@cline/shared 0.0.92 → 0.0.93-nightly.1792117748

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