@shumai-one/shumai 0.3.2 → 0.3.4
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/bin/{chunk-qmtvy2j4.js → chunk-03pw611p.js} +2 -2
- package/bin/{chunk-1nh6xgek.js → chunk-05m8w09t.js} +1 -1
- package/bin/chunk-0ark0qrm.js +1 -0
- package/bin/{chunk-arpna31w.js → chunk-1apsnd7e.js} +1 -1
- package/bin/{chunk-g2dk56e7.js → chunk-1bfrnc6b.js} +1 -1
- package/bin/chunk-21h9kgp5.js +1 -0
- package/bin/{chunk-na2nympm.js → chunk-2967rnmn.js} +1 -1
- package/bin/chunk-2errtbmb.js +2 -0
- package/bin/{chunk-hrzm70wg.js → chunk-2jnyk045.js} +1 -1
- package/bin/{chunk-etces6ff.js → chunk-2mr99scd.js} +2 -2
- package/bin/chunk-2pxev94x.js +2 -0
- package/bin/chunk-2y9t0qxp.js +45 -0
- package/bin/{chunk-s7qpj715.js → chunk-2ydhnafa.js} +2 -2
- package/bin/chunk-38hp9gfh.js +2 -0
- package/bin/chunk-3t7v2de9.js +307 -0
- package/bin/{chunk-20y3wte3.js → chunk-3vbx3x11.js} +2 -2
- package/bin/{chunk-d3s00sn0.js → chunk-3xfhbvar.js} +2 -2
- package/bin/chunk-4153rke8.js +12 -0
- package/bin/{chunk-7jjc175m.js → chunk-4a185tez.js} +3 -3
- package/bin/{chunk-zxpef55w.js → chunk-4rexdetz.js} +3 -3
- package/bin/{chunk-1dawjfk8.js → chunk-58y9bagr.js} +2 -2
- package/bin/chunk-5dqn7egd.js +11 -0
- package/bin/{chunk-9p2d0mk1.js → chunk-5e48saab.js} +1 -1
- package/bin/{chunk-vnfmh5ke.js → chunk-5qwzveck.js} +2 -2
- package/bin/chunk-61hfhfce.js +2 -0
- package/bin/chunk-6ab9eftx.js +3 -0
- package/bin/chunk-6b0f3d07.js +2 -0
- package/bin/chunk-6gjn8trh.js +3 -0
- package/bin/{chunk-gn8snrnk.js → chunk-75x3w5hx.js} +1 -1
- package/bin/chunk-7e39zmss.js +1 -0
- package/bin/chunk-7h1m1e0b.js +1 -0
- package/bin/chunk-7kdz1eng.js +3 -0
- package/bin/chunk-7pcba64w.js +1 -0
- package/bin/{chunk-s05f0v9t.js → chunk-7xfx7741.js} +1 -1
- package/bin/chunk-898hrxwq.js +2 -0
- package/bin/{chunk-ph3e1bpp.js → chunk-89chaa11.js} +2 -2
- package/bin/chunk-8btfb5g6.js +2 -0
- package/bin/{chunk-gvn079hy.js → chunk-8pa1n500.js} +2 -2
- package/bin/{chunk-vy24ncn2.js → chunk-8qe7cpbr.js} +1 -1
- package/bin/{chunk-ws07a9kv.js → chunk-8tnq43k9.js} +1 -1
- package/bin/{chunk-1d22tysv.js → chunk-8wzepzp3.js} +2 -2
- package/bin/chunk-9deae0n7.js +3 -0
- package/bin/{chunk-3rcc5s99.js → chunk-ankkm2wz.js} +2 -2
- package/bin/chunk-ardp3pze.js +2 -0
- package/bin/chunk-axe5rq99.js +7 -0
- package/bin/chunk-bagxeg82.js +2 -0
- package/bin/{chunk-ss45w8ks.js → chunk-bhqrqt97.js} +2 -2
- package/bin/chunk-bn1sts8x.js +3 -0
- package/bin/{chunk-31mjcykb.js → chunk-bpb0szs5.js} +2 -2
- package/bin/{chunk-tsncwscz.js → chunk-c1j58ekb.js} +2 -2
- package/bin/chunk-c4nenmry.js +2 -0
- package/bin/chunk-c9f6n4sf.js +3 -0
- package/bin/chunk-cwh21vfb.js +2 -0
- package/bin/chunk-cwpmf8tx.js +2 -0
- package/bin/{chunk-ejfmxjw6.js → chunk-d2xrh0vv.js} +2 -2
- package/bin/chunk-d4sg0z3y.js +2 -0
- package/bin/chunk-d4sjezbk.js +8 -0
- package/bin/{chunk-vgb8bzcg.js → chunk-ddfx823h.js} +2 -2
- package/bin/chunk-dtjx1097.js +2 -0
- package/bin/chunk-e32bzfza.js +1 -0
- package/bin/chunk-e6rmqgzv.js +2 -0
- package/bin/chunk-ersxsrz8.js +62 -0
- package/bin/chunk-gg1wfpm8.js +3 -0
- package/bin/{chunk-qc6dmzn0.js → chunk-gg8dmkwd.js} +2 -2
- package/bin/chunk-gnx9g8px.js +2 -0
- package/bin/{chunk-xawwxdq9.js → chunk-h0k9zw29.js} +2 -2
- package/bin/chunk-htrzgs2a.css +1 -0
- package/bin/chunk-j2jdrmaa.js +2 -0
- package/bin/{chunk-v2kfr8fx.js → chunk-j5dejr3e.js} +2 -2
- package/bin/{chunk-wap08p4j.js → chunk-j5q3t199.js} +2 -2
- package/bin/chunk-jgxhv36z.js +3 -0
- package/bin/{chunk-dwswqq3g.js → chunk-jnx8p6kj.js} +1 -1
- package/bin/chunk-k41vt2gq.js +1 -0
- package/bin/chunk-k78m3rar.js +2 -0
- package/bin/chunk-kfbztymc.js +4 -0
- package/bin/chunk-kgr3ytpb.js +5 -0
- package/bin/chunk-khc3dydj.js +2 -0
- package/bin/chunk-krpr6g8a.js +1 -0
- package/bin/chunk-m8tnsds1.js +2 -0
- package/bin/chunk-mfmcsdd7.js +1 -0
- package/bin/chunk-msjv1ykh.js +2 -0
- package/bin/chunk-n73dbqps.js +1 -0
- package/bin/{chunk-5vqan9c4.js → chunk-n7cmya8k.js} +2 -2
- package/bin/{chunk-hfp4hpca.js → chunk-nabagpah.js} +2 -2
- package/bin/chunk-nn5qpr0q.js +1 -0
- package/bin/{chunk-ve7v8wtv.js → chunk-pew69nxg.js} +2 -2
- package/bin/{chunk-7eycsyk6.js → chunk-q2shr586.js} +1 -1
- package/bin/chunk-q7v8sj72.js +1 -0
- package/bin/chunk-q9tm2d21.js +8 -0
- package/bin/{chunk-mcxsk75h.js → chunk-qw5yjhab.js} +3 -3
- package/bin/{chunk-j0p1peav.js → chunk-r9thyg31.js} +2 -2
- package/bin/{chunk-h2wsm7h3.js → chunk-s584wxzj.js} +2 -2
- package/bin/{chunk-wr5byz6r.js → chunk-s5s1rk4n.js} +1 -1
- package/bin/{chunk-zs9b0f3z.js → chunk-scfbmsy7.js} +2 -2
- package/bin/{chunk-k20bhxed.js → chunk-sddrv3ep.js} +1 -1
- package/bin/{chunk-amsb41z5.js → chunk-sfmhbk59.js} +1 -1
- package/bin/chunk-tbdgkpgw.js +2 -0
- package/bin/chunk-twhj7h73.js +1 -0
- package/bin/{chunk-mahxw48e.js → chunk-v5zdafv4.js} +2 -2
- package/bin/{chunk-3t7mjvdv.js → chunk-vzx1r87y.js} +2 -2
- package/bin/{chunk-a76c5r3c.js → chunk-w3xzd86e.js} +2 -2
- package/bin/{chunk-nzy3pjjm.js → chunk-xkh6b42h.js} +2 -2
- package/bin/chunk-yn7mxpmb.js +7 -0
- package/bin/{chunk-yahb7wan.js → chunk-z544s59c.js} +2 -2
- package/bin/{chunk-f8cn9m28.js → chunk-zned6mj8.js} +1 -1
- package/bin/{chunk-08mxv0sm.js → chunk-zpq34g0w.js} +2 -2
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +495 -372
- package/package.json +7 -7
- package/prisma/migrations/20260801065040_add_audit_log/migration.sql +33 -0
- package/prisma/migrations/20260805021613_add_asset_autofill_context/migration.sql +2 -0
- package/prisma/migrations/20260806082136_add_sharelink_watermark/migration.sql +69 -0
- package/prisma/migrations/20260806085643_add_watermark_file_status/migration.sql +7 -0
- package/prisma/migrations/20260807140837_clean_media_remove_raw_transcodes_and_original_download_url/migration.sql +86 -0
- package/prisma/migrations/20260808014542_add_sharelink_allow_download/migration.sql +2 -0
- package/prisma/schema.prisma +93 -0
- package/bin/chunk-08dr94gp.js +0 -2
- package/bin/chunk-0t4z17qr.js +0 -2
- package/bin/chunk-2ynx0den.js +0 -8
- package/bin/chunk-31a3k77j.js +0 -2
- package/bin/chunk-3jdef7n4.js +0 -6
- package/bin/chunk-4ahve1nf.js +0 -2
- package/bin/chunk-4hdnrwh1.js +0 -1
- package/bin/chunk-4hdx2tv0.js +0 -2
- package/bin/chunk-4htdb0xp.js +0 -1
- package/bin/chunk-4p7xpfey.js +0 -2
- package/bin/chunk-5f81c951.js +0 -1
- package/bin/chunk-5zntjzxw.js +0 -3
- package/bin/chunk-6a2eb3b5.js +0 -3
- package/bin/chunk-6t3gdd7e.js +0 -2
- package/bin/chunk-7d5kep8c.js +0 -2
- package/bin/chunk-7kzqkp5z.js +0 -1
- package/bin/chunk-7sh6409h.js +0 -1
- package/bin/chunk-7y8dng8t.js +0 -2
- package/bin/chunk-8e5zvy88.js +0 -307
- package/bin/chunk-8m6zg15c.js +0 -4
- package/bin/chunk-8qyke29r.js +0 -7
- package/bin/chunk-90et6bwm.js +0 -3
- package/bin/chunk-9c7fxjej.js +0 -2
- package/bin/chunk-a10tf0d8.js +0 -3
- package/bin/chunk-b10meywb.js +0 -2
- package/bin/chunk-b1e3tec3.js +0 -62
- package/bin/chunk-bdjhb77e.js +0 -2
- package/bin/chunk-beay9amy.js +0 -1
- package/bin/chunk-c3fvs0bv.js +0 -4
- package/bin/chunk-c5my1b3k.js +0 -7
- package/bin/chunk-dhekxndw.js +0 -3
- package/bin/chunk-dwaj1yn4.js +0 -2
- package/bin/chunk-er1rb6yj.js +0 -1
- package/bin/chunk-etqpzc9e.js +0 -3
- package/bin/chunk-fdpjw17x.js +0 -7
- package/bin/chunk-gqh4ttjh.js +0 -3
- package/bin/chunk-hz31j0hk.js +0 -4
- package/bin/chunk-jm6bxtzt.js +0 -41
- package/bin/chunk-jstc7pka.js +0 -2
- package/bin/chunk-k0a35mg9.js +0 -2
- package/bin/chunk-k9w6mk9d.js +0 -3
- package/bin/chunk-kgb16ggd.css +0 -1
- package/bin/chunk-m4py21f3.js +0 -2
- package/bin/chunk-mm1j72a8.js +0 -7
- package/bin/chunk-nr89225z.js +0 -2
- package/bin/chunk-nrf5r23d.js +0 -1
- package/bin/chunk-nt9tfjx6.js +0 -12
- package/bin/chunk-p396vw9h.js +0 -8
- package/bin/chunk-p9xfyqh1.js +0 -2
- package/bin/chunk-pj0fgb2x.js +0 -6
- package/bin/chunk-pp072ksj.js +0 -2
- package/bin/chunk-q5cdjzbv.js +0 -3
- package/bin/chunk-qn96vbke.js +0 -2
- package/bin/chunk-qvgc9e08.js +0 -3
- package/bin/chunk-rrxjvewm.js +0 -2
- package/bin/chunk-s5rfya1p.js +0 -1
- package/bin/chunk-scsy69bp.js +0 -1
- package/bin/chunk-sf6fwvrs.js +0 -8
- package/bin/chunk-t2txvzkp.js +0 -3
- package/bin/chunk-td54rdfj.js +0 -8
- package/bin/chunk-vb9m47z9.js +0 -1
- package/bin/chunk-vf066xwh.js +0 -3
- package/bin/chunk-w3a50kz8.js +0 -3
- package/bin/chunk-w9w5301f.js +0 -4
- package/bin/chunk-wny0qagx.js +0 -3
- package/bin/chunk-wqhk76de.js +0 -14
- package/bin/chunk-wrz9e73c.js +0 -2
- package/bin/chunk-x5dcgk62.js +0 -6
- package/bin/chunk-xwmsxg5x.js +0 -1
- package/bin/chunk-y2nw8rbx.js +0 -4
- package/bin/chunk-y9ttm07y.js +0 -3
- package/bin/chunk-z0ej44ak.js +0 -3
- package/bin/chunk-zemgtnk0.js +0 -1
- package/bin/chunk-zg0vm233.js +0 -2
- package/bin/chunk-zhd2mkbr.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
async function q(j){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText==="function")try{return await navigator.clipboard.writeText(j),!0}catch{}try{let h=document.createElement("textarea");h.value=j,h.style.position="fixed",h.style.top="0",h.style.left="0",h.style.width="2em",h.style.height="2em",h.style.padding="0",h.style.border="none",h.style.outline="none",h.style.boxShadow="none",h.style.background="transparent",h.style.opacity="0",document.body.appendChild(h),h.focus(),h.select();let p=document.execCommand("copy");return document.body.removeChild(h),p}catch(h){return console.error("Failed to copy text to clipboard:",h),!1}}
|
|
2
|
-
export{q as
|
|
2
|
+
export{q as db};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as q}from"./chunk-dtjx1097.js";import"./chunk-cwh21vfb.js";import"./chunk-3t7v2de9.js";import"./chunk-xkh6b42h.js";import"./chunk-yn7mxpmb.js";import"./chunk-8btfb5g6.js";import"./chunk-d4sg0z3y.js";import"./chunk-k78m3rar.js";import"./chunk-m8tnsds1.js";import"./chunk-bpb0szs5.js";import"./chunk-6b0f3d07.js";import"./chunk-cwpmf8tx.js";import"./chunk-2pxev94x.js";import"./chunk-nabagpah.js";import"./chunk-05m8w09t.js";import"./chunk-ankkm2wz.js";import"./chunk-3vbx3x11.js";import"./chunk-msjv1ykh.js";import"./chunk-bagxeg82.js";import"./chunk-vzx1r87y.js";import"./chunk-gg1wfpm8.js";import"./chunk-2mr99scd.js";import"./chunk-z544s59c.js";import"./chunk-898hrxwq.js";import"./chunk-j5q3t199.js";import"./chunk-d2xrh0vv.js";import"./chunk-s584wxzj.js";import"./chunk-c1j58ekb.js";import"./chunk-v5zdafv4.js";import"./chunk-38hp9gfh.js";import{Bg as f,Tg as k}from"./chunk-ersxsrz8.js";import"./chunk-8tnq43k9.js";function w(){let{shareId:v}=A.useParams();return f(q,{shareId:v})}var A=k("/share/$shareId/")({component:w});export{A as Route};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Kk as q,Ok as M}from"./chunk-8tnq43k9.js";var GG=q((xK,e)=>{var y=1000,f=y*60,x=f*60,I=x*24,CG=I*7,IG=I*365.25;e.exports=function(G,Q){Q=Q||{};var K=typeof G;if(K==="string"&&G.length>0)return _G(G);else if(K==="number"&&isFinite(G))return Q.long?yG(G):DG(G);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(G))};function _G(G){if(G=String(G),G.length>100)return;var Q=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(G);if(!Q)return;var K=parseFloat(Q[1]),V=(Q[2]||"ms").toLowerCase();switch(V){case"years":case"year":case"yrs":case"yr":case"y":return K*IG;case"weeks":case"week":case"w":return K*CG;case"days":case"day":case"d":return K*I;case"hours":case"hour":case"hrs":case"hr":case"h":return K*x;case"minutes":case"minute":case"mins":case"min":case"m":return K*f;case"seconds":case"second":case"secs":case"sec":case"s":return K*y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return K;default:return}}function DG(G){var Q=Math.abs(G);if(Q>=I)return Math.round(G/I)+"d";if(Q>=x)return Math.round(G/x)+"h";if(Q>=f)return Math.round(G/f)+"m";if(Q>=y)return Math.round(G/y)+"s";return G+"ms"}function yG(G){var Q=Math.abs(G);if(Q>=I)return u(G,Q,I,"day");if(Q>=x)return u(G,Q,x,"hour");if(Q>=f)return u(G,Q,f,"minute");if(Q>=y)return u(G,Q,y,"second");return G+" ms"}function u(G,Q,K,V){var Z=Q>=K*1.5;return Math.round(G/K)+" "+V+(Z?"s":"")}});var m=q((hK,KG)=>{function fG(G){K.debug=K,K.default=K,K.coerce=L,K.disable=J,K.enable=Z,K.enabled=N,K.humanize=GG(),K.destroy=v,Object.keys(G).forEach(($)=>{K[$]=G[$]}),K.names=[],K.skips=[],K.formatters={};function Q($){let w=0;for(let W=0;W<$.length;W++)w=(w<<5)-w+$.charCodeAt(W),w|=0;return K.colors[Math.abs(w)%K.colors.length]}K.selectColor=Q;function K($){let w,W=null,Y,R;function B(...X){if(!B.enabled)return;let T=B,j=Number(new Date),A=j-(w||j);if(T.diff=A,T.prev=w,T.curr=j,w=j,X[0]=K.coerce(X[0]),typeof X[0]!=="string")X.unshift("%O");let F=0;X[0]=X[0].replace(/%([a-zA-Z%])/g,(C,D)=>{if(C==="%%")return"%";F++;let s=K.formatters[D];if(typeof s==="function"){let AG=X[F];C=s.call(T,AG),X.splice(F,1),F--}return C}),K.formatArgs.call(T,X),(T.log||K.log).apply(T,X)}if(B.namespace=$,B.useColors=K.useColors(),B.color=K.selectColor($),B.extend=V,B.destroy=K.destroy,Object.defineProperty(B,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(W!==null)return W;if(Y!==K.namespaces)Y=K.namespaces,R=K.enabled($);return R},set:(X)=>{W=X}}),typeof K.init==="function")K.init(B);return B}function V($,w){let W=K(this.namespace+(typeof w>"u"?":":w)+$);return W.log=this.log,W}function Z($){K.save($),K.namespaces=$,K.names=[],K.skips=[];let w=(typeof $==="string"?$:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let W of w)if(W[0]==="-")K.skips.push(W.slice(1));else K.names.push(W)}function z($,w){let W=0,Y=0,R=-1,B=0;while(W<$.length)if(Y<w.length&&(w[Y]===$[W]||w[Y]==="*"))if(w[Y]==="*")R=Y,B=W,Y++;else W++,Y++;else if(R!==-1)Y=R+1,B++,W=B;else return!1;while(Y<w.length&&w[Y]==="*")Y++;return Y===w.length}function J(){let $=[...K.names,...K.skips.map((w)=>"-"+w)].join(",");return K.enable(""),$}function N($){for(let w of K.skips)if(z($,w))return!1;for(let w of K.names)if(z($,w))return!0;return!1}function L($){if($ instanceof Error)return $.stack||$.message;return $}function v(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return K.enable(K.load()),K}KG.exports=fG});var VG=q((QG,g)=>{QG.formatArgs=hG;QG.save=vG;QG.load=bG;QG.useColors=xG;QG.storage=iG();QG.destroy=(()=>{let G=!1;return()=>{if(!G)G=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();QG.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function xG(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let G;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(G=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(G[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function hG(G){if(G[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+G[0]+(this.useColors?"%c ":" ")+"+"+g.exports.humanize(this.diff),!this.useColors)return;let Q="color: "+this.color;G.splice(1,0,Q,"color: inherit");let K=0,V=0;G[0].replace(/%[a-zA-Z%]/g,(Z)=>{if(Z==="%%")return;if(K++,Z==="%c")V=K}),G.splice(V,0,Q)}QG.log=console.debug||console.log||(()=>{});function vG(G){try{if(G)QG.storage.setItem("debug",G);else QG.storage.removeItem("debug")}catch(Q){}}function bG(){let G;try{G=QG.storage.getItem("debug")||QG.storage.getItem("DEBUG")}catch(Q){}if(!G&&typeof process<"u"&&"env"in process)G=process.env.DEBUG;return G}function iG(){try{return localStorage}catch(G){}}g.exports=m()(QG);var{formatters:kG}=g.exports;kG.j=function(G){try{return JSON.stringify(G)}catch(Q){return"[UnexpectedJSONParseError]: "+Q.message}}});var $G=q((bK,ZG)=>{ZG.exports=(G,Q=process.argv)=>{let K=G.startsWith("-")?"":G.length===1?"-":"--",V=Q.indexOf(K+G),Z=Q.indexOf("--");return V!==-1&&(Z===-1||V<Z)}});var JG=q((iK,zG)=>{var mG=M("os"),wG=M("tty"),O=$G(),{env:U}=process,d;if(O("no-color")||O("no-colors")||O("color=false")||O("color=never"))d=0;else if(O("color")||O("colors")||O("color=true")||O("color=always"))d=1;function rG(){if("FORCE_COLOR"in U){if(U.FORCE_COLOR==="true")return 1;if(U.FORCE_COLOR==="false")return 0;return U.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(U.FORCE_COLOR,10),3)}}function aG(G){if(G===0)return!1;return{level:G,hasBasic:!0,has256:G>=2,has16m:G>=3}}function oG(G,{streamIsTTY:Q,sniffFlags:K=!0}={}){let V=rG();if(V!==void 0)d=V;let Z=K?d:V;if(Z===0)return 0;if(K){if(O("color=16m")||O("color=full")||O("color=truecolor"))return 3;if(O("color=256"))return 2}if(G&&!Q&&Z===void 0)return 0;let z=Z||0;if(U.TERM==="dumb")return z;if(process.platform==="win32"){let J=mG.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in U){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((J)=>(J in U))||U.CI_NAME==="codeship")return 1;return z}if("TEAMCITY_VERSION"in U)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(U.TEAMCITY_VERSION)?1:0;if(U.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in U){let J=Number.parseInt((U.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(U.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(U.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(U.TERM))return 1;if("COLORTERM"in U)return 1;return z}function r(G,Q={}){let K=oG(G,{streamIsTTY:G&&G.isTTY,...Q});return aG(K)}zG.exports={supportsColor:r,stdout:r({isTTY:wG.isatty(1)}),stderr:r({isTTY:wG.isatty(2)})}});var BG=q((YG,l)=>{var tG=M("tty"),c=M("util");YG.init=ZK;YG.log=KK;YG.formatArgs=eG;YG.save=QK;YG.load=VK;YG.useColors=sG;YG.destroy=c.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");YG.colors=[6,2,3,4,5,1];try{let G=JG();if(G&&(G.stderr||G).level>=2)YG.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(G){}YG.inspectOpts=Object.keys(process.env).filter((G)=>{return/^debug_/i.test(G)}).reduce((G,Q)=>{let K=Q.substring(6).toLowerCase().replace(/_([a-z])/g,(Z,z)=>{return z.toUpperCase()}),V=process.env[Q];if(/^(yes|on|true|enabled)$/i.test(V))V=!0;else if(/^(no|off|false|disabled)$/i.test(V))V=!1;else if(V==="null")V=null;else V=Number(V);return G[K]=V,G},{});function sG(){return"colors"in YG.inspectOpts?Boolean(YG.inspectOpts.colors):tG.isatty(process.stderr.fd)}function eG(G){let{namespace:Q,useColors:K}=this;if(K){let V=this.color,Z="\x1B[3"+(V<8?V:"8;5;"+V),z=` ${Z};1m${Q} \x1B[0m`;G[0]=z+G[0].split(`
|
|
3
3
|
`).join(`
|
|
4
4
|
`+z),G.push(Z+"m+"+l.exports.humanize(this.diff)+"\x1B[0m")}else G[0]=GK()+Q+" "+G[0]}function GK(){if(YG.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function KK(...G){return process.stderr.write(c.formatWithOptions(YG.inspectOpts,...G)+`
|
|
5
5
|
`)}function QK(G){if(G)process.env.DEBUG=G;else delete process.env.DEBUG}function VK(){return process.env.DEBUG}function ZK(G){G.inspectOpts={};let Q=Object.keys(YG.inspectOpts);for(let K=0;K<Q.length;K++)G.inspectOpts[Q[K]]=YG.inspectOpts[Q[K]]}l.exports=m()(YG);var{formatters:WG}=l.exports;WG.o=function(G){return this.inspectOpts.colors=this.useColors,c.inspect(G,this.inspectOpts).split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{xc as J,yc as H}from"./chunk-8pa1n500.js";import{ld as P,md as V,nd as W}from"./chunk-zned6mj8.js";import"./chunk-8tnq43k9.js";var X=class{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(){}async releaseMigrationLock(){}get supportsOutput(){return!0}},Y=class{#h;#j=new $;#w;#z;constructor(h){this.#h={...h}}async init(){if(this.#w=this.#h.database,this.#z=new Z(this.#w),this.#h.onCreateConnection)await this.#h.onCreateConnection(this.#z)}async acquireConnection(){return await this.#j.lock(),this.#z}async beginTransaction(h){await h.executeQuery(H.raw("begin"))}async commitTransaction(h){await h.executeQuery(H.raw("commit"))}async rollbackTransaction(h){await h.executeQuery(H.raw("rollback"))}async releaseConnection(){this.#j.unlock()}async destroy(){this.#w?.close()}},Z=class{#h;constructor(h){this.#h=h}executeQuery(h){let{sql:w,parameters:z}=h,j=this.#h.prepare(w);return Promise.resolve({rows:j.all(z)})}async*streamQuery(){throw Error("Streaming query is not supported by SQLite driver.")}},$=class{#h;#j;async lock(){while(this.#h!==void 0)await this.#h;this.#h=new Promise((h)=>{this.#j=h})}unlock(){let h=this.#j;this.#h=void 0,this.#j=void 0,h?.()}},k=class{#h;constructor(h){this.#h=h}async getSchemas(){return[]}async getTables(h={withInternalKyselyTables:!1}){let w=this.#h.selectFrom("sqlite_schema").where("type","=","table").where("name","not like","sqlite_%").select("name").$castTo();if(!h.withInternalKyselyTables)w=w.where("name","!=",V).where("name","!=",W);let z=await w.execute();return Promise.all(z.map(({name:j})=>this.#j(j)))}async getMetadata(h){return{tables:await this.getTables(h)}}async#j(h){let w=this.#h,z=(await w.selectFrom("sqlite_master").where("name","=",h).select("sql").$castTo().execute())[0]?.sql?.split(/[\(\),]/)?.find((j)=>j.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.[0]?.replace(/["`]/g,"");return{name:h,columns:(await w.selectFrom(J`pragma_table_info(${h})`.as("table_info")).select(["name","type","notnull","dflt_value"]).execute()).map((j)=>({name:j.name,dataType:j.type,isNullable:!j.notnull,isAutoIncrementing:j.name===z,hasDefaultValue:j.dflt_value!=null})),isView:!0}}},K=class extends P{getCurrentParameterPlaceholder(){return"?"}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}},G=class{#h;constructor(h){this.#h={...h}}createDriver(){return new Y(this.#h)}createQueryCompiler(){return new K}createAdapter(){return new X}createIntrospector(h){return new k(h)}};export{G as BunSqliteDialect};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as RB,c as bB}from"./chunk-cwh21vfb.js";import{e as gB}from"./chunk-2errtbmb.js";import{i as LB,l as MB}from"./chunk-3t7v2de9.js";import"./chunk-xkh6b42h.js";import{I as NB}from"./chunk-8btfb5g6.js";import"./chunk-k78m3rar.js";import{Ia as DB}from"./chunk-bpb0szs5.js";import"./chunk-cwpmf8tx.js";import"./chunk-2pxev94x.js";import"./chunk-nabagpah.js";import"./chunk-ankkm2wz.js";import"./chunk-3vbx3x11.js";import{Pe as kB}from"./chunk-pew69nxg.js";import"./chunk-bagxeg82.js";import{sf as VB,tf as wB}from"./chunk-gg1wfpm8.js";import{uf as EB}from"./chunk-2mr99scd.js";import{vf as $B}from"./chunk-z544s59c.js";import"./chunk-898hrxwq.js";import"./chunk-j5q3t199.js";import"./chunk-c1j58ekb.js";import"./chunk-v5zdafv4.js";import{vg as PB}from"./chunk-38hp9gfh.js";import{Ag as zB,Bg as G,Bh as ZB,Cg as D,Dg as HB,Fj as yB,Gg as j,Ig as QB,Og as qB,Qg as YB,Tg as TB,_h as _B,dh as q,oh as p,xg as d,xj as UB,zg as XB}from"./chunk-ersxsrz8.js";import{Jk as KB}from"./chunk-8tnq43k9.js";var $=KB(XB(),1);var tB=({item:J})=>{if(J.preview?.thumbnailUrl)return G("img",{src:J.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(J.preview?.proxyType==="audio"||J.proxyType==="audio")return G("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:G(ZB,{className:"w-5 h-5 text-muted-foreground"})});return G("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:G(_B,{className:"w-5 h-5 text-muted-foreground"})})},OB=({projectId:J,currentAssetId:X,parentFolderId:Q,initialFiles:_,initialNextCursor:w})=>{let{ref:z,inView:k}=$B({threshold:0,rootMargin:"200px"}),T=$.useRef(null),N=$.useRef(!1),[O,y]=$.useState(_),[Z,R]=$.useState(w),[b,S]=$.useState(!!w),[L,P]=$.useState(!1);return $.useEffect(()=>{y(_),R(w),S(!!w),N.current=!1},[_,w]),$.useEffect(()=>{(async()=>{if(!Z||L||!k||!b)return;P(!0);try{let W=await q.api.folders[":folderId"].search.$post({param:{folderId:Q},json:{assetType:"file",after:Z,first:200,recursively:!1,conditions:[]}});if(!W.ok)throw Error("Failed to fetch next page");let g=await W.json(),M=g.data||[];y((f)=>[...f,...M]),R(g.pageInfo?.cursor||void 0),S(!!g.pageInfo?.cursor&&M.length>0)}catch(W){console.error("Error fetching next page:",W)}finally{P(!1)}})()},[k,Z,b,L,Q]),$.useEffect(()=>{N.current=!1},[X]),$.useEffect(()=>{if(O.some((W)=>W?.id===X)&&T.current&&!N.current)T.current.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}),N.current=!0},[O,X]),G("div",{className:"h-24 md:h-full w-full md:w-24 bg-gray-100 dark:bg-gray-950 flex flex-row md:flex-col flex-shrink-0 select-none",children:D("div",{className:"flex-1 overflow-x-auto overflow-y-hidden md:overflow-y-auto md:overflow-x-hidden px-4 md:px-0 py-2 md:py-4 flex flex-row md:flex-col items-center gap-3 no-scrollbar",children:[O.map((H)=>{if(!H)return null;let W=H.id===X;return G("div",{ref:H.id===X?T:null,className:"flex-shrink-0",children:G(YB,{to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:H.id},search:{version:void 0},className:UB("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block",W?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:G(tB,{item:H})})},H.id)}),b&&G("div",{ref:z,className:"px-2 md:px-0 py-2 md:py-4 flex justify-center items-center h-full md:w-full flex-shrink-0",children:L&&G(p,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};var Y=KB(XB(),1);function eB(){let{projectId:J,fileId:X}=WB.useParams(),Q=WB.useSearch(),_=Q.version,w=Q.start,z=_||X,k=Q.cmpLeft,T=Q.cmpRight,N=Q.cmpActive??"left",O=!!Q.compare&&!!k&&!!T,y=Y.useRef(null),{teamId:Z,ensureTeamIdForProject:R}=PB(),[b,S]=Y.useState(360),[L,P]=Y.useState([]),{fileViewRightSidebarCollapsed:H}=EB(),{isChatbotOpen:W}=wB(),[g,M]=Y.useState(0),[f,C]=Y.useState(null),[l,AB]=Y.useState(null),[xB,jB]=Y.useState(void 0),[A,I]=Y.useState({show:!1,files:[],nextCursor:void 0,folderId:void 0}),SB=q.api.files[":fileId"].metadata.$patch,{mutate:CB}=QB({mutationFn:async(B)=>{let K=await SB(B);if(!K.ok)throw Error("Failed to patch metadata");return await K.json()}}),hB=HB(),{members:FB,fetchMembers:n}=NB();Y.useEffect(()=>{R(J)},[J,R]),Y.useEffect(()=>{if(Z)n(Z,!0)},[Z,n]);let{data:o,isLoading:vB,isError:pB,isFetching:fB}=j({queryKey:["files",X],queryFn:async()=>{let B=await q.api.files[":fileId"].$get({param:{fileId:X}});if(!B.ok)throw Error("Failed to fetch stack");return await B.json()},enabled:!!Z,placeholderData:d}),{data:IB,isLoading:mB,isError:uB,isFetching:cB}=j({queryKey:["files",_],queryFn:async()=>{let B=await q.api.files[":fileId"].$get({param:{fileId:_}});if(!B.ok)throw Error("Failed to fetch version");return await B.json()},enabled:!!Z&&!!_,placeholderData:d}),{data:dB}=j({queryKey:["version_stacks",X,"versions"],queryFn:async()=>{let B=await q.api.version_stacks[":stackId"].versions.$get({param:{stackId:X}});if(!B.ok)throw Error("Failed to fetch versions");return await B.json()},enabled:!!J&&!!X&&(!!_||O)}),{data:x}=j({queryKey:["projects",J],queryFn:async()=>{let B=await q.api.projects[":projectId"].$get({param:{projectId:J}});if(!B.ok)throw Error("Failed to fetch project");return await B.json()}}),h=qB(),{setProjectState:a,clearProjectState:r}=VB(),lB=vB||!!_&&mB,nB=pB||!!_&&uB,oB=fB||!!_&&cB,U=IB||o,V=_?dB:o?.versionStack?.versions;Y.useEffect(()=>{if(U&&x&&Z)a({teamId:Z,projectId:J,projectName:x.name??"",ancestorFolders:U.ancestorFolders??[],currentAsset:{name:U.name,type:"file",version:V?V.find((B)=>B.id===z)?.version??V.length:void 0,proxyType:U.proxyType},isRootFolder:!1,fileId:X,downloadInfo:{originalKey:U.media?.original?.key,videoTranscodes:U.media?.videoTranscodes?.map((B)=>({key:B.key,width:B.width,height:B.height}))},versions:V,compareMode:O,canCompareVersions:(V?.length??0)>=2,onCompareVersions:()=>{let B=LB(V);if(!B)return;h({to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:X},search:(K)=>({...K,version:void 0,compare:!0,cmpLeft:B.left.id,cmpRight:B.right.id,cmpActive:"left"})})},onFolderClick:(B)=>{h({to:"/projects/$projectId/folders/$folderId",params:{projectId:J,folderId:B}})}});return()=>r()},[Z,J,x,U,V,z,X,O,a,r,h]);let E=U?.ancestorFolders?.[0]?.id??x?.rootFolder??"";if(Y.useEffect(()=>{if(!E||!z)return;if(A.folderId===E)return;let B=!0;return(async()=>{try{let F="",t=!1,e=[],BB=void 0;for(let GB=0;GB<5;GB++){let JB=await q.api.folders[":folderId"].search.$post({param:{folderId:E},json:{assetType:"file",after:F,first:200,recursively:!1,conditions:[]}});if(!JB.ok)throw Error("Failed to search parent folder for carousel");let v=await JB.json(),c=v.data||[];if(e.push(...c),c.some((sB)=>sB.id===z)){t=!0,BB=v.pageInfo?.cursor||void 0;break}if(!v.pageInfo?.cursor||c.length<200)break;F=v.pageInfo.cursor}if(B)if(t)I({show:!0,files:e,nextCursor:BB,folderId:E});else I({show:!1,files:[],nextCursor:void 0,folderId:E})}catch(F){if(console.error(F),B)I({show:!1,files:[],nextCursor:void 0,folderId:E})}})(),()=>{B=!1}},[E,z,A.folderId]),Y.useEffect(()=>{M(0),C(null),P([])},[U?.id]),Y.useEffect(()=>{C(null),P([])},[l?.id]),lB&&!U)return G(kB,{});if(nB||!U||!x||!Z)return G("div",{children:yB.file_not_found()});let m=O?l:U,i=m?.id??z,aB=(B,K)=>{if(!Z)return;CB({param:{fileId:i},json:[{key:B,value:K}]},{onSuccess:()=>{hB.invalidateQueries({queryKey:["files",i]})}})},u=(B)=>{h({to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:X},search:(K)=>({...K,...B})})},rB=()=>{u({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:N==="left"?k:T})},iB=(B)=>{C(B.id||null);let K=B.annotations;if(K&&K.length>0)P(K);else P([]);if(O){if(B.second!==null&&B.second!==void 0)jB({second:B.second,nonce:Date.now()});return}if(B.second!==null&&B.second!==void 0)y.current?.seekTo(B.second),y.current?.pause();else if(K&&K.length>0)y.current?.pause()},s=()=>{P([]),C(null)};return G("div",{className:"h-full flex flex-1 flex-col bg-background",children:D("div",{className:"h-full flex flex-1 overflow-hidden",children:[D("div",{className:"flex-1 relative",children:[oB&&!O&&G("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:G(p,{className:"h-8 w-8 animate-spin text-foreground"})}),O&&k&&T?G(bB,{versions:V??[],leftId:k,rightId:T,activeSide:N,annotations:L,seekRequest:xB,onActiveSideChange:(B)=>u({cmpActive:B}),onSwitchVersion:(B,K)=>u(B==="left"?{cmpLeft:K}:{cmpRight:K}),onExit:rB,onActiveAssetChange:AB,onPlay:s,onTimeUpdate:M}):G(RB,{file:U,mediaControllerRef:y,onPlay:s,onTimeUpdate:M,annotations:L,startTime:w,children:A.show&&G(OB,{projectId:J,currentAssetId:z,parentFolderId:E,initialFiles:A.files,initialNextCursor:A.nextCursor})})]}),(!H||W)&&D(zB,{children:[G(DB,{onResize:(B)=>{S((K)=>Math.max(300,Math.min(600,K-B)))},className:"hidden md:block"}),G("div",{style:{width:b},className:"flex-shrink-0 bg-background flex flex-col",children:W?G(gB,{projectId:J,contextAssetId:z}):G(MB,{teamId:Z,projectId:J,file:m,onSaveField:aB,members:FB,onCommentSelect:iB,currentTime:g,onTyping:()=>{if(O)return;y.current?.pause()},selectedCommentId:f,hideAnnotationControl:m?.proxyType==="audio"})})]})]})})}var WB=TB("/projects/$projectId/files/$fileId")({component:eB});export{WB as Route};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{xc as P,yc as J}from"./chunk-8pa1n500.js";import{ld as V,md as W,nd as X}from"./chunk-zned6mj8.js";import"./chunk-8tnq43k9.js";var Y=class{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(){}async releaseMigrationLock(){}get supportsOutput(){return!0}},Z=class{#h;#j=new k;#z;#H;constructor(h){this.#h={...h}}async init(){if(this.#z=this.#h.database,this.#H=new $(this.#z),this.#h.onCreateConnection)await this.#h.onCreateConnection(this.#H)}async acquireConnection(){return await this.#j.lock(),this.#H}async beginTransaction(h){await h.executeQuery(J.raw("begin"))}async commitTransaction(h){await h.executeQuery(J.raw("commit"))}async rollbackTransaction(h){await h.executeQuery(J.raw("rollback"))}async releaseConnection(){this.#j.unlock()}async destroy(){this.#z?.close()}},$=class{#h;constructor(h){this.#h=h}executeQuery(h){let{sql:z,parameters:H}=h,j=this.#h.prepare(z).all(...H);return Promise.resolve({rows:j})}async*streamQuery(){throw Error("Streaming query is not supported by SQLite driver.")}},k=class{#h;#j;async lock(){while(this.#h!==void 0)await this.#h;this.#h=new Promise((h)=>{this.#j=h})}unlock(){let h=this.#j;this.#h=void 0,this.#j=void 0,h?.()}},w=class{#h;constructor(h){this.#h=h}async getSchemas(){return[]}async getTables(h={withInternalKyselyTables:!1}){let z=this.#h.selectFrom("sqlite_schema").where("type","=","table").where("name","not like","sqlite_%").select("name").$castTo();if(!h.withInternalKyselyTables)z=z.where("name","!=",W).where("name","!=",X);let H=await z.execute();return Promise.all(H.map(({name:j})=>this.#j(j)))}async getMetadata(h){return{tables:await this.getTables(h)}}async#j(h){let z=this.#h,H=(await z.selectFrom("sqlite_master").where("name","=",h).select("sql").$castTo().execute())[0]?.sql?.split(/[\(\),]/)?.find((j)=>j.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.[0]?.replace(/["`]/g,"");return{name:h,columns:(await z.selectFrom(P`pragma_table_info(${h})`.as("table_info")).select(["name","type","notnull","dflt_value"]).execute()).map((j)=>({name:j.name,dataType:j.type,isNullable:!j.notnull,isAutoIncrementing:j.name===H,hasDefaultValue:j.dflt_value!=null})),isView:!0}}},K=class extends V{getCurrentParameterPlaceholder(){return"?"}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}},F=class{#h;constructor(h){this.#h={...h}}createDriver(){return new Z(this.#h)}createQueryCompiler(){return new K}createAdapter(){return new Y}createIntrospector(h){return new w(h)}};export{F as NodeSqliteDialect};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{m as p}from"./chunk-xkh6b42h.js";import{Ha as Uz}from"./chunk-bpb0szs5.js";import{Qa as Yz,Ra as Zz,Sa as _z,Ta as $z,Ua as Kz}from"./chunk-cwpmf8tx.js";import{bb as A}from"./chunk-nabagpah.js";import{tf as v}from"./chunk-gg1wfpm8.js";import{Wf as Jz}from"./chunk-j5q3t199.js";import{vg as Xz}from"./chunk-38hp9gfh.js";import{Ag as B,Bg as z,Cg as J,Dg as a,Eh as M,Fh as s,Fi as zz,Fj as Y,Gg as n,Kh as b,Ui as S,bj as Gz,dh as r,gi as h,oh as o,xh as t,xj as T,zg as Bz,zh as e}from"./chunk-ersxsrz8.js";import{Jk as Rz}from"./chunk-8tnq43k9.js";var _=Rz(Bz(),1);function uz({projectId:O,contextAssetId:R}){let{isHistoryMode:W,setIsHistoryMode:I,currentSessionId:Vz,chatAssets:u,removeAsset:Wz,messages:E,historySessions:g,isStreaming:D,fetchHistorySessions:m,loadSession:Lz,deleteSession:Nz,startNewSession:Qz,sendMessage:Pz,abortActiveSession:Oz,selectedAgentId:H,setSelectedAgentId:w,inputText:C,setInputText:l}=v(),{teamId:Z,ensureTeamIdForProject:j}=Xz();_.useEffect(()=>{if(O)j(O)},[O,j]);let{data:Dz=[]}=n({queryKey:["agents",Z],queryFn:async()=>{if(!Z)return[];let G=await r.api.teams[":teamId"].agents.$get({param:{teamId:Z}});if(!G.ok)throw Error("failed to fetch agents");return G.json()},enabled:!!Z}),F=Dz.filter((G)=>G.type==="chat"&&G.enabled);_.useEffect(()=>{if(F.length>0){if(!F.some((X)=>X.id===H))w(F[0].id)}},[F,H,w]);let d=_.useRef(null),y=_.useRef(null),k=_.useRef(!0),f=_.useRef(!0);_.useEffect(()=>{f.current=!0,k.current=!0},[O,R,W]),_.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let{scrollTop:X,isAtBottom:$}=v.getState(),V=setTimeout(()=>{if($)G.scrollTop=G.scrollHeight;else G.scrollTop=X;let Q=setTimeout(()=>{f.current=!1},50);return()=>clearTimeout(Q)},0);return()=>clearTimeout(V)},[O,R,W]),_.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let X=()=>{if(f.current)return;let $=G.scrollTop,V=G.scrollHeight-$-G.clientHeight<10;v.getState().setScrollState($,V)};return G.addEventListener("scroll",X),()=>{G.removeEventListener("scroll",X)}},[O,R,W]);let{ref:qz,isDropTarget:Ez}=Uz({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});_.useEffect(()=>{if(!W){let{isAtBottom:G}=v.getState();if(G||D){let X=k.current?"auto":"smooth";d.current?.scrollIntoView({behavior:X})}k.current=!1}},[E,D,W]),_.useEffect(()=>{if(W&&Z)m(Z)},[W,m,Z]);let q=a(),Fz=_.useCallback(()=>{q.invalidateQueries({queryKey:["search"]}),q.invalidateQueries({queryKey:["folders"]}),q.invalidateQueries({queryKey:["files"]}),q.invalidateQueries({queryKey:["file"]}),q.invalidateQueries({queryKey:["version_stacks"]}),q.invalidateQueries({queryKey:["projects"]})},[q]),x=()=>{if(!C.trim()||D||!Z)return;Pz(Z,C,O,R,Fz),l("")},Hz=(G)=>{if(G.nativeEvent.isComposing)return;if(G.key==="Enter"&&!G.shiftKey)G.preventDefault(),x()},c=(G)=>{if(typeof G==="string")return G;if(Array.isArray(G))return G.map((X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"&&"type"in X&&X.type==="text"&&"text"in X)return String(X.text);return""}).join("");return""},i=(G)=>{return G.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:")},Cz=(G)=>{switch(G.role){case"user":return z("div",{className:"flex justify-end w-full",children:z("div",{className:"bg-primary text-primary-foreground rounded-lg px-3 py-2 max-w-[85%] text-sm whitespace-pre-wrap shadow-xs break-words",children:c(G.content)})},G.id);case"assistant":{let $=G.content;if(!$)return null;let V=[];if($.forEach((K,L)=>{if(!K||typeof K!=="object")return;let N=K;switch(N.type){case"text":{let U=N.text;if(typeof U!=="string"||!U.trim())return;V.push(z("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:z(p,{components:{pre:({node:P,...vz})=>z("pre",{className:"whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm",...vz})},children:i(U)})},`txt-${L}`));break}case"thinking":{let U=N.thinking;if(typeof U!=="string"||!U.trim())return;V.push(J("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-medium text-muted-foreground select-none cursor-pointer hover:bg-muted/40 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(s,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),z("span",{children:Y.role_thinking()||"Thinking"}),z(b,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),z("div",{className:"p-3 pt-0 text-xs text-muted-foreground/90 border-t border-border/40 bg-muted/10 leading-relaxed prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-sans",children:z(p,{children:i(U)})})]},`think-${L}`));break}case"toolCall":{let U=String(N.name||N.toolName||Y.unknown()),P=N.arguments||N.args;V.push(J("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-semibold text-violet-600 dark:text-violet-400 select-none cursor-pointer hover:bg-violet-500/10 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(Gz,{className:"h-3.5 w-3.5"}),z("span",{children:Y.calling_tool()}),z("span",{className:"font-mono bg-violet-500/10 px-1.5 py-0.5 rounded text-[11px] text-violet-700 dark:text-violet-300",children:U}),z(b,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!P&&J("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[z("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:Y.tool_arguments()||"Arguments"}),z("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(P,null,2)})]})]},`tool-${L}`));break}case"image":{let U=String(N.mimeType||"image/png"),P=String(N.data||"");V.push(z("div",{className:"my-2 max-w-full",children:P?z("img",{src:P.startsWith("data:")?P:`data:${U};base64,${P}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):z("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:Y.image_object()})},`img-${L}`));break}default:{let U=JSON.stringify(K,null,2);if(U==="{}")return;V.push(z("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:U},`other-${L}`))}}}),V.length===0)return null;let Q=!1;if($.length>0){let K=$[$.length-1];if(typeof K==="string"&&K.trim().length>0)Q=!0;else if(K&&typeof K==="object"){let L=K;if(L.type==="text"&&typeof L.text==="string"&&L.text.trim().length>0)Q=!0}}return J("div",{className:"flex flex-col w-full space-y-1",children:[z("div",{className:"space-y-2 w-full",children:V}),Q&&z("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:Y.created_by_agent()})]},G.id)}case"toolResult":return z("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:z("span",{className:"font-semibold",children:Y.tool_result_with_name({name:G.toolName||"tool"})})},G.id);case"thinking_level_change":case"custom":{let X=G;if(X.customType==="context_display_info"){let Q=X.details?.assets||[];if(Q.length===0)return null;return J("div",{className:"text-xs text-muted-foreground bg-muted/40 p-2.5 rounded-lg border border-border/50 space-y-1 my-1",children:[z("div",{className:"font-semibold",children:Y.assets_added_to_context()}),z("ul",{className:"list-disc list-inside space-y-0.5",children:Q.map((K)=>J("li",{className:"truncate",children:[K.name," ",J("span",{className:"text-muted-foreground/70",children:["(",K.type,")"]})]},K.id))})]},G.id)}let $=X.content||"";return z("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:c($)},G.id)}default:return null}};return J("div",{ref:qz,className:T("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[Ez&&z("div",{className:"absolute inset-0 bg-accent/30 border-2 border-primary z-50 pointer-events-none flex items-center justify-center p-6 text-center animate-in fade-in duration-150",children:J("div",{className:"bg-background/95 text-foreground px-4 py-3 rounded-xl border border-border/80 flex flex-col items-center gap-2 shadow-lg max-w-[80%] animate-in zoom-in-95 duration-150",children:[z(M,{className:"h-6 w-6 text-primary animate-bounce"}),z("span",{className:"text-sm font-semibold text-foreground",children:Y.chatbot_drag_drop_hint()||"Drop assets here"})]})}),z("div",{className:"flex items-center justify-between p-4 pt-[0.7rem] flex-shrink-0",children:W?J(B,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.history()})}),z("button",{onClick:()=>I(!1),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:"Close History",children:z(t,{className:"h-4 w-4"})})]}):J(B,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.shumai_agent()})}),J("div",{className:"flex items-center gap-1",children:[z("button",{onClick:Qz,className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.new_chat(),children:z(zz,{className:"h-4 w-4"})}),z("button",{onClick:()=>I(!0),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.history(),children:z(h,{className:"h-4 w-4"})})]})]})}),W?z(A,{className:"flex-1 p-4 min-h-0",children:g.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 text-muted-foreground p-4 text-center",children:[z(h,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.no_history_sessions()})]}):z("div",{className:"space-y-2 pb-4",children:g.map((G)=>{let X=G.id===Vz;return J("div",{className:T("group relative flex items-center justify-between p-3 border rounded-lg transition-all cursor-pointer bg-card",X?"border-primary":"border-border hover:bg-accent/30"),children:[J("div",{onClick:()=>Z&&Lz(Z,G.id),className:"flex-1 min-w-0 pr-6",children:[z("div",{className:"text-sm font-semibold text-foreground truncate",children:G.name||Y.new_chat()}),z("div",{className:"text-xs text-muted-foreground mt-0.5",children:Jz(G.createdAt)})]}),z("button",{onClick:($)=>{if($.stopPropagation(),Z&&confirm(Y.delete_session_confirm()))Nz(Z,G.id)},className:"absolute right-3 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted",title:"Delete Session",children:z(S,{className:"h-4 w-4"})})]},G.id)})})}):J(B,{children:[z(A,{ref:y,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:E.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center",children:[z(M,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.chatbot_drag_drop_hint()})]}):J("div",{className:"space-y-4 pb-4",children:[E.map(Cz),D&&E.length>0&&E[E.length-1].role==="user"&&J("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[z(o,{className:"h-3 w-3 animate-spin text-primary"}),z("span",{children:"Thinking..."})]}),z("div",{ref:d})]})}),z("div",{className:"p-2 flex-shrink-0 bg-background",children:J("div",{className:"relative flex flex-col w-full border border-foreground/20 rounded-2xl shadow-xs transition-all duration-200 focus-within:ring-2 focus-within:ring-primary focus-within:border-transparent bg-background overflow-hidden",children:[u.length>0&&z("div",{className:"flex flex-col gap-1.5 min-h-0 max-h-[160px] overflow-y-auto border-b border-border bg-muted/5 p-3 divide-y divide-border/50",children:u.map((G)=>J("div",{className:"flex items-center justify-between py-1.5 text-xs group",children:[J("div",{className:"flex items-baseline gap-1.5 min-w-0 pr-2",children:[z("span",{className:"truncate font-medium text-foreground",children:G.name}),z("span",{className:"text-[9px] text-muted-foreground uppercase flex-shrink-0",children:G.type})]}),z("button",{onClick:()=>Wz(G.id),className:"text-muted-foreground hover:text-destructive transition-colors p-0.5",title:Y.remove_from_context(),children:z(S,{className:"h-3.5 w-3.5"})})]},G.id))}),z("textarea",{value:C,onChange:(G)=>l(G.target.value),onKeyDown:Hz,placeholder:"Type a message...",rows:2,className:"w-full bg-transparent border-none focus:ring-0 focus:outline-hidden resize-none min-h-[44px] max-h-[120px] px-3 py-2 text-sm focus-visible:outline-hidden focus:ring-transparent focus:border-transparent focus-visible:ring-0",disabled:D}),J("div",{className:"flex justify-between items-center px-3 pb-2 pt-1",children:[z("div",{className:"flex items-center gap-1.5 min-w-0 max-w-[70%]",children:F.length>0?J(Yz,{value:H||"",onValueChange:(G)=>w(G),disabled:D,children:[z(_z,{className:"h-8 border-none bg-transparent hover:bg-muted text-muted-foreground hover:text-foreground focus:ring-0 focus:ring-offset-0 px-2 py-0 gap-1.5 text-xs shrink-0 select-none shadow-none max-w-full",children:z(Zz,{placeholder:Y.select_agent()})}),z($z,{children:F.map((G)=>z(Kz,{value:G.id,children:J("div",{className:"flex items-center gap-2",children:[G.avatar?z("img",{src:G.avatar,alt:G.name,className:"w-4 h-4 rounded-full object-cover"}):z(M,{className:"w-4 h-4 text-muted-foreground"}),z("span",{className:"text-xs",children:G.name})]})},G.id))})]}):z("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:z("span",{children:Y.no_chat_agents_warning()})})}),D?z("button",{onClick:()=>{if(Z)Oz(Z)},className:"p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm bg-destructive text-destructive-foreground hover:bg-destructive/90 transform hover:-translate-y-0.5",title:"Stop generation",children:z("div",{className:"h-4 w-4 flex items-center justify-center",children:z("div",{className:"h-3 w-3 bg-current rounded-[2px] bg-white"})})}):z("button",{onClick:x,disabled:!C.trim()||!H,className:T("p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm",C.trim()&&H?"bg-primary text-primary-foreground hover:bg-primary/95 transform hover:-translate-y-0.5":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:z(e,{className:"h-4 w-4"})})]})]})})]})]})}
|
|
2
|
+
export{uz as e};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
function w(q){let k=q[q.length-1];return k&&k.role!=="user"?"agent":"user"}function x(q){return q.some((k)=>{if(k.role==="user"&&Array.isArray(k.content))return k.content.some((v)=>v.type==="image");if(k.role==="toolResult"&&Array.isArray(k.content))return k.content.some((v)=>v.type==="image");return!1})}function y(q){let k={"X-Initiator":w(q.messages),"Openai-Intent":"conversation-edits"};if(q.hasImages)k["Copilot-Vision-Request"]="true";return k}
|
|
3
|
-
export{x as
|
|
3
|
+
export{x as Oj,y as Pj};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{p as
|
|
1
|
+
import{$g as o,Yg as a,_g as l}from"./chunk-ersxsrz8.js";var p=a()(o((i)=>({fileViewLeftSidebarCollapsed:!0,setFileViewLeftSidebarCollapsed:(e)=>i({fileViewLeftSidebarCollapsed:e}),fileViewRightSidebarCollapsed:!1,setFileViewRightSidebarCollapsed:(e)=>i({fileViewRightSidebarCollapsed:e}),fileListLeftSidebarCollapsed:!1,setFileListLeftSidebarCollapsed:(e)=>i({fileListLeftSidebarCollapsed:e}),fileListRightSidebarCollapsed:!0,setFileListRightSidebarCollapsed:(e)=>i({fileListRightSidebarCollapsed:e}),shareConfigLeftSidebarCollapsed:!1,setShareConfigLeftSidebarCollapsed:(e)=>i({shareConfigLeftSidebarCollapsed:e}),shareConfigRightSidebarCollapsed:!1,setShareConfigRightSidebarCollapsed:(e)=>i({shareConfigRightSidebarCollapsed:e}),viewModes:{},setViewMode:(e,d)=>i((s)=>({viewModes:{...s.viewModes,[e]:d}})),videoTimeDisplayMode:"standard",setVideoTimeDisplayMode:(e)=>i({videoTimeDisplayMode:e})}),{name:"ui-storage",storage:l(()=>localStorage)}));
|
|
2
|
+
export{p as uf};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{hg as e}from"./chunk-c1j58ekb.js";import{Bg as v,rj as U,xj as P}from"./chunk-ersxsrz8.js";var x={human:"human",agent:"agent"};var l={editor:"editor",reviewer:"reviewer"};var S={team:"team",project:"project"};var h={chat:"chat",autofill:"autofill",embedding:"embedding"};var n=e.object({cursor:e.string().optional(),total:e.number().optional(),totalSize:e.number().optional()}),a=e.object({first:e.coerce.number().optional(),after:e.string().optional()});var ge=e.object({name:e.string()}),w=e.object({id:e.string(),name:e.string(),rootFolder:e.string().optional(),updatedAt:e.union([e.string(),e.date()])});var ye=e.object({data:e.array(w),pageInfo:n}),ue=e.object({teamId:e.string(),userId:e.string()}),xe=e.object({id:e.string(),name:e.string(),email:e.string().optional(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),image:e.string().optional(),unreadNotificationCount:e.number().optional()}),Se=e.object({name:e.string().optional(),imageKey:e.string().nullable().optional()}),he=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),email:e.string().optional(),type:e.nativeEnum(x).optional(),image:e.string().optional(),scope:e.nativeEnum(S).optional()}),be=e.object({includeAgents:e.string().optional().transform((o)=>o==="true")}),C={best_match:"best_match",all:"all"},_e=e.union([e.object({key:e.literal("transcode.videoStrategy"),value:e.nativeEnum(C)})]),Re=e.object({allowedDomains:e.array(e.string()),pendingDomains:e.array(e.string()).default([])});var je=e.object({role:e.enum(["editor","reviewer"])});var b=e.nativeEnum(h),_=e.enum(["off","minimal","low","medium","high","xhigh"]),F=e.object({id:e.string().optional(),skillId:e.string(),skill:e.object({id:e.string(),name:e.string()}).optional()}),Te=e.object({id:e.string(),name:e.string(),type:b,enabled:e.boolean(),avatar:e.string().optional(),providerId:e.string().optional(),modelId:e.string().optional(),thinkingLevel:_.optional().default("off"),systemPrompt:e.string().optional(),soul:e.string().optional(),skills:e.array(F).optional(),deniedTools:e.array(e.string()).optional()}),R=e.object({name:e.string().min(1),type:b,enabled:e.boolean().optional().default(!0),avatar:e.string().optional(),providerId:e.string().optional(),modelId:e.string().optional(),thinkingLevel:_.optional().default("off"),systemPrompt:e.string().optional(),soul:e.string().optional(),skills:e.array(e.string()).optional(),deniedTools:e.array(e.string()).optional()}),ve=R.superRefine((o,r)=>{if(o.type==="chat"||o.type==="autofill"){if(!o.providerId)r.addIssue({code:e.ZodIssueCode.custom,message:"providerId is required for chat/autofill agents",path:["providerId"]});if(!o.modelId)r.addIssue({code:e.ZodIssueCode.custom,message:"modelId is required for chat/autofill agents",path:["modelId"]})}}),Ue=R.superRefine((o,r)=>{if(o.type==="chat"||o.type==="autofill"){if(!o.providerId)r.addIssue({code:e.ZodIssueCode.custom,message:"providerId is required for chat/autofill agents",path:["providerId"]});if(!o.modelId)r.addIssue({code:e.ZodIssueCode.custom,message:"modelId is required for chat/autofill agents",path:["modelId"]})}}),Pe=e.object({id:e.string(),sessionId:e.string(),entry:e.unknown()}),Me=e.object({id:e.string(),name:e.string().nullable().optional(),type:e.string(),createdAt:e.string(),creator:e.object({id:e.string(),name:e.string().nullable().optional(),email:e.string().nullable().optional(),image:e.string().nullable().optional()}).nullable().optional(),agentId:e.string().optional()});var Fe=e.object({apiKey:e.string().optional(),baseUrl:e.string().optional(),chatModels:e.array(e.string()).optional()}),N=e.enum(["1h","24h","7d","30d"]),Ne=e.object({timeframe:N.default("30d"),userId:e.string().optional()});var Oe=e.object({data:e.array(e.lazy(()=>V)),pageInfo:n}),j=e.object({proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),thumbnailUrl:e.string().optional(),originalHeight:e.number().optional(),originalWidth:e.number().optional(),spriteUrl:e.string().optional(),duration:e.number().optional(),pageCount:e.number().optional()}),L=e.object({type:e.string().nullable(),preview:j.nullable()}),s=e.object({id:e.string(),name:e.string(),image:e.string().optional()}),E=e.object({fieldId:e.string(),value:e.any()}),W=e.object({id:e.string(),name:e.string()}),O=e.object({duration:e.number().optional(),originalWidth:e.number().optional(),originalHeight:e.number().optional(),frameRate:e.number().optional(),totalFrames:e.number().optional(),startTimecode:e.string().optional()}),V=e.object({id:e.string(),name:e.string(),sizeByte:e.number(),fileCount:e.number(),type:e.string(),targetType:e.string().optional().nullable(),status:e.string(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),latestChildren:e.array(L).optional(),preview:j.nullable().optional(),createdAt:e.string(),updatedAt:e.string(),deletedAt:e.string().nullable().optional(),projectId:e.string().optional().nullable(),creator:s.nullable().optional(),fieldValues:e.array(E).optional(),sortIndex:e.string().optional().nullable(),startTime:e.number().optional().nullable(),endTime:e.number().optional().nullable(),media:e.object({original:e.object({key:e.string().optional()}).optional(),videoTranscodes:e.array(e.object({id:e.string(),url:e.string(),key:e.string(),width:e.number(),height:e.number(),size:e.number()})).optional(),imageTranscodes:e.array(e.object({id:e.string(),url:e.string(),key:e.string(),width:e.number(),height:e.number(),size:e.number()})).optional(),videoPreview:e.object({url:e.string(),key:e.string().optional()}).optional(),pdfTranscode:e.object({url:e.string(),key:e.string().optional()}).optional(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),metadata:O.optional()}).optional(),ancestorFolders:e.array(W).optional(),versionStack:e.object({id:e.string(),versions:e.array(e.object({version:e.number(),current:e.boolean(),id:e.string(),name:e.string().optional().nullable(),previewUrl:e.string().optional().nullable(),creator:e.object({id:e.string(),name:e.string().nullable()}).nullable().optional()}))}).optional().nullable()}),Ve=e.object({name:e.string(),type:e.string(),projectId:e.string().optional(),parentId:e.string().optional(),key:e.string().optional(),sizeByte:e.number().optional(),contentType:e.string().optional(),creatorId:e.string().optional()}),Qe=e.object({assetId:e.string()}),Ke=e.object({id:e.string(),name:e.string()}),De=e.object({assetId:e.string().optional(),assetType:e.string(),projectId:e.string().optional(),showDeleted:e.boolean().optional(),prefix:e.string().optional(),sort:e.string().optional(),order:e.string().optional(),...a.shape}),Ze=e.object({assetId:e.string(),userId:e.string(),replyToId:e.string().optional(),message:e.string(),annotations:e.any().optional(),second:e.number().optional(),attachmentIds:e.array(e.string())}),Q=e.object({id:e.string(),assetId:e.string(),url:e.string(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional()}),K=e.object({id:e.string(),assetId:e.string(),message:e.string().nullable(),annotations:e.any(),second:e.number().nullable(),creator:s,replies:e.array(e.lazy(()=>K)),attachments:e.array(Q),mentions:e.array(s),createdAt:e.string(),updatedAt:e.string(),sessionId:e.string().nullable(),isCompleted:e.boolean(),completionLastChangedBy:s.nullable()}),Be=e.object({isCompleted:e.boolean()}),Ge=e.object({newParentId:e.string(),assetIds:e.array(e.string()),creatorId:e.string().optional()}),Je=e.object({newParentId:e.string(),assetIds:e.array(e.string()),withComments:e.boolean().default(!1),creatorId:e.string().optional()}),Ye=e.object({name:e.string()}),He=e.object({beforeIndex:e.string().optional(),afterIndex:e.string().optional()}),Xe=e.object({ids:e.array(e.string())}),$e=e.object({ids:e.array(e.string())}),Ae=e.object({file:e.instanceof(File)}),ze=e.object({key:e.string()}),et=e.object({fileName:e.string(),contentType:e.string(),size:e.number()}),tt=e.object({id:e.string(),uploadUrl:e.string()}),ot=e.object({ids:e.array(e.string())}),D=e.object({id:e.string(),name:e.string(),url:e.string()}),rt=e.object({files:e.array(D)});var st=e.object({userCount:e.number()}),it=e.object({name:e.string().min(1,"Name is required").max(100,"Name is too long")}),pt=e.object({id:e.string(),token:e.string(),name:e.string(),createdAt:e.string()});var Z=e.enum(["is","eq","neq","gt","gte","lt","lte","contains","notContains","isEmpty","isNotEmpty","in","notIn","hasAny","hasAll","hasNone","isWithin"]),B=e.object({field:e.string(),operator:Z,value:e.any()}),G=e.enum(["asc","desc"]),J=e.object({field:e.string(),order:G}),Y=e.enum(["AND","OR"]),H=e.enum(["file","folder"]),m=e.object({operator:Y.optional().default("AND"),conditions:e.array(B).optional().default([]),sort:J.optional(),assetType:H.optional(),showSymlink:e.boolean().optional(),recursively:e.boolean().optional().default(!0),query:e.string().optional(),isSemantic:e.boolean().optional().default(!1)}),ft=m.extend(a.shape);var f=e.object({sourceFolderId:e.string(),searchFilter:m}),X=e.object({id:e.string(),name:e.string(),filter:f,projectId:e.string(),createdAt:e.string(),updatedAt:e.string(),creator:e.object({id:e.string(),name:e.string(),image:e.string().optional().nullable()}).optional().nullable()}),xt=e.object({name:e.string(),filter:f}),St=e.object({name:e.string().optional(),filter:f.optional()});var ht=e.object({data:e.array(X),pageInfo:e.object({cursor:e.string().optional(),total:e.number().optional()})});var Rt=e.object({name:e.string(),parentId:e.string()}),jt=e.object({name:e.string()}),kt=e.object({ids:e.array(e.string())}),It=e.object({ids:e.array(e.string())});var Ut=e.object({code:e.string(),role:e.string(),teamId:e.string(),teamName:e.string(),projectId:e.string().optional(),projectName:e.string().optional(),inviterName:e.string(),isUsed:e.boolean()}),Pt=e.object({role:e.nativeEnum(l)}),Mt=e.object({role:e.nativeEnum(l)}),wt=e.object({code:e.string()});var Et={text:"text",longText:"longText",select:"select",selectMulti:"selectMulti",rating:"rating",number:"number",toggle:"toggle",date:"date",user:"user",userMulti:"userMulti"},Wt=e.object({id:e.string(),displayName:e.string(),color:e.string().optional()}),d=e.object({name:e.string(),type:e.enum(["text","longText","select","selectMulti","rating","number","toggle","date","user","userMulti"]),text:e.any().optional(),longText:e.any().optional(),select:e.any().optional(),selectMulti:e.any().optional(),rating:e.any().optional(),number:e.any().optional(),toggle:e.any().optional(),date:e.any().optional(),user:e.any().optional(),userMulti:e.any().optional()}),Ot=e.object({key:e.string().optional(),label:e.string().optional(),scope:e.string().optional(),config:d,aiAutofill:e.boolean().default(!1),description:e.string().default("")}),Vt=e.object({label:e.string().optional(),config:d,aiAutofill:e.boolean().optional(),description:e.string().optional()}),$=e.object({fieldId:e.string(),visible:e.boolean()}),Qt=e.array($),A=e.object({key:e.string(),value:e.any()}),Kt=e.array(A),Dt=e.object({id:e.string(),config:d,scope:e.string(),readOnly:e.boolean(),visible:e.boolean(),description:e.string(),aiAutofill:e.boolean()});var k=e.object({id:e.string().optional(),name:e.string().optional(),role:e.string().optional()}),I=e.object({id:e.string().optional(),name:e.string().optional()}),z=e.object({id:e.string().optional(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),name:e.string().optional(),preview:e.string().optional(),thumbnailUrl:e.string().optional(),originalWidth:e.number().optional(),originalHeight:e.number().optional()}),Gt=e.object({id:e.string().optional(),creator:k.optional(),type:e.string().optional(),team:I.optional(),project:I.optional(),asset:z.optional(),user:k.optional(),createdAt:e.string().optional(),isRead:e.boolean().optional()}),Jt=e.object({unreadOnly:e.union([e.boolean(),e.string()]).transform((o)=>o===!0||o==="true").optional(),after:e.string().optional(),pageSize:e.coerce.number().optional()}),Yt=e.object({notificationId:e.string().min(1)}),Ht=e.object({comments:e.boolean().default(!0),replies:e.boolean().default(!0),mentions:e.boolean().default(!0),yourUploads:e.boolean().default(!1),otherUploads:e.boolean().default(!0),statusUpdates:e.boolean().default(!0)});var zt=e.object({name:e.string(),coverImageKey:e.string().optional(),enableNotification:e.boolean().default(!0)}),eo=e.object({name:e.string().optional(),coverImageKey:e.string().optional(),enableNotification:e.boolean().optional()}),ee=e.object({id:e.string(),name:e.string(),teamId:e.string(),rootFolder:e.string().optional(),coverImage:e.string().optional(),coverImageKey:e.string().optional(),enableNotification:e.boolean(),updatedAt:e.union([e.string(),e.date()])}),to=e.object({sortBy:e.string().optional(),sortDirection:e.enum(["asc","desc"]).optional()}).merge(a),oo=e.object({data:e.array(ee),pageInfo:n}),ro=e.object({teamId:e.string()}),ao=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),image:e.string().optional(),scope:e.enum(["team","project"]).optional(),hasCustomRole:e.boolean().optional()}),no=e.object({id:e.string(),name:e.string()}),so=e.object({assetType:e.string(),sort:e.enum(["createdAt","name","size"]).optional(),order:e.enum(["asc","desc"]).optional()}).merge(a),io=e.object({role:e.enum(["editor","reviewer"])}),po=e.object({userId:e.string(),role:e.enum(["owner","editor","reviewer"])}),co=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),image:e.string().optional()});var q=["openai-completions","mistral-conversations","openai-responses","azure-openai-responses","openai-codex-responses","anthropic-messages","bedrock-converse-stream","google-generative-ai","google-vertex"],te=e.object({api:e.enum(q).optional(),reasoning:e.boolean().default(!1),input:e.array(e.enum(["text","image"])).default(["text"]),contextWindow:e.number().int().positive().default(128000),maxTokens:e.number().int().positive().default(4096),cost:e.object({input:e.number().nonnegative().default(0),output:e.number().nonnegative().default(0),cacheRead:e.number().nonnegative().default(0),cacheWrite:e.number().nonnegative().default(0)})}),g=e.object({id:e.string().optional(),modelId:e.string().min(1,"Model ID is required"),name:e.string().min(0).default(""),config:te}),y=e.object({baseUrl:e.string().url("Must be a valid URL").optional().or(e.literal("")),apiKey:e.string().optional().or(e.literal("")),api:e.enum(q),headers:e.record(e.string(),e.string()).optional(),authHeader:e.boolean().optional()}),fo=e.object({name:e.string().min(1,"Provider name is required"),config:y,models:e.array(g).min(1,"At least one model is required")}),go=e.object({config:y,models:e.array(g).min(1,"At least one model is required")}),yo=e.object({id:e.string(),name:e.string(),isBuiltin:e.boolean(),config:y,models:e.array(g).optional(),modelsCount:e.number().optional(),createdAt:e.date(),updatedAt:e.date()});var ho=e.object({name:e.string().min(1),expireAt:e.string().datetime().optional(),password:e.string().optional(),isDisabled:e.boolean().optional(),allowDownload:e.boolean().optional(),defaultSortOrder:e.string().optional(),viewMode:e.string().optional()}),bo=e.object({name:e.string().min(1).optional(),expireAt:e.string().datetime().optional().nullable(),password:e.string().optional().nullable(),isDisabled:e.boolean().optional(),allowDownload:e.boolean().optional(),defaultSortOrder:e.string().optional().nullable(),viewMode:e.string().optional().nullable(),fieldVisibility:e.record(e.string(),e.boolean()).optional().nullable()}),_o=a.extend({projectId:e.string().optional()}),Ro=e.object({assetIds:e.array(e.string().min(1)).min(1)});var Io=e.object({assetId:e.string().optional(),githubUrl:e.string().optional(),override:e.boolean().optional()}),qo=e.object({config:e.object({environmentVariables:e.array(e.object({name:e.string(),default:e.string().optional()}))})}),To=e.object({permission:e.enum(["owner","editor","reviewer"])});var T=e.lazy(()=>e.object({name:e.string(),id:e.string(),size:e.number(),children:e.array(T),type:e.string(),mediaType:e.string().optional()})),Po=e.object({parentId:e.string(),files:e.array(T)}),oe=e.object({id:e.string(),fileId:e.string(),url:e.string()}),Mo=e.object({taskId:e.string(),presignedUrls:e.array(oe),createdAssets:e.array(e.object({tempId:e.string(),assetId:e.string()})).optional()}),wo=e.object({fileId:e.string(),errorMessage:e.string().optional()}),Co=e.object({id:e.string(),name:e.string(),total:e.number(),uploaded:e.number(),createdAt:e.string()}),Fo=e.object({bucket:e.string(),key:e.string(),Signature:e.string()}),No=e.object({file:e.instanceof(File)});var re=e.object({key:e.string(),value:e.unknown()}),Wo=e.object({value:e.unknown()}),Oo=e.array(re);var Ko=e.object({fileIds:e.array(e.string())}),Do=e.object({fileId:e.string(),beforeId:e.string()});var Go=e.object({agentId:e.string(),textPrompt:e.string().optional(),attachedFiles:e.array(e.string()).optional(),assetIds:e.array(e.string()).optional(),sessionId:e.string().optional(),contextAssetId:e.string().optional(),projectId:e.string().optional()}).superRefine((o,r)=>{let p=o.textPrompt&&o.textPrompt.trim().length>0,c=o.attachedFiles&&o.attachedFiles.length>0,M=o.assetIds&&o.assetIds.length>0;if(!p&&!c&&!M)r.addIssue({code:e.ZodIssueCode.custom,message:"At least one of textPrompt, attachedFiles, or assetIds must be provided.",path:["textPrompt"]})}),Jo=e.object({id:e.string(),agentId:e.string(),userId:e.string().nullable(),assetId:e.string().nullable(),userCommentId:e.string().nullable(),name:e.string().nullable().optional(),createdAt:e.string(),updatedAt:e.string()}),Yo=e.intersection(e.object({id:e.string()}),e.unknown());var i;((t)=>{t.team_create="team_create";t.team_update="team_update";t.team_delete="team_delete";t.team_member_add="team_member_add";t.team_member_update="team_member_update";t.team_member_remove="team_member_remove";t.project_create="project_create";t.project_update="project_update";t.project_delete="project_delete";t.project_empty_trash="project_empty_trash";t.project_member_add="project_member_add";t.project_member_update="project_member_update";t.project_member_remove="project_member_remove";t.file_create="file_create";t.file_update="file_update";t.file_delete="file_delete";t.folder_create="folder_create";t.folder_update="folder_update";t.folder_delete="folder_delete";t.asset_reparent="asset_reparent";t.asset_copy="asset_copy";t.share_create="share_create";t.share_update="share_update";t.share_delete="share_delete";t.agent_create="agent_create";t.agent_update="agent_update";t.agent_delete="agent_delete";t.skill_create="skill_create";t.skill_update="skill_update";t.skill_delete="skill_delete";t.provider_create="provider_create";t.provider_update="provider_update";t.provider_delete="provider_delete";t.invite_create="invite_create";t.invite_revoke="invite_revoke";t.metadata_field_create="metadata_field_create";t.metadata_field_update="metadata_field_update";t.metadata_field_delete="metadata_field_delete";t.comment_create="comment_create";t.comment_update="comment_update";t.comment_delete="comment_delete";t.comment_complete="comment_complete"})(i||={});var ae=e.object({id:e.string(),action:e.nativeEnum(i),teamId:e.string(),userId:e.string().nullable().optional(),projectId:e.string().nullable().optional(),itemId:e.string().nullable().optional(),createdAt:e.string()}),$o=e.object({first:e.coerce.number().optional(),after:e.string().optional(),actions:e.union([e.nativeEnum(i),e.array(e.nativeEnum(i))]).transform((o)=>Array.isArray(o)?o:[o]).optional(),userIds:e.union([e.string(),e.array(e.string())]).transform((o)=>Array.isArray(o)?o:[o]).optional(),itemId:e.string().optional()}),Ao=e.object({nodes:e.array(ae),pageInfo:e.object({hasNextPage:e.boolean(),endCursor:e.string().nullable()}),total:e.number()});var ne=e.object({id:e.string(),type:e.literal("text"),x:e.number().min(0).max(1),y:e.number().min(0).max(1),opacity:e.number().min(0).max(1),rotation:e.number().min(-180).max(180),text:e.string(),size:e.number().positive().max(1),color:e.string()}),se=e.object({id:e.string(),type:e.literal("image"),x:e.number().min(0).max(1),y:e.number().min(0).max(1),opacity:e.number().min(0).max(1),rotation:e.number().min(-180).max(180),imageAssetKey:e.string().min(1),imageAssetUrl:e.string().optional(),size:e.number().positive().max(1)}),ie=e.discriminatedUnion("type",[ne,se]),u=e.object({blocks:e.array(ie)}),tr=e.object({name:e.string().min(1),teamId:e.string().optional(),config:u}),or=e.object({name:e.string().min(1).optional(),config:u.optional()}),rr=e.object({enabled:e.boolean(),config:u.optional()}).superRefine((o,r)=>{if(o.enabled&&(!o.config||o.config.blocks.length===0))r.addIssue({code:"custom",path:["config"],message:"Watermark configuration is required when enabling watermark"})});function Mr({className:o,orientation:r="horizontal",decorative:p=!0,...c}){return v(U.Root,{"data-slot":"separator",decorative:p,orientation:r,className:P("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",o),...c})}
|
|
2
|
+
export{_ as Va,Et as Wa,q as Xa,g as Ya,y as Za,C as _a,i as $a,Mr as ab};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Nj as _1}from"./chunk-7xfx7741.js";import{Oj as P1,Pj as f1}from"./chunk-2jnyk045.js";import{Xj as D1}from"./chunk-jgxhv36z.js";import{Yj as B1}from"./chunk-bhqrqt97.js";import{Zj as j1,_j as S0}from"./chunk-kgr3ytpb.js";import{pk as T1,sk as I1,tk as R1,uk as k1,vk as y1}from"./chunk-6gjn8trh.js";import{wk as c}from"./chunk-sfmhbk59.js";import{xk as S1}from"./chunk-75x3w5hx.js";import{Dk as j0}from"./chunk-7kdz1eng.js";import{Fk as A1}from"./chunk-6ab9eftx.js";import"./chunk-8tnq43k9.js";function U(X,Z,$,W,Y){if(W==="m")throw TypeError("Private method is not writable");if(W==="a"&&!Y)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?X!==Z||!Y:!Z.has(X))throw TypeError("Cannot write private member to an object whose class did not declare it");return W==="a"?Y.call(X,$):Y?Y.value=$:Z.set(X,$),$}function z(X,Z,$,W){if($==="a"&&!W)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?X!==Z||!W:!Z.has(X))throw TypeError("Cannot read private member from an object whose class did not declare it");return $==="m"?W:$==="a"?W.call(X):W?W.value:Z.get(X)}var pZ=function(){let{crypto:X}=globalThis;if(X?.randomUUID)return pZ=X.randomUUID.bind(X),X.randomUUID();let Z=new Uint8Array(1),$=X?()=>X.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(W)=>(+W^$()&15>>+W/4).toString(16))};function d(X){return typeof X==="object"&&X!==null&&(("name"in X)&&X.name==="AbortError"||("message"in X)&&String(X.message).includes("FetchRequestCanceledException"))}var xX=(X)=>{if(X instanceof Error)return X;if(typeof X==="object"&&X!==null){try{if(Object.prototype.toString.call(X)==="[object Error]"){let Z=Error(X.message,X.cause?{cause:X.cause}:{});if(X.stack)Z.stack=X.stack;if(X.cause&&!Z.cause)Z.cause=X.cause;if(X.name)Z.name=X.name;return Z}}catch{}try{return Error(JSON.stringify(X))}catch{}}return Error(X)};class C extends Error{}class A extends C{constructor(X,Z,$,W,Y){super(`${A.makeMessage(X,Z,$)}`);this.status=X,this.headers=W,this.requestID=W?.get("request-id"),this.error=Z,this.type=Y??null}static makeMessage(X,Z,$){let W=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):$;if(X&&W)return`${X} ${W}`;if(X)return`${X} status code (no body)`;if(W)return W;return"(no status code or body)"}static generate(X,Z,$,W){if(!X||!W)return new s({message:$,cause:xX(Z)});let Y=Z,J=Y?.error?.type;if(X===400)return new FX(X,Y,$,W,J);if(X===401)return new LX(X,Y,$,W,J);if(X===403)return new AX(X,Y,$,W,J);if(X===404)return new jX(X,Y,$,W,J);if(X===409)return new SX(X,Y,$,W,J);if(X===422)return new BX(X,Y,$,W,J);if(X===429)return new DX(X,Y,$,W,J);if(X>=500)return new TX(X,Y,$,W,J);return new A(X,Y,$,W,J)}}class D extends A{constructor({message:X}={}){super(void 0,void 0,X||"Request was aborted.",void 0)}}class s extends A{constructor({message:X,cause:Z}){super(void 0,void 0,X||"Connection error.",void 0);if(Z)this.cause=Z}}class HX extends s{constructor({message:X}={}){super({message:X??"Request timed out."})}}class FX extends A{}class LX extends A{}class AX extends A{}class jX extends A{}class SX extends A{}class BX extends A{}class DX extends A{}class TX extends A{}var c1=/^[a-z][a-z0-9+.-]*:/i,P0=(X)=>{return c1.test(X)},lZ=(X)=>(lZ=Array.isArray,lZ(X)),iZ=lZ;function qZ(X){if(typeof X!=="object")return{};return X??{}}function nZ(X){if(!X)return!0;for(let Z in X)return!1;return!0}function f0(X,Z){return Object.prototype.hasOwnProperty.call(X,Z)}var I0=(X,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new C(`${X} must be an integer`);if(Z<0)throw new C(`${X} must be a positive integer`);return Z};var CZ=(X)=>{try{return JSON.parse(X)}catch(Z){return}};var R0=(X)=>new Promise((Z)=>setTimeout(Z,X));var i="0.91.1";var h0=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function d1(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var m1=()=>{let X=d1();if(X==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":y0(Deno.build.os),"X-Stainless-Arch":k0(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":i,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(X==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":y0(globalThis.process.platform??"unknown"),"X-Stainless-Arch":k0(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=u1();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":i,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function u1(){if(typeof navigator>"u"||!navigator)return null;let X=[{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/}];for(let{key:Z,pattern:$}of X){let W=$.exec(navigator.userAgent);if(W){let Y=W[1]||0,J=W[2]||0,Q=W[3]||0;return{browser:Z,version:`${Y}.${J}.${Q}`}}}return null}var k0=(X)=>{if(X==="x32")return"x32";if(X==="x86_64"||X==="x64")return"x64";if(X==="arm")return"arm";if(X==="aarch64"||X==="arm64")return"arm64";if(X)return`other:${X}`;return"unknown"},y0=(X)=>{if(X=X.toLowerCase(),X.includes("ios"))return"iOS";if(X==="android")return"Android";if(X==="darwin")return"MacOS";if(X==="win32")return"Windows";if(X==="freebsd")return"FreeBSD";if(X==="openbsd")return"OpenBSD";if(X==="linux")return"Linux";if(X)return`Other:${X}`;return"Unknown"},_0,g0=()=>{return _0??(_0=m1())};function b0(){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 rZ(...X){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...X)}function OZ(X){let Z=Symbol.asyncIterator in X?X[Symbol.asyncIterator]():X[Symbol.iterator]();return rZ({start(){},async pull($){let{done:W,value:Y}=await Z.next();if(W)$.close();else $.enqueue(Y)},async cancel(){await Z.return?.()}})}function PX(X){if(X[Symbol.asyncIterator])return X;let Z=X.getReader();return{async next(){try{let $=await Z.read();if($?.done)Z.releaseLock();return $}catch($){throw Z.releaseLock(),$}},async return(){let $=Z.cancel();return Z.releaseLock(),await $,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function v0(X){if(X===null||typeof X!=="object")return;if(X[Symbol.asyncIterator]){await X[Symbol.asyncIterator]().return?.();return}let Z=X.getReader(),$=Z.cancel();Z.releaseLock(),await $}var c0=({headers:X,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function d0(X){return Object.entries(X).filter(([Z,$])=>typeof $<"u").map(([Z,$])=>{if(typeof $==="string"||typeof $==="number"||typeof $==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent($)}`;if($===null)return`${encodeURIComponent(Z)}=`;throw new C(`Cannot stringify type ${typeof $}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}function p0(X){let Z=0;for(let Y of X)Z+=Y.length;let $=new Uint8Array(Z),W=0;for(let Y of X)$.set(Y,W),W+=Y.length;return $}var m0;function fX(X){let Z;return(m0??(Z=new globalThis.TextEncoder,m0=Z.encode.bind(Z)))(X)}var u0;function aZ(X){let Z;return(u0??(Z=new globalThis.TextDecoder,u0=Z.decode.bind(Z)))(X)}var f,I;class n{constructor(){f.set(this,void 0),I.set(this,void 0),U(this,f,new Uint8Array,"f"),U(this,I,null,"f")}decode(X){if(X==null)return[];let Z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?fX(X):X;U(this,f,p0([z(this,f,"f"),Z]),"f");let $=[],W;while((W=i1(z(this,f,"f"),z(this,I,"f")))!=null){if(W.carriage&&z(this,I,"f")==null){U(this,I,W.index,"f");continue}if(z(this,I,"f")!=null&&(W.index!==z(this,I,"f")+1||W.carriage)){$.push(aZ(z(this,f,"f").subarray(0,z(this,I,"f")-1))),U(this,f,z(this,f,"f").subarray(z(this,I,"f")),"f"),U(this,I,null,"f");continue}let Y=z(this,I,"f")!==null?W.preceding-1:W.preceding,J=aZ(z(this,f,"f").subarray(0,Y));$.push(J),U(this,f,z(this,f,"f").subarray(W.index),"f"),U(this,I,null,"f")}return $}flush(){if(!z(this,f,"f").length)return[];return this.decode(`
|
|
3
|
+
`)}}f=new WeakMap,I=new WeakMap;n.NEWLINE_CHARS=new Set([`
|
|
4
|
+
`,"\r"]);n.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function i1(X,Z){for(let Y=Z??0;Y<X.length;Y++){if(X[Y]===10)return{preceding:Y,index:Y+1,carriage:!1};if(X[Y]===13)return{preceding:Y,index:Y+1,carriage:!0}}return null}function l0(X){for(let W=0;W<X.length-1;W++){if(X[W]===10&&X[W+1]===10)return W+2;if(X[W]===13&&X[W+1]===13)return W+2;if(X[W]===13&&X[W+1]===10&&W+3<X.length&&X[W+2]===13&&X[W+3]===10)return W+4}return-1}var MZ={off:0,error:200,warn:300,info:400,debug:500},oZ=(X,Z,$)=>{if(!X)return;if(f0(MZ,X))return X;S($).warn(`${Z} was set to ${JSON.stringify(X)}, expected one of ${JSON.stringify(Object.keys(MZ))}`);return};function IX(){}function EZ(X,Z,$){if(!Z||MZ[X]>MZ[$])return IX;else return Z[X].bind(Z)}var n1={error:IX,warn:IX,info:IX,debug:IX},i0=new WeakMap;function S(X){let Z=X.logger,$=X.logLevel??"off";if(!Z)return n1;let W=i0.get(Z);if(W&&W[0]===$)return W[1];let Y={error:EZ("error",Z,$),warn:EZ("warn",Z,$),info:EZ("info",Z,$),debug:EZ("debug",Z,$)};return i0.set(Z,[$,Y]),Y}var m=(X)=>{if(X.options)X.options={...X.options},delete X.options.headers;if(X.headers)X.headers=Object.fromEntries((X.headers instanceof Headers?[...X.headers]:Object.entries(X.headers)).map(([Z,$])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":$]));if("retryOfRequestLogID"in X){if(X.retryOfRequestLogID)X.retryOf=X.retryOfRequestLogID;delete X.retryOfRequestLogID}return X};var RX;class R{constructor(X,Z,$){this.iterator=X,RX.set(this,void 0),this.controller=Z,U(this,RX,$,"f")}static fromSSEResponse(X,Z,$){let W=!1,Y=$?S($):console;async function*J(){if(W)throw new C("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");W=!0;let Q=!1;try{for await(let w of r1(X,Z)){if(w.event==="completion")try{yield JSON.parse(w.data)}catch(G){throw Y.error("Could not parse message into JSON:",w.data),Y.error("From chunk:",w.raw),G}if(w.event==="message_start"||w.event==="message_delta"||w.event==="message_stop"||w.event==="content_block_start"||w.event==="content_block_delta"||w.event==="content_block_stop"||w.event==="message"||w.event==="user.message"||w.event==="user.interrupt"||w.event==="user.tool_confirmation"||w.event==="user.custom_tool_result"||w.event==="agent.message"||w.event==="agent.thinking"||w.event==="agent.tool_use"||w.event==="agent.tool_result"||w.event==="agent.mcp_tool_use"||w.event==="agent.mcp_tool_result"||w.event==="agent.custom_tool_use"||w.event==="agent.thread_context_compacted"||w.event==="session.status_running"||w.event==="session.status_idle"||w.event==="session.status_rescheduled"||w.event==="session.status_terminated"||w.event==="session.error"||w.event==="session.deleted"||w.event==="span.model_request_start"||w.event==="span.model_request_end")try{yield JSON.parse(w.data)}catch(G){throw Y.error("Could not parse message into JSON:",w.data),Y.error("From chunk:",w.raw),G}if(w.event==="ping")continue;if(w.event==="error"){let G=CZ(w.data)??w.data,M=G?.error?.type;throw new A(void 0,G,void 0,X.headers,M)}}Q=!0}catch(w){if(d(w))return;throw w}finally{if(!Q)Z.abort()}}return new R(J,Z,$)}static fromReadableStream(X,Z,$){let W=!1;async function*Y(){let Q=new n,w=PX(X);for await(let G of w)for(let M of Q.decode(G))yield M;for(let G of Q.flush())yield G}async function*J(){if(W)throw new C("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");W=!0;let Q=!1;try{for await(let w of Y()){if(Q)continue;if(w)yield JSON.parse(w)}Q=!0}catch(w){if(d(w))return;throw w}finally{if(!Q)Z.abort()}}return new R(J,Z,$)}[(RX=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let X=[],Z=[],$=this.iterator(),W=(Y)=>{return{next:()=>{if(Y.length===0){let J=$.next();X.push(J),Z.push(J)}return Y.shift()}}};return[new R(()=>W(X),this.controller,z(this,RX,"f")),new R(()=>W(Z),this.controller,z(this,RX,"f"))]}toReadableStream(){let X=this,Z;return rZ({async start(){Z=X[Symbol.asyncIterator]()},async pull($){try{let{value:W,done:Y}=await Z.next();if(Y)return $.close();let J=fX(JSON.stringify(W)+`
|
|
5
|
+
`);$.enqueue(J)}catch(W){$.error(W)}},async cancel(){await Z.return?.()}})}}async function*r1(X,Z){if(!X.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new C("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new C("Attempted to iterate over a response with no body")}let $=new n0,W=new n,Y=PX(X.body);for await(let J of a1(Y))for(let Q of W.decode(J)){let w=$.decode(Q);if(w)yield w}for(let J of W.flush()){let Q=$.decode(J);if(Q)yield Q}}async function*a1(X){let Z=new Uint8Array;for await(let $ of X){if($==null)continue;let W=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?fX($):$,Y=new Uint8Array(Z.length+W.length);Y.set(Z),Y.set(W,Z.length),Z=Y;let J;while((J=l0(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class n0{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(X){if(X.endsWith("\r"))X=X.substring(0,X.length-1);if(!X){if(!this.event&&!this.data.length)return null;let Y={event:this.event,data:this.data.join(`
|
|
6
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],Y}if(this.chunks.push(X),X.startsWith(":"))return null;let[Z,$,W]=o1(X,":");if(W.startsWith(" "))W=W.substring(1);if(Z==="event")this.event=W;else if(Z==="data")this.data.push(W);return null}}function o1(X,Z){let $=X.indexOf(Z);if($!==-1)return[X.substring(0,$),Z,X.substring($+Z.length)];return[X,"",""]}async function xZ(X,Z){let{response:$,requestLogID:W,retryOfRequestLogID:Y,startTime:J}=Z,Q=await(async()=>{if(Z.options.stream){if(S(X).debug("response",$.status,$.url,$.headers,$.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse($,Z.controller);return R.fromSSEResponse($,Z.controller)}if($.status===204)return null;if(Z.options.__binaryResponse)return $;let G=$.headers.get("content-type")?.split(";")[0]?.trim();if(G?.includes("application/json")||G?.endsWith("+json")){if($.headers.get("content-length")==="0")return;let K=await $.json();return tZ(K,$)}return await $.text()})();return S(X).debug(`[${W}] response parsed`,m({retryOfRequestLogID:Y,url:$.url,status:$.status,body:Q,durationMs:Date.now()-J})),Q}function tZ(X,Z){if(!X||typeof X!=="object"||Array.isArray(X))return X;return Object.defineProperty(X,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var kX;class e extends Promise{constructor(X,Z,$=xZ){super((W)=>{W(null)});this.responsePromise=Z,this.parseResponse=$,kX.set(this,void 0),U(this,kX,X,"f")}_thenUnwrap(X){return new e(z(this,kX,"f"),this.responsePromise,async(Z,$)=>tZ(X(await this.parseResponse(Z,$),$),$.response))}asResponse(){return this.responsePromise.then((X)=>X.response)}async withResponse(){let[X,Z]=await Promise.all([this.parse(),this.asResponse()]);return{data:X,response:Z,request_id:Z.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((X)=>this.parseResponse(z(this,kX,"f"),X));return this.parsedPromise}then(X,Z){return this.parse().then(X,Z)}catch(X){return this.parse().catch(X)}finally(X){return this.parse().finally(X)}}kX=new WeakMap;var HZ;class sZ{constructor(X,Z,$,W){HZ.set(this,void 0),U(this,HZ,X,"f"),this.options=W,this.response=Z,this.body=$}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let X=this.nextPageRequestOptions();if(!X)throw new C("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await z(this,HZ,"f").requestAPIList(this.constructor,X)}async*iterPages(){let X=this;yield X;while(X.hasNextPage())X=await X.getNextPage(),yield X}async*[(HZ=new WeakMap,Symbol.asyncIterator)](){for await(let X of this.iterPages())for(let Z of X.getPaginatedItems())yield Z}}class FZ extends e{constructor(X,Z,$){super(X,Z,async(W,Y)=>new $(W,Y.response,await xZ(W,Y),Y.options))}async*[Symbol.asyncIterator](){let X=await this;for await(let Z of X)yield Z}}class b extends sZ{constructor(X,Z,$,W){super(X,Z,$,W);this.data=$.data||[],this.has_more=$.has_more||!1,this.first_id=$.first_id||null,this.last_id=$.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let Z=this.first_id;if(!Z)return null;return{...this.options,query:{...qZ(this.options.query),before_id:Z}}}let X=this.last_id;if(!X)return null;return{...this.options,query:{...qZ(this.options.query),after_id:X}}}}class F extends sZ{constructor(X,Z,$,W){super(X,Z,$,W);this.data=$.data||[],this.next_page=$.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let X=this.next_page;if(!X)return null;return{...this.options,query:{...qZ(this.options.query),page:X}}}}var X0=()=>{if(typeof File>"u"){let{process:X}=globalThis,Z=typeof X?.versions?.node==="string"&&parseInt(X.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(Z?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function XX(X,Z,$){return X0(),new File(X,Z??"unknown_file",$)}function yX(X,Z){let $=typeof X==="object"&&X!==null&&(("name"in X)&&X.name&&String(X.name)||("url"in X)&&X.url&&String(X.url)||("filename"in X)&&X.filename&&String(X.filename)||("path"in X)&&X.path&&String(X.path))||"";return Z?$.split(/[\\/]/).pop()||void 0:$}var Z0=(X)=>X!=null&&typeof X==="object"&&typeof X[Symbol.asyncIterator]==="function";var wX=async(X,Z,$=!0)=>{return{...X,body:await e1(X.body,Z,$)}},r0=new WeakMap;function s1(X){let Z=typeof X==="function"?X:X.fetch,$=r0.get(Z);if($)return $;let W=(async()=>{try{let Y="Response"in Z?Z.Response:(await Z("data:,")).constructor,J=new FormData;if(J.toString()===await new Y(J).text())return!1;return!0}catch{return!0}})();return r0.set(Z,W),W}var e1=async(X,Z,$=!0)=>{if(!await s1(Z))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let W=new FormData;return await Promise.all(Object.entries(X||{}).map(([Y,J])=>eZ(W,Y,J,$))),W},X2=(X)=>X instanceof Blob&&("name"in X);var eZ=async(X,Z,$,W)=>{if($===void 0)return;if($==null)throw TypeError(`Received null for "${Z}"; to pass null in FormData, you must use the string 'null'`);if(typeof $==="string"||typeof $==="number"||typeof $==="boolean")X.append(Z,String($));else if($ instanceof Response){let Y={},J=$.headers.get("Content-Type");if(J)Y={type:J};X.append(Z,XX([await $.blob()],yX($,W),Y))}else if(Z0($))X.append(Z,XX([await new Response(OZ($)).blob()],yX($,W)));else if(X2($))X.append(Z,XX([$],yX($,W),{type:$.type}));else if(Array.isArray($))await Promise.all($.map((Y)=>eZ(X,Z+"[]",Y,W)));else if(typeof $==="object")await Promise.all(Object.entries($).map(([Y,J])=>eZ(X,`${Z}[${Y}]`,J,W)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${$} instead`)};var a0=(X)=>X!=null&&typeof X==="object"&&typeof X.size==="number"&&typeof X.type==="string"&&typeof X.text==="function"&&typeof X.slice==="function"&&typeof X.arrayBuffer==="function",Z2=(X)=>X!=null&&typeof X==="object"&&typeof X.name==="string"&&typeof X.lastModified==="number"&&a0(X),$2=(X)=>X!=null&&typeof X==="object"&&typeof X.url==="string"&&typeof X.blob==="function";async function LZ(X,Z,$){if(X0(),X=await X,Z||(Z=yX(X,!0)),Z2(X)){if(X instanceof File&&Z==null&&$==null)return X;return XX([await X.arrayBuffer()],Z??X.name,{type:X.type,lastModified:X.lastModified,...$})}if($2(X)){let Y=await X.blob();return Z||(Z=new URL(X.url).pathname.split(/[\\/]/).pop()),XX(await $0(Y),Z,$)}let W=await $0(X);if(!$?.type){let Y=W.find((J)=>typeof J==="object"&&("type"in J)&&J.type);if(typeof Y==="string")$={...$,type:Y}}return XX(W,Z,$)}async function $0(X){let Z=[];if(typeof X==="string"||ArrayBuffer.isView(X)||X instanceof ArrayBuffer)Z.push(X);else if(a0(X))Z.push(X instanceof Blob?X:await X.arrayBuffer());else if(Z0(X))for await(let $ of X)Z.push(...await $0($));else{let $=X?.constructor?.name;throw Error(`Unexpected data type: ${typeof X}${$?`; constructor: ${$}`:""}${W2(X)}`)}return Z}function W2(X){if(typeof X!=="object"||X===null)return"";return`; props: [${Object.getOwnPropertyNames(X).map(($)=>`"${$}"`).join(", ")}]`}class x{constructor(X){this._client=X}}var o0=Symbol.for("brand.privateNullableHeaders");function*J2(X){if(!X)return;if(o0 in X){let{values:W,nulls:Y}=X;yield*W.entries();for(let J of Y)yield[J,null];return}let Z=!1,$;if(X instanceof Headers)$=X.entries();else if(iZ(X))$=X;else Z=!0,$=Object.entries(X??{});for(let W of $){let Y=W[0];if(typeof Y!=="string")throw TypeError("expected header name to be a string");let J=iZ(W[1])?W[1]:[W[1]],Q=!1;for(let w of J){if(w===void 0)continue;if(Z&&!Q)Q=!0,yield[Y,null];yield[Y,w]}}}var V=(X)=>{let Z=new Headers,$=new Set;for(let W of X){let Y=new Set;for(let[J,Q]of J2(W)){let w=J.toLowerCase();if(!Y.has(w))Z.delete(J),Y.add(w);if(Q===null)Z.delete(J),$.add(w);else Z.append(J,Q),$.delete(w)}}return{[o0]:!0,values:Z,nulls:$}};function s0(X){return X.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var t0=Object.freeze(Object.create(null)),z2=(X=s0)=>function($,...W){if($.length===1)return $[0];let Y=!1,J=[],Q=$.reduce((O,E,K)=>{if(/[?#]/.test(E))Y=!0;let q=W[K],H=(Y?encodeURIComponent:X)(""+q);if(K!==W.length&&(q==null||typeof q==="object"&&q.toString===Object.getPrototypeOf(Object.getPrototypeOf(q.hasOwnProperty??t0)??t0)?.toString))H=q+"",J.push({start:O.length+E.length,length:H.length,error:`Value of type ${Object.prototype.toString.call(q).slice(8,-1)} is not a valid path parameter`});return O+E+(K===W.length?"":H)},""),w=Q.split(/[?#]/,1)[0],G=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,M;while((M=G.exec(w))!==null)J.push({start:M.index,length:M[0].length,error:`Value "${M[0]}" can't be safely passed as a path parameter`});if(J.sort((O,E)=>O.start-E.start),J.length>0){let O=0,E=J.reduce((K,q)=>{let H=" ".repeat(q.start-O),B="^".repeat(q.length);return O=q.start+q.length,K+H+B},"");throw new C(`Path parameters result in path with invalid segments:
|
|
7
|
+
${J.map((K)=>K.error).join(`
|
|
8
|
+
`)}
|
|
9
|
+
${Q}
|
|
10
|
+
${E}`)}return Q},N=z2(s0);class _X extends x{create(X,Z){let{betas:$,...W}=X;return this._client.post("/v1/environments?beta=true",{body:W,...Z,headers:V([{"anthropic-beta":[...$??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/environments/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}update(X,Z,$){let{betas:W,...Y}=Z;return this._client.post(N`/v1/environments/${X}?beta=true`,{body:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}list(X={},Z){let{betas:$,...W}=X??{};return this._client.getAPIList("/v1/environments?beta=true",F,{query:W,...Z,headers:V([{"anthropic-beta":[...$??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete(X,Z={},$){let{betas:W}=Z??{};return this._client.delete(N`/v1/environments/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}archive(X,Z={},$){let{betas:W}=Z??{};return this._client.post(N`/v1/environments/${X}/archive?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}}var hX=Symbol("anthropic.sdk.stainlessHelper");function AZ(X){return typeof X==="object"&&X!==null&&hX in X}function W0(X,Z){let $=new Set;if(X){for(let W of X)if(AZ(W))$.add(W[hX])}if(Z)for(let W of Z){if(AZ(W))$.add(W[hX]);if(Array.isArray(W.content)){for(let Y of W.content)if(AZ(Y))$.add(Y[hX])}}return Array.from($)}function jZ(X,Z){let $=W0(X,Z);if($.length===0)return{};return{"x-stainless-helper":$.join(", ")}}function e0(X){if(AZ(X))return{"x-stainless-helper":X[hX]};return{}}class gX extends x{list(X={},Z){let{betas:$,...W}=X??{};return this._client.getAPIList("/v1/files?beta=true",b,{query:W,...Z,headers:V([{"anthropic-beta":[...$??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete(X,Z={},$){let{betas:W}=Z??{};return this._client.delete(N`/v1/files/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"files-api-2025-04-14"].toString()},$?.headers])})}download(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/files/${X}/content?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},$?.headers]),__binaryResponse:!0})}retrieveMetadata(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/files/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"files-api-2025-04-14"].toString()},$?.headers])})}upload(X,Z){let{betas:$,...W}=X;return this._client.post("/v1/files?beta=true",wX({body:W,...Z,headers:V([{"anthropic-beta":[...$??[],"files-api-2025-04-14"].toString()},e0(W.file),Z?.headers])},this._client))}}class bX extends x{retrieve(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/models/${X}?beta=true`,{...$,headers:V([{...W?.toString()!=null?{"anthropic-beta":W?.toString()}:void 0},$?.headers])})}list(X={},Z){let{betas:$,...W}=X??{};return this._client.getAPIList("/v1/models?beta=true",b,{query:W,...Z,headers:V([{...$?.toString()!=null?{"anthropic-beta":$?.toString()}:void 0},Z?.headers])})}}class vX extends x{create(X,Z){let{betas:$,...W}=X;return this._client.post("/v1/user_profiles?beta=true",{body:W,...Z,headers:V([{"anthropic-beta":[...$??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/user_profiles/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"user-profiles-2026-03-24"].toString()},$?.headers])})}update(X,Z,$){let{betas:W,...Y}=Z;return this._client.post(N`/v1/user_profiles/${X}?beta=true`,{body:Y,...$,headers:V([{"anthropic-beta":[...W??[],"user-profiles-2026-03-24"].toString()},$?.headers])})}list(X={},Z){let{betas:$,...W}=X??{};return this._client.getAPIList("/v1/user_profiles?beta=true",F,{query:W,...Z,headers:V([{"anthropic-beta":[...$??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL(X,Z={},$){let{betas:W}=Z??{};return this._client.post(N`/v1/user_profiles/${X}/enrollment_url?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"user-profiles-2026-03-24"].toString()},$?.headers])})}}class cX extends x{list(X,Z={},$){let{betas:W,...Y}=Z??{};return this._client.getAPIList(N`/v1/agents/${X}/versions?beta=true`,F,{query:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}}class QX extends x{constructor(){super(...arguments);this.versions=new cX(this._client)}create(X,Z){let{betas:$,...W}=X;return this._client.post("/v1/agents?beta=true",{body:W,...Z,headers:V([{"anthropic-beta":[...$??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve(X,Z={},$){let{betas:W,...Y}=Z??{};return this._client.get(N`/v1/agents/${X}?beta=true`,{query:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}update(X,Z,$){let{betas:W,...Y}=Z;return this._client.post(N`/v1/agents/${X}?beta=true`,{body:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}list(X={},Z){let{betas:$,...W}=X??{};return this._client.getAPIList("/v1/agents?beta=true",F,{query:W,...Z,headers:V([{"anthropic-beta":[...$??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive(X,Z={},$){let{betas:W}=Z??{};return this._client.post(N`/v1/agents/${X}/archive?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}}QX.Versions=cX;class dX extends x{create(X,Z,$){let{view:W,betas:Y,...J}=Z;return this._client.post(N`/v1/memory_stores/${X}/memories?beta=true`,{query:{view:W},body:J,...$,headers:V([{"anthropic-beta":[...Y??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}retrieve(X,Z,$){let{memory_store_id:W,betas:Y,...J}=Z;return this._client.get(N`/v1/memory_stores/${W}/memories/${X}?beta=true`,{query:J,...$,headers:V([{"anthropic-beta":[...Y??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}update(X,Z,$){let{memory_store_id:W,view:Y,betas:J,...Q}=Z;return this._client.post(N`/v1/memory_stores/${W}/memories/${X}?beta=true`,{query:{view:Y},body:Q,...$,headers:V([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}list(X,Z={},$){let{betas:W,...Y}=Z??{};return this._client.getAPIList(N`/v1/memory_stores/${X}/memories?beta=true`,F,{query:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}delete(X,Z,$){let{memory_store_id:W,expected_content_sha256:Y,betas:J}=Z;return this._client.delete(N`/v1/memory_stores/${W}/memories/${X}?beta=true`,{query:{expected_content_sha256:Y},...$,headers:V([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}}class mX extends x{retrieve(X,Z,$){let{memory_store_id:W,betas:Y,...J}=Z;return this._client.get(N`/v1/memory_stores/${W}/memory_versions/${X}?beta=true`,{query:J,...$,headers:V([{"anthropic-beta":[...Y??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}list(X,Z={},$){let{betas:W,...Y}=Z??{};return this._client.getAPIList(N`/v1/memory_stores/${X}/memory_versions?beta=true`,F,{query:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}redact(X,Z,$){let{memory_store_id:W,betas:Y}=Z;return this._client.post(N`/v1/memory_stores/${W}/memory_versions/${X}/redact?beta=true`,{...$,headers:V([{"anthropic-beta":[...Y??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}}class ZX extends x{constructor(){super(...arguments);this.memories=new dX(this._client),this.memoryVersions=new mX(this._client)}create(X,Z){let{betas:$,...W}=X;return this._client.post("/v1/memory_stores?beta=true",{body:W,...Z,headers:V([{"anthropic-beta":[...$??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/memory_stores/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}update(X,Z,$){let{betas:W,...Y}=Z;return this._client.post(N`/v1/memory_stores/${X}?beta=true`,{body:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}list(X={},Z){let{betas:$,...W}=X??{};return this._client.getAPIList("/v1/memory_stores?beta=true",F,{query:W,...Z,headers:V([{"anthropic-beta":[...$??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete(X,Z={},$){let{betas:W}=Z??{};return this._client.delete(N`/v1/memory_stores/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}archive(X,Z={},$){let{betas:W}=Z??{};return this._client.post(N`/v1/memory_stores/${X}/archive?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}}ZX.Memories=dX;ZX.MemoryVersions=mX;var SZ={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};function X1(X){return X?.output_format??X?.output_config?.format}function Y0(X,Z,$){let W=X1(Z);if(!Z||!("parse"in(W??{})))return{...X,content:X.content.map((Y)=>{if(Y.type==="text"){let J=Object.defineProperty({...Y},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(J,"parsed",{get(){return $.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return Y}),parsed_output:null};return J0(X,Z,$)}function J0(X,Z,$){let W=null,Y=X.content.map((J)=>{if(J.type==="text"){let Q=O2(Z,J.text);if(W===null)W=Q;let w=Object.defineProperty({...J},"parsed_output",{value:Q,enumerable:!1});return Object.defineProperty(w,"parsed",{get(){return $.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Q},enumerable:!1})}return J});return{...X,content:Y,parsed_output:W}}function O2(X,Z){let $=X1(X);if($?.type!=="json_schema")return null;try{if("parse"in $)return $.parse(Z);return JSON.parse(Z)}catch(W){throw new C(`Failed to parse structured output: ${W}`)}}var E2=(X)=>{let Z=0,$=[];while(Z<X.length){let W=X[Z];if(W==="\\"){Z++;continue}if(W==="{"){$.push({type:"brace",value:"{"}),Z++;continue}if(W==="}"){$.push({type:"brace",value:"}"}),Z++;continue}if(W==="["){$.push({type:"paren",value:"["}),Z++;continue}if(W==="]"){$.push({type:"paren",value:"]"}),Z++;continue}if(W===":"){$.push({type:"separator",value:":"}),Z++;continue}if(W===","){$.push({type:"delimiter",value:","}),Z++;continue}if(W==='"'){let w="",G=!1;W=X[++Z];while(W!=='"'){if(Z===X.length){G=!0;break}if(W==="\\"){if(Z++,Z===X.length){G=!0;break}w+=W+X[Z],W=X[++Z]}else w+=W,W=X[++Z]}if(W=X[++Z],!G)$.push({type:"string",value:w});continue}if(W&&/\s/.test(W)){Z++;continue}let J=/[0-9]/;if(W&&J.test(W)||W==="-"||W==="."){let w="";if(W==="-")w+=W,W=X[++Z];while(W&&J.test(W)||W===".")w+=W,W=X[++Z];$.push({type:"number",value:w});continue}let Q=/[a-z]/i;if(W&&Q.test(W)){let w="";while(W&&Q.test(W)){if(Z===X.length)break;w+=W,W=X[++Z]}if(w=="true"||w=="false"||w==="null")$.push({type:"name",value:w});else{Z++;continue}continue}Z++}return $},KX=(X)=>{if(X.length===0)return X;let Z=X[X.length-1];switch(Z.type){case"separator":return X=X.slice(0,X.length-1),KX(X);break;case"number":let $=Z.value[Z.value.length-1];if($==="."||$==="-")return X=X.slice(0,X.length-1),KX(X);case"string":let W=X[X.length-2];if(W?.type==="delimiter")return X=X.slice(0,X.length-1),KX(X);else if(W?.type==="brace"&&W.value==="{")return X=X.slice(0,X.length-1),KX(X);break;case"delimiter":return X=X.slice(0,X.length-1),KX(X);break}return X},M2=(X)=>{let Z=[];if(X.map(($)=>{if($.type==="brace")if($.value==="{")Z.push("}");else Z.splice(Z.lastIndexOf("}"),1);if($.type==="paren")if($.value==="[")Z.push("]");else Z.splice(Z.lastIndexOf("]"),1)}),Z.length>0)Z.reverse().map(($)=>{if($==="}")X.push({type:"brace",value:"}"});else if($==="]")X.push({type:"paren",value:"]"})});return X},x2=(X)=>{let Z="";return X.map(($)=>{switch($.type){case"string":Z+='"'+$.value+'"';break;default:Z+=$.value;break}}),Z},BZ=(X)=>JSON.parse(x2(M2(KX(E2(X)))));var h,r,VX,uX,DZ,pX,lX,TZ,iX,u,nX,PZ,fZ,$X,IZ,RZ,rX,z0,Z1,kZ,w0,Q0,K0,$1,W1="__json_buf";function Y1(X){return X.type==="tool_use"||X.type==="server_tool_use"||X.type==="mcp_tool_use"}class aX{constructor(X,Z){h.add(this),this.messages=[],this.receivedMessages=[],r.set(this,void 0),VX.set(this,null),this.controller=new AbortController,uX.set(this,void 0),DZ.set(this,()=>{}),pX.set(this,()=>{}),lX.set(this,void 0),TZ.set(this,()=>{}),iX.set(this,()=>{}),u.set(this,{}),nX.set(this,!1),PZ.set(this,!1),fZ.set(this,!1),$X.set(this,!1),IZ.set(this,void 0),RZ.set(this,void 0),rX.set(this,void 0),kZ.set(this,($)=>{if(U(this,PZ,!0,"f"),d($))$=new D;if($ instanceof D)return U(this,fZ,!0,"f"),this._emit("abort",$);if($ instanceof C)return this._emit("error",$);if($ instanceof Error){let W=new C($.message);return W.cause=$,this._emit("error",W)}return this._emit("error",new C(String($)))}),U(this,uX,new Promise(($,W)=>{U(this,DZ,$,"f"),U(this,pX,W,"f")}),"f"),U(this,lX,new Promise(($,W)=>{U(this,TZ,$,"f"),U(this,iX,W,"f")}),"f"),z(this,uX,"f").catch(()=>{}),z(this,lX,"f").catch(()=>{}),U(this,VX,X,"f"),U(this,rX,Z?.logger??console,"f")}get response(){return z(this,IZ,"f")}get request_id(){return z(this,RZ,"f")}async withResponse(){U(this,$X,!0,"f");let X=await z(this,uX,"f");if(!X)throw Error("Could not resolve a `Response` object");return{data:this,response:X,request_id:X.headers.get("request-id")}}static fromReadableStream(X){let Z=new aX(null);return Z._run(()=>Z._fromReadableStream(X)),Z}static createMessage(X,Z,$,{logger:W}={}){let Y=new aX(Z,{logger:W});for(let J of Z.messages)Y._addMessageParam(J);return U(Y,VX,{...Z,stream:!0},"f"),Y._run(()=>Y._createMessage(X,{...Z,stream:!0},{...$,headers:{...$?.headers,"X-Stainless-Helper-Method":"stream"}})),Y}_run(X){X().then(()=>{this._emitFinal(),this._emit("end")},z(this,kZ,"f"))}_addMessageParam(X){this.messages.push(X)}_addMessage(X,Z=!0){if(this.receivedMessages.push(X),Z)this._emit("message",X)}async _createMessage(X,Z,$){let W=$?.signal,Y;if(W){if(W.aborted)this.controller.abort();Y=this.controller.abort.bind(this.controller),W.addEventListener("abort",Y)}try{z(this,h,"m",w0).call(this);let{response:J,data:Q}=await X.create({...Z,stream:!0},{...$,signal:this.controller.signal}).withResponse();this._connected(J);for await(let w of Q)z(this,h,"m",Q0).call(this,w);if(Q.controller.signal?.aborted)throw new D;z(this,h,"m",K0).call(this)}finally{if(W&&Y)W.removeEventListener("abort",Y)}}_connected(X){if(this.ended)return;U(this,IZ,X,"f"),U(this,RZ,X?.headers.get("request-id"),"f"),z(this,DZ,"f").call(this,X),this._emit("connect")}get ended(){return z(this,nX,"f")}get errored(){return z(this,PZ,"f")}get aborted(){return z(this,fZ,"f")}abort(){this.controller.abort()}on(X,Z){return(z(this,u,"f")[X]||(z(this,u,"f")[X]=[])).push({listener:Z}),this}off(X,Z){let $=z(this,u,"f")[X];if(!$)return this;let W=$.findIndex((Y)=>Y.listener===Z);if(W>=0)$.splice(W,1);return this}once(X,Z){return(z(this,u,"f")[X]||(z(this,u,"f")[X]=[])).push({listener:Z,once:!0}),this}emitted(X){return new Promise((Z,$)=>{if(U(this,$X,!0,"f"),X!=="error")this.once("error",$);this.once(X,Z)})}async done(){U(this,$X,!0,"f"),await z(this,lX,"f")}get currentMessage(){return z(this,r,"f")}async finalMessage(){return await this.done(),z(this,h,"m",z0).call(this)}async finalText(){return await this.done(),z(this,h,"m",Z1).call(this)}_emit(X,...Z){if(z(this,nX,"f"))return;if(X==="end")U(this,nX,!0,"f"),z(this,TZ,"f").call(this);let $=z(this,u,"f")[X];if($)z(this,u,"f")[X]=$.filter((W)=>!W.once),$.forEach(({listener:W})=>W(...Z));if(X==="abort"){let W=Z[0];if(!z(this,$X,"f")&&!$?.length)Promise.reject(W);z(this,pX,"f").call(this,W),z(this,iX,"f").call(this,W),this._emit("end");return}if(X==="error"){let W=Z[0];if(!z(this,$X,"f")&&!$?.length)Promise.reject(W);z(this,pX,"f").call(this,W),z(this,iX,"f").call(this,W),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",z(this,h,"m",z0).call(this))}async _fromReadableStream(X,Z){let $=Z?.signal,W;if($){if($.aborted)this.controller.abort();W=this.controller.abort.bind(this.controller),$.addEventListener("abort",W)}try{z(this,h,"m",w0).call(this),this._connected(null);let Y=R.fromReadableStream(X,this.controller);for await(let J of Y)z(this,h,"m",Q0).call(this,J);if(Y.controller.signal?.aborted)throw new D;z(this,h,"m",K0).call(this)}finally{if($&&W)$.removeEventListener("abort",W)}}[(r=new WeakMap,VX=new WeakMap,uX=new WeakMap,DZ=new WeakMap,pX=new WeakMap,lX=new WeakMap,TZ=new WeakMap,iX=new WeakMap,u=new WeakMap,nX=new WeakMap,PZ=new WeakMap,fZ=new WeakMap,$X=new WeakMap,IZ=new WeakMap,RZ=new WeakMap,rX=new WeakMap,kZ=new WeakMap,h=new WeakSet,z0=function(){if(this.receivedMessages.length===0)throw new C("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Z1=function(){if(this.receivedMessages.length===0)throw new C("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter(($)=>$.type==="text").map(($)=>$.text);if(Z.length===0)throw new C("stream ended without producing a content block with type=text");return Z.join(" ")},w0=function(){if(this.ended)return;U(this,r,void 0,"f")},Q0=function(Z){if(this.ended)return;let $=z(this,h,"m",$1).call(this,Z);switch(this._emit("streamEvent",Z,$),Z.type){case"content_block_delta":{let W=$.content.at(-1);switch(Z.delta.type){case"text_delta":{if(W.type==="text")this._emit("text",Z.delta.text,W.text||"");break}case"citations_delta":{if(W.type==="text")this._emit("citation",Z.delta.citation,W.citations??[]);break}case"input_json_delta":{if(Y1(W)&&W.input)this._emit("inputJson",Z.delta.partial_json,W.input);break}case"thinking_delta":{if(W.type==="thinking")this._emit("thinking",Z.delta.thinking,W.thinking);break}case"signature_delta":{if(W.type==="thinking")this._emit("signature",W.signature);break}case"compaction_delta":{if(W.type==="compaction"&&W.content)this._emit("compaction",W.content);break}default:J1(Z.delta)}break}case"message_stop":{this._addMessageParam($),this._addMessage(Y0($,z(this,VX,"f"),{logger:z(this,rX,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",$.content.at(-1));break}case"message_start":{U(this,r,$,"f");break}case"content_block_start":case"message_delta":break}},K0=function(){if(this.ended)throw new C("stream has ended, this shouldn't happen");let Z=z(this,r,"f");if(!Z)throw new C("request ended without sending any chunks");return U(this,r,void 0,"f"),Y0(Z,z(this,VX,"f"),{logger:z(this,rX,"f")})},$1=function(Z){let $=z(this,r,"f");if(Z.type==="message_start"){if($)throw new C(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!$)throw new C(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return $;case"message_delta":if($.container=Z.delta.container,$.stop_reason=Z.delta.stop_reason,$.stop_sequence=Z.delta.stop_sequence,$.usage.output_tokens=Z.usage.output_tokens,$.context_management=Z.context_management,Z.usage.input_tokens!=null)$.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)$.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)$.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)$.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)$.usage.iterations=Z.usage.iterations;return $;case"content_block_start":return $.content.push(Z.content_block),$;case"content_block_delta":{let W=$.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(W?.type==="text")$.content[Z.index]={...W,text:(W.text||"")+Z.delta.text};break}case"citations_delta":{if(W?.type==="text")$.content[Z.index]={...W,citations:[...W.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(W&&Y1(W)){let Y=W[W1]||"";Y+=Z.delta.partial_json;let J={...W};if(Object.defineProperty(J,W1,{value:Y,enumerable:!1,writable:!0}),Y)try{J.input=BZ(Y)}catch(Q){let w=new C(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Q}. JSON: ${Y}`);z(this,kZ,"f").call(this,w)}$.content[Z.index]=J}break}case"thinking_delta":{if(W?.type==="thinking")$.content[Z.index]={...W,thinking:W.thinking+Z.delta.thinking};break}case"signature_delta":{if(W?.type==="thinking")$.content[Z.index]={...W,signature:Z.delta.signature};break}case"compaction_delta":{if(W?.type==="compaction")$.content[Z.index]={...W,content:(W.content||"")+Z.delta.content};break}default:J1(Z.delta)}return $}case"content_block_stop":return $}},Symbol.asyncIterator)](){let X=[],Z=[],$=!1;return this.on("streamEvent",(W)=>{let Y=Z.shift();if(Y)Y.resolve(W);else X.push(W)}),this.on("end",()=>{$=!0;for(let W of Z)W.resolve(void 0);Z.length=0}),this.on("abort",(W)=>{$=!0;for(let Y of Z)Y.reject(W);Z.length=0}),this.on("error",(W)=>{$=!0;for(let Y of Z)Y.reject(W);Z.length=0}),{next:async()=>{if(!X.length){if($)return{value:void 0,done:!0};return new Promise((Y,J)=>Z.push({resolve:Y,reject:J})).then((Y)=>Y?{value:Y,done:!1}:{value:void 0,done:!0})}return{value:X.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new R(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function J1(X){}class GX extends Error{constructor(X){let Z=typeof X==="string"?X:X.map(($)=>{if($.type==="text")return $.text;return`[${$.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=X}}var z1=1e5,w1=`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:
|
|
11
|
+
1. Task Overview
|
|
12
|
+
The user's core request and success criteria
|
|
13
|
+
Any clarifications or constraints they specified
|
|
14
|
+
2. Current State
|
|
15
|
+
What has been completed so far
|
|
16
|
+
Files created, modified, or analyzed (with paths if relevant)
|
|
17
|
+
Key outputs or artifacts produced
|
|
18
|
+
3. Important Discoveries
|
|
19
|
+
Technical constraints or requirements uncovered
|
|
20
|
+
Decisions made and their rationale
|
|
21
|
+
Errors encountered and how they were resolved
|
|
22
|
+
What approaches were tried that didn't work (and why)
|
|
23
|
+
4. Next Steps
|
|
24
|
+
Specific actions needed to complete the task
|
|
25
|
+
Any blockers or open questions to resolve
|
|
26
|
+
Priority order if multiple steps remain
|
|
27
|
+
5. Context to Preserve
|
|
28
|
+
User preferences or style requirements
|
|
29
|
+
Domain-specific details that aren't obvious
|
|
30
|
+
Any promises made to the user
|
|
31
|
+
Be concise but complete\u2014err 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.
|
|
32
|
+
Wrap your summary in <summary></summary> tags.`;var oX,NX,WX,j,P,k,p,a,tX,Q1,V0;function K1(){let X,Z;return{promise:new Promise((W,Y)=>{X=W,Z=Y}),resolve:X,reject:Z}}class sX{constructor(X,Z,$){oX.add(this),this.client=X,NX.set(this,!1),WX.set(this,!1),j.set(this,void 0),P.set(this,void 0),k.set(this,void 0),p.set(this,void 0),a.set(this,void 0),tX.set(this,0),U(this,j,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let Y=["BetaToolRunner",...W0(Z.tools,Z.messages)].join(", ");if(U(this,P,{...$,headers:V([{"x-stainless-helper":Y},$?.headers])},"f"),U(this,a,K1(),"f"),Z.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*[(NX=new WeakMap,WX=new WeakMap,j=new WeakMap,P=new WeakMap,k=new WeakMap,p=new WeakMap,a=new WeakMap,tX=new WeakMap,oX=new WeakSet,Q1=async function(){let Z=z(this,j,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let $=0;if(z(this,k,"f")!==void 0)try{let G=await z(this,k,"f");$=G.usage.input_tokens+(G.usage.cache_creation_input_tokens??0)+(G.usage.cache_read_input_tokens??0)+G.usage.output_tokens}catch{return!1}let W=Z.contextTokenThreshold??z1;if($<W)return!1;let Y=Z.model??z(this,j,"f").params.model,J=Z.summaryPrompt??w1,Q=z(this,j,"f").params.messages;if(Q[Q.length-1].role==="assistant"){let G=Q[Q.length-1];if(Array.isArray(G.content)){let M=G.content.filter((O)=>O.type!=="tool_use");if(M.length===0)Q.pop();else G.content=M}}let w=await this.client.beta.messages.create({model:Y,messages:[...Q,{role:"user",content:[{type:"text",text:J}]}],max_tokens:z(this,j,"f").params.max_tokens},{signal:z(this,P,"f").signal,headers:V([z(this,P,"f").headers,{"x-stainless-helper":"compaction"}])});if(w.content[0]?.type!=="text")throw new C("Expected text response for compaction");return z(this,j,"f").params.messages=[{role:"user",content:w.content}],!0},Symbol.asyncIterator)](){var X;if(z(this,NX,"f"))throw new C("Cannot iterate over a consumed stream");U(this,NX,!0,"f"),U(this,WX,!0,"f"),U(this,p,void 0,"f");try{while(!0){let Z;try{if(z(this,j,"f").params.max_iterations&&z(this,tX,"f")>=z(this,j,"f").params.max_iterations)break;U(this,WX,!1,"f"),U(this,p,void 0,"f"),U(this,tX,(X=z(this,tX,"f"),X++,X),"f"),U(this,k,void 0,"f");let{max_iterations:$,compactionControl:W,...Y}=z(this,j,"f").params;if(Y.stream)Z=this.client.beta.messages.stream({...Y},z(this,P,"f")),U(this,k,Z.finalMessage(),"f"),z(this,k,"f").catch(()=>{}),yield Z;else U(this,k,this.client.beta.messages.create({...Y,stream:!1},z(this,P,"f")),"f"),yield z(this,k,"f");if(!await z(this,oX,"m",Q1).call(this)){if(!z(this,WX,"f")){let{role:w,content:G}=await z(this,k,"f");z(this,j,"f").params.messages.push({role:w,content:G})}let Q=await z(this,oX,"m",V0).call(this,z(this,j,"f").params.messages.at(-1));if(Q)z(this,j,"f").params.messages.push(Q);else if(!z(this,WX,"f"))break}}finally{if(Z)Z.abort()}}if(!z(this,k,"f"))throw new C("ToolRunner concluded without a message from the server");z(this,a,"f").resolve(await z(this,k,"f"))}catch(Z){throw U(this,NX,!1,"f"),z(this,a,"f").promise.catch(()=>{}),z(this,a,"f").reject(Z),U(this,a,K1(),"f"),Z}}setMessagesParams(X){if(typeof X==="function")z(this,j,"f").params=X(z(this,j,"f").params);else z(this,j,"f").params=X;U(this,WX,!0,"f"),U(this,p,void 0,"f")}setRequestOptions(X){if(typeof X==="function")U(this,P,X(z(this,P,"f")),"f");else U(this,P,{...z(this,P,"f"),...X},"f")}async generateToolResponse(X=z(this,P,"f").signal){let Z=await z(this,k,"f")??this.params.messages.at(-1);if(!Z)return null;return z(this,oX,"m",V0).call(this,Z,X)}done(){return z(this,a,"f").promise}async runUntilDone(){if(!z(this,NX,"f"))for await(let X of this);return this.done()}get params(){return z(this,j,"f").params}pushMessages(...X){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...X]}))}then(X,Z){return this.runUntilDone().then(X,Z)}}V0=async function(Z,$=z(this,P,"f").signal){if(z(this,p,"f")!==void 0)return z(this,p,"f");return U(this,p,H2(z(this,j,"f").params,Z,{...z(this,P,"f"),signal:$}),"f"),z(this,p,"f")};async function H2(X,Z=X.messages.at(-1),$){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let W=Z.content.filter((J)=>J.type==="tool_use");if(W.length===0)return null;return{role:"user",content:await Promise.all(W.map(async(J)=>{let Q=X.tools.find((w)=>("name"in w?w.name:w.mcp_server_name)===J.name);if(!Q||!("run"in Q))return{type:"tool_result",tool_use_id:J.id,content:`Error: Tool '${J.name}' not found`,is_error:!0};try{let w=J.input;if("parse"in Q&&Q.parse)w=Q.parse(w);let G=await Q.run(w,{toolUseBlock:J,signal:$?.signal});return{type:"tool_result",tool_use_id:J.id,content:G}}catch(w){return{type:"tool_result",tool_use_id:J.id,content:w instanceof GX?w.content:`Error: ${w instanceof Error?w.message:String(w)}`,is_error:!0}}}))}}class UX{constructor(X,Z){this.iterator=X,this.controller=Z}async*decoder(){let X=new n;for await(let Z of this.iterator)for(let $ of X.decode(Z))yield JSON.parse($);for(let Z of X.flush())yield JSON.parse(Z)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(X,Z){if(!X.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new C("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new C("Attempted to iterate over a response with no body")}return new UX(PX(X.body),Z)}}class eX extends x{create(X,Z){let{betas:$,...W}=X;return this._client.post("/v1/messages/batches?beta=true",{body:W,...Z,headers:V([{"anthropic-beta":[...$??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/messages/batches/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"message-batches-2024-09-24"].toString()},$?.headers])})}list(X={},Z){let{betas:$,...W}=X??{};return this._client.getAPIList("/v1/messages/batches?beta=true",b,{query:W,...Z,headers:V([{"anthropic-beta":[...$??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete(X,Z={},$){let{betas:W}=Z??{};return this._client.delete(N`/v1/messages/batches/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"message-batches-2024-09-24"].toString()},$?.headers])})}cancel(X,Z={},$){let{betas:W}=Z??{};return this._client.post(N`/v1/messages/batches/${X}/cancel?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"message-batches-2024-09-24"].toString()},$?.headers])})}async results(X,Z={},$){let W=await this.retrieve(X);if(!W.results_url)throw new C(`No batch \`results_url\`; Has it finished processing? ${W.processing_status} - ${W.id}`);let{betas:Y}=Z??{};return this._client.get(W.results_url,{...$,headers:V([{"anthropic-beta":[...Y??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},$?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((J,Q)=>UX.fromResponse(Q.response,Q.controller))}}var V1={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},L2=["claude-mythos-preview","claude-opus-4-6"];class o extends x{constructor(){super(...arguments);this.batches=new eX(this._client)}create(X,Z){let $=G1(X),{betas:W,...Y}=$;if(Y.model in V1)console.warn(`The model '${Y.model}' is deprecated and will reach end-of-life on ${V1[Y.model]}
|
|
33
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(L2.includes(Y.model)&&Y.thinking&&Y.thinking.type==="enabled")console.warn(`Using Claude with ${Y.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 J=this._client._options.timeout;if(!Y.stream&&J==null){let w=SZ[Y.model]??void 0;J=this._client.calculateNonstreamingTimeout(Y.max_tokens,w)}let Q=jZ(Y.tools,Y.messages);return this._client.post("/v1/messages?beta=true",{body:Y,timeout:J??600000,...Z,headers:V([{...W?.toString()!=null?{"anthropic-beta":W?.toString()}:void 0},Q,Z?.headers]),stream:$.stream??!1})}parse(X,Z){return Z={...Z,headers:V([{"anthropic-beta":[...X.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create(X,Z).then(($)=>J0($,X,{logger:this._client.logger??console}))}stream(X,Z){return aX.createMessage(this,X,Z)}countTokens(X,Z){let $=G1(X),{betas:W,...Y}=$;return this._client.post("/v1/messages/count_tokens?beta=true",{body:Y,...Z,headers:V([{"anthropic-beta":[...W??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner(X,Z){return new sX(this._client,X,Z)}}function G1(X){if(!X.output_format)return X;if(X.output_config?.format)throw new C("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...$}=X;return{...$,output_config:{...X.output_config,format:Z}}}o.Batches=eX;o.BetaToolRunner=sX;o.ToolError=GX;class XZ extends x{list(X,Z={},$){let{betas:W,...Y}=Z??{};return this._client.getAPIList(N`/v1/sessions/${X}/events?beta=true`,F,{query:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}send(X,Z,$){let{betas:W,...Y}=Z;return this._client.post(N`/v1/sessions/${X}/events?beta=true`,{body:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}stream(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/sessions/${X}/events/stream?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers]),stream:!0})}}class ZZ extends x{retrieve(X,Z,$){let{session_id:W,betas:Y}=Z;return this._client.get(N`/v1/sessions/${W}/resources/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...Y??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}update(X,Z,$){let{session_id:W,betas:Y,...J}=Z;return this._client.post(N`/v1/sessions/${W}/resources/${X}?beta=true`,{body:J,...$,headers:V([{"anthropic-beta":[...Y??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}list(X,Z={},$){let{betas:W,...Y}=Z??{};return this._client.getAPIList(N`/v1/sessions/${X}/resources?beta=true`,F,{query:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}delete(X,Z,$){let{session_id:W,betas:Y}=Z;return this._client.delete(N`/v1/sessions/${W}/resources/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...Y??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}add(X,Z,$){let{betas:W,...Y}=Z;return this._client.post(N`/v1/sessions/${X}/resources?beta=true`,{body:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}}class YX extends x{constructor(){super(...arguments);this.events=new XZ(this._client),this.resources=new ZZ(this._client)}create(X,Z){let{betas:$,...W}=X;return this._client.post("/v1/sessions?beta=true",{body:W,...Z,headers:V([{"anthropic-beta":[...$??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/sessions/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}update(X,Z,$){let{betas:W,...Y}=Z;return this._client.post(N`/v1/sessions/${X}?beta=true`,{body:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}list(X={},Z){let{betas:$,...W}=X??{};return this._client.getAPIList("/v1/sessions?beta=true",F,{query:W,...Z,headers:V([{"anthropic-beta":[...$??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete(X,Z={},$){let{betas:W}=Z??{};return this._client.delete(N`/v1/sessions/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}archive(X,Z={},$){let{betas:W}=Z??{};return this._client.post(N`/v1/sessions/${X}/archive?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}}YX.Events=XZ;YX.Resources=ZZ;class $Z extends x{create(X,Z={},$){let{betas:W,...Y}=Z??{};return this._client.post(N`/v1/skills/${X}/versions?beta=true`,wX({body:Y,...$,headers:V([{"anthropic-beta":[...W??[],"skills-2025-10-02"].toString()},$?.headers])},this._client))}retrieve(X,Z,$){let{skill_id:W,betas:Y}=Z;return this._client.get(N`/v1/skills/${W}/versions/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...Y??[],"skills-2025-10-02"].toString()},$?.headers])})}list(X,Z={},$){let{betas:W,...Y}=Z??{};return this._client.getAPIList(N`/v1/skills/${X}/versions?beta=true`,F,{query:Y,...$,headers:V([{"anthropic-beta":[...W??[],"skills-2025-10-02"].toString()},$?.headers])})}delete(X,Z,$){let{skill_id:W,betas:Y}=Z;return this._client.delete(N`/v1/skills/${W}/versions/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...Y??[],"skills-2025-10-02"].toString()},$?.headers])})}}class qX extends x{constructor(){super(...arguments);this.versions=new $Z(this._client)}create(X={},Z){let{betas:$,...W}=X??{};return this._client.post("/v1/skills?beta=true",wX({body:W,...Z,headers:V([{"anthropic-beta":[...$??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/skills/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"skills-2025-10-02"].toString()},$?.headers])})}list(X={},Z){let{betas:$,...W}=X??{};return this._client.getAPIList("/v1/skills?beta=true",F,{query:W,...Z,headers:V([{"anthropic-beta":[...$??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete(X,Z={},$){let{betas:W}=Z??{};return this._client.delete(N`/v1/skills/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"skills-2025-10-02"].toString()},$?.headers])})}}qX.Versions=$Z;class WZ extends x{create(X,Z,$){let{betas:W,...Y}=Z;return this._client.post(N`/v1/vaults/${X}/credentials?beta=true`,{body:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}retrieve(X,Z,$){let{vault_id:W,betas:Y}=Z;return this._client.get(N`/v1/vaults/${W}/credentials/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...Y??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}update(X,Z,$){let{vault_id:W,betas:Y,...J}=Z;return this._client.post(N`/v1/vaults/${W}/credentials/${X}?beta=true`,{body:J,...$,headers:V([{"anthropic-beta":[...Y??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}list(X,Z={},$){let{betas:W,...Y}=Z??{};return this._client.getAPIList(N`/v1/vaults/${X}/credentials?beta=true`,F,{query:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}delete(X,Z,$){let{vault_id:W,betas:Y}=Z;return this._client.delete(N`/v1/vaults/${W}/credentials/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...Y??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}archive(X,Z,$){let{vault_id:W,betas:Y}=Z;return this._client.post(N`/v1/vaults/${W}/credentials/${X}/archive?beta=true`,{...$,headers:V([{"anthropic-beta":[...Y??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}}class CX extends x{constructor(){super(...arguments);this.credentials=new WZ(this._client)}create(X,Z){let{betas:$,...W}=X;return this._client.post("/v1/vaults?beta=true",{body:W,...Z,headers:V([{"anthropic-beta":[...$??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/vaults/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}update(X,Z,$){let{betas:W,...Y}=Z;return this._client.post(N`/v1/vaults/${X}?beta=true`,{body:Y,...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}list(X={},Z){let{betas:$,...W}=X??{};return this._client.getAPIList("/v1/vaults?beta=true",F,{query:W,...Z,headers:V([{"anthropic-beta":[...$??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete(X,Z={},$){let{betas:W}=Z??{};return this._client.delete(N`/v1/vaults/${X}?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}archive(X,Z={},$){let{betas:W}=Z??{};return this._client.post(N`/v1/vaults/${X}/archive?beta=true`,{...$,headers:V([{"anthropic-beta":[...W??[],"managed-agents-2026-04-01"].toString()},$?.headers])})}}CX.Credentials=WZ;class T extends x{constructor(){super(...arguments);this.models=new bX(this._client),this.messages=new o(this._client),this.agents=new QX(this._client),this.environments=new _X(this._client),this.sessions=new YX(this._client),this.vaults=new CX(this._client),this.memoryStores=new ZX(this._client),this.files=new gX(this._client),this.skills=new qX(this._client),this.userProfiles=new vX(this._client)}}T.Models=bX;T.Messages=o;T.Agents=QX;T.Environments=_X;T.Sessions=YX;T.Vaults=CX;T.MemoryStores=ZX;T.Files=gX;T.Skills=qX;T.UserProfiles=vX;class OX extends x{create(X,Z){let{betas:$,...W}=X;return this._client.post("/v1/complete",{body:W,timeout:this._client._options.timeout??600000,...Z,headers:V([{...$?.toString()!=null?{"anthropic-beta":$?.toString()}:void 0},Z?.headers]),stream:X.stream??!1})}}function N1(X){return X?.output_config?.format}function G0(X,Z,$){let W=N1(Z);if(!Z||!("parse"in(W??{})))return{...X,content:X.content.map((Y)=>{if(Y.type==="text")return Object.defineProperty({...Y},"parsed_output",{value:null,enumerable:!1});return Y}),parsed_output:null};return N0(X,Z,$)}function N0(X,Z,$){let W=null,Y=X.content.map((J)=>{if(J.type==="text"){let Q=I2(Z,J.text);if(W===null)W=Q;return Object.defineProperty({...J},"parsed_output",{value:Q,enumerable:!1})}return J});return{...X,content:Y,parsed_output:W}}function I2(X,Z){let $=N1(X);if($?.type!=="json_schema")return null;try{if("parse"in $)return $.parse(Z);return JSON.parse(Z)}catch(W){throw new C(`Failed to parse structured output: ${W}`)}}var g,t,EX,YZ,yZ,JZ,zZ,_Z,wZ,l,QZ,hZ,gZ,JX,bZ,vZ,KZ,U0,U1,q0,C0,O0,E0,q1,C1="__json_buf";function O1(X){return X.type==="tool_use"||X.type==="server_tool_use"}class VZ{constructor(X,Z){g.add(this),this.messages=[],this.receivedMessages=[],t.set(this,void 0),EX.set(this,null),this.controller=new AbortController,YZ.set(this,void 0),yZ.set(this,()=>{}),JZ.set(this,()=>{}),zZ.set(this,void 0),_Z.set(this,()=>{}),wZ.set(this,()=>{}),l.set(this,{}),QZ.set(this,!1),hZ.set(this,!1),gZ.set(this,!1),JX.set(this,!1),bZ.set(this,void 0),vZ.set(this,void 0),KZ.set(this,void 0),q0.set(this,($)=>{if(U(this,hZ,!0,"f"),d($))$=new D;if($ instanceof D)return U(this,gZ,!0,"f"),this._emit("abort",$);if($ instanceof C)return this._emit("error",$);if($ instanceof Error){let W=new C($.message);return W.cause=$,this._emit("error",W)}return this._emit("error",new C(String($)))}),U(this,YZ,new Promise(($,W)=>{U(this,yZ,$,"f"),U(this,JZ,W,"f")}),"f"),U(this,zZ,new Promise(($,W)=>{U(this,_Z,$,"f"),U(this,wZ,W,"f")}),"f"),z(this,YZ,"f").catch(()=>{}),z(this,zZ,"f").catch(()=>{}),U(this,EX,X,"f"),U(this,KZ,Z?.logger??console,"f")}get response(){return z(this,bZ,"f")}get request_id(){return z(this,vZ,"f")}async withResponse(){U(this,JX,!0,"f");let X=await z(this,YZ,"f");if(!X)throw Error("Could not resolve a `Response` object");return{data:this,response:X,request_id:X.headers.get("request-id")}}static fromReadableStream(X){let Z=new VZ(null);return Z._run(()=>Z._fromReadableStream(X)),Z}static createMessage(X,Z,$,{logger:W}={}){let Y=new VZ(Z,{logger:W});for(let J of Z.messages)Y._addMessageParam(J);return U(Y,EX,{...Z,stream:!0},"f"),Y._run(()=>Y._createMessage(X,{...Z,stream:!0},{...$,headers:{...$?.headers,"X-Stainless-Helper-Method":"stream"}})),Y}_run(X){X().then(()=>{this._emitFinal(),this._emit("end")},z(this,q0,"f"))}_addMessageParam(X){this.messages.push(X)}_addMessage(X,Z=!0){if(this.receivedMessages.push(X),Z)this._emit("message",X)}async _createMessage(X,Z,$){let W=$?.signal,Y;if(W){if(W.aborted)this.controller.abort();Y=this.controller.abort.bind(this.controller),W.addEventListener("abort",Y)}try{z(this,g,"m",C0).call(this);let{response:J,data:Q}=await X.create({...Z,stream:!0},{...$,signal:this.controller.signal}).withResponse();this._connected(J);for await(let w of Q)z(this,g,"m",O0).call(this,w);if(Q.controller.signal?.aborted)throw new D;z(this,g,"m",E0).call(this)}finally{if(W&&Y)W.removeEventListener("abort",Y)}}_connected(X){if(this.ended)return;U(this,bZ,X,"f"),U(this,vZ,X?.headers.get("request-id"),"f"),z(this,yZ,"f").call(this,X),this._emit("connect")}get ended(){return z(this,QZ,"f")}get errored(){return z(this,hZ,"f")}get aborted(){return z(this,gZ,"f")}abort(){this.controller.abort()}on(X,Z){return(z(this,l,"f")[X]||(z(this,l,"f")[X]=[])).push({listener:Z}),this}off(X,Z){let $=z(this,l,"f")[X];if(!$)return this;let W=$.findIndex((Y)=>Y.listener===Z);if(W>=0)$.splice(W,1);return this}once(X,Z){return(z(this,l,"f")[X]||(z(this,l,"f")[X]=[])).push({listener:Z,once:!0}),this}emitted(X){return new Promise((Z,$)=>{if(U(this,JX,!0,"f"),X!=="error")this.once("error",$);this.once(X,Z)})}async done(){U(this,JX,!0,"f"),await z(this,zZ,"f")}get currentMessage(){return z(this,t,"f")}async finalMessage(){return await this.done(),z(this,g,"m",U0).call(this)}async finalText(){return await this.done(),z(this,g,"m",U1).call(this)}_emit(X,...Z){if(z(this,QZ,"f"))return;if(X==="end")U(this,QZ,!0,"f"),z(this,_Z,"f").call(this);let $=z(this,l,"f")[X];if($)z(this,l,"f")[X]=$.filter((W)=>!W.once),$.forEach(({listener:W})=>W(...Z));if(X==="abort"){let W=Z[0];if(!z(this,JX,"f")&&!$?.length)Promise.reject(W);z(this,JZ,"f").call(this,W),z(this,wZ,"f").call(this,W),this._emit("end");return}if(X==="error"){let W=Z[0];if(!z(this,JX,"f")&&!$?.length)Promise.reject(W);z(this,JZ,"f").call(this,W),z(this,wZ,"f").call(this,W),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",z(this,g,"m",U0).call(this))}async _fromReadableStream(X,Z){let $=Z?.signal,W;if($){if($.aborted)this.controller.abort();W=this.controller.abort.bind(this.controller),$.addEventListener("abort",W)}try{z(this,g,"m",C0).call(this),this._connected(null);let Y=R.fromReadableStream(X,this.controller);for await(let J of Y)z(this,g,"m",O0).call(this,J);if(Y.controller.signal?.aborted)throw new D;z(this,g,"m",E0).call(this)}finally{if($&&W)$.removeEventListener("abort",W)}}[(t=new WeakMap,EX=new WeakMap,YZ=new WeakMap,yZ=new WeakMap,JZ=new WeakMap,zZ=new WeakMap,_Z=new WeakMap,wZ=new WeakMap,l=new WeakMap,QZ=new WeakMap,hZ=new WeakMap,gZ=new WeakMap,JX=new WeakMap,bZ=new WeakMap,vZ=new WeakMap,KZ=new WeakMap,q0=new WeakMap,g=new WeakSet,U0=function(){if(this.receivedMessages.length===0)throw new C("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},U1=function(){if(this.receivedMessages.length===0)throw new C("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter(($)=>$.type==="text").map(($)=>$.text);if(Z.length===0)throw new C("stream ended without producing a content block with type=text");return Z.join(" ")},C0=function(){if(this.ended)return;U(this,t,void 0,"f")},O0=function(Z){if(this.ended)return;let $=z(this,g,"m",q1).call(this,Z);switch(this._emit("streamEvent",Z,$),Z.type){case"content_block_delta":{let W=$.content.at(-1);switch(Z.delta.type){case"text_delta":{if(W.type==="text")this._emit("text",Z.delta.text,W.text||"");break}case"citations_delta":{if(W.type==="text")this._emit("citation",Z.delta.citation,W.citations??[]);break}case"input_json_delta":{if(O1(W)&&W.input)this._emit("inputJson",Z.delta.partial_json,W.input);break}case"thinking_delta":{if(W.type==="thinking")this._emit("thinking",Z.delta.thinking,W.thinking);break}case"signature_delta":{if(W.type==="thinking")this._emit("signature",W.signature);break}default:E1(Z.delta)}break}case"message_stop":{this._addMessageParam($),this._addMessage(G0($,z(this,EX,"f"),{logger:z(this,KZ,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",$.content.at(-1));break}case"message_start":{U(this,t,$,"f");break}case"content_block_start":case"message_delta":break}},E0=function(){if(this.ended)throw new C("stream has ended, this shouldn't happen");let Z=z(this,t,"f");if(!Z)throw new C("request ended without sending any chunks");return U(this,t,void 0,"f"),G0(Z,z(this,EX,"f"),{logger:z(this,KZ,"f")})},q1=function(Z){let $=z(this,t,"f");if(Z.type==="message_start"){if($)throw new C(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!$)throw new C(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return $;case"message_delta":if($.stop_reason=Z.delta.stop_reason,$.stop_sequence=Z.delta.stop_sequence,$.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)$.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)$.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)$.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)$.usage.server_tool_use=Z.usage.server_tool_use;return $;case"content_block_start":return $.content.push({...Z.content_block}),$;case"content_block_delta":{let W=$.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(W?.type==="text")$.content[Z.index]={...W,text:(W.text||"")+Z.delta.text};break}case"citations_delta":{if(W?.type==="text")$.content[Z.index]={...W,citations:[...W.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(W&&O1(W)){let Y=W[C1]||"";Y+=Z.delta.partial_json;let J={...W};if(Object.defineProperty(J,C1,{value:Y,enumerable:!1,writable:!0}),Y)J.input=BZ(Y);$.content[Z.index]=J}break}case"thinking_delta":{if(W?.type==="thinking")$.content[Z.index]={...W,thinking:W.thinking+Z.delta.thinking};break}case"signature_delta":{if(W?.type==="thinking")$.content[Z.index]={...W,signature:Z.delta.signature};break}default:E1(Z.delta)}return $}case"content_block_stop":return $}},Symbol.asyncIterator)](){let X=[],Z=[],$=!1;return this.on("streamEvent",(W)=>{let Y=Z.shift();if(Y)Y.resolve(W);else X.push(W)}),this.on("end",()=>{$=!0;for(let W of Z)W.resolve(void 0);Z.length=0}),this.on("abort",(W)=>{$=!0;for(let Y of Z)Y.reject(W);Z.length=0}),this.on("error",(W)=>{$=!0;for(let Y of Z)Y.reject(W);Z.length=0}),{next:async()=>{if(!X.length){if($)return{value:void 0,done:!0};return new Promise((Y,J)=>Z.push({resolve:Y,reject:J})).then((Y)=>Y?{value:Y,done:!1}:{value:void 0,done:!0})}return{value:X.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new R(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function E1(X){}class GZ extends x{create(X,Z){return this._client.post("/v1/messages/batches",{body:X,...Z})}retrieve(X,Z){return this._client.get(N`/v1/messages/batches/${X}`,Z)}list(X={},Z){return this._client.getAPIList("/v1/messages/batches",b,{query:X,...Z})}delete(X,Z){return this._client.delete(N`/v1/messages/batches/${X}`,Z)}cancel(X,Z){return this._client.post(N`/v1/messages/batches/${X}/cancel`,Z)}async results(X,Z){let $=await this.retrieve(X);if(!$.results_url)throw new C(`No batch \`results_url\`; Has it finished processing? ${$.processing_status} - ${$.id}`);return this._client.get($.results_url,{...Z,headers:V([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((W,Y)=>UX.fromResponse(Y.response,Y.controller))}}class zX extends x{constructor(){super(...arguments);this.batches=new GZ(this._client)}create(X,Z){if(X.model in M1)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${M1[X.model]}
|
|
34
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(k2.includes(X.model)&&X.thinking&&X.thinking.type==="enabled")console.warn(`Using Claude with ${X.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 $=this._client._options.timeout;if(!X.stream&&$==null){let Y=SZ[X.model]??void 0;$=this._client.calculateNonstreamingTimeout(X.max_tokens,Y)}let W=jZ(X.tools,X.messages);return this._client.post("/v1/messages",{body:X,timeout:$??600000,...Z,headers:V([W,Z?.headers]),stream:X.stream??!1})}parse(X,Z){return this.create(X,Z).then(($)=>N0($,X,{logger:this._client.logger??console}))}stream(X,Z){return VZ.createMessage(this,X,Z,{logger:this._client.logger??console})}countTokens(X,Z){return this._client.post("/v1/messages/count_tokens",{body:X,...Z})}}var M1={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026"},k2=["claude-mythos-preview","claude-opus-4-6"];zX.Batches=GZ;class MX extends x{retrieve(X,Z={},$){let{betas:W}=Z??{};return this._client.get(N`/v1/models/${X}`,{...$,headers:V([{...W?.toString()!=null?{"anthropic-beta":W?.toString()}:void 0},$?.headers])})}list(X={},Z){let{betas:$,...W}=X??{};return this._client.getAPIList("/v1/models",b,{query:W,...Z,headers:V([{...$?.toString()!=null?{"anthropic-beta":$?.toString()}:void 0},Z?.headers])})}}var NZ=(X)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[X]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(X)?.trim()||void 0;return};var M0,x0,cZ,x1,H1="\\n\\nHuman:",F1="\\n\\nAssistant:";class L{constructor({baseURL:X=NZ("ANTHROPIC_BASE_URL"),apiKey:Z=NZ("ANTHROPIC_API_KEY")??null,authToken:$=NZ("ANTHROPIC_AUTH_TOKEN")??null,...W}={}){M0.add(this),cZ.set(this,void 0);let Y={apiKey:Z,authToken:$,...W,baseURL:X||"https://api.anthropic.com"};if(!Y.dangerouslyAllowBrowser&&h0())throw new C(`It looks like you're running in a browser-like environment.
|
|
35
|
+
|
|
36
|
+
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
37
|
+
If you understand the risks and have appropriate mitigations in place,
|
|
38
|
+
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
39
|
+
|
|
40
|
+
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
41
|
+
`);this.baseURL=Y.baseURL,this.timeout=Y.timeout??x0.DEFAULT_TIMEOUT,this.logger=Y.logger??console;let J="warn";this.logLevel=J,this.logLevel=oZ(Y.logLevel,"ClientOptions.logLevel",this)??oZ(NZ("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=Y.fetchOptions,this.maxRetries=Y.maxRetries??2,this.fetch=Y.fetch??b0(),U(this,cZ,c0,"f"),this._options=Y,this.apiKey=typeof Z==="string"?Z:null,this.authToken=$}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){if(X.get("x-api-key")||X.get("authorization"))return;if(this.apiKey&&X.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&X.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders(X){return V([await this.apiKeyAuth(X),await this.bearerAuth(X)])}async apiKeyAuth(X){if(this.apiKey==null)return;return V([{"X-Api-Key":this.apiKey}])}async bearerAuth(X){if(this.authToken==null)return;return V([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(X){return d0(X)}getUserAgent(){return`${this.constructor.name}/JS ${i}`}defaultIdempotencyKey(){return`stainless-node-retry-${pZ()}`}makeStatusError(X,Z,$,W){return A.generate(X,Z,$,W)}buildURL(X,Z,$){let W=!z(this,M0,"m",x1).call(this)&&$||this.baseURL,Y=P0(X)?new URL(X):new URL(W+(W.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),J=this.defaultQuery(),Q=Object.fromEntries(Y.searchParams);if(!nZ(J)||!nZ(Q))Z={...Q,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))Y.search=this.stringifyQuery(Z);return Y.toString()}_calculateNonstreamingTimeout(X){if(3600*X/128000>600)throw new C("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 600000}async prepareOptions(X){}async prepareRequest(X,{url:Z,options:$}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,$){return this.request(Promise.resolve($).then((W)=>{return{method:X,path:Z,...W}}))}request(X,Z=null){return new e(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,$){let W=await X,Y=W.maxRetries??this.maxRetries;if(Z==null)Z=Y;await this.prepareOptions(W);let{req:J,url:Q,timeout:w}=await this.buildRequest(W,{retryCount:Y-Z});await this.prepareRequest(J,{url:Q,options:W});let G="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),M=$===void 0?"":`, retryOf: ${$}`,O=Date.now();if(S(this).debug(`[${G}] sending request`,m({retryOfRequestLogID:$,method:W.method,url:Q,options:W,headers:J.headers})),W.signal?.aborted)throw new D;let E=new AbortController,K=await this.fetchWithTimeout(Q,J,w,E).catch(xX),q=Date.now();if(K instanceof globalThis.Error){let y=`retrying, ${Z} attempts remaining`;if(W.signal?.aborted)throw new D;let _=d(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return S(this).info(`[${G}] connection ${_?"timed out":"failed"} - ${y}`),S(this).debug(`[${G}] connection ${_?"timed out":"failed"} (${y})`,m({retryOfRequestLogID:$,url:Q,durationMs:q-O,message:K.message})),this.retryRequest(W,Z,$??G);if(S(this).info(`[${G}] connection ${_?"timed out":"failed"} - error; no more retries left`),S(this).debug(`[${G}] connection ${_?"timed out":"failed"} (error; no more retries left)`,m({retryOfRequestLogID:$,url:Q,durationMs:q-O,message:K.message})),_)throw new HX;throw new s({cause:K})}let H=[...K.headers.entries()].filter(([y])=>y==="request-id").map(([y,_])=>", "+y+": "+JSON.stringify(_)).join(""),B=`[${G}${M}${H}] ${J.method} ${Q} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${q-O}ms`;if(!K.ok){let y=await this.shouldRetry(K);if(Z&&y){let UZ=`retrying, ${Z} attempts remaining`;return await v0(K.body),S(this).info(`${B} - ${UZ}`),S(this).debug(`[${G}] response error (${UZ})`,m({retryOfRequestLogID:$,url:K.url,status:K.status,headers:K.headers,durationMs:q-O})),this.retryRequest(W,Z,$??G,K.headers)}let _=y?"error; no more retries left":"error; not retryable";S(this).info(`${B} - ${_}`);let B0=await K.text().catch((UZ)=>xX(UZ).message),D0=CZ(B0),T0=D0?void 0:B0;throw S(this).debug(`[${G}] response error (${_})`,m({retryOfRequestLogID:$,url:K.url,status:K.status,headers:K.headers,message:T0,durationMs:Date.now()-O})),this.makeStatusError(K.status,D0,T0,K.headers)}return S(this).info(B),S(this).debug(`[${G}] response start`,m({retryOfRequestLogID:$,url:K.url,status:K.status,headers:K.headers,durationMs:q-O})),{response:K,options:W,controller:E,requestLogID:G,retryOfRequestLogID:$,startTime:O}}getAPIList(X,Z,$){return this.requestAPIList(Z,$&&"then"in $?$.then((W)=>({method:"get",path:X,...W})):{method:"get",path:X,...$})}requestAPIList(X,Z){let $=this.makeRequest(Z,null,void 0);return new FZ(this,$,X)}async fetchWithTimeout(X,Z,$,W){let{signal:Y,method:J,...Q}=Z||{},w=this._makeAbort(W);if(Y)Y.addEventListener("abort",w,{once:!0});let G=setTimeout(w,$),M=globalThis.ReadableStream&&Q.body instanceof globalThis.ReadableStream||typeof Q.body==="object"&&Q.body!==null&&Symbol.asyncIterator in Q.body,O={signal:W.signal,...M?{duplex:"half"}:{},method:"GET",...Q};if(J)O.method=J.toUpperCase();try{return await this.fetch.call(void 0,X,O)}finally{clearTimeout(G)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,$,W){let Y,J=W?.get("retry-after-ms");if(J){let w=parseFloat(J);if(!Number.isNaN(w))Y=w}let Q=W?.get("retry-after");if(Q&&!Y){let w=parseFloat(Q);if(!Number.isNaN(w))Y=w*1000;else Y=Date.parse(Q)-Date.now()}if(Y===void 0){let w=X.maxRetries??this.maxRetries;Y=this.calculateDefaultRetryTimeoutMillis(Z,w)}return await R0(Y),this.makeRequest(X,Z-1,$)}calculateDefaultRetryTimeoutMillis(X,Z){let Y=Z-X,J=Math.min(0.5*Math.pow(2,Y),8),Q=1-Math.random()*0.25;return J*Q*1000}calculateNonstreamingTimeout(X,Z){if(3600000*X/128000>600000||Z!=null&&X>Z)throw new C("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 600000}async buildRequest(X,{retryCount:Z=0}={}){let $={...X},{method:W,path:Y,query:J,defaultBaseURL:Q}=$,w=this.buildURL(Y,J,Q);if("timeout"in $)I0("timeout",$.timeout);$.timeout=$.timeout??this.timeout;let{bodyHeaders:G,body:M}=this.buildBody({options:$}),O=await this.buildHeaders({options:X,method:W,bodyHeaders:G,retryCount:Z});return{req:{method:W,headers:O,...$.signal&&{signal:$.signal},...globalThis.ReadableStream&&M instanceof globalThis.ReadableStream&&{duplex:"half"},...M&&{body:M},...this.fetchOptions??{},...$.fetchOptions??{}},url:w,timeout:$.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:$,retryCount:W}){let Y={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();Y[this.idempotencyHeader]=X.idempotencyKey}let J=V([Y,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(W),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...g0(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(X),this._options.defaultHeaders,$,X.headers]);return this.validateHeaders(J),J.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let $=V([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&$.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:OZ(X)};else if(typeof X==="object"&&$.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return z(this,cZ,"f").call(this,{body:X,headers:$})}}x0=L,cZ=new WeakMap,M0=new WeakSet,x1=function(){return this.baseURL!=="https://api.anthropic.com"};L.Anthropic=x0;L.HUMAN_PROMPT=H1;L.AI_PROMPT=F1;L.DEFAULT_TIMEOUT=600000;L.AnthropicError=C;L.APIError=A;L.APIConnectionError=s;L.APIConnectionTimeoutError=HX;L.APIUserAbortError=D;L.NotFoundError=jX;L.ConflictError=SX;L.RateLimitError=DX;L.BadRequestError=FX;L.AuthenticationError=LX;L.InternalServerError=TX;L.PermissionDeniedError=AX;L.UnprocessableEntityError=BX;L.toFile=LZ;class v extends L{constructor(){super(...arguments);this.completions=new OX(this),this.messages=new zX(this),this.models=new MX(this),this.beta=new T(this)}}v.Completions=OX;v.Messages=zX;v.Models=MX;v.Beta=T;function h1(X,Z){if(X)return X;if(B1("PI_CACHE_RETENTION",Z)==="long")return"long";return"short"}function _2(X,Z,$){let W=h1(Z,$);if(W==="none")return{retention:W};let Y=W==="long"&&uZ(X).supportsLongCacheRetention?"1h":void 0;return{retention:W,cacheControl:{type:"ephemeral",...Y&&{ttl:Y}}}}var h2="2.1.75",g2=["Read","Write","Edit","Bash","Grep","Glob","AskUserQuestion","EnterPlanMode","ExitPlanMode","KillShell","NotebookEdit","Skill","Task","TaskOutput","TodoWrite","WebFetch","WebSearch"],b2=new Map(g2.map((X)=>[X.toLowerCase(),X])),mZ=(X)=>b2.get(X.toLowerCase())??X,v2=(X,Z)=>{if(Z&&Z.length>0){let $=X.toLowerCase(),W=Z.find((Y)=>Y.name.toLowerCase()===$);if(W)return W.name}return X};function c2(X){if(!X.some((Y)=>Y.type==="image"))return c(X.map((Y)=>Y.text).join(`
|
|
42
|
+
`));let $=X.map((Y)=>{if(Y.type==="text")return{type:"text",text:c(Y.text)};return{type:"image",source:{type:"base64",media_type:Y.mimeType,data:Y.data}}});if(!$.some((Y)=>Y.type==="text"))$.unshift({type:"text",text:"(see attached image)"});return $}var d2="fine-grained-tool-streaming-2025-05-14",m2="interleaved-thinking-2025-05-14";function uZ(X){return{supportsEagerToolInputStreaming:X.compat?.supportsEagerToolInputStreaming??!0,supportsLongCacheRetention:X.compat?.supportsLongCacheRetention??!0,sendSessionAffinityHeaders:X.compat?.sendSessionAffinityHeaders??!1,supportsCacheControlOnTools:X.compat?.supportsCacheControlOnTools??!0,supportsTemperature:X.compat?.supportsTemperature??!0,allowEmptySignature:X.compat?.allowEmptySignature??!1,supportsStrictTools:X.compat?.supportsStrictTools??!1,supportsToolReferences:X.compat?.supportsToolReferences??u2(X)}}function u2(X){if(X.provider!=="anthropic"||X.id.includes("haiku"))return!1;let Z=X.id.match(/^claude-(?:opus|sonnet|fable)-(\d+)(?:-(\d+))?(?:-|$)/);if(!Z)return!1;let $=Number(Z[1]),W=Z[2]&&Z[2].length<8?Number(Z[2]):0;return $>4||$===4&&W>=5}function H0(...X){let Z={};for(let $ of X)if($)Object.assign(Z,$);return Z}function F0(X,Z){if(!X)return!1;let $=Z.toLowerCase();for(let[W,Y]of Object.entries(X))if(W.toLowerCase()===$&&Y!==null&&Y.trim().length>0)return!0;return!1}function g1(X,Z,$){if(Z)return;if(F0($,"authorization")||F0($,"x-api-key")||F0($,"cf-aig-authorization"))return;throw Error(`No API key for provider: ${X}`)}var p2=new Set(["message_start","message_delta","message_stop","content_block_start","content_block_delta","content_block_stop"]);function b1(X){if(!X.event&&X.data.length===0)return null;let Z={event:X.event,data:X.data.join(`
|
|
43
|
+
`),raw:[...X.raw]};return X.event=null,X.data=[],X.raw=[],Z}function L0(X,Z){if(X==="")return b1(Z);if(Z.raw.push(X),X.startsWith(":"))return null;let $=X.indexOf(":"),W=$===-1?X:X.slice(0,$),Y=$===-1?"":X.slice($+1);if(Y.startsWith(" "))Y=Y.slice(1);if(W==="event")Z.event=Y;else if(W==="data")Z.data.push(Y);return null}function l2(X){let Z=X.indexOf("\r"),$=X.indexOf(`
|
|
44
|
+
`);if(Z===-1)return $;if($===-1)return Z;return Math.min(Z,$)}function dZ(X){let Z=l2(X);if(Z===-1)return null;let $=Z+1;if(X[Z]==="\r"&&X[$]===`
|
|
45
|
+
`)$+=1;return{line:X.slice(0,Z),rest:X.slice($)}}async function*i2(X,Z){let $=X.getReader(),W=new TextDecoder,Y={event:null,data:[],raw:[]},J="";try{while(!0){if(Z?.aborted)throw Error("Request was aborted");let{value:G,done:M}=await $.read();if(M)break;J+=W.decode(G,{stream:!0});let O=dZ(J);while(O){J=O.rest;let E=L0(O.line,Y);if(E)yield E;O=dZ(J)}}J+=W.decode();let Q=dZ(J);while(Q){J=Q.rest;let G=L0(Q.line,Y);if(G)yield G;Q=dZ(J)}if(J.length>0){let G=L0(J,Y);if(G)yield G}let w=b1(Y);if(w)yield w}finally{$.releaseLock()}}async function*n2(X,Z){if(!X.body)throw Error("Attempted to iterate over an Anthropic response with no body");let $=!1,W=!1;for await(let Y of i2(X.body,Z)){if(Y.event==="error")throw Error(Y.data);if(!p2.has(Y.event??""))continue;try{let J=j1(Y.data);if(J.type==="message_start")$=!0;else if(J.type==="message_stop")W=!0;yield J}catch(J){let Q=J instanceof Error?J.message:String(J);throw Error(`Could not parse Anthropic SSE event ${Y.event}: ${Q}; data=${Y.data}; raw=${Y.raw.join("\\n")}`)}}if($&&!W)throw Error("Anthropic stream ended before message_stop")}var A0=(X,Z,$)=>{let W=new A1;return(async()=>{let Y={role:"assistant",content:[],api:X.api,provider:X.provider,model:X.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let J,Q;if($?.client)J=$.client,Q=!1;else{let K=$?.apiKey;g1(X.provider,K,$?.headers);let q;if(X.provider==="github-copilot"){let _=P1(Z.messages);q=f1({messages:Z.messages,hasImages:_})}let B=h1($?.cacheRetention,$?.env)==="none"?void 0:$?.sessionId,y=o2(X,K,$?.interleavedThinking??!0,Z4(X,Z),$?.headers,q,B);J=y.client,Q=y.isOAuthToken}let w=t2(X,Z,Q,$),G=await $?.onPayload?.(w,X);if(G!==void 0)w=G;let M={...$?.signal?{signal:$.signal}:{},...$?.timeoutMs!==void 0?{timeout:$.timeoutMs}:{},maxRetries:0},O=await D1(()=>J.messages.create({...w,stream:!0},M).asResponse(),{maxRetries:$?.maxRetries,maxRetryDelayMs:$?.maxRetryDelayMs,signal:$?.signal});await $?.onResponse?.({status:O.status,headers:S1(O.headers)},X),W.push({type:"start",partial:Y});let E=Y.content;for await(let K of n2(O,$?.signal))if(K.type==="message_start")Y.responseId=K.message.id,Y.usage.input=K.message.usage.input_tokens||0,Y.usage.output=K.message.usage.output_tokens||0,Y.usage.cacheRead=K.message.usage.cache_read_input_tokens||0,Y.usage.cacheWrite=K.message.usage.cache_creation_input_tokens||0,Y.usage.cacheWrite1h=K.message.usage.cache_creation?.ephemeral_1h_input_tokens||0,Y.usage.totalTokens=Y.usage.input+Y.usage.output+Y.usage.cacheRead+Y.usage.cacheWrite,j0(X,Y.usage);else if(K.type==="content_block_start"){if(K.content_block.type==="text"){let q={type:"text",text:"",index:K.index};Y.content.push(q),W.push({type:"text_start",contentIndex:Y.content.length-1,partial:Y})}else if(K.content_block.type==="thinking"){let q={type:"thinking",thinking:"",thinkingSignature:"",index:K.index};Y.content.push(q),W.push({type:"thinking_start",contentIndex:Y.content.length-1,partial:Y})}else if(K.content_block.type==="redacted_thinking"){let q={type:"thinking",thinking:"[Reasoning redacted]",thinkingSignature:K.content_block.data,redacted:!0,index:K.index};Y.content.push(q),W.push({type:"thinking_start",contentIndex:Y.content.length-1,partial:Y})}else if(K.content_block.type==="tool_use"){let q={type:"toolCall",id:K.content_block.id,name:Q?v2(K.content_block.name,Z.tools):K.content_block.name,arguments:K.content_block.input??{},partialJson:"",index:K.index};Y.content.push(q),W.push({type:"toolcall_start",contentIndex:Y.content.length-1,partial:Y})}}else if(K.type==="content_block_delta"){if(K.delta.type==="text_delta"){let q=E.findIndex((B)=>B.index===K.index),H=E[q];if(H&&H.type==="text")H.text+=K.delta.text,W.push({type:"text_delta",contentIndex:q,delta:K.delta.text,partial:Y})}else if(K.delta.type==="thinking_delta"){let q=E.findIndex((B)=>B.index===K.index),H=E[q];if(H&&H.type==="thinking")H.thinking+=K.delta.thinking,W.push({type:"thinking_delta",contentIndex:q,delta:K.delta.thinking,partial:Y})}else if(K.delta.type==="input_json_delta"){let q=E.findIndex((B)=>B.index===K.index),H=E[q];if(H&&H.type==="toolCall")H.partialJson+=K.delta.partial_json,H.arguments=S0(H.partialJson),W.push({type:"toolcall_delta",contentIndex:q,delta:K.delta.partial_json,partial:Y})}else if(K.delta.type==="signature_delta"){let q=E.findIndex((B)=>B.index===K.index),H=E[q];if(H&&H.type==="thinking")H.thinkingSignature=H.thinkingSignature||"",H.thinkingSignature+=K.delta.signature}}else if(K.type==="content_block_stop"){let q=E.findIndex((B)=>B.index===K.index),H=E[q];if(H){if(delete H.index,H.type==="text")W.push({type:"text_end",contentIndex:q,content:H.text,partial:Y});else if(H.type==="thinking")W.push({type:"thinking_end",contentIndex:q,content:H.thinking,partial:Y});else if(H.type==="toolCall")H.arguments=S0(H.partialJson),delete H.partialJson,W.push({type:"toolcall_end",contentIndex:q,toolCall:H,partial:Y})}}else if(K.type==="message_delta"){if(K.delta.stop_reason){let q=$4(K.delta.stop_reason,K.delta.stop_details);if(Y.stopReason=q.stopReason,q.errorMessage)Y.errorMessage=q.errorMessage}if(K.usage){if(K.usage.input_tokens!=null)Y.usage.input=K.usage.input_tokens;if(K.usage.output_tokens!=null)Y.usage.output=K.usage.output_tokens;if(K.usage.cache_read_input_tokens!=null)Y.usage.cacheRead=K.usage.cache_read_input_tokens;if(K.usage.cache_creation_input_tokens!=null)Y.usage.cacheWrite=K.usage.cache_creation_input_tokens;let q=K.usage.output_tokens_details?.thinking_tokens;if(q!=null)Y.usage.reasoning=q}Y.usage.totalTokens=Y.usage.input+Y.usage.output+Y.usage.cacheRead+Y.usage.cacheWrite,j0(X,Y.usage)}if($?.signal?.aborted)throw Error("Request was aborted");if(Y.stopReason==="aborted"||Y.stopReason==="error")throw Error(Y.errorMessage||"An unknown error occurred");W.push({type:"done",reason:Y.stopReason,message:Y}),W.end()}catch(J){for(let Q of Y.content)delete Q.index,delete Q.partialJson;Y.stopReason=$?.signal?.aborted?"aborted":"error",Y.errorMessage=J instanceof Error?J.message:JSON.stringify(J),W.push({type:"error",reason:Y.stopReason,error:Y}),W.end()}})(),W};function r2(X,Z){let $=Z?X.thinkingLevelMap?.[Z]:void 0;if(typeof $==="string")return $;switch(Z){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}var a6=(X,Z,$)=>{g1(X.provider,$?.apiKey,$?.headers);let W=R1(X,Z,$,$?.apiKey);if(!$?.reasoning)return A0(X,Z,{...W,thinkingEnabled:!1});if(X.compat?.forceAdaptiveThinking===!0){let Q=r2(X,$.reasoning);return A0(X,Z,{...W,thinkingEnabled:!0,effort:Q})}let Y=k1(W.maxTokens,X.maxTokens,$.reasoning,$.thinkingBudgets),J=I1(X,Z,Y.maxTokens);return A0(X,Z,{...W,maxTokens:J,thinkingEnabled:!0,thinkingBudgetTokens:Math.min(Y.thinkingBudget,Math.max(0,J-1024))})};function a2(X){return X.includes("sk-ant-oat")}function o2(X,Z,$,W,Y,J,Q){let w=$&&X.compat?.forceAdaptiveThinking!==!0,G=[];if(W)G.push(d2);if(w)G.push(m2);if(X.provider==="github-copilot")return{client:new v({apiKey:null,authToken:Z??null,baseURL:X.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:H0({accept:"application/json","anthropic-dangerous-direct-browser-access":"true",...G.length>0?{"anthropic-beta":G.join(",")}:{}},X.headers,J,Y)}),isOAuthToken:!1};if(Z&&a2(Z))return{client:new v({apiKey:null,authToken:Z,baseURL:X.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:H0({accept:"application/json","anthropic-dangerous-direct-browser-access":"true","anthropic-beta":["claude-code-20250219","oauth-2025-04-20",...G].join(","),"user-agent":`claude-cli/${h2}`,"x-app":"cli"},X.headers,Y)}),isOAuthToken:!0};let M=Q&&uZ(X).sendSessionAffinityHeaders?{"x-session-affinity":Q}:{},O=H0({accept:"application/json","anthropic-dangerous-direct-browser-access":"true",...G.length>0?{"anthropic-beta":G.join(",")}:{}},M,X.headers,Y);return{client:new v({apiKey:Z??null,authToken:null,baseURL:X.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:O}),isOAuthToken:!1}}function t2(X,Z,$,W){let{cacheControl:Y}=_2(X,W?.cacheRetention,W?.env),J=uZ(X),Q=y1(Z.messages,X,s2),w=$?mZ:(q)=>q,G=_1({...Z,messages:Q},J.supportsToolReferences,w),M=G.immediate,O=[...G.deferred.values()];if(M.length===0&&O.length>0)M=O,O=[];let E=new Set(O.map((q)=>w(q.name))),K={model:X.id,messages:X4(Q,$,Y,J.allowEmptySignature,E,w),max_tokens:W?.maxTokens??X.maxTokens,stream:!0};if($){if(K.system=[{type:"text",text:"You are Claude Code, Anthropic's official CLI for Claude.",...Y?{cache_control:Y}:{}}],Z.systemPrompt)K.system.push({type:"text",text:c(Z.systemPrompt),...Y?{cache_control:Y}:{}})}else if(Z.systemPrompt)K.system=[{type:"text",text:c(Z.systemPrompt),...Y?{cache_control:Y}:{}}];if(W?.temperature!==void 0&&!W?.thinkingEnabled&&J.supportsTemperature)K.temperature=W.temperature;if(M.length>0||O.length>0)K.tools=[...L1(M,$,J.supportsEagerToolInputStreaming,J.supportsStrictTools,J.supportsCacheControlOnTools?Y:void 0),...L1(O,$,J.supportsEagerToolInputStreaming,J.supportsStrictTools,void 0,!0)];if(X.reasoning){if(W?.thinkingEnabled){let q=W.thinkingDisplay??"summarized";if(X.compat?.forceAdaptiveThinking===!0){if(K.thinking={type:"adaptive",display:q},W.effort)K.output_config=W.effort==="xhigh"?{effort:W.effort}:{effort:W.effort}}else K.thinking={type:"enabled",budget_tokens:W.thinkingBudgetTokens||1024,display:q}}else if(W?.thinkingEnabled===!1&&X.thinkingLevelMap?.off!==null)K.thinking={type:"disabled"}}if(W?.metadata){let q=W.metadata.user_id;if(typeof q==="string")K.metadata={user_id:q}}if(W?.toolChoice)if(typeof W.toolChoice==="string")K.tool_choice={type:W.toolChoice};else K.tool_choice=W.toolChoice;return K}function s2(X){return X.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64)}function e2(X,Z,$,W,Y){let J=[];for(let w of X.addedToolNames??[]){let G=Y(w);if(!$.has(G)||W.has(G))continue;W.add(G),J.push({type:"tool_reference",tool_name:Z?mZ(w):w})}let Q=c2(X.content);return{toolResult:{type:"tool_result",tool_use_id:X.toolCallId,content:J.length>0?J:Q,is_error:X.isError},siblingContent:J.length===0?[]:typeof Q==="string"?[{type:"text",text:Q}]:Q}}function X4(X,Z,$,W=!1,Y=new Set,J=(Q)=>Q){let Q=[],w=new Set;for(let G=0;G<X.length;G++){let M=X[G];if(M.role==="user")if(typeof M.content==="string"){if(M.content.trim().length>0)Q.push({role:"user",content:c(M.content)})}else{let E=M.content.map((K)=>{if(K.type==="text")return{type:"text",text:c(K.text)};else return{type:"image",source:{type:"base64",media_type:K.mimeType,data:K.data}}}).filter((K)=>{if(K.type==="text")return K.text.trim().length>0;return!0});if(E.length===0)continue;Q.push({role:"user",content:E})}else if(M.role==="assistant"){let O=[];for(let E of M.content)if(E.type==="text"){if(E.text.trim().length===0)continue;O.push({type:"text",text:c(E.text)})}else if(E.type==="thinking"){if(E.redacted){O.push({type:"redacted_thinking",data:E.thinkingSignature});continue}let K=E.thinkingSignature,q=!!K&&K.trim().length>0;if(E.thinking.trim().length===0&&!q)continue;if(!q)O.push(W?{type:"thinking",thinking:c(E.thinking),signature:""}:{type:"text",text:c(E.thinking)});else O.push({type:"thinking",thinking:c(E.thinking),signature:K})}else if(E.type==="toolCall")O.push({type:"tool_use",id:E.id,name:Z?mZ(E.name):E.name,input:E.arguments??{}});if(O.length===0)continue;Q.push({role:"assistant",content:O})}else if(M.role==="toolResult"){let O=[],E=[],K=G;while(K<X.length&&X[K].role==="toolResult"){let q=e2(X[K],Z,Y,w,J);O.push(q.toolResult),E.push(...q.siblingContent),K++}G=K-1,Q.push({role:"user",content:[...O,...E]})}}if($&&Q.length>0){let G=Q[Q.length-1];if(G.role==="user"){if(Array.isArray(G.content)){let M=G.content[G.content.length-1];if(M&&(M.type==="text"||M.type==="image"||M.type==="tool_result"))M.cache_control=$}else if(typeof G.content==="string")G.content=[{type:"text",text:G.content,cache_control:$}]}}return Q}function Z4(X,Z){return!!Z.tools?.length&&!uZ(X).supportsEagerToolInputStreaming}function L1(X,Z,$,W,Y,J=!1){if(!X)return[];return X.map((Q,w)=>{let G=T1(Q,W),M=Q.parameters,O={type:"object",properties:M.properties??{},required:M.required??[]},E=G===!0?{...Q.parameters,...O}:O;return{name:Z?mZ(Q.name):Q.name,description:Q.description,...$?{eager_input_streaming:!0}:{},...G===!0?{strict:!0}:{},input_schema:E,...J?{defer_loading:!0}:{},...Y&&w===X.length-1?{cache_control:Y}:{}}})}function $4(X,Z){switch(X){case"end_turn":return{stopReason:"stop"};case"max_tokens":return{stopReason:"length"};case"tool_use":return{stopReason:"toolUse"};case"refusal":return{stopReason:"error",errorMessage:Z?.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"};default:throw Error(`Unhandled stop reason: ${X}`)}}export{a6 as streamSimple,A0 as stream};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{l as
|
|
1
|
+
import{Bg as a,xj as o}from"./chunk-ersxsrz8.js";function l({className:t,...e}){return a("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a("table",{"data-slot":"table",className:o("w-full caption-bottom text-sm",t),...e})})}function n({className:t,...e}){return a("thead",{"data-slot":"table-header",className:o("[&_tr]:border-b",t),...e})}function c({className:t,...e}){return a("tbody",{"data-slot":"table-body",className:o("[&_tr:last-child]:border-0",t),...e})}function d({className:t,...e}){return a("tr",{"data-slot":"table-row",className:o("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",t),...e})}function s({className:t,...e}){return a("th",{"data-slot":"table-head",className:o("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function b({className:t,...e}){return a("td",{"data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}
|
|
2
|
+
export{l as Ka,n as La,c as Ma,d as Na,s as Oa,b as Pa};
|