dal-code 1.0.53 → 1.0.54
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/CHANGELOG.md +5 -0
- package/dist/bundle/chunks/{anthropic-messages-Y6ZFHUZY.js → anthropic-messages-UHE6F2IE.js} +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-M6NPMDKK.js → azure-openai-responses-EK4W2MKL.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
- package/dist/bundle/chunks/{chunk-6VVU2U7I.js → chunk-2C7JTP5O.js} +1 -1
- package/dist/bundle/chunks/{chunk-BY4XL3JS.js → chunk-33MCYYJ3.js} +1 -1
- package/dist/bundle/chunks/{chunk-GHZXS4EI.js → chunk-356BFRU3.js} +1 -1
- package/dist/bundle/chunks/{chunk-3KP6IUMV.js → chunk-3ZHZINH3.js} +2 -2
- package/dist/bundle/chunks/{chunk-2IIG5FH4.js → chunk-4DMD6C65.js} +1 -1
- package/dist/bundle/chunks/{chunk-6GCEEEP2.js → chunk-B5GJW7C2.js} +1 -1
- package/dist/bundle/chunks/{chunk-EHKSTDLR.js → chunk-CSZTBJOE.js} +1 -1
- package/dist/bundle/chunks/{chunk-XQY5ZHQA.js → chunk-FE533CCR.js} +1 -1
- package/dist/bundle/chunks/{chunk-22WV5HKU.js → chunk-IDZ3QKHZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-FBHNYUW7.js → chunk-K4B5ABCQ.js} +1 -1
- package/dist/bundle/chunks/{chunk-N2RRGQFI.js → chunk-L3RBW36Y.js} +1 -1
- package/dist/bundle/chunks/{chunk-HBTEG3CS.js → chunk-O7G23ELK.js} +1 -1
- package/dist/bundle/chunks/{chunk-YIBYUMGO.js → chunk-R7FBN5UP.js} +2 -2
- package/dist/bundle/chunks/{chunk-YALY2HLR.js → chunk-RKLUP6JT.js} +10 -12
- package/dist/bundle/chunks/{chunk-EGEFD4CT.js → chunk-SCYK4XNE.js} +1 -1
- package/dist/bundle/chunks/{chunk-QYQJQJ5B.js → chunk-VIS5PYQO.js} +1 -1
- package/dist/bundle/chunks/{chunk-YZQKKXBH.js → chunk-XRF4A4KI.js} +1 -1
- package/dist/bundle/chunks/{cli-UYQ4R2DI.js → cli-XOLEGZVC.js} +1 -1
- package/dist/bundle/chunks/{cli-DZWQCYIH.js → cli-YJV3WN2N.js} +1 -1
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-HI7IU5IW.js → cloudflare-workers-ai-system-one-KNGB64NR.js} +1 -1
- package/dist/bundle/chunks/{execute-B5PKAASV.js → execute-6PNQ63VS.js} +1 -1
- package/dist/bundle/chunks/{google-generative-ai-DA5V3QPV.js → google-generative-ai-YJN7TGWU.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-BT23CSDX.js → google-vertex-3BVJFMMZ.js} +1 -1
- package/dist/bundle/chunks/{llama-cpp-classify-T62K6I4H.js → llama-cpp-classify-JVUWNG3E.js} +1 -1
- package/dist/bundle/chunks/{mcp-KRPDZMNU.js → mcp-PC3Y3FBI.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-NAYQLEXL.js → mistral-conversations-O6YIQAS5.js} +1 -1
- package/dist/bundle/chunks/{office-UYJNMMJ5.js → office-AXLGVCMO.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-NN7VPVPU.js → openai-codex-responses-YQ5NNPTG.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-OWUZLSV4.js → openai-completions-R4I3PKBD.js} +1 -1
- package/dist/bundle/chunks/{openai-decisions-RU4UQIAZ.js → openai-decisions-IUHMKKHZ.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-NPZBVAJQ.js → openai-responses-E2PHOQF4.js} +1 -1
- package/dist/bundle/chunks/{openrouter-images-YX7ATNAW.js → openrouter-images-NCMLTKZW.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-IDL3P2ML.js → pi-messages-GLTSGLSO.js} +1 -1
- package/dist/bundle/chunks/{review-34VIXKJ7.js → review-KXWT7T3V.js} +1 -1
- package/dist/bundle/chunks/{router-WVWEQNZR.js → router-26PXJ7YH.js} +1 -1
- package/dist/bundle/chunks/{runtime-WJYFTWKS.js → runtime-LJBCO7CX.js} +1 -1
- package/dist/bundle/chunks/{sdk-BGOXS6X2.js → sdk-6GP346VB.js} +1 -1
- package/dist/bundle/chunks/{sync-D7K3QQKF.js → sync-ONQZCAYG.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-64X2E56P.js → typesafe-system-one-GQFHU7SQ.js} +1 -1
- package/dist/bundle/chunks/{usage-VBIOUGRZ.js → usage-MY7HTXQB.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-JXLCYYRR.js → virtual-modules-BEBLHRXC.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/settings-manager.d.ts +1 -1
- package/dist/core/settings-manager.js +1 -1
- package/dist/core/tools/bash.js +14 -14
- package/dist/core/tools/renderers/bash.js +8 -8
- package/dist/modes/interactive/components/compaction-summary-message.js +1 -3
- package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-compat/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-learn/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +1 -1
- package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-router/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-sync/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-schema/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,11 @@ DAL Code 的发布说明。这里只写用户看得见的变化。
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [1.0.54] - 2026-11-22
|
|
12
|
+
|
|
13
|
+
- 长任务里不再频繁整理上下文:较早对话整理为摘要的频率减半,整理后只显示一行“较早的对话已整理为摘要”,不再显示 token 数。
|
|
14
|
+
- 命令标题后不再显示“(超时 N 秒)”。
|
|
15
|
+
|
|
11
16
|
## [1.0.53] - 2026-11-21
|
|
12
17
|
|
|
13
18
|
- 同一套做法在 3 个会话里重复出现后,DAL 会自动把它整理成技能或补充进已有技能,下次会话起生效,不再需要手动采用。之后会跟踪效果,变差会自动退回;涉及删除、凭据、联网、发布或依赖的改动仍需你确认。
|
package/dist/bundle/chunks/{anthropic-messages-Y6ZFHUZY.js → anthropic-messages-UHE6F2IE.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var oe=Object.defineProperty;var l=(e,r)=>oe(e,"name",{value:r,configurable:!0});import{createRequire as ie}from"node:module";const St=ie(import.meta.url);import{ANTHROPIC_FEDERATION_RULE_ID_ENV as le,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV as ue,ANTHROPIC_ORGANIZATION_ID_ENV as ce,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV as pe,ANTHROPIC_WORKSPACE_ID_ENV as de}from"./chunk-723ZGEZ2.js";import{registerSessionResourceCleanup as W}from"./chunk-ZG74NES2.js";import{applyOpenRouterReportedCost as he,isOpenRouterModel as ge}from"./chunk-P7FPUEYA.js";import{buildCopilotDynamicHeaders as fe,hasCopilotVisionInput as me}from"./chunk-PGXDEOVV.js";import{shortHash as _e}from"./chunk-PJACZCIR.js";import{adjustMaxTokensForThinking as ye,buildBaseOptions as ke,clampMaxTokensToContext as Te,getJsonSchemaToolParameters as ve,prefersJsonSchemaStrictSampling as V,resolveJsonSchemaStrictSampling as xe,splitErrorToolResultImages as Se,transformMessages as z}from"./chunk-
|
|
1
|
+
var oe=Object.defineProperty;var l=(e,r)=>oe(e,"name",{value:r,configurable:!0});import{createRequire as ie}from"node:module";const St=ie(import.meta.url);import{ANTHROPIC_FEDERATION_RULE_ID_ENV as le,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV as ue,ANTHROPIC_ORGANIZATION_ID_ENV as ce,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV as pe,ANTHROPIC_WORKSPACE_ID_ENV as de}from"./chunk-723ZGEZ2.js";import{registerSessionResourceCleanup as W}from"./chunk-ZG74NES2.js";import{applyOpenRouterReportedCost as he,isOpenRouterModel as ge}from"./chunk-P7FPUEYA.js";import{buildCopilotDynamicHeaders as fe,hasCopilotVisionInput as me}from"./chunk-PGXDEOVV.js";import{shortHash as _e}from"./chunk-PJACZCIR.js";import{adjustMaxTokensForThinking as ye,buildBaseOptions as ke,clampMaxTokensToContext as Te,getJsonSchemaToolParameters as ve,prefersJsonSchemaStrictSampling as V,resolveJsonSchemaStrictSampling as xe,splitErrorToolResultImages as Se,transformMessages as z}from"./chunk-FE533CCR.js";import{sanitizeSurrogates as b}from"./chunk-L2ZPNLYD.js";import{retryProviderRequest as be}from"./chunk-ML5DIOWR.js";import{withCauseDetail as Re}from"./chunk-33MCYYJ3.js";import{headersToRecord as Ee}from"./chunk-UTB4DTYQ.js";import{getProviderEnvValue as C}from"./chunk-7DDKXS2Q.js";import{ToolCallArgumentsStream as we,parseJsonWithRepair as Ie}from"./chunk-FFMDRXC4.js";import{calculateCost as G,getCurrentTools as K,getInitialSystemMessage as Ae,resolveTranscript as Ce}from"./chunk-K4B5ABCQ.js";import{AssistantMessageEventStream as Me,appendAssistantMessageDiagnostic as P}from"./chunk-4LDEEFCY.js";import{getIdentityHeaders as B,getSystemMessageText as Oe,renderSystemMessageUpdate as Ne}from"./chunk-SCYK4XNE.js";import{Anthropic as H}from"./chunk-D2WTLI2T.js";import"./chunk-JXWJOIH4.js";var Le=["The compiled grammar is too large","Too many strict tools (","Schemas contains too many parameters with union types ("];function De(e){return Le.some(r=>e.includes(r))}l(De,"isStrictToolLimitErrorMessage");var I=new Set,Pe=1e4;function Be(e){if(e!==void 0&&(I.add(e),I.size>Pe)){let r=I.values().next().value;r!==void 0&&I.delete(r)}}l(Be,"markStrictToolLimitsExceeded");function He(e){return e!==void 0&&I.has(e)}l(He,"hasExceededStrictToolLimits"),W(e=>{e?I.delete(e):I.clear()});function $(e,r){return e||(C("PI_CACHE_RETENTION",r)==="long"?"long":"short")}l($,"resolveCacheRetention");function Ue(e,r,t){let s=$(r,t);if(s==="none")return{retention:s};let i=s==="long"&&M(e).supportsLongCacheRetention?"1h":void 0;return{retention:s,cacheControl:{type:"ephemeral",...i&&{ttl:i}}}}l(Ue,"getCacheControl");function U(e){return{type:"image",source:{type:"base64",media_type:e.mimeType,data:e.data}}}l(U,"convertImageBlock");function Fe(e){if(!e.some(t=>t.type==="image"))return b(e.map(t=>t.text).join(`
|
|
2
2
|
`));let r=e.map(t=>t.type==="text"?{type:"text",text:b(t.text)}:U(t));return r.some(t=>t.type==="text")||r.unshift({type:"text",text:"(see attached image)"}),r}l(Fe,"convertContentBlocks");var qe="fine-grained-tool-streaming-2025-05-14",je="interleaved-thinking-2025-05-14",We="server-side-fallback-2026-07-01",Ve="mid-conversation-output-config-2026-07-01",ze="thinking-binding-controls-2026-08-01",Ge="inline-tools-2026-09-15",Ke="message-threads-2026-08-12",$e={name:"__pi_deferred_placeholder__",description:"Reserved placeholder. Never available. Never call this.",input_schema:{type:"object",properties:{},required:[]},defer_loading:!0};function Je(e){return(e.compat?.allowedFallbackModels?.length??0)>0}l(Je,"shouldUseServerSideFallbackBeta");function M(e){let r=e.provider==="openrouter"||e.baseUrl.includes("openrouter.ai");return{supportsEagerToolInputStreaming:e.compat?.supportsEagerToolInputStreaming??!0,supportsLongCacheRetention:e.compat?.supportsLongCacheRetention??!0,sendSessionAffinityHeaders:e.compat?.sendSessionAffinityHeaders??r,sessionAffinityFormat:e.compat?.sessionAffinityFormat??(r?"openrouter":void 0),supportsCacheControlOnTools:e.compat?.supportsCacheControlOnTools??!0,supportsTemperature:e.compat?.supportsTemperature??!0,allowEmptySignature:e.compat?.allowEmptySignature??!1,supportsStrictTools:e.compat?.supportsStrictTools??!1,supportsMidConvoSystemMessages:e.compat?.supportsMidConvoSystemMessages??!1,supportsMidConvoToolChanges:e.compat?.supportsMidConvoToolChanges??!1,supportsMessageThreads:e.compat?.supportsMessageThreads??(e.provider==="anthropic"&&e.baseUrl.includes("api.anthropic.com"))}}l(M,"getAnthropicCompat");var E=new Map,Xe=1e4,Ye=new Set(["thread_not_found","thread_already_continued","thread_continue_in_flight","thread_fingerprint_mismatch"]);function J(e,r){if(E.delete(e),E.set(e,r),E.size>Xe){let t=E.keys().next().value;t!==void 0&&E.delete(t)}}l(J,"setThreadState"),W(e=>{e?E.delete(e):E.clear()});function X(e,r,t){let{system:s,tools:i,thinking:o,output_config:n,tool_choice:u,betas:g,fallbacks:_}=r,p=JSON.stringify([e.provider,e.baseUrl,r.model,s,i,o,n,u,g,_]),c=JSON.stringify(t,(m,y)=>{if(m!=="cache_control")return m==="content"&&typeof y=="string"?[{type:"text",text:y}]:y});return _e(p+c)}l(X,"hashThreadPrefix");function Y(e,r){return{sessionId:e,body:{...r,thread:{type:"create"}}}}l(Y,"createThreadRequest");function Ze(e,r,t){let s=E.get(r);if(s!=="off"){if(s!==void 0&&t.messages.length>s.prefixCount&&X(e,t,t.messages.slice(0,s.prefixCount))===s.prefixHash){E.delete(r);let{system:i,tools:o,...n}=t;return{body:{...n,messages:t.messages.slice(s.prefixCount),thread:{type:"continue",previous_message_id:s.replyId}},sessionId:r}}return Y(r,t)}}l(Ze,"prepareThreadRequest");function Qe(e){let r=e.error?.error?.details?.error_code;return typeof r=="string"?r:void 0}l(Qe,"getThreadErrorCode");async function et(e,r,t,s,i){try{return{response:await t(e.body),thread:e}}catch(o){if(i?.aborted||!(o instanceof H.APIError))throw o;let n=Qe(o),u=n!==void 0&&Ye.has(n),g=n==="thread_unsupported_request"||n===void 0&&o.status===400&&o.message.includes("thread");if(!u&&!g)throw o;if(P(s,{type:"anthropic_thread_fallback",timestamp:Date.now(),error:{message:o.message},details:{reason:n??String(o.status)}}),u){let p=Y(e.sessionId,r);return{response:await t(p.body),thread:p}}let _=await t(r);return J(e.sessionId,"off"),{response:_,thread:void 0}}}l(et,"sendThreadRequest");function tt(e,r,t,s,i,o){if(s.responseId===void 0||s.responseModel!==void 0)return;let n=re(z([s],e,ne),i,void 0,o).messages.filter(g=>g.role==="assistant"),u=[...t.messages,...n];J(r.sessionId,{prefixCount:u.length,prefixHash:X(e,t,u),replyId:s.responseId})}l(tt,"recordThreadReply");function F(...e){let r={};for(let t of e)t&&Object.assign(r,t);return r}l(F,"mergeHeaders");function q(e,r){if(!e)return!1;let t=r.toLowerCase();for(let[s,i]of Object.entries(e))if(s.toLowerCase()===t&&i!==null&&i.trim().length>0)return!0;return!1}l(q,"hasHeader");function Z(e,r){return!!e||q(r,"authorization")||q(r,"x-api-key")||q(r,"cf-aig-authorization")}l(Z,"hasRequestAuth");function Q(e,r,t){if(!Z(r,t))throw new Error(`No API key for provider: ${e}`)}l(Q,"assertRequestAuth");var O=class extends H{static{l(this,"PiAnthropic")}_shouldResolveDefaultCredentials(){return!1}};function ee(e,r,t,s){if(e.provider!=="anthropic"||Z(r,t))return;let i=C(le,s),o=C(ce,s),n=C(ue,s);if(!(!i||!o||!n))return{organization_id:o,workspace_id:C(de,s),authentication:{type:"oidc_federation",federation_rule_id:i,service_account_id:C(pe,s),identity_token:{source:"file",path:n}}}}l(ee,"getAnthropicFederation");var N,nt=new Set(["message_start","message_delta","message_stop","content_block_start","content_block_delta","content_block_stop"]);function te(e){if(!e.event&&e.data.length===0)return null;let r={event:e.event,data:e.data.join(`
|
|
3
3
|
`),raw:[...e.raw]};return e.event=null,e.data=[],e.raw=[],r}l(te,"flushSseEvent");function j(e,r){if(e==="")return te(r);if(r.raw.push(e),e.startsWith(":"))return null;let t=e.indexOf(":"),s=t===-1?e:e.slice(0,t),i=t===-1?"":e.slice(t+1);return i.startsWith(" ")&&(i=i.slice(1)),s==="event"?r.event=i:s==="data"&&r.data.push(i),null}l(j,"decodeSseLine");function rt(e){let r=e.indexOf("\r"),t=e.indexOf(`
|
|
4
4
|
`);return r===-1?t:t===-1?r:Math.min(r,t)}l(rt,"nextLineBreakIndex");function L(e){let r=rt(e);if(r===-1)return null;let t=r+1;return e[r]==="\r"&&e[t]===`
|
package/dist/bundle/chunks/{azure-openai-responses-M6NPMDKK.js → azure-openai-responses-EK4W2MKL.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
var R=Object.defineProperty;var u=(r,t)=>R(r,"name",{value:t,configurable:!0});import{createRequire as T}from"node:module";const Z=T(import.meta.url);import{convertResponsesMessages as M,convertResponsesTools as A,getResponsesToolSupport as S,processResponsesStream as w}from"./chunk-
|
|
1
|
+
var R=Object.defineProperty;var u=(r,t)=>R(r,"name",{value:t,configurable:!0});import{createRequire as T}from"node:module";const Z=T(import.meta.url);import{convertResponsesMessages as M,convertResponsesTools as A,getResponsesToolSupport as S,processResponsesStream as w}from"./chunk-B5GJW7C2.js";import{resolveAzureConfig as E,resolveDeploymentName as O}from"./chunk-TMTOQ7H7.js";import{clampOpenAIPromptCacheKey as I}from"./chunk-PRRNXB7S.js";import{AzureOpenAI as P}from"./chunk-CF5GWZHW.js";import"./chunk-PJACZCIR.js";import{buildBaseOptions as C,createGrammarToolInputProperties as d,resolveSamplingParams as _}from"./chunk-FE533CCR.js";import"./chunk-L2ZPNLYD.js";import{retryProviderRequest as b}from"./chunk-ML5DIOWR.js";import{formatProviderError as k,normalizeProviderError as x}from"./chunk-33MCYYJ3.js";import{headersToRecord as z}from"./chunk-UTB4DTYQ.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import{clampThinkingLevel as q,getDeclaredTools as h,resolveTranscript as L,resolveTranscriptTools as N}from"./chunk-K4B5ABCQ.js";import{AssistantMessageEventStream as G}from"./chunk-4LDEEFCY.js";import{getIdentityHeaders as K}from"./chunk-SCYK4XNE.js";import"./chunk-JXWJOIH4.js";var D=new Set(["openai","openai-codex","opencode","azure"]),U=16;function j(r){return k(x(r),"Azure OpenAI API error")}u(j,"formatAzureOpenAIError");var v=u((r,t,e)=>{let a=new G,p=L(t,r.compat?.supportsMidConvoSystemMessages);return(async()=>{let n=O(r,e),s={role:"assistant",content:[],api:"azure-openai-responses",provider:r.provider,model:r.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{let i=e?.apiKey;if(!i)throw new Error(`No API key for provider: ${r.provider}`);let l=H(r,i,e),o=d(h(p.messages),r.compat?.supportsOpenAIGrammarTools??!1),m=V(r,p,e,n,o),c=await e?.onPayload?.(m,r);c!==void 0&&(m=c);let g={...e?.signal?{signal:e.signal}:{},...e?.timeoutMs!==void 0?{timeout:e.timeoutMs}:{},maxRetries:0},{data:y,response:f}=await b(()=>l.responses.create(m,g).withResponse(),{maxRetries:e?.maxRetries,maxRetryDelayMs:e?.maxRetryDelayMs,signal:e?.signal});if(await e?.onResponse?.({status:f.status,headers:z(f.headers)},r),a.push({type:"start",partial:s}),await w(y,s,a,r,{onProviderStreamEvent:e?.onProviderStreamEvent,grammarToolInputProperties:o}),e?.signal?.aborted)throw new Error("Request was aborted");if(s.stopReason==="pending")throw new Error("Azure OpenAI Responses stream ended without a stop reason");if(s.stopReason==="aborted"||s.stopReason==="error")throw new Error(s.errorMessage||"An unknown error occurred");a.push({type:"done",reason:s.stopReason,message:s}),a.end()}catch(i){s.stopReason=e?.signal?.aborted?"aborted":"error",s.errorMessage=j(i),a.push({type:"error",reason:s.stopReason,error:s}),a.end()}})(),a},"stream"),B=u((r,t,e)=>{let a=e?.apiKey;if(!a)throw new Error(`No API key for provider: ${r.provider}`);let p={...C(r,t,e,a),toolChoice:e?.toolChoice},n=e?.reasoning?q(r,e.reasoning):void 0;return v(r,t,{...p,reasoningEffort:n==="off"?void 0:n})},"streamSimple");function H(r,t,e){let a={...K(r,e?.identity),...r.headers};e?.headers&&Object.assign(a,e.headers);let{baseUrl:p,apiVersion:n}=E(r,e);return new P({apiKey:t,apiVersion:n,dangerouslyAllowBrowser:!0,fetch:e?.fetch,defaultHeaders:a,baseURL:p})}u(H,"createClient");function V(r,t,e,a,p=d(h(t.messages),r.compat?.supportsOpenAIGrammarTools??!1)){let n=r.compat?.supportsAdditionalTools??!1,s=r.compat?.supportsToolSearch??!1,i=N(t.messages,S({supportsMidConvoSystemMessages:r.compat?.supportsMidConvoSystemMessages??!1,supportsAdditionalTools:n,supportsToolSearch:s})),l=M(r,t,D,{grammarToolInputProperties:p,supportsMidConvoSystemMessages:r.compat?.supportsMidConvoSystemMessages??!1,supportsAdditionalTools:n,supportsToolSearch:s,toolOptions:{supportsStrictMode:r.compat?.supportsStrictMode??!0,supportsOpenAIGrammarTools:r.compat?.supportsOpenAIGrammarTools??!1}}),o={model:a,input:l,stream:!0,prompt_cache_key:r.compat?.promptCacheKeyMode==="disabled"?void 0:I(e?.sessionId),store:!1};e?.maxTokens&&(o.max_output_tokens=Math.max(e.maxTokens,U)),e?.temperature!==void 0&&(o.temperature=e?.temperature),i.requestTools.length>0&&(o.tools=A(i.requestTools,{supportsStrictMode:r.compat?.supportsStrictMode??!0,supportsOpenAIGrammarTools:r.compat?.supportsOpenAIGrammarTools??!1})),e?.toolChoice!==void 0&&(o.tool_choice=e.toolChoice);let m=e?.reasoningEffort??(e?.reasoningSummary?"medium":void 0);if(r.reasoning)if(m){let g=e?.reasoningEffort?r.thinkingLevelMap?.[e.reasoningEffort]??e.reasoningEffort:m;o.reasoning={effort:g,summary:e?.reasoningSummary||"auto"},o.include=["reasoning.encrypted_content"]}else r.thinkingLevelMap?.off!==null&&(o.reasoning={effort:r.thinkingLevelMap?.off??"none"});let c=_(r,m??"off",e?.samplingParams);return c&&Object.assign(o,c),o}u(V,"buildParams");export{v as stream,B as streamSimple};
|
|
@@ -76,7 +76,7 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
|
76
76
|
`);let{connect:d}=await h;if(e.emit("proxyConnect",d),this.emit("proxyConnect",d,e),d.statusCode===200)return e.once("socket",tD),t.secureEndpoint?(ns("Upgrading socket connection to TLS"),Vd.connect({...US(Kd(t),"host","path","port"),socket:n})):n;throw n.destroy(),new Error(`Proxy authentication failed with status ${d.statusCode} after retry`)}};eD.protocols=["http","https"];function tD(e){setImmediate(()=>{e.resume()})}i(tD,"resume");function US(e,...t){let r={},s;for(s in e)t.includes(s)||(r[s]=e[s]);return r}i(US,"omit2");var rD=class{static{i(this,"FifoQueue")}incoming=[];outgoing=[];get length(){return this.incoming.length+this.outgoing.length}enqueue(e){this.incoming.push(e)}dequeue(){if(this.outgoing.length===0)for(;this.incoming.length>0;)this.outgoing.push(this.incoming.pop());return this.outgoing.pop()}},jq=class{static{i(this,"EventStream")}queue=new rD;waiting=new rD;done=!1;finalResultPromise;resolveFinalResult;isComplete;extractResult;constructor(e,t){this.isComplete=e,this.extractResult=t,this.finalResultPromise=new Promise(r=>{this.resolveFinalResult=r})}push(e){if(this.done)return;this.isComplete(e)&&(this.done=!0,this.resolveFinalResult(this.extractResult(e)));let t=this.waiting.dequeue();t?t({value:e,done:!1}):this.queue.enqueue(e)}end(e){for(this.done=!0,e!==void 0&&this.resolveFinalResult(e);this.waiting.length>0;)this.waiting.dequeue()({value:void 0,done:!0})}async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.dequeue();else{if(this.done)return;{let e=await new Promise(t=>this.waiting.enqueue(t));if(e.done)return;yield e.value}}}result(){return this.finalResultPromise}},Gq=class extends jq{static{i(this,"AssistantMessageEventStream")}#t=Date.now();#s=performance.now();#e;constructor(){super(e=>e.type==="done"||e.type==="error",e=>{if(e.type==="done")return e.message;if(e.type==="error")return e.error;throw new Error("Unexpected event type for final result")})}push(e){this.#e===void 0&&(e.type==="text_delta"||e.type==="thinking_delta"||e.type==="toolcall_delta")&&(this.#e=this.#r()),e.type==="done"?this.#i(e.message):e.type==="error"&&this.#i(e.error),super.push(e)}end(e){e!==void 0&&this.#i(e),super.end(e)}#r(){return Math.max(0,Math.round(performance.now()-this.#s))}#i(e){this.done||e.timestamp<this.#t||(this.#e!==void 0&&e.timing?.firstTokenMs===void 0&&(e.timing={...e.timing,firstTokenMs:this.#e}),e.durationMs===void 0&&(e.durationMs=this.#r()))}};function iD(e,t){e.diagnostics=[...e.diagnostics??[],t]}i(iD,"appendAssistantMessageDiagnostic");function sD(e,t=`
|
|
77
77
|
`){return typeof e=="string"?e:e.filter(r=>r.type==="text").map(r=>r.text).join(t)}i(sD,"contentText");function nD(e){let t=[sD(e.content)];for(let r of Object.values(e.sections??{}))r!==null&&t.push(r);return t.filter(r=>r.length>0).join(`
|
|
78
78
|
|
|
79
|
-
`)}i(nD,"getSystemMessageText");function Hq(e,t,r=e.length){return`${e.slice(t,r)} `.slice(0,-1)}i(Hq,"ownedSlice");var zq="1.0.
|
|
79
|
+
`)}i(nD,"getSystemMessageText");function Hq(e,t,r=e.length){return`${e.slice(t,r)} `.slice(0,-1)}i(Hq,"ownedSlice");var zq="1.0.54";function Wq(e){return e?.version??zq}i(Wq,"getClientVersion");function jS(e){return e.role==="system"}i(jS,"isSystemMessage");function oD(e){let t=e[0];return t&&jS(t)?t:void 0}i(oD,"getInitialSystemMessage");function Vq(e){return oD(e)?e.slice(1):e}i(Vq,"withoutInitialSystemMessage");function aD(e){let t=new Map;for(let r of e)if(jS(r)){for(let s of r.toolsRemoved??[])t.delete(s.name);for(let s of r.toolsAdded??[])t.set(s.name,s)}return[...t.values()]}i(aD,"getCurrentTools");function qq(e){let t=[],r=new Map,s;for(let o of e){if(!jS(o))continue;s??=o.timestamp;let a=sD(o.content);a.length>0&&t.push(a);for(let[l,h]of Object.entries(o.sections??{}))h===null?r.delete(l):r.set(l,h)}let n=aD(e);if(!(s===void 0&&n.length===0))return{role:"system",content:t.join(`
|
|
80
80
|
|
|
81
81
|
`),...r.size>0?{sections:Object.fromEntries(r)}:{},...n.length>0?{toolsAdded:n}:{},timestamp:s??0}}i(qq,"getCurrentSystemMessage");function Kq(e){let t=qq(e.messages),r=e.messages.filter(s=>s.role!=="system");return{messages:t?[t,...r]:r}}i(Kq,"collapseSystemMessages");function Jq(e,t){let r=t.input+t.cacheRead+t.cacheWrite,s=e.cost,n=-1;for(let l of e.cost.tiers??[])r>l.inputTokensAbove&&l.inputTokensAbove>n&&(s=l,n=l.inputTokensAbove);let o=t.cacheWrite1h??0,a=t.cacheWrite-o;return t.cost.input=s.input/1e6*t.input,t.cost.output=s.output/1e6*t.output,t.cost.cacheRead=s.cacheRead/1e6*t.cacheRead,t.cost.cacheWrite=(s.cacheWrite*a+s.input*2*o)/1e6,t.cost.total=t.cost.input+t.cost.output+t.cost.cacheRead+t.cost.cacheWrite,t.cost.totalFromProvider=!1,t.cost}i(Jq,"calculateCost");var Yo=["off","minimal","low","medium","high","xhigh","max"];function Xq(e){return e.reasoning?Yo.filter(t=>{let r=e.thinkingLevelMap?.[t];return r===null?!1:t==="xhigh"||t==="max"?r!==void 0:!0}):["off"]}i(Xq,"getSupportedThinkingLevels");function Yq(e,t){let r=Xq(e);if(r.includes(t))return t;let s=Yo.indexOf(t);if(s===-1)return r[0]??"off";for(let n=s;n<Yo.length;n++){let o=Yo[n];if(r.includes(o))return o}for(let n=s-1;n>=0;n--){let o=Yo[n];if(r.includes(o))return o}return r[0]??"off"}i(Yq,"clampThinkingLevel");var Qq=4e3;function Zq(e){if(!(e instanceof Error))return{message:GS(e),messageCarriesBody:!1};let t=e,r=r9(t),s=i9(t),n=s===void 0||e.message.includes(s),o=r===void 0&&s===void 0?t9(e):e.message;return{status:r,body:s,message:o,messageCarriesBody:n}}i(Zq,"normalizeProviderError");var e9=5;function t9(e){let t,r=e.cause;for(let o=0;o<e9&&r instanceof Error;o++)t=r,r=r.cause;if(!t)return e.message;let s=(t.message||t.name).trim(),n=t.code;return(typeof n=="string"||typeof n=="number")&&!s.includes(String(n))&&(s=s?`${s} (${n})`:String(n)),!s||e.message.includes(s)?e.message:e.message?`${e.message}: ${s}`:s}i(t9,"withCauseDetail");function r9(e){if(typeof e.statusCode=="number")return e.statusCode;if(typeof e.status=="number")return e.status;if(typeof e.$metadata?.httpStatusCode=="number")return e.$metadata.httpStatusCode;if(typeof e.$response?.statusCode=="number")return e.$response.statusCode}i(r9,"extractStatus");function i9(e){let t=s9(e);if(t===void 0)return;let r=t.trim();if(r.length!==0)return o9(r,Qq)}i(i9,"extractBody");function s9(e){if(typeof e.body=="string")return e.body;if(lD(e.error))return GS(e.error);let t=e.$response?.body;if(typeof t=="string")return t;if(!n9(t)&&lD(t))return GS(t)}i(s9,"pickBodyText");function n9(e){return typeof e=="object"&&e!==null&&"pipe"in e&&typeof e.pipe=="function"}i(n9,"isReadableStreamLike");function lD(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t!==Object.prototype&&t!==null?!1:Object.keys(e).length>0}i(lD,"isPlainNonEmptyObject");function o9(e,t){return e.length<=t?e:`${Hq(e,0,t)}... [truncated ${e.length-t} chars]`}i(o9,"truncateErrorText");function GS(e){try{let t=JSON.stringify(e);return t===void 0?String(e):t}catch{return String(e)}}i(GS,"safeJsonStringify");function a9(...e){let t=new Map;for(let r of e)for(let[s,n]of Object.entries(r??{})){let o=s.toLowerCase();t.delete(o),n!==null&&t.set(o,[s,n])}return t.size>0?Object.fromEntries(t.values()):void 0}i(a9,"providerHeadersToRecord");var Jd=null;function l9(e){if(!(typeof process>"u"||!process.versions?.bun||Object.keys(process.env).length>0)){if(Jd===null){Jd=new Map;try{let{readFileSync:t}=je("node:fs"),r=t("/proc/self/environ","utf-8");for(let s of r.split("\0")){let n=s.indexOf("=");n>0&&Jd.set(s.slice(0,n),s.slice(n+1))}}catch{}}return Jd.get(e)}}i(l9,"getBunSandboxEnvValue");function Rt(e,t){return t?.[e]||(typeof process<"u"?process.env[e]:void 0)||l9(e)||void 0}i(Rt,"getProviderEnvValue");var d9={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function HS(e,t){let r=e.toLowerCase(),s=e.toUpperCase();return t?.[r]||t?.[s]||Rt(r)||Rt(s)||""}i(HS,"getProxyEnv");function c9(e){if(e instanceof URL)return e;try{return new URL(e)}catch{return}}i(c9,"parseProxyTargetUrl");function zS(e){return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e}i(zS,"stripBrackets");function u9(e){let t=e.trim().toLowerCase();if(!t)return;if(t.startsWith("[")){let s=t.indexOf("]");if(s!==-1){let n=t.slice(1,s),o=t.slice(s+1);if(o.startsWith(":")){let a=Number.parseInt(o.slice(1),10);return{host:n,port:Number.isNaN(a)?0:a}}return{host:n,port:0}}}if(t.includes(":")&&t.split(":").length>2)return{host:t,port:0};let r=t.lastIndexOf(":");if(r!==-1&&r===t.indexOf(":")){let s=t.slice(0,r),n=Number.parseInt(t.slice(r+1),10);if(!Number.isNaN(n))return{host:s,port:n}}return{host:t,port:0}}i(u9,"parseNoProxyEntry");function h9(e,t,r){let s=HS("no_proxy",r).toLowerCase();if(!s)return!0;if(s==="*")return!1;let n=zS(e.toLowerCase());return s.split(/[,\s]/).every(o=>{let a=u9(o);if(!a||a.port&&a.port!==t)return!0;let l=zS(a.host);return l.startsWith("*.")?l=l.slice(2):(l.startsWith(".")||l.startsWith("*"))&&(l=l.slice(1)),l?!(n===l||n.endsWith(`.${l}`)):!0})}i(h9,"shouldProxyHostname");function m9(e,t){let r=c9(e);if(!r?.protocol||!r.host)return"";let s=r.protocol.split(":",1)[0],n=zS(r.hostname||r.host.replace(/:\d*$/,"")),o=Number.parseInt(r.port,10)||d9[s]||0;if(!h9(n,o,t))return"";let a=HS(`${s}_proxy`,t)||HS("all_proxy",t);return a&&!a.includes("://")&&(a=`${s}://${a}`),a}i(m9,"getProxyForUrl");var f9="Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";function p9(e,t){let r=m9(e,t);if(!r)return;let s;try{s=new URL(r)}catch(n){throw new Error(`Invalid proxy URL ${JSON.stringify(r)}: ${n instanceof Error?n.message:String(n)}`)}if(s.protocol!=="http:"&&s.protocol!=="https:")throw new Error(`${f9} Got ${s.protocol}`);return s}i(p9,"resolveHttpProxyUrlForTarget");function WS(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}i(WS,"sanitizeSurrogates");var L7=ve(Cq(),1),g9=new Set(['"',"\\","/","b","f","n","r","t"]);function y9(e){let t=e.codePointAt(0);return t!==void 0&&t>=0&&t<=31}i(y9,"isControlCharacter");function S9(e){switch(e){case"\b":return"\\b";case"\f":return"\\f";case`
|
|
82
82
|
`:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return`\\u${e.codePointAt(0)?.toString(16).padStart(4,"0")??"0000"}`}}i(S9,"escapeControlCharacter");function _9(e){let t="",r=!1;for(let s=0;s<e.length;s++){let n=e[s];if(!r){t+=n,n==='"'&&(r=!0);continue}if(n==='"'){t+=n,r=!1;continue}if(n==="\\"){let o=e[s+1];if(o===void 0){t+="\\\\";continue}if(o==="u"){let a=e.slice(s+2,s+6);if(/^[0-9a-fA-F]{4}$/.test(a)){t+=`\\u${a}`,s+=5;continue}}if(g9.has(o)){t+=`\\${o}`,s+=1;continue}t+="\\\\";continue}t+=y9(n)?S9(n):n}return t}i(_9,"repairJson");function E9(e){try{return JSON.parse(e)}catch(t){let r=_9(e);if(r!==e)return JSON.parse(r);throw t}}i(E9,"parseJsonWithRepair");function w9(e){if(!e?.trim())return{arguments:{}};try{let t=E9(e);if(typeof t!="object"||t===null||Array.isArray(t))throw new Error("Tool arguments must be a JSON object");return{arguments:t}}catch(t){return{arguments:{},argumentsError:`${t instanceof Error?t.message:String(t)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Ha=Object.defineProperty;var p=(e,t)=>Ha(e,"name",{value:t,configurable:!0});import{createRequire as Va}from"node:module";const Fy=Va(import.meta.url);import{require_safe_buffer as Bt}from"./chunk-567OJLS7.js";import{getJsonSchemaToolParameters as $a,resolveJsonSchemaStrictSampling as tn,transformMessages as Ja}from"./chunk-XQY5ZHQA.js";import{sanitizeSurrogates as St}from"./chunk-L2ZPNLYD.js";import{retryProviderRequest as Wa}from"./chunk-ML5DIOWR.js";import{clampThinkingLevel as Xa,collapseSystemMessages as Ka,withoutInitialSystemMessage as Ya}from"./chunk-FBHNYUW7.js";import{__commonJS as z,__require as te,__toESM as ze}from"./chunk-JXWJOIH4.js";var za=z({"node_modules/retry/lib/retry_operation.js"(e,t){function r(n,i){typeof i=="boolean"&&(i={forever:i}),this._originalTimeouts=JSON.parse(JSON.stringify(n)),this._timeouts=n,this._options=i||{},this._maxRetryTime=i&&i.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}p(r,"RetryOperation"),t.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(n){if(this._timeout&&clearTimeout(this._timeout),!n)return!1;var i=new Date().getTime();if(n&&i-this._operationStart>=this._maxRetryTime)return this._errors.push(n),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(n);var o=this._timeouts.shift();if(o===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),o=this._cachedTimeouts.slice(-1);else return!1;var a=this;return this._timer=setTimeout(function(){a._attempts++,a._operationTimeoutCb&&(a._timeout=setTimeout(function(){a._operationTimeoutCb(a._attempts)},a._operationTimeout),a._options.unref&&a._timeout.unref()),a._fn(a._attempts)},o),this._options.unref&&this._timer.unref(),!0},r.prototype.attempt=function(n,i){this._fn=n,i&&(i.timeout&&(this._operationTimeout=i.timeout),i.cb&&(this._operationTimeoutCb=i.cb));var o=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){o._operationTimeoutCb()},o._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},r.prototype.try=function(n){console.log("Using RetryOperation.try() is deprecated"),this.attempt(n)},r.prototype.start=function(n){console.log("Using RetryOperation.start() is deprecated"),this.attempt(n)},r.prototype.start=r.prototype.try,r.prototype.errors=function(){return this._errors},r.prototype.attempts=function(){return this._attempts},r.prototype.mainError=function(){if(this._errors.length===0)return null;for(var n={},i=null,o=0,a=0;a<this._errors.length;a++){var c=this._errors[a],u=c.message,d=(n[u]||0)+1;n[u]=d,d>=o&&(i=c,o=d)}return i}}}),Qa=z({"node_modules/retry/lib/retry.js"(e){var t=za();e.operation=function(r){var n=e.timeouts(r);return new t(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},e.timeouts=function(r){if(r instanceof Array)return[].concat(r);var n={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var i in r)n[i]=r[i];if(n.minTimeout>n.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],a=0;a<n.retries;a++)o.push(this.createTimeout(a,n));return r&&r.forever&&!o.length&&o.push(this.createTimeout(a,n)),o.sort(function(c,u){return c-u}),o},e.createTimeout=function(r,n){var i=n.randomize?Math.random()+1:1,o=Math.round(i*Math.max(n.minTimeout,1)*Math.pow(n.factor,r));return o=Math.min(o,n.maxTimeout),o},e.wrap=function(r,n,i){if(n instanceof Array&&(i=n,n=null),!i){i=[];for(var o in r)typeof r[o]=="function"&&i.push(o)}for(var a=0;a<i.length;a++){var c=i[a],u=r[c];r[c]=function(d){var h=e.operation(n),m=Array.prototype.slice.call(arguments,1),g=m.pop();m.push(function(_){h.retry(_)||(_&&(arguments[0]=h.mainError()),g.apply(this,arguments))}),h.attempt(function(){d.apply(r,m)})}.bind(r,u),r[c].options=n}}}}),Za=z({"node_modules/retry/index.js"(e,t){t.exports=Qa()}}),ja=z({"node_modules/p-retry/index.js"(e,t){"use strict";var r=Za(),n=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],i=class extends Error{static{p(this,"AbortError")}constructor(u){super(),u instanceof Error?(this.originalError=u,{message:u}=u):(this.originalError=new Error(u),this.originalError.stack=this.stack),this.name="AbortError",this.message=u}},o=p((u,d,h)=>{let m=h.retries-(d-1);return u.attemptNumber=d,u.retriesLeft=m,u},"decorateErrorWithCounts"),a=p(u=>n.includes(u),"isNetworkError"),c=p((u,d)=>new Promise((h,m)=>{d={onFailedAttempt:p(()=>{},"onFailedAttempt"),retries:10,...d};let g=r.operation(d);g.attempt(async _=>{try{h(await u(_))}catch(f){if(!(f instanceof Error)){m(new TypeError(`Non-error was thrown: "${f}". You should only throw errors.`));return}if(f instanceof i)g.stop(),m(f.originalError);else if(f instanceof TypeError&&!a(f.message))g.stop(),m(f);else{o(f,_,d);try{await d.onFailedAttempt(f)}catch(y){m(y);return}g.retry(f)||m(g.mainError())}}})}),"pRetry2");t.exports=c,t.exports.default=c,t.exports.AbortError=i}}),rn=z({"node_modules/extend/index.js"(e,t){"use strict";var r=Object.prototype.hasOwnProperty,n=Object.prototype.toString,i=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=p(function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},"isArray"),c=p(function(h){if(!h||n.call(h)!=="[object Object]")return!1;var m=r.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&r.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!g)return!1;var _;for(_ in h);return typeof _>"u"||r.call(h,_)},"isPlainObject2"),u=p(function(h,m){i&&m.name==="__proto__"?i(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},"setProperty"),d=p(function(h,m){if(m==="__proto__")if(r.call(h,m)){if(o)return o(h,m).value}else return;return h[m]},"getProperty");t.exports=p(function h(){var m,g,_,f,y,E,C=arguments[0],S=1,A=arguments.length,v=!1;for(typeof C=="boolean"&&(v=C,C=arguments[1]||{},S=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});S<A;++S)if(m=arguments[S],m!=null)for(g in m)_=d(C,g),f=d(m,g),C!==f&&(v&&f&&(c(f)||(y=a(f)))?(y?(y=!1,E=_&&a(_)?_:[]):E=_&&c(_)?_:{},u(C,{name:g,newValue:h(v,E,f)})):typeof f<"u"&&u(C,{name:g,newValue:f}));return C},"extend")}}),el=z({"node_modules/gaxios/package.json"(e,t){t.exports={name:"gaxios",version:"7.1.4",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^22.13.1","@types/sinon":"^17.0.3","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",linkinator:"^6.1.2",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}}}),tl=z({"node_modules/gaxios/build/cjs/src/util.cjs"(e,t){"use strict";var r=el();t.exports={pkg:r}}}),nn=z({"node_modules/gaxios/build/cjs/src/common.js"(e){"use strict";var t=e&&e.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(e,"__esModule",{value:!0}),e.GaxiosError=e.GAXIOS_ERROR_SYMBOL=void 0,e.defaultErrorRedactor=c;var r=t(rn()),n=t(tl()),i=n.default.pkg;e.GAXIOS_ERROR_SYMBOL=Symbol.for(`${i.name}-gaxios-error`);var o=class wa extends Error{static{p(this,"_GaxiosError")}config;response;code;status;error;[e.GAXIOS_ERROR_SYMBOL]=i.version;static[Symbol.hasInstance](d){return d&&typeof d=="object"&&e.GAXIOS_ERROR_SYMBOL in d&&d[e.GAXIOS_ERROR_SYMBOL]===i.version?!0:Function.prototype[Symbol.hasInstance].call(wa,d)}constructor(d,h,m,g){if(super(d,{cause:g}),this.config=h,this.response=m,this.error=g instanceof Error?g:void 0,this.config=(0,r.default)(!0,{},h),this.response&&(this.response.config=(0,r.default)(!0,{},this.response.config)),this.response){try{this.response.data=a(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}g instanceof DOMException?this.code=g.name:g&&typeof g=="object"&&"code"in g&&(typeof g.code=="string"||typeof g.code=="number")&&(this.code=g.code)}static extractAPIErrorFromResponse(d,h="The request failed"){let m=h;if(typeof d.data=="string"&&(m=d.data),d.data&&typeof d.data=="object"&&"error"in d.data&&d.data.error&&!d.ok){if(typeof d.data.error=="string")return{message:d.data.error,code:d.status,status:d.statusText};if(typeof d.data.error=="object"){m="message"in d.data.error&&typeof d.data.error.message=="string"?d.data.error.message:m;let g="status"in d.data.error&&typeof d.data.error.status=="string"?d.data.error.status:d.statusText,_="code"in d.data.error&&typeof d.data.error.code=="number"?d.data.error.code:d.status;if("errors"in d.data.error&&Array.isArray(d.data.error.errors)){let f=[];for(let y of d.data.error.errors)typeof y=="object"&&"message"in y&&typeof y.message=="string"&&f.push(y.message);return Object.assign({message:f.join(`
|
|
1
|
+
var Ha=Object.defineProperty;var p=(e,t)=>Ha(e,"name",{value:t,configurable:!0});import{createRequire as Va}from"node:module";const Fy=Va(import.meta.url);import{require_safe_buffer as Bt}from"./chunk-567OJLS7.js";import{getJsonSchemaToolParameters as $a,resolveJsonSchemaStrictSampling as tn,transformMessages as Ja}from"./chunk-FE533CCR.js";import{sanitizeSurrogates as St}from"./chunk-L2ZPNLYD.js";import{retryProviderRequest as Wa}from"./chunk-ML5DIOWR.js";import{clampThinkingLevel as Xa,collapseSystemMessages as Ka,withoutInitialSystemMessage as Ya}from"./chunk-K4B5ABCQ.js";import{__commonJS as z,__require as te,__toESM as ze}from"./chunk-JXWJOIH4.js";var za=z({"node_modules/retry/lib/retry_operation.js"(e,t){function r(n,i){typeof i=="boolean"&&(i={forever:i}),this._originalTimeouts=JSON.parse(JSON.stringify(n)),this._timeouts=n,this._options=i||{},this._maxRetryTime=i&&i.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}p(r,"RetryOperation"),t.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(n){if(this._timeout&&clearTimeout(this._timeout),!n)return!1;var i=new Date().getTime();if(n&&i-this._operationStart>=this._maxRetryTime)return this._errors.push(n),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(n);var o=this._timeouts.shift();if(o===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),o=this._cachedTimeouts.slice(-1);else return!1;var a=this;return this._timer=setTimeout(function(){a._attempts++,a._operationTimeoutCb&&(a._timeout=setTimeout(function(){a._operationTimeoutCb(a._attempts)},a._operationTimeout),a._options.unref&&a._timeout.unref()),a._fn(a._attempts)},o),this._options.unref&&this._timer.unref(),!0},r.prototype.attempt=function(n,i){this._fn=n,i&&(i.timeout&&(this._operationTimeout=i.timeout),i.cb&&(this._operationTimeoutCb=i.cb));var o=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){o._operationTimeoutCb()},o._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},r.prototype.try=function(n){console.log("Using RetryOperation.try() is deprecated"),this.attempt(n)},r.prototype.start=function(n){console.log("Using RetryOperation.start() is deprecated"),this.attempt(n)},r.prototype.start=r.prototype.try,r.prototype.errors=function(){return this._errors},r.prototype.attempts=function(){return this._attempts},r.prototype.mainError=function(){if(this._errors.length===0)return null;for(var n={},i=null,o=0,a=0;a<this._errors.length;a++){var c=this._errors[a],u=c.message,d=(n[u]||0)+1;n[u]=d,d>=o&&(i=c,o=d)}return i}}}),Qa=z({"node_modules/retry/lib/retry.js"(e){var t=za();e.operation=function(r){var n=e.timeouts(r);return new t(n,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},e.timeouts=function(r){if(r instanceof Array)return[].concat(r);var n={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var i in r)n[i]=r[i];if(n.minTimeout>n.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],a=0;a<n.retries;a++)o.push(this.createTimeout(a,n));return r&&r.forever&&!o.length&&o.push(this.createTimeout(a,n)),o.sort(function(c,u){return c-u}),o},e.createTimeout=function(r,n){var i=n.randomize?Math.random()+1:1,o=Math.round(i*Math.max(n.minTimeout,1)*Math.pow(n.factor,r));return o=Math.min(o,n.maxTimeout),o},e.wrap=function(r,n,i){if(n instanceof Array&&(i=n,n=null),!i){i=[];for(var o in r)typeof r[o]=="function"&&i.push(o)}for(var a=0;a<i.length;a++){var c=i[a],u=r[c];r[c]=function(d){var h=e.operation(n),m=Array.prototype.slice.call(arguments,1),g=m.pop();m.push(function(_){h.retry(_)||(_&&(arguments[0]=h.mainError()),g.apply(this,arguments))}),h.attempt(function(){d.apply(r,m)})}.bind(r,u),r[c].options=n}}}}),Za=z({"node_modules/retry/index.js"(e,t){t.exports=Qa()}}),ja=z({"node_modules/p-retry/index.js"(e,t){"use strict";var r=Za(),n=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],i=class extends Error{static{p(this,"AbortError")}constructor(u){super(),u instanceof Error?(this.originalError=u,{message:u}=u):(this.originalError=new Error(u),this.originalError.stack=this.stack),this.name="AbortError",this.message=u}},o=p((u,d,h)=>{let m=h.retries-(d-1);return u.attemptNumber=d,u.retriesLeft=m,u},"decorateErrorWithCounts"),a=p(u=>n.includes(u),"isNetworkError"),c=p((u,d)=>new Promise((h,m)=>{d={onFailedAttempt:p(()=>{},"onFailedAttempt"),retries:10,...d};let g=r.operation(d);g.attempt(async _=>{try{h(await u(_))}catch(f){if(!(f instanceof Error)){m(new TypeError(`Non-error was thrown: "${f}". You should only throw errors.`));return}if(f instanceof i)g.stop(),m(f.originalError);else if(f instanceof TypeError&&!a(f.message))g.stop(),m(f);else{o(f,_,d);try{await d.onFailedAttempt(f)}catch(y){m(y);return}g.retry(f)||m(g.mainError())}}})}),"pRetry2");t.exports=c,t.exports.default=c,t.exports.AbortError=i}}),rn=z({"node_modules/extend/index.js"(e,t){"use strict";var r=Object.prototype.hasOwnProperty,n=Object.prototype.toString,i=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=p(function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},"isArray"),c=p(function(h){if(!h||n.call(h)!=="[object Object]")return!1;var m=r.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&r.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!g)return!1;var _;for(_ in h);return typeof _>"u"||r.call(h,_)},"isPlainObject2"),u=p(function(h,m){i&&m.name==="__proto__"?i(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},"setProperty"),d=p(function(h,m){if(m==="__proto__")if(r.call(h,m)){if(o)return o(h,m).value}else return;return h[m]},"getProperty");t.exports=p(function h(){var m,g,_,f,y,E,C=arguments[0],S=1,A=arguments.length,v=!1;for(typeof C=="boolean"&&(v=C,C=arguments[1]||{},S=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});S<A;++S)if(m=arguments[S],m!=null)for(g in m)_=d(C,g),f=d(m,g),C!==f&&(v&&f&&(c(f)||(y=a(f)))?(y?(y=!1,E=_&&a(_)?_:[]):E=_&&c(_)?_:{},u(C,{name:g,newValue:h(v,E,f)})):typeof f<"u"&&u(C,{name:g,newValue:f}));return C},"extend")}}),el=z({"node_modules/gaxios/package.json"(e,t){t.exports={name:"gaxios",version:"7.1.4",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^22.13.1","@types/sinon":"^17.0.3","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",linkinator:"^6.1.2",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}}}),tl=z({"node_modules/gaxios/build/cjs/src/util.cjs"(e,t){"use strict";var r=el();t.exports={pkg:r}}}),nn=z({"node_modules/gaxios/build/cjs/src/common.js"(e){"use strict";var t=e&&e.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(e,"__esModule",{value:!0}),e.GaxiosError=e.GAXIOS_ERROR_SYMBOL=void 0,e.defaultErrorRedactor=c;var r=t(rn()),n=t(tl()),i=n.default.pkg;e.GAXIOS_ERROR_SYMBOL=Symbol.for(`${i.name}-gaxios-error`);var o=class wa extends Error{static{p(this,"_GaxiosError")}config;response;code;status;error;[e.GAXIOS_ERROR_SYMBOL]=i.version;static[Symbol.hasInstance](d){return d&&typeof d=="object"&&e.GAXIOS_ERROR_SYMBOL in d&&d[e.GAXIOS_ERROR_SYMBOL]===i.version?!0:Function.prototype[Symbol.hasInstance].call(wa,d)}constructor(d,h,m,g){if(super(d,{cause:g}),this.config=h,this.response=m,this.error=g instanceof Error?g:void 0,this.config=(0,r.default)(!0,{},h),this.response&&(this.response.config=(0,r.default)(!0,{},this.response.config)),this.response){try{this.response.data=a(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}g instanceof DOMException?this.code=g.name:g&&typeof g=="object"&&"code"in g&&(typeof g.code=="string"||typeof g.code=="number")&&(this.code=g.code)}static extractAPIErrorFromResponse(d,h="The request failed"){let m=h;if(typeof d.data=="string"&&(m=d.data),d.data&&typeof d.data=="object"&&"error"in d.data&&d.data.error&&!d.ok){if(typeof d.data.error=="string")return{message:d.data.error,code:d.status,status:d.statusText};if(typeof d.data.error=="object"){m="message"in d.data.error&&typeof d.data.error.message=="string"?d.data.error.message:m;let g="status"in d.data.error&&typeof d.data.error.status=="string"?d.data.error.status:d.statusText,_="code"in d.data.error&&typeof d.data.error.code=="number"?d.data.error.code:d.status;if("errors"in d.data.error&&Array.isArray(d.data.error.errors)){let f=[];for(let y of d.data.error.errors)typeof y=="object"&&"message"in y&&typeof y.message=="string"&&f.push(y.message);return Object.assign({message:f.join(`
|
|
2
2
|
`)||m,code:_,status:g},d.data.error)}return Object.assign({message:m,code:_,status:g},d.data.error)}}return{message:m,code:d.status,status:d.statusText}}};e.GaxiosError=o;function a(u,d){switch(u){case"stream":return d;case"json":return JSON.parse(JSON.stringify(d));case"arraybuffer":return JSON.parse(Buffer.from(d).toString("utf8"));case"blob":return JSON.parse(d.text());default:return d}}p(a,"translateData");function c(u){let d="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";function h(_){_&&_.forEach((f,y)=>{(/^authentication$/i.test(y)||/^authorization$/i.test(y)||/secret/i.test(y))&&_.set(y,d)})}p(h,"redactHeaders");function m(_,f){if(typeof _=="object"&&_!==null&&typeof _[f]=="string"){let y=_[f];(/grant_type=/i.test(y)||/assertion=/i.test(y)||/secret/i.test(y))&&(_[f]=d)}}p(m,"redactString");function g(_){!_||typeof _!="object"||(_ instanceof FormData||_ instanceof URLSearchParams||"forEach"in _&&"set"in _?_.forEach((f,y)=>{(["grant_type","assertion"].includes(y)||/secret/.test(y))&&_.set(y,d)}):("grant_type"in _&&(_.grant_type=d),"assertion"in _&&(_.assertion=d),"client_secret"in _&&(_.client_secret=d)))}return p(g,"redactObject"),u.config&&(h(u.config.headers),m(u.config,"data"),g(u.config.data),m(u.config,"body"),g(u.config.body),u.config.url.searchParams.has("token")&&u.config.url.searchParams.set("token",d),u.config.url.searchParams.has("client_secret")&&u.config.url.searchParams.set("client_secret",d)),u.response&&(c({config:u.response.config}),h(u.response.headers),u.response.bodyUsed&&(m(u.response,"data"),g(u.response.data))),u}p(c,"defaultErrorRedactor")}}),rl=z({"node_modules/gaxios/build/cjs/src/retry.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getRetryConfig=t;async function t(o){let a=n(o);if(!o||!o.config||!a&&!o.config.retry)return{shouldRetry:!1};a=a||{},a.currentRetryAttempt=a.currentRetryAttempt||0,a.retry=a.retry===void 0||a.retry===null?3:a.retry,a.httpMethodsToRetry=a.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],a.noResponseRetries=a.noResponseRetries===void 0||a.noResponseRetries===null?2:a.noResponseRetries,a.retryDelayMultiplier=a.retryDelayMultiplier?a.retryDelayMultiplier:2,a.timeOfFirstRequest=a.timeOfFirstRequest?a.timeOfFirstRequest:Date.now(),a.totalTimeout=a.totalTimeout?a.totalTimeout:Number.MAX_SAFE_INTEGER,a.maxRetryDelay=a.maxRetryDelay?a.maxRetryDelay:Number.MAX_SAFE_INTEGER;let c=[[100,199],[408,408],[429,429],[500,599]];if(a.statusCodesToRetry=a.statusCodesToRetry||c,o.config.retryConfig=a,!await(a.shouldRetry||r)(o))return{shouldRetry:!1,config:o.config};let u=i(a);o.config.retryConfig.currentRetryAttempt+=1;let d=a.retryBackoff?a.retryBackoff(o,u):new Promise(h=>{setTimeout(h,u)});return a.onRetryAttempt&&await a.onRetryAttempt(o),await d,{shouldRetry:!0,config:o.config}}p(t,"getRetryConfig");function r(o){let a=n(o);if(o.config.signal?.aborted&&o.code!=="TimeoutError"||o.code==="AbortError"||!a||a.retry===0||!o.response&&(a.currentRetryAttempt||0)>=a.noResponseRetries||!a.httpMethodsToRetry||!a.httpMethodsToRetry.includes(o.config.method?.toUpperCase()||"GET"))return!1;if(o.response&&o.response.status){let c=!1;for(let[u,d]of a.statusCodesToRetry){let h=o.response.status;if(h>=u&&h<=d){c=!0;break}}if(!c)return!1}return a.currentRetryAttempt=a.currentRetryAttempt||0,!(a.currentRetryAttempt>=a.retry)}p(r,"shouldRetryRequest");function n(o){if(o&&o.config&&o.config.retryConfig)return o.config.retryConfig}p(n,"getConfig");function i(o){let a=(o.currentRetryAttempt?0:o.retryDelay??100)+(Math.pow(o.retryDelayMultiplier,o.currentRetryAttempt)-1)/2*1e3,c=o.totalTimeout-(Date.now()-o.timeOfFirstRequest);return Math.min(a,c,o.maxRetryDelay)}p(i,"getNextRetryDelay")}}),on=z({"node_modules/gaxios/build/cjs/src/interceptor.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GaxiosInterceptorManager=void 0;var t=class extends Set{static{p(this,"GaxiosInterceptorManager")}};e.GaxiosInterceptorManager=t}}),nl=z({"node_modules/gaxios/build/cjs/src/gaxios.js"(e){"use strict";var t=e&&e.__importDefault||function(g){return g&&g.__esModule?g:{default:g}},r;Object.defineProperty(e,"__esModule",{value:!0}),e.Gaxios=void 0;var n=t(rn()),i=te("https"),o=nn(),a=rl(),c=te("stream"),u=on(),d=p(async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID(),"randomUUID"),h=204,m=class{static{p(this,"Gaxios")}agentCache=new Map;defaults;interceptors;constructor(g){this.defaults=g||{},this.interceptors={request:new u.GaxiosInterceptorManager,response:new u.GaxiosInterceptorManager}}fetch(...g){let _=g[0],f=g[1],y,E=new Headers;return typeof _=="string"?y=new URL(_):_ instanceof URL?y=_:_&&_.url&&(y=new URL(_.url)),_&&typeof _=="object"&&"headers"in _&&r.mergeHeaders(E,_.headers),f&&r.mergeHeaders(E,new Headers(f.headers)),typeof _=="object"&&!(_ instanceof URL)?this.request({...f,..._,headers:E,url:y}):this.request({...f,headers:E,url:y})}async request(g={}){let _=await this.#n(g);return _=await this.#t(_),this.#r(this._request(_))}async _defaultAdapter(g){let _=g.fetchImplementation||this.defaults.fetchImplementation||await r.#l(),f={...g};delete f.data;let y=await _(g.url,f),E=await this.getResponseData(g,y);return Object.getOwnPropertyDescriptor(y,"data")?.configurable||Object.defineProperties(y,{data:{configurable:!0,writable:!0,enumerable:!0,value:E}}),Object.assign(y,{config:g,data:E})}async _request(g){try{let _;if(g.adapter?_=await g.adapter(g,this._defaultAdapter.bind(this)):_=await this._defaultAdapter(g),!g.validateStatus(_.status)){if(g.responseType==="stream"){let y=[];for await(let E of _.data)y.push(E);_.data=y.toString()}let f=o.GaxiosError.extractAPIErrorFromResponse(_,`Request failed with status code ${_.status}`);throw new o.GaxiosError(f?.message,g,_,f)}return _}catch(_){let f;_ instanceof o.GaxiosError?f=_:_ instanceof Error?f=new o.GaxiosError(_.message,g,void 0,_):f=new o.GaxiosError("Unexpected Gaxios Error",g,void 0,_);let{shouldRetry:y,config:E}=await(0,a.getRetryConfig)(f);if(y&&E)return f.config.retryConfig.currentRetryAttempt=E.retryConfig.currentRetryAttempt,g.retryConfig=f.config?.retryConfig,this.#i(g),this._request(g);throw g.errorRedactor&&g.errorRedactor(f),f}}async getResponseData(g,_){if(_.status===h)return"";if(g.maxContentLength&&_.headers.has("content-length")&&g.maxContentLength<Number.parseInt(_.headers?.get("content-length")||""))throw new o.GaxiosError("Response's `Content-Length` is over the limit.",g,Object.assign(_,{config:g}));switch(g.responseType){case"stream":return _.body;case"json":{let f=await _.text();try{return JSON.parse(f)}catch{return f}}case"arraybuffer":return _.arrayBuffer();case"blob":return _.blob();case"text":return _.text();default:return this.getResponseDataFromContentType(_)}}#e(g,_=[]){let f=new URL(g),y=[..._],E=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(let C of E)y.push(C.trim());for(let C of y)if(C instanceof RegExp){if(C.test(f.toString()))return!1}else if(C instanceof URL){if(C.origin===f.origin)return!1}else if(C.startsWith("*.")||C.startsWith(".")){let S=C.replace(/^\*\./,".");if(f.hostname.endsWith(S))return!1}else if(C===f.origin||C===f.hostname||C===f.href)return!1;return!0}async#t(g){let _=Promise.resolve(g);for(let f of this.interceptors.request.values())f&&(_=_.then(f.resolved,f.rejected));return _}async#r(g){let _=Promise.resolve(g);for(let f of this.interceptors.response.values())f&&(_=_.then(f.resolved,f.rejected));return _}async#n(g){let _=new Headers(this.defaults.headers);r.mergeHeaders(_,g.headers);let f=(0,n.default)(!0,{},this.defaults,g);if(!f.url)throw new Error("URL is required.");if(f.baseURL&&(f.url=new URL(f.url,f.baseURL)),f.url=new URL(f.url),f.params)if(f.paramsSerializer){let C=f.paramsSerializer(f.params);C.startsWith("?")&&(C=C.slice(1));let S=f.url.toString().includes("?")?"&":"?";f.url=f.url+S+C}else{let C=f.url instanceof URL?f.url:new URL(f.url);for(let[S,A]of new URLSearchParams(f.params))C.searchParams.append(S,A);f.url=C}typeof g.maxContentLength=="number"&&(f.size=g.maxContentLength),typeof g.maxRedirects=="number"&&(f.follow=g.maxRedirects);let y=typeof f.data=="string"||f.data instanceof ArrayBuffer||f.data instanceof Blob||globalThis.File&&f.data instanceof File||f.data instanceof FormData||f.data instanceof c.Readable||f.data instanceof ReadableStream||f.data instanceof String||f.data instanceof URLSearchParams||ArrayBuffer.isView(f.data)||["Blob","File","FormData"].includes(f.data?.constructor?.name||"");if(f.multipart?.length){let C=await d();_.set("content-type",`multipart/related; boundary=${C}`),f.body=c.Readable.from(this.getMultipartRequest(f.multipart,C))}else y?f.body=f.data:typeof f.data=="object"?_.get("Content-Type")==="application/x-www-form-urlencoded"?f.body=f.paramsSerializer?f.paramsSerializer(f.data):new URLSearchParams(f.data):(_.has("content-type")||_.set("content-type","application/json"),f.body=JSON.stringify(f.data)):f.data&&(f.body=f.data);f.validateStatus=f.validateStatus||this.validateStatus,f.responseType=f.responseType||"unknown",!_.has("accept")&&f.responseType==="json"&&_.set("accept","application/json");let E=f.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(!f.agent)if(E&&this.#e(f.url,f.noProxy)){let C=await r.#a();this.agentCache.has(E)?f.agent=this.agentCache.get(E):(f.agent=new C(E,{cert:f.cert,key:f.key}),this.agentCache.set(E,f.agent))}else f.cert&&f.key&&(this.agentCache.has(f.key)?f.agent=this.agentCache.get(f.key):(f.agent=new i.Agent({cert:f.cert,key:f.key}),this.agentCache.set(f.key,f.agent)));return typeof f.errorRedactor!="function"&&f.errorRedactor!==!1&&(f.errorRedactor=o.defaultErrorRedactor),f.body&&!("duplex"in f)&&(f.duplex="half"),this.#i(f),Object.assign(f,{headers:_,url:f.url instanceof URL?f.url:new URL(f.url)})}#i(g){if(g.timeout){let _=AbortSignal.timeout(g.timeout);g.signal&&!g.signal.aborted?g.signal=AbortSignal.any([g.signal,_]):g.signal=_}}validateStatus(g){return g>=200&&g<300}async getResponseDataFromContentType(g){let _=g.headers.get("Content-Type");if(_===null)return g.text();if(_=_.toLowerCase(),_.includes("application/json")){let f=await g.text();try{f=JSON.parse(f)}catch{}return f}else return _.match(/^text\//)?g.text():g.blob()}async*getMultipartRequest(g,_){let f=`--${_}--`;for(let y of g){let E=y.headers.get("Content-Type")||"application/octet-stream";yield`--${_}\r
|
|
3
3
|
Content-Type: ${E}\r
|
|
4
4
|
\r
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=Object.defineProperty;var i=(t,e)=>c(t,"name",{value:e,configurable:!0});import{createRequire as y}from"node:module";const h=y(import.meta.url);import{ownedSlice as p}from"./chunk-
|
|
1
|
+
var c=Object.defineProperty;var i=(t,e)=>c(t,"name",{value:e,configurable:!0});import{createRequire as y}from"node:module";const h=y(import.meta.url);import{ownedSlice as p}from"./chunk-SCYK4XNE.js";var g=4e3;function m(t){if(!(t instanceof Error))return{message:a(t),messageCarriesBody:!1};let e=t,n=b(e),s=$(e),o=s===void 0||t.message.includes(s),u=n===void 0&&s===void 0?r(t):t.message;return{status:n,body:s,message:u,messageCarriesBody:o}}i(m,"normalizeProviderError");var l=5;function r(t){let e,n=t.cause;for(let u=0;u<l&&n instanceof Error;u++)e=n,n=n.cause;if(!e)return t.message;let s=(e.message||e.name).trim(),o=e.code;return(typeof o=="string"||typeof o=="number")&&!s.includes(String(o))&&(s=s?`${s} (${o})`:String(o)),!s||t.message.includes(s)?t.message:t.message?`${t.message}: ${s}`:s}i(r,"withCauseDetail");function b(t){if(typeof t.statusCode=="number")return t.statusCode;if(typeof t.status=="number")return t.status;if(typeof t.$metadata?.httpStatusCode=="number")return t.$metadata.httpStatusCode;if(typeof t.$response?.statusCode=="number")return t.$response.statusCode}i(b,"extractStatus");function $(t){let e=S(t);if(e===void 0)return;let n=e.trim();if(n.length!==0)return f(n,g)}i($,"extractBody");function S(t){if(typeof t.body=="string")return t.body;if(d(t.error))return a(t.error);let e=t.$response?.body;if(typeof e=="string")return e;if(!C(e)&&d(e))return a(e)}i(S,"pickBodyText");function C(t){return typeof t=="object"&&t!==null&&"pipe"in t&&typeof t.pipe=="function"}i(C,"isReadableStreamLike");function d(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return e!==Object.prototype&&e!==null?!1:Object.keys(t).length>0}i(d,"isPlainNonEmptyObject");function E(t,e){return t.messageCarriesBody||t.status===void 0||t.body===void 0?e!==void 0&&t.status!==void 0?`${e} (${t.status}): ${t.message}`:t.message:e!==void 0?`${e} (${t.status}): ${t.body}`:`${t.status}: ${t.body}`}i(E,"formatProviderError");function f(t,e){return t.length<=e?t:`${p(t,0,e)}... [truncated ${t.length-e} chars]`}i(f,"truncateErrorText");function a(t){try{let e=JSON.stringify(t);return e===void 0?String(t):e}catch{return String(t)}}i(a,"safeJsonStringify");export{E as formatProviderError,m as normalizeProviderError,f as truncateErrorText,r as withCauseDetail};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var it=Object.defineProperty;var o=(e,t)=>it(e,"name",{value:t,configurable:!0});import{createRequire as st}from"node:module";const Vr=st(import.meta.url);import{fill as nt,getShellConfig as ot}from"./chunk-SE42OS3U.js";import{APP_TITLE as at,getAgentDir as U,getFileRevision as N,normalizePath as V,require_cross_spawn as lt,stripBom as te}from"./chunk-R47JBGS3.js";import{require_graceful_fs as fe}from"./chunk-XJFQKN3N.js";import{drainNewerDataFormatFiles as ut,t as ct,writeFileAtomicSync as pe}from"./chunk-YZQKKXBH.js";import{__commonJS as P,__require as re,__toESM as me}from"./chunk-JXWJOIH4.js";var dt=P({"node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js"(e,t){function r(i,s){typeof s=="boolean"&&(s={forever:s}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=s||{},this._maxRetryTime=s&&s.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}o(r,"RetryOperation"),t.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var s=new Date().getTime();if(i&&s-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var a=this,l=setTimeout(function(){a._attempts++,a._operationTimeoutCb&&(a._timeout=setTimeout(function(){a._operationTimeoutCb(a._attempts)},a._operationTimeout),a._options.unref&&a._timeout.unref()),a._fn(a._attempts)},n);return this._options.unref&&l.unref(),!0},r.prototype.attempt=function(i,s){this._fn=i,s&&(s.timeout&&(this._operationTimeout=s.timeout),s.cb&&(this._operationTimeoutCb=s.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},r.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)},r.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)},r.prototype.start=r.prototype.try,r.prototype.errors=function(){return this._errors},r.prototype.attempts=function(){return this._attempts},r.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},s=null,n=0,a=0;a<this._errors.length;a++){var l=this._errors[a],u=l.message,h=(i[u]||0)+1;i[u]=h,h>=n&&(s=l,n=h)}return s}}}),ht=P({"node_modules/proper-lockfile/node_modules/retry/lib/retry.js"(e){var t=dt();e.operation=function(r){var i=e.timeouts(r);return new t(i,{forever:r&&r.forever,unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},e.timeouts=function(r){if(r instanceof Array)return[].concat(r);var i={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var s in r)i[s]=r[s];if(i.minTimeout>i.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],a=0;a<i.retries;a++)n.push(this.createTimeout(a,i));return r&&r.forever&&!n.length&&n.push(this.createTimeout(a,i)),n.sort(function(l,u){return l-u}),n},e.createTimeout=function(r,i){var s=i.randomize?Math.random()+1:1,n=Math.round(s*i.minTimeout*Math.pow(i.factor,r));return n=Math.min(n,i.maxTimeout),n},e.wrap=function(r,i,s){if(i instanceof Array&&(s=i,i=null),!s){s=[];for(var n in r)typeof r[n]=="function"&&s.push(n)}for(var a=0;a<s.length;a++){var l=s[a],u=r[l];r[l]=function(h){var f=e.operation(i),g=Array.prototype.slice.call(arguments,1),m=g.pop();g.push(function(w){f.retry(w)||(w&&(arguments[0]=f.mainError()),m.apply(this,arguments))}),f.attempt(function(){h.apply(r,g)})}.bind(r,u),r[l].options=i}}}}),ft=P({"node_modules/proper-lockfile/node_modules/retry/index.js"(e,t){t.exports=ht()}}),pt=P({"node_modules/signal-exit/signals.js"(e,t){t.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],process.platform!=="win32"&&t.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&t.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}}),mt=P({"node_modules/signal-exit/index.js"(e,t){var r=global.process,i=o(function(y){return y&&typeof y=="object"&&typeof y.removeListener=="function"&&typeof y.emit=="function"&&typeof y.reallyExit=="function"&&typeof y.listeners=="function"&&typeof y.kill=="function"&&typeof y.pid=="number"&&typeof y.on=="function"},"processOk");i(r)?(s=re("assert"),n=pt(),a=/^win/i.test(r.platform),l=re("events"),typeof l!="function"&&(l=l.EventEmitter),r.__signal_exit_emitter__?u=r.__signal_exit_emitter__:(u=r.__signal_exit_emitter__=new l,u.count=0,u.emitted={}),u.infinite||(u.setMaxListeners(1/0),u.infinite=!0),t.exports=function(y,p){if(!i(global.process))return function(){};s.equal(typeof y,"function","a callback must be provided for exit handler"),m===!1&&w();var c="exit";p&&p.alwaysLast&&(c="afterexit");var d=o(function(){u.removeListener(c,y),u.listeners("exit").length===0&&u.listeners("afterexit").length===0&&h()},"remove");return u.on(c,y),d},h=o(function(){!m||!i(global.process)||(m=!1,n.forEach(function(y){try{r.removeListener(y,g[y])}catch{}}),r.emit=b,r.reallyExit=v,u.count-=1)},"unload"),t.exports.unload=h,f=o(function(y,p,c){u.emitted[y]||(u.emitted[y]=!0,u.emit(y,p,c))},"emit"),g={},n.forEach(function(y){g[y]=function(){if(i(global.process)){var p=r.listeners(y);p.length===u.count&&(h(),f("exit",null,y),f("afterexit",null,y),a&&y==="SIGHUP"&&(y="SIGINT"),r.kill(r.pid,y))}}}),t.exports.signals=function(){return n},m=!1,w=o(function(){m||!i(global.process)||(m=!0,u.count+=1,n=n.filter(function(y){try{return r.on(y,g[y]),!0}catch{return!1}}),r.emit=S,r.reallyExit=x)},"load"),t.exports.load=w,v=r.reallyExit,x=o(function(y){i(global.process)&&(r.exitCode=y||0,f("exit",r.exitCode,null),f("afterexit",r.exitCode,null),v.call(r,r.exitCode))},"processReallyExit"),b=r.emit,S=o(function(y,p){if(y==="exit"&&i(global.process)){p!==void 0&&(r.exitCode=p);var c=b.apply(this,arguments);return f("exit",r.exitCode,null),f("afterexit",r.exitCode,null),c}else return b.apply(this,arguments)},"processEmit")):t.exports=function(){return function(){}};var s,n,a,l,u,h,f,g,m,w,v,x,b,S}}),yt=P({"node_modules/proper-lockfile/lib/mtime-precision.js"(e,t){"use strict";var r=Symbol();function i(n,a,l){let u=a[r];if(u)return a.stat(n,(f,g)=>{if(f)return l(f);l(null,g.mtime,u)});let h=new Date(Math.ceil(Date.now()/1e3)*1e3+5);a.utimes(n,h,h,f=>{if(f)return l(f);a.stat(n,(g,m)=>{if(g)return l(g);let w=m.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(a,r,{value:w}),l(null,m.mtime,w)})})}o(i,"probe");function s(n){let a=Date.now();return n==="s"&&(a=Math.ceil(a/1e3)*1e3),new Date(a)}o(s,"getMtime"),t.exports.probe=i,t.exports.getMtime=s}}),gt=P({"node_modules/proper-lockfile/lib/lockfile.js"(e,t){"use strict";var r=re("path"),i=fe(),s=ft(),n=mt(),a=yt(),l={};function u(p,c){return c.lockfilePath||`${p}.lock`}o(u,"getLockFile");function h(p,c,d){if(!c.realpath)return d(null,r.resolve(p));c.fs.realpath(p,d)}o(h,"resolveCanonicalPath");function f(p,c,d){let E=u(p,c);c.fs.mkdir(E,C=>{if(!C)return a.probe(E,c.fs,(_,R,M)=>{if(_)return c.fs.rmdir(E,()=>{}),d(_);d(null,R,M)});if(C.code!=="EEXIST")return d(C);if(c.stale<=0)return d(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:p}));c.fs.stat(E,(_,R)=>{if(_)return _.code==="ENOENT"?f(p,{...c,stale:0},d):d(_);if(!g(R,c))return d(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:p}));m(p,c,M=>{if(M)return d(M);f(p,{...c,stale:0},d)})})})}o(f,"acquireLock");function g(p,c){return p.mtime.getTime()<Date.now()-c.stale}o(g,"isLockStale");function m(p,c,d){c.fs.rmdir(u(p,c),E=>{if(E&&E.code!=="ENOENT")return d(E);d()})}o(m,"removeLock");function w(p,c){let d=l[p];d.updateTimeout||(d.updateDelay=d.updateDelay||c.update,d.updateTimeout=setTimeout(()=>{d.updateTimeout=null,c.fs.stat(d.lockfilePath,(E,C)=>{let _=d.lastUpdate+c.stale<Date.now();if(E)return E.code==="ENOENT"||_?v(p,d,Object.assign(E,{code:"ECOMPROMISED"})):(d.updateDelay=1e3,w(p,c));if(d.mtime.getTime()!==C.mtime.getTime())return v(p,d,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let R=a.getMtime(d.mtimePrecision);c.fs.utimes(d.lockfilePath,R,R,M=>{let Q=d.lastUpdate+c.stale<Date.now();if(!d.released){if(M)return M.code==="ENOENT"||Q?v(p,d,Object.assign(M,{code:"ECOMPROMISED"})):(d.updateDelay=1e3,w(p,c));d.mtime=R,d.lastUpdate=Date.now(),d.updateDelay=null,w(p,c)}})})},d.updateDelay),d.updateTimeout.unref&&d.updateTimeout.unref())}o(w,"updateLock");function v(p,c,d){c.released=!0,c.updateTimeout&&clearTimeout(c.updateTimeout),l[p]===c&&delete l[p],c.options.onCompromised(d)}o(v,"setLockAsCompromised");function x(p,c,d){c={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:o(E=>{throw E},"onCompromised"),...c},c.retries=c.retries||0,c.retries=typeof c.retries=="number"?{retries:c.retries}:c.retries,c.stale=Math.max(c.stale||0,2e3),c.update=c.update==null?c.stale/2:c.update||0,c.update=Math.max(Math.min(c.update,c.stale/2),1e3),h(p,c,(E,C)=>{if(E)return d(E);let _=s.operation(c.retries);_.attempt(()=>{f(C,c,(R,M,Q)=>{if(_.retry(R))return;if(R)return d(_.mainError());let rt=l[C]={lockfilePath:u(C,c),mtime:M,mtimePrecision:Q,options:c,lastUpdate:Date.now()};w(C,c),d(null,ee=>{if(rt.released)return ee&&ee(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));b(C,{...c,realpath:!1},ee)})})})})}o(x,"lock");function b(p,c,d){c={fs:i,realpath:!0,...c},h(p,c,(E,C)=>{if(E)return d(E);let _=l[C];if(!_)return d(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));_.updateTimeout&&clearTimeout(_.updateTimeout),_.released=!0,delete l[C],m(C,c,d)})}o(b,"unlock");function S(p,c,d){c={stale:1e4,realpath:!0,fs:i,...c},c.stale=Math.max(c.stale||0,2e3),h(p,c,(E,C)=>{if(E)return d(E);c.fs.stat(u(C,c),(_,R)=>_?_.code==="ENOENT"?d(null,!1):d(_):d(null,!g(R,c)))})}o(S,"check");function y(){return l}o(y,"getLocks"),n(()=>{for(let p in l){let c=l[p].options;try{c.fs.rmdirSync(u(p,c))}catch{}}}),t.exports.lock=x,t.exports.unlock=b,t.exports.check=S,t.exports.getLocks=y}}),vt=P({"node_modules/proper-lockfile/lib/adapter.js"(e,t){"use strict";var r=fe();function i(l){let u=["mkdir","realpath","stat","rmdir","utimes"],h={...l};return u.forEach(f=>{h[f]=(...g)=>{let m=g.pop(),w;try{w=l[`${f}Sync`](...g)}catch(v){return m(v)}m(null,w)}}),h}o(i,"createSyncFs");function s(l){return(...u)=>new Promise((h,f)=>{u.push((g,m)=>{g?f(g):h(m)}),l(...u)})}o(s,"toPromise");function n(l){return(...u)=>{let h,f;if(u.push((g,m)=>{h=g,f=m}),l(...u),h)throw h;return f}}o(n,"toSync");function a(l){if(l={...l},l.fs=i(l.fs||r),typeof l.retries=="number"&&l.retries>0||l.retries&&typeof l.retries.retries=="number"&&l.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return l}o(a,"toSyncOptions"),t.exports={toPromise:s,toSync:n,toSyncOptions:a}}}),ye=P({"node_modules/proper-lockfile/index.js"(e,t){"use strict";var r=gt(),{toPromise:i,toSync:s,toSyncOptions:n}=vt();async function a(m,w){let v=await i(r.lock)(m,w);return i(v)}o(a,"lock");function l(m,w){let v=s(r.lock)(m,n(w));return s(v)}o(l,"lockSync");function u(m,w){return i(r.unlock)(m,w)}o(u,"unlock");function h(m,w){return s(r.unlock)(m,n(w))}o(h,"unlockSync");function f(m,w){return i(r.check)(m,w)}o(f,"check");function g(m,w){return s(r.check)(m,n(w))}o(g,"checkSync"),t.exports=a,t.exports.lock=a,t.exports.unlock=u,t.exports.lockSync=l,t.exports.unlockSync=h,t.exports.check=f,t.exports.checkSync=g}}),L={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603},A=class extends Error{static{o(this,"McpError")}code;data;constructor(e,t,r){super(t),this.name="McpError",this.code=e,this.data=r}},I=class extends Error{static{o(this,"McpConnectionClosedError")}constructor(e="MCP connection closed"){super(e),this.name="McpConnectionClosedError"}},wt=class extends Error{static{o(this,"McpTimeoutError")}timeoutMs;constructor(e){super(`MCP request timed out after ${e}ms`),this.name="McpTimeoutError",this.timeoutMs=e}},ie=class extends Error{static{o(this,"McpAbortError")}constructor(e="MCP request aborted"){super(e),this.name="AbortError"}};function T(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(T,"isObject");function F(e){return e instanceof Error?e:new Error(String(e))}o(F,"toError");function B(e){return typeof e=="string"||typeof e=="number"&&Number.isFinite(e)}o(B,"isJsonRpcId");function se(e){return T(e)&&e.jsonrpc==="2.0"&&B(e.id)&&typeof e.method=="string"}o(se,"isJsonRpcRequest");function ge(e){return T(e)&&e.jsonrpc==="2.0"&&!("id"in e)&&typeof e.method=="string"}o(ge,"isJsonRpcNotification");function ne(e){return!T(e)||e.jsonrpc!=="2.0"||!B(e.id)?!1:"result"in e?!("error"in e):!("error"in e)||!T(e.error)?!1:typeof e.error.code=="number"&&typeof e.error.message=="string"}o(ne,"isJsonRpcResponse");function G(e){if(se(e)||ge(e)||ne(e))return e;throw new A(L.invalidRequest,"Invalid JSON-RPC message")}o(G,"parseJsonRpcMessage");var oe="2025-11-25",Et=[oe,"2025-06-18","2025-03-26","2024-11-05"],St=3e4,ve=1e3;function _t(e){if(!T(e)||typeof e.protocolVersion!="string"||!T(e.capabilities)||!T(e.serverInfo)||typeof e.serverInfo.name!="string"||typeof e.serverInfo.version!="string"||e.instructions!==void 0&&typeof e.instructions!="string")throw new A(L.invalidRequest,"Invalid MCP initialize result");return e}o(_t,"validateInitializeResult");function j(e){return new A(L.invalidRequest,e)}o(j,"invalid");function xt(e,t,r,i){let s=T(r)?r[t]:void 0;if(!T(r)||!Array.isArray(s))throw j(`Invalid MCP ${e} result`);for(let a of s)if(!T(a)||!i(a))throw j(`Invalid entry in MCP ${e} result`);let n=r.nextCursor===null||r.nextCursor===""?void 0:r.nextCursor;if(n!==void 0&&typeof n!="string")throw j(`Invalid MCP ${e} cursor`);return{items:s,...n===void 0?{}:{nextCursor:n}}}o(xt,"validateListPage");var bt=o(e=>typeof e.name=="string"&&T(e.inputSchema),"isTool"),we=o(e=>typeof e.uri=="string"&&(e.name===void 0||typeof e.name=="string"),"isResource"),Ee=o(e=>typeof e.uriTemplate=="string"&&(e.name===void 0||typeof e.name=="string"),"isResourceTemplate");function Se(e){return{...e,name:e.name??e.uri}}o(Se,"toResource");function _e(e){return{...e,name:e.name??e.uriTemplate}}o(_e,"toResourceTemplate");function xe(e){return e.nextCursor===void 0?{}:{nextCursor:e.nextCursor}}o(xe,"pageCursor");function Tt(e){if(!T(e)||!Array.isArray(e.contents))throw j("Invalid MCP resources/read result");for(let t of e.contents)if(!T(t)||typeof t.uri!="string"||typeof t.text!="string"&&typeof t.blob!="string")throw j("Invalid contents in MCP resources/read result");return e}o(Tt,"validateReadResourceResult");function Ct(e){if(!T(e)||e.content!==void 0&&!Array.isArray(e.content))throw new A(L.invalidRequest,"Invalid MCP tools/call result");return e.content===void 0?{...e,content:[]}:e}o(Ct,"validateCallToolResult");var Rt=class{static{o(this,"McpClient")}options;state="idle";transport;nextRequestId=1;serverInfoValue;serverCapabilitiesValue;instructionsValue;protocolVersionValue;pending=new Map;progressRequests=new Map;incoming=new Map;requestHandlers=new Map;notificationListeners=new Map;errorListeners=new Set;closeListeners=new Set;disposers=[];constructor(e){this.options=Object.freeze({...e}),this.requestHandlers.set("ping",()=>({}));let t=e.roots;t&&this.requestHandlers.set("roots/list",async()=>({roots:[...typeof t=="function"?await t():t]}))}get connectionState(){return this.state}get serverInfo(){return this.serverInfoValue}get serverCapabilities(){return this.serverCapabilitiesValue}get instructions(){return this.instructionsValue}get protocolVersion(){return this.protocolVersionValue}async connect(e){if(this.state!=="idle")throw new Error(`Cannot connect MCP client in ${this.state} state`);this.state="connecting",this.transport=e,this.disposers=[e.onMessage(t=>this.handleMessage(t)),e.onError(t=>this.emitError(t)),e.onClose(()=>this.handleTransportClose())];try{await e.start();let t={...this.options.capabilities};this.options.roots&&t.roots===void 0&&(t.roots={});let r=_t(await this.requestInternal("initialize",{protocolVersion:this.options.protocolVersion??oe,capabilities:t,clientInfo:{name:this.options.name,version:this.options.version,...this.options.title===void 0?{}:{title:this.options.title}}},{},!0));if(!Et.includes(r.protocolVersion))throw new Error(`MCP server selected unsupported protocol version ${r.protocolVersion}`);return this.protocolVersionValue=r.protocolVersion,this.serverInfoValue=r.serverInfo,this.serverCapabilitiesValue=r.capabilities,this.instructionsValue=r.instructions,e.setProtocolVersion?.(r.protocolVersion),await this.notifyInternal("notifications/initialized",void 0,!0),this.state="connected",r}catch(t){throw await this.close().catch(()=>{}),t}}request(e,t,r={}){return this.requestInternal(e,t,r,!1)}notify(e,t){return this.notifyInternal(e,t,!1)}setRequestHandler(e,t){return this.requestHandlers.set(e,t),()=>{this.requestHandlers.get(e)===t&&this.requestHandlers.delete(e)}}onNotification(e,t){let r=this.notificationListeners.get(e)??new Set;return this.notificationListeners.set(e,r),r.add(t),()=>{r.delete(t),r.size===0&&this.notificationListeners.delete(e)}}onError(e){return this.errorListeners.add(e),()=>this.errorListeners.delete(e)}onClose(e){return this.closeListeners.add(e),()=>this.closeListeners.delete(e)}async ping(e={}){await this.request("ping",void 0,e)}async listTools(e={}){return await this.listAll("tools/list","tools",bt,e)}async listResources(e={}){return(await this.listAll("resources/list","resources",we,e)).map(Se)}async listResourcesPage(e,t={}){let r=await this.listPage("resources/list","resources",we,e,t);return{resources:r.items.map(Se),...xe(r)}}async listResourceTemplates(e={}){return(await this.listAll("resources/templates/list","resourceTemplates",Ee,e)).map(_e)}async listResourceTemplatesPage(e,t={}){let r=await this.listPage("resources/templates/list","resourceTemplates",Ee,e,t);return{resourceTemplates:r.items.map(_e),...xe(r)}}async readResource(e,t={}){return Tt(await this.request("resources/read",{uri:e},t))}async listPage(e,t,r,i,s){return xt(e,t,await this.request(e,i===void 0?void 0:{cursor:i},s),r)}async listAll(e,t,r,i){let s=[],n=new Set,a;for(let l=0;l<ve;l++){let u=await this.listPage(e,t,r,a,i);if(s.push(...u.items),u.nextCursor===void 0)return s;if(n.has(u.nextCursor))throw new Error(`MCP ${e} returned duplicate cursor: ${u.nextCursor}`);n.add(u.nextCursor),a=u.nextCursor}throw new Error(`MCP ${e} exceeded ${ve} pages`)}async callTool(e,t,r={}){return Ct(await this.request("tools/call",{name:e,...t===void 0?{}:{arguments:t}},r))}async close(){let e=this.transport;this.transport=void 0,this.disposeTransportListeners(),this.markClosed(new I),await e?.close()}async requestInternal(e,t,r,i){let s=this.requireTransport(i);if(r.signal?.aborted)throw new ie;let n=this.nextRequestId++,a=r.onProgress?n:void 0,l=a===void 0?t:{...t,_meta:{...T(t?._meta)?t._meta:{},progressToken:a}},u={jsonrpc:"2.0",id:n,method:e,...l===void 0?{}:{params:l}};return new Promise((h,f)=>{let g={resolve:h,reject:f,timeoutMs:r.timeoutMs??this.options.requestTimeoutMs??St,timer:void 0,signal:r.signal,onAbort:o(()=>this.cancelPending(n,new ie,e!=="initialize",String(r.signal?.reason??"Aborted")),"onAbort"),sendController:new AbortController,cancellable:e!=="initialize",onProgress:r.onProgress,progressToken:a};this.pending.set(n,g),a!==void 0&&this.progressRequests.set(a,n),r.signal?.addEventListener("abort",g.onAbort,{once:!0}),this.armTimeout(n,g),s.send(u,{signal:g.sendController.signal}).catch(m=>this.cancelPending(n,m,!1))})}async notifyInternal(e,t,r){await this.requireTransport(r).send({jsonrpc:"2.0",method:e,...t===void 0?{}:{params:t}})}requireTransport(e){if(this.transport&&(this.state==="connected"||e&&this.state==="connecting"))return this.transport;throw new I(`MCP client is ${this.state}`)}handleMessage(e){if(ne(e)){this.handleResponse(e);return}if(se(e)){this.handleRequest(e);return}if(ge(e)){this.handleNotification(e.method,e.params);return}this.emitError(new A(L.invalidRequest,"Received invalid JSON-RPC message"))}handleResponse(e){let t=this.pending.get(e.id);if(!t){this.emitError(new Error(`Received response for unknown MCP request ${String(e.id)}`));return}this.removePending(e.id,t),"error"in e?t.reject(new A(e.error.code,e.error.message,e.error.data)):t.resolve(e.result)}async handleRequest(e){let t=this.transport;if(!t)return;let r=this.requestHandlers.get(e.method);if(!r){await t.send({jsonrpc:"2.0",id:e.id,error:{code:L.methodNotFound,message:`Method not found: ${e.method}`}}).catch(s=>this.emitError(s));return}let i=new AbortController;this.incoming.set(e.id,i);try{let s=await r(e.params,{signal:i.signal});await t.send({jsonrpc:"2.0",id:e.id,result:s??{}})}catch(s){let n=s instanceof A?{code:s.code,message:s.message,data:s.data}:{code:L.internalError,message:F(s).message};await t.send({jsonrpc:"2.0",id:e.id,error:n}).catch(a=>this.emitError(a))}finally{this.incoming.delete(e.id)}}handleNotification(e,t){e==="notifications/progress"?this.handleProgress(t):e==="notifications/cancelled"&&this.handleCancelled(t);for(let r of this.notificationListeners.get(e)??[])try{r(t)}catch(i){this.emitError(i)}}handleProgress(e){if(!T(e)||!B(e.progressToken)||typeof e.progress!="number")return;let t=this.progressRequests.get(e.progressToken),r=t===void 0?void 0:this.pending.get(t);if(!(t===void 0||!r)){this.armTimeout(t,r);try{r.onProgress?.(e)}catch(i){this.emitError(i)}}}handleCancelled(e){T(e)&&B(e.requestId)&&this.incoming.get(e.requestId)?.abort(e.reason)}armTimeout(e,t){t.timer&&clearTimeout(t.timer),!(!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)&&(t.timer=setTimeout(()=>{this.cancelPending(e,new wt(t.timeoutMs),t.cancellable,"Request timed out")},t.timeoutMs))}cancelPending(e,t,r,i){let s=this.pending.get(e);s&&(this.removePending(e,s),s.reject(t),r&&this.transport&&this.transport.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:e,...i?{reason:i}:{}}}).catch(n=>this.emitError(n)))}removePending(e,t){this.pending.delete(e),t.timer&&clearTimeout(t.timer),t.progressToken!==void 0&&this.progressRequests.delete(t.progressToken),t.signal?.removeEventListener("abort",t.onAbort),t.sendController.abort()}rejectPending(e){for(let[t,r]of this.pending)this.removePending(t,r),r.reject(e)}handleTransportClose(){this.markClosed(new I)}markClosed(e){let t=this.state==="closed";this.state="closed",this.rejectPending(e);for(let r of this.incoming.values())r.abort(e);if(this.incoming.clear(),!t)for(let r of[...this.closeListeners])try{r()}catch(i){this.emitError(i)}}emitError(e){let t=F(e);for(let r of this.errorListeners)r(t)}disposeTransportListeners(){for(let e of this.disposers.splice(0))e()}},Mt=me(lt(),1);import{spawn as Pt}from"node:child_process";import O from"node:process";var H=16*1024*1024,be=class{static{o(this,"TransportEvents")}messageListeners=new Set;errorListeners=new Set;closeListeners=new Set;closeEmitted=!1;onMessage(e){return this.messageListeners.add(e),()=>this.messageListeners.delete(e)}onError(e){return this.errorListeners.add(e),()=>this.errorListeners.delete(e)}onClose(e){return this.closeListeners.add(e),()=>this.closeListeners.delete(e)}emitMessage(e){for(let t of this.messageListeners)t(e)}emitError(e){let t=F(e);for(let r of this.errorListeners)r(t)}emitClose(){if(!this.closeEmitted){this.closeEmitted=!0;for(let e of this.closeListeners)e()}}},Lt=64*1024,At=class{static{o(this,"JsonRpcLineReader")}options;stdoutChunks=[];stdoutPendingBytes=0;stderrBuffer=Buffer.alloc(0);constructor(e){this.options=e}get stderr(){return this.stderrBuffer.toString("utf8")}readStdout(e){let t=Buffer.from(e.buffer,e.byteOffset,e.byteLength),r=this.options.maxMessageBytes??H,i=0;for(;;){let s=t.indexOf(10,i);if(s<0){i<t.length&&(this.stdoutChunks.push(Buffer.from(t.subarray(i))),this.stdoutPendingBytes+=t.length-i),this.stdoutPendingBytes>r&&(this.stdoutChunks=[],this.stdoutPendingBytes=0,this.options.onError(new Error(`MCP stdio message exceeds ${r} bytes`)));return}let n=t.subarray(i,s);if(this.stdoutChunks.length>0&&(this.stdoutChunks.push(n),n=Buffer.concat(this.stdoutChunks,this.stdoutPendingBytes+n.length),this.stdoutChunks=[],this.stdoutPendingBytes=0),i=s+1,n.length>r){this.options.onError(new Error(`MCP stdio message exceeds ${r} bytes`));continue}let a=n.toString("utf8").replace(/\r$/,"");if(a.trim())try{this.options.onMessage(G(JSON.parse(a)))}catch(l){this.options.onError(l)}}}readStderr(e){let t=this.options.maxStderrBytes??Lt;this.stderrBuffer=Buffer.concat([this.stderrBuffer,e]),this.stderrBuffer.length>t&&(this.stderrBuffer=this.stderrBuffer.subarray(-t)),this.options.onStderr?.(Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"))}end(){Buffer.concat(this.stdoutChunks).toString("utf8").trim()&&this.options.onError(new Error("MCP stdio server closed with an incomplete JSON-RPC message")),this.stdoutChunks=[],this.stdoutPendingBytes=0}},It=2e3,kt=500,z=O.platform!=="win32",ae=new Set,Te=!1;function le(e,t){let r=e.pid;if(O.platform==="win32"&&r!==void 0){if(e.exitCode!==null)return;Pt("taskkill",["/pid",String(r),"/T","/F"],{stdio:"ignore",windowsHide:!0}).on("error",()=>{});return}if(z&&r!==void 0)try{O.kill(-r,t);return}catch{}try{e.kill(t)}catch{}}o(le,"killProcessTree");function Ot(){Te||(Te=!0,O.once("exit",()=>{for(let e of ae)try{O.kill(-e,"SIGTERM")}catch{}}))}o(Ot,"installExitHook");var $t=class extends be{static{o(this,"StdioTransport")}options;child;lines;started=!1;closed=!1;constructor(e){super(),this.options=Object.freeze({...e,args:e.args?[...e.args]:void 0}),this.lines=new At({maxMessageBytes:this.options.maxMessageBytes,maxStderrBytes:this.options.maxStderrBytes,onStderr:this.options.onStderr,onMessage:o(t=>this.emitMessage(t),"onMessage"),onError:o(t=>this.emitError(t),"onError")})}get pid(){return this.child?.pid}get stderr(){return this.lines.stderr}async start(){if(this.started)throw new Error("MCP stdio transport already started");if(this.closed)throw new I;this.started=!0;let e=this.options.inheritEnv===!1?{...this.options.env}:{...O.env,...this.options.env},t=(0,Mt.default)(this.options.command,this.options.args??[],{cwd:this.options.cwd,env:e,stdio:["pipe","pipe",this.options.stderr==="inherit"?"inherit":"pipe"],windowsHide:!0,detached:z});this.child=t;let r=t.pid;z&&r!==void 0&&(Ot(),ae.add(r),t.once("close",()=>ae.delete(r))),t.stdout?.on("data",i=>this.lines.readStdout(i)),t.stdout?.on("error",i=>this.emitError(i)),t.stdin?.on("error",i=>{this.closed||this.emitError(i)}),t.stderr?.on("data",i=>this.lines.readStderr(i)),t.stderr?.on("error",i=>this.emitError(i)),t.on("close",()=>{this.child=void 0,this.lines.end(),this.emitClose()}),await new Promise((i,s)=>{let n=o(()=>{t.off("error",a),i()},"onSpawn"),a=o(l=>{t.off("spawn",n),s(l)},"onError");t.once("spawn",n),t.once("error",a)}),t.on("error",i=>{this.closed||this.emitError(i)})}async send(e){let t=this.child?.stdin;if(!this.started||this.closed||!t?.writable)throw new I;let r=`${JSON.stringify(e)}
|
|
1
|
+
var it=Object.defineProperty;var o=(e,t)=>it(e,"name",{value:t,configurable:!0});import{createRequire as st}from"node:module";const Vr=st(import.meta.url);import{fill as nt,getShellConfig as ot}from"./chunk-SE42OS3U.js";import{APP_TITLE as at,getAgentDir as U,getFileRevision as N,normalizePath as V,require_cross_spawn as lt,stripBom as te}from"./chunk-R47JBGS3.js";import{require_graceful_fs as fe}from"./chunk-XJFQKN3N.js";import{drainNewerDataFormatFiles as ut,t as ct,writeFileAtomicSync as pe}from"./chunk-XRF4A4KI.js";import{__commonJS as P,__require as re,__toESM as me}from"./chunk-JXWJOIH4.js";var dt=P({"node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js"(e,t){function r(i,s){typeof s=="boolean"&&(s={forever:s}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=s||{},this._maxRetryTime=s&&s.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}o(r,"RetryOperation"),t.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var s=new Date().getTime();if(i&&s-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var a=this,l=setTimeout(function(){a._attempts++,a._operationTimeoutCb&&(a._timeout=setTimeout(function(){a._operationTimeoutCb(a._attempts)},a._operationTimeout),a._options.unref&&a._timeout.unref()),a._fn(a._attempts)},n);return this._options.unref&&l.unref(),!0},r.prototype.attempt=function(i,s){this._fn=i,s&&(s.timeout&&(this._operationTimeout=s.timeout),s.cb&&(this._operationTimeoutCb=s.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},r.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)},r.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)},r.prototype.start=r.prototype.try,r.prototype.errors=function(){return this._errors},r.prototype.attempts=function(){return this._attempts},r.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},s=null,n=0,a=0;a<this._errors.length;a++){var l=this._errors[a],u=l.message,h=(i[u]||0)+1;i[u]=h,h>=n&&(s=l,n=h)}return s}}}),ht=P({"node_modules/proper-lockfile/node_modules/retry/lib/retry.js"(e){var t=dt();e.operation=function(r){var i=e.timeouts(r);return new t(i,{forever:r&&r.forever,unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},e.timeouts=function(r){if(r instanceof Array)return[].concat(r);var i={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var s in r)i[s]=r[s];if(i.minTimeout>i.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],a=0;a<i.retries;a++)n.push(this.createTimeout(a,i));return r&&r.forever&&!n.length&&n.push(this.createTimeout(a,i)),n.sort(function(l,u){return l-u}),n},e.createTimeout=function(r,i){var s=i.randomize?Math.random()+1:1,n=Math.round(s*i.minTimeout*Math.pow(i.factor,r));return n=Math.min(n,i.maxTimeout),n},e.wrap=function(r,i,s){if(i instanceof Array&&(s=i,i=null),!s){s=[];for(var n in r)typeof r[n]=="function"&&s.push(n)}for(var a=0;a<s.length;a++){var l=s[a],u=r[l];r[l]=function(h){var f=e.operation(i),g=Array.prototype.slice.call(arguments,1),m=g.pop();g.push(function(w){f.retry(w)||(w&&(arguments[0]=f.mainError()),m.apply(this,arguments))}),f.attempt(function(){h.apply(r,g)})}.bind(r,u),r[l].options=i}}}}),ft=P({"node_modules/proper-lockfile/node_modules/retry/index.js"(e,t){t.exports=ht()}}),pt=P({"node_modules/signal-exit/signals.js"(e,t){t.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],process.platform!=="win32"&&t.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&t.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}}),mt=P({"node_modules/signal-exit/index.js"(e,t){var r=global.process,i=o(function(y){return y&&typeof y=="object"&&typeof y.removeListener=="function"&&typeof y.emit=="function"&&typeof y.reallyExit=="function"&&typeof y.listeners=="function"&&typeof y.kill=="function"&&typeof y.pid=="number"&&typeof y.on=="function"},"processOk");i(r)?(s=re("assert"),n=pt(),a=/^win/i.test(r.platform),l=re("events"),typeof l!="function"&&(l=l.EventEmitter),r.__signal_exit_emitter__?u=r.__signal_exit_emitter__:(u=r.__signal_exit_emitter__=new l,u.count=0,u.emitted={}),u.infinite||(u.setMaxListeners(1/0),u.infinite=!0),t.exports=function(y,p){if(!i(global.process))return function(){};s.equal(typeof y,"function","a callback must be provided for exit handler"),m===!1&&w();var c="exit";p&&p.alwaysLast&&(c="afterexit");var d=o(function(){u.removeListener(c,y),u.listeners("exit").length===0&&u.listeners("afterexit").length===0&&h()},"remove");return u.on(c,y),d},h=o(function(){!m||!i(global.process)||(m=!1,n.forEach(function(y){try{r.removeListener(y,g[y])}catch{}}),r.emit=b,r.reallyExit=v,u.count-=1)},"unload"),t.exports.unload=h,f=o(function(y,p,c){u.emitted[y]||(u.emitted[y]=!0,u.emit(y,p,c))},"emit"),g={},n.forEach(function(y){g[y]=function(){if(i(global.process)){var p=r.listeners(y);p.length===u.count&&(h(),f("exit",null,y),f("afterexit",null,y),a&&y==="SIGHUP"&&(y="SIGINT"),r.kill(r.pid,y))}}}),t.exports.signals=function(){return n},m=!1,w=o(function(){m||!i(global.process)||(m=!0,u.count+=1,n=n.filter(function(y){try{return r.on(y,g[y]),!0}catch{return!1}}),r.emit=S,r.reallyExit=x)},"load"),t.exports.load=w,v=r.reallyExit,x=o(function(y){i(global.process)&&(r.exitCode=y||0,f("exit",r.exitCode,null),f("afterexit",r.exitCode,null),v.call(r,r.exitCode))},"processReallyExit"),b=r.emit,S=o(function(y,p){if(y==="exit"&&i(global.process)){p!==void 0&&(r.exitCode=p);var c=b.apply(this,arguments);return f("exit",r.exitCode,null),f("afterexit",r.exitCode,null),c}else return b.apply(this,arguments)},"processEmit")):t.exports=function(){return function(){}};var s,n,a,l,u,h,f,g,m,w,v,x,b,S}}),yt=P({"node_modules/proper-lockfile/lib/mtime-precision.js"(e,t){"use strict";var r=Symbol();function i(n,a,l){let u=a[r];if(u)return a.stat(n,(f,g)=>{if(f)return l(f);l(null,g.mtime,u)});let h=new Date(Math.ceil(Date.now()/1e3)*1e3+5);a.utimes(n,h,h,f=>{if(f)return l(f);a.stat(n,(g,m)=>{if(g)return l(g);let w=m.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(a,r,{value:w}),l(null,m.mtime,w)})})}o(i,"probe");function s(n){let a=Date.now();return n==="s"&&(a=Math.ceil(a/1e3)*1e3),new Date(a)}o(s,"getMtime"),t.exports.probe=i,t.exports.getMtime=s}}),gt=P({"node_modules/proper-lockfile/lib/lockfile.js"(e,t){"use strict";var r=re("path"),i=fe(),s=ft(),n=mt(),a=yt(),l={};function u(p,c){return c.lockfilePath||`${p}.lock`}o(u,"getLockFile");function h(p,c,d){if(!c.realpath)return d(null,r.resolve(p));c.fs.realpath(p,d)}o(h,"resolveCanonicalPath");function f(p,c,d){let E=u(p,c);c.fs.mkdir(E,C=>{if(!C)return a.probe(E,c.fs,(_,R,M)=>{if(_)return c.fs.rmdir(E,()=>{}),d(_);d(null,R,M)});if(C.code!=="EEXIST")return d(C);if(c.stale<=0)return d(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:p}));c.fs.stat(E,(_,R)=>{if(_)return _.code==="ENOENT"?f(p,{...c,stale:0},d):d(_);if(!g(R,c))return d(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:p}));m(p,c,M=>{if(M)return d(M);f(p,{...c,stale:0},d)})})})}o(f,"acquireLock");function g(p,c){return p.mtime.getTime()<Date.now()-c.stale}o(g,"isLockStale");function m(p,c,d){c.fs.rmdir(u(p,c),E=>{if(E&&E.code!=="ENOENT")return d(E);d()})}o(m,"removeLock");function w(p,c){let d=l[p];d.updateTimeout||(d.updateDelay=d.updateDelay||c.update,d.updateTimeout=setTimeout(()=>{d.updateTimeout=null,c.fs.stat(d.lockfilePath,(E,C)=>{let _=d.lastUpdate+c.stale<Date.now();if(E)return E.code==="ENOENT"||_?v(p,d,Object.assign(E,{code:"ECOMPROMISED"})):(d.updateDelay=1e3,w(p,c));if(d.mtime.getTime()!==C.mtime.getTime())return v(p,d,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let R=a.getMtime(d.mtimePrecision);c.fs.utimes(d.lockfilePath,R,R,M=>{let Q=d.lastUpdate+c.stale<Date.now();if(!d.released){if(M)return M.code==="ENOENT"||Q?v(p,d,Object.assign(M,{code:"ECOMPROMISED"})):(d.updateDelay=1e3,w(p,c));d.mtime=R,d.lastUpdate=Date.now(),d.updateDelay=null,w(p,c)}})})},d.updateDelay),d.updateTimeout.unref&&d.updateTimeout.unref())}o(w,"updateLock");function v(p,c,d){c.released=!0,c.updateTimeout&&clearTimeout(c.updateTimeout),l[p]===c&&delete l[p],c.options.onCompromised(d)}o(v,"setLockAsCompromised");function x(p,c,d){c={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:o(E=>{throw E},"onCompromised"),...c},c.retries=c.retries||0,c.retries=typeof c.retries=="number"?{retries:c.retries}:c.retries,c.stale=Math.max(c.stale||0,2e3),c.update=c.update==null?c.stale/2:c.update||0,c.update=Math.max(Math.min(c.update,c.stale/2),1e3),h(p,c,(E,C)=>{if(E)return d(E);let _=s.operation(c.retries);_.attempt(()=>{f(C,c,(R,M,Q)=>{if(_.retry(R))return;if(R)return d(_.mainError());let rt=l[C]={lockfilePath:u(C,c),mtime:M,mtimePrecision:Q,options:c,lastUpdate:Date.now()};w(C,c),d(null,ee=>{if(rt.released)return ee&&ee(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));b(C,{...c,realpath:!1},ee)})})})})}o(x,"lock");function b(p,c,d){c={fs:i,realpath:!0,...c},h(p,c,(E,C)=>{if(E)return d(E);let _=l[C];if(!_)return d(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));_.updateTimeout&&clearTimeout(_.updateTimeout),_.released=!0,delete l[C],m(C,c,d)})}o(b,"unlock");function S(p,c,d){c={stale:1e4,realpath:!0,fs:i,...c},c.stale=Math.max(c.stale||0,2e3),h(p,c,(E,C)=>{if(E)return d(E);c.fs.stat(u(C,c),(_,R)=>_?_.code==="ENOENT"?d(null,!1):d(_):d(null,!g(R,c)))})}o(S,"check");function y(){return l}o(y,"getLocks"),n(()=>{for(let p in l){let c=l[p].options;try{c.fs.rmdirSync(u(p,c))}catch{}}}),t.exports.lock=x,t.exports.unlock=b,t.exports.check=S,t.exports.getLocks=y}}),vt=P({"node_modules/proper-lockfile/lib/adapter.js"(e,t){"use strict";var r=fe();function i(l){let u=["mkdir","realpath","stat","rmdir","utimes"],h={...l};return u.forEach(f=>{h[f]=(...g)=>{let m=g.pop(),w;try{w=l[`${f}Sync`](...g)}catch(v){return m(v)}m(null,w)}}),h}o(i,"createSyncFs");function s(l){return(...u)=>new Promise((h,f)=>{u.push((g,m)=>{g?f(g):h(m)}),l(...u)})}o(s,"toPromise");function n(l){return(...u)=>{let h,f;if(u.push((g,m)=>{h=g,f=m}),l(...u),h)throw h;return f}}o(n,"toSync");function a(l){if(l={...l},l.fs=i(l.fs||r),typeof l.retries=="number"&&l.retries>0||l.retries&&typeof l.retries.retries=="number"&&l.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return l}o(a,"toSyncOptions"),t.exports={toPromise:s,toSync:n,toSyncOptions:a}}}),ye=P({"node_modules/proper-lockfile/index.js"(e,t){"use strict";var r=gt(),{toPromise:i,toSync:s,toSyncOptions:n}=vt();async function a(m,w){let v=await i(r.lock)(m,w);return i(v)}o(a,"lock");function l(m,w){let v=s(r.lock)(m,n(w));return s(v)}o(l,"lockSync");function u(m,w){return i(r.unlock)(m,w)}o(u,"unlock");function h(m,w){return s(r.unlock)(m,n(w))}o(h,"unlockSync");function f(m,w){return i(r.check)(m,w)}o(f,"check");function g(m,w){return s(r.check)(m,n(w))}o(g,"checkSync"),t.exports=a,t.exports.lock=a,t.exports.unlock=u,t.exports.lockSync=l,t.exports.unlockSync=h,t.exports.check=f,t.exports.checkSync=g}}),L={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603},A=class extends Error{static{o(this,"McpError")}code;data;constructor(e,t,r){super(t),this.name="McpError",this.code=e,this.data=r}},I=class extends Error{static{o(this,"McpConnectionClosedError")}constructor(e="MCP connection closed"){super(e),this.name="McpConnectionClosedError"}},wt=class extends Error{static{o(this,"McpTimeoutError")}timeoutMs;constructor(e){super(`MCP request timed out after ${e}ms`),this.name="McpTimeoutError",this.timeoutMs=e}},ie=class extends Error{static{o(this,"McpAbortError")}constructor(e="MCP request aborted"){super(e),this.name="AbortError"}};function T(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(T,"isObject");function F(e){return e instanceof Error?e:new Error(String(e))}o(F,"toError");function B(e){return typeof e=="string"||typeof e=="number"&&Number.isFinite(e)}o(B,"isJsonRpcId");function se(e){return T(e)&&e.jsonrpc==="2.0"&&B(e.id)&&typeof e.method=="string"}o(se,"isJsonRpcRequest");function ge(e){return T(e)&&e.jsonrpc==="2.0"&&!("id"in e)&&typeof e.method=="string"}o(ge,"isJsonRpcNotification");function ne(e){return!T(e)||e.jsonrpc!=="2.0"||!B(e.id)?!1:"result"in e?!("error"in e):!("error"in e)||!T(e.error)?!1:typeof e.error.code=="number"&&typeof e.error.message=="string"}o(ne,"isJsonRpcResponse");function G(e){if(se(e)||ge(e)||ne(e))return e;throw new A(L.invalidRequest,"Invalid JSON-RPC message")}o(G,"parseJsonRpcMessage");var oe="2025-11-25",Et=[oe,"2025-06-18","2025-03-26","2024-11-05"],St=3e4,ve=1e3;function _t(e){if(!T(e)||typeof e.protocolVersion!="string"||!T(e.capabilities)||!T(e.serverInfo)||typeof e.serverInfo.name!="string"||typeof e.serverInfo.version!="string"||e.instructions!==void 0&&typeof e.instructions!="string")throw new A(L.invalidRequest,"Invalid MCP initialize result");return e}o(_t,"validateInitializeResult");function j(e){return new A(L.invalidRequest,e)}o(j,"invalid");function xt(e,t,r,i){let s=T(r)?r[t]:void 0;if(!T(r)||!Array.isArray(s))throw j(`Invalid MCP ${e} result`);for(let a of s)if(!T(a)||!i(a))throw j(`Invalid entry in MCP ${e} result`);let n=r.nextCursor===null||r.nextCursor===""?void 0:r.nextCursor;if(n!==void 0&&typeof n!="string")throw j(`Invalid MCP ${e} cursor`);return{items:s,...n===void 0?{}:{nextCursor:n}}}o(xt,"validateListPage");var bt=o(e=>typeof e.name=="string"&&T(e.inputSchema),"isTool"),we=o(e=>typeof e.uri=="string"&&(e.name===void 0||typeof e.name=="string"),"isResource"),Ee=o(e=>typeof e.uriTemplate=="string"&&(e.name===void 0||typeof e.name=="string"),"isResourceTemplate");function Se(e){return{...e,name:e.name??e.uri}}o(Se,"toResource");function _e(e){return{...e,name:e.name??e.uriTemplate}}o(_e,"toResourceTemplate");function xe(e){return e.nextCursor===void 0?{}:{nextCursor:e.nextCursor}}o(xe,"pageCursor");function Tt(e){if(!T(e)||!Array.isArray(e.contents))throw j("Invalid MCP resources/read result");for(let t of e.contents)if(!T(t)||typeof t.uri!="string"||typeof t.text!="string"&&typeof t.blob!="string")throw j("Invalid contents in MCP resources/read result");return e}o(Tt,"validateReadResourceResult");function Ct(e){if(!T(e)||e.content!==void 0&&!Array.isArray(e.content))throw new A(L.invalidRequest,"Invalid MCP tools/call result");return e.content===void 0?{...e,content:[]}:e}o(Ct,"validateCallToolResult");var Rt=class{static{o(this,"McpClient")}options;state="idle";transport;nextRequestId=1;serverInfoValue;serverCapabilitiesValue;instructionsValue;protocolVersionValue;pending=new Map;progressRequests=new Map;incoming=new Map;requestHandlers=new Map;notificationListeners=new Map;errorListeners=new Set;closeListeners=new Set;disposers=[];constructor(e){this.options=Object.freeze({...e}),this.requestHandlers.set("ping",()=>({}));let t=e.roots;t&&this.requestHandlers.set("roots/list",async()=>({roots:[...typeof t=="function"?await t():t]}))}get connectionState(){return this.state}get serverInfo(){return this.serverInfoValue}get serverCapabilities(){return this.serverCapabilitiesValue}get instructions(){return this.instructionsValue}get protocolVersion(){return this.protocolVersionValue}async connect(e){if(this.state!=="idle")throw new Error(`Cannot connect MCP client in ${this.state} state`);this.state="connecting",this.transport=e,this.disposers=[e.onMessage(t=>this.handleMessage(t)),e.onError(t=>this.emitError(t)),e.onClose(()=>this.handleTransportClose())];try{await e.start();let t={...this.options.capabilities};this.options.roots&&t.roots===void 0&&(t.roots={});let r=_t(await this.requestInternal("initialize",{protocolVersion:this.options.protocolVersion??oe,capabilities:t,clientInfo:{name:this.options.name,version:this.options.version,...this.options.title===void 0?{}:{title:this.options.title}}},{},!0));if(!Et.includes(r.protocolVersion))throw new Error(`MCP server selected unsupported protocol version ${r.protocolVersion}`);return this.protocolVersionValue=r.protocolVersion,this.serverInfoValue=r.serverInfo,this.serverCapabilitiesValue=r.capabilities,this.instructionsValue=r.instructions,e.setProtocolVersion?.(r.protocolVersion),await this.notifyInternal("notifications/initialized",void 0,!0),this.state="connected",r}catch(t){throw await this.close().catch(()=>{}),t}}request(e,t,r={}){return this.requestInternal(e,t,r,!1)}notify(e,t){return this.notifyInternal(e,t,!1)}setRequestHandler(e,t){return this.requestHandlers.set(e,t),()=>{this.requestHandlers.get(e)===t&&this.requestHandlers.delete(e)}}onNotification(e,t){let r=this.notificationListeners.get(e)??new Set;return this.notificationListeners.set(e,r),r.add(t),()=>{r.delete(t),r.size===0&&this.notificationListeners.delete(e)}}onError(e){return this.errorListeners.add(e),()=>this.errorListeners.delete(e)}onClose(e){return this.closeListeners.add(e),()=>this.closeListeners.delete(e)}async ping(e={}){await this.request("ping",void 0,e)}async listTools(e={}){return await this.listAll("tools/list","tools",bt,e)}async listResources(e={}){return(await this.listAll("resources/list","resources",we,e)).map(Se)}async listResourcesPage(e,t={}){let r=await this.listPage("resources/list","resources",we,e,t);return{resources:r.items.map(Se),...xe(r)}}async listResourceTemplates(e={}){return(await this.listAll("resources/templates/list","resourceTemplates",Ee,e)).map(_e)}async listResourceTemplatesPage(e,t={}){let r=await this.listPage("resources/templates/list","resourceTemplates",Ee,e,t);return{resourceTemplates:r.items.map(_e),...xe(r)}}async readResource(e,t={}){return Tt(await this.request("resources/read",{uri:e},t))}async listPage(e,t,r,i,s){return xt(e,t,await this.request(e,i===void 0?void 0:{cursor:i},s),r)}async listAll(e,t,r,i){let s=[],n=new Set,a;for(let l=0;l<ve;l++){let u=await this.listPage(e,t,r,a,i);if(s.push(...u.items),u.nextCursor===void 0)return s;if(n.has(u.nextCursor))throw new Error(`MCP ${e} returned duplicate cursor: ${u.nextCursor}`);n.add(u.nextCursor),a=u.nextCursor}throw new Error(`MCP ${e} exceeded ${ve} pages`)}async callTool(e,t,r={}){return Ct(await this.request("tools/call",{name:e,...t===void 0?{}:{arguments:t}},r))}async close(){let e=this.transport;this.transport=void 0,this.disposeTransportListeners(),this.markClosed(new I),await e?.close()}async requestInternal(e,t,r,i){let s=this.requireTransport(i);if(r.signal?.aborted)throw new ie;let n=this.nextRequestId++,a=r.onProgress?n:void 0,l=a===void 0?t:{...t,_meta:{...T(t?._meta)?t._meta:{},progressToken:a}},u={jsonrpc:"2.0",id:n,method:e,...l===void 0?{}:{params:l}};return new Promise((h,f)=>{let g={resolve:h,reject:f,timeoutMs:r.timeoutMs??this.options.requestTimeoutMs??St,timer:void 0,signal:r.signal,onAbort:o(()=>this.cancelPending(n,new ie,e!=="initialize",String(r.signal?.reason??"Aborted")),"onAbort"),sendController:new AbortController,cancellable:e!=="initialize",onProgress:r.onProgress,progressToken:a};this.pending.set(n,g),a!==void 0&&this.progressRequests.set(a,n),r.signal?.addEventListener("abort",g.onAbort,{once:!0}),this.armTimeout(n,g),s.send(u,{signal:g.sendController.signal}).catch(m=>this.cancelPending(n,m,!1))})}async notifyInternal(e,t,r){await this.requireTransport(r).send({jsonrpc:"2.0",method:e,...t===void 0?{}:{params:t}})}requireTransport(e){if(this.transport&&(this.state==="connected"||e&&this.state==="connecting"))return this.transport;throw new I(`MCP client is ${this.state}`)}handleMessage(e){if(ne(e)){this.handleResponse(e);return}if(se(e)){this.handleRequest(e);return}if(ge(e)){this.handleNotification(e.method,e.params);return}this.emitError(new A(L.invalidRequest,"Received invalid JSON-RPC message"))}handleResponse(e){let t=this.pending.get(e.id);if(!t){this.emitError(new Error(`Received response for unknown MCP request ${String(e.id)}`));return}this.removePending(e.id,t),"error"in e?t.reject(new A(e.error.code,e.error.message,e.error.data)):t.resolve(e.result)}async handleRequest(e){let t=this.transport;if(!t)return;let r=this.requestHandlers.get(e.method);if(!r){await t.send({jsonrpc:"2.0",id:e.id,error:{code:L.methodNotFound,message:`Method not found: ${e.method}`}}).catch(s=>this.emitError(s));return}let i=new AbortController;this.incoming.set(e.id,i);try{let s=await r(e.params,{signal:i.signal});await t.send({jsonrpc:"2.0",id:e.id,result:s??{}})}catch(s){let n=s instanceof A?{code:s.code,message:s.message,data:s.data}:{code:L.internalError,message:F(s).message};await t.send({jsonrpc:"2.0",id:e.id,error:n}).catch(a=>this.emitError(a))}finally{this.incoming.delete(e.id)}}handleNotification(e,t){e==="notifications/progress"?this.handleProgress(t):e==="notifications/cancelled"&&this.handleCancelled(t);for(let r of this.notificationListeners.get(e)??[])try{r(t)}catch(i){this.emitError(i)}}handleProgress(e){if(!T(e)||!B(e.progressToken)||typeof e.progress!="number")return;let t=this.progressRequests.get(e.progressToken),r=t===void 0?void 0:this.pending.get(t);if(!(t===void 0||!r)){this.armTimeout(t,r);try{r.onProgress?.(e)}catch(i){this.emitError(i)}}}handleCancelled(e){T(e)&&B(e.requestId)&&this.incoming.get(e.requestId)?.abort(e.reason)}armTimeout(e,t){t.timer&&clearTimeout(t.timer),!(!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)&&(t.timer=setTimeout(()=>{this.cancelPending(e,new wt(t.timeoutMs),t.cancellable,"Request timed out")},t.timeoutMs))}cancelPending(e,t,r,i){let s=this.pending.get(e);s&&(this.removePending(e,s),s.reject(t),r&&this.transport&&this.transport.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:e,...i?{reason:i}:{}}}).catch(n=>this.emitError(n)))}removePending(e,t){this.pending.delete(e),t.timer&&clearTimeout(t.timer),t.progressToken!==void 0&&this.progressRequests.delete(t.progressToken),t.signal?.removeEventListener("abort",t.onAbort),t.sendController.abort()}rejectPending(e){for(let[t,r]of this.pending)this.removePending(t,r),r.reject(e)}handleTransportClose(){this.markClosed(new I)}markClosed(e){let t=this.state==="closed";this.state="closed",this.rejectPending(e);for(let r of this.incoming.values())r.abort(e);if(this.incoming.clear(),!t)for(let r of[...this.closeListeners])try{r()}catch(i){this.emitError(i)}}emitError(e){let t=F(e);for(let r of this.errorListeners)r(t)}disposeTransportListeners(){for(let e of this.disposers.splice(0))e()}},Mt=me(lt(),1);import{spawn as Pt}from"node:child_process";import O from"node:process";var H=16*1024*1024,be=class{static{o(this,"TransportEvents")}messageListeners=new Set;errorListeners=new Set;closeListeners=new Set;closeEmitted=!1;onMessage(e){return this.messageListeners.add(e),()=>this.messageListeners.delete(e)}onError(e){return this.errorListeners.add(e),()=>this.errorListeners.delete(e)}onClose(e){return this.closeListeners.add(e),()=>this.closeListeners.delete(e)}emitMessage(e){for(let t of this.messageListeners)t(e)}emitError(e){let t=F(e);for(let r of this.errorListeners)r(t)}emitClose(){if(!this.closeEmitted){this.closeEmitted=!0;for(let e of this.closeListeners)e()}}},Lt=64*1024,At=class{static{o(this,"JsonRpcLineReader")}options;stdoutChunks=[];stdoutPendingBytes=0;stderrBuffer=Buffer.alloc(0);constructor(e){this.options=e}get stderr(){return this.stderrBuffer.toString("utf8")}readStdout(e){let t=Buffer.from(e.buffer,e.byteOffset,e.byteLength),r=this.options.maxMessageBytes??H,i=0;for(;;){let s=t.indexOf(10,i);if(s<0){i<t.length&&(this.stdoutChunks.push(Buffer.from(t.subarray(i))),this.stdoutPendingBytes+=t.length-i),this.stdoutPendingBytes>r&&(this.stdoutChunks=[],this.stdoutPendingBytes=0,this.options.onError(new Error(`MCP stdio message exceeds ${r} bytes`)));return}let n=t.subarray(i,s);if(this.stdoutChunks.length>0&&(this.stdoutChunks.push(n),n=Buffer.concat(this.stdoutChunks,this.stdoutPendingBytes+n.length),this.stdoutChunks=[],this.stdoutPendingBytes=0),i=s+1,n.length>r){this.options.onError(new Error(`MCP stdio message exceeds ${r} bytes`));continue}let a=n.toString("utf8").replace(/\r$/,"");if(a.trim())try{this.options.onMessage(G(JSON.parse(a)))}catch(l){this.options.onError(l)}}}readStderr(e){let t=this.options.maxStderrBytes??Lt;this.stderrBuffer=Buffer.concat([this.stderrBuffer,e]),this.stderrBuffer.length>t&&(this.stderrBuffer=this.stderrBuffer.subarray(-t)),this.options.onStderr?.(Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"))}end(){Buffer.concat(this.stdoutChunks).toString("utf8").trim()&&this.options.onError(new Error("MCP stdio server closed with an incomplete JSON-RPC message")),this.stdoutChunks=[],this.stdoutPendingBytes=0}},It=2e3,kt=500,z=O.platform!=="win32",ae=new Set,Te=!1;function le(e,t){let r=e.pid;if(O.platform==="win32"&&r!==void 0){if(e.exitCode!==null)return;Pt("taskkill",["/pid",String(r),"/T","/F"],{stdio:"ignore",windowsHide:!0}).on("error",()=>{});return}if(z&&r!==void 0)try{O.kill(-r,t);return}catch{}try{e.kill(t)}catch{}}o(le,"killProcessTree");function Ot(){Te||(Te=!0,O.once("exit",()=>{for(let e of ae)try{O.kill(-e,"SIGTERM")}catch{}}))}o(Ot,"installExitHook");var $t=class extends be{static{o(this,"StdioTransport")}options;child;lines;started=!1;closed=!1;constructor(e){super(),this.options=Object.freeze({...e,args:e.args?[...e.args]:void 0}),this.lines=new At({maxMessageBytes:this.options.maxMessageBytes,maxStderrBytes:this.options.maxStderrBytes,onStderr:this.options.onStderr,onMessage:o(t=>this.emitMessage(t),"onMessage"),onError:o(t=>this.emitError(t),"onError")})}get pid(){return this.child?.pid}get stderr(){return this.lines.stderr}async start(){if(this.started)throw new Error("MCP stdio transport already started");if(this.closed)throw new I;this.started=!0;let e=this.options.inheritEnv===!1?{...this.options.env}:{...O.env,...this.options.env},t=(0,Mt.default)(this.options.command,this.options.args??[],{cwd:this.options.cwd,env:e,stdio:["pipe","pipe",this.options.stderr==="inherit"?"inherit":"pipe"],windowsHide:!0,detached:z});this.child=t;let r=t.pid;z&&r!==void 0&&(Ot(),ae.add(r),t.once("close",()=>ae.delete(r))),t.stdout?.on("data",i=>this.lines.readStdout(i)),t.stdout?.on("error",i=>this.emitError(i)),t.stdin?.on("error",i=>{this.closed||this.emitError(i)}),t.stderr?.on("data",i=>this.lines.readStderr(i)),t.stderr?.on("error",i=>this.emitError(i)),t.on("close",()=>{this.child=void 0,this.lines.end(),this.emitClose()}),await new Promise((i,s)=>{let n=o(()=>{t.off("error",a),i()},"onSpawn"),a=o(l=>{t.off("spawn",n),s(l)},"onError");t.once("spawn",n),t.once("error",a)}),t.on("error",i=>{this.closed||this.emitError(i)})}async send(e){let t=this.child?.stdin;if(!this.started||this.closed||!t?.writable)throw new I;let r=`${JSON.stringify(e)}
|
|
2
2
|
`;await new Promise((i,s)=>{t.write(r,n=>n?s(n):i())})}async close(){if(this.closed)return;this.closed=!0;let e=this.child;if(!e){this.emitClose();return}if(!z&&(e.exitCode!==null||e.signalCode!==null)){e.stdin?.end();return}let t=this.options.closeTimeoutMs??It;await new Promise(r=>{let i=[];e.once("close",()=>{for(let n of i)clearTimeout(n);le(e,"SIGTERM"),r()});let s=Math.min(kt,t);i.push(setTimeout(()=>le(e,"SIGTERM"),s)),i.push(setTimeout(()=>le(e,"SIGKILL"),s+t)),e.stdin?.end()})}},Dt=8*1024,Ce=500,Nt=1e3,jt=3e4,qt=5;async function Ut(e,t){let r=e.getReader(),i=new TextDecoder,s="",n,a,l=[],u=0,h=t.maxEventBytes??H,f=o(()=>{if(l.length===0){n=void 0,a=void 0;return}let v=l.join(`
|
|
3
3
|
`);t.onEvent({...n?{event:n}:{},data:v,...a?{id:a}:{}}),n=void 0,a=void 0,l=[],u=0},"dispatch"),g=o(v=>{if(v===""){f();return}if(v.startsWith(":"))return;let x=v.indexOf(":"),b=x<0?v:v.slice(0,x),S=x<0?"":v.slice(x+1);if(S.startsWith(" ")&&(S=S.slice(1)),b==="data"){if(u+=Buffer.byteLength(S)+(l.length>0?1:0),u>h)throw new Error(`MCP SSE event exceeds ${h} bytes`);l.push(S)}else b==="event"?n=S:b==="id"&&!S.includes("\0")?(a=S,t.onId?.(S)):b==="retry"&&/^\d+$/.test(S)&&t.onRetry?.(Number(S))},"processLine"),m=!1,w=o(()=>{let v=0;for(let x=0;x<s.length;x++){let b=s[x];b!=="\r"&&b!==`
|
|
4
4
|
`||(g(s.slice(v,x)),b==="\r"&&(x+1<s.length?s[x+1]===`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Le=Object.defineProperty;var a=(e,t)=>Le(e,"name",{value:t,configurable:!0});import{createRequire as Ie}from"node:module";const Dr=Ie(import.meta.url);import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as De,typebox_exports as T}from"./chunk-3YGHTGYM.js";import{fill as E,sanitizeBinaryOutput as Pe}from"./chunk-SE42OS3U.js";import{CodeHighlighter as Fe,Container as V,Spacer as I,Text as $,getCapabilities as Y,getImageDimensions as je,hyperlink as We,imageFallback as Be,keyHint as K,truncateToWidth as Ue}from"./chunk-EH7SFF47.js";import{getDocsPath as He,resolvePath as Ge,shortenHomePath as Je}from"./chunk-R47JBGS3.js";import{t as g}from"./chunk-
|
|
1
|
+
var Le=Object.defineProperty;var a=(e,t)=>Le(e,"name",{value:t,configurable:!0});import{createRequire as Ie}from"node:module";const Dr=Ie(import.meta.url);import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as De,typebox_exports as T}from"./chunk-3YGHTGYM.js";import{fill as E,sanitizeBinaryOutput as Pe}from"./chunk-SE42OS3U.js";import{CodeHighlighter as Fe,Container as V,Spacer as I,Text as $,getCapabilities as Y,getImageDimensions as je,hyperlink as We,imageFallback as Be,keyHint as K,truncateToWidth as Ue}from"./chunk-EH7SFF47.js";import{getDocsPath as He,resolvePath as Ge,shortenHomePath as Je}from"./chunk-R47JBGS3.js";import{t as g}from"./chunk-XRF4A4KI.js";import{createWriteStream as ze}from"node:fs";import{writeFile as qe}from"node:fs/promises";import{randomBytes as Xe}from"node:crypto";import{lstatSync as Ze,mkdtempSync as Ve,readdirSync as Ye,rmSync as Q}from"node:fs";import{tmpdir as D}from"node:os";import{join as P}from"node:path";var Ke=1440*60*1e3,Qe=10080*60*1e3,et=/^(?:dal-(?:sandbox|bg|bash|powershell|output|mxc)|pi-codemode|pi-mcp)-(\d+)-/,tt=/^(?:dal-(?:sandbox|mxc)-[A-Za-z0-9]{6}|(?:dal-(?:bash|powershell|output)|pi-codemode|pi-mcp)-[0-9a-f]{16}(?:\.[A-Za-z0-9]+)?)$/,O=new Set,ee=!1;function te(e){try{Q(e,{recursive:!0,force:!0})}catch{}}a(te,"removePath");function rt(){for(let e of O)te(e);O.clear()}a(rt,"cleanupOwnedTempFiles");function nt(){ee||(ee=!0,process.on("exit",rt))}a(nt,"installExitHook");function F(e){nt(),O.add(e)}a(F,"registerTempPath");function it(e){O.delete(e),te(e)}a(it,"removeTempPath");function ot(e){let t=Ve(P(D(),`dal-${e}-${process.pid}-`));return F(t),t}a(ot,"createTempDir");function at(e,t,r=D()){return P(r,`${e}-${process.pid}-${Xe(8).toString("hex")}${t}`)}a(at,"tempFilePath");function st(e){if(e===process.pid)return!0;try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}a(st,"processExists");function lt(e={}){let t=e.dir??D(),r=e.now??Date.now(),n=e.maxAgeMs??Ke,i=e.legacyMaxAgeMs??Qe,o=e.exists??st,s=process.getuid?.(),c={removed:[],kept:0},l;try{l=Ye(t)}catch{return c}for(let p of l){let d=et.exec(p),u=!d&&tt.test(p);if(!d&&!u)continue;let m=P(t,p);try{let f=Ze(m);if(s!==void 0&&f.uid!==s)continue;if(!(r-f.mtimeMs>=(d?n:i))||d&&o(Number(d[1]))){c.kept++;continue}Q(m,{recursive:!0,force:!0}),c.removed.push(m)}catch{}}return c}a(lt,"sweepStaleTempFiles");var re=384,C;function ut(e){return C=e,()=>{C===e&&(C=void 0)}}a(ut,"setOutputFileDirectory");function ne(e,t){let r=C?.(),n=at(e,t,r);return r||F(n),n}a(ne,"createOutputFilePath");async function ct(e,t,r){let n=ne(e,t);return await qe(n,r,{mode:re,flag:"wx"}),n}a(ct,"writeOutputFile");function dt(e,t){let r=ne(e,t);return{path:r,stream:ze(r,{mode:re,flags:"wx"})}}a(dt,"createOutputFileStream");function ie(){return{input:0,output:0,cacheRead:0,cacheWrite:0,cost:0}}a(ie,"createUsageTotals");function oe(e,t){e.input+=t.input,e.output+=t.output,e.cacheRead+=t.cacheRead,e.cacheWrite+=t.cacheWrite,e.cost+=t.cost.total}a(oe,"addUsageToTotals");function pt(e,t){return{input:e.input+t.input,output:e.output+t.output,cacheRead:e.cacheRead+t.cacheRead,cacheWrite:e.cacheWrite+t.cacheWrite,...e.cacheWrite1h!==void 0||t.cacheWrite1h!==void 0?{cacheWrite1h:(e.cacheWrite1h??0)+(t.cacheWrite1h??0)}:{},...e.reasoning!==void 0||t.reasoning!==void 0?{reasoning:(e.reasoning??0)+(t.reasoning??0)}:{},totalTokens:e.totalTokens+t.totalTokens,cost:{input:e.cost.input+t.cost.input,output:e.cost.output+t.cost.output,cacheRead:e.cost.cacheRead+t.cost.cacheRead,cacheWrite:e.cost.cacheWrite+t.cost.cacheWrite,total:e.cost.total+t.cost.total,totalFromProvider:e.cost.totalFromProvider===!0&&t.cost.totalFromProvider===!0}}}a(pt,"combineUsage");function mt(e){let t=new Map;for(let r of e){let n,i;if(r.type==="message"&&r.message.role==="assistant"?(n=`${r.message.provider}/${r.message.responseModel??r.message.model}`,i=r.message.usage):r.type==="usage"?(n=`${r.provider}/${r.model}`,i=r.usage):r.type==="message"&&r.message.role==="toolResult"&&r.message.usage?(n="Tools/summaries",i=r.message.usage):(r.type==="branch_summary"||r.type==="compaction")&&r.usage&&(n="Tools/summaries",i=r.usage),!n||!i)continue;let o=t.get(n);o||(o=ie(),t.set(n,o)),oe(o,i)}return Array.from(t,([r,n])=>({key:r,cost:n.cost,tokens:n.input+n.output+n.cacheRead+n.cacheWrite})).filter(r=>r.cost>0||r.tokens>0).sort((r,n)=>n.cost-r.cost)}a(mt,"getUsageCostBreakdown");function ae(e,t,r,n=0,i="end"){if(!e)return{visualLines:[],skippedCount:0};let o=new $(e,n,0).render(r);if(o.length<=t)return{visualLines:o,skippedCount:0};let s=i==="start"?o.slice(0,t):o.slice(-t),c=o.length-t;return{visualLines:s,skippedCount:c}}a(ae,"truncateToVisualLines");var j=class{static{a(this,"VisualLinePreview")}options;cachedWidth;cachedLines;constructor(e){this.options=e}render(e){if(this.cachedLines===void 0||this.cachedWidth!==e){let{text:t,maxVisualLines:r,keep:n,formatHint:i}=this.options,o=ae(t,r,e,0,n),s=o.visualLines;if(o.skippedCount>0){let c=Ue(i(o.skippedCount),e,"...");this.cachedLines=n==="start"?[...s,c]:[c,...s]}else this.cachedLines=s;this.cachedWidth=e}return this.cachedLines}invalidate(){this.cachedWidth=void 0,this.cachedLines=void 0}};import{pathToFileURL as ft}from"node:url";var gt="(?:\\u0007|\\u001B\\u005C|\\u009C)",se="\\u001B\\]",le="(?:(?:\\u001B\\[|\\u009B)[<=>]|[\\u001B\\u009B][[\\]()#;?]*)(?:\\d{1,4}(?:[;:]\\d{0,4})*)?",ht="[\\dA-PR-TZcf-nq-uy=><~]",yt=new RegExp(`(?:${se}[\\s\\S]*?${gt})|${le}${ht}`,"g"),St=new RegExp(`(?:${se}(?:[^\\u0007\\u009C\\u001B]|\\u001B(?!\\\\))*|${le})$`),At=256;function $t(e){if(!e.includes("\x1B")&&!e.includes("\x9B"))return{complete:e,pending:""};let t=Math.max(0,e.length-At),r=St.exec(e.slice(t));if(!r)return{complete:e,pending:""};let n=t+r.index;return{complete:e.slice(0,n),pending:e.slice(n)}}a($t,"splitIncompleteAnsiSuffix");function ue(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(yt,"")}a(ue,"stripAnsi");function ce(e){return typeof e!="string"?"":Je(e)}a(ce,"shortenPath");function Tt(e,t,r){if(!Y().hyperlinks)return e;let n=Ge(t,r);return We(e,ft(n).href)}a(Tt,"linkPath");function de(e){return typeof e=="string"?e:e==null?"":null}a(de,"str");function pe(e){return typeof e=="string"&&e.trim()!==""&&(e=Number(e)),typeof e=="number"&&Number.isFinite(e)?e:void 0}a(pe,"parseLineNumber");function wt(e,t){if(e==null&&t==null)return"";let r=e==null?1:pe(e);if(r===void 0)return"";if(t==null)return`:${r}`;let n=pe(t);if(n===void 0)return"";let i=r+n-1;return`:${r}${i?`-${i}`:""}`}a(wt,"formatReadLineRange");function k(e){return e.replace(/\t/g," ")}a(k,"replaceTabs");function vt(e){return e.replace(/\r/g,"")}a(vt,"normalizeDisplayText");function me(e,t){if(!e)return"";let r=e.content.filter(s=>s.type==="text"),n=e.content.filter(s=>s.type==="image"),i=r.map(s=>Pe(ue(s.text||"")).replace(/\r/g,"")).join(`
|
|
2
2
|
`),o=Y();if(n.length>0&&(!o.images||!t)){let s=n.map(c=>{let l=c.mimeType??"image/unknown",p=c.data&&c.mimeType?je(c.data,c.mimeType)??void 0:void 0;return Be(l,p)}).join(`
|
|
3
3
|
`);i=i?`${i}
|
|
4
4
|
${s}`:s}return i}a(me,"getTextOutput");var fe=100;function _t(e,t,r,n){let i=r.fg("toolTitle",r.bold(e));if(t==null)return i;let o=typeof t=="object"&&!Array.isArray(t)?Object.entries(t):[["args",t]];if(o.length===0)return i;if(n){let l=o.map(([p,d])=>{let u=typeof d=="string"?d:JSON.stringify(d,null,2)??String(d);return` ${p}: ${k(u).replace(/\r/g,"").split(`
|
|
@@ -31,7 +31,7 @@ Searches over deferred tool metadata with BM25 and exposes matching tools for th
|
|
|
31
31
|
|
|
32
32
|
Some of the tools, such as tools of MCP servers, may not have been provided to you upfront, and you should use this tool (\`${w}\`) to search for the required tools. For MCP tool discovery, always use \`${w}\`.`;function or(e={}){return{name:w,label:w,description:ir,promptSnippet:"Search for tools that are not loaded yet and load the matches",parameters:tr,exposure:"model-only",reachesTools:a(()=>"all","reachesTools"),async execute(t,{query:r,limit:n}){if(r.trim()==="")throw new Error("query must not be empty");let i=n??U;if(!Number.isInteger(i)||i<=0)throw new Error("limit must be a positive integer");let o=e.tools?nr(e.tools,r,i):[];return{content:[{type:"text",text:o.length===0?"No matching tools found.":`Loaded ${o.length} tool${o.length===1?"":"s"}. They are available from your next call:
|
|
33
33
|
${o.map(s=>`- ${s.name}: ${s.description.trim().split(/\r?\n/)[0]}`).join(`
|
|
34
|
-
`)}`}],details:{loaded:o.map(s=>s.name)}}}}}a(or,"createToolSearchToolDefinition");import{join as ar}from"node:path";var G={transport:"auto",sessionShareDestination:"auto",steeringMode:"one-at-a-time",followUpMode:"one-at-a-time",compaction:{enabled:!0,reserveTokens:16384,keepRecentTokens:2e4},branchSummary:{reserveTokens:16384,skipPrompt:!1},retry:{enabled:!0,maxRetries:3,baseDelayMs:2e3,maxAgentDelayMs:De,provider:{maxRetryDelayMs:6e4}},hideThinkingBlock:!1,showCacheMissNotices:!1,quietStartup:!1,defaultProjectTrust:"ask",collapseChangelog:!1,enableInstallTelemetry:!0,enableAnalytics:!1,enableSkillCommands:!0,terminal:{showImages:!0,imageWidthCells:60,clearOnShrink:!1,showTerminalProgress:!1},images:{autoResize:!0,blockImages:!1},doubleEscapeAction:"tree",treeFilterMode:"default",editorPaddingX:0,outputPad:1,autocompleteMaxVisible:5,markdown:{codeBlockIndent:" ",mermaid:"streaming"},warnings:{anthropicExtraUsage:!0},codemode:{mode:"on",inlineBudget:3e3},cacheWarming:"idle",tuiMode:"fullscreen",fullscreenExitOutput:"transcript",fullscreenScrollbar:"auto",fullscreenCopyOnSelect:!0,fullscreenWheelScrollLines:"auto"};function sr(e,t){return{name:e.name,label:e.label,description:e.description,parameters:e.parameters,outputSchema:e.outputSchema,constrainedSampling:e.constrainedSampling,prepareArguments:e.prepareArguments,executionMode:e.executionMode,executionModeFor:e.executionModeFor,execute:a((r,n,i,o,s)=>e.execute(r,n,i,o,s??t?.(r,i)),"execute")}}a(sr,"wrapToolDefinition");function lr(e){return{name:e.name,label:e.label,description:e.description,parameters:e.parameters,outputSchema:e.outputSchema,constrainedSampling:e.constrainedSampling,prepareArguments:e.prepareArguments,executionMode:e.executionMode,executionModeFor:e.executionModeFor,execute:a(async(t,r,n,i)=>e.execute(t,r,n,i),"execute")}}a(lr,"createToolDefinitionFromAgentTool");var ur=a(()=>import("./execute-
|
|
34
|
+
`)}`}],details:{loaded:o.map(s=>s.name)}}}}}a(or,"createToolSearchToolDefinition");import{join as ar}from"node:path";var G={transport:"auto",sessionShareDestination:"auto",steeringMode:"one-at-a-time",followUpMode:"one-at-a-time",compaction:{enabled:!0,reserveTokens:16384,keepRecentTokens:2e4},branchSummary:{reserveTokens:16384,skipPrompt:!1},retry:{enabled:!0,maxRetries:3,baseDelayMs:2e3,maxAgentDelayMs:De,provider:{maxRetryDelayMs:6e4}},hideThinkingBlock:!1,showCacheMissNotices:!1,quietStartup:!1,defaultProjectTrust:"ask",collapseChangelog:!1,enableInstallTelemetry:!0,enableAnalytics:!1,enableSkillCommands:!0,terminal:{showImages:!0,imageWidthCells:60,clearOnShrink:!1,showTerminalProgress:!1},images:{autoResize:!0,blockImages:!1},doubleEscapeAction:"tree",treeFilterMode:"default",editorPaddingX:0,outputPad:1,autocompleteMaxVisible:5,markdown:{codeBlockIndent:" ",mermaid:"streaming"},warnings:{anthropicExtraUsage:!0},codemode:{mode:"on",inlineBudget:3e3},cacheWarming:"idle",tuiMode:"fullscreen",fullscreenExitOutput:"transcript",fullscreenScrollbar:"auto",fullscreenCopyOnSelect:!0,fullscreenWheelScrollLines:"auto"};function sr(e,t){return{name:e.name,label:e.label,description:e.description,parameters:e.parameters,outputSchema:e.outputSchema,constrainedSampling:e.constrainedSampling,prepareArguments:e.prepareArguments,executionMode:e.executionMode,executionModeFor:e.executionModeFor,execute:a((r,n,i,o,s)=>e.execute(r,n,i,o,s??t?.(r,i)),"execute")}}a(sr,"wrapToolDefinition");function lr(e){return{name:e.name,label:e.label,description:e.description,parameters:e.parameters,outputSchema:e.outputSchema,constrainedSampling:e.constrainedSampling,prepareArguments:e.prepareArguments,executionMode:e.executionMode,executionModeFor:e.executionModeFor,execute:a(async(t,r,n,i)=>e.execute(t,r,n,i),"execute")}}a(lr,"createToolDefinitionFromAgentTool");var ur=a(()=>import("./execute-6PNQ63VS.js"),"loadCodemodeExecutor"),cr=10,dr=8,pr=5,Oe=80,mr=/^Script (completed|failed)\nWall time [\d.]+ seconds\nOutput:\n$/;function Ce(e,t){return`${e.fg("muted",E(g("\u2026\uFF08\u8FD8\u6709 {count} \u884C\uFF0C"),{count:t}))}${K("app.tools.expand",g("\u5C55\u5F00"))}${e.fg("muted",g("\uFF09"))}`}a(Ce,"expandHint");function fr(e){return e===void 0?"":e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}a(fr,"formatDuration");function ke(e){return`$${e>=.01?e.toFixed(2):e.toPrecision(2)}`}a(ke,"formatCost");function gr(e,t){switch(e.status){case"running":return t.fg("warning","\u2026");case"ok":return t.fg("success","\u2713");case"error":return t.fg("error","\u2717");case"cancelled":return t.fg("muted","\u2298")}}a(gr,"statusIcon");function hr(e,t,r){let n=!r&&e.args.length>Oe?`${e.args.slice(0,Oe-3)}...`:e.args,i=fr(e.durationMs),o=`${gr(e,t)} ${t.fg("toolTitle",e.name)}`;return n&&(o+=` ${t.fg("muted",n)}`),i&&(o+=` ${t.fg("dim",i)}`),e.cost&&(o+=` ${t.fg("dim",ke(e.cost))}`),r&&e.error&&(o+=`
|
|
35
35
|
${t.fg("error",e.error.split(`
|
|
36
36
|
`).join(`
|
|
37
37
|
`))}`),o}a(hr,"formatCall");var yr={renderCall(e,t,r){bt(r);let n=de(e?.code),i=t.fg("toolTitle",t.bold("codemode")),o=r.lastComponent??new V;if(o.clear(),n===null)return o.addChild(new $(`${i} ${t.fg("error",g("[\u53C2\u6570\u65E0\u6548]"))}`,0,0)),o;if(o.addChild(new $(i,0,0)),n){let s=r.state;s.scriptHighlighter??=new Fe;let c=s.scriptHighlighter.highlight(k(n.replace(/\r/g,"").trimEnd()),"javascript").join(`
|