sliccy 1.26.1 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node-server/index.js +60 -1
- package/dist/ui/assets/{___vite-browser-external_commonjs-proxy-7U87kfBv.js → ___vite-browser-external_commonjs-proxy-Cmb9zBUT.js} +1 -1
- package/dist/ui/assets/{anthropic-CfFsAbhs.js → anthropic-DuWlRZpT.js} +1 -1
- package/dist/ui/assets/{azure-openai-responses-DX9SzdYk.js → azure-openai-responses-Mf18OBAm.js} +1 -1
- package/dist/ui/assets/bsh-watchdog-Cy8-MCiI.js +4 -0
- package/dist/ui/assets/{google-Dgcj8p2Y.js → google-dnYjk8Fg.js} +1 -1
- package/dist/ui/assets/{google-gemini-cli-3EajcUec.js → google-gemini-cli-CW5TUXrG.js} +1 -1
- package/dist/ui/assets/{google-shared-D1yWx-8k.js → google-shared-52YT-STV.js} +1 -1
- package/dist/ui/assets/{google-vertex-CWmtNuIQ.js → google-vertex-Cvd06MOV.js} +1 -1
- package/dist/ui/assets/{index-DJPmZw4a.js → index-COxfqL_6.js} +59 -48
- package/dist/ui/assets/{index-DIookCYH.js → index-Cif-vpwj.js} +1 -1
- package/dist/ui/assets/{index-d-ZPN7pB.js → index-Cj5FGv1O.js} +1 -1
- package/dist/ui/assets/{index-CgFkFStV.js → index-D5qCAmuj.js} +1 -1
- package/dist/ui/assets/{index-nEt-VnbM.js → index-qZV7PBFf.js} +1 -1
- package/dist/ui/assets/{json-parse-CRcpIgF_.js → json-parse-DPL6t0PZ.js} +1 -1
- package/dist/ui/assets/{mistral-B5PVshqk.js → mistral-CqzEB3Wd.js} +1 -1
- package/dist/ui/assets/{offscreen-client-Dj7EBRST.js → offscreen-client-EF1SfFBJ.js} +1 -1
- package/dist/ui/assets/{openai-codex-responses-q2oyEW2I.js → openai-codex-responses-DjhHU788.js} +1 -1
- package/dist/ui/assets/{openai-completions-DwmKL5b1.js → openai-completions-DI3BzoVD.js} +1 -1
- package/dist/ui/assets/{openai-responses-I0hZgQNc.js → openai-responses-CDRmRVXg.js} +1 -1
- package/dist/ui/assets/{openai-responses-shared-DipKQ09W.js → openai-responses-shared-xnWIf7Sq.js} +1 -1
- package/dist/ui/assets/{pyodide-4ipJLcSu.js → pyodide-D7VX_btJ.js} +1 -1
- package/dist/ui/assets/{sql-wasm-xEgzZ1j4.js → sql-wasm-CFjKorYF.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/packages/webapp/index.html +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/bsh-watchdog-DthzjzbF.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/anthropic-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/anthropic-DuWlRZpT.js","assets/json-parse-DPL6t0PZ.js","assets/sanitize-unicode-cmozpu7l.js","assets/github-copilot-headers-CrHPofPv.js","assets/azure-openai-responses-Mf18OBAm.js","assets/client-DFw1b8C8.js","assets/openai-responses-shared-xnWIf7Sq.js","assets/hash-DMDecQcg.js","assets/google-dnYjk8Fg.js","assets/google-shared-52YT-STV.js","assets/google-gemini-cli-CW5TUXrG.js","assets/google-vertex-Cvd06MOV.js","assets/mistral-CqzEB3Wd.js","assets/openai-codex-responses-DjhHU788.js","assets/openai-completions-DI3BzoVD.js","assets/openai-responses-CDRmRVXg.js","assets/sql-wasm-CFjKorYF.js","assets/___vite-browser-external_commonjs-proxy-Cmb9zBUT.js","assets/__vite-browser-external-D7Ct-6yo.js","assets/index-qZV7PBFf.js","assets/xterm-DOrYoP_4.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();const UM="modulepreload",WM=function(t){return"/"+t},Db={},Vt=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let s=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=o?.nonce||o?.getAttribute("nonce");i=s(n.map(c=>{if(c=WM(c),c in Db)return;Db[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":UM,u||(p.as="script"),p.crossOrigin="",p.href=c,l&&p.setAttribute("nonce",l),document.head.appendChild(p),u)return new Promise((f,h)=>{p.addEventListener("load",f),p.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(s){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s}return i.then(s=>{for(const o of s||[])o.status==="rejected"&&a(o.reason);return e().catch(a)})};function Fv(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var $o=Fv();function sE(t){$o=t}var fo={exec:()=>null};function sn(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(i,a)=>{let s=typeof a=="string"?a:a.source;return s=s.replace(Yr.caret,"$1"),n=n.replace(i,s),r},getRegex:()=>new RegExp(n,e)};return r}var BM=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Yr={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},zM=/^(?:[ \t]*(?:\n|$))+/,qM=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,jM=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Yc=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,GM=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Uv=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,oE=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lE=sn(oE).replace(/bull/g,Uv).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),HM=sn(oE).replace(/bull/g,Uv).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Wv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,VM=/^[^\n]+/,Bv=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ZM=sn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Bv).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),KM=sn(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Uv).getRegex(),rf="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",zv=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,JM=sn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",zv).replace("tag",rf).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),cE=sn(Wv).replace("hr",Yc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rf).getRegex(),QM=sn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",cE).getRegex(),qv={blockquote:QM,code:qM,def:ZM,fences:jM,heading:GM,hr:Yc,html:JM,lheading:lE,list:KM,newline:zM,paragraph:cE,table:fo,text:VM},Fb=sn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Yc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rf).getRegex(),YM={...qv,lheading:HM,table:Fb,paragraph:sn(Wv).replace("hr",Yc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Fb).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",rf).getRegex()},XM={...qv,html:sn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",zv).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:fo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:sn(Wv).replace("hr",Yc).replace("heading",` *#{1,6} *[^
|
|
3
3
|
]`).replace("lheading",lE).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},eL=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,tL=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,uE=/^( {2,}|\\)\n(?!\s*$)/,nL=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_l=/[\p{P}\p{S}]/u,af=/[\s\p{P}\p{S}]/u,jv=/[^\s\p{P}\p{S}]/u,rL=sn(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,af).getRegex(),dE=/(?!~)[\p{P}\p{S}]/u,iL=/(?!~)[\s\p{P}\p{S}]/u,aL=/(?:[^\s\p{P}\p{S}]|~)/u,sL=sn(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",BM?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),pE=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,oL=sn(pE,"u").replace(/punct/g,_l).getRegex(),lL=sn(pE,"u").replace(/punct/g,dE).getRegex(),fE="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",cL=sn(fE,"gu").replace(/notPunctSpace/g,jv).replace(/punctSpace/g,af).replace(/punct/g,_l).getRegex(),uL=sn(fE,"gu").replace(/notPunctSpace/g,aL).replace(/punctSpace/g,iL).replace(/punct/g,dE).getRegex(),dL=sn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,jv).replace(/punctSpace/g,af).replace(/punct/g,_l).getRegex(),pL=sn(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,_l).getRegex(),fL="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",hL=sn(fL,"gu").replace(/notPunctSpace/g,jv).replace(/punctSpace/g,af).replace(/punct/g,_l).getRegex(),mL=sn(/\\(punct)/,"gu").replace(/punct/g,_l).getRegex(),gL=sn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),vL=sn(zv).replace("(?:-->|$)","-->").getRegex(),yL=sn("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",vL).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),hp=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,wL=sn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",hp).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),hE=sn(/^!?\[(label)\]\[(ref)\]/).replace("label",hp).replace("ref",Bv).getRegex(),mE=sn(/^!?\[(ref)\](?:\[\])?/).replace("ref",Bv).getRegex(),bL=sn("reflink|nolink(?!\\()","g").replace("reflink",hE).replace("nolink",mE).getRegex(),Ub=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Gv={_backpedal:fo,anyPunctuation:mL,autolink:gL,blockSkip:sL,br:uE,code:tL,del:fo,delLDelim:fo,delRDelim:fo,emStrongLDelim:oL,emStrongRDelimAst:cL,emStrongRDelimUnd:dL,escape:eL,link:wL,nolink:mE,punctuation:rL,reflink:hE,reflinkSearch:bL,tag:yL,text:nL,url:fo},xL={...Gv,link:sn(/^!?\[(label)\]\((.*?)\)/).replace("label",hp).getRegex(),reflink:sn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",hp).getRegex()},X1={...Gv,emStrongRDelimAst:uL,emStrongLDelim:lL,delLDelim:pL,delRDelim:hL,url:sn(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ub).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:sn(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ub).getRegex()},kL={...X1,br:sn(uE).replace("{2,}","*").getRegex(),text:sn(X1.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Su={normal:qv,gfm:YM,pedantic:XM},Yl={normal:Gv,gfm:X1,breaks:kL,pedantic:xL},EL={"&":"&","<":"<",">":">",'"':""","'":"'"},Wb=t=>EL[t];function Ea(t,e){if(e){if(Yr.escapeTest.test(t))return t.replace(Yr.escapeReplace,Wb)}else if(Yr.escapeTestNoEncode.test(t))return t.replace(Yr.escapeReplaceNoEncode,Wb);return t}function Bb(t){try{t=encodeURI(t).replace(Yr.percentDecode,"%")}catch{return null}return t}function zb(t,e){let n=t.replace(Yr.findPipe,(a,s,o)=>{let l=!1,c=s;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),r=n.split(Yr.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Yr.slashPipe,"|");return r}function Xl(t,e,n){let r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function SL(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function CL(t,e=0){let n=e,r="";for(let i of t)if(i===" "){let a=4-n%4;r+=" ".repeat(a),n+=a}else r+=i,n++;return r}function qb(t,e,n,r,i){let a=e.href,s=e.title||null,o=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:s,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,l}function AL(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
|
|
4
4
|
`).map(a=>{let s=a.match(n.other.beginningSpace);if(s===null)return a;let[o]=s;return o.length>=i.length?a.slice(i.length):a}).join(`
|
|
@@ -179,8 +179,8 @@ mark{background:color-mix(in srgb,var(--s2-accent) 25%,transparent);color:inheri
|
|
|
179
179
|
</style>
|
|
180
180
|
<script>${kD}<\/script>
|
|
181
181
|
</head>
|
|
182
|
-
<body class="sprinkle-inline">${e}</body></html>`;if(xD)return SD(t,i,n);const a=document.createElement("iframe");a.setAttribute("sandbox","allow-scripts allow-same-origin"),a.style.cssText="width:100%;border:none;overflow:hidden;display:block;",a.srcdoc=i,t.appendChild(a);const s=o=>{if(o.source!==a.contentWindow)return;const l=o.data;l?.type&&(l.type==="inline-sprinkle-lick"?n(l.action,l.data):l.type==="inline-sprinkle-height"&&(a.style.height=l.height+"px"))};return window.addEventListener("message",s),{dispose(){window.removeEventListener("message",s),a.remove()}}}function ED(t,e){const n=t.querySelectorAll("pre > code.language-shtml");if(n.length===0)return[];const r=[];for(const i of n){const a=i.parentElement,s=i.textContent??"",o=document.createElement("div");o.className="msg__inline-sprinkle",a.replaceWith(o),r.push(CE(o,s,e))}return r}function Xb(t){for(const e of t)try{e.dispose()}catch{}t.length=0}function SD(t,e,n){const r=document.createElement("iframe");r.src=chrome.runtime.getURL("sprinkle-sandbox.html"),r.style.cssText="width:100%;border:none;overflow:hidden;display:block;",t.appendChild(r);const i=a=>{if(a.source!==r.contentWindow)return;const s=a.data;s?.type&&(s.type==="inline-sprinkle-lick"?n(s.action,s.data):s.type==="inline-sprinkle-height"&&(r.style.height=s.height+"px"))};return window.addEventListener("message",i),r.addEventListener("load",()=>{r.contentWindow?.postMessage({type:"inline-sprinkle-render",srcdoc:e},"*")},{once:!0}),{dispose(){window.removeEventListener("message",i),r.remove()}}}const ho=wn("tool-ui");class CD{pending=new Map;idCounter=0;generateId(){return`tool-ui-${++this.idCounter}-${Date.now().toString(36)}`}register(e,n,r,i){this.pending.set(e,{request:n,resolve:r,reject:i}),ho.info("Tool UI registered",{id:e})}async handleAction(e,n){const r=this.pending.get(e);if(!r){ho.warn("Action for unknown tool UI",{id:e,action:n.action});return}ho.info("Tool UI action",{id:e,action:n.action});try{let i;r.request.onAction?i=await r.request.onAction(n.action,n.data):i=n,r.resolve(i)}catch(i){r.reject(i instanceof Error?i:new Error(String(i)))}finally{this.pending.delete(e)}}cancel(e,n="cancelled"){const r=this.pending.get(e);r&&(r.reject(new Error(n)),this.pending.delete(e),ho.info("Tool UI cancelled",{id:e,reason:n}))}cancelAll(e="cancelled"){const n=this.pending.size;for(const[r,i]of this.pending)i.reject(new Error(e));this.pending.clear(),n>0&&ho.info("All tool UIs cancelled",{reason:e,count:n})}isPending(e){return this.pending.has(e)}getPendingIds(){return[...this.pending.keys()]}}const yp=new CD;async function AD(t,e){const n=t.id??yp.generateId();let r,i;const a=new Promise((s,o)=>{r=s,i=o});return yp.register(n,t,r,i),e?e({content:[{type:"tool_ui",requestId:n,html:t.html}]}):ho.warn("showToolUI called without onUpdate callback — UI may not render"),a.finally(()=>{e&&e({content:[{type:"tool_ui_done",requestId:n}]})})}const gl=[];function TD(t){return gl.push(t),t}function _D(t){const e=gl.lastIndexOf(t);e!==-1&&gl.splice(e,1)}function AE(){return gl.length>0?gl[gl.length-1]:null}async function TE(t){const e=AE();return e?AD(t,e.onUpdate):(ho.warn("showToolUIFromContext called without execution context"),null)}const Cc=wn("tool-ui-renderer"),ID=typeof chrome<"u"&&!!chrome?.runtime?.id;class RD{container;iframe=null;inlineSprinkle=null;messageHandler=null;requestId;nonce;constructor(e,n){this.container=e,this.requestId=n,this.nonce=crypto.randomUUID()}async render(e){ID?await this.renderInSandbox(e):this.renderWithInlineSprinkle(e)}async renderInSandbox(e){const n=document.createElement("iframe");n.src=chrome.runtime.getURL("tool-ui-sandbox.html"),n.style.cssText="width: 100%; border: none; min-height: 60px;",this.iframe=n,await new Promise((a,s)=>{const o=setTimeout(()=>{Cc.error("Tool UI iframe load timed out"),n.remove(),this.iframe=null,s(new Error("tool-ui sandbox iframe load timed out"))},5e3);n.addEventListener("load",()=>{clearTimeout(o),a()},{once:!0}),n.addEventListener("error",()=>{clearTimeout(o),n.remove(),this.iframe=null,s(new Error("tool-ui sandbox iframe failed to load"))},{once:!0}),this.container.appendChild(n)}),this.messageHandler=a=>{if(a.source!==n.contentWindow)return;const s=a.data;if(s?.type){if(s.nonce!==this.nonce){Cc.warn("Tool UI message nonce mismatch",{expected:this.nonce,received:s.nonce});return}s.type==="tool-ui-action"&&s.id===this.requestId?(Cc.info("Tool UI action received",{id:s.id,action:s.action}),yp.handleAction(s.id,{action:s.action,data:s.data})):s.type==="tool-ui-rendered"&&s.id===this.requestId?s.height&&this.iframe&&(this.iframe.style.height=`${Math.max(60,s.height)}px`):s.type==="tool-ui-resize"&&s.id===this.requestId&&s.height&&this.iframe&&(this.iframe.style.height=`${Math.max(60,s.height)}px`)}},window.addEventListener("message",this.messageHandler);const{collectThemeCSS:r}=await Vt(async()=>{const{collectThemeCSS:a}=await Promise.resolve().then(()=>bD);return{collectThemeCSS:a}},void 0),i=r();n.contentWindow.postMessage({type:"tool-ui-render",id:this.requestId,nonce:this.nonce,html:e,themeCSS:i},"*")}renderWithInlineSprinkle(e){const n=document.createElement("div");n.className="msg__inline-sprinkle",this.container.appendChild(n),this.inlineSprinkle=CE(n,e,(r,i)=>{Cc.info("Tool UI action (inline sprinkle)",{id:this.requestId,action:r}),yp.handleAction(this.requestId,{action:r,data:i})})}dispose(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.iframe&&(this.iframe.remove(),this.iframe=null),this.inlineSprinkle&&(this.inlineSprinkle.dispose(),this.inlineSprinkle=null)}}const wp=new Map;function $D(t,e,n){const r=wp.get(e);r&&r.dispose();const i=new RD(t,e);return wp.set(e,i),i.render(n).catch(a=>{Cc.error("Failed to render tool UI",{requestId:e,error:a.message})}),i}function ND(t){const e=wp.get(t);e&&(e.dispose(),wp.delete(t))}const _E=new Map;function PD(t,e){return(n,r,i)=>{if(n.api!==t)throw new Error(`Mismatched api: ${n.api} expected ${t}`);return e(n,r,i)}}function OD(t,e){return(n,r,i)=>{if(n.api!==t)throw new Error(`Mismatched api: ${n.api} expected ${t}`);return e(n,r,i)}}function Ei(t,e){_E.set(t.api,{provider:{api:t.api,stream:PD(t.api,t.stream),streamSimple:OD(t.api,t.streamSimple)},sourceId:e})}function MD(t){return _E.get(t)?.provider}var vr={};let Bd=null,a0=null,s0=null;const xh=t=>import(t),LD="node:fs",DD="node:os",FD="node:path";typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&(xh(LD).then(t=>{Bd=t.existsSync}),xh(DD).then(t=>{a0=t.homedir}),xh(FD).then(t=>{s0=t.join}));let ac=null;function UD(){if(ac===null){if(!Bd||!a0||!s0)return typeof process<"u"&&(process.versions?.node||process.versions?.bun)||(ac=!1),!1;const t=vr.GOOGLE_APPLICATION_CREDENTIALS;t?ac=Bd(t):ac=Bd(s0(a0(),".config","gcloud","application_default_credentials.json"))}return ac}function wue(t){if(t==="github-copilot")return vr.COPILOT_GITHUB_TOKEN||vr.GH_TOKEN||vr.GITHUB_TOKEN;if(t==="anthropic")return vr.ANTHROPIC_OAUTH_TOKEN||vr.ANTHROPIC_API_KEY;if(t==="google-vertex"){if(vr.GOOGLE_CLOUD_API_KEY)return vr.GOOGLE_CLOUD_API_KEY;const r=UD(),i=!!(vr.GOOGLE_CLOUD_PROJECT||vr.GCLOUD_PROJECT),a=!!vr.GOOGLE_CLOUD_LOCATION;if(r&&i&&a)return"<authenticated>"}if(t==="amazon-bedrock"&&(vr.AWS_PROFILE||vr.AWS_ACCESS_KEY_ID&&vr.AWS_SECRET_ACCESS_KEY||vr.AWS_BEARER_TOKEN_BEDROCK||vr.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI||vr.AWS_CONTAINER_CREDENTIALS_FULL_URI||vr.AWS_WEB_IDENTITY_TOKEN_FILE))return"<authenticated>";const n={openai:"OPENAI_API_KEY","azure-openai-responses":"AZURE_OPENAI_API_KEY",google:"GEMINI_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",openrouter:"OPENROUTER_API_KEY","vercel-ai-gateway":"AI_GATEWAY_API_KEY",zai:"ZAI_API_KEY",mistral:"MISTRAL_API_KEY",minimax:"MINIMAX_API_KEY","minimax-cn":"MINIMAX_CN_API_KEY",huggingface:"HF_TOKEN",opencode:"OPENCODE_API_KEY","opencode-go":"OPENCODE_API_KEY","kimi-coding":"KIMI_API_KEY"}[t];return n?vr[n]:void 0}const WD={"amazon-bedrock":{"amazon.nova-2-lite-v1:0":{id:"amazon.nova-2-lite-v1:0",name:"Nova 2 Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.33,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"amazon.nova-lite-v1:0":{id:"amazon.nova-lite-v1:0",name:"Nova Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:.015,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"amazon.nova-micro-v1:0":{id:"amazon.nova-micro-v1:0",name:"Nova Micro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:.00875,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"amazon.nova-premier-v1:0":{id:"amazon.nova-premier-v1:0",name:"Nova Premier",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:2.5,output:12.5,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"amazon.nova-pro-v1:0":{id:"amazon.nova-pro-v1:0",name:"Nova Pro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"anthropic.claude-3-5-haiku-20241022-v1:0":{id:"anthropic.claude-3-5-haiku-20241022-v1:0",name:"Claude Haiku 3.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic.claude-3-5-sonnet-20240620-v1:0":{id:"anthropic.claude-3-5-sonnet-20240620-v1:0",name:"Claude Sonnet 3.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic.claude-3-5-sonnet-20241022-v2:0":{id:"anthropic.claude-3-5-sonnet-20241022-v2:0",name:"Claude Sonnet 3.5 v2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic.claude-3-7-sonnet-20250219-v1:0":{id:"anthropic.claude-3-7-sonnet-20250219-v1:0",name:"Claude Sonnet 3.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic.claude-3-haiku-20240307-v1:0":{id:"anthropic.claude-3-haiku-20240307-v1:0",name:"Claude Haiku 3",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:4096},"anthropic.claude-haiku-4-5-20251001-v1:0":{id:"anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-1-20250805-v1:0":{id:"anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic.claude-opus-4-20250514-v1:0":{id:"anthropic.claude-opus-4-20250514-v1:0",name:"Claude Opus 4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic.claude-opus-4-5-20251101-v1:0":{id:"anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-6-v1":{id:"anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-sonnet-4-20250514-v1:0":{id:"anthropic.claude-sonnet-4-20250514-v1:0",name:"Claude Sonnet 4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-sonnet-4-6":{id:"anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"deepseek.r1-v1:0":{id:"deepseek.r1-v1:0",name:"DeepSeek-R1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"deepseek.v3-v1:0":{id:"deepseek.v3-v1:0",name:"DeepSeek-V3.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.58,output:1.68,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"deepseek.v3.2":{id:"deepseek.v3.2",name:"DeepSeek-V3.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.62,output:1.85,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"eu.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"eu.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-5-20251101-v1:0":{id:"eu.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-6-v1":{id:"eu.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-sonnet-4-20250514-v1:0":{id:"eu.anthropic.claude-sonnet-4-20250514-v1:0",name:"Claude Sonnet 4 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"eu.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-sonnet-4-6":{id:"eu.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"global.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"global.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-5-20251101-v1:0":{id:"global.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-6-v1":{id:"global.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-sonnet-4-20250514-v1:0":{id:"global.anthropic.claude-sonnet-4-20250514-v1:0",name:"Claude Sonnet 4 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"global.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-sonnet-4-6":{id:"global.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"google.gemma-3-27b-it":{id:"google.gemma-3-27b-it",name:"Google Gemma 3 27B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.12,output:.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:8192},"google.gemma-3-4b-it":{id:"google.gemma-3-4b-it",name:"Gemma 3 4B IT",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.04,output:.08,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-1-405b-instruct-v1:0":{id:"meta.llama3-1-405b-instruct-v1:0",name:"Llama 3.1 405B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:2.4,output:2.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-1-70b-instruct-v1:0":{id:"meta.llama3-1-70b-instruct-v1:0",name:"Llama 3.1 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-1-8b-instruct-v1:0":{id:"meta.llama3-1-8b-instruct-v1:0",name:"Llama 3.1 8B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.22,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-2-11b-instruct-v1:0":{id:"meta.llama3-2-11b-instruct-v1:0",name:"Llama 3.2 11B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.16,output:.16,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-2-1b-instruct-v1:0":{id:"meta.llama3-2-1b-instruct-v1:0",name:"Llama 3.2 1B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:4096},"meta.llama3-2-3b-instruct-v1:0":{id:"meta.llama3-2-3b-instruct-v1:0",name:"Llama 3.2 3B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:4096},"meta.llama3-2-90b-instruct-v1:0":{id:"meta.llama3-2-90b-instruct-v1:0",name:"Llama 3.2 90B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-3-70b-instruct-v1:0":{id:"meta.llama3-3-70b-instruct-v1:0",name:"Llama 3.3 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama4-maverick-17b-instruct-v1:0":{id:"meta.llama4-maverick-17b-instruct-v1:0",name:"Llama 4 Maverick 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"meta.llama4-scout-17b-instruct-v1:0":{id:"meta.llama4-scout-17b-instruct-v1:0",name:"Llama 4 Scout 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:35e5,maxTokens:16384},"minimax.minimax-m2":{id:"minimax.minimax-m2",name:"MiniMax M2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204608,maxTokens:128e3},"minimax.minimax-m2.1":{id:"minimax.minimax-m2.1",name:"MiniMax M2.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"mistral.devstral-2-123b":{id:"mistral.devstral-2-123b",name:"Devstral 2 123B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.magistral-small-2509":{id:"mistral.magistral-small-2509",name:"Magistral Small 1.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e4},"mistral.ministral-3-14b-instruct":{id:"mistral.ministral-3-14b-instruct",name:"Ministral 14B 3.0",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.2,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.ministral-3-3b-instruct":{id:"mistral.ministral-3-3b-instruct",name:"Ministral 3 3B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.ministral-3-8b-instruct":{id:"mistral.ministral-3-8b-instruct",name:"Ministral 3 8B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.mistral-large-3-675b-instruct":{id:"mistral.mistral-large-3-675b-instruct",name:"Mistral Large 3",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.pixtral-large-2502-v1:0":{id:"mistral.pixtral-large-2502-v1:0",name:"Pixtral Large (25.02)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"mistral.voxtral-mini-3b-2507":{id:"mistral.voxtral-mini-3b-2507",name:"Voxtral Mini 3B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.voxtral-small-24b-2507":{id:"mistral.voxtral-small-24b-2507",name:"Voxtral Small 24B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.35,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:8192},"moonshot.kimi-k2-thinking":{id:"moonshot.kimi-k2-thinking",name:"Kimi K2 Thinking",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"moonshotai.kimi-k2.5":{id:"moonshotai.kimi-k2.5",name:"Kimi K2.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"nvidia.nemotron-nano-12b-v2":{id:"nvidia.nemotron-nano-12b-v2",name:"NVIDIA Nemotron Nano 12B v2 VL BF16",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-3-30b":{id:"nvidia.nemotron-nano-3-30b",name:"NVIDIA Nemotron Nano 3 30B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-9b-v2":{id:"nvidia.nemotron-nano-9b-v2",name:"NVIDIA Nemotron Nano 9B v2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.06,output:.23,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai.gpt-oss-120b-1:0":{id:"openai.gpt-oss-120b-1:0",name:"gpt-oss-120b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai.gpt-oss-20b-1:0":{id:"openai.gpt-oss-20b-1:0",name:"gpt-oss-20b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.07,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai.gpt-oss-safeguard-120b":{id:"openai.gpt-oss-safeguard-120b",name:"GPT OSS Safeguard 120B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai.gpt-oss-safeguard-20b":{id:"openai.gpt-oss-safeguard-20b",name:"GPT OSS Safeguard 20B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.07,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"qwen.qwen3-235b-a22b-2507-v1:0":{id:"qwen.qwen3-235b-a22b-2507-v1:0",name:"Qwen3 235B A22B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-32b-v1:0":{id:"qwen.qwen3-32b-v1:0",name:"Qwen3 32B (dense)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"qwen.qwen3-coder-30b-a3b-v1:0":{id:"qwen.qwen3-coder-30b-a3b-v1:0",name:"Qwen3 Coder 30B A3B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-coder-480b-a35b-v1:0":{id:"qwen.qwen3-coder-480b-a35b-v1:0",name:"Qwen3 Coder 480B A35B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen.qwen3-next-80b-a3b":{id:"qwen.qwen3-next-80b-a3b",name:"Qwen/Qwen3-Next-80B-A3B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.14,output:1.4,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"qwen.qwen3-vl-235b-a22b":{id:"qwen.qwen3-vl-235b-a22b",name:"Qwen/Qwen3-VL-235B-A22B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.3,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"us.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"us.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-1-20250805-v1:0":{id:"us.anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"us.anthropic.claude-opus-4-20250514-v1:0":{id:"us.anthropic.claude-opus-4-20250514-v1:0",name:"Claude Opus 4 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"us.anthropic.claude-opus-4-5-20251101-v1:0":{id:"us.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-6-v1":{id:"us.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-sonnet-4-20250514-v1:0":{id:"us.anthropic.claude-sonnet-4-20250514-v1:0",name:"Claude Sonnet 4 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"us.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-sonnet-4-6":{id:"us.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"writer.palmyra-x4-v1:0":{id:"writer.palmyra-x4-v1:0",name:"Palmyra X4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:122880,maxTokens:8192},"writer.palmyra-x5-v1:0":{id:"writer.palmyra-x5-v1:0",name:"Palmyra X5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:6,cacheRead:0,cacheWrite:0},contextWindow:104e4,maxTokens:8192},"zai.glm-4.7":{id:"zai.glm-4.7",name:"GLM-4.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai.glm-4.7-flash":{id:"zai.glm-4.7-flash",name:"GLM-4.7-Flash",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.07,output:.4,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072}},anthropic:{"claude-3-5-haiku-20241022":{id:"claude-3-5-haiku-20241022",name:"Claude Haiku 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-haiku-latest":{id:"claude-3-5-haiku-latest",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20240620":{id:"claude-3-5-sonnet-20240620",name:"Claude Sonnet 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20241022":{id:"claude-3-5-sonnet-20241022",name:"Claude Sonnet 3.5 v2",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-7-sonnet-20250219":{id:"claude-3-7-sonnet-20250219",name:"Claude Sonnet 3.7",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-3-7-sonnet-latest":{id:"claude-3-7-sonnet-latest",name:"Claude Sonnet 3.7 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-3-haiku-20240307":{id:"claude-3-haiku-20240307",name:"Claude Haiku 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3-opus-20240229":{id:"claude-3-opus-20240229",name:"Claude Opus 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:4096},"claude-3-sonnet-20240229":{id:"claude-3-sonnet-20240229",name:"Claude Sonnet 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-haiku-4-5-20251001":{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-0":{id:"claude-opus-4-0",name:"Claude Opus 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1-20250805":{id:"claude-opus-4-1-20250805",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-20250514":{id:"claude-opus-4-20250514",name:"Claude Opus 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-5-20251101":{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4-0":{id:"claude-sonnet-4-0",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-20250514":{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5-20250929":{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3}},"azure-openai-responses":{"codex-mini-latest":{id:"codex-mini-latest",name:"Codex Mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text"],cost:{input:1.5,output:6,cacheRead:.375,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"gpt-4":{id:"gpt-4",name:"GPT-4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.03,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},cerebras:{"gpt-oss-120b":{id:"gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!0,input:["text"],cost:{input:.25,output:.69,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"llama3.1-8b":{id:"llama3.1-8b",name:"Llama 3.1 8B",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:8e3},"qwen-3-235b-a22b-instruct-2507":{id:"qwen-3-235b-a22b-instruct-2507",name:"Qwen 3 235B Instruct",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:.6,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:32e3},"zai-glm-4.7":{id:"zai-glm-4.7",name:"Z.AI GLM-4.7",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:2.25,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4e4}},"github-copilot":{"claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:144e3,maxTokens:32e3},"claude-opus-4.5":{id:"claude-opus-4.5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:16e4,maxTokens:32e3},"claude-opus-4.6":{id:"claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:216e3,maxTokens:16e3},"claude-sonnet-4.5":{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:144e3,maxTokens:32e3},"claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:32e3},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5-mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1-Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1-Codex-max",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1-Codex-mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2-Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3-Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"grok-code-fast-1":{id:"grok-code-fast-1",name:"Grok Code Fast 1",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3}},google:{"gemini-1.5-flash":{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-flash-8b":{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash-8B",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.0375,output:.15,cacheRead:.01,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-pro":{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:1.25,output:5,cacheRead:.3125,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite-preview-06-17":{id:"gemini-2.5-flash-lite-preview-06-17",name:"Gemini 2.5 Flash Lite Preview 06-17",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite-preview-09-2025":{id:"gemini-2.5-flash-lite-preview-09-2025",name:"Gemini 2.5 Flash Lite Preview 09-25",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-preview-04-17":{id:"gemini-2.5-flash-preview-04-17",name:"Gemini 2.5 Flash Preview 04-17",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.0375,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-preview-05-20":{id:"gemini-2.5-flash-preview-05-20",name:"Gemini 2.5 Flash Preview 05-20",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.0375,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-preview-09-2025":{id:"gemini-2.5-flash-preview-09-2025",name:"Gemini 2.5 Flash Preview 09-25",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.31,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro-preview-05-06":{id:"gemini-2.5-pro-preview-05-06",name:"Gemini 2.5 Pro Preview 05-06",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.31,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro-preview-06-05":{id:"gemini-2.5-pro-preview-06-05",name:"Gemini 2.5 Pro Preview 06-05",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.31,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"gemini-3.1-flash-lite-preview":{id:"gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:1},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview-customtools":{id:"gemini-3.1-pro-preview-customtools",name:"Gemini 3.1 Pro Preview Custom Tools",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-latest":{id:"gemini-flash-latest",name:"Gemini Flash Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-lite-latest":{id:"gemini-flash-lite-latest",name:"Gemini Flash-Lite Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-live-2.5-flash":{id:"gemini-live-2.5-flash",name:"Gemini Live 2.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.5,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"gemini-live-2.5-flash-preview-native-audio":{id:"gemini-live-2.5-flash-preview-native-audio",name:"Gemini Live 2.5 Flash Preview Native Audio",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text"],cost:{input:.5,output:2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536}},"google-antigravity":{"claude-opus-4-5-thinking":{id:"claude-opus-4-5-thinking",name:"Claude Opus 4.5 Thinking (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6-thinking":{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:128e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5-thinking":{id:"claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6 (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"gemini-3-flash":{id:"gemini-3-flash",name:"Gemini 3 Flash (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.5,cacheWrite:0},contextWindow:1048576,maxTokens:65535},"gemini-3.1-pro-high":{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:2.375},contextWindow:1048576,maxTokens:65535},"gemini-3.1-pro-low":{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro Low (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:2.375},contextWindow:1048576,maxTokens:65535},"gpt-oss-120b-medium":{id:"gpt-oss-120b-medium",name:"GPT-OSS 120B Medium (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!1,input:["text"],cost:{input:.09,output:.36,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768}},"google-gemini-cli":{"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65535},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65535},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65535},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65535},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65535}},"google-vertex":{"gemini-1.5-flash":{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-flash-8b":{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash-8B (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.0375,output:.15,cacheRead:.01,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-pro":{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:1.25,output:5,cacheRead:.3125,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.0375,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite-preview-09-2025":{id:"gemini-2.5-flash-lite-preview-09-2025",name:"Gemini 2.5 Flash Lite Preview 09-25 (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536}},groq:{"deepseek-r1-distill-llama-70b":{id:"deepseek-r1-distill-llama-70b",name:"DeepSeek R1 Distill Llama 70B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.75,output:.99,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"gemma2-9b-it":{id:"gemma2-9b-it",name:"Gemma 2 9B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.2,output:.2,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"llama-3.1-8b-instant":{id:"llama-3.1-8b-instant",name:"Llama 3.1 8B Instant",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.08,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"llama-3.3-70b-versatile":{id:"llama-3.3-70b-versatile",name:"Llama 3.3 70B Versatile",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.59,output:.79,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"llama3-70b-8192":{id:"llama3-70b-8192",name:"Llama 3 70B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.59,output:.79,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"llama3-8b-8192":{id:"llama3-8b-8192",name:"Llama 3 8B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.08,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"meta-llama/llama-4-maverick-17b-128e-instruct":{id:"meta-llama/llama-4-maverick-17b-128e-instruct",name:"Llama 4 Maverick 17B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"meta-llama/llama-4-scout-17b-16e-instruct":{id:"meta-llama/llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text","image"],cost:{input:.11,output:.34,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"mistral-saba-24b":{id:"mistral-saba-24b",name:"Mistral Saba 24B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.79,output:.79,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"moonshotai/kimi-k2-instruct":{id:"moonshotai/kimi-k2-instruct",name:"Kimi K2 Instruct",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/kimi-k2-instruct-0905":{id:"moonshotai/kimi-k2-instruct-0905",name:"Kimi K2 Instruct 0905",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen-qwq-32b":{id:"qwen-qwq-32b",name:"Qwen QwQ 32B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.29,output:.39,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen3 32B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.29,output:.59,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384}},huggingface:{"MiniMaxAI/MiniMax-M2.1":{id:"MiniMaxAI/MiniMax-M2.1",name:"MiniMax-M2.1",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.5":{id:"MiniMaxAI/MiniMax-M2.5",name:"MiniMax-M2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:131072},"Qwen/Qwen3-235B-A22B-Thinking-2507":{id:"Qwen/Qwen3-235B-A22B-Thinking-2507",name:"Qwen3-235B-A22B-Thinking-2507",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3-Coder-480B-A35B-Instruct":{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct",name:"Qwen3-Coder-480B-A35B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:2,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Coder-Next":{id:"Qwen/Qwen3-Coder-Next",name:"Qwen3-Coder-Next",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.2,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Qwen/Qwen3-Next-80B-A3B-Instruct":{id:"Qwen/Qwen3-Next-80B-A3B-Instruct",name:"Qwen3-Next-80B-A3B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Next-80B-A3B-Thinking":{id:"Qwen/Qwen3-Next-80B-A3B-Thinking",name:"Qwen3-Next-80B-A3B-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.3,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3.5-397B-A17B":{id:"Qwen/Qwen3.5-397B-A17B",name:"Qwen3.5-397B-A17B",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"XiaomiMiMo/MiMo-V2-Flash":{id:"XiaomiMiMo/MiMo-V2-Flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"deepseek-ai/DeepSeek-R1-0528":{id:"deepseek-ai/DeepSeek-R1-0528",name:"DeepSeek-R1-0528",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:3,output:5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:163840},"deepseek-ai/DeepSeek-V3.2":{id:"deepseek-ai/DeepSeek-V3.2",name:"DeepSeek-V3.2",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.28,output:.4,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"moonshotai/Kimi-K2-Instruct":{id:"moonshotai/Kimi-K2-Instruct",name:"Kimi-K2-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/Kimi-K2-Instruct-0905":{id:"moonshotai/Kimi-K2-Instruct-0905",name:"Kimi-K2-Instruct-0905",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"moonshotai/Kimi-K2-Thinking":{id:"moonshotai/Kimi-K2-Thinking",name:"Kimi-K2-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.5":{id:"moonshotai/Kimi-K2.5",name:"Kimi-K2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"zai-org/GLM-4.7":{id:"zai-org/GLM-4.7",name:"GLM-4.7",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai-org/GLM-4.7-Flash":{id:"zai-org/GLM-4.7-Flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai-org/GLM-5":{id:"zai-org/GLM-5",name:"GLM-5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"kimi-coding":{k2p5:{id:"k2p5",name:"Kimi K2.5",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768}},minimax:{"MiniMax-M2":{id:"MiniMax-M2",name:"MiniMax-M2",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.1":{id:"MiniMax-M2.1",name:"MiniMax-M2.1",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.1-highspeed":{id:"MiniMax-M2.1-highspeed",name:"MiniMax-M2.1-highspeed",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.5":{id:"MiniMax-M2.5",name:"MiniMax-M2.5",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.5-highspeed":{id:"MiniMax-M2.5-highspeed",name:"MiniMax-M2.5-highspeed",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072}},"minimax-cn":{"MiniMax-M2":{id:"MiniMax-M2",name:"MiniMax-M2",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.1":{id:"MiniMax-M2.1",name:"MiniMax-M2.1",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.1-highspeed":{id:"MiniMax-M2.1-highspeed",name:"MiniMax-M2.1-highspeed",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.5":{id:"MiniMax-M2.5",name:"MiniMax-M2.5",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.5-highspeed":{id:"MiniMax-M2.5-highspeed",name:"MiniMax-M2.5-highspeed",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072}},mistral:{"codestral-latest":{id:"codestral-latest",name:"Codestral (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.3,output:.9,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"devstral-2512":{id:"devstral-2512",name:"Devstral 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-medium-2507":{id:"devstral-medium-2507",name:"Devstral Medium",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-medium-latest":{id:"devstral-medium-latest",name:"Devstral 2 (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-small-2505":{id:"devstral-small-2505",name:"Devstral Small 2505",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-small-2507":{id:"devstral-small-2507",name:"Devstral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"labs-devstral-small-2512":{id:"labs-devstral-small-2512",name:"Devstral Small 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"magistral-medium-latest":{id:"magistral-medium-latest",name:"Magistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:2,output:5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"magistral-small":{id:"magistral-small",name:"Magistral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-3b-latest":{id:"ministral-3b-latest",name:"Ministral 3B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-8b-latest":{id:"ministral-8b-latest",name:"Ministral 8B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-large-2411":{id:"mistral-large-2411",name:"Mistral Large 2.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"mistral-large-2512":{id:"mistral-large-2512",name:"Mistral Large 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-large-latest":{id:"mistral-large-latest",name:"Mistral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-2505":{id:"mistral-medium-2505",name:"Mistral Medium 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"mistral-medium-2508":{id:"mistral-medium-2508",name:"Mistral Medium 3.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-latest":{id:"mistral-medium-latest",name:"Mistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistral-nemo":{id:"mistral-nemo",name:"Mistral Nemo",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-small-2506":{id:"mistral-small-2506",name:"Mistral Small 3.2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistral-small-latest":{id:"mistral-small-latest",name:"Mistral Small (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"open-mistral-7b":{id:"open-mistral-7b",name:"Mistral 7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.25,output:.25,cacheRead:0,cacheWrite:0},contextWindow:8e3,maxTokens:8e3},"open-mixtral-8x22b":{id:"open-mixtral-8x22b",name:"Mixtral 8x22B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:64e3,maxTokens:64e3},"open-mixtral-8x7b":{id:"open-mixtral-8x7b",name:"Mixtral 8x7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.7,output:.7,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:32e3},"pixtral-12b":{id:"pixtral-12b",name:"Pixtral 12B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"pixtral-large-latest":{id:"pixtral-large-latest",name:"Pixtral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3}},openai:{"codex-mini-latest":{id:"codex-mini-latest",name:"Codex Mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text"],cost:{input:1.5,output:6,cacheRead:.375,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"gpt-4":{id:"gpt-4",name:"GPT-4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.03,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},"openai-codex":{"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:272e3,maxTokens:128e3}},opencode:{"big-pickle":{id:"big-pickle",name:"Big Pickle",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"claude-3-5-haiku":{id:"claude-3-5-haiku",name:"Claude Haiku 3.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"gemini-3-flash":{id:"gemini-3-flash",name:"Gemini 3 Flash",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro":{id:"gemini-3.1-pro",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:204800,maxTokens:131072},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:30,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni-free":{id:"mimo-v2-omni-free",name:"MiMo V2 Omni Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:64e3},"mimo-v2-pro-free":{id:"mimo-v2-pro-free",name:"MiMo V2 Pro Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:64e3},"minimax-m2.5":{id:"minimax-m2.5",name:"MiniMax M2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m2.5-free":{id:"minimax-m2.5-free",name:"MiniMax M2.5 Free",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"nemotron-3-super-free":{id:"nemotron-3-super-free",name:"Nemotron 3 Super Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:128e3}},"opencode-go":{"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:204800,maxTokens:131072},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:65536},"minimax-m2.5":{id:"minimax-m2.5",name:"MiniMax M2.5",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m2.7":{id:"minimax-m2.7",name:"MiniMax M2.7",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072}},openrouter:{"ai21/jamba-large-1.7":{id:"ai21/jamba-large-1.7",name:"AI21: Jamba Large 1.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:8,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"alibaba/tongyi-deepresearch-30b-a3b":{id:"alibaba/tongyi-deepresearch-30b-a3b",name:"Tongyi DeepResearch 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.44999999999999996,cacheRead:.09,cacheWrite:0},contextWindow:131072,maxTokens:131072},"allenai/olmo-3.1-32b-instruct":{id:"allenai/olmo-3.1-32b-instruct",name:"AllenAI: Olmo 3.1 32B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.6,cacheRead:0,cacheWrite:0},contextWindow:65536,maxTokens:4096},"amazon/nova-2-lite-v1":{id:"amazon/nova-2-lite-v1",name:"Amazon: Nova 2 Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65535},"amazon/nova-lite-v1":{id:"amazon/nova-lite-v1",name:"Amazon: Nova Lite 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"amazon/nova-micro-v1":{id:"amazon/nova-micro-v1",name:"Amazon: Nova Micro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:5120},"amazon/nova-premier-v1":{id:"amazon/nova-premier-v1",name:"Amazon: Nova Premier 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:12.5,cacheRead:.625,cacheWrite:0},contextWindow:1e6,maxTokens:32e3},"amazon/nova-pro-v1":{id:"amazon/nova-pro-v1",name:"Amazon: Nova Pro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:3.1999999999999997,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Anthropic: Claude 3 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Anthropic: Claude 3.5 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-3.5-sonnet":{id:"anthropic/claude-3.5-sonnet",name:"Anthropic: Claude 3.5 Sonnet",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:6,output:30,cacheRead:.6,cacheWrite:7.5},contextWindow:2e5,maxTokens:8192},"anthropic/claude-3.7-sonnet":{id:"anthropic/claude-3.7-sonnet",name:"Anthropic: Claude 3.7 Sonnet",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-3.7-sonnet:thinking":{id:"anthropic/claude-3.7-sonnet:thinking",name:"Anthropic: Claude 3.7 Sonnet (thinking)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Anthropic: Claude Haiku 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.09999999999999999,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Anthropic: Claude Opus 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Anthropic: Claude Opus 4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Anthropic: Claude Opus 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Anthropic: Claude Opus 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Anthropic: Claude Sonnet 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Anthropic: Claude Sonnet 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Anthropic: Claude Sonnet 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-preview:free":{id:"arcee-ai/trinity-large-preview:free",name:"Arcee AI: Trinity Large Preview (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:4096},"arcee-ai/trinity-mini":{id:"arcee-ai/trinity-mini",name:"Arcee AI: Trinity Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.045,output:.15,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"arcee-ai/trinity-mini:free":{id:"arcee-ai/trinity-mini:free",name:"Arcee AI: Trinity Mini (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"arcee-ai/virtuoso-large":{id:"arcee-ai/virtuoso-large",name:"Arcee AI: Virtuoso Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.75,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:64e3},auto:{id:"auto",name:"Auto",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"baidu/ernie-4.5-21b-a3b":{id:"baidu/ernie-4.5-21b-a3b",name:"Baidu: ERNIE 4.5 21B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.07,output:.28,cacheRead:0,cacheWrite:0},contextWindow:12e4,maxTokens:8e3},"baidu/ernie-4.5-vl-28b-a3b":{id:"baidu/ernie-4.5-vl-28b-a3b",name:"Baidu: ERNIE 4.5 VL 28B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.14,output:.56,cacheRead:0,cacheWrite:0},contextWindow:3e4,maxTokens:8e3},"bytedance-seed/seed-1.6":{id:"bytedance-seed/seed-1.6",name:"ByteDance Seed: Seed 1.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-1.6-flash":{id:"bytedance-seed/seed-1.6-flash",name:"ByteDance Seed: Seed 1.6 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-2.0-lite":{id:"bytedance-seed/seed-2.0-lite",name:"ByteDance Seed: Seed-2.0-Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"bytedance-seed/seed-2.0-mini":{id:"bytedance-seed/seed-2.0-mini",name:"ByteDance Seed: Seed-2.0-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"cohere/command-r-08-2024":{id:"cohere/command-r-08-2024",name:"Cohere: Command R (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"cohere/command-r-plus-08-2024":{id:"cohere/command-r-plus-08-2024",name:"Cohere: Command R+ (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"deepseek/deepseek-chat":{id:"deepseek/deepseek-chat",name:"DeepSeek: DeepSeek V3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.32,output:.8899999999999999,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:163840},"deepseek/deepseek-chat-v3-0324":{id:"deepseek/deepseek-chat-v3-0324",name:"DeepSeek: DeepSeek V3 0324",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:.77,cacheRead:.135,cacheWrite:0},contextWindow:163840,maxTokens:4096},"deepseek/deepseek-chat-v3.1":{id:"deepseek/deepseek-chat-v3.1",name:"DeepSeek: DeepSeek V3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.75,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:7168},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek: R1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.7,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:64e3,maxTokens:16e3},"deepseek/deepseek-r1-0528":{id:"deepseek/deepseek-r1-0528",name:"DeepSeek: R1 0528",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.44999999999999996,output:2.1500000000000004,cacheRead:.22499999999999998,cacheWrite:0},contextWindow:163840,maxTokens:65536},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek: DeepSeek V3.1 Terminus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.21,output:.7899999999999999,cacheRead:.1300000002,cacheWrite:0},contextWindow:163840,maxTokens:4096},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek: DeepSeek V3.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.26,output:.38,cacheRead:.13,cacheWrite:0},contextWindow:163840,maxTokens:4096},"deepseek/deepseek-v3.2-exp":{id:"deepseek/deepseek-v3.2-exp",name:"DeepSeek: DeepSeek V3.2 Exp",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.41,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"essentialai/rnj-1-instruct":{id:"essentialai/rnj-1-instruct",name:"EssentialAI: Rnj 1 Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:4096},"google/gemini-2.0-flash-001":{id:"google/gemini-2.0-flash-001",name:"Google: Gemini 2.0 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:8192},"google/gemini-2.0-flash-lite-001":{id:"google/gemini-2.0-flash-lite-001",name:"Google: Gemini 2.0 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Google: Gemini 2.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Google: Gemini 2.5 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite-preview-09-2025":{id:"google/gemini-2.5-flash-lite-preview-09-2025",name:"Google: Gemini 2.5 Flash Lite Preview 09-2025",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Google: Gemini 2.5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview":{id:"google/gemini-2.5-pro-preview",name:"Google: Gemini 2.5 Pro Preview 06-05",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview-05-06":{id:"google/gemini-2.5-pro-preview-05-06",name:"Google: Gemini 2.5 Pro Preview 05-06",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65535},"google/gemini-3-flash-preview":{id:"google/gemini-3-flash-preview",name:"Google: Gemini 3 Flash Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.049999999999999996,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-3-pro-preview":{id:"google/gemini-3-pro-preview",name:"Google: Gemini 3 Pro Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Google: Gemini 3.1 Flash Lite Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.024999999999999998,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Google: Gemini 3.1 Pro Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview-customtools":{id:"google/gemini-3.1-pro-preview-customtools",name:"Google: Gemini 3.1 Pro Preview Custom Tools",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"inception/mercury":{id:"inception/mercury",name:"Inception: Mercury",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"inception/mercury-2":{id:"inception/mercury-2",name:"Inception: Mercury 2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:5e4},"inception/mercury-coder":{id:"inception/mercury-coder",name:"Inception: Mercury Coder",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"kwaipilot/kat-coder-pro":{id:"kwaipilot/kat-coder-pro",name:"Kwaipilot: KAT-Coder-Pro V1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.207,output:.828,cacheRead:.0414,cacheWrite:0},contextWindow:256e3,maxTokens:128e3},"meituan/longcat-flash-chat":{id:"meituan/longcat-flash-chat",name:"Meituan: LongCat Flash Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.7999999999999999,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:131072},"meta-llama/llama-3-8b-instruct":{id:"meta-llama/llama-3-8b-instruct",name:"Meta: Llama 3 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.03,output:.04,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:16384},"meta-llama/llama-3.1-70b-instruct":{id:"meta-llama/llama-3.1-70b-instruct",name:"Meta: Llama 3.1 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"meta-llama/llama-3.1-8b-instruct":{id:"meta-llama/llama-3.1-8b-instruct",name:"Meta: Llama 3.1 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.049999999999999996,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct":{id:"meta-llama/llama-3.3-70b-instruct",name:"Meta: Llama 3.3 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.32,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct:free":{id:"meta-llama/llama-3.3-70b-instruct:free",name:"Meta: Llama 3.3 70B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:65536,maxTokens:4096},"meta-llama/llama-4-maverick":{id:"meta-llama/llama-4-maverick",name:"Meta: Llama 4 Maverick",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:16384},"meta-llama/llama-4-scout":{id:"meta-llama/llama-4-scout",name:"Meta: Llama 4 Scout",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.3,cacheRead:0,cacheWrite:0},contextWindow:327680,maxTokens:16384},"minimax/minimax-m1":{id:"minimax/minimax-m1",name:"MiniMax: MiniMax M1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.39999999999999997,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:4e4},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax: MiniMax M2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.255,output:1,cacheRead:.03,cacheWrite:0},contextWindow:196608,maxTokens:196608},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax: MiniMax M2.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.95,cacheRead:.0290000007,cacheWrite:0},contextWindow:196608,maxTokens:4096},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax: MiniMax M2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.17,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:196608,maxTokens:65536},"minimax/minimax-m2.5:free":{id:"minimax/minimax-m2.5:free",name:"MiniMax: MiniMax M2.5 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:196608,maxTokens:196608},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"MiniMax: MiniMax M2.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"mistralai/codestral-2508":{id:"mistralai/codestral-2508",name:"Mistral: Codestral 2508",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.3,output:.8999999999999999,cacheRead:.03,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"mistralai/devstral-2512":{id:"mistralai/devstral-2512",name:"Mistral: Devstral 2 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/devstral-medium":{id:"mistralai/devstral-medium",name:"Mistral: Devstral Medium",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/devstral-small":{id:"mistralai/devstral-small",name:"Mistral: Devstral Small 1.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/ministral-14b-2512":{id:"mistralai/ministral-14b-2512",name:"Mistral: Ministral 3 14B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.19999999999999998,output:.19999999999999998,cacheRead:.02,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/ministral-3b-2512":{id:"mistralai/ministral-3b-2512",name:"Mistral: Ministral 3 3B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:.01,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/ministral-8b-2512":{id:"mistralai/ministral-8b-2512",name:"Mistral: Ministral 3 8B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-large":{id:"mistralai/mistral-large",name:"Mistral Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-large-2407":{id:"mistralai/mistral-large-2407",name:"Mistral Large 2407",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-large-2411":{id:"mistralai/mistral-large-2411",name:"Mistral Large 2411",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-large-2512":{id:"mistralai/mistral-large-2512",name:"Mistral: Mistral Large 3 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-medium-3":{id:"mistralai/mistral-medium-3",name:"Mistral: Mistral Medium 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-medium-3.1":{id:"mistralai/mistral-medium-3.1",name:"Mistral: Mistral Medium 3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-nemo":{id:"mistralai/mistral-nemo",name:"Mistral: Mistral Nemo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.04,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"mistralai/mistral-saba":{id:"mistralai/mistral-saba",name:"Mistral: Saba",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.6,cacheRead:.02,cacheWrite:0},contextWindow:32768,maxTokens:4096},"mistralai/mistral-small-24b-instruct-2501":{id:"mistralai/mistral-small-24b-instruct-2501",name:"Mistral: Mistral Small 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.049999999999999996,output:.08,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:16384},"mistralai/mistral-small-2603":{id:"mistralai/mistral-small-2603",name:"Mistral: Mistral Small 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-small-3.1-24b-instruct:free":{id:"mistralai/mistral-small-3.1-24b-instruct:free",name:"Mistral: Mistral Small 3.1 24B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-small-3.2-24b-instruct":{id:"mistralai/mistral-small-3.2-24b-instruct",name:"Mistral: Mistral Small 3.2 24B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.075,output:.19999999999999998,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-small-creative":{id:"mistralai/mistral-small-creative",name:"Mistral: Mistral Small Creative",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:32768,maxTokens:4096},"mistralai/mixtral-8x22b-instruct":{id:"mistralai/mixtral-8x22b-instruct",name:"Mistral: Mixtral 8x22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:65536,maxTokens:4096},"mistralai/mixtral-8x7b-instruct":{id:"mistralai/mixtral-8x7b-instruct",name:"Mistral: Mixtral 8x7B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.54,output:.54,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:16384},"mistralai/pixtral-large-2411":{id:"mistralai/pixtral-large-2411",name:"Mistral: Pixtral Large 2411",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/voxtral-small-24b-2507":{id:"mistralai/voxtral-small-24b-2507",name:"Mistral: Voxtral Small 24B 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:32e3,maxTokens:4096},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"MoonshotAI: Kimi K2 0711",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.55,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:4096},"moonshotai/kimi-k2-0905":{id:"moonshotai/kimi-k2-0905",name:"MoonshotAI: Kimi K2 0905",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:4096},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"MoonshotAI: Kimi K2 Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.47,output:2,cacheRead:.14100000000000001,cacheWrite:0},contextWindow:131072,maxTokens:4096},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"MoonshotAI: Kimi K2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.41,output:2.06,cacheRead:.07,cacheWrite:0},contextWindow:262144,maxTokens:4096},"nex-agi/deepseek-v3.1-nex-n1":{id:"nex-agi/deepseek-v3.1-nex-n1",name:"Nex AGI: DeepSeek V3.1 Nex N1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.27,output:1,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:163840},"nvidia/llama-3.1-nemotron-70b-instruct":{id:"nvidia/llama-3.1-nemotron-70b-instruct",name:"NVIDIA: Llama 3.1 Nemotron 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1.2,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"nvidia/llama-3.3-nemotron-super-49b-v1.5":{id:"nvidia/llama-3.3-nemotron-super-49b-v1.5",name:"NVIDIA: Llama 3.3 Nemotron Super 49B V1.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"nvidia/nemotron-3-nano-30b-a3b":{id:"nvidia/nemotron-3-nano-30b-a3b",name:"NVIDIA: Nemotron 3 Nano 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.049999999999999996,output:.19999999999999998,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"nvidia/nemotron-3-nano-30b-a3b:free":{id:"nvidia/nemotron-3-nano-30b-a3b:free",name:"NVIDIA: Nemotron 3 Nano 30B A3B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"nvidia/nemotron-3-super-120b-a12b":{id:"nvidia/nemotron-3-super-120b-a12b",name:"NVIDIA: Nemotron 3 Super",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.5,cacheRead:.04,cacheWrite:0},contextWindow:262144,maxTokens:4096},"nvidia/nemotron-3-super-120b-a12b:free":{id:"nvidia/nemotron-3-super-120b-a12b:free",name:"NVIDIA: Nemotron 3 Super (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"nvidia/nemotron-nano-12b-v2-vl:free":{id:"nvidia/nemotron-nano-12b-v2-vl:free",name:"NVIDIA: Nemotron Nano 12B 2 VL (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"nvidia/nemotron-nano-9b-v2":{id:"nvidia/nemotron-nano-9b-v2",name:"NVIDIA: Nemotron Nano 9B V2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.04,output:.16,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"nvidia/nemotron-nano-9b-v2:free":{id:"nvidia/nemotron-nano-9b-v2:free",name:"NVIDIA: Nemotron Nano 9B V2 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-3.5-turbo":{id:"openai/gpt-3.5-turbo",name:"OpenAI: GPT-3.5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-3.5-turbo-0613":{id:"openai/gpt-3.5-turbo-0613",name:"OpenAI: GPT-3.5 Turbo (older v0613)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:2,cacheRead:0,cacheWrite:0},contextWindow:4095,maxTokens:4096},"openai/gpt-3.5-turbo-16k":{id:"openai/gpt-3.5-turbo-16k",name:"OpenAI: GPT-3.5 Turbo 16k",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:3,output:4,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-4":{id:"openai/gpt-4",name:"OpenAI: GPT-4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8191,maxTokens:4096},"openai/gpt-4-0314":{id:"openai/gpt-4-0314",name:"OpenAI: GPT-4 (older v0314)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8191,maxTokens:4096},"openai/gpt-4-1106-preview":{id:"openai/gpt-4-1106-preview",name:"OpenAI: GPT-4 Turbo (older v1106)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"OpenAI: GPT-4 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4-turbo-preview":{id:"openai/gpt-4-turbo-preview",name:"OpenAI: GPT-4 Turbo Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"OpenAI: GPT-4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"OpenAI: GPT-4.1 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:1.5999999999999999,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"OpenAI: GPT-4.1 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"OpenAI: GPT-4o",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-05-13":{id:"openai/gpt-4o-2024-05-13",name:"OpenAI: GPT-4o (2024-05-13)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4o-2024-08-06":{id:"openai/gpt-4o-2024-08-06",name:"OpenAI: GPT-4o (2024-08-06)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-11-20":{id:"openai/gpt-4o-2024-11-20",name:"OpenAI: GPT-4o (2024-11-20)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-audio-preview":{id:"openai/gpt-4o-audio-preview",name:"OpenAI: GPT-4o Audio",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"OpenAI: GPT-4o-mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini-2024-07-18":{id:"openai/gpt-4o-mini-2024-07-18",name:"OpenAI: GPT-4o-mini (2024-07-18)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o:extended":{id:"openai/gpt-4o:extended",name:"OpenAI: GPT-4o (extended)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:6,output:18,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"openai/gpt-5":{id:"openai/gpt-5",name:"OpenAI: GPT-5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"OpenAI: GPT-5 Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-image":{id:"openai/gpt-5-image",name:"OpenAI: GPT-5 Image",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-image-mini":{id:"openai/gpt-5-image-mini",name:"OpenAI: GPT-5 Image Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2.5,output:2,cacheRead:.25,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"OpenAI: GPT-5 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"OpenAI: GPT-5 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"OpenAI: GPT-5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1":{id:"openai/gpt-5.1",name:"OpenAI: GPT-5.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-chat":{id:"openai/gpt-5.1-chat",name:"OpenAI: GPT-5.1 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"OpenAI: GPT-5.1-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"OpenAI: GPT-5.1-Codex-Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"OpenAI: GPT-5.1-Codex-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:1e5},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"OpenAI: GPT-5.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"OpenAI: GPT-5.2 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"OpenAI: GPT-5.2-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"OpenAI: GPT-5.2 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"OpenAI: GPT-5.3 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"OpenAI: GPT-5.3-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"OpenAI: GPT-5.4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"OpenAI: GPT-5.4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"OpenAI: GPT-5.4 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"OpenAI: GPT-5.4 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"OpenAI: gpt-oss-120b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.039,output:.19,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"openai/gpt-oss-120b:free":{id:"openai/gpt-oss-120b:free",name:"OpenAI: gpt-oss-120b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"OpenAI: gpt-oss-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.03,output:.11,cacheRead:.015,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b:free":{id:"openai/gpt-oss-20b:free",name:"OpenAI: gpt-oss-20b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"OpenAI: gpt-oss-safeguard-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"OpenAI: o1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"OpenAI: o3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"OpenAI: o3 Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"OpenAI: o3 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini-high":{id:"openai/o3-mini-high",name:"OpenAI: o3 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"OpenAI: o3 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"OpenAI: o4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-deep-research":{id:"openai/o4-mini-deep-research",name:"OpenAI: o4 Mini Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-high":{id:"openai/o4-mini-high",name:"OpenAI: o4 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openrouter/auto":{id:"openrouter/auto",name:"Auto Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:-1e6,output:-1e6,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"openrouter/free":{id:"openrouter/free",name:"Free Models Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:4096},"prime-intellect/intellect-3":{id:"prime-intellect/intellect-3",name:"Prime Intellect: INTELLECT-3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen-2.5-72b-instruct":{id:"qwen/qwen-2.5-72b-instruct",name:"Qwen2.5 72B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.12,output:.39,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:16384},"qwen/qwen-2.5-7b-instruct":{id:"qwen/qwen-2.5-7b-instruct",name:"Qwen: Qwen2.5 7B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.04,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:4096},"qwen/qwen-max":{id:"qwen/qwen-max",name:"Qwen: Qwen-Max ",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1.04,output:4.16,cacheRead:.20800000000000002,cacheWrite:0},contextWindow:32768,maxTokens:8192},"qwen/qwen-plus":{id:"qwen/qwen-plus",name:"Qwen: Qwen-Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:.052000000000000005,cacheWrite:0},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28":{id:"qwen/qwen-plus-2025-07-28",name:"Qwen: Qwen Plus 0728",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28:thinking":{id:"qwen/qwen-plus-2025-07-28:thinking",name:"Qwen: Qwen Plus 0728 (thinking)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:32768},"qwen/qwen-turbo":{id:"qwen/qwen-turbo",name:"Qwen: Qwen-Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.0325,output:.13,cacheRead:.006500000000000001,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen-vl-max":{id:"qwen/qwen-vl-max",name:"Qwen: Qwen VL Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.52,output:2.08,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-14b":{id:"qwen/qwen3-14b",name:"Qwen: Qwen3 14B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:40960},"qwen/qwen3-235b-a22b":{id:"qwen/qwen3-235b-a22b",name:"Qwen: Qwen3 235B A22B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.45499999999999996,output:1.8199999999999998,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen3-235b-a22b-2507":{id:"qwen/qwen3-235b-a22b-2507",name:"Qwen: Qwen3 235B A22B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.071,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-235b-a22b-thinking-2507":{id:"qwen/qwen3-235b-a22b-thinking-2507",name:"Qwen: Qwen3 235B A22B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.14950000000000002,output:1.495,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"qwen/qwen3-30b-a3b":{id:"qwen/qwen3-30b-a3b",name:"Qwen: Qwen3 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.28,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:40960},"qwen/qwen3-30b-a3b-instruct-2507":{id:"qwen/qwen3-30b-a3b-instruct-2507",name:"Qwen: Qwen3 30B A3B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3-30b-a3b-thinking-2507":{id:"qwen/qwen3-30b-a3b-thinking-2507",name:"Qwen: Qwen3 30B A3B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.39999999999999997,cacheRead:.08,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen: Qwen3 32B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.24,cacheRead:.04,cacheWrite:0},contextWindow:40960,maxTokens:40960},"qwen/qwen3-4b:free":{id:"qwen/qwen3-4b:free",name:"Qwen: Qwen3 4B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:4096},"qwen/qwen3-8b":{id:"qwen/qwen3-8b",name:"Qwen: Qwen3 8B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:40960,maxTokens:8192},"qwen/qwen3-coder":{id:"qwen/qwen3-coder",name:"Qwen: Qwen3 Coder 480B A35B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.22,output:1,cacheRead:.022,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-coder-30b-a3b-instruct":{id:"qwen/qwen3-coder-30b-a3b-instruct",name:"Qwen: Qwen3 Coder 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.07,output:.27,cacheRead:0,cacheWrite:0},contextWindow:16e4,maxTokens:32768},"qwen/qwen3-coder-flash":{id:"qwen/qwen3-coder-flash",name:"Qwen: Qwen3 Coder Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.195,output:.975,cacheRead:.039,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder-next":{id:"qwen/qwen3-coder-next",name:"Qwen: Qwen3 Coder Next",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.12,output:.75,cacheRead:.06,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3-coder-plus":{id:"qwen/qwen3-coder-plus",name:"Qwen: Qwen3 Coder Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.65,output:3.25,cacheRead:.13,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder:free":{id:"qwen/qwen3-coder:free",name:"Qwen: Qwen3 Coder 480B A35B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"qwen/qwen3-max":{id:"qwen/qwen3-max",name:"Qwen: Qwen3 Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.78,output:3.9,cacheRead:.156,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-max-thinking":{id:"qwen/qwen3-max-thinking",name:"Qwen: Qwen3 Max Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.78,output:3.9,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-next-80b-a3b-instruct":{id:"qwen/qwen3-next-80b-a3b-instruct",name:"Qwen: Qwen3 Next 80B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-next-80b-a3b-instruct:free":{id:"qwen/qwen3-next-80b-a3b-instruct:free",name:"Qwen: Qwen3 Next 80B A3B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-next-80b-a3b-thinking":{id:"qwen/qwen3-next-80b-a3b-thinking",name:"Qwen: Qwen3 Next 80B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.0975,output:.78,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-235b-a22b-instruct":{id:"qwen/qwen3-vl-235b-a22b-instruct",name:"Qwen: Qwen3 VL 235B A22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.19999999999999998,output:.88,cacheRead:.11,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-vl-235b-a22b-thinking":{id:"qwen/qwen3-vl-235b-a22b-thinking",name:"Qwen: Qwen3 VL 235B A22B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-instruct":{id:"qwen/qwen3-vl-30b-a3b-instruct",name:"Qwen: Qwen3 VL 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.13,output:.52,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-thinking":{id:"qwen/qwen3-vl-30b-a3b-thinking",name:"Qwen: Qwen3 VL 30B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.13,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-32b-instruct":{id:"qwen/qwen3-vl-32b-instruct",name:"Qwen: Qwen3 VL 32B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.10400000000000001,output:.41600000000000004,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-8b-instruct":{id:"qwen/qwen3-vl-8b-instruct",name:"Qwen: Qwen3 VL 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.5,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-8b-thinking":{id:"qwen/qwen3-vl-8b-thinking",name:"Qwen: Qwen3 VL 8B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.117,output:1.365,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3.5-122b-a10b":{id:"qwen/qwen3.5-122b-a10b",name:"Qwen: Qwen3.5-122B-A10B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.08,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-27b":{id:"qwen/qwen3.5-27b",name:"Qwen: Qwen3.5-27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.195,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-35b-a3b":{id:"qwen/qwen3.5-35b-a3b",name:"Qwen: Qwen3.5-35B-A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1625,output:1.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-397b-a17b":{id:"qwen/qwen3.5-397b-a17b",name:"Qwen: Qwen3.5 397B A17B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.39,output:2.34,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-9b":{id:"qwen/qwen3.5-9b",name:"Qwen: Qwen3.5-9B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.049999999999999996,output:.15,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"qwen/qwen3.5-flash-02-23":{id:"qwen/qwen3.5-flash-02-23",name:"Qwen: Qwen3.5-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.065,output:.26,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.5-plus-02-15":{id:"qwen/qwen3.5-plus-02-15",name:"Qwen: Qwen3.5 Plus 2026-02-15",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwq-32b":{id:"qwen/qwq-32b",name:"Qwen: QwQ 32B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.58,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"relace/relace-search":{id:"relace/relace-search",name:"Relace: Relace Search",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:128e3},"sao10k/l3-euryale-70b":{id:"sao10k/l3-euryale-70b",name:"Sao10k: Llama 3 Euryale 70B v2.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1.48,output:1.48,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"sao10k/l3.1-euryale-70b":{id:"sao10k/l3.1-euryale-70b",name:"Sao10K: Llama 3.1 Euryale 70B v2.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.85,output:.85,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"stepfun/step-3.5-flash":{id:"stepfun/step-3.5-flash",name:"StepFun: Step 3.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"stepfun/step-3.5-flash:free":{id:"stepfun/step-3.5-flash:free",name:"StepFun: Step 3.5 Flash (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"thedrummer/rocinante-12b":{id:"thedrummer/rocinante-12b",name:"TheDrummer: Rocinante 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.16999999999999998,output:.43,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"thedrummer/unslopnemo-12b":{id:"thedrummer/unslopnemo-12b",name:"TheDrummer: UnslopNemo 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"tngtech/deepseek-r1t2-chimera":{id:"tngtech/deepseek-r1t2-chimera",name:"TNG: DeepSeek R1T2 Chimera",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.1,cacheRead:.15,cacheWrite:0},contextWindow:163840,maxTokens:163840},"upstage/solar-pro-3":{id:"upstage/solar-pro-3",name:"Upstage: Solar Pro 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"x-ai/grok-3":{id:"x-ai/grok-3",name:"xAI: Grok 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:4096},"x-ai/grok-3-beta":{id:"x-ai/grok-3-beta",name:"xAI: Grok 3 Beta",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:4096},"x-ai/grok-3-mini":{id:"x-ai/grok-3-mini",name:"xAI: Grok 3 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:4096},"x-ai/grok-3-mini-beta":{id:"x-ai/grok-3-mini-beta",name:"xAI: Grok 3 Mini Beta",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:4096},"x-ai/grok-4":{id:"x-ai/grok-4",name:"xAI: Grok 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"x-ai/grok-4-fast":{id:"x-ai/grok-4-fast",name:"xAI: Grok 4 Fast",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"x-ai/grok-4.1-fast":{id:"x-ai/grok-4.1-fast",name:"xAI: Grok 4.1 Fast",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"x-ai/grok-4.20-beta":{id:"x-ai/grok-4.20-beta",name:"xAI: Grok 4.20 Beta",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"x-ai/grok-code-fast-1":{id:"x-ai/grok-code-fast-1",name:"xAI: Grok Code Fast 1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.5,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:1e4},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"Xiaomi: MiMo-V2-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.29,cacheRead:.045,cacheWrite:0},contextWindow:262144,maxTokens:65536},"xiaomi/mimo-v2-omni":{id:"xiaomi/mimo-v2-omni",name:"Xiaomi: MiMo-V2-Omni",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"xiaomi/mimo-v2-pro":{id:"xiaomi/mimo-v2-pro",name:"Xiaomi: MiMo-V2-Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"z-ai/glm-4-32b":{id:"z-ai/glm-4-32b",name:"Z.ai: GLM 4 32B ",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"z-ai/glm-4.5":{id:"z-ai/glm-4.5",name:"Z.ai: GLM 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:131072,maxTokens:98304},"z-ai/glm-4.5-air":{id:"z-ai/glm-4.5-air",name:"Z.ai: GLM 4.5 Air",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.13,output:.85,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:98304},"z-ai/glm-4.5-air:free":{id:"z-ai/glm-4.5-air:free",name:"Z.ai: GLM 4.5 Air (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:96e3},"z-ai/glm-4.5v":{id:"z-ai/glm-4.5v",name:"Z.ai: GLM 4.5V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:1.7999999999999998,cacheRead:.11,cacheWrite:0},contextWindow:65536,maxTokens:16384},"z-ai/glm-4.6":{id:"z-ai/glm-4.6",name:"Z.ai: GLM 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.39,output:1.9,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:204800},"z-ai/glm-4.6v":{id:"z-ai/glm-4.6v",name:"Z.ai: GLM 4.6V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:.8999999999999999,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"z-ai/glm-4.7":{id:"z-ai/glm-4.7",name:"Z.ai: GLM 4.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.39,output:1.75,cacheRead:.195,cacheWrite:0},contextWindow:202752,maxTokens:65535},"z-ai/glm-4.7-flash":{id:"z-ai/glm-4.7-flash",name:"Z.ai: GLM 4.7 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.06,output:.39999999999999997,cacheRead:.0100000002,cacheWrite:0},contextWindow:202752,maxTokens:4096},"z-ai/glm-5":{id:"z-ai/glm-5",name:"Z.ai: GLM 5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:1.9,cacheRead:.119,cacheWrite:0},contextWindow:8e4,maxTokens:131072},"z-ai/glm-5-turbo":{id:"z-ai/glm-5-turbo",name:"Z.ai: GLM 5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.96,output:3.1999999999999997,cacheRead:.192,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"vercel-ai-gateway":{"alibaba/qwen-3-14b":{id:"alibaba/qwen-3-14b",name:"Qwen3-14B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.12,output:.24,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-235b":{id:"alibaba/qwen-3-235b",name:"Qwen3-235B-A22B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.071,output:.463,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-30b":{id:"alibaba/qwen-3-30b",name:"Qwen3-30B-A3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.08,output:.29,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-32b":{id:"alibaba/qwen-3-32b",name:"Qwen 3 32B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.29,output:.59,cacheRead:.145,cacheWrite:0},contextWindow:131072,maxTokens:40960},"alibaba/qwen3-235b-a22b-thinking":{id:"alibaba/qwen3-235b-a22b-thinking",name:"Qwen3 235B A22B Thinking 2507",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.22999999999999998,output:2.3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:262114,maxTokens:262114},"alibaba/qwen3-coder":{id:"alibaba/qwen3-coder",name:"Qwen3 Coder 480B A35B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:1.5999999999999999,cacheRead:.022,cacheWrite:0},contextWindow:262144,maxTokens:66536},"alibaba/qwen3-coder-30b-a3b":{id:"alibaba/qwen3-coder-30b-a3b",name:"Qwen 3 Coder 30B A3B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:8192},"alibaba/qwen3-coder-next":{id:"alibaba/qwen3-coder-next",name:"Qwen3 Coder Next",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.5,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3-coder-plus":{id:"alibaba/qwen3-coder-plus",name:"Qwen3 Coder Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1,output:5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"alibaba/qwen3-max":{id:"alibaba/qwen3-max",name:"Qwen3 Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-preview":{id:"alibaba/qwen3-max-preview",name:"Qwen3 Max Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-thinking":{id:"alibaba/qwen3-max-thinking",name:"Qwen 3 Max Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"alibaba/qwen3-vl-thinking":{id:"alibaba/qwen3-vl-thinking",name:"Qwen3 VL 235B A22B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3.5-flash":{id:"alibaba/qwen3.5-flash",name:"Qwen 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.001,cacheWrite:.125},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.5-plus":{id:"alibaba/qwen3.5-plus",name:"Qwen 3.5 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2.4,cacheRead:.04,cacheWrite:.5},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Claude 3 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Claude 3.5 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-3.5-sonnet":{id:"anthropic/claude-3.5-sonnet",name:"Claude 3.5 Sonnet",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic/claude-3.5-sonnet-20240620":{id:"anthropic/claude-3.5-sonnet-20240620",name:"Claude 3.5 Sonnet (2024-06-20)",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic/claude-3.7-sonnet":{id:"anthropic/claude-3.7-sonnet",name:"Claude 3.7 Sonnet",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.09999999999999999,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Claude Opus 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-preview":{id:"arcee-ai/trinity-large-preview",name:"Trinity Large Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:131e3},"bytedance/seed-1.6":{id:"bytedance/seed-1.6",name:"Seed 1.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:2,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:256e3,maxTokens:32e3},"cohere/command-a":{id:"cohere/command-a",name:"Command A",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8e3},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek-R1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"deepseek/deepseek-v3":{id:"deepseek/deepseek-v3",name:"DeepSeek V3 0324",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.77,output:.77,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-v3.1":{id:"deepseek/deepseek-v3.1",name:"DeepSeek-V3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek V3.1 Terminus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.27,output:1,cacheRead:.135,cacheWrite:0},contextWindow:131072,maxTokens:65536},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek V3.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.28,output:.42,cacheRead:.028,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"deepseek/deepseek-v3.2-thinking":{id:"deepseek/deepseek-v3.2-thinking",name:"DeepSeek V3.2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.28,output:.42,cacheRead:.028,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"google/gemini-2.0-flash":{id:"google/gemini-2.0-flash",name:"Gemini 2.0 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.0-flash-lite":{id:"google/gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.02,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-3-flash":{id:"google/gemini-3-flash",name:"Gemini 3 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3-pro-preview":{id:"google/gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"inception/mercury-2":{id:"inception/mercury-2",name:"Mercury 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"inception/mercury-coder-small":{id:"inception/mercury-coder-small",name:"Mercury Coder Small Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:16384},"meituan/longcat-flash-chat":{id:"meituan/longcat-flash-chat",name:"LongCat Flash Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:1e5},"meituan/longcat-flash-thinking":{id:"meituan/longcat-flash-thinking",name:"LongCat Flash Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.1-70b":{id:"meta/llama-3.1-70b",name:"Llama 3.1 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.1-8b":{id:"meta/llama-3.1-8b",name:"Llama 3.1 8B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"meta/llama-3.2-11b":{id:"meta/llama-3.2-11b",name:"Llama 3.2 11B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.16,output:.16,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.2-90b":{id:"meta/llama-3.2-90b",name:"Llama 3.2 90B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.3-70b":{id:"meta/llama-3.3-70b",name:"Llama 3.3 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-maverick":{id:"meta/llama-4-maverick",name:"Llama 4 Maverick 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.24,output:.9700000000000001,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-scout":{id:"meta/llama-4-scout",name:"Llama 4 Scout 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.16999999999999998,output:.66,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax M2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:205e3,maxTokens:205e3},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax M2.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.1-lightning":{id:"minimax/minimax-m2.1-lightning",name:"MiniMax M2.1 Lightning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax M2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.5-highspeed":{id:"minimax/minimax-m2.5-highspeed",name:"MiniMax M2.5 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"Minimax M2.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7-highspeed":{id:"minimax/minimax-m2.7-highspeed",name:"MiniMax M2.7 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131100},"mistral/codestral":{id:"mistral/codestral",name:"Mistral Codestral",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.3,output:.8999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/devstral-2":{id:"mistral/devstral-2",name:"Devstral 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/devstral-small":{id:"mistral/devstral-small",name:"Devstral Small 1.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/devstral-small-2":{id:"mistral/devstral-small-2",name:"Devstral Small 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/ministral-3b":{id:"mistral/ministral-3b",name:"Ministral 3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/ministral-8b":{id:"mistral/ministral-8b",name:"Ministral 8B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/mistral-medium":{id:"mistral/mistral-medium",name:"Mistral Medium 3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/mistral-small":{id:"mistral/mistral-small",name:"Mistral Small",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:4e3},"mistral/pixtral-12b":{id:"mistral/pixtral-12b",name:"Pixtral 12B 2409",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/pixtral-large":{id:"mistral/pixtral-large",name:"Pixtral Large",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"Kimi K2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/kimi-k2-0905":{id:"moonshotai/kimi-k2-0905",name:"Kimi K2 0905",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2-thinking-turbo":{id:"moonshotai/kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2-turbo":{id:"moonshotai/kimi-k2-turbo",name:"Kimi K2 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:262114,maxTokens:262114},"nvidia/nemotron-nano-12b-v2-vl":{id:"nvidia/nemotron-nano-12b-v2-vl",name:"Nvidia Nemotron Nano 12B V2 VL",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"nvidia/nemotron-nano-9b-v2":{id:"nvidia/nemotron-nano-9b-v2",name:"Nvidia Nemotron Nano 9B V2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.22999999999999998,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"GPT-4 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"GPT-4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"GPT-4.1 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:1.5999999999999999,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"GPT-4.1 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"GPT-4o",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"GPT-4o mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5":{id:"openai/gpt-5",name:"GPT-5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-chat":{id:"openai/gpt-5-chat",name:"GPT 5 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"GPT-5-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"GPT-5 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"GPT-5 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"GPT-5 pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"GPT-5.1-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"GPT 5.1 Codex Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"GPT 5.1 Codex Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-instant":{id:"openai/gpt-5.1-instant",name:"GPT-5.1 Instant",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.1-thinking":{id:"openai/gpt-5.1-thinking",name:"GPT 5.1 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"GPT 5.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"GPT 5.2 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"GPT 5.2 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"GPT 5.2 ",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"GPT-5.3 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"GPT 5.3 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"GPT 5.4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"GPT 5.4 Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"GPT 5.4 Nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"GPT 5.4 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"gpt-oss-20b",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.07,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"gpt-oss-safeguard-20b",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"o1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"o3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"o3-deep-research",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"o3-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"o3 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"o4-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"perplexity/sonar":{id:"perplexity/sonar",name:"Sonar",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:1,output:1,cacheRead:0,cacheWrite:0},contextWindow:127e3,maxTokens:8e3},"perplexity/sonar-pro":{id:"perplexity/sonar-pro",name:"Sonar Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:8e3},"prime-intellect/intellect-3":{id:"prime-intellect/intellect-3",name:"INTELLECT 3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"xai/grok-2-vision":{id:"xai/grok-2-vision",name:"Grok 2 Vision",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"xai/grok-3":{id:"xai/grok-3",name:"Grok 3 Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:131072},"xai/grok-3-fast":{id:"xai/grok-3-fast",name:"Grok 3 Fast Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:5,output:25,cacheRead:1.25,cacheWrite:0},contextWindow:131072,maxTokens:131072},"xai/grok-3-mini":{id:"xai/grok-3-mini",name:"Grok 3 Mini Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:131072},"xai/grok-3-mini-fast":{id:"xai/grok-3-mini-fast",name:"Grok 3 Mini Fast Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.6,output:4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"xai/grok-4":{id:"xai/grok-4",name:"Grok 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"xai/grok-4-fast-non-reasoning":{id:"xai/grok-4-fast-non-reasoning",name:"Grok 4 Fast Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:256e3},"xai/grok-4-fast-reasoning":{id:"xai/grok-4-fast-reasoning",name:"Grok 4 Fast Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:256e3},"xai/grok-4.1-fast-non-reasoning":{id:"xai/grok-4.1-fast-non-reasoning",name:"Grok 4.1 Fast Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"xai/grok-4.1-fast-reasoning":{id:"xai/grok-4.1-fast-reasoning",name:"Grok 4.1 Fast Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"xai/grok-4.20-multi-agent-beta":{id:"xai/grok-4.20-multi-agent-beta",name:"Grok 4.20 Multi Agent Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-non-reasoning-beta":{id:"xai/grok-4.20-non-reasoning-beta",name:"Grok 4.20 Beta Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-reasoning-beta":{id:"xai/grok-4.20-reasoning-beta",name:"Grok 4.20 Beta Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-code-fast-1":{id:"xai/grok-code-fast-1",name:"Grok Code Fast 1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.5,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"MiMo V2 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.02,cacheWrite:0},contextWindow:262144,maxTokens:32e3},"xiaomi/mimo-v2-pro":{id:"xiaomi/mimo-v2-pro",name:"MiMo V2 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"zai/glm-4.5":{id:"zai/glm-4.5",name:"GLM-4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5-air":{id:"zai/glm-4.5-air",name:"GLM 4.5 Air",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.1,cacheRead:.03,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5v":{id:"zai/glm-4.5v",name:"GLM 4.5V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.6,output:1.7999999999999998,cacheRead:.11,cacheWrite:0},contextWindow:66e3,maxTokens:16e3},"zai/glm-4.6":{id:"zai/glm-4.6",name:"GLM 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:2e5,maxTokens:96e3},"zai/glm-4.6v":{id:"zai/glm-4.6v",name:"GLM-4.6V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:.8999999999999999,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.6v-flash":{id:"zai/glm-4.6v-flash",name:"GLM-4.6V-Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.7":{id:"zai/glm-4.7",name:"GLM 4.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:12e4},"zai/glm-4.7-flash":{id:"zai/glm-4.7-flash",name:"GLM 4.7 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.07,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131e3},"zai/glm-4.7-flashx":{id:"zai/glm-4.7-flashx",name:"GLM 4.7 FlashX",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai/glm-5":{id:"zai/glm-5",name:"GLM 5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3.1999999999999997,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:202800,maxTokens:131100},"zai/glm-5-turbo":{id:"zai/glm-5-turbo",name:"GLM 5 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:202800,maxTokens:131100}},xai:{"grok-2":{id:"grok-2",name:"Grok 2",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-1212":{id:"grok-2-1212",name:"Grok 2 (1212)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-latest":{id:"grok-2-latest",name:"Grok 2 Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-vision":{id:"grok-2-vision",name:"Grok 2 Vision",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-2-vision-1212":{id:"grok-2-vision-1212",name:"Grok 2 Vision (1212)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-2-vision-latest":{id:"grok-2-vision-latest",name:"Grok 2 Vision Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-3":{id:"grok-3",name:"Grok 3",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-fast":{id:"grok-3-fast",name:"Grok 3 Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:25,cacheRead:1.25,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-fast-latest":{id:"grok-3-fast-latest",name:"Grok 3 Fast Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:25,cacheRead:1.25,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-latest":{id:"grok-3-latest",name:"Grok 3 Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-mini":{id:"grok-3-mini",name:"Grok 3 Mini",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-mini-fast":{id:"grok-3-mini-fast",name:"Grok 3 Mini Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:.6,output:4,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-mini-fast-latest":{id:"grok-3-mini-fast-latest",name:"Grok 3 Mini Fast Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:.6,output:4,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-mini-latest":{id:"grok-3-mini-latest",name:"Grok 3 Mini Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-4":{id:"grok-4",name:"Grok 4",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:256e3,maxTokens:64e3},"grok-4-1-fast":{id:"grok-4-1-fast",name:"Grok 4.1 Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4-1-fast-non-reasoning":{id:"grok-4-1-fast-non-reasoning",name:"Grok 4.1 Fast (Non-Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4-fast":{id:"grok-4-fast",name:"Grok 4 Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4-fast-non-reasoning":{id:"grok-4-fast-non-reasoning",name:"Grok 4 Fast (Non-Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4.20-0309-non-reasoning":{id:"grok-4.20-0309-non-reasoning",name:"Grok 4.20 (Non-Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4.20-0309-reasoning":{id:"grok-4.20-0309-reasoning",name:"Grok 4.20 (Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-beta":{id:"grok-beta",name:"Grok Beta",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:15,cacheRead:5,cacheWrite:0},contextWindow:131072,maxTokens:4096},"grok-code-fast-1":{id:"grok-code-fast-1",name:"Grok Code Fast 1",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:.2,output:1.5,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:1e4},"grok-vision-beta":{id:"grok-vision-beta",name:"Grok Vision Beta",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:5,cacheWrite:0},contextWindow:8192,maxTokens:4096}},zai:{"glm-4.5":{id:"glm-4.5",name:"GLM-4.5",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.5-air":{id:"glm-4.5-air",name:"GLM-4.5-Air",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:.2,output:1.1,cacheRead:.03,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.5-flash":{id:"glm-4.5-flash",name:"GLM-4.5-Flash",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.5v":{id:"glm-4.5v",name:"GLM-4.5V",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text","image"],cost:{input:.6,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:64e3,maxTokens:16384},"glm-4.6":{id:"glm-4.6",name:"GLM-4.6",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-4.6v":{id:"glm-4.6v",name:"GLM-4.6V",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text","image"],cost:{input:.3,output:.9,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"glm-4.7":{id:"glm-4.7",name:"GLM-4.7",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-4.7-flash":{id:"glm-4.7-flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5-turbo":{id:"glm-5-turbo",name:"GLM-5-Turbo",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:2e5,maxTokens:131072}}},sf=new Map;for(const[t,e]of Object.entries(WD)){const n=new Map;for(const[r,i]of Object.entries(e))n.set(r,i);sf.set(t,n)}function IE(t,e){return sf.get(t)?.get(e)}function Zv(){return Array.from(sf.keys())}function o0(t){const e=sf.get(t);return e?Array.from(e.values()):[]}function BD(t,e){return e.cost.input=t.cost.input/1e6*e.input,e.cost.output=t.cost.output/1e6*e.output,e.cost.cacheRead=t.cost.cacheRead/1e6*e.cacheRead,e.cost.cacheWrite=t.cost.cacheWrite/1e6*e.cacheWrite,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite,e.cost}function bue(t){return!!(t.id.includes("gpt-5.2")||t.id.includes("gpt-5.3")||t.id.includes("gpt-5.4")||t.id.includes("opus-4-6")||t.id.includes("opus-4.6"))}class zD{isComplete;extractResult;queue=[];waiting=[];done=!1;finalResultPromise;resolveFinalResult;constructor(e,n){this.isComplete=e,this.extractResult=n,this.finalResultPromise=new Promise(r=>{this.resolveFinalResult=r})}push(e){if(this.done)return;this.isComplete(e)&&(this.done=!0,this.resolveFinalResult(this.extractResult(e)));const n=this.waiting.shift();n?n({value:e,done:!1}):this.queue.push(e)}end(e){for(this.done=!0,e!==void 0&&this.resolveFinalResult(e);this.waiting.length>0;)this.waiting.shift()({value:void 0,done:!0})}async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.shift();else{if(this.done)return;{const e=await new Promise(n=>this.waiting.push(n));if(e.done)return;yield e.value}}}result(){return this.finalResultPromise}}class Kv extends zD{constructor(){super(e=>e.type==="done"||e.type==="error",e=>{if(e.type==="done")return e.message;if(e.type==="error")return e.error;throw new Error("Unexpected event type for final result")})}}function Jv(){return new Kv}const qD=t=>import(t);let ex,tx,nx,rx,ix,ax,sx,ox,lx,cx;function RE(t,e){(async()=>{for await(const n of e)t.push(n);t.end()})()}function $E(t,e){return{role:"assistant",content:[],api:t.api,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:e instanceof Error?e.message:String(e),timestamp:Date.now()}}function Pa(t){return(e,n,r)=>{const i=new Kv;return t().then(a=>{const s=a.stream(e,n,r);RE(i,s)}).catch(a=>{const s=$E(e,a);i.push({type:"error",reason:"error",error:s}),i.end(s)}),i}}function Oa(t){return(e,n,r)=>{const i=new Kv;return t().then(a=>{const s=a.streamSimple(e,n,r);RE(i,s)}).catch(a=>{const s=$E(e,a);i.push({type:"error",reason:"error",error:s}),i.end(s)}),i}}function NE(){return ex||=Vt(()=>import("./anthropic-CfFsAbhs.js"),__vite__mapDeps([0,1,2,3])).then(t=>{const e=t;return{stream:e.streamAnthropic,streamSimple:e.streamSimpleAnthropic}}),ex}function PE(){return tx||=Vt(()=>import("./azure-openai-responses-DX9SzdYk.js"),__vite__mapDeps([4,5,6,7,1,2])).then(t=>{const e=t;return{stream:e.streamAzureOpenAIResponses,streamSimple:e.streamSimpleAzureOpenAIResponses}}),tx}function OE(){return nx||=Vt(()=>import("./google-Dgcj8p2Y.js"),__vite__mapDeps([8,9,2])).then(t=>{const e=t;return{stream:e.streamGoogle,streamSimple:e.streamSimpleGoogle}}),nx}function ME(){return rx||=Vt(()=>import("./google-gemini-cli-3EajcUec.js"),__vite__mapDeps([10,2,9])).then(t=>{const e=t;return{stream:e.streamGoogleGeminiCli,streamSimple:e.streamSimpleGoogleGeminiCli}}),rx}function LE(){return ix||=Vt(()=>import("./google-vertex-CWmtNuIQ.js"),__vite__mapDeps([11,9,2])).then(t=>{const e=t;return{stream:e.streamGoogleVertex,streamSimple:e.streamSimpleGoogleVertex}}),ix}function DE(){return ax||=Vt(()=>import("./mistral-B5PVshqk.js"),__vite__mapDeps([12,7,1,2])).then(t=>{const e=t;return{stream:e.streamMistral,streamSimple:e.streamSimpleMistral}}),ax}function FE(){return sx||=Vt(()=>import("./openai-codex-responses-q2oyEW2I.js"),__vite__mapDeps([13,6,7,1,2])).then(t=>{const e=t;return{stream:e.streamOpenAICodexResponses,streamSimple:e.streamSimpleOpenAICodexResponses}}),sx}function UE(){return ox||=Vt(()=>import("./openai-completions-DwmKL5b1.js"),__vite__mapDeps([14,5,1,2,3])).then(t=>{const e=t;return{stream:e.streamOpenAICompletions,streamSimple:e.streamSimpleOpenAICompletions}}),ox}function WE(){return lx||=Vt(()=>import("./openai-responses-I0hZgQNc.js"),__vite__mapDeps([15,5,3,6,7,1,2])).then(t=>{const e=t;return{stream:e.streamOpenAIResponses,streamSimple:e.streamSimpleOpenAIResponses}}),lx}function BE(){return cx||=qD("./amazon-bedrock.js").then(t=>{const e=t;return{stream:e.streamBedrock,streamSimple:e.streamSimpleBedrock}}),cx}const zE=Pa(NE),qE=Oa(NE),jD=Pa(PE),GD=Oa(PE),HD=Pa(OE),VD=Oa(OE),ZD=Pa(ME),KD=Oa(ME),JD=Pa(LE),QD=Oa(LE),YD=Pa(DE),XD=Oa(DE),eF=Pa(FE),tF=Oa(FE),jE=Pa(UE),GE=Oa(UE),nF=Pa(WE),rF=Oa(WE),iF=Pa(BE),aF=Oa(BE);function sF(){Ei({api:"anthropic-messages",stream:zE,streamSimple:qE}),Ei({api:"openai-completions",stream:jE,streamSimple:GE}),Ei({api:"mistral-conversations",stream:YD,streamSimple:XD}),Ei({api:"openai-responses",stream:nF,streamSimple:rF}),Ei({api:"azure-openai-responses",stream:jD,streamSimple:GD}),Ei({api:"openai-codex-responses",stream:eF,streamSimple:tF}),Ei({api:"google-generative-ai",stream:HD,streamSimple:VD}),Ei({api:"google-gemini-cli",stream:ZD,streamSimple:KD}),Ei({api:"google-vertex",stream:JD,streamSimple:QD}),Ei({api:"bedrock-converse-stream",stream:iF,streamSimple:aF})}sF();function oF(t){const e=MD(t);if(!e)throw new Error(`No API provider registered for api: ${t}`);return e}function Qv(t,e,n){return oF(t.api).streamSimple(t,e,n)}async function lF(t,e,n){return Qv(t,e,n).result()}function Yv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function cF(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Js={},kh={},ux;function dx(){return ux||(ux=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Allow=t.ALL=t.COLLECTION=t.ATOM=t.SPECIAL=t.INF=t._INFINITY=t.INFINITY=t.NAN=t.BOOL=t.NULL=t.OBJ=t.ARR=t.NUM=t.STR=void 0,t.STR=1,t.NUM=2,t.ARR=4,t.OBJ=8,t.NULL=16,t.BOOL=32,t.NAN=64,t.INFINITY=128,t._INFINITY=256,t.INF=t.INFINITY|t._INFINITY,t.SPECIAL=t.NULL|t.BOOL|t.INF|t.NAN,t.ATOM=t.STR|t.NUM|t.SPECIAL,t.COLLECTION=t.ARR|t.OBJ,t.ALL=t.ATOM|t.COLLECTION,t.Allow={STR:t.STR,NUM:t.NUM,ARR:t.ARR,OBJ:t.OBJ,NULL:t.NULL,BOOL:t.BOOL,NAN:t.NAN,INFINITY:t.INFINITY,_INFINITY:t._INFINITY,INF:t.INF,SPECIAL:t.SPECIAL,ATOM:t.ATOM,COLLECTION:t.COLLECTION,ALL:t.ALL},t.default=t.Allow})(kh)),kh}var px;function uF(){return px||(px=1,(function(t){var e=Js&&Js.__createBinding||(Object.create?(function(c,u,d,p){p===void 0&&(p=d);var f=Object.getOwnPropertyDescriptor(u,d);(!f||("get"in f?!u.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return u[d]}}),Object.defineProperty(c,p,f)}):(function(c,u,d,p){p===void 0&&(p=d),c[p]=u[d]})),n=Js&&Js.__exportStar||function(c,u){for(var d in c)d!=="default"&&!Object.prototype.hasOwnProperty.call(u,d)&&e(u,c,d)};Object.defineProperty(t,"__esModule",{value:!0}),t.Allow=t.MalformedJSON=t.PartialJSON=t.parseJSON=t.parse=void 0;const r=dx();Object.defineProperty(t,"Allow",{enumerable:!0,get:function(){return r.Allow}}),n(dx(),t);class i extends Error{}t.PartialJSON=i;class a extends Error{}t.MalformedJSON=a;function s(c,u=r.Allow.ALL){if(typeof c!="string")throw new TypeError(`expecting str, got ${typeof c}`);if(!c.trim())throw new Error(`${c} is empty`);return o(c.trim(),u)}t.parseJSON=s;const o=(c,u)=>{const d=c.length;let p=0;const f=A=>{throw new i(`${A} at position ${p}`)},h=A=>{throw new a(`${A} at position ${p}`)},m=()=>(S(),p>=d&&f("Unexpected end of input"),c[p]==='"'?g():c[p]==="{"?v():c[p]==="["?y():c.substring(p,p+4)==="null"||r.Allow.NULL&u&&d-p<4&&"null".startsWith(c.substring(p))?(p+=4,null):c.substring(p,p+4)==="true"||r.Allow.BOOL&u&&d-p<4&&"true".startsWith(c.substring(p))?(p+=4,!0):c.substring(p,p+5)==="false"||r.Allow.BOOL&u&&d-p<5&&"false".startsWith(c.substring(p))?(p+=5,!1):c.substring(p,p+8)==="Infinity"||r.Allow.INFINITY&u&&d-p<8&&"Infinity".startsWith(c.substring(p))?(p+=8,1/0):c.substring(p,p+9)==="-Infinity"||r.Allow._INFINITY&u&&1<d-p&&d-p<9&&"-Infinity".startsWith(c.substring(p))?(p+=9,-1/0):c.substring(p,p+3)==="NaN"||r.Allow.NAN&u&&d-p<3&&"NaN".startsWith(c.substring(p))?(p+=3,NaN):b()),g=()=>{const A=p;let _=!1;for(p++;p<d&&(c[p]!=='"'||_&&c[p-1]==="\\");)_=c[p]==="\\"?!_:!1,p++;if(c.charAt(p)=='"')try{return JSON.parse(c.substring(A,++p-Number(_)))}catch(I){h(String(I))}else if(r.Allow.STR&u)try{return JSON.parse(c.substring(A,p-Number(_))+'"')}catch{return JSON.parse(c.substring(A,c.lastIndexOf("\\"))+'"')}f("Unterminated string literal")},v=()=>{p++,S();const A={};try{for(;c[p]!=="}";){if(S(),p>=d&&r.Allow.OBJ&u)return A;const _=g();S(),p++;try{const I=m();A[_]=I}catch(I){if(r.Allow.OBJ&u)return A;throw I}S(),c[p]===","&&p++}}catch{if(r.Allow.OBJ&u)return A;f("Expected '}' at end of object")}return p++,A},y=()=>{p++;const A=[];try{for(;c[p]!=="]";)A.push(m()),S(),c[p]===","&&p++}catch{if(r.Allow.ARR&u)return A;f("Expected ']' at end of array")}return p++,A},b=()=>{if(p===0){c==="-"&&h("Not sure what '-' is");try{return JSON.parse(c)}catch(_){if(r.Allow.NUM&u)try{return JSON.parse(c.substring(0,c.lastIndexOf("e")))}catch{}h(String(_))}}const A=p;for(c[p]==="-"&&p++;c[p]&&",]}".indexOf(c[p])===-1;)p++;p==d&&!(r.Allow.NUM&u)&&f("Unterminated number literal");try{return JSON.parse(c.substring(A,p))}catch{c.substring(A,p)==="-"&&f("Not sure what '-' is");try{return JSON.parse(c.substring(A,c.lastIndexOf("e")))}catch(I){h(String(I))}}},S=()=>{for(;p<d&&`
|
|
183
|
-
\r `.includes(c[p]);)p++};return m()},l=s;t.parse=l})(Js)),Js}var xue=uF();const dF=[/prompt is too long/i,/input is too long for requested model/i,/exceeds the context window/i,/input token count.*exceeds the maximum/i,/maximum prompt length is \d+/i,/reduce the length of the messages/i,/maximum context length is \d+ tokens/i,/exceeds the limit of \d+/i,/exceeds the available context size/i,/greater than the context length/i,/context window exceeds limit/i,/exceeded model token limit/i,/too large for model with \d+ maximum context length/i,/model_context_window_exceeded/i,/context[_ ]length[_ ]exceeded/i,/too many tokens/i,/token limit exceeded/i];function pF(t,e){return!!(t.stopReason==="error"&&t.errorMessage&&(dF.some(n=>n.test(t.errorMessage))||/^4(00|13)\s*(status code)?\s*\(no body\)/i.test(t.errorMessage)))}var _u={exports:{}},Eh={},qa={},Qs={},Sh={},Ch={},Ah={},fx;function bp(){return fx||(fx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends e{constructor(y){if(super(),!t.IDENTIFIER.test(y))throw new Error("CodeGen: name must be a valid identifier");this.str=y}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class r extends e{constructor(y){super(),this._items=typeof y=="string"?[y]:y}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const y=this._items[0];return y===""||y==='""'}get str(){var y;return(y=this._str)!==null&&y!==void 0?y:this._str=this._items.reduce((b,S)=>`${b}${S}`,"")}get names(){var y;return(y=this._names)!==null&&y!==void 0?y:this._names=this._items.reduce((b,S)=>(S instanceof n&&(b[S.str]=(b[S.str]||0)+1),b),{})}}t._Code=r,t.nil=new r("");function i(v,...y){const b=[v[0]];let S=0;for(;S<y.length;)o(b,y[S]),b.push(v[++S]);return new r(b)}t._=i;const a=new r("+");function s(v,...y){const b=[f(v[0])];let S=0;for(;S<y.length;)b.push(a),o(b,y[S]),b.push(a,f(v[++S]));return l(b),new r(b)}t.str=s;function o(v,y){y instanceof r?v.push(...y._items):y instanceof n?v.push(y):v.push(d(y))}t.addCodeArg=o;function l(v){let y=1;for(;y<v.length-1;){if(v[y]===a){const b=c(v[y-1],v[y+1]);if(b!==void 0){v.splice(y-1,3,b);continue}v[y++]="+"}y++}}function c(v,y){if(y==='""')return v;if(v==='""')return y;if(typeof v=="string")return y instanceof n||v[v.length-1]!=='"'?void 0:typeof y!="string"?`${v.slice(0,-1)}${y}"`:y[0]==='"'?v.slice(0,-1)+y.slice(1):void 0;if(typeof y=="string"&&y[0]==='"'&&!(v instanceof n))return`"${v}${y.slice(1)}`}function u(v,y){return y.emptyStr()?v:v.emptyStr()?y:s`${v}${y}`}t.strConcat=u;function d(v){return typeof v=="number"||typeof v=="boolean"||v===null?v:f(Array.isArray(v)?v.join(","):v)}function p(v){return new r(f(v))}t.stringify=p;function f(v){return JSON.stringify(v).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=f;function h(v){return typeof v=="string"&&t.IDENTIFIER.test(v)?new r(`.${v}`):i`[${v}]`}t.getProperty=h;function m(v){if(typeof v=="string"&&t.IDENTIFIER.test(v))return new r(`${v}`);throw new Error(`CodeGen: invalid export name: ${v}, use explicit $id name mapping`)}t.getEsmExportName=m;function g(v){return new r(v.toString())}t.regexpCode=g})(Ah)),Ah}var Th={},hx;function mx(){return hx||(hx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=bp();class n extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`),this.value=c.value}}var r;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(r||(t.UsedValueState=r={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class i{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof e.Name?c:this.name(c)}name(c){return new e.Name(this._newName(c))}_newName(c){const u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,d;if(!((d=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(c)||this._prefixes&&!this._prefixes.has(c))throw new Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}}t.Scope=i;class a extends e.Name{constructor(c,u){super(u),this.prefix=c}setValue(c,{property:u,itemIndex:d}){this.value=c,this.scopePath=(0,e._)`.${new e.Name(u)}[${d}]`}}t.ValueScopeName=a;const s=(0,e._)`\n`;class o extends i{constructor(c){super(c),this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?s:e.nil}}get(){return this._scope}name(c){return new a(c,this._newName(c))}value(c,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const p=this.toName(c),{prefix:f}=p,h=(d=u.key)!==null&&d!==void 0?d:u.ref;let m=this._values[f];if(m){const y=m.get(h);if(y)return y}else m=this._values[f]=new Map;m.set(h,p);const g=this._scope[f]||(this._scope[f]=[]),v=g.length;return g[v]=u.ref,p.setValue(u,{property:f,itemIndex:v}),p}getValue(c,u){const d=this._values[c];if(d)return d.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,d=>{if(d.scopePath===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return(0,e._)`${c}${d.scopePath}`})}scopeCode(c=this._values,u,d){return this._reduceValues(c,p=>{if(p.value===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return p.value.code},u,d)}_reduceValues(c,u,d={},p){let f=e.nil;for(const h in c){const m=c[h];if(!m)continue;const g=d[h]=d[h]||new Map;m.forEach(v=>{if(g.has(v))return;g.set(v,r.Started);let y=u(v);if(y){const b=this.opts.es5?t.varKinds.var:t.varKinds.const;f=(0,e._)`${f}${b} ${v} = ${y};${this.opts._n}`}else if(y=p?.(v))f=(0,e._)`${f}${y}${this.opts._n}`;else throw new n(v);g.set(v,r.Completed)})}return f}}t.ValueScope=o})(Th)),Th}var gx;function Zt(){return gx||(gx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=bp(),n=mx();var r=bp();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}});var i=mx();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class a{optimizeNodes(){return this}optimizeNames(H,K){return this}}class s extends a{constructor(H,K,he){super(),this.varKind=H,this.name=K,this.rhs=he}render({es5:H,_n:K}){const he=H?n.varKinds.var:this.varKind,Te=this.rhs===void 0?"":` = ${this.rhs}`;return`${he} ${this.name}${Te};`+K}optimizeNames(H,K){if(H[this.name.str])return this.rhs&&(this.rhs=U(this.rhs,H,K)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends a{constructor(H,K,he){super(),this.lhs=H,this.rhs=K,this.sideEffects=he}render({_n:H}){return`${this.lhs} = ${this.rhs};`+H}optimizeNames(H,K){if(!(this.lhs instanceof e.Name&&!H[this.lhs.str]&&!this.sideEffects))return this.rhs=U(this.rhs,H,K),this}get names(){const H=this.lhs instanceof e.Name?{}:{...this.lhs.names};return L(H,this.rhs)}}class l extends o{constructor(H,K,he,Te){super(H,he,Te),this.op=K}render({_n:H}){return`${this.lhs} ${this.op}= ${this.rhs};`+H}}class c extends a{constructor(H){super(),this.label=H,this.names={}}render({_n:H}){return`${this.label}:`+H}}class u extends a{constructor(H){super(),this.label=H,this.names={}}render({_n:H}){return`break${this.label?` ${this.label}`:""};`+H}}class d extends a{constructor(H){super(),this.error=H}render({_n:H}){return`throw ${this.error};`+H}get names(){return this.error.names}}class p extends a{constructor(H){super(),this.code=H}render({_n:H}){return`${this.code};`+H}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(H,K){return this.code=U(this.code,H,K),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class f extends a{constructor(H=[]){super(),this.nodes=H}render(H){return this.nodes.reduce((K,he)=>K+he.render(H),"")}optimizeNodes(){const{nodes:H}=this;let K=H.length;for(;K--;){const he=H[K].optimizeNodes();Array.isArray(he)?H.splice(K,1,...he):he?H[K]=he:H.splice(K,1)}return H.length>0?this:void 0}optimizeNames(H,K){const{nodes:he}=this;let Te=he.length;for(;Te--;){const Re=he[Te];Re.optimizeNames(H,K)||(X(H,Re.names),he.splice(Te,1))}return he.length>0?this:void 0}get names(){return this.nodes.reduce((H,K)=>z(H,K.names),{})}}class h extends f{render(H){return"{"+H._n+super.render(H)+"}"+H._n}}class m extends f{}class g extends h{}g.kind="else";class v extends h{constructor(H,K){super(K),this.condition=H}render(H){let K=`if(${this.condition})`+super.render(H);return this.else&&(K+="else "+this.else.render(H)),K}optimizeNodes(){super.optimizeNodes();const H=this.condition;if(H===!0)return this.nodes;let K=this.else;if(K){const he=K.optimizeNodes();K=this.else=Array.isArray(he)?new g(he):he}if(K)return H===!1?K instanceof v?K:K.nodes:this.nodes.length?this:new v(se(H),K instanceof v?[K]:K.nodes);if(!(H===!1||!this.nodes.length))return this}optimizeNames(H,K){var he;if(this.else=(he=this.else)===null||he===void 0?void 0:he.optimizeNames(H,K),!!(super.optimizeNames(H,K)||this.else))return this.condition=U(this.condition,H,K),this}get names(){const H=super.names;return L(H,this.condition),this.else&&z(H,this.else.names),H}}v.kind="if";class y extends h{}y.kind="for";class b extends y{constructor(H){super(),this.iteration=H}render(H){return`for(${this.iteration})`+super.render(H)}optimizeNames(H,K){if(super.optimizeNames(H,K))return this.iteration=U(this.iteration,H,K),this}get names(){return z(super.names,this.iteration.names)}}class S extends y{constructor(H,K,he,Te){super(),this.varKind=H,this.name=K,this.from=he,this.to=Te}render(H){const K=H.es5?n.varKinds.var:this.varKind,{name:he,from:Te,to:Re}=this;return`for(${K} ${he}=${Te}; ${he}<${Re}; ${he}++)`+super.render(H)}get names(){const H=L(super.names,this.from);return L(H,this.to)}}class A extends y{constructor(H,K,he,Te){super(),this.loop=H,this.varKind=K,this.name=he,this.iterable=Te}render(H){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(H)}optimizeNames(H,K){if(super.optimizeNames(H,K))return this.iterable=U(this.iterable,H,K),this}get names(){return z(super.names,this.iterable.names)}}class _ extends h{constructor(H,K,he){super(),this.name=H,this.args=K,this.async=he}render(H){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(H)}}_.kind="func";class I extends f{render(H){return"return "+super.render(H)}}I.kind="return";class P extends h{render(H){let K="try"+super.render(H);return this.catch&&(K+=this.catch.render(H)),this.finally&&(K+=this.finally.render(H)),K}optimizeNodes(){var H,K;return super.optimizeNodes(),(H=this.catch)===null||H===void 0||H.optimizeNodes(),(K=this.finally)===null||K===void 0||K.optimizeNodes(),this}optimizeNames(H,K){var he,Te;return super.optimizeNames(H,K),(he=this.catch)===null||he===void 0||he.optimizeNames(H,K),(Te=this.finally)===null||Te===void 0||Te.optimizeNames(H,K),this}get names(){const H=super.names;return this.catch&&z(H,this.catch.names),this.finally&&z(H,this.finally.names),H}}class B extends h{constructor(H){super(),this.error=H}render(H){return`catch(${this.error})`+super.render(H)}}B.kind="catch";class D extends h{render(H){return"finally"+super.render(H)}}D.kind="finally";class O{constructor(H,K={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...K,_n:K.lines?`
|
|
182
|
+
<body class="sprinkle-inline">${e}</body></html>`;if(xD)return SD(t,i,n);const a=document.createElement("iframe");a.setAttribute("sandbox","allow-scripts allow-same-origin"),a.style.cssText="width:100%;border:none;overflow:hidden;display:block;",a.srcdoc=i,t.appendChild(a);const s=o=>{if(o.source!==a.contentWindow)return;const l=o.data;l?.type&&(l.type==="inline-sprinkle-lick"?n(l.action,l.data):l.type==="inline-sprinkle-height"&&(a.style.height=l.height+"px"))};return window.addEventListener("message",s),{dispose(){window.removeEventListener("message",s),a.remove()}}}function ED(t,e){const n=t.querySelectorAll("pre > code.language-shtml");if(n.length===0)return[];const r=[];for(const i of n){const a=i.parentElement,s=i.textContent??"",o=document.createElement("div");o.className="msg__inline-sprinkle",a.replaceWith(o),r.push(CE(o,s,e))}return r}function Xb(t){for(const e of t)try{e.dispose()}catch{}t.length=0}function SD(t,e,n){const r=document.createElement("iframe");r.src=chrome.runtime.getURL("sprinkle-sandbox.html"),r.style.cssText="width:100%;border:none;overflow:hidden;display:block;",t.appendChild(r);const i=a=>{if(a.source!==r.contentWindow)return;const s=a.data;s?.type&&(s.type==="inline-sprinkle-lick"?n(s.action,s.data):s.type==="inline-sprinkle-height"&&(r.style.height=s.height+"px"))};return window.addEventListener("message",i),r.addEventListener("load",()=>{r.contentWindow?.postMessage({type:"inline-sprinkle-render",srcdoc:e},"*")},{once:!0}),{dispose(){window.removeEventListener("message",i),r.remove()}}}const ho=wn("tool-ui");class CD{pending=new Map;idCounter=0;generateId(){return`tool-ui-${++this.idCounter}-${Date.now().toString(36)}`}register(e,n,r,i){this.pending.set(e,{request:n,resolve:r,reject:i}),ho.info("Tool UI registered",{id:e})}async handleAction(e,n){const r=this.pending.get(e);if(!r){ho.warn("Action for unknown tool UI",{id:e,action:n.action});return}ho.info("Tool UI action",{id:e,action:n.action});try{let i;r.request.onAction?i=await r.request.onAction(n.action,n.data):i=n,r.resolve(i)}catch(i){r.reject(i instanceof Error?i:new Error(String(i)))}finally{this.pending.delete(e)}}cancel(e,n="cancelled"){const r=this.pending.get(e);r&&(r.reject(new Error(n)),this.pending.delete(e),ho.info("Tool UI cancelled",{id:e,reason:n}))}cancelAll(e="cancelled"){const n=this.pending.size;for(const[r,i]of this.pending)i.reject(new Error(e));this.pending.clear(),n>0&&ho.info("All tool UIs cancelled",{reason:e,count:n})}isPending(e){return this.pending.has(e)}getPendingIds(){return[...this.pending.keys()]}}const yp=new CD;async function AD(t,e){const n=t.id??yp.generateId();let r,i;const a=new Promise((s,o)=>{r=s,i=o});return yp.register(n,t,r,i),e?e({content:[{type:"tool_ui",requestId:n,html:t.html}]}):ho.warn("showToolUI called without onUpdate callback — UI may not render"),a.finally(()=>{e&&e({content:[{type:"tool_ui_done",requestId:n}]})})}const gl=[];function TD(t){return gl.push(t),t}function _D(t){const e=gl.lastIndexOf(t);e!==-1&&gl.splice(e,1)}function AE(){return gl.length>0?gl[gl.length-1]:null}async function TE(t){const e=AE();return e?AD(t,e.onUpdate):(ho.warn("showToolUIFromContext called without execution context"),null)}const Cc=wn("tool-ui-renderer"),ID=typeof chrome<"u"&&!!chrome?.runtime?.id;class RD{container;iframe=null;inlineSprinkle=null;messageHandler=null;requestId;nonce;constructor(e,n){this.container=e,this.requestId=n,this.nonce=crypto.randomUUID()}async render(e){ID?await this.renderInSandbox(e):this.renderWithInlineSprinkle(e)}async renderInSandbox(e){const n=document.createElement("iframe");n.src=chrome.runtime.getURL("tool-ui-sandbox.html"),n.style.cssText="width: 100%; border: none; min-height: 60px;",this.iframe=n,await new Promise((a,s)=>{const o=setTimeout(()=>{Cc.error("Tool UI iframe load timed out"),n.remove(),this.iframe=null,s(new Error("tool-ui sandbox iframe load timed out"))},5e3);n.addEventListener("load",()=>{clearTimeout(o),a()},{once:!0}),n.addEventListener("error",()=>{clearTimeout(o),n.remove(),this.iframe=null,s(new Error("tool-ui sandbox iframe failed to load"))},{once:!0}),this.container.appendChild(n)}),this.messageHandler=a=>{if(a.source!==n.contentWindow)return;const s=a.data;if(s?.type){if(s.nonce!==this.nonce){Cc.warn("Tool UI message nonce mismatch",{expected:this.nonce,received:s.nonce});return}s.type==="tool-ui-action"&&s.id===this.requestId?(Cc.info("Tool UI action received",{id:s.id,action:s.action}),yp.handleAction(s.id,{action:s.action,data:s.data})):s.type==="tool-ui-rendered"&&s.id===this.requestId?s.height&&this.iframe&&(this.iframe.style.height=`${Math.max(60,s.height)}px`):s.type==="tool-ui-resize"&&s.id===this.requestId&&s.height&&this.iframe&&(this.iframe.style.height=`${Math.max(60,s.height)}px`)}},window.addEventListener("message",this.messageHandler);const{collectThemeCSS:r}=await Vt(async()=>{const{collectThemeCSS:a}=await Promise.resolve().then(()=>bD);return{collectThemeCSS:a}},void 0),i=r();n.contentWindow.postMessage({type:"tool-ui-render",id:this.requestId,nonce:this.nonce,html:e,themeCSS:i},"*")}renderWithInlineSprinkle(e){const n=document.createElement("div");n.className="msg__inline-sprinkle",this.container.appendChild(n),this.inlineSprinkle=CE(n,e,(r,i)=>{Cc.info("Tool UI action (inline sprinkle)",{id:this.requestId,action:r}),yp.handleAction(this.requestId,{action:r,data:i})})}dispose(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.iframe&&(this.iframe.remove(),this.iframe=null),this.inlineSprinkle&&(this.inlineSprinkle.dispose(),this.inlineSprinkle=null)}}const wp=new Map;function $D(t,e,n){const r=wp.get(e);r&&r.dispose();const i=new RD(t,e);return wp.set(e,i),i.render(n).catch(a=>{Cc.error("Failed to render tool UI",{requestId:e,error:a.message})}),i}function ND(t){const e=wp.get(t);e&&(e.dispose(),wp.delete(t))}const _E=new Map;function PD(t,e){return(n,r,i)=>{if(n.api!==t)throw new Error(`Mismatched api: ${n.api} expected ${t}`);return e(n,r,i)}}function OD(t,e){return(n,r,i)=>{if(n.api!==t)throw new Error(`Mismatched api: ${n.api} expected ${t}`);return e(n,r,i)}}function Ei(t,e){_E.set(t.api,{provider:{api:t.api,stream:PD(t.api,t.stream),streamSimple:OD(t.api,t.streamSimple)},sourceId:e})}function MD(t){return _E.get(t)?.provider}var vr={};let Bd=null,a0=null,s0=null;const xh=t=>import(t),LD="node:fs",DD="node:os",FD="node:path";typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&(xh(LD).then(t=>{Bd=t.existsSync}),xh(DD).then(t=>{a0=t.homedir}),xh(FD).then(t=>{s0=t.join}));let ac=null;function UD(){if(ac===null){if(!Bd||!a0||!s0)return typeof process<"u"&&(process.versions?.node||process.versions?.bun)||(ac=!1),!1;const t=vr.GOOGLE_APPLICATION_CREDENTIALS;t?ac=Bd(t):ac=Bd(s0(a0(),".config","gcloud","application_default_credentials.json"))}return ac}function xue(t){if(t==="github-copilot")return vr.COPILOT_GITHUB_TOKEN||vr.GH_TOKEN||vr.GITHUB_TOKEN;if(t==="anthropic")return vr.ANTHROPIC_OAUTH_TOKEN||vr.ANTHROPIC_API_KEY;if(t==="google-vertex"){if(vr.GOOGLE_CLOUD_API_KEY)return vr.GOOGLE_CLOUD_API_KEY;const r=UD(),i=!!(vr.GOOGLE_CLOUD_PROJECT||vr.GCLOUD_PROJECT),a=!!vr.GOOGLE_CLOUD_LOCATION;if(r&&i&&a)return"<authenticated>"}if(t==="amazon-bedrock"&&(vr.AWS_PROFILE||vr.AWS_ACCESS_KEY_ID&&vr.AWS_SECRET_ACCESS_KEY||vr.AWS_BEARER_TOKEN_BEDROCK||vr.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI||vr.AWS_CONTAINER_CREDENTIALS_FULL_URI||vr.AWS_WEB_IDENTITY_TOKEN_FILE))return"<authenticated>";const n={openai:"OPENAI_API_KEY","azure-openai-responses":"AZURE_OPENAI_API_KEY",google:"GEMINI_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",openrouter:"OPENROUTER_API_KEY","vercel-ai-gateway":"AI_GATEWAY_API_KEY",zai:"ZAI_API_KEY",mistral:"MISTRAL_API_KEY",minimax:"MINIMAX_API_KEY","minimax-cn":"MINIMAX_CN_API_KEY",huggingface:"HF_TOKEN",opencode:"OPENCODE_API_KEY","opencode-go":"OPENCODE_API_KEY","kimi-coding":"KIMI_API_KEY"}[t];return n?vr[n]:void 0}const WD={"amazon-bedrock":{"amazon.nova-2-lite-v1:0":{id:"amazon.nova-2-lite-v1:0",name:"Nova 2 Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.33,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"amazon.nova-lite-v1:0":{id:"amazon.nova-lite-v1:0",name:"Nova Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:.015,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"amazon.nova-micro-v1:0":{id:"amazon.nova-micro-v1:0",name:"Nova Micro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:.00875,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"amazon.nova-premier-v1:0":{id:"amazon.nova-premier-v1:0",name:"Nova Premier",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:2.5,output:12.5,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"amazon.nova-pro-v1:0":{id:"amazon.nova-pro-v1:0",name:"Nova Pro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"anthropic.claude-3-5-haiku-20241022-v1:0":{id:"anthropic.claude-3-5-haiku-20241022-v1:0",name:"Claude Haiku 3.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic.claude-3-5-sonnet-20240620-v1:0":{id:"anthropic.claude-3-5-sonnet-20240620-v1:0",name:"Claude Sonnet 3.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic.claude-3-5-sonnet-20241022-v2:0":{id:"anthropic.claude-3-5-sonnet-20241022-v2:0",name:"Claude Sonnet 3.5 v2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic.claude-3-7-sonnet-20250219-v1:0":{id:"anthropic.claude-3-7-sonnet-20250219-v1:0",name:"Claude Sonnet 3.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic.claude-3-haiku-20240307-v1:0":{id:"anthropic.claude-3-haiku-20240307-v1:0",name:"Claude Haiku 3",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:4096},"anthropic.claude-haiku-4-5-20251001-v1:0":{id:"anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-1-20250805-v1:0":{id:"anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic.claude-opus-4-20250514-v1:0":{id:"anthropic.claude-opus-4-20250514-v1:0",name:"Claude Opus 4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic.claude-opus-4-5-20251101-v1:0":{id:"anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-6-v1":{id:"anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-sonnet-4-20250514-v1:0":{id:"anthropic.claude-sonnet-4-20250514-v1:0",name:"Claude Sonnet 4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-sonnet-4-6":{id:"anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"deepseek.r1-v1:0":{id:"deepseek.r1-v1:0",name:"DeepSeek-R1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"deepseek.v3-v1:0":{id:"deepseek.v3-v1:0",name:"DeepSeek-V3.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.58,output:1.68,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"deepseek.v3.2":{id:"deepseek.v3.2",name:"DeepSeek-V3.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.62,output:1.85,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"eu.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"eu.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-5-20251101-v1:0":{id:"eu.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-6-v1":{id:"eu.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-sonnet-4-20250514-v1:0":{id:"eu.anthropic.claude-sonnet-4-20250514-v1:0",name:"Claude Sonnet 4 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"eu.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-sonnet-4-6":{id:"eu.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"global.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"global.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-5-20251101-v1:0":{id:"global.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-6-v1":{id:"global.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-sonnet-4-20250514-v1:0":{id:"global.anthropic.claude-sonnet-4-20250514-v1:0",name:"Claude Sonnet 4 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"global.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-sonnet-4-6":{id:"global.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"google.gemma-3-27b-it":{id:"google.gemma-3-27b-it",name:"Google Gemma 3 27B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.12,output:.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:8192},"google.gemma-3-4b-it":{id:"google.gemma-3-4b-it",name:"Gemma 3 4B IT",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.04,output:.08,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-1-405b-instruct-v1:0":{id:"meta.llama3-1-405b-instruct-v1:0",name:"Llama 3.1 405B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:2.4,output:2.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-1-70b-instruct-v1:0":{id:"meta.llama3-1-70b-instruct-v1:0",name:"Llama 3.1 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-1-8b-instruct-v1:0":{id:"meta.llama3-1-8b-instruct-v1:0",name:"Llama 3.1 8B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.22,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-2-11b-instruct-v1:0":{id:"meta.llama3-2-11b-instruct-v1:0",name:"Llama 3.2 11B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.16,output:.16,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-2-1b-instruct-v1:0":{id:"meta.llama3-2-1b-instruct-v1:0",name:"Llama 3.2 1B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:4096},"meta.llama3-2-3b-instruct-v1:0":{id:"meta.llama3-2-3b-instruct-v1:0",name:"Llama 3.2 3B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:4096},"meta.llama3-2-90b-instruct-v1:0":{id:"meta.llama3-2-90b-instruct-v1:0",name:"Llama 3.2 90B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-3-70b-instruct-v1:0":{id:"meta.llama3-3-70b-instruct-v1:0",name:"Llama 3.3 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama4-maverick-17b-instruct-v1:0":{id:"meta.llama4-maverick-17b-instruct-v1:0",name:"Llama 4 Maverick 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"meta.llama4-scout-17b-instruct-v1:0":{id:"meta.llama4-scout-17b-instruct-v1:0",name:"Llama 4 Scout 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:35e5,maxTokens:16384},"minimax.minimax-m2":{id:"minimax.minimax-m2",name:"MiniMax M2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204608,maxTokens:128e3},"minimax.minimax-m2.1":{id:"minimax.minimax-m2.1",name:"MiniMax M2.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"mistral.devstral-2-123b":{id:"mistral.devstral-2-123b",name:"Devstral 2 123B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.magistral-small-2509":{id:"mistral.magistral-small-2509",name:"Magistral Small 1.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e4},"mistral.ministral-3-14b-instruct":{id:"mistral.ministral-3-14b-instruct",name:"Ministral 14B 3.0",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.2,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.ministral-3-3b-instruct":{id:"mistral.ministral-3-3b-instruct",name:"Ministral 3 3B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.ministral-3-8b-instruct":{id:"mistral.ministral-3-8b-instruct",name:"Ministral 3 8B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.mistral-large-3-675b-instruct":{id:"mistral.mistral-large-3-675b-instruct",name:"Mistral Large 3",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.pixtral-large-2502-v1:0":{id:"mistral.pixtral-large-2502-v1:0",name:"Pixtral Large (25.02)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"mistral.voxtral-mini-3b-2507":{id:"mistral.voxtral-mini-3b-2507",name:"Voxtral Mini 3B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.voxtral-small-24b-2507":{id:"mistral.voxtral-small-24b-2507",name:"Voxtral Small 24B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.35,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:8192},"moonshot.kimi-k2-thinking":{id:"moonshot.kimi-k2-thinking",name:"Kimi K2 Thinking",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"moonshotai.kimi-k2.5":{id:"moonshotai.kimi-k2.5",name:"Kimi K2.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"nvidia.nemotron-nano-12b-v2":{id:"nvidia.nemotron-nano-12b-v2",name:"NVIDIA Nemotron Nano 12B v2 VL BF16",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-3-30b":{id:"nvidia.nemotron-nano-3-30b",name:"NVIDIA Nemotron Nano 3 30B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-9b-v2":{id:"nvidia.nemotron-nano-9b-v2",name:"NVIDIA Nemotron Nano 9B v2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.06,output:.23,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai.gpt-oss-120b-1:0":{id:"openai.gpt-oss-120b-1:0",name:"gpt-oss-120b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai.gpt-oss-20b-1:0":{id:"openai.gpt-oss-20b-1:0",name:"gpt-oss-20b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.07,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai.gpt-oss-safeguard-120b":{id:"openai.gpt-oss-safeguard-120b",name:"GPT OSS Safeguard 120B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai.gpt-oss-safeguard-20b":{id:"openai.gpt-oss-safeguard-20b",name:"GPT OSS Safeguard 20B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.07,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"qwen.qwen3-235b-a22b-2507-v1:0":{id:"qwen.qwen3-235b-a22b-2507-v1:0",name:"Qwen3 235B A22B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-32b-v1:0":{id:"qwen.qwen3-32b-v1:0",name:"Qwen3 32B (dense)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"qwen.qwen3-coder-30b-a3b-v1:0":{id:"qwen.qwen3-coder-30b-a3b-v1:0",name:"Qwen3 Coder 30B A3B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-coder-480b-a35b-v1:0":{id:"qwen.qwen3-coder-480b-a35b-v1:0",name:"Qwen3 Coder 480B A35B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen.qwen3-next-80b-a3b":{id:"qwen.qwen3-next-80b-a3b",name:"Qwen/Qwen3-Next-80B-A3B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.14,output:1.4,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"qwen.qwen3-vl-235b-a22b":{id:"qwen.qwen3-vl-235b-a22b",name:"Qwen/Qwen3-VL-235B-A22B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.3,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"us.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"us.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-1-20250805-v1:0":{id:"us.anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"us.anthropic.claude-opus-4-20250514-v1:0":{id:"us.anthropic.claude-opus-4-20250514-v1:0",name:"Claude Opus 4 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"us.anthropic.claude-opus-4-5-20251101-v1:0":{id:"us.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-6-v1":{id:"us.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-sonnet-4-20250514-v1:0":{id:"us.anthropic.claude-sonnet-4-20250514-v1:0",name:"Claude Sonnet 4 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"us.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-sonnet-4-6":{id:"us.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"writer.palmyra-x4-v1:0":{id:"writer.palmyra-x4-v1:0",name:"Palmyra X4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:122880,maxTokens:8192},"writer.palmyra-x5-v1:0":{id:"writer.palmyra-x5-v1:0",name:"Palmyra X5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:6,cacheRead:0,cacheWrite:0},contextWindow:104e4,maxTokens:8192},"zai.glm-4.7":{id:"zai.glm-4.7",name:"GLM-4.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai.glm-4.7-flash":{id:"zai.glm-4.7-flash",name:"GLM-4.7-Flash",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.07,output:.4,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072}},anthropic:{"claude-3-5-haiku-20241022":{id:"claude-3-5-haiku-20241022",name:"Claude Haiku 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-haiku-latest":{id:"claude-3-5-haiku-latest",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20240620":{id:"claude-3-5-sonnet-20240620",name:"Claude Sonnet 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20241022":{id:"claude-3-5-sonnet-20241022",name:"Claude Sonnet 3.5 v2",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-7-sonnet-20250219":{id:"claude-3-7-sonnet-20250219",name:"Claude Sonnet 3.7",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-3-7-sonnet-latest":{id:"claude-3-7-sonnet-latest",name:"Claude Sonnet 3.7 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-3-haiku-20240307":{id:"claude-3-haiku-20240307",name:"Claude Haiku 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3-opus-20240229":{id:"claude-3-opus-20240229",name:"Claude Opus 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:4096},"claude-3-sonnet-20240229":{id:"claude-3-sonnet-20240229",name:"Claude Sonnet 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-haiku-4-5-20251001":{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-0":{id:"claude-opus-4-0",name:"Claude Opus 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1-20250805":{id:"claude-opus-4-1-20250805",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-20250514":{id:"claude-opus-4-20250514",name:"Claude Opus 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-5-20251101":{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4-0":{id:"claude-sonnet-4-0",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-20250514":{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5-20250929":{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3}},"azure-openai-responses":{"codex-mini-latest":{id:"codex-mini-latest",name:"Codex Mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text"],cost:{input:1.5,output:6,cacheRead:.375,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"gpt-4":{id:"gpt-4",name:"GPT-4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.03,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},cerebras:{"gpt-oss-120b":{id:"gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!0,input:["text"],cost:{input:.25,output:.69,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"llama3.1-8b":{id:"llama3.1-8b",name:"Llama 3.1 8B",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:8e3},"qwen-3-235b-a22b-instruct-2507":{id:"qwen-3-235b-a22b-instruct-2507",name:"Qwen 3 235B Instruct",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:.6,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:32e3},"zai-glm-4.7":{id:"zai-glm-4.7",name:"Z.AI GLM-4.7",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!1,input:["text"],cost:{input:2.25,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4e4}},"github-copilot":{"claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:144e3,maxTokens:32e3},"claude-opus-4.5":{id:"claude-opus-4.5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:16e4,maxTokens:32e3},"claude-opus-4.6":{id:"claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:216e3,maxTokens:16e3},"claude-sonnet-4.5":{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:144e3,maxTokens:32e3},"claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:32e3},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5-mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1-Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1-Codex-max",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1-Codex-mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2-Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3-Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"grok-code-fast-1":{id:"grok-code-fast-1",name:"Grok Code Fast 1",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3}},google:{"gemini-1.5-flash":{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-flash-8b":{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash-8B",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.0375,output:.15,cacheRead:.01,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-pro":{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:1.25,output:5,cacheRead:.3125,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite-preview-06-17":{id:"gemini-2.5-flash-lite-preview-06-17",name:"Gemini 2.5 Flash Lite Preview 06-17",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite-preview-09-2025":{id:"gemini-2.5-flash-lite-preview-09-2025",name:"Gemini 2.5 Flash Lite Preview 09-25",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-preview-04-17":{id:"gemini-2.5-flash-preview-04-17",name:"Gemini 2.5 Flash Preview 04-17",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.0375,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-preview-05-20":{id:"gemini-2.5-flash-preview-05-20",name:"Gemini 2.5 Flash Preview 05-20",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.0375,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-preview-09-2025":{id:"gemini-2.5-flash-preview-09-2025",name:"Gemini 2.5 Flash Preview 09-25",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.31,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro-preview-05-06":{id:"gemini-2.5-pro-preview-05-06",name:"Gemini 2.5 Pro Preview 05-06",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.31,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro-preview-06-05":{id:"gemini-2.5-pro-preview-06-05",name:"Gemini 2.5 Pro Preview 06-05",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.31,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"gemini-3.1-flash-lite-preview":{id:"gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:1},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview-customtools":{id:"gemini-3.1-pro-preview-customtools",name:"Gemini 3.1 Pro Preview Custom Tools",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-latest":{id:"gemini-flash-latest",name:"Gemini Flash Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-lite-latest":{id:"gemini-flash-lite-latest",name:"Gemini Flash-Lite Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-live-2.5-flash":{id:"gemini-live-2.5-flash",name:"Gemini Live 2.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.5,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"gemini-live-2.5-flash-preview-native-audio":{id:"gemini-live-2.5-flash-preview-native-audio",name:"Gemini Live 2.5 Flash Preview Native Audio",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text"],cost:{input:.5,output:2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536}},"google-antigravity":{"claude-opus-4-5-thinking":{id:"claude-opus-4-5-thinking",name:"Claude Opus 4.5 Thinking (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6-thinking":{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:128e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5-thinking":{id:"claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6 (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"gemini-3-flash":{id:"gemini-3-flash",name:"Gemini 3 Flash (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.5,cacheWrite:0},contextWindow:1048576,maxTokens:65535},"gemini-3.1-pro-high":{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:2.375},contextWindow:1048576,maxTokens:65535},"gemini-3.1-pro-low":{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro Low (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:2.375},contextWindow:1048576,maxTokens:65535},"gpt-oss-120b-medium":{id:"gpt-oss-120b-medium",name:"GPT-OSS 120B Medium (Antigravity)",api:"google-gemini-cli",provider:"google-antigravity",baseUrl:"https://daily-cloudcode-pa.sandbox.googleapis.com",reasoning:!1,input:["text"],cost:{input:.09,output:.36,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768}},"google-gemini-cli":{"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65535},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65535},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65535},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65535},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview (Cloud Code Assist)",api:"google-gemini-cli",provider:"google-gemini-cli",baseUrl:"https://cloudcode-pa.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65535}},"google-vertex":{"gemini-1.5-flash":{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-flash-8b":{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash-8B (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.0375,output:.15,cacheRead:.01,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-pro":{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:1.25,output:5,cacheRead:.3125,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.0375,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite-preview-09-2025":{id:"gemini-2.5-flash-lite-preview-09-2025",name:"Gemini 2.5 Flash Lite Preview 09-25 (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536}},groq:{"deepseek-r1-distill-llama-70b":{id:"deepseek-r1-distill-llama-70b",name:"DeepSeek R1 Distill Llama 70B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.75,output:.99,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"gemma2-9b-it":{id:"gemma2-9b-it",name:"Gemma 2 9B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.2,output:.2,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"llama-3.1-8b-instant":{id:"llama-3.1-8b-instant",name:"Llama 3.1 8B Instant",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.08,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"llama-3.3-70b-versatile":{id:"llama-3.3-70b-versatile",name:"Llama 3.3 70B Versatile",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.59,output:.79,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"llama3-70b-8192":{id:"llama3-70b-8192",name:"Llama 3 70B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.59,output:.79,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"llama3-8b-8192":{id:"llama3-8b-8192",name:"Llama 3 8B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.08,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"meta-llama/llama-4-maverick-17b-128e-instruct":{id:"meta-llama/llama-4-maverick-17b-128e-instruct",name:"Llama 4 Maverick 17B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"meta-llama/llama-4-scout-17b-16e-instruct":{id:"meta-llama/llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text","image"],cost:{input:.11,output:.34,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"mistral-saba-24b":{id:"mistral-saba-24b",name:"Mistral Saba 24B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.79,output:.79,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"moonshotai/kimi-k2-instruct":{id:"moonshotai/kimi-k2-instruct",name:"Kimi K2 Instruct",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/kimi-k2-instruct-0905":{id:"moonshotai/kimi-k2-instruct-0905",name:"Kimi K2 Instruct 0905",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen-qwq-32b":{id:"qwen-qwq-32b",name:"Qwen QwQ 32B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.29,output:.39,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen3 32B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.29,output:.59,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384}},huggingface:{"MiniMaxAI/MiniMax-M2.1":{id:"MiniMaxAI/MiniMax-M2.1",name:"MiniMax-M2.1",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.5":{id:"MiniMaxAI/MiniMax-M2.5",name:"MiniMax-M2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:131072},"Qwen/Qwen3-235B-A22B-Thinking-2507":{id:"Qwen/Qwen3-235B-A22B-Thinking-2507",name:"Qwen3-235B-A22B-Thinking-2507",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3-Coder-480B-A35B-Instruct":{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct",name:"Qwen3-Coder-480B-A35B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:2,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Coder-Next":{id:"Qwen/Qwen3-Coder-Next",name:"Qwen3-Coder-Next",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.2,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Qwen/Qwen3-Next-80B-A3B-Instruct":{id:"Qwen/Qwen3-Next-80B-A3B-Instruct",name:"Qwen3-Next-80B-A3B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Next-80B-A3B-Thinking":{id:"Qwen/Qwen3-Next-80B-A3B-Thinking",name:"Qwen3-Next-80B-A3B-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.3,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3.5-397B-A17B":{id:"Qwen/Qwen3.5-397B-A17B",name:"Qwen3.5-397B-A17B",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"XiaomiMiMo/MiMo-V2-Flash":{id:"XiaomiMiMo/MiMo-V2-Flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"deepseek-ai/DeepSeek-R1-0528":{id:"deepseek-ai/DeepSeek-R1-0528",name:"DeepSeek-R1-0528",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:3,output:5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:163840},"deepseek-ai/DeepSeek-V3.2":{id:"deepseek-ai/DeepSeek-V3.2",name:"DeepSeek-V3.2",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.28,output:.4,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"moonshotai/Kimi-K2-Instruct":{id:"moonshotai/Kimi-K2-Instruct",name:"Kimi-K2-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/Kimi-K2-Instruct-0905":{id:"moonshotai/Kimi-K2-Instruct-0905",name:"Kimi-K2-Instruct-0905",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"moonshotai/Kimi-K2-Thinking":{id:"moonshotai/Kimi-K2-Thinking",name:"Kimi-K2-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.5":{id:"moonshotai/Kimi-K2.5",name:"Kimi-K2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"zai-org/GLM-4.7":{id:"zai-org/GLM-4.7",name:"GLM-4.7",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai-org/GLM-4.7-Flash":{id:"zai-org/GLM-4.7-Flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai-org/GLM-5":{id:"zai-org/GLM-5",name:"GLM-5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"kimi-coding":{k2p5:{id:"k2p5",name:"Kimi K2.5",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768}},minimax:{"MiniMax-M2":{id:"MiniMax-M2",name:"MiniMax-M2",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.1":{id:"MiniMax-M2.1",name:"MiniMax-M2.1",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.1-highspeed":{id:"MiniMax-M2.1-highspeed",name:"MiniMax-M2.1-highspeed",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.5":{id:"MiniMax-M2.5",name:"MiniMax-M2.5",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.5-highspeed":{id:"MiniMax-M2.5-highspeed",name:"MiniMax-M2.5-highspeed",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072}},"minimax-cn":{"MiniMax-M2":{id:"MiniMax-M2",name:"MiniMax-M2",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.1":{id:"MiniMax-M2.1",name:"MiniMax-M2.1",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.1-highspeed":{id:"MiniMax-M2.1-highspeed",name:"MiniMax-M2.1-highspeed",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMax-M2.5":{id:"MiniMax-M2.5",name:"MiniMax-M2.5",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.5-highspeed":{id:"MiniMax-M2.5-highspeed",name:"MiniMax-M2.5-highspeed",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072}},mistral:{"codestral-latest":{id:"codestral-latest",name:"Codestral (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.3,output:.9,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"devstral-2512":{id:"devstral-2512",name:"Devstral 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-medium-2507":{id:"devstral-medium-2507",name:"Devstral Medium",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-medium-latest":{id:"devstral-medium-latest",name:"Devstral 2 (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-small-2505":{id:"devstral-small-2505",name:"Devstral Small 2505",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-small-2507":{id:"devstral-small-2507",name:"Devstral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"labs-devstral-small-2512":{id:"labs-devstral-small-2512",name:"Devstral Small 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"magistral-medium-latest":{id:"magistral-medium-latest",name:"Magistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:2,output:5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"magistral-small":{id:"magistral-small",name:"Magistral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-3b-latest":{id:"ministral-3b-latest",name:"Ministral 3B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-8b-latest":{id:"ministral-8b-latest",name:"Ministral 8B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-large-2411":{id:"mistral-large-2411",name:"Mistral Large 2.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"mistral-large-2512":{id:"mistral-large-2512",name:"Mistral Large 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-large-latest":{id:"mistral-large-latest",name:"Mistral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-2505":{id:"mistral-medium-2505",name:"Mistral Medium 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"mistral-medium-2508":{id:"mistral-medium-2508",name:"Mistral Medium 3.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-latest":{id:"mistral-medium-latest",name:"Mistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistral-nemo":{id:"mistral-nemo",name:"Mistral Nemo",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-small-2506":{id:"mistral-small-2506",name:"Mistral Small 3.2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistral-small-latest":{id:"mistral-small-latest",name:"Mistral Small (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"open-mistral-7b":{id:"open-mistral-7b",name:"Mistral 7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.25,output:.25,cacheRead:0,cacheWrite:0},contextWindow:8e3,maxTokens:8e3},"open-mixtral-8x22b":{id:"open-mixtral-8x22b",name:"Mixtral 8x22B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:64e3,maxTokens:64e3},"open-mixtral-8x7b":{id:"open-mixtral-8x7b",name:"Mixtral 8x7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.7,output:.7,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:32e3},"pixtral-12b":{id:"pixtral-12b",name:"Pixtral 12B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"pixtral-large-latest":{id:"pixtral-large-latest",name:"Pixtral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3}},openai:{"codex-mini-latest":{id:"codex-mini-latest",name:"Codex Mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text"],cost:{input:1.5,output:6,cacheRead:.375,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"gpt-4":{id:"gpt-4",name:"GPT-4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.03,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},"openai-codex":{"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:272e3,maxTokens:128e3}},opencode:{"big-pickle":{id:"big-pickle",name:"Big Pickle",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"claude-3-5-haiku":{id:"claude-3-5-haiku",name:"Claude Haiku 3.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"gemini-3-flash":{id:"gemini-3-flash",name:"Gemini 3 Flash",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro":{id:"gemini-3.1-pro",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:204800,maxTokens:131072},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:30,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni-free":{id:"mimo-v2-omni-free",name:"MiMo V2 Omni Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:64e3},"mimo-v2-pro-free":{id:"mimo-v2-pro-free",name:"MiMo V2 Pro Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:64e3},"minimax-m2.5":{id:"minimax-m2.5",name:"MiniMax M2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m2.5-free":{id:"minimax-m2.5-free",name:"MiniMax M2.5 Free",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"nemotron-3-super-free":{id:"nemotron-3-super-free",name:"Nemotron 3 Super Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:128e3}},"opencode-go":{"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:204800,maxTokens:131072},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:65536},"minimax-m2.5":{id:"minimax-m2.5",name:"MiniMax M2.5",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m2.7":{id:"minimax-m2.7",name:"MiniMax M2.7",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072}},openrouter:{"ai21/jamba-large-1.7":{id:"ai21/jamba-large-1.7",name:"AI21: Jamba Large 1.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:8,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"alibaba/tongyi-deepresearch-30b-a3b":{id:"alibaba/tongyi-deepresearch-30b-a3b",name:"Tongyi DeepResearch 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.44999999999999996,cacheRead:.09,cacheWrite:0},contextWindow:131072,maxTokens:131072},"allenai/olmo-3.1-32b-instruct":{id:"allenai/olmo-3.1-32b-instruct",name:"AllenAI: Olmo 3.1 32B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.6,cacheRead:0,cacheWrite:0},contextWindow:65536,maxTokens:4096},"amazon/nova-2-lite-v1":{id:"amazon/nova-2-lite-v1",name:"Amazon: Nova 2 Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65535},"amazon/nova-lite-v1":{id:"amazon/nova-lite-v1",name:"Amazon: Nova Lite 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"amazon/nova-micro-v1":{id:"amazon/nova-micro-v1",name:"Amazon: Nova Micro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:5120},"amazon/nova-premier-v1":{id:"amazon/nova-premier-v1",name:"Amazon: Nova Premier 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:12.5,cacheRead:.625,cacheWrite:0},contextWindow:1e6,maxTokens:32e3},"amazon/nova-pro-v1":{id:"amazon/nova-pro-v1",name:"Amazon: Nova Pro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:3.1999999999999997,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Anthropic: Claude 3 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Anthropic: Claude 3.5 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-3.5-sonnet":{id:"anthropic/claude-3.5-sonnet",name:"Anthropic: Claude 3.5 Sonnet",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:6,output:30,cacheRead:.6,cacheWrite:7.5},contextWindow:2e5,maxTokens:8192},"anthropic/claude-3.7-sonnet":{id:"anthropic/claude-3.7-sonnet",name:"Anthropic: Claude 3.7 Sonnet",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-3.7-sonnet:thinking":{id:"anthropic/claude-3.7-sonnet:thinking",name:"Anthropic: Claude 3.7 Sonnet (thinking)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Anthropic: Claude Haiku 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.09999999999999999,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Anthropic: Claude Opus 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Anthropic: Claude Opus 4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Anthropic: Claude Opus 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Anthropic: Claude Opus 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Anthropic: Claude Sonnet 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Anthropic: Claude Sonnet 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Anthropic: Claude Sonnet 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-preview:free":{id:"arcee-ai/trinity-large-preview:free",name:"Arcee AI: Trinity Large Preview (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:4096},"arcee-ai/trinity-mini":{id:"arcee-ai/trinity-mini",name:"Arcee AI: Trinity Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.045,output:.15,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"arcee-ai/trinity-mini:free":{id:"arcee-ai/trinity-mini:free",name:"Arcee AI: Trinity Mini (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"arcee-ai/virtuoso-large":{id:"arcee-ai/virtuoso-large",name:"Arcee AI: Virtuoso Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.75,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:64e3},auto:{id:"auto",name:"Auto",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"baidu/ernie-4.5-21b-a3b":{id:"baidu/ernie-4.5-21b-a3b",name:"Baidu: ERNIE 4.5 21B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.07,output:.28,cacheRead:0,cacheWrite:0},contextWindow:12e4,maxTokens:8e3},"baidu/ernie-4.5-vl-28b-a3b":{id:"baidu/ernie-4.5-vl-28b-a3b",name:"Baidu: ERNIE 4.5 VL 28B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.14,output:.56,cacheRead:0,cacheWrite:0},contextWindow:3e4,maxTokens:8e3},"bytedance-seed/seed-1.6":{id:"bytedance-seed/seed-1.6",name:"ByteDance Seed: Seed 1.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-1.6-flash":{id:"bytedance-seed/seed-1.6-flash",name:"ByteDance Seed: Seed 1.6 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-2.0-lite":{id:"bytedance-seed/seed-2.0-lite",name:"ByteDance Seed: Seed-2.0-Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"bytedance-seed/seed-2.0-mini":{id:"bytedance-seed/seed-2.0-mini",name:"ByteDance Seed: Seed-2.0-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"cohere/command-r-08-2024":{id:"cohere/command-r-08-2024",name:"Cohere: Command R (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"cohere/command-r-plus-08-2024":{id:"cohere/command-r-plus-08-2024",name:"Cohere: Command R+ (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"deepseek/deepseek-chat":{id:"deepseek/deepseek-chat",name:"DeepSeek: DeepSeek V3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.32,output:.8899999999999999,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:163840},"deepseek/deepseek-chat-v3-0324":{id:"deepseek/deepseek-chat-v3-0324",name:"DeepSeek: DeepSeek V3 0324",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:.77,cacheRead:.135,cacheWrite:0},contextWindow:163840,maxTokens:4096},"deepseek/deepseek-chat-v3.1":{id:"deepseek/deepseek-chat-v3.1",name:"DeepSeek: DeepSeek V3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.75,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:7168},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek: R1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.7,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:64e3,maxTokens:16e3},"deepseek/deepseek-r1-0528":{id:"deepseek/deepseek-r1-0528",name:"DeepSeek: R1 0528",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.44999999999999996,output:2.1500000000000004,cacheRead:.22499999999999998,cacheWrite:0},contextWindow:163840,maxTokens:65536},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek: DeepSeek V3.1 Terminus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.21,output:.7899999999999999,cacheRead:.1300000002,cacheWrite:0},contextWindow:163840,maxTokens:4096},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek: DeepSeek V3.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.26,output:.38,cacheRead:.13,cacheWrite:0},contextWindow:163840,maxTokens:4096},"deepseek/deepseek-v3.2-exp":{id:"deepseek/deepseek-v3.2-exp",name:"DeepSeek: DeepSeek V3.2 Exp",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.41,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"essentialai/rnj-1-instruct":{id:"essentialai/rnj-1-instruct",name:"EssentialAI: Rnj 1 Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:4096},"google/gemini-2.0-flash-001":{id:"google/gemini-2.0-flash-001",name:"Google: Gemini 2.0 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:8192},"google/gemini-2.0-flash-lite-001":{id:"google/gemini-2.0-flash-lite-001",name:"Google: Gemini 2.0 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Google: Gemini 2.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Google: Gemini 2.5 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite-preview-09-2025":{id:"google/gemini-2.5-flash-lite-preview-09-2025",name:"Google: Gemini 2.5 Flash Lite Preview 09-2025",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Google: Gemini 2.5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview":{id:"google/gemini-2.5-pro-preview",name:"Google: Gemini 2.5 Pro Preview 06-05",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview-05-06":{id:"google/gemini-2.5-pro-preview-05-06",name:"Google: Gemini 2.5 Pro Preview 05-06",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65535},"google/gemini-3-flash-preview":{id:"google/gemini-3-flash-preview",name:"Google: Gemini 3 Flash Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.049999999999999996,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-3-pro-preview":{id:"google/gemini-3-pro-preview",name:"Google: Gemini 3 Pro Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Google: Gemini 3.1 Flash Lite Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.024999999999999998,cacheWrite:.08333333333333334},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Google: Gemini 3.1 Pro Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview-customtools":{id:"google/gemini-3.1-pro-preview-customtools",name:"Google: Gemini 3.1 Pro Preview Custom Tools",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"inception/mercury":{id:"inception/mercury",name:"Inception: Mercury",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"inception/mercury-2":{id:"inception/mercury-2",name:"Inception: Mercury 2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:5e4},"inception/mercury-coder":{id:"inception/mercury-coder",name:"Inception: Mercury Coder",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"kwaipilot/kat-coder-pro":{id:"kwaipilot/kat-coder-pro",name:"Kwaipilot: KAT-Coder-Pro V1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.207,output:.828,cacheRead:.0414,cacheWrite:0},contextWindow:256e3,maxTokens:128e3},"meituan/longcat-flash-chat":{id:"meituan/longcat-flash-chat",name:"Meituan: LongCat Flash Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.7999999999999999,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:131072},"meta-llama/llama-3-8b-instruct":{id:"meta-llama/llama-3-8b-instruct",name:"Meta: Llama 3 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.03,output:.04,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:16384},"meta-llama/llama-3.1-70b-instruct":{id:"meta-llama/llama-3.1-70b-instruct",name:"Meta: Llama 3.1 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"meta-llama/llama-3.1-8b-instruct":{id:"meta-llama/llama-3.1-8b-instruct",name:"Meta: Llama 3.1 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.049999999999999996,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct":{id:"meta-llama/llama-3.3-70b-instruct",name:"Meta: Llama 3.3 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.32,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct:free":{id:"meta-llama/llama-3.3-70b-instruct:free",name:"Meta: Llama 3.3 70B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:65536,maxTokens:4096},"meta-llama/llama-4-maverick":{id:"meta-llama/llama-4-maverick",name:"Meta: Llama 4 Maverick",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:16384},"meta-llama/llama-4-scout":{id:"meta-llama/llama-4-scout",name:"Meta: Llama 4 Scout",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.3,cacheRead:0,cacheWrite:0},contextWindow:327680,maxTokens:16384},"minimax/minimax-m1":{id:"minimax/minimax-m1",name:"MiniMax: MiniMax M1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.39999999999999997,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:4e4},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax: MiniMax M2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.255,output:1,cacheRead:.03,cacheWrite:0},contextWindow:196608,maxTokens:196608},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax: MiniMax M2.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.95,cacheRead:.0290000007,cacheWrite:0},contextWindow:196608,maxTokens:4096},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax: MiniMax M2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.17,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:196608,maxTokens:65536},"minimax/minimax-m2.5:free":{id:"minimax/minimax-m2.5:free",name:"MiniMax: MiniMax M2.5 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:196608,maxTokens:196608},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"MiniMax: MiniMax M2.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"mistralai/codestral-2508":{id:"mistralai/codestral-2508",name:"Mistral: Codestral 2508",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.3,output:.8999999999999999,cacheRead:.03,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"mistralai/devstral-2512":{id:"mistralai/devstral-2512",name:"Mistral: Devstral 2 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/devstral-medium":{id:"mistralai/devstral-medium",name:"Mistral: Devstral Medium",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/devstral-small":{id:"mistralai/devstral-small",name:"Mistral: Devstral Small 1.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/ministral-14b-2512":{id:"mistralai/ministral-14b-2512",name:"Mistral: Ministral 3 14B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.19999999999999998,output:.19999999999999998,cacheRead:.02,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/ministral-3b-2512":{id:"mistralai/ministral-3b-2512",name:"Mistral: Ministral 3 3B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:.01,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/ministral-8b-2512":{id:"mistralai/ministral-8b-2512",name:"Mistral: Ministral 3 8B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-large":{id:"mistralai/mistral-large",name:"Mistral Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-large-2407":{id:"mistralai/mistral-large-2407",name:"Mistral Large 2407",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-large-2411":{id:"mistralai/mistral-large-2411",name:"Mistral Large 2411",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-large-2512":{id:"mistralai/mistral-large-2512",name:"Mistral: Mistral Large 3 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-medium-3":{id:"mistralai/mistral-medium-3",name:"Mistral: Mistral Medium 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-medium-3.1":{id:"mistralai/mistral-medium-3.1",name:"Mistral: Mistral Medium 3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-nemo":{id:"mistralai/mistral-nemo",name:"Mistral: Mistral Nemo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.04,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"mistralai/mistral-saba":{id:"mistralai/mistral-saba",name:"Mistral: Saba",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.6,cacheRead:.02,cacheWrite:0},contextWindow:32768,maxTokens:4096},"mistralai/mistral-small-24b-instruct-2501":{id:"mistralai/mistral-small-24b-instruct-2501",name:"Mistral: Mistral Small 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.049999999999999996,output:.08,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:16384},"mistralai/mistral-small-2603":{id:"mistralai/mistral-small-2603",name:"Mistral: Mistral Small 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-small-3.1-24b-instruct:free":{id:"mistralai/mistral-small-3.1-24b-instruct:free",name:"Mistral: Mistral Small 3.1 24B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-small-3.2-24b-instruct":{id:"mistralai/mistral-small-3.2-24b-instruct",name:"Mistral: Mistral Small 3.2 24B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.075,output:.19999999999999998,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-small-creative":{id:"mistralai/mistral-small-creative",name:"Mistral: Mistral Small Creative",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:32768,maxTokens:4096},"mistralai/mixtral-8x22b-instruct":{id:"mistralai/mixtral-8x22b-instruct",name:"Mistral: Mixtral 8x22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:65536,maxTokens:4096},"mistralai/mixtral-8x7b-instruct":{id:"mistralai/mixtral-8x7b-instruct",name:"Mistral: Mixtral 8x7B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.54,output:.54,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:16384},"mistralai/pixtral-large-2411":{id:"mistralai/pixtral-large-2411",name:"Mistral: Pixtral Large 2411",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/voxtral-small-24b-2507":{id:"mistralai/voxtral-small-24b-2507",name:"Mistral: Voxtral Small 24B 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:32e3,maxTokens:4096},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"MoonshotAI: Kimi K2 0711",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.55,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:4096},"moonshotai/kimi-k2-0905":{id:"moonshotai/kimi-k2-0905",name:"MoonshotAI: Kimi K2 0905",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:4096},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"MoonshotAI: Kimi K2 Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.47,output:2,cacheRead:.14100000000000001,cacheWrite:0},contextWindow:131072,maxTokens:4096},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"MoonshotAI: Kimi K2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.41,output:2.06,cacheRead:.07,cacheWrite:0},contextWindow:262144,maxTokens:4096},"nex-agi/deepseek-v3.1-nex-n1":{id:"nex-agi/deepseek-v3.1-nex-n1",name:"Nex AGI: DeepSeek V3.1 Nex N1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.27,output:1,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:163840},"nvidia/llama-3.1-nemotron-70b-instruct":{id:"nvidia/llama-3.1-nemotron-70b-instruct",name:"NVIDIA: Llama 3.1 Nemotron 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1.2,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"nvidia/llama-3.3-nemotron-super-49b-v1.5":{id:"nvidia/llama-3.3-nemotron-super-49b-v1.5",name:"NVIDIA: Llama 3.3 Nemotron Super 49B V1.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"nvidia/nemotron-3-nano-30b-a3b":{id:"nvidia/nemotron-3-nano-30b-a3b",name:"NVIDIA: Nemotron 3 Nano 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.049999999999999996,output:.19999999999999998,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"nvidia/nemotron-3-nano-30b-a3b:free":{id:"nvidia/nemotron-3-nano-30b-a3b:free",name:"NVIDIA: Nemotron 3 Nano 30B A3B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"nvidia/nemotron-3-super-120b-a12b":{id:"nvidia/nemotron-3-super-120b-a12b",name:"NVIDIA: Nemotron 3 Super",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.5,cacheRead:.04,cacheWrite:0},contextWindow:262144,maxTokens:4096},"nvidia/nemotron-3-super-120b-a12b:free":{id:"nvidia/nemotron-3-super-120b-a12b:free",name:"NVIDIA: Nemotron 3 Super (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"nvidia/nemotron-nano-12b-v2-vl:free":{id:"nvidia/nemotron-nano-12b-v2-vl:free",name:"NVIDIA: Nemotron Nano 12B 2 VL (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"nvidia/nemotron-nano-9b-v2":{id:"nvidia/nemotron-nano-9b-v2",name:"NVIDIA: Nemotron Nano 9B V2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.04,output:.16,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"nvidia/nemotron-nano-9b-v2:free":{id:"nvidia/nemotron-nano-9b-v2:free",name:"NVIDIA: Nemotron Nano 9B V2 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-3.5-turbo":{id:"openai/gpt-3.5-turbo",name:"OpenAI: GPT-3.5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-3.5-turbo-0613":{id:"openai/gpt-3.5-turbo-0613",name:"OpenAI: GPT-3.5 Turbo (older v0613)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:2,cacheRead:0,cacheWrite:0},contextWindow:4095,maxTokens:4096},"openai/gpt-3.5-turbo-16k":{id:"openai/gpt-3.5-turbo-16k",name:"OpenAI: GPT-3.5 Turbo 16k",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:3,output:4,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-4":{id:"openai/gpt-4",name:"OpenAI: GPT-4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8191,maxTokens:4096},"openai/gpt-4-0314":{id:"openai/gpt-4-0314",name:"OpenAI: GPT-4 (older v0314)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8191,maxTokens:4096},"openai/gpt-4-1106-preview":{id:"openai/gpt-4-1106-preview",name:"OpenAI: GPT-4 Turbo (older v1106)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"OpenAI: GPT-4 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4-turbo-preview":{id:"openai/gpt-4-turbo-preview",name:"OpenAI: GPT-4 Turbo Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"OpenAI: GPT-4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"OpenAI: GPT-4.1 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:1.5999999999999999,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"OpenAI: GPT-4.1 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"OpenAI: GPT-4o",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-05-13":{id:"openai/gpt-4o-2024-05-13",name:"OpenAI: GPT-4o (2024-05-13)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4o-2024-08-06":{id:"openai/gpt-4o-2024-08-06",name:"OpenAI: GPT-4o (2024-08-06)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-11-20":{id:"openai/gpt-4o-2024-11-20",name:"OpenAI: GPT-4o (2024-11-20)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-audio-preview":{id:"openai/gpt-4o-audio-preview",name:"OpenAI: GPT-4o Audio",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"OpenAI: GPT-4o-mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini-2024-07-18":{id:"openai/gpt-4o-mini-2024-07-18",name:"OpenAI: GPT-4o-mini (2024-07-18)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o:extended":{id:"openai/gpt-4o:extended",name:"OpenAI: GPT-4o (extended)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:6,output:18,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"openai/gpt-5":{id:"openai/gpt-5",name:"OpenAI: GPT-5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"OpenAI: GPT-5 Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-image":{id:"openai/gpt-5-image",name:"OpenAI: GPT-5 Image",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-image-mini":{id:"openai/gpt-5-image-mini",name:"OpenAI: GPT-5 Image Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2.5,output:2,cacheRead:.25,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"OpenAI: GPT-5 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"OpenAI: GPT-5 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"OpenAI: GPT-5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1":{id:"openai/gpt-5.1",name:"OpenAI: GPT-5.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-chat":{id:"openai/gpt-5.1-chat",name:"OpenAI: GPT-5.1 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"OpenAI: GPT-5.1-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"OpenAI: GPT-5.1-Codex-Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"OpenAI: GPT-5.1-Codex-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:1e5},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"OpenAI: GPT-5.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"OpenAI: GPT-5.2 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"OpenAI: GPT-5.2-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"OpenAI: GPT-5.2 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"OpenAI: GPT-5.3 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"OpenAI: GPT-5.3-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"OpenAI: GPT-5.4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"OpenAI: GPT-5.4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"OpenAI: GPT-5.4 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"OpenAI: GPT-5.4 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"OpenAI: gpt-oss-120b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.039,output:.19,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"openai/gpt-oss-120b:free":{id:"openai/gpt-oss-120b:free",name:"OpenAI: gpt-oss-120b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"OpenAI: gpt-oss-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.03,output:.11,cacheRead:.015,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b:free":{id:"openai/gpt-oss-20b:free",name:"OpenAI: gpt-oss-20b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"OpenAI: gpt-oss-safeguard-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"OpenAI: o1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"OpenAI: o3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"OpenAI: o3 Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"OpenAI: o3 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini-high":{id:"openai/o3-mini-high",name:"OpenAI: o3 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"OpenAI: o3 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"OpenAI: o4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-deep-research":{id:"openai/o4-mini-deep-research",name:"OpenAI: o4 Mini Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-high":{id:"openai/o4-mini-high",name:"OpenAI: o4 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openrouter/auto":{id:"openrouter/auto",name:"Auto Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:-1e6,output:-1e6,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"openrouter/free":{id:"openrouter/free",name:"Free Models Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:4096},"prime-intellect/intellect-3":{id:"prime-intellect/intellect-3",name:"Prime Intellect: INTELLECT-3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen-2.5-72b-instruct":{id:"qwen/qwen-2.5-72b-instruct",name:"Qwen2.5 72B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.12,output:.39,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:16384},"qwen/qwen-2.5-7b-instruct":{id:"qwen/qwen-2.5-7b-instruct",name:"Qwen: Qwen2.5 7B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.04,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:4096},"qwen/qwen-max":{id:"qwen/qwen-max",name:"Qwen: Qwen-Max ",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1.04,output:4.16,cacheRead:.20800000000000002,cacheWrite:0},contextWindow:32768,maxTokens:8192},"qwen/qwen-plus":{id:"qwen/qwen-plus",name:"Qwen: Qwen-Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:.052000000000000005,cacheWrite:0},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28":{id:"qwen/qwen-plus-2025-07-28",name:"Qwen: Qwen Plus 0728",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28:thinking":{id:"qwen/qwen-plus-2025-07-28:thinking",name:"Qwen: Qwen Plus 0728 (thinking)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:32768},"qwen/qwen-turbo":{id:"qwen/qwen-turbo",name:"Qwen: Qwen-Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.0325,output:.13,cacheRead:.006500000000000001,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen-vl-max":{id:"qwen/qwen-vl-max",name:"Qwen: Qwen VL Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.52,output:2.08,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-14b":{id:"qwen/qwen3-14b",name:"Qwen: Qwen3 14B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:40960},"qwen/qwen3-235b-a22b":{id:"qwen/qwen3-235b-a22b",name:"Qwen: Qwen3 235B A22B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.45499999999999996,output:1.8199999999999998,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen3-235b-a22b-2507":{id:"qwen/qwen3-235b-a22b-2507",name:"Qwen: Qwen3 235B A22B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.071,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-235b-a22b-thinking-2507":{id:"qwen/qwen3-235b-a22b-thinking-2507",name:"Qwen: Qwen3 235B A22B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.14950000000000002,output:1.495,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"qwen/qwen3-30b-a3b":{id:"qwen/qwen3-30b-a3b",name:"Qwen: Qwen3 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.28,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:40960},"qwen/qwen3-30b-a3b-instruct-2507":{id:"qwen/qwen3-30b-a3b-instruct-2507",name:"Qwen: Qwen3 30B A3B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3-30b-a3b-thinking-2507":{id:"qwen/qwen3-30b-a3b-thinking-2507",name:"Qwen: Qwen3 30B A3B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.39999999999999997,cacheRead:.08,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen: Qwen3 32B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.24,cacheRead:.04,cacheWrite:0},contextWindow:40960,maxTokens:40960},"qwen/qwen3-4b:free":{id:"qwen/qwen3-4b:free",name:"Qwen: Qwen3 4B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:4096},"qwen/qwen3-8b":{id:"qwen/qwen3-8b",name:"Qwen: Qwen3 8B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:40960,maxTokens:8192},"qwen/qwen3-coder":{id:"qwen/qwen3-coder",name:"Qwen: Qwen3 Coder 480B A35B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.22,output:1,cacheRead:.022,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-coder-30b-a3b-instruct":{id:"qwen/qwen3-coder-30b-a3b-instruct",name:"Qwen: Qwen3 Coder 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.07,output:.27,cacheRead:0,cacheWrite:0},contextWindow:16e4,maxTokens:32768},"qwen/qwen3-coder-flash":{id:"qwen/qwen3-coder-flash",name:"Qwen: Qwen3 Coder Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.195,output:.975,cacheRead:.039,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder-next":{id:"qwen/qwen3-coder-next",name:"Qwen: Qwen3 Coder Next",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.12,output:.75,cacheRead:.06,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3-coder-plus":{id:"qwen/qwen3-coder-plus",name:"Qwen: Qwen3 Coder Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.65,output:3.25,cacheRead:.13,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder:free":{id:"qwen/qwen3-coder:free",name:"Qwen: Qwen3 Coder 480B A35B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"qwen/qwen3-max":{id:"qwen/qwen3-max",name:"Qwen: Qwen3 Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.78,output:3.9,cacheRead:.156,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-max-thinking":{id:"qwen/qwen3-max-thinking",name:"Qwen: Qwen3 Max Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.78,output:3.9,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-next-80b-a3b-instruct":{id:"qwen/qwen3-next-80b-a3b-instruct",name:"Qwen: Qwen3 Next 80B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-next-80b-a3b-instruct:free":{id:"qwen/qwen3-next-80b-a3b-instruct:free",name:"Qwen: Qwen3 Next 80B A3B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-next-80b-a3b-thinking":{id:"qwen/qwen3-next-80b-a3b-thinking",name:"Qwen: Qwen3 Next 80B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.0975,output:.78,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-235b-a22b-instruct":{id:"qwen/qwen3-vl-235b-a22b-instruct",name:"Qwen: Qwen3 VL 235B A22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.19999999999999998,output:.88,cacheRead:.11,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-vl-235b-a22b-thinking":{id:"qwen/qwen3-vl-235b-a22b-thinking",name:"Qwen: Qwen3 VL 235B A22B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-instruct":{id:"qwen/qwen3-vl-30b-a3b-instruct",name:"Qwen: Qwen3 VL 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.13,output:.52,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-thinking":{id:"qwen/qwen3-vl-30b-a3b-thinking",name:"Qwen: Qwen3 VL 30B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.13,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-32b-instruct":{id:"qwen/qwen3-vl-32b-instruct",name:"Qwen: Qwen3 VL 32B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.10400000000000001,output:.41600000000000004,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-8b-instruct":{id:"qwen/qwen3-vl-8b-instruct",name:"Qwen: Qwen3 VL 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.5,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-8b-thinking":{id:"qwen/qwen3-vl-8b-thinking",name:"Qwen: Qwen3 VL 8B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.117,output:1.365,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3.5-122b-a10b":{id:"qwen/qwen3.5-122b-a10b",name:"Qwen: Qwen3.5-122B-A10B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.08,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-27b":{id:"qwen/qwen3.5-27b",name:"Qwen: Qwen3.5-27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.195,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-35b-a3b":{id:"qwen/qwen3.5-35b-a3b",name:"Qwen: Qwen3.5-35B-A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1625,output:1.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-397b-a17b":{id:"qwen/qwen3.5-397b-a17b",name:"Qwen: Qwen3.5 397B A17B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.39,output:2.34,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-9b":{id:"qwen/qwen3.5-9b",name:"Qwen: Qwen3.5-9B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.049999999999999996,output:.15,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"qwen/qwen3.5-flash-02-23":{id:"qwen/qwen3.5-flash-02-23",name:"Qwen: Qwen3.5-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.065,output:.26,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.5-plus-02-15":{id:"qwen/qwen3.5-plus-02-15",name:"Qwen: Qwen3.5 Plus 2026-02-15",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwq-32b":{id:"qwen/qwq-32b",name:"Qwen: QwQ 32B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.58,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"relace/relace-search":{id:"relace/relace-search",name:"Relace: Relace Search",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:128e3},"sao10k/l3-euryale-70b":{id:"sao10k/l3-euryale-70b",name:"Sao10k: Llama 3 Euryale 70B v2.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1.48,output:1.48,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"sao10k/l3.1-euryale-70b":{id:"sao10k/l3.1-euryale-70b",name:"Sao10K: Llama 3.1 Euryale 70B v2.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.85,output:.85,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"stepfun/step-3.5-flash":{id:"stepfun/step-3.5-flash",name:"StepFun: Step 3.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"stepfun/step-3.5-flash:free":{id:"stepfun/step-3.5-flash:free",name:"StepFun: Step 3.5 Flash (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"thedrummer/rocinante-12b":{id:"thedrummer/rocinante-12b",name:"TheDrummer: Rocinante 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.16999999999999998,output:.43,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"thedrummer/unslopnemo-12b":{id:"thedrummer/unslopnemo-12b",name:"TheDrummer: UnslopNemo 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"tngtech/deepseek-r1t2-chimera":{id:"tngtech/deepseek-r1t2-chimera",name:"TNG: DeepSeek R1T2 Chimera",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.3,output:1.1,cacheRead:.15,cacheWrite:0},contextWindow:163840,maxTokens:163840},"upstage/solar-pro-3":{id:"upstage/solar-pro-3",name:"Upstage: Solar Pro 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"x-ai/grok-3":{id:"x-ai/grok-3",name:"xAI: Grok 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:4096},"x-ai/grok-3-beta":{id:"x-ai/grok-3-beta",name:"xAI: Grok 3 Beta",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:4096},"x-ai/grok-3-mini":{id:"x-ai/grok-3-mini",name:"xAI: Grok 3 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:4096},"x-ai/grok-3-mini-beta":{id:"x-ai/grok-3-mini-beta",name:"xAI: Grok 3 Mini Beta",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:4096},"x-ai/grok-4":{id:"x-ai/grok-4",name:"xAI: Grok 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"x-ai/grok-4-fast":{id:"x-ai/grok-4-fast",name:"xAI: Grok 4 Fast",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"x-ai/grok-4.1-fast":{id:"x-ai/grok-4.1-fast",name:"xAI: Grok 4.1 Fast",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"x-ai/grok-4.20-beta":{id:"x-ai/grok-4.20-beta",name:"xAI: Grok 4.20 Beta",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"x-ai/grok-code-fast-1":{id:"x-ai/grok-code-fast-1",name:"xAI: Grok Code Fast 1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.5,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:1e4},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"Xiaomi: MiMo-V2-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.29,cacheRead:.045,cacheWrite:0},contextWindow:262144,maxTokens:65536},"xiaomi/mimo-v2-omni":{id:"xiaomi/mimo-v2-omni",name:"Xiaomi: MiMo-V2-Omni",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"xiaomi/mimo-v2-pro":{id:"xiaomi/mimo-v2-pro",name:"Xiaomi: MiMo-V2-Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"z-ai/glm-4-32b":{id:"z-ai/glm-4-32b",name:"Z.ai: GLM 4 32B ",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"z-ai/glm-4.5":{id:"z-ai/glm-4.5",name:"Z.ai: GLM 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:131072,maxTokens:98304},"z-ai/glm-4.5-air":{id:"z-ai/glm-4.5-air",name:"Z.ai: GLM 4.5 Air",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.13,output:.85,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:131072,maxTokens:98304},"z-ai/glm-4.5-air:free":{id:"z-ai/glm-4.5-air:free",name:"Z.ai: GLM 4.5 Air (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:96e3},"z-ai/glm-4.5v":{id:"z-ai/glm-4.5v",name:"Z.ai: GLM 4.5V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:1.7999999999999998,cacheRead:.11,cacheWrite:0},contextWindow:65536,maxTokens:16384},"z-ai/glm-4.6":{id:"z-ai/glm-4.6",name:"Z.ai: GLM 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.39,output:1.9,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:204800},"z-ai/glm-4.6v":{id:"z-ai/glm-4.6v",name:"Z.ai: GLM 4.6V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:.8999999999999999,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"z-ai/glm-4.7":{id:"z-ai/glm-4.7",name:"Z.ai: GLM 4.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.39,output:1.75,cacheRead:.195,cacheWrite:0},contextWindow:202752,maxTokens:65535},"z-ai/glm-4.7-flash":{id:"z-ai/glm-4.7-flash",name:"Z.ai: GLM 4.7 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.06,output:.39999999999999997,cacheRead:.0100000002,cacheWrite:0},contextWindow:202752,maxTokens:4096},"z-ai/glm-5":{id:"z-ai/glm-5",name:"Z.ai: GLM 5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:1.9,cacheRead:.119,cacheWrite:0},contextWindow:8e4,maxTokens:131072},"z-ai/glm-5-turbo":{id:"z-ai/glm-5-turbo",name:"Z.ai: GLM 5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.96,output:3.1999999999999997,cacheRead:.192,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"vercel-ai-gateway":{"alibaba/qwen-3-14b":{id:"alibaba/qwen-3-14b",name:"Qwen3-14B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.12,output:.24,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-235b":{id:"alibaba/qwen-3-235b",name:"Qwen3-235B-A22B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.071,output:.463,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-30b":{id:"alibaba/qwen-3-30b",name:"Qwen3-30B-A3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.08,output:.29,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-32b":{id:"alibaba/qwen-3-32b",name:"Qwen 3 32B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.29,output:.59,cacheRead:.145,cacheWrite:0},contextWindow:131072,maxTokens:40960},"alibaba/qwen3-235b-a22b-thinking":{id:"alibaba/qwen3-235b-a22b-thinking",name:"Qwen3 235B A22B Thinking 2507",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.22999999999999998,output:2.3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:262114,maxTokens:262114},"alibaba/qwen3-coder":{id:"alibaba/qwen3-coder",name:"Qwen3 Coder 480B A35B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:1.5999999999999999,cacheRead:.022,cacheWrite:0},contextWindow:262144,maxTokens:66536},"alibaba/qwen3-coder-30b-a3b":{id:"alibaba/qwen3-coder-30b-a3b",name:"Qwen 3 Coder 30B A3B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:8192},"alibaba/qwen3-coder-next":{id:"alibaba/qwen3-coder-next",name:"Qwen3 Coder Next",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.5,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3-coder-plus":{id:"alibaba/qwen3-coder-plus",name:"Qwen3 Coder Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1,output:5,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"alibaba/qwen3-max":{id:"alibaba/qwen3-max",name:"Qwen3 Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-preview":{id:"alibaba/qwen3-max-preview",name:"Qwen3 Max Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-thinking":{id:"alibaba/qwen3-max-thinking",name:"Qwen 3 Max Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"alibaba/qwen3-vl-thinking":{id:"alibaba/qwen3-vl-thinking",name:"Qwen3 VL 235B A22B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3.5-flash":{id:"alibaba/qwen3.5-flash",name:"Qwen 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.001,cacheWrite:.125},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.5-plus":{id:"alibaba/qwen3.5-plus",name:"Qwen 3.5 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.39999999999999997,output:2.4,cacheRead:.04,cacheWrite:.5},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Claude 3 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Claude 3.5 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.7999999999999999,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-3.5-sonnet":{id:"anthropic/claude-3.5-sonnet",name:"Claude 3.5 Sonnet",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic/claude-3.5-sonnet-20240620":{id:"anthropic/claude-3.5-sonnet-20240620",name:"Claude 3.5 Sonnet (2024-06-20)",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic/claude-3.7-sonnet":{id:"anthropic/claude-3.7-sonnet",name:"Claude 3.7 Sonnet",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.09999999999999999,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Claude Opus 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-preview":{id:"arcee-ai/trinity-large-preview",name:"Trinity Large Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:131e3},"bytedance/seed-1.6":{id:"bytedance/seed-1.6",name:"Seed 1.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:2,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:256e3,maxTokens:32e3},"cohere/command-a":{id:"cohere/command-a",name:"Command A",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8e3},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek-R1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"deepseek/deepseek-v3":{id:"deepseek/deepseek-v3",name:"DeepSeek V3 0324",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.77,output:.77,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-v3.1":{id:"deepseek/deepseek-v3.1",name:"DeepSeek-V3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek V3.1 Terminus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.27,output:1,cacheRead:.135,cacheWrite:0},contextWindow:131072,maxTokens:65536},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek V3.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.28,output:.42,cacheRead:.028,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"deepseek/deepseek-v3.2-thinking":{id:"deepseek/deepseek-v3.2-thinking",name:"DeepSeek V3.2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.28,output:.42,cacheRead:.028,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"google/gemini-2.0-flash":{id:"google/gemini-2.0-flash",name:"Gemini 2.0 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.0-flash-lite":{id:"google/gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.02,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-3-flash":{id:"google/gemini-3-flash",name:"Gemini 3 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3-pro-preview":{id:"google/gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"inception/mercury-2":{id:"inception/mercury-2",name:"Mercury 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:.75,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"inception/mercury-coder-small":{id:"inception/mercury-coder-small",name:"Mercury Coder Small Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:16384},"meituan/longcat-flash-chat":{id:"meituan/longcat-flash-chat",name:"LongCat Flash Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:1e5},"meituan/longcat-flash-thinking":{id:"meituan/longcat-flash-thinking",name:"LongCat Flash Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.1-70b":{id:"meta/llama-3.1-70b",name:"Llama 3.1 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.1-8b":{id:"meta/llama-3.1-8b",name:"Llama 3.1 8B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"meta/llama-3.2-11b":{id:"meta/llama-3.2-11b",name:"Llama 3.2 11B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.16,output:.16,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.2-90b":{id:"meta/llama-3.2-90b",name:"Llama 3.2 90B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.3-70b":{id:"meta/llama-3.3-70b",name:"Llama 3.3 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-maverick":{id:"meta/llama-4-maverick",name:"Llama 4 Maverick 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.24,output:.9700000000000001,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-scout":{id:"meta/llama-4-scout",name:"Llama 4 Scout 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.16999999999999998,output:.66,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax M2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:205e3,maxTokens:205e3},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax M2.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.1-lightning":{id:"minimax/minimax-m2.1-lightning",name:"MiniMax M2.1 Lightning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax M2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.5-highspeed":{id:"minimax/minimax-m2.5-highspeed",name:"MiniMax M2.5 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"Minimax M2.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7-highspeed":{id:"minimax/minimax-m2.7-highspeed",name:"MiniMax M2.7 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131100},"mistral/codestral":{id:"mistral/codestral",name:"Mistral Codestral",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.3,output:.8999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/devstral-2":{id:"mistral/devstral-2",name:"Devstral 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.39999999999999997,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/devstral-small":{id:"mistral/devstral-small",name:"Devstral Small 1.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/devstral-small-2":{id:"mistral/devstral-small-2",name:"Devstral Small 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/ministral-3b":{id:"mistral/ministral-3b",name:"Ministral 3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.09999999999999999,output:.09999999999999999,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/ministral-8b":{id:"mistral/ministral-8b",name:"Ministral 8B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/mistral-medium":{id:"mistral/mistral-medium",name:"Mistral Medium 3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/mistral-small":{id:"mistral/mistral-small",name:"Mistral Small",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.3,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:4e3},"mistral/pixtral-12b":{id:"mistral/pixtral-12b",name:"Pixtral 12B 2409",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/pixtral-large":{id:"mistral/pixtral-large",name:"Pixtral Large",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"Kimi K2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/kimi-k2-0905":{id:"moonshotai/kimi-k2-0905",name:"Kimi K2 0905",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2-thinking-turbo":{id:"moonshotai/kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2-turbo":{id:"moonshotai/kimi-k2-turbo",name:"Kimi K2 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:262114,maxTokens:262114},"nvidia/nemotron-nano-12b-v2-vl":{id:"nvidia/nemotron-nano-12b-v2-vl",name:"Nvidia Nemotron Nano 12B V2 VL",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"nvidia/nemotron-nano-9b-v2":{id:"nvidia/nemotron-nano-9b-v2",name:"Nvidia Nemotron Nano 9B V2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.22999999999999998,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"GPT-4 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"GPT-4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"GPT-4.1 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.39999999999999997,output:1.5999999999999999,cacheRead:.09999999999999999,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"GPT-4.1 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.09999999999999999,output:.39999999999999997,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"GPT-4o",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"GPT-4o mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5":{id:"openai/gpt-5",name:"GPT-5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-chat":{id:"openai/gpt-5-chat",name:"GPT 5 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"GPT-5-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"GPT-5 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"GPT-5 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.049999999999999996,output:.39999999999999997,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"GPT-5 pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"GPT-5.1-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"GPT 5.1 Codex Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"GPT 5.1 Codex Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.024999999999999998,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-instant":{id:"openai/gpt-5.1-instant",name:"GPT-5.1 Instant",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.1-thinking":{id:"openai/gpt-5.1-thinking",name:"GPT 5.1 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"GPT 5.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"GPT 5.2 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"GPT 5.2 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"GPT 5.2 ",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"GPT-5.3 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"GPT 5.3 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"GPT 5.4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"GPT 5.4 Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"GPT 5.4 Nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.19999999999999998,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"GPT 5.4 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"gpt-oss-20b",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.07,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"gpt-oss-safeguard-20b",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"o1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"o3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"o3-deep-research",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"o3-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"o3 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"o4-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"perplexity/sonar":{id:"perplexity/sonar",name:"Sonar",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:1,output:1,cacheRead:0,cacheWrite:0},contextWindow:127e3,maxTokens:8e3},"perplexity/sonar-pro":{id:"perplexity/sonar-pro",name:"Sonar Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:8e3},"prime-intellect/intellect-3":{id:"prime-intellect/intellect-3",name:"INTELLECT 3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"xai/grok-2-vision":{id:"xai/grok-2-vision",name:"Grok 2 Vision",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"xai/grok-3":{id:"xai/grok-3",name:"Grok 3 Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:131072},"xai/grok-3-fast":{id:"xai/grok-3-fast",name:"Grok 3 Fast Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:5,output:25,cacheRead:1.25,cacheWrite:0},contextWindow:131072,maxTokens:131072},"xai/grok-3-mini":{id:"xai/grok-3-mini",name:"Grok 3 Mini Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:131072},"xai/grok-3-mini-fast":{id:"xai/grok-3-mini-fast",name:"Grok 3 Mini Fast Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.6,output:4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"xai/grok-4":{id:"xai/grok-4",name:"Grok 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"xai/grok-4-fast-non-reasoning":{id:"xai/grok-4-fast-non-reasoning",name:"Grok 4 Fast Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:256e3},"xai/grok-4-fast-reasoning":{id:"xai/grok-4-fast-reasoning",name:"Grok 4 Fast Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:256e3},"xai/grok-4.1-fast-non-reasoning":{id:"xai/grok-4.1-fast-non-reasoning",name:"Grok 4.1 Fast Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"xai/grok-4.1-fast-reasoning":{id:"xai/grok-4.1-fast-reasoning",name:"Grok 4.1 Fast Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:.5,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"xai/grok-4.20-multi-agent-beta":{id:"xai/grok-4.20-multi-agent-beta",name:"Grok 4.20 Multi Agent Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-non-reasoning-beta":{id:"xai/grok-4.20-non-reasoning-beta",name:"Grok 4.20 Beta Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-reasoning-beta":{id:"xai/grok-4.20-reasoning-beta",name:"Grok 4.20 Beta Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-code-fast-1":{id:"xai/grok-code-fast-1",name:"Grok Code Fast 1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.5,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"MiMo V2 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.09999999999999999,output:.3,cacheRead:.02,cacheWrite:0},contextWindow:262144,maxTokens:32e3},"xiaomi/mimo-v2-pro":{id:"xiaomi/mimo-v2-pro",name:"MiMo V2 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"zai/glm-4.5":{id:"zai/glm-4.5",name:"GLM-4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5-air":{id:"zai/glm-4.5-air",name:"GLM 4.5 Air",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.19999999999999998,output:1.1,cacheRead:.03,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5v":{id:"zai/glm-4.5v",name:"GLM 4.5V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.6,output:1.7999999999999998,cacheRead:.11,cacheWrite:0},contextWindow:66e3,maxTokens:16e3},"zai/glm-4.6":{id:"zai/glm-4.6",name:"GLM 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:2e5,maxTokens:96e3},"zai/glm-4.6v":{id:"zai/glm-4.6v",name:"GLM-4.6V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:.8999999999999999,cacheRead:.049999999999999996,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.6v-flash":{id:"zai/glm-4.6v-flash",name:"GLM-4.6V-Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.7":{id:"zai/glm-4.7",name:"GLM 4.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:12e4},"zai/glm-4.7-flash":{id:"zai/glm-4.7-flash",name:"GLM 4.7 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.07,output:.39999999999999997,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131e3},"zai/glm-4.7-flashx":{id:"zai/glm-4.7-flashx",name:"GLM 4.7 FlashX",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.39999999999999997,cacheRead:.01,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai/glm-5":{id:"zai/glm-5",name:"GLM 5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3.1999999999999997,cacheRead:.19999999999999998,cacheWrite:0},contextWindow:202800,maxTokens:131100},"zai/glm-5-turbo":{id:"zai/glm-5-turbo",name:"GLM 5 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:202800,maxTokens:131100}},xai:{"grok-2":{id:"grok-2",name:"Grok 2",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-1212":{id:"grok-2-1212",name:"Grok 2 (1212)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-latest":{id:"grok-2-latest",name:"Grok 2 Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-2-vision":{id:"grok-2-vision",name:"Grok 2 Vision",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-2-vision-1212":{id:"grok-2-vision-1212",name:"Grok 2 Vision (1212)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-2-vision-latest":{id:"grok-2-vision-latest",name:"Grok 2 Vision Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:10,cacheRead:2,cacheWrite:0},contextWindow:8192,maxTokens:4096},"grok-3":{id:"grok-3",name:"Grok 3",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-fast":{id:"grok-3-fast",name:"Grok 3 Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:25,cacheRead:1.25,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-fast-latest":{id:"grok-3-fast-latest",name:"Grok 3 Fast Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:25,cacheRead:1.25,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-latest":{id:"grok-3-latest",name:"Grok 3 Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-mini":{id:"grok-3-mini",name:"Grok 3 Mini",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-mini-fast":{id:"grok-3-mini-fast",name:"Grok 3 Mini Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:.6,output:4,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-mini-fast-latest":{id:"grok-3-mini-fast-latest",name:"Grok 3 Mini Fast Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:.6,output:4,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-mini-latest":{id:"grok-3-mini-latest",name:"Grok 3 Mini Latest",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-4":{id:"grok-4",name:"Grok 4",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:256e3,maxTokens:64e3},"grok-4-1-fast":{id:"grok-4-1-fast",name:"Grok 4.1 Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4-1-fast-non-reasoning":{id:"grok-4-1-fast-non-reasoning",name:"Grok 4.1 Fast (Non-Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4-fast":{id:"grok-4-fast",name:"Grok 4 Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4-fast-non-reasoning":{id:"grok-4-fast-non-reasoning",name:"Grok 4 Fast (Non-Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4.20-0309-non-reasoning":{id:"grok-4.20-0309-non-reasoning",name:"Grok 4.20 (Non-Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-4.20-0309-reasoning":{id:"grok-4.20-0309-reasoning",name:"Grok 4.20 (Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"grok-beta":{id:"grok-beta",name:"Grok Beta",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:15,cacheRead:5,cacheWrite:0},contextWindow:131072,maxTokens:4096},"grok-code-fast-1":{id:"grok-code-fast-1",name:"Grok Code Fast 1",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text"],cost:{input:.2,output:1.5,cacheRead:.02,cacheWrite:0},contextWindow:256e3,maxTokens:1e4},"grok-vision-beta":{id:"grok-vision-beta",name:"Grok Vision Beta",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:5,cacheWrite:0},contextWindow:8192,maxTokens:4096}},zai:{"glm-4.5":{id:"glm-4.5",name:"GLM-4.5",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.5-air":{id:"glm-4.5-air",name:"GLM-4.5-Air",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:.2,output:1.1,cacheRead:.03,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.5-flash":{id:"glm-4.5-flash",name:"GLM-4.5-Flash",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.5v":{id:"glm-4.5v",name:"GLM-4.5V",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text","image"],cost:{input:.6,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:64e3,maxTokens:16384},"glm-4.6":{id:"glm-4.6",name:"GLM-4.6",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-4.6v":{id:"glm-4.6v",name:"GLM-4.6V",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text","image"],cost:{input:.3,output:.9,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"glm-4.7":{id:"glm-4.7",name:"GLM-4.7",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-4.7-flash":{id:"glm-4.7-flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5-turbo":{id:"glm-5-turbo",name:"GLM-5-Turbo",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:2e5,maxTokens:131072}}},sf=new Map;for(const[t,e]of Object.entries(WD)){const n=new Map;for(const[r,i]of Object.entries(e))n.set(r,i);sf.set(t,n)}function IE(t,e){return sf.get(t)?.get(e)}function Zv(){return Array.from(sf.keys())}function o0(t){const e=sf.get(t);return e?Array.from(e.values()):[]}function BD(t,e){return e.cost.input=t.cost.input/1e6*e.input,e.cost.output=t.cost.output/1e6*e.output,e.cost.cacheRead=t.cost.cacheRead/1e6*e.cacheRead,e.cost.cacheWrite=t.cost.cacheWrite/1e6*e.cacheWrite,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite,e.cost}function kue(t){return!!(t.id.includes("gpt-5.2")||t.id.includes("gpt-5.3")||t.id.includes("gpt-5.4")||t.id.includes("opus-4-6")||t.id.includes("opus-4.6"))}class zD{isComplete;extractResult;queue=[];waiting=[];done=!1;finalResultPromise;resolveFinalResult;constructor(e,n){this.isComplete=e,this.extractResult=n,this.finalResultPromise=new Promise(r=>{this.resolveFinalResult=r})}push(e){if(this.done)return;this.isComplete(e)&&(this.done=!0,this.resolveFinalResult(this.extractResult(e)));const n=this.waiting.shift();n?n({value:e,done:!1}):this.queue.push(e)}end(e){for(this.done=!0,e!==void 0&&this.resolveFinalResult(e);this.waiting.length>0;)this.waiting.shift()({value:void 0,done:!0})}async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.shift();else{if(this.done)return;{const e=await new Promise(n=>this.waiting.push(n));if(e.done)return;yield e.value}}}result(){return this.finalResultPromise}}class Kv extends zD{constructor(){super(e=>e.type==="done"||e.type==="error",e=>{if(e.type==="done")return e.message;if(e.type==="error")return e.error;throw new Error("Unexpected event type for final result")})}}function Jv(){return new Kv}const qD=t=>import(t);let ex,tx,nx,rx,ix,ax,sx,ox,lx,cx;function RE(t,e){(async()=>{for await(const n of e)t.push(n);t.end()})()}function $E(t,e){return{role:"assistant",content:[],api:t.api,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:e instanceof Error?e.message:String(e),timestamp:Date.now()}}function Pa(t){return(e,n,r)=>{const i=new Kv;return t().then(a=>{const s=a.stream(e,n,r);RE(i,s)}).catch(a=>{const s=$E(e,a);i.push({type:"error",reason:"error",error:s}),i.end(s)}),i}}function Oa(t){return(e,n,r)=>{const i=new Kv;return t().then(a=>{const s=a.streamSimple(e,n,r);RE(i,s)}).catch(a=>{const s=$E(e,a);i.push({type:"error",reason:"error",error:s}),i.end(s)}),i}}function NE(){return ex||=Vt(()=>import("./anthropic-DuWlRZpT.js"),__vite__mapDeps([0,1,2,3])).then(t=>{const e=t;return{stream:e.streamAnthropic,streamSimple:e.streamSimpleAnthropic}}),ex}function PE(){return tx||=Vt(()=>import("./azure-openai-responses-Mf18OBAm.js"),__vite__mapDeps([4,5,6,7,1,2])).then(t=>{const e=t;return{stream:e.streamAzureOpenAIResponses,streamSimple:e.streamSimpleAzureOpenAIResponses}}),tx}function OE(){return nx||=Vt(()=>import("./google-dnYjk8Fg.js"),__vite__mapDeps([8,9,2])).then(t=>{const e=t;return{stream:e.streamGoogle,streamSimple:e.streamSimpleGoogle}}),nx}function ME(){return rx||=Vt(()=>import("./google-gemini-cli-CW5TUXrG.js"),__vite__mapDeps([10,2,9])).then(t=>{const e=t;return{stream:e.streamGoogleGeminiCli,streamSimple:e.streamSimpleGoogleGeminiCli}}),rx}function LE(){return ix||=Vt(()=>import("./google-vertex-Cvd06MOV.js"),__vite__mapDeps([11,9,2])).then(t=>{const e=t;return{stream:e.streamGoogleVertex,streamSimple:e.streamSimpleGoogleVertex}}),ix}function DE(){return ax||=Vt(()=>import("./mistral-CqzEB3Wd.js"),__vite__mapDeps([12,7,1,2])).then(t=>{const e=t;return{stream:e.streamMistral,streamSimple:e.streamSimpleMistral}}),ax}function FE(){return sx||=Vt(()=>import("./openai-codex-responses-DjhHU788.js"),__vite__mapDeps([13,6,7,1,2])).then(t=>{const e=t;return{stream:e.streamOpenAICodexResponses,streamSimple:e.streamSimpleOpenAICodexResponses}}),sx}function UE(){return ox||=Vt(()=>import("./openai-completions-DI3BzoVD.js"),__vite__mapDeps([14,5,1,2,3])).then(t=>{const e=t;return{stream:e.streamOpenAICompletions,streamSimple:e.streamSimpleOpenAICompletions}}),ox}function WE(){return lx||=Vt(()=>import("./openai-responses-CDRmRVXg.js"),__vite__mapDeps([15,5,3,6,7,1,2])).then(t=>{const e=t;return{stream:e.streamOpenAIResponses,streamSimple:e.streamSimpleOpenAIResponses}}),lx}function BE(){return cx||=qD("./amazon-bedrock.js").then(t=>{const e=t;return{stream:e.streamBedrock,streamSimple:e.streamSimpleBedrock}}),cx}const zE=Pa(NE),qE=Oa(NE),jD=Pa(PE),GD=Oa(PE),HD=Pa(OE),VD=Oa(OE),ZD=Pa(ME),KD=Oa(ME),JD=Pa(LE),QD=Oa(LE),YD=Pa(DE),XD=Oa(DE),eF=Pa(FE),tF=Oa(FE),jE=Pa(UE),GE=Oa(UE),nF=Pa(WE),rF=Oa(WE),iF=Pa(BE),aF=Oa(BE);function sF(){Ei({api:"anthropic-messages",stream:zE,streamSimple:qE}),Ei({api:"openai-completions",stream:jE,streamSimple:GE}),Ei({api:"mistral-conversations",stream:YD,streamSimple:XD}),Ei({api:"openai-responses",stream:nF,streamSimple:rF}),Ei({api:"azure-openai-responses",stream:jD,streamSimple:GD}),Ei({api:"openai-codex-responses",stream:eF,streamSimple:tF}),Ei({api:"google-generative-ai",stream:HD,streamSimple:VD}),Ei({api:"google-gemini-cli",stream:ZD,streamSimple:KD}),Ei({api:"google-vertex",stream:JD,streamSimple:QD}),Ei({api:"bedrock-converse-stream",stream:iF,streamSimple:aF})}sF();function oF(t){const e=MD(t);if(!e)throw new Error(`No API provider registered for api: ${t}`);return e}function Qv(t,e,n){return oF(t.api).streamSimple(t,e,n)}async function lF(t,e,n){return Qv(t,e,n).result()}function Yv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function cF(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Js={},kh={},ux;function dx(){return ux||(ux=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Allow=t.ALL=t.COLLECTION=t.ATOM=t.SPECIAL=t.INF=t._INFINITY=t.INFINITY=t.NAN=t.BOOL=t.NULL=t.OBJ=t.ARR=t.NUM=t.STR=void 0,t.STR=1,t.NUM=2,t.ARR=4,t.OBJ=8,t.NULL=16,t.BOOL=32,t.NAN=64,t.INFINITY=128,t._INFINITY=256,t.INF=t.INFINITY|t._INFINITY,t.SPECIAL=t.NULL|t.BOOL|t.INF|t.NAN,t.ATOM=t.STR|t.NUM|t.SPECIAL,t.COLLECTION=t.ARR|t.OBJ,t.ALL=t.ATOM|t.COLLECTION,t.Allow={STR:t.STR,NUM:t.NUM,ARR:t.ARR,OBJ:t.OBJ,NULL:t.NULL,BOOL:t.BOOL,NAN:t.NAN,INFINITY:t.INFINITY,_INFINITY:t._INFINITY,INF:t.INF,SPECIAL:t.SPECIAL,ATOM:t.ATOM,COLLECTION:t.COLLECTION,ALL:t.ALL},t.default=t.Allow})(kh)),kh}var px;function uF(){return px||(px=1,(function(t){var e=Js&&Js.__createBinding||(Object.create?(function(c,u,d,p){p===void 0&&(p=d);var f=Object.getOwnPropertyDescriptor(u,d);(!f||("get"in f?!u.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return u[d]}}),Object.defineProperty(c,p,f)}):(function(c,u,d,p){p===void 0&&(p=d),c[p]=u[d]})),n=Js&&Js.__exportStar||function(c,u){for(var d in c)d!=="default"&&!Object.prototype.hasOwnProperty.call(u,d)&&e(u,c,d)};Object.defineProperty(t,"__esModule",{value:!0}),t.Allow=t.MalformedJSON=t.PartialJSON=t.parseJSON=t.parse=void 0;const r=dx();Object.defineProperty(t,"Allow",{enumerable:!0,get:function(){return r.Allow}}),n(dx(),t);class i extends Error{}t.PartialJSON=i;class a extends Error{}t.MalformedJSON=a;function s(c,u=r.Allow.ALL){if(typeof c!="string")throw new TypeError(`expecting str, got ${typeof c}`);if(!c.trim())throw new Error(`${c} is empty`);return o(c.trim(),u)}t.parseJSON=s;const o=(c,u)=>{const d=c.length;let p=0;const f=A=>{throw new i(`${A} at position ${p}`)},h=A=>{throw new a(`${A} at position ${p}`)},m=()=>(S(),p>=d&&f("Unexpected end of input"),c[p]==='"'?g():c[p]==="{"?v():c[p]==="["?y():c.substring(p,p+4)==="null"||r.Allow.NULL&u&&d-p<4&&"null".startsWith(c.substring(p))?(p+=4,null):c.substring(p,p+4)==="true"||r.Allow.BOOL&u&&d-p<4&&"true".startsWith(c.substring(p))?(p+=4,!0):c.substring(p,p+5)==="false"||r.Allow.BOOL&u&&d-p<5&&"false".startsWith(c.substring(p))?(p+=5,!1):c.substring(p,p+8)==="Infinity"||r.Allow.INFINITY&u&&d-p<8&&"Infinity".startsWith(c.substring(p))?(p+=8,1/0):c.substring(p,p+9)==="-Infinity"||r.Allow._INFINITY&u&&1<d-p&&d-p<9&&"-Infinity".startsWith(c.substring(p))?(p+=9,-1/0):c.substring(p,p+3)==="NaN"||r.Allow.NAN&u&&d-p<3&&"NaN".startsWith(c.substring(p))?(p+=3,NaN):b()),g=()=>{const A=p;let _=!1;for(p++;p<d&&(c[p]!=='"'||_&&c[p-1]==="\\");)_=c[p]==="\\"?!_:!1,p++;if(c.charAt(p)=='"')try{return JSON.parse(c.substring(A,++p-Number(_)))}catch(I){h(String(I))}else if(r.Allow.STR&u)try{return JSON.parse(c.substring(A,p-Number(_))+'"')}catch{return JSON.parse(c.substring(A,c.lastIndexOf("\\"))+'"')}f("Unterminated string literal")},v=()=>{p++,S();const A={};try{for(;c[p]!=="}";){if(S(),p>=d&&r.Allow.OBJ&u)return A;const _=g();S(),p++;try{const I=m();A[_]=I}catch(I){if(r.Allow.OBJ&u)return A;throw I}S(),c[p]===","&&p++}}catch{if(r.Allow.OBJ&u)return A;f("Expected '}' at end of object")}return p++,A},y=()=>{p++;const A=[];try{for(;c[p]!=="]";)A.push(m()),S(),c[p]===","&&p++}catch{if(r.Allow.ARR&u)return A;f("Expected ']' at end of array")}return p++,A},b=()=>{if(p===0){c==="-"&&h("Not sure what '-' is");try{return JSON.parse(c)}catch(_){if(r.Allow.NUM&u)try{return JSON.parse(c.substring(0,c.lastIndexOf("e")))}catch{}h(String(_))}}const A=p;for(c[p]==="-"&&p++;c[p]&&",]}".indexOf(c[p])===-1;)p++;p==d&&!(r.Allow.NUM&u)&&f("Unterminated number literal");try{return JSON.parse(c.substring(A,p))}catch{c.substring(A,p)==="-"&&f("Not sure what '-' is");try{return JSON.parse(c.substring(A,c.lastIndexOf("e")))}catch(I){h(String(I))}}},S=()=>{for(;p<d&&`
|
|
183
|
+
\r `.includes(c[p]);)p++};return m()},l=s;t.parse=l})(Js)),Js}var Eue=uF();const dF=[/prompt is too long/i,/input is too long for requested model/i,/exceeds the context window/i,/input token count.*exceeds the maximum/i,/maximum prompt length is \d+/i,/reduce the length of the messages/i,/maximum context length is \d+ tokens/i,/exceeds the limit of \d+/i,/exceeds the available context size/i,/greater than the context length/i,/context window exceeds limit/i,/exceeded model token limit/i,/too large for model with \d+ maximum context length/i,/model_context_window_exceeded/i,/context[_ ]length[_ ]exceeded/i,/too many tokens/i,/token limit exceeded/i];function pF(t,e){return!!(t.stopReason==="error"&&t.errorMessage&&(dF.some(n=>n.test(t.errorMessage))||/^4(00|13)\s*(status code)?\s*\(no body\)/i.test(t.errorMessage)))}var _u={exports:{}},Eh={},qa={},Qs={},Sh={},Ch={},Ah={},fx;function bp(){return fx||(fx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends e{constructor(y){if(super(),!t.IDENTIFIER.test(y))throw new Error("CodeGen: name must be a valid identifier");this.str=y}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class r extends e{constructor(y){super(),this._items=typeof y=="string"?[y]:y}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const y=this._items[0];return y===""||y==='""'}get str(){var y;return(y=this._str)!==null&&y!==void 0?y:this._str=this._items.reduce((b,S)=>`${b}${S}`,"")}get names(){var y;return(y=this._names)!==null&&y!==void 0?y:this._names=this._items.reduce((b,S)=>(S instanceof n&&(b[S.str]=(b[S.str]||0)+1),b),{})}}t._Code=r,t.nil=new r("");function i(v,...y){const b=[v[0]];let S=0;for(;S<y.length;)o(b,y[S]),b.push(v[++S]);return new r(b)}t._=i;const a=new r("+");function s(v,...y){const b=[f(v[0])];let S=0;for(;S<y.length;)b.push(a),o(b,y[S]),b.push(a,f(v[++S]));return l(b),new r(b)}t.str=s;function o(v,y){y instanceof r?v.push(...y._items):y instanceof n?v.push(y):v.push(d(y))}t.addCodeArg=o;function l(v){let y=1;for(;y<v.length-1;){if(v[y]===a){const b=c(v[y-1],v[y+1]);if(b!==void 0){v.splice(y-1,3,b);continue}v[y++]="+"}y++}}function c(v,y){if(y==='""')return v;if(v==='""')return y;if(typeof v=="string")return y instanceof n||v[v.length-1]!=='"'?void 0:typeof y!="string"?`${v.slice(0,-1)}${y}"`:y[0]==='"'?v.slice(0,-1)+y.slice(1):void 0;if(typeof y=="string"&&y[0]==='"'&&!(v instanceof n))return`"${v}${y.slice(1)}`}function u(v,y){return y.emptyStr()?v:v.emptyStr()?y:s`${v}${y}`}t.strConcat=u;function d(v){return typeof v=="number"||typeof v=="boolean"||v===null?v:f(Array.isArray(v)?v.join(","):v)}function p(v){return new r(f(v))}t.stringify=p;function f(v){return JSON.stringify(v).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=f;function h(v){return typeof v=="string"&&t.IDENTIFIER.test(v)?new r(`.${v}`):i`[${v}]`}t.getProperty=h;function m(v){if(typeof v=="string"&&t.IDENTIFIER.test(v))return new r(`${v}`);throw new Error(`CodeGen: invalid export name: ${v}, use explicit $id name mapping`)}t.getEsmExportName=m;function g(v){return new r(v.toString())}t.regexpCode=g})(Ah)),Ah}var Th={},hx;function mx(){return hx||(hx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=bp();class n extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`),this.value=c.value}}var r;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(r||(t.UsedValueState=r={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class i{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof e.Name?c:this.name(c)}name(c){return new e.Name(this._newName(c))}_newName(c){const u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,d;if(!((d=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(c)||this._prefixes&&!this._prefixes.has(c))throw new Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}}t.Scope=i;class a extends e.Name{constructor(c,u){super(u),this.prefix=c}setValue(c,{property:u,itemIndex:d}){this.value=c,this.scopePath=(0,e._)`.${new e.Name(u)}[${d}]`}}t.ValueScopeName=a;const s=(0,e._)`\n`;class o extends i{constructor(c){super(c),this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?s:e.nil}}get(){return this._scope}name(c){return new a(c,this._newName(c))}value(c,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const p=this.toName(c),{prefix:f}=p,h=(d=u.key)!==null&&d!==void 0?d:u.ref;let m=this._values[f];if(m){const y=m.get(h);if(y)return y}else m=this._values[f]=new Map;m.set(h,p);const g=this._scope[f]||(this._scope[f]=[]),v=g.length;return g[v]=u.ref,p.setValue(u,{property:f,itemIndex:v}),p}getValue(c,u){const d=this._values[c];if(d)return d.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,d=>{if(d.scopePath===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return(0,e._)`${c}${d.scopePath}`})}scopeCode(c=this._values,u,d){return this._reduceValues(c,p=>{if(p.value===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return p.value.code},u,d)}_reduceValues(c,u,d={},p){let f=e.nil;for(const h in c){const m=c[h];if(!m)continue;const g=d[h]=d[h]||new Map;m.forEach(v=>{if(g.has(v))return;g.set(v,r.Started);let y=u(v);if(y){const b=this.opts.es5?t.varKinds.var:t.varKinds.const;f=(0,e._)`${f}${b} ${v} = ${y};${this.opts._n}`}else if(y=p?.(v))f=(0,e._)`${f}${y}${this.opts._n}`;else throw new n(v);g.set(v,r.Completed)})}return f}}t.ValueScope=o})(Th)),Th}var gx;function Zt(){return gx||(gx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=bp(),n=mx();var r=bp();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}});var i=mx();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return i.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class a{optimizeNodes(){return this}optimizeNames(H,K){return this}}class s extends a{constructor(H,K,he){super(),this.varKind=H,this.name=K,this.rhs=he}render({es5:H,_n:K}){const he=H?n.varKinds.var:this.varKind,Te=this.rhs===void 0?"":` = ${this.rhs}`;return`${he} ${this.name}${Te};`+K}optimizeNames(H,K){if(H[this.name.str])return this.rhs&&(this.rhs=U(this.rhs,H,K)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends a{constructor(H,K,he){super(),this.lhs=H,this.rhs=K,this.sideEffects=he}render({_n:H}){return`${this.lhs} = ${this.rhs};`+H}optimizeNames(H,K){if(!(this.lhs instanceof e.Name&&!H[this.lhs.str]&&!this.sideEffects))return this.rhs=U(this.rhs,H,K),this}get names(){const H=this.lhs instanceof e.Name?{}:{...this.lhs.names};return L(H,this.rhs)}}class l extends o{constructor(H,K,he,Te){super(H,he,Te),this.op=K}render({_n:H}){return`${this.lhs} ${this.op}= ${this.rhs};`+H}}class c extends a{constructor(H){super(),this.label=H,this.names={}}render({_n:H}){return`${this.label}:`+H}}class u extends a{constructor(H){super(),this.label=H,this.names={}}render({_n:H}){return`break${this.label?` ${this.label}`:""};`+H}}class d extends a{constructor(H){super(),this.error=H}render({_n:H}){return`throw ${this.error};`+H}get names(){return this.error.names}}class p extends a{constructor(H){super(),this.code=H}render({_n:H}){return`${this.code};`+H}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(H,K){return this.code=U(this.code,H,K),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class f extends a{constructor(H=[]){super(),this.nodes=H}render(H){return this.nodes.reduce((K,he)=>K+he.render(H),"")}optimizeNodes(){const{nodes:H}=this;let K=H.length;for(;K--;){const he=H[K].optimizeNodes();Array.isArray(he)?H.splice(K,1,...he):he?H[K]=he:H.splice(K,1)}return H.length>0?this:void 0}optimizeNames(H,K){const{nodes:he}=this;let Te=he.length;for(;Te--;){const Re=he[Te];Re.optimizeNames(H,K)||(X(H,Re.names),he.splice(Te,1))}return he.length>0?this:void 0}get names(){return this.nodes.reduce((H,K)=>z(H,K.names),{})}}class h extends f{render(H){return"{"+H._n+super.render(H)+"}"+H._n}}class m extends f{}class g extends h{}g.kind="else";class v extends h{constructor(H,K){super(K),this.condition=H}render(H){let K=`if(${this.condition})`+super.render(H);return this.else&&(K+="else "+this.else.render(H)),K}optimizeNodes(){super.optimizeNodes();const H=this.condition;if(H===!0)return this.nodes;let K=this.else;if(K){const he=K.optimizeNodes();K=this.else=Array.isArray(he)?new g(he):he}if(K)return H===!1?K instanceof v?K:K.nodes:this.nodes.length?this:new v(se(H),K instanceof v?[K]:K.nodes);if(!(H===!1||!this.nodes.length))return this}optimizeNames(H,K){var he;if(this.else=(he=this.else)===null||he===void 0?void 0:he.optimizeNames(H,K),!!(super.optimizeNames(H,K)||this.else))return this.condition=U(this.condition,H,K),this}get names(){const H=super.names;return L(H,this.condition),this.else&&z(H,this.else.names),H}}v.kind="if";class y extends h{}y.kind="for";class b extends y{constructor(H){super(),this.iteration=H}render(H){return`for(${this.iteration})`+super.render(H)}optimizeNames(H,K){if(super.optimizeNames(H,K))return this.iteration=U(this.iteration,H,K),this}get names(){return z(super.names,this.iteration.names)}}class S extends y{constructor(H,K,he,Te){super(),this.varKind=H,this.name=K,this.from=he,this.to=Te}render(H){const K=H.es5?n.varKinds.var:this.varKind,{name:he,from:Te,to:Re}=this;return`for(${K} ${he}=${Te}; ${he}<${Re}; ${he}++)`+super.render(H)}get names(){const H=L(super.names,this.from);return L(H,this.to)}}class A extends y{constructor(H,K,he,Te){super(),this.loop=H,this.varKind=K,this.name=he,this.iterable=Te}render(H){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(H)}optimizeNames(H,K){if(super.optimizeNames(H,K))return this.iterable=U(this.iterable,H,K),this}get names(){return z(super.names,this.iterable.names)}}class _ extends h{constructor(H,K,he){super(),this.name=H,this.args=K,this.async=he}render(H){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(H)}}_.kind="func";class I extends f{render(H){return"return "+super.render(H)}}I.kind="return";class P extends h{render(H){let K="try"+super.render(H);return this.catch&&(K+=this.catch.render(H)),this.finally&&(K+=this.finally.render(H)),K}optimizeNodes(){var H,K;return super.optimizeNodes(),(H=this.catch)===null||H===void 0||H.optimizeNodes(),(K=this.finally)===null||K===void 0||K.optimizeNodes(),this}optimizeNames(H,K){var he,Te;return super.optimizeNames(H,K),(he=this.catch)===null||he===void 0||he.optimizeNames(H,K),(Te=this.finally)===null||Te===void 0||Te.optimizeNames(H,K),this}get names(){const H=super.names;return this.catch&&z(H,this.catch.names),this.finally&&z(H,this.finally.names),H}}class B extends h{constructor(H){super(),this.error=H}render(H){return`catch(${this.error})`+super.render(H)}}B.kind="catch";class D extends h{render(H){return"finally"+super.render(H)}}D.kind="finally";class O{constructor(H,K={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...K,_n:K.lines?`
|
|
184
184
|
`:""},this._extScope=H,this._scope=new n.Scope({parent:H}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(H){return this._scope.name(H)}scopeName(H){return this._extScope.name(H)}scopeValue(H,K){const he=this._extScope.value(H,K);return(this._values[he.prefix]||(this._values[he.prefix]=new Set)).add(he),he}getScopeValue(H,K){return this._extScope.getValue(H,K)}scopeRefs(H){return this._extScope.scopeRefs(H,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(H,K,he,Te){const Re=this._scope.toName(K);return he!==void 0&&Te&&(this._constants[Re.str]=he),this._leafNode(new s(H,Re,he)),Re}const(H,K,he){return this._def(n.varKinds.const,H,K,he)}let(H,K,he){return this._def(n.varKinds.let,H,K,he)}var(H,K,he){return this._def(n.varKinds.var,H,K,he)}assign(H,K,he){return this._leafNode(new o(H,K,he))}add(H,K){return this._leafNode(new l(H,t.operators.ADD,K))}code(H){return typeof H=="function"?H():H!==e.nil&&this._leafNode(new p(H)),this}object(...H){const K=["{"];for(const[he,Te]of H)K.length>1&&K.push(","),K.push(he),(he!==Te||this.opts.es5)&&(K.push(":"),(0,e.addCodeArg)(K,Te));return K.push("}"),new e._Code(K)}if(H,K,he){if(this._blockNode(new v(H)),K&&he)this.code(K).else().code(he).endIf();else if(K)this.code(K).endIf();else if(he)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(H){return this._elseNode(new v(H))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(v,g)}_for(H,K){return this._blockNode(H),K&&this.code(K).endFor(),this}for(H,K){return this._for(new b(H),K)}forRange(H,K,he,Te,Re=this.opts.es5?n.varKinds.var:n.varKinds.let){const je=this._scope.toName(H);return this._for(new S(Re,je,K,he),()=>Te(je))}forOf(H,K,he,Te=n.varKinds.const){const Re=this._scope.toName(H);if(this.opts.es5){const je=K instanceof e.Name?K:this.var("_arr",K);return this.forRange("_i",0,(0,e._)`${je}.length`,qe=>{this.var(Re,(0,e._)`${je}[${qe}]`),he(Re)})}return this._for(new A("of",Te,Re,K),()=>he(Re))}forIn(H,K,he,Te=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(H,(0,e._)`Object.keys(${K})`,he);const Re=this._scope.toName(H);return this._for(new A("in",Te,Re,K),()=>he(Re))}endFor(){return this._endBlockNode(y)}label(H){return this._leafNode(new c(H))}break(H){return this._leafNode(new u(H))}return(H){const K=new I;if(this._blockNode(K),this.code(H),K.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(I)}try(H,K,he){if(!K&&!he)throw new Error('CodeGen: "try" without "catch" and "finally"');const Te=new P;if(this._blockNode(Te),this.code(H),K){const Re=this.name("e");this._currNode=Te.catch=new B(Re),K(Re)}return he&&(this._currNode=Te.finally=new D,this.code(he)),this._endBlockNode(B,D)}throw(H){return this._leafNode(new d(H))}block(H,K){return this._blockStarts.push(this._nodes.length),H&&this.code(H).endBlock(K),this}endBlock(H){const K=this._blockStarts.pop();if(K===void 0)throw new Error("CodeGen: not in self-balancing block");const he=this._nodes.length-K;if(he<0||H!==void 0&&he!==H)throw new Error(`CodeGen: wrong number of nodes: ${he} vs ${H} expected`);return this._nodes.length=K,this}func(H,K=e.nil,he,Te){return this._blockNode(new _(H,K,he)),Te&&this.code(Te).endFunc(),this}endFunc(){return this._endBlockNode(_)}optimize(H=1){for(;H-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(H){return this._currNode.nodes.push(H),this}_blockNode(H){this._currNode.nodes.push(H),this._nodes.push(H)}_endBlockNode(H,K){const he=this._currNode;if(he instanceof H||K&&he instanceof K)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${K?`${H.kind}/${K.kind}`:H.kind}"`)}_elseNode(H){const K=this._currNode;if(!(K instanceof v))throw new Error('CodeGen: "else" without "if"');return this._currNode=K.else=H,this}get _root(){return this._nodes[0]}get _currNode(){const H=this._nodes;return H[H.length-1]}set _currNode(H){const K=this._nodes;K[K.length-1]=H}}t.CodeGen=O;function z(ie,H){for(const K in H)ie[K]=(ie[K]||0)+(H[K]||0);return ie}function L(ie,H){return H instanceof e._CodeOrName?z(ie,H.names):ie}function U(ie,H,K){if(ie instanceof e.Name)return he(ie);if(!Te(ie))return ie;return new e._Code(ie._items.reduce((Re,je)=>(je instanceof e.Name&&(je=he(je)),je instanceof e._Code?Re.push(...je._items):Re.push(je),Re),[]));function he(Re){const je=K[Re.str];return je===void 0||H[Re.str]!==1?Re:(delete H[Re.str],je)}function Te(Re){return Re instanceof e._Code&&Re._items.some(je=>je instanceof e.Name&&H[je.str]===1&&K[je.str]!==void 0)}}function X(ie,H){for(const K in H)ie[K]=(ie[K]||0)-(H[K]||0)}function se(ie){return typeof ie=="boolean"||typeof ie=="number"||ie===null?!ie:(0,e._)`!${pe(ie)}`}t.not=se;const le=V(t.operators.AND);function ee(...ie){return ie.reduce(le)}t.and=ee;const oe=V(t.operators.OR);function ce(...ie){return ie.reduce(oe)}t.or=ce;function V(ie){return(H,K)=>H===e.nil?K:K===e.nil?H:(0,e._)`${pe(H)} ${ie} ${pe(K)}`}function pe(ie){return ie instanceof e.Name?ie:(0,e._)`(${ie})`}})(Ch)),Ch}var Gt={},vx;function cn(){if(vx)return Gt;vx=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.checkStrictMode=Gt.getErrorPath=Gt.Type=Gt.useFunc=Gt.setEvaluated=Gt.evaluatedPropsToName=Gt.mergeEvaluated=Gt.eachItem=Gt.unescapeJsonPointer=Gt.escapeJsonPointer=Gt.escapeFragment=Gt.unescapeFragment=Gt.schemaRefOrVal=Gt.schemaHasRulesButRef=Gt.schemaHasRules=Gt.checkUnknownRules=Gt.alwaysValidSchema=Gt.toHash=void 0;const t=Zt(),e=bp();function n(A){const _={};for(const I of A)_[I]=!0;return _}Gt.toHash=n;function r(A,_){return typeof _=="boolean"?_:Object.keys(_).length===0?!0:(i(A,_),!a(_,A.self.RULES.all))}Gt.alwaysValidSchema=r;function i(A,_=A.schema){const{opts:I,self:P}=A;if(!I.strictSchema||typeof _=="boolean")return;const B=P.RULES.keywords;for(const D in _)B[D]||S(A,`unknown keyword: "${D}"`)}Gt.checkUnknownRules=i;function a(A,_){if(typeof A=="boolean")return!A;for(const I in A)if(_[I])return!0;return!1}Gt.schemaHasRules=a;function s(A,_){if(typeof A=="boolean")return!A;for(const I in A)if(I!=="$ref"&&_.all[I])return!0;return!1}Gt.schemaHasRulesButRef=s;function o({topSchemaRef:A,schemaPath:_},I,P,B){if(!B){if(typeof I=="number"||typeof I=="boolean")return I;if(typeof I=="string")return(0,t._)`${I}`}return(0,t._)`${A}${_}${(0,t.getProperty)(P)}`}Gt.schemaRefOrVal=o;function l(A){return d(decodeURIComponent(A))}Gt.unescapeFragment=l;function c(A){return encodeURIComponent(u(A))}Gt.escapeFragment=c;function u(A){return typeof A=="number"?`${A}`:A.replace(/~/g,"~0").replace(/\//g,"~1")}Gt.escapeJsonPointer=u;function d(A){return A.replace(/~1/g,"/").replace(/~0/g,"~")}Gt.unescapeJsonPointer=d;function p(A,_){if(Array.isArray(A))for(const I of A)_(I);else _(A)}Gt.eachItem=p;function f({mergeNames:A,mergeToName:_,mergeValues:I,resultToName:P}){return(B,D,O,z)=>{const L=O===void 0?D:O instanceof t.Name?(D instanceof t.Name?A(B,D,O):_(B,D,O),O):D instanceof t.Name?(_(B,O,D),D):I(D,O);return z===t.Name&&!(L instanceof t.Name)?P(B,L):L}}Gt.mergeEvaluated={props:f({mergeNames:(A,_,I)=>A.if((0,t._)`${I} !== true && ${_} !== undefined`,()=>{A.if((0,t._)`${_} === true`,()=>A.assign(I,!0),()=>A.assign(I,(0,t._)`${I} || {}`).code((0,t._)`Object.assign(${I}, ${_})`))}),mergeToName:(A,_,I)=>A.if((0,t._)`${I} !== true`,()=>{_===!0?A.assign(I,!0):(A.assign(I,(0,t._)`${I} || {}`),m(A,I,_))}),mergeValues:(A,_)=>A===!0?!0:{...A,..._},resultToName:h}),items:f({mergeNames:(A,_,I)=>A.if((0,t._)`${I} !== true && ${_} !== undefined`,()=>A.assign(I,(0,t._)`${_} === true ? true : ${I} > ${_} ? ${I} : ${_}`)),mergeToName:(A,_,I)=>A.if((0,t._)`${I} !== true`,()=>A.assign(I,_===!0?!0:(0,t._)`${I} > ${_} ? ${I} : ${_}`)),mergeValues:(A,_)=>A===!0?!0:Math.max(A,_),resultToName:(A,_)=>A.var("items",_)})};function h(A,_){if(_===!0)return A.var("props",!0);const I=A.var("props",(0,t._)`{}`);return _!==void 0&&m(A,I,_),I}Gt.evaluatedPropsToName=h;function m(A,_,I){Object.keys(I).forEach(P=>A.assign((0,t._)`${_}${(0,t.getProperty)(P)}`,!0))}Gt.setEvaluated=m;const g={};function v(A,_){return A.scopeValue("func",{ref:_,code:g[_.code]||(g[_.code]=new e._Code(_.code))})}Gt.useFunc=v;var y;(function(A){A[A.Num=0]="Num",A[A.Str=1]="Str"})(y||(Gt.Type=y={}));function b(A,_,I){if(A instanceof t.Name){const P=_===y.Num;return I?P?(0,t._)`"[" + ${A} + "]"`:(0,t._)`"['" + ${A} + "']"`:P?(0,t._)`"/" + ${A}`:(0,t._)`"/" + ${A}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return I?(0,t.getProperty)(A).toString():"/"+u(A)}Gt.getErrorPath=b;function S(A,_,I=A.opts.strictSchema){if(I){if(_=`strict mode: ${_}`,I===!0)throw new Error(_);A.self.logger.warn(_)}}return Gt.checkStrictMode=S,Gt}var Iu={},yx;function Ls(){if(yx)return Iu;yx=1,Object.defineProperty(Iu,"__esModule",{value:!0});const t=Zt(),e={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};return Iu.default=e,Iu}var wx;function of(){return wx||(wx=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=Zt(),n=cn(),r=Ls();t.keywordError={message:({keyword:g})=>(0,e.str)`must pass "${g}" keyword validation`},t.keyword$DataError={message:({keyword:g,schemaType:v})=>v?(0,e.str)`"${g}" keyword must be ${v} ($data)`:(0,e.str)`"${g}" keyword is invalid ($data)`};function i(g,v=t.keywordError,y,b){const{it:S}=g,{gen:A,compositeRule:_,allErrors:I}=S,P=d(g,v,y);b??(_||I)?l(A,P):c(S,(0,e._)`[${P}]`)}t.reportError=i;function a(g,v=t.keywordError,y){const{it:b}=g,{gen:S,compositeRule:A,allErrors:_}=b,I=d(g,v,y);l(S,I),A||_||c(b,r.default.vErrors)}t.reportExtraError=a;function s(g,v){g.assign(r.default.errors,v),g.if((0,e._)`${r.default.vErrors} !== null`,()=>g.if(v,()=>g.assign((0,e._)`${r.default.vErrors}.length`,v),()=>g.assign(r.default.vErrors,null)))}t.resetErrorsCount=s;function o({gen:g,keyword:v,schemaValue:y,data:b,errsCount:S,it:A}){if(S===void 0)throw new Error("ajv implementation error");const _=g.name("err");g.forRange("i",S,r.default.errors,I=>{g.const(_,(0,e._)`${r.default.vErrors}[${I}]`),g.if((0,e._)`${_}.instancePath === undefined`,()=>g.assign((0,e._)`${_}.instancePath`,(0,e.strConcat)(r.default.instancePath,A.errorPath))),g.assign((0,e._)`${_}.schemaPath`,(0,e.str)`${A.errSchemaPath}/${v}`),A.opts.verbose&&(g.assign((0,e._)`${_}.schema`,y),g.assign((0,e._)`${_}.data`,b))})}t.extendErrors=o;function l(g,v){const y=g.const("err",v);g.if((0,e._)`${r.default.vErrors} === null`,()=>g.assign(r.default.vErrors,(0,e._)`[${y}]`),(0,e._)`${r.default.vErrors}.push(${y})`),g.code((0,e._)`${r.default.errors}++`)}function c(g,v){const{gen:y,validateName:b,schemaEnv:S}=g;S.$async?y.throw((0,e._)`new ${g.ValidationError}(${v})`):(y.assign((0,e._)`${b}.errors`,v),y.return(!1))}const u={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function d(g,v,y){const{createErrors:b}=g.it;return b===!1?(0,e._)`{}`:p(g,v,y)}function p(g,v,y={}){const{gen:b,it:S}=g,A=[f(S,y),h(g,y)];return m(g,v,A),b.object(...A)}function f({errorPath:g},{instancePath:v}){const y=v?(0,e.str)`${g}${(0,n.getErrorPath)(v,n.Type.Str)}`:g;return[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,y)]}function h({keyword:g,it:{errSchemaPath:v}},{schemaPath:y,parentSchema:b}){let S=b?v:(0,e.str)`${v}/${g}`;return y&&(S=(0,e.str)`${S}${(0,n.getErrorPath)(y,n.Type.Str)}`),[u.schemaPath,S]}function m(g,{params:v,message:y},b){const{keyword:S,data:A,schemaValue:_,it:I}=g,{opts:P,propertyName:B,topSchemaRef:D,schemaPath:O}=I;b.push([u.keyword,S],[u.params,typeof v=="function"?v(g):v||(0,e._)`{}`]),P.messages&&b.push([u.message,typeof y=="function"?y(g):y]),P.verbose&&b.push([u.schema,_],[u.parentSchema,(0,e._)`${D}${O}`],[r.default.data,A]),B&&b.push([u.propertyName,B])}})(Sh)),Sh}var bx;function fF(){if(bx)return Qs;bx=1,Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.boolOrEmptySchema=Qs.topBoolOrEmptySchema=void 0;const t=of(),e=Zt(),n=Ls(),r={message:"boolean schema is false"};function i(o){const{gen:l,schema:c,validateName:u}=o;c===!1?s(o,!1):typeof c=="object"&&c.$async===!0?l.return(n.default.data):(l.assign((0,e._)`${u}.errors`,null),l.return(!0))}Qs.topBoolOrEmptySchema=i;function a(o,l){const{gen:c,schema:u}=o;u===!1?(c.var(l,!1),s(o)):c.var(l,!0)}Qs.boolOrEmptySchema=a;function s(o,l){const{gen:c,data:u}=o,d={gen:c,keyword:"false schema",data:u,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:o};(0,t.reportError)(d,r,void 0,l)}return Qs}var Ir={},Ys={},xx;function HE(){if(xx)return Ys;xx=1,Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.getRules=Ys.isJSONType=void 0;const t=["string","number","integer","boolean","null","object","array"],e=new Set(t);function n(i){return typeof i=="string"&&e.has(i)}Ys.isJSONType=n;function r(){const i={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...i,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},i.number,i.string,i.array,i.object],post:{rules:[]},all:{},keywords:{}}}return Ys.getRules=r,Ys}var ja={},kx;function VE(){if(kx)return ja;kx=1,Object.defineProperty(ja,"__esModule",{value:!0}),ja.shouldUseRule=ja.shouldUseGroup=ja.schemaHasRulesForType=void 0;function t({schema:r,self:i},a){const s=i.RULES.types[a];return s&&s!==!0&&e(r,s)}ja.schemaHasRulesForType=t;function e(r,i){return i.rules.some(a=>n(r,a))}ja.shouldUseGroup=e;function n(r,i){var a;return r[i.keyword]!==void 0||((a=i.definition.implements)===null||a===void 0?void 0:a.some(s=>r[s]!==void 0))}return ja.shouldUseRule=n,ja}var Ex;function xp(){if(Ex)return Ir;Ex=1,Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.reportTypeError=Ir.checkDataTypes=Ir.checkDataType=Ir.coerceAndCheckDataType=Ir.getJSONTypes=Ir.getSchemaTypes=Ir.DataType=void 0;const t=HE(),e=VE(),n=of(),r=Zt(),i=cn();var a;(function(y){y[y.Correct=0]="Correct",y[y.Wrong=1]="Wrong"})(a||(Ir.DataType=a={}));function s(y){const b=o(y.type);if(b.includes("null")){if(y.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!b.length&&y.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');y.nullable===!0&&b.push("null")}return b}Ir.getSchemaTypes=s;function o(y){const b=Array.isArray(y)?y:y?[y]:[];if(b.every(t.isJSONType))return b;throw new Error("type must be JSONType or JSONType[]: "+b.join(","))}Ir.getJSONTypes=o;function l(y,b){const{gen:S,data:A,opts:_}=y,I=u(b,_.coerceTypes),P=b.length>0&&!(I.length===0&&b.length===1&&(0,e.schemaHasRulesForType)(y,b[0]));if(P){const B=h(b,A,_.strictNumbers,a.Wrong);S.if(B,()=>{I.length?d(y,b,I):g(y)})}return P}Ir.coerceAndCheckDataType=l;const c=new Set(["string","number","integer","boolean","null"]);function u(y,b){return b?y.filter(S=>c.has(S)||b==="array"&&S==="array"):[]}function d(y,b,S){const{gen:A,data:_,opts:I}=y,P=A.let("dataType",(0,r._)`typeof ${_}`),B=A.let("coerced",(0,r._)`undefined`);I.coerceTypes==="array"&&A.if((0,r._)`${P} == 'object' && Array.isArray(${_}) && ${_}.length == 1`,()=>A.assign(_,(0,r._)`${_}[0]`).assign(P,(0,r._)`typeof ${_}`).if(h(b,_,I.strictNumbers),()=>A.assign(B,_))),A.if((0,r._)`${B} !== undefined`);for(const O of S)(c.has(O)||O==="array"&&I.coerceTypes==="array")&&D(O);A.else(),g(y),A.endIf(),A.if((0,r._)`${B} !== undefined`,()=>{A.assign(_,B),p(y,B)});function D(O){switch(O){case"string":A.elseIf((0,r._)`${P} == "number" || ${P} == "boolean"`).assign(B,(0,r._)`"" + ${_}`).elseIf((0,r._)`${_} === null`).assign(B,(0,r._)`""`);return;case"number":A.elseIf((0,r._)`${P} == "boolean" || ${_} === null
|
|
185
185
|
|| (${P} == "string" && ${_} && ${_} == +${_})`).assign(B,(0,r._)`+${_}`);return;case"integer":A.elseIf((0,r._)`${P} === "boolean" || ${_} === null
|
|
186
186
|
|| (${P} === "string" && ${_} && ${_} == +${_} && !(${_} % 1))`).assign(B,(0,r._)`+${_}`);return;case"boolean":A.elseIf((0,r._)`${_} === "false" || ${_} === 0 || ${_} === null`).assign(B,!1).elseIf((0,r._)`${_} === "true" || ${_} === 1`).assign(B,!0);return;case"null":A.elseIf((0,r._)`${_} === "" || ${_} === 0 || ${_} === false`),A.assign(B,null);return;case"array":A.elseIf((0,r._)`${P} === "string" || ${P} === "number"
|
|
@@ -739,8 +739,8 @@ Result: ${o.result??""}
|
|
|
739
739
|
`,document.head.appendChild(e)}}const WS=[{id:"chat",label:"Chat"},{id:"terminal",label:"Terminal"},{id:"files",label:"Files"},{id:"memory",label:"Memory"}],BS="slicc-hidden-tabs",t3=["terminal","memory"];function HB(){try{const t=localStorage.getItem(BS);return t?new Set(JSON.parse(t)):new Set(t3)}catch{return new Set(t3)}}function VB(t){const e=t.filter(n=>n!=="chat");localStorage.setItem(BS,JSON.stringify(e))}const ZB=WS.filter(t=>!HB().has(t.id)),n3="chat",KB=new Set(WS.map(t=>t.id));function JB(t){return KB.has(t)}class r3{zoneId;tabBar;contentArea;tabs=new Map;activeTabId=null;callbacks;addBtn=null;fullpageBtn=null;isFullpage=!1;separator=null;scrollArea=null;storageKey;classPrefix;constructor(e,n,r,i={},a={}){this.tabBar=e,this.contentArea=n,this.zoneId=r,this.callbacks=i,this.storageKey=`slicc-${r}-tab`,this.classPrefix=a.classPrefix??"mini-tabs"}addTab(e){if(this.tabs.has(e.id))return;const n=document.createElement("button");if(n.dataset.tabId=e.id,e.pinned&&e.icon){n.className=`${this.classPrefix}__tab ${this.classPrefix}__tab--icon ${this.classPrefix}__tab--dimmed`,n.innerHTML=e.icon,n.setAttribute("aria-label",e.label),n.dataset.tooltip=e.label,n.dataset.tooltipPos="top";const r=this.separator||this.findFirstNonPinnedBtn()||this.addBtn;if(r?this.tabBar.insertBefore(n,r):this.tabBar.appendChild(n),!this.separator){this.separator=document.createElement("div"),this.separator.className=`${this.classPrefix}__separator`,this.scrollArea=document.createElement("div"),this.scrollArea.className=`${this.classPrefix}__scroll`;const i=this.addBtn||this.fullpageBtn;i?(this.tabBar.insertBefore(this.separator,i),this.tabBar.insertBefore(this.scrollArea,i)):(this.tabBar.appendChild(this.separator),this.tabBar.appendChild(this.scrollArea))}n.addEventListener("click",()=>{const i=this.tabs.get(e.id);i&&!i.mounted&&this.enablePinnedTab(e.id),this.activateTab(e.id)}),this.tabs.set(e.id,{btn:n,container:e.element,tab:e,mounted:!1})}else{if(n.className=`${this.classPrefix}__tab`,n.appendChild(document.createTextNode(e.label)),e.closable){const i=document.createElement("span");i.className=`${this.classPrefix}__tab-close`,i.title="Close panel",i.textContent="×",i.addEventListener("click",a=>{a.stopPropagation(),this.callbacks.onTabClose?.(e.id)}),n.appendChild(i)}n.addEventListener("click",()=>this.activateTab(e.id)),this.scrollArea?this.scrollArea.appendChild(n):this.addBtn?this.tabBar.insertBefore(n,this.addBtn):this.tabBar.appendChild(n);const r=e.element;r.style.display="none",this.contentArea.appendChild(r),this.tabs.set(e.id,{btn:n,container:r,tab:e,mounted:!0}),(!this.activeTabId||!this.tabs.get(this.activeTabId)?.mounted)&&this.activateTab(e.id)}}removeTab(e){const n=this.tabs.get(e);if(n&&(n.btn.remove(),n.mounted&&n.container.remove(),this.tabs.delete(e),this.activeTabId===e)){const r=Array.from(this.tabs.entries()).find(([,i])=>i.mounted);r?this.activateTab(r[0]):this.activeTabId=null}}enablePinnedTab(e){const n=this.tabs.get(e);!n||n.mounted||(n.mounted=!0,n.btn.classList.remove(`${this.classPrefix}__tab--dimmed`),n.container.style.display="none",this.contentArea.appendChild(n.container))}isPinnedTabEnabled(e){return this.tabs.get(e)?.mounted??!1}activateTab(e){const n=this.tabs.get(e);if(!(!n||!n.mounted)){this.activeTabId=e;for(const[r,{btn:i,container:a,mounted:s}]of this.tabs){const o=r===e;i.classList.toggle(`${this.classPrefix}__tab--active`,o),s&&(a.style.display=o?"flex":"none")}try{localStorage.setItem(this.storageKey,e)}catch{}n.tab.onActivate?.(),this.callbacks.onTabActivate?.(e)}}getActiveTabId(){return this.activeTabId}getTabIds(){return Array.from(this.tabs.keys())}hasTab(e){return this.tabs.has(e)}get tabCount(){return this.tabs.size}enableAddButton(){this.addBtn||(this.addBtn=document.createElement("button"),this.addBtn.className=`${this.classPrefix}__tab ${this.classPrefix}__tab--add`,this.addBtn.textContent="+",this.addBtn.dataset.tooltip="Open panel",this.addBtn.dataset.tooltipPos="top",this.addBtn.setAttribute("aria-label","Open panel"),this.addBtn.addEventListener("click",()=>this.callbacks.onAddClick?.()),this.tabBar.appendChild(this.addBtn))}setAddButtonEnabled(e){this.addBtn&&(this.addBtn.disabled=!e)}enableFullpageButton(){this.fullpageBtn||(this.fullpageBtn=document.createElement("button"),this.fullpageBtn.className=`${this.classPrefix}__tab ${this.classPrefix}__tab--fullpage`,this.fullpageBtn.dataset.tooltip="Full page",this.fullpageBtn.dataset.tooltipPos="top",this.fullpageBtn.setAttribute("aria-label","Toggle full page"),this.fullpageBtn.innerHTML='<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 2h4v4"/><path d="M6 14H2v-4"/><path d="M14 2L9.5 6.5"/><path d="M2 14l4.5-4.5"/></svg>',this.fullpageBtn.addEventListener("click",()=>{this.isFullpage=!this.isFullpage,this.fullpageBtn.classList.toggle(`${this.classPrefix}__tab--active`,this.isFullpage),this.fullpageBtn.innerHTML=this.isFullpage?'<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 6h-4V2"/><path d="M2 10h4v4"/><path d="M10 6l4.5-4.5"/><path d="M6 10L1.5 14.5"/></svg>':'<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 2h4v4"/><path d="M6 14H2v-4"/><path d="M14 2L9.5 6.5"/><path d="M2 14l4.5-4.5"/></svg>',this.fullpageBtn.dataset.tooltip=this.isFullpage?"Exit full page":"Full page",this.callbacks.onFullpageToggle?.(this.isFullpage)}),this.tabBar.appendChild(this.fullpageBtn))}restoreActiveTab(){try{const e=localStorage.getItem(this.storageKey);if(e&&this.tabs.has(e)&&this.tabs.get(e).mounted)return this.activateTab(e),e}catch{}return null}findFirstNonPinnedBtn(){for(const[,e]of this.tabs)if(!e.tab.pinned)return e.btn;return null}}class QB{entries=new Map;listeners=new Set;register(e){this.entries.set(e.id,{descriptor:e}),this.notify()}unregister(e){this.entries.delete(e),this.notify()}get(e){return this.entries.get(e)}getByZone(e){const n=[];for(const r of this.entries.values())r.descriptor.zone===e&&n.push(r.descriptor);return n}getClosed(){const e=[];for(const n of this.entries.values())n.descriptor.zone===null&&e.push(n.descriptor);return e}setZone(e,n){const r=this.entries.get(e);r&&(r.descriptor.zone=n,this.notify())}ids(){return Array.from(this.entries.keys())}has(e){return this.entries.has(e)}onChange(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(){for(const e of this.listeners)e()}}function i3(t,e,n){const r=document.querySelector(".sprinkle-picker");if(r){r.remove();return}const{registry:i,callbacks:a,getAvailableSprinkles:s}=n,o=i.getClosed(),l=s?.()??[];if(o.length===0&&l.length===0)return;const c=document.createElement("div");c.className="sprinkle-picker",c.style.cssText="position: absolute; min-width: 160px; max-height: 300px; overflow-y: auto; background: var(--s2-bg-layer-2); border: 1px solid var(--s2-border-default); border-radius: var(--s2-radius-l); padding: 4px 0; box-shadow: var(--s2-shadow-elevated); z-index: 1000;";const u=()=>{c.remove(),document.removeEventListener("pointerdown",p,!0),document.removeEventListener("keydown",f,!0)};for(const h of o){const m=a3(h.label,()=>{a.onSelectPanel(h.id,e),u()});c.appendChild(m)}if(o.length>0&&l.length>0){const h=document.createElement("div");h.style.cssText="height: 1px; background: var(--s2-border-default); margin: 4px 0;",c.appendChild(h)}for(const h of l){const m=a3(h.title,()=>{a.onSelectSprinkle(h.name,e),u()});c.appendChild(m)}const d=t.getBoundingClientRect();c.style.top=`${d.bottom+4}px`,c.style.left=`${d.left}px`,document.body.appendChild(c);const p=h=>{c.contains(h.target)||u()},f=h=>{h.key==="Escape"&&u()};requestAnimationFrame(()=>{document.addEventListener("pointerdown",p,!0),document.addEventListener("keydown",f,!0)})}function a3(t,e){const n=document.createElement("div");return n.className="sprinkle-picker__item",n.style.cssText="padding: 6px 12px; cursor: pointer; font-size: 12px; color: var(--s2-content-default); border-radius: var(--s2-radius-s); margin: 0 4px; transition: background 130ms ease;",n.textContent=t,n.addEventListener("mouseenter",()=>{n.style.background="var(--s2-bg-elevated)"}),n.addEventListener("mouseleave",()=>{n.style.background=""}),n.addEventListener("click",e),n}class Uc{root;isExtension;scoopsEl;leftEl;rightEl;verticalDivider;terminalContainer;iframeContainer;threadHeaderEl;threadHeaderName;primaryZoneEl;primaryZone;get drawerZone(){return this.primaryZone}get drawerZoneEl(){return this.primaryZoneEl}tabContainers=new Map;activeTab="chat";debugTabContainers=null;scoopSwitcher=null;scoopSwitcherEl=null;avatarEl;logoSvg=null;logoImg=null;logoScoopCount=-1;panels;registry=new QB;onModelChange;refreshModels;onScoopSelect;onClearChat;onClearFilesystem;onSprinkleClose;getAvailableSprinkles;onOpenSprinkle;constructor(e,n=!1){this.root=e,this.isExtension=n,n?this.buildTabbedLayout():this.buildSplitLayout()}setScoopSwitcherOrchestrator(e){this.scoopSwitcher?.setOrchestrator(e)}updateScoopSwitcherStatus(e,n){this.scoopSwitcher?.updateStatus(e,n)}setScoopSwitcherSelected(e){this.scoopSwitcher?.setSelected(e)}refreshScoopSwitcher(){this.scoopSwitcher?.refresh()}setActiveTab(e){this.isExtension&&this.extensionZone?.activateTab(e)}getActiveTab(){return this.activeTab}isTerminalOpen(){return this.isExtension?!0:this.primaryZone.isPinnedTabEnabled("terminal")}setAgentProcessing(e){this.threadHeaderEl?.classList.toggle("thread-header--processing",e)}openTerminal(){if(this.isExtension)return;this.primaryZone.isPinnedTabEnabled("terminal")||this.primaryZone.enablePinnedTab("terminal");const e=this.primaryZone.getActiveTabId();e&&e.startsWith("sprinkle-")||this.primaryZone.activateTab("terminal")}setDebugTabs(e){if(!this.isExtension||!this.debugTabContainers)return;const n=[{id:"terminal",label:"Terminal",container:this.debugTabContainers.terminal,onActivate:()=>this.panels?.terminal?.refit?.()},{id:"memory",label:"Memory",container:this.debugTabContainers.memory,onActivate:()=>this.panels?.memory?.refresh()}];for(const{id:r,label:i,container:a,onActivate:s}of n)e&&!this.extensionZone.hasTab(r)?(this.extensionZone.addTab({id:r,label:i,closable:!1,element:a,onActivate:s}),this.tabContainers.set(r,a)):!e&&this.extensionZone.hasTab(r)&&(this.extensionZone.removeTab(r),this.tabContainers.delete(r));VB(e?[]:["terminal","memory"])}buildHeader(e){const n=document.createElement("div");n.className="header";const r=()=>{if(eu())return;const d=oy();for(const p of d)if(p.models.length>0){cy(`${p.providerId}:${p.models[0].id}`);return}};r(),this.refreshModels=()=>{r(),this.panels?.chat?.refreshModelSelector(),this.refreshAvatar()};const i=document.createElement("div");i.className="header__row";const a=document.createElement("div");a.className="header__brand";const s=this.isExtension?24:28,o=this.sliccLogo(s);a.appendChild(o);const l=document.createElement("div");l.className="header__title",l.textContent="slicc",a.appendChild(l),i.appendChild(a),this.isExtension&&(this.scoopSwitcherEl=document.createElement("div"),this.scoopSwitcherEl.className="scoop-switcher",this.scoopSwitcher=new GB(this.scoopSwitcherEl,{onScoopSelect:u=>this.onScoopSelect?.(u),onCreateScoop:u=>{this.panels?.scoops?.createScoop(u)},onDeleteScoop:u=>{this.panels?.scoops?.deleteScoop?.(u)}}),i.appendChild(this.scoopSwitcherEl));const c=document.createElement("div");c.className="header__spacer",i.appendChild(c),this.avatarEl=this.buildUserAvatar(),i.appendChild(this.avatarEl),n.appendChild(i),e.appendChild(n)}static SCOOP_COLORS=["#f000a0","#00f0f0","#90f000","#15d675","#e68619"];sliccLogo(e=22){const n=document.createElement("img");return n.width=e,n.height=e,n.src="/logos/sliccy-color-0scoops-128x128.png",n.alt="slicc",n.classList.add("header__logo"),n.style.objectFit="contain",this.logoImg=n,n}static SCOOP_R=5;static SCOOP_SPACING=8.5;static ROW_STEP=7.5;pyramidLayout(e){if(e===0)return[];const{SCOOP_SPACING:n,ROW_STEP:r}=Uc;let i=1;for(;i*(i+1)/2<e;)i++;const a=[];let s=e,o=i;for(;s>0;){const p=Math.min(s,o);a.push(p),s-=p,o--}const l=16,c=19,u=[];let d=c-Uc.SCOOP_R;for(const p of a){const f=(p-1)*n,h=l-f/2;for(let m=0;m<p;m++)u.push({cx:h+m*n,cy:d});d-=r}return u}updateLogoScoops(e){const n=e.filter(a=>!a.isCone),r=this.logoScoopCount;if(r===n.length&&r>=0)return;this.logoScoopCount=n.length;const i=Math.min(Math.max(n.length,0),10);this.logoImg&&(this.logoImg.src=`/logos/sliccy-color-${i}scoops-128x128.png`),this.updateFaviconForScoops(n.length)}updateFaviconForScoops(e){const n=Math.min(Math.max(e,0),10),r=document.querySelector('link[rel="icon"]');r&&(r.href=`/logos/sliccy-color-${n}scoops-32x32.png`);const i=typeof chrome<"u"?chrome:null;i?.action?.setIcon&&i.action.setIcon({path:{16:`logos/sliccy-color-${n}scoops-16x16.png`,32:`logos/sliccy-color-${n}scoops-32x32.png`,48:`logos/sliccy-color-${n}scoops-48x48.png`,128:`logos/sliccy-color-${n}scoops-128x128.png`}}).catch(()=>{})}getInitials(e){const n=e.trim().split(/\s+/);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}buildUserAvatar(){const e=document.createElement("div");e.className="header__avatar",e.setAttribute("aria-label","Account"),e.dataset.tooltip="Account";const r=lr().find(i=>i.userName||i.userAvatar);if(r?.userAvatar){const i=document.createElement("img");i.src=r.userAvatar,i.alt=r.userName??"User",i.addEventListener("error",()=>{e.removeChild(i),r.userName&&(e.classList.add("header__avatar--initials"),e.textContent=this.getInitials(r.userName))}),e.appendChild(i)}else r?.userName?(e.classList.add("header__avatar--initials"),e.textContent=this.getInitials(r.userName)):(e.classList.add("header__avatar--placeholder"),e.innerHTML='<svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor"><path d="M10 10c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v1c0 .55.45 1 1 1h14c.55 0 1-.45 1-1v-1c0-2.66-5.33-4-8-4z"/></svg>');return e.addEventListener("click",()=>this.showAvatarPopover()),e}refreshAvatar(){if(!this.avatarEl)return;const e=this.avatarEl.parentElement;if(!e)return;const n=this.buildUserAvatar();e.replaceChild(n,this.avatarEl),this.avatarEl=n}showAvatarPopover(){const e=document.querySelector(".avatar-popover");if(e){e.remove();return}const n=document.createElement("div");n.className="avatar-popover";const r=lr(),i=r.find(d=>d.userName||d.accessToken||d.apiKey);if(i){const d=document.createElement("div");d.className="avatar-popover__user";const p=document.createElement("div");p.className="avatar-popover__name",p.textContent=i.userName||"Logged in",d.appendChild(p);const f=document.createElement("div");f.className="avatar-popover__provider",f.textContent=Zr(i.providerId).name,d.appendChild(f),n.appendChild(d);const h=document.createElement("button");h.className="avatar-popover__item",h.textContent="Sign out",h.addEventListener("click",()=>{_p(i.providerId),n.remove(),this.refreshAvatar(),this.refreshModels?.()}),n.appendChild(h)}if(r.length>0){const d=document.createElement("div");d.className="avatar-popover__separator",n.appendChild(d);const p=document.createElement("button");p.className="avatar-popover__item avatar-popover__item--danger",p.textContent="Clear all accounts",p.addEventListener("click",()=>{m0(),n.remove(),this.refreshAvatar(),this.refreshModels?.()}),n.appendChild(p)}const a=document.createElement("div");a.className="avatar-popover__separator",n.appendChild(a);const s=document.createElement("button");s.className="avatar-popover__item avatar-popover__item--danger",s.textContent="Clear chat",s.addEventListener("click",async()=>{n.remove(),await this.panels?.chat?.clearSession(),await this.onClearChat?.(),location.reload()}),n.appendChild(s);const o=document.createElement("div");o.className="avatar-popover__separator",n.appendChild(o);const l=document.createElement("button");l.className="avatar-popover__item",l.textContent="Account settings…",l.addEventListener("click",async()=>{n.remove(),xl()||m0(),await uy()&&(this.refreshAvatar(),this.refreshModels?.())}),n.appendChild(l),document.body.appendChild(n);const c=this.avatarEl.getBoundingClientRect();n.style.top=`${c.bottom+4}px`,n.style.right=`${window.innerWidth-c.right}px`;const u=d=>{if(d instanceof KeyboardEvent){if(d.key!=="Escape")return}else if(n.contains(d.target)||this.avatarEl.contains(d.target))return;n.remove(),document.removeEventListener("mousedown",u),document.removeEventListener("keydown",u)};requestAnimationFrame(()=>{document.addEventListener("mousedown",u),document.addEventListener("keydown",u)})}extensionZone;buildTabbedLayout(){for(;this.root.firstChild;)this.root.removeChild(this.root.firstChild);this.buildHeader(this.root);const e=document.createElement("div");e.className="tab-bar",this.root.appendChild(e);const n=document.createElement("div");n.className="tab-content",this.root.appendChild(n),this.extensionZone=new r3(e,n,"primary",{onTabActivate:o=>{this.activeTab=o,o==="terminal"&&this.panels?.terminal?.refit?.(),o==="memory"&&this.panels?.memory?.refresh()},onTabClose:o=>{const l=o.startsWith("sprinkle-")?o.slice(9):o;this.onSprinkleClose?.(l)},onAddClick:()=>this.showExtensionPicker(e)},{classPrefix:"tab-bar"});const r=document.createElement("div");r.className="tab-content__panel";const i=document.createElement("div");i.className="tab-content__panel";const a=document.createElement("div");a.className="tab-content__panel";const s=document.createElement("div");s.className="tab-content__panel";for(const{id:o,label:l}of ZB){const c=o==="chat"?r:o==="terminal"?i:o==="files"?a:s;this.extensionZone.addTab({id:o,label:l,closable:!1,element:c,onActivate:o==="terminal"?()=>this.panels?.terminal?.refit?.():o==="memory"?()=>this.panels?.memory?.refresh():void 0}),this.tabContainers.set(o,c)}this.debugTabContainers={terminal:i,memory:s},this.extensionZone.enableAddButton(),this.iframeContainer=document.createElement("div"),this.iframeContainer.id="scoop-iframes",this.iframeContainer.style.display="none",this.root.appendChild(this.iframeContainer),this.scoopsEl=document.createElement("div"),this.scoopsEl.style.display="none",this.root.appendChild(this.scoopsEl),this.panels={chat:new q6(r),terminal:new j6(i,{onClearTerminal:()=>{this.panels.terminal.clearTerminal()}}),fileBrowser:new Q6(a,{onRunCommand:async o=>{await this.runFileBrowserCommand(o),this.extensionZone.activateTab("terminal")},onClearFilesystem:()=>this.onClearFilesystem?.()}),memory:new Y6(s),scoops:new e3(this.scoopsEl,{onScoopSelect:o=>this.onScoopSelect?.(o),onSendMessage:()=>{},onScoopsChanged:o=>this.updateLogoScoops(o)})},this.panels.chat.onModelChange=o=>this.onModelChange?.(o)}showExtensionPicker(e){const n=this.getAvailableSprinkles?.()??[],r=new Set(this.extensionZone.getTabIds()),i=n.filter(a=>!r.has(`sprinkle-${a.name}`));i.length!==0&&i3(e,"primary",{registry:this.registry,callbacks:{onSelectPanel:()=>{},onSelectSprinkle:a=>{this.onOpenSprinkle?.(a)}},getAvailableSprinkles:()=>i})}switchTab(e){this.extensionZone&&this.extensionZone.activateTab(e)}buildSplitLayout(){for(;this.root.firstChild;)this.root.removeChild(this.root.firstChild);this.buildHeader(this.root);const e=document.createElement("div");e.className="layout",this.scoopsEl=document.createElement("div"),this.scoopsEl.className="layout__scoops",e.appendChild(this.scoopsEl),this.leftEl=document.createElement("div"),this.leftEl.className="layout__left",this.threadHeaderEl=document.createElement("div"),this.threadHeaderEl.className="thread-header";const n=document.createElement("div");n.className="thread-header__title";const r=document.createElement("span");r.className="thread-header__icon",r.innerHTML='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 4h14a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H7l-4 3V5a1 1 0 0 1 1-1z"/><path d="M7 8h6"/><path d="M7 11h3"/></svg>',n.appendChild(r),this.threadHeaderName=document.createElement("span"),this.threadHeaderName.className="thread-header__name",this.threadHeaderName.textContent="sliccy",n.appendChild(this.threadHeaderName),this.threadHeaderEl.appendChild(n);const i=document.createElement("button");i.className="thread-header__panel-toggle thread-header__panel-toggle--right",i.dataset.tooltip="Toggle panel",i.setAttribute("aria-label","Toggle panel"),i.innerHTML='<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 3h14a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/><path d="M12 3v14"/></svg>',i.addEventListener("click",()=>{this.rightEl.classList.toggle("layout__right--open")});const a=document.createElement("button");a.className="thread-header__panel-toggle",a.dataset.tooltip="Clear Chat",a.setAttribute("aria-label","Clear Chat"),a.innerHTML='<svg width="16" height="16" viewBox="0 0 20 20" fill="none"><path d="m8.249,15.021c-.4,0-.733-.317-.748-.72l-.25-6.5c-.017-.414.307-.763.72-.778.01-.001.021-.001.03-.001.4,0,.733.317.748.72l.25,6.5c.017.414-.307.763-.72.778-.01.001-.021.001-.03.001Z" fill="currentColor"/><path d="m11.751,15.021c-.01,0-.02,0-.03-.001-.413-.016-.736-.364-.72-.778l.25-6.5c.015-.403.348-.72.748-.72.01,0,.02,0,.03.001.413.016.736.364.72.778l-.25,6.5c-.015.403-.348.72-.748.72Z" fill="currentColor"/><path d="m17,4h-3.5v-.75c0-1.24-1.01-2.25-2.25-2.25h-2.5c-1.24,0-2.25,1.01-2.25,2.25v.75h-3.5c-.414,0-.75.336-.75.75s.336.75.75.75h.52l.422,10.342c.048,1.21,1.036,2.158,2.248,2.158h7.619c1.212,0,2.2-.948,2.248-2.158l.422-10.342h.52c.414,0,.75-.336.75-.75s-.336-.75-.75-.75Zm-9-.75c0-.413.337-.75.75-.75h2.5c.413,0,.75.337.75.75v.75h-4v-.75Zm6.56,12.531c-.017.403-.346.719-.75.719h-7.619c-.404,0-.733-.316-.75-.719l-.42-10.281h9.959l-.42,10.281Z" fill="currentColor"/></svg>',a.addEventListener("click",async()=>{await this.panels.chat.clearSession(),await this.onClearChat?.(),location.reload()});const s=document.createElement("div");s.className="thread-header__actions",s.appendChild(a),s.appendChild(i),this.threadHeaderEl.appendChild(s),this.leftEl.appendChild(this.threadHeaderEl);const o=document.createElement("div");o.style.cssText="display: flex; flex-direction: column; flex: 1; min-height: 0;",this.leftEl.appendChild(o),e.appendChild(this.leftEl),this.verticalDivider=document.createElement("div"),this.verticalDivider.className="layout__divider layout__divider--vertical",e.appendChild(this.verticalDivider),this.rightEl=document.createElement("div"),this.rightEl.className="layout__right",this.primaryZoneEl=document.createElement("div"),this.primaryZoneEl.style.cssText="display: flex; flex-direction: column; min-height: 0; overflow: hidden; flex: 1;";const l=document.createElement("div");l.className="mini-tabs";const c=document.createElement("button");c.className="thread-header__panel-toggle thread-header__panel-toggle--right",c.dataset.tooltip="Close panel",c.setAttribute("aria-label","Close panel"),c.innerHTML='<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v14"/><path d="M3 3h14a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',c.addEventListener("click",()=>{this.rightEl.classList.remove("layout__right--open")}),l.appendChild(c),this.primaryZoneEl.appendChild(l);const u=document.createElement("div");u.style.cssText="flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;",this.primaryZoneEl.appendChild(u),this.primaryZone=new r3(l,u,"primary",{onTabActivate:v=>{v==="terminal"&&this.panels?.terminal?.refit(),v==="memory"&&this.panels?.memory?.refresh()},onTabClose:v=>{const y=v.startsWith("sprinkle-")?v.slice(9):v;this.onSprinkleClose?.(y)},onAddClick:()=>this.showPickerForZone("primary",l),onFullpageToggle:v=>{this.leftEl.classList.toggle("layout__left--fullpage-hidden",v),this.verticalDivider.classList.toggle("layout__divider--fullpage-hidden",v),this.scoopsEl.classList.toggle("layout__scoops--fullpage-hidden",v),this.rightEl.classList.toggle("layout__right--fullpage",v)}}),this.terminalContainer=document.createElement("div"),this.terminalContainer.style.cssText="display: flex; flex-direction: column; min-height: 0; overflow: hidden; flex: 1;";const d=document.createElement("div");d.style.cssText="display: flex; flex-direction: column; min-height: 0; overflow: hidden; flex: 1;";const p=document.createElement("div");p.style.cssText="display: flex; flex-direction: column; min-height: 0; flex: 1;";const f=v=>`<svg width="16" height="16" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">${v}</svg>`,h='<path d="M5.5 14.5C5.30762 14.5 5.11621 14.4268 4.96973 14.2803L1.21973 10.5303C0.92676 10.2373 0.92676 9.76269 1.21973 9.46972L4.96973 5.71972C5.2627 5.42675 5.73731 5.42675 6.03028 5.71972C6.32325 6.01269 6.32325 6.4873 6.03028 6.78027L2.81055 10L6.03028 13.2197C6.32325 13.5127 6.32325 13.9873 6.03028 14.2803C5.8838 14.4268 5.69238 14.5 5.5 14.5Z" fill="currentColor"/><path d="M14.5 14.5C14.3076 14.5 14.1162 14.4268 13.9697 14.2803C13.6768 13.9873 13.6768 13.5127 13.9697 13.2197L17.1895 9.99999L13.9697 6.78026C13.6768 6.48729 13.6768 6.01268 13.9697 5.71971C14.2627 5.42674 14.7373 5.42674 15.0303 5.71971L18.7803 9.46971C19.0732 9.76268 19.0732 10.2373 18.7803 10.5303L15.0303 14.2803C14.8838 14.4267 14.6924 14.5 14.5 14.5Z" fill="currentColor"/><path d="M8.22852 18C8.16993 18 8.11036 17.9932 8.05176 17.9795C7.64844 17.8818 7.40137 17.4766 7.49805 17.0742L10.998 2.57422C11.0957 2.1709 11.5078 1.92871 11.9033 2.02051C12.3066 2.11817 12.5537 2.52344 12.457 2.92578L8.95703 17.4258C8.87402 17.7695 8.56642 18 8.22852 18Z" fill="currentColor"/>',m='<path d="M18 4.75C18 2.61621 13.9756 1.5 10 1.5C6.02441 1.5 2 2.61621 2 4.75C2 4.81714 2.01538 4.88037 2.02325 4.94556C2.01696 4.98462 2 5.01978 2 5.06055V15C2 17.0615 6.14697 18 10 18C13.853 18 18 17.0615 18 15V5.06055C18 5.01978 17.983 4.98462 17.9767 4.94556C17.9846 4.88037 18 4.81714 18 4.75ZM16.5002 9.99451C16.4084 10.4097 14.2719 11.5 10 11.5C5.72705 11.5 3.59033 10.4092 3.5 10V6.72449C5.02985 7.56665 7.52393 8 10 8C12.4761 8 14.9701 7.56665 16.5001 6.72437L16.5002 9.99451ZM10 3C14.2886 3 16.5 4.22656 16.5 4.75C16.5 5.27344 14.2886 6.5 10 6.5C5.71143 6.5 3.5 5.27344 3.5 4.75C3.5 4.22656 5.71143 3 10 3ZM10 16.5C5.72705 16.5 3.59033 15.4092 3.5 15V11.8464C5.05219 12.6304 7.58337 13 10 13C12.4168 13 14.9482 12.6304 16.5003 11.8463L16.5005 14.9941C16.4097 15.4092 14.273 16.5 10 16.5Z" fill="currentColor"/>',g='<path d="M10.0039 12.5889C9.11573 12.5889 8.25098 12.1289 7.77588 11.3057C7.06787 10.0781 7.48975 8.50489 8.71582 7.79688C9.30908 7.45313 10.001 7.36329 10.665 7.54004C11.3276 7.71777 11.8814 8.14356 12.2241 8.73731C12.5674 9.33106 12.6582 10.0234 12.481 10.6855C12.3032 11.3486 11.8784 11.9024 11.2842 12.2451C10.8809 12.4785 10.4395 12.5889 10.0039 12.5889ZM9.07471 10.5557C9.36914 11.0645 10.0229 11.2392 10.5342 10.9463C10.7812 10.8037 10.958 10.5732 11.0317 10.2978C11.1055 10.0225 11.0679 9.73436 10.9253 9.48729C10.7822 9.24022 10.5522 9.06346 10.2764 8.98924C10.0015 8.916 9.71337 8.95408 9.46581 9.09569C8.95556 9.39061 8.78027 10.0449 9.07471 10.5557Z" fill="currentColor"/><path d="M6.90674 18.3184C6.56738 18.3184 6.22461 18.2334 5.91455 18.0537L5.09473 17.5811C4.20166 17.0674 3.84473 15.9316 4.28369 14.998L4.86377 13.7646C4.59863 13.4014 4.37402 13.0137 4.19189 12.6035L2.83496 12.4912C1.80615 12.4063 1.00049 11.5313 1.00049 10.5L0.99951 9.55371C0.99951 8.52051 1.80469 7.64453 2.83301 7.55957L4.1875 7.44531C4.2793 7.23633 4.37988 7.03613 4.48926 6.8457C4.59912 6.65429 4.72266 6.46679 4.8584 6.28125L4.27783 5.05176C3.83691 4.11914 4.1914 2.9834 5.08496 2.4668L5.90527 1.99317C6.79785 1.47657 7.95898 1.73438 8.54785 2.58301L9.32519 3.70117C9.76904 3.65137 10.2173 3.65332 10.666 3.70117L11.4414 2.58203C12.0303 1.73242 13.1924 1.47265 14.085 1.98828L14.9048 2.46094C15.7988 2.97656 16.1543 4.11231 15.7153 5.04492L15.1352 6.27734C15.4009 6.6416 15.6255 7.02929 15.8071 7.43847L17.164 7.55077C18.1924 7.63573 18.998 8.51073 18.999 9.54198L18.9995 10.4893C19.0005 11.5205 18.1958 12.3965 17.1675 12.4834L15.812 12.5976C15.7207 12.8066 15.6201 13.0059 15.5093 13.1973C15.3999 13.3867 15.2769 13.5752 15.1411 13.7607L15.7217 14.9902C16.1621 15.9219 15.8081 17.0576 14.915 17.5752L14.0942 18.0498C13.2007 18.5684 12.0405 18.3076 11.4517 17.459L10.6743 16.3408C10.2285 16.3897 9.78028 16.3887 9.3335 16.3418L8.55713 17.4619C8.17334 18.0156 7.54541 18.3184 6.90674 18.3184ZM6.9043 3.22461C6.81934 3.22461 6.73389 3.24609 6.65625 3.29102L5.83545 3.76563C5.61279 3.89454 5.52393 4.17774 5.63428 4.41114L6.41309 6.06153C6.53907 6.32813 6.49707 6.64356 6.30567 6.86817C6.10157 7.10743 5.93262 7.34473 5.78907 7.59376C5.64796 7.83985 5.52393 8.11231 5.42091 8.40333C5.32277 8.68165 5.07081 8.87599 4.77687 8.9004L2.95802 9.05372C2.6963 9.07618 2.49952 9.29005 2.49952 9.55274L2.5005 10.499C2.5005 10.7568 2.70167 10.9756 2.959 10.9971L4.77834 11.1475C5.07229 11.1719 5.32473 11.3662 5.42336 11.6445C5.62209 12.2051 5.92043 12.7207 6.31008 13.1768C6.50197 13.4004 6.54446 13.7168 6.41897 13.9834L5.64114 15.6358C5.53176 15.8692 5.62014 16.1533 5.84378 16.2813L6.66409 16.7549C6.88821 16.8848 7.17825 16.8184 7.32425 16.6074L8.36527 15.1055C8.53275 14.8633 8.82425 14.7363 9.11771 14.7959C9.70609 14.9033 10.3023 14.9043 10.8877 14.7949C11.1773 14.7402 11.4727 14.8613 11.6412 15.1045L12.6831 16.6035C12.8296 16.8135 13.1216 16.8799 13.3438 16.751L14.1641 16.2773C14.3902 16.1465 14.4776 15.8682 14.3653 15.6309L13.5864 13.9805C13.4605 13.7139 13.5025 13.3984 13.6939 13.1738C13.898 12.9336 14.0669 12.6973 14.2095 12.4492L14.21 12.4483C14.3526 12.2012 14.4732 11.9365 14.5786 11.6387C14.6773 11.3604 14.9292 11.166 15.2232 11.1416L17.042 10.9893C17.2984 10.9668 17.4995 10.7481 17.4995 10.4902L17.499 9.54298C17.499 9.28126 17.3018 9.06739 17.0401 9.04493L15.2212 8.89454C14.9273 8.87013 14.6748 8.67579 14.5762 8.39747C14.3784 7.8379 14.0796 7.32227 13.689 6.86524C13.4976 6.64063 13.4551 6.3252 13.5806 6.0586L14.3579 4.40626C14.4678 4.17286 14.3789 3.88868 14.1553 3.75978L13.3355 3.28712C13.1108 3.16017 12.8213 3.2256 12.6743 3.43653L11.6348 4.93653C11.4668 5.17969 11.1758 5.30469 10.8819 5.24708C10.2905 5.1377 9.69435 5.1377 9.11183 5.24708C8.81984 5.29884 8.52638 5.1797 8.35841 4.93751L7.31642 3.43849C7.22023 3.30079 7.06348 3.22461 6.9043 3.22461Z" fill="currentColor"/>';this.primaryZone.addTab({id:"terminal",label:"Terminal",closable:!1,element:this.terminalContainer,pinned:!0,icon:f(h),onActivate:()=>this.panels?.terminal?.refit()}),this.primaryZone.addTab({id:"files",label:"Files",closable:!1,element:d,pinned:!0,icon:f(m)}),this.primaryZone.addTab({id:"memory",label:"Memory",closable:!1,element:p,pinned:!0,icon:f(g),onActivate:()=>this.panels?.memory?.refresh()}),this.primaryZone.enableAddButton(),this.primaryZone.enableFullpageButton(),this.rightEl.appendChild(this.primaryZoneEl),e.appendChild(this.rightEl),this.iframeContainer=document.createElement("div"),this.iframeContainer.id="scoop-iframes",this.iframeContainer.style.display="none",e.appendChild(this.iframeContainer),this.root.appendChild(e),this.panels={chat:new q6(o),terminal:new j6(this.terminalContainer,{onClearTerminal:()=>{this.panels.terminal.clearTerminal(),this.openTerminal()}}),fileBrowser:new Q6(d,{onRunCommand:async v=>{await this.runFileBrowserCommand(v),this.openTerminal()},onClearFilesystem:()=>this.onClearFilesystem?.()}),memory:new Y6(p),scoops:new e3(this.scoopsEl,{onScoopSelect:v=>{this.onScoopSelect?.(v),this.threadHeaderName.textContent=v.assistantLabel},onSendMessage:()=>{},onScoopsChanged:v=>this.updateLogoScoops(v)})},this.panels.chat.onModelChange=v=>this.onModelChange?.(v),this.setupVerticalDrag(),window.addEventListener("resize",()=>{})}getIframeContainer(){return this.iframeContainer}async runFileBrowserCommand(e){const n=await this.panels.terminal.runCommand(e);n.exitCode!==0&&n.stderr&&console.warn("[Layout] File browser command failed:",n.stderr.trim())}setupVerticalDrag(){if(!this.verticalDivider)return;let e=!1;const n=i=>{if(!e)return;const a=this.root.querySelector(".layout")?.getBoundingClientRect();if(!a)return;const s=58,o=i.clientX-a.left-s,l=a.width-s,c=Math.max(.3,Math.min(.7,o/l));this.leftEl.style.flex=`${c*100} 0 0`,this.rightEl.style.flex=`${(1-c)*100} 0 0`},r=()=>{e=!1,this.verticalDivider.classList.remove("active"),document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r),this.panels?.terminal?.refit()};this.verticalDivider.addEventListener("mousedown",i=>{i.preventDefault(),e=!0,this.verticalDivider.classList.add("active"),document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)})}updateAddButtons(){const e=this.registry.getClosed().length,n=this.getAvailableSprinkles?.()??[],r=new Set;for(const s of this.registry.ids())s.startsWith("sprinkle-")&&this.registry.get(s)?.descriptor.zone!==null&&r.add(s.slice(9));const i=n.filter(s=>!r.has(s.name)).length,a=e+i>0;this.primaryZone?.setAddButtonEnabled(a)}showPickerForZone(e,n){const r=new Set;for(const a of this.registry.ids())a.startsWith("sprinkle-")&&this.registry.get(a)?.descriptor.zone!==null&&r.add(a.slice(9));const i=(this.getAvailableSprinkles?.()??[]).filter(a=>!r.has(a.name));i3(n,e,{registry:this.registry,callbacks:{onSelectPanel:(a,s)=>{this.openPanelInZone(a,s)},onSelectSprinkle:(a,s)=>{this.onOpenSprinkle?.(a,s)}},getAvailableSprinkles:()=>i})}openPanelInZone(e,n){const r=this.registry.get(e);if(!r)return;const i=this.primaryZone;this.registry.setZone(e,n),i.addTab({id:r.descriptor.id,label:r.descriptor.label,closable:r.descriptor.closable,element:r.descriptor.element,onActivate:r.descriptor.onActivate}),i.activateTab(e)}dynamicSprinkles=new Map;addSprinkle(e,n,r,i){if(this.isExtension){const a=`sprinkle-${e}`,s=document.createElement("div");s.className="tab-content__panel",s.appendChild(r),this.extensionZone.addTab({id:a,label:n,closable:!0,element:s}),this.tabContainers.set(a,s),this.dynamicSprinkles.set(e,s),this.extensionZone.activateTab(a)}else{const a=i??"primary",s=this.primaryZone,o=`sprinkle-${e}`,l=document.createElement("div");l.style.cssText="display: flex; flex-direction: column; min-height: 0; overflow: auto; flex: 1;",l.appendChild(r),this.registry.register({id:o,label:n,zone:a,closable:!0,element:l,onClose:()=>this.onSprinkleClose?.(e)}),s.addTab({id:o,label:n,closable:!0,element:l}),this.dynamicSprinkles.set(e,l),s.activateTab(o),this.updateAddButtons()}}removeSprinkle(e){if(this.isExtension){const n=`sprinkle-${e}`;this.extensionZone.removeTab(n),this.tabContainers.delete(n),this.dynamicSprinkles.delete(e)}else{const n=`sprinkle-${e}`;this.primaryZone.removeTab(n),this.registry.unregister(n),this.dynamicSprinkles.delete(e),this.updateAddButtons()}}dispose(){for(this.panels.chat.dispose(),this.panels.terminal.dispose(),this.panels.fileBrowser.dispose(),this.panels.memory.dispose();this.root.firstChild;)this.root.removeChild(this.root.firstChild)}}const YB=300,fc=6;let al=null,qd=null;function XB(){return al||(al=document.createElement("div"),al.className="s2-tooltip",document.body.appendChild(al)),al}function ez(t){const e=t.getAttribute("data-tooltip");if(!e)return;const n=XB();n.textContent=e,n.classList.remove("s2-tooltip--visible"),n.style.left="0",n.style.top="0";const r=t.getBoundingClientRect(),i=n.getBoundingClientRect(),a=t.getAttribute("data-tooltip-pos")||"bottom";let s,o;a==="top"?(s=r.top-i.height-fc,o=r.left+r.width/2-i.width/2):a==="right"?(s=r.top+r.height/2-i.height/2,o=r.right+fc):(s=r.bottom+fc,o=r.left+r.width/2-i.width/2),a==="bottom"&&s+i.height>window.innerHeight-4?s=r.top-i.height-fc:a==="top"&&s<4&&(s=r.bottom+fc),o<4&&(o=4),o+i.width>window.innerWidth-4&&(o=window.innerWidth-i.width-4),n.style.top=`${s}px`,n.style.left=`${o}px`,n.classList.add("s2-tooltip--visible")}function jh(){qd&&(clearTimeout(qd),qd=null),al?.classList.remove("s2-tooltip--visible")}function tz(){document.addEventListener("pointerenter",t=>{const e=t.target.closest?.("[data-tooltip]");e&&(jh(),qd=setTimeout(()=>ez(e),YB))},!0),document.addEventListener("pointerleave",t=>{t.target.closest?.("[data-tooltip]")&&jh()},!0),document.addEventListener("pointerdown",jh,!0)}var Gh,s3;function nz(){if(s3)return Gh;s3=1,Gh=t;function t(e){var n,r;if(typeof e!="function")throw new Error("expected a function but got "+e);return function(){return n||(n=!0,r=e.apply(this,arguments)),r}}return Gh}var Hh={},o3;function rz(){return o3||(o3=1,(function(t){function e(v,y){var b;return v instanceof Buffer?b=v:b=Buffer.from(v.buffer,v.byteOffset,v.byteLength),b.toString(y)}var n=function(v){return Buffer.from(v)};function r(v){for(var y=0,b=Math.min(256*256,v.length+1),S=new Uint16Array(b),A=[],_=0;;){var I=y<v.length;if(!I||_>=b-1){var P=S.subarray(0,_),B=P;if(A.push(String.fromCharCode.apply(null,B)),!I)return A.join("");v=v.subarray(y),y=0,_=0}var D=v[y++];if((D&128)===0)S[_++]=D;else if((D&224)===192){var O=v[y++]&63;S[_++]=(D&31)<<6|O}else if((D&240)===224){var O=v[y++]&63,z=v[y++]&63;S[_++]=(D&31)<<12|O<<6|z}else if((D&248)===240){var O=v[y++]&63,z=v[y++]&63,L=v[y++]&63,U=(D&7)<<18|O<<12|z<<6|L;U>65535&&(U-=65536,S[_++]=U>>>10&1023|55296,U=56320|U&1023),S[_++]=U}}}function i(v){for(var y=0,b=v.length,S=0,A=Math.max(32,b+(b>>>1)+7),_=new Uint8Array(A>>>3<<3);y<b;){var I=v.charCodeAt(y++);if(I>=55296&&I<=56319){if(y<b){var P=v.charCodeAt(y);(P&64512)===56320&&(++y,I=((I&1023)<<10)+(P&1023)+65536)}if(I>=55296&&I<=56319)continue}if(S+4>_.length){A+=8,A*=1+y/v.length*2,A=A>>>3<<3;var B=new Uint8Array(A);B.set(_),_=B}if((I&4294967168)===0){_[S++]=I;continue}else if((I&4294965248)===0)_[S++]=I>>>6&31|192;else if((I&4294901760)===0)_[S++]=I>>>12&15|224,_[S++]=I>>>6&63|128;else if((I&4292870144)===0)_[S++]=I>>>18&7|240,_[S++]=I>>>12&63|128,_[S++]=I>>>6&63|128;else continue;_[S++]=I&63|128}return _.slice?_.slice(0,S):_.subarray(0,S)}var a="Failed to ",s=function(v,y,b){if(v)throw new Error("".concat(a).concat(y,": the '").concat(b,"' option is unsupported."))},o=typeof Buffer=="function"&&Buffer.from,l=o?n:i;function c(){this.encoding="utf-8"}c.prototype.encode=function(v,y){return s(y&&y.stream,"encode","stream"),l(v)};function u(v){var y;try{var b=new Blob([v],{type:"text/plain;charset=UTF-8"});y=URL.createObjectURL(b);var S=new XMLHttpRequest;return S.open("GET",y,!1),S.send(),S.responseText}finally{y&&URL.revokeObjectURL(y)}}var d=!o&&typeof Blob=="function"&&typeof URL=="function"&&typeof URL.createObjectURL=="function",p=["utf-8","utf8","unicode-1-1-utf-8"],f=r;o?f=e:d&&(f=function(v){try{return u(v)}catch{return r(v)}});var h="construct 'TextDecoder'",m="".concat(a," ").concat(h,": the ");function g(v,y){s(y&&y.fatal,h,"fatal"),v=v||"utf-8";var b;if(o?b=Buffer.isEncoding(v):b=p.indexOf(v.toLowerCase())!==-1,!b)throw new RangeError("".concat(m," encoding label provided ('").concat(v,"') is invalid."));this.encoding=v,this.fatal=!1,this.ignoreBOM=!1}g.prototype.decode=function(v,y){s(y&&y.stream,"decode","stream");var b;return v instanceof Uint8Array?b=v:v.buffer instanceof ArrayBuffer?b=new Uint8Array(v.buffer):b=new Uint8Array(v),f(b,this.encoding)},t.TextEncoder=t.TextEncoder||c,t.TextDecoder=t.TextDecoder||g})(typeof window<"u"?window:typeof globalThis<"u"?globalThis:Hh)),Hh}var Vh,l3;function iz(){return l3||(l3=1,rz(),Vh={encode:t=>new TextEncoder().encode(t),decode:t=>new TextDecoder().decode(t)}),Vh}var Zh,c3;function az(){if(c3)return Zh;c3=1,Zh=t;function t(e,n,r){var i;return function(){if(!n)return e.apply(this,arguments);var a=this,s=arguments,o=r&&!i;if(clearTimeout(i),i=setTimeout(function(){if(i=null,!o)return e.apply(a,s)},n),o)return e.apply(this,arguments)}}return Zh}var Kh,u3;function fy(){if(u3)return Kh;u3=1;function t(o){if(o.length===0)return".";let l=r(o);return l=l.reduce(s,[]),n(...l)}function e(...o){let l="";for(let c of o)c.startsWith("/")?l=c:l=t(n(l,c));return l}function n(...o){if(o.length===0)return"";let l=o.join("/");return l=l.replace(/\/{2,}/g,"/"),l}function r(o){if(o.length===0)return[];if(o==="/")return["/"];let l=o.split("/");return l[l.length-1]===""&&l.pop(),o[0]==="/"?l[0]="/":l[0]!=="."&&l.unshift("."),l}function i(o){const l=o.lastIndexOf("/");if(l===-1)throw new Error(`Cannot get dirname of "${o}"`);return l===0?"/":o.slice(0,l)}function a(o){if(o==="/")throw new Error(`Cannot get basename of "${o}"`);const l=o.lastIndexOf("/");return l===-1?o:o.slice(l+1)}function s(o,l){if(o.length===0)return o.push(l),o;if(l===".")return o;if(l===".."){if(o.length===1){if(o[0]==="/")throw new Error("Unable to normalize path - traverses above root directory");if(o[0]===".")return o.push(l),o}return o[o.length-1]===".."?(o.push(".."),o):(o.pop(),o)}return o.push(l),o}return Kh={join:n,normalize:t,split:r,basename:a,dirname:i,resolve:e},Kh}var Jh,d3;function zS(){if(d3)return Jh;d3=1;function t(o){return class extends Error{constructor(...l){super(...l),this.code=o,this.message?this.message=o+": "+this.message:this.message=o}}}const e=t("EEXIST"),n=t("ENOENT"),r=t("ENOTDIR"),i=t("ENOTEMPTY"),a=t("ETIMEDOUT"),s=t("EISDIR");return Jh={EEXIST:e,ENOENT:n,ENOTDIR:r,ENOTEMPTY:i,ETIMEDOUT:a,EISDIR:s},Jh}var Qh,p3;function sz(){if(p3)return Qh;p3=1;const t=fy(),{EEXIST:e,ENOENT:n,ENOTDIR:r,ENOTEMPTY:i,EISDIR:a}=zS(),s=0;return Qh=class{constructor(){}_makeRoot(l=new Map){return l.set(s,{mode:511,type:"dir",size:0,ino:0,mtimeMs:Date.now()}),l}activate(l=null){l===null?this._root=new Map([["/",this._makeRoot()]]):typeof l=="string"?this._root=new Map([["/",this._makeRoot(this.parse(l))]]):this._root=l}get activated(){return!!this._root}deactivate(){this._root=void 0}size(){return this._countInodes(this._root.get("/"))-1}_countInodes(l){let c=1;for(let[u,d]of l)u!==s&&(c+=this._countInodes(d));return c}autoinc(){return this._maxInode(this._root.get("/"))+1}_maxInode(l){let c=l.get(s).ino;for(let[u,d]of l)u!==s&&(c=Math.max(c,this._maxInode(d)));return c}print(l=this._root.get("/")){let c="";const u=(d,p)=>{for(let[f,h]of d){if(f===0)continue;let m=h.get(s),g=m.mode.toString(8);c+=`${" ".repeat(p)}${f} ${g}`,m.type==="file"?c+=` ${m.size} ${m.mtimeMs}
|
|
740
740
|
`:(c+=`
|
|
741
741
|
`,u(h,p+1))}};return u(l,0),c}parse(l){let c=0;function u(h){const m=++c,g=h.length===1?"dir":"file";let[v,y,b]=h;return v=parseInt(v,8),y=y?parseInt(y):0,b=b?parseInt(b):Date.now(),new Map([[s,{mode:v,type:g,size:y,mtimeMs:b,ino:m}]])}let d=l.trim().split(`
|
|
742
|
-
`),p=this._makeRoot(),f=[{indent:-1,node:p},{indent:0,node:null}];for(let h of d){let g=h.match(/^\t*/)[0].length;h=h.slice(g);let[v,...y]=h.split(" "),b=u(y);if(g<=f[f.length-1].indent)for(;g<=f[f.length-1].indent;)f.pop();f.push({indent:g,node:b}),f[f.length-2].node.set(v,b)}return p}_lookup(l,c=!0){let u=this._root,d="/",p=t.split(l);for(let f=0;f<p.length;++f){let h=p[f];if(u=u.get(h),!u)throw new n(l);if(c||f<p.length-1){const m=u.get(s);if(m.type==="symlink"){let g=t.resolve(d,m.target);u=this._lookup(g)}d?d=t.join(d,h):d=h}}return u}mkdir(l,{mode:c}){if(l==="/")throw new e;let u=this._lookup(t.dirname(l)),d=t.basename(l);if(u.has(d))throw new e;let p=new Map,f={mode:c,type:"dir",size:0,mtimeMs:Date.now(),ino:this.autoinc()};p.set(s,f),u.set(d,p)}rmdir(l){let c=this._lookup(l);if(c.get(s).type!=="dir")throw new r;if(c.size>1)throw new i;let u=this._lookup(t.dirname(l)),d=t.basename(l);u.delete(d)}readdir(l){let c=this._lookup(l);if(c.get(s).type!=="dir")throw new r;return[...c.keys()].filter(u=>typeof u=="string")}writeStat(l,c,{mode:u}){let d,p;try{p=this.stat(l)}catch{}if(p!==void 0){if(p.type==="dir")throw new a;u==null&&(u=p.mode),d=p.ino}u==null&&(u=438),d==null&&(d=this.autoinc());let f=this._lookup(t.dirname(l)),h=t.basename(l),m={mode:u,type:"file",size:c,mtimeMs:Date.now(),ino:d},g=new Map;return g.set(s,m),f.set(h,g),m}unlink(l){let c=this._lookup(t.dirname(l)),u=t.basename(l);c.delete(u)}rename(l,c){let u=t.basename(c),d=this._lookup(l);this._lookup(t.dirname(c)).set(u,d),this.unlink(l)}stat(l){return this._lookup(l).get(s)}lstat(l){return this._lookup(l,!1).get(s)}readlink(l){return this._lookup(l,!1).get(s).target}symlink(l,c){let u,d;try{let g=this.stat(c);d===null&&(d=g.mode),u=g.ino}catch{}d==null&&(d=40960),u==null&&(u=this.autoinc());let p=this._lookup(t.dirname(c)),f=t.basename(c),h={mode:d,type:"symlink",target:l,size:0,mtimeMs:Date.now(),ino:u},m=new Map;return m.set(s,h),p.set(f,m),h}_du(l){let c=0;for(const[u,d]of l.entries())u===s?c+=d.size:c+=this._du(d);return c}du(l){let c=this._lookup(l);return this._du(c)}},Qh}class qS{constructor(e="keyval-store",n="keyval"){this.storeName=n,this._dbName=e,this._storeName=n,this._init()}_init(){this._dbp||(this._dbp=new Promise((e,n)=>{const r=indexedDB.open(this._dbName);r.onerror=()=>n(r.error),r.onsuccess=()=>e(r.result),r.onupgradeneeded=()=>{r.result.createObjectStore(this._storeName)}}))}_withIDBStore(e,n){return this._init(),this._dbp.then(r=>new Promise((i,a)=>{const s=r.transaction(this.storeName,e);s.oncomplete=()=>i(),s.onabort=s.onerror=()=>a(s.error),n(s.objectStore(this.storeName))}))}_close(){return this._init(),this._dbp.then(e=>{e.close(),this._dbp=void 0})}}let Yh;function No(){return Yh||(Yh=new qS),Yh}function oz(t,e=No()){let n;return e._withIDBStore("readwrite",r=>{n=r.get(t)}).then(()=>n.result)}function lz(t,e,n=No()){return n._withIDBStore("readwrite",r=>{r.put(e,t)})}function cz(t,e,n=No()){return n._withIDBStore("readwrite",r=>{const i=r.get(t);i.onsuccess=()=>{r.put(e(i.result),t)}})}function uz(t,e=No()){return e._withIDBStore("readwrite",n=>{n.delete(t)})}function dz(t=No()){return t._withIDBStore("readwrite",e=>{e.clear()})}function pz(t=No()){const e=[];return t._withIDBStore("readwrite",n=>{(n.openKeyCursor||n.openCursor).call(n).onsuccess=function(){this.result&&(e.push(this.result.key),this.result.continue())}}).then(()=>e)}function fz(t=No()){return t._close()}const hz=Object.freeze(Object.defineProperty({__proto__:null,Store:qS,clear:dz,close:fz,del:uz,get:oz,keys:pz,set:lz,update:cz},Symbol.toStringTag,{value:"Module"})),jS=cF(hz);var Xh,f3;function mz(){if(f3)return Xh;f3=1;const t=jS;return Xh=class{constructor(n,r){this._database=n,this._storename=r,this._store=new t.Store(this._database,this._storename)}saveSuperblock(n){return t.set("!root",n,this._store)}loadSuperblock(){return t.get("!root",this._store)}readFile(n){return t.get(n,this._store)}writeFile(n,r){return t.set(n,r,this._store)}unlink(n){return t.del(n,this._store)}wipe(){return t.clear(this._store)}close(){return t.close(this._store)}},Xh}var em,h3;function gz(){return h3||(h3=1,em=class{constructor(e){this._url=e}loadSuperblock(){return fetch(this._url+"/.superblock.txt").then(e=>e.ok?e.text():null)}async readFile(e){const n=await fetch(this._url+e);if(n.status===200)return n.arrayBuffer();throw new Error("ENOENT")}async sizeFile(e){const n=await fetch(this._url+e,{method:"HEAD"});if(n.status===200)return n.headers.get("content-length");throw new Error("ENOENT")}}),em}var tm,m3;function vz(){if(m3)return tm;m3=1;const t=jS,e=n=>new Promise(r=>setTimeout(r,n));return tm=class{constructor(r,i){this._id=Math.random(),this._database=r,this._storename=i,this._store=new t.Store(this._database,this._storename),this._lock=null}async has({margin:r=2e3}={}){if(this._lock&&this._lock.holder===this._id){const i=Date.now();return this._lock.expires>i+r?!0:await this.renew()}else return!1}async renew({ttl:r=5e3}={}){let i;return await t.update("lock",a=>{const o=Date.now()+r;return i=a&&a.holder===this._id,this._lock=i?{holder:this._id,expires:o}:a,this._lock},this._store),i}async acquire({ttl:r=5e3}={}){let i,a,s;if(await t.update("lock",o=>{const l=Date.now(),c=l+r;return a=o&&o.expires<l,i=o===void 0||a,s=o&&o.holder===this._id,this._lock=i?{holder:this._id,expires:c}:o,this._lock},this._store),s)throw new Error("Mutex double-locked");return i}async wait({interval:r=100,limit:i=6e3,ttl:a}={}){for(;i--;){if(await this.acquire({ttl:a}))return!0;await e(r)}throw new Error("Mutex timeout")}async release({force:r=!1}={}){let i,a,s;if(await t.update("lock",o=>(i=r||o&&o.holder===this._id,a=o===void 0,s=o&&o.holder!==this._id,this._lock=i?void 0:o,this._lock),this._store),await t.close(this._store),!i&&!r){if(a)throw new Error("Mutex double-freed");if(s)throw new Error("Mutex lost ownership")}return i}},tm}var nm,g3;function yz(){return g3||(g3=1,nm=class{constructor(e){this._id=Math.random(),this._database=e,this._has=!1,this._release=null}async has(){return this._has}async acquire(){return new Promise(e=>{navigator.locks.request(this._database+"_lock",{ifAvailable:!0},n=>(this._has=!!n,e(!!n),new Promise(r=>{this._release=r})))})}async wait({timeout:e=6e5}={}){return new Promise((n,r)=>{const i=new AbortController;setTimeout(()=>{i.abort(),r(new Error("Mutex timeout"))},e),navigator.locks.request(this._database+"_lock",{signal:i.signal},a=>(this._has=!!a,n(!!a),new Promise(s=>{this._release=s})))})}async release({force:e=!1}={}){this._has=!1,this._release?this._release():e&&navigator.locks.request(this._database+"_lock",{steal:!0},n=>!0)}}),nm}var rm,v3;function wz(){if(v3)return rm;v3=1;const{encode:t,decode:e}=iz(),n=az(),r=sz(),{ENOENT:i,ENOTEMPTY:a,ETIMEDOUT:s}=zS(),o=mz(),l=gz(),c=vz(),u=yz(),d=fy();return rm=class{constructor(){this.saveSuperblock=n(()=>{this.flush()},500)}async init(f,{wipe:h,url:m,urlauto:g,fileDbName:v=f,db:y=null,fileStoreName:b=f+"_files",lockDbName:S=f+"_lock",lockStoreName:A=f+"_lock"}={}){this._name=f,this._idb=y||new o(v,b),this._mutex=navigator.locks?new u(f):new c(S,A),this._cache=new r(f),this._opts={wipe:h,url:m},this._needsWipe=!!h,m&&(this._http=new l(m),this._urlauto=!!g)}async activate(){if(this._cache.activated)return;this._needsWipe&&(this._needsWipe=!1,await this._idb.wipe(),await this._mutex.release({force:!0})),await this._mutex.has()||await this._mutex.wait();const f=await this._idb.loadSuperblock();if(f)this._cache.activate(f);else if(this._http){const h=await this._http.loadSuperblock();this._cache.activate(h),await this._saveSuperblock()}else this._cache.activate();if(!await this._mutex.has())throw new s}async deactivate(){await this._mutex.has()&&await this._saveSuperblock(),this._cache.deactivate();try{await this._mutex.release()}catch(f){console.log(f)}await this._idb.close()}async _saveSuperblock(){this._cache.activated&&(this._lastSavedAt=Date.now(),await this._idb.saveSuperblock(this._cache._root))}_writeStat(f,h,m){let g=d.split(d.dirname(f)),v=g.shift();for(let y of g){v=d.join(v,y);try{this._cache.mkdir(v,{mode:511})}catch{}}return this._cache.writeStat(f,h,m)}async readFile(f,h){const m=typeof h=="string"?h:h&&h.encoding;if(m&&m!=="utf8")throw new Error('Only "utf8" encoding is supported in readFile');let g=null,v=null;try{v=this._cache.stat(f),g=await this._idb.readFile(v.ino)}catch(y){if(!this._urlauto)throw y}if(!g&&this._http){let y=this._cache.lstat(f);for(;y.type==="symlink";)f=d.resolve(d.dirname(f),y.target),y=this._cache.lstat(f);g=await this._http.readFile(f)}if(g&&((!v||v.size!=g.byteLength)&&(v=await this._writeStat(f,g.byteLength,{mode:v?v.mode:438}),this.saveSuperblock()),m==="utf8"?g=e(g):g.toString=()=>e(g)),!v)throw new i(f);return g}async writeFile(f,h,m){const{mode:g,encoding:v="utf8"}=m;if(typeof h=="string"){if(v!=="utf8")throw new Error('Only "utf8" encoding is supported in writeFile');h=t(h)}const y=await this._cache.writeStat(f,h.byteLength,{mode:g});await this._idb.writeFile(y.ino,h)}async unlink(f,h){const m=this._cache.lstat(f);this._cache.unlink(f),m.type!=="symlink"&&await this._idb.unlink(m.ino)}readdir(f,h){return this._cache.readdir(f)}mkdir(f,h){const{mode:m=511}=h;this._cache.mkdir(f,{mode:m})}rmdir(f,h){if(f==="/")throw new a;this._cache.rmdir(f)}rename(f,h){this._cache.rename(f,h)}stat(f,h){return this._cache.stat(f)}lstat(f,h){return this._cache.lstat(f)}readlink(f,h){return this._cache.readlink(f)}symlink(f,h){this._cache.symlink(f,h)}async backFile(f,h){let m=await this._http.sizeFile(f);await this._writeStat(f,m,h)}du(f){return this._cache.du(f)}flush(){return this._saveSuperblock()}},rm}var im,y3;function bz(){return y3||(y3=1,im=class{constructor(e){this.type=e.type,this.mode=e.mode,this.size=e.size,this.ino=e.ino,this.mtimeMs=e.mtimeMs,this.ctimeMs=e.ctimeMs||e.mtimeMs,this.uid=1,this.gid=1,this.dev=1}isFile(){return this.type==="file"}isDirectory(){return this.type==="dir"}isSymbolicLink(){return this.type==="symlink"}}),im}var am,w3;function xz(){if(w3)return am;w3=1;const t=wz(),e=bz(),n=fy();function r(s,o,...l){return s=n.normalize(s),(typeof o>"u"||typeof o=="function")&&(o={}),typeof o=="string"&&(o={encoding:o}),[s,o,...l]}function i(s,o,l,...c){return s=n.normalize(s),(typeof l>"u"||typeof l=="function")&&(l={}),typeof l=="string"&&(l={encoding:l}),[s,o,l,...c]}function a(s,o,...l){return[n.normalize(s),n.normalize(o),...l]}return am=class{constructor(o,l={}){this.init=this.init.bind(this),this.readFile=this._wrap(this.readFile,r,!1),this.writeFile=this._wrap(this.writeFile,i,!0),this.unlink=this._wrap(this.unlink,r,!0),this.readdir=this._wrap(this.readdir,r,!1),this.mkdir=this._wrap(this.mkdir,r,!0),this.rmdir=this._wrap(this.rmdir,r,!0),this.rename=this._wrap(this.rename,a,!0),this.stat=this._wrap(this.stat,r,!1),this.lstat=this._wrap(this.lstat,r,!1),this.readlink=this._wrap(this.readlink,r,!1),this.symlink=this._wrap(this.symlink,a,!0),this.backFile=this._wrap(this.backFile,r,!0),this.du=this._wrap(this.du,r,!1),this._deactivationPromise=null,this._deactivationTimeout=null,this._activationPromise=null,this._operations=new Set,o&&this.init(o,l)}async init(...o){return this._initPromiseResolve&&await this._initPromise,this._initPromise=this._init(...o),this._initPromise}async _init(o,l={}){await this._gracefulShutdown(),this._activationPromise&&await this._deactivate(),this._backend&&this._backend.destroy&&await this._backend.destroy(),this._backend=l.backend||new t,this._backend.init&&await this._backend.init(o,l),this._initPromiseResolve&&(this._initPromiseResolve(),this._initPromiseResolve=null),l.defer||this.stat("/")}async _gracefulShutdown(){this._operations.size>0&&(this._isShuttingDown=!0,await new Promise(o=>this._gracefulShutdownResolve=o),this._isShuttingDown=!1,this._gracefulShutdownResolve=null)}_wrap(o,l,c){return async(...u)=>{u=l(...u);let d={name:o.name,args:u};this._operations.add(d);try{return await this._activate(),await o.apply(this,u)}finally{this._operations.delete(d),c&&this._backend.saveSuperblock(),this._operations.size===0&&(this._deactivationTimeout||clearTimeout(this._deactivationTimeout),this._deactivationTimeout=setTimeout(this._deactivate.bind(this),500))}}}async _activate(){this._initPromise||console.warn(new Error(`Attempted to use LightningFS ${this._name} before it was initialized.`)),await this._initPromise,this._deactivationTimeout&&(clearTimeout(this._deactivationTimeout),this._deactivationTimeout=null),this._deactivationPromise&&await this._deactivationPromise,this._deactivationPromise=null,this._activationPromise||(this._activationPromise=this._backend.activate?this._backend.activate():Promise.resolve()),await this._activationPromise}async _deactivate(){return this._activationPromise&&await this._activationPromise,this._deactivationPromise||(this._deactivationPromise=this._backend.deactivate?this._backend.deactivate():Promise.resolve()),this._activationPromise=null,this._gracefulShutdownResolve&&this._gracefulShutdownResolve(),this._deactivationPromise}async readFile(o,l){return this._backend.readFile(o,l)}async writeFile(o,l,c){return await this._backend.writeFile(o,l,c),null}async unlink(o,l){return await this._backend.unlink(o,l),null}async readdir(o,l){return this._backend.readdir(o,l)}async mkdir(o,l){return await this._backend.mkdir(o,l),null}async rmdir(o,l){return await this._backend.rmdir(o,l),null}async rename(o,l){return await this._backend.rename(o,l),null}async stat(o,l){const c=await this._backend.stat(o,l);return new e(c)}async lstat(o,l){const c=await this._backend.lstat(o,l);return new e(c)}async readlink(o,l){return this._backend.readlink(o,l)}async symlink(o,l){return await this._backend.symlink(o,l),null}async backFile(o,l){return await this._backend.backFile(o,l),null}async du(o){return this._backend.du(o)}async flush(){return this._backend.flush()}},am}var sm,b3;function kz(){if(b3)return sm;b3=1;const t=nz(),e=xz();function n(r,i){return typeof r=="function"&&(i=r),i=t(i),[(...s)=>i(null,...s),i]}return sm=class{constructor(...i){this.promises=new e(...i),this.init=this.init.bind(this),this.readFile=this.readFile.bind(this),this.writeFile=this.writeFile.bind(this),this.unlink=this.unlink.bind(this),this.readdir=this.readdir.bind(this),this.mkdir=this.mkdir.bind(this),this.rmdir=this.rmdir.bind(this),this.rename=this.rename.bind(this),this.stat=this.stat.bind(this),this.lstat=this.lstat.bind(this),this.readlink=this.readlink.bind(this),this.symlink=this.symlink.bind(this),this.backFile=this.backFile.bind(this),this.du=this.du.bind(this),this.flush=this.flush.bind(this)}init(i,a){return this.promises.init(i,a)}readFile(i,a,s){const[o,l]=n(a,s);this.promises.readFile(i,a).then(o).catch(l)}writeFile(i,a,s,o){const[l,c]=n(s,o);this.promises.writeFile(i,a,s).then(l).catch(c)}unlink(i,a,s){const[o,l]=n(a,s);this.promises.unlink(i,a).then(o).catch(l)}readdir(i,a,s){const[o,l]=n(a,s);this.promises.readdir(i,a).then(o).catch(l)}mkdir(i,a,s){const[o,l]=n(a,s);this.promises.mkdir(i,a).then(o).catch(l)}rmdir(i,a,s){const[o,l]=n(a,s);this.promises.rmdir(i,a).then(o).catch(l)}rename(i,a,s){const[o,l]=n(s);this.promises.rename(i,a).then(o).catch(l)}stat(i,a,s){const[o,l]=n(a,s);this.promises.stat(i).then(o).catch(l)}lstat(i,a,s){const[o,l]=n(a,s);this.promises.lstat(i).then(o).catch(l)}readlink(i,a,s){const[o,l]=n(a,s);this.promises.readlink(i).then(o).catch(l)}symlink(i,a,s){const[o,l]=n(s);this.promises.symlink(i,a).then(o).catch(l)}backFile(i,a,s){const[o,l]=n(a,s);this.promises.backFile(i,a).then(o).catch(l)}du(i,a){const[s,o]=n(a);this.promises.du(i).then(s).catch(o)}flush(i){const[a,s]=n(i);this.promises.flush().then(a).catch(s)}},sm}var Ez=kz();const Sz=Yv(Ez);class Ln extends Error{constructor(e,n,r){super(`${e}: ${n}${r?` '${r}'`:""}`),this.code=e,this.path=r,this.name="FsError"}}function Ot(t){if(!t||t==="/")return"/";t.startsWith("/")||(t="/"+t);const e=t.split("/"),n=[];for(const r of e)r===""||r==="."||(r===".."?n.pop():n.push(r));return"/"+n.join("/")}function hl(t){const e=Ot(t);if(e==="/")return{dir:"/",base:""};const n=e.lastIndexOf("/");return{dir:n===0?"/":e.slice(0,n),base:e.slice(n+1)}}function wo(...t){return Ot(t.join("/"))}class Kr{lfs;_ready;mountPoints=new Map;constructor(e,n){const r=new Sz(e,{wipe:n});this.lfs=r.promises,this._ready=this.lfs.stat("/").then(()=>{}).catch(()=>{})}static async create(e){const n=e?.dbName??"browser-fs",r=e?.wipe??!1,i=new Kr(n,r);return await i._ready,i}getLightningFS(){return this.lfs}async mount(e,n){const r=Ot(e),{dir:i}=hl(r);i!=="/"&&await this.mkdir(i,{recursive:!0});try{await this.lfs.mkdir(r)}catch{}this.mountPoints.set(r,n)}unmount(e){this.mountPoints.delete(Ot(e))}listMounts(){return[...this.mountPoints.keys()]}findMount(e){for(const[n,r]of this.mountPoints){if(e===n)return{handle:r,relParts:[]};if(e.startsWith(n+"/"))return{handle:r,relParts:e.slice(n.length+1).split("/").filter(Boolean)}}return null}static async fsaNavDir(e,n,r=!1){let i=e;for(const a of n)i=await i.getDirectoryHandle(a,{create:r});return i}static async fsaGetFile(e,n,r=!1){return(await Kr.fsaNavDir(e,n.slice(0,-1),r)).getFileHandle(n[n.length-1],{create:r})}convertFsaError(e,n){if(e instanceof Ln)return e;if(e instanceof Error){if(e.name==="NotFoundError")return new Ln("ENOENT","no such file or directory",n);if(e.name==="TypeMismatchError")return new Ln("ENOTDIR","not a directory",n);if(e.name==="NotAllowedError")return new Ln("EINVAL","permission denied",n)}return new Ln("EINVAL",e instanceof Error?e.message:String(e),n)}async readFile(e,n){const r=Ot(e),i=this.findMount(r);if(i){if(i.relParts.length===0)throw new Ln("EISDIR","is a directory",r);try{const s=await(await Kr.fsaGetFile(i.handle,i.relParts)).getFile();return(n?.encoding??"utf-8")==="utf-8"?await s.text():new Uint8Array(await s.arrayBuffer())}catch(a){throw this.convertFsaError(a,r)}}try{return(n?.encoding??"utf-8")==="utf-8"?await this.lfs.readFile(r,{encoding:"utf8"}):await this.lfs.readFile(r)}catch(a){throw this.convertError(a,r)}}async writeFile(e,n,r){const i=Ot(e),a=this.findMount(i);if(a){if(a.relParts.length===0)throw new Ln("EISDIR","is a directory",i);try{const l=await(await Kr.fsaGetFile(a.handle,a.relParts,!0)).createWritable(),c=typeof n=="string"?new TextEncoder().encode(n):new Uint8Array(n instanceof Uint8Array?n.buffer:n);await l.write(c),await l.close()}catch(o){throw this.convertFsaError(o,i)}return}const{dir:s}=hl(i);s!=="/"&&await this.mkdir(s,{recursive:!0});try{await this.lfs.writeFile(i,n)}catch(o){throw this.convertError(o,i)}}async readDir(e){const n=Ot(e),r=this.findMount(n);if(r)try{const i=r.relParts.length===0?r.handle:await Kr.fsaNavDir(r.handle,r.relParts),a=[];for await(const[s,o]of i)a.push({name:s,type:o.kind==="directory"?"directory":"file"});return a}catch(i){throw this.convertFsaError(i,n)}try{const i=await this.lfs.readdir(n),a=[];for(const s of i){const o=n==="/"?`/${s}`:`${n}/${s}`;try{const l=await this.lfs.stat(o);a.push({name:s,type:l.isDirectory()?"directory":"file"})}catch{}}return a}catch(i){throw this.convertError(i,n)}}async mkdir(e,n){const r=Ot(e);if(r==="/")return;const i=this.findMount(r);if(i){if(i.relParts.length===0)return;try{await Kr.fsaNavDir(i.handle,i.relParts,!0)}catch(a){throw this.convertFsaError(a,r)}return}if(n?.recursive){const a=r.split("/").filter(Boolean);let s="";for(const o of a){s+="/"+o;try{await this.lfs.mkdir(s)}catch(l){if(l instanceof Error&&!l.message.includes("EEXIST"))throw this.convertError(l,s)}}}else try{await this.lfs.mkdir(r)}catch(a){throw this.convertError(a,r)}}async rm(e,n){const r=Ot(e),i=this.findMount(r);if(i){if(i.relParts.length===0)throw new Ln("EINVAL","cannot remove a mount point — use unmount",r);try{const a=i.relParts.slice(0,-1),s=i.relParts[i.relParts.length-1];await(a.length===0?i.handle:await Kr.fsaNavDir(i.handle,a)).removeEntry(s,{recursive:n?.recursive})}catch(a){throw this.convertFsaError(a,r)}return}try{(await this.lfs.stat(r)).isDirectory()?n?.recursive?await this.rmRecursive(r):await this.lfs.rmdir(r):await this.lfs.unlink(r)}catch(a){throw this.convertError(a,r)}}async rmRecursive(e){const n=await this.lfs.readdir(e);for(const r of n){const i=e==="/"?`/${r}`:`${e}/${r}`;(await this.lfs.stat(i)).isDirectory()?await this.rmRecursive(i):await this.lfs.unlink(i)}await this.lfs.rmdir(e)}async stat(e){const n=Ot(e),r=this.findMount(n);if(r){if(r.relParts.length===0)try{const i=await this.lfs.stat(n);return{type:"directory",size:i.size,mtime:i.mtimeMs,ctime:i.ctimeMs}}catch{return{type:"directory",size:0,mtime:Date.now(),ctime:Date.now()}}try{try{const a=await(await Kr.fsaGetFile(r.handle,r.relParts)).getFile();return{type:"file",size:a.size,mtime:a.lastModified,ctime:a.lastModified}}catch{return await Kr.fsaNavDir(r.handle,r.relParts),{type:"directory",size:0,mtime:Date.now(),ctime:Date.now()}}}catch(i){throw this.convertFsaError(i,n)}}try{const i=await this.lfs.stat(n);return{type:i.isDirectory()?"directory":"file",size:i.size,mtime:i.mtimeMs,ctime:i.ctimeMs}}catch(i){throw this.convertError(i,n)}}async exists(e){const n=Ot(e),r=this.findMount(n);if(r){if(r.relParts.length===0)return!0;try{return await this.stat(n),!0}catch{return!1}}try{return await this.lfs.stat(n),!0}catch{return!1}}async rename(e,n){const r=Ot(e),i=Ot(n);try{await this.lfs.rename(r,i)}catch(a){throw this.convertError(a,r)}}async readTextFile(e){return await this.readFile(e,{encoding:"utf-8"})}async*walk(e){const n=Ot(e),r=await this.readDir(n);for(const i of r){const a=n==="/"?`/${i.name}`:`${n}/${i.name}`;i.type==="file"?yield a:yield*this.walk(a)}}async copyFile(e,n){if((await this.stat(e)).type==="directory")throw new Ln("EISDIR","is a directory",e);const i=await this.readFile(e,{encoding:"binary"});await this.writeFile(n,i)}dirname(e){return hl(Ot(e)).dir}basename(e){return hl(Ot(e)).base}convertError(e,n){if(e instanceof Ln)return e;const r=e instanceof Error?e.message:String(e);return r.includes("ENOENT")?new Ln("ENOENT","no such file or directory",n):r.includes("EEXIST")?new Ln("EEXIST","file already exists",n):r.includes("ENOTDIR")?new Ln("ENOTDIR","not a directory",n):r.includes("EISDIR")?new Ln("EISDIR","is a directory",n):r.includes("ENOTEMPTY")?new Ln("ENOTEMPTY","directory not empty",n):new Ln("EINVAL",r,n)}}class GS{vfs;allowedPrefixes;readOnlyPrefixes;constructor(e,n,r=[]){this.vfs=e;const i=a=>{const s=Ot(a);return s.endsWith("/")?s:s+"/"};this.allowedPrefixes=n.map(i),this.readOnlyPrefixes=r.map(i)}isAllowed(e){const n=Ot(e);return[...this.allowedPrefixes,...this.readOnlyPrefixes].some(i=>n===i.slice(0,-1)||n.startsWith(i)||n==="/"||i.startsWith(n+"/"))}isAllowedStrict(e){const n=Ot(e);return[...this.allowedPrefixes,...this.readOnlyPrefixes].some(i=>n===i.slice(0,-1)||n.startsWith(i))}isWritable(e){const n=Ot(e);return this.allowedPrefixes.some(r=>n===r.slice(0,-1)||n.startsWith(r))}checkWrite(e){if(!this.isWritable(e))throw new Ln("EACCES","permission denied",Ot(e))}getUnderlyingFS(){return this.vfs}getLightningFS(){return this.vfs.getLightningFS()}async readFile(e,n){if(!this.isAllowedStrict(e))throw new Ln("ENOENT","no such file or directory",Ot(e));return this.vfs.readFile(e,n)}async readDir(e){if(!this.isAllowed(e))return[];const n=await this.vfs.readDir(e);if(!this.isAllowedStrict(e)){const r=Ot(e);return n.filter(i=>{const a=r==="/"?`/${i.name}`:`${r}/${i.name}`;return this.isAllowed(a)})}return n}async stat(e){if(!this.isAllowed(e))throw new Ln("ENOENT","no such file or directory",Ot(e));return this.vfs.stat(e)}async exists(e){return this.isAllowed(e)?this.vfs.exists(e):!1}async readTextFile(e){if(!this.isAllowedStrict(e))throw new Ln("ENOENT","no such file or directory",Ot(e));return this.vfs.readTextFile(e)}async*walk(e){if(this.isAllowed(e))for await(const n of this.vfs.walk(e))this.isAllowed(n)&&(yield n)}async writeFile(e,n,r){return this.checkWrite(e),this.vfs.writeFile(e,n,r)}async mkdir(e,n){return this.checkWrite(e),this.vfs.mkdir(e,n)}async rm(e,n){return this.checkWrite(e),this.vfs.rm(e,n)}async rename(e,n){return this.checkWrite(e),this.checkWrite(n),this.vfs.rename(e,n)}async copyFile(e,n){if(!this.isAllowed(e))throw new Ln("ENOENT","no such file or directory",Ot(e));return this.checkWrite(n),this.vfs.copyFile(e,n)}dirname(e){return this.vfs.dirname(e)}basename(e){return this.vfs.basename(e)}}const Cz=Object.freeze(Object.defineProperty({__proto__:null,FsError:Ln,RestrictedFS:GS,VirtualFS:Kr,joinPath:wo,normalizePath:Ot,splitPath:hl},Symbol.toStringTag,{value:"Module"})),HS=".slicc",Az="state.json",$ue="skills",ts="manifest.yaml",k0=".skill",Tz=50*1024*1024,_z=50*1024*1024,x3=1e3,hy="/workspace/skills",VS="SKILL.md",ZS="1.0.0";function Iz(t){const e={},n=t.split(`
|
|
743
|
-
`);let r=null,i=!1,a={},s=null;for(const o of n){const l=o.trim();if(!l||l.startsWith("#"))continue;if(l.startsWith("- ")){const f=l.slice(2).trim();i&&s?s.push(f):r&&r.push(f);continue}const c=l.indexOf(":");if(c===-1)continue;const u=l.slice(0,c).trim(),d=l.slice(c+1).trim(),p=o.search(/\S/);if(u==="structured"){i=!0,a={},e.structured=a;continue}if(i&&p>=2){if(p>=4&&s)continue;d===""||d==="[]"?(s=[],a[u]=s):(a[u]=d,s=null);continue}p===0&&(i=!1),d===""||d==="[]"?(r=[],e[u]=r):(e[u]=d,r=null)}return e}function KS(t,e=ts){const n=Iz(t);if(!n.skill||typeof n.skill!="string")throw new Error(`Invalid manifest: missing 'skill' field in ${e}`);if(!n.version||typeof n.version!="string")throw new Error(`Invalid manifest: missing 'version' field in ${e}`);return{skill:n.skill,version:n.version,description:n.description||"",adds:n.adds||[],modifies:n.modifies||[],structured:n.structured,conflicts:n.conflicts||[],depends:n.depends||[],test:n.test,author:n.author}}async function Rz(t,e){const n=`${e}/${ts}`,r=await t.readTextFile(n);return KS(r,n)}function Nue(t,e){const n=(t.depends||[]).filter(r=>!e.includes(r));return{ok:n.length===0,missing:n}}function Pue(t,e){const n=(t.conflicts||[]).filter(r=>e.includes(r));return{ok:n.length===0,conflicting:n}}const $z=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;class E0 extends Error{}function Nz(t){return new TextDecoder().decode(t)}function Pz(t){const e=t.replace(/\\/g,"/");if(!e||e.endsWith("/"))return null;if(e.startsWith("/")||/^[A-Za-z]:\//.test(e))throw new Error(`Blocked suspicious path "${t}".`);const n=e.split("/");if(n.some(r=>r===""||r==="."||r===".."))throw new Error(`Blocked suspicious path "${t}".`);return n.join("/")}function Oz(t){if(!$z.test(t))throw new Error(`Invalid manifest: skill name "${t}" must be a simple directory name.`)}function Mz(t){const e=[];for(const[n,r]of Object.entries(t)){const i=Pz(n);i&&e.push({originalPath:n,path:i,bytes:r})}return e}function Lz(t){const e=t.filter(n=>n.path===ts||n.path.endsWith(`/${ts}`));if(e.length===0)throw new Error(`Skill archive is missing ${ts}.`);if(e.length>1)throw new Error(`Skill archive contains multiple ${ts} files.`);return e[0]}function Dz(t){let e=0,n=0;return vf(t,{filter(r){if(e++,e>x3)throw new E0(`Skill archives may contain at most ${x3} entries.`);if(n+=r.originalSize,n>_z)throw new E0("Skill archives must expand to 50 MB or smaller after extraction.");return!0}})}function Fz(t){const e=`${Date.now()}-${Math.random().toString(16).slice(2,8)}`;return wo(hy,`.${t}.tmp-${e}`)}async function Uz(t,e){if(!e.name.toLowerCase().endsWith(k0))throw new Error(`Only ${k0} archives can be installed with drag and drop.`);if(e.size>Tz)throw new Error("Skill archives must be 50 MB or smaller.");let n;try{const c=new Uint8Array(await e.arrayBuffer());n=Dz(c)}catch(c){if(c instanceof E0)throw c;const u=c instanceof Error?c.message:String(c);throw new Error(`Invalid .skill archive: ${u}`)}const r=Mz(n),i=Lz(r),a=KS(Nz(i.bytes),i.path);Oz(a.skill);const s=wo(hy,a.skill);if(await t.exists(s))throw new Error(`Skill "${a.skill}" already exists at ${s}.`);const o=Fz(a.skill),l=i.path===ts?"":i.path.slice(0,-(ts.length+1));await t.mkdir(o,{recursive:!0});try{let c=0;for(const u of r){if(l&&(u.path===l||!u.path.startsWith(`${l}/`)))continue;const d=l?u.path.slice(l.length+1):u.path;if(!d)continue;const p=wo(o,d),{dir:f}=hl(p);f!=="/"&&await t.mkdir(f,{recursive:!0}),await t.writeFile(p,u.bytes),c++}return await t.rename(o,s),{skillName:a.skill,destinationPath:s,fileCount:c}}catch(c){throw await t.exists(o)&&await t.rm(o,{recursive:!0}),c}}function JS(t){return t.toLowerCase().endsWith(k0)}function Wz(t){return Array.from(t).find(e=>JS(e.name))??null}function k3(t){if(!t)return!1;if(t.items){for(const e of Array.from(t.items))if(e.kind==="file")return!0}return!1}function Bz(t){if(!t)return null;if(t.files){const e=Wz(t.files);if(e)return e}if(!t.items)return null;for(const e of Array.from(t.items)){if(e.kind&&e.kind!=="file")continue;const n=e.getAsFile?.();if(n&&JS(n.name))return n}return null}const gs=wn("cdp");class zz{ws=null;nextId=1;pending=new Map;listeners=new Map;_state="disconnected";get state(){return this._state}async connect(e){if(this._state!=="disconnected")throw new Error(`Cannot connect: state is ${this._state}`);if(!e?.url)throw new Error("CDPClient.connect() requires a WebSocket URL");const{url:n,timeout:r=5e3}=e;return this._state="connecting",new Promise((i,a)=>{const s=setTimeout(()=>{this.cleanup(),a(new Error(`CDP connection timed out after ${r}ms`))},r);try{this.ws=new WebSocket(n)}catch(o){clearTimeout(s),this._state="disconnected",a(o);return}this.ws.onopen=()=>{clearTimeout(s),this._state="connected",gs.info("Connected",{url:n}),i()},this.ws.onerror=o=>{clearTimeout(s),this._state==="connecting"&&(gs.error("Connection failed",{url:n}),this.cleanup(),a(new Error("CDP WebSocket connection failed")))},this.ws.onmessage=o=>{this.handleMessage(o.data)},this.ws.onclose=()=>{this.handleClose()}})}disconnect(){this.ws&&(this.ws.onclose=null,this.ws.close()),this.cleanup(),gs.info("Disconnected")}async send(e,n,r,i=3e4){if(this._state!=="connected"||!this.ws)throw new Error("CDP client is not connected");const a=this.nextId++,s={id:a,method:e};return n&&(s.params=n),r&&(s.sessionId=r),gs.debug("Send",{method:e,id:a,sessionId:r}),new Promise((o,l)=>{const c=setTimeout(()=>{this.pending.delete(a),l(new Error(`CDP command timed out after ${i}ms: ${e}`))},i);this.pending.set(a,{resolve:u=>{clearTimeout(c),o(u)},reject:u=>{clearTimeout(c),l(u)}}),this.ws.send(JSON.stringify(s))})}on(e,n){let r=this.listeners.get(e);r||(r=new Set,this.listeners.set(e,r)),r.add(n)}off(e,n){const r=this.listeners.get(e);r&&(r.delete(n),r.size===0&&this.listeners.delete(e))}once(e,n=3e4){return new Promise((r,i)=>{const a=setTimeout(()=>{this.off(e,s),i(new Error(`Timed out waiting for event: ${e}`))},n),s=o=>{clearTimeout(a),this.off(e,s),r(o)};this.on(e,s)})}handleMessage(e){let n;try{n=JSON.parse(e)}catch{return}if("id"in n&&typeof n.id=="number"){const r=n;gs.debug("Response",{id:r.id,hasError:!!r.error});const i=this.pending.get(r.id);i&&(this.pending.delete(r.id),r.error?(gs.error("Command error",{id:r.id,code:r.error.code,message:r.error.message}),i.reject(new Error(`CDP error: ${r.error.message} (${r.error.code})`))):i.resolve(r.result??{}));return}if("method"in n){const r=n;gs.debug("Event",{method:r.method,sessionId:r.sessionId});const i=this.listeners.get(r.method);if(i){const a=r.sessionId?{...r.params,sessionId:r.sessionId}:r.params??{};for(const s of i)try{s(a)}catch{}}}}handleClose(){gs.error("Connection closed unexpectedly",{pendingCommands:this.pending.size});for(const[,e]of this.pending)e.reject(new Error("CDP connection closed"));this.cleanup()}cleanup(){this.ws=null,this._state="disconnected",this.pending.clear()}}function vo(t,e=""){if(t==null)return e;if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);try{return JSON.stringify(t)??e}catch{return String(t)}}const qz="ws://localhost:5710/cdp",E3=wn("browser-api");function jz(t=typeof window<"u"?window.location:null){return t?.host?`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}/cdp`:qz}class Gz{client;localClient;sessionId=null;attachedTargetId=null;trayTargetProvider=null;remoteTargetInfo=null;_tabLock=Promise.resolve();handleJavaScriptDialogOpening=async e=>{const n=typeof e.sessionId=="string"?e.sessionId:this.sessionId;if(n)try{await this.client.send("Page.handleJavaScriptDialog",{accept:!1},n,5e3),E3.warn("Auto-dismissed unexpected JavaScript dialog",{sessionId:n,type:e.type,message:e.message,url:e.url})}catch(r){E3.warn("Failed to auto-dismiss JavaScript dialog",{sessionId:n,error:r instanceof Error?r.message:String(r)})}};constructor(e){this.client=e??new zz,this.localClient=this.client,this.addDialogListener(this.client)}getTransport(){return this.client}getSessionId(){return this.sessionId}getAttachedTargetId(){return this.attachedTargetId}async withTab(e,n){let r;const i=new Promise(s=>{r=s}),a=this._tabLock;this._tabLock=i,await a;try{const s=await this.attachToPage(e);return await n(s)}finally{r()}}setTrayTargetProvider(e){this.trayTargetProvider=e}async listAllTargets(){const e=await this.listPages();if(!this.trayTargetProvider)return e;const n=!this.remoteTargetInfo,r=new Set(e.map(s=>s.targetId)),a=this.trayTargetProvider.getTargets().filter(s=>!n||!(s.runtimeId==="leader"&&r.has(s.localTargetId))).map(s=>({targetId:s.targetId,title:s.title,url:s.url}));return[...e,...a]}async connect(e){await this.client.connect({url:e?.url??jz(),timeout:e?.timeout})}async createPage(e){return await this.ensureConnected(),(await this.client.send("Target.createTarget",{url:e??"about:blank",background:!0})).targetId}async createRemotePage(e,n){if(!this.trayTargetProvider?.openRemoteTab)throw new Error("Remote tab opening not available (no tray target provider)");return this.trayTargetProvider.openRemoteTab(e,n??"about:blank")}async closePage(e){if(await this.ensureConnected(),this.trayTargetProvider?.createRemoteTransport&&e.includes(":")){const n=e.indexOf(":"),r=e.substring(0,n),i=e.substring(n+1);{const a=this.trayTargetProvider.createRemoteTransport(r,i);try{await a.send("Target.closeTarget",{targetId:i})}finally{this.trayTargetProvider.removeRemoteTransport&&this.trayTargetProvider.removeRemoteTransport(r,i)}this.attachedTargetId===e&&(this.remoteTargetInfo&&(this.setClient(this.localClient),this.remoteTargetInfo=null),this.sessionId=null,this.attachedTargetId=null);return}}await this.localClient.send("Target.closeTarget",{targetId:e}),this.attachedTargetId===e&&(this.sessionId=null,this.attachedTargetId=null)}disconnect(){this.sessionId=null,this.attachedTargetId=null,this.client.disconnect()}async listPages(){return await this.ensureConnected(),((await this.client.send("Target.getTargets")).targetInfos??[]).filter(r=>r.type==="page").map(r=>({targetId:r.targetId,title:r.title,url:r.url,...r.active?{active:!0}:{}}))}async attachToPage(e){if(await this.ensureConnected(),this.sessionId&&this.attachedTargetId===e)return this.sessionId;if(this.trayTargetProvider?.createRemoteTransport&&e.includes(":")){const r=e.indexOf(":"),i=e.substring(0,r),a=e.substring(r+1);{const s=this.trayTargetProvider.createRemoteTransport(i,a);this.setClient(s),this.remoteTargetInfo={runtimeId:i,localTargetId:a};const o=await this.client.send("Target.attachToTarget",{targetId:a,flatten:!0});return this.sessionId=o.sessionId,this.attachedTargetId=e,await this.client.send("Page.enable",{},this.sessionId),this.sessionId}}const n=await this.client.send("Target.attachToTarget",{targetId:e,flatten:!0});return this.sessionId=n.sessionId,this.attachedTargetId=e,await this.client.send("Page.enable",{},this.sessionId),this.sessionId}async detach(){if(this.sessionId){try{await this.client.send("Target.detachFromTarget",{sessionId:this.sessionId})}catch{}this.remoteTargetInfo&&this.trayTargetProvider?.removeRemoteTransport&&(this.trayTargetProvider.removeRemoteTransport(this.remoteTargetInfo.runtimeId,this.remoteTargetInfo.localTargetId),this.setClient(this.localClient),this.remoteTargetInfo=null),this.sessionId=null,this.attachedTargetId=null}}async navigate(e){await this.ensureConnected(),this.ensureAttached(),await this.client.send("Page.enable",{},this.sessionId);const n=this.client.once("Page.loadEventFired");await this.client.send("Page.navigate",{url:e},this.sessionId),await n}async screenshot(e){await this.ensureConnected(),this.ensureAttached();try{const n={format:e?.format??"png",captureBeyondViewport:!0};if(e?.quality!==void 0&&(n.quality=e.quality),e?.clip||e?.fullPage){let a=0,s=0;try{await this.client.send("Runtime.enable",{},this.sessionId);const o=await this.client.send("Runtime.evaluate",{expression:"JSON.stringify({ w: window.innerWidth, h: document.documentElement.scrollHeight })",returnByValue:!0},this.sessionId),l=JSON.parse(o.result?.value??"{}");a=l.w??0,s=l.h??0}catch{}e?.clip?n.clip={...e.clip,scale:e.clip.scale??1}:n.clip={x:0,y:0,width:a||1280,height:s||800,scale:1}}let i=(await this.client.send("Page.captureScreenshot",n,this.sessionId)).data;if(e?.maxWidth)try{const{getMagick:a}=await Vt(async()=>{const{getMagick:d}=await Promise.resolve().then(()=>SP);return{getMagick:d}},void 0),s=await a(),o=atob(i),l=new Uint8Array(o.length);for(let d=0;d<o.length;d++)l[d]=o.charCodeAt(d);const c=8e3;let u=!1;await s.ImageMagick.read(l,async d=>{const p=Math.min(e.maxWidth,c),f=Math.max(d.width,d.height);if(d.width>p||f>c){const h=Math.min(p/d.width,c/f);d.resize(Math.round(d.width*h),Math.round(d.height*h)),u=!0}u&&d.write("PNG",h=>{let m="";for(let g=0;g<h.length;g++)m+=String.fromCharCode(h[g]);i=btoa(m)})})}catch(a){console.warn("[browser-api] Screenshot maxWidth resize failed, returning original",a)}return i}finally{}}async evaluate(e,n){await this.ensureConnected(),this.ensureAttached(),await this.client.send("Runtime.enable",{},this.sessionId);const r=await this.client.send("Runtime.evaluate",{expression:e,awaitPromise:n?.awaitPromise??!0,returnByValue:n?.returnByValue??!0},this.sessionId),i=r.exceptionDetails;if(i){const s=i.exception?.description??i.text;throw new Error(`Evaluation failed: ${s}`)}return r.result.value}async click(e){await this.ensureConnected(),this.ensureAttached();const n=await this.boundingBox(e);if(!n)throw new Error(`Element not found: ${e}`);const r=n.x+n.width/2,i=n.y+n.height/2;await this.client.send("Input.dispatchMouseEvent",{type:"mousePressed",x:r,y:i,button:"left",clickCount:1},this.sessionId),await this.client.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:r,y:i,button:"left",clickCount:1},this.sessionId)}async type(e){await this.ensureConnected(),this.ensureAttached();for(const n of e)await this.client.send("Input.dispatchKeyEvent",{type:"keyDown",text:n},this.sessionId),await this.client.send("Input.dispatchKeyEvent",{type:"keyUp",text:n},this.sessionId)}async waitForSelector(e,n){await this.ensureConnected(),this.ensureAttached();const r=n?.timeout??3e4,i=n?.interval??100,a=Date.now();for(;Date.now()-a<r;){if(await this.evaluate(`!!document.querySelector(${JSON.stringify(e)})`))return;await new Promise(o=>setTimeout(o,i))}throw new Error(`waitForSelector timed out after ${r}ms: ${e}`)}async getAccessibilityTree(){await this.ensureConnected(),this.ensureAttached(),await this.client.send("Accessibility.enable",{},this.sessionId);const n=(await this.client.send("Accessibility.getFullAXTree",{},this.sessionId)).nodes;if(!n||n.length===0)return{role:"RootWebArea",name:""};const r=new Map;let i;for(const s of n){const o=vo(s.value?.value),l=vo(s.description?.value),c={role:vo(s.role?.value,"unknown"),name:vo(s.name?.value)};o!==""&&(c.value=o),l!==""&&(c.description=l),s.backendDOMNodeId&&(c.backendNodeId=s.backendDOMNodeId),s.childIds&&(c.childIds=s.childIds),r.set(s.nodeId,c),s.parentId||(i=s.nodeId)}function a(s){const o=r.get(s);if(!o)return{role:"unknown",name:""};const l={role:o.role,name:o.name};return o.value&&(l.value=o.value),o.description&&(l.description=o.description),o.backendNodeId&&(l.backendNodeId=o.backendNodeId),o.childIds&&o.childIds.length>0&&(l.children=o.childIds.map(c=>a(c)).filter(c=>c.role!=="unknown")),l}return i?a(i):{role:"RootWebArea",name:""}}async clickByBackendNodeId(e){await this.ensureConnected(),this.ensureAttached(),await this.client.send("DOM.enable",{},this.sessionId),await this.client.send("Runtime.enable",{},this.sessionId);const r=(await this.client.send("DOM.resolveNode",{backendNodeId:e},this.sessionId)).object;if(!r?.objectId)throw new Error(`Could not resolve backend node ${e} to a DOM element`);const a=(await this.client.send("Runtime.callFunctionOn",{objectId:r.objectId,functionDeclaration:`function() {
|
|
742
|
+
`),p=this._makeRoot(),f=[{indent:-1,node:p},{indent:0,node:null}];for(let h of d){let g=h.match(/^\t*/)[0].length;h=h.slice(g);let[v,...y]=h.split(" "),b=u(y);if(g<=f[f.length-1].indent)for(;g<=f[f.length-1].indent;)f.pop();f.push({indent:g,node:b}),f[f.length-2].node.set(v,b)}return p}_lookup(l,c=!0){let u=this._root,d="/",p=t.split(l);for(let f=0;f<p.length;++f){let h=p[f];if(u=u.get(h),!u)throw new n(l);if(c||f<p.length-1){const m=u.get(s);if(m.type==="symlink"){let g=t.resolve(d,m.target);u=this._lookup(g)}d?d=t.join(d,h):d=h}}return u}mkdir(l,{mode:c}){if(l==="/")throw new e;let u=this._lookup(t.dirname(l)),d=t.basename(l);if(u.has(d))throw new e;let p=new Map,f={mode:c,type:"dir",size:0,mtimeMs:Date.now(),ino:this.autoinc()};p.set(s,f),u.set(d,p)}rmdir(l){let c=this._lookup(l);if(c.get(s).type!=="dir")throw new r;if(c.size>1)throw new i;let u=this._lookup(t.dirname(l)),d=t.basename(l);u.delete(d)}readdir(l){let c=this._lookup(l);if(c.get(s).type!=="dir")throw new r;return[...c.keys()].filter(u=>typeof u=="string")}writeStat(l,c,{mode:u}){let d,p;try{p=this.stat(l)}catch{}if(p!==void 0){if(p.type==="dir")throw new a;u==null&&(u=p.mode),d=p.ino}u==null&&(u=438),d==null&&(d=this.autoinc());let f=this._lookup(t.dirname(l)),h=t.basename(l),m={mode:u,type:"file",size:c,mtimeMs:Date.now(),ino:d},g=new Map;return g.set(s,m),f.set(h,g),m}unlink(l){let c=this._lookup(t.dirname(l)),u=t.basename(l);c.delete(u)}rename(l,c){let u=t.basename(c),d=this._lookup(l);this._lookup(t.dirname(c)).set(u,d),this.unlink(l)}stat(l){return this._lookup(l).get(s)}lstat(l){return this._lookup(l,!1).get(s)}readlink(l){return this._lookup(l,!1).get(s).target}symlink(l,c){let u,d;try{let g=this.stat(c);d===null&&(d=g.mode),u=g.ino}catch{}d==null&&(d=40960),u==null&&(u=this.autoinc());let p=this._lookup(t.dirname(c)),f=t.basename(c),h={mode:d,type:"symlink",target:l,size:0,mtimeMs:Date.now(),ino:u},m=new Map;return m.set(s,h),p.set(f,m),h}_du(l){let c=0;for(const[u,d]of l.entries())u===s?c+=d.size:c+=this._du(d);return c}du(l){let c=this._lookup(l);return this._du(c)}},Qh}class qS{constructor(e="keyval-store",n="keyval"){this.storeName=n,this._dbName=e,this._storeName=n,this._init()}_init(){this._dbp||(this._dbp=new Promise((e,n)=>{const r=indexedDB.open(this._dbName);r.onerror=()=>n(r.error),r.onsuccess=()=>e(r.result),r.onupgradeneeded=()=>{r.result.createObjectStore(this._storeName)}}))}_withIDBStore(e,n){return this._init(),this._dbp.then(r=>new Promise((i,a)=>{const s=r.transaction(this.storeName,e);s.oncomplete=()=>i(),s.onabort=s.onerror=()=>a(s.error),n(s.objectStore(this.storeName))}))}_close(){return this._init(),this._dbp.then(e=>{e.close(),this._dbp=void 0})}}let Yh;function No(){return Yh||(Yh=new qS),Yh}function oz(t,e=No()){let n;return e._withIDBStore("readwrite",r=>{n=r.get(t)}).then(()=>n.result)}function lz(t,e,n=No()){return n._withIDBStore("readwrite",r=>{r.put(e,t)})}function cz(t,e,n=No()){return n._withIDBStore("readwrite",r=>{const i=r.get(t);i.onsuccess=()=>{r.put(e(i.result),t)}})}function uz(t,e=No()){return e._withIDBStore("readwrite",n=>{n.delete(t)})}function dz(t=No()){return t._withIDBStore("readwrite",e=>{e.clear()})}function pz(t=No()){const e=[];return t._withIDBStore("readwrite",n=>{(n.openKeyCursor||n.openCursor).call(n).onsuccess=function(){this.result&&(e.push(this.result.key),this.result.continue())}}).then(()=>e)}function fz(t=No()){return t._close()}const hz=Object.freeze(Object.defineProperty({__proto__:null,Store:qS,clear:dz,close:fz,del:uz,get:oz,keys:pz,set:lz,update:cz},Symbol.toStringTag,{value:"Module"})),jS=cF(hz);var Xh,f3;function mz(){if(f3)return Xh;f3=1;const t=jS;return Xh=class{constructor(n,r){this._database=n,this._storename=r,this._store=new t.Store(this._database,this._storename)}saveSuperblock(n){return t.set("!root",n,this._store)}loadSuperblock(){return t.get("!root",this._store)}readFile(n){return t.get(n,this._store)}writeFile(n,r){return t.set(n,r,this._store)}unlink(n){return t.del(n,this._store)}wipe(){return t.clear(this._store)}close(){return t.close(this._store)}},Xh}var em,h3;function gz(){return h3||(h3=1,em=class{constructor(e){this._url=e}loadSuperblock(){return fetch(this._url+"/.superblock.txt").then(e=>e.ok?e.text():null)}async readFile(e){const n=await fetch(this._url+e);if(n.status===200)return n.arrayBuffer();throw new Error("ENOENT")}async sizeFile(e){const n=await fetch(this._url+e,{method:"HEAD"});if(n.status===200)return n.headers.get("content-length");throw new Error("ENOENT")}}),em}var tm,m3;function vz(){if(m3)return tm;m3=1;const t=jS,e=n=>new Promise(r=>setTimeout(r,n));return tm=class{constructor(r,i){this._id=Math.random(),this._database=r,this._storename=i,this._store=new t.Store(this._database,this._storename),this._lock=null}async has({margin:r=2e3}={}){if(this._lock&&this._lock.holder===this._id){const i=Date.now();return this._lock.expires>i+r?!0:await this.renew()}else return!1}async renew({ttl:r=5e3}={}){let i;return await t.update("lock",a=>{const o=Date.now()+r;return i=a&&a.holder===this._id,this._lock=i?{holder:this._id,expires:o}:a,this._lock},this._store),i}async acquire({ttl:r=5e3}={}){let i,a,s;if(await t.update("lock",o=>{const l=Date.now(),c=l+r;return a=o&&o.expires<l,i=o===void 0||a,s=o&&o.holder===this._id,this._lock=i?{holder:this._id,expires:c}:o,this._lock},this._store),s)throw new Error("Mutex double-locked");return i}async wait({interval:r=100,limit:i=6e3,ttl:a}={}){for(;i--;){if(await this.acquire({ttl:a}))return!0;await e(r)}throw new Error("Mutex timeout")}async release({force:r=!1}={}){let i,a,s;if(await t.update("lock",o=>(i=r||o&&o.holder===this._id,a=o===void 0,s=o&&o.holder!==this._id,this._lock=i?void 0:o,this._lock),this._store),await t.close(this._store),!i&&!r){if(a)throw new Error("Mutex double-freed");if(s)throw new Error("Mutex lost ownership")}return i}},tm}var nm,g3;function yz(){return g3||(g3=1,nm=class{constructor(e){this._id=Math.random(),this._database=e,this._has=!1,this._release=null}async has(){return this._has}async acquire(){return new Promise(e=>{navigator.locks.request(this._database+"_lock",{ifAvailable:!0},n=>(this._has=!!n,e(!!n),new Promise(r=>{this._release=r})))})}async wait({timeout:e=6e5}={}){return new Promise((n,r)=>{const i=new AbortController;setTimeout(()=>{i.abort(),r(new Error("Mutex timeout"))},e),navigator.locks.request(this._database+"_lock",{signal:i.signal},a=>(this._has=!!a,n(!!a),new Promise(s=>{this._release=s})))})}async release({force:e=!1}={}){this._has=!1,this._release?this._release():e&&navigator.locks.request(this._database+"_lock",{steal:!0},n=>!0)}}),nm}var rm,v3;function wz(){if(v3)return rm;v3=1;const{encode:t,decode:e}=iz(),n=az(),r=sz(),{ENOENT:i,ENOTEMPTY:a,ETIMEDOUT:s}=zS(),o=mz(),l=gz(),c=vz(),u=yz(),d=fy();return rm=class{constructor(){this.saveSuperblock=n(()=>{this.flush()},500)}async init(f,{wipe:h,url:m,urlauto:g,fileDbName:v=f,db:y=null,fileStoreName:b=f+"_files",lockDbName:S=f+"_lock",lockStoreName:A=f+"_lock"}={}){this._name=f,this._idb=y||new o(v,b),this._mutex=navigator.locks?new u(f):new c(S,A),this._cache=new r(f),this._opts={wipe:h,url:m},this._needsWipe=!!h,m&&(this._http=new l(m),this._urlauto=!!g)}async activate(){if(this._cache.activated)return;this._needsWipe&&(this._needsWipe=!1,await this._idb.wipe(),await this._mutex.release({force:!0})),await this._mutex.has()||await this._mutex.wait();const f=await this._idb.loadSuperblock();if(f)this._cache.activate(f);else if(this._http){const h=await this._http.loadSuperblock();this._cache.activate(h),await this._saveSuperblock()}else this._cache.activate();if(!await this._mutex.has())throw new s}async deactivate(){await this._mutex.has()&&await this._saveSuperblock(),this._cache.deactivate();try{await this._mutex.release()}catch(f){console.log(f)}await this._idb.close()}async _saveSuperblock(){this._cache.activated&&(this._lastSavedAt=Date.now(),await this._idb.saveSuperblock(this._cache._root))}_writeStat(f,h,m){let g=d.split(d.dirname(f)),v=g.shift();for(let y of g){v=d.join(v,y);try{this._cache.mkdir(v,{mode:511})}catch{}}return this._cache.writeStat(f,h,m)}async readFile(f,h){const m=typeof h=="string"?h:h&&h.encoding;if(m&&m!=="utf8")throw new Error('Only "utf8" encoding is supported in readFile');let g=null,v=null;try{v=this._cache.stat(f),g=await this._idb.readFile(v.ino)}catch(y){if(!this._urlauto)throw y}if(!g&&this._http){let y=this._cache.lstat(f);for(;y.type==="symlink";)f=d.resolve(d.dirname(f),y.target),y=this._cache.lstat(f);g=await this._http.readFile(f)}if(g&&((!v||v.size!=g.byteLength)&&(v=await this._writeStat(f,g.byteLength,{mode:v?v.mode:438}),this.saveSuperblock()),m==="utf8"?g=e(g):g.toString=()=>e(g)),!v)throw new i(f);return g}async writeFile(f,h,m){const{mode:g,encoding:v="utf8"}=m;if(typeof h=="string"){if(v!=="utf8")throw new Error('Only "utf8" encoding is supported in writeFile');h=t(h)}const y=await this._cache.writeStat(f,h.byteLength,{mode:g});await this._idb.writeFile(y.ino,h)}async unlink(f,h){const m=this._cache.lstat(f);this._cache.unlink(f),m.type!=="symlink"&&await this._idb.unlink(m.ino)}readdir(f,h){return this._cache.readdir(f)}mkdir(f,h){const{mode:m=511}=h;this._cache.mkdir(f,{mode:m})}rmdir(f,h){if(f==="/")throw new a;this._cache.rmdir(f)}rename(f,h){this._cache.rename(f,h)}stat(f,h){return this._cache.stat(f)}lstat(f,h){return this._cache.lstat(f)}readlink(f,h){return this._cache.readlink(f)}symlink(f,h){this._cache.symlink(f,h)}async backFile(f,h){let m=await this._http.sizeFile(f);await this._writeStat(f,m,h)}du(f){return this._cache.du(f)}flush(){return this._saveSuperblock()}},rm}var im,y3;function bz(){return y3||(y3=1,im=class{constructor(e){this.type=e.type,this.mode=e.mode,this.size=e.size,this.ino=e.ino,this.mtimeMs=e.mtimeMs,this.ctimeMs=e.ctimeMs||e.mtimeMs,this.uid=1,this.gid=1,this.dev=1}isFile(){return this.type==="file"}isDirectory(){return this.type==="dir"}isSymbolicLink(){return this.type==="symlink"}}),im}var am,w3;function xz(){if(w3)return am;w3=1;const t=wz(),e=bz(),n=fy();function r(s,o,...l){return s=n.normalize(s),(typeof o>"u"||typeof o=="function")&&(o={}),typeof o=="string"&&(o={encoding:o}),[s,o,...l]}function i(s,o,l,...c){return s=n.normalize(s),(typeof l>"u"||typeof l=="function")&&(l={}),typeof l=="string"&&(l={encoding:l}),[s,o,l,...c]}function a(s,o,...l){return[n.normalize(s),n.normalize(o),...l]}return am=class{constructor(o,l={}){this.init=this.init.bind(this),this.readFile=this._wrap(this.readFile,r,!1),this.writeFile=this._wrap(this.writeFile,i,!0),this.unlink=this._wrap(this.unlink,r,!0),this.readdir=this._wrap(this.readdir,r,!1),this.mkdir=this._wrap(this.mkdir,r,!0),this.rmdir=this._wrap(this.rmdir,r,!0),this.rename=this._wrap(this.rename,a,!0),this.stat=this._wrap(this.stat,r,!1),this.lstat=this._wrap(this.lstat,r,!1),this.readlink=this._wrap(this.readlink,r,!1),this.symlink=this._wrap(this.symlink,a,!0),this.backFile=this._wrap(this.backFile,r,!0),this.du=this._wrap(this.du,r,!1),this._deactivationPromise=null,this._deactivationTimeout=null,this._activationPromise=null,this._operations=new Set,o&&this.init(o,l)}async init(...o){return this._initPromiseResolve&&await this._initPromise,this._initPromise=this._init(...o),this._initPromise}async _init(o,l={}){await this._gracefulShutdown(),this._activationPromise&&await this._deactivate(),this._backend&&this._backend.destroy&&await this._backend.destroy(),this._backend=l.backend||new t,this._backend.init&&await this._backend.init(o,l),this._initPromiseResolve&&(this._initPromiseResolve(),this._initPromiseResolve=null),l.defer||this.stat("/")}async _gracefulShutdown(){this._operations.size>0&&(this._isShuttingDown=!0,await new Promise(o=>this._gracefulShutdownResolve=o),this._isShuttingDown=!1,this._gracefulShutdownResolve=null)}_wrap(o,l,c){return async(...u)=>{u=l(...u);let d={name:o.name,args:u};this._operations.add(d);try{return await this._activate(),await o.apply(this,u)}finally{this._operations.delete(d),c&&this._backend.saveSuperblock(),this._operations.size===0&&(this._deactivationTimeout||clearTimeout(this._deactivationTimeout),this._deactivationTimeout=setTimeout(this._deactivate.bind(this),500))}}}async _activate(){this._initPromise||console.warn(new Error(`Attempted to use LightningFS ${this._name} before it was initialized.`)),await this._initPromise,this._deactivationTimeout&&(clearTimeout(this._deactivationTimeout),this._deactivationTimeout=null),this._deactivationPromise&&await this._deactivationPromise,this._deactivationPromise=null,this._activationPromise||(this._activationPromise=this._backend.activate?this._backend.activate():Promise.resolve()),await this._activationPromise}async _deactivate(){return this._activationPromise&&await this._activationPromise,this._deactivationPromise||(this._deactivationPromise=this._backend.deactivate?this._backend.deactivate():Promise.resolve()),this._activationPromise=null,this._gracefulShutdownResolve&&this._gracefulShutdownResolve(),this._deactivationPromise}async readFile(o,l){return this._backend.readFile(o,l)}async writeFile(o,l,c){return await this._backend.writeFile(o,l,c),null}async unlink(o,l){return await this._backend.unlink(o,l),null}async readdir(o,l){return this._backend.readdir(o,l)}async mkdir(o,l){return await this._backend.mkdir(o,l),null}async rmdir(o,l){return await this._backend.rmdir(o,l),null}async rename(o,l){return await this._backend.rename(o,l),null}async stat(o,l){const c=await this._backend.stat(o,l);return new e(c)}async lstat(o,l){const c=await this._backend.lstat(o,l);return new e(c)}async readlink(o,l){return this._backend.readlink(o,l)}async symlink(o,l){return await this._backend.symlink(o,l),null}async backFile(o,l){return await this._backend.backFile(o,l),null}async du(o){return this._backend.du(o)}async flush(){return this._backend.flush()}},am}var sm,b3;function kz(){if(b3)return sm;b3=1;const t=nz(),e=xz();function n(r,i){return typeof r=="function"&&(i=r),i=t(i),[(...s)=>i(null,...s),i]}return sm=class{constructor(...i){this.promises=new e(...i),this.init=this.init.bind(this),this.readFile=this.readFile.bind(this),this.writeFile=this.writeFile.bind(this),this.unlink=this.unlink.bind(this),this.readdir=this.readdir.bind(this),this.mkdir=this.mkdir.bind(this),this.rmdir=this.rmdir.bind(this),this.rename=this.rename.bind(this),this.stat=this.stat.bind(this),this.lstat=this.lstat.bind(this),this.readlink=this.readlink.bind(this),this.symlink=this.symlink.bind(this),this.backFile=this.backFile.bind(this),this.du=this.du.bind(this),this.flush=this.flush.bind(this)}init(i,a){return this.promises.init(i,a)}readFile(i,a,s){const[o,l]=n(a,s);this.promises.readFile(i,a).then(o).catch(l)}writeFile(i,a,s,o){const[l,c]=n(s,o);this.promises.writeFile(i,a,s).then(l).catch(c)}unlink(i,a,s){const[o,l]=n(a,s);this.promises.unlink(i,a).then(o).catch(l)}readdir(i,a,s){const[o,l]=n(a,s);this.promises.readdir(i,a).then(o).catch(l)}mkdir(i,a,s){const[o,l]=n(a,s);this.promises.mkdir(i,a).then(o).catch(l)}rmdir(i,a,s){const[o,l]=n(a,s);this.promises.rmdir(i,a).then(o).catch(l)}rename(i,a,s){const[o,l]=n(s);this.promises.rename(i,a).then(o).catch(l)}stat(i,a,s){const[o,l]=n(a,s);this.promises.stat(i).then(o).catch(l)}lstat(i,a,s){const[o,l]=n(a,s);this.promises.lstat(i).then(o).catch(l)}readlink(i,a,s){const[o,l]=n(a,s);this.promises.readlink(i).then(o).catch(l)}symlink(i,a,s){const[o,l]=n(s);this.promises.symlink(i,a).then(o).catch(l)}backFile(i,a,s){const[o,l]=n(a,s);this.promises.backFile(i,a).then(o).catch(l)}du(i,a){const[s,o]=n(a);this.promises.du(i).then(s).catch(o)}flush(i){const[a,s]=n(i);this.promises.flush().then(a).catch(s)}},sm}var Ez=kz();const Sz=Yv(Ez);class Ln extends Error{constructor(e,n,r){super(`${e}: ${n}${r?` '${r}'`:""}`),this.code=e,this.path=r,this.name="FsError"}}function Ot(t){if(!t||t==="/")return"/";t.startsWith("/")||(t="/"+t);const e=t.split("/"),n=[];for(const r of e)r===""||r==="."||(r===".."?n.pop():n.push(r));return"/"+n.join("/")}function hl(t){const e=Ot(t);if(e==="/")return{dir:"/",base:""};const n=e.lastIndexOf("/");return{dir:n===0?"/":e.slice(0,n),base:e.slice(n+1)}}function wo(...t){return Ot(t.join("/"))}class Kr{lfs;_ready;mountPoints=new Map;constructor(e,n){const r=new Sz(e,{wipe:n});this.lfs=r.promises,this._ready=this.lfs.stat("/").then(()=>{}).catch(()=>{})}static async create(e){const n=e?.dbName??"browser-fs",r=e?.wipe??!1,i=new Kr(n,r);return await i._ready,i}getLightningFS(){return this.lfs}async mount(e,n){const r=Ot(e),{dir:i}=hl(r);i!=="/"&&await this.mkdir(i,{recursive:!0});try{await this.lfs.mkdir(r)}catch{}this.mountPoints.set(r,n)}unmount(e){this.mountPoints.delete(Ot(e))}listMounts(){return[...this.mountPoints.keys()]}findMount(e){for(const[n,r]of this.mountPoints){if(e===n)return{handle:r,relParts:[]};if(e.startsWith(n+"/"))return{handle:r,relParts:e.slice(n.length+1).split("/").filter(Boolean)}}return null}static async fsaNavDir(e,n,r=!1){let i=e;for(const a of n)i=await i.getDirectoryHandle(a,{create:r});return i}static async fsaGetFile(e,n,r=!1){return(await Kr.fsaNavDir(e,n.slice(0,-1),r)).getFileHandle(n[n.length-1],{create:r})}convertFsaError(e,n){if(e instanceof Ln)return e;if(e instanceof Error){if(e.name==="NotFoundError")return new Ln("ENOENT","no such file or directory",n);if(e.name==="TypeMismatchError")return new Ln("ENOTDIR","not a directory",n);if(e.name==="NotAllowedError")return new Ln("EINVAL","permission denied",n)}return new Ln("EINVAL",e instanceof Error?e.message:String(e),n)}async readFile(e,n){const r=Ot(e),i=this.findMount(r);if(i){if(i.relParts.length===0)throw new Ln("EISDIR","is a directory",r);try{const s=await(await Kr.fsaGetFile(i.handle,i.relParts)).getFile();return(n?.encoding??"utf-8")==="utf-8"?await s.text():new Uint8Array(await s.arrayBuffer())}catch(a){throw this.convertFsaError(a,r)}}try{return(n?.encoding??"utf-8")==="utf-8"?await this.lfs.readFile(r,{encoding:"utf8"}):await this.lfs.readFile(r)}catch(a){throw this.convertError(a,r)}}async writeFile(e,n,r){const i=Ot(e),a=this.findMount(i);if(a){if(a.relParts.length===0)throw new Ln("EISDIR","is a directory",i);try{const l=await(await Kr.fsaGetFile(a.handle,a.relParts,!0)).createWritable(),c=typeof n=="string"?new TextEncoder().encode(n):new Uint8Array(n instanceof Uint8Array?n.buffer:n);await l.write(c),await l.close()}catch(o){throw this.convertFsaError(o,i)}return}const{dir:s}=hl(i);s!=="/"&&await this.mkdir(s,{recursive:!0});try{await this.lfs.writeFile(i,n)}catch(o){throw this.convertError(o,i)}}async readDir(e){const n=Ot(e),r=this.findMount(n);if(r)try{const i=r.relParts.length===0?r.handle:await Kr.fsaNavDir(r.handle,r.relParts),a=[];for await(const[s,o]of i)a.push({name:s,type:o.kind==="directory"?"directory":"file"});return a}catch(i){throw this.convertFsaError(i,n)}try{const i=await this.lfs.readdir(n),a=[];for(const s of i){const o=n==="/"?`/${s}`:`${n}/${s}`;try{const l=await this.lfs.stat(o);a.push({name:s,type:l.isDirectory()?"directory":"file"})}catch{}}return a}catch(i){throw this.convertError(i,n)}}async mkdir(e,n){const r=Ot(e);if(r==="/")return;const i=this.findMount(r);if(i){if(i.relParts.length===0)return;try{await Kr.fsaNavDir(i.handle,i.relParts,!0)}catch(a){throw this.convertFsaError(a,r)}return}if(n?.recursive){const a=r.split("/").filter(Boolean);let s="";for(const o of a){s+="/"+o;try{await this.lfs.mkdir(s)}catch(l){if(l instanceof Error&&!l.message.includes("EEXIST"))throw this.convertError(l,s)}}}else try{await this.lfs.mkdir(r)}catch(a){throw this.convertError(a,r)}}async rm(e,n){const r=Ot(e),i=this.findMount(r);if(i){if(i.relParts.length===0)throw new Ln("EINVAL","cannot remove a mount point — use unmount",r);try{const a=i.relParts.slice(0,-1),s=i.relParts[i.relParts.length-1];await(a.length===0?i.handle:await Kr.fsaNavDir(i.handle,a)).removeEntry(s,{recursive:n?.recursive})}catch(a){throw this.convertFsaError(a,r)}return}try{(await this.lfs.stat(r)).isDirectory()?n?.recursive?await this.rmRecursive(r):await this.lfs.rmdir(r):await this.lfs.unlink(r)}catch(a){throw this.convertError(a,r)}}async rmRecursive(e){const n=await this.lfs.readdir(e);for(const r of n){const i=e==="/"?`/${r}`:`${e}/${r}`;(await this.lfs.stat(i)).isDirectory()?await this.rmRecursive(i):await this.lfs.unlink(i)}await this.lfs.rmdir(e)}async stat(e){const n=Ot(e),r=this.findMount(n);if(r){if(r.relParts.length===0)try{const i=await this.lfs.stat(n);return{type:"directory",size:i.size,mtime:i.mtimeMs,ctime:i.ctimeMs}}catch{return{type:"directory",size:0,mtime:Date.now(),ctime:Date.now()}}try{try{const a=await(await Kr.fsaGetFile(r.handle,r.relParts)).getFile();return{type:"file",size:a.size,mtime:a.lastModified,ctime:a.lastModified}}catch{return await Kr.fsaNavDir(r.handle,r.relParts),{type:"directory",size:0,mtime:Date.now(),ctime:Date.now()}}}catch(i){throw this.convertFsaError(i,n)}}try{const i=await this.lfs.stat(n);return{type:i.isDirectory()?"directory":"file",size:i.size,mtime:i.mtimeMs,ctime:i.ctimeMs}}catch(i){throw this.convertError(i,n)}}async exists(e){const n=Ot(e),r=this.findMount(n);if(r){if(r.relParts.length===0)return!0;try{return await this.stat(n),!0}catch{return!1}}try{return await this.lfs.stat(n),!0}catch{return!1}}async rename(e,n){const r=Ot(e),i=Ot(n);try{await this.lfs.rename(r,i)}catch(a){throw this.convertError(a,r)}}async readTextFile(e){return await this.readFile(e,{encoding:"utf-8"})}async*walk(e){const n=Ot(e),r=await this.readDir(n);for(const i of r){const a=n==="/"?`/${i.name}`:`${n}/${i.name}`;i.type==="file"?yield a:yield*this.walk(a)}}async copyFile(e,n){if((await this.stat(e)).type==="directory")throw new Ln("EISDIR","is a directory",e);const i=await this.readFile(e,{encoding:"binary"});await this.writeFile(n,i)}dirname(e){return hl(Ot(e)).dir}basename(e){return hl(Ot(e)).base}convertError(e,n){if(e instanceof Ln)return e;const r=e instanceof Error?e.message:String(e);return r.includes("ENOENT")?new Ln("ENOENT","no such file or directory",n):r.includes("EEXIST")?new Ln("EEXIST","file already exists",n):r.includes("ENOTDIR")?new Ln("ENOTDIR","not a directory",n):r.includes("EISDIR")?new Ln("EISDIR","is a directory",n):r.includes("ENOTEMPTY")?new Ln("ENOTEMPTY","directory not empty",n):new Ln("EINVAL",r,n)}}class GS{vfs;allowedPrefixes;readOnlyPrefixes;constructor(e,n,r=[]){this.vfs=e;const i=a=>{const s=Ot(a);return s.endsWith("/")?s:s+"/"};this.allowedPrefixes=n.map(i),this.readOnlyPrefixes=r.map(i)}isAllowed(e){const n=Ot(e);return[...this.allowedPrefixes,...this.readOnlyPrefixes].some(i=>n===i.slice(0,-1)||n.startsWith(i)||n==="/"||i.startsWith(n+"/"))}isAllowedStrict(e){const n=Ot(e);return[...this.allowedPrefixes,...this.readOnlyPrefixes].some(i=>n===i.slice(0,-1)||n.startsWith(i))}isWritable(e){const n=Ot(e);return this.allowedPrefixes.some(r=>n===r.slice(0,-1)||n.startsWith(r))}checkWrite(e){if(!this.isWritable(e))throw new Ln("EACCES","permission denied",Ot(e))}getUnderlyingFS(){return this.vfs}getLightningFS(){return this.vfs.getLightningFS()}async readFile(e,n){if(!this.isAllowedStrict(e))throw new Ln("ENOENT","no such file or directory",Ot(e));return this.vfs.readFile(e,n)}async readDir(e){if(!this.isAllowed(e))return[];const n=await this.vfs.readDir(e);if(!this.isAllowedStrict(e)){const r=Ot(e);return n.filter(i=>{const a=r==="/"?`/${i.name}`:`${r}/${i.name}`;return this.isAllowed(a)})}return n}async stat(e){if(!this.isAllowed(e))throw new Ln("ENOENT","no such file or directory",Ot(e));return this.vfs.stat(e)}async exists(e){return this.isAllowed(e)?this.vfs.exists(e):!1}async readTextFile(e){if(!this.isAllowedStrict(e))throw new Ln("ENOENT","no such file or directory",Ot(e));return this.vfs.readTextFile(e)}async*walk(e){if(this.isAllowed(e))for await(const n of this.vfs.walk(e))this.isAllowed(n)&&(yield n)}async writeFile(e,n,r){return this.checkWrite(e),this.vfs.writeFile(e,n,r)}async mkdir(e,n){return this.checkWrite(e),this.vfs.mkdir(e,n)}async rm(e,n){return this.checkWrite(e),this.vfs.rm(e,n)}async rename(e,n){return this.checkWrite(e),this.checkWrite(n),this.vfs.rename(e,n)}async copyFile(e,n){if(!this.isAllowed(e))throw new Ln("ENOENT","no such file or directory",Ot(e));return this.checkWrite(n),this.vfs.copyFile(e,n)}dirname(e){return this.vfs.dirname(e)}basename(e){return this.vfs.basename(e)}}const Cz=Object.freeze(Object.defineProperty({__proto__:null,FsError:Ln,RestrictedFS:GS,VirtualFS:Kr,joinPath:wo,normalizePath:Ot,splitPath:hl},Symbol.toStringTag,{value:"Module"})),HS=".slicc",Az="state.json",Pue="skills",ts="manifest.yaml",k0=".skill",Tz=50*1024*1024,_z=50*1024*1024,x3=1e3,hy="/workspace/skills",VS="SKILL.md",ZS="1.0.0";function Iz(t){const e={},n=t.split(`
|
|
743
|
+
`);let r=null,i=!1,a={},s=null;for(const o of n){const l=o.trim();if(!l||l.startsWith("#"))continue;if(l.startsWith("- ")){const f=l.slice(2).trim();i&&s?s.push(f):r&&r.push(f);continue}const c=l.indexOf(":");if(c===-1)continue;const u=l.slice(0,c).trim(),d=l.slice(c+1).trim(),p=o.search(/\S/);if(u==="structured"){i=!0,a={},e.structured=a;continue}if(i&&p>=2){if(p>=4&&s)continue;d===""||d==="[]"?(s=[],a[u]=s):(a[u]=d,s=null);continue}p===0&&(i=!1),d===""||d==="[]"?(r=[],e[u]=r):(e[u]=d,r=null)}return e}function KS(t,e=ts){const n=Iz(t);if(!n.skill||typeof n.skill!="string")throw new Error(`Invalid manifest: missing 'skill' field in ${e}`);if(!n.version||typeof n.version!="string")throw new Error(`Invalid manifest: missing 'version' field in ${e}`);return{skill:n.skill,version:n.version,description:n.description||"",adds:n.adds||[],modifies:n.modifies||[],structured:n.structured,conflicts:n.conflicts||[],depends:n.depends||[],test:n.test,author:n.author}}async function Rz(t,e){const n=`${e}/${ts}`,r=await t.readTextFile(n);return KS(r,n)}function Oue(t,e){const n=(t.depends||[]).filter(r=>!e.includes(r));return{ok:n.length===0,missing:n}}function Mue(t,e){const n=(t.conflicts||[]).filter(r=>e.includes(r));return{ok:n.length===0,conflicting:n}}const $z=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;class E0 extends Error{}function Nz(t){return new TextDecoder().decode(t)}function Pz(t){const e=t.replace(/\\/g,"/");if(!e||e.endsWith("/"))return null;if(e.startsWith("/")||/^[A-Za-z]:\//.test(e))throw new Error(`Blocked suspicious path "${t}".`);const n=e.split("/");if(n.some(r=>r===""||r==="."||r===".."))throw new Error(`Blocked suspicious path "${t}".`);return n.join("/")}function Oz(t){if(!$z.test(t))throw new Error(`Invalid manifest: skill name "${t}" must be a simple directory name.`)}function Mz(t){const e=[];for(const[n,r]of Object.entries(t)){const i=Pz(n);i&&e.push({originalPath:n,path:i,bytes:r})}return e}function Lz(t){const e=t.filter(n=>n.path===ts||n.path.endsWith(`/${ts}`));if(e.length===0)throw new Error(`Skill archive is missing ${ts}.`);if(e.length>1)throw new Error(`Skill archive contains multiple ${ts} files.`);return e[0]}function Dz(t){let e=0,n=0;return vf(t,{filter(r){if(e++,e>x3)throw new E0(`Skill archives may contain at most ${x3} entries.`);if(n+=r.originalSize,n>_z)throw new E0("Skill archives must expand to 50 MB or smaller after extraction.");return!0}})}function Fz(t){const e=`${Date.now()}-${Math.random().toString(16).slice(2,8)}`;return wo(hy,`.${t}.tmp-${e}`)}async function Uz(t,e){if(!e.name.toLowerCase().endsWith(k0))throw new Error(`Only ${k0} archives can be installed with drag and drop.`);if(e.size>Tz)throw new Error("Skill archives must be 50 MB or smaller.");let n;try{const c=new Uint8Array(await e.arrayBuffer());n=Dz(c)}catch(c){if(c instanceof E0)throw c;const u=c instanceof Error?c.message:String(c);throw new Error(`Invalid .skill archive: ${u}`)}const r=Mz(n),i=Lz(r),a=KS(Nz(i.bytes),i.path);Oz(a.skill);const s=wo(hy,a.skill);if(await t.exists(s))throw new Error(`Skill "${a.skill}" already exists at ${s}.`);const o=Fz(a.skill),l=i.path===ts?"":i.path.slice(0,-(ts.length+1));await t.mkdir(o,{recursive:!0});try{let c=0;for(const u of r){if(l&&(u.path===l||!u.path.startsWith(`${l}/`)))continue;const d=l?u.path.slice(l.length+1):u.path;if(!d)continue;const p=wo(o,d),{dir:f}=hl(p);f!=="/"&&await t.mkdir(f,{recursive:!0}),await t.writeFile(p,u.bytes),c++}return await t.rename(o,s),{skillName:a.skill,destinationPath:s,fileCount:c}}catch(c){throw await t.exists(o)&&await t.rm(o,{recursive:!0}),c}}function JS(t){return t.toLowerCase().endsWith(k0)}function Wz(t){return Array.from(t).find(e=>JS(e.name))??null}function k3(t){if(!t)return!1;if(t.items){for(const e of Array.from(t.items))if(e.kind==="file")return!0}return!1}function Bz(t){if(!t)return null;if(t.files){const e=Wz(t.files);if(e)return e}if(!t.items)return null;for(const e of Array.from(t.items)){if(e.kind&&e.kind!=="file")continue;const n=e.getAsFile?.();if(n&&JS(n.name))return n}return null}const gs=wn("cdp");class zz{ws=null;nextId=1;pending=new Map;listeners=new Map;_state="disconnected";get state(){return this._state}async connect(e){if(this._state!=="disconnected")throw new Error(`Cannot connect: state is ${this._state}`);if(!e?.url)throw new Error("CDPClient.connect() requires a WebSocket URL");const{url:n,timeout:r=5e3}=e;return this._state="connecting",new Promise((i,a)=>{const s=setTimeout(()=>{this.cleanup(),a(new Error(`CDP connection timed out after ${r}ms`))},r);try{this.ws=new WebSocket(n)}catch(o){clearTimeout(s),this._state="disconnected",a(o);return}this.ws.onopen=()=>{clearTimeout(s),this._state="connected",gs.info("Connected",{url:n}),i()},this.ws.onerror=o=>{clearTimeout(s),this._state==="connecting"&&(gs.error("Connection failed",{url:n}),this.cleanup(),a(new Error("CDP WebSocket connection failed")))},this.ws.onmessage=o=>{this.handleMessage(o.data)},this.ws.onclose=()=>{this.handleClose()}})}disconnect(){this.ws&&(this.ws.onclose=null,this.ws.close()),this.cleanup(),gs.info("Disconnected")}async send(e,n,r,i=3e4){if(this._state!=="connected"||!this.ws)throw new Error("CDP client is not connected");const a=this.nextId++,s={id:a,method:e};return n&&(s.params=n),r&&(s.sessionId=r),gs.debug("Send",{method:e,id:a,sessionId:r}),new Promise((o,l)=>{const c=setTimeout(()=>{this.pending.delete(a),l(new Error(`CDP command timed out after ${i}ms: ${e}`))},i);this.pending.set(a,{resolve:u=>{clearTimeout(c),o(u)},reject:u=>{clearTimeout(c),l(u)}}),this.ws.send(JSON.stringify(s))})}on(e,n){let r=this.listeners.get(e);r||(r=new Set,this.listeners.set(e,r)),r.add(n)}off(e,n){const r=this.listeners.get(e);r&&(r.delete(n),r.size===0&&this.listeners.delete(e))}once(e,n=3e4){return new Promise((r,i)=>{const a=setTimeout(()=>{this.off(e,s),i(new Error(`Timed out waiting for event: ${e}`))},n),s=o=>{clearTimeout(a),this.off(e,s),r(o)};this.on(e,s)})}handleMessage(e){let n;try{n=JSON.parse(e)}catch{return}if("id"in n&&typeof n.id=="number"){const r=n;gs.debug("Response",{id:r.id,hasError:!!r.error});const i=this.pending.get(r.id);i&&(this.pending.delete(r.id),r.error?(gs.error("Command error",{id:r.id,code:r.error.code,message:r.error.message}),i.reject(new Error(`CDP error: ${r.error.message} (${r.error.code})`))):i.resolve(r.result??{}));return}if("method"in n){const r=n;gs.debug("Event",{method:r.method,sessionId:r.sessionId});const i=this.listeners.get(r.method);if(i){const a=r.sessionId?{...r.params,sessionId:r.sessionId}:r.params??{};for(const s of i)try{s(a)}catch{}}}}handleClose(){gs.error("Connection closed unexpectedly",{pendingCommands:this.pending.size});for(const[,e]of this.pending)e.reject(new Error("CDP connection closed"));this.cleanup()}cleanup(){this.ws=null,this._state="disconnected",this.pending.clear()}}function vo(t,e=""){if(t==null)return e;if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);try{return JSON.stringify(t)??e}catch{return String(t)}}const qz="ws://localhost:5710/cdp",E3=wn("browser-api");function jz(t=typeof window<"u"?window.location:null){return t?.host?`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}/cdp`:qz}class Gz{client;localClient;sessionId=null;attachedTargetId=null;trayTargetProvider=null;remoteTargetInfo=null;_tabLock=Promise.resolve();handleJavaScriptDialogOpening=async e=>{const n=typeof e.sessionId=="string"?e.sessionId:this.sessionId;if(n)try{await this.client.send("Page.handleJavaScriptDialog",{accept:!1},n,5e3),E3.warn("Auto-dismissed unexpected JavaScript dialog",{sessionId:n,type:e.type,message:e.message,url:e.url})}catch(r){E3.warn("Failed to auto-dismiss JavaScript dialog",{sessionId:n,error:r instanceof Error?r.message:String(r)})}};constructor(e){this.client=e??new zz,this.localClient=this.client,this.addDialogListener(this.client)}getTransport(){return this.client}getSessionId(){return this.sessionId}getAttachedTargetId(){return this.attachedTargetId}async withTab(e,n){let r;const i=new Promise(s=>{r=s}),a=this._tabLock;this._tabLock=i,await a;try{const s=await this.attachToPage(e);return await n(s)}finally{r()}}setTrayTargetProvider(e){this.trayTargetProvider=e}async listAllTargets(){const e=await this.listPages();if(!this.trayTargetProvider)return e;const n=!this.remoteTargetInfo,r=new Set(e.map(s=>s.targetId)),a=this.trayTargetProvider.getTargets().filter(s=>!n||!(s.runtimeId==="leader"&&r.has(s.localTargetId))).map(s=>({targetId:s.targetId,title:s.title,url:s.url}));return[...e,...a]}async connect(e){await this.client.connect({url:e?.url??jz(),timeout:e?.timeout})}async createPage(e){return await this.ensureConnected(),(await this.client.send("Target.createTarget",{url:e??"about:blank",background:!0})).targetId}async createRemotePage(e,n){if(!this.trayTargetProvider?.openRemoteTab)throw new Error("Remote tab opening not available (no tray target provider)");return this.trayTargetProvider.openRemoteTab(e,n??"about:blank")}async closePage(e){if(await this.ensureConnected(),this.trayTargetProvider?.createRemoteTransport&&e.includes(":")){const n=e.indexOf(":"),r=e.substring(0,n),i=e.substring(n+1);{const a=this.trayTargetProvider.createRemoteTransport(r,i);try{await a.send("Target.closeTarget",{targetId:i})}finally{this.trayTargetProvider.removeRemoteTransport&&this.trayTargetProvider.removeRemoteTransport(r,i)}this.attachedTargetId===e&&(this.remoteTargetInfo&&(this.setClient(this.localClient),this.remoteTargetInfo=null),this.sessionId=null,this.attachedTargetId=null);return}}await this.localClient.send("Target.closeTarget",{targetId:e}),this.attachedTargetId===e&&(this.sessionId=null,this.attachedTargetId=null)}disconnect(){this.sessionId=null,this.attachedTargetId=null,this.client.disconnect()}async listPages(){return await this.ensureConnected(),((await this.client.send("Target.getTargets")).targetInfos??[]).filter(r=>r.type==="page").map(r=>({targetId:r.targetId,title:r.title,url:r.url,...r.active?{active:!0}:{}}))}async attachToPage(e){if(await this.ensureConnected(),this.sessionId&&this.attachedTargetId===e)return this.sessionId;if(this.trayTargetProvider?.createRemoteTransport&&e.includes(":")){const r=e.indexOf(":"),i=e.substring(0,r),a=e.substring(r+1);{const s=this.trayTargetProvider.createRemoteTransport(i,a);this.setClient(s),this.remoteTargetInfo={runtimeId:i,localTargetId:a};const o=await this.client.send("Target.attachToTarget",{targetId:a,flatten:!0});return this.sessionId=o.sessionId,this.attachedTargetId=e,await this.client.send("Page.enable",{},this.sessionId),this.sessionId}}const n=await this.client.send("Target.attachToTarget",{targetId:e,flatten:!0});return this.sessionId=n.sessionId,this.attachedTargetId=e,await this.client.send("Page.enable",{},this.sessionId),this.sessionId}async detach(){if(this.sessionId){try{await this.client.send("Target.detachFromTarget",{sessionId:this.sessionId})}catch{}this.remoteTargetInfo&&this.trayTargetProvider?.removeRemoteTransport&&(this.trayTargetProvider.removeRemoteTransport(this.remoteTargetInfo.runtimeId,this.remoteTargetInfo.localTargetId),this.setClient(this.localClient),this.remoteTargetInfo=null),this.sessionId=null,this.attachedTargetId=null}}async navigate(e){await this.ensureConnected(),this.ensureAttached(),await this.client.send("Page.enable",{},this.sessionId);const n=this.client.once("Page.loadEventFired");await this.client.send("Page.navigate",{url:e},this.sessionId),await n}async screenshot(e){await this.ensureConnected(),this.ensureAttached();try{const n={format:e?.format??"png",captureBeyondViewport:!0};if(e?.quality!==void 0&&(n.quality=e.quality),e?.clip||e?.fullPage){let a=0,s=0;try{await this.client.send("Runtime.enable",{},this.sessionId);const o=await this.client.send("Runtime.evaluate",{expression:"JSON.stringify({ w: window.innerWidth, h: document.documentElement.scrollHeight })",returnByValue:!0},this.sessionId),l=JSON.parse(o.result?.value??"{}");a=l.w??0,s=l.h??0}catch{}e?.clip?n.clip={...e.clip,scale:e.clip.scale??1}:n.clip={x:0,y:0,width:a||1280,height:s||800,scale:1}}let i=(await this.client.send("Page.captureScreenshot",n,this.sessionId)).data;if(e?.maxWidth)try{const{getMagick:a}=await Vt(async()=>{const{getMagick:d}=await Promise.resolve().then(()=>SP);return{getMagick:d}},void 0),s=await a(),o=atob(i),l=new Uint8Array(o.length);for(let d=0;d<o.length;d++)l[d]=o.charCodeAt(d);const c=8e3;let u=!1;await s.ImageMagick.read(l,async d=>{const p=Math.min(e.maxWidth,c),f=Math.max(d.width,d.height);if(d.width>p||f>c){const h=Math.min(p/d.width,c/f);d.resize(Math.round(d.width*h),Math.round(d.height*h)),u=!0}u&&d.write("PNG",h=>{let m="";for(let g=0;g<h.length;g++)m+=String.fromCharCode(h[g]);i=btoa(m)})})}catch(a){console.warn("[browser-api] Screenshot maxWidth resize failed, returning original",a)}return i}finally{}}async evaluate(e,n){await this.ensureConnected(),this.ensureAttached(),await this.client.send("Runtime.enable",{},this.sessionId);const r=await this.client.send("Runtime.evaluate",{expression:e,awaitPromise:n?.awaitPromise??!0,returnByValue:n?.returnByValue??!0},this.sessionId),i=r.exceptionDetails;if(i){const s=i.exception?.description??i.text;throw new Error(`Evaluation failed: ${s}`)}return r.result.value}async click(e){await this.ensureConnected(),this.ensureAttached();const n=await this.boundingBox(e);if(!n)throw new Error(`Element not found: ${e}`);const r=n.x+n.width/2,i=n.y+n.height/2;await this.client.send("Input.dispatchMouseEvent",{type:"mousePressed",x:r,y:i,button:"left",clickCount:1},this.sessionId),await this.client.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:r,y:i,button:"left",clickCount:1},this.sessionId)}async type(e){await this.ensureConnected(),this.ensureAttached();for(const n of e)await this.client.send("Input.dispatchKeyEvent",{type:"keyDown",text:n},this.sessionId),await this.client.send("Input.dispatchKeyEvent",{type:"keyUp",text:n},this.sessionId)}async waitForSelector(e,n){await this.ensureConnected(),this.ensureAttached();const r=n?.timeout??3e4,i=n?.interval??100,a=Date.now();for(;Date.now()-a<r;){if(await this.evaluate(`!!document.querySelector(${JSON.stringify(e)})`))return;await new Promise(o=>setTimeout(o,i))}throw new Error(`waitForSelector timed out after ${r}ms: ${e}`)}async getAccessibilityTree(){await this.ensureConnected(),this.ensureAttached(),await this.client.send("Accessibility.enable",{},this.sessionId);const n=(await this.client.send("Accessibility.getFullAXTree",{},this.sessionId)).nodes;if(!n||n.length===0)return{role:"RootWebArea",name:""};const r=new Map;let i;for(const s of n){const o=vo(s.value?.value),l=vo(s.description?.value),c={role:vo(s.role?.value,"unknown"),name:vo(s.name?.value)};o!==""&&(c.value=o),l!==""&&(c.description=l),s.backendDOMNodeId&&(c.backendNodeId=s.backendDOMNodeId),s.childIds&&(c.childIds=s.childIds),r.set(s.nodeId,c),s.parentId||(i=s.nodeId)}function a(s){const o=r.get(s);if(!o)return{role:"unknown",name:""};const l={role:o.role,name:o.name};return o.value&&(l.value=o.value),o.description&&(l.description=o.description),o.backendNodeId&&(l.backendNodeId=o.backendNodeId),o.childIds&&o.childIds.length>0&&(l.children=o.childIds.map(c=>a(c)).filter(c=>c.role!=="unknown")),l}return i?a(i):{role:"RootWebArea",name:""}}async clickByBackendNodeId(e){await this.ensureConnected(),this.ensureAttached(),await this.client.send("DOM.enable",{},this.sessionId),await this.client.send("Runtime.enable",{},this.sessionId);const r=(await this.client.send("DOM.resolveNode",{backendNodeId:e},this.sessionId)).object;if(!r?.objectId)throw new Error(`Could not resolve backend node ${e} to a DOM element`);const a=(await this.client.send("Runtime.callFunctionOn",{objectId:r.objectId,functionDeclaration:`function() {
|
|
744
744
|
this.scrollIntoView({ block: 'center', inline: 'center' });
|
|
745
745
|
const r = this.getBoundingClientRect();
|
|
746
746
|
return { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
@@ -2999,7 +2999,7 @@ except SystemExit as exc:
|
|
|
2999
2999
|
except BaseException:
|
|
3000
3000
|
traceback.print_exc()
|
|
3001
3001
|
__slicc_exit_code = 1
|
|
3002
|
-
`;let U1=null,W1=null;const IP=Object.create(null);class Xp extends Error{constructor(e){super(`Process exited with code ${e}`),this.code=e,this.name="NodeExitError"}}function R2(t){const e=t.length>1&&t.endsWith("/")?t.slice(0,-1):t,n=e.lastIndexOf("/");return n>=0?e.slice(n+1):e}function Ase(t){const e=t.lastIndexOf("/");return e<=0?"/":t.slice(0,e)}function Tse(t,e){return t==="/"?`/${e}`:`${t}/${e}`}function _se(t){if(/^(https?:\/\/|about:|file:|chrome:)/i.test(t))return!0;try{return new URL(t).protocol.length>0}catch{return!1}}function Ise(t,e){return t==="/"?e.startsWith("/"):e===t||e.startsWith(`${t}/`)}function Rse(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function $se(t){return t==null?"":t instanceof Uint8Array?`x'${Rse(t)}'`:String(t)}function Rv(t){return ry(t)}function ef(t){const e=typeof chrome<"u"&&!!chrome?.runtime?.id,n=`/preview${t}`;return e?chrome.runtime.getURL(n):`${typeof window<"u"&&window.location?.origin?window.location.origin:"http://localhost:5710"}${n}`}function Nse(t){return t.length===0||t.startsWith("/")?!1:!t.split("/").some(e=>e==="..")}function Pse(t,e){return Ot(`${t}/${e}`)}function As(t){if(typeof t=="string")return t;if(t==null)return String(t);try{return JSON.stringify(t)}catch{return String(t)}}function RP(t,e){const n=import.meta.resolve;if(typeof n=="function")try{return new URL("./",n(t))}catch{}return new URL(e,import.meta.url)}async function Ose(){return U1||(U1=(async()=>{const e=(await Vt(()=>import("./sql-wasm-
|
|
3002
|
+
`;let U1=null,W1=null;const IP=Object.create(null);class Xp extends Error{constructor(e){super(`Process exited with code ${e}`),this.code=e,this.name="NodeExitError"}}function R2(t){const e=t.length>1&&t.endsWith("/")?t.slice(0,-1):t,n=e.lastIndexOf("/");return n>=0?e.slice(n+1):e}function Ase(t){const e=t.lastIndexOf("/");return e<=0?"/":t.slice(0,e)}function Tse(t,e){return t==="/"?`/${e}`:`${t}/${e}`}function _se(t){if(/^(https?:\/\/|about:|file:|chrome:)/i.test(t))return!0;try{return new URL(t).protocol.length>0}catch{return!1}}function Ise(t,e){return t==="/"?e.startsWith("/"):e===t||e.startsWith(`${t}/`)}function Rse(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function $se(t){return t==null?"":t instanceof Uint8Array?`x'${Rse(t)}'`:String(t)}function Rv(t){return ry(t)}function ef(t){const e=typeof chrome<"u"&&!!chrome?.runtime?.id,n=`/preview${t}`;return e?chrome.runtime.getURL(n):`${typeof window<"u"&&window.location?.origin?window.location.origin:"http://localhost:5710"}${n}`}function Nse(t){return t.length===0||t.startsWith("/")?!1:!t.split("/").some(e=>e==="..")}function Pse(t,e){return Ot(`${t}/${e}`)}function As(t){if(typeof t=="string")return t;if(t==null)return String(t);try{return JSON.stringify(t)}catch{return String(t)}}function RP(t,e){const n=import.meta.resolve;if(typeof n=="function")try{return new URL("./",n(t))}catch{}return new URL(e,import.meta.url)}async function Ose(){return U1||(U1=(async()=>{const e=(await Vt(()=>import("./sql-wasm-CFjKorYF.js").then(r=>r.s),__vite__mapDeps([16,17,18]))).default,n=typeof window>"u"?RP("sql.js/dist/sql-wasm.js","../../../../../node_modules/sql.js/dist/").toString():kse;return e({locateFile:r=>`${n}${r}`})})()),U1}const Mse=typeof chrome<"u"&&!!chrome?.runtime?.id;async function Lse(){return W1||(W1=(async()=>{const{loadPyodide:t}=await Vt(async()=>{const{loadPyodide:n}=await import("./pyodide-D7VX_btJ.js");return{loadPyodide:n}},[]);let e;return typeof window>"u"?e=decodeURIComponent(RP("pyodide/pyodide.mjs","../../../../../node_modules/pyodide/").pathname):Mse?e=chrome.runtime.getURL("pyodide/"):e=Ese,t({indexURL:e,fullStdLib:!1})})()),W1}function Dse(){return{stdout:`usage: node -e <code> [args...]
|
|
3003
3003
|
`,stderr:"",exitCode:0}}function Fse(){return{stdout:`${Sse}
|
|
3004
3004
|
`,stderr:"",exitCode:0}}function Use(){return hn("node",async(t,e)=>{if(t.includes("--help")||t.includes("-h"))return Dse();if(t.includes("--version")||t.includes("-v"))return Fse();let n="",r="<stdin>",i=["node"];if(t.length>0&&(t[0]==="-e"||t[0]==="--eval")){if(!t[1])return{stdout:"",stderr:`node: option requires an argument -- eval
|
|
3005
3005
|
`,exitCode:9};n=t[1],r="[eval]",i=["node",...t.slice(2)]}else if(t.length>0&&!t[0].startsWith("-")){const m=t[0],g=e.fs.resolvePath(e.cwd,m);if(!await e.fs.exists(g))return{stdout:"",stderr:`node: cannot find module '${m}'
|
|
@@ -3074,7 +3074,7 @@ ${n}`)(d,u,c,f,h,h.exports,IP,p),{stdout:a.join(""),stderr:s.join(""),exitCode:0
|
|
|
3074
3074
|
`,exitCode:1};let c;try{c=await e.fs.readFileBuffer(o)}catch{return{stdout:"",stderr:`open: failed to read: ${s}
|
|
3075
3075
|
`,exitCode:1}}const u=new Uint8Array(c.byteLength);u.set(c);const d=new Blob([u.buffer],{type:Rv(o)}),p=URL.createObjectURL(d),f=document.createElement("a");f.href=p,f.download=R2(o)||"download",f.style.display="none",document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(p),0),a.push(`downloaded ${o}`)}else{const l=ef(o);window.open(l,"_blank","noopener,noreferrer"),a.push(`opened ${o} → ${l}`)}}return{stdout:a.join(`
|
|
3076
3076
|
`)+`
|
|
3077
|
-
`,stderr:"",exitCode:0}})}let B1=null,z1=null;async function q1(){return B1||(B1=Vt(()=>import("./index-
|
|
3077
|
+
`,stderr:"",exitCode:0}})}let B1=null,z1=null;async function q1(){return B1||(B1=Vt(()=>import("./index-qZV7PBFf.js"),__vite__mapDeps([19,17,18]))),B1}async function qse(){return z1||(z1=Vt(()=>import("./index-Cj5FGv1O.js"),[])),z1}function jse(t){return t.endsWith("right")?{range:t.slice(0,-5),rotation:90}:t.endsWith("left")?{range:t.slice(0,-4),rotation:270}:t.endsWith("down")?{range:t.slice(0,-4),rotation:180}:{range:t}}function _8(t){const{range:e,rotation:n}=jse(t);if(/^\d+$/.test(e)){const i=parseInt(e,10);return{start:i,end:i,rotation:n}}const r=e.match(/^(\d+)-(\d+|end)$/);if(r){const i=parseInt(r[1],10),a=r[2]==="end"?"end":parseInt(r[2],10);return{start:i,end:a,rotation:n}}throw new Error(`Invalid page range: ${t}`)}function I8(t,e){const n=t.start,r=t.end;if(n<1||n>e)throw new Error(`Page ${n} out of range (1-${e})`);const i=r==="end"?e:r;if(i<1||i>e)throw new Error(`Page ${i} out of range (1-${e})`);if(i<n)throw new Error(`Invalid range: ${n}-${i}`);const a=[];for(let s=n;s<=i;s++)a.push(s);return a}function Gse(){return{stdout:`usage: pdftk <input.pdf> <operation> [args...]
|
|
3078
3078
|
|
|
3079
3079
|
Operations:
|
|
3080
3080
|
dump_data Print metadata (page count, title, author, etc.)
|
|
@@ -3568,7 +3568,7 @@ ${h}`,stderr:"",exitCode:0}}catch(a){return{stdout:"",stderr:`upskill: failed to
|
|
|
3568
3568
|
`,stderr:"",exitCode:0}}catch(c){return{stdout:"",stderr:`upskill: failed to install from GitHub: ${c instanceof Error?c.message:String(c)}
|
|
3569
3569
|
`,exitCode:1}}}function ole(t){const e=t.match(/^https?:\/\/clawhub\.ai\/[^\/]+\/([^\/]+)/);if(e)return e[1];if(t.startsWith("clawhub:")){const n=t.slice(8);return n.includes("/")?n.split("/")[1]:n}return null}async function YP(){await Gf(),await jf()}async function jf(){try{const e=(typeof window<"u"?window:globalThis).__slicc_reloadSkills;if(typeof e=="function"){await e();return}typeof chrome<"u"&&chrome?.runtime?.sendMessage&&chrome.runtime.sendMessage({source:"panel",payload:{type:"reload-skills"}})}catch{}}function lle(t){const e=t.match(/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)(?:@([a-zA-Z0-9_./\-]+))?$/);return e?{owner:e[1],repo:e[2],branch:e[3]}:null}async function Gf(){try{if(typeof window>"u")return;const t=window.__slicc_sprinkleManager;t&&typeof t.openNewAutoOpenSprinkles=="function"&&await t.openNewAutoOpenSprinkles()}catch{}}async function cle(t,e,n){let r=null;try{const c=await t.readDir("/home");for(const u of c)try{const d=await t.readTextFile(`/home/${u.name}/.welcome.json`);r=JSON.parse(d);break}catch{}}catch{}if(!r)return{stdout:"",stderr:`upskill: no user profile found. Complete the welcome onboarding first, or create /home/<name>/.welcome.json manually.
|
|
3570
3570
|
`,exitCode:1};let i;try{const c=await t.readTextFile("/shared/skill-catalog.json");i=JSON.parse(c)}catch{return{stdout:"",stderr:`upskill: skill catalog not found at /shared/skill-catalog.json
|
|
3571
|
-
`,exitCode:1}}const a=new Set;try{const u=await(await Vt(()=>import("./index-
|
|
3571
|
+
`,exitCode:1}}const a=new Set;try{const u=await(await Vt(()=>import("./index-D5qCAmuj.js"),[])).discoverSkills(t);for(const d of u)a.add(d.name)}catch{}const s=Hoe(i.skills,r).filter(c=>!a.has(c.entry.name));if(s.length===0)return{stdout:`No new skill recommendations — all matching skills are already installed.
|
|
3572
3572
|
`,stderr:"",exitCode:0};if(n){let c="",u="",d=0;for(const p of s){const f=p.entry.source,h=await Nv(e),[m,g]=f.repo.split("/"),v=await QP(m,g,h,f.path,e);if(v.error){u+=`upskill: failed to list ${p.entry.name}: ${v.error}
|
|
3573
3573
|
`;continue}const y=f.skill?v.skills.filter(b=>b.name===f.skill):v.skills;for(const b of y){const S=await Pv(m,g,b.path,b.name,t,h,!1,e);S.exitCode===0?(c+=S.stdout,d++):u+=S.stderr}}return d>0&&(c+=`
|
|
3574
3574
|
Installed ${d} recommended skill(s)
|
|
@@ -3580,10 +3580,10 @@ Installed ${d} recommended skill(s)
|
|
|
3580
3580
|
`,o+=` Install: ${u}
|
|
3581
3581
|
|
|
3582
3582
|
`}return o+=`To install all recommended: upskill recommendations --install
|
|
3583
|
-
`,{stdout:o,stderr:"",exitCode:0}}function ule(t,e){return hn("upskill",async(n,r)=>{if(n.length===0||n.includes("--help")||n.includes("-h"))return q8();const i=[];let a,s=!1,o=!1,l=!1,c="",u,d="",p=1,f=0;for(;f<n.length;){const g=n[f];if(g==="search"){const v=n.slice(f+1),y=v.indexOf("--page");y>=0&&(p=parseInt(v[y+1],10)||1,v.splice(y,2)),d=v.join(" ");break}else if(g==="recommendations"){const v=n.includes("--install");return cle(t,e,v)}else if(g==="list"){const y=await(await Vt(()=>import("./index-
|
|
3583
|
+
`,{stdout:o,stderr:"",exitCode:0}}function ule(t,e){return hn("upskill",async(n,r)=>{if(n.length===0||n.includes("--help")||n.includes("-h"))return q8();const i=[];let a,s=!1,o=!1,l=!1,c="",u,d="",p=1,f=0;for(;f<n.length;){const g=n[f];if(g==="search"){const v=n.slice(f+1),y=v.indexOf("--page");y>=0&&(p=parseInt(v[y+1],10)||1,v.splice(y,2)),d=v.join(" ");break}else if(g==="recommendations"){const v=n.includes("--install");return cle(t,e,v)}else if(g==="list"){const y=await(await Vt(()=>import("./index-D5qCAmuj.js"),[])).discoverSkills(t);return y.length===0?{stdout:`No discoverable local skills found.
|
|
3584
3584
|
|
|
3585
3585
|
${Jc()}${Qc()}`,stderr:"",exitCode:0}:{stdout:VP(y,"Discoverable local skills"),stderr:"",exitCode:0}}else if(g==="info"||g==="read"){const v=n[f+1];if(!v)return{stdout:"",stderr:`upskill: ${g} requires a skill name
|
|
3586
|
-
`,exitCode:1};const y=await Vt(()=>import("./index-
|
|
3586
|
+
`,exitCode:1};const y=await Vt(()=>import("./index-D5qCAmuj.js"),[]);if(g==="info"){const b=await y.getSkillInfo(t,v);return b?{stdout:ZP(b),stderr:"",exitCode:0}:{stdout:"",stderr:`upskill: skill "${v}" not found
|
|
3587
3587
|
`,exitCode:1}}else{const b=await y.readSkillInstructions(t,v);return b===null?{stdout:"",stderr:`upskill: no SKILL.md found for "${v}"
|
|
3588
3588
|
`,exitCode:1}:{stdout:b+`
|
|
3589
3589
|
`,stderr:"",exitCode:0}}}else if(g==="--skill")i.push(n[++f]);else if(g==="--path"||g==="-p")a=n[++f];else if(g==="--list")s=!0;else if(g==="--all")o=!0;else if(g==="--force")l=!0;else if(g==="--branch"||g==="-b"){const v=n[f+1];if(!v||v.startsWith("-"))return{stdout:"",stderr:`upskill: --branch requires a value
|
|
@@ -3634,7 +3634,7 @@ Examples:
|
|
|
3634
3634
|
skill list
|
|
3635
3635
|
skill info bluebubbles
|
|
3636
3636
|
skill read bluebubbles
|
|
3637
|
-
`,stderr:"",exitCode:0};const r=e[0],i=await Vt(()=>import("./index-
|
|
3637
|
+
`,stderr:"",exitCode:0};const r=e[0],i=await Vt(()=>import("./index-D5qCAmuj.js"),[]);try{switch(r){case"list":{const a=await i.discoverSkills(t);return a.length===0?{stdout:`No discoverable skills found.
|
|
3638
3638
|
|
|
3639
3639
|
${Jc()}${Qc()}
|
|
3640
3640
|
Install install-managed skills with: upskill owner/repo --all
|
|
@@ -3722,7 +3722,7 @@ Usage: mount <target-path>
|
|
|
3722
3722
|
const globalThis = __state;
|
|
3723
3723
|
const global = __state;
|
|
3724
3724
|
${t}`)(c,l,o,d,p,p.exports,IP,u),{stdout:r.join(""),stderr:i.join(""),exitCode:0}}catch(f){if(f instanceof Xp)return{stdout:r.join(""),stderr:i.join(""),exitCode:f.code};const h=f instanceof Error?f.stack??f.message:String(f);return{stdout:r.join(""),stderr:`${i.join("")}${h}
|
|
3725
|
-
`,exitCode:1}}}function mle(t){const e=[];let n="",r=0;for(;r<t.length;){const i=t[r];if(i==='"'){for(r++;r<t.length&&t[r]!=='"';)n+=t[r],r++;r++}else if(i==="'"){for(r++;r<t.length&&t[r]!=="'";)n+=t[r],r++;r++}else i==="\\"&&r+1<t.length&&t[r+1]===" "?(n+=" ",r+=2):/\s/.test(i)?(n.length>0&&(e.push(n),n=""),r++):(n+=i,r++)}return n.length>0&&e.push(n),e}let bl=null,G8=!1;function gle(){return typeof chrome<"u"&&chrome?.runtime?.id?"extension":typeof document<"u"&&document.documentElement?.dataset?.electronOverlay?"electron":"cli"}async function XP(){if(!G8&&!(typeof localStorage<"u"&&localStorage.getItem("telemetry-disabled")==="true"))try{typeof window<"u"&&(window.SAMPLE_PAGEVIEWS_AT_RATE="high"),bl=(await Vt(()=>import("./index-D7hjyFh1.js"),[])).sampleRUM,G8=!0,bl&&bl("navigate",{source:typeof document<"u"?document.referrer:"",target:gle()})}catch{}}function vle(t,e){bl?.("formsubmit",{source:t,target:e})}function yle(t){bl?.("fill",{source:t})}function wle(t){bl?.("viewblock",{source:t})}function H8(t){const e=t.length>1&&t.endsWith("/")?t.slice(0,-1):t,n=e.lastIndexOf("/");return n>=0?e.slice(n+1):e}function ble(t){if(!t)return!0;const e=t.toLowerCase();return e.startsWith("text/")||e.includes("json")||e.includes("xml")||e.includes("javascript")||e.includes("ecmascript")||e.includes("html")||e.includes("css")||e.includes("svg")}async function V8(t,e){const n=t.headers.get("content-type")??"";if(ble(n))return t.text();const i=await t.arrayBuffer(),a=new Uint8Array(i),s=new TextDecoder("iso-8859-1").decode(i);return hie(s,a),e&&mie(e,a),s}function Z8(t){if(t){if(t instanceof Headers){const e={};return t.forEach((n,r)=>{e[r]=n}),e}return t}}function K8(t,e){if(!t)return;if((e?.["Content-Type"]??e?.["content-type"]??"").includes("multipart/form-data")){const r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}return t}function xle(){return typeof chrome<"u"&&!!chrome?.runtime?.id?async(e,n)=>{const r=Z8(n?.headers),i=await fetch(e,{method:n?.method??"GET",headers:r,body:K8(n?.body,r)}),a=await V8(i,e),s={};return i.headers.forEach((o,l)=>{s[l]=o}),{status:i.status,statusText:i.statusText,headers:s,body:a,url:e}}:async(e,n)=>{const r=n?.method??"GET",
|
|
3725
|
+
`,exitCode:1}}}function mle(t){const e=[];let n="",r=0;for(;r<t.length;){const i=t[r];if(i==='"'){for(r++;r<t.length&&t[r]!=='"';)n+=t[r],r++;r++}else if(i==="'"){for(r++;r<t.length&&t[r]!=="'";)n+=t[r],r++;r++}else i==="\\"&&r+1<t.length&&t[r+1]===" "?(n+=" ",r+=2):/\s/.test(i)?(n.length>0&&(e.push(n),n=""),r++):(n+=i,r++)}return n.length>0&&e.push(n),e}let bl=null,G8=!1;function gle(){return typeof chrome<"u"&&chrome?.runtime?.id?"extension":typeof document<"u"&&document.documentElement?.dataset?.electronOverlay?"electron":"cli"}async function XP(){if(!G8&&!(typeof localStorage<"u"&&localStorage.getItem("telemetry-disabled")==="true"))try{typeof window<"u"&&(window.SAMPLE_PAGEVIEWS_AT_RATE="high"),bl=(await Vt(()=>import("./index-D7hjyFh1.js"),[])).sampleRUM,G8=!0,bl&&bl("navigate",{source:typeof document<"u"?document.referrer:"",target:gle()})}catch{}}function vle(t,e){bl?.("formsubmit",{source:t,target:e})}function yle(t){bl?.("fill",{source:t})}function wle(t){bl?.("viewblock",{source:t})}function H8(t){const e=t.length>1&&t.endsWith("/")?t.slice(0,-1):t,n=e.lastIndexOf("/");return n>=0?e.slice(n+1):e}function ble(t){if(!t)return!0;const e=t.toLowerCase();return e.startsWith("text/")||e.includes("json")||e.includes("xml")||e.includes("javascript")||e.includes("ecmascript")||e.includes("html")||e.includes("css")||e.includes("svg")}async function V8(t,e){const n=t.headers.get("content-type")??"";if(ble(n))return t.text();const i=await t.arrayBuffer(),a=new Uint8Array(i),s=new TextDecoder("iso-8859-1").decode(i);return hie(s,a),e&&mie(e,a),s}function Z8(t){if(t){if(t instanceof Headers){const e={};return t.forEach((n,r)=>{e[r]=n}),e}return t}}function K8(t,e){if(!t)return;if((e?.["Content-Type"]??e?.["content-type"]??"").includes("multipart/form-data")){const r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}return t}function xle(t){if(!t)return{};const e={};for(const[n,r]of Object.entries(t)){const i=n.toLowerCase();i==="cookie"?e["X-Proxy-Cookie"]=r:i==="origin"?e["X-Proxy-Origin"]=r:i==="referer"?e["X-Proxy-Referer"]=r:i.startsWith("proxy-")?e[`X-Proxy-${n}`]=r:e[n]=r}return e}function kle(t){const e={};for(const[n,r]of Object.entries(t))n.toLowerCase()==="x-proxy-set-cookie"?e["set-cookie"]=r:e[n]=r;return e}function Ele(){return typeof chrome<"u"&&!!chrome?.runtime?.id?async(e,n)=>{const r=Z8(n?.headers),i=await fetch(e,{method:n?.method??"GET",headers:r,body:K8(n?.body,r)}),a=await V8(i,e),s={};return i.headers.forEach((o,l)=>{s[l]=o}),{status:i.status,statusText:i.statusText,headers:s,body:a,url:e}}:async(e,n)=>{const r=n?.method??"GET",i=Z8(n?.headers),s={...xle(i),"X-Target-URL":e},o={method:r,headers:s,cache:"no-store"};n?.body&&!["GET","HEAD"].includes(r)&&(o.body=K8(n.body,s));const l=await fetch("/api/fetch-proxy",o);if(l.status===502||l.status===400){const p=await l.text();let f=`Proxy error ${l.status}`;try{f=JSON.parse(p).error??f}catch{}throw new Error(f)}const c=await V8(l,e),u={};l.headers.forEach((p,f)=>{u[f]=p});const d=kle(u);return{status:l.status,statusText:l.statusText,headers:d,body:c,url:e}}}class eO{constructor(e){this.options=e,this.vfsAdapter=new XN(e.fs);const n=e.cwd??"/",r={HOME:"/",PATH:"/usr/bin",USER:"user",SHELL:"/bin/bash",PWD:n,...e.env};this.gitCommands=new Jp({fs:e.fs,authorName:r.GIT_AUTHOR_NAME??"User",authorEmail:r.GIT_AUTHOR_EMAIL??"user@example.com"}),this.mountCommands=new fle({fs:e.fs});const i=this.createGitCustomCommand(),a=qoe({onMediaPreview:async u=>this.renderMediaPreview(u),getJshCommands:()=>this.getJshCommandNames(),fs:e.fs,browserAPI:e.browserAPI}),s=this.createMountCustomCommand(),o=Ele(),l=[i,s,dle(e.fs),ule(e.fs,o),...a];this.bash=new pie({fs:this.vfsAdapter,cwd:n,env:r,fetch:o,customCommands:l});const c=l.map(u=>u.name);this.builtinCommandNames=new Set([...Pee(),...Oee(),...c]),this.vfsAdapter.setRegisteredCommandsFn(()=>[...this.builtinCommandNames]),this.lastEnv={...r},this.cwd=n}bash;vfsAdapter;gitCommands;mountCommands;terminal=null;fitAddon=null;terminalHost=null;previewHost=null;previewUrls=[];previewStateListener=null;hasPreview=!1;resizeObserver=null;themeObserver=null;currentLine="";cursorPos=0;history=[];historyIndex=-1;isExecuting=!1;continuationBuffer="";lastEnv;cwd;builtinCommandNames;createGitCustomCommand(){const e=this.gitCommands;return hn("git",async(n,r)=>{const i=r.cwd,a=await e.execute(n,i);return{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode}})}createMountCustomCommand(){const e=this.mountCommands;return hn("mount",async(n,r)=>{const i=r.cwd,a=await e.execute(n,i);return{stdout:a.stdout,stderr:a.stderr,exitCode:a.exitCode}})}getBash(){return this.bash}getCwd(){return this.cwd}getEnv(){return{...this.lastEnv}}async getFilteredJshCommands(){const e=await LP(this.options.fs),n=new Map;for(const[r,i]of e)this.builtinCommandNames.has(r)||n.set(r,i);return n}async getJshCommandNames(){return[...(await this.getFilteredJshCommands()).keys()]}async tryJshFallback(e){const n=e.trim(),r=n.indexOf(" "),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1).trim():"",o=(await this.getFilteredJshCommands()).get(i);if(!o)return null;const l=a?mle(a):[],c=await j8(o,l,{fs:this.vfsAdapter,cwd:this.cwd,env:new Map(Object.entries(this.lastEnv)),stdin:"",exec:(u,d)=>this.bash.exec(u,{env:this.lastEnv,cwd:d?.cwd??this.cwd})});return{stdout:c.stdout,stderr:c.stderr,exitCode:c.exitCode,env:this.lastEnv}}async runCommand(e){const n=e.trim().split(/\s+/)[0]||"unknown";yle(n);const r=await this.bash.exec(e,{env:this.lastEnv,cwd:this.cwd});if(r.env&&(this.lastEnv={...r.env}),r.env?.PWD&&(this.cwd=r.env.PWD),r.exitCode===127){const i=await this.tryJshFallback(e);if(i)return i}return r}async mount(e){const n=e??this.options.container;if(!n)throw new Error("No container element provided");const{Terminal:r}=await Vt(async()=>{const{Terminal:l}=await import("./xterm-Bb8UKAlD.js");return{Terminal:l}},[]),{FitAddon:i}=await Vt(async()=>{const{FitAddon:l}=await import("./addon-fit-DOCEibfw.js");return{FitAddon:l}},[]);await Vt(()=>Promise.resolve({}),__vite__mapDeps([20]));const a=!document.documentElement.classList.contains("theme-light"),s={background:"#141414",foreground:"#cfcfcf",cursor:"#3562ff",cursorAccent:"#141414",selectionBackground:"#3562ff40",selectionForeground:"#ffffff",black:"#1a1a1a",red:"#e34850",green:"#2d9d78",yellow:"#e68619",blue:"#3562ff",magenta:"#a962e8",cyan:"#2db9be",white:"#cfcfcf",brightBlack:"#5a5a5a",brightRed:"#e34850",brightGreen:"#2d9d78",brightYellow:"#e68619",brightBlue:"#4a75ff",brightMagenta:"#a962e8",brightCyan:"#2db9be",brightWhite:"#ffffff"},o={background:"#f0f0f0",foreground:"#1a1a1a",cursor:"#2b54db",cursorAccent:"#f0f0f0",selectionBackground:"#2b54db30",selectionForeground:"#000000",black:"#1a1a1a",red:"#d73220",green:"#268e6c",yellow:"#d17a00",blue:"#2b54db",magenta:"#8839ef",cyan:"#1a9088",white:"#e8e8e8",brightBlack:"#6e6e6e",brightRed:"#d73220",brightGreen:"#268e6c",brightYellow:"#d17a00",brightBlue:"#1e44c4",brightMagenta:"#8839ef",brightCyan:"#1a9088",brightWhite:"#ffffff"};this.terminal=new r({cursorBlink:!0,fontSize:11,fontFamily:"'Source Code Pro', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace",theme:a?s:o,convertEol:!0}),this.themeObserver?.disconnect(),this.themeObserver=new MutationObserver(()=>{if(!this.terminal)return;const l=document.documentElement.classList.contains("theme-light");this.terminal.options.theme=l?o:s}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.fitAddon=new i,this.terminal.loadAddon(this.fitAddon),n.replaceChildren(),this.terminalHost=document.createElement("div"),this.terminalHost.className="terminal-panel__terminal-host",n.appendChild(this.terminalHost),this.previewHost=document.createElement("div"),this.previewHost.className="terminal-panel__preview",n.appendChild(this.previewHost),this.terminal.open(this.terminalHost),this.fitAddon.fit(),this.resizeObserver?.disconnect(),this.resizeObserver=new ResizeObserver(()=>this.refit()),this.resizeObserver.observe(this.terminalHost),this.terminal.writeln("\x1B[1mslicc\x1B[0m \x1B[90mshell (powered by just-bash)\x1B[0m"),this.terminal.writeln(`\x1B[90mType "help" for available commands.\x1B[0m
|
|
3726
3726
|
`),this.showPrompt(),this.setupInputHandler()}async executeCommand(e){const n=await this.runCommand(e);return{stdout:n.stdout,stderr:n.stderr,exitCode:n.exitCode}}async executeScriptFile(e,n=[]){return j8(e,n,{fs:this.vfsAdapter,cwd:this.cwd,env:new Map(Object.entries(this.lastEnv)),stdin:"",exec:(r,i)=>this.bash.exec(r,{env:this.lastEnv,cwd:i?.cwd??this.cwd})})}refit(){this.fitAddon?.fit()}setPreviewStateListener(e){this.previewStateListener=e,this.previewStateListener?.(this.hasPreview)}async executeCommandInTerminal(e){const n=e.trim();if(!n)return{stdout:"",stderr:"",exitCode:0};if(!this.terminal)return this.executeCommand(n);if(this.isExecuting||this.currentLine.length>0||this.continuationBuffer.length>0)return{stdout:"",stderr:`terminal is busy; finish current input first
|
|
3727
3727
|
`,exitCode:1};this.history[this.history.length-1]!==n&&this.history.push(n),this.historyIndex=-1,this.terminal.write(n),this.terminal.writeln(""),this.isExecuting=!0;try{const r=await this.runCommand(n);return r.stdout&&this.writeToTerminal(r.stdout),r.stderr&&this.writeToTerminal(r.stderr,!0),{stdout:r.stdout,stderr:r.stderr,exitCode:r.exitCode}}catch(r){const a=`Error: ${r instanceof Error?r.message:String(r)}
|
|
3728
3728
|
`;return this.writeToTerminal(a,!0),{stdout:"",stderr:a,exitCode:1}}finally{this.isExecuting=!1,this.showPrompt()}}clearTerminal(){this.terminal?.clear(),this.clearMediaPreview()}dispose(){this.themeObserver?.disconnect(),this.themeObserver=null,this.resizeObserver?.disconnect(),this.resizeObserver=null,this.clearMediaPreview(),this.terminal?.dispose(),this.terminal=null,this.fitAddon=null,this.terminalHost=null,this.previewHost=null}showPrompt(){if(!this.terminal)return;const e=this.cwd==="/"?"/":this.cwd.split("/").pop()??this.cwd;this.terminal.write(`\x1B[34m${e}\x1B[0m \x1B[90m$\x1B[0m `)}setupInputHandler(){this.terminal&&this.terminal.onData(e=>{if(!this.isExecuting){if(e.startsWith("\x1B[")||e.startsWith("\x1BO")){switch(e){case"\x1B[A":this.handleHistoryUp();return;case"\x1B[B":this.handleHistoryDown();return;case"\x1B[C":this.handleArrowRight();return;case"\x1B[D":this.handleArrowLeft();return;case"\x1B[H":case"\x1BOH":case"\x1B[1~":this.handleHome();return;case"\x1B[F":case"\x1BOF":case"\x1B[4~":this.handleEnd();return;case"\x1B[3~":this.handleDelete();return}return}for(const n of e)switch(n){case"\r":this.handleEnter();break;case"":this.handleBackspace();break;case"":this.handleCtrlC();break;case" ":this.handleTab();break;default:n>=" "&&this.insertChar(n)}}})}getPromptWidth(){return(this.cwd==="/"?"/":this.cwd.split("/").pop()??this.cwd).length+3}getCursorVisualLine(){let e=0;for(const[n,r]of this.currentLine.split(`
|
|
@@ -3739,9 +3739,9 @@ ${t}`)(c,l,o,d,p,p.exports,IP,u),{stdout:r.join(""),stderr:i.join(""),exitCode:0
|
|
|
3739
3739
|
`).filter(Boolean);if(l.length===0)return;if(l.length===1){const c=l[0],u=c.slice(r.length);u&&(this.currentLine=this.currentLine.slice(0,this.cursorPos)+u+this.currentLine.slice(this.cursorPos),this.cursorPos+=u.length,this.terminal.write(u));let d=" ";i||(await this.bash.exec(`compgen -d -- ${a.slice(0,-1)}${u}'`,{env:this.lastEnv,cwd:this.cwd})).stdout.trim()===c&&(d="/"),this.currentLine=this.currentLine.slice(0,this.cursorPos)+d+this.currentLine.slice(this.cursorPos),this.cursorPos+=1,this.terminal.write(d)}else{let c=l[0];for(const d of l)for(;!d.startsWith(c);)c=c.slice(0,-1);const u=c.slice(r.length);if(u)this.currentLine=this.currentLine.slice(0,this.cursorPos)+u+this.currentLine.slice(this.cursorPos),this.cursorPos+=u.length,this.terminal.write(u);else{this.terminal.writeln(""),this.terminal.writeln(l.map(p=>p.split("/").pop()??p).join(" ")),this.showPrompt(),this.terminal.write(this.currentLine);const d=this.currentLine.length-this.cursorPos;d>0&&this.terminal.write(`\x1B[${d}D`)}}}catch(o){console.warn("[Shell] Tab completion failed:",o instanceof Error?o.message:String(o))}}replaceCurrentLine(e){const n=this.getCursorVisualLine();n>0&&this.terminal?.write(`\x1B[${n}A`),this.terminal?.write("\r\x1B[J"),this.showPrompt(),this.currentLine=e,this.cursorPos=e.length,this.terminal?.write(e)}isIncomplete(e){if(e.endsWith("\\"))return!0;let n=!1,r=!1,i=!1;for(const a of e){if(i){i=!1;continue}if(a==="\\"&&!n){i=!0;continue}if(a==="'"&&!r){n=!n;continue}if(a==='"'&&!n){r=!r;continue}}return n||r}async handleEnter(){const e=this.currentLine.split(`
|
|
3740
3740
|
`);if(e.length>1){const a=this.getCursorVisualLine(),s=e.length-1-a;s>0&&this.terminal?.write(`\x1B[${s}B`);const o=e[e.length-1].length;this.terminal?.write("\r"),o>0&&this.terminal?.write(`\x1B[${o}C`)}this.terminal?.writeln("");const n=this.currentLine;this.currentLine="",this.cursorPos=0;const r=this.continuationBuffer?this.continuationBuffer+`
|
|
3741
3741
|
`+n:n;if(this.isIncomplete(r)){this.continuationBuffer=r,this.terminal?.write("> ");return}this.continuationBuffer="";const i=r.trim();if(this.historyIndex=-1,!i){this.showPrompt();return}if(this.history[this.history.length-1]!==i&&this.history.push(i),i==="clear"){this.clearTerminal(),this.showPrompt();return}this.isExecuting=!0;try{const a=await this.runCommand(i);a.stdout&&this.writeToTerminal(a.stdout),a.stderr&&this.writeToTerminal(a.stderr,!0)}catch(a){const s=a instanceof Error?a.message:String(a);this.writeToTerminal(`Error: ${s}
|
|
3742
|
-
`,!0)}this.isExecuting=!1,this.showPrompt()}writeToTerminal(e,n=!1){this.terminal&&(n?this.terminal.write(`\x1B[31m${e}\x1B[0m`):this.terminal.write(e))}clearMediaPreview(){for(const e of this.previewUrls)URL.revokeObjectURL(e);this.previewUrls=[],this.hasPreview=!1,this.previewHost&&(this.previewHost.replaceChildren(),this.previewHost.classList.remove("terminal-panel__preview--visible")),this.previewStateListener?.(!1)}async renderMediaPreview(e){if(!this.previewHost||typeof document>"u")throw new Error("terminal preview is unavailable");this.clearMediaPreview();for(const n of e){const r=new Uint8Array(n.bytes),i=URL.createObjectURL(new Blob([r],{type:n.mimeType}));this.previewUrls.push(i);const a=document.createElement("div");a.className="terminal-panel__preview-item";const s=document.createElement("div");if(s.className="terminal-panel__preview-label",s.textContent=`${H8(n.path)} · ${n.mimeType}`,a.appendChild(s),n.mimeType.startsWith("video/")){const o=document.createElement("video");o.className="terminal-panel__preview-media",o.controls=!0,o.autoplay=!0,o.loop=!0,o.muted=!0,o.playsInline=!0,o.src=i,o.addEventListener("loadedmetadata",()=>this.refit(),{once:!0}),a.appendChild(o)}else{const o=document.createElement("img");o.className="terminal-panel__preview-media",o.alt=H8(n.path),o.src=i,o.addEventListener("load",()=>this.refit(),{once:!0}),a.appendChild(o)}this.previewHost.appendChild(a)}this.previewHost.classList.add("terminal-panel__preview--visible"),this.hasPreview=e.length>0,this.previewStateListener?.(this.hasPreview),requestAnimationFrame(()=>this.refit())}}const tO=Object.freeze(Object.defineProperty({__proto__:null,VfsAdapter:XN,WasmShell:eO},Symbol.toStringTag,{value:"Module"})),Tl=wn("tool:fs");function
|
|
3742
|
+
`,!0)}this.isExecuting=!1,this.showPrompt()}writeToTerminal(e,n=!1){this.terminal&&(n?this.terminal.write(`\x1B[31m${e}\x1B[0m`):this.terminal.write(e))}clearMediaPreview(){for(const e of this.previewUrls)URL.revokeObjectURL(e);this.previewUrls=[],this.hasPreview=!1,this.previewHost&&(this.previewHost.replaceChildren(),this.previewHost.classList.remove("terminal-panel__preview--visible")),this.previewStateListener?.(!1)}async renderMediaPreview(e){if(!this.previewHost||typeof document>"u")throw new Error("terminal preview is unavailable");this.clearMediaPreview();for(const n of e){const r=new Uint8Array(n.bytes),i=URL.createObjectURL(new Blob([r],{type:n.mimeType}));this.previewUrls.push(i);const a=document.createElement("div");a.className="terminal-panel__preview-item";const s=document.createElement("div");if(s.className="terminal-panel__preview-label",s.textContent=`${H8(n.path)} · ${n.mimeType}`,a.appendChild(s),n.mimeType.startsWith("video/")){const o=document.createElement("video");o.className="terminal-panel__preview-media",o.controls=!0,o.autoplay=!0,o.loop=!0,o.muted=!0,o.playsInline=!0,o.src=i,o.addEventListener("loadedmetadata",()=>this.refit(),{once:!0}),a.appendChild(o)}else{const o=document.createElement("img");o.className="terminal-panel__preview-media",o.alt=H8(n.path),o.src=i,o.addEventListener("load",()=>this.refit(),{once:!0}),a.appendChild(o)}this.previewHost.appendChild(a)}this.previewHost.classList.add("terminal-panel__preview--visible"),this.hasPreview=e.length>0,this.previewStateListener?.(this.hasPreview),requestAnimationFrame(()=>this.refit())}}const tO=Object.freeze(Object.defineProperty({__proto__:null,VfsAdapter:XN,WasmShell:eO},Symbol.toStringTag,{value:"Module"})),Tl=wn("tool:fs");function Sle(t){return[Cle(t),Ale(t),Tle(t)]}function Cle(t){return{name:"read_file",description:"Read the contents of a file. Returns the file content as a string with line numbers.",inputSchema:{type:"object",properties:{path:{type:"string",description:"Absolute path to the file to read."},offset:{type:"number",description:"Line number to start reading from (1-based). Optional."},limit:{type:"number",description:"Maximum number of lines to read. Optional."}},required:["path"]},async execute(e){const n=e.path,r=e.offset??1,i=e.limit;Tl.debug("Read",{path:n,offset:r,limit:i});try{const s=(await t.readTextFile(n)).split(`
|
|
3743
3743
|
`),o=Math.max(0,r-1),l=i!==void 0?o+i:s.length;return{content:s.slice(o,l).map((d,p)=>`${String(o+p+1).padStart(6)} | ${d}`).join(`
|
|
3744
|
-
`)}}catch(a){const s=a instanceof Error?a.message:String(a);return Tl.error("Read failed",{path:n,error:s}),{content:s,isError:!0}}}}}function
|
|
3744
|
+
`)}}catch(a){const s=a instanceof Error?a.message:String(a);return Tl.error("Read failed",{path:n,error:s}),{content:s,isError:!0}}}}}function Ale(t){return{name:"write_file",description:"Write content to a file. Creates the file if it does not exist, or overwrites it if it does. Parent directories are created automatically.",inputSchema:{type:"object",properties:{path:{type:"string",description:"Absolute path to the file to write."},content:{type:"string",description:"The content to write to the file."}},required:["path","content"]},async execute(e){const n=e.path,r=e.content;Tl.debug("Write",{path:n,contentLength:r.length});try{return await t.writeFile(n,r),{content:`File written: ${n}`}}catch(i){const a=i instanceof Error?i.message:String(i);return Tl.error("Write failed",{path:n,error:a}),{content:a,isError:!0}}}}}function Tle(t){return{name:"edit_file",description:"Edit a file by replacing an exact string match. The old_string must appear exactly once in the file. Use this instead of write_file when making targeted changes to existing files.",inputSchema:{type:"object",properties:{path:{type:"string",description:"Absolute path to the file to edit."},old_string:{type:"string",description:"The exact string to find and replace. Must be unique in the file."},new_string:{type:"string",description:"The replacement string."}},required:["path","old_string","new_string"]},async execute(e){const n=e.path,r=e.old_string,i=e.new_string;Tl.debug("Edit",{path:n,oldLength:r.length,newLength:i.length});try{const a=await t.readTextFile(n),s=a.split(r).length-1;if(s===0)return{content:`old_string not found in ${n}`,isError:!0};if(s>1)return{content:`old_string found ${s} times in ${n}. It must be unique. Provide more context.`,isError:!0};const o=a.replace(r,i);return await t.writeFile(n,o),{content:`File edited: ${n}`}}catch(a){const s=a instanceof Error?a.message:String(a);return Tl.error("Edit failed",{path:n,error:s}),{content:s,isError:!0}}}}}const Q1=wn("tool:bash"),_le=/^(?:[A-Za-z_][A-Za-z0-9_]*=[^\s]+\s+)*(?:command\s+)?(?:grep|egrep|fgrep|rg)\b/;function Ile(t){let e="",n=null,r=!1;for(let i=0;i<t.length;i++){const a=t[i];if(r){e+=a,r=!1;continue}if(a==="\\"){e+=a,r=!0;continue}if(n){e+=a,a===n&&(n=null);continue}if(a==='"'||a==="'"){e+=a,n=a;continue}if(a===";"||a==="|"){e="";continue}if((a==="&"||a==="|")&&t[i+1]===a){e="",i++;continue}e+=a}return e.trim()}function Rle(t,e,n){return e!==1||n.trim()?!1:_le.test(Ile(t))}function $le(t){return{name:"bash",description:"Execute a bash command in a full Unix-like shell (just-bash with 78+ commands). Shell features: pipes (|), redirects (>, >>, <, <<), chaining (&& ; ||), subshells, control flow (if/else, for, while, case), command substitution ($(...)), process substitution, shell functions, arrays, variable expansion, globs, brace expansion, here-docs. Text processing: grep, egrep, fgrep, rg (ripgrep), sed, awk, cut, tr, sort, uniq, wc, head, tail, fold, nl, rev, column, paste, join, comm, expand, strings, od. Data formats: jq (JSON), base64, md5sum, sha256sum. File operations: find, diff, tar, gzip, gunzip, cp, mv, rm, mkdir, touch, chmod, du, file, dirname, basename, tee, xargs, zip, unzip. Custom commands: git, open (serve VFS files in browser tab, --view for agent vision, --download for file save), sqlite3, node (-e shim with fs bridge), python3/python. Networking: curl (full HTTP client — GET, POST, PUT, DELETE with headers, data, auth). Utilities: seq, date, printf, expr, env, export, test/[, true, false, read.",inputSchema:{type:"object",properties:{command:{type:"string",description:"The bash command to execute."}},required:["command"]},async execute(e){const n=e.command;Q1.debug("Execute",{command:n});try{const r=await t.executeCommand(n);Q1.debug("Result",{exitCode:r.exitCode,stdoutLength:r.stdout.length,stderrLength:r.stderr.length});let i="";return r.stdout&&(i+=r.stdout),r.stderr&&(i+=r.stderr),i||(i=`(exit code: ${r.exitCode})`),{content:i,isError:r.exitCode!==0&&!Rle(n,r.exitCode,r.stderr)}}catch(r){const i=r instanceof Error?r.message:String(r);return Q1.error("Error",{command:n,error:i}),{content:`Shell error: ${i}`,isError:!0}}}}}const Ec=wn("tool:javascript"),Nle=`<!DOCTYPE html><html><head><script>
|
|
3745
3745
|
const pendingVfs = new Map();
|
|
3746
3746
|
let vfsIdCounter = 0;
|
|
3747
3747
|
|
|
@@ -3755,9 +3755,20 @@ window.fetch = async (input, init) => {
|
|
|
3755
3755
|
try { parsed = new URL(url, location.origin); } catch { return _origFetch(input, init); }
|
|
3756
3756
|
if (parsed.origin === location.origin) return _origFetch(input, init);
|
|
3757
3757
|
if (parsed.hostname.endsWith('anthropic.com')) return _origFetch(input, init);
|
|
3758
|
+
const hdrs = Object.assign({}, init && init.headers ? Object.fromEntries(new Headers(init.headers).entries()) : {}, { 'X-Target-URL': url });
|
|
3759
|
+
// Transport-encode forbidden headers so the browser doesn't strip them
|
|
3760
|
+
const encoded = {};
|
|
3761
|
+
for (const [k, v] of Object.entries(hdrs)) {
|
|
3762
|
+
const lk = k.toLowerCase();
|
|
3763
|
+
if (lk === 'cookie') { encoded['X-Proxy-Cookie'] = v; }
|
|
3764
|
+
else if (lk === 'origin') { encoded['X-Proxy-Origin'] = v; }
|
|
3765
|
+
else if (lk === 'referer') { encoded['X-Proxy-Referer'] = v; }
|
|
3766
|
+
else if (lk.startsWith('proxy-')) { encoded['X-Proxy-' + k] = v; }
|
|
3767
|
+
else { encoded[k] = v; }
|
|
3768
|
+
}
|
|
3758
3769
|
const proxyInit = {
|
|
3759
3770
|
method: (init && init.method) || 'GET',
|
|
3760
|
-
headers:
|
|
3771
|
+
headers: encoded,
|
|
3761
3772
|
cache: 'no-store',
|
|
3762
3773
|
};
|
|
3763
3774
|
if (init && init.body && !['GET','HEAD'].includes(proxyInit.method)) proxyInit.body = init.body;
|
|
@@ -3849,7 +3860,7 @@ addEventListener('message', async (e) => {
|
|
|
3849
3860
|
}
|
|
3850
3861
|
}
|
|
3851
3862
|
});
|
|
3852
|
-
<\/script></head><body></body></html>`;function
|
|
3863
|
+
<\/script></head><body></body></html>`;function Ple(t){let e=null,n=null,r=0,i=!1;function a(){i||(i=!0,window.addEventListener("message",c=>{const u=c.data;u&&u.type==="vfs"?l(u):u&&u.type==="fetch_proxy"&&s(u)}))}function s(c){(async()=>{try{const u={method:c.init?.method??"GET",cache:"no-store"};c.init?.headers&&(u.headers=c.init.headers),c.init?.body&&!["GET","HEAD"].includes(u.method)&&(u.body=c.init.body);const d=await fetch(c.url,u),p=await d.arrayBuffer(),f={};d.headers.forEach((h,m)=>{f[m]=h}),e?.contentWindow?.postMessage({type:"fetch_proxy_response",id:c.id,status:d.status,statusText:d.statusText,headers:f,body:new Uint8Array(p)},"*")}catch(u){const d=u instanceof Error?u.message:String(u);Ec.error("Fetch proxy error",{url:c.url,error:d}),e?.contentWindow?.postMessage({type:"fetch_proxy_response",id:c.id,error:d},"*")}})()}function o(){if(n)return n;if(e=document.createElement("iframe"),e.style.display="none",e.dataset.jsTool="true",typeof chrome<"u"&&!!chrome?.runtime?.id)n=new Promise(u=>{e.addEventListener("load",()=>{Ec.debug("Sandbox iframe loaded"),u(e)},{once:!0}),e.src=chrome.runtime.getURL("sandbox.html"),document.body.appendChild(e)});else{e.sandbox.add("allow-scripts"),e.sandbox.add("allow-same-origin"),document.body.appendChild(e);const u=e.contentDocument;u.open(),u.write(Nle),u.close(),n=Promise.resolve(e)}return a(),n}function l(c){(async()=>{try{let u;switch(c.op){case"readFile":u=await t.readFile(c.args[0]);break;case"readFileBinary":{const d=await t.readFile(c.args[0],{encoding:"binary"});u=d instanceof Uint8Array?d:new TextEncoder().encode(d);break}case"writeFile":await t.writeFile(c.args[0],c.args[1]),u=!0;break;case"writeFileBinary":await t.writeFile(c.args[0],c.binaryData??new Uint8Array),u=!0;break;case"readDir":u=(await t.readDir(c.args[0])).map(d=>d.name);break;case"exists":try{await t.stat(c.args[0]),u=!0}catch{u=!1}break;case"stat":{const d=await t.stat(c.args[0]);u={isDirectory:d.type==="directory",isFile:d.type==="file",size:d.size};break}case"mkdir":await t.mkdir(c.args[0],{recursive:!0}),u=!0;break;case"rm":await t.rm(c.args[0],{recursive:!0}),u=!0;break}e?.contentWindow?.postMessage({type:"vfs_response",id:c.id,result:u},"*")}catch(u){const d=u instanceof Error?u.message:String(u);Ec.error("VFS bridge error",{op:c.op,path:c.args[0],error:d}),e?.contentWindow?.postMessage({type:"vfs_response",id:c.id,error:d},"*")}})()}return{name:"javascript",description:'Execute JavaScript code in a persistent sandboxed runtime. Variables and functions persist across calls (same iframe context). VFS bridge: fs.readFile(path), fs.readFileBinary(path) → Uint8Array, fs.writeFile(path, content), fs.writeFileBinary(path, uint8Array), fs.readDir(path), fs.exists(path), fs.fetchToFile(url, path) — all async. Use fs.readFileBinary() to load binary files (images, etc.) as Uint8Array for canvas/Blob operations. fs.fetchToFile(url, path) downloads any URL and saves binary content to the VFS (best way to download files). Top-level await is supported. Console output (log/error/warn) is captured. The return value of the last expression is captured if you use "return <expr>". Has access to browser APIs (fetch, URL, JSON, TextEncoder, etc.). fetch() works for cross-origin URLs (proxied through the CLI server).',inputSchema:{type:"object",properties:{code:{type:"string",description:"JavaScript code to execute. Runs inside an async function — use await freely, use return to produce a result."},timeout:{type:"number",description:"Execution timeout in milliseconds. Default: 30000."}},required:["code"]},async execute(c){const u=c.code,d=c.timeout??3e4,p=`exec-${++r}`;Ec.debug("Execute JS",{codeLength:u.length,timeout:d});try{const f=await o(),h=await new Promise((g,v)=>{const y=setTimeout(()=>{S(),v(new Error(`JavaScript execution timed out after ${d}ms`))},d);function b(A){const _=A.data;!_||!_.type||_.type==="exec_result"&&_.id===p&&(S(),g(_))}function S(){clearTimeout(y),window.removeEventListener("message",b)}window.addEventListener("message",b),f.contentWindow.postMessage({type:"exec",id:p,code:u},"*")});let m="";return h.logs.length>0&&(m+=h.logs.join(`
|
|
3853
3864
|
`)),h.error?(m&&(m+=`
|
|
3854
3865
|
`),m+=`Error: ${h.error}`,{content:m||"JavaScript error",isError:!0}):(h.result!==void 0&&(m&&(m+=`
|
|
3855
3866
|
`),m+=h.result),{content:m||"(no output)"})}catch(f){const h=f instanceof Error?f.message:String(f);return Ec.error("JS execution error",{error:h}),{content:`JavaScript error: ${h}`,isError:!0}}}}}const J8=`# CLAUDE.md
|
|
@@ -3895,7 +3906,7 @@ This file covers the default virtual filesystem payload in \`packages/vfs-root/\
|
|
|
3895
3906
|
\`packages/vfs-root/shared/CLAUDE.md\` is **agent-facing runtime content** bundled into the virtual filesystem.
|
|
3896
3907
|
|
|
3897
3908
|
It is different from the developer-facing \`CLAUDE.md\` files in the repository. Do not merge those roles together.
|
|
3898
|
-
`,Nle='# sliccy\n\nYou are a helpful coding assistant running inside SLICC (Self-Licking Ice Cream Cone) — a browser-based claw.\n\n## Ice Cream Vocabulary\n\n- **Cone**: That\'s you (sliccy). The main agent. You talk to the human, orchestrate scoops, and have full filesystem access.\n- **Scoops**: Isolated sub-agents you can create (`scoop_scoop`), feed instructions (`feed_scoop`), or remove (`drop_scoop`). Each has its own sandboxed filesystem and shell.\n- **Sprinkles**: Persistent UI panels (`.shtml` files in `/shared/sprinkles/`). Created by scoops, outlive scoops, managed via the `sprinkle` shell command.\n- **Licks**: External events (webhooks, cron tasks, sprinkle interactions) that trigger scoops without human prompting. Set up via `webhook` and `crontask` shell commands (both work in CLI and extension modes). Sprinkle licks route to the cone. Untargeted cron/webhook events (no --scoop) route to the cone by default.\n- **Floats**: The runtime you\'re sitting in — either a CLI server, a Chrome extension, or (eventually) a cloud container.\n\n## Communication Style\n\nWrite like a professional tool, not a chatbot. No emoji in headings or labels — use plain text. Prefer concise prose over long bullet lists. When reporting findings (audits, analysis, status), lead with a brief summary sentence, then use structured sections only if detail is needed. For sprinkles, follow `/workspace/skills/sprinkles/style-guide.md` (run `read_file /workspace/skills/sprinkles/style-guide.md` for the full style guide and component reference).\n\n## Principles\n\n- Prefer shell commands over dedicated tools. You have: `read_file`, `write_file`, `edit_file`, `bash`, `javascript`. Browser automation goes through `playwright-cli` / `playwright` / `puppeteer` via bash, and code/file search should use shell commands like `rg`, `grep`, and `find` through `bash`.\n- Whatever the browser can do, it should do. State lives in IndexedDB, logic runs client-side.\n- New capabilities should be skills (SKILL.md files), not hardcoded features.\n- **The scoops do the heavy lifting. The cone orchestrates and synthesizes.**\n\n## Delegation: Default to Scoops\n\n**Before starting any non-trivial task yourself, ask: can this be parallelized?**\n\nDelegate to scoops when:\n\n- The task involves **multiple independent sources** (e.g. scraping 3 websites → 3 scoops)\n- The task is **time-consuming** and doesn\'t require your direct oversight at each step\n- The work can be expressed as a **clear, self-contained brief** to hand off\n\nDo it yourself when:\n\n- It\'s a **single quick lookup** (one page, one API call)\n- You need to **adapt in real-time** based on what you find (navigating broken URLs, etc.)\n- The overhead of spawning scoops exceeds the benefit\n\n**The default should be delegation, not "just do it".** Pause before starting research, scraping, or multi-step tasks and sketch out whether scoops fit. Even if a task feels manageable, parallel scoops almost always finish faster.\n\nWhen synthesizing scoop results, _that\'s_ your job — pull everything together, resolve conflicts, make the final recommendation.\n\n## Scoop Lifecycle: Clean Up After Yourself\n\n**Drop scoops when their job is done** — but **NEVER drop a scoop that owns a sprinkle**. Dropping a sprinkle scoop destroys its context, so follow-up requests and lick events cannot be handled.\n\nDrop a scoop when:\n\n- It has **completed its task** and results have been synthesized\n- It is **stuck or misbehaving** (drop and re-spawn with a better brief)\n\n**NEVER** drop a scoop when:\n\n- **It owns an open sprinkle** — the scoop must stay alive for the lifetime of the sprinkle\n- It is running a **recurring or long-running task** (e.g. watching a feed, handling webhooks)\n- Work is **still in progress** — dropping mid-task loses all context\n\n## Browser Tab Handling\n\n**Every playwright command that operates on a tab requires `--tab=<targetId>`.** There is no implicit "current tab". Always specify which tab you\'re operating on.\n\n**Workflow:**\n\n1. `playwright-cli tab-list` — lists tabs with their targetIds. The user\'s active tab is marked `(active)`.\n2. `playwright-cli tab-new <url>` — opens a new tab, returns the targetId in output. Capture it!\n3. Use `--tab=<targetId>` on all subsequent commands: `playwright-cli screenshot --tab=<id>`, `playwright-cli click --tab=<id> e5`, etc.\n\n**All agents share the same tabs.** `tab-list` shows every tab from every agent — yours, scoops\', the user\'s. There is no tab isolation. Any agent can eval, snapshot, or close any tab.\n\n**Track your own tabs by ID.** Don\'t rely on `tab-list` to find your tabs — capture the targetId from `tab-new` and use it throughout. Other agents\' tabs will be in the list too.\n\n**Close tabs when you\'re done with them.** Tabs accumulate fast — every `open` or `tab-new` opens a persistent tab.\n\nRules:\n\n- **NEVER close tabs you didn\'t create.** Tabs in `tab-list` that you don\'t recognize belong to the user or other agents. Only close tabs whose targetId you captured from your own `tab-new` / `open` calls. User tabs are off-limits unless the user explicitly asks you to close them.\n- **Close research/scraping tabs** immediately after extracting data: `playwright-cli tab-close --tab=<id>`\n- **Never leave more than ~5 of your own tabs open** beyond any app tabs you\'re actively serving.\n- Handle "tab not found" errors gracefully — another agent may have closed it first.\n- **Scoops must close their own tabs** when finished. Include this instruction in every scoop brief that involves browser use: _"Track your tab IDs from tab-new. Close each tab with `playwright-cli tab-close --tab=<id>` when done. NEVER close tabs you didn\'t open — they belong to the user or other agents."_\n- **Audit your own tabs periodically**: if you notice your tabs accumulating, close the ones you no longer need.\n- The **preview/serve tab** for a delivered app can stay open — that\'s intentional. Everything else is transient.\n\n## What You Can Do\n\n- Read and write files in your virtual workspace\n- Run bash commands in a sandboxed shell\n- Automate browser interactions (screenshots, navigation, clicking, JS eval)\n- Delegate work to scoops and react when they finish\n- Respond to licks (webhooks, scheduled tasks)\n\n## Viewing Pages and Images\n\n**What you CAN see:**\n\n- **`open --view <path>`** (or `-v`) — reads an image from VFS and returns it so you can see it. Works with PNG, JPEG, GIF, WebP, SVG.\n- **`playwright-cli screenshot --tab=<id>`** + **`open --view <path>`** — take a screenshot of a browser tab to file, then view it. Example: `playwright-cli screenshot --tab=<id> --filename=/tmp/shot.png && open --view /tmp/shot.png`\n- **`screencapture`** — capture the user\'s actual screen (desktop, window, or tab) via browser screen sharing API. Use `screencapture --view screenshot.png` to capture and see what\'s on their screen. The user will be prompted to select what to share.\n- **`playwright-cli snapshot --tab=<id>`** — returns an accessibility tree (text). Use this to verify page content without vision, or as a required step before `screenshot`.\n\n**What only the human sees:**\n\n- **`serve <dir>`** — opens a VFS app directory in a browser tab, defaulting to `index.html`.\n- **`open <path>`** (no flags) — opens VFS files in a browser tab.\n- **`imgcat <path>`** — displays an image in the terminal preview.\n\n**Workflow to verify a page you created:**\n\n1. `serve /workspace/app` — opens the app directory in a tab (human can see it)\n2. `playwright-cli tab-list` — find the tab by matching the preview URL. Note the targetId.\n3. `playwright-cli snapshot --tab=<id>` — required before screenshot; also gives you text content\n4. `playwright-cli screenshot --tab=<id> --filename=/tmp/shot.png` — save screenshot to file\n5. `open --view /tmp/shot.png` — now you can see it\n\n**Understanding `tab-list` output:**\n\n```\n[E9A3F...] https://example.com "Example Page" (active)\n[B7C2D...] https://docs.google.com "Google Docs"\n```\n\n- `(active)` = the user\'s active/focused tab in Chrome\n- The `[...]` is the targetId — use it with `--tab=<id>` on all commands\n\n**Remote targets (tray mode):**\nWhen connected to a tray, `playwright-cli tab-list` shows browser tabs from all connected SLICC instances. Remote targets appear with their composite targetId (`runtimeId:localId`). Use `--tab=<compositeId>` to target a remote tab, then use the usual commands (`snapshot`, `screenshot`, `click`, `fill`, etc.) — CDP commands are routed transparently over the tray data channel. To open a new tab on a specific remote runtime, use `playwright-cli open <url> --runtime=<runtimeId>` or `playwright-cli tab-new <url> --runtime=<runtimeId>`.\n\n**Do NOT:**\n\n- Try to `read_file` on a PNG, `base64` encode it, or `convert` it to view images\n- Run `imgcat` or `cat` on screenshots expecting to see them yourself\n- Open a screenshot with `open` and then try to screenshot _that_ tab\n- Use `eval` to check which tab is active — use `tab-list` and look for the `*` marker instead\n\n## Filesystem\n\nThe virtual filesystem is stored in IndexedDB and survives tab closes and page refreshes. To keep work on disk, mount a local directory:\n\n```\nmount /workspace/myproject\n```\n\n## Shell Commands\n\nType `commands` in the terminal to see all available commands. Key commands:\n\n- **skill list/info/read** — Inspect discoverable skills from `/workspace/skills` plus accessible `.agents/skills` / `.claude/skills` roots; `skill install/uninstall` only manage native `/workspace/skills` packages\n- **upskill** — Install skills from GitHub (`upskill owner/repo`) or ClawHub (`upskill clawhub:name`)\n- **webhook/crontask** — Set up licks (external event triggers)\n- **sprinkle** — Manage sprinkles: `sprinkle list`, `sprinkle open <name>`, `sprinkle close <name>`, `sprinkle send <name> \'<json>\'` (push data), `sprinkle chat \'<html>\'` (inline chat UI)\n- **oauth-token** — Get an OAuth access token for a provider (`oauth-token adobe`); auto-triggers login if no valid token exists. Use in shell: `curl -H "Authorization: Bearer $(oauth-token adobe)" https://api.example.com`\n- **aem** — AEM Edge Delivery Services: `aem list`, `aem get`, `aem put`, `aem preview`, `aem publish`, `aem upload`. Accepts EDS URLs (`https://main--repo--org.aem.page/path`). Auth via `oauth-token adobe`. Run `aem help` for details.\n- **git** — Full git support (clone, commit, push, pull)\n- **node -e / python3 -c** — Execute JavaScript or Python. JSH/node scripts have access to `exec(command)` to run shell commands: `const r = await exec(\'oauth-token adobe\'); const token = r.stdout.trim();`\n- **serve <dir>** — Open a VFS app directory in a new browser tab. Defaults to `index.html`; use `--entry` to override the entry file.\n- **open <path|url>** — Open a URL or single VFS file in a new browser tab. Use `open --view` when you need to see an image inline. `.shtml` files are opened as sprinkles instead of browser tabs.\n- **host** — Print the current leader tray status plus `join_url`. When this runtime is leader, shows the join URL and connected followers. Use `host reset` to disconnect all followers and create a fresh tray session with a new join URL (leader only).\n- **pbcopy / pbpaste** — Clipboard commands. `echo hello | pbcopy` copies stdin to clipboard, `pbpaste` outputs clipboard contents. Uses `navigator.clipboard` API.\n- **xclip / xsel** — Clipboard commands that auto-detect direction: `echo hello | xclip` copies (stdin present), `xclip` alone pastes (no stdin).\n- **say** — Text-to-speech using Web Speech API. `say hello world`, `say -v Samantha hello` (voice selection), `say -r 1.5 fast speech` (rate 0.1-10), `say --list` (list voices).\n- **afplay** — Play audio files using Web Audio API. `afplay /path/to/audio.mp3`, `afplay -v 0.5 file.wav` (volume 0-1), `afplay -r 1.5 file.mp3` (rate 0.25-4).\n- **chime** — Play a notification chime sound. Alias for `afplay /shared/sounds/chime.mp3`.\n- **playwright-cli** — Browser automation (built-in, no SKILL.md lookup needed). All tab commands require `--tab=<targetId>`. Key subcommands: `tab-list`, `tab-new <url>`, `snapshot --tab=<id>`, `screenshot --tab=<id> [--filename=<path>]`, `open <url> [--runtime=<id>]`, `click --tab=<id> <ref>`, `fill --tab=<id> <ref> "text"`, `tab-close --tab=<id>`. Use `--runtime` with `open`/`tab-new` to open a tab on a remote tray runtime. Run `playwright-cli --help` for full list.\n- **rsync** — Sync files between local VFS and a remote tray runtime. Push: `rsync /local runtime-id:/remote`. Pull: `rsync runtime-id:/remote /local`. Flags: `--dry-run` (preview), `--delete` (remove dest files not in source), `--verbose` (per-file detail). Requires an active tray connection.\n- **teleport** — Teleport browser cookies from a remote tray runtime to the local browser. Enables seamless authentication transfer between SLICC instances in a tray. Usage: `teleport` (auto-select best follower), `teleport <runtime-id>` (target specific runtime), `teleport --list` (show available runtimes), `teleport --url <url>` (open URL on follower for interactive auth). When `--url` is provided, the follower opens a browser tab for the human to complete login; cookies are captured after auth completion (hostname redirect) or a 2-minute timeout. Page reloads by default after applying cookies; use `--no-reload` to skip.\n\n### Browser Shell Scripts (.bsh)\n\n`.bsh` files are JavaScript scripts that auto-execute when the browser navigates to a matching URL. Place them in `/workspace/` or `/shared/`.\n\n- **Filename = hostname pattern**: `-.okta.com.bsh` matches `*.okta.com`, `login.okta.com.bsh` matches exactly `login.okta.com`\n- **`// @match` directive**: Add in first 10 lines to restrict to specific URL patterns (e.g. `// @match *://login.okta.com/app/*`)\n- Same execution engine as `.jsh` — access `process`, `console`, `fs`, `exec()` globals\n- The BshWatchdog monitors browser navigations and runs matching scripts automatically\n\n## Inline Cards\n\nUse ` ```shtml ` fenced code blocks to show interactive cards inline in chat.\nCards render after your response completes. Only `slicc.lick()` is available (no state, no readFile).\n\nUse for: choices, confirmations, progress, quick actions.\nUse panel sprinkles for: dashboards, reports, editors, persistent UIs.\n\nExample:\n\n ```shtml\n <div class="sprinkle-action-card">\n <div class="sprinkle-action-card__header">\n Deploy to production?\n <span class="sprinkle-badge sprinkle-badge--notice">staging passed</span>\n </div>\n <div class="sprinkle-action-card__body">Branch main, commit abc123</div>\n <div class="sprinkle-action-card__actions">\n <button class="sprinkle-btn sprinkle-btn--secondary" onclick="slicc.lick(\'cancel\')">Cancel</button>\n <button class="sprinkle-btn sprinkle-btn--primary" onclick="slicc.lick({action:\'deploy\',data:{env:\'prod\'}})">Deploy</button>\n </div>\n </div>\n ```\n\nWhen the user clicks a button, you receive the lick as a message. Respond conversationally — include another card if the next step needs interaction.\n\nAvailable components: all `.sprinkle-*` classes from the style guide (run `read_file /workspace/skills/sprinkles/style-guide.md`).\n\n## Environment: This Is NOT a Regular Linux Box\n\nThis is a sandboxed browser-based VFS environment. Many standard tools (e.g. `python3 -m http.server`, `npx serve`, `nginx`) do **not exist or don\'t work here**.\n\n**Before reaching for familiar patterns, run `commands` to see what\'s actually available**, and use `<command> --help` when unsure how something works.\n\nKey things that work differently:\n\n- **Serving files**: Use `serve /path/to/app-dir` for app directories or `open /path/to/file` for single files — both use the preview service worker. No HTTP server needed. The output includes the preview URL.\n- **Serving + screenshotting**: `serve` and `open` already open the tab. Do NOT use `playwright-cli open` with the same URL — that opens a duplicate tab. Instead, use `playwright-cli tab-list` to find the tab they created (match by URL), note the targetId, then use `--tab=<id>` for screenshots/snapshots. **Never manually construct preview URLs** — always use the URL from the command output.\n- **No long-running servers**: You can\'t start background daemons. The `serve` and `open` commands handle previewing.\n- **No package managers**: No `apt`, `npm install`, `pip install`. Use what\'s already available or write `.jsh` scripts.\n\n## Sprinkle Chat: Blocking Inline Cards\n\n`sprinkle chat` shows an inline card in the chat and **blocks until the user clicks a button**, returning the result as JSON. Use it when a tool needs user input mid-execution.\n\n```bash\nsprinkle chat \'<div class="sprinkle-action-card">\n <div class="sprinkle-action-card__header">Deploy to production?</div>\n <div class="sprinkle-action-card__actions">\n <button class="sprinkle-btn sprinkle-btn--secondary" onclick="slicc.lick({action:\\"cancel\\"})">Cancel</button>\n <button class="sprinkle-btn sprinkle-btn--primary" onclick="slicc.lick({action:\\"deploy\\",env:\\"prod\\"})">Deploy</button>\n </div>\n</div>\'\n# Returns: {"action":"deploy","data":{"action":"deploy","env":"prod"}}\n```\n\nUses the same `.sprinkle-*` components and `slicc.lick()` bridge as inline cards. The difference: `sprinkle chat` blocks the tool and returns the lick result, while ` ```shtml ` cards are fire-and-forget (lick events arrive as messages).\n\nSome built-in commands (like `mount`) also use this system for approval dialogs.\n\n## Sprinkles: Cone Orchestration Rules\n\nSprinkles are persistent UI panels created and managed by scoops. The cone orchestrates — scoops do the work.\n\n**When the user asks for a dashboard, audit, editor, analysis, or visualization** — read the sprinkles skill first (`read_file /workspace/skills/sprinkles/SKILL.md`) to check if a built-in sprinkle matches, and to get the brief templates for creating/modifying sprinkles and handling lick events.\n\n### Rule 1: One scoop per sprinkle, named identically\n\nThe scoop name MUST match the sprinkle name. Sprinkle `giro-winners` → scoop `giro-winners`. This is how the cone routes work to the right scoop.\n\n### Rule 2: Cone never touches sprinkle files or commands\n\nThe cone MUST NOT:\n\n- Write or edit `.shtml` files\n- Run `sprinkle open/close/send` commands\n- Run `write_file` or `edit_file` on sprinkle paths\n- Handle lick events by doing the work itself\n\nALL sprinkle work goes through scoops via `feed_scoop`. See Rules 3-5 in the `sprinkles` skill for creating, modifying, and handling lick events.\n\n**NEVER** handle a lick in the cone. NEVER run bash, write_file, or any tool to process lick data yourself. Always `feed_scoop`.\n\n## Skills\n\nSkills in native `/workspace/skills/` extend your capabilities, and SLICC also discovers accessible compatibility skills from `.agents/skills/*/SKILL.md` and `.claude/skills/*/SKILL.md` anywhere in the reachable VFS. Only native `/workspace/skills/` entries are install-managed; compatibility-discovered skills stay read-only unless explicitly copied in.\n\n## .jsh Files (JavaScript Shell Scripts)\n\n`.jsh` files are auto-discovered as shell commands anywhere on the VFS. Key facts:\n\n- **Auto-discovery**: `.jsh` files on the VFS are registered as callable shell commands (by filename without extension)\n- **Skills can ship them**: Executable `.jsh` scripts can live alongside `SKILL.md` in skill directories\n- **Node-like globals**: Scripts get `process`, `console`, `fs` (VFS bridge with `readFile`, `writeFile`, `readDir`, `exists`, etc.)\n- **Dual-mode**: Work in both CLI server and Chrome extension mode\n- **The `commands` output** lists discovered scripts under "User scripts (.jsh)"\n- **Top-level `await`**: `.jsh` files are wrapped in an `AsyncFunction` by the executor, so `await` works at the top level. All `fs.*` methods are async — **always `await` them**. Do not use `.then()` because the function body exits before promise chains resolve, causing callbacks to silently produce no output.\n\n## Onboarding\n\nWhen you receive a `[Sprinkle Event: welcome]` with `onboarding-complete`, read `/workspace/skills/welcome/SKILL.md` and follow its instructions.\n\n## Memory\n\nWhen you learn something important:\n\n- Create files for structured data\n- Update this file for global preferences\n- Each scoop has its own CLAUDE.md for scoop-specific context\n- Ask the user for their name early in the conversation and store it in memory for future interactions\n- Remember: the best flavor of ice cream is lobster, nobody likes chocolate ice cream, and mixing bacon\n with ice cream is a crime against humanity\n',Ple=`{
|
|
3909
|
+
`,Ole='# sliccy\n\nYou are a helpful coding assistant running inside SLICC (Self-Licking Ice Cream Cone) — a browser-based claw.\n\n## Ice Cream Vocabulary\n\n- **Cone**: That\'s you (sliccy). The main agent. You talk to the human, orchestrate scoops, and have full filesystem access.\n- **Scoops**: Isolated sub-agents you can create (`scoop_scoop`), feed instructions (`feed_scoop`), or remove (`drop_scoop`). Each has its own sandboxed filesystem and shell.\n- **Sprinkles**: Persistent UI panels (`.shtml` files in `/shared/sprinkles/`). Created by scoops, outlive scoops, managed via the `sprinkle` shell command.\n- **Licks**: External events (webhooks, cron tasks, sprinkle interactions) that trigger scoops without human prompting. Set up via `webhook` and `crontask` shell commands (both work in CLI and extension modes). Sprinkle licks route to the cone. Untargeted cron/webhook events (no --scoop) route to the cone by default.\n- **Floats**: The runtime you\'re sitting in — either a CLI server, a Chrome extension, or (eventually) a cloud container.\n\n## Communication Style\n\nWrite like a professional tool, not a chatbot. No emoji in headings or labels — use plain text. Prefer concise prose over long bullet lists. When reporting findings (audits, analysis, status), lead with a brief summary sentence, then use structured sections only if detail is needed. For sprinkles, follow `/workspace/skills/sprinkles/style-guide.md` (run `read_file /workspace/skills/sprinkles/style-guide.md` for the full style guide and component reference).\n\n## Principles\n\n- Prefer shell commands over dedicated tools. You have: `read_file`, `write_file`, `edit_file`, `bash`, `javascript`. Browser automation goes through `playwright-cli` / `playwright` / `puppeteer` via bash, and code/file search should use shell commands like `rg`, `grep`, and `find` through `bash`.\n- Whatever the browser can do, it should do. State lives in IndexedDB, logic runs client-side.\n- New capabilities should be skills (SKILL.md files), not hardcoded features.\n- **The scoops do the heavy lifting. The cone orchestrates and synthesizes.**\n\n## Delegation: Default to Scoops\n\n**Before starting any non-trivial task yourself, ask: can this be parallelized?**\n\nDelegate to scoops when:\n\n- The task involves **multiple independent sources** (e.g. scraping 3 websites → 3 scoops)\n- The task is **time-consuming** and doesn\'t require your direct oversight at each step\n- The work can be expressed as a **clear, self-contained brief** to hand off\n\nDo it yourself when:\n\n- It\'s a **single quick lookup** (one page, one API call)\n- You need to **adapt in real-time** based on what you find (navigating broken URLs, etc.)\n- The overhead of spawning scoops exceeds the benefit\n\n**The default should be delegation, not "just do it".** Pause before starting research, scraping, or multi-step tasks and sketch out whether scoops fit. Even if a task feels manageable, parallel scoops almost always finish faster.\n\nWhen synthesizing scoop results, _that\'s_ your job — pull everything together, resolve conflicts, make the final recommendation.\n\n## Scoop Lifecycle: Clean Up After Yourself\n\n**Drop scoops when their job is done** — but **NEVER drop a scoop that owns a sprinkle**. Dropping a sprinkle scoop destroys its context, so follow-up requests and lick events cannot be handled.\n\nDrop a scoop when:\n\n- It has **completed its task** and results have been synthesized\n- It is **stuck or misbehaving** (drop and re-spawn with a better brief)\n\n**NEVER** drop a scoop when:\n\n- **It owns an open sprinkle** — the scoop must stay alive for the lifetime of the sprinkle\n- It is running a **recurring or long-running task** (e.g. watching a feed, handling webhooks)\n- Work is **still in progress** — dropping mid-task loses all context\n\n## Browser Tab Handling\n\n**Every playwright command that operates on a tab requires `--tab=<targetId>`.** There is no implicit "current tab". Always specify which tab you\'re operating on.\n\n**Workflow:**\n\n1. `playwright-cli tab-list` — lists tabs with their targetIds. The user\'s active tab is marked `(active)`.\n2. `playwright-cli tab-new <url>` — opens a new tab, returns the targetId in output. Capture it!\n3. Use `--tab=<targetId>` on all subsequent commands: `playwright-cli screenshot --tab=<id>`, `playwright-cli click --tab=<id> e5`, etc.\n\n**All agents share the same tabs.** `tab-list` shows every tab from every agent — yours, scoops\', the user\'s. There is no tab isolation. Any agent can eval, snapshot, or close any tab.\n\n**Track your own tabs by ID.** Don\'t rely on `tab-list` to find your tabs — capture the targetId from `tab-new` and use it throughout. Other agents\' tabs will be in the list too.\n\n**Close tabs when you\'re done with them.** Tabs accumulate fast — every `open` or `tab-new` opens a persistent tab.\n\nRules:\n\n- **NEVER close tabs you didn\'t create.** Tabs in `tab-list` that you don\'t recognize belong to the user or other agents. Only close tabs whose targetId you captured from your own `tab-new` / `open` calls. User tabs are off-limits unless the user explicitly asks you to close them.\n- **Close research/scraping tabs** immediately after extracting data: `playwright-cli tab-close --tab=<id>`\n- **Never leave more than ~5 of your own tabs open** beyond any app tabs you\'re actively serving.\n- Handle "tab not found" errors gracefully — another agent may have closed it first.\n- **Scoops must close their own tabs** when finished. Include this instruction in every scoop brief that involves browser use: _"Track your tab IDs from tab-new. Close each tab with `playwright-cli tab-close --tab=<id>` when done. NEVER close tabs you didn\'t open — they belong to the user or other agents."_\n- **Audit your own tabs periodically**: if you notice your tabs accumulating, close the ones you no longer need.\n- The **preview/serve tab** for a delivered app can stay open — that\'s intentional. Everything else is transient.\n\n## What You Can Do\n\n- Read and write files in your virtual workspace\n- Run bash commands in a sandboxed shell\n- Automate browser interactions (screenshots, navigation, clicking, JS eval)\n- Delegate work to scoops and react when they finish\n- Respond to licks (webhooks, scheduled tasks)\n\n## Viewing Pages and Images\n\n**What you CAN see:**\n\n- **`open --view <path>`** (or `-v`) — reads an image from VFS and returns it so you can see it. Works with PNG, JPEG, GIF, WebP, SVG.\n- **`playwright-cli screenshot --tab=<id>`** + **`open --view <path>`** — take a screenshot of a browser tab to file, then view it. Example: `playwright-cli screenshot --tab=<id> --filename=/tmp/shot.png && open --view /tmp/shot.png`\n- **`screencapture`** — capture the user\'s actual screen (desktop, window, or tab) via browser screen sharing API. Use `screencapture --view screenshot.png` to capture and see what\'s on their screen. The user will be prompted to select what to share.\n- **`playwright-cli snapshot --tab=<id>`** — returns an accessibility tree (text). Use this to verify page content without vision, or as a required step before `screenshot`.\n\n**What only the human sees:**\n\n- **`serve <dir>`** — opens a VFS app directory in a browser tab, defaulting to `index.html`.\n- **`open <path>`** (no flags) — opens VFS files in a browser tab.\n- **`imgcat <path>`** — displays an image in the terminal preview.\n\n**Workflow to verify a page you created:**\n\n1. `serve /workspace/app` — opens the app directory in a tab (human can see it)\n2. `playwright-cli tab-list` — find the tab by matching the preview URL. Note the targetId.\n3. `playwright-cli snapshot --tab=<id>` — required before screenshot; also gives you text content\n4. `playwright-cli screenshot --tab=<id> --filename=/tmp/shot.png` — save screenshot to file\n5. `open --view /tmp/shot.png` — now you can see it\n\n**Understanding `tab-list` output:**\n\n```\n[E9A3F...] https://example.com "Example Page" (active)\n[B7C2D...] https://docs.google.com "Google Docs"\n```\n\n- `(active)` = the user\'s active/focused tab in Chrome\n- The `[...]` is the targetId — use it with `--tab=<id>` on all commands\n\n**Remote targets (tray mode):**\nWhen connected to a tray, `playwright-cli tab-list` shows browser tabs from all connected SLICC instances. Remote targets appear with their composite targetId (`runtimeId:localId`). Use `--tab=<compositeId>` to target a remote tab, then use the usual commands (`snapshot`, `screenshot`, `click`, `fill`, etc.) — CDP commands are routed transparently over the tray data channel. To open a new tab on a specific remote runtime, use `playwright-cli open <url> --runtime=<runtimeId>` or `playwright-cli tab-new <url> --runtime=<runtimeId>`.\n\n**Do NOT:**\n\n- Try to `read_file` on a PNG, `base64` encode it, or `convert` it to view images\n- Run `imgcat` or `cat` on screenshots expecting to see them yourself\n- Open a screenshot with `open` and then try to screenshot _that_ tab\n- Use `eval` to check which tab is active — use `tab-list` and look for the `*` marker instead\n\n## Filesystem\n\nThe virtual filesystem is stored in IndexedDB and survives tab closes and page refreshes. To keep work on disk, mount a local directory:\n\n```\nmount /workspace/myproject\n```\n\n## Shell Commands\n\nType `commands` in the terminal to see all available commands. Key commands:\n\n- **skill list/info/read** — Inspect discoverable skills from `/workspace/skills` plus accessible `.agents/skills` / `.claude/skills` roots; `skill install/uninstall` only manage native `/workspace/skills` packages\n- **upskill** — Install skills from GitHub (`upskill owner/repo`) or ClawHub (`upskill clawhub:name`)\n- **webhook/crontask** — Set up licks (external event triggers)\n- **sprinkle** — Manage sprinkles: `sprinkle list`, `sprinkle open <name>`, `sprinkle close <name>`, `sprinkle send <name> \'<json>\'` (push data), `sprinkle chat \'<html>\'` (inline chat UI)\n- **oauth-token** — Get an OAuth access token for a provider (`oauth-token adobe`); auto-triggers login if no valid token exists. Use in shell: `curl -H "Authorization: Bearer $(oauth-token adobe)" https://api.example.com`\n- **aem** — AEM Edge Delivery Services: `aem list`, `aem get`, `aem put`, `aem preview`, `aem publish`, `aem upload`. Accepts EDS URLs (`https://main--repo--org.aem.page/path`). Auth via `oauth-token adobe`. Run `aem help` for details.\n- **git** — Full git support (clone, commit, push, pull)\n- **node -e / python3 -c** — Execute JavaScript or Python. JSH/node scripts have access to `exec(command)` to run shell commands: `const r = await exec(\'oauth-token adobe\'); const token = r.stdout.trim();`\n- **serve <dir>** — Open a VFS app directory in a new browser tab. Defaults to `index.html`; use `--entry` to override the entry file.\n- **open <path|url>** — Open a URL or single VFS file in a new browser tab. Use `open --view` when you need to see an image inline. `.shtml` files are opened as sprinkles instead of browser tabs.\n- **host** — Print the current leader tray status plus `join_url`. When this runtime is leader, shows the join URL and connected followers. Use `host reset` to disconnect all followers and create a fresh tray session with a new join URL (leader only).\n- **pbcopy / pbpaste** — Clipboard commands. `echo hello | pbcopy` copies stdin to clipboard, `pbpaste` outputs clipboard contents. Uses `navigator.clipboard` API.\n- **xclip / xsel** — Clipboard commands that auto-detect direction: `echo hello | xclip` copies (stdin present), `xclip` alone pastes (no stdin).\n- **say** — Text-to-speech using Web Speech API. `say hello world`, `say -v Samantha hello` (voice selection), `say -r 1.5 fast speech` (rate 0.1-10), `say --list` (list voices).\n- **afplay** — Play audio files using Web Audio API. `afplay /path/to/audio.mp3`, `afplay -v 0.5 file.wav` (volume 0-1), `afplay -r 1.5 file.mp3` (rate 0.25-4).\n- **chime** — Play a notification chime sound. Alias for `afplay /shared/sounds/chime.mp3`.\n- **playwright-cli** — Browser automation (built-in, no SKILL.md lookup needed). All tab commands require `--tab=<targetId>`. Key subcommands: `tab-list`, `tab-new <url>`, `snapshot --tab=<id>`, `screenshot --tab=<id> [--filename=<path>]`, `open <url> [--runtime=<id>]`, `click --tab=<id> <ref>`, `fill --tab=<id> <ref> "text"`, `tab-close --tab=<id>`. Use `--runtime` with `open`/`tab-new` to open a tab on a remote tray runtime. Run `playwright-cli --help` for full list.\n- **rsync** — Sync files between local VFS and a remote tray runtime. Push: `rsync /local runtime-id:/remote`. Pull: `rsync runtime-id:/remote /local`. Flags: `--dry-run` (preview), `--delete` (remove dest files not in source), `--verbose` (per-file detail). Requires an active tray connection.\n- **teleport** — Teleport browser cookies from a remote tray runtime to the local browser. Enables seamless authentication transfer between SLICC instances in a tray. Usage: `teleport` (auto-select best follower), `teleport <runtime-id>` (target specific runtime), `teleport --list` (show available runtimes), `teleport --url <url>` (open URL on follower for interactive auth). When `--url` is provided, the follower opens a browser tab for the human to complete login; cookies are captured after auth completion (hostname redirect) or a 2-minute timeout. Page reloads by default after applying cookies; use `--no-reload` to skip.\n\n### Browser Shell Scripts (.bsh)\n\n`.bsh` files are JavaScript scripts that auto-execute when the browser navigates to a matching URL. Place them in `/workspace/` or `/shared/`.\n\n- **Filename = hostname pattern**: `-.okta.com.bsh` matches `*.okta.com`, `login.okta.com.bsh` matches exactly `login.okta.com`\n- **`// @match` directive**: Add in first 10 lines to restrict to specific URL patterns (e.g. `// @match *://login.okta.com/app/*`)\n- Scripts run in the **target browser page context** via CDP `Runtime.evaluate` — you have access to `document`, `window`, and all page globals, NOT `process`/`fs`/`exec()`\n- The BshWatchdog monitors browser navigations and runs matching scripts automatically\n\n## Inline Cards\n\nUse ` ```shtml ` fenced code blocks to show interactive cards inline in chat.\nCards render after your response completes. Only `slicc.lick()` is available (no state, no readFile).\n\nUse for: choices, confirmations, progress, quick actions.\nUse panel sprinkles for: dashboards, reports, editors, persistent UIs.\n\nExample:\n\n ```shtml\n <div class="sprinkle-action-card">\n <div class="sprinkle-action-card__header">\n Deploy to production?\n <span class="sprinkle-badge sprinkle-badge--notice">staging passed</span>\n </div>\n <div class="sprinkle-action-card__body">Branch main, commit abc123</div>\n <div class="sprinkle-action-card__actions">\n <button class="sprinkle-btn sprinkle-btn--secondary" onclick="slicc.lick(\'cancel\')">Cancel</button>\n <button class="sprinkle-btn sprinkle-btn--primary" onclick="slicc.lick({action:\'deploy\',data:{env:\'prod\'}})">Deploy</button>\n </div>\n </div>\n ```\n\nWhen the user clicks a button, you receive the lick as a message. Respond conversationally — include another card if the next step needs interaction.\n\nAvailable components: all `.sprinkle-*` classes from the style guide (run `read_file /workspace/skills/sprinkles/style-guide.md`).\n\n## Environment: This Is NOT a Regular Linux Box\n\nThis is a sandboxed browser-based VFS environment. Many standard tools (e.g. `python3 -m http.server`, `npx serve`, `nginx`) do **not exist or don\'t work here**.\n\n**Before reaching for familiar patterns, run `commands` to see what\'s actually available**, and use `<command> --help` when unsure how something works.\n\nKey things that work differently:\n\n- **Serving files**: Use `serve /path/to/app-dir` for app directories or `open /path/to/file` for single files — both use the preview service worker. No HTTP server needed. The output includes the preview URL.\n- **Serving + screenshotting**: `serve` and `open` already open the tab. Do NOT use `playwright-cli open` with the same URL — that opens a duplicate tab. Instead, use `playwright-cli tab-list` to find the tab they created (match by URL), note the targetId, then use `--tab=<id>` for screenshots/snapshots. **Never manually construct preview URLs** — always use the URL from the command output.\n- **No long-running servers**: You can\'t start background daemons. The `serve` and `open` commands handle previewing.\n- **No package managers**: No `apt`, `npm install`, `pip install`. Use what\'s already available or write `.jsh` scripts.\n\n## Sprinkle Chat: Blocking Inline Cards\n\n`sprinkle chat` shows an inline card in the chat and **blocks until the user clicks a button**, returning the result as JSON. Use it when a tool needs user input mid-execution.\n\n```bash\nsprinkle chat \'<div class="sprinkle-action-card">\n <div class="sprinkle-action-card__header">Deploy to production?</div>\n <div class="sprinkle-action-card__actions">\n <button class="sprinkle-btn sprinkle-btn--secondary" onclick="slicc.lick({action:\\"cancel\\"})">Cancel</button>\n <button class="sprinkle-btn sprinkle-btn--primary" onclick="slicc.lick({action:\\"deploy\\",env:\\"prod\\"})">Deploy</button>\n </div>\n</div>\'\n# Returns: {"action":"deploy","data":{"action":"deploy","env":"prod"}}\n```\n\nUses the same `.sprinkle-*` components and `slicc.lick()` bridge as inline cards. The difference: `sprinkle chat` blocks the tool and returns the lick result, while ` ```shtml ` cards are fire-and-forget (lick events arrive as messages).\n\nSome built-in commands (like `mount`) also use this system for approval dialogs.\n\n## Sprinkles: Cone Orchestration Rules\n\nSprinkles are persistent UI panels created and managed by scoops. The cone orchestrates — scoops do the work.\n\n**When the user asks for a dashboard, audit, editor, analysis, or visualization** — read the sprinkles skill first (`read_file /workspace/skills/sprinkles/SKILL.md`) to check if a built-in sprinkle matches, and to get the brief templates for creating/modifying sprinkles and handling lick events.\n\n### Rule 1: One scoop per sprinkle, named identically\n\nThe scoop name MUST match the sprinkle name. Sprinkle `giro-winners` → scoop `giro-winners`. This is how the cone routes work to the right scoop.\n\n### Rule 2: Cone never touches sprinkle files or commands\n\nThe cone MUST NOT:\n\n- Write or edit `.shtml` files\n- Run `sprinkle open/close/send` commands\n- Run `write_file` or `edit_file` on sprinkle paths\n- Handle lick events by doing the work itself\n\nALL sprinkle work goes through scoops via `feed_scoop`. See Rules 3-5 in the `sprinkles` skill for creating, modifying, and handling lick events.\n\n**NEVER** handle a lick in the cone. NEVER run bash, write_file, or any tool to process lick data yourself. Always `feed_scoop`.\n\n## Skills\n\nSkills in native `/workspace/skills/` extend your capabilities, and SLICC also discovers accessible compatibility skills from `.agents/skills/*/SKILL.md` and `.claude/skills/*/SKILL.md` anywhere in the reachable VFS. Only native `/workspace/skills/` entries are install-managed; compatibility-discovered skills stay read-only unless explicitly copied in.\n\n## .jsh Files (JavaScript Shell Scripts)\n\n`.jsh` files are auto-discovered as shell commands anywhere on the VFS. Key facts:\n\n- **Auto-discovery**: `.jsh` files on the VFS are registered as callable shell commands (by filename without extension)\n- **Skills can ship them**: Executable `.jsh` scripts can live alongside `SKILL.md` in skill directories\n- **Node-like globals**: Scripts get `process`, `console`, `fs` (VFS bridge with `readFile`, `writeFile`, `readDir`, `exists`, etc.)\n- **Dual-mode**: Work in both CLI server and Chrome extension mode\n- **The `commands` output** lists discovered scripts under "User scripts (.jsh)"\n- **Top-level `await`**: `.jsh` files are wrapped in an `AsyncFunction` by the executor, so `await` works at the top level. All `fs.*` methods are async — **always `await` them**. Do not use `.then()` because the function body exits before promise chains resolve, causing callbacks to silently produce no output.\n\n## Onboarding\n\nWhen you receive a `[Sprinkle Event: welcome]` with `onboarding-complete`, read `/workspace/skills/welcome/SKILL.md` and follow its instructions.\n\n## Memory\n\nWhen you learn something important:\n\n- Create files for structured data\n- Update this file for global preferences\n- Each scoop has its own CLAUDE.md for scoop-specific context\n- Ask the user for their name early in the conversation and store it in memory for future interactions\n- Remember: the best flavor of ice cream is lobster, nobody likes chocolate ice cream, and mixing bacon\n with ice cream is a crime against humanity\n',Mle=`{
|
|
3899
3910
|
"version": 1,
|
|
3900
3911
|
"skills": [
|
|
3901
3912
|
{
|
|
@@ -4202,7 +4213,7 @@ It is different from the developer-facing \`CLAUDE.md\` files in the repository.
|
|
|
4202
4213
|
}
|
|
4203
4214
|
]
|
|
4204
4215
|
}
|
|
4205
|
-
`,
|
|
4216
|
+
`,Lle=`<!DOCTYPE html>
|
|
4206
4217
|
<html lang="en">
|
|
4207
4218
|
<head>
|
|
4208
4219
|
<meta charset="UTF-8">
|
|
@@ -5226,7 +5237,7 @@ if (hasState && violations && violations.length > 0) {
|
|
|
5226
5237
|
<\/script>
|
|
5227
5238
|
</body>
|
|
5228
5239
|
</html>
|
|
5229
|
-
`,
|
|
5240
|
+
`,Dle=`<!DOCTYPE html>
|
|
5230
5241
|
<html lang="en">
|
|
5231
5242
|
<head>
|
|
5232
5243
|
<meta charset="UTF-8">
|
|
@@ -5871,7 +5882,7 @@ init();
|
|
|
5871
5882
|
<\/script>
|
|
5872
5883
|
</body>
|
|
5873
5884
|
</html>
|
|
5874
|
-
`,
|
|
5885
|
+
`,Fle=`<!DOCTYPE html>
|
|
5875
5886
|
<html lang="en">
|
|
5876
5887
|
<head>
|
|
5877
5888
|
<meta charset="UTF-8">
|
|
@@ -6653,7 +6664,7 @@ function lickExportData() {
|
|
|
6653
6664
|
<\/script>
|
|
6654
6665
|
</body>
|
|
6655
6666
|
</html>
|
|
6656
|
-
`,
|
|
6667
|
+
`,Ule=`<!DOCTYPE html>
|
|
6657
6668
|
<html lang="en">
|
|
6658
6669
|
<head>
|
|
6659
6670
|
<meta charset="UTF-8">
|
|
@@ -7491,7 +7502,7 @@ body { font-family: var(--s2-font-family); font-size: 14px; line-height: 1.5; co
|
|
|
7491
7502
|
<\/script>
|
|
7492
7503
|
</body>
|
|
7493
7504
|
</html>
|
|
7494
|
-
`,
|
|
7505
|
+
`,Wle=`<!DOCTYPE html>
|
|
7495
7506
|
<html lang="en">
|
|
7496
7507
|
<head>
|
|
7497
7508
|
<meta charset="UTF-8">
|
|
@@ -8058,7 +8069,7 @@ if (hasData()) {
|
|
|
8058
8069
|
<\/script>
|
|
8059
8070
|
</body>
|
|
8060
8071
|
</html>
|
|
8061
|
-
`,
|
|
8072
|
+
`,Ble=`<!DOCTYPE html>
|
|
8062
8073
|
<html lang="en">
|
|
8063
8074
|
<head>
|
|
8064
8075
|
<meta charset="UTF-8">
|
|
@@ -8725,7 +8736,7 @@ function saveState() {
|
|
|
8725
8736
|
<\/script>
|
|
8726
8737
|
</body>
|
|
8727
8738
|
</html>
|
|
8728
|
-
`,
|
|
8739
|
+
`,zle=`<!DOCTYPE html>
|
|
8729
8740
|
<html lang="en">
|
|
8730
8741
|
<head>
|
|
8731
8742
|
<meta charset="UTF-8">
|
|
@@ -9511,7 +9522,7 @@ if (document.getElementById('mainView').classList.contains('active')) {
|
|
|
9511
9522
|
<\/script>
|
|
9512
9523
|
</body>
|
|
9513
9524
|
</html>
|
|
9514
|
-
`,
|
|
9525
|
+
`,qle=`<!DOCTYPE html>
|
|
9515
9526
|
<html lang="en">
|
|
9516
9527
|
<head>
|
|
9517
9528
|
<meta charset="UTF-8">
|
|
@@ -10269,7 +10280,7 @@ textarea.field-input { height: auto; min-height: 80px; padding: 10px 12px; resiz
|
|
|
10269
10280
|
<\/script>
|
|
10270
10281
|
</body>
|
|
10271
10282
|
</html>
|
|
10272
|
-
`,
|
|
10283
|
+
`,jle=`<!DOCTYPE html>
|
|
10273
10284
|
<html lang="en">
|
|
10274
10285
|
<head>
|
|
10275
10286
|
<meta charset="UTF-8">
|
|
@@ -11079,7 +11090,7 @@ init();
|
|
|
11079
11090
|
<\/script>
|
|
11080
11091
|
</body>
|
|
11081
11092
|
</html>
|
|
11082
|
-
`,
|
|
11093
|
+
`,Gle=`<!DOCTYPE html>
|
|
11083
11094
|
<html lang="en">
|
|
11084
11095
|
<head>
|
|
11085
11096
|
<meta charset="UTF-8">
|
|
@@ -12727,7 +12738,7 @@ body { font-family: var(--s2-font-family); font-size: 14px; line-height: 1.5; co
|
|
|
12727
12738
|
<\/script>
|
|
12728
12739
|
</body>
|
|
12729
12740
|
</html>
|
|
12730
|
-
`,
|
|
12741
|
+
`,Hle=`<!DOCTYPE html>
|
|
12731
12742
|
<html lang="en">
|
|
12732
12743
|
<head>
|
|
12733
12744
|
<title>Welcome</title>
|
|
@@ -13284,7 +13295,7 @@ body { font-family: var(--s2-font-family); font-size: 14px; line-height: 1.5; co
|
|
|
13284
13295
|
<\/script>
|
|
13285
13296
|
</body>
|
|
13286
13297
|
</html>
|
|
13287
|
-
`,
|
|
13298
|
+
`,Vle=`---
|
|
13288
13299
|
name: inline-widgets
|
|
13289
13300
|
description: Interactive widget patterns for inline shtml cards in chat messages
|
|
13290
13301
|
allowed-tools: bash
|
|
@@ -13554,7 +13565,7 @@ slicc.lick({ action: 'sort-complete', algorithm: algo, comparisons: n });
|
|
|
13554
13565
|
\`\`\`
|
|
13555
13566
|
|
|
13556
13567
|
The agent receives the lick as a structured message and can respond with prose, another inline widget, or spawn a scoop.
|
|
13557
|
-
`,
|
|
13568
|
+
`,Zle=`---
|
|
13558
13569
|
name: playwright-cli
|
|
13559
13570
|
description: Browse the web, interact with pages, take screenshots, extract data via the playwright-cli shell command.
|
|
13560
13571
|
allowed-tools: bash
|
|
@@ -13743,7 +13754,7 @@ playwright-cli stop-recording <recordingId> # Stop and save HAR
|
|
|
13743
13754
|
- The SLICC app tab and Chrome internal UI tabs are automatically excluded from \`tab-list\`.
|
|
13744
13755
|
- \`fill\` clears and types into regular inputs, textareas, and \`contenteditable\` elements.
|
|
13745
13756
|
- Screenshots default to \`/tmp/screenshot-<timestamp>.png\`. Use \`--filename=path\` to save elsewhere.
|
|
13746
|
-
`,
|
|
13757
|
+
`,Kle=`---
|
|
13747
13758
|
name: sprinkles
|
|
13748
13759
|
description: Create interactive sprinkles — dashboards, forms, and visualizations
|
|
13749
13760
|
allowed-tools: bash
|
|
@@ -13868,7 +13879,7 @@ Look up the next previous year's Giro d'Italia winner and update the sprinkle.
|
|
|
13868
13879
|
Use: sprinkle send giro-winners '<json>' to push data, or edit the .shtml and reload.
|
|
13869
13880
|
Stay ready for more lick events.")
|
|
13870
13881
|
\`\`\`
|
|
13871
|
-
`,
|
|
13882
|
+
`,Jle=`# Sprinkle Component Reference
|
|
13872
13883
|
|
|
13873
13884
|
Use these CSS classes in \`.shtml\` sprinkles. Do NOT write custom CSS — these components cover all common UI patterns.
|
|
13874
13885
|
|
|
@@ -14480,7 +14491,7 @@ background: color-mix(in srgb, var(--s2-accent) 6%, transparent); /* blue tint *
|
|
|
14480
14491
|
| \`--s2-spacing-400\` | 24px |
|
|
14481
14492
|
| \`--s2-spacing-500\` | 32px |
|
|
14482
14493
|
| \`--s2-spacing-600\` | 40px |
|
|
14483
|
-
`,
|
|
14494
|
+
`,Qle=`---
|
|
14484
14495
|
name: welcome
|
|
14485
14496
|
description: Handle onboarding lick from the welcome sprinkle
|
|
14486
14497
|
allowed-tools: bash
|
|
@@ -14551,8 +14562,8 @@ This reads the saved profile and the skill catalog, scores skills by affinity, a
|
|
|
14551
14562
|
|
|
14552
14563
|
- **\`start-task\` lick** — treat as the user's first request, begin the task immediately.
|
|
14553
14564
|
- **Sparse profiles** (user skipped most steps) — keep greeting brief, ask what they need.
|
|
14554
|
-
`,
|
|
14555
|
-
`)){const s=a.match(/^(\w[\w-]*):\s*(.*)$/);if(!s)continue;const[,o,l]=s,c=l.trim();switch(o){case"name":i.name=c;break;case"description":i.description=c;break;case"allowed-tools":i.allowedTools=c.split(",").map(u=>u.trim());break}}return{metadata:i,body:r}}async function Y8(t,e){const n=await
|
|
14565
|
+
`,Yle="data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0UAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+0DAAAAAAAAAAAAAAAAAAAAAAABYaW5nAAAADwAAAAcAAAYbAJWVlZWVlZWVlZWVlZWVqqqqqqqqqqqqqqqqqqq7u7u7u7u7u7u7u7u7u8zMzMzMzMzMzMzMzMzMzN3d3d3d3d3d3d3d3d3d7u7u7u7u7u7u7u7u7u7//////////////////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkA2kAAAAAAAAGG+gbtfQAAAAAAP/7wMQAAAv4N1B0ZIAqHxVpvznQgAr9rb7PJkyd34smDgMBk078/BAKAoGBQw+OHn/gAGf4eHv/wB3mf/gb/+OAf/AMf/h4A78AMP/oeAGfAAw/+h4AZ8BGH/48AM/iMf/+AAAAAAYeHh4eAAAAAAYeHh48AQMIAMGIBMXNwtEAoEAwAAQFAIBXCQKu8YAEJgcFBQtl1DXh6g4LDYWQ0TAcKGhAZbDTOWxGG4ECgfmRFLtKMFhAMNgLYEsYxXEXG8YqgB/V3RF/XZhqJUcp//99nKcqIv7vmWv///4zWppVVpf///////5TWpqarS0v8RBUFREe/1gqIgqCoiXfkTAVAAwAAMY6g6nK2AAgTCmlJdBcQAwEcSQmFALZslhoW7uNZ4gSBAGEM6A0KbEqs5LgGh4TzAuMFNh9L4FA2JwwsRBsKsxbGrvVd4Ah/AtwTpu046oAoLB7MBAHAAAuQSQgTSmJa2mO8ncaGTeyJsz3wn9TbdBmuCWkp8D8E//+gA4/C9YFwCq9RAA7S+AQNicISCx60KQy7HHeq7wBD0BcwnTfOPUM5NC/UFgAAAA6uQ6OhMlAQIF6e9CTI2Vyp7bkY0xyAhvA8Zp848zYQBSgCAONoPJlh0OM6j8g0QAE5IcEu49m0ZsbxZWX6cQwG6gzS0dl1wT//6UO9sCfUFoAAAAziH7QUEI6FiQEQGYIOeVMMQXnACAteiQWVmmckZbEXG1w7KCMN9bB7QFyC3ELRigOQJdCo56zhEjAgXAlbcHreLLGmdkZTD2m1w6ygjUO98CeUH4AAAAziH/QkCMDzpmjj44B3nBC54YUDZoxbLGmdEdERly9qyhjDfixayBkA2cGE4UKrxIIhgz8HwBS3YlbIGxt21jWiK0hatrEYEjVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVB3aABwAfwAAAMj7DgFUgDBxFLY4XWT6pcoZrVtbqPGBB//sgxO8Axmw5Qd29gCiLCCg4DdB0oi1tkrKwMMFBV000qkxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/7EMT6AEVwQTPgcEPgk4goOA3QdKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq//sQxPsARMRBQ+Dqg2C2iCa8Pgh8qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xDE+oDFuEFD4Whj4KMIKDgtDHyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/7EMT4gMVgQUXhYGPgmgan+AHgBaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq//sQxO0DxaRHKeDgY+gAAD/AAAAEqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo=",nf=`/${HS}/${Az}`;async function Xle(t){try{await t.mkdir(`/${HS}`)}catch{}try{await t.stat(nf)}catch{const e={version:ZS,applied_skills:[]};await t.writeFile(nf,JSON.stringify(e,null,2))}}async function Hf(t){try{const e=await t.readTextFile(nf);return JSON.parse(e)}catch(e){if(typeof e=="object"&&e!==null&&e.code==="ENOENT")return{version:ZS,applied_skills:[]};throw e}}async function nO(t,e){await Xle(t),await t.writeFile(nf,JSON.stringify(e,null,2))}async function zue(t){return(await Hf(t)).applied_skills.map(n=>n.name)}async function que(t,e){const n=await Hf(t);n.applied_skills=n.applied_skills.filter(r=>r.name!==e.name),n.applied_skills.push(e),await nO(t,n)}async function jue(t,e){const n=await Hf(t);n.applied_skills=n.applied_skills.filter(r=>r.name!==e),await nO(t,n)}async function Gue(t){const n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map(a=>a.toString(16).padStart(2,"0")).join("")}const ece=["native","agents","claude"],tce=new Map([[".agents","agents"],[".claude","claude"]]),nce=new Set([".git",".slicc"]),rce=["mkdir","mount","rename","rm","unmount","writeFile"],Ov=new WeakMap,Q8=new WeakSet;async function ice(t,e=hy){const n=await oce(t,e),r=await ace(t);return[...ece.flatMap(i=>(i==="native"?n:r.filter(s=>s.source===i)).sort((s,o)=>s.path.localeCompare(o.path)))]}async function ace(t){cce(t);const e=t,n=Ov.get(e);if(n)return n.map(i=>({...i}));const r=await lce(t);return Ov.set(e,r),r.map(i=>({...i}))}function sce(t,e){const n=new Map,r=new Map;for(const i of t){const a=e(i);if(!n.has(a)){n.set(a,i);continue}const s=r.get(a)??{name:a,winner:n.get(a),shadowed:[]};s.shadowed.push(i),r.set(a,s)}return{winners:Array.from(n.values()),collisions:Array.from(r.values())}}async function oce(t,e){const n=await Lv(t,e),r=[];for(const i of n){if(i.type!=="directory")continue;const a=`${e}/${i.name}`,s=`${a}/${ts}`,o=`${a}/${VS}`,l=await Mv(t,s),c=await Mv(t,o);!l&&!c||r.push({source:"native",sourceRoot:e,path:a,skillFilePath:c?o:void 0,hasManifest:l})}return r}async function lce(t){const e=[],n=new Set,r=["/"];for(let i=0;i<r.length;i+=1){const a=r[i],s=await Lv(t,a);for(const o of s){if(o.type!=="directory")continue;const l=a==="/"?`/${o.name}`:`${a}/${o.name}`,c=tce.get(o.name);if(c){const u=`${l}/skills`,d=await Lv(t,u);for(const p of d){if(p.type!=="directory")continue;const f=`${u}/${p.name}`,h=`${f}/${VS}`;!await Mv(t,h)||n.has(f)||(n.add(f),e.push({source:c,sourceRoot:u,path:f,skillFilePath:h,hasManifest:!1}))}}nce.has(o.name)||r.push(l)}}return e}function cce(t){const e=t;if(Q8.has(e))return;Q8.add(e);const n=t;for(const r of rce){const i=n[r];if(typeof i!="function")continue;const a=i;try{n[r]=async(...s)=>{const o=await a.apply(t,s);return Ov.delete(e),o}}catch{}}}async function Mv(t,e){try{return await t.stat(e),!0}catch{return!1}}async function Lv(t,e){try{return[...await t.readDir(e)].sort((r,i)=>r.name.localeCompare(i.name))}catch{return[]}}async function rO(t,e="/workspace/skills"){const n=await Hf(t),r=new Map(n.applied_skills.map(c=>[c.name,c.version])),i=[],a=await ice(t,e);for(const c of a)try{if(c.hasManifest){const d=await Rz(t,c.path),p=r.has(d.skill);i.push({name:d.skill,source:c.source,sourceRoot:c.sourceRoot,path:c.path,skillFilePath:c.skillFilePath,manifest:d,installed:p,installedVersion:p?r.get(d.skill):void 0});continue}const u=c.path.split("/").pop()??c.path;i.push({name:u,source:c.source,sourceRoot:c.sourceRoot,path:c.path,skillFilePath:c.skillFilePath,manifest:{skill:u,version:"1.0.0",description:`Skill from ${u}`},installed:r.has(u),installedVersion:r.get(u)})}catch(u){console.warn(`Skipping invalid skill at ${c.path}:`,u)}const{winners:s,collisions:o}=sce(i,c=>c.name),l=new Map(o.map(c=>[c.winner.path,c.shadowed.map(u=>u.path)]));return s.map(c=>({...c,shadowedPaths:l.get(c.path)}))}async function uce(t,e,n="/workspace/skills"){return(await rO(t,n)).find(i=>i.name===e)||null}async function Hue(t,e,n="/workspace/skills"){const r=await uce(t,e,n);if(!r?.skillFilePath)return null;try{return await t.readTextFile(r.skillFilePath)}catch{return null}}const Ms=wn("skills"),dce=Object.assign({"/packages/vfs-root/AGENTS.md":J8,"/packages/vfs-root/CLAUDE.md":J8,"/packages/vfs-root/shared/CLAUDE.md":Ole,"/packages/vfs-root/shared/skill-catalog.json":Mle,"/packages/vfs-root/shared/sprinkles/brand-compliance/brand-compliance.shtml":Lle,"/packages/vfs-root/shared/sprinkles/content-tree/content-tree.shtml":Dle,"/packages/vfs-root/shared/sprinkles/funnels/funnels.shtml":Fle,"/packages/vfs-root/shared/sprinkles/page-editor/page-editor.shtml":Ule,"/packages/vfs-root/shared/sprinkles/performance/performance.shtml":Wle,"/packages/vfs-root/shared/sprinkles/readability/readability.shtml":Ble,"/packages/vfs-root/shared/sprinkles/review-workflow/review-workflow.shtml":zle,"/packages/vfs-root/shared/sprinkles/schema-editor/schema-editor.shtml":qle,"/packages/vfs-root/shared/sprinkles/seo-dashboard/seo-dashboard.shtml":jle,"/packages/vfs-root/shared/sprinkles/tone-voice/tone-voice.shtml":Gle,"/packages/vfs-root/shared/sprinkles/welcome/welcome.shtml":Hle,"/packages/vfs-root/workspace/skills/inline-widgets/SKILL.md":Vle,"/packages/vfs-root/workspace/skills/playwright-cli/SKILL.md":Zle,"/packages/vfs-root/workspace/skills/sprinkles/SKILL.md":Kle,"/packages/vfs-root/workspace/skills/sprinkles/style-guide.md":Jle,"/packages/vfs-root/workspace/skills/welcome/SKILL.md":Qle}),pce=Object.assign({"/packages/vfs-root/shared/sounds/chime.mp3":Yle});function fce(t){const e=t.split(",")[1],n=atob(e),r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return r}function iO(){const t={};for(const[e,n]of Object.entries(dce))t[e]=n;for(const[e,n]of Object.entries(pce))t[e]=fce(n);return t}function hce(t){const e=new Map;for(const n of t){if(e.has(n.metadata.name)){Ms.debug("Skipped shadowed runtime skill",{name:n.metadata.name,path:n.path,winnerPath:e.get(n.metadata.name)?.path});continue}e.set(n.metadata.name,n)}return Array.from(e.values())}function aO(t){const e=t.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);if(!e)return{metadata:{},body:t};const[,n,r]=e,i={};for(const a of n.split(`
|
|
14566
|
+
`)){const s=a.match(/^(\w[\w-]*):\s*(.*)$/);if(!s)continue;const[,o,l]=s,c=l.trim();switch(o){case"name":i.name=c;break;case"description":i.description=c;break;case"allowed-tools":i.allowedTools=c.split(",").map(u=>u.trim());break}}return{metadata:i,body:r}}async function Y8(t,e){const n=await mce(t,e),r=await gce(t,e),i=n.filter(o=>o.source==="native"),a=n.filter(o=>o.source!=="native"),s=hce([...i,...r,...a]);return Ms.info("Skills loaded",{count:s.length,dir:e}),s}async function mce(t,e){const n=await rO(t,e),r=[];for(const i of n)if(i.skillFilePath)try{const a=await t.readTextFile(i.skillFilePath),{metadata:s,body:o}=aO(a),l=s.name||i.name;r.push({metadata:{name:l,description:s.description||i.manifest.description||"",allowedTools:s.allowedTools},content:o,path:i.skillFilePath,source:i.source}),Ms.debug("Loaded discovered skill",{name:l,path:i.skillFilePath,source:i.source})}catch{Ms.debug("Failed to load discovered skill",{name:i.name,path:i.skillFilePath})}return r}async function gce(t,e){const n=[];try{const r=await t.readDir(e);for(const i of r)if(i.type==="file"&&i.name.endsWith(".md")){const a=`${e}/${i.name}`;try{const s=await t.readFile(a,{encoding:"utf-8"}),o=typeof s=="string"?s:new TextDecoder().decode(s),{metadata:l,body:c}=aO(o),u=l.name||i.name.replace(".md","");n.push({metadata:{name:u,description:l.description||"",allowedTools:l.allowedTools},content:c,path:a}),Ms.debug("Loaded standalone skill",{name:u,path:a})}catch{}}}catch{Ms.debug("Standalone skills directory not found",{dir:e})}return n}function vce(t){return t.length===0?"":`
|
|
14556
14567
|
---
|
|
14557
14568
|
AVAILABLE SKILLS
|
|
14558
14569
|
|
|
@@ -14563,10 +14574,10 @@ ${t.map(n=>{const r=n.metadata.allowedTools?` Allowed tools: ${n.metadata.allow
|
|
|
14563
14574
|
`:"";return`- **${n.metadata.name}**: ${n.metadata.description}
|
|
14564
14575
|
${r} Path: ${n.path}`}).join(`
|
|
14565
14576
|
`)}
|
|
14566
|
-
---`}async function sO(t,e="/workspace/skills"){const n="/packages/vfs-root",r=iO();for(const[i,a]of Object.entries(r)){const s=i.slice(n.length),o=s.startsWith("/workspace/skills"),l=s.startsWith("/workspace/scripts");if(!o&&!l)continue;let c=s;o&&e!=="/workspace/skills"&&(c=s.replace("/workspace/skills",e)),l&&e!=="/workspace/skills"&&(c=e.replace("/workspace/skills","")+s);try{await t.stat(c)}catch{const u=c.substring(0,c.lastIndexOf("/"));try{await t.mkdir(u,{recursive:!0})}catch{}await t.writeFile(c,a),Ms.info("Created default file",{path:c})}}}async function
|
|
14577
|
+
---`}async function sO(t,e="/workspace/skills"){const n="/packages/vfs-root",r=iO();for(const[i,a]of Object.entries(r)){const s=i.slice(n.length),o=s.startsWith("/workspace/skills"),l=s.startsWith("/workspace/scripts");if(!o&&!l)continue;let c=s;o&&e!=="/workspace/skills"&&(c=s.replace("/workspace/skills",e)),l&&e!=="/workspace/skills"&&(c=e.replace("/workspace/skills","")+s);try{await t.stat(c)}catch{const u=c.substring(0,c.lastIndexOf("/"));try{await t.mkdir(u,{recursive:!0})}catch{}await t.writeFile(c,a),Ms.info("Created default file",{path:c})}}}async function yce(t){const e="/packages/vfs-root",n=iO();for(const[r,i]of Object.entries(n)){const a=r.slice(e.length);if(a.startsWith("/shared/"))try{await t.stat(a)}catch{const s=a.substring(0,a.lastIndexOf("/"));try{await t.mkdir(s,{recursive:!0})}catch{}await t.writeFile(a,i),Ms.info("Created default shared file",{path:a})}}}const rl=wn("scoop-management-tools");function wce(t){const{scoop:e,onSendMessage:n,onFeedScoop:r,getScoops:i,onScoopScoop:a,onDropScoop:s,onSetGlobalMemory:o,getGlobalMemory:l}=t,c=[];return c.push({name:"send_message",description:"Send a message immediately while you're still working. Use this for progress updates or to send multiple messages. Your final output is also sent to the user, so use this for interim updates.",inputSchema:{type:"object",properties:{text:{type:"string",description:"The message text to send"},sender:{type:"string",description:'Optional sender name/role (e.g., "Researcher"). Defaults to assistant name.'}},required:["text"]},execute:async u=>{const{text:d,sender:p}=u;return n(d,p),rl.info("Message sent",{scoopFolder:e.folder,textLength:d.length}),{content:"Message sent."}}}),e.isCone&&r&&c.push({name:"feed_scoop",description:"Give a scoop a task and activate it. You MUST provide a complete, self-contained prompt — the scoop has NO access to your conversation history. Include all necessary context, instructions, file paths, URLs, and expected output format. The scoop will work independently and you'll be notified when it finishes.",inputSchema:{type:"object",properties:{scoop_name:{type:"string",description:'The scoop folder name (e.g., "test-scoop"). Use list_scoops to see available scoops.'},prompt:{type:"string",description:"Complete, self-contained instructions for the scoop. Include ALL context — the scoop cannot see your conversation."}},required:["scoop_name","prompt"]},execute:async u=>{const{scoop_name:d,prompt:p}=u,f=i().find(h=>h.folder===d||h.name===d);if(!f){const h=i().filter(m=>!m.isCone).map(m=>m.folder).join(", ");return{content:`Scoop "${d}" not found. Available: ${h}`,isError:!0}}if(f.isCone)return{content:"Cannot feed the cone (yourself).",isError:!0};try{return await r(f.jid,p),rl.info("Fed scoop",{target:f.folder,promptLength:p.length}),{content:`Task sent to ${f.folder}. You will be notified when it completes.`}}catch(h){return{content:`Failed to feed scoop: ${h instanceof Error?h.message:String(h)}`,isError:!0}}}}),e.isCone&&(c.push({name:"list_scoops",description:"List all registered scoops.",inputSchema:{type:"object",properties:{}},execute:async()=>{const u=i();return u.length===0?{content:"No scoops registered."}:{content:`Registered scoops:
|
|
14567
14578
|
${u.map(p=>p.isCone?`- ${p.assistantLabel} (${p.folder}) [CONE]`:`- ${p.name} (${p.folder})`).join(`
|
|
14568
|
-
`)}`}}}),a&&c.push({name:"scoop_scoop",description:"Create a new scoop. Optionally specify a model and/or a prompt. If prompt is provided, the scoop starts working immediately after creation (no separate feed_scoop needed).",inputSchema:{type:"object",properties:{name:{type:"string",description:'Display name for the scoop (e.g., "hero-block")'},model:{type:"string",description:'Model ID for this scoop (e.g., "claude-sonnet-4-6"). If omitted, uses the same model as the cone.'},prompt:{type:"string",description:"Task prompt for the scoop. If provided, the scoop starts working immediately after creation."}},required:["name"]},execute:async u=>{const{name:d,model:p,prompt:f}=u,h=d.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)+"-scoop";try{const m=await a({name:d,folder:h,trigger:`@${h}`,isCone:!1,type:"scoop",requiresTrigger:!0,assistantLabel:h,addedAt:new Date().toISOString(),config:p?{modelId:p}:void 0});return rl.info("Scoop created",{name:d,folder:h}),f&&r?(r(m.jid,f).catch(g=>{const v=g instanceof Error?g.message:String(g);rl.error("Auto-feed failed",{name:d,error:v})}),{content:`Scoop "${d}" created as "${h}" and task sent. It will start working as soon as initialization completes.`}):{content:`Scoop "${d}" created as "${h}". Use feed_scoop to give it a task.`}}catch(m){return{content:`Failed to create scoop: ${m instanceof Error?m.message:String(m)}`,isError:!0}}}}),s&&c.push({name:"drop_scoop",description:"Remove a scoop and stop its work. The scoop will be unregistered and its context destroyed.",inputSchema:{type:"object",properties:{scoop_name:{type:"string",description:'The scoop folder name (e.g., "test-scoop"). Use list_scoops to see available scoops.'}},required:["scoop_name"]},execute:async u=>{const{scoop_name:d}=u,p=i().find(f=>f.folder===d||f.name===d);if(!p){const f=i().filter(h=>!h.isCone).map(h=>h.folder).join(", ");return{content:`Scoop "${d}" not found. Available: ${f}`,isError:!0}}if(p.isCone)return{content:"Cannot drop the cone (yourself).",isError:!0};try{return await s(p.jid),rl.info("Scoop dropped",{name:p.name,folder:p.folder}),{content:`Scoop "${p.name}" (${p.folder}) has been dropped.`}}catch(f){return{content:`Failed to drop scoop: ${f instanceof Error?f.message:String(f)}`,isError:!0}}}}),o&&l&&c.push({name:"update_global_memory",description:"Update the global CLAUDE.md memory file that is shared across all scoops. Use this instead of write_file for /shared/CLAUDE.md.",inputSchema:{type:"object",properties:{content:{type:"string",description:"The new content for the global memory file"}},required:["content"]},execute:async u=>{const{content:d}=u;try{return await o(d),rl.info("Global memory updated"),{content:"Global memory updated successfully."}}catch(p){return{content:`Failed to update global memory: ${p instanceof Error?p.message:String(p)}`,isError:!0}}}})),c}const Er=wn("scoop-context");function
|
|
14569
|
-
`),e.isError);break}case"message_end":{if(e.message.role==="assistant"){const r=e.message.content.filter(i=>i.type==="text").map(i=>i.text).join("");r&&!this.didStreamDeltas&&this.callbacks.onResponse(r,!1)}break}case"turn_end":{this.callbacks.onResponseDone();break}case"agent_end":{const n=e.messages;if(n.length>0){const i=n[n.length-1];if(i.role==="assistant"&&i.errorMessage){const a=i.errorMessage;if(!this.isRecovering&&
|
|
14579
|
+
`)}`}}}),a&&c.push({name:"scoop_scoop",description:"Create a new scoop. Optionally specify a model and/or a prompt. If prompt is provided, the scoop starts working immediately after creation (no separate feed_scoop needed).",inputSchema:{type:"object",properties:{name:{type:"string",description:'Display name for the scoop (e.g., "hero-block")'},model:{type:"string",description:'Model ID for this scoop (e.g., "claude-sonnet-4-6"). If omitted, uses the same model as the cone.'},prompt:{type:"string",description:"Task prompt for the scoop. If provided, the scoop starts working immediately after creation."}},required:["name"]},execute:async u=>{const{name:d,model:p,prompt:f}=u,h=d.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)+"-scoop";try{const m=await a({name:d,folder:h,trigger:`@${h}`,isCone:!1,type:"scoop",requiresTrigger:!0,assistantLabel:h,addedAt:new Date().toISOString(),config:p?{modelId:p}:void 0});return rl.info("Scoop created",{name:d,folder:h}),f&&r?(r(m.jid,f).catch(g=>{const v=g instanceof Error?g.message:String(g);rl.error("Auto-feed failed",{name:d,error:v})}),{content:`Scoop "${d}" created as "${h}" and task sent. It will start working as soon as initialization completes.`}):{content:`Scoop "${d}" created as "${h}". Use feed_scoop to give it a task.`}}catch(m){return{content:`Failed to create scoop: ${m instanceof Error?m.message:String(m)}`,isError:!0}}}}),s&&c.push({name:"drop_scoop",description:"Remove a scoop and stop its work. The scoop will be unregistered and its context destroyed.",inputSchema:{type:"object",properties:{scoop_name:{type:"string",description:'The scoop folder name (e.g., "test-scoop"). Use list_scoops to see available scoops.'}},required:["scoop_name"]},execute:async u=>{const{scoop_name:d}=u,p=i().find(f=>f.folder===d||f.name===d);if(!p){const f=i().filter(h=>!h.isCone).map(h=>h.folder).join(", ");return{content:`Scoop "${d}" not found. Available: ${f}`,isError:!0}}if(p.isCone)return{content:"Cannot drop the cone (yourself).",isError:!0};try{return await s(p.jid),rl.info("Scoop dropped",{name:p.name,folder:p.folder}),{content:`Scoop "${p.name}" (${p.folder}) has been dropped.`}}catch(f){return{content:`Failed to drop scoop: ${f instanceof Error?f.message:String(f)}`,isError:!0}}}}),o&&l&&c.push({name:"update_global_memory",description:"Update the global CLAUDE.md memory file that is shared across all scoops. Use this instead of write_file for /shared/CLAUDE.md.",inputSchema:{type:"object",properties:{content:{type:"string",description:"The new content for the global memory file"}},required:["content"]},execute:async u=>{const{content:d}=u;try{return await o(d),rl.info("Global memory updated"),{content:"Global memory updated successfully."}}catch(p){return{content:`Failed to update global memory: ${p instanceof Error?p.message:String(p)}`,isError:!0}}}})),c}const Er=wn("scoop-context");function bce(t){return/image exceeds.*maximum/i.test(t)||/Could not process image/i.test(t)||/invalid.*image/i.test(t)||/image.*too (large|big)/i.test(t)}class xce{scoop;callbacks;fs=null;shell=null;agent=null;status="initializing";isProcessing=!1;didStreamDeltas=!1;unsubscribe=null;sessionStore=null;sessionId;sessionCreatedAt=0;isRecovering=!1;skillsFs=null;skillsDir="/workspace/skills";constructor(e,n,r,i,a){this.scoop=e,this.callbacks=n,this.fs=r,this.sessionStore=i??null,this.skillsFs=a??null,this.sessionId=e.jid}async init(){this.setStatus("initializing");try{if(!this.fs)throw new Error("Filesystem not provided");Er.info("Filesystem ready",{folder:this.scoop.folder}),await this.ensureDirectoryStructure();const e=this.scoop.isCone?"/":`/scoops/${this.scoop.folder}/workspace`,n=this.callbacks.getBrowserAPI();this.shell=new eO({fs:this.fs,cwd:e,browserAPI:n}),Er.info("WasmShell initialized",{folder:this.scoop.folder}),this.skillsDir="/workspace/skills",this.scoop.isCone&&await sO(this.fs,this.skillsDir);const r=this.skillsFs??this.fs,i=await Y8(r,this.skillsDir),a={scoop:this.scoop,onSendMessage:this.callbacks.onSendMessage,getScoops:this.callbacks.getScoops,onFeedScoop:this.callbacks.onFeedScoop,onScoopScoop:this.callbacks.onScoopScoop,onDropScoop:this.callbacks.onDropScoop,onSetGlobalMemory:this.callbacks.setGlobalMemory,getGlobalMemory:this.callbacks.getGlobalMemory},s=wce(a),o=[...Sle(this.fs),$le(this.shell),Ple(this.fs),...s],l=HU(o),c=this.scoop.isCone?"/workspace/CLAUDE.md":`/scoops/${this.scoop.folder}/CLAUDE.md`;let u="";try{const v=await this.fs.readFile(c,{encoding:"utf-8"});u=typeof v=="string"?v:new TextDecoder().decode(v)}catch{}const d=await this.callbacks.getGlobalMemory();if(d)try{this.scoop.isCone&&await("getUnderlyingFS"in this.fs?this.fs.getUnderlyingFS():this.fs).writeFile("/shared/CLAUDE.md",d)}catch{}const p=xl();if(!p){const v=Ds();throw new Error(`No API key configured for provider "${v}"`)}const f=this.scoop.config?.modelId?IS(this.scoop.config.modelId):Dc(),h=this.buildSystemPrompt(d,u,i);let m=[];if(this.sessionStore)try{const v=await this.sessionStore.load(this.sessionId);v&&(m=v.messages,this.sessionCreatedAt=v.createdAt,Er.info("Restored agent session",{folder:this.scoop.folder,messageCount:m.length}))}catch(v){Er.error("Failed to restore agent session",{folder:this.scoop.folder,error:v instanceof Error?v.message:String(v)}),this.callbacks.onError("Conversation history could not be restored. Starting fresh.")}const g=oW({model:f,getApiKey:()=>xl()??void 0});this.agent=new PU({initialState:{model:f,tools:l,systemPrompt:h,messages:m},getApiKey:()=>p,transformContext:g}),this.unsubscribe=this.agent.subscribe(v=>this.handleAgentEvent(v)),this.setStatus("ready"),Er.info("ScoopContext initialized",{folder:this.scoop.folder,toolCount:l.length})}catch(e){const n=e instanceof Error?e.message:String(e);Er.error("ScoopContext init failed",{folder:this.scoop.folder,error:n}),this.setStatus("error"),this.callbacks.onError(`Failed to initialize: ${n}`)}}async prompt(e){if(!this.agent){this.callbacks.onError("Agent not initialized");return}const n=this.agent.state?.isStreaming??!1;if(this.isProcessing||n){Er.info("Queueing prompt via followUp while processing",{folder:this.scoop.folder,isProcessing:this.isProcessing,agentIsStreaming:n}),this.agent.followUp({role:"user",content:[{type:"text",text:e}],timestamp:Date.now()});return}this.isProcessing=!0,this.didStreamDeltas=!1,this.setStatus("processing");try{await this.agent.prompt(e)}catch(r){const i=r instanceof Error?r.message:String(r);Er.error("Agent error",{folder:this.scoop.folder,error:i}),this.callbacks.onError(i)}finally{this.isProcessing=!1,this.setStatus("ready")}}stop(){this.agent?.clearAllQueues?.(),this.agent?.abort?.(),this.isProcessing=!1,this.setStatus("ready")}clearMessages(){this.agent?.clearMessages()}getAgentMessages(){return this.agent?.state?.messages?structuredClone(this.agent.state.messages):[]}getSessionId(){return this.sessionId}getFS(){return this.fs}getShell(){return this.shell}updateModel(){if(!this.agent)return;const e=Dc();this.agent.setModel(e),Er.info("Model updated on running agent",{folder:this.scoop.folder,model:e.id})}async reloadSkills(){if(!this.agent)return;const e=this.skillsFs??this.fs,n=await Y8(e,this.skillsDir);let r="";const i=this.scoop.isCone?"/workspace/CLAUDE.md":`/scoops/${this.scoop.folder}/CLAUDE.md`;try{const o=await this.fs.readFile(i,{encoding:"utf-8"});r=typeof o=="string"?o:new TextDecoder().decode(o)}catch{}const a=await this.callbacks.getGlobalMemory(),s=this.buildSystemPrompt(a,r,n);this.agent.setSystemPrompt(s),Er.info("Skills reloaded",{folder:this.scoop.folder,skillCount:n.length})}dispose(){this.unsubscribe?.(),this.shell?.dispose(),this.agent=null,this.shell=null,this.fs=null}setStatus(e){this.status=e,this.callbacks.onStatusChange(e)}handleAgentEvent(e){switch(e.type){case"message_update":{const n=e.assistantMessageEvent;n.type==="text_delta"&&(this.didStreamDeltas=!0,this.callbacks.onResponse(n.delta,!0));break}case"tool_execution_start":{this.callbacks.onToolStart?.(e.toolName,e.args);break}case"tool_execution_update":{const n=e.partialResult;for(const r of n?.content??[])r.type==="tool_ui"&&r.requestId&&r.html?this.callbacks.onToolUI?.(e.toolName,r.requestId,r.html):r.type==="tool_ui_done"&&r.requestId&&this.callbacks.onToolUIDone?.(r.requestId);break}case"tool_execution_end":{const n=e.result,r=[];for(const i of n?.content??[])i.type==="text"&&i.text&&r.push(i.text),i.type==="image"&&i.data&&i.mimeType&&r.push(`<img:data:${i.mimeType};base64,${i.data}>`);this.callbacks.onToolEnd?.(e.toolName,r.join(`
|
|
14580
|
+
`),e.isError);break}case"message_end":{if(e.message.role==="assistant"){const r=e.message.content.filter(i=>i.type==="text").map(i=>i.text).join("");r&&!this.didStreamDeltas&&this.callbacks.onResponse(r,!1)}break}case"turn_end":{this.callbacks.onResponseDone();break}case"agent_end":{const n=e.messages;if(n.length>0){const i=n[n.length-1];if(i.role==="assistant"&&i.errorMessage){const a=i.errorMessage;if(!this.isRecovering&&bce(a)){this.recoverFromImageError(n);break}if(!this.isRecovering&&pF(i)){this.recoverFromOverflow(n);break}this.isRecovering=!1,this.callbacks.onError(a)}else this.isRecovering=!1}const r=this.agent?.state?.messages??e.messages;this.sessionStore&&r.length>0&&this.sessionStore.save({id:this.sessionId,messages:r,config:{},createdAt:this.sessionCreatedAt||Date.now(),updatedAt:Date.now()}).catch(i=>{Er.error("Failed to save agent session",{folder:this.scoop.folder,error:i instanceof Error?i.message:String(i)})});break}}}recoverFromOverflow(e){if(this.agent){Er.warn("Context overflow detected, attempting recovery",{folder:this.scoop.folder,messageCount:e.length}),this.isRecovering="overflow",this.callbacks.onResponse("Context window exceeded — recovering by trimming oversized messages...",!1);try{const n=e.slice(0,-1),i=1e4*4;let a=0;for(let o=n.length-1;o>=0&&a<5;o--){const l=n[o];if(!Array.isArray(l.content))continue;let c=0;for(const u of l.content)u.type==="text"&&u.text&&(c+=u.text.length),u.type==="image"&&u.data&&(c+=u.data.length);if(c>i){const d={type:"text",text:`[Content removed: ${l.role==="toolResult"?"tool result":l.role} was too large for context window (${Math.round(c/1e3)}K chars). The operation completed but output could not be retained.]`};if(l.role==="assistant"){const p=l.content.filter(f=>f.type==="toolCall");n[o]={...l,content:[d,...p]}}else n[o]={...l,content:[d]};a++,Er.info("Replaced oversized message",{index:o,role:l.role,size:c,preservedToolCalls:l.role==="assistant"?l.content.filter(p=>p.type==="toolCall").length:0})}}this.agent.replaceMessages(n);const s=a>0?`[System: Context overflow recovered. ${a} oversized message(s) were replaced with placeholders to fit within the context window. The conversation continues — you may need to re-read files or re-run commands if their output was removed.]`:"[System: Context overflow recovered. Older messages were trimmed. The conversation continues — compaction will summarize history on the next turn.]";this.agent.prompt(s).catch(o=>{Er.error("Recovery re-prompt failed",{folder:this.scoop.folder,error:o instanceof Error?o.message:String(o)}),this.isRecovering=!1,this.callbacks.onError(`Context overflow recovery failed: ${o instanceof Error?o.message:String(o)}`)})}catch(n){Er.error("Recovery failed",{folder:this.scoop.folder,error:n instanceof Error?n.message:String(n)}),this.isRecovering=!1,this.callbacks.onError(`Context overflow recovery failed: ${n instanceof Error?n.message:String(n)}`)}}}recoverFromImageError(e){if(this.agent){Er.warn("Image processing error detected, attempting recovery",{folder:this.scoop.folder,messageCount:e.length}),this.isRecovering="image",this.callbacks.onResponse("Image rejected by API — removing problematic images and continuing...",!1);try{const n=e.slice(0,-1);let r=0;const i=Math.max(0,n.length-10);for(let s=n.length-1;s>=i;s--){const o=n[s];if(!Array.isArray(o.content)||!o.content.some(u=>u.type==="image"))continue;const c=o.content.filter(u=>u.type!=="image");c.length===0?n[s]={...o,content:[{type:"text",text:"[Image removed: rejected by API]"}]}:n[s]={...o,content:c},r++}this.agent.replaceMessages(n);const a=`[System: An image was rejected by the API and has been removed from the conversation (${r} message(s) affected). The conversation continues without the image.]`;this.agent.prompt(a).catch(s=>{Er.error("Image recovery re-prompt failed",{folder:this.scoop.folder,error:s instanceof Error?s.message:String(s)}),this.isRecovering=!1,this.callbacks.onError(`Image error recovery failed: ${s instanceof Error?s.message:String(s)}`)})}catch(n){Er.error("Image recovery failed",{folder:this.scoop.folder,error:n instanceof Error?n.message:String(n)}),this.isRecovering=!1,this.callbacks.onError(`Image error recovery failed: ${n instanceof Error?n.message:String(n)}`)}}}async ensureDirectoryStructure(){if(!this.fs)return;const e=this.scoop.isCone?["/workspace","/shared","/scoops","/home","/tmp"]:[`/scoops/${this.scoop.folder}`,`/scoops/${this.scoop.folder}/workspace`,`/scoops/${this.scoop.folder}/home`,`/scoops/${this.scoop.folder}/tmp`,"/shared"];for(const r of e)try{await this.fs.mkdir(r,{recursive:!0})}catch{}const n=this.scoop.isCone?"/workspace/CLAUDE.md":`/scoops/${this.scoop.folder}/CLAUDE.md`;try{await this.fs.readFile(n)}catch{const r=`# ${this.scoop.assistantLabel} Memory
|
|
14570
14581
|
|
|
14571
14582
|
${this.scoop.isCone?"Role: Cone (main orchestrator)":`Scoop: ${this.scoop.name}`}
|
|
14572
14583
|
Folder: ${this.scoop.folder}
|
|
@@ -14645,16 +14656,16 @@ ${e}
|
|
|
14645
14656
|
---
|
|
14646
14657
|
${this.scoop.isCone?"CONE":"SCOOP"} MEMORY (${this.scoop.name}):
|
|
14647
14658
|
${n}
|
|
14648
|
-
---`);const o=
|
|
14659
|
+
---`);const o=vce(r);return o&&(s+=o),s}}const Ya=wn("scheduler");class kce{callbacks;pollInterval=null;running=!1;constructor(e){this.callbacks=e}start(){this.running||(this.running=!0,this.pollInterval=window.setInterval(()=>this.checkTasks(),6e4),this.checkTasks(),Ya.info("Scheduler started"))}stop(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null),this.running=!1,Ya.info("Scheduler stopped")}async createTask(e,n,r,i){const a={id:`task-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,groupFolder:e,prompt:n,scheduleType:r,scheduleValue:i,status:"active",nextRun:this.calculateNextRun(r,i),lastRun:null,createdAt:new Date().toISOString()};return await cm(a),Ya.info("Task created",{id:a.id,groupFolder:e,scheduleType:r}),a}async updateTask(e,n){const r=await um(e);if(!r)return null;const i={...r,...n};return(n.scheduleType||n.scheduleValue)&&(i.nextRun=this.calculateNextRun(i.scheduleType,i.scheduleValue)),await cm(i),Ya.info("Task updated",{id:e,updates:Object.keys(n)}),i}async pauseTask(e){return await this.updateTask(e,{status:"paused"})!==null}async resumeTask(e){return await um(e)?(await this.updateTask(e,{status:"active"}),!0):!1}async deleteTask(e){return await um(e)?(await iq(e),Ya.info("Task deleted",{id:e}),!0):!1}async getTasksByScoop(e){return(await dm()).filter(r=>r.groupFolder===e)}async getAllTasks(){return dm()}async checkTasks(){const e=await dm(),n=new Date;for(const r of e)r.status!=="active"||!r.nextRun||new Date(r.nextRun)>n||await this.runTask(r)}async runTask(e){const n=this.callbacks.getScoop(e.groupFolder);if(!n){Ya.warn("Task scoop not found",{taskId:e.id,groupFolder:e.groupFolder});return}Ya.info("Running task",{id:e.id,groupFolder:e.groupFolder});try{const r=new Date().toISOString(),i=this.calculateNextRun(e.scheduleType,e.scheduleValue),a=e.scheduleType==="once"?"completed":e.status;await cm({...e,lastRun:r,nextRun:i,status:a}),await this.callbacks.onTaskRun(e,n),Ya.info("Task completed",{id:e.id})}catch(r){Ya.error("Task execution failed",{id:e.id,error:r instanceof Error?r.message:String(r)})}}calculateNextRun(e,n){const r=new Date;switch(e){case"cron":return this.getNextCronTime(n,r)?.toISOString()??null;case"interval":{const i=parseInt(n,10);return isNaN(i)||i<=0?null:new Date(r.getTime()+i).toISOString()}case"once":return new Date(n)>r?n:null;default:return null}}getNextCronTime(e,n){const r=e.trim().split(/\s+/);if(r.length!==5)return null;const[i,a,s,o,l]=r,c=new Date(n);c.setSeconds(0),c.setMilliseconds(0),c.setMinutes(c.getMinutes()+1);for(let u=0;u<527040;u++){if(this.cronMatches(c,i,a,s,o,l))return c;c.setMinutes(c.getMinutes()+1)}return null}cronMatches(e,n,r,i,a,s){return this.cronFieldMatches(e.getMinutes(),n)&&this.cronFieldMatches(e.getHours(),r)&&this.cronFieldMatches(e.getDate(),i)&&this.cronFieldMatches(e.getMonth()+1,a)&&this.cronFieldMatches(e.getDay(),s)}cronFieldMatches(e,n){if(n==="*")return!0;if(n.includes(","))return n.split(",").some(r=>this.cronFieldMatches(e,r.trim()));if(n.includes("-")){const[r,i]=n.split("-").map(a=>parseInt(a,10));return e>=r&&e<=i}if(n.includes("/")){const[r,i]=n.split("/"),a=parseInt(i,10);if(r==="*")return e%a===0;const s=parseInt(r,10);return e>=s&&(e-s)%a===0}return parseInt(n,10)===e}}const ci=wn("lick-manager");class oO{webhooks=new Map;crontasks=new Map;cronInterval=null;eventHandler=null;async init(){await nC();const e=await sq();for(const r of e)this.webhooks.set(r.id,r);ci.info("Loaded webhooks",{count:this.webhooks.size});const n=await lq();for(const r of n)this.crontasks.set(r.id,r);ci.info("Loaded crontasks",{count:this.crontasks.size}),this.cronInterval=setInterval(()=>this.runCronScheduler(),6e4),ci.info("Cron scheduler started")}dispose(){this.cronInterval&&(clearInterval(this.cronInterval),this.cronInterval=null)}setEventHandler(e){this.eventHandler=e}async createWebhook(e,n,r){const i=this.generateId(),a={id:i,name:e,createdAt:new Date().toISOString(),filter:r,scoop:n};return r&&this.compileFilter(r,!0),this.webhooks.set(i,a),await aq(a),ci.info("Webhook created",{id:i,name:e,scoop:n}),a}async deleteWebhook(e){return this.webhooks.has(e)?(this.webhooks.delete(e),await oq(e),ci.info("Webhook deleted",{id:e}),!0):!1}listWebhooks(){return Array.from(this.webhooks.values())}getWebhook(e){return this.webhooks.get(e)}handleWebhookEvent(e,n,r){const i=this.webhooks.get(e);if(!i){ci.warn("Webhook not found",{webhookId:e});return}let a={type:"webhook",webhookId:e,webhookName:i.name,targetScoop:i.scoop,timestamp:new Date().toISOString(),headers:n,body:r};if(i.filter)try{const o=this.compileFilter(i.filter,!0)(a);if(o===!1){ci.debug("Webhook event dropped by filter",{webhookId:e,name:i.name});return}typeof o=="object"&&o!==null&&(a=o)}catch(s){ci.error("Webhook filter error",{webhookId:e,error:s instanceof Error?s.message:String(s)})}ci.info("Webhook event received",{webhookId:e,name:i.name,targetScoop:i.scoop}),this.eventHandler?.(a)}async createCronTask(e,n,r,i){const a=this.getNextCronTime(n,new Date);if(!a)throw new Error("Invalid cron expression");i&&this.compileFilter(i,!1);const s=this.generateId(),o={id:s,name:e,cron:n,scoop:r,filter:i,nextRun:a.toISOString(),lastRun:null,status:"active",createdAt:new Date().toISOString()};return this.crontasks.set(s,o),await pm(o),ci.info("Cron task created",{id:s,name:e,cron:n,scoop:r}),o}async deleteCronTask(e){return this.crontasks.has(e)?(this.crontasks.delete(e),await cq(e),ci.info("Cron task deleted",{id:e}),!0):!1}listCronTasks(){return Array.from(this.crontasks.values())}getCronTask(e){return this.crontasks.get(e)}getLicksForScoop(e,n){const r=s=>s===e||s===n||`${s}-scoop`===n,i=Array.from(this.webhooks.values()).filter(s=>r(s.scoop)),a=Array.from(this.crontasks.values()).filter(s=>r(s.scoop));return{webhooks:i,cronTasks:a}}async runCronScheduler(){const e=new Date;for(const n of this.crontasks.values()){if(n.status!=="active"||!n.nextRun||new Date(n.nextRun)>e)continue;let i={time:e.toISOString()};if(n.filter)try{const l=this.compileFilter(n.filter,!1)(null);if(l===!1){ci.debug("Cron task skipped by filter",{id:n.id,name:n.name});const c=this.getNextCronTime(n.cron,e);n.nextRun=c?.toISOString()??null,n.lastRun=e.toISOString(),await pm(n);continue}typeof l=="object"&&l!==null&&(i=l)}catch(o){ci.error("Cron filter error",{id:n.id,error:o instanceof Error?o.message:String(o)})}const a={type:"cron",cronId:n.id,cronName:n.name,targetScoop:n.scoop,timestamp:e.toISOString(),body:i};ci.info("Cron task running",{id:n.id,name:n.name}),this.eventHandler?.(a);const s=this.getNextCronTime(n.cron,e);n.nextRun=s?.toISOString()??null,n.lastRun=e.toISOString(),await pm(n)}}generateId(){const e="abcdefghijklmnopqrstuvwxyz0123456789";let n="";for(let r=0;r<12;r++)n+=e[Math.floor(Math.random()*e.length)];return n}compileFilter(e,n){try{return n?new Function("event",`return (${e})(event);`):new Function(`return (${e})();`)}catch(r){throw new Error(`Invalid filter function: ${r instanceof Error?r.message:String(r)}`)}}getNextCronTime(e,n){const r=e.trim().split(/\s+/);if(r.length!==5)return null;const[i,a,s,o,l]=r,c=new Date(n);c.setSeconds(0),c.setMilliseconds(0),c.setMinutes(c.getMinutes()+1);const u=(d,p)=>{if(p==="*")return!0;if(p.includes(","))return p.split(",").some(f=>u(d,f.trim()));if(p.includes("-")){const[f,h]=p.split("-").map(m=>parseInt(m,10));return d>=f&&d<=h}if(p.includes("/")){const[f,h]=p.split("/"),m=parseInt(h,10);if(f==="*")return d%m===0;const g=parseInt(f,10);return d>=g&&(d-g)%m===0}return parseInt(p,10)===d};for(let d=0;d<527040;d++){if(u(c.getMinutes(),i)&&u(c.getHours(),a)&&u(c.getDate(),s)&&u(c.getMonth()+1,o)&&u(c.getDay(),l))return c;c.setMinutes(c.getMinutes()+1)}return null}}function lO(t,e,n){if(e.length===0&&n.length===0)return null;const r=[];e.length>0&&r.push(`${e.length} active webhook${e.length>1?"s":""}`),n.length>0&&r.push(`${n.length} active cron task${n.length>1?"s":""}`);const i=[...e.map(a=>` webhook delete ${a.id}`),...n.map(a=>` crontask delete ${a.id}`)].join(`
|
|
14649
14660
|
`);return new Error(`Cannot remove scoop '${t}': it has ${r.join(" and ")}. Unregister them first:
|
|
14650
|
-
${i}`)}let Y1=null;function
|
|
14661
|
+
${i}`)}let Y1=null;function Ece(){return Y1||(Y1=new oO),Y1}const Sce=Object.freeze(Object.defineProperty({__proto__:null,LickManager:oO,buildActiveLicksError:lO,getLickManager:Ece},Symbol.toStringTag,{value:"Module"})),Bt=wn("orchestrator");class Cce{scoops=new Map;tabs=new Map;contexts=new Map;messageQueues=new Map;lastAgentTimestamp=new Map;container;callbacks;config;pollInterval=null;scheduler=null;globalMemoryCache="";sharedFs=null;scoopResponseBuffer=new Map;lickManager=null;sessionStore=null;constructor(e,n,r={name:"sliccy",triggerPattern:/^@sliccy\b/i}){this.container=e,this.callbacks=n,this.config=r}async init(){await nC(),this.sharedFs=await Kr.create({dbName:"slicc-fs"}),this.sessionStore=new DU,await this.ensureRootStructure();const e=await Xz();for(const n of Object.values(e)){n.isCone&&(n.trigger=void 0,n.requiresTrigger=!1,n.assistantLabel=n.assistantLabel||"sliccy"),this.scoops.set(n.jid,n),this.messageQueues.set(n.jid,[]);const r=await tC(`lastAgentTs_${n.jid}`);r&&this.lastAgentTimestamp.set(n.jid,r)}await this.ensureGlobalMemory(),this.scheduler=new kce({onTaskRun:async(n,r)=>{Bt.info("Running scheduled task",{taskId:n.id,scoop:r.name}),await this.sendPrompt(r.jid,`[SCHEDULED TASK]
|
|
14651
14662
|
|
|
14652
|
-
${n.prompt}`,"scheduler","Scheduled Task")},getScoop:n=>{for(const r of this.scoops.values())if(r.folder===n)return r}}),this.scheduler.start(),Bt.info("Orchestrator initialized",{scoopCount:this.scoops.size});for(const n of this.scoops.values())await this.createScoopTab(n.jid);this.startMessageLoop()}async ensureRootStructure(){if(!this.sharedFs)return;const e=["/workspace","/shared","/scoops","/home","/tmp"];for(const n of e)try{await this.sharedFs.mkdir(n,{recursive:!0})}catch{}}async ensureGlobalMemory(){if(this.sharedFs){await
|
|
14663
|
+
${n.prompt}`,"scheduler","Scheduled Task")},getScoop:n=>{for(const r of this.scoops.values())if(r.folder===n)return r}}),this.scheduler.start(),Bt.info("Orchestrator initialized",{scoopCount:this.scoops.size});for(const n of this.scoops.values())await this.createScoopTab(n.jid);this.startMessageLoop()}async ensureRootStructure(){if(!this.sharedFs)return;const e=["/workspace","/shared","/scoops","/home","/tmp"];for(const n of e)try{await this.sharedFs.mkdir(n,{recursive:!0})}catch{}}async ensureGlobalMemory(){if(this.sharedFs){await yce(this.sharedFs);try{const e=await this.sharedFs.readFile("/shared/CLAUDE.md",{encoding:"utf-8"});this.globalMemoryCache=typeof e=="string"?e:new TextDecoder().decode(e)}catch{Bt.warn("Global memory file not found after creating defaults")}}}async getGlobalMemory(){if(this.globalMemoryCache)return this.globalMemoryCache;if(this.sharedFs)try{const e=await this.sharedFs.readFile("/shared/CLAUDE.md",{encoding:"utf-8"});this.globalMemoryCache=typeof e=="string"?e:new TextDecoder().decode(e)}catch{}return this.globalMemoryCache}async setGlobalMemory(e){this.sharedFs&&(await this.sharedFs.writeFile("/shared/CLAUDE.md",e),this.globalMemoryCache=e,Bt.info("Global memory updated"))}getSharedFS(){return this.sharedFs}setLickManager(e){this.lickManager=e}async registerScoop(e){await Yz(e),this.scoops.set(e.jid,e),this.messageQueues.set(e.jid,[]),Bt.info("Scoop registered",{jid:e.jid,name:e.name}),this.createScoopTab(e.jid).catch(n=>{const r=n instanceof Error?n.message:String(n);Bt.error("Scoop init failed",{jid:e.jid,error:r})})}async unregisterScoop(e){const n=this.scoops.get(e);if(n&&this.lickManager){const{webhooks:r,cronTasks:i}=this.lickManager.getLicksForScoop(n.name,n.folder),a=lO(n.folder,r,i);if(a)throw a}await this.destroyScoopTab(e),this.sessionStore?.delete(e).catch(r=>{Bt.warn("Failed to delete agent session",{jid:e,error:r instanceof Error?r.message:String(r)})}),await eq(e),this.scoops.delete(e),this.messageQueues.delete(e),this.lastAgentTimestamp.delete(e),Bt.info("Scoop unregistered",{jid:e})}getScoops(){return Array.from(this.scoops.values())}getScoop(e){return this.scoops.get(e)}async resetFilesystem(){for(const[e,n]of this.contexts.entries())n.stop(),this.contexts.delete(e);this.sharedFs=await Kr.create({dbName:"slicc-fs",wipe:!0}),await this.ensureRootStructure(),await this.ensureGlobalMemory(),await sO(this.sharedFs).catch(e=>{Bt.warn("Failed to re-seed default skills",{error:e instanceof Error?e.message:String(e)})}),Bt.info("Filesystem reset and defaults re-seeded")}async clearAllMessages(){await tq(),this.sessionStore&&await this.sessionStore.clearAll().catch(e=>{Bt.warn("Failed to clear agent sessions",{error:e instanceof Error?e.message:String(e)})});for(const e of this.contexts.values())e.clearMessages();this.lastAgentTimestamp.clear();for(const e of this.scoops.keys())this.messageQueues.set(e,[]);Bt.info("All messages cleared")}async handleMessage(e){Bt.info("handleMessage",{id:e.id,chatJid:e.chatJid,sender:e.senderName,channel:e.channel,contentPreview:e.content.slice(0,80)});const n=this.scoops.get(e.chatJid),r=n?.isCone?"cone":n?.name??"unknown";vle(r,localStorage.getItem("selected-model")??"unknown"),await C3(e),await this.routeToScoop(e)}async delegateToScoop(e,n,r){const i=this.scoops.get(e);if(!i)throw new Error(`Scoop not found: ${e}`);const a={id:`delegate-${Date.now()}-${Math.random().toString(36).slice(2)}`,chatJid:e,senderId:"cone",senderName:r,content:n,timestamp:new Date().toISOString(),fromAssistant:!0,channel:"delegation"};await C3(a),this.callbacks.onIncomingMessage?.(e,a),Bt.info("Delegating to scoop",{scoopJid:e,scoopName:i.name,promptLength:n.length}),this.sendPrompt(e,n,"cone",r).catch(s=>{const o=s instanceof Error?s.message:String(s);Bt.error("Delegation failed",{scoopJid:e,error:o}),this.callbacks.onError(e,`Delegation failed: ${o}`)})}async routeToScoop(e){const n=this.scoops.get(e.chatJid);if(!n){Bt.info("routeToScoop: unregistered target",{chatJid:e.chatJid});return}const r=e.channel==="webhook"||e.channel==="cron";if(!n.isCone&&n.requiresTrigger&&n.trigger&&!r&&!e.content.includes(n.trigger)){Bt.info("routeToScoop: trigger not found in content",{chatJid:e.chatJid,trigger:n.trigger,contentPreview:e.content.slice(0,80)});return}const i=this.messageQueues.get(e.chatJid)??[];i.push(e),this.messageQueues.set(e.chatJid,i);let a=this.tabs.get(e.chatJid);if(Bt.debug("routeToScoop: queued",{chatJid:e.chatJid,scoopName:n.name,tabStatus:a?.status??"no-tab",queueLength:i.length}),a?.status==="error"){Bt.info("routeToScoop: tab in error state, retrying init",{chatJid:e.chatJid});try{await this.createScoopTab(e.chatJid),a=this.tabs.get(e.chatJid)}catch{Bt.warn("routeToScoop: retry init failed",{chatJid:e.chatJid})}}a?.status==="ready"&&await this.processScoopQueue(e.chatJid)}async createScoopTab(e){const n=this.scoops.get(e);if(!n)throw new Error(`Scoop not found: ${e}`);if(this.contexts.has(e))if(this.tabs.get(e)?.status==="error")Bt.info("Re-creating context after error",{jid:e}),this.contexts.get(e)?.dispose(),this.contexts.delete(e),this.tabs.delete(e);else{Bt.debug("Context already exists",{jid:e});return}if(!this.sharedFs)throw new Error("Shared filesystem not initialized");const r=`scoop-${n.folder}-${Date.now()}`,i=n.isCone?this.sharedFs:new GS(this.sharedFs,[`/scoops/${n.folder}/`,"/shared/"],["/workspace/"]),a={onResponse:(l,c)=>{if(this.callbacks.onResponse(e,l,c),!n.isCone)if(c){const u=this.scoopResponseBuffer.get(e)??"";this.scoopResponseBuffer.set(e,u+l)}else this.scoopResponseBuffer.set(e,l)},onResponseDone:()=>{const l=this.tabs.get(e);l&&(l.lastActivity=new Date().toISOString(),this.tabs.set(e,l)),this.callbacks.onResponseDone(e)},onError:l=>{const c=this.tabs.get(e);c&&(c.status="error",c.error=l,this.tabs.set(e,c)),this.callbacks.onError(e,l),this.callbacks.onStatusChange(e,"error")},onStatusChange:l=>{const c=this.tabs.get(e);if(c&&(c.status=l,c.lastActivity=new Date().toISOString(),this.tabs.set(e,c)),this.callbacks.onStatusChange(e,l),l==="ready"&&!n.isCone){const u=this.scoopResponseBuffer.get(e);if(this.scoopResponseBuffer.delete(e),u){const d=Array.from(this.scoops.values()).find(p=>p.isCone);if(d){const p=u.length>2e3?u.slice(0,2e3)+`
|
|
14653
14664
|
... (truncated)`:u,f={id:`scoop-done-${e}-${Date.now()}`,chatJid:d.jid,senderId:n.folder,senderName:n.assistantLabel,content:`[@${n.assistantLabel} completed]:
|
|
14654
|
-
${p}`,timestamp:new Date().toISOString(),fromAssistant:!1,channel:"scoop-notify"};Bt.info("Routing scoop completion to cone",{scoop:n.folder,responseLength:u.length}),this.handleMessage(f).catch(h=>{const m=h instanceof Error?h.message:String(h);Bt.error("Failed to route scoop completion to cone",{scoop:n.folder,error:m}),this.callbacks.onError(d.jid,`Scoop ${n.folder} completed but notification failed: ${m}`)})}}}},onToolStart:(l,c)=>{this.callbacks.onToolStart?.(e,l,c)},onToolEnd:(l,c,u)=>{this.callbacks.onToolEnd?.(e,l,c,u)},onToolUI:(l,c,u)=>{this.callbacks.onToolUI?.(e,l,c,u)},onToolUIDone:l=>{this.callbacks.onToolUIDone?.(e,l)},onSendMessage:(l,c)=>{this.callbacks.onSendMessage(e,`${c?`[${c}] `:""}${l}`)},getScoops:()=>this.getScoops(),onFeedScoop:n.isCone?(l,c)=>this.delegateToScoop(l,c,n.assistantLabel):void 0,onScoopScoop:n.isCone?async l=>{const c={...l,jid:`scoop_${l.folder}_${Date.now()}`};return await this.registerScoop(c),c}:void 0,onDropScoop:n.isCone?async l=>{await this.unregisterScoop(l)}:void 0,getGlobalMemory:()=>this.getGlobalMemory(),setGlobalMemory:n.isCone?l=>this.setGlobalMemory(l):void 0,getBrowserAPI:()=>this.callbacks.getBrowserAPI()},s=new
|
|
14655
|
-
`);this.messageQueues.set(e,[]);const c=o[o.length-1];this.lastAgentTimestamp.set(e,c.timestamp),await C0(`lastAgentTs_${e}`,c.timestamp),await this.sendPrompt(e,l,c.senderId,c.senderName)}startMessageLoop(){this.pollInterval||(this.pollInterval=window.setInterval(()=>{for(const e of this.scoops.keys())this.tabs.get(e)?.status==="ready"&&this.processScoopQueue(e).catch(r=>{const i=r instanceof Error?r.message:String(r);Bt.error("Message queue processing failed",{jid:e,error:i}),this.callbacks.onError(e,`Queue processing failed: ${i}`)})},2e3))}stopMessageLoop(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}updateModel(){for(const e of this.contexts.values())e.updateModel();Bt.info("Model updated on all active contexts",{contextCount:this.contexts.size})}async reloadAllSkills(){const e=[];for(const[n,r]of this.contexts){const i=this.tabs.get(n);(i?.status==="ready"||i?.status==="processing")&&e.push(r.reloadSkills().catch(a=>{Bt.warn("Failed to reload skills for scoop",{jid:n,error:a instanceof Error?a.message:String(a)})}))}await Promise.all(e),Bt.info("Skills reloaded across all contexts",{count:e.length})}stopScoop(e){const n=this.contexts.get(e);n&&n.stop()}async shutdown(){this.stopMessageLoop(),this.scheduler?.stop(),this.scheduler=null;for(const e of this.contexts.keys())await this.destroyScoopTab(e);Bt.info("Orchestrator shutdown")}}const cO=wn("tray-follower");async function Sce(t){const e=await(t.fetchImpl??fetch)(t.joinUrl,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({controllerId:t.controllerId,runtime:t.runtime})}),n=await Rce(e);return cO.info("Follower tray attach response",{trayId:n.trayId,action:n.result.action,code:n.result.code,participantCount:n.participantCount}),Cce(n)}function Cce(t){const e={trayId:t.trayId,controllerId:t.controllerId,participantCount:t.participantCount,leader:t.leader,action:t.result.action,code:t.result.code,iceServers:t.iceServers};return t.result.action==="wait"?{...e,retryAfterMs:t.result.retryAfterMs}:t.result.action==="signal"?{...e,bootstrap:t.result.bootstrap}:t.result.action==="fail"?{...e,error:t.result.error}:e}async function Ace(t){return Vf(await Zf(t,{action:"poll",controllerId:t.controllerId,bootstrapId:t.bootstrapId,cursor:t.cursor}))}async function Tce(t){return Vf(await Zf(t,{action:"answer",controllerId:t.controllerId,bootstrapId:t.bootstrapId,answer:t.answer}))}async function _ce(t){return Vf(await Zf(t,{action:"ice-candidate",controllerId:t.controllerId,bootstrapId:t.bootstrapId,candidate:t.candidate}))}async function Ice(t){return Vf(await Zf(t,{action:"retry",controllerId:t.controllerId,bootstrapId:t.bootstrapId,runtime:t.runtime}))}function Vf(t){return{trayId:t.trayId,controllerId:t.controllerId,participantCount:t.participantCount,leader:t.leader,bootstrap:t.bootstrap,events:t.events}}async function Rce(t){let e=null,n=null;try{e=await t.text(),n=JSON.parse(e)}catch{}if(!$ce(n)){const r=e?e.slice(0,200):"(empty)";throw cO.warn("Tray follower attach returned an invalid response",{status:t.status,body:r}),new Error(`Tray follower attach returned an invalid response (${t.status}): ${r}`)}return n}async function Zf(t,e){const n=await(t.fetchImpl??fetch)(t.joinUrl,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),r=await n.json().catch(()=>null);if(!Nce(r))throw new Error(`Tray follower bootstrap returned an invalid response (${n.status})`);return r}function $ce(t){if(!t||typeof t!="object")return!1;const e=t;if(typeof e.trayId!="string"||typeof e.controllerId!="string"||e.role!=="follower"||typeof e.participantCount!="number")return!1;const n=e.result;if(!n||typeof n!="object")return!1;const r=n;return r.action==="wait"?(r.code==="LEADER_NOT_ELECTED"||r.code==="LEADER_NOT_CONNECTED")&&typeof r.retryAfterMs=="number":r.action==="signal"?r.code==="LEADER_CONNECTED"&&uO(r.bootstrap):r.action==="fail"?(r.code==="INVALID_JOIN_CAPABILITY"||r.code==="TRAY_EXPIRED")&&typeof r.error=="string":!1}function Nce(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.trayId=="string"&&typeof e.controllerId=="string"&&e.role==="follower"&&typeof e.participantCount=="number"&&uO(e.bootstrap)&&Array.isArray(e.events)}function uO(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.controllerId=="string"&&typeof e.bootstrapId=="string"&&typeof e.attempt=="number"&&typeof e.state=="string"&&typeof e.expiresAt=="string"&&typeof e.cursor=="number"&&typeof e.maxRetries=="number"&&typeof e.retriesRemaining=="number"}const or=wn("tray-webrtc"),Pce="tray-control",Oce=250;class Mce{constructor(e){this.options=e,this.iceServers=e.iceServers,this.peerConnectionFactory=e.peerConnectionFactory??(()=>dO(this.iceServers)),this.dataChannelLabel=e.dataChannelLabel??Pce}peerConnectionFactory;dataChannelLabel;peers=new Map;iceServers;setIceServers(e){this.iceServers=e}async handleControlMessage(e){e.type==="follower.join_requested"?(e.iceServers&&!this.iceServers&&(this.iceServers=e.iceServers),await this.handleJoinRequested(e)):e.type==="bootstrap.answer"?await this.peers.get(e.bootstrapId)?.peer.setRemoteDescription(e.answer):e.type==="bootstrap.ice_candidate"&&await this.peers.get(e.bootstrapId)?.peer.addIceCandidate(e.candidate)}getPeers(){return Array.from(this.peers.values()).map(({state:e})=>({...e}))}getChannel(e){return this.peers.get(e)?.channel??null}stop(){for(const e of this.peers.values())e.peer.close();this.peers.clear()}async handleJoinRequested(e){this.closeControllerPeers(e.controllerId);const n=this.peerConnectionFactory(),r={controllerId:e.controllerId,bootstrapId:e.bootstrapId,attempt:e.attempt,state:"connecting",connectedAt:null,runtime:e.runtime},i=n.createDataChannel(this.dataChannelLabel);this.peers.set(e.bootstrapId,{state:r,peer:n,channel:i}),n.addEventListener("icecandidate",({candidate:a})=>{const s=fO(a);s&&this.options.sendControlMessage({type:"bootstrap.ice_candidate",controllerId:e.controllerId,bootstrapId:e.bootstrapId,candidate:s})}),n.addEventListener("connectionstatechange",()=>{const a=this.peers.get(e.bootstrapId);a&&(a.state.state!=="connected"?n.connectionState==="failed"&&this.failPeer(e,"Leader peer connection failed before the data channel opened"):(n.connectionState==="disconnected"||n.connectionState==="failed")&&(or.warn("Leader peer connection state changed post-connect",{bootstrapId:e.bootstrapId,state:n.connectionState}),this.options.onPeerDisconnected?.(e.bootstrapId,`Peer connection ${n.connectionState}`)))}),i.addEventListener("open",()=>{const a=this.peers.get(e.bootstrapId);!a||a.state.state==="connected"||(a.state.state="connected",a.state.connectedAt=new Date().toISOString(),this.options.onPeerConnected?.({...a.state},a.channel))}),i.addEventListener("close",()=>{const a=this.peers.get(e.bootstrapId);a&&(a.state.state!=="connected"?this.failPeer(e,"Leader data channel closed before opening"):(or.warn("Leader data channel closed post-connect",{bootstrapId:e.bootstrapId}),this.options.onPeerDisconnected?.(e.bootstrapId,"Data channel closed")))}),i.addEventListener("error",()=>{const a=this.peers.get(e.bootstrapId);a&&(a.state.state!=="connected"?this.failPeer(e,"Leader data channel failed before opening"):(or.warn("Leader data channel error post-connect",{bootstrapId:e.bootstrapId}),this.options.onPeerDisconnected?.(e.bootstrapId,"Data channel error")))});try{const a=await n.createOffer();await n.setLocalDescription(a),this.options.sendControlMessage({type:"bootstrap.offer",controllerId:e.controllerId,bootstrapId:e.bootstrapId,offer:pO(n.localDescription??a,"offer")})}catch(a){this.failPeer(e,a instanceof Error?a.message:String(a))}}closeControllerPeers(e){for(const[n,r]of this.peers.entries())r.state.controllerId===e&&(r.peer.close(),this.peers.delete(n))}failPeer(e,n){const r=this.peers.get(e.bootstrapId);if(r){r.peer.close(),this.peers.delete(e.bootstrapId);try{this.options.sendControlMessage({type:"bootstrap.failed",controllerId:e.controllerId,bootstrapId:e.bootstrapId,code:"WEBRTC_BOOTSTRAP_FAILED",message:n,retryable:!0,retryAfterMs:1e3})}catch(i){or.warn("Failed to report tray bootstrap failure",{error:i instanceof Error?i.message:String(i)})}}}}class Lce{constructor(e){this.options=e,this.fetchImpl=e.fetchImpl??fetch,this.iceServers=e.iceServers,this.peerConnectionFactory=e.peerConnectionFactory??(()=>dO(this.iceServers)),this.controllerIdFactory=e.controllerIdFactory??(()=>crypto.randomUUID()),this.sleep=e.sleep??(n=>new Promise(r=>setTimeout(r,n))),this.pollIntervalMs=e.pollIntervalMs??Oce}fetchImpl;peerConnectionFactory;controllerIdFactory;sleep;pollIntervalMs;iceServers;activePeer=null;stopped=!1;async start(){this.stopped=!1;const e=this.controllerIdFactory(),n=Date.now();na({state:"connecting",joinUrl:this.options.joinUrl,trayId:null,error:null,lastPingTime:null,reconnectAttempts:0,attachAttempts:0,lastAttachCode:null,connectingSince:n,lastError:null}),or.info("Follower tray join starting",{joinUrl:this.options.joinUrl});let r=0;for(;;){X8(this.stopped),r++;let i;try{i=await Sce({joinUrl:this.options.joinUrl,controllerId:e,runtime:this.options.runtime,fetchImpl:this.fetchImpl})}catch(a){const s=a instanceof Error?a.message:String(a);throw na({..._s(),attachAttempts:r,lastError:s}),a}if(na({..._s(),attachAttempts:r,lastAttachCode:i.code}),i.action==="wait"){const a=i.retryAfterMs??1e3;or.info("Follower tray attach waiting",{attempt:r,code:i.code,retryAfterMs:a}),r%10===0&&or.warn(`Follower tray attach still waiting after ${r} attempts`,{attempt:r,code:i.code,retryAfterMs:a}),await this.sleep(a);continue}if(i.action==="fail"||!i.bootstrap){const a=i.error??`Tray follower attach failed (${i.code})`;throw na({state:"error",joinUrl:this.options.joinUrl,trayId:null,error:a,lastPingTime:null,reconnectAttempts:0,attachAttempts:r,lastAttachCode:i.code,connectingSince:null,lastError:a}),or.warn("Follower tray attach failed",{error:a}),new Error(a)}i.iceServers&&(this.iceServers=i.iceServers);try{const a=await this.completeBootstrap(i.trayId,e,i.bootstrap);return na({state:"connected",joinUrl:this.options.joinUrl,trayId:a.trayId,error:null,lastPingTime:null,reconnectAttempts:0,attachAttempts:r,lastAttachCode:i.code,connectingSince:null,lastError:null}),or.info("Follower tray connected",{trayId:a.trayId,controllerId:e}),a}catch(a){const s=a instanceof Error?a.message:String(a);throw na({state:"error",joinUrl:this.options.joinUrl,trayId:i.trayId,error:s,lastPingTime:null,reconnectAttempts:0,attachAttempts:r,lastAttachCode:i.code,connectingSince:null,lastError:s}),or.warn("Follower tray bootstrap failed",{error:s}),a}}}stop(){this.stopped=!0,this.activePeer?.peer.close(),this.activePeer?.channel?.close(),this.activePeer=null,na({state:"inactive",joinUrl:null,trayId:null,error:null,lastPingTime:null,reconnectAttempts:0,attachAttempts:0,lastAttachCode:null,connectingSince:null,lastError:null})}async completeBootstrap(e,n,r){let i=r,a=0;for(this.activePeer=this.createFollowerPeer(n,i.bootstrapId);;){if(X8(this.stopped),this.activePeer.open&&this.activePeer.channel)return{trayId:e,controllerId:n,bootstrapId:i.bootstrapId,channel:this.activePeer.channel};if(this.activePeer.openError)throw new Error(this.activePeer.openError);const s=await Ace({joinUrl:this.options.joinUrl,controllerId:n,bootstrapId:i.bootstrapId,cursor:a,fetchImpl:this.fetchImpl});i=s.bootstrap,a=i.cursor;try{for(const o of s.events)if(o.type==="bootstrap.offer"){await this.activePeer.peer.setRemoteDescription(o.offer);const l=await this.activePeer.peer.createAnswer();await this.activePeer.peer.setLocalDescription(l),await Tce({joinUrl:this.options.joinUrl,controllerId:n,bootstrapId:i.bootstrapId,answer:pO(this.activePeer.peer.localDescription??l,"answer"),fetchImpl:this.fetchImpl})}else if(o.type==="bootstrap.ice_candidate")await this.activePeer.peer.addIceCandidate(o.candidate);else if(o.type==="bootstrap.failed")throw new Error(o.failure.message)}catch(o){if(i.failure?.retryable&&i.retriesRemaining>0){i=(await Ice({joinUrl:this.options.joinUrl,controllerId:n,bootstrapId:i.bootstrapId,runtime:this.options.runtime,fetchImpl:this.fetchImpl})).bootstrap,a=0,this.activePeer.peer.close(),this.activePeer=this.createFollowerPeer(n,i.bootstrapId);continue}throw o}this.activePeer.open||await this.sleep(this.pollIntervalMs)}}createFollowerPeer(e,n){const r=this.peerConnectionFactory(),i={peer:r,channel:null,open:!1,openError:null};return r.addEventListener("connectionstatechange",()=>{i.open&&(r.connectionState==="disconnected"||r.connectionState==="failed")&&(or.warn("Follower peer connection state changed post-connect",{bootstrapId:n,state:r.connectionState}),this.options.onDisconnected?.(`Peer connection ${r.connectionState}`))}),r.addEventListener("datachannel",({channel:a})=>{i.channel=a,a.addEventListener("open",()=>{i.open=!0}),a.addEventListener("close",()=>{i.open?(or.warn("Follower data channel closed post-connect",{bootstrapId:n}),this.options.onDisconnected?.("Data channel closed")):i.openError="Follower data channel closed before opening"}),a.addEventListener("error",()=>{i.open?(or.warn("Follower data channel error post-connect",{bootstrapId:n}),this.options.onDisconnected?.("Data channel error")):i.openError="Follower data channel failed before opening"})}),r.addEventListener("icecandidate",({candidate:a})=>{const s=fO(a);s&&_ce({joinUrl:this.options.joinUrl,controllerId:e,bootstrapId:n,candidate:s,fetchImpl:this.fetchImpl}).catch(o=>{or.warn("Failed to send follower ICE candidate",{error:o instanceof Error?o.message:String(o)})})}),i}}function Dce(t,e){const n=e.baseDelayMs??1e3,r=e.backoffMultiplier??2,i=e.maxDelayMs??3e4,a=e.maxAttempts??10,s=e.sleep??t.sleep??(h=>new Promise(m=>setTimeout(m,h)));let o=!1,l=!1,c=null;const u={cancel(){o=!0,l=!1,c?.stop(),c=null},get reconnecting(){return l}},d=()=>{const h=new Lce({...t,sleep:s,onDisconnected:m=>{o||(or.warn("Follower disconnected, starting reconnect loop",{reason:m}),p(m))}});return c=h,{manager:h,connectionPromise:h.start()}},p=async h=>{if(o||l)return;l=!0,c?.stop(),c=null;let m=0,g=n,v=h??"Unknown disconnect";for(;!o&&m<a&&(m++,e.onReconnecting?.(m),na({..._s(),state:"reconnecting",error:null,reconnectAttempts:m}),or.info("Reconnect attempt",{attempt:m,delay:g}),await s(g),!o);){let y=null;try{const b=d();y=b.manager;const S=await b.connectionPromise;if(o){y.stop();break}l=!1,na({..._s(),state:"connected",joinUrl:t.joinUrl,trayId:S.trayId,error:null,lastPingTime:null,reconnectAttempts:0,connectingSince:null,lastError:null}),or.info("Reconnect successful",{attempt:m,trayId:S.trayId}),e.onConnected(S);return}catch(b){v=b instanceof Error?b.message:String(b),or.warn("Reconnect attempt failed",{attempt:m,error:v}),y?.stop(),c=null}g=Math.min(g*r,i)}o||(l=!1,na({..._s(),state:"error",error:`Reconnect failed after ${m} attempts: ${v}`,reconnectAttempts:m}),or.warn("Reconnect gave up",{attempts:m,lastError:v}),e.onGaveUp?.(v))},{connectionPromise:f}=d();return f.then(h=>{o||e.onConnected(h)}).catch(h=>{o||or.warn("Initial follower connection failed",{error:h instanceof Error?h.message:String(h)})}),u}function dO(t){if(typeof RTCPeerConnection>"u")throw new Error("RTCPeerConnection is not available in this runtime");const e=t?.length?{iceServers:t}:void 0;return new RTCPeerConnection(e)}function pO(t,e){if(!t||t.type!==e||typeof t.sdp!="string")throw new Error(`Expected a local ${e} description before signaling`);return{type:t.type,sdp:t.sdp}}function fO(t){if(!t||typeof t!="object")return null;const e=t;return typeof e.candidate=="string"?{candidate:e.candidate,sdpMid:typeof e.sdpMid=="string"?e.sdpMid:null,sdpMLineIndex:typeof e.sdpMLineIndex=="number"?e.sdpMLineIndex:null,usernameFragment:typeof e.usernameFragment=="string"?e.usernameFragment:null}:null}function X8(t){if(t)throw new Error("Tray follower stopped before WebRTC bootstrap completed")}const Fd=64*1024;async function Dv(t,e){try{switch(e.op){case"readFile":return await Fce(t,e.path,e.encoding);case"writeFile":return[await Uce(t,e.path,e.content,e.encoding)];case"stat":return[await Wce(t,e.path)];case"readDir":return[await Bce(t,e.path)];case"mkdir":return[await zce(t,e.path,e.recursive)];case"rm":return[await qce(t,e.path,e.recursive)];case"exists":return[await jce(t,e.path)];case"walk":return[await Gce(t,e.path)];default:return[{ok:!1,error:`Unknown fs operation: ${e.op}`}]}}catch(n){return[Hce(n)]}}async function Fce(t,e,n){if((n??"utf-8")==="utf-8"){const s=await t.readFile(e,{encoding:"utf-8"});return eE(s,"utf-8")}const i=await t.readFile(e,{encoding:"binary"}),a=Vce(i);return eE(a,"base64")}async function Uce(t,e,n,r){if(r==="base64"){const i=Zce(n);await t.writeFile(e,i)}else await t.writeFile(e,n);return{ok:!0,data:{type:"void"}}}async function Wce(t,e){return{ok:!0,data:{type:"stat",stat:await t.stat(e)}}}async function Bce(t,e){return{ok:!0,data:{type:"dirEntries",entries:await t.readDir(e)}}}async function zce(t,e,n){return await t.mkdir(e,{recursive:n}),{ok:!0,data:{type:"void"}}}async function qce(t,e,n){return await t.rm(e,{recursive:n}),{ok:!0,data:{type:"void"}}}async function jce(t,e){return{ok:!0,data:{type:"exists",exists:await t.exists(e)}}}async function Gce(t,e){const n=[];for await(const r of t.walk(e))n.push(r);return{ok:!0,data:{type:"paths",paths:n}}}function eE(t,e){if(t.length<=Fd)return[{ok:!0,data:{type:"file",content:t,encoding:e}}];const n=Math.ceil(t.length/Fd),r=[];for(let i=0;i<n;i++){const a=i*Fd,s=t.slice(a,a+Fd);r.push({ok:!0,data:{type:"file",content:s,encoding:e},chunkIndex:i,totalChunks:n})}return r}function Hce(t){return t instanceof Error&&"code"in t?{ok:!1,error:t.message,code:t.code}:{ok:!1,error:t instanceof Error?t.message:String(t)}}function Vce(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function Zce(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}class Kce{runtimes=new Map;dirty=!1;setTargets(e,n){this.runtimes.set(e,n),this.dirty=!0}removeRuntime(e){this.runtimes.delete(e)&&(this.dirty=!0)}getEntries(){this.dirty=!1;const e=[];for(const[n,r]of this.runtimes)for(const i of r)e.push({targetId:`${n}:${i.targetId}`,localTargetId:i.targetId,runtimeId:n,title:i.title,url:i.url,isLocal:!1});return e}hasChanged(){return this.dirty}getRuntimeIds(){return[...this.runtimes.keys()]}}const tE=wn("data-channel-keepalive");class hO{sendPing;onDead;intervalMs;maxMissed;timer=null;missedPongs=0;awaitingPong=!1;stopped=!1;constructor(e){this.sendPing=e.sendPing,this.onDead=e.onDead,this.intervalMs=e.intervalMs??1e4,this.maxMissed=e.maxMissed??3}start(){this.timer||this.stopped||(this.timer=setInterval(()=>this.tick(),this.intervalMs))}stop(){this.stopped=!0,this.timer&&(clearInterval(this.timer),this.timer=null)}receivePong(){this.awaitingPong=!1,this.missedPongs=0}receivePing(){this.missedPongs=0,this.awaitingPong=!1}get missed(){return this.missedPongs}tick(){if(!this.stopped){if(this.awaitingPong&&(this.missedPongs++,tE.debug("Missed pong",{missedPongs:this.missedPongs,maxMissed:this.maxMissed}),this.missedPongs>=this.maxMissed)){tE.warn("Channel declared dead",{missedPongs:this.missedPongs}),this.stop(),this.onDead();return}this.awaitingPong=!0,this.sendPing()}}}const ka=wn("tray-leader-sync");function Jce(t){return t?t.includes("standalone")?"standalone":t.includes("extension")?"extension":t.includes("electron")?"electron":"unknown":"unknown"}class Qce{constructor(e){this.options=e}followers=new Map;registry=new Kce;runtimeToBootstrap=new Map;pendingCDPRoutes=new Map;cdpChunkBuffers=new Map;remoteTransports=new Map;pendingTabOpenRoutes=new Map;tabOpenResolvers=new Map;pendingFsRoutes=new Map;fsResolvers=new Map;addFollower(e,n,r){this.removeFollower(e);const i=Kz(n),a=i.onMessage(l=>{this.handleFollowerMessage(e,l)}),s=new hO({sendPing:()=>i.send({type:"ping"}),onDead:()=>{ka.warn("Follower keepalive dead, removing follower",{bootstrapId:e}),this.removeFollower(e),this.options.onFollowerDead?.(e)}});s.start(),this.followers.set(e,{bootstrapId:e,sync:i,unsubscribe:a,keepalive:s,runtime:r?.runtime,connectedAt:r?.connectedAt,lastActivity:Date.now(),floatType:Jce(r?.runtime)}),ka.info("Follower added to sync",{bootstrapId:e,followerCount:this.followers.size}),this.sendSnapshotToFollower(e);const o=this.getConnectedEntries();o.length>0&&i.send({type:"targets.registry",targets:o})}removeFollower(e){const n=this.followers.get(e);if(n){n.keepalive.stop(),n.unsubscribe(),n.sync.close(),this.followers.delete(e);for(const[r,i]of this.runtimeToBootstrap)if(i===e){this.cleanupRemoteTransports(r),this.registry.removeRuntime(r),this.runtimeToBootstrap.delete(r);break}this.registry.hasChanged()&&this.broadcastTargetRegistry(),ka.info("Follower removed from sync",{bootstrapId:e,followerCount:this.followers.size})}}broadcastEvent(e){if(this.followers.size===0)return;const n=this.options.getScoopJid(),r={type:"agent_event",event:e,scoopJid:n};for(const i of this.followers.values())i.sync.send(r)}broadcastUserMessage(e,n){if(this.followers.size===0)return;const r=this.options.getScoopJid(),i={type:"user_message_echo",text:e,messageId:n,scoopJid:r};for(const a of this.followers.values())a.sync.send(i)}broadcastStatus(e){if(this.followers.size===0)return;const n={type:"status",scoopStatus:e};for(const r of this.followers.values())r.sync.send(n)}sendSnapshotToFollower(e){const n=this.followers.get(e);if(!n)return;const r=this.options.getMessages(),i=this.options.getScoopJid();Vz(n.sync,r,i),ka.debug("Snapshot sent to follower",{bootstrapId:e,messageCount:r.length})}handleFollowerMessage(e,n){switch(n.type){case"user_message":ka.info("Follower user message received",{bootstrapId:e,messageId:n.messageId}),this.options.onFollowerMessage(n.text,n.messageId);break;case"abort":ka.info("Follower abort received",{bootstrapId:e}),this.options.onFollowerAbort();break;case"request_snapshot":ka.info("Follower snapshot request received",{bootstrapId:e}),this.sendSnapshotToFollower(e);break;case"targets.advertise":{ka.info("Follower targets advertised",{bootstrapId:e,runtimeId:n.runtimeId,targetCount:n.targets.length});for(const r of[...this.remoteTransports.keys()]){const i=r.substring(0,r.indexOf(":"));i!=="leader"&&!this.runtimeToBootstrap.has(i)&&i!==n.runtimeId&&(this.remoteTransports.get(r)?.disconnect(),this.remoteTransports.delete(r),ka.debug("Cleaned up orphaned remote transport on advertise",{key:r}))}this.runtimeToBootstrap.set(n.runtimeId,e),this.registry.setTargets(n.runtimeId,n.targets),this.broadcastTargetRegistry();break}case"cdp.request":{const{requestId:r,targetRuntimeId:i,localTargetId:a,method:s,params:o,sessionId:l}=n;i==="leader"?this.executeLocalCDP(r,a,s,o,l,e):this.forwardCDPRequest(r,i,a,s,o,l,e);break}case"cdp.response":{this.handleCDPResponse(n);break}case"cdp.event":{this.handleCDPEvent(e,n.method,n.params,n.sessionId);break}case"tab.open":{const{requestId:r,targetRuntimeId:i,url:a}=n;i==="leader"?this.executeLocalTabOpen(r,a,e):this.forwardTabOpen(r,i,a,e);break}case"tab.opened":{this.handleTabOpenResponse(n.requestId,n.targetId);break}case"tab.open.error":{this.handleTabOpenError(n.requestId,n.error);break}case"fs.request":{const{requestId:r,targetRuntimeId:i,request:a}=n;i==="leader"?this.executeLocalFs(r,a,e):this.forwardFsRequest(r,i,a,e);break}case"fs.response":{this.handleFsResponse(n.requestId,n.response);break}case"ping":{const r=this.followers.get(e);r&&(r.keepalive.receivePing(),r.lastActivity=Date.now(),r.sync.send({type:"pong"}));break}case"pong":{const r=this.followers.get(e);r&&(r.keepalive.receivePong(),r.lastActivity=Date.now());break}}}setLocalTargets(e){this.registry.setTargets("leader",e),this.registry.hasChanged()&&this.broadcastTargetRegistry()}broadcastTargetRegistry(){if(this.followers.size===0)return;const n={type:"targets.registry",targets:this.getConnectedEntries()};for(const r of this.followers.values())r.sync.send(n)}getTargets(){return this.getConnectedEntries()}getConnectedEntries(){return this.registry.getEntries().filter(e=>{if(e.runtimeId==="leader")return!0;const n=this.runtimeToBootstrap.get(e.runtimeId);return n?this.followers.has(n):!1})}createRemoteTransport(e,n){const r={sendCDPRequest:(a,s,o,l)=>{const c=this.runtimeToBootstrap.get(e),u=c?this.followers.get(c):void 0;if(!u){this.remoteTransports.get(`${e}:${n}`)?.handleResponse(a,void 0,`Target runtime "${e}" not connected`);return}this.pendingCDPRoutes.set(a,{requesterBootstrapId:"__leader__",requestId:a}),u.sync.send({type:"cdp.request",requestId:a,localTargetId:n,method:s,params:o,sessionId:l})}},i=new XS(r);return this.remoteTransports.set(`${e}:${n}`,i),i}removeRemoteTransport(e,n){const r=`${e}:${n}`,i=this.remoteTransports.get(r);i&&(i.disconnect(),this.remoteTransports.delete(r))}cleanupRemoteTransports(e){const n=`${e}:`;for(const r of[...this.remoteTransports.keys()])r.startsWith(n)&&(this.remoteTransports.get(r)?.disconnect(),this.remoteTransports.delete(r),ka.debug("Cleaned up stale remote transport",{key:r}))}getConnectedFollowers(){return[...this.runtimeToBootstrap.entries()].map(([e,n])=>{const r=this.followers.get(n);return{runtimeId:e,runtime:r?.runtime,connectedAt:r?.connectedAt,lastActivity:r?.lastActivity,floatType:r?.floatType}})}getBestFollowerForTeleport(){const e=[];for(const[i,a]of this.runtimeToBootstrap){const s=this.followers.get(a);s&&e.push({runtimeId:i,bootstrapId:a,floatType:s.floatType,lastActivity:s.lastActivity})}if(e.length===0)return null;const n=e.filter(i=>i.floatType==="standalone"),r=n.length>0?n:e;return r.sort((i,a)=>a.lastActivity-i.lastActivity),r[0]}get hasFollowers(){return this.followers.size>0}stop(){for(const e of[...this.followers.keys()])this.removeFollower(e)}async executeLocalCDP(e,n,r,i,a,s){const o=this.followers.get(s);if(!o)return;const l=this.options.browserTransport;if(!l){o.sync.send({type:"cdp.response",requestId:e,error:"Leader has no browser transport"});return}try{const c=await l.send(r,i,a);S0(o.sync,e,c)}catch(c){o.sync.send({type:"cdp.response",requestId:e,error:c instanceof Error?c.message:String(c)})}}forwardCDPRequest(e,n,r,i,a,s,o){const l=this.runtimeToBootstrap.get(n),c=l?this.followers.get(l):void 0,u=this.followers.get(o);if(!c){u&&u.sync.send({type:"cdp.response",requestId:e,error:`Target runtime "${n}" not connected`});return}this.pendingCDPRoutes.set(e,{requesterBootstrapId:o,requestId:e}),c.sync.send({type:"cdp.request",requestId:e,localTargetId:r,method:i,params:a,sessionId:s})}handleCDPResponse(e){const{requestId:n,result:r,error:i,chunkData:a,chunkIndex:s,totalChunks:o}=e,l=this.pendingCDPRoutes.get(n);if(!l)return;const c=my(this.cdpChunkBuffers,e);if(!c)return;if(this.pendingCDPRoutes.delete(n),l.requesterBootstrapId==="__leader__"){for(const d of this.remoteTransports.values())d.handleResponse(n,c.result,c.error);return}const u=this.followers.get(l.requesterBootstrapId);u&&S0(u.sync,n,c.result,c.error)}handleCDPEvent(e,n,r,i){let a;for(const[o,l]of this.runtimeToBootstrap)if(l===e){a=o;break}if(!a)return;const s=`${a}:`;for(const[o,l]of this.remoteTransports)o.startsWith(s)&&l.handleEvent(n,r)}openRemoteTab(e,n){const r=this.runtimeToBootstrap.get(e),i=r?this.followers.get(r):void 0;if(!i)return Promise.reject(new Error(`Target runtime "${e}" not connected`));const a=`tab-open-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise((s,o)=>{this.tabOpenResolvers.set(a,{resolve:s,reject:o}),this.pendingTabOpenRoutes.set(a,{requesterBootstrapId:"__leader__",requestId:a}),i.sync.send({type:"tab.open",requestId:a,url:n})})}async executeLocalTabOpen(e,n,r){const i=this.followers.get(r);if(!i)return;const a=this.options.browserTransport;if(!a){i.sync.send({type:"tab.open.error",requestId:e,error:"Leader has no browser transport"});return}try{const o=(await a.send("Target.createTarget",{url:n,background:!0})).targetId;i.sync.send({type:"tab.opened",requestId:e,targetId:`leader:${o}`})}catch(s){i.sync.send({type:"tab.open.error",requestId:e,error:s instanceof Error?s.message:String(s)})}}forwardTabOpen(e,n,r,i){const a=this.runtimeToBootstrap.get(n),s=a?this.followers.get(a):void 0,o=this.followers.get(i);if(!s){o&&o.sync.send({type:"tab.open.error",requestId:e,error:`Target runtime "${n}" not connected`});return}this.pendingTabOpenRoutes.set(e,{requesterBootstrapId:i,requestId:e}),s.sync.send({type:"tab.open",requestId:e,url:r})}handleTabOpenResponse(e,n){const r=this.pendingTabOpenRoutes.get(e);if(!r)return;if(this.pendingTabOpenRoutes.delete(e),r.requesterBootstrapId==="__leader__"){const a=this.tabOpenResolvers.get(e);a&&(this.tabOpenResolvers.delete(e),a.resolve(n));return}const i=this.followers.get(r.requesterBootstrapId);i&&i.sync.send({type:"tab.opened",requestId:e,targetId:n})}handleTabOpenError(e,n){const r=this.pendingTabOpenRoutes.get(e);if(!r)return;if(this.pendingTabOpenRoutes.delete(e),r.requesterBootstrapId==="__leader__"){const a=this.tabOpenResolvers.get(e);a&&(this.tabOpenResolvers.delete(e),a.reject(new Error(n)));return}const i=this.followers.get(r.requesterBootstrapId);i&&i.sync.send({type:"tab.open.error",requestId:e,error:n})}async executeLocalFs(e,n,r){const i=this.followers.get(r);if(!i)return;const a=this.options.vfs;if(!a){i.sync.send({type:"fs.response",requestId:e,response:{ok:!1,error:"Leader has no VFS"}});return}const s=await Dv(a,n);for(const o of s)i.sync.send({type:"fs.response",requestId:e,response:o})}forwardFsRequest(e,n,r,i){const a=this.runtimeToBootstrap.get(n),s=a?this.followers.get(a):void 0,o=this.followers.get(i);if(!s){o&&o.sync.send({type:"fs.response",requestId:e,response:{ok:!1,error:`Target runtime "${n}" not connected`}});return}this.pendingFsRoutes.set(e,{requesterBootstrapId:i,requestId:e,chunks:[],totalChunks:1}),s.sync.send({type:"fs.request",requestId:e,request:r})}handleFsResponse(e,n){const r=this.pendingFsRoutes.get(e);if(!r){const s=this.fsResolvers.get(e);if(s){s.responses.push(n);const o=n.ok&&n.totalChunks||1;s.responses.length>=o&&(this.fsResolvers.delete(e),s.resolve(s.responses))}return}if(r.requesterBootstrapId==="__leader__"){const s=this.fsResolvers.get(e);if(s){s.responses.push(n);const o=n.ok&&n.totalChunks||1;s.responses.length>=o&&(this.fsResolvers.delete(e),this.pendingFsRoutes.delete(e),s.resolve(s.responses))}return}const i=this.followers.get(r.requesterBootstrapId);i&&i.sync.send({type:"fs.response",requestId:e,response:n}),r.chunks.push(n);const a=n.ok&&n.totalChunks||1;r.totalChunks=a,r.chunks.length>=r.totalChunks&&this.pendingFsRoutes.delete(e)}sendFsRequest(e,n){if(e==="leader"){const s=this.options.vfs;return s?Dv(s,n):Promise.resolve([{ok:!1,error:"Leader has no VFS"}])}const r=this.runtimeToBootstrap.get(e),i=r?this.followers.get(r):void 0;if(!i)return Promise.resolve([{ok:!1,error:`Target runtime "${e}" not connected`}]);const a=`fs-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise((s,o)=>{this.fsResolvers.set(a,{resolve:s,reject:o,responses:[]}),this.pendingFsRoutes.set(a,{requesterBootstrapId:"__leader__",requestId:a,chunks:[],totalChunks:1}),i.sync.send({type:"fs.request",requestId:a,request:n})})}}const Vr=wn("tray-follower-sync");class Yce{constructor(e,n={}){this.options=n,this.sync=Jz(e),this.unsubscribe=this.sync.onMessage(r=>{this.handleLeaderMessage(r)}),this.keepalive=new hO({sendPing:()=>this.sync.send({type:"ping"}),onDead:()=>{Vr.warn("Leader keepalive dead, cleaning up"),this.handleDisconnect("Keepalive timeout — leader not responding"),this.options.onDead?.()}}),this.keepalive.start(),e.addEventListener("close",()=>{Vr.warn("Data channel closed"),this.handleDisconnect("Data channel closed")}),e.addEventListener("error",()=>{Vr.warn("Data channel error"),this.handleDisconnect("Data channel error")})}sync;eventListeners=new Set;unsubscribe;keepalive;latestSnapshot=null;sentMessageIds=new Set;targetEntries=[];remoteTransports=new Map;cdpChunkBuffers=new Map;snapshotChunkBuffer=null;remoteCDPSessions=new Set;cdpEventCleanups=[];tabOpenResolvers=new Map;fsResolvers=new Map;sendMessage(e,n){const r=n??`follower-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;this.sentMessageIds.add(r),this.sync.send({type:"user_message",text:e,messageId:r}),Vr.info("Sent user message to leader",{messageId:r})}onEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}stop(){this.sync.send({type:"abort"}),Vr.info("Sent abort to leader")}requestSnapshot(){this.sync.send({type:"request_snapshot"})}getLatestSnapshot(){return this.latestSnapshot}close(){this.keepalive.stop(),this.unsubscribe(),this.sync.close(),this.eventListeners.clear(),this.cleanupCDPEventForwarding(),Vr.info("Follower sync closed")}advertiseTargets(e,n){this.sync.send({type:"targets.advertise",targets:e,runtimeId:n})}getTargets(){return this.targetEntries}disconnected=!1;handleDisconnect(e){if(this.disconnected)return;this.disconnected=!0;const n=_s();na({...n,state:"error",error:e}),this.emitEvent({type:"error",error:`Connection to leader lost: ${e}`}),this.keepalive.stop(),this.cleanupCDPEventForwarding(),this.unsubscribe(),this.sync.close(),this.options.onDisconnect?.(e)}handleLeaderMessage(e){switch(e.type){case"snapshot":Vr.info("Snapshot received from leader",{messageCount:e.messages.length,scoopJid:e.scoopJid}),this.snapshotChunkBuffer=null,this.latestSnapshot={messages:e.messages,scoopJid:e.scoopJid},this.options.onSnapshot?.(e.messages,e.scoopJid);break;case"snapshot_chunk":{const n=Zz(this.snapshotChunkBuffer,e);this.snapshotChunkBuffer=n.buffer,n.result&&(Vr.info("Chunked snapshot reassembled from leader",{messageCount:n.result.messages.length,scoopJid:n.result.scoopJid}),this.latestSnapshot=n.result,this.options.onSnapshot?.(n.result.messages,n.result.scoopJid));break}case"agent_event":this.emitEvent(e.event);break;case"user_message_echo":if(this.sentMessageIds.has(e.messageId)){this.sentMessageIds.delete(e.messageId),Vr.debug("Skipping own message echo",{messageId:e.messageId});break}Vr.info("User message echo received",{messageId:e.messageId,scoopJid:e.scoopJid}),this.options.onUserMessage?.(e.text,e.messageId,e.scoopJid);break;case"status":this.options.onStatus?.(e.scoopStatus);break;case"error":Vr.warn("Error from leader",{error:e.error}),this.emitEvent({type:"error",error:e.error});break;case"targets.registry":Vr.info("Target registry received from leader",{targetCount:e.targets.length}),this.targetEntries=e.targets,this.options.onTargetsUpdated?.(this.targetEntries);break;case"cdp.request":{const{requestId:n,localTargetId:r,method:i,params:a,sessionId:s}=e;this.executeLocalCDP(n,r,i,a,s);break}case"cdp.response":{this.routeCDPResponse(e);break}case"cdp.event":{for(const n of this.remoteTransports.values())n.handleEvent(e.method,e.params);break}case"tab.open":{this.executeLocalTabOpen(e.requestId,e.url);break}case"tab.opened":{const n=this.tabOpenResolvers.get(e.requestId);n&&(this.tabOpenResolvers.delete(e.requestId),n.resolve(e.targetId));break}case"tab.open.error":{const n=this.tabOpenResolvers.get(e.requestId);n&&(this.tabOpenResolvers.delete(e.requestId),n.reject(new Error(e.error)));break}case"fs.request":{this.executeLocalFs(e.requestId,e.request);break}case"fs.response":{this.routeFsResponse(e.requestId,e.response);break}case"ping":{this.keepalive.receivePing(),this.sync.send({type:"pong"});break}case"pong":{this.keepalive.receivePong(),xW(Date.now());break}}}emitEvent(e){for(const n of this.eventListeners)try{n(e)}catch(r){Vr.error("Listener error",{eventType:e.type,error:r instanceof Error?r.message:String(r)})}}createRemoteTransport(e,n){const r={sendCDPRequest:(a,s,o,l)=>{this.sync.send({type:"cdp.request",requestId:a,targetRuntimeId:e,localTargetId:n,method:s,params:o,sessionId:l})}},i=new XS(r);return this.remoteTransports.set(`${e}:${n}`,i),i}removeRemoteTransport(e,n){const r=`${e}:${n}`,i=this.remoteTransports.get(r);i&&(i.disconnect(),this.remoteTransports.delete(r))}openRemoteTab(e,n){const r=`tab-open-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise((i,a)=>{this.tabOpenResolvers.set(r,{resolve:i,reject:a}),this.sync.send({type:"tab.open",requestId:r,targetRuntimeId:e,url:n})})}async executeLocalTabOpen(e,n){const r=this.options.browserTransport;if(!r){this.sync.send({type:"tab.open.error",requestId:e,error:"Follower has no browser transport"});return}try{const a=(await r.send("Target.createTarget",{url:n,background:!0})).targetId;this.sync.send({type:"tab.opened",requestId:e,targetId:a}),this.options.onTargetsChanged?.()}catch(i){this.sync.send({type:"tab.open.error",requestId:e,error:i instanceof Error?i.message:String(i)})}}async executeLocalCDP(e,n,r,i,a){const s=this.options.browserTransport;if(!s){this.sync.send({type:"cdp.response",requestId:e,error:"Follower has no browser transport"});return}try{const o=await s.send(r,i,a);if(r==="Target.attachToTarget"&&o.sessionId){const l=o.sessionId;this.remoteCDPSessions.add(l),this.setupCDPEventForwarding(s,l),Vr.debug("Tracking remote CDP session",{remoteSessionId:l})}r==="Target.detachFromTarget"&&a&&this.remoteCDPSessions.has(a)&&(this.remoteCDPSessions.delete(a),Vr.debug("Removed remote CDP session on detach",{sessionId:a})),S0(this.sync,e,o)}catch(o){this.sync.send({type:"cdp.response",requestId:e,error:o instanceof Error?o.message:String(o)})}}setupCDPEventForwarding(e,n){const r=["Page.frameNavigated","Page.loadEventFired","Page.domContentEventFired","Network.responseReceived","Network.loadingFinished","Network.requestWillBeSent"];for(const i of r){const a=s=>{if(s.sessionId!==n||!this.remoteCDPSessions.has(n))return;const{sessionId:o,...l}=s;this.sync.send({type:"cdp.event",method:i,params:l,sessionId:n})};e.on(i,a),this.cdpEventCleanups.push(()=>e.off(i,a))}}cleanupCDPEventForwarding(){for(const e of this.cdpEventCleanups)e();this.cdpEventCleanups.length=0,this.remoteCDPSessions.clear()}routeCDPResponse(e){const n=my(this.cdpChunkBuffers,e);if(n)for(const r of this.remoteTransports.values())r.handleResponse(e.requestId,n.result,n.error)}async executeLocalFs(e,n){const r=this.options.vfs;if(!r){this.sync.send({type:"fs.response",requestId:e,response:{ok:!1,error:"Follower has no VFS"}});return}const i=await Dv(r,n);for(const a of i)this.sync.send({type:"fs.response",requestId:e,response:a})}routeFsResponse(e,n){const r=this.fsResolvers.get(e);if(!r)return;r.responses.push(n);const i=n.ok&&n.totalChunks||1;r.responses.length>=i&&(this.fsResolvers.delete(e),r.resolve(r.responses))}sendFsRequest(e,n){const r=`fs-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise((i,a)=>{this.fsResolvers.set(r,{resolve:i,reject:a,responses:[]}),this.sync.send({type:"fs.request",requestId:r,targetRuntimeId:e,request:n})})}}const Xce="electron-overlay",nE="/electron",eue="slicc-electron-overlay:set-tab";function tue(t,e){if(e)return"extension";try{const n=new URL(t);return rue(n)?"electron-overlay":"standalone"}catch{return"standalone"}}function nue(t,e){return t==="electron-overlay"||t==="standalone"&&e}function rE(t){try{const n=new URL(t).searchParams.get("tab");return n&&JB(n)?n:n3}catch{return n3}}function rue(t){return t.pathname===nE||t.pathname===`${nE}/`||t.searchParams.get("runtime")===Xce}function iue(t){const e=new URL(t);return`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}/licks-ws`}function aue(t,e){return`${new URL(t).origin}/webhooks/${e}`}function sue(t,e){const n=t.replace(/\/+$/,""),r=e.replace(/^\/+/,"");return`${n}/${r}`}function oue(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type===eue}const lue=["/shared/sprinkles"];async function cue(t){const e=new Map;for(const n of lue)await t.exists(n)&&await iE(t,n,e);return await iE(t,"/",e),e}async function iE(t,e,n){for await(const r of t.walk(e)){if(!r.endsWith(".shtml"))continue;const i=uue(r);if(!n.has(i)){let a;try{a=await t.readFile(r,{encoding:"utf-8"})??""}catch{a=""}n.set(i,{name:i,path:r,title:due(a,i),autoOpen:pue(a)})}}}function uue(t){const e=t.split("/").pop()??t;return e.endsWith(".shtml")?e.slice(0,-6):e}function due(t,e){const n=t.match(/data-sprinkle-title=["']([^"']+)["']/);if(n)return n[1];const r=t.match(/<title>([^<]+)<\/title>/i);return r?r[1].trim():e}function pue(t){return/data-sprinkle-autoopen\b/.test(t)}class fue{listeners=new Map;lickHandler;fs;closeHandler;constructor(e,n,r){this.fs=e,this.lickHandler=n,this.closeHandler=r}createAPI(e){return{name:e,lick:n=>{const r=typeof n=="string"?n:n.action,i=typeof n=="string"?void 0:n.data,a={type:"sprinkle",sprinkleName:e,targetScoop:void 0,timestamp:new Date().toISOString(),body:{action:r,data:i}};this.lickHandler(a)},on:(n,r)=>{const i=`${e}:${n}`;let a=this.listeners.get(i);a||(a=new Set,this.listeners.set(i,a)),a.add(r)},off:(n,r)=>{const i=`${e}:${n}`;this.listeners.get(i)?.delete(r)},readFile:async n=>await this.fs.readFile(n,{encoding:"utf-8"}),setState:n=>{try{localStorage.setItem(`slicc-sprinkle-state:${e}`,JSON.stringify(n))}catch{}},getState:()=>{try{const n=localStorage.getItem(`slicc-sprinkle-state:${e}`);return n?JSON.parse(n):null}catch{return null}},open:n=>{const r=/^https?:|^chrome-extension:/.test(n)?n:ef(n);window.open(r,"_blank")},close:()=>this.closeHandler(e)}}pushUpdate(e,n){const r=`${e}:update`,i=this.listeners.get(r);if(i)for(const a of i)try{a(n)}catch{}}removeSprinkle(e){for(const n of this.listeners.keys())n.startsWith(`${e}:`)&&this.listeners.delete(n)}}const Xa=wn("sprinkle-manager"),aE="slicc-open-sprinkles";class mO{fs;bridge;callbacks;availableSprinkles=new Map;openSprinkles=new Map;constructor(e,n,r){this.fs=e,this.bridge=new fue(e,n,i=>this.close(i)),this.callbacks=r}async restoreOpenSprinkles(){try{const e=localStorage.getItem(aE);if(!e){for(const r of this.availableSprinkles.values())if(r.autoOpen)try{await this.open(r.name)}catch{Xa.warn("Failed to auto-open sprinkle",{name:r.name})}return}const n=JSON.parse(e);for(const r of n)try{await this.open(r)}catch{Xa.warn("Failed to restore sprinkle",{name:r})}}catch{}}persistOpenSprinkles(){try{localStorage.setItem(aE,JSON.stringify([...this.openSprinkles.keys()]))}catch{}}async openNewAutoOpenSprinkles(){await this.refresh();for(const e of this.availableSprinkles.values())if(e.autoOpen&&!this.openSprinkles.has(e.name))try{await this.open(e.name),Xa.info("Auto-opened new sprinkle after install",{name:e.name})}catch{Xa.warn("Failed to auto-open new sprinkle",{name:e.name})}}async refresh(){this.availableSprinkles=await cue(this.fs),Xa.info("Discovered sprinkles",{count:this.availableSprinkles.size})}async open(e,n){if(this.openSprinkles.has(e)){Xa.info("Sprinkle already open",{name:e});return}let r=this.availableSprinkles.get(e);if(r||(await this.refresh(),r=this.availableSprinkles.get(e)),!r)throw new Error(`Sprinkle not found: ${e}`);const i=await this.fs.readFile(r.path,{encoding:"utf-8"}),a=document.createElement("div");a.className="sprinkle-panel",a.style.cssText="width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden;",a.dataset.sprinkle=e,this.openSprinkles.set(e,{renderer:null,container:a}),this.callbacks.addSprinkle(e,r.title,a,n);const s=this.bridge.createAPI(e),o=new SE(a,s);await o.render(i,e),this.openSprinkles.get(e).renderer=o,this.persistOpenSprinkles(),wle(e),Xa.info("Sprinkle opened",{name:e,title:r.title})}close(e){const n=this.openSprinkles.get(e);n&&(n.renderer.dispose(),n.container.remove(),this.bridge.removeSprinkle(e),this.openSprinkles.delete(e),this.callbacks.removeSprinkle(e),this.persistOpenSprinkles(),Xa.info("Sprinkle closed",{name:e}))}available(){return Array.from(this.availableSprinkles.values())}opened(){return Array.from(this.openSprinkles.keys())}sendToSprinkle(e,n){const r=this.openSprinkles.get(e);if(!r){Xa.warn("Cannot send to closed sprinkle",{name:e});return}this.bridge.pushUpdate(e,n),r.renderer.pushUpdate(n)}}const _t=wn("main");function hue(){const t=document.createElement("div");t.className="skill-drop-overlay";const e=document.createElement("div");e.className="skill-drop-overlay__card";const n=document.createElement("div");n.className="skill-drop-overlay__title",e.appendChild(n);const r=document.createElement("div");return r.className="skill-drop-overlay__desc",e.appendChild(r),t.appendChild(e),document.body.appendChild(t),{show(i,a){n.textContent=i,r.textContent=a,t.classList.add("skill-drop-overlay--visible")},hide(){t.classList.remove("skill-drop-overlay--visible")}}}function gO(){const t=document.createElement("div");return t.className="skill-drop-toast-container",document.body.appendChild(t),(e,n)=>{const r=document.createElement("div");r.className=`skill-drop-toast skill-drop-toast--${n}`,r.textContent=e,t.appendChild(r),requestAnimationFrame(()=>r.classList.add("skill-drop-toast--visible"));const i=()=>{r.classList.remove("skill-drop-toast--visible"),window.setTimeout(()=>r.remove(),180)};window.setTimeout(i,4200)}}function vO(t,e,n){const r=hue();let i=0,a=!1;const s=()=>{i=0,a||r.hide()};window.addEventListener("dragenter",o=>{k3(o.dataTransfer)&&(o.preventDefault(),i+=1,a||r.show("Drop .skill to install","Unpack into /workspace/skills/{name}."))}),window.addEventListener("dragover",o=>{k3(o.dataTransfer)&&(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="copy"),a||r.show("Drop .skill to install","Unpack into /workspace/skills/{name}."))}),window.addEventListener("dragleave",()=>{i!==0&&(i=Math.max(0,i-1),i===0&&!a&&r.hide())}),window.addEventListener("dragend",s),window.addEventListener("blur",s),window.addEventListener("drop",async o=>{const l=Bz(o.dataTransfer);if(!l){s();return}if(o.preventDefault(),i=0,a){r.hide(),e("Another .skill installation is already in progress.","error");return}a=!0,r.show("Installing skill…",l.name);try{const c=await Uz(t,l);await n(),e(`Installed "${c.skillName}" to ${c.destinationPath} (${c.fileCount} files). Run "skill install ${c.skillName}" to apply it.`,"success")}catch(c){const u=c instanceof Error?c.message:String(c);e(`Failed to install dropped skill: ${u}`,"error")}finally{a=!1,r.hide()}})}async function mue(t){const{OffscreenClient:e}=await Vt(async()=>{const{OffscreenClient:f}=await import("./offscreen-client-Dj7EBRST.js");return{OffscreenClient:f}},[]),{VirtualFS:n}=await Vt(async()=>{const{VirtualFS:f}=await Promise.resolve().then(()=>Cz);return{VirtualFS:f}},void 0),r=new Uc(t,!0);window.__slicc_debug_tabs=f=>r.setDebugTabs(f),await r.panels.chat.initSession("session-cone");let i=null;const a=await n.create({dbName:"slicc-fs"});r.panels.fileBrowser.setFs(a),_t.info("File browser wired to shared VFS (local IndexedDB)");const s=new BroadcastChannel("preview-vfs");s.onmessage=f=>{if(f.data?.type!=="preview-vfs-read")return;const{id:h,path:m,asText:g}=f.data;(async()=>{try{const v=g?"utf-8":"binary",y=await a.readFile(m,{encoding:v});s.postMessage({type:"preview-vfs-response",id:h,content:y})}catch(v){const y=v instanceof Error?v.message:String(v);y.includes("ENOENT")||_t.error("Preview VFS read failed",{path:m,error:y}),s.postMessage({type:"preview-vfs-response",id:h,error:y})}})()};const o=gO();vO(a,o,async()=>{await r.panels.fileBrowser.refresh()});try{const{WasmShell:f}=await Vt(async()=>{const{WasmShell:b}=await Promise.resolve().then(()=>tO);return{WasmShell:b}},void 0),{PanelCdpProxy:h,BrowserAPI:m}=await Vt(async()=>{const{PanelCdpProxy:b,BrowserAPI:S}=await import("./index-DIookCYH.js");return{PanelCdpProxy:b,BrowserAPI:S}},[]),g=new h;await g.connect();const v=new m(g),y=new f({fs:a,browserAPI:v});await r.panels.terminal.mountShell(y),_t.info("Terminal mounted with shared VFS and BrowserAPI (CDP proxy)")}catch(f){_t.warn("Failed to mount shell to terminal",f)}let l,c=new Set;const u=async f=>{i=f,l.selectedScoopJid=f.jid,r.panels.memory.setSelectedScoop(f.jid),r.setScoopSwitcherSelected?.(f.jid),r.panels.scoops.setSelectedJid(f.jid);const h=f.isCone?"session-cone":`session-${f.folder}`,m=f.isCone?void 0:f.name;await r.panels.chat.switchToContext(h,!f.isCone,m),l.isProcessing(f.jid)&&r.panels.chat.setProcessing(!0)};l=new e({onStatusChange:(f,h)=>{r.panels.scoops.updateScoopStatus(f,h),r.updateScoopSwitcherStatus?.(f,h),i?.jid===f&&(r.setAgentProcessing(h==="processing"),h==="processing"?r.panels.chat.setProcessing(!0):h==="ready"&&r.panels.chat.setProcessing(!1))},onScoopCreated:f=>{r.panels.scoops.refreshScoops(),r.refreshScoopSwitcher?.(),i||(i=f,l.selectedScoopJid=f.jid,r.panels.memory.setSelectedScoop(f.jid))},onScoopListUpdate:()=>{const f=new Set(l.getScoops().map(h=>h.folder));for(const h of c)f.has(h)||r.panels.chat.deleteSessionById(`session-${h}`);if(c=f,r.panels.scoops.refreshScoops(),r.refreshScoopSwitcher?.(),!i){const m=l.getScoops().find(g=>g.isCone);m&&(i=m,l.selectedScoopJid=m.jid,r.panels.memory.setSelectedScoop(m.jid))}},onIncomingMessage:(f,h)=>{if(i?.jid===f){const m=h.channel==="delegation"?`**[Instructions from sliccy]**
|
|
14665
|
+
${p}`,timestamp:new Date().toISOString(),fromAssistant:!1,channel:"scoop-notify"};Bt.info("Routing scoop completion to cone",{scoop:n.folder,responseLength:u.length}),this.handleMessage(f).catch(h=>{const m=h instanceof Error?h.message:String(h);Bt.error("Failed to route scoop completion to cone",{scoop:n.folder,error:m}),this.callbacks.onError(d.jid,`Scoop ${n.folder} completed but notification failed: ${m}`)})}}}},onToolStart:(l,c)=>{this.callbacks.onToolStart?.(e,l,c)},onToolEnd:(l,c,u)=>{this.callbacks.onToolEnd?.(e,l,c,u)},onToolUI:(l,c,u)=>{this.callbacks.onToolUI?.(e,l,c,u)},onToolUIDone:l=>{this.callbacks.onToolUIDone?.(e,l)},onSendMessage:(l,c)=>{this.callbacks.onSendMessage(e,`${c?`[${c}] `:""}${l}`)},getScoops:()=>this.getScoops(),onFeedScoop:n.isCone?(l,c)=>this.delegateToScoop(l,c,n.assistantLabel):void 0,onScoopScoop:n.isCone?async l=>{const c={...l,jid:`scoop_${l.folder}_${Date.now()}`};return await this.registerScoop(c),c}:void 0,onDropScoop:n.isCone?async l=>{await this.unregisterScoop(l)}:void 0,getGlobalMemory:()=>this.getGlobalMemory(),setGlobalMemory:n.isCone?l=>this.setGlobalMemory(l):void 0,getBrowserAPI:()=>this.callbacks.getBrowserAPI()},s=new xce(n,a,i,this.sessionStore??void 0,this.sharedFs??void 0);this.contexts.set(e,s),this.tabs.set(e,{jid:e,contextId:r,status:"initializing",lastActivity:new Date().toISOString()}),await s.init();const o=this.tabs.get(e);o&&o.status==="initializing"&&(o.status="ready",this.tabs.set(e,o),this.callbacks.onStatusChange(e,"ready")),Bt.info("Scoop context created",{jid:e,contextId:r})}async destroyScoopTab(e){const n=this.contexts.get(e);n&&(n.dispose(),this.contexts.delete(e),this.tabs.delete(e),Bt.info("Scoop context destroyed",{jid:e}))}isProcessing(e){return this.tabs.get(e)?.status==="processing"}getScoopContext(e){return this.contexts.get(e)}async clearQueuedMessages(e){const n=this.messageQueues.get(e);if(n&&n.length>0){for(const r of n)await A3(r.id);this.messageQueues.set(e,[])}}async deleteQueuedMessage(e,n){const r=this.messageQueues.get(e);if(r){const i=r.findIndex(a=>a.id===n);i!==-1&&r.splice(i,1)}await A3(n)}async getMessagesForScoop(e){return nq(e)}async waitForTabReady(e,n=1e4){const r=Date.now();for(;Date.now()-r<n;){const i=this.tabs.get(e);if(!i)return!1;if(i.status==="ready"||i.status==="processing")return!0;if(i.status==="error")return!1;await new Promise(a=>setTimeout(a,100))}return Bt.warn("Timed out waiting for tab to become ready",{jid:e}),!1}async sendPrompt(e,n,r,i){let a=this.contexts.get(e);a||(await this.createScoopTab(e),a=this.contexts.get(e));let s=this.tabs.get(e);if(s?.status==="initializing"){if(Bt.debug("Context initializing, waiting to send message",{jid:e}),!await this.waitForTabReady(e)){Bt.error("Context did not become ready in time, dropping prompt",{jid:e});return}a=this.contexts.get(e),s=this.tabs.get(e)}if(!a){Bt.error("Context not found after creation",{jid:e});return}this.scoopResponseBuffer.delete(e),s&&(s.status="processing",s.lastActivity=new Date().toISOString(),this.tabs.set(e,s),this.callbacks.onStatusChange(e,"processing")),Bt.debug("Prompt sent to scoop",{jid:e,textLength:n.length}),await a.prompt(n)}async processScoopQueue(e){const n=this.messageQueues.get(e);if(!n||n.length===0){Bt.debug("processScoopQueue: empty queue",{jid:e});return}const r=this.tabs.get(e);if(r?.status!=="ready"){Bt.debug("processScoopQueue: tab not ready",{jid:e,status:r?.status??"no-tab"});return}const i=this.scoops.get(e),a=i?.assistantLabel??e,s=this.lastAgentTimestamp.get(e)??"",o=await rq(e,s,a);if(Bt.debug("processScoopQueue: DB query",{jid:e,scoopName:i?.name,excludeName:a,since:s,dbMessageCount:o.length,queueLength:n.length}),o.length===0){Bt.debug("processScoopQueue: no messages from DB, clearing queue",{jid:e}),this.messageQueues.set(e,[]);return}const l=o.map(u=>`[${new Date(u.timestamp).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}] ${u.senderName}: ${u.content}`).join(`
|
|
14666
|
+
`);this.messageQueues.set(e,[]);const c=o[o.length-1];this.lastAgentTimestamp.set(e,c.timestamp),await C0(`lastAgentTs_${e}`,c.timestamp),await this.sendPrompt(e,l,c.senderId,c.senderName)}startMessageLoop(){this.pollInterval||(this.pollInterval=window.setInterval(()=>{for(const e of this.scoops.keys())this.tabs.get(e)?.status==="ready"&&this.processScoopQueue(e).catch(r=>{const i=r instanceof Error?r.message:String(r);Bt.error("Message queue processing failed",{jid:e,error:i}),this.callbacks.onError(e,`Queue processing failed: ${i}`)})},2e3))}stopMessageLoop(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}updateModel(){for(const e of this.contexts.values())e.updateModel();Bt.info("Model updated on all active contexts",{contextCount:this.contexts.size})}async reloadAllSkills(){const e=[];for(const[n,r]of this.contexts){const i=this.tabs.get(n);(i?.status==="ready"||i?.status==="processing")&&e.push(r.reloadSkills().catch(a=>{Bt.warn("Failed to reload skills for scoop",{jid:n,error:a instanceof Error?a.message:String(a)})}))}await Promise.all(e),Bt.info("Skills reloaded across all contexts",{count:e.length})}stopScoop(e){const n=this.contexts.get(e);n&&n.stop()}async shutdown(){this.stopMessageLoop(),this.scheduler?.stop(),this.scheduler=null;for(const e of this.contexts.keys())await this.destroyScoopTab(e);Bt.info("Orchestrator shutdown")}}const cO=wn("tray-follower");async function Ace(t){const e=await(t.fetchImpl??fetch)(t.joinUrl,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({controllerId:t.controllerId,runtime:t.runtime})}),n=await Nce(e);return cO.info("Follower tray attach response",{trayId:n.trayId,action:n.result.action,code:n.result.code,participantCount:n.participantCount}),Tce(n)}function Tce(t){const e={trayId:t.trayId,controllerId:t.controllerId,participantCount:t.participantCount,leader:t.leader,action:t.result.action,code:t.result.code,iceServers:t.iceServers};return t.result.action==="wait"?{...e,retryAfterMs:t.result.retryAfterMs}:t.result.action==="signal"?{...e,bootstrap:t.result.bootstrap}:t.result.action==="fail"?{...e,error:t.result.error}:e}async function _ce(t){return Vf(await Zf(t,{action:"poll",controllerId:t.controllerId,bootstrapId:t.bootstrapId,cursor:t.cursor}))}async function Ice(t){return Vf(await Zf(t,{action:"answer",controllerId:t.controllerId,bootstrapId:t.bootstrapId,answer:t.answer}))}async function Rce(t){return Vf(await Zf(t,{action:"ice-candidate",controllerId:t.controllerId,bootstrapId:t.bootstrapId,candidate:t.candidate}))}async function $ce(t){return Vf(await Zf(t,{action:"retry",controllerId:t.controllerId,bootstrapId:t.bootstrapId,runtime:t.runtime}))}function Vf(t){return{trayId:t.trayId,controllerId:t.controllerId,participantCount:t.participantCount,leader:t.leader,bootstrap:t.bootstrap,events:t.events}}async function Nce(t){let e=null,n=null;try{e=await t.text(),n=JSON.parse(e)}catch{}if(!Pce(n)){const r=e?e.slice(0,200):"(empty)";throw cO.warn("Tray follower attach returned an invalid response",{status:t.status,body:r}),new Error(`Tray follower attach returned an invalid response (${t.status}): ${r}`)}return n}async function Zf(t,e){const n=await(t.fetchImpl??fetch)(t.joinUrl,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),r=await n.json().catch(()=>null);if(!Oce(r))throw new Error(`Tray follower bootstrap returned an invalid response (${n.status})`);return r}function Pce(t){if(!t||typeof t!="object")return!1;const e=t;if(typeof e.trayId!="string"||typeof e.controllerId!="string"||e.role!=="follower"||typeof e.participantCount!="number")return!1;const n=e.result;if(!n||typeof n!="object")return!1;const r=n;return r.action==="wait"?(r.code==="LEADER_NOT_ELECTED"||r.code==="LEADER_NOT_CONNECTED")&&typeof r.retryAfterMs=="number":r.action==="signal"?r.code==="LEADER_CONNECTED"&&uO(r.bootstrap):r.action==="fail"?(r.code==="INVALID_JOIN_CAPABILITY"||r.code==="TRAY_EXPIRED")&&typeof r.error=="string":!1}function Oce(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.trayId=="string"&&typeof e.controllerId=="string"&&e.role==="follower"&&typeof e.participantCount=="number"&&uO(e.bootstrap)&&Array.isArray(e.events)}function uO(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.controllerId=="string"&&typeof e.bootstrapId=="string"&&typeof e.attempt=="number"&&typeof e.state=="string"&&typeof e.expiresAt=="string"&&typeof e.cursor=="number"&&typeof e.maxRetries=="number"&&typeof e.retriesRemaining=="number"}const or=wn("tray-webrtc"),Mce="tray-control",Lce=250;class Dce{constructor(e){this.options=e,this.iceServers=e.iceServers,this.peerConnectionFactory=e.peerConnectionFactory??(()=>dO(this.iceServers)),this.dataChannelLabel=e.dataChannelLabel??Mce}peerConnectionFactory;dataChannelLabel;peers=new Map;iceServers;setIceServers(e){this.iceServers=e}async handleControlMessage(e){e.type==="follower.join_requested"?(e.iceServers&&!this.iceServers&&(this.iceServers=e.iceServers),await this.handleJoinRequested(e)):e.type==="bootstrap.answer"?await this.peers.get(e.bootstrapId)?.peer.setRemoteDescription(e.answer):e.type==="bootstrap.ice_candidate"&&await this.peers.get(e.bootstrapId)?.peer.addIceCandidate(e.candidate)}getPeers(){return Array.from(this.peers.values()).map(({state:e})=>({...e}))}getChannel(e){return this.peers.get(e)?.channel??null}stop(){for(const e of this.peers.values())e.peer.close();this.peers.clear()}async handleJoinRequested(e){this.closeControllerPeers(e.controllerId);const n=this.peerConnectionFactory(),r={controllerId:e.controllerId,bootstrapId:e.bootstrapId,attempt:e.attempt,state:"connecting",connectedAt:null,runtime:e.runtime},i=n.createDataChannel(this.dataChannelLabel);this.peers.set(e.bootstrapId,{state:r,peer:n,channel:i}),n.addEventListener("icecandidate",({candidate:a})=>{const s=fO(a);s&&this.options.sendControlMessage({type:"bootstrap.ice_candidate",controllerId:e.controllerId,bootstrapId:e.bootstrapId,candidate:s})}),n.addEventListener("connectionstatechange",()=>{const a=this.peers.get(e.bootstrapId);a&&(a.state.state!=="connected"?n.connectionState==="failed"&&this.failPeer(e,"Leader peer connection failed before the data channel opened"):(n.connectionState==="disconnected"||n.connectionState==="failed")&&(or.warn("Leader peer connection state changed post-connect",{bootstrapId:e.bootstrapId,state:n.connectionState}),this.options.onPeerDisconnected?.(e.bootstrapId,`Peer connection ${n.connectionState}`)))}),i.addEventListener("open",()=>{const a=this.peers.get(e.bootstrapId);!a||a.state.state==="connected"||(a.state.state="connected",a.state.connectedAt=new Date().toISOString(),this.options.onPeerConnected?.({...a.state},a.channel))}),i.addEventListener("close",()=>{const a=this.peers.get(e.bootstrapId);a&&(a.state.state!=="connected"?this.failPeer(e,"Leader data channel closed before opening"):(or.warn("Leader data channel closed post-connect",{bootstrapId:e.bootstrapId}),this.options.onPeerDisconnected?.(e.bootstrapId,"Data channel closed")))}),i.addEventListener("error",()=>{const a=this.peers.get(e.bootstrapId);a&&(a.state.state!=="connected"?this.failPeer(e,"Leader data channel failed before opening"):(or.warn("Leader data channel error post-connect",{bootstrapId:e.bootstrapId}),this.options.onPeerDisconnected?.(e.bootstrapId,"Data channel error")))});try{const a=await n.createOffer();await n.setLocalDescription(a),this.options.sendControlMessage({type:"bootstrap.offer",controllerId:e.controllerId,bootstrapId:e.bootstrapId,offer:pO(n.localDescription??a,"offer")})}catch(a){this.failPeer(e,a instanceof Error?a.message:String(a))}}closeControllerPeers(e){for(const[n,r]of this.peers.entries())r.state.controllerId===e&&(r.peer.close(),this.peers.delete(n))}failPeer(e,n){const r=this.peers.get(e.bootstrapId);if(r){r.peer.close(),this.peers.delete(e.bootstrapId);try{this.options.sendControlMessage({type:"bootstrap.failed",controllerId:e.controllerId,bootstrapId:e.bootstrapId,code:"WEBRTC_BOOTSTRAP_FAILED",message:n,retryable:!0,retryAfterMs:1e3})}catch(i){or.warn("Failed to report tray bootstrap failure",{error:i instanceof Error?i.message:String(i)})}}}}class Fce{constructor(e){this.options=e,this.fetchImpl=e.fetchImpl??fetch,this.iceServers=e.iceServers,this.peerConnectionFactory=e.peerConnectionFactory??(()=>dO(this.iceServers)),this.controllerIdFactory=e.controllerIdFactory??(()=>crypto.randomUUID()),this.sleep=e.sleep??(n=>new Promise(r=>setTimeout(r,n))),this.pollIntervalMs=e.pollIntervalMs??Lce}fetchImpl;peerConnectionFactory;controllerIdFactory;sleep;pollIntervalMs;iceServers;activePeer=null;stopped=!1;async start(){this.stopped=!1;const e=this.controllerIdFactory(),n=Date.now();na({state:"connecting",joinUrl:this.options.joinUrl,trayId:null,error:null,lastPingTime:null,reconnectAttempts:0,attachAttempts:0,lastAttachCode:null,connectingSince:n,lastError:null}),or.info("Follower tray join starting",{joinUrl:this.options.joinUrl});let r=0;for(;;){X8(this.stopped),r++;let i;try{i=await Ace({joinUrl:this.options.joinUrl,controllerId:e,runtime:this.options.runtime,fetchImpl:this.fetchImpl})}catch(a){const s=a instanceof Error?a.message:String(a);throw na({..._s(),attachAttempts:r,lastError:s}),a}if(na({..._s(),attachAttempts:r,lastAttachCode:i.code}),i.action==="wait"){const a=i.retryAfterMs??1e3;or.info("Follower tray attach waiting",{attempt:r,code:i.code,retryAfterMs:a}),r%10===0&&or.warn(`Follower tray attach still waiting after ${r} attempts`,{attempt:r,code:i.code,retryAfterMs:a}),await this.sleep(a);continue}if(i.action==="fail"||!i.bootstrap){const a=i.error??`Tray follower attach failed (${i.code})`;throw na({state:"error",joinUrl:this.options.joinUrl,trayId:null,error:a,lastPingTime:null,reconnectAttempts:0,attachAttempts:r,lastAttachCode:i.code,connectingSince:null,lastError:a}),or.warn("Follower tray attach failed",{error:a}),new Error(a)}i.iceServers&&(this.iceServers=i.iceServers);try{const a=await this.completeBootstrap(i.trayId,e,i.bootstrap);return na({state:"connected",joinUrl:this.options.joinUrl,trayId:a.trayId,error:null,lastPingTime:null,reconnectAttempts:0,attachAttempts:r,lastAttachCode:i.code,connectingSince:null,lastError:null}),or.info("Follower tray connected",{trayId:a.trayId,controllerId:e}),a}catch(a){const s=a instanceof Error?a.message:String(a);throw na({state:"error",joinUrl:this.options.joinUrl,trayId:i.trayId,error:s,lastPingTime:null,reconnectAttempts:0,attachAttempts:r,lastAttachCode:i.code,connectingSince:null,lastError:s}),or.warn("Follower tray bootstrap failed",{error:s}),a}}}stop(){this.stopped=!0,this.activePeer?.peer.close(),this.activePeer?.channel?.close(),this.activePeer=null,na({state:"inactive",joinUrl:null,trayId:null,error:null,lastPingTime:null,reconnectAttempts:0,attachAttempts:0,lastAttachCode:null,connectingSince:null,lastError:null})}async completeBootstrap(e,n,r){let i=r,a=0;for(this.activePeer=this.createFollowerPeer(n,i.bootstrapId);;){if(X8(this.stopped),this.activePeer.open&&this.activePeer.channel)return{trayId:e,controllerId:n,bootstrapId:i.bootstrapId,channel:this.activePeer.channel};if(this.activePeer.openError)throw new Error(this.activePeer.openError);const s=await _ce({joinUrl:this.options.joinUrl,controllerId:n,bootstrapId:i.bootstrapId,cursor:a,fetchImpl:this.fetchImpl});i=s.bootstrap,a=i.cursor;try{for(const o of s.events)if(o.type==="bootstrap.offer"){await this.activePeer.peer.setRemoteDescription(o.offer);const l=await this.activePeer.peer.createAnswer();await this.activePeer.peer.setLocalDescription(l),await Ice({joinUrl:this.options.joinUrl,controllerId:n,bootstrapId:i.bootstrapId,answer:pO(this.activePeer.peer.localDescription??l,"answer"),fetchImpl:this.fetchImpl})}else if(o.type==="bootstrap.ice_candidate")await this.activePeer.peer.addIceCandidate(o.candidate);else if(o.type==="bootstrap.failed")throw new Error(o.failure.message)}catch(o){if(i.failure?.retryable&&i.retriesRemaining>0){i=(await $ce({joinUrl:this.options.joinUrl,controllerId:n,bootstrapId:i.bootstrapId,runtime:this.options.runtime,fetchImpl:this.fetchImpl})).bootstrap,a=0,this.activePeer.peer.close(),this.activePeer=this.createFollowerPeer(n,i.bootstrapId);continue}throw o}this.activePeer.open||await this.sleep(this.pollIntervalMs)}}createFollowerPeer(e,n){const r=this.peerConnectionFactory(),i={peer:r,channel:null,open:!1,openError:null};return r.addEventListener("connectionstatechange",()=>{i.open&&(r.connectionState==="disconnected"||r.connectionState==="failed")&&(or.warn("Follower peer connection state changed post-connect",{bootstrapId:n,state:r.connectionState}),this.options.onDisconnected?.(`Peer connection ${r.connectionState}`))}),r.addEventListener("datachannel",({channel:a})=>{i.channel=a,a.addEventListener("open",()=>{i.open=!0}),a.addEventListener("close",()=>{i.open?(or.warn("Follower data channel closed post-connect",{bootstrapId:n}),this.options.onDisconnected?.("Data channel closed")):i.openError="Follower data channel closed before opening"}),a.addEventListener("error",()=>{i.open?(or.warn("Follower data channel error post-connect",{bootstrapId:n}),this.options.onDisconnected?.("Data channel error")):i.openError="Follower data channel failed before opening"})}),r.addEventListener("icecandidate",({candidate:a})=>{const s=fO(a);s&&Rce({joinUrl:this.options.joinUrl,controllerId:e,bootstrapId:n,candidate:s,fetchImpl:this.fetchImpl}).catch(o=>{or.warn("Failed to send follower ICE candidate",{error:o instanceof Error?o.message:String(o)})})}),i}}function Uce(t,e){const n=e.baseDelayMs??1e3,r=e.backoffMultiplier??2,i=e.maxDelayMs??3e4,a=e.maxAttempts??10,s=e.sleep??t.sleep??(h=>new Promise(m=>setTimeout(m,h)));let o=!1,l=!1,c=null;const u={cancel(){o=!0,l=!1,c?.stop(),c=null},get reconnecting(){return l}},d=()=>{const h=new Fce({...t,sleep:s,onDisconnected:m=>{o||(or.warn("Follower disconnected, starting reconnect loop",{reason:m}),p(m))}});return c=h,{manager:h,connectionPromise:h.start()}},p=async h=>{if(o||l)return;l=!0,c?.stop(),c=null;let m=0,g=n,v=h??"Unknown disconnect";for(;!o&&m<a&&(m++,e.onReconnecting?.(m),na({..._s(),state:"reconnecting",error:null,reconnectAttempts:m}),or.info("Reconnect attempt",{attempt:m,delay:g}),await s(g),!o);){let y=null;try{const b=d();y=b.manager;const S=await b.connectionPromise;if(o){y.stop();break}l=!1,na({..._s(),state:"connected",joinUrl:t.joinUrl,trayId:S.trayId,error:null,lastPingTime:null,reconnectAttempts:0,connectingSince:null,lastError:null}),or.info("Reconnect successful",{attempt:m,trayId:S.trayId}),e.onConnected(S);return}catch(b){v=b instanceof Error?b.message:String(b),or.warn("Reconnect attempt failed",{attempt:m,error:v}),y?.stop(),c=null}g=Math.min(g*r,i)}o||(l=!1,na({..._s(),state:"error",error:`Reconnect failed after ${m} attempts: ${v}`,reconnectAttempts:m}),or.warn("Reconnect gave up",{attempts:m,lastError:v}),e.onGaveUp?.(v))},{connectionPromise:f}=d();return f.then(h=>{o||e.onConnected(h)}).catch(h=>{o||or.warn("Initial follower connection failed",{error:h instanceof Error?h.message:String(h)})}),u}function dO(t){if(typeof RTCPeerConnection>"u")throw new Error("RTCPeerConnection is not available in this runtime");const e=t?.length?{iceServers:t}:void 0;return new RTCPeerConnection(e)}function pO(t,e){if(!t||t.type!==e||typeof t.sdp!="string")throw new Error(`Expected a local ${e} description before signaling`);return{type:t.type,sdp:t.sdp}}function fO(t){if(!t||typeof t!="object")return null;const e=t;return typeof e.candidate=="string"?{candidate:e.candidate,sdpMid:typeof e.sdpMid=="string"?e.sdpMid:null,sdpMLineIndex:typeof e.sdpMLineIndex=="number"?e.sdpMLineIndex:null,usernameFragment:typeof e.usernameFragment=="string"?e.usernameFragment:null}:null}function X8(t){if(t)throw new Error("Tray follower stopped before WebRTC bootstrap completed")}const Fd=64*1024;async function Dv(t,e){try{switch(e.op){case"readFile":return await Wce(t,e.path,e.encoding);case"writeFile":return[await Bce(t,e.path,e.content,e.encoding)];case"stat":return[await zce(t,e.path)];case"readDir":return[await qce(t,e.path)];case"mkdir":return[await jce(t,e.path,e.recursive)];case"rm":return[await Gce(t,e.path,e.recursive)];case"exists":return[await Hce(t,e.path)];case"walk":return[await Vce(t,e.path)];default:return[{ok:!1,error:`Unknown fs operation: ${e.op}`}]}}catch(n){return[Zce(n)]}}async function Wce(t,e,n){if((n??"utf-8")==="utf-8"){const s=await t.readFile(e,{encoding:"utf-8"});return eE(s,"utf-8")}const i=await t.readFile(e,{encoding:"binary"}),a=Kce(i);return eE(a,"base64")}async function Bce(t,e,n,r){if(r==="base64"){const i=Jce(n);await t.writeFile(e,i)}else await t.writeFile(e,n);return{ok:!0,data:{type:"void"}}}async function zce(t,e){return{ok:!0,data:{type:"stat",stat:await t.stat(e)}}}async function qce(t,e){return{ok:!0,data:{type:"dirEntries",entries:await t.readDir(e)}}}async function jce(t,e,n){return await t.mkdir(e,{recursive:n}),{ok:!0,data:{type:"void"}}}async function Gce(t,e,n){return await t.rm(e,{recursive:n}),{ok:!0,data:{type:"void"}}}async function Hce(t,e){return{ok:!0,data:{type:"exists",exists:await t.exists(e)}}}async function Vce(t,e){const n=[];for await(const r of t.walk(e))n.push(r);return{ok:!0,data:{type:"paths",paths:n}}}function eE(t,e){if(t.length<=Fd)return[{ok:!0,data:{type:"file",content:t,encoding:e}}];const n=Math.ceil(t.length/Fd),r=[];for(let i=0;i<n;i++){const a=i*Fd,s=t.slice(a,a+Fd);r.push({ok:!0,data:{type:"file",content:s,encoding:e},chunkIndex:i,totalChunks:n})}return r}function Zce(t){return t instanceof Error&&"code"in t?{ok:!1,error:t.message,code:t.code}:{ok:!1,error:t instanceof Error?t.message:String(t)}}function Kce(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function Jce(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}class Qce{runtimes=new Map;dirty=!1;setTargets(e,n){this.runtimes.set(e,n),this.dirty=!0}removeRuntime(e){this.runtimes.delete(e)&&(this.dirty=!0)}getEntries(){this.dirty=!1;const e=[];for(const[n,r]of this.runtimes)for(const i of r)e.push({targetId:`${n}:${i.targetId}`,localTargetId:i.targetId,runtimeId:n,title:i.title,url:i.url,isLocal:!1});return e}hasChanged(){return this.dirty}getRuntimeIds(){return[...this.runtimes.keys()]}}const tE=wn("data-channel-keepalive");class hO{sendPing;onDead;intervalMs;maxMissed;timer=null;missedPongs=0;awaitingPong=!1;stopped=!1;constructor(e){this.sendPing=e.sendPing,this.onDead=e.onDead,this.intervalMs=e.intervalMs??1e4,this.maxMissed=e.maxMissed??3}start(){this.timer||this.stopped||(this.timer=setInterval(()=>this.tick(),this.intervalMs))}stop(){this.stopped=!0,this.timer&&(clearInterval(this.timer),this.timer=null)}receivePong(){this.awaitingPong=!1,this.missedPongs=0}receivePing(){this.missedPongs=0,this.awaitingPong=!1}get missed(){return this.missedPongs}tick(){if(!this.stopped){if(this.awaitingPong&&(this.missedPongs++,tE.debug("Missed pong",{missedPongs:this.missedPongs,maxMissed:this.maxMissed}),this.missedPongs>=this.maxMissed)){tE.warn("Channel declared dead",{missedPongs:this.missedPongs}),this.stop(),this.onDead();return}this.awaitingPong=!0,this.sendPing()}}}const ka=wn("tray-leader-sync");function Yce(t){return t?t.includes("standalone")?"standalone":t.includes("extension")?"extension":t.includes("electron")?"electron":"unknown":"unknown"}class Xce{constructor(e){this.options=e}followers=new Map;registry=new Qce;runtimeToBootstrap=new Map;pendingCDPRoutes=new Map;cdpChunkBuffers=new Map;remoteTransports=new Map;pendingTabOpenRoutes=new Map;tabOpenResolvers=new Map;pendingFsRoutes=new Map;fsResolvers=new Map;addFollower(e,n,r){this.removeFollower(e);const i=Kz(n),a=i.onMessage(l=>{this.handleFollowerMessage(e,l)}),s=new hO({sendPing:()=>i.send({type:"ping"}),onDead:()=>{ka.warn("Follower keepalive dead, removing follower",{bootstrapId:e}),this.removeFollower(e),this.options.onFollowerDead?.(e)}});s.start(),this.followers.set(e,{bootstrapId:e,sync:i,unsubscribe:a,keepalive:s,runtime:r?.runtime,connectedAt:r?.connectedAt,lastActivity:Date.now(),floatType:Yce(r?.runtime)}),ka.info("Follower added to sync",{bootstrapId:e,followerCount:this.followers.size}),this.sendSnapshotToFollower(e);const o=this.getConnectedEntries();o.length>0&&i.send({type:"targets.registry",targets:o})}removeFollower(e){const n=this.followers.get(e);if(n){n.keepalive.stop(),n.unsubscribe(),n.sync.close(),this.followers.delete(e);for(const[r,i]of this.runtimeToBootstrap)if(i===e){this.cleanupRemoteTransports(r),this.registry.removeRuntime(r),this.runtimeToBootstrap.delete(r);break}this.registry.hasChanged()&&this.broadcastTargetRegistry(),ka.info("Follower removed from sync",{bootstrapId:e,followerCount:this.followers.size})}}broadcastEvent(e){if(this.followers.size===0)return;const n=this.options.getScoopJid(),r={type:"agent_event",event:e,scoopJid:n};for(const i of this.followers.values())i.sync.send(r)}broadcastUserMessage(e,n){if(this.followers.size===0)return;const r=this.options.getScoopJid(),i={type:"user_message_echo",text:e,messageId:n,scoopJid:r};for(const a of this.followers.values())a.sync.send(i)}broadcastStatus(e){if(this.followers.size===0)return;const n={type:"status",scoopStatus:e};for(const r of this.followers.values())r.sync.send(n)}sendSnapshotToFollower(e){const n=this.followers.get(e);if(!n)return;const r=this.options.getMessages(),i=this.options.getScoopJid();Vz(n.sync,r,i),ka.debug("Snapshot sent to follower",{bootstrapId:e,messageCount:r.length})}handleFollowerMessage(e,n){switch(n.type){case"user_message":ka.info("Follower user message received",{bootstrapId:e,messageId:n.messageId}),this.options.onFollowerMessage(n.text,n.messageId);break;case"abort":ka.info("Follower abort received",{bootstrapId:e}),this.options.onFollowerAbort();break;case"request_snapshot":ka.info("Follower snapshot request received",{bootstrapId:e}),this.sendSnapshotToFollower(e);break;case"targets.advertise":{ka.info("Follower targets advertised",{bootstrapId:e,runtimeId:n.runtimeId,targetCount:n.targets.length});for(const r of[...this.remoteTransports.keys()]){const i=r.substring(0,r.indexOf(":"));i!=="leader"&&!this.runtimeToBootstrap.has(i)&&i!==n.runtimeId&&(this.remoteTransports.get(r)?.disconnect(),this.remoteTransports.delete(r),ka.debug("Cleaned up orphaned remote transport on advertise",{key:r}))}this.runtimeToBootstrap.set(n.runtimeId,e),this.registry.setTargets(n.runtimeId,n.targets),this.broadcastTargetRegistry();break}case"cdp.request":{const{requestId:r,targetRuntimeId:i,localTargetId:a,method:s,params:o,sessionId:l}=n;i==="leader"?this.executeLocalCDP(r,a,s,o,l,e):this.forwardCDPRequest(r,i,a,s,o,l,e);break}case"cdp.response":{this.handleCDPResponse(n);break}case"cdp.event":{this.handleCDPEvent(e,n.method,n.params,n.sessionId);break}case"tab.open":{const{requestId:r,targetRuntimeId:i,url:a}=n;i==="leader"?this.executeLocalTabOpen(r,a,e):this.forwardTabOpen(r,i,a,e);break}case"tab.opened":{this.handleTabOpenResponse(n.requestId,n.targetId);break}case"tab.open.error":{this.handleTabOpenError(n.requestId,n.error);break}case"fs.request":{const{requestId:r,targetRuntimeId:i,request:a}=n;i==="leader"?this.executeLocalFs(r,a,e):this.forwardFsRequest(r,i,a,e);break}case"fs.response":{this.handleFsResponse(n.requestId,n.response);break}case"ping":{const r=this.followers.get(e);r&&(r.keepalive.receivePing(),r.lastActivity=Date.now(),r.sync.send({type:"pong"}));break}case"pong":{const r=this.followers.get(e);r&&(r.keepalive.receivePong(),r.lastActivity=Date.now());break}}}setLocalTargets(e){this.registry.setTargets("leader",e),this.registry.hasChanged()&&this.broadcastTargetRegistry()}broadcastTargetRegistry(){if(this.followers.size===0)return;const n={type:"targets.registry",targets:this.getConnectedEntries()};for(const r of this.followers.values())r.sync.send(n)}getTargets(){return this.getConnectedEntries()}getConnectedEntries(){return this.registry.getEntries().filter(e=>{if(e.runtimeId==="leader")return!0;const n=this.runtimeToBootstrap.get(e.runtimeId);return n?this.followers.has(n):!1})}createRemoteTransport(e,n){const r={sendCDPRequest:(a,s,o,l)=>{const c=this.runtimeToBootstrap.get(e),u=c?this.followers.get(c):void 0;if(!u){this.remoteTransports.get(`${e}:${n}`)?.handleResponse(a,void 0,`Target runtime "${e}" not connected`);return}this.pendingCDPRoutes.set(a,{requesterBootstrapId:"__leader__",requestId:a}),u.sync.send({type:"cdp.request",requestId:a,localTargetId:n,method:s,params:o,sessionId:l})}},i=new XS(r);return this.remoteTransports.set(`${e}:${n}`,i),i}removeRemoteTransport(e,n){const r=`${e}:${n}`,i=this.remoteTransports.get(r);i&&(i.disconnect(),this.remoteTransports.delete(r))}cleanupRemoteTransports(e){const n=`${e}:`;for(const r of[...this.remoteTransports.keys()])r.startsWith(n)&&(this.remoteTransports.get(r)?.disconnect(),this.remoteTransports.delete(r),ka.debug("Cleaned up stale remote transport",{key:r}))}getConnectedFollowers(){return[...this.runtimeToBootstrap.entries()].map(([e,n])=>{const r=this.followers.get(n);return{runtimeId:e,runtime:r?.runtime,connectedAt:r?.connectedAt,lastActivity:r?.lastActivity,floatType:r?.floatType}})}getBestFollowerForTeleport(){const e=[];for(const[i,a]of this.runtimeToBootstrap){const s=this.followers.get(a);s&&e.push({runtimeId:i,bootstrapId:a,floatType:s.floatType,lastActivity:s.lastActivity})}if(e.length===0)return null;const n=e.filter(i=>i.floatType==="standalone"),r=n.length>0?n:e;return r.sort((i,a)=>a.lastActivity-i.lastActivity),r[0]}get hasFollowers(){return this.followers.size>0}stop(){for(const e of[...this.followers.keys()])this.removeFollower(e)}async executeLocalCDP(e,n,r,i,a,s){const o=this.followers.get(s);if(!o)return;const l=this.options.browserTransport;if(!l){o.sync.send({type:"cdp.response",requestId:e,error:"Leader has no browser transport"});return}try{const c=await l.send(r,i,a);S0(o.sync,e,c)}catch(c){o.sync.send({type:"cdp.response",requestId:e,error:c instanceof Error?c.message:String(c)})}}forwardCDPRequest(e,n,r,i,a,s,o){const l=this.runtimeToBootstrap.get(n),c=l?this.followers.get(l):void 0,u=this.followers.get(o);if(!c){u&&u.sync.send({type:"cdp.response",requestId:e,error:`Target runtime "${n}" not connected`});return}this.pendingCDPRoutes.set(e,{requesterBootstrapId:o,requestId:e}),c.sync.send({type:"cdp.request",requestId:e,localTargetId:r,method:i,params:a,sessionId:s})}handleCDPResponse(e){const{requestId:n,result:r,error:i,chunkData:a,chunkIndex:s,totalChunks:o}=e,l=this.pendingCDPRoutes.get(n);if(!l)return;const c=my(this.cdpChunkBuffers,e);if(!c)return;if(this.pendingCDPRoutes.delete(n),l.requesterBootstrapId==="__leader__"){for(const d of this.remoteTransports.values())d.handleResponse(n,c.result,c.error);return}const u=this.followers.get(l.requesterBootstrapId);u&&S0(u.sync,n,c.result,c.error)}handleCDPEvent(e,n,r,i){let a;for(const[o,l]of this.runtimeToBootstrap)if(l===e){a=o;break}if(!a)return;const s=`${a}:`;for(const[o,l]of this.remoteTransports)o.startsWith(s)&&l.handleEvent(n,r)}openRemoteTab(e,n){const r=this.runtimeToBootstrap.get(e),i=r?this.followers.get(r):void 0;if(!i)return Promise.reject(new Error(`Target runtime "${e}" not connected`));const a=`tab-open-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise((s,o)=>{this.tabOpenResolvers.set(a,{resolve:s,reject:o}),this.pendingTabOpenRoutes.set(a,{requesterBootstrapId:"__leader__",requestId:a}),i.sync.send({type:"tab.open",requestId:a,url:n})})}async executeLocalTabOpen(e,n,r){const i=this.followers.get(r);if(!i)return;const a=this.options.browserTransport;if(!a){i.sync.send({type:"tab.open.error",requestId:e,error:"Leader has no browser transport"});return}try{const o=(await a.send("Target.createTarget",{url:n,background:!0})).targetId;i.sync.send({type:"tab.opened",requestId:e,targetId:`leader:${o}`})}catch(s){i.sync.send({type:"tab.open.error",requestId:e,error:s instanceof Error?s.message:String(s)})}}forwardTabOpen(e,n,r,i){const a=this.runtimeToBootstrap.get(n),s=a?this.followers.get(a):void 0,o=this.followers.get(i);if(!s){o&&o.sync.send({type:"tab.open.error",requestId:e,error:`Target runtime "${n}" not connected`});return}this.pendingTabOpenRoutes.set(e,{requesterBootstrapId:i,requestId:e}),s.sync.send({type:"tab.open",requestId:e,url:r})}handleTabOpenResponse(e,n){const r=this.pendingTabOpenRoutes.get(e);if(!r)return;if(this.pendingTabOpenRoutes.delete(e),r.requesterBootstrapId==="__leader__"){const a=this.tabOpenResolvers.get(e);a&&(this.tabOpenResolvers.delete(e),a.resolve(n));return}const i=this.followers.get(r.requesterBootstrapId);i&&i.sync.send({type:"tab.opened",requestId:e,targetId:n})}handleTabOpenError(e,n){const r=this.pendingTabOpenRoutes.get(e);if(!r)return;if(this.pendingTabOpenRoutes.delete(e),r.requesterBootstrapId==="__leader__"){const a=this.tabOpenResolvers.get(e);a&&(this.tabOpenResolvers.delete(e),a.reject(new Error(n)));return}const i=this.followers.get(r.requesterBootstrapId);i&&i.sync.send({type:"tab.open.error",requestId:e,error:n})}async executeLocalFs(e,n,r){const i=this.followers.get(r);if(!i)return;const a=this.options.vfs;if(!a){i.sync.send({type:"fs.response",requestId:e,response:{ok:!1,error:"Leader has no VFS"}});return}const s=await Dv(a,n);for(const o of s)i.sync.send({type:"fs.response",requestId:e,response:o})}forwardFsRequest(e,n,r,i){const a=this.runtimeToBootstrap.get(n),s=a?this.followers.get(a):void 0,o=this.followers.get(i);if(!s){o&&o.sync.send({type:"fs.response",requestId:e,response:{ok:!1,error:`Target runtime "${n}" not connected`}});return}this.pendingFsRoutes.set(e,{requesterBootstrapId:i,requestId:e,chunks:[],totalChunks:1}),s.sync.send({type:"fs.request",requestId:e,request:r})}handleFsResponse(e,n){const r=this.pendingFsRoutes.get(e);if(!r){const s=this.fsResolvers.get(e);if(s){s.responses.push(n);const o=n.ok&&n.totalChunks||1;s.responses.length>=o&&(this.fsResolvers.delete(e),s.resolve(s.responses))}return}if(r.requesterBootstrapId==="__leader__"){const s=this.fsResolvers.get(e);if(s){s.responses.push(n);const o=n.ok&&n.totalChunks||1;s.responses.length>=o&&(this.fsResolvers.delete(e),this.pendingFsRoutes.delete(e),s.resolve(s.responses))}return}const i=this.followers.get(r.requesterBootstrapId);i&&i.sync.send({type:"fs.response",requestId:e,response:n}),r.chunks.push(n);const a=n.ok&&n.totalChunks||1;r.totalChunks=a,r.chunks.length>=r.totalChunks&&this.pendingFsRoutes.delete(e)}sendFsRequest(e,n){if(e==="leader"){const s=this.options.vfs;return s?Dv(s,n):Promise.resolve([{ok:!1,error:"Leader has no VFS"}])}const r=this.runtimeToBootstrap.get(e),i=r?this.followers.get(r):void 0;if(!i)return Promise.resolve([{ok:!1,error:`Target runtime "${e}" not connected`}]);const a=`fs-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise((s,o)=>{this.fsResolvers.set(a,{resolve:s,reject:o,responses:[]}),this.pendingFsRoutes.set(a,{requesterBootstrapId:"__leader__",requestId:a,chunks:[],totalChunks:1}),i.sync.send({type:"fs.request",requestId:a,request:n})})}}const Vr=wn("tray-follower-sync");class eue{constructor(e,n={}){this.options=n,this.sync=Jz(e),this.unsubscribe=this.sync.onMessage(r=>{this.handleLeaderMessage(r)}),this.keepalive=new hO({sendPing:()=>this.sync.send({type:"ping"}),onDead:()=>{Vr.warn("Leader keepalive dead, cleaning up"),this.handleDisconnect("Keepalive timeout — leader not responding"),this.options.onDead?.()}}),this.keepalive.start(),e.addEventListener("close",()=>{Vr.warn("Data channel closed"),this.handleDisconnect("Data channel closed")}),e.addEventListener("error",()=>{Vr.warn("Data channel error"),this.handleDisconnect("Data channel error")})}sync;eventListeners=new Set;unsubscribe;keepalive;latestSnapshot=null;sentMessageIds=new Set;targetEntries=[];remoteTransports=new Map;cdpChunkBuffers=new Map;snapshotChunkBuffer=null;remoteCDPSessions=new Set;cdpEventCleanups=[];tabOpenResolvers=new Map;fsResolvers=new Map;sendMessage(e,n){const r=n??`follower-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;this.sentMessageIds.add(r),this.sync.send({type:"user_message",text:e,messageId:r}),Vr.info("Sent user message to leader",{messageId:r})}onEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}stop(){this.sync.send({type:"abort"}),Vr.info("Sent abort to leader")}requestSnapshot(){this.sync.send({type:"request_snapshot"})}getLatestSnapshot(){return this.latestSnapshot}close(){this.keepalive.stop(),this.unsubscribe(),this.sync.close(),this.eventListeners.clear(),this.cleanupCDPEventForwarding(),Vr.info("Follower sync closed")}advertiseTargets(e,n){this.sync.send({type:"targets.advertise",targets:e,runtimeId:n})}getTargets(){return this.targetEntries}disconnected=!1;handleDisconnect(e){if(this.disconnected)return;this.disconnected=!0;const n=_s();na({...n,state:"error",error:e}),this.emitEvent({type:"error",error:`Connection to leader lost: ${e}`}),this.keepalive.stop(),this.cleanupCDPEventForwarding(),this.unsubscribe(),this.sync.close(),this.options.onDisconnect?.(e)}handleLeaderMessage(e){switch(e.type){case"snapshot":Vr.info("Snapshot received from leader",{messageCount:e.messages.length,scoopJid:e.scoopJid}),this.snapshotChunkBuffer=null,this.latestSnapshot={messages:e.messages,scoopJid:e.scoopJid},this.options.onSnapshot?.(e.messages,e.scoopJid);break;case"snapshot_chunk":{const n=Zz(this.snapshotChunkBuffer,e);this.snapshotChunkBuffer=n.buffer,n.result&&(Vr.info("Chunked snapshot reassembled from leader",{messageCount:n.result.messages.length,scoopJid:n.result.scoopJid}),this.latestSnapshot=n.result,this.options.onSnapshot?.(n.result.messages,n.result.scoopJid));break}case"agent_event":this.emitEvent(e.event);break;case"user_message_echo":if(this.sentMessageIds.has(e.messageId)){this.sentMessageIds.delete(e.messageId),Vr.debug("Skipping own message echo",{messageId:e.messageId});break}Vr.info("User message echo received",{messageId:e.messageId,scoopJid:e.scoopJid}),this.options.onUserMessage?.(e.text,e.messageId,e.scoopJid);break;case"status":this.options.onStatus?.(e.scoopStatus);break;case"error":Vr.warn("Error from leader",{error:e.error}),this.emitEvent({type:"error",error:e.error});break;case"targets.registry":Vr.info("Target registry received from leader",{targetCount:e.targets.length}),this.targetEntries=e.targets,this.options.onTargetsUpdated?.(this.targetEntries);break;case"cdp.request":{const{requestId:n,localTargetId:r,method:i,params:a,sessionId:s}=e;this.executeLocalCDP(n,r,i,a,s);break}case"cdp.response":{this.routeCDPResponse(e);break}case"cdp.event":{for(const n of this.remoteTransports.values())n.handleEvent(e.method,e.params);break}case"tab.open":{this.executeLocalTabOpen(e.requestId,e.url);break}case"tab.opened":{const n=this.tabOpenResolvers.get(e.requestId);n&&(this.tabOpenResolvers.delete(e.requestId),n.resolve(e.targetId));break}case"tab.open.error":{const n=this.tabOpenResolvers.get(e.requestId);n&&(this.tabOpenResolvers.delete(e.requestId),n.reject(new Error(e.error)));break}case"fs.request":{this.executeLocalFs(e.requestId,e.request);break}case"fs.response":{this.routeFsResponse(e.requestId,e.response);break}case"ping":{this.keepalive.receivePing(),this.sync.send({type:"pong"});break}case"pong":{this.keepalive.receivePong(),xW(Date.now());break}}}emitEvent(e){for(const n of this.eventListeners)try{n(e)}catch(r){Vr.error("Listener error",{eventType:e.type,error:r instanceof Error?r.message:String(r)})}}createRemoteTransport(e,n){const r={sendCDPRequest:(a,s,o,l)=>{this.sync.send({type:"cdp.request",requestId:a,targetRuntimeId:e,localTargetId:n,method:s,params:o,sessionId:l})}},i=new XS(r);return this.remoteTransports.set(`${e}:${n}`,i),i}removeRemoteTransport(e,n){const r=`${e}:${n}`,i=this.remoteTransports.get(r);i&&(i.disconnect(),this.remoteTransports.delete(r))}openRemoteTab(e,n){const r=`tab-open-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise((i,a)=>{this.tabOpenResolvers.set(r,{resolve:i,reject:a}),this.sync.send({type:"tab.open",requestId:r,targetRuntimeId:e,url:n})})}async executeLocalTabOpen(e,n){const r=this.options.browserTransport;if(!r){this.sync.send({type:"tab.open.error",requestId:e,error:"Follower has no browser transport"});return}try{const a=(await r.send("Target.createTarget",{url:n,background:!0})).targetId;this.sync.send({type:"tab.opened",requestId:e,targetId:a}),this.options.onTargetsChanged?.()}catch(i){this.sync.send({type:"tab.open.error",requestId:e,error:i instanceof Error?i.message:String(i)})}}async executeLocalCDP(e,n,r,i,a){const s=this.options.browserTransport;if(!s){this.sync.send({type:"cdp.response",requestId:e,error:"Follower has no browser transport"});return}try{const o=await s.send(r,i,a);if(r==="Target.attachToTarget"&&o.sessionId){const l=o.sessionId;this.remoteCDPSessions.add(l),this.setupCDPEventForwarding(s,l),Vr.debug("Tracking remote CDP session",{remoteSessionId:l})}r==="Target.detachFromTarget"&&a&&this.remoteCDPSessions.has(a)&&(this.remoteCDPSessions.delete(a),Vr.debug("Removed remote CDP session on detach",{sessionId:a})),S0(this.sync,e,o)}catch(o){this.sync.send({type:"cdp.response",requestId:e,error:o instanceof Error?o.message:String(o)})}}setupCDPEventForwarding(e,n){const r=["Page.frameNavigated","Page.loadEventFired","Page.domContentEventFired","Network.responseReceived","Network.loadingFinished","Network.requestWillBeSent"];for(const i of r){const a=s=>{if(s.sessionId!==n||!this.remoteCDPSessions.has(n))return;const{sessionId:o,...l}=s;this.sync.send({type:"cdp.event",method:i,params:l,sessionId:n})};e.on(i,a),this.cdpEventCleanups.push(()=>e.off(i,a))}}cleanupCDPEventForwarding(){for(const e of this.cdpEventCleanups)e();this.cdpEventCleanups.length=0,this.remoteCDPSessions.clear()}routeCDPResponse(e){const n=my(this.cdpChunkBuffers,e);if(n)for(const r of this.remoteTransports.values())r.handleResponse(e.requestId,n.result,n.error)}async executeLocalFs(e,n){const r=this.options.vfs;if(!r){this.sync.send({type:"fs.response",requestId:e,response:{ok:!1,error:"Follower has no VFS"}});return}const i=await Dv(r,n);for(const a of i)this.sync.send({type:"fs.response",requestId:e,response:a})}routeFsResponse(e,n){const r=this.fsResolvers.get(e);if(!r)return;r.responses.push(n);const i=n.ok&&n.totalChunks||1;r.responses.length>=i&&(this.fsResolvers.delete(e),r.resolve(r.responses))}sendFsRequest(e,n){const r=`fs-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return new Promise((i,a)=>{this.fsResolvers.set(r,{resolve:i,reject:a,responses:[]}),this.sync.send({type:"fs.request",requestId:r,targetRuntimeId:e,request:n})})}}const tue="electron-overlay",nE="/electron",nue="slicc-electron-overlay:set-tab";function rue(t,e){if(e)return"extension";try{const n=new URL(t);return aue(n)?"electron-overlay":"standalone"}catch{return"standalone"}}function iue(t,e){return t==="electron-overlay"||t==="standalone"&&e}function rE(t){try{const n=new URL(t).searchParams.get("tab");return n&&JB(n)?n:n3}catch{return n3}}function aue(t){return t.pathname===nE||t.pathname===`${nE}/`||t.searchParams.get("runtime")===tue}function sue(t){const e=new URL(t);return`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}/licks-ws`}function oue(t,e){return`${new URL(t).origin}/webhooks/${e}`}function lue(t,e){const n=t.replace(/\/+$/,""),r=e.replace(/^\/+/,"");return`${n}/${r}`}function cue(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type===nue}const uue=["/shared/sprinkles"];async function due(t){const e=new Map;for(const n of uue)await t.exists(n)&&await iE(t,n,e);return await iE(t,"/",e),e}async function iE(t,e,n){for await(const r of t.walk(e)){if(!r.endsWith(".shtml"))continue;const i=pue(r);if(!n.has(i)){let a;try{a=await t.readFile(r,{encoding:"utf-8"})??""}catch{a=""}n.set(i,{name:i,path:r,title:fue(a,i),autoOpen:hue(a)})}}}function pue(t){const e=t.split("/").pop()??t;return e.endsWith(".shtml")?e.slice(0,-6):e}function fue(t,e){const n=t.match(/data-sprinkle-title=["']([^"']+)["']/);if(n)return n[1];const r=t.match(/<title>([^<]+)<\/title>/i);return r?r[1].trim():e}function hue(t){return/data-sprinkle-autoopen\b/.test(t)}class mue{listeners=new Map;lickHandler;fs;closeHandler;constructor(e,n,r){this.fs=e,this.lickHandler=n,this.closeHandler=r}createAPI(e){return{name:e,lick:n=>{const r=typeof n=="string"?n:n.action,i=typeof n=="string"?void 0:n.data,a={type:"sprinkle",sprinkleName:e,targetScoop:void 0,timestamp:new Date().toISOString(),body:{action:r,data:i}};this.lickHandler(a)},on:(n,r)=>{const i=`${e}:${n}`;let a=this.listeners.get(i);a||(a=new Set,this.listeners.set(i,a)),a.add(r)},off:(n,r)=>{const i=`${e}:${n}`;this.listeners.get(i)?.delete(r)},readFile:async n=>await this.fs.readFile(n,{encoding:"utf-8"}),setState:n=>{try{localStorage.setItem(`slicc-sprinkle-state:${e}`,JSON.stringify(n))}catch{}},getState:()=>{try{const n=localStorage.getItem(`slicc-sprinkle-state:${e}`);return n?JSON.parse(n):null}catch{return null}},open:n=>{const r=/^https?:|^chrome-extension:/.test(n)?n:ef(n);window.open(r,"_blank")},close:()=>this.closeHandler(e)}}pushUpdate(e,n){const r=`${e}:update`,i=this.listeners.get(r);if(i)for(const a of i)try{a(n)}catch{}}removeSprinkle(e){for(const n of this.listeners.keys())n.startsWith(`${e}:`)&&this.listeners.delete(n)}}const Xa=wn("sprinkle-manager"),aE="slicc-open-sprinkles";class mO{fs;bridge;callbacks;availableSprinkles=new Map;openSprinkles=new Map;constructor(e,n,r){this.fs=e,this.bridge=new mue(e,n,i=>this.close(i)),this.callbacks=r}async restoreOpenSprinkles(){try{const e=localStorage.getItem(aE);if(!e){for(const r of this.availableSprinkles.values())if(r.autoOpen)try{await this.open(r.name)}catch{Xa.warn("Failed to auto-open sprinkle",{name:r.name})}return}const n=JSON.parse(e);for(const r of n)try{await this.open(r)}catch{Xa.warn("Failed to restore sprinkle",{name:r})}}catch{}}persistOpenSprinkles(){try{localStorage.setItem(aE,JSON.stringify([...this.openSprinkles.keys()]))}catch{}}async openNewAutoOpenSprinkles(){await this.refresh();for(const e of this.availableSprinkles.values())if(e.autoOpen&&!this.openSprinkles.has(e.name))try{await this.open(e.name),Xa.info("Auto-opened new sprinkle after install",{name:e.name})}catch{Xa.warn("Failed to auto-open new sprinkle",{name:e.name})}}async refresh(){this.availableSprinkles=await due(this.fs),Xa.info("Discovered sprinkles",{count:this.availableSprinkles.size})}async open(e,n){if(this.openSprinkles.has(e)){Xa.info("Sprinkle already open",{name:e});return}let r=this.availableSprinkles.get(e);if(r||(await this.refresh(),r=this.availableSprinkles.get(e)),!r)throw new Error(`Sprinkle not found: ${e}`);const i=await this.fs.readFile(r.path,{encoding:"utf-8"}),a=document.createElement("div");a.className="sprinkle-panel",a.style.cssText="width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden;",a.dataset.sprinkle=e,this.openSprinkles.set(e,{renderer:null,container:a}),this.callbacks.addSprinkle(e,r.title,a,n);const s=this.bridge.createAPI(e),o=new SE(a,s);await o.render(i,e),this.openSprinkles.get(e).renderer=o,this.persistOpenSprinkles(),wle(e),Xa.info("Sprinkle opened",{name:e,title:r.title})}close(e){const n=this.openSprinkles.get(e);n&&(n.renderer.dispose(),n.container.remove(),this.bridge.removeSprinkle(e),this.openSprinkles.delete(e),this.callbacks.removeSprinkle(e),this.persistOpenSprinkles(),Xa.info("Sprinkle closed",{name:e}))}available(){return Array.from(this.availableSprinkles.values())}opened(){return Array.from(this.openSprinkles.keys())}sendToSprinkle(e,n){const r=this.openSprinkles.get(e);if(!r){Xa.warn("Cannot send to closed sprinkle",{name:e});return}this.bridge.pushUpdate(e,n),r.renderer.pushUpdate(n)}}const _t=wn("main");function gue(){const t=document.createElement("div");t.className="skill-drop-overlay";const e=document.createElement("div");e.className="skill-drop-overlay__card";const n=document.createElement("div");n.className="skill-drop-overlay__title",e.appendChild(n);const r=document.createElement("div");return r.className="skill-drop-overlay__desc",e.appendChild(r),t.appendChild(e),document.body.appendChild(t),{show(i,a){n.textContent=i,r.textContent=a,t.classList.add("skill-drop-overlay--visible")},hide(){t.classList.remove("skill-drop-overlay--visible")}}}function gO(){const t=document.createElement("div");return t.className="skill-drop-toast-container",document.body.appendChild(t),(e,n)=>{const r=document.createElement("div");r.className=`skill-drop-toast skill-drop-toast--${n}`,r.textContent=e,t.appendChild(r),requestAnimationFrame(()=>r.classList.add("skill-drop-toast--visible"));const i=()=>{r.classList.remove("skill-drop-toast--visible"),window.setTimeout(()=>r.remove(),180)};window.setTimeout(i,4200)}}function vO(t,e,n){const r=gue();let i=0,a=!1;const s=()=>{i=0,a||r.hide()};window.addEventListener("dragenter",o=>{k3(o.dataTransfer)&&(o.preventDefault(),i+=1,a||r.show("Drop .skill to install","Unpack into /workspace/skills/{name}."))}),window.addEventListener("dragover",o=>{k3(o.dataTransfer)&&(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="copy"),a||r.show("Drop .skill to install","Unpack into /workspace/skills/{name}."))}),window.addEventListener("dragleave",()=>{i!==0&&(i=Math.max(0,i-1),i===0&&!a&&r.hide())}),window.addEventListener("dragend",s),window.addEventListener("blur",s),window.addEventListener("drop",async o=>{const l=Bz(o.dataTransfer);if(!l){s();return}if(o.preventDefault(),i=0,a){r.hide(),e("Another .skill installation is already in progress.","error");return}a=!0,r.show("Installing skill…",l.name);try{const c=await Uz(t,l);await n(),e(`Installed "${c.skillName}" to ${c.destinationPath} (${c.fileCount} files). Run "skill install ${c.skillName}" to apply it.`,"success")}catch(c){const u=c instanceof Error?c.message:String(c);e(`Failed to install dropped skill: ${u}`,"error")}finally{a=!1,r.hide()}})}async function vue(t){const{OffscreenClient:e}=await Vt(async()=>{const{OffscreenClient:f}=await import("./offscreen-client-EF1SfFBJ.js");return{OffscreenClient:f}},[]),{VirtualFS:n}=await Vt(async()=>{const{VirtualFS:f}=await Promise.resolve().then(()=>Cz);return{VirtualFS:f}},void 0),r=new Uc(t,!0);window.__slicc_debug_tabs=f=>r.setDebugTabs(f),await r.panels.chat.initSession("session-cone");let i=null;const a=await n.create({dbName:"slicc-fs"});r.panels.fileBrowser.setFs(a),_t.info("File browser wired to shared VFS (local IndexedDB)");const s=new BroadcastChannel("preview-vfs");s.onmessage=f=>{if(f.data?.type!=="preview-vfs-read")return;const{id:h,path:m,asText:g}=f.data;(async()=>{try{const v=g?"utf-8":"binary",y=await a.readFile(m,{encoding:v});s.postMessage({type:"preview-vfs-response",id:h,content:y})}catch(v){const y=v instanceof Error?v.message:String(v);y.includes("ENOENT")||_t.error("Preview VFS read failed",{path:m,error:y}),s.postMessage({type:"preview-vfs-response",id:h,error:y})}})()};const o=gO();vO(a,o,async()=>{await r.panels.fileBrowser.refresh()});try{const{WasmShell:f}=await Vt(async()=>{const{WasmShell:b}=await Promise.resolve().then(()=>tO);return{WasmShell:b}},void 0),{PanelCdpProxy:h,BrowserAPI:m}=await Vt(async()=>{const{PanelCdpProxy:b,BrowserAPI:S}=await import("./index-Cif-vpwj.js");return{PanelCdpProxy:b,BrowserAPI:S}},[]),g=new h;await g.connect();const v=new m(g),y=new f({fs:a,browserAPI:v});await r.panels.terminal.mountShell(y),_t.info("Terminal mounted with shared VFS and BrowserAPI (CDP proxy)")}catch(f){_t.warn("Failed to mount shell to terminal",f)}let l,c=new Set;const u=async f=>{i=f,l.selectedScoopJid=f.jid,r.panels.memory.setSelectedScoop(f.jid),r.setScoopSwitcherSelected?.(f.jid),r.panels.scoops.setSelectedJid(f.jid);const h=f.isCone?"session-cone":`session-${f.folder}`,m=f.isCone?void 0:f.name;await r.panels.chat.switchToContext(h,!f.isCone,m),l.isProcessing(f.jid)&&r.panels.chat.setProcessing(!0)};l=new e({onStatusChange:(f,h)=>{r.panels.scoops.updateScoopStatus(f,h),r.updateScoopSwitcherStatus?.(f,h),i?.jid===f&&(r.setAgentProcessing(h==="processing"),h==="processing"?r.panels.chat.setProcessing(!0):h==="ready"&&r.panels.chat.setProcessing(!1))},onScoopCreated:f=>{r.panels.scoops.refreshScoops(),r.refreshScoopSwitcher?.(),i||(i=f,l.selectedScoopJid=f.jid,r.panels.memory.setSelectedScoop(f.jid))},onScoopListUpdate:()=>{const f=new Set(l.getScoops().map(h=>h.folder));for(const h of c)f.has(h)||r.panels.chat.deleteSessionById(`session-${h}`);if(c=f,r.panels.scoops.refreshScoops(),r.refreshScoopSwitcher?.(),!i){const m=l.getScoops().find(g=>g.isCone);m&&(i=m,l.selectedScoopJid=m.jid,r.panels.memory.setSelectedScoop(m.jid))}},onIncomingMessage:(f,h)=>{if(i?.jid===f){const m=h.channel==="delegation"?`**[Instructions from sliccy]**
|
|
14656
14667
|
|
|
14657
|
-
${h.content}`:h.content;r.panels.chat.addUserMessage(m)}},onReady:async()=>{try{_t.info("Offscreen engine ready, scoop count:",l.getScoops().length),window.localStorage.getItem(vl)&&chrome.runtime.sendMessage({source:"panel",payload:{type:"refresh-tray-runtime"}}).catch(()=>{});const f=i??l.getScoops().find(h=>h.isCone)??l.getScoops()[0];f&&(i=f,l.selectedScoopJid=f.jid,await u(f))}catch(f){_t.error("Failed to initialize on ready",{error:f instanceof Error?f.message:String(f)})}}}),l.setLocalFS(a);const d=l.createAgentHandle();r.panels.chat.setAgent(d),r.panels.scoops.setOrchestrator(l),r.panels.memory.setOrchestrator(l),r.setScoopSwitcherOrchestrator?.(l),r.onScoopSelect=u,r.onModelChange=f=>{localStorage.setItem("selected-model",f),l.updateModel()},r.onClearChat=async()=>{const f=l.getScoops();for(const h of f){const m=h.isCone?"session-cone":`session-${h.folder}`;await r.panels.chat.deleteSessionById(m)}l.clearAllMessages()},r.onClearFilesystem=async()=>{l.clearFilesystem()},r.panels.chat.onInlineSprinkleLick=(f,h)=>{l.sendSprinkleLick("inline",{action:f,data:h})};const p=new mO(a,f=>{f.type==="sprinkle"&&(f.sprinkleName==="welcome"&&f.body?.action==="onboarding-complete"&&localStorage.setItem("slicc-welcomed","1"),l.sendSprinkleLick(f.sprinkleName,f.body))},{addSprinkle:(f,h,m,g)=>r.addSprinkle(f,h,m,g),removeSprinkle:f=>r.removeSprinkle(f)});if(window.__slicc_sprinkleManager=p,window.__slicc_reloadSkills=()=>(chrome.runtime.sendMessage({source:"panel",payload:{type:"reload-skills"}}),Promise.resolve()),l.setSprinkleOpHandler(f=>{const{id:h,op:m,name:g,data:v}=f;console.log("[main-ext] sprinkle-op handler called",{id:h,op:m,name:g}),(async()=>{try{let y;switch(m){case"list":await p.refresh(),y=p.available();break;case"opened":y=p.opened();break;case"refresh":await p.refresh(),y=p.available().length;break;case"open":await p.open(g),y=!0;break;case"close":p.close(g),y=!0;break;case"send":p.sendToSprinkle(g,v),y=!0;break;case"openNewAutoOpen":await p.openNewAutoOpenSprinkles(),y=!0;break}console.log("[main-ext] sprinkle-op response sending",{id:h,op:m,result:typeof y}),chrome.runtime.sendMessage({source:"panel",payload:{type:"sprinkle-op-response",id:h,result:y}}).catch(()=>{})}catch(y){chrome.runtime.sendMessage({source:"panel",payload:{type:"sprinkle-op-response",id:h,error:y instanceof Error?y.message:String(y)}}).catch(()=>{})}})()}),await p.refresh(),r.onSprinkleClose=f=>p.close(f),r.getAvailableSprinkles=()=>{const f=new Set(p.opened());return p.available().filter(h=>!f.has(h.name)).map(h=>({name:h.name,title:h.title}))},r.onOpenSprinkle=(f,h)=>p.open(f,h),r.updateAddButtons(),await p.restoreOpenSprinkles(),!localStorage.getItem("slicc-welcomed")&&p.available().some(f=>f.name==="welcome"))try{await p.open("welcome")}catch(f){_t.warn("Failed to open welcome sprinkle",f)}_t.info("SprinkleManager initialized (extension mode)"),l.requestState(),_t.info("Extension UI connected to offscreen agent engine"),XP().catch(()=>{})}async function
|
|
14668
|
+
${h.content}`:h.content;r.panels.chat.addUserMessage(m)}},onReady:async()=>{try{_t.info("Offscreen engine ready, scoop count:",l.getScoops().length),window.localStorage.getItem(vl)&&chrome.runtime.sendMessage({source:"panel",payload:{type:"refresh-tray-runtime"}}).catch(()=>{});const f=i??l.getScoops().find(h=>h.isCone)??l.getScoops()[0];f&&(i=f,l.selectedScoopJid=f.jid,await u(f))}catch(f){_t.error("Failed to initialize on ready",{error:f instanceof Error?f.message:String(f)})}}}),l.setLocalFS(a);const d=l.createAgentHandle();r.panels.chat.setAgent(d),r.panels.scoops.setOrchestrator(l),r.panels.memory.setOrchestrator(l),r.setScoopSwitcherOrchestrator?.(l),r.onScoopSelect=u,r.onModelChange=f=>{localStorage.setItem("selected-model",f),l.updateModel()},r.onClearChat=async()=>{const f=l.getScoops();for(const h of f){const m=h.isCone?"session-cone":`session-${h.folder}`;await r.panels.chat.deleteSessionById(m)}l.clearAllMessages()},r.onClearFilesystem=async()=>{l.clearFilesystem()},r.panels.chat.onInlineSprinkleLick=(f,h)=>{l.sendSprinkleLick("inline",{action:f,data:h})};const p=new mO(a,f=>{f.type==="sprinkle"&&(f.sprinkleName==="welcome"&&f.body?.action==="onboarding-complete"&&localStorage.setItem("slicc-welcomed","1"),l.sendSprinkleLick(f.sprinkleName,f.body))},{addSprinkle:(f,h,m,g)=>r.addSprinkle(f,h,m,g),removeSprinkle:f=>r.removeSprinkle(f)});if(window.__slicc_sprinkleManager=p,window.__slicc_reloadSkills=()=>(chrome.runtime.sendMessage({source:"panel",payload:{type:"reload-skills"}}),Promise.resolve()),l.setSprinkleOpHandler(f=>{const{id:h,op:m,name:g,data:v}=f;console.log("[main-ext] sprinkle-op handler called",{id:h,op:m,name:g}),(async()=>{try{let y;switch(m){case"list":await p.refresh(),y=p.available();break;case"opened":y=p.opened();break;case"refresh":await p.refresh(),y=p.available().length;break;case"open":await p.open(g),y=!0;break;case"close":p.close(g),y=!0;break;case"send":p.sendToSprinkle(g,v),y=!0;break;case"openNewAutoOpen":await p.openNewAutoOpenSprinkles(),y=!0;break}console.log("[main-ext] sprinkle-op response sending",{id:h,op:m,result:typeof y}),chrome.runtime.sendMessage({source:"panel",payload:{type:"sprinkle-op-response",id:h,result:y}}).catch(()=>{})}catch(y){chrome.runtime.sendMessage({source:"panel",payload:{type:"sprinkle-op-response",id:h,error:y instanceof Error?y.message:String(y)}}).catch(()=>{})}})()}),await p.refresh(),r.onSprinkleClose=f=>p.close(f),r.getAvailableSprinkles=()=>{const f=new Set(p.opened());return p.available().filter(h=>!f.has(h.name)).map(h=>({name:h.name,title:h.title}))},r.onOpenSprinkle=(f,h)=>p.open(f,h),r.updateAddButtons(),await p.restoreOpenSprinkles(),!localStorage.getItem("slicc-welcomed")&&p.available().some(f=>f.name==="welcome"))try{await p.open("welcome")}catch(f){_t.warn("Failed to open welcome sprinkle",f)}_t.info("SprinkleManager initialized (extension mode)"),l.requestState(),_t.info("Extension UI connected to offscreen agent engine"),XP().catch(()=>{})}async function yue(){SW(),tz();const t=document.getElementById("app");if(!t)throw new Error("#app element not found");"serviceWorker"in navigator&&navigator.serviceWorker.register("/preview-sw.js",{scope:"/preview/"}).then(()=>_t.info("Preview SW registered")).catch(L=>_t.error("Preview SW registration failed — preview feature will not work",L)),CS();let e=xl();const n=u0(window.localStorage);if(!e&&!n){const L=window.location.port==="5710"||window.location.port==="3000"||window.location.port==="";await uy({preferTrayJoin:!L}),e=xl()}const r=!e&&u0(window.localStorage),i=typeof chrome<"u"&&!!chrome?.runtime?.id,a=rue(window.location.href,i);if(a==="extension")return vue(t);const s=new Uc(t,a==="electron-overlay");if(a==="electron-overlay"){const L=rE(window.location.href);s.setActiveTab(L);const U=document.createElement("style");U.id="slicc-electron-overlay-runtime-style",U.textContent=`
|
|
14658
14669
|
#app > .tab-bar { display: none !important; }
|
|
14659
14670
|
#app > .tab-content {
|
|
14660
14671
|
height: calc(100vh - var(--s2-header-height));
|
|
@@ -14662,11 +14673,11 @@ ${h.content}`:h.content;r.panels.chat.addUserMessage(m)}},onReady:async()=>{try{
|
|
|
14662
14673
|
#app > .tab-content > .tab-content__panel {
|
|
14663
14674
|
height: 100%;
|
|
14664
14675
|
}
|
|
14665
|
-
`,document.head.appendChild(U),window.addEventListener("message",X=>{X.source===window.parent&&
|
|
14676
|
+
`,document.head.appendChild(U),window.addEventListener("message",X=>{X.source===window.parent&&cue(X.data)&&s.setActiveTab(rE(`http://localhost/?tab=${X.data.tab??""}`))}),window.addEventListener("keydown",X=>{X.code==="Semicolon"&&(X.metaKey||X.ctrlKey)&&!X.shiftKey&&!X.altKey&&!X.repeat&&(X.preventDefault(),X.stopPropagation(),window.parent.postMessage({type:"slicc-electron-overlay:toggle"},"*"))},!0)}const o=gO();await s.panels.chat.initSession("session-cone"),_t.info("Session initialized");const l=new Gz,c=new Set,u=L=>{_t.debug("Emit to UI",{type:L.type,listenerCount:c.size});for(const U of c)try{U(L)}catch(X){_t.error("Listener error",{eventType:L.type,error:X instanceof Error?X.message:String(X)})}};let d=null;const p=new Map,f=new Map;function h(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function m(L){let U=f.get(L);return U||(U=[],f.set(L,U)),U}function g(L,U){const X=m(L);let se=p.get(L);if(se){const V=X.find(pe=>pe.id===se);if(V)return V}se=`scoop-${L}-${h()}`,p.set(L,se);const ee=v.getScoops().find(V=>V.jid===L),oe=ee?.isCone?"cone":ee?.name??"unknown",ce={id:se,role:"assistant",content:"",timestamp:Date.now(),toolCalls:[],isStreaming:!0,source:oe,channel:U};return X.push(ce),d?.jid===L&&u({type:"message_start",messageId:se}),ce}const v=new Cce(s.getIframeContainer(),{onResponse:(L,U,X)=>{const se=g(L);X?se.content+=U:(se.content=U,se.isStreaming=!1),d?.jid===L&&(u({type:"content_delta",messageId:se.id,text:U}),X||u({type:"content_done",messageId:se.id}))},onResponseDone:L=>{const U=m(L),X=p.get(L);if(X){const se=U.find(le=>le.id===X);se&&(se.isStreaming=!1),d?.jid===L&&u({type:"content_done",messageId:X}),p.delete(L)}},onSendMessage:(L,U)=>{_t.debug("Send message requested",{targetJid:L,textLength:U.length});const X=`msg-${h()}`,se={id:X,chatJid:L,senderId:"assistant",senderName:"sliccy",content:U,timestamp:new Date().toISOString(),fromAssistant:!0,channel:"web"};v.handleMessage(se),m(L).push({id:X,role:"assistant",content:U,timestamp:Date.now()}),d?.jid===L&&(u({type:"message_start",messageId:X}),u({type:"content_delta",messageId:X,text:U}),u({type:"content_done",messageId:X}))},onStatusChange:(L,U)=>{if(s.panels.scoops.updateScoopStatus(L,U),s.updateScoopSwitcherStatus?.(L,U),d?.jid===L){if(s.setAgentProcessing(U==="processing"),U==="processing")s.panels.chat.setProcessing(!0);else if(U==="ready"){s.panels.chat.setProcessing(!1);const X=p.get(L)??`done-${L}-${h()}`;p.delete(L),u({type:"turn_end",messageId:X})}}},onError:(L,U)=>{_t.error("Scoop error",{scoopJid:L,error:U}),d?.jid===L&&u({type:"error",error:U})},getBrowserAPI:()=>l,onToolStart:(L,U,X)=>{if(new Set(["send_message","list_scoops","list_tasks"]).has(U))return;const le=g(L);le.toolCalls||(le.toolCalls=[]),le.toolCalls.push({id:h(),name:U,input:X}),d?.jid===L&&u({type:"tool_use_start",messageId:le.id,toolName:U,toolInput:X})},onToolEnd:(L,U,X,se)=>{if(new Set(["send_message","list_scoops","list_tasks"]).has(U))return;const ee=m(L),oe=p.get(L);if(oe){const ce=ee.find(V=>V.id===oe);if(ce?.toolCalls){const V=[...ce.toolCalls].reverse().find(pe=>pe.name===U&&pe.result===void 0);V&&(V.result=X,V.isError=se)}}d?.jid===L&&oe&&u({type:"tool_result",messageId:oe,toolName:U,result:X,isError:se})},onToolUI:(L,U,X,se)=>{const le=p.get(L);le?u({type:"tool_ui",messageId:le,toolName:U,requestId:X,html:se}):_t.warn("Cannot emit tool_ui - no message ID for scoop",{scoopJid:L,requestId:X})},onToolUIDone:(L,U)=>{const X=p.get(L);X&&u({type:"tool_ui_done",messageId:X,requestId:U})},onIncomingMessage:(L,U)=>{const X={id:U.id,role:"user",content:U.channel==="delegation"?`**[Instructions from sliccy]**
|
|
14666
14677
|
|
|
14667
|
-
${U.content}`:U.content,timestamp:new Date(U.timestamp).getTime(),source:U.channel==="delegation"?"delegation":void 0,channel:U.channel};m(L).push(X),d?.jid===L&&(u({type:"message_start",messageId:U.id}),u({type:"content_delta",messageId:U.id,text:X.content}),u({type:"content_done",messageId:U.id}))}});await v.init(),s.panels.scoops.setOrchestrator(v),s.panels.memory.setOrchestrator(v),s.setScoopSwitcherOrchestrator?.(v);const y=v.getSharedFS();if(y){s.panels.fileBrowser.setFs(y),_t.info("File browser wired to shared VFS");const L=new BroadcastChannel("preview-vfs");L.onmessage=U=>{if(U.data?.type!=="preview-vfs-read")return;const{id:X,path:se,asText:le}=U.data;(async()=>{try{const ee=le?"utf-8":"binary",oe=await y.readFile(se,{encoding:ee});L.postMessage({type:"preview-vfs-response",id:X,content:oe})}catch(ee){const oe=ee instanceof Error?ee.message:String(ee);oe.includes("ENOENT")||_t.error("Preview VFS read failed",{path:se,error:oe}),L.postMessage({type:"preview-vfs-response",id:X,error:oe})}})()},vO(y,(U,X)=>{X==="error"?_t.warn("Dropped skill install failed",{message:U}):_t.info("Dropped skill installed",{message:U}),o(U,X)},async()=>{await s.panels.fileBrowser.refresh()});try{const{WasmShell:U}=await Vt(async()=>{const{WasmShell:se}=await Promise.resolve().then(()=>tO);return{WasmShell:se}},void 0),X=new U({fs:y,browserAPI:l});await s.panels.terminal.mountShell(X),_t.info("Terminal mounted with shared VFS");try{const{BshWatchdog:se}=await Vt(async()=>{const{BshWatchdog:ee}=await import("./bsh-watchdog-
|
|
14678
|
+
${U.content}`:U.content,timestamp:new Date(U.timestamp).getTime(),source:U.channel==="delegation"?"delegation":void 0,channel:U.channel};m(L).push(X),d?.jid===L&&(u({type:"message_start",messageId:U.id}),u({type:"content_delta",messageId:U.id,text:X.content}),u({type:"content_done",messageId:U.id}))}});await v.init(),s.panels.scoops.setOrchestrator(v),s.panels.memory.setOrchestrator(v),s.setScoopSwitcherOrchestrator?.(v);const y=v.getSharedFS();if(y){s.panels.fileBrowser.setFs(y),_t.info("File browser wired to shared VFS");const L=new BroadcastChannel("preview-vfs");L.onmessage=U=>{if(U.data?.type!=="preview-vfs-read")return;const{id:X,path:se,asText:le}=U.data;(async()=>{try{const ee=le?"utf-8":"binary",oe=await y.readFile(se,{encoding:ee});L.postMessage({type:"preview-vfs-response",id:X,content:oe})}catch(ee){const oe=ee instanceof Error?ee.message:String(ee);oe.includes("ENOENT")||_t.error("Preview VFS read failed",{path:se,error:oe}),L.postMessage({type:"preview-vfs-response",id:X,error:oe})}})()},vO(y,(U,X)=>{X==="error"?_t.warn("Dropped skill install failed",{message:U}):_t.info("Dropped skill installed",{message:U}),o(U,X)},async()=>{await s.panels.fileBrowser.refresh()});try{const{WasmShell:U}=await Vt(async()=>{const{WasmShell:se}=await Promise.resolve().then(()=>tO);return{WasmShell:se}},void 0),X=new U({fs:y,browserAPI:l});await s.panels.terminal.mountShell(X),_t.info("Terminal mounted with shared VFS");try{const{BshWatchdog:se}=await Vt(async()=>{const{BshWatchdog:ee}=await import("./bsh-watchdog-Cy8-MCiI.js");return{BshWatchdog:ee}},[]),le=new se({transport:l.getTransport(),fs:y});le.start(),window.addEventListener("beforeunload",()=>le.stop(),{once:!0}),_t.info("BSH navigation watchdog started")}catch(se){_t.warn("Failed to start BSH watchdog",se)}}catch(U){_t.warn("Failed to mount shell to terminal",U)}}const b=v.getScoops(),S=b.some(L=>L.isCone);if(r)_t.info("Skipping local cone bootstrap while joining a tray without a configured provider");else if(!S)d=await s.panels.scoops.createScoop("Cone",!0),_t.info("Created cone");else{const U=new URLSearchParams(window.location.search).get("scoop");if(U){const X=b.find(se=>se.folder===U);X?(d=X,_t.info("Restored scoop from URL",{folder:U})):d=b.find(se=>se.isCone)??b[0]}else d=b.find(X=>X.isCone)??b[0]}d&&s.panels.memory.setSelectedScoop(d.jid);let A=null;const _={sendMessage(L,U){if(!d){u({type:"error",error:"No scoop selected"});return}const X={id:U??`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,chatJid:d.jid,senderId:"user",senderName:"User",content:L,timestamp:new Date().toISOString(),fromAssistant:!1,channel:"web"};m(d.jid).push({id:X.id,role:"user",content:L,timestamp:Date.now()}),A?.broadcastUserMessage(L,X.id),v.handleMessage(X),v.createScoopTab(d.jid)},onEvent(L){return c.add(L),()=>c.delete(L)},stop(){d&&(v.stopScoop(d.jid),v.clearQueuedMessages(d.jid).catch(L=>{_t.error("Failed to clear queued messages on stop",{error:L instanceof Error?L.message:String(L)})}))}};s.panels.chat.setAgent(_),s.panels.chat.setDeleteQueuedMessageCallback(L=>{if(d){v.deleteQueuedMessage(d.jid,L).catch(X=>{_t.error("Failed to delete queued message",{messageId:L,error:X instanceof Error?X.message:String(X)})});const U=f.get(d.jid);if(U){const X=U.findIndex(se=>se.id===L);X!==-1&&U.splice(X,1)}}}),_t.info("Cone agent handle wired to chat UI");const{getLickManager:I}=await Vt(async()=>{const{getLickManager:L}=await Promise.resolve().then(()=>Sce);return{getLickManager:L}},void 0),P=I();await P.init(),v.setLickManager(P);const B=L=>{const U=L.type==="webhook",X=L.type==="sprinkle",se=U?L.webhookName:X?L.sprinkleName:L.cronName,le=U?L.webhookId:X?L.sprinkleName:L.cronId,ee=L.type;_t.debug("Lick event",{type:L.type,name:se,targetScoop:L.targetScoop}),X&&L.sprinkleName==="welcome"&&L.body?.action==="onboarding-complete"&&localStorage.setItem("slicc-welcomed","1");const oe=v.getScoops();let ce;if(X||!L.targetScoop?ce=oe.find(V=>V.isCone):ce=oe.find(V=>V.name===L.targetScoop||V.folder===L.targetScoop||V.folder===`${L.targetScoop}-scoop`),ce){const V=`${ee}-${le}-${Date.now()}`,ie=`[${U?"Webhook Event":X?"Sprinkle Event":"Cron Event"}: ${se}]
|
|
14668
14679
|
\`\`\`json
|
|
14669
14680
|
${JSON.stringify(L.body,null,2)}
|
|
14670
|
-
\`\`\``,H={id:V,chatJid:ce.jid,senderId:ee,senderName:`${ee}:${se}`,content:ie,timestamp:L.timestamp,fromAssistant:!1,channel:ee};m(ce.jid).push({id:V,role:"user",content:ie,timestamp:Date.now(),source:"lick",channel:ee}),d?.jid===ce.jid&&s.panels.chat.addLickMessage(V,ie,ee),_t.info("Routing lick to scoop",{type:ee,name:se,scoopJid:ce.jid}),v.handleMessage(H)}else _t.warn("Lick target scoop not found",{targetScoop:L.targetScoop})};P.setEventHandler(B),s.panels.chat.onInlineSprinkleLick=(L,U)=>{const X={type:"sprinkle",sprinkleName:"inline",targetScoop:void 0,timestamp:new Date().toISOString(),body:{action:L,data:U}};B(X)};let D=null;if(y){if(D=new mO(y,B,{addSprinkle:(L,U,X,se)=>s.addSprinkle(L,U,X,se),removeSprinkle:L=>s.removeSprinkle(L)}),window.__slicc_sprinkleManager=D,window.__slicc_reloadSkills=()=>v.reloadAllSkills(),await D.refresh(),s.onSprinkleClose=L=>D.close(L),s.getAvailableSprinkles=()=>{const L=new Set(D.opened());return D.available().filter(U=>!L.has(U.name)).map(U=>({name:U.name,title:U.title}))},s.onOpenSprinkle=(L,U)=>D.open(L,U),s.updateAddButtons(),!localStorage.getItem("slicc-welcomed")&&D.available().some(L=>L.name==="welcome"))try{await D.open("welcome")}catch(L){_t.warn("Failed to open welcome sprinkle",L)}await D.restoreOpenSprinkles(),_t.info("SprinkleManager initialized")}const O=()=>{const L=
|
|
14681
|
+
\`\`\``,H={id:V,chatJid:ce.jid,senderId:ee,senderName:`${ee}:${se}`,content:ie,timestamp:L.timestamp,fromAssistant:!1,channel:ee};m(ce.jid).push({id:V,role:"user",content:ie,timestamp:Date.now(),source:"lick",channel:ee}),d?.jid===ce.jid&&s.panels.chat.addLickMessage(V,ie,ee),_t.info("Routing lick to scoop",{type:ee,name:se,scoopJid:ce.jid}),v.handleMessage(H)}else _t.warn("Lick target scoop not found",{targetScoop:L.targetScoop})};P.setEventHandler(B),s.panels.chat.onInlineSprinkleLick=(L,U)=>{const X={type:"sprinkle",sprinkleName:"inline",targetScoop:void 0,timestamp:new Date().toISOString(),body:{action:L,data:U}};B(X)};let D=null;if(y){if(D=new mO(y,B,{addSprinkle:(L,U,X,se)=>s.addSprinkle(L,U,X,se),removeSprinkle:L=>s.removeSprinkle(L)}),window.__slicc_sprinkleManager=D,window.__slicc_reloadSkills=()=>v.reloadAllSkills(),await D.refresh(),s.onSprinkleClose=L=>D.close(L),s.getAvailableSprinkles=()=>{const L=new Set(D.opened());return D.available().filter(U=>!L.has(U.name)).map(U=>({name:U.name,title:U.title}))},s.onOpenSprinkle=(L,U)=>D.open(L,U),s.updateAddButtons(),!localStorage.getItem("slicc-welcomed")&&D.available().some(L=>L.name==="welcome"))try{await D.open("welcome")}catch(L){_t.warn("Failed to open welcome sprinkle",L)}await D.restoreOpenSprinkles(),_t.info("SprinkleManager initialized")}const O=()=>{const L=sue(window.location.href),U=new WebSocket(L);U.onopen=()=>{_t.info("Lick WebSocket connected")},U.onmessage=async X=>{try{const se=JSON.parse(X.data);if(se.requestId){let le;try{switch(se.type){case"list_webhooks":le={type:"response",requestId:se.requestId,data:P.listWebhooks()};break;case"create_webhook":{const ee=await P.createWebhook(se.name||"default",se.scoop,se.filter),oe=pp().session,ce=oe?.webhookUrl?lue(oe.webhookUrl,ee.id):oue(window.location.href,ee.id);le={type:"response",requestId:se.requestId,data:{...ee,url:ce}};break}case"delete_webhook":{le=await P.deleteWebhook(se.id)?{type:"response",requestId:se.requestId,data:{ok:!0}}:{type:"response",requestId:se.requestId,data:{error:"Webhook not found"}};break}case"list_crontasks":le={type:"response",requestId:se.requestId,data:P.listCronTasks()};break;case"create_crontask":{if(!se.name)throw new Error("name is required");if(!se.cron)throw new Error("cron is required");const ee=await P.createCronTask(se.name,se.cron,se.scoop,se.filter);le={type:"response",requestId:se.requestId,data:ee};break}case"delete_crontask":{le=await P.deleteCronTask(se.id)?{type:"response",requestId:se.requestId,data:{ok:!0}}:{type:"response",requestId:se.requestId,data:{error:"Cron task not found"}};break}case"tray_status":{const ee=pp();le={type:"response",requestId:se.requestId,data:{state:ee.state,joinUrl:ee.session?.joinUrl??null,workerBaseUrl:ee.session?.workerBaseUrl??null,trayId:ee.session?.trayId??null}};break}default:le={type:"response",requestId:se.requestId,error:`Unknown request type: ${se.type}`}}}catch(ee){le={type:"response",requestId:se.requestId,error:ee instanceof Error?ee.message:String(ee)}}U.send(JSON.stringify(le));return}se.type==="webhook_event"&&P.handleWebhookEvent(se.webhookId,se.headers,se.body)}catch(se){_t.error("Failed to process lick message",{error:se instanceof Error?se.message:String(se)})}},U.onclose=()=>{_t.warn("Lick WebSocket disconnected, reconnecting in 3s..."),setTimeout(O,3e3)},U.onerror=X=>{_t.error("Lick WebSocket error",{error:String(X)})}};O(),s.onModelChange=L=>{localStorage.setItem("selected-model",L),v.updateModel()},s.onClearChat=async()=>{await v.clearAllMessages(),f.clear()},s.onClearFilesystem=async()=>{await v.resetFilesystem()};const z=async L=>{_t.info("Scoop selected",{jid:L.jid,name:L.name}),d=L,v.createScoopTab(L.jid),s.panels.memory.setSelectedScoop(L.jid),s.panels.scoops.setSelectedJid(L.jid);const U=L.isCone?"session-cone":`session-${L.folder}`,X=f.get(L.jid),se=L.isCone?void 0:L.name;if(X&&X.length>0)await s.panels.chat.switchToContext(U,!L.isCone,se),s.panels.chat.loadMessages(X);else if(await s.panels.chat.switchToContext(U,!L.isCone,se),s.panels.chat.getMessages().length===0){const le=await v.getMessagesForScoop(L.jid);for(const ee of le){const oe=ee.channel==="webhook"||ee.channel==="cron",ce=ee.channel==="delegation";if(oe){const V={id:ee.id,role:"user",content:ee.content,timestamp:new Date(ee.timestamp).getTime(),source:"lick",channel:ee.channel};m(L.jid).push(V),s.panels.chat.addUserMessage(ee.content)}else if(ce){const V={id:ee.id,role:"user",content:`**[Instructions from sliccy]**
|
|
14671
14682
|
|
|
14672
|
-
${ee.content}`,timestamp:new Date(ee.timestamp).getTime(),source:"delegation",channel:"delegation"};m(L.jid).push(V),s.panels.chat.addUserMessage(V.content)}else ee.fromAssistant?(u({type:"message_start",messageId:ee.id}),u({type:"content_delta",messageId:ee.id,text:ee.content}),u({type:"content_done",messageId:ee.id})):s.panels.chat.addUserMessage(ee.content)}}L.isCone&&v.isProcessing(L.jid)&&s.panels.chat.setProcessing(!0)};if(s.onScoopSelect=z,d&&(v.createScoopTab(d.jid),await z(d)),a==="standalone"||a==="electron-overlay"){const L=await yW(),U=
|
|
14683
|
+
${ee.content}`,timestamp:new Date(ee.timestamp).getTime(),source:"delegation",channel:"delegation"};m(L.jid).push(V),s.panels.chat.addUserMessage(V.content)}else ee.fromAssistant?(u({type:"message_start",messageId:ee.id}),u({type:"content_delta",messageId:ee.id,text:ee.content}),u({type:"content_done",messageId:ee.id})):s.panels.chat.addUserMessage(ee.content)}}L.isCone&&v.isProcessing(L.jid)&&s.panels.chat.setProcessing(!0)};if(s.onScoopSelect=z,d&&(v.createScoopTab(d.jid),await z(d)),a==="standalone"||a==="electron-overlay"){const L=await yW(),U=iue(a,L!==null)?fW:null,X=await vW({locationHref:window.location.href,storage:window.localStorage,defaultWorkerBaseUrl:U,runtimeConfigFetcher:async()=>L});let se=null,le=null,ee=null;foe(()=>A?(V,pe)=>A.sendFsRequest(V,pe):se?(V,pe)=>se.sendFsRequest(V,pe):null),Cae(()=>A?()=>A.getBestFollowerForTeleport():null),Aae(()=>A?()=>A.getConnectedFollowers():null);const oe=V=>{ee&&(clearInterval(ee),ee=null),se?.close();const pe=`follower-${V.bootstrapId}`,ie=new eue(V.channel,{browserTransport:l.getTransport(),browserAPI:l,onSnapshot:K=>{s.panels.chat.loadMessages(K)},onUserMessage:K=>{s.panels.chat.addUserMessage(K)},onStatus:K=>{s.panels.chat.setProcessing(K==="processing")},onTargetsChanged:()=>void H()});se=ie,l.setTrayTargetProvider(ie),s.panels.chat.setAgent(ie),ie.requestSnapshot();const H=async()=>{try{const K=await l.listPages();ie.advertiseTargets(K.map(he=>({targetId:he.targetId,title:he.title,url:he.url})),pe)}catch{}};ee=setInterval(H,5e3),H(),_t.info("Follower sync wired to chat panel",{trayId:V.trayId})},ce=V=>{le?.cancel(),ee&&(clearInterval(ee),ee=null),se?.close(),se=null,le=Uce({joinUrl:V,runtime:"slicc-standalone",fetchImpl:Iv()},{onConnected:pe=>oe(pe),onReconnecting:pe=>{_t.info("Follower reconnecting",{attempt:pe})},onGaveUp:pe=>{_t.warn("Follower reconnect gave up",{lastError:pe})}})};if(window.addEventListener("slicc:tray-join",(V=>{ce(V.detail.joinUrl)})),window.addEventListener("beforeunload",()=>{ee&&clearInterval(ee),se?.close(),le?.cancel()},{once:!0}),X?.joinUrl)ce(X.joinUrl);else if(X?.workerBaseUrl){let V,pe,ie,H;const K=()=>{pe=new Xce({browserTransport:l.getTransport(),browserAPI:l,getMessages:()=>s.panels.chat.getMessages(),getScoopJid:()=>d?.jid??"cone",onFollowerMessage:(Te,Re)=>{s.panels.chat.addUserMessage(Te),_.sendMessage(Te,Re)},onFollowerAbort:()=>{_.stop()}}),A=pe,pse(()=>pe.getConnectedFollowers()),l.setTrayTargetProvider(pe),H&&clearInterval(H);const he=async()=>{try{const Te=await l.listPages();pe.setLocalTargets(Te.map(Re=>({targetId:Re.targetId,title:Re.title,url:Re.url})))}catch{}};H=setInterval(he,5e3),he(),ie=new Dce({sendControlMessage:Te=>V.sendControlMessage(Te),onPeerConnected:(Te,Re)=>{_t.info("Tray follower data channel opened",{controllerId:Te.controllerId,bootstrapId:Te.bootstrapId,attempt:Te.attempt,runtime:Te.runtime}),pe.addFollower(Te.bootstrapId,Re,{runtime:Te.runtime,connectedAt:Te.connectedAt??void 0})}})};K(),c.add(he=>{pe.broadcastEvent(he)}),V=new cse({workerBaseUrl:X.workerBaseUrl,runtime:"slicc-standalone",fetchImpl:Iv(),onControlMessage:he=>{if(he.type==="webhook.event"){P.handleWebhookEvent(he.webhookId,he.headers,he.body);return}ie.handleControlMessage(he).catch(Te=>{_t.warn("Tray leader bootstrap handling failed",{error:Te instanceof Error?Te.message:String(Te)})})}}),hse(async()=>{pe.stop(),ie.stop(),V.stop(),await V.clearSession();const he=await V.start(),Te=O6(window.location.href,he.workerBaseUrl,he.trayId);return Te!==window.location.href&&window.history.replaceState(window.history.state,"",Te),K(),pp()}),V.start().then(he=>{const Te=O6(window.location.href,he.workerBaseUrl,he.trayId);Te!==window.location.href&&window.history.replaceState(window.history.state,"",Te)}).catch(he=>{_t.warn("Leader tray join failed",{error:he instanceof Error?he.message:String(he)})}),window.addEventListener("beforeunload",()=>{clearInterval(H),pe.stop(),ie.stop(),V.stop()},{once:!0})}}_t.info("Orchestrator initialized — cone+scoops ready",{scoopCount:v.getScoops().length}),XP().catch(()=>{})}yue().catch(t=>{_t.error("Fatal error",t);const e=document.getElementById("app");if(e){const n=document.createElement("div");n.style.cssText="padding: 2rem; text-align: center;";const r=document.createElement("h1");r.style.color="var(--s2-negative, #e34850)",r.textContent="Failed to start";const i=document.createElement("p");i.style.color="var(--s2-content-tertiary, #717171)",i.textContent=t.message,n.appendChild(r),n.appendChild(i);const a=document.createElement("button");for(a.textContent="Reset all data & reload",a.style.cssText="margin-top: 1rem; padding: 0.5rem 1.5rem; background: var(--s2-negative, #e34850); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px;",a.addEventListener("click",async()=>{a.disabled=!0,a.textContent="Resetting…";const s=await indexedDB.databases();await Promise.all(s.map(o=>o.name?new Promise(l=>{const c=indexedDB.deleteDatabase(o.name);c.onsuccess=()=>l(),c.onerror=()=>l(),c.onblocked=()=>l()}):Promise.resolve())),location.reload()}),n.appendChild(a);e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n)}});export{Kv as A,uce as B,Uz as C,KS as D,Hue as E,sce as F,Yv as G,Gz as H,zz as I,Hz as J,NW as K,hae as L,ts as M,XS as R,Pue as S,hy as W,Vt as _,BD as a,$W as b,wn as c,pS as d,Eue as e,cF as f,xue as g,zue as h,Xle as i,Oue as j,Mue as k,Gue as l,que as m,Hf as n,jue as o,Tz as p,ZS as q,Rz as r,kue as s,RW as t,k0 as u,VS as v,HS as w,Az as x,ice as y,rO as z};
|