@cline/shared 0.0.81 → 0.0.82
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/agent.d.ts +5 -2
- package/dist/automation/index.js +38 -46
- package/dist/db/index.js +10 -10
- package/dist/feature-flags.d.ts +2 -0
- package/dist/hub.d.ts +21 -1
- package/dist/index.browser.d.ts +3 -3
- package/dist/index.browser.js +21 -21
- package/dist/index.d.ts +3 -3
- package/dist/index.js +80 -88
- package/dist/llms/model-info.d.ts +10 -0
- package/dist/llms/tools.d.ts +14 -0
- package/dist/prompt/format.d.ts +4 -0
- package/dist/remote-config/index.js +45 -53
- package/dist/rpc/runtime.d.ts +6 -0
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/storage/paths.d.ts +40 -0
- package/dist/team/schema.d.ts +37 -37
- 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 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
|
-
${
|
|
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
|
|
5
|
-
+`.includes(
|
|
6
|
-
+`.includes(
|
|
7
|
-
|
|
8
|
-
`,r:"\r",t:"\t"};function
|
|
9
|
-
`)
|
|
1
|
+
import{z as J}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"]),U$=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(U$)}).strict(),T.object({type:T.literal("budget_tokens"),min:T.number().min(-1).optional(),max:T.number().min(0).optional()}).strict().refine(($)=>$.min===void 0||$.max===void 0||$.min<=$.max,{message:"Minimum reasoning budget cannot exceed maximum",path:["min"]})]);var O1=U.enum(["default","openai-responses","r1"]),D$={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},N1=U.enum(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),b1=U.enum(["active","preview","deprecated","legacy"]),E1=U.object({input:U.number().optional(),output:U.number().optional(),cacheWrite:U.number().optional(),cacheRead:U.number().optional()}),T1=U.object({maxBudget:U.number().optional(),outputPrice:U.number().optional(),thinkingLevel:U.enum(["low","high"]).optional()}),M1=U.object({reasoningDefaultOn:U.boolean().optional()}).catchall(U.unknown()),M0=U.enum(["text","image","audio","video","pdf"]),y1=U.object({input:U.array(M0),output:U.array(M0)});function C1($){return($?.input===void 0||$.input.includes("text"))&&($?.output===void 0||$.output.includes("text"))}var S1=U.enum(["language","image-generation","speech-generation","video-generation","transcription"]);function P$($){return($.operation===void 0||$.operation==="language")&&C1($.modalities)}var g1=U.enum(["batch","streaming"]);function A$($){return $.modalities?.input.includes("text")===!0&&$.modalities.output.includes("image")}function B$($){return $.operation==="image-generation"}function y0($,f,w){let Z=$.capabilities;if(Z===void 0||Z.length===0)return w?.assumeWhenUnspecified??!1;return Z.includes(f)}function I$($){return y0($,"tools",{assumeWhenUnspecified:!0})}function O$($){return y0($,"images",{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(N1).optional(),operation:S1.optional(),operationModes:U.array(g1).optional(),modalities:y1.optional(),reasoningOptions:U.array(T0).optional(),apiFormat:O1.optional(),systemRole:U.enum(["system","developer"]).optional(),temperature:U.number().optional(),pricing:E1.optional(),thinkingConfig:T1.optional(),status:b1.optional(),deprecationNotice:U.string().optional(),replacedBy:U.string().optional(),releaseDate:U.string().optional(),deprecationDate:U.string().optional(),family:U.string().optional(),metadata:M1.optional()});import{z as g}from"zod";var N$="This tool call was rejected by the user and not executed.",b$="NOT a tool or system failure. Clarify with user before proceeding.",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 E$=J.enum(["completed","max_iterations","aborted","mistake_limit","error"]),T$=J.object({inputTokens:J.number(),outputTokens:J.number(),cacheReadTokens:J.number().optional(),cacheWriteTokens:J.number().optional(),totalCost:J.number().optional()}),v4=J.object({text:J.string(),usage:T$,messages:J.array(J.custom()),toolCalls:J.array(C0),iterations:J.number(),finishReason:E$,model:J.object({id:J.string(),provider:J.string(),info:W0.optional()}),startedAt:J.date(),endedAt:J.date(),durationMs:J.number()}),n4=J.object({distinctId:J.string().optional(),sessionId:J.string().optional(),providerId:J.string(),modelId:J.string(),apiKey:J.string().optional(),baseUrl:J.string().url().optional(),headers:J.record(J.string(),J.string()).optional(),knownModels:J.record(J.string(),W0).optional(),providerConfig:J.unknown().optional(),initialMessages:J.array(J.custom()).optional(),systemPrompt:J.string(),tools:J.array(J.custom()),modelTools:J.array(J.custom()).optional(),maxIterations:J.number().positive().optional(),maxParallelToolCalls:J.number().int().positive().default(8),maxTokensPerTurn:J.number().positive().optional(),temperature:J.number().nonnegative().optional(),apiTimeoutMs:J.number().positive().default(180000),userFileContentLoader:J.function().input([J.string()]).output(J.promise(J.string())).optional(),toolContextMetadata:J.record(J.string(),J.unknown()).optional(),execution:J.object({maxConsecutiveMistakes:J.number().int().positive().optional(),reminderAfterIterations:J.number().nonnegative().optional(),reminderText:J.string().optional(),loopDetection:J.union([J.literal(!1),J.object({softThreshold:J.number().int().positive().optional(),hardThreshold:J.number().int().positive().optional()})]).optional()}).optional(),reasoningEffort:k0.optional(),thinkingBudgetTokens:J.number().positive().optional(),thinking:J.boolean().optional(),onEvent:J.function().input([J.custom()]).output(J.void()).optional(),hooks:J.custom().optional(),parentAgentId:J.string().optional(),extensions:J.array(J.custom()).optional(),hookErrorMode:J.enum(["ignore","throw"]).default("ignore"),toolPolicies:J.record(J.string(),J.object({enabled:J.boolean().optional(),autoApprove:J.boolean().optional()})).optional(),requestToolApproval:J.function().input([J.object({sessionId:J.string(),agentId:J.string(),conversationId:J.string(),iteration:J.number(),toolCallId:J.string(),toolName:J.string(),input:J.unknown(),policy:J.object({enabled:J.boolean().optional(),autoApprove:J.boolean().optional()}).default({})})]).output(J.union([J.object({approved:J.boolean(),reason:J.string().optional()}),J.promise(J.object({approved:J.boolean(),reason:J.string().optional()}))])).optional(),onConsecutiveMistakeLimitReached:J.function().input([J.object({iteration:J.number().int().positive(),consecutiveMistakes:J.number().int().positive(),maxConsecutiveMistakes:J.number().int().positive(),reason:J.enum(["api_error","invalid_tool_call","tool_execution_failed"]),details:J.string().optional()})]).output(J.union([J.object({action:J.literal("continue"),guidance:J.string().optional()}),J.object({action:J.literal("stop"),reason:J.string().optional()}),J.promise(J.union([J.object({action:J.literal("continue"),guidance:J.string().optional()}),J.object({action:J.literal("stop"),reason:J.string().optional()})]))])).optional(),logger:J.custom().optional(),extensionContext:J.custom().optional(),abortSignal:J.custom().optional()});import{z as F}from"zod";var v1=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"]),n1=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()}),h1=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()}),M$=F.object({actor:n1,context:h1,payload:F.record(F.string(),F.unknown()).optional()}),y$=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()}),C$=F.object({adapter:F.string(),botUserName:F.string().optional(),event:v1,payload:F.record(F.string(),F.unknown()),ts:F.string()});var x1=[{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 z1(){return x1.map(($)=>({...$}))}function S$($,f){let w=$.includeWhen;if(!w)return!0;let Z=f[w.flag]??"";if(w.equals!==void 0&&Z!==w.equals)return!1;if(w.notEquals!==void 0&&Z===w.notEquals)return!1;return!0}function g$($=c1){let f=new Set(z1().map((w)=>w.name));return $.filter((w)=>f.has(w.id)).map((w)=>({id:w.id,name:w.name,type:w.type,hint:w.hint,fields:w.fields.map((Z)=>({flag:Z.flag,label:Z.label,placeholder:Z.placeholder,required:Z.required,help:Z.help,initialValue:Z.initialValue,options:Z.options,includeWhen:Z.includeWhen})),security:w.security?{prompt:w.security.prompt,fields:w.security.fields.map((Z)=>({key:Z.key,label:Z.label,placeholder:Z.placeholder,help:Z.help,requiredMessage:Z.requiredMessage}))}:void 0}))}function v$($){return/^\d+$/.test($)?void 0:"Telegram user ID must contain digits only"}function n$($){return/^T[A-Z0-9]+$/.test($)?void 0:"Slack workspace ID must start with T and contain uppercase letters or digits only"}function h$($){return/^[UW][A-Z0-9]+$/.test($)?void 0:"Slack member ID must start with U or W and contain uppercase letters or digits only"}var c1=[{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:v$}],argumentFlags:["--allowed-user-id","--hook-command"],buildArgs:({userId:$})=>["--allowed-user-id",$??""]}},{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:n$},{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:h$}],argumentFlags:["--hook-command"],buildArgs:({teamId:$,userId:f})=>["--hook-command",`jq -r ".payload.actor.participantKey" | grep -qx "slack:team:${$}:user:${f}" && echo '{"action":"allow"}' || echo '{"action":"deny"}'`]}},{id:"discord",name:"Discord",type:"webhook",hint:"Requires a Discord app and public URL.",fields:[{flag:"--application-id",aliases:["--app-id"],label:"Application ID",required:!0,help:["Go to discord.com/developers/applications","Create a new app, copy the Application ID"]},{flag:"--bot-token",aliases:["--token"],label:"Bot token",required:!0,help:["Go to Bot section, create a bot, copy the token"]},{flag:"--public-key",label:"Public key",required:!0,help:["Found in General Information of your app"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0,help:["Base URL for the connector","For Discord, set the Interactions Endpoint URL to <base-url>/api/webhooks/discord"]}]},{id:"whatsapp",name:"WhatsApp",type:"webhook",hint:"Requires Meta developer account and public URL.",fields:[{flag:"--phone-number-id",label:"Phone number ID",required:!0,help:["From your WhatsApp Business account in Meta Developer portal"]},{flag:"--access-token",label:"Access token",required:!0,help:["Generate a permanent token in Meta Developer portal"]},{flag:"--app-secret",label:"App secret",required:!0,help:["Found in App Settings > Basic"]},{flag:"--verify-token",label:"Webhook verify token",placeholder:"my-verify-token",required:!0,help:["Any string you choose, used to verify webhook setup"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"gchat",name:"Google Chat",type:"webhook",hint:"Requires Google Cloud project and public URL.",fields:[{flag:"--credentials-json",label:"Service account credentials JSON",required:!0,help:["Create a service account in Google Cloud Console","Download the credentials JSON file","Paste the JSON content here"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"linear",name:"Linear",type:"webhook",hint:"React to Linear issues and comments.",fields:[{flag:"--api-key",label:"API key",required:!0,help:["Go to Linear Settings > API > Personal API keys"]},{flag:"--webhook-secret",label:"Webhook signing secret",required:!0,help:["Go to Settings > API > Webhooks, create one","Copy the signing secret"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]}];var x$=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],z$=new Set(x$);function l1($,f){return $.name||`extension_${String(f).padStart(4,"0")}`}function u1($){return Array.isArray($)&&$.every((f)=>typeof f==="string")}function o1($){if(!Array.isArray($))return;let f=$.filter((w)=>typeof w==="string").map((w)=>w.trim()).filter((w)=>w.length>0);return f.length>0?f:void 0}function d1($){let f=o1($.providerIds),w=o1($.modelIds);return{...$,...f?{providerIds:f}:{},...w?{modelIds:w}:{}}}function c$($,f){let w=l1($,f),Z=$.manifest;if(!Z||typeof Z!=="object")throw Error(`Invalid manifest for extension "${w}": manifest is required`);if(!Array.isArray(Z.capabilities)||Z.capabilities.length===0)throw Error(`Invalid manifest for extension "${w}": capabilities must be a non-empty array`);let Y=new Set;for(let G of Z.capabilities){if(!z$.has(G))throw Error(`Invalid manifest for extension "${w}": unsupported capability "${String(G)}"`);Y.add(G)}if(Object.hasOwn(Z,"providerIds")&&!u1(Z.providerIds))throw Error(`Invalid manifest for extension "${w}": providerIds must be a string array when provided`);if(Object.hasOwn(Z,"modelIds")&&!u1(Z.modelIds))throw Error(`Invalid manifest for extension "${w}": modelIds must be a string array when provided`);let K=Y.has("hooks");if($.hooks!==void 0&&!K)throw Error(`Invalid manifest for extension "${w}": runtime hooks require the "hooks" capability`);return{capabilities:Y,raw:d1(Z)}}function u$($,f){if(!$||typeof $!=="object")throw Error(`Invalid automation event contribution for extension "${f}": expected object`);let w=typeof $.eventType==="string"?$.eventType.trim():"",Z=typeof $.source==="string"?$.source.trim():"";if(!w)throw Error(`Invalid automation event contribution for extension "${f}": eventType is required`);if(!Z)throw Error(`Invalid automation event contribution for extension "${f}": source is required`);return{...$,eventType:w,source:Z,examples:$.examples?[...$.examples]:void 0,metadata:$.metadata?{...$.metadata}:void 0}}class S0{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]};normalized=[];phase="resolve";setupContext;constructor($={}){this.extensions=$.extensions??[],this.setupContext=$.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map(($,f)=>({extension:$,order:f,manifest:{capabilities:new Set,raw:$.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map(($)=>({...$,manifest:c$($.extension,$.order)})),this.phase="setup"}async setup($={}){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;let f,w=[];for(let Z of this.normalized){let{extension:Y}=Z;if(Y.disabled)continue;let K=l1(Y,Z.order),X={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},G={registerTool:(W)=>X.tools.push(W),registerCommand:(W)=>X.commands.push(W),registerRule:(W)=>{if(!Z.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${K}": registerRule requires the "rules" capability`);X.rules.push(W)},registerMessageBuilder:(W)=>X.messageBuilder.push(W),registerProvider:(W)=>X.providers.push(W),registerAutomationEventType:(W)=>{if(!Z.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${K}": registerAutomationEventType requires the "automationEvents" capability`);X.automationEventTypes.push(u$(W,K))},registerMcpServer:(W)=>{if(!Z.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${K}": registerMcpServer requires the "mcp" capability`);X.mcpServers.push({...W,metadata:{...W.metadata??{},source:"plugin",plugin:K}})}},V=Z.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await Y.setup?.(G,V),w.push(X)}catch(W){if($.tolerateSetupErrors!==!0)throw W;f??=W}}if(f&&$.tolerateSetupErrors!==!0)throw f;for(let Z of w)this.registry.tools.push(...Z.tools),this.registry.commands.push(...Z.commands),this.registry.rules.push(...Z.rules),this.registry.messageBuilder.push(...Z.messageBuilder),this.registry.providers.push(...Z.providers),this.registry.automationEventTypes.push(...Z.automationEventTypes),this.registry.mcpServers.push(...Z.mcpServers);if(this.phase="activate",f)throw f}activate(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase==="setup")throw Error("Contribution registry setup must complete before activation");if(this.phase!=="activate")return;this.phase="run"}async initialize($={}){this.resolve(),this.validate();try{await this.setup($)}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)=>$.order-f.order).map(({extension:$})=>$)}}function o$($={}){return new S0($)}var l$=[".js",".ts"];var g0={CLINE_PASS:"ext-cline-pass",CODE_ONBOARDING_GITHUB:"code-onboarding-github"},d$={[g0.CLINE_PASS]:!1,[g0.CODE_ONBOARDING_GITHUB]:!1},m$=Object.values(g0);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()),p$=R.object({toolName:R.string(),parameters:l}),r$=R.object({toolName:R.string(),parameters:l,result:R.string(),success:R.boolean(),executionTimeMs:R.number()}),s$=R.object({prompt:R.string(),attachments:R.array(R.string())}),i$=R.object({taskMetadata:l}),a$=R.object({taskMetadata:l,previousState:l}),t$=R.object({taskMetadata:l}),e$=R.object({taskMetadata:l}),$f=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()}),p1=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:p$.optional(),postToolUse:r$.optional(),userPromptSubmit:s$.optional(),taskStart:i$.optional(),taskResume:a$.optional(),taskCancel:t$.optional(),taskComplete:e$.optional(),preCompact:$f.optional()}).passthrough();function ff($){let f=p1.safeParse($);if(!f.success)return;return f.data}var i4="v1",a4="v1",t4="v1",e4=["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($){let f=/^v(\d+)$/.exec($?.trim()??"");if(!f)return;return Number.parseInt(f[1]??"",10)}function $3($,f="v1"){let w=F0($.protocolVersion),Z=F0(f);if(w===void 0||Z===void 0)return{compatible:!1,reason:"missing_protocol"};let Y=F0($.minClientProtocolVersion)??w,K=F0($.maxClientProtocolVersion)??w;return Z>=Y&&Z<=K?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var f3="approval.respond",w3="0",Z3="__hubScheduleRunAt",r1=["act","plan","yolo"];function wf($){return r1.some((f)=>f===$)}function q3($,f){if(!$||!Object.hasOwn($,"mode"))return f;let w=$.mode;if(wf(w))return w;throw Error(`mode must be one of: ${r1.join(", ")}`)}var Zf=30000,Y3=5000;function qf($){switch($){case"run.start":case"session.send_input":return null;default:return Zf}}function J3($,f){return f===void 0?qf($):f}var Yf=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],Jf=new Set(Yf);function H3($){return typeof $==="string"&&Jf.has($)}var K3="tool_executor.",X3="custom_tool.",G3="hook.",R3="compaction.compact",Q3="checkpoint.create",j3="mistake_limit.decide",V3="user_instructions.snapshot";function v0($,f){return`<file_content path="${$}">
|
|
2
|
+
${f}
|
|
3
|
+
</file_content>`}function Hf($,f="act"){return`<user_input mode="${f}">${$}</user_input>`}function Kf($,f){return`<user_command slash="${f}">${$}</user_command>`}function Xf($,f){return`<mode_notice>The user switched from ${$} mode to ${f} mode before sending this message.</mode_notice>`}function Gf(){let $=null;return{record(f,w){if(f===w)return;if($){$=$.from===w?null:{from:$.from,to:w};return}$={from:f,to:w}},consume(){let f=$;return $=null,f}}}function Rf($,f){let w=$.trim(),Z=new RegExp(`^<${f}\\b([^>]*)>([\\s\\S]*?)<\\/${f}>$`,"i").exec(w);if(!Z)return;return{attrs:Z[1]??"",content:Z[2]??""}}function Qf($,f){return new RegExp(`${f}="([^"]+)"`,"i").exec($)?.[1]?.trim()||void 0}function s1($){if(!$?.trim())return;let f=Rf($,"user_command");if(!f)return;let w=Qf(f.attrs,"slash");if(!w)return;return{slash:w,content:f.content.trim()}}function i1($){if(!$?.trim())return"";let f=$.trim();for(let w of["user_input","user_command"]){let Z=f6(f,w);f=(Z!==f?Z:f.replace(new RegExp(`<${w}[^>]*>`,"g"),"")).trim()}return f}function a1($){if(!$?.trim())return"";return jf($,"mode_notice").trim()}function jf($,f){let w=`<${f}>`,Z=`</${f}>`,Y=$,K=Y.indexOf(w);while(K!==-1){let X=Y.indexOf(Z,K+w.length);if(X===-1)break;Y=Y.slice(0,K)+Y.slice(X+Z.length),K=Y.indexOf(w,K)}return Y}function n0($){let f=a1(i1($)),w=s1($);if(!w)return f;if(w.slash.toLowerCase()==="team"){let Y=f.toLowerCase().startsWith("spawn a team of agents for the following task:")?f.slice(46).trim():f;return Y?`/team ${Y}`:"/team"}return f?`/${w.slash} ${f}`:`/${w.slash}`}var t1=240,e1=480;function $6($,f){let w=$.replace(/\s+/gu," ").trim();if(w.length<=f)return w;return`${w.slice(0,f-1).trimEnd()}…`}function Vf($){return $6(n0($),t1)}function kf($,f){let w=f?.trim()??"",Z=$.toLowerCase(),Y=Z==="user"||Z==="session"?n0(w):w;return $6(Y,e1)}function f6($,f){if(!$?.trim())return"";if(!f)return $;let w=new RegExp(`<${f}\\b[^>]*>([\\s\\S]*?)</${f}>`,"g");return $.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]",w6=N.enum(["image","audio","video","file"]),Z6=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(($)=>{let f=new URL($).protocol;return f==="http:"||f==="https:"},"Generated media URLs must use HTTP or HTTPS")}),N.object({type:N.literal("artifact"),artifactId:N.string().min(1)})]);function q6($){if($.startsWith("image/"))return"image";if($.startsWith("audio/"))return"audio";if($.startsWith("video/"))return"video";return"file"}var Y6=N.object({id:N.string().min(1),modality:w6,mediaType:N.string().min(1),source:Z6,name:N.string().min(1).optional(),sizeBytes:N.number().int().nonnegative().optional()}).refine(($)=>q6($.mediaType)===$.modality,{message:"Generated media modality must match its media type",path:["modality"]});function Wf($){return Y6.safeParse($).success}function Ff($){return q6($)}var L0=["image/png","image/jpeg","image/gif","image/webp"],h0=5242880,v=h0,x=6291456,J6=8388608;function _f($){return $.length}function x0($){let f=$.endsWith("==")?2:$.endsWith("=")?1:0;return Math.floor($.length*3/4)-f}function Lf($=h0){return Math.floor($*3/4)}function z0($){return Math.ceil($/3)*4}function c0($={}){return{maxImageEncodedBytes:$.maxImageEncodedBytes??v,maxImageDecodedBytes:$.maxImageDecodedBytes??x,maxTotalMediaBytes:$.maxTotalMediaBytes??J6}}function U0(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function _0($,f){$.omittedImages+=1,$.omittedReasons[f]=($.omittedReasons[f]??0)+1}function J0($,f,w,Z){let Y=c0(w);if($>Y.maxImageEncodedBytes){let K={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${Y.maxImageEncodedBytes} byte encoded limit`};return _0(Z,K.reason),K}if(f>Y.maxImageDecodedBytes){let K={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${Y.maxImageDecodedBytes} byte decoded limit`};return _0(Z,K.reason),K}if(Z.totalEncodedBytes+$>Y.maxTotalMediaBytes){let K={ok:!1,reason:"total_limit",message:`Image media exceeds the ${Y.maxTotalMediaBytes} byte total media limit`};return _0(Z,K.reason),K}return Z.totalEncodedBytes+=$,Z.keptImages+=1,null}function H6($){return $>=65&&$<=90||$>=97&&$<=122||$>=48&&$<=57||$===43||$===47}function Uf($){return $.length>0&&u0($,0,$.length)}function Df($,f,w){let Z=K6($),Y=Z.end-Z.start;if(Y===0)return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let K=c0(f);if(w.totalEncodedBytes+Y>K.maxTotalMediaBytes)return{ok:!1,reason:"total_limit",message:`Generated media exceeds the ${K.maxTotalMediaBytes} byte total media limit`};if(!u0($,Z.start,Z.end))return{ok:!1,reason:"invalid_base64",message:"Generated media must contain valid base64"};let X=$.slice(Z.start,Z.end);return w.totalEncodedBytes+=Y,{ok:!0,base64:X,encodedBytes:Y,decodedBytes:x0(X)}}function u0($,f,w){let Z=w-f;if(Z%4!==0)return!1;let Y=w;if(Z>=2&&$.charCodeAt(w-2)===61&&$.charCodeAt(w-1)===61)Y-=2;else if(Z>=1&&$.charCodeAt(w-1)===61)Y-=1;for(let K=f;K<Y;K++)if(!H6($.charCodeAt(K)))return!1;for(let K=Y;K<w;K++)if($.charCodeAt(K)!==61)return!1;return!0}function Pf($,f,w){return w-f>=5&&($.charCodeAt(f)|32)===100&&($.charCodeAt(f+1)|32)===97&&($.charCodeAt(f+2)|32)===116&&($.charCodeAt(f+3)|32)===97&&$.charCodeAt(f+4)===58}function K6($){let f=0,w=$.length;while(f<w&&/\s/.test($[f]??""))f+=1;while(w>f&&/\s/.test($[w-1]??""))w-=1;return{start:f,end:w}}function Af($,f,w){if(!Pf($,f,w))return;let Z=f+5,Y=$.indexOf(",",Z);if(Y===-1||Y>=w)return;if(Y-Z>128)return;let K=$.slice(Z,Y).toLowerCase(),X=";base64";if(!K.endsWith(X))return;let G=K.slice(0,-X.length);if(!G||G.includes(";"))return;return{mediaType:G,base64Start:Y+1,base64End:w}}function X6($,f,w={}){let Z=w.maxEncodedBytes??v,Y=w.maxDecodedBytes??x,K=new Set(w.supportedMediaTypes??L0),X=$?.toLowerCase(),G=K6(f),V=G.start,W=G.end,_=Af(f,G.start,G.end);if(_){if(X&&X!==_.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${$} does not match data URL type ${_.mediaType}`};X=_.mediaType,V=_.base64Start,W=_.base64End}if(!X||!K.has(X))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${$??"unknown"}`};let L=W-V;if(L===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(L>Z)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${Z} byte encoded limit`};if(!u0(f,V,W))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let D=f.slice(V,W),b=x0(D);if(b>Y)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${Y} byte decoded limit`};return{ok:!0,mediaType:X,base64:D,encodedBytes:L,decodedBytes:b}}function H0($,f,w,Z){let Y=X6($,f,{maxEncodedBytes:w.maxImageEncodedBytes,maxDecodedBytes:w.maxImageDecodedBytes});if(!Y.ok)return _0(Z,Y.reason),Y;let K=J0(Y.encodedBytes,Y.decodedBytes,w,Z);if(K)return K;return Y}function M($){return $.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}var K0="ERROR: EMPTY CONTENT",Bf="[image attached]",If="[generated image]";function Of($){return`[generated ${$}]`}function D0($){return{type:"text",text:`[generated ${$.modality} unavailable to this model]`}}function o0($,f){let w=$[$.length-1];if(f.role==="tool"&&w?.role==="tool"&&Array.isArray(w.content)&&Array.isArray(f.content)){w.content.push(...f.content);return}$.push(f)}function Nf($){if(!Array.isArray($)||$.length===0)return!1;return $.every((f)=>{if(!f||typeof f!=="object")return!1;let w=f;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 G6($){return J0(v,0,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},$)===null}function Q6($){try{return new URL($).protocol}catch{return}}function l0($,f){let w=H0($.mediaType,$.data,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},f);if(!w.ok)return d();return j6(w.base64,w.mediaType)}function j6($,f){return{type:"file",data:{type:"data",data:$},mediaType:f}}function e($,f){return{type:"file",data:$,mediaType:f??"image"}}function d0($,f){if($.image instanceof URL){if($.image.protocol==="data:"){let X=H0($.mediaType,$.image.href,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},f);if(!X.ok)return d();return e(`data:${X.mediaType};base64,${X.base64}`,X.mediaType)}if($.image.protocol!=="http:"&&$.image.protocol!=="https:")return d();if(!G6(f))return d();return e($.image,$.mediaType)}if(typeof $.image==="string"){let X=Q6($.image);if(X==="http:"||X==="https:"){if(!G6(f))return d();return e($.image,$.mediaType)}let G=X==="data:",V=H0($.mediaType??(G?void 0:"image/png"),$.image,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},f);if(!V.ok)return d();return e(G?`data:${V.mediaType};base64,${V.base64}`:V.base64,V.mediaType)}let w=$.image.byteLength,Z=z0(w),Y=$.mediaType?.toLowerCase()??"image/png";if(!L0.includes(Y)||J0(Z,w,{maxImageEncodedBytes:v,maxImageDecodedBytes:x},f))return d();return e($.image,Y)}function bf($,f){if(!f)return!0;if($.modality==="file")return $.mediaType==="application/pdf"&&f.includes("pdf");return f.includes($.modality)}function R6($,f,w){if(!bf($,w))return D0($);if($.modality==="image"){if($.source.type==="artifact")return D0($);return d0({type:"image",image:$.source.type==="url"?$.source.url:$.source.data,mediaType:$.mediaType},f)}if($.source.type==="artifact")return D0($);if($.source.type==="url"){let Z=Q6($.source.url);if(Z!=="http:"&&Z!=="https:"&&Z!=="data:")return D0($)}return e($.source.type==="url"?$.source.url:$.source.data,$.mediaType)}function m0($,f,w,Z){let{hoistImages:Y,inlineImagePlaceholder:K}=Z;if($==null||typeof $!=="object")return{value:$,changed:!1,mediaChanged:!1};if(Array.isArray($)){let _=[],L=!1,D=!1;for(let b of $){if(b&&typeof b==="object"){let k=b;if(k.type==="image"&&typeof k.data==="string"&&typeof k.mediaType==="string"){if(!Y){_.push(K),L=!0,D=!0;continue}let O0={type:"image",data:k.data,mediaType:k.mediaType},p=l0(O0,w);if(p.type==="file")f.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=m0(b,f,w,Z);_.push(E.value),L||=E.changed,D||=E.mediaChanged}return{value:L?_:$,changed:L,mediaChanged:D}}let X=$;if(X.type==="image"){if(typeof X.data==="string"&&typeof X.mediaType==="string"){if(!Y)return{value:K,changed:!0,mediaChanged:!0};let _={type:"image",data:X.data,mediaType:X.mediaType},L=l0(_,w);if(L.type==="file")return f.push({type:"image",data:L.data.data,mediaType:L.mediaType}),{value:Bf,changed:!0,mediaChanged:!0};return{value:L.text,changed:!0,mediaChanged:!0}}return{value:a,changed:!0,mediaChanged:!0}}let G={},V=!1,W=!1;for(let[_,L]of Object.entries(X)){let D=m0(L,f,w,Z);G[_]=D.value,V||=D.changed,W||=D.mediaChanged}return{value:V?G:$,changed:V,mediaChanged:W}}function X0($){if(typeof $==="string")return M($);if(Array.isArray($))return $.map((f)=>X0(f));if($!==null&&typeof $==="object"){let f=$,w={};for(let[Z,Y]of Object.entries(f))w[Z]=X0(Y);return w}return $}function V6($,f=!1,w=U0(),Z){let Y=Z?.supportsImages??!0;if(typeof $==="string")return{type:f?"error-text":"text",value:M($)};if(!f&&Nf($))return{type:"content",value:$.map((K)=>K.type==="image"?Y?l0(K,w):{type:"text",text:t}:{type:"text",text:M(K.text)})};if($!==null&&typeof $==="object"){let K=[],X=m0($,K,w,{hoistImages:!f&&Y,inlineImagePlaceholder:Y?a:t});if(!f&&K.length>0)return{type:"content",value:[{type:"text",text:typeof X.value==="string"?M(X.value):JSON.stringify(X0(X.value))},...K.map((V)=>j6(V.data,V.mediaType))]};if(X.mediaChanged)return{type:f?"error-json":"json",value:X0(X.value)}}if($===null||typeof $==="boolean"||typeof $==="number"||typeof $==="object")return{type:f?"error-json":"json",value:X0($)};return{type:f?"error-text":"text",value:M(String($))}}function Ef($,f,w){let Z=w?.assistantToolCallArgKey??"input",Y=w?.supportedInputModalities,K=!Y||Y.includes("image"),X=[],G=U0(),V=[],W=()=>{return V.splice(0).map((L)=>L.type==="image"?K?d0(L,G):{type:"text",text:t}:R6(L.media,G,Y))};if(typeof $==="string"&&$.trim().length>0||Array.isArray($)&&$.length>0)X.push({role:"system",content:typeof $==="string"?M($):$});for(let _ of f){let L=_.content;if(typeof L==="string"){let k=_.role==="user"&&V.length>0?W():[];if(k.length>0){X.push({role:_.role,content:[{type:"text",text:L.trim().length>0?M(L):K0},...k]});continue}if(L.trim().length===0){X.push({role:_.role,content:[{type:"text",text:K0}]});continue}X.push({role:_.role,content:M(L)});continue}let D=[],b=[];if(L.length===0){X.push({role:_.role,content:[{type:"text",text:K0}]});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:If});else D.push(K?d0(k,G):{type:"text",text:t});break;case"media":if(_.role==="assistant")V.push(k),D.push({type:"text",text:Of(k.media.modality)});else D.push(R6(k.media,G,Y));break;case"file":D.push({type:"text",text:v0(k.path,M(k.content))});break;case"tool-call":if(_.role==="assistant")D.push({type:"tool-call",toolCallId:k.toolCallId,toolName:k.toolName,[Z]:k.input,...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"tool-result":{b.push({type:"tool-result",toolCallId:k.toolCallId,toolName:k.toolName,output:V6(k.output,k.isError??!1,G,{supportsImages:K})});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:K0});if(D.length>0)o0(X,{role:_.role,content:D});if(E)o0(X,{role:"tool",content:b})}if(V.length>0)o0(X,{role:"user",content:W()});return X}var P3=["show","hide","subscription"];function k6($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function Tf($,f){if(!$&&!f)return;let w=$?.metadata,Z=f?.metadata,Y={...$??{},...f??{}};if(k6(w)&&k6(Z))Y.metadata={...w,...Z};return Y}var I3=["web_search","image_generation"],O3=["web_search"];var G0={max:1,xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},Mf=void 0;function yf($,f){if(typeof $==="string"&&$.toLowerCase()in G0)return $.toLowerCase();return f?void 0:void 0}function W6($,f){let w=typeof $==="string"?$.toLowerCase():void 0;if(w&&w in G0)return G0[w];if(f?.fallbackEffort)return G0[f.fallbackEffort];return}function Cf($){let f=W6($.effort,{fallbackEffort:$.fallbackEffort});if(f===void 0)return;if(f<=0)return 0;let w=$.minimumBudget??1;if($.maxBudget<w)return;let Z=$.scaleTokens??$.maxBudget;return Math.min(Math.max(Math.floor(Z*f),w),$.maxBudget)}function Sf($){return $ instanceof Error?{name:$.name,message:$.message}:$}var gf=3;function F6($){return Math.max(1,Math.ceil($/3))}function p0($){let f=new WeakSet;try{return JSON.stringify($,(w,Z)=>{if(typeof Z==="bigint")return Z.toString();if(typeof Z!=="object"||Z===null)return Z;if(f.has(Z))return"[Circular]";return f.add(Z),Z})??""}catch{return String($??"")}}function vf($){let f;try{f=JSON.stringify({systemPrompt:$.systemPrompt,messages:$.messages,tools:$.tools})}catch{f=[p0($.systemPrompt),p0($.messages),p0($.tools)].join(`
|
|
4
|
+
`)}return F6(f.length)}var nf={debug:()=>{},log:()=>{},error:()=>{}};var y3=60,C3=1,S3=3600;function hf($){return typeof $==="number"&&Number.isFinite($)}function xf($){return Math.min(Math.max($,1),3600)}function g3($){if(!hf($))return 60;return xf($)}function v3($,f,w){let Z=w?` (${w})`:"",Y=Math.round(f/100)/10;return`MCP request to "${$}"${Z} timed out after ${Y}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function zf($){if($ instanceof Error)return $.message;return String($)}function cf($){if($&&typeof $==="object"&&"code"in $&&typeof $.code==="string")return $.code;return""}class o extends Error{constructor($,f){super(`${$} at position ${f}`);this.position=f}}function _6($){return/^[0-9A-Fa-f]$/.test($)}function c($){return $>="0"&&$<="9"}function L6($){return $>=" "}function f0($){return`,:[]/{}()
|
|
5
|
+
+`.includes($)}function r0($){return $>="a"&&$<="z"||$>="A"&&$<="Z"||$==="_"||$==="$"}function P0($){return $>="a"&&$<="z"||$>="A"&&$<="Z"||$==="_"||$==="$"||$>="0"&&$<="9"}var s0=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,i0=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function a0($){return`,[]/{}
|
|
6
|
+
+`.includes($)}function t0($){return w0($)||uf.test($)}var uf=/^[[{\w-]$/;function e0($){return $===`
|
|
7
|
+
`||$==="\r"||$==="\t"||$==="\b"||$==="\f"}function z($,f){let w=$.charCodeAt(f);return w===32||w===10||w===9||w===13}function U6($,f){let w=$.charCodeAt(f);return w===32||w===9||w===13}function D6($,f){let w=$.charCodeAt(f);return w===160||w===6158||w>=8192&&w<=8203||w===8239||w===8287||w===12288||w===65279}function w0($){return $1($)||A0($)}function $1($){return $==='"'||$==="“"||$==="”"}function f1($){return $==='"'}function A0($){return $==="'"||$==="‘"||$==="’"||$==="`"||$==="´"}function w1($){return $==="'"}function Z0($,f){let w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,Z=$.lastIndexOf(f);return Z!==-1?$.substring(0,Z)+(w?"":$.substring(Z+1)):$}function y($,f){let w=$.length;if(!z($,w-1))return $+f;while(z($,w-1))w--;return $.substring(0,w)+f+$.substring(w)}function P6($,f,w){return $.substring(0,f)+$.substring(f+w)}function A6($){return/[,\n][ \t\r]*$/.test($)}var of={""":'"',"&":"&","<":"<",">":">","'":"'"},Z1=12;function q1($){if($.charAt(0)!=="&")return null;let f=$.indexOf(";");if(f===-1)return null;let w=$.substring(0,f+1),Z=of[w];if(Z!==void 0)return{char:Z,length:w.length};if($.charAt(1)==="#"){let Y=$.substring(2,f),K=Y.charAt(0)==="x"||Y.charAt(0)==="X",X=K?Y.substring(1):Y;if(X.length>0){let G=Number.parseInt(X,K?16:10);if(!Number.isNaN(G)&&G>=0&&G<=1114111)return{char:String.fromCodePoint(G),length:w.length}}}return null}function B6($){return $!==null&&$.char==='"'}function I6($){return $!==null&&$.char==="'"}function $0($,f){let w=0;for(let Z=0;Z<$.length;Z++)if($.charAt(Z)===f)w++;return w}function O6($,f){switch(f){case")":return $0($,"(")>$0($,")");case"]":return $0($,"[")>$0($,"]");case"}":return $0($,"{")>$0($,"}");default:return!1}}var N6={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},lf={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
8
|
+
`,r:"\r",t:"\t"};function Y1($){let f=0,w="";if(W(["```","[```","{```"]),!K())F$();W(["```","```]","```}"]);let Y=L(",");if(Y)X();if(t0($[f])&&A6(w)){if(!Y)w=y(w,",");p()}else if(Y)w=Z0(w,",");while($[f]==="}"||$[f]==="]")f++,X();if(f>=$.length)return w;N0();function K(){X();let Q=k()||O0()||r()||I()||j$()||U1(!1)||V$();return X(),Q}function X(){let Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,j=f,P=G(Q);do if(P=V(),P)P=G(Q);while(P);return f>j}function G(Q){let j=Q?z:U6,P="";while(!0)if(j($,f))P+=$[f],f++;else if(D6($,f))P+=" ",f++;else break;if(P.length>0)return w+=P,!0;return!1}function V(){if($[f]==="/"&&$[f+1]==="*"){while(f<$.length&&!df($,f))f++;return f+=2,!0}if($[f]==="/"&&$[f+1]==="/"){while(f<$.length&&$[f]!==`
|
|
9
|
+
`)f++;return!0}return!1}function W(Q){if(_(Q)){if(r0($[f]))while(f<$.length&&P0($[f]))f++;return X(),!0}return!1}function _(Q){G(!0);for(let j of Q){let P=f+j.length;if($.slice(f,P)===j)return f=P,!0}return!1}function L(Q){if($[f]===Q)return w+=$[f],f++,!0;return!1}function D(Q){if($[f]===Q)return f++,!0;return!1}function b(){return D("\\")}function E(){if(X(),$[f]==="."&&$[f+1]==="."&&$[f+2]===".")return f+=3,X(),D(","),!0;return!1}function k(){if($[f]==="{"){if(w+="{",f++,X(),D(","))X();let Q=!0;while(f<$.length&&$[f]!=="}"){let j;if(!Q){if(j=L(","),!j)w=y(w,",");X()}else j=!0;if(E(),!(r()||U1(!0))){if($[f]==="}"||$[f]==="{"||$[f]==="]"||$[f]==="["||$[f]===void 0){if(!Q)w=Z0(w,",")}else _$();break}X();let n=L(":"),i=f>=$.length;if(!n)if(t0($[f])||i)w=y(w,":");else A1();if(!K())if(n||i)w+="null";else A1();Q=!1}if($[f]==="}")w+="}",f++;else w=y(w,"}");return!0}return!1}function O0(){if($[f]==="["){if(w+="[",f++,X(),D(","))X();let Q=!0;while(f<$.length&&$[f]!=="]"){if(!Q){if(!L(","))w=y(w,",")}if(E(),!K()){if(!Q)w=Z0(w,",");break}Q=!1}if($[f]==="]")w+="]",f++;else w=y(w,"]");return!0}return!1}function p(){let Q=!0,j=!0;while(j){if(!Q){if(!L(","))w=y(w,",")}else Q=!1;j=K()}if(!j)w=Z0(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
|
|
12
|
-
`)A+="\\n"
|
|
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(f++,!w0($[f]))N0()}let n=$[f]==="&"?q1($.slice(f,f+Z1)):null,i=B6(n)||I6(n);if(w0($[f])||i){let B1=f1($[f])?f1:w1($[f])?w1:A0($[f])?A0:$1,Q0=f,j0=w.length,A='"';f+=i&&n?n.length:1;while(!0){if(f>=$.length){let O=D1(f-1);if(!Q&&f0($.charAt(O)))return f=Q0,w=w.substring(0,j0),r(!0);return A=y(A,'"'),w+=A,!0}if(f===j)return A=y(A,'"'),w+=A,!0;let h=i&&$[f]==="&"?q1($.slice(f,f+Z1)):null;if(h&&n?h.char===n.char:B1($[f])){let O=f,b0=A.length;if(A+='"',f+=h?h.length:1,w+=A,X(!1),Q||f>=$.length||f0($[f])&&!O6(A,$[f])||w0($[f])&&!k$(f)||c($[f]))return L1(),!0;if($[f]==="\\")N0();let u=D1(O-1),I1=$.charAt(u);if(I1===",")return f=Q0,w=w.substring(0,j0),r(!1,u);if(f0(I1))return f=Q0,w=w.substring(0,j0),r(!0);w=w.substring(0,j0),f=O+(h?h.length:1),A=`${A.substring(0,b0)}\\${A.substring(b0)}`}else if(Q&&a0($[f])){if($[f-1]===":"&&s0.test($.substring(Q0+1,f+2)))while(f<$.length&&i0.test($[f]))A+=$[f],f++;return A=y(A,'"'),w+=A,L1(),!0}else if(h){let O=h.char;if(O==='"')A+="\\\"";else if(e0(O))A+=N6[O];else A+=O;f+=h.length}else if($[f]==="\\"){let O=$.charAt(f+1);if(lf[O]!==void 0)A+=$.slice(f,f+2),f+=2;else if(O==="u"){let u=2;while(u<6&&_6($[f+u]))u++;if(u===6)A+=$.slice(f,f+6),f+=6;else if(f+u>=$.length)f=$.length;else L$()}else if(O===`
|
|
12
|
+
`)A+="\\n",f+=2;else A+=O,f+=2}else{let O=$.charAt(f);if(O==='"'&&$[f-1]!=="\\")A+=`\\${O}`,f++;else if(e0(O))A+=N6[O],f++;else{if(!L6(O))W$(O);A+=O,f++}}if(P)b()}}return!1}function L1(){let Q=!1;X();while($[f]==="+"){Q=!0,f++,X(),w=Z0(w,'"',!0);let j=w.length;if(r())w=P6(w,j,1);else w=y(w,'"')}return Q}function I(){let Q=f,j="",P=!1;if($[f]==="-"){if(j+=$[f],f++,!c($[f])&&P1())j+="0"}if($[f]==="0"&&c($[f+1]))P=!0;while(c($[f]))j+=$[f],f++;if($[f]==="."){if(j===""||j==="-")j+="0";if(j+=$[f],f++,!c($[f]))j+="0";while(c($[f]))j+=$[f],f++}if(f>Q){if($[f]==="e"||$[f]==="E"){if(j==="-")P=!0;if(j+=$[f],f++,$[f]==="-"||$[f]==="+")j+=$[f],f++;if(!c($[f]))j+="0";while(c($[f]))j+=$[f],f++}if(!P1())return f=Q,!1;return w+=P?`"${$.substring(Q,f)}"`:j,!0}return!1}function j$(){return s("true","true")||s("false","false")||s("null","null")||s("True","true")||s("False","false")||s("None","null")}function s(Q,j){if($.slice(f,f+Q.length)===Q&&!P0($[f+Q.length]))return w+=j,f+=Q.length,!0;return!1}function U1(Q){let j=f;if(r0($[f])){while(f<$.length&&P0($[f]))f++;let P=f;while(z($,P))P++;if($[P]==="("){if(f=P+1,K(),$[f]===")"){if(f++,$[f]===";")f++}return!0}}while(f<$.length&&!a0($[f])&&!w0($[f])&&(!Q||$[f]!==":"))f++;if($[f-1]===":"&&s0.test($.substring(j,f+2)))while(f<$.length&&i0.test($[f]))f++;if(f>j){while(z($,f-1)&&f>0)f--;let P=$.slice(j,f);if(w+=P==="undefined"?"null":JSON.stringify(P),$[f]==='"')f++;return!0}}function V$(){if($[f]==="/"){let Q=f;f++;while(f<$.length&&($[f]!=="/"||$[f-1]==="\\"))f++;return f++,w+=JSON.stringify($.substring(Q,f)),!0}}function D1(Q){let j=Q;while(j>0&&z($,j))j--;return j}function k$(Q){let j=Q+1;while(j<$.length&&z($,j))j++;return j>=$.length||f0($[j])}function P1(){return f>=$.length||f0($[f])||z($,f)}function W$(Q){throw new o(`Invalid character ${JSON.stringify(Q)}`,f)}function N0(){throw new o(`Unexpected character ${JSON.stringify($[f])}`,f)}function F$(){throw new o("Unexpected end of json string",$.length)}function _$(){throw new o("Object key expected",f)}function A1(){throw new o("Colon expected",f)}function L$(){let Q=$.slice(f,f+6);throw new o(`Invalid unicode character "${Q}"`,f)}}function df($,f){return $[f]==="*"&&$[f+1]==="/"}function mf($){let f=!1,w=!1,Z=!1;for(let Y=0;Y<$.length;Y+=1){let K=$[Y];if(Z){Z=!1;continue}if(K==="\\"){Z=!0;continue}if(!w&&K==='"')f=!f;else if(!f&&K==="'")w=!w}return f||w}var pf=/^\{\s*"([A-Za-z0-9_.$-]+)"\s*:\s*([\s\S]+?)\s*\}$/;function rf($){let f=$.match(pf);if(!f)return;let[,w,Z]=f,Y=Z.trim();if(!Y)return;let K=Y[0];if(K==='"'||K==="{"||K==="["||Y==="true"||Y==="false"||Y==="null"||Number.isFinite(Number(Y)))return;return JSON.parse(`{"${w}":${JSON.stringify(Y)}}`)}function sf($){if(typeof $!=="string")return $;let f=$.trimStart();if(f[0]!=="{"&&f[0]!=="[")return $;try{return JSON.parse(f)}catch{}if(!mf(f))try{return JSON.parse(Y1(f))}catch{}return rf(f)??$}function af($){let f=new WeakSet;try{return JSON.stringify($,(Z,Y)=>{if(typeof Y==="bigint")return Y.toString();if(Y&&typeof Y==="object"){if(f.has(Y))return"[Circular]";f.add(Y)}return Y})??"null"}catch{return String($)}}function tf($){try{return JSON.parse($)}catch{return}}function q0($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function ef($){let f=$.type;if(typeof f==="string")return[f];return Array.isArray(f)?f.filter((w)=>typeof w==="string"):[]}function J1($,f){if(ef($).includes(f))return!0;for(let Z of["anyOf","oneOf","allOf"]){let Y=$[Z];if(Array.isArray(Y)&&Y.some((K)=>q0(K)&&J1(K,f)))return!0}return!1}function $2($,f){if(typeof $!=="string")return $;let w=$.trim(),Z=J1(f,"array"),Y=J1(f,"object");if((!Z||!w.startsWith("["))&&(!Y||!w.startsWith("{")))return $;try{let K=JSON.parse(w);if(Array.isArray(K))return Z?K:$;if(q0(K))return Y?K:$;return $}catch{return $}}function H1($,f){let w=$2($,f);if(Array.isArray(w)){let X=f.items;if(!q0(X))return w;let G=!1,V=w.map((W)=>{let _=H1(W,X);return G||=_!==W,_});return G?V:w}if(!q0(w))return w;let Z=f.properties;if(!q0(Z))return w;let Y=!1,K={...w};for(let[X,G]of Object.entries(Z)){if(!(X in w)||!q0(G))continue;let V=H1(w[X],G);if(V!==w[X])K[X]=V,Y=!0}return Y?K:w}function f2($){if(typeof globalThis.atob==="function")try{let f=globalThis.atob($),w=Uint8Array.from(f,(Z)=>Z.charCodeAt(0));return new TextDecoder().decode(w)}catch{return null}if(typeof Buffer<"u")try{return Buffer.from($,"base64").toString("utf8")}catch{return null}return null}function w2($){let f=$?.trim();if(!f)return null;try{let w=f.split(".");if(w.length!==3)return null;let Z=w[1];if(!Z)return null;let Y=Z.replace(/-/g,"+").replace(/_/g,"/"),K=Y.padEnd(Y.length+(4-Y.length%4)%4,"="),X=f2(K);return X?JSON.parse(X):null}catch{return null}}function Z2($){return Object.fromEntries(Object.entries($).filter(([,f])=>f!==void 0))}function q2($){let f=$.replaceAll("\\","/"),w=f.lastIndexOf("/");return(w>=0?f.slice(w+1):f).toLowerCase()}function Y2($){return $==="win32"?"powershell":"/bin/bash"}function K1($){let f=q2($);if(f==="powershell"||f==="powershell.exe"||f==="pwsh"||f==="pwsh.exe")return"powershell";if(f==="cmd"||f==="cmd.exe")return"cmd";if(f==="wsl"||f==="wsl.exe")return"wsl";return"posix"}function b6($,f){switch(K1($)){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:f};case"cmd":return{args:["/d","/s","/c",f]};case"wsl":return{args:["bash","-c",f]};case"posix":return{args:["-c",f]}}}function J2($,f){if(K1($)==="powershell")return["-NoProfile","-NonInteractive","-Command",f];return b6($,f).args}function H2($){return $.toLowerCase().replace(/[^\w.-]+/g,"_")}function K2($){let f=$?.trim();return f?f:void 0}function E6($,f){if($.length<=f)return $;return`${$.slice(0,f-1)}…`}function X2($,f="/",w=100){if(!$||$.length<=w)return $||"";let Z=$.split(f)?.shift()?.trim()?.slice(0,w-1);return Z?`${Z}…`:E6($,w)}function G2($){if($.length<=8)return"****";return`${$.slice(0,4)}...${$.slice(-4)}`}function R2($){return $.charCodeAt(0)===65279?$.slice(1):$}function Q2($){if(!$)return"(unknown-date)";let f=new Date($);if(Number.isNaN(f.getTime()))return $;return f.toLocaleString("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0})}function j2($){let f=Math.max(0,Math.floor($/1000)),w=Math.floor(f/86400),Z=Math.floor(f%86400/3600),Y=Math.floor(f%3600/60),K=f%60;if(w>0)return`${w}d ${Z}h`;if(Z>0)return`${Z}h ${Y}m`;if(Y>0)return`${Y}m ${K}s`;return`${K}s`}import{z as T6}from"zod";function V2($,f){let w=$.safeParse(f);if(!w.success)throw Error(T6.prettifyError(w.error));return w.data}function X1($){return T6.toJSONSchema($)}function G1($){return $==="cline"||$==="cline-pass"}var M6=`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}}`,y6=`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
|
|
77
|
+
{{CLINE_METADATA}}`;var R1="# Workspace Configuration",S6=`# 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.`,g6=`# 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.`,v6=`${g6}
|
|
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.`,n6=`${g6}
|
|
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
|
|
95
|
-
${
|
|
96
|
-
${
|
|
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 C6($,f,w){if(w?.trim()?.includes(R1))return w.trim();let Z=w||JSON.stringify({workspaces:{[$]:{hint:f||$.split("/").at(-1)||$}}},null,2);return`
|
|
95
|
+
${R1}
|
|
96
|
+
${Z}`}function k2($){let{ide:f="Terminal Shell",mode:w,platform:Z="unknown",workspaceName:Y,metadata:K,rules:X,overridePrompt:G,providerId:V,planModeSwitchTool:W=!0}=$,_=$.workspaceRoot??$.rootPath??"",L=G1(V||"");if(G?.trim()){let E=G.trim();if(L&&K?.trim()&&!E.includes(R1))return`${E}
|
|
97
97
|
|
|
98
|
-
${
|
|
98
|
+
${C6(_,Y,K)}`.trim();return E}let D=w==="yolo"?y6:M6,b=[X,S6,w==="plan"?W?v6:n6: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?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};
|
|
100
|
+
`);return D.replace("{{PLATFORM_NAME}}",Z).replace("{{CWD}}",_).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",f).replace("{{CLINE_METADATA}}",L?C6(_,Y,K):"").replace("{{CLINE_RULES}}",b).trim()}var W2="anthropic/claude-sonnet-5";var F2="remote://";import{z as H}from"zod";var h6=H.object({id:H.string(),temperature:H.number().optional(),maxTokens:H.number().optional(),contextWindow:H.number().optional(),inputPrice:H.number().optional(),outputPrice:H.number().optional(),supportsImages:H.boolean().optional()}),x6=H.object({models:H.array(h6).optional(),openAiBaseUrl:H.string().optional(),openAiHeaders:H.record(H.string(),H.string()).optional(),azureApiVersion:H.string().optional(),azureIdentity:H.boolean().optional()}),z6=H.object({id:H.string(),thinkingBudgetTokens:H.number().optional()}),c6=H.object({name:H.string(),baseModelId:H.string(),thinkingBudgetTokens:H.number().optional()}),u6=H.object({models:H.array(z6).optional(),customModels:H.array(c6).optional(),awsRegion:H.string().optional(),awsUseCrossRegionInference:H.boolean().optional(),awsUseGlobalInference:H.boolean().optional(),awsBedrockUsePromptCache:H.boolean().optional(),awsBedrockEndpoint:H.string().optional()}),o6=H.object({id:H.string()}),l6=H.object({models:H.array(o6).optional()}),d6=H.object({id:H.string(),thinkingBudgetTokens:H.number().optional()}),m6=H.object({models:H.array(d6).optional(),vertexProjectId:H.string().optional(),vertexRegion:H.string().optional()}),p6=H.object({id:H.string(),thinkingBudgetTokens:H.number().optional(),promptCachingEnabled:H.boolean().optional()}),r6=H.object({models:H.array(p6).optional(),baseUrl:H.string().optional()}),s6=H.object({id:H.string(),thinkingBudgetTokens:H.number().optional()}),i6=H.object({models:H.array(s6).optional(),baseUrl:H.string().optional()}),_2=H.object({OpenAiCompatible:x6.optional(),AwsBedrock:u6.optional(),Cline:l6.optional(),Vertex:m6.optional(),LiteLLM:r6.optional(),Anthropic:i6.optional()}),a6=H.object({id:H.string()}),t6=H.object({name:H.string(),url:H.string(),alwaysEnabled:H.boolean().optional(),headers:H.record(H.string(),H.string()).optional()}),Q1=H.object({alwaysEnabled:H.boolean(),name:H.string(),contents:H.string()}),B0=H.object({bucket:H.string(),accessKeyId:H.string(),secretAccessKey:H.string(),region:H.string().optional(),endpoint:H.string().optional(),accountId:H.string().optional()}),e6=H.object({enabled:H.boolean().optional(),type:H.union([H.literal("s3_access_keys"),H.literal("r2_access_keys"),H.literal("azure_access_keys")]).optional(),s3AccessSettings:B0.optional(),r2AccessSettings:B0.optional(),azureAccessSettings:B0.optional()}),$$=H.object({promptUploading:e6.optional()}),L2=H.object({version:H.string(),providerSettings:_2.optional(),telemetryEnabled:H.boolean().optional(),kanbanEnabled:H.boolean().optional(),mcpMarketplaceEnabled:H.boolean().optional(),allowedMCPServers:H.array(a6).optional(),remoteMCPServers:H.array(t6).optional(),blockPersonalRemoteMCPServers:H.boolean().optional(),yoloModeAllowed:H.boolean().optional(),openTelemetryEnabled:H.boolean().optional(),openTelemetryMetricsExporter:H.string().optional(),openTelemetryLogsExporter:H.string().optional(),openTelemetryOtlpProtocol:H.string().optional(),openTelemetryOtlpEndpoint:H.string().optional(),openTelemetryOtlpHeaders:H.record(H.string(),H.string()).optional(),openTelemetryOtlpMetricsProtocol:H.string().optional(),openTelemetryOtlpMetricsEndpoint:H.string().optional(),openTelemetryOtlpMetricsHeaders:H.record(H.string(),H.string()).optional(),openTelemetryOtlpLogsProtocol:H.string().optional(),openTelemetryOtlpLogsEndpoint:H.string().optional(),openTelemetryOtlpLogsHeaders:H.record(H.string(),H.string()).optional(),openTelemetryMetricExportInterval:H.number().optional(),openTelemetryOtlpInsecure:H.boolean().optional(),openTelemetryLogBatchSize:H.number().optional(),openTelemetryLogBatchTimeout:H.number().optional(),openTelemetryLogMaxQueueSize:H.number().optional(),enterpriseTelemetry:$$.optional(),globalRules:H.array(Q1).optional(),globalWorkflows:H.array(Q1).optional()}),U2=H.record(H.string(),H.string());var D2=4317;var P2="127.0.0.1:4317";import j1 from"zod";var A2=j1.enum(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),B2=j1.enum(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),I2=j1.enum(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var O2="runtime.team.progress.v1",N2="runtime.team.lifecycle.v1";var b2="CLINE_ENVIRONMENT",E2="CLINE_ENVIRONMENT_OVERRIDE",V1={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"}},T2="production";function f$($){let f=$?.trim().toLowerCase();if(f==="production"||f==="staging"||f==="local")return f;return}function w$(){if(typeof process>"u"||!process?.env)return{};return process.env}function Z$(){let $=w$();return f$($.CLINE_ENVIRONMENT_OVERRIDE)??f$($.CLINE_ENVIRONMENT)??"production"}function M2($){if(typeof $==="string")return V1[$];return V1[Z$()]}function y2($,f){if(f.CLINE_API_BASE_URL)$={...$,apiBaseUrl:f.CLINE_API_BASE_URL,mcpBaseUrl:`${f.CLINE_API_BASE_URL}/v1/mcp`};return $}function C2($){let f=M2($);return y2(f,w$())}var S2="agent.reasoning.unexpected_tokens",g2="task.provider_request_started",v2="task.provider_stream_started",n2="task.first_chunk_received",h2="task.provider_stream_failed",x2="task.cancelled",z2="sdk.error";var m=new Map;function c2(){m.clear()}function u2($,f){let w=typeof f.error_message==="string"?f.error_message:"";return[$,f.component,f.operation,f.error_type,f.error_code??"",f.error_status??"",w.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function o2($){let f=Date.now(),w=m.get($);if(w&&f-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 Z=w?.suppressed??0;if(m.delete($),m.size>=512){let Y=m.keys().next();if(!Y.done)m.delete(Y.value)}return m.set($,{startMs:f,emitted:1,suppressed:0}),{emit:!0,suppressed:Z}}function l2($,f){$?.capture({event:"agent.reasoning.unexpected_tokens",properties:W1({sessionId:f.sessionId,agentId:f.agentId,runId:f.runId,iteration:f.iteration,providerId:f.providerId,modelId:f.modelId,requestedThinking:f.requestedThinking,reasoningTokenCount:f.reasoningTokenCount})})}function d2($,f){if(!$)return;$.capture({event:f.event,properties:W1({sessionId:f.sessionId,ulid:f.ulid??f.sessionId,agentId:f.agentId,conversationId:f.conversationId,runId:f.runId,iteration:f.iteration,provider:f.providerId,providerId:f.providerId,model:f.modelId,modelId:f.modelId,phase:f.phase,durationMs:f.durationMs,eventType:f.eventType,...f.error===void 0?{}:F1(f.error,f.messageLimit),error_class:f.errorClass})})}function m2($,f){if(!$)return!1;let w=f.event??"sdk.error",Z=q$(f),Y=0;try{let K=o2(u2(w,Z));if(!K.emit)return!0;Y=K.suppressed}catch{}return $.capture({event:w,properties:Y>0?{...Z,suppressed_count:Y}:Z}),!0}function q$($){return W1({...$.context??{},component:$.component,operation:$.operation,severity:$.severity??"error",handled:$.handled??!0,...F1($.error,$.messageLimit,$.errorMessage)})}function W1($){let f={};for(let[w,Z]of Object.entries($))if(Z!==void 0)f[w]=Z;return f}function F1($,f=500,w){let Z=s2($)?$:void 0,Y=$ instanceof Error?$:void 0,K=R0(w)??R0(Y?.message)??R0(Z?.message)??i2($)??"Unknown error",X=a2(Z?.code),G=k1(Z?.status)??k1(Z?.statusCode)??k1(Z?.responseStatus);return{error_type:Y?.name?.trim()||R0(Z?.name)||Y?.constructor?.name||"Error",error_message:r2(p2(K),f),...X!==void 0?{error_code:X}:{},...G!==void 0?{error_status:G}:{}}}function p2($){return $.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 r2($,f){let w=Math.max(1,Math.floor(f));return $.length>w?$.substring(0,w):$}function s2($){return typeof $==="object"&&$!==null}function R0($){return typeof $==="string"&&$.trim().length>0?$:void 0}function i2($){if($ instanceof Error)return;let f=typeof $==="string"?$:String($);return f==="[object Object]"?void 0:R0(f)}function a2($){if(typeof $==="string"&&$.trim().length>0)return $;if(typeof $==="number"&&Number.isFinite($))return $;return}function k1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function Y$($){let f={};if(!$)return f;return $.split(",").forEach((w)=>{let Z=w.indexOf("=");if(Z<=0)return;try{let Y=decodeURIComponent(w.substring(0,Z).trim()),K=decodeURIComponent(w.substring(Z+1).trim());if(!Y||!K)return;f[Y]=K}catch{}}),f}function t2(){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?Y$(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function J$($={}){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",...$}}function e2($={}){return{...t2(),...$,metadata:J$($.metadata)}}function H$($){let f=$?.trim();return f?f:void 0}function $4($,f){if(!$)return;let w=typeof $==="function"?$(f):$;if(!w)return;let Z=H$(w.rootSessionId);if(!Z)return;return{rootSessionId:Z}}function f4($){return H$($?.rootSessionId)}var w4=($)=>crypto.getRandomValues(new Uint8Array($)),Z4=($,f,w)=>{let Z=256-256%$.length;if(Z===256){let K=$.length-1;return(X=f)=>{if(!X)return"";let G="";while(!0){let V=w(X),W=X;while(W--)if(G+=$[V[W]&K],G.length>=X)return G}}}let Y=Math.ceil(409.6*f/Z);return(K=f)=>{if(!K)return"";let X="";while(!0){let G=w(Y),V=Y;while(V--)if(G[V]<Z){if(X+=$[G[V]%$.length],X.length>=K)return X}}}},K$=($,f=21)=>Z4($,f|0,w4);function q4($="",f=""){let w=K$("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${$}${Date.now()}_${w(5)}${f}`}var Y4=["idle","running","pending","completed","failed","cancelled"];var _1=["rules","skills","workflows","plugins","hooks"],X$=_1,J4=new Set(_1);function G$($){return typeof $==="string"&&J4.has($)}function H4($){if(!Array.isArray($))return;let f=$.map((w)=>typeof w==="string"?w.trim():"").filter(G$);return[...new Set(f)]}function K4($,f){return new Set($??X$).has(f)}import{z as C}from"zod";var X4=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()}),G4=C.object({currentWorkspacePath:C.string().min(1).optional(),workspaces:C.record(C.string().min(1),X4)});function b8(){return{workspaces:{}}}function E8($,f){let w={...$,workspaces:{...$.workspaces,[f.rootPath]:f}};if(!w.currentWorkspacePath)w.currentWorkspacePath=f.rootPath;return G4.parse(w)}var R4="workspaces",Q4="chat";function j4($){let f=$.trim(),w=/^[A-Za-z]:[\\/]/.test(f)||f.startsWith("\\\\"),Z=f.startsWith("/");if(!w&&!Z)return!1;let Y=f.split(w?/[\\/]+/:/\/+/).filter(Boolean),K=Y.at(-1)??"",X=Y.at(-2)??"",G=Y.at(-3)??"";return(Y.at(-4)??"")===".cline"&&G==="data"&&X==="workspaces"&&K==="chat"}import{z as q}from"zod";var V4=["current_state","boundary_analysis","interface_proposal"],C8=3600000,S8=240,g8=400,S=q.preprocess(($)=>$ instanceof Date?$.toISOString():$,q.string().datetime()),Y0=q.enum(["pending","in_progress","blocked","completed"]),R$=q.enum(["queued","running","completed","failed","cancelled","interrupted"]),I0=q.enum(["draft","in_review","finalized"]),k4=q.object({agentId:q.string(),role:q.enum(["lead","teammate"]),description:q.string().optional(),status:q.enum(["idle","running","stopped"])}),v8=q.object({agentId:q.string(),rolePrompt:q.string(),modelId:q.string().optional(),maxIterations:q.number().optional()});function B($){return q.preprocess((f)=>f===null?void 0:f,$.optional())}var n8=q.object({agentId:q.string().min(1).describe("Teammate identifier"),rolePrompt:q.string().min(1).describe("System prompt describing teammate role")}).strict(),h8=q.object({agentId:q.string().min(1).describe("Teammate identifier"),reason:B(q.string().min(1)).describe("Optional shutdown reason")}),x8=q.object({}),W4={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},z8={create:["status","taskId","summary","reason"]},c8=q.object({action:q.enum(["create","list","claim","complete","block"]),title:B(q.string().min(1)).describe("Task title"),description:B(q.string().min(1)).describe("Task details"),dependsOn:B(q.array(q.string().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:B(q.string().min(1)).describe("Optional assignee"),status:B(q.enum(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:B(q.string()).describe("Task ID"),summary:B(q.string().min(1)).describe("Completion summary"),reason:B(q.string().min(1)).describe("Blocking reason")}).superRefine(($,f)=>{for(let w of W4[$.action]){if($[w]!==void 0)continue;f.addIssue({code:"custom",path:[w],message:`Field "${w}" is required when action=${$.action}`})}}),u8=q.object({agentId:q.string().describe("Teammate agent ID"),task:q.string().min(1).describe("Task instructions for the teammate"),taskId:B(q.string()).describe("Optional shared task list ID"),runMode:B(q.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(q.boolean()).describe("If true, continue the teammate conversation; otherwise start fresh")}),o8=q.object({status:B(q.enum(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:B(q.string().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:B(q.boolean()).describe("Include completed/failed runs (default true)")}),l8=q.object({runId:q.string().min(1).describe("Run ID"),reason:B(q.string().min(1)).describe("Optional cancellation reason")}),d8=q.object({runId:B(q.string().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),m8=q.object({toAgentId:q.string().min(1).describe("Recipient agent ID"),subject:q.string().min(1).describe("Message subject"),body:q.string().min(1).describe("Message body"),taskId:B(q.string().min(1)).describe("Optional task ID context")}),p8=q.object({subject:q.string().min(1).describe("Message subject"),body:q.string().min(1).describe("Message body"),taskId:B(q.string().min(1)).describe("Optional task ID context")}),r8=q.object({unreadOnly:B(q.boolean()).describe("Only unread messages for read action (default true)")}),s8=q.object({kind:q.enum(["progress","handoff","blocked","decision","done","error"]),summary:q.string().min(1).describe("Update summary"),taskId:B(q.string().min(1)).describe("Optional task ID context"),evidence:B(q.array(q.string().min(1))).describe("Optional evidence links/snippets"),nextAction:B(q.string().min(1)).describe("Planned next step")}),i8=q.object({}),a8=q.object({title:q.string().describe("Outcome title"),requiredSections:q.array(q.string()).default(V4).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),t8=q.object({outcomeId:q.string().describe("Outcome ID"),section:q.string().describe("Section name"),sourceRunId:B(q.string()).describe("Optional source run ID"),content:q.string().describe("Section fragment content")}),e8=q.object({fragmentId:q.string().describe("Fragment ID"),approved:q.boolean().describe("Review decision")}),$w=q.object({outcomeId:q.string().describe("Outcome ID")}),fw=q.object({}),ww=q.object({teamId:q.string(),teamName:q.string(),members:q.array(k4),taskCounts:q.record(Y0,q.number()),unreadMessages:q.number(),missionLogEntries:q.number(),activeRuns:q.number(),queuedRuns:q.number(),outcomeCounts:q.record(I0,q.number())}),F4=q.object({id:q.string(),title:q.string(),description:q.string(),status:Y0,createdAt:S,updatedAt:S,createdBy:q.string(),assignee:q.string().optional(),dependsOn:q.array(q.string()),summary:q.string().optional(),isReady:q.boolean(),blockedBy:q.array(q.string())}),Zw=q.discriminatedUnion("action",[q.object({action:q.literal("create"),taskId:q.string(),status:Y0,ignoredFields:q.array(q.string()).optional(),note:q.string().optional()}),q.object({action:q.literal("list"),tasks:q.array(F4)}),q.object({action:q.literal("claim"),taskId:q.string(),status:Y0,nextStep:q.string()}),q.object({action:q.literal("complete"),taskId:q.string(),status:Y0}),q.object({action:q.literal("block"),taskId:q.string(),status:Y0})]),qw=q.object({agentId:q.string(),mode:q.enum(["sync","async"]),status:q.enum(["dispatched","running","queued","joined"]),dispatched:q.boolean(),message:q.string(),deduped:q.boolean().optional(),runId:q.string().optional(),text:q.string().optional(),iterations:q.number().optional()}),_4=q.object({textPreview:q.string(),iterations:q.number(),finishReason:q.string(),durationMs:q.number(),usage:q.object({inputTokens:q.number(),outputTokens:q.number(),cacheReadTokens:q.number().optional(),cacheWriteTokens:q.number().optional(),totalCost:q.number().optional()})}),Yw=q.object({id:q.string(),agentId:q.string(),taskId:q.string().optional(),status:R$,messagePreview:q.string(),priority:q.number(),retryCount:q.number(),maxRetries:q.number(),nextAttemptAt:S.optional(),continueConversation:q.boolean().optional(),startedAt:S,endedAt:S.optional(),leaseOwner:q.string().optional(),heartbeatAt:S.optional(),lastProgressAt:S.optional(),lastProgressMessage:q.string().optional(),currentActivity:q.string().optional(),error:q.string().optional(),resultSummary:_4.optional()}),Jw=q.object({id:q.string(),teamId:q.string(),fromAgentId:q.string(),toAgentId:q.string(),subject:q.string(),body:q.string(),taskId:q.string().optional(),sentAt:S,readAt:S.optional()}),Hw=q.object({id:q.string(),teamId:q.string(),title:q.string(),status:I0,requiredSections:q.array(q.string()),createdBy:q.string(),createdAt:S,finalizedAt:S.optional()}),Kw=q.object({outcomeId:q.string(),status:I0,requiredSections:q.array(q.string())}),Xw=q.object({agentId:q.string(),status:q.string()}),Gw=q.object({runId:q.string(),status:R$}),Rw=q.object({id:q.string(),toAgentId:q.string()}),Qw=q.object({delivered:q.number()}),jw=q.object({id:q.string()}),Vw=q.object({status:q.string()}),kw=q.object({fragmentId:q.string(),status:q.string()}),Ww=q.object({outcomeId:q.string(),status:I0});var L4;((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"})(L4||={});import{z as U4}from"zod";function D4($){let{$schema:f,...w}=$;if(typeof w.type==="string")return w;if("properties"in w||"required"in w||"additionalProperties"in w)return{type:"object",...w};for(let Z of["oneOf","anyOf","allOf"]){let Y=w[Z];if(!Array.isArray(Y)||Y.length===0)continue;if(Z==="allOf"){if(Y.some((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 "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((X)=>X&&typeof X==="object"&&X.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 "${Z}" 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 P4($){let f=D4($.inputSchema instanceof U4.ZodType?X1($.inputSchema):$.inputSchema);return{name:$.name,description:$.description,inputSchema:f,lifecycle:$.lifecycle,timeoutMs:$.timeoutMs??30000,retryable:$.retryable??!0,maxRetries:$.maxRetries??3,execute:$.execute}}var Q$=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function A4($){let f=($ instanceof Error?$.message:String($)).toLowerCase();return Q$.some((w)=>f.includes(w))}export{X1 as zodToJsonSchema,f6 as xmlTagsRemoval,V2 as validateWithZod,X6 as validateImageMedia,H0 as validateAndReserveImageMedia,Df as validateAndReserveBase64Media,B$ as usesImageGenerationOperation,E8 as upsertWorkspaceInfo,E6 as truncateStr,X2 as truncateSplit,K2 as trimNonEmpty,V6 as toAiSdkToolResultOutput,C1 as supportsChatModalities,R2 as stripUtf8Bom,a1 as stripModeNotices,S$ as shouldIncludeConnectorField,Sf as serializeAbortReason,M as sanitizeSurrogates,H2 as sanitizeFileName,af as safeJsonStringify,tf as safeJsonParse,f4 as resolveRootSessionId,W6 as resolveReasoningEffortRatio,Cf as resolveReasoningBudgetFromRatio,c0 as resolveMediaBudget,g3 as resolveMcpTimeoutSeconds,J3 as resolveHubCommandTimeoutMs,$4 as resolveHookSessionContext,yf as resolveEffectiveReasoningEffort,Z$ as resolveClineEnvironment,c2 as resetSdkErrorRateLimiterForTests,J0 as reserveImageMediaBytes,q3 as readHubScheduleMode,s1 as parseUserCommandEnvelope,H4 as parseRuntimeConfigExtensions,sf as parseJsonStream,ff as parseHookEventPayload,Z2 as omitUndefinedValues,i1 as normalizeUserInput,F1 as normalizeSdkError,d1 as normalizePluginManifest,H1 as normalizeJsonLikeStringsForSchema,nf as noopBasicLogger,I$ as modelSupportsToolCalling,O$ as modelSupportsImageInput,A$ as modelProducesImages,y0 as modelHasCapability,Tf as mergeModelOptions,G2 as maskSecret,z1 as listConnectorCatalog,G$ as isRuntimeConfigExtensionKind,hf as isMcpTimeoutConfigured,A4 as isLikelyAuthError,H3 as isHubToolExecutorName,wf as isHubScheduleMode,$3 as isHubProtocolCompatible,Wf as isGeneratedMedia,G1 as isClineProvider,j4 as isChatWorkspacePath,P$ as isChatCompatibleModel,Uf as isCanonicalBase64,H6 as isBase64Char,Lf as imageFileMaxDecodedBytesForBase64Limit,z0 as imageBase64LengthForDecodedBytes,_f as imageBase64EncodedByteLength,x0 as imageBase64DecodedByteLength,K4 as hasRuntimeConfigExtension,K1 as getShellKind,b6 as getShellInvocation,J2 as getShellArgs,zf as getErrorMessage,cf as getErrorCode,Y2 as getDefaultShell,qf as getDefaultHubCommandTimeoutMs,C2 as getClineEnvironmentConfig,Ff as generatedMediaModalityFromMediaType,Hf as formatUserInputBlock,Kf as formatUserCommandBlock,j2 as formatUptime,Vf as formatSessionSearchTitle,kf as formatSessionSearchPreview,Xf as formatModeSwitchNotice,Ef as formatMessagesForAiSdk,v3 as formatMcpTimeoutErrorMessage,Q2 as formatHumanReadableDate,v0 as formatFileContentBlock,n0 as formatDisplayUserInput,F6 as estimateTokens,vf as estimateRequestInputTokens,b8 as emptyWorkspaceManifest,w2 as decodeJwtPayload,P4 as createTool,q4 as createSessionId,Gf as createModeSwitchNoticeTracker,U0 as createMediaBudgetState,o$ as createContributionRegistry,J$ as createClineTelemetryServiceMetadata,e2 as createClineTelemetryServiceConfig,g$ as connectorChannelsFromPlatforms,xf as clampMcpTimeoutSeconds,d2 as captureTaskLifecycleEvent,m2 as captureSdkError,l2 as captureAgentUnexpectedReasoningTokens,q$ as buildSdkErrorProperties,k2 as buildClineSystemPrompt,G4 as WorkspaceManifestSchema,X4 as WorkspaceInfoSchema,m6 as VertexSettingsSchema,d6 as VertexModelSchema,N$ as USER_REJECTED_TOOL_REASON,P3 as USAGE_COST_DISPLAYS,C0 as ToolCallRecordSchema,T1 as ThinkingConfigSchema,v8 as TeamTeammateSpecSchema,Zw as TeamTaskToolResultSchema,F4 as TeamTaskListItemToolResultSchema,c8 as TeamTaskInputSchema,ww as TeamStatusToolResultSchema,x8 as TeamStatusInputSchema,n8 as TeamSpawnTeammateInputSchema,Xw as TeamSimpleAgentStatusToolResultSchema,h8 as TeamShutdownTeammateInputSchema,Rw as TeamSendMessageToolResultSchema,m8 as TeamSendMessageInputSchema,Yw as TeamRunToolSummarySchema,qw as TeamRunTaskToolResultSchema,u8 as TeamRunTaskInputSchema,_4 as TeamRunResultSummarySchema,e8 as TeamReviewOutcomeFragmentInputSchema,r8 as TeamReadMailboxInputSchema,Hw as TeamOutcomeToolResultSchema,kw as TeamOutcomeFragmentToolResultSchema,jw as TeamMissionLogToolResultSchema,s8 as TeamMissionLogInputSchema,L4 as TeamMessageType,Jw as TeamMailboxMessageToolResultSchema,o8 as TeamListRunsInputSchema,fw as TeamListOutcomesInputSchema,Ww as TeamFinalizeOutcomeToolResultSchema,$w as TeamFinalizeOutcomeInputSchema,Kw as TeamCreateOutcomeToolResultSchema,a8 as TeamCreateOutcomeInputSchema,Vw as TeamCleanupToolResultSchema,i8 as TeamCleanupInputSchema,Gw as TeamCancelRunToolResultSchema,l8 as TeamCancelRunInputSchema,Qw as TeamBroadcastToolResultSchema,p8 as TeamBroadcastInputSchema,d8 as TeamAwaitRunsInputSchema,t8 as TeamAttachOutcomeFragmentInputSchema,b$ as TOOL_REJECTION_SUFFIX,z8 as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,g8 as TEAM_RUN_TEXT_PREVIEW_LIMIT,S8 as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,O2 as TEAM_PROGRESS_EVENT_TYPE,N2 as TEAM_LIFECYCLE_EVENT_TYPE,C8 as TEAM_AWAIT_TIMEOUT_MS,v2 as TASK_PROVIDER_STREAM_STARTED_EVENT,h2 as TASK_PROVIDER_STREAM_FAILED_EVENT,g2 as TASK_PROVIDER_REQUEST_STARTED_EVENT,n2 as TASK_FIRST_CHUNK_RECEIVED_EVENT,x2 as TASK_CANCELLED_EVENT,L0 as SUPPORTED_IMAGE_MEDIA_TYPES,Y4 as SESSION_STATUS_VALUES,t1 as SESSION_SEARCH_TITLE_MAX_LENGTH,e1 as SESSION_SEARCH_PREVIEW_MAX_LENGTH,z2 as SDK_ERROR_TELEMETRY_EVENT,B0 as S3AccessKeySettingsSchema,t6 as RemoteMCPServerSchema,L2 as RemoteConfigSchema,E0 as ReasoningLevelSchema,k0 as ReasoningEffortSchema,_1 as RUNTIME_CONFIG_EXTENSION_KINDS,F2 as REMOTE_URI_SCHEME,V0 as REASONING_LEVELS,G0 as REASONING_EFFORT_RATIOS,B2 as ProviderProtocolSchema,I2 as ProviderClientSchema,A2 as ProviderCapabilitySchema,e6 as PromptUploadingSchema,l$ as PLUGIN_FILE_EXTENSIONS,n6 as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,v6 as PLAN_MODE_INSTRUCTIONS,x6 as OpenAiCompatibleSchema,h6 as OpenAiCompatibleModelSchema,Z3 as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,w3 as ONE_TIME_SCHEDULE_CRON_PATTERN,b1 as ModelStatusSchema,T0 as ModelReasoningOptionSchema,E1 as ModelPricingSchema,S1 as ModelOperationSchema,g1 as ModelOperationModeSchema,M0 as ModelModalitySchema,y1 as ModelModalitiesSchema,M1 as ModelMetadataSchema,W0 as ModelInfoSchema,N1 as ModelCapabilitySchema,S6 as MODE_TAG_INSTRUCTIONS,I3 as MODEL_TOOL_NAMES,C3 as MIN_MCP_TIMEOUT_SECONDS,a4 as MIN_CLIENT_HUB_PROTOCOL_VERSION,S3 as MAX_MCP_TIMEOUT_SECONDS,t4 as MAX_CLIENT_HUB_PROTOCOL_VERSION,r6 as LiteLLMSchema,p6 as LiteLLMModelSchema,t as IMAGE_UNSUPPORTED_PLACEHOLDER,a as IMAGE_OMITTED_PLACEHOLDER,p1 as HookEventPayloadSchema,m1 as HookEventNameSchema,V3 as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,Yf as HUB_TOOL_EXECUTOR_NAMES,K3 as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,r1 as HUB_SCHEDULE_MODES,j3 as HUB_MISTAKE_LIMIT_CAPABILITY,G3 as HUB_HOOK_CAPABILITY_PREFIX,Zf as HUB_DEFAULT_COMMAND_TIMEOUT_MS,X3 as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,R3 as HUB_COMPACTION_CAPABILITY,Y3 as HUB_COMMAND_SLOW_LOG_MS,f3 as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,Q3 as HUB_CHECKPOINT_CAPABILITY,e4 as HUB_CAPABILITIES,Q1 as GlobalInstructionsFileSchema,Z6 as GeneratedMediaSourceSchema,Y6 as GeneratedMediaSchema,w6 as GeneratedMediaModalitySchema,d$ as FeatureFlagDefaultValue,m$ as FEATURE_FLAGS,$$ as EnterpriseTelemetrySchema,K0 as EMPTY_CONTENT_TEXT,X$ as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,Mf as DEFAULT_REASONING_EFFORT,V4 as DEFAULT_OUTCOME_REQUIRED_SECTIONS,y3 as DEFAULT_MCP_TIMEOUT_SECONDS,J6 as DEFAULT_MAX_TOTAL_MEDIA_BYTES,v as DEFAULT_MAX_IMAGE_ENCODED_BYTES,x as DEFAULT_MAX_IMAGE_DECODED_BYTES,h0 as DEFAULT_MAX_IMAGE_BASE64_BYTES,T2 as DEFAULT_CLINE_ENVIRONMENT,S0 as ContributionRegistry,C$ as ConnectorHookEventSchema,v1 as ConnectorHookEventNameSchema,h1 as ConnectorEventContextSchema,n1 as ConnectorEventActorSchema,M$ as ConnectorAuthorizationRequestSchema,y$ as ConnectorAuthorizationDecisionSchema,l6 as ClineSettingsSchema,o6 as ClineModelSchema,i4 as CURRENT_HUB_PROTOCOL_VERSION,c1 as CONNECTOR_PLATFORMS,x1 as CONNECTOR_CATALOG,O3 as CONFIGURABLE_MODEL_TOOL_NAMES,R4 as CLINE_WORKSPACES_DIRECTORY_NAME,E2 as CLINE_ENVIRONMENT_OVERRIDE_ENV,b2 as CLINE_ENVIRONMENT_ENV,V1 as CLINE_ENVIRONMENTS,D2 as CLINE_DEFAULT_RPC_PORT,P2 as CLINE_DEFAULT_RPC_ADDRESS,W2 as CLINE_DEFAULT_MODEL_ID,Q4 as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,gf as CHARS_PER_TOKEN,u6 as AwsBedrockSettingsSchema,z6 as AwsBedrockModelSchema,c6 as AwsBedrockCustomModelSchema,O1 as ApiFormatSchema,D$ as ApiFormat,i6 as AnthropicSchema,s6 as AnthropicModelSchema,a6 as AllowedMCPServerSchema,T$ as AgentUsageSchema,v4 as AgentResultSchema,E$ as AgentFinishReasonSchema,n4 as AgentConfigSchema,Q$ as AUTH_ERROR_PATTERNS,U2 as APIKeySchema,S2 as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT};
|