@cline/shared 0.0.86-nightly.1790649045 → 0.0.87

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.
@@ -1,16 +1,16 @@
1
- import{z as K}from"zod";import{z as L}from"zod";import{z as M}from"zod";var Wf=["none","minimal","low","medium","high","xhigh","max"],yf=M.enum(Wf),_f=yf.exclude(["none"]),B6=M.enum([...Wf,"default"]).nullable(),Tf=M.discriminatedUnion("type",[M.object({type:M.literal("toggle")}).strict(),M.object({type:M.literal("effort"),values:M.array(B6)}).strict(),M.object({type:M.literal("budget_tokens"),min:M.number().min(-1).optional(),max:M.number().min(0).optional()}).strict().refine((f)=>f.min===void 0||f.max===void 0||f.min<=f.max,{message:"Minimum reasoning budget cannot exceed maximum",path:["min"]})]);var b0=L.enum(["default","openai-responses","r1"]),A6={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},M0=L.enum(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),y0=L.enum(["active","preview","deprecated","legacy"]),T0=L.object({input:L.number().optional(),output:L.number().optional(),cacheWrite:L.number().optional(),cacheRead:L.number().optional()}),E0=L.object({maxBudget:L.number().optional(),outputPrice:L.number().optional(),thinkingLevel:L.enum(["low","high"]).optional()}),S0=L.object({reasoningDefaultOn:L.boolean().optional(),apiProtocol:L.enum(["openai-chat","openai-responses","anthropic","gemini"]).optional()}).catchall(L.unknown()),Ef=L.enum(["text","image","audio","video","pdf"]),g0=L.object({input:L.array(Ef),output:L.array(Ef)});function v0(f){return(f?.input===void 0||f.input.includes("text"))&&(f?.output===void 0||f.output.includes("text"))}var n0=L.enum(["language","image-generation","speech-generation","video-generation","transcription","realtime"]);function N6(f){let $=f.modalities?.input,w=f.modalities?.output;return $?.length===1&&$[0]==="audio"&&w?.length===1&&w[0]==="text"}function C6(f){return(f.operation===void 0||f.operation==="language")&&v0(f.modalities)}var h0=L.enum(["batch","streaming"]);function b6(f){return f.modalities?.input.includes("text")===!0&&f.modalities.output.includes("image")}function M6(f){return f.operation==="image-generation"}function Sf(f,$,w){let Y=f.capabilities;if(Y===void 0||Y.length===0)return w?.assumeWhenUnspecified??!1;return Y.includes($)}function y6(f){return Sf(f,"tools",{assumeWhenUnspecified:!0})}function T6(f){return Sf(f,"images",{assumeWhenUnspecified:!0})}var Ff=L.object({id:L.string(),name:L.string().optional(),description:L.string().optional(),maxTokens:L.number().optional(),contextWindow:L.number().optional(),maxInputTokens:L.number().optional(),capabilities:L.array(M0).optional(),operation:n0.optional(),operationModes:L.array(h0).optional(),modalities:g0.optional(),reasoningOptions:L.array(Tf).optional(),apiFormat:b0.optional(),systemRole:L.enum(["system","developer"]).optional(),temperature:L.number().optional(),pricing:T0.optional(),thinkingConfig:E0.optional(),status:y0.optional(),deprecationNotice:L.string().optional(),replacedBy:L.string().optional(),releaseDate:L.string().optional(),deprecationDate:L.string().optional(),family:L.string().optional(),metadata:S0.optional()});import{z as g}from"zod";var E6="This tool call was rejected by the user and not executed.",S6="NOT a tool or system failure. Clarify with user before proceeding.",gf=g.object({id:g.string(),name:g.string(),execution:g.enum(["client","provider"]).optional(),input:g.unknown(),output:g.unknown(),error:g.string().optional(),durationMs:g.number(),startedAt:g.date(),endedAt:g.date()});var g6=K.enum(["completed","max_iterations","aborted","mistake_limit","error"]),v6=K.object({inputTokens:K.number(),outputTokens:K.number(),cacheReadTokens:K.number().optional(),cacheWriteTokens:K.number().optional(),totalCost:K.number().optional()}),i4=K.object({text:K.string(),usage:v6,messages:K.array(K.custom()),toolCalls:K.array(gf),iterations:K.number(),finishReason:g6,model:K.object({id:K.string(),provider:K.string(),info:Ff.optional()}),startedAt:K.date(),endedAt:K.date(),durationMs:K.number()}),a4=K.object({distinctId:K.string().optional(),sessionId:K.string().optional(),providerId:K.string(),modelId:K.string(),apiKey:K.string().optional(),baseUrl:K.string().url().optional(),headers:K.record(K.string(),K.string()).optional(),knownModels:K.record(K.string(),Ff).optional(),providerConfig:K.unknown().optional(),initialMessages:K.array(K.custom()).optional(),systemPrompt:K.string(),tools:K.array(K.custom()),modelTools:K.array(K.custom()).optional(),maxIterations:K.number().positive().optional(),maxParallelToolCalls:K.number().int().positive().default(8),maxTokensPerTurn:K.number().positive().optional(),temperature:K.number().nonnegative().optional(),apiTimeoutMs:K.number().positive().default(180000),userFileContentLoader:K.function().input([K.string()]).output(K.promise(K.string())).optional(),toolContextMetadata:K.record(K.string(),K.unknown()).optional(),execution:K.object({maxConsecutiveMistakes:K.number().int().positive().optional(),reminderAfterIterations:K.number().nonnegative().optional(),reminderText:K.string().optional(),loopDetection:K.union([K.literal(!1),K.object({softThreshold:K.number().int().positive().optional(),hardThreshold:K.number().int().positive().optional()})]).optional()}).optional(),reasoningEffort:_f.optional(),thinkingBudgetTokens:K.number().positive().optional(),thinking:K.boolean().optional(),onEvent:K.function().input([K.custom()]).output(K.void()).optional(),hooks:K.custom().optional(),parentAgentId:K.string().optional(),extensions:K.array(K.custom()).optional(),hookErrorMode:K.enum(["ignore","throw"]).default("ignore"),toolPolicies:K.record(K.string(),K.object({enabled:K.boolean().optional(),autoApprove:K.boolean().optional()})).optional(),requestToolApproval:K.function().input([K.object({sessionId:K.string(),agentId:K.string(),conversationId:K.string(),iteration:K.number(),toolCallId:K.string(),toolName:K.string(),input:K.unknown(),policy:K.object({enabled:K.boolean().optional(),autoApprove:K.boolean().optional()}).default({})})]).output(K.union([K.object({approved:K.boolean(),reason:K.string().optional()}),K.promise(K.object({approved:K.boolean(),reason:K.string().optional()}))])).optional(),onConsecutiveMistakeLimitReached:K.function().input([K.object({iteration:K.number().int().positive(),consecutiveMistakes:K.number().int().positive(),maxConsecutiveMistakes:K.number().int().positive(),reason:K.enum(["api_error","invalid_tool_call","tool_execution_failed"]),details:K.string().optional()})]).output(K.union([K.object({action:K.literal("continue"),guidance:K.string().optional()}),K.object({action:K.literal("stop"),reason:K.string().optional()}),K.promise(K.union([K.object({action:K.literal("continue"),guidance:K.string().optional()}),K.object({action:K.literal("stop"),reason:K.string().optional()})]))])).optional(),logger:K.custom().optional(),extensionContext:K.custom().optional(),abortSignal:K.custom().optional()});import{z as _}from"zod";var x0=_.enum(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),z0=_.object({id:_.string().optional(),label:_.string().optional(),role:_.string().optional(),participantKey:_.string().optional(),participantLabel:_.string().optional(),platformUserId:_.string().optional(),metadata:_.record(_.string(),_.unknown()).optional()}),c0=_.object({source:_.string(),sourceEvent:_.string(),threadId:_.string(),channelId:_.string(),isDM:_.boolean(),sessionId:_.string().optional(),workspaceRoot:_.string().optional(),metadata:_.record(_.string(),_.unknown()).optional()}),n6=_.object({actor:z0,context:c0,payload:_.record(_.string(),_.unknown()).optional()}),h6=_.object({action:_.enum(["allow","deny"]).default("allow"),message:_.string().optional(),reason:_.string().optional(),metadata:_.record(_.string(),_.unknown()).optional()}),x6=_.object({adapter:_.string(),botUserName:_.string().optional(),event:x0,payload:_.record(_.string(),_.unknown()),ts:_.string()});var u0=[{name:"discord",description:"Discord interactions and gateway bridge backed by RPC runtime sessions"},{name:"gchat",description:"Google Chat webhook bridge backed by RPC runtime sessions"},{name:"linear",description:"Linear webhook bridge backed by RPC runtime sessions"},{name:"slack",description:"Slack webhook/socket bridge backed by RPC runtime sessions"},{name:"telegram",description:"Bridge Telegram bot messages into RPC chat sessions"},{name:"whatsapp",description:"Bridge WhatsApp webhook messages into RPC chat sessions"}];function o0(){return u0.map((f)=>({...f}))}function z6(f,$){let w=f.includeWhen;if(!w)return!0;let Y=$[w.flag]??"";if(w.equals!==void 0&&Y!==w.equals)return!1;if(w.notEquals!==void 0&&Y===w.notEquals)return!1;return!0}function c6(f=l0){let $=new Set(o0().map((w)=>w.name));return f.filter((w)=>$.has(w.id)).map((w)=>({id:w.id,name:w.name,type:w.type,hint:w.hint,fields:w.fields.map((Y)=>({flag:Y.flag,label:Y.label,placeholder:Y.placeholder,required:Y.required,help:Y.help,initialValue:Y.initialValue,options:Y.options,includeWhen:Y.includeWhen})),security:w.security?{prompt:w.security.prompt,fields:w.security.fields.map((Y)=>({key:Y.key,label:Y.label,placeholder:Y.placeholder,help:Y.help,requiredMessage:Y.requiredMessage}))}:void 0}))}function u6(f){return/^\d+$/.test(f)?void 0:"Telegram user ID must contain digits only"}function o6(f){return/^T[A-Z0-9]+$/.test(f)?void 0:"Slack workspace ID must start with T and contain uppercase letters or digits only"}function l6(f){return/^[UW][A-Z0-9]+$/.test(f)?void 0:"Slack member ID must start with U or W and contain uppercase letters or digits only"}var l0=[{id:"telegram",name:"Telegram",type:"polling",hint:"Easiest to set up. No public URL needed.",derivedReconnectFlags:["-m","--bot-username"],fields:[{flag:"-k",aliases:["--bot-token"],label:"Bot token",placeholder:"7123456789:AAH...",required:!0,help:["Open Telegram and start a chat with @BotFather","Send /newbot and follow the prompts","BotFather gives you this after creating the bot","It looks like 7123456789:AAHxxx..."]}],security:{prompt:"By default, anyone who finds your bot can message it and run tasks on your machine. Restrict access to your Telegram user ID?",fields:[{key:"userId",label:"Your Telegram user ID",placeholder:"123456789",help:["Message @userinfobot on Telegram","It will reply with your numeric user ID"],requiredMessage:"User ID is required to restrict access",validate:u6}],argumentFlags:["--allowed-user-id","--hook-command"],buildArgs:({userId:f})=>["--allowed-user-id",f??""]}},{id:"slack",name:"Slack",type:"hybrid",hint:"Public URL for webhook mode; leave blank for socket mode.",fields:[{flag:"--bot-token",label:"Bot token",placeholder:"xoxb-...",required:!0,help:["Go to api.slack.com/apps and create a new app","Add Bot Token Scopes: chat:write, app_mentions:read, channels:history, channels:read, im:history, im:read, im:write, users:read","Install to workspace and copy the Bot Token"]},{flag:"--base-url",label:"Public base URL",placeholder:"leave blank for socket mode",help:["Enter a publicly accessible URL for webhook mode","Leave blank to use Slack socket mode instead"]},{flag:"--signing-secret",label:"Signing secret",required:!0,help:["Found in your app's Basic Information page"],includeWhen:{flag:"--base-url",notEquals:""}},{flag:"--app-token",label:"App-level token",placeholder:"xapp-...",required:!0,help:["Enable Socket Mode in the Slack app","Generate an app-level token with the connections:write scope"],includeWhen:{flag:"--base-url",equals:""}}],security:{prompt:"Restrict which Slack users can interact with the bot?",fields:[{key:"teamId",label:"Allowed Slack workspace ID",placeholder:"T01ABC123",help:["Open your Slack workspace URL in a browser","The workspace ID is the segment after /client/, for example T01ABC123"],requiredMessage:"Workspace ID is required to restrict access",validate:o6},{key:"userId",label:"Allowed Slack member ID",placeholder:"U01ABC123",help:["Click a user's name in Slack, then View full profile","Click ... and Copy member ID"],requiredMessage:"Member ID is required to restrict access",validate:l6}],argumentFlags:["--hook-command"],buildArgs:({teamId:f,userId:$})=>["--hook-command",`jq -r ".payload.actor.participantKey" | grep -qx "slack:team:${f}:user:${$}" && echo '{"action":"allow"}' || echo '{"action":"deny"}'`]}},{id:"discord",name:"Discord",type:"webhook",hint:"Requires a Discord app and public URL.",fields:[{flag:"--application-id",aliases:["--app-id"],label:"Application ID",required:!0,help:["Go to discord.com/developers/applications","Create a new app, copy the Application ID"]},{flag:"--bot-token",aliases:["--token"],label:"Bot token",required:!0,help:["Go to Bot section, create a bot, copy the token"]},{flag:"--public-key",label:"Public key",required:!0,help:["Found in General Information of your app"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0,help:["Base URL for the connector","For Discord, set the Interactions Endpoint URL to <base-url>/api/webhooks/discord"]}]},{id:"whatsapp",name:"WhatsApp",type:"webhook",hint:"Requires Meta developer account and public URL.",fields:[{flag:"--phone-number-id",label:"Phone number ID",required:!0,help:["From your WhatsApp Business account in Meta Developer portal"]},{flag:"--access-token",label:"Access token",required:!0,help:["Generate a permanent token in Meta Developer portal"]},{flag:"--app-secret",label:"App secret",required:!0,help:["Found in App Settings > Basic"]},{flag:"--verify-token",label:"Webhook verify token",placeholder:"my-verify-token",required:!0,help:["Any string you choose, used to verify webhook setup"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"gchat",name:"Google Chat",type:"webhook",hint:"Requires Google Cloud project and public URL.",fields:[{flag:"--credentials-json",label:"Service account credentials JSON",required:!0,help:["Create a service account in Google Cloud Console","Download the credentials JSON file","Paste the JSON content here"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"linear",name:"Linear",type:"webhook",hint:"React to Linear issues and comments.",fields:[{flag:"--api-key",label:"API key",required:!0,help:["Go to Linear Settings > API > Personal API keys"]},{flag:"--webhook-secret",label:"Webhook signing secret",required:!0,help:["Go to Settings > API > Webhooks, create one","Copy the signing secret"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]}];var m6=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],p6=new Set(m6);function d0(f,$){return f.name||`extension_${String($).padStart(4,"0")}`}function m0(f){return Array.isArray(f)&&f.every(($)=>typeof $==="string")}function p0(f){if(!Array.isArray(f))return;let $=f.filter((w)=>typeof w==="string").map((w)=>w.trim()).filter((w)=>w.length>0);return $.length>0?$:void 0}function r0(f){let $=p0(f.providerIds),w=p0(f.modelIds);return{...f,...$?{providerIds:$}:{},...w?{modelIds:w}:{}}}function d6(f,$){let w=d0(f,$),Y=f.manifest;if(!Y||typeof Y!=="object")throw Error(`Invalid manifest for extension "${w}": manifest is required`);if(!Array.isArray(Y.capabilities)||Y.capabilities.length===0)throw Error(`Invalid manifest for extension "${w}": capabilities must be a non-empty array`);let J=new Set;for(let H of Y.capabilities){if(!p6.has(H))throw Error(`Invalid manifest for extension "${w}": unsupported capability "${String(H)}"`);J.add(H)}if(Object.hasOwn(Y,"providerIds")&&!m0(Y.providerIds))throw Error(`Invalid manifest for extension "${w}": providerIds must be a string array when provided`);if(Object.hasOwn(Y,"modelIds")&&!m0(Y.modelIds))throw Error(`Invalid manifest for extension "${w}": modelIds must be a string array when provided`);let X=J.has("hooks");if(f.hooks!==void 0&&!X)throw Error(`Invalid manifest for extension "${w}": runtime hooks require the "hooks" capability`);return{capabilities:J,raw:r0(Y)}}function r6(f,$){if(!f||typeof f!=="object")throw Error(`Invalid automation event contribution for extension "${$}": expected object`);let w=typeof f.eventType==="string"?f.eventType.trim():"",Y=typeof f.source==="string"?f.source.trim():"";if(!w)throw Error(`Invalid automation event contribution for extension "${$}": eventType is required`);if(!Y)throw Error(`Invalid automation event contribution for extension "${$}": source is required`);return{...f,eventType:w,source:Y,examples:f.examples?[...f.examples]:void 0,metadata:f.metadata?{...f.metadata}:void 0}}class vf{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]};normalized=[];phase="resolve";setupContext;constructor(f={}){this.extensions=f.extensions??[],this.setupContext=f.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((f,$)=>({extension:f,order:$,manifest:{capabilities:new Set,raw:f.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((f)=>({...f,manifest:d6(f.extension,f.order)})),this.phase="setup"}async setup(f={}){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;let $,w=[];for(let Y of this.normalized){let{extension:J}=Y;if(J.disabled)continue;let X=d0(J,Y.order),G={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},H={registerTool:(V)=>G.tools.push(V),registerCommand:(V)=>G.commands.push(V),registerRule:(V)=>{if(!Y.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${X}": registerRule requires the "rules" capability`);G.rules.push(V)},registerMessageBuilder:(V)=>G.messageBuilder.push(V),registerProvider:(V)=>G.providers.push(V),registerAutomationEventType:(V)=>{if(!Y.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${X}": registerAutomationEventType requires the "automationEvents" capability`);G.automationEventTypes.push(r6(V,X))},registerMcpServer:(V)=>{if(!Y.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${X}": registerMcpServer requires the "mcp" capability`);G.mcpServers.push({...V,metadata:{...V.metadata??{},source:"plugin",plugin:X}})}},R=Y.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await J.setup?.(H,R),w.push(G)}catch(V){if(f.tolerateSetupErrors!==!0)throw V;$??=V}}if($&&f.tolerateSetupErrors!==!0)throw $;for(let Y of w)this.registry.tools.push(...Y.tools),this.registry.commands.push(...Y.commands),this.registry.rules.push(...Y.rules),this.registry.messageBuilder.push(...Y.messageBuilder),this.registry.providers.push(...Y.providers),this.registry.automationEventTypes.push(...Y.automationEventTypes),this.registry.mcpServers.push(...Y.mcpServers);if(this.phase="activate",$)throw $}activate(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase==="setup")throw Error("Contribution registry setup must complete before activation");if(this.phase!=="activate")return;this.phase="run"}async initialize(f={}){this.resolve(),this.validate();try{await this.setup(f)}finally{if(this.phase==="activate")this.activate()}}isActivated(){return this.phase==="run"}getRegistrySnapshot(){return{tools:[...this.registry.tools],commands:[...this.registry.commands],rules:[...this.registry.rules],messageBuilder:[...this.registry.messageBuilder],providers:[...this.registry.providers],automationEventTypes:[...this.registry.automationEventTypes],mcpServers:[...this.registry.mcpServers]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getRegisteredMcpServers(){return[...this.registry.mcpServers]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((f,$)=>f.order-$.order).map(({extension:f})=>f)}}function s6(f={}){return new vf(f)}var i6=[".js",".ts"];var a={CLINE_PASS:"ext-cline-pass",CODE_CLOUD_AGENTS:"code-cloud-agents",CODE_ONBOARDING_GITHUB:"code-onboarding-github",CLINE_COMPOSIO_BETA:"CLINE_COMPOSIO_BETA"},a6={[a.CLINE_PASS]:!1,[a.CODE_CLOUD_AGENTS]:!1,[a.CODE_ONBOARDING_GITHUB]:!1,[a.CLINE_COMPOSIO_BETA]:!1},t6=Object.values(a);import{z as Q}from"zod";var s0=Q.enum(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),l=Q.record(Q.string(),Q.string()),e6=Q.object({toolName:Q.string(),parameters:l}),f$=Q.object({toolName:Q.string(),parameters:l,result:Q.string(),success:Q.boolean(),executionTimeMs:Q.number()}),$$=Q.object({prompt:Q.string(),attachments:Q.array(Q.string())}),w$=Q.object({taskMetadata:l}),Y$=Q.object({taskMetadata:l,previousState:l}),Z$=Q.object({taskMetadata:l}),J$=Q.object({taskMetadata:l}),K$=Q.object({taskId:Q.string(),ulid:Q.string(),contextSize:Q.number(),compactionStrategy:Q.string(),previousApiReqIndex:Q.number(),tokensIn:Q.number(),tokensOut:Q.number(),tokensInCache:Q.number(),tokensOutCache:Q.number(),deletedRangeStart:Q.number(),deletedRangeEnd:Q.number(),contextJsonPath:Q.string(),contextRawPath:Q.string()}),i0=Q.object({clineVersion:Q.string(),hookName:s0,timestamp:Q.string(),taskId:Q.string(),sessionContext:Q.object({rootSessionId:Q.string().optional(),hookLogPath:Q.string().optional()}).optional(),workspaceRoots:Q.array(Q.string()),workspaceInfo:Q.custom().optional(),userId:Q.string(),agent_id:Q.string(),parent_agent_id:Q.string().nullable(),iteration:Q.number().optional(),reason:Q.string().optional(),tool_call:Q.object({id:Q.string(),name:Q.string(),input:Q.unknown()}).optional(),tool_result:Q.custom().optional(),turn:Q.unknown().optional(),error:Q.object({name:Q.string(),message:Q.string(),stack:Q.string().optional()}).optional(),preToolUse:e6.optional(),postToolUse:f$.optional(),userPromptSubmit:$$.optional(),taskStart:w$.optional(),taskResume:Y$.optional(),taskCancel:Z$.optional(),taskComplete:J$.optional(),preCompact:K$.optional()}).passthrough();function q$(f){let $=i0.safeParse(f);if(!$.success)return;return $.data}var H3="v1",Q3="v1",k3="v1",j3=["client.register","client.list","session.create","session.list","session.get","session.run","session.abort","schedule.create","schedule.list","task.create","task.list","task.get","task.update","task.approve","task.cancel","task.run","task.automation.get","task.automation.set","settings.get","settings.set","connector.start","connector.stop","connector.supervised","run.enqueue","run.list","hub.drain","hub.status","stream.replay"];function Df(f){let $=/^v(\d+)$/.exec(f?.trim()??"");if(!$)return;return Number.parseInt($[1]??"",10)}function R3(f,$="v1"){let w=Df(f.protocolVersion),Y=Df($);if(w===void 0||Y===void 0)return{compatible:!1,reason:"missing_protocol"};let J=Df(f.minClientProtocolVersion)??w,X=Df(f.maxClientProtocolVersion)??w;return Y>=J&&Y<=X?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var V3="approval.respond",W3="0",_3="__hubScheduleRunAt",a0=["act","plan","yolo"];function X$(f){return a0.some(($)=>$===f)}function F3(f,$){if(!f||!Object.hasOwn(f,"mode"))return $;let w=f.mode;if(X$(w))return w;throw Error(`mode must be one of: ${a0.join(", ")}`)}var G$=30000,D3=5000;function H$(f){switch(f){case"run.start":case"session.send_input":return null;default:return G$}}function L3(f,$){return $===void 0?H$(f):$}var Q$=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],k$=new Set(Q$);function U3(f){return typeof f==="string"&&k$.has(f)}var I3="tool_executor.",P3="custom_tool.",O3="hook.",B3="compaction.compact",A3="checkpoint.create",N3="mistake_limit.decide",C3="user_instructions.snapshot";function b3(f){let $=f.activeSessionCount;if(typeof $!=="number"||$<=0)return"active sessions from other Cline clients";let w=`${$} active session${$===1?"":"s"}`,Y=f.participantClientCount;if(typeof Y!=="number"||Y<=0)return w;return`${w} from ${Y} connected Cline client${Y===1?"":"s"}`}function nf(f,$){return`<file_content path="${f}">
2
- ${$}
3
- </file_content>`}function j$(f,$="act"){return`<user_input mode="${$}">${f}</user_input>`}function R$(f,$){return`<user_command slash="${$}">${f}</user_command>`}function V$(f,$){return`<mode_notice>The user switched from ${f} mode to ${$} mode before sending this message.</mode_notice>`}function W$(){let f=null;return{record($,w){if($===w)return;if(f){f=f.from===w?null:{from:f.from,to:w};return}f={from:$,to:w}},consume(){let $=f;return f=null,$}}}function _$(f,$){let w=f.trim(),Y=new RegExp(`^<${$}\\b([^>]*)>([\\s\\S]*?)<\\/${$}>$`,"i").exec(w);if(!Y)return;return{attrs:Y[1]??"",content:Y[2]??""}}function F$(f,$){return new RegExp(`${$}="([^"]+)"`,"i").exec(f)?.[1]?.trim()||void 0}function t0(f){if(!f?.trim())return;let $=_$(f,"user_command");if(!$)return;let w=F$($.attrs,"slash");if(!w)return;return{slash:w,content:$.content.trim()}}function e0(f){if(!f?.trim())return"";let $=f.trim();for(let w of["user_input","user_command"]){let Y=Z1($,w);$=(Y!==$?Y:$.replace(new RegExp(`<${w}[^>]*>`,"g"),"")).trim()}return $}function f1(f){if(!f?.trim())return"";return D$(f,"mode_notice").trim()}function D$(f,$){let w=`<${$}>`,Y=`</${$}>`,J=f,X=J.indexOf(w);while(X!==-1){let G=J.indexOf(Y,X+w.length);if(G===-1)break;J=J.slice(0,X)+J.slice(G+Y.length),X=J.indexOf(w,X)}return J}function hf(f){let $=f1(e0(f)),w=t0(f);if(!w)return $;if(w.slash.toLowerCase()==="team"){let J=$.toLowerCase().startsWith("spawn a team of agents for the following task:")?$.slice(46).trim():$;return J?`/team ${J}`:"/team"}return $?`/${w.slash} ${$}`:`/${w.slash}`}var $1=240,w1=480;function Y1(f,$){let w=f.replace(/\s+/gu," ").trim();if(w.length<=$)return w;return`${w.slice(0,$-1).trimEnd()}…`}function L$(f){return Y1(hf(f),$1)}function U$(f,$){let w=$?.trim()??"",Y=f.toLowerCase(),J=Y==="user"||Y==="session"?hf(w):w;return Y1(J,w1)}function Z1(f,$){if(!f?.trim())return"";if(!$)return f;let w=new RegExp(`<${$}\\b[^>]*>([\\s\\S]*?)</${$}>`,"g");return f.replace(w,"$1")}import{z as N}from"zod";var t="[media omitted: invalid or exceeds size limit]",e="[Image attached — this model cannot view images]",J1=N.enum(["image","audio","video","file"]),K1=N.discriminatedUnion("type",[N.object({type:N.literal("base64"),data:N.string().min(1)}),N.object({type:N.literal("url"),url:N.string().url().refine((f)=>{let $=new URL(f).protocol;return $==="http:"||$==="https:"},"Generated media URLs must use HTTP or HTTPS")}),N.object({type:N.literal("artifact"),artifactId:N.string().min(1)})]);function q1(f){if(f.startsWith("image/"))return"image";if(f.startsWith("audio/"))return"audio";if(f.startsWith("video/"))return"video";return"file"}var X1=N.object({id:N.string().min(1),modality:J1,mediaType:N.string().min(1),source:K1,name:N.string().min(1).optional(),sizeBytes:N.number().int().nonnegative().optional()}).refine((f)=>q1(f.mediaType)===f.modality,{message:"Generated media modality must match its media type",path:["modality"]});function I$(f){return X1.safeParse(f).success}function P$(f){return q1(f)}var Uf=["image/png","image/jpeg","image/gif","image/webp"],xf=5242880,v=xf,x=6291456,G1=8388608;function O$(f){return f.length}function zf(f){let $=f.endsWith("==")?2:f.endsWith("=")?1:0;return Math.floor(f.length*3/4)-$}function B$(f=xf){return Math.floor(f*3/4)}function cf(f){return Math.ceil(f/3)*4}function uf(f={}){return{maxImageEncodedBytes:f.maxImageEncodedBytes??v,maxImageDecodedBytes:f.maxImageDecodedBytes??x,maxTotalMediaBytes:f.maxTotalMediaBytes??G1}}function If(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function Lf(f,$){f.omittedImages+=1,f.omittedReasons[$]=(f.omittedReasons[$]??0)+1}function qf(f,$,w,Y){let J=uf(w);if(f>J.maxImageEncodedBytes){let X={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${J.maxImageEncodedBytes} byte encoded limit`};return Lf(Y,X.reason),X}if($>J.maxImageDecodedBytes){let X={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${J.maxImageDecodedBytes} byte decoded limit`};return Lf(Y,X.reason),X}if(Y.totalEncodedBytes+f>J.maxTotalMediaBytes){let X={ok:!1,reason:"total_limit",message:`Image media exceeds the ${J.maxTotalMediaBytes} byte total media limit`};return Lf(Y,X.reason),X}return Y.totalEncodedBytes+=f,Y.keptImages+=1,null}function H1(f){return f>=65&&f<=90||f>=97&&f<=122||f>=48&&f<=57||f===43||f===47}function A$(f){return f.length>0&&of(f,0,f.length)}function N$(f,$,w){let Y=Q1(f),J=Y.end-Y.start;if(J===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let X=uf($);if(w.totalEncodedBytes+J>X.maxTotalMediaBytes)return{ok:!1,reason:"total_limit",message:`Generated media exceeds the ${X.maxTotalMediaBytes} byte total media limit`};if(!of(f,Y.start,Y.end))return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let G=f.slice(Y.start,Y.end);return w.totalEncodedBytes+=J,{ok:!0,base64:G,encodedBytes:J,decodedBytes:zf(G)}}function of(f,$,w){let Y=w-$;if(Y%4!==0)return!1;let J=w;if(Y>=2&&f.charCodeAt(w-2)===61&&f.charCodeAt(w-1)===61)J-=2;else if(Y>=1&&f.charCodeAt(w-1)===61)J-=1;for(let X=$;X<J;X++)if(!H1(f.charCodeAt(X)))return!1;for(let X=J;X<w;X++)if(f.charCodeAt(X)!==61)return!1;return!0}function C$(f,$,w){return w-$>=5&&(f.charCodeAt($)|32)===100&&(f.charCodeAt($+1)|32)===97&&(f.charCodeAt($+2)|32)===116&&(f.charCodeAt($+3)|32)===97&&f.charCodeAt($+4)===58}function Q1(f){let $=0,w=f.length;while($<w&&/\s/.test(f[$]??""))$+=1;while(w>$&&/\s/.test(f[w-1]??""))w-=1;return{start:$,end:w}}function b$(f,$,w){if(!C$(f,$,w))return;let Y=$+5,J=f.indexOf(",",Y);if(J===-1||J>=w)return;if(J-Y>128)return;let X=f.slice(Y,J).toLowerCase(),G=";base64";if(!X.endsWith(G))return;let H=X.slice(0,-G.length);if(!H||H.includes(";"))return;return{mediaType:H,base64Start:J+1,base64End:w}}function k1(f,$,w={}){let Y=w.maxEncodedBytes??v,J=w.maxDecodedBytes??x,X=new Set(w.supportedMediaTypes??Uf),G=f?.toLowerCase(),H=Q1($),R=H.start,V=H.end,F=b$($,H.start,H.end);if(F){if(G&&G!==F.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${f} does not match data URL type ${F.mediaType}`};G=F.mediaType,R=F.base64Start,V=F.base64End}if(!G||!X.has(G))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${f??"unknown"}`};let D=V-R;if(D===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(D>Y)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${Y} byte encoded limit`};if(!of($,R,V))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let U=$.slice(R,V),C=zf(U);if(C>J)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${J} byte decoded limit`};return{ok:!0,mediaType:G,base64:U,encodedBytes:D,decodedBytes:C}}function Xf(f,$,w,Y){let J=k1(f,$,{maxEncodedBytes:w.maxImageEncodedBytes,maxDecodedBytes:w.maxImageDecodedBytes});if(!J.ok)return Lf(Y,J.reason),J;let X=qf(J.encodedBytes,J.decodedBytes,w,Y);if(X)return X;return J}function y(f){return f.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var Gf="ERROR: EMPTY CONTENT",M$="[image attached]",y$="[generated image]";function T$(f){return`[generated ${f}]`}function Pf(f){return{type:"text",text:`[generated ${f.modality} unavailable to this model]`}}function lf(f,$){let w=f[f.length-1];if($.role==="tool"&&w?.role==="tool"&&Array.isArray(w.content)&&Array.isArray($.content)){w.content.push(...$.content);return}f.push($)}function E$(f){if(!Array.isArray(f)||f.length===0)return!1;return f.every(($)=>{if(!$||typeof $!=="object")return!1;let w=$;if(w.type==="text")return typeof w.text==="string";if(w.type==="image")return typeof w.data==="string"&&typeof w.mediaType==="string";return!1})}function m(){return{type:"text",text:t}}function j1(f){return qf(v,0,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},f)===null}function V1(f){try{return new URL(f).protocol}catch{return}}function mf(f,$){let w=Xf(f.mediaType,f.data,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$);if(!w.ok)return m();return W1(w.base64,w.mediaType)}function W1(f,$){return{type:"file",data:{type:"data",data:f},mediaType:$}}function ff(f,$){return{type:"file",data:f,mediaType:$??"image"}}function pf(f,$){if(f.image instanceof URL){if(f.image.protocol==="data:"){let G=Xf(f.mediaType,f.image.href,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$);if(!G.ok)return m();return ff(`data:${G.mediaType};base64,${G.base64}`,G.mediaType)}if(f.image.protocol!=="http:"&&f.image.protocol!=="https:")return m();if(!j1($))return m();return ff(f.image,f.mediaType)}if(typeof f.image==="string"){let G=V1(f.image);if(G==="http:"||G==="https:"){if(!j1($))return m();return ff(f.image,f.mediaType)}let H=G==="data:",R=Xf(f.mediaType??(H?void 0:"image/png"),f.image,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$);if(!R.ok)return m();return ff(H?`data:${R.mediaType};base64,${R.base64}`:R.base64,R.mediaType)}let w=f.image.byteLength,Y=cf(w),J=f.mediaType?.toLowerCase()??"image/png";if(!Uf.includes(J)||qf(Y,w,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$))return m();return ff(f.image,J)}function S$(f,$){if(!$)return!0;if(f.modality==="file")return f.mediaType==="application/pdf"&&$.includes("pdf");return $.includes(f.modality)}function R1(f,$,w){if(!S$(f,w))return Pf(f);if(f.modality==="image"){if(f.source.type==="artifact")return Pf(f);return pf({type:"image",image:f.source.type==="url"?f.source.url:f.source.data,mediaType:f.mediaType},$)}if(f.source.type==="artifact")return Pf(f);if(f.source.type==="url"){let Y=V1(f.source.url);if(Y!=="http:"&&Y!=="https:"&&Y!=="data:")return Pf(f)}return ff(f.source.type==="url"?f.source.url:f.source.data,f.mediaType)}function df(f,$,w,Y){let{hoistImages:J,inlineImagePlaceholder:X}=Y;if(f==null||typeof f!=="object")return{value:f,changed:!1,mediaChanged:!1};if(Array.isArray(f)){let F=[],D=!1,U=!1;for(let C of f){if(C&&typeof C==="object"){let W=C;if(W.type==="image"&&typeof W.data==="string"&&typeof W.mediaType==="string"){if(!J){F.push(X),D=!0,U=!0;continue}let Cf={type:"image",data:W.data,mediaType:W.mediaType},d=mf(Cf,w);if(d.type==="file")$.push({type:"image",data:d.data.data,mediaType:d.mediaType});else F.push(d.text);D=!0,U=!0;continue}if(W.type==="image"){F.push(t),D=!0,U=!0;continue}if(W.type==="text"&&typeof W.text==="string"){F.push(W.text),D=!0;continue}}let b=df(C,$,w,Y);F.push(b.value),D||=b.changed,U||=b.mediaChanged}return{value:D?F:f,changed:D,mediaChanged:U}}let G=f;if(G.type==="image"){if(typeof G.data==="string"&&typeof G.mediaType==="string"){if(!J)return{value:X,changed:!0,mediaChanged:!0};let F={type:"image",data:G.data,mediaType:G.mediaType},D=mf(F,w);if(D.type==="file")return $.push({type:"image",data:D.data.data,mediaType:D.mediaType}),{value:M$,changed:!0,mediaChanged:!0};return{value:D.text,changed:!0,mediaChanged:!0}}return{value:t,changed:!0,mediaChanged:!0}}let H={},R=!1,V=!1;for(let[F,D]of Object.entries(G)){let U=df(D,$,w,Y);H[F]=U.value,R||=U.changed,V||=U.mediaChanged}return{value:R?H:f,changed:R,mediaChanged:V}}function Hf(f){if(typeof f==="string")return y(f);if(Array.isArray(f))return f.map(($)=>Hf($));if(f!==null&&typeof f==="object"){let $=f,w={};for(let[Y,J]of Object.entries($))w[Y]=Hf(J);return w}return f}function _1(f,$=!1,w=If(),Y){let J=Y?.supportsImages??!0;if(typeof f==="string")return{type:$?"error-text":"text",value:y(f)};if(!$&&E$(f))return{type:"content",value:f.map((X)=>X.type==="image"?J?mf(X,w):{type:"text",text:e}:{type:"text",text:y(X.text)})};if(f!==null&&typeof f==="object"){let X=[],G=df(f,X,w,{hoistImages:!$&&J,inlineImagePlaceholder:J?t:e});if(!$&&X.length>0)return{type:"content",value:[{type:"text",text:typeof G.value==="string"?y(G.value):JSON.stringify(Hf(G.value))},...X.map((R)=>W1(R.data,R.mediaType))]};if(G.mediaChanged)return{type:$?"error-json":"json",value:Hf(G.value)}}if(f===null||typeof f==="boolean"||typeof f==="number"||typeof f==="object")return{type:$?"error-json":"json",value:Hf(f)};return{type:$?"error-text":"text",value:y(String(f))}}function g$(f,$,w){let Y=w?.assistantToolCallArgKey??"input",J=w?.supportedInputModalities,X=!J||J.includes("image"),G=[],H=If(),R=[],V=()=>{return R.splice(0).map((D)=>D.type==="image"?X?pf(D,H):{type:"text",text:e}:R1(D.media,H,J))};if(typeof f==="string"&&f.trim().length>0||Array.isArray(f)&&f.length>0)G.push({role:"system",content:typeof f==="string"?y(f):f});for(let F of $){let D=F.content;if(typeof D==="string"){let W=F.role==="user"&&R.length>0?V():[];if(W.length>0){G.push({role:F.role,content:[{type:"text",text:D.trim().length>0?y(D):Gf},...W]});continue}if(D.trim().length===0){G.push({role:F.role,content:[{type:"text",text:Gf}]});continue}G.push({role:F.role,content:y(D)});continue}let U=[],C=[];if(D.length===0){G.push({role:F.role,content:[{type:"text",text:Gf}]});continue}for(let W of D)switch(W.type){case"text":U.push({type:"text",text:y(W.text),...W.providerOptions?{providerOptions:W.providerOptions}:{}});break;case"reasoning":U.push({type:"reasoning",text:y(W.text),...W.providerOptions?{providerOptions:W.providerOptions}:{}});break;case"image":if(F.role==="assistant")R.push(W),U.push({type:"text",text:y$});else U.push(X?pf(W,H):{type:"text",text:e});break;case"media":if(F.role==="assistant")R.push(W),U.push({type:"text",text:T$(W.media.modality)});else U.push(R1(W.media,H,J));break;case"file":U.push({type:"text",text:nf(W.path,y(W.content))});break;case"tool-call":if(F.role==="assistant")U.push({type:"tool-call",toolCallId:W.toolCallId,toolName:W.toolName,[Y]:W.input,...W.providerOptions?{providerOptions:W.providerOptions}:{}});break;case"tool-result":{C.push({type:"tool-result",toolCallId:W.toolCallId,toolName:W.toolName,output:_1(W.output,W.isError??!1,H,{supportsImages:X})});break}}let b=C.length>0;if(F.role==="user"&&!b&&R.length>0)U.push(...V());if(U.length>0&&U.every((W)=>W.type==="text"&&typeof W.text==="string"&&W.text.trim().length===0))U.splice(0,U.length,{type:"text",text:Gf});if(U.length>0)lf(G,{role:F.role,content:U});if(b)lf(G,{role:"tool",content:C})}if(R.length>0)lf(G,{role:"user",content:V()});return G}var n3=["show","hide","subscription"];function F1(f){return typeof f==="object"&&f!==null&&!Array.isArray(f)}function v$(f,$){if(!f&&!$)return;let w=f?.metadata,Y=$?.metadata,J={...f??{},...$??{}};if(F1(w)&&F1(Y))J.metadata={...w,...Y};return J}var z3=["web_search","image_generation"],c3=["web_search"];var Qf={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},n$=void 0;function h$(f,$){if(typeof f==="string"&&f.toLowerCase()in Qf)return f.toLowerCase();return $?void 0:void 0}function D1(f,$){let w=typeof f==="string"?f.toLowerCase():void 0;if(w&&w in Qf)return Qf[w];if($?.fallbackEffort)return Qf[$.fallbackEffort];return}function x$(f){let $=D1(f.effort,{fallbackEffort:f.fallbackEffort});if($===void 0)return;if($<=0)return 0;let w=f.minimumBudget??1;if(f.maxBudget<w)return;let Y=f.scaleTokens??f.maxBudget;return Math.min(Math.max(Math.floor(Y*$),w),f.maxBudget)}function z$(f){return f instanceof Error?{name:f.name,message:f.message}:f}var c$=3;function L1(f){return Math.max(1,Math.ceil(f/3))}function rf(f){let $=new WeakSet;try{return JSON.stringify(f,(w,Y)=>{if(typeof Y==="bigint")return Y.toString();if(typeof Y!=="object"||Y===null)return Y;if($.has(Y))return"[Circular]";return $.add(Y),Y})??""}catch{return String(f??"")}}function u$(f){let $;try{$=JSON.stringify({systemPrompt:f.systemPrompt,messages:f.messages,tools:f.tools})}catch{$=[rf(f.systemPrompt),rf(f.messages),rf(f.tools)].join(`
4
- `)}return L1($.length)}var o$={debug:()=>{},log:()=>{},error:()=>{}};var d3=60,r3=1,s3=3600;function l$(f){return typeof f==="number"&&Number.isFinite(f)}function m$(f){return Math.min(Math.max(f,1),3600)}function i3(f){if(!l$(f))return 60;return m$(f)}function a3(f,$,w){let Y=w?` (${w})`:"",J=Math.round($/100)/10;return`MCP request to "${f}"${Y} timed out after ${J}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function p$(f){if(f instanceof Error)return f.message;return String(f)}function d$(f){if(f&&typeof f==="object"&&"code"in f&&typeof f.code==="string")return f.code;return""}class o extends Error{constructor(f,$){super(`${f} at position ${$}`);this.position=$}}function U1(f){return/^[0-9A-Fa-f]$/.test(f)}function c(f){return f>="0"&&f<="9"}function I1(f){return f>=" "}function wf(f){return`,:[]/{}()
5
- +`.includes(f)}function sf(f){return f>="a"&&f<="z"||f>="A"&&f<="Z"||f==="_"||f==="$"}function Of(f){return f>="a"&&f<="z"||f>="A"&&f<="Z"||f==="_"||f==="$"||f>="0"&&f<="9"}var af=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,tf=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function ef(f){return`,[]/{}
6
- +`.includes(f)}function f0(f){return Yf(f)||r$.test(f)}var r$=/^[[{\w-]$/;function $0(f){return f===`
7
- `||f==="\r"||f==="\t"||f==="\b"||f==="\f"}function z(f,$){let w=f.charCodeAt($);return w===32||w===10||w===9||w===13}function P1(f,$){let w=f.charCodeAt($);return w===32||w===9||w===13}function O1(f,$){let w=f.charCodeAt($);return w===160||w===6158||w>=8192&&w<=8203||w===8239||w===8287||w===12288||w===65279}function Yf(f){return w0(f)||Bf(f)}function w0(f){return f==='"'||f==="“"||f==="”"}function Y0(f){return f==='"'}function Bf(f){return f==="'"||f==="‘"||f==="’"||f==="`"||f==="´"}function Z0(f){return f==="'"}function Zf(f,$){let w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,Y=f.lastIndexOf($);return Y!==-1?f.substring(0,Y)+(w?"":f.substring(Y+1)):f}function T(f,$){let w=f.length;if(!z(f,w-1))return f+$;while(z(f,w-1))w--;return f.substring(0,w)+$+f.substring(w)}function B1(f,$,w){return f.substring(0,$)+f.substring($+w)}function A1(f){return/[,\n][ \t\r]*$/.test(f)}var s$={"&quot;":'"',"&amp;":"&","&lt;":"<","&gt;":">","&apos;":"'"},J0=12;function K0(f){if(f.charAt(0)!=="&")return null;let $=f.indexOf(";");if($===-1)return null;let w=f.substring(0,$+1),Y=s$[w];if(Y!==void 0)return{char:Y,length:w.length};if(f.charAt(1)==="#"){let J=f.substring(2,$),X=J.charAt(0)==="x"||J.charAt(0)==="X",G=X?J.substring(1):J;if(G.length>0){let H=Number.parseInt(G,X?16:10);if(!Number.isNaN(H)&&H>=0&&H<=1114111)return{char:String.fromCodePoint(H),length:w.length}}}return null}function N1(f){return f!==null&&f.char==='"'}function C1(f){return f!==null&&f.char==="'"}function $f(f,$){let w=0;for(let Y=0;Y<f.length;Y++)if(f.charAt(Y)===$)w++;return w}function b1(f,$){switch($){case")":return $f(f,"(")>$f(f,")");case"]":return $f(f,"[")>$f(f,"]");case"}":return $f(f,"{")>$f(f,"}");default:return!1}}var M1={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},i$={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
8
- `,r:"\r",t:"\t"};function q0(f){let $=0,w="";if(V(["```","[```","{```"]),!X())I6();V(["```","```]","```}"]);let J=D(",");if(J)G();if(f0(f[$])&&A1(w)){if(!J)w=T(w,",");d()}else if(J)w=Zf(w,",");while(f[$]==="}"||f[$]==="]")$++,G();if($>=f.length)return w;bf();function X(){G();let k=W()||Cf()||r()||B()||F6()||P0(!1)||D6();return G(),k}function G(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,j=$,I=H(k);do if(I=R(),I)I=H(k);while(I);return $>j}function H(k){let j=k?z:P1,I="";while(!0)if(j(f,$))I+=f[$],$++;else if(O1(f,$))I+=" ",$++;else break;if(I.length>0)return w+=I,!0;return!1}function R(){if(f[$]==="/"&&f[$+1]==="*"){while($<f.length&&!a$(f,$))$++;return $+=2,!0}if(f[$]==="/"&&f[$+1]==="/"){while($<f.length&&f[$]!==`
9
- `)$++;return!0}return!1}function V(k){if(F(k)){if(sf(f[$]))while($<f.length&&Of(f[$]))$++;return G(),!0}return!1}function F(k){H(!0);for(let j of k){let I=$+j.length;if(f.slice($,I)===j)return $=I,!0}return!1}function D(k){if(f[$]===k)return w+=f[$],$++,!0;return!1}function U(k){if(f[$]===k)return $++,!0;return!1}function C(){return U("\\")}function b(){if(G(),f[$]==="."&&f[$+1]==="."&&f[$+2]===".")return $+=3,G(),U(","),!0;return!1}function W(){if(f[$]==="{"){if(w+="{",$++,G(),U(","))G();let k=!0;while($<f.length&&f[$]!=="}"){let j;if(!k){if(j=D(","),!j)w=T(w,",");G()}else j=!0;if(b(),!(r()||P0(!0))){if(f[$]==="}"||f[$]==="{"||f[$]==="]"||f[$]==="["||f[$]===void 0){if(!k)w=Zf(w,",")}else P6();break}G();let n=D(":"),i=$>=f.length;if(!n)if(f0(f[$])||i)w=T(w,":");else A0();if(!X())if(n||i)w+="null";else A0();k=!1}if(f[$]==="}")w+="}",$++;else w=T(w,"}");return!0}return!1}function Cf(){if(f[$]==="["){if(w+="[",$++,G(),U(","))G();let k=!0;while($<f.length&&f[$]!=="]"){if(!k){if(!D(","))w=T(w,",")}if(b(),!X()){if(!k)w=Zf(w,",");break}k=!1}if(f[$]==="]")w+="]",$++;else w=T(w,"]");return!0}return!1}function d(){let k=!0,j=!0;while(j){if(!k){if(!D(","))w=T(w,",")}else k=!1;j=X()}if(!j)w=Zf(w,",");w=`[
10
- ${w}
11
- ]`}function r(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,I=f[$]==="\\";if(I){if($++,!Yf(f[$]))bf()}let n=f[$]==="&"?K0(f.slice($,$+J0)):null,i=N1(n)||C1(n);if(Yf(f[$])||i){let N0=Y0(f[$])?Y0:Z0(f[$])?Z0:Bf(f[$])?Bf:w0,Rf=$,Vf=w.length,P='"';$+=i&&n?n.length:1;while(!0){if($>=f.length){let A=O0($-1);if(!k&&wf(f.charAt(A)))return $=Rf,w=w.substring(0,Vf),r(!0);return P=T(P,'"'),w+=P,!0}if($===j)return P=T(P,'"'),w+=P,!0;let h=i&&f[$]==="&"?K0(f.slice($,$+J0)):null;if(h&&n?h.char===n.char:N0(f[$])){let A=$,Mf=P.length;if(P+='"',$+=h?h.length:1,w+=P,G(!1),k||$>=f.length||wf(f[$])&&!b1(P,f[$])||Yf(f[$])&&!L6($)||c(f[$]))return I0(),!0;if(f[$]==="\\")bf();let u=O0(A-1),C0=f.charAt(u);if(C0===",")return $=Rf,w=w.substring(0,Vf),r(!1,u);if(wf(C0))return $=Rf,w=w.substring(0,Vf),r(!0);w=w.substring(0,Vf),$=A+(h?h.length:1),P=`${P.substring(0,Mf)}\\${P.substring(Mf)}`}else if(k&&ef(f[$])){if(f[$-1]===":"&&af.test(f.substring(Rf+1,$+2)))while($<f.length&&tf.test(f[$]))P+=f[$],$++;return P=T(P,'"'),w+=P,I0(),!0}else if(h){let A=h.char;if(A==='"')P+="\\\"";else if($0(A))P+=M1[A];else P+=A;$+=h.length}else if(f[$]==="\\"){let A=f.charAt($+1);if(i$[A]!==void 0)P+=f.slice($,$+2),$+=2;else if(A==="u"){let u=2;while(u<6&&U1(f[$+u]))u++;if(u===6)P+=f.slice($,$+6),$+=6;else if($+u>=f.length)$=f.length;else O6()}else if(A===`
12
- `)P+="\\n",$+=2;else P+=A,$+=2}else{let A=f.charAt($);if(A==='"'&&f[$-1]!=="\\")P+=`\\${A}`,$++;else if($0(A))P+=M1[A],$++;else{if(!I1(A))U6(A);P+=A,$++}}if(I)C()}}return!1}function I0(){let k=!1;G();while(f[$]==="+"){k=!0,$++,G(),w=Zf(w,'"',!0);let j=w.length;if(r())w=B1(w,j,1);else w=T(w,'"')}return k}function B(){let k=$,j="",I=!1;if(f[$]==="-"){if(j+=f[$],$++,!c(f[$])&&B0())j+="0"}if(f[$]==="0"&&c(f[$+1]))I=!0;while(c(f[$]))j+=f[$],$++;if(f[$]==="."){if(j===""||j==="-")j+="0";if(j+=f[$],$++,!c(f[$]))j+="0";while(c(f[$]))j+=f[$],$++}if($>k){if(f[$]==="e"||f[$]==="E"){if(j==="-")I=!0;if(j+=f[$],$++,f[$]==="-"||f[$]==="+")j+=f[$],$++;if(!c(f[$]))j+="0";while(c(f[$]))j+=f[$],$++}if(!B0())return $=k,!1;return w+=I?`"${f.substring(k,$)}"`:j,!0}return!1}function F6(){return s("true","true")||s("false","false")||s("null","null")||s("True","true")||s("False","false")||s("None","null")}function s(k,j){if(f.slice($,$+k.length)===k&&!Of(f[$+k.length]))return w+=j,$+=k.length,!0;return!1}function P0(k){let j=$;if(sf(f[$])){while($<f.length&&Of(f[$]))$++;let I=$;while(z(f,I))I++;if(f[I]==="("){if($=I+1,X(),f[$]===")"){if($++,f[$]===";")$++}return!0}}while($<f.length&&!ef(f[$])&&!Yf(f[$])&&(!k||f[$]!==":"))$++;if(f[$-1]===":"&&af.test(f.substring(j,$+2)))while($<f.length&&tf.test(f[$]))$++;if($>j){while(z(f,$-1)&&$>0)$--;let I=f.slice(j,$);if(w+=I==="undefined"?"null":JSON.stringify(I),f[$]==='"')$++;return!0}}function D6(){if(f[$]==="/"){let k=$;$++;while($<f.length&&(f[$]!=="/"||f[$-1]==="\\"))$++;return $++,w+=JSON.stringify(f.substring(k,$)),!0}}function O0(k){let j=k;while(j>0&&z(f,j))j--;return j}function L6(k){let j=k+1;while(j<f.length&&z(f,j))j++;return j>=f.length||wf(f[j])}function B0(){return $>=f.length||wf(f[$])||z(f,$)}function U6(k){throw new o(`Invalid character ${JSON.stringify(k)}`,$)}function bf(){throw new o(`Unexpected character ${JSON.stringify(f[$])}`,$)}function I6(){throw new o("Unexpected end of json string",f.length)}function P6(){throw new o("Object key expected",$)}function A0(){throw new o("Colon expected",$)}function O6(){let k=f.slice($,$+6);throw new o(`Invalid unicode character "${k}"`,$)}}function a$(f,$){return f[$]==="*"&&f[$+1]==="/"}function t$(f){let $=!1,w=!1,Y=!1;for(let J=0;J<f.length;J+=1){let X=f[J];if(Y){Y=!1;continue}if(X==="\\"){Y=!0;continue}if(!w&&X==='"')$=!$;else if(!$&&X==="'")w=!w}return $||w}var e$=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function f2(f){let $=f.match(e$);if(!$)return;let[,w,Y]=$,J=Y.trim();if(!J)return;let X=J[0];if(X==='"'||X==="{"||X==="["||J==="true"||J==="false"||J==="null"||Number.isFinite(Number(J)))return;return JSON.parse(`{"${w}":${JSON.stringify(J)}}`)}function $2(f){if(typeof f!=="string")return f;let $=f.trimStart();if($[0]!=="{"&&$[0]!=="[")return f;try{return JSON.parse($)}catch{}if(!t$($))try{return JSON.parse(q0($))}catch{}return f2($)??f}function w2(f){let $=new WeakSet;try{return JSON.stringify(f,(Y,J)=>{if(typeof J==="bigint")return J.toString();if(J&&typeof J==="object"){if($.has(J))return"[Circular]";$.add(J)}return J})??"null"}catch{return String(f)}}function Y2(f){try{return JSON.parse(f)}catch{return}}function Jf(f){return typeof f==="object"&&f!==null&&!Array.isArray(f)}function Z2(f){let $=f.type;if(typeof $==="string")return[$];return Array.isArray($)?$.filter((w)=>typeof w==="string"):[]}function X0(f,$){if(Z2(f).includes($))return!0;for(let Y of["anyOf","oneOf","allOf"]){let J=f[Y];if(Array.isArray(J)&&J.some((X)=>Jf(X)&&X0(X,$)))return!0}return!1}function J2(f,$){if(typeof f!=="string")return f;let w=f.trim(),Y=X0($,"array"),J=X0($,"object");if((!Y||!w.startsWith("["))&&(!J||!w.startsWith("{")))return f;try{let X=JSON.parse(w);if(Array.isArray(X))return Y?X:f;if(Jf(X))return J?X:f;return f}catch{return f}}function G0(f,$){let w=J2(f,$);if(Array.isArray(w)){let G=$.items;if(!Jf(G))return w;let H=!1,R=w.map((V)=>{let F=G0(V,G);return H||=F!==V,F});return H?R:w}if(!Jf(w))return w;let Y=$.properties;if(!Jf(Y))return w;let J=!1,X={...w};for(let[G,H]of Object.entries(Y)){if(!(G in w)||!Jf(H))continue;let R=G0(w[G],H);if(R!==w[G])X[G]=R,J=!0}return J?X:w}function K2(f){if(typeof globalThis.atob==="function")try{let $=globalThis.atob(f),w=Uint8Array.from($,(Y)=>Y.charCodeAt(0));return new TextDecoder().decode(w)}catch{return null}if(typeof Buffer<"u")try{return Buffer.from(f,"base64").toString("utf8")}catch{return null}return null}function q2(f){let $=f?.trim();if(!$)return null;try{let w=$.split(".");if(w.length!==3)return null;let Y=w[1];if(!Y)return null;let J=Y.replace(/-/g,"+").replace(/_/g,"/"),X=J.padEnd(J.length+(4-J.length%4)%4,"="),G=K2(X);return G?JSON.parse(G):null}catch{return null}}function X2(f){return Object.fromEntries(Object.entries(f).filter(([,$])=>$!==void 0))}function y1(f){let $=f.replaceAll("\\","/"),w=$.lastIndexOf("/");return(w>=0?$.slice(w+1):$).toLowerCase()}function G2(f){return f==="win32"?"powershell":"/bin/bash"}function H0(f){let $=y1(f);if(kf(f)!==void 0)return"powershell";if($==="cmd"||$==="cmd.exe")return"cmd";if($==="wsl"||$==="wsl.exe")return"wsl";return"posix"}var H2=new Set(["-nologo","-noninteractive","-noprofile"]),Q2="-noprofile";function k2(f,$){let w="";for(let Y=0;Y<f.length;Y++){let J=f[Y];if(J==="`"&&Y+1<f.length){let X=f[Y+1];if(X==="u"&&$==="core"&&f[Y+2]==="{"){let G=f.indexOf("}",Y+3),H=G>Y+3?f.slice(Y+3,G):"",R=Number.parseInt(H,16);if(H.length<=6&&/^[0-9a-fA-F]+$/.test(H)&&R<=1114111){w+=String.fromCodePoint(R),Y=G;continue}}switch(X){case"n":w+=`
13
- `;break;case"r":w+="\r";break;case"t":w+="\t";break;case"b":w+="\b";break;case"f":w+="\f";break;case"v":w+="\v";break;case"0":w+="\x00";break;case"a":w+="\x07";break;case"e":w+=$==="core"?"\x1B":"e";break;default:w+=X}Y++;continue}if(J==='"'&&f[Y+1]==='"'){w+='"',Y++;continue}w+=J}return w}function j2(f){let $=f[0];if($!=="'"&&$!=='"')return;for(let w=1;w<f.length;w++){let Y=f[w];if($==='"'&&Y==="`"){w++;continue}if(Y===$){if(f[w+1]===$){w++;continue}if(f.slice(w+1).trim()!=="")return;return{quote:$,body:f.slice(1,w)}}}return}function kf(f){let $=y1(f);if($==="powershell"||$==="powershell.exe")return"windows";if($==="pwsh"||$==="pwsh.exe")return"core";return}function R2(f,$){let w=j2(f);if(!w)return;let Y=(w.quote==="'"?w.body.replaceAll("''","'"):k2(w.body,$)).trim();return Y.length>0?Y:void 0}function V2(f,$){let w=/^[ \t]*(?:&[ \t]*(?:"([^"$`]*)"|'((?:[^']|'')*)')|(?:&[ \t]*)?([^\s$`"';&|<>(){}#@,]+))[ \t]+([\S\s]*)$/.exec(f);if(!w)return;let Y=w[1]??w[2]?.replaceAll("''","'")??w[3],J=kf($);if(!J||!kf(Y))return;let X=w[4],G=!1;for(;;){let H=/^(-[^\s=]+)[ \t]*([\S\s]*)$/.exec(X);if(!H)return;let R=H[1].toLowerCase();if(R==="-command"){let V=G?R2(H[2],J):void 0;return V===void 0?void 0:{executable:Y,script:V}}if(!H2.has(R))return;if(R===Q2)G=!0;X=H[2]}}function W2(f,$){if(!/[\\/:]/.test($)&&kf($)===kf(f))return f;return $}function T1(f,$){switch(H0(f)){case"powershell":{let w={executable:f,script:$};for(;;){let Y=V2(w.script,w.executable);if(!Y)break;w={executable:W2(f,Y.executable),script:Y.script}}return{executable:w.executable,args:["-NoProfile","-NonInteractive","-Command","[Console]::InputEncoding=[Text.UTF8Encoding]::new();[Console]::OutputEncoding=[Text.UTF8Encoding]::new();$ErrorActionPreference='Stop';$c=[Console]::In.ReadToEnd();$c+=[Environment]::NewLine+'if(-not $?){exit 1}';& ([ScriptBlock]::Create($c))"],input:w.script}}case"cmd":return{executable:f,args:["/d","/s","/c",$]};case"wsl":return{executable:f,args:["bash","-c",$]};case"posix":return{executable:f,args:["-c",$]}}}function _2(f,$){if(H0(f)==="powershell")return["-NoProfile","-NonInteractive","-Command",$];return T1(f,$).args}function F2(f){return f.toLowerCase().replace(/[^\w.-]+/g,"_")}function D2(f){let $=f?.trim();return $?$:void 0}function E1(f,$){if(f.length<=$)return f;return`${f.slice(0,$-1)}…`}function L2(f,$="/",w=100){if(!f||f.length<=w)return f||"";let Y=f.split($)?.shift()?.trim()?.slice(0,w-1);return Y?`${Y}…`:E1(f,w)}function U2(f){if(f.length<=8)return"****";return`${f.slice(0,4)}...${f.slice(-4)}`}function I2(f){return f.charCodeAt(0)===65279?f.slice(1):f}function P2(f){if(!f)return"(unknown-date)";let $=new Date(f);if(Number.isNaN($.getTime()))return f;return $.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}function O2(f){let $=Math.max(0,Math.floor(f/1000)),w=Math.floor($/86400),Y=Math.floor($%86400/3600),J=Math.floor($%3600/60),X=$%60;if(w>0)return`${w}d ${Y}h`;if(Y>0)return`${Y}h ${J}m`;if(J>0)return`${J}m ${X}s`;return`${X}s`}import{z as S1}from"zod";function B2(f,$){let w=f.safeParse($);if(!w.success)throw Error(S1.prettifyError(w.error));return w.data}function Q0(f){return S1.toJSONSchema(f)}function k0(f){return f==="cline"||f==="cline-pass"}var g1=`You are Cline, an AI coding agent. Your primary goal is to assist users with various coding tasks by leveraging your knowledge and the tools at your disposal. Given the user's prompt, you should use the tools available to you to answer user's question.
1
+ import{z as s}from"zod";import{z as T}from"zod";import{z as _}from"zod";var he=["none","minimal","low","medium","high","xhigh","max"],we=_.enum(he),be=we.exclude(["none"]),Io=_.enum([...he,"default"]).nullable(),Oe=_.discriminatedUnion("type",[_.object({type:_.literal("toggle")}).strict(),_.object({type:_.literal("effort"),values:_.array(Io)}).strict(),_.object({type:_.literal("budget_tokens"),min:_.number().min(-1).optional(),max:_.number().min(0).optional()}).strict().refine((e)=>e.min===void 0||e.max===void 0||e.min<=e.max,{message:"Minimum reasoning budget cannot exceed maximum",path:["min"]})]);var Mt=T.enum(["default","openai-responses","r1"]),vo={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},_t=T.enum(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),Pt=T.enum(["active","preview","deprecated","legacy"]),wt=T.object({input:T.number().optional(),output:T.number().optional(),cacheWrite:T.number().optional(),cacheRead:T.number().optional()}),Ot=T.object({maxBudget:T.number().optional(),outputPrice:T.number().optional(),thinkingLevel:T.enum(["low","high"]).optional()}),Nt=T.object({reasoningDefaultOn:T.boolean().optional(),apiProtocol:T.enum(["openai-chat","openai-responses","anthropic","gemini"]).optional()}).catchall(T.unknown()),Ne=T.enum(["text","image","audio","video","pdf"]),Lt=T.object({input:T.array(Ne),output:T.array(Ne)});function Dt(e){return(e?.input===void 0||e.input.includes("text"))&&(e?.output===void 0||e.output.includes("text"))}var Bt=T.enum(["language","image-generation","speech-generation","video-generation","transcription","realtime"]);function Mo(e){let t=e.modalities?.input,n=e.modalities?.output;return t?.length===1&&t[0]==="audio"&&n?.length===1&&n[0]==="text"}function _o(e){return(e.operation===void 0||e.operation==="language")&&Dt(e.modalities)}var Ht=T.enum(["batch","streaming"]);function Po(e){return e.modalities?.input.includes("text")===!0&&e.modalities.output.includes("image")}function wo(e){return e.operation==="image-generation"}function Le(e,t,n){let o=e.capabilities;if(o===void 0||o.length===0)return n?.assumeWhenUnspecified??!1;return o.includes(t)}function Oo(e){return Le(e,"tools",{assumeWhenUnspecified:!0})}function No(e){return Le(e,"images",{assumeWhenUnspecified:!0})}var xe=T.object({id:T.string(),name:T.string().optional(),description:T.string().optional(),maxTokens:T.number().optional(),contextWindow:T.number().optional(),maxInputTokens:T.number().optional(),capabilities:T.array(_t).optional(),operation:Bt.optional(),operationModes:T.array(Ht).optional(),modalities:Lt.optional(),reasoningOptions:T.array(Oe).optional(),apiFormat:Mt.optional(),systemRole:T.enum(["system","developer"]).optional(),temperature:T.number().optional(),pricing:wt.optional(),thinkingConfig:Ot.optional(),status:Pt.optional(),deprecationNotice:T.string().optional(),replacedBy:T.string().optional(),releaseDate:T.string().optional(),deprecationDate:T.string().optional(),family:T.string().optional(),metadata:Nt.optional()});import{z as L}from"zod";var Lo="This tool call was rejected by the user and not executed.",Do="NOT a tool or system failure. Clarify with user before proceeding.",De=L.object({id:L.string(),name:L.string(),execution:L.enum(["client","provider"]).optional(),input:L.unknown(),output:L.unknown(),error:L.string().optional(),durationMs:L.number(),startedAt:L.date(),endedAt:L.date()});var Bo=s.enum(["completed","max_iterations","aborted","mistake_limit","error"]),Ho=s.object({inputTokens:s.number(),outputTokens:s.number(),cacheReadTokens:s.number().optional(),cacheWriteTokens:s.number().optional(),totalCost:s.number().optional()}),Qs=s.object({text:s.string(),usage:Ho,messages:s.array(s.custom()),toolCalls:s.array(De),iterations:s.number(),finishReason:Bo,model:s.object({id:s.string(),provider:s.string(),info:xe.optional()}),startedAt:s.date(),endedAt:s.date(),durationMs:s.number()}),Zs=s.object({distinctId:s.string().optional(),sessionId:s.string().optional(),providerId:s.string(),modelId:s.string(),apiKey:s.string().optional(),baseUrl:s.string().url().optional(),headers:s.record(s.string(),s.string()).optional(),knownModels:s.record(s.string(),xe).optional(),providerConfig:s.unknown().optional(),initialMessages:s.array(s.custom()).optional(),systemPrompt:s.string(),tools:s.array(s.custom()),modelTools:s.array(s.custom()).optional(),maxIterations:s.number().positive().optional(),maxParallelToolCalls:s.number().int().positive().default(8),maxTokensPerTurn:s.number().positive().optional(),temperature:s.number().nonnegative().optional(),apiTimeoutMs:s.number().positive().default(180000),userFileContentLoader:s.function().input([s.string()]).output(s.promise(s.string())).optional(),toolContextMetadata:s.record(s.string(),s.unknown()).optional(),execution:s.object({maxConsecutiveMistakes:s.number().int().positive().optional(),reminderAfterIterations:s.number().nonnegative().optional(),reminderText:s.string().optional(),loopDetection:s.union([s.literal(!1),s.object({softThreshold:s.number().int().positive().optional(),hardThreshold:s.number().int().positive().optional()})]).optional()}).optional(),reasoningEffort:be.optional(),thinkingBudgetTokens:s.number().positive().optional(),thinking:s.boolean().optional(),onEvent:s.function().input([s.custom()]).output(s.void()).optional(),hooks:s.custom().optional(),parentAgentId:s.string().optional(),extensions:s.array(s.custom()).optional(),hookErrorMode:s.enum(["ignore","throw"]).default("ignore"),toolPolicies:s.record(s.string(),s.object({enabled:s.boolean().optional(),autoApprove:s.boolean().optional()})).optional(),requestToolApproval:s.function().input([s.object({sessionId:s.string(),agentId:s.string(),conversationId:s.string(),iteration:s.number(),toolCallId:s.string(),toolName:s.string(),input:s.unknown(),policy:s.object({enabled:s.boolean().optional(),autoApprove:s.boolean().optional()}).default({})})]).output(s.union([s.object({approved:s.boolean(),reason:s.string().optional()}),s.promise(s.object({approved:s.boolean(),reason:s.string().optional()}))])).optional(),onConsecutiveMistakeLimitReached:s.function().input([s.object({iteration:s.number().int().positive(),consecutiveMistakes:s.number().int().positive(),maxConsecutiveMistakes:s.number().int().positive(),reason:s.enum(["api_error","invalid_tool_call","tool_execution_failed"]),details:s.string().optional()})]).output(s.union([s.object({action:s.literal("continue"),guidance:s.string().optional()}),s.object({action:s.literal("stop"),reason:s.string().optional()}),s.promise(s.union([s.object({action:s.literal("continue"),guidance:s.string().optional()}),s.object({action:s.literal("stop"),reason:s.string().optional()})]))])).optional(),logger:s.custom().optional(),extensionContext:s.custom().optional(),abortSignal:s.custom().optional()});import{z as h}from"zod";var Ut=h.enum(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),Ft=h.object({id:h.string().optional(),label:h.string().optional(),role:h.string().optional(),participantKey:h.string().optional(),participantLabel:h.string().optional(),platformUserId:h.string().optional(),metadata:h.record(h.string(),h.unknown()).optional()}),Gt=h.object({source:h.string(),sourceEvent:h.string(),threadId:h.string(),channelId:h.string(),isDM:h.boolean(),sessionId:h.string().optional(),workspaceRoot:h.string().optional(),metadata:h.record(h.string(),h.unknown()).optional()}),Uo=h.object({actor:Ft,context:Gt,payload:h.record(h.string(),h.unknown()).optional()}),Fo=h.object({action:h.enum(["allow","deny"]).default("allow"),message:h.string().optional(),reason:h.string().optional(),metadata:h.record(h.string(),h.unknown()).optional()}),Go=h.object({adapter:h.string(),botUserName:h.string().optional(),event:Ut,payload:h.record(h.string(),h.unknown()),ts:h.string()});var Vt=[{name:"discord",description:"Discord interactions and gateway bridge backed by RPC runtime sessions"},{name:"gchat",description:"Google Chat webhook bridge backed by RPC runtime sessions"},{name:"linear",description:"Linear webhook bridge backed by RPC runtime sessions"},{name:"slack",description:"Slack webhook/socket bridge backed by RPC runtime sessions"},{name:"telegram",description:"Bridge Telegram bot messages into RPC chat sessions"},{name:"whatsapp",description:"Bridge WhatsApp webhook messages into RPC chat sessions"}];function jt(){return Vt.map((e)=>({...e}))}function Vo(e,t){let n=e.includeWhen;if(!n)return!0;let o=t[n.flag]??"";if(n.equals!==void 0&&o!==n.equals)return!1;if(n.notEquals!==void 0&&o===n.notEquals)return!1;return!0}function jo(e=qt){let t=new Set(jt().map((n)=>n.name));return e.filter((n)=>t.has(n.id)).map((n)=>({id:n.id,name:n.name,type:n.type,hint:n.hint,fields:n.fields.map((o)=>({flag:o.flag,label:o.label,placeholder:o.placeholder,required:o.required,help:o.help,initialValue:o.initialValue,options:o.options,includeWhen:o.includeWhen})),security:n.security?{prompt:n.security.prompt,fields:n.security.fields.map((o)=>({key:o.key,label:o.label,placeholder:o.placeholder,help:o.help,requiredMessage:o.requiredMessage}))}:void 0}))}function qo(e){return/^\d+$/.test(e)?void 0:"Telegram user ID must contain digits only"}function zo(e){return/^T[A-Z0-9]+$/.test(e)?void 0:"Slack workspace ID must start with T and contain uppercase letters or digits only"}function Wo(e){return/^[UW][A-Z0-9]+$/.test(e)?void 0:"Slack member ID must start with U or W and contain uppercase letters or digits only"}var qt=[{id:"telegram",name:"Telegram",type:"polling",hint:"Easiest to set up. No public URL needed.",derivedReconnectFlags:["-m","--bot-username"],fields:[{flag:"-k",aliases:["--bot-token"],label:"Bot token",placeholder:"7123456789:AAH...",required:!0,help:["Open Telegram and start a chat with @BotFather","Send /newbot and follow the prompts","BotFather gives you this after creating the bot","It looks like 7123456789:AAHxxx..."]}],security:{prompt:"By default, anyone who finds your bot can message it and run tasks on your machine. Restrict access to your Telegram user ID?",fields:[{key:"userId",label:"Your Telegram user ID",placeholder:"123456789",help:["Message @userinfobot on Telegram","It will reply with your numeric user ID"],requiredMessage:"User ID is required to restrict access",validate:qo}],argumentFlags:["--allowed-user-id","--hook-command"],buildArgs:({userId:e})=>["--allowed-user-id",e??""]}},{id:"slack",name:"Slack",type:"hybrid",hint:"Public URL for webhook mode; leave blank for socket mode.",fields:[{flag:"--bot-token",label:"Bot token",placeholder:"xoxb-...",required:!0,help:["Go to api.slack.com/apps and create a new app","Add Bot Token Scopes: chat:write, app_mentions:read, channels:history, channels:read, im:history, im:read, im:write, users:read","Install to workspace and copy the Bot Token"]},{flag:"--base-url",label:"Public base URL",placeholder:"leave blank for socket mode",help:["Enter a publicly accessible URL for webhook mode","Leave blank to use Slack socket mode instead"]},{flag:"--signing-secret",label:"Signing secret",required:!0,help:["Found in your app's Basic Information page"],includeWhen:{flag:"--base-url",notEquals:""}},{flag:"--app-token",label:"App-level token",placeholder:"xapp-...",required:!0,help:["Enable Socket Mode in the Slack app","Generate an app-level token with the connections:write scope"],includeWhen:{flag:"--base-url",equals:""}}],security:{prompt:"Restrict which Slack users can interact with the bot?",fields:[{key:"teamId",label:"Allowed Slack workspace ID",placeholder:"T01ABC123",help:["Open your Slack workspace URL in a browser","The workspace ID is the segment after /client/, for example T01ABC123"],requiredMessage:"Workspace ID is required to restrict access",validate:zo},{key:"userId",label:"Allowed Slack member ID",placeholder:"U01ABC123",help:["Click a user's name in Slack, then View full profile","Click ... and Copy member ID"],requiredMessage:"Member ID is required to restrict access",validate:Wo}],argumentFlags:["--hook-command"],buildArgs:({teamId:e,userId:t})=>["--hook-command",`jq -r ".payload.actor.participantKey" | grep -qx "slack:team:${e}:user:${t}" && echo '{"action":"allow"}' || echo '{"action":"deny"}'`]}},{id:"discord",name:"Discord",type:"webhook",hint:"Requires a Discord app and public URL.",fields:[{flag:"--application-id",aliases:["--app-id"],label:"Application ID",required:!0,help:["Go to discord.com/developers/applications","Create a new app, copy the Application ID"]},{flag:"--bot-token",aliases:["--token"],label:"Bot token",required:!0,help:["Go to Bot section, create a bot, copy the token"]},{flag:"--public-key",label:"Public key",required:!0,help:["Found in General Information of your app"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0,help:["Base URL for the connector","For Discord, set the Interactions Endpoint URL to <base-url>/api/webhooks/discord"]}]},{id:"whatsapp",name:"WhatsApp",type:"webhook",hint:"Requires Meta developer account and public URL.",fields:[{flag:"--phone-number-id",label:"Phone number ID",required:!0,help:["From your WhatsApp Business account in Meta Developer portal"]},{flag:"--access-token",label:"Access token",required:!0,help:["Generate a permanent token in Meta Developer portal"]},{flag:"--app-secret",label:"App secret",required:!0,help:["Found in App Settings > Basic"]},{flag:"--verify-token",label:"Webhook verify token",placeholder:"my-verify-token",required:!0,help:["Any string you choose, used to verify webhook setup"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"gchat",name:"Google Chat",type:"webhook",hint:"Requires Google Cloud project and public URL.",fields:[{flag:"--credentials-json",label:"Service account credentials JSON",required:!0,help:["Create a service account in Google Cloud Console","Download the credentials JSON file","Paste the JSON content here"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"linear",name:"Linear",type:"webhook",hint:"React to Linear issues and comments.",fields:[{flag:"--api-key",label:"API key",required:!0,help:["Go to Linear Settings > API > Personal API keys"]},{flag:"--webhook-secret",label:"Webhook signing secret",required:!0,help:["Go to Settings > API > Webhooks, create one","Copy the signing secret"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]}];var Ko=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],$o=new Set(Ko);function Kt(e,t){return e.name||`extension_${String(t).padStart(4,"0")}`}function zt(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function Wt(e){if(!Array.isArray(e))return;let t=e.filter((n)=>typeof n==="string").map((n)=>n.trim()).filter((n)=>n.length>0);return t.length>0?t:void 0}function $t(e){let t=Wt(e.providerIds),n=Wt(e.modelIds);return{...e,...t?{providerIds:t}:{},...n?{modelIds:n}:{}}}function Jo(e,t){let n=Kt(e,t),o=e.manifest;if(!o||typeof o!=="object")throw Error(`Invalid manifest for extension "${n}": manifest is required`);if(!Array.isArray(o.capabilities)||o.capabilities.length===0)throw Error(`Invalid manifest for extension "${n}": capabilities must be a non-empty array`);let i=new Set;for(let c of o.capabilities){if(!$o.has(c))throw Error(`Invalid manifest for extension "${n}": unsupported capability "${String(c)}"`);i.add(c)}if(Object.hasOwn(o,"providerIds")&&!zt(o.providerIds))throw Error(`Invalid manifest for extension "${n}": providerIds must be a string array when provided`);if(Object.hasOwn(o,"modelIds")&&!zt(o.modelIds))throw Error(`Invalid manifest for extension "${n}": modelIds must be a string array when provided`);let l=i.has("hooks");if(e.hooks!==void 0&&!l)throw Error(`Invalid manifest for extension "${n}": runtime hooks require the "hooks" capability`);return{capabilities:i,raw:$t(o)}}function Yo(e,t){if(!e||typeof e!=="object")throw Error(`Invalid automation event contribution for extension "${t}": expected object`);let n=typeof e.eventType==="string"?e.eventType.trim():"",o=typeof e.source==="string"?e.source.trim():"";if(!n)throw Error(`Invalid automation event contribution for extension "${t}": eventType is required`);if(!o)throw Error(`Invalid automation event contribution for extension "${t}": source is required`);return{...e,eventType:n,source:o,examples:e.examples?[...e.examples]:void 0,metadata:e.metadata?{...e.metadata}:void 0}}class Be{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]};normalized=[];phase="resolve";setupContext;constructor(e={}){this.extensions=e.extensions??[],this.setupContext=e.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((e,t)=>({extension:e,order:t,manifest:{capabilities:new Set,raw:e.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((e)=>({...e,manifest:Jo(e.extension,e.order)})),this.phase="setup"}async setup(e={}){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;let t,n=[];for(let o of this.normalized){let{extension:i}=o;if(i.disabled)continue;let l=Kt(i,o.order),d={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},c={registerTool:(f)=>d.tools.push(f),registerCommand:(f)=>d.commands.push(f),registerRule:(f)=>{if(!o.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${l}": registerRule requires the "rules" capability`);d.rules.push(f)},registerMessageBuilder:(f)=>d.messageBuilder.push(f),registerProvider:(f)=>d.providers.push(f),registerAutomationEventType:(f)=>{if(!o.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${l}": registerAutomationEventType requires the "automationEvents" capability`);d.automationEventTypes.push(Yo(f,l))},registerMcpServer:(f)=>{if(!o.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${l}": registerMcpServer requires the "mcp" capability`);d.mcpServers.push({...f,metadata:{...f.metadata??{},source:"plugin",plugin:l}})}},m=o.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await i.setup?.(c,m),n.push(d)}catch(f){if(e.tolerateSetupErrors!==!0)throw f;t??=f}}if(t&&e.tolerateSetupErrors!==!0)throw t;for(let o of n)this.registry.tools.push(...o.tools),this.registry.commands.push(...o.commands),this.registry.rules.push(...o.rules),this.registry.messageBuilder.push(...o.messageBuilder),this.registry.providers.push(...o.providers),this.registry.automationEventTypes.push(...o.automationEventTypes),this.registry.mcpServers.push(...o.mcpServers);if(this.phase="activate",t)throw t}activate(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase==="setup")throw Error("Contribution registry setup must complete before activation");if(this.phase!=="activate")return;this.phase="run"}async initialize(e={}){this.resolve(),this.validate();try{await this.setup(e)}finally{if(this.phase==="activate")this.activate()}}isActivated(){return this.phase==="run"}getRegistrySnapshot(){return{tools:[...this.registry.tools],commands:[...this.registry.commands],rules:[...this.registry.rules],messageBuilder:[...this.registry.messageBuilder],providers:[...this.registry.providers],automationEventTypes:[...this.registry.automationEventTypes],mcpServers:[...this.registry.mcpServers]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getRegisteredMcpServers(){return[...this.registry.mcpServers]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((e,t)=>e.order-t.order).map(({extension:e})=>e)}}function Xo(e={}){return new Be(e)}var Qo=[".js",".ts"];var Q={CLINE_PASS:"ext-cline-pass",CODE_CLOUD_AGENTS:"code-cloud-agents",CODE_ONBOARDING_GITHUB:"code-onboarding-github",CLINE_COMPOSIO_BETA:"CLINE_COMPOSIO_BETA"},Zo={[Q.CLINE_PASS]:!1,[Q.CODE_CLOUD_AGENTS]:!1,[Q.CODE_ONBOARDING_GITHUB]:!1,[Q.CLINE_COMPOSIO_BETA]:!1},er=Object.values(Q);import{z as u}from"zod";var Jt=u.enum(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),q=u.record(u.string(),u.string()),tr=u.object({toolName:u.string(),parameters:q}),nr=u.object({toolName:u.string(),parameters:q,result:u.string(),success:u.boolean(),executionTimeMs:u.number()}),or=u.object({prompt:u.string(),attachments:u.array(u.string())}),rr=u.object({taskMetadata:q}),ir=u.object({taskMetadata:q,previousState:q}),sr=u.object({taskMetadata:q}),ar=u.object({taskMetadata:q}),lr=u.object({taskId:u.string(),ulid:u.string(),contextSize:u.number(),compactionStrategy:u.string(),previousApiReqIndex:u.number(),tokensIn:u.number(),tokensOut:u.number(),tokensInCache:u.number(),tokensOutCache:u.number(),deletedRangeStart:u.number(),deletedRangeEnd:u.number(),contextJsonPath:u.string(),contextRawPath:u.string()}),Yt=u.object({clineVersion:u.string(),hookName:Jt,timestamp:u.string(),taskId:u.string(),sessionContext:u.object({rootSessionId:u.string().optional(),hookLogPath:u.string().optional()}).optional(),workspaceRoots:u.array(u.string()),workspaceInfo:u.custom().optional(),userId:u.string(),agent_id:u.string(),parent_agent_id:u.string().nullable(),iteration:u.number().optional(),reason:u.string().optional(),tool_call:u.object({id:u.string(),name:u.string(),input:u.unknown()}).optional(),tool_result:u.custom().optional(),turn:u.unknown().optional(),error:u.object({name:u.string(),message:u.string(),stack:u.string().optional()}).optional(),preToolUse:tr.optional(),postToolUse:nr.optional(),userPromptSubmit:or.optional(),taskStart:rr.optional(),taskResume:ir.optional(),taskCancel:sr.optional(),taskComplete:ar.optional(),preCompact:lr.optional()}).passthrough();function dr(e){let t=Yt.safeParse(e);if(!t.success)return;return t.data}var pa="v1",ga="v1",ma="v1",fa=["client.register","client.list","session.create","session.list","session.get","session.run","session.abort","schedule.create","schedule.list","task.create","task.list","task.get","task.update","task.approve","task.cancel","task.run","task.automation.get","task.automation.set","settings.get","settings.set","connector.start","connector.stop","connector.supervised","run.enqueue","run.list","hub.drain","hub.status","stream.replay"];function Te(e){let t=/^v(\d+)$/.exec(e?.trim()??"");if(!t)return;return Number.parseInt(t[1]??"",10)}function ya(e,t="v1"){let n=Te(e.protocolVersion),o=Te(t);if(n===void 0||o===void 0)return{compatible:!1,reason:"missing_protocol"};let i=Te(e.minClientProtocolVersion)??n,l=Te(e.maxClientProtocolVersion)??n;return o>=i&&o<=l?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var ha="approval.respond",ba="0",xa="__hubScheduleRunAt",Xt=["act","plan","yolo"];function cr(e){return Xt.some((t)=>t===e)}function Ta(e,t){if(!e||!Object.hasOwn(e,"mode"))return t;let n=e.mode;if(cr(n))return n;throw Error(`mode must be one of: ${Xt.join(", ")}`)}var ur=30000,Sa=5000;function pr(e){switch(e){case"run.start":case"session.send_input":return null;default:return ur}}function Aa(e,t){return t===void 0?pr(e):t}var gr=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],mr=new Set(gr);function Ea(e){return typeof e==="string"&&mr.has(e)}var ka="tool_executor.",Ca="custom_tool.",Ra="hook.",Ia="compaction.compact",va="checkpoint.create",Ma="mistake_limit.decide",_a="user_instructions.snapshot";function Pa(e){let t=e.activeSessionCount;if(typeof t!=="number"||t<=0)return"active sessions from other Cline clients";let n=`${t} active session${t===1?"":"s"}`,o=e.participantClientCount;if(typeof o!=="number"||o<=0)return n;return`${n} from ${o} connected Cline client${o===1?"":"s"}`}function He(e,t){return`<file_content path="${e}">
2
+ ${t}
3
+ </file_content>`}function fr(e,t="act"){return`<user_input mode="${t}">${e}</user_input>`}function yr(e,t){return`<user_command slash="${t}">${e}</user_command>`}function hr(e,t){return`<mode_notice>The user switched from ${e} mode to ${t} mode before sending this message.</mode_notice>`}function br(){let e=null;return{record(t,n){if(t===n)return;if(e){e=e.from===n?null:{from:e.from,to:n};return}e={from:t,to:n}},consume(){let t=e;return e=null,t}}}function xr(e,t){let n=e.trim(),o=new RegExp(`^<${t}\\b([^>]*)>([\\s\\S]*?)<\\/${t}>$`,"i").exec(n);if(!o)return;return{attrs:o[1]??"",content:o[2]??""}}function Tr(e,t){return new RegExp(`${t}="([^"]+)"`,"i").exec(e)?.[1]?.trim()||void 0}function Qt(e){if(!e?.trim())return;let t=xr(e,"user_command");if(!t)return;let n=Tr(t.attrs,"slash");if(!n)return;return{slash:n,content:t.content.trim()}}function Zt(e){if(!e?.trim())return"";let t=e.trim();for(let n of["user_input","user_command"]){let o=rn(t,n);t=(o!==t?o:t.replace(new RegExp(`<${n}[^>]*>`,"g"),"")).trim()}return t}function en(e){if(!e?.trim())return"";return Sr(e,"mode_notice").trim()}function Sr(e,t){let n=`<${t}>`,o=`</${t}>`,i=e,l=i.indexOf(n);while(l!==-1){let d=i.indexOf(o,l+n.length);if(d===-1)break;i=i.slice(0,l)+i.slice(d+o.length),l=i.indexOf(n,l)}return i}function Ue(e){let t=en(Zt(e)),n=Qt(e);if(!n)return t;if(n.slash.toLowerCase()==="team"){let i=t.toLowerCase().startsWith("spawn a team of agents for the following task:")?t.slice(46).trim():t;return i?`/team ${i}`:"/team"}return t?`/${n.slash} ${t}`:`/${n.slash}`}var tn=240,nn=480;function on(e,t){let n=e.replace(/\s+/gu," ").trim();if(n.length<=t)return n;return`${n.slice(0,t-1).trimEnd()}…`}function Ar(e){return on(Ue(e),tn)}function Er(e,t){let n=t?.trim()??"",o=e.toLowerCase(),i=o==="user"||o==="session"?Ue(n):n;return on(i,nn)}function rn(e,t){if(!e?.trim())return"";if(!t)return e;let n=new RegExp(`<${t}\\b[^>]*>([\\s\\S]*?)</${t}>`,"g");return e.replace(n,"$1")}import{z as I}from"zod";var Z="[media omitted: invalid or exceeds size limit]",ee="[Image attached — this model cannot view images]",sn=I.enum(["image","audio","video","file"]),an=I.discriminatedUnion("type",[I.object({type:I.literal("base64"),data:I.string().min(1)}),I.object({type:I.literal("url"),url:I.string().url().refine((e)=>{let t=new URL(e).protocol;return t==="http:"||t==="https:"},"Generated media URLs must use HTTP or HTTPS")}),I.object({type:I.literal("artifact"),artifactId:I.string().min(1)})]);function ln(e){if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";return"file"}var dn=I.object({id:I.string().min(1),modality:sn,mediaType:I.string().min(1),source:an,name:I.string().min(1).optional(),sizeBytes:I.number().int().nonnegative().optional()}).refine((e)=>ln(e.mediaType)===e.modality,{message:"Generated media modality must match its media type",path:["modality"]});function kr(e){return dn.safeParse(e).success}function Cr(e){return ln(e)}var Ae=["image/png","image/jpeg","image/gif","image/webp"],Fe=5242880,D=Fe,U=6291456,cn=8388608;function Rr(e){return e.length}function Ge(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}function Ir(e=Fe){return Math.floor(e*3/4)}function Ve(e){return Math.ceil(e/3)*4}function je(e={}){return{maxImageEncodedBytes:e.maxImageEncodedBytes??D,maxImageDecodedBytes:e.maxImageDecodedBytes??U,maxTotalMediaBytes:e.maxTotalMediaBytes??cn}}function Ee(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function Se(e,t){e.omittedImages+=1,e.omittedReasons[t]=(e.omittedReasons[t]??0)+1}function le(e,t,n,o){let i=je(n);if(e>i.maxImageEncodedBytes){let l={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${i.maxImageEncodedBytes} byte encoded limit`};return Se(o,l.reason),l}if(t>i.maxImageDecodedBytes){let l={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${i.maxImageDecodedBytes} byte decoded limit`};return Se(o,l.reason),l}if(o.totalEncodedBytes+e>i.maxTotalMediaBytes){let l={ok:!1,reason:"total_limit",message:`Image media exceeds the ${i.maxTotalMediaBytes} byte total media limit`};return Se(o,l.reason),l}return o.totalEncodedBytes+=e,o.keptImages+=1,null}function un(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47}function vr(e){return e.length>0&&qe(e,0,e.length)}function Mr(e,t,n){let o=pn(e),i=o.end-o.start;if(i===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let l=je(t);if(n.totalEncodedBytes+i>l.maxTotalMediaBytes)return{ok:!1,reason:"total_limit",message:`Generated media exceeds the ${l.maxTotalMediaBytes} byte total media limit`};if(!qe(e,o.start,o.end))return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let d=e.slice(o.start,o.end);return n.totalEncodedBytes+=i,{ok:!0,base64:d,encodedBytes:i,decodedBytes:Ge(d)}}function qe(e,t,n){let o=n-t;if(o%4!==0)return!1;let i=n;if(o>=2&&e.charCodeAt(n-2)===61&&e.charCodeAt(n-1)===61)i-=2;else if(o>=1&&e.charCodeAt(n-1)===61)i-=1;for(let l=t;l<i;l++)if(!un(e.charCodeAt(l)))return!1;for(let l=i;l<n;l++)if(e.charCodeAt(l)!==61)return!1;return!0}function _r(e,t,n){return n-t>=5&&(e.charCodeAt(t)|32)===100&&(e.charCodeAt(t+1)|32)===97&&(e.charCodeAt(t+2)|32)===116&&(e.charCodeAt(t+3)|32)===97&&e.charCodeAt(t+4)===58}function pn(e){let t=0,n=e.length;while(t<n&&/\s/.test(e[t]??""))t+=1;while(n>t&&/\s/.test(e[n-1]??""))n-=1;return{start:t,end:n}}function Pr(e,t,n){if(!_r(e,t,n))return;let o=t+5,i=e.indexOf(",",o);if(i===-1||i>=n)return;if(i-o>128)return;let l=e.slice(o,i).toLowerCase(),d=";base64";if(!l.endsWith(d))return;let c=l.slice(0,-d.length);if(!c||c.includes(";"))return;return{mediaType:c,base64Start:i+1,base64End:n}}function gn(e,t,n={}){let o=n.maxEncodedBytes??D,i=n.maxDecodedBytes??U,l=new Set(n.supportedMediaTypes??Ae),d=e?.toLowerCase(),c=pn(t),{start:m,end:f}=c,b=Pr(t,c.start,c.end);if(b){if(d&&d!==b.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${e} does not match data URL type ${b.mediaType}`};d=b.mediaType,m=b.base64Start,f=b.base64End}if(!d||!l.has(d))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${e??"unknown"}`};let x=f-m;if(x===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(x>o)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${o} byte encoded limit`};if(!qe(t,m,f))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let S=t.slice(m,f),v=Ge(S);if(v>i)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${i} byte decoded limit`};return{ok:!0,mediaType:d,base64:S,encodedBytes:x,decodedBytes:v}}function de(e,t,n,o){let i=gn(e,t,{maxEncodedBytes:n.maxImageEncodedBytes,maxDecodedBytes:n.maxImageDecodedBytes});if(!i.ok)return Se(o,i.reason),i;let l=le(i.encodedBytes,i.decodedBytes,n,o);if(l)return l;return i}function P(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var ce="ERROR: EMPTY CONTENT",wr="[image attached]",Or="[generated image]";function Nr(e){return`[generated ${e}]`}function ke(e){return{type:"text",text:`[generated ${e.modality} unavailable to this model]`}}function ze(e,t){let n=e[e.length-1];if(t.role==="tool"&&n?.role==="tool"&&Array.isArray(n.content)&&Array.isArray(t.content)){n.content.push(...t.content);return}e.push(t)}function Lr(e){if(!Array.isArray(e)||e.length===0)return!1;return e.every((t)=>{if(!t||typeof t!=="object")return!1;let n=t;if(n.type==="text")return typeof n.text==="string";if(n.type==="image")return typeof n.data==="string"&&typeof n.mediaType==="string";return!1})}function z(){return{type:"text",text:Z}}function mn(e){return le(D,0,{maxImageEncodedBytes:D,maxImageDecodedBytes:U},e)===null}function yn(e){try{return new URL(e).protocol}catch{return}}function We(e,t){let n=de(e.mediaType,e.data,{maxImageEncodedBytes:D,maxImageDecodedBytes:U},t);if(!n.ok)return z();return hn(n.base64,n.mediaType)}function hn(e,t){return{type:"file",data:{type:"data",data:e},mediaType:t}}function te(e,t){return{type:"file",data:e,mediaType:t??"image"}}function Ke(e,t){if(e.image instanceof URL){if(e.image.protocol==="data:"){let d=de(e.mediaType,e.image.href,{maxImageEncodedBytes:D,maxImageDecodedBytes:U},t);if(!d.ok)return z();return te(`data:${d.mediaType};base64,${d.base64}`,d.mediaType)}if(e.image.protocol!=="http:"&&e.image.protocol!=="https:")return z();if(!mn(t))return z();return te(e.image,e.mediaType)}if(typeof e.image==="string"){let d=yn(e.image);if(d==="http:"||d==="https:"){if(!mn(t))return z();return te(e.image,e.mediaType)}let c=d==="data:",m=de(e.mediaType??(c?void 0:"image/png"),e.image,{maxImageEncodedBytes:D,maxImageDecodedBytes:U},t);if(!m.ok)return z();return te(c?`data:${m.mediaType};base64,${m.base64}`:m.base64,m.mediaType)}let n=e.image.byteLength,o=Ve(n),i=e.mediaType?.toLowerCase()??"image/png";if(!Ae.includes(i)||le(o,n,{maxImageEncodedBytes:D,maxImageDecodedBytes:U},t))return z();return te(e.image,i)}function Dr(e,t){if(!t)return!0;if(e.modality==="file")return e.mediaType==="application/pdf"&&t.includes("pdf");return t.includes(e.modality)}function fn(e,t,n){if(!Dr(e,n))return ke(e);if(e.modality==="image"){if(e.source.type==="artifact")return ke(e);return Ke({type:"image",image:e.source.type==="url"?e.source.url:e.source.data,mediaType:e.mediaType},t)}if(e.source.type==="artifact")return ke(e);if(e.source.type==="url"){let o=yn(e.source.url);if(o!=="http:"&&o!=="https:"&&o!=="data:")return ke(e)}return te(e.source.type==="url"?e.source.url:e.source.data,e.mediaType)}function $e(e,t,n,o){let{hoistImages:i,inlineImagePlaceholder:l}=o;if(e==null||typeof e!=="object")return{value:e,changed:!1,mediaChanged:!1};if(Array.isArray(e)){let b=[],x=!1,S=!1;for(let v of e){if(v&&typeof v==="object"){let y=v;if(y.type==="image"&&typeof y.data==="string"&&typeof y.mediaType==="string"){if(!i){b.push(l),x=!0,S=!0;continue}let Me={type:"image",data:y.data,mediaType:y.mediaType},K=We(Me,n);if(K.type==="file")t.push({type:"image",data:K.data.data,mediaType:K.mediaType});else b.push(K.text);x=!0,S=!0;continue}if(y.type==="image"){b.push(Z),x=!0,S=!0;continue}if(y.type==="text"&&typeof y.text==="string"){b.push(y.text),x=!0;continue}}let M=$e(v,t,n,o);b.push(M.value),x||=M.changed,S||=M.mediaChanged}return{value:x?b:e,changed:x,mediaChanged:S}}let d=e;if(d.type==="image"){if(typeof d.data==="string"&&typeof d.mediaType==="string"){if(!i)return{value:l,changed:!0,mediaChanged:!0};let b={type:"image",data:d.data,mediaType:d.mediaType},x=We(b,n);if(x.type==="file")return t.push({type:"image",data:x.data.data,mediaType:x.mediaType}),{value:wr,changed:!0,mediaChanged:!0};return{value:x.text,changed:!0,mediaChanged:!0}}return{value:Z,changed:!0,mediaChanged:!0}}let c={},m=!1,f=!1;for(let[b,x]of Object.entries(d)){let S=$e(x,t,n,o);c[b]=S.value,m||=S.changed,f||=S.mediaChanged}return{value:m?c:e,changed:m,mediaChanged:f}}function ue(e){if(typeof e==="string")return P(e);if(Array.isArray(e))return e.map((t)=>ue(t));if(e!==null&&typeof e==="object"){let t=e,n={};for(let[o,i]of Object.entries(t))n[o]=ue(i);return n}return e}function bn(e,t=!1,n=Ee(),o){let i=o?.supportsImages??!0;if(typeof e==="string")return{type:t?"error-text":"text",value:P(e)};if(!t&&Lr(e))return{type:"content",value:e.map((l)=>l.type==="image"?i?We(l,n):{type:"text",text:ee}:{type:"text",text:P(l.text)})};if(e!==null&&typeof e==="object"){let l=[],d=$e(e,l,n,{hoistImages:!t&&i,inlineImagePlaceholder:i?Z:ee});if(!t&&l.length>0)return{type:"content",value:[{type:"text",text:typeof d.value==="string"?P(d.value):JSON.stringify(ue(d.value))},...l.map((m)=>hn(m.data,m.mediaType))]};if(d.mediaChanged)return{type:t?"error-json":"json",value:ue(d.value)}}if(e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="object")return{type:t?"error-json":"json",value:ue(e)};return{type:t?"error-text":"text",value:P(String(e))}}function Br(e,t,n){let o=n?.assistantToolCallArgKey??"input",i=n?.supportedInputModalities,l=!i||i.includes("image"),d=[],c=Ee(),m=[],f=()=>m.splice(0).map((x)=>x.type==="image"?l?Ke(x,c):{type:"text",text:ee}:fn(x.media,c,i));if(typeof e==="string"&&e.trim().length>0||Array.isArray(e)&&e.length>0)d.push({role:"system",content:typeof e==="string"?P(e):e});for(let b of t){let x=b.content;if(typeof x==="string"){let y=b.role==="user"&&m.length>0?f():[];if(y.length>0){d.push({role:b.role,content:[{type:"text",text:x.trim().length>0?P(x):ce},...y]});continue}if(x.trim().length===0){d.push({role:b.role,content:[{type:"text",text:ce}]});continue}d.push({role:b.role,content:P(x)});continue}let S=[],v=[];if(x.length===0){d.push({role:b.role,content:[{type:"text",text:ce}]});continue}for(let y of x)switch(y.type){case"text":S.push({type:"text",text:P(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"reasoning":S.push({type:"reasoning",text:P(y.text),...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"image":if(b.role==="assistant")m.push(y),S.push({type:"text",text:Or});else S.push(l?Ke(y,c):{type:"text",text:ee});break;case"media":if(b.role==="assistant")m.push(y),S.push({type:"text",text:Nr(y.media.modality)});else S.push(fn(y.media,c,i));break;case"file":S.push({type:"text",text:He(y.path,P(y.content))});break;case"tool-call":if(b.role==="assistant")S.push({type:"tool-call",toolCallId:y.toolCallId,toolName:y.toolName,[o]:y.input,...y.providerOptions?{providerOptions:y.providerOptions}:{}});break;case"tool-result":{v.push({type:"tool-result",toolCallId:y.toolCallId,toolName:y.toolName,output:bn(y.output,y.isError??!1,c,{supportsImages:l})});break}}let M=v.length>0;if(b.role==="user"&&!M&&m.length>0)S.push(...f());if(S.length>0&&S.every((y)=>y.type==="text"&&typeof y.text==="string"&&y.text.trim().length===0))S.splice(0,S.length,{type:"text",text:ce});if(S.length>0)ze(d,{role:b.role,content:S});if(M)ze(d,{role:"tool",content:v})}if(m.length>0)ze(d,{role:"user",content:f()});return d}var Ua=["show","hide","subscription"];function xn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Hr(e,t){if(!e&&!t)return;let n=e?.metadata,o=t?.metadata,i={...e??{},...t??{}};if(xn(n)&&xn(o))i.metadata={...n,...o};return i}var Va=["web_search","image_generation"],ja=["web_search"];var pe={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},Ur=void 0;function Fr(e,t){if(typeof e==="string"&&e.toLowerCase()in pe)return e.toLowerCase();return t?void 0:void 0}function Tn(e,t){let n=typeof e==="string"?e.toLowerCase():void 0;if(n&&n in pe)return pe[n];if(t?.fallbackEffort)return pe[t.fallbackEffort];return}function Gr(e){let t=Tn(e.effort,{fallbackEffort:e.fallbackEffort});if(t===void 0)return;if(t<=0)return 0;let n=e.minimumBudget??1;if(e.maxBudget<n)return;let o=e.scaleTokens??e.maxBudget;return Math.min(Math.max(Math.floor(o*t),n),e.maxBudget)}function Vr(e){return e instanceof Error?{name:e.name,message:e.message}:e}var jr=3;function Sn(e){return Math.max(1,Math.ceil(e/3))}function Je(e){let t=new WeakSet;try{return JSON.stringify(e,(n,o)=>{if(typeof o==="bigint")return o.toString();if(typeof o!=="object"||o===null)return o;if(t.has(o))return"[Circular]";return t.add(o),o})??""}catch{return String(e??"")}}function qr(e){let t;try{t=JSON.stringify({systemPrompt:e.systemPrompt,messages:e.messages,tools:e.tools})}catch{t=[Je(e.systemPrompt),Je(e.messages),Je(e.tools)].join(`
4
+ `)}return Sn(t.length)}var zr={debug:()=>{},log:()=>{},error:()=>{}};var Ja=60,Ya=1,Xa=3600;function Wr(e){return typeof e==="number"&&Number.isFinite(e)}function Kr(e){return Math.min(Math.max(e,1),3600)}function Qa(e){if(!Wr(e))return 60;return Kr(e)}function Za(e,t,n){let o=n?` (${n})`:"",i=Math.round(t/100)/10;return`MCP request to "${e}"${o} timed out after ${i}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function $r(e){if(e instanceof Error)return e.message;return String(e)}function Jr(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return""}class j extends Error{constructor(e,t){super(`${e} at position ${t}`);this.position=t}}function An(e){return/^[0-9A-Fa-f]$/.test(e)}function G(e){return e>="0"&&e<="9"}function En(e){return e>=" "}function oe(e){return`,:[]/{}()
5
+ +`.includes(e)}function Ye(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"}function Ce(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"||e==="$"||e>="0"&&e<="9"}var Xe=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,Qe=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function Ze(e){return`,[]/{}
6
+ +`.includes(e)}function et(e){return re(e)||Yr.test(e)}var Yr=/^[[{\w-]$/;function tt(e){return e===`
7
+ `||e==="\r"||e==="\t"||e==="\b"||e==="\f"}function F(e,t){let n=e.charCodeAt(t);return n===32||n===10||n===9||n===13}function kn(e,t){let n=e.charCodeAt(t);return n===32||n===9||n===13}function Cn(e,t){let n=e.charCodeAt(t);return n===160||n===6158||n>=8192&&n<=8203||n===8239||n===8287||n===12288||n===65279}function re(e){return nt(e)||Re(e)}function nt(e){return e==='"'||e==="“"||e==="”"}function ot(e){return e==='"'}function Re(e){return e==="'"||e==="‘"||e==="’"||e==="`"||e==="´"}function rt(e){return e==="'"}function ie(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=e.lastIndexOf(t);return o!==-1?e.substring(0,o)+(n?"":e.substring(o+1)):e}function w(e,t){let n=e.length;if(!F(e,n-1))return e+t;while(F(e,n-1))n--;return e.substring(0,n)+t+e.substring(n)}function Rn(e,t,n){return e.substring(0,t)+e.substring(t+n)}function In(e){return/[,\n][ \t\r]*$/.test(e)}var Xr={"&quot;":'"',"&amp;":"&","&lt;":"<","&gt;":">","&apos;":"'"},it=12;function st(e){if(e.charAt(0)!=="&")return null;let t=e.indexOf(";");if(t===-1)return null;let n=e.substring(0,t+1),o=Xr[n];if(o!==void 0)return{char:o,length:n.length};if(e.charAt(1)==="#"){let i=e.substring(2,t),l=i.charAt(0)==="x"||i.charAt(0)==="X",d=l?i.substring(1):i;if(d.length>0){let c=Number.parseInt(d,l?16:10);if(!Number.isNaN(c)&&c>=0&&c<=1114111)return{char:String.fromCodePoint(c),length:n.length}}}return null}function vn(e){return e!==null&&e.char==='"'}function Mn(e){return e!==null&&e.char==="'"}function ne(e,t){let n=0;for(let o=0;o<e.length;o++)if(e.charAt(o)===t)n++;return n}function _n(e,t){switch(t){case")":return ne(e,"(")>ne(e,")");case"]":return ne(e,"[")>ne(e,"]");case"}":return ne(e,"{")>ne(e,"}");default:return!1}}var Pn={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},Qr={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
8
+ `,r:"\r",t:"\t"};function at(e){let t=0,n="";if(f(["```","[```","{```"]),!l())ko();f(["```","```]","```}"]);let i=x(",");if(i)d();if(et(e[t])&&In(n)){if(!i)n=w(n,",");K()}else if(i)n=ie(n,",");while(e[t]==="}"||e[t]==="]")t++,d();if(t>=e.length)return n;_e();function l(){d();let p=y()||Me()||J()||C()||To()||Et(!1)||So();return d(),p}function d(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,g=t,A=c(p);do if(A=m(),A)A=c(p);while(A);return t>g}function c(p){let g=p?F:kn,A="";while(!0)if(g(e,t))A+=e[t],t++;else if(Cn(e,t))A+=" ",t++;else break;if(A.length>0)return n+=A,!0;return!1}function m(){if(e[t]==="/"&&e[t+1]==="*"){while(t<e.length&&!Zr(e,t))t++;return t+=2,!0}if(e[t]==="/"&&e[t+1]==="/"){while(t<e.length&&e[t]!==`
9
+ `)t++;return!0}return!1}function f(p){if(b(p)){if(Ye(e[t]))while(t<e.length&&Ce(e[t]))t++;return d(),!0}return!1}function b(p){c(!0);for(let g of p){let A=t+g.length;if(e.slice(t,A)===g)return t=A,!0}return!1}function x(p){if(e[t]===p)return n+=e[t],t++,!0;return!1}function S(p){if(e[t]===p)return t++,!0;return!1}function v(){return S("\\")}function M(){if(d(),e[t]==="."&&e[t+1]==="."&&e[t+2]===".")return t+=3,d(),S(","),!0;return!1}function y(){if(e[t]==="{"){if(n+="{",t++,d(),S(","))d();let p=!0;while(t<e.length&&e[t]!=="}"){let g;if(!p){if(g=x(","),!g)n=w(n,",");d()}else g=!0;if(M(),!(J()||Et(!0))){if(e[t]==="}"||e[t]==="{"||e[t]==="]"||e[t]==="["||e[t]===void 0){if(!p)n=ie(n,",")}else Co();break}d();let B=x(":"),X=t>=e.length;if(!B)if(et(e[t])||X)n=w(n,":");else Rt();if(!l())if(B||X)n+="null";else Rt();p=!1}if(e[t]==="}")n+="}",t++;else n=w(n,"}");return!0}return!1}function Me(){if(e[t]==="["){if(n+="[",t++,d(),S(","))d();let p=!0;while(t<e.length&&e[t]!=="]"){if(!p){if(!x(","))n=w(n,",")}if(M(),!l()){if(!p)n=ie(n,",");break}p=!1}if(e[t]==="]")n+="]",t++;else n=w(n,"]");return!0}return!1}function K(){let p=!0,g=!0;while(g){if(!p){if(!x(","))n=w(n,",")}else p=!1;g=l()}if(!g)n=ie(n,",");n=`[
10
+ ${n}
11
+ ]`}function J(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,A=e[t]==="\\";if(A){if(t++,!re(e[t]))_e()}let B=e[t]==="&"?st(e.slice(t,t+it)):null,X=vn(B)||Mn(B);if(re(e[t])||X){let It=ot(e[t])?ot:rt(e[t])?rt:Re(e[t])?Re:nt,fe=t,ye=n.length,E='"';t+=X&&B?B.length:1;while(!0){if(t>=e.length){let R=kt(t-1);if(!p&&oe(e.charAt(R)))return t=fe,n=n.substring(0,ye),J(!0);return E=w(E,'"'),n+=E,!0}if(t===g)return E=w(E,'"'),n+=E,!0;let H=X&&e[t]==="&"?st(e.slice(t,t+it)):null;if(H&&B?H.char===B.char:It(e[t])){let R=t,Pe=E.length;if(E+='"',t+=H?H.length:1,n+=E,d(!1),p||t>=e.length||oe(e[t])&&!_n(E,e[t])||re(e[t])&&!Ao(t)||G(e[t]))return At(),!0;if(e[t]==="\\")_e();let V=kt(R-1),vt=e.charAt(V);if(vt===",")return t=fe,n=n.substring(0,ye),J(!1,V);if(oe(vt))return t=fe,n=n.substring(0,ye),J(!0);n=n.substring(0,ye),t=R+(H?H.length:1),E=`${E.substring(0,Pe)}\\${E.substring(Pe)}`}else if(p&&Ze(e[t])){if(e[t-1]===":"&&Xe.test(e.substring(fe+1,t+2)))while(t<e.length&&Qe.test(e[t]))E+=e[t],t++;return E=w(E,'"'),n+=E,At(),!0}else if(H){let R=H.char;if(R==='"')E+="\\\"";else if(tt(R))E+=Pn[R];else E+=R;t+=H.length}else if(e[t]==="\\"){let R=e.charAt(t+1);if(Qr[R]!==void 0)E+=e.slice(t,t+2),t+=2;else if(R==="u"){let V=2;while(V<6&&An(e[t+V]))V++;if(V===6)E+=e.slice(t,t+6),t+=6;else if(t+V>=e.length)t=e.length;else Ro()}else if(R===`
12
+ `)E+="\\n",t+=2;else E+=R,t+=2}else{let R=e.charAt(t);if(R==='"'&&e[t-1]!=="\\")E+=`\\${R}`,t++;else if(tt(R))E+=Pn[R],t++;else{if(!En(R))Eo(R);E+=R,t++}}if(A)v()}}return!1}function At(){let p=!1;d();while(e[t]==="+"){p=!0,t++,d(),n=ie(n,'"',!0);let g=n.length;if(J())n=Rn(n,g,1);else n=w(n,'"')}return p}function C(){let p=t,g="",A=!1;if(e[t]==="-"){if(g+=e[t],t++,!G(e[t])&&Ct())g+="0"}if(e[t]==="0"&&G(e[t+1]))A=!0;while(G(e[t]))g+=e[t],t++;if(e[t]==="."){if(g===""||g==="-")g+="0";if(g+=e[t],t++,!G(e[t]))g+="0";while(G(e[t]))g+=e[t],t++}if(t>p){if(e[t]==="e"||e[t]==="E"){if(g==="-")A=!0;if(g+=e[t],t++,e[t]==="-"||e[t]==="+")g+=e[t],t++;if(!G(e[t]))g+="0";while(G(e[t]))g+=e[t],t++}if(!Ct())return t=p,!1;return n+=A?`"${e.substring(p,t)}"`:g,!0}return!1}function To(){return Y("true","true")||Y("false","false")||Y("null","null")||Y("True","true")||Y("False","false")||Y("None","null")}function Y(p,g){if(e.slice(t,t+p.length)===p&&!Ce(e[t+p.length]))return n+=g,t+=p.length,!0;return!1}function Et(p){let g=t;if(Ye(e[t])){while(t<e.length&&Ce(e[t]))t++;let A=t;while(F(e,A))A++;if(e[A]==="("){if(t=A+1,l(),e[t]===")"){if(t++,e[t]===";")t++}return!0}}while(t<e.length&&!Ze(e[t])&&!re(e[t])&&(!p||e[t]!==":"))t++;if(e[t-1]===":"&&Xe.test(e.substring(g,t+2)))while(t<e.length&&Qe.test(e[t]))t++;if(t>g){while(F(e,t-1)&&t>0)t--;let A=e.slice(g,t);if(n+=A==="undefined"?"null":JSON.stringify(A),e[t]==='"')t++;return!0}}function So(){if(e[t]==="/"){let p=t;t++;while(t<e.length&&(e[t]!=="/"||e[t-1]==="\\"))t++;return t++,n+=JSON.stringify(e.substring(p,t)),!0}}function kt(p){let g=p;while(g>0&&F(e,g))g--;return g}function Ao(p){let g=p+1;while(g<e.length&&F(e,g))g++;return g>=e.length||oe(e[g])}function Ct(){return t>=e.length||oe(e[t])||F(e,t)}function Eo(p){throw new j(`Invalid character ${JSON.stringify(p)}`,t)}function _e(){throw new j(`Unexpected character ${JSON.stringify(e[t])}`,t)}function ko(){throw new j("Unexpected end of json string",e.length)}function Co(){throw new j("Object key expected",t)}function Rt(){throw new j("Colon expected",t)}function Ro(){let p=e.slice(t,t+6);throw new j(`Invalid unicode character "${p}"`,t)}}function Zr(e,t){return e[t]==="*"&&e[t+1]==="/"}function ei(e){let t=!1,n=!1,o=!1;for(let i=0;i<e.length;i+=1){let l=e[i];if(o){o=!1;continue}if(l==="\\"){o=!0;continue}if(!n&&l==='"')t=!t;else if(!t&&l==="'")n=!n}return t||n}var ti=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function ni(e){let t=e.match(ti);if(!t)return;let[,n,o]=t,i=o.trim();if(!i)return;let l=i[0];if(l==='"'||l==="{"||l==="["||i==="true"||i==="false"||i==="null"||Number.isFinite(Number(i)))return;return JSON.parse(`{"${n}":${JSON.stringify(i)}}`)}function oi(e){if(typeof e!=="string")return e;let t=e.trimStart();if(t[0]!=="{"&&t[0]!=="[")return e;try{return JSON.parse(t)}catch{}if(!ei(t))try{return JSON.parse(at(t))}catch{}return ni(t)??e}function ri(e){let t=new WeakSet;try{return JSON.stringify(e,(o,i)=>{if(typeof i==="bigint")return i.toString();if(i&&typeof i==="object"){if(t.has(i))return"[Circular]";t.add(i)}return i})??"null"}catch{return String(e)}}function ii(e){try{return JSON.parse(e)}catch{return}}function se(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function si(e){let t=e.type;if(typeof t==="string")return[t];return Array.isArray(t)?t.filter((n)=>typeof n==="string"):[]}function lt(e,t){if(si(e).includes(t))return!0;for(let o of["anyOf","oneOf","allOf"]){let i=e[o];if(Array.isArray(i)&&i.some((l)=>se(l)&&lt(l,t)))return!0}return!1}function ai(e,t){if(typeof e!=="string")return e;let n=e.trim(),o=lt(t,"array"),i=lt(t,"object");if((!o||!n.startsWith("["))&&(!i||!n.startsWith("{")))return e;try{let l=JSON.parse(n);if(Array.isArray(l))return o?l:e;if(se(l))return i?l:e;return e}catch{return e}}function dt(e,t){let n=ai(e,t);if(Array.isArray(n)){let d=t.items;if(!se(d))return n;let c=!1,m=n.map((f)=>{let b=dt(f,d);return c||=b!==f,b});return c?m:n}if(!se(n))return n;let o=t.properties;if(!se(o))return n;let i=!1,l={...n};for(let[d,c]of Object.entries(o)){if(!(d in n)||!se(c))continue;let m=dt(n[d],c);if(m!==n[d])l[d]=m,i=!0}return i?l:n}function li(e){if(typeof globalThis.atob==="function")try{let t=globalThis.atob(e),n=Uint8Array.from(t,(o)=>o.charCodeAt(0));return new TextDecoder().decode(n)}catch{return null}if(typeof Buffer<"u")try{return Buffer.from(e,"base64").toString("utf8")}catch{return null}return null}function di(e){let t=e?.trim();if(!t)return null;try{let n=t.split(".");if(n.length!==3)return null;let o=n[1];if(!o)return null;let i=o.replace(/-/g,"+").replace(/_/g,"/"),l=i.padEnd(i.length+(4-i.length%4)%4,"="),d=li(l);return d?JSON.parse(d):null}catch{return null}}function ci(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function wn(e){let t=e.replaceAll("\\","/"),n=t.lastIndexOf("/");return(n>=0?t.slice(n+1):t).toLowerCase()}function ui(e){return e==="win32"?"powershell":"/bin/bash"}function ct(e){let t=wn(e);if(ge(e)!==void 0)return"powershell";if(t==="cmd"||t==="cmd.exe")return"cmd";if(t==="wsl"||t==="wsl.exe")return"wsl";return"posix"}var pi=new Set(["-nologo","-noninteractive","-noprofile"]),gi="-noprofile";function mi(e,t){let n="";for(let o=0;o<e.length;o++){let i=e[o];if(i==="`"&&o+1<e.length){let l=e[o+1];if(l==="u"&&t==="core"&&e[o+2]==="{"){let d=e.indexOf("}",o+3),c=d>o+3?e.slice(o+3,d):"",m=Number.parseInt(c,16);if(c.length<=6&&/^[0-9a-fA-F]+$/.test(c)&&m<=1114111){n+=String.fromCodePoint(m),o=d;continue}}switch(l){case"n":n+=`
13
+ `;break;case"r":n+="\r";break;case"t":n+="\t";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;case"0":n+="\x00";break;case"a":n+="\x07";break;case"e":n+=t==="core"?"\x1B":"e";break;default:n+=l}o++;continue}if(i==='"'&&e[o+1]==='"'){n+='"',o++;continue}n+=i}return n}function fi(e){let t=e[0];if(t!=="'"&&t!=='"')return;for(let n=1;n<e.length;n++){let o=e[n];if(t==='"'&&o==="`"){n++;continue}if(o===t){if(e[n+1]===t){n++;continue}if(e.slice(n+1).trim()!=="")return;return{quote:t,body:e.slice(1,n)}}}return}function ge(e){let t=wn(e);if(t==="powershell"||t==="powershell.exe")return"windows";if(t==="pwsh"||t==="pwsh.exe")return"core";return}function yi(e,t){let n=fi(e);if(!n)return;let o=(n.quote==="'"?n.body.replaceAll("''","'"):mi(n.body,t)).trim();return o.length>0?o:void 0}function hi(e,t){let n=/^[ \t]*(?:&[ \t]*(?:"([^"$`]*)"|'((?:[^']|'')*)')|(?:&[ \t]*)?([^\s$`"';&|<>(){}#@,]+))[ \t]+([\S\s]*)$/.exec(e);if(!n)return;let o=n[1]??n[2]?.replaceAll("''","'")??n[3],i=ge(t);if(!i||!ge(o))return;let l=n[4],d=!1;for(;;){let c=/^(-[^\s=]+)[ \t]*([\S\s]*)$/.exec(l);if(!c)return;let m=c[1].toLowerCase();if(m==="-command"){let f=d?yi(c[2],i):void 0;return f===void 0?void 0:{executable:o,script:f}}if(!pi.has(m))return;if(m===gi)d=!0;l=c[2]}}function bi(e,t){if(!/[\\/:]/.test(t)&&ge(t)===ge(e))return e;return t}function On(e,t){switch(ct(e)){case"powershell":{let n={executable:e,script:t};for(;;){let o=hi(n.script,n.executable);if(!o)break;n={executable:bi(e,o.executable),script:o.script}}return{executable:n.executable,args:["-NoProfile","-NonInteractive","-Command","[Console]::InputEncoding=[Text.UTF8Encoding]::new();[Console]::OutputEncoding=[Text.UTF8Encoding]::new();$ErrorActionPreference='Stop';$c=[Console]::In.ReadToEnd();$c+=[Environment]::NewLine+'if(-not $?){exit 1}';& ([ScriptBlock]::Create($c))"],input:n.script}}case"cmd":return{executable:e,args:["/d","/s","/c",t]};case"wsl":return{executable:e,args:["bash","-c",t]};case"posix":return{executable:e,args:["-c",t]}}}function xi(e,t){if(ct(e)==="powershell")return["-NoProfile","-NonInteractive","-Command",t];return On(e,t).args}function Ti(e){return e.toLowerCase().replace(/[^\w.-]+/g,"_")}function Si(e){let t=e?.trim();return t?t:void 0}function Nn(e,t){if(e.length<=t)return e;return`${e.slice(0,t-1)}…`}function Ai(e,t="/",n=100){if(!e||e.length<=n)return e||"";let o=e.split(t)?.shift()?.trim()?.slice(0,n-1);return o?`${o}…`:Nn(e,n)}function Ei(e){if(e.length<=8)return"****";return`${e.slice(0,4)}...${e.slice(-4)}`}function ki(e){return e.charCodeAt(0)===65279?e.slice(1):e}function Ci(e){if(!e)return"(unknown-date)";let t=new Date(e);if(Number.isNaN(t.getTime()))return e;return t.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}function Ri(e){let t=Math.max(0,Math.floor(e/1000)),n=Math.floor(t/86400),o=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),l=t%60;if(n>0)return`${n}d ${o}h`;if(o>0)return`${o}h ${i}m`;if(i>0)return`${i}m ${l}s`;return`${l}s`}import{z as Ln}from"zod";function Ii(e,t){let n=e.safeParse(t);if(!n.success)throw Error(Ln.prettifyError(n.error));return n.data}function ut(e){return Ln.toJSONSchema(e)}function pt(e){return e==="cline"||e==="cline-pass"}var Dn=`You are Cline, an AI coding agent. Your primary goal is to assist users with various coding tasks by leveraging your knowledge and the tools at your disposal. Given the user's prompt, you should use the tools available to you to answer user's question.
14
14
 
15
15
  Always gather all the necessary context before starting to work on a task. For example, if you are generating a unit test or new code, make sure you understand the requirement, the naming conventions, frameworks and libraries used and aligned in the current codebase, and the environment and commands used to run and test the code etc. Always validate the new unit test at the end including running the code if possible for live feedback.
16
16
  Review each question carefully and answer it with detailed, accurate information.
@@ -45,7 +45,7 @@ When you have completed the task, please provide a summary of what you did and a
45
45
 
46
46
  If user asked a simple question without any coding context, answer it directly without using any tools.
47
47
  {{CLINE_RULES}}
48
- {{CLINE_METADATA}}`;var v1=`You are Cline, a careful and helpful coding agent that works in the background.
48
+ {{CLINE_METADATA}}`;var Bn=`You are Cline, a careful and helpful coding agent that works in the background.
49
49
  You are tasked to solve an issue reported by the user who you cannot communicate with directly.
50
50
  Your goal is to utilize the tools at your disposal to investigate and answer the question according to user's instructions with the aim to verify that the issue is resolved.
51
51
 
@@ -84,9 +84,9 @@ IMPORTANT:
84
84
  - When you call 'submit_and_exit', set 'verified' to true only if your tool output shows the requirements are met; otherwise set it to false.
85
85
  - Response without the submit_and_exit tool call will considered not completed and the task will continue.
86
86
  {{CLINE_RULES}}
87
- {{CLINE_METADATA}}`;var j0={ACT:g1,YOLO:v1};var R0="# Workspace Configuration",h1=`# Plan / Act Modes
87
+ {{CLINE_METADATA}}`;var gt={ACT:Dn,YOLO:Bn};var mt="# Workspace Configuration",Un=`# Plan / Act Modes
88
88
 
89
- User messages arrive wrapped in a <user_input mode="..."> tag. The mode attribute is the interaction mode the user was in when they sent that message: "plan" means plan-mode constraints applied (explore, analyze, and align on a plan -- no edits or state-changing commands), while "act" (or "yolo") means implementation was allowed. If the mode attribute changes between messages, the user switched modes -- the newest message's mode is what governs right now, regardless of what earlier messages allowed. A <mode_notice> block inside a message marks exactly when such a switch happened.`,x1=`# Plan Mode
89
+ User messages arrive wrapped in a <user_input mode="..."> tag. The mode attribute is the interaction mode the user was in when they sent that message: "plan" means plan-mode constraints applied (explore, analyze, and align on a plan -- no edits or state-changing commands), while "act" (or "yolo") means implementation was allowed. If the mode attribute changes between messages, the user switched modes -- the newest message's mode is what governs right now, regardless of what earlier messages allowed. A <mode_notice> block inside a message marks exactly when such a switch happened.`,Fn=`# Plan Mode
90
90
 
91
91
  You are in Plan mode. Your role is to explore, analyze, and plan -- not to execute.
92
92
 
@@ -97,14 +97,14 @@ You are in Plan mode. Your role is to explore, analyze, and plan -- not to execu
97
97
  - Do NOT edit files, write code, run destructive commands, or make any changes
98
98
  - Do NOT implement anything -- focus on understanding and alignment first
99
99
 
100
- The run_commands tool remains available in plan mode strictly for read-only inspection -- listing files, searching (grep), reading configs, inspecting git history and diffs, checking tool versions, and the like. Never use it to change anything: no creating, modifying, or deleting files, no writing scripts that make changes, and no state-changing commands (installs, migrations, database or schema changes, container commands that mutate state, etc.). File-editing commands (rm/mv/cp, in-place edits like sed -i, output redirection to files outside /tmp, git commands that change the working tree, package installs) are hard-blocked in plan mode: they are not executed and return a tool error instead, so do not attempt them. If the task requires a mutation, put it in the plan; it happens only after the user switches to act mode.`,z1=`${x1}
100
+ The run_commands tool remains available in plan mode strictly for read-only inspection -- listing files, searching (grep), reading configs, inspecting git history and diffs, checking tool versions, and the like. Never use it to change anything: no creating, modifying, or deleting files, no writing scripts that make changes, and no state-changing commands (installs, migrations, database or schema changes, container commands that mutate state, etc.). File-editing commands (rm/mv/cp, in-place edits like sed -i, output redirection to files outside /tmp, git commands that change the working tree, package installs) are hard-blocked in plan mode: they are not executed and return a tool error instead, so do not attempt them. If the task requires a mutation, put it in the plan; it happens only after the user switches to act mode.`,Gn=`${Fn}
101
101
 
102
- Once the user has reviewed your plan and explicitly approved it in a follow-up message, use the switch_to_act_mode tool to switch to act mode and begin implementation. Calling switch_to_act_mode immediately starts execution, so never call it in the same turn you present a plan and never treat the original task request as approval -- end your turn after presenting the plan and wait for the user's response.`,c1=`${x1}
102
+ Once the user has reviewed your plan and explicitly approved it in a follow-up message, use the switch_to_act_mode tool to switch to act mode and begin implementation. Calling switch_to_act_mode immediately starts execution, so never call it in the same turn you present a plan and never treat the original task request as approval -- end your turn after presenting the plan and wait for the user's response.`,Vn=`${Fn}
103
103
 
104
- Once you have presented your plan, end your turn and wait for the user's response. You do NOT have the ability to switch to act mode yourself -- the user must do it manually with the Plan/Act toggle once they are satisfied with the plan. If the task requires tools that are only available in act mode, ask the user to "toggle to Act mode" (use those words).`;function n1(f,$,w){if(w?.trim()?.includes(R0))return w.trim();let Y=w||JSON.stringify({workspaces:{[f]:{hint:$||f.split("/").at(-1)||f}}},null,2);return`
105
- ${R0}
106
- ${Y}`}function A2(f){let{ide:$="Terminal Shell",mode:w,platform:Y="unknown",workspaceName:J,metadata:X,rules:G,overridePrompt:H,providerId:R,planModeSwitchTool:V=!0}=f,F=f.workspaceRoot??f.rootPath??"",D=k0(R||"");if(H?.trim()){let b=H.trim();if(D&&X?.trim()&&!b.includes(R0))return`${b}
104
+ Once you have presented your plan, end your turn and wait for the user's response. You do NOT have the ability to switch to act mode yourself -- the user must do it manually with the Plan/Act toggle once they are satisfied with the plan. If the task requires tools that are only available in act mode, ask the user to "toggle to Act mode" (use those words).`;function Hn(e,t,n){if(n?.trim()?.includes(mt))return n.trim();let o=n||JSON.stringify({workspaces:{[e]:{hint:t||e.split("/").at(-1)||e}}},null,2);return`
105
+ ${mt}
106
+ ${o}`}function vi(e){let{ide:t="Terminal Shell",mode:n,platform:o="unknown",workspaceName:i,metadata:l,rules:d,overridePrompt:c,providerId:m,planModeSwitchTool:f=!0}=e,b=e.workspaceRoot??e.rootPath??"",x=pt(m||"");if(c?.trim()){let M=c.trim();if(x&&l?.trim()&&!M.includes(mt))return`${M}
107
107
 
108
- ${n1(F,J,X)}`.trim();return b}let U=w==="yolo"?j0.YOLO:j0.ACT,C=[G,w==="yolo"?void 0:h1,w==="plan"?V?z1:c1:void 0].filter(Boolean).join(`
108
+ ${Hn(b,i,l)}`.trim();return M}let S=n==="yolo"?gt.YOLO:gt.ACT,v=[d,n==="yolo"?void 0:Un,n==="plan"?f?Gn:Vn:void 0].filter(Boolean).join(`
109
109
 
110
- `);return U.replace("{{PLATFORM_NAME}}",Y).replace("{{CWD}}",F).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",$).replace("{{CLINE_METADATA}}",D?n1(F,J,X):"").replace("{{CLINE_RULES}}",C).trim()}var N2="anthropic/claude-sonnet-5";var C2="remote://";import{z as q}from"zod";var u1=q.object({id:q.string(),temperature:q.number().optional(),maxTokens:q.number().optional(),contextWindow:q.number().optional(),inputPrice:q.number().optional(),outputPrice:q.number().optional(),supportsImages:q.boolean().optional()}),o1=q.object({models:q.array(u1).optional(),openAiBaseUrl:q.string().optional(),openAiHeaders:q.record(q.string(),q.string()).optional(),azureApiVersion:q.string().optional(),azureIdentity:q.boolean().optional()}),l1=q.object({id:q.string(),thinkingBudgetTokens:q.number().optional()}),m1=q.object({name:q.string(),baseModelId:q.string(),thinkingBudgetTokens:q.number().optional()}),p1=q.object({models:q.array(l1).optional(),customModels:q.array(m1).optional(),awsRegion:q.string().optional(),awsUseCrossRegionInference:q.boolean().optional(),awsUseGlobalInference:q.boolean().optional(),awsBedrockUsePromptCache:q.boolean().optional(),awsBedrockEndpoint:q.string().optional()}),d1=q.object({id:q.string()}),r1=q.object({models:q.array(d1).optional()}),s1=q.object({id:q.string(),thinkingBudgetTokens:q.number().optional()}),i1=q.object({models:q.array(s1).optional(),vertexProjectId:q.string().optional(),vertexRegion:q.string().optional()}),a1=q.object({id:q.string(),thinkingBudgetTokens:q.number().optional(),promptCachingEnabled:q.boolean().optional()}),t1=q.object({models:q.array(a1).optional(),baseUrl:q.string().optional()}),e1=q.object({id:q.string(),thinkingBudgetTokens:q.number().optional()}),f6=q.object({models:q.array(e1).optional(),baseUrl:q.string().optional()}),b2=q.object({OpenAiCompatible:o1.optional(),AwsBedrock:p1.optional(),Cline:r1.optional(),Vertex:i1.optional(),LiteLLM:t1.optional(),Anthropic:f6.optional()}),$6=q.object({id:q.string()}),w6=q.object({name:q.string(),url:q.string(),alwaysEnabled:q.boolean().optional(),headers:q.record(q.string(),q.string()).optional()}),V0=q.object({alwaysEnabled:q.boolean(),name:q.string(),contents:q.string()}),Af=q.object({bucket:q.string(),accessKeyId:q.string(),secretAccessKey:q.string(),region:q.string().optional(),endpoint:q.string().optional(),accountId:q.string().optional()}),Y6=q.object({enabled:q.boolean().optional(),type:q.union([q.literal("s3_access_keys"),q.literal("r2_access_keys"),q.literal("azure_access_keys")]).optional(),s3AccessSettings:Af.optional(),r2AccessSettings:Af.optional(),azureAccessSettings:Af.optional()}),Z6=q.object({promptUploading:Y6.optional()}),M2=q.object({version:q.string(),providerSettings:b2.optional(),telemetryEnabled:q.boolean().optional(),kanbanEnabled:q.boolean().optional(),mcpMarketplaceEnabled:q.boolean().optional(),allowedMCPServers:q.array($6).optional(),remoteMCPServers:q.array(w6).optional(),blockPersonalRemoteMCPServers:q.boolean().optional(),yoloModeAllowed:q.boolean().optional(),openTelemetryEnabled:q.boolean().optional(),openTelemetryMetricsExporter:q.string().optional(),openTelemetryLogsExporter:q.string().optional(),openTelemetryOtlpProtocol:q.string().optional(),openTelemetryOtlpEndpoint:q.string().optional(),openTelemetryOtlpHeaders:q.record(q.string(),q.string()).optional(),openTelemetryOtlpMetricsProtocol:q.string().optional(),openTelemetryOtlpMetricsEndpoint:q.string().optional(),openTelemetryOtlpMetricsHeaders:q.record(q.string(),q.string()).optional(),openTelemetryOtlpLogsProtocol:q.string().optional(),openTelemetryOtlpLogsEndpoint:q.string().optional(),openTelemetryOtlpLogsHeaders:q.record(q.string(),q.string()).optional(),openTelemetryMetricExportInterval:q.number().optional(),openTelemetryOtlpInsecure:q.boolean().optional(),openTelemetryLogBatchSize:q.number().optional(),openTelemetryLogBatchTimeout:q.number().optional(),openTelemetryLogMaxQueueSize:q.number().optional(),enterpriseTelemetry:Z6.optional(),globalRules:q.array(V0).optional(),globalWorkflows:q.array(V0).optional()}),y2=q.record(q.string(),q.string());var T2=4317;var E2="127.0.0.1:4317";import W0 from"zod";var S2=W0.enum(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),g2=W0.enum(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),v2=W0.enum(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var n2="runtime.team.progress.v1",h2="runtime.team.lifecycle.v1";function J6(){return globalThis}function x2(f){J6().__clineClientIdentity=f}function z2(){return J6().__clineClientIdentity}var c2="CLINE_ENVIRONMENT",u2="CLINE_ENVIRONMENT_OVERRIDE",_0={production:{environment:"production",appBaseUrl:"https://app.cline.bot",apiBaseUrl:"https://api.cline.bot",mcpBaseUrl:"https://api.cline.bot/v1/mcp",workOsClientId:"client_01K3A541FN8TA3EPPHTD2325AR"},staging:{environment:"staging",appBaseUrl:"https://staging-app.cline.bot",apiBaseUrl:"https://core-api.staging.int.cline.bot",mcpBaseUrl:"https://core-api.staging.int.cline.bot/v1/mcp",workOsClientId:"client_01K3A5415VF6QBQBG3XYCW91G6"},local:{environment:"local",appBaseUrl:"http://localhost:3000",apiBaseUrl:"http://localhost:7777",mcpBaseUrl:"http://localhost:7777/v1/mcp",workOsClientId:"client_01K6XQAY7JK6T5HXVSZW2S5VYK"}},o2="production";function K6(f){let $=f?.trim().toLowerCase();if($==="production"||$==="staging"||$==="local")return $;return}function q6(){if(typeof process>"u"||!process?.env)return{};return process.env}function X6(){let f=q6();return K6(f.CLINE_ENVIRONMENT_OVERRIDE)??K6(f.CLINE_ENVIRONMENT)??"production"}function l2(f){if(typeof f==="string")return _0[f];return _0[X6()]}function m2(f,$){if($.CLINE_API_BASE_URL)f={...f,apiBaseUrl:$.CLINE_API_BASE_URL,mcpBaseUrl:`${$.CLINE_API_BASE_URL}/v1/mcp`};return f}function p2(f){let $=l2(f);return m2($,q6())}var d2="agent.reasoning.unexpected_tokens",r2="task.provider_request_started",s2="task.provider_stream_started",i2="task.first_chunk_received",a2="task.provider_stream_failed",t2="task.cancelled",e2="task.max_tokens_recovery";var f4="sdk.error";var p=new Map;function $4(){p.clear()}function w4(f,$){let w=typeof $.error_message==="string"?$.error_message:"";return[f,$.component,$.operation,$.error_type,$.error_code??"",$.error_status??"",w.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function Y4(f){let $=Date.now(),w=p.get(f);if(w&&$-w.startMs<3600000){if(w.emitted<5)return w.emitted+=1,{emit:!0,suppressed:0};return w.suppressed+=1,{emit:!1,suppressed:w.suppressed}}let Y=w?.suppressed??0;if(p.delete(f),p.size>=512){let J=p.keys().next();if(!J.done)p.delete(J.value)}return p.set(f,{startMs:$,emitted:1,suppressed:0}),{emit:!0,suppressed:Y}}function Z4(f,$){f?.capture({event:"agent.reasoning.unexpected_tokens",properties:D0({sessionId:$.sessionId,agentId:$.agentId,runId:$.runId,iteration:$.iteration,providerId:$.providerId,modelId:$.modelId,requestedThinking:$.requestedThinking,reasoningTokenCount:$.reasoningTokenCount})})}function J4(f,$){if(!f)return;f.capture({event:$.event,properties:D0({sessionId:$.sessionId,ulid:$.ulid??$.sessionId,agentId:$.agentId,conversationId:$.conversationId,runId:$.runId,iteration:$.iteration,provider:$.providerId,providerId:$.providerId,model:$.modelId,modelId:$.modelId,phase:$.phase,durationMs:$.durationMs,eventType:$.eventType,...$.error===void 0?{}:L0($.error,$.messageLimit),error_class:$.errorClass})})}function K4(f,$){if(!f)return!1;let w=$.event??"sdk.error",Y=G6($),J=0;try{let X=Y4(w4(w,Y));if(!X.emit)return!0;J=X.suppressed}catch{}return f.capture({event:w,properties:J>0?{...Y,suppressed_count:J}:Y}),!0}function G6(f){return D0({...f.context??{},component:f.component,operation:f.operation,severity:f.severity??"error",handled:f.handled??!0,...L0(f.error,f.messageLimit,f.errorMessage)})}function D0(f){let $={};for(let[w,Y]of Object.entries(f))if(Y!==void 0)$[w]=Y;return $}function L0(f,$=500,w){let Y=G4(f)?f:void 0,J=f instanceof Error?f:void 0,X=jf(w)??jf(J?.message)??jf(Y?.message)??H4(f)??"Unknown error",G=Q4(Y?.code),H=F0(Y?.status)??F0(Y?.statusCode)??F0(Y?.responseStatus);return{error_type:J?.name?.trim()||jf(Y?.name)||J?.constructor?.name||"Error",error_message:X4(q4(X),$),...G!==void 0?{error_code:G}:{},...H!==void 0?{error_status:H}:{}}}function q4(f){return f.replace(/(authorization=Bearer\s+)[^&\s]+/gi,"$1[redacted]").replace(/(api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|password|secret)=([^&\s]+)/gi,"$1=[redacted]").replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,"$1[redacted]").replace(/\/Users\/[^/\s]+/g,"/Users/[redacted]").replace(/\/home\/[^/\s]+/g,"/home/[redacted]").replace(/([A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s]+/g,"$1[redacted]")}function X4(f,$){let w=Math.max(1,Math.floor($));return f.length>w?f.substring(0,w):f}function G4(f){return typeof f==="object"&&f!==null}function jf(f){return typeof f==="string"&&f.trim().length>0?f:void 0}function H4(f){if(f instanceof Error)return;let $=typeof f==="string"?f:String(f);return $==="[object Object]"?void 0:jf($)}function Q4(f){if(typeof f==="string"&&f.trim().length>0)return f;if(typeof f==="number"&&Number.isFinite(f))return f;return}function F0(f){return typeof f==="number"&&Number.isFinite(f)?f:void 0}function H6(f){let $={};if(!f)return $;return f.split(",").forEach((w)=>{let Y=w.indexOf("=");if(Y<=0)return;try{let J=decodeURIComponent(w.substring(0,Y).trim()),X=decodeURIComponent(w.substring(Y+1).trim());if(!J||!X)return;$[J]=X}catch{}}),$}function k4(){if(!process.env)return{enabled:!1};return{enabled:process.env.OTEL_TELEMETRY_ENABLED==="1"||process.env.OTEL_TELEMETRY_ENABLED==="true",metricsExporter:process.env.OTEL_METRICS_EXPORTER||"otlp",logsExporter:process.env.OTEL_LOGS_EXPORTER||"otlp",tracesExporter:process.env.OTEL_TRACES_EXPORTER,otlpProtocol:process.env.OTEL_EXPORTER_OTLP_PROTOCOL||"http/json",otlpEndpoint:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,metricExportInterval:process.env.OTEL_METRIC_EXPORT_INTERVAL?Number.parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL,10):void 0,otlpHeaders:process.env.OTEL_EXPORTER_OTLP_HEADERS?H6(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function Q6(f={}){return{extension_version:"unknown",cline_type:"unknown",platform:"terminal",platform_version:process?.version||"unknown",os_type:process?.platform||"unknown",os_version:process?.platform==="win32"?process?.env?.OS??"unknown":"unknown",...f}}function j4(f={}){return{...k4(),...f,metadata:Q6(f.metadata)}}function k6(f){let $=f?.trim();return $?$:void 0}function R4(f,$){if(!f)return;let w=typeof f==="function"?f($):f;if(!w)return;let Y=k6(w.rootSessionId);if(!Y)return;return{rootSessionId:Y}}function V4(f){return k6(f?.rootSessionId)}var W4=(f)=>crypto.getRandomValues(new Uint8Array(f)),_4=(f,$,w)=>{let Y=256-256%f.length;if(Y===256){let X=f.length-1;return(G=$)=>{if(!G)return"";let H="";while(!0){let R=w(G),V=G;while(V--)if(H+=f[R[V]&X],H.length>=G)return H}}}let J=Math.ceil(409.6*$/Y);return(X=$)=>{if(!X)return"";let G="";while(!0){let H=w(J),R=J;while(R--)if(H[R]<Y){if(G+=f[H[R]%f.length],G.length>=X)return G}}}},j6=(f,$=21)=>_4(f,$|0,W4);function F4(f="",$=""){let w=j6("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${f}${Date.now()}_${w(5)}${$}`}var D4=["idle","running","pending","completed","failed","cancelled"];var U0=["rules","skills","workflows","plugins","hooks"],R6=U0,L4=new Set(U0);function V6(f){return typeof f==="string"&&L4.has(f)}function U4(f){if(!Array.isArray(f))return;let $=f.map((w)=>typeof w==="string"?w.trim():"").filter(V6);return[...new Set($)]}function I4(f,$){return new Set(f??R6).has($)}import{z as E}from"zod";var P4=E.object({rootPath:E.string().min(1),hint:E.string().min(1).optional(),associatedRemoteUrls:E.array(E.string().min(1)).optional(),latestGitCommitHash:E.string().min(1).optional(),latestGitBranchName:E.string().min(1).optional()}),O4=E.object({currentWorkspacePath:E.string().min(1).optional(),workspaces:E.record(E.string().min(1),P4)});function r8(){return{workspaces:{}}}function s8(f,$){let w={...f,workspaces:{...f.workspaces,[$.rootPath]:$}};if(!w.currentWorkspacePath)w.currentWorkspacePath=$.rootPath;return O4.parse(w)}var B4="workspaces",A4="chat";function N4(f){let $=f.trim(),w=/^[A-Za-z]:[\\/]/.test($)||$.startsWith("\\\\"),Y=$.startsWith("/");if(!w&&!Y)return!1;let J=$.split(w?/[\\/]+/:/\/+/).filter(Boolean),X=J.at(-1)??"",G=J.at(-2)??"",H=J.at(-3)??"";return(J.at(-4)??"")===".cline"&&H==="data"&&G==="workspaces"&&X==="chat"}import{z as Z}from"zod";var C4=["current_state","boundary_analysis","interface_proposal"],e8=3600000,fw=240,$w=400,S=Z.preprocess((f)=>f instanceof Date?f.toISOString():f,Z.string().datetime()),Kf=Z.enum(["pending","in_progress","blocked","completed"]),W6=Z.enum(["queued","running","completed","failed","cancelled","interrupted"]),Nf=Z.enum(["draft","in_review","finalized"]),b4=Z.object({agentId:Z.string(),role:Z.enum(["lead","teammate"]),description:Z.string().optional(),status:Z.enum(["idle","running","stopped"])}),ww=Z.object({agentId:Z.string(),rolePrompt:Z.string(),modelId:Z.string().optional(),maxIterations:Z.number().optional()});function O(f){return Z.preprocess(($)=>$===null?void 0:$,f.optional())}var Yw=Z.object({agentId:Z.string().min(1).describe("Teammate identifier"),rolePrompt:Z.string().min(1).describe("System prompt describing teammate role")}).strict(),Zw=Z.object({agentId:Z.string().min(1).describe("Teammate identifier"),reason:O(Z.string().min(1)).describe("Optional shutdown reason")}),Jw=Z.object({}),M4={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},Kw={create:["status","taskId","summary","reason"]},qw=Z.object({action:Z.enum(["create","list","claim","complete","block"]),title:O(Z.string().min(1)).describe("Task title"),description:O(Z.string().min(1)).describe("Task details"),dependsOn:O(Z.array(Z.string().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:O(Z.string().min(1)).describe("Optional assignee"),status:O(Z.enum(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:O(Z.string()).describe("Task ID"),summary:O(Z.string().min(1)).describe("Completion summary"),reason:O(Z.string().min(1)).describe("Blocking reason")}).superRefine((f,$)=>{for(let w of M4[f.action]){if(f[w]!==void 0)continue;$.addIssue({code:"custom",path:[w],message:`Field "${w}" is required when action=${f.action}`})}}),Xw=Z.object({agentId:Z.string().describe("Teammate agent ID"),task:Z.string().min(1).describe("Task instructions for the teammate"),taskId:O(Z.string()).describe("Optional shared task list ID"),runMode:O(Z.enum(["sync","async"])).describe("Execution mode: 'sync' blocks until the teammate finishes and returns the result (default if omitted); 'async' queues the run and returns a runId immediately — use team_await_runs to collect results later."),continueConversation:O(Z.boolean()).describe("If true, continue the teammate conversation; otherwise start fresh")}),Gw=Z.object({status:O(Z.enum(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:O(Z.string().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:O(Z.boolean()).describe("Include completed/failed runs (default true)")}),Hw=Z.object({runId:Z.string().min(1).describe("Run ID"),reason:O(Z.string().min(1)).describe("Optional cancellation reason")}),Qw=Z.object({runId:O(Z.string().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),kw=Z.object({toAgentId:Z.string().min(1).describe("Recipient agent ID"),subject:Z.string().min(1).describe("Message subject"),body:Z.string().min(1).describe("Message body"),taskId:O(Z.string().min(1)).describe("Optional task ID context")}),jw=Z.object({subject:Z.string().min(1).describe("Message subject"),body:Z.string().min(1).describe("Message body"),taskId:O(Z.string().min(1)).describe("Optional task ID context")}),Rw=Z.object({unreadOnly:O(Z.boolean()).describe("Only unread messages for read action (default true)")}),Vw=Z.object({kind:Z.enum(["progress","handoff","blocked","decision","done","error"]),summary:Z.string().min(1).describe("Update summary"),taskId:O(Z.string().min(1)).describe("Optional task ID context"),evidence:O(Z.array(Z.string().min(1))).describe("Optional evidence links/snippets"),nextAction:O(Z.string().min(1)).describe("Planned next step")}),Ww=Z.object({}),_w=Z.object({title:Z.string().describe("Outcome title"),requiredSections:Z.array(Z.string()).default(C4).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),Fw=Z.object({outcomeId:Z.string().describe("Outcome ID"),section:Z.string().describe("Section name"),sourceRunId:O(Z.string()).describe("Optional source run ID"),content:Z.string().describe("Section fragment content")}),Dw=Z.object({fragmentId:Z.string().describe("Fragment ID"),approved:Z.boolean().describe("Review decision")}),Lw=Z.object({outcomeId:Z.string().describe("Outcome ID")}),Uw=Z.object({}),Iw=Z.object({teamId:Z.string(),teamName:Z.string(),members:Z.array(b4),taskCounts:Z.record(Kf,Z.number()),unreadMessages:Z.number(),missionLogEntries:Z.number(),activeRuns:Z.number(),queuedRuns:Z.number(),outcomeCounts:Z.record(Nf,Z.number())}),y4=Z.object({id:Z.string(),title:Z.string(),description:Z.string(),status:Kf,createdAt:S,updatedAt:S,createdBy:Z.string(),assignee:Z.string().optional(),dependsOn:Z.array(Z.string()),summary:Z.string().optional(),isReady:Z.boolean(),blockedBy:Z.array(Z.string())}),Pw=Z.discriminatedUnion("action",[Z.object({action:Z.literal("create"),taskId:Z.string(),status:Kf,ignoredFields:Z.array(Z.string()).optional(),note:Z.string().optional()}),Z.object({action:Z.literal("list"),tasks:Z.array(y4)}),Z.object({action:Z.literal("claim"),taskId:Z.string(),status:Kf,nextStep:Z.string()}),Z.object({action:Z.literal("complete"),taskId:Z.string(),status:Kf}),Z.object({action:Z.literal("block"),taskId:Z.string(),status:Kf})]),Ow=Z.object({agentId:Z.string(),mode:Z.enum(["sync","async"]),status:Z.enum(["dispatched","running","queued","joined"]),dispatched:Z.boolean(),message:Z.string(),deduped:Z.boolean().optional(),runId:Z.string().optional(),text:Z.string().optional(),iterations:Z.number().optional()}),T4=Z.object({textPreview:Z.string(),iterations:Z.number(),finishReason:Z.string(),durationMs:Z.number(),usage:Z.object({inputTokens:Z.number(),outputTokens:Z.number(),cacheReadTokens:Z.number().optional(),cacheWriteTokens:Z.number().optional(),totalCost:Z.number().optional()})}),Bw=Z.object({id:Z.string(),agentId:Z.string(),taskId:Z.string().optional(),status:W6,messagePreview:Z.string(),priority:Z.number(),retryCount:Z.number(),maxRetries:Z.number(),nextAttemptAt:S.optional(),continueConversation:Z.boolean().optional(),startedAt:S,endedAt:S.optional(),leaseOwner:Z.string().optional(),heartbeatAt:S.optional(),lastProgressAt:S.optional(),lastProgressMessage:Z.string().optional(),currentActivity:Z.string().optional(),error:Z.string().optional(),resultSummary:T4.optional()}),Aw=Z.object({id:Z.string(),teamId:Z.string(),fromAgentId:Z.string(),toAgentId:Z.string(),subject:Z.string(),body:Z.string(),taskId:Z.string().optional(),sentAt:S,readAt:S.optional()}),Nw=Z.object({id:Z.string(),teamId:Z.string(),title:Z.string(),status:Nf,requiredSections:Z.array(Z.string()),createdBy:Z.string(),createdAt:S,finalizedAt:S.optional()}),Cw=Z.object({outcomeId:Z.string(),status:Nf,requiredSections:Z.array(Z.string())}),bw=Z.object({agentId:Z.string(),status:Z.string()}),Mw=Z.object({runId:Z.string(),status:W6}),yw=Z.object({id:Z.string(),toAgentId:Z.string()}),Tw=Z.object({delivered:Z.number()}),Ew=Z.object({id:Z.string()}),Sw=Z.object({status:Z.string()}),gw=Z.object({fragmentId:Z.string(),status:Z.string()}),vw=Z.object({outcomeId:Z.string(),status:Nf});var E4;((B)=>{B.TaskStart="task_start";B.TaskEnd="task_end";B.AgentEvent="agent_event";B.TeammateSpawned="teammate_spawned";B.TeammateShutdown="teammate_shutdown";B.TeamTaskUpdated="team_task_updated";B.TeamMessage="team_message";B.TeamMissionLog="team_mission_log";B.TeamTaskCompleted="team_task_completed";B.RunStarted="run_started";B.RunQueued="run_queued";B.RunProgress="run_progress";B.RunCompleted="run_completed";B.RunFailed="run_failed";B.RunCancelled="run_cancelled";B.RunInterrupted="run_interrupted";B.OutcomeCreated="outcome_created";B.OutcomeFragmentAttached="outcome_fragment_attached";B.OutcomeFragmentReviewed="outcome_fragment_reviewed";B.OutcomeFinalized="outcome_finalized"})(E4||={});import{z as S4}from"zod";function g4(f){let{$schema:$,...w}=f;if(typeof w.type==="string")return w;if("properties"in w||"required"in w||"additionalProperties"in w)return{type:"object",...w};for(let Y of["oneOf","anyOf","allOf"]){let J=w[Y];if(!Array.isArray(J)||J.length===0)continue;if(Y==="allOf"){if(J.some((H)=>H&&typeof H==="object"&&H.type==="object"))return{type:"object",...w};throw Error('Tool inputSchema must describe an object at the top level, but the schema has a top-level "allOf" with no branch that asserts type: "object". Add type: "object" to at least one allOf branch to make the object constraint explicit.')}if(J.every((G)=>G&&typeof G==="object"&&G.type==="object"))return{type:"object",...w};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${Y}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return w}function v4(f){let $=g4(f.inputSchema instanceof S4.ZodType?Q0(f.inputSchema):f.inputSchema);return{name:f.name,description:f.description,inputSchema:$,lifecycle:f.lifecycle,executionMode:f.executionMode,timeoutMs:f.timeoutMs??30000,retryable:f.retryable??!0,maxRetries:f.maxRetries??3,execute:f.execute}}var _6=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function n4(f){let $=(f instanceof Error?f.message:String(f)).toLowerCase();return _6.some((w)=>$.includes(w))}export{Q0 as zodToJsonSchema,Z1 as xmlTagsRemoval,B2 as validateWithZod,k1 as validateImageMedia,Xf as validateAndReserveImageMedia,N$ as validateAndReserveBase64Media,M6 as usesImageGenerationOperation,s8 as upsertWorkspaceInfo,E1 as truncateStr,L2 as truncateSplit,D2 as trimNonEmpty,_1 as toAiSdkToolResultOutput,v0 as supportsChatModalities,I2 as stripUtf8Bom,f1 as stripModeNotices,z6 as shouldIncludeConnectorField,x2 as setClineClientIdentity,z$ as serializeAbortReason,y as sanitizeSurrogates,F2 as sanitizeFileName,w2 as safeJsonStringify,Y2 as safeJsonParse,V4 as resolveRootSessionId,D1 as resolveReasoningEffortRatio,x$ as resolveReasoningBudgetFromRatio,uf as resolveMediaBudget,i3 as resolveMcpTimeoutSeconds,L3 as resolveHubCommandTimeoutMs,R4 as resolveHookSessionContext,h$ as resolveEffectiveReasoningEffort,X6 as resolveClineEnvironment,$4 as resetSdkErrorRateLimiterForTests,qf as reserveImageMediaBytes,F3 as readHubScheduleMode,t0 as parseUserCommandEnvelope,U4 as parseRuntimeConfigExtensions,$2 as parseJsonStream,q$ as parseHookEventPayload,X2 as omitUndefinedValues,e0 as normalizeUserInput,L0 as normalizeSdkError,r0 as normalizePluginManifest,G0 as normalizeJsonLikeStringsForSchema,o$ as noopBasicLogger,y6 as modelSupportsToolCalling,T6 as modelSupportsImageInput,b6 as modelProducesImages,Sf as modelHasCapability,v$ as mergeModelOptions,U2 as maskSecret,o0 as listConnectorCatalog,N6 as isTranscriptionModel,V6 as isRuntimeConfigExtensionKind,l$ as isMcpTimeoutConfigured,n4 as isLikelyAuthError,U3 as isHubToolExecutorName,X$ as isHubScheduleMode,R3 as isHubProtocolCompatible,I$ as isGeneratedMedia,k0 as isClineProvider,N4 as isChatWorkspacePath,C6 as isChatCompatibleModel,A$ as isCanonicalBase64,H1 as isBase64Char,B$ as imageFileMaxDecodedBytesForBase64Limit,cf as imageBase64LengthForDecodedBytes,O$ as imageBase64EncodedByteLength,zf as imageBase64DecodedByteLength,I4 as hasRuntimeConfigExtension,H0 as getShellKind,T1 as getShellInvocation,_2 as getShellArgs,p$ as getErrorMessage,d$ as getErrorCode,G2 as getDefaultShell,H$ as getDefaultHubCommandTimeoutMs,p2 as getClineEnvironmentConfig,z2 as getClineClientIdentity,P$ as generatedMediaModalityFromMediaType,j$ as formatUserInputBlock,R$ as formatUserCommandBlock,O2 as formatUptime,L$ as formatSessionSearchTitle,U$ as formatSessionSearchPreview,V$ as formatModeSwitchNotice,g$ as formatMessagesForAiSdk,a3 as formatMcpTimeoutErrorMessage,P2 as formatHumanReadableDate,nf as formatFileContentBlock,hf as formatDisplayUserInput,L1 as estimateTokens,u$ as estimateRequestInputTokens,r8 as emptyWorkspaceManifest,b3 as describeOutdatedHubSessions,q2 as decodeJwtPayload,v4 as createTool,F4 as createSessionId,W$ as createModeSwitchNoticeTracker,If as createMediaBudgetState,s6 as createContributionRegistry,Q6 as createClineTelemetryServiceMetadata,j4 as createClineTelemetryServiceConfig,c6 as connectorChannelsFromPlatforms,m$ as clampMcpTimeoutSeconds,J4 as captureTaskLifecycleEvent,K4 as captureSdkError,Z4 as captureAgentUnexpectedReasoningTokens,G6 as buildSdkErrorProperties,A2 as buildClineSystemPrompt,O4 as WorkspaceManifestSchema,P4 as WorkspaceInfoSchema,i1 as VertexSettingsSchema,s1 as VertexModelSchema,E6 as USER_REJECTED_TOOL_REASON,n3 as USAGE_COST_DISPLAYS,gf as ToolCallRecordSchema,E0 as ThinkingConfigSchema,ww as TeamTeammateSpecSchema,Pw as TeamTaskToolResultSchema,y4 as TeamTaskListItemToolResultSchema,qw as TeamTaskInputSchema,Iw as TeamStatusToolResultSchema,Jw as TeamStatusInputSchema,Yw as TeamSpawnTeammateInputSchema,bw as TeamSimpleAgentStatusToolResultSchema,Zw as TeamShutdownTeammateInputSchema,yw as TeamSendMessageToolResultSchema,kw as TeamSendMessageInputSchema,Bw as TeamRunToolSummarySchema,Ow as TeamRunTaskToolResultSchema,Xw as TeamRunTaskInputSchema,T4 as TeamRunResultSummarySchema,Dw as TeamReviewOutcomeFragmentInputSchema,Rw as TeamReadMailboxInputSchema,Nw as TeamOutcomeToolResultSchema,gw as TeamOutcomeFragmentToolResultSchema,Ew as TeamMissionLogToolResultSchema,Vw as TeamMissionLogInputSchema,E4 as TeamMessageType,Aw as TeamMailboxMessageToolResultSchema,Gw as TeamListRunsInputSchema,Uw as TeamListOutcomesInputSchema,vw as TeamFinalizeOutcomeToolResultSchema,Lw as TeamFinalizeOutcomeInputSchema,Cw as TeamCreateOutcomeToolResultSchema,_w as TeamCreateOutcomeInputSchema,Sw as TeamCleanupToolResultSchema,Ww as TeamCleanupInputSchema,Mw as TeamCancelRunToolResultSchema,Hw as TeamCancelRunInputSchema,Tw as TeamBroadcastToolResultSchema,jw as TeamBroadcastInputSchema,Qw as TeamAwaitRunsInputSchema,Fw as TeamAttachOutcomeFragmentInputSchema,S6 as TOOL_REJECTION_SUFFIX,Kw as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,$w as TEAM_RUN_TEXT_PREVIEW_LIMIT,fw as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,n2 as TEAM_PROGRESS_EVENT_TYPE,h2 as TEAM_LIFECYCLE_EVENT_TYPE,e8 as TEAM_AWAIT_TIMEOUT_MS,s2 as TASK_PROVIDER_STREAM_STARTED_EVENT,a2 as TASK_PROVIDER_STREAM_FAILED_EVENT,r2 as TASK_PROVIDER_REQUEST_STARTED_EVENT,e2 as TASK_MAX_TOKENS_RECOVERY_EVENT,i2 as TASK_FIRST_CHUNK_RECEIVED_EVENT,t2 as TASK_CANCELLED_EVENT,Uf as SUPPORTED_IMAGE_MEDIA_TYPES,D4 as SESSION_STATUS_VALUES,$1 as SESSION_SEARCH_TITLE_MAX_LENGTH,w1 as SESSION_SEARCH_PREVIEW_MAX_LENGTH,f4 as SDK_ERROR_TELEMETRY_EVENT,Af as S3AccessKeySettingsSchema,w6 as RemoteMCPServerSchema,M2 as RemoteConfigSchema,yf as ReasoningLevelSchema,_f as ReasoningEffortSchema,U0 as RUNTIME_CONFIG_EXTENSION_KINDS,C2 as REMOTE_URI_SCHEME,Wf as REASONING_LEVELS,Qf as REASONING_EFFORT_RATIOS,g2 as ProviderProtocolSchema,v2 as ProviderClientSchema,S2 as ProviderCapabilitySchema,Y6 as PromptUploadingSchema,i6 as PLUGIN_FILE_EXTENSIONS,c1 as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,z1 as PLAN_MODE_INSTRUCTIONS,o1 as OpenAiCompatibleSchema,u1 as OpenAiCompatibleModelSchema,_3 as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,W3 as ONE_TIME_SCHEDULE_CRON_PATTERN,y0 as ModelStatusSchema,Tf as ModelReasoningOptionSchema,T0 as ModelPricingSchema,n0 as ModelOperationSchema,h0 as ModelOperationModeSchema,Ef as ModelModalitySchema,g0 as ModelModalitiesSchema,S0 as ModelMetadataSchema,Ff as ModelInfoSchema,M0 as ModelCapabilitySchema,h1 as MODE_TAG_INSTRUCTIONS,z3 as MODEL_TOOL_NAMES,r3 as MIN_MCP_TIMEOUT_SECONDS,Q3 as MIN_CLIENT_HUB_PROTOCOL_VERSION,s3 as MAX_MCP_TIMEOUT_SECONDS,k3 as MAX_CLIENT_HUB_PROTOCOL_VERSION,t1 as LiteLLMSchema,a1 as LiteLLMModelSchema,e as IMAGE_UNSUPPORTED_PLACEHOLDER,t as IMAGE_OMITTED_PLACEHOLDER,i0 as HookEventPayloadSchema,s0 as HookEventNameSchema,C3 as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,Q$ as HUB_TOOL_EXECUTOR_NAMES,I3 as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,a0 as HUB_SCHEDULE_MODES,N3 as HUB_MISTAKE_LIMIT_CAPABILITY,O3 as HUB_HOOK_CAPABILITY_PREFIX,G$ as HUB_DEFAULT_COMMAND_TIMEOUT_MS,P3 as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,B3 as HUB_COMPACTION_CAPABILITY,D3 as HUB_COMMAND_SLOW_LOG_MS,V3 as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,A3 as HUB_CHECKPOINT_CAPABILITY,j3 as HUB_CAPABILITIES,V0 as GlobalInstructionsFileSchema,K1 as GeneratedMediaSourceSchema,X1 as GeneratedMediaSchema,J1 as GeneratedMediaModalitySchema,a6 as FeatureFlagDefaultValue,a as FeatureFlag,t6 as FEATURE_FLAGS,Z6 as EnterpriseTelemetrySchema,Gf as EMPTY_CONTENT_TEXT,R6 as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,n$ as DEFAULT_REASONING_EFFORT,C4 as DEFAULT_OUTCOME_REQUIRED_SECTIONS,d3 as DEFAULT_MCP_TIMEOUT_SECONDS,G1 as DEFAULT_MAX_TOTAL_MEDIA_BYTES,v as DEFAULT_MAX_IMAGE_ENCODED_BYTES,x as DEFAULT_MAX_IMAGE_DECODED_BYTES,xf as DEFAULT_MAX_IMAGE_BASE64_BYTES,o2 as DEFAULT_CLINE_ENVIRONMENT,vf as ContributionRegistry,x6 as ConnectorHookEventSchema,x0 as ConnectorHookEventNameSchema,c0 as ConnectorEventContextSchema,z0 as ConnectorEventActorSchema,n6 as ConnectorAuthorizationRequestSchema,h6 as ConnectorAuthorizationDecisionSchema,r1 as ClineSettingsSchema,d1 as ClineModelSchema,H3 as CURRENT_HUB_PROTOCOL_VERSION,l0 as CONNECTOR_PLATFORMS,u0 as CONNECTOR_CATALOG,c3 as CONFIGURABLE_MODEL_TOOL_NAMES,B4 as CLINE_WORKSPACES_DIRECTORY_NAME,u2 as CLINE_ENVIRONMENT_OVERRIDE_ENV,c2 as CLINE_ENVIRONMENT_ENV,_0 as CLINE_ENVIRONMENTS,T2 as CLINE_DEFAULT_RPC_PORT,E2 as CLINE_DEFAULT_RPC_ADDRESS,N2 as CLINE_DEFAULT_MODEL_ID,A4 as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,c$ as CHARS_PER_TOKEN,p1 as AwsBedrockSettingsSchema,l1 as AwsBedrockModelSchema,m1 as AwsBedrockCustomModelSchema,b0 as ApiFormatSchema,A6 as ApiFormat,f6 as AnthropicSchema,e1 as AnthropicModelSchema,$6 as AllowedMCPServerSchema,v6 as AgentUsageSchema,i4 as AgentResultSchema,g6 as AgentFinishReasonSchema,a4 as AgentConfigSchema,_6 as AUTH_ERROR_PATTERNS,y2 as APIKeySchema,d2 as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT};
110
+ `);return S.replace("{{PLATFORM_NAME}}",o).replace("{{CWD}}",b).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",x?Hn(b,i,l):"").replace("{{CLINE_RULES}}",v).trim()}var Mi="anthropic/claude-sonnet-5";var _i="remote://";import{z as a}from"zod";var jn=a.object({id:a.string(),temperature:a.number().optional(),maxTokens:a.number().optional(),contextWindow:a.number().optional(),inputPrice:a.number().optional(),outputPrice:a.number().optional(),supportsImages:a.boolean().optional()}),qn=a.object({models:a.array(jn).optional(),openAiBaseUrl:a.string().optional(),openAiHeaders:a.record(a.string(),a.string()).optional(),azureApiVersion:a.string().optional(),azureIdentity:a.boolean().optional()}),zn=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional()}),Wn=a.object({name:a.string(),baseModelId:a.string(),thinkingBudgetTokens:a.number().optional()}),Kn=a.object({models:a.array(zn).optional(),customModels:a.array(Wn).optional(),awsRegion:a.string().optional(),awsUseCrossRegionInference:a.boolean().optional(),awsUseGlobalInference:a.boolean().optional(),awsBedrockUsePromptCache:a.boolean().optional(),awsBedrockEndpoint:a.string().optional()}),$n=a.object({id:a.string()}),Jn=a.object({models:a.array($n).optional()}),Yn=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional()}),Xn=a.object({models:a.array(Yn).optional(),vertexProjectId:a.string().optional(),vertexRegion:a.string().optional()}),Qn=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional(),promptCachingEnabled:a.boolean().optional()}),Zn=a.object({models:a.array(Qn).optional(),baseUrl:a.string().optional()}),eo=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional()}),to=a.object({models:a.array(eo).optional(),baseUrl:a.string().optional()}),Pi=a.object({OpenAiCompatible:qn.optional(),AwsBedrock:Kn.optional(),Cline:Jn.optional(),Vertex:Xn.optional(),LiteLLM:Zn.optional(),Anthropic:to.optional()}),no=a.object({id:a.string()}),oo=a.object({name:a.string(),url:a.string(),alwaysEnabled:a.boolean().optional(),headers:a.record(a.string(),a.string()).optional()}),ft=a.object({alwaysEnabled:a.boolean(),name:a.string(),contents:a.string()}),Ie=a.object({bucket:a.string(),accessKeyId:a.string(),secretAccessKey:a.string(),region:a.string().optional(),endpoint:a.string().optional(),accountId:a.string().optional()}),ro=a.object({enabled:a.boolean().optional(),type:a.union([a.literal("s3_access_keys"),a.literal("r2_access_keys"),a.literal("azure_access_keys")]).optional(),s3AccessSettings:Ie.optional(),r2AccessSettings:Ie.optional(),azureAccessSettings:Ie.optional()}),io=a.object({promptUploading:ro.optional()}),wi=a.object({version:a.string(),providerSettings:Pi.optional(),telemetryEnabled:a.boolean().optional(),kanbanEnabled:a.boolean().optional(),mcpMarketplaceEnabled:a.boolean().optional(),allowedMCPServers:a.array(no).optional(),remoteMCPServers:a.array(oo).optional(),blockPersonalRemoteMCPServers:a.boolean().optional(),yoloModeAllowed:a.boolean().optional(),openTelemetryEnabled:a.boolean().optional(),openTelemetryMetricsExporter:a.string().optional(),openTelemetryLogsExporter:a.string().optional(),openTelemetryOtlpProtocol:a.string().optional(),openTelemetryOtlpEndpoint:a.string().optional(),openTelemetryOtlpHeaders:a.record(a.string(),a.string()).optional(),openTelemetryOtlpMetricsProtocol:a.string().optional(),openTelemetryOtlpMetricsEndpoint:a.string().optional(),openTelemetryOtlpMetricsHeaders:a.record(a.string(),a.string()).optional(),openTelemetryOtlpLogsProtocol:a.string().optional(),openTelemetryOtlpLogsEndpoint:a.string().optional(),openTelemetryOtlpLogsHeaders:a.record(a.string(),a.string()).optional(),openTelemetryMetricExportInterval:a.number().optional(),openTelemetryOtlpInsecure:a.boolean().optional(),openTelemetryLogBatchSize:a.number().optional(),openTelemetryLogBatchTimeout:a.number().optional(),openTelemetryLogMaxQueueSize:a.number().optional(),enterpriseTelemetry:io.optional(),globalRules:a.array(ft).optional(),globalWorkflows:a.array(ft).optional()}),Oi=a.record(a.string(),a.string());var Ni=4317;var Li="127.0.0.1:4317";import yt from"zod";var Di=yt.enum(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),Bi=yt.enum(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),Hi=yt.enum(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var Ui="runtime.team.progress.v1",Fi="runtime.team.lifecycle.v1";function so(){return globalThis}function Gi(e){so().__clineClientIdentity=e}function Vi(){return so().__clineClientIdentity}var ji="CLINE_ENVIRONMENT",qi="CLINE_ENVIRONMENT_OVERRIDE",ht={production:{environment:"production",appBaseUrl:"https://app.cline.bot",apiBaseUrl:"https://api.cline.bot",mcpBaseUrl:"https://api.cline.bot/v1/mcp",workOsClientId:"client_01K3A541FN8TA3EPPHTD2325AR"},staging:{environment:"staging",appBaseUrl:"https://staging-app.cline.bot",apiBaseUrl:"https://core-api.staging.int.cline.bot",mcpBaseUrl:"https://core-api.staging.int.cline.bot/v1/mcp",workOsClientId:"client_01K3A5415VF6QBQBG3XYCW91G6"},local:{environment:"local",appBaseUrl:"http://localhost:3000",apiBaseUrl:"http://localhost:7777",mcpBaseUrl:"http://localhost:7777/v1/mcp",workOsClientId:"client_01K6XQAY7JK6T5HXVSZW2S5VYK"}},zi="production";function ao(e){let t=e?.trim().toLowerCase();if(t==="production"||t==="staging"||t==="local")return t;return}function lo(){if(typeof process>"u"||!process?.env)return{};return process.env}function co(){let e=lo();return ao(e.CLINE_ENVIRONMENT_OVERRIDE)??ao(e.CLINE_ENVIRONMENT)??"production"}function Wi(e){if(typeof e==="string")return ht[e];return ht[co()]}function Ki(e,t){if(t.CLINE_API_BASE_URL)e={...e,apiBaseUrl:t.CLINE_API_BASE_URL,mcpBaseUrl:`${t.CLINE_API_BASE_URL}/v1/mcp`};return e}function $i(e){let t=Wi(e);return Ki(t,lo())}var Ji="agent.reasoning.unexpected_tokens",Yi="task.provider_request_started",Xi="task.provider_stream_started",Qi="task.first_chunk_received",Zi="task.provider_stream_failed",es="task.cancelled",ts="task.max_tokens_recovery";var ns="sdk.error";var W=new Map;function os(){W.clear()}function rs(e,t){let n=typeof t.error_message==="string"?t.error_message:"";return[e,t.component,t.operation,t.error_type,t.error_code??"",t.error_status??"",n.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function is(e){let t=Date.now(),n=W.get(e);if(n&&t-n.startMs<3600000){if(n.emitted<5)return n.emitted+=1,{emit:!0,suppressed:0};return n.suppressed+=1,{emit:!1,suppressed:n.suppressed}}let o=n?.suppressed??0;if(W.delete(e),W.size>=512){let i=W.keys().next();if(!i.done)W.delete(i.value)}return W.set(e,{startMs:t,emitted:1,suppressed:0}),{emit:!0,suppressed:o}}function ss(e,t){e?.capture({event:"agent.reasoning.unexpected_tokens",properties:xt({sessionId:t.sessionId,agentId:t.agentId,runId:t.runId,iteration:t.iteration,providerId:t.providerId,modelId:t.modelId,requestedThinking:t.requestedThinking,reasoningTokenCount:t.reasoningTokenCount})})}function as(e,t){if(!e)return;e.capture({event:t.event,properties:xt({sessionId:t.sessionId,ulid:t.ulid??t.sessionId,agentId:t.agentId,conversationId:t.conversationId,runId:t.runId,iteration:t.iteration,provider:t.providerId,providerId:t.providerId,model:t.modelId,modelId:t.modelId,phase:t.phase,durationMs:t.durationMs,eventType:t.eventType,...t.error===void 0?{}:Tt(t.error,t.messageLimit),error_class:t.errorClass})})}function ls(e,t){if(!e)return!1;let n=t.event??"sdk.error",o=uo(t),i=0;try{let l=is(rs(n,o));if(!l.emit)return!0;i=l.suppressed}catch{}return e.capture({event:n,properties:i>0?{...o,suppressed_count:i}:o}),!0}function uo(e){return xt({...e.context??{},component:e.component,operation:e.operation,severity:e.severity??"error",handled:e.handled??!0,...Tt(e.error,e.messageLimit,e.errorMessage)})}function xt(e){let t={};for(let[n,o]of Object.entries(e))if(o!==void 0)t[n]=o;return t}function Tt(e,t=500,n){let o=us(e)?e:void 0,i=e instanceof Error?e:void 0,l=me(n)??me(i?.message)??me(o?.message)??ps(e)??"Unknown error",d=gs(o?.code),c=bt(o?.status)??bt(o?.statusCode)??bt(o?.responseStatus);return{error_type:i?.name?.trim()||me(o?.name)||i?.constructor?.name||"Error",error_message:cs(ds(l),t),...d!==void 0?{error_code:d}:{},...c!==void 0?{error_status:c}:{}}}function ds(e){return e.replace(/(authorization=Bearer\s+)[^&\s]+/gi,"$1[redacted]").replace(/(api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|password|secret)=([^&\s]+)/gi,"$1=[redacted]").replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,"$1[redacted]").replace(/\/Users\/[^/\s]+/g,"/Users/[redacted]").replace(/\/home\/[^/\s]+/g,"/home/[redacted]").replace(/([A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s]+/g,"$1[redacted]")}function cs(e,t){let n=Math.max(1,Math.floor(t));return e.length>n?e.substring(0,n):e}function us(e){return typeof e==="object"&&e!==null}function me(e){return typeof e==="string"&&e.trim().length>0?e:void 0}function ps(e){if(e instanceof Error)return;let t=typeof e==="string"?e:String(e);return t==="[object Object]"?void 0:me(t)}function gs(e){if(typeof e==="string"&&e.trim().length>0)return e;if(typeof e==="number"&&Number.isFinite(e))return e;return}function bt(e){return typeof e==="number"&&Number.isFinite(e)?e:void 0}function po(e){let t={};if(!e)return t;return e.split(",").forEach((n)=>{let o=n.indexOf("=");if(o<=0)return;try{let i=decodeURIComponent(n.substring(0,o).trim()),l=decodeURIComponent(n.substring(o+1).trim());if(!i||!l)return;t[i]=l}catch{}}),t}function ms(){if(!process.env)return{enabled:!1};return{enabled:process.env.OTEL_TELEMETRY_ENABLED==="1"||process.env.OTEL_TELEMETRY_ENABLED==="true",metricsExporter:process.env.OTEL_METRICS_EXPORTER||"otlp",logsExporter:process.env.OTEL_LOGS_EXPORTER||"otlp",tracesExporter:process.env.OTEL_TRACES_EXPORTER,otlpProtocol:process.env.OTEL_EXPORTER_OTLP_PROTOCOL||"http/json",otlpEndpoint:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,metricExportInterval:process.env.OTEL_METRIC_EXPORT_INTERVAL?Number.parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL,10):void 0,otlpHeaders:process.env.OTEL_EXPORTER_OTLP_HEADERS?po(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function go(e={}){return{extension_version:"unknown",cline_type:"unknown",platform:"terminal",platform_version:process?.version||"unknown",os_type:process?.platform||"unknown",os_version:process?.platform==="win32"?process?.env?.OS??"unknown":"unknown",...e}}function fs(e={}){return{...ms(),...e,metadata:go(e.metadata)}}function mo(e){let t=e?.trim();return t?t:void 0}function ys(e,t){if(!e)return;let n=typeof e==="function"?e(t):e;if(!n)return;let o=mo(n.rootSessionId);if(!o)return;return{rootSessionId:o}}function hs(e){return mo(e?.rootSessionId)}var bs=(e)=>crypto.getRandomValues(new Uint8Array(e)),xs=(e,t,n)=>{let o=256-256%e.length;if(o===256){let l=e.length-1;return(d=t)=>{if(!d)return"";let c="";while(!0){let m=n(d),f=d;while(f--)if(c+=e[m[f]&l],c.length>=d)return c}}}let i=Math.ceil(409.6*t/o);return(l=t)=>{if(!l)return"";let d="";while(!0){let c=n(i),m=i;while(m--)if(c[m]<o){if(d+=e[c[m]%e.length],d.length>=l)return d}}}},fo=(e,t=21)=>xs(e,t|0,bs);function Ts(e="",t=""){let n=fo("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${e}${Date.now()}_${n(5)}${t}`}var Ss=["idle","running","pending","completed","failed","cancelled"];var St=["rules","skills","workflows","plugins","hooks"],yo=St,As=new Set(St);function ho(e){return typeof e==="string"&&As.has(e)}function Es(e){if(!Array.isArray(e))return;let t=e.map((n)=>typeof n==="string"?n.trim():"").filter(ho);return[...new Set(t)]}function ks(e,t){return new Set(e??yo).has(t)}import{z as O}from"zod";var Cs=O.object({rootPath:O.string().min(1),hint:O.string().min(1).optional(),associatedRemoteUrls:O.array(O.string().min(1)).optional(),latestGitCommitHash:O.string().min(1).optional(),latestGitBranchName:O.string().min(1).optional()}),Rs=O.object({currentWorkspacePath:O.string().min(1).optional(),workspaces:O.record(O.string().min(1),Cs)});function Yl(){return{workspaces:{}}}function Xl(e,t){let n={...e,workspaces:{...e.workspaces,[t.rootPath]:t}};if(!n.currentWorkspacePath)n.currentWorkspacePath=t.rootPath;return Rs.parse(n)}var Is="workspaces",vs="chat";function Ms(e){let t=e.trim(),n=/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("\\\\"),o=t.startsWith("/");if(!n&&!o)return!1;let i=t.split(n?/[\\/]+/:/\/+/).filter(Boolean),l=i.at(-1)??"",d=i.at(-2)??"",c=i.at(-3)??"";return(i.at(-4)??"")===".cline"&&c==="data"&&d==="workspaces"&&l==="chat"}import{z as r}from"zod";var _s=["current_state","boundary_analysis","interface_proposal"],td=3600000,nd=240,od=400,N=r.preprocess((e)=>e instanceof Date?e.toISOString():e,r.string().datetime()),ae=r.enum(["pending","in_progress","blocked","completed"]),bo=r.enum(["queued","running","completed","failed","cancelled","interrupted"]),ve=r.enum(["draft","in_review","finalized"]),Ps=r.object({agentId:r.string(),role:r.enum(["lead","teammate"]),description:r.string().optional(),status:r.enum(["idle","running","stopped"])}),rd=r.object({agentId:r.string(),rolePrompt:r.string(),modelId:r.string().optional(),maxIterations:r.number().optional()});function k(e){return r.preprocess((t)=>t===null?void 0:t,e.optional())}var id=r.object({agentId:r.string().min(1).describe("Teammate identifier"),rolePrompt:r.string().min(1).describe("System prompt describing teammate role")}).strict(),sd=r.object({agentId:r.string().min(1).describe("Teammate identifier"),reason:k(r.string().min(1)).describe("Optional shutdown reason")}),ad=r.object({}),ws={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},ld={create:["status","taskId","summary","reason"]},dd=r.object({action:r.enum(["create","list","claim","complete","block"]),title:k(r.string().min(1)).describe("Task title"),description:k(r.string().min(1)).describe("Task details"),dependsOn:k(r.array(r.string().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:k(r.string().min(1)).describe("Optional assignee"),status:k(r.enum(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:k(r.string()).describe("Task ID"),summary:k(r.string().min(1)).describe("Completion summary"),reason:k(r.string().min(1)).describe("Blocking reason")}).superRefine((e,t)=>{for(let n of ws[e.action]){if(e[n]!==void 0)continue;t.addIssue({code:"custom",path:[n],message:`Field "${n}" is required when action=${e.action}`})}}),cd=r.object({agentId:r.string().describe("Teammate agent ID"),task:r.string().min(1).describe("Task instructions for the teammate"),taskId:k(r.string()).describe("Optional shared task list ID"),runMode:k(r.enum(["sync","async"])).describe("Execution mode: 'sync' blocks until the teammate finishes and returns the result (default if omitted); 'async' queues the run and returns a runId immediately — use team_await_runs to collect results later."),continueConversation:k(r.boolean()).describe("If true, continue the teammate conversation; otherwise start fresh")}),ud=r.object({status:k(r.enum(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:k(r.string().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:k(r.boolean()).describe("Include completed/failed runs (default true)")}),pd=r.object({runId:r.string().min(1).describe("Run ID"),reason:k(r.string().min(1)).describe("Optional cancellation reason")}),gd=r.object({runId:k(r.string().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),md=r.object({toAgentId:r.string().min(1).describe("Recipient agent ID"),subject:r.string().min(1).describe("Message subject"),body:r.string().min(1).describe("Message body"),taskId:k(r.string().min(1)).describe("Optional task ID context")}),fd=r.object({subject:r.string().min(1).describe("Message subject"),body:r.string().min(1).describe("Message body"),taskId:k(r.string().min(1)).describe("Optional task ID context")}),yd=r.object({unreadOnly:k(r.boolean()).describe("Only unread messages for read action (default true)")}),hd=r.object({kind:r.enum(["progress","handoff","blocked","decision","done","error"]),summary:r.string().min(1).describe("Update summary"),taskId:k(r.string().min(1)).describe("Optional task ID context"),evidence:k(r.array(r.string().min(1))).describe("Optional evidence links/snippets"),nextAction:k(r.string().min(1)).describe("Planned next step")}),bd=r.object({}),xd=r.object({title:r.string().describe("Outcome title"),requiredSections:r.array(r.string()).default(_s).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),Td=r.object({outcomeId:r.string().describe("Outcome ID"),section:r.string().describe("Section name"),sourceRunId:k(r.string()).describe("Optional source run ID"),content:r.string().describe("Section fragment content")}),Sd=r.object({fragmentId:r.string().describe("Fragment ID"),approved:r.boolean().describe("Review decision")}),Ad=r.object({outcomeId:r.string().describe("Outcome ID")}),Ed=r.object({}),kd=r.object({teamId:r.string(),teamName:r.string(),members:r.array(Ps),taskCounts:r.record(ae,r.number()),unreadMessages:r.number(),missionLogEntries:r.number(),activeRuns:r.number(),queuedRuns:r.number(),outcomeCounts:r.record(ve,r.number())}),Os=r.object({id:r.string(),title:r.string(),description:r.string(),status:ae,createdAt:N,updatedAt:N,createdBy:r.string(),assignee:r.string().optional(),dependsOn:r.array(r.string()),summary:r.string().optional(),isReady:r.boolean(),blockedBy:r.array(r.string())}),Cd=r.discriminatedUnion("action",[r.object({action:r.literal("create"),taskId:r.string(),status:ae,ignoredFields:r.array(r.string()).optional(),note:r.string().optional()}),r.object({action:r.literal("list"),tasks:r.array(Os)}),r.object({action:r.literal("claim"),taskId:r.string(),status:ae,nextStep:r.string()}),r.object({action:r.literal("complete"),taskId:r.string(),status:ae}),r.object({action:r.literal("block"),taskId:r.string(),status:ae})]),Rd=r.object({agentId:r.string(),mode:r.enum(["sync","async"]),status:r.enum(["dispatched","running","queued","joined"]),dispatched:r.boolean(),message:r.string(),deduped:r.boolean().optional(),runId:r.string().optional(),text:r.string().optional(),iterations:r.number().optional()}),Ns=r.object({textPreview:r.string(),iterations:r.number(),finishReason:r.string(),durationMs:r.number(),usage:r.object({inputTokens:r.number(),outputTokens:r.number(),cacheReadTokens:r.number().optional(),cacheWriteTokens:r.number().optional(),totalCost:r.number().optional()})}),Id=r.object({id:r.string(),agentId:r.string(),taskId:r.string().optional(),status:bo,messagePreview:r.string(),priority:r.number(),retryCount:r.number(),maxRetries:r.number(),nextAttemptAt:N.optional(),continueConversation:r.boolean().optional(),startedAt:N,endedAt:N.optional(),leaseOwner:r.string().optional(),heartbeatAt:N.optional(),lastProgressAt:N.optional(),lastProgressMessage:r.string().optional(),currentActivity:r.string().optional(),error:r.string().optional(),resultSummary:Ns.optional()}),vd=r.object({id:r.string(),teamId:r.string(),fromAgentId:r.string(),toAgentId:r.string(),subject:r.string(),body:r.string(),taskId:r.string().optional(),sentAt:N,readAt:N.optional()}),Md=r.object({id:r.string(),teamId:r.string(),title:r.string(),status:ve,requiredSections:r.array(r.string()),createdBy:r.string(),createdAt:N,finalizedAt:N.optional()}),_d=r.object({outcomeId:r.string(),status:ve,requiredSections:r.array(r.string())}),Pd=r.object({agentId:r.string(),status:r.string()}),wd=r.object({runId:r.string(),status:bo}),Od=r.object({id:r.string(),toAgentId:r.string()}),Nd=r.object({delivered:r.number()}),Ld=r.object({id:r.string()}),Dd=r.object({status:r.string()}),Bd=r.object({fragmentId:r.string(),status:r.string()}),Hd=r.object({outcomeId:r.string(),status:ve});var Ls;((C)=>{C.TaskStart="task_start";C.TaskEnd="task_end";C.AgentEvent="agent_event";C.TeammateSpawned="teammate_spawned";C.TeammateShutdown="teammate_shutdown";C.TeamTaskUpdated="team_task_updated";C.TeamMessage="team_message";C.TeamMissionLog="team_mission_log";C.TeamTaskCompleted="team_task_completed";C.RunStarted="run_started";C.RunQueued="run_queued";C.RunProgress="run_progress";C.RunCompleted="run_completed";C.RunFailed="run_failed";C.RunCancelled="run_cancelled";C.RunInterrupted="run_interrupted";C.OutcomeCreated="outcome_created";C.OutcomeFragmentAttached="outcome_fragment_attached";C.OutcomeFragmentReviewed="outcome_fragment_reviewed";C.OutcomeFinalized="outcome_finalized"})(Ls||={});import{z as Ds}from"zod";function Bs(e){let{$schema:t,...n}=e;if(typeof n.type==="string")return n;if("properties"in n||"required"in n||"additionalProperties"in n)return{type:"object",...n};for(let o of["oneOf","anyOf","allOf"]){let i=n[o];if(!Array.isArray(i)||i.length===0)continue;if(o==="allOf"){if(i.some((c)=>c&&typeof c==="object"&&c.type==="object"))return{type:"object",...n};throw Error('Tool inputSchema must describe an object at the top level, but the schema has a top-level "allOf" with no branch that asserts type: "object". Add type: "object" to at least one allOf branch to make the object constraint explicit.')}if(i.every((d)=>d&&typeof d==="object"&&d.type==="object"))return{type:"object",...n};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${o}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return n}function Hs(e){let t=Bs(e.inputSchema instanceof Ds.ZodType?ut(e.inputSchema):e.inputSchema);return{name:e.name,description:e.description,inputSchema:t,lifecycle:e.lifecycle,executionMode:e.executionMode,timeoutMs:e.timeoutMs??30000,retryable:e.retryable??!0,maxRetries:e.maxRetries??3,execute:e.execute}}var xo=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function Us(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return xo.some((n)=>t.includes(n))}export{Ji as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT,Oi as APIKeySchema,xo as AUTH_ERROR_PATTERNS,Zs as AgentConfigSchema,Bo as AgentFinishReasonSchema,Qs as AgentResultSchema,Ho as AgentUsageSchema,no as AllowedMCPServerSchema,eo as AnthropicModelSchema,to as AnthropicSchema,vo as ApiFormat,Mt as ApiFormatSchema,Wn as AwsBedrockCustomModelSchema,zn as AwsBedrockModelSchema,Kn as AwsBedrockSettingsSchema,jr as CHARS_PER_TOKEN,vs as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,Mi as CLINE_DEFAULT_MODEL_ID,Li as CLINE_DEFAULT_RPC_ADDRESS,Ni as CLINE_DEFAULT_RPC_PORT,ht as CLINE_ENVIRONMENTS,ji as CLINE_ENVIRONMENT_ENV,qi as CLINE_ENVIRONMENT_OVERRIDE_ENV,Is as CLINE_WORKSPACES_DIRECTORY_NAME,ja as CONFIGURABLE_MODEL_TOOL_NAMES,Vt as CONNECTOR_CATALOG,qt as CONNECTOR_PLATFORMS,pa as CURRENT_HUB_PROTOCOL_VERSION,$n as ClineModelSchema,Jn as ClineSettingsSchema,Fo as ConnectorAuthorizationDecisionSchema,Uo as ConnectorAuthorizationRequestSchema,Ft as ConnectorEventActorSchema,Gt as ConnectorEventContextSchema,Ut as ConnectorHookEventNameSchema,Go as ConnectorHookEventSchema,Be as ContributionRegistry,zi as DEFAULT_CLINE_ENVIRONMENT,Fe as DEFAULT_MAX_IMAGE_BASE64_BYTES,U as DEFAULT_MAX_IMAGE_DECODED_BYTES,D as DEFAULT_MAX_IMAGE_ENCODED_BYTES,cn as DEFAULT_MAX_TOTAL_MEDIA_BYTES,Ja as DEFAULT_MCP_TIMEOUT_SECONDS,_s as DEFAULT_OUTCOME_REQUIRED_SECTIONS,Ur as DEFAULT_REASONING_EFFORT,yo as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,ce as EMPTY_CONTENT_TEXT,io as EnterpriseTelemetrySchema,er as FEATURE_FLAGS,Q as FeatureFlag,Zo as FeatureFlagDefaultValue,sn as GeneratedMediaModalitySchema,dn as GeneratedMediaSchema,an as GeneratedMediaSourceSchema,ft as GlobalInstructionsFileSchema,fa as HUB_CAPABILITIES,va as HUB_CHECKPOINT_CAPABILITY,ha as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,Sa as HUB_COMMAND_SLOW_LOG_MS,Ia as HUB_COMPACTION_CAPABILITY,Ca as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,ur as HUB_DEFAULT_COMMAND_TIMEOUT_MS,Ra as HUB_HOOK_CAPABILITY_PREFIX,Ma as HUB_MISTAKE_LIMIT_CAPABILITY,Xt as HUB_SCHEDULE_MODES,ka as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,gr as HUB_TOOL_EXECUTOR_NAMES,_a as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,Jt as HookEventNameSchema,Yt as HookEventPayloadSchema,Z as IMAGE_OMITTED_PLACEHOLDER,ee as IMAGE_UNSUPPORTED_PLACEHOLDER,Qn as LiteLLMModelSchema,Zn as LiteLLMSchema,ma as MAX_CLIENT_HUB_PROTOCOL_VERSION,Xa as MAX_MCP_TIMEOUT_SECONDS,ga as MIN_CLIENT_HUB_PROTOCOL_VERSION,Ya as MIN_MCP_TIMEOUT_SECONDS,Va as MODEL_TOOL_NAMES,Un as MODE_TAG_INSTRUCTIONS,_t as ModelCapabilitySchema,xe as ModelInfoSchema,Nt as ModelMetadataSchema,Lt as ModelModalitiesSchema,Ne as ModelModalitySchema,Ht as ModelOperationModeSchema,Bt as ModelOperationSchema,wt as ModelPricingSchema,Oe as ModelReasoningOptionSchema,Pt as ModelStatusSchema,ba as ONE_TIME_SCHEDULE_CRON_PATTERN,xa as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,jn as OpenAiCompatibleModelSchema,qn as OpenAiCompatibleSchema,Gn as PLAN_MODE_INSTRUCTIONS,Vn as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,Qo as PLUGIN_FILE_EXTENSIONS,ro as PromptUploadingSchema,Di as ProviderCapabilitySchema,Hi as ProviderClientSchema,Bi as ProviderProtocolSchema,pe as REASONING_EFFORT_RATIOS,he as REASONING_LEVELS,_i as REMOTE_URI_SCHEME,St as RUNTIME_CONFIG_EXTENSION_KINDS,be as ReasoningEffortSchema,we as ReasoningLevelSchema,wi as RemoteConfigSchema,oo as RemoteMCPServerSchema,Ie as S3AccessKeySettingsSchema,ns as SDK_ERROR_TELEMETRY_EVENT,nn as SESSION_SEARCH_PREVIEW_MAX_LENGTH,tn as SESSION_SEARCH_TITLE_MAX_LENGTH,Ss as SESSION_STATUS_VALUES,Ae as SUPPORTED_IMAGE_MEDIA_TYPES,es as TASK_CANCELLED_EVENT,Qi as TASK_FIRST_CHUNK_RECEIVED_EVENT,ts as TASK_MAX_TOKENS_RECOVERY_EVENT,Yi as TASK_PROVIDER_REQUEST_STARTED_EVENT,Zi as TASK_PROVIDER_STREAM_FAILED_EVENT,Xi as TASK_PROVIDER_STREAM_STARTED_EVENT,td as TEAM_AWAIT_TIMEOUT_MS,Fi as TEAM_LIFECYCLE_EVENT_TYPE,Ui as TEAM_PROGRESS_EVENT_TYPE,nd as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,od as TEAM_RUN_TEXT_PREVIEW_LIMIT,ld as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,Do as TOOL_REJECTION_SUFFIX,Td as TeamAttachOutcomeFragmentInputSchema,gd as TeamAwaitRunsInputSchema,fd as TeamBroadcastInputSchema,Nd as TeamBroadcastToolResultSchema,pd as TeamCancelRunInputSchema,wd as TeamCancelRunToolResultSchema,bd as TeamCleanupInputSchema,Dd as TeamCleanupToolResultSchema,xd as TeamCreateOutcomeInputSchema,_d as TeamCreateOutcomeToolResultSchema,Ad as TeamFinalizeOutcomeInputSchema,Hd as TeamFinalizeOutcomeToolResultSchema,Ed as TeamListOutcomesInputSchema,ud as TeamListRunsInputSchema,vd as TeamMailboxMessageToolResultSchema,Ls as TeamMessageType,hd as TeamMissionLogInputSchema,Ld as TeamMissionLogToolResultSchema,Bd as TeamOutcomeFragmentToolResultSchema,Md as TeamOutcomeToolResultSchema,yd as TeamReadMailboxInputSchema,Sd as TeamReviewOutcomeFragmentInputSchema,Ns as TeamRunResultSummarySchema,cd as TeamRunTaskInputSchema,Rd as TeamRunTaskToolResultSchema,Id as TeamRunToolSummarySchema,md as TeamSendMessageInputSchema,Od as TeamSendMessageToolResultSchema,sd as TeamShutdownTeammateInputSchema,Pd as TeamSimpleAgentStatusToolResultSchema,id as TeamSpawnTeammateInputSchema,ad as TeamStatusInputSchema,kd as TeamStatusToolResultSchema,dd as TeamTaskInputSchema,Os as TeamTaskListItemToolResultSchema,Cd as TeamTaskToolResultSchema,rd as TeamTeammateSpecSchema,Ot as ThinkingConfigSchema,De as ToolCallRecordSchema,Ua as USAGE_COST_DISPLAYS,Lo as USER_REJECTED_TOOL_REASON,Yn as VertexModelSchema,Xn as VertexSettingsSchema,Cs as WorkspaceInfoSchema,Rs as WorkspaceManifestSchema,vi as buildClineSystemPrompt,uo as buildSdkErrorProperties,ss as captureAgentUnexpectedReasoningTokens,ls as captureSdkError,as as captureTaskLifecycleEvent,Kr as clampMcpTimeoutSeconds,jo as connectorChannelsFromPlatforms,fs as createClineTelemetryServiceConfig,go as createClineTelemetryServiceMetadata,Xo as createContributionRegistry,Ee as createMediaBudgetState,br as createModeSwitchNoticeTracker,Ts as createSessionId,Hs as createTool,di as decodeJwtPayload,Pa as describeOutdatedHubSessions,Yl as emptyWorkspaceManifest,qr as estimateRequestInputTokens,Sn as estimateTokens,Ue as formatDisplayUserInput,He as formatFileContentBlock,Ci as formatHumanReadableDate,Za as formatMcpTimeoutErrorMessage,Br as formatMessagesForAiSdk,hr as formatModeSwitchNotice,Er as formatSessionSearchPreview,Ar as formatSessionSearchTitle,Ri as formatUptime,yr as formatUserCommandBlock,fr as formatUserInputBlock,Cr as generatedMediaModalityFromMediaType,Vi as getClineClientIdentity,$i as getClineEnvironmentConfig,pr as getDefaultHubCommandTimeoutMs,ui as getDefaultShell,Jr as getErrorCode,$r as getErrorMessage,xi as getShellArgs,On as getShellInvocation,ct as getShellKind,ks as hasRuntimeConfigExtension,Ge as imageBase64DecodedByteLength,Rr as imageBase64EncodedByteLength,Ve as imageBase64LengthForDecodedBytes,Ir as imageFileMaxDecodedBytesForBase64Limit,un as isBase64Char,vr as isCanonicalBase64,_o as isChatCompatibleModel,Ms as isChatWorkspacePath,pt as isClineProvider,kr as isGeneratedMedia,ya as isHubProtocolCompatible,cr as isHubScheduleMode,Ea as isHubToolExecutorName,Us as isLikelyAuthError,Wr as isMcpTimeoutConfigured,ho as isRuntimeConfigExtensionKind,Mo as isTranscriptionModel,jt as listConnectorCatalog,Ei as maskSecret,Hr as mergeModelOptions,Le as modelHasCapability,Po as modelProducesImages,No as modelSupportsImageInput,Oo as modelSupportsToolCalling,zr as noopBasicLogger,dt as normalizeJsonLikeStringsForSchema,$t as normalizePluginManifest,Tt as normalizeSdkError,Zt as normalizeUserInput,ci as omitUndefinedValues,dr as parseHookEventPayload,oi as parseJsonStream,Es as parseRuntimeConfigExtensions,Qt as parseUserCommandEnvelope,Ta as readHubScheduleMode,le as reserveImageMediaBytes,os as resetSdkErrorRateLimiterForTests,co as resolveClineEnvironment,Fr as resolveEffectiveReasoningEffort,ys as resolveHookSessionContext,Aa as resolveHubCommandTimeoutMs,Qa as resolveMcpTimeoutSeconds,je as resolveMediaBudget,Gr as resolveReasoningBudgetFromRatio,Tn as resolveReasoningEffortRatio,hs as resolveRootSessionId,ii as safeJsonParse,ri as safeJsonStringify,Ti as sanitizeFileName,P as sanitizeSurrogates,Vr as serializeAbortReason,Gi as setClineClientIdentity,Vo as shouldIncludeConnectorField,en as stripModeNotices,ki as stripUtf8Bom,Dt as supportsChatModalities,bn as toAiSdkToolResultOutput,Si as trimNonEmpty,Ai as truncateSplit,Nn as truncateStr,Xl as upsertWorkspaceInfo,wo as usesImageGenerationOperation,Mr as validateAndReserveBase64Media,de as validateAndReserveImageMedia,gn as validateImageMedia,Ii as validateWithZod,rn as xmlTagsRemoval,ut as zodToJsonSchema};