alchemylab-opencode 2.0.1 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NODE_COMPAT.md +8 -1
- package/dist/20260127222353_familiar_lady_ursula-YYOFSQD5.js +18 -0
- package/dist/20260211171708_add_project_commands-3GKQTPBZ.js +18 -0
- package/dist/20260213144116_wakeful_the_professor-ROO7OAVL.js +18 -0
- package/dist/20260225215848_workspace-V2OZTNFF.js +18 -0
- package/dist/20260227213759_add_session_workspace_id-GVDWAXKM.js +18 -0
- package/dist/20260228203230_blue_harpoon-Z5QP2II5.js +18 -0
- package/dist/20260303231226_add_workspace_fields-QOVAFN7W.js +18 -0
- package/dist/20260309230000_move_org_to_state-RQURSDZD.js +18 -0
- package/dist/20260312043431_session_message_cursor-VBISKDXL.js +18 -0
- package/dist/20260323234822_events-PILJHLNA.js +18 -0
- package/dist/20260410174513_workspace-name-63YCZ5NS.js +18 -0
- package/dist/20260413175956_chief_energizer-NMAZYGDO.js +18 -0
- package/dist/20260423070820_add_icon_url_override-RAJCVNEP.js +18 -0
- package/dist/20260427172553_slow_nightmare-ULYYZLR4.js +18 -0
- package/dist/20260428004200_add_session_path-U4WO2TGE.js +18 -0
- package/dist/20260501142318_next_venus-6BCYATSC.js +18 -0
- package/dist/20260504145000_add_sync_owner-RGVHV6LN.js +18 -0
- package/dist/20260507164347_add_workspace_time-GE6UHNPM.js +18 -0
- package/dist/{20260510033149_session_usage-UGBVOXZB.js → 20260510033149_session_usage-7XHCFVKY.js} +5 -1
- package/dist/20260511000411_data_migration_state-2EGZKFLB.js +18 -0
- package/dist/20260511173437_session-metadata-K322YY33.js +18 -0
- package/dist/20260601010001_normalize_storage_paths-VZDTY366.js +18 -0
- package/dist/{20260225215848_workspace-ZMSOZSPA.js → 20260601202201_amazing_prowler-YT6PLK3L.js} +5 -1
- package/dist/{20260228203230_blue_harpoon-IW3Z4TQZ.js → 20260602002951_lowly_union_jack-6VLQTBVB.js} +5 -1
- package/dist/20260602182828_add_project_directories-TVSRD25A.js +18 -0
- package/dist/20260603001617_session_message_projection_indexes-PHKTF6HK.js +18 -0
- package/dist/{20260622170816_reset_v2_session_state-5JPHJTZG.js → 20260603040000_session_message_projection_order-7RTV2POG.js} +5 -1
- package/dist/20260603141458_session_input_inbox-RSBWABG7.js +18 -0
- package/dist/20260603160727_jittery_ezekiel_stane-DXBLLRVV.js +18 -0
- package/dist/20260604172448_event_sourced_session_input-H6Z3JEBD.js +18 -0
- package/dist/20260605003541_add_session_context_snapshot-6FDPM2TK.js +18 -0
- package/dist/20260605042240_add_context_epoch_agent-C2OF2UKR.js +18 -0
- package/dist/20260611035744_credential-YNZ47FSH.js +18 -0
- package/dist/20260611192811_lush_chimera-E357VI6P.js +18 -0
- package/dist/20260612174303_project_dir_strategy-VUGGK42O.js +18 -0
- package/dist/20260622142730_simplify_session_context_epoch-UYGXZ5BX.js +18 -0
- package/dist/20260622170816_reset_v2_session_state-EILLPCJQ.js +18 -0
- package/dist/20260622202450_simplify_session_input-Y65GDGBO.js +18 -0
- package/dist/NodeSdk-AGMQWBHH.js +18 -0
- package/dist/anthropic-45OFTLAW.js +18 -0
- package/dist/anthropic-FVULF7C3.js +18 -0
- package/dist/app-runtime-LDQWNGWP.js +18 -0
- package/dist/chunk-2JE3QYG6.js +18 -0
- package/dist/chunk-2MRHL4B2.js +18 -0
- package/dist/chunk-4GJE6OMN.js +190 -0
- package/dist/chunk-4MBUHJHY.js +22 -0
- package/dist/chunk-5BLZCAU6.js +55 -0
- package/dist/chunk-7XX6TY62.js +259 -0
- package/dist/chunk-ANF3QA3Z.js +48 -0
- package/dist/chunk-AZUMH3TO.js +18 -0
- package/dist/chunk-B74WSFN4.js +878 -0
- package/dist/chunk-BQ4IEPN3.js +19 -0
- package/dist/chunk-CYRZU5QM.js +33 -0
- package/dist/chunk-DADVNQTM.js +1490 -0
- package/dist/chunk-DO2UZ6NY.js +18 -0
- package/dist/chunk-DWEYXIQI.js +780 -0
- package/dist/chunk-EK6FQQHY.js +20 -0
- package/dist/chunk-ELPXQ32J.js +90 -0
- package/dist/chunk-FGLPSSRK.js +19 -0
- package/dist/chunk-FOHYZ7MJ.js +55 -0
- package/dist/chunk-FV7U6PVP.js +18 -0
- package/dist/chunk-FYYAOZPU.js +18 -0
- package/dist/chunk-G7PFO5HG.js +920 -0
- package/dist/chunk-GDWO6EXN.js +22 -0
- package/dist/chunk-GW3ZRKAI.js +20 -0
- package/dist/chunk-IYUSBBGY.js +35 -0
- package/dist/chunk-JPOFLMNH.js +18 -0
- package/dist/{chunk-VURLSDCB.js → chunk-K5LKDIVU.js} +4 -0
- package/dist/chunk-KS4WLVK5.js +19 -0
- package/dist/chunk-LIXP4TPL.js +18 -0
- package/dist/chunk-LSC4RT5V.js +36 -0
- package/dist/chunk-M5A6NFHQ.js +28 -0
- package/dist/chunk-M6E6KNLV.js +30 -0
- package/dist/chunk-MLFZXUGQ.js +18 -0
- package/dist/chunk-NDI67DRG.js +31 -0
- package/dist/chunk-NGT6LCW6.js +18 -0
- package/dist/chunk-OCWGUTZJ.js +36 -0
- package/dist/chunk-OGDRUXMJ.js +18 -0
- package/dist/chunk-OGJKLJC7.js +29 -0
- package/dist/chunk-OT2YNR56.js +19 -0
- package/dist/chunk-OUVSKG2H.js +19 -0
- package/dist/chunk-P5RLCJUV.js +18 -0
- package/dist/chunk-Q3WIUQXB.js +18 -0
- package/dist/{20260227213759_add_session_workspace_id-ROENWPKA.js → chunk-QCRIXKIC.js} +5 -1
- package/dist/chunk-QD24DLUD.js +18 -0
- package/dist/chunk-R2GWBJEP.js +18 -0
- package/dist/chunk-RPAXSOGH.js +18 -0
- package/dist/chunk-TK5R7QUN.js +18 -0
- package/dist/chunk-TNQWZFIZ.js +28 -0
- package/dist/chunk-UCLPBO4I.js +18 -0
- package/dist/chunk-UPEPL4I2.js +18 -0
- package/dist/chunk-V6FDDNGV.js +117 -0
- package/dist/chunk-V6HERYFV.js +18 -0
- package/dist/chunk-V7XKKJ7X.js +24 -0
- package/dist/chunk-VHDYUBBS.js +23 -0
- package/dist/chunk-VWLJXTZ5.js +18 -0
- package/dist/chunk-VXAPFOIL.js +22 -0
- package/dist/chunk-WKZYINC7.js +29 -0
- package/dist/chunk-WPMP2ZFE.js +40 -0
- package/dist/chunk-WRTNIOI3.js +18 -0
- package/dist/chunk-X5F46HR5.js +18 -0
- package/dist/chunk-XPS7TQZG.js +22 -0
- package/dist/chunk-YJPP6IQ3.js +23 -0
- package/dist/chunk-ZYQWFC55.js +22 -0
- package/dist/code-mode-YYOGD36U.js +502 -0
- package/dist/copilot-provider-QVMLQZZC.js +18 -0
- package/dist/dist-5NQOHNPL.js +18 -0
- package/dist/dist-7CT3XCNN.js +32 -0
- package/dist/dist-CL46WFZG.js +18 -0
- package/dist/{20260605042240_add_context_epoch_agent-W6IQYZXE.js → dist-CYBRID2F.js} +5 -1
- package/dist/dist-HXJTF22W.js +32 -0
- package/dist/dist-JFXI53ZF.js +22 -0
- package/dist/dist-KBYKWVT5.js +22 -0
- package/dist/dist-KM5HCPZX.js +35 -0
- package/dist/dist-KTNLTEHB.js +18 -0
- package/dist/dist-KZ5R5QM5.js +24 -0
- package/dist/dist-NLXUYBW7.js +32 -0
- package/dist/dist-O4DF72J2.js +22 -0
- package/dist/dist-PH4MEGVR.js +22 -0
- package/dist/{20260511000411_data_migration_state-FB4LBFSE.js → dist-QJPOJCLB.js} +5 -1
- package/dist/dist-QYH62TCJ.js +22 -0
- package/dist/{20260303231226_add_workspace_fields-OUVZMNAG.js → dist-RIC4WKHC.js} +5 -1
- package/dist/dist-T776XKTM.js +22 -0
- package/dist/dist-TCE5MKZQ.js +23 -0
- package/dist/dist-TH2Q44RX.js +50 -0
- package/dist/dist-VV5FV5RT.js +101 -0
- package/dist/dist-XAFENVUS.js +22 -0
- package/dist/dist-XPFB35TX.js +32 -0
- package/dist/dist-YUH4RKR5.js +28 -0
- package/dist/dist-es-43ZM44MP.js +18 -0
- package/dist/dist-es-6PLFRCS4.js +18 -0
- package/dist/dist-es-G5UIJOU7.js +26 -0
- package/dist/{20260428004200_add_session_path-LGW75WYA.js → dist-es-HYIIGUNX.js} +5 -1
- package/dist/dist-es-L2GU465G.js +18 -0
- package/dist/dist-es-LSR2QCFZ.js +18 -0
- package/dist/dist-es-RGEIM2BP.js +18 -0
- package/dist/dist-es-SITTNOGV.js +18 -0
- package/dist/dist-es-W5GYOX6F.js +18 -0
- package/dist/esm-NN5W7YCL.js +18 -0
- package/dist/esm-XWJSHYHG.js +18 -0
- package/dist/getMachineId-bsd-L5I5TZ5I.js +18 -0
- package/dist/getMachineId-darwin-YB7KG37W.js +19 -0
- package/dist/getMachineId-linux-EL47KXX7.js +18 -0
- package/dist/getMachineId-unsupported-QOWPEBPN.js +18 -0
- package/dist/getMachineId-win-HCRYRDFJ.js +18 -0
- package/dist/lib-ZP7Q6A3E.js +199 -0
- package/dist/loadCognitoIdentity-EWT55EI7.js +18 -0
- package/dist/loadSso-AGOUE6RL.js +18 -0
- package/dist/{20260213144116_wakeful_the_professor-ZVDD54AK.js → loadSts-RH5L3PIX.js} +5 -1
- package/dist/mantle-IJXDXT4M.js +25 -0
- package/dist/mime-types-46EO4HOZ.js +18 -0
- package/dist/multipart-parser-KZWMKXA4.js +19 -0
- package/dist/{20260211171708_add_project_commands-GDOHPDPF.js → open-7KXTRM37.js} +5 -1
- package/dist/openai-ZOJI6I5R.js +18 -0
- package/dist/p-map-CYL6ILJW.js +18 -0
- package/dist/photon-W56QZY4L.js +18 -0
- package/dist/{20260423070820_add_icon_url_override-X5SHFGTI.js → pkce-VT4ITJTB.js} +5 -1
- package/dist/{pty.node-Y3N2XKYG.js → pty.node-IWULXXG6.js} +5 -1
- package/dist/run.js +5 -1
- package/dist/serve.js +143 -1
- package/dist/server-LVIHYOCY.js +21 -0
- package/dist/session-6OPJNJMK.js +18 -0
- package/dist/signin-OCIW23YM.js +18 -0
- package/dist/src-3NCXEROI.js +18 -0
- package/dist/src-LXWGIUZH.js +18 -0
- package/dist/src-WDYKISPD.js +20 -0
- package/dist/src-YAAFIGTW.js +18 -0
- package/dist/sso-oidc-OMMKINFE.js +18 -0
- package/dist/sts-MWK22JIX.js +18 -0
- package/dist/token-QPO3OAGS.js +18 -0
- package/dist/token-util-YGPCEEPO.js +18 -0
- package/dist/unified-W3ZKZ4HG.js +18 -0
- package/dist/worktree-32M5MTFE.js +18 -0
- package/package.json +40 -40
- package/postinstall.cjs +4 -2
- package/dist/20260127222353_familiar_lady_ursula-KV747FJX.js +0 -14
- package/dist/20260309230000_move_org_to_state-NOXAPU5V.js +0 -14
- package/dist/20260312043431_session_message_cursor-DJ4T3T4R.js +0 -14
- package/dist/20260323234822_events-72GIKJ2A.js +0 -14
- package/dist/20260410174513_workspace-name-JXSWFBJN.js +0 -14
- package/dist/20260413175956_chief_energizer-4HEWZ6U3.js +0 -14
- package/dist/20260427172553_slow_nightmare-PS5T2AH2.js +0 -14
- package/dist/20260501142318_next_venus-J3TLVXZ6.js +0 -14
- package/dist/20260504145000_add_sync_owner-3R52GB4C.js +0 -14
- package/dist/20260507164347_add_workspace_time-JHDRCZAR.js +0 -14
- package/dist/20260511173437_session-metadata-T2XHGWHS.js +0 -14
- package/dist/20260601010001_normalize_storage_paths-5MAY5GT3.js +0 -14
- package/dist/20260601202201_amazing_prowler-PET224YG.js +0 -14
- package/dist/20260602002951_lowly_union_jack-PG6XDMGL.js +0 -14
- package/dist/20260602182828_add_project_directories-ZCH2ACGG.js +0 -14
- package/dist/20260603001617_session_message_projection_indexes-XVLJTUF2.js +0 -14
- package/dist/20260603040000_session_message_projection_order-XG6RACZQ.js +0 -14
- package/dist/20260603141458_session_input_inbox-K2VQ7V6E.js +0 -14
- package/dist/20260603160727_jittery_ezekiel_stane-WKJLRDO7.js +0 -14
- package/dist/20260604172448_event_sourced_session_input-NTXOECR7.js +0 -14
- package/dist/20260605003541_add_session_context_snapshot-DXMQEXMT.js +0 -14
- package/dist/20260611035744_credential-XTMSYTJD.js +0 -14
- package/dist/20260611192811_lush_chimera-XPLIQMJD.js +0 -14
- package/dist/20260612174303_project_dir_strategy-FR2NGQKK.js +0 -14
- package/dist/20260622142730_simplify_session_context_epoch-NTQZR3RE.js +0 -14
- package/dist/20260622202450_simplify_session_input-2EXF2HMV.js +0 -14
- package/dist/app-runtime-HQBOCDV5.js +0 -14
- package/dist/chunk-4FEBIOI5.js +0 -865
- package/dist/chunk-4K2RXRZL.js +0 -14
- package/dist/chunk-4RFMKEKM.js +0 -1455
- package/dist/chunk-BM2C7NHL.js +0 -41
- package/dist/chunk-MKEMZFJI.js +0 -393
- package/dist/chunk-OMDJ6ZZ2.js +0 -684
- package/dist/chunk-OWMG4NNF.js +0 -186
- package/dist/chunk-QRABYJKL.js +0 -14
- package/dist/chunk-RHIWAYN5.js +0 -14
- package/dist/chunk-Z5TLIUAI.js +0 -28
- package/dist/code-mode-7BQJUARW.js +0 -40
- package/dist/copilot-provider-TX4YFKJZ.js +0 -14
- package/dist/photon-VQS5F5BI.js +0 -14
- package/dist/server-BFUQR7MX.js +0 -17
- package/dist/session-6RNXZNG6.js +0 -14
- package/dist/worktree-QHQHX3SG.js +0 -14
- package/patches/@ai-sdk%2Famazon-bedrock@4.0.166.patch +0 -164
- package/patches/@ai-sdk%2Fanthropic@3.0.111.patch +0 -528
- package/patches/@ai-sdk%2Fgoogle@3.0.73.patch +0 -69
- package/patches/@ai-sdk%2Fgroq@3.0.31.patch +0 -79
- package/patches/@ai-sdk%2Fmistral@3.0.51.patch +0 -714
- package/patches/@ai-sdk%2Fopenai-compatible@2.0.41.patch +0 -39
- package/patches/@ai-sdk%2Fopenai@3.0.88.patch +0 -280
- package/patches/@ai-sdk%2Fxai@3.0.139.patch +0 -296
- package/patches/@modelcontextprotocol%2Fsdk@1.29.0.patch +0 -647
- package/patches/@npmcli%2Fagent@4.0.2.patch +0 -13
- package/patches/effect@4.0.0-beta.83.patch +0 -57
- package/patches/gcp-metadata@8.1.2.patch +0 -14
- package/patches/pacote@21.5.0.patch +0 -18
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Built by esbuild from opencode-server source
|
|
2
|
+
if (typeof globalThis.Bun === 'undefined') {
|
|
3
|
+
globalThis.Bun = {
|
|
4
|
+
version: '0.0.0-node-compat',
|
|
5
|
+
stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
|
|
6
|
+
which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
|
|
10
|
+
if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
|
|
11
|
+
import { createRequire as __alchemyCreateRequire } from 'node:module';
|
|
12
|
+
const require = __alchemyCreateRequire(import.meta.url);
|
|
13
|
+
import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
|
|
14
|
+
import { dirname as __alchemyDirname } from 'node:path';
|
|
15
|
+
const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
|
|
16
|
+
const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
|
|
17
|
+
|
|
18
|
+
import{a as Z,b as pe,c as ye,d as ge,e as oe,f as Se,g as Be,h as Ke,i as xe,j as we,k as ke,l as Pe,m as Ee,n as B,o as K,p as ie,q as ee,r as le,s as Je,t as W,u as Re,v as _e,w as te,x as De}from"./chunk-4MBUHJHY.js";import{a as Ht}from"./chunk-5BLZCAU6.js";import{a as me,l as ze,n as Te}from"./chunk-WKZYINC7.js";import"./chunk-Q3WIUQXB.js";import{A as e}from"./chunk-WPMP2ZFE.js";import{a as b,g as qt}from"./chunk-2MRHL4B2.js";var Dt=qt(Ht(),1);function We(t){var n,o,l,i;if(t==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let s=(n=t.promptTokenCount)!=null?n:0,p=(o=t.candidatesTokenCount)!=null?o:0,m=(l=t.cachedContentTokenCount)!=null?l:0,u=(i=t.thoughtsTokenCount)!=null?i:0;return{inputTokens:{total:s,noCache:s-m,cacheRead:m,cacheWrite:void 0},outputTokens:{total:p+u,text:p,reasoning:u},raw:t}}b(We,"convertGoogleGenerativeAIUsage");function ae(t,n=!0){if(t==null)return;if(Vt(t))return n?void 0:typeof t=="object"&&t.description?{type:"object",description:t.description}:{type:"object"};if(typeof t=="boolean")return{type:"boolean",properties:{}};let{type:o,description:l,required:i,properties:s,items:p,allOf:m,anyOf:u,oneOf:h,format:v,const:T,minLength:c,enum:g}=t,y={};if(l&&(y.description=l),i&&(y.required=i),v&&(y.format=v),T!==void 0&&(y.enum=[T]),o)if(Array.isArray(o)){let d=o.includes("null"),f=o.filter(S=>S!=="null");f.length===0?y.type="null":(y.anyOf=f.map(S=>({type:S})),d&&(y.nullable=!0))}else y.type=o;if(g!==void 0&&(y.enum=g),s!=null&&(y.properties=Object.entries(s).reduce((d,[f,S])=>(d[f]=ae(S,!1),d),{})),p&&(y.items=Array.isArray(p)?p.map(d=>ae(d,!1)):ae(p,!1)),m&&(y.allOf=m.map(d=>ae(d,!1))),u)if(u.some(d=>typeof d=="object"&&d?.type==="null")){let d=u.filter(f=>!(typeof f=="object"&&f?.type==="null"));if(d.length===1){let f=ae(d[0],!1);typeof f=="object"&&(y.nullable=!0,Object.assign(y,f))}else y.anyOf=d.map(f=>ae(f,!1)),y.nullable=!0}else y.anyOf=u.map(d=>ae(d,!1));return h&&(y.oneOf=h.map(d=>ae(d,!1))),c!==void 0&&(y.minLength=c),y}b(ae,"convertJSONSchemaToOpenAPISchema");function Vt(t){return t!=null&&typeof t=="object"&&t.type==="object"&&(t.properties==null||Object.keys(t.properties).length===0)&&!t.additionalProperties}b(Vt,"isEmptyObjectSchema");var Ft="skip_thought_signature_validator";function Ye(t,n){let o=[n,"google","googleVertex","vertex"].filter((l,i,s)=>s.indexOf(l)===i);for(let l of o){let i=t?.[l];if(i!=null)return i}}b(Ye,"getGoogleProviderOptions");var $t=/^data:([^;,]+);base64,(.+)$/s;function zt(t){let n=$t.exec(t);if(n!=null)return{mediaType:n[1],data:n[2]}}b(zt,"parseBase64DataUrl");function Bt(t){let n=zt(t);if(n!=null)return{inlineData:{mimeType:n.mediaType,data:n.data}}}b(Bt,"convertUrlToolResultPart");function Kt(t,n,o,l,i=!0){let s=[],p=[];for(let m of o)switch(m.type){case"text":{p.push(m.text);break}case"image-data":case"file-data":{s.push({inlineData:{mimeType:m.mediaType,data:m.data}});break}case"image-url":case"file-url":{let u=Bt(m.url);u!=null?s.push(u):p.push(JSON.stringify(m));break}default:{p.push(JSON.stringify(m));break}}t.push({functionResponse:{...i&&l!=null?{id:l}:{},name:n,response:{name:n,content:p.length>0?p.join(`
|
|
19
|
+
`):"Tool executed successfully."},...s.length>0?{parts:s}:{}}})}b(Kt,"appendToolResultParts");function Jt(t,n,o,l,i=!0){for(let s of o)switch(s.type){case"text":t.push({functionResponse:{...i&&l!=null?{id:l}:{},name:n,response:{name:n,content:s.text}}});break;case"image-data":case"file-data":{let p=String(s.mediaType).split("/")[0];t.push({inlineData:{mimeType:String(s.mediaType),data:String(s.data)}},{text:`Tool executed successfully and returned this ${p==="image"?"image":"file"} as a response`});break}default:t.push({text:JSON.stringify(s)});break}}b(Jt,"appendLegacyToolResultParts");function Wt(t,n){var o,l,i,s,p,m;let u=[],h=[],v=!0,T=(o=n?.isGemmaModel)!=null?o:!1,c=(l=n?.isGemini3Model)!=null?l:!1,g=(i=n?.providerOptionsName)!=null?i:"google",y=(s=n?.supportsFunctionResponseParts)!=null?s:!0,d=n?.onWarning,f=(p=n?.includeFunctionCallIds)!=null?p:!0,S=!1,O=[],a=b(I=>(O.push(I),S=!0,Ft),"injectSkipSignature");for(let{role:I,content:w}of t)switch(I){case"system":{if(!v)throw new Te({functionality:"system messages are only supported at the beginning of the conversation"});u.push({text:w});break}case"user":{v=!1;let N=[];for(let _ of w)switch(_.type){case"text":{N.push({text:_.text});break}case"file":{let A=_.mediaType==="image/*"?"image/jpeg":_.mediaType;N.push(_.data instanceof URL?{fileData:{mimeType:A,fileUri:_.data.toString()}}:{inlineData:{mimeType:A,data:ge(_.data)}});break}}h.push({role:"user",parts:N});break}case"assistant":{v=!1;let N=!1;h.push({role:"model",parts:w.map(_=>{let A=Ye(_.providerOptions,g),k=A?.thoughtSignature!=null?String(A.thoughtSignature):void 0;switch(_.type){case"text":return _.text.length===0?void 0:{text:_.text,thoughtSignature:k};case"reasoning":return _.text.length===0?void 0:{text:_.text,thought:!0,thoughtSignature:k};case"file":{if(_.data instanceof URL)throw new Te({functionality:"File data URLs in assistant messages are not supported"});return{inlineData:{mimeType:_.mediaType,data:ge(_.data)},...A?.thought===!0?{thought:!0}:{},thoughtSignature:k}}case"tool-call":{let D=A?.serverToolCallId!=null?String(A.serverToolCallId):void 0,U=A?.serverToolType!=null?String(A.serverToolType):void 0,M=D!=null&&U!=null,C=!M&&k==null&&N,H=k??(c&&!C?a(_.toolName):void 0);return!M&&k!=null&&(N=!0),M?{toolCall:{toolType:U,args:typeof _.input=="string"?Ee(_.input):_.input,id:D},thoughtSignature:H}:{functionCall:{...f&&_.toolCallId!=null?{id:_.toolCallId}:{},name:_.toolName,args:_.input},thoughtSignature:H}}case"tool-result":{let D=A?.serverToolCallId!=null?String(A.serverToolCallId):void 0,U=A?.serverToolType!=null?String(A.serverToolType):void 0;return D&&U?{toolResponse:{toolType:U,response:_.output.type==="json"?_.output.value:{},id:D},thoughtSignature:k}:void 0}}}).filter(_=>_!==void 0)}),h[h.length-1].parts.length===0&&h.pop();break}case"tool":{v=!1;let N=[];for(let _ of w){if(_.type==="tool-approval-response")continue;let A=Ye(_.providerOptions,g),k=A?.serverToolCallId!=null?String(A.serverToolCallId):void 0,D=A?.serverToolType!=null?String(A.serverToolType):void 0;if(k&&D){let M=A?.thoughtSignature!=null?String(A.thoughtSignature):void 0;if(h.length>0){let C=h[h.length-1];if(C.role==="model"){C.parts.push({toolResponse:{toolType:D,response:_.output.type==="json"?_.output.value:{},id:k},thoughtSignature:M});continue}}}let U=_.output;U.type==="content"?y?Kt(N,_.toolName,U.value,_.toolCallId,f):Jt(N,_.toolName,U.value,_.toolCallId,f):N.push({functionResponse:{...f&&_.toolCallId!=null?{id:_.toolCallId}:{},name:_.toolName,response:{name:_.toolName,content:U.type==="execution-denied"?(m=U.reason)!=null?m:"Tool call execution denied.":U.value}}})}h.push({role:"user",parts:N});break}}if(T&&u.length>0&&h.length>0&&h[0].role==="user"){let I=u.map(w=>w.text).join(`
|
|
20
|
+
|
|
21
|
+
`);h[0].parts.unshift({text:I+`
|
|
22
|
+
|
|
23
|
+
`})}if(S&&d!=null){let I=Array.from(new Set(O));d({type:"other",message:`Replayed ${O.length} \`functionCall\` part(s) for a Gemini 3 model without a \`thoughtSignature\` (tools: ${I.map(w=>`\`${w}\``).join(", ")}). Injected the documented \`skip_thought_signature_validator\` sentinel to keep the request from failing with HTTP 400. The likely cause is application code that drops \`providerOptions.google.thoughtSignature\` when persisting or serializing assistant tool-call messages. See https://ai.google.dev/gemini-api/docs/thought-signatures.`})}return{systemInstruction:u.length>0&&!T?{parts:u}:void 0,contents:h}}b(Wt,"convertToGoogleGenerativeAIMessages");function Xe(t){return t.includes("/")?t:`models/${t}`}b(Xe,"getModelPath");var Yt=B(()=>K(e.object({error:e.object({code:e.number().nullable(),message:e.string(),status:e.string(),details:e.array(e.unknown()).nullish()})}))),fe=Re({errorSchema:Yt,errorToMessage:b(t=>t.error.message,"errorToMessage")}),Qe=B(()=>K(e.object({responseModalities:e.array(e.enum(["TEXT","IMAGE"])).optional(),thinkingConfig:e.object({thinkingBudget:e.number().optional(),includeThoughts:e.boolean().optional(),thinkingLevel:e.enum(["minimal","low","medium","high"]).optional()}).optional(),cachedContent:e.string().optional(),structuredOutputs:e.boolean().optional(),safetySettings:e.array(e.object({category:e.enum(["HARM_CATEGORY_UNSPECIFIED","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_CIVIC_INTEGRITY"]),threshold:e.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"])})).optional(),threshold:e.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"]).optional(),audioTimestamp:e.boolean().optional(),labels:e.record(e.string(),e.string()).optional(),mediaResolution:e.enum(["MEDIA_RESOLUTION_UNSPECIFIED","MEDIA_RESOLUTION_LOW","MEDIA_RESOLUTION_MEDIUM","MEDIA_RESOLUTION_HIGH"]).optional(),imageConfig:e.object({aspectRatio:e.enum(["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9","21:9","1:8","8:1","1:4","4:1"]).optional(),imageSize:e.enum(["1K","2K","4K","512"]).optional(),personGeneration:e.enum(["PERSON_GENERATION_UNSPECIFIED","ALLOW_ALL","ALLOW_ADULT","ALLOW_NONE"]).optional(),prominentPeople:e.enum(["PROMINENT_PEOPLE_UNSPECIFIED","ALLOW_PROMINENT_PEOPLE","BLOCK_PROMINENT_PEOPLE"]).optional(),imageOutputOptions:e.object({mimeType:e.enum(["image/jpeg","image/png"]).optional(),compressionQuality:e.number().optional()}).optional()}).optional(),retrievalConfig:e.object({latLng:e.object({latitude:e.number(),longitude:e.number()}).optional()}).optional(),streamFunctionCallArguments:e.boolean().optional(),serviceTier:e.enum(["standard","flex","priority"]).optional(),sharedRequestType:e.enum(["priority","flex","standard"]).optional(),requestType:e.enum(["shared"]).optional()}))),Xt=/(^|\/)gemini-1(?:[.-]|$)/i,Qt=/(^|\/)gemini-2(?:[.-]|$)/i,Zt=/(^|\/)gemini-2\.5(?:[.-]|$)/i,en=/(^|\/)gemini-/i;function tn(t){return Xt.test(t)||/(^|\/)gemini-pro(?:-vision)?$/i.test(t)||/(^|\/)gemini-robotics-er-1\.5(?:[.-]|$)/i.test(t)}b(tn,"isKnownPreGemini2Model");function rt(t){let n=en.test(t),o=Qt.test(t),l=tn(t),s=n&&!(l||o);return{supportsGemini2Tools:n&&!l||t.toLowerCase().includes("nano-banana"),supportsFileSearch:Zt.test(t)||s,usesGemini3Features:s}}b(rt,"getGoogleModelCapabilities");function nn({tools:t,toolChoice:n,modelId:o,isVertexProvider:l=!1}){var i,s;t=t?.length?t:void 0;let p=[],{supportsGemini2Tools:m,supportsFileSearch:u,usesGemini3Features:h}=rt(o);if(t==null)return{tools:void 0,toolConfig:void 0,toolWarnings:p};let v=t.some(d=>d.type==="function"),T=t.some(d=>d.type==="provider");if(v&&T&&!h&&p.push({type:"unsupported",feature:"combination of function and provider-defined tools"}),T){let d=[];if(t.filter(S=>S.type==="provider").forEach(S=>{switch(S.id){case"google.google_search":m?d.push({googleSearch:{...S.args}}):p.push({type:"unsupported",feature:`provider-defined tool ${S.id}`,details:"Google Search requires Gemini 2.0 or newer."});break;case"google.enterprise_web_search":m?d.push({enterpriseWebSearch:{}}):p.push({type:"unsupported",feature:`provider-defined tool ${S.id}`,details:"Enterprise Web Search requires Gemini 2.0 or newer."});break;case"google.url_context":m?d.push({urlContext:{}}):p.push({type:"unsupported",feature:`provider-defined tool ${S.id}`,details:"The URL context tool is not supported with other Gemini models than Gemini 2."});break;case"google.code_execution":m?d.push({codeExecution:{}}):p.push({type:"unsupported",feature:`provider-defined tool ${S.id}`,details:"The code execution tool is not supported with other Gemini models than Gemini 2."});break;case"google.file_search":u?d.push({fileSearch:{...S.args}}):p.push({type:"unsupported",feature:`provider-defined tool ${S.id}`,details:"The file search tool is only supported with Gemini 2.5 models and Gemini 3 models."});break;case"google.vertex_rag_store":m?d.push({retrieval:{vertex_rag_store:{rag_resources:{rag_corpus:S.args.ragCorpus},similarity_top_k:S.args.topK}}}):p.push({type:"unsupported",feature:`provider-defined tool ${S.id}`,details:"The RAG store tool is not supported with other Gemini models than Gemini 2."});break;case"google.google_maps":m?d.push({googleMaps:{}}):p.push({type:"unsupported",feature:`provider-defined tool ${S.id}`,details:"The Google Maps grounding tool is not supported with Gemini models other than Gemini 2 or newer."});break;default:p.push({type:"unsupported",feature:`provider-defined tool ${S.id}`});break}}),v&&h&&d.length>0){let S=[];for(let a of t)a.type==="function"&&S.push({name:a.name,description:(i=a.description)!=null?i:"",parameters:ae(a.inputSchema)});let O={functionCallingConfig:{mode:"VALIDATED"},...!l&&{includeServerSideToolInvocations:!0}};if(n!=null)switch(n.type){case"auto":break;case"none":O.functionCallingConfig={mode:"NONE"};break;case"required":O.functionCallingConfig={mode:"ANY"};break;case"tool":O.functionCallingConfig={mode:"ANY",allowedFunctionNames:[n.toolName]};break}return{tools:[...d,{functionDeclarations:S}],toolConfig:O,toolWarnings:p}}return{tools:d.length>0?d:void 0,toolConfig:void 0,toolWarnings:p}}let c=[],g=!1;for(let d of t)d.type==="function"?(c.push({name:d.name,description:(s=d.description)!=null?s:"",parameters:ae(d.inputSchema)}),d.strict===!0&&(g=!0)):p.push({type:"unsupported",feature:`function tool ${d.name}`});if(n==null)return{tools:[{functionDeclarations:c}],toolConfig:g?{functionCallingConfig:{mode:"VALIDATED"}}:void 0,toolWarnings:p};let y=n.type;switch(y){case"auto":return{tools:[{functionDeclarations:c}],toolConfig:{functionCallingConfig:{mode:g?"VALIDATED":"AUTO"}},toolWarnings:p};case"none":return{tools:[{functionDeclarations:c}],toolConfig:{functionCallingConfig:{mode:"NONE"}},toolWarnings:p};case"required":return{tools:[{functionDeclarations:c}],toolConfig:{functionCallingConfig:{mode:"ANY"}},toolWarnings:p};case"tool":return{tools:[{functionDeclarations:c}],toolConfig:{functionCallingConfig:{mode:"ANY",allowedFunctionNames:[n.toolName]}},toolWarnings:p};default:{let d=y;throw new Te({functionality:`tool choice type: ${d}`})}}}b(nn,"prepareTools");var on=class{static{b(this,"GoogleJSONAccumulator")}constructor(){this.accumulatedArgs={},this.jsonText="",this.pathStack=[],this.stringOpen=!1}processPartialArgs(t){let n="";for(let o of t){let l=o.jsonPath.replace(/^\$\./,"");if(!l)continue;let i=ln(l),s=an(this.accumulatedArgs,i);if(o.stringValue!=null&&s!==void 0){let u=JSON.stringify(o.stringValue).slice(1,-1);et(this.accumulatedArgs,i,s+o.stringValue),n+=u;continue}let m=rn(o);m!=null&&(et(this.accumulatedArgs,i,m.value),n+=this.emitNavigationTo(i,o,m.json))}return this.jsonText+=n,{currentJSON:this.accumulatedArgs,textDelta:n}}finalize(){let t=JSON.stringify(this.accumulatedArgs),n=t.slice(this.jsonText.length);return{finalJSON:t,closingDelta:n}}ensureRoot(){return this.pathStack.length===0?(this.pathStack.push({segment:"",isArray:!1,childCount:0}),"{"):""}emitNavigationTo(t,n,o){let l="";this.stringOpen&&(l+='"',this.stringOpen=!1),l+=this.ensureRoot();let i=t.slice(0,-1),s=t[t.length-1],p=this.findCommonStackDepth(i);return l+=this.closeDownTo(p),l+=this.openDownTo(i,s),l+=this.emitLeaf(s,n,o),l}findCommonStackDepth(t){let n=Math.min(this.pathStack.length-1,t.length),o=0;for(let l=0;l<n&&this.pathStack[l+1].segment===t[l];l++)o++;return o+1}closeDownTo(t){let n="";for(;this.pathStack.length>t;){let o=this.pathStack.pop();n+=o.isArray?"]":"}"}return n}openDownTo(t,n){let o="",l=this.pathStack.length-1;for(let i=l;i<t.length;i++){let s=t[i],p=this.pathStack[this.pathStack.length-1];p.childCount>0&&(o+=","),p.childCount++,typeof s=="string"&&(o+=`${JSON.stringify(s)}:`);let u=typeof(i+1<t.length?t[i+1]:n)=="number";o+=u?"[":"{",this.pathStack.push({segment:s,isArray:u,childCount:0})}return o}emitLeaf(t,n,o){let l="",i=this.pathStack[this.pathStack.length-1];return i.childCount>0&&(l+=","),i.childCount++,typeof t=="string"&&(l+=`${JSON.stringify(t)}:`),n.stringValue!=null&&n.willContinue?(l+=o.slice(0,-1),this.stringOpen=!0):l+=o,l}};function ln(t){let n=[];for(let o of t.split(".")){let l=o.indexOf("[");if(l===-1)n.push(o);else{l>0&&n.push(o.slice(0,l));for(let i of o.matchAll(/\[(\d+)\]/g))n.push(parseInt(i[1],10))}}return n}b(ln,"parsePath");var sn=Object.prototype.hasOwnProperty;function ut(t,n){return sn.call(t,n)}b(ut,"hasOwnProperty");function Ze(t,n,o){Object.defineProperty(t,n,{value:o,enumerable:!0,configurable:!0,writable:!0})}b(Ze,"defineOwnProperty");function an(t,n){let o=t;for(let l of n){if(o==null||typeof o!="object")return;let i=o;if(!ut(i,l))return;o=i[l]}return o}b(an,"getNestedValue");function et(t,n,o){let l=t;for(let i=0;i<n.length-1;i++){let s=n[i],p=n[i+1];(!ut(l,s)||l[s]==null)&&Ze(l,s,typeof p=="number"?[]:{}),l=l[s]}Ze(l,n[n.length-1],o)}b(et,"setNestedValue");function rn(t){var n,o;let l=(o=(n=t.stringValue)!=null?n:t.numberValue)!=null?o:t.boolValue;if(l!=null)return{value:l,json:JSON.stringify(l)};if("nullValue"in t)return{value:null,json:"null"}}b(rn,"resolvePartialArgValue");function tt({finishReason:t,hasToolCalls:n}){switch(t){case"STOP":return n?"tool-calls":"stop";case"MAX_TOKENS":return"length";case"IMAGE_SAFETY":case"RECITATION":case"SAFETY":case"BLOCKLIST":case"PROHIBITED_CONTENT":case"SPII":return"content-filter";case"MALFORMED_FUNCTION_CALL":return"error";default:return"other"}}b(tt,"mapGoogleGenerativeAIFinishReason");var un=["HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_SEXUALLY_EXPLICIT"],Ne=class{static{b(this,"GoogleGenerativeAILanguageModel")}constructor(t,n){this.specificationVersion="v3";var o;this.modelId=t,this.config=n,this.generateId=(o=n.generateId)!=null?o:oe}get provider(){return this.config.provider}get supportedUrls(){var t,n,o;return(o=(n=(t=this.config).supportedUrls)==null?void 0:n.call(t))!=null?o:{}}async getArgs({prompt:t,maxOutputTokens:n,temperature:o,topP:l,topK:i,frequencyPenalty:s,presencePenalty:p,stopSequences:m,responseFormat:u,seed:h,tools:v,toolChoice:T,providerOptions:c},{isStreaming:g=!1}={}){var y,d,f;let S=[],O=this.config.provider.includes("vertex")?"vertex":"google",a=await ie({provider:O,providerOptions:c,schema:Qe});a==null&&O!=="google"&&(a=await ie({provider:"google",providerOptions:c,schema:Qe}));let I=this.config.provider.startsWith("google.vertex.");v?.some(j=>j.type==="provider"&&j.id==="google.vertex_rag_store")&&!I&&S.push({type:"other",message:`The 'vertex_rag_store' tool is only supported with the Google Vertex provider and might not be supported or could behave unexpectedly with the current Google provider (${this.config.provider}).`}),a?.streamFunctionCallArguments&&!I&&S.push({type:"other",message:`'streamFunctionCallArguments' is only supported on the Vertex AI API and will be ignored with the current Google provider (${this.config.provider}). See https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc`}),a?.serviceTier&&I&&S.push({type:"other",message:"'serviceTier' is a Gemini API option and is not supported on Vertex AI. Use 'sharedRequestType' (and optionally 'requestType') instead. See https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo"}),(a?.sharedRequestType||a?.requestType)&&!I&&S.push({type:"other",message:`'sharedRequestType' and 'requestType' are Vertex AI options and are ignored with the current Google provider (${this.config.provider}).`});let w=I&&(a?.sharedRequestType||a?.requestType)?{...a.sharedRequestType&&{"X-Vertex-AI-LLM-Shared-Request-Type":a.sharedRequestType},...a.requestType&&{"X-Vertex-AI-LLM-Request-Type":a.requestType}}:void 0,N=I?void 0:a?.serviceTier,_=a?.imageConfig;if(_!=null&&!I){let{personGeneration:j,prominentPeople:L,imageOutputOptions:r,...G}=_,x=Object.entries({personGeneration:j,prominentPeople:L,imageOutputOptions:r}).filter(([,E])=>E!=null).map(([E])=>`'imageConfig.${E}'`);x.length>0&&(S.push({type:"other",message:`${x.join(", ")} ${x.length===1?"is a Vertex AI option and is":"are Vertex AI options and are"} ignored with the current Google provider (${this.config.provider}).`}),_=G)}let A=this.modelId.toLowerCase().startsWith("gemma-"),{usesGemini3Features:k}=rt(this.modelId),{contents:D,systemInstruction:U}=Wt(t,{isGemmaModel:A,isGemini3Model:k,providerOptionsName:O,supportsFunctionResponseParts:k,onWarning:b(j=>S.push(j),"onWarning"),includeFunctionCallIds:!I}),{tools:M,toolConfig:C,toolWarnings:H}=nn({tools:v,toolChoice:T,modelId:this.modelId,isVertexProvider:I}),$=g&&I?(y=a?.streamFunctionCallArguments)!=null?y:!1:void 0,J=a?.threshold,Y=(d=a?.safetySettings)!=null?d:J!=null?un.map(j=>({category:j,threshold:J})):void 0,z=C||$||a?.retrievalConfig?{...C,...$&&{functionCallingConfig:{...C?.functionCallingConfig,streamFunctionCallArguments:!0}},...a?.retrievalConfig&&{retrievalConfig:a.retrievalConfig}}:void 0;return{args:{generationConfig:{maxOutputTokens:n,temperature:o,topK:i,topP:l,frequencyPenalty:s,presencePenalty:p,stopSequences:m,seed:h,responseMimeType:u?.type==="json"?"application/json":void 0,responseSchema:u?.type==="json"&&u.schema!=null&&((f=a?.structuredOutputs)==null||f)?ae(u.schema):void 0,...a?.audioTimestamp&&{audioTimestamp:a.audioTimestamp},responseModalities:a?.responseModalities,thinkingConfig:a?.thinkingConfig,...a?.mediaResolution&&{mediaResolution:a.mediaResolution},..._&&{imageConfig:_}},contents:D,systemInstruction:A?void 0:U,safetySettings:Y,tools:M,toolConfig:z,cachedContent:a?.cachedContent,labels:a?.labels,serviceTier:N},warnings:[...S,...H],providerOptionsName:O,extraHeaders:w}}async doGenerate(t){var n,o,l,i,s,p,m,u,h,v,T,c,g,y,d,f,S,O,a;let{args:I,warnings:w,providerOptionsName:N,extraHeaders:_}=await this.getArgs(t),A=Z(await W(this.config.headers),t.headers,_),{responseHeaders:k,value:D,rawValue:U}=await ee({url:`${this.config.baseURL}/${Xe(this.modelId)}:generateContent`,headers:A,body:I,failedResponseHandler:fe,successfulResponseHandler:te(dn),abortSignal:t.abortSignal,fetch:this.config.fetch}),M=D.candidates[0],C=[],H=(o=(n=M.content)==null?void 0:n.parts)!=null?o:[],$=D.usageMetadata,J,Y;for(let j of H)if("executableCode"in j&&((l=j.executableCode)!=null&&l.code)){let L=this.config.generateId();J=L,C.push({type:"tool-call",toolCallId:L,toolName:"code_execution",input:JSON.stringify(j.executableCode),providerExecuted:!0})}else if("codeExecutionResult"in j&&j.codeExecutionResult)C.push({type:"tool-result",toolCallId:J,toolName:"code_execution",result:{outcome:j.codeExecutionResult.outcome,output:(i=j.codeExecutionResult.output)!=null?i:""}});else if("text"in j&&j.text!=null){let L=j.thoughtSignature?{[N]:{thoughtSignature:j.thoughtSignature}}:void 0;if(j.text.length===0){if(L!=null&&C.length>0){let r=C[C.length-1];r.providerMetadata=L}}else C.push({type:j.thought===!0?"reasoning":"text",text:j.text,providerMetadata:L})}else if("functionCall"in j&&j.functionCall.name!=null)C.push({type:"tool-call",toolCallId:(s=j.functionCall.id)!=null?s:this.config.generateId(),toolName:j.functionCall.name,input:JSON.stringify((p=j.functionCall.args)!=null?p:{}),providerMetadata:j.thoughtSignature?{[N]:{thoughtSignature:j.thoughtSignature}}:void 0});else if("inlineData"in j){let L=j.thought===!0,r=!!j.thoughtSignature;C.push({type:"file",data:j.inlineData.data,mediaType:j.inlineData.mimeType,providerMetadata:L||r?{[N]:{...L?{thought:!0}:{},...r?{thoughtSignature:j.thoughtSignature}:{}}}:void 0})}else if("toolCall"in j&&j.toolCall){let L=(m=j.toolCall.id)!=null?m:this.config.generateId();Y=L,C.push({type:"tool-call",toolCallId:L,toolName:`server:${j.toolCall.toolType}`,input:JSON.stringify((u=j.toolCall.args)!=null?u:{}),providerExecuted:!0,dynamic:!0,providerMetadata:j.thoughtSignature?{[N]:{thoughtSignature:j.thoughtSignature,serverToolCallId:L,serverToolType:j.toolCall.toolType}}:{[N]:{serverToolCallId:L,serverToolType:j.toolCall.toolType}}})}else if("toolResponse"in j&&j.toolResponse){let L=(h=Y??j.toolResponse.id)!=null?h:this.config.generateId();C.push({type:"tool-result",toolCallId:L,toolName:`server:${j.toolResponse.toolType}`,result:(v=j.toolResponse.response)!=null?v:{},providerMetadata:j.thoughtSignature?{[N]:{thoughtSignature:j.thoughtSignature,serverToolCallId:L,serverToolType:j.toolResponse.toolType}}:{[N]:{serverToolCallId:L,serverToolType:j.toolResponse.toolType}}}),Y=void 0}let z=(T=nt({groundingMetadata:M.groundingMetadata,generateId:this.config.generateId}))!=null?T:[];for(let j of z)C.push(j);return{content:C,finishReason:{unified:tt({finishReason:M.finishReason,hasToolCalls:C.some(j=>j.type==="tool-call"&&!j.providerExecuted)}),raw:(c=M.finishReason)!=null?c:void 0},usage:We($),warnings:w,providerMetadata:{[N]:{promptFeedback:(g=D.promptFeedback)!=null?g:null,groundingMetadata:(y=M.groundingMetadata)!=null?y:null,urlContextMetadata:(d=M.urlContextMetadata)!=null?d:null,safetyRatings:(f=M.safetyRatings)!=null?f:null,usageMetadata:$??null,finishMessage:(S=M.finishMessage)!=null?S:null,serviceTier:(O=$?.serviceTier)!=null?O:null}},request:{body:I},response:{id:(a=D.responseId)!=null?a:void 0,headers:k,body:U}}}async doStream(t){let{args:n,warnings:o,providerOptionsName:l,extraHeaders:i}=await this.getArgs(t,{isStreaming:!0}),s=Z(await W(this.config.headers),t.headers,i),{responseHeaders:p,value:m}=await ee({url:`${this.config.baseURL}/${Xe(this.modelId)}:streamGenerateContent?alt=sse`,headers:s,body:n,failedResponseHandler:fe,successfulResponseHandler:_e(pn),abortSignal:t.abortSignal,fetch:this.config.fetch}),u={unified:"other",raw:void 0},h,v,T=null,c=null,g=this.config.generateId,y=!1,d=!1,f=null,S=null,O=0,a=new Set,I,w,N=[],_=b(A=>{let k=N.pop();if(k==null)return;let{finalJSON:D,closingDelta:U}=k.accumulator.finalize();U.length>0&&A.enqueue({type:"tool-input-delta",id:k.toolCallId,delta:U,providerMetadata:k.providerMetadata}),A.enqueue({type:"tool-input-end",id:k.toolCallId,providerMetadata:k.providerMetadata}),A.enqueue({type:"tool-call",toolCallId:k.toolCallId,toolName:k.toolName,input:D,providerMetadata:k.providerMetadata}),y=!0},"finishActiveStreamingToolCall");return{stream:m.pipeThrough(new TransformStream({start(A){A.enqueue({type:"stream-start",warnings:o})},transform(A,k){var D,U,M,C,H,$,J,Y,z,j,L,r,G,x,E,q;if(t.includeRawChunks&&k.enqueue({type:"raw",rawValue:A.rawValue}),!A.success){k.enqueue({type:"error",error:A.error});return}let F=A.value;!d&&F.responseId!=null&&(d=!0,k.enqueue({type:"response-metadata",id:F.responseId}));let X=F.usageMetadata;X!=null&&(h=X);let P=(D=F.candidates)==null?void 0:D[0];if(P==null)return;let ue=P.content;P.groundingMetadata!=null&&(T=P.groundingMetadata),P.urlContextMetadata!=null&&(c=P.urlContextMetadata);let ve=nt({groundingMetadata:P.groundingMetadata,generateId:g});if(ve!=null)for(let Q of ve)Q.sourceType==="url"&&!a.has(Q.url)&&(a.add(Q.url),k.enqueue(Q));if(ue!=null){let Q=(U=ue.parts)!=null?U:[];for(let R of Q)if("executableCode"in R&&((M=R.executableCode)!=null&&M.code)){let V=g();I=V,k.enqueue({type:"tool-call",toolCallId:V,toolName:"code_execution",input:JSON.stringify(R.executableCode),providerExecuted:!0})}else if("codeExecutionResult"in R&&R.codeExecutionResult){let V=I;V&&k.enqueue({type:"tool-result",toolCallId:V,toolName:"code_execution",result:{outcome:R.codeExecutionResult.outcome,output:(C=R.codeExecutionResult.output)!=null?C:""}})}else if("text"in R&&R.text!=null){let V=R.thoughtSignature?{[l]:{thoughtSignature:R.thoughtSignature}}:void 0;R.text.length===0?V!=null&&f!==null&&k.enqueue({type:"text-delta",id:f,delta:"",providerMetadata:V}):R.thought===!0?(f!==null&&(k.enqueue({type:"text-end",id:f}),f=null),S===null&&(S=String(O++),k.enqueue({type:"reasoning-start",id:S,providerMetadata:V})),k.enqueue({type:"reasoning-delta",id:S,delta:R.text,providerMetadata:V})):(S!==null&&(k.enqueue({type:"reasoning-end",id:S}),S=null),f===null&&(f=String(O++),k.enqueue({type:"text-start",id:f,providerMetadata:V})),k.enqueue({type:"text-delta",id:f,delta:R.text,providerMetadata:V}))}else if("inlineData"in R){f!==null&&(k.enqueue({type:"text-end",id:f}),f=null),S!==null&&(k.enqueue({type:"reasoning-end",id:S}),S=null);let V=R.thought===!0,ce=!!R.thoughtSignature,je=V||ce?{[l]:{...V?{thought:!0}:{},...ce?{thoughtSignature:R.thoughtSignature}:{}}}:void 0;k.enqueue({type:"file",mediaType:R.inlineData.mimeType,data:R.inlineData.data,providerMetadata:je})}else if("toolCall"in R&&R.toolCall){let V=(H=R.toolCall.id)!=null?H:g();w=V;let ce={[l]:{...R.thoughtSignature?{thoughtSignature:R.thoughtSignature}:{},serverToolCallId:V,serverToolType:R.toolCall.toolType}};k.enqueue({type:"tool-call",toolCallId:V,toolName:`server:${R.toolCall.toolType}`,input:JSON.stringify(($=R.toolCall.args)!=null?$:{}),providerExecuted:!0,dynamic:!0,providerMetadata:ce})}else if("toolResponse"in R&&R.toolResponse){let V=(J=w??R.toolResponse.id)!=null?J:g(),ce={[l]:{...R.thoughtSignature?{thoughtSignature:R.thoughtSignature}:{},serverToolCallId:V,serverToolType:R.toolResponse.toolType}};k.enqueue({type:"tool-result",toolCallId:V,toolName:`server:${R.toolResponse.toolType}`,result:(Y=R.toolResponse.response)!=null?Y:{},providerMetadata:ce}),w=void 0}for(let R of Q){if(!("functionCall"in R))continue;let V=R.thoughtSignature?{[l]:{thoughtSignature:R.thoughtSignature}}:void 0,ce=R.functionCall.partialArgs!=null||R.functionCall.name!=null&&R.functionCall.willContinue===!0,je=R.functionCall.name==null&&R.functionCall.args==null&&R.functionCall.partialArgs==null&&R.functionCall.willContinue==null,Lt=R.functionCall.name!=null&&R.functionCall.args!=null&&R.functionCall.partialArgs==null,Gt=R.functionCall.name!=null&&R.functionCall.args==null&&R.functionCall.partialArgs==null&&R.functionCall.willContinue!==!0;if(ce){if(R.functionCall.name!=null){let ne=(z=R.functionCall.id)!=null?z:g(),se=new on;if(N.push({toolCallId:ne,toolName:R.functionCall.name,accumulator:se,providerMetadata:V}),k.enqueue({type:"tool-input-start",id:ne,toolName:R.functionCall.name,providerMetadata:V}),R.functionCall.partialArgs!=null){let de=R.functionCall.partialArgs,{textDelta:Ie}=se.processPartialArgs(de);Ie.length>0&&k.enqueue({type:"tool-input-delta",id:ne,delta:Ie,providerMetadata:V}),R.functionCall.willContinue!==!0&&de.every(Ut=>Ut.willContinue!==!0)&&_(k)}}else if(R.functionCall.partialArgs!=null&&N.length>0){let ne=N[N.length-1],se=R.functionCall.partialArgs,{textDelta:de}=ne.accumulator.processPartialArgs(se);de.length>0&&k.enqueue({type:"tool-input-delta",id:ne.toolCallId,delta:de,providerMetadata:V}),R.functionCall.willContinue!==!0&&se.every(Ie=>Ie.willContinue!==!0)&&_(k)}}else if(je&&N.length>0)_(k);else if(Lt){let ne=(j=R.functionCall.id)!=null?j:g(),se=R.functionCall.name,de=typeof R.functionCall.args=="string"?R.functionCall.args:JSON.stringify((L=R.functionCall.args)!=null?L:{});k.enqueue({type:"tool-input-start",id:ne,toolName:se,providerMetadata:V}),k.enqueue({type:"tool-input-delta",id:ne,delta:de,providerMetadata:V}),k.enqueue({type:"tool-input-end",id:ne,providerMetadata:V}),k.enqueue({type:"tool-call",toolCallId:ne,toolName:se,input:de,providerMetadata:V}),y=!0}else if(Gt){let ne=(r=R.functionCall.id)!=null?r:g(),se=R.functionCall.name;k.enqueue({type:"tool-input-start",id:ne,toolName:se,providerMetadata:V}),k.enqueue({type:"tool-input-end",id:ne,providerMetadata:V}),k.enqueue({type:"tool-call",toolCallId:ne,toolName:se,input:"{}",providerMetadata:V}),y=!0}}}P.finishReason!=null&&(u={unified:tt({finishReason:P.finishReason,hasToolCalls:y}),raw:P.finishReason},v={[l]:{promptFeedback:(G=F.promptFeedback)!=null?G:null,groundingMetadata:T,urlContextMetadata:c,safetyRatings:(x=P.safetyRatings)!=null?x:null,usageMetadata:X??null,finishMessage:(E=P.finishMessage)!=null?E:null,serviceTier:(q=h?.serviceTier)!=null?q:null}})},flush(A){f!==null&&A.enqueue({type:"text-end",id:f}),S!==null&&A.enqueue({type:"reasoning-end",id:S}),A.enqueue({type:"finish",finishReason:u,usage:We(h),providerMetadata:v})}})),response:{headers:p},request:{body:n}}}};function nt({groundingMetadata:t,generateId:n}){var o,l,i,s,p,m;if(!t?.groundingChunks)return;let u=[];for(let h of t.groundingChunks)if(h.web!=null)u.push({type:"source",sourceType:"url",id:n(),url:h.web.uri,title:(o=h.web.title)!=null?o:void 0});else if(h.image!=null)u.push({type:"source",sourceType:"url",id:n(),url:h.image.sourceUri,title:(l=h.image.title)!=null?l:void 0});else if(h.retrievedContext!=null){let v=h.retrievedContext.uri,T=h.retrievedContext.fileSearchStore;if(v&&(v.startsWith("http://")||v.startsWith("https://")))u.push({type:"source",sourceType:"url",id:n(),url:v,title:(i=h.retrievedContext.title)!=null?i:void 0});else if(v){let c=(s=h.retrievedContext.title)!=null?s:"Unknown Document",g="application/octet-stream",y;v.endsWith(".pdf")?(g="application/pdf",y=v.split("/").pop()):v.endsWith(".txt")?(g="text/plain",y=v.split("/").pop()):v.endsWith(".docx")?(g="application/vnd.openxmlformats-officedocument.wordprocessingml.document",y=v.split("/").pop()):v.endsWith(".doc")?(g="application/msword",y=v.split("/").pop()):(v.match(/\.(md|markdown)$/)&&(g="text/markdown"),y=v.split("/").pop()),u.push({type:"source",sourceType:"document",id:n(),mediaType:g,title:c,filename:y})}else if(T){let c=(p=h.retrievedContext.title)!=null?p:"Unknown Document";u.push({type:"source",sourceType:"document",id:n(),mediaType:"application/octet-stream",title:c,filename:T.split("/").pop()})}}else h.maps!=null&&h.maps.uri&&u.push({type:"source",sourceType:"url",id:n(),url:h.maps.uri,title:(m=h.maps.title)!=null?m:void 0});return u.length>0?u:void 0}b(nt,"extractSources");var ct=b(()=>e.object({webSearchQueries:e.array(e.string()).nullish(),imageSearchQueries:e.array(e.string()).nullish(),retrievalQueries:e.array(e.string()).nullish(),searchEntryPoint:e.object({renderedContent:e.string()}).nullish(),groundingChunks:e.array(e.object({web:e.object({uri:e.string(),title:e.string().nullish()}).nullish(),image:e.object({sourceUri:e.string(),imageUri:e.string(),title:e.string().nullish(),domain:e.string().nullish()}).nullish(),retrievedContext:e.object({uri:e.string().nullish(),title:e.string().nullish(),text:e.string().nullish(),fileSearchStore:e.string().nullish()}).nullish(),maps:e.object({uri:e.string().nullish(),title:e.string().nullish(),text:e.string().nullish(),placeId:e.string().nullish()}).nullish()})).nullish(),groundingSupports:e.array(e.object({segment:e.object({startIndex:e.number().nullish(),endIndex:e.number().nullish(),text:e.string().nullish()}).nullish(),segment_text:e.string().nullish(),groundingChunkIndices:e.array(e.number()).nullish(),supportChunkIndices:e.array(e.number()).nullish(),confidenceScores:e.array(e.number()).nullish(),confidenceScore:e.array(e.number()).nullish()})).nullish(),retrievalMetadata:e.union([e.object({webDynamicRetrievalScore:e.number()}),e.object({})]).nullish()}),"getGroundingMetadataSchema"),cn=e.object({jsonPath:e.string(),stringValue:e.string().nullish(),numberValue:e.number().nullish(),boolValue:e.boolean().nullish(),nullValue:e.unknown().nullish(),willContinue:e.boolean().nullish()}),dt=b(()=>e.object({parts:e.array(e.union([e.object({functionCall:e.object({id:e.string().nullish(),name:e.string().nullish(),args:e.unknown().nullish(),partialArgs:e.array(cn).nullish(),willContinue:e.boolean().nullish()}),thoughtSignature:e.string().nullish()}),e.object({inlineData:e.object({mimeType:e.string(),data:e.string()}),thought:e.boolean().nullish(),thoughtSignature:e.string().nullish()}),e.object({toolCall:e.object({toolType:e.string(),args:e.unknown().nullish(),id:e.string()}),thoughtSignature:e.string().nullish()}),e.object({toolResponse:e.object({toolType:e.string(),response:e.unknown().nullish(),id:e.string()}),thoughtSignature:e.string().nullish()}),e.object({executableCode:e.object({language:e.string(),code:e.string()}).nullish(),codeExecutionResult:e.object({outcome:e.string(),output:e.string().nullish()}).nullish(),text:e.string().nullish(),thought:e.boolean().nullish(),thoughtSignature:e.string().nullish()})])).nullish()}),"getContentSchema"),Me=b(()=>e.object({category:e.string().nullish(),probability:e.string().nullish(),probabilityScore:e.number().nullish(),severity:e.string().nullish(),severityScore:e.number().nullish(),blocked:e.boolean().nullish()}),"getSafetyRatingSchema"),ot=e.array(e.object({modality:e.string(),tokenCount:e.number()})).nullish(),pt=e.object({cachedContentTokenCount:e.number().nullish(),thoughtsTokenCount:e.number().nullish(),promptTokenCount:e.number().nullish(),candidatesTokenCount:e.number().nullish(),totalTokenCount:e.number().nullish(),trafficType:e.string().nullish(),serviceTier:e.string().nullish(),promptTokensDetails:ot,candidatesTokensDetails:ot}),gt=b(()=>e.object({urlMetadata:e.array(e.object({retrievedUrl:e.string(),urlRetrievalStatus:e.string()})).nullish()}),"getUrlContextMetadataSchema"),dn=B(()=>K(e.object({responseId:e.string().nullish(),candidates:e.array(e.object({content:dt().nullish().or(e.object({}).strict()),finishReason:e.string().nullish(),finishMessage:e.string().nullish(),safetyRatings:e.array(Me()).nullish(),groundingMetadata:ct().nullish(),urlContextMetadata:gt().nullish()})),usageMetadata:pt.nullish(),promptFeedback:e.object({blockReason:e.string().nullish(),safetyRatings:e.array(Me()).nullish()}).nullish()}))),pn=B(()=>K(e.object({responseId:e.string().nullish(),candidates:e.array(e.object({content:dt().nullish(),finishReason:e.string().nullish(),finishMessage:e.string().nullish(),safetyRatings:e.array(Me()).nullish(),groundingMetadata:ct().nullish(),urlContextMetadata:gt().nullish()})).nullish(),usageMetadata:pt.nullish(),promptFeedback:e.object({blockReason:e.string().nullish(),safetyRatings:e.array(Me()).nullish()}).nullish()}))),gn=Je({id:"google.code_execution",inputSchema:e.object({language:e.string().describe("The programming language of the code."),code:e.string().describe("The code to be executed.")}),outputSchema:e.object({outcome:e.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),output:e.string().describe("The output from the code execution.")})}),hn=le({id:"google.enterprise_web_search",inputSchema:B(()=>K(e.object({})))}),mn=e.object({fileSearchStoreNames:e.array(e.string()).describe("The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"),topK:e.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),metadataFilter:e.string().describe("Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression.").optional()}).passthrough(),fn=B(()=>K(mn)),vn=le({id:"google.file_search",inputSchema:fn}),yn=le({id:"google.google_maps",inputSchema:B(()=>K(e.object({})))}),_n=e.object({searchTypes:e.object({webSearch:e.object({}).optional(),imageSearch:e.object({}).optional()}).optional(),timeRangeFilter:e.object({startTime:e.string(),endTime:e.string()}).optional()}).passthrough(),bn=B(()=>K(_n)),Tn=le({id:"google.google_search",inputSchema:bn}),Sn=le({id:"google.url_context",inputSchema:B(()=>K(e.object({})))}),Cn=le({id:"google.vertex_rag_store",inputSchema:e.object({ragCorpus:e.string(),topK:e.number().optional()})}),he={googleSearch:Tn,enterpriseWebSearch:hn,googleMaps:yn,urlContext:Sn,fileSearch:vn,codeExecution:gn,vertexRagStore:Cn};function He(t){var n,o,l,i,s,p,m,u;if(t==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let h=(n=t.total_input_tokens)!=null?n:0,v=(o=t.total_output_tokens)!=null?o:0,T=(l=t.total_thought_tokens)!=null?l:0,c=(i=t.total_cached_tokens)!=null?i:0;return{inputTokens:{total:(s=t.total_input_tokens)!=null?s:void 0,noCache:t.total_input_tokens==null?void 0:h-c,cacheRead:(p=t.total_cached_tokens)!=null?p:void 0,cacheWrite:void 0},outputTokens:{total:t.total_output_tokens==null&&t.total_thought_tokens==null?void 0:v+T,text:(m=t.total_output_tokens)!=null?m:void 0,reasoning:(u=t.total_thought_tokens)!=null?u:void 0},raw:t}}b(He,"convertGoogleInteractionsUsage");function ht(t){let n=t?.output_tokens_by_modality;if(n==null)return;let o={};for(let l of n)l?.modality!=null&&l.tokens!=null&&(o[l.modality]=l.tokens);return Object.keys(o).length>0?o:void 0}b(ht,"getGoogleInteractionsOutputTokensByModality");var In={pdf:"application/pdf",txt:"text/plain",md:"text/markdown",markdown:"text/markdown",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};function mt(t){let n=t.toLowerCase();for(let[o,l]of Object.entries(In))if(n.endsWith(`.${o}`))return l;return"application/octet-stream"}b(mt,"inferDocMediaType");function ft(t){let n=t.split("/"),o=n[n.length-1];return o&&o.length>0?o:void 0}b(ft,"basename");function xn({annotation:t,generateId:n}){var o,l,i,s,p;switch(t.type){case"url_citation":{let m=t;return m.url==null||m.url.length===0?void 0:{type:"source",sourceType:"url",id:n(),url:m.url,...m.title!=null?{title:m.title}:{}}}case"file_citation":{let m=t,u=(l=(o=m.url)!=null?o:m.document_uri)!=null?l:m.file_name;if(u==null||u.length===0)return;if(u.startsWith("http://")||u.startsWith("https://"))return{type:"source",sourceType:"url",id:n(),url:u,...m.file_name!=null?{title:m.file_name}:{}};let h=(i=m.file_name)!=null?i:ft(u),v=mt(u);return{type:"source",sourceType:"document",id:n(),mediaType:v,title:(p=(s=m.file_name)!=null?s:h)!=null?p:u,...h!=null?{filename:h}:{}}}case"place_citation":{let m=t;return m.url==null||m.url.length===0?void 0:{type:"source",sourceType:"url",id:n(),url:m.url,...m.name!=null?{title:m.name}:{}}}default:return}}b(xn,"annotationToSource");function vt({block:t,generateId:n}){var o,l,i,s,p,m,u,h,v,T,c;let g=[];switch(t.type){case"url_context_result":{let y=(o=t.result)!=null?o:[];for(let d of y)d?.url==null||d.url.length===0||d.status!=null&&d.status!=="success"||g.push({type:"source",sourceType:"url",id:n(),url:d.url});break}case"google_search_result":{let y=(l=t.result)!=null?l:[];for(let d of y){let f=d?.url;f==null||f.length===0||g.push({type:"source",sourceType:"url",id:n(),url:f,...d.title!=null?{title:d.title}:{}})}break}case"google_maps_result":{let y=(i=t.result)!=null?i:[];for(let d of y)for(let f of(s=d.places)!=null?s:[])f.url==null||f.url.length===0||g.push({type:"source",sourceType:"url",id:n(),url:f.url,...f.name!=null?{title:f.name}:{}});break}case"file_search_result":{let y=(p=t.result)!=null?p:[];for(let d of y){if(d==null||typeof d!="object")continue;let f=d,S=(u=(m=f.url)!=null?m:f.document_uri)!=null?u:f.file_name;if(S==null||S.length===0)continue;if(S.startsWith("http://")||S.startsWith("https://")){g.push({type:"source",sourceType:"url",id:n(),url:S,...f.title!=null?{title:f.title}:{}});continue}let O=(h=f.file_name)!=null?h:ft(S),a=mt(S);g.push({type:"source",sourceType:"document",id:n(),mediaType:a,title:(c=(T=(v=f.title)!=null?v:f.file_name)!=null?T:O)!=null?c:S,...O!=null?{filename:O}:{}})}break}default:break}return g}b(vt,"builtinToolResultToSources");function Ge({annotations:t,generateId:n}){var o;if(t==null)return[];let l=new Set,i=[];for(let s of t){let p=xn({annotation:s,generateId:n});if(p==null)continue;let m=p.sourceType==="url"?`url:${p.url}`:`doc:${(o=p.filename)!=null?o:p.title}`;l.has(m)||(l.add(m),i.push(p))}return i}b(Ge,"annotationsToSources");function Ve({status:t,hasFunctionCall:n}){switch(t){case"completed":return n?"tool-calls":"stop";case"requires_action":return"tool-calls";case"failed":return"error";case"incomplete":return"length";case"cancelled":return"other";default:return"other"}}b(Ve,"mapGoogleInteractionsFinishReason");var wn=new Set(["google_search_call","code_execution_call","url_context_call","file_search_call","google_maps_call","mcp_server_tool_call"]),kn=new Set(["google_search_result","code_execution_result","url_context_result","file_search_result","google_maps_result","mcp_server_tool_result"]);function En(t){return t.replace(/_call$/,"")}b(En,"builtinToolNameFromCallType");function Rn(t){return t.replace(/_result$/,"")}b(Rn,"builtinToolNameFromResultType");function it({warnings:t,generateId:n,includeRawChunks:o,serviceTier:l}){let i,s,p=l,m,u=!1,h=new Map,v=new Set;function T(c){var g;return c.sourceType==="url"?`url:${c.url}`:`doc:${(g=c.filename)!=null?g:c.title}`}return b(T,"sourceKey"),new TransformStream({start(c){c.enqueue({type:"stream-start",warnings:t})},transform(c,g){var y,d,f,S,O,a,I,w,N,_,A,k,D,U,M,C,H,$,J,Y;if(o&&g.enqueue({type:"raw",rawValue:c.rawValue}),!c.success){m="failed",g.enqueue({type:"error",error:c.error});return}let z=c.value,j=z.event_type;switch(j){case"interaction.created":{let r=z.interaction;i=r?.id!=null&&r.id.length>0?r.id:void 0;let G=r?.created,x;if(typeof G=="string"){let E=new Date(G);Number.isNaN(E.getTime())||(x=E)}g.enqueue({type:"response-metadata",...i!=null?{id:i}:{},modelId:r?.model,...x?{timestamp:x}:{}});break}case"step.start":{let L=z,r=L.step,G=L.index,x=`${i??"interaction"}:${G}`,E=r?.type;if(E==="model_output"){let q=(y=r?.content)==null?void 0:y[0];if(q?.type==="text"){h.set(G,{kind:"text",id:x,emittedSourceKeys:new Set}),g.enqueue({type:"text-start",id:x});let F=Ge({annotations:q.annotations,generateId:n});for(let X of F){let P=T(X);v.has(P)||(v.add(P),g.enqueue(X))}}else q?.type==="image"?h.set(G,{kind:"image",id:x,...q.data!=null?{data:q.data}:{},...q.mime_type!=null?{mimeType:q.mime_type}:{},...q.uri!=null?{uri:q.uri}:{}}):h.set(G,{kind:"pending_model_output",id:x})}else if(E==="thought"){let q=r?.signature;if(h.set(G,{kind:"reasoning",id:x,...q!=null?{signature:q}:{}}),g.enqueue({type:"reasoning-start",id:x}),Array.isArray(r?.summary))for(let F of r.summary)F?.type==="text"&&typeof F.text=="string"&&g.enqueue({type:"reasoning-delta",id:x,delta:F.text})}else if(E==="function_call"){let q=(d=r?.id)!=null?d:x,F=(f=r?.name)!=null?f:"unknown";u=!0;let X={kind:"function_call",id:x,toolCallId:q,toolName:F,argumentsAccum:"",...r?.signature!=null?{signature:r.signature}:{}};h.set(G,X),g.enqueue({type:"tool-input-start",id:q,toolName:F})}else if(E!=null&&wn.has(E)){let q=E==="mcp_server_tool_call"?(S=r?.name)!=null?S:"mcp_server_tool":En(E),F=(O=r?.id)!=null?O:x,X={kind:"builtin_tool_call",id:x,blockType:E,toolCallId:F,toolName:q,arguments:(a=r?.arguments)!=null?a:{},callEmitted:!1};h.set(G,X)}else if(E!=null&&kn.has(E)){let q=E==="mcp_server_tool_result"?(I=r?.name)!=null?I:"mcp_server_tool":Rn(E),F=(w=r?.call_id)!=null?w:x,X={kind:"builtin_tool_result",id:x,blockType:E,callId:F,toolName:q,result:(N=r?.result)!=null?N:null,...r?.is_error!=null?{isError:r.is_error}:{},resultEmitted:!1};h.set(G,X)}else h.set(G,{kind:"unknown",id:x});break}case"step.delta":{let L=z,r=h.get(L.index);if(r==null)break;let G=(_=L.delta)==null?void 0:_.type;if(r.kind==="pending_model_output"&&(G==="text"||G==="text_annotation"||G==="text_annotation_delta")){let E={kind:"text",id:r.id,emittedSourceKeys:new Set};h.set(L.index,E),r=E,g.enqueue({type:"text-start",id:E.id})}if(G==="image"&&(r.kind==="pending_model_output"||r.kind==="text"||r.kind==="image")){let E=L.delta,q={};i!=null&&(q.interactionId=i);let F=Object.keys(q).length>0?{google:q}:void 0;if(E?.data!=null&&E.data.length>0)g.enqueue({type:"file",mediaType:(A=E.mime_type)!=null?A:"image/png",data:E.data,...F?{providerMetadata:F}:{}});else if(E?.uri!=null&&E.uri.length>0){let X={google:{...i!=null?{interactionId:i}:{},imageUri:E.uri}};g.enqueue({type:"file",mediaType:(k=E.mime_type)!=null?k:"image/png",data:"",providerMetadata:X})}r.kind==="image"&&(r.data=void 0,r.uri=void 0);break}if(G==="video"&&(r.kind==="pending_model_output"||r.kind==="text")){let E=L.delta,q={};i!=null&&(q.interactionId=i);let F=Object.keys(q).length>0?{google:q}:void 0;if(E?.data!=null&&E.data.length>0)g.enqueue({type:"file",mediaType:(D=E.mime_type)!=null?D:"video/mp4",data:E.data,...F?{providerMetadata:F}:{}});else if(E?.uri!=null&&E.uri.length>0){let X={google:{...i!=null?{interactionId:i}:{},videoUri:E.uri}};g.enqueue({type:"file",mediaType:(U=E.mime_type)!=null?U:"video/mp4",data:"",providerMetadata:X})}break}let x=L.delta;if(r.kind==="text"&&x?.type==="text"){let E=(M=x.text)!=null?M:"";E.length>0&&g.enqueue({type:"text-delta",id:r.id,delta:E})}else if(r.kind==="text"&&(x?.type==="text_annotation"||x?.type==="text_annotation_delta")){let E=Ge({annotations:x.annotations,generateId:n});for(let q of E){let F=T(q);v.has(F)||(v.add(F),r.emittedSourceKeys.add(F),g.enqueue(q))}}else if(r.kind==="image"&&x?.type==="image")x.data!=null&&(r.data=x.data),x.mime_type!=null&&(r.mimeType=x.mime_type),x.uri!=null&&(r.uri=x.uri);else if(r.kind==="reasoning"){if(x?.type==="thought_summary"){let E=x.content;E?.type==="text"&&typeof E.text=="string"&&g.enqueue({type:"reasoning-delta",id:r.id,delta:E.text})}else if(x?.type==="thought_signature"){let E=x.signature;E!=null&&(r.signature=E)}}else if(r.kind==="function_call"&&x?.type==="arguments_delta"){let E=typeof x.arguments=="string"?x.arguments:"";E.length>0&&(r.argumentsAccum+=E,g.enqueue({type:"tool-input-delta",id:r.toolCallId,delta:E})),x.id!=null&&(r.toolCallId=x.id),x.signature!=null&&(r.signature=x.signature),u=!0}else r.kind==="builtin_tool_call"&&x?.type===r.blockType?(x.id!=null&&(r.toolCallId=x.id),x.arguments!=null&&typeof x.arguments=="object"&&(r.arguments=x.arguments),x.name!=null&&r.blockType==="mcp_server_tool_call"&&(r.toolName=x.name)):r.kind==="builtin_tool_result"&&x?.type===r.blockType&&(x.call_id!=null&&(r.callId=x.call_id),x.result!==void 0&&(r.result=x.result),x.is_error!=null&&(r.isError=x.is_error),x.name!=null&&r.blockType==="mcp_server_tool_result"&&(r.toolName=x.name));break}case"step.stop":{let L=z,r=h.get(L.index);if(r==null)break;if(r.kind==="text"){let G=i!=null?{google:{interactionId:i}}:void 0;g.enqueue({type:"text-end",id:r.id,...G?{providerMetadata:G}:{}})}else if(r.kind==="reasoning"){let G={};r.signature!=null&&(G.signature=r.signature),i!=null&&(G.interactionId=i);let x=Object.keys(G).length>0?{google:G}:void 0;g.enqueue({type:"reasoning-end",id:r.id,...x?{providerMetadata:x}:{}})}else if(r.kind==="image"){let G={};i!=null&&(G.interactionId=i);let x=Object.keys(G).length>0?{google:G}:void 0;if(r.data!=null&&r.data.length>0)g.enqueue({type:"file",mediaType:(C=r.mimeType)!=null?C:"image/png",data:r.data,...x?{providerMetadata:x}:{}});else if(r.uri!=null&&r.uri.length>0){let E={google:{...i!=null?{interactionId:i}:{},imageUri:r.uri}};g.enqueue({type:"file",mediaType:(H=r.mimeType)!=null?H:"image/png",data:"",providerMetadata:E})}}else if(r.kind==="function_call"){let G=r.argumentsAccum.length>0?r.argumentsAccum:"{}";g.enqueue({type:"tool-input-end",id:r.toolCallId});let x={};r.signature!=null&&(x.signature=r.signature),i!=null&&(x.interactionId=i);let E=Object.keys(x).length>0?{google:x}:void 0;g.enqueue({type:"tool-call",toolCallId:r.toolCallId,toolName:r.toolName,input:G,...E?{providerMetadata:E}:{}})}else if(r.kind==="builtin_tool_call"&&!r.callEmitted)g.enqueue({type:"tool-call",toolCallId:r.toolCallId,toolName:r.toolName,input:JSON.stringify(($=r.arguments)!=null?$:{}),providerExecuted:!0}),r.callEmitted=!0;else if(r.kind==="builtin_tool_result"&&!r.resultEmitted){g.enqueue({type:"tool-result",toolCallId:r.callId,toolName:r.toolName,result:(J=r.result)!=null?J:null}),r.resultEmitted=!0;let G=vt({block:{type:r.blockType,call_id:r.callId,result:r.result},generateId:n});for(let x of G){let E=T(x);v.has(E)||(v.add(E),g.enqueue(x))}}h.delete(L.index);break}case"interaction.status_update":case"interaction.in_progress":case"interaction.requires_action":{let L=z;L.status!=null?m=L.status:j==="interaction.requires_action"?m="requires_action":m="in_progress";break}case"interaction.completed":{let r=z.interaction;r?.id!=null&&r.id.length>0&&(i=r.id),r?.status!=null&&(m=r.status),r?.usage!=null&&(s=r.usage),r?.service_tier!=null&&(p=r.service_tier);break}case"error":{let L=z;m="failed";let r=(Y=L.error)!=null?Y:{message:"Unknown interaction error"};g.enqueue({type:"error",error:r});break}default:break}},flush(c){let g={unified:Ve({status:m,hasFunctionCall:u}),raw:m},y=ht(s),d={google:{...i!=null?{interactionId:i}:{},...p!=null?{serviceTier:p}:{},...y!=null?{outputTokensByModality:y}:{}}};c.enqueue({type:"finish",finishReason:g,usage:He(s),providerMetadata:d})}})}b(it,"buildGoogleInteractionsStreamTransform");function yt(t){let n=t.indexOf("/");return n===-1?t:t.substring(0,n)}b(yt,"getTopLevelMediaType");function Ae(t){let n=t.indexOf("/");if(n===-1)return!1;let o=t.substring(n+1);return o.length>0&&o!=="*"}b(Ae,"isFullMediaType");function On({prompt:t,previousInteractionId:n,store:o,mediaResolution:l}){var i,s,p,m,u,h,v;let T=[],c=n!=null&&o===!1,g=n!=null&&o!==!1;c&&T.push({type:"other",message:"google.interactions: providerOptions.google.previousInteractionId was set together with store: false. These are incoherent (the prior interaction cannot be referenced when nothing was stored on the server); the full history will be sent and previous_interaction_id will still be emitted."});let y=g?Mn({prompt:t,previousInteractionId:n}):t,d=[],f=[];for(let O of y)switch(O.role){case"system":{d.push(O.content);break}case"user":{let a=[];for(let w of O.content)if(w.type==="text")a.push({type:"text",text:w.text});else if(w.type==="file"){let N=lt({part:w,warnings:T,mediaResolution:l});N!=null&&a.push(N)}let I=jn(a);I.length>0&&f.push({type:"user_input",content:I});break}case"assistant":{let a=[],I=b(()=>{a.length>0&&(f.push({type:"model_output",content:a}),a=[])},"flushModelOutput");for(let w of O.content)if(w.type==="text")a.push({type:"text",text:w.text});else if(w.type==="reasoning"){I();let N=(s=(i=w.providerOptions)==null?void 0:i.google)==null?void 0:s.signature;f.push({type:"thought",...N!=null?{signature:N}:{},summary:w.text.length>0?[{type:"text",text:w.text}]:void 0})}else if(w.type==="file"){let N=lt({part:w,warnings:T,mediaResolution:l});N!=null&&a.push(N)}else if(w.type==="tool-call"){I();let N=(m=(p=w.providerOptions)==null?void 0:p.google)==null?void 0:m.signature,_=typeof w.input=="string"?An(w.input):(u=w.input)!=null?u:{};f.push({type:"function_call",id:w.toolCallId,name:w.toolName,arguments:_,...N!=null?{signature:N}:{}})}else T.push({type:"other",message:`google.interactions: unsupported assistant content part type "${w.type}"; part dropped.`});I();break}case"tool":{let a=[];for(let I of O.content){if(I.type!=="tool-result"){T.push({type:"other",message:`google.interactions: unsupported tool message part type "${I.type}"; part dropped.`});continue}let w=Nn({toolCallId:I.toolCallId,toolName:I.toolName,output:I.output,signature:(v=(h=I.providerOptions)==null?void 0:h.google)==null?void 0:v.signature,warnings:T});a.push(w)}a.length>0&&f.push({type:"user_input",content:a});break}}let S=d.length>0?d.join(`
|
|
24
|
+
|
|
25
|
+
`):void 0;return{input:f,systemInstruction:S,warnings:T}}b(On,"convertToGoogleInteractionsInput");function lt({part:t,warnings:n,mediaResolution:o}){let l=yt(t.mediaType),i;switch(l){case"image":i="image";break;case"audio":i="audio";break;case"video":i="video";break;case"application":i="document";break;default:i=void 0}if(i==null){n.push({type:"other",message:`google.interactions: unsupported file media type "${t.mediaType}"; part dropped.`});return}let s=o!=null&&(i==="image"||i==="video")?{resolution:o}:{};if(t.data instanceof URL)return{type:i,uri:t.data.toString(),...Ae(t.mediaType)?{mime_type:t.mediaType}:{},...s};if(!Ae(t.mediaType)){n.push({type:"other",message:`google.interactions: inline file data requires a full IANA media type (e.g. "image/png"), got "${t.mediaType}"; part dropped.`});return}return{type:i,data:ge(t.data),mime_type:t.mediaType,...s}}b(lt,"convertFilePartToContent");function Mn({prompt:t,previousInteractionId:n}){let o=[],l=new Set;for(let i of t){if(i.role==="assistant"){if(i.content.some(p=>{var m,u;return((u=(m=p.providerOptions)==null?void 0:m.google)==null?void 0:u.interactionId)===n})){for(let p of i.content)p.type==="tool-call"&&l.add(p.toolCallId);continue}o.push(i);continue}if(i.role==="tool"){let s=i.content.filter(p=>p.type!=="tool-result"?!0:!l.has(p.toolCallId));if(s.length===0)continue;o.push({...i,content:s});continue}o.push(i)}return o}b(Mn,"compactPromptForPreviousInteraction");function An(t){try{let n=Ee(t);return n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{value:n}}catch{return{value:t}}}b(An,"safeParseToolArgs");function Nn({toolCallId:t,toolName:n,output:o,signature:l,warnings:i}){var s;let p={type:"function_result",call_id:t,name:n,...l!=null?{signature:l}:{}};switch(o.type){case"text":return{...p,result:o.value};case"json":return{...p,result:JSON.stringify(o.value)};case"error-text":return{...p,is_error:!0,result:o.value};case"error-json":return{...p,is_error:!0,result:JSON.stringify(o.value)};case"execution-denied":return{...p,is_error:!0,result:(s=o.reason)!=null?s:"Tool execution denied by user."};case"content":{let m=[];for(let u of o.value)if(u.type==="text")m.push({type:"text",text:u.text});else if(u.type==="image-data"){let h=Le({part:{type:"file",mediaType:u.mediaType,data:u.data},warnings:i});h!=null&&m.push(h)}else if(u.type==="image-url"){let h=Le({part:{type:"file",mediaType:"image/*",data:new URL(u.url)},warnings:i});h!=null&&m.push(h)}else if(u.type==="file-data"||u.type==="file-url"){let h=u.type==="file-data"?u.mediaType:"application/*";if(yt(h)!=="image"){i.push({type:"other",message:`google.interactions: tool-result file with mediaType "${h}" is not supported (Interactions \`function_result.result\` accepts only text and image content); part dropped.`});continue}let T=Le({part:u.type==="file-data"?{type:"file",mediaType:u.mediaType,data:u.data}:{type:"file",mediaType:h,data:new URL(u.url)},warnings:i});T!=null&&m.push(T)}else i.push({type:"other",message:`google.interactions: tool-result content part type "${u.type}" is not supported; part dropped.`});return{...p,result:m}}}}b(Nn,"convertToolResultPart");function Le({part:t,warnings:n}){if(t.data instanceof URL)return{type:"image",uri:t.data.toString(),...Ae(t.mediaType)?{mime_type:t.mediaType}:{}};if(!Ae(t.mediaType)){n.push({type:"other",message:`google.interactions: tool-result image part requires a full IANA media type (e.g. "image/png"), got "${t.mediaType}"; part dropped.`});return}return{type:"image",data:ge(t.data),mime_type:t.mediaType}}b(Le,"filePartToImageBlock");function jn(t){if(t.length<2)return t;let n=[];for(let o of t){let l=n[n.length-1];if(o.type==="text"&&l!=null&&l.type==="text"&&l.annotations==null&&o.annotations==null){let i={type:"text",text:`${l.text}
|
|
26
|
+
|
|
27
|
+
${o.text}`};n[n.length-1]=i;continue}n.push(o)}return n}b(jn,"mergeAdjacentTextContent");var Oe=b(()=>e.object({modality:e.string().nullish(),tokens:e.number().nullish()}).loose(),"tokenByModalitySchema"),_t=b(()=>e.object({total_input_tokens:e.number().nullish(),total_output_tokens:e.number().nullish(),total_thought_tokens:e.number().nullish(),total_cached_tokens:e.number().nullish(),total_tool_use_tokens:e.number().nullish(),total_tokens:e.number().nullish(),input_tokens_by_modality:e.array(Oe()).nullish(),output_tokens_by_modality:e.array(Oe()).nullish(),cached_tokens_by_modality:e.array(Oe()).nullish(),tool_use_tokens_by_modality:e.array(Oe()).nullish(),grounding_tool_count:e.array(e.object({type:e.string().nullish(),count:e.number().nullish()}).loose()).nullish()}).loose(),"usageSchema2"),bt=b(()=>e.enum(["in_progress","requires_action","completed","failed","cancelled","incomplete"]),"interactionStatusSchema"),Tt=b(()=>{let t=e.object({type:e.literal("url_citation"),url:e.string().nullish(),title:e.string().nullish(),start_index:e.number().nullish(),end_index:e.number().nullish()}).loose(),n=e.object({type:e.literal("file_citation"),file_name:e.string().nullish(),document_uri:e.string().nullish(),url:e.string().nullish(),page_number:e.number().nullish(),media_id:e.string().nullish(),start_index:e.number().nullish(),end_index:e.number().nullish(),custom_metadata:e.record(e.string(),e.unknown()).nullish()}).loose(),o=e.object({type:e.literal("place_citation"),name:e.string().nullish(),url:e.string().nullish(),place_id:e.string().nullish(),start_index:e.number().nullish(),end_index:e.number().nullish()}).loose();return e.union([t,n,o,e.object({type:e.string()}).loose()])},"annotationSchema"),St=b(()=>e.object({type:e.string(),text:e.string().nullish(),data:e.string().nullish(),mime_type:e.string().nullish()}).loose(),"thoughtSummaryItemSchema"),st=b(()=>{let t=e.object({type:e.literal("text"),text:e.string(),annotations:e.array(Tt()).nullish()}).loose(),n=e.object({type:e.literal("image"),data:e.string().nullish(),mime_type:e.string().nullish(),resolution:e.enum(["low","medium","high","ultra_high"]).nullish(),uri:e.string().nullish()}).loose(),o=e.object({type:e.literal("video"),data:e.string().nullish(),mime_type:e.string().nullish(),uri:e.string().nullish()}).loose();return e.union([t,n,o,e.object({type:e.string()}).loose()])},"contentBlockSchema"),Ct=["google_search_call","code_execution_call","url_context_call","file_search_call","google_maps_call","mcp_server_tool_call"],It=["google_search_result","code_execution_result","url_context_result","file_search_result","google_maps_result","mcp_server_tool_result"],xt=b(()=>{let t=e.object({type:e.literal("user_input"),content:e.array(st()).nullish()}).loose(),n=e.object({type:e.literal("model_output"),content:e.array(st()).nullish()}).loose(),o=e.object({type:e.literal("function_call"),id:e.string(),name:e.string(),arguments:e.record(e.string(),e.unknown()).nullish(),signature:e.string().nullish()}).loose(),l=e.object({type:e.literal("thought"),signature:e.string().nullish(),summary:e.array(St()).nullish()}).loose(),i=e.object({type:e.enum(Ct),id:e.string(),arguments:e.record(e.string(),e.unknown()).nullish(),name:e.string().nullish(),server_name:e.string().nullish(),search_type:e.string().nullish(),signature:e.string().nullish()}).loose(),s=e.object({type:e.enum(It),call_id:e.string(),result:e.unknown().nullish(),is_error:e.boolean().nullish(),name:e.string().nullish(),server_name:e.string().nullish(),signature:e.string().nullish()}).loose();return e.union([t,n,o,l,i,s,e.object({type:e.string()}).loose()])},"stepSchema"),Ue=B(()=>K(e.object({id:e.string().nullish(),created:e.string().nullish(),updated:e.string().nullish(),status:bt(),model:e.string().nullish(),agent:e.string().nullish(),steps:e.array(xt()).nullish(),usage:_t().nullish(),service_tier:e.string().nullish(),previous_interaction_id:e.string().nullish(),response_modalities:e.array(e.string()).nullish()}).loose())),wt=B(()=>K((()=>{let t=bt(),n=Tt(),o=St(),l=e.object({event_type:e.literal("interaction.created"),event_id:e.string().nullish(),interaction:e.object({id:e.string().nullish(),created:e.string().nullish(),model:e.string().nullish(),agent:e.string().nullish(),status:t.nullish()}).loose()}).loose(),i=e.object({event_type:e.literal("step.start"),event_id:e.string().nullish(),index:e.number(),step:xt()}).loose(),s=e.object({type:e.literal("text"),text:e.string()}).loose(),p=e.object({type:e.literal("thought_summary"),content:o.nullish()}).loose(),m=e.object({type:e.literal("thought_signature"),signature:e.string().nullish()}).loose(),u=e.object({type:e.literal("arguments_delta"),arguments:e.string().nullish(),id:e.string().nullish(),signature:e.string().nullish()}).loose(),h=e.object({type:e.enum(["text_annotation_delta","text_annotation"]),annotations:e.array(n).nullish()}).loose(),v=e.object({type:e.literal("image"),data:e.string().nullish(),mime_type:e.string().nullish(),resolution:e.enum(["low","medium","high","ultra_high"]).nullish(),uri:e.string().nullish()}).loose(),T=e.object({type:e.literal("video"),data:e.string().nullish(),mime_type:e.string().nullish(),uri:e.string().nullish()}).loose(),c=e.object({type:e.enum(Ct),id:e.string().nullish(),arguments:e.record(e.string(),e.unknown()).nullish(),name:e.string().nullish(),server_name:e.string().nullish(),search_type:e.string().nullish(),signature:e.string().nullish()}).loose(),g=e.object({type:e.enum(It),call_id:e.string().nullish(),result:e.unknown().nullish(),is_error:e.boolean().nullish(),name:e.string().nullish(),server_name:e.string().nullish(),signature:e.string().nullish()}).loose(),y=e.object({type:e.string()}).loose(),d=e.union([s,v,T,p,m,u,h,c,g,y]),f=e.object({event_type:e.literal("step.delta"),event_id:e.string().nullish(),index:e.number(),delta:d}).loose(),S=e.object({event_type:e.literal("step.stop"),event_id:e.string().nullish(),index:e.number()}).loose(),O=e.object({event_type:e.literal("interaction.status_update"),event_id:e.string().nullish(),interaction_id:e.string().nullish(),status:t.nullish()}).loose(),a=e.object({event_type:e.literal("interaction.in_progress"),event_id:e.string().nullish(),interaction_id:e.string().nullish(),status:t.nullish()}).loose(),I=e.object({event_type:e.literal("interaction.requires_action"),event_id:e.string().nullish(),interaction_id:e.string().nullish(),status:t.nullish()}).loose(),w=e.object({event_type:e.literal("interaction.completed"),event_id:e.string().nullish(),interaction:e.object({id:e.string().nullish(),status:t.nullish(),usage:_t().nullish(),service_tier:e.string().nullish()}).loose()}).loose(),N=e.object({event_type:e.literal("error"),event_id:e.string().nullish(),error:e.object({code:e.string().nullish(),message:e.string().nullish()}).loose().nullish()}).loose(),_=e.object({event_type:e.string()}).loose();return e.union([l,i,f,S,O,a,I,w,N,_])})())),Pn=B(()=>K(e.object({previousInteractionId:e.string().nullish(),store:e.boolean().nullish(),agent:e.string().nullish(),agentConfig:e.union([e.object({type:e.literal("dynamic")}).loose(),e.object({type:e.literal("deep-research"),thinkingSummaries:e.enum(["auto","none"]).nullish(),visualization:e.enum(["off","auto"]).nullish(),collaborativePlanning:e.boolean().nullish()})]).nullish(),thinkingLevel:e.enum(["minimal","low","medium","high"]).nullish(),thinkingSummaries:e.enum(["auto","none"]).nullish(),responseFormat:e.array(e.union([e.object({type:e.literal("text"),mimeType:e.string().nullish(),schema:e.unknown().nullish()}).loose(),e.object({type:e.literal("image"),mimeType:e.string().nullish(),aspectRatio:e.enum(["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9","21:9","1:8","8:1","1:4","4:1"]).nullish(),imageSize:e.enum(["1K","2K","4K","512"]).nullish()}).loose(),e.object({type:e.literal("audio"),mimeType:e.string().nullish()}).loose()])).nullish(),imageConfig:e.object({aspectRatio:e.enum(["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9","21:9","1:8","8:1","1:4","4:1"]).nullish(),imageSize:e.enum(["1K","2K","4K","512"]).nullish()}).nullish(),mediaResolution:e.enum(["low","medium","high","ultra_high"]).nullish(),responseModalities:e.array(e.enum(["text","image","audio","video","document"])).nullish(),serviceTier:e.enum(["flex","standard","priority"]).nullish(),systemInstruction:e.string().nullish(),signature:e.string().nullish(),interactionId:e.string().nullish(),pollingTimeoutMs:e.number().int().positive().nullish(),background:e.boolean().nullish(),environment:e.union([e.string(),e.object({type:e.literal("remote"),sources:e.array(e.union([e.object({type:e.literal("gcs"),source:e.string(),target:e.string().nullish()}),e.object({type:e.literal("repository"),source:e.string(),target:e.string().nullish()}),e.object({type:e.literal("inline"),content:e.string(),target:e.string()})])).nullish(),network:e.union([e.literal("disabled"),e.object({allowlist:e.array(e.object({domain:e.string(),transform:e.array(e.record(e.string(),e.string())).nullish()}))})]).nullish()})]).nullish()})));function Ce({signature:t,interactionId:n}){let o={};return t!=null&&(o.signature=t),n!=null&&(o.interactionId=n),Object.keys(o).length>0?{providerMetadata:{google:o}}:{}}b(Ce,"googleProviderMetadata");var Dn=new Set(["google_search_call","code_execution_call","url_context_call","file_search_call","google_maps_call","mcp_server_tool_call"]),Ln=new Set(["google_search_result","code_execution_result","url_context_result","file_search_result","google_maps_result","mcp_server_tool_result"]);function Gn(t){return t.replace(/_call$/,"")}b(Gn,"builtinToolNameFromCallType2");function Un(t){return t.replace(/_result$/,"")}b(Un,"builtinToolNameFromResultType2");function kt({steps:t,generateId:n,interactionId:o}){var l,i,s,p,m,u,h,v,T,c,g,y,d;let f=[],S=!1;if(t==null)return{content:f,hasFunctionCall:S};for(let O of t){if(O==null||typeof O!="object")continue;let a=O.type;if(typeof a=="string")switch(a){case"user_input":break;case"model_output":{let I=(l=O.content)!=null?l:[];for(let w of I){if(w==null||typeof w!="object")continue;let N=w.type;if(N==="text"){let _=(i=w.text)!=null?i:"",A=w.annotations;f.push({type:"text",text:_,...Ce({interactionId:o})});let k=Ge({annotations:A,generateId:n});for(let D of k)f.push(D)}else if(N==="image"){let _=w;_.data!=null&&_.data.length>0?f.push({type:"file",mediaType:(s=_.mime_type)!=null?s:"image/png",data:_.data,...Ce({interactionId:o})}):_.uri!=null&&_.uri.length>0&&f.push({type:"file",mediaType:(p=_.mime_type)!=null?p:"image/png",data:"",providerMetadata:{google:{...o!=null?{interactionId:o}:{},imageUri:_.uri}}})}else if(N==="video"){let _=w;_.data!=null&&_.data.length>0?f.push({type:"file",mediaType:(m=_.mime_type)!=null?m:"video/mp4",data:_.data,...Ce({interactionId:o})}):_.uri!=null&&_.uri.length>0&&f.push({type:"file",mediaType:(u=_.mime_type)!=null?u:"video/mp4",data:"",providerMetadata:{google:{...o!=null?{interactionId:o}:{},videoUri:_.uri}}})}}break}case"thought":{let I=O,N=(Array.isArray(I.summary)?I.summary:[]).filter(_=>_?.type==="text"&&typeof _.text=="string").map(_=>_.text).join(`
|
|
28
|
+
`);f.push({type:"reasoning",text:N,...Ce({signature:I.signature,interactionId:o})});break}case"function_call":{S=!0;let I=O;f.push({type:"tool-call",toolCallId:I.id,toolName:I.name,input:JSON.stringify((h=I.arguments)!=null?h:{}),...Ce({signature:I.signature,interactionId:o})});break}default:{if(Dn.has(a)){let I=O,w=a==="mcp_server_tool_call"?(v=I.name)!=null?v:"mcp_server_tool":Gn(a),N=JSON.stringify((T=I.arguments)!=null?T:{});f.push({type:"tool-call",toolCallId:(c=I.id)!=null?c:n(),toolName:w,input:N,providerExecuted:!0})}else if(Ln.has(a)){let I=O,w=a==="mcp_server_tool_result"?(g=I.name)!=null?g:"mcp_server_tool":Un(a);f.push({type:"tool-result",toolCallId:(y=I.call_id)!=null?y:n(),toolName:w,result:(d=I.result)!=null?d:null});let N=vt({block:O,generateId:n});for(let _ of N)f.push(_)}break}}}return{content:f,hasFunctionCall:S}}b(kt,"parseGoogleInteractionsOutputs");var qn=b(()=>globalThis.fetch,"getOriginalFetch");async function Et({baseURL:t,interactionId:n,headers:o,fetch:l=qn()}){if(n==null||n.length===0)return;let i=`${t}/interactions/${encodeURIComponent(n)}/cancel`;try{let s=await l(i,{method:"POST",headers:xe(Z({"Content-Type":"application/json"},o),Be()),body:"{}"});try{await s.text()}catch{}}catch{}}b(Et,"cancelGoogleInteraction");var Hn=new Set(["completed","failed","cancelled","incomplete"]);function qe(t){return t!=null&&Hn.has(t)}b(qe,"isTerminalStatus");var Vn=1e3,Fn=1e4,$n=1800*1e3;async function zn({baseURL:t,interactionId:n,headers:o,fetch:l,abortSignal:i,initialDelayMs:s=Vn,maxDelayMs:p=Fn,timeoutMs:m=$n}){if(n==null||n.length===0)throw new Error("google.interactions: cannot poll a background interaction without an id. The POST response did not include an interaction id.");let u=Date.now(),h=s,v=`${t}/interactions/${encodeURIComponent(n)}`,T=b(()=>Et({baseURL:t,interactionId:n,headers:o,fetch:l}),"cancelOnServer");try{for(;;){if(i?.aborted)throw await T(),new DOMException("Polling was aborted","AbortError");if(Date.now()-u>m)throw new Error(`google.interactions: timed out polling interaction ${n} after ${m}ms.`);await pe(h,{abortSignal:i});let{value:c,rawValue:g,responseHeaders:y}=await we({url:v,headers:o,failedResponseHandler:fe,successfulResponseHandler:te(Ue),abortSignal:i,fetch:l});if(qe(c.status))return{response:c,rawResponse:g,responseHeaders:y};h=Math.min(h*2,p)}}catch(c){throw Se(c)&&await T(),c}}b(zn,"pollGoogleInteractionUntilTerminal");function Bn({tools:t,toolChoice:n}){var o,l,i,s;let p=[],m=t?.length?t:void 0;if(m==null)return{tools:void 0,toolChoice:void 0,toolWarnings:p};let u=[];for(let T of m){if(T.type==="function"){u.push({type:"function",name:T.name,description:(o=T.description)!=null?o:"",parameters:T.inputSchema});continue}if(T.type==="provider"){let c=(l=T.args)!=null?l:{};switch(T.id){case"google.google_search":{let g=c.searchTypes,y;if(g!=null&&typeof g=="object"){let d=[];g.webSearch!=null&&d.push("web_search"),g.imageSearch!=null&&d.push("image_search"),d.length>0&&(y=d)}u.push({type:"google_search",...y!=null?{search_types:y}:{}});break}case"google.code_execution":{u.push({type:"code_execution"});break}case"google.url_context":{u.push({type:"url_context"});break}case"google.file_search":{u.push({type:"file_search",...c.fileSearchStoreNames!=null?{file_search_store_names:c.fileSearchStoreNames}:{},...c.topK!=null?{top_k:c.topK}:{},...c.metadataFilter!=null?{metadata_filter:c.metadataFilter}:{}});break}case"google.google_maps":{u.push({type:"google_maps",...c.latitude!=null?{latitude:c.latitude}:{},...c.longitude!=null?{longitude:c.longitude}:{},...c.enableWidget!=null?{enable_widget:c.enableWidget}:{}});break}case"google.computer_use":{u.push({type:"computer_use",environment:(i=c.environment)!=null?i:"browser",...c.excludedPredefinedFunctions!=null?{excludedPredefinedFunctions:c.excludedPredefinedFunctions}:{}});break}case"google.mcp_server":{u.push({type:"mcp_server",...c.name!=null?{name:c.name}:{},...c.url!=null?{url:c.url}:{},...c.headers!=null?{headers:c.headers}:{},...c.allowedTools!=null?{allowed_tools:c.allowedTools}:{}});break}case"google.retrieval":{let g=(s=c.vertexAiSearchConfig)!=null?s:void 0;u.push({type:"retrieval",...c.retrievalTypes!=null?{retrieval_types:c.retrievalTypes}:{retrieval_types:["vertex_ai_search"]},...g!=null?{vertex_ai_search_config:g}:{}});break}default:{p.push({type:"unsupported",feature:`provider-defined tool ${T.id}`,details:`provider-defined tool ${T.id} is not supported by google.interactions; tool dropped.`});break}}continue}p.push({type:"unsupported",feature:`tool of type ${T.type}`,details:"Only function tools and google.* provider-defined tools are supported by google.interactions; tool dropped."})}let h=u.some(T=>T.type==="function"),v;if(n!=null&&h)switch(n.type){case"auto":v="auto";break;case"required":v="any";break;case"none":v="none";break;case"tool":v={allowed_tools:{mode:"validated",tools:[n.toolName]}};break}return{tools:u.length>0?u:void 0,toolChoice:v,toolWarnings:p}}b(Bn,"prepareGoogleInteractionsTools");var Kn=3,Jn=500;function Wn({baseURL:t,interactionId:n,headers:o,fetch:l,abortSignal:i,maxRetries:s=Kn,retryDelayMs:p=Jn}){if(n.length===0)throw new Error("google.interactions: cannot stream a background interaction without an id.");let m={...o,accept:"text/event-stream"},u,h=!1,v=0,T=!1,c,g=new AbortController,y=b(()=>g.abort(),"upstreamAbortHandler");i!=null&&(i.aborted?g.abort():i.addEventListener("abort",y,{once:!0}));let d=g.signal;function f(){let O=`${t}/interactions/${encodeURIComponent(n)}`,a=new URLSearchParams({stream:"true"});return u!=null&&a.set("last_event_id",u),`${O}?${a.toString()}`}b(f,"buildUrl");async function S(){let{value:O}=await we({url:f(),headers:m,failedResponseHandler:fe,successfulResponseHandler:_e(wt),abortSignal:d,fetch:l});return O.getReader()}return b(S,"openReader"),new ReadableStream({async start(O){try{for(;!h&&!d.aborted;){if(c==null)try{c=await S(),T=!1}catch(a){if(Se(a)||d.aborted){O.error(a);return}if(v++,v>=s){O.error(a);return}await pe(p*v,{abortSignal:d});continue}try{let{done:a,value:I}=await c.read();if(a){if(c=void 0,h)break;if(T)v=0;else{if(v++,v>=s){O.error(new Error("google.interactions: SSE stream closed without producing any events."));return}await pe(p*v,{abortSignal:d})}continue}if(T=!0,I.success){let w=I.value;typeof w.event_id=="string"&&w.event_id.length>0&&(u=w.event_id),(w.event_type==="interaction.completed"||w.event_type==="error")&&(h=!0)}O.enqueue(I)}catch(a){if(Se(a)||d.aborted){O.error(a);return}if(c=void 0,v++,v>=s){O.error(a);return}await pe(p*v,{abortSignal:d})}}O.close()}catch(a){O.error(a)}finally{i?.removeEventListener("abort",y),c?.cancel().catch(()=>{}),c=void 0,d.aborted&&!h&&await Et({baseURL:t,interactionId:n,headers:o,fetch:l})}},cancel(){g.abort(),c?.cancel().catch(()=>{}),c=void 0}})}b(Wn,"streamGoogleInteractionEvents");function Yn({response:t,warnings:n,generateId:o,includeRawChunks:l,headerServiceTier:i}){return new ReadableStream({start(s){var p,m,u;s.enqueue({type:"stream-start",warnings:n});let h=typeof t.id=="string"&&t.id.length>0?t.id:void 0,v,T=t.created;if(typeof T=="string"){let a=new Date(T);Number.isNaN(a.getTime())||(v=a)}s.enqueue({type:"response-metadata",...h!=null?{id:h}:{},modelId:(p=t.model)!=null?p:void 0,...v?{timestamp:v}:{}}),l&&s.enqueue({type:"raw",rawValue:t});let{content:c,hasFunctionCall:g}=kt({steps:(m=t.steps)!=null?m:null,generateId:o,interactionId:h}),y=0,d=b(()=>`${h??"agent"}:${y++}`,"nextBlockId");for(let a of c)switch(a.type){case"text":{let I=d(),w=a.providerMetadata;s.enqueue({type:"text-start",id:I}),a.text.length>0&&s.enqueue({type:"text-delta",id:I,delta:a.text}),s.enqueue({type:"text-end",id:I,...w?{providerMetadata:w}:{}});break}case"reasoning":{let I=d(),w=a.providerMetadata;s.enqueue({type:"reasoning-start",id:I}),a.text.length>0&&s.enqueue({type:"reasoning-delta",id:I,delta:a.text}),s.enqueue({type:"reasoning-end",id:I,...w?{providerMetadata:w}:{}});break}case"tool-call":{let I=a.providerMetadata;s.enqueue({type:"tool-input-start",id:a.toolCallId,toolName:a.toolName,...a.providerExecuted?{providerExecuted:a.providerExecuted}:{}}),s.enqueue({type:"tool-input-delta",id:a.toolCallId,delta:a.input}),s.enqueue({type:"tool-input-end",id:a.toolCallId}),s.enqueue({type:"tool-call",toolCallId:a.toolCallId,toolName:a.toolName,input:a.input,...a.providerExecuted?{providerExecuted:a.providerExecuted}:{},...I?{providerMetadata:I}:{}});break}case"tool-result":{s.enqueue({type:"tool-result",toolCallId:a.toolCallId,toolName:a.toolName,result:a.result});break}case"source":case"file":{s.enqueue(a);break}default:break}let f=(u=t.service_tier)!=null?u:i,S={unified:Ve({status:t.status,hasFunctionCall:g}),raw:t.status},O={google:{...h!=null?{interactionId:h}:{},...f!=null?{serviceTier:f}:{}}};s.enqueue({type:"finish",finishReason:S,usage:He(t.usage),providerMetadata:O}),s.close()}})}b(Yn,"synthesizeGoogleInteractionsAgentStream");var Rt=class{static{b(this,"GoogleInteractionsLanguageModel")}constructor(t,n){this.specificationVersion="v3",typeof t=="string"?(this.modelId=t,this.agent=void 0):"managedAgent"in t?(this.modelId=t.managedAgent,this.agent=t.managedAgent):(this.modelId=t.agent,this.agent=t.agent),this.config=n}get provider(){return this.config.provider}get supportedUrls(){return this.config.supportedUrls?this.config.supportedUrls():{"image/*":[/^https?:\/\/.+/],"application/pdf":[/^https?:\/\/.+/],"audio/*":[/^https?:\/\/.+/],"video/*":[/^https?:\/\/(www\.)?youtube\.com\/watch\?v=.+/,/^https?:\/\/youtu\.be\/.+/,/^gs:\/\/.+/]}}async getArgs(t){var n,o,l,i,s,p,m,u,h,v,T,c,g,y,d,f,S,O,a,I,w,N,_,A,k,D,U;let M=[],C=await ie({provider:"google",providerOptions:t.providerOptions,schema:Pn}),H=this.agent!=null;H||(t.frequencyPenalty!=null&&M.push({type:"unsupported",feature:"frequencyPenalty"}),t.presencePenalty!=null&&M.push({type:"unsupported",feature:"presencePenalty"}));let $=t.tools!=null&&t.tools.length>0,J,Y;if($){let P=Bn({tools:t.tools,toolChoice:t.toolChoice});J=P.tools,Y=P.toolChoice,M.push(...P.toolWarnings)}let z=[];if(((n=t.responseFormat)==null?void 0:n.type)==="json")if(H)M.push({type:"other",message:"google.interactions: structured output (responseFormat) is not supported when an agent is set; responseFormat will be ignored."});else{let P={type:"text",mime_type:"application/json",...t.responseFormat.schema!=null?{schema:t.responseFormat.schema}:{}};z.push(P)}if(C?.responseFormat!=null)for(let P of C.responseFormat)P.type==="text"?z.push(re({type:"text",mime_type:(o=P.mimeType)!=null?o:void 0,schema:(l=P.schema)!=null?l:void 0})):P.type==="image"?z.push(re({type:"image",mime_type:(i=P.mimeType)!=null?i:void 0,aspect_ratio:(s=P.aspectRatio)!=null?s:void 0,image_size:(p=P.imageSize)!=null?p:void 0})):P.type==="audio"&&z.push(re({type:"audio",mime_type:(m=P.mimeType)!=null?m:void 0}));let{input:j,systemInstruction:L,warnings:r}=On({prompt:t.prompt,previousInteractionId:(u=C?.previousInteractionId)!=null?u:void 0,store:(h=C?.store)!=null?h:void 0,mediaResolution:(v=C?.mediaResolution)!=null?v:void 0});M.push(...r);let G=L,x=(T=C?.systemInstruction)!=null?T:void 0;G!=null&&x!=null?M.push({type:"other",message:"google.interactions: both AI SDK system message and providerOptions.google.systemInstruction were set; using the AI SDK system message."}):G==null&&x!=null&&(G=x);let E;if(H){let P=[];t.temperature!=null&&P.push("temperature"),t.topP!=null&&P.push("topP"),t.topK!=null&&P.push("topK"),t.frequencyPenalty!=null&&P.push("frequencyPenalty"),t.presencePenalty!=null&&P.push("presencePenalty"),t.seed!=null&&P.push("seed"),t.stopSequences!=null&&t.stopSequences.length>0&&P.push("stopSequences"),t.maxOutputTokens!=null&&P.push("maxOutputTokens"),C?.thinkingLevel!=null&&P.push("thinkingLevel"),C?.thinkingSummaries!=null&&P.push("thinkingSummaries"),C?.imageConfig!=null&&P.push("imageConfig"),P.length>0&&M.push({type:"other",message:`google.interactions: ${P.join(", ")} ${P.length===1?"is":"are"} not supported when an agent is set; use providerOptions.google.agentConfig instead. Dropped from the request body.`}),E=void 0}else if(E=re({temperature:(c=t.temperature)!=null?c:void 0,top_p:(g=t.topP)!=null?g:void 0,top_k:(y=t.topK)!=null?y:void 0,seed:(d=t.seed)!=null?d:void 0,stop_sequences:t.stopSequences!=null&&t.stopSequences.length>0?t.stopSequences:void 0,max_output_tokens:(f=t.maxOutputTokens)!=null?f:void 0,thinking_level:(S=C?.thinkingLevel)!=null?S:void 0,thinking_summaries:(O=C?.thinkingSummaries)!=null?O:void 0,tool_choice:Y}),C?.imageConfig!=null){let P=z.some(ue=>ue.type==="image");M.push({type:"other",message:P?"google.interactions: providerOptions.google.imageConfig is deprecated and was ignored because providerOptions.google.responseFormat already supplies an image entry. Use responseFormat exclusively.":'google.interactions: providerOptions.google.imageConfig is deprecated. Use providerOptions.google.responseFormat with a { type: "image", ... } entry instead.'}),P||z.push({type:"image",mime_type:"image/png",...C.imageConfig.aspectRatio!=null?{aspect_ratio:C.imageConfig.aspectRatio}:{},...C.imageConfig.imageSize!=null?{image_size:C.imageConfig.imageSize}:{}})}let q;if(H&&C?.agentConfig!=null){let P=C.agentConfig;P.type==="deep-research"?q=re({type:"deep-research",thinking_summaries:(a=P.thinkingSummaries)!=null?a:void 0,visualization:(I=P.visualization)!=null?I:void 0,collaborative_planning:(w=P.collaborativePlanning)!=null?w:void 0}):P.type==="dynamic"&&(q={type:"dynamic"})}let F;if(C?.environment!=null)if(!H)M.push({type:"other",message:"google.interactions: environment is only supported when an agent is set; environment will be omitted from the request body."});else if(typeof C.environment=="string")F=C.environment;else{let P=C.environment,ue=(N=P.sources)==null?void 0:N.map(Q=>{var R;return Q.type==="inline"?{type:"inline",content:Q.content,target:Q.target}:re({type:Q.type,source:Q.source,target:(R=Q.target)!=null?R:void 0})}),ve;P.network==="disabled"?ve="disabled":P.network!=null&&(ve={allowlist:P.network.allowlist.map(Q=>{var R;return re({domain:Q.domain,transform:(R=Q.transform)!=null?R:void 0})})}),F=re({type:"remote",sources:ue!=null&&ue.length>0?ue:void 0,network:ve})}return{args:re({...H?{agent:this.agent}:{model:this.modelId},input:j,system_instruction:G,tools:J,response_format:z.length>0?z:void 0,response_modalities:C?.responseModalities!=null?C.responseModalities:void 0,previous_interaction_id:(_=C?.previousInteractionId)!=null?_:void 0,service_tier:(A=C?.serviceTier)!=null?A:void 0,store:(k=C?.store)!=null?k:void 0,generation_config:E!=null&&Object.keys(E).length>0?E:void 0,agent_config:q,environment:F,background:(D=C?.background)!=null?D:void 0}),warnings:M,isAgent:H,isBackground:C?.background===!0,pollingTimeoutMs:(U=C?.pollingTimeoutMs)!=null?U:void 0}}async doGenerate(t){var n,o,l,i,s,p;let{args:m,warnings:u,isAgent:h,pollingTimeoutMs:v}=await this.getArgs(t),T=`${this.config.baseURL}/interactions`,c=Z(at,this.config.headers?await W(this.config.headers):void 0,t.headers),g=await ee({url:T,headers:c,body:m,failedResponseHandler:fe,successfulResponseHandler:te(Ue),abortSignal:t.abortSignal,fetch:this.config.fetch}),{responseHeaders:y,value:d,rawValue:f}=g;if(h&&!qe(d.status)){let k=await zn({baseURL:this.config.baseURL,interactionId:d.id,headers:c,fetch:this.config.fetch,abortSignal:t.abortSignal,timeoutMs:v});d=k.response,f=k.rawResponse,y=(n=k.responseHeaders)!=null?n:y}let S=typeof d.id=="string"&&d.id.length>0?d.id:void 0,{content:O,hasFunctionCall:a}=kt({steps:(o=d.steps)!=null?o:null,generateId:(l=this.config.generateId)!=null?l:oe,interactionId:S}),I={unified:Ve({status:d.status,hasFunctionCall:a}),raw:d.status},w=(s=(i=d.service_tier)!=null?i:y?.["x-gemini-service-tier"])!=null?s:void 0,N=ht(d.usage),_={google:{...S!=null?{interactionId:S}:{},...w!=null?{serviceTier:w}:{},...N!=null?{outputTokensByModality:N}:{}}},A;if(typeof d.created=="string"){let k=new Date(d.created);Number.isNaN(k.getTime())||(A=k)}return{content:O,finishReason:I,usage:He(d.usage),warnings:u,providerMetadata:_,request:{body:m},response:{headers:y,body:f,...S!=null?{id:S}:{},...A?{timestamp:A}:{},modelId:(p=d.model)!=null?p:void 0}}}async doStream(t){var n;let{args:o,warnings:l,isBackground:i,pollingTimeoutMs:s}=await this.getArgs(t),p=`${this.config.baseURL}/interactions`,m=Z(at,this.config.headers?await W(this.config.headers):void 0,t.headers);if(i)return this.doStreamBackground({args:o,warnings:l,url:p,mergedHeaders:m,options:t,pollingTimeoutMs:s});let u={...o,stream:!0},{responseHeaders:h,value:v}=await ee({url:p,headers:m,body:u,failedResponseHandler:fe,successfulResponseHandler:_e(wt),abortSignal:t.abortSignal,fetch:this.config.fetch}),T=h?.["x-gemini-service-tier"],c=it({warnings:l,generateId:(n=this.config.generateId)!=null?n:oe,includeRawChunks:t.includeRawChunks,serviceTier:T});return{stream:v.pipeThrough(c),request:{body:u},response:{headers:h}}}async doStreamBackground({args:t,warnings:n,url:o,mergedHeaders:l,options:i,pollingTimeoutMs:s}){var p,m;let u=await ee({url:o,headers:l,body:t,failedResponseHandler:fe,successfulResponseHandler:te(Ue),abortSignal:i.abortSignal,fetch:this.config.fetch}),{responseHeaders:h,value:v}=u,T=v.id;if(T==null||T.length===0)throw new Error("google.interactions: background POST response did not include an interaction id; cannot stream the result.");let c=h?.["x-gemini-service-tier"];if(qe(v.status))return{stream:Yn({response:v,warnings:n,generateId:(p=this.config.generateId)!=null?p:oe,includeRawChunks:i.includeRawChunks,headerServiceTier:c}),request:{body:t},response:{headers:h}};let g=Wn({baseURL:this.config.baseURL,interactionId:T,headers:l,fetch:this.config.fetch,abortSignal:i.abortSignal}),y=it({warnings:n,generateId:(m=this.config.generateId)!=null?m:oe,includeRawChunks:i.includeRawChunks,serviceTier:c});return{stream:g.pipeThrough(y),request:{body:t},response:{headers:h}}}},at={"Api-Revision":"2026-05-20"};function re(t){let n={};for(let[o,l]of Object.entries(t))l!==void 0&&(n[o]=l);return n}b(re,"pruneUndefined");function Xn(t){let n=new Dt.GoogleAuth({scopes:["https://www.googleapis.com/auth/cloud-platform"],...t});return b(async function(){var l;let s=await(await n.getClient()).getAccessToken();return(l=s?.token)!=null?l:null},"generateAuthToken")}b(Xn,"createAuthTokenGenerator");var Qn="4.0.181",Zn=e.object({error:e.object({code:e.number().nullable(),message:e.string(),status:e.string()})}),be=Re({errorSchema:Zn,errorToMessage:b(t=>t.error.message,"errorToMessage")}),Ot=e.object({outputDimensionality:e.number().optional(),taskType:e.enum(["SEMANTIC_SIMILARITY","CLASSIFICATION","CLUSTERING","RETRIEVAL_DOCUMENT","RETRIEVAL_QUERY","QUESTION_ANSWERING","FACT_VERIFICATION","CODE_RETRIEVAL_QUERY"]).optional(),title:e.string().optional(),autoTruncate:e.boolean().optional()}),eo=class{static{b(this,"GoogleVertexEmbeddingModel")}constructor(t,n){this.specificationVersion="v3",this.supportsParallelCalls=!0,this.modelId=t,this.config=n}get provider(){return this.config.provider}get maxEmbeddingsPerCall(){return Mt(this.modelId)?1:2048}async doEmbed({values:t,headers:n,abortSignal:o,providerOptions:l}){var i;let s=await ie({provider:"vertex",providerOptions:l,schema:Ot});if(s==null&&(s=await ie({provider:"google",providerOptions:l,schema:Ot})),s=s??{},t.length>this.maxEmbeddingsPerCall)throw new ze({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:t});let p=Z(await W(this.config.headers),n);if(Mt(this.modelId)){let{responseHeaders:T,value:c,rawValue:g}=await ee({url:`${this.config.baseURL}/models/${this.modelId}:embedContent`,headers:p,body:{content:{parts:[{text:t[0]}]},embedContentConfig:{outputDimensionality:s.outputDimensionality,taskType:s.taskType,title:s.title,autoTruncate:s.autoTruncate}},failedResponseHandler:be,successfulResponseHandler:te(no),abortSignal:o,fetch:this.config.fetch});return{warnings:[],embeddings:[c.embedding.values],usage:((i=c.usageMetadata)==null?void 0:i.promptTokenCount)==null?void 0:{tokens:c.usageMetadata.promptTokenCount},response:{headers:T,body:g}}}let m=`${this.config.baseURL}/models/${this.modelId}:predict`,{responseHeaders:u,value:h,rawValue:v}=await ee({url:m,headers:p,body:{instances:t.map(T=>({content:T,task_type:s.taskType,title:s.title})),parameters:{outputDimensionality:s.outputDimensionality,autoTruncate:s.autoTruncate}},failedResponseHandler:be,successfulResponseHandler:te(to),abortSignal:o,fetch:this.config.fetch});return{warnings:[],embeddings:h.predictions.map(T=>T.embeddings.values),usage:{tokens:h.predictions.reduce((T,c)=>T+c.embeddings.statistics.token_count,0)},response:{headers:u,body:v}}}},to=e.object({predictions:e.array(e.object({embeddings:e.object({values:e.array(e.number()),statistics:e.object({token_count:e.number()})})}))}),no=e.object({embedding:e.object({values:e.array(e.number())}),usageMetadata:e.object({promptTokenCount:e.number().nullish()}).nullish()});function Mt(t){return t==="gemini-embedding-2"||t==="gemini-embedding-2-preview"}b(Mt,"usesEmbedContentEndpoint");var oo=class{static{b(this,"GoogleVertexImageModel")}constructor(t,n){this.modelId=t,this.config=n,this.specificationVersion="v3"}get maxImagesPerCall(){return At(this.modelId)?10:4}get provider(){return this.config.provider}async doGenerate(t){return At(this.modelId)?this.doGenerateGemini(t):this.doGenerateImagen(t)}async doGenerateImagen({prompt:t,n,size:o,aspectRatio:l,seed:i,providerOptions:s,headers:p,abortSignal:m,files:u,mask:h}){var v,T,c,g,y,d,f;let S=[];o!=null&&S.push({type:"unsupported",feature:"size",details:"This model does not support the `size` option. Use `aspectRatio` instead."});let O=await ie({provider:"vertex",providerOptions:s,schema:lo}),{edit:a,...I}=O??{},{mode:w,baseSteps:N,maskMode:_,maskDilation:A}=a??{},k=u!=null&&u.length>0,D;if(k){let H=[];for(let $=0;$<u.length;$++){let J=u[$];H.push({referenceType:"REFERENCE_TYPE_RAW",referenceId:$+1,referenceImage:{bytesBase64Encoded:Nt(J)}})}h!=null&&H.push({referenceType:"REFERENCE_TYPE_MASK",referenceId:u.length+1,referenceImage:{bytesBase64Encoded:Nt(h)},maskImageConfig:{maskMode:_??"MASK_MODE_USER_PROVIDED",...A!=null?{dilation:A}:{}}}),D={instances:[{prompt:t,referenceImages:H}],parameters:{sampleCount:n,...l!=null?{aspectRatio:l}:{},...i!=null?{seed:i}:{},editMode:w??"EDIT_MODE_INPAINT_INSERTION",...N!=null?{editConfig:{baseSteps:N}}:{},...I}}}else D={instances:[{prompt:t}],parameters:{sampleCount:n,...l!=null?{aspectRatio:l}:{},...i!=null?{seed:i}:{},...I}};let U=(c=(T=(v=this.config._internal)==null?void 0:v.currentDate)==null?void 0:T.call(v))!=null?c:new Date,{value:M,responseHeaders:C}=await ee({url:`${this.config.baseURL}/models/${this.modelId}:predict`,headers:Z(await W(this.config.headers),p),body:D,failedResponseHandler:be,successfulResponseHandler:te(io),abortSignal:m,fetch:this.config.fetch});return{images:(y=(g=M.predictions)==null?void 0:g.map(({bytesBase64Encoded:H})=>H))!=null?y:[],warnings:S,response:{timestamp:U,modelId:this.modelId,headers:C},providerMetadata:{vertex:{images:(f=(d=M.predictions)==null?void 0:d.map(H=>{let{prompt:$}=H;return{...$!=null&&{revisedPrompt:$}}}))!=null?f:[]}}}}async doGenerateGemini({prompt:t,n,size:o,aspectRatio:l,seed:i,providerOptions:s,headers:p,abortSignal:m,files:u,mask:h}){var v,T,c,g,y,d,f,S,O;let a=[];if(h!=null)throw new Error("Gemini image models do not support mask-based image editing.");if(n!=null&&n>1)throw new Error("Gemini image models do not support generating a set number of images per call. Use n=1 or omit the n parameter.");o!=null&&a.push({type:"unsupported",feature:"size",details:"This model does not support the `size` option. Use `aspectRatio` instead."});let I=[];if(t!=null&&I.push({type:"text",text:t}),u!=null&&u.length>0)for(let D of u)D.type==="url"?I.push({type:"file",data:new URL(D.url),mediaType:"image/*"}):I.push({type:"file",data:typeof D.data=="string"?D.data:new Uint8Array(D.data),mediaType:D.mediaType});let w=[{role:"user",content:I}],_=await new Ne(this.modelId,{provider:this.config.provider,baseURL:this.config.baseURL,headers:(v=this.config.headers)!=null?v:{},fetch:this.config.fetch,generateId:(T=this.config.generateId)!=null?T:oe,supportedUrls:b(()=>({"*":[/^https?:\/\/.*$/,/^gs:\/\/.*$/]}),"supportedUrls")}).doGenerate({prompt:w,seed:i,providerOptions:{vertex:{responseModalities:["IMAGE"],imageConfig:l?{aspectRatio:l}:void 0,...(c=s?.vertex)!=null?c:{}}},headers:p,abortSignal:m}),A=(d=(y=(g=this.config._internal)==null?void 0:g.currentDate)==null?void 0:y.call(g))!=null?d:new Date,k=[];for(let D of _.content)D.type==="file"&&D.mediaType.startsWith("image/")&&k.push(ge(D.data));return{images:k,warnings:a,providerMetadata:{vertex:{images:k.map(()=>({}))}},response:{timestamp:A,modelId:this.modelId,headers:(f=_.response)==null?void 0:f.headers},usage:_.usage?{inputTokens:_.usage.inputTokens.total,outputTokens:_.usage.outputTokens.total,totalTokens:((S=_.usage.inputTokens.total)!=null?S:0)+((O=_.usage.outputTokens.total)!=null?O:0)}:void 0}}};function At(t){return t.startsWith("gemini-")}b(At,"isGeminiModel");var io=e.object({predictions:e.array(e.object({bytesBase64Encoded:e.string(),mimeType:e.string(),prompt:e.string().nullish()})).nullish()}),lo=e.object({negativePrompt:e.string().nullish(),personGeneration:e.enum(["dont_allow","allow_adult","allow_all"]).nullish(),safetySetting:e.enum(["block_low_and_above","block_medium_and_above","block_only_high","block_none"]).nullish(),addWatermark:e.boolean().nullish(),storageUri:e.string().nullish(),sampleImageSize:e.enum(["1K","2K"]).nullish(),edit:e.object({baseSteps:e.number().nullish(),mode:e.enum(["EDIT_MODE_INPAINT_INSERTION","EDIT_MODE_INPAINT_REMOVAL","EDIT_MODE_OUTPAINT","EDIT_MODE_CONTROLLED_EDITING","EDIT_MODE_PRODUCT_IMAGE","EDIT_MODE_BGSWAP"]).nullish(),maskMode:e.enum(["MASK_MODE_DEFAULT","MASK_MODE_USER_PROVIDED","MASK_MODE_DETECTION_BOX","MASK_MODE_CLOTHING_AREA","MASK_MODE_PARSED_PERSON"]).nullish(),maskDilation:e.number().nullish()}).nullish()});function Nt(t){if(t.type==="url")throw new Error("URL-based images are not supported for Google Vertex image editing. Please provide the image data directly.");return typeof t.data=="string"?t.data:ye(t.data)}b(Nt,"getBase64Data");var so={googleSearch:he.googleSearch,enterpriseWebSearch:he.enterpriseWebSearch,googleMaps:he.googleMaps,urlContext:he.urlContext,fileSearch:he.fileSearch,codeExecution:he.codeExecution,vertexRagStore:he.vertexRagStore},ao=e.object({languageCodes:e.array(e.string()).optional(),enableAutomaticPunctuation:e.boolean().optional(),enableWordTimeOffsets:e.boolean().optional(),region:e.string().optional()});function Fe(t){if(t==null)return;let n=Number.parseFloat(t);return Number.isFinite(n)?n:void 0}b(Fe,"parseDurationSeconds");function ro(t){if(t!=null)try{let n=new Intl.Locale(t).language;return n.length===2?n:void 0}catch{return}}b(ro,"convertBcp47ToIso6391");var uo=class{static{b(this,"GoogleVertexTranscriptionModel")}constructor(t,n){this.modelId=t,this.config=n,this.specificationVersion="v3"}get provider(){return this.config.provider}async doGenerate(t){var n,o,l,i,s,p,m,u,h,v;let T=(l=(o=(n=this.config._internal)==null?void 0:n.currentDate)==null?void 0:o.call(n))!=null?l:new Date,c=[],g;for(let U of["googleVertex","vertex","google"])if(g=await ie({provider:U,providerOptions:t.providerOptions,schema:ao}),g!=null)break;let y=(i=g?.region)!=null?i:this.config.location,d=(s=g?.languageCodes)!=null?s:["auto"],f=typeof t.audio=="string"?t.audio:ye(t.audio),S={config:{model:this.modelId,languageCodes:d,autoDecodingConfig:{},features:{enableWordTimeOffsets:(p=g?.enableWordTimeOffsets)!=null?p:!0,enableAutomaticPunctuation:(m=g?.enableAutomaticPunctuation)!=null?m:!0}},content:f},a=`https://${y==="global"?"speech.googleapis.com":`${y}-speech.googleapis.com`}/v2/projects/${this.config.project}/locations/${y}/recognizers/_:recognize`,{value:I,responseHeaders:w,rawValue:N}=await ee({url:a,headers:Z(this.config.headers?await W(this.config.headers):void 0,t.headers),body:S,failedResponseHandler:be,successfulResponseHandler:te(co),abortSignal:t.abortSignal,fetch:this.config.fetch}),_=(u=I.results)!=null?u:[],A=_.map(U=>{var M,C,H;return(H=(C=(M=U.alternatives)==null?void 0:M[0])==null?void 0:C.transcript)!=null?H:""}).join(" ").trim(),k=_.flatMap(U=>{var M,C,H,$;return($=(H=(C=(M=U.alternatives)==null?void 0:M[0])==null?void 0:C.words)==null?void 0:H.flatMap(J=>{let Y=Fe(J.startOffset),z=Fe(J.endOffset);return J.word==null||Y==null||z==null?[]:[{text:J.word,startSecond:Y,endSecond:z}]}))!=null?$:[]}),D=ro((h=_[0])==null?void 0:h.languageCode);return{text:A,segments:k,language:D,durationInSeconds:Fe((v=I.metadata)==null?void 0:v.totalBilledDuration),warnings:c,response:{timestamp:T,modelId:this.modelId,headers:w,body:N}}}},co=e.object({results:e.array(e.object({alternatives:e.array(e.object({transcript:e.string().nullish(),words:e.array(e.object({word:e.string().nullish(),startOffset:e.string().nullish(),endOffset:e.string().nullish()})).nullish()})).nullish(),languageCode:e.string().nullish()})).nullish(),metadata:e.object({totalBilledDuration:e.string().nullish()}).nullish()});function po(t){var n,o;return(o=(n=t.frameImages)==null?void 0:n.find(l=>l.frameType==="first_frame"))==null?void 0:o.image}b(po,"getFirstFrameImage");function go(t){var n;return(n=po(t))!=null?n:t.image}b(go,"resolveStartImage");function ho(t){var n,o;return(o=(n=t.frameImages)==null?void 0:n.find(l=>l.frameType==="last_frame"))==null?void 0:o.image}b(ho,"getLastFrameImage");function mo(t){if(!(t.frameImages!=null&&t.frameImages.length>0))return t.inputReferences!=null&&t.inputReferences.length>0?t.inputReferences:void 0}b(mo,"getInputReferences");function $e(t,n){if(t.type==="url"){if(t.url.startsWith("gs://"))return{gcsUri:t.url,mimeType:"image/png"};n.push({type:"unsupported",feature:"URL-based image input",details:"Vertex AI video models require base64-encoded images or GCS URIs. URL will be ignored."});return}return{bytesBase64Encoded:typeof t.data=="string"?t.data:ye(t.data),mimeType:t.mediaType||"image/png"}}b($e,"convertFileToVertexImage");function fo(t,n){let o=$e(t,n);return o!=null?{image:o}:void 0}b(fo,"convertInputReferenceImage");var vo=class{static{b(this,"GoogleVertexVideoModel")}constructor(t,n){this.modelId=t,this.config=n,this.specificationVersion="v3"}get provider(){return this.config.provider}get maxVideosPerCall(){return 4}async doGenerate(t){var n,o,l,i,s,p,m;let u=(l=(o=(n=this.config._internal)==null?void 0:n.currentDate)==null?void 0:o.call(n))!=null?l:new Date,h=[],v=await ie({provider:"vertex",providerOptions:t.providerOptions,schema:yo}),T=[{}],c=T[0];t.prompt!=null&&(c.prompt=t.prompt);let g=go(t);if(g!=null){let M=$e(g,h);M!=null&&(c.image=M)}let y=ho(t);if(y!=null){let M=$e(y,h);M!=null&&(c.lastFrame=M)}let d=mo(t);d!=null?c.referenceImages=d.flatMap(M=>{let C=fo(M,h);return C!=null?[C]:[]}):v?.referenceImages!=null&&(c.referenceImages=v.referenceImages);let f={sampleCount:t.n};if(t.aspectRatio&&(f.aspectRatio=t.aspectRatio),t.resolution){let M={"1280x720":"720p","1920x1080":"1080p","3840x2160":"4k"};f.resolution=M[t.resolution]||t.resolution}t.duration&&(f.durationSeconds=t.duration),t.seed&&(f.seed=t.seed);let S=(i=t.generateAudio)!=null?i:v?.generateAudio;if(S!=null&&(f.generateAudio=S),v!=null){let M=v;M.personGeneration!==void 0&&M.personGeneration!==null&&(f.personGeneration=M.personGeneration),M.negativePrompt!==void 0&&M.negativePrompt!==null&&(f.negativePrompt=M.negativePrompt),M.gcsOutputDirectory!==void 0&&M.gcsOutputDirectory!==null&&(f.gcsOutputDirectory=M.gcsOutputDirectory);for(let[C,H]of Object.entries(M))["pollIntervalMs","pollTimeoutMs","personGeneration","negativePrompt","generateAudio","gcsOutputDirectory","referenceImages"].includes(C)||(f[C]=H)}let{value:O}=await ee({url:`${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,headers:Z(await W(this.config.headers),t.headers),body:{instances:T,parameters:f},successfulResponseHandler:te(jt),failedResponseHandler:be,abortSignal:t.abortSignal,fetch:this.config.fetch}),a=O.name;if(!a)throw new me({name:"VERTEX_VIDEO_GENERATION_ERROR",message:"No operation name returned from API"});let I=(s=v?.pollIntervalMs)!=null?s:1e4,w=(p=v?.pollTimeoutMs)!=null?p:6e5,N=Date.now(),_=O,A;for(;!_.done;){if(Date.now()-N>w)throw new me({name:"VERTEX_VIDEO_GENERATION_TIMEOUT",message:`Video generation timed out after ${w}ms`});if(await pe(I),(m=t.abortSignal)!=null&&m.aborted)throw new me({name:"VERTEX_VIDEO_GENERATION_ABORTED",message:"Video generation request was aborted"});let{value:M,responseHeaders:C}=await ee({url:`${this.config.baseURL}/models/${this.modelId}:fetchPredictOperation`,headers:Z(await W(this.config.headers),t.headers),body:{operationName:a},successfulResponseHandler:te(jt),failedResponseHandler:be,abortSignal:t.abortSignal,fetch:this.config.fetch});_=M,A=C}if(_.error)throw new me({name:"VERTEX_VIDEO_GENERATION_FAILED",message:`Video generation failed: ${_.error.message}`});let k=_.response;if(!k?.videos||k.videos.length===0)throw new me({name:"VERTEX_VIDEO_GENERATION_ERROR",message:`No videos in response. Response: ${JSON.stringify(_)}`});let D=[],U=[];for(let M of k.videos)M.bytesBase64Encoded?(D.push({type:"base64",data:M.bytesBase64Encoded,mediaType:M.mimeType||"video/mp4"}),U.push({mimeType:M.mimeType})):M.gcsUri&&(D.push({type:"url",url:M.gcsUri,mediaType:M.mimeType||"video/mp4"}),U.push({gcsUri:M.gcsUri,mimeType:M.mimeType}));if(D.length===0)throw new me({name:"VERTEX_VIDEO_GENERATION_ERROR",message:"No valid videos in response"});return{videos:D,warnings:h,response:{timestamp:u,modelId:this.modelId,headers:A},providerMetadata:{"google-vertex":{videos:U}}}}},jt=e.object({name:e.string().nullish(),done:e.boolean().nullish(),error:e.object({code:e.number().nullish(),message:e.string(),status:e.string().nullish()}).nullish(),response:e.object({videos:e.array(e.object({bytesBase64Encoded:e.string().nullish(),gcsUri:e.string().nullish(),mimeType:e.string().nullish()})).nullish(),raiMediaFilteredCount:e.number().nullish()}).nullish()}),yo=B(()=>K(e.object({pollIntervalMs:e.number().positive().nullish(),pollTimeoutMs:e.number().positive().nullish(),personGeneration:e.enum(["dont_allow","allow_adult","allow_all"]).nullish(),negativePrompt:e.string().nullish(),generateAudio:e.boolean().nullish(),gcsOutputDirectory:e.string().nullish(),referenceImages:e.array(e.object({bytesBase64Encoded:e.string().nullish(),gcsUri:e.string().nullish()})).nullish()}).passthrough())),_o="https://aiplatform.googleapis.com/v1/publishers/google";function bo(t,n){return async(o,l)=>{let i={...l,headers:{...l?.headers?Ke(l.headers):{},"x-goog-api-key":t}};return(n??fetch)(o.toString(),i)}}b(bo,"createExpressModeFetch");function Pt(t={}){let n=ke({settingValue:t.apiKey,environmentVariableName:"GOOGLE_VERTEX_API_KEY"}),o=b(()=>Pe({settingValue:t.project,settingName:"project",environmentVariableName:"GOOGLE_VERTEX_PROJECT",description:"Google Vertex project"}),"loadVertexProject"),l=b(()=>Pe({settingValue:t.location,settingName:"location",environmentVariableName:"GOOGLE_VERTEX_LOCATION",description:"Google Vertex location"}),"loadVertexLocation"),i=b(({endpoint:g=!1}={})=>{var y,d;if(n)return(y=De(t.baseURL))!=null?y:_o;let f=l(),S=o(),O=b(()=>f==="global"?"aiplatform.googleapis.com":f==="eu"||f==="us"?`aiplatform.${f}.rep.googleapis.com`:`${f}-aiplatform.googleapis.com`,"getHost");return(d=De(t.baseURL))!=null?d:`https://${O()}/v1beta1/projects/${S}/locations/${f}${g?"":"/publishers/google"}`},"loadBaseURL"),s=b((g,{endpoint:y=!1}={})=>{let d=b(async()=>{var f;let S=await W((f=t.headers)!=null?f:{});return xe(S,`ai-sdk/google-vertex/${Qn}`)},"getHeaders");return{provider:`google.vertex.${g}`,headers:d,fetch:n?bo(n,t.fetch):t.fetch,baseURL:i({endpoint:y})}},"createConfig"),p=b(g=>{var y;return new Ne(g,{...s("chat"),generateId:(y=t.generateId)!=null?y:oe,supportedUrls:b(()=>({"*":[/^https?:\/\/.*$/,/^gs:\/\/.*$/]}),"supportedUrls")})},"createChatModel"),m=b(g=>{var y;if(n)throw new Error("Google Vertex Interactions models do not support Express Mode API keys. Use standard Google Cloud credentials instead.");return new Rt(g,{...s("interactions",{endpoint:!0}),generateId:(y=t.generateId)!=null?y:oe})},"createInteractionsModel"),u=b(g=>new eo(g,s("embedding")),"createEmbeddingModel"),h=b(g=>{var y;return new oo(g,{...s("image"),generateId:(y=t.generateId)!=null?y:oe})},"createImageModel"),v=b(g=>{var y;return new vo(g,{...s("video"),generateId:(y=t.generateId)!=null?y:oe})},"createVideoModel"),T=b(g=>{if(n)throw new Error("Google Vertex transcription models do not support Express Mode API keys. Use standard Google Cloud credentials instead.");let y=s("transcription");return new uo(g,{provider:y.provider,headers:y.headers,fetch:y.fetch,project:o(),location:l()})},"createTranscriptionModel"),c=b(function(g){if(new.target)throw new Error("The Google Vertex AI model function cannot be called with the new keyword.");return p(g)},"provider");return c.specificationVersion="v3",c.languageModel=p,c.interactions=m,c.embeddingModel=u,c.textEmbeddingModel=u,c.image=h,c.imageModel=h,c.video=v,c.videoModel=v,c.transcription=T,c.transcriptionModel=T,c.tools=so,c}b(Pt,"createVertex");function To(t={}){if(ke({settingValue:t.apiKey,environmentVariableName:"GOOGLE_VERTEX_API_KEY"}))return Pt(t);let o=t.project==null?t.googleAuthOptions:{projectId:t.project,...t.googleAuthOptions},l=Xn(o);return Pt({...t,headers:b(async()=>({Authorization:`Bearer ${await l()}`,...await W(t.headers)}),"headers")})}b(To,"createVertex2");var Ii=To();export{Qn as VERSION,To as createVertex,Ii as vertex};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Built by esbuild from opencode-server source
|
|
2
|
+
if (typeof globalThis.Bun === 'undefined') {
|
|
3
|
+
globalThis.Bun = {
|
|
4
|
+
version: '0.0.0-node-compat',
|
|
5
|
+
stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
|
|
6
|
+
which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
|
|
10
|
+
if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
|
|
11
|
+
import { createRequire as __alchemyCreateRequire } from 'node:module';
|
|
12
|
+
const require = __alchemyCreateRequire(import.meta.url);
|
|
13
|
+
import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
|
|
14
|
+
import { dirname as __alchemyDirname } from 'node:path';
|
|
15
|
+
const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
|
|
16
|
+
const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
|
|
17
|
+
|
|
18
|
+
import{a,b,c,d,e,f,g}from"./chunk-RPAXSOGH.js";import"./chunk-OCWGUTZJ.js";import"./chunk-CYRZU5QM.js";import"./chunk-2MRHL4B2.js";export{f as ENV_ACCOUNT_ID,e as ENV_CREDENTIAL_SCOPE,d as ENV_EXPIRATION,a as ENV_KEY,b as ENV_SECRET,c as ENV_SESSION,g as fromEnv};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Built by esbuild from opencode-server source
|
|
2
|
+
if (typeof globalThis.Bun === 'undefined') {
|
|
3
|
+
globalThis.Bun = {
|
|
4
|
+
version: '0.0.0-node-compat',
|
|
5
|
+
stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
|
|
6
|
+
which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
|
|
10
|
+
if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
|
|
11
|
+
import { createRequire as __alchemyCreateRequire } from 'node:module';
|
|
12
|
+
const require = __alchemyCreateRequire(import.meta.url);
|
|
13
|
+
import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
|
|
14
|
+
import { dirname as __alchemyDirname } from 'node:path';
|
|
15
|
+
const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
|
|
16
|
+
const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
|
|
17
|
+
|
|
18
|
+
import{a}from"./chunk-UPEPL4I2.js";import"./chunk-OCWGUTZJ.js";import"./chunk-CYRZU5QM.js";import"./chunk-2MRHL4B2.js";export{a as fromLoginCredentials};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Built by esbuild from opencode-server source
|
|
2
|
+
if (typeof globalThis.Bun === 'undefined') {
|
|
3
|
+
globalThis.Bun = {
|
|
4
|
+
version: '0.0.0-node-compat',
|
|
5
|
+
stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
|
|
6
|
+
which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
|
|
10
|
+
if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
|
|
11
|
+
import { createRequire as __alchemyCreateRequire } from 'node:module';
|
|
12
|
+
const require = __alchemyCreateRequire(import.meta.url);
|
|
13
|
+
import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
|
|
14
|
+
import { dirname as __alchemyDirname } from 'node:path';
|
|
15
|
+
const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
|
|
16
|
+
const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
|
|
17
|
+
|
|
18
|
+
import{c as H}from"./chunk-OT2YNR56.js";import{a as V,b as U}from"./chunk-2JE3QYG6.js";import{a as z}from"./chunk-NGT6LCW6.js";import{a as K,b as W,g as E}from"./chunk-RPAXSOGH.js";import{a as ae}from"./chunk-YJPP6IQ3.js";import{a as j}from"./chunk-UPEPL4I2.js";import{a as q}from"./chunk-OGDRUXMJ.js";import"./chunk-EK6FQQHY.js";import{b as ie,c as se}from"./chunk-OCWGUTZJ.js";import{h as M,k as F}from"./chunk-BQ4IEPN3.js";import{f as y}from"./chunk-CYRZU5QM.js";import{a as o,g}from"./chunk-2MRHL4B2.js";var B=g(y());var we=o((...e)=>{let r=-1,t=Object.assign(o(async i=>{let s=await de(...e)(i);return!s.expiration&&r!==-1&&(s.expiration=new Date(Date.now()+r)),s},"baseFunction"),{expireAfter(i){if(i<5*6e4)throw new Error("@aws-sdk/credential-providers - createCredentialChain(...).expireAfter(ms) may not be called with a duration lower than five minutes.");return r=i,t}});return t},"createCredentialChain"),de=o((...e)=>async r=>{if(e.length===0)throw new B.ProviderError("No providers in chain",{tryNextLink:!1});let n;for(let t of e)try{return await t(r)}catch(i){if(n=i,i?.tryNextLink)continue;throw i}throw n},"propertyProviderChain");var P=g(y());function A(e){return Promise.all(Object.keys(e).reduce((r,n)=>{let t=e[n];return typeof t=="string"?r.push([n,t]):r.push(t().then(i=>[n,i])),r},[])).then(r=>r.reduce((n,[t,i])=>(n[t]=i,n),{}))}o(A,"resolveLogins");function x(e){return async r=>{e.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:n,CognitoIdentityClient:t}=await import("./loadCognitoIdentity-EWT55EI7.js"),i=o(l=>e.clientConfig?.[l]??e.parentClientConfig?.[l]??r?.callerClientConfig?.[l],"fromConfigs"),{Credentials:{AccessKeyId:s=ce(e.logger),Expiration:a,SecretKey:c=fe(e.logger),SessionToken:d}=le(e.logger)}=await(e.client??new t(Object.assign({},e.clientConfig??{},{region:i("region"),profile:i("profile"),userAgentAppId:i("userAgentAppId")}))).send(new n({CustomRoleArn:e.customRoleArn,IdentityId:e.identityId,Logins:e.logins?await A(e.logins):void 0}));return{identityId:e.identityId,accessKeyId:s,secretAccessKey:c,sessionToken:d,expiration:a}}}o(x,"fromCognitoIdentity");function ce(e){throw new P.CredentialsProviderError("Response from Amazon Cognito contained no access key ID",{logger:e})}o(ce,"throwOnMissingAccessKeyId");function le(e){throw new P.CredentialsProviderError("Response from Amazon Cognito contained no credentials",{logger:e})}o(le,"throwOnMissingCredentials");function fe(e){throw new P.CredentialsProviderError("Response from Amazon Cognito contained no secret key",{logger:e})}o(fe,"throwOnMissingSecretKey");var $=g(y());var N="IdentityIds",_=class{static{o(this,"IndexedDbStorage")}dbName;constructor(r="aws:cognito-identity-ids"){this.dbName=r}getItem(r){return this.withObjectStore("readonly",n=>{let t=n.get(r);return new Promise(i=>{t.onerror=()=>i(null),t.onsuccess=()=>i(t.result?t.result.value:null)})}).catch(()=>null)}removeItem(r){return this.withObjectStore("readwrite",n=>{let t=n.delete(r);return new Promise((i,s)=>{t.onerror=()=>s(t.error),t.onsuccess=()=>i()})})}setItem(r,n){return this.withObjectStore("readwrite",t=>{let i=t.put({id:r,value:n});return new Promise((s,a)=>{i.onerror=()=>a(i.error),i.onsuccess=()=>s()})})}getDb(){let r=self.indexedDB.open(this.dbName,1);return new Promise((n,t)=>{r.onsuccess=()=>{n(r.result)},r.onerror=()=>{t(r.error)},r.onblocked=()=>{t(new Error("Unable to access DB"))},r.onupgradeneeded=()=>{let i=r.result;i.onerror=()=>{t(new Error("Failed to create object store"))},i.createObjectStore(N,{keyPath:"id"})}})}withObjectStore(r,n){return this.getDb().then(t=>{let i=t.transaction(N,r);return i.oncomplete=()=>t.close(),new Promise((s,a)=>{i.onerror=()=>a(i.error),s(n(i.objectStore(N)))}).catch(s=>{throw t.close(),s})})}};var b=class{static{o(this,"InMemoryStorage")}store;constructor(r={}){this.store=r}getItem(r){return r in this.store?this.store[r]:null}removeItem(r){delete this.store[r]}setItem(r,n){this.store[r]=n}};var me=new b;function G(){return typeof self=="object"&&self.indexedDB?new _:typeof window=="object"&&window.localStorage?window.localStorage:me}o(G,"localStorage");function R({accountId:e,cache:r=G(),client:n,clientConfig:t,customRoleArn:i,identityPoolId:s,logins:a,userIdentifier:c=!a||Object.keys(a).length===0?"ANONYMOUS":void 0,logger:d,parentClientConfig:l}){d?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let w=c?`aws:cognito-identity-credentials:${s}:${c}`:void 0,f=o(async C=>{let{GetIdCommand:m,CognitoIdentityClient:S}=await import("./loadCognitoIdentity-EWT55EI7.js"),u=o(p=>t?.[p]??l?.[p]??C?.callerClientConfig?.[p],"fromConfigs"),v=n??new S(Object.assign({},t??{},{region:u("region"),profile:u("profile"),userAgentAppId:u("userAgentAppId")})),h=w&&await r.getItem(w);if(!h){let{IdentityId:p=ue(d)}=await v.send(new m({AccountId:e,IdentityPoolId:s,Logins:a?await A(a):void 0}));h=p,w&&Promise.resolve(r.setItem(w,h)).catch(()=>{})}return f=x({client:v,customRoleArn:i,logins:a,identityId:h}),f(C)},"provider");return C=>f(C).catch(async m=>{throw w&&Promise.resolve(r.removeItem(w)).catch(()=>{}),m})}o(R,"fromCognitoIdentityPool");function ue(e){throw new $.CredentialsProviderError("Response from Amazon Cognito contained no identity ID",{logger:e})}o(ue,"throwOnMissingId");var qe=o(e=>x({...e}),"fromCognitoIdentity");var ze=o(e=>R({...e}),"fromCognitoIdentityPool");var Ye=o(e=>(e?.logger?.debug("@smithy/credential-provider-imds","fromContainerMetadata"),M(e)),"fromContainerMetadata");var Ze=o(e=>E(e),"fromEnv");var tr=o((e={})=>z({...e}),"fromIni");var Y=g(se());var ar=o(e=>(e?.logger?.debug("@smithy/credential-provider-imds","fromInstanceMetadata"),async()=>F(e)().then(r=>(0,Y.setCredentialFeature)(r,"CREDENTIALS_IMDS","0"))),"fromInstanceMetadata");var fr=o(e=>j({...e}),"fromLoginCredentials");var I=g(y());var k=g(y());var J="AWS_EC2_METADATA_DISABLED",Q=o(async e=>{let{ENV_CMDS_FULL_URI:r,ENV_CMDS_RELATIVE_URI:n,fromContainerMetadata:t,fromInstanceMetadata:i}=await import("./dist-es-RGEIM2BP.js");if(process.env[n]||process.env[r]){e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");let{fromHttp:s}=await import("./dist-es-L2GU465G.js");return(0,k.chain)(s(e),t(e))}return process.env[J]&&process.env[J]!=="false"?async()=>{throw new k.CredentialsProviderError("EC2 Instance Metadata Service access disabled",{logger:e.logger})}:(e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),i(e))},"remoteProvider");function X(e,r){let n=pe(e),t,i,s,a,c=o(async d=>{if(d?.forceRefresh)return a||(a=n(d).then(l=>{s=l}).finally(()=>{a=void 0})),await a,s;if(s?.expiration&&s?.expiration?.getTime()<Date.now()&&(s=void 0),t)await t;else if(!s||r?.(s))if(s)i||(i=n(d).then(l=>{s=l}).catch(()=>{}).finally(()=>{i=void 0}));else return t=n(d).then(l=>{s=l}).finally(()=>{t=void 0}),c(d);return s},"provider");return c}o(X,"memoizeChain");var pe=o(e=>async r=>{let n;for(let t of e)try{return await t(r)}catch(i){if(n=i,i?.tryNextLink)continue;throw i}throw n},"internalCreateChain");var Z=!1,L=o((e={})=>X([async()=>{if(e.profile??process.env[I.ENV_PROFILE])throw process.env[K]&&process.env[W]&&(Z||((e.logger?.warn&&e.logger?.constructor?.name!=="NoOpLogger"?e.logger.warn.bind(e.logger):console.warn)(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:
|
|
19
|
+
Multiple credential sources detected:
|
|
20
|
+
Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set.
|
|
21
|
+
This SDK will proceed with the AWS_PROFILE value.
|
|
22
|
+
|
|
23
|
+
However, a future version may change this behavior to prefer the ENV static credentials.
|
|
24
|
+
Please ensure that your environment only sets either the AWS_PROFILE or the
|
|
25
|
+
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.
|
|
26
|
+
`),Z=!0)),new I.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.",{logger:e.logger,tryNextLink:!0});return e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),E(e)()},async r=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:n,ssoAccountId:t,ssoRegion:i,ssoRoleName:s,ssoSession:a}=e;if(!n&&!t&&!i&&!s&&!a)throw new I.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:e.logger});let{fromSSO:c}=await import("./dist-es-LSR2QCFZ.js");return c(e)(r)},async r=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:n}=await import("./dist-es-HYIIGUNX.js");return n(e)(r)},async r=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:n}=await import("./dist-es-SITTNOGV.js");return n(e)(r)},async r=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:n}=await import("./dist-es-W5GYOX6F.js");return n(e)(r)},async()=>(e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await Q(e))()),async()=>{throw new I.CredentialsProviderError("Could not load credentials from any providers",{tryNextLink:!1,logger:e.logger})}],ee),"defaultProvider");var ee=o(e=>e?.expiration!==void 0&&e.expiration.getTime()-Date.now()<3e5,"credentialsTreatedAsExpired");var re=o((e={})=>L({...e}),"fromNodeProviderChain");var Or=o(e=>q(e),"fromProcess");var Lr=o((e={})=>H({...e}),"fromSSO");var T=g(y());var te=g(ie()),D=g(y());var ge="us-east-1",ne=o((e,r,n)=>{let t;return async(i={})=>{let{callerClientConfig:s}=i,a=e.clientConfig?.profile??s?.profile,c=e.logger??s?.logger;c?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");let d={...e.params,RoleSessionName:e.params.RoleSessionName??"aws-sdk-js-"+Date.now()};if(d?.SerialNumber){if(!e.mfaCodeProvider)throw new D.CredentialsProviderError("Temporary credential requires multi-factor authentication, but no MFA code callback was provided.",{tryNextLink:!1,logger:c});d.TokenCode=await e.mfaCodeProvider(d?.SerialNumber)}let{AssumeRoleCommand:l,STSClient:w}=await import("./loadSts-RH5L3PIX.js");if(!t){let C=typeof r=="function"?r():void 0,m=[e.masterCredentials,e.clientConfig?.credentials,void s?.credentials,s?.credentialDefaultProvider?.(),C],S="STS client default credentials";if(m[0])S="options.masterCredentials";else if(m[1])S="options.clientConfig.credentials";else{if(m[2])throw S="caller client's credentials",new Error("fromTemporaryCredentials recursion in callerClientConfig.credentials");m[3]?S="caller client's credentialDefaultProvider":m[4]&&(S="AWS SDK default credentials")}let u=[e.clientConfig?.region,s?.region,await n?.({profile:a}),ge],v="default partition's default region";u[0]?v="options.clientConfig.region":u[1]?v="caller client's region":u[2]&&(v="file or env region");let h=[oe(e.clientConfig?.requestHandler),oe(s?.requestHandler)],p="STS default requestHandler";h[0]?p="options.clientConfig.requestHandler":h[1]&&(p="caller client's requestHandler"),c?.debug?.(`@aws-sdk/credential-providers - fromTemporaryCredentials STS client init with ${v}=${await(0,te.normalizeProvider)(O(u))()}, ${S}, ${p}.`),t=new w({userAgentAppId:s?.userAgentAppId,...e.clientConfig,credentials:O(m),logger:c,profile:a,region:O(u),requestHandler:O(h)})}if(e.clientPlugins)for(let C of e.clientPlugins)t.middlewareStack.use(C);let{Credentials:f}=await t.send(new l(d));if(!f||!f.AccessKeyId||!f.SecretAccessKey)throw new D.CredentialsProviderError(`Invalid response from STS.assumeRole call with role ${d.RoleArn}`,{logger:c});return{accessKeyId:f.AccessKeyId,secretAccessKey:f.SecretAccessKey,sessionToken:f.SessionToken,expiration:f.Expiration,credentialScope:f.CredentialScope}}},"fromTemporaryCredentials"),oe=o(e=>e?.metadata?.handlerProtocol==="h2"?void 0:e,"filterRequestHandler"),O=o(e=>{for(let r of e)if(r!==void 0)return r},"coalesce");var qr=o(e=>ne(e,re,async({profile:r=process.env.AWS_PROFILE})=>(0,T.loadConfig)({environmentVariableSelector:o(n=>n.AWS_REGION,"environmentVariableSelector"),configFileSelector:o(n=>n.region,"configFileSelector"),default:o(()=>{},"default")},{...T.NODE_REGION_CONFIG_FILE_OPTIONS,profile:r})()),"fromTemporaryCredentials");var zr=o((e={})=>U({...e}),"fromTokenFile");var Yr=o(e=>V({...e}),"fromWebToken");export{we as createCredentialChain,qe as fromCognitoIdentity,ze as fromCognitoIdentityPool,Ye as fromContainerMetadata,Ze as fromEnv,ae as fromHttp,tr as fromIni,ar as fromInstanceMetadata,fr as fromLoginCredentials,re as fromNodeProviderChain,Or as fromProcess,Lr as fromSSO,qr as fromTemporaryCredentials,zr as fromTokenFile,Yr as fromWebToken,de as propertyProviderChain};
|
|
@@ -10,5 +10,9 @@ if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => {
|
|
|
10
10
|
if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
|
|
11
11
|
import { createRequire as __alchemyCreateRequire } from 'node:module';
|
|
12
12
|
const require = __alchemyCreateRequire(import.meta.url);
|
|
13
|
+
import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
|
|
14
|
+
import { dirname as __alchemyDirname } from 'node:path';
|
|
15
|
+
const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
|
|
16
|
+
const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
|
|
13
17
|
|
|
14
|
-
import"./chunk-
|
|
18
|
+
import{a}from"./chunk-NGT6LCW6.js";import"./chunk-OCWGUTZJ.js";import"./chunk-CYRZU5QM.js";import"./chunk-2MRHL4B2.js";export{a as fromIni};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Built by esbuild from opencode-server source
|
|
2
|
+
if (typeof globalThis.Bun === 'undefined') {
|
|
3
|
+
globalThis.Bun = {
|
|
4
|
+
version: '0.0.0-node-compat',
|
|
5
|
+
stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
|
|
6
|
+
which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
|
|
10
|
+
if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
|
|
11
|
+
import { createRequire as __alchemyCreateRequire } from 'node:module';
|
|
12
|
+
const require = __alchemyCreateRequire(import.meta.url);
|
|
13
|
+
import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
|
|
14
|
+
import { dirname as __alchemyDirname } from 'node:path';
|
|
15
|
+
const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
|
|
16
|
+
const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
|
|
17
|
+
|
|
18
|
+
import{a}from"./chunk-YJPP6IQ3.js";import"./chunk-EK6FQQHY.js";import"./chunk-OCWGUTZJ.js";import"./chunk-CYRZU5QM.js";import"./chunk-2MRHL4B2.js";export{a as fromHttp};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Built by esbuild from opencode-server source
|
|
2
|
+
if (typeof globalThis.Bun === 'undefined') {
|
|
3
|
+
globalThis.Bun = {
|
|
4
|
+
version: '0.0.0-node-compat',
|
|
5
|
+
stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
|
|
6
|
+
which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
|
|
10
|
+
if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
|
|
11
|
+
import { createRequire as __alchemyCreateRequire } from 'node:module';
|
|
12
|
+
const require = __alchemyCreateRequire(import.meta.url);
|
|
13
|
+
import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
|
|
14
|
+
import { dirname as __alchemyDirname } from 'node:path';
|
|
15
|
+
const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
|
|
16
|
+
const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
|
|
17
|
+
|
|
18
|
+
import{a,b,c}from"./chunk-OT2YNR56.js";import"./chunk-OCWGUTZJ.js";import"./chunk-CYRZU5QM.js";import"./chunk-2MRHL4B2.js";export{c as fromSSO,a as isSsoProfile,b as validateSsoProfile};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Built by esbuild from opencode-server source
|
|
2
|
+
if (typeof globalThis.Bun === 'undefined') {
|
|
3
|
+
globalThis.Bun = {
|
|
4
|
+
version: '0.0.0-node-compat',
|
|
5
|
+
stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
|
|
6
|
+
which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
|
|
10
|
+
if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
|
|
11
|
+
import { createRequire as __alchemyCreateRequire } from 'node:module';
|
|
12
|
+
const require = __alchemyCreateRequire(import.meta.url);
|
|
13
|
+
import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
|
|
14
|
+
import { dirname as __alchemyDirname } from 'node:path';
|
|
15
|
+
const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
|
|
16
|
+
const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
|
|
17
|
+
|
|
18
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-BQ4IEPN3.js";import"./chunk-CYRZU5QM.js";import"./chunk-2MRHL4B2.js";export{b as DEFAULT_MAX_RETRIES,a as DEFAULT_TIMEOUT,g as ENV_CMDS_AUTH_TOKEN,e as ENV_CMDS_FULL_URI,f as ENV_CMDS_RELATIVE_URI,i as Endpoint,h as fromContainerMetadata,k as fromInstanceMetadata,j as getInstanceMetadataEndpoint,d as httpRequest,c as providerConfigFromInit};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Built by esbuild from opencode-server source
|
|
2
|
+
if (typeof globalThis.Bun === 'undefined') {
|
|
3
|
+
globalThis.Bun = {
|
|
4
|
+
version: '0.0.0-node-compat',
|
|
5
|
+
stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
|
|
6
|
+
which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
|
|
10
|
+
if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
|
|
11
|
+
import { createRequire as __alchemyCreateRequire } from 'node:module';
|
|
12
|
+
const require = __alchemyCreateRequire(import.meta.url);
|
|
13
|
+
import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
|
|
14
|
+
import { dirname as __alchemyDirname } from 'node:path';
|
|
15
|
+
const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
|
|
16
|
+
const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
|
|
17
|
+
|
|
18
|
+
import{a}from"./chunk-OGDRUXMJ.js";import"./chunk-OCWGUTZJ.js";import"./chunk-CYRZU5QM.js";import"./chunk-2MRHL4B2.js";export{a as fromProcess};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Built by esbuild from opencode-server source
|
|
2
|
+
if (typeof globalThis.Bun === 'undefined') {
|
|
3
|
+
globalThis.Bun = {
|
|
4
|
+
version: '0.0.0-node-compat',
|
|
5
|
+
stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
|
|
6
|
+
which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
|
|
10
|
+
if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
|
|
11
|
+
import { createRequire as __alchemyCreateRequire } from 'node:module';
|
|
12
|
+
const require = __alchemyCreateRequire(import.meta.url);
|
|
13
|
+
import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
|
|
14
|
+
import { dirname as __alchemyDirname } from 'node:path';
|
|
15
|
+
const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
|
|
16
|
+
const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
|
|
17
|
+
|
|
18
|
+
import{a,b}from"./chunk-2JE3QYG6.js";import"./chunk-OCWGUTZJ.js";import"./chunk-CYRZU5QM.js";import"./chunk-2MRHL4B2.js";export{b as fromTokenFile,a as fromWebToken};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Built by esbuild from opencode-server source
|
|
2
|
+
if (typeof globalThis.Bun === 'undefined') {
|
|
3
|
+
globalThis.Bun = {
|
|
4
|
+
version: '0.0.0-node-compat',
|
|
5
|
+
stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
|
|
6
|
+
which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
|
|
10
|
+
if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
|
|
11
|
+
import { createRequire as __alchemyCreateRequire } from 'node:module';
|
|
12
|
+
const require = __alchemyCreateRequire(import.meta.url);
|
|
13
|
+
import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
|
|
14
|
+
import { dirname as __alchemyDirname } from 'node:path';
|
|
15
|
+
const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
|
|
16
|
+
const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
|
|
17
|
+
|
|
18
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,n as m}from"./chunk-FYYAOZPU.js";import"./chunk-V6HERYFV.js";import"./chunk-DO2UZ6NY.js";import"./chunk-AZUMH3TO.js";import"./chunk-2MRHL4B2.js";m();export{b as AlwaysOffSampler,c as AlwaysOnSampler,h as BasicTracerProvider,f as BatchSpanProcessor,i as ConsoleSpanExporter,j as InMemorySpanExporter,l as NoopSpanProcessor,d as ParentBasedSampler,g as RandomIdGenerator,a as SamplingDecision,k as SimpleSpanProcessor,e as TraceIdRatioBasedSampler};
|