@cline/shared 0.0.69 → 0.0.70

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,15 +1,15 @@
1
- import{z as E}from"zod";import{z as k}from"zod";import{z as K}from"zod";var An=["none","minimal","low","medium","high","xhigh","max"],Hn=K.enum(An),In=Hn.exclude(["none"]),z4=K.enum([...An,"default"]).nullable(),Ln=K.discriminatedUnion("type",[K.object({type:K.literal("toggle")}).strict(),K.object({type:K.literal("effort"),values:K.array(z4)}).strict(),K.object({type:K.literal("budget_tokens"),min:K.number().min(-1).optional(),max:K.number().min(0).optional()}).strict().refine((n)=>n.min===void 0||n.max===void 0||n.min<=n.max,{message:"Minimum reasoning budget cannot exceed maximum",path:["min"]})]);var If=k.enum(["default","openai-responses","r1"]),p4={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},$f=k.enum(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),Df=k.enum(["active","preview","deprecated","legacy"]),Yf=k.object({input:k.number().optional(),output:k.number().optional(),cacheWrite:k.number().optional(),cacheRead:k.number().optional()}),Mf=k.object({maxBudget:k.number().optional(),outputPrice:k.number().optional(),thinkingLevel:k.enum(["low","high"]).optional()}),Gf=k.object({reasoningDefaultOn:k.boolean().optional()}).catchall(k.unknown()),$n=k.object({id:k.string(),name:k.string().optional(),description:k.string().optional(),maxTokens:k.number().optional(),contextWindow:k.number().optional(),maxInputTokens:k.number().optional(),capabilities:k.array($f).optional(),reasoningOptions:k.array(Ln).optional(),apiFormat:If.optional(),systemRole:k.enum(["system","developer"]).optional(),temperature:k.number().optional(),pricing:Yf.optional(),thinkingConfig:Mf.optional(),status:Df.optional(),deprecationNotice:k.string().optional(),replacedBy:k.string().optional(),releaseDate:k.string().optional(),deprecationDate:k.string().optional(),family:k.string().optional(),metadata:Gf.optional()});import{z as O}from"zod";var Jn=O.object({id:O.string(),name:O.string(),input:O.unknown(),output:O.unknown(),error:O.string().optional(),durationMs:O.number(),startedAt:O.date(),endedAt:O.date()});var i4=E.enum(["completed","max_iterations","aborted","mistake_limit","error"]),a4=E.object({inputTokens:E.number(),outputTokens:E.number(),cacheReadTokens:E.number().optional(),cacheWriteTokens:E.number().optional(),totalCost:E.number().optional()}),a0=E.object({text:E.string(),usage:a4,messages:E.array(E.custom()),toolCalls:E.array(Jn),iterations:E.number(),finishReason:i4,model:E.object({id:E.string(),provider:E.string(),info:$n.optional()}),startedAt:E.date(),endedAt:E.date(),durationMs:E.number()}),e0=E.object({sessionId:E.string().optional(),providerId:E.string(),modelId:E.string(),apiKey:E.string().optional(),baseUrl:E.string().url().optional(),headers:E.record(E.string(),E.string()).optional(),knownModels:E.record(E.string(),$n).optional(),providerConfig:E.unknown().optional(),initialMessages:E.array(E.custom()).optional(),systemPrompt:E.string(),tools:E.array(E.custom()),maxIterations:E.number().positive().optional(),maxParallelToolCalls:E.number().int().positive().default(8),maxTokensPerTurn:E.number().positive().optional(),temperature:E.number().nonnegative().optional(),apiTimeoutMs:E.number().positive().default(180000),userFileContentLoader:E.function().input([E.string()]).output(E.promise(E.string())).optional(),toolContextMetadata:E.record(E.string(),E.unknown()).optional(),execution:E.object({maxConsecutiveMistakes:E.number().int().positive().optional(),reminderAfterIterations:E.number().nonnegative().optional(),reminderText:E.string().optional(),loopDetection:E.union([E.literal(!1),E.object({softThreshold:E.number().int().positive().optional(),hardThreshold:E.number().int().positive().optional()})]).optional()}).optional(),reasoningEffort:In.optional(),thinkingBudgetTokens:E.number().positive().optional(),thinking:E.boolean().optional(),onEvent:E.function().input([E.custom()]).output(E.void()).optional(),hooks:E.custom().optional(),parentAgentId:E.string().optional(),extensions:E.array(E.custom()).optional(),hookErrorMode:E.enum(["ignore","throw"]).default("ignore"),toolPolicies:E.record(E.string(),E.object({enabled:E.boolean().optional(),autoApprove:E.boolean().optional()})).optional(),requestToolApproval:E.function().input([E.object({sessionId:E.string(),agentId:E.string(),conversationId:E.string(),iteration:E.number(),toolCallId:E.string(),toolName:E.string(),input:E.unknown(),policy:E.object({enabled:E.boolean().optional(),autoApprove:E.boolean().optional()}).default({})})]).output(E.union([E.object({approved:E.boolean(),reason:E.string().optional()}),E.promise(E.object({approved:E.boolean(),reason:E.string().optional()}))])).optional(),onConsecutiveMistakeLimitReached:E.function().input([E.object({iteration:E.number().int().positive(),consecutiveMistakes:E.number().int().positive(),maxConsecutiveMistakes:E.number().int().positive(),reason:E.enum(["api_error","invalid_tool_call","tool_execution_failed"]),details:E.string().optional()})]).output(E.union([E.object({action:E.literal("continue"),guidance:E.string().optional()}),E.object({action:E.literal("stop"),reason:E.string().optional()}),E.promise(E.union([E.object({action:E.literal("continue"),guidance:E.string().optional()}),E.object({action:E.literal("stop"),reason:E.string().optional()})]))])).optional(),logger:E.custom().optional(),extensionContext:E.custom().optional(),abortSignal:E.custom().optional()});import{z as b}from"zod";var yf=b.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"]),Xf=b.object({id:b.string().optional(),label:b.string().optional(),role:b.string().optional(),participantKey:b.string().optional(),participantLabel:b.string().optional(),platformUserId:b.string().optional(),metadata:b.record(b.string(),b.unknown()).optional()}),bf=b.object({source:b.string(),sourceEvent:b.string(),threadId:b.string(),channelId:b.string(),isDM:b.boolean(),sessionId:b.string().optional(),workspaceRoot:b.string().optional(),metadata:b.record(b.string(),b.unknown()).optional()}),e4=b.object({actor:Xf,context:bf,payload:b.record(b.string(),b.unknown()).optional()}),t4=b.object({action:b.enum(["allow","deny"]).default("allow"),message:b.string().optional(),reason:b.string().optional(),metadata:b.record(b.string(),b.unknown()).optional()}),n6=b.object({adapter:b.string(),botUserName:b.string().optional(),event:yf,payload:b.record(b.string(),b.unknown()),ts:b.string()});var qf=[{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 kf(){return qf.map((n)=>({...n}))}function f6(n,f){let _=n.includeWhen;if(!_)return!0;let B=f[_.flag]??"";if(_.equals!==void 0&&B!==_.equals)return!1;if(_.notEquals!==void 0&&B===_.notEquals)return!1;return!0}function _6(n=Zf){let f=new Set(kf().map((_)=>_.name));return n.filter((_)=>f.has(_.id)).map((_)=>({id:_.id,name:_.name,type:_.type,hint:_.hint,fields:_.fields.map((B)=>({flag:B.flag,label:B.label,placeholder:B.placeholder,required:B.required,help:B.help,initialValue:B.initialValue,options:B.options,includeWhen:B.includeWhen})),security:_.security?{prompt:_.security.prompt,fields:_.security.fields.map((B)=>({key:B.key,label:B.label,placeholder:B.placeholder,help:B.help,requiredMessage:B.requiredMessage}))}:void 0}))}function w6(n){return/^\d+$/.test(n)?void 0:"Telegram user ID must contain digits only"}function B6(n){return/^T[A-Z0-9]+$/.test(n)?void 0:"Slack workspace ID must start with T and contain uppercase letters or digits only"}function d6(n){return/^[UW][A-Z0-9]+$/.test(n)?void 0:"Slack member ID must start with U or W and contain uppercase letters or digits only"}var Zf=[{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:w6}],argumentFlags:["--allowed-user-id","--hook-command"],buildArgs:({userId:n})=>["--allowed-user-id",n??""]}},{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:B6},{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:d6}],argumentFlags:["--hook-command"],buildArgs:({teamId:n,userId:f})=>["--hook-command",`jq -r ".payload.actor.participantKey" | grep -qx "slack:team:${n}:user:${f}" && 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 R6=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],E6=new Set(R6);function Jf(n,f){return n.name||`extension_${String(f).padStart(4,"0")}`}function Hf(n){return Array.isArray(n)&&n.every((f)=>typeof f==="string")}function Lf(n){if(!Array.isArray(n))return;let f=n.filter((_)=>typeof _==="string").map((_)=>_.trim()).filter((_)=>_.length>0);return f.length>0?f:void 0}function Tf(n){let f=Lf(n.providerIds),_=Lf(n.modelIds);return{...n,...f?{providerIds:f}:{},..._?{modelIds:_}:{}}}function A6(n,f){let _=Jf(n,f),B=n.manifest;if(!B||typeof B!=="object")throw Error(`Invalid manifest for extension "${_}": manifest is required`);if(!Array.isArray(B.capabilities)||B.capabilities.length===0)throw Error(`Invalid manifest for extension "${_}": capabilities must be a non-empty array`);let d=new Set;for(let $ of B.capabilities){if(!E6.has($))throw Error(`Invalid manifest for extension "${_}": unsupported capability "${String($)}"`);d.add($)}if(Object.hasOwn(B,"providerIds")&&!Hf(B.providerIds))throw Error(`Invalid manifest for extension "${_}": providerIds must be a string array when provided`);if(Object.hasOwn(B,"modelIds")&&!Hf(B.modelIds))throw Error(`Invalid manifest for extension "${_}": modelIds must be a string array when provided`);let I=d.has("hooks");if(n.hooks!==void 0&&!I)throw Error(`Invalid manifest for extension "${_}": runtime hooks require the "hooks" capability`);return{capabilities:d,raw:Tf(B)}}function I6(n,f){if(!n||typeof n!=="object")throw Error(`Invalid automation event contribution for extension "${f}": expected object`);let _=typeof n.eventType==="string"?n.eventType.trim():"",B=typeof n.source==="string"?n.source.trim():"";if(!_)throw Error(`Invalid automation event contribution for extension "${f}": eventType is required`);if(!B)throw Error(`Invalid automation event contribution for extension "${f}": source is required`);return{...n,eventType:_,source:B,examples:n.examples?[...n.examples]:void 0,metadata:n.metadata?{...n.metadata}:void 0}}class Tn{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]};normalized=[];phase="resolve";setupContext;constructor(n={}){this.extensions=n.extensions??[],this.setupContext=n.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((n,f)=>({extension:n,order:f,manifest:{capabilities:new Set,raw:n.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((n)=>({...n,manifest:A6(n.extension,n.order)})),this.phase="setup"}async setup(n={}){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;let f,_=[];for(let B of this.normalized){let{extension:d}=B;if(d.disabled)continue;let I=Jf(d,B.order),A={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},$={registerTool:(Y)=>A.tools.push(Y),registerCommand:(Y)=>A.commands.push(Y),registerRule:(Y)=>{if(!B.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${I}": registerRule requires the "rules" capability`);A.rules.push(Y)},registerMessageBuilder:(Y)=>A.messageBuilder.push(Y),registerProvider:(Y)=>A.providers.push(Y),registerAutomationEventType:(Y)=>{if(!B.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${I}": registerAutomationEventType requires the "automationEvents" capability`);A.automationEventTypes.push(I6(Y,I))},registerMcpServer:(Y)=>{if(!B.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${I}": registerMcpServer requires the "mcp" capability`);A.mcpServers.push({...Y,metadata:{...Y.metadata??{},source:"plugin",plugin:I}})}},y=B.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await d.setup?.($,y),_.push(A)}catch(Y){if(n.tolerateSetupErrors!==!0)throw Y;f??=Y}}if(f&&n.tolerateSetupErrors!==!0)throw f;for(let B of _)this.registry.tools.push(...B.tools),this.registry.commands.push(...B.commands),this.registry.rules.push(...B.rules),this.registry.messageBuilder.push(...B.messageBuilder),this.registry.providers.push(...B.providers),this.registry.automationEventTypes.push(...B.automationEventTypes),this.registry.mcpServers.push(...B.mcpServers);if(this.phase="activate",f)throw f}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(n={}){this.resolve(),this.validate();try{await this.setup(n)}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((n,f)=>n.order-f.order).map(({extension:n})=>n)}}function $6(n={}){return new Tn(n)}var D6=[".js",".ts"];var Vf={CLINE_PASS:"ext-cline-pass"},Y6={[Vf.CLINE_PASS]:!1},M6=Object.values(Vf);import{z as D}from"zod";var of=D.enum(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),v=D.record(D.string(),D.string()),G6=D.object({toolName:D.string(),parameters:v}),y6=D.object({toolName:D.string(),parameters:v,result:D.string(),success:D.boolean(),executionTimeMs:D.number()}),X6=D.object({prompt:D.string(),attachments:D.array(D.string())}),b6=D.object({taskMetadata:v}),q6=D.object({taskMetadata:v,previousState:v}),k6=D.object({taskMetadata:v}),Z6=D.object({taskMetadata:v}),H6=D.object({taskId:D.string(),ulid:D.string(),contextSize:D.number(),compactionStrategy:D.string(),previousApiReqIndex:D.number(),tokensIn:D.number(),tokensOut:D.number(),tokensInCache:D.number(),tokensOutCache:D.number(),deletedRangeStart:D.number(),deletedRangeEnd:D.number(),contextJsonPath:D.string(),contextRawPath:D.string()}),Kf=D.object({clineVersion:D.string(),hookName:of,timestamp:D.string(),taskId:D.string(),sessionContext:D.object({rootSessionId:D.string().optional(),hookLogPath:D.string().optional()}).optional(),workspaceRoots:D.array(D.string()),workspaceInfo:D.custom().optional(),userId:D.string(),agent_id:D.string(),parent_agent_id:D.string().nullable(),iteration:D.number().optional(),reason:D.string().optional(),tool_call:D.object({id:D.string(),name:D.string(),input:D.unknown()}).optional(),tool_result:D.custom().optional(),turn:D.unknown().optional(),error:D.object({name:D.string(),message:D.string(),stack:D.string().optional()}).optional(),preToolUse:G6.optional(),postToolUse:y6.optional(),userPromptSubmit:X6.optional(),taskStart:b6.optional(),taskResume:q6.optional(),taskCancel:k6.optional(),taskComplete:Z6.optional(),preCompact:H6.optional()}).passthrough();function L6(n){let f=Kf.safeParse(n);if(!f.success)return;return f.data}var D1="v1",Y1="v1",M1="v1",G1=["client.register","client.list","session.create","session.list","session.get","session.run","session.abort","schedule.create","schedule.list","settings.get","settings.set"];function Dn(n){let f=/^v(\d+)$/.exec(n?.trim()??"");if(!f)return;return Number.parseInt(f[1]??"",10)}function y1(n,f="v1"){let _=Dn(n.protocolVersion),B=Dn(f);if(_===void 0||B===void 0)return{compatible:!1,reason:"missing_protocol"};let d=Dn(n.minClientProtocolVersion)??_,I=Dn(n.maxClientProtocolVersion)??_;return B>=d&&B<=I?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var X1="0",b1="__hubScheduleRunAt",Uf=["act","plan","yolo"];function J6(n){return Uf.some((f)=>f===n)}function q1(n,f){if(!n||!Object.hasOwn(n,"mode"))return f;let _=n.mode;if(J6(_))return _;throw Error(`mode must be one of: ${Uf.join(", ")}`)}var T6=30000,k1=5000;function V6(n){switch(n){case"run.start":case"session.send_input":return null;default:return T6}}function Z1(n,f){return f===void 0?V6(n):f}var o6=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],K6=new Set(o6);function H1(n){return typeof n==="string"&&K6.has(n)}var L1="tool_executor.",J1="custom_tool.",T1="hook.",V1="compaction.compact",o1="checkpoint.create",K1="mistake_limit.decide",U1="user_instructions.snapshot";function Vn(n,f){return`<file_content path="${n}">
2
- ${f}
3
- </file_content>`}function U6(n,f="act"){return`<user_input mode="${f}">${n}</user_input>`}function F6(n,f){return`<user_command slash="${f}">${n}</user_command>`}function Q6(n,f){return`<mode_notice>The user switched from ${n} mode to ${f} mode before sending this message.</mode_notice>`}function j6(){let n=null;return{record(f,_){if(f===_)return;if(n){n=n.from===_?null:{from:n.from,to:_};return}n={from:f,to:_}},consume(){let f=n;return n=null,f}}}function P6(n,f){let _=n.trim(),B=new RegExp(`^<${f}\\b([^>]*)>([\\s\\S]*?)<\\/${f}>$`,"i").exec(_);if(!B)return;return{attrs:B[1]??"",content:B[2]??""}}function W6(n,f){return new RegExp(`${f}="([^"]+)"`,"i").exec(n)?.[1]?.trim()||void 0}function Ff(n){if(!n?.trim())return;let f=P6(n,"user_command");if(!f)return;let _=W6(f.attrs,"slash");if(!_)return;return{slash:_,content:f.content.trim()}}function Qf(n){if(!n?.trim())return"";let f=n.trim();for(let _ of["user_input","user_command"]){let B=Pf(f,_);f=(B!==f?B:f.replace(new RegExp(`<${_}[^>]*>`,"g"),"")).trim()}return f}function jf(n){if(!n?.trim())return"";return O6(n,"mode_notice").trim()}function O6(n,f){let _=`<${f}>`,B=`</${f}>`,d=n,I=d.indexOf(_);while(I!==-1){let A=d.indexOf(B,I+_.length);if(A===-1)break;d=d.slice(0,I)+d.slice(A+B.length),I=d.indexOf(_,I)}return d}function g6(n){let f=jf(Qf(n)),_=Ff(n);if(!_)return f;if(_.slash.toLowerCase()==="team"){let d=f.toLowerCase().startsWith("spawn a team of agents for the following task:")?f.slice(46).trim():f;return d?`/team ${d}`:"/team"}return f?`/${_.slash} ${f}`:`/${_.slash}`}function Pf(n,f){if(!n?.trim())return"";if(!f)return n;let _=new RegExp(`<${f}\\b[^>]*>([\\s\\S]*?)</${f}>`,"g");return n.replace(_,"$1")}var h="[media omitted: invalid or exceeds size limit]",Mn=["image/png","image/jpeg","image/gif","image/webp"],N6=5242880,S=5242880,u=6291456,C6=8388608;function S6(n){return n.length}function Wf(n){let f=n.endsWith("==")?2:n.endsWith("=")?1:0;return Math.floor(n.length*3/4)-f}function c6(n=5242880){return Math.floor(n*3/4)}function on(n){return Math.ceil(n/3)*4}function Of(n={}){return{maxImageEncodedBytes:n.maxImageEncodedBytes??5242880,maxImageDecodedBytes:n.maxImageDecodedBytes??6291456,maxTotalMediaBytes:n.maxTotalMediaBytes??8388608}}function Gn(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function Yn(n,f){n.omittedImages+=1,n.omittedReasons[f]=(n.omittedReasons[f]??0)+1}function nn(n,f,_,B){let d=Of(_);if(n>d.maxImageEncodedBytes){let I={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${d.maxImageEncodedBytes} byte encoded limit`};return Yn(B,I.reason),I}if(f>d.maxImageDecodedBytes){let I={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${d.maxImageDecodedBytes} byte decoded limit`};return Yn(B,I.reason),I}if(B.totalEncodedBytes+n>d.maxTotalMediaBytes){let I={ok:!1,reason:"total_limit",message:`Image media exceeds the ${d.maxTotalMediaBytes} byte total media limit`};return Yn(B,I.reason),I}return B.totalEncodedBytes+=n,B.keptImages+=1,null}function gf(n){return n>=65&&n<=90||n>=97&&n<=122||n>=48&&n<=57||n===43||n===47}function v6(n){return n.length>0&&Nf(n,0,n.length)}function Nf(n,f,_){let B=_-f;if(B%4!==0)return!1;let d=_;if(B>=2&&n.charCodeAt(_-2)===61&&n.charCodeAt(_-1)===61)d-=2;else if(B>=1&&n.charCodeAt(_-1)===61)d-=1;for(let I=f;I<d;I++)if(!gf(n.charCodeAt(I)))return!1;for(let I=d;I<_;I++)if(n.charCodeAt(I)!==61)return!1;return!0}function h6(n,f,_){return _-f>=5&&(n.charCodeAt(f)|32)===100&&(n.charCodeAt(f+1)|32)===97&&(n.charCodeAt(f+2)|32)===116&&(n.charCodeAt(f+3)|32)===97&&n.charCodeAt(f+4)===58}function u6(n){let f=0,_=n.length;while(f<_&&/\s/.test(n[f]??""))f+=1;while(_>f&&/\s/.test(n[_-1]??""))_-=1;return{start:f,end:_}}function m6(n,f,_){if(!h6(n,f,_))return;let B=f+5,d=n.indexOf(",",B);if(d===-1||d>=_)return;if(d-B>128)return;let I=n.slice(B,d).toLowerCase(),A=";base64";if(!I.endsWith(A))return;let $=I.slice(0,-A.length);if(!$||$.includes(";"))return;return{mediaType:$,base64Start:d+1,base64End:_}}function Cf(n,f,_={}){let B=_.maxEncodedBytes??5242880,d=_.maxDecodedBytes??6291456,I=new Set(_.supportedMediaTypes??Mn),A=n?.toLowerCase(),$=u6(f),y=$.start,Y=$.end,X=m6(f,$.start,$.end);if(X){if(A&&A!==X.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${n} does not match data URL type ${X.mediaType}`};A=X.mediaType,y=X.base64Start,Y=X.base64End}if(!A||!I.has(A))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${n??"unknown"}`};let V=Y-y;if(V===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(V>B)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${B} byte encoded limit`};if(!Nf(f,y,Y))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let o=f.slice(y,Y),T=Wf(o);if(T>d)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${d} byte decoded limit`};return{ok:!0,mediaType:A,base64:o,encodedBytes:V,decodedBytes:T}}function fn(n,f,_,B){let d=Cf(n,f,{maxEncodedBytes:_.maxImageEncodedBytes,maxDecodedBytes:_.maxImageDecodedBytes});if(!d.ok)return Yn(B,d.reason),d;let I=nn(d.encodedBytes,d.decodedBytes,_,B);if(I)return I;return d}function F(n){return n.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var Kn="ERROR: EMPTY CONTENT",x6="[image attached]";function Sf(n,f){let _=n[n.length-1];if(f.role==="tool"&&_?.role==="tool"&&Array.isArray(_.content)&&Array.isArray(f.content)){_.content.push(...f.content);return}n.push(f)}function l6(n){if(!Array.isArray(n)||n.length===0)return!1;return n.every((f)=>{if(!f||typeof f!=="object")return!1;let _=f;if(_.type==="text")return typeof _.text==="string";if(_.type==="image")return typeof _.data==="string"&&typeof _.mediaType==="string";return!1})}function m(){return{type:"text",text:h}}function cf(n){return nn(S,0,{maxImageEncodedBytes:S,maxImageDecodedBytes:u},n)===null}function s6(n){try{return new URL(n).protocol}catch{return}}function Un(n,f){let _=fn(n.mediaType,n.data,{maxImageEncodedBytes:S,maxImageDecodedBytes:u},f);if(!_.ok)return m();return{type:"image-data",data:_.base64,mediaType:_.mediaType}}function r6(n,f){if(n.image instanceof URL){if(n.image.protocol==="data:"){let A=fn(n.mediaType,n.image.href,{maxImageEncodedBytes:S,maxImageDecodedBytes:u},f);if(!A.ok)return m();return{type:"image",image:`data:${A.mediaType};base64,${A.base64}`,mediaType:A.mediaType}}if(n.image.protocol!=="http:"&&n.image.protocol!=="https:")return m();if(!cf(f))return m();return{type:"image",image:n.image,mediaType:n.mediaType}}if(typeof n.image==="string"){let A=s6(n.image);if(A==="http:"||A==="https:"){if(!cf(f))return m();return{type:"image",image:n.image,mediaType:n.mediaType}}let $=A==="data:",y=fn(n.mediaType??($?void 0:"image/png"),n.image,{maxImageEncodedBytes:S,maxImageDecodedBytes:u},f);if(!y.ok)return m();return{type:"image",image:$?`data:${y.mediaType};base64,${y.base64}`:y.base64,mediaType:y.mediaType}}let _=n.image.byteLength,B=on(_),d=n.mediaType?.toLowerCase()??"image/png";if(!Mn.includes(d)||nn(B,_,{maxImageEncodedBytes:S,maxImageDecodedBytes:u},f))return m();return{type:"image",image:n.image,mediaType:d}}function Fn(n,f,_,B=!0){if(n==null||typeof n!=="object")return{value:n,changed:!1,mediaChanged:!1};if(Array.isArray(n)){let y=[],Y=!1,X=!1;for(let V of n){if(V&&typeof V==="object"){let T=V;if(T.type==="image"&&typeof T.data==="string"&&typeof T.mediaType==="string"){if(!B){y.push(h),Y=!0,X=!0;continue}let dn={type:"image",data:T.data,mediaType:T.mediaType},x=Un(dn,_);if(x.type==="image-data")f.push({type:"image",data:x.data,mediaType:x.mediaType});else y.push(x.text);Y=!0,X=!0;continue}if(T.type==="image"){y.push(h),Y=!0,X=!0;continue}if(T.type==="text"&&typeof T.text==="string"){y.push(T.text),Y=!0;continue}}let o=Fn(V,f,_,B);y.push(o.value),Y||=o.changed,X||=o.mediaChanged}return{value:Y?y:n,changed:Y,mediaChanged:X}}let d=n;if(d.type==="image"){if(typeof d.data==="string"&&typeof d.mediaType==="string"){if(!B)return{value:h,changed:!0,mediaChanged:!0};let y={type:"image",data:d.data,mediaType:d.mediaType},Y=Un(y,_);if(Y.type==="image-data")return f.push({type:"image",data:Y.data,mediaType:Y.mediaType}),{value:x6,changed:!0,mediaChanged:!0};return{value:Y.text,changed:!0,mediaChanged:!0}}return{value:h,changed:!0,mediaChanged:!0}}let I={},A=!1,$=!1;for(let[y,Y]of Object.entries(d)){let X=Fn(Y,f,_,B);I[y]=X.value,A||=X.changed,$||=X.mediaChanged}return{value:A?I:n,changed:A,mediaChanged:$}}function _n(n){if(typeof n==="string")return F(n);if(Array.isArray(n))return n.map((f)=>_n(f));if(n!==null&&typeof n==="object"){let f=n,_={};for(let[B,d]of Object.entries(f))_[B]=_n(d);return _}return n}function vf(n,f=!1,_=Gn()){if(typeof n==="string")return{type:f?"error-text":"text",value:F(n)};if(!f&&l6(n))return{type:"content",value:n.map((B)=>B.type==="image"?Un(B,_):{type:"text",text:F(B.text)})};if(n!==null&&typeof n==="object"){let B=[],d=Fn(n,B,_,!f);if(!f&&B.length>0)return{type:"content",value:[{type:"text",text:typeof d.value==="string"?F(d.value):JSON.stringify(_n(d.value))},...B.map((A)=>({type:"image-data",data:A.data,mediaType:A.mediaType}))]};if(d.mediaChanged)return{type:f?"error-json":"json",value:_n(d.value)}}if(n===null||typeof n==="boolean"||typeof n==="number"||typeof n==="object")return{type:f?"error-json":"json",value:_n(n)};return{type:f?"error-text":"text",value:F(String(n))}}function z6(n,f,_){let B=_?.assistantToolCallArgKey??"input",d=[],I=Gn();if(typeof n==="string"&&n.trim().length>0||Array.isArray(n)&&n.length>0)d.push({role:"system",content:typeof n==="string"?F(n):n});for(let A of f){let $=A.content;if(typeof $==="string"){if($.trim().length===0){d.push({role:A.role,content:[{type:"text",text:Kn}]});continue}d.push({role:A.role,content:F($)});continue}let y=[],Y=[];if($.length===0){d.push({role:A.role,content:[{type:"text",text:Kn}]});continue}for(let X of $)switch(X.type){case"text":y.push({type:"text",text:F(X.text),...X.providerOptions?{providerOptions:X.providerOptions}:{}});break;case"reasoning":y.push({type:"reasoning",text:F(X.text),...X.providerOptions?{providerOptions:X.providerOptions}:{}});break;case"image":y.push(r6(X,I));break;case"file":y.push({type:"text",text:Vn(X.path,F(X.content))});break;case"tool-call":if(A.role==="assistant")y.push({type:"tool-call",toolCallId:X.toolCallId,toolName:X.toolName,[B]:X.input,...X.providerOptions?{providerOptions:X.providerOptions}:{}});break;case"tool-result":{Y.push({type:"tool-result",toolCallId:X.toolCallId,toolName:X.toolName,output:vf(X.output,X.isError??!1,I)});break}}if(y.length>0)Sf(d,{role:A.role,content:y});if(Y.length>0)Sf(d,{role:"tool",content:Y})}return d}var g1=["show","hide","subscription"];function hf(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function p6(n,f){if(!n&&!f)return;let _=n?.metadata,B=f?.metadata,d={...n??{},...f??{}};if(hf(_)&&hf(B))d.metadata={..._,...B};return d}var wn={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},i6=void 0;function a6(n,f){if(typeof n==="string"&&n.toLowerCase()in wn)return n.toLowerCase();return f?void 0:void 0}function uf(n,f){let _=typeof n==="string"?n.toLowerCase():void 0;if(_&&_ in wn)return wn[_];if(f?.fallbackEffort)return wn[f.fallbackEffort];return}function e6(n){let f=uf(n.effort,{fallbackEffort:n.fallbackEffort});if(f===void 0)return;if(f<=0)return 0;let _=n.minimumBudget??1;if(n.maxBudget<_)return;let B=n.scaleTokens??n.maxBudget;return Math.min(Math.max(Math.floor(B*f),_),n.maxBudget)}function t6(n){return n instanceof Error?{name:n.name,message:n.message}:n}var n_=3;function mf(n){return Math.max(1,Math.ceil(n/3))}function Qn(n){let f=new WeakSet;try{return JSON.stringify(n,(_,B)=>{if(typeof B==="bigint")return B.toString();if(typeof B!=="object"||B===null)return B;if(f.has(B))return"[Circular]";return f.add(B),B})??""}catch{return String(n??"")}}function f_(n){let f;try{f=JSON.stringify({systemPrompt:n.systemPrompt,messages:n.messages,tools:n.tools})}catch{f=[Qn(n.systemPrompt),Qn(n.messages),Qn(n.tools)].join(`
4
- `)}return mf(f.length)}var __={debug:()=>{},log:()=>{},error:()=>{}};var u1=60,m1=1,x1=3600;function w_(n){return typeof n==="number"&&Number.isFinite(n)}function B_(n){return Math.min(Math.max(n,1),3600)}function l1(n){if(!w_(n))return 60;return B_(n)}function s1(n,f,_){let B=_?` (${_})`:"",d=Math.round(f/100)/10;return`MCP request to "${n}"${B} timed out after ${d}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function d_(n){if(n instanceof Error)return n.message;return String(n)}function R_(n){if(n&&typeof n==="object"&&"code"in n&&typeof n.code==="string")return n.code;return""}class c extends Error{constructor(n,f){super(`${n} at position ${f}`);this.position=f}}function xf(n){return/^[0-9A-Fa-f]$/.test(n)}function N(n){return n>="0"&&n<="9"}function lf(n){return n>=" "}function p(n){return`,:[]/{}()
5
- +`.includes(n)}function jn(n){return n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="_"||n==="$"}function yn(n){return n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="_"||n==="$"||n>="0"&&n<="9"}var Pn=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,Wn=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function On(n){return`,[]/{}
6
- +`.includes(n)}function gn(n){return i(n)||E_.test(n)}var E_=/^[[{\w-]$/;function Nn(n){return n===`
7
- `||n==="\r"||n==="\t"||n==="\b"||n==="\f"}function g(n,f){let _=n.charCodeAt(f);return _===32||_===10||_===9||_===13}function sf(n,f){let _=n.charCodeAt(f);return _===32||_===9||_===13}function rf(n,f){let _=n.charCodeAt(f);return _===160||_===6158||_>=8192&&_<=8203||_===8239||_===8287||_===12288||_===65279}function i(n){return Cn(n)||Xn(n)}function Cn(n){return n==='"'||n==="“"||n==="”"}function Sn(n){return n==='"'}function Xn(n){return n==="'"||n==="‘"||n==="’"||n==="`"||n==="´"}function cn(n){return n==="'"}function a(n,f){let _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,B=n.lastIndexOf(f);return B!==-1?n.substring(0,B)+(_?"":n.substring(B+1)):n}function U(n,f){let _=n.length;if(!g(n,_-1))return n+f;while(g(n,_-1))_--;return n.substring(0,_)+f+n.substring(_)}function zf(n,f,_){return n.substring(0,f)+n.substring(f+_)}function pf(n){return/[,\n][ \t\r]*$/.test(n)}var A_={"&quot;":'"',"&amp;":"&","&lt;":"<","&gt;":">","&apos;":"'"},vn=12;function hn(n){if(n.charAt(0)!=="&")return null;let f=n.indexOf(";");if(f===-1)return null;let _=n.substring(0,f+1),B=A_[_];if(B!==void 0)return{char:B,length:_.length};if(n.charAt(1)==="#"){let d=n.substring(2,f),I=d.charAt(0)==="x"||d.charAt(0)==="X",A=I?d.substring(1):d;if(A.length>0){let $=Number.parseInt(A,I?16:10);if(!Number.isNaN($)&&$>=0&&$<=1114111)return{char:String.fromCodePoint($),length:_.length}}}return null}function af(n){return n!==null&&n.char==='"'}function ef(n){return n!==null&&n.char==="'"}function z(n,f){let _=0;for(let B=0;B<n.length;B++)if(n.charAt(B)===f)_++;return _}function tf(n,f){switch(f){case")":return z(n,"(")>z(n,")");case"]":return z(n,"[")>z(n,"]");case"}":return z(n,"{")>z(n,"}");default:return!1}}var n4={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},I_={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
8
- `,r:"\r",t:"\t"};function un(n){let f=0,_="";if(Y(["```","[```","{```"]),!I())l4();Y(["```","```]","```}"]);let d=V(",");if(d)A();if(gn(n[f])&&pf(_)){if(!d)_=U(_,",");v4()}else if(d)_=a(_,",");while(n[f]==="}"||n[f]==="]")f++,A();if(f>=n.length)return _;kn();function I(){A();let M=x()||c4()||l()||L()||h4()||wf(!1)||u4();return A(),M}function A(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,G=f,q=$(M);do if(q=y(),q)q=$(M);while(q);return f>G}function $(M){let G=M?g:sf,q="";while(!0)if(G(n,f))q+=n[f],f++;else if(rf(n,f))q+=" ",f++;else break;if(q.length>0)return _+=q,!0;return!1}function y(){if(n[f]==="/"&&n[f+1]==="*"){while(f<n.length&&!$_(n,f))f++;return f+=2,!0}if(n[f]==="/"&&n[f+1]==="/"){while(f<n.length&&n[f]!==`
9
- `)f++;return!0}return!1}function Y(M){if(X(M)){if(jn(n[f]))while(f<n.length&&yn(n[f]))f++;return A(),!0}return!1}function X(M){$(!0);for(let G of M){let q=f+G.length;if(n.slice(f,q)===G)return f=q,!0}return!1}function V(M){if(n[f]===M)return _+=n[f],f++,!0;return!1}function o(M){if(n[f]===M)return f++,!0;return!1}function T(){return o("\\")}function dn(){if(A(),n[f]==="."&&n[f+1]==="."&&n[f+2]===".")return f+=3,A(),o(","),!0;return!1}function x(){if(n[f]==="{"){if(_+="{",f++,A(),o(","))A();let M=!0;while(f<n.length&&n[f]!=="}"){let G;if(!M){if(G=V(","),!G)_=U(_,",");A()}else G=!0;if(dn(),!(l()||wf(!0))){if(n[f]==="}"||n[f]==="{"||n[f]==="]"||n[f]==="["||n[f]===void 0){if(!M)_=a(_,",")}else s4();break}A();let P=V(":"),r=f>=n.length;if(!P)if(gn(n[f])||r)_=U(_,":");else Rf();if(!I())if(P||r)_+="null";else Rf();M=!1}if(n[f]==="}")_+="}",f++;else _=U(_,"}");return!0}return!1}function c4(){if(n[f]==="["){if(_+="[",f++,A(),o(","))A();let M=!0;while(f<n.length&&n[f]!=="]"){if(!M){if(!V(","))_=U(_,",")}if(dn(),!I()){if(!M)_=a(_,",");break}M=!1}if(n[f]==="]")_+="]",f++;else _=U(_,"]");return!0}return!1}function v4(){let M=!0,G=!0;while(G){if(!M){if(!V(","))_=U(_,",")}else M=!1;G=I()}if(!G)_=a(_,",");_=`[
10
- ${_}
11
- ]`}function l(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,q=n[f]==="\\";if(q){if(f++,!i(n[f]))kn()}let P=n[f]==="&"?hn(n.slice(f,f+vn)):null,r=af(P)||ef(P);if(i(n[f])||r){let Ef=Sn(n[f])?Sn:cn(n[f])?cn:Xn(n[f])?Xn:Cn,Rn=f,En=_.length,Z='"';f+=r&&P?P.length:1;while(!0){if(f>=n.length){let J=Bf(f-1);if(!M&&p(n.charAt(J)))return f=Rn,_=_.substring(0,En),l(!0);return Z=U(Z,'"'),_+=Z,!0}if(f===G)return Z=U(Z,'"'),_+=Z,!0;let W=r&&n[f]==="&"?hn(n.slice(f,f+vn)):null;if(W&&P?W.char===P.char:Ef(n[f])){let J=f,Zn=Z.length;if(Z+='"',f+=W?W.length:1,_+=Z,A(!1),M||f>=n.length||p(n[f])&&!tf(Z,n[f])||i(n[f])&&!m4(f)||N(n[f]))return _f(),!0;if(n[f]==="\\")kn();let C=Bf(J-1),Af=n.charAt(C);if(Af===",")return f=Rn,_=_.substring(0,En),l(!1,C);if(p(Af))return f=Rn,_=_.substring(0,En),l(!0);_=_.substring(0,En),f=J+(W?W.length:1),Z=`${Z.substring(0,Zn)}\\${Z.substring(Zn)}`}else if(M&&On(n[f])){if(n[f-1]===":"&&Pn.test(n.substring(Rn+1,f+2)))while(f<n.length&&Wn.test(n[f]))Z+=n[f],f++;return Z=U(Z,'"'),_+=Z,_f(),!0}else if(W){let J=W.char;if(J==='"')Z+="\\\"";else if(Nn(J))Z+=n4[J];else Z+=J;f+=W.length}else if(n[f]==="\\"){let J=n.charAt(f+1);if(I_[J]!==void 0)Z+=n.slice(f,f+2),f+=2;else if(J==="u"){let C=2;while(C<6&&xf(n[f+C]))C++;if(C===6)Z+=n.slice(f,f+6),f+=6;else if(f+C>=n.length)f=n.length;else r4()}else if(J===`
12
- `)Z+="\\n",f+=2;else Z+=J,f+=2}else{let J=n.charAt(f);if(J==='"'&&n[f-1]!=="\\")Z+=`\\${J}`,f++;else if(Nn(J))Z+=n4[J],f++;else{if(!lf(J))x4(J);Z+=J,f++}}if(q)T()}}return!1}function _f(){let M=!1;A();while(n[f]==="+"){M=!0,f++,A(),_=a(_,'"',!0);let G=_.length;if(l())_=zf(_,G,1);else _=U(_,'"')}return M}function L(){let M=f,G="",q=!1;if(n[f]==="-"){if(G+=n[f],f++,!N(n[f])&&df())G+="0"}if(n[f]==="0"&&N(n[f+1]))q=!0;while(N(n[f]))G+=n[f],f++;if(n[f]==="."){if(G===""||G==="-")G+="0";if(G+=n[f],f++,!N(n[f]))G+="0";while(N(n[f]))G+=n[f],f++}if(f>M){if(n[f]==="e"||n[f]==="E"){if(G==="-")q=!0;if(G+=n[f],f++,n[f]==="-"||n[f]==="+")G+=n[f],f++;if(!N(n[f]))G+="0";while(N(n[f]))G+=n[f],f++}if(!df())return f=M,!1;return _+=q?`"${n.substring(M,f)}"`:G,!0}return!1}function h4(){return s("true","true")||s("false","false")||s("null","null")||s("True","true")||s("False","false")||s("None","null")}function s(M,G){if(n.slice(f,f+M.length)===M&&!yn(n[f+M.length]))return _+=G,f+=M.length,!0;return!1}function wf(M){let G=f;if(jn(n[f])){while(f<n.length&&yn(n[f]))f++;let q=f;while(g(n,q))q++;if(n[q]==="("){if(f=q+1,I(),n[f]===")"){if(f++,n[f]===";")f++}return!0}}while(f<n.length&&!On(n[f])&&!i(n[f])&&(!M||n[f]!==":"))f++;if(n[f-1]===":"&&Pn.test(n.substring(G,f+2)))while(f<n.length&&Wn.test(n[f]))f++;if(f>G){while(g(n,f-1)&&f>0)f--;let q=n.slice(G,f);if(_+=q==="undefined"?"null":JSON.stringify(q),n[f]==='"')f++;return!0}}function u4(){if(n[f]==="/"){let M=f;f++;while(f<n.length&&(n[f]!=="/"||n[f-1]==="\\"))f++;return f++,_+=JSON.stringify(n.substring(M,f)),!0}}function Bf(M){let G=M;while(G>0&&g(n,G))G--;return G}function m4(M){let G=M+1;while(G<n.length&&g(n,G))G++;return G>=n.length||p(n[G])}function df(){return f>=n.length||p(n[f])||g(n,f)}function x4(M){throw new c(`Invalid character ${JSON.stringify(M)}`,f)}function kn(){throw new c(`Unexpected character ${JSON.stringify(n[f])}`,f)}function l4(){throw new c("Unexpected end of json string",n.length)}function s4(){throw new c("Object key expected",f)}function Rf(){throw new c("Colon expected",f)}function r4(){let M=n.slice(f,f+6);throw new c(`Invalid unicode character "${M}"`,f)}}function $_(n,f){return n[f]==="*"&&n[f+1]==="/"}var D_=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function Y_(n){let f=n.match(D_);if(!f)return;let[,_,B]=f,d=B.trim();if(!d)return;let I=d[0];if(I==='"'||I==="{"||I==="["||d==="true"||d==="false"||d==="null"||Number.isFinite(Number(d)))return;return JSON.parse(`{"${_}":${JSON.stringify(d)}}`)}var M_=[(n)=>JSON.parse(n),(n)=>JSON.parse(un(n)),Y_];function G_(n){if(typeof n!=="string")return n;let f=n.trimStart();if(f[0]!=="{"&&f[0]!=="[")return n;for(let _ of M_)try{let B=_(f);if(B!==void 0)return B}catch{}return n}function y_(n){let f=new WeakSet;try{return JSON.stringify(n,(B,d)=>{if(typeof d==="bigint")return d.toString();if(d&&typeof d==="object"){if(f.has(d))return"[Circular]";f.add(d)}return d})??"null"}catch{return String(n)}}function X_(n){try{return JSON.parse(n)}catch{return}}function e(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function b_(n){let f=n.type;if(typeof f==="string")return[f];return Array.isArray(f)?f.filter((_)=>typeof _==="string"):[]}function mn(n,f){if(b_(n).includes(f))return!0;for(let B of["anyOf","oneOf","allOf"]){let d=n[B];if(Array.isArray(d)&&d.some((I)=>e(I)&&mn(I,f)))return!0}return!1}function q_(n,f){if(typeof n!=="string")return n;let _=n.trim(),B=mn(f,"array"),d=mn(f,"object");if((!B||!_.startsWith("["))&&(!d||!_.startsWith("{")))return n;try{let I=JSON.parse(_);if(Array.isArray(I))return B?I:n;if(e(I))return d?I:n;return n}catch{return n}}function xn(n,f){let _=q_(n,f);if(Array.isArray(_)){let A=f.items;if(!e(A))return _;let $=!1,y=_.map((Y)=>{let X=xn(Y,A);return $||=X!==Y,X});return $?y:_}if(!e(_))return _;let B=f.properties;if(!e(B))return _;let d=!1,I={..._};for(let[A,$]of Object.entries(B)){if(!(A in _)||!e($))continue;let y=xn(_[A],$);if(y!==_[A])I[A]=y,d=!0}return d?I:_}function k_(n){if(typeof globalThis.atob==="function")try{let f=globalThis.atob(n),_=Uint8Array.from(f,(B)=>B.charCodeAt(0));return new TextDecoder().decode(_)}catch{return null}if(typeof Buffer<"u")try{return Buffer.from(n,"base64").toString("utf8")}catch{return null}return null}function Z_(n){let f=n?.trim();if(!f)return null;try{let _=f.split(".");if(_.length!==3)return null;let B=_[1];if(!B)return null;let d=B.replace(/-/g,"+").replace(/_/g,"/"),I=d.padEnd(d.length+(4-d.length%4)%4,"="),A=k_(I);return A?JSON.parse(A):null}catch{return null}}function H_(n){return Object.fromEntries(Object.entries(n).filter(([,f])=>f!==void 0))}function L_(n){let f=n.replaceAll("\\","/"),_=f.lastIndexOf("/");return(_>=0?f.slice(_+1):f).toLowerCase()}function J_(n){return n==="win32"?"powershell":"/bin/bash"}function ln(n){let f=L_(n);if(f==="powershell"||f==="powershell.exe"||f==="pwsh"||f==="pwsh.exe")return"powershell";if(f==="cmd"||f==="cmd.exe")return"cmd";if(f==="wsl"||f==="wsl.exe")return"wsl";return"posix"}function f4(n,f){switch(ln(n)){case"powershell":return{args:["-NoProfile","-NonInteractive","-Command","[Console]::InputEncoding=[Text.UTF8Encoding]::new();[Console]::OutputEncoding=[Text.UTF8Encoding]::new();$c=[Console]::In.ReadToEnd();$c+=[Environment]::NewLine+'if(-not $?){exit 1}';& ([ScriptBlock]::Create($c))"],input:f};case"cmd":return{args:["/d","/s","/c",f]};case"wsl":return{args:["bash","-c",f]};case"posix":return{args:["-c",f]}}}function T_(n,f){if(ln(n)==="powershell")return["-NoProfile","-NonInteractive","-Command",f];return f4(n,f).args}function V_(n){return n.toLowerCase().replace(/[^\w.-]+/g,"_")}function o_(n){let f=n?.trim();return f?f:void 0}function _4(n,f){if(n.length<=f)return n;return`${n.slice(0,f-1)}…`}function K_(n,f="/",_=100){if(!n||n.length<=_)return n||"";let B=n.split(f)?.shift()?.trim()?.slice(0,_-1);return B?`${B}…`:_4(n,_)}function U_(n){if(n.length<=8)return"****";return`${n.slice(0,4)}...${n.slice(-4)}`}function F_(n){return n.charCodeAt(0)===65279?n.slice(1):n}function Q_(n){if(!n)return"(unknown-date)";let f=new Date(n);if(Number.isNaN(f.getTime()))return n;return f.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}function j_(n){let f=Math.max(0,Math.floor(n/1000)),_=Math.floor(f/86400),B=Math.floor(f%86400/3600),d=Math.floor(f%3600/60),I=f%60;if(_>0)return`${_}d ${B}h`;if(B>0)return`${B}h ${d}m`;if(d>0)return`${d}m ${I}s`;return`${I}s`}import{z as w4}from"zod";function P_(n,f){let _=n.safeParse(f);if(!_.success)throw Error(w4.prettifyError(_.error));return _.data}function sn(n){return w4.toJSONSchema(n)}function rn(n){return n==="cline"||n==="cline-pass"}var B4=`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 X}from"zod";import{z as W}from"zod";import{z as M}from"zod";var _0=["none","minimal","low","medium","high","xhigh","max"],M0=M.enum(_0),Q0=M0.exclude(["none"]),ef=M.enum([..._0,"default"]).nullable(),E0=M.discriminatedUnion("type",[M.object({type:M.literal("toggle")}).strict(),M.object({type:M.literal("effort"),values:M.array(ef)}).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 Q1=W.enum(["default","openai-responses","r1"]),f6={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},j1=W.enum(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),V1=W.enum(["active","preview","deprecated","legacy"]),k1=W.object({input:W.number().optional(),output:W.number().optional(),cacheWrite:W.number().optional(),cacheRead:W.number().optional()}),F1=W.object({maxBudget:W.number().optional(),outputPrice:W.number().optional(),thinkingLevel:W.enum(["low","high"]).optional()}),L1=W.object({reasoningDefaultOn:W.boolean().optional()}).catchall(W.unknown()),j0=W.object({id:W.string(),name:W.string().optional(),description:W.string().optional(),maxTokens:W.number().optional(),contextWindow:W.number().optional(),maxInputTokens:W.number().optional(),capabilities:W.array(j1).optional(),reasoningOptions:W.array(E0).optional(),apiFormat:Q1.optional(),systemRole:W.enum(["system","developer"]).optional(),temperature:W.number().optional(),pricing:k1.optional(),thinkingConfig:F1.optional(),status:V1.optional(),deprecationNotice:W.string().optional(),replacedBy:W.string().optional(),releaseDate:W.string().optional(),deprecationDate:W.string().optional(),family:W.string().optional(),metadata:L1.optional()});import{z as n}from"zod";var O0=n.object({id:n.string(),name:n.string(),input:n.unknown(),output:n.unknown(),error:n.string().optional(),durationMs:n.number(),startedAt:n.date(),endedAt:n.date()});var $6=X.enum(["completed","max_iterations","aborted","mistake_limit","error"]),w6=X.object({inputTokens:X.number(),outputTokens:X.number(),cacheReadTokens:X.number().optional(),cacheWriteTokens:X.number().optional(),totalCost:X.number().optional()}),Z4=X.object({text:X.string(),usage:w6,messages:X.array(X.custom()),toolCalls:X.array(O0),iterations:X.number(),finishReason:$6,model:X.object({id:X.string(),provider:X.string(),info:j0.optional()}),startedAt:X.date(),endedAt:X.date(),durationMs:X.number()}),G4=X.object({sessionId:X.string().optional(),providerId:X.string(),modelId:X.string(),apiKey:X.string().optional(),baseUrl:X.string().url().optional(),headers:X.record(X.string(),X.string()).optional(),knownModels:X.record(X.string(),j0).optional(),providerConfig:X.unknown().optional(),initialMessages:X.array(X.custom()).optional(),systemPrompt:X.string(),tools:X.array(X.custom()),maxIterations:X.number().positive().optional(),maxParallelToolCalls:X.number().int().positive().default(8),maxTokensPerTurn:X.number().positive().optional(),temperature:X.number().nonnegative().optional(),apiTimeoutMs:X.number().positive().default(180000),userFileContentLoader:X.function().input([X.string()]).output(X.promise(X.string())).optional(),toolContextMetadata:X.record(X.string(),X.unknown()).optional(),execution:X.object({maxConsecutiveMistakes:X.number().int().positive().optional(),reminderAfterIterations:X.number().nonnegative().optional(),reminderText:X.string().optional(),loopDetection:X.union([X.literal(!1),X.object({softThreshold:X.number().int().positive().optional(),hardThreshold:X.number().int().positive().optional()})]).optional()}).optional(),reasoningEffort:Q0.optional(),thinkingBudgetTokens:X.number().positive().optional(),thinking:X.boolean().optional(),onEvent:X.function().input([X.custom()]).output(X.void()).optional(),hooks:X.custom().optional(),parentAgentId:X.string().optional(),extensions:X.array(X.custom()).optional(),hookErrorMode:X.enum(["ignore","throw"]).default("ignore"),toolPolicies:X.record(X.string(),X.object({enabled:X.boolean().optional(),autoApprove:X.boolean().optional()})).optional(),requestToolApproval:X.function().input([X.object({sessionId:X.string(),agentId:X.string(),conversationId:X.string(),iteration:X.number(),toolCallId:X.string(),toolName:X.string(),input:X.unknown(),policy:X.object({enabled:X.boolean().optional(),autoApprove:X.boolean().optional()}).default({})})]).output(X.union([X.object({approved:X.boolean(),reason:X.string().optional()}),X.promise(X.object({approved:X.boolean(),reason:X.string().optional()}))])).optional(),onConsecutiveMistakeLimitReached:X.function().input([X.object({iteration:X.number().int().positive(),consecutiveMistakes:X.number().int().positive(),maxConsecutiveMistakes:X.number().int().positive(),reason:X.enum(["api_error","invalid_tool_call","tool_execution_failed"]),details:X.string().optional()})]).output(X.union([X.object({action:X.literal("continue"),guidance:X.string().optional()}),X.object({action:X.literal("stop"),reason:X.string().optional()}),X.promise(X.union([X.object({action:X.literal("continue"),guidance:X.string().optional()}),X.object({action:X.literal("stop"),reason:X.string().optional()})]))])).optional(),logger:X.custom().optional(),extensionContext:X.custom().optional(),abortSignal:X.custom().optional()});import{z as F}from"zod";var W1=F.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"]),A1=F.object({id:F.string().optional(),label:F.string().optional(),role:F.string().optional(),participantKey:F.string().optional(),participantLabel:F.string().optional(),platformUserId:F.string().optional(),metadata:F.record(F.string(),F.unknown()).optional()}),D1=F.object({source:F.string(),sourceEvent:F.string(),threadId:F.string(),channelId:F.string(),isDM:F.boolean(),sessionId:F.string().optional(),workspaceRoot:F.string().optional(),metadata:F.record(F.string(),F.unknown()).optional()}),Y6=F.object({actor:A1,context:D1,payload:F.record(F.string(),F.unknown()).optional()}),q6=F.object({action:F.enum(["allow","deny"]).default("allow"),message:F.string().optional(),reason:F.string().optional(),metadata:F.record(F.string(),F.unknown()).optional()}),Z6=F.object({adapter:F.string(),botUserName:F.string().optional(),event:W1,payload:F.record(F.string(),F.unknown()),ts:F.string()});var U1=[{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 P1(){return U1.map((f)=>({...f}))}function G6(f,$){let w=f.includeWhen;if(!w)return!0;let q=$[w.flag]??"";if(w.equals!==void 0&&q!==w.equals)return!1;if(w.notEquals!==void 0&&q===w.notEquals)return!1;return!0}function X6(f=I1){let $=new Set(P1().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((q)=>({flag:q.flag,label:q.label,placeholder:q.placeholder,required:q.required,help:q.help,initialValue:q.initialValue,options:q.options,includeWhen:q.includeWhen})),security:w.security?{prompt:w.security.prompt,fields:w.security.fields.map((q)=>({key:q.key,label:q.label,placeholder:q.placeholder,help:q.help,requiredMessage:q.requiredMessage}))}:void 0}))}function H6(f){return/^\d+$/.test(f)?void 0:"Telegram user ID must contain digits only"}function R6(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 J6(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 I1=[{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:H6}],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:R6},{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:J6}],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 K6=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],_6=new Set(K6);function E1(f,$){return f.name||`extension_${String($).padStart(4,"0")}`}function B1(f){return Array.isArray(f)&&f.every(($)=>typeof $==="string")}function M1(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 O1(f){let $=M1(f.providerIds),w=M1(f.modelIds);return{...f,...$?{providerIds:$}:{},...w?{modelIds:w}:{}}}function Q6(f,$){let w=E1(f,$),q=f.manifest;if(!q||typeof q!=="object")throw Error(`Invalid manifest for extension "${w}": manifest is required`);if(!Array.isArray(q.capabilities)||q.capabilities.length===0)throw Error(`Invalid manifest for extension "${w}": capabilities must be a non-empty array`);let Z=new Set;for(let J of q.capabilities){if(!_6.has(J))throw Error(`Invalid manifest for extension "${w}": unsupported capability "${String(J)}"`);Z.add(J)}if(Object.hasOwn(q,"providerIds")&&!B1(q.providerIds))throw Error(`Invalid manifest for extension "${w}": providerIds must be a string array when provided`);if(Object.hasOwn(q,"modelIds")&&!B1(q.modelIds))throw Error(`Invalid manifest for extension "${w}": modelIds must be a string array when provided`);let H=Z.has("hooks");if(f.hooks!==void 0&&!H)throw Error(`Invalid manifest for extension "${w}": runtime hooks require the "hooks" capability`);return{capabilities:Z,raw:O1(q)}}function j6(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():"",q=typeof f.source==="string"?f.source.trim():"";if(!w)throw Error(`Invalid automation event contribution for extension "${$}": eventType is required`);if(!q)throw Error(`Invalid automation event contribution for extension "${$}": source is required`);return{...f,eventType:w,source:q,examples:f.examples?[...f.examples]:void 0,metadata:f.metadata?{...f.metadata}:void 0}}class b0{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:Q6(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 q of this.normalized){let{extension:Z}=q;if(Z.disabled)continue;let H=E1(Z,q.order),R={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},J={registerTool:(V)=>R.tools.push(V),registerCommand:(V)=>R.commands.push(V),registerRule:(V)=>{if(!q.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${H}": registerRule requires the "rules" capability`);R.rules.push(V)},registerMessageBuilder:(V)=>R.messageBuilder.push(V),registerProvider:(V)=>R.providers.push(V),registerAutomationEventType:(V)=>{if(!q.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${H}": registerAutomationEventType requires the "automationEvents" capability`);R.automationEventTypes.push(j6(V,H))},registerMcpServer:(V)=>{if(!q.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${H}": registerMcpServer requires the "mcp" capability`);R.mcpServers.push({...V,metadata:{...V.metadata??{},source:"plugin",plugin:H}})}},k=q.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await Z.setup?.(J,k),w.push(R)}catch(V){if(f.tolerateSetupErrors!==!0)throw V;$??=V}}if($&&f.tolerateSetupErrors!==!0)throw $;for(let q of w)this.registry.tools.push(...q.tools),this.registry.commands.push(...q.commands),this.registry.rules.push(...q.rules),this.registry.messageBuilder.push(...q.messageBuilder),this.registry.providers.push(...q.providers),this.registry.automationEventTypes.push(...q.automationEventTypes),this.registry.mcpServers.push(...q.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 V6(f={}){return new b0(f)}var k6=[".js",".ts"];var b1={CLINE_PASS:"ext-cline-pass"},F6={[b1.CLINE_PASS]:!1},L6=Object.values(b1);import{z as K}from"zod";var N1=K.enum(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),o=K.record(K.string(),K.string()),W6=K.object({toolName:K.string(),parameters:o}),A6=K.object({toolName:K.string(),parameters:o,result:K.string(),success:K.boolean(),executionTimeMs:K.number()}),D6=K.object({prompt:K.string(),attachments:K.array(K.string())}),U6=K.object({taskMetadata:o}),P6=K.object({taskMetadata:o,previousState:o}),I6=K.object({taskMetadata:o}),B6=K.object({taskMetadata:o}),M6=K.object({taskId:K.string(),ulid:K.string(),contextSize:K.number(),compactionStrategy:K.string(),previousApiReqIndex:K.number(),tokensIn:K.number(),tokensOut:K.number(),tokensInCache:K.number(),tokensOutCache:K.number(),deletedRangeStart:K.number(),deletedRangeEnd:K.number(),contextJsonPath:K.string(),contextRawPath:K.string()}),T1=K.object({clineVersion:K.string(),hookName:N1,timestamp:K.string(),taskId:K.string(),sessionContext:K.object({rootSessionId:K.string().optional(),hookLogPath:K.string().optional()}).optional(),workspaceRoots:K.array(K.string()),workspaceInfo:K.custom().optional(),userId:K.string(),agent_id:K.string(),parent_agent_id:K.string().nullable(),iteration:K.number().optional(),reason:K.string().optional(),tool_call:K.object({id:K.string(),name:K.string(),input:K.unknown()}).optional(),tool_result:K.custom().optional(),turn:K.unknown().optional(),error:K.object({name:K.string(),message:K.string(),stack:K.string().optional()}).optional(),preToolUse:W6.optional(),postToolUse:A6.optional(),userPromptSubmit:D6.optional(),taskStart:U6.optional(),taskResume:P6.optional(),taskCancel:I6.optional(),taskComplete:B6.optional(),preCompact:M6.optional()}).passthrough();function E6(f){let $=T1.safeParse(f);if(!$.success)return;return $.data}var W4="v1",A4="v1",D4="v1",U4=["client.register","client.list","session.create","session.list","session.get","session.run","session.abort","schedule.create","schedule.list","settings.get","settings.set","connector.start","connector.stop","connector.supervised"];function V0(f){let $=/^v(\d+)$/.exec(f?.trim()??"");if(!$)return;return Number.parseInt($[1]??"",10)}function P4(f,$="v1"){let w=V0(f.protocolVersion),q=V0($);if(w===void 0||q===void 0)return{compatible:!1,reason:"missing_protocol"};let Z=V0(f.minClientProtocolVersion)??w,H=V0(f.maxClientProtocolVersion)??w;return q>=Z&&q<=H?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var I4="0",B4="__hubScheduleRunAt",y1=["act","plan","yolo"];function O6(f){return y1.some(($)=>$===f)}function M4(f,$){if(!f||!Object.hasOwn(f,"mode"))return $;let w=f.mode;if(O6(w))return w;throw Error(`mode must be one of: ${y1.join(", ")}`)}var b6=30000,E4=5000;function N6(f){switch(f){case"run.start":case"session.send_input":return null;default:return b6}}function O4(f,$){return $===void 0?N6(f):$}var T6=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],y6=new Set(T6);function b4(f){return typeof f==="string"&&y6.has(f)}var N4="tool_executor.",T4="custom_tool.",y4="hook.",C4="compaction.compact",S4="checkpoint.create",g4="mistake_limit.decide",n4="user_instructions.snapshot";function N0(f,$){return`<file_content path="${f}">
2
+ ${$}
3
+ </file_content>`}function C6(f,$="act"){return`<user_input mode="${$}">${f}</user_input>`}function S6(f,$){return`<user_command slash="${$}">${f}</user_command>`}function g6(f,$){return`<mode_notice>The user switched from ${f} mode to ${$} mode before sending this message.</mode_notice>`}function n6(){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 v6(f,$){let w=f.trim(),q=new RegExp(`^<${$}\\b([^>]*)>([\\s\\S]*?)<\\/${$}>$`,"i").exec(w);if(!q)return;return{attrs:q[1]??"",content:q[2]??""}}function h6(f,$){return new RegExp(`${$}="([^"]+)"`,"i").exec(f)?.[1]?.trim()||void 0}function C1(f){if(!f?.trim())return;let $=v6(f,"user_command");if(!$)return;let w=h6($.attrs,"slash");if(!w)return;return{slash:w,content:$.content.trim()}}function S1(f){if(!f?.trim())return"";let $=f.trim();for(let w of["user_input","user_command"]){let q=n1($,w);$=(q!==$?q:$.replace(new RegExp(`<${w}[^>]*>`,"g"),"")).trim()}return $}function g1(f){if(!f?.trim())return"";return x6(f,"mode_notice").trim()}function x6(f,$){let w=`<${$}>`,q=`</${$}>`,Z=f,H=Z.indexOf(w);while(H!==-1){let R=Z.indexOf(q,H+w.length);if(R===-1)break;Z=Z.slice(0,H)+Z.slice(R+q.length),H=Z.indexOf(w,H)}return Z}function z6(f){let $=g1(S1(f)),w=C1(f);if(!w)return $;if(w.slash.toLowerCase()==="team"){let Z=$.toLowerCase().startsWith("spawn a team of agents for the following task:")?$.slice(46).trim():$;return Z?`/team ${Z}`:"/team"}return $?`/${w.slash} ${$}`:`/${w.slash}`}function n1(f,$){if(!f?.trim())return"";if(!$)return f;let w=new RegExp(`<${$}\\b[^>]*>([\\s\\S]*?)</${$}>`,"g");return f.replace(w,"$1")}var i="[media omitted: invalid or exceeds size limit]",Y0="[Image attached — this model cannot view images]",F0=["image/png","image/jpeg","image/gif","image/webp"],c6=5242880,z=5242880,u=6291456,o6=8388608;function u6(f){return f.length}function v1(f){let $=f.endsWith("==")?2:f.endsWith("=")?1:0;return Math.floor(f.length*3/4)-$}function d6(f=5242880){return Math.floor(f*3/4)}function T0(f){return Math.ceil(f/3)*4}function h1(f={}){return{maxImageEncodedBytes:f.maxImageEncodedBytes??5242880,maxImageDecodedBytes:f.maxImageDecodedBytes??6291456,maxTotalMediaBytes:f.maxTotalMediaBytes??8388608}}function L0(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function k0(f,$){f.omittedImages+=1,f.omittedReasons[$]=(f.omittedReasons[$]??0)+1}function q0(f,$,w,q){let Z=h1(w);if(f>Z.maxImageEncodedBytes){let H={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${Z.maxImageEncodedBytes} byte encoded limit`};return k0(q,H.reason),H}if($>Z.maxImageDecodedBytes){let H={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${Z.maxImageDecodedBytes} byte decoded limit`};return k0(q,H.reason),H}if(q.totalEncodedBytes+f>Z.maxTotalMediaBytes){let H={ok:!1,reason:"total_limit",message:`Image media exceeds the ${Z.maxTotalMediaBytes} byte total media limit`};return k0(q,H.reason),H}return q.totalEncodedBytes+=f,q.keptImages+=1,null}function x1(f){return f>=65&&f<=90||f>=97&&f<=122||f>=48&&f<=57||f===43||f===47}function l6(f){return f.length>0&&z1(f,0,f.length)}function z1(f,$,w){let q=w-$;if(q%4!==0)return!1;let Z=w;if(q>=2&&f.charCodeAt(w-2)===61&&f.charCodeAt(w-1)===61)Z-=2;else if(q>=1&&f.charCodeAt(w-1)===61)Z-=1;for(let H=$;H<Z;H++)if(!x1(f.charCodeAt(H)))return!1;for(let H=Z;H<w;H++)if(f.charCodeAt(H)!==61)return!1;return!0}function m6(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 p6(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 r6(f,$,w){if(!m6(f,$,w))return;let q=$+5,Z=f.indexOf(",",q);if(Z===-1||Z>=w)return;if(Z-q>128)return;let H=f.slice(q,Z).toLowerCase(),R=";base64";if(!H.endsWith(R))return;let J=H.slice(0,-R.length);if(!J||J.includes(";"))return;return{mediaType:J,base64Start:Z+1,base64End:w}}function c1(f,$,w={}){let q=w.maxEncodedBytes??5242880,Z=w.maxDecodedBytes??6291456,H=new Set(w.supportedMediaTypes??F0),R=f?.toLowerCase(),J=p6($),k=J.start,V=J.end,A=r6($,J.start,J.end);if(A){if(R&&R!==A.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${f} does not match data URL type ${A.mediaType}`};R=A.mediaType,k=A.base64Start,V=A.base64End}if(!R||!H.has(R))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${f??"unknown"}`};let j=V-k;if(j===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(j>q)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${q} byte encoded limit`};if(!z1($,k,V))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let B=$.slice(k,V),O=v1(B);if(O>Z)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${Z} byte decoded limit`};return{ok:!0,mediaType:R,base64:B,encodedBytes:j,decodedBytes:O}}function Z0(f,$,w,q){let Z=c1(f,$,{maxEncodedBytes:w.maxImageEncodedBytes,maxDecodedBytes:w.maxImageDecodedBytes});if(!Z.ok)return k0(q,Z.reason),Z;let H=q0(Z.encodedBytes,Z.decodedBytes,w,q);if(H)return H;return Z}function N(f){return f.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var y0="ERROR: EMPTY CONTENT",s6="[image attached]";function o1(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 i6(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 d(){return{type:"text",text:i}}function u1(f){return q0(z,0,{maxImageEncodedBytes:z,maxImageDecodedBytes:u},f)===null}function a6(f){try{return new URL(f).protocol}catch{return}}function C0(f,$){let w=Z0(f.mediaType,f.data,{maxImageEncodedBytes:z,maxImageDecodedBytes:u},$);if(!w.ok)return d();return d1(w.base64,w.mediaType)}function d1(f,$){return{type:"file",data:{type:"data",data:f},mediaType:$}}function G0(f,$){return{type:"file",data:f,mediaType:$??"image"}}function t6(f,$){if(f.image instanceof URL){if(f.image.protocol==="data:"){let R=Z0(f.mediaType,f.image.href,{maxImageEncodedBytes:z,maxImageDecodedBytes:u},$);if(!R.ok)return d();return G0(`data:${R.mediaType};base64,${R.base64}`,R.mediaType)}if(f.image.protocol!=="http:"&&f.image.protocol!=="https:")return d();if(!u1($))return d();return G0(f.image,f.mediaType)}if(typeof f.image==="string"){let R=a6(f.image);if(R==="http:"||R==="https:"){if(!u1($))return d();return G0(f.image,f.mediaType)}let J=R==="data:",k=Z0(f.mediaType??(J?void 0:"image/png"),f.image,{maxImageEncodedBytes:z,maxImageDecodedBytes:u},$);if(!k.ok)return d();return G0(J?`data:${k.mediaType};base64,${k.base64}`:k.base64,k.mediaType)}let w=f.image.byteLength,q=T0(w),Z=f.mediaType?.toLowerCase()??"image/png";if(!F0.includes(Z)||q0(q,w,{maxImageEncodedBytes:z,maxImageDecodedBytes:u},$))return d();return G0(f.image,Z)}function S0(f,$,w,q){let{hoistImages:Z,inlineImagePlaceholder:H}=q;if(f==null||typeof f!=="object")return{value:f,changed:!1,mediaChanged:!1};if(Array.isArray(f)){let A=[],j=!1,B=!1;for(let O of f){if(O&&typeof O==="object"){let b=O;if(b.type==="image"&&typeof b.data==="string"&&typeof b.mediaType==="string"){if(!Z){A.push(H),j=!0,B=!0;continue}let P0={type:"image",data:b.data,mediaType:b.mediaType},m=C0(P0,w);if(m.type==="file")$.push({type:"image",data:m.data.data,mediaType:m.mediaType});else A.push(m.text);j=!0,B=!0;continue}if(b.type==="image"){A.push(i),j=!0,B=!0;continue}if(b.type==="text"&&typeof b.text==="string"){A.push(b.text),j=!0;continue}}let C=S0(O,$,w,q);A.push(C.value),j||=C.changed,B||=C.mediaChanged}return{value:j?A:f,changed:j,mediaChanged:B}}let R=f;if(R.type==="image"){if(typeof R.data==="string"&&typeof R.mediaType==="string"){if(!Z)return{value:H,changed:!0,mediaChanged:!0};let A={type:"image",data:R.data,mediaType:R.mediaType},j=C0(A,w);if(j.type==="file")return $.push({type:"image",data:j.data.data,mediaType:j.mediaType}),{value:s6,changed:!0,mediaChanged:!0};return{value:j.text,changed:!0,mediaChanged:!0}}return{value:i,changed:!0,mediaChanged:!0}}let J={},k=!1,V=!1;for(let[A,j]of Object.entries(R)){let B=S0(j,$,w,q);J[A]=B.value,k||=B.changed,V||=B.mediaChanged}return{value:k?J:f,changed:k,mediaChanged:V}}function X0(f){if(typeof f==="string")return N(f);if(Array.isArray(f))return f.map(($)=>X0($));if(f!==null&&typeof f==="object"){let $=f,w={};for(let[q,Z]of Object.entries($))w[q]=X0(Z);return w}return f}function l1(f,$=!1,w=L0(),q){let Z=q?.supportsImages??!0;if(typeof f==="string")return{type:$?"error-text":"text",value:N(f)};if(!$&&i6(f))return{type:"content",value:f.map((H)=>H.type==="image"?Z?C0(H,w):{type:"text",text:Y0}:{type:"text",text:N(H.text)})};if(f!==null&&typeof f==="object"){let H=[],R=S0(f,H,w,{hoistImages:!$&&Z,inlineImagePlaceholder:Z?i:Y0});if(!$&&H.length>0)return{type:"content",value:[{type:"text",text:typeof R.value==="string"?N(R.value):JSON.stringify(X0(R.value))},...H.map((k)=>d1(k.data,k.mediaType))]};if(R.mediaChanged)return{type:$?"error-json":"json",value:X0(R.value)}}if(f===null||typeof f==="boolean"||typeof f==="number"||typeof f==="object")return{type:$?"error-json":"json",value:X0(f)};return{type:$?"error-text":"text",value:N(String(f))}}function e6(f,$,w){let q=w?.assistantToolCallArgKey??"input",Z=w?.supportsImages??!0,H=[],R=L0();if(typeof f==="string"&&f.trim().length>0||Array.isArray(f)&&f.length>0)H.push({role:"system",content:typeof f==="string"?N(f):f});for(let J of $){let k=J.content;if(typeof k==="string"){if(k.trim().length===0){H.push({role:J.role,content:[{type:"text",text:y0}]});continue}H.push({role:J.role,content:N(k)});continue}let V=[],A=[];if(k.length===0){H.push({role:J.role,content:[{type:"text",text:y0}]});continue}for(let j of k)switch(j.type){case"text":V.push({type:"text",text:N(j.text),...j.providerOptions?{providerOptions:j.providerOptions}:{}});break;case"reasoning":V.push({type:"reasoning",text:N(j.text),...j.providerOptions?{providerOptions:j.providerOptions}:{}});break;case"image":V.push(Z?t6(j,R):{type:"text",text:Y0});break;case"file":V.push({type:"text",text:N0(j.path,N(j.content))});break;case"tool-call":if(J.role==="assistant")V.push({type:"tool-call",toolCallId:j.toolCallId,toolName:j.toolName,[q]:j.input,...j.providerOptions?{providerOptions:j.providerOptions}:{}});break;case"tool-result":{A.push({type:"tool-result",toolCallId:j.toolCallId,toolName:j.toolName,output:l1(j.output,j.isError??!1,R,{supportsImages:Z})});break}}if(V.length>0)o1(H,{role:J.role,content:V});if(A.length>0)o1(H,{role:"tool",content:A})}return H}var u4=["show","hide","subscription"];function m1(f){return typeof f==="object"&&f!==null&&!Array.isArray(f)}function f$(f,$){if(!f&&!$)return;let w=f?.metadata,q=$?.metadata,Z={...f??{},...$??{}};if(m1(w)&&m1(q))Z.metadata={...w,...q};return Z}var H0={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},$$=void 0;function w$(f,$){if(typeof f==="string"&&f.toLowerCase()in H0)return f.toLowerCase();return $?void 0:void 0}function p1(f,$){let w=typeof f==="string"?f.toLowerCase():void 0;if(w&&w in H0)return H0[w];if($?.fallbackEffort)return H0[$.fallbackEffort];return}function Y$(f){let $=p1(f.effort,{fallbackEffort:f.fallbackEffort});if($===void 0)return;if($<=0)return 0;let w=f.minimumBudget??1;if(f.maxBudget<w)return;let q=f.scaleTokens??f.maxBudget;return Math.min(Math.max(Math.floor(q*$),w),f.maxBudget)}function q$(f){return f instanceof Error?{name:f.name,message:f.message}:f}var Z$=3;function r1(f){return Math.max(1,Math.ceil(f/3))}function g0(f){let $=new WeakSet;try{return JSON.stringify(f,(w,q)=>{if(typeof q==="bigint")return q.toString();if(typeof q!=="object"||q===null)return q;if($.has(q))return"[Circular]";return $.add(q),q})??""}catch{return String(f??"")}}function G$(f){let $;try{$=JSON.stringify({systemPrompt:f.systemPrompt,messages:f.messages,tools:f.tools})}catch{$=[g0(f.systemPrompt),g0(f.messages),g0(f.tools)].join(`
4
+ `)}return r1($.length)}var X$={debug:()=>{},log:()=>{},error:()=>{}};var i4=60,a4=1,t4=3600;function H$(f){return typeof f==="number"&&Number.isFinite(f)}function R$(f){return Math.min(Math.max(f,1),3600)}function e4(f){if(!H$(f))return 60;return R$(f)}function fw(f,$,w){let q=w?` (${w})`:"",Z=Math.round($/100)/10;return`MCP request to "${f}"${q} timed out after ${Z}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function J$(f){if(f instanceof Error)return f.message;return String(f)}function K$(f){if(f&&typeof f==="object"&&"code"in f&&typeof f.code==="string")return f.code;return""}class c extends Error{constructor(f,$){super(`${f} at position ${$}`);this.position=$}}function s1(f){return/^[0-9A-Fa-f]$/.test(f)}function h(f){return f>="0"&&f<="9"}function i1(f){return f>=" "}function t(f){return`,:[]/{}()
5
+ +`.includes(f)}function n0(f){return f>="a"&&f<="z"||f>="A"&&f<="Z"||f==="_"||f==="$"}function W0(f){return f>="a"&&f<="z"||f>="A"&&f<="Z"||f==="_"||f==="$"||f>="0"&&f<="9"}var v0=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,h0=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function x0(f){return`,[]/{}
6
+ +`.includes(f)}function z0(f){return e(f)||_$.test(f)}var _$=/^[[{\w-]$/;function c0(f){return f===`
7
+ `||f==="\r"||f==="\t"||f==="\b"||f==="\f"}function v(f,$){let w=f.charCodeAt($);return w===32||w===10||w===9||w===13}function a1(f,$){let w=f.charCodeAt($);return w===32||w===9||w===13}function t1(f,$){let w=f.charCodeAt($);return w===160||w===6158||w>=8192&&w<=8203||w===8239||w===8287||w===12288||w===65279}function e(f){return o0(f)||A0(f)}function o0(f){return f==='"'||f==="“"||f==="”"}function u0(f){return f==='"'}function A0(f){return f==="'"||f==="‘"||f==="’"||f==="`"||f==="´"}function d0(f){return f==="'"}function f0(f,$){let w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,q=f.lastIndexOf($);return q!==-1?f.substring(0,q)+(w?"":f.substring(q+1)):f}function E(f,$){let w=f.length;if(!v(f,w-1))return f+$;while(v(f,w-1))w--;return f.substring(0,w)+$+f.substring(w)}function e1(f,$,w){return f.substring(0,$)+f.substring($+w)}function ff(f){return/[,\n][ \t\r]*$/.test(f)}var Q$={"&quot;":'"',"&amp;":"&","&lt;":"<","&gt;":">","&apos;":"'"},l0=12;function m0(f){if(f.charAt(0)!=="&")return null;let $=f.indexOf(";");if($===-1)return null;let w=f.substring(0,$+1),q=Q$[w];if(q!==void 0)return{char:q,length:w.length};if(f.charAt(1)==="#"){let Z=f.substring(2,$),H=Z.charAt(0)==="x"||Z.charAt(0)==="X",R=H?Z.substring(1):Z;if(R.length>0){let J=Number.parseInt(R,H?16:10);if(!Number.isNaN(J)&&J>=0&&J<=1114111)return{char:String.fromCodePoint(J),length:w.length}}}return null}function $f(f){return f!==null&&f.char==='"'}function wf(f){return f!==null&&f.char==="'"}function a(f,$){let w=0;for(let q=0;q<f.length;q++)if(f.charAt(q)===$)w++;return w}function Yf(f,$){switch($){case")":return a(f,"(")>a(f,")");case"]":return a(f,"[")>a(f,"]");case"}":return a(f,"{")>a(f,"}");default:return!1}}var qf={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},j$={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
8
+ `,r:"\r",t:"\t"};function p0(f){let $=0,w="";if(V(["```","[```","{```"]),!H())sf();V(["```","```]","```}"]);let Z=j(",");if(Z)R();if(z0(f[$])&&ff(w)){if(!Z)w=E(w,",");m()}else if(Z)w=f0(w,",");while(f[$]==="}"||f[$]==="]")$++,R();if($>=f.length)return w;I0();function H(){R();let _=b()||P0()||p()||P()||lf()||X1(!1)||mf();return R(),_}function R(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,Q=$,L=J(_);do if(L=k(),L)L=J(_);while(L);return $>Q}function J(_){let Q=_?v:a1,L="";while(!0)if(Q(f,$))L+=f[$],$++;else if(t1(f,$))L+=" ",$++;else break;if(L.length>0)return w+=L,!0;return!1}function k(){if(f[$]==="/"&&f[$+1]==="*"){while($<f.length&&!V$(f,$))$++;return $+=2,!0}if(f[$]==="/"&&f[$+1]==="/"){while($<f.length&&f[$]!==`
9
+ `)$++;return!0}return!1}function V(_){if(A(_)){if(n0(f[$]))while($<f.length&&W0(f[$]))$++;return R(),!0}return!1}function A(_){J(!0);for(let Q of _){let L=$+Q.length;if(f.slice($,L)===Q)return $=L,!0}return!1}function j(_){if(f[$]===_)return w+=f[$],$++,!0;return!1}function B(_){if(f[$]===_)return $++,!0;return!1}function O(){return B("\\")}function C(){if(R(),f[$]==="."&&f[$+1]==="."&&f[$+2]===".")return $+=3,R(),B(","),!0;return!1}function b(){if(f[$]==="{"){if(w+="{",$++,R(),B(","))R();let _=!0;while($<f.length&&f[$]!=="}"){let Q;if(!_){if(Q=j(","),!Q)w=E(w,",");R()}else Q=!0;if(C(),!(p()||X1(!0))){if(f[$]==="}"||f[$]==="{"||f[$]==="]"||f[$]==="["||f[$]===void 0){if(!_)w=f0(w,",")}else af();break}R();let S=j(":"),s=$>=f.length;if(!S)if(z0(f[$])||s)w=E(w,":");else J1();if(!H())if(S||s)w+="null";else J1();_=!1}if(f[$]==="}")w+="}",$++;else w=E(w,"}");return!0}return!1}function P0(){if(f[$]==="["){if(w+="[",$++,R(),B(","))R();let _=!0;while($<f.length&&f[$]!=="]"){if(!_){if(!j(","))w=E(w,",")}if(C(),!H()){if(!_)w=f0(w,",");break}_=!1}if(f[$]==="]")w+="]",$++;else w=E(w,"]");return!0}return!1}function m(){let _=!0,Q=!0;while(Q){if(!_){if(!j(","))w=E(w,",")}else _=!1;Q=H()}if(!Q)w=f0(w,",");w=`[
10
+ ${w}
11
+ ]`}function p(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,L=f[$]==="\\";if(L){if($++,!e(f[$]))I0()}let S=f[$]==="&"?m0(f.slice($,$+l0)):null,s=$f(S)||wf(S);if(e(f[$])||s){let K1=u0(f[$])?u0:d0(f[$])?d0:A0(f[$])?A0:o0,J0=$,K0=w.length,D='"';$+=s&&S?S.length:1;while(!0){if($>=f.length){let I=H1($-1);if(!_&&t(f.charAt(I)))return $=J0,w=w.substring(0,K0),p(!0);return D=E(D,'"'),w+=D,!0}if($===Q)return D=E(D,'"'),w+=D,!0;let g=s&&f[$]==="&"?m0(f.slice($,$+l0)):null;if(g&&S?g.char===S.char:K1(f[$])){let I=$,B0=D.length;if(D+='"',$+=g?g.length:1,w+=D,R(!1),_||$>=f.length||t(f[$])&&!Yf(D,f[$])||e(f[$])&&!pf($)||h(f[$]))return G1(),!0;if(f[$]==="\\")I0();let x=H1(I-1),_1=f.charAt(x);if(_1===",")return $=J0,w=w.substring(0,K0),p(!1,x);if(t(_1))return $=J0,w=w.substring(0,K0),p(!0);w=w.substring(0,K0),$=I+(g?g.length:1),D=`${D.substring(0,B0)}\\${D.substring(B0)}`}else if(_&&x0(f[$])){if(f[$-1]===":"&&v0.test(f.substring(J0+1,$+2)))while($<f.length&&h0.test(f[$]))D+=f[$],$++;return D=E(D,'"'),w+=D,G1(),!0}else if(g){let I=g.char;if(I==='"')D+="\\\"";else if(c0(I))D+=qf[I];else D+=I;$+=g.length}else if(f[$]==="\\"){let I=f.charAt($+1);if(j$[I]!==void 0)D+=f.slice($,$+2),$+=2;else if(I==="u"){let x=2;while(x<6&&s1(f[$+x]))x++;if(x===6)D+=f.slice($,$+6),$+=6;else if($+x>=f.length)$=f.length;else tf()}else if(I===`
12
+ `)D+="\\n",$+=2;else D+=I,$+=2}else{let I=f.charAt($);if(I==='"'&&f[$-1]!=="\\")D+=`\\${I}`,$++;else if(c0(I))D+=qf[I],$++;else{if(!i1(I))rf(I);D+=I,$++}}if(L)O()}}return!1}function G1(){let _=!1;R();while(f[$]==="+"){_=!0,$++,R(),w=f0(w,'"',!0);let Q=w.length;if(p())w=e1(w,Q,1);else w=E(w,'"')}return _}function P(){let _=$,Q="",L=!1;if(f[$]==="-"){if(Q+=f[$],$++,!h(f[$])&&R1())Q+="0"}if(f[$]==="0"&&h(f[$+1]))L=!0;while(h(f[$]))Q+=f[$],$++;if(f[$]==="."){if(Q===""||Q==="-")Q+="0";if(Q+=f[$],$++,!h(f[$]))Q+="0";while(h(f[$]))Q+=f[$],$++}if($>_){if(f[$]==="e"||f[$]==="E"){if(Q==="-")L=!0;if(Q+=f[$],$++,f[$]==="-"||f[$]==="+")Q+=f[$],$++;if(!h(f[$]))Q+="0";while(h(f[$]))Q+=f[$],$++}if(!R1())return $=_,!1;return w+=L?`"${f.substring(_,$)}"`:Q,!0}return!1}function lf(){return r("true","true")||r("false","false")||r("null","null")||r("True","true")||r("False","false")||r("None","null")}function r(_,Q){if(f.slice($,$+_.length)===_&&!W0(f[$+_.length]))return w+=Q,$+=_.length,!0;return!1}function X1(_){let Q=$;if(n0(f[$])){while($<f.length&&W0(f[$]))$++;let L=$;while(v(f,L))L++;if(f[L]==="("){if($=L+1,H(),f[$]===")"){if($++,f[$]===";")$++}return!0}}while($<f.length&&!x0(f[$])&&!e(f[$])&&(!_||f[$]!==":"))$++;if(f[$-1]===":"&&v0.test(f.substring(Q,$+2)))while($<f.length&&h0.test(f[$]))$++;if($>Q){while(v(f,$-1)&&$>0)$--;let L=f.slice(Q,$);if(w+=L==="undefined"?"null":JSON.stringify(L),f[$]==='"')$++;return!0}}function mf(){if(f[$]==="/"){let _=$;$++;while($<f.length&&(f[$]!=="/"||f[$-1]==="\\"))$++;return $++,w+=JSON.stringify(f.substring(_,$)),!0}}function H1(_){let Q=_;while(Q>0&&v(f,Q))Q--;return Q}function pf(_){let Q=_+1;while(Q<f.length&&v(f,Q))Q++;return Q>=f.length||t(f[Q])}function R1(){return $>=f.length||t(f[$])||v(f,$)}function rf(_){throw new c(`Invalid character ${JSON.stringify(_)}`,$)}function I0(){throw new c(`Unexpected character ${JSON.stringify(f[$])}`,$)}function sf(){throw new c("Unexpected end of json string",f.length)}function af(){throw new c("Object key expected",$)}function J1(){throw new c("Colon expected",$)}function tf(){let _=f.slice($,$+6);throw new c(`Invalid unicode character "${_}"`,$)}}function V$(f,$){return f[$]==="*"&&f[$+1]==="/"}var k$=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function F$(f){let $=f.match(k$);if(!$)return;let[,w,q]=$,Z=q.trim();if(!Z)return;let H=Z[0];if(H==='"'||H==="{"||H==="["||Z==="true"||Z==="false"||Z==="null"||Number.isFinite(Number(Z)))return;return JSON.parse(`{"${w}":${JSON.stringify(Z)}}`)}var L$=[(f)=>JSON.parse(f),(f)=>JSON.parse(p0(f)),F$];function W$(f){if(typeof f!=="string")return f;let $=f.trimStart();if($[0]!=="{"&&$[0]!=="[")return f;for(let w of L$)try{let q=w($);if(q!==void 0)return q}catch{}return f}function A$(f){let $=new WeakSet;try{return JSON.stringify(f,(q,Z)=>{if(typeof Z==="bigint")return Z.toString();if(Z&&typeof Z==="object"){if($.has(Z))return"[Circular]";$.add(Z)}return Z})??"null"}catch{return String(f)}}function D$(f){try{return JSON.parse(f)}catch{return}}function $0(f){return typeof f==="object"&&f!==null&&!Array.isArray(f)}function U$(f){let $=f.type;if(typeof $==="string")return[$];return Array.isArray($)?$.filter((w)=>typeof w==="string"):[]}function r0(f,$){if(U$(f).includes($))return!0;for(let q of["anyOf","oneOf","allOf"]){let Z=f[q];if(Array.isArray(Z)&&Z.some((H)=>$0(H)&&r0(H,$)))return!0}return!1}function P$(f,$){if(typeof f!=="string")return f;let w=f.trim(),q=r0($,"array"),Z=r0($,"object");if((!q||!w.startsWith("["))&&(!Z||!w.startsWith("{")))return f;try{let H=JSON.parse(w);if(Array.isArray(H))return q?H:f;if($0(H))return Z?H:f;return f}catch{return f}}function s0(f,$){let w=P$(f,$);if(Array.isArray(w)){let R=$.items;if(!$0(R))return w;let J=!1,k=w.map((V)=>{let A=s0(V,R);return J||=A!==V,A});return J?k:w}if(!$0(w))return w;let q=$.properties;if(!$0(q))return w;let Z=!1,H={...w};for(let[R,J]of Object.entries(q)){if(!(R in w)||!$0(J))continue;let k=s0(w[R],J);if(k!==w[R])H[R]=k,Z=!0}return Z?H:w}function I$(f){if(typeof globalThis.atob==="function")try{let $=globalThis.atob(f),w=Uint8Array.from($,(q)=>q.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 B$(f){let $=f?.trim();if(!$)return null;try{let w=$.split(".");if(w.length!==3)return null;let q=w[1];if(!q)return null;let Z=q.replace(/-/g,"+").replace(/_/g,"/"),H=Z.padEnd(Z.length+(4-Z.length%4)%4,"="),R=I$(H);return R?JSON.parse(R):null}catch{return null}}function M$(f){return Object.fromEntries(Object.entries(f).filter(([,$])=>$!==void 0))}function E$(f){let $=f.replaceAll("\\","/"),w=$.lastIndexOf("/");return(w>=0?$.slice(w+1):$).toLowerCase()}function O$(f){return f==="win32"?"powershell":"/bin/bash"}function i0(f){let $=E$(f);if($==="powershell"||$==="powershell.exe"||$==="pwsh"||$==="pwsh.exe")return"powershell";if($==="cmd"||$==="cmd.exe")return"cmd";if($==="wsl"||$==="wsl.exe")return"wsl";return"posix"}function Zf(f,$){switch(i0(f)){case"powershell":return{args:["-NoProfile","-NonInteractive","-Command","[Console]::InputEncoding=[Text.UTF8Encoding]::new();[Console]::OutputEncoding=[Text.UTF8Encoding]::new();$c=[Console]::In.ReadToEnd();$c+=[Environment]::NewLine+'if(-not $?){exit 1}';& ([ScriptBlock]::Create($c))"],input:$};case"cmd":return{args:["/d","/s","/c",$]};case"wsl":return{args:["bash","-c",$]};case"posix":return{args:["-c",$]}}}function b$(f,$){if(i0(f)==="powershell")return["-NoProfile","-NonInteractive","-Command",$];return Zf(f,$).args}function N$(f){return f.toLowerCase().replace(/[^\w.-]+/g,"_")}function T$(f){let $=f?.trim();return $?$:void 0}function Gf(f,$){if(f.length<=$)return f;return`${f.slice(0,$-1)}…`}function y$(f,$="/",w=100){if(!f||f.length<=w)return f||"";let q=f.split($)?.shift()?.trim()?.slice(0,w-1);return q?`${q}…`:Gf(f,w)}function C$(f){if(f.length<=8)return"****";return`${f.slice(0,4)}...${f.slice(-4)}`}function S$(f){return f.charCodeAt(0)===65279?f.slice(1):f}function g$(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 n$(f){let $=Math.max(0,Math.floor(f/1000)),w=Math.floor($/86400),q=Math.floor($%86400/3600),Z=Math.floor($%3600/60),H=$%60;if(w>0)return`${w}d ${q}h`;if(q>0)return`${q}h ${Z}m`;if(Z>0)return`${Z}m ${H}s`;return`${H}s`}import{z as Xf}from"zod";function v$(f,$){let w=f.safeParse($);if(!w.success)throw Error(Xf.prettifyError(w.error));return w.data}function a0(f){return Xf.toJSONSchema(f)}function t0(f){return f==="cline"||f==="cline-pass"}var Hf=`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.
13
13
 
14
14
  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.
15
15
  Review each question carefully and answer it with detailed, accurate information.
@@ -44,7 +44,7 @@ When you have completed the task, please provide a summary of what you did and a
44
44
 
45
45
  If user asked a simple question without any coding context, answer it directly without using any tools.
46
46
  {{CLINE_RULES}}
47
- {{CLINE_METADATA}}`,d4=`You are Cline, a careful and helpful coding agent that works in the background.
47
+ {{CLINE_METADATA}}`,Rf=`You are Cline, a careful and helpful coding agent that works in the background.
48
48
  You are tasked to solve an issue reported by the user who you cannot communicate with directly.
49
49
  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.
50
50
 
@@ -74,9 +74,9 @@ IMPORTANT:
74
74
  - Always includes tool calls in your response until the task is completed. You should only end the task when all the requirements are met by calling the 'submit_and_exit' tool.
75
75
  - Response without the submit_and_exit tool call will considered not completed and the task will continue.
76
76
  {{CLINE_RULES}}
77
- {{CLINE_METADATA}}`;var zn="# Workspace Configuration",E4=`# Plan / Act Modes
77
+ {{CLINE_METADATA}}`;var e0="# Workspace Configuration",Kf=`# Plan / Act Modes
78
78
 
79
- 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.`,A4=`# Plan Mode
79
+ 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.`,_f=`# Plan Mode
80
80
 
81
81
  You are in Plan mode. Your role is to explore, analyze, and plan -- not to execute.
82
82
 
@@ -87,12 +87,14 @@ You are in Plan mode. Your role is to explore, analyze, and plan -- not to execu
87
87
  - Do NOT edit files, write code, run destructive commands, or make any changes
88
88
  - Do NOT implement anything -- focus on understanding and alignment first
89
89
 
90
- 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.). If the task requires a mutation, put it in the plan; it happens only after the user switches to act mode.
90
+ 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.`,Qf=`${_f}
91
91
 
92
- 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.`;function R4(n,f,_){if(_?.trim()?.includes(zn))return _.trim();let B=_||JSON.stringify({workspaces:{[n]:{hint:f||n.split("/").at(-1)||n}}},null,2);return`
93
- ${zn}
94
- ${B}`}function W_(n){let{ide:f="Terminal Shell",mode:_,platform:B="unknown",workspaceName:d,metadata:I,rules:A,overridePrompt:$,providerId:y}=n,Y=n.workspaceRoot??n.rootPath??"",X=rn(y||"");if($?.trim()){let T=$.trim();if(X&&I?.trim()&&!T.includes(zn))return`${T}
92
+ 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.`,jf=`${_f}
95
93
 
96
- ${R4(Y,d,I)}`.trim();return T}let V=_==="yolo"?d4:B4,o=[A,E4,_==="plan"?A4:void 0].filter(Boolean).join(`
94
+ 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 Jf(f,$,w){if(w?.trim()?.includes(e0))return w.trim();let q=w||JSON.stringify({workspaces:{[f]:{hint:$||f.split("/").at(-1)||f}}},null,2);return`
95
+ ${e0}
96
+ ${q}`}function h$(f){let{ide:$="Terminal Shell",mode:w,platform:q="unknown",workspaceName:Z,metadata:H,rules:R,overridePrompt:J,providerId:k,planModeSwitchTool:V=!0}=f,A=f.workspaceRoot??f.rootPath??"",j=t0(k||"");if(J?.trim()){let C=J.trim();if(j&&H?.trim()&&!C.includes(e0))return`${C}
97
97
 
98
- `);return V.replace("{{PLATFORM_NAME}}",B).replace("{{CWD}}",Y).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",f).replace("{{CLINE_METADATA}}",X?R4(Y,d,I):"").replace("{{CLINE_RULES}}",o).trim()}var O_="anthropic/claude-sonnet-5";var g_="remote://";import{z as R}from"zod";var I4=R.object({id:R.string(),temperature:R.number().optional(),maxTokens:R.number().optional(),contextWindow:R.number().optional(),inputPrice:R.number().optional(),outputPrice:R.number().optional(),supportsImages:R.boolean().optional()}),$4=R.object({models:R.array(I4).optional(),openAiBaseUrl:R.string().optional(),openAiHeaders:R.record(R.string(),R.string()).optional(),azureApiVersion:R.string().optional(),azureIdentity:R.boolean().optional()}),D4=R.object({id:R.string(),thinkingBudgetTokens:R.number().optional()}),Y4=R.object({name:R.string(),baseModelId:R.string(),thinkingBudgetTokens:R.number().optional()}),M4=R.object({models:R.array(D4).optional(),customModels:R.array(Y4).optional(),awsRegion:R.string().optional(),awsUseCrossRegionInference:R.boolean().optional(),awsUseGlobalInference:R.boolean().optional(),awsBedrockUsePromptCache:R.boolean().optional(),awsBedrockEndpoint:R.string().optional()}),G4=R.object({id:R.string()}),y4=R.object({models:R.array(G4).optional()}),X4=R.object({id:R.string(),thinkingBudgetTokens:R.number().optional()}),b4=R.object({models:R.array(X4).optional(),vertexProjectId:R.string().optional(),vertexRegion:R.string().optional()}),q4=R.object({id:R.string(),thinkingBudgetTokens:R.number().optional(),promptCachingEnabled:R.boolean().optional()}),k4=R.object({models:R.array(q4).optional(),baseUrl:R.string().optional()}),Z4=R.object({id:R.string(),thinkingBudgetTokens:R.number().optional()}),H4=R.object({models:R.array(Z4).optional(),baseUrl:R.string().optional()}),N_=R.object({OpenAiCompatible:$4.optional(),AwsBedrock:M4.optional(),Cline:y4.optional(),Vertex:b4.optional(),LiteLLM:k4.optional(),Anthropic:H4.optional()}),L4=R.object({id:R.string()}),J4=R.object({name:R.string(),url:R.string(),alwaysEnabled:R.boolean().optional(),headers:R.record(R.string(),R.string()).optional()}),pn=R.object({alwaysEnabled:R.boolean(),name:R.string(),contents:R.string()}),bn=R.object({bucket:R.string(),accessKeyId:R.string(),secretAccessKey:R.string(),region:R.string().optional(),endpoint:R.string().optional(),accountId:R.string().optional()}),T4=R.object({enabled:R.boolean().optional(),type:R.union([R.literal("s3_access_keys"),R.literal("r2_access_keys"),R.literal("azure_access_keys")]).optional(),s3AccessSettings:bn.optional(),r2AccessSettings:bn.optional(),azureAccessSettings:bn.optional()}),V4=R.object({promptUploading:T4.optional()}),C_=R.object({version:R.string(),providerSettings:N_.optional(),telemetryEnabled:R.boolean().optional(),kanbanEnabled:R.boolean().optional(),mcpMarketplaceEnabled:R.boolean().optional(),allowedMCPServers:R.array(L4).optional(),remoteMCPServers:R.array(J4).optional(),blockPersonalRemoteMCPServers:R.boolean().optional(),yoloModeAllowed:R.boolean().optional(),openTelemetryEnabled:R.boolean().optional(),openTelemetryMetricsExporter:R.string().optional(),openTelemetryLogsExporter:R.string().optional(),openTelemetryOtlpProtocol:R.string().optional(),openTelemetryOtlpEndpoint:R.string().optional(),openTelemetryOtlpHeaders:R.record(R.string(),R.string()).optional(),openTelemetryOtlpMetricsProtocol:R.string().optional(),openTelemetryOtlpMetricsEndpoint:R.string().optional(),openTelemetryOtlpMetricsHeaders:R.record(R.string(),R.string()).optional(),openTelemetryOtlpLogsProtocol:R.string().optional(),openTelemetryOtlpLogsEndpoint:R.string().optional(),openTelemetryOtlpLogsHeaders:R.record(R.string(),R.string()).optional(),openTelemetryMetricExportInterval:R.number().optional(),openTelemetryOtlpInsecure:R.boolean().optional(),openTelemetryLogBatchSize:R.number().optional(),openTelemetryLogBatchTimeout:R.number().optional(),openTelemetryLogMaxQueueSize:R.number().optional(),enterpriseTelemetry:V4.optional(),globalRules:R.array(pn).optional(),globalWorkflows:R.array(pn).optional()}),S_=R.record(R.string(),R.string());var c_=4317;var v_="127.0.0.1:4317";import an from"zod";var h_=an.enum(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),u_=an.enum(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),m_=an.enum(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var x_="runtime.team.progress.v1",l_="runtime.team.lifecycle.v1";var s_="CLINE_ENVIRONMENT",r_="CLINE_ENVIRONMENT_OVERRIDE",en={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"}},z_="production";function o4(n){let f=n?.trim().toLowerCase();if(f==="production"||f==="staging"||f==="local")return f;return}function K4(){if(typeof process>"u"||!process?.env)return{};return process.env}function U4(){let n=K4();return o4(n.CLINE_ENVIRONMENT_OVERRIDE)??o4(n.CLINE_ENVIRONMENT)??"production"}function p_(n){if(typeof n==="string")return en[n];return en[U4()]}function i_(n,f){if(f.CLINE_API_BASE_URL)n={...n,apiBaseUrl:f.CLINE_API_BASE_URL,mcpBaseUrl:`${f.CLINE_API_BASE_URL}/v1/mcp`};return n}function a_(n){let f=p_(n);return i_(f,K4())}var e_="agent.reasoning.unexpected_tokens",t_="task.provider_request_started",n0="task.provider_stream_started",f0="task.first_chunk_received",_0="task.provider_stream_failed",w0="task.cancelled",B0="sdk.error";function d0(n,f){n?.capture({event:"agent.reasoning.unexpected_tokens",properties:Q4({sessionId:f.sessionId,agentId:f.agentId,runId:f.runId,iteration:f.iteration,providerId:f.providerId,modelId:f.modelId,requestedThinking:f.requestedThinking,reasoningTokenCount:f.reasoningTokenCount})})}function R0(n,f){if(!n)return;n.capture({event:f.event,properties:Q4({sessionId:f.sessionId,ulid:f.ulid??f.sessionId,agentId:f.agentId,conversationId:f.conversationId,runId:f.runId,iteration:f.iteration,provider:f.providerId,providerId:f.providerId,model:f.modelId,modelId:f.modelId,phase:f.phase,durationMs:f.durationMs,eventType:f.eventType,...f.error===void 0?{}:nf(f.error,f.messageLimit)})})}function E0(n,f){if(!n)return;n.capture({event:f.event??"sdk.error",properties:F4(f)})}function F4(n){return{...n.context??{},component:n.component,operation:n.operation,severity:n.severity??"error",handled:n.handled??!0,...nf(n.error,n.messageLimit,n.errorMessage)}}function Q4(n){let f={};for(let[_,B]of Object.entries(n))if(B!==void 0)f[_]=B;return f}function nf(n,f=500,_){let B=$0(n)?n:void 0,d=n instanceof Error?n:void 0,I=Bn(_)??Bn(d?.message)??Bn(B?.message)??D0(n)??"Unknown error",A=Y0(B?.code),$=tn(B?.status)??tn(B?.statusCode)??tn(B?.responseStatus);return{error_type:d?.name?.trim()||Bn(B?.name)||d?.constructor?.name||"Error",error_message:I0(A0(I),f),...A!==void 0?{error_code:A}:{},...$!==void 0?{error_status:$}:{}}}function A0(n){return n.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 I0(n,f){let _=Math.max(1,Math.floor(f));return n.length>_?n.substring(0,_):n}function $0(n){return typeof n==="object"&&n!==null}function Bn(n){return typeof n==="string"&&n.trim().length>0?n:void 0}function D0(n){if(n instanceof Error)return;let f=typeof n==="string"?n:String(n);return f==="[object Object]"?void 0:Bn(f)}function Y0(n){if(typeof n==="string"&&n.trim().length>0)return n;if(typeof n==="number"&&Number.isFinite(n))return n;return}function tn(n){return typeof n==="number"&&Number.isFinite(n)?n:void 0}function j4(n){let f={};if(!n)return f;return n.split(",").forEach((_)=>{let B=_.indexOf("=");if(B<=0)return;try{let d=decodeURIComponent(_.substring(0,B).trim()),I=decodeURIComponent(_.substring(B+1).trim());if(!d||!I)return;f[d]=I}catch{}}),f}function M0(){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?j4(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function P4(n={}){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",...n}}function G0(n={}){return{...M0(),...n,metadata:P4(n.metadata)}}function W4(n){let f=n?.trim();return f?f:void 0}function y0(n,f){if(!n)return;let _=typeof n==="function"?n(f):n;if(!_)return;let B=W4(_.rootSessionId);if(!B)return;return{rootSessionId:B}}function X0(n){return W4(n?.rootSessionId)}var b0=(n)=>crypto.getRandomValues(new Uint8Array(n)),q0=(n,f,_)=>{let B=256-256%n.length;if(B===256){let I=n.length-1;return(A=f)=>{if(!A)return"";let $="";while(!0){let y=_(A),Y=A;while(Y--)if($+=n[y[Y]&I],$.length>=A)return $}}}let d=Math.ceil(409.6*f/B);return(I=f)=>{if(!I)return"";let A="";while(!0){let $=_(d),y=d;while(y--)if($[y]<B){if(A+=n[$[y]%n.length],A.length>=I)return A}}}},O4=(n,f=21)=>q0(n,f|0,b0);function k0(n="",f=""){let _=O4("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${n}${Date.now()}_${_(5)}${f}`}var Z0=["idle","running","pending","completed","failed","cancelled"];var ff=["rules","skills","workflows","plugins"],g4=ff,H0=new Set(ff);function N4(n){return typeof n==="string"&&H0.has(n)}function L0(n){if(!Array.isArray(n))return;let f=n.map((_)=>typeof _==="string"?_.trim():"").filter(N4);return[...new Set(f)]}function J0(n,f){return new Set(n??g4).has(f)}import{z as Q}from"zod";var T0=Q.object({rootPath:Q.string().min(1),hint:Q.string().min(1).optional(),associatedRemoteUrls:Q.array(Q.string().min(1)).optional(),latestGitCommitHash:Q.string().min(1).optional(),latestGitBranchName:Q.string().min(1).optional()}),V0=Q.object({currentWorkspacePath:Q.string().min(1).optional(),workspaces:Q.record(Q.string().min(1),T0)});function Sw(){return{workspaces:{}}}function cw(n,f){let _={...n,workspaces:{...n.workspaces,[f.rootPath]:f}};if(!_.currentWorkspacePath)_.currentWorkspacePath=f.rootPath;return V0.parse(_)}var o0="workspaces",K0="chat";function U0(n){let f=n.trim(),_=/^[A-Za-z]:[\\/]/.test(f)||f.startsWith("\\\\"),B=f.startsWith("/");if(!_&&!B)return!1;let d=f.split(_?/[\\/]+/:/\/+/).filter(Boolean),I=d.at(-1)??"",A=d.at(-2)??"",$=d.at(-3)??"";return(d.at(-4)??"")===".cline"&&$==="data"&&A==="workspaces"&&I==="chat"}import{z as w}from"zod";var F0=["current_state","boundary_analysis","interface_proposal"],mw=3600000,xw=240,lw=400,j=w.preprocess((n)=>n instanceof Date?n.toISOString():n,w.string().datetime()),t=w.enum(["pending","in_progress","blocked","completed"]),C4=w.enum(["queued","running","completed","failed","cancelled","interrupted"]),qn=w.enum(["draft","in_review","finalized"]),Q0=w.object({agentId:w.string(),role:w.enum(["lead","teammate"]),description:w.string().optional(),status:w.enum(["idle","running","stopped"])}),sw=w.object({agentId:w.string(),rolePrompt:w.string(),modelId:w.string().optional(),maxIterations:w.number().optional()});function H(n){return w.preprocess((f)=>f===null?void 0:f,n.optional())}var rw=w.object({agentId:w.string().min(1).describe("Teammate identifier"),rolePrompt:w.string().min(1).describe("System prompt describing teammate role")}).strict(),zw=w.object({agentId:w.string().min(1).describe("Teammate identifier"),reason:H(w.string().min(1)).describe("Optional shutdown reason")}),pw=w.object({}),j0={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},iw={create:["status","taskId","summary","reason"]},aw=w.object({action:w.enum(["create","list","claim","complete","block"]),title:H(w.string().min(1)).describe("Task title"),description:H(w.string().min(1)).describe("Task details"),dependsOn:H(w.array(w.string().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:H(w.string().min(1)).describe("Optional assignee"),status:H(w.enum(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:H(w.string()).describe("Task ID"),summary:H(w.string().min(1)).describe("Completion summary"),reason:H(w.string().min(1)).describe("Blocking reason")}).superRefine((n,f)=>{for(let _ of j0[n.action]){if(n[_]!==void 0)continue;f.addIssue({code:"custom",path:[_],message:`Field "${_}" is required when action=${n.action}`})}}),ew=w.object({agentId:w.string().describe("Teammate agent ID"),task:w.string().min(1).describe("Task instructions for the teammate"),taskId:H(w.string()).describe("Optional shared task list ID"),runMode:H(w.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:H(w.boolean()).describe("If true, continue the teammate conversation; otherwise start fresh")}),tw=w.object({status:H(w.enum(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:H(w.string().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:H(w.boolean()).describe("Include completed/failed runs (default true)")}),nB=w.object({runId:w.string().min(1).describe("Run ID"),reason:H(w.string().min(1)).describe("Optional cancellation reason")}),fB=w.object({runId:H(w.string().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),_B=w.object({toAgentId:w.string().min(1).describe("Recipient agent ID"),subject:w.string().min(1).describe("Message subject"),body:w.string().min(1).describe("Message body"),taskId:H(w.string().min(1)).describe("Optional task ID context")}),wB=w.object({subject:w.string().min(1).describe("Message subject"),body:w.string().min(1).describe("Message body"),taskId:H(w.string().min(1)).describe("Optional task ID context")}),BB=w.object({unreadOnly:H(w.boolean()).describe("Only unread messages for read action (default true)")}),dB=w.object({kind:w.enum(["progress","handoff","blocked","decision","done","error"]),summary:w.string().min(1).describe("Update summary"),taskId:H(w.string().min(1)).describe("Optional task ID context"),evidence:H(w.array(w.string().min(1))).describe("Optional evidence links/snippets"),nextAction:H(w.string().min(1)).describe("Planned next step")}),RB=w.object({}),EB=w.object({title:w.string().describe("Outcome title"),requiredSections:w.array(w.string()).default(F0).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),AB=w.object({outcomeId:w.string().describe("Outcome ID"),section:w.string().describe("Section name"),sourceRunId:H(w.string()).describe("Optional source run ID"),content:w.string().describe("Section fragment content")}),IB=w.object({fragmentId:w.string().describe("Fragment ID"),approved:w.boolean().describe("Review decision")}),$B=w.object({outcomeId:w.string().describe("Outcome ID")}),DB=w.object({}),YB=w.object({teamId:w.string(),teamName:w.string(),members:w.array(Q0),taskCounts:w.record(t,w.number()),unreadMessages:w.number(),missionLogEntries:w.number(),activeRuns:w.number(),queuedRuns:w.number(),outcomeCounts:w.record(qn,w.number())}),P0=w.object({id:w.string(),title:w.string(),description:w.string(),status:t,createdAt:j,updatedAt:j,createdBy:w.string(),assignee:w.string().optional(),dependsOn:w.array(w.string()),summary:w.string().optional(),isReady:w.boolean(),blockedBy:w.array(w.string())}),MB=w.discriminatedUnion("action",[w.object({action:w.literal("create"),taskId:w.string(),status:t,ignoredFields:w.array(w.string()).optional(),note:w.string().optional()}),w.object({action:w.literal("list"),tasks:w.array(P0)}),w.object({action:w.literal("claim"),taskId:w.string(),status:t,nextStep:w.string()}),w.object({action:w.literal("complete"),taskId:w.string(),status:t}),w.object({action:w.literal("block"),taskId:w.string(),status:t})]),GB=w.object({agentId:w.string(),mode:w.enum(["sync","async"]),status:w.enum(["dispatched","running","queued","joined"]),dispatched:w.boolean(),message:w.string(),deduped:w.boolean().optional(),runId:w.string().optional(),text:w.string().optional(),iterations:w.number().optional()}),W0=w.object({textPreview:w.string(),iterations:w.number(),finishReason:w.string(),durationMs:w.number(),usage:w.object({inputTokens:w.number(),outputTokens:w.number(),cacheReadTokens:w.number().optional(),cacheWriteTokens:w.number().optional(),totalCost:w.number().optional()})}),yB=w.object({id:w.string(),agentId:w.string(),taskId:w.string().optional(),status:C4,messagePreview:w.string(),priority:w.number(),retryCount:w.number(),maxRetries:w.number(),nextAttemptAt:j.optional(),continueConversation:w.boolean().optional(),startedAt:j,endedAt:j.optional(),leaseOwner:w.string().optional(),heartbeatAt:j.optional(),lastProgressAt:j.optional(),lastProgressMessage:w.string().optional(),currentActivity:w.string().optional(),error:w.string().optional(),resultSummary:W0.optional()}),XB=w.object({id:w.string(),teamId:w.string(),fromAgentId:w.string(),toAgentId:w.string(),subject:w.string(),body:w.string(),taskId:w.string().optional(),sentAt:j,readAt:j.optional()}),bB=w.object({id:w.string(),teamId:w.string(),title:w.string(),status:qn,requiredSections:w.array(w.string()),createdBy:w.string(),createdAt:j,finalizedAt:j.optional()}),qB=w.object({outcomeId:w.string(),status:qn,requiredSections:w.array(w.string())}),kB=w.object({agentId:w.string(),status:w.string()}),ZB=w.object({runId:w.string(),status:C4}),HB=w.object({id:w.string(),toAgentId:w.string()}),LB=w.object({delivered:w.number()}),JB=w.object({id:w.string()}),TB=w.object({status:w.string()}),VB=w.object({fragmentId:w.string(),status:w.string()}),oB=w.object({outcomeId:w.string(),status:qn});var O0;((L)=>{L.TaskStart="task_start";L.TaskEnd="task_end";L.AgentEvent="agent_event";L.TeammateSpawned="teammate_spawned";L.TeammateShutdown="teammate_shutdown";L.TeamTaskUpdated="team_task_updated";L.TeamMessage="team_message";L.TeamMissionLog="team_mission_log";L.TeamTaskCompleted="team_task_completed";L.RunStarted="run_started";L.RunQueued="run_queued";L.RunProgress="run_progress";L.RunCompleted="run_completed";L.RunFailed="run_failed";L.RunCancelled="run_cancelled";L.RunInterrupted="run_interrupted";L.OutcomeCreated="outcome_created";L.OutcomeFragmentAttached="outcome_fragment_attached";L.OutcomeFragmentReviewed="outcome_fragment_reviewed";L.OutcomeFinalized="outcome_finalized"})(O0||={});import{z as g0}from"zod";function N0(n){let{$schema:f,..._}=n;if(typeof _.type==="string")return _;if("properties"in _||"required"in _||"additionalProperties"in _)return{type:"object",..._};for(let B of["oneOf","anyOf","allOf"]){let d=_[B];if(!Array.isArray(d)||d.length===0)continue;if(B==="allOf"){if(d.some(($)=>$&&typeof $==="object"&&$.type==="object"))return{type:"object",..._};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(d.every((A)=>A&&typeof A==="object"&&A.type==="object"))return{type:"object",..._};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${B}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return _}function C0(n){let f=N0(n.inputSchema instanceof g0.ZodType?sn(n.inputSchema):n.inputSchema);return{name:n.name,description:n.description,inputSchema:f,lifecycle:n.lifecycle,timeoutMs:n.timeoutMs??30000,retryable:n.retryable??!0,maxRetries:n.maxRetries??3,execute:n.execute}}var S4=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function S0(n){let f=(n instanceof Error?n.message:String(n)).toLowerCase();return S4.some((_)=>f.includes(_))}export{sn as zodToJsonSchema,Pf as xmlTagsRemoval,P_ as validateWithZod,Cf as validateImageMedia,fn as validateAndReserveImageMedia,cw as upsertWorkspaceInfo,_4 as truncateStr,K_ as truncateSplit,o_ as trimNonEmpty,vf as toAiSdkToolResultOutput,F_ as stripUtf8Bom,jf as stripModeNotices,f6 as shouldIncludeConnectorField,t6 as serializeAbortReason,F as sanitizeSurrogates,V_ as sanitizeFileName,y_ as safeJsonStringify,X_ as safeJsonParse,X0 as resolveRootSessionId,uf as resolveReasoningEffortRatio,e6 as resolveReasoningBudgetFromRatio,Of as resolveMediaBudget,l1 as resolveMcpTimeoutSeconds,Z1 as resolveHubCommandTimeoutMs,y0 as resolveHookSessionContext,a6 as resolveEffectiveReasoningEffort,U4 as resolveClineEnvironment,nn as reserveImageMediaBytes,q1 as readHubScheduleMode,Ff as parseUserCommandEnvelope,L0 as parseRuntimeConfigExtensions,G_ as parseJsonStream,L6 as parseHookEventPayload,H_ as omitUndefinedValues,Qf as normalizeUserInput,nf as normalizeSdkError,Tf as normalizePluginManifest,xn as normalizeJsonLikeStringsForSchema,__ as noopBasicLogger,p6 as mergeModelOptions,U_ as maskSecret,kf as listConnectorCatalog,N4 as isRuntimeConfigExtensionKind,w_ as isMcpTimeoutConfigured,S0 as isLikelyAuthError,H1 as isHubToolExecutorName,J6 as isHubScheduleMode,y1 as isHubProtocolCompatible,rn as isClineProvider,U0 as isChatWorkspacePath,v6 as isCanonicalBase64,gf as isBase64Char,c6 as imageFileMaxDecodedBytesForBase64Limit,on as imageBase64LengthForDecodedBytes,S6 as imageBase64EncodedByteLength,Wf as imageBase64DecodedByteLength,J0 as hasRuntimeConfigExtension,ln as getShellKind,f4 as getShellInvocation,T_ as getShellArgs,d_ as getErrorMessage,R_ as getErrorCode,J_ as getDefaultShell,V6 as getDefaultHubCommandTimeoutMs,a_ as getClineEnvironmentConfig,U6 as formatUserInputBlock,F6 as formatUserCommandBlock,j_ as formatUptime,Q6 as formatModeSwitchNotice,z6 as formatMessagesForAiSdk,s1 as formatMcpTimeoutErrorMessage,Q_ as formatHumanReadableDate,Vn as formatFileContentBlock,g6 as formatDisplayUserInput,mf as estimateTokens,f_ as estimateRequestInputTokens,Sw as emptyWorkspaceManifest,Z_ as decodeJwtPayload,C0 as createTool,k0 as createSessionId,j6 as createModeSwitchNoticeTracker,Gn as createMediaBudgetState,$6 as createContributionRegistry,P4 as createClineTelemetryServiceMetadata,G0 as createClineTelemetryServiceConfig,_6 as connectorChannelsFromPlatforms,B_ as clampMcpTimeoutSeconds,R0 as captureTaskLifecycleEvent,E0 as captureSdkError,d0 as captureAgentUnexpectedReasoningTokens,F4 as buildSdkErrorProperties,W_ as buildClineSystemPrompt,V0 as WorkspaceManifestSchema,T0 as WorkspaceInfoSchema,b4 as VertexSettingsSchema,X4 as VertexModelSchema,g1 as USAGE_COST_DISPLAYS,Jn as ToolCallRecordSchema,Mf as ThinkingConfigSchema,sw as TeamTeammateSpecSchema,MB as TeamTaskToolResultSchema,P0 as TeamTaskListItemToolResultSchema,aw as TeamTaskInputSchema,YB as TeamStatusToolResultSchema,pw as TeamStatusInputSchema,rw as TeamSpawnTeammateInputSchema,kB as TeamSimpleAgentStatusToolResultSchema,zw as TeamShutdownTeammateInputSchema,HB as TeamSendMessageToolResultSchema,_B as TeamSendMessageInputSchema,yB as TeamRunToolSummarySchema,GB as TeamRunTaskToolResultSchema,ew as TeamRunTaskInputSchema,W0 as TeamRunResultSummarySchema,IB as TeamReviewOutcomeFragmentInputSchema,BB as TeamReadMailboxInputSchema,bB as TeamOutcomeToolResultSchema,VB as TeamOutcomeFragmentToolResultSchema,JB as TeamMissionLogToolResultSchema,dB as TeamMissionLogInputSchema,O0 as TeamMessageType,XB as TeamMailboxMessageToolResultSchema,tw as TeamListRunsInputSchema,DB as TeamListOutcomesInputSchema,oB as TeamFinalizeOutcomeToolResultSchema,$B as TeamFinalizeOutcomeInputSchema,qB as TeamCreateOutcomeToolResultSchema,EB as TeamCreateOutcomeInputSchema,TB as TeamCleanupToolResultSchema,RB as TeamCleanupInputSchema,ZB as TeamCancelRunToolResultSchema,nB as TeamCancelRunInputSchema,LB as TeamBroadcastToolResultSchema,wB as TeamBroadcastInputSchema,fB as TeamAwaitRunsInputSchema,AB as TeamAttachOutcomeFragmentInputSchema,iw as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,lw as TEAM_RUN_TEXT_PREVIEW_LIMIT,xw as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,x_ as TEAM_PROGRESS_EVENT_TYPE,l_ as TEAM_LIFECYCLE_EVENT_TYPE,mw as TEAM_AWAIT_TIMEOUT_MS,n0 as TASK_PROVIDER_STREAM_STARTED_EVENT,_0 as TASK_PROVIDER_STREAM_FAILED_EVENT,t_ as TASK_PROVIDER_REQUEST_STARTED_EVENT,f0 as TASK_FIRST_CHUNK_RECEIVED_EVENT,w0 as TASK_CANCELLED_EVENT,Mn as SUPPORTED_IMAGE_MEDIA_TYPES,Z0 as SESSION_STATUS_VALUES,B0 as SDK_ERROR_TELEMETRY_EVENT,bn as S3AccessKeySettingsSchema,J4 as RemoteMCPServerSchema,C_ as RemoteConfigSchema,Hn as ReasoningLevelSchema,In as ReasoningEffortSchema,ff as RUNTIME_CONFIG_EXTENSION_KINDS,g_ as REMOTE_URI_SCHEME,An as REASONING_LEVELS,wn as REASONING_EFFORT_RATIOS,u_ as ProviderProtocolSchema,m_ as ProviderClientSchema,h_ as ProviderCapabilitySchema,T4 as PromptUploadingSchema,D6 as PLUGIN_FILE_EXTENSIONS,A4 as PLAN_MODE_INSTRUCTIONS,$4 as OpenAiCompatibleSchema,I4 as OpenAiCompatibleModelSchema,b1 as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,X1 as ONE_TIME_SCHEDULE_CRON_PATTERN,Df as ModelStatusSchema,Ln as ModelReasoningOptionSchema,Yf as ModelPricingSchema,Gf as ModelMetadataSchema,$n as ModelInfoSchema,$f as ModelCapabilitySchema,E4 as MODE_TAG_INSTRUCTIONS,m1 as MIN_MCP_TIMEOUT_SECONDS,Y1 as MIN_CLIENT_HUB_PROTOCOL_VERSION,x1 as MAX_MCP_TIMEOUT_SECONDS,M1 as MAX_CLIENT_HUB_PROTOCOL_VERSION,k4 as LiteLLMSchema,q4 as LiteLLMModelSchema,h as IMAGE_OMITTED_PLACEHOLDER,Kf as HookEventPayloadSchema,of as HookEventNameSchema,U1 as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,o6 as HUB_TOOL_EXECUTOR_NAMES,L1 as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,Uf as HUB_SCHEDULE_MODES,K1 as HUB_MISTAKE_LIMIT_CAPABILITY,T1 as HUB_HOOK_CAPABILITY_PREFIX,T6 as HUB_DEFAULT_COMMAND_TIMEOUT_MS,J1 as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,V1 as HUB_COMPACTION_CAPABILITY,k1 as HUB_COMMAND_SLOW_LOG_MS,o1 as HUB_CHECKPOINT_CAPABILITY,G1 as HUB_CAPABILITIES,pn as GlobalInstructionsFileSchema,Y6 as FeatureFlagDefaultValue,M6 as FEATURE_FLAGS,V4 as EnterpriseTelemetrySchema,Kn as EMPTY_CONTENT_TEXT,g4 as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,i6 as DEFAULT_REASONING_EFFORT,F0 as DEFAULT_OUTCOME_REQUIRED_SECTIONS,u1 as DEFAULT_MCP_TIMEOUT_SECONDS,C6 as DEFAULT_MAX_TOTAL_MEDIA_BYTES,S as DEFAULT_MAX_IMAGE_ENCODED_BYTES,u as DEFAULT_MAX_IMAGE_DECODED_BYTES,N6 as DEFAULT_MAX_IMAGE_BASE64_BYTES,z_ as DEFAULT_CLINE_ENVIRONMENT,Tn as ContributionRegistry,n6 as ConnectorHookEventSchema,yf as ConnectorHookEventNameSchema,bf as ConnectorEventContextSchema,Xf as ConnectorEventActorSchema,e4 as ConnectorAuthorizationRequestSchema,t4 as ConnectorAuthorizationDecisionSchema,y4 as ClineSettingsSchema,G4 as ClineModelSchema,D1 as CURRENT_HUB_PROTOCOL_VERSION,Zf as CONNECTOR_PLATFORMS,qf as CONNECTOR_CATALOG,o0 as CLINE_WORKSPACES_DIRECTORY_NAME,r_ as CLINE_ENVIRONMENT_OVERRIDE_ENV,s_ as CLINE_ENVIRONMENT_ENV,en as CLINE_ENVIRONMENTS,c_ as CLINE_DEFAULT_RPC_PORT,v_ as CLINE_DEFAULT_RPC_ADDRESS,O_ as CLINE_DEFAULT_MODEL_ID,K0 as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,n_ as CHARS_PER_TOKEN,M4 as AwsBedrockSettingsSchema,D4 as AwsBedrockModelSchema,Y4 as AwsBedrockCustomModelSchema,If as ApiFormatSchema,p4 as ApiFormat,H4 as AnthropicSchema,Z4 as AnthropicModelSchema,L4 as AllowedMCPServerSchema,a4 as AgentUsageSchema,a0 as AgentResultSchema,i4 as AgentFinishReasonSchema,e0 as AgentConfigSchema,S4 as AUTH_ERROR_PATTERNS,S_ as APIKeySchema,e_ as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT};
98
+ ${Jf(A,Z,H)}`.trim();return C}let B=w==="yolo"?Rf:Hf,O=[R,Kf,w==="plan"?V?Qf:jf:void 0].filter(Boolean).join(`
99
+
100
+ `);return B.replace("{{PLATFORM_NAME}}",q).replace("{{CWD}}",A).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",$).replace("{{CLINE_METADATA}}",j?Jf(A,Z,H):"").replace("{{CLINE_RULES}}",O).trim()}var x$="anthropic/claude-sonnet-5";var z$="remote://";import{z as G}from"zod";var Vf=G.object({id:G.string(),temperature:G.number().optional(),maxTokens:G.number().optional(),contextWindow:G.number().optional(),inputPrice:G.number().optional(),outputPrice:G.number().optional(),supportsImages:G.boolean().optional()}),kf=G.object({models:G.array(Vf).optional(),openAiBaseUrl:G.string().optional(),openAiHeaders:G.record(G.string(),G.string()).optional(),azureApiVersion:G.string().optional(),azureIdentity:G.boolean().optional()}),Ff=G.object({id:G.string(),thinkingBudgetTokens:G.number().optional()}),Lf=G.object({name:G.string(),baseModelId:G.string(),thinkingBudgetTokens:G.number().optional()}),Wf=G.object({models:G.array(Ff).optional(),customModels:G.array(Lf).optional(),awsRegion:G.string().optional(),awsUseCrossRegionInference:G.boolean().optional(),awsUseGlobalInference:G.boolean().optional(),awsBedrockUsePromptCache:G.boolean().optional(),awsBedrockEndpoint:G.string().optional()}),Af=G.object({id:G.string()}),Df=G.object({models:G.array(Af).optional()}),Uf=G.object({id:G.string(),thinkingBudgetTokens:G.number().optional()}),Pf=G.object({models:G.array(Uf).optional(),vertexProjectId:G.string().optional(),vertexRegion:G.string().optional()}),If=G.object({id:G.string(),thinkingBudgetTokens:G.number().optional(),promptCachingEnabled:G.boolean().optional()}),Bf=G.object({models:G.array(If).optional(),baseUrl:G.string().optional()}),Mf=G.object({id:G.string(),thinkingBudgetTokens:G.number().optional()}),Ef=G.object({models:G.array(Mf).optional(),baseUrl:G.string().optional()}),c$=G.object({OpenAiCompatible:kf.optional(),AwsBedrock:Wf.optional(),Cline:Df.optional(),Vertex:Pf.optional(),LiteLLM:Bf.optional(),Anthropic:Ef.optional()}),Of=G.object({id:G.string()}),bf=G.object({name:G.string(),url:G.string(),alwaysEnabled:G.boolean().optional(),headers:G.record(G.string(),G.string()).optional()}),f1=G.object({alwaysEnabled:G.boolean(),name:G.string(),contents:G.string()}),D0=G.object({bucket:G.string(),accessKeyId:G.string(),secretAccessKey:G.string(),region:G.string().optional(),endpoint:G.string().optional(),accountId:G.string().optional()}),Nf=G.object({enabled:G.boolean().optional(),type:G.union([G.literal("s3_access_keys"),G.literal("r2_access_keys"),G.literal("azure_access_keys")]).optional(),s3AccessSettings:D0.optional(),r2AccessSettings:D0.optional(),azureAccessSettings:D0.optional()}),Tf=G.object({promptUploading:Nf.optional()}),o$=G.object({version:G.string(),providerSettings:c$.optional(),telemetryEnabled:G.boolean().optional(),kanbanEnabled:G.boolean().optional(),mcpMarketplaceEnabled:G.boolean().optional(),allowedMCPServers:G.array(Of).optional(),remoteMCPServers:G.array(bf).optional(),blockPersonalRemoteMCPServers:G.boolean().optional(),yoloModeAllowed:G.boolean().optional(),openTelemetryEnabled:G.boolean().optional(),openTelemetryMetricsExporter:G.string().optional(),openTelemetryLogsExporter:G.string().optional(),openTelemetryOtlpProtocol:G.string().optional(),openTelemetryOtlpEndpoint:G.string().optional(),openTelemetryOtlpHeaders:G.record(G.string(),G.string()).optional(),openTelemetryOtlpMetricsProtocol:G.string().optional(),openTelemetryOtlpMetricsEndpoint:G.string().optional(),openTelemetryOtlpMetricsHeaders:G.record(G.string(),G.string()).optional(),openTelemetryOtlpLogsProtocol:G.string().optional(),openTelemetryOtlpLogsEndpoint:G.string().optional(),openTelemetryOtlpLogsHeaders:G.record(G.string(),G.string()).optional(),openTelemetryMetricExportInterval:G.number().optional(),openTelemetryOtlpInsecure:G.boolean().optional(),openTelemetryLogBatchSize:G.number().optional(),openTelemetryLogBatchTimeout:G.number().optional(),openTelemetryLogMaxQueueSize:G.number().optional(),enterpriseTelemetry:Tf.optional(),globalRules:G.array(f1).optional(),globalWorkflows:G.array(f1).optional()}),u$=G.record(G.string(),G.string());var d$=4317;var l$="127.0.0.1:4317";import $1 from"zod";var m$=$1.enum(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),p$=$1.enum(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),r$=$1.enum(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var s$="runtime.team.progress.v1",i$="runtime.team.lifecycle.v1";var a$="CLINE_ENVIRONMENT",t$="CLINE_ENVIRONMENT_OVERRIDE",w1={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"}},e$="production";function yf(f){let $=f?.trim().toLowerCase();if($==="production"||$==="staging"||$==="local")return $;return}function Cf(){if(typeof process>"u"||!process?.env)return{};return process.env}function Sf(){let f=Cf();return yf(f.CLINE_ENVIRONMENT_OVERRIDE)??yf(f.CLINE_ENVIRONMENT)??"production"}function f2(f){if(typeof f==="string")return w1[f];return w1[Sf()]}function $2(f,$){if($.CLINE_API_BASE_URL)f={...f,apiBaseUrl:$.CLINE_API_BASE_URL,mcpBaseUrl:`${$.CLINE_API_BASE_URL}/v1/mcp`};return f}function w2(f){let $=f2(f);return $2($,Cf())}var Y2="agent.reasoning.unexpected_tokens",q2="task.provider_request_started",Z2="task.provider_stream_started",G2="task.first_chunk_received",X2="task.provider_stream_failed",H2="task.cancelled",R2="sdk.error";var l=new Map;function J2(){l.clear()}function K2(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 _2(f){let $=Date.now(),w=l.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 q=w?.suppressed??0;if(l.delete(f),l.size>=512){let Z=l.keys().next();if(!Z.done)l.delete(Z.value)}return l.set(f,{startMs:$,emitted:1,suppressed:0}),{emit:!0,suppressed:q}}function Q2(f,$){f?.capture({event:"agent.reasoning.unexpected_tokens",properties:nf({sessionId:$.sessionId,agentId:$.agentId,runId:$.runId,iteration:$.iteration,providerId:$.providerId,modelId:$.modelId,requestedThinking:$.requestedThinking,reasoningTokenCount:$.reasoningTokenCount})})}function j2(f,$){if(!f)return;f.capture({event:$.event,properties:nf({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?{}:q1($.error,$.messageLimit),error_class:$.errorClass})})}function V2(f,$){if(!f)return!1;let w=$.event??"sdk.error",q=gf($),Z=0;try{let H=_2(K2(w,q));if(!H.emit)return!0;Z=H.suppressed}catch{}return f.capture({event:w,properties:Z>0?{...q,suppressed_count:Z}:q}),!0}function gf(f){return{...f.context??{},component:f.component,operation:f.operation,severity:f.severity??"error",handled:f.handled??!0,...q1(f.error,f.messageLimit,f.errorMessage)}}function nf(f){let $={};for(let[w,q]of Object.entries(f))if(q!==void 0)$[w]=q;return $}function q1(f,$=500,w){let q=L2(f)?f:void 0,Z=f instanceof Error?f:void 0,H=R0(w)??R0(Z?.message)??R0(q?.message)??W2(f)??"Unknown error",R=A2(q?.code),J=Y1(q?.status)??Y1(q?.statusCode)??Y1(q?.responseStatus);return{error_type:Z?.name?.trim()||R0(q?.name)||Z?.constructor?.name||"Error",error_message:F2(k2(H),$),...R!==void 0?{error_code:R}:{},...J!==void 0?{error_status:J}:{}}}function k2(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 F2(f,$){let w=Math.max(1,Math.floor($));return f.length>w?f.substring(0,w):f}function L2(f){return typeof f==="object"&&f!==null}function R0(f){return typeof f==="string"&&f.trim().length>0?f:void 0}function W2(f){if(f instanceof Error)return;let $=typeof f==="string"?f:String(f);return $==="[object Object]"?void 0:R0($)}function A2(f){if(typeof f==="string"&&f.trim().length>0)return f;if(typeof f==="number"&&Number.isFinite(f))return f;return}function Y1(f){return typeof f==="number"&&Number.isFinite(f)?f:void 0}function vf(f){let $={};if(!f)return $;return f.split(",").forEach((w)=>{let q=w.indexOf("=");if(q<=0)return;try{let Z=decodeURIComponent(w.substring(0,q).trim()),H=decodeURIComponent(w.substring(q+1).trim());if(!Z||!H)return;$[Z]=H}catch{}}),$}function D2(){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?vf(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function hf(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 U2(f={}){return{...D2(),...f,metadata:hf(f.metadata)}}function xf(f){let $=f?.trim();return $?$:void 0}function P2(f,$){if(!f)return;let w=typeof f==="function"?f($):f;if(!w)return;let q=xf(w.rootSessionId);if(!q)return;return{rootSessionId:q}}function I2(f){return xf(f?.rootSessionId)}var B2=(f)=>crypto.getRandomValues(new Uint8Array(f)),M2=(f,$,w)=>{let q=256-256%f.length;if(q===256){let H=f.length-1;return(R=$)=>{if(!R)return"";let J="";while(!0){let k=w(R),V=R;while(V--)if(J+=f[k[V]&H],J.length>=R)return J}}}let Z=Math.ceil(409.6*$/q);return(H=$)=>{if(!H)return"";let R="";while(!0){let J=w(Z),k=Z;while(k--)if(J[k]<q){if(R+=f[J[k]%f.length],R.length>=H)return R}}}},zf=(f,$=21)=>M2(f,$|0,B2);function E2(f="",$=""){let w=zf("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${f}${Date.now()}_${w(5)}${$}`}var O2=["idle","running","pending","completed","failed","cancelled"];var Z1=["rules","skills","workflows","plugins"],cf=Z1,b2=new Set(Z1);function of(f){return typeof f==="string"&&b2.has(f)}function N2(f){if(!Array.isArray(f))return;let $=f.map((w)=>typeof w==="string"?w.trim():"").filter(of);return[...new Set($)]}function T2(f,$){return new Set(f??cf).has($)}import{z as T}from"zod";var y2=T.object({rootPath:T.string().min(1),hint:T.string().min(1).optional(),associatedRemoteUrls:T.array(T.string().min(1)).optional(),latestGitCommitHash:T.string().min(1).optional(),latestGitBranchName:T.string().min(1).optional()}),C2=T.object({currentWorkspacePath:T.string().min(1).optional(),workspaces:T.record(T.string().min(1),y2)});function mw(){return{workspaces:{}}}function pw(f,$){let w={...f,workspaces:{...f.workspaces,[$.rootPath]:$}};if(!w.currentWorkspacePath)w.currentWorkspacePath=$.rootPath;return C2.parse(w)}var S2="workspaces",g2="chat";function n2(f){let $=f.trim(),w=/^[A-Za-z]:[\\/]/.test($)||$.startsWith("\\\\"),q=$.startsWith("/");if(!w&&!q)return!1;let Z=$.split(w?/[\\/]+/:/\/+/).filter(Boolean),H=Z.at(-1)??"",R=Z.at(-2)??"",J=Z.at(-3)??"";return(Z.at(-4)??"")===".cline"&&J==="data"&&R==="workspaces"&&H==="chat"}import{z as Y}from"zod";var v2=["current_state","boundary_analysis","interface_proposal"],aw=3600000,tw=240,ew=400,y=Y.preprocess((f)=>f instanceof Date?f.toISOString():f,Y.string().datetime()),w0=Y.enum(["pending","in_progress","blocked","completed"]),uf=Y.enum(["queued","running","completed","failed","cancelled","interrupted"]),U0=Y.enum(["draft","in_review","finalized"]),h2=Y.object({agentId:Y.string(),role:Y.enum(["lead","teammate"]),description:Y.string().optional(),status:Y.enum(["idle","running","stopped"])}),f3=Y.object({agentId:Y.string(),rolePrompt:Y.string(),modelId:Y.string().optional(),maxIterations:Y.number().optional()});function U(f){return Y.preprocess(($)=>$===null?void 0:$,f.optional())}var $3=Y.object({agentId:Y.string().min(1).describe("Teammate identifier"),rolePrompt:Y.string().min(1).describe("System prompt describing teammate role")}).strict(),w3=Y.object({agentId:Y.string().min(1).describe("Teammate identifier"),reason:U(Y.string().min(1)).describe("Optional shutdown reason")}),Y3=Y.object({}),x2={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},q3={create:["status","taskId","summary","reason"]},Z3=Y.object({action:Y.enum(["create","list","claim","complete","block"]),title:U(Y.string().min(1)).describe("Task title"),description:U(Y.string().min(1)).describe("Task details"),dependsOn:U(Y.array(Y.string().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:U(Y.string().min(1)).describe("Optional assignee"),status:U(Y.enum(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:U(Y.string()).describe("Task ID"),summary:U(Y.string().min(1)).describe("Completion summary"),reason:U(Y.string().min(1)).describe("Blocking reason")}).superRefine((f,$)=>{for(let w of x2[f.action]){if(f[w]!==void 0)continue;$.addIssue({code:"custom",path:[w],message:`Field "${w}" is required when action=${f.action}`})}}),G3=Y.object({agentId:Y.string().describe("Teammate agent ID"),task:Y.string().min(1).describe("Task instructions for the teammate"),taskId:U(Y.string()).describe("Optional shared task list ID"),runMode:U(Y.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:U(Y.boolean()).describe("If true, continue the teammate conversation; otherwise start fresh")}),X3=Y.object({status:U(Y.enum(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:U(Y.string().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:U(Y.boolean()).describe("Include completed/failed runs (default true)")}),H3=Y.object({runId:Y.string().min(1).describe("Run ID"),reason:U(Y.string().min(1)).describe("Optional cancellation reason")}),R3=Y.object({runId:U(Y.string().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),J3=Y.object({toAgentId:Y.string().min(1).describe("Recipient agent ID"),subject:Y.string().min(1).describe("Message subject"),body:Y.string().min(1).describe("Message body"),taskId:U(Y.string().min(1)).describe("Optional task ID context")}),K3=Y.object({subject:Y.string().min(1).describe("Message subject"),body:Y.string().min(1).describe("Message body"),taskId:U(Y.string().min(1)).describe("Optional task ID context")}),_3=Y.object({unreadOnly:U(Y.boolean()).describe("Only unread messages for read action (default true)")}),Q3=Y.object({kind:Y.enum(["progress","handoff","blocked","decision","done","error"]),summary:Y.string().min(1).describe("Update summary"),taskId:U(Y.string().min(1)).describe("Optional task ID context"),evidence:U(Y.array(Y.string().min(1))).describe("Optional evidence links/snippets"),nextAction:U(Y.string().min(1)).describe("Planned next step")}),j3=Y.object({}),V3=Y.object({title:Y.string().describe("Outcome title"),requiredSections:Y.array(Y.string()).default(v2).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),k3=Y.object({outcomeId:Y.string().describe("Outcome ID"),section:Y.string().describe("Section name"),sourceRunId:U(Y.string()).describe("Optional source run ID"),content:Y.string().describe("Section fragment content")}),F3=Y.object({fragmentId:Y.string().describe("Fragment ID"),approved:Y.boolean().describe("Review decision")}),L3=Y.object({outcomeId:Y.string().describe("Outcome ID")}),W3=Y.object({}),A3=Y.object({teamId:Y.string(),teamName:Y.string(),members:Y.array(h2),taskCounts:Y.record(w0,Y.number()),unreadMessages:Y.number(),missionLogEntries:Y.number(),activeRuns:Y.number(),queuedRuns:Y.number(),outcomeCounts:Y.record(U0,Y.number())}),z2=Y.object({id:Y.string(),title:Y.string(),description:Y.string(),status:w0,createdAt:y,updatedAt:y,createdBy:Y.string(),assignee:Y.string().optional(),dependsOn:Y.array(Y.string()),summary:Y.string().optional(),isReady:Y.boolean(),blockedBy:Y.array(Y.string())}),D3=Y.discriminatedUnion("action",[Y.object({action:Y.literal("create"),taskId:Y.string(),status:w0,ignoredFields:Y.array(Y.string()).optional(),note:Y.string().optional()}),Y.object({action:Y.literal("list"),tasks:Y.array(z2)}),Y.object({action:Y.literal("claim"),taskId:Y.string(),status:w0,nextStep:Y.string()}),Y.object({action:Y.literal("complete"),taskId:Y.string(),status:w0}),Y.object({action:Y.literal("block"),taskId:Y.string(),status:w0})]),U3=Y.object({agentId:Y.string(),mode:Y.enum(["sync","async"]),status:Y.enum(["dispatched","running","queued","joined"]),dispatched:Y.boolean(),message:Y.string(),deduped:Y.boolean().optional(),runId:Y.string().optional(),text:Y.string().optional(),iterations:Y.number().optional()}),c2=Y.object({textPreview:Y.string(),iterations:Y.number(),finishReason:Y.string(),durationMs:Y.number(),usage:Y.object({inputTokens:Y.number(),outputTokens:Y.number(),cacheReadTokens:Y.number().optional(),cacheWriteTokens:Y.number().optional(),totalCost:Y.number().optional()})}),P3=Y.object({id:Y.string(),agentId:Y.string(),taskId:Y.string().optional(),status:uf,messagePreview:Y.string(),priority:Y.number(),retryCount:Y.number(),maxRetries:Y.number(),nextAttemptAt:y.optional(),continueConversation:Y.boolean().optional(),startedAt:y,endedAt:y.optional(),leaseOwner:Y.string().optional(),heartbeatAt:y.optional(),lastProgressAt:y.optional(),lastProgressMessage:Y.string().optional(),currentActivity:Y.string().optional(),error:Y.string().optional(),resultSummary:c2.optional()}),I3=Y.object({id:Y.string(),teamId:Y.string(),fromAgentId:Y.string(),toAgentId:Y.string(),subject:Y.string(),body:Y.string(),taskId:Y.string().optional(),sentAt:y,readAt:y.optional()}),B3=Y.object({id:Y.string(),teamId:Y.string(),title:Y.string(),status:U0,requiredSections:Y.array(Y.string()),createdBy:Y.string(),createdAt:y,finalizedAt:y.optional()}),M3=Y.object({outcomeId:Y.string(),status:U0,requiredSections:Y.array(Y.string())}),E3=Y.object({agentId:Y.string(),status:Y.string()}),O3=Y.object({runId:Y.string(),status:uf}),b3=Y.object({id:Y.string(),toAgentId:Y.string()}),N3=Y.object({delivered:Y.number()}),T3=Y.object({id:Y.string()}),y3=Y.object({status:Y.string()}),C3=Y.object({fragmentId:Y.string(),status:Y.string()}),S3=Y.object({outcomeId:Y.string(),status:U0});var o2;((P)=>{P.TaskStart="task_start";P.TaskEnd="task_end";P.AgentEvent="agent_event";P.TeammateSpawned="teammate_spawned";P.TeammateShutdown="teammate_shutdown";P.TeamTaskUpdated="team_task_updated";P.TeamMessage="team_message";P.TeamMissionLog="team_mission_log";P.TeamTaskCompleted="team_task_completed";P.RunStarted="run_started";P.RunQueued="run_queued";P.RunProgress="run_progress";P.RunCompleted="run_completed";P.RunFailed="run_failed";P.RunCancelled="run_cancelled";P.RunInterrupted="run_interrupted";P.OutcomeCreated="outcome_created";P.OutcomeFragmentAttached="outcome_fragment_attached";P.OutcomeFragmentReviewed="outcome_fragment_reviewed";P.OutcomeFinalized="outcome_finalized"})(o2||={});import{z as u2}from"zod";function d2(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 q of["oneOf","anyOf","allOf"]){let Z=w[q];if(!Array.isArray(Z)||Z.length===0)continue;if(q==="allOf"){if(Z.some((J)=>J&&typeof J==="object"&&J.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(Z.every((R)=>R&&typeof R==="object"&&R.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 "${q}" 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 l2(f){let $=d2(f.inputSchema instanceof u2.ZodType?a0(f.inputSchema):f.inputSchema);return{name:f.name,description:f.description,inputSchema:$,lifecycle:f.lifecycle,timeoutMs:f.timeoutMs??30000,retryable:f.retryable??!0,maxRetries:f.maxRetries??3,execute:f.execute}}var df=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function m2(f){let $=(f instanceof Error?f.message:String(f)).toLowerCase();return df.some((w)=>$.includes(w))}export{a0 as zodToJsonSchema,n1 as xmlTagsRemoval,v$ as validateWithZod,c1 as validateImageMedia,Z0 as validateAndReserveImageMedia,pw as upsertWorkspaceInfo,Gf as truncateStr,y$ as truncateSplit,T$ as trimNonEmpty,l1 as toAiSdkToolResultOutput,S$ as stripUtf8Bom,g1 as stripModeNotices,G6 as shouldIncludeConnectorField,q$ as serializeAbortReason,N as sanitizeSurrogates,N$ as sanitizeFileName,A$ as safeJsonStringify,D$ as safeJsonParse,I2 as resolveRootSessionId,p1 as resolveReasoningEffortRatio,Y$ as resolveReasoningBudgetFromRatio,h1 as resolveMediaBudget,e4 as resolveMcpTimeoutSeconds,O4 as resolveHubCommandTimeoutMs,P2 as resolveHookSessionContext,w$ as resolveEffectiveReasoningEffort,Sf as resolveClineEnvironment,J2 as resetSdkErrorRateLimiterForTests,q0 as reserveImageMediaBytes,M4 as readHubScheduleMode,C1 as parseUserCommandEnvelope,N2 as parseRuntimeConfigExtensions,W$ as parseJsonStream,E6 as parseHookEventPayload,M$ as omitUndefinedValues,S1 as normalizeUserInput,q1 as normalizeSdkError,O1 as normalizePluginManifest,s0 as normalizeJsonLikeStringsForSchema,X$ as noopBasicLogger,f$ as mergeModelOptions,C$ as maskSecret,P1 as listConnectorCatalog,of as isRuntimeConfigExtensionKind,H$ as isMcpTimeoutConfigured,m2 as isLikelyAuthError,b4 as isHubToolExecutorName,O6 as isHubScheduleMode,P4 as isHubProtocolCompatible,t0 as isClineProvider,n2 as isChatWorkspacePath,l6 as isCanonicalBase64,x1 as isBase64Char,d6 as imageFileMaxDecodedBytesForBase64Limit,T0 as imageBase64LengthForDecodedBytes,u6 as imageBase64EncodedByteLength,v1 as imageBase64DecodedByteLength,T2 as hasRuntimeConfigExtension,i0 as getShellKind,Zf as getShellInvocation,b$ as getShellArgs,J$ as getErrorMessage,K$ as getErrorCode,O$ as getDefaultShell,N6 as getDefaultHubCommandTimeoutMs,w2 as getClineEnvironmentConfig,C6 as formatUserInputBlock,S6 as formatUserCommandBlock,n$ as formatUptime,g6 as formatModeSwitchNotice,e6 as formatMessagesForAiSdk,fw as formatMcpTimeoutErrorMessage,g$ as formatHumanReadableDate,N0 as formatFileContentBlock,z6 as formatDisplayUserInput,r1 as estimateTokens,G$ as estimateRequestInputTokens,mw as emptyWorkspaceManifest,B$ as decodeJwtPayload,l2 as createTool,E2 as createSessionId,n6 as createModeSwitchNoticeTracker,L0 as createMediaBudgetState,V6 as createContributionRegistry,hf as createClineTelemetryServiceMetadata,U2 as createClineTelemetryServiceConfig,X6 as connectorChannelsFromPlatforms,R$ as clampMcpTimeoutSeconds,j2 as captureTaskLifecycleEvent,V2 as captureSdkError,Q2 as captureAgentUnexpectedReasoningTokens,gf as buildSdkErrorProperties,h$ as buildClineSystemPrompt,C2 as WorkspaceManifestSchema,y2 as WorkspaceInfoSchema,Pf as VertexSettingsSchema,Uf as VertexModelSchema,u4 as USAGE_COST_DISPLAYS,O0 as ToolCallRecordSchema,F1 as ThinkingConfigSchema,f3 as TeamTeammateSpecSchema,D3 as TeamTaskToolResultSchema,z2 as TeamTaskListItemToolResultSchema,Z3 as TeamTaskInputSchema,A3 as TeamStatusToolResultSchema,Y3 as TeamStatusInputSchema,$3 as TeamSpawnTeammateInputSchema,E3 as TeamSimpleAgentStatusToolResultSchema,w3 as TeamShutdownTeammateInputSchema,b3 as TeamSendMessageToolResultSchema,J3 as TeamSendMessageInputSchema,P3 as TeamRunToolSummarySchema,U3 as TeamRunTaskToolResultSchema,G3 as TeamRunTaskInputSchema,c2 as TeamRunResultSummarySchema,F3 as TeamReviewOutcomeFragmentInputSchema,_3 as TeamReadMailboxInputSchema,B3 as TeamOutcomeToolResultSchema,C3 as TeamOutcomeFragmentToolResultSchema,T3 as TeamMissionLogToolResultSchema,Q3 as TeamMissionLogInputSchema,o2 as TeamMessageType,I3 as TeamMailboxMessageToolResultSchema,X3 as TeamListRunsInputSchema,W3 as TeamListOutcomesInputSchema,S3 as TeamFinalizeOutcomeToolResultSchema,L3 as TeamFinalizeOutcomeInputSchema,M3 as TeamCreateOutcomeToolResultSchema,V3 as TeamCreateOutcomeInputSchema,y3 as TeamCleanupToolResultSchema,j3 as TeamCleanupInputSchema,O3 as TeamCancelRunToolResultSchema,H3 as TeamCancelRunInputSchema,N3 as TeamBroadcastToolResultSchema,K3 as TeamBroadcastInputSchema,R3 as TeamAwaitRunsInputSchema,k3 as TeamAttachOutcomeFragmentInputSchema,q3 as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,ew as TEAM_RUN_TEXT_PREVIEW_LIMIT,tw as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,s$ as TEAM_PROGRESS_EVENT_TYPE,i$ as TEAM_LIFECYCLE_EVENT_TYPE,aw as TEAM_AWAIT_TIMEOUT_MS,Z2 as TASK_PROVIDER_STREAM_STARTED_EVENT,X2 as TASK_PROVIDER_STREAM_FAILED_EVENT,q2 as TASK_PROVIDER_REQUEST_STARTED_EVENT,G2 as TASK_FIRST_CHUNK_RECEIVED_EVENT,H2 as TASK_CANCELLED_EVENT,F0 as SUPPORTED_IMAGE_MEDIA_TYPES,O2 as SESSION_STATUS_VALUES,R2 as SDK_ERROR_TELEMETRY_EVENT,D0 as S3AccessKeySettingsSchema,bf as RemoteMCPServerSchema,o$ as RemoteConfigSchema,M0 as ReasoningLevelSchema,Q0 as ReasoningEffortSchema,Z1 as RUNTIME_CONFIG_EXTENSION_KINDS,z$ as REMOTE_URI_SCHEME,_0 as REASONING_LEVELS,H0 as REASONING_EFFORT_RATIOS,p$ as ProviderProtocolSchema,r$ as ProviderClientSchema,m$ as ProviderCapabilitySchema,Nf as PromptUploadingSchema,k6 as PLUGIN_FILE_EXTENSIONS,jf as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,Qf as PLAN_MODE_INSTRUCTIONS,kf as OpenAiCompatibleSchema,Vf as OpenAiCompatibleModelSchema,B4 as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,I4 as ONE_TIME_SCHEDULE_CRON_PATTERN,V1 as ModelStatusSchema,E0 as ModelReasoningOptionSchema,k1 as ModelPricingSchema,L1 as ModelMetadataSchema,j0 as ModelInfoSchema,j1 as ModelCapabilitySchema,Kf as MODE_TAG_INSTRUCTIONS,a4 as MIN_MCP_TIMEOUT_SECONDS,A4 as MIN_CLIENT_HUB_PROTOCOL_VERSION,t4 as MAX_MCP_TIMEOUT_SECONDS,D4 as MAX_CLIENT_HUB_PROTOCOL_VERSION,Bf as LiteLLMSchema,If as LiteLLMModelSchema,Y0 as IMAGE_UNSUPPORTED_PLACEHOLDER,i as IMAGE_OMITTED_PLACEHOLDER,T1 as HookEventPayloadSchema,N1 as HookEventNameSchema,n4 as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,T6 as HUB_TOOL_EXECUTOR_NAMES,N4 as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,y1 as HUB_SCHEDULE_MODES,g4 as HUB_MISTAKE_LIMIT_CAPABILITY,y4 as HUB_HOOK_CAPABILITY_PREFIX,b6 as HUB_DEFAULT_COMMAND_TIMEOUT_MS,T4 as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,C4 as HUB_COMPACTION_CAPABILITY,E4 as HUB_COMMAND_SLOW_LOG_MS,S4 as HUB_CHECKPOINT_CAPABILITY,U4 as HUB_CAPABILITIES,f1 as GlobalInstructionsFileSchema,F6 as FeatureFlagDefaultValue,L6 as FEATURE_FLAGS,Tf as EnterpriseTelemetrySchema,y0 as EMPTY_CONTENT_TEXT,cf as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,$$ as DEFAULT_REASONING_EFFORT,v2 as DEFAULT_OUTCOME_REQUIRED_SECTIONS,i4 as DEFAULT_MCP_TIMEOUT_SECONDS,o6 as DEFAULT_MAX_TOTAL_MEDIA_BYTES,z as DEFAULT_MAX_IMAGE_ENCODED_BYTES,u as DEFAULT_MAX_IMAGE_DECODED_BYTES,c6 as DEFAULT_MAX_IMAGE_BASE64_BYTES,e$ as DEFAULT_CLINE_ENVIRONMENT,b0 as ContributionRegistry,Z6 as ConnectorHookEventSchema,W1 as ConnectorHookEventNameSchema,D1 as ConnectorEventContextSchema,A1 as ConnectorEventActorSchema,Y6 as ConnectorAuthorizationRequestSchema,q6 as ConnectorAuthorizationDecisionSchema,Df as ClineSettingsSchema,Af as ClineModelSchema,W4 as CURRENT_HUB_PROTOCOL_VERSION,I1 as CONNECTOR_PLATFORMS,U1 as CONNECTOR_CATALOG,S2 as CLINE_WORKSPACES_DIRECTORY_NAME,t$ as CLINE_ENVIRONMENT_OVERRIDE_ENV,a$ as CLINE_ENVIRONMENT_ENV,w1 as CLINE_ENVIRONMENTS,d$ as CLINE_DEFAULT_RPC_PORT,l$ as CLINE_DEFAULT_RPC_ADDRESS,x$ as CLINE_DEFAULT_MODEL_ID,g2 as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,Z$ as CHARS_PER_TOKEN,Wf as AwsBedrockSettingsSchema,Ff as AwsBedrockModelSchema,Lf as AwsBedrockCustomModelSchema,Q1 as ApiFormatSchema,f6 as ApiFormat,Ef as AnthropicSchema,Mf as AnthropicModelSchema,Of as AllowedMCPServerSchema,w6 as AgentUsageSchema,Z4 as AgentResultSchema,$6 as AgentFinishReasonSchema,G4 as AgentConfigSchema,df as AUTH_ERROR_PATTERNS,u$ as APIKeySchema,Y2 as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT};