@minimax-ai/code 0.6.11 → 0.6.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/CHANGELOG.zh-CN.md +23 -0
  3. package/README.md +1 -1
  4. package/README.zh-CN.md +11 -1
  5. package/assets/agents/_default/prompt-base-windows.md +1 -1
  6. package/assets/agents/_default/prompt-base-windows.md.hbs +1 -1
  7. package/assets/agents/desktop-task/checkpoint/system.md +6 -2
  8. package/assets/agents/managed-prompts.json +1 -0
  9. package/assets/agents/memory-v2-consolidation.md +2 -2
  10. package/assets/agents/workflow/goal/budget-limit.md +4 -1
  11. package/assets/agents/workflow/goal/completion-summary.md +2 -0
  12. package/assets/agents/workflow/goal/recovery-terminal-audit.md +3 -2
  13. package/assets/agents/workflow/goal/recovery.md +2 -2
  14. package/chunks/{clipboard-image-Q5NH3BUQ.js → application-FYXBCFKS.js} +1 -1
  15. package/chunks/{auth-command-YIBIYLYL.js → auth-command-UUTBKVM2.js} +3 -3
  16. package/chunks/chunk-25R53L7J.js +23 -0
  17. package/chunks/chunk-334CV6RF.js +2 -0
  18. package/chunks/{chunk-7FUBWI5L.js → chunk-47KWM23C.js} +906 -856
  19. package/chunks/{chunk-FNHS672G.js → chunk-5ADYFF2U.js} +3367 -2383
  20. package/chunks/{chunk-NXXFMBAV.js → chunk-AMLNR7IO.js} +1 -1
  21. package/chunks/{chunk-3MHUE4DM.js → chunk-DCFP5ZHZ.js} +6 -6
  22. package/chunks/{chunk-X4N2MWNJ.js → chunk-G3BYCHZS.js} +1 -1
  23. package/chunks/{chunk-3FETZOUF.js → chunk-I2T4QMR7.js} +3 -3
  24. package/chunks/{chunk-FPCUX6KP.js → chunk-I5CQQ3J6.js} +1 -1
  25. package/chunks/{chunk-VUXFNHQE.js → chunk-I7MLO7YD.js} +1 -1
  26. package/chunks/{chunk-CRTW4JM6.js → chunk-IO46JRII.js} +1 -1
  27. package/chunks/chunk-KGAIRLNO.js +3 -0
  28. package/chunks/chunk-L43V3NKW.js +2 -0
  29. package/chunks/chunk-NJVLEZ3I.js +2 -0
  30. package/chunks/{chunk-YPMJNO4T.js → chunk-OHWTK4KK.js} +1 -1
  31. package/chunks/{chunk-2LP3AAE5.js → chunk-QJ2FEPC2.js} +4 -4
  32. package/chunks/{chunk-UQ2YIDWV.js → chunk-QXUSWEWV.js} +1 -1
  33. package/chunks/{application-ZJ5NM3DF.js → chunk-SLFKHVQC.js} +1 -1
  34. package/chunks/chunk-VAVHH4XP.js +16 -0
  35. package/chunks/chunk-X3PES5WL.js +193 -0
  36. package/chunks/chunk-X7FQ5SBJ.js +40 -0
  37. package/chunks/{chunk-S6GSNWAM.js → chunk-ZPSMBMGA.js} +119 -119
  38. package/chunks/clipboard-image-SRYRNKLQ.js +2 -0
  39. package/chunks/{data-dir-AVW455BT.js → data-dir-C6MQE6W2.js} +1 -1
  40. package/chunks/dist-K652HFOW.js +2 -0
  41. package/chunks/{google-W4KKPJIU.js → google-ZWZWHJZZ.js} +1 -1
  42. package/chunks/{google-vertex-K2VBU5YX.js → google-vertex-C3BYAM6A.js} +1 -1
  43. package/chunks/{install-source-REWTEDE3.js → install-source-FIUDUO7G.js} +1 -1
  44. package/chunks/launcher-AVQRYDKB.js +275 -0
  45. package/chunks/{lifecycle-7W6GXLEL.js → lifecycle-VXPE5MII.js} +1 -1
  46. package/chunks/main-JXKRTY5N.js +11 -0
  47. package/chunks/{plugin-command-QSDS4V7E.js → plugin-command-ZZLA7IRM.js} +1 -1
  48. package/chunks/{provider-command-ZE4ODVR3.js → provider-command-PVOKX3IV.js} +1 -1
  49. package/chunks/{run-acp-command-LM4IFM5B.js → run-acp-command-MV4O4NBX.js} +32 -32
  50. package/chunks/run-app-server-command-DEX4FRZJ.js +24 -0
  51. package/chunks/{run-exec-command-B7H55F5B.js → run-exec-command-EJMP5IF3.js} +1 -1
  52. package/chunks/{tools-L7RFN554.js → tools-VTXR5JSH.js} +1 -1
  53. package/chunks/{update-HOQ5YQFF.js → update-4XVOPCYB.js} +1 -1
  54. package/cli.js +2 -2
  55. package/package.json +1 -1
  56. package/chunks/chunk-5JU6ZMXS.js +0 -23
  57. package/chunks/chunk-G7FSWJID.js +0 -193
  58. package/chunks/chunk-LQIEYG3O.js +0 -39
  59. package/chunks/chunk-MESLFKP6.js +0 -3
  60. package/chunks/chunk-NICEDCLM.js +0 -2
  61. package/chunks/chunk-NP5G53PV.js +0 -16
  62. package/chunks/chunk-RDUENEEQ.js +0 -2
  63. package/chunks/dist-B52TV5OC.js +0 -2
  64. package/chunks/launcher-BADSPVA5.js +0 -274
  65. package/chunks/main-LWOWUP76.js +0 -9
@@ -0,0 +1,2 @@
1
+ import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
2
+ import{a,b,c,d,e}from"./chunk-VAVHH4XP.js";import"./chunk-OHWTK4KK.js";import"./chunk-SLFKHVQC.js";import"./chunk-D76SO2ME.js";export{a as MINIMAX_CODE_CLIPBOARD_IMAGE_MAX_BYTES,b as TuiClipboardImageError,c as copyTuiAttachmentToTemporaryLease,e as extensionForClipboardImageMimeType,d as readTuiClipboardImage};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
2
- import{a,b,c,d}from"./chunk-CRTW4JM6.js";import"./chunk-2LP3AAE5.js";import"./chunk-G7FSWJID.js";import"./chunk-3FETZOUF.js";import"./chunk-CWWDVX6C.js";import"./chunk-ZITT4GJK.js";import"./chunk-D76SO2ME.js";export{b as getTuiDataDirPath,d as prepareTuiDataDir,a as resolveDefaultTuiDataDir,c as resolveTuiDataDir};
2
+ import{a,b,c,d}from"./chunk-IO46JRII.js";import"./chunk-QJ2FEPC2.js";import"./chunk-X3PES5WL.js";import"./chunk-I2T4QMR7.js";import"./chunk-CWWDVX6C.js";import"./chunk-ZITT4GJK.js";import"./chunk-D76SO2ME.js";export{b as getTuiDataDirPath,d as prepareTuiDataDir,a as resolveDefaultTuiDataDir,c as resolveTuiDataDir};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
2
+ import{$ as W,$a as Va,A as v,Aa as ua,B as w,Ba as va,C as x,Ca as wa,D as y,Da as xa,E as z,Ea as ya,F as A,Fa as za,G as B,Ga as Aa,H as C,Ha as Ba,I as D,Ia as Ca,J as E,Ja as Da,K as F,Ka as Ea,L as G,La as Fa,M as H,Ma as Ga,N as I,Na as Ha,O as J,Oa as Ia,P as K,Pa as Ja,Q as L,Qa as Ka,R as M,Ra as La,S as N,Sa as Ma,T as O,Ta as Na,U as P,Ua as Oa,V as Q,Va as Pa,W as R,Wa as Qa,X as S,Xa as Ra,Y as T,Ya as Sa,Z as U,Za as Ta,_ as V,_a as Ua,aa as X,ab as Wa,ba as Y,bb as Xa,ca as Z,cb as Ya,d as a,da as _,db as Za,ea as $,eb as hb,f as b,fa as aa,fb as ib,g as c,ga as ba,gb as jb,h as d,ha as ca,hb as kb,ia as da,ib as lb,j as e,ja as ea,jb as mb,k as f,ka as fa,kb as nb,l as g,la as ga,lb as ob,m as h,ma as ha,mb as pb,n as i,na as ia,nb as qb,o as j,oa as ja,ob as rb,p as k,pb as sb,q as l,qa as ka,qb as tb,r as m,ra as la,rb as ub,s as n,sa as ma,sb as vb,t as o,ta as na,u as p,ua as oa,v as q,va as pa,w as r,wa as qa,x as s,xa as ra,y as t,ya as sa,z as u,za as ta}from"./chunk-X3PES5WL.js";import"./chunk-I2T4QMR7.js";import"./chunk-CWWDVX6C.js";import{a as _a,b as $a,c as ab,d as bb,e as cb,f as db,g as eb,h as fb,i as gb}from"./chunk-ZITT4GJK.js";import"./chunk-D76SO2ME.js";export{M as AGENT_BUILTIN_MCP_TOOL_IDS,N as AGENT_BUILTIN_SKILL_IDS,L as AGENT_BUILTIN_TOOL_IDS,O as AGENT_CAPABILITY_OWNED_SKILL_IDS,A as AGENT_RUNTIME_FRAMEWORKS,cb as ASR_PROXY_AUTH_ENV_KEYS,xa as BRAND,ia as BROWSER_CONFIG_DEFAULTS,Pa as CONVERSATION_STOP_CONFIG_DEFAULTS,o as CUSTOM_PROVIDER_ID_PREFIX,tb as ConfigFileError,V as DATA_CONTRIBUTION_CONFIG_DEFAULTS,B as DEFAULT_AGENT_RUNTIME_FRAMEWORK,Ha as DEFAULT_MODEL_PRESETS,za as DEFAULT_PORT,x as DEFAULT_SKILLS_CONFIG,z as EXTERNAL_SOURCE_KIND_LIST,ba as GOAL_CONFIG_DEFAULTS,ca as GOAL_CONFIG_LIMITS,_ as GOAL_EVALUATOR_MODEL_POLICIES,aa as GOAL_SUBAGENT_PROFILES,Z as GOAL_VERIFICATION_EVIDENCE_MODES,Y as GOAL_VERIFICATION_MODES,$ as GOAL_VERIFIER_READONLY_PROFILE,F as LEGACY_DATA_DIR_BASENAME,$a as LEGACY_RUNTIME_ENV_KEYS,kb as LOCAL_RUNTIME_AUTH_CONTEXT_FILE,m as MANAGED_MINIMAX_PROVIDER_ID,_a as MANAGED_RUNTIME_KEYS,h as MEMORY_V2_DEFAULTS,n as MINIMAX_API_PROVIDER_ID,E as NEW_DATA_DIR_BASENAME,Aa as OPENCODE_PORT_OFFSET,bb as PARENT_HINT_KEYS,ga as REQUEST_MEDIA_DEFAULTS,ya as RUNTIME_ENV_PREFIX,ab as RUNTIME_IDENTITY_KEYS,la as SANDBOX_CONFIG_DEFAULTS,na as SUBAGENT_CONFIG_DEFAULTS,rb as TEST_PORT_ROLE_FLOOR,qb as TEST_PORT_ROLE_OFFSET,ea as TOOL_RESULT_COMPACTION_DEFAULTS,Ga as allowsManagedMinimaxProviderOverride,db as buildChildEnv,pb as clearLocalRuntimeAuthContextFile,Za as compareAndSetLocalModelContext,Sa as credentialEnvReferenceName,u as deliveredDefaultModelId,Ca as detectGitPortInfo,jb as detectPidOwner,gb as findLegacyRuntimeEnvKeys,ib as formatPidFile,La as getConfig,Fa as getConfigPath,Ea as getDataDir,H as getLegacyDataDirPath,Oa as getOpenCodePort,G as getPrimaryDataDirPath,Da as getProfile,ra as getRuntimeBuildEnv,ta as getRuntimePresetKey,qa as getRuntimeRegion,ka as getSandboxConfigDefaults,T as isAgentBuiltinMcpToolEnabled,U as isAgentBuiltinSkillEnabled,S as isAgentBuiltinToolEnabled,va as isBetaFeatureProdReady,p as isFirstPartyMinimaxMessagesRoute,wa as isInternalBuild,j as isLegacyManagedMinimaxProvider,i as isLegacyMemoryRecallEnabled,a as isLocalSourceProvenanceEnabled,k as isManagedProviderBaseUrl,sa as isManagedRuntime,g as isMemoryV2Enabled,t as isOfficialCatalogRoute,pa as isProposalEligibleAgent,r as listRouteModelIds,ub as loadConfigFromFile,J as migrateDefaultDataDir,K as migrateProfileDataDir,w as minimaxApiModels,lb as normalizeLocalRuntimeAuthContext,Q as parseAgentCapabilityConfig,D as parseAgentRuntimeConfig,C as parseAgentRuntimeFramework,P as parseAgentsConfig,ja as parseBrowserConfig,e as parseConfigText,Qa as parseConversationStopConfig,W as parseDataContributionConfig,da as parseGoalConfig,hb as parsePidFile,ha as parseRequestMediaConfig,c as parseRunawayGuardOverride,ma as parseSandboxConfig,y as parseSkillsConfig,oa as parseSubagentConfig,fa as parseToolResultCompactionConfig,sb as pickTestPort,Ua as probeProviderCredential,Ra as readConversationStopConfig,X as readDataContributionEnabled,vb as readExplicitBetaFeatureFromFile,nb as readLocalRuntimeAuthContext,Va as removeLocalProviderConfig,Wa as replaceLocalManagedMinimaxProvider,Ka as resetConfig,Ba as resetGitDetect,R as resolveAgentCapabilities,ua as resolveBetaFeature,I as resolveDataDir,mb as resolveLocalRuntimeAuthContextPath,s as resolveModelAvailability,q as resolveModelCallRoute,v as resolveModelReplacement,Na as resolvePort,Ma as resolvePromptConfig,l as resolveProviderAuthMode,Ta as resolveProviderCredential,d as resolveRunawayGuardConfig,f as serializeConfigPreservingComments,Ia as setLegacyByokProviderMigrationEnabled,Ja as setManagedPresetBaseUrlSyncEnabled,eb as stripManagedRuntimeEnv,fb as stripRuntimeBoundaryKeysFrom,Xa as updateLocalByokConfig,Ya as updateLocalModelSelection,ob as writeLocalRuntimeAuthContext,b as writeTuiStatusLineSetting};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
2
- import{c as R,d as L,e as f,f as _,g as G,h as O,i as P}from"./chunk-NXXFMBAV.js";import"./chunk-X4N2MWNJ.js";import{d as w,e as M,f as T,h as v,j as S}from"./chunk-UOE7W4PK.js";import{a as b}from"./chunk-WFWSBUYD.js";import"./chunk-CWWDVX6C.js";import"./chunk-D76SO2ME.js";var A=0,k=(e,o,n)=>{let i=new T;return(async()=>{let t={role:"assistant",content:[],api:"google-generative-ai",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let r=n?.apiKey;if(!r)throw new Error(`No API key for provider: ${e.provider}`);let c=W(e,r,n?.headers),u=B(e,o,n),C=await n?.onPayload?.(u,e);C!==void 0&&(u=C);let N=await c.models.generateContentStream(u);i.push({type:"start",partial:t});let a=null,I=t.content,l=()=>I.length-1;for await(let g of N){t.responseId||=g.responseId;let d=g.candidates?.[0];if(d?.content?.parts)for(let s of d.content.parts){if(s.text!==void 0){let h=L(s);(!a||h&&a.type!=="thinking"||!h&&a.type!=="text")&&(a&&(a.type==="text"?i.push({type:"text_end",contentIndex:I.length-1,content:a.text,partial:t}):i.push({type:"thinking_end",contentIndex:l(),content:a.thinking,partial:t})),h?(a={type:"thinking",thinking:"",thinkingSignature:void 0},t.content.push(a),i.push({type:"thinking_start",contentIndex:l(),partial:t})):(a={type:"text",text:""},t.content.push(a),i.push({type:"text_start",contentIndex:l(),partial:t}))),a.type==="thinking"?(a.thinking+=s.text,a.thinkingSignature=f(a.thinkingSignature,s.thoughtSignature),i.push({type:"thinking_delta",contentIndex:l(),delta:s.text,partial:t})):(a.text+=s.text,a.textSignature=f(a.textSignature,s.thoughtSignature),i.push({type:"text_delta",contentIndex:l(),delta:s.text,partial:t}))}if(s.functionCall){a&&(a.type==="text"?i.push({type:"text_end",contentIndex:l(),content:a.text,partial:t}):i.push({type:"thinking_end",contentIndex:l(),content:a.thinking,partial:t}),a=null);let h=s.functionCall.id,p={type:"toolCall",id:!h||t.content.some(x=>x.type==="toolCall"&&x.id===h)?`${s.functionCall.name}_${Date.now()}_${++A}`:h,name:s.functionCall.name||"",arguments:s.functionCall.args??{},...s.thoughtSignature&&{thoughtSignature:s.thoughtSignature}};t.content.push(p),i.push({type:"toolcall_start",contentIndex:l(),partial:t}),i.push({type:"toolcall_delta",contentIndex:l(),delta:JSON.stringify(p.arguments),partial:t}),i.push({type:"toolcall_end",contentIndex:l(),toolCall:p,partial:t})}}d?.finishReason&&(t.stopReason=P(d.finishReason),t.content.some(s=>s.type==="toolCall")&&(t.stopReason="toolUse")),g.usageMetadata&&(t.usage={input:(g.usageMetadata.promptTokenCount||0)-(g.usageMetadata.cachedContentTokenCount||0),output:(g.usageMetadata.candidatesTokenCount||0)+(g.usageMetadata.thoughtsTokenCount||0),cacheRead:g.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:g.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},w(e,t.usage))}if(a&&(a.type==="text"?i.push({type:"text_end",contentIndex:l(),content:a.text,partial:t}):i.push({type:"thinking_end",contentIndex:l(),content:a.thinking,partial:t})),n?.signal?.aborted)throw new Error("Request was aborted");if(t.stopReason==="aborted"||t.stopReason==="error")throw new Error("An unknown error occurred");i.push({type:"done",reason:t.stopReason,message:t}),i.end()}catch(r){v(n?.onProviderError,r,e);for(let c of t.content)"index"in c&&delete c.index;t.stopReason=n?.signal?.aborted?"aborted":"error",t.errorMessage=r instanceof Error?r.message:JSON.stringify(r),i.push({type:"error",reason:t.stopReason,error:t}),i.end()}})(),i},X=(e,o,n)=>{let i=n?.apiKey;if(!i)throw new Error(`No API key for provider: ${e.provider}`);let t=S(e,n,i);if(!n?.reasoning)return k(e,o,{...t,thinking:{enabled:!1}});let r=M(e,n.reasoning),c=r==="off"?"high":r,u=e;return y(u)||E(u)||m(u)?k(e,o,{...t,thinking:{enabled:!0,level:U(c,u)}}):k(e,o,{...t,thinking:{enabled:!0,budgetTokens:$(u,c,n.thinkingBudgets)}})};function W(e,o,n){let i={};return e.baseUrl&&(i.baseUrl=e.baseUrl,i.apiVersion=""),(e.headers||n)&&(i.headers={...e.headers,...n}),new R({apiKey:o,httpOptions:Object.keys(i).length>0?i:void 0})}function B(e,o,n={}){let i=_(e,o),t={};n.temperature!==void 0&&(t.temperature=n.temperature),n.maxTokens!==void 0&&(t.maxOutputTokens=n.maxTokens);let r={...Object.keys(t).length>0&&t,...o.systemPrompt&&{systemInstruction:b(o.systemPrompt)},...o.tools&&o.tools.length>0&&{tools:G(o.tools)}};if(o.tools&&o.tools.length>0&&n.toolChoice?r.toolConfig={functionCallingConfig:{mode:O(n.toolChoice)}}:r.toolConfig=void 0,n.thinking?.enabled&&e.reasoning){let u={includeThoughts:!0};n.thinking.level!==void 0?u.thinkingLevel=n.thinking.level:n.thinking.budgetTokens!==void 0&&(u.thinkingBudget=n.thinking.budgetTokens),r.thinkingConfig=u}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(r.thinkingConfig=H(e));if(n.signal){if(n.signal.aborted)throw new Error("Request aborted");r.abortSignal=n.signal}return{model:e.id,contents:i,config:r}}function m(e){return/gemma-?4/.test(e.id.toLowerCase())}function y(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function E(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function H(e){return y(e)?{thinkingLevel:"LOW"}:E(e)?{thinkingLevel:"MINIMAL"}:m(e)?{thinkingLevel:"MINIMAL"}:{thinkingBudget:0}}function U(e,o){if(y(o))switch(e){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}if(m(o))switch(e){case"minimal":case"low":return"MINIMAL";case"medium":case"high":return"HIGH"}switch(e){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function $(e,o,n){return n?.[o]!==void 0?n[o]:e.id.includes("2.5-pro")?{minimal:128,low:2048,medium:8192,high:32768}[o]:e.id.includes("2.5-flash-lite")?{minimal:512,low:2048,medium:8192,high:24576}[o]:e.id.includes("2.5-flash")?{minimal:128,low:2048,medium:8192,high:24576}[o]:-1}export{k as streamGoogle,X as streamSimpleGoogle};
2
+ import{c as R,d as L,e as f,f as _,g as G,h as O,i as P}from"./chunk-AMLNR7IO.js";import"./chunk-G3BYCHZS.js";import{d as w,e as M,f as T,h as v,j as S}from"./chunk-UOE7W4PK.js";import{a as b}from"./chunk-WFWSBUYD.js";import"./chunk-CWWDVX6C.js";import"./chunk-D76SO2ME.js";var A=0,k=(e,o,n)=>{let i=new T;return(async()=>{let t={role:"assistant",content:[],api:"google-generative-ai",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let r=n?.apiKey;if(!r)throw new Error(`No API key for provider: ${e.provider}`);let c=W(e,r,n?.headers),u=B(e,o,n),C=await n?.onPayload?.(u,e);C!==void 0&&(u=C);let N=await c.models.generateContentStream(u);i.push({type:"start",partial:t});let a=null,I=t.content,l=()=>I.length-1;for await(let g of N){t.responseId||=g.responseId;let d=g.candidates?.[0];if(d?.content?.parts)for(let s of d.content.parts){if(s.text!==void 0){let h=L(s);(!a||h&&a.type!=="thinking"||!h&&a.type!=="text")&&(a&&(a.type==="text"?i.push({type:"text_end",contentIndex:I.length-1,content:a.text,partial:t}):i.push({type:"thinking_end",contentIndex:l(),content:a.thinking,partial:t})),h?(a={type:"thinking",thinking:"",thinkingSignature:void 0},t.content.push(a),i.push({type:"thinking_start",contentIndex:l(),partial:t})):(a={type:"text",text:""},t.content.push(a),i.push({type:"text_start",contentIndex:l(),partial:t}))),a.type==="thinking"?(a.thinking+=s.text,a.thinkingSignature=f(a.thinkingSignature,s.thoughtSignature),i.push({type:"thinking_delta",contentIndex:l(),delta:s.text,partial:t})):(a.text+=s.text,a.textSignature=f(a.textSignature,s.thoughtSignature),i.push({type:"text_delta",contentIndex:l(),delta:s.text,partial:t}))}if(s.functionCall){a&&(a.type==="text"?i.push({type:"text_end",contentIndex:l(),content:a.text,partial:t}):i.push({type:"thinking_end",contentIndex:l(),content:a.thinking,partial:t}),a=null);let h=s.functionCall.id,p={type:"toolCall",id:!h||t.content.some(x=>x.type==="toolCall"&&x.id===h)?`${s.functionCall.name}_${Date.now()}_${++A}`:h,name:s.functionCall.name||"",arguments:s.functionCall.args??{},...s.thoughtSignature&&{thoughtSignature:s.thoughtSignature}};t.content.push(p),i.push({type:"toolcall_start",contentIndex:l(),partial:t}),i.push({type:"toolcall_delta",contentIndex:l(),delta:JSON.stringify(p.arguments),partial:t}),i.push({type:"toolcall_end",contentIndex:l(),toolCall:p,partial:t})}}d?.finishReason&&(t.stopReason=P(d.finishReason),t.content.some(s=>s.type==="toolCall")&&(t.stopReason="toolUse")),g.usageMetadata&&(t.usage={input:(g.usageMetadata.promptTokenCount||0)-(g.usageMetadata.cachedContentTokenCount||0),output:(g.usageMetadata.candidatesTokenCount||0)+(g.usageMetadata.thoughtsTokenCount||0),cacheRead:g.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:g.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},w(e,t.usage))}if(a&&(a.type==="text"?i.push({type:"text_end",contentIndex:l(),content:a.text,partial:t}):i.push({type:"thinking_end",contentIndex:l(),content:a.thinking,partial:t})),n?.signal?.aborted)throw new Error("Request was aborted");if(t.stopReason==="aborted"||t.stopReason==="error")throw new Error("An unknown error occurred");i.push({type:"done",reason:t.stopReason,message:t}),i.end()}catch(r){v(n?.onProviderError,r,e);for(let c of t.content)"index"in c&&delete c.index;t.stopReason=n?.signal?.aborted?"aborted":"error",t.errorMessage=r instanceof Error?r.message:JSON.stringify(r),i.push({type:"error",reason:t.stopReason,error:t}),i.end()}})(),i},X=(e,o,n)=>{let i=n?.apiKey;if(!i)throw new Error(`No API key for provider: ${e.provider}`);let t=S(e,n,i);if(!n?.reasoning)return k(e,o,{...t,thinking:{enabled:!1}});let r=M(e,n.reasoning),c=r==="off"?"high":r,u=e;return y(u)||E(u)||m(u)?k(e,o,{...t,thinking:{enabled:!0,level:U(c,u)}}):k(e,o,{...t,thinking:{enabled:!0,budgetTokens:$(u,c,n.thinkingBudgets)}})};function W(e,o,n){let i={};return e.baseUrl&&(i.baseUrl=e.baseUrl,i.apiVersion=""),(e.headers||n)&&(i.headers={...e.headers,...n}),new R({apiKey:o,httpOptions:Object.keys(i).length>0?i:void 0})}function B(e,o,n={}){let i=_(e,o),t={};n.temperature!==void 0&&(t.temperature=n.temperature),n.maxTokens!==void 0&&(t.maxOutputTokens=n.maxTokens);let r={...Object.keys(t).length>0&&t,...o.systemPrompt&&{systemInstruction:b(o.systemPrompt)},...o.tools&&o.tools.length>0&&{tools:G(o.tools)}};if(o.tools&&o.tools.length>0&&n.toolChoice?r.toolConfig={functionCallingConfig:{mode:O(n.toolChoice)}}:r.toolConfig=void 0,n.thinking?.enabled&&e.reasoning){let u={includeThoughts:!0};n.thinking.level!==void 0?u.thinkingLevel=n.thinking.level:n.thinking.budgetTokens!==void 0&&(u.thinkingBudget=n.thinking.budgetTokens),r.thinkingConfig=u}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(r.thinkingConfig=H(e));if(n.signal){if(n.signal.aborted)throw new Error("Request aborted");r.abortSignal=n.signal}return{model:e.id,contents:i,config:r}}function m(e){return/gemma-?4/.test(e.id.toLowerCase())}function y(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function E(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function H(e){return y(e)?{thinkingLevel:"LOW"}:E(e)?{thinkingLevel:"MINIMAL"}:m(e)?{thinkingLevel:"MINIMAL"}:{thinkingBudget:0}}function U(e,o){if(y(o))switch(e){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}if(m(o))switch(e){case"minimal":case"low":return"MINIMAL";case"medium":case"high":return"HIGH"}switch(e){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function $(e,o,n){return n?.[o]!==void 0?n[o]:e.id.includes("2.5-pro")?{minimal:128,low:2048,medium:8192,high:32768}[o]:e.id.includes("2.5-flash-lite")?{minimal:512,low:2048,medium:8192,high:24576}[o]:e.id.includes("2.5-flash")?{minimal:128,low:2048,medium:8192,high:24576}[o]:-1}export{k as streamGoogle,X as streamSimpleGoogle};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
2
- import{a as d,b as w,c as m,d as M,e as k,f as R,g as S,h as G,i as N}from"./chunk-NXXFMBAV.js";import"./chunk-X4N2MWNJ.js";import{d as E,e as T,f as b,h as _,j as v}from"./chunk-UOE7W4PK.js";import{a as O}from"./chunk-WFWSBUYD.js";import"./chunk-CWWDVX6C.js";import"./chunk-D76SO2ME.js";var P="v1",V="gcp-vertex-credentials",H={THINKING_LEVEL_UNSPECIFIED:d.THINKING_LEVEL_UNSPECIFIED,MINIMAL:d.MINIMAL,LOW:d.LOW,MEDIUM:d.MEDIUM,HIGH:d.HIGH},K=0,C=(e,n,t)=>{let o=new b;return(async()=>{let i={role:"assistant",content:[],api:"google-vertex",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let a=$(t),c=a?j(e,a,t?.headers):W(e,F(t),z(t),t?.headers),g=X(e,n,t),y=await t?.onPayload?.(g,e);y!==void 0&&(g=y);let D=await c.models.generateContentStream(g);o.push({type:"start",partial:i});let r=null,x=i.content,u=()=>x.length-1;for await(let l of D){i.responseId||=l.responseId;let p=l.candidates?.[0];if(p?.content?.parts)for(let s of p.content.parts){if(s.text!==void 0){let h=M(s);(!r||h&&r.type!=="thinking"||!h&&r.type!=="text")&&(r&&(r.type==="text"?o.push({type:"text_end",contentIndex:x.length-1,content:r.text,partial:i}):o.push({type:"thinking_end",contentIndex:u(),content:r.thinking,partial:i})),h?(r={type:"thinking",thinking:"",thinkingSignature:void 0},i.content.push(r),o.push({type:"thinking_start",contentIndex:u(),partial:i})):(r={type:"text",text:""},i.content.push(r),o.push({type:"text_start",contentIndex:u(),partial:i}))),r.type==="thinking"?(r.thinking+=s.text,r.thinkingSignature=k(r.thinkingSignature,s.thoughtSignature),o.push({type:"thinking_delta",contentIndex:u(),delta:s.text,partial:i})):(r.text+=s.text,r.textSignature=k(r.textSignature,s.thoughtSignature),o.push({type:"text_delta",contentIndex:u(),delta:s.text,partial:i}))}if(s.functionCall){r&&(r.type==="text"?o.push({type:"text_end",contentIndex:u(),content:r.text,partial:i}):o.push({type:"thinking_end",contentIndex:u(),content:r.thinking,partial:i}),r=null);let h=s.functionCall.id,f={type:"toolCall",id:!h||i.content.some(L=>L.type==="toolCall"&&L.id===h)?`${s.functionCall.name}_${Date.now()}_${++K}`:h,name:s.functionCall.name||"",arguments:s.functionCall.args??{},...s.thoughtSignature&&{thoughtSignature:s.thoughtSignature}};i.content.push(f),o.push({type:"toolcall_start",contentIndex:u(),partial:i}),o.push({type:"toolcall_delta",contentIndex:u(),delta:JSON.stringify(f.arguments),partial:i}),o.push({type:"toolcall_end",contentIndex:u(),toolCall:f,partial:i})}}p?.finishReason&&(i.stopReason=N(p.finishReason),i.content.some(s=>s.type==="toolCall")&&(i.stopReason="toolUse")),l.usageMetadata&&(i.usage={input:(l.usageMetadata.promptTokenCount||0)-(l.usageMetadata.cachedContentTokenCount||0),output:(l.usageMetadata.candidatesTokenCount||0)+(l.usageMetadata.thoughtsTokenCount||0),cacheRead:l.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:l.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},E(e,i.usage))}if(r&&(r.type==="text"?o.push({type:"text_end",contentIndex:u(),content:r.text,partial:i}):o.push({type:"thinking_end",contentIndex:u(),content:r.thinking,partial:i})),t?.signal?.aborted)throw new Error("Request was aborted");if(i.stopReason==="aborted"||i.stopReason==="error")throw new Error("An unknown error occurred");o.push({type:"done",reason:i.stopReason,message:i}),o.end()}catch(a){_(t?.onProviderError,a,e);for(let c of i.content)"index"in c&&delete c.index;i.stopReason=t?.signal?.aborted?"aborted":"error",i.errorMessage=a instanceof Error?a.message:JSON.stringify(a),o.push({type:"error",reason:i.stopReason,error:i}),o.end()}})(),o},ce=(e,n,t)=>{let o=v(e,t,void 0);if(!t?.reasoning)return C(e,n,{...o,thinking:{enabled:!1}});let i=T(e,t.reasoning),a=i==="off"?"high":i,c=e;return I(c)||U(c)?C(e,n,{...o,thinking:{enabled:!0,level:Y(a,c)}}):C(e,n,{...o,thinking:{enabled:!0,budgetTokens:Z(c,a,t.thinkingBudgets)}})};function W(e,n,t,o){return new m({vertexai:!0,project:n,location:t,apiVersion:P,httpOptions:A(e,o)})}function j(e,n,t){return new m({vertexai:!0,apiKey:n,apiVersion:P,httpOptions:A(e,t)})}function A(e,n){let t={},o=B(e.baseUrl);return o&&(t.baseUrl=o,t.baseUrlResourceScope=w.COLLECTION,J(o)&&(t.apiVersion="")),(e.headers||n)&&(t.headers={...e.headers,...n}),Object.keys(t).length>0?t:void 0}function B(e){let n=e.trim();if(!(!n||n.includes("{location}")))return n}function J(e){try{return new URL(e).pathname.split("/").some(t=>/^v\d+(?:beta\d*)?$/.test(t))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function $(e){let n=e?.apiKey?.trim();if(!(!n||n===V||q(n)))return n}function q(e){return/^<[^>]+>$/.test(e)}function F(e){let n=e?.project||process.env.GOOGLE_CLOUD_PROJECT||process.env.GCLOUD_PROJECT;if(!n)throw new Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return n}function z(e){let n=e?.location||process.env.GOOGLE_CLOUD_LOCATION;if(!n)throw new Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return n}function X(e,n,t={}){let o=R(e,n),i={};t.temperature!==void 0&&(i.temperature=t.temperature),t.maxTokens!==void 0&&(i.maxOutputTokens=t.maxTokens);let a={...Object.keys(i).length>0&&i,...n.systemPrompt&&{systemInstruction:O(n.systemPrompt)},...n.tools&&n.tools.length>0&&{tools:S(n.tools)}};if(n.tools&&n.tools.length>0&&t.toolChoice?a.toolConfig={functionCallingConfig:{mode:G(t.toolChoice)}}:a.toolConfig=void 0,t.thinking?.enabled&&e.reasoning){let g={includeThoughts:!0};t.thinking.level!==void 0?g.thinkingLevel=H[t.thinking.level]:t.thinking.budgetTokens!==void 0&&(g.thinkingBudget=t.thinking.budgetTokens),a.thinkingConfig=g}else e.reasoning&&t.thinking&&!t.thinking.enabled&&(a.thinkingConfig=Q(e));if(t.signal){if(t.signal.aborted)throw new Error("Request aborted");a.abortSignal=t.signal}return{model:e.id,contents:o,config:a}}function I(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function U(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function Q(e){let n=e;return I(n)?{thinkingLevel:d.LOW}:U(n)?{thinkingLevel:d.MINIMAL}:{thinkingBudget:0}}function Y(e,n){if(I(n))switch(e){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}switch(e){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function Z(e,n,t){return t?.[n]!==void 0?t[n]:e.id.includes("2.5-pro")?{minimal:128,low:2048,medium:8192,high:32768}[n]:e.id.includes("2.5-flash")?{minimal:128,low:2048,medium:8192,high:24576}[n]:-1}export{C as streamGoogleVertex,ce as streamSimpleGoogleVertex};
2
+ import{a as d,b as w,c as m,d as M,e as k,f as R,g as S,h as G,i as N}from"./chunk-AMLNR7IO.js";import"./chunk-G3BYCHZS.js";import{d as E,e as T,f as b,h as _,j as v}from"./chunk-UOE7W4PK.js";import{a as O}from"./chunk-WFWSBUYD.js";import"./chunk-CWWDVX6C.js";import"./chunk-D76SO2ME.js";var P="v1",V="gcp-vertex-credentials",H={THINKING_LEVEL_UNSPECIFIED:d.THINKING_LEVEL_UNSPECIFIED,MINIMAL:d.MINIMAL,LOW:d.LOW,MEDIUM:d.MEDIUM,HIGH:d.HIGH},K=0,C=(e,n,t)=>{let o=new b;return(async()=>{let i={role:"assistant",content:[],api:"google-vertex",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let a=$(t),c=a?j(e,a,t?.headers):W(e,F(t),z(t),t?.headers),g=X(e,n,t),y=await t?.onPayload?.(g,e);y!==void 0&&(g=y);let D=await c.models.generateContentStream(g);o.push({type:"start",partial:i});let r=null,x=i.content,u=()=>x.length-1;for await(let l of D){i.responseId||=l.responseId;let p=l.candidates?.[0];if(p?.content?.parts)for(let s of p.content.parts){if(s.text!==void 0){let h=M(s);(!r||h&&r.type!=="thinking"||!h&&r.type!=="text")&&(r&&(r.type==="text"?o.push({type:"text_end",contentIndex:x.length-1,content:r.text,partial:i}):o.push({type:"thinking_end",contentIndex:u(),content:r.thinking,partial:i})),h?(r={type:"thinking",thinking:"",thinkingSignature:void 0},i.content.push(r),o.push({type:"thinking_start",contentIndex:u(),partial:i})):(r={type:"text",text:""},i.content.push(r),o.push({type:"text_start",contentIndex:u(),partial:i}))),r.type==="thinking"?(r.thinking+=s.text,r.thinkingSignature=k(r.thinkingSignature,s.thoughtSignature),o.push({type:"thinking_delta",contentIndex:u(),delta:s.text,partial:i})):(r.text+=s.text,r.textSignature=k(r.textSignature,s.thoughtSignature),o.push({type:"text_delta",contentIndex:u(),delta:s.text,partial:i}))}if(s.functionCall){r&&(r.type==="text"?o.push({type:"text_end",contentIndex:u(),content:r.text,partial:i}):o.push({type:"thinking_end",contentIndex:u(),content:r.thinking,partial:i}),r=null);let h=s.functionCall.id,f={type:"toolCall",id:!h||i.content.some(L=>L.type==="toolCall"&&L.id===h)?`${s.functionCall.name}_${Date.now()}_${++K}`:h,name:s.functionCall.name||"",arguments:s.functionCall.args??{},...s.thoughtSignature&&{thoughtSignature:s.thoughtSignature}};i.content.push(f),o.push({type:"toolcall_start",contentIndex:u(),partial:i}),o.push({type:"toolcall_delta",contentIndex:u(),delta:JSON.stringify(f.arguments),partial:i}),o.push({type:"toolcall_end",contentIndex:u(),toolCall:f,partial:i})}}p?.finishReason&&(i.stopReason=N(p.finishReason),i.content.some(s=>s.type==="toolCall")&&(i.stopReason="toolUse")),l.usageMetadata&&(i.usage={input:(l.usageMetadata.promptTokenCount||0)-(l.usageMetadata.cachedContentTokenCount||0),output:(l.usageMetadata.candidatesTokenCount||0)+(l.usageMetadata.thoughtsTokenCount||0),cacheRead:l.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:l.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},E(e,i.usage))}if(r&&(r.type==="text"?o.push({type:"text_end",contentIndex:u(),content:r.text,partial:i}):o.push({type:"thinking_end",contentIndex:u(),content:r.thinking,partial:i})),t?.signal?.aborted)throw new Error("Request was aborted");if(i.stopReason==="aborted"||i.stopReason==="error")throw new Error("An unknown error occurred");o.push({type:"done",reason:i.stopReason,message:i}),o.end()}catch(a){_(t?.onProviderError,a,e);for(let c of i.content)"index"in c&&delete c.index;i.stopReason=t?.signal?.aborted?"aborted":"error",i.errorMessage=a instanceof Error?a.message:JSON.stringify(a),o.push({type:"error",reason:i.stopReason,error:i}),o.end()}})(),o},ce=(e,n,t)=>{let o=v(e,t,void 0);if(!t?.reasoning)return C(e,n,{...o,thinking:{enabled:!1}});let i=T(e,t.reasoning),a=i==="off"?"high":i,c=e;return I(c)||U(c)?C(e,n,{...o,thinking:{enabled:!0,level:Y(a,c)}}):C(e,n,{...o,thinking:{enabled:!0,budgetTokens:Z(c,a,t.thinkingBudgets)}})};function W(e,n,t,o){return new m({vertexai:!0,project:n,location:t,apiVersion:P,httpOptions:A(e,o)})}function j(e,n,t){return new m({vertexai:!0,apiKey:n,apiVersion:P,httpOptions:A(e,t)})}function A(e,n){let t={},o=B(e.baseUrl);return o&&(t.baseUrl=o,t.baseUrlResourceScope=w.COLLECTION,J(o)&&(t.apiVersion="")),(e.headers||n)&&(t.headers={...e.headers,...n}),Object.keys(t).length>0?t:void 0}function B(e){let n=e.trim();if(!(!n||n.includes("{location}")))return n}function J(e){try{return new URL(e).pathname.split("/").some(t=>/^v\d+(?:beta\d*)?$/.test(t))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function $(e){let n=e?.apiKey?.trim();if(!(!n||n===V||q(n)))return n}function q(e){return/^<[^>]+>$/.test(e)}function F(e){let n=e?.project||process.env.GOOGLE_CLOUD_PROJECT||process.env.GCLOUD_PROJECT;if(!n)throw new Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return n}function z(e){let n=e?.location||process.env.GOOGLE_CLOUD_LOCATION;if(!n)throw new Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return n}function X(e,n,t={}){let o=R(e,n),i={};t.temperature!==void 0&&(i.temperature=t.temperature),t.maxTokens!==void 0&&(i.maxOutputTokens=t.maxTokens);let a={...Object.keys(i).length>0&&i,...n.systemPrompt&&{systemInstruction:O(n.systemPrompt)},...n.tools&&n.tools.length>0&&{tools:S(n.tools)}};if(n.tools&&n.tools.length>0&&t.toolChoice?a.toolConfig={functionCallingConfig:{mode:G(t.toolChoice)}}:a.toolConfig=void 0,t.thinking?.enabled&&e.reasoning){let g={includeThoughts:!0};t.thinking.level!==void 0?g.thinkingLevel=H[t.thinking.level]:t.thinking.budgetTokens!==void 0&&(g.thinkingBudget=t.thinking.budgetTokens),a.thinkingConfig=g}else e.reasoning&&t.thinking&&!t.thinking.enabled&&(a.thinkingConfig=Q(e));if(t.signal){if(t.signal.aborted)throw new Error("Request aborted");a.abortSignal=t.signal}return{model:e.id,contents:o,config:a}}function I(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function U(e){return/gemini-3(?:\.\d+)?-flash/.test(e.id.toLowerCase())}function Q(e){let n=e;return I(n)?{thinkingLevel:d.LOW}:U(n)?{thinkingLevel:d.MINIMAL}:{thinkingBudget:0}}function Y(e,n){if(I(n))switch(e){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}switch(e){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function Z(e,n,t){return t?.[n]!==void 0?t[n]:e.id.includes("2.5-pro")?{minimal:128,low:2048,medium:8192,high:32768}[n]:e.id.includes("2.5-flash")?{minimal:128,low:2048,medium:8192,high:24576}[n]:-1}export{C as streamGoogleVertex,ce as streamSimpleGoogleVertex};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
2
- import{g as a,h as b,i as c,j as d,k as e,l as f,m as g,n as h,o as i,p as j,q as k,r as l,s as m,t as n,u as o,v as p,w as q,x as r}from"./chunk-RDUENEEQ.js";import"./chunk-HQ2U4QVQ.js";import"./chunk-D76SO2ME.js";export{a as MCODE_INTERNAL_NPM_REGISTRY,c as MCODE_PUBLIC_NPM_MIRROR_REGISTRY,b as MCODE_PUBLIC_NPM_REGISTRY,l as bindMcodeNpmCommandToRuntime,j as buildMcodePackageManagerCommand,f as classifyMcodeInstallPath,i as classifyNpmGlobalInstall,m as createMcodeNpmRuntimeEnvironment,e as detectMcodeInstallSource,p as isInternalMcodePackageName,d as isManagedMcodeInstallRoot,q as resolveInstalledMcodePackageVersion,k as resolveLatestMcodeRegistryVersion,h as resolveMcodeNpmDistTag,g as resolveMcodeNpmDistribution,r as resolveMcodeNpmPrefixInstall,o as resolveMcodePackageName,n as runMcodePackageManagerCommand};
2
+ import{A as o,B as p,C as q,D as r,m as a,n as b,o as c,p as d,q as e,r as f,s as g,t as h,u as i,v as j,w as k,x as l,y as m,z as n}from"./chunk-334CV6RF.js";import"./chunk-HQ2U4QVQ.js";import"./chunk-D76SO2ME.js";export{a as MCODE_INTERNAL_NPM_REGISTRY,c as MCODE_PUBLIC_NPM_MIRROR_REGISTRY,b as MCODE_PUBLIC_NPM_REGISTRY,l as bindMcodeNpmCommandToRuntime,j as buildMcodePackageManagerCommand,f as classifyMcodeInstallPath,i as classifyNpmGlobalInstall,m as createMcodeNpmRuntimeEnvironment,e as detectMcodeInstallSource,p as isInternalMcodePackageName,d as isManagedMcodeInstallRoot,q as resolveInstalledMcodePackageVersion,k as resolveLatestMcodeRegistryVersion,h as resolveMcodeNpmDistTag,g as resolveMcodeNpmDistribution,r as resolveMcodeNpmPrefixInstall,o as resolveMcodePackageName,n as runMcodePackageManagerCommand};