orcaq 1.0.20

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 (1018) hide show
  1. package/.output/nitro.json +15 -0
  2. package/.output/public/_nuxt/8qASMGdV.js +1 -0
  3. package/.output/public/_nuxt/9lJACZIQ.js +19 -0
  4. package/.output/public/_nuxt/B2DnNiWd.js +1 -0
  5. package/.output/public/_nuxt/B6E6ObS_.js +8 -0
  6. package/.output/public/_nuxt/BH83_dXo.js +39 -0
  7. package/.output/public/_nuxt/BIKqrFbQ.js +1 -0
  8. package/.output/public/_nuxt/BNjPC06x.js +1 -0
  9. package/.output/public/_nuxt/BPQ-Pz1w.js +39 -0
  10. package/.output/public/_nuxt/BRpgKkVT.js +51 -0
  11. package/.output/public/_nuxt/BTCLPbPY.js +4 -0
  12. package/.output/public/_nuxt/BUV-RarV.js +1 -0
  13. package/.output/public/_nuxt/Bh6RgYlO.js +1 -0
  14. package/.output/public/_nuxt/Bq3cyzOD.js +1 -0
  15. package/.output/public/_nuxt/Bt9sU68B.js +9 -0
  16. package/.output/public/_nuxt/BwpH2ZxJ.js +1 -0
  17. package/.output/public/_nuxt/C25Tmn1m.js +1 -0
  18. package/.output/public/_nuxt/C2HlI1ss.js +1 -0
  19. package/.output/public/_nuxt/CU3ZV9iV.js +1 -0
  20. package/.output/public/_nuxt/CbcyysXi.js +1 -0
  21. package/.output/public/_nuxt/CepyvMhE.js +1 -0
  22. package/.output/public/_nuxt/CrgoNCm2.js +2 -0
  23. package/.output/public/_nuxt/CuBKbBH_.js +1 -0
  24. package/.output/public/_nuxt/CulD8qYQ.js +193 -0
  25. package/.output/public/_nuxt/CustomEdge.BNBpjEHb.css +1 -0
  26. package/.output/public/_nuxt/CylkLpwm.js +1 -0
  27. package/.output/public/_nuxt/D-bWLYHw.js +1 -0
  28. package/.output/public/_nuxt/D-zecHND.js +1 -0
  29. package/.output/public/_nuxt/D8vj6kFe.js +160 -0
  30. package/.output/public/_nuxt/DIETYtCL.js +1 -0
  31. package/.output/public/_nuxt/DJ4vUzxS.js +1 -0
  32. package/.output/public/_nuxt/DK-itzXx.js +8 -0
  33. package/.output/public/_nuxt/DL3T5jYo.js +3867 -0
  34. package/.output/public/_nuxt/DUsuhY9i.js +1 -0
  35. package/.output/public/_nuxt/DXV2HFBA.js +224 -0
  36. package/.output/public/_nuxt/Dh2zppOR.js +1 -0
  37. package/.output/public/_nuxt/DlAUqK2U.js +1 -0
  38. package/.output/public/_nuxt/DlmSeCnw.js +5 -0
  39. package/.output/public/_nuxt/DswTpYG4.js +1 -0
  40. package/.output/public/_nuxt/DynamicTable.DJeANwbG.css +1 -0
  41. package/.output/public/_nuxt/G830WtVn.js +1 -0
  42. package/.output/public/_nuxt/ICwM1E4-.js +15 -0
  43. package/.output/public/_nuxt/QZbJy9YW.js +31 -0
  44. package/.output/public/_nuxt/QuickQueryTable.DS_ON57S.css +1 -0
  45. package/.output/public/_nuxt/UXhX8z2W.js +1 -0
  46. package/.output/public/_nuxt/WrapperErdDiagram.DwhUd9Wr.css +1 -0
  47. package/.output/public/_nuxt/_fileId_.DmPfwyyD.css +1 -0
  48. package/.output/public/_nuxt/_tabViewId_.9Axt3zoi.css +1 -0
  49. package/.output/public/_nuxt/builds/latest.json +1 -0
  50. package/.output/public/_nuxt/builds/meta/6364d5cf-4642-479f-ba12-6440c56702af.json +1 -0
  51. package/.output/public/_nuxt/default.DixIpIal.css +1 -0
  52. package/.output/public/_nuxt/entry.GqPNPe1e.css +1 -0
  53. package/.output/public/_nuxt/index.CrXmf4gr.css +1 -0
  54. package/.output/public/_nuxt/ivUnXl9B.js +1 -0
  55. package/.output/public/_nuxt/pAheHeBV.js +36 -0
  56. package/.output/public/_nuxt/s5fCn4j5.js +1 -0
  57. package/.output/public/favicon.ico +0 -0
  58. package/.output/public/logo.png +0 -0
  59. package/.output/public/manifest.json +25 -0
  60. package/.output/public/robots.txt +1 -0
  61. package/.output/public/vite.svg +1 -0
  62. package/.output/server/chunks/_/error-500.mjs +8 -0
  63. package/.output/server/chunks/_/error-500.mjs.map +1 -0
  64. package/.output/server/chunks/build/client.manifest.mjs +773 -0
  65. package/.output/server/chunks/build/client.manifest.mjs.map +1 -0
  66. package/.output/server/chunks/nitro/nitro.mjs +6432 -0
  67. package/.output/server/chunks/nitro/nitro.mjs.map +1 -0
  68. package/.output/server/chunks/routes/api/ai/chat.mjs +77 -0
  69. package/.output/server/chunks/routes/api/ai/chat.mjs.map +1 -0
  70. package/.output/server/chunks/routes/api/execute-bulk-delete.mjs +100 -0
  71. package/.output/server/chunks/routes/api/execute-bulk-delete.mjs.map +1 -0
  72. package/.output/server/chunks/routes/api/execute-bulk-update.mjs +105 -0
  73. package/.output/server/chunks/routes/api/execute-bulk-update.mjs.map +1 -0
  74. package/.output/server/chunks/routes/api/execute.mjs +47 -0
  75. package/.output/server/chunks/routes/api/execute.mjs.map +1 -0
  76. package/.output/server/chunks/routes/api/get-one-function.mjs +28 -0
  77. package/.output/server/chunks/routes/api/get-one-function.mjs.map +1 -0
  78. package/.output/server/chunks/routes/api/get-one-table.mjs +180 -0
  79. package/.output/server/chunks/routes/api/get-one-table.mjs.map +1 -0
  80. package/.output/server/chunks/routes/api/get-over-view-function.mjs +41 -0
  81. package/.output/server/chunks/routes/api/get-over-view-function.mjs.map +1 -0
  82. package/.output/server/chunks/routes/api/get-over-view-tables.mjs +53 -0
  83. package/.output/server/chunks/routes/api/get-over-view-tables.mjs.map +1 -0
  84. package/.output/server/chunks/routes/api/get-reverse-table-schemas.mjs +112 -0
  85. package/.output/server/chunks/routes/api/get-reverse-table-schemas.mjs.map +1 -0
  86. package/.output/server/chunks/routes/api/get-schema-meta-data.mjs +152 -0
  87. package/.output/server/chunks/routes/api/get-schema-meta-data.mjs.map +1 -0
  88. package/.output/server/chunks/routes/api/get-table-size.mjs +49 -0
  89. package/.output/server/chunks/routes/api/get-table-size.mjs.map +1 -0
  90. package/.output/server/chunks/routes/api/get-table-structure.mjs +111 -0
  91. package/.output/server/chunks/routes/api/get-table-structure.mjs.map +1 -0
  92. package/.output/server/chunks/routes/api/get-tables.mjs +287 -0
  93. package/.output/server/chunks/routes/api/get-tables.mjs.map +1 -0
  94. package/.output/server/chunks/routes/api/getMetricMonitor.mjs +46 -0
  95. package/.output/server/chunks/routes/api/getMetricMonitor.mjs.map +1 -0
  96. package/.output/server/chunks/routes/api/managment-connection/health-check.mjs +28 -0
  97. package/.output/server/chunks/routes/api/managment-connection/health-check.mjs.map +1 -0
  98. package/.output/server/chunks/routes/api/raw-execute.mjs +48 -0
  99. package/.output/server/chunks/routes/api/raw-execute.mjs.map +1 -0
  100. package/.output/server/chunks/routes/renderer.mjs +316 -0
  101. package/.output/server/chunks/routes/renderer.mjs.map +1 -0
  102. package/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
  103. package/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
  104. package/.output/server/index.mjs +14 -0
  105. package/.output/server/index.mjs.map +1 -0
  106. package/.output/server/node_modules/@ai-sdk/anthropic/dist/index.mjs +4374 -0
  107. package/.output/server/node_modules/@ai-sdk/anthropic/package.json +74 -0
  108. package/.output/server/node_modules/@ai-sdk/gateway/dist/index.mjs +1082 -0
  109. package/.output/server/node_modules/@ai-sdk/gateway/package.json +69 -0
  110. package/.output/server/node_modules/@ai-sdk/google/dist/index.mjs +2007 -0
  111. package/.output/server/node_modules/@ai-sdk/google/package.json +74 -0
  112. package/.output/server/node_modules/@ai-sdk/openai/dist/index.mjs +5956 -0
  113. package/.output/server/node_modules/@ai-sdk/openai/package.json +74 -0
  114. package/.output/server/node_modules/@ai-sdk/openai-compatible/dist/index.mjs +1551 -0
  115. package/.output/server/node_modules/@ai-sdk/openai-compatible/package.json +74 -0
  116. package/.output/server/node_modules/@ai-sdk/provider/dist/index.mjs +377 -0
  117. package/.output/server/node_modules/@ai-sdk/provider/package.json +57 -0
  118. package/.output/server/node_modules/@ai-sdk/provider-utils/dist/index.mjs +2549 -0
  119. package/.output/server/node_modules/@ai-sdk/provider-utils/package.json +75 -0
  120. package/.output/server/node_modules/@ai-sdk/xai/dist/index.mjs +2214 -0
  121. package/.output/server/node_modules/@ai-sdk/xai/package.json +68 -0
  122. package/.output/server/node_modules/@babel/parser/lib/index.js +14246 -0
  123. package/.output/server/node_modules/@babel/parser/package.json +50 -0
  124. package/.output/server/node_modules/@iconify/utils/lib/colors/index.mjs +350 -0
  125. package/.output/server/node_modules/@iconify/utils/lib/colors/keywords.mjs +188 -0
  126. package/.output/server/node_modules/@iconify/utils/lib/css/common.mjs +90 -0
  127. package/.output/server/node_modules/@iconify/utils/lib/css/format.mjs +38 -0
  128. package/.output/server/node_modules/@iconify/utils/lib/css/icon.mjs +76 -0
  129. package/.output/server/node_modules/@iconify/utils/lib/css/icons.mjs +168 -0
  130. package/.output/server/node_modules/@iconify/utils/lib/customisations/bool.mjs +22 -0
  131. package/.output/server/node_modules/@iconify/utils/lib/customisations/defaults.mjs +14 -0
  132. package/.output/server/node_modules/@iconify/utils/lib/customisations/flip.mjs +16 -0
  133. package/.output/server/node_modules/@iconify/utils/lib/customisations/merge.mjs +22 -0
  134. package/.output/server/node_modules/@iconify/utils/lib/customisations/rotate.mjs +33 -0
  135. package/.output/server/node_modules/@iconify/utils/lib/emoji/cleanup.mjs +51 -0
  136. package/.output/server/node_modules/@iconify/utils/lib/emoji/convert.mjs +84 -0
  137. package/.output/server/node_modules/@iconify/utils/lib/emoji/data.mjs +16 -0
  138. package/.output/server/node_modules/@iconify/utils/lib/emoji/format.mjs +44 -0
  139. package/.output/server/node_modules/@iconify/utils/lib/emoji/parse.mjs +58 -0
  140. package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/base.mjs +231 -0
  141. package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/create.mjs +31 -0
  142. package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/numbers.mjs +164 -0
  143. package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/similar.mjs +216 -0
  144. package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/tree.mjs +113 -0
  145. package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/find.mjs +104 -0
  146. package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/replace.mjs +34 -0
  147. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/components.mjs +75 -0
  148. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/missing.mjs +97 -0
  149. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/name.mjs +54 -0
  150. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/parse.mjs +97 -0
  151. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/similar.mjs +45 -0
  152. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/tree.mjs +105 -0
  153. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/variations.mjs +54 -0
  154. package/.output/server/node_modules/@iconify/utils/lib/icon/defaults.mjs +24 -0
  155. package/.output/server/node_modules/@iconify/utils/lib/icon/merge.mjs +20 -0
  156. package/.output/server/node_modules/@iconify/utils/lib/icon/name.mjs +53 -0
  157. package/.output/server/node_modules/@iconify/utils/lib/icon/square.mjs +23 -0
  158. package/.output/server/node_modules/@iconify/utils/lib/icon/transformations.mjs +16 -0
  159. package/.output/server/node_modules/@iconify/utils/lib/icon-set/convert-info.mjs +182 -0
  160. package/.output/server/node_modules/@iconify/utils/lib/icon-set/expand.mjs +22 -0
  161. package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icon.mjs +28 -0
  162. package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icons.mjs +46 -0
  163. package/.output/server/node_modules/@iconify/utils/lib/icon-set/minify.mjs +66 -0
  164. package/.output/server/node_modules/@iconify/utils/lib/icon-set/parse.mjs +51 -0
  165. package/.output/server/node_modules/@iconify/utils/lib/icon-set/tree.mjs +23 -0
  166. package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate-basic.mjs +62 -0
  167. package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate.mjs +161 -0
  168. package/.output/server/node_modules/@iconify/utils/lib/index.mjs +64 -0
  169. package/.output/server/node_modules/@iconify/utils/lib/loader/custom.mjs +50 -0
  170. package/.output/server/node_modules/@iconify/utils/lib/loader/loader.mjs +59 -0
  171. package/.output/server/node_modules/@iconify/utils/lib/loader/modern.mjs +80 -0
  172. package/.output/server/node_modules/@iconify/utils/lib/loader/utils.mjs +92 -0
  173. package/.output/server/node_modules/@iconify/utils/lib/misc/objects.mjs +30 -0
  174. package/.output/server/node_modules/@iconify/utils/lib/misc/strings.mjs +17 -0
  175. package/.output/server/node_modules/@iconify/utils/lib/misc/title.mjs +5 -0
  176. package/.output/server/node_modules/@iconify/utils/lib/svg/build.mjs +119 -0
  177. package/.output/server/node_modules/@iconify/utils/lib/svg/defs.mjs +30 -0
  178. package/.output/server/node_modules/@iconify/utils/lib/svg/encode-svg-for-css.mjs +20 -0
  179. package/.output/server/node_modules/@iconify/utils/lib/svg/html.mjs +9 -0
  180. package/.output/server/node_modules/@iconify/utils/lib/svg/id.mjs +28 -0
  181. package/.output/server/node_modules/@iconify/utils/lib/svg/inner-html.mjs +19 -0
  182. package/.output/server/node_modules/@iconify/utils/lib/svg/parse.mjs +83 -0
  183. package/.output/server/node_modules/@iconify/utils/lib/svg/pretty.mjs +70 -0
  184. package/.output/server/node_modules/@iconify/utils/lib/svg/size.mjs +40 -0
  185. package/.output/server/node_modules/@iconify/utils/lib/svg/trim.mjs +5 -0
  186. package/.output/server/node_modules/@iconify/utils/lib/svg/url.mjs +11 -0
  187. package/.output/server/node_modules/@iconify/utils/lib/svg/viewbox.mjs +8 -0
  188. package/.output/server/node_modules/@iconify/utils/package.json +447 -0
  189. package/.output/server/node_modules/@ioredis/commands/built/commands.json +2447 -0
  190. package/.output/server/node_modules/@ioredis/commands/built/index.js +208 -0
  191. package/.output/server/node_modules/@ioredis/commands/package.json +52 -0
  192. package/.output/server/node_modules/@opentelemetry/api/build/src/api/context.js +81 -0
  193. package/.output/server/node_modules/@opentelemetry/api/build/src/api/diag.js +93 -0
  194. package/.output/server/node_modules/@opentelemetry/api/build/src/api/metrics.js +61 -0
  195. package/.output/server/node_modules/@opentelemetry/api/build/src/api/propagation.js +89 -0
  196. package/.output/server/node_modules/@opentelemetry/api/build/src/api/trace.js +79 -0
  197. package/.output/server/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.js +63 -0
  198. package/.output/server/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.js +55 -0
  199. package/.output/server/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.js +23 -0
  200. package/.output/server/node_modules/@opentelemetry/api/build/src/baggage/utils.js +51 -0
  201. package/.output/server/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js +38 -0
  202. package/.output/server/node_modules/@opentelemetry/api/build/src/context/context.js +55 -0
  203. package/.output/server/node_modules/@opentelemetry/api/build/src/context-api.js +24 -0
  204. package/.output/server/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js +59 -0
  205. package/.output/server/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js +57 -0
  206. package/.output/server/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.js +45 -0
  207. package/.output/server/node_modules/@opentelemetry/api/build/src/diag/types.js +44 -0
  208. package/.output/server/node_modules/@opentelemetry/api/build/src/diag-api.js +29 -0
  209. package/.output/server/node_modules/@opentelemetry/api/build/src/index.js +81 -0
  210. package/.output/server/node_modules/@opentelemetry/api/build/src/internal/global-utils.js +64 -0
  211. package/.output/server/node_modules/@opentelemetry/api/build/src/internal/semver.js +122 -0
  212. package/.output/server/node_modules/@opentelemetry/api/build/src/metrics/Metric.js +25 -0
  213. package/.output/server/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.js +127 -0
  214. package/.output/server/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.js +31 -0
  215. package/.output/server/node_modules/@opentelemetry/api/build/src/metrics-api.js +24 -0
  216. package/.output/server/node_modules/@opentelemetry/api/build/src/platform/index.js +29 -0
  217. package/.output/server/node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js +22 -0
  218. package/.output/server/node_modules/@opentelemetry/api/build/src/platform/node/index.js +29 -0
  219. package/.output/server/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.js +34 -0
  220. package/.output/server/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.js +41 -0
  221. package/.output/server/node_modules/@opentelemetry/api/build/src/propagation-api.js +24 -0
  222. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.js +69 -0
  223. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js +75 -0
  224. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js +32 -0
  225. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js +55 -0
  226. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.js +54 -0
  227. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js +42 -0
  228. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/context-utils.js +82 -0
  229. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.js +103 -0
  230. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.js +46 -0
  231. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/internal/utils.js +24 -0
  232. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.js +27 -0
  233. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/span_kind.js +46 -0
  234. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.js +49 -0
  235. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/status.js +23 -0
  236. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/trace_flags.js +26 -0
  237. package/.output/server/node_modules/@opentelemetry/api/build/src/trace-api.js +24 -0
  238. package/.output/server/node_modules/@opentelemetry/api/build/src/version.js +21 -0
  239. package/.output/server/node_modules/@opentelemetry/api/package.json +113 -0
  240. package/.output/server/node_modules/@sqltools/formatter/lib/core/Formatter.js +234 -0
  241. package/.output/server/node_modules/@sqltools/formatter/lib/core/Indentation.js +42 -0
  242. package/.output/server/node_modules/@sqltools/formatter/lib/core/InlineBlock.js +60 -0
  243. package/.output/server/node_modules/@sqltools/formatter/lib/core/Params.js +21 -0
  244. package/.output/server/node_modules/@sqltools/formatter/lib/core/Tokenizer.js +272 -0
  245. package/.output/server/node_modules/@sqltools/formatter/lib/core/escapeRegExp.js +10 -0
  246. package/.output/server/node_modules/@sqltools/formatter/lib/core/last.js +7 -0
  247. package/.output/server/node_modules/@sqltools/formatter/lib/core/types.js +22 -0
  248. package/.output/server/node_modules/@sqltools/formatter/lib/languages/Db2Formatter.js +585 -0
  249. package/.output/server/node_modules/@sqltools/formatter/lib/languages/N1qlFormatter.js +257 -0
  250. package/.output/server/node_modules/@sqltools/formatter/lib/languages/PlSqlFormatter.js +459 -0
  251. package/.output/server/node_modules/@sqltools/formatter/lib/languages/StandardSqlFormatter.js +369 -0
  252. package/.output/server/node_modules/@sqltools/formatter/lib/languages/utils/abstract.js +23 -0
  253. package/.output/server/node_modules/@sqltools/formatter/lib/sqlFormatter.js +34 -0
  254. package/.output/server/node_modules/@sqltools/formatter/package.json +59 -0
  255. package/.output/server/node_modules/@standard-schema/spec/dist/index.js +0 -0
  256. package/.output/server/node_modules/@standard-schema/spec/package.json +52 -0
  257. package/.output/server/node_modules/@vercel/oidc/dist/auth-config.js +84 -0
  258. package/.output/server/node_modules/@vercel/oidc/dist/get-context.js +34 -0
  259. package/.output/server/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js +80 -0
  260. package/.output/server/node_modules/@vercel/oidc/dist/index.js +33 -0
  261. package/.output/server/node_modules/@vercel/oidc/dist/oauth.js +88 -0
  262. package/.output/server/node_modules/@vercel/oidc/dist/token-error.js +40 -0
  263. package/.output/server/node_modules/@vercel/oidc/dist/token-io.js +78 -0
  264. package/.output/server/node_modules/@vercel/oidc/dist/token-util.js +198 -0
  265. package/.output/server/node_modules/@vercel/oidc/dist/token.js +53 -0
  266. package/.output/server/node_modules/@vercel/oidc/package.json +52 -0
  267. package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6690 -0
  268. package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
  269. package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +686 -0
  270. package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
  271. package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1404 -0
  272. package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  273. package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1789 -0
  274. package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
  275. package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6654 -0
  276. package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
  277. package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1669 -0
  278. package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
  279. package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +857 -0
  280. package/.output/server/node_modules/@vue/server-renderer/package.json +55 -0
  281. package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +594 -0
  282. package/.output/server/node_modules/@vue/shared/package.json +47 -0
  283. package/.output/server/node_modules/ai/dist/index.mjs +12363 -0
  284. package/.output/server/node_modules/ai/package.json +106 -0
  285. package/.output/server/node_modules/ansis/index.js +1 -0
  286. package/.output/server/node_modules/ansis/package.json +28 -0
  287. package/.output/server/node_modules/app-root-path/index.js +4 -0
  288. package/.output/server/node_modules/app-root-path/lib/app-root-path.js +30 -0
  289. package/.output/server/node_modules/app-root-path/lib/resolve.js +128 -0
  290. package/.output/server/node_modules/app-root-path/package.json +66 -0
  291. package/.output/server/node_modules/balanced-match/index.js +62 -0
  292. package/.output/server/node_modules/balanced-match/package.json +48 -0
  293. package/.output/server/node_modules/bindings/bindings.js +221 -0
  294. package/.output/server/node_modules/bindings/package.json +28 -0
  295. package/.output/server/node_modules/brace-expansion/index.js +203 -0
  296. package/.output/server/node_modules/brace-expansion/package.json +46 -0
  297. package/.output/server/node_modules/cluster-key-slot/lib/index.js +166 -0
  298. package/.output/server/node_modules/cluster-key-slot/package.json +56 -0
  299. package/.output/server/node_modules/consola/dist/chunks/prompt.mjs +280 -0
  300. package/.output/server/node_modules/consola/dist/core.mjs +512 -0
  301. package/.output/server/node_modules/consola/dist/index.mjs +651 -0
  302. package/.output/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
  303. package/.output/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
  304. package/.output/server/node_modules/consola/package.json +136 -0
  305. package/.output/server/node_modules/dayjs/dayjs.min.js +1 -0
  306. package/.output/server/node_modules/dayjs/package.json +84 -0
  307. package/.output/server/node_modules/debug/package.json +65 -0
  308. package/.output/server/node_modules/debug/src/browser.js +272 -0
  309. package/.output/server/node_modules/debug/src/common.js +292 -0
  310. package/.output/server/node_modules/debug/src/index.js +10 -0
  311. package/.output/server/node_modules/debug/src/node.js +263 -0
  312. package/.output/server/node_modules/dedent/dist/dedent.js +73 -0
  313. package/.output/server/node_modules/dedent/package.json +119 -0
  314. package/.output/server/node_modules/denque/index.js +481 -0
  315. package/.output/server/node_modules/denque/package.json +58 -0
  316. package/.output/server/node_modules/devalue/index.js +3 -0
  317. package/.output/server/node_modules/devalue/package.json +34 -0
  318. package/.output/server/node_modules/devalue/src/base64.js +110 -0
  319. package/.output/server/node_modules/devalue/src/constants.js +6 -0
  320. package/.output/server/node_modules/devalue/src/parse.js +160 -0
  321. package/.output/server/node_modules/devalue/src/stringify.js +232 -0
  322. package/.output/server/node_modules/devalue/src/uneval.js +351 -0
  323. package/.output/server/node_modules/devalue/src/utils.js +113 -0
  324. package/.output/server/node_modules/dotenv/lib/main.js +361 -0
  325. package/.output/server/node_modules/dotenv/package.json +61 -0
  326. package/.output/server/node_modules/entities/lib/decode.js +536 -0
  327. package/.output/server/node_modules/entities/lib/decode_codepoint.js +76 -0
  328. package/.output/server/node_modules/entities/lib/generated/decode-data-html.js +9 -0
  329. package/.output/server/node_modules/entities/lib/generated/decode-data-xml.js +9 -0
  330. package/.output/server/node_modules/entities/package.json +90 -0
  331. package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  332. package/.output/server/node_modules/estree-walker/package.json +37 -0
  333. package/.output/server/node_modules/eventsource-parser/dist/index.js +106 -0
  334. package/.output/server/node_modules/eventsource-parser/dist/stream.js +29 -0
  335. package/.output/server/node_modules/eventsource-parser/package.json +115 -0
  336. package/.output/server/node_modules/file-uri-to-path/index.js +66 -0
  337. package/.output/server/node_modules/file-uri-to-path/package.json +32 -0
  338. package/.output/server/node_modules/glob/dist/commonjs/glob.js +247 -0
  339. package/.output/server/node_modules/glob/dist/commonjs/has-magic.js +27 -0
  340. package/.output/server/node_modules/glob/dist/commonjs/ignore.js +119 -0
  341. package/.output/server/node_modules/glob/dist/commonjs/index.js +68 -0
  342. package/.output/server/node_modules/glob/dist/commonjs/package.json +3 -0
  343. package/.output/server/node_modules/glob/dist/commonjs/pattern.js +219 -0
  344. package/.output/server/node_modules/glob/dist/commonjs/processor.js +301 -0
  345. package/.output/server/node_modules/glob/dist/commonjs/walker.js +387 -0
  346. package/.output/server/node_modules/glob/package.json +99 -0
  347. package/.output/server/node_modules/has-flag/index.js +8 -0
  348. package/.output/server/node_modules/has-flag/package.json +46 -0
  349. package/.output/server/node_modules/hookable/dist/index.mjs +290 -0
  350. package/.output/server/node_modules/hookable/package.json +49 -0
  351. package/.output/server/node_modules/inherits/inherits.js +9 -0
  352. package/.output/server/node_modules/inherits/inherits_browser.js +27 -0
  353. package/.output/server/node_modules/inherits/package.json +29 -0
  354. package/.output/server/node_modules/ioredis/built/Command.js +349 -0
  355. package/.output/server/node_modules/ioredis/built/DataHandler.js +220 -0
  356. package/.output/server/node_modules/ioredis/built/Pipeline.js +334 -0
  357. package/.output/server/node_modules/ioredis/built/Redis.js +697 -0
  358. package/.output/server/node_modules/ioredis/built/ScanStream.js +51 -0
  359. package/.output/server/node_modules/ioredis/built/Script.js +62 -0
  360. package/.output/server/node_modules/ioredis/built/SubscriptionSet.js +41 -0
  361. package/.output/server/node_modules/ioredis/built/autoPipelining.js +159 -0
  362. package/.output/server/node_modules/ioredis/built/cluster/ClusterOptions.js +22 -0
  363. package/.output/server/node_modules/ioredis/built/cluster/ClusterSubscriber.js +202 -0
  364. package/.output/server/node_modules/ioredis/built/cluster/ClusterSubscriberGroup.js +224 -0
  365. package/.output/server/node_modules/ioredis/built/cluster/ConnectionPool.js +154 -0
  366. package/.output/server/node_modules/ioredis/built/cluster/DelayQueue.js +53 -0
  367. package/.output/server/node_modules/ioredis/built/cluster/index.js +862 -0
  368. package/.output/server/node_modules/ioredis/built/cluster/util.js +100 -0
  369. package/.output/server/node_modules/ioredis/built/connectors/AbstractConnector.js +26 -0
  370. package/.output/server/node_modules/ioredis/built/connectors/SentinelConnector/FailoverDetector.js +45 -0
  371. package/.output/server/node_modules/ioredis/built/connectors/SentinelConnector/SentinelIterator.js +37 -0
  372. package/.output/server/node_modules/ioredis/built/connectors/SentinelConnector/index.js +305 -0
  373. package/.output/server/node_modules/ioredis/built/connectors/StandaloneConnector.js +69 -0
  374. package/.output/server/node_modules/ioredis/built/connectors/index.js +7 -0
  375. package/.output/server/node_modules/ioredis/built/constants/TLSProfiles.js +149 -0
  376. package/.output/server/node_modules/ioredis/built/errors/ClusterAllFailedError.js +15 -0
  377. package/.output/server/node_modules/ioredis/built/errors/MaxRetriesPerRequestError.js +14 -0
  378. package/.output/server/node_modules/ioredis/built/errors/index.js +5 -0
  379. package/.output/server/node_modules/ioredis/built/index.js +62 -0
  380. package/.output/server/node_modules/ioredis/built/redis/RedisOptions.js +55 -0
  381. package/.output/server/node_modules/ioredis/built/redis/event_handler.js +292 -0
  382. package/.output/server/node_modules/ioredis/built/transaction.js +93 -0
  383. package/.output/server/node_modules/ioredis/built/utils/Commander.js +117 -0
  384. package/.output/server/node_modules/ioredis/built/utils/applyMixin.js +8 -0
  385. package/.output/server/node_modules/ioredis/built/utils/debug.js +95 -0
  386. package/.output/server/node_modules/ioredis/built/utils/index.js +297 -0
  387. package/.output/server/node_modules/ioredis/built/utils/lodash.js +9 -0
  388. package/.output/server/node_modules/ioredis/package.json +100 -0
  389. package/.output/server/node_modules/lodash.defaults/index.js +668 -0
  390. package/.output/server/node_modules/lodash.defaults/package.json +19 -0
  391. package/.output/server/node_modules/lodash.isarguments/index.js +229 -0
  392. package/.output/server/node_modules/lodash.isarguments/package.json +19 -0
  393. package/.output/server/node_modules/lru-cache/dist/commonjs/index.js +1546 -0
  394. package/.output/server/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  395. package/.output/server/node_modules/lru-cache/package.json +116 -0
  396. package/.output/server/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  397. package/.output/server/node_modules/minimatch/dist/commonjs/ast.js +592 -0
  398. package/.output/server/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
  399. package/.output/server/node_modules/minimatch/dist/commonjs/escape.js +22 -0
  400. package/.output/server/node_modules/minimatch/dist/commonjs/index.js +1017 -0
  401. package/.output/server/node_modules/minimatch/dist/commonjs/package.json +3 -0
  402. package/.output/server/node_modules/minimatch/dist/commonjs/unescape.js +24 -0
  403. package/.output/server/node_modules/minimatch/package.json +82 -0
  404. package/.output/server/node_modules/minipass/dist/commonjs/index.js +1028 -0
  405. package/.output/server/node_modules/minipass/dist/commonjs/package.json +3 -0
  406. package/.output/server/node_modules/minipass/package.json +82 -0
  407. package/.output/server/node_modules/ms/index.js +162 -0
  408. package/.output/server/node_modules/ms/package.json +38 -0
  409. package/.output/server/node_modules/path-scurry/dist/commonjs/index.js +2014 -0
  410. package/.output/server/node_modules/path-scurry/dist/commonjs/package.json +3 -0
  411. package/.output/server/node_modules/path-scurry/package.json +89 -0
  412. package/.output/server/node_modules/pg/lib/client.js +650 -0
  413. package/.output/server/node_modules/pg/lib/connection-parameters.js +167 -0
  414. package/.output/server/node_modules/pg/lib/connection.js +222 -0
  415. package/.output/server/node_modules/pg/lib/crypto/cert-signatures.js +121 -0
  416. package/.output/server/node_modules/pg/lib/crypto/sasl.js +212 -0
  417. package/.output/server/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
  418. package/.output/server/node_modules/pg/lib/crypto/utils-webcrypto.js +88 -0
  419. package/.output/server/node_modules/pg/lib/crypto/utils.js +9 -0
  420. package/.output/server/node_modules/pg/lib/defaults.js +84 -0
  421. package/.output/server/node_modules/pg/lib/index.js +58 -0
  422. package/.output/server/node_modules/pg/lib/native/client.js +307 -0
  423. package/.output/server/node_modules/pg/lib/native/index.js +2 -0
  424. package/.output/server/node_modules/pg/lib/native/query.js +168 -0
  425. package/.output/server/node_modules/pg/lib/query.js +253 -0
  426. package/.output/server/node_modules/pg/lib/result.js +108 -0
  427. package/.output/server/node_modules/pg/lib/stream.js +81 -0
  428. package/.output/server/node_modules/pg/lib/type-overrides.js +35 -0
  429. package/.output/server/node_modules/pg/lib/utils.js +206 -0
  430. package/.output/server/node_modules/pg/package.json +62 -0
  431. package/.output/server/node_modules/pg-cloudflare/dist/empty.js +4 -0
  432. package/.output/server/node_modules/pg-cloudflare/package.json +32 -0
  433. package/.output/server/node_modules/pg-connection-string/index.js +112 -0
  434. package/.output/server/node_modules/pg-connection-string/package.json +40 -0
  435. package/.output/server/node_modules/pg-cursor/index.js +265 -0
  436. package/.output/server/node_modules/pg-cursor/package.json +38 -0
  437. package/.output/server/node_modules/pg-int8/index.js +100 -0
  438. package/.output/server/node_modules/pg-int8/package.json +24 -0
  439. package/.output/server/node_modules/pg-pool/index.js +471 -0
  440. package/.output/server/node_modules/pg-pool/package.json +41 -0
  441. package/.output/server/node_modules/pg-protocol/dist/buffer-reader.js +55 -0
  442. package/.output/server/node_modules/pg-protocol/dist/buffer-writer.js +81 -0
  443. package/.output/server/node_modules/pg-protocol/dist/index.js +15 -0
  444. package/.output/server/node_modules/pg-protocol/dist/messages.js +160 -0
  445. package/.output/server/node_modules/pg-protocol/dist/parser.js +304 -0
  446. package/.output/server/node_modules/pg-protocol/dist/serializer.js +189 -0
  447. package/.output/server/node_modules/pg-protocol/package.json +35 -0
  448. package/.output/server/node_modules/pg-query-stream/dist/index.js +48 -0
  449. package/.output/server/node_modules/pg-query-stream/package.json +60 -0
  450. package/.output/server/node_modules/pg-types/index.js +47 -0
  451. package/.output/server/node_modules/pg-types/lib/arrayParser.js +11 -0
  452. package/.output/server/node_modules/pg-types/lib/binaryParsers.js +257 -0
  453. package/.output/server/node_modules/pg-types/lib/builtins.js +73 -0
  454. package/.output/server/node_modules/pg-types/lib/textParsers.js +215 -0
  455. package/.output/server/node_modules/pg-types/package.json +42 -0
  456. package/.output/server/node_modules/pgpass/lib/helper.js +233 -0
  457. package/.output/server/node_modules/pgpass/lib/index.js +23 -0
  458. package/.output/server/node_modules/pgpass/package.json +41 -0
  459. package/.output/server/node_modules/postgres-array/index.js +97 -0
  460. package/.output/server/node_modules/postgres-array/package.json +35 -0
  461. package/.output/server/node_modules/postgres-bytea/index.js +31 -0
  462. package/.output/server/node_modules/postgres-bytea/package.json +34 -0
  463. package/.output/server/node_modules/postgres-date/index.js +116 -0
  464. package/.output/server/node_modules/postgres-date/package.json +33 -0
  465. package/.output/server/node_modules/postgres-interval/index.js +125 -0
  466. package/.output/server/node_modules/postgres-interval/package.json +36 -0
  467. package/.output/server/node_modules/redis-errors/index.js +7 -0
  468. package/.output/server/node_modules/redis-errors/lib/modern.js +59 -0
  469. package/.output/server/node_modules/redis-errors/lib/old.js +119 -0
  470. package/.output/server/node_modules/redis-errors/package.json +41 -0
  471. package/.output/server/node_modules/redis-parser/index.js +3 -0
  472. package/.output/server/node_modules/redis-parser/lib/parser.js +552 -0
  473. package/.output/server/node_modules/redis-parser/package.json +53 -0
  474. package/.output/server/node_modules/reflect-metadata/Reflect.js +1415 -0
  475. package/.output/server/node_modules/reflect-metadata/package.json +68 -0
  476. package/.output/server/node_modules/safe-buffer/index.js +65 -0
  477. package/.output/server/node_modules/safe-buffer/package.json +51 -0
  478. package/.output/server/node_modules/sha.js/hash.js +81 -0
  479. package/.output/server/node_modules/sha.js/index.js +15 -0
  480. package/.output/server/node_modules/sha.js/package.json +30 -0
  481. package/.output/server/node_modules/sha.js/sha.js +94 -0
  482. package/.output/server/node_modules/sha.js/sha1.js +99 -0
  483. package/.output/server/node_modules/sha.js/sha224.js +53 -0
  484. package/.output/server/node_modules/sha.js/sha256.js +135 -0
  485. package/.output/server/node_modules/sha.js/sha384.js +57 -0
  486. package/.output/server/node_modules/sha.js/sha512.js +260 -0
  487. package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
  488. package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  489. package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
  490. package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
  491. package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
  492. package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
  493. package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  494. package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  495. package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
  496. package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
  497. package/.output/server/node_modules/source-map-js/package.json +71 -0
  498. package/.output/server/node_modules/source-map-js/source-map.js +8 -0
  499. package/.output/server/node_modules/split2/index.js +141 -0
  500. package/.output/server/node_modules/split2/package.json +39 -0
  501. package/.output/server/node_modules/sql-highlight/lib/escapeHtml.js +59 -0
  502. package/.output/server/node_modules/sql-highlight/lib/index.js +85 -0
  503. package/.output/server/node_modules/sql-highlight/lib/keywords.js +145 -0
  504. package/.output/server/node_modules/sql-highlight/package.json +49 -0
  505. package/.output/server/node_modules/sqlite3/build/Release/node_sqlite3.node +0 -0
  506. package/.output/server/node_modules/sqlite3/build/Release/node_sqlite3.node.bak +0 -0
  507. package/.output/server/node_modules/sqlite3/lib/sqlite3-binding.js +1 -0
  508. package/.output/server/node_modules/sqlite3/lib/sqlite3.js +207 -0
  509. package/.output/server/node_modules/sqlite3/lib/trace.js +38 -0
  510. package/.output/server/node_modules/sqlite3/package.json +89 -0
  511. package/.output/server/node_modules/standard-as-callback/built/index.js +41 -0
  512. package/.output/server/node_modules/standard-as-callback/built/utils.js +23 -0
  513. package/.output/server/node_modules/standard-as-callback/package.json +40 -0
  514. package/.output/server/node_modules/supports-color/index.js +152 -0
  515. package/.output/server/node_modules/supports-color/package.json +58 -0
  516. package/.output/server/node_modules/tslib/package.json +47 -0
  517. package/.output/server/node_modules/tslib/tslib.js +484 -0
  518. package/.output/server/node_modules/typeorm/cache/DbQueryResultCache.js +264 -0
  519. package/.output/server/node_modules/typeorm/cache/QueryResultCacheFactory.js +42 -0
  520. package/.output/server/node_modules/typeorm/cache/RedisQueryResultCache.js +197 -0
  521. package/.output/server/node_modules/typeorm/common/DeepPartial.js +4 -0
  522. package/.output/server/node_modules/typeorm/common/EntityTarget.js +4 -0
  523. package/.output/server/node_modules/typeorm/common/MixedList.js +4 -0
  524. package/.output/server/node_modules/typeorm/common/ObjectLiteral.js +4 -0
  525. package/.output/server/node_modules/typeorm/common/ObjectType.js +4 -0
  526. package/.output/server/node_modules/typeorm/common/RelationType.js +4 -0
  527. package/.output/server/node_modules/typeorm/connection/Connection.js +16 -0
  528. package/.output/server/node_modules/typeorm/connection/ConnectionManager.js +66 -0
  529. package/.output/server/node_modules/typeorm/connection/ConnectionMetadataBuilder.js +74 -0
  530. package/.output/server/node_modules/typeorm/connection/ConnectionOptionsReader.js +198 -0
  531. package/.output/server/node_modules/typeorm/connection/options-reader/ConnectionOptionsEnvReader.js +111 -0
  532. package/.output/server/node_modules/typeorm/container.js +60 -0
  533. package/.output/server/node_modules/typeorm/data-source/DataSource.js +517 -0
  534. package/.output/server/node_modules/typeorm/decorator/Check.js +27 -0
  535. package/.output/server/node_modules/typeorm/decorator/EntityRepository.js +21 -0
  536. package/.output/server/node_modules/typeorm/decorator/Exclusion.js +27 -0
  537. package/.output/server/node_modules/typeorm/decorator/ForeignKey.js +44 -0
  538. package/.output/server/node_modules/typeorm/decorator/Generated.js +24 -0
  539. package/.output/server/node_modules/typeorm/decorator/Index.js +56 -0
  540. package/.output/server/node_modules/typeorm/decorator/Unique.js +50 -0
  541. package/.output/server/node_modules/typeorm/decorator/columns/Column.js +78 -0
  542. package/.output/server/node_modules/typeorm/decorator/columns/CreateDateColumn.js +21 -0
  543. package/.output/server/node_modules/typeorm/decorator/columns/DeleteDateColumn.js +20 -0
  544. package/.output/server/node_modules/typeorm/decorator/columns/ObjectIdColumn.js +27 -0
  545. package/.output/server/node_modules/typeorm/decorator/columns/PrimaryColumn.js +63 -0
  546. package/.output/server/node_modules/typeorm/decorator/columns/PrimaryGeneratedColumn.js +59 -0
  547. package/.output/server/node_modules/typeorm/decorator/columns/UpdateDateColumn.js +20 -0
  548. package/.output/server/node_modules/typeorm/decorator/columns/VersionColumn.js +21 -0
  549. package/.output/server/node_modules/typeorm/decorator/columns/ViewColumn.js +19 -0
  550. package/.output/server/node_modules/typeorm/decorator/columns/VirtualColumn.js +49 -0
  551. package/.output/server/node_modules/typeorm/decorator/entity/ChildEntity.js +25 -0
  552. package/.output/server/node_modules/typeorm/decorator/entity/Entity.js +31 -0
  553. package/.output/server/node_modules/typeorm/decorator/entity/TableInheritance.js +22 -0
  554. package/.output/server/node_modules/typeorm/decorator/entity-view/ViewEntity.js +32 -0
  555. package/.output/server/node_modules/typeorm/decorator/listeners/AfterInsert.js +19 -0
  556. package/.output/server/node_modules/typeorm/decorator/listeners/AfterLoad.js +19 -0
  557. package/.output/server/node_modules/typeorm/decorator/listeners/AfterRecover.js +19 -0
  558. package/.output/server/node_modules/typeorm/decorator/listeners/AfterRemove.js +19 -0
  559. package/.output/server/node_modules/typeorm/decorator/listeners/AfterSoftRemove.js +19 -0
  560. package/.output/server/node_modules/typeorm/decorator/listeners/AfterUpdate.js +19 -0
  561. package/.output/server/node_modules/typeorm/decorator/listeners/BeforeInsert.js +19 -0
  562. package/.output/server/node_modules/typeorm/decorator/listeners/BeforeRecover.js +19 -0
  563. package/.output/server/node_modules/typeorm/decorator/listeners/BeforeRemove.js +19 -0
  564. package/.output/server/node_modules/typeorm/decorator/listeners/BeforeSoftRemove.js +19 -0
  565. package/.output/server/node_modules/typeorm/decorator/listeners/BeforeUpdate.js +19 -0
  566. package/.output/server/node_modules/typeorm/decorator/listeners/EventSubscriber.js +17 -0
  567. package/.output/server/node_modules/typeorm/decorator/options/ColumnOptions.js +4 -0
  568. package/.output/server/node_modules/typeorm/decorator/options/EntityOptions.js +4 -0
  569. package/.output/server/node_modules/typeorm/decorator/options/IndexOptions.js +4 -0
  570. package/.output/server/node_modules/typeorm/decorator/options/JoinColumnOptions.js +4 -0
  571. package/.output/server/node_modules/typeorm/decorator/options/JoinTableOptions.js +4 -0
  572. package/.output/server/node_modules/typeorm/decorator/options/RelationOptions.js +4 -0
  573. package/.output/server/node_modules/typeorm/decorator/options/ValueTransformer.js +4 -0
  574. package/.output/server/node_modules/typeorm/decorator/relations/JoinColumn.js +27 -0
  575. package/.output/server/node_modules/typeorm/decorator/relations/JoinTable.js +34 -0
  576. package/.output/server/node_modules/typeorm/decorator/relations/ManyToMany.js +46 -0
  577. package/.output/server/node_modules/typeorm/decorator/relations/ManyToOne.js +46 -0
  578. package/.output/server/node_modules/typeorm/decorator/relations/OneToMany.js +37 -0
  579. package/.output/server/node_modules/typeorm/decorator/relations/OneToOne.js +45 -0
  580. package/.output/server/node_modules/typeorm/decorator/relations/RelationCount.js +23 -0
  581. package/.output/server/node_modules/typeorm/decorator/relations/RelationId.js +22 -0
  582. package/.output/server/node_modules/typeorm/decorator/tree/Tree.js +21 -0
  583. package/.output/server/node_modules/typeorm/decorator/tree/TreeChildren.js +34 -0
  584. package/.output/server/node_modules/typeorm/decorator/tree/TreeLevelColumn.js +19 -0
  585. package/.output/server/node_modules/typeorm/decorator/tree/TreeParent.js +33 -0
  586. package/.output/server/node_modules/typeorm/driver/DriverFactory.js +98 -0
  587. package/.output/server/node_modules/typeorm/driver/DriverUtils.js +228 -0
  588. package/.output/server/node_modules/typeorm/driver/Query.js +16 -0
  589. package/.output/server/node_modules/typeorm/driver/SqlInMemory.js +15 -0
  590. package/.output/server/node_modules/typeorm/driver/aurora-mysql/AuroraMysqlDriver.js +847 -0
  591. package/.output/server/node_modules/typeorm/driver/aurora-mysql/AuroraMysqlQueryRunner.js +1709 -0
  592. package/.output/server/node_modules/typeorm/driver/aurora-postgres/AuroraPostgresDriver.js +103 -0
  593. package/.output/server/node_modules/typeorm/driver/aurora-postgres/AuroraPostgresQueryRunner.js +146 -0
  594. package/.output/server/node_modules/typeorm/driver/better-sqlite3/BetterSqlite3Driver.js +153 -0
  595. package/.output/server/node_modules/typeorm/driver/better-sqlite3/BetterSqlite3QueryRunner.js +126 -0
  596. package/.output/server/node_modules/typeorm/driver/capacitor/CapacitorDriver.js +78 -0
  597. package/.output/server/node_modules/typeorm/driver/capacitor/CapacitorQueryRunner.js +98 -0
  598. package/.output/server/node_modules/typeorm/driver/cockroachdb/CockroachDriver.js +885 -0
  599. package/.output/server/node_modules/typeorm/driver/cockroachdb/CockroachQueryRunner.js +2453 -0
  600. package/.output/server/node_modules/typeorm/driver/cordova/CordovaDriver.js +76 -0
  601. package/.output/server/node_modules/typeorm/driver/cordova/CordovaQueryRunner.js +170 -0
  602. package/.output/server/node_modules/typeorm/driver/expo/ExpoDriver.js +29 -0
  603. package/.output/server/node_modules/typeorm/driver/expo/ExpoDriverFactory.js +22 -0
  604. package/.output/server/node_modules/typeorm/driver/expo/ExpoQueryRunner.js +65 -0
  605. package/.output/server/node_modules/typeorm/driver/expo/legacy/ExpoLegacyDriver.js +75 -0
  606. package/.output/server/node_modules/typeorm/driver/expo/legacy/ExpoLegacyQueryRunner.js +169 -0
  607. package/.output/server/node_modules/typeorm/driver/mongodb/MongoDriver.js +404 -0
  608. package/.output/server/node_modules/typeorm/driver/mongodb/MongoQueryRunner.js +701 -0
  609. package/.output/server/node_modules/typeorm/driver/mongodb/bson.typings.js +5 -0
  610. package/.output/server/node_modules/typeorm/driver/mongodb/typings.js +23 -0
  611. package/.output/server/node_modules/typeorm/driver/mysql/MysqlDriver.js +1105 -0
  612. package/.output/server/node_modules/typeorm/driver/mysql/MysqlQueryRunner.js +2139 -0
  613. package/.output/server/node_modules/typeorm/driver/nativescript/NativescriptDriver.js +94 -0
  614. package/.output/server/node_modules/typeorm/driver/nativescript/NativescriptQueryRunner.js +92 -0
  615. package/.output/server/node_modules/typeorm/driver/oracle/OracleDriver.js +869 -0
  616. package/.output/server/node_modules/typeorm/driver/oracle/OracleQueryRunner.js +1884 -0
  617. package/.output/server/node_modules/typeorm/driver/postgres/PostgresDriver.js +1259 -0
  618. package/.output/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js +2729 -0
  619. package/.output/server/node_modules/typeorm/driver/react-native/ReactNativeDriver.js +728 -0
  620. package/.output/server/node_modules/typeorm/driver/react-native/ReactNativeQueryRunner.js +107 -0
  621. package/.output/server/node_modules/typeorm/driver/sap/SapDriver.js +681 -0
  622. package/.output/server/node_modules/typeorm/driver/sap/SapQueryRunner.js +2054 -0
  623. package/.output/server/node_modules/typeorm/driver/spanner/SpannerDriver.js +613 -0
  624. package/.output/server/node_modules/typeorm/driver/spanner/SpannerQueryRunner.js +1464 -0
  625. package/.output/server/node_modules/typeorm/driver/sqlite/SqliteDriver.js +174 -0
  626. package/.output/server/node_modules/typeorm/driver/sqlite/SqliteQueryRunner.js +124 -0
  627. package/.output/server/node_modules/typeorm/driver/sqlite-abstract/AbstractSqliteDriver.js +695 -0
  628. package/.output/server/node_modules/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +1511 -0
  629. package/.output/server/node_modules/typeorm/driver/sqljs/SqljsDriver.js +250 -0
  630. package/.output/server/node_modules/typeorm/driver/sqljs/SqljsQueryRunner.js +123 -0
  631. package/.output/server/node_modules/typeorm/driver/sqlserver/MssqlParameter.js +23 -0
  632. package/.output/server/node_modules/typeorm/driver/sqlserver/SqlServerDriver.js +922 -0
  633. package/.output/server/node_modules/typeorm/driver/sqlserver/SqlServerQueryRunner.js +2484 -0
  634. package/.output/server/node_modules/typeorm/driver/types/DatabaseType.js +4 -0
  635. package/.output/server/node_modules/typeorm/driver/types/GeoJsonTypes.js +4 -0
  636. package/.output/server/node_modules/typeorm/driver/types/MetadataTableType.js +11 -0
  637. package/.output/server/node_modules/typeorm/driver/types/ReplicationMode.js +4 -0
  638. package/.output/server/node_modules/typeorm/entity-manager/EntityManager.js +853 -0
  639. package/.output/server/node_modules/typeorm/entity-manager/EntityManagerFactory.js +24 -0
  640. package/.output/server/node_modules/typeorm/entity-manager/MongoEntityManager.js +668 -0
  641. package/.output/server/node_modules/typeorm/entity-manager/SqljsEntityManager.js +44 -0
  642. package/.output/server/node_modules/typeorm/entity-schema/EntitySchema.js +15 -0
  643. package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaEmbeddedColumnOptions.js +8 -0
  644. package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaEmbeddedError.js +18 -0
  645. package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaOptions.js +11 -0
  646. package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaTransformer.js +333 -0
  647. package/.output/server/node_modules/typeorm/error/AlreadyHasActiveConnectionError.js +16 -0
  648. package/.output/server/node_modules/typeorm/error/CannotAttachTreeChildrenEntityError.js +16 -0
  649. package/.output/server/node_modules/typeorm/error/CannotConnectAlreadyConnectedError.js +15 -0
  650. package/.output/server/node_modules/typeorm/error/CannotCreateEntityIdMapError.js +21 -0
  651. package/.output/server/node_modules/typeorm/error/CannotDetermineEntityError.js +16 -0
  652. package/.output/server/node_modules/typeorm/error/CannotExecuteNotConnectedError.js +15 -0
  653. package/.output/server/node_modules/typeorm/error/CannotGetEntityManagerNotConnectedError.js +15 -0
  654. package/.output/server/node_modules/typeorm/error/CannotReflectMethodParameterTypeError.js +18 -0
  655. package/.output/server/node_modules/typeorm/error/CircularRelationsError.js +16 -0
  656. package/.output/server/node_modules/typeorm/error/ColumnTypeUndefinedError.js +19 -0
  657. package/.output/server/node_modules/typeorm/error/ConnectionIsNotSetError.js +15 -0
  658. package/.output/server/node_modules/typeorm/error/ConnectionNotFoundError.js +15 -0
  659. package/.output/server/node_modules/typeorm/error/CustomRepositoryCannotInheritRepositoryError.js +18 -0
  660. package/.output/server/node_modules/typeorm/error/CustomRepositoryDoesNotHaveEntityError.js +18 -0
  661. package/.output/server/node_modules/typeorm/error/CustomRepositoryNotFoundError.js +18 -0
  662. package/.output/server/node_modules/typeorm/error/DataTypeNotSupportedError.js +14 -0
  663. package/.output/server/node_modules/typeorm/error/DriverOptionNotSetError.js +16 -0
  664. package/.output/server/node_modules/typeorm/error/DriverPackageNotInstalledError.js +16 -0
  665. package/.output/server/node_modules/typeorm/error/EntityMetadataNotFoundError.js +29 -0
  666. package/.output/server/node_modules/typeorm/error/EntityNotFoundError.js +42 -0
  667. package/.output/server/node_modules/typeorm/error/EntityPropertyNotFoundError.js +17 -0
  668. package/.output/server/node_modules/typeorm/error/FindRelationsNotFoundError.js +23 -0
  669. package/.output/server/node_modules/typeorm/error/ForbiddenTransactionModeOverrideError.js +16 -0
  670. package/.output/server/node_modules/typeorm/error/InitializedRelationError.js +20 -0
  671. package/.output/server/node_modules/typeorm/error/InsertValuesMissingError.js +16 -0
  672. package/.output/server/node_modules/typeorm/error/LimitOnUpdateNotSupportedError.js +15 -0
  673. package/.output/server/node_modules/typeorm/error/LockNotSupportedOnGivenDriverError.js +15 -0
  674. package/.output/server/node_modules/typeorm/error/MetadataAlreadyExistsError.js +18 -0
  675. package/.output/server/node_modules/typeorm/error/MetadataWithSuchNameAlreadyExistsError.js +16 -0
  676. package/.output/server/node_modules/typeorm/error/MissingDeleteDateColumnError.js +12 -0
  677. package/.output/server/node_modules/typeorm/error/MissingDriverError.js +16 -0
  678. package/.output/server/node_modules/typeorm/error/MissingJoinColumnError.js +23 -0
  679. package/.output/server/node_modules/typeorm/error/MissingJoinTableError.js +23 -0
  680. package/.output/server/node_modules/typeorm/error/MissingPrimaryColumnError.js +13 -0
  681. package/.output/server/node_modules/typeorm/error/MustBeEntityError.js +15 -0
  682. package/.output/server/node_modules/typeorm/error/NestedSetMultipleRootError.js +12 -0
  683. package/.output/server/node_modules/typeorm/error/NoConnectionForRepositoryError.js +16 -0
  684. package/.output/server/node_modules/typeorm/error/NoConnectionOptionError.js +16 -0
  685. package/.output/server/node_modules/typeorm/error/NoNeedToReleaseEntityManagerError.js +17 -0
  686. package/.output/server/node_modules/typeorm/error/NoVersionOrUpdateDateColumnError.js +15 -0
  687. package/.output/server/node_modules/typeorm/error/OffsetWithoutLimitNotSupportedError.js +17 -0
  688. package/.output/server/node_modules/typeorm/error/OptimisticLockCanNotBeUsedError.js +15 -0
  689. package/.output/server/node_modules/typeorm/error/OptimisticLockVersionMismatchError.js +15 -0
  690. package/.output/server/node_modules/typeorm/error/PersistedEntityNotFoundError.js +15 -0
  691. package/.output/server/node_modules/typeorm/error/PessimisticLockTransactionRequiredError.js +15 -0
  692. package/.output/server/node_modules/typeorm/error/PrimaryColumnCannotBeNullableError.js +13 -0
  693. package/.output/server/node_modules/typeorm/error/QueryFailedError.js +30 -0
  694. package/.output/server/node_modules/typeorm/error/QueryRunnerAlreadyReleasedError.js +12 -0
  695. package/.output/server/node_modules/typeorm/error/QueryRunnerProviderAlreadyReleasedError.js +16 -0
  696. package/.output/server/node_modules/typeorm/error/RepositoryNotTreeError.js +32 -0
  697. package/.output/server/node_modules/typeorm/error/ReturningStatementNotSupportedError.js +16 -0
  698. package/.output/server/node_modules/typeorm/error/SubjectRemovedAndUpdatedError.js +16 -0
  699. package/.output/server/node_modules/typeorm/error/SubjectWithoutIdentifierError.js +17 -0
  700. package/.output/server/node_modules/typeorm/error/TransactionAlreadyStartedError.js +15 -0
  701. package/.output/server/node_modules/typeorm/error/TransactionNotStartedError.js +15 -0
  702. package/.output/server/node_modules/typeorm/error/TreeRepositoryNotSupportedError.js +12 -0
  703. package/.output/server/node_modules/typeorm/error/TypeORMError.js +23 -0
  704. package/.output/server/node_modules/typeorm/error/UpdateValuesMissingError.js +12 -0
  705. package/.output/server/node_modules/typeorm/error/UsingJoinColumnIsNotAllowedError.js +13 -0
  706. package/.output/server/node_modules/typeorm/error/UsingJoinColumnOnlyOnOneSideAllowedError.js +14 -0
  707. package/.output/server/node_modules/typeorm/error/UsingJoinTableIsNotAllowedError.js +14 -0
  708. package/.output/server/node_modules/typeorm/error/UsingJoinTableOnlyOnOneSideAllowedError.js +14 -0
  709. package/.output/server/node_modules/typeorm/error/index.js +66 -0
  710. package/.output/server/node_modules/typeorm/find-options/EqualOperator.js +13 -0
  711. package/.output/server/node_modules/typeorm/find-options/FindManyOptions.js +4 -0
  712. package/.output/server/node_modules/typeorm/find-options/FindOneOptions.js +4 -0
  713. package/.output/server/node_modules/typeorm/find-options/FindOperator.js +96 -0
  714. package/.output/server/node_modules/typeorm/find-options/FindOperatorType.js +4 -0
  715. package/.output/server/node_modules/typeorm/find-options/FindOptionsOrder.js +4 -0
  716. package/.output/server/node_modules/typeorm/find-options/FindOptionsRelations.js +4 -0
  717. package/.output/server/node_modules/typeorm/find-options/FindOptionsSelect.js +4 -0
  718. package/.output/server/node_modules/typeorm/find-options/FindOptionsUtils.js +350 -0
  719. package/.output/server/node_modules/typeorm/find-options/FindOptionsWhere.js +4 -0
  720. package/.output/server/node_modules/typeorm/find-options/FindTreeOptions.js +4 -0
  721. package/.output/server/node_modules/typeorm/find-options/JoinOptions.js +4 -0
  722. package/.output/server/node_modules/typeorm/find-options/OrderByCondition.js +4 -0
  723. package/.output/server/node_modules/typeorm/find-options/operator/And.js +9 -0
  724. package/.output/server/node_modules/typeorm/find-options/operator/Any.js +13 -0
  725. package/.output/server/node_modules/typeorm/find-options/operator/ArrayContainedBy.js +13 -0
  726. package/.output/server/node_modules/typeorm/find-options/operator/ArrayContains.js +13 -0
  727. package/.output/server/node_modules/typeorm/find-options/operator/ArrayOverlap.js +13 -0
  728. package/.output/server/node_modules/typeorm/find-options/operator/Between.js +13 -0
  729. package/.output/server/node_modules/typeorm/find-options/operator/Equal.js +17 -0
  730. package/.output/server/node_modules/typeorm/find-options/operator/ILike.js +13 -0
  731. package/.output/server/node_modules/typeorm/find-options/operator/In.js +13 -0
  732. package/.output/server/node_modules/typeorm/find-options/operator/IsNull.js +13 -0
  733. package/.output/server/node_modules/typeorm/find-options/operator/JsonContains.js +13 -0
  734. package/.output/server/node_modules/typeorm/find-options/operator/LessThan.js +13 -0
  735. package/.output/server/node_modules/typeorm/find-options/operator/LessThanOrEqual.js +13 -0
  736. package/.output/server/node_modules/typeorm/find-options/operator/Like.js +13 -0
  737. package/.output/server/node_modules/typeorm/find-options/operator/MoreThan.js +13 -0
  738. package/.output/server/node_modules/typeorm/find-options/operator/MoreThanOrEqual.js +13 -0
  739. package/.output/server/node_modules/typeorm/find-options/operator/Not.js +14 -0
  740. package/.output/server/node_modules/typeorm/find-options/operator/Or.js +9 -0
  741. package/.output/server/node_modules/typeorm/find-options/operator/Raw.js +12 -0
  742. package/.output/server/node_modules/typeorm/globals.js +182 -0
  743. package/.output/server/node_modules/typeorm/index.js +196 -0
  744. package/.output/server/node_modules/typeorm/index.mjs +422 -0
  745. package/.output/server/node_modules/typeorm/logger/AbstractLogger.js +238 -0
  746. package/.output/server/node_modules/typeorm/logger/AdvancedConsoleLogger.js +56 -0
  747. package/.output/server/node_modules/typeorm/logger/DebugLogger.js +78 -0
  748. package/.output/server/node_modules/typeorm/logger/FileLogger.js +88 -0
  749. package/.output/server/node_modules/typeorm/logger/FormattedConsoleLogger.js +59 -0
  750. package/.output/server/node_modules/typeorm/logger/Logger.js +4 -0
  751. package/.output/server/node_modules/typeorm/logger/LoggerFactory.js +39 -0
  752. package/.output/server/node_modules/typeorm/logger/LoggerOptions.js +4 -0
  753. package/.output/server/node_modules/typeorm/logger/SimpleConsoleLogger.js +57 -0
  754. package/.output/server/node_modules/typeorm/metadata/CheckMetadata.js +35 -0
  755. package/.output/server/node_modules/typeorm/metadata/ColumnMetadata.js +618 -0
  756. package/.output/server/node_modules/typeorm/metadata/EmbeddedMetadata.js +224 -0
  757. package/.output/server/node_modules/typeorm/metadata/EntityListenerMetadata.js +77 -0
  758. package/.output/server/node_modules/typeorm/metadata/EntityMetadata.js +692 -0
  759. package/.output/server/node_modules/typeorm/metadata/ExclusionMetadata.js +35 -0
  760. package/.output/server/node_modules/typeorm/metadata/ForeignKeyMetadata.js +57 -0
  761. package/.output/server/node_modules/typeorm/metadata/IndexMetadata.js +144 -0
  762. package/.output/server/node_modules/typeorm/metadata/RelationCountMetadata.js +39 -0
  763. package/.output/server/node_modules/typeorm/metadata/RelationIdMetadata.js +62 -0
  764. package/.output/server/node_modules/typeorm/metadata/RelationMetadata.js +440 -0
  765. package/.output/server/node_modules/typeorm/metadata/UniqueMetadata.js +101 -0
  766. package/.output/server/node_modules/typeorm/metadata/types/EventListenerTypes.js +22 -0
  767. package/.output/server/node_modules/typeorm/metadata-args/MetadataArgsStorage.js +236 -0
  768. package/.output/server/node_modules/typeorm/metadata-builder/ClosureJunctionEntityMetadataBuilder.js +145 -0
  769. package/.output/server/node_modules/typeorm/metadata-builder/EntityMetadataBuilder.js +838 -0
  770. package/.output/server/node_modules/typeorm/metadata-builder/EntityMetadataValidator.js +258 -0
  771. package/.output/server/node_modules/typeorm/metadata-builder/JunctionEntityMetadataBuilder.js +287 -0
  772. package/.output/server/node_modules/typeorm/metadata-builder/MetadataUtils.js +44 -0
  773. package/.output/server/node_modules/typeorm/metadata-builder/RelationJoinColumnBuilder.js +185 -0
  774. package/.output/server/node_modules/typeorm/migration/Migration.js +21 -0
  775. package/.output/server/node_modules/typeorm/migration/MigrationExecutor.js +534 -0
  776. package/.output/server/node_modules/typeorm/naming-strategy/DefaultNamingStrategy.js +145 -0
  777. package/.output/server/node_modules/typeorm/naming-strategy/LegacyOracleNamingStrategy.js +50 -0
  778. package/.output/server/node_modules/typeorm/package.json +268 -0
  779. package/.output/server/node_modules/typeorm/persistence/EntityPersistExecutor.js +170 -0
  780. package/.output/server/node_modules/typeorm/persistence/Subject.js +239 -0
  781. package/.output/server/node_modules/typeorm/persistence/SubjectChangedColumnsComputer.js +216 -0
  782. package/.output/server/node_modules/typeorm/persistence/SubjectDatabaseEntityLoader.js +135 -0
  783. package/.output/server/node_modules/typeorm/persistence/SubjectExecutor.js +760 -0
  784. package/.output/server/node_modules/typeorm/persistence/SubjectTopologicalSorter.js +174 -0
  785. package/.output/server/node_modules/typeorm/persistence/subject-builder/CascadesSubjectBuilder.js +107 -0
  786. package/.output/server/node_modules/typeorm/persistence/subject-builder/ManyToManySubjectBuilder.js +218 -0
  787. package/.output/server/node_modules/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js +181 -0
  788. package/.output/server/node_modules/typeorm/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js +155 -0
  789. package/.output/server/node_modules/typeorm/persistence/tree/ClosureSubjectExecutor.js +241 -0
  790. package/.output/server/node_modules/typeorm/persistence/tree/MaterializedPathSubjectExecutor.js +125 -0
  791. package/.output/server/node_modules/typeorm/persistence/tree/NestedSetSubjectExecutor.js +271 -0
  792. package/.output/server/node_modules/typeorm/platform/PlatformTools.js +243 -0
  793. package/.output/server/node_modules/typeorm/query-builder/Alias.js +29 -0
  794. package/.output/server/node_modules/typeorm/query-builder/Brackets.js +19 -0
  795. package/.output/server/node_modules/typeorm/query-builder/DeleteQueryBuilder.js +200 -0
  796. package/.output/server/node_modules/typeorm/query-builder/InsertQueryBuilder.js +745 -0
  797. package/.output/server/node_modules/typeorm/query-builder/JoinAttribute.js +175 -0
  798. package/.output/server/node_modules/typeorm/query-builder/NotBrackets.js +17 -0
  799. package/.output/server/node_modules/typeorm/query-builder/QueryBuilder.js +1139 -0
  800. package/.output/server/node_modules/typeorm/query-builder/QueryBuilderUtils.js +32 -0
  801. package/.output/server/node_modules/typeorm/query-builder/QueryExpressionMap.js +328 -0
  802. package/.output/server/node_modules/typeorm/query-builder/RelationIdLoader.js +503 -0
  803. package/.output/server/node_modules/typeorm/query-builder/RelationLoader.js +283 -0
  804. package/.output/server/node_modules/typeorm/query-builder/RelationQueryBuilder.js +155 -0
  805. package/.output/server/node_modules/typeorm/query-builder/RelationRemover.js +143 -0
  806. package/.output/server/node_modules/typeorm/query-builder/RelationUpdater.js +152 -0
  807. package/.output/server/node_modules/typeorm/query-builder/ReturningResultsEntityUpdator.js +176 -0
  808. package/.output/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js +2656 -0
  809. package/.output/server/node_modules/typeorm/query-builder/SoftDeleteQueryBuilder.js +368 -0
  810. package/.output/server/node_modules/typeorm/query-builder/UpdateQueryBuilder.js +498 -0
  811. package/.output/server/node_modules/typeorm/query-builder/index.js +20 -0
  812. package/.output/server/node_modules/typeorm/query-builder/relation-count/RelationCountAttribute.js +80 -0
  813. package/.output/server/node_modules/typeorm/query-builder/relation-count/RelationCountLoader.js +168 -0
  814. package/.output/server/node_modules/typeorm/query-builder/relation-count/RelationCountMetadataToAttributeTransformer.js +55 -0
  815. package/.output/server/node_modules/typeorm/query-builder/relation-id/RelationIdAttribute.js +88 -0
  816. package/.output/server/node_modules/typeorm/query-builder/relation-id/RelationIdLoader.js +275 -0
  817. package/.output/server/node_modules/typeorm/query-builder/relation-id/RelationIdMetadataToAttributeTransformer.js +55 -0
  818. package/.output/server/node_modules/typeorm/query-builder/result/DeleteResult.js +17 -0
  819. package/.output/server/node_modules/typeorm/query-builder/result/InsertResult.js +28 -0
  820. package/.output/server/node_modules/typeorm/query-builder/result/UpdateResult.js +29 -0
  821. package/.output/server/node_modules/typeorm/query-builder/transformer/DocumentToEntityTransformer.js +196 -0
  822. package/.output/server/node_modules/typeorm/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js +112 -0
  823. package/.output/server/node_modules/typeorm/query-builder/transformer/PlainObjectToNewEntityTransformer.js +92 -0
  824. package/.output/server/node_modules/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js +447 -0
  825. package/.output/server/node_modules/typeorm/query-runner/BaseQueryRunner.js +454 -0
  826. package/.output/server/node_modules/typeorm/query-runner/QueryLock.js +28 -0
  827. package/.output/server/node_modules/typeorm/query-runner/QueryResult.js +17 -0
  828. package/.output/server/node_modules/typeorm/repository/AbstractRepository.js +92 -0
  829. package/.output/server/node_modules/typeorm/repository/BaseEntity.js +328 -0
  830. package/.output/server/node_modules/typeorm/repository/MongoRepository.js +305 -0
  831. package/.output/server/node_modules/typeorm/repository/RemoveOptions.js +4 -0
  832. package/.output/server/node_modules/typeorm/repository/Repository.js +379 -0
  833. package/.output/server/node_modules/typeorm/repository/SaveOptions.js +4 -0
  834. package/.output/server/node_modules/typeorm/repository/TreeRepository.js +255 -0
  835. package/.output/server/node_modules/typeorm/schema-builder/MongoSchemaBuilder.js +66 -0
  836. package/.output/server/node_modules/typeorm/schema-builder/RdbmsSchemaBuilder.js +929 -0
  837. package/.output/server/node_modules/typeorm/schema-builder/options/TableCheckOptions.js +4 -0
  838. package/.output/server/node_modules/typeorm/schema-builder/options/TableColumnOptions.js +4 -0
  839. package/.output/server/node_modules/typeorm/schema-builder/options/TableExclusionOptions.js +4 -0
  840. package/.output/server/node_modules/typeorm/schema-builder/options/TableForeignKeyOptions.js +4 -0
  841. package/.output/server/node_modules/typeorm/schema-builder/options/TableIndexOptions.js +4 -0
  842. package/.output/server/node_modules/typeorm/schema-builder/options/TableOptions.js +4 -0
  843. package/.output/server/node_modules/typeorm/schema-builder/options/TableUniqueOptions.js +4 -0
  844. package/.output/server/node_modules/typeorm/schema-builder/options/ViewOptions.js +4 -0
  845. package/.output/server/node_modules/typeorm/schema-builder/table/Table.js +296 -0
  846. package/.output/server/node_modules/typeorm/schema-builder/table/TableCheck.js +49 -0
  847. package/.output/server/node_modules/typeorm/schema-builder/table/TableColumn.js +117 -0
  848. package/.output/server/node_modules/typeorm/schema-builder/table/TableExclusion.js +43 -0
  849. package/.output/server/node_modules/typeorm/schema-builder/table/TableForeignKey.js +72 -0
  850. package/.output/server/node_modules/typeorm/schema-builder/table/TableIndex.js +68 -0
  851. package/.output/server/node_modules/typeorm/schema-builder/table/TableUnique.js +50 -0
  852. package/.output/server/node_modules/typeorm/schema-builder/util/TableUtils.js +41 -0
  853. package/.output/server/node_modules/typeorm/schema-builder/util/ViewUtils.js +27 -0
  854. package/.output/server/node_modules/typeorm/schema-builder/view/View.js +71 -0
  855. package/.output/server/node_modules/typeorm/subscriber/Broadcaster.js +660 -0
  856. package/.output/server/node_modules/typeorm/subscriber/BroadcasterResult.js +30 -0
  857. package/.output/server/node_modules/typeorm/subscriber/event/QueryEvent.js +4 -0
  858. package/.output/server/node_modules/typeorm/util/ApplyValueTransformers.js +25 -0
  859. package/.output/server/node_modules/typeorm/util/DateUtils.js +229 -0
  860. package/.output/server/node_modules/typeorm/util/DepGraph.js +230 -0
  861. package/.output/server/node_modules/typeorm/util/DirectoryExportedClassesLoader.js +65 -0
  862. package/.output/server/node_modules/typeorm/util/ImportUtils.js +66 -0
  863. package/.output/server/node_modules/typeorm/util/InstanceChecker.js +104 -0
  864. package/.output/server/node_modules/typeorm/util/ObjectUtils.js +49 -0
  865. package/.output/server/node_modules/typeorm/util/OrmUtils.js +443 -0
  866. package/.output/server/node_modules/typeorm/util/PathUtils.js +33 -0
  867. package/.output/server/node_modules/typeorm/util/RandomGenerator.js +154 -0
  868. package/.output/server/node_modules/typeorm/util/SqlTagUtils.js +43 -0
  869. package/.output/server/node_modules/typeorm/util/StringUtils.js +113 -0
  870. package/.output/server/node_modules/typeorm/util/TreeRepositoryUtils.js +67 -0
  871. package/.output/server/node_modules/typeorm/util/VersionUtils.js +27 -0
  872. package/.output/server/node_modules/typeorm/util/escapeRegExp.js +10 -0
  873. package/.output/server/node_modules/ufo/dist/index.mjs +630 -0
  874. package/.output/server/node_modules/ufo/package.json +47 -0
  875. package/.output/server/node_modules/unhead/dist/plugins.mjs +94 -0
  876. package/.output/server/node_modules/unhead/dist/server.mjs +220 -0
  877. package/.output/server/node_modules/unhead/dist/shared/unhead.C13swrCa.mjs +48 -0
  878. package/.output/server/node_modules/unhead/dist/shared/unhead.CApf5sj3.mjs +148 -0
  879. package/.output/server/node_modules/unhead/dist/shared/unhead.Cp0iF6eN.mjs +177 -0
  880. package/.output/server/node_modules/unhead/dist/shared/unhead.DGkFBTYv.mjs +172 -0
  881. package/.output/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs +196 -0
  882. package/.output/server/node_modules/unhead/dist/shared/unhead.DZbvapt-.mjs +70 -0
  883. package/.output/server/node_modules/unhead/dist/shared/unhead.DeCxexjU.mjs +166 -0
  884. package/.output/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs +38 -0
  885. package/.output/server/node_modules/unhead/dist/utils.mjs +5 -0
  886. package/.output/server/node_modules/unhead/package.json +101 -0
  887. package/.output/server/node_modules/uuid/dist/cjs/index.js +31 -0
  888. package/.output/server/node_modules/uuid/dist/cjs/max.js +3 -0
  889. package/.output/server/node_modules/uuid/dist/cjs/md5.js +13 -0
  890. package/.output/server/node_modules/uuid/dist/cjs/native.js +4 -0
  891. package/.output/server/node_modules/uuid/dist/cjs/nil.js +3 -0
  892. package/.output/server/node_modules/uuid/dist/cjs/package.json +1 -0
  893. package/.output/server/node_modules/uuid/dist/cjs/parse.js +11 -0
  894. package/.output/server/node_modules/uuid/dist/cjs/regex.js +3 -0
  895. package/.output/server/node_modules/uuid/dist/cjs/rng.js +13 -0
  896. package/.output/server/node_modules/uuid/dist/cjs/sha1.js +13 -0
  897. package/.output/server/node_modules/uuid/dist/cjs/stringify.js +39 -0
  898. package/.output/server/node_modules/uuid/dist/cjs/v1.js +87 -0
  899. package/.output/server/node_modules/uuid/dist/cjs/v1ToV6.js +13 -0
  900. package/.output/server/node_modules/uuid/dist/cjs/v3.js +14 -0
  901. package/.output/server/node_modules/uuid/dist/cjs/v35.js +41 -0
  902. package/.output/server/node_modules/uuid/dist/cjs/v4.js +29 -0
  903. package/.output/server/node_modules/uuid/dist/cjs/v5.js +14 -0
  904. package/.output/server/node_modules/uuid/dist/cjs/v6.js +19 -0
  905. package/.output/server/node_modules/uuid/dist/cjs/v6ToV1.js +13 -0
  906. package/.output/server/node_modules/uuid/dist/cjs/v7.js +69 -0
  907. package/.output/server/node_modules/uuid/dist/cjs/validate.js +7 -0
  908. package/.output/server/node_modules/uuid/dist/cjs/version.js +10 -0
  909. package/.output/server/node_modules/uuid/package.json +132 -0
  910. package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
  911. package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  912. package/.output/server/node_modules/vue/index.js +7 -0
  913. package/.output/server/node_modules/vue/index.mjs +1 -0
  914. package/.output/server/node_modules/vue/package.json +112 -0
  915. package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
  916. package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +196 -0
  917. package/.output/server/node_modules/vue-bundle-renderer/package.json +50 -0
  918. package/.output/server/node_modules/xtend/mutable.js +17 -0
  919. package/.output/server/node_modules/xtend/package.json +55 -0
  920. package/.output/server/node_modules/zod/index.js +4 -0
  921. package/.output/server/node_modules/zod/package.json +135 -0
  922. package/.output/server/node_modules/zod/v3/ZodError.js +133 -0
  923. package/.output/server/node_modules/zod/v3/errors.js +9 -0
  924. package/.output/server/node_modules/zod/v3/external.js +6 -0
  925. package/.output/server/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  926. package/.output/server/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  927. package/.output/server/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  928. package/.output/server/node_modules/zod/v3/helpers/util.js +133 -0
  929. package/.output/server/node_modules/zod/v3/index.js +4 -0
  930. package/.output/server/node_modules/zod/v3/locales/en.js +109 -0
  931. package/.output/server/node_modules/zod/v3/package.json +6 -0
  932. package/.output/server/node_modules/zod/v3/types.js +3695 -0
  933. package/.output/server/node_modules/zod/v4/classic/checks.js +1 -0
  934. package/.output/server/node_modules/zod/v4/classic/coerce.js +17 -0
  935. package/.output/server/node_modules/zod/v4/classic/compat.js +31 -0
  936. package/.output/server/node_modules/zod/v4/classic/errors.js +48 -0
  937. package/.output/server/node_modules/zod/v4/classic/external.js +20 -0
  938. package/.output/server/node_modules/zod/v4/classic/from-json-schema.js +584 -0
  939. package/.output/server/node_modules/zod/v4/classic/index.js +4 -0
  940. package/.output/server/node_modules/zod/v4/classic/iso.js +30 -0
  941. package/.output/server/node_modules/zod/v4/classic/package.json +6 -0
  942. package/.output/server/node_modules/zod/v4/classic/parse.js +15 -0
  943. package/.output/server/node_modules/zod/v4/classic/schemas.js +1157 -0
  944. package/.output/server/node_modules/zod/v4/core/api.js +1082 -0
  945. package/.output/server/node_modules/zod/v4/core/checks.js +575 -0
  946. package/.output/server/node_modules/zod/v4/core/core.js +76 -0
  947. package/.output/server/node_modules/zod/v4/core/doc.js +35 -0
  948. package/.output/server/node_modules/zod/v4/core/errors.js +182 -0
  949. package/.output/server/node_modules/zod/v4/core/index.js +16 -0
  950. package/.output/server/node_modules/zod/v4/core/json-schema-generator.js +95 -0
  951. package/.output/server/node_modules/zod/v4/core/json-schema-processors.js +605 -0
  952. package/.output/server/node_modules/zod/v4/core/json-schema.js +1 -0
  953. package/.output/server/node_modules/zod/v4/core/package.json +6 -0
  954. package/.output/server/node_modules/zod/v4/core/parse.js +93 -0
  955. package/.output/server/node_modules/zod/v4/core/regexes.js +133 -0
  956. package/.output/server/node_modules/zod/v4/core/registries.js +51 -0
  957. package/.output/server/node_modules/zod/v4/core/schemas.js +2095 -0
  958. package/.output/server/node_modules/zod/v4/core/to-json-schema.js +437 -0
  959. package/.output/server/node_modules/zod/v4/core/util.js +651 -0
  960. package/.output/server/node_modules/zod/v4/core/versions.js +5 -0
  961. package/.output/server/node_modules/zod/v4/index.js +3 -0
  962. package/.output/server/node_modules/zod/v4/locales/ar.js +106 -0
  963. package/.output/server/node_modules/zod/v4/locales/az.js +105 -0
  964. package/.output/server/node_modules/zod/v4/locales/be.js +156 -0
  965. package/.output/server/node_modules/zod/v4/locales/bg.js +120 -0
  966. package/.output/server/node_modules/zod/v4/locales/ca.js +107 -0
  967. package/.output/server/node_modules/zod/v4/locales/cs.js +111 -0
  968. package/.output/server/node_modules/zod/v4/locales/da.js +115 -0
  969. package/.output/server/node_modules/zod/v4/locales/de.js +108 -0
  970. package/.output/server/node_modules/zod/v4/locales/en.js +109 -0
  971. package/.output/server/node_modules/zod/v4/locales/eo.js +109 -0
  972. package/.output/server/node_modules/zod/v4/locales/es.js +132 -0
  973. package/.output/server/node_modules/zod/v4/locales/fa.js +114 -0
  974. package/.output/server/node_modules/zod/v4/locales/fi.js +112 -0
  975. package/.output/server/node_modules/zod/v4/locales/fr-CA.js +107 -0
  976. package/.output/server/node_modules/zod/v4/locales/fr.js +108 -0
  977. package/.output/server/node_modules/zod/v4/locales/he.js +214 -0
  978. package/.output/server/node_modules/zod/v4/locales/hu.js +108 -0
  979. package/.output/server/node_modules/zod/v4/locales/hy.js +147 -0
  980. package/.output/server/node_modules/zod/v4/locales/id.js +106 -0
  981. package/.output/server/node_modules/zod/v4/locales/index.js +49 -0
  982. package/.output/server/node_modules/zod/v4/locales/is.js +109 -0
  983. package/.output/server/node_modules/zod/v4/locales/it.js +108 -0
  984. package/.output/server/node_modules/zod/v4/locales/ja.js +107 -0
  985. package/.output/server/node_modules/zod/v4/locales/ka.js +112 -0
  986. package/.output/server/node_modules/zod/v4/locales/kh.js +5 -0
  987. package/.output/server/node_modules/zod/v4/locales/km.js +110 -0
  988. package/.output/server/node_modules/zod/v4/locales/ko.js +111 -0
  989. package/.output/server/node_modules/zod/v4/locales/lt.js +203 -0
  990. package/.output/server/node_modules/zod/v4/locales/mk.js +109 -0
  991. package/.output/server/node_modules/zod/v4/locales/ms.js +107 -0
  992. package/.output/server/node_modules/zod/v4/locales/nl.js +110 -0
  993. package/.output/server/node_modules/zod/v4/locales/no.js +108 -0
  994. package/.output/server/node_modules/zod/v4/locales/ota.js +109 -0
  995. package/.output/server/node_modules/zod/v4/locales/package.json +6 -0
  996. package/.output/server/node_modules/zod/v4/locales/pl.js +109 -0
  997. package/.output/server/node_modules/zod/v4/locales/ps.js +114 -0
  998. package/.output/server/node_modules/zod/v4/locales/pt.js +108 -0
  999. package/.output/server/node_modules/zod/v4/locales/ru.js +156 -0
  1000. package/.output/server/node_modules/zod/v4/locales/sl.js +109 -0
  1001. package/.output/server/node_modules/zod/v4/locales/sv.js +110 -0
  1002. package/.output/server/node_modules/zod/v4/locales/ta.js +110 -0
  1003. package/.output/server/node_modules/zod/v4/locales/th.js +110 -0
  1004. package/.output/server/node_modules/zod/v4/locales/tr.js +105 -0
  1005. package/.output/server/node_modules/zod/v4/locales/ua.js +5 -0
  1006. package/.output/server/node_modules/zod/v4/locales/uk.js +108 -0
  1007. package/.output/server/node_modules/zod/v4/locales/ur.js +110 -0
  1008. package/.output/server/node_modules/zod/v4/locales/uz.js +109 -0
  1009. package/.output/server/node_modules/zod/v4/locales/vi.js +108 -0
  1010. package/.output/server/node_modules/zod/v4/locales/yo.js +107 -0
  1011. package/.output/server/node_modules/zod/v4/locales/zh-CN.js +109 -0
  1012. package/.output/server/node_modules/zod/v4/locales/zh-TW.js +107 -0
  1013. package/.output/server/node_modules/zod/v4/package.json +6 -0
  1014. package/.output/server/package.json +95 -0
  1015. package/README.md +46 -0
  1016. package/bin/cli.mjs +113 -0
  1017. package/bin/entry.cjs +84 -0
  1018. package/package.json +48 -0
@@ -0,0 +1,4374 @@
1
+ // src/anthropic-provider.ts
2
+ import {
3
+ NoSuchModelError
4
+ } from "@ai-sdk/provider";
5
+ import {
6
+ generateId as generateId2,
7
+ loadApiKey,
8
+ loadOptionalSetting,
9
+ withoutTrailingSlash,
10
+ withUserAgentSuffix
11
+ } from "@ai-sdk/provider-utils";
12
+
13
+ // src/version.ts
14
+ var VERSION = true ? "3.0.9" : "0.0.0-test";
15
+
16
+ // src/anthropic-messages-language-model.ts
17
+ import {
18
+ APICallError
19
+ } from "@ai-sdk/provider";
20
+ import {
21
+ combineHeaders,
22
+ createEventSourceResponseHandler,
23
+ createJsonResponseHandler,
24
+ createToolNameMapping,
25
+ generateId,
26
+ parseProviderOptions as parseProviderOptions2,
27
+ postJsonToApi,
28
+ resolve
29
+ } from "@ai-sdk/provider-utils";
30
+
31
+ // src/anthropic-error.ts
32
+ import {
33
+ createJsonErrorResponseHandler,
34
+ lazySchema,
35
+ zodSchema
36
+ } from "@ai-sdk/provider-utils";
37
+ import { z } from "zod/v4";
38
+ var anthropicErrorDataSchema = lazySchema(
39
+ () => zodSchema(
40
+ z.object({
41
+ type: z.literal("error"),
42
+ error: z.object({
43
+ type: z.string(),
44
+ message: z.string()
45
+ })
46
+ })
47
+ )
48
+ );
49
+ var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
50
+ errorSchema: anthropicErrorDataSchema,
51
+ errorToMessage: (data) => data.error.message
52
+ });
53
+
54
+ // src/anthropic-messages-api.ts
55
+ import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
56
+ import { z as z2 } from "zod/v4";
57
+ var anthropicMessagesResponseSchema = lazySchema2(
58
+ () => zodSchema2(
59
+ z2.object({
60
+ type: z2.literal("message"),
61
+ id: z2.string().nullish(),
62
+ model: z2.string().nullish(),
63
+ content: z2.array(
64
+ z2.discriminatedUnion("type", [
65
+ z2.object({
66
+ type: z2.literal("text"),
67
+ text: z2.string(),
68
+ citations: z2.array(
69
+ z2.discriminatedUnion("type", [
70
+ z2.object({
71
+ type: z2.literal("web_search_result_location"),
72
+ cited_text: z2.string(),
73
+ url: z2.string(),
74
+ title: z2.string(),
75
+ encrypted_index: z2.string()
76
+ }),
77
+ z2.object({
78
+ type: z2.literal("page_location"),
79
+ cited_text: z2.string(),
80
+ document_index: z2.number(),
81
+ document_title: z2.string().nullable(),
82
+ start_page_number: z2.number(),
83
+ end_page_number: z2.number()
84
+ }),
85
+ z2.object({
86
+ type: z2.literal("char_location"),
87
+ cited_text: z2.string(),
88
+ document_index: z2.number(),
89
+ document_title: z2.string().nullable(),
90
+ start_char_index: z2.number(),
91
+ end_char_index: z2.number()
92
+ })
93
+ ])
94
+ ).optional()
95
+ }),
96
+ z2.object({
97
+ type: z2.literal("thinking"),
98
+ thinking: z2.string(),
99
+ signature: z2.string()
100
+ }),
101
+ z2.object({
102
+ type: z2.literal("redacted_thinking"),
103
+ data: z2.string()
104
+ }),
105
+ z2.object({
106
+ type: z2.literal("tool_use"),
107
+ id: z2.string(),
108
+ name: z2.string(),
109
+ input: z2.unknown(),
110
+ // Programmatic tool calling: caller info when triggered from code execution
111
+ caller: z2.union([
112
+ z2.object({
113
+ type: z2.literal("code_execution_20250825"),
114
+ tool_id: z2.string()
115
+ }),
116
+ z2.object({
117
+ type: z2.literal("direct")
118
+ })
119
+ ]).optional()
120
+ }),
121
+ z2.object({
122
+ type: z2.literal("server_tool_use"),
123
+ id: z2.string(),
124
+ name: z2.string(),
125
+ input: z2.record(z2.string(), z2.unknown()).nullish()
126
+ }),
127
+ z2.object({
128
+ type: z2.literal("mcp_tool_use"),
129
+ id: z2.string(),
130
+ name: z2.string(),
131
+ input: z2.unknown(),
132
+ server_name: z2.string()
133
+ }),
134
+ z2.object({
135
+ type: z2.literal("mcp_tool_result"),
136
+ tool_use_id: z2.string(),
137
+ is_error: z2.boolean(),
138
+ content: z2.array(
139
+ z2.union([
140
+ z2.string(),
141
+ z2.object({ type: z2.literal("text"), text: z2.string() })
142
+ ])
143
+ )
144
+ }),
145
+ z2.object({
146
+ type: z2.literal("web_fetch_tool_result"),
147
+ tool_use_id: z2.string(),
148
+ content: z2.union([
149
+ z2.object({
150
+ type: z2.literal("web_fetch_result"),
151
+ url: z2.string(),
152
+ retrieved_at: z2.string(),
153
+ content: z2.object({
154
+ type: z2.literal("document"),
155
+ title: z2.string().nullable(),
156
+ citations: z2.object({ enabled: z2.boolean() }).optional(),
157
+ source: z2.union([
158
+ z2.object({
159
+ type: z2.literal("base64"),
160
+ media_type: z2.literal("application/pdf"),
161
+ data: z2.string()
162
+ }),
163
+ z2.object({
164
+ type: z2.literal("text"),
165
+ media_type: z2.literal("text/plain"),
166
+ data: z2.string()
167
+ })
168
+ ])
169
+ })
170
+ }),
171
+ z2.object({
172
+ type: z2.literal("web_fetch_tool_result_error"),
173
+ error_code: z2.string()
174
+ })
175
+ ])
176
+ }),
177
+ z2.object({
178
+ type: z2.literal("web_search_tool_result"),
179
+ tool_use_id: z2.string(),
180
+ content: z2.union([
181
+ z2.array(
182
+ z2.object({
183
+ type: z2.literal("web_search_result"),
184
+ url: z2.string(),
185
+ title: z2.string(),
186
+ encrypted_content: z2.string(),
187
+ page_age: z2.string().nullish()
188
+ })
189
+ ),
190
+ z2.object({
191
+ type: z2.literal("web_search_tool_result_error"),
192
+ error_code: z2.string()
193
+ })
194
+ ])
195
+ }),
196
+ // code execution results for code_execution_20250522 tool:
197
+ z2.object({
198
+ type: z2.literal("code_execution_tool_result"),
199
+ tool_use_id: z2.string(),
200
+ content: z2.union([
201
+ z2.object({
202
+ type: z2.literal("code_execution_result"),
203
+ stdout: z2.string(),
204
+ stderr: z2.string(),
205
+ return_code: z2.number(),
206
+ content: z2.array(
207
+ z2.object({
208
+ type: z2.literal("code_execution_output"),
209
+ file_id: z2.string()
210
+ })
211
+ ).optional().default([])
212
+ }),
213
+ z2.object({
214
+ type: z2.literal("code_execution_tool_result_error"),
215
+ error_code: z2.string()
216
+ })
217
+ ])
218
+ }),
219
+ // bash code execution results for code_execution_20250825 tool:
220
+ z2.object({
221
+ type: z2.literal("bash_code_execution_tool_result"),
222
+ tool_use_id: z2.string(),
223
+ content: z2.discriminatedUnion("type", [
224
+ z2.object({
225
+ type: z2.literal("bash_code_execution_result"),
226
+ content: z2.array(
227
+ z2.object({
228
+ type: z2.literal("bash_code_execution_output"),
229
+ file_id: z2.string()
230
+ })
231
+ ),
232
+ stdout: z2.string(),
233
+ stderr: z2.string(),
234
+ return_code: z2.number()
235
+ }),
236
+ z2.object({
237
+ type: z2.literal("bash_code_execution_tool_result_error"),
238
+ error_code: z2.string()
239
+ })
240
+ ])
241
+ }),
242
+ // text editor code execution results for code_execution_20250825 tool:
243
+ z2.object({
244
+ type: z2.literal("text_editor_code_execution_tool_result"),
245
+ tool_use_id: z2.string(),
246
+ content: z2.discriminatedUnion("type", [
247
+ z2.object({
248
+ type: z2.literal("text_editor_code_execution_tool_result_error"),
249
+ error_code: z2.string()
250
+ }),
251
+ z2.object({
252
+ type: z2.literal("text_editor_code_execution_view_result"),
253
+ content: z2.string(),
254
+ file_type: z2.string(),
255
+ num_lines: z2.number().nullable(),
256
+ start_line: z2.number().nullable(),
257
+ total_lines: z2.number().nullable()
258
+ }),
259
+ z2.object({
260
+ type: z2.literal("text_editor_code_execution_create_result"),
261
+ is_file_update: z2.boolean()
262
+ }),
263
+ z2.object({
264
+ type: z2.literal(
265
+ "text_editor_code_execution_str_replace_result"
266
+ ),
267
+ lines: z2.array(z2.string()).nullable(),
268
+ new_lines: z2.number().nullable(),
269
+ new_start: z2.number().nullable(),
270
+ old_lines: z2.number().nullable(),
271
+ old_start: z2.number().nullable()
272
+ })
273
+ ])
274
+ }),
275
+ // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
276
+ z2.object({
277
+ type: z2.literal("tool_search_tool_result"),
278
+ tool_use_id: z2.string(),
279
+ content: z2.union([
280
+ z2.object({
281
+ type: z2.literal("tool_search_tool_search_result"),
282
+ tool_references: z2.array(
283
+ z2.object({
284
+ type: z2.literal("tool_reference"),
285
+ tool_name: z2.string()
286
+ })
287
+ )
288
+ }),
289
+ z2.object({
290
+ type: z2.literal("tool_search_tool_result_error"),
291
+ error_code: z2.string()
292
+ })
293
+ ])
294
+ })
295
+ ])
296
+ ),
297
+ stop_reason: z2.string().nullish(),
298
+ stop_sequence: z2.string().nullish(),
299
+ usage: z2.looseObject({
300
+ input_tokens: z2.number(),
301
+ output_tokens: z2.number(),
302
+ cache_creation_input_tokens: z2.number().nullish(),
303
+ cache_read_input_tokens: z2.number().nullish()
304
+ }),
305
+ container: z2.object({
306
+ expires_at: z2.string(),
307
+ id: z2.string(),
308
+ skills: z2.array(
309
+ z2.object({
310
+ type: z2.union([z2.literal("anthropic"), z2.literal("custom")]),
311
+ skill_id: z2.string(),
312
+ version: z2.string()
313
+ })
314
+ ).nullish()
315
+ }).nullish(),
316
+ context_management: z2.object({
317
+ applied_edits: z2.array(
318
+ z2.union([
319
+ z2.object({
320
+ type: z2.literal("clear_tool_uses_20250919"),
321
+ cleared_tool_uses: z2.number(),
322
+ cleared_input_tokens: z2.number()
323
+ }),
324
+ z2.object({
325
+ type: z2.literal("clear_thinking_20251015"),
326
+ cleared_thinking_turns: z2.number(),
327
+ cleared_input_tokens: z2.number()
328
+ })
329
+ ])
330
+ )
331
+ }).nullish()
332
+ })
333
+ )
334
+ );
335
+ var anthropicMessagesChunkSchema = lazySchema2(
336
+ () => zodSchema2(
337
+ z2.discriminatedUnion("type", [
338
+ z2.object({
339
+ type: z2.literal("message_start"),
340
+ message: z2.object({
341
+ id: z2.string().nullish(),
342
+ model: z2.string().nullish(),
343
+ role: z2.string().nullish(),
344
+ usage: z2.looseObject({
345
+ input_tokens: z2.number(),
346
+ cache_creation_input_tokens: z2.number().nullish(),
347
+ cache_read_input_tokens: z2.number().nullish()
348
+ }),
349
+ // Programmatic tool calling: content may be pre-populated for deferred tool calls
350
+ content: z2.array(
351
+ z2.discriminatedUnion("type", [
352
+ z2.object({
353
+ type: z2.literal("tool_use"),
354
+ id: z2.string(),
355
+ name: z2.string(),
356
+ input: z2.unknown(),
357
+ caller: z2.union([
358
+ z2.object({
359
+ type: z2.literal("code_execution_20250825"),
360
+ tool_id: z2.string()
361
+ }),
362
+ z2.object({
363
+ type: z2.literal("direct")
364
+ })
365
+ ]).optional()
366
+ })
367
+ ])
368
+ ).nullish(),
369
+ stop_reason: z2.string().nullish(),
370
+ container: z2.object({
371
+ expires_at: z2.string(),
372
+ id: z2.string()
373
+ }).nullish()
374
+ })
375
+ }),
376
+ z2.object({
377
+ type: z2.literal("content_block_start"),
378
+ index: z2.number(),
379
+ content_block: z2.discriminatedUnion("type", [
380
+ z2.object({
381
+ type: z2.literal("text"),
382
+ text: z2.string()
383
+ }),
384
+ z2.object({
385
+ type: z2.literal("thinking"),
386
+ thinking: z2.string()
387
+ }),
388
+ z2.object({
389
+ type: z2.literal("tool_use"),
390
+ id: z2.string(),
391
+ name: z2.string(),
392
+ // Programmatic tool calling: input may be present directly for deferred tool calls
393
+ input: z2.record(z2.string(), z2.unknown()).optional(),
394
+ // Programmatic tool calling: caller info when triggered from code execution
395
+ caller: z2.union([
396
+ z2.object({
397
+ type: z2.literal("code_execution_20250825"),
398
+ tool_id: z2.string()
399
+ }),
400
+ z2.object({
401
+ type: z2.literal("direct")
402
+ })
403
+ ]).optional()
404
+ }),
405
+ z2.object({
406
+ type: z2.literal("redacted_thinking"),
407
+ data: z2.string()
408
+ }),
409
+ z2.object({
410
+ type: z2.literal("server_tool_use"),
411
+ id: z2.string(),
412
+ name: z2.string(),
413
+ input: z2.record(z2.string(), z2.unknown()).nullish()
414
+ }),
415
+ z2.object({
416
+ type: z2.literal("mcp_tool_use"),
417
+ id: z2.string(),
418
+ name: z2.string(),
419
+ input: z2.unknown(),
420
+ server_name: z2.string()
421
+ }),
422
+ z2.object({
423
+ type: z2.literal("mcp_tool_result"),
424
+ tool_use_id: z2.string(),
425
+ is_error: z2.boolean(),
426
+ content: z2.array(
427
+ z2.union([
428
+ z2.string(),
429
+ z2.object({ type: z2.literal("text"), text: z2.string() })
430
+ ])
431
+ )
432
+ }),
433
+ z2.object({
434
+ type: z2.literal("web_fetch_tool_result"),
435
+ tool_use_id: z2.string(),
436
+ content: z2.union([
437
+ z2.object({
438
+ type: z2.literal("web_fetch_result"),
439
+ url: z2.string(),
440
+ retrieved_at: z2.string(),
441
+ content: z2.object({
442
+ type: z2.literal("document"),
443
+ title: z2.string().nullable(),
444
+ citations: z2.object({ enabled: z2.boolean() }).optional(),
445
+ source: z2.union([
446
+ z2.object({
447
+ type: z2.literal("base64"),
448
+ media_type: z2.literal("application/pdf"),
449
+ data: z2.string()
450
+ }),
451
+ z2.object({
452
+ type: z2.literal("text"),
453
+ media_type: z2.literal("text/plain"),
454
+ data: z2.string()
455
+ })
456
+ ])
457
+ })
458
+ }),
459
+ z2.object({
460
+ type: z2.literal("web_fetch_tool_result_error"),
461
+ error_code: z2.string()
462
+ })
463
+ ])
464
+ }),
465
+ z2.object({
466
+ type: z2.literal("web_search_tool_result"),
467
+ tool_use_id: z2.string(),
468
+ content: z2.union([
469
+ z2.array(
470
+ z2.object({
471
+ type: z2.literal("web_search_result"),
472
+ url: z2.string(),
473
+ title: z2.string(),
474
+ encrypted_content: z2.string(),
475
+ page_age: z2.string().nullish()
476
+ })
477
+ ),
478
+ z2.object({
479
+ type: z2.literal("web_search_tool_result_error"),
480
+ error_code: z2.string()
481
+ })
482
+ ])
483
+ }),
484
+ // code execution results for code_execution_20250522 tool:
485
+ z2.object({
486
+ type: z2.literal("code_execution_tool_result"),
487
+ tool_use_id: z2.string(),
488
+ content: z2.union([
489
+ z2.object({
490
+ type: z2.literal("code_execution_result"),
491
+ stdout: z2.string(),
492
+ stderr: z2.string(),
493
+ return_code: z2.number(),
494
+ content: z2.array(
495
+ z2.object({
496
+ type: z2.literal("code_execution_output"),
497
+ file_id: z2.string()
498
+ })
499
+ ).optional().default([])
500
+ }),
501
+ z2.object({
502
+ type: z2.literal("code_execution_tool_result_error"),
503
+ error_code: z2.string()
504
+ })
505
+ ])
506
+ }),
507
+ // bash code execution results for code_execution_20250825 tool:
508
+ z2.object({
509
+ type: z2.literal("bash_code_execution_tool_result"),
510
+ tool_use_id: z2.string(),
511
+ content: z2.discriminatedUnion("type", [
512
+ z2.object({
513
+ type: z2.literal("bash_code_execution_result"),
514
+ content: z2.array(
515
+ z2.object({
516
+ type: z2.literal("bash_code_execution_output"),
517
+ file_id: z2.string()
518
+ })
519
+ ),
520
+ stdout: z2.string(),
521
+ stderr: z2.string(),
522
+ return_code: z2.number()
523
+ }),
524
+ z2.object({
525
+ type: z2.literal("bash_code_execution_tool_result_error"),
526
+ error_code: z2.string()
527
+ })
528
+ ])
529
+ }),
530
+ // text editor code execution results for code_execution_20250825 tool:
531
+ z2.object({
532
+ type: z2.literal("text_editor_code_execution_tool_result"),
533
+ tool_use_id: z2.string(),
534
+ content: z2.discriminatedUnion("type", [
535
+ z2.object({
536
+ type: z2.literal("text_editor_code_execution_tool_result_error"),
537
+ error_code: z2.string()
538
+ }),
539
+ z2.object({
540
+ type: z2.literal("text_editor_code_execution_view_result"),
541
+ content: z2.string(),
542
+ file_type: z2.string(),
543
+ num_lines: z2.number().nullable(),
544
+ start_line: z2.number().nullable(),
545
+ total_lines: z2.number().nullable()
546
+ }),
547
+ z2.object({
548
+ type: z2.literal("text_editor_code_execution_create_result"),
549
+ is_file_update: z2.boolean()
550
+ }),
551
+ z2.object({
552
+ type: z2.literal(
553
+ "text_editor_code_execution_str_replace_result"
554
+ ),
555
+ lines: z2.array(z2.string()).nullable(),
556
+ new_lines: z2.number().nullable(),
557
+ new_start: z2.number().nullable(),
558
+ old_lines: z2.number().nullable(),
559
+ old_start: z2.number().nullable()
560
+ })
561
+ ])
562
+ }),
563
+ // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
564
+ z2.object({
565
+ type: z2.literal("tool_search_tool_result"),
566
+ tool_use_id: z2.string(),
567
+ content: z2.union([
568
+ z2.object({
569
+ type: z2.literal("tool_search_tool_search_result"),
570
+ tool_references: z2.array(
571
+ z2.object({
572
+ type: z2.literal("tool_reference"),
573
+ tool_name: z2.string()
574
+ })
575
+ )
576
+ }),
577
+ z2.object({
578
+ type: z2.literal("tool_search_tool_result_error"),
579
+ error_code: z2.string()
580
+ })
581
+ ])
582
+ })
583
+ ])
584
+ }),
585
+ z2.object({
586
+ type: z2.literal("content_block_delta"),
587
+ index: z2.number(),
588
+ delta: z2.discriminatedUnion("type", [
589
+ z2.object({
590
+ type: z2.literal("input_json_delta"),
591
+ partial_json: z2.string()
592
+ }),
593
+ z2.object({
594
+ type: z2.literal("text_delta"),
595
+ text: z2.string()
596
+ }),
597
+ z2.object({
598
+ type: z2.literal("thinking_delta"),
599
+ thinking: z2.string()
600
+ }),
601
+ z2.object({
602
+ type: z2.literal("signature_delta"),
603
+ signature: z2.string()
604
+ }),
605
+ z2.object({
606
+ type: z2.literal("citations_delta"),
607
+ citation: z2.discriminatedUnion("type", [
608
+ z2.object({
609
+ type: z2.literal("web_search_result_location"),
610
+ cited_text: z2.string(),
611
+ url: z2.string(),
612
+ title: z2.string(),
613
+ encrypted_index: z2.string()
614
+ }),
615
+ z2.object({
616
+ type: z2.literal("page_location"),
617
+ cited_text: z2.string(),
618
+ document_index: z2.number(),
619
+ document_title: z2.string().nullable(),
620
+ start_page_number: z2.number(),
621
+ end_page_number: z2.number()
622
+ }),
623
+ z2.object({
624
+ type: z2.literal("char_location"),
625
+ cited_text: z2.string(),
626
+ document_index: z2.number(),
627
+ document_title: z2.string().nullable(),
628
+ start_char_index: z2.number(),
629
+ end_char_index: z2.number()
630
+ })
631
+ ])
632
+ })
633
+ ])
634
+ }),
635
+ z2.object({
636
+ type: z2.literal("content_block_stop"),
637
+ index: z2.number()
638
+ }),
639
+ z2.object({
640
+ type: z2.literal("error"),
641
+ error: z2.object({
642
+ type: z2.string(),
643
+ message: z2.string()
644
+ })
645
+ }),
646
+ z2.object({
647
+ type: z2.literal("message_delta"),
648
+ delta: z2.object({
649
+ stop_reason: z2.string().nullish(),
650
+ stop_sequence: z2.string().nullish(),
651
+ container: z2.object({
652
+ expires_at: z2.string(),
653
+ id: z2.string(),
654
+ skills: z2.array(
655
+ z2.object({
656
+ type: z2.union([
657
+ z2.literal("anthropic"),
658
+ z2.literal("custom")
659
+ ]),
660
+ skill_id: z2.string(),
661
+ version: z2.string()
662
+ })
663
+ ).nullish()
664
+ }).nullish(),
665
+ context_management: z2.object({
666
+ applied_edits: z2.array(
667
+ z2.union([
668
+ z2.object({
669
+ type: z2.literal("clear_tool_uses_20250919"),
670
+ cleared_tool_uses: z2.number(),
671
+ cleared_input_tokens: z2.number()
672
+ }),
673
+ z2.object({
674
+ type: z2.literal("clear_thinking_20251015"),
675
+ cleared_thinking_turns: z2.number(),
676
+ cleared_input_tokens: z2.number()
677
+ })
678
+ ])
679
+ )
680
+ }).nullish()
681
+ }),
682
+ usage: z2.looseObject({
683
+ output_tokens: z2.number(),
684
+ cache_creation_input_tokens: z2.number().nullish()
685
+ })
686
+ }),
687
+ z2.object({
688
+ type: z2.literal("message_stop")
689
+ }),
690
+ z2.object({
691
+ type: z2.literal("ping")
692
+ })
693
+ ])
694
+ )
695
+ );
696
+ var anthropicReasoningMetadataSchema = lazySchema2(
697
+ () => zodSchema2(
698
+ z2.object({
699
+ signature: z2.string().optional(),
700
+ redactedData: z2.string().optional()
701
+ })
702
+ )
703
+ );
704
+
705
+ // src/anthropic-messages-options.ts
706
+ import { z as z3 } from "zod/v4";
707
+ var anthropicFilePartProviderOptions = z3.object({
708
+ /**
709
+ * Citation configuration for this document.
710
+ * When enabled, this document will generate citations in the response.
711
+ */
712
+ citations: z3.object({
713
+ /**
714
+ * Enable citations for this document
715
+ */
716
+ enabled: z3.boolean()
717
+ }).optional(),
718
+ /**
719
+ * Custom title for the document.
720
+ * If not provided, the filename will be used.
721
+ */
722
+ title: z3.string().optional(),
723
+ /**
724
+ * Context about the document that will be passed to the model
725
+ * but not used towards cited content.
726
+ * Useful for storing document metadata as text or stringified JSON.
727
+ */
728
+ context: z3.string().optional()
729
+ });
730
+ var anthropicProviderOptions = z3.object({
731
+ /**
732
+ * Whether to send reasoning to the model.
733
+ *
734
+ * This allows you to deactivate reasoning inputs for models that do not support them.
735
+ */
736
+ sendReasoning: z3.boolean().optional(),
737
+ /**
738
+ * Determines how structured outputs are generated.
739
+ *
740
+ * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
741
+ * - `jsonTool`: Use a special 'json' tool to specify the structured output format.
742
+ * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
743
+ */
744
+ structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
745
+ /**
746
+ * Configuration for enabling Claude's extended thinking.
747
+ *
748
+ * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
749
+ * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
750
+ */
751
+ thinking: z3.object({
752
+ type: z3.union([z3.literal("enabled"), z3.literal("disabled")]),
753
+ budgetTokens: z3.number().optional()
754
+ }).optional(),
755
+ /**
756
+ * Whether to disable parallel function calling during tool use. Default is false.
757
+ * When set to true, Claude will use at most one tool per response.
758
+ */
759
+ disableParallelToolUse: z3.boolean().optional(),
760
+ /**
761
+ * Cache control settings for this message.
762
+ * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
763
+ */
764
+ cacheControl: z3.object({
765
+ type: z3.literal("ephemeral"),
766
+ ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
767
+ }).optional(),
768
+ /**
769
+ * MCP servers to be utilized in this request.
770
+ */
771
+ mcpServers: z3.array(
772
+ z3.object({
773
+ type: z3.literal("url"),
774
+ name: z3.string(),
775
+ url: z3.string(),
776
+ authorizationToken: z3.string().nullish(),
777
+ toolConfiguration: z3.object({
778
+ enabled: z3.boolean().nullish(),
779
+ allowedTools: z3.array(z3.string()).nullish()
780
+ }).nullish()
781
+ })
782
+ ).optional(),
783
+ /**
784
+ * Agent Skills configuration. Skills enable Claude to perform specialized tasks
785
+ * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
786
+ * Requires code execution tool to be enabled.
787
+ */
788
+ container: z3.object({
789
+ id: z3.string().optional(),
790
+ skills: z3.array(
791
+ z3.object({
792
+ type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
793
+ skillId: z3.string(),
794
+ version: z3.string().optional()
795
+ })
796
+ ).optional()
797
+ }).optional(),
798
+ /**
799
+ * Whether to enable tool streaming (and structured output streaming).
800
+ *
801
+ * When set to false, the model will return all tool calls and results
802
+ * at once after a delay.
803
+ *
804
+ * @default true
805
+ */
806
+ toolStreaming: z3.boolean().optional(),
807
+ /**
808
+ * @default 'high'
809
+ */
810
+ effort: z3.enum(["low", "medium", "high"]).optional(),
811
+ contextManagement: z3.object({
812
+ edits: z3.array(
813
+ z3.discriminatedUnion("type", [
814
+ z3.object({
815
+ type: z3.literal("clear_tool_uses_20250919"),
816
+ trigger: z3.discriminatedUnion("type", [
817
+ z3.object({
818
+ type: z3.literal("input_tokens"),
819
+ value: z3.number()
820
+ }),
821
+ z3.object({
822
+ type: z3.literal("tool_uses"),
823
+ value: z3.number()
824
+ })
825
+ ]).optional(),
826
+ keep: z3.object({
827
+ type: z3.literal("tool_uses"),
828
+ value: z3.number()
829
+ }).optional(),
830
+ clearAtLeast: z3.object({
831
+ type: z3.literal("input_tokens"),
832
+ value: z3.number()
833
+ }).optional(),
834
+ clearToolInputs: z3.boolean().optional(),
835
+ excludeTools: z3.array(z3.string()).optional()
836
+ }),
837
+ z3.object({
838
+ type: z3.literal("clear_thinking_20251015"),
839
+ keep: z3.union([
840
+ z3.literal("all"),
841
+ z3.object({
842
+ type: z3.literal("thinking_turns"),
843
+ value: z3.number()
844
+ })
845
+ ]).optional()
846
+ })
847
+ ])
848
+ )
849
+ }).optional()
850
+ });
851
+
852
+ // src/anthropic-prepare-tools.ts
853
+ import {
854
+ UnsupportedFunctionalityError
855
+ } from "@ai-sdk/provider";
856
+
857
+ // src/get-cache-control.ts
858
+ var MAX_CACHE_BREAKPOINTS = 4;
859
+ function getCacheControl(providerMetadata) {
860
+ var _a;
861
+ const anthropic2 = providerMetadata == null ? void 0 : providerMetadata.anthropic;
862
+ const cacheControlValue = (_a = anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ? _a : anthropic2 == null ? void 0 : anthropic2.cache_control;
863
+ return cacheControlValue;
864
+ }
865
+ var CacheControlValidator = class {
866
+ constructor() {
867
+ this.breakpointCount = 0;
868
+ this.warnings = [];
869
+ }
870
+ getCacheControl(providerMetadata, context) {
871
+ const cacheControlValue = getCacheControl(providerMetadata);
872
+ if (!cacheControlValue) {
873
+ return void 0;
874
+ }
875
+ if (!context.canCache) {
876
+ this.warnings.push({
877
+ type: "unsupported",
878
+ feature: "cache_control on non-cacheable context",
879
+ details: `cache_control cannot be set on ${context.type}. It will be ignored.`
880
+ });
881
+ return void 0;
882
+ }
883
+ this.breakpointCount++;
884
+ if (this.breakpointCount > MAX_CACHE_BREAKPOINTS) {
885
+ this.warnings.push({
886
+ type: "unsupported",
887
+ feature: "cacheControl breakpoint limit",
888
+ details: `Maximum ${MAX_CACHE_BREAKPOINTS} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`
889
+ });
890
+ return void 0;
891
+ }
892
+ return cacheControlValue;
893
+ }
894
+ getWarnings() {
895
+ return this.warnings;
896
+ }
897
+ };
898
+
899
+ // src/tool/text-editor_20250728.ts
900
+ import { createProviderToolFactory } from "@ai-sdk/provider-utils";
901
+ import { z as z4 } from "zod/v4";
902
+ import { lazySchema as lazySchema3, zodSchema as zodSchema3 } from "@ai-sdk/provider-utils";
903
+ var textEditor_20250728ArgsSchema = lazySchema3(
904
+ () => zodSchema3(
905
+ z4.object({
906
+ maxCharacters: z4.number().optional()
907
+ })
908
+ )
909
+ );
910
+ var textEditor_20250728InputSchema = lazySchema3(
911
+ () => zodSchema3(
912
+ z4.object({
913
+ command: z4.enum(["view", "create", "str_replace", "insert"]),
914
+ path: z4.string(),
915
+ file_text: z4.string().optional(),
916
+ insert_line: z4.number().int().optional(),
917
+ new_str: z4.string().optional(),
918
+ old_str: z4.string().optional(),
919
+ view_range: z4.array(z4.number().int()).optional()
920
+ })
921
+ )
922
+ );
923
+ var factory = createProviderToolFactory({
924
+ id: "anthropic.text_editor_20250728",
925
+ inputSchema: textEditor_20250728InputSchema
926
+ });
927
+ var textEditor_20250728 = (args = {}) => {
928
+ return factory(args);
929
+ };
930
+
931
+ // src/tool/web-search_20250305.ts
932
+ import {
933
+ createProviderToolFactoryWithOutputSchema,
934
+ lazySchema as lazySchema4,
935
+ zodSchema as zodSchema4
936
+ } from "@ai-sdk/provider-utils";
937
+ import { z as z5 } from "zod/v4";
938
+ var webSearch_20250305ArgsSchema = lazySchema4(
939
+ () => zodSchema4(
940
+ z5.object({
941
+ maxUses: z5.number().optional(),
942
+ allowedDomains: z5.array(z5.string()).optional(),
943
+ blockedDomains: z5.array(z5.string()).optional(),
944
+ userLocation: z5.object({
945
+ type: z5.literal("approximate"),
946
+ city: z5.string().optional(),
947
+ region: z5.string().optional(),
948
+ country: z5.string().optional(),
949
+ timezone: z5.string().optional()
950
+ }).optional()
951
+ })
952
+ )
953
+ );
954
+ var webSearch_20250305OutputSchema = lazySchema4(
955
+ () => zodSchema4(
956
+ z5.array(
957
+ z5.object({
958
+ url: z5.string(),
959
+ title: z5.string().nullable(),
960
+ pageAge: z5.string().nullable(),
961
+ encryptedContent: z5.string(),
962
+ type: z5.literal("web_search_result")
963
+ })
964
+ )
965
+ )
966
+ );
967
+ var webSearch_20250305InputSchema = lazySchema4(
968
+ () => zodSchema4(
969
+ z5.object({
970
+ query: z5.string()
971
+ })
972
+ )
973
+ );
974
+ var factory2 = createProviderToolFactoryWithOutputSchema({
975
+ id: "anthropic.web_search_20250305",
976
+ inputSchema: webSearch_20250305InputSchema,
977
+ outputSchema: webSearch_20250305OutputSchema,
978
+ supportsDeferredResults: true
979
+ });
980
+ var webSearch_20250305 = (args = {}) => {
981
+ return factory2(args);
982
+ };
983
+
984
+ // src/tool/web-fetch-20250910.ts
985
+ import {
986
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
987
+ lazySchema as lazySchema5,
988
+ zodSchema as zodSchema5
989
+ } from "@ai-sdk/provider-utils";
990
+ import { z as z6 } from "zod/v4";
991
+ var webFetch_20250910ArgsSchema = lazySchema5(
992
+ () => zodSchema5(
993
+ z6.object({
994
+ maxUses: z6.number().optional(),
995
+ allowedDomains: z6.array(z6.string()).optional(),
996
+ blockedDomains: z6.array(z6.string()).optional(),
997
+ citations: z6.object({ enabled: z6.boolean() }).optional(),
998
+ maxContentTokens: z6.number().optional()
999
+ })
1000
+ )
1001
+ );
1002
+ var webFetch_20250910OutputSchema = lazySchema5(
1003
+ () => zodSchema5(
1004
+ z6.object({
1005
+ type: z6.literal("web_fetch_result"),
1006
+ url: z6.string(),
1007
+ content: z6.object({
1008
+ type: z6.literal("document"),
1009
+ title: z6.string().nullable(),
1010
+ citations: z6.object({ enabled: z6.boolean() }).optional(),
1011
+ source: z6.union([
1012
+ z6.object({
1013
+ type: z6.literal("base64"),
1014
+ mediaType: z6.literal("application/pdf"),
1015
+ data: z6.string()
1016
+ }),
1017
+ z6.object({
1018
+ type: z6.literal("text"),
1019
+ mediaType: z6.literal("text/plain"),
1020
+ data: z6.string()
1021
+ })
1022
+ ])
1023
+ }),
1024
+ retrievedAt: z6.string().nullable()
1025
+ })
1026
+ )
1027
+ );
1028
+ var webFetch_20250910InputSchema = lazySchema5(
1029
+ () => zodSchema5(
1030
+ z6.object({
1031
+ url: z6.string()
1032
+ })
1033
+ )
1034
+ );
1035
+ var factory3 = createProviderToolFactoryWithOutputSchema2({
1036
+ id: "anthropic.web_fetch_20250910",
1037
+ inputSchema: webFetch_20250910InputSchema,
1038
+ outputSchema: webFetch_20250910OutputSchema,
1039
+ supportsDeferredResults: true
1040
+ });
1041
+ var webFetch_20250910 = (args = {}) => {
1042
+ return factory3(args);
1043
+ };
1044
+
1045
+ // src/anthropic-prepare-tools.ts
1046
+ import { validateTypes } from "@ai-sdk/provider-utils";
1047
+ async function prepareTools({
1048
+ tools,
1049
+ toolChoice,
1050
+ disableParallelToolUse,
1051
+ cacheControlValidator,
1052
+ supportsStructuredOutput
1053
+ }) {
1054
+ var _a;
1055
+ tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
1056
+ const toolWarnings = [];
1057
+ const betas = /* @__PURE__ */ new Set();
1058
+ const validator = cacheControlValidator || new CacheControlValidator();
1059
+ if (tools == null) {
1060
+ return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
1061
+ }
1062
+ const anthropicTools2 = [];
1063
+ for (const tool of tools) {
1064
+ switch (tool.type) {
1065
+ case "function": {
1066
+ const cacheControl = validator.getCacheControl(tool.providerOptions, {
1067
+ type: "tool definition",
1068
+ canCache: true
1069
+ });
1070
+ const anthropicOptions = (_a = tool.providerOptions) == null ? void 0 : _a.anthropic;
1071
+ const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
1072
+ const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
1073
+ anthropicTools2.push({
1074
+ name: tool.name,
1075
+ description: tool.description,
1076
+ input_schema: tool.inputSchema,
1077
+ cache_control: cacheControl,
1078
+ ...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {},
1079
+ ...deferLoading != null ? { defer_loading: deferLoading } : {},
1080
+ ...allowedCallers != null ? { allowed_callers: allowedCallers } : {},
1081
+ ...tool.inputExamples != null ? {
1082
+ input_examples: tool.inputExamples.map(
1083
+ (example) => example.input
1084
+ )
1085
+ } : {}
1086
+ });
1087
+ if (supportsStructuredOutput === true) {
1088
+ betas.add("structured-outputs-2025-11-13");
1089
+ }
1090
+ if (tool.inputExamples != null || allowedCallers != null) {
1091
+ betas.add("advanced-tool-use-2025-11-20");
1092
+ }
1093
+ break;
1094
+ }
1095
+ case "provider": {
1096
+ switch (tool.id) {
1097
+ case "anthropic.code_execution_20250522": {
1098
+ betas.add("code-execution-2025-05-22");
1099
+ anthropicTools2.push({
1100
+ type: "code_execution_20250522",
1101
+ name: "code_execution",
1102
+ cache_control: void 0
1103
+ });
1104
+ break;
1105
+ }
1106
+ case "anthropic.code_execution_20250825": {
1107
+ betas.add("code-execution-2025-08-25");
1108
+ anthropicTools2.push({
1109
+ type: "code_execution_20250825",
1110
+ name: "code_execution"
1111
+ });
1112
+ break;
1113
+ }
1114
+ case "anthropic.computer_20250124": {
1115
+ betas.add("computer-use-2025-01-24");
1116
+ anthropicTools2.push({
1117
+ name: "computer",
1118
+ type: "computer_20250124",
1119
+ display_width_px: tool.args.displayWidthPx,
1120
+ display_height_px: tool.args.displayHeightPx,
1121
+ display_number: tool.args.displayNumber,
1122
+ cache_control: void 0
1123
+ });
1124
+ break;
1125
+ }
1126
+ case "anthropic.computer_20241022": {
1127
+ betas.add("computer-use-2024-10-22");
1128
+ anthropicTools2.push({
1129
+ name: "computer",
1130
+ type: "computer_20241022",
1131
+ display_width_px: tool.args.displayWidthPx,
1132
+ display_height_px: tool.args.displayHeightPx,
1133
+ display_number: tool.args.displayNumber,
1134
+ cache_control: void 0
1135
+ });
1136
+ break;
1137
+ }
1138
+ case "anthropic.text_editor_20250124": {
1139
+ betas.add("computer-use-2025-01-24");
1140
+ anthropicTools2.push({
1141
+ name: "str_replace_editor",
1142
+ type: "text_editor_20250124",
1143
+ cache_control: void 0
1144
+ });
1145
+ break;
1146
+ }
1147
+ case "anthropic.text_editor_20241022": {
1148
+ betas.add("computer-use-2024-10-22");
1149
+ anthropicTools2.push({
1150
+ name: "str_replace_editor",
1151
+ type: "text_editor_20241022",
1152
+ cache_control: void 0
1153
+ });
1154
+ break;
1155
+ }
1156
+ case "anthropic.text_editor_20250429": {
1157
+ betas.add("computer-use-2025-01-24");
1158
+ anthropicTools2.push({
1159
+ name: "str_replace_based_edit_tool",
1160
+ type: "text_editor_20250429",
1161
+ cache_control: void 0
1162
+ });
1163
+ break;
1164
+ }
1165
+ case "anthropic.text_editor_20250728": {
1166
+ const args = await validateTypes({
1167
+ value: tool.args,
1168
+ schema: textEditor_20250728ArgsSchema
1169
+ });
1170
+ anthropicTools2.push({
1171
+ name: "str_replace_based_edit_tool",
1172
+ type: "text_editor_20250728",
1173
+ max_characters: args.maxCharacters,
1174
+ cache_control: void 0
1175
+ });
1176
+ break;
1177
+ }
1178
+ case "anthropic.bash_20250124": {
1179
+ betas.add("computer-use-2025-01-24");
1180
+ anthropicTools2.push({
1181
+ name: "bash",
1182
+ type: "bash_20250124",
1183
+ cache_control: void 0
1184
+ });
1185
+ break;
1186
+ }
1187
+ case "anthropic.bash_20241022": {
1188
+ betas.add("computer-use-2024-10-22");
1189
+ anthropicTools2.push({
1190
+ name: "bash",
1191
+ type: "bash_20241022",
1192
+ cache_control: void 0
1193
+ });
1194
+ break;
1195
+ }
1196
+ case "anthropic.memory_20250818": {
1197
+ betas.add("context-management-2025-06-27");
1198
+ anthropicTools2.push({
1199
+ name: "memory",
1200
+ type: "memory_20250818"
1201
+ });
1202
+ break;
1203
+ }
1204
+ case "anthropic.web_fetch_20250910": {
1205
+ betas.add("web-fetch-2025-09-10");
1206
+ const args = await validateTypes({
1207
+ value: tool.args,
1208
+ schema: webFetch_20250910ArgsSchema
1209
+ });
1210
+ anthropicTools2.push({
1211
+ type: "web_fetch_20250910",
1212
+ name: "web_fetch",
1213
+ max_uses: args.maxUses,
1214
+ allowed_domains: args.allowedDomains,
1215
+ blocked_domains: args.blockedDomains,
1216
+ citations: args.citations,
1217
+ max_content_tokens: args.maxContentTokens,
1218
+ cache_control: void 0
1219
+ });
1220
+ break;
1221
+ }
1222
+ case "anthropic.web_search_20250305": {
1223
+ const args = await validateTypes({
1224
+ value: tool.args,
1225
+ schema: webSearch_20250305ArgsSchema
1226
+ });
1227
+ anthropicTools2.push({
1228
+ type: "web_search_20250305",
1229
+ name: "web_search",
1230
+ max_uses: args.maxUses,
1231
+ allowed_domains: args.allowedDomains,
1232
+ blocked_domains: args.blockedDomains,
1233
+ user_location: args.userLocation,
1234
+ cache_control: void 0
1235
+ });
1236
+ break;
1237
+ }
1238
+ case "anthropic.tool_search_regex_20251119": {
1239
+ betas.add("advanced-tool-use-2025-11-20");
1240
+ anthropicTools2.push({
1241
+ type: "tool_search_tool_regex_20251119",
1242
+ name: "tool_search_tool_regex"
1243
+ });
1244
+ break;
1245
+ }
1246
+ case "anthropic.tool_search_bm25_20251119": {
1247
+ betas.add("advanced-tool-use-2025-11-20");
1248
+ anthropicTools2.push({
1249
+ type: "tool_search_tool_bm25_20251119",
1250
+ name: "tool_search_tool_bm25"
1251
+ });
1252
+ break;
1253
+ }
1254
+ default: {
1255
+ toolWarnings.push({
1256
+ type: "unsupported",
1257
+ feature: `provider-defined tool ${tool.id}`
1258
+ });
1259
+ break;
1260
+ }
1261
+ }
1262
+ break;
1263
+ }
1264
+ default: {
1265
+ toolWarnings.push({
1266
+ type: "unsupported",
1267
+ feature: `tool ${tool}`
1268
+ });
1269
+ break;
1270
+ }
1271
+ }
1272
+ }
1273
+ if (toolChoice == null) {
1274
+ return {
1275
+ tools: anthropicTools2,
1276
+ toolChoice: disableParallelToolUse ? { type: "auto", disable_parallel_tool_use: disableParallelToolUse } : void 0,
1277
+ toolWarnings,
1278
+ betas
1279
+ };
1280
+ }
1281
+ const type = toolChoice.type;
1282
+ switch (type) {
1283
+ case "auto":
1284
+ return {
1285
+ tools: anthropicTools2,
1286
+ toolChoice: {
1287
+ type: "auto",
1288
+ disable_parallel_tool_use: disableParallelToolUse
1289
+ },
1290
+ toolWarnings,
1291
+ betas
1292
+ };
1293
+ case "required":
1294
+ return {
1295
+ tools: anthropicTools2,
1296
+ toolChoice: {
1297
+ type: "any",
1298
+ disable_parallel_tool_use: disableParallelToolUse
1299
+ },
1300
+ toolWarnings,
1301
+ betas
1302
+ };
1303
+ case "none":
1304
+ return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
1305
+ case "tool":
1306
+ return {
1307
+ tools: anthropicTools2,
1308
+ toolChoice: {
1309
+ type: "tool",
1310
+ name: toolChoice.toolName,
1311
+ disable_parallel_tool_use: disableParallelToolUse
1312
+ },
1313
+ toolWarnings,
1314
+ betas
1315
+ };
1316
+ default: {
1317
+ const _exhaustiveCheck = type;
1318
+ throw new UnsupportedFunctionalityError({
1319
+ functionality: `tool choice type: ${_exhaustiveCheck}`
1320
+ });
1321
+ }
1322
+ }
1323
+ }
1324
+
1325
+ // src/convert-anthropic-messages-usage.ts
1326
+ function convertAnthropicMessagesUsage(usage) {
1327
+ var _a, _b;
1328
+ const inputTokens = usage.input_tokens;
1329
+ const outputTokens = usage.output_tokens;
1330
+ const cacheCreationTokens = (_a = usage.cache_creation_input_tokens) != null ? _a : 0;
1331
+ const cacheReadTokens = (_b = usage.cache_read_input_tokens) != null ? _b : 0;
1332
+ return {
1333
+ inputTokens: {
1334
+ total: inputTokens + cacheCreationTokens + cacheReadTokens,
1335
+ noCache: inputTokens,
1336
+ cacheRead: cacheReadTokens,
1337
+ cacheWrite: cacheCreationTokens
1338
+ },
1339
+ outputTokens: {
1340
+ total: outputTokens,
1341
+ text: void 0,
1342
+ reasoning: void 0
1343
+ },
1344
+ raw: usage
1345
+ };
1346
+ }
1347
+
1348
+ // src/convert-to-anthropic-messages-prompt.ts
1349
+ import {
1350
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError2
1351
+ } from "@ai-sdk/provider";
1352
+ import {
1353
+ convertToBase64,
1354
+ parseProviderOptions,
1355
+ validateTypes as validateTypes2,
1356
+ isNonNullable
1357
+ } from "@ai-sdk/provider-utils";
1358
+
1359
+ // src/tool/code-execution_20250522.ts
1360
+ import {
1361
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
1362
+ lazySchema as lazySchema6,
1363
+ zodSchema as zodSchema6
1364
+ } from "@ai-sdk/provider-utils";
1365
+ import { z as z7 } from "zod/v4";
1366
+ var codeExecution_20250522OutputSchema = lazySchema6(
1367
+ () => zodSchema6(
1368
+ z7.object({
1369
+ type: z7.literal("code_execution_result"),
1370
+ stdout: z7.string(),
1371
+ stderr: z7.string(),
1372
+ return_code: z7.number(),
1373
+ content: z7.array(
1374
+ z7.object({
1375
+ type: z7.literal("code_execution_output"),
1376
+ file_id: z7.string()
1377
+ })
1378
+ ).optional().default([])
1379
+ })
1380
+ )
1381
+ );
1382
+ var codeExecution_20250522InputSchema = lazySchema6(
1383
+ () => zodSchema6(
1384
+ z7.object({
1385
+ code: z7.string()
1386
+ })
1387
+ )
1388
+ );
1389
+ var factory4 = createProviderToolFactoryWithOutputSchema3({
1390
+ id: "anthropic.code_execution_20250522",
1391
+ inputSchema: codeExecution_20250522InputSchema,
1392
+ outputSchema: codeExecution_20250522OutputSchema
1393
+ });
1394
+ var codeExecution_20250522 = (args = {}) => {
1395
+ return factory4(args);
1396
+ };
1397
+
1398
+ // src/tool/code-execution_20250825.ts
1399
+ import {
1400
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
1401
+ lazySchema as lazySchema7,
1402
+ zodSchema as zodSchema7
1403
+ } from "@ai-sdk/provider-utils";
1404
+ import { z as z8 } from "zod/v4";
1405
+ var codeExecution_20250825OutputSchema = lazySchema7(
1406
+ () => zodSchema7(
1407
+ z8.discriminatedUnion("type", [
1408
+ z8.object({
1409
+ type: z8.literal("code_execution_result"),
1410
+ stdout: z8.string(),
1411
+ stderr: z8.string(),
1412
+ return_code: z8.number(),
1413
+ content: z8.array(
1414
+ z8.object({
1415
+ type: z8.literal("code_execution_output"),
1416
+ file_id: z8.string()
1417
+ })
1418
+ ).optional().default([])
1419
+ }),
1420
+ z8.object({
1421
+ type: z8.literal("bash_code_execution_result"),
1422
+ content: z8.array(
1423
+ z8.object({
1424
+ type: z8.literal("bash_code_execution_output"),
1425
+ file_id: z8.string()
1426
+ })
1427
+ ),
1428
+ stdout: z8.string(),
1429
+ stderr: z8.string(),
1430
+ return_code: z8.number()
1431
+ }),
1432
+ z8.object({
1433
+ type: z8.literal("bash_code_execution_tool_result_error"),
1434
+ error_code: z8.string()
1435
+ }),
1436
+ z8.object({
1437
+ type: z8.literal("text_editor_code_execution_tool_result_error"),
1438
+ error_code: z8.string()
1439
+ }),
1440
+ z8.object({
1441
+ type: z8.literal("text_editor_code_execution_view_result"),
1442
+ content: z8.string(),
1443
+ file_type: z8.string(),
1444
+ num_lines: z8.number().nullable(),
1445
+ start_line: z8.number().nullable(),
1446
+ total_lines: z8.number().nullable()
1447
+ }),
1448
+ z8.object({
1449
+ type: z8.literal("text_editor_code_execution_create_result"),
1450
+ is_file_update: z8.boolean()
1451
+ }),
1452
+ z8.object({
1453
+ type: z8.literal("text_editor_code_execution_str_replace_result"),
1454
+ lines: z8.array(z8.string()).nullable(),
1455
+ new_lines: z8.number().nullable(),
1456
+ new_start: z8.number().nullable(),
1457
+ old_lines: z8.number().nullable(),
1458
+ old_start: z8.number().nullable()
1459
+ })
1460
+ ])
1461
+ )
1462
+ );
1463
+ var codeExecution_20250825InputSchema = lazySchema7(
1464
+ () => zodSchema7(
1465
+ z8.discriminatedUnion("type", [
1466
+ // Programmatic tool calling format (mapped from { code } by AI SDK)
1467
+ z8.object({
1468
+ type: z8.literal("programmatic-tool-call"),
1469
+ code: z8.string()
1470
+ }),
1471
+ z8.object({
1472
+ type: z8.literal("bash_code_execution"),
1473
+ command: z8.string()
1474
+ }),
1475
+ z8.discriminatedUnion("command", [
1476
+ z8.object({
1477
+ type: z8.literal("text_editor_code_execution"),
1478
+ command: z8.literal("view"),
1479
+ path: z8.string()
1480
+ }),
1481
+ z8.object({
1482
+ type: z8.literal("text_editor_code_execution"),
1483
+ command: z8.literal("create"),
1484
+ path: z8.string(),
1485
+ file_text: z8.string().nullish()
1486
+ }),
1487
+ z8.object({
1488
+ type: z8.literal("text_editor_code_execution"),
1489
+ command: z8.literal("str_replace"),
1490
+ path: z8.string(),
1491
+ old_str: z8.string(),
1492
+ new_str: z8.string()
1493
+ })
1494
+ ])
1495
+ ])
1496
+ )
1497
+ );
1498
+ var factory5 = createProviderToolFactoryWithOutputSchema4({
1499
+ id: "anthropic.code_execution_20250825",
1500
+ inputSchema: codeExecution_20250825InputSchema,
1501
+ outputSchema: codeExecution_20250825OutputSchema,
1502
+ // Programmatic tool calling: tool results may be deferred to a later turn
1503
+ // when code execution triggers a client-executed tool that needs to be
1504
+ // resolved before the code execution result can be returned.
1505
+ supportsDeferredResults: true
1506
+ });
1507
+ var codeExecution_20250825 = (args = {}) => {
1508
+ return factory5(args);
1509
+ };
1510
+
1511
+ // src/tool/tool-search-regex_20251119.ts
1512
+ import {
1513
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
1514
+ lazySchema as lazySchema8,
1515
+ zodSchema as zodSchema8
1516
+ } from "@ai-sdk/provider-utils";
1517
+ import { z as z9 } from "zod/v4";
1518
+ var toolSearchRegex_20251119OutputSchema = lazySchema8(
1519
+ () => zodSchema8(
1520
+ z9.array(
1521
+ z9.object({
1522
+ type: z9.literal("tool_reference"),
1523
+ toolName: z9.string()
1524
+ })
1525
+ )
1526
+ )
1527
+ );
1528
+ var toolSearchRegex_20251119InputSchema = lazySchema8(
1529
+ () => zodSchema8(
1530
+ z9.object({
1531
+ /**
1532
+ * A regex pattern to search for tools.
1533
+ * Uses Python re.search() syntax. Maximum 200 characters.
1534
+ *
1535
+ * Examples:
1536
+ * - "weather" - matches tool names/descriptions containing "weather"
1537
+ * - "get_.*_data" - matches tools like get_user_data, get_weather_data
1538
+ * - "database.*query|query.*database" - OR patterns for flexibility
1539
+ * - "(?i)slack" - case-insensitive search
1540
+ */
1541
+ pattern: z9.string(),
1542
+ /**
1543
+ * Maximum number of tools to return. Optional.
1544
+ */
1545
+ limit: z9.number().optional()
1546
+ })
1547
+ )
1548
+ );
1549
+ var factory6 = createProviderToolFactoryWithOutputSchema5({
1550
+ id: "anthropic.tool_search_regex_20251119",
1551
+ inputSchema: toolSearchRegex_20251119InputSchema,
1552
+ outputSchema: toolSearchRegex_20251119OutputSchema
1553
+ });
1554
+ var toolSearchRegex_20251119 = (args = {}) => {
1555
+ return factory6(args);
1556
+ };
1557
+
1558
+ // src/convert-to-anthropic-messages-prompt.ts
1559
+ function convertToString(data) {
1560
+ if (typeof data === "string") {
1561
+ return Buffer.from(data, "base64").toString("utf-8");
1562
+ }
1563
+ if (data instanceof Uint8Array) {
1564
+ return new TextDecoder().decode(data);
1565
+ }
1566
+ if (data instanceof URL) {
1567
+ throw new UnsupportedFunctionalityError2({
1568
+ functionality: "URL-based text documents are not supported for citations"
1569
+ });
1570
+ }
1571
+ throw new UnsupportedFunctionalityError2({
1572
+ functionality: `unsupported data type for text documents: ${typeof data}`
1573
+ });
1574
+ }
1575
+ function isUrlData(data) {
1576
+ return data instanceof URL || isUrlString(data);
1577
+ }
1578
+ function isUrlString(data) {
1579
+ return typeof data === "string" && /^https?:\/\//i.test(data);
1580
+ }
1581
+ function getUrlString(data) {
1582
+ return data instanceof URL ? data.toString() : data;
1583
+ }
1584
+ async function convertToAnthropicMessagesPrompt({
1585
+ prompt,
1586
+ sendReasoning,
1587
+ warnings,
1588
+ cacheControlValidator,
1589
+ toolNameMapping
1590
+ }) {
1591
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
1592
+ const betas = /* @__PURE__ */ new Set();
1593
+ const blocks = groupIntoBlocks(prompt);
1594
+ const validator = cacheControlValidator || new CacheControlValidator();
1595
+ let system = void 0;
1596
+ const messages = [];
1597
+ async function shouldEnableCitations(providerMetadata) {
1598
+ var _a2, _b2;
1599
+ const anthropicOptions = await parseProviderOptions({
1600
+ provider: "anthropic",
1601
+ providerOptions: providerMetadata,
1602
+ schema: anthropicFilePartProviderOptions
1603
+ });
1604
+ return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
1605
+ }
1606
+ async function getDocumentMetadata(providerMetadata) {
1607
+ const anthropicOptions = await parseProviderOptions({
1608
+ provider: "anthropic",
1609
+ providerOptions: providerMetadata,
1610
+ schema: anthropicFilePartProviderOptions
1611
+ });
1612
+ return {
1613
+ title: anthropicOptions == null ? void 0 : anthropicOptions.title,
1614
+ context: anthropicOptions == null ? void 0 : anthropicOptions.context
1615
+ };
1616
+ }
1617
+ for (let i = 0; i < blocks.length; i++) {
1618
+ const block = blocks[i];
1619
+ const isLastBlock = i === blocks.length - 1;
1620
+ const type = block.type;
1621
+ switch (type) {
1622
+ case "system": {
1623
+ if (system != null) {
1624
+ throw new UnsupportedFunctionalityError2({
1625
+ functionality: "Multiple system messages that are separated by user/assistant messages"
1626
+ });
1627
+ }
1628
+ system = block.messages.map(({ content, providerOptions }) => ({
1629
+ type: "text",
1630
+ text: content,
1631
+ cache_control: validator.getCacheControl(providerOptions, {
1632
+ type: "system message",
1633
+ canCache: true
1634
+ })
1635
+ }));
1636
+ break;
1637
+ }
1638
+ case "user": {
1639
+ const anthropicContent = [];
1640
+ for (const message of block.messages) {
1641
+ const { role, content } = message;
1642
+ switch (role) {
1643
+ case "user": {
1644
+ for (let j = 0; j < content.length; j++) {
1645
+ const part = content[j];
1646
+ const isLastPart = j === content.length - 1;
1647
+ const cacheControl = (_a = validator.getCacheControl(part.providerOptions, {
1648
+ type: "user message part",
1649
+ canCache: true
1650
+ })) != null ? _a : isLastPart ? validator.getCacheControl(message.providerOptions, {
1651
+ type: "user message",
1652
+ canCache: true
1653
+ }) : void 0;
1654
+ switch (part.type) {
1655
+ case "text": {
1656
+ anthropicContent.push({
1657
+ type: "text",
1658
+ text: part.text,
1659
+ cache_control: cacheControl
1660
+ });
1661
+ break;
1662
+ }
1663
+ case "file": {
1664
+ if (part.mediaType.startsWith("image/")) {
1665
+ anthropicContent.push({
1666
+ type: "image",
1667
+ source: isUrlData(part.data) ? {
1668
+ type: "url",
1669
+ url: getUrlString(part.data)
1670
+ } : {
1671
+ type: "base64",
1672
+ media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
1673
+ data: convertToBase64(part.data)
1674
+ },
1675
+ cache_control: cacheControl
1676
+ });
1677
+ } else if (part.mediaType === "application/pdf") {
1678
+ betas.add("pdfs-2024-09-25");
1679
+ const enableCitations = await shouldEnableCitations(
1680
+ part.providerOptions
1681
+ );
1682
+ const metadata = await getDocumentMetadata(
1683
+ part.providerOptions
1684
+ );
1685
+ anthropicContent.push({
1686
+ type: "document",
1687
+ source: isUrlData(part.data) ? {
1688
+ type: "url",
1689
+ url: getUrlString(part.data)
1690
+ } : {
1691
+ type: "base64",
1692
+ media_type: "application/pdf",
1693
+ data: convertToBase64(part.data)
1694
+ },
1695
+ title: (_b = metadata.title) != null ? _b : part.filename,
1696
+ ...metadata.context && { context: metadata.context },
1697
+ ...enableCitations && {
1698
+ citations: { enabled: true }
1699
+ },
1700
+ cache_control: cacheControl
1701
+ });
1702
+ } else if (part.mediaType === "text/plain") {
1703
+ const enableCitations = await shouldEnableCitations(
1704
+ part.providerOptions
1705
+ );
1706
+ const metadata = await getDocumentMetadata(
1707
+ part.providerOptions
1708
+ );
1709
+ anthropicContent.push({
1710
+ type: "document",
1711
+ source: isUrlData(part.data) ? {
1712
+ type: "url",
1713
+ url: getUrlString(part.data)
1714
+ } : {
1715
+ type: "text",
1716
+ media_type: "text/plain",
1717
+ data: convertToString(part.data)
1718
+ },
1719
+ title: (_c = metadata.title) != null ? _c : part.filename,
1720
+ ...metadata.context && { context: metadata.context },
1721
+ ...enableCitations && {
1722
+ citations: { enabled: true }
1723
+ },
1724
+ cache_control: cacheControl
1725
+ });
1726
+ } else {
1727
+ throw new UnsupportedFunctionalityError2({
1728
+ functionality: `media type: ${part.mediaType}`
1729
+ });
1730
+ }
1731
+ break;
1732
+ }
1733
+ }
1734
+ }
1735
+ break;
1736
+ }
1737
+ case "tool": {
1738
+ for (let i2 = 0; i2 < content.length; i2++) {
1739
+ const part = content[i2];
1740
+ if (part.type === "tool-approval-response") {
1741
+ continue;
1742
+ }
1743
+ const isLastPart = i2 === content.length - 1;
1744
+ const cacheControl = (_d = validator.getCacheControl(part.providerOptions, {
1745
+ type: "tool result part",
1746
+ canCache: true
1747
+ })) != null ? _d : isLastPart ? validator.getCacheControl(message.providerOptions, {
1748
+ type: "tool result message",
1749
+ canCache: true
1750
+ }) : void 0;
1751
+ const output = part.output;
1752
+ let contentValue;
1753
+ switch (output.type) {
1754
+ case "content":
1755
+ contentValue = output.value.map((contentPart) => {
1756
+ switch (contentPart.type) {
1757
+ case "text":
1758
+ return {
1759
+ type: "text",
1760
+ text: contentPart.text
1761
+ };
1762
+ case "image-data": {
1763
+ return {
1764
+ type: "image",
1765
+ source: {
1766
+ type: "base64",
1767
+ media_type: contentPart.mediaType,
1768
+ data: contentPart.data
1769
+ }
1770
+ };
1771
+ }
1772
+ case "image-url": {
1773
+ return {
1774
+ type: "image",
1775
+ source: {
1776
+ type: "url",
1777
+ url: contentPart.url
1778
+ }
1779
+ };
1780
+ }
1781
+ case "file-url": {
1782
+ return {
1783
+ type: "document",
1784
+ source: {
1785
+ type: "url",
1786
+ url: contentPart.url
1787
+ }
1788
+ };
1789
+ }
1790
+ case "file-data": {
1791
+ if (contentPart.mediaType === "application/pdf") {
1792
+ betas.add("pdfs-2024-09-25");
1793
+ return {
1794
+ type: "document",
1795
+ source: {
1796
+ type: "base64",
1797
+ media_type: contentPart.mediaType,
1798
+ data: contentPart.data
1799
+ }
1800
+ };
1801
+ }
1802
+ warnings.push({
1803
+ type: "other",
1804
+ message: `unsupported tool content part type: ${contentPart.type} with media type: ${contentPart.mediaType}`
1805
+ });
1806
+ return void 0;
1807
+ }
1808
+ default: {
1809
+ warnings.push({
1810
+ type: "other",
1811
+ message: `unsupported tool content part type: ${contentPart.type}`
1812
+ });
1813
+ return void 0;
1814
+ }
1815
+ }
1816
+ }).filter(isNonNullable);
1817
+ break;
1818
+ case "text":
1819
+ case "error-text":
1820
+ contentValue = output.value;
1821
+ break;
1822
+ case "execution-denied":
1823
+ contentValue = (_e = output.reason) != null ? _e : "Tool execution denied.";
1824
+ break;
1825
+ case "json":
1826
+ case "error-json":
1827
+ default:
1828
+ contentValue = JSON.stringify(output.value);
1829
+ break;
1830
+ }
1831
+ anthropicContent.push({
1832
+ type: "tool_result",
1833
+ tool_use_id: part.toolCallId,
1834
+ content: contentValue,
1835
+ is_error: output.type === "error-text" || output.type === "error-json" ? true : void 0,
1836
+ cache_control: cacheControl
1837
+ });
1838
+ }
1839
+ break;
1840
+ }
1841
+ default: {
1842
+ const _exhaustiveCheck = role;
1843
+ throw new Error(`Unsupported role: ${_exhaustiveCheck}`);
1844
+ }
1845
+ }
1846
+ }
1847
+ messages.push({ role: "user", content: anthropicContent });
1848
+ break;
1849
+ }
1850
+ case "assistant": {
1851
+ const anthropicContent = [];
1852
+ const mcpToolUseIds = /* @__PURE__ */ new Set();
1853
+ for (let j = 0; j < block.messages.length; j++) {
1854
+ const message = block.messages[j];
1855
+ const isLastMessage = j === block.messages.length - 1;
1856
+ const { content } = message;
1857
+ for (let k = 0; k < content.length; k++) {
1858
+ const part = content[k];
1859
+ const isLastContentPart = k === content.length - 1;
1860
+ const cacheControl = (_f = validator.getCacheControl(part.providerOptions, {
1861
+ type: "assistant message part",
1862
+ canCache: true
1863
+ })) != null ? _f : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
1864
+ type: "assistant message",
1865
+ canCache: true
1866
+ }) : void 0;
1867
+ switch (part.type) {
1868
+ case "text": {
1869
+ anthropicContent.push({
1870
+ type: "text",
1871
+ text: (
1872
+ // trim the last text part if it's the last message in the block
1873
+ // because Anthropic does not allow trailing whitespace
1874
+ // in pre-filled assistant responses
1875
+ isLastBlock && isLastMessage && isLastContentPart ? part.text.trim() : part.text
1876
+ ),
1877
+ cache_control: cacheControl
1878
+ });
1879
+ break;
1880
+ }
1881
+ case "reasoning": {
1882
+ if (sendReasoning) {
1883
+ const reasoningMetadata = await parseProviderOptions({
1884
+ provider: "anthropic",
1885
+ providerOptions: part.providerOptions,
1886
+ schema: anthropicReasoningMetadataSchema
1887
+ });
1888
+ if (reasoningMetadata != null) {
1889
+ if (reasoningMetadata.signature != null) {
1890
+ validator.getCacheControl(part.providerOptions, {
1891
+ type: "thinking block",
1892
+ canCache: false
1893
+ });
1894
+ anthropicContent.push({
1895
+ type: "thinking",
1896
+ thinking: part.text,
1897
+ signature: reasoningMetadata.signature
1898
+ });
1899
+ } else if (reasoningMetadata.redactedData != null) {
1900
+ validator.getCacheControl(part.providerOptions, {
1901
+ type: "redacted thinking block",
1902
+ canCache: false
1903
+ });
1904
+ anthropicContent.push({
1905
+ type: "redacted_thinking",
1906
+ data: reasoningMetadata.redactedData
1907
+ });
1908
+ } else {
1909
+ warnings.push({
1910
+ type: "other",
1911
+ message: "unsupported reasoning metadata"
1912
+ });
1913
+ }
1914
+ } else {
1915
+ warnings.push({
1916
+ type: "other",
1917
+ message: "unsupported reasoning metadata"
1918
+ });
1919
+ }
1920
+ } else {
1921
+ warnings.push({
1922
+ type: "other",
1923
+ message: "sending reasoning content is disabled for this model"
1924
+ });
1925
+ }
1926
+ break;
1927
+ }
1928
+ case "tool-call": {
1929
+ if (part.providerExecuted) {
1930
+ const providerToolName = toolNameMapping.toProviderToolName(
1931
+ part.toolName
1932
+ );
1933
+ const isMcpToolUse = ((_h = (_g = part.providerOptions) == null ? void 0 : _g.anthropic) == null ? void 0 : _h.type) === "mcp-tool-use";
1934
+ if (isMcpToolUse) {
1935
+ mcpToolUseIds.add(part.toolCallId);
1936
+ const serverName = (_j = (_i = part.providerOptions) == null ? void 0 : _i.anthropic) == null ? void 0 : _j.serverName;
1937
+ if (serverName == null || typeof serverName !== "string") {
1938
+ warnings.push({
1939
+ type: "other",
1940
+ message: "mcp tool use server name is required and must be a string"
1941
+ });
1942
+ break;
1943
+ }
1944
+ anthropicContent.push({
1945
+ type: "mcp_tool_use",
1946
+ id: part.toolCallId,
1947
+ name: part.toolName,
1948
+ input: part.input,
1949
+ server_name: serverName,
1950
+ cache_control: cacheControl
1951
+ });
1952
+ } else if (
1953
+ // code execution 20250825:
1954
+ providerToolName === "code_execution" && part.input != null && typeof part.input === "object" && "type" in part.input && typeof part.input.type === "string" && (part.input.type === "bash_code_execution" || part.input.type === "text_editor_code_execution")
1955
+ ) {
1956
+ anthropicContent.push({
1957
+ type: "server_tool_use",
1958
+ id: part.toolCallId,
1959
+ name: part.input.type,
1960
+ // map back to subtool name
1961
+ input: part.input,
1962
+ cache_control: cacheControl
1963
+ });
1964
+ } else if (
1965
+ // code execution 20250825 programmatic tool calling:
1966
+ // Strip the fake 'programmatic-tool-call' type before sending to Anthropic
1967
+ providerToolName === "code_execution" && part.input != null && typeof part.input === "object" && "type" in part.input && part.input.type === "programmatic-tool-call"
1968
+ ) {
1969
+ const { type: _, ...inputWithoutType } = part.input;
1970
+ anthropicContent.push({
1971
+ type: "server_tool_use",
1972
+ id: part.toolCallId,
1973
+ name: "code_execution",
1974
+ input: inputWithoutType,
1975
+ cache_control: cacheControl
1976
+ });
1977
+ } else {
1978
+ if (providerToolName === "code_execution" || // code execution 20250522
1979
+ providerToolName === "web_fetch" || providerToolName === "web_search") {
1980
+ anthropicContent.push({
1981
+ type: "server_tool_use",
1982
+ id: part.toolCallId,
1983
+ name: providerToolName,
1984
+ input: part.input,
1985
+ cache_control: cacheControl
1986
+ });
1987
+ } else if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
1988
+ anthropicContent.push({
1989
+ type: "server_tool_use",
1990
+ id: part.toolCallId,
1991
+ name: providerToolName,
1992
+ input: part.input,
1993
+ cache_control: cacheControl
1994
+ });
1995
+ } else {
1996
+ warnings.push({
1997
+ type: "other",
1998
+ message: `provider executed tool call for tool ${part.toolName} is not supported`
1999
+ });
2000
+ }
2001
+ }
2002
+ break;
2003
+ }
2004
+ const callerOptions = (_k = part.providerOptions) == null ? void 0 : _k.anthropic;
2005
+ const caller = (callerOptions == null ? void 0 : callerOptions.caller) ? callerOptions.caller.type === "code_execution_20250825" && callerOptions.caller.toolId ? {
2006
+ type: "code_execution_20250825",
2007
+ tool_id: callerOptions.caller.toolId
2008
+ } : callerOptions.caller.type === "direct" ? { type: "direct" } : void 0 : void 0;
2009
+ anthropicContent.push({
2010
+ type: "tool_use",
2011
+ id: part.toolCallId,
2012
+ name: part.toolName,
2013
+ input: part.input,
2014
+ ...caller && { caller },
2015
+ cache_control: cacheControl
2016
+ });
2017
+ break;
2018
+ }
2019
+ case "tool-result": {
2020
+ const providerToolName = toolNameMapping.toProviderToolName(
2021
+ part.toolName
2022
+ );
2023
+ if (mcpToolUseIds.has(part.toolCallId)) {
2024
+ const output = part.output;
2025
+ if (output.type !== "json" && output.type !== "error-json") {
2026
+ warnings.push({
2027
+ type: "other",
2028
+ message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`
2029
+ });
2030
+ break;
2031
+ }
2032
+ anthropicContent.push({
2033
+ type: "mcp_tool_result",
2034
+ tool_use_id: part.toolCallId,
2035
+ is_error: output.type === "error-json",
2036
+ content: output.value,
2037
+ cache_control: cacheControl
2038
+ });
2039
+ } else if (providerToolName === "code_execution") {
2040
+ const output = part.output;
2041
+ if (output.type === "error-text" || output.type === "error-json") {
2042
+ let errorInfo = {};
2043
+ try {
2044
+ if (typeof output.value === "string") {
2045
+ errorInfo = JSON.parse(output.value);
2046
+ } else if (typeof output.value === "object" && output.value !== null) {
2047
+ errorInfo = output.value;
2048
+ }
2049
+ } catch (e) {
2050
+ }
2051
+ if (errorInfo.type === "code_execution_tool_result_error") {
2052
+ anthropicContent.push({
2053
+ type: "code_execution_tool_result",
2054
+ tool_use_id: part.toolCallId,
2055
+ content: {
2056
+ type: "code_execution_tool_result_error",
2057
+ error_code: (_l = errorInfo.errorCode) != null ? _l : "unknown"
2058
+ },
2059
+ cache_control: cacheControl
2060
+ });
2061
+ } else {
2062
+ anthropicContent.push({
2063
+ type: "bash_code_execution_tool_result",
2064
+ tool_use_id: part.toolCallId,
2065
+ cache_control: cacheControl,
2066
+ content: {
2067
+ type: "bash_code_execution_tool_result_error",
2068
+ error_code: (_m = errorInfo.errorCode) != null ? _m : "unknown"
2069
+ }
2070
+ });
2071
+ }
2072
+ break;
2073
+ }
2074
+ if (output.type !== "json") {
2075
+ warnings.push({
2076
+ type: "other",
2077
+ message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`
2078
+ });
2079
+ break;
2080
+ }
2081
+ if (output.value == null || typeof output.value !== "object" || !("type" in output.value) || typeof output.value.type !== "string") {
2082
+ warnings.push({
2083
+ type: "other",
2084
+ message: `provider executed tool result output value is not a valid code execution result for tool ${part.toolName}`
2085
+ });
2086
+ break;
2087
+ }
2088
+ if (output.value.type === "code_execution_result") {
2089
+ const codeExecutionOutput = await validateTypes2({
2090
+ value: output.value,
2091
+ schema: codeExecution_20250522OutputSchema
2092
+ });
2093
+ anthropicContent.push({
2094
+ type: "code_execution_tool_result",
2095
+ tool_use_id: part.toolCallId,
2096
+ content: {
2097
+ type: codeExecutionOutput.type,
2098
+ stdout: codeExecutionOutput.stdout,
2099
+ stderr: codeExecutionOutput.stderr,
2100
+ return_code: codeExecutionOutput.return_code,
2101
+ content: (_n = codeExecutionOutput.content) != null ? _n : []
2102
+ },
2103
+ cache_control: cacheControl
2104
+ });
2105
+ } else {
2106
+ const codeExecutionOutput = await validateTypes2({
2107
+ value: output.value,
2108
+ schema: codeExecution_20250825OutputSchema
2109
+ });
2110
+ if (codeExecutionOutput.type === "code_execution_result") {
2111
+ anthropicContent.push({
2112
+ type: "code_execution_tool_result",
2113
+ tool_use_id: part.toolCallId,
2114
+ content: {
2115
+ type: codeExecutionOutput.type,
2116
+ stdout: codeExecutionOutput.stdout,
2117
+ stderr: codeExecutionOutput.stderr,
2118
+ return_code: codeExecutionOutput.return_code,
2119
+ content: (_o = codeExecutionOutput.content) != null ? _o : []
2120
+ },
2121
+ cache_control: cacheControl
2122
+ });
2123
+ } else if (codeExecutionOutput.type === "bash_code_execution_result" || codeExecutionOutput.type === "bash_code_execution_tool_result_error") {
2124
+ anthropicContent.push({
2125
+ type: "bash_code_execution_tool_result",
2126
+ tool_use_id: part.toolCallId,
2127
+ cache_control: cacheControl,
2128
+ content: codeExecutionOutput
2129
+ });
2130
+ } else {
2131
+ anthropicContent.push({
2132
+ type: "text_editor_code_execution_tool_result",
2133
+ tool_use_id: part.toolCallId,
2134
+ cache_control: cacheControl,
2135
+ content: codeExecutionOutput
2136
+ });
2137
+ }
2138
+ }
2139
+ break;
2140
+ }
2141
+ if (providerToolName === "web_fetch") {
2142
+ const output = part.output;
2143
+ if (output.type === "error-json") {
2144
+ const errorValue = JSON.parse(output.value);
2145
+ anthropicContent.push({
2146
+ type: "web_fetch_tool_result",
2147
+ tool_use_id: part.toolCallId,
2148
+ content: {
2149
+ type: "web_fetch_tool_result_error",
2150
+ error_code: errorValue.errorCode
2151
+ },
2152
+ cache_control: cacheControl
2153
+ });
2154
+ break;
2155
+ }
2156
+ if (output.type !== "json") {
2157
+ warnings.push({
2158
+ type: "other",
2159
+ message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`
2160
+ });
2161
+ break;
2162
+ }
2163
+ const webFetchOutput = await validateTypes2({
2164
+ value: output.value,
2165
+ schema: webFetch_20250910OutputSchema
2166
+ });
2167
+ anthropicContent.push({
2168
+ type: "web_fetch_tool_result",
2169
+ tool_use_id: part.toolCallId,
2170
+ content: {
2171
+ type: "web_fetch_result",
2172
+ url: webFetchOutput.url,
2173
+ retrieved_at: webFetchOutput.retrievedAt,
2174
+ content: {
2175
+ type: "document",
2176
+ title: webFetchOutput.content.title,
2177
+ citations: webFetchOutput.content.citations,
2178
+ source: {
2179
+ type: webFetchOutput.content.source.type,
2180
+ media_type: webFetchOutput.content.source.mediaType,
2181
+ data: webFetchOutput.content.source.data
2182
+ }
2183
+ }
2184
+ },
2185
+ cache_control: cacheControl
2186
+ });
2187
+ break;
2188
+ }
2189
+ if (providerToolName === "web_search") {
2190
+ const output = part.output;
2191
+ if (output.type !== "json") {
2192
+ warnings.push({
2193
+ type: "other",
2194
+ message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`
2195
+ });
2196
+ break;
2197
+ }
2198
+ const webSearchOutput = await validateTypes2({
2199
+ value: output.value,
2200
+ schema: webSearch_20250305OutputSchema
2201
+ });
2202
+ anthropicContent.push({
2203
+ type: "web_search_tool_result",
2204
+ tool_use_id: part.toolCallId,
2205
+ content: webSearchOutput.map((result) => ({
2206
+ url: result.url,
2207
+ title: result.title,
2208
+ page_age: result.pageAge,
2209
+ encrypted_content: result.encryptedContent,
2210
+ type: result.type
2211
+ })),
2212
+ cache_control: cacheControl
2213
+ });
2214
+ break;
2215
+ }
2216
+ if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
2217
+ const output = part.output;
2218
+ if (output.type !== "json") {
2219
+ warnings.push({
2220
+ type: "other",
2221
+ message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`
2222
+ });
2223
+ break;
2224
+ }
2225
+ const toolSearchOutput = await validateTypes2({
2226
+ value: output.value,
2227
+ schema: toolSearchRegex_20251119OutputSchema
2228
+ });
2229
+ const toolReferences = toolSearchOutput.map((ref) => ({
2230
+ type: "tool_reference",
2231
+ tool_name: ref.toolName
2232
+ }));
2233
+ anthropicContent.push({
2234
+ type: "tool_search_tool_result",
2235
+ tool_use_id: part.toolCallId,
2236
+ content: {
2237
+ type: "tool_search_tool_search_result",
2238
+ tool_references: toolReferences
2239
+ },
2240
+ cache_control: cacheControl
2241
+ });
2242
+ break;
2243
+ }
2244
+ warnings.push({
2245
+ type: "other",
2246
+ message: `provider executed tool result for tool ${part.toolName} is not supported`
2247
+ });
2248
+ break;
2249
+ }
2250
+ }
2251
+ }
2252
+ }
2253
+ messages.push({ role: "assistant", content: anthropicContent });
2254
+ break;
2255
+ }
2256
+ default: {
2257
+ const _exhaustiveCheck = type;
2258
+ throw new Error(`content type: ${_exhaustiveCheck}`);
2259
+ }
2260
+ }
2261
+ }
2262
+ return {
2263
+ prompt: { system, messages },
2264
+ betas
2265
+ };
2266
+ }
2267
+ function groupIntoBlocks(prompt) {
2268
+ const blocks = [];
2269
+ let currentBlock = void 0;
2270
+ for (const message of prompt) {
2271
+ const { role } = message;
2272
+ switch (role) {
2273
+ case "system": {
2274
+ if ((currentBlock == null ? void 0 : currentBlock.type) !== "system") {
2275
+ currentBlock = { type: "system", messages: [] };
2276
+ blocks.push(currentBlock);
2277
+ }
2278
+ currentBlock.messages.push(message);
2279
+ break;
2280
+ }
2281
+ case "assistant": {
2282
+ if ((currentBlock == null ? void 0 : currentBlock.type) !== "assistant") {
2283
+ currentBlock = { type: "assistant", messages: [] };
2284
+ blocks.push(currentBlock);
2285
+ }
2286
+ currentBlock.messages.push(message);
2287
+ break;
2288
+ }
2289
+ case "user": {
2290
+ if ((currentBlock == null ? void 0 : currentBlock.type) !== "user") {
2291
+ currentBlock = { type: "user", messages: [] };
2292
+ blocks.push(currentBlock);
2293
+ }
2294
+ currentBlock.messages.push(message);
2295
+ break;
2296
+ }
2297
+ case "tool": {
2298
+ if ((currentBlock == null ? void 0 : currentBlock.type) !== "user") {
2299
+ currentBlock = { type: "user", messages: [] };
2300
+ blocks.push(currentBlock);
2301
+ }
2302
+ currentBlock.messages.push(message);
2303
+ break;
2304
+ }
2305
+ default: {
2306
+ const _exhaustiveCheck = role;
2307
+ throw new Error(`Unsupported role: ${_exhaustiveCheck}`);
2308
+ }
2309
+ }
2310
+ }
2311
+ return blocks;
2312
+ }
2313
+
2314
+ // src/map-anthropic-stop-reason.ts
2315
+ function mapAnthropicStopReason({
2316
+ finishReason,
2317
+ isJsonResponseFromTool
2318
+ }) {
2319
+ switch (finishReason) {
2320
+ case "pause_turn":
2321
+ case "end_turn":
2322
+ case "stop_sequence":
2323
+ return "stop";
2324
+ case "refusal":
2325
+ return "content-filter";
2326
+ case "tool_use":
2327
+ return isJsonResponseFromTool ? "stop" : "tool-calls";
2328
+ case "max_tokens":
2329
+ case "model_context_window_exceeded":
2330
+ return "length";
2331
+ default:
2332
+ return "other";
2333
+ }
2334
+ }
2335
+
2336
+ // src/anthropic-messages-language-model.ts
2337
+ function createCitationSource(citation, citationDocuments, generateId3) {
2338
+ var _a;
2339
+ if (citation.type !== "page_location" && citation.type !== "char_location") {
2340
+ return;
2341
+ }
2342
+ const documentInfo = citationDocuments[citation.document_index];
2343
+ if (!documentInfo) {
2344
+ return;
2345
+ }
2346
+ return {
2347
+ type: "source",
2348
+ sourceType: "document",
2349
+ id: generateId3(),
2350
+ mediaType: documentInfo.mediaType,
2351
+ title: (_a = citation.document_title) != null ? _a : documentInfo.title,
2352
+ filename: documentInfo.filename,
2353
+ providerMetadata: {
2354
+ anthropic: citation.type === "page_location" ? {
2355
+ citedText: citation.cited_text,
2356
+ startPageNumber: citation.start_page_number,
2357
+ endPageNumber: citation.end_page_number
2358
+ } : {
2359
+ citedText: citation.cited_text,
2360
+ startCharIndex: citation.start_char_index,
2361
+ endCharIndex: citation.end_char_index
2362
+ }
2363
+ }
2364
+ };
2365
+ }
2366
+ var AnthropicMessagesLanguageModel = class {
2367
+ constructor(modelId, config) {
2368
+ this.specificationVersion = "v3";
2369
+ var _a;
2370
+ this.modelId = modelId;
2371
+ this.config = config;
2372
+ this.generateId = (_a = config.generateId) != null ? _a : generateId;
2373
+ }
2374
+ supportsUrl(url) {
2375
+ return url.protocol === "https:";
2376
+ }
2377
+ get provider() {
2378
+ return this.config.provider;
2379
+ }
2380
+ get supportedUrls() {
2381
+ var _a, _b, _c;
2382
+ return (_c = (_b = (_a = this.config).supportedUrls) == null ? void 0 : _b.call(_a)) != null ? _c : {};
2383
+ }
2384
+ async getArgs({
2385
+ userSuppliedBetas,
2386
+ prompt,
2387
+ maxOutputTokens,
2388
+ temperature,
2389
+ topP,
2390
+ topK,
2391
+ frequencyPenalty,
2392
+ presencePenalty,
2393
+ stopSequences,
2394
+ responseFormat,
2395
+ seed,
2396
+ tools,
2397
+ toolChoice,
2398
+ providerOptions,
2399
+ stream
2400
+ }) {
2401
+ var _a, _b, _c, _d, _e, _f;
2402
+ const warnings = [];
2403
+ if (frequencyPenalty != null) {
2404
+ warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
2405
+ }
2406
+ if (presencePenalty != null) {
2407
+ warnings.push({ type: "unsupported", feature: "presencePenalty" });
2408
+ }
2409
+ if (seed != null) {
2410
+ warnings.push({ type: "unsupported", feature: "seed" });
2411
+ }
2412
+ if (temperature != null && temperature > 1) {
2413
+ warnings.push({
2414
+ type: "unsupported",
2415
+ feature: "temperature",
2416
+ details: `${temperature} exceeds anthropic maximum of 1.0. clamped to 1.0`
2417
+ });
2418
+ temperature = 1;
2419
+ } else if (temperature != null && temperature < 0) {
2420
+ warnings.push({
2421
+ type: "unsupported",
2422
+ feature: "temperature",
2423
+ details: `${temperature} is below anthropic minimum of 0. clamped to 0`
2424
+ });
2425
+ temperature = 0;
2426
+ }
2427
+ if ((responseFormat == null ? void 0 : responseFormat.type) === "json") {
2428
+ if (responseFormat.schema == null) {
2429
+ warnings.push({
2430
+ type: "unsupported",
2431
+ feature: "responseFormat",
2432
+ details: "JSON response format requires a schema. The response format is ignored."
2433
+ });
2434
+ }
2435
+ }
2436
+ const anthropicOptions = await parseProviderOptions2({
2437
+ provider: "anthropic",
2438
+ providerOptions,
2439
+ schema: anthropicProviderOptions
2440
+ });
2441
+ const {
2442
+ maxOutputTokens: maxOutputTokensForModel,
2443
+ supportsStructuredOutput: modelSupportsStructuredOutput,
2444
+ isKnownModel
2445
+ } = getModelCapabilities(this.modelId);
2446
+ const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
2447
+ const structureOutputMode = (_b = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b : "auto";
2448
+ const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2449
+ const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
2450
+ type: "function",
2451
+ name: "json",
2452
+ description: "Respond with a JSON object.",
2453
+ inputSchema: responseFormat.schema
2454
+ } : void 0;
2455
+ const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
2456
+ const cacheControlValidator = new CacheControlValidator();
2457
+ const toolNameMapping = createToolNameMapping({
2458
+ tools,
2459
+ providerToolNames: {
2460
+ "anthropic.code_execution_20250522": "code_execution",
2461
+ "anthropic.code_execution_20250825": "code_execution",
2462
+ "anthropic.computer_20241022": "computer",
2463
+ "anthropic.computer_20250124": "computer",
2464
+ "anthropic.text_editor_20241022": "str_replace_editor",
2465
+ "anthropic.text_editor_20250124": "str_replace_editor",
2466
+ "anthropic.text_editor_20250429": "str_replace_based_edit_tool",
2467
+ "anthropic.text_editor_20250728": "str_replace_based_edit_tool",
2468
+ "anthropic.bash_20241022": "bash",
2469
+ "anthropic.bash_20250124": "bash",
2470
+ "anthropic.memory_20250818": "memory",
2471
+ "anthropic.web_search_20250305": "web_search",
2472
+ "anthropic.web_fetch_20250910": "web_fetch",
2473
+ "anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
2474
+ "anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
2475
+ }
2476
+ });
2477
+ const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
2478
+ prompt,
2479
+ sendReasoning: (_c = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _c : true,
2480
+ warnings,
2481
+ cacheControlValidator,
2482
+ toolNameMapping
2483
+ });
2484
+ const isThinking = ((_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type) === "enabled";
2485
+ let thinkingBudget = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens;
2486
+ const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
2487
+ const baseArgs = {
2488
+ // model id:
2489
+ model: this.modelId,
2490
+ // standardized settings:
2491
+ max_tokens: maxTokens,
2492
+ temperature,
2493
+ top_k: topK,
2494
+ top_p: topP,
2495
+ stop_sequences: stopSequences,
2496
+ // provider specific settings:
2497
+ ...isThinking && {
2498
+ thinking: { type: "enabled", budget_tokens: thinkingBudget }
2499
+ },
2500
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && {
2501
+ output_config: { effort: anthropicOptions.effort }
2502
+ },
2503
+ // structured output:
2504
+ ...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
2505
+ output_format: {
2506
+ type: "json_schema",
2507
+ schema: responseFormat.schema
2508
+ }
2509
+ },
2510
+ // mcp servers:
2511
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
2512
+ mcp_servers: anthropicOptions.mcpServers.map((server) => ({
2513
+ type: server.type,
2514
+ name: server.name,
2515
+ url: server.url,
2516
+ authorization_token: server.authorizationToken,
2517
+ tool_configuration: server.toolConfiguration ? {
2518
+ allowed_tools: server.toolConfiguration.allowedTools,
2519
+ enabled: server.toolConfiguration.enabled
2520
+ } : void 0
2521
+ }))
2522
+ },
2523
+ // container: For programmatic tool calling (just an ID string) or agent skills (object with id and skills)
2524
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
2525
+ container: anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0 ? (
2526
+ // Object format when skills are provided (agent skills feature)
2527
+ {
2528
+ id: anthropicOptions.container.id,
2529
+ skills: anthropicOptions.container.skills.map((skill) => ({
2530
+ type: skill.type,
2531
+ skill_id: skill.skillId,
2532
+ version: skill.version
2533
+ }))
2534
+ }
2535
+ ) : (
2536
+ // String format for container ID only (programmatic tool calling)
2537
+ anthropicOptions.container.id
2538
+ )
2539
+ },
2540
+ // prompt:
2541
+ system: messagesPrompt.system,
2542
+ messages: messagesPrompt.messages,
2543
+ ...contextManagement && {
2544
+ context_management: {
2545
+ edits: contextManagement.edits.map((edit) => {
2546
+ const strategy = edit.type;
2547
+ switch (strategy) {
2548
+ case "clear_tool_uses_20250919":
2549
+ return {
2550
+ type: edit.type,
2551
+ ...edit.trigger !== void 0 && {
2552
+ trigger: edit.trigger
2553
+ },
2554
+ ...edit.keep !== void 0 && { keep: edit.keep },
2555
+ ...edit.clearAtLeast !== void 0 && {
2556
+ clear_at_least: edit.clearAtLeast
2557
+ },
2558
+ ...edit.clearToolInputs !== void 0 && {
2559
+ clear_tool_inputs: edit.clearToolInputs
2560
+ },
2561
+ ...edit.excludeTools !== void 0 && {
2562
+ exclude_tools: edit.excludeTools
2563
+ }
2564
+ };
2565
+ case "clear_thinking_20251015":
2566
+ return {
2567
+ type: edit.type,
2568
+ ...edit.keep !== void 0 && { keep: edit.keep }
2569
+ };
2570
+ default:
2571
+ warnings.push({
2572
+ type: "other",
2573
+ message: `Unknown context management strategy: ${strategy}`
2574
+ });
2575
+ return void 0;
2576
+ }
2577
+ }).filter((edit) => edit !== void 0)
2578
+ }
2579
+ }
2580
+ };
2581
+ if (isThinking) {
2582
+ if (thinkingBudget == null) {
2583
+ warnings.push({
2584
+ type: "compatibility",
2585
+ feature: "extended thinking",
2586
+ details: "thinking budget is required when thinking is enabled. using default budget of 1024 tokens."
2587
+ });
2588
+ baseArgs.thinking = {
2589
+ type: "enabled",
2590
+ budget_tokens: 1024
2591
+ };
2592
+ thinkingBudget = 1024;
2593
+ }
2594
+ if (baseArgs.temperature != null) {
2595
+ baseArgs.temperature = void 0;
2596
+ warnings.push({
2597
+ type: "unsupported",
2598
+ feature: "temperature",
2599
+ details: "temperature is not supported when thinking is enabled"
2600
+ });
2601
+ }
2602
+ if (topK != null) {
2603
+ baseArgs.top_k = void 0;
2604
+ warnings.push({
2605
+ type: "unsupported",
2606
+ feature: "topK",
2607
+ details: "topK is not supported when thinking is enabled"
2608
+ });
2609
+ }
2610
+ if (topP != null) {
2611
+ baseArgs.top_p = void 0;
2612
+ warnings.push({
2613
+ type: "unsupported",
2614
+ feature: "topP",
2615
+ details: "topP is not supported when thinking is enabled"
2616
+ });
2617
+ }
2618
+ baseArgs.max_tokens = maxTokens + (thinkingBudget != null ? thinkingBudget : 0);
2619
+ } else {
2620
+ if (topP != null && temperature != null) {
2621
+ warnings.push({
2622
+ type: "unsupported",
2623
+ feature: "topP",
2624
+ details: `topP is not supported when temperature is set. topP is ignored.`
2625
+ });
2626
+ baseArgs.top_p = void 0;
2627
+ }
2628
+ }
2629
+ if (isKnownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
2630
+ if (maxOutputTokens != null) {
2631
+ warnings.push({
2632
+ type: "unsupported",
2633
+ feature: "maxOutputTokens",
2634
+ details: `${baseArgs.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${maxOutputTokensForModel} max output tokens. The max output tokens have been limited to ${maxOutputTokensForModel}.`
2635
+ });
2636
+ }
2637
+ baseArgs.max_tokens = maxOutputTokensForModel;
2638
+ }
2639
+ if ((anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0) {
2640
+ betas.add("mcp-client-2025-04-04");
2641
+ }
2642
+ if (contextManagement) {
2643
+ betas.add("context-management-2025-06-27");
2644
+ }
2645
+ if ((anthropicOptions == null ? void 0 : anthropicOptions.container) && anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0) {
2646
+ betas.add("code-execution-2025-08-25");
2647
+ betas.add("skills-2025-10-02");
2648
+ betas.add("files-api-2025-04-14");
2649
+ if (!(tools == null ? void 0 : tools.some(
2650
+ (tool) => tool.type === "provider" && tool.id === "anthropic.code_execution_20250825"
2651
+ ))) {
2652
+ warnings.push({
2653
+ type: "other",
2654
+ message: "code execution tool is required when using skills"
2655
+ });
2656
+ }
2657
+ }
2658
+ if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
2659
+ betas.add("effort-2025-11-24");
2660
+ }
2661
+ if (stream && ((_f = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _f : true)) {
2662
+ betas.add("fine-grained-tool-streaming-2025-05-14");
2663
+ }
2664
+ const usingNativeOutputFormat = useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
2665
+ if (usingNativeOutputFormat) {
2666
+ betas.add("structured-outputs-2025-11-13");
2667
+ }
2668
+ const {
2669
+ tools: anthropicTools2,
2670
+ toolChoice: anthropicToolChoice,
2671
+ toolWarnings,
2672
+ betas: toolsBetas
2673
+ } = await prepareTools(
2674
+ jsonResponseTool != null ? {
2675
+ tools: [...tools != null ? tools : [], jsonResponseTool],
2676
+ toolChoice: { type: "required" },
2677
+ disableParallelToolUse: true,
2678
+ cacheControlValidator,
2679
+ supportsStructuredOutput
2680
+ } : {
2681
+ tools: tools != null ? tools : [],
2682
+ toolChoice,
2683
+ disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
2684
+ cacheControlValidator,
2685
+ supportsStructuredOutput
2686
+ }
2687
+ );
2688
+ const cacheWarnings = cacheControlValidator.getWarnings();
2689
+ return {
2690
+ args: {
2691
+ ...baseArgs,
2692
+ tools: anthropicTools2,
2693
+ tool_choice: anthropicToolChoice,
2694
+ stream: stream === true ? true : void 0
2695
+ // do not send when not streaming
2696
+ },
2697
+ warnings: [...warnings, ...toolWarnings, ...cacheWarnings],
2698
+ betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas, ...userSuppliedBetas]),
2699
+ usesJsonResponseTool: jsonResponseTool != null,
2700
+ toolNameMapping
2701
+ };
2702
+ }
2703
+ async getHeaders({
2704
+ betas,
2705
+ headers
2706
+ }) {
2707
+ return combineHeaders(
2708
+ await resolve(this.config.headers),
2709
+ headers,
2710
+ betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
2711
+ );
2712
+ }
2713
+ async getBetasFromHeaders(requestHeaders) {
2714
+ var _a, _b;
2715
+ const configHeaders = await resolve(this.config.headers);
2716
+ const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
2717
+ const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
2718
+ return new Set(
2719
+ [
2720
+ ...configBetaHeader.toLowerCase().split(","),
2721
+ ...requestBetaHeader.toLowerCase().split(",")
2722
+ ].map((beta) => beta.trim()).filter((beta) => beta !== "")
2723
+ );
2724
+ }
2725
+ buildRequestUrl(isStreaming) {
2726
+ var _a, _b, _c;
2727
+ return (_c = (_b = (_a = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
2728
+ }
2729
+ transformRequestBody(args) {
2730
+ var _a, _b, _c;
2731
+ return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args)) != null ? _c : args;
2732
+ }
2733
+ extractCitationDocuments(prompt) {
2734
+ const isCitationPart = (part) => {
2735
+ var _a, _b;
2736
+ if (part.type !== "file") {
2737
+ return false;
2738
+ }
2739
+ if (part.mediaType !== "application/pdf" && part.mediaType !== "text/plain") {
2740
+ return false;
2741
+ }
2742
+ const anthropic2 = (_a = part.providerOptions) == null ? void 0 : _a.anthropic;
2743
+ const citationsConfig = anthropic2 == null ? void 0 : anthropic2.citations;
2744
+ return (_b = citationsConfig == null ? void 0 : citationsConfig.enabled) != null ? _b : false;
2745
+ };
2746
+ return prompt.filter((message) => message.role === "user").flatMap((message) => message.content).filter(isCitationPart).map((part) => {
2747
+ var _a;
2748
+ const filePart = part;
2749
+ return {
2750
+ title: (_a = filePart.filename) != null ? _a : "Untitled Document",
2751
+ filename: filePart.filename,
2752
+ mediaType: filePart.mediaType
2753
+ };
2754
+ });
2755
+ }
2756
+ async doGenerate(options) {
2757
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
2758
+ const { args, warnings, betas, usesJsonResponseTool, toolNameMapping } = await this.getArgs({
2759
+ ...options,
2760
+ stream: false,
2761
+ userSuppliedBetas: await this.getBetasFromHeaders(options.headers)
2762
+ });
2763
+ const citationDocuments = this.extractCitationDocuments(options.prompt);
2764
+ const {
2765
+ responseHeaders,
2766
+ value: response,
2767
+ rawValue: rawResponse
2768
+ } = await postJsonToApi({
2769
+ url: this.buildRequestUrl(false),
2770
+ headers: await this.getHeaders({ betas, headers: options.headers }),
2771
+ body: this.transformRequestBody(args),
2772
+ failedResponseHandler: anthropicFailedResponseHandler,
2773
+ successfulResponseHandler: createJsonResponseHandler(
2774
+ anthropicMessagesResponseSchema
2775
+ ),
2776
+ abortSignal: options.abortSignal,
2777
+ fetch: this.config.fetch
2778
+ });
2779
+ const content = [];
2780
+ const mcpToolCalls = {};
2781
+ const serverToolCalls = {};
2782
+ let isJsonResponseFromTool = false;
2783
+ for (const part of response.content) {
2784
+ switch (part.type) {
2785
+ case "text": {
2786
+ if (!usesJsonResponseTool) {
2787
+ content.push({ type: "text", text: part.text });
2788
+ if (part.citations) {
2789
+ for (const citation of part.citations) {
2790
+ const source = createCitationSource(
2791
+ citation,
2792
+ citationDocuments,
2793
+ this.generateId
2794
+ );
2795
+ if (source) {
2796
+ content.push(source);
2797
+ }
2798
+ }
2799
+ }
2800
+ }
2801
+ break;
2802
+ }
2803
+ case "thinking": {
2804
+ content.push({
2805
+ type: "reasoning",
2806
+ text: part.thinking,
2807
+ providerMetadata: {
2808
+ anthropic: {
2809
+ signature: part.signature
2810
+ }
2811
+ }
2812
+ });
2813
+ break;
2814
+ }
2815
+ case "redacted_thinking": {
2816
+ content.push({
2817
+ type: "reasoning",
2818
+ text: "",
2819
+ providerMetadata: {
2820
+ anthropic: {
2821
+ redactedData: part.data
2822
+ }
2823
+ }
2824
+ });
2825
+ break;
2826
+ }
2827
+ case "tool_use": {
2828
+ const isJsonResponseTool = usesJsonResponseTool && part.name === "json";
2829
+ if (isJsonResponseTool) {
2830
+ isJsonResponseFromTool = true;
2831
+ content.push({
2832
+ type: "text",
2833
+ text: JSON.stringify(part.input)
2834
+ });
2835
+ } else {
2836
+ const caller = part.caller;
2837
+ const callerInfo = caller ? {
2838
+ type: caller.type,
2839
+ toolId: "tool_id" in caller ? caller.tool_id : void 0
2840
+ } : void 0;
2841
+ content.push({
2842
+ type: "tool-call",
2843
+ toolCallId: part.id,
2844
+ toolName: part.name,
2845
+ input: JSON.stringify(part.input),
2846
+ ...callerInfo && {
2847
+ providerMetadata: {
2848
+ anthropic: {
2849
+ caller: callerInfo
2850
+ }
2851
+ }
2852
+ }
2853
+ });
2854
+ }
2855
+ break;
2856
+ }
2857
+ case "server_tool_use": {
2858
+ if (part.name === "text_editor_code_execution" || part.name === "bash_code_execution") {
2859
+ content.push({
2860
+ type: "tool-call",
2861
+ toolCallId: part.id,
2862
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
2863
+ input: JSON.stringify({ type: part.name, ...part.input }),
2864
+ providerExecuted: true
2865
+ });
2866
+ } else if (part.name === "web_search" || part.name === "code_execution" || part.name === "web_fetch") {
2867
+ const inputToSerialize = part.name === "code_execution" && part.input != null && typeof part.input === "object" && "code" in part.input && !("type" in part.input) ? { type: "programmatic-tool-call", ...part.input } : part.input;
2868
+ content.push({
2869
+ type: "tool-call",
2870
+ toolCallId: part.id,
2871
+ toolName: toolNameMapping.toCustomToolName(part.name),
2872
+ input: JSON.stringify(inputToSerialize),
2873
+ providerExecuted: true
2874
+ });
2875
+ } else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
2876
+ serverToolCalls[part.id] = part.name;
2877
+ content.push({
2878
+ type: "tool-call",
2879
+ toolCallId: part.id,
2880
+ toolName: toolNameMapping.toCustomToolName(part.name),
2881
+ input: JSON.stringify(part.input),
2882
+ providerExecuted: true
2883
+ });
2884
+ }
2885
+ break;
2886
+ }
2887
+ case "mcp_tool_use": {
2888
+ mcpToolCalls[part.id] = {
2889
+ type: "tool-call",
2890
+ toolCallId: part.id,
2891
+ toolName: part.name,
2892
+ input: JSON.stringify(part.input),
2893
+ providerExecuted: true,
2894
+ dynamic: true,
2895
+ providerMetadata: {
2896
+ anthropic: {
2897
+ type: "mcp-tool-use",
2898
+ serverName: part.server_name
2899
+ }
2900
+ }
2901
+ };
2902
+ content.push(mcpToolCalls[part.id]);
2903
+ break;
2904
+ }
2905
+ case "mcp_tool_result": {
2906
+ content.push({
2907
+ type: "tool-result",
2908
+ toolCallId: part.tool_use_id,
2909
+ toolName: mcpToolCalls[part.tool_use_id].toolName,
2910
+ isError: part.is_error,
2911
+ result: part.content,
2912
+ dynamic: true,
2913
+ providerMetadata: mcpToolCalls[part.tool_use_id].providerMetadata
2914
+ });
2915
+ break;
2916
+ }
2917
+ case "web_fetch_tool_result": {
2918
+ if (part.content.type === "web_fetch_result") {
2919
+ content.push({
2920
+ type: "tool-result",
2921
+ toolCallId: part.tool_use_id,
2922
+ toolName: toolNameMapping.toCustomToolName("web_fetch"),
2923
+ result: {
2924
+ type: "web_fetch_result",
2925
+ url: part.content.url,
2926
+ retrievedAt: part.content.retrieved_at,
2927
+ content: {
2928
+ type: part.content.content.type,
2929
+ title: part.content.content.title,
2930
+ citations: part.content.content.citations,
2931
+ source: {
2932
+ type: part.content.content.source.type,
2933
+ mediaType: part.content.content.source.media_type,
2934
+ data: part.content.content.source.data
2935
+ }
2936
+ }
2937
+ }
2938
+ });
2939
+ } else if (part.content.type === "web_fetch_tool_result_error") {
2940
+ content.push({
2941
+ type: "tool-result",
2942
+ toolCallId: part.tool_use_id,
2943
+ toolName: toolNameMapping.toCustomToolName("web_fetch"),
2944
+ isError: true,
2945
+ result: {
2946
+ type: "web_fetch_tool_result_error",
2947
+ errorCode: part.content.error_code
2948
+ }
2949
+ });
2950
+ }
2951
+ break;
2952
+ }
2953
+ case "web_search_tool_result": {
2954
+ if (Array.isArray(part.content)) {
2955
+ content.push({
2956
+ type: "tool-result",
2957
+ toolCallId: part.tool_use_id,
2958
+ toolName: toolNameMapping.toCustomToolName("web_search"),
2959
+ result: part.content.map((result) => {
2960
+ var _a2;
2961
+ return {
2962
+ url: result.url,
2963
+ title: result.title,
2964
+ pageAge: (_a2 = result.page_age) != null ? _a2 : null,
2965
+ encryptedContent: result.encrypted_content,
2966
+ type: result.type
2967
+ };
2968
+ })
2969
+ });
2970
+ for (const result of part.content) {
2971
+ content.push({
2972
+ type: "source",
2973
+ sourceType: "url",
2974
+ id: this.generateId(),
2975
+ url: result.url,
2976
+ title: result.title,
2977
+ providerMetadata: {
2978
+ anthropic: {
2979
+ pageAge: (_a = result.page_age) != null ? _a : null
2980
+ }
2981
+ }
2982
+ });
2983
+ }
2984
+ } else {
2985
+ content.push({
2986
+ type: "tool-result",
2987
+ toolCallId: part.tool_use_id,
2988
+ toolName: toolNameMapping.toCustomToolName("web_search"),
2989
+ isError: true,
2990
+ result: {
2991
+ type: "web_search_tool_result_error",
2992
+ errorCode: part.content.error_code
2993
+ }
2994
+ });
2995
+ }
2996
+ break;
2997
+ }
2998
+ // code execution 20250522:
2999
+ case "code_execution_tool_result": {
3000
+ if (part.content.type === "code_execution_result") {
3001
+ content.push({
3002
+ type: "tool-result",
3003
+ toolCallId: part.tool_use_id,
3004
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
3005
+ result: {
3006
+ type: part.content.type,
3007
+ stdout: part.content.stdout,
3008
+ stderr: part.content.stderr,
3009
+ return_code: part.content.return_code,
3010
+ content: (_b = part.content.content) != null ? _b : []
3011
+ }
3012
+ });
3013
+ } else if (part.content.type === "code_execution_tool_result_error") {
3014
+ content.push({
3015
+ type: "tool-result",
3016
+ toolCallId: part.tool_use_id,
3017
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
3018
+ isError: true,
3019
+ result: {
3020
+ type: "code_execution_tool_result_error",
3021
+ errorCode: part.content.error_code
3022
+ }
3023
+ });
3024
+ }
3025
+ break;
3026
+ }
3027
+ // code execution 20250825:
3028
+ case "bash_code_execution_tool_result":
3029
+ case "text_editor_code_execution_tool_result": {
3030
+ content.push({
3031
+ type: "tool-result",
3032
+ toolCallId: part.tool_use_id,
3033
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
3034
+ result: part.content
3035
+ });
3036
+ break;
3037
+ }
3038
+ // tool search tool results:
3039
+ case "tool_search_tool_result": {
3040
+ const providerToolName = (_c = serverToolCalls[part.tool_use_id]) != null ? _c : "tool_search_tool_regex";
3041
+ if (part.content.type === "tool_search_tool_search_result") {
3042
+ content.push({
3043
+ type: "tool-result",
3044
+ toolCallId: part.tool_use_id,
3045
+ toolName: toolNameMapping.toCustomToolName(providerToolName),
3046
+ result: part.content.tool_references.map((ref) => ({
3047
+ type: ref.type,
3048
+ toolName: ref.tool_name
3049
+ }))
3050
+ });
3051
+ } else {
3052
+ content.push({
3053
+ type: "tool-result",
3054
+ toolCallId: part.tool_use_id,
3055
+ toolName: toolNameMapping.toCustomToolName(providerToolName),
3056
+ isError: true,
3057
+ result: {
3058
+ type: "tool_search_tool_result_error",
3059
+ errorCode: part.content.error_code
3060
+ }
3061
+ });
3062
+ }
3063
+ break;
3064
+ }
3065
+ }
3066
+ }
3067
+ return {
3068
+ content,
3069
+ finishReason: {
3070
+ unified: mapAnthropicStopReason({
3071
+ finishReason: response.stop_reason,
3072
+ isJsonResponseFromTool
3073
+ }),
3074
+ raw: (_d = response.stop_reason) != null ? _d : void 0
3075
+ },
3076
+ usage: convertAnthropicMessagesUsage(response.usage),
3077
+ request: { body: args },
3078
+ response: {
3079
+ id: (_e = response.id) != null ? _e : void 0,
3080
+ modelId: (_f = response.model) != null ? _f : void 0,
3081
+ headers: responseHeaders,
3082
+ body: rawResponse
3083
+ },
3084
+ warnings,
3085
+ providerMetadata: {
3086
+ anthropic: {
3087
+ usage: response.usage,
3088
+ cacheCreationInputTokens: (_g = response.usage.cache_creation_input_tokens) != null ? _g : null,
3089
+ stopSequence: (_h = response.stop_sequence) != null ? _h : null,
3090
+ container: response.container ? {
3091
+ expiresAt: response.container.expires_at,
3092
+ id: response.container.id,
3093
+ skills: (_j = (_i = response.container.skills) == null ? void 0 : _i.map((skill) => ({
3094
+ type: skill.type,
3095
+ skillId: skill.skill_id,
3096
+ version: skill.version
3097
+ }))) != null ? _j : null
3098
+ } : null,
3099
+ contextManagement: (_k = mapAnthropicResponseContextManagement(
3100
+ response.context_management
3101
+ )) != null ? _k : null
3102
+ }
3103
+ }
3104
+ };
3105
+ }
3106
+ async doStream(options) {
3107
+ var _a, _b;
3108
+ const {
3109
+ args: body,
3110
+ warnings,
3111
+ betas,
3112
+ usesJsonResponseTool,
3113
+ toolNameMapping
3114
+ } = await this.getArgs({
3115
+ ...options,
3116
+ stream: true,
3117
+ userSuppliedBetas: await this.getBetasFromHeaders(options.headers)
3118
+ });
3119
+ const citationDocuments = this.extractCitationDocuments(options.prompt);
3120
+ const url = this.buildRequestUrl(true);
3121
+ const { responseHeaders, value: response } = await postJsonToApi({
3122
+ url,
3123
+ headers: await this.getHeaders({ betas, headers: options.headers }),
3124
+ body: this.transformRequestBody(body),
3125
+ failedResponseHandler: anthropicFailedResponseHandler,
3126
+ successfulResponseHandler: createEventSourceResponseHandler(
3127
+ anthropicMessagesChunkSchema
3128
+ ),
3129
+ abortSignal: options.abortSignal,
3130
+ fetch: this.config.fetch
3131
+ });
3132
+ let finishReason = {
3133
+ unified: "other",
3134
+ raw: void 0
3135
+ };
3136
+ const usage = {
3137
+ input_tokens: 0,
3138
+ output_tokens: 0,
3139
+ cache_creation_input_tokens: 0,
3140
+ cache_read_input_tokens: 0
3141
+ };
3142
+ const contentBlocks = {};
3143
+ const mcpToolCalls = {};
3144
+ const serverToolCalls = {};
3145
+ let contextManagement = null;
3146
+ let rawUsage = void 0;
3147
+ let cacheCreationInputTokens = null;
3148
+ let stopSequence = null;
3149
+ let container = null;
3150
+ let isJsonResponseFromTool = false;
3151
+ let blockType = void 0;
3152
+ const generateId3 = this.generateId;
3153
+ const transformedStream = response.pipeThrough(
3154
+ new TransformStream({
3155
+ start(controller) {
3156
+ controller.enqueue({ type: "stream-start", warnings });
3157
+ },
3158
+ transform(chunk, controller) {
3159
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
3160
+ if (options.includeRawChunks) {
3161
+ controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
3162
+ }
3163
+ if (!chunk.success) {
3164
+ controller.enqueue({ type: "error", error: chunk.error });
3165
+ return;
3166
+ }
3167
+ const value = chunk.value;
3168
+ switch (value.type) {
3169
+ case "ping": {
3170
+ return;
3171
+ }
3172
+ case "content_block_start": {
3173
+ const part = value.content_block;
3174
+ const contentBlockType = part.type;
3175
+ blockType = contentBlockType;
3176
+ switch (contentBlockType) {
3177
+ case "text": {
3178
+ if (usesJsonResponseTool) {
3179
+ return;
3180
+ }
3181
+ contentBlocks[value.index] = { type: "text" };
3182
+ controller.enqueue({
3183
+ type: "text-start",
3184
+ id: String(value.index)
3185
+ });
3186
+ return;
3187
+ }
3188
+ case "thinking": {
3189
+ contentBlocks[value.index] = { type: "reasoning" };
3190
+ controller.enqueue({
3191
+ type: "reasoning-start",
3192
+ id: String(value.index)
3193
+ });
3194
+ return;
3195
+ }
3196
+ case "redacted_thinking": {
3197
+ contentBlocks[value.index] = { type: "reasoning" };
3198
+ controller.enqueue({
3199
+ type: "reasoning-start",
3200
+ id: String(value.index),
3201
+ providerMetadata: {
3202
+ anthropic: {
3203
+ redactedData: part.data
3204
+ }
3205
+ }
3206
+ });
3207
+ return;
3208
+ }
3209
+ case "tool_use": {
3210
+ const isJsonResponseTool = usesJsonResponseTool && part.name === "json";
3211
+ if (isJsonResponseTool) {
3212
+ isJsonResponseFromTool = true;
3213
+ contentBlocks[value.index] = { type: "text" };
3214
+ controller.enqueue({
3215
+ type: "text-start",
3216
+ id: String(value.index)
3217
+ });
3218
+ } else {
3219
+ const caller = part.caller;
3220
+ const callerInfo = caller ? {
3221
+ type: caller.type,
3222
+ toolId: "tool_id" in caller ? caller.tool_id : void 0
3223
+ } : void 0;
3224
+ const hasNonEmptyInput = part.input && Object.keys(part.input).length > 0;
3225
+ const initialInput = hasNonEmptyInput ? JSON.stringify(part.input) : "";
3226
+ contentBlocks[value.index] = {
3227
+ type: "tool-call",
3228
+ toolCallId: part.id,
3229
+ toolName: part.name,
3230
+ input: initialInput,
3231
+ firstDelta: initialInput.length === 0,
3232
+ ...callerInfo && { caller: callerInfo }
3233
+ };
3234
+ controller.enqueue({
3235
+ type: "tool-input-start",
3236
+ id: part.id,
3237
+ toolName: part.name
3238
+ });
3239
+ }
3240
+ return;
3241
+ }
3242
+ case "server_tool_use": {
3243
+ if ([
3244
+ "web_fetch",
3245
+ "web_search",
3246
+ // code execution 20250825:
3247
+ "code_execution",
3248
+ // code execution 20250825 text editor:
3249
+ "text_editor_code_execution",
3250
+ // code execution 20250825 bash:
3251
+ "bash_code_execution"
3252
+ ].includes(part.name)) {
3253
+ const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
3254
+ const customToolName = toolNameMapping.toCustomToolName(providerToolName);
3255
+ contentBlocks[value.index] = {
3256
+ type: "tool-call",
3257
+ toolCallId: part.id,
3258
+ toolName: customToolName,
3259
+ input: "",
3260
+ providerExecuted: true,
3261
+ firstDelta: true,
3262
+ providerToolName: part.name
3263
+ };
3264
+ controller.enqueue({
3265
+ type: "tool-input-start",
3266
+ id: part.id,
3267
+ toolName: customToolName,
3268
+ providerExecuted: true
3269
+ });
3270
+ } else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
3271
+ serverToolCalls[part.id] = part.name;
3272
+ const customToolName = toolNameMapping.toCustomToolName(
3273
+ part.name
3274
+ );
3275
+ contentBlocks[value.index] = {
3276
+ type: "tool-call",
3277
+ toolCallId: part.id,
3278
+ toolName: customToolName,
3279
+ input: "",
3280
+ providerExecuted: true,
3281
+ firstDelta: true,
3282
+ providerToolName: part.name
3283
+ };
3284
+ controller.enqueue({
3285
+ type: "tool-input-start",
3286
+ id: part.id,
3287
+ toolName: customToolName,
3288
+ providerExecuted: true
3289
+ });
3290
+ }
3291
+ return;
3292
+ }
3293
+ case "web_fetch_tool_result": {
3294
+ if (part.content.type === "web_fetch_result") {
3295
+ controller.enqueue({
3296
+ type: "tool-result",
3297
+ toolCallId: part.tool_use_id,
3298
+ toolName: toolNameMapping.toCustomToolName("web_fetch"),
3299
+ result: {
3300
+ type: "web_fetch_result",
3301
+ url: part.content.url,
3302
+ retrievedAt: part.content.retrieved_at,
3303
+ content: {
3304
+ type: part.content.content.type,
3305
+ title: part.content.content.title,
3306
+ citations: part.content.content.citations,
3307
+ source: {
3308
+ type: part.content.content.source.type,
3309
+ mediaType: part.content.content.source.media_type,
3310
+ data: part.content.content.source.data
3311
+ }
3312
+ }
3313
+ }
3314
+ });
3315
+ } else if (part.content.type === "web_fetch_tool_result_error") {
3316
+ controller.enqueue({
3317
+ type: "tool-result",
3318
+ toolCallId: part.tool_use_id,
3319
+ toolName: toolNameMapping.toCustomToolName("web_fetch"),
3320
+ isError: true,
3321
+ result: {
3322
+ type: "web_fetch_tool_result_error",
3323
+ errorCode: part.content.error_code
3324
+ }
3325
+ });
3326
+ }
3327
+ return;
3328
+ }
3329
+ case "web_search_tool_result": {
3330
+ if (Array.isArray(part.content)) {
3331
+ controller.enqueue({
3332
+ type: "tool-result",
3333
+ toolCallId: part.tool_use_id,
3334
+ toolName: toolNameMapping.toCustomToolName("web_search"),
3335
+ result: part.content.map((result) => {
3336
+ var _a3;
3337
+ return {
3338
+ url: result.url,
3339
+ title: result.title,
3340
+ pageAge: (_a3 = result.page_age) != null ? _a3 : null,
3341
+ encryptedContent: result.encrypted_content,
3342
+ type: result.type
3343
+ };
3344
+ })
3345
+ });
3346
+ for (const result of part.content) {
3347
+ controller.enqueue({
3348
+ type: "source",
3349
+ sourceType: "url",
3350
+ id: generateId3(),
3351
+ url: result.url,
3352
+ title: result.title,
3353
+ providerMetadata: {
3354
+ anthropic: {
3355
+ pageAge: (_a2 = result.page_age) != null ? _a2 : null
3356
+ }
3357
+ }
3358
+ });
3359
+ }
3360
+ } else {
3361
+ controller.enqueue({
3362
+ type: "tool-result",
3363
+ toolCallId: part.tool_use_id,
3364
+ toolName: toolNameMapping.toCustomToolName("web_search"),
3365
+ isError: true,
3366
+ result: {
3367
+ type: "web_search_tool_result_error",
3368
+ errorCode: part.content.error_code
3369
+ }
3370
+ });
3371
+ }
3372
+ return;
3373
+ }
3374
+ // code execution 20250522:
3375
+ case "code_execution_tool_result": {
3376
+ if (part.content.type === "code_execution_result") {
3377
+ controller.enqueue({
3378
+ type: "tool-result",
3379
+ toolCallId: part.tool_use_id,
3380
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
3381
+ result: {
3382
+ type: part.content.type,
3383
+ stdout: part.content.stdout,
3384
+ stderr: part.content.stderr,
3385
+ return_code: part.content.return_code,
3386
+ content: (_b2 = part.content.content) != null ? _b2 : []
3387
+ }
3388
+ });
3389
+ } else if (part.content.type === "code_execution_tool_result_error") {
3390
+ controller.enqueue({
3391
+ type: "tool-result",
3392
+ toolCallId: part.tool_use_id,
3393
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
3394
+ isError: true,
3395
+ result: {
3396
+ type: "code_execution_tool_result_error",
3397
+ errorCode: part.content.error_code
3398
+ }
3399
+ });
3400
+ }
3401
+ return;
3402
+ }
3403
+ // code execution 20250825:
3404
+ case "bash_code_execution_tool_result":
3405
+ case "text_editor_code_execution_tool_result": {
3406
+ controller.enqueue({
3407
+ type: "tool-result",
3408
+ toolCallId: part.tool_use_id,
3409
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
3410
+ result: part.content
3411
+ });
3412
+ return;
3413
+ }
3414
+ // tool search tool results:
3415
+ case "tool_search_tool_result": {
3416
+ const providerToolName = (_c = serverToolCalls[part.tool_use_id]) != null ? _c : "tool_search_tool_regex";
3417
+ if (part.content.type === "tool_search_tool_search_result") {
3418
+ controller.enqueue({
3419
+ type: "tool-result",
3420
+ toolCallId: part.tool_use_id,
3421
+ toolName: toolNameMapping.toCustomToolName(providerToolName),
3422
+ result: part.content.tool_references.map((ref) => ({
3423
+ type: ref.type,
3424
+ toolName: ref.tool_name
3425
+ }))
3426
+ });
3427
+ } else {
3428
+ controller.enqueue({
3429
+ type: "tool-result",
3430
+ toolCallId: part.tool_use_id,
3431
+ toolName: toolNameMapping.toCustomToolName(providerToolName),
3432
+ isError: true,
3433
+ result: {
3434
+ type: "tool_search_tool_result_error",
3435
+ errorCode: part.content.error_code
3436
+ }
3437
+ });
3438
+ }
3439
+ return;
3440
+ }
3441
+ case "mcp_tool_use": {
3442
+ mcpToolCalls[part.id] = {
3443
+ type: "tool-call",
3444
+ toolCallId: part.id,
3445
+ toolName: part.name,
3446
+ input: JSON.stringify(part.input),
3447
+ providerExecuted: true,
3448
+ dynamic: true,
3449
+ providerMetadata: {
3450
+ anthropic: {
3451
+ type: "mcp-tool-use",
3452
+ serverName: part.server_name
3453
+ }
3454
+ }
3455
+ };
3456
+ controller.enqueue(mcpToolCalls[part.id]);
3457
+ return;
3458
+ }
3459
+ case "mcp_tool_result": {
3460
+ controller.enqueue({
3461
+ type: "tool-result",
3462
+ toolCallId: part.tool_use_id,
3463
+ toolName: mcpToolCalls[part.tool_use_id].toolName,
3464
+ isError: part.is_error,
3465
+ result: part.content,
3466
+ dynamic: true,
3467
+ providerMetadata: mcpToolCalls[part.tool_use_id].providerMetadata
3468
+ });
3469
+ return;
3470
+ }
3471
+ default: {
3472
+ const _exhaustiveCheck = contentBlockType;
3473
+ throw new Error(
3474
+ `Unsupported content block type: ${_exhaustiveCheck}`
3475
+ );
3476
+ }
3477
+ }
3478
+ }
3479
+ case "content_block_stop": {
3480
+ if (contentBlocks[value.index] != null) {
3481
+ const contentBlock = contentBlocks[value.index];
3482
+ switch (contentBlock.type) {
3483
+ case "text": {
3484
+ controller.enqueue({
3485
+ type: "text-end",
3486
+ id: String(value.index)
3487
+ });
3488
+ break;
3489
+ }
3490
+ case "reasoning": {
3491
+ controller.enqueue({
3492
+ type: "reasoning-end",
3493
+ id: String(value.index)
3494
+ });
3495
+ break;
3496
+ }
3497
+ case "tool-call":
3498
+ const isJsonResponseTool = usesJsonResponseTool && contentBlock.toolName === "json";
3499
+ if (!isJsonResponseTool) {
3500
+ controller.enqueue({
3501
+ type: "tool-input-end",
3502
+ id: contentBlock.toolCallId
3503
+ });
3504
+ let finalInput = contentBlock.input === "" ? "{}" : contentBlock.input;
3505
+ if (contentBlock.providerToolName === "code_execution") {
3506
+ try {
3507
+ const parsed = JSON.parse(finalInput);
3508
+ if (parsed != null && typeof parsed === "object" && "code" in parsed && !("type" in parsed)) {
3509
+ finalInput = JSON.stringify({
3510
+ type: "programmatic-tool-call",
3511
+ ...parsed
3512
+ });
3513
+ }
3514
+ } catch (e) {
3515
+ }
3516
+ }
3517
+ controller.enqueue({
3518
+ type: "tool-call",
3519
+ toolCallId: contentBlock.toolCallId,
3520
+ toolName: contentBlock.toolName,
3521
+ input: finalInput,
3522
+ providerExecuted: contentBlock.providerExecuted,
3523
+ ...contentBlock.caller && {
3524
+ providerMetadata: {
3525
+ anthropic: {
3526
+ caller: contentBlock.caller
3527
+ }
3528
+ }
3529
+ }
3530
+ });
3531
+ }
3532
+ break;
3533
+ }
3534
+ delete contentBlocks[value.index];
3535
+ }
3536
+ blockType = void 0;
3537
+ return;
3538
+ }
3539
+ case "content_block_delta": {
3540
+ const deltaType = value.delta.type;
3541
+ switch (deltaType) {
3542
+ case "text_delta": {
3543
+ if (usesJsonResponseTool) {
3544
+ return;
3545
+ }
3546
+ controller.enqueue({
3547
+ type: "text-delta",
3548
+ id: String(value.index),
3549
+ delta: value.delta.text
3550
+ });
3551
+ return;
3552
+ }
3553
+ case "thinking_delta": {
3554
+ controller.enqueue({
3555
+ type: "reasoning-delta",
3556
+ id: String(value.index),
3557
+ delta: value.delta.thinking
3558
+ });
3559
+ return;
3560
+ }
3561
+ case "signature_delta": {
3562
+ if (blockType === "thinking") {
3563
+ controller.enqueue({
3564
+ type: "reasoning-delta",
3565
+ id: String(value.index),
3566
+ delta: "",
3567
+ providerMetadata: {
3568
+ anthropic: {
3569
+ signature: value.delta.signature
3570
+ }
3571
+ }
3572
+ });
3573
+ }
3574
+ return;
3575
+ }
3576
+ case "input_json_delta": {
3577
+ const contentBlock = contentBlocks[value.index];
3578
+ let delta = value.delta.partial_json;
3579
+ if (delta.length === 0) {
3580
+ return;
3581
+ }
3582
+ if (isJsonResponseFromTool) {
3583
+ if ((contentBlock == null ? void 0 : contentBlock.type) !== "text") {
3584
+ return;
3585
+ }
3586
+ controller.enqueue({
3587
+ type: "text-delta",
3588
+ id: String(value.index),
3589
+ delta
3590
+ });
3591
+ } else {
3592
+ if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
3593
+ return;
3594
+ }
3595
+ if (contentBlock.firstDelta && (contentBlock.providerToolName === "bash_code_execution" || contentBlock.providerToolName === "text_editor_code_execution")) {
3596
+ delta = `{"type": "${contentBlock.providerToolName}",${delta.substring(1)}`;
3597
+ }
3598
+ controller.enqueue({
3599
+ type: "tool-input-delta",
3600
+ id: contentBlock.toolCallId,
3601
+ delta
3602
+ });
3603
+ contentBlock.input += delta;
3604
+ contentBlock.firstDelta = false;
3605
+ }
3606
+ return;
3607
+ }
3608
+ case "citations_delta": {
3609
+ const citation = value.delta.citation;
3610
+ const source = createCitationSource(
3611
+ citation,
3612
+ citationDocuments,
3613
+ generateId3
3614
+ );
3615
+ if (source) {
3616
+ controller.enqueue(source);
3617
+ }
3618
+ return;
3619
+ }
3620
+ default: {
3621
+ const _exhaustiveCheck = deltaType;
3622
+ throw new Error(
3623
+ `Unsupported delta type: ${_exhaustiveCheck}`
3624
+ );
3625
+ }
3626
+ }
3627
+ }
3628
+ case "message_start": {
3629
+ usage.input_tokens = value.message.usage.input_tokens;
3630
+ usage.cache_read_input_tokens = (_d = value.message.usage.cache_read_input_tokens) != null ? _d : 0;
3631
+ usage.cache_creation_input_tokens = (_e = value.message.usage.cache_creation_input_tokens) != null ? _e : 0;
3632
+ rawUsage = {
3633
+ ...value.message.usage
3634
+ };
3635
+ cacheCreationInputTokens = (_f = value.message.usage.cache_creation_input_tokens) != null ? _f : null;
3636
+ if (value.message.container != null) {
3637
+ container = {
3638
+ expiresAt: value.message.container.expires_at,
3639
+ id: value.message.container.id,
3640
+ skills: null
3641
+ };
3642
+ }
3643
+ if (value.message.stop_reason != null) {
3644
+ finishReason = {
3645
+ unified: mapAnthropicStopReason({
3646
+ finishReason: value.message.stop_reason,
3647
+ isJsonResponseFromTool
3648
+ }),
3649
+ raw: value.message.stop_reason
3650
+ };
3651
+ }
3652
+ controller.enqueue({
3653
+ type: "response-metadata",
3654
+ id: (_g = value.message.id) != null ? _g : void 0,
3655
+ modelId: (_h = value.message.model) != null ? _h : void 0
3656
+ });
3657
+ if (value.message.content != null) {
3658
+ for (let contentIndex = 0; contentIndex < value.message.content.length; contentIndex++) {
3659
+ const part = value.message.content[contentIndex];
3660
+ if (part.type === "tool_use") {
3661
+ const caller = part.caller;
3662
+ const callerInfo = caller ? {
3663
+ type: caller.type,
3664
+ toolId: "tool_id" in caller ? caller.tool_id : void 0
3665
+ } : void 0;
3666
+ controller.enqueue({
3667
+ type: "tool-input-start",
3668
+ id: part.id,
3669
+ toolName: part.name
3670
+ });
3671
+ const inputStr = JSON.stringify((_i = part.input) != null ? _i : {});
3672
+ controller.enqueue({
3673
+ type: "tool-input-delta",
3674
+ id: part.id,
3675
+ delta: inputStr
3676
+ });
3677
+ controller.enqueue({
3678
+ type: "tool-input-end",
3679
+ id: part.id
3680
+ });
3681
+ controller.enqueue({
3682
+ type: "tool-call",
3683
+ toolCallId: part.id,
3684
+ toolName: part.name,
3685
+ input: inputStr,
3686
+ ...callerInfo && {
3687
+ providerMetadata: {
3688
+ anthropic: {
3689
+ caller: callerInfo
3690
+ }
3691
+ }
3692
+ }
3693
+ });
3694
+ }
3695
+ }
3696
+ }
3697
+ return;
3698
+ }
3699
+ case "message_delta": {
3700
+ usage.output_tokens = value.usage.output_tokens;
3701
+ finishReason = {
3702
+ unified: mapAnthropicStopReason({
3703
+ finishReason: value.delta.stop_reason,
3704
+ isJsonResponseFromTool
3705
+ }),
3706
+ raw: (_j = value.delta.stop_reason) != null ? _j : void 0
3707
+ };
3708
+ stopSequence = (_k = value.delta.stop_sequence) != null ? _k : null;
3709
+ container = value.delta.container != null ? {
3710
+ expiresAt: value.delta.container.expires_at,
3711
+ id: value.delta.container.id,
3712
+ skills: (_m = (_l = value.delta.container.skills) == null ? void 0 : _l.map((skill) => ({
3713
+ type: skill.type,
3714
+ skillId: skill.skill_id,
3715
+ version: skill.version
3716
+ }))) != null ? _m : null
3717
+ } : null;
3718
+ if (value.delta.context_management) {
3719
+ contextManagement = mapAnthropicResponseContextManagement(
3720
+ value.delta.context_management
3721
+ );
3722
+ }
3723
+ rawUsage = {
3724
+ ...rawUsage,
3725
+ ...value.usage
3726
+ };
3727
+ return;
3728
+ }
3729
+ case "message_stop": {
3730
+ controller.enqueue({
3731
+ type: "finish",
3732
+ finishReason,
3733
+ usage: convertAnthropicMessagesUsage(usage),
3734
+ providerMetadata: {
3735
+ anthropic: {
3736
+ usage: rawUsage != null ? rawUsage : null,
3737
+ cacheCreationInputTokens,
3738
+ stopSequence,
3739
+ container,
3740
+ contextManagement
3741
+ }
3742
+ }
3743
+ });
3744
+ return;
3745
+ }
3746
+ case "error": {
3747
+ controller.enqueue({ type: "error", error: value.error });
3748
+ return;
3749
+ }
3750
+ default: {
3751
+ const _exhaustiveCheck = value;
3752
+ throw new Error(`Unsupported chunk type: ${_exhaustiveCheck}`);
3753
+ }
3754
+ }
3755
+ }
3756
+ })
3757
+ );
3758
+ const [streamForFirstChunk, streamForConsumer] = transformedStream.tee();
3759
+ const firstChunkReader = streamForFirstChunk.getReader();
3760
+ try {
3761
+ await firstChunkReader.read();
3762
+ let result = await firstChunkReader.read();
3763
+ if (((_a = result.value) == null ? void 0 : _a.type) === "raw") {
3764
+ result = await firstChunkReader.read();
3765
+ }
3766
+ if (((_b = result.value) == null ? void 0 : _b.type) === "error") {
3767
+ const error = result.value.error;
3768
+ throw new APICallError({
3769
+ message: error.message,
3770
+ url,
3771
+ requestBodyValues: body,
3772
+ statusCode: error.type === "overloaded_error" ? 529 : 500,
3773
+ responseHeaders,
3774
+ responseBody: JSON.stringify(error),
3775
+ isRetryable: error.type === "overloaded_error"
3776
+ });
3777
+ }
3778
+ } finally {
3779
+ firstChunkReader.cancel().catch(() => {
3780
+ });
3781
+ firstChunkReader.releaseLock();
3782
+ }
3783
+ return {
3784
+ stream: streamForConsumer,
3785
+ request: { body },
3786
+ response: { headers: responseHeaders }
3787
+ };
3788
+ }
3789
+ };
3790
+ function getModelCapabilities(modelId) {
3791
+ if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
3792
+ return {
3793
+ maxOutputTokens: 64e3,
3794
+ supportsStructuredOutput: true,
3795
+ isKnownModel: true
3796
+ };
3797
+ } else if (modelId.includes("claude-opus-4-1")) {
3798
+ return {
3799
+ maxOutputTokens: 32e3,
3800
+ supportsStructuredOutput: true,
3801
+ isKnownModel: true
3802
+ };
3803
+ } else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet")) {
3804
+ return {
3805
+ maxOutputTokens: 64e3,
3806
+ supportsStructuredOutput: false,
3807
+ isKnownModel: true
3808
+ };
3809
+ } else if (modelId.includes("claude-opus-4-")) {
3810
+ return {
3811
+ maxOutputTokens: 32e3,
3812
+ supportsStructuredOutput: false,
3813
+ isKnownModel: true
3814
+ };
3815
+ } else if (modelId.includes("claude-3-5-haiku")) {
3816
+ return {
3817
+ maxOutputTokens: 8192,
3818
+ supportsStructuredOutput: false,
3819
+ isKnownModel: true
3820
+ };
3821
+ } else if (modelId.includes("claude-3-haiku")) {
3822
+ return {
3823
+ maxOutputTokens: 4096,
3824
+ supportsStructuredOutput: false,
3825
+ isKnownModel: true
3826
+ };
3827
+ } else {
3828
+ return {
3829
+ maxOutputTokens: 4096,
3830
+ supportsStructuredOutput: false,
3831
+ isKnownModel: false
3832
+ };
3833
+ }
3834
+ }
3835
+ function mapAnthropicResponseContextManagement(contextManagement) {
3836
+ return contextManagement ? {
3837
+ appliedEdits: contextManagement.applied_edits.map((edit) => {
3838
+ const strategy = edit.type;
3839
+ switch (strategy) {
3840
+ case "clear_tool_uses_20250919":
3841
+ return {
3842
+ type: edit.type,
3843
+ clearedToolUses: edit.cleared_tool_uses,
3844
+ clearedInputTokens: edit.cleared_input_tokens
3845
+ };
3846
+ case "clear_thinking_20251015":
3847
+ return {
3848
+ type: edit.type,
3849
+ clearedThinkingTurns: edit.cleared_thinking_turns,
3850
+ clearedInputTokens: edit.cleared_input_tokens
3851
+ };
3852
+ }
3853
+ }).filter((edit) => edit !== void 0)
3854
+ } : null;
3855
+ }
3856
+
3857
+ // src/tool/bash_20241022.ts
3858
+ import {
3859
+ createProviderToolFactory as createProviderToolFactory2,
3860
+ lazySchema as lazySchema9,
3861
+ zodSchema as zodSchema9
3862
+ } from "@ai-sdk/provider-utils";
3863
+ import { z as z10 } from "zod/v4";
3864
+ var bash_20241022InputSchema = lazySchema9(
3865
+ () => zodSchema9(
3866
+ z10.object({
3867
+ command: z10.string(),
3868
+ restart: z10.boolean().optional()
3869
+ })
3870
+ )
3871
+ );
3872
+ var bash_20241022 = createProviderToolFactory2({
3873
+ id: "anthropic.bash_20241022",
3874
+ inputSchema: bash_20241022InputSchema
3875
+ });
3876
+
3877
+ // src/tool/bash_20250124.ts
3878
+ import {
3879
+ createProviderToolFactory as createProviderToolFactory3,
3880
+ lazySchema as lazySchema10,
3881
+ zodSchema as zodSchema10
3882
+ } from "@ai-sdk/provider-utils";
3883
+ import { z as z11 } from "zod/v4";
3884
+ var bash_20250124InputSchema = lazySchema10(
3885
+ () => zodSchema10(
3886
+ z11.object({
3887
+ command: z11.string(),
3888
+ restart: z11.boolean().optional()
3889
+ })
3890
+ )
3891
+ );
3892
+ var bash_20250124 = createProviderToolFactory3({
3893
+ id: "anthropic.bash_20250124",
3894
+ inputSchema: bash_20250124InputSchema
3895
+ });
3896
+
3897
+ // src/tool/computer_20241022.ts
3898
+ import {
3899
+ createProviderToolFactory as createProviderToolFactory4,
3900
+ lazySchema as lazySchema11,
3901
+ zodSchema as zodSchema11
3902
+ } from "@ai-sdk/provider-utils";
3903
+ import { z as z12 } from "zod/v4";
3904
+ var computer_20241022InputSchema = lazySchema11(
3905
+ () => zodSchema11(
3906
+ z12.object({
3907
+ action: z12.enum([
3908
+ "key",
3909
+ "type",
3910
+ "mouse_move",
3911
+ "left_click",
3912
+ "left_click_drag",
3913
+ "right_click",
3914
+ "middle_click",
3915
+ "double_click",
3916
+ "screenshot",
3917
+ "cursor_position"
3918
+ ]),
3919
+ coordinate: z12.array(z12.number().int()).optional(),
3920
+ text: z12.string().optional()
3921
+ })
3922
+ )
3923
+ );
3924
+ var computer_20241022 = createProviderToolFactory4({
3925
+ id: "anthropic.computer_20241022",
3926
+ inputSchema: computer_20241022InputSchema
3927
+ });
3928
+
3929
+ // src/tool/computer_20250124.ts
3930
+ import {
3931
+ createProviderToolFactory as createProviderToolFactory5,
3932
+ lazySchema as lazySchema12,
3933
+ zodSchema as zodSchema12
3934
+ } from "@ai-sdk/provider-utils";
3935
+ import { z as z13 } from "zod/v4";
3936
+ var computer_20250124InputSchema = lazySchema12(
3937
+ () => zodSchema12(
3938
+ z13.object({
3939
+ action: z13.enum([
3940
+ "key",
3941
+ "hold_key",
3942
+ "type",
3943
+ "cursor_position",
3944
+ "mouse_move",
3945
+ "left_mouse_down",
3946
+ "left_mouse_up",
3947
+ "left_click",
3948
+ "left_click_drag",
3949
+ "right_click",
3950
+ "middle_click",
3951
+ "double_click",
3952
+ "triple_click",
3953
+ "scroll",
3954
+ "wait",
3955
+ "screenshot"
3956
+ ]),
3957
+ coordinate: z13.tuple([z13.number().int(), z13.number().int()]).optional(),
3958
+ duration: z13.number().optional(),
3959
+ scroll_amount: z13.number().optional(),
3960
+ scroll_direction: z13.enum(["up", "down", "left", "right"]).optional(),
3961
+ start_coordinate: z13.tuple([z13.number().int(), z13.number().int()]).optional(),
3962
+ text: z13.string().optional()
3963
+ })
3964
+ )
3965
+ );
3966
+ var computer_20250124 = createProviderToolFactory5({
3967
+ id: "anthropic.computer_20250124",
3968
+ inputSchema: computer_20250124InputSchema
3969
+ });
3970
+
3971
+ // src/tool/memory_20250818.ts
3972
+ import {
3973
+ createProviderToolFactory as createProviderToolFactory6,
3974
+ lazySchema as lazySchema13,
3975
+ zodSchema as zodSchema13
3976
+ } from "@ai-sdk/provider-utils";
3977
+ import { z as z14 } from "zod/v4";
3978
+ var memory_20250818InputSchema = lazySchema13(
3979
+ () => zodSchema13(
3980
+ z14.discriminatedUnion("command", [
3981
+ z14.object({
3982
+ command: z14.literal("view"),
3983
+ path: z14.string(),
3984
+ view_range: z14.tuple([z14.number(), z14.number()]).optional()
3985
+ }),
3986
+ z14.object({
3987
+ command: z14.literal("create"),
3988
+ path: z14.string(),
3989
+ file_text: z14.string()
3990
+ }),
3991
+ z14.object({
3992
+ command: z14.literal("str_replace"),
3993
+ path: z14.string(),
3994
+ old_str: z14.string(),
3995
+ new_str: z14.string()
3996
+ }),
3997
+ z14.object({
3998
+ command: z14.literal("insert"),
3999
+ path: z14.string(),
4000
+ insert_line: z14.number(),
4001
+ insert_text: z14.string()
4002
+ }),
4003
+ z14.object({
4004
+ command: z14.literal("delete"),
4005
+ path: z14.string()
4006
+ }),
4007
+ z14.object({
4008
+ command: z14.literal("rename"),
4009
+ old_path: z14.string(),
4010
+ new_path: z14.string()
4011
+ })
4012
+ ])
4013
+ )
4014
+ );
4015
+ var memory_20250818 = createProviderToolFactory6({
4016
+ id: "anthropic.memory_20250818",
4017
+ inputSchema: memory_20250818InputSchema
4018
+ });
4019
+
4020
+ // src/tool/text-editor_20241022.ts
4021
+ import {
4022
+ createProviderToolFactory as createProviderToolFactory7,
4023
+ lazySchema as lazySchema14,
4024
+ zodSchema as zodSchema14
4025
+ } from "@ai-sdk/provider-utils";
4026
+ import { z as z15 } from "zod/v4";
4027
+ var textEditor_20241022InputSchema = lazySchema14(
4028
+ () => zodSchema14(
4029
+ z15.object({
4030
+ command: z15.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4031
+ path: z15.string(),
4032
+ file_text: z15.string().optional(),
4033
+ insert_line: z15.number().int().optional(),
4034
+ new_str: z15.string().optional(),
4035
+ old_str: z15.string().optional(),
4036
+ view_range: z15.array(z15.number().int()).optional()
4037
+ })
4038
+ )
4039
+ );
4040
+ var textEditor_20241022 = createProviderToolFactory7({
4041
+ id: "anthropic.text_editor_20241022",
4042
+ inputSchema: textEditor_20241022InputSchema
4043
+ });
4044
+
4045
+ // src/tool/text-editor_20250124.ts
4046
+ import {
4047
+ createProviderToolFactory as createProviderToolFactory8,
4048
+ lazySchema as lazySchema15,
4049
+ zodSchema as zodSchema15
4050
+ } from "@ai-sdk/provider-utils";
4051
+ import { z as z16 } from "zod/v4";
4052
+ var textEditor_20250124InputSchema = lazySchema15(
4053
+ () => zodSchema15(
4054
+ z16.object({
4055
+ command: z16.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
4056
+ path: z16.string(),
4057
+ file_text: z16.string().optional(),
4058
+ insert_line: z16.number().int().optional(),
4059
+ new_str: z16.string().optional(),
4060
+ old_str: z16.string().optional(),
4061
+ view_range: z16.array(z16.number().int()).optional()
4062
+ })
4063
+ )
4064
+ );
4065
+ var textEditor_20250124 = createProviderToolFactory8({
4066
+ id: "anthropic.text_editor_20250124",
4067
+ inputSchema: textEditor_20250124InputSchema
4068
+ });
4069
+
4070
+ // src/tool/text-editor_20250429.ts
4071
+ import {
4072
+ createProviderToolFactory as createProviderToolFactory9,
4073
+ lazySchema as lazySchema16,
4074
+ zodSchema as zodSchema16
4075
+ } from "@ai-sdk/provider-utils";
4076
+ import { z as z17 } from "zod/v4";
4077
+ var textEditor_20250429InputSchema = lazySchema16(
4078
+ () => zodSchema16(
4079
+ z17.object({
4080
+ command: z17.enum(["view", "create", "str_replace", "insert"]),
4081
+ path: z17.string(),
4082
+ file_text: z17.string().optional(),
4083
+ insert_line: z17.number().int().optional(),
4084
+ new_str: z17.string().optional(),
4085
+ old_str: z17.string().optional(),
4086
+ view_range: z17.array(z17.number().int()).optional()
4087
+ })
4088
+ )
4089
+ );
4090
+ var textEditor_20250429 = createProviderToolFactory9({
4091
+ id: "anthropic.text_editor_20250429",
4092
+ inputSchema: textEditor_20250429InputSchema
4093
+ });
4094
+
4095
+ // src/tool/tool-search-bm25_20251119.ts
4096
+ import {
4097
+ createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
4098
+ lazySchema as lazySchema17,
4099
+ zodSchema as zodSchema17
4100
+ } from "@ai-sdk/provider-utils";
4101
+ import { z as z18 } from "zod/v4";
4102
+ var toolSearchBm25_20251119OutputSchema = lazySchema17(
4103
+ () => zodSchema17(
4104
+ z18.array(
4105
+ z18.object({
4106
+ type: z18.literal("tool_reference"),
4107
+ toolName: z18.string()
4108
+ })
4109
+ )
4110
+ )
4111
+ );
4112
+ var toolSearchBm25_20251119InputSchema = lazySchema17(
4113
+ () => zodSchema17(
4114
+ z18.object({
4115
+ /**
4116
+ * A natural language query to search for tools.
4117
+ * Claude will use BM25 text search to find relevant tools.
4118
+ */
4119
+ query: z18.string(),
4120
+ /**
4121
+ * Maximum number of tools to return. Optional.
4122
+ */
4123
+ limit: z18.number().optional()
4124
+ })
4125
+ )
4126
+ );
4127
+ var factory7 = createProviderToolFactoryWithOutputSchema6({
4128
+ id: "anthropic.tool_search_bm25_20251119",
4129
+ inputSchema: toolSearchBm25_20251119InputSchema,
4130
+ outputSchema: toolSearchBm25_20251119OutputSchema
4131
+ });
4132
+ var toolSearchBm25_20251119 = (args = {}) => {
4133
+ return factory7(args);
4134
+ };
4135
+
4136
+ // src/anthropic-tools.ts
4137
+ var anthropicTools = {
4138
+ /**
4139
+ * The bash tool enables Claude to execute shell commands in a persistent bash session,
4140
+ * allowing system operations, script execution, and command-line automation.
4141
+ *
4142
+ * Image results are supported.
4143
+ */
4144
+ bash_20241022,
4145
+ /**
4146
+ * The bash tool enables Claude to execute shell commands in a persistent bash session,
4147
+ * allowing system operations, script execution, and command-line automation.
4148
+ *
4149
+ * Image results are supported.
4150
+ */
4151
+ bash_20250124,
4152
+ /**
4153
+ * Claude can analyze data, create visualizations, perform complex calculations,
4154
+ * run system commands, create and edit files, and process uploaded files directly within
4155
+ * the API conversation.
4156
+ *
4157
+ * The code execution tool allows Claude to run Bash commands and manipulate files,
4158
+ * including writing code, in a secure, sandboxed environment.
4159
+ */
4160
+ codeExecution_20250522,
4161
+ /**
4162
+ * Claude can analyze data, create visualizations, perform complex calculations,
4163
+ * run system commands, create and edit files, and process uploaded files directly within
4164
+ * the API conversation.
4165
+ *
4166
+ * The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
4167
+ * including writing code, in a secure, sandboxed environment.
4168
+ *
4169
+ * This is the latest version with enhanced Bash support and file operations.
4170
+ */
4171
+ codeExecution_20250825,
4172
+ /**
4173
+ * Claude can interact with computer environments through the computer use tool, which
4174
+ * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
4175
+ *
4176
+ * Image results are supported.
4177
+ *
4178
+ * @param displayWidthPx - The width of the display being controlled by the model in pixels.
4179
+ * @param displayHeightPx - The height of the display being controlled by the model in pixels.
4180
+ * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
4181
+ */
4182
+ computer_20241022,
4183
+ /**
4184
+ * Claude can interact with computer environments through the computer use tool, which
4185
+ * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
4186
+ *
4187
+ * Image results are supported.
4188
+ *
4189
+ * @param displayWidthPx - The width of the display being controlled by the model in pixels.
4190
+ * @param displayHeightPx - The height of the display being controlled by the model in pixels.
4191
+ * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
4192
+ */
4193
+ computer_20250124,
4194
+ /**
4195
+ * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
4196
+ * Claude can create, read, update, and delete files that persist between sessions,
4197
+ * allowing it to build knowledge over time without keeping everything in the context window.
4198
+ * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
4199
+ *
4200
+ * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
4201
+ */
4202
+ memory_20250818,
4203
+ /**
4204
+ * Claude can use an Anthropic-defined text editor tool to view and modify text files,
4205
+ * helping you debug, fix, and improve your code or other text documents. This allows Claude
4206
+ * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
4207
+ *
4208
+ * Supported models: Claude Sonnet 3.5
4209
+ */
4210
+ textEditor_20241022,
4211
+ /**
4212
+ * Claude can use an Anthropic-defined text editor tool to view and modify text files,
4213
+ * helping you debug, fix, and improve your code or other text documents. This allows Claude
4214
+ * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
4215
+ *
4216
+ * Supported models: Claude Sonnet 3.7
4217
+ */
4218
+ textEditor_20250124,
4219
+ /**
4220
+ * Claude can use an Anthropic-defined text editor tool to view and modify text files,
4221
+ * helping you debug, fix, and improve your code or other text documents. This allows Claude
4222
+ * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
4223
+ *
4224
+ * Note: This version does not support the "undo_edit" command.
4225
+ *
4226
+ * @deprecated Use textEditor_20250728 instead
4227
+ */
4228
+ textEditor_20250429,
4229
+ /**
4230
+ * Claude can use an Anthropic-defined text editor tool to view and modify text files,
4231
+ * helping you debug, fix, and improve your code or other text documents. This allows Claude
4232
+ * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
4233
+ *
4234
+ * Note: This version does not support the "undo_edit" command and adds optional max_characters parameter.
4235
+ *
4236
+ * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1
4237
+ *
4238
+ * @param maxCharacters - Optional maximum number of characters to view in the file
4239
+ */
4240
+ textEditor_20250728,
4241
+ /**
4242
+ * Creates a web fetch tool that gives Claude direct access to real-time web content.
4243
+ *
4244
+ * @param maxUses - The max_uses parameter limits the number of web fetches performed
4245
+ * @param allowedDomains - Only fetch from these domains
4246
+ * @param blockedDomains - Never fetch from these domains
4247
+ * @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
4248
+ * @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
4249
+ */
4250
+ webFetch_20250910,
4251
+ /**
4252
+ * Creates a web search tool that gives Claude direct access to real-time web content.
4253
+ *
4254
+ * @param maxUses - Maximum number of web searches Claude can perform during the conversation.
4255
+ * @param allowedDomains - Optional list of domains that Claude is allowed to search.
4256
+ * @param blockedDomains - Optional list of domains that Claude should avoid when searching.
4257
+ * @param userLocation - Optional user location information to provide geographically relevant search results.
4258
+ */
4259
+ webSearch_20250305,
4260
+ /**
4261
+ * Creates a tool search tool that uses regex patterns to find tools.
4262
+ *
4263
+ * The tool search tool enables Claude to work with hundreds or thousands of tools
4264
+ * by dynamically discovering and loading them on-demand. Instead of loading all
4265
+ * tool definitions into the context window upfront, Claude searches your tool
4266
+ * catalog and loads only the tools it needs.
4267
+ *
4268
+ * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
4269
+ * to mark them for deferred loading.
4270
+ *
4271
+ * Supported models: Claude Opus 4.5, Claude Sonnet 4.5
4272
+ */
4273
+ toolSearchRegex_20251119,
4274
+ /**
4275
+ * Creates a tool search tool that uses BM25 (natural language) to find tools.
4276
+ *
4277
+ * The tool search tool enables Claude to work with hundreds or thousands of tools
4278
+ * by dynamically discovering and loading them on-demand. Instead of loading all
4279
+ * tool definitions into the context window upfront, Claude searches your tool
4280
+ * catalog and loads only the tools it needs.
4281
+ *
4282
+ * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
4283
+ * to mark them for deferred loading.
4284
+ *
4285
+ * Supported models: Claude Opus 4.5, Claude Sonnet 4.5
4286
+ */
4287
+ toolSearchBm25_20251119
4288
+ };
4289
+
4290
+ // src/anthropic-provider.ts
4291
+ function createAnthropic(options = {}) {
4292
+ var _a, _b;
4293
+ const baseURL = (_a = withoutTrailingSlash(
4294
+ loadOptionalSetting({
4295
+ settingValue: options.baseURL,
4296
+ environmentVariableName: "ANTHROPIC_BASE_URL"
4297
+ })
4298
+ )) != null ? _a : "https://api.anthropic.com/v1";
4299
+ const providerName = (_b = options.name) != null ? _b : "anthropic.messages";
4300
+ const getHeaders = () => withUserAgentSuffix(
4301
+ {
4302
+ "anthropic-version": "2023-06-01",
4303
+ "x-api-key": loadApiKey({
4304
+ apiKey: options.apiKey,
4305
+ environmentVariableName: "ANTHROPIC_API_KEY",
4306
+ description: "Anthropic"
4307
+ }),
4308
+ ...options.headers
4309
+ },
4310
+ `ai-sdk/anthropic/${VERSION}`
4311
+ );
4312
+ const createChatModel = (modelId) => {
4313
+ var _a2;
4314
+ return new AnthropicMessagesLanguageModel(modelId, {
4315
+ provider: providerName,
4316
+ baseURL,
4317
+ headers: getHeaders,
4318
+ fetch: options.fetch,
4319
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId2,
4320
+ supportedUrls: () => ({
4321
+ "image/*": [/^https?:\/\/.*$/]
4322
+ })
4323
+ });
4324
+ };
4325
+ const provider = function(modelId) {
4326
+ if (new.target) {
4327
+ throw new Error(
4328
+ "The Anthropic model function cannot be called with the new keyword."
4329
+ );
4330
+ }
4331
+ return createChatModel(modelId);
4332
+ };
4333
+ provider.specificationVersion = "v3";
4334
+ provider.languageModel = createChatModel;
4335
+ provider.chat = createChatModel;
4336
+ provider.messages = createChatModel;
4337
+ provider.embeddingModel = (modelId) => {
4338
+ throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
4339
+ };
4340
+ provider.textEmbeddingModel = provider.embeddingModel;
4341
+ provider.imageModel = (modelId) => {
4342
+ throw new NoSuchModelError({ modelId, modelType: "imageModel" });
4343
+ };
4344
+ provider.tools = anthropicTools;
4345
+ return provider;
4346
+ }
4347
+ var anthropic = createAnthropic();
4348
+
4349
+ // src/forward-anthropic-container-id-from-last-step.ts
4350
+ function forwardAnthropicContainerIdFromLastStep({
4351
+ steps
4352
+ }) {
4353
+ var _a, _b, _c;
4354
+ for (let i = steps.length - 1; i >= 0; i--) {
4355
+ const containerId = (_c = (_b = (_a = steps[i].providerMetadata) == null ? void 0 : _a.anthropic) == null ? void 0 : _b.container) == null ? void 0 : _c.id;
4356
+ if (containerId) {
4357
+ return {
4358
+ providerOptions: {
4359
+ anthropic: {
4360
+ container: { id: containerId }
4361
+ }
4362
+ }
4363
+ };
4364
+ }
4365
+ }
4366
+ return void 0;
4367
+ }
4368
+ export {
4369
+ VERSION,
4370
+ anthropic,
4371
+ createAnthropic,
4372
+ forwardAnthropicContainerIdFromLastStep
4373
+ };
4374
+ //# sourceMappingURL=index.mjs.map