@cline/shared 0.0.79 → 0.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.js +17 -17
- package/dist/index.js +28 -28
- package/package.json +1 -1
package/dist/index.browser.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{z as H}from"zod";import{z as U}from"zod";import{z as y}from"zod";var V0=["none","minimal","low","medium","high","xhigh","max"],E0=y.enum(V0),k0=E0.exclude(["none"]),F6=y.enum([...V0,"default"]).nullable(),y0=y.discriminatedUnion("type",[y.object({type:y.literal("toggle")}).strict(),y.object({type:y.literal("effort"),values:y.array(F6)}).strict(),y.object({type:y.literal("budget_tokens"),min:y.number().min(-1).optional(),max:y.number().min(0).optional()}).strict().refine((f)=>f.min===void 0||f.max===void 0||f.min<=f.max,{message:"Minimum reasoning budget cannot exceed maximum",path:["min"]})]);var A1=U.enum(["default","openai-responses","r1"]),_6={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},B1=U.enum(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),I1=U.enum(["active","preview","deprecated","legacy"]),O1=U.object({input:U.number().optional(),output:U.number().optional(),cacheWrite:U.number().optional(),cacheRead:U.number().optional()}),N1=U.object({maxBudget:U.number().optional(),outputPrice:U.number().optional(),thinkingLevel:U.enum(["low","high"]).optional()}),b1=U.object({reasoningDefaultOn:U.boolean().optional()}).catchall(U.unknown()),T0=U.enum(["text","image","audio","video","pdf"]),E1=U.object({input:U.array(T0),output:U.array(T0)});function y1(f){return(f?.input===void 0||f.input.includes("text"))&&(f?.output===void 0||f.output.includes("text"))}var T1=U.enum(["language","image-generation","speech-generation","video-generation","transcription"]);function L6(f){return(f.operation===void 0||f.operation==="language")&&y1(f.modalities)}var M1=U.enum(["batch","streaming"]);function U6(f){return f.modalities?.input.includes("text")===!0&&f.modalities.output.includes("image")}function D6(f){return f.operation==="image-generation"}function C1(f,$,w){let q=f.capabilities;if(q===void 0||q.length===0)return w?.assumeWhenUnspecified??!1;return q.includes($)}function P6(f){return C1(f,"tools",{assumeWhenUnspecified:!0})}var W0=U.object({id:U.string(),name:U.string().optional(),description:U.string().optional(),maxTokens:U.number().optional(),contextWindow:U.number().optional(),maxInputTokens:U.number().optional(),capabilities:U.array(B1).optional(),operation:T1.optional(),operationModes:U.array(M1).optional(),modalities:E1.optional(),reasoningOptions:U.array(y0).optional(),apiFormat:A1.optional(),systemRole:U.enum(["system","developer"]).optional(),temperature:U.number().optional(),pricing:O1.optional(),thinkingConfig:N1.optional(),status:I1.optional(),deprecationNotice:U.string().optional(),replacedBy:U.string().optional(),releaseDate:U.string().optional(),deprecationDate:U.string().optional(),family:U.string().optional(),metadata:b1.optional()});import{z as g}from"zod";var M0=g.object({id:g.string(),name:g.string(),execution:g.enum(["client","provider"]).optional(),input:g.unknown(),output:g.unknown(),error:g.string().optional(),durationMs:g.number(),startedAt:g.date(),endedAt:g.date()});var A6=H.enum(["completed","max_iterations","aborted","mistake_limit","error"]),B6=H.object({inputTokens:H.number(),outputTokens:H.number(),cacheReadTokens:H.number().optional(),cacheWriteTokens:H.number().optional(),totalCost:H.number().optional()}),b4=H.object({text:H.string(),usage:B6,messages:H.array(H.custom()),toolCalls:H.array(M0),iterations:H.number(),finishReason:A6,model:H.object({id:H.string(),provider:H.string(),info:W0.optional()}),startedAt:H.date(),endedAt:H.date(),durationMs:H.number()}),E4=H.object({distinctId:H.string().optional(),sessionId:H.string().optional(),providerId:H.string(),modelId:H.string(),apiKey:H.string().optional(),baseUrl:H.string().url().optional(),headers:H.record(H.string(),H.string()).optional(),knownModels:H.record(H.string(),W0).optional(),providerConfig:H.unknown().optional(),initialMessages:H.array(H.custom()).optional(),systemPrompt:H.string(),tools:H.array(H.custom()),modelTools:H.array(H.custom()).optional(),maxIterations:H.number().positive().optional(),maxParallelToolCalls:H.number().int().positive().default(8),maxTokensPerTurn:H.number().positive().optional(),temperature:H.number().nonnegative().optional(),apiTimeoutMs:H.number().positive().default(180000),userFileContentLoader:H.function().input([H.string()]).output(H.promise(H.string())).optional(),toolContextMetadata:H.record(H.string(),H.unknown()).optional(),execution:H.object({maxConsecutiveMistakes:H.number().int().positive().optional(),reminderAfterIterations:H.number().nonnegative().optional(),reminderText:H.string().optional(),loopDetection:H.union([H.literal(!1),H.object({softThreshold:H.number().int().positive().optional(),hardThreshold:H.number().int().positive().optional()})]).optional()}).optional(),reasoningEffort:k0.optional(),thinkingBudgetTokens:H.number().positive().optional(),thinking:H.boolean().optional(),onEvent:H.function().input([H.custom()]).output(H.void()).optional(),hooks:H.custom().optional(),parentAgentId:H.string().optional(),extensions:H.array(H.custom()).optional(),hookErrorMode:H.enum(["ignore","throw"]).default("ignore"),toolPolicies:H.record(H.string(),H.object({enabled:H.boolean().optional(),autoApprove:H.boolean().optional()})).optional(),requestToolApproval:H.function().input([H.object({sessionId:H.string(),agentId:H.string(),conversationId:H.string(),iteration:H.number(),toolCallId:H.string(),toolName:H.string(),input:H.unknown(),policy:H.object({enabled:H.boolean().optional(),autoApprove:H.boolean().optional()}).default({})})]).output(H.union([H.object({approved:H.boolean(),reason:H.string().optional()}),H.promise(H.object({approved:H.boolean(),reason:H.string().optional()}))])).optional(),onConsecutiveMistakeLimitReached:H.function().input([H.object({iteration:H.number().int().positive(),consecutiveMistakes:H.number().int().positive(),maxConsecutiveMistakes:H.number().int().positive(),reason:H.enum(["api_error","invalid_tool_call","tool_execution_failed"]),details:H.string().optional()})]).output(H.union([H.object({action:H.literal("continue"),guidance:H.string().optional()}),H.object({action:H.literal("stop"),reason:H.string().optional()}),H.promise(H.union([H.object({action:H.literal("continue"),guidance:H.string().optional()}),H.object({action:H.literal("stop"),reason:H.string().optional()})]))])).optional(),logger:H.custom().optional(),extensionContext:H.custom().optional(),abortSignal:H.custom().optional()});import{z as F}from"zod";var S1=F.enum(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),g1=F.object({id:F.string().optional(),label:F.string().optional(),role:F.string().optional(),participantKey:F.string().optional(),participantLabel:F.string().optional(),platformUserId:F.string().optional(),metadata:F.record(F.string(),F.unknown()).optional()}),v1=F.object({source:F.string(),sourceEvent:F.string(),threadId:F.string(),channelId:F.string(),isDM:F.boolean(),sessionId:F.string().optional(),workspaceRoot:F.string().optional(),metadata:F.record(F.string(),F.unknown()).optional()}),I6=F.object({actor:g1,context:v1,payload:F.record(F.string(),F.unknown()).optional()}),O6=F.object({action:F.enum(["allow","deny"]).default("allow"),message:F.string().optional(),reason:F.string().optional(),metadata:F.record(F.string(),F.unknown()).optional()}),N6=F.object({adapter:F.string(),botUserName:F.string().optional(),event:S1,payload:F.record(F.string(),F.unknown()),ts:F.string()});var n1=[{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 h1(){return n1.map((f)=>({...f}))}function b6(f,$){let w=f.includeWhen;if(!w)return!0;let q=$[w.flag]??"";if(w.equals!==void 0&&q!==w.equals)return!1;if(w.notEquals!==void 0&&q===w.notEquals)return!1;return!0}function E6(f=x1){let $=new Set(h1().map((w)=>w.name));return f.filter((w)=>$.has(w.id)).map((w)=>({id:w.id,name:w.name,type:w.type,hint:w.hint,fields:w.fields.map((q)=>({flag:q.flag,label:q.label,placeholder:q.placeholder,required:q.required,help:q.help,initialValue:q.initialValue,options:q.options,includeWhen:q.includeWhen})),security:w.security?{prompt:w.security.prompt,fields:w.security.fields.map((q)=>({key:q.key,label:q.label,placeholder:q.placeholder,help:q.help,requiredMessage:q.requiredMessage}))}:void 0}))}function y6(f){return/^\d+$/.test(f)?void 0:"Telegram user ID must contain digits only"}function T6(f){return/^T[A-Z0-9]+$/.test(f)?void 0:"Slack workspace ID must start with T and contain uppercase letters or digits only"}function M6(f){return/^[UW][A-Z0-9]+$/.test(f)?void 0:"Slack member ID must start with U or W and contain uppercase letters or digits only"}var x1=[{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:y6}],argumentFlags:["--allowed-user-id","--hook-command"],buildArgs:({userId:f})=>["--allowed-user-id",f??""]}},{id:"slack",name:"Slack",type:"hybrid",hint:"Public URL for webhook mode; leave blank for socket mode.",fields:[{flag:"--bot-token",label:"Bot token",placeholder:"xoxb-...",required:!0,help:["Go to api.slack.com/apps and create a new app","Add Bot Token Scopes: chat:write, app_mentions:read, channels:history, channels:read, im:history, im:read, im:write, users:read","Install to workspace and copy the Bot Token"]},{flag:"--base-url",label:"Public base URL",placeholder:"leave blank for socket mode",help:["Enter a publicly accessible URL for webhook mode","Leave blank to use Slack socket mode instead"]},{flag:"--signing-secret",label:"Signing secret",required:!0,help:["Found in your app's Basic Information page"],includeWhen:{flag:"--base-url",notEquals:""}},{flag:"--app-token",label:"App-level token",placeholder:"xapp-...",required:!0,help:["Enable Socket Mode in the Slack app","Generate an app-level token with the connections:write scope"],includeWhen:{flag:"--base-url",equals:""}}],security:{prompt:"Restrict which Slack users can interact with the bot?",fields:[{key:"teamId",label:"Allowed Slack workspace ID",placeholder:"T01ABC123",help:["Open your Slack workspace URL in a browser","The workspace ID is the segment after /client/, for example T01ABC123"],requiredMessage:"Workspace ID is required to restrict access",validate:T6},{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:M6}],argumentFlags:["--hook-command"],buildArgs:({teamId:f,userId:$})=>["--hook-command",`jq -r ".payload.actor.participantKey" | grep -qx "slack:team:${f}:user:${$}" && echo '{"action":"allow"}' || echo '{"action":"deny"}'`]}},{id:"discord",name:"Discord",type:"webhook",hint:"Requires a Discord app and public URL.",fields:[{flag:"--application-id",aliases:["--app-id"],label:"Application ID",required:!0,help:["Go to discord.com/developers/applications","Create a new app, copy the Application ID"]},{flag:"--bot-token",aliases:["--token"],label:"Bot token",required:!0,help:["Go to Bot section, create a bot, copy the token"]},{flag:"--public-key",label:"Public key",required:!0,help:["Found in General Information of your app"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0,help:["Base URL for the connector","For Discord, set the Interactions Endpoint URL to <base-url>/api/webhooks/discord"]}]},{id:"whatsapp",name:"WhatsApp",type:"webhook",hint:"Requires Meta developer account and public URL.",fields:[{flag:"--phone-number-id",label:"Phone number ID",required:!0,help:["From your WhatsApp Business account in Meta Developer portal"]},{flag:"--access-token",label:"Access token",required:!0,help:["Generate a permanent token in Meta Developer portal"]},{flag:"--app-secret",label:"App secret",required:!0,help:["Found in App Settings > Basic"]},{flag:"--verify-token",label:"Webhook verify token",placeholder:"my-verify-token",required:!0,help:["Any string you choose, used to verify webhook setup"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"gchat",name:"Google Chat",type:"webhook",hint:"Requires Google Cloud project and public URL.",fields:[{flag:"--credentials-json",label:"Service account credentials JSON",required:!0,help:["Create a service account in Google Cloud Console","Download the credentials JSON file","Paste the JSON content here"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"linear",name:"Linear",type:"webhook",hint:"React to Linear issues and comments.",fields:[{flag:"--api-key",label:"API key",required:!0,help:["Go to Linear Settings > API > Personal API keys"]},{flag:"--webhook-secret",label:"Webhook signing secret",required:!0,help:["Go to Settings > API > Webhooks, create one","Copy the signing secret"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]}];var C6=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],S6=new Set(C6);function u1(f,$){return f.name||`extension_${String($).padStart(4,"0")}`}function z1(f){return Array.isArray(f)&&f.every(($)=>typeof $==="string")}function c1(f){if(!Array.isArray(f))return;let $=f.filter((w)=>typeof w==="string").map((w)=>w.trim()).filter((w)=>w.length>0);return $.length>0?$:void 0}function o1(f){let $=c1(f.providerIds),w=c1(f.modelIds);return{...f,...$?{providerIds:$}:{},...w?{modelIds:w}:{}}}function g6(f,$){let w=u1(f,$),q=f.manifest;if(!q||typeof q!=="object")throw Error(`Invalid manifest for extension "${w}": manifest is required`);if(!Array.isArray(q.capabilities)||q.capabilities.length===0)throw Error(`Invalid manifest for extension "${w}": capabilities must be a non-empty array`);let Y=new Set;for(let K of q.capabilities){if(!S6.has(K))throw Error(`Invalid manifest for extension "${w}": unsupported capability "${String(K)}"`);Y.add(K)}if(Object.hasOwn(q,"providerIds")&&!z1(q.providerIds))throw Error(`Invalid manifest for extension "${w}": providerIds must be a string array when provided`);if(Object.hasOwn(q,"modelIds")&&!z1(q.modelIds))throw Error(`Invalid manifest for extension "${w}": modelIds must be a string array when provided`);let X=Y.has("hooks");if(f.hooks!==void 0&&!X)throw Error(`Invalid manifest for extension "${w}": runtime hooks require the "hooks" capability`);return{capabilities:Y,raw:o1(q)}}function v6(f,$){if(!f||typeof f!=="object")throw Error(`Invalid automation event contribution for extension "${$}": expected object`);let w=typeof f.eventType==="string"?f.eventType.trim():"",q=typeof f.source==="string"?f.source.trim():"";if(!w)throw Error(`Invalid automation event contribution for extension "${$}": eventType is required`);if(!q)throw Error(`Invalid automation event contribution for extension "${$}": source is required`);return{...f,eventType:w,source:q,examples:f.examples?[...f.examples]:void 0,metadata:f.metadata?{...f.metadata}:void 0}}class C0{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]};normalized=[];phase="resolve";setupContext;constructor(f={}){this.extensions=f.extensions??[],this.setupContext=f.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((f,$)=>({extension:f,order:$,manifest:{capabilities:new Set,raw:f.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((f)=>({...f,manifest:g6(f.extension,f.order)})),this.phase="setup"}async setup(f={}){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;let $,w=[];for(let q of this.normalized){let{extension:Y}=q;if(Y.disabled)continue;let X=u1(Y,q.order),G={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},K={registerTool:(W)=>G.tools.push(W),registerCommand:(W)=>G.commands.push(W),registerRule:(W)=>{if(!q.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${X}": registerRule requires the "rules" capability`);G.rules.push(W)},registerMessageBuilder:(W)=>G.messageBuilder.push(W),registerProvider:(W)=>G.providers.push(W),registerAutomationEventType:(W)=>{if(!q.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${X}": registerAutomationEventType requires the "automationEvents" capability`);G.automationEventTypes.push(v6(W,X))},registerMcpServer:(W)=>{if(!q.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${X}": registerMcpServer requires the "mcp" capability`);G.mcpServers.push({...W,metadata:{...W.metadata??{},source:"plugin",plugin:X}})}},V=q.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await Y.setup?.(K,V),w.push(G)}catch(W){if(f.tolerateSetupErrors!==!0)throw W;$??=W}}if($&&f.tolerateSetupErrors!==!0)throw $;for(let q of w)this.registry.tools.push(...q.tools),this.registry.commands.push(...q.commands),this.registry.rules.push(...q.rules),this.registry.messageBuilder.push(...q.messageBuilder),this.registry.providers.push(...q.providers),this.registry.automationEventTypes.push(...q.automationEventTypes),this.registry.mcpServers.push(...q.mcpServers);if(this.phase="activate",$)throw $}activate(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase==="setup")throw Error("Contribution registry setup must complete before activation");if(this.phase!=="activate")return;this.phase="run"}async initialize(f={}){this.resolve(),this.validate();try{await this.setup(f)}finally{if(this.phase==="activate")this.activate()}}isActivated(){return this.phase==="run"}getRegistrySnapshot(){return{tools:[...this.registry.tools],commands:[...this.registry.commands],rules:[...this.registry.rules],messageBuilder:[...this.registry.messageBuilder],providers:[...this.registry.providers],automationEventTypes:[...this.registry.automationEventTypes],mcpServers:[...this.registry.mcpServers]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getRegisteredMcpServers(){return[...this.registry.mcpServers]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((f,$)=>f.order-$.order).map(({extension:f})=>f)}}function n6(f={}){return new C0(f)}var h6=[".js",".ts"];var l1={CLINE_PASS:"ext-cline-pass"},x6={[l1.CLINE_PASS]:!1},z6=Object.values(l1);import{z as R}from"zod";var m1=R.enum(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),l=R.record(R.string(),R.string()),c6=R.object({toolName:R.string(),parameters:l}),u6=R.object({toolName:R.string(),parameters:l,result:R.string(),success:R.boolean(),executionTimeMs:R.number()}),o6=R.object({prompt:R.string(),attachments:R.array(R.string())}),l6=R.object({taskMetadata:l}),m6=R.object({taskMetadata:l,previousState:l}),d6=R.object({taskMetadata:l}),p6=R.object({taskMetadata:l}),r6=R.object({taskId:R.string(),ulid:R.string(),contextSize:R.number(),compactionStrategy:R.string(),previousApiReqIndex:R.number(),tokensIn:R.number(),tokensOut:R.number(),tokensInCache:R.number(),tokensOutCache:R.number(),deletedRangeStart:R.number(),deletedRangeEnd:R.number(),contextJsonPath:R.string(),contextRawPath:R.string()}),d1=R.object({clineVersion:R.string(),hookName:m1,timestamp:R.string(),taskId:R.string(),sessionContext:R.object({rootSessionId:R.string().optional(),hookLogPath:R.string().optional()}).optional(),workspaceRoots:R.array(R.string()),workspaceInfo:R.custom().optional(),userId:R.string(),agent_id:R.string(),parent_agent_id:R.string().nullable(),iteration:R.number().optional(),reason:R.string().optional(),tool_call:R.object({id:R.string(),name:R.string(),input:R.unknown()}).optional(),tool_result:R.custom().optional(),turn:R.unknown().optional(),error:R.object({name:R.string(),message:R.string(),stack:R.string().optional()}).optional(),preToolUse:c6.optional(),postToolUse:u6.optional(),userPromptSubmit:o6.optional(),taskStart:l6.optional(),taskResume:m6.optional(),taskCancel:d6.optional(),taskComplete:p6.optional(),preCompact:r6.optional()}).passthrough();function s6(f){let $=d1.safeParse(f);if(!$.success)return;return $.data}var u4="v1",o4="v1",l4="v1",m4=["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 F0(f){let $=/^v(\d+)$/.exec(f?.trim()??"");if(!$)return;return Number.parseInt($[1]??"",10)}function d4(f,$="v1"){let w=F0(f.protocolVersion),q=F0($);if(w===void 0||q===void 0)return{compatible:!1,reason:"missing_protocol"};let Y=F0(f.minClientProtocolVersion)??w,X=F0(f.maxClientProtocolVersion)??w;return q>=Y&&q<=X?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var p4="approval.respond",r4="0",s4="__hubScheduleRunAt",p1=["act","plan","yolo"];function i6(f){return p1.some(($)=>$===f)}function i4(f,$){if(!f||!Object.hasOwn(f,"mode"))return $;let w=f.mode;if(i6(w))return w;throw Error(`mode must be one of: ${p1.join(", ")}`)}var a6=30000,a4=5000;function t6(f){switch(f){case"run.start":case"session.send_input":return null;default:return a6}}function t4(f,$){return $===void 0?t6(f):$}var e6=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],f$=new Set(e6);function e4(f){return typeof f==="string"&&f$.has(f)}var f3="tool_executor.",$3="custom_tool.",w3="hook.",q3="compaction.compact",Z3="checkpoint.create",Y3="mistake_limit.decide",H3="user_instructions.snapshot";function S0(f,$){return`<file_content path="${f}">
|
|
1
|
+
import{z as H}from"zod";import{z as U}from"zod";import{z as T}from"zod";var V0=["none","minimal","low","medium","high","xhigh","max"],E0=T.enum(V0),k0=E0.exclude(["none"]),Wf=T.enum([...V0,"default"]).nullable(),T0=T.discriminatedUnion("type",[T.object({type:T.literal("toggle")}).strict(),T.object({type:T.literal("effort"),values:T.array(Wf)}).strict(),T.object({type:T.literal("budget_tokens"),min:T.number().min(-1).optional(),max:T.number().min(0).optional()}).strict().refine((f)=>f.min===void 0||f.max===void 0||f.min<=f.max,{message:"Minimum reasoning budget cannot exceed maximum",path:["min"]})]);var A1=U.enum(["default","openai-responses","r1"]),Ff={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},B1=U.enum(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),I1=U.enum(["active","preview","deprecated","legacy"]),O1=U.object({input:U.number().optional(),output:U.number().optional(),cacheWrite:U.number().optional(),cacheRead:U.number().optional()}),N1=U.object({maxBudget:U.number().optional(),outputPrice:U.number().optional(),thinkingLevel:U.enum(["low","high"]).optional()}),b1=U.object({reasoningDefaultOn:U.boolean().optional()}).catchall(U.unknown()),M0=U.enum(["text","image","audio","video","pdf"]),E1=U.object({input:U.array(M0),output:U.array(M0)});function T1(f){return(f?.input===void 0||f.input.includes("text"))&&(f?.output===void 0||f.output.includes("text"))}var M1=U.enum(["language","image-generation","speech-generation","video-generation","transcription"]);function _f(f){return(f.operation===void 0||f.operation==="language")&&T1(f.modalities)}var C1=U.enum(["batch","streaming"]);function Lf(f){return f.modalities?.input.includes("text")===!0&&f.modalities.output.includes("image")}function Uf(f){return f.operation==="image-generation"}function y1(f,$,w){let q=f.capabilities;if(q===void 0||q.length===0)return w?.assumeWhenUnspecified??!1;return q.includes($)}function Df(f){return y1(f,"tools",{assumeWhenUnspecified:!0})}var W0=U.object({id:U.string(),name:U.string().optional(),description:U.string().optional(),maxTokens:U.number().optional(),contextWindow:U.number().optional(),maxInputTokens:U.number().optional(),capabilities:U.array(B1).optional(),operation:M1.optional(),operationModes:U.array(C1).optional(),modalities:E1.optional(),reasoningOptions:U.array(T0).optional(),apiFormat:A1.optional(),systemRole:U.enum(["system","developer"]).optional(),temperature:U.number().optional(),pricing:O1.optional(),thinkingConfig:N1.optional(),status:I1.optional(),deprecationNotice:U.string().optional(),replacedBy:U.string().optional(),releaseDate:U.string().optional(),deprecationDate:U.string().optional(),family:U.string().optional(),metadata:b1.optional()});import{z as g}from"zod";var C0=g.object({id:g.string(),name:g.string(),execution:g.enum(["client","provider"]).optional(),input:g.unknown(),output:g.unknown(),error:g.string().optional(),durationMs:g.number(),startedAt:g.date(),endedAt:g.date()});var Pf=H.enum(["completed","max_iterations","aborted","mistake_limit","error"]),Af=H.object({inputTokens:H.number(),outputTokens:H.number(),cacheReadTokens:H.number().optional(),cacheWriteTokens:H.number().optional(),totalCost:H.number().optional()}),b4=H.object({text:H.string(),usage:Af,messages:H.array(H.custom()),toolCalls:H.array(C0),iterations:H.number(),finishReason:Pf,model:H.object({id:H.string(),provider:H.string(),info:W0.optional()}),startedAt:H.date(),endedAt:H.date(),durationMs:H.number()}),E4=H.object({distinctId:H.string().optional(),sessionId:H.string().optional(),providerId:H.string(),modelId:H.string(),apiKey:H.string().optional(),baseUrl:H.string().url().optional(),headers:H.record(H.string(),H.string()).optional(),knownModels:H.record(H.string(),W0).optional(),providerConfig:H.unknown().optional(),initialMessages:H.array(H.custom()).optional(),systemPrompt:H.string(),tools:H.array(H.custom()),modelTools:H.array(H.custom()).optional(),maxIterations:H.number().positive().optional(),maxParallelToolCalls:H.number().int().positive().default(8),maxTokensPerTurn:H.number().positive().optional(),temperature:H.number().nonnegative().optional(),apiTimeoutMs:H.number().positive().default(180000),userFileContentLoader:H.function().input([H.string()]).output(H.promise(H.string())).optional(),toolContextMetadata:H.record(H.string(),H.unknown()).optional(),execution:H.object({maxConsecutiveMistakes:H.number().int().positive().optional(),reminderAfterIterations:H.number().nonnegative().optional(),reminderText:H.string().optional(),loopDetection:H.union([H.literal(!1),H.object({softThreshold:H.number().int().positive().optional(),hardThreshold:H.number().int().positive().optional()})]).optional()}).optional(),reasoningEffort:k0.optional(),thinkingBudgetTokens:H.number().positive().optional(),thinking:H.boolean().optional(),onEvent:H.function().input([H.custom()]).output(H.void()).optional(),hooks:H.custom().optional(),parentAgentId:H.string().optional(),extensions:H.array(H.custom()).optional(),hookErrorMode:H.enum(["ignore","throw"]).default("ignore"),toolPolicies:H.record(H.string(),H.object({enabled:H.boolean().optional(),autoApprove:H.boolean().optional()})).optional(),requestToolApproval:H.function().input([H.object({sessionId:H.string(),agentId:H.string(),conversationId:H.string(),iteration:H.number(),toolCallId:H.string(),toolName:H.string(),input:H.unknown(),policy:H.object({enabled:H.boolean().optional(),autoApprove:H.boolean().optional()}).default({})})]).output(H.union([H.object({approved:H.boolean(),reason:H.string().optional()}),H.promise(H.object({approved:H.boolean(),reason:H.string().optional()}))])).optional(),onConsecutiveMistakeLimitReached:H.function().input([H.object({iteration:H.number().int().positive(),consecutiveMistakes:H.number().int().positive(),maxConsecutiveMistakes:H.number().int().positive(),reason:H.enum(["api_error","invalid_tool_call","tool_execution_failed"]),details:H.string().optional()})]).output(H.union([H.object({action:H.literal("continue"),guidance:H.string().optional()}),H.object({action:H.literal("stop"),reason:H.string().optional()}),H.promise(H.union([H.object({action:H.literal("continue"),guidance:H.string().optional()}),H.object({action:H.literal("stop"),reason:H.string().optional()})]))])).optional(),logger:H.custom().optional(),extensionContext:H.custom().optional(),abortSignal:H.custom().optional()});import{z as F}from"zod";var S1=F.enum(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),g1=F.object({id:F.string().optional(),label:F.string().optional(),role:F.string().optional(),participantKey:F.string().optional(),participantLabel:F.string().optional(),platformUserId:F.string().optional(),metadata:F.record(F.string(),F.unknown()).optional()}),v1=F.object({source:F.string(),sourceEvent:F.string(),threadId:F.string(),channelId:F.string(),isDM:F.boolean(),sessionId:F.string().optional(),workspaceRoot:F.string().optional(),metadata:F.record(F.string(),F.unknown()).optional()}),Bf=F.object({actor:g1,context:v1,payload:F.record(F.string(),F.unknown()).optional()}),If=F.object({action:F.enum(["allow","deny"]).default("allow"),message:F.string().optional(),reason:F.string().optional(),metadata:F.record(F.string(),F.unknown()).optional()}),Of=F.object({adapter:F.string(),botUserName:F.string().optional(),event:S1,payload:F.record(F.string(),F.unknown()),ts:F.string()});var n1=[{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 h1(){return n1.map((f)=>({...f}))}function Nf(f,$){let w=f.includeWhen;if(!w)return!0;let q=$[w.flag]??"";if(w.equals!==void 0&&q!==w.equals)return!1;if(w.notEquals!==void 0&&q===w.notEquals)return!1;return!0}function bf(f=x1){let $=new Set(h1().map((w)=>w.name));return f.filter((w)=>$.has(w.id)).map((w)=>({id:w.id,name:w.name,type:w.type,hint:w.hint,fields:w.fields.map((q)=>({flag:q.flag,label:q.label,placeholder:q.placeholder,required:q.required,help:q.help,initialValue:q.initialValue,options:q.options,includeWhen:q.includeWhen})),security:w.security?{prompt:w.security.prompt,fields:w.security.fields.map((q)=>({key:q.key,label:q.label,placeholder:q.placeholder,help:q.help,requiredMessage:q.requiredMessage}))}:void 0}))}function Ef(f){return/^\d+$/.test(f)?void 0:"Telegram user ID must contain digits only"}function Tf(f){return/^T[A-Z0-9]+$/.test(f)?void 0:"Slack workspace ID must start with T and contain uppercase letters or digits only"}function Mf(f){return/^[UW][A-Z0-9]+$/.test(f)?void 0:"Slack member ID must start with U or W and contain uppercase letters or digits only"}var x1=[{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:Ef}],argumentFlags:["--allowed-user-id","--hook-command"],buildArgs:({userId:f})=>["--allowed-user-id",f??""]}},{id:"slack",name:"Slack",type:"hybrid",hint:"Public URL for webhook mode; leave blank for socket mode.",fields:[{flag:"--bot-token",label:"Bot token",placeholder:"xoxb-...",required:!0,help:["Go to api.slack.com/apps and create a new app","Add Bot Token Scopes: chat:write, app_mentions:read, channels:history, channels:read, im:history, im:read, im:write, users:read","Install to workspace and copy the Bot Token"]},{flag:"--base-url",label:"Public base URL",placeholder:"leave blank for socket mode",help:["Enter a publicly accessible URL for webhook mode","Leave blank to use Slack socket mode instead"]},{flag:"--signing-secret",label:"Signing secret",required:!0,help:["Found in your app's Basic Information page"],includeWhen:{flag:"--base-url",notEquals:""}},{flag:"--app-token",label:"App-level token",placeholder:"xapp-...",required:!0,help:["Enable Socket Mode in the Slack app","Generate an app-level token with the connections:write scope"],includeWhen:{flag:"--base-url",equals:""}}],security:{prompt:"Restrict which Slack users can interact with the bot?",fields:[{key:"teamId",label:"Allowed Slack workspace ID",placeholder:"T01ABC123",help:["Open your Slack workspace URL in a browser","The workspace ID is the segment after /client/, for example T01ABC123"],requiredMessage:"Workspace ID is required to restrict access",validate:Tf},{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:Mf}],argumentFlags:["--hook-command"],buildArgs:({teamId:f,userId:$})=>["--hook-command",`jq -r ".payload.actor.participantKey" | grep -qx "slack:team:${f}:user:${$}" && echo '{"action":"allow"}' || echo '{"action":"deny"}'`]}},{id:"discord",name:"Discord",type:"webhook",hint:"Requires a Discord app and public URL.",fields:[{flag:"--application-id",aliases:["--app-id"],label:"Application ID",required:!0,help:["Go to discord.com/developers/applications","Create a new app, copy the Application ID"]},{flag:"--bot-token",aliases:["--token"],label:"Bot token",required:!0,help:["Go to Bot section, create a bot, copy the token"]},{flag:"--public-key",label:"Public key",required:!0,help:["Found in General Information of your app"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0,help:["Base URL for the connector","For Discord, set the Interactions Endpoint URL to <base-url>/api/webhooks/discord"]}]},{id:"whatsapp",name:"WhatsApp",type:"webhook",hint:"Requires Meta developer account and public URL.",fields:[{flag:"--phone-number-id",label:"Phone number ID",required:!0,help:["From your WhatsApp Business account in Meta Developer portal"]},{flag:"--access-token",label:"Access token",required:!0,help:["Generate a permanent token in Meta Developer portal"]},{flag:"--app-secret",label:"App secret",required:!0,help:["Found in App Settings > Basic"]},{flag:"--verify-token",label:"Webhook verify token",placeholder:"my-verify-token",required:!0,help:["Any string you choose, used to verify webhook setup"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"gchat",name:"Google Chat",type:"webhook",hint:"Requires Google Cloud project and public URL.",fields:[{flag:"--credentials-json",label:"Service account credentials JSON",required:!0,help:["Create a service account in Google Cloud Console","Download the credentials JSON file","Paste the JSON content here"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"linear",name:"Linear",type:"webhook",hint:"React to Linear issues and comments.",fields:[{flag:"--api-key",label:"API key",required:!0,help:["Go to Linear Settings > API > Personal API keys"]},{flag:"--webhook-secret",label:"Webhook signing secret",required:!0,help:["Go to Settings > API > Webhooks, create one","Copy the signing secret"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]}];var Cf=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],yf=new Set(Cf);function u1(f,$){return f.name||`extension_${String($).padStart(4,"0")}`}function z1(f){return Array.isArray(f)&&f.every(($)=>typeof $==="string")}function c1(f){if(!Array.isArray(f))return;let $=f.filter((w)=>typeof w==="string").map((w)=>w.trim()).filter((w)=>w.length>0);return $.length>0?$:void 0}function o1(f){let $=c1(f.providerIds),w=c1(f.modelIds);return{...f,...$?{providerIds:$}:{},...w?{modelIds:w}:{}}}function Sf(f,$){let w=u1(f,$),q=f.manifest;if(!q||typeof q!=="object")throw Error(`Invalid manifest for extension "${w}": manifest is required`);if(!Array.isArray(q.capabilities)||q.capabilities.length===0)throw Error(`Invalid manifest for extension "${w}": capabilities must be a non-empty array`);let Y=new Set;for(let K of q.capabilities){if(!yf.has(K))throw Error(`Invalid manifest for extension "${w}": unsupported capability "${String(K)}"`);Y.add(K)}if(Object.hasOwn(q,"providerIds")&&!z1(q.providerIds))throw Error(`Invalid manifest for extension "${w}": providerIds must be a string array when provided`);if(Object.hasOwn(q,"modelIds")&&!z1(q.modelIds))throw Error(`Invalid manifest for extension "${w}": modelIds must be a string array when provided`);let X=Y.has("hooks");if(f.hooks!==void 0&&!X)throw Error(`Invalid manifest for extension "${w}": runtime hooks require the "hooks" capability`);return{capabilities:Y,raw:o1(q)}}function gf(f,$){if(!f||typeof f!=="object")throw Error(`Invalid automation event contribution for extension "${$}": expected object`);let w=typeof f.eventType==="string"?f.eventType.trim():"",q=typeof f.source==="string"?f.source.trim():"";if(!w)throw Error(`Invalid automation event contribution for extension "${$}": eventType is required`);if(!q)throw Error(`Invalid automation event contribution for extension "${$}": source is required`);return{...f,eventType:w,source:q,examples:f.examples?[...f.examples]:void 0,metadata:f.metadata?{...f.metadata}:void 0}}class y0{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]};normalized=[];phase="resolve";setupContext;constructor(f={}){this.extensions=f.extensions??[],this.setupContext=f.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((f,$)=>({extension:f,order:$,manifest:{capabilities:new Set,raw:f.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((f)=>({...f,manifest:Sf(f.extension,f.order)})),this.phase="setup"}async setup(f={}){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;let $,w=[];for(let q of this.normalized){let{extension:Y}=q;if(Y.disabled)continue;let X=u1(Y,q.order),G={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},K={registerTool:(W)=>G.tools.push(W),registerCommand:(W)=>G.commands.push(W),registerRule:(W)=>{if(!q.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${X}": registerRule requires the "rules" capability`);G.rules.push(W)},registerMessageBuilder:(W)=>G.messageBuilder.push(W),registerProvider:(W)=>G.providers.push(W),registerAutomationEventType:(W)=>{if(!q.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${X}": registerAutomationEventType requires the "automationEvents" capability`);G.automationEventTypes.push(gf(W,X))},registerMcpServer:(W)=>{if(!q.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${X}": registerMcpServer requires the "mcp" capability`);G.mcpServers.push({...W,metadata:{...W.metadata??{},source:"plugin",plugin:X}})}},V=q.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await Y.setup?.(K,V),w.push(G)}catch(W){if(f.tolerateSetupErrors!==!0)throw W;$??=W}}if($&&f.tolerateSetupErrors!==!0)throw $;for(let q of w)this.registry.tools.push(...q.tools),this.registry.commands.push(...q.commands),this.registry.rules.push(...q.rules),this.registry.messageBuilder.push(...q.messageBuilder),this.registry.providers.push(...q.providers),this.registry.automationEventTypes.push(...q.automationEventTypes),this.registry.mcpServers.push(...q.mcpServers);if(this.phase="activate",$)throw $}activate(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase==="setup")throw Error("Contribution registry setup must complete before activation");if(this.phase!=="activate")return;this.phase="run"}async initialize(f={}){this.resolve(),this.validate();try{await this.setup(f)}finally{if(this.phase==="activate")this.activate()}}isActivated(){return this.phase==="run"}getRegistrySnapshot(){return{tools:[...this.registry.tools],commands:[...this.registry.commands],rules:[...this.registry.rules],messageBuilder:[...this.registry.messageBuilder],providers:[...this.registry.providers],automationEventTypes:[...this.registry.automationEventTypes],mcpServers:[...this.registry.mcpServers]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getRegisteredMcpServers(){return[...this.registry.mcpServers]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((f,$)=>f.order-$.order).map(({extension:f})=>f)}}function vf(f={}){return new y0(f)}var nf=[".js",".ts"];var l1={CLINE_PASS:"ext-cline-pass"},hf={[l1.CLINE_PASS]:!1},xf=Object.values(l1);import{z as R}from"zod";var d1=R.enum(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),l=R.record(R.string(),R.string()),zf=R.object({toolName:R.string(),parameters:l}),cf=R.object({toolName:R.string(),parameters:l,result:R.string(),success:R.boolean(),executionTimeMs:R.number()}),uf=R.object({prompt:R.string(),attachments:R.array(R.string())}),of=R.object({taskMetadata:l}),lf=R.object({taskMetadata:l,previousState:l}),df=R.object({taskMetadata:l}),mf=R.object({taskMetadata:l}),pf=R.object({taskId:R.string(),ulid:R.string(),contextSize:R.number(),compactionStrategy:R.string(),previousApiReqIndex:R.number(),tokensIn:R.number(),tokensOut:R.number(),tokensInCache:R.number(),tokensOutCache:R.number(),deletedRangeStart:R.number(),deletedRangeEnd:R.number(),contextJsonPath:R.string(),contextRawPath:R.string()}),m1=R.object({clineVersion:R.string(),hookName:d1,timestamp:R.string(),taskId:R.string(),sessionContext:R.object({rootSessionId:R.string().optional(),hookLogPath:R.string().optional()}).optional(),workspaceRoots:R.array(R.string()),workspaceInfo:R.custom().optional(),userId:R.string(),agent_id:R.string(),parent_agent_id:R.string().nullable(),iteration:R.number().optional(),reason:R.string().optional(),tool_call:R.object({id:R.string(),name:R.string(),input:R.unknown()}).optional(),tool_result:R.custom().optional(),turn:R.unknown().optional(),error:R.object({name:R.string(),message:R.string(),stack:R.string().optional()}).optional(),preToolUse:zf.optional(),postToolUse:cf.optional(),userPromptSubmit:uf.optional(),taskStart:of.optional(),taskResume:lf.optional(),taskCancel:df.optional(),taskComplete:mf.optional(),preCompact:pf.optional()}).passthrough();function rf(f){let $=m1.safeParse(f);if(!$.success)return;return $.data}var u4="v1",o4="v1",l4="v1",d4=["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 F0(f){let $=/^v(\d+)$/.exec(f?.trim()??"");if(!$)return;return Number.parseInt($[1]??"",10)}function m4(f,$="v1"){let w=F0(f.protocolVersion),q=F0($);if(w===void 0||q===void 0)return{compatible:!1,reason:"missing_protocol"};let Y=F0(f.minClientProtocolVersion)??w,X=F0(f.maxClientProtocolVersion)??w;return q>=Y&&q<=X?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var p4="approval.respond",r4="0",s4="__hubScheduleRunAt",p1=["act","plan","yolo"];function sf(f){return p1.some(($)=>$===f)}function i4(f,$){if(!f||!Object.hasOwn(f,"mode"))return $;let w=f.mode;if(sf(w))return w;throw Error(`mode must be one of: ${p1.join(", ")}`)}var af=30000,a4=5000;function tf(f){switch(f){case"run.start":case"session.send_input":return null;default:return af}}function t4(f,$){return $===void 0?tf(f):$}var ef=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],f$=new Set(ef);function e4(f){return typeof f==="string"&&f$.has(f)}var f3="tool_executor.",$3="custom_tool.",w3="hook.",q3="compaction.compact",Z3="checkpoint.create",Y3="mistake_limit.decide",H3="user_instructions.snapshot";function S0(f,$){return`<file_content path="${f}">
|
|
2
2
|
${$}
|
|
3
|
-
</file_content>`}function $$(f,$="act"){return`<user_input mode="${$}">${f}</user_input>`}function w$(f,$){return`<user_command slash="${$}">${f}</user_command>`}function q$(f,$){return`<mode_notice>The user switched from ${f} mode to ${$} mode before sending this message.</mode_notice>`}function Z$(){let f=null;return{record($,w){if($===w)return;if(f){f=f.from===w?null:{from:f.from,to:w};return}f={from:$,to:w}},consume(){let $=f;return f=null,$}}}function Y$(f,$){let w=f.trim(),q=new RegExp(`^<${$}\\b([^>]*)>([\\s\\S]*?)<\\/${$}>$`,"i").exec(w);if(!q)return;return{attrs:q[1]??"",content:q[2]??""}}function H$(f,$){return new RegExp(`${$}="([^"]+)"`,"i").exec(f)?.[1]?.trim()||void 0}function r1(f){if(!f?.trim())return;let $=Y$(f,"user_command");if(!$)return;let w=H$($.attrs,"slash");if(!w)return;return{slash:w,content:$.content.trim()}}function s1(f){if(!f?.trim())return"";let $=f.trim();for(let w of["user_input","user_command"]){let q=a1($,w);$=(q!==$?q:$.replace(new RegExp(`<${w}[^>]*>`,"g"),"")).trim()}return $}function i1(f){if(!f?.trim())return"";return J$(f,"mode_notice").trim()}function J$(f,$){let w=`<${$}>`,q=`</${$}>`,Y=f,X=Y.indexOf(w);while(X!==-1){let G=Y.indexOf(q,X+w.length);if(G===-1)break;Y=Y.slice(0,X)+Y.slice(G+q.length),X=Y.indexOf(w,X)}return Y}function X$(f){let $=i1(s1(f)),w=r1(f);if(!w)return $;if(w.slash.toLowerCase()==="team"){let Y=$.toLowerCase().startsWith("spawn a team of agents for the following task:")?$.slice(46).trim():$;return Y?`/team ${Y}`:"/team"}return $?`/${w.slash} ${$}`:`/${w.slash}`}function a1(f,$){if(!f?.trim())return"";if(!$)return f;let w=new RegExp(`<${$}\\b[^>]*>([\\s\\S]*?)</${$}>`,"g");return f.replace(w,"$1")}import{z as N}from"zod";var a="[media omitted: invalid or exceeds size limit]",t="[Image attached — this model cannot view images]",t1=N.enum(["image","audio","video","file"]),e1=N.discriminatedUnion("type",[N.object({type:N.literal("base64"),data:N.string().min(1)}),N.object({type:N.literal("url"),url:N.string().url().refine((f)=>{let $=new URL(f).protocol;return $==="http:"||$==="https:"},"Generated media URLs must use HTTP or HTTPS")}),N.object({type:N.literal("artifact"),artifactId:N.string().min(1)})]);function ff(f){if(f.startsWith("image/"))return"image";if(f.startsWith("audio/"))return"audio";if(f.startsWith("video/"))return"video";return"file"}var $f=N.object({id:N.string().min(1),modality:t1,mediaType:N.string().min(1),source:e1,name:N.string().min(1).optional(),sizeBytes:N.number().int().nonnegative().optional()}).refine((f)=>ff(f.mediaType)===f.modality,{message:"Generated media modality must match its media type",path:["modality"]});function G$(f){return $f.safeParse(f).success}function K$(f){return ff(f)}var L0=["image/png","image/jpeg","image/gif","image/webp"],g0=5242880,v=g0,x=6291456,wf=8388608;function R$(f){return f.length}function v0(f){let $=f.endsWith("==")?2:f.endsWith("=")?1:0;return Math.floor(f.length*3/4)-$}function Q$(f=g0){return Math.floor(f*3/4)}function n0(f){return Math.ceil(f/3)*4}function h0(f={}){return{maxImageEncodedBytes:f.maxImageEncodedBytes??v,maxImageDecodedBytes:f.maxImageDecodedBytes??x,maxTotalMediaBytes:f.maxTotalMediaBytes??wf}}function U0(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function _0(f,$){f.omittedImages+=1,f.omittedReasons[$]=(f.omittedReasons[$]??0)+1}function H0(f,$,w,q){let Y=h0(w);if(f>Y.maxImageEncodedBytes){let X={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${Y.maxImageEncodedBytes} byte encoded limit`};return _0(q,X.reason),X}if($>Y.maxImageDecodedBytes){let X={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${Y.maxImageDecodedBytes} byte decoded limit`};return _0(q,X.reason),X}if(q.totalEncodedBytes+f>Y.maxTotalMediaBytes){let X={ok:!1,reason:"total_limit",message:`Image media exceeds the ${Y.maxTotalMediaBytes} byte total media limit`};return _0(q,X.reason),X}return q.totalEncodedBytes+=f,q.keptImages+=1,null}function qf(f){return f>=65&&f<=90||f>=97&&f<=122||f>=48&&f<=57||f===43||f===47}function j$(f){return f.length>0&&x0(f,0,f.length)}function V$(f,$,w){let q=Zf(f),Y=q.end-q.start;if(Y===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let X=h0($);if(w.totalEncodedBytes+Y>X.maxTotalMediaBytes)return{ok:!1,reason:"total_limit",message:`Generated media exceeds the ${X.maxTotalMediaBytes} byte total media limit`};if(!x0(f,q.start,q.end))return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let G=f.slice(q.start,q.end);return w.totalEncodedBytes+=Y,{ok:!0,base64:G,encodedBytes:Y,decodedBytes:v0(G)}}function x0(f,$,w){let q=w-$;if(q%4!==0)return!1;let Y=w;if(q>=2&&f.charCodeAt(w-2)===61&&f.charCodeAt(w-1)===61)Y-=2;else if(q>=1&&f.charCodeAt(w-1)===61)Y-=1;for(let X=$;X<Y;X++)if(!qf(f.charCodeAt(X)))return!1;for(let X=Y;X<w;X++)if(f.charCodeAt(X)!==61)return!1;return!0}function k$(f,$,w){return w-$>=5&&(f.charCodeAt($)|32)===100&&(f.charCodeAt($+1)|32)===97&&(f.charCodeAt($+2)|32)===116&&(f.charCodeAt($+3)|32)===97&&f.charCodeAt($+4)===58}function Zf(f){let $=0,w=f.length;while($<w&&/\s/.test(f[$]??""))$+=1;while(w>$&&/\s/.test(f[w-1]??""))w-=1;return{start:$,end:w}}function W$(f,$,w){if(!k$(f,$,w))return;let q=$+5,Y=f.indexOf(",",q);if(Y===-1||Y>=w)return;if(Y-q>128)return;let X=f.slice(q,Y).toLowerCase(),G=";base64";if(!X.endsWith(G))return;let K=X.slice(0,-G.length);if(!K||K.includes(";"))return;return{mediaType:K,base64Start:Y+1,base64End:w}}function Yf(f,$,w={}){let q=w.maxEncodedBytes??v,Y=w.maxDecodedBytes??x,X=new Set(w.supportedMediaTypes??L0),G=f?.toLowerCase(),K=Zf($),V=K.start,W=K.end,_=W$($,K.start,K.end);if(_){if(G&&G!==_.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${f} does not match data URL type ${_.mediaType}`};G=_.mediaType,V=_.base64Start,W=_.base64End}if(!G||!X.has(G))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${f??"unknown"}`};let L=W-V;if(L===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(L>q)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${q} byte encoded limit`};if(!x0($,V,W))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let D=$.slice(V,W),b=v0(D);if(b>Y)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${Y} byte decoded limit`};return{ok:!0,mediaType:G,base64:D,encodedBytes:L,decodedBytes:b}}function J0(f,$,w,q){let Y=Yf(f,$,{maxEncodedBytes:w.maxImageEncodedBytes,maxDecodedBytes:w.maxImageDecodedBytes});if(!Y.ok)return _0(q,Y.reason),Y;let X=H0(Y.encodedBytes,Y.decodedBytes,w,q);if(X)return X;return Y}function T(f){return f.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var X0="ERROR: EMPTY CONTENT",F$="[image attached]",_$="[generated image]";function L$(f){return`[generated ${f}]`}function D0(f){return{type:"text",text:`[generated ${f.modality} unavailable to this model]`}}function z0(f,$){let w=f[f.length-1];if($.role==="tool"&&w?.role==="tool"&&Array.isArray(w.content)&&Array.isArray($.content)){w.content.push(...$.content);return}f.push($)}function U$(f){if(!Array.isArray(f)||f.length===0)return!1;return f.every(($)=>{if(!$||typeof $!=="object")return!1;let w=$;if(w.type==="text")return typeof w.text==="string";if(w.type==="image")return typeof w.data==="string"&&typeof w.mediaType==="string";return!1})}function m(){return{type:"text",text:a}}function Hf(f){return H0(v,0,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},f)===null}function Xf(f){try{return new URL(f).protocol}catch{return}}function c0(f,$){let w=J0(f.mediaType,f.data,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$);if(!w.ok)return m();return Gf(w.base64,w.mediaType)}function Gf(f,$){return{type:"file",data:{type:"data",data:f},mediaType:$}}function e(f,$){return{type:"file",data:f,mediaType:$??"image"}}function u0(f,$){if(f.image instanceof URL){if(f.image.protocol==="data:"){let G=J0(f.mediaType,f.image.href,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$);if(!G.ok)return m();return e(`data:${G.mediaType};base64,${G.base64}`,G.mediaType)}if(f.image.protocol!=="http:"&&f.image.protocol!=="https:")return m();if(!Hf($))return m();return e(f.image,f.mediaType)}if(typeof f.image==="string"){let G=Xf(f.image);if(G==="http:"||G==="https:"){if(!Hf($))return m();return e(f.image,f.mediaType)}let K=G==="data:",V=J0(f.mediaType??(K?void 0:"image/png"),f.image,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$);if(!V.ok)return m();return e(K?`data:${V.mediaType};base64,${V.base64}`:V.base64,V.mediaType)}let w=f.image.byteLength,q=n0(w),Y=f.mediaType?.toLowerCase()??"image/png";if(!L0.includes(Y)||H0(q,w,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$))return m();return e(f.image,Y)}function D$(f,$){if(!$)return!0;if(f.modality==="file")return f.mediaType==="application/pdf"&&$.includes("pdf");return $.includes(f.modality)}function Jf(f,$,w){if(!D$(f,w))return D0(f);if(f.modality==="image"){if(f.source.type==="artifact")return D0(f);return u0({type:"image",image:f.source.type==="url"?f.source.url:f.source.data,mediaType:f.mediaType},$)}if(f.source.type==="artifact")return D0(f);if(f.source.type==="url"){let q=Xf(f.source.url);if(q!=="http:"&&q!=="https:"&&q!=="data:")return D0(f)}return e(f.source.type==="url"?f.source.url:f.source.data,f.mediaType)}function o0(f,$,w,q){let{hoistImages:Y,inlineImagePlaceholder:X}=q;if(f==null||typeof f!=="object")return{value:f,changed:!1,mediaChanged:!1};if(Array.isArray(f)){let _=[],L=!1,D=!1;for(let b of f){if(b&&typeof b==="object"){let k=b;if(k.type==="image"&&typeof k.data==="string"&&typeof k.mediaType==="string"){if(!Y){_.push(X),L=!0,D=!0;continue}let O0={type:"image",data:k.data,mediaType:k.mediaType},p=c0(O0,w);if(p.type==="file")$.push({type:"image",data:p.data.data,mediaType:p.mediaType});else _.push(p.text);L=!0,D=!0;continue}if(k.type==="image"){_.push(a),L=!0,D=!0;continue}if(k.type==="text"&&typeof k.text==="string"){_.push(k.text),L=!0;continue}}let E=o0(b,$,w,q);_.push(E.value),L||=E.changed,D||=E.mediaChanged}return{value:L?_:f,changed:L,mediaChanged:D}}let G=f;if(G.type==="image"){if(typeof G.data==="string"&&typeof G.mediaType==="string"){if(!Y)return{value:X,changed:!0,mediaChanged:!0};let _={type:"image",data:G.data,mediaType:G.mediaType},L=c0(_,w);if(L.type==="file")return $.push({type:"image",data:L.data.data,mediaType:L.mediaType}),{value:F$,changed:!0,mediaChanged:!0};return{value:L.text,changed:!0,mediaChanged:!0}}return{value:a,changed:!0,mediaChanged:!0}}let K={},V=!1,W=!1;for(let[_,L]of Object.entries(G)){let D=o0(L,$,w,q);K[_]=D.value,V||=D.changed,W||=D.mediaChanged}return{value:V?K:f,changed:V,mediaChanged:W}}function G0(f){if(typeof f==="string")return T(f);if(Array.isArray(f))return f.map(($)=>G0($));if(f!==null&&typeof f==="object"){let $=f,w={};for(let[q,Y]of Object.entries($))w[q]=G0(Y);return w}return f}function Kf(f,$=!1,w=U0(),q){let Y=q?.supportsImages??!0;if(typeof f==="string")return{type:$?"error-text":"text",value:T(f)};if(!$&&U$(f))return{type:"content",value:f.map((X)=>X.type==="image"?Y?c0(X,w):{type:"text",text:t}:{type:"text",text:T(X.text)})};if(f!==null&&typeof f==="object"){let X=[],G=o0(f,X,w,{hoistImages:!$&&Y,inlineImagePlaceholder:Y?a:t});if(!$&&X.length>0)return{type:"content",value:[{type:"text",text:typeof G.value==="string"?T(G.value):JSON.stringify(G0(G.value))},...X.map((V)=>Gf(V.data,V.mediaType))]};if(G.mediaChanged)return{type:$?"error-json":"json",value:G0(G.value)}}if(f===null||typeof f==="boolean"||typeof f==="number"||typeof f==="object")return{type:$?"error-json":"json",value:G0(f)};return{type:$?"error-text":"text",value:T(String(f))}}function P$(f,$,w){let q=w?.assistantToolCallArgKey??"input",Y=w?.supportedInputModalities,X=!Y||Y.includes("image"),G=[],K=U0(),V=[],W=()=>{return V.splice(0).map((L)=>L.type==="image"?X?u0(L,K):{type:"text",text:t}:Jf(L.media,K,Y))};if(typeof f==="string"&&f.trim().length>0||Array.isArray(f)&&f.length>0)G.push({role:"system",content:typeof f==="string"?T(f):f});for(let _ of $){let L=_.content;if(typeof L==="string"){let k=_.role==="user"&&V.length>0?W():[];if(k.length>0){G.push({role:_.role,content:[{type:"text",text:L.trim().length>0?T(L):X0},...k]});continue}if(L.trim().length===0){G.push({role:_.role,content:[{type:"text",text:X0}]});continue}G.push({role:_.role,content:T(L)});continue}let D=[],b=[];if(L.length===0){G.push({role:_.role,content:[{type:"text",text:X0}]});continue}for(let k of L)switch(k.type){case"text":D.push({type:"text",text:T(k.text),...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"reasoning":D.push({type:"reasoning",text:T(k.text),...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"image":if(_.role==="assistant")V.push(k),D.push({type:"text",text:_$});else D.push(X?u0(k,K):{type:"text",text:t});break;case"media":if(_.role==="assistant")V.push(k),D.push({type:"text",text:L$(k.media.modality)});else D.push(Jf(k.media,K,Y));break;case"file":D.push({type:"text",text:S0(k.path,T(k.content))});break;case"tool-call":if(_.role==="assistant")D.push({type:"tool-call",toolCallId:k.toolCallId,toolName:k.toolName,[q]:k.input,...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"tool-result":{b.push({type:"tool-result",toolCallId:k.toolCallId,toolName:k.toolName,output:Kf(k.output,k.isError??!1,K,{supportsImages:X})});break}}let E=b.length>0;if(_.role==="user"&&!E&&V.length>0)D.push(...W());if(D.length>0&&D.every((k)=>k.type==="text"&&typeof k.text==="string"&&k.text.trim().length===0))D.splice(0,D.length,{type:"text",text:X0});if(D.length>0)z0(G,{role:_.role,content:D});if(E)z0(G,{role:"tool",content:b})}if(V.length>0)z0(G,{role:"user",content:W()});return G}var V3=["show","hide","subscription"];function Rf(f){return typeof f==="object"&&f!==null&&!Array.isArray(f)}function A$(f,$){if(!f&&!$)return;let w=f?.metadata,q=$?.metadata,Y={...f??{},...$??{}};if(Rf(w)&&Rf(q))Y.metadata={...w,...q};return Y}var F3=["web_search","image_generation"],_3=["web_search"];var K0={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},B$=void 0;function I$(f,$){if(typeof f==="string"&&f.toLowerCase()in K0)return f.toLowerCase();return $?void 0:void 0}function Qf(f,$){let w=typeof f==="string"?f.toLowerCase():void 0;if(w&&w in K0)return K0[w];if($?.fallbackEffort)return K0[$.fallbackEffort];return}function O$(f){let $=Qf(f.effort,{fallbackEffort:f.fallbackEffort});if($===void 0)return;if($<=0)return 0;let w=f.minimumBudget??1;if(f.maxBudget<w)return;let q=f.scaleTokens??f.maxBudget;return Math.min(Math.max(Math.floor(q*$),w),f.maxBudget)}function N$(f){return f instanceof Error?{name:f.name,message:f.message}:f}var b$=3;function jf(f){return Math.max(1,Math.ceil(f/3))}function l0(f){let $=new WeakSet;try{return JSON.stringify(f,(w,q)=>{if(typeof q==="bigint")return q.toString();if(typeof q!=="object"||q===null)return q;if($.has(q))return"[Circular]";return $.add(q),q})??""}catch{return String(f??"")}}function E$(f){let $;try{$=JSON.stringify({systemPrompt:f.systemPrompt,messages:f.messages,tools:f.tools})}catch{$=[l0(f.systemPrompt),l0(f.messages),l0(f.tools)].join(`
|
|
4
|
-
`)}return
|
|
5
|
-
+`.includes(f)}function
|
|
3
|
+
</file_content>`}function $$(f,$="act"){return`<user_input mode="${$}">${f}</user_input>`}function w$(f,$){return`<user_command slash="${$}">${f}</user_command>`}function q$(f,$){return`<mode_notice>The user switched from ${f} mode to ${$} mode before sending this message.</mode_notice>`}function Z$(){let f=null;return{record($,w){if($===w)return;if(f){f=f.from===w?null:{from:f.from,to:w};return}f={from:$,to:w}},consume(){let $=f;return f=null,$}}}function Y$(f,$){let w=f.trim(),q=new RegExp(`^<${$}\\b([^>]*)>([\\s\\S]*?)<\\/${$}>$`,"i").exec(w);if(!q)return;return{attrs:q[1]??"",content:q[2]??""}}function H$(f,$){return new RegExp(`${$}="([^"]+)"`,"i").exec(f)?.[1]?.trim()||void 0}function r1(f){if(!f?.trim())return;let $=Y$(f,"user_command");if(!$)return;let w=H$($.attrs,"slash");if(!w)return;return{slash:w,content:$.content.trim()}}function s1(f){if(!f?.trim())return"";let $=f.trim();for(let w of["user_input","user_command"]){let q=a1($,w);$=(q!==$?q:$.replace(new RegExp(`<${w}[^>]*>`,"g"),"")).trim()}return $}function i1(f){if(!f?.trim())return"";return J$(f,"mode_notice").trim()}function J$(f,$){let w=`<${$}>`,q=`</${$}>`,Y=f,X=Y.indexOf(w);while(X!==-1){let G=Y.indexOf(q,X+w.length);if(G===-1)break;Y=Y.slice(0,X)+Y.slice(G+q.length),X=Y.indexOf(w,X)}return Y}function X$(f){let $=i1(s1(f)),w=r1(f);if(!w)return $;if(w.slash.toLowerCase()==="team"){let Y=$.toLowerCase().startsWith("spawn a team of agents for the following task:")?$.slice(46).trim():$;return Y?`/team ${Y}`:"/team"}return $?`/${w.slash} ${$}`:`/${w.slash}`}function a1(f,$){if(!f?.trim())return"";if(!$)return f;let w=new RegExp(`<${$}\\b[^>]*>([\\s\\S]*?)</${$}>`,"g");return f.replace(w,"$1")}import{z as N}from"zod";var a="[media omitted: invalid or exceeds size limit]",t="[Image attached — this model cannot view images]",t1=N.enum(["image","audio","video","file"]),e1=N.discriminatedUnion("type",[N.object({type:N.literal("base64"),data:N.string().min(1)}),N.object({type:N.literal("url"),url:N.string().url().refine((f)=>{let $=new URL(f).protocol;return $==="http:"||$==="https:"},"Generated media URLs must use HTTP or HTTPS")}),N.object({type:N.literal("artifact"),artifactId:N.string().min(1)})]);function f6(f){if(f.startsWith("image/"))return"image";if(f.startsWith("audio/"))return"audio";if(f.startsWith("video/"))return"video";return"file"}var $6=N.object({id:N.string().min(1),modality:t1,mediaType:N.string().min(1),source:e1,name:N.string().min(1).optional(),sizeBytes:N.number().int().nonnegative().optional()}).refine((f)=>f6(f.mediaType)===f.modality,{message:"Generated media modality must match its media type",path:["modality"]});function G$(f){return $6.safeParse(f).success}function K$(f){return f6(f)}var L0=["image/png","image/jpeg","image/gif","image/webp"],g0=5242880,v=g0,x=6291456,w6=8388608;function R$(f){return f.length}function v0(f){let $=f.endsWith("==")?2:f.endsWith("=")?1:0;return Math.floor(f.length*3/4)-$}function Q$(f=g0){return Math.floor(f*3/4)}function n0(f){return Math.ceil(f/3)*4}function h0(f={}){return{maxImageEncodedBytes:f.maxImageEncodedBytes??v,maxImageDecodedBytes:f.maxImageDecodedBytes??x,maxTotalMediaBytes:f.maxTotalMediaBytes??w6}}function U0(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function _0(f,$){f.omittedImages+=1,f.omittedReasons[$]=(f.omittedReasons[$]??0)+1}function H0(f,$,w,q){let Y=h0(w);if(f>Y.maxImageEncodedBytes){let X={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${Y.maxImageEncodedBytes} byte encoded limit`};return _0(q,X.reason),X}if($>Y.maxImageDecodedBytes){let X={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${Y.maxImageDecodedBytes} byte decoded limit`};return _0(q,X.reason),X}if(q.totalEncodedBytes+f>Y.maxTotalMediaBytes){let X={ok:!1,reason:"total_limit",message:`Image media exceeds the ${Y.maxTotalMediaBytes} byte total media limit`};return _0(q,X.reason),X}return q.totalEncodedBytes+=f,q.keptImages+=1,null}function q6(f){return f>=65&&f<=90||f>=97&&f<=122||f>=48&&f<=57||f===43||f===47}function j$(f){return f.length>0&&x0(f,0,f.length)}function V$(f,$,w){let q=Z6(f),Y=q.end-q.start;if(Y===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let X=h0($);if(w.totalEncodedBytes+Y>X.maxTotalMediaBytes)return{ok:!1,reason:"total_limit",message:`Generated media exceeds the ${X.maxTotalMediaBytes} byte total media limit`};if(!x0(f,q.start,q.end))return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let G=f.slice(q.start,q.end);return w.totalEncodedBytes+=Y,{ok:!0,base64:G,encodedBytes:Y,decodedBytes:v0(G)}}function x0(f,$,w){let q=w-$;if(q%4!==0)return!1;let Y=w;if(q>=2&&f.charCodeAt(w-2)===61&&f.charCodeAt(w-1)===61)Y-=2;else if(q>=1&&f.charCodeAt(w-1)===61)Y-=1;for(let X=$;X<Y;X++)if(!q6(f.charCodeAt(X)))return!1;for(let X=Y;X<w;X++)if(f.charCodeAt(X)!==61)return!1;return!0}function k$(f,$,w){return w-$>=5&&(f.charCodeAt($)|32)===100&&(f.charCodeAt($+1)|32)===97&&(f.charCodeAt($+2)|32)===116&&(f.charCodeAt($+3)|32)===97&&f.charCodeAt($+4)===58}function Z6(f){let $=0,w=f.length;while($<w&&/\s/.test(f[$]??""))$+=1;while(w>$&&/\s/.test(f[w-1]??""))w-=1;return{start:$,end:w}}function W$(f,$,w){if(!k$(f,$,w))return;let q=$+5,Y=f.indexOf(",",q);if(Y===-1||Y>=w)return;if(Y-q>128)return;let X=f.slice(q,Y).toLowerCase(),G=";base64";if(!X.endsWith(G))return;let K=X.slice(0,-G.length);if(!K||K.includes(";"))return;return{mediaType:K,base64Start:Y+1,base64End:w}}function Y6(f,$,w={}){let q=w.maxEncodedBytes??v,Y=w.maxDecodedBytes??x,X=new Set(w.supportedMediaTypes??L0),G=f?.toLowerCase(),K=Z6($),V=K.start,W=K.end,_=W$($,K.start,K.end);if(_){if(G&&G!==_.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${f} does not match data URL type ${_.mediaType}`};G=_.mediaType,V=_.base64Start,W=_.base64End}if(!G||!X.has(G))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${f??"unknown"}`};let L=W-V;if(L===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(L>q)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${q} byte encoded limit`};if(!x0($,V,W))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let D=$.slice(V,W),b=v0(D);if(b>Y)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${Y} byte decoded limit`};return{ok:!0,mediaType:G,base64:D,encodedBytes:L,decodedBytes:b}}function J0(f,$,w,q){let Y=Y6(f,$,{maxEncodedBytes:w.maxImageEncodedBytes,maxDecodedBytes:w.maxImageDecodedBytes});if(!Y.ok)return _0(q,Y.reason),Y;let X=H0(Y.encodedBytes,Y.decodedBytes,w,q);if(X)return X;return Y}function M(f){return f.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var X0="ERROR: EMPTY CONTENT",F$="[image attached]",_$="[generated image]";function L$(f){return`[generated ${f}]`}function D0(f){return{type:"text",text:`[generated ${f.modality} unavailable to this model]`}}function z0(f,$){let w=f[f.length-1];if($.role==="tool"&&w?.role==="tool"&&Array.isArray(w.content)&&Array.isArray($.content)){w.content.push(...$.content);return}f.push($)}function U$(f){if(!Array.isArray(f)||f.length===0)return!1;return f.every(($)=>{if(!$||typeof $!=="object")return!1;let w=$;if(w.type==="text")return typeof w.text==="string";if(w.type==="image")return typeof w.data==="string"&&typeof w.mediaType==="string";return!1})}function d(){return{type:"text",text:a}}function H6(f){return H0(v,0,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},f)===null}function X6(f){try{return new URL(f).protocol}catch{return}}function c0(f,$){let w=J0(f.mediaType,f.data,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$);if(!w.ok)return d();return G6(w.base64,w.mediaType)}function G6(f,$){return{type:"file",data:{type:"data",data:f},mediaType:$}}function e(f,$){return{type:"file",data:f,mediaType:$??"image"}}function u0(f,$){if(f.image instanceof URL){if(f.image.protocol==="data:"){let G=J0(f.mediaType,f.image.href,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$);if(!G.ok)return d();return e(`data:${G.mediaType};base64,${G.base64}`,G.mediaType)}if(f.image.protocol!=="http:"&&f.image.protocol!=="https:")return d();if(!H6($))return d();return e(f.image,f.mediaType)}if(typeof f.image==="string"){let G=X6(f.image);if(G==="http:"||G==="https:"){if(!H6($))return d();return e(f.image,f.mediaType)}let K=G==="data:",V=J0(f.mediaType??(K?void 0:"image/png"),f.image,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$);if(!V.ok)return d();return e(K?`data:${V.mediaType};base64,${V.base64}`:V.base64,V.mediaType)}let w=f.image.byteLength,q=n0(w),Y=f.mediaType?.toLowerCase()??"image/png";if(!L0.includes(Y)||H0(q,w,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$))return d();return e(f.image,Y)}function D$(f,$){if(!$)return!0;if(f.modality==="file")return f.mediaType==="application/pdf"&&$.includes("pdf");return $.includes(f.modality)}function J6(f,$,w){if(!D$(f,w))return D0(f);if(f.modality==="image"){if(f.source.type==="artifact")return D0(f);return u0({type:"image",image:f.source.type==="url"?f.source.url:f.source.data,mediaType:f.mediaType},$)}if(f.source.type==="artifact")return D0(f);if(f.source.type==="url"){let q=X6(f.source.url);if(q!=="http:"&&q!=="https:"&&q!=="data:")return D0(f)}return e(f.source.type==="url"?f.source.url:f.source.data,f.mediaType)}function o0(f,$,w,q){let{hoistImages:Y,inlineImagePlaceholder:X}=q;if(f==null||typeof f!=="object")return{value:f,changed:!1,mediaChanged:!1};if(Array.isArray(f)){let _=[],L=!1,D=!1;for(let b of f){if(b&&typeof b==="object"){let k=b;if(k.type==="image"&&typeof k.data==="string"&&typeof k.mediaType==="string"){if(!Y){_.push(X),L=!0,D=!0;continue}let O0={type:"image",data:k.data,mediaType:k.mediaType},p=c0(O0,w);if(p.type==="file")$.push({type:"image",data:p.data.data,mediaType:p.mediaType});else _.push(p.text);L=!0,D=!0;continue}if(k.type==="image"){_.push(a),L=!0,D=!0;continue}if(k.type==="text"&&typeof k.text==="string"){_.push(k.text),L=!0;continue}}let E=o0(b,$,w,q);_.push(E.value),L||=E.changed,D||=E.mediaChanged}return{value:L?_:f,changed:L,mediaChanged:D}}let G=f;if(G.type==="image"){if(typeof G.data==="string"&&typeof G.mediaType==="string"){if(!Y)return{value:X,changed:!0,mediaChanged:!0};let _={type:"image",data:G.data,mediaType:G.mediaType},L=c0(_,w);if(L.type==="file")return $.push({type:"image",data:L.data.data,mediaType:L.mediaType}),{value:F$,changed:!0,mediaChanged:!0};return{value:L.text,changed:!0,mediaChanged:!0}}return{value:a,changed:!0,mediaChanged:!0}}let K={},V=!1,W=!1;for(let[_,L]of Object.entries(G)){let D=o0(L,$,w,q);K[_]=D.value,V||=D.changed,W||=D.mediaChanged}return{value:V?K:f,changed:V,mediaChanged:W}}function G0(f){if(typeof f==="string")return M(f);if(Array.isArray(f))return f.map(($)=>G0($));if(f!==null&&typeof f==="object"){let $=f,w={};for(let[q,Y]of Object.entries($))w[q]=G0(Y);return w}return f}function K6(f,$=!1,w=U0(),q){let Y=q?.supportsImages??!0;if(typeof f==="string")return{type:$?"error-text":"text",value:M(f)};if(!$&&U$(f))return{type:"content",value:f.map((X)=>X.type==="image"?Y?c0(X,w):{type:"text",text:t}:{type:"text",text:M(X.text)})};if(f!==null&&typeof f==="object"){let X=[],G=o0(f,X,w,{hoistImages:!$&&Y,inlineImagePlaceholder:Y?a:t});if(!$&&X.length>0)return{type:"content",value:[{type:"text",text:typeof G.value==="string"?M(G.value):JSON.stringify(G0(G.value))},...X.map((V)=>G6(V.data,V.mediaType))]};if(G.mediaChanged)return{type:$?"error-json":"json",value:G0(G.value)}}if(f===null||typeof f==="boolean"||typeof f==="number"||typeof f==="object")return{type:$?"error-json":"json",value:G0(f)};return{type:$?"error-text":"text",value:M(String(f))}}function P$(f,$,w){let q=w?.assistantToolCallArgKey??"input",Y=w?.supportedInputModalities,X=!Y||Y.includes("image"),G=[],K=U0(),V=[],W=()=>{return V.splice(0).map((L)=>L.type==="image"?X?u0(L,K):{type:"text",text:t}:J6(L.media,K,Y))};if(typeof f==="string"&&f.trim().length>0||Array.isArray(f)&&f.length>0)G.push({role:"system",content:typeof f==="string"?M(f):f});for(let _ of $){let L=_.content;if(typeof L==="string"){let k=_.role==="user"&&V.length>0?W():[];if(k.length>0){G.push({role:_.role,content:[{type:"text",text:L.trim().length>0?M(L):X0},...k]});continue}if(L.trim().length===0){G.push({role:_.role,content:[{type:"text",text:X0}]});continue}G.push({role:_.role,content:M(L)});continue}let D=[],b=[];if(L.length===0){G.push({role:_.role,content:[{type:"text",text:X0}]});continue}for(let k of L)switch(k.type){case"text":D.push({type:"text",text:M(k.text),...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"reasoning":D.push({type:"reasoning",text:M(k.text),...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"image":if(_.role==="assistant")V.push(k),D.push({type:"text",text:_$});else D.push(X?u0(k,K):{type:"text",text:t});break;case"media":if(_.role==="assistant")V.push(k),D.push({type:"text",text:L$(k.media.modality)});else D.push(J6(k.media,K,Y));break;case"file":D.push({type:"text",text:S0(k.path,M(k.content))});break;case"tool-call":if(_.role==="assistant")D.push({type:"tool-call",toolCallId:k.toolCallId,toolName:k.toolName,[q]:k.input,...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"tool-result":{b.push({type:"tool-result",toolCallId:k.toolCallId,toolName:k.toolName,output:K6(k.output,k.isError??!1,K,{supportsImages:X})});break}}let E=b.length>0;if(_.role==="user"&&!E&&V.length>0)D.push(...W());if(D.length>0&&D.every((k)=>k.type==="text"&&typeof k.text==="string"&&k.text.trim().length===0))D.splice(0,D.length,{type:"text",text:X0});if(D.length>0)z0(G,{role:_.role,content:D});if(E)z0(G,{role:"tool",content:b})}if(V.length>0)z0(G,{role:"user",content:W()});return G}var V3=["show","hide","subscription"];function R6(f){return typeof f==="object"&&f!==null&&!Array.isArray(f)}function A$(f,$){if(!f&&!$)return;let w=f?.metadata,q=$?.metadata,Y={...f??{},...$??{}};if(R6(w)&&R6(q))Y.metadata={...w,...q};return Y}var F3=["web_search","image_generation"],_3=["web_search"];var K0={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},B$=void 0;function I$(f,$){if(typeof f==="string"&&f.toLowerCase()in K0)return f.toLowerCase();return $?void 0:void 0}function Q6(f,$){let w=typeof f==="string"?f.toLowerCase():void 0;if(w&&w in K0)return K0[w];if($?.fallbackEffort)return K0[$.fallbackEffort];return}function O$(f){let $=Q6(f.effort,{fallbackEffort:f.fallbackEffort});if($===void 0)return;if($<=0)return 0;let w=f.minimumBudget??1;if(f.maxBudget<w)return;let q=f.scaleTokens??f.maxBudget;return Math.min(Math.max(Math.floor(q*$),w),f.maxBudget)}function N$(f){return f instanceof Error?{name:f.name,message:f.message}:f}var b$=3;function j6(f){return Math.max(1,Math.ceil(f/3))}function l0(f){let $=new WeakSet;try{return JSON.stringify(f,(w,q)=>{if(typeof q==="bigint")return q.toString();if(typeof q!=="object"||q===null)return q;if($.has(q))return"[Circular]";return $.add(q),q})??""}catch{return String(f??"")}}function E$(f){let $;try{$=JSON.stringify({systemPrompt:f.systemPrompt,messages:f.messages,tools:f.tools})}catch{$=[l0(f.systemPrompt),l0(f.messages),l0(f.tools)].join(`
|
|
4
|
+
`)}return j6($.length)}var T$={debug:()=>{},log:()=>{},error:()=>{}};var B3=60,I3=1,O3=3600;function M$(f){return typeof f==="number"&&Number.isFinite(f)}function C$(f){return Math.min(Math.max(f,1),3600)}function N3(f){if(!M$(f))return 60;return C$(f)}function b3(f,$,w){let q=w?` (${w})`:"",Y=Math.round($/100)/10;return`MCP request to "${f}"${q} timed out after ${Y}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function y$(f){if(f instanceof Error)return f.message;return String(f)}function S$(f){if(f&&typeof f==="object"&&"code"in f&&typeof f.code==="string")return f.code;return""}class o extends Error{constructor(f,$){super(`${f} at position ${$}`);this.position=$}}function V6(f){return/^[0-9A-Fa-f]$/.test(f)}function c(f){return f>="0"&&f<="9"}function k6(f){return f>=" "}function $0(f){return`,:[]/{}()
|
|
5
|
+
+`.includes(f)}function d0(f){return f>="a"&&f<="z"||f>="A"&&f<="Z"||f==="_"||f==="$"}function P0(f){return f>="a"&&f<="z"||f>="A"&&f<="Z"||f==="_"||f==="$"||f>="0"&&f<="9"}var m0=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,p0=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function r0(f){return`,[]/{}
|
|
6
6
|
+`.includes(f)}function s0(f){return w0(f)||g$.test(f)}var g$=/^[[{\w-]$/;function i0(f){return f===`
|
|
7
|
-
`||f==="\r"||f==="\t"||f==="\b"||f==="\f"}function z(f,$){let w=f.charCodeAt($);return w===32||w===10||w===9||w===13}function
|
|
8
|
-
`,r:"\r",t:"\t"};function w1(f){let $=0,w="";if(W(["```","[```","{```"]),!X())
|
|
9
|
-
`)$++;return!0}return!1}function W(Q){if(_(Q)){if(
|
|
7
|
+
`||f==="\r"||f==="\t"||f==="\b"||f==="\f"}function z(f,$){let w=f.charCodeAt($);return w===32||w===10||w===9||w===13}function W6(f,$){let w=f.charCodeAt($);return w===32||w===9||w===13}function F6(f,$){let w=f.charCodeAt($);return w===160||w===6158||w>=8192&&w<=8203||w===8239||w===8287||w===12288||w===65279}function w0(f){return a0(f)||A0(f)}function a0(f){return f==='"'||f==="“"||f==="”"}function t0(f){return f==='"'}function A0(f){return f==="'"||f==="‘"||f==="’"||f==="`"||f==="´"}function e0(f){return f==="'"}function q0(f,$){let w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,q=f.lastIndexOf($);return q!==-1?f.substring(0,q)+(w?"":f.substring(q+1)):f}function C(f,$){let w=f.length;if(!z(f,w-1))return f+$;while(z(f,w-1))w--;return f.substring(0,w)+$+f.substring(w)}function _6(f,$,w){return f.substring(0,$)+f.substring($+w)}function L6(f){return/[,\n][ \t\r]*$/.test(f)}var v$={""":'"',"&":"&","<":"<",">":">","'":"'"},f1=12;function $1(f){if(f.charAt(0)!=="&")return null;let $=f.indexOf(";");if($===-1)return null;let w=f.substring(0,$+1),q=v$[w];if(q!==void 0)return{char:q,length:w.length};if(f.charAt(1)==="#"){let Y=f.substring(2,$),X=Y.charAt(0)==="x"||Y.charAt(0)==="X",G=X?Y.substring(1):Y;if(G.length>0){let K=Number.parseInt(G,X?16:10);if(!Number.isNaN(K)&&K>=0&&K<=1114111)return{char:String.fromCodePoint(K),length:w.length}}}return null}function U6(f){return f!==null&&f.char==='"'}function D6(f){return f!==null&&f.char==="'"}function f0(f,$){let w=0;for(let q=0;q<f.length;q++)if(f.charAt(q)===$)w++;return w}function P6(f,$){switch($){case")":return f0(f,"(")>f0(f,")");case"]":return f0(f,"[")>f0(f,"]");case"}":return f0(f,"{")>f0(f,"}");default:return!1}}var A6={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},n$={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
8
|
+
`,r:"\r",t:"\t"};function w1(f){let $=0,w="";if(W(["```","[```","{```"]),!X())jf();W(["```","```]","```}"]);let Y=L(",");if(Y)G();if(s0(f[$])&&L6(w)){if(!Y)w=C(w,",");p()}else if(Y)w=q0(w,",");while(f[$]==="}"||f[$]==="]")$++,G();if($>=f.length)return w;N0();function X(){G();let Q=k()||O0()||r()||I()||Gf()||F1(!1)||Kf();return G(),Q}function G(){let Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,j=$,P=K(Q);do if(P=V(),P)P=K(Q);while(P);return $>j}function K(Q){let j=Q?z:W6,P="";while(!0)if(j(f,$))P+=f[$],$++;else if(F6(f,$))P+=" ",$++;else break;if(P.length>0)return w+=P,!0;return!1}function V(){if(f[$]==="/"&&f[$+1]==="*"){while($<f.length&&!h$(f,$))$++;return $+=2,!0}if(f[$]==="/"&&f[$+1]==="/"){while($<f.length&&f[$]!==`
|
|
9
|
+
`)$++;return!0}return!1}function W(Q){if(_(Q)){if(d0(f[$]))while($<f.length&&P0(f[$]))$++;return G(),!0}return!1}function _(Q){K(!0);for(let j of Q){let P=$+j.length;if(f.slice($,P)===j)return $=P,!0}return!1}function L(Q){if(f[$]===Q)return w+=f[$],$++,!0;return!1}function D(Q){if(f[$]===Q)return $++,!0;return!1}function b(){return D("\\")}function E(){if(G(),f[$]==="."&&f[$+1]==="."&&f[$+2]===".")return $+=3,G(),D(","),!0;return!1}function k(){if(f[$]==="{"){if(w+="{",$++,G(),D(","))G();let Q=!0;while($<f.length&&f[$]!=="}"){let j;if(!Q){if(j=L(","),!j)w=C(w,",");G()}else j=!0;if(E(),!(r()||F1(!0))){if(f[$]==="}"||f[$]==="{"||f[$]==="]"||f[$]==="["||f[$]===void 0){if(!Q)w=q0(w,",")}else Vf();break}G();let n=L(":"),i=$>=f.length;if(!n)if(s0(f[$])||i)w=C(w,":");else U1();if(!X())if(n||i)w+="null";else U1();Q=!1}if(f[$]==="}")w+="}",$++;else w=C(w,"}");return!0}return!1}function O0(){if(f[$]==="["){if(w+="[",$++,G(),D(","))G();let Q=!0;while($<f.length&&f[$]!=="]"){if(!Q){if(!L(","))w=C(w,",")}if(E(),!X()){if(!Q)w=q0(w,",");break}Q=!1}if(f[$]==="]")w+="]",$++;else w=C(w,"]");return!0}return!1}function p(){let Q=!0,j=!0;while(j){if(!Q){if(!L(","))w=C(w,",")}else Q=!1;j=X()}if(!j)w=q0(w,",");w=`[
|
|
10
10
|
${w}
|
|
11
|
-
]`}function r(){let Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,P=f[$]==="\\";if(P){if($++,!w0(f[$]))N0()}let n=f[$]==="&"?$1(f.slice($,$+f1)):null,i=
|
|
12
|
-
`)A+="\\n",$+=2;else A+=O,$+=2}else{let O=f.charAt($);if(O==='"'&&f[$-1]!=="\\")A+=`\\${O}`,$++;else if(i0(O))A+=
|
|
11
|
+
]`}function r(){let Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1,P=f[$]==="\\";if(P){if($++,!w0(f[$]))N0()}let n=f[$]==="&"?$1(f.slice($,$+f1)):null,i=U6(n)||D6(n);if(w0(f[$])||i){let D1=t0(f[$])?t0:e0(f[$])?e0:A0(f[$])?A0:a0,Q0=$,j0=w.length,A='"';$+=i&&n?n.length:1;while(!0){if($>=f.length){let O=_1($-1);if(!Q&&$0(f.charAt(O)))return $=Q0,w=w.substring(0,j0),r(!0);return A=C(A,'"'),w+=A,!0}if($===j)return A=C(A,'"'),w+=A,!0;let h=i&&f[$]==="&"?$1(f.slice($,$+f1)):null;if(h&&n?h.char===n.char:D1(f[$])){let O=$,b0=A.length;if(A+='"',$+=h?h.length:1,w+=A,G(!1),Q||$>=f.length||$0(f[$])&&!P6(A,f[$])||w0(f[$])&&!Rf($)||c(f[$]))return W1(),!0;if(f[$]==="\\")N0();let u=_1(O-1),P1=f.charAt(u);if(P1===",")return $=Q0,w=w.substring(0,j0),r(!1,u);if($0(P1))return $=Q0,w=w.substring(0,j0),r(!0);w=w.substring(0,j0),$=O+(h?h.length:1),A=`${A.substring(0,b0)}\\${A.substring(b0)}`}else if(Q&&r0(f[$])){if(f[$-1]===":"&&m0.test(f.substring(Q0+1,$+2)))while($<f.length&&p0.test(f[$]))A+=f[$],$++;return A=C(A,'"'),w+=A,W1(),!0}else if(h){let O=h.char;if(O==='"')A+="\\\"";else if(i0(O))A+=A6[O];else A+=O;$+=h.length}else if(f[$]==="\\"){let O=f.charAt($+1);if(n$[O]!==void 0)A+=f.slice($,$+2),$+=2;else if(O==="u"){let u=2;while(u<6&&V6(f[$+u]))u++;if(u===6)A+=f.slice($,$+6),$+=6;else if($+u>=f.length)$=f.length;else kf()}else if(O===`
|
|
12
|
+
`)A+="\\n",$+=2;else A+=O,$+=2}else{let O=f.charAt($);if(O==='"'&&f[$-1]!=="\\")A+=`\\${O}`,$++;else if(i0(O))A+=A6[O],$++;else{if(!k6(O))Qf(O);A+=O,$++}}if(P)b()}}return!1}function W1(){let Q=!1;G();while(f[$]==="+"){Q=!0,$++,G(),w=q0(w,'"',!0);let j=w.length;if(r())w=_6(w,j,1);else w=C(w,'"')}return Q}function I(){let Q=$,j="",P=!1;if(f[$]==="-"){if(j+=f[$],$++,!c(f[$])&&L1())j+="0"}if(f[$]==="0"&&c(f[$+1]))P=!0;while(c(f[$]))j+=f[$],$++;if(f[$]==="."){if(j===""||j==="-")j+="0";if(j+=f[$],$++,!c(f[$]))j+="0";while(c(f[$]))j+=f[$],$++}if($>Q){if(f[$]==="e"||f[$]==="E"){if(j==="-")P=!0;if(j+=f[$],$++,f[$]==="-"||f[$]==="+")j+=f[$],$++;if(!c(f[$]))j+="0";while(c(f[$]))j+=f[$],$++}if(!L1())return $=Q,!1;return w+=P?`"${f.substring(Q,$)}"`:j,!0}return!1}function Gf(){return s("true","true")||s("false","false")||s("null","null")||s("True","true")||s("False","false")||s("None","null")}function s(Q,j){if(f.slice($,$+Q.length)===Q&&!P0(f[$+Q.length]))return w+=j,$+=Q.length,!0;return!1}function F1(Q){let j=$;if(d0(f[$])){while($<f.length&&P0(f[$]))$++;let P=$;while(z(f,P))P++;if(f[P]==="("){if($=P+1,X(),f[$]===")"){if($++,f[$]===";")$++}return!0}}while($<f.length&&!r0(f[$])&&!w0(f[$])&&(!Q||f[$]!==":"))$++;if(f[$-1]===":"&&m0.test(f.substring(j,$+2)))while($<f.length&&p0.test(f[$]))$++;if($>j){while(z(f,$-1)&&$>0)$--;let P=f.slice(j,$);if(w+=P==="undefined"?"null":JSON.stringify(P),f[$]==='"')$++;return!0}}function Kf(){if(f[$]==="/"){let Q=$;$++;while($<f.length&&(f[$]!=="/"||f[$-1]==="\\"))$++;return $++,w+=JSON.stringify(f.substring(Q,$)),!0}}function _1(Q){let j=Q;while(j>0&&z(f,j))j--;return j}function Rf(Q){let j=Q+1;while(j<f.length&&z(f,j))j++;return j>=f.length||$0(f[j])}function L1(){return $>=f.length||$0(f[$])||z(f,$)}function Qf(Q){throw new o(`Invalid character ${JSON.stringify(Q)}`,$)}function N0(){throw new o(`Unexpected character ${JSON.stringify(f[$])}`,$)}function jf(){throw new o("Unexpected end of json string",f.length)}function Vf(){throw new o("Object key expected",$)}function U1(){throw new o("Colon expected",$)}function kf(){let Q=f.slice($,$+6);throw new o(`Invalid unicode character "${Q}"`,$)}}function h$(f,$){return f[$]==="*"&&f[$+1]==="/"}function x$(f){let $=!1,w=!1,q=!1;for(let Y=0;Y<f.length;Y+=1){let X=f[Y];if(q){q=!1;continue}if(X==="\\"){q=!0;continue}if(!w&&X==='"')$=!$;else if(!$&&X==="'")w=!w}return $||w}var z$=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function c$(f){let $=f.match(z$);if(!$)return;let[,w,q]=$,Y=q.trim();if(!Y)return;let X=Y[0];if(X==='"'||X==="{"||X==="["||Y==="true"||Y==="false"||Y==="null"||Number.isFinite(Number(Y)))return;return JSON.parse(`{"${w}":${JSON.stringify(Y)}}`)}function u$(f){if(typeof f!=="string")return f;let $=f.trimStart();if($[0]!=="{"&&$[0]!=="[")return f;try{return JSON.parse($)}catch{}if(!x$($))try{return JSON.parse(w1($))}catch{}return c$($)??f}function o$(f){let $=new WeakSet;try{return JSON.stringify(f,(q,Y)=>{if(typeof Y==="bigint")return Y.toString();if(Y&&typeof Y==="object"){if($.has(Y))return"[Circular]";$.add(Y)}return Y})??"null"}catch{return String(f)}}function l$(f){try{return JSON.parse(f)}catch{return}}function Z0(f){return typeof f==="object"&&f!==null&&!Array.isArray(f)}function d$(f){let $=f.type;if(typeof $==="string")return[$];return Array.isArray($)?$.filter((w)=>typeof w==="string"):[]}function q1(f,$){if(d$(f).includes($))return!0;for(let q of["anyOf","oneOf","allOf"]){let Y=f[q];if(Array.isArray(Y)&&Y.some((X)=>Z0(X)&&q1(X,$)))return!0}return!1}function m$(f,$){if(typeof f!=="string")return f;let w=f.trim(),q=q1($,"array"),Y=q1($,"object");if((!q||!w.startsWith("["))&&(!Y||!w.startsWith("{")))return f;try{let X=JSON.parse(w);if(Array.isArray(X))return q?X:f;if(Z0(X))return Y?X:f;return f}catch{return f}}function Z1(f,$){let w=m$(f,$);if(Array.isArray(w)){let G=$.items;if(!Z0(G))return w;let K=!1,V=w.map((W)=>{let _=Z1(W,G);return K||=_!==W,_});return K?V:w}if(!Z0(w))return w;let q=$.properties;if(!Z0(q))return w;let Y=!1,X={...w};for(let[G,K]of Object.entries(q)){if(!(G in w)||!Z0(K))continue;let V=Z1(w[G],K);if(V!==w[G])X[G]=V,Y=!0}return Y?X:w}function p$(f){if(typeof globalThis.atob==="function")try{let $=globalThis.atob(f),w=Uint8Array.from($,(q)=>q.charCodeAt(0));return new TextDecoder().decode(w)}catch{return null}if(typeof Buffer<"u")try{return Buffer.from(f,"base64").toString("utf8")}catch{return null}return null}function r$(f){let $=f?.trim();if(!$)return null;try{let w=$.split(".");if(w.length!==3)return null;let q=w[1];if(!q)return null;let Y=q.replace(/-/g,"+").replace(/_/g,"/"),X=Y.padEnd(Y.length+(4-Y.length%4)%4,"="),G=p$(X);return G?JSON.parse(G):null}catch{return null}}function s$(f){return Object.fromEntries(Object.entries(f).filter(([,$])=>$!==void 0))}function i$(f){let $=f.replaceAll("\\","/"),w=$.lastIndexOf("/");return(w>=0?$.slice(w+1):$).toLowerCase()}function a$(f){return f==="win32"?"powershell":"/bin/bash"}function Y1(f){let $=i$(f);if($==="powershell"||$==="powershell.exe"||$==="pwsh"||$==="pwsh.exe")return"powershell";if($==="cmd"||$==="cmd.exe")return"cmd";if($==="wsl"||$==="wsl.exe")return"wsl";return"posix"}function B6(f,$){switch(Y1(f)){case"powershell":return{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:$};case"cmd":return{args:["/d","/s","/c",$]};case"wsl":return{args:["bash","-c",$]};case"posix":return{args:["-c",$]}}}function t$(f,$){if(Y1(f)==="powershell")return["-NoProfile","-NonInteractive","-Command",$];return B6(f,$).args}function e$(f){return f.toLowerCase().replace(/[^\w.-]+/g,"_")}function f2(f){let $=f?.trim();return $?$:void 0}function I6(f,$){if(f.length<=$)return f;return`${f.slice(0,$-1)}…`}function $2(f,$="/",w=100){if(!f||f.length<=w)return f||"";let q=f.split($)?.shift()?.trim()?.slice(0,w-1);return q?`${q}…`:I6(f,w)}function w2(f){if(f.length<=8)return"****";return`${f.slice(0,4)}...${f.slice(-4)}`}function q2(f){return f.charCodeAt(0)===65279?f.slice(1):f}function Z2(f){if(!f)return"(unknown-date)";let $=new Date(f);if(Number.isNaN($.getTime()))return f;return $.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}function Y2(f){let $=Math.max(0,Math.floor(f/1000)),w=Math.floor($/86400),q=Math.floor($%86400/3600),Y=Math.floor($%3600/60),X=$%60;if(w>0)return`${w}d ${q}h`;if(q>0)return`${q}h ${Y}m`;if(Y>0)return`${Y}m ${X}s`;return`${X}s`}import{z as O6}from"zod";function H2(f,$){let w=f.safeParse($);if(!w.success)throw Error(O6.prettifyError(w.error));return w.data}function H1(f){return O6.toJSONSchema(f)}function J1(f){return f==="cline"||f==="cline-pass"}var N6=`You are Cline, an AI coding agent. Your primary goal is to assist users with various coding tasks by leveraging your knowledge and the tools at your disposal. Given the user's prompt, you should use the tools available to you to answer user's question.
|
|
13
13
|
|
|
14
14
|
Always gather all the necessary context before starting to work on a task. For example, if you are generating a unit test or new code, make sure you understand the requirement, the naming conventions, frameworks and libraries used and aligned in the current codebase, and the environment and commands used to run and test the code etc. Always validate the new unit test at the end including running the code if possible for live feedback.
|
|
15
15
|
Review each question carefully and answer it with detailed, accurate information.
|
|
@@ -44,7 +44,7 @@ When you have completed the task, please provide a summary of what you did and a
|
|
|
44
44
|
|
|
45
45
|
If user asked a simple question without any coding context, answer it directly without using any tools.
|
|
46
46
|
{{CLINE_RULES}}
|
|
47
|
-
{{CLINE_METADATA}}`,
|
|
47
|
+
{{CLINE_METADATA}}`,b6=`You are Cline, a careful and helpful coding agent that works in the background.
|
|
48
48
|
You are tasked to solve an issue reported by the user who you cannot communicate with directly.
|
|
49
49
|
Your goal is to utilize the tools at your disposal to investigate and answer the question according to user's instructions with the aim to verify that the issue is resolved.
|
|
50
50
|
|
|
@@ -74,9 +74,9 @@ IMPORTANT:
|
|
|
74
74
|
- Always includes tool calls in your response until the task is completed. You should only end the task when all the requirements are met by calling the 'submit_and_exit' tool.
|
|
75
75
|
- Response without the submit_and_exit tool call will considered not completed and the task will continue.
|
|
76
76
|
{{CLINE_RULES}}
|
|
77
|
-
{{CLINE_METADATA}}`;var X1="# Workspace Configuration",
|
|
77
|
+
{{CLINE_METADATA}}`;var X1="# Workspace Configuration",T6=`# Plan / Act Modes
|
|
78
78
|
|
|
79
|
-
User messages arrive wrapped in a <user_input mode="..."> tag. The mode attribute is the interaction mode the user was in when they sent that message: "plan" means plan-mode constraints applied (explore, analyze, and align on a plan -- no edits or state-changing commands), while "act" (or "yolo") means implementation was allowed. If the mode attribute changes between messages, the user switched modes -- the newest message's mode is what governs right now, regardless of what earlier messages allowed. A <mode_notice> block inside a message marks exactly when such a switch happened.`,
|
|
79
|
+
User messages arrive wrapped in a <user_input mode="..."> tag. The mode attribute is the interaction mode the user was in when they sent that message: "plan" means plan-mode constraints applied (explore, analyze, and align on a plan -- no edits or state-changing commands), while "act" (or "yolo") means implementation was allowed. If the mode attribute changes between messages, the user switched modes -- the newest message's mode is what governs right now, regardless of what earlier messages allowed. A <mode_notice> block inside a message marks exactly when such a switch happened.`,M6=`# Plan Mode
|
|
80
80
|
|
|
81
81
|
You are in Plan mode. Your role is to explore, analyze, and plan -- not to execute.
|
|
82
82
|
|
|
@@ -87,14 +87,14 @@ You are in Plan mode. Your role is to explore, analyze, and plan -- not to execu
|
|
|
87
87
|
- Do NOT edit files, write code, run destructive commands, or make any changes
|
|
88
88
|
- Do NOT implement anything -- focus on understanding and alignment first
|
|
89
89
|
|
|
90
|
-
The run_commands tool remains available in plan mode strictly for read-only inspection -- listing files, searching (grep), reading configs, inspecting git history and diffs, checking tool versions, and the like. Never use it to change anything: no creating, modifying, or deleting files, no writing scripts that make changes, and no state-changing commands (installs, migrations, database or schema changes, container commands that mutate state, etc.). 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.`,
|
|
90
|
+
The run_commands tool remains available in plan mode strictly for read-only inspection -- listing files, searching (grep), reading configs, inspecting git history and diffs, checking tool versions, and the like. Never use it to change anything: no creating, modifying, or deleting files, no writing scripts that make changes, and no state-changing commands (installs, migrations, database or schema changes, container commands that mutate state, etc.). File-editing commands (rm/mv/cp, in-place edits like sed -i, output redirection to files outside /tmp, git commands that change the working tree, package installs) are hard-blocked in plan mode: they are not executed and return a tool error instead, so do not attempt them. If the task requires a mutation, put it in the plan; it happens only after the user switches to act mode.`,C6=`${M6}
|
|
91
91
|
|
|
92
|
-
Once the user has reviewed your plan and explicitly approved it in a follow-up message, use the switch_to_act_mode tool to switch to act mode and begin implementation. Calling switch_to_act_mode immediately starts execution, so never call it in the same turn you present a plan and never treat the original task request as approval -- end your turn after presenting the plan and wait for the user's response.`,
|
|
92
|
+
Once the user has reviewed your plan and explicitly approved it in a follow-up message, use the switch_to_act_mode tool to switch to act mode and begin implementation. Calling switch_to_act_mode immediately starts execution, so never call it in the same turn you present a plan and never treat the original task request as approval -- end your turn after presenting the plan and wait for the user's response.`,y6=`${M6}
|
|
93
93
|
|
|
94
|
-
Once you have presented your plan, end your turn and wait for the user's response. You do NOT have the ability to switch to act mode yourself -- the user must do it manually with the Plan/Act toggle once they are satisfied with the plan. If the task requires tools that are only available in act mode, ask the user to "toggle to Act mode" (use those words).`;function
|
|
94
|
+
Once you have presented your plan, end your turn and wait for the user's response. You do NOT have the ability to switch to act mode yourself -- the user must do it manually with the Plan/Act toggle once they are satisfied with the plan. If the task requires tools that are only available in act mode, ask the user to "toggle to Act mode" (use those words).`;function E6(f,$,w){if(w?.trim()?.includes(X1))return w.trim();let q=w||JSON.stringify({workspaces:{[f]:{hint:$||f.split("/").at(-1)||f}}},null,2);return`
|
|
95
95
|
${X1}
|
|
96
96
|
${q}`}function J2(f){let{ide:$="Terminal Shell",mode:w,platform:q="unknown",workspaceName:Y,metadata:X,rules:G,overridePrompt:K,providerId:V,planModeSwitchTool:W=!0}=f,_=f.workspaceRoot??f.rootPath??"",L=J1(V||"");if(K?.trim()){let E=K.trim();if(L&&X?.trim()&&!E.includes(X1))return`${E}
|
|
97
97
|
|
|
98
|
-
${
|
|
98
|
+
${E6(_,Y,X)}`.trim();return E}let D=w==="yolo"?b6:N6,b=[G,T6,w==="plan"?W?C6:y6:void 0].filter(Boolean).join(`
|
|
99
99
|
|
|
100
|
-
`);return D.replace("{{PLATFORM_NAME}}",q).replace("{{CWD}}",_).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",$).replace("{{CLINE_METADATA}}",L?Ef(_,Y,X):"").replace("{{CLINE_RULES}}",b).trim()}var X2="anthropic/claude-sonnet-5";var G2="remote://";import{z as J}from"zod";var Sf=J.object({id:J.string(),temperature:J.number().optional(),maxTokens:J.number().optional(),contextWindow:J.number().optional(),inputPrice:J.number().optional(),outputPrice:J.number().optional(),supportsImages:J.boolean().optional()}),gf=J.object({models:J.array(Sf).optional(),openAiBaseUrl:J.string().optional(),openAiHeaders:J.record(J.string(),J.string()).optional(),azureApiVersion:J.string().optional(),azureIdentity:J.boolean().optional()}),vf=J.object({id:J.string(),thinkingBudgetTokens:J.number().optional()}),nf=J.object({name:J.string(),baseModelId:J.string(),thinkingBudgetTokens:J.number().optional()}),hf=J.object({models:J.array(vf).optional(),customModels:J.array(nf).optional(),awsRegion:J.string().optional(),awsUseCrossRegionInference:J.boolean().optional(),awsUseGlobalInference:J.boolean().optional(),awsBedrockUsePromptCache:J.boolean().optional(),awsBedrockEndpoint:J.string().optional()}),xf=J.object({id:J.string()}),zf=J.object({models:J.array(xf).optional()}),cf=J.object({id:J.string(),thinkingBudgetTokens:J.number().optional()}),uf=J.object({models:J.array(cf).optional(),vertexProjectId:J.string().optional(),vertexRegion:J.string().optional()}),of=J.object({id:J.string(),thinkingBudgetTokens:J.number().optional(),promptCachingEnabled:J.boolean().optional()}),lf=J.object({models:J.array(of).optional(),baseUrl:J.string().optional()}),mf=J.object({id:J.string(),thinkingBudgetTokens:J.number().optional()}),df=J.object({models:J.array(mf).optional(),baseUrl:J.string().optional()}),K2=J.object({OpenAiCompatible:gf.optional(),AwsBedrock:hf.optional(),Cline:zf.optional(),Vertex:uf.optional(),LiteLLM:lf.optional(),Anthropic:df.optional()}),pf=J.object({id:J.string()}),rf=J.object({name:J.string(),url:J.string(),alwaysEnabled:J.boolean().optional(),headers:J.record(J.string(),J.string()).optional()}),G1=J.object({alwaysEnabled:J.boolean(),name:J.string(),contents:J.string()}),B0=J.object({bucket:J.string(),accessKeyId:J.string(),secretAccessKey:J.string(),region:J.string().optional(),endpoint:J.string().optional(),accountId:J.string().optional()}),sf=J.object({enabled:J.boolean().optional(),type:J.union([J.literal("s3_access_keys"),J.literal("r2_access_keys"),J.literal("azure_access_keys")]).optional(),s3AccessSettings:B0.optional(),r2AccessSettings:B0.optional(),azureAccessSettings:B0.optional()}),af=J.object({promptUploading:sf.optional()}),R2=J.object({version:J.string(),providerSettings:K2.optional(),telemetryEnabled:J.boolean().optional(),kanbanEnabled:J.boolean().optional(),mcpMarketplaceEnabled:J.boolean().optional(),allowedMCPServers:J.array(pf).optional(),remoteMCPServers:J.array(rf).optional(),blockPersonalRemoteMCPServers:J.boolean().optional(),yoloModeAllowed:J.boolean().optional(),openTelemetryEnabled:J.boolean().optional(),openTelemetryMetricsExporter:J.string().optional(),openTelemetryLogsExporter:J.string().optional(),openTelemetryOtlpProtocol:J.string().optional(),openTelemetryOtlpEndpoint:J.string().optional(),openTelemetryOtlpHeaders:J.record(J.string(),J.string()).optional(),openTelemetryOtlpMetricsProtocol:J.string().optional(),openTelemetryOtlpMetricsEndpoint:J.string().optional(),openTelemetryOtlpMetricsHeaders:J.record(J.string(),J.string()).optional(),openTelemetryOtlpLogsProtocol:J.string().optional(),openTelemetryOtlpLogsEndpoint:J.string().optional(),openTelemetryOtlpLogsHeaders:J.record(J.string(),J.string()).optional(),openTelemetryMetricExportInterval:J.number().optional(),openTelemetryOtlpInsecure:J.boolean().optional(),openTelemetryLogBatchSize:J.number().optional(),openTelemetryLogBatchTimeout:J.number().optional(),openTelemetryLogMaxQueueSize:J.number().optional(),enterpriseTelemetry:af.optional(),globalRules:J.array(G1).optional(),globalWorkflows:J.array(G1).optional()}),Q2=J.record(J.string(),J.string());var j2=4317;var V2="127.0.0.1:4317";import K1 from"zod";var k2=K1.enum(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),W2=K1.enum(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),F2=K1.enum(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var _2="runtime.team.progress.v1",L2="runtime.team.lifecycle.v1";var U2="CLINE_ENVIRONMENT",D2="CLINE_ENVIRONMENT_OVERRIDE",R1={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"}},P2="production";function tf(f){let $=f?.trim().toLowerCase();if($==="production"||$==="staging"||$==="local")return $;return}function ef(){if(typeof process>"u"||!process?.env)return{};return process.env}function f6(){let f=ef();return tf(f.CLINE_ENVIRONMENT_OVERRIDE)??tf(f.CLINE_ENVIRONMENT)??"production"}function A2(f){if(typeof f==="string")return R1[f];return R1[f6()]}function B2(f,$){if($.CLINE_API_BASE_URL)f={...f,apiBaseUrl:$.CLINE_API_BASE_URL,mcpBaseUrl:`${$.CLINE_API_BASE_URL}/v1/mcp`};return f}function I2(f){let $=A2(f);return B2($,ef())}var O2="agent.reasoning.unexpected_tokens",N2="task.provider_request_started",b2="task.provider_stream_started",E2="task.first_chunk_received",y2="task.provider_stream_failed",T2="task.cancelled",M2="sdk.error";var d=new Map;function C2(){d.clear()}function S2(f,$){let w=typeof $.error_message==="string"?$.error_message:"";return[f,$.component,$.operation,$.error_type,$.error_code??"",$.error_status??"",w.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function g2(f){let $=Date.now(),w=d.get(f);if(w&&$-w.startMs<3600000){if(w.emitted<5)return w.emitted+=1,{emit:!0,suppressed:0};return w.suppressed+=1,{emit:!1,suppressed:w.suppressed}}let q=w?.suppressed??0;if(d.delete(f),d.size>=512){let Y=d.keys().next();if(!Y.done)d.delete(Y.value)}return d.set(f,{startMs:$,emitted:1,suppressed:0}),{emit:!0,suppressed:q}}function v2(f,$){f?.capture({event:"agent.reasoning.unexpected_tokens",properties:j1({sessionId:$.sessionId,agentId:$.agentId,runId:$.runId,iteration:$.iteration,providerId:$.providerId,modelId:$.modelId,requestedThinking:$.requestedThinking,reasoningTokenCount:$.reasoningTokenCount})})}function n2(f,$){if(!f)return;f.capture({event:$.event,properties:j1({sessionId:$.sessionId,ulid:$.ulid??$.sessionId,agentId:$.agentId,conversationId:$.conversationId,runId:$.runId,iteration:$.iteration,provider:$.providerId,providerId:$.providerId,model:$.modelId,modelId:$.modelId,phase:$.phase,durationMs:$.durationMs,eventType:$.eventType,...$.error===void 0?{}:V1($.error,$.messageLimit),error_class:$.errorClass})})}function h2(f,$){if(!f)return!1;let w=$.event??"sdk.error",q=$6($),Y=0;try{let X=g2(S2(w,q));if(!X.emit)return!0;Y=X.suppressed}catch{}return f.capture({event:w,properties:Y>0?{...q,suppressed_count:Y}:q}),!0}function $6(f){return j1({...f.context??{},component:f.component,operation:f.operation,severity:f.severity??"error",handled:f.handled??!0,...V1(f.error,f.messageLimit,f.errorMessage)})}function j1(f){let $={};for(let[w,q]of Object.entries(f))if(q!==void 0)$[w]=q;return $}function V1(f,$=500,w){let q=c2(f)?f:void 0,Y=f instanceof Error?f:void 0,X=R0(w)??R0(Y?.message)??R0(q?.message)??u2(f)??"Unknown error",G=o2(q?.code),K=Q1(q?.status)??Q1(q?.statusCode)??Q1(q?.responseStatus);return{error_type:Y?.name?.trim()||R0(q?.name)||Y?.constructor?.name||"Error",error_message:z2(x2(X),$),...G!==void 0?{error_code:G}:{},...K!==void 0?{error_status:K}:{}}}function x2(f){return f.replace(/(authorization=Bearer\s+)[^&\s]+/gi,"$1[redacted]").replace(/(api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|password|secret)=([^&\s]+)/gi,"$1=[redacted]").replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,"$1[redacted]").replace(/\/Users\/[^/\s]+/g,"/Users/[redacted]").replace(/\/home\/[^/\s]+/g,"/home/[redacted]").replace(/([A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s]+/g,"$1[redacted]")}function z2(f,$){let w=Math.max(1,Math.floor($));return f.length>w?f.substring(0,w):f}function c2(f){return typeof f==="object"&&f!==null}function R0(f){return typeof f==="string"&&f.trim().length>0?f:void 0}function u2(f){if(f instanceof Error)return;let $=typeof f==="string"?f:String(f);return $==="[object Object]"?void 0:R0($)}function o2(f){if(typeof f==="string"&&f.trim().length>0)return f;if(typeof f==="number"&&Number.isFinite(f))return f;return}function Q1(f){return typeof f==="number"&&Number.isFinite(f)?f:void 0}function w6(f){let $={};if(!f)return $;return f.split(",").forEach((w)=>{let q=w.indexOf("=");if(q<=0)return;try{let Y=decodeURIComponent(w.substring(0,q).trim()),X=decodeURIComponent(w.substring(q+1).trim());if(!Y||!X)return;$[Y]=X}catch{}}),$}function l2(){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?w6(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function q6(f={}){return{extension_version:"unknown",cline_type:"unknown",platform:"terminal",platform_version:process?.version||"unknown",os_type:process?.platform||"unknown",os_version:process?.platform==="win32"?process?.env?.OS??"unknown":"unknown",...f}}function m2(f={}){return{...l2(),...f,metadata:q6(f.metadata)}}function Z6(f){let $=f?.trim();return $?$:void 0}function d2(f,$){if(!f)return;let w=typeof f==="function"?f($):f;if(!w)return;let q=Z6(w.rootSessionId);if(!q)return;return{rootSessionId:q}}function p2(f){return Z6(f?.rootSessionId)}var r2=(f)=>crypto.getRandomValues(new Uint8Array(f)),s2=(f,$,w)=>{let q=256-256%f.length;if(q===256){let X=f.length-1;return(G=$)=>{if(!G)return"";let K="";while(!0){let V=w(G),W=G;while(W--)if(K+=f[V[W]&X],K.length>=G)return K}}}let Y=Math.ceil(409.6*$/q);return(X=$)=>{if(!X)return"";let G="";while(!0){let K=w(Y),V=Y;while(V--)if(K[V]<q){if(G+=f[K[V]%f.length],G.length>=X)return G}}}},Y6=(f,$=21)=>s2(f,$|0,r2);function i2(f="",$=""){let w=Y6("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${f}${Date.now()}_${w(5)}${$}`}var a2=["idle","running","pending","completed","failed","cancelled"];var k1=["rules","skills","workflows","plugins","hooks"],H6=k1,t2=new Set(k1);function J6(f){return typeof f==="string"&&t2.has(f)}function e2(f){if(!Array.isArray(f))return;let $=f.map((w)=>typeof w==="string"?w.trim():"").filter(J6);return[...new Set($)]}function f4(f,$){return new Set(f??H6).has($)}import{z as C}from"zod";var $4=C.object({rootPath:C.string().min(1),hint:C.string().min(1).optional(),associatedRemoteUrls:C.array(C.string().min(1)).optional(),latestGitCommitHash:C.string().min(1).optional(),latestGitBranchName:C.string().min(1).optional()}),w4=C.object({currentWorkspacePath:C.string().min(1).optional(),workspaces:C.record(C.string().min(1),$4)});function U8(){return{workspaces:{}}}function D8(f,$){let w={...f,workspaces:{...f.workspaces,[$.rootPath]:$}};if(!w.currentWorkspacePath)w.currentWorkspacePath=$.rootPath;return w4.parse(w)}var q4="workspaces",Z4="chat";function Y4(f){let $=f.trim(),w=/^[A-Za-z]:[\\/]/.test($)||$.startsWith("\\\\"),q=$.startsWith("/");if(!w&&!q)return!1;let Y=$.split(w?/[\\/]+/:/\/+/).filter(Boolean),X=Y.at(-1)??"",G=Y.at(-2)??"",K=Y.at(-3)??"";return(Y.at(-4)??"")===".cline"&&K==="data"&&G==="workspaces"&&X==="chat"}import{z as Z}from"zod";var H4=["current_state","boundary_analysis","interface_proposal"],I8=3600000,O8=240,N8=400,S=Z.preprocess((f)=>f instanceof Date?f.toISOString():f,Z.string().datetime()),Y0=Z.enum(["pending","in_progress","blocked","completed"]),X6=Z.enum(["queued","running","completed","failed","cancelled","interrupted"]),I0=Z.enum(["draft","in_review","finalized"]),J4=Z.object({agentId:Z.string(),role:Z.enum(["lead","teammate"]),description:Z.string().optional(),status:Z.enum(["idle","running","stopped"])}),b8=Z.object({agentId:Z.string(),rolePrompt:Z.string(),modelId:Z.string().optional(),maxIterations:Z.number().optional()});function B(f){return Z.preprocess(($)=>$===null?void 0:$,f.optional())}var E8=Z.object({agentId:Z.string().min(1).describe("Teammate identifier"),rolePrompt:Z.string().min(1).describe("System prompt describing teammate role")}).strict(),y8=Z.object({agentId:Z.string().min(1).describe("Teammate identifier"),reason:B(Z.string().min(1)).describe("Optional shutdown reason")}),T8=Z.object({}),X4={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},M8={create:["status","taskId","summary","reason"]},C8=Z.object({action:Z.enum(["create","list","claim","complete","block"]),title:B(Z.string().min(1)).describe("Task title"),description:B(Z.string().min(1)).describe("Task details"),dependsOn:B(Z.array(Z.string().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:B(Z.string().min(1)).describe("Optional assignee"),status:B(Z.enum(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:B(Z.string()).describe("Task ID"),summary:B(Z.string().min(1)).describe("Completion summary"),reason:B(Z.string().min(1)).describe("Blocking reason")}).superRefine((f,$)=>{for(let w of X4[f.action]){if(f[w]!==void 0)continue;$.addIssue({code:"custom",path:[w],message:`Field "${w}" is required when action=${f.action}`})}}),S8=Z.object({agentId:Z.string().describe("Teammate agent ID"),task:Z.string().min(1).describe("Task instructions for the teammate"),taskId:B(Z.string()).describe("Optional shared task list ID"),runMode:B(Z.enum(["sync","async"])).describe("Execution mode: 'sync' blocks until the teammate finishes and returns the result (default if omitted); 'async' queues the run and returns a runId immediately — use team_await_runs to collect results later."),continueConversation:B(Z.boolean()).describe("If true, continue the teammate conversation; otherwise start fresh")}),g8=Z.object({status:B(Z.enum(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:B(Z.string().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:B(Z.boolean()).describe("Include completed/failed runs (default true)")}),v8=Z.object({runId:Z.string().min(1).describe("Run ID"),reason:B(Z.string().min(1)).describe("Optional cancellation reason")}),n8=Z.object({runId:B(Z.string().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),h8=Z.object({toAgentId:Z.string().min(1).describe("Recipient agent ID"),subject:Z.string().min(1).describe("Message subject"),body:Z.string().min(1).describe("Message body"),taskId:B(Z.string().min(1)).describe("Optional task ID context")}),x8=Z.object({subject:Z.string().min(1).describe("Message subject"),body:Z.string().min(1).describe("Message body"),taskId:B(Z.string().min(1)).describe("Optional task ID context")}),z8=Z.object({unreadOnly:B(Z.boolean()).describe("Only unread messages for read action (default true)")}),c8=Z.object({kind:Z.enum(["progress","handoff","blocked","decision","done","error"]),summary:Z.string().min(1).describe("Update summary"),taskId:B(Z.string().min(1)).describe("Optional task ID context"),evidence:B(Z.array(Z.string().min(1))).describe("Optional evidence links/snippets"),nextAction:B(Z.string().min(1)).describe("Planned next step")}),u8=Z.object({}),o8=Z.object({title:Z.string().describe("Outcome title"),requiredSections:Z.array(Z.string()).default(H4).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),l8=Z.object({outcomeId:Z.string().describe("Outcome ID"),section:Z.string().describe("Section name"),sourceRunId:B(Z.string()).describe("Optional source run ID"),content:Z.string().describe("Section fragment content")}),m8=Z.object({fragmentId:Z.string().describe("Fragment ID"),approved:Z.boolean().describe("Review decision")}),d8=Z.object({outcomeId:Z.string().describe("Outcome ID")}),p8=Z.object({}),r8=Z.object({teamId:Z.string(),teamName:Z.string(),members:Z.array(J4),taskCounts:Z.record(Y0,Z.number()),unreadMessages:Z.number(),missionLogEntries:Z.number(),activeRuns:Z.number(),queuedRuns:Z.number(),outcomeCounts:Z.record(I0,Z.number())}),G4=Z.object({id:Z.string(),title:Z.string(),description:Z.string(),status:Y0,createdAt:S,updatedAt:S,createdBy:Z.string(),assignee:Z.string().optional(),dependsOn:Z.array(Z.string()),summary:Z.string().optional(),isReady:Z.boolean(),blockedBy:Z.array(Z.string())}),s8=Z.discriminatedUnion("action",[Z.object({action:Z.literal("create"),taskId:Z.string(),status:Y0,ignoredFields:Z.array(Z.string()).optional(),note:Z.string().optional()}),Z.object({action:Z.literal("list"),tasks:Z.array(G4)}),Z.object({action:Z.literal("claim"),taskId:Z.string(),status:Y0,nextStep:Z.string()}),Z.object({action:Z.literal("complete"),taskId:Z.string(),status:Y0}),Z.object({action:Z.literal("block"),taskId:Z.string(),status:Y0})]),i8=Z.object({agentId:Z.string(),mode:Z.enum(["sync","async"]),status:Z.enum(["dispatched","running","queued","joined"]),dispatched:Z.boolean(),message:Z.string(),deduped:Z.boolean().optional(),runId:Z.string().optional(),text:Z.string().optional(),iterations:Z.number().optional()}),K4=Z.object({textPreview:Z.string(),iterations:Z.number(),finishReason:Z.string(),durationMs:Z.number(),usage:Z.object({inputTokens:Z.number(),outputTokens:Z.number(),cacheReadTokens:Z.number().optional(),cacheWriteTokens:Z.number().optional(),totalCost:Z.number().optional()})}),a8=Z.object({id:Z.string(),agentId:Z.string(),taskId:Z.string().optional(),status:X6,messagePreview:Z.string(),priority:Z.number(),retryCount:Z.number(),maxRetries:Z.number(),nextAttemptAt:S.optional(),continueConversation:Z.boolean().optional(),startedAt:S,endedAt:S.optional(),leaseOwner:Z.string().optional(),heartbeatAt:S.optional(),lastProgressAt:S.optional(),lastProgressMessage:Z.string().optional(),currentActivity:Z.string().optional(),error:Z.string().optional(),resultSummary:K4.optional()}),t8=Z.object({id:Z.string(),teamId:Z.string(),fromAgentId:Z.string(),toAgentId:Z.string(),subject:Z.string(),body:Z.string(),taskId:Z.string().optional(),sentAt:S,readAt:S.optional()}),e8=Z.object({id:Z.string(),teamId:Z.string(),title:Z.string(),status:I0,requiredSections:Z.array(Z.string()),createdBy:Z.string(),createdAt:S,finalizedAt:S.optional()}),fw=Z.object({outcomeId:Z.string(),status:I0,requiredSections:Z.array(Z.string())}),$w=Z.object({agentId:Z.string(),status:Z.string()}),ww=Z.object({runId:Z.string(),status:X6}),qw=Z.object({id:Z.string(),toAgentId:Z.string()}),Zw=Z.object({delivered:Z.number()}),Yw=Z.object({id:Z.string()}),Hw=Z.object({status:Z.string()}),Jw=Z.object({fragmentId:Z.string(),status:Z.string()}),Xw=Z.object({outcomeId:Z.string(),status:I0});var R4;((I)=>{I.TaskStart="task_start";I.TaskEnd="task_end";I.AgentEvent="agent_event";I.TeammateSpawned="teammate_spawned";I.TeammateShutdown="teammate_shutdown";I.TeamTaskUpdated="team_task_updated";I.TeamMessage="team_message";I.TeamMissionLog="team_mission_log";I.TeamTaskCompleted="team_task_completed";I.RunStarted="run_started";I.RunQueued="run_queued";I.RunProgress="run_progress";I.RunCompleted="run_completed";I.RunFailed="run_failed";I.RunCancelled="run_cancelled";I.RunInterrupted="run_interrupted";I.OutcomeCreated="outcome_created";I.OutcomeFragmentAttached="outcome_fragment_attached";I.OutcomeFragmentReviewed="outcome_fragment_reviewed";I.OutcomeFinalized="outcome_finalized"})(R4||={});import{z as Q4}from"zod";function j4(f){let{$schema:$,...w}=f;if(typeof w.type==="string")return w;if("properties"in w||"required"in w||"additionalProperties"in w)return{type:"object",...w};for(let q of["oneOf","anyOf","allOf"]){let Y=w[q];if(!Array.isArray(Y)||Y.length===0)continue;if(q==="allOf"){if(Y.some((K)=>K&&typeof K==="object"&&K.type==="object"))return{type:"object",...w};throw Error('Tool inputSchema must describe an object at the top level, but the schema has a top-level "allOf" with no branch that asserts type: "object". Add type: "object" to at least one allOf branch to make the object constraint explicit.')}if(Y.every((G)=>G&&typeof G==="object"&&G.type==="object"))return{type:"object",...w};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${q}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return w}function V4(f){let $=j4(f.inputSchema instanceof Q4.ZodType?H1(f.inputSchema):f.inputSchema);return{name:f.name,description:f.description,inputSchema:$,lifecycle:f.lifecycle,timeoutMs:f.timeoutMs??30000,retryable:f.retryable??!0,maxRetries:f.maxRetries??3,execute:f.execute}}var G6=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function k4(f){let $=(f instanceof Error?f.message:String(f)).toLowerCase();return G6.some((w)=>$.includes(w))}export{H1 as zodToJsonSchema,a1 as xmlTagsRemoval,H2 as validateWithZod,Yf as validateImageMedia,J0 as validateAndReserveImageMedia,V$ as validateAndReserveBase64Media,D6 as usesImageGenerationOperation,D8 as upsertWorkspaceInfo,If as truncateStr,$2 as truncateSplit,f2 as trimNonEmpty,Kf as toAiSdkToolResultOutput,y1 as supportsChatModalities,q2 as stripUtf8Bom,i1 as stripModeNotices,b6 as shouldIncludeConnectorField,N$ as serializeAbortReason,T as sanitizeSurrogates,e$ as sanitizeFileName,o$ as safeJsonStringify,l$ as safeJsonParse,p2 as resolveRootSessionId,Qf as resolveReasoningEffortRatio,O$ as resolveReasoningBudgetFromRatio,h0 as resolveMediaBudget,N3 as resolveMcpTimeoutSeconds,t4 as resolveHubCommandTimeoutMs,d2 as resolveHookSessionContext,I$ as resolveEffectiveReasoningEffort,f6 as resolveClineEnvironment,C2 as resetSdkErrorRateLimiterForTests,H0 as reserveImageMediaBytes,i4 as readHubScheduleMode,r1 as parseUserCommandEnvelope,e2 as parseRuntimeConfigExtensions,u$ as parseJsonStream,s6 as parseHookEventPayload,s$ as omitUndefinedValues,s1 as normalizeUserInput,V1 as normalizeSdkError,o1 as normalizePluginManifest,Z1 as normalizeJsonLikeStringsForSchema,y$ as noopBasicLogger,P6 as modelSupportsToolCalling,U6 as modelProducesImages,C1 as modelHasCapability,A$ as mergeModelOptions,w2 as maskSecret,h1 as listConnectorCatalog,J6 as isRuntimeConfigExtensionKind,T$ as isMcpTimeoutConfigured,k4 as isLikelyAuthError,e4 as isHubToolExecutorName,i6 as isHubScheduleMode,d4 as isHubProtocolCompatible,G$ as isGeneratedMedia,J1 as isClineProvider,Y4 as isChatWorkspacePath,L6 as isChatCompatibleModel,j$ as isCanonicalBase64,qf as isBase64Char,Q$ as imageFileMaxDecodedBytesForBase64Limit,n0 as imageBase64LengthForDecodedBytes,R$ as imageBase64EncodedByteLength,v0 as imageBase64DecodedByteLength,f4 as hasRuntimeConfigExtension,Y1 as getShellKind,Bf as getShellInvocation,t$ as getShellArgs,C$ as getErrorMessage,S$ as getErrorCode,a$ as getDefaultShell,t6 as getDefaultHubCommandTimeoutMs,I2 as getClineEnvironmentConfig,K$ as generatedMediaModalityFromMediaType,$$ as formatUserInputBlock,w$ as formatUserCommandBlock,Y2 as formatUptime,q$ as formatModeSwitchNotice,P$ as formatMessagesForAiSdk,b3 as formatMcpTimeoutErrorMessage,Z2 as formatHumanReadableDate,S0 as formatFileContentBlock,X$ as formatDisplayUserInput,jf as estimateTokens,E$ as estimateRequestInputTokens,U8 as emptyWorkspaceManifest,r$ as decodeJwtPayload,V4 as createTool,i2 as createSessionId,Z$ as createModeSwitchNoticeTracker,U0 as createMediaBudgetState,n6 as createContributionRegistry,q6 as createClineTelemetryServiceMetadata,m2 as createClineTelemetryServiceConfig,E6 as connectorChannelsFromPlatforms,M$ as clampMcpTimeoutSeconds,n2 as captureTaskLifecycleEvent,h2 as captureSdkError,v2 as captureAgentUnexpectedReasoningTokens,$6 as buildSdkErrorProperties,J2 as buildClineSystemPrompt,w4 as WorkspaceManifestSchema,$4 as WorkspaceInfoSchema,uf as VertexSettingsSchema,cf as VertexModelSchema,V3 as USAGE_COST_DISPLAYS,M0 as ToolCallRecordSchema,N1 as ThinkingConfigSchema,b8 as TeamTeammateSpecSchema,s8 as TeamTaskToolResultSchema,G4 as TeamTaskListItemToolResultSchema,C8 as TeamTaskInputSchema,r8 as TeamStatusToolResultSchema,T8 as TeamStatusInputSchema,E8 as TeamSpawnTeammateInputSchema,$w as TeamSimpleAgentStatusToolResultSchema,y8 as TeamShutdownTeammateInputSchema,qw as TeamSendMessageToolResultSchema,h8 as TeamSendMessageInputSchema,a8 as TeamRunToolSummarySchema,i8 as TeamRunTaskToolResultSchema,S8 as TeamRunTaskInputSchema,K4 as TeamRunResultSummarySchema,m8 as TeamReviewOutcomeFragmentInputSchema,z8 as TeamReadMailboxInputSchema,e8 as TeamOutcomeToolResultSchema,Jw as TeamOutcomeFragmentToolResultSchema,Yw as TeamMissionLogToolResultSchema,c8 as TeamMissionLogInputSchema,R4 as TeamMessageType,t8 as TeamMailboxMessageToolResultSchema,g8 as TeamListRunsInputSchema,p8 as TeamListOutcomesInputSchema,Xw as TeamFinalizeOutcomeToolResultSchema,d8 as TeamFinalizeOutcomeInputSchema,fw as TeamCreateOutcomeToolResultSchema,o8 as TeamCreateOutcomeInputSchema,Hw as TeamCleanupToolResultSchema,u8 as TeamCleanupInputSchema,ww as TeamCancelRunToolResultSchema,v8 as TeamCancelRunInputSchema,Zw as TeamBroadcastToolResultSchema,x8 as TeamBroadcastInputSchema,n8 as TeamAwaitRunsInputSchema,l8 as TeamAttachOutcomeFragmentInputSchema,M8 as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,N8 as TEAM_RUN_TEXT_PREVIEW_LIMIT,O8 as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,_2 as TEAM_PROGRESS_EVENT_TYPE,L2 as TEAM_LIFECYCLE_EVENT_TYPE,I8 as TEAM_AWAIT_TIMEOUT_MS,b2 as TASK_PROVIDER_STREAM_STARTED_EVENT,y2 as TASK_PROVIDER_STREAM_FAILED_EVENT,N2 as TASK_PROVIDER_REQUEST_STARTED_EVENT,E2 as TASK_FIRST_CHUNK_RECEIVED_EVENT,T2 as TASK_CANCELLED_EVENT,L0 as SUPPORTED_IMAGE_MEDIA_TYPES,a2 as SESSION_STATUS_VALUES,M2 as SDK_ERROR_TELEMETRY_EVENT,B0 as S3AccessKeySettingsSchema,rf as RemoteMCPServerSchema,R2 as RemoteConfigSchema,E0 as ReasoningLevelSchema,k0 as ReasoningEffortSchema,k1 as RUNTIME_CONFIG_EXTENSION_KINDS,G2 as REMOTE_URI_SCHEME,V0 as REASONING_LEVELS,K0 as REASONING_EFFORT_RATIOS,W2 as ProviderProtocolSchema,F2 as ProviderClientSchema,k2 as ProviderCapabilitySchema,sf as PromptUploadingSchema,h6 as PLUGIN_FILE_EXTENSIONS,Cf as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,Mf as PLAN_MODE_INSTRUCTIONS,gf as OpenAiCompatibleSchema,Sf as OpenAiCompatibleModelSchema,s4 as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,r4 as ONE_TIME_SCHEDULE_CRON_PATTERN,I1 as ModelStatusSchema,y0 as ModelReasoningOptionSchema,O1 as ModelPricingSchema,T1 as ModelOperationSchema,M1 as ModelOperationModeSchema,T0 as ModelModalitySchema,E1 as ModelModalitiesSchema,b1 as ModelMetadataSchema,W0 as ModelInfoSchema,B1 as ModelCapabilitySchema,yf as MODE_TAG_INSTRUCTIONS,F3 as MODEL_TOOL_NAMES,I3 as MIN_MCP_TIMEOUT_SECONDS,o4 as MIN_CLIENT_HUB_PROTOCOL_VERSION,O3 as MAX_MCP_TIMEOUT_SECONDS,l4 as MAX_CLIENT_HUB_PROTOCOL_VERSION,lf as LiteLLMSchema,of as LiteLLMModelSchema,t as IMAGE_UNSUPPORTED_PLACEHOLDER,a as IMAGE_OMITTED_PLACEHOLDER,d1 as HookEventPayloadSchema,m1 as HookEventNameSchema,H3 as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,e6 as HUB_TOOL_EXECUTOR_NAMES,f3 as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,p1 as HUB_SCHEDULE_MODES,Y3 as HUB_MISTAKE_LIMIT_CAPABILITY,w3 as HUB_HOOK_CAPABILITY_PREFIX,a6 as HUB_DEFAULT_COMMAND_TIMEOUT_MS,$3 as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,q3 as HUB_COMPACTION_CAPABILITY,a4 as HUB_COMMAND_SLOW_LOG_MS,p4 as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,Z3 as HUB_CHECKPOINT_CAPABILITY,m4 as HUB_CAPABILITIES,G1 as GlobalInstructionsFileSchema,e1 as GeneratedMediaSourceSchema,$f as GeneratedMediaSchema,t1 as GeneratedMediaModalitySchema,x6 as FeatureFlagDefaultValue,z6 as FEATURE_FLAGS,af as EnterpriseTelemetrySchema,X0 as EMPTY_CONTENT_TEXT,H6 as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,B$ as DEFAULT_REASONING_EFFORT,H4 as DEFAULT_OUTCOME_REQUIRED_SECTIONS,B3 as DEFAULT_MCP_TIMEOUT_SECONDS,wf as DEFAULT_MAX_TOTAL_MEDIA_BYTES,v as DEFAULT_MAX_IMAGE_ENCODED_BYTES,x as DEFAULT_MAX_IMAGE_DECODED_BYTES,g0 as DEFAULT_MAX_IMAGE_BASE64_BYTES,P2 as DEFAULT_CLINE_ENVIRONMENT,C0 as ContributionRegistry,N6 as ConnectorHookEventSchema,S1 as ConnectorHookEventNameSchema,v1 as ConnectorEventContextSchema,g1 as ConnectorEventActorSchema,I6 as ConnectorAuthorizationRequestSchema,O6 as ConnectorAuthorizationDecisionSchema,zf as ClineSettingsSchema,xf as ClineModelSchema,u4 as CURRENT_HUB_PROTOCOL_VERSION,x1 as CONNECTOR_PLATFORMS,n1 as CONNECTOR_CATALOG,_3 as CONFIGURABLE_MODEL_TOOL_NAMES,q4 as CLINE_WORKSPACES_DIRECTORY_NAME,D2 as CLINE_ENVIRONMENT_OVERRIDE_ENV,U2 as CLINE_ENVIRONMENT_ENV,R1 as CLINE_ENVIRONMENTS,j2 as CLINE_DEFAULT_RPC_PORT,V2 as CLINE_DEFAULT_RPC_ADDRESS,X2 as CLINE_DEFAULT_MODEL_ID,Z4 as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,b$ as CHARS_PER_TOKEN,hf as AwsBedrockSettingsSchema,vf as AwsBedrockModelSchema,nf as AwsBedrockCustomModelSchema,A1 as ApiFormatSchema,_6 as ApiFormat,df as AnthropicSchema,mf as AnthropicModelSchema,pf as AllowedMCPServerSchema,B6 as AgentUsageSchema,b4 as AgentResultSchema,A6 as AgentFinishReasonSchema,E4 as AgentConfigSchema,G6 as AUTH_ERROR_PATTERNS,Q2 as APIKeySchema,O2 as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT};
|
|
100
|
+
`);return D.replace("{{PLATFORM_NAME}}",q).replace("{{CWD}}",_).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",$).replace("{{CLINE_METADATA}}",L?E6(_,Y,X):"").replace("{{CLINE_RULES}}",b).trim()}var X2="anthropic/claude-sonnet-5";var G2="remote://";import{z as J}from"zod";var S6=J.object({id:J.string(),temperature:J.number().optional(),maxTokens:J.number().optional(),contextWindow:J.number().optional(),inputPrice:J.number().optional(),outputPrice:J.number().optional(),supportsImages:J.boolean().optional()}),g6=J.object({models:J.array(S6).optional(),openAiBaseUrl:J.string().optional(),openAiHeaders:J.record(J.string(),J.string()).optional(),azureApiVersion:J.string().optional(),azureIdentity:J.boolean().optional()}),v6=J.object({id:J.string(),thinkingBudgetTokens:J.number().optional()}),n6=J.object({name:J.string(),baseModelId:J.string(),thinkingBudgetTokens:J.number().optional()}),h6=J.object({models:J.array(v6).optional(),customModels:J.array(n6).optional(),awsRegion:J.string().optional(),awsUseCrossRegionInference:J.boolean().optional(),awsUseGlobalInference:J.boolean().optional(),awsBedrockUsePromptCache:J.boolean().optional(),awsBedrockEndpoint:J.string().optional()}),x6=J.object({id:J.string()}),z6=J.object({models:J.array(x6).optional()}),c6=J.object({id:J.string(),thinkingBudgetTokens:J.number().optional()}),u6=J.object({models:J.array(c6).optional(),vertexProjectId:J.string().optional(),vertexRegion:J.string().optional()}),o6=J.object({id:J.string(),thinkingBudgetTokens:J.number().optional(),promptCachingEnabled:J.boolean().optional()}),l6=J.object({models:J.array(o6).optional(),baseUrl:J.string().optional()}),d6=J.object({id:J.string(),thinkingBudgetTokens:J.number().optional()}),m6=J.object({models:J.array(d6).optional(),baseUrl:J.string().optional()}),K2=J.object({OpenAiCompatible:g6.optional(),AwsBedrock:h6.optional(),Cline:z6.optional(),Vertex:u6.optional(),LiteLLM:l6.optional(),Anthropic:m6.optional()}),p6=J.object({id:J.string()}),r6=J.object({name:J.string(),url:J.string(),alwaysEnabled:J.boolean().optional(),headers:J.record(J.string(),J.string()).optional()}),G1=J.object({alwaysEnabled:J.boolean(),name:J.string(),contents:J.string()}),B0=J.object({bucket:J.string(),accessKeyId:J.string(),secretAccessKey:J.string(),region:J.string().optional(),endpoint:J.string().optional(),accountId:J.string().optional()}),s6=J.object({enabled:J.boolean().optional(),type:J.union([J.literal("s3_access_keys"),J.literal("r2_access_keys"),J.literal("azure_access_keys")]).optional(),s3AccessSettings:B0.optional(),r2AccessSettings:B0.optional(),azureAccessSettings:B0.optional()}),i6=J.object({promptUploading:s6.optional()}),R2=J.object({version:J.string(),providerSettings:K2.optional(),telemetryEnabled:J.boolean().optional(),kanbanEnabled:J.boolean().optional(),mcpMarketplaceEnabled:J.boolean().optional(),allowedMCPServers:J.array(p6).optional(),remoteMCPServers:J.array(r6).optional(),blockPersonalRemoteMCPServers:J.boolean().optional(),yoloModeAllowed:J.boolean().optional(),openTelemetryEnabled:J.boolean().optional(),openTelemetryMetricsExporter:J.string().optional(),openTelemetryLogsExporter:J.string().optional(),openTelemetryOtlpProtocol:J.string().optional(),openTelemetryOtlpEndpoint:J.string().optional(),openTelemetryOtlpHeaders:J.record(J.string(),J.string()).optional(),openTelemetryOtlpMetricsProtocol:J.string().optional(),openTelemetryOtlpMetricsEndpoint:J.string().optional(),openTelemetryOtlpMetricsHeaders:J.record(J.string(),J.string()).optional(),openTelemetryOtlpLogsProtocol:J.string().optional(),openTelemetryOtlpLogsEndpoint:J.string().optional(),openTelemetryOtlpLogsHeaders:J.record(J.string(),J.string()).optional(),openTelemetryMetricExportInterval:J.number().optional(),openTelemetryOtlpInsecure:J.boolean().optional(),openTelemetryLogBatchSize:J.number().optional(),openTelemetryLogBatchTimeout:J.number().optional(),openTelemetryLogMaxQueueSize:J.number().optional(),enterpriseTelemetry:i6.optional(),globalRules:J.array(G1).optional(),globalWorkflows:J.array(G1).optional()}),Q2=J.record(J.string(),J.string());var j2=4317;var V2="127.0.0.1:4317";import K1 from"zod";var k2=K1.enum(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),W2=K1.enum(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),F2=K1.enum(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var _2="runtime.team.progress.v1",L2="runtime.team.lifecycle.v1";var U2="CLINE_ENVIRONMENT",D2="CLINE_ENVIRONMENT_OVERRIDE",R1={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"}},P2="production";function a6(f){let $=f?.trim().toLowerCase();if($==="production"||$==="staging"||$==="local")return $;return}function t6(){if(typeof process>"u"||!process?.env)return{};return process.env}function e6(){let f=t6();return a6(f.CLINE_ENVIRONMENT_OVERRIDE)??a6(f.CLINE_ENVIRONMENT)??"production"}function A2(f){if(typeof f==="string")return R1[f];return R1[e6()]}function B2(f,$){if($.CLINE_API_BASE_URL)f={...f,apiBaseUrl:$.CLINE_API_BASE_URL,mcpBaseUrl:`${$.CLINE_API_BASE_URL}/v1/mcp`};return f}function I2(f){let $=A2(f);return B2($,t6())}var O2="agent.reasoning.unexpected_tokens",N2="task.provider_request_started",b2="task.provider_stream_started",E2="task.first_chunk_received",T2="task.provider_stream_failed",M2="task.cancelled",C2="sdk.error";var m=new Map;function y2(){m.clear()}function S2(f,$){let w=typeof $.error_message==="string"?$.error_message:"";return[f,$.component,$.operation,$.error_type,$.error_code??"",$.error_status??"",w.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function g2(f){let $=Date.now(),w=m.get(f);if(w&&$-w.startMs<3600000){if(w.emitted<5)return w.emitted+=1,{emit:!0,suppressed:0};return w.suppressed+=1,{emit:!1,suppressed:w.suppressed}}let q=w?.suppressed??0;if(m.delete(f),m.size>=512){let Y=m.keys().next();if(!Y.done)m.delete(Y.value)}return m.set(f,{startMs:$,emitted:1,suppressed:0}),{emit:!0,suppressed:q}}function v2(f,$){f?.capture({event:"agent.reasoning.unexpected_tokens",properties:j1({sessionId:$.sessionId,agentId:$.agentId,runId:$.runId,iteration:$.iteration,providerId:$.providerId,modelId:$.modelId,requestedThinking:$.requestedThinking,reasoningTokenCount:$.reasoningTokenCount})})}function n2(f,$){if(!f)return;f.capture({event:$.event,properties:j1({sessionId:$.sessionId,ulid:$.ulid??$.sessionId,agentId:$.agentId,conversationId:$.conversationId,runId:$.runId,iteration:$.iteration,provider:$.providerId,providerId:$.providerId,model:$.modelId,modelId:$.modelId,phase:$.phase,durationMs:$.durationMs,eventType:$.eventType,...$.error===void 0?{}:V1($.error,$.messageLimit),error_class:$.errorClass})})}function h2(f,$){if(!f)return!1;let w=$.event??"sdk.error",q=ff($),Y=0;try{let X=g2(S2(w,q));if(!X.emit)return!0;Y=X.suppressed}catch{}return f.capture({event:w,properties:Y>0?{...q,suppressed_count:Y}:q}),!0}function ff(f){return j1({...f.context??{},component:f.component,operation:f.operation,severity:f.severity??"error",handled:f.handled??!0,...V1(f.error,f.messageLimit,f.errorMessage)})}function j1(f){let $={};for(let[w,q]of Object.entries(f))if(q!==void 0)$[w]=q;return $}function V1(f,$=500,w){let q=c2(f)?f:void 0,Y=f instanceof Error?f:void 0,X=R0(w)??R0(Y?.message)??R0(q?.message)??u2(f)??"Unknown error",G=o2(q?.code),K=Q1(q?.status)??Q1(q?.statusCode)??Q1(q?.responseStatus);return{error_type:Y?.name?.trim()||R0(q?.name)||Y?.constructor?.name||"Error",error_message:z2(x2(X),$),...G!==void 0?{error_code:G}:{},...K!==void 0?{error_status:K}:{}}}function x2(f){return f.replace(/(authorization=Bearer\s+)[^&\s]+/gi,"$1[redacted]").replace(/(api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|password|secret)=([^&\s]+)/gi,"$1=[redacted]").replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,"$1[redacted]").replace(/\/Users\/[^/\s]+/g,"/Users/[redacted]").replace(/\/home\/[^/\s]+/g,"/home/[redacted]").replace(/([A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s]+/g,"$1[redacted]")}function z2(f,$){let w=Math.max(1,Math.floor($));return f.length>w?f.substring(0,w):f}function c2(f){return typeof f==="object"&&f!==null}function R0(f){return typeof f==="string"&&f.trim().length>0?f:void 0}function u2(f){if(f instanceof Error)return;let $=typeof f==="string"?f:String(f);return $==="[object Object]"?void 0:R0($)}function o2(f){if(typeof f==="string"&&f.trim().length>0)return f;if(typeof f==="number"&&Number.isFinite(f))return f;return}function Q1(f){return typeof f==="number"&&Number.isFinite(f)?f:void 0}function $f(f){let $={};if(!f)return $;return f.split(",").forEach((w)=>{let q=w.indexOf("=");if(q<=0)return;try{let Y=decodeURIComponent(w.substring(0,q).trim()),X=decodeURIComponent(w.substring(q+1).trim());if(!Y||!X)return;$[Y]=X}catch{}}),$}function l2(){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?$f(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function wf(f={}){return{extension_version:"unknown",cline_type:"unknown",platform:"terminal",platform_version:process?.version||"unknown",os_type:process?.platform||"unknown",os_version:process?.platform==="win32"?process?.env?.OS??"unknown":"unknown",...f}}function d2(f={}){return{...l2(),...f,metadata:wf(f.metadata)}}function qf(f){let $=f?.trim();return $?$:void 0}function m2(f,$){if(!f)return;let w=typeof f==="function"?f($):f;if(!w)return;let q=qf(w.rootSessionId);if(!q)return;return{rootSessionId:q}}function p2(f){return qf(f?.rootSessionId)}var r2=(f)=>crypto.getRandomValues(new Uint8Array(f)),s2=(f,$,w)=>{let q=256-256%f.length;if(q===256){let X=f.length-1;return(G=$)=>{if(!G)return"";let K="";while(!0){let V=w(G),W=G;while(W--)if(K+=f[V[W]&X],K.length>=G)return K}}}let Y=Math.ceil(409.6*$/q);return(X=$)=>{if(!X)return"";let G="";while(!0){let K=w(Y),V=Y;while(V--)if(K[V]<q){if(G+=f[K[V]%f.length],G.length>=X)return G}}}},Zf=(f,$=21)=>s2(f,$|0,r2);function i2(f="",$=""){let w=Zf("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${f}${Date.now()}_${w(5)}${$}`}var a2=["idle","running","pending","completed","failed","cancelled"];var k1=["rules","skills","workflows","plugins","hooks"],Yf=k1,t2=new Set(k1);function Hf(f){return typeof f==="string"&&t2.has(f)}function e2(f){if(!Array.isArray(f))return;let $=f.map((w)=>typeof w==="string"?w.trim():"").filter(Hf);return[...new Set($)]}function f4(f,$){return new Set(f??Yf).has($)}import{z as y}from"zod";var $4=y.object({rootPath:y.string().min(1),hint:y.string().min(1).optional(),associatedRemoteUrls:y.array(y.string().min(1)).optional(),latestGitCommitHash:y.string().min(1).optional(),latestGitBranchName:y.string().min(1).optional()}),w4=y.object({currentWorkspacePath:y.string().min(1).optional(),workspaces:y.record(y.string().min(1),$4)});function U8(){return{workspaces:{}}}function D8(f,$){let w={...f,workspaces:{...f.workspaces,[$.rootPath]:$}};if(!w.currentWorkspacePath)w.currentWorkspacePath=$.rootPath;return w4.parse(w)}var q4="workspaces",Z4="chat";function Y4(f){let $=f.trim(),w=/^[A-Za-z]:[\\/]/.test($)||$.startsWith("\\\\"),q=$.startsWith("/");if(!w&&!q)return!1;let Y=$.split(w?/[\\/]+/:/\/+/).filter(Boolean),X=Y.at(-1)??"",G=Y.at(-2)??"",K=Y.at(-3)??"";return(Y.at(-4)??"")===".cline"&&K==="data"&&G==="workspaces"&&X==="chat"}import{z as Z}from"zod";var H4=["current_state","boundary_analysis","interface_proposal"],I8=3600000,O8=240,N8=400,S=Z.preprocess((f)=>f instanceof Date?f.toISOString():f,Z.string().datetime()),Y0=Z.enum(["pending","in_progress","blocked","completed"]),Jf=Z.enum(["queued","running","completed","failed","cancelled","interrupted"]),I0=Z.enum(["draft","in_review","finalized"]),J4=Z.object({agentId:Z.string(),role:Z.enum(["lead","teammate"]),description:Z.string().optional(),status:Z.enum(["idle","running","stopped"])}),b8=Z.object({agentId:Z.string(),rolePrompt:Z.string(),modelId:Z.string().optional(),maxIterations:Z.number().optional()});function B(f){return Z.preprocess(($)=>$===null?void 0:$,f.optional())}var E8=Z.object({agentId:Z.string().min(1).describe("Teammate identifier"),rolePrompt:Z.string().min(1).describe("System prompt describing teammate role")}).strict(),T8=Z.object({agentId:Z.string().min(1).describe("Teammate identifier"),reason:B(Z.string().min(1)).describe("Optional shutdown reason")}),M8=Z.object({}),X4={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},C8={create:["status","taskId","summary","reason"]},y8=Z.object({action:Z.enum(["create","list","claim","complete","block"]),title:B(Z.string().min(1)).describe("Task title"),description:B(Z.string().min(1)).describe("Task details"),dependsOn:B(Z.array(Z.string().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:B(Z.string().min(1)).describe("Optional assignee"),status:B(Z.enum(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:B(Z.string()).describe("Task ID"),summary:B(Z.string().min(1)).describe("Completion summary"),reason:B(Z.string().min(1)).describe("Blocking reason")}).superRefine((f,$)=>{for(let w of X4[f.action]){if(f[w]!==void 0)continue;$.addIssue({code:"custom",path:[w],message:`Field "${w}" is required when action=${f.action}`})}}),S8=Z.object({agentId:Z.string().describe("Teammate agent ID"),task:Z.string().min(1).describe("Task instructions for the teammate"),taskId:B(Z.string()).describe("Optional shared task list ID"),runMode:B(Z.enum(["sync","async"])).describe("Execution mode: 'sync' blocks until the teammate finishes and returns the result (default if omitted); 'async' queues the run and returns a runId immediately — use team_await_runs to collect results later."),continueConversation:B(Z.boolean()).describe("If true, continue the teammate conversation; otherwise start fresh")}),g8=Z.object({status:B(Z.enum(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:B(Z.string().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:B(Z.boolean()).describe("Include completed/failed runs (default true)")}),v8=Z.object({runId:Z.string().min(1).describe("Run ID"),reason:B(Z.string().min(1)).describe("Optional cancellation reason")}),n8=Z.object({runId:B(Z.string().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),h8=Z.object({toAgentId:Z.string().min(1).describe("Recipient agent ID"),subject:Z.string().min(1).describe("Message subject"),body:Z.string().min(1).describe("Message body"),taskId:B(Z.string().min(1)).describe("Optional task ID context")}),x8=Z.object({subject:Z.string().min(1).describe("Message subject"),body:Z.string().min(1).describe("Message body"),taskId:B(Z.string().min(1)).describe("Optional task ID context")}),z8=Z.object({unreadOnly:B(Z.boolean()).describe("Only unread messages for read action (default true)")}),c8=Z.object({kind:Z.enum(["progress","handoff","blocked","decision","done","error"]),summary:Z.string().min(1).describe("Update summary"),taskId:B(Z.string().min(1)).describe("Optional task ID context"),evidence:B(Z.array(Z.string().min(1))).describe("Optional evidence links/snippets"),nextAction:B(Z.string().min(1)).describe("Planned next step")}),u8=Z.object({}),o8=Z.object({title:Z.string().describe("Outcome title"),requiredSections:Z.array(Z.string()).default(H4).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),l8=Z.object({outcomeId:Z.string().describe("Outcome ID"),section:Z.string().describe("Section name"),sourceRunId:B(Z.string()).describe("Optional source run ID"),content:Z.string().describe("Section fragment content")}),d8=Z.object({fragmentId:Z.string().describe("Fragment ID"),approved:Z.boolean().describe("Review decision")}),m8=Z.object({outcomeId:Z.string().describe("Outcome ID")}),p8=Z.object({}),r8=Z.object({teamId:Z.string(),teamName:Z.string(),members:Z.array(J4),taskCounts:Z.record(Y0,Z.number()),unreadMessages:Z.number(),missionLogEntries:Z.number(),activeRuns:Z.number(),queuedRuns:Z.number(),outcomeCounts:Z.record(I0,Z.number())}),G4=Z.object({id:Z.string(),title:Z.string(),description:Z.string(),status:Y0,createdAt:S,updatedAt:S,createdBy:Z.string(),assignee:Z.string().optional(),dependsOn:Z.array(Z.string()),summary:Z.string().optional(),isReady:Z.boolean(),blockedBy:Z.array(Z.string())}),s8=Z.discriminatedUnion("action",[Z.object({action:Z.literal("create"),taskId:Z.string(),status:Y0,ignoredFields:Z.array(Z.string()).optional(),note:Z.string().optional()}),Z.object({action:Z.literal("list"),tasks:Z.array(G4)}),Z.object({action:Z.literal("claim"),taskId:Z.string(),status:Y0,nextStep:Z.string()}),Z.object({action:Z.literal("complete"),taskId:Z.string(),status:Y0}),Z.object({action:Z.literal("block"),taskId:Z.string(),status:Y0})]),i8=Z.object({agentId:Z.string(),mode:Z.enum(["sync","async"]),status:Z.enum(["dispatched","running","queued","joined"]),dispatched:Z.boolean(),message:Z.string(),deduped:Z.boolean().optional(),runId:Z.string().optional(),text:Z.string().optional(),iterations:Z.number().optional()}),K4=Z.object({textPreview:Z.string(),iterations:Z.number(),finishReason:Z.string(),durationMs:Z.number(),usage:Z.object({inputTokens:Z.number(),outputTokens:Z.number(),cacheReadTokens:Z.number().optional(),cacheWriteTokens:Z.number().optional(),totalCost:Z.number().optional()})}),a8=Z.object({id:Z.string(),agentId:Z.string(),taskId:Z.string().optional(),status:Jf,messagePreview:Z.string(),priority:Z.number(),retryCount:Z.number(),maxRetries:Z.number(),nextAttemptAt:S.optional(),continueConversation:Z.boolean().optional(),startedAt:S,endedAt:S.optional(),leaseOwner:Z.string().optional(),heartbeatAt:S.optional(),lastProgressAt:S.optional(),lastProgressMessage:Z.string().optional(),currentActivity:Z.string().optional(),error:Z.string().optional(),resultSummary:K4.optional()}),t8=Z.object({id:Z.string(),teamId:Z.string(),fromAgentId:Z.string(),toAgentId:Z.string(),subject:Z.string(),body:Z.string(),taskId:Z.string().optional(),sentAt:S,readAt:S.optional()}),e8=Z.object({id:Z.string(),teamId:Z.string(),title:Z.string(),status:I0,requiredSections:Z.array(Z.string()),createdBy:Z.string(),createdAt:S,finalizedAt:S.optional()}),fw=Z.object({outcomeId:Z.string(),status:I0,requiredSections:Z.array(Z.string())}),$w=Z.object({agentId:Z.string(),status:Z.string()}),ww=Z.object({runId:Z.string(),status:Jf}),qw=Z.object({id:Z.string(),toAgentId:Z.string()}),Zw=Z.object({delivered:Z.number()}),Yw=Z.object({id:Z.string()}),Hw=Z.object({status:Z.string()}),Jw=Z.object({fragmentId:Z.string(),status:Z.string()}),Xw=Z.object({outcomeId:Z.string(),status:I0});var R4;((I)=>{I.TaskStart="task_start";I.TaskEnd="task_end";I.AgentEvent="agent_event";I.TeammateSpawned="teammate_spawned";I.TeammateShutdown="teammate_shutdown";I.TeamTaskUpdated="team_task_updated";I.TeamMessage="team_message";I.TeamMissionLog="team_mission_log";I.TeamTaskCompleted="team_task_completed";I.RunStarted="run_started";I.RunQueued="run_queued";I.RunProgress="run_progress";I.RunCompleted="run_completed";I.RunFailed="run_failed";I.RunCancelled="run_cancelled";I.RunInterrupted="run_interrupted";I.OutcomeCreated="outcome_created";I.OutcomeFragmentAttached="outcome_fragment_attached";I.OutcomeFragmentReviewed="outcome_fragment_reviewed";I.OutcomeFinalized="outcome_finalized"})(R4||={});import{z as Q4}from"zod";function j4(f){let{$schema:$,...w}=f;if(typeof w.type==="string")return w;if("properties"in w||"required"in w||"additionalProperties"in w)return{type:"object",...w};for(let q of["oneOf","anyOf","allOf"]){let Y=w[q];if(!Array.isArray(Y)||Y.length===0)continue;if(q==="allOf"){if(Y.some((K)=>K&&typeof K==="object"&&K.type==="object"))return{type:"object",...w};throw Error('Tool inputSchema must describe an object at the top level, but the schema has a top-level "allOf" with no branch that asserts type: "object". Add type: "object" to at least one allOf branch to make the object constraint explicit.')}if(Y.every((G)=>G&&typeof G==="object"&&G.type==="object"))return{type:"object",...w};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${q}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return w}function V4(f){let $=j4(f.inputSchema instanceof Q4.ZodType?H1(f.inputSchema):f.inputSchema);return{name:f.name,description:f.description,inputSchema:$,lifecycle:f.lifecycle,timeoutMs:f.timeoutMs??30000,retryable:f.retryable??!0,maxRetries:f.maxRetries??3,execute:f.execute}}var Xf=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function k4(f){let $=(f instanceof Error?f.message:String(f)).toLowerCase();return Xf.some((w)=>$.includes(w))}export{H1 as zodToJsonSchema,a1 as xmlTagsRemoval,H2 as validateWithZod,Y6 as validateImageMedia,J0 as validateAndReserveImageMedia,V$ as validateAndReserveBase64Media,Uf as usesImageGenerationOperation,D8 as upsertWorkspaceInfo,I6 as truncateStr,$2 as truncateSplit,f2 as trimNonEmpty,K6 as toAiSdkToolResultOutput,T1 as supportsChatModalities,q2 as stripUtf8Bom,i1 as stripModeNotices,Nf as shouldIncludeConnectorField,N$ as serializeAbortReason,M as sanitizeSurrogates,e$ as sanitizeFileName,o$ as safeJsonStringify,l$ as safeJsonParse,p2 as resolveRootSessionId,Q6 as resolveReasoningEffortRatio,O$ as resolveReasoningBudgetFromRatio,h0 as resolveMediaBudget,N3 as resolveMcpTimeoutSeconds,t4 as resolveHubCommandTimeoutMs,m2 as resolveHookSessionContext,I$ as resolveEffectiveReasoningEffort,e6 as resolveClineEnvironment,y2 as resetSdkErrorRateLimiterForTests,H0 as reserveImageMediaBytes,i4 as readHubScheduleMode,r1 as parseUserCommandEnvelope,e2 as parseRuntimeConfigExtensions,u$ as parseJsonStream,rf as parseHookEventPayload,s$ as omitUndefinedValues,s1 as normalizeUserInput,V1 as normalizeSdkError,o1 as normalizePluginManifest,Z1 as normalizeJsonLikeStringsForSchema,T$ as noopBasicLogger,Df as modelSupportsToolCalling,Lf as modelProducesImages,y1 as modelHasCapability,A$ as mergeModelOptions,w2 as maskSecret,h1 as listConnectorCatalog,Hf as isRuntimeConfigExtensionKind,M$ as isMcpTimeoutConfigured,k4 as isLikelyAuthError,e4 as isHubToolExecutorName,sf as isHubScheduleMode,m4 as isHubProtocolCompatible,G$ as isGeneratedMedia,J1 as isClineProvider,Y4 as isChatWorkspacePath,_f as isChatCompatibleModel,j$ as isCanonicalBase64,q6 as isBase64Char,Q$ as imageFileMaxDecodedBytesForBase64Limit,n0 as imageBase64LengthForDecodedBytes,R$ as imageBase64EncodedByteLength,v0 as imageBase64DecodedByteLength,f4 as hasRuntimeConfigExtension,Y1 as getShellKind,B6 as getShellInvocation,t$ as getShellArgs,y$ as getErrorMessage,S$ as getErrorCode,a$ as getDefaultShell,tf as getDefaultHubCommandTimeoutMs,I2 as getClineEnvironmentConfig,K$ as generatedMediaModalityFromMediaType,$$ as formatUserInputBlock,w$ as formatUserCommandBlock,Y2 as formatUptime,q$ as formatModeSwitchNotice,P$ as formatMessagesForAiSdk,b3 as formatMcpTimeoutErrorMessage,Z2 as formatHumanReadableDate,S0 as formatFileContentBlock,X$ as formatDisplayUserInput,j6 as estimateTokens,E$ as estimateRequestInputTokens,U8 as emptyWorkspaceManifest,r$ as decodeJwtPayload,V4 as createTool,i2 as createSessionId,Z$ as createModeSwitchNoticeTracker,U0 as createMediaBudgetState,vf as createContributionRegistry,wf as createClineTelemetryServiceMetadata,d2 as createClineTelemetryServiceConfig,bf as connectorChannelsFromPlatforms,C$ as clampMcpTimeoutSeconds,n2 as captureTaskLifecycleEvent,h2 as captureSdkError,v2 as captureAgentUnexpectedReasoningTokens,ff as buildSdkErrorProperties,J2 as buildClineSystemPrompt,w4 as WorkspaceManifestSchema,$4 as WorkspaceInfoSchema,u6 as VertexSettingsSchema,c6 as VertexModelSchema,V3 as USAGE_COST_DISPLAYS,C0 as ToolCallRecordSchema,N1 as ThinkingConfigSchema,b8 as TeamTeammateSpecSchema,s8 as TeamTaskToolResultSchema,G4 as TeamTaskListItemToolResultSchema,y8 as TeamTaskInputSchema,r8 as TeamStatusToolResultSchema,M8 as TeamStatusInputSchema,E8 as TeamSpawnTeammateInputSchema,$w as TeamSimpleAgentStatusToolResultSchema,T8 as TeamShutdownTeammateInputSchema,qw as TeamSendMessageToolResultSchema,h8 as TeamSendMessageInputSchema,a8 as TeamRunToolSummarySchema,i8 as TeamRunTaskToolResultSchema,S8 as TeamRunTaskInputSchema,K4 as TeamRunResultSummarySchema,d8 as TeamReviewOutcomeFragmentInputSchema,z8 as TeamReadMailboxInputSchema,e8 as TeamOutcomeToolResultSchema,Jw as TeamOutcomeFragmentToolResultSchema,Yw as TeamMissionLogToolResultSchema,c8 as TeamMissionLogInputSchema,R4 as TeamMessageType,t8 as TeamMailboxMessageToolResultSchema,g8 as TeamListRunsInputSchema,p8 as TeamListOutcomesInputSchema,Xw as TeamFinalizeOutcomeToolResultSchema,m8 as TeamFinalizeOutcomeInputSchema,fw as TeamCreateOutcomeToolResultSchema,o8 as TeamCreateOutcomeInputSchema,Hw as TeamCleanupToolResultSchema,u8 as TeamCleanupInputSchema,ww as TeamCancelRunToolResultSchema,v8 as TeamCancelRunInputSchema,Zw as TeamBroadcastToolResultSchema,x8 as TeamBroadcastInputSchema,n8 as TeamAwaitRunsInputSchema,l8 as TeamAttachOutcomeFragmentInputSchema,C8 as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,N8 as TEAM_RUN_TEXT_PREVIEW_LIMIT,O8 as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,_2 as TEAM_PROGRESS_EVENT_TYPE,L2 as TEAM_LIFECYCLE_EVENT_TYPE,I8 as TEAM_AWAIT_TIMEOUT_MS,b2 as TASK_PROVIDER_STREAM_STARTED_EVENT,T2 as TASK_PROVIDER_STREAM_FAILED_EVENT,N2 as TASK_PROVIDER_REQUEST_STARTED_EVENT,E2 as TASK_FIRST_CHUNK_RECEIVED_EVENT,M2 as TASK_CANCELLED_EVENT,L0 as SUPPORTED_IMAGE_MEDIA_TYPES,a2 as SESSION_STATUS_VALUES,C2 as SDK_ERROR_TELEMETRY_EVENT,B0 as S3AccessKeySettingsSchema,r6 as RemoteMCPServerSchema,R2 as RemoteConfigSchema,E0 as ReasoningLevelSchema,k0 as ReasoningEffortSchema,k1 as RUNTIME_CONFIG_EXTENSION_KINDS,G2 as REMOTE_URI_SCHEME,V0 as REASONING_LEVELS,K0 as REASONING_EFFORT_RATIOS,W2 as ProviderProtocolSchema,F2 as ProviderClientSchema,k2 as ProviderCapabilitySchema,s6 as PromptUploadingSchema,nf as PLUGIN_FILE_EXTENSIONS,y6 as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,C6 as PLAN_MODE_INSTRUCTIONS,g6 as OpenAiCompatibleSchema,S6 as OpenAiCompatibleModelSchema,s4 as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,r4 as ONE_TIME_SCHEDULE_CRON_PATTERN,I1 as ModelStatusSchema,T0 as ModelReasoningOptionSchema,O1 as ModelPricingSchema,M1 as ModelOperationSchema,C1 as ModelOperationModeSchema,M0 as ModelModalitySchema,E1 as ModelModalitiesSchema,b1 as ModelMetadataSchema,W0 as ModelInfoSchema,B1 as ModelCapabilitySchema,T6 as MODE_TAG_INSTRUCTIONS,F3 as MODEL_TOOL_NAMES,I3 as MIN_MCP_TIMEOUT_SECONDS,o4 as MIN_CLIENT_HUB_PROTOCOL_VERSION,O3 as MAX_MCP_TIMEOUT_SECONDS,l4 as MAX_CLIENT_HUB_PROTOCOL_VERSION,l6 as LiteLLMSchema,o6 as LiteLLMModelSchema,t as IMAGE_UNSUPPORTED_PLACEHOLDER,a as IMAGE_OMITTED_PLACEHOLDER,m1 as HookEventPayloadSchema,d1 as HookEventNameSchema,H3 as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,ef as HUB_TOOL_EXECUTOR_NAMES,f3 as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,p1 as HUB_SCHEDULE_MODES,Y3 as HUB_MISTAKE_LIMIT_CAPABILITY,w3 as HUB_HOOK_CAPABILITY_PREFIX,af as HUB_DEFAULT_COMMAND_TIMEOUT_MS,$3 as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,q3 as HUB_COMPACTION_CAPABILITY,a4 as HUB_COMMAND_SLOW_LOG_MS,p4 as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,Z3 as HUB_CHECKPOINT_CAPABILITY,d4 as HUB_CAPABILITIES,G1 as GlobalInstructionsFileSchema,e1 as GeneratedMediaSourceSchema,$6 as GeneratedMediaSchema,t1 as GeneratedMediaModalitySchema,hf as FeatureFlagDefaultValue,xf as FEATURE_FLAGS,i6 as EnterpriseTelemetrySchema,X0 as EMPTY_CONTENT_TEXT,Yf as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,B$ as DEFAULT_REASONING_EFFORT,H4 as DEFAULT_OUTCOME_REQUIRED_SECTIONS,B3 as DEFAULT_MCP_TIMEOUT_SECONDS,w6 as DEFAULT_MAX_TOTAL_MEDIA_BYTES,v as DEFAULT_MAX_IMAGE_ENCODED_BYTES,x as DEFAULT_MAX_IMAGE_DECODED_BYTES,g0 as DEFAULT_MAX_IMAGE_BASE64_BYTES,P2 as DEFAULT_CLINE_ENVIRONMENT,y0 as ContributionRegistry,Of as ConnectorHookEventSchema,S1 as ConnectorHookEventNameSchema,v1 as ConnectorEventContextSchema,g1 as ConnectorEventActorSchema,Bf as ConnectorAuthorizationRequestSchema,If as ConnectorAuthorizationDecisionSchema,z6 as ClineSettingsSchema,x6 as ClineModelSchema,u4 as CURRENT_HUB_PROTOCOL_VERSION,x1 as CONNECTOR_PLATFORMS,n1 as CONNECTOR_CATALOG,_3 as CONFIGURABLE_MODEL_TOOL_NAMES,q4 as CLINE_WORKSPACES_DIRECTORY_NAME,D2 as CLINE_ENVIRONMENT_OVERRIDE_ENV,U2 as CLINE_ENVIRONMENT_ENV,R1 as CLINE_ENVIRONMENTS,j2 as CLINE_DEFAULT_RPC_PORT,V2 as CLINE_DEFAULT_RPC_ADDRESS,X2 as CLINE_DEFAULT_MODEL_ID,Z4 as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,b$ as CHARS_PER_TOKEN,h6 as AwsBedrockSettingsSchema,v6 as AwsBedrockModelSchema,n6 as AwsBedrockCustomModelSchema,A1 as ApiFormatSchema,Ff as ApiFormat,m6 as AnthropicSchema,d6 as AnthropicModelSchema,p6 as AllowedMCPServerSchema,Af as AgentUsageSchema,b4 as AgentResultSchema,Pf as AgentFinishReasonSchema,E4 as AgentConfigSchema,Xf as AUTH_ERROR_PATTERNS,Q2 as APIKeySchema,O2 as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT};
|