@cline/shared 0.0.41-nightly.1779419821 → 0.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import{z as w}from"zod";import{z as Y}from"zod";var Zn=Y.enum(["default","openai-responses","r1"]),ef={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},bn=Y.enum(["images","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),Jn=Y.enum(["active","preview","deprecated","legacy"]),Bn=Y.object({input:Y.number().optional(),output:Y.number().optional(),cacheWrite:Y.number().optional(),cacheRead:Y.number().optional()}),Qn=Y.object({maxBudget:Y.number().optional(),outputPrice:Y.number().optional(),thinkingLevel:Y.enum(["low","high"]).optional()}),Vn=Y.object({reasoningDefaultOn:Y.boolean().optional()}).catchall(Y.unknown()),v=Y.object({id:Y.string(),name:Y.string().optional(),description:Y.string().optional(),maxTokens:Y.number().optional(),contextWindow:Y.number().optional(),maxInputTokens:Y.number().optional(),capabilities:Y.array(bn).optional(),apiFormat:Zn.optional(),systemRole:Y.enum(["system","developer"]).optional(),temperature:Y.number().optional(),pricing:Bn.optional(),thinkingConfig:Qn.optional(),status:Jn.optional(),deprecationNotice:Y.string().optional(),replacedBy:Y.string().optional(),releaseDate:Y.string().optional(),deprecationDate:Y.string().optional(),family:Y.string().optional(),metadata:Vn.optional()});import{z as Z}from"zod";var nn=Z.object({id:Z.string(),name:Z.string(),input:Z.unknown(),output:Z.unknown(),error:Z.string().optional(),durationMs:Z.number(),startedAt:Z.date(),endedAt:Z.date()});var af=w.enum(["completed","max_iterations","aborted","mistake_limit","error"]),zf=w.object({inputTokens:w.number(),outputTokens:w.number(),cacheReadTokens:w.number().optional(),cacheWriteTokens:w.number().optional(),totalCost:w.number().optional()}),fg=w.object({text:w.string(),usage:zf,messages:w.array(w.custom()),toolCalls:w.array(nn),iterations:w.number(),finishReason:af,model:w.object({id:w.string(),provider:w.string(),info:v.optional()}),startedAt:w.date(),endedAt:w.date(),durationMs:w.number()}),no=w.enum(["low","medium","high","xhigh"]),og=w.object({sessionId:w.string().optional(),providerId:w.string(),modelId:w.string(),apiKey:w.string().optional(),baseUrl:w.string().url().optional(),headers:w.record(w.string(),w.string()).optional(),knownModels:w.record(w.string(),v).optional(),providerConfig:w.unknown().optional(),initialMessages:w.array(w.custom()).optional(),systemPrompt:w.string(),tools:w.array(w.custom()),maxIterations:w.number().positive().optional(),maxParallelToolCalls:w.number().int().positive().default(8),maxTokensPerTurn:w.number().positive().optional(),apiTimeoutMs:w.number().positive().default(180000),userFileContentLoader:w.function().input([w.string()]).output(w.promise(w.string())).optional(),toolContextMetadata:w.record(w.string(),w.unknown()).optional(),execution:w.object({maxConsecutiveMistakes:w.number().int().positive().optional(),reminderAfterIterations:w.number().nonnegative().optional(),reminderText:w.string().optional(),loopDetection:w.union([w.literal(!1),w.object({softThreshold:w.number().int().positive().optional(),hardThreshold:w.number().int().positive().optional()})]).optional()}).optional(),reasoningEffort:no.optional(),thinkingBudgetTokens:w.number().positive().optional(),thinking:w.boolean().optional(),onEvent:w.function().input([w.custom()]).output(w.void()).optional(),hooks:w.custom().optional(),parentAgentId:w.string().optional(),extensions:w.array(w.custom()).optional(),hookErrorMode:w.enum(["ignore","throw"]).default("ignore"),toolPolicies:w.record(w.string(),w.object({enabled:w.boolean().optional(),autoApprove:w.boolean().optional()})).optional(),requestToolApproval:w.function().input([w.object({sessionId:w.string(),agentId:w.string(),conversationId:w.string(),iteration:w.number(),toolCallId:w.string(),toolName:w.string(),input:w.unknown(),policy:w.object({enabled:w.boolean().optional(),autoApprove:w.boolean().optional()}).default({})})]).output(w.union([w.object({approved:w.boolean(),reason:w.string().optional()}),w.promise(w.object({approved:w.boolean(),reason:w.string().optional()}))])).optional(),onConsecutiveMistakeLimitReached:w.function().input([w.object({iteration:w.number().int().positive(),consecutiveMistakes:w.number().int().positive(),maxConsecutiveMistakes:w.number().int().positive(),reason:w.enum(["api_error","invalid_tool_call","tool_execution_failed"]),details:w.string().optional()})]).output(w.union([w.object({action:w.literal("continue"),guidance:w.string().optional()}),w.object({action:w.literal("stop"),reason:w.string().optional()}),w.promise(w.union([w.object({action:w.literal("continue"),guidance:w.string().optional()}),w.object({action:w.literal("stop"),reason:w.string().optional()})]))])).optional(),logger:w.custom().optional(),extensionContext:w.custom().optional(),abortSignal:w.custom().optional()});import{z as H}from"zod";var Wn=H.enum(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),jn=H.object({id:H.string().optional(),label:H.string().optional(),role:H.string().optional(),participantKey:H.string().optional(),participantLabel:H.string().optional(),platformUserId:H.string().optional(),metadata:H.record(H.string(),H.unknown()).optional()}),Tn=H.object({source:H.string(),sourceEvent:H.string(),threadId:H.string(),channelId:H.string(),isDM:H.boolean(),sessionId:H.string().optional(),workspaceRoot:H.string().optional(),metadata:H.record(H.string(),H.unknown()).optional()}),fo=H.object({actor:jn,context:Tn,payload:H.record(H.string(),H.unknown()).optional()}),oo=H.object({action:H.enum(["allow","deny"]).default("allow"),message:H.string().optional(),reason:H.string().optional(),metadata:H.record(H.string(),H.unknown()).optional()}),ro=H.object({adapter:H.string(),botUserName:H.string().optional(),event:Wn,payload:H.record(H.string(),H.unknown()),ts:H.string()});var go=["hooks","tools","commands","rules","messageBuilders","providers","automationEvents"],wo=new Set(go);function Cn(n,f){return n.name||`extension_${String(f).padStart(4,"0")}`}function Kn(n){return Array.isArray(n)&&n.every((f)=>typeof f==="string")}function Nn(n){if(!Array.isArray(n))return;let f=n.filter((o)=>typeof o==="string").map((o)=>o.trim()).filter((o)=>o.length>0);return f.length>0?f:void 0}function Mn(n){let f=Nn(n.providerIds),o=Nn(n.modelIds);return{...n,...f?{providerIds:f}:{},...o?{modelIds:o}:{}}}function $o(n,f){let o=Cn(n,f),d=n.manifest;if(!d||typeof d!=="object")throw Error(`Invalid manifest for extension "${o}": manifest is required`);if(!Array.isArray(d.capabilities)||d.capabilities.length===0)throw Error(`Invalid manifest for extension "${o}": capabilities must be a non-empty array`);let $=new Set;for(let F of d.capabilities){if(!wo.has(F))throw Error(`Invalid manifest for extension "${o}": unsupported capability "${String(F)}"`);$.add(F)}if(Object.hasOwn(d,"providerIds")&&!Kn(d.providerIds))throw Error(`Invalid manifest for extension "${o}": providerIds must be a string array when provided`);if(Object.hasOwn(d,"modelIds")&&!Kn(d.modelIds))throw Error(`Invalid manifest for extension "${o}": modelIds must be a string array when provided`);let _=$.has("hooks");if(n.hooks!==void 0&&!_)throw Error(`Invalid manifest for extension "${o}": runtime hooks require the "hooks" capability`);return{capabilities:$,raw:Mn(d)}}function Eo(n,f){if(!n||typeof n!=="object")throw Error(`Invalid automation event contribution for extension "${f}": expected object`);let o=typeof n.eventType==="string"?n.eventType.trim():"",d=typeof n.source==="string"?n.source.trim():"";if(!o)throw Error(`Invalid automation event contribution for extension "${f}": eventType is required`);if(!d)throw Error(`Invalid automation event contribution for extension "${f}": source is required`);return{...n,eventType:o,source:d,examples:n.examples?[...n.examples]:void 0,metadata:n.metadata?{...n.metadata}:void 0}}class fn{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[]};normalized=[];phase="resolve";setupContext;constructor(n={}){this.extensions=n.extensions??[],this.setupContext=n.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((n,f)=>({extension:n,order:f,manifest:{capabilities:new Set,raw:n.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((n)=>({...n,manifest:$o(n.extension,n.order)})),this.phase="setup"}async setup(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;for(let n of this.normalized){let{extension:f}=n;if(f.disabled)continue;let o=Cn(f,n.order),d={registerTool:(_)=>this.registry.tools.push(_),registerCommand:(_)=>this.registry.commands.push(_),registerRule:(_)=>{if(!n.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${o}": registerRule requires the "rules" capability`);this.registry.rules.push(_)},registerMessageBuilder:(_)=>this.registry.messageBuilder.push(_),registerProvider:(_)=>this.registry.providers.push(_),registerAutomationEventType:(_)=>{if(!n.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${o}": registerAutomationEventType requires the "automationEvents" capability`);this.registry.automationEventTypes.push(Eo(_,o))}},$=n.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};await f.setup?.(d,$)}this.phase="activate"}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(),await this.setup(),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]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((n,f)=>n.order-f.order).map(({extension:n})=>n)}}function _o(n={}){return new fn(n)}var yo=[".js",".ts"];import{z as E}from"zod";var On=E.enum(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),j=E.record(E.string(),E.string()),Ro=E.object({toolName:E.string(),parameters:j}),Ho=E.object({toolName:E.string(),parameters:j,result:E.string(),success:E.boolean(),executionTimeMs:E.number()}),qo=E.object({prompt:E.string(),attachments:E.array(E.string())}),ko=E.object({taskMetadata:j}),Uo=E.object({taskMetadata:j,previousState:j}),Yo=E.object({taskMetadata:j}),Fo=E.object({taskMetadata:j}),Io=E.object({taskId:E.string(),ulid:E.string(),contextSize:E.number(),compactionStrategy:E.string(),previousApiReqIndex:E.number(),tokensIn:E.number(),tokensOut:E.number(),tokensInCache:E.number(),tokensOutCache:E.number(),deletedRangeStart:E.number(),deletedRangeEnd:E.number(),contextJsonPath:E.string(),contextRawPath:E.string()}),cn=E.object({clineVersion:E.string(),hookName:On,timestamp:E.string(),taskId:E.string(),sessionContext:E.object({rootSessionId:E.string().optional(),hookLogPath:E.string().optional()}).optional(),workspaceRoots:E.array(E.string()),workspaceInfo:E.custom().optional(),userId:E.string(),agent_id:E.string(),parent_agent_id:E.string().nullable(),iteration:E.number().optional(),reason:E.string().optional(),tool_call:E.object({id:E.string(),name:E.string(),input:E.unknown()}).optional(),tool_result:E.custom().optional(),turn:E.unknown().optional(),error:E.object({name:E.string(),message:E.string(),stack:E.string().optional()}).optional(),preToolUse:Ro.optional(),postToolUse:Ho.optional(),userPromptSubmit:qo.optional(),taskStart:ko.optional(),taskResume:Uo.optional(),taskCancel:Yo.optional(),taskComplete:Fo.optional(),preCompact:Io.optional()}).passthrough();function Lo(n){let f=cn.safeParse(n);if(!f.success)return;return f.data}var Hg=30000,qg=5000;function lo(n){switch(n){case"run.start":case"session.send_input":return null;default:return 30000}}function kg(n,f){return f===void 0?lo(n):f}var so=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],Po=new Set(so);function Ug(n){return typeof n==="string"&&Po.has(n)}var Yg="tool_executor.",Fg="custom_tool.",Ig="hook.",Lg="compaction.compact",lg="checkpoint.create",sg="mistake_limit.decide",Pg="user_instructions.snapshot";function on(n,f){return`<file_content path="${n}">
2
2
  ${f}
3
- </file_content>`}function Do(n,f="act"){return`<user_input mode="${f}">${n}</user_input>`}function Go(n,f){return`<user_command slash="${f}">${n}</user_command>`}function Ao(n,f){let o=n.trim(),d=new RegExp(`^<${f}\\b([^>]*)>([\\s\\S]*?)<\\/${f}>$`,"i").exec(o);if(!d)return;return{attrs:d[1]??"",content:d[2]??""}}function Xo(n,f){return new RegExp(`${f}="([^"]+)"`,"i").exec(n)?.[1]?.trim()||void 0}function hn(n){if(!n?.trim())return;let f=Ao(n,"user_command");if(!f)return;let o=Xo(f.attrs,"slash");if(!o)return;return{slash:o,content:f.content.trim()}}function Sn(n){if(!n?.trim())return"";let f=n.trim();for(let o of["user_input","user_command"]){let d=un(f,o);f=(d!==f?d:f.replace(new RegExp(`<${o}[^>]*>`,"g"),"")).trim()}return f}function Zo(n){let f=Sn(n),o=hn(n);if(!o)return f;if(o.slash.toLowerCase()==="team"){let $=f.toLowerCase().startsWith("spawn a team of agents for the following task:")?f.slice(46).trim():f;return $?`/team ${$}`:"/team"}return f?`/${o.slash} ${f}`:`/${o.slash}`}function un(n,f){if(!n?.trim())return"";if(!f)return n;let o=new RegExp(`<${f}\\b[^>]*>([\\s\\S]*?)</${f}>`,"g");return n.replace(o,"$1")}function G(n){return n.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}function xn(n,f){let o=n[n.length-1];if(f.role==="tool"&&o?.role==="tool"&&Array.isArray(o.content)&&Array.isArray(f.content)){o.content.push(...f.content);return}n.push(f)}function bo(n){if(!Array.isArray(n)||n.length===0)return!1;return n.every((f)=>{if(!f||typeof f!=="object")return!1;let o=f;if(o.type==="text")return typeof o.text==="string";if(o.type==="image")return typeof o.data==="string"&&typeof o.mediaType==="string";return!1})}function rn(n,f){if(n==null||typeof n!=="object")return n;if(Array.isArray(n)){let $=[];for(let _ of n){if(_&&typeof _==="object"){let R=_;if(R.type==="image"&&typeof R.data==="string"&&typeof R.mediaType==="string"){f.push({type:"image",data:R.data,mediaType:R.mediaType});continue}if(R.type==="text"&&typeof R.text==="string"){$.push(R.text);continue}}$.push(rn(_,f))}return $}let o=n,d={};for(let[$,_]of Object.entries(o))d[$]=rn(_,f);return d}function p(n){if(typeof n==="string")return G(n);if(Array.isArray(n))return n.map((f)=>p(f));if(n!==null&&typeof n==="object"){let f=n,o={};for(let[d,$]of Object.entries(f))o[d]=p($);return o}return n}function mn(n,f=!1){if(typeof n==="string")return{type:f?"error-text":"text",value:G(n)};if(!f&&bo(n))return{type:"content",value:n.map((o)=>o.type==="image"?{type:"image-data",data:o.data,mediaType:o.mediaType}:{type:"text",text:G(o.text)})};if(!f&&n!==null&&typeof n==="object"){let o=[],d=rn(n,o);if(o.length>0)return{type:"content",value:[{type:"text",text:typeof d==="string"?G(d):JSON.stringify(p(d))},...o.map((_)=>({type:"image-data",data:_.data,mediaType:_.mediaType}))]}}if(n===null||typeof n==="boolean"||typeof n==="number"||typeof n==="object")return{type:f?"error-json":"json",value:p(n)};return{type:f?"error-text":"text",value:G(String(n))}}function Jo(n,f,o){let d=o?.assistantToolCallArgKey??"input",$=[];if(typeof n==="string"&&n.trim().length>0||Array.isArray(n)&&n.length>0)$.push({role:"system",content:typeof n==="string"?G(n):n});for(let _ of f){let R=_.content;if(typeof R==="string"){$.push({role:_.role,content:G(R)});continue}let F=[],P=[];for(let k of R)switch(k.type){case"text":F.push({type:"text",text:G(k.text),...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"reasoning":F.push({type:"reasoning",text:G(k.text),...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"image":F.push({type:"image",image:k.image,mediaType:k.mediaType});break;case"file":F.push({type:"text",text:on(k.path,G(k.content))});break;case"tool-call":if(_.role==="assistant")F.push({type:"tool-call",toolCallId:k.toolCallId,toolName:k.toolName,[d]:k.input,...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"tool-result":P.push({type:"tool-result",toolCallId:k.toolCallId,toolName:k.toolName,output:mn(k.output,k.isError??!1)});break}if(F.length>0)xn($,{role:_.role,content:F});if(P.length>0)xn($,{role:"tool",content:P})}return $}var c={xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},Bo=void 0;function Qo(n,f){if(typeof n==="string"&&n.toLowerCase()in c)return n.toLowerCase();return f?void 0:void 0}function vn(n,f){let o=typeof n==="string"?n.toLowerCase():void 0;if(o&&o in c)return c[o];if(f?.fallbackEffort)return c[f.fallbackEffort];return}function Vo(n){let f=vn(n.effort,{fallbackEffort:n.fallbackEffort});if(f===void 0)return;if(f<=0)return 0;let o=n.minimumBudget??1;if(n.maxBudget<o)return;let d=n.scaleTokens??n.maxBudget;return Math.min(Math.max(Math.floor(d*f),o),n.maxBudget)}var Wo={"HTTP-Referer":"https://cline.bot","X-Title":"Cline","X-IS-MULTIROOT":"false","X-CLIENT-TYPE":"cline-sdk"};function jo(n){return n instanceof Error?{name:n.name,message:n.message}:n}function To(n){return Math.max(1,Math.ceil(n/3))}var Ko={debug:()=>{},log:()=>{},error:()=>{}};class B extends Error{constructor(n,f){super(`${n} at position ${f}`);this.position=f}}function pn(n){return/^[0-9A-Fa-f]$/.test(n)}function V(n){return n>="0"&&n<="9"}function tn(n){return n>=" "}function h(n){return`,:[]/{}()
3
+ </file_content>`}function Do(n,f="act"){return`<user_input mode="${f}">${n}</user_input>`}function Go(n,f){return`<user_command slash="${f}">${n}</user_command>`}function Ao(n,f){let o=n.trim(),d=new RegExp(`^<${f}\\b([^>]*)>([\\s\\S]*?)<\\/${f}>$`,"i").exec(o);if(!d)return;return{attrs:d[1]??"",content:d[2]??""}}function Xo(n,f){return new RegExp(`${f}="([^"]+)"`,"i").exec(n)?.[1]?.trim()||void 0}function hn(n){if(!n?.trim())return;let f=Ao(n,"user_command");if(!f)return;let o=Xo(f.attrs,"slash");if(!o)return;return{slash:o,content:f.content.trim()}}function Sn(n){if(!n?.trim())return"";let f=n.trim();for(let o of["user_input","user_command"]){let d=un(f,o);f=(d!==f?d:f.replace(new RegExp(`<${o}[^>]*>`,"g"),"")).trim()}return f}function Zo(n){let f=Sn(n),o=hn(n);if(!o)return f;if(o.slash.toLowerCase()==="team"){let $=f.toLowerCase().startsWith("spawn a team of agents for the following task:")?f.slice(46).trim():f;return $?`/team ${$}`:"/team"}return f?`/${o.slash} ${f}`:`/${o.slash}`}function un(n,f){if(!n?.trim())return"";if(!f)return n;let o=new RegExp(`<${f}\\b[^>]*>([\\s\\S]*?)</${f}>`,"g");return n.replace(o,"$1")}function G(n){return n.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}function xn(n,f){let o=n[n.length-1];if(f.role==="tool"&&o?.role==="tool"&&Array.isArray(o.content)&&Array.isArray(f.content)){o.content.push(...f.content);return}n.push(f)}function bo(n){if(!Array.isArray(n)||n.length===0)return!1;return n.every((f)=>{if(!f||typeof f!=="object")return!1;let o=f;if(o.type==="text")return typeof o.text==="string";if(o.type==="image")return typeof o.data==="string"&&typeof o.mediaType==="string";return!1})}function rn(n,f){if(n==null||typeof n!=="object")return n;if(Array.isArray(n)){let $=[];for(let _ of n){if(_&&typeof _==="object"){let R=_;if(R.type==="image"&&typeof R.data==="string"&&typeof R.mediaType==="string"){f.push({type:"image",data:R.data,mediaType:R.mediaType});continue}if(R.type==="text"&&typeof R.text==="string"){$.push(R.text);continue}}$.push(rn(_,f))}return $}let o=n,d={};for(let[$,_]of Object.entries(o))d[$]=rn(_,f);return d}function p(n){if(typeof n==="string")return G(n);if(Array.isArray(n))return n.map((f)=>p(f));if(n!==null&&typeof n==="object"){let f=n,o={};for(let[d,$]of Object.entries(f))o[d]=p($);return o}return n}function mn(n,f=!1){if(typeof n==="string")return{type:f?"error-text":"text",value:G(n)};if(!f&&bo(n))return{type:"content",value:n.map((o)=>o.type==="image"?{type:"image-data",data:o.data,mediaType:o.mediaType}:{type:"text",text:G(o.text)})};if(!f&&n!==null&&typeof n==="object"){let o=[],d=rn(n,o);if(o.length>0)return{type:"content",value:[{type:"text",text:typeof d==="string"?G(d):JSON.stringify(p(d))},...o.map((_)=>({type:"image-data",data:_.data,mediaType:_.mediaType}))]}}if(n===null||typeof n==="boolean"||typeof n==="number"||typeof n==="object")return{type:f?"error-json":"json",value:p(n)};return{type:f?"error-text":"text",value:G(String(n))}}function Jo(n,f,o){let d=o?.assistantToolCallArgKey??"input",$=[];if(typeof n==="string"&&n.trim().length>0||Array.isArray(n)&&n.length>0)$.push({role:"system",content:typeof n==="string"?G(n):n});for(let _ of f){let R=_.content;if(typeof R==="string"){$.push({role:_.role,content:G(R)});continue}let F=[],P=[];for(let k of R)switch(k.type){case"text":F.push({type:"text",text:G(k.text),...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"reasoning":F.push({type:"reasoning",text:G(k.text),...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"image":F.push({type:"image",image:k.image,mediaType:k.mediaType});break;case"file":F.push({type:"text",text:on(k.path,G(k.content))});break;case"tool-call":if(_.role==="assistant")F.push({type:"tool-call",toolCallId:k.toolCallId,toolName:k.toolName,[d]:k.input,...k.providerOptions?{providerOptions:k.providerOptions}:{}});break;case"tool-result":{P.push({type:"tool-result",toolCallId:k.toolCallId,toolName:k.toolName,output:mn(k.output,k.isError??!1)});break}}if(F.length>0)xn($,{role:_.role,content:F});if(P.length>0)xn($,{role:"tool",content:P})}return $}var c={xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},Bo=void 0;function Qo(n,f){if(typeof n==="string"&&n.toLowerCase()in c)return n.toLowerCase();return f?void 0:void 0}function vn(n,f){let o=typeof n==="string"?n.toLowerCase():void 0;if(o&&o in c)return c[o];if(f?.fallbackEffort)return c[f.fallbackEffort];return}function Vo(n){let f=vn(n.effort,{fallbackEffort:n.fallbackEffort});if(f===void 0)return;if(f<=0)return 0;let o=n.minimumBudget??1;if(n.maxBudget<o)return;let d=n.scaleTokens??n.maxBudget;return Math.min(Math.max(Math.floor(d*f),o),n.maxBudget)}var Wo={"HTTP-Referer":"https://cline.bot","X-Title":"Cline","X-IS-MULTIROOT":"false","X-CLIENT-TYPE":"cline-sdk"};function jo(n){return n instanceof Error?{name:n.name,message:n.message}:n}function To(n){return Math.max(1,Math.ceil(n/3))}var Ko={debug:()=>{},log:()=>{},error:()=>{}};class B extends Error{constructor(n,f){super(`${n} at position ${f}`);this.position=f}}function pn(n){return/^[0-9A-Fa-f]$/.test(n)}function V(n){return n>="0"&&n<="9"}function tn(n){return n>=" "}function h(n){return`,:[]/{}()
4
4
  +`.includes(n)}function gn(n){return n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="_"||n==="$"}function wn(n){return n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="_"||n==="$"||n>="0"&&n<="9"}var dn=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,$n=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function En(n){return`,[]/{}
5
5
  +`.includes(n)}function _n(n){return S(n)||No.test(n)}var No=/^[[{\w-]$/;function en(n){return n===`
6
6
  `||n==="\r"||n==="\t"||n==="\b"||n==="\f"}function Q(n,f){let o=n.charCodeAt(f);return o===32||o===10||o===9||o===13}function an(n,f){let o=n.charCodeAt(f);return o===32||o===9||o===13}function zn(n,f){let o=n.charCodeAt(f);return o===160||o===6158||o>=8192&&o<=8203||o===8239||o===8287||o===12288||o===65279}function S(n){return yn(n)||i(n)}function yn(n){return n==='"'||n==="“"||n==="”"}function Rn(n){return n==='"'}function i(n){return n==="'"||n==="‘"||n==="’"||n==="`"||n==="´"}function Hn(n){return n==="'"}function C(n,f){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,d=n.lastIndexOf(f);return d!==-1?n.substring(0,d)+(o?"":n.substring(d+1)):n}function D(n,f){let o=n.length;if(!Q(n,o-1))return n+f;while(Q(n,o-1))o--;return n.substring(0,o)+f+n.substring(o)}function nf(n,f,o){return n.substring(0,f)+n.substring(f+o)}function ff(n){return/[,\n][ \t\r]*$/.test(n)}var Co={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},Mo={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
package/dist/index.js CHANGED
@@ -75,7 +75,7 @@ ${e}${i.contents.trim()}`}).join(`
75
75
 
76
76
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let v of r.seen.entries()){let u=v[1];if(i===v[0]){o(v);continue}if(r.external){let g=r.external.registry.get(v[0])?.id;if(i!==v[0]&&g){o(v);continue}}if(r.metadataRegistry.get(v[0])?.id){o(v);continue}if(u.cycle){o(v);continue}if(u.count>1){if(r.reused==="ref"){o(v);continue}}}}function Lr(r,i){let t=r.seen.get(i);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");let e=(u)=>{let l=r.seen.get(u);if(l.ref===null)return;let g=l.def??l.schema,c={...g},_=l.ref;if(l.ref=null,_){e(_);let w=r.seen.get(_),m=w.schema;if(m.$ref&&(r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"))g.allOf=g.allOf??[],g.allOf.push(m);else Object.assign(g,m);if(Object.assign(g,c),u._zod.parent===_)for(let E in g){if(E==="$ref"||E==="allOf")continue;if(!(E in c))delete g[E]}if(m.$ref&&w.def)for(let E in g){if(E==="$ref"||E==="allOf")continue;if(E in w.def&&JSON.stringify(g[E])===JSON.stringify(w.def[E]))delete g[E]}}let U=u._zod.parent;if(U&&U!==_){e(U);let w=r.seen.get(U);if(w?.schema.$ref){if(g.$ref=w.schema.$ref,w.def)for(let m in g){if(m==="$ref"||m==="allOf")continue;if(m in w.def&&JSON.stringify(g[m])===JSON.stringify(w.def[m]))delete g[m]}}}r.override({zodSchema:u,jsonSchema:g,path:l.path??[]})};for(let u of[...r.seen.entries()].reverse())e(u[0]);let n={};if(r.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(r.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(r.target==="openapi-3.0");if(r.external?.uri){let u=r.external.registry.get(i)?.id;if(!u)throw Error("Schema is missing an `id` property");n.$id=r.external.uri(u)}Object.assign(n,t.def??t.schema);let o=r.metadataRegistry.get(i)?.id;if(o!==void 0&&n.id===o)delete n.id;let v=r.external?.defs??{};for(let u of r.seen.entries()){let l=u[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;v[l.defId]=l.def}}if(r.external);else if(Object.keys(v).length>0)if(r.target==="draft-2020-12")n.$defs=v;else n.definitions=v;try{let u=JSON.parse(JSON.stringify(n));return Object.defineProperty(u,"~standard",{value:{...i["~standard"],jsonSchema:{input:Un(i,"input",r.processors),output:Un(i,"output",r.processors)}},enumerable:!1,writable:!1}),u}catch(u){throw Error("Error converting schema to JSON.")}}function y(r,i){let t=i??{seen:new Set};if(t.seen.has(r))return!1;t.seen.add(r);let e=r._zod.def;if(e.type==="transform")return!0;if(e.type==="array")return y(e.element,t);if(e.type==="set")return y(e.valueType,t);if(e.type==="lazy")return y(e.getter(),t);if(e.type==="promise"||e.type==="optional"||e.type==="nonoptional"||e.type==="nullable"||e.type==="readonly"||e.type==="default"||e.type==="prefault")return y(e.innerType,t);if(e.type==="intersection")return y(e.left,t)||y(e.right,t);if(e.type==="record"||e.type==="map")return y(e.keyType,t)||y(e.valueType,t);if(e.type==="pipe"){if(r._zod.traits.has("$ZodCodec"))return!0;return y(e.in,t)||y(e.out,t)}if(e.type==="object"){for(let n in e.shape)if(y(e.shape[n],t))return!0;return!1}if(e.type==="union"){for(let n of e.options)if(y(n,t))return!0;return!1}if(e.type==="tuple"){for(let n of e.items)if(y(n,t))return!0;if(e.rest&&y(e.rest,t))return!0;return!1}return!1}var Ou=(r,i={})=>(t)=>{let e=Er({...t,processors:i});return W(r,e),jr(e,r),Lr(e,r)},Un=(r,i,t={})=>(e)=>{let{libraryOptions:n,target:o}=e??{},v=Er({...n??{},target:o,io:i,processors:t});return W(r,v),jr(v,r),Lr(v,r)};var FU={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},fu=(r,i,t,e)=>{let n=t;n.type="string";let{minimum:o,maximum:v,format:u,patterns:l,contentEncoding:g}=r._zod.bag;if(typeof o==="number")n.minLength=o;if(typeof v==="number")n.maxLength=v;if(u){if(n.format=FU[u]??u,n.format==="")delete n.format;if(u==="time")delete n.format}if(g)n.contentEncoding=g;if(l&&l.size>0){let c=[...l];if(c.length===1)n.pattern=c[0].source;else if(c.length>1)n.allOf=[...c.map((_)=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:_.source}))]}},Eu=(r,i,t,e)=>{let n=t,{minimum:o,maximum:v,format:u,multipleOf:l,exclusiveMaximum:g,exclusiveMinimum:c}=r._zod.bag;if(typeof u==="string"&&u.includes("int"))n.type="integer";else n.type="number";let _=typeof c==="number"&&c>=(o??Number.NEGATIVE_INFINITY),U=typeof g==="number"&&g<=(v??Number.POSITIVE_INFINITY),w=i.target==="draft-04"||i.target==="openapi-3.0";if(_)if(w)n.minimum=c,n.exclusiveMinimum=!0;else n.exclusiveMinimum=c;else if(typeof o==="number")n.minimum=o;if(U)if(w)n.maximum=g,n.exclusiveMaximum=!0;else n.exclusiveMaximum=g;else if(typeof v==="number")n.maximum=v;if(typeof l==="number")n.multipleOf=l},ju=(r,i,t,e)=>{t.type="boolean"},Lu=(r,i,t,e)=>{if(i.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Au=(r,i,t,e)=>{if(i.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Ju=(r,i,t,e)=>{if(i.target==="openapi-3.0")t.type="string",t.nullable=!0,t.enum=[null];else t.type="null"},Gu=(r,i,t,e)=>{if(i.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Xu=(r,i,t,e)=>{if(i.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Wu=(r,i,t,e)=>{t.not={}},Hu=(r,i,t,e)=>{},qu=(r,i,t,e)=>{},Vu=(r,i,t,e)=>{if(i.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},du=(r,i,t,e)=>{let n=r._zod.def,o=Gn(n.entries);if(o.every((v)=>typeof v==="number"))t.type="number";if(o.every((v)=>typeof v==="string"))t.type="string";t.enum=o},Yu=(r,i,t,e)=>{let n=r._zod.def,o=[];for(let v of n.values)if(v===void 0){if(i.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v==="bigint")if(i.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else o.push(Number(v));else o.push(v);if(o.length===0);else if(o.length===1){let v=o[0];if(t.type=v===null?"null":typeof v,i.target==="draft-04"||i.target==="openapi-3.0")t.enum=[v];else t.const=v}else{if(o.every((v)=>typeof v==="number"))t.type="number";if(o.every((v)=>typeof v==="string"))t.type="string";if(o.every((v)=>typeof v==="boolean"))t.type="boolean";if(o.every((v)=>v===null))t.type="null";t.enum=o}},Ru=(r,i,t,e)=>{if(i.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},Fu=(r,i,t,e)=>{let n=t,o=r._zod.pattern;if(!o)throw Error("Pattern not found in template literal");n.type="string",n.pattern=o.source},Bu=(r,i,t,e)=>{let n=t,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:u,mime:l}=r._zod.bag;if(v!==void 0)o.minLength=v;if(u!==void 0)o.maxLength=u;if(l)if(l.length===1)o.contentMediaType=l[0],Object.assign(n,o);else Object.assign(n,o),n.anyOf=l.map((g)=>({contentMediaType:g}));else Object.assign(n,o)},Qu=(r,i,t,e)=>{t.type="boolean"},Ku=(r,i,t,e)=>{if(i.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},Tu=(r,i,t,e)=>{if(i.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Mu=(r,i,t,e)=>{if(i.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},xu=(r,i,t,e)=>{if(i.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},zu=(r,i,t,e)=>{if(i.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Cu=(r,i,t,e)=>{let n=t,o=r._zod.def,{minimum:v,maximum:u}=r._zod.bag;if(typeof v==="number")n.minItems=v;if(typeof u==="number")n.maxItems=u;n.type="array",n.items=W(o.element,i,{...e,path:[...e.path,"items"]})},Zu=(r,i,t,e)=>{let n=t,o=r._zod.def;n.type="object",n.properties={};let v=o.shape;for(let g in v)n.properties[g]=W(v[g],i,{...e,path:[...e.path,"properties",g]});let u=new Set(Object.keys(v)),l=new Set([...u].filter((g)=>{let c=o.shape[g]._zod;if(i.io==="input")return c.optin===void 0;else return c.optout===void 0}));if(l.size>0)n.required=Array.from(l);if(o.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!o.catchall){if(i.io==="output")n.additionalProperties=!1}else if(o.catchall)n.additionalProperties=W(o.catchall,i,{...e,path:[...e.path,"additionalProperties"]})},kt=(r,i,t,e)=>{let n=r._zod.def,o=n.inclusive===!1,v=n.options.map((u,l)=>W(u,i,{...e,path:[...e.path,o?"oneOf":"anyOf",l]}));if(o)t.oneOf=v;else t.anyOf=v},hu=(r,i,t,e)=>{let n=r._zod.def,o=W(n.left,i,{...e,path:[...e.path,"allOf",0]}),v=W(n.right,i,{...e,path:[...e.path,"allOf",1]}),u=(g)=>("allOf"in g)&&Object.keys(g).length===1,l=[...u(o)?o.allOf:[o],...u(v)?v.allOf:[v]];t.allOf=l},yu=(r,i,t,e)=>{let n=t,o=r._zod.def;n.type="array";let v=i.target==="draft-2020-12"?"prefixItems":"items",u=i.target==="draft-2020-12"?"items":i.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((U,w)=>W(U,i,{...e,path:[...e.path,v,w]})),g=o.rest?W(o.rest,i,{...e,path:[...e.path,u,...i.target==="openapi-3.0"?[o.items.length]:[]]}):null;if(i.target==="draft-2020-12"){if(n.prefixItems=l,g)n.items=g}else if(i.target==="openapi-3.0"){if(n.items={anyOf:l},g)n.items.anyOf.push(g);if(n.minItems=l.length,!g)n.maxItems=l.length}else if(n.items=l,g)n.additionalItems=g;let{minimum:c,maximum:_}=r._zod.bag;if(typeof c==="number")n.minItems=c;if(typeof _==="number")n.maxItems=_},au=(r,i,t,e)=>{let n=t,o=r._zod.def;n.type="object";let v=o.keyType,l=v._zod.bag?.patterns;if(o.mode==="loose"&&l&&l.size>0){let c=W(o.valueType,i,{...e,path:[...e.path,"patternProperties","*"]});n.patternProperties={};for(let _ of l)n.patternProperties[_.source]=c}else{if(i.target==="draft-07"||i.target==="draft-2020-12")n.propertyNames=W(o.keyType,i,{...e,path:[...e.path,"propertyNames"]});n.additionalProperties=W(o.valueType,i,{...e,path:[...e.path,"additionalProperties"]})}let g=v._zod.values;if(g){let c=[...g].filter((_)=>typeof _==="string"||typeof _==="number");if(c.length>0)n.required=c}},pu=(r,i,t,e)=>{let n=r._zod.def,o=W(n.innerType,i,e),v=i.seen.get(r);if(i.target==="openapi-3.0")v.ref=n.innerType,t.nullable=!0;else t.anyOf=[o,{type:"null"}]},su=(r,i,t,e)=>{let n=r._zod.def;W(n.innerType,i,e);let o=i.seen.get(r);o.ref=n.innerType},rg=(r,i,t,e)=>{let n=r._zod.def;W(n.innerType,i,e);let o=i.seen.get(r);o.ref=n.innerType,t.default=JSON.parse(JSON.stringify(n.defaultValue))},ng=(r,i,t,e)=>{let n=r._zod.def;W(n.innerType,i,e);let o=i.seen.get(r);if(o.ref=n.innerType,i.io==="input")t._prefault=JSON.parse(JSON.stringify(n.defaultValue))},ig=(r,i,t,e)=>{let n=r._zod.def;W(n.innerType,i,e);let o=i.seen.get(r);o.ref=n.innerType;let v;try{v=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}t.default=v},tg=(r,i,t,e)=>{let n=r._zod.def,o=n.in._zod.traits.has("$ZodTransform"),v=i.io==="input"?o?n.out:n.in:n.out;W(v,i,e);let u=i.seen.get(r);u.ref=v},og=(r,i,t,e)=>{let n=r._zod.def;W(n.innerType,i,e);let o=i.seen.get(r);o.ref=n.innerType,t.readOnly=!0},eg=(r,i,t,e)=>{let n=r._zod.def;W(n.innerType,i,e);let o=i.seen.get(r);o.ref=n.innerType},Dt=(r,i,t,e)=>{let n=r._zod.def;W(n.innerType,i,e);let o=i.seen.get(r);o.ref=n.innerType},vg=(r,i,t,e)=>{let n=r._zod.innerType;W(n,i,e);let o=i.seen.get(r);o.ref=n},wt={string:fu,number:Eu,boolean:ju,bigint:Lu,symbol:Au,null:Ju,undefined:Gu,void:Xu,never:Wu,any:Hu,unknown:qu,date:Vu,enum:du,literal:Yu,nan:Ru,template_literal:Fu,file:Bu,success:Qu,custom:Ku,function:Tu,transform:Mu,map:xu,set:zu,array:Cu,object:Zu,union:kt,intersection:hu,tuple:yu,record:au,nullable:pu,nonoptional:su,default:rg,prefault:ng,catch:ig,pipe:tg,readonly:og,promise:eg,optional:Dt,lazy:vg};function St(r,i){if("_idmap"in r){let e=r,n=Er({...i,processors:wt}),o={};for(let l of e._idmap.entries()){let[g,c]=l;W(c,n)}let v={},u={registry:e,uri:i?.uri,defs:o};n.external=u;for(let l of e._idmap.entries()){let[g,c]=l;jr(n,c),v[g]=Lr(n,c)}if(Object.keys(o).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";v.__shared={[l]:o}}return{schemas:v}}let t=Er({...i,processors:wt});return W(r,t),jr(t,r),Lr(t,r)}class $g{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(r){this.ctx.counter=r}get seen(){return this.ctx.seen}constructor(r){let i=r?.target??"draft-2020-12";if(i==="draft-4")i="draft-04";if(i==="draft-7")i="draft-07";this.ctx=Er({processors:wt,target:i,...r?.metadata&&{metadata:r.metadata},...r?.unrepresentable&&{unrepresentable:r.unrepresentable},...r?.override&&{override:r.override},...r?.io&&{io:r.io}})}process(r,i={path:[],schemaPath:[]}){return W(r,this.ctx,i)}emit(r,i){if(i){if(i.cycles)this.ctx.cycles=i.cycles;if(i.reused)this.ctx.reused=i.reused;if(i.external)this.ctx.external=i.external}jr(this.ctx,r);let t=Lr(this.ctx,r),{"~standard":e,...n}=t;return n}}var zc={};var an={};br(an,{xor:()=>FI,xid:()=>uI,void:()=>HI,uuidv7:()=>rI,uuidv6:()=>sc,uuidv4:()=>pc,uuid:()=>ac,url:()=>nI,unknown:()=>Qr,union:()=>zt,undefined:()=>XI,ulid:()=>$I,uint64:()=>JI,uint32:()=>jI,tuple:()=>Qg,transform:()=>Zt,templateLiteral:()=>sI,symbol:()=>GI,superRefine:()=>Ul,success:()=>hI,stringbool:()=>$6,stringFormat:()=>SI,string:()=>pn,strictObject:()=>YI,set:()=>MI,refine:()=>_l,record:()=>Kg,readonly:()=>ul,promise:()=>r6,preprocess:()=>g6,prefault:()=>rl,pipe:()=>jt,partialRecord:()=>QI,optional:()=>ri,object:()=>dI,number:()=>Eg,nullish:()=>ZI,nullable:()=>ni,null:()=>Gg,nonoptional:()=>nl,never:()=>xt,nativeEnum:()=>xI,nanoid:()=>oI,nan:()=>yI,meta:()=>e6,map:()=>TI,mac:()=>cI,looseRecord:()=>KI,looseObject:()=>RI,literal:()=>zI,lazy:()=>cl,ksuid:()=>gI,keyof:()=>VI,jwt:()=>DI,json:()=>u6,ipv6:()=>II,ipv4:()=>lI,invertCodec:()=>pI,intersection:()=>Fg,int64:()=>AI,int32:()=>EI,int:()=>Et,instanceof:()=>v6,httpUrl:()=>iI,hostname:()=>NI,hex:()=>mI,hash:()=>PI,guid:()=>yc,function:()=>n6,float64:()=>fI,float32:()=>OI,file:()=>CI,exactOptional:()=>hg,enum:()=>Ct,emoji:()=>tI,email:()=>hc,e164:()=>kI,discriminatedUnion:()=>BI,describe:()=>o6,date:()=>qI,custom:()=>t6,cuid2:()=>vI,cuid:()=>eI,codec:()=>aI,cidrv6:()=>_I,cidrv4:()=>bI,check:()=>i6,catch:()=>ol,boolean:()=>jg,bigint:()=>LI,base64url:()=>wI,base64:()=>UI,array:()=>ei,any:()=>WI,_function:()=>n6,_default:()=>pg,_ZodString:()=>Lt,ZodXor:()=>dg,ZodXID:()=>qt,ZodVoid:()=>qg,ZodUnknown:()=>Wg,ZodUnion:()=>$i,ZodUndefined:()=>Ag,ZodUUID:()=>Ir,ZodURL:()=>ti,ZodULID:()=>Ht,ZodType:()=>L,ZodTuple:()=>Bg,ZodTransform:()=>Cg,ZodTemplateLiteral:()=>gl,ZodSymbol:()=>Lg,ZodSuccess:()=>il,ZodStringFormat:()=>V,ZodString:()=>Sn,ZodSet:()=>Mg,ZodRecord:()=>kn,ZodReadonly:()=>$l,ZodPromise:()=>Il,ZodPreprocess:()=>vl,ZodPrefault:()=>sg,ZodPipe:()=>ui,ZodOptional:()=>ht,ZodObject:()=>vi,ZodNumberFormat:()=>Kr,ZodNumber:()=>mn,ZodNullable:()=>yg,ZodNull:()=>Jg,ZodNonOptional:()=>yt,ZodNever:()=>Hg,ZodNanoID:()=>Gt,ZodNaN:()=>el,ZodMap:()=>Tg,ZodMAC:()=>fg,ZodLiteral:()=>xg,ZodLazy:()=>ll,ZodKSUID:()=>Vt,ZodJWT:()=>Tt,ZodIntersection:()=>Rg,ZodIPv6:()=>Yt,ZodIPv4:()=>dt,ZodGUID:()=>sn,ZodFunction:()=>bl,ZodFile:()=>zg,ZodExactOptional:()=>Zg,ZodEnum:()=>Dn,ZodEmoji:()=>Jt,ZodEmail:()=>At,ZodE164:()=>Kt,ZodDiscriminatedUnion:()=>Yg,ZodDefault:()=>ag,ZodDate:()=>oi,ZodCustomStringFormat:()=>Nn,ZodCustom:()=>li,ZodCodec:()=>gi,ZodCatch:()=>tl,ZodCUID2:()=>Wt,ZodCUID:()=>Xt,ZodCIDRv6:()=>Ft,ZodCIDRv4:()=>Rt,ZodBoolean:()=>Pn,ZodBigIntFormat:()=>Mt,ZodBigInt:()=>On,ZodBase64URL:()=>Qt,ZodBase64:()=>Bt,ZodArray:()=>Vg,ZodAny:()=>Xg});var Nt={};br(Nt,{uppercase:()=>on,trim:()=>ln,toUpperCase:()=>In,toLowerCase:()=>cn,startsWith:()=>vn,slugify:()=>bn,size:()=>Rr,regex:()=>nn,property:()=>Ut,positive:()=>ct,overwrite:()=>or,normalize:()=>gn,nonpositive:()=>bt,nonnegative:()=>_t,negative:()=>It,multipleOf:()=>Or,minSize:()=>cr,minLength:()=>Ur,mime:()=>un,maxSize:()=>fr,maxLength:()=>Fr,lte:()=>nr,lt:()=>gr,lowercase:()=>tn,length:()=>Br,includes:()=>en,gte:()=>h,gt:()=>lr,endsWith:()=>$n});var wn={};br(wn,{time:()=>lg,duration:()=>cg,datetime:()=>ug,date:()=>gg,ZodISOTime:()=>Ot,ZodISODuration:()=>ft,ZodISODateTime:()=>mt,ZodISODate:()=>Pt});var mt=I("ZodISODateTime",(r,i)=>{Ke.init(r,i),V.init(r,i)});function ug(r){return K$(mt,r)}var Pt=I("ZodISODate",(r,i)=>{Te.init(r,i),V.init(r,i)});function gg(r){return T$(Pt,r)}var Ot=I("ZodISOTime",(r,i)=>{Me.init(r,i),V.init(r,i)});function lg(r){return M$(Ot,r)}var ft=I("ZodISODuration",(r,i)=>{xe.init(r,i),V.init(r,i)});function cg(r){return x$(ft,r)}var Cc=(r,i)=>{Vn.init(r,i),r.name="ZodError",Object.defineProperties(r,{format:{value:(t)=>Yn(r,t)},flatten:{value:(t)=>dn(r,t)},addIssue:{value:(t)=>{r.issues.push(t),r.message=JSON.stringify(r.issues,zr,2)}},addIssues:{value:(t)=>{r.issues.push(...t),r.message=JSON.stringify(r.issues,zr,2)}},isEmpty:{get(){return r.issues.length===0}}})},QU=I("ZodError",Cc),s=I("ZodError",Cc,{Parent:Error});var Ig=hr(s),bg=yr(s),_g=ar(s),Ug=pr(s),wg=Oi(s),kg=fi(s),Dg=Ei(s),Sg=ji(s),Ng=Li(s),mg=Ai(s),Pg=Ji(s),Og=Gi(s);var Zc=new WeakMap;function ii(r,i,t){let e=Object.getPrototypeOf(r),n=Zc.get(e);if(!n)n=new Set,Zc.set(e,n);if(n.has(i))return;n.add(i);for(let o in t){let v=t[o];Object.defineProperty(e,o,{configurable:!0,enumerable:!1,get(){let u=v.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:u}),u},set(u){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:u})}})}}var L=I("ZodType",(r,i)=>{return j.init(r,i),Object.assign(r["~standard"],{jsonSchema:{input:Un(r,"input"),output:Un(r,"output")}}),r.toJSONSchema=Ou(r,{}),r.def=i,r.type=i.type,Object.defineProperty(r,"_def",{value:i}),r.parse=(t,e)=>Ig(r,t,e,{callee:r.parse}),r.safeParse=(t,e)=>_g(r,t,e),r.parseAsync=async(t,e)=>bg(r,t,e,{callee:r.parseAsync}),r.safeParseAsync=async(t,e)=>Ug(r,t,e),r.spa=r.safeParseAsync,r.encode=(t,e)=>wg(r,t,e),r.decode=(t,e)=>kg(r,t,e),r.encodeAsync=async(t,e)=>Dg(r,t,e),r.decodeAsync=async(t,e)=>Sg(r,t,e),r.safeEncode=(t,e)=>Ng(r,t,e),r.safeDecode=(t,e)=>mg(r,t,e),r.safeEncodeAsync=async(t,e)=>Pg(r,t,e),r.safeDecodeAsync=async(t,e)=>Og(r,t,e),ii(r,"ZodType",{check(...t){let e=this.def;return this.clone(S.mergeDefs(e,{checks:[...e.checks??[],...t.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,e){return C(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},refine(t,e){return this.check(_l(t,e))},superRefine(t,e){return this.check(Ul(t,e))},overwrite(t){return this.check(or(t))},optional(){return ri(this)},exactOptional(){return hg(this)},nullable(){return ni(this)},nullish(){return ri(ni(this))},nonoptional(t){return nl(this,t)},array(){return ei(this)},or(t){return zt([this,t])},and(t){return Fg(this,t)},transform(t){return jt(this,Zt(t))},default(t){return pg(this,t)},prefault(t){return rl(this,t)},catch(t){return ol(this,t)},pipe(t){return jt(this,t)},readonly(){return ul(this)},describe(t){let e=this.clone();return M.add(e,{description:t}),e},meta(...t){if(t.length===0)return M.get(this);let e=this.clone();return M.add(e,t[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t){return t(this)}}),Object.defineProperty(r,"description",{get(){return M.get(r)?.description},configurable:!0}),r}),Lt=I("_ZodString",(r,i)=>{Yr.init(r,i),L.init(r,i),r._zod.processJSONSchema=(e,n,o)=>fu(r,e,n,o);let t=r._zod.bag;r.format=t.format??null,r.minLength=t.minimum??null,r.maxLength=t.maximum??null,ii(r,"_ZodString",{regex(...e){return this.check(nn(...e))},includes(...e){return this.check(en(...e))},startsWith(...e){return this.check(vn(...e))},endsWith(...e){return this.check($n(...e))},min(...e){return this.check(Ur(...e))},max(...e){return this.check(Fr(...e))},length(...e){return this.check(Br(...e))},nonempty(...e){return this.check(Ur(1,...e))},lowercase(e){return this.check(tn(e))},uppercase(e){return this.check(on(e))},trim(){return this.check(ln())},normalize(...e){return this.check(gn(...e))},toLowerCase(){return this.check(cn())},toUpperCase(){return this.check(In())},slugify(){return this.check(bn())}})}),Sn=I("ZodString",(r,i)=>{Yr.init(r,i),Lt.init(r,i),r.email=(t)=>r.check(xi(At,t)),r.url=(t)=>r.check(yn(ti,t)),r.jwt=(t)=>r.check(lt(Tt,t)),r.emoji=(t)=>r.check(yi(Jt,t)),r.guid=(t)=>r.check(hn(sn,t)),r.uuid=(t)=>r.check(zi(Ir,t)),r.uuidv4=(t)=>r.check(Ci(Ir,t)),r.uuidv6=(t)=>r.check(Zi(Ir,t)),r.uuidv7=(t)=>r.check(hi(Ir,t)),r.nanoid=(t)=>r.check(ai(Gt,t)),r.guid=(t)=>r.check(hn(sn,t)),r.cuid=(t)=>r.check(pi(Xt,t)),r.cuid2=(t)=>r.check(si(Wt,t)),r.ulid=(t)=>r.check(rt(Ht,t)),r.base64=(t)=>r.check($t(Bt,t)),r.base64url=(t)=>r.check(ut(Qt,t)),r.xid=(t)=>r.check(nt(qt,t)),r.ksuid=(t)=>r.check(it(Vt,t)),r.ipv4=(t)=>r.check(tt(dt,t)),r.ipv6=(t)=>r.check(ot(Yt,t)),r.cidrv4=(t)=>r.check(et(Rt,t)),r.cidrv6=(t)=>r.check(vt(Ft,t)),r.e164=(t)=>r.check(gt(Kt,t)),r.datetime=(t)=>r.check(ug(t)),r.date=(t)=>r.check(gg(t)),r.time=(t)=>r.check(lg(t)),r.duration=(t)=>r.check(cg(t))});function pn(r){return R$(Sn,r)}var V=I("ZodStringFormat",(r,i)=>{q.init(r,i),Lt.init(r,i)}),At=I("ZodEmail",(r,i)=>{He.init(r,i),V.init(r,i)});function hc(r){return xi(At,r)}var sn=I("ZodGUID",(r,i)=>{Xe.init(r,i),V.init(r,i)});function yc(r){return hn(sn,r)}var Ir=I("ZodUUID",(r,i)=>{We.init(r,i),V.init(r,i)});function ac(r){return zi(Ir,r)}function pc(r){return Ci(Ir,r)}function sc(r){return Zi(Ir,r)}function rI(r){return hi(Ir,r)}var ti=I("ZodURL",(r,i)=>{qe.init(r,i),V.init(r,i)});function nI(r){return yn(ti,r)}function iI(r){return yn(ti,{protocol:rr.httpProtocol,hostname:rr.domain,...S.normalizeParams(r)})}var Jt=I("ZodEmoji",(r,i)=>{Ve.init(r,i),V.init(r,i)});function tI(r){return yi(Jt,r)}var Gt=I("ZodNanoID",(r,i)=>{de.init(r,i),V.init(r,i)});function oI(r){return ai(Gt,r)}var Xt=I("ZodCUID",(r,i)=>{Ye.init(r,i),V.init(r,i)});function eI(r){return pi(Xt,r)}var Wt=I("ZodCUID2",(r,i)=>{Re.init(r,i),V.init(r,i)});function vI(r){return si(Wt,r)}var Ht=I("ZodULID",(r,i)=>{Fe.init(r,i),V.init(r,i)});function $I(r){return rt(Ht,r)}var qt=I("ZodXID",(r,i)=>{Be.init(r,i),V.init(r,i)});function uI(r){return nt(qt,r)}var Vt=I("ZodKSUID",(r,i)=>{Qe.init(r,i),V.init(r,i)});function gI(r){return it(Vt,r)}var dt=I("ZodIPv4",(r,i)=>{ze.init(r,i),V.init(r,i)});function lI(r){return tt(dt,r)}var fg=I("ZodMAC",(r,i)=>{Ze.init(r,i),V.init(r,i)});function cI(r){return B$(fg,r)}var Yt=I("ZodIPv6",(r,i)=>{Ce.init(r,i),V.init(r,i)});function II(r){return ot(Yt,r)}var Rt=I("ZodCIDRv4",(r,i)=>{he.init(r,i),V.init(r,i)});function bI(r){return et(Rt,r)}var Ft=I("ZodCIDRv6",(r,i)=>{ye.init(r,i),V.init(r,i)});function _I(r){return vt(Ft,r)}var Bt=I("ZodBase64",(r,i)=>{pe.init(r,i),V.init(r,i)});function UI(r){return $t(Bt,r)}var Qt=I("ZodBase64URL",(r,i)=>{se.init(r,i),V.init(r,i)});function wI(r){return ut(Qt,r)}var Kt=I("ZodE164",(r,i)=>{rv.init(r,i),V.init(r,i)});function kI(r){return gt(Kt,r)}var Tt=I("ZodJWT",(r,i)=>{nv.init(r,i),V.init(r,i)});function DI(r){return lt(Tt,r)}var Nn=I("ZodCustomStringFormat",(r,i)=>{iv.init(r,i),V.init(r,i)});function SI(r,i,t={}){return _n(Nn,r,i,t)}function NI(r){return _n(Nn,"hostname",rr.hostname,r)}function mI(r){return _n(Nn,"hex",rr.hex,r)}function PI(r,i){let t=i?.enc??"hex",e=`${r}_${t}`,n=rr[e];if(!n)throw Error(`Unrecognized hash format: ${e}`);return _n(Nn,e,n,i)}var mn=I("ZodNumber",(r,i)=>{Fi.init(r,i),L.init(r,i),r._zod.processJSONSchema=(e,n,o)=>Eu(r,e,n,o),ii(r,"ZodNumber",{gt(e,n){return this.check(lr(e,n))},gte(e,n){return this.check(h(e,n))},min(e,n){return this.check(h(e,n))},lt(e,n){return this.check(gr(e,n))},lte(e,n){return this.check(nr(e,n))},max(e,n){return this.check(nr(e,n))},int(e){return this.check(Et(e))},safe(e){return this.check(Et(e))},positive(e){return this.check(lr(0,e))},nonnegative(e){return this.check(h(0,e))},negative(e){return this.check(gr(0,e))},nonpositive(e){return this.check(nr(0,e))},multipleOf(e,n){return this.check(Or(e,n))},step(e,n){return this.check(Or(e,n))},finite(){return this}});let t=r._zod.bag;r.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,r.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,r.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??0.5),r.isFinite=!0,r.format=t.format??null});function Eg(r){return z$(mn,r)}var Kr=I("ZodNumberFormat",(r,i)=>{tv.init(r,i),mn.init(r,i)});function Et(r){return Z$(Kr,r)}function OI(r){return h$(Kr,r)}function fI(r){return y$(Kr,r)}function EI(r){return a$(Kr,r)}function jI(r){return p$(Kr,r)}var Pn=I("ZodBoolean",(r,i)=>{Qn.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>ju(r,t,e,n)});function jg(r){return s$(Pn,r)}var On=I("ZodBigInt",(r,i)=>{Bi.init(r,i),L.init(r,i),r._zod.processJSONSchema=(e,n,o)=>Lu(r,e,n,o),r.gte=(e,n)=>r.check(h(e,n)),r.min=(e,n)=>r.check(h(e,n)),r.gt=(e,n)=>r.check(lr(e,n)),r.gte=(e,n)=>r.check(h(e,n)),r.min=(e,n)=>r.check(h(e,n)),r.lt=(e,n)=>r.check(gr(e,n)),r.lte=(e,n)=>r.check(nr(e,n)),r.max=(e,n)=>r.check(nr(e,n)),r.positive=(e)=>r.check(lr(BigInt(0),e)),r.negative=(e)=>r.check(gr(BigInt(0),e)),r.nonpositive=(e)=>r.check(nr(BigInt(0),e)),r.nonnegative=(e)=>r.check(h(BigInt(0),e)),r.multipleOf=(e,n)=>r.check(Or(e,n));let t=r._zod.bag;r.minValue=t.minimum??null,r.maxValue=t.maximum??null,r.format=t.format??null});function LI(r){return nu(On,r)}var Mt=I("ZodBigIntFormat",(r,i)=>{ov.init(r,i),On.init(r,i)});function AI(r){return tu(Mt,r)}function JI(r){return ou(Mt,r)}var Lg=I("ZodSymbol",(r,i)=>{ev.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Au(r,t,e,n)});function GI(r){return eu(Lg,r)}var Ag=I("ZodUndefined",(r,i)=>{vv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Gu(r,t,e,n)});function XI(r){return vu(Ag,r)}var Jg=I("ZodNull",(r,i)=>{$v.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Ju(r,t,e,n)});function Gg(r){return $u(Jg,r)}var Xg=I("ZodAny",(r,i)=>{uv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Hu(r,t,e,n)});function WI(){return uu(Xg)}var Wg=I("ZodUnknown",(r,i)=>{gv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>qu(r,t,e,n)});function Qr(){return gu(Wg)}var Hg=I("ZodNever",(r,i)=>{lv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Wu(r,t,e,n)});function xt(r){return lu(Hg,r)}var qg=I("ZodVoid",(r,i)=>{cv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Xu(r,t,e,n)});function HI(r){return cu(qg,r)}var oi=I("ZodDate",(r,i)=>{Iv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(e,n,o)=>Vu(r,e,n,o),r.min=(e,n)=>r.check(h(e,n)),r.max=(e,n)=>r.check(nr(e,n));let t=r._zod.bag;r.minDate=t.minimum?new Date(t.minimum):null,r.maxDate=t.maximum?new Date(t.maximum):null});function qI(r){return Iu(oi,r)}var Vg=I("ZodArray",(r,i)=>{bv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Cu(r,t,e,n),r.element=i.element,ii(r,"ZodArray",{min(t,e){return this.check(Ur(t,e))},nonempty(t){return this.check(Ur(1,t))},max(t,e){return this.check(Fr(t,e))},length(t,e){return this.check(Br(t,e))},unwrap(){return this.element}})});function ei(r,i){return Uu(Vg,r,i)}function VI(r){let i=r._zod.def.shape;return Ct(Object.keys(i))}var vi=I("ZodObject",(r,i)=>{_v.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Zu(r,t,e,n),S.defineLazy(r,"shape",()=>{return i.shape}),ii(r,"ZodObject",{keyof(){return Ct(Object.keys(this._zod.def.shape))},catchall(t){return this.clone({...this._zod.def,catchall:t})},passthrough(){return this.clone({...this._zod.def,catchall:Qr()})},loose(){return this.clone({...this._zod.def,catchall:Qr()})},strict(){return this.clone({...this._zod.def,catchall:xt()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(t){return S.extend(this,t)},safeExtend(t){return S.safeExtend(this,t)},merge(t){return S.merge(this,t)},pick(t){return S.pick(this,t)},omit(t){return S.omit(this,t)},partial(...t){return S.partial(ht,this,t[0])},required(...t){return S.required(yt,this,t[0])}})});function dI(r,i){let t={type:"object",shape:r??{},...S.normalizeParams(i)};return new vi(t)}function YI(r,i){return new vi({type:"object",shape:r,catchall:xt(),...S.normalizeParams(i)})}function RI(r,i){return new vi({type:"object",shape:r,catchall:Qr(),...S.normalizeParams(i)})}var $i=I("ZodUnion",(r,i)=>{Kn.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>kt(r,t,e,n),r.options=i.options});function zt(r,i){return new $i({type:"union",options:r,...S.normalizeParams(i)})}var dg=I("ZodXor",(r,i)=>{$i.init(r,i),Uv.init(r,i),r._zod.processJSONSchema=(t,e,n)=>kt(r,t,e,n),r.options=i.options});function FI(r,i){return new dg({type:"union",options:r,inclusive:!1,...S.normalizeParams(i)})}var Yg=I("ZodDiscriminatedUnion",(r,i)=>{$i.init(r,i),wv.init(r,i)});function BI(r,i,t){return new Yg({type:"union",options:i,discriminator:r,...S.normalizeParams(t)})}var Rg=I("ZodIntersection",(r,i)=>{kv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>hu(r,t,e,n)});function Fg(r,i){return new Rg({type:"intersection",left:r,right:i})}var Bg=I("ZodTuple",(r,i)=>{Qi.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>yu(r,t,e,n),r.rest=(t)=>r.clone({...r._zod.def,rest:t})});function Qg(r,i,t){let e=i instanceof j,n=e?t:i;return new Bg({type:"tuple",items:r,rest:e?i:null,...S.normalizeParams(n)})}var kn=I("ZodRecord",(r,i)=>{Dv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>au(r,t,e,n),r.keyType=i.keyType,r.valueType=i.valueType});function Kg(r,i,t){if(!i||!i._zod)return new kn({type:"record",keyType:pn(),valueType:r,...S.normalizeParams(i)});return new kn({type:"record",keyType:r,valueType:i,...S.normalizeParams(t)})}function QI(r,i,t){let e=C(r);return e._zod.values=void 0,new kn({type:"record",keyType:e,valueType:i,...S.normalizeParams(t)})}function KI(r,i,t){return new kn({type:"record",keyType:r,valueType:i,mode:"loose",...S.normalizeParams(t)})}var Tg=I("ZodMap",(r,i)=>{Sv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>xu(r,t,e,n),r.keyType=i.keyType,r.valueType=i.valueType,r.min=(...t)=>r.check(cr(...t)),r.nonempty=(t)=>r.check(cr(1,t)),r.max=(...t)=>r.check(fr(...t)),r.size=(...t)=>r.check(Rr(...t))});function TI(r,i,t){return new Tg({type:"map",keyType:r,valueType:i,...S.normalizeParams(t)})}var Mg=I("ZodSet",(r,i)=>{Nv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>zu(r,t,e,n),r.min=(...t)=>r.check(cr(...t)),r.nonempty=(t)=>r.check(cr(1,t)),r.max=(...t)=>r.check(fr(...t)),r.size=(...t)=>r.check(Rr(...t))});function MI(r,i){return new Mg({type:"set",valueType:r,...S.normalizeParams(i)})}var Dn=I("ZodEnum",(r,i)=>{mv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(e,n,o)=>du(r,e,n,o),r.enum=i.entries,r.options=Object.values(i.entries);let t=new Set(Object.keys(i.entries));r.extract=(e,n)=>{let o={};for(let v of e)if(t.has(v))o[v]=i.entries[v];else throw Error(`Key ${v} not found in enum`);return new Dn({...i,checks:[],...S.normalizeParams(n),entries:o})},r.exclude=(e,n)=>{let o={...i.entries};for(let v of e)if(t.has(v))delete o[v];else throw Error(`Key ${v} not found in enum`);return new Dn({...i,checks:[],...S.normalizeParams(n),entries:o})}});function Ct(r,i){let t=Array.isArray(r)?Object.fromEntries(r.map((e)=>[e,e])):r;return new Dn({type:"enum",entries:t,...S.normalizeParams(i)})}function xI(r,i){return new Dn({type:"enum",entries:r,...S.normalizeParams(i)})}var xg=I("ZodLiteral",(r,i)=>{Pv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Yu(r,t,e,n),r.values=new Set(i.values),Object.defineProperty(r,"value",{get(){if(i.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return i.values[0]}})});function zI(r,i){return new xg({type:"literal",values:Array.isArray(r)?r:[r],...S.normalizeParams(i)})}var zg=I("ZodFile",(r,i)=>{Ov.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Bu(r,t,e,n),r.min=(t,e)=>r.check(cr(t,e)),r.max=(t,e)=>r.check(fr(t,e)),r.mime=(t,e)=>r.check(un(Array.isArray(t)?t:[t],e))});function CI(r){return wu(zg,r)}var Cg=I("ZodTransform",(r,i)=>{fv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Mu(r,t,e,n),r._zod.parse=(t,e)=>{if(e.direction==="backward")throw new qr(r.constructor.name);t.addIssue=(o)=>{if(typeof o==="string")t.issues.push(S.issue(o,t.value,i));else{let v=o;if(v.fatal)v.continue=!1;v.code??(v.code="custom"),v.input??(v.input=t.value),v.inst??(v.inst=r),t.issues.push(S.issue(v))}};let n=i.transform(t.value,t);if(n instanceof Promise)return n.then((o)=>{return t.value=o,t.fallback=!0,t});return t.value=n,t.fallback=!0,t}});function Zt(r){return new Cg({type:"transform",transform:r})}var ht=I("ZodOptional",(r,i)=>{Ki.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Dt(r,t,e,n),r.unwrap=()=>r._zod.def.innerType});function ri(r){return new ht({type:"optional",innerType:r})}var Zg=I("ZodExactOptional",(r,i)=>{Ev.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Dt(r,t,e,n),r.unwrap=()=>r._zod.def.innerType});function hg(r){return new Zg({type:"optional",innerType:r})}var yg=I("ZodNullable",(r,i)=>{jv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>pu(r,t,e,n),r.unwrap=()=>r._zod.def.innerType});function ni(r){return new yg({type:"nullable",innerType:r})}function ZI(r){return ri(ni(r))}var ag=I("ZodDefault",(r,i)=>{Lv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>rg(r,t,e,n),r.unwrap=()=>r._zod.def.innerType,r.removeDefault=r.unwrap});function pg(r,i){return new ag({type:"default",innerType:r,get defaultValue(){return typeof i==="function"?i():S.shallowClone(i)}})}var sg=I("ZodPrefault",(r,i)=>{Av.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>ng(r,t,e,n),r.unwrap=()=>r._zod.def.innerType});function rl(r,i){return new sg({type:"prefault",innerType:r,get defaultValue(){return typeof i==="function"?i():S.shallowClone(i)}})}var yt=I("ZodNonOptional",(r,i)=>{Jv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>su(r,t,e,n),r.unwrap=()=>r._zod.def.innerType});function nl(r,i){return new yt({type:"nonoptional",innerType:r,...S.normalizeParams(i)})}var il=I("ZodSuccess",(r,i)=>{Gv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Qu(r,t,e,n),r.unwrap=()=>r._zod.def.innerType});function hI(r){return new il({type:"success",innerType:r})}var tl=I("ZodCatch",(r,i)=>{Xv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>ig(r,t,e,n),r.unwrap=()=>r._zod.def.innerType,r.removeCatch=r.unwrap});function ol(r,i){return new tl({type:"catch",innerType:r,catchValue:typeof i==="function"?i:()=>i})}var el=I("ZodNaN",(r,i)=>{Wv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Ru(r,t,e,n)});function yI(r){return _u(el,r)}var ui=I("ZodPipe",(r,i)=>{Ti.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>tg(r,t,e,n),r.in=i.in,r.out=i.out});function jt(r,i){return new ui({type:"pipe",in:r,out:i})}var gi=I("ZodCodec",(r,i)=>{ui.init(r,i),Tn.init(r,i)});function aI(r,i,t){return new gi({type:"pipe",in:r,out:i,transform:t.decode,reverseTransform:t.encode})}function pI(r){let i=r._zod.def;return new gi({type:"pipe",in:i.out,out:i.in,transform:i.reverseTransform,reverseTransform:i.transform})}var vl=I("ZodPreprocess",(r,i)=>{ui.init(r,i),Hv.init(r,i)}),$l=I("ZodReadonly",(r,i)=>{qv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>og(r,t,e,n),r.unwrap=()=>r._zod.def.innerType});function ul(r){return new $l({type:"readonly",innerType:r})}var gl=I("ZodTemplateLiteral",(r,i)=>{Vv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Fu(r,t,e,n)});function sI(r,i){return new gl({type:"template_literal",parts:r,...S.normalizeParams(i)})}var ll=I("ZodLazy",(r,i)=>{Rv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>vg(r,t,e,n),r.unwrap=()=>r._zod.def.getter()});function cl(r){return new ll({type:"lazy",getter:r})}var Il=I("ZodPromise",(r,i)=>{Yv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>eg(r,t,e,n),r.unwrap=()=>r._zod.def.innerType});function r6(r){return new Il({type:"promise",innerType:r})}var bl=I("ZodFunction",(r,i)=>{dv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Tu(r,t,e,n)});function n6(r){return new bl({type:"function",input:Array.isArray(r?.input)?Qg(r?.input):r?.input??ei(Qr()),output:r?.output??Qr()})}var li=I("ZodCustom",(r,i)=>{Fv.init(r,i),L.init(r,i),r._zod.processJSONSchema=(t,e,n)=>Ku(r,t,e,n)});function i6(r){let i=new d({check:"custom"});return i._zod.check=r,i}function t6(r,i){return ku(li,r??(()=>!0),i)}function _l(r,i={}){return Du(li,r,i)}function Ul(r,i){return Su(r,i)}var o6=Nu,e6=mu;function v6(r,i={}){let t=new li({type:"custom",check:"custom",fn:(e)=>e instanceof r,abort:!0,...S.normalizeParams(i)});return t._zod.bag.Class=r,t._zod.check=(e)=>{if(!(e.value instanceof r))e.issues.push({code:"invalid_type",expected:r.name,input:e.value,inst:t,path:[...t._zod.def.path??[]]})},t}var $6=(...r)=>Pu({Codec:gi,Boolean:Pn,String:Sn},...r);function u6(r){let i=cl(()=>{return zt([pn(r),Eg(),jg(),Gg(),ei(i),Kg(pn(),i)])});return i}function g6(r,i){return new vl({type:"pipe",in:Zt(r),out:i})}var TU={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function MU(r){B({customError:r})}function xU(){return B().customError}var wl;(function(r){})(wl||(wl={}));var P={...an,...Nt,iso:wn},zU=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function CU(r,i){let t=r.$schema;if(t==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(t==="http://json-schema.org/draft-07/schema#")return"draft-7";if(t==="http://json-schema.org/draft-04/schema#")return"draft-4";return i??"draft-2020-12"}function ZU(r,i){if(!r.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let t=r.slice(1).split("/").filter(Boolean);if(t.length===0)return i.rootSchema;let e=i.version==="draft-2020-12"?"$defs":"definitions";if(t[0]===e){let n=t[1];if(!n||!i.defs[n])throw Error(`Reference not found: ${r}`);return i.defs[n]}throw Error(`Reference not found: ${r}`)}function l6(r,i){if(r.not!==void 0){if(typeof r.not==="object"&&Object.keys(r.not).length===0)return P.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(r.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(r.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(r.if!==void 0||r.then!==void 0||r.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(r.dependentSchemas!==void 0||r.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(r.$ref){let n=r.$ref;if(i.refs.has(n))return i.refs.get(n);if(i.processing.has(n))return P.lazy(()=>{if(!i.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return i.refs.get(n)});i.processing.add(n);let o=ZU(n,i),v=x(o,i);return i.refs.set(n,v),i.processing.delete(n),v}if(r.enum!==void 0){let n=r.enum;if(i.version==="openapi-3.0"&&r.nullable===!0&&n.length===1&&n[0]===null)return P.null();if(n.length===0)return P.never();if(n.length===1)return P.literal(n[0]);if(n.every((v)=>typeof v==="string"))return P.enum(n);let o=n.map((v)=>P.literal(v));if(o.length<2)return o[0];return P.union([o[0],o[1],...o.slice(2)])}if(r.const!==void 0)return P.literal(r.const);let t=r.type;if(Array.isArray(t)){let n=t.map((o)=>{let v={...r,type:o};return l6(v,i)});if(n.length===0)return P.never();if(n.length===1)return n[0];return P.union(n)}if(!t)return P.any();let e;switch(t){case"string":{let n=P.string();if(r.format){let o=r.format;if(o==="email")n=n.check(P.email());else if(o==="uri"||o==="uri-reference")n=n.check(P.url());else if(o==="uuid"||o==="guid")n=n.check(P.uuid());else if(o==="date-time")n=n.check(P.iso.datetime());else if(o==="date")n=n.check(P.iso.date());else if(o==="time")n=n.check(P.iso.time());else if(o==="duration")n=n.check(P.iso.duration());else if(o==="ipv4")n=n.check(P.ipv4());else if(o==="ipv6")n=n.check(P.ipv6());else if(o==="mac")n=n.check(P.mac());else if(o==="cidr")n=n.check(P.cidrv4());else if(o==="cidr-v6")n=n.check(P.cidrv6());else if(o==="base64")n=n.check(P.base64());else if(o==="base64url")n=n.check(P.base64url());else if(o==="e164")n=n.check(P.e164());else if(o==="jwt")n=n.check(P.jwt());else if(o==="emoji")n=n.check(P.emoji());else if(o==="nanoid")n=n.check(P.nanoid());else if(o==="cuid")n=n.check(P.cuid());else if(o==="cuid2")n=n.check(P.cuid2());else if(o==="ulid")n=n.check(P.ulid());else if(o==="xid")n=n.check(P.xid());else if(o==="ksuid")n=n.check(P.ksuid())}if(typeof r.minLength==="number")n=n.min(r.minLength);if(typeof r.maxLength==="number")n=n.max(r.maxLength);if(r.pattern)n=n.regex(new RegExp(r.pattern));e=n;break}case"number":case"integer":{let n=t==="integer"?P.number().int():P.number();if(typeof r.minimum==="number")n=n.min(r.minimum);if(typeof r.maximum==="number")n=n.max(r.maximum);if(typeof r.exclusiveMinimum==="number")n=n.gt(r.exclusiveMinimum);else if(r.exclusiveMinimum===!0&&typeof r.minimum==="number")n=n.gt(r.minimum);if(typeof r.exclusiveMaximum==="number")n=n.lt(r.exclusiveMaximum);else if(r.exclusiveMaximum===!0&&typeof r.maximum==="number")n=n.lt(r.maximum);if(typeof r.multipleOf==="number")n=n.multipleOf(r.multipleOf);e=n;break}case"boolean":{e=P.boolean();break}case"null":{e=P.null();break}case"object":{let n={},o=r.properties||{},v=new Set(r.required||[]);for(let[l,g]of Object.entries(o)){let c=x(g,i);n[l]=v.has(l)?c:c.optional()}if(r.propertyNames){let l=x(r.propertyNames,i),g=r.additionalProperties&&typeof r.additionalProperties==="object"?x(r.additionalProperties,i):P.any();if(Object.keys(n).length===0){e=P.record(l,g);break}let c=P.object(n).passthrough(),_=P.looseRecord(l,g);e=P.intersection(c,_);break}if(r.patternProperties){let l=r.patternProperties,g=Object.keys(l),c=[];for(let U of g){let w=x(l[U],i),m=P.string().regex(new RegExp(U));c.push(P.looseRecord(m,w))}let _=[];if(Object.keys(n).length>0)_.push(P.object(n).passthrough());if(_.push(...c),_.length===0)e=P.object({}).passthrough();else if(_.length===1)e=_[0];else{let U=P.intersection(_[0],_[1]);for(let w=2;w<_.length;w++)U=P.intersection(U,_[w]);e=U}break}let u=P.object(n);if(r.additionalProperties===!1)e=u.strict();else if(typeof r.additionalProperties==="object")e=u.catchall(x(r.additionalProperties,i));else e=u.passthrough();break}case"array":{let{prefixItems:n,items:o}=r;if(n&&Array.isArray(n)){let v=n.map((l)=>x(l,i)),u=o&&typeof o==="object"&&!Array.isArray(o)?x(o,i):void 0;if(u)e=P.tuple(v).rest(u);else e=P.tuple(v);if(typeof r.minItems==="number")e=e.check(P.minLength(r.minItems));if(typeof r.maxItems==="number")e=e.check(P.maxLength(r.maxItems))}else if(Array.isArray(o)){let v=o.map((l)=>x(l,i)),u=r.additionalItems&&typeof r.additionalItems==="object"?x(r.additionalItems,i):void 0;if(u)e=P.tuple(v).rest(u);else e=P.tuple(v);if(typeof r.minItems==="number")e=e.check(P.minLength(r.minItems));if(typeof r.maxItems==="number")e=e.check(P.maxLength(r.maxItems))}else if(o!==void 0){let v=x(o,i),u=P.array(v);if(typeof r.minItems==="number")u=u.min(r.minItems);if(typeof r.maxItems==="number")u=u.max(r.maxItems);e=u}else e=P.array(P.any());break}default:throw Error(`Unsupported type: ${t}`)}return e}function x(r,i){if(typeof r==="boolean")return r?P.any():P.never();let t=l6(r,i),e=r.type||r.enum!==void 0||r.const!==void 0;if(r.anyOf&&Array.isArray(r.anyOf)){let u=r.anyOf.map((g)=>x(g,i)),l=P.union(u);t=e?P.intersection(t,l):l}if(r.oneOf&&Array.isArray(r.oneOf)){let u=r.oneOf.map((g)=>x(g,i)),l=P.xor(u);t=e?P.intersection(t,l):l}if(r.allOf&&Array.isArray(r.allOf))if(r.allOf.length===0)t=e?t:P.any();else{let u=e?t:x(r.allOf[0],i),l=e?0:1;for(let g=l;g<r.allOf.length;g++)u=P.intersection(u,x(r.allOf[g],i));t=u}if(r.nullable===!0&&i.version==="openapi-3.0")t=P.nullable(t);if(r.readOnly===!0)t=P.readonly(t);if(r.default!==void 0)t=t.default(r.default);let n={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let u of o)if(u in r)n[u]=r[u];let v=["contentEncoding","contentMediaType","contentSchema"];for(let u of v)if(u in r)n[u]=r[u];for(let u of Object.keys(r))if(!zU.has(u))n[u]=r[u];if(Object.keys(n).length>0)i.registry.add(t,n);if(r.description)t=t.describe(r.description);return t}function c6(r,i){if(typeof r==="boolean")return r?P.any():P.never();let t;try{t=JSON.parse(JSON.stringify(r))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let e=CU(t,i?.defaultTarget),n=t.$defs||t.definitions||{},o={version:e,defs:n,refs:new Map,processing:new Set,rootSchema:t,registry:i?.registry??M};return x(t,o)}var kl={};br(kl,{string:()=>hU,number:()=>yU,date:()=>sU,boolean:()=>aU,bigint:()=>pU});function hU(r){return F$(Sn,r)}function yU(r){return C$(mn,r)}function aU(r){return ru(Pn,r)}function pU(r){return iu(On,r)}function sU(r){return bu(oi,r)}B(Mn());var at=$;var I6=$.object({id:$.string(),temperature:$.number().optional(),isR1FormatRequired:$.boolean().optional(),maxTokens:$.number().optional(),contextWindow:$.number().optional(),inputPrice:$.number().optional(),outputPrice:$.number().optional(),supportsImages:$.boolean().optional()}),b6=$.object({models:$.array(I6).optional(),openAiBaseUrl:$.string().optional(),openAiHeaders:$.record($.string(),$.string()).optional(),azureApiVersion:$.string().optional(),azureIdentity:$.boolean().optional()}),_6=$.object({id:$.string(),thinkingBudgetTokens:$.number().optional()}),U6=$.object({name:$.string(),baseModelId:$.string(),thinkingBudgetTokens:$.number().optional()}),w6=$.object({models:$.array(_6).optional(),customModels:$.array(U6).optional(),awsRegion:$.string().optional(),awsUseCrossRegionInference:$.boolean().optional(),awsUseGlobalInference:$.boolean().optional(),awsBedrockUsePromptCache:$.boolean().optional(),awsBedrockEndpoint:$.string().optional()}),k6=$.object({id:$.string()}),D6=$.object({models:$.array(k6).optional()}),S6=$.object({id:$.string(),thinkingBudgetTokens:$.number().optional()}),N6=$.object({models:$.array(S6).optional(),vertexProjectId:$.string().optional(),vertexRegion:$.string().optional()}),m6=$.object({id:$.string(),thinkingBudgetTokens:$.number().optional(),promptCachingEnabled:$.boolean().optional()}),P6=$.object({models:$.array(m6).optional(),baseUrl:$.string().optional()}),O6=$.object({id:$.string(),thinkingBudgetTokens:$.number().optional()}),f6=$.object({models:$.array(O6).optional(),baseUrl:$.string().optional()}),rw=$.object({OpenAiCompatible:b6.optional(),AwsBedrock:w6.optional(),Cline:D6.optional(),Vertex:N6.optional(),LiteLLM:P6.optional(),Anthropic:f6.optional()}),E6=$.object({id:$.string()}),j6=$.object({name:$.string(),url:$.string(),alwaysEnabled:$.boolean().optional(),headers:$.record($.string(),$.string()).optional()}),Dl=$.object({alwaysEnabled:$.boolean(),name:$.string(),contents:$.string()}),pt=$.object({bucket:$.string(),accessKeyId:$.string(),secretAccessKey:$.string(),region:$.string().optional(),endpoint:$.string().optional(),accountId:$.string().optional()}),L6=$.object({enabled:$.boolean().optional(),type:$.union([$.literal("s3_access_keys"),$.literal("r2_access_keys"),$.literal("azure_access_keys")]).optional(),s3AccessSettings:pt.optional(),r2AccessSettings:pt.optional(),azureAccessSettings:pt.optional()}),A6=$.object({promptUploading:L6.optional()}),nw=$.object({version:$.string(),providerSettings:rw.optional(),telemetryEnabled:$.boolean().optional(),kanbanEnabled:$.boolean().optional(),mcpMarketplaceEnabled:$.boolean().optional(),allowedMCPServers:$.array(E6).optional(),remoteMCPServers:$.array(j6).optional(),blockPersonalRemoteMCPServers:$.boolean().optional(),yoloModeAllowed:$.boolean().optional(),openTelemetryEnabled:$.boolean().optional(),openTelemetryMetricsExporter:$.string().optional(),openTelemetryLogsExporter:$.string().optional(),openTelemetryOtlpProtocol:$.string().optional(),openTelemetryOtlpEndpoint:$.string().optional(),openTelemetryOtlpHeaders:$.record($.string(),$.string()).optional(),openTelemetryOtlpMetricsProtocol:$.string().optional(),openTelemetryOtlpMetricsEndpoint:$.string().optional(),openTelemetryOtlpMetricsHeaders:$.record($.string(),$.string()).optional(),openTelemetryOtlpLogsProtocol:$.string().optional(),openTelemetryOtlpLogsEndpoint:$.string().optional(),openTelemetryOtlpLogsHeaders:$.record($.string(),$.string()).optional(),openTelemetryMetricExportInterval:$.number().optional(),openTelemetryOtlpInsecure:$.boolean().optional(),openTelemetryLogBatchSize:$.number().optional(),openTelemetryLogBatchTimeout:$.number().optional(),openTelemetryLogMaxQueueSize:$.number().optional(),enterpriseTelemetry:A6.optional(),globalRules:$.array(Dl).optional(),globalWorkflows:$.array(Dl).optional()}),iw=$.record($.string(),$.string());var J6=$.enum(["default","openai-responses","r1"]),tw={DEFAULT:"default",OPENAI_RESPONSES:"openai-responses",R1:"r1"},G6=$.enum(["images","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),X6=$.enum(["active","preview","deprecated","legacy"]),W6=$.object({input:$.number().optional(),output:$.number().optional(),cacheWrite:$.number().optional(),cacheRead:$.number().optional()}),H6=$.object({maxBudget:$.number().optional(),outputPrice:$.number().optional(),thinkingLevel:$.enum(["low","high"]).optional()}),q6=$.object({reasoningDefaultOn:$.boolean().optional()}).catchall($.unknown()),st=$.object({id:$.string(),name:$.string().optional(),description:$.string().optional(),maxTokens:$.number().optional(),contextWindow:$.number().optional(),maxInputTokens:$.number().optional(),capabilities:$.array(G6).optional(),apiFormat:J6.optional(),systemRole:$.enum(["system","developer"]).optional(),temperature:$.number().optional(),pricing:W6.optional(),thinkingConfig:H6.optional(),status:X6.optional(),deprecationNotice:$.string().optional(),replacedBy:$.string().optional(),releaseDate:$.string().optional(),deprecationDate:$.string().optional(),family:$.string().optional(),metadata:q6.optional()});var Sl=$.object({id:$.string(),name:$.string(),input:$.unknown(),output:$.unknown(),error:$.string().optional(),durationMs:$.number(),startedAt:$.date(),endedAt:$.date()});var ow=$.enum(["completed","max_iterations","aborted","mistake_limit","error"]),ew=$.object({inputTokens:$.number(),outputTokens:$.number(),cacheReadTokens:$.number().optional(),cacheWriteTokens:$.number().optional(),totalCost:$.number().optional()}),Im=$.object({text:$.string(),usage:ew,messages:$.array($.custom()),toolCalls:$.array(Sl),iterations:$.number(),finishReason:ow,model:$.object({id:$.string(),provider:$.string(),info:st.optional()}),startedAt:$.date(),endedAt:$.date(),durationMs:$.number()}),vw=$.enum(["low","medium","high","xhigh"]),bm=$.object({sessionId:$.string().optional(),providerId:$.string(),modelId:$.string(),apiKey:$.string().optional(),baseUrl:$.string().url().optional(),headers:$.record($.string(),$.string()).optional(),knownModels:$.record($.string(),st).optional(),providerConfig:$.unknown().optional(),initialMessages:$.array($.custom()).optional(),systemPrompt:$.string(),tools:$.array($.custom()),maxIterations:$.number().positive().optional(),maxParallelToolCalls:$.number().int().positive().default(8),maxTokensPerTurn:$.number().positive().optional(),apiTimeoutMs:$.number().positive().default(180000),userFileContentLoader:$.function().input([$.string()]).output($.promise($.string())).optional(),toolContextMetadata:$.record($.string(),$.unknown()).optional(),execution:$.object({maxConsecutiveMistakes:$.number().int().positive().optional(),reminderAfterIterations:$.number().nonnegative().optional(),reminderText:$.string().optional(),loopDetection:$.union([$.literal(!1),$.object({softThreshold:$.number().int().positive().optional(),hardThreshold:$.number().int().positive().optional()})]).optional()}).optional(),reasoningEffort:vw.optional(),thinkingBudgetTokens:$.number().positive().optional(),thinking:$.boolean().optional(),onEvent:$.function().input([$.custom()]).output($.void()).optional(),hooks:$.custom().optional(),parentAgentId:$.string().optional(),extensions:$.array($.custom()).optional(),hookErrorMode:$.enum(["ignore","throw"]).default("ignore"),toolPolicies:$.record($.string(),$.object({enabled:$.boolean().optional(),autoApprove:$.boolean().optional()})).optional(),requestToolApproval:$.function().input([$.object({sessionId:$.string(),agentId:$.string(),conversationId:$.string(),iteration:$.number(),toolCallId:$.string(),toolName:$.string(),input:$.unknown(),policy:$.object({enabled:$.boolean().optional(),autoApprove:$.boolean().optional()}).default({})})]).output($.union([$.object({approved:$.boolean(),reason:$.string().optional()}),$.promise($.object({approved:$.boolean(),reason:$.string().optional()}))])).optional(),onConsecutiveMistakeLimitReached:$.function().input([$.object({iteration:$.number().int().positive(),consecutiveMistakes:$.number().int().positive(),maxConsecutiveMistakes:$.number().int().positive(),reason:$.enum(["api_error","invalid_tool_call","tool_execution_failed"]),details:$.string().optional()})]).output($.union([$.object({action:$.literal("continue"),guidance:$.string().optional()}),$.object({action:$.literal("stop"),reason:$.string().optional()}),$.promise($.union([$.object({action:$.literal("continue"),guidance:$.string().optional()}),$.object({action:$.literal("stop"),reason:$.string().optional()})]))])).optional(),logger:$.custom().optional(),extensionContext:$.custom().optional(),abortSignal:$.custom().optional()});var V6=$.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"]),d6=$.object({id:$.string().optional(),label:$.string().optional(),role:$.string().optional(),participantKey:$.string().optional(),participantLabel:$.string().optional(),platformUserId:$.string().optional(),metadata:$.record($.string(),$.unknown()).optional()}),Y6=$.object({source:$.string(),sourceEvent:$.string(),threadId:$.string(),channelId:$.string(),isDM:$.boolean(),sessionId:$.string().optional(),workspaceRoot:$.string().optional(),metadata:$.record($.string(),$.unknown()).optional()}),$w=$.object({actor:d6,context:Y6,payload:$.record($.string(),$.unknown()).optional()}),uw=$.object({action:$.enum(["allow","deny"]).default("allow"),message:$.string().optional(),reason:$.string().optional(),metadata:$.record($.string(),$.unknown()).optional()}),gw=$.object({adapter:$.string(),botUserName:$.string().optional(),event:V6,payload:$.record($.string(),$.unknown()),ts:$.string()});var R6=[];function Nl(r){R6.push(r)}async function lw(){let r=R6.splice(0);await Promise.all(r.map((i)=>{try{return(typeof i==="function"?i():i.dispose())??Promise.resolve()}catch{return Promise.resolve()}}))}var cw=["hooks","tools","commands","rules","messageBuilders","providers","automationEvents"],Iw=new Set(cw);function Q6(r,i){return r.name||`extension_${String(i).padStart(4,"0")}`}function F6(r){return Array.isArray(r)&&r.every((i)=>typeof i==="string")}function B6(r){if(!Array.isArray(r))return;let i=r.filter((t)=>typeof t==="string").map((t)=>t.trim()).filter((t)=>t.length>0);return i.length>0?i:void 0}function K6(r){let i=B6(r.providerIds),t=B6(r.modelIds);return{...r,...i?{providerIds:i}:{},...t?{modelIds:t}:{}}}function bw(r,i){let t=Q6(r,i),e=r.manifest;if(!e||typeof e!=="object")throw Error(`Invalid manifest for extension "${t}": manifest is required`);if(!Array.isArray(e.capabilities)||e.capabilities.length===0)throw Error(`Invalid manifest for extension "${t}": capabilities must be a non-empty array`);let n=new Set;for(let u of e.capabilities){if(!Iw.has(u))throw Error(`Invalid manifest for extension "${t}": unsupported capability "${String(u)}"`);n.add(u)}if(Object.hasOwn(e,"providerIds")&&!F6(e.providerIds))throw Error(`Invalid manifest for extension "${t}": providerIds must be a string array when provided`);if(Object.hasOwn(e,"modelIds")&&!F6(e.modelIds))throw Error(`Invalid manifest for extension "${t}": modelIds must be a string array when provided`);let o=n.has("hooks");if(r.hooks!==void 0&&!o)throw Error(`Invalid manifest for extension "${t}": runtime hooks require the "hooks" capability`);return{capabilities:n,raw:K6(e)}}function _w(r,i){if(!r||typeof r!=="object")throw Error(`Invalid automation event contribution for extension "${i}": expected object`);let t=typeof r.eventType==="string"?r.eventType.trim():"",e=typeof r.source==="string"?r.source.trim():"";if(!t)throw Error(`Invalid automation event contribution for extension "${i}": eventType is required`);if(!e)throw Error(`Invalid automation event contribution for extension "${i}": source is required`);return{...r,eventType:t,source:e,examples:r.examples?[...r.examples]:void 0,metadata:r.metadata?{...r.metadata}:void 0}}class ml{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[]};normalized=[];phase="resolve";setupContext;constructor(r={}){this.extensions=r.extensions??[],this.setupContext=r.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((r,i)=>({extension:r,order:i,manifest:{capabilities:new Set,raw:r.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((r)=>({...r,manifest:bw(r.extension,r.order)})),this.phase="setup"}async setup(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;for(let r of this.normalized){let{extension:i}=r;if(i.disabled)continue;let t=Q6(i,r.order),e={registerTool:(o)=>this.registry.tools.push(o),registerCommand:(o)=>this.registry.commands.push(o),registerRule:(o)=>{if(!r.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${t}": registerRule requires the "rules" capability`);this.registry.rules.push(o)},registerMessageBuilder:(o)=>this.registry.messageBuilder.push(o),registerProvider:(o)=>this.registry.providers.push(o),registerAutomationEventType:(o)=>{if(!r.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${t}": registerAutomationEventType requires the "automationEvents" capability`);this.registry.automationEventTypes.push(_w(o,t))}},n=r.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};await i.setup?.(e,n)}this.phase="activate"}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(),await this.setup(),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]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((r,i)=>r.order-i.order).map(({extension:r})=>r)}}function Uw(r={}){return new ml(r)}var ww=[".js",".ts"];var T6=$.enum(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),Tr=$.record($.string(),$.string()),kw=$.object({toolName:$.string(),parameters:Tr}),Dw=$.object({toolName:$.string(),parameters:Tr,result:$.string(),success:$.boolean(),executionTimeMs:$.number()}),Sw=$.object({prompt:$.string(),attachments:$.array($.string())}),Nw=$.object({taskMetadata:Tr}),mw=$.object({taskMetadata:Tr,previousState:Tr}),Pw=$.object({taskMetadata:Tr}),Ow=$.object({taskMetadata:Tr}),fw=$.object({taskId:$.string(),ulid:$.string(),contextSize:$.number(),compactionStrategy:$.string(),previousApiReqIndex:$.number(),tokensIn:$.number(),tokensOut:$.number(),tokensInCache:$.number(),tokensOutCache:$.number(),deletedRangeStart:$.number(),deletedRangeEnd:$.number(),contextJsonPath:$.string(),contextRawPath:$.string()}),M6=$.object({clineVersion:$.string(),hookName:T6,timestamp:$.string(),taskId:$.string(),sessionContext:$.object({rootSessionId:$.string().optional(),hookLogPath:$.string().optional()}).optional(),workspaceRoots:$.array($.string()),workspaceInfo:$.custom().optional(),userId:$.string(),agent_id:$.string(),parent_agent_id:$.string().nullable(),iteration:$.number().optional(),reason:$.string().optional(),tool_call:$.object({id:$.string(),name:$.string(),input:$.unknown()}).optional(),tool_result:$.custom().optional(),turn:$.unknown().optional(),error:$.object({name:$.string(),message:$.string(),stack:$.string().optional()}).optional(),preToolUse:kw.optional(),postToolUse:Dw.optional(),userPromptSubmit:Sw.optional(),taskStart:Nw.optional(),taskResume:mw.optional(),taskCancel:Pw.optional(),taskComplete:Ow.optional(),preCompact:fw.optional()}).passthrough();function Ew(r){let i=M6.safeParse(r);if(!i.success)return;return i.data}var fm=30000,Em=5000;function jw(r){switch(r){case"run.start":case"session.send_input":return null;default:return 30000}}function jm(r,i){return i===void 0?jw(r):i}var Lw=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],Aw=new Set(Lw);function Lm(r){return typeof r==="string"&&Aw.has(r)}var Am="tool_executor.",Jm="custom_tool.",Gm="hook.",Xm="compaction.compact",Wm="checkpoint.create",Hm="mistake_limit.decide",qm="user_instructions.snapshot";function Pl(r,i){return`<file_content path="${r}">
77
77
  ${i}
78
- </file_content>`}function Jw(r,i="act"){return`<user_input mode="${i}">${r}</user_input>`}function Gw(r,i){return`<user_command slash="${i}">${r}</user_command>`}function Xw(r,i){let t=r.trim(),e=new RegExp(`^<${i}\\b([^>]*)>([\\s\\S]*?)<\\/${i}>$`,"i").exec(t);if(!e)return;return{attrs:e[1]??"",content:e[2]??""}}function Ww(r,i){return new RegExp(`${i}="([^"]+)"`,"i").exec(r)?.[1]?.trim()||void 0}function x6(r){if(!r?.trim())return;let i=Xw(r,"user_command");if(!i)return;let t=Ww(i.attrs,"slash");if(!t)return;return{slash:t,content:i.content.trim()}}function z6(r){if(!r?.trim())return"";let i=r.trim();for(let t of["user_input","user_command"]){let e=C6(i,t);i=(e!==i?e:i.replace(new RegExp(`<${t}[^>]*>`,"g"),"")).trim()}return i}function Hw(r){let i=z6(r),t=x6(r);if(!t)return i;if(t.slash.toLowerCase()==="team"){let n=i.toLowerCase().startsWith("spawn a team of agents for the following task:")?i.slice(46).trim():i;return n?`/team ${n}`:"/team"}return i?`/${t.slash} ${i}`:`/${t.slash}`}function C6(r,i){if(!r?.trim())return"";if(!i)return r;let t=new RegExp(`<${i}\\b[^>]*>([\\s\\S]*?)</${i}>`,"g");return r.replace(t,"$1")}function er(r){return r.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}function Z6(r,i){let t=r[r.length-1];if(i.role==="tool"&&t?.role==="tool"&&Array.isArray(t.content)&&Array.isArray(i.content)){t.content.push(...i.content);return}r.push(i)}function qw(r){if(!Array.isArray(r)||r.length===0)return!1;return r.every((i)=>{if(!i||typeof i!=="object")return!1;let t=i;if(t.type==="text")return typeof t.text==="string";if(t.type==="image")return typeof t.data==="string"&&typeof t.mediaType==="string";return!1})}function Ol(r,i){if(r==null||typeof r!=="object")return r;if(Array.isArray(r)){let n=[];for(let o of r){if(o&&typeof o==="object"){let v=o;if(v.type==="image"&&typeof v.data==="string"&&typeof v.mediaType==="string"){i.push({type:"image",data:v.data,mediaType:v.mediaType});continue}if(v.type==="text"&&typeof v.text==="string"){n.push(v.text);continue}}n.push(Ol(o,i))}return n}let t=r,e={};for(let[n,o]of Object.entries(t))e[n]=Ol(o,i);return e}function ro(r){if(typeof r==="string")return er(r);if(Array.isArray(r))return r.map((i)=>ro(i));if(r!==null&&typeof r==="object"){let i=r,t={};for(let[e,n]of Object.entries(i))t[e]=ro(n);return t}return r}function h6(r,i=!1){if(typeof r==="string")return{type:i?"error-text":"text",value:er(r)};if(!i&&qw(r))return{type:"content",value:r.map((t)=>t.type==="image"?{type:"image-data",data:t.data,mediaType:t.mediaType}:{type:"text",text:er(t.text)})};if(!i&&r!==null&&typeof r==="object"){let t=[],e=Ol(r,t);if(t.length>0)return{type:"content",value:[{type:"text",text:typeof e==="string"?er(e):JSON.stringify(ro(e))},...t.map((o)=>({type:"image-data",data:o.data,mediaType:o.mediaType}))]}}if(r===null||typeof r==="boolean"||typeof r==="number"||typeof r==="object")return{type:i?"error-json":"json",value:ro(r)};return{type:i?"error-text":"text",value:er(String(r))}}function Vw(r,i,t){let e=t?.assistantToolCallArgKey??"input",n=[];if(typeof r==="string"&&r.trim().length>0||Array.isArray(r)&&r.length>0)n.push({role:"system",content:typeof r==="string"?er(r):r});for(let o of i){let v=o.content;if(typeof v==="string"){n.push({role:o.role,content:er(v)});continue}let u=[],l=[];for(let g of v)switch(g.type){case"text":u.push({type:"text",text:er(g.text),...g.providerOptions?{providerOptions:g.providerOptions}:{}});break;case"reasoning":u.push({type:"reasoning",text:er(g.text),...g.providerOptions?{providerOptions:g.providerOptions}:{}});break;case"image":u.push({type:"image",image:g.image,mediaType:g.mediaType});break;case"file":u.push({type:"text",text:Pl(g.path,er(g.content))});break;case"tool-call":if(o.role==="assistant")u.push({type:"tool-call",toolCallId:g.toolCallId,toolName:g.toolName,[e]:g.input,...g.providerOptions?{providerOptions:g.providerOptions}:{}});break;case"tool-result":l.push({type:"tool-result",toolCallId:g.toolCallId,toolName:g.toolName,output:h6(g.output,g.isError??!1)});break}if(u.length>0)Z6(n,{role:o.role,content:u});if(l.length>0)Z6(n,{role:"tool",content:l})}return n}var ci={xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},dw=void 0;function Yw(r,i){if(typeof r==="string"&&r.toLowerCase()in ci)return r.toLowerCase();return i?void 0:void 0}function y6(r,i){let t=typeof r==="string"?r.toLowerCase():void 0;if(t&&t in ci)return ci[t];if(i?.fallbackEffort)return ci[i.fallbackEffort];return}function Rw(r){let i=y6(r.effort,{fallbackEffort:r.fallbackEffort});if(i===void 0)return;if(i<=0)return 0;let t=r.minimumBudget??1;if(r.maxBudget<t)return;let e=r.scaleTokens??r.maxBudget;return Math.min(Math.max(Math.floor(e*i),t),r.maxBudget)}var Fw={"HTTP-Referer":"https://cline.bot","X-Title":"Cline","X-IS-MULTIROOT":"false","X-CLIENT-TYPE":"cline-sdk"};function Bw(r){return r instanceof Error?{name:r.name,message:r.message}:r}function Qw(r){return Math.max(1,Math.ceil(r/3))}var Kw={debug:()=>{},log:()=>{},error:()=>{}};class Ar extends Error{constructor(r,i){super(`${r} at position ${i}`);this.position=i}}function a6(r){return/^[0-9A-Fa-f]$/.test(r)}function Gr(r){return r>="0"&&r<="9"}function p6(r){return r>=" "}function Ii(r){return`,:[]/{}()
78
+ </file_content>`}function Jw(r,i="act"){return`<user_input mode="${i}">${r}</user_input>`}function Gw(r,i){return`<user_command slash="${i}">${r}</user_command>`}function Xw(r,i){let t=r.trim(),e=new RegExp(`^<${i}\\b([^>]*)>([\\s\\S]*?)<\\/${i}>$`,"i").exec(t);if(!e)return;return{attrs:e[1]??"",content:e[2]??""}}function Ww(r,i){return new RegExp(`${i}="([^"]+)"`,"i").exec(r)?.[1]?.trim()||void 0}function x6(r){if(!r?.trim())return;let i=Xw(r,"user_command");if(!i)return;let t=Ww(i.attrs,"slash");if(!t)return;return{slash:t,content:i.content.trim()}}function z6(r){if(!r?.trim())return"";let i=r.trim();for(let t of["user_input","user_command"]){let e=C6(i,t);i=(e!==i?e:i.replace(new RegExp(`<${t}[^>]*>`,"g"),"")).trim()}return i}function Hw(r){let i=z6(r),t=x6(r);if(!t)return i;if(t.slash.toLowerCase()==="team"){let n=i.toLowerCase().startsWith("spawn a team of agents for the following task:")?i.slice(46).trim():i;return n?`/team ${n}`:"/team"}return i?`/${t.slash} ${i}`:`/${t.slash}`}function C6(r,i){if(!r?.trim())return"";if(!i)return r;let t=new RegExp(`<${i}\\b[^>]*>([\\s\\S]*?)</${i}>`,"g");return r.replace(t,"$1")}function er(r){return r.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"�")}function Z6(r,i){let t=r[r.length-1];if(i.role==="tool"&&t?.role==="tool"&&Array.isArray(t.content)&&Array.isArray(i.content)){t.content.push(...i.content);return}r.push(i)}function qw(r){if(!Array.isArray(r)||r.length===0)return!1;return r.every((i)=>{if(!i||typeof i!=="object")return!1;let t=i;if(t.type==="text")return typeof t.text==="string";if(t.type==="image")return typeof t.data==="string"&&typeof t.mediaType==="string";return!1})}function Ol(r,i){if(r==null||typeof r!=="object")return r;if(Array.isArray(r)){let n=[];for(let o of r){if(o&&typeof o==="object"){let v=o;if(v.type==="image"&&typeof v.data==="string"&&typeof v.mediaType==="string"){i.push({type:"image",data:v.data,mediaType:v.mediaType});continue}if(v.type==="text"&&typeof v.text==="string"){n.push(v.text);continue}}n.push(Ol(o,i))}return n}let t=r,e={};for(let[n,o]of Object.entries(t))e[n]=Ol(o,i);return e}function ro(r){if(typeof r==="string")return er(r);if(Array.isArray(r))return r.map((i)=>ro(i));if(r!==null&&typeof r==="object"){let i=r,t={};for(let[e,n]of Object.entries(i))t[e]=ro(n);return t}return r}function h6(r,i=!1){if(typeof r==="string")return{type:i?"error-text":"text",value:er(r)};if(!i&&qw(r))return{type:"content",value:r.map((t)=>t.type==="image"?{type:"image-data",data:t.data,mediaType:t.mediaType}:{type:"text",text:er(t.text)})};if(!i&&r!==null&&typeof r==="object"){let t=[],e=Ol(r,t);if(t.length>0)return{type:"content",value:[{type:"text",text:typeof e==="string"?er(e):JSON.stringify(ro(e))},...t.map((o)=>({type:"image-data",data:o.data,mediaType:o.mediaType}))]}}if(r===null||typeof r==="boolean"||typeof r==="number"||typeof r==="object")return{type:i?"error-json":"json",value:ro(r)};return{type:i?"error-text":"text",value:er(String(r))}}function Vw(r,i,t){let e=t?.assistantToolCallArgKey??"input",n=[];if(typeof r==="string"&&r.trim().length>0||Array.isArray(r)&&r.length>0)n.push({role:"system",content:typeof r==="string"?er(r):r});for(let o of i){let v=o.content;if(typeof v==="string"){n.push({role:o.role,content:er(v)});continue}let u=[],l=[];for(let g of v)switch(g.type){case"text":u.push({type:"text",text:er(g.text),...g.providerOptions?{providerOptions:g.providerOptions}:{}});break;case"reasoning":u.push({type:"reasoning",text:er(g.text),...g.providerOptions?{providerOptions:g.providerOptions}:{}});break;case"image":u.push({type:"image",image:g.image,mediaType:g.mediaType});break;case"file":u.push({type:"text",text:Pl(g.path,er(g.content))});break;case"tool-call":if(o.role==="assistant")u.push({type:"tool-call",toolCallId:g.toolCallId,toolName:g.toolName,[e]:g.input,...g.providerOptions?{providerOptions:g.providerOptions}:{}});break;case"tool-result":{l.push({type:"tool-result",toolCallId:g.toolCallId,toolName:g.toolName,output:h6(g.output,g.isError??!1)});break}}if(u.length>0)Z6(n,{role:o.role,content:u});if(l.length>0)Z6(n,{role:"tool",content:l})}return n}var ci={xhigh:0.95,high:0.8,medium:0.5,low:0.2,minimal:0.1,none:0},dw=void 0;function Yw(r,i){if(typeof r==="string"&&r.toLowerCase()in ci)return r.toLowerCase();return i?void 0:void 0}function y6(r,i){let t=typeof r==="string"?r.toLowerCase():void 0;if(t&&t in ci)return ci[t];if(i?.fallbackEffort)return ci[i.fallbackEffort];return}function Rw(r){let i=y6(r.effort,{fallbackEffort:r.fallbackEffort});if(i===void 0)return;if(i<=0)return 0;let t=r.minimumBudget??1;if(r.maxBudget<t)return;let e=r.scaleTokens??r.maxBudget;return Math.min(Math.max(Math.floor(e*i),t),r.maxBudget)}var Fw={"HTTP-Referer":"https://cline.bot","X-Title":"Cline","X-IS-MULTIROOT":"false","X-CLIENT-TYPE":"cline-sdk"};function Bw(r){return r instanceof Error?{name:r.name,message:r.message}:r}function Qw(r){return Math.max(1,Math.ceil(r/3))}var Kw={debug:()=>{},log:()=>{},error:()=>{}};class Ar extends Error{constructor(r,i){super(`${r} at position ${i}`);this.position=i}}function a6(r){return/^[0-9A-Fa-f]$/.test(r)}function Gr(r){return r>="0"&&r<="9"}function p6(r){return r>=" "}function Ii(r){return`,:[]/{}()
79
79
  +`.includes(r)}function fl(r){return r>="a"&&r<="z"||r>="A"&&r<="Z"||r==="_"||r==="$"}function El(r){return r>="a"&&r<="z"||r>="A"&&r<="Z"||r==="_"||r==="$"||r>="0"&&r<="9"}var jl=/^(http|https|ftp|mailto|file|data|irc):\/\/$/,Ll=/^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;function Al(r){return`,[]/{}
80
80
  +`.includes(r)}function Jl(r){return bi(r)||Tw.test(r)}var Tw=/^[[{\w-]$/;function s6(r){return r===`
81
81
  `||r==="\r"||r==="\t"||r==="\b"||r==="\f"}function Jr(r,i){let t=r.charCodeAt(i);return t===32||t===10||t===9||t===13}function r4(r,i){let t=r.charCodeAt(i);return t===32||t===9||t===13}function n4(r,i){let t=r.charCodeAt(i);return t===160||t===6158||t>=8192&&t<=8203||t===8239||t===8287||t===12288||t===65279}function bi(r){return Gl(r)||no(r)}function Gl(r){return r==='"'||r==="“"||r==="”"}function Xl(r){return r==='"'}function no(r){return r==="'"||r==="‘"||r==="’"||r==="`"||r==="´"}function Wl(r){return r==="'"}function fn(r,i){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,e=r.lastIndexOf(i);return e!==-1?r.substring(0,e)+(t?"":r.substring(e+1)):r}function tr(r,i){let t=r.length;if(!Jr(r,t-1))return r+i;while(Jr(r,t-1))t--;return r.substring(0,t)+i+r.substring(t)}function i4(r,i,t){return r.substring(0,i)+r.substring(i+t)}function t4(r){return/[,\n][ \t\r]*$/.test(r)}var Mw={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},xw={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
@@ -61,6 +61,8 @@ export interface ToolResultContent {
61
61
  type: "tool_result";
62
62
  /** ID of the tool call this is responding to */
63
63
  tool_use_id: string;
64
+ /** Name of the tool that generated this result */
65
+ name: string;
64
66
  /** Result content (can be text or error) */
65
67
  content: string | Array<TextContent | ImageContent | FileContent>;
66
68
  /** Whether this result represents an error */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cline/shared",
3
- "version": "0.0.41-nightly.1779419821",
3
+ "version": "0.0.42",
4
4
  "description": "Shared utilities, types, and schemas for Cline packages",
5
5
  "repository": {
6
6
  "type": "git",