pulls.review 0.2.0 → 0.2.1
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.
- package/dist/client/assets/ChatWidget-BsnoQ6oS.js +1 -0
- package/dist/client/assets/DisplayFileIcon-DzBo3Ez5.js +151 -0
- package/dist/client/assets/GithubAvatar-CSsUV5vf.js +1 -0
- package/dist/client/assets/LandingHero-BkTBSu71.js +1 -0
- package/dist/client/assets/_repo_-Dcgj3PGg.js +22 -0
- package/dist/client/assets/analyze-509KQQBC.js +1 -0
- package/dist/client/assets/andromeeda-vGVdxbeo.js +1 -0
- package/dist/client/assets/anthropic-messages-Cd2DkgOC.js +41 -0
- package/dist/client/assets/aurora-x-CDeNXAV0.js +1 -0
- package/dist/client/assets/ayu-dark-DluEY0Gj.js +1 -0
- package/dist/client/assets/ayu-light-C3h-C4tm.js +1 -0
- package/dist/client/assets/ayu-mirage-Bqwy1Gya.js +1 -0
- package/dist/client/assets/browser-agent-rpc-BXhoSh1z-DrxWeI3_.js +1 -0
- package/dist/client/assets/c-BNQJhXlP.js +1 -0
- package/dist/client/assets/catppuccin-frappe-C9Q5zVZY.js +1 -0
- package/dist/client/assets/catppuccin-latte-CtsyrtPq.js +1 -0
- package/dist/client/assets/catppuccin-macchiato-R8nAf1vR.js +1 -0
- package/dist/client/assets/catppuccin-mocha-DjuaAJKi.js +1 -0
- package/dist/client/assets/clojure-DqKBuwfJ.js +1 -0
- package/dist/client/assets/cpp-7GgD5o7L.js +1 -0
- package/dist/client/assets/csharp-oqKa8noW.js +1 -0
- package/dist/client/assets/css-DlBQoFxe.js +1 -0
- package/dist/client/assets/dark-plus-Cs2F2srj.js +1 -0
- package/dist/client/assets/de-Bq9RfdAn.js +1 -0
- package/dist/client/assets/diff-BKQFn0my.js +37 -0
- package/dist/client/assets/diff-Bx6SazPw.js +1 -0
- package/dist/client/assets/diff-woXpYk--.js +1 -0
- package/dist/client/assets/diffs-store-ncE62OUU.js +1510 -0
- package/dist/client/assets/dist-Dh0a8u-Y.js +1 -0
- package/dist/client/assets/docker-IyjqRm3v.js +1 -0
- package/dist/client/assets/dracula-BHWKrbxM.js +1 -0
- package/dist/client/assets/dracula-soft-5eyTD99u.js +1 -0
- package/dist/client/assets/elixir-D3n0XgqJ.js +1 -0
- package/dist/client/assets/en-8hQdak1X.js +1 -0
- package/dist/client/assets/error-CJ3RHG07.js +1 -0
- package/dist/client/assets/es-QcvEBShr.js +1 -0
- package/dist/client/assets/everforest-dark-sB-x3p7T.js +1 -0
- package/dist/client/assets/everforest-light-Df2xbC6M.js +1 -0
- package/dist/client/assets/fr-DAWKVvDP.js +1 -0
- package/dist/client/assets/github-dark-C-LZuMrd.js +1 -0
- package/dist/client/assets/github-dark-default-DXG-b-1a.js +1 -0
- package/dist/client/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/dist/client/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
- package/dist/client/assets/github-light-EUqPIrTm.js +1 -0
- package/dist/client/assets/github-light-default-BXViO-2h.js +1 -0
- package/dist/client/assets/github-light-high-contrast-B68TUdTA.js +1 -0
- package/dist/client/assets/go-rLFTqkRN.js +1 -0
- package/dist/client/assets/graphql-ki1Ij_uk.js +1 -0
- package/dist/client/assets/groovy-CacY0gHj.js +1 -0
- package/dist/client/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
- package/dist/client/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
- package/dist/client/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
- package/dist/client/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
- package/dist/client/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
- package/dist/client/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
- package/dist/client/assets/haskell-D8IpX4py.js +1 -0
- package/dist/client/assets/horizon-CE9ld1lL.js +1 -0
- package/dist/client/assets/horizon-bright-DSNQnXHK.js +1 -0
- package/dist/client/assets/houston-CsvMBhTu.js +1 -0
- package/dist/client/assets/html-BC8aFsRK.js +1 -0
- package/dist/client/assets/i18n-CGV_MDS8.js +2 -0
- package/dist/client/assets/id-NIGs9Xhn.js +1 -0
- package/dist/client/assets/index-BCCy9wJJ.js +2 -0
- package/dist/client/assets/index-BDPZiDIt.css +1 -0
- package/dist/client/assets/ini-B5eOa1yu.js +1 -0
- package/dist/client/assets/install-B-q5w2uE.js +4 -0
- package/dist/client/assets/it-DjRuurmk.js +1 -0
- package/dist/client/assets/ja-BAKkDsQ5.js +1 -0
- package/dist/client/assets/java-D7h0NA_A.js +1 -0
- package/dist/client/assets/javascript-DcMHgNcu.js +1 -0
- package/dist/client/assets/json-qhed-kSA.js +1 -0
- package/dist/client/assets/jsonc-CYpm1nAK.js +1 -0
- package/dist/client/assets/jsx-BUUYi3qs.js +1 -0
- package/dist/client/assets/kanagawa-dragon-Bozd7klA.js +1 -0
- package/dist/client/assets/kanagawa-lotus-BmuOG9ZW.js +1 -0
- package/dist/client/assets/kanagawa-wave-BML5mF2J.js +1 -0
- package/dist/client/assets/ko-DHculY2W.js +1 -0
- package/dist/client/assets/kotlin-DhhofPvG.js +1 -0
- package/dist/client/assets/laserwave-C_8bwKvT.js +1 -0
- package/dist/client/assets/less-DVTAwKKz.js +1 -0
- package/dist/client/assets/light-plus-DVQuIRkW.js +1 -0
- package/dist/client/assets/llm-DYDmh8Ki.js +2 -0
- package/dist/client/assets/llm-store-CVM33nlB.js +2 -0
- package/dist/client/assets/locales-SpkpwNqX.js +1 -0
- package/dist/client/assets/lua-DCW0Dwo5.js +1 -0
- package/dist/client/assets/make-Dixweg8N.js +1 -0
- package/dist/client/assets/markdown-BYOwaDjH.js +1 -0
- package/dist/client/assets/material-theme-Bm3Qr25_.js +1 -0
- package/dist/client/assets/material-theme-darker-2IIEA8gg.js +1 -0
- package/dist/client/assets/material-theme-lighter-uhdI0v04.js +1 -0
- package/dist/client/assets/material-theme-ocean-CHQ94UKr.js +1 -0
- package/dist/client/assets/material-theme-palenight-B5W6OYN7.js +1 -0
- package/dist/client/assets/mdx-DQZ5AkYe.js +1 -0
- package/dist/client/assets/min-dark-BSWPekZh.js +1 -0
- package/dist/client/assets/min-light-DDpmG2fV.js +1 -0
- package/dist/client/assets/monokai-B_bV9PQ9.js +1 -0
- package/dist/client/assets/nginx-C4fSytnP.js +1 -0
- package/dist/client/assets/night-owl-DhmEMT88.js +1 -0
- package/dist/client/assets/night-owl-light-eJ-hLW7d.js +1 -0
- package/dist/client/assets/node.browser-BX-QLlU2.js +1 -0
- package/dist/client/assets/node.browser-DFtqp6Hr.js +1 -0
- package/dist/client/assets/nord-Cb4Vim4T.js +1 -0
- package/dist/client/assets/objective-c-D1A_Heim.js +1 -0
- package/dist/client/assets/objective-cpp-BsSzOQcm.js +1 -0
- package/dist/client/assets/one-dark-pro-CLwyXe_n.js +1 -0
- package/dist/client/assets/one-light-D7Lr4KcI.js +1 -0
- package/dist/client/assets/openai-completions-CSvY9IVo.js +21 -0
- package/dist/client/assets/pages-B5mEqsbn.js +1 -0
- package/dist/client/assets/pages-local-x_ACBinc.js +1 -0
- package/dist/client/assets/pages-web-DitAPN6U.js +21 -0
- package/dist/client/assets/patch-parser-k3Vbbmi0.js +5 -0
- package/dist/client/assets/perl-C8GHouAq.js +1 -0
- package/dist/client/assets/php-BahmaYs0.js +1 -0
- package/dist/client/assets/pierre-dark-CpLgRqie.js +1 -0
- package/dist/client/assets/pierre-dark-protanopia-deuteranopia-B35FxJx-.js +1 -0
- package/dist/client/assets/pierre-dark-soft-kZQmAZld.js +1 -0
- package/dist/client/assets/pierre-dark-tritanopia-CpjhbsIL.js +1 -0
- package/dist/client/assets/pierre-dark-vibrant-CpQYzh95.js +1 -0
- package/dist/client/assets/pierre-light-CoaEpmwp.js +1 -0
- package/dist/client/assets/pierre-light-protanopia-deuteranopia-0fSaH845.js +1 -0
- package/dist/client/assets/pierre-light-soft-lWLdNTOI.js +1 -0
- package/dist/client/assets/pierre-light-tritanopia-CEbqgOJL.js +1 -0
- package/dist/client/assets/pierre-light-vibrant-D80Fkn33.js +1 -0
- package/dist/client/assets/plastic-DQwYfKfQ.js +1 -0
- package/dist/client/assets/poimandres-DRFjx7u4.js +1 -0
- package/dist/client/assets/portalTarget-C60SzJiK.js +1 -0
- package/dist/client/assets/preload-helper-BaNbYf_w.js +1 -0
- package/dist/client/assets/proto-DB4EqR-F.js +1 -0
- package/dist/client/assets/pt-BR-LLtJ99P6.js +1 -0
- package/dist/client/assets/python-gzcpVVnB.js +1 -0
- package/dist/client/assets/r-C5FwQflr.js +1 -0
- package/dist/client/assets/red-DX1BQOs8.js +1 -0
- package/dist/client/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
- package/dist/client/assets/rose-pine-aMsaMD1D.js +1 -0
- package/dist/client/assets/rose-pine-dawn-8PwUyIlP.js +1 -0
- package/dist/client/assets/rose-pine-moon-DO-qXg-I.js +1 -0
- package/dist/client/assets/ru-DvkrOLxc.js +1 -0
- package/dist/client/assets/ruby-CfFGiaYl.js +1 -0
- package/dist/client/assets/runtime-dom.esm-bundler-CqL7__VR.js +2 -0
- package/dist/client/assets/rust-Cfkwpbl8.js +1 -0
- package/dist/client/assets/scala-BiFt_7mu.js +1 -0
- package/dist/client/assets/scss-C-_0yqZd.js +1 -0
- package/dist/client/assets/shellscript-CLZ0U2zV.js +1 -0
- package/dist/client/assets/shiki-wasm-noop-Gxv9UHE7.js +1 -0
- package/dist/client/assets/slack-dark-DnToyrRv.js +1 -0
- package/dist/client/assets/slack-ochin-B2OO5cIa.js +1 -0
- package/dist/client/assets/snazzy-light-4G7pJPwS.js +1 -0
- package/dist/client/assets/solarized-dark-UdsmMDCL.js +1 -0
- package/dist/client/assets/solarized-light-C1IUL_tW.js +1 -0
- package/dist/client/assets/source-hSji-yvG.js +2 -0
- package/dist/client/assets/sql-BsFa4tDR.js +1 -0
- package/dist/client/assets/swift-CyEgAFGc.js +1 -0
- package/dist/client/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/dist/client/assets/terraform-DswuEJGm.js +1 -0
- package/dist/client/assets/time-ago-Bdao9Hh1.js +1 -0
- package/dist/client/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/dist/client/assets/toml-CcmNWLt0.js +1 -0
- package/dist/client/assets/transform-messages-C8U1xonk.js +3 -0
- package/dist/client/assets/tsx-DvWhG4dC.js +1 -0
- package/dist/client/assets/typescript-BTGs5etX.js +1 -0
- package/dist/client/assets/upload-GnI9kmJu.js +1 -0
- package/dist/client/assets/uploadSession-BUj4FNau.js +1 -0
- package/dist/client/assets/useDocumentTitle-nuqxXiNo.js +185 -0
- package/dist/client/assets/vesper-DdrHHSXu.js +1 -0
- package/dist/client/assets/vitesse-black-fwtXNY1n.js +1 -0
- package/dist/client/assets/vitesse-dark-BZCL-v6S.js +1 -0
- package/dist/client/assets/vitesse-light-VbXTXTou.js +1 -0
- package/dist/client/assets/vue-BbYmdtmv.js +1 -0
- package/dist/client/assets/vue-html-BXjKVtKk.js +1 -0
- package/dist/client/assets/vue-i18n-DVI_S4Q5.js +5 -0
- package/dist/client/assets/xml-BsprbK0m.js +1 -0
- package/dist/client/assets/yaml-rwi0_p6S.js +1 -0
- package/dist/client/assets/zh-CN-BIibd6kG.js +1 -0
- package/dist/client/assets/zh-TW-3FtUHjoZ.js +1 -0
- package/dist/client/favicon.svg +1 -0
- package/dist/client/index.html +44 -0
- package/dist/client/og-dark.png +0 -0
- package/dist/client/og.png +0 -0
- package/dist/client/robots.txt +2 -0
- package/dist/devframe-CX5butdC.mjs +493 -0
- package/dist/devframe.mjs +2 -0
- package/dist/index.mjs +90 -0
- package/package.json +2 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./node.browser-DFtqp6Hr.js","./error-CJ3RHG07.js","./node.browser-BX-QLlU2.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{$t as n,Gt as r,Jt as i,Kt as a,Qt as o,Ut as s,Yt as c,Zt as l,en as u,qt as d}from"./useDocumentTitle-nuqxXiNo.js";import{t as f}from"./preload-helper-BaNbYf_w.js";import{a as p,c as m,d as h,f as g,g as _,h as v,i as y,l as b,m as ee,n as te,o as ne,p as re,r as x,s as ie,t as ae,u as oe}from"./error-CJ3RHG07.js";import{_ as se,b as ce,c as le,f as ue,g as de,h as S,i as fe,m as pe,n as me,r as he,s as ge,t as _e,v as ve,x as ye,y as be}from"./transform-messages-C8U1xonk.js";var xe=15e3,Se=5e3;function Ce(e,t){if(!(e>=5e3))throw new p(`${t} must be at least ${Se}ms (got ${e}); to run without memory sync, pass \`memorySyncIntervalMs: null\` to the worker instead`)}function C(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function w(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var we=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return we=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(+e^n()&15>>e/4).toString(16))},Te=/^[a-z][a-z0-9+.-]*:/i,Ee=e=>Te.test(e),T=e=>(T=Array.isArray,T(e)),De=T;function Oe(e){return typeof e==`object`?e??{}:{}}function ke(e){if(!e)return!0;for(let t in e)return!1;return!0}function Ae(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function je(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Me=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new p(`${e} must be an integer`);if(t<0)throw new p(`${e} must be a positive integer`);return t},Ne=e=>{try{return JSON.parse(e)}catch{return}},Pe=(e,t)=>new Promise(n=>{if(t?.aborted)return n();let r=()=>{clearTimeout(i),n()},i=setTimeout(()=>{t?.removeEventListener(`abort`,r),n()},e);t?.addEventListener(`abort`,r,{once:!0})}),Fe=`0.124.0`,Ie=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`;function Le(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}var Re=()=>{let e=Le();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Fe,"X-Stainless-OS":Ve(Deno.build.os),"X-Stainless-Arch":Be(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Fe,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process?.version??`unknown`};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Fe,"X-Stainless-OS":Ve(globalThis.process.platform??`unknown`),"X-Stainless-Arch":Be(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=ze();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Fe,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Fe,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}};function ze(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var Be=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,Ve=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),He,Ue=()=>He??=Re(),We=new WeakMap,Ge=typeof globalThis.FinalizationRegistry==`function`?new globalThis.FinalizationRegistry(e=>Ye(e)):null;function Ke(e,t){return()=>e.removeEventListener(`abort`,t)}function qe(e,t,n){We.set(e,Ke(t,n))}function Je(e,t){We.has(t)&&Ge?.register(e,t,t)}function Ye(e){let t=We.get(e);t&&(We.delete(e),Ge?.unregister(e),t())}function Xe(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Ze(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function Qe(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Ze({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function $e(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function et(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var tt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)}),nt=`RFC3986`,rt=e=>String(e),it={RFC1738:e=>String(e).replace(/%20/g,`+`),RFC3986:rt},at=(e,t)=>(at=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),at(e,t)),E=(()=>{let e=[];for(let t=0;t<256;++t)e.push(`%`+((t<16?`0`:``)+t.toString(16)).toUpperCase());return e})(),ot=1024,st=(e,t,n,r,i)=>{if(e.length===0)return e;let a=e;if(typeof e==`symbol`?a=Symbol.prototype.toString.call(e):typeof e!=`string`&&(a=String(e)),n===`iso-8859-1`)return escape(a).replace(/%u[0-9a-f]{4}/gi,function(e){return`%26%23`+parseInt(e.slice(2),16)+`%3B`});let o=``;for(let e=0;e<a.length;e+=ot){let t=a.length>=ot?a.slice(e,e+ot):a,n=[];for(let e=0;e<t.length;++e){let r=t.charCodeAt(e);if(r===45||r===46||r===95||r===126||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||i===`RFC1738`&&(r===40||r===41)){n[n.length]=t.charAt(e);continue}if(r<128){n[n.length]=E[r];continue}if(r<2048){n[n.length]=E[192|r>>6]+E[128|r&63];continue}if(r<55296||r>=57344){n[n.length]=E[224|r>>12]+E[128|r>>6&63]+E[128|r&63];continue}e+=1,r=65536+((r&1023)<<10|t.charCodeAt(e)&1023),n[n.length]=E[240|r>>18]+E[128|r>>12&63]+E[128|r>>6&63]+E[128|r&63]}o+=n.join(``)}return o};function ct(e){return!e||typeof e!=`object`?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function lt(e,t){if(T(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}var ut={brackets(e){return String(e)+`[]`},comma:`comma`,indices(e,t){return String(e)+`[`+t+`]`},repeat(e){return String(e)}},dt=function(e,t){Array.prototype.push.apply(e,T(t)?t:[t])},ft,D={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:`indices`,charset:`utf-8`,charsetSentinel:!1,delimiter:`&`,encode:!0,encodeDotInKeys:!1,encoder:st,encodeValuesOnly:!1,format:nt,formatter:rt,indices:!1,serializeDate(e){return(ft??=Function.prototype.call.bind(Date.prototype.toISOString))(e)},skipNulls:!1,strictNullHandling:!1};function pt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`symbol`||typeof e==`bigint`}var mt={};function ht(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=e,y=_,b=0,ee=!1;for(;(y=y.get(mt))!==void 0&&!ee;){let t=y.get(e);if(b+=1,t!==void 0){if(t===b)throw RangeError(`Cyclic object value`);ee=!0}y.get(mt)===void 0&&(b=0)}if(typeof l==`function`?v=l(t,v):v instanceof Date?v=f?.(v):n===`comma`&&T(v)&&(v=lt(v,function(e){return e instanceof Date?f?.(e):e})),v===null){if(a)return c&&!h?c(t,D.encoder,g,`key`,p):t;v=``}if(pt(v)||ct(v)){if(c){let e=h?t:c(t,D.encoder,g,`key`,p);return[m?.(e)+`=`+m?.(c(v,D.encoder,g,`value`,p))]}return[m?.(t)+`=`+m?.(String(v))]}let te=[];if(v===void 0)return te;let ne;if(n===`comma`&&T(v))h&&c&&(v=lt(v,c)),ne=[{value:v.length>0?v.join(`,`)||null:void 0}];else if(T(l))ne=l;else{let e=Object.keys(v);ne=u?e.sort(u):e}let re=s?String(t).replace(/\./g,`%2E`):String(t),x=r&&T(v)&&v.length===1?re+`[]`:re;if(i&&T(v)&&v.length===0)return x+`[]`;for(let t=0;t<ne.length;++t){let y=ne[t],ee=typeof y==`object`&&y.value!==void 0?y.value:v[y];if(o&&ee===null)continue;let re=d&&s?y.replace(/\./g,`%2E`):y,ie=T(v)?typeof n==`function`?n(x,re):x:x+(d?`.`+re:`[`+re+`]`);_.set(e,b);let ae=new WeakMap;ae.set(mt,_),dt(te,ht(ee,ie,n,r,i,a,o,s,n===`comma`&&h&&T(v)?null:c,l,u,d,f,p,m,h,g,ae))}return te}function gt(e=D){if(e.allowEmptyArrays!==void 0&&typeof e.allowEmptyArrays!=`boolean`)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(e.encodeDotInKeys!==void 0&&typeof e.encodeDotInKeys!=`boolean`)throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!=`function`)throw TypeError(`Encoder has to be a function.`);let t=e.charset||D.charset;if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);let n=nt;if(e.format!==void 0){if(!at(it,e.format))throw TypeError(`Unknown format option provided.`);n=e.format}let r=it[n],i=D.filter;(typeof e.filter==`function`||T(e.filter))&&(i=e.filter);let a;if(a=e.arrayFormat&&e.arrayFormat in ut?e.arrayFormat:`indices`in e?e.indices?`indices`:`repeat`:D.arrayFormat,`commaRoundTrip`in e&&typeof e.commaRoundTrip!=`boolean`)throw TypeError("`commaRoundTrip` must be a boolean, or absent");let o=e.allowDots===void 0?e.encodeDotInKeys?!0:D.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==`boolean`?e.addQueryPrefix:D.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays==`boolean`?!!e.allowEmptyArrays:D.allowEmptyArrays,arrayFormat:a,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:D.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:e.delimiter===void 0?D.delimiter:e.delimiter,encode:typeof e.encode==`boolean`?e.encode:D.encode,encodeDotInKeys:typeof e.encodeDotInKeys==`boolean`?e.encodeDotInKeys:D.encodeDotInKeys,encoder:typeof e.encoder==`function`?e.encoder:D.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==`boolean`?e.encodeValuesOnly:D.encodeValuesOnly,filter:i,format:n,formatter:r,serializeDate:typeof e.serializeDate==`function`?e.serializeDate:D.serializeDate,skipNulls:typeof e.skipNulls==`boolean`?e.skipNulls:D.skipNulls,sort:typeof e.sort==`function`?e.sort:null,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:D.strictNullHandling}}function _t(e,t={}){let n=e,r=gt(t),i,a;typeof r.filter==`function`?(a=r.filter,n=a(``,n)):T(r.filter)&&(a=r.filter,i=a);let o=[];if(typeof n!=`object`||!n)return``;let s=ut[r.arrayFormat],c=s===`comma`&&r.commaRoundTrip;i||=Object.keys(n),r.sort&&i.sort(r.sort);let l=new WeakMap;for(let e=0;e<i.length;++e){let t=i[e];r.skipNulls&&n[t]===null||dt(o,ht(n[t],t,s,c,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}let u=o.join(r.delimiter),d=r.addQueryPrefix===!0?`?`:``;return r.charsetSentinel&&(r.charset===`iso-8859-1`?d+=`utf8=%26%2310003%3B&`:d+=`utf8=%E2%9C%93&`),u.length>0?d+u:``}function vt(e){return _t(e,{arrayFormat:`brackets`})}var yt=`urn:ietf:params:oauth:grant-type:jwt-bearer`,bt=`refresh_token`,xt=`/v1/oauth/token`,St=`oauth-2025-04-20`,Ct=`oidc-federation-2026-04-01`,wt=1<<20;function Tt(e){if(!e)return;let t;try{t=new URL(e)}catch(t){throw new k(`Invalid token endpoint base URL "${e}": ${t}`)}if(t.protocol===`https:`)return;let n=t.hostname.toLowerCase().replace(/^\[|\]$/g,``);if(t.protocol!==`http:`||n!==`localhost`&&n!==`127.0.0.1`&&n!==`::1`)throw new k(`Refusing to send credential over non-https token endpoint "${e}"`)}async function Et(e,t){let n=await jt(e),r;try{r=JSON.parse(n)}catch{throw new k(`Token endpoint returned non-JSON response (status ${e.status})`,e.status,O(n),t)}if(!r.access_token)throw new k(`Token endpoint response missing access_token: ${JSON.stringify(O(r))}`,e.status,O(r),t);if(r.token_type&&r.token_type.toLowerCase()!==`bearer`)throw new k(`Token endpoint response: unsupported token_type "${r.token_type}" (want Bearer)`,e.status,O(r),t);return r}var Dt=2e3,Ot=new Set([`error`,`error_description`,`error_uri`]);function O(e){if(e==null)return e;if(typeof e==`string`){let t;try{t=JSON.parse(e)}catch{return e.length<=Dt?e:e.slice(0,Dt)+`... <${e.length-Dt} more chars>`}return JSON.stringify(O(t))}if(typeof e==`object`&&!Array.isArray(e)){let t={};for(let[n,r]of Object.entries(e))Ot.has(n)&&(t[n]=r);return t}return null}async function kt(e,t=e=>console.warn(`anthropic-sdk: ${e}`)){if(typeof process>`u`||process.platform===`win32`)return;let{fs:n}=await f(async()=>{let{fs:e}=await import(`./node.browser-DFtqp6Hr.js`);return{fs:e}},__vite__mapDeps([0,1]),import.meta.url),r=e,i;try{r=await n.promises.realpath(e),i=await n.promises.stat(r)}catch{return}let a=i.mode&511;if(a&18)throw new k(`Credentials file at ${r} is group/world-writable (mode 0o${a.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${r}\`.`);if(a&36)throw new k(`Credentials file at ${r} is group/world-readable (mode 0o${a.toString(8)}); run \`chmod 600 ${r}\` before retrying.`);typeof process.getuid==`function`&&i.uid!==process.getuid()&&t(`credentials file at ${r} is owned by uid ${i.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function At(e,t){let{fs:n,path:r}=await f(async()=>{let{fs:e,path:t}=await import(`./node.browser-DFtqp6Hr.js`);return{fs:e,path:t}},__vite__mapDeps([0,1]),import.meta.url),i=r.dirname(e);await n.promises.mkdir(i,{recursive:!0,mode:448});let a=`${e}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let r=await n.promises.open(a,`w`,384);try{await r.writeFile(JSON.stringify(t,null,2)),await r.sync()}finally{await r.close()}await n.promises.rename(a,e)}catch(e){throw await n.promises.unlink(a).catch(()=>{}),e}try{let e=await n.promises.open(i,`r`);try{await e.sync()}finally{await e.close()}}catch{}}async function jt(e){if(!e.body)return``;let t=e.body.getReader(),n=[],r=0;for(;;){let{done:e,value:i}=await t.read();if(e)break;if(r+i.length>wt){let e=wt-r;e>0&&n.push(i.subarray(0,e)),await t.cancel();break}n.push(i),r+=i.length}let i;if(n.length===1)i=n[0];else{i=new Uint8Array(n.reduce((e,t)=>e+t.length,0));let e=0;for(let t of n)i.set(t,e),e+=t.length}return new TextDecoder(`utf-8`).decode(i)}var k=class extends p{constructor(e,t=null,n=null,r=null){super(e),this.statusCode=t,this.body=n,this.requestId=r}};function Mt(){return Math.floor(Date.now()/1e3)}var Nt=class{constructor(e,t){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=e,this.onAdvisoryRefreshError=t}async getToken(){let e=this.nextForce;this.nextForce=!1;let t=this.cached;if(e||t==null)return(await this.refresh(e)).token;if(t.expiresAt==null)return t.token;let n=t.expiresAt-Mt();return n>120?t.token:n>30?(this.backgroundRefresh(),t.token):(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(e=!1){return this.pendingRefresh&&!e?this.pendingRefresh:this.doRefresh(e)}backgroundRefresh(){this.pendingRefresh||Mt()-this.lastAdvisoryError<5||this.doRefresh().catch(e=>{this.lastAdvisoryError=Mt(),this.onAdvisoryRefreshError?.(e)})}doRefresh(e=!1){return this.pendingRefresh=this.provider(e?{forceRefresh:!0}:void 0).then(e=>(this.cached=e,this.pendingRefresh=null,e),e=>{throw this.pendingRefresh=null,e}),this.pendingRefresh}},A=e=>{if(globalThis.process!==void 0)return{}[e]?.trim()||void 0;if(globalThis.Deno!==void 0)return globalThis.Deno.env?.get?.(e)?.trim()||void 0};function Pt(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}var Ft;function It(e){let t;return(Ft??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}var Lt;function Rt(e){let t;return(Lt??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var zt=e=>{if(globalThis.Buffer!==void 0){let t=globalThis.Buffer.from(e,`base64`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}if(typeof atob<`u`){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}throw new p("Cannot decode base64 string; Expected `Buffer` or `atob` to be defined")},Bt=`warn`,Vt={off:0,error:200,warn:300,info:400,debug:500},Ht=(e,t,n)=>{if(e){if(Ae(Vt,e))return e;n.warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Vt))}`)}};function Ut(){}function Wt(e,t,n){return!t||Vt[e]>Vt[n]?Ut:t[e].bind(t)}var Gt={error:Ut,warn:Ut,info:Ut,debug:Ut},Kt=new WeakMap;function qt(e,t){let n=Kt.get(e);if(n&&n[0]===t)return n[1];let r={error:Wt(`error`,e,t),warn:Wt(`warn`,e,t),info:Wt(`info`,e,t),debug:Wt(`debug`,e,t)};return Kt.set(e,[t,r]),r}function j(e){let t=e.logger,n=e.logLevel??`off`;return t?qt(t,n):Gt}var Jt,Yt;function Xt(){let e=A(`ANTHROPIC_LOG`);return(!Yt||e!==Jt)&&(Jt=e,Yt=qt(console,Ht(e,`process.env['ANTHROPIC_LOG']`,qt(console,`warn`))??`warn`)),Yt}var Zt=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`api-key`||e.toLowerCase()===`x-api-key`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e),Qt=/^[A-Za-z0-9_.-]+$/;function $t(e){if(!e)throw Error(`profile name is empty`);if(e===`.`||e===`..`)throw Error(`profile name "${e}" is not allowed`);if(e.includes(`/`)||e.includes(`\\`))throw Error(`profile name "${e}" must not contain path separators`);if(!Qt.test(e))throw Error(`profile name "${e}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var en=async e=>{var t,n;let r=await nn();if(r===null)return null;let i=e??await an();if(i===null)return null;$t(i);let{fs:a,path:o}=await f(async()=>{let{fs:e,path:t}=await import(`./node.browser-DFtqp6Hr.js`);return{fs:e,path:t}},__vite__mapDeps([0,1]),import.meta.url),s=o.join(r,`configs`,`${i}.json`),c;try{c=await a.promises.readFile(s,`utf-8`)}catch(e){if(e?.code!==`ENOENT`)throw Error(`failed to read config file ${s}: ${e}`);c=null}if(c===null){let e=A(`ANTHROPIC_ORGANIZATION_ID`),t=A(`ANTHROPIC_IDENTITY_TOKEN_FILE`),n=A(`ANTHROPIC_FEDERATION_RULE_ID`);return n&&e?{fromFile:!1,config:{organization_id:e,workspace_id:A(`ANTHROPIC_WORKSPACE_ID`),base_url:A(`ANTHROPIC_BASE_URL`),authentication:{type:`oidc_federation`,federation_rule_id:n,service_account_id:A(`ANTHROPIC_SERVICE_ACCOUNT_ID`),identity_token:t?{source:`file`,path:t}:void 0,scope:A(`ANTHROPIC_SCOPE`)}}}:null}let l;try{l=JSON.parse(c)}catch(e){throw Error(`failed to parse config file ${s}: ${e}`)}if(!l.authentication)throw Error(`config file ${s} is missing "authentication"`);let u=l.authentication.type;if(u!==`oidc_federation`&&u!==`user_oauth`)throw Error(`authentication.type "${u}" is not a known authentication type`);if(l.organization_id??(l.organization_id=A(`ANTHROPIC_ORGANIZATION_ID`)),l.workspace_id??(l.workspace_id=A(`ANTHROPIC_WORKSPACE_ID`)),l.base_url??(l.base_url=A(`ANTHROPIC_BASE_URL`)),(t=l.authentication).scope??(t.scope=A(`ANTHROPIC_SCOPE`)),l.authentication.type===`oidc_federation`){if(!l.authentication.identity_token){let e=A(`ANTHROPIC_IDENTITY_TOKEN_FILE`);e&&(l.authentication.identity_token={source:`file`,path:e})}l.authentication.federation_rule_id||(l.authentication.federation_rule_id=A(`ANTHROPIC_FEDERATION_RULE_ID`)??``),(n=l.authentication).service_account_id??(n.service_account_id=A(`ANTHROPIC_SERVICE_ACCOUNT_ID`))}return{config:l,fromFile:!0}},tn=async(e,t)=>{if(e?.authentication.credentials_path)return e.authentication.credentials_path;let n=await nn();if(!n)return null;let r=t??await an();if(!r)return null;$t(r);let{path:i}=await f(async()=>{let{path:e}=await import(`./node.browser-DFtqp6Hr.js`);return{path:e}},__vite__mapDeps([0,1]),import.meta.url);return i.join(n,`credentials`,`${r}.json`)},nn=async()=>{if(!rn())return null;let{path:e}=await f(async()=>{let{path:e}=await import(`./node.browser-DFtqp6Hr.js`);return{path:e}},__vite__mapDeps([0,1]),import.meta.url),t=A(`ANTHROPIC_CONFIG_DIR`);if(t)return t;if(Ue()[`X-Stainless-OS`]===`Windows`){let t=A(`APPDATA`);if(t)return e.join(t,`Anthropic`);let n=A(`USERPROFILE`);return n?e.join(n,`AppData`,`Roaming`,`Anthropic`):null}let n=A(`XDG_CONFIG_HOME`);if(n)return e.join(n,`anthropic`);let r=A(`HOME`);return r?e.join(r,`.config`,`anthropic`):null},rn=()=>{let e=Ue()[`X-Stainless-Runtime`];return e===`node`||e===`deno`},an=async()=>{let e=await nn();if(!e)return null;let t=A(`ANTHROPIC_PROFILE`);if(t)return t;let{fs:n,path:r}=await f(async()=>{let{fs:e,path:t}=await import(`./node.browser-DFtqp6Hr.js`);return{fs:e,path:t}},__vite__mapDeps([0,1]),import.meta.url),i=r.join(e,`active_config`);try{return(await n.promises.readFile(i,`utf-8`)).trim()||`default`}catch(e){if(e?.code!==`ENOENT`)throw Error(`failed to read ${i}: ${e}`);return`default`}};function on(e){if(!e)throw new p(`Identity token file path is empty`);return async()=>{let{fs:t}=await f(async()=>{let{fs:e}=await import(`./node.browser-DFtqp6Hr.js`);return{fs:e}},__vite__mapDeps([0,1]),import.meta.url),n;try{n=await t.promises.readFile(e,`utf-8`)}catch(t){throw new p(`Failed to read identity token file at ${e}: ${t}`)}let r=n.trim();if(!r)throw new p(`Identity token file at ${e} is empty`);return r}}function sn(e){if(!e)throw new p(`Identity token value is empty`);return()=>e}function cn(e){return async()=>{Tt(e.baseURL);let t=await e.identityTokenProvider();if(t.length>16384)throw new k(`Identity token is ${Math.ceil(t.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let n={grant_type:yt,assertion:t,federation_rule_id:e.federationRuleId,organization_id:e.organizationId};e.serviceAccountId&&(n.service_account_id=e.serviceAccountId),e.workspaceId&&(n.workspace_id=e.workspaceId);let r=`${e.baseURL}${xt}`,i;try{i=await e.fetch(r,{method:`POST`,headers:{"Content-Type":`application/json`,"anthropic-beta":`${St},${Ct}`,"User-Agent":e.userAgent||`anthropic-sdk-typescript/0.124.0 oidcFederationProvider`},body:JSON.stringify(n)})}catch(e){throw new k(`Failed to reach token endpoint ${r}: ${e}`)}let a=i.headers.get(`Request-Id`);if(!i.ok){let t=O(await i.text().catch(()=>``)),n=``;throw i.status===401&&(n=` Ensure your federation rule matches your identity token. ${e.workspaceId?``:"If your federation rule is scoped to multiple workspaces, set the ANTHROPIC_WORKSPACE_ID environment variable, the 'workspace_id' config key, or the `workspaceId` option. "}View your authentication events in the Workload identity page of Claude Console for more details.`),new k(`Token exchange failed with status ${i.status}${a?` (request-id ${a})`:``}: ${t}${n}`,i.status,t,a)}let o=await Et(i,a),s=Number(o.expires_in);if(!Number.isFinite(s))throw new k(`Token endpoint response missing required fields: ${JSON.stringify(O(o))}`,i.status,O(o),a);return{token:o.access_token,expiresAt:Mt()+s}}}function ln(e){return async t=>{let{fs:n}=await f(async()=>{let{fs:e}=await import(`./node.browser-DFtqp6Hr.js`);return{fs:e}},__vite__mapDeps([0,1]),import.meta.url);await kt(e.credentialsPath,e.onSafetyWarning);let r;try{r=await n.promises.readFile(e.credentialsPath,`utf-8`)}catch(t){throw new k(`Credentials file not found at ${e.credentialsPath}: ${t}`)}let i;try{i=JSON.parse(r)}catch(t){throw new k(`Credentials file at ${e.credentialsPath} is not valid JSON: ${t}`)}let a=i.access_token;if(!a)throw new k(`Credentials file at ${e.credentialsPath} must include 'access_token'`);let o=i.expires_at;if(!t?.forceRefresh&&(o==null||Mt()<o-30))return{token:a,expiresAt:o??null};let s=i.refresh_token;if(!e.clientId||!s)throw new k(`Access token at ${e.credentialsPath} has expired and no refresh is available (client_id ${e.clientId?`set`:`empty`}, refresh_token ${s?`set`:`empty`})`);Tt(e.baseURL);let c={grant_type:bt,refresh_token:s,client_id:e.clientId},l=`${e.baseURL}${xt}`,u;try{u=await e.fetch(l,{method:`POST`,headers:{"Content-Type":`application/json`,"anthropic-beta":St,"User-Agent":e.userAgent||`anthropic-sdk-typescript/0.124.0 userOAuthProvider`},body:JSON.stringify(c)})}catch(e){throw new k(`User OAuth refresh failed to reach token endpoint: ${e}`)}let d=u.headers.get(`Request-Id`);if(!u.ok){let e=await u.text().catch(()=>``);throw new k(`User OAuth refresh failed (HTTP ${u.status}): ${O(e)}`,u.status,O(e),d)}let p=await Et(u,d),m=Number(p.expires_in);if(!Number.isFinite(m))throw new k(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(O(p))}`,u.status,O(p),d);let h=Mt()+m,g=p.refresh_token||s;return await At(e.credentialsPath,{...i,version:`1.0`,type:`oauth_token`,access_token:p.access_token,expires_at:h,refresh_token:g}),{token:p.access_token,expiresAt:h}}}function un(e,t){let n=fn(e,e.authentication.credentials_path??null,(e.base_url||t.baseURL).replace(/\/+$/,``),t),r={};return e.workspace_id&&e.authentication.type===`user_oauth`&&(r[`anthropic-workspace-id`]=e.workspace_id),{provider:n,extraHeaders:r,baseURL:e.base_url||void 0}}async function dn(e,t){let n=await en(t);if(!n)return null;let{config:r,fromFile:i}=n;return un(r.authentication.credentials_path||!i?r:{...r,authentication:{...r.authentication,credentials_path:await tn(r,t)??void 0}},e)}function fn(e,t,n,r){switch(e.authentication.type){case`oidc_federation`:{let i=e.authentication,a=pn(i);if(!a)throw new k(`oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)`);if(!i.federation_rule_id)throw new k(`oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via ANTHROPIC_FEDERATION_RULE_ID (profile takes precedence).`);if(!e.organization_id)throw new k(`oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)`);let o=cn({identityTokenProvider:a,federationRuleId:i.federation_rule_id,organizationId:e.organization_id,serviceAccountId:i.service_account_id,workspaceId:e.workspace_id,baseURL:n,fetch:r.fetch,userAgent:r.userAgent});return t?mn(o,t,r.onCacheWriteError,r.onSafetyWarning):o}case`user_oauth`:if(!t)throw new k(`user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)`);return ln({credentialsPath:t,clientId:e.authentication.client_id,baseURL:n,fetch:r.fetch,userAgent:r.userAgent,onSafetyWarning:r.onSafetyWarning});default:{let t=e.authentication.type;throw new k(`authentication.type "${t}" is not a known authentication type`)}}}function pn(e){if(e.identity_token){let t=e.identity_token.source;if(t!==`file`)throw new k(`identity_token.source "${t}" is not supported by this SDK version (only "file")`);if(!e.identity_token.path)throw new k(`identity_token.source "file" requires a non-empty path`);return on(e.identity_token.path)}let t=A(`ANTHROPIC_IDENTITY_TOKEN_FILE`);if(t)return on(t);let n=A(`ANTHROPIC_IDENTITY_TOKEN`);return n?sn(n):null}function mn(e,t,n,r){return async i=>{let{fs:a}=await f(async()=>{let{fs:e}=await import(`./node.browser-DFtqp6Hr.js`);return{fs:e}},__vite__mapDeps([0,1]),import.meta.url);await kt(t,r);let o;try{let e=await a.promises.readFile(t,`utf-8`);o=JSON.parse(e);let n=o?.access_token;if(n&&!i?.forceRefresh){let e=o?.expires_at;if(e==null||Mt()<e-30)return{token:n,expiresAt:e??null}}}catch(e){e?.code!==`ENOENT`&&!(e instanceof SyntaxError)&&n?.(e)}let s=await e(i);try{await At(t,{...o??{},version:`1.0`,type:`oauth_token`,access_token:s.token,expires_at:s.expiresAt})}catch(e){n?.(e)}return s}}var M,N,hn=class{constructor(){M.set(this,void 0),N.set(this,void 0),C(this,M,new Uint8Array,`f`),C(this,N,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?It(e):e;C(this,M,Pt([w(this,M,`f`),t]),`f`);let n=[],r;for(;(r=gn(w(this,M,`f`),w(this,N,`f`)))!=null;){if(r.carriage&&w(this,N,`f`)==null){C(this,N,r.index,`f`);continue}if(w(this,N,`f`)!=null&&(r.index!==w(this,N,`f`)+1||r.carriage)){n.push(Rt(w(this,M,`f`).subarray(0,w(this,N,`f`)-1))),C(this,M,w(this,M,`f`).subarray(w(this,N,`f`)),`f`),C(this,N,null,`f`);continue}let e=w(this,N,`f`)===null?r.preceding:r.preceding-1,t=Rt(w(this,M,`f`).subarray(0,e));n.push(t),C(this,M,w(this,M,`f`).subarray(r.index),`f`),C(this,N,null,`f`)}return n}flush(){return w(this,M,`f`).length?this.decode(`
|
|
3
|
+
`):[]}};M=new WeakMap,N=new WeakMap,hn.NEWLINE_CHARS=new Set([`
|
|
4
|
+
`,`\r`]),hn.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function gn(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function _n(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}var vn,yn=class e{constructor(e,t,n){this.iterator=e,vn.set(this,void 0),this.controller=t,C(this,vn,n,`f`)}static rawEvents(e,t=new AbortController){return bn(e,t)}static fromSSEResponse(t,n,r){let i=!1,a=r?j(r):console;async function*o(){if(i)throw new p("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let e of bn(t,n)){if(e.event===`completion`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event===`message_start`||e.event===`message_delta`||e.event===`message_stop`||e.event===`content_block_start`||e.event===`content_block_delta`||e.event===`content_block_stop`||e.event===`message`||e.event===`user.message`||e.event===`user.interrupt`||e.event===`user.tool_confirmation`||e.event===`user.custom_tool_result`||e.event===`user.tool_result`||e.event===`agent.message`||e.event===`agent.thinking`||e.event===`agent.tool_use`||e.event===`agent.tool_result`||e.event===`agent.mcp_tool_use`||e.event===`agent.mcp_tool_result`||e.event===`agent.custom_tool_use`||e.event===`agent.thread_context_compacted`||e.event===`session.status_running`||e.event===`session.status_idle`||e.event===`session.status_rescheduled`||e.event===`session.status_terminated`||e.event===`session.error`||e.event===`session.deleted`||e.event===`session.updated`||e.event===`span.model_request_start`||e.event===`span.model_request_end`||e.event===`span.outcome_evaluation_start`||e.event===`span.outcome_evaluation_ongoing`||e.event===`span.outcome_evaluation_end`||e.event===`user.define_outcome`||e.event===`agent.thread_message_received`||e.event===`agent.thread_message_sent`||e.event===`agent.session_thread_message_received`||e.event===`agent.session_thread_message_sent`||e.event===`session.thread_created`||e.event===`session.thread_status_created`||e.event===`session.thread_status_running`||e.event===`session.thread_status_idle`||e.event===`session.thread_status_rescheduled`||e.event===`session.thread_status_terminated`||e.event===`event_start`||e.event===`event_delta`||e.event===`system.message`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event!==`ping`&&e.event===`error`){let n=Ne(e.data)??e.data,r=n?.error?.type;throw new x(void 0,n,void 0,t.headers,r)}}e=!0}catch(e){if(_(e))return;throw e}finally{e||n.abort(),Ye(n)}}return new e(o,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new hn,n=$e(t);for await(let t of n)for(let n of e.decode(t))yield n;for(let t of e.flush())yield t}async function*o(){if(i)throw new p("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(_(e))return;throw e}finally{e||n.abort(),Ye(n)}}return new e(o,n,r)}[(vn=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,w(this,vn,`f`)),new e(()=>i(n),this.controller,w(this,vn,`f`))]}toReadableStream(){let e=this,t;return Ze({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{let{value:n,done:r}=await t.next();if(r)return e.close();let i=It(JSON.stringify(n)+`
|
|
5
|
+
`);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}};async function*bn(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new p(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new p(`Attempted to iterate over a response with no body`);let n=new Sn,r=new hn,i=$e(e.body);for await(let e of xn(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*xn(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let e=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==`string`?It(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=_n(t))!==-1;)yield t.subarray(0,i),t=t.subarray(i)}t.length>0&&(yield t)}var Sn=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|
|
6
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],e}if(this.chunks.push(e),e.startsWith(`:`))return null;let[t,n,r]=Cn(e,`:`);return r.startsWith(` `)&&(r=r.substring(1)),t===`event`?this.event=r:t===`data`&&this.data.push(r),null}};function Cn(e,t){let n=e.indexOf(t);return n===-1?[e,``,``]:[e.substring(0,n),t,e.substring(n+t.length)]}async function wn(e,t){let{response:n,requestLogID:r,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{if(t.options.stream)return j(e).debug(`response`,n.status,n.url,n.headers,n.body),yn.fromSSEResponse(n,t.controller,e);if(n.status===204)return null;if(t.options.__binaryResponse)return n;let r=n.headers.get(`content-type`)?.split(`;`)[0]?.trim();return r?.includes(`application/json`)||r?.endsWith(`+json`)?n.headers.get(`content-length`)===`0`?void 0:Tn(await n.json(),n):await n.text()})().finally(()=>{!t.options.stream&&!t.options.__binaryResponse&&Ye(t.controller)});return j(e).debug(`[${r}] response parsed`,Zt({retryOfRequestLogID:i,url:n.url,status:n.status,body:o,durationMs:Date.now()-a})),o}function Tn(e,t){return!e||typeof e!=`object`||Array.isArray(e)?e:Object.defineProperties(e,{_request_id:{value:t.headers.get(`request-id`),enumerable:!1},_workspace_id:{value:t.headers.get(`anthropic-workspace-id`),enumerable:!1}})}var En=new WeakSet;function Dn(e){return typeof e==`object`&&!!e&&En.has(e)}function On(e){let t=new Set;for(;typeof e==`object`&&e&&!t.has(e);){if(t.add(e),Dn(e)||_(e)||e instanceof ae||e instanceof re)return!0;e=e.cause}return!1}function kn(e,t,n,r){return async(i,a={})=>{if(t.length===0)return e.call(void 0,i,a);let o=a.headers instanceof Headers?a.headers:new Headers(a.headers),s=await Mn(e,t,n,r)({...a,headers:o,url:typeof i==`string`?i:i instanceof URL?i.href:i.url});if(s.bodyUsed||s.body?.locked)throw new p(`middleware consumed the response body; use response.clone() to inspect it, or return new Response(body, response) to consume and replace it`);return s}}function An(e,t){let n=new WeakMap;return{options:e,logger:t?j(t):Xt(),parse(r){if(e?.stream&&r.ok)return jn(r,e,t);let i=n.get(r);return i||(i=jn(r,e,t),n.set(r,i)),i}}}async function jn(e,t,n){if(e.bodyUsed||e.body?.locked)throw new p(`cannot ctx.parse() a response whose body was already consumed; call ctx.parse() instead of reading the body, or read via response.clone()`);if(t?.stream&&e.ok)return yn.fromSSEResponse(e.clone(),new AbortController,n);if(e.status===204)return null;if(t?.__binaryResponse)return e;let r=e.headers.get(`content-type`)?.split(`;`)[0]?.trim();return r?.includes(`application/json`)||r?.endsWith(`+json`)?e.headers.get(`content-length`)===`0`?void 0:Tn(await e.clone().json(),e):await e.clone().text()}function Mn(e,t,n,r){let i=async({url:t,...n})=>{try{return await e.call(void 0,t,n)}catch(e){let t=v(e);throw En.add(t),t}},a=An(n,r);for(let e=t.length-1;e>=0;e--){let n=t[e],r=i;i=async e=>n(e,r,a)}return i}var Nn,Pn=class e extends Promise{constructor(e,t,n=wn){super(e=>{e(null)}),this.responsePromise=t,this.parseResponse=n,Nn.set(this,void 0),C(this,Nn,e,`f`)}_thenUnwrap(t){return new e(w(this,Nn,`f`),this.responsePromise,async(e,n)=>Tn(t(await this.parseResponse(e,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get(`request-id`),workspace_id:t.headers.get(`anthropic-workspace-id`)}}parse(){return this.parsedPromise||=this.responsePromise.then(e=>this.parseResponse(w(this,Nn,`f`),e)),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Nn=new WeakMap;var Fn,In=class{constructor(e,t,n,r){Fn.set(this,void 0),C(this,Fn,e,`f`),this.options=r,this.response=t,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new p("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await w(this,Fn,`f`).requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Fn=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}},Ln=class extends Pn{constructor(e,t,n){super(e,t,async(e,t)=>new n(e,t.response,await wn(e,t),t.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}},Rn=class extends In{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.has_more=n.has_more||!1,this.first_id=n.first_id||null,this.last_id=n.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more!==!1&&super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let e=this.first_id;return e?{...this.options,query:{...Oe(this.options.query),before_id:e}}:null}let e=this.last_id;return e?{...this.options,query:{...Oe(this.options.query),after_id:e}}:null}},P=class extends In{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.next_page=n.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let e=this.next_page;return e?{...this.options,query:{...Oe(this.options.query),page:e}}:null}},zn=class extends In{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.next_page=n.next_page||null,this.prev_page=n.prev_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let e=this.next_page;return e?{...this.options,query:{...Oe(this.options.query),page:e}}:null}},Bn=()=>{if(typeof File>`u`){let{process:e}=globalThis,t=typeof e?.versions?.node==`string`&&parseInt(e.versions.node.split(`.`))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":``))}};function Vn(e,t,n){return Bn(),new File(e,t??`unknown_file`,n)}function Hn(e,t){let n=typeof e==`object`&&!!e&&(`name`in e&&e.name&&String(e.name)||`url`in e&&e.url&&String(e.url)||`filename`in e&&e.filename&&String(e.filename)||`path`in e&&e.path&&String(e.path))||``;return t?n.split(/[\\/]/).pop()||void 0:n}var Un=e=>typeof e==`object`&&!!e&&typeof e[Symbol.asyncIterator]==`function`,Wn=async(e,t,n=!0)=>({...e,body:await qn(e.body,t,n)}),Gn=new WeakMap;function Kn(e){let t=typeof e==`function`?e:e.fetch,n=Gn.get(t);if(n)return n;let r=(async()=>{try{let e=`Response`in t?t.Response:(await t(`data:,`)).constructor,n=new FormData;return n.toString()!==await new e(n).text()}catch{return!0}})();return Gn.set(t,r),r}var qn=async(e,t,n=!0)=>{if(!await Kn(t))throw TypeError(`The provided fetch function does not support file uploads with the current global FormData class.`);let r=new FormData;return await Promise.all(Object.entries(e||{}).map(([e,t])=>Jn(r,e,t,n))),r},Jn=async(e,t,n,r)=>{if(n!==void 0){if(n==null)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof n==`string`||typeof n==`number`||typeof n==`boolean`)e.append(t,String(n));else if(n instanceof Response){let i={},a=n.headers.get(`Content-Type`);a&&(i={type:a}),e.append(t,Vn([await n.blob()],Hn(n,r),i))}else if(Un(n))e.append(t,Vn([await new Response(Qe(n)).blob()],Hn(n,r)));else if(n instanceof Blob)e.append(t,Vn([n],Hn(n,r)||void 0,{type:n.type}));else if(Array.isArray(n))await Promise.all(n.map(n=>Jn(e,t+`[]`,n,r)));else if(typeof n.then==`function`)throw TypeError(`Received a Promise for "${t}"; await it first, e.g. \`await toFile(...)\``);else if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))throw TypeError(`Received ${n.constructor.name} for "${t}"; to upload raw bytes, wrap them with \`await toFile(bytes, 'filename')\``);else if(typeof n==`object`)await Promise.all(Object.entries(n).map(([n,i])=>Jn(e,`${t}[${n}]`,i,r)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${n} instead`)}},Yn=e=>typeof e==`object`&&!!e&&typeof e.size==`number`&&typeof e.type==`string`&&typeof e.text==`function`&&typeof e.slice==`function`&&typeof e.arrayBuffer==`function`,Xn=e=>typeof e==`object`&&!!e&&typeof e.name==`string`&&typeof e.lastModified==`number`&&Yn(e),Zn=e=>typeof e==`object`&&!!e&&typeof e.url==`string`&&typeof e.blob==`function`;async function Qn(e,t,n){if(Bn(),e=await e,t||=Hn(e,!0),Xn(e))return e instanceof File&&t==null&&n==null?e:Vn([await e.arrayBuffer()],t??e.name,{type:e.type,lastModified:e.lastModified,...n});if(Zn(e)){let r=await e.blob();return t||=new URL(e.url).pathname.split(/[\\/]/).pop(),Vn(await $n(r),t,n)}let r=await $n(e);if(!n?.type){let e=r.find(e=>typeof e==`object`&&`type`in e&&e.type);typeof e==`string`&&(n={...n,type:e})}return Vn(r,t,n)}async function $n(e){let t=[];if(typeof e==`string`||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(Yn(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(Un(e))for await(let n of e)t.push(...await $n(n));else{let t=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${t?`; constructor: ${t}`:``}${er(e)}`)}return t}function er(e){return typeof e!=`object`||!e?``:`; props: [${Object.getOwnPropertyNames(e).map(e=>`"${e}"`).join(`, `)}]`}var F=class{constructor(e){this._client=e}},tr=Symbol.for(`brand.privateNullableHeaders`);function*nr(e){if(!e)return;if(tr in e){let{values:t,nulls:n}=e;yield*t.entries();for(let e of n)yield[e,null];return}let t=!1,n;e instanceof Headers?n=e.entries():De(e)?n=e:(t=!0,n=Object.entries(e??{}));for(let e of n){let n=e[0];if(typeof n!=`string`)throw TypeError(`expected header name to be a string`);let r=De(e[1])?e[1]:[e[1]],i=!1;for(let e of r)e!==void 0&&(t&&!i&&(i=!0,yield[n,rr]),yield[n,e])}}var rr=Symbol(`clear`),ir=new Set([`x-stainless-helper`]),ar=(e,t)=>{let n=e?e.split(`,`).map(e=>e.trim()).filter(Boolean):[];for(let e of t.split(`,`).map(e=>e.trim()))e&&!n.includes(e)&&n.push(e);return n.join(`, `)},I=e=>{let t=new Headers,n=new Set;for(let r of e){let e=new Set;for(let[i,a]of nr(r)){let r=i.toLowerCase();if(ir.has(r)){if(a===rr)continue;a===null?(t.delete(i),n.add(r)):(t.set(i,ar(t.get(i),a)),n.delete(r));continue}(a===rr||!e.has(r))&&(t.delete(i),e.add(r),a===rr)||(a===null?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r)))}}return{[tr]:!0,values:t,nulls:n}};function or(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var sr=Object.freeze(Object.create(null)),L=((e=or)=>function(t,...n){if(t.length===1)return t[0];let r=!1,i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);let s=n[o],c=(r?encodeURIComponent:e)(``+s);return o!==n.length&&(s==null||typeof s==`object`&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??sr)??sr)?.toString)&&(c=s+``,i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?``:c)},``),o=a.split(/[?#]/,1)[0],s=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=s.exec(o))!==null;)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can\'t be safely passed as a path parameter`});if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0,t=i.reduce((t,n)=>{let r=` `.repeat(n.start-e),i=`^`.repeat(n.length);return e=n.start+n.length,t+r+i},``);throw new p(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join(`
|
|
7
|
+
`)}\n${a}\n${t}`)}return a})(or),cr=class extends F{retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/deployment_runs/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/deployment_runs?beta=true`,P,{query:i,...t,headers:I([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}},lr=class extends F{create(e,t){let{betas:n,workspace_id:r,...i}=e;return this._client.post(`/v1/deployments?beta=true`,{body:i,...t,headers:I([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/deployments/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}update(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/deployments/${e}?beta=true`,{body:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/deployments?beta=true`,P,{query:i,...t,headers:I([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}archive(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/deployments/${e}/archive?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}pause(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/deployments/${e}/pause?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}run(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/deployments/${e}/run?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}unpause(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/deployments/${e}/unpause?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}},ur=class extends F{create(e,t){let{betas:n,workspace_id:r,...i}=e;return this._client.post(`/v1/dreams?beta=true`,{body:i,...t,headers:I([{"anthropic-beta":[...n??[],`dreaming-2026-04-21`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/dreams/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`dreaming-2026-04-21`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/dreams?beta=true`,P,{query:i,...t,headers:I([{"anthropic-beta":[...n??[],`dreaming-2026-04-21`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}archive(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/dreams/${e}/archive?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`dreaming-2026-04-21`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}cancel(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/dreams/${e}/cancel?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`dreaming-2026-04-21`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}},dr=`x-stainless-helper`,fr=`x-stainless-helper-method`;function pr(e){return{[dr]:e}}var mr=Symbol(`anthropic.sdk.stainlessHelper`);function hr(e){return typeof e==`object`&&!!e&&mr in e}function gr(e,t){let n=new Set;if(e)for(let t of e)hr(t)&&n.add(t[mr]);if(t)for(let e of t){hr(e)&&n.add(e[mr]);let t=e.content;if(Array.isArray(t))for(let e of t)hr(e)&&n.add(e[mr])}return Array.from(n)}function _r(e,t){let n=gr(e,t);return n.length===0?{}:{[dr]:n.join(`, `)}}function vr(e){return hr(e)?{[dr]:e[mr]}:{}}var yr=class extends F{list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/files?beta=true`,P,{query:i,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()},...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}delete(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.delete(L`/v1/files/${e}?beta=true`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()},...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}download(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/files/${e}/content?beta=true`,{...n,headers:I([{Accept:`application/binary`,...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()},...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/files/${e}?beta=true`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()},...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}upload(e,t){let{betas:n,workspace_id:r,...i}=e;return this._client.post(`/v1/files?beta=true`,Wn({body:i,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()},...r==null?void 0:{"anthropic-workspace-id":r}},vr(i.file),t?.headers])},this._client))}},br=class extends F{retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/models/${e}?beta=true`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()},...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/models?beta=true`,Rn,{query:i,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()},...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}},xr=class extends F{create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/user_profiles?beta=true`,{body:r,...t,headers:I([{"anthropic-beta":[...n??[],`user-profiles-2026-08-18`].toString()},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(L`/v1/user_profiles/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`user-profiles-2026-08-18`].toString()},n?.headers])})}update(e,t,n){let{betas:r,...i}=t;return this._client.post(L`/v1/user_profiles/${e}?beta=true`,{body:i,...n,headers:I([{"anthropic-beta":[...r??[],`user-profiles-2026-08-18`].toString()},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/user_profiles?beta=true`,P,{query:r,...t,headers:I([{"anthropic-beta":[...n??[],`user-profiles-2026-08-18`].toString()},t?.headers])})}createEnrollmentURL(e,t={},n){let{betas:r}=t??{};return this._client.post(L`/v1/user_profiles/${e}/enrollment_url?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`user-profiles-2026-08-18`].toString()},n?.headers])})}},Sr=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0});var n=256,r=function(){function e(e){e===void 0&&(e=`=`),this._paddingCharacter=e}return e.prototype.encodedLength=function(e){return this._paddingCharacter?(e+2)/3*4|0:(e*8+5)/6|0},e.prototype.encode=function(e){for(var t=``,n=0;n<e.length-2;n+=3){var r=e[n]<<16|e[n+1]<<8|e[n+2];t+=this._encodeByte(r>>>18&63),t+=this._encodeByte(r>>>12&63),t+=this._encodeByte(r>>>6&63),t+=this._encodeByte(r>>>0&63)}var i=e.length-n;if(i>0){var r=e[n]<<16|(i===2?e[n+1]<<8:0);t+=this._encodeByte(r>>>18&63),t+=this._encodeByte(r>>>12&63),t+=i===2?this._encodeByte(r>>>6&63):this._paddingCharacter||``,t+=this._paddingCharacter||``}return t},e.prototype.maxDecodedLength=function(e){return this._paddingCharacter?e/4*3|0:(e*6+7)/8|0},e.prototype.decodedLength=function(e){return this.maxDecodedLength(e.length-this._getPaddingLength(e))},e.prototype.decode=function(e){if(e.length===0)return new Uint8Array;for(var t=this._getPaddingLength(e),r=e.length-t,i=new Uint8Array(this.maxDecodedLength(r)),a=0,o=0,s=0,c=0,l=0,u=0,d=0;o<r-4;o+=4)c=this._decodeChar(e.charCodeAt(o+0)),l=this._decodeChar(e.charCodeAt(o+1)),u=this._decodeChar(e.charCodeAt(o+2)),d=this._decodeChar(e.charCodeAt(o+3)),i[a++]=c<<2|l>>>4,i[a++]=l<<4|u>>>2,i[a++]=u<<6|d,s|=c&n,s|=l&n,s|=u&n,s|=d&n;if(o<r-1&&(c=this._decodeChar(e.charCodeAt(o)),l=this._decodeChar(e.charCodeAt(o+1)),i[a++]=c<<2|l>>>4,s|=c&n,s|=l&n),o<r-2&&(u=this._decodeChar(e.charCodeAt(o+2)),i[a++]=l<<4|u>>>2,s|=u&n),o<r-3&&(d=this._decodeChar(e.charCodeAt(o+3)),i[a++]=u<<6|d,s|=d&n),s!==0)throw Error(`Base64Coder: incorrect characters for decoding`);return i},e.prototype._encodeByte=function(e){var t=e;return t+=65,t+=25-e>>>8&6,t+=51-e>>>8&-75,t+=61-e>>>8&-15,t+=62-e>>>8&3,String.fromCharCode(t)},e.prototype._decodeChar=function(e){var t=n;return t+=(42-e&e-44)>>>8&-n+e-43+62,t+=(46-e&e-48)>>>8&-n+e-47+63,t+=(47-e&e-58)>>>8&-n+e-48+52,t+=(64-e&e-91)>>>8&-n+e-65+0,t+=(96-e&e-123)>>>8&-n+e-97+26,t},e.prototype._getPaddingLength=function(e){var t=0;if(this._paddingCharacter){for(var n=e.length-1;n>=0&&e[n]===this._paddingCharacter;n--)t++;if(e.length<4||t>2)throw Error(`Base64Coder: incorrect padding`)}return t},e}();e.Coder=r;var i=new r;function a(e){return i.encode(e)}e.encode=a;function o(e){return i.decode(e)}e.decode=o;var s=function(e){t(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}return r.prototype._encodeByte=function(e){var t=e;return t+=65,t+=25-e>>>8&6,t+=51-e>>>8&-75,t+=61-e>>>8&-13,t+=62-e>>>8&49,String.fromCharCode(t)},r.prototype._decodeChar=function(e){var t=n;return t+=(44-e&e-46)>>>8&-n+e-45+62,t+=(94-e&e-96)>>>8&-n+e-95+63,t+=(47-e&e-58)>>>8&-n+e-48+52,t+=(64-e&e-91)>>>8&-n+e-65+0,t+=(96-e&e-123)>>>8&-n+e-97+26,t},r}(r);e.URLSafeCoder=s;var c=new s;function l(e){return c.encode(e)}e.encodeURLSafe=l;function u(e){return c.decode(e)}e.decodeURLSafe=u,e.encodedLength=function(e){return i.encodedLength(e)},e.maxDecodedLength=function(e){return i.maxDecodedLength(e)},e.decodedLength=function(e){return i.decodedLength(e)}})),Cr=t(((e,t)=>{(function(e,n){var r={};n(r);var i=r.default;for(var a in r)i[a]=r[a];typeof t==`object`&&typeof t.exports==`object`?t.exports=i:typeof define==`function`&&define.amd?define(function(){return i}):e.sha256=i})(e,function(e){e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(e,n,r,i,a){for(var o,s,c,l,u,d,f,p,m,h,g,_,v;a>=64;){for(o=n[0],s=n[1],c=n[2],l=n[3],u=n[4],d=n[5],f=n[6],p=n[7],h=0;h<16;h++)g=i+h*4,e[h]=(r[g]&255)<<24|(r[g+1]&255)<<16|(r[g+2]&255)<<8|r[g+3]&255;for(h=16;h<64;h++)m=e[h-2],_=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,m=e[h-15],v=(m>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,e[h]=(_+e[h-7]|0)+(v+e[h-16]|0);for(h=0;h<64;h++)_=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&d^~u&f)|0)+(p+(t[h]+e[h]|0)|0)|0,v=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&s^o&c^s&c)|0,p=f,f=d,d=u,u=l+_|0,l=c,c=s,s=o,o=_+v|0;n[0]+=o,n[1]+=s,n[2]+=c,n[3]+=l,n[4]+=u,n[5]+=d,n[6]+=f,n[7]+=p,i+=64,a-=64}return i}var r=function(){function t(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return t.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},t.prototype.clean=function(){for(var e=0;e<this.buffer.length;e++)this.buffer[e]=0;for(var e=0;e<this.temp.length;e++)this.temp[e]=0;this.reset()},t.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this.finished)throw Error(`SHA256: can't update because hash was finished.`);var r=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[r++],t--;this.bufferLength===64&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(r=n(this.temp,this.state,e,r,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[r++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,r=this.bufferLength,i=t/536870912|0,a=t<<3,o=t%64<56?64:128;this.buffer[r]=128;for(var s=r+1;s<o-8;s++)this.buffer[s]=0;this.buffer[o-8]=i>>>24&255,this.buffer[o-7]=i>>>16&255,this.buffer[o-6]=i>>>8&255,this.buffer[o-5]=i>>>0&255,this.buffer[o-4]=a>>>24&255,this.buffer[o-3]=a>>>16&255,this.buffer[o-2]=a>>>8&255,this.buffer[o-1]=a>>>0&255,n(this.temp,this.state,this.buffer,0,o),this.finished=!0}for(var s=0;s<8;s++)e[s*4+0]=this.state[s]>>>24&255,e[s*4+1]=this.state[s]>>>16&255,e[s*4+2]=this.state[s]>>>8&255,e[s*4+3]=this.state[s]>>>0&255;return this},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype._saveState=function(e){for(var t=0;t<this.state.length;t++)e[t]=this.state[t]},t.prototype._restoreState=function(e,t){for(var n=0;n<this.state.length;n++)this.state[n]=e[n];this.bytesHashed=t,this.finished=!1,this.bufferLength=0},t}();e.Hash=r;var i=function(){function e(e){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)new r().update(e).finish(t).clean();else for(var n=0;n<e.length;n++)t[n]=e[n];for(var n=0;n<t.length;n++)t[n]^=54;this.inner.update(t);for(var n=0;n<t.length;n++)t[n]^=106;this.outer.update(t),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var n=0;n<t.length;n++)t[n]=0}return e.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},e.prototype.clean=function(){for(var e=0;e<this.istate.length;e++)this.ostate[e]=this.istate[e]=0;this.inner.clean(),this.outer.clean()},e.prototype.update=function(e){return this.inner.update(e),this},e.prototype.finish=function(e){return this.outer.finished?this.outer.finish(e):(this.inner.finish(e),this.outer.update(e,this.digestLength).finish(e)),this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e}();e.HMAC=i;function a(e){var t=new r().update(e),n=t.digest();return t.clean(),n}e.hash=a,e.default=a;function o(e,t){var n=new i(e).update(t),r=n.digest();return n.clean(),r}e.hmac=o;function s(e,t,n,r){var i=r[0];if(i===0)throw Error(`hkdf: cannot expand more`);t.reset(),i>1&&t.update(e),n&&t.update(n),t.update(r),t.finish(e),r[0]++}var c=new Uint8Array(e.digestLength);function l(e,t,n,r){t===void 0&&(t=c),r===void 0&&(r=32);for(var a=new Uint8Array([1]),l=new i(o(t,e)),u=new Uint8Array(l.digestLength),d=u.length,f=new Uint8Array(r),p=0;p<r;p++)d===u.length&&(s(u,l,n,a),d=0),f[p]=u[d++];return l.clean(),u.fill(0),a.fill(0),f}e.hkdf=l;function u(e,t,n,r){for(var a=new i(e),o=a.digestLength,s=new Uint8Array(4),c=new Uint8Array(o),l=new Uint8Array(o),u=new Uint8Array(r),d=0;d*o<r;d++){var f=d+1;s[0]=f>>>24&255,s[1]=f>>>16&255,s[2]=f>>>8&255,s[3]=f>>>0&255,a.reset(),a.update(t),a.update(s),a.finish(l);for(var p=0;p<o;p++)c[p]=l[p];for(var p=2;p<=n;p++){a.reset(),a.update(l).finish(l);for(var m=0;m<o;m++)c[m]^=l[m]}for(var p=0;p<o&&d*o+p<r;p++)u[d*o+p]=c[p]}for(var d=0;d<o;d++)c[d]=l[d]=0;for(var d=0;d<4;d++)s[d]=0;return a.clean(),u}e.pbkdf2=u})})),wr=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.timingSafeEqual=n;function t(e,t=``){if(!e)throw Error(t)}function n(e,n){if(e.byteLength!==n.byteLength)return!1;e instanceof DataView||(e=new DataView(ArrayBuffer.isView(e)?e.buffer:e)),n instanceof DataView||(n=new DataView(ArrayBuffer.isView(n)?n.buffer:n)),t(e instanceof DataView),t(n instanceof DataView);let r=e.byteLength,i=0,a=-1;for(;++a<r;)i|=e.getUint8(a)^n.getUint8(a);return i===0}})),Tr=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Webhook=e.WebhookVerificationError=void 0;var t=Sr(),n=Cr(),r=wr(),i=300,a=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name=`ExtendableError`,this.stack=Error(t).stack}},o=class e extends a{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype),this.name=`WebhookVerificationError`}};e.WebhookVerificationError=o;var s=class e{constructor(n,r){if(r?.format===`raw`)this.key=n instanceof Uint8Array?n:Uint8Array.from(n,e=>e.charCodeAt(0));else{if(typeof n!=`string`)throw Error(`Expected secret to be of type string`);n.startsWith(e.prefix)&&(n=n.substring(e.prefix.length)),this.key=t.decode(n)}if(this.key.length===0)throw Error(`Secret can't be empty.`)}verify(e,t,n){let i=n?.jsonParse??!0,a={};for(let e of Object.keys(t))a[e.toLowerCase()]=t[e];let s=a[`webhook-id`],c=a[`webhook-signature`],l=a[`webhook-timestamp`];if(!c||!s||!l)throw new o(`Missing required headers`);let u=this.verifyTimestamp(l),d=this.sign(s,u,e).split(`,`)[1],f=c.split(` `),p=new globalThis.TextEncoder;for(let t of f){let[n,a]=t.split(`,`);if(n===`v1`&&(0,r.timingSafeEqual)(p.encode(a),p.encode(d))){let t=e.toString();return t===``?void 0:i?JSON.parse(t):void 0}}throw new o(`No matching signature found`)}sign(e,r,i){if(typeof i!=`string`){if(i.constructor.name===`Buffer`)i=i.toString();else throw Error(`Expected payload to be of type string or Buffer.`)}let a=new TextEncoder,o=Math.floor(r.getTime()/1e3),s=a.encode(`${e}.${o}.${i}`);return`v1,${t.encode(n.hmac(this.key,s))}`}verifyTimestamp(e){let t=Math.floor(Date.now()/1e3),n=parseInt(e,10);if(Number.isNaN(n))throw new o(`Invalid Signature Headers`);if(t-n>i)throw new o(`Message timestamp too old`);if(n>t+i)throw new o(`Message timestamp too new`);return new Date(n*1e3)}};e.Webhook=s,s.prefix=`whsec_`}))(),Er=class extends F{parseUnverified(e){return JSON.parse(e)}unwrap(e,t){let n=t?.headers;if(n==null)throw Error(`Webhook headers are required in order to verify the signature`);let r=t.key===void 0?this._client.webhookKey:t.key;if(!r)throw Error(`Webhook key must not be null or empty in order to unwrap`);return new Tr.Webhook(r).verify(e,n),JSON.parse(e)}},Dr=class extends F{list(e,t={},n){let{betas:r,workspace_id:i,...a}=t??{};return this._client.getAPIList(L`/v1/agents/${e}/versions?beta=true`,P,{query:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}},Or=class extends F{constructor(){super(...arguments),this.versions=new Dr(this._client)}create(e,t){let{betas:n,workspace_id:r,...i}=e;return this._client.post(`/v1/agents?beta=true`,{body:i,...t,headers:I([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}retrieve(e,t={},n){let{betas:r,workspace_id:i,...a}=t??{};return this._client.get(L`/v1/agents/${e}?beta=true`,{query:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}update(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/agents/${e}?beta=true`,{body:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/agents?beta=true`,P,{query:i,...t,headers:I([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}archive(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/agents/${e}/archive?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}};Or.Versions=Dr;function kr(e,t){if(!e)return()=>{};if(e.aborted)return t.abort(),()=>{};let n=()=>t.abort();return e.addEventListener(`abort`,n),()=>e.removeEventListener(`abort`,n)}function Ar(e,t){return e instanceof x&&e.status===t}function jr(e){return e instanceof x&&typeof e.status==`number`&&e.status>=400&&e.status<500}function Mr(e){return jr(e)&&!Ar(e,408)&&!Ar(e,409)&&!Ar(e,429)}function Nr(e,t,n){return Math.min(t*2**e,n)}function Pr(e,t){return e+Math.random()*(t-e)}function Fr(e){return e*(1-Math.random()*.25)}function Ir(e,{authToken:t,helper:n}){if(!t)throw new p(`copyClientForHelper: expected a non-empty authToken but received ${JSON.stringify(t)}`);let r=e,i=r._options.defaultHeaders,a=r._authState?.extraHeaders,o=I([a?Object.fromEntries(Object.entries(a).filter(([e])=>{let t=e.toLowerCase();return t!==`authorization`&&t!==`x-api-key`})):void 0,i,{[dr]:n}]);return e.withOptions({apiKey:null,authToken:t,baseURL:e.baseURL,credentials:void 0,defaultHeaders:o})}var Lr,Rr,R,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr=1e3,Xr=6e4,Zr=3e5,Qr=class{constructor(e){Lr.set(this,void 0),Rr.set(this,!1),R.set(this,void 0),zr.set(this,void 0),Br.set(this,void 0),Vr.set(this,void 0),Hr.set(this,void 0),Ur.set(this,void 0),Wr.set(this,void 0),this.client=e.client,this.environmentId=e.environmentId,this.environmentKey=e.environmentKey,this.workerId=e.workerId??ti(),C(this,Lr,Ir(e.client,{authToken:e.environmentKey,helper:`environments-work-poller`}),`f`),C(this,Br,e.autoStop??!0,`f`),C(this,Vr,e.drain??!1,`f`),C(this,Hr,e.blockMs===void 0?999:e.blockMs,`f`),C(this,Ur,e.reclaimOlderThanMs??null,`f`),C(this,Wr,e.requestOptions,`f`),C(this,R,new AbortController,`f`),C(this,zr,kr(e.signal,w(this,R,`f`)),`f`)}get signal(){return w(this,R,`f`).signal}abort(){w(this,R,`f`).abort()}async*[(Lr=new WeakMap,Rr=new WeakMap,R=new WeakMap,zr=new WeakMap,Br=new WeakMap,Vr=new WeakMap,Hr=new WeakMap,Ur=new WeakMap,Wr=new WeakMap,Symbol.asyncIterator)](){if(w(this,Rr,`f`))throw new p(`Cannot iterate over a consumed WorkPoller`);C(this,Rr,!0,`f`);let e=j(this.client);e.info(`poller starting`,{component:`work-poller`,environment_id:this.environmentId});let t=new ei(e,this.environmentId);try{let n=0;for(;!w(this,R,`f`).signal.aborted;){let r;try{r=await w(this,Lr,`f`).beta.environments.work.poll(this.environmentId,{"Anthropic-Worker-ID":this.workerId,...w(this,Hr,`f`)===null?{}:{block_ms:w(this,Hr,`f`)},...w(this,Ur,`f`)===null?{}:{reclaim_older_than_ms:w(this,Ur,`f`)}},{headers:I([w(this,Wr,`f`)?.headers]),signal:w(this,R,`f`).signal})}catch(t){if(w(this,R,`f`).signal.aborted)return;if(Mr(t))throw e.error(`poll failed permanently, stopping poller`,{error:String(t)}),t;let r=Fr($r(n));e.warn(`poll failed, backing off`,{error:String(t),backoff_ms:r}),n++,await Pe(r,w(this,R,`f`).signal);continue}if(n=0,r==null){if(w(this,Vr,`f`))return;t.onEmptyPoll(),await Pe(Pr(1e3,3e3),w(this,R,`f`).signal);continue}t.onClaim(),e.info(`claimed work`,{component:`work-poller`,environment_id:this.environmentId,work_id:r.id,work_type:r.data.type});try{await w(this,Lr,`f`).beta.environments.work.ack(r.id,{environment_id:r.environment_id},{headers:I([w(this,Wr,`f`)?.headers]),signal:w(this,R,`f`).signal})}catch(t){e.error(`ack failed`,{work_id:r.id,error:String(t)});continue}try{yield r}finally{if(w(this,Br,`f`))try{await w(this,Lr,`f`).beta.environments.work.stop(r.id,{environment_id:r.environment_id},{headers:I([w(this,Wr,`f`)?.headers])})}catch(t){Ar(t,409)||e.warn(`stop failed`,{work_id:r.id,error:String(t)})}}}}finally{w(this,zr,`f`).call(this)}}};function $r(e){return Nr(e,Yr,Xr)}var ei=class{constructor(e,t){Gr.set(this,void 0),Kr.set(this,void 0),qr.set(this,void 0),Jr.set(this,0),C(this,Gr,e,`f`),C(this,Kr,t,`f`)}onEmptyPoll(){let e=Date.now(),t={component:`work-poller`,environment_id:w(this,Kr,`f`)};w(this,qr,`f`)===void 0?(C(this,qr,C(this,Jr,e,`f`),`f`),w(this,Gr,`f`).info(`idle; polling for work`,t)):e-w(this,Jr,`f`)>=Zr?(C(this,Jr,e,`f`),w(this,Gr,`f`).info(`still polling; idle for ${Math.round((e-w(this,qr,`f`))/1e3)}s`,t)):w(this,Gr,`f`).debug(`poll returned no work`,t)}onClaim(){C(this,qr,void 0,`f`)}};Gr=new WeakMap,Kr=new WeakMap,qr=new WeakMap,Jr=new WeakMap;function ti(){let e={}.HOSTNAME;return e?`${e}-${we()}`:we()}var ni,ri,ii,ai=class{constructor(){ni.set(this,[]),ri.set(this,[]),ii.set(this,!1)}push(e){if(w(this,ii,`f`))return!1;let t=w(this,ri,`f`).shift();return t?t({done:!1,value:e}):w(this,ni,`f`).push(e),!0}close(){if(!w(this,ii,`f`))for(C(this,ii,!0,`f`);w(this,ri,`f`).length>0;)w(this,ri,`f`).shift()({done:!0,value:void 0})}next(e){return w(this,ni,`f`).length>0?Promise.resolve({done:!1,value:w(this,ni,`f`).shift()}):w(this,ii,`f`)||e?.aborted?Promise.resolve({done:!0,value:void 0}):new Promise(t=>{let n=n=>{e?.removeEventListener(`abort`,r),t(n)},r=()=>{let e=w(this,ri,`f`).indexOf(n);e>=0&&w(this,ri,`f`).splice(e,1),t({done:!0,value:void 0})};w(this,ri,`f`).push(n),e?.addEventListener(`abort`,r,{once:!0})})}tryShift(){return w(this,ni,`f`).shift()}};ni=new WeakMap,ri=new WeakMap,ii=new WeakMap;var oi=class extends Error{constructor(e){let t=typeof e==`string`?e:e.map(e=>e.type===`text`?e.text:`[${e.type}]`).join(` `);super(t),this.name=`ToolError`,this.content=e}};function si(e){return`name`in e?e.name:`mcp_server_name`in e?e.mcp_server_name:e.type}function ci(e){return e instanceof oi?e.content:`Error: ${e instanceof Error?e.message:String(e)}`}async function li(e,t,n){try{let r=e.parse?e.parse(t):t;return{content:await e.run(r,n),isError:!1}}catch(e){return{content:ci(e),isError:!0}}}var ui,di,fi,pi,z,B,mi,V,hi,gi,_i,H,vi,U,yi,bi,xi,Si,Ci,wi,W,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li=500,Ri=1e4,zi=12e4,Bi=3e4,Vi=1e3,Hi=3e4,Ui=3e5;function Wi(e){return e.type===`session.status_idle`&&e.stop_reason?.type===`end_turn`}var Gi=class{constructor(e,t){ui.set(this,void 0),di.set(this,void 0),fi.set(this,new Set),pi.set(this,!1),z.set(this,void 0),C(this,ui,e,`f`),C(this,di,t,`f`)}noteEvent(e){e.type!==`user.tool_confirmation`&&(Wi(e)?this.arm():this.disarm())}block(e){w(this,fi,`f`).add(e),w(this,z,`f`)!==void 0&&(C(this,pi,!0,`f`),clearTimeout(w(this,z,`f`)),C(this,z,void 0,`f`))}unblock(e){w(this,fi,`f`).delete(e),w(this,fi,`f`).size===0&&w(this,pi,`f`)&&this.arm()}arm(){if(!(w(this,ui,`f`)<=0)){if(w(this,fi,`f`).size>0){C(this,pi,!0,`f`);return}C(this,pi,!1,`f`),w(this,z,`f`)!==void 0&&clearTimeout(w(this,z,`f`)),C(this,z,setTimeout(w(this,di,`f`),w(this,ui,`f`)),`f`)}}disarm(){C(this,pi,!1,`f`),w(this,z,`f`)!==void 0&&(clearTimeout(w(this,z,`f`)),C(this,z,void 0,`f`))}};ui=new WeakMap,di=new WeakMap,fi=new WeakMap,pi=new WeakMap,z=new WeakMap;var Ki=class{constructor(e,t){B.add(this),mi.set(this,!1),V.set(this,void 0),hi.set(this,void 0),gi.set(this,void 0),_i.set(this,void 0),H.set(this,void 0),vi.set(this,new Set),U.set(this,new Set),yi.set(this,new Map),bi.set(this,new Map),xi.set(this,new ai),Si.set(this,0),Ci.set(this,Ui),wi.set(this,null),W.set(this,void 0),this.client=t.client,this.sessionId=e,this.tools=t.tools,this.maxIdleMs=t.maxIdleMs??6e4,C(this,H,j(t.client),`f`),C(this,_i,new Map(t.tools.map(e=>[si(e),e])),`f`),C(this,V,new AbortController,`f`),C(this,hi,kr(t.signal,w(this,V,`f`)),`f`),C(this,gi,t.requestOptions,`f`),C(this,W,new Gi(this.maxIdleMs,()=>{w(this,H,`f`).info(`session idle after end_turn; stopping`,{component:`session-tool-runner`,session_id:this.sessionId,max_idle_ms:this.maxIdleMs}),w(this,V,`f`).abort()}),`f`)}get signal(){return w(this,V,`f`).signal}abort(){w(this,V,`f`).abort()}_setSendRetryWindow(e){C(this,Ci,e,`f`)}async*[(mi=new WeakMap,V=new WeakMap,hi=new WeakMap,gi=new WeakMap,_i=new WeakMap,H=new WeakMap,vi=new WeakMap,U=new WeakMap,yi=new WeakMap,bi=new WeakMap,xi=new WeakMap,Si=new WeakMap,Ci=new WeakMap,wi=new WeakMap,W=new WeakMap,B=new WeakSet,Symbol.asyncIterator)](){if(w(this,mi,`f`))throw new p(`Cannot iterate over a consumed SessionToolRunner`);C(this,mi,!0,`f`),w(this,H,`f`).info(`session tool runner starting`,{component:`session-tool-runner`,session_id:this.sessionId});let e=w(this,B,`m`,Ei).call(this).catch(e=>{w(this,V,`f`).signal.aborted||w(this,H,`f`).error(`stream loop failed`,{error:String(e)}),w(this,V,`f`).abort()});try{for(;;){let e=await w(this,xi,`f`).next(w(this,V,`f`).signal);if(e.done)break;yield e.value}await e;let t;for(;(t=w(this,xi,`f`).tryShift())!==void 0;)yield t}finally{w(this,V,`f`).abort(),w(this,W,`f`).disarm(),await e;try{await w(this,B,`m`,Ii).call(this)}catch(e){w(this,H,`f`).warn(`drain failed`,{error:String(e)})}w(this,xi,`f`).close();for(let e of this.tools)try{await e.close?.()}catch(t){w(this,H,`f`).warn(`tool.close failed`,{tool:si(e),error:String(t)})}w(this,hi,`f`).call(this)}}};Ti=function(){return{...w(this,gi,`f`),headers:I([pr(`session-tool-runner`),w(this,gi,`f`)?.headers]),signal:w(this,V,`f`).signal}},Ei=async function(){let e=w(this,V,`f`),t=Li;for(;!e.signal.aborted;){try{let e=await this.client.beta.sessions.events.stream(this.sessionId,{},w(this,B,`m`,Ti).call(this));await w(this,B,`m`,Di).call(this);for await(let n of e)if(t=Li,await w(this,B,`m`,ki).call(this,n))return}catch(n){if(e.signal.throwIfAborted(),Mr(n))throw w(this,H,`f`).error(`permanent stream failure, shutting down`,{error:String(n)}),e.abort(),n;w(this,H,`f`).warn(`stream disconnected, reconnecting`,{error:String(n),backoff_ms:t})}e.signal.throwIfAborted(),await Pe(t,e.signal),t=Math.min(t*2,Ri)}},Di=async function(){let e=w(this,V,`f`),t=[],n=!1;try{for await(let e of this.client.beta.sessions.events.list(this.sessionId,{limit:1e3},w(this,B,`m`,Ti).call(this)))w(this,B,`m`,Oi).call(this,e,t),n=Wi(e)}catch(n){e.signal.throwIfAborted(),w(this,H,`f`).warn(`reconcile list failed`,{error:String(n)});for(let e of t)w(this,vi,`f`).delete(e.id);return}let r=t.filter(e=>!w(this,U,`f`).has(e.id));w(this,W,`f`).disarm();for(let e of r)await w(this,B,`m`,Ai).call(this,e);for(let e of[...w(this,bi,`f`).values()]){let t=w(this,yi,`f`).get(e.id);t!==void 0&&await w(this,B,`m`,Mi).call(this,e,t)}let i=r.filter(e=>!w(this,U,`f`).has(e.id)&&!w(this,bi,`f`).has(e.id));n&&i.length===0?w(this,W,`f`).arm():w(this,W,`f`).disarm()},Oi=function(e,t){e.type===`agent.tool_use`||e.type===`agent.custom_tool_use`?(w(this,vi,`f`).add(e.id),w(this,U,`f`).has(e.id)||t.push(e)):e.type===`user.tool_result`?w(this,U,`f`).add(e.tool_use_id):e.type===`user.custom_tool_result`?w(this,U,`f`).add(e.custom_tool_use_id):e.type===`user.tool_confirmation`&&(w(this,U,`f`).has(e.tool_use_id)||w(this,yi,`f`).set(e.tool_use_id,e.result))},ki=async function(e){switch(w(this,W,`f`).noteEvent(e),e.type){case`agent.tool_use`:case`agent.custom_tool_use`:return w(this,vi,`f`).has(e.id)||(w(this,vi,`f`).add(e.id),await w(this,B,`m`,Ai).call(this,e)),!1;case`user.tool_confirmation`:return await w(this,B,`m`,ji).call(this,e),!1;case`user.tool_result`:return w(this,U,`f`).add(e.tool_use_id),!1;case`user.custom_tool_result`:return w(this,U,`f`).add(e.custom_tool_use_id),!1;case`session.status_terminated`:case`session.deleted`:return w(this,H,`f`).info(`session terminated`,{component:`session-tool-runner`,session_id:this.sessionId}),w(this,V,`f`).abort(),!0;default:return!1}},Ai=async function(e){let t=e.evaluated_permission,n=t===`deny`?`deny`:w(this,yi,`f`).get(e.id);if(n===void 0){t===void 0||t===`allow`?await w(this,B,`m`,Pi).call(this,e,void 0):w(this,bi,`f`).has(e.id)||(w(this,H,`f`).info(`tool call awaiting confirmation; holding`,{component:`session-tool-runner`,session_id:this.sessionId,tool:e.name,tool_use_id:e.id}),w(this,bi,`f`).set(e.id,e),w(this,W,`f`).block(e.id));return}await w(this,B,`m`,Mi).call(this,e,n)},ji=async function(e){w(this,yi,`f`).set(e.tool_use_id,e.result);let t=w(this,bi,`f`).get(e.tool_use_id);t!==void 0&&await w(this,B,`m`,Mi).call(this,t,e.result)},Mi=async function(e,t){let n=w(this,bi,`f`).delete(e.id);if(t===`allow`){w(this,H,`f`).info(`tool call confirmed`,{component:`session-tool-runner`,session_id:this.sessionId,tool:e.name,tool_use_id:e.id}),n||w(this,W,`f`).block(e.id);try{await w(this,B,`m`,Pi).call(this,e,`allow`)}finally{w(this,W,`f`).unblock(e.id)}return}n&&w(this,W,`f`).unblock(e.id),w(this,U,`f`).add(e.id),w(this,H,`f`).info(`tool call denied; not executing`,{component:`session-tool-runner`,session_id:this.sessionId,tool:e.name,tool_use_id:e.id}),w(this,B,`m`,Ni).call(this,{event:e,toolUseId:e.id,name:e.name,isError:!1,posted:!1,confirmation:`deny`})},Ni=function(e){w(this,xi,`f`).push(e)},Pi=async function(e,t){var n,r;if(!w(this,U,`f`).has(e.id)){w(this,H,`f`).info(`executing tool`,{component:`session-tool-runner`,session_id:this.sessionId,tool:e.name,tool_use_id:e.id}),C(this,Si,(n=w(this,Si,`f`),n++,n),`f`);try{let n=w(this,_i,`f`).get(e.name);if(!n){w(this,H,`f`).info(`tool not owned by this runner; leaving the tool_use_id pending for its owner`,{component:`session-tool-runner`,session_id:this.sessionId,tool:e.name,tool_use_id:e.id}),w(this,B,`m`,Ni).call(this,{event:e,toolUseId:e.id,name:e.name,isError:!1,posted:!1,confirmation:t});return}let r,i,a=new AbortController,o=kr(w(this,V,`f`).signal,a),s=setTimeout(()=>a.abort(),zi);try{let t=await li(n,e.input,{toolUse:e,toolUseBlock:e,signal:a.signal});r=t.content,i=t.isError}finally{clearTimeout(s),o()}let c=qi(e,i,Ji(r)),l=await w(this,B,`m`,Fi).call(this,c,e.id);w(this,B,`m`,Ni).call(this,{event:e,result:c,toolUseId:e.id,name:e.name,isError:i,posted:l,confirmation:t})}finally{C(this,Si,(r=w(this,Si,`f`),r--,r),`f`),w(this,Si,`f`)===0&&w(this,wi,`f`)?.call(this)}}},Fi=async function(e,t){let n=w(this,V,`f`),r=Date.now(),i,a=0;for(;;){a++,n.signal.throwIfAborted();try{return await this.client.beta.sessions.events.send(this.sessionId,{events:[e]},w(this,B,`m`,Ti).call(this)),w(this,U,`f`).add(t),!0}catch(e){if(i=e,Mr(e))break;let o=w(this,Ci,`f`)-(Date.now()-r);if(o<=0)break;let s=Math.min(Fr(Nr(a-1,Vi,Hi)),o);w(this,H,`f`).warn(`tool result send failed; retrying`,{tool_use_id:t,attempt:a,backoff_ms:s,error:String(e)}),await Pe(s,n.signal)}}return w(this,H,`f`).error(`failed to send tool result`,{tool_use_id:t,attempts:a,error:String(i)}),!1},Ii=async function(){w(this,Si,`f`)!==0&&(await Promise.race([new Promise(e=>C(this,wi,e,`f`)),Pe(Bi)]),C(this,wi,null,`f`),w(this,Si,`f`)>0&&w(this,H,`f`).warn(`drain timeout exceeded`))};function qi(e,t,n){return e.type===`agent.custom_tool_use`?{type:`user.custom_tool_result`,custom_tool_use_id:e.id,is_error:t,content:n}:{type:`user.tool_result`,tool_use_id:e.id,is_error:t,content:n}}function Ji(e){if(typeof e==`string`)return[{type:`text`,text:e||`(no output)`}];let t=e.map(e=>e.type===`text`?{type:`text`,text:e.text||`(no output)`}:e.type===`image`||e.type===`document`?e:e.type===`search_result`?{type:`search_result`,source:e.source,title:e.title,content:e.content.map(e=>({type:`text`,text:e.text})),citations:{enabled:e.citations?.enabled??!1}}:{type:`text`,text:JSON.stringify(e)});return t.length>0?t:[{type:`text`,text:`(no output)`}]}var Yi,Xi,Zi,Qi,$i,ea=3e4,ta=9e4,na=`NO_HEARTBEAT`;function ra(e){return e.resources.some(e=>e.type===`memory_store`)}function ia(e){if(!e)return null;let t;try{let n=e.replace(/-/g,`+`).replace(/_/g,`/`),r=n.padEnd(Math.ceil(n.length/4)*4,`=`);t=JSON.parse(Rt(zt(r)))}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t.sessions_token;return typeof n==`string`&&n!==``?n:null}var aa=class{constructor(e){if(Yi.add(this),Xi.set(this,void 0),e.unrestrictedPaths!==void 0)throw new p("The `unrestrictedPaths` option you passed to EnvironmentWorker (or client.beta.environments.work.worker()) is no longer supported. The worker's file tools (read, write, edit, glob, grep) are now always confined to `workdir` plus the session's memory folders. Remove `unrestrictedPaths` from your options; to let the file tools reach any other directory, add it to `AgentToolContext.allowedRoots` from a `tools` factory.");this.client=e.client,this.environmentId=e.environmentId,this.environmentKey=e.environmentKey,this.tools=e.tools,this.workdir=e.workdir??process.cwd(),this.maxFileBytes=e.maxFileBytes,this.maxIdleMs=e.maxIdleMs,e.memorySyncIntervalMs!=null&&Ce(e.memorySyncIntervalMs,`memorySyncIntervalMs`),this.memorySyncIntervalMs=e.memorySyncIntervalMs,this.memorySyncDeletions=e.memorySyncDeletions??`enabled`,this.workerId=e.workerId,this.requestOptions=e.requestOptions,C(this,Xi,e.signal,`f`)}async run(e){let{environmentId:t,environmentKey:n}=this;if(t===void 0||n===void 0)throw new p(`EnvironmentWorker.run: environmentId and environmentKey are required to poll for work`);let r=e??w(this,Xi,`f`),i=new Qr({client:this.client,environmentId:t,environmentKey:n,...this.workerId===void 0?{}:{workerId:this.workerId},...r?{signal:r}:{},...this.requestOptions===void 0?{}:{requestOptions:this.requestOptions},autoStop:!1});for await(let e of i)try{await w(this,Yi,`m`,Zi).call(this,e,n,i.signal)}catch(t){if(i.signal?.aborted)throw t;j(this.client).error(`work item failed`,{work_id:e.id,error:String(t)})}}async handleItem(e){let t=e?.workId??A(`ANTHROPIC_WORK_ID`),n=e?.environmentId??A(`ANTHROPIC_ENVIRONMENT_ID`),r=e?.sessionId??A(`ANTHROPIC_SESSION_ID`),i=e?.environmentKey??this.environmentKey??A(`ANTHROPIC_ENVIRONMENT_KEY`),a=e?.workSecret||A(`ANTHROPIC_WORK_SECRET`)||null;if(!t)throw new p(`handleItem: workId is required — pass it or set ANTHROPIC_WORK_ID`);if(!n)throw new p(`handleItem: environmentId is required — pass it or set ANTHROPIC_ENVIRONMENT_ID`);if(!r)throw new p(`handleItem: sessionId is required — pass it or set ANTHROPIC_SESSION_ID`);if(!i)throw new p(`handleItem: environmentKey is required — pass it, construct the worker with it, or set ANTHROPIC_ENVIRONMENT_KEY`);let o={id:t,environment_id:n,secret:a,data:{type:`session`,id:r}};await w(this,Yi,`m`,Zi).call(this,o,i,e?.signal??w(this,Xi,`f`))}};Xi=new WeakMap,Yi=new WeakSet,Zi=async function(e,t,n){let r=j(this.client),i=ia(e.secret);e.secret&&i===null&&r.warn(`work item carried a secret payload but no sessions token could be extracted; falling back to the environment key`,{work_id:e.id});let a=i??t,o=Ir(this.client,{authToken:a,helper:`environments-worker`}),s=e.data.id,c=new AbortController,l=kr(n,c),u=new ca(c),d=await f(()=>import(`./node.browser-BX-QLlU2.js`),__vite__mapDeps([2,1]),import.meta.url),p,m,h=ua(o,e,u,r,this.requestOptions,e=>{p=e,m?._setSendRetryWindow(e)}).catch(t=>{c.signal.aborted||r.error(`heartbeat loop failed`,{work_id:e.id,error:String(t)}),c.abort()}),g=async()=>{},_,v=!1;try{if(e.data.type!==`session`){r.debug(`skipping non-session work item`,{work_id:e.id,type:e.data.type});return}let t=await o.beta.sessions.retrieve(s);if(i===null&&this.memorySyncIntervalMs!==null&&ra(t))throw new d.SessionMemoryError(`cannot mount the session's memories: the work item carried no sessions token (work_id=${e.id}, session_id=${s}); the memory endpoints reject the environment key, so the poller must issue a per-item \`secret\` carrying \`sessions_token\`, or set \`memorySyncIntervalMs: null\` to run without memory`);let n={workdir:this.workdir,client:o,session:t,...this.maxFileBytes===void 0?{}:{maxFileBytes:this.maxFileBytes}};try{g=await d.setupSkills(n)}catch(t){r.warn(`skill setup failed`,{session_id:s,work_id:e.id,error:String(t)})}i!==null&&this.memorySyncIntervalMs!==null?(_=new d.SessionMemoryStores(o,{workdir:this.workdir,...this.memorySyncIntervalMs===void 0?{}:{syncIntervalMs:this.memorySyncIntervalMs},syncDeletions:this.memorySyncDeletions}),await _.download(t),n.allowedRoots=_.roots,n.readOnlyRoots=_.readOnlyRoots):r.debug(`memory stores disabled for this item`,{work_id:e.id}),m=new Ki(s,{client:o,tools:typeof this.tools==`function`?this.tools(n):this.tools??d.betaAgentToolset20260401(n),...this.maxIdleMs===void 0?{}:{maxIdleMs:this.maxIdleMs},...this.requestOptions===void 0?{}:{requestOptions:this.requestOptions},signal:c.signal}),p!==void 0&&m._setSendRetryWindow(p);for await(let e of m)_&&await _.syncIfDue();v=!c.signal.aborted}finally{try{await g().catch(t=>{r.warn(`skill cleanup failed`,{session_id:s,work_id:e.id,error:String(t)})})}finally{if(_){let t=d.MEMORY_FLUSH_TIMEOUT_MS;v&&await oa(_.finish(),t)&&r.warn(`final memory sync cut off after ${t}ms; the flush that follows still uploads changed files`,{session_id:s,work_id:e.id});let n=new AbortController;await oa(_.flushWrites(n.signal),t)&&(n.abort(),r.warn(`memory flush cut off after ${t}ms; changed files it had not uploaded yet are not saved`,{session_id:s,work_id:e.id})),await _.dispose().catch(t=>{r.warn(`memory store cleanup failed`,{session_id:s,work_id:e.id,error:String(t)})})}}u.finish(`runner_done`),l(),await h,u.lost?r.info(`lease lost; released without stopping it`,{session_id:s,work_id:e.id}):await sa(o,e,r,this.requestOptions)}};async function oa(e,t){let n;try{return await Promise.race([e.then(()=>!1,()=>!1),new Promise(e=>{n=setTimeout(()=>e(!0),t)})])}finally{n!==void 0&&clearTimeout(n)}}async function sa(e,t,n,r){try{await e.beta.environments.work.stop(t.id,{environment_id:t.environment_id,force:!0},{...r,headers:I([r?.headers])})}catch(e){Ar(e,409)||n.error(`force-stop on exit failed`,{work_id:t.id,error:String(e)})}}var ca=class{constructor(e){Qi.set(this,void 0),$i.set(this,void 0),C(this,Qi,e,`f`)}get signal(){return w(this,Qi,`f`).signal}finish(e){C(this,$i,w(this,$i,`f`)??e,`f`),w(this,Qi,`f`).abort()}get lost(){return w(this,$i,`f`)===`lease_lost`||w(this,$i,`f`)===`assumed_lost`}};Qi=new WeakMap,$i=new WeakMap;function la(e){let t=e instanceof x?e.error:void 0;for(let e of[`error`,`details`,`current_state`]){if(!je(t))return{};t=t[e]}return je(t)?t:{}}async function ua(e,t,n,r,i,a){let o=ea,s=ta,c=Date.now(),l=na,u=async()=>{let u=new AbortController,d=kr(n.signal,u),f=setTimeout(()=>u.abort(),o);try{let d=await e.beta.environments.work.heartbeat(t.id,{environment_id:t.environment_id,expected_last_heartbeat:l},{...i,headers:I([i?.headers]),signal:u.signal});c=Date.now(),l=d.last_heartbeat,d.ttl_seconds>0&&(s=d.ttl_seconds*1e3,o=Math.max(1e3,Math.min(s/2,ea)),a?.(s)),(d.state===`stopping`||d.state===`stopped`)&&(r.info(`heartbeat signals shutdown`,{work_id:t.id,state:d.state}),n.finish(`control_plane_stop`)),d.lease_extended||(r.warn(`lease not extended, shutting down`,{work_id:t.id}),n.finish(`control_plane_stop`))}catch(e){if(n.signal.throwIfAborted(),Ar(e,412)){let i=la(e);r.error(`lease lost: heartbeat precondition failed`,{work_id:t.id,server_state:i.state,server_ttl_seconds:i.ttl_seconds,server_last_heartbeat:i.last_heartbeat}),n.finish(`lease_lost`);return}if(Mr(e))throw r.error(`permanent heartbeat failure`,{work_id:t.id,error:String(e)}),n.finish(`heartbeat_rejected`),e;if(Date.now()-c>s){r.error(`lease assumed lost: no successful heartbeat in ttl`,{work_id:t.id,ttl_ms:s,error:String(e)}),n.finish(`assumed_lost`);return}r.warn(`transient heartbeat failure`,{work_id:t.id,error:String(e)})}finally{clearTimeout(f),d()}};for(await u();!n.signal.aborted;)await Pe(o,n.signal),n.signal.throwIfAborted(),await u()}var da=class extends F{retrieve(e,t,n){let{environment_id:r,betas:i,workspace_id:a}=t;return this._client.get(L`/v1/environments/${r}/work/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}update(e,t,n){let{environment_id:r,betas:i,workspace_id:a,...o}=t;return this._client.post(L`/v1/environments/${r}/work/${e}?beta=true`,{body:o,...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(L`/v1/environments/${e}/work?beta=true`,P,{query:i,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}ack(e,t,n){let{environment_id:r,betas:i}=t;return this._client.post(L`/v1/environments/${r}/work/${e}/ack?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}heartbeat(e,t,n){let{environment_id:r,desired_ttl_seconds:i,expected_last_heartbeat:a,betas:o}=t;return this._client.post(L`/v1/environments/${r}/work/${e}/heartbeat?beta=true`,{query:{desired_ttl_seconds:i,expected_last_heartbeat:a},...n,headers:I([{"anthropic-beta":[...o??[],`managed-agents-2026-04-01`].toString()},n?.headers])})}poll(e,t={},n){let{betas:r,"Anthropic-Worker-ID":i,...a}=t??{};return this._client.get(L`/v1/environments/${e}/work/poll?beta=true`,{query:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"Anthropic-Worker-ID":i}},n?.headers])})}stats(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/environments/${e}/work/stats?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}stop(e,t,n){let{environment_id:r,betas:i,workspace_id:a,...o}=t;return this._client.post(L`/v1/environments/${r}/work/${e}/stop?beta=true`,{body:o,...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}poller(e){return new Qr({...e,client:this._client})}worker(e){return new aa({...e,client:this._client})}};da.WorkPoller=Qr,da.EnvironmentWorker=aa;var fa=class extends F{constructor(){super(...arguments),this.work=new da(this._client)}create(e,t){let{betas:n,workspace_id:r,...i}=e;return this._client.post(`/v1/environments?beta=true`,{body:i,...t,headers:I([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/environments/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}update(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/environments/${e}?beta=true`,{body:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/environments?beta=true`,P,{query:i,...t,headers:I([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}delete(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.delete(L`/v1/environments/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}archive(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/environments/${e}/archive?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}};fa.Work=da;var pa=class extends F{create(e,t,n){let{view:r,betas:i,workspace_id:a,...o}=t;return this._client.post(L`/v1/memory_stores/${e}/memories?beta=true`,{query:{view:r},body:o,...n,headers:I([{"anthropic-beta":[...i??[],`agent-memory-2026-07-22`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}retrieve(e,t,n){let{memory_store_id:r,betas:i,workspace_id:a,...o}=t;return this._client.get(L`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:o,...n,headers:I([{"anthropic-beta":[...i??[],`agent-memory-2026-07-22`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}update(e,t,n){let{memory_store_id:r,view:i,betas:a,workspace_id:o,...s}=t;return this._client.post(L`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:{view:i},body:s,...n,headers:I([{"anthropic-beta":[...a??[],`agent-memory-2026-07-22`].toString(),...o==null?void 0:{"anthropic-workspace-id":o}},n?.headers])})}list(e,t={},n){let{betas:r,workspace_id:i,...a}=t??{};return this._client.getAPIList(L`/v1/memory_stores/${e}/memories?beta=true`,P,{query:a,...n,headers:I([{"anthropic-beta":[...r??[],`agent-memory-2026-07-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}delete(e,t,n){let{memory_store_id:r,expected_content_sha256:i,betas:a,workspace_id:o}=t;return this._client.delete(L`/v1/memory_stores/${r}/memories/${e}?beta=true`,{query:{expected_content_sha256:i},...n,headers:I([{"anthropic-beta":[...a??[],`agent-memory-2026-07-22`].toString(),...o==null?void 0:{"anthropic-workspace-id":o}},n?.headers])})}},ma=class extends F{retrieve(e,t,n){let{memory_store_id:r,betas:i,workspace_id:a,...o}=t;return this._client.get(L`/v1/memory_stores/${r}/memory_versions/${e}?beta=true`,{query:o,...n,headers:I([{"anthropic-beta":[...i??[],`agent-memory-2026-07-22`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}list(e,t={},n){let{betas:r,workspace_id:i,...a}=t??{};return this._client.getAPIList(L`/v1/memory_stores/${e}/memory_versions?beta=true`,P,{query:a,...n,headers:I([{"anthropic-beta":[...r??[],`agent-memory-2026-07-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}redact(e,t,n){let{memory_store_id:r,betas:i,workspace_id:a}=t;return this._client.post(L`/v1/memory_stores/${r}/memory_versions/${e}/redact?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`agent-memory-2026-07-22`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}},ha=class extends F{constructor(){super(...arguments),this.memories=new pa(this._client),this.memoryVersions=new ma(this._client)}create(e,t){let{betas:n,workspace_id:r,...i}=e;return this._client.post(`/v1/memory_stores?beta=true`,{body:i,...t,headers:I([{"anthropic-beta":[...n??[],`agent-memory-2026-07-22`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/memory_stores/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`agent-memory-2026-07-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}update(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/memory_stores/${e}?beta=true`,{body:a,...n,headers:I([{"anthropic-beta":[...r??[],`agent-memory-2026-07-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/memory_stores?beta=true`,P,{query:i,...t,headers:I([{"anthropic-beta":[...n??[],`agent-memory-2026-07-22`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}delete(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.delete(L`/v1/memory_stores/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`agent-memory-2026-07-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}archive(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/memory_stores/${e}/archive?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`agent-memory-2026-07-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}};ha.Memories=pa,ha.MemoryVersions=ma;var ga=class e{constructor(e,t){this.iterator=e,this.controller=t}async*decoder(){let e=new hn;for await(let t of this.iterator)for(let n of e.decode(t))yield JSON.parse(n);for(let t of e.flush())yield JSON.parse(t)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(t,n){if(!t.body)throw n.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new p(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new p(`Attempted to iterate over a response with no body`);return new e($e(t.body),n)}},_a=class extends F{create(e,t){let{betas:n,user_profile_id:r,workspace_id:i,...a}=e;return this._client.post(`/v1/messages/batches?beta=true`,{body:a,...t,headers:I([{"anthropic-beta":[...n??[],`message-batches-2024-09-24`].toString(),...r==null?void 0:{"anthropic-user-profile-id":r},...i==null?void 0:{"anthropic-workspace-id":i}},t?.headers])})}retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/messages/batches/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`message-batches-2024-09-24`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/messages/batches?beta=true`,Rn,{query:i,...t,headers:I([{"anthropic-beta":[...n??[],`message-batches-2024-09-24`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}delete(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.delete(L`/v1/messages/batches/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`message-batches-2024-09-24`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}cancel(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`message-batches-2024-09-24`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}async results(e,t={},n){let r=await this.retrieve(e,t,n);if(!r.results_url)throw new p(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);let{betas:i,workspace_id:a}=t??{};return this._client.get(r.results_url,{...n,headers:I([{"anthropic-beta":[...i??[],`message-batches-2024-09-24`].toString(),Accept:`application/binary`,...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((e,t)=>ga.fromResponse(t.response,t.controller))}},va={"claude-opus-4@20250514":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};function ya(e){return e?.output_format??e?.output_config?.format}function ba(e,t,n){let r=ya(t);return!t||!(`parse`in(r??{}))?{...e,content:e.content.map(e=>{if(e.type===`text`){let t=Object.defineProperty({...e},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(t,"parsed",{get(){return n.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return e}),parsed_output:null}:xa(e,t,n)}function xa(e,t,n){let r=null,i=e.content.map(e=>{if(e.type===`text`){let i=Sa(t,e.text);r===null&&(r=i);let a=Object.defineProperty({...e},"parsed_output",{value:i,enumerable:!1});return Object.defineProperty(a,"parsed",{get(){return n.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),i},enumerable:!1})}return e});return{...e,content:i,parsed_output:r}}function Sa(e,t){let n=ya(e);if(n?.type!==`json_schema`)return null;try{return`parse`in n?n.parse(t):JSON.parse(t)}catch(e){throw new p(`Failed to parse structured output: ${e}`)}}var Ca=e=>{let t=0,n=[];for(;t<e.length;){let r=e[t];if(r===`\\`){t++;continue}if(r===`{`){n.push({type:`brace`,value:`{`}),t++;continue}if(r===`}`){n.push({type:`brace`,value:`}`}),t++;continue}if(r===`[`){n.push({type:`paren`,value:`[`}),t++;continue}if(r===`]`){n.push({type:`paren`,value:`]`}),t++;continue}if(r===`:`){n.push({type:`separator`,value:`:`}),t++;continue}if(r===`,`){n.push({type:`delimiter`,value:`,`}),t++;continue}if(r===`"`){let i=``,a=!1;for(r=e[++t];r!==`"`;){if(t===e.length){a=!0;break}if(r===`\\`){if(t++,t===e.length){a=!0;break}i+=r+e[t],r=e[++t]}else i+=r,r=e[++t]}r=e[++t],a||n.push({type:`string`,value:i});continue}if(r&&/\s/.test(r)){t++;continue}let i=/[0-9]/;if(r&&i.test(r)||r===`-`||r===`.`){let a=``;for(r===`-`&&(a+=r,r=e[++t]);r&&(i.test(r)||r===`.`||r===`e`||r===`E`||(r===`-`||r===`+`)&&(a[a.length-1]===`e`||a[a.length-1]===`E`));)a+=r,r=e[++t];n.push({type:`number`,value:a});continue}let a=/[a-z]/i;if(r&&a.test(r)){let i=``;for(;r&&a.test(r)&&t!==e.length;)i+=r,r=e[++t];if(i==`true`||i==`false`||i===`null`)n.push({type:`name`,value:i});else{t++;continue}continue}t++}return n},wa=e=>{if(e.length===0)return e;let t=e[e.length-1];switch(t.type){case`separator`:return e=e.slice(0,e.length-1),wa(e);case`number`:let n=t.value[t.value.length-1];if(n===`.`||n===`-`||n===`+`||n===`e`||n===`E`)return e=e.slice(0,e.length-1),wa(e);case`string`:let r=e[e.length-2];if(r?.type===`delimiter`||r?.type===`brace`&&r.value===`{`)return e=e.slice(0,e.length-1),wa(e);break;case`delimiter`:return e=e.slice(0,e.length-1),wa(e)}return e},Ta=e=>{let t=[];return e.map(e=>{e.type===`brace`&&(e.value===`{`?t.push(`}`):t.splice(t.lastIndexOf(`}`),1)),e.type===`paren`&&(e.value===`[`?t.push(`]`):t.splice(t.lastIndexOf(`]`),1))}),t.length>0&&t.reverse().map(t=>{t===`}`?e.push({type:`brace`,value:`}`}):t===`]`&&e.push({type:`paren`,value:`]`})}),e},Ea=e=>{let t=``;return e.map(e=>{switch(e.type){case`string`:t+=`"`+e.value+`"`;break;default:t+=e.value}}),t},Da=e=>JSON.parse(Ea(Ta(wa(Ca(e))))),Oa=`__json_buf`;function ka(e,t){let n={};for(let t of Object.keys(e))t!==`input`&&(n[t]=e[t]);Object.defineProperty(n,Oa,{value:t,enumerable:!1,writable:!0});let r,i=!1;return Object.defineProperty(n,"input",{enumerable:!0,configurable:!0,get(){return i||=(r=t?Da(t):{},!0),r}}),n}var G,Aa,ja,Ma,Na,Pa,Fa,Ia,La,K,Ra,za,Ba,Va,Ha,Ua,Wa,Ga,Ka,qa,Ja,Ya,Xa,Za,Qa,$a;function eo(e){return e.type===`tool_use`||e.type===`server_tool_use`||e.type===`mcp_tool_use`}var to=class e{constructor(e,t){G.add(this),this.messages=[],this.receivedMessages=[],Aa.set(this,void 0),ja.set(this,null),this.controller=new AbortController,Ma.set(this,void 0),Na.set(this,()=>{}),Pa.set(this,()=>{}),Fa.set(this,void 0),Ia.set(this,()=>{}),La.set(this,()=>{}),K.set(this,{}),Ra.set(this,!1),za.set(this,!1),Ba.set(this,!1),Va.set(this,!1),Ha.set(this,void 0),Ua.set(this,void 0),Wa.set(this,void 0),Ga.set(this,void 0),Ja.set(this,e=>{if(C(this,za,!0,`f`),_(e)&&(e=new y),e instanceof y)return C(this,Ba,!0,`f`),this._emit(`abort`,e);if(e instanceof p)return this._emit(`error`,e);if(e instanceof Error){let t=new p(e.message);return t.cause=e,this._emit(`error`,t)}return this._emit(`error`,new p(String(e)))}),C(this,Ma,new Promise((e,t)=>{C(this,Na,e,`f`),C(this,Pa,t,`f`)}),`f`),C(this,Fa,new Promise((e,t)=>{C(this,Ia,e,`f`),C(this,La,t,`f`)}),`f`),w(this,Ma,`f`).catch(()=>{}),w(this,Fa,`f`).catch(()=>{}),C(this,ja,e,`f`),C(this,Ga,t?.logger??console,`f`)}get response(){return w(this,Ha,`f`)}get request_id(){return w(this,Ua,`f`)}get workspace_id(){return w(this,Wa,`f`)}async withResponse(){C(this,Va,!0,`f`);let e=await w(this,Ma,`f`);if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get(`request-id`),workspace_id:e.headers.get(`anthropic-workspace-id`)}}static fromReadableStream(t){let n=new e(null);return n._run(()=>n._fromReadableStream(t)),n}static createMessage(t,n,r,{logger:i}={}){let a=new e(n,{logger:i});for(let e of n.messages)a._addMessageParam(e);return C(a,ja,{...n,stream:!0},`f`),a._run(()=>a._createMessage(t,{...n,stream:!0},{...r,headers:{...r?.headers,[fr]:`stream`}})),a}_run(e){e().then(()=>{this._emitFinal(),this._emit(`end`)},w(this,Ja,`f`))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit(`message`,e)}async _createMessage(e,t,n){let r=n?.signal,i;r&&(r.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),r.addEventListener(`abort`,i));try{w(this,G,`m`,Ya).call(this);let{response:r,data:i}=await e.create({...t,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(r);for await(let e of i)w(this,G,`m`,Xa).call(this,e);if(i.controller.signal?.aborted)throw new y;w(this,G,`m`,Za).call(this)}finally{r&&i&&r.removeEventListener(`abort`,i)}}_connected(e){this.ended||(C(this,Ha,e,`f`),C(this,Ua,e?.headers.get(`request-id`),`f`),C(this,Wa,e?.headers.get(`anthropic-workspace-id`),`f`),w(this,Na,`f`).call(this,e),this._emit(`connect`))}get ended(){return w(this,Ra,`f`)}get errored(){return w(this,za,`f`)}get aborted(){return w(this,Ba,`f`)}abort(){this.controller.abort()}on(e,t){return(w(this,K,`f`)[e]||(w(this,K,`f`)[e]=[])).push({listener:t}),this}off(e,t){let n=w(this,K,`f`)[e];if(!n)return this;let r=n.findIndex(e=>e.listener===t);return r>=0&&n.splice(r,1),this}once(e,t){return(w(this,K,`f`)[e]||(w(this,K,`f`)[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{C(this,Va,!0,`f`),e!==`error`&&this.once(`error`,n),this.once(e,t)})}async done(){C(this,Va,!0,`f`),await w(this,Fa,`f`)}get currentMessage(){return w(this,Aa,`f`)}async finalMessage(){return await this.done(),w(this,G,`m`,Ka).call(this)}async finalText(){return await this.done(),w(this,G,`m`,qa).call(this)}_emit(e,...t){if(w(this,Ra,`f`))return;e===`end`&&(C(this,Ra,!0,`f`),w(this,Ia,`f`).call(this));let n=w(this,K,`f`)[e];if(n&&(w(this,K,`f`)[e]=n.filter(e=>!e.once),n.forEach(({listener:e})=>e(...t))),e===`abort`){let e=t[0];!w(this,Va,`f`)&&!n?.length&&Promise.reject(e),w(this,Pa,`f`).call(this,e),w(this,La,`f`).call(this,e),this._emit(`end`);return}if(e===`error`){let e=t[0];!w(this,Va,`f`)&&!n?.length&&Promise.reject(e),w(this,Pa,`f`).call(this,e),w(this,La,`f`).call(this,e),this._emit(`end`)}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit(`finalMessage`,w(this,G,`m`,Ka).call(this))}async _fromReadableStream(e,t){let n=t?.signal,r;n&&(n.aborted&&this.controller.abort(),r=this.controller.abort.bind(this.controller),n.addEventListener(`abort`,r));try{w(this,G,`m`,Ya).call(this),this._connected(null);let t=yn.fromReadableStream(e,this.controller);for await(let e of t)w(this,G,`m`,Xa).call(this,e);if(t.controller.signal?.aborted)throw new y;w(this,G,`m`,Za).call(this)}finally{n&&r&&n.removeEventListener(`abort`,r)}}[(Aa=new WeakMap,ja=new WeakMap,Ma=new WeakMap,Na=new WeakMap,Pa=new WeakMap,Fa=new WeakMap,Ia=new WeakMap,La=new WeakMap,K=new WeakMap,Ra=new WeakMap,za=new WeakMap,Ba=new WeakMap,Va=new WeakMap,Ha=new WeakMap,Ua=new WeakMap,Wa=new WeakMap,Ga=new WeakMap,Ja=new WeakMap,G=new WeakSet,Ka=function(){if(this.receivedMessages.length===0)throw new p(`stream ended without producing a Message with role=assistant`);return this.receivedMessages.at(-1)},qa=function(){if(this.receivedMessages.length===0)throw new p(`stream ended without producing a Message with role=assistant`);let e=this.receivedMessages.at(-1).content.filter(e=>e.type===`text`).map(e=>e.text);if(e.length===0)throw new p(`stream ended without producing a content block with type=text`);return e.join(` `)},Ya=function(){this.ended||C(this,Aa,void 0,`f`)},Xa=function(e){if(this.ended)return;let t=w(this,G,`m`,Qa).call(this,e);switch(this._emit(`streamEvent`,e,t),e.type){case`content_block_delta`:{let n=t.content.at(-1);switch(e.delta.type){case`text_delta`:n.type===`text`&&this._emit(`text`,e.delta.text,n.text||``);break;case`citations_delta`:n.type===`text`&&this._emit(`citation`,e.delta.citation,n.citations??[]);break;case`input_json_delta`:if(eo(n)&&w(this,K,`f`).inputJson?.length){let t;try{t=n.input}catch(e){w(this,Ja,`f`).call(this,w(this,G,`m`,$a).call(this,n,e));break}this._emit(`inputJson`,e.delta.partial_json,t)}break;case`thinking_delta`:n.type===`thinking`&&this._emit(`thinking`,e.delta.thinking,n.thinking);break;case`signature_delta`:n.type===`thinking`&&this._emit(`signature`,n.signature);break;case`compaction_delta`:n.type===`compaction`&&n.content&&this._emit(`compaction`,n.content);break;default:e.delta}break}case`message_stop`:this._addMessageParam(t),this._addMessage(ba(t,w(this,ja,`f`),{logger:w(this,Ga,`f`)}),!0);break;case`content_block_stop`:this._emit(`contentBlock`,t.content.at(-1));break;case`message_start`:C(this,Aa,t,`f`)}},Za=function(){if(this.ended)throw new p(`stream has ended, this shouldn't happen`);let e=w(this,Aa,`f`);if(!e)throw new p(`request ended without sending any chunks`);return C(this,Aa,void 0,`f`),ba(e,w(this,ja,`f`),{logger:w(this,Ga,`f`)})},Qa=function(e){let t=w(this,Aa,`f`);if(e.type===`message_start`){if(t)throw new p(`Unexpected event order, got ${e.type} before receiving "message_stop"`);return e.message}if(!t)throw new p(`Unexpected event order, got ${e.type} before "message_start"`);switch(e.type){case`message_stop`:return t;case`message_delta`:return t.stop_reason=e.delta.stop_reason,t.stop_sequence=e.delta.stop_sequence,t.stop_details=e.delta.stop_details,t.usage.output_tokens=e.usage.output_tokens,e.delta.container!=null&&(t.container=e.delta.container),e.context_management!=null&&(t.context_management=e.context_management),e.input_transformations!=null&&(t.input_transformations=e.input_transformations),e.usage.input_tokens!=null&&(t.usage.input_tokens=e.usage.input_tokens),e.usage.cache_creation_input_tokens!=null&&(t.usage.cache_creation_input_tokens=e.usage.cache_creation_input_tokens),e.usage.cache_read_input_tokens!=null&&(t.usage.cache_read_input_tokens=e.usage.cache_read_input_tokens),e.usage.server_tool_use!=null&&(t.usage.server_tool_use=e.usage.server_tool_use),e.usage.iterations!=null&&(t.usage.iterations=e.usage.iterations),e.usage.fallback_credit!=null&&(t.usage.fallback_credit=e.usage.fallback_credit),e.usage.output_tokens_details!=null&&(t.usage.output_tokens_details=e.usage.output_tokens_details),t;case`content_block_start`:return t.content.push(e.content_block),e.content_block.type===`fallback`&&(t.model=e.content_block.to.model),t;case`content_block_delta`:{let n=t.content.at(e.index);switch(e.delta.type){case`text_delta`:n?.type===`text`&&(t.content[e.index]={...n,text:(n.text||``)+e.delta.text});break;case`citations_delta`:n?.type===`text`&&(t.content[e.index]={...n,citations:[...n.citations??[],e.delta.citation]});break;case`input_json_delta`:if(n&&eo(n)){let r=(n.__json_buf||``)+e.delta.partial_json;t.content[e.index]=ka(n,r)}break;case`thinking_delta`:n?.type===`thinking`&&(t.content[e.index]={...n,thinking:n.thinking+e.delta.thinking});break;case`signature_delta`:n?.type===`thinking`&&(t.content[e.index]={...n,signature:e.delta.signature});break;case`compaction_delta`:n?.type===`compaction`&&(t.content[e.index]={...n,content:(n.content||``)+e.delta.content,encrypted_content:e.delta.encrypted_content});break;default:e.delta}return t}case`content_block_stop`:{let n=t.content.at(e.index);if(n&&eo(n)&&`__json_buf`in n){let e;try{e=n.input}catch(t){e={},w(this,Ja,`f`).call(this,w(this,G,`m`,$a).call(this,n,t))}Object.defineProperty(n,"input",{value:e,enumerable:!0,configurable:!0,writable:!0})}return t}}},$a=function(e,t){let n=e[Oa];return new p(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${t}. JSON: ${n}`)},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on(`streamEvent`,n=>{let r=t.shift();r?r.resolve(n):e.push(n)}),this.on(`end`,()=>{n=!0;for(let e of t)e.resolve(void 0);t.length=0}),this.on(`abort`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),this.on(`error`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((e,n)=>t.push({resolve:e,reject:n})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new yn(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function no(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var ro=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
|
|
8
|
+
1. Task Overview
|
|
9
|
+
The user's core request and success criteria
|
|
10
|
+
Any clarifications or constraints they specified
|
|
11
|
+
2. Current State
|
|
12
|
+
What has been completed so far
|
|
13
|
+
Files created, modified, or analyzed (with paths if relevant)
|
|
14
|
+
Key outputs or artifacts produced
|
|
15
|
+
3. Important Discoveries
|
|
16
|
+
Technical constraints or requirements uncovered
|
|
17
|
+
Decisions made and their rationale
|
|
18
|
+
Errors encountered and how they were resolved
|
|
19
|
+
What approaches were tried that didn't work (and why)
|
|
20
|
+
4. Next Steps
|
|
21
|
+
Specific actions needed to complete the task
|
|
22
|
+
Any blockers or open questions to resolve
|
|
23
|
+
Priority order if multiple steps remain
|
|
24
|
+
5. Context to Preserve
|
|
25
|
+
User preferences or style requirements
|
|
26
|
+
Domain-specific details that aren't obvious
|
|
27
|
+
Any promises made to the user
|
|
28
|
+
Be concise but complete—err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
|
|
29
|
+
Wrap your summary in <summary></summary> tags.`,io,ao,oo,q,J,Y,so,co,lo,uo,fo,po=class{constructor(e,t,n){io.add(this),this.client=e,ao.set(this,!1),oo.set(this,!1),q.set(this,void 0),J.set(this,void 0),Y.set(this,void 0),so.set(this,void 0),co.set(this,void 0),lo.set(this,0),C(this,q,{params:{...t,messages:structuredClone(t.messages)}},`f`);let r=gr(t.tools,t.messages);C(this,J,{...n,headers:I([pr(`BetaToolRunner`),r.length?{[dr]:r.join(`, `)}:void 0,n?.headers])},`f`),C(this,co,no(),`f`),t.compactionControl?.enabled&&console.warn('Anthropic: The `compactionControl` parameter is deprecated and will be removed in a future version. Use server-side compaction instead by passing `edits: [{ type: "compact_20260112" }]` in the params passed to `toolRunner()`. See https://platform.claude.com/docs/en/build-with-claude/compaction')}async*[(ao=new WeakMap,oo=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakMap,so=new WeakMap,co=new WeakMap,lo=new WeakMap,io=new WeakSet,uo=async function(){let e=w(this,q,`f`).params.compactionControl;if(!e||!e.enabled)return!1;let t=0;if(w(this,Y,`f`)!==void 0)try{let e=await w(this,Y,`f`);t=e.usage.input_tokens+(e.usage.cache_creation_input_tokens??0)+(e.usage.cache_read_input_tokens??0)+e.usage.output_tokens}catch{return!1}let n=e.contextTokenThreshold??1e5;if(t<n)return!1;let r=e.model??w(this,q,`f`).params.model,i=e.summaryPrompt??ro,a=w(this,q,`f`).params.messages;if(a[a.length-1].role===`assistant`){let e=a[a.length-1];if(Array.isArray(e.content)){let t=e.content.filter(e=>e.type!==`tool_use`);t.length===0?a.pop():e.content=t}}let o=await this.client.beta.messages.create({model:r,messages:[...a,{role:`user`,content:[{type:`text`,text:i}]}],max_tokens:w(this,q,`f`).params.max_tokens},{signal:w(this,J,`f`).signal,headers:I([w(this,J,`f`).headers,pr(`compaction`)])});if(o.content[0]?.type!==`text`)throw new p(`Expected text response for compaction`);return w(this,q,`f`).params.messages=[{role:`user`,content:o.content}],!0},Symbol.asyncIterator)](){var e;if(w(this,ao,`f`))throw new p(`Cannot iterate over a consumed stream`);C(this,ao,!0,`f`),C(this,oo,!0,`f`),C(this,so,void 0,`f`);try{for(;;){let t;try{if(w(this,q,`f`).params.max_iterations&&w(this,lo,`f`)>=w(this,q,`f`).params.max_iterations)break;C(this,oo,!1,`f`),C(this,so,void 0,`f`),C(this,lo,(e=w(this,lo,`f`),e++,e),`f`),C(this,Y,void 0,`f`);let{max_iterations:n,compactionControl:r,...i}=w(this,q,`f`).params;if(i.stream?(t=this.client.beta.messages.stream({...i},w(this,J,`f`)),C(this,Y,t.finalMessage(),`f`),w(this,Y,`f`).catch(()=>{}),yield t):(C(this,Y,this.client.beta.messages.create({...i,stream:!1},w(this,J,`f`)),`f`),yield w(this,Y,`f`)),!await w(this,io,`m`,uo).call(this)){if(!w(this,oo,`f`)){let e=await w(this,Y,`f`),t=bo(e.stop_reason);w(this,q,`f`).params.messages.push({role:e.role,content:e.content});let{container:n}=w(this,q,`f`).params;if(e.container&&(n==null?w(this,q,`f`).params.container=e.container.id:typeof n==`object`&&n.id==null&&(w(this,q,`f`).params.container={...n,id:e.container.id})),t===`stop`)break;if(t===`resume`)continue}let e=await w(this,io,`m`,fo).call(this,w(this,q,`f`).params.messages.at(-1));if(e)w(this,q,`f`).params.messages.push(e);else if(!w(this,oo,`f`))break}}finally{t&&t.abort()}}if(!w(this,Y,`f`))throw new p(`ToolRunner concluded without a message from the server`);w(this,co,`f`).resolve(await w(this,Y,`f`))}catch(e){throw C(this,ao,!1,`f`),w(this,co,`f`).promise.catch(()=>{}),w(this,co,`f`).reject(e),C(this,co,no(),`f`),e}}setMessagesParams(e){typeof e==`function`?w(this,q,`f`).params=e(w(this,q,`f`).params):w(this,q,`f`).params=e,C(this,oo,!0,`f`),C(this,so,void 0,`f`)}setRequestOptions(e){typeof e==`function`?C(this,J,e(w(this,J,`f`)),`f`):C(this,J,{...w(this,J,`f`),...e},`f`)}async generateToolResponse(e=w(this,J,`f`).signal){let t=await w(this,Y,`f`)??this.params.messages.at(-1);return t?w(this,io,`m`,fo).call(this,t,e):null}done(){return w(this,co,`f`).promise}async runUntilDone(){if(!w(this,ao,`f`))for await(let e of this);return this.done()}get params(){return w(this,q,`f`).params}pushMessages(...e){this.setMessagesParams(t=>({...t,messages:[...t.messages,...e]}))}then(e,t){return this.runUntilDone().then(e,t)}};fo=async function(e,t=w(this,J,`f`).signal){return w(this,so,`f`)===void 0&&C(this,so,mo(w(this,q,`f`).params,e,{...w(this,J,`f`),signal:t}),`f`),w(this,so,`f`)};async function mo(e,t=e.messages.at(-1),n){if(!t||t.role!==`assistant`||!t.content||typeof t.content==`string`)return null;let r=t.content.filter(e=>e.type===`tool_use`);if(r.length===0)return null;let i=go(e);return{role:`user`,content:await Promise.all(r.map(async t=>{let r=e.tools.find(e=>(`name`in e?e.name:`mcp_server_name`in e?e.mcp_server_name:e.type)===t.name);if(!r||!(`run`in r)||!i.has(t.name))return ho(t);try{let e=t.input;`parse`in r&&r.parse&&(e=r.parse(e));let i=await r.run(e,{toolUse:t,toolUseBlock:t,signal:n?.signal});return{type:`tool_result`,tool_use_id:t.id,content:i}}catch(e){return{type:`tool_result`,tool_use_id:t.id,content:e instanceof oi?e.content:`Error: ${e instanceof Error?e.message:String(e)}`,is_error:!0}}}))}}function ho(e){return{type:`tool_result`,tool_use_id:e.id,content:`Error: Tool '${e.name}' not found`,is_error:!0}}function go(e){let t=new Set;for(let n of e.tools)`run`in n&&t.add(n.name);for(let n of e.messages)if(n.role===`system`&&typeof n.content!=`string`)for(let e of n.content)_o(e,t);return t}function _o(e,t){switch(e.type){case`tool_removal`:case`tool_addition`:vo(e,t)}}function vo(e,t){let n=yo(e.tool);n!==void 0&&(e.type===`tool_removal`?t.delete(n):t.add(n))}function yo(e){switch(e.type){case`tool_reference`:return e.name;default:return}}function bo(e){if(e===null)return`stop`;switch(e){case`tool_use`:return`run_tools`;case`pause_turn`:case`compaction`:return`resume`;case`end_turn`:case`stop_sequence`:case`max_tokens`:case`model_context_window_exceeded`:case`refusal`:return`stop`;default:return`stop`}}var xo={},So=[`claude-mythos-preview`,`claude-opus-4-6`],Co=class extends F{constructor(){super(...arguments),this.batches=new _a(this._client)}create(e,t){let n=wo(e),{betas:r,user_profile_id:i,workspace_id:a,...o}=n;o.model in xo&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${xo[o.model]}\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),So.includes(o.model)&&o.thinking&&o.thinking.type===`enabled`&&console.warn(`Using Claude with ${o.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let s=t?.timeout??this._client._options.timeout;if(!o.stream&&s==null){let e=va[o.model]??void 0;s=this._client.calculateNonstreamingTimeout(o.max_tokens,e)}let c=_r(o.tools,o.messages);return this._client.post(`/v1/messages?beta=true`,{body:o,timeout:s??6e5,...t,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()},...i==null?void 0:{"anthropic-user-profile-id":i},...a==null?void 0:{"anthropic-workspace-id":a}},c,t?.headers]),stream:n.stream??!1})}parse(e,t){return t={...t,headers:I([{"anthropic-beta":[...e.betas??[],`structured-outputs-2025-12-15`].toString()},t?.headers])},this.create(e,t).then(t=>xa(t,e,{logger:this._client.logger??console}))}stream(e,t){return to.createMessage(this,e,t)}countTokens(e,t){let{betas:n,user_profile_id:r,workspace_id:i,...a}=wo(e);return this._client.post(`/v1/messages/count_tokens?beta=true`,{body:a,...t,headers:I([{"anthropic-beta":[...n??[],`token-counting-2024-11-01`].toString(),...r==null?void 0:{"anthropic-user-profile-id":r},...i==null?void 0:{"anthropic-workspace-id":i}},t?.headers])})}toolRunner(e,t){return new po(this._client,e,t)}};function wo(e){if(!e.output_format)return e;if(e.output_config?.format)throw new p(`Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).`);let{output_format:t,...n}=e;return{...n,output_config:{...e.output_config,format:t}}}Co.Batches=_a,Co.BetaToolRunner=po,Co.ToolError=oi;var To=class extends F{retrieve(e,t){return this._client.get(L`/v1/organizations/api_keys/${e}?beta=true`,t)}update(e,t,n){return this._client.post(L`/v1/organizations/api_keys/${e}?beta=true`,{body:t,...n})}list(e={},t){return this._client.getAPIList(`/v1/organizations/api_keys?beta=true`,Rn,{query:e,...t})}},Eo=class extends F{retrieve(e){return this._client.get(`/v1/organizations/compliance_settings?beta=true`,e)}update(e,t){return this._client.post(`/v1/organizations/compliance_settings?beta=true`,{body:e,...t})}},Do=class extends F{create(e,t){return this._client.post(`/v1/organizations/external_keys?beta=true`,{body:e,...t})}retrieve(e,t){return this._client.get(L`/v1/organizations/external_keys/${e}?beta=true`,t)}update(e,t,n){return this._client.post(L`/v1/organizations/external_keys/${e}?beta=true`,{body:t,...n})}list(e={},t){return this._client.getAPIList(`/v1/organizations/external_keys?beta=true`,P,{query:e,...t})}delete(e,t){return this._client.delete(L`/v1/organizations/external_keys/${e}?beta=true`,t)}validate(e,t){return this._client.post(L`/v1/organizations/external_keys/${e}/validate?beta=true`,t)}},Oo=class extends F{create(e,t){return this._client.post(`/v1/organizations/invites?beta=true`,{body:e,...t})}retrieve(e,t){return this._client.get(L`/v1/organizations/invites/${e}?beta=true`,t)}list(e={},t){return this._client.getAPIList(`/v1/organizations/invites?beta=true`,Rn,{query:e,...t})}delete(e,t){return this._client.delete(L`/v1/organizations/invites/${e}?beta=true`,t)}},ko=class extends F{list(e={},t){return this._client.getAPIList(`/v1/organizations/rate_limits?beta=true`,P,{query:e,...t})}},Ao=class extends F{retrieve(e,t){return this._client.get(L`/v1/organizations/users/${e}?beta=true`,t)}update(e,t,n){return this._client.post(L`/v1/organizations/users/${e}?beta=true`,{body:t,...n})}list(e={},t){return this._client.getAPIList(`/v1/organizations/users?beta=true`,Rn,{query:e,...t})}remove(e,t){return this._client.delete(L`/v1/organizations/users/${e}?beta=true`,t)}},jo=class extends F{create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/organizations/federation_issuers?beta=true`,{body:r,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(L`/v1/organizations/federation_issuers/${e}?beta=true`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}update(e,t,n){let{betas:r,...i}=t;return this._client.post(L`/v1/organizations/federation_issuers/${e}?beta=true`,{body:i,...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/organizations/federation_issuers?beta=true`,P,{query:r,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(L`/v1/organizations/federation_issuers/${e}/archive?beta=true`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}},Mo=class extends F{list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(L`/v1/organizations/federation_rules/${e}/workspaces?beta=true`,P,{query:i,...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}add(e,t,n){let{betas:r,...i}=t;return this._client.post(L`/v1/organizations/federation_rules/${e}/workspaces?beta=true`,{body:i,...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}remove(e,t,n){let{federation_rule_id:r,betas:i}=t;return this._client.delete(L`/v1/organizations/federation_rules/${r}/workspaces/${e}?beta=true`,{...n,headers:I([{...i?.toString()==null?void 0:{"anthropic-beta":i?.toString()}},n?.headers])})}},No=class extends F{constructor(){super(...arguments),this.workspaces=new Mo(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/organizations/federation_rules?beta=true`,{body:r,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(L`/v1/organizations/federation_rules/${e}?beta=true`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}update(e,t,n){let{betas:r,...i}=t;return this._client.post(L`/v1/organizations/federation_rules/${e}?beta=true`,{body:i,...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/organizations/federation_rules?beta=true`,P,{query:r,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(L`/v1/organizations/federation_rules/${e}/archive?beta=true`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}};No.Workspaces=Mo;var Po=class extends F{constructor(){super(...arguments),this.issuers=new jo(this._client),this.rules=new No(this._client)}};Po.Issuers=jo,Po.Rules=No;var Fo=class extends F{list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(L`/v1/organizations/service_accounts/${e}/workspaces?beta=true`,P,{query:i,...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}add(e,t,n){let{betas:r,...i}=t;return this._client.post(L`/v1/organizations/service_accounts/${e}/workspaces?beta=true`,{body:i,...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}remove(e,t,n){let{service_account_id:r,betas:i}=t;return this._client.delete(L`/v1/organizations/service_accounts/${r}/workspaces/${e}?beta=true`,{...n,headers:I([{...i?.toString()==null?void 0:{"anthropic-beta":i?.toString()}},n?.headers])})}},Io=class extends F{constructor(){super(...arguments),this.workspaces=new Fo(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/organizations/service_accounts?beta=true`,{body:r,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers])})}retrieve(e,t={},n){let{betas:r}=t??{};return this._client.get(L`/v1/organizations/service_accounts/${e}?beta=true`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}update(e,t,n){let{betas:r,...i}=t;return this._client.post(L`/v1/organizations/service_accounts/${e}?beta=true`,{body:i,...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}list(e={},t){let{betas:n,...r}=e??{};return this._client.getAPIList(`/v1/organizations/service_accounts?beta=true`,P,{query:r,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers])})}archive(e,t={},n){let{betas:r}=t??{};return this._client.post(L`/v1/organizations/service_accounts/${e}/archive?beta=true`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}};Io.Workspaces=Fo;var Lo=class extends F{retrieve(e,t,n){let{workspace_id:r}=t;return this._client.get(L`/v1/organizations/workspaces/${r}/members/${e}?beta=true`,n)}update(e,t,n){let{workspace_id:r,...i}=t;return this._client.post(L`/v1/organizations/workspaces/${r}/members/${e}?beta=true`,{body:i,...n})}list(e,t={},n){return this._client.getAPIList(L`/v1/organizations/workspaces/${e}/members?beta=true`,Rn,{query:t,...n})}add(e,t,n){return this._client.post(L`/v1/organizations/workspaces/${e}/members?beta=true`,{body:t,...n})}remove(e,t,n){let{workspace_id:r}=t;return this._client.delete(L`/v1/organizations/workspaces/${r}/members/${e}?beta=true`,n)}},Ro=class extends F{list(e,t={},n){return this._client.getAPIList(L`/v1/organizations/workspaces/${e}/rate_limits?beta=true`,P,{query:t,...n})}},zo=class extends F{retrieve(e,t,n){let{workspace_id:r,betas:i}=t;return this._client.get(L`/v1/organizations/workspaces/${r}/service_accounts/${e}?beta=true`,{...n,headers:I([{...i?.toString()==null?void 0:{"anthropic-beta":i?.toString()}},n?.headers])})}update(e,t,n){let{workspace_id:r,betas:i,...a}=t;return this._client.post(L`/v1/organizations/workspaces/${r}/service_accounts/${e}?beta=true`,{body:a,...n,headers:I([{...i?.toString()==null?void 0:{"anthropic-beta":i?.toString()}},n?.headers])})}list(e,t={},n){let{betas:r,...i}=t??{};return this._client.getAPIList(L`/v1/organizations/workspaces/${e}/service_accounts?beta=true`,P,{query:i,...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}add(e,t,n){let{betas:r,...i}=t;return this._client.post(L`/v1/organizations/workspaces/${e}/service_accounts?beta=true`,{body:i,...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()}},n?.headers])})}remove(e,t,n){let{workspace_id:r,betas:i}=t;return this._client.delete(L`/v1/organizations/workspaces/${r}/service_accounts/${e}?beta=true`,{...n,headers:I([{...i?.toString()==null?void 0:{"anthropic-beta":i?.toString()}},n?.headers])})}},Bo=class extends F{constructor(){super(...arguments),this.rateLimits=new Ro(this._client),this.members=new Lo(this._client),this.serviceAccounts=new zo(this._client)}create(e,t){let{betas:n,...r}=e;return this._client.post(`/v1/organizations/workspaces?beta=true`,{body:r,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()}},t?.headers])})}retrieve(e,t){return this._client.get(L`/v1/organizations/workspaces/${e}?beta=true`,t)}update(e,t,n){return this._client.post(L`/v1/organizations/workspaces/${e}?beta=true`,{body:t,...n})}list(e={},t){return this._client.getAPIList(`/v1/organizations/workspaces?beta=true`,Rn,{query:e,...t})}archive(e,t){return this._client.post(L`/v1/organizations/workspaces/${e}/archive?beta=true`,t)}};Bo.RateLimits=Ro,Bo.Members=Lo,Bo.ServiceAccounts=zo;var X=class extends F{constructor(){super(...arguments),this.apiKeys=new To(this._client),this.externalKeys=new Do(this._client),this.federation=new Po(this._client),this.invites=new Oo(this._client),this.serviceAccounts=new Io(this._client),this.users=new Ao(this._client),this.workspaces=new Bo(this._client),this.rateLimits=new ko(this._client),this.complianceSettings=new Eo(this._client)}retrieve(e){return this._client.get(`/v1/organizations/me?beta=true`,e)}};X.APIKeys=To,X.ExternalKeys=Do,X.Federation=Po,X.Invites=Oo,X.ServiceAccounts=Io,X.Users=Ao,X.Workspaces=Bo,X.RateLimits=ko,X.ComplianceSettings=Eo;var Vo=class extends F{list(e,t={},n){let{betas:r,workspace_id:i,...a}=t??{};return this._client.getAPIList(L`/v1/sessions/${e}/events?beta=true`,P,{query:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}send(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/sessions/${e}/events?beta=true`,{body:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}stream(e,t={},n){let{betas:r,workspace_id:i,...a}=t??{};return this._client.get(L`/v1/sessions/${e}/events/stream?beta=true`,{query:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers]),stream:!0})}toolRunner(e,t){return new Ki(e,{...t,client:this._client})}};Vo.SessionToolRunner=Ki;var Ho=class extends F{retrieve(e,t,n){let{session_id:r,betas:i,workspace_id:a}=t;return this._client.get(L`/v1/sessions/${r}/resources/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}update(e,t,n){let{session_id:r,betas:i,workspace_id:a,...o}=t;return this._client.post(L`/v1/sessions/${r}/resources/${e}?beta=true`,{body:o,...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}list(e,t={},n){let{betas:r,workspace_id:i,...a}=t??{};return this._client.getAPIList(L`/v1/sessions/${e}/resources?beta=true`,P,{query:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}delete(e,t,n){let{session_id:r,betas:i,workspace_id:a}=t;return this._client.delete(L`/v1/sessions/${r}/resources/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}add(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/sessions/${e}/resources?beta=true`,{body:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}},Uo=class extends F{list(e,t,n){let{session_id:r,betas:i,workspace_id:a,...o}=t;return this._client.getAPIList(L`/v1/sessions/${r}/threads/${e}/events?beta=true`,P,{query:o,...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}stream(e,t,n){let{session_id:r,betas:i,workspace_id:a,...o}=t;return this._client.get(L`/v1/sessions/${r}/threads/${e}/stream?beta=true`,{query:o,...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers]),stream:!0})}},Wo=class extends F{constructor(){super(...arguments),this.events=new Uo(this._client)}retrieve(e,t,n){let{session_id:r,betas:i,workspace_id:a}=t;return this._client.get(L`/v1/sessions/${r}/threads/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}list(e,t={},n){let{betas:r,workspace_id:i,...a}=t??{};return this._client.getAPIList(L`/v1/sessions/${e}/threads?beta=true`,P,{query:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}archive(e,t,n){let{session_id:r,betas:i,workspace_id:a}=t;return this._client.post(L`/v1/sessions/${r}/threads/${e}/archive?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}};Wo.Events=Uo;var Go=class extends F{constructor(){super(...arguments),this.events=new Vo(this._client),this.resources=new Ho(this._client),this.threads=new Wo(this._client)}create(e,t){let{betas:n,workspace_id:r,...i}=e;return this._client.post(`/v1/sessions?beta=true`,{body:i,...t,headers:I([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/sessions/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}update(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/sessions/${e}?beta=true`,{body:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/sessions?beta=true`,zn,{query:i,...t,headers:I([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}delete(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.delete(L`/v1/sessions/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}archive(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/sessions/${e}/archive?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}};Go.Events=Vo,Go.Resources=Ho,Go.Threads=Wo;var Ko=class extends F{create(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/skills/${e}/versions?beta=true`,Wn({body:a,...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()},...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])},this._client,!1))}retrieve(e,t,n){let{skill_id:r,betas:i,workspace_id:a}=t;return this._client.get(L`/v1/skills/${r}/versions/${e}?beta=true`,{...n,headers:I([{...i?.toString()==null?void 0:{"anthropic-beta":i?.toString()},...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}list(e,t={},n){let{betas:r,workspace_id:i,...a}=t??{};return this._client.getAPIList(L`/v1/skills/${e}/versions?beta=true`,P,{query:a,...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()},...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}delete(e,t,n){let{skill_id:r,betas:i,workspace_id:a}=t;return this._client.delete(L`/v1/skills/${r}/versions/${e}?beta=true`,{...n,headers:I([{...i?.toString()==null?void 0:{"anthropic-beta":i?.toString()},...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}download(e,t,n){let{skill_id:r,betas:i,workspace_id:a}=t;return this._client.get(L`/v1/skills/${r}/versions/${e}/content?beta=true`,{...n,headers:I([{Accept:`application/binary`,...i?.toString()==null?void 0:{"anthropic-beta":i?.toString()},...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers]),__binaryResponse:!0})}},qo=class extends F{constructor(){super(...arguments),this.versions=new Ko(this._client)}create(e,t){let{betas:n,workspace_id:r,...i}=e;return this._client.post(`/v1/skills?beta=true`,Wn({body:i,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()},...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])},this._client,!1))}retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/skills/${e}?beta=true`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()},...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/skills?beta=true`,P,{query:i,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()},...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}delete(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.delete(L`/v1/skills/${e}?beta=true`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()},...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}};qo.Versions=Ko;var Jo=class extends F{create(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/tunnels/${e}/certificates?beta=true`,{body:a,...n,headers:I([{"anthropic-beta":[...r??[],`mcp-tunnels-2026-06-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}retrieve(e,t,n){let{tunnel_id:r,betas:i,workspace_id:a}=t;return this._client.get(L`/v1/tunnels/${r}/certificates/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`mcp-tunnels-2026-06-22`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}list(e,t={},n){let{betas:r,workspace_id:i,...a}=t??{};return this._client.getAPIList(L`/v1/tunnels/${e}/certificates?beta=true`,P,{query:a,...n,headers:I([{"anthropic-beta":[...r??[],`mcp-tunnels-2026-06-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}archive(e,t,n){let{tunnel_id:r,betas:i,workspace_id:a}=t;return this._client.post(L`/v1/tunnels/${r}/certificates/${e}/archive?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`mcp-tunnels-2026-06-22`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}},Yo=class extends F{constructor(){super(...arguments),this.certificates=new Jo(this._client)}create(e,t){let{betas:n,workspace_id:r,...i}=e;return this._client.post(`/v1/tunnels?beta=true`,{body:i,...t,headers:I([{"anthropic-beta":[...n??[],`mcp-tunnels-2026-06-22`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/tunnels/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`mcp-tunnels-2026-06-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/tunnels?beta=true`,P,{query:i,...t,headers:I([{"anthropic-beta":[...n??[],`mcp-tunnels-2026-06-22`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}archive(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/tunnels/${e}/archive?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`mcp-tunnels-2026-06-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}revealToken(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/tunnels/${e}/reveal_token?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`mcp-tunnels-2026-06-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}rotateToken(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/tunnels/${e}/rotate_token?beta=true`,{body:a,...n,headers:I([{"anthropic-beta":[...r??[],`mcp-tunnels-2026-06-22`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}};Yo.Certificates=Jo;var Xo=class extends F{create(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/vaults/${e}/credentials?beta=true`,{body:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}retrieve(e,t,n){let{vault_id:r,betas:i,workspace_id:a}=t;return this._client.get(L`/v1/vaults/${r}/credentials/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}update(e,t,n){let{vault_id:r,betas:i,workspace_id:a,...o}=t;return this._client.post(L`/v1/vaults/${r}/credentials/${e}?beta=true`,{body:o,...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}list(e,t={},n){let{betas:r,workspace_id:i,...a}=t??{};return this._client.getAPIList(L`/v1/vaults/${e}/credentials?beta=true`,P,{query:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}delete(e,t,n){let{vault_id:r,betas:i,workspace_id:a}=t;return this._client.delete(L`/v1/vaults/${r}/credentials/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}archive(e,t,n){let{vault_id:r,betas:i,workspace_id:a}=t;return this._client.post(L`/v1/vaults/${r}/credentials/${e}/archive?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}mcpOAuthValidate(e,t,n){let{vault_id:r,betas:i,workspace_id:a}=t;return this._client.post(L`/v1/vaults/${r}/credentials/${e}/mcp_oauth_validate?beta=true`,{...n,headers:I([{"anthropic-beta":[...i??[],`managed-agents-2026-04-01`].toString(),...a==null?void 0:{"anthropic-workspace-id":a}},n?.headers])})}},Zo=class extends F{constructor(){super(...arguments),this.credentials=new Xo(this._client)}create(e,t){let{betas:n,workspace_id:r,...i}=e;return this._client.post(`/v1/vaults?beta=true`,{body:i,...t,headers:I([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/vaults/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}update(e,t,n){let{betas:r,workspace_id:i,...a}=t;return this._client.post(L`/v1/vaults/${e}?beta=true`,{body:a,...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/vaults?beta=true`,P,{query:i,...t,headers:I([{"anthropic-beta":[...n??[],`managed-agents-2026-04-01`].toString(),...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}delete(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.delete(L`/v1/vaults/${e}?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}archive(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.post(L`/v1/vaults/${e}/archive?beta=true`,{...n,headers:I([{"anthropic-beta":[...r??[],`managed-agents-2026-04-01`].toString(),...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}};Zo.Credentials=Xo;var Z=class extends F{constructor(){super(...arguments),this.models=new br(this._client),this.messages=new Co(this._client),this.agents=new Or(this._client),this.environments=new fa(this._client),this.sessions=new Go(this._client),this.deployments=new lr(this._client),this.deploymentRuns=new cr(this._client),this.vaults=new Zo(this._client),this.memoryStores=new ha(this._client),this.files=new yr(this._client),this.skills=new qo(this._client),this.webhooks=new Er(this._client),this.userProfiles=new xr(this._client),this.dreams=new ur(this._client),this.tunnels=new Yo(this._client),this.organization=new X(this._client)}};Z.Models=br,Z.Messages=Co,Z.Agents=Or,Z.Environments=fa,Z.Sessions=Go,Z.Deployments=lr,Z.DeploymentRuns=cr,Z.Vaults=Zo,Z.MemoryStores=ha,Z.Files=yr,Z.Skills=qo,Z.Webhooks=Er,Z.UserProfiles=xr,Z.Dreams=ur,Z.Tunnels=Yo,Z.Organization=X;var Qo=class extends F{create(e,t){let{betas:n,workspace_id:r,...i}=e;return this._client.post(`/v1/complete`,{body:i,timeout:this._client._options.timeout??6e5,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()},...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers]),stream:e.stream??!1})}},$o=class extends F{list(e={},t){let{workspace_id:n,...r}=e??{};return this._client.getAPIList(`/v1/files`,P,{query:r,...t,headers:I([{...n==null?void 0:{"anthropic-workspace-id":n}},t?.headers])})}delete(e,t={},n){let{workspace_id:r}=t??{};return this._client.delete(L`/v1/files/${e}`,{...n,headers:I([{...r==null?void 0:{"anthropic-workspace-id":r}},n?.headers])})}download(e,t={},n){let{workspace_id:r}=t??{};return this._client.get(L`/v1/files/${e}/content`,{...n,headers:I([{Accept:`application/binary`,...r==null?void 0:{"anthropic-workspace-id":r}},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},n){let{workspace_id:r}=t??{};return this._client.get(L`/v1/files/${e}`,{...n,headers:I([{...r==null?void 0:{"anthropic-workspace-id":r}},n?.headers])})}upload(e,t){let{workspace_id:n,...r}=e;return this._client.post(`/v1/files`,Wn({body:r,...t,headers:I([{...n==null?void 0:{"anthropic-workspace-id":n}},vr(r.file),t?.headers])},this._client))}};function es(e){return e?.output_config?.format}function ts(e,t,n){let r=es(t);return!t||!(`parse`in(r??{}))?{...e,content:e.content.map(e=>e.type===`text`?Object.defineProperty({...e},"parsed_output",{value:null,enumerable:!1}):e),parsed_output:null}:ns(e,t,n)}function ns(e,t,n){let r=null,i=e.content.map(e=>{if(e.type===`text`){let n=rs(t,e.text);return r===null&&(r=n),Object.defineProperty({...e},"parsed_output",{value:n,enumerable:!1})}return e});return{...e,content:i,parsed_output:r}}function rs(e,t){let n=es(e);if(n?.type!==`json_schema`)return null;try{return`parse`in n?n.parse(t):JSON.parse(t)}catch(e){throw new p(`Failed to parse structured output: ${e}`)}}var Q,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds;function Os(e){return e.type===`tool_use`||e.type===`server_tool_use`}var ks=class e{constructor(e,t){Q.add(this),this.messages=[],this.receivedMessages=[],is.set(this,void 0),as.set(this,null),this.controller=new AbortController,os.set(this,void 0),ss.set(this,()=>{}),cs.set(this,()=>{}),ls.set(this,void 0),us.set(this,()=>{}),ds.set(this,()=>{}),fs.set(this,{}),ps.set(this,!1),ms.set(this,!1),hs.set(this,!1),gs.set(this,!1),_s.set(this,void 0),vs.set(this,void 0),ys.set(this,void 0),bs.set(this,void 0),Cs.set(this,e=>{if(C(this,ms,!0,`f`),_(e)&&(e=new y),e instanceof y)return C(this,hs,!0,`f`),this._emit(`abort`,e);if(e instanceof p)return this._emit(`error`,e);if(e instanceof Error){let t=new p(e.message);return t.cause=e,this._emit(`error`,t)}return this._emit(`error`,new p(String(e)))}),C(this,os,new Promise((e,t)=>{C(this,ss,e,`f`),C(this,cs,t,`f`)}),`f`),C(this,ls,new Promise((e,t)=>{C(this,us,e,`f`),C(this,ds,t,`f`)}),`f`),w(this,os,`f`).catch(()=>{}),w(this,ls,`f`).catch(()=>{}),C(this,as,e,`f`),C(this,bs,t?.logger??console,`f`)}get response(){return w(this,_s,`f`)}get request_id(){return w(this,vs,`f`)}get workspace_id(){return w(this,ys,`f`)}async withResponse(){C(this,gs,!0,`f`);let e=await w(this,os,`f`);if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get(`request-id`),workspace_id:e.headers.get(`anthropic-workspace-id`)}}static fromReadableStream(t){let n=new e(null);return n._run(()=>n._fromReadableStream(t)),n}static createMessage(t,n,r,{logger:i}={}){let a=new e(n,{logger:i});for(let e of n.messages)a._addMessageParam(e);return C(a,as,{...n,stream:!0},`f`),a._run(()=>a._createMessage(t,{...n,stream:!0},{...r,headers:{...r?.headers,[fr]:`stream`}})),a}_run(e){e().then(()=>{this._emitFinal(),this._emit(`end`)},w(this,Cs,`f`))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit(`message`,e)}async _createMessage(e,t,n){let r=n?.signal,i;r&&(r.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),r.addEventListener(`abort`,i));try{w(this,Q,`m`,ws).call(this);let{response:r,data:i}=await e.create({...t,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(r);for await(let e of i)w(this,Q,`m`,Ts).call(this,e);if(i.controller.signal?.aborted)throw new y;w(this,Q,`m`,Es).call(this)}finally{r&&i&&r.removeEventListener(`abort`,i)}}_connected(e){this.ended||(C(this,_s,e,`f`),C(this,vs,e?.headers.get(`request-id`),`f`),C(this,ys,e?.headers.get(`anthropic-workspace-id`),`f`),w(this,ss,`f`).call(this,e),this._emit(`connect`))}get ended(){return w(this,ps,`f`)}get errored(){return w(this,ms,`f`)}get aborted(){return w(this,hs,`f`)}abort(){this.controller.abort()}on(e,t){return(w(this,fs,`f`)[e]||(w(this,fs,`f`)[e]=[])).push({listener:t}),this}off(e,t){let n=w(this,fs,`f`)[e];if(!n)return this;let r=n.findIndex(e=>e.listener===t);return r>=0&&n.splice(r,1),this}once(e,t){return(w(this,fs,`f`)[e]||(w(this,fs,`f`)[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{C(this,gs,!0,`f`),e!==`error`&&this.once(`error`,n),this.once(e,t)})}async done(){C(this,gs,!0,`f`),await w(this,ls,`f`)}get currentMessage(){return w(this,is,`f`)}async finalMessage(){return await this.done(),w(this,Q,`m`,xs).call(this)}async finalText(){return await this.done(),w(this,Q,`m`,Ss).call(this)}_emit(e,...t){if(w(this,ps,`f`))return;e===`end`&&(C(this,ps,!0,`f`),w(this,us,`f`).call(this));let n=w(this,fs,`f`)[e];if(n&&(w(this,fs,`f`)[e]=n.filter(e=>!e.once),n.forEach(({listener:e})=>e(...t))),e===`abort`){let e=t[0];!w(this,gs,`f`)&&!n?.length&&Promise.reject(e),w(this,cs,`f`).call(this,e),w(this,ds,`f`).call(this,e),this._emit(`end`);return}if(e===`error`){let e=t[0];!w(this,gs,`f`)&&!n?.length&&Promise.reject(e),w(this,cs,`f`).call(this,e),w(this,ds,`f`).call(this,e),this._emit(`end`)}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit(`finalMessage`,w(this,Q,`m`,xs).call(this))}async _fromReadableStream(e,t){let n=t?.signal,r;n&&(n.aborted&&this.controller.abort(),r=this.controller.abort.bind(this.controller),n.addEventListener(`abort`,r));try{w(this,Q,`m`,ws).call(this),this._connected(null);let t=yn.fromReadableStream(e,this.controller);for await(let e of t)w(this,Q,`m`,Ts).call(this,e);if(t.controller.signal?.aborted)throw new y;w(this,Q,`m`,Es).call(this)}finally{n&&r&&n.removeEventListener(`abort`,r)}}[(is=new WeakMap,as=new WeakMap,os=new WeakMap,ss=new WeakMap,cs=new WeakMap,ls=new WeakMap,us=new WeakMap,ds=new WeakMap,fs=new WeakMap,ps=new WeakMap,ms=new WeakMap,hs=new WeakMap,gs=new WeakMap,_s=new WeakMap,vs=new WeakMap,ys=new WeakMap,bs=new WeakMap,Cs=new WeakMap,Q=new WeakSet,xs=function(){if(this.receivedMessages.length===0)throw new p(`stream ended without producing a Message with role=assistant`);return this.receivedMessages.at(-1)},Ss=function(){if(this.receivedMessages.length===0)throw new p(`stream ended without producing a Message with role=assistant`);let e=this.receivedMessages.at(-1).content.filter(e=>e.type===`text`).map(e=>e.text);if(e.length===0)throw new p(`stream ended without producing a content block with type=text`);return e.join(` `)},ws=function(){this.ended||C(this,is,void 0,`f`)},Ts=function(e){if(this.ended)return;let t=w(this,Q,`m`,Ds).call(this,e);switch(this._emit(`streamEvent`,e,t),e.type){case`content_block_delta`:{let n=t.content.at(-1);switch(e.delta.type){case`text_delta`:n.type===`text`&&this._emit(`text`,e.delta.text,n.text||``);break;case`citations_delta`:n.type===`text`&&this._emit(`citation`,e.delta.citation,n.citations??[]);break;case`input_json_delta`:Os(n)&&w(this,fs,`f`).inputJson?.length&&this._emit(`inputJson`,e.delta.partial_json,n.input);break;case`thinking_delta`:n.type===`thinking`&&this._emit(`thinking`,e.delta.thinking,n.thinking);break;case`signature_delta`:n.type===`thinking`&&this._emit(`signature`,n.signature);break;default:e.delta}break}case`message_stop`:this._addMessageParam(t),this._addMessage(ts(t,w(this,as,`f`),{logger:w(this,bs,`f`)}),!0);break;case`content_block_stop`:this._emit(`contentBlock`,t.content.at(-1));break;case`message_start`:C(this,is,t,`f`)}},Es=function(){if(this.ended)throw new p(`stream has ended, this shouldn't happen`);let e=w(this,is,`f`);if(!e)throw new p(`request ended without sending any chunks`);return C(this,is,void 0,`f`),ts(e,w(this,as,`f`),{logger:w(this,bs,`f`)})},Ds=function(e){let t=w(this,is,`f`);if(e.type===`message_start`){if(t)throw new p(`Unexpected event order, got ${e.type} before receiving "message_stop"`);return e.message}if(!t)throw new p(`Unexpected event order, got ${e.type} before "message_start"`);switch(e.type){case`message_stop`:return t;case`message_delta`:return t.stop_reason=e.delta.stop_reason,t.stop_sequence=e.delta.stop_sequence,t.stop_details=e.delta.stop_details,t.usage.output_tokens=e.usage.output_tokens,e.delta.container!=null&&(t.container=e.delta.container),e.usage.input_tokens!=null&&(t.usage.input_tokens=e.usage.input_tokens),e.usage.cache_creation_input_tokens!=null&&(t.usage.cache_creation_input_tokens=e.usage.cache_creation_input_tokens),e.usage.cache_read_input_tokens!=null&&(t.usage.cache_read_input_tokens=e.usage.cache_read_input_tokens),e.usage.server_tool_use!=null&&(t.usage.server_tool_use=e.usage.server_tool_use),e.usage.output_tokens_details!=null&&(t.usage.output_tokens_details=e.usage.output_tokens_details),t;case`content_block_start`:return t.content.push({...e.content_block}),t;case`content_block_delta`:{let n=t.content.at(e.index);switch(e.delta.type){case`text_delta`:n?.type===`text`&&(t.content[e.index]={...n,text:(n.text||``)+e.delta.text});break;case`citations_delta`:n?.type===`text`&&(t.content[e.index]={...n,citations:[...n.citations??[],e.delta.citation]});break;case`input_json_delta`:if(n&&Os(n)){let r=(n.__json_buf||``)+e.delta.partial_json;t.content[e.index]=ka(n,r)}break;case`thinking_delta`:n?.type===`thinking`&&(t.content[e.index]={...n,thinking:n.thinking+e.delta.thinking});break;case`signature_delta`:n?.type===`thinking`&&(t.content[e.index]={...n,signature:e.delta.signature});break;default:e.delta}return t}case`content_block_stop`:{let n=t.content.at(e.index);return n&&Os(n)&&`__json_buf`in n&&Object.defineProperty(n,"input",{value:n.input,enumerable:!0,configurable:!0,writable:!0}),t}}},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on(`streamEvent`,n=>{let r=t.shift();r?r.resolve(n):e.push(n)}),this.on(`end`,()=>{n=!0;for(let e of t)e.resolve(void 0);t.length=0}),this.on(`abort`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),this.on(`error`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((e,n)=>t.push({resolve:e,reject:n})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new yn(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}},As=class extends F{create(e,t){let{user_profile_id:n,workspace_id:r,...i}=e;return this._client.post(`/v1/messages/batches`,{body:i,...t,headers:I([{...n==null?void 0:{"anthropic-user-profile-id":n},...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}retrieve(e,t={},n){let{workspace_id:r}=t??{};return this._client.get(L`/v1/messages/batches/${e}`,{...n,headers:I([{...r==null?void 0:{"anthropic-workspace-id":r}},n?.headers])})}list(e={},t){let{workspace_id:n,...r}=e??{};return this._client.getAPIList(`/v1/messages/batches`,Rn,{query:r,...t,headers:I([{...n==null?void 0:{"anthropic-workspace-id":n}},t?.headers])})}delete(e,t={},n){let{workspace_id:r}=t??{};return this._client.delete(L`/v1/messages/batches/${e}`,{...n,headers:I([{...r==null?void 0:{"anthropic-workspace-id":r}},n?.headers])})}cancel(e,t={},n){let{workspace_id:r}=t??{};return this._client.post(L`/v1/messages/batches/${e}/cancel`,{...n,headers:I([{...r==null?void 0:{"anthropic-workspace-id":r}},n?.headers])})}async results(e,t={},n){let r=await this.retrieve(e,t,n);if(!r.results_url)throw new p(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);let{workspace_id:i}=t??{};return this._client.get(r.results_url,{...n,headers:I([{Accept:`application/binary`,...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((e,t)=>ga.fromResponse(t.response,t.controller))}},js=class extends F{constructor(){super(...arguments),this.batches=new As(this._client)}create(e,t){let{user_profile_id:n,workspace_id:r,...i}=e;i.model in Ms&&console.warn(`The model '${i.model}' is deprecated and will reach end-of-life on ${Ms[i.model]}\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),Ns.includes(i.model)&&i.thinking&&i.thinking.type===`enabled`&&console.warn(`Using Claude with ${i.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let a=t?.timeout??this._client._options.timeout;if(!i.stream&&a==null){let e=va[i.model]??void 0;a=this._client.calculateNonstreamingTimeout(i.max_tokens,e)}let o=_r(i.tools,i.messages);return this._client.post(`/v1/messages`,{body:i,timeout:a??6e5,...t,headers:I([{...n==null?void 0:{"anthropic-user-profile-id":n},...r==null?void 0:{"anthropic-workspace-id":r}},o,t?.headers]),stream:e.stream??!1})}parse(e,t){return this.create(e,t).then(t=>ns(t,e,{logger:this._client.logger??console}))}stream(e,t){return ks.createMessage(this,e,t,{logger:this._client.logger??console})}countTokens(e,t){let{user_profile_id:n,workspace_id:r,...i}=e;return this._client.post(`/v1/messages/count_tokens`,{body:i,...t,headers:I([{...n==null?void 0:{"anthropic-user-profile-id":n},...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}},Ms={},Ns=[`claude-mythos-preview`,`claude-opus-4-6`];js.Batches=As;var Ps=class extends F{retrieve(e,t={},n){let{betas:r,workspace_id:i}=t??{};return this._client.get(L`/v1/models/${e}`,{...n,headers:I([{...r?.toString()==null?void 0:{"anthropic-beta":r?.toString()},...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e={},t){let{betas:n,workspace_id:r,...i}=e??{};return this._client.getAPIList(`/v1/models`,Rn,{query:i,...t,headers:I([{...n?.toString()==null?void 0:{"anthropic-beta":n?.toString()},...r==null?void 0:{"anthropic-workspace-id":r}},t?.headers])})}},Fs=class extends F{create(e,t,n){let{workspace_id:r,...i}=t;return this._client.post(L`/v1/skills/${e}/versions`,Wn({body:i,...n,headers:I([{...r==null?void 0:{"anthropic-workspace-id":r}},n?.headers])},this._client,!1))}retrieve(e,t,n){let{skill_id:r,workspace_id:i}=t;return this._client.get(L`/v1/skills/${r}/versions/${e}`,{...n,headers:I([{...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}list(e,t={},n){let{workspace_id:r,...i}=t??{};return this._client.getAPIList(L`/v1/skills/${e}/versions`,P,{query:i,...n,headers:I([{...r==null?void 0:{"anthropic-workspace-id":r}},n?.headers])})}delete(e,t,n){let{skill_id:r,workspace_id:i}=t;return this._client.delete(L`/v1/skills/${r}/versions/${e}`,{...n,headers:I([{...i==null?void 0:{"anthropic-workspace-id":i}},n?.headers])})}},Is=class extends F{constructor(){super(...arguments),this.versions=new Fs(this._client)}create(e,t){let{workspace_id:n,...r}=e;return this._client.post(`/v1/skills`,Wn({body:r,...t,headers:I([{...n==null?void 0:{"anthropic-workspace-id":n}},t?.headers])},this._client,!1))}retrieve(e,t={},n){let{workspace_id:r}=t??{};return this._client.get(L`/v1/skills/${e}`,{...n,headers:I([{...r==null?void 0:{"anthropic-workspace-id":r}},n?.headers])})}list(e={},t){let{workspace_id:n,...r}=e??{};return this._client.getAPIList(`/v1/skills`,P,{query:r,...t,headers:I([{...n==null?void 0:{"anthropic-workspace-id":n}},t?.headers])})}delete(e,t={},n){let{workspace_id:r}=t??{};return this._client.delete(L`/v1/skills/${e}`,{...n,headers:I([{...r==null?void 0:{"anthropic-workspace-id":r}},n?.headers])})}};Is.Versions=Fs;var Ls,Rs,zs,Bs,Vs=`\\n\\nHuman:`,Hs=`\\n\\nAssistant:`,$=class{get credentials(){return this._authState.provider}constructor({baseURL:e=A(`ANTHROPIC_BASE_URL`),apiKey:t,authToken:n,webhookKey:r=A(`ANTHROPIC_WEBHOOK_SIGNING_KEY`)??null,...i}={}){if(Ls.add(this),this._requestAuthFlags=new WeakMap,zs.set(this,void 0),t===void 0&&(t=i.profile==null?A(`ANTHROPIC_API_KEY`)??null:null),n===void 0&&(n=i.profile==null?A(`ANTHROPIC_AUTH_TOKEN`)??null:null),i.profile!=null&&(i.credentials!=null||i.config!=null))throw TypeError("Pass at most one of `profile`, `credentials`, or `config`.");let a={apiKey:t,authToken:n,webhookKey:r,...i,baseURL:e||`https://api.anthropic.com`};if(!a.dangerouslyAllowBrowser&&Ie())throw new p(`It looks like you're running in a browser-like environment.
|
|
30
|
+
|
|
31
|
+
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
32
|
+
If you understand the risks and have appropriate mitigations in place,
|
|
33
|
+
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
34
|
+
|
|
35
|
+
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
36
|
+
`);this.baseURL=a.baseURL,this._baseURLIsExplicit=i.__baseURLIsExplicit??!!e,this.timeout=a.timeout??Rs.DEFAULT_TIMEOUT,this.logger=a.logger??console,this.logLevel=Bt,this.logLevel=Ht(a.logLevel,`ClientOptions.logLevel`,j(this))??Ht(A(`ANTHROPIC_LOG`),`process.env['ANTHROPIC_LOG']`,j(this))??`warn`,this.fetchOptions=a.fetchOptions,this.maxRetries=a.maxRetries??2,this.fetch=a.fetch??Xe(),C(this,zs,tt,`f`),this.middleware=[...a.middleware??[]];let o=A(`ANTHROPIC_CUSTOM_HEADERS`);if(o){let e={};for(let t of o.split(`
|
|
37
|
+
`)){let n=t.indexOf(`:`);n>=0&&(e[t.substring(0,n).trim()]=t.substring(n+1).trim())}a.defaultHeaders={...e,...a.defaultHeaders}}let s=i.__auth;if(delete a.__auth,delete a.__baseURLIsExplicit,this._options=a,this.apiKey=typeof t==`string`?t:null,this.authToken=n,this.webhookKey=r,s)this._authState=s,!this._baseURLIsExplicit&&s.baseURL&&(this.baseURL=s.baseURL);else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let e=a.credentials??null;if(e)this._authState.provider=e,this._authState.tokenCache=this._makeTokenCache(e);else if(a.config!=null){let e=un(a.config,this._credentialResolverOptions());this._authState.provider=e.provider,this._authState.tokenCache=this._makeTokenCache(e.provider),this._authState.extraHeaders=e.extraHeaders,this._applyCredentialBaseURL(e.baseURL)}else a.profile==null?this._shouldResolveDefaultCredentials()&&(this._authState.resolution=this._resolveDefaultCredentials()):this._authState.resolution=this._resolveDefaultCredentials(a.profile)}}_shouldResolveDefaultCredentials(){return!0}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,``);this._authState.baseURL=t,this._baseURLIsExplicit||(this.baseURL=t)}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this._credentialsFetch(),userAgent:this.getUserAgent(),onCacheWriteError:e=>{j(this).debug(`credential cache write failed (best-effort)`,e)},onSafetyWarning:e=>{j(this).warn(e)}}}_credentialsFetch(){return kn(this.fetch,this.middleware,void 0,this)}_makeTokenCache(e){return new Nt(e,e=>{j(this).debug(`advisory token refresh failed; serving cached token`,e)})}withOptions(e){let t=`credentials`in e||`config`in e||`profile`in e,n=`apiKey`in e||`authToken`in e||t,r={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,middleware:this.middleware,apiKey:this.apiKey,authToken:this.authToken,webhookKey:this.webhookKey,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:n?void 0:this._authState,__baseURLIsExplicit:`baseURL`in e||this._baseURLIsExplicit};return new this.constructor(r)}async _resolveDefaultCredentials(e){try{let t=await dn(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new p(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(e){this._authState.error=e}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(e.get(`x-api-key`)||e.get(`authorization`))){if(this._authState.error)throw this._authState.error;if(!(this._authState.tokenCache||this._authState.resolution)&&!(this.apiKey&&e.get(`x-api-key`))&&!t.has(`x-api-key`)&&!(this.authToken&&e.get(`authorization`))&&!t.has(`authorization`))throw Error(`Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted`)}}_authFlags(e){let t=this._requestAuthFlags.get(e);return t||(t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t)),t}async authHeaders(e){if(this._authState.resolution&&await this._authState.resolution,!this._authState.error){if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,I([{Authorization:`Bearer ${t}`}])}return I([await this.apiKeyAuth(e),await this.bearerAuth(e)])}}async apiKeyAuth(e){if(this.apiKey!=null)return I([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return I([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return vt(e)}getUserAgent(){return`Anthropic/JS ${Fe}`}defaultIdempotencyKey(){return`stainless-node-retry-${we()}`}makeStatusError(e,t,n,r){return x.generate(e,t,n,r)}buildURL(e,t,n){let r=!w(this,Ls,`m`,Bs).call(this)&&n||this.baseURL,i=Ee(e)?new URL(e):new URL(r+(r.endsWith(`/`)&&e.startsWith(`/`)?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return(!ke(a)||!ke(o))&&(t={...o,...a,...t}),typeof t==`object`&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new p(`Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details`);return 6e5}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){if(this._authState.tokenCache&&this.apiKey==null){let t=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[e,n]of Object.entries(this._authState.extraHeaders))t.has(e)||t.set(e,n);(t.get(`anthropic-beta`)?.split(`,`).map(e=>e.trim()))?.includes(`oauth-2025-04-20`)||t.append(`anthropic-beta`,St),e.headers=t}}backendMiddleware(){return[]}get(e,t){return this.methodRequest(`get`,e,t)}post(e,t){return this.methodRequest(`post`,e,t)}patch(e,t){return this.methodRequest(`patch`,e,t)}put(e,t){return this.methodRequest(`put`,e,t)}delete(e,t){return this.methodRequest(`delete`,e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new Pn(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){let r=await e,i=r.maxRetries??this.maxRetries;t??(t=i,this._requestAuthFlags.delete(r)),await this.prepareOptions(r);let{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t}),c=`log_`+(Math.random()*(1<<24)|0).toString(16).padStart(6,`0`),l=n===void 0?``:`, retryOf: ${n}`,u=Date.now();if(r.signal?.aborted)throw new y;let d=new AbortController,f=await this.fetchWithTimeout(o,a,s,d,r,{requestLogID:c,retryOfRequestLogID:n}).catch(v),p=Date.now();if(f instanceof globalThis.Error){Ye(d);let e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new y;let i=_(f)||/timed? ?out/i.test(String(f)+(`cause`in f?String(f.cause):``)),a=this.middleware.length>0||!!r.middleware?.length||this.backendMiddleware().length>0;if(a&&!i&&!On(f))throw j(this).info(`[${c}] middleware error (not retryable)`),j(this).debug(`[${c}] middleware error (not retryable)`,Zt({retryOfRequestLogID:n,url:o,durationMs:p-u,message:f.message})),f;if(t)return j(this).info(`[${c}] connection ${i?`timed out`:`failed`} - ${e}`),j(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (${e})`,Zt({retryOfRequestLogID:n,url:o,durationMs:p-u,message:f.message})),this.retryRequest(r,t,n??c);throw j(this).info(`[${c}] connection ${i?`timed out`:`failed`} - error; no more retries left`),j(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (error; no more retries left)`,Zt({retryOfRequestLogID:n,url:o,durationMs:p-u,message:f.message})),i?new te:a&&!Dn(f)?f:new ae({cause:f})}let m=`[${c}${l}${[...f.headers.entries()].filter(([e])=>e===`request-id`||e===`anthropic-workspace-id`).map(([e,t])=>`, `+e+`: `+JSON.stringify(t)).join(``)}] ${a.method} ${o} ${f.ok?`succeeded`:`failed`} with status ${f.status} in ${p-u}ms`;if(!f.ok){let e=await this.shouldRetry(f,r);if(t&&e){let e=`retrying, ${t} attempts remaining`;return await et(f.body),Ye(d),j(this).info(`${m} - ${e}`),j(this).debug(`[${c}] response error (${e})`,Zt({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:p-u})),this.retryRequest(r,t,n??c,f.headers)}let i=e?`error; no more retries left`:`error; not retryable`;j(this).info(`${m} - ${i}`);let a=await f.text().catch(e=>v(e).message),o=Ne(a),s=o?void 0:a;throw j(this).debug(`[${c}] response error (${i})`,Zt({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,message:s,durationMs:Date.now()-u})),Ye(d),this.makeStatusError(f.status,o,s,f.headers)}return j(this).info(m),j(this).debug(`[${c}] response start`,Zt({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:p-u})),Je(f.body??f,d),{response:f,options:r,controller:d,requestLogID:c,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,n&&`then`in n?n.then(t=>({method:`get`,path:e,...t})):{method:`get`,path:e,...n})}requestAPIList(e,t){let n=this.makeRequest(t,null,void 0);return new Ln(this,n,e)}async fetchWithTimeout(e,t,n,r,i,a){let{signal:o,method:s,...c}=t||{},l=this._makeAbort(r);o&&(o.addEventListener(`abort`,l,{once:!0}),qe(r,o,l));let u=globalThis.ReadableStream&&c.body instanceof globalThis.ReadableStream||typeof c.body==`object`&&c.body!==null&&Symbol.asyncIterator in c.body,d={signal:r.signal,...u?{duplex:`half`}:{},method:`GET`,...c};s&&(d.method=s.toUpperCase());let f=this.fetch,p=async(e,t)=>{let r=setTimeout(l,n);try{return await f.call(void 0,e,t)}finally{clearTimeout(r)}},m=i===void 0?p:(async(e,t={})=>{let n=typeof e==`string`?e:e instanceof URL?e.href:e.url;return t.headers=t.headers instanceof Headers?t.headers:new Headers(t.headers),await this.prepareRequest(t,{url:n,options:i}),a&&j(this).debug(`[${a.requestLogID}] sending request`,Zt({retryOfRequestLogID:a.retryOfRequestLogID,method:t.method,url:n,options:i,headers:t.headers})),p(e,t)}),h=i?.middleware,g=this.backendMiddleware();return await kn(m,h?.length||g.length?[...this.middleware,...h??[],...g]:this.middleware,i,this)(e,d)}async shouldRetry(e,t){let n=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&n.usedTokenCache&&!n.didRefreshFor401)return n.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let r=e.headers.get(`x-should-retry`);return r===`true`?!0:r===`false`?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,n,r){let i,a=r?.get(`retry-after-ms`);if(a){let e=parseFloat(a);Number.isNaN(e)||(i=e)}let o=r?.get(`retry-after`);if(o&&!i){let e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():e*1e3}if(i===void 0){let n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}return await Pe(i),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e;return Math.min(.5*2**n,8)*(1-Math.random()*.25)*1e3}calculateNonstreamingTimeout(e,t){let n=6e5;if(36e5*e/128e3>n||t!=null&&e>t)throw new p(`Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details`);return n}async buildRequest(e,{retryCount:t=0}={}){let n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n;this._authState.resolution&&await this._authState.resolution,!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL&&(this.baseURL=this._authState.baseURL);let s=this.buildURL(i,a,o);`timeout`in n&&Me(`timeout`,n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:`half`},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&t!==`get`&&(e.idempotencyKey||=this.defaultIdempotencyKey(),i[this.idempotencyHeader]=e.idempotencyKey);let a=I([i,{Accept:`application/json`,"User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...Ue(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":`true`}:void 0,"anthropic-version":`2023-06-01`},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=I([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==`string`&&n.values.has(`content-type`)||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e==`object`&&(Symbol.asyncIterator in e||Symbol.iterator in e&&`next`in e&&typeof e.next==`function`)?{bodyHeaders:void 0,body:Qe(e)}:typeof e==`object`&&n.values.get(`content-type`)===`application/x-www-form-urlencoded`?{bodyHeaders:{"content-type":`application/x-www-form-urlencoded`},body:this.stringifyQuery(e)}:w(this,zs,`f`).call(this,{body:e,headers:n})}};Rs=$,zs=new WeakMap,Ls=new WeakSet,Bs=function(){return this.baseURL!==`https://api.anthropic.com`},$.Anthropic=Rs,$.HUMAN_PROMPT=Vs,$.AI_PROMPT=Hs,$.DEFAULT_TIMEOUT=6e5,$.AnthropicError=p,$.APIError=x,$.APIConnectionError=ae,$.APIConnectionTimeoutError=te,$.APIUserAbortError=y,$.NotFoundError=oe,$.ConflictError=m,$.RateLimitError=g,$.BadRequestError=ie,$.AuthenticationError=ne,$.InternalServerError=b,$.PermissionDeniedError=h,$.UnprocessableEntityError=ee,$.toFile=Qn;var Us=class extends ${constructor(){super(...arguments),this.completions=new Qo(this),this.messages=new js(this),this.models=new Ps(this),this.files=new $o(this),this.skills=new Is(this),this.beta=new Z(this)}};Us.Completions=Qo,Us.Messages=js,Us.Models=Ps,Us.Files=$o,Us.Skills=Is,Us.Beta=Z,new TextEncoder;var Ws=e({stream:()=>vc,streamSimple:()=>bc});function Gs(e,t){return e||(se(`PI_CACHE_RETENTION`,t)===`long`?`long`:`short`)}function Ks(e,t,n){let r=Gs(t,n);if(r===`none`)return{retention:r};let i=r===`long`&&oc(e).supportsLongCacheRetention?`1h`:void 0;return{retention:r,cacheControl:{type:`ephemeral`,...i&&{ttl:i}}}}var qs=`2.1.280`,Js=new Map([`Read`,`Write`,`Edit`,`Bash`,`Grep`,`Glob`,`AskUserQuestion`,`EnterPlanMode`,`ExitPlanMode`,`KillShell`,`NotebookEdit`,`Skill`,`Task`,`TaskOutput`,`TodoWrite`,`WebFetch`,`WebSearch`].map(e=>[e.toLowerCase(),e])),Ys=e=>Js.get(e.toLowerCase())??e,Xs=(e,t)=>{if(t&&t.length>0){let n=e.toLowerCase(),r=t.find(e=>e.name.toLowerCase()===n);if(r)return r.name}return e};function Zs(e){if(!e.some(e=>e.type===`image`))return S(e.map(e=>e.text).join(`
|
|
38
|
+
`));let t=e.map(e=>e.type===`text`?{type:`text`,text:S(e.text)}:{type:`image`,source:{type:`base64`,media_type:e.mimeType,data:e.data}});return t.some(e=>e.type===`text`)||t.unshift({type:`text`,text:`(see attached image)`}),t}var Qs=`fine-grained-tool-streaming-2025-05-14`,$s=`interleaved-thinking-2025-05-14`,ec=`server-side-fallback-2026-07-01`,tc=`mid-conversation-output-config-2026-07-01`,nc=`thinking-binding-controls-2026-08-01`,rc=`mid-conversation-tool-changes-2026-07-01`,ic={name:`__pi_deferred_placeholder__`,description:`Reserved placeholder. Never available. Never call this.`,input_schema:{type:`object`,properties:{},required:[]},defer_loading:!0};function ac(e){return(e.compat?.allowedFallbackModels?.length??0)>0}function oc(e){let t=e.provider===`openrouter`||e.baseUrl.includes(`openrouter.ai`);return{supportsEagerToolInputStreaming:e.compat?.supportsEagerToolInputStreaming??!0,supportsLongCacheRetention:e.compat?.supportsLongCacheRetention??!0,sendSessionAffinityHeaders:e.compat?.sendSessionAffinityHeaders??t,sessionAffinityFormat:e.compat?.sessionAffinityFormat??(t?`openrouter`:void 0),supportsCacheControlOnTools:e.compat?.supportsCacheControlOnTools??!0,supportsTemperature:e.compat?.supportsTemperature??!0,allowEmptySignature:e.compat?.allowEmptySignature??!1,supportsStrictTools:e.compat?.supportsStrictTools??!1,supportsMidConvoSystemMessages:e.compat?.supportsMidConvoSystemMessages??!1,supportsMidConvoToolChanges:e.compat?.supportsMidConvoToolChanges??!1}}function sc(...e){let t={};for(let n of e)n&&Object.assign(t,n);return t}function cc(...e){return sc({"User-Agent":ve()},...e)}function lc(e,t){if(!e)return!1;let n=t.toLowerCase();for(let[t,r]of Object.entries(e))if(t.toLowerCase()===n&&r!==null&&r.trim().length>0)return!0;return!1}function uc(e,t,n){if(!t&&!(lc(n,`authorization`)||lc(n,`x-api-key`)||lc(n,`cf-aig-authorization`)))throw Error(`No API key for provider: ${e}`)}var dc=new Set([`message_start`,`message_delta`,`message_stop`,`content_block_start`,`content_block_delta`,`content_block_stop`]);function fc(e){if(!e.event&&e.data.length===0)return null;let t={event:e.event,data:e.data.join(`
|
|
39
|
+
`),raw:[...e.raw]};return e.event=null,e.data=[],e.raw=[],t}function pc(e,t){if(e===``)return fc(t);if(t.raw.push(e),e.startsWith(`:`))return null;let n=e.indexOf(`:`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n+1);return i.startsWith(` `)&&(i=i.slice(1)),r===`event`?t.event=i:r===`data`&&t.data.push(i),null}function mc(e){let t=e.indexOf(`\r`),n=e.indexOf(`
|
|
40
|
+
`);return t===-1?n:n===-1?t:Math.min(t,n)}function hc(e){let t=mc(e);if(t===-1)return null;let n=t+1;return e[t]===`\r`&&e[n]===`
|
|
41
|
+
`&&(n+=1),{line:e.slice(0,t),rest:e.slice(n)}}async function*gc(e,t){let n=e.getReader(),r=new TextDecoder,i={event:null,data:[],raw:[]},a=``;try{for(;;){if(t?.aborted)throw Error(`Request was aborted`);let{value:e,done:o}=await n.read();if(o)break;a+=r.decode(e,{stream:!0});let s=hc(a);for(;s;){a=s.rest;let e=pc(s.line,i);e&&(yield e),s=hc(a)}}a+=r.decode();let e=hc(a);for(;e;){a=e.rest;let t=pc(e.line,i);t&&(yield t),e=hc(a)}if(a.length>0){let e=pc(a,i);e&&(yield e)}let o=fc(i);o&&(yield o)}finally{n.releaseLock()}}async function*_c(e,t){if(!e.body)throw Error(`Attempted to iterate over an Anthropic response with no body`);let n=!1,r=!1;for await(let i of gc(e.body,t)){if(i.event===`error`)throw Error(i.data);if(dc.has(i.event??``))try{let e=be(i.data);e.type===`message_start`?n=!0:e.type===`message_stop`&&(r=!0),yield e}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Could not parse Anthropic SSE event ${i.event}: ${t}; data=${i.data}; raw=${i.raw.join(`\\n`)}`)}}if(n&&!r)throw Error(`Anthropic stream ended before message_stop`)}var vc=(e,t,i)=>{let a=new u,o=c(t,oc(e).supportsMidConvoSystemMessages),l=r(o.messages);return(async()=>{let t=e.compat?.supportsMidConvoEffort?i?.effort??`high`:void 0,r={role:`assistant`,content:[],api:e.api,provider:e.provider,model:e.id,...t===void 0?{}:{providerThinkingLevel:t},usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`pending`,timestamp:Date.now()};try{let t,c,u=e,d;if(i?.client)t=i.client,c=!1;else{let n=i?.apiKey;uc(e.provider,n,i?.headers);let r;if(e.provider===`github-copilot`){let e=le(o.messages);r=ge({messages:o.messages,hasImages:e})}let a=Gs(i?.cacheRetention,i?.env)===`none`?void 0:i?.sessionId,s=Sc(e,n,i?.headers,i?.fetch,r,a);t=s.client,c=s.isOAuthToken}let f=wc(e,o,c,i),p=await i?.onPayload?.(f,e);p!==void 0&&(f={...p,stream:!0});let m={...i?.signal?{signal:i.signal}:{},...i?.timeoutMs===void 0?{}:{timeout:i.timeoutMs},maxRetries:0},h=await de(()=>t.beta.messages.create(f,m).asResponse(),{maxRetries:i?.maxRetries,maxRetryDelayMs:i?.maxRetryDelayMs,signal:i?.signal});await i?.onResponse?.({status:h.status,headers:ye(h.headers)},e),a.push({type:`start`,partial:r});let g=r.content;for await(let t of _c(h,i?.signal))if(t.type===`message_start`){r.responseId=t.message.id;let n=t.message.input_transformations;Array.isArray(n)&&(d=n);let i=t.message.model;i!==e.id&&(r.responseModel=i);let a=i===e.id?void 0:e.compat?.allowedFallbackModels?.find(t=>t.provider===e.provider&&t.model===i)?.cost;u=a?{...e,id:i,cost:a}:e,r.usage.input=t.message.usage.input_tokens||0,r.usage.output=t.message.usage.output_tokens||0,r.usage.cacheRead=t.message.usage.cache_read_input_tokens||0,r.usage.cacheWrite=t.message.usage.cache_creation_input_tokens||0,r.usage.cacheWrite1h=t.message.usage.cache_creation?.ephemeral_1h_input_tokens||0,r.usage.totalTokens=r.usage.input+r.usage.output+r.usage.cacheRead+r.usage.cacheWrite,s(u,r.usage)}else if(t.type===`content_block_start`){if(t.content_block.type===`fallback`){if(r.content.length>0)throw Error(`Anthropic performed an unsupported mid-output model fallback`);continue}if(t.content_block.type===`text`){let e={type:`text`,text:t.content_block.text??``,index:t.index};r.content.push(e),a.push({type:`text_start`,contentIndex:r.content.length-1,partial:r})}else if(t.content_block.type===`thinking`){let e={type:`thinking`,thinking:t.content_block.thinking??``,thinkingSignature:t.content_block.signature??``,index:t.index};r.content.push(e),a.push({type:`thinking_start`,contentIndex:r.content.length-1,partial:r})}else if(t.content_block.type===`redacted_thinking`){let e={type:`thinking`,thinking:`[Reasoning redacted]`,thinkingSignature:t.content_block.data,redacted:!0,index:t.index};r.content.push(e),a.push({type:`thinking_start`,contentIndex:r.content.length-1,partial:r})}else if(t.content_block.type===`tool_use`){let e={type:`toolCall`,id:t.content_block.id,name:c?Xs(t.content_block.name,l):t.content_block.name,arguments:t.content_block.input??{},partialJson:``,index:t.index};r.content.push(e),a.push({type:`toolcall_start`,contentIndex:r.content.length-1,partial:r})}}else if(t.type===`content_block_delta`){if(t.delta.type===`text_delta`){let e=g.findIndex(e=>e.index===t.index),n=g[e];n&&n.type===`text`&&(n.text+=t.delta.text,a.push({type:`text_delta`,contentIndex:e,delta:t.delta.text,partial:r}))}else if(t.delta.type===`thinking_delta`){let e=g.findIndex(e=>e.index===t.index),n=g[e];n&&n.type===`thinking`&&(n.thinking+=t.delta.thinking,a.push({type:`thinking_delta`,contentIndex:e,delta:t.delta.thinking,partial:r}))}else if(t.delta.type===`input_json_delta`){let e=g.findIndex(e=>e.index===t.index),n=g[e];n&&n.type===`toolCall`&&(n.partialJson+=t.delta.partial_json,n.arguments=ce(n.partialJson),a.push({type:`toolcall_delta`,contentIndex:e,delta:t.delta.partial_json,partial:r}))}else if(t.delta.type===`signature_delta`){let e=g[g.findIndex(e=>e.index===t.index)];e&&e.type===`thinking`&&(e.thinkingSignature=e.thinkingSignature||``,e.thinkingSignature+=t.delta.signature)}}else if(t.type===`content_block_stop`){let e=g.findIndex(e=>e.index===t.index),n=g[e];n&&(delete n.index,n.type===`text`?a.push({type:`text_end`,contentIndex:e,content:n.text,partial:r}):n.type===`thinking`?a.push({type:`thinking_end`,contentIndex:e,content:n.thinking,partial:r}):n.type===`toolCall`&&(n.arguments=ce(n.partialJson),delete n.partialJson,a.push({type:`toolcall_end`,contentIndex:e,toolCall:n,partial:r})))}else if(t.type===`message_delta`){let e=t.input_transformations;if(Array.isArray(e)&&(d=e),t.delta.stop_reason){r.rawStopReason=t.delta.stop_reason;let e=Mc(t.delta.stop_reason,t.delta.stop_details);r.stopReason=e.stopReason,e.errorMessage&&(r.errorMessage=e.errorMessage)}if(t.usage){t.usage.input_tokens!=null&&(r.usage.input=t.usage.input_tokens),t.usage.output_tokens!=null&&(r.usage.output=t.usage.output_tokens),t.usage.cache_read_input_tokens!=null&&(r.usage.cacheRead=t.usage.cache_read_input_tokens),t.usage.cache_creation_input_tokens!=null&&(r.usage.cacheWrite=t.usage.cache_creation_input_tokens);let e=t.usage.output_tokens_details?.thinking_tokens;e!=null&&(r.usage.reasoning=e)}r.usage.totalTokens=r.usage.input+r.usage.output+r.usage.cacheRead+r.usage.cacheWrite,s(u,r.usage)}if(i?.signal?.aborted)throw Error(`Request was aborted`);if(r.stopReason===`pending`)throw Error(`Anthropic stream ended without a stop reason`);if(r.stopReason===`aborted`||r.stopReason===`error`)throw Error(r.errorMessage||`An unknown error occurred`);d&&d.length>0&&n(r,{type:`anthropic_input_transformations`,timestamp:Date.now(),details:{transformations:d.map(e=>({type:e.type??void 0,path:e.path??void 0,reason:e.reason??void 0}))}}),a.push({type:`done`,reason:r.stopReason,message:r}),a.end()}catch(e){for(let e of r.content)delete e.index,delete e.partialJson;r.stopReason=i?.signal?.aborted?`aborted`:`error`,r.errorMessage=e instanceof Error?e.message:JSON.stringify(e),a.push({type:`error`,reason:r.stopReason,error:r}),a.end()}})(),a};function yc(e,t){let n=t?e.thinkingLevelMap?.[t]:void 0;if(typeof n==`string`)return n;switch(t){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`high`:return`high`;default:return`high`}}var bc=(e,t,n)=>{uc(e.provider,n?.apiKey,n?.headers);let r={...he(e,t,n,n?.apiKey),toolChoice:n?.toolChoice};if(!n?.reasoning)return vc(e,t,{...r,thinkingEnabled:!1});if(e.compat?.forceAdaptiveThinking===!0){let i=yc(e,n.reasoning);return vc(e,t,{...r,thinkingEnabled:!0,effort:i})}let i=me(r.maxTokens,e.maxTokens,n.reasoning,n.thinkingBudgets),a=fe(e,t,i.maxTokens);return vc(e,t,{...r,maxTokens:a,thinkingEnabled:!0,thinkingBudgetTokens:Math.min(i.thinkingBudget,Math.max(0,a-1024))})};function xc(e){return e.includes(`sk-ant-oat`)}function Sc(e,t,n,r,i,a){if(e.provider===`github-copilot`)return{client:new Us({apiKey:null,authToken:t??null,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,fetch:r,defaultHeaders:cc({accept:`application/json`,"anthropic-dangerous-direct-browser-access":`true`},e.headers,i,n)}),isOAuthToken:!1};if(t&&xc(t))return{client:new Us({apiKey:null,authToken:t,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,fetch:r,defaultHeaders:cc({accept:`application/json`,"anthropic-dangerous-direct-browser-access":`true`,"user-agent":`claude-cli/${qs}`,"x-app":`cli`},e.headers,n)}),isOAuthToken:!0};let o=oc(e),s={};if(a&&o.sendSessionAffinityHeaders){let e=o.sessionAffinityFormat===`openrouter`?`x-session-id`:`x-session-affinity`;s[e]=a}let c=cc({accept:`application/json`,"anthropic-dangerous-direct-browser-access":`true`},s,e.headers,n);return{client:new Us({apiKey:t??null,authToken:null,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,fetch:r,defaultHeaders:c}),isOAuthToken:!1}}function Cc(e,t,n,r,i){let a;for(let t of[e.headers,i?.headers])for(let[e,n]of Object.entries(t??{}))e.toLowerCase()===`anthropic-beta`&&(a=n);if(a===null)return[];if(a!==void 0)return[...new Set(a.split(`,`).map(e=>e.trim()).filter(e=>e.length>0))];let o=[];return n&&o.push(`claude-code-20250219`,`oauth-2025-04-20`),Ac(e,t)&&o.push(Qs),e.reasoning&&i?.thinkingEnabled===!0&&(i.interleavedThinking??!0)&&e.compat?.forceAdaptiveThinking!==!0&&o.push($s),ac(e)&&o.push(ec),e.compat?.supportsMidConvoEffort===!0&&o.push(tc,nc),r&&o.push(rc),[...new Set(o)]}function wc(e,t,n,o){let{cacheControl:s}=Ks(e,o?.cacheRetention,o?.env),c=oc(e),u=d(t.messages),f=u?l(u):``,p=_e(t.messages,e,Tc),m=u?p.slice(1):p,h=u?.toolsAdded??[],g=c.supportsMidConvoSystemMessages&&c.supportsMidConvoToolChanges&&h.length>0&&!i(t.messages),_=Dc(m,n,s,c.allowEmptySignature,e.compat?.supportsMidConvoEffort===!0?e.provider:void 0,g),v=o?.effort??`high`,y=Cc(e,t,n,g,o),b={model:e.id,messages:e.compat?.supportsMidConvoEffort===!0?kc(_,v):_.messages,max_tokens:o?.maxTokens??e.maxTokens,stream:!0,...y.length>0?{betas:y}:{}};n?(b.system=[{type:`text`,text:`You are Claude Code, Anthropic's official CLI for Claude.`,...s?{cache_control:s}:{}}],f&&b.system.push({type:`text`,text:S(f),...s?{cache_control:s}:{}})):f&&(b.system=[{type:`text`,text:S(f),...s?{cache_control:s}:{}}]),o?.temperature!==void 0&&!o?.thinkingEnabled&&e.compat?.supportsMidConvoEffort!==!0&&c.supportsTemperature&&(b.temperature=o.temperature);let ee=c.supportsCacheControlOnTools?s:void 0;if(g){let e=new Set(h.map(e=>e.name)),r=a(t.messages).filter(t=>!e.has(t.name));b.tools=[...jc(h,n,c.supportsEagerToolInputStreaming,c.supportsStrictTools,ee),ic,...jc(r,n,c.supportsEagerToolInputStreaming,c.supportsStrictTools).map(e=>({...e,defer_loading:!0}))]}else{let e=r(t.messages);e.length>0&&(b.tools=jc(e,n,c.supportsEagerToolInputStreaming,c.supportsStrictTools,ee))}if(e.compat?.supportsMidConvoEffort===!0)b.thinking={type:`adaptive`,display:o?.thinkingDisplay??`summarized`,block_binding:{prefix_mismatch_behavior:`drop_block`}},b.output_config={effort:`high`};else if(e.reasoning){if(o?.thinkingEnabled){let t=o.thinkingDisplay??`summarized`;e.compat?.forceAdaptiveThinking===!0?(b.thinking={type:`adaptive`,display:t},o.effort&&(b.output_config={effort:o.effort})):b.thinking={type:`enabled`,budget_tokens:o.thinkingBudgetTokens||1024,display:t}}else o?.thinkingEnabled===!1&&e.thinkingLevelMap?.off!==null&&(b.thinking={type:`disabled`})}if(o?.metadata){let e=o.metadata.user_id;typeof e==`string`&&(b.metadata={user_id:e})}o?.toolChoice&&(b.tool_choice=typeof o.toolChoice==`string`?{type:o.toolChoice}:o.toolChoice);let te=e.compat?.allowedFallbackModels;return te&&te.length>0&&(b.fallbacks=te.map(e=>({model:e.model}))),b}function Tc(e){return e.replace(/[^a-zA-Z0-9_-]/g,`_`).slice(0,64)}function Ec(e){return{type:`tool_result`,tool_use_id:e.toolCallId,content:Zs(e.content),is_error:e.isError}}function Dc(e,t,n,r=!1,i,a=!1){let s=[],c=new Map,l=[],u=()=>{s.push(...l),l.length=0};for(let n=0;n<e.length;n++){let d=e[n];if(d.role===`system`){let e=o(d),n=[];if(e.length>0&&n.push({type:`text`,text:S(e)}),a){for(let e of d.toolsRemoved??[])n.push({type:`tool_removal`,tool:{type:`tool_reference`,name:t?Ys(e.name):e.name}});for(let e of d.toolsAdded??[])n.push({type:`tool_addition`,tool:{type:`tool_reference`,name:t?Ys(e.name):e.name}})}n.length>0&&l.push({role:`system`,content:n})}else if(d.role===`user`){if(typeof d.content==`string`)d.content.trim().length>0&&s.push({role:`user`,content:S(d.content)});else{let e=d.content.map(e=>e.type===`text`?{type:`text`,text:S(e.text)}:{type:`image`,source:{type:`base64`,media_type:e.mimeType,data:e.data}}).filter(e=>e.type!==`text`||e.text.trim().length>0);if(e.length===0)continue;s.push({role:`user`,content:e})}}else if(d.role===`assistant`){u();let e=[];for(let n of d.content)if(n.type===`text`){if(n.text.trim().length===0)continue;e.push({type:`text`,text:S(n.text)})}else if(n.type===`thinking`){if(n.redacted){e.push({type:`redacted_thinking`,data:n.thinkingSignature});continue}let t=n.thinkingSignature,i=!!t&&t.trim().length>0;if(n.thinking.trim().length===0&&!i)continue;i?e.push({type:`thinking`,thinking:S(n.thinking),signature:t}):e.push(r?{type:`thinking`,thinking:S(n.thinking),signature:``}:{type:`text`,text:S(n.thinking)})}else n.type===`toolCall`&&e.push({type:`tool_use`,id:n.id,name:t?Ys(n.name):n.name,input:n.arguments??{}});if(e.length===0)continue;let n=s.length;s.push({role:`assistant`,content:e}),i!==void 0&&d.api===`anthropic-messages`&&d.provider===i&&Oc(d.providerThinkingLevel)&&c.set(n,d.providerThinkingLevel)}else if(d.role===`toolResult`){let t=[],r=n;for(;r<e.length&&e[r].role===`toolResult`;)t.push(Ec(e[r])),r++;n=r-1,s.push({role:`user`,content:t})}}if(u(),n&&s.length>0){let e=s[s.length-1];if(e.role===`user`||e.role===`system`){if(Array.isArray(e.content)){let t=e.content[e.content.length-1];t&&(t.type===`text`||t.type===`image`||t.type===`tool_result`||t.type===`tool_addition`||t.type===`tool_removal`)&&(t.cache_control=n)}else typeof e.content==`string`&&(e.content=[{type:`text`,text:e.content,cache_control:n}])}}return{messages:s,assistantLevels:c}}function Oc(e){return e===`low`||e===`medium`||e===`high`||e===`xhigh`||e===`max`}function kc(e,t){let n=[];for(let t=0;t<e.messages.length;t++){let r=e.assistantLevels.get(t);r!==void 0&&n.push({role:`system`,content:[],output_config:{effort:r}}),n.push(e.messages[t])}return n.push({role:`system`,content:[],output_config:{effort:t}}),n}function Ac(e,t){return r(t.messages).length>0&&!oc(e).supportsEagerToolInputStreaming}function jc(e,t,n,r,i){return e?e.map((a,o)=>{let s=pe(a,r),c=ue(a,s),l=c,u={type:`object`,properties:l.properties??{},required:l.required??[]},d=s===!0?{...c,...u}:u;return{name:t?Ys(a.name):a.name,description:a.description,...n?{eager_input_streaming:!0}:{},...s===!0?{strict:!0}:{},input_schema:d,...i&&o===e.length-1?{cache_control:i}:{}}}):[]}function Mc(e,t){switch(e){case`end_turn`:return{stopReason:`stop`};case`max_tokens`:return{stopReason:`length`};case`tool_use`:return{stopReason:`toolUse`};case`refusal`:return{stopReason:`error`,errorMessage:t?.explanation||`The model refused to complete the request`};case`pause_turn`:return{stopReason:`stop`};case`stop_sequence`:return{stopReason:`stop`};case`sensitive`:return{stopReason:`error`,errorMessage:`Provider stopped with: sensitive`};default:throw Error(`Unhandled stop reason: ${e}`)}}export{xe as n,Se as r,vc as stream,bc as streamSimple,Ws as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.freeze(JSON.parse(`{"colors":{"activityBar.background":"#07090F","activityBar.foreground":"#86A5FF","activityBar.inactiveForeground":"#576dafc5","activityBarBadge.background":"#86A5FF","activityBarBadge.foreground":"#07090F","badge.background":"#86A5FF","badge.foreground":"#07090F","breadcrumb.activeSelectionForeground":"#86A5FF","breadcrumb.focusForeground":"#576daf","breadcrumb.foreground":"#576dafa6","breadcrumbPicker.background":"#07090F","button.background":"#86A5FF","button.foreground":"#07090F","button.hoverBackground":"#A8BEFF","descriptionForeground":"#576daf79","diffEditor.diagonalFill":"#15182B","diffEditor.insertedTextBackground":"#64d3892c","diffEditor.removedTextBackground":"#dd50742c","dropdown.background":"#15182B","dropdown.foreground":"#c7d5ff99","editor.background":"#07090F","editor.findMatchBackground":"#576daf","editor.findMatchHighlightBackground":"#262E47","editor.inactiveSelectionBackground":"#262e47be","editor.selectionBackground":"#262E47","editor.selectionHighlightBackground":"#262E47","editor.wordHighlightBackground":"#262E47","editor.wordHighlightStrongBackground":"#262E47","editorCodeLens.foreground":"#262E47","editorCursor.background":"#01030b","editorCursor.foreground":"#86A5FF","editorGroup.background":"#07090F","editorGroup.border":"#15182B","editorGroup.dropBackground":"#0C0E19","editorGroup.emptyBackground":"#07090F","editorGroupHeader.tabsBackground":"#07090F","editorLineNumber.activeForeground":"#576dafd8","editorLineNumber.foreground":"#262e47bb","editorWidget.background":"#15182B","editorWidget.border":"#576daf","extensionButton.prominentBackground":"#C7D5FF","extensionButton.prominentForeground":"#07090F","focusBorder":"#262E47","foreground":"#576daf","gitDecoration.addedResourceForeground":"#64d389fd","gitDecoration.deletedResourceForeground":"#dd5074","gitDecoration.ignoredResourceForeground":"#576daf90","gitDecoration.modifiedResourceForeground":"#c778db","gitDecoration.untrackedResourceForeground":"#576daf90","icon.foreground":"#576daf","input.background":"#15182B","input.foreground":"#86A5FF","inputOption.activeForeground":"#86A5FF","inputValidation.errorBackground":"#dd5073","inputValidation.errorBorder":"#dd5073","inputValidation.errorForeground":"#07090F","list.activeSelectionBackground":"#000000","list.activeSelectionForeground":"#86A5FF","list.dropBackground":"#000000","list.errorForeground":"#dd5074","list.focusBackground":"#01030b","list.focusForeground":"#86A5FF","list.highlightForeground":"#A8BEFF","list.hoverBackground":"#000000","list.hoverForeground":"#A8BEFF","list.inactiveFocusBackground":"#01030b","list.inactiveSelectionBackground":"#000000","list.inactiveSelectionForeground":"#86A5FF","list.warningForeground":"#e6db7f","notificationCenterHeader.background":"#15182B","notifications.background":"#15182B","panel.border":"#15182B","panelTitle.activeBorder":"#86A5FF","panelTitle.activeForeground":"#C7D5FF","panelTitle.inactiveForeground":"#576daf","peekViewTitle.background":"#262E47","quickInput.background":"#0C0E19","scrollbar.shadow":"#01030b","scrollbarSlider.activeBackground":"#576daf","scrollbarSlider.background":"#262E47","scrollbarSlider.hoverBackground":"#576daf","selection.background":"#01030b","sideBar.background":"#07090F","sideBar.border":"#15182B","sideBarSectionHeader.background":"#07090F","sideBarSectionHeader.foreground":"#86A5FF","statusBar.background":"#86A5FF","statusBar.debuggingBackground":"#c778db","statusBar.foreground":"#07090F","tab.activeBackground":"#07090F","tab.activeBorder":"#86A5FF","tab.activeForeground":"#C7D5FF","tab.border":"#07090F","tab.inactiveBackground":"#07090F","tab.inactiveForeground":"#576dafd8","terminal.ansiBrightRed":"#dd5073","terminal.ansiGreen":"#63eb90","terminal.ansiRed":"#dd5073","terminal.foreground":"#A8BEFF","textLink.foreground":"#86A5FF","titleBar.activeBackground":"#07090F","titleBar.activeForeground":"#86A5FF","titleBar.inactiveBackground":"#07090F","tree.indentGuidesStroke":"#576daf","widget.shadow":"#01030b"},"displayName":"Aurora X","name":"aurora-x","tokenColors":[{"scope":["comment","punctuation.definition.comment"],"settings":{"fontStyle":"italic","foreground":"#546E7A"}},{"scope":["variable","string constant.other.placeholder"],"settings":{"foreground":"#EEFFFF"}},{"scope":["constant.other.color"],"settings":{"foreground":"#ffffff"}},{"scope":["invalid","invalid.illegal"],"settings":{"foreground":"#FF5370"}},{"scope":["keyword","storage.type","storage.modifier"],"settings":{"foreground":"#C792EA"}},{"scope":["keyword.control","constant.other.color","punctuation","meta.tag","punctuation.definition.tag","punctuation.separator.inheritance.php","punctuation.definition.tag.html","punctuation.definition.tag.begin.html","punctuation.definition.tag.end.html","punctuation.section.embedded","keyword.other.template","keyword.other.substitution"],"settings":{"foreground":"#89DDFF"}},{"scope":["entity.name.tag","meta.tag.sgml","markup.deleted.git_gutter"],"settings":{"foreground":"#f07178"}},{"scope":["entity.name.function","meta.function-call","variable.function","support.function","keyword.other.special-method"],"settings":{"foreground":"#82AAFF"}},{"scope":["meta.block variable.other"],"settings":{"foreground":"#f07178"}},{"scope":["support.other.variable","string.other.link"],"settings":{"foreground":"#f07178"}},{"scope":["constant.numeric","constant.language","support.constant","constant.character","constant.escape","variable.parameter","keyword.other.unit","keyword.other"],"settings":{"foreground":"#F78C6C"}},{"scope":["string","constant.other.symbol","constant.other.key","entity.other.inherited-class","markup.heading","markup.inserted.git_gutter","meta.group.braces.curly constant.other.object.key.js string.unquoted.label.js"],"settings":{"foreground":"#C3E88D"}},{"scope":["entity.name","support.type","support.class","support.orther.namespace.use.php","meta.use.php","support.other.namespace.php","markup.changed.git_gutter","support.type.sys-types"],"settings":{"foreground":"#FFCB6B"}},{"scope":["support.type"],"settings":{"foreground":"#B2CCD6"}},{"scope":["source.css support.type.property-name","source.sass support.type.property-name","source.scss support.type.property-name","source.less support.type.property-name","source.stylus support.type.property-name","source.postcss support.type.property-name"],"settings":{"foreground":"#B2CCD6"}},{"scope":["entity.name.module.js","variable.import.parameter.js","variable.other.class.js"],"settings":{"foreground":"#FF5370"}},{"scope":["variable.language"],"settings":{"fontStyle":"italic","foreground":"#FF5370"}},{"scope":["entity.name.method.js"],"settings":{"fontStyle":"italic","foreground":"#82AAFF"}},{"scope":["meta.class-method.js entity.name.function.js","variable.function.constructor"],"settings":{"foreground":"#82AAFF"}},{"scope":["entity.other.attribute-name"],"settings":{"foreground":"#C792EA"}},{"scope":["text.html.basic entity.other.attribute-name.html","text.html.basic entity.other.attribute-name"],"settings":{"fontStyle":"italic","foreground":"#FFCB6B"}},{"scope":["entity.other.attribute-name.class"],"settings":{"foreground":"#FFCB6B"}},{"scope":["source.sass keyword.control"],"settings":{"foreground":"#82AAFF"}},{"scope":["markup.inserted"],"settings":{"foreground":"#C3E88D"}},{"scope":["markup.deleted"],"settings":{"foreground":"#FF5370"}},{"scope":["markup.changed"],"settings":{"foreground":"#C792EA"}},{"scope":["string.regexp"],"settings":{"foreground":"#89DDFF"}},{"scope":["constant.character.escape"],"settings":{"foreground":"#89DDFF"}},{"scope":["*url*","*link*","*uri*"],"settings":{"fontStyle":"underline"}},{"scope":["tag.decorator.js entity.name.tag.js","tag.decorator.js punctuation.definition.tag.js"],"settings":{"fontStyle":"italic","foreground":"#82AAFF"}},{"scope":["source.js constant.other.object.key.js string.unquoted.label.js"],"settings":{"fontStyle":"italic","foreground":"#FF5370"}},{"scope":["source.json meta.structure.dictionary.json support.type.property-name.json"],"settings":{"foreground":"#C792EA"}},{"scope":["source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],"settings":{"foreground":"#FFCB6B"}},{"scope":["source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],"settings":{"foreground":"#F78C6C"}},{"scope":["source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],"settings":{"foreground":"#FF5370"}},{"scope":["source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],"settings":{"foreground":"#C17E70"}},{"scope":["source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],"settings":{"foreground":"#82AAFF"}},{"scope":["source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],"settings":{"foreground":"#f07178"}},{"scope":["source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],"settings":{"foreground":"#C792EA"}},{"scope":["source.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json meta.structure.dictionary.value.json meta.structure.dictionary.json support.type.property-name.json"],"settings":{"foreground":"#C3E88D"}},{"scope":["text.html.markdown","punctuation.definition.list_item.markdown"],"settings":{"foreground":"#EEFFFF"}},{"scope":["text.html.markdown markup.inline.raw.markdown"],"settings":{"foreground":"#C792EA"}},{"scope":["text.html.markdown markup.inline.raw.markdown punctuation.definition.raw.markdown"],"settings":{"foreground":"#65737E"}},{"scope":["markdown.heading","markup.heading | markup.heading entity.name","markup.heading.markdown punctuation.definition.heading.markdown"],"settings":{"foreground":"#C3E88D"}},{"scope":["markup.italic"],"settings":{"fontStyle":"italic","foreground":"#f07178"}},{"scope":["markup.bold","markup.bold string"],"settings":{"fontStyle":"bold","foreground":"#f07178"}},{"scope":["markup.bold markup.italic","markup.italic markup.bold","markup.quote markup.bold","markup.bold markup.italic string","markup.italic markup.bold string","markup.quote markup.bold string"],"settings":{"fontStyle":"bold","foreground":"#f07178"}},{"scope":["markup.underline"],"settings":{"fontStyle":"underline","foreground":"#F78C6C"}},{"scope":["markup.quote punctuation.definition.blockquote.markdown"],"settings":{"foreground":"#65737E"}},{"scope":["markup.quote"],"settings":{"fontStyle":"italic"}},{"scope":["string.other.link.title.markdown"],"settings":{"foreground":"#82AAFF"}},{"scope":["string.other.link.description.title.markdown"],"settings":{"foreground":"#C792EA"}},{"scope":["constant.other.reference.link.markdown"],"settings":{"foreground":"#FFCB6B"}},{"scope":["markup.raw.block"],"settings":{"foreground":"#C792EA"}},{"scope":["markup.raw.block.fenced.markdown"],"settings":{"foreground":"#00000050"}},{"scope":["punctuation.definition.fenced.markdown"],"settings":{"foreground":"#00000050"}},{"scope":["markup.raw.block.fenced.markdown","variable.language.fenced.markdown","punctuation.section.class.end"],"settings":{"foreground":"#EEFFFF"}},{"scope":["variable.language.fenced.markdown"],"settings":{"foreground":"#65737E"}},{"scope":["meta.separator"],"settings":{"fontStyle":"bold","foreground":"#65737E"}},{"scope":["markup.table"],"settings":{"foreground":"#EEFFFF"}}],"type":"dark"}`));export{e as default};
|