@cline/shared 0.0.91 → 0.0.92-nightly.1791599808
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db/index.js +5 -5
- package/dist/index.browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/providers/defaults.d.ts +6 -2
- package/dist/storage/index.js +1 -1
- package/package.json +1 -1
package/dist/db/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as sn,readFileSync as on,renameSync as cn}from"node:fs";import{appendFileSync as ge,existsSync as u,mkdirSync as M,readdirSync as de,readFileSync as J,statSync as S}from"node:fs";import{homedir as Te}from"node:os";import{basename as _e,dirname as O,extname as fe,isAbsolute as Ne,join as o,relative as Ce,resolve as g}from"node:path";var v="workspaces",b="chat";function Ee(e){let n=e.trim(),t=/^[A-Za-z]:[\\/]/.test(n)||n.startsWith("\\\\"),r=n.startsWith("/");if(!t&&!r)return!1;let s=n.split(t?/[\\/]+/:/\/+/).filter(Boolean),i=s.at(-1)??"",c=s.at(-2)??"",a=s.at(-3)??"";return(s.at(-4)??"")===".cline"&&a==="data"&&c==="workspaces"&&i==="chat"}var X=".clinerules",h=".cline",Re=".claude",I=".agents",Se=I,Q="agents",y="hooks",P="skills",V="rules",k="workflows",w="plugins",z="AGENTS.md",Le="plugin.json";function _n(){return o(p(),v,b)}var De="cline_mcp_settings.json",Ae="settings.json";function me(){let e=process?.env?.HOME?.trim();if(e&&e!=="~")return e;let n=process?.env?.USERPROFILE?.trim();if(n)return n;let t=process?.env?.HOMEDRIVE?.trim(),r=process?.env?.HOMEPATH?.trim();if(t&&r)return`${t}${r}`;let s=Te().trim();if(s&&s!=="~")return s;return"~"}var d=me(),Z=!1;function fn(e){let n=e.trim();if(!n)return;d=n,Z=!0}function Nn(e){if(Z)return;let n=e.trim();if(!n)return;d=n}var A,ee=!1;function Cn(e){let n=e.trim();if(!n)return;A=n,ee=!0}function Rn(e){if(ee)return;let n=e.trim();if(!n)return;A=n}function l(){if(A)return A;let e=process.env.CLINE_DIR?.trim();if(e)return e;return o(d,".cline")}function Oe(){return o(d,"Documents","Cline")}function x(e){return o(Oe(),e)}function p(){let e=process.env.CLINE_DATA_DIR?.trim();if(e)return e;return o(l(),"data")}function Sn(){let e=process.env.CLINE_SESSION_DATA_DIR?.trim();if(e)return e;return o(p(),"sessions")}function Ln(){let e=process.env.CLINE_TEAM_DATA_DIR?.trim();if(e)return e;return o(p(),"teams")}function he(){let e=process.env.CLINE_CONNECTOR_DATA_DIR?.trim();if(e)return e;return o(p(),"connectors")}function Dn(e,n){let t=e.replace(/[^a-zA-Z0-9._-]+/g,"_"),r=n.replace(/[^a-zA-Z0-9._-]+/g,"_");return o(p(),"logs","connectors",t,`${r}.log`)}function ne(){let e=process.env.CLINE_CONNECTOR_SETTINGS_PATH?.trim();if(e)return e;return o(he(),Ae)}function G(){let e=process.env.CLINE_DB_DATA_DIR?.trim();if(e)return e;return o(p(),"db")}function te(){let e=process.env.CLINE_CONNECTORS_DB_PATH?.trim();if(e)return e;return o(G(),"connectors.db")}function An(){let e=process.env.CLINE_CRON_DB_PATH?.trim();if(e)return e;return o(G(),"cron.db")}function mn(){let e=process.env.CLINE_TASKS_DB_PATH?.trim();if(e)return e;return o(G(),"tasks.db")}function On(){return o(l(),"schedules")}function Ie(){return o(l(),"tasks")}function xe(e){let n=e.trim();if(!n)throw Error("workspaceRoot is required for workspace task scope");return o(n,".cline","tasks")}function hn(e){let n=e.taskSpecsDir?.trim();if(n)return n;if(e.scope==="workspace")return xe(e.workspaceRoot??"");return Ie()}function ve(){return o(l(),"cron")}function K(e){return o(e,".cline","cron")}function re(e){if(typeof e==="string")return K(e);if(e?.cronSpecsDir?.trim())return e.cronSpecsDir.trim();if(e?.scope==="workspace"){let n=e.workspaceRoot?.trim();if(!n)throw Error("workspaceRoot is required for workspace cron scope");return K(n)}return ve()}function In(e){return o(re(e),"reports")}function xn(e){return o(re(e),"events")}function vn(){let e=process.env.CLINE_PROVIDER_SETTINGS_PATH?.trim();if(e)return e;return o(p(),"settings","providers.json")}function bn(){let e=process.env.CLINE_GLOBAL_SETTINGS_PATH?.trim();if(e)return e;return o(p(),"settings","global-settings.json")}function yn(){let e=process.env.CLINE_MCP_SETTINGS_PATH?.trim();if(e)return e;return o(p(),"settings",De)}function N(e){let n=new Set,t=[];for(let r of e){if(!r||n.has(r))continue;n.add(r),t.push(r)}return t}function be(e){if(!e)return[];return[X,h,Re,I].map((n)=>o(e,n,P))}function ye(){return o(l(),Q)}function kn(e){return N([e?o(e,h,Q):"",ye()])}function Pn(e){let n=[x("Hooks"),o(l(),y)];if(e)n.push(o(e,X,y),o(e,h,y));return N(n)}function wn(e){return N([...be(e),o(l(),P),o(d,I,P)])}function ke(){return o(d,I,z)}function Pe(e){return[o(e,X),o(e,h,V)]}function we(){let e=[];for(let n of["OneDrive","OneDriveConsumer","OneDriveCommercial"]){let t=process.env[n]?.trim();if(t)e.push(o(t,"Documents"))}return e}function Ue(){return N([o(l(),V),o(d,"Cline","Rules"),x("Rules"),...we().map((e)=>o(e,"Cline","Rules"))])}function Un(e){let n=e?Pe(e):[],t=e?[o(e,z)]:[];return N([...t,...n,ke(),...Ue()])}function Mn(e){return N([e?o(e,".clinerules",k):"",x("Workflows"),o(l(),k),e?o(e,".cline",k):""])}function Xn(e){return N([e?o(e,".cline",w):"",o(l(),w),x("Plugins")])}function Gn(){return[o(d,Se,w)]}var se=new Set([".js",".ts"]),F="package.json",Me=["index.ts","index.js"],Xe=new Set(["node_modules"]);function U(e){try{return S(o(e,Le)).isFile()}catch{return!1}}function m(e){let n=e.lastIndexOf(".");if(n===-1)return!1;return se.has(e.slice(n))}function oe(e){try{let n=JSON.parse(J(e,"utf8"));if(!n.cline||typeof n.cline!=="object")return null;return n.cline}catch{return null}}function ie(e){let n=e?.plugins;if(!Array.isArray(n))return[];return n.flatMap((t)=>t.paths??[])}function Ge(e){let n=g(e);if(!u(n)||!S(n).isDirectory())return null;if(U(n))return null;let t=o(n,F);if(u(t)){let r=oe(t),s=ie(r).map((i)=>g(n,i)).filter((i)=>u(i)&&S(i).isFile()&&m(i));if(s.length>0)return s}for(let r of Me){let s=o(n,r);if(u(s)&&S(s).isFile())return[s]}return null}function Fe(e){try{let n=JSON.parse(J(e,"utf8"));return typeof n.name==="string"&&n.name.trim()?n.name.trim():void 0}catch{return}}function qe(e,n){let t=Ce(g(e),g(n));return t===""||!t.startsWith("..")&&!Ne(t)}function Fn(e,n){let t=O(e),r=g(n);while(qe(r,t)){let s=o(t,F);if(u(s)){let c=Fe(s);if(c)return c;break}let i=g(t,"..");if(i===t)break;t=i}return _e(e,fe(e))}function Ye(e){let n=g(e);if(!u(n))return[];if(U(n))return[];let t=[],r=[n];while(r.length>0){let s=r.pop();if(!s)continue;let i;try{i=de(s,{withFileTypes:!0})}catch{continue}for(let c of i){let a=o(s,c.name);if(c.isDirectory()){if(U(a))continue;if(Xe.has(c.name)||c.name.startsWith("."))continue;let _=o(a,F);if(u(_)){let f=oe(_),H=ie(f).map((L)=>g(a,L)).filter((L)=>u(L)&&S(L).isFile()&&m(L));if(H.length>0){t.push(...H);continue}}r.push(a);continue}if(c.name.startsWith("."))continue;if(c.isFile()&&m(a))t.push(a)}}return t.sort((s,i)=>s.localeCompare(i))}function qn(e,n){let t=[];for(let r of e){let s=r.trim();if(!s)continue;let i=g(n,s);if(!u(i))throw Error(`Plugin path does not exist: ${i}`);if(S(i).isDirectory()){let a=Ge(i);if(a){t.push(...a);continue}t.push(...Ye(i));continue}if(!m(i))throw Error(`Plugin file must use a supported extension (${[...se].join(", ")}): ${i}`);t.push(i)}return t}function je(e){let n=O(e);if(!u(n))M(n,{recursive:!0})}function Yn(e){M(O(e),{recursive:!0}),ge(e,"")}function jn(e){if(e?.trim())return je(e),O(e);let n=o(p(),"logs");if(!u(n))M(n,{recursive:!0});return n}import{mkdirSync as Be}from"node:fs";import{createRequire as We}from"node:module";import{dirname as He}from"node:path";function ce(e){if(e instanceof Error)return e.message;return String(e)}function ae(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return""}var Ke=3,Je=50;function C(){return new Date().toISOString()}function D(e){return e?1:0}function E(e){return typeof e==="string"?e:""}function q(e){if(typeof e!=="string")return;let n=e.trim();return n.length>0?n:void 0}function $e(e){return e===1||e===!0}function Qe(e){if(e<=0)return;try{let n=new SharedArrayBuffer(4),t=new Int32Array(n);Atomics.wait(t,0,0,e)}catch{}}function Ve(e){if(!e||typeof e!=="object")return!1;let n=ce(e),t=ae(e);return t==="SQLITE_BUSY"||t==="SQLITE_LOCKED"||n.includes("SQLITE_BUSY")||n.includes("SQLITE_LOCKED")||n.includes("database is locked")}function T(e){let n=0;for(;;)try{return e()}catch(t){if(!Ve(t)||n>=Ke)throw t;n+=1,Qe(Je*2**(n-1))}}function ze(e){return{prepare:(n)=>{let t=e.query(n);return{run:(...r)=>T(()=>t.run(...r)),get:(...r)=>T(()=>t.get(...r)),all:(...r)=>T(()=>t.all(...r))}},exec:(n)=>T(()=>e.exec(n)),close:()=>e.close?.()}}function Ze(e){return{prepare:(n)=>{let t=e.prepare(n);return{run:(...r)=>T(()=>t.run(...r)),get:(...r)=>T(()=>t.get(...r)??null),all:(...r)=>T(()=>t.all(...r))}},exec:(n)=>T(()=>e.exec(n)),close:()=>e.close?.()}}function Y(e){Be(He(e),{recursive:!0});let n=We(import.meta.url);if(typeof globalThis.Bun<"u"){let{Database:r}=n("bun:sqlite");return ze(new r(e,{create:!0}))}let t=process.emitWarning;process.emitWarning=(r,...s)=>{if((typeof r==="string"?r:r?.message??"").includes("SQLite"))return;return t.call(process,r,...s)};try{let{DatabaseSync:r}=n(["node",":sqlite"].join(""));return Ze(new r(e))}finally{process.emitWarning=t}}var en=[`CREATE TABLE IF NOT EXISTS sessions (
|
|
2
2
|
session_id TEXT PRIMARY KEY,
|
|
3
3
|
source TEXT NOT NULL,
|
|
4
4
|
pid INTEGER NOT NULL,
|
|
@@ -77,7 +77,7 @@ import{existsSync as rn,readFileSync as sn,renameSync as on}from"node:fs";import
|
|
|
77
77
|
FOREIGN KEY (session_id) REFERENCES sessions(session_id) ON DELETE SET NULL
|
|
78
78
|
);`,`CREATE INDEX IF NOT EXISTS idx_schedule_executions_schedule
|
|
79
79
|
ON schedule_executions(schedule_id, triggered_at DESC);`,`CREATE INDEX IF NOT EXISTS idx_schedules_next_run
|
|
80
|
-
ON schedules(enabled, next_run_at);`],
|
|
80
|
+
ON schedules(enabled, next_run_at);`],nn=[{table:"sessions",column:"workspace_root",sql:"ALTER TABLE sessions ADD COLUMN workspace_root TEXT;"},{table:"sessions",column:"parent_session_id",sql:"ALTER TABLE sessions ADD COLUMN parent_session_id TEXT;"},{table:"sessions",column:"parent_agent_id",sql:"ALTER TABLE sessions ADD COLUMN parent_agent_id TEXT;"},{table:"sessions",column:"agent_id",sql:"ALTER TABLE sessions ADD COLUMN agent_id TEXT;"},{table:"sessions",column:"conversation_id",sql:"ALTER TABLE sessions ADD COLUMN conversation_id TEXT;"},{table:"sessions",column:"is_subagent",sql:"ALTER TABLE sessions ADD COLUMN is_subagent INTEGER NOT NULL DEFAULT 0;"},{table:"sessions",column:"messages_path",sql:"ALTER TABLE sessions ADD COLUMN messages_path TEXT;"},{table:"sessions",column:"metadata_json",sql:"ALTER TABLE sessions ADD COLUMN metadata_json TEXT;"},{table:"sessions",column:"transcript_path",sql:"ALTER TABLE sessions ADD COLUMN transcript_path TEXT NOT NULL DEFAULT '';"},{table:"schedules",column:"claim_token",sql:"ALTER TABLE schedules ADD COLUMN claim_token TEXT;"},{table:"schedules",column:"claim_started_at",sql:"ALTER TABLE schedules ADD COLUMN claim_started_at TEXT;"},{table:"schedules",column:"claim_until_at",sql:"ALTER TABLE schedules ADD COLUMN claim_until_at TEXT;"}];function tn(e,n){return new Set(e.prepare(`PRAGMA table_info(${n});`).all().map((t)=>t.name))}function rn(e,n={}){e.exec("PRAGMA journal_mode = WAL;"),e.exec("PRAGMA busy_timeout = 5000;");for(let s of en)e.exec(s);if(!n.includeLegacyMigrations)return;let t=new Map,r=(s)=>{let i=t.get(s);if(!i)i=tn(e,s),t.set(s,i);return i};for(let s of nn)if(!r(s.table).has(s.column)){if(e.exec(s.sql),s.column==="workspace_root")e.exec("UPDATE sessions SET workspace_root = cwd WHERE workspace_root IS NULL OR workspace_root = '';");t.delete(s.table)}}var an=`CREATE TABLE IF NOT EXISTS connector_configs (
|
|
81
81
|
channel TEXT PRIMARY KEY,
|
|
82
82
|
type TEXT NOT NULL,
|
|
83
83
|
values_json TEXT NOT NULL DEFAULT '{}',
|
|
@@ -85,7 +85,7 @@ import{existsSync as rn,readFileSync as sn,renameSync as on}from"node:fs";import
|
|
|
85
85
|
security_values_json TEXT NOT NULL DEFAULT '{}',
|
|
86
86
|
configured_at TEXT NOT NULL,
|
|
87
87
|
updated_at TEXT NOT NULL
|
|
88
|
-
);`,
|
|
88
|
+
);`,un=`CREATE TABLE IF NOT EXISTS connector_connections (
|
|
89
89
|
channel TEXT NOT NULL,
|
|
90
90
|
instance_id TEXT NOT NULL,
|
|
91
91
|
connect_args_json TEXT NOT NULL,
|
|
@@ -94,7 +94,7 @@ import{existsSync as rn,readFileSync as sn,renameSync as on}from"node:fs";import
|
|
|
94
94
|
updated_at TEXT NOT NULL,
|
|
95
95
|
last_connected_at TEXT NOT NULL,
|
|
96
96
|
PRIMARY KEY (channel, instance_id)
|
|
97
|
-
);`;function pe(e){e.exec("PRAGMA journal_mode = WAL;"),e.exec("PRAGMA busy_timeout = 5000;"),e.exec(
|
|
97
|
+
);`;function pe(e){e.exec("PRAGMA journal_mode = WAL;"),e.exec("PRAGMA busy_timeout = 5000;"),e.exec(an),e.exec(un)}function R(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function ue(e){if(typeof e!=="string"||!e)return{};try{let n=JSON.parse(e);if(!R(n))return{};let t={};for(let[r,s]of Object.entries(n))if(typeof s==="string")t[r]=s;return t}catch{return{}}}function le(e){if(typeof e!=="string"||!e)return;try{let n=JSON.parse(e);if(!Array.isArray(n))return;return n.filter((t)=>typeof t==="string")}catch{return}}class W{dbPath;db;constructor(e={}){this.dbPath=e.dbPath??te()}getRawDb(){if(this.db)return this.db;let e=Y(this.dbPath);return pe(e),this.db=e,this.importLegacyJsonSettings(),e}close(){this.db?.close?.(),this.db=void 0}getConfig(e){let n=this.getRawDb().prepare("SELECT * FROM connector_configs WHERE channel = ?").get(e);return n?j(n):void 0}listConfigs(){return this.getRawDb().prepare("SELECT * FROM connector_configs ORDER BY channel ASC").all().map(j)}getConnection(e,n){let t=this.getRawDb().prepare(`SELECT * FROM connector_connections
|
|
98
98
|
WHERE channel = ? AND instance_id = ?`).get(e,n);return t?B(t):void 0}listConnections(e){return(e?this.getRawDb().prepare(`SELECT * FROM connector_connections
|
|
99
99
|
WHERE channel = ?
|
|
100
100
|
ORDER BY instance_id ASC`).all(e):this.getRawDb().prepare(`SELECT * FROM connector_connections
|
|
@@ -124,4 +124,4 @@ import{existsSync as rn,readFileSync as sn,renameSync as on}from"node:fs";import
|
|
|
124
124
|
WHERE channel = ? AND instance_id = ?`).run(D(n),C(),e,t);return}this.getRawDb().prepare(`UPDATE connector_connections
|
|
125
125
|
SET enabled = ?, updated_at = ?
|
|
126
126
|
WHERE channel = ?`).run(D(n),C(),e)}deleteConnection(e,n){return(this.getRawDb().prepare(`DELETE FROM connector_connections
|
|
127
|
-
WHERE channel = ? AND instance_id = ?`).run(e,n).changes??0)>0}disableAll(){this.getRawDb().prepare("UPDATE connector_connections SET enabled = 0, updated_at = ?").run(C())}deleteConfig(e){return(this.getRawDb().prepare("DELETE FROM connector_configs WHERE channel = ?").run(e).changes??0)>0}importLegacyJsonSettings(){let e=ne();if(!
|
|
127
|
+
WHERE channel = ? AND instance_id = ?`).run(e,n).changes??0)>0}disableAll(){this.getRawDb().prepare("UPDATE connector_connections SET enabled = 0, updated_at = ?").run(C())}deleteConfig(e){return(this.getRawDb().prepare("DELETE FROM connector_configs WHERE channel = ?").run(e).changes??0)>0}importLegacyJsonSettings(){let e=ne();if(!sn(e))return;try{let n=JSON.parse(on(e,"utf8")),t=R(n)&&R(n.connectors)?n.connectors:{};for(let[r,s]of Object.entries(t)){if(!R(s)||this.getConfig(r))continue;let i={};if(R(s.values)){for(let[_,f]of Object.entries(s.values))if(typeof f==="string")i[_]=f}let c={},a=R(s.security)?s.security:void 0;if(a&&R(a.values)){for(let[_,f]of Object.entries(a.values))if(typeof f==="string")c[_]=f}this.upsertConfig({channel:r,type:typeof s.type==="string"?s.type:r,values:i,security:a?{enabled:a.enabled===!0,values:c}:void 0,configuredAt:typeof s.configuredAt==="string"?s.configuredAt:void 0,updatedAt:typeof s.updatedAt==="string"?s.updatedAt:void 0})}cn(e,`${e}.migrated`)}catch{}}}function j(e){let n=e.security_enabled===1,t=ue(e.security_values_json),r=n||Object.keys(t).length>0;return{channel:E(e.channel),type:E(e.type),values:ue(e.values_json),security:r?{enabled:n,values:t}:void 0,configuredAt:E(e.configured_at),updatedAt:E(e.updated_at)}}function B(e){return{channel:E(e.channel),instanceId:E(e.instance_id),connectArgs:le(e.connect_args_json)??[],lastSuccessfulArgs:le(e.last_successful_args_json)??[],enabled:e.enabled===1,updatedAt:E(e.updated_at),lastConnectedAt:q(e.last_connected_at)??E(e.updated_at)}}function ln(e){let n=new W;try{return e(n)}finally{n.close()}}export{W as SqliteConnectorStore,$e as asBool,q as asOptionalString,E as asString,pe as ensureConnectorSchema,rn as ensureSessionSchema,Y as loadSqliteDb,C as nowIso,D as toBoolInt,ln as withConnectorStore};
|
package/dist/index.browser.js
CHANGED
|
@@ -107,4 +107,4 @@ ${o}`}function vi(e){let{ide:t="Terminal Shell",mode:n,platform:o="unknown",work
|
|
|
107
107
|
|
|
108
108
|
${Hn(b,i,l)}`.trim();return M}let S=n==="yolo"?gt.YOLO:gt.ACT,v=[d,n==="yolo"?void 0:Un,n==="plan"?f?Gn:Vn:void 0].filter(Boolean).join(`
|
|
109
109
|
|
|
110
|
-
`);return S.replace("{{PLATFORM_NAME}}",o).replace("{{CWD}}",b).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",x?Hn(b,i,l):"").replace("{{CLINE_RULES}}",v).trim()}function Mi(e){return e?.metadata?.apiKeyOptional===!0}function Pi(e){let t=e?.metadata?.localCliCommand;if(typeof t!=="string"||!t.trim())return;return{command:t.trim(),docsUrl:e?.docsUrl}}var _i="anthropic/claude-sonnet-5";var wi="remote://";import{z as a}from"zod";var jn=a.object({id:a.string(),temperature:a.number().optional(),maxTokens:a.number().optional(),contextWindow:a.number().optional(),inputPrice:a.number().optional(),outputPrice:a.number().optional(),supportsImages:a.boolean().optional()}),qn=a.object({models:a.array(jn).optional(),openAiBaseUrl:a.string().optional(),openAiHeaders:a.record(a.string(),a.string()).optional(),azureApiVersion:a.string().optional(),azureIdentity:a.boolean().optional()}),zn=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional()}),Wn=a.object({name:a.string(),baseModelId:a.string(),thinkingBudgetTokens:a.number().optional()}),Kn=a.object({models:a.array(zn).optional(),customModels:a.array(Wn).optional(),awsRegion:a.string().optional(),awsUseCrossRegionInference:a.boolean().optional(),awsUseGlobalInference:a.boolean().optional(),awsBedrockUsePromptCache:a.boolean().optional(),awsBedrockEndpoint:a.string().optional()}),$n=a.object({id:a.string()}),Jn=a.object({models:a.array($n).optional()}),Yn=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional()}),Xn=a.object({models:a.array(Yn).optional(),vertexProjectId:a.string().optional(),vertexRegion:a.string().optional()}),Qn=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional(),promptCachingEnabled:a.boolean().optional()}),Zn=a.object({models:a.array(Qn).optional(),baseUrl:a.string().optional()}),eo=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional()}),to=a.object({models:a.array(eo).optional(),baseUrl:a.string().optional()}),Oi=a.object({OpenAiCompatible:qn.optional(),AwsBedrock:Kn.optional(),Cline:Jn.optional(),Vertex:Xn.optional(),LiteLLM:Zn.optional(),Anthropic:to.optional()}),no=a.object({id:a.string()}),oo=a.object({name:a.string(),url:a.string(),alwaysEnabled:a.boolean().optional(),headers:a.record(a.string(),a.string()).optional()}),ft=a.object({alwaysEnabled:a.boolean(),name:a.string(),contents:a.string()}),Ie=a.object({bucket:a.string(),accessKeyId:a.string(),secretAccessKey:a.string(),region:a.string().optional(),endpoint:a.string().optional(),accountId:a.string().optional()}),ro=a.object({enabled:a.boolean().optional(),type:a.union([a.literal("s3_access_keys"),a.literal("r2_access_keys"),a.literal("azure_access_keys")]).optional(),s3AccessSettings:Ie.optional(),r2AccessSettings:Ie.optional(),azureAccessSettings:Ie.optional()}),io=a.object({promptUploading:ro.optional()}),Ni=a.object({version:a.string(),providerSettings:Oi.optional(),telemetryEnabled:a.boolean().optional(),kanbanEnabled:a.boolean().optional(),mcpMarketplaceEnabled:a.boolean().optional(),allowedMCPServers:a.array(no).optional(),remoteMCPServers:a.array(oo).optional(),blockPersonalRemoteMCPServers:a.boolean().optional(),yoloModeAllowed:a.boolean().optional(),openTelemetryEnabled:a.boolean().optional(),openTelemetryMetricsExporter:a.string().optional(),openTelemetryLogsExporter:a.string().optional(),openTelemetryOtlpProtocol:a.string().optional(),openTelemetryOtlpEndpoint:a.string().optional(),openTelemetryOtlpHeaders:a.record(a.string(),a.string()).optional(),openTelemetryOtlpMetricsProtocol:a.string().optional(),openTelemetryOtlpMetricsEndpoint:a.string().optional(),openTelemetryOtlpMetricsHeaders:a.record(a.string(),a.string()).optional(),openTelemetryOtlpLogsProtocol:a.string().optional(),openTelemetryOtlpLogsEndpoint:a.string().optional(),openTelemetryOtlpLogsHeaders:a.record(a.string(),a.string()).optional(),openTelemetryMetricExportInterval:a.number().optional(),openTelemetryOtlpInsecure:a.boolean().optional(),openTelemetryLogBatchSize:a.number().optional(),openTelemetryLogBatchTimeout:a.number().optional(),openTelemetryLogMaxQueueSize:a.number().optional(),enterpriseTelemetry:io.optional(),globalRules:a.array(ft).optional(),globalWorkflows:a.array(ft).optional()}),Li=a.record(a.string(),a.string());var Di=4317;var Bi="127.0.0.1:4317";import yt from"zod";var Hi=yt.enum(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),Ui=yt.enum(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),Fi=yt.enum(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var Gi="runtime.team.progress.v1",Vi="runtime.team.lifecycle.v1";function so(){return globalThis}function ji(e){so().__clineClientIdentity=e}function qi(){return so().__clineClientIdentity}var zi="CLINE_ENVIRONMENT",Wi="CLINE_ENVIRONMENT_OVERRIDE",ht={production:{environment:"production",appBaseUrl:"https://app.cline.bot",apiBaseUrl:"https://api.cline.bot",mcpBaseUrl:"https://api.cline.bot/v1/mcp",workOsClientId:"client_01K3A541FN8TA3EPPHTD2325AR"},staging:{environment:"staging",appBaseUrl:"https://staging-app.cline.bot",apiBaseUrl:"https://core-api.staging.int.cline.bot",mcpBaseUrl:"https://core-api.staging.int.cline.bot/v1/mcp",workOsClientId:"client_01K3A5415VF6QBQBG3XYCW91G6"},local:{environment:"local",appBaseUrl:"http://localhost:3000",apiBaseUrl:"http://localhost:7777",mcpBaseUrl:"http://localhost:7777/v1/mcp",workOsClientId:"client_01K6XQAY7JK6T5HXVSZW2S5VYK"}},Ki="production";function ao(e){let t=e?.trim().toLowerCase();if(t==="production"||t==="staging"||t==="local")return t;return}function lo(){if(typeof process>"u"||!process?.env)return{};return process.env}function co(){let e=lo();return ao(e.CLINE_ENVIRONMENT_OVERRIDE)??ao(e.CLINE_ENVIRONMENT)??"production"}function $i(e){if(typeof e==="string")return ht[e];return ht[co()]}function Ji(e,t){if(t.CLINE_API_BASE_URL)e={...e,apiBaseUrl:t.CLINE_API_BASE_URL,mcpBaseUrl:`${t.CLINE_API_BASE_URL}/v1/mcp`};return e}function Yi(e){let t=$i(e);return Ji(t,lo())}var Xi="agent.reasoning.unexpected_tokens",Qi="task.provider_request_started",Zi="task.provider_stream_started",es="task.first_chunk_received",ts="task.provider_stream_failed",ns="task.cancelled",os="task.max_tokens_recovery";var rs="sdk.error";var W=new Map;function is(){W.clear()}function ss(e,t){let n=typeof t.error_message==="string"?t.error_message:"";return[e,t.component,t.operation,t.error_type,t.error_code??"",t.error_status??"",n.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function as(e){let t=Date.now(),n=W.get(e);if(n&&t-n.startMs<3600000){if(n.emitted<5)return n.emitted+=1,{emit:!0,suppressed:0};return n.suppressed+=1,{emit:!1,suppressed:n.suppressed}}let o=n?.suppressed??0;if(W.delete(e),W.size>=512){let i=W.keys().next();if(!i.done)W.delete(i.value)}return W.set(e,{startMs:t,emitted:1,suppressed:0}),{emit:!0,suppressed:o}}function ls(e,t){e?.capture({event:"agent.reasoning.unexpected_tokens",properties:xt({sessionId:t.sessionId,agentId:t.agentId,runId:t.runId,iteration:t.iteration,providerId:t.providerId,modelId:t.modelId,requestedThinking:t.requestedThinking,reasoningTokenCount:t.reasoningTokenCount})})}function ds(e,t){if(!e)return;e.capture({event:t.event,properties:xt({sessionId:t.sessionId,ulid:t.ulid??t.sessionId,agentId:t.agentId,conversationId:t.conversationId,runId:t.runId,iteration:t.iteration,provider:t.providerId,providerId:t.providerId,model:t.modelId,modelId:t.modelId,phase:t.phase,durationMs:t.durationMs,eventType:t.eventType,...t.error===void 0?{}:Tt(t.error,t.messageLimit),error_class:t.errorClass})})}function cs(e,t){if(!e)return!1;let n=t.event??"sdk.error",o=uo(t),i=0;try{let l=as(ss(n,o));if(!l.emit)return!0;i=l.suppressed}catch{}return e.capture({event:n,properties:i>0?{...o,suppressed_count:i}:o}),!0}function uo(e){return xt({...e.context??{},component:e.component,operation:e.operation,severity:e.severity??"error",handled:e.handled??!0,...Tt(e.error,e.messageLimit,e.errorMessage)})}function xt(e){let t={};for(let[n,o]of Object.entries(e))if(o!==void 0)t[n]=o;return t}function Tt(e,t=500,n){let o=gs(e)?e:void 0,i=e instanceof Error?e:void 0,l=me(n)??me(i?.message)??me(o?.message)??ms(e)??"Unknown error",d=fs(o?.code),c=bt(o?.status)??bt(o?.statusCode)??bt(o?.responseStatus);return{error_type:i?.name?.trim()||me(o?.name)||i?.constructor?.name||"Error",error_message:ps(us(l),t),...d!==void 0?{error_code:d}:{},...c!==void 0?{error_status:c}:{}}}function us(e){return e.replace(/(authorization=Bearer\s+)[^&\s]+/gi,"$1[redacted]").replace(/(api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|password|secret)=([^&\s]+)/gi,"$1=[redacted]").replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,"$1[redacted]").replace(/\/Users\/[^/\s]+/g,"/Users/[redacted]").replace(/\/home\/[^/\s]+/g,"/home/[redacted]").replace(/([A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s]+/g,"$1[redacted]")}function ps(e,t){let n=Math.max(1,Math.floor(t));return e.length>n?e.substring(0,n):e}function gs(e){return typeof e==="object"&&e!==null}function me(e){return typeof e==="string"&&e.trim().length>0?e:void 0}function ms(e){if(e instanceof Error)return;let t=typeof e==="string"?e:String(e);return t==="[object Object]"?void 0:me(t)}function fs(e){if(typeof e==="string"&&e.trim().length>0)return e;if(typeof e==="number"&&Number.isFinite(e))return e;return}function bt(e){return typeof e==="number"&&Number.isFinite(e)?e:void 0}function po(e){let t={};if(!e)return t;return e.split(",").forEach((n)=>{let o=n.indexOf("=");if(o<=0)return;try{let i=decodeURIComponent(n.substring(0,o).trim()),l=decodeURIComponent(n.substring(o+1).trim());if(!i||!l)return;t[i]=l}catch{}}),t}function ys(){if(!process.env)return{enabled:!1};return{enabled:process.env.OTEL_TELEMETRY_ENABLED==="1"||process.env.OTEL_TELEMETRY_ENABLED==="true",metricsExporter:process.env.OTEL_METRICS_EXPORTER||"otlp",logsExporter:process.env.OTEL_LOGS_EXPORTER||"otlp",tracesExporter:process.env.OTEL_TRACES_EXPORTER,otlpProtocol:process.env.OTEL_EXPORTER_OTLP_PROTOCOL||"http/json",otlpEndpoint:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,metricExportInterval:process.env.OTEL_METRIC_EXPORT_INTERVAL?Number.parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL,10):void 0,otlpHeaders:process.env.OTEL_EXPORTER_OTLP_HEADERS?po(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function go(e={}){return{extension_version:"unknown",cline_type:"unknown",platform:"terminal",platform_version:process?.version||"unknown",os_type:process?.platform||"unknown",os_version:process?.platform==="win32"?process?.env?.OS??"unknown":"unknown",...e}}function hs(e={}){return{...ys(),...e,metadata:go(e.metadata)}}function mo(e){let t=e?.trim();return t?t:void 0}function bs(e,t){if(!e)return;let n=typeof e==="function"?e(t):e;if(!n)return;let o=mo(n.rootSessionId);if(!o)return;return{rootSessionId:o}}function xs(e){return mo(e?.rootSessionId)}var Ts=(e)=>crypto.getRandomValues(new Uint8Array(e)),Ss=(e,t,n)=>{let o=256-256%e.length;if(o===256){let l=e.length-1;return(d=t)=>{if(!d)return"";let c="";while(!0){let m=n(d),f=d;while(f--)if(c+=e[m[f]&l],c.length>=d)return c}}}let i=Math.ceil(409.6*t/o);return(l=t)=>{if(!l)return"";let d="";while(!0){let c=n(i),m=i;while(m--)if(c[m]<o){if(d+=e[c[m]%e.length],d.length>=l)return d}}}},fo=(e,t=21)=>Ss(e,t|0,Ts);function As(e="",t=""){let n=fo("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${e}${Date.now()}_${n(5)}${t}`}var Es=["idle","running","pending","completed","failed","cancelled"];var St=["rules","skills","workflows","plugins","hooks"],yo=St,ks=new Set(St);function ho(e){return typeof e==="string"&&ks.has(e)}function Cs(e){if(!Array.isArray(e))return;let t=e.map((n)=>typeof n==="string"?n.trim():"").filter(ho);return[...new Set(t)]}function Rs(e,t){return new Set(e??yo).has(t)}import{z as O}from"zod";var Is=O.object({rootPath:O.string().min(1),hint:O.string().min(1).optional(),associatedRemoteUrls:O.array(O.string().min(1)).optional(),latestGitCommitHash:O.string().min(1).optional(),latestGitBranchName:O.string().min(1).optional()}),vs=O.object({currentWorkspacePath:O.string().min(1).optional(),workspaces:O.record(O.string().min(1),Is)});function Zl(){return{workspaces:{}}}function ed(e,t){let n={...e,workspaces:{...e.workspaces,[t.rootPath]:t}};if(!n.currentWorkspacePath)n.currentWorkspacePath=t.rootPath;return vs.parse(n)}var Ms="workspaces",Ps="chat";function _s(e){let t=e.trim(),n=/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("\\\\"),o=t.startsWith("/");if(!n&&!o)return!1;let i=t.split(n?/[\\/]+/:/\/+/).filter(Boolean),l=i.at(-1)??"",d=i.at(-2)??"",c=i.at(-3)??"";return(i.at(-4)??"")===".cline"&&c==="data"&&d==="workspaces"&&l==="chat"}import{z as r}from"zod";var ws=["current_state","boundary_analysis","interface_proposal"],rd=3600000,id=240,sd=400,N=r.preprocess((e)=>e instanceof Date?e.toISOString():e,r.string().datetime()),ae=r.enum(["pending","in_progress","blocked","completed"]),bo=r.enum(["queued","running","completed","failed","cancelled","interrupted"]),ve=r.enum(["draft","in_review","finalized"]),Os=r.object({agentId:r.string(),role:r.enum(["lead","teammate"]),description:r.string().optional(),status:r.enum(["idle","running","stopped"])}),ad=r.object({agentId:r.string(),rolePrompt:r.string(),modelId:r.string().optional(),maxIterations:r.number().optional()});function k(e){return r.preprocess((t)=>t===null?void 0:t,e.optional())}var ld=r.object({agentId:r.string().min(1).describe("Teammate identifier"),rolePrompt:r.string().min(1).describe("System prompt describing teammate role")}).strict(),dd=r.object({agentId:r.string().min(1).describe("Teammate identifier"),reason:k(r.string().min(1)).describe("Optional shutdown reason")}),cd=r.object({}),Ns={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},ud={create:["status","taskId","summary","reason"]},pd=r.object({action:r.enum(["create","list","claim","complete","block"]),title:k(r.string().min(1)).describe("Task title"),description:k(r.string().min(1)).describe("Task details"),dependsOn:k(r.array(r.string().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:k(r.string().min(1)).describe("Optional assignee"),status:k(r.enum(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:k(r.string()).describe("Task ID"),summary:k(r.string().min(1)).describe("Completion summary"),reason:k(r.string().min(1)).describe("Blocking reason")}).superRefine((e,t)=>{for(let n of Ns[e.action]){if(e[n]!==void 0)continue;t.addIssue({code:"custom",path:[n],message:`Field "${n}" is required when action=${e.action}`})}}),gd=r.object({agentId:r.string().describe("Teammate agent ID"),task:r.string().min(1).describe("Task instructions for the teammate"),taskId:k(r.string()).describe("Optional shared task list ID"),runMode:k(r.enum(["sync","async"])).describe("Execution mode: 'sync' blocks until the teammate finishes and returns the result (default if omitted); 'async' queues the run and returns a runId immediately — use team_await_runs to collect results later."),continueConversation:k(r.boolean()).describe("If true, continue the teammate conversation; otherwise start fresh")}),md=r.object({status:k(r.enum(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:k(r.string().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:k(r.boolean()).describe("Include completed/failed runs (default true)")}),fd=r.object({runId:r.string().min(1).describe("Run ID"),reason:k(r.string().min(1)).describe("Optional cancellation reason")}),yd=r.object({runId:k(r.string().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),hd=r.object({toAgentId:r.string().min(1).describe("Recipient agent ID"),subject:r.string().min(1).describe("Message subject"),body:r.string().min(1).describe("Message body"),taskId:k(r.string().min(1)).describe("Optional task ID context")}),bd=r.object({subject:r.string().min(1).describe("Message subject"),body:r.string().min(1).describe("Message body"),taskId:k(r.string().min(1)).describe("Optional task ID context")}),xd=r.object({unreadOnly:k(r.boolean()).describe("Only unread messages for read action (default true)")}),Td=r.object({kind:r.enum(["progress","handoff","blocked","decision","done","error"]),summary:r.string().min(1).describe("Update summary"),taskId:k(r.string().min(1)).describe("Optional task ID context"),evidence:k(r.array(r.string().min(1))).describe("Optional evidence links/snippets"),nextAction:k(r.string().min(1)).describe("Planned next step")}),Sd=r.object({}),Ad=r.object({title:r.string().describe("Outcome title"),requiredSections:r.array(r.string()).default(ws).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),Ed=r.object({outcomeId:r.string().describe("Outcome ID"),section:r.string().describe("Section name"),sourceRunId:k(r.string()).describe("Optional source run ID"),content:r.string().describe("Section fragment content")}),kd=r.object({fragmentId:r.string().describe("Fragment ID"),approved:r.boolean().describe("Review decision")}),Cd=r.object({outcomeId:r.string().describe("Outcome ID")}),Rd=r.object({}),Id=r.object({teamId:r.string(),teamName:r.string(),members:r.array(Os),taskCounts:r.record(ae,r.number()),unreadMessages:r.number(),missionLogEntries:r.number(),activeRuns:r.number(),queuedRuns:r.number(),outcomeCounts:r.record(ve,r.number())}),Ls=r.object({id:r.string(),title:r.string(),description:r.string(),status:ae,createdAt:N,updatedAt:N,createdBy:r.string(),assignee:r.string().optional(),dependsOn:r.array(r.string()),summary:r.string().optional(),isReady:r.boolean(),blockedBy:r.array(r.string())}),vd=r.discriminatedUnion("action",[r.object({action:r.literal("create"),taskId:r.string(),status:ae,ignoredFields:r.array(r.string()).optional(),note:r.string().optional()}),r.object({action:r.literal("list"),tasks:r.array(Ls)}),r.object({action:r.literal("claim"),taskId:r.string(),status:ae,nextStep:r.string()}),r.object({action:r.literal("complete"),taskId:r.string(),status:ae}),r.object({action:r.literal("block"),taskId:r.string(),status:ae})]),Md=r.object({agentId:r.string(),mode:r.enum(["sync","async"]),status:r.enum(["dispatched","running","queued","joined"]),dispatched:r.boolean(),message:r.string(),deduped:r.boolean().optional(),runId:r.string().optional(),text:r.string().optional(),iterations:r.number().optional()}),Ds=r.object({textPreview:r.string(),iterations:r.number(),finishReason:r.string(),durationMs:r.number(),usage:r.object({inputTokens:r.number(),outputTokens:r.number(),cacheReadTokens:r.number().optional(),cacheWriteTokens:r.number().optional(),totalCost:r.number().optional()})}),Pd=r.object({id:r.string(),agentId:r.string(),taskId:r.string().optional(),status:bo,messagePreview:r.string(),priority:r.number(),retryCount:r.number(),maxRetries:r.number(),nextAttemptAt:N.optional(),continueConversation:r.boolean().optional(),startedAt:N,endedAt:N.optional(),leaseOwner:r.string().optional(),heartbeatAt:N.optional(),lastProgressAt:N.optional(),lastProgressMessage:r.string().optional(),currentActivity:r.string().optional(),error:r.string().optional(),resultSummary:Ds.optional()}),_d=r.object({id:r.string(),teamId:r.string(),fromAgentId:r.string(),toAgentId:r.string(),subject:r.string(),body:r.string(),taskId:r.string().optional(),sentAt:N,readAt:N.optional()}),wd=r.object({id:r.string(),teamId:r.string(),title:r.string(),status:ve,requiredSections:r.array(r.string()),createdBy:r.string(),createdAt:N,finalizedAt:N.optional()}),Od=r.object({outcomeId:r.string(),status:ve,requiredSections:r.array(r.string())}),Nd=r.object({agentId:r.string(),status:r.string()}),Ld=r.object({runId:r.string(),status:bo}),Dd=r.object({id:r.string(),toAgentId:r.string()}),Bd=r.object({delivered:r.number()}),Hd=r.object({id:r.string()}),Ud=r.object({status:r.string()}),Fd=r.object({fragmentId:r.string(),status:r.string()}),Gd=r.object({outcomeId:r.string(),status:ve});var Bs;((C)=>{C.TaskStart="task_start";C.TaskEnd="task_end";C.AgentEvent="agent_event";C.TeammateSpawned="teammate_spawned";C.TeammateShutdown="teammate_shutdown";C.TeamTaskUpdated="team_task_updated";C.TeamMessage="team_message";C.TeamMissionLog="team_mission_log";C.TeamTaskCompleted="team_task_completed";C.RunStarted="run_started";C.RunQueued="run_queued";C.RunProgress="run_progress";C.RunCompleted="run_completed";C.RunFailed="run_failed";C.RunCancelled="run_cancelled";C.RunInterrupted="run_interrupted";C.OutcomeCreated="outcome_created";C.OutcomeFragmentAttached="outcome_fragment_attached";C.OutcomeFragmentReviewed="outcome_fragment_reviewed";C.OutcomeFinalized="outcome_finalized"})(Bs||={});import{z as Hs}from"zod";function Us(e){let{$schema:t,...n}=e;if(typeof n.type==="string")return n;if("properties"in n||"required"in n||"additionalProperties"in n)return{type:"object",...n};for(let o of["oneOf","anyOf","allOf"]){let i=n[o];if(!Array.isArray(i)||i.length===0)continue;if(o==="allOf"){if(i.some((c)=>c&&typeof c==="object"&&c.type==="object"))return{type:"object",...n};throw Error('Tool inputSchema must describe an object at the top level, but the schema has a top-level "allOf" with no branch that asserts type: "object". Add type: "object" to at least one allOf branch to make the object constraint explicit.')}if(i.every((d)=>d&&typeof d==="object"&&d.type==="object"))return{type:"object",...n};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${o}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return n}function Fs(e){let t=Us(e.inputSchema instanceof Hs.ZodType?ut(e.inputSchema):e.inputSchema);return{name:e.name,resultPolicy:e.resultPolicy,description:e.description,inputSchema:t,lifecycle:e.lifecycle,executionMode:e.executionMode,timeoutMs:e.timeoutMs??30000,retryable:e.retryable??!0,maxRetries:e.maxRetries??3,execute:e.execute}}var xo=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function Gs(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return xo.some((n)=>t.includes(n))}export{Xi as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT,Li as APIKeySchema,xo as AUTH_ERROR_PATTERNS,ta as AgentConfigSchema,Bo as AgentFinishReasonSchema,ea as AgentResultSchema,Ho as AgentUsageSchema,no as AllowedMCPServerSchema,eo as AnthropicModelSchema,to as AnthropicSchema,vo as ApiFormat,Mt as ApiFormatSchema,Wn as AwsBedrockCustomModelSchema,zn as AwsBedrockModelSchema,Kn as AwsBedrockSettingsSchema,jr as CHARS_PER_TOKEN,Ps as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,_i as CLINE_DEFAULT_MODEL_ID,Bi as CLINE_DEFAULT_RPC_ADDRESS,Di as CLINE_DEFAULT_RPC_PORT,ht as CLINE_ENVIRONMENTS,zi as CLINE_ENVIRONMENT_ENV,Wi as CLINE_ENVIRONMENT_OVERRIDE_ENV,Ms as CLINE_WORKSPACES_DIRECTORY_NAME,za as CONFIGURABLE_MODEL_TOOL_NAMES,Vt as CONNECTOR_CATALOG,qt as CONNECTOR_PLATFORMS,ma as CURRENT_HUB_PROTOCOL_VERSION,$n as ClineModelSchema,Jn as ClineSettingsSchema,Fo as ConnectorAuthorizationDecisionSchema,Uo as ConnectorAuthorizationRequestSchema,Ft as ConnectorEventActorSchema,Gt as ConnectorEventContextSchema,Ut as ConnectorHookEventNameSchema,Go as ConnectorHookEventSchema,Be as ContributionRegistry,Ki as DEFAULT_CLINE_ENVIRONMENT,Fe as DEFAULT_MAX_IMAGE_BASE64_BYTES,U as DEFAULT_MAX_IMAGE_DECODED_BYTES,D as DEFAULT_MAX_IMAGE_ENCODED_BYTES,cn as DEFAULT_MAX_TOTAL_MEDIA_BYTES,Xa as DEFAULT_MCP_TIMEOUT_SECONDS,ws as DEFAULT_OUTCOME_REQUIRED_SECTIONS,Ur as DEFAULT_REASONING_EFFORT,yo as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,ce as EMPTY_CONTENT_TEXT,io as EnterpriseTelemetrySchema,er as FEATURE_FLAGS,Q as FeatureFlag,Zo as FeatureFlagDefaultValue,sn as GeneratedMediaModalitySchema,dn as GeneratedMediaSchema,an as GeneratedMediaSourceSchema,ft as GlobalInstructionsFileSchema,ha as HUB_CAPABILITIES,Pa as HUB_CHECKPOINT_CAPABILITY,xa as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,Ea as HUB_COMMAND_SLOW_LOG_MS,Ma as HUB_COMPACTION_CAPABILITY,Ia as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,ur as HUB_DEFAULT_COMMAND_TIMEOUT_MS,va as HUB_HOOK_CAPABILITY_PREFIX,_a as HUB_MISTAKE_LIMIT_CAPABILITY,Xt as HUB_SCHEDULE_MODES,Ra as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,gr as HUB_TOOL_EXECUTOR_NAMES,wa as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,Jt as HookEventNameSchema,Yt as HookEventPayloadSchema,Z as IMAGE_OMITTED_PLACEHOLDER,ee as IMAGE_UNSUPPORTED_PLACEHOLDER,Qn as LiteLLMModelSchema,Zn as LiteLLMSchema,ya as MAX_CLIENT_HUB_PROTOCOL_VERSION,Za as MAX_MCP_TIMEOUT_SECONDS,fa as MIN_CLIENT_HUB_PROTOCOL_VERSION,Qa as MIN_MCP_TIMEOUT_SECONDS,qa as MODEL_TOOL_NAMES,Un as MODE_TAG_INSTRUCTIONS,Pt as ModelCapabilitySchema,xe as ModelInfoSchema,Nt as ModelMetadataSchema,Lt as ModelModalitiesSchema,Ne as ModelModalitySchema,Ht as ModelOperationModeSchema,Bt as ModelOperationSchema,wt as ModelPricingSchema,Oe as ModelReasoningOptionSchema,_t as ModelStatusSchema,Ta as ONE_TIME_SCHEDULE_CRON_PATTERN,Sa as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,jn as OpenAiCompatibleModelSchema,qn as OpenAiCompatibleSchema,Gn as PLAN_MODE_INSTRUCTIONS,Vn as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,Qo as PLUGIN_FILE_EXTENSIONS,ro as PromptUploadingSchema,Hi as ProviderCapabilitySchema,Fi as ProviderClientSchema,Ui as ProviderProtocolSchema,pe as REASONING_EFFORT_RATIOS,he as REASONING_LEVELS,wi as REMOTE_URI_SCHEME,St as RUNTIME_CONFIG_EXTENSION_KINDS,be as ReasoningEffortSchema,we as ReasoningLevelSchema,Ni as RemoteConfigSchema,oo as RemoteMCPServerSchema,Ie as S3AccessKeySettingsSchema,rs as SDK_ERROR_TELEMETRY_EVENT,nn as SESSION_SEARCH_PREVIEW_MAX_LENGTH,tn as SESSION_SEARCH_TITLE_MAX_LENGTH,Es as SESSION_STATUS_VALUES,Ae as SUPPORTED_IMAGE_MEDIA_TYPES,ns as TASK_CANCELLED_EVENT,es as TASK_FIRST_CHUNK_RECEIVED_EVENT,os as TASK_MAX_TOKENS_RECOVERY_EVENT,Qi as TASK_PROVIDER_REQUEST_STARTED_EVENT,ts as TASK_PROVIDER_STREAM_FAILED_EVENT,Zi as TASK_PROVIDER_STREAM_STARTED_EVENT,rd as TEAM_AWAIT_TIMEOUT_MS,Vi as TEAM_LIFECYCLE_EVENT_TYPE,Gi as TEAM_PROGRESS_EVENT_TYPE,id as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,sd as TEAM_RUN_TEXT_PREVIEW_LIMIT,ud as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,Do as TOOL_REJECTION_SUFFIX,Ed as TeamAttachOutcomeFragmentInputSchema,yd as TeamAwaitRunsInputSchema,bd as TeamBroadcastInputSchema,Bd as TeamBroadcastToolResultSchema,fd as TeamCancelRunInputSchema,Ld as TeamCancelRunToolResultSchema,Sd as TeamCleanupInputSchema,Ud as TeamCleanupToolResultSchema,Ad as TeamCreateOutcomeInputSchema,Od as TeamCreateOutcomeToolResultSchema,Cd as TeamFinalizeOutcomeInputSchema,Gd as TeamFinalizeOutcomeToolResultSchema,Rd as TeamListOutcomesInputSchema,md as TeamListRunsInputSchema,_d as TeamMailboxMessageToolResultSchema,Bs as TeamMessageType,Td as TeamMissionLogInputSchema,Hd as TeamMissionLogToolResultSchema,Fd as TeamOutcomeFragmentToolResultSchema,wd as TeamOutcomeToolResultSchema,xd as TeamReadMailboxInputSchema,kd as TeamReviewOutcomeFragmentInputSchema,Ds as TeamRunResultSummarySchema,gd as TeamRunTaskInputSchema,Md as TeamRunTaskToolResultSchema,Pd as TeamRunToolSummarySchema,hd as TeamSendMessageInputSchema,Dd as TeamSendMessageToolResultSchema,dd as TeamShutdownTeammateInputSchema,Nd as TeamSimpleAgentStatusToolResultSchema,ld as TeamSpawnTeammateInputSchema,cd as TeamStatusInputSchema,Id as TeamStatusToolResultSchema,pd as TeamTaskInputSchema,Ls as TeamTaskListItemToolResultSchema,vd as TeamTaskToolResultSchema,ad as TeamTeammateSpecSchema,Ot as ThinkingConfigSchema,De as ToolCallRecordSchema,Ga as USAGE_COST_DISPLAYS,Lo as USER_REJECTED_TOOL_REASON,Yn as VertexModelSchema,Xn as VertexSettingsSchema,Is as WorkspaceInfoSchema,vs as WorkspaceManifestSchema,vi as buildClineSystemPrompt,uo as buildSdkErrorProperties,ls as captureAgentUnexpectedReasoningTokens,cs as captureSdkError,ds as captureTaskLifecycleEvent,Kr as clampMcpTimeoutSeconds,jo as connectorChannelsFromPlatforms,hs as createClineTelemetryServiceConfig,go as createClineTelemetryServiceMetadata,Xo as createContributionRegistry,Ee as createMediaBudgetState,br as createModeSwitchNoticeTracker,As as createSessionId,Fs as createTool,di as decodeJwtPayload,Oa as describeOutdatedHubSessions,Zl as emptyWorkspaceManifest,qr as estimateRequestInputTokens,Sn as estimateTokens,Ue as formatDisplayUserInput,He as formatFileContentBlock,Ci as formatHumanReadableDate,tl as formatMcpTimeoutErrorMessage,Br as formatMessagesForAiSdk,hr as formatModeSwitchNotice,Er as formatSessionSearchPreview,Ar as formatSessionSearchTitle,Ri as formatUptime,yr as formatUserCommandBlock,fr as formatUserInputBlock,Cr as generatedMediaModalityFromMediaType,qi as getClineClientIdentity,Yi as getClineEnvironmentConfig,pr as getDefaultHubCommandTimeoutMs,ui as getDefaultShell,Jr as getErrorCode,$r as getErrorMessage,xi as getShellArgs,On as getShellInvocation,ct as getShellKind,Rs as hasRuntimeConfigExtension,Ge as imageBase64DecodedByteLength,Rr as imageBase64EncodedByteLength,Ve as imageBase64LengthForDecodedBytes,Ir as imageFileMaxDecodedBytesForBase64Limit,un as isBase64Char,vr as isCanonicalBase64,Po as isChatCompatibleModel,_s as isChatWorkspacePath,pt as isClineProvider,kr as isGeneratedMedia,ba as isHubProtocolCompatible,cr as isHubScheduleMode,Ca as isHubToolExecutorName,Gs as isLikelyAuthError,Wr as isMcpTimeoutConfigured,ho as isRuntimeConfigExtensionKind,Mo as isTranscriptionModel,jt as listConnectorCatalog,Ei as maskSecret,Hr as mergeModelOptions,Le as modelHasCapability,_o as modelProducesImages,No as modelSupportsImageInput,Oo as modelSupportsToolCalling,zr as noopBasicLogger,dt as normalizeJsonLikeStringsForSchema,$t as normalizePluginManifest,Tt as normalizeSdkError,Zt as normalizeUserInput,ci as omitUndefinedValues,dr as parseHookEventPayload,oi as parseJsonStream,Cs as parseRuntimeConfigExtensions,Qt as parseUserCommandEnvelope,Aa as readHubScheduleMode,le as reserveImageMediaBytes,is as resetSdkErrorRateLimiterForTests,co as resolveClineEnvironment,Fr as resolveEffectiveReasoningEffort,bs as resolveHookSessionContext,ka as resolveHubCommandTimeoutMs,el as resolveMcpTimeoutSeconds,je as resolveMediaBudget,Mi as resolveProviderApiKeyOptional,Pi as resolveProviderLocalCli,Gr as resolveReasoningBudgetFromRatio,Tn as resolveReasoningEffortRatio,xs as resolveRootSessionId,ii as safeJsonParse,ri as safeJsonStringify,Ti as sanitizeFileName,_ as sanitizeSurrogates,Vr as serializeAbortReason,ji as setClineClientIdentity,Vo as shouldIncludeConnectorField,en as stripModeNotices,ki as stripUtf8Bom,Dt as supportsChatModalities,bn as toAiSdkToolResultOutput,Si as trimNonEmpty,Ai as truncateSplit,Nn as truncateStr,ed as upsertWorkspaceInfo,wo as usesImageGenerationOperation,Mr as validateAndReserveBase64Media,de as validateAndReserveImageMedia,gn as validateImageMedia,Ii as validateWithZod,rn as xmlTagsRemoval,ut as zodToJsonSchema};
|
|
110
|
+
`);return S.replace("{{PLATFORM_NAME}}",o).replace("{{CWD}}",b).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",x?Hn(b,i,l):"").replace("{{CLINE_RULES}}",v).trim()}function Mi(e){return e?.metadata?.apiKeyOptional===!0}function Pi(e){let t=e?.metadata?.localCliCommand;if(typeof t!=="string"||!t.trim())return;return{command:t.trim(),docsUrl:e?.docsUrl}}var _i="anthropic/claude-sonnet-5.5";var wi="remote://";import{z as a}from"zod";var jn=a.object({id:a.string(),temperature:a.number().optional(),maxTokens:a.number().optional(),contextWindow:a.number().optional(),inputPrice:a.number().optional(),outputPrice:a.number().optional(),supportsImages:a.boolean().optional()}),qn=a.object({models:a.array(jn).optional(),openAiBaseUrl:a.string().optional(),openAiHeaders:a.record(a.string(),a.string()).optional(),azureApiVersion:a.string().optional(),azureIdentity:a.boolean().optional()}),zn=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional()}),Wn=a.object({name:a.string(),baseModelId:a.string(),thinkingBudgetTokens:a.number().optional()}),Kn=a.object({models:a.array(zn).optional(),customModels:a.array(Wn).optional(),awsRegion:a.string().optional(),awsUseCrossRegionInference:a.boolean().optional(),awsUseGlobalInference:a.boolean().optional(),awsBedrockUsePromptCache:a.boolean().optional(),awsBedrockEndpoint:a.string().optional()}),$n=a.object({id:a.string()}),Jn=a.object({models:a.array($n).optional()}),Yn=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional()}),Xn=a.object({models:a.array(Yn).optional(),vertexProjectId:a.string().optional(),vertexRegion:a.string().optional()}),Qn=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional(),promptCachingEnabled:a.boolean().optional()}),Zn=a.object({models:a.array(Qn).optional(),baseUrl:a.string().optional()}),eo=a.object({id:a.string(),thinkingBudgetTokens:a.number().optional()}),to=a.object({models:a.array(eo).optional(),baseUrl:a.string().optional()}),Oi=a.object({OpenAiCompatible:qn.optional(),AwsBedrock:Kn.optional(),Cline:Jn.optional(),Vertex:Xn.optional(),LiteLLM:Zn.optional(),Anthropic:to.optional()}),no=a.object({id:a.string()}),oo=a.object({name:a.string(),url:a.string(),alwaysEnabled:a.boolean().optional(),headers:a.record(a.string(),a.string()).optional()}),ft=a.object({alwaysEnabled:a.boolean(),name:a.string(),contents:a.string()}),Ie=a.object({bucket:a.string(),accessKeyId:a.string(),secretAccessKey:a.string(),region:a.string().optional(),endpoint:a.string().optional(),accountId:a.string().optional()}),ro=a.object({enabled:a.boolean().optional(),type:a.union([a.literal("s3_access_keys"),a.literal("r2_access_keys"),a.literal("azure_access_keys")]).optional(),s3AccessSettings:Ie.optional(),r2AccessSettings:Ie.optional(),azureAccessSettings:Ie.optional()}),io=a.object({promptUploading:ro.optional()}),Ni=a.object({version:a.string(),providerSettings:Oi.optional(),telemetryEnabled:a.boolean().optional(),kanbanEnabled:a.boolean().optional(),mcpMarketplaceEnabled:a.boolean().optional(),allowedMCPServers:a.array(no).optional(),remoteMCPServers:a.array(oo).optional(),blockPersonalRemoteMCPServers:a.boolean().optional(),yoloModeAllowed:a.boolean().optional(),openTelemetryEnabled:a.boolean().optional(),openTelemetryMetricsExporter:a.string().optional(),openTelemetryLogsExporter:a.string().optional(),openTelemetryOtlpProtocol:a.string().optional(),openTelemetryOtlpEndpoint:a.string().optional(),openTelemetryOtlpHeaders:a.record(a.string(),a.string()).optional(),openTelemetryOtlpMetricsProtocol:a.string().optional(),openTelemetryOtlpMetricsEndpoint:a.string().optional(),openTelemetryOtlpMetricsHeaders:a.record(a.string(),a.string()).optional(),openTelemetryOtlpLogsProtocol:a.string().optional(),openTelemetryOtlpLogsEndpoint:a.string().optional(),openTelemetryOtlpLogsHeaders:a.record(a.string(),a.string()).optional(),openTelemetryMetricExportInterval:a.number().optional(),openTelemetryOtlpInsecure:a.boolean().optional(),openTelemetryLogBatchSize:a.number().optional(),openTelemetryLogBatchTimeout:a.number().optional(),openTelemetryLogMaxQueueSize:a.number().optional(),enterpriseTelemetry:io.optional(),globalRules:a.array(ft).optional(),globalWorkflows:a.array(ft).optional()}),Li=a.record(a.string(),a.string());var Di=4317;var Bi="127.0.0.1:4317";import yt from"zod";var Hi=yt.enum(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),Ui=yt.enum(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),Fi=yt.enum(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);var Gi="runtime.team.progress.v1",Vi="runtime.team.lifecycle.v1";function so(){return globalThis}function ji(e){so().__clineClientIdentity=e}function qi(){return so().__clineClientIdentity}var zi="CLINE_ENVIRONMENT",Wi="CLINE_ENVIRONMENT_OVERRIDE",ht={production:{environment:"production",appBaseUrl:"https://app.cline.bot",apiBaseUrl:"https://api.cline.bot",mcpBaseUrl:"https://api.cline.bot/v1/mcp",workOsClientId:"client_01K3A541FN8TA3EPPHTD2325AR"},staging:{environment:"staging",appBaseUrl:"https://staging-app.cline.bot",apiBaseUrl:"https://core-api.staging.int.cline.bot",mcpBaseUrl:"https://core-api.staging.int.cline.bot/v1/mcp",workOsClientId:"client_01K3A5415VF6QBQBG3XYCW91G6"},local:{environment:"local",appBaseUrl:"http://localhost:3000",apiBaseUrl:"http://localhost:7777",mcpBaseUrl:"http://localhost:7777/v1/mcp",workOsClientId:"client_01K6XQAY7JK6T5HXVSZW2S5VYK"}},Ki="production";function ao(e){let t=e?.trim().toLowerCase();if(t==="production"||t==="staging"||t==="local")return t;return}function lo(){if(typeof process>"u"||!process?.env)return{};return process.env}function co(){let e=lo();return ao(e.CLINE_ENVIRONMENT_OVERRIDE)??ao(e.CLINE_ENVIRONMENT)??"production"}function $i(e){if(typeof e==="string")return ht[e];return ht[co()]}function Ji(e,t){if(t.CLINE_API_BASE_URL)e={...e,apiBaseUrl:t.CLINE_API_BASE_URL,mcpBaseUrl:`${t.CLINE_API_BASE_URL}/v1/mcp`};return e}function Yi(e){let t=$i(e);return Ji(t,lo())}var Xi="agent.reasoning.unexpected_tokens",Qi="task.provider_request_started",Zi="task.provider_stream_started",es="task.first_chunk_received",ts="task.provider_stream_failed",ns="task.cancelled",os="task.max_tokens_recovery";var rs="sdk.error";var W=new Map;function is(){W.clear()}function ss(e,t){let n=typeof t.error_message==="string"?t.error_message:"";return[e,t.component,t.operation,t.error_type,t.error_code??"",t.error_status??"",n.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function as(e){let t=Date.now(),n=W.get(e);if(n&&t-n.startMs<3600000){if(n.emitted<5)return n.emitted+=1,{emit:!0,suppressed:0};return n.suppressed+=1,{emit:!1,suppressed:n.suppressed}}let o=n?.suppressed??0;if(W.delete(e),W.size>=512){let i=W.keys().next();if(!i.done)W.delete(i.value)}return W.set(e,{startMs:t,emitted:1,suppressed:0}),{emit:!0,suppressed:o}}function ls(e,t){e?.capture({event:"agent.reasoning.unexpected_tokens",properties:xt({sessionId:t.sessionId,agentId:t.agentId,runId:t.runId,iteration:t.iteration,providerId:t.providerId,modelId:t.modelId,requestedThinking:t.requestedThinking,reasoningTokenCount:t.reasoningTokenCount})})}function ds(e,t){if(!e)return;e.capture({event:t.event,properties:xt({sessionId:t.sessionId,ulid:t.ulid??t.sessionId,agentId:t.agentId,conversationId:t.conversationId,runId:t.runId,iteration:t.iteration,provider:t.providerId,providerId:t.providerId,model:t.modelId,modelId:t.modelId,phase:t.phase,durationMs:t.durationMs,eventType:t.eventType,...t.error===void 0?{}:Tt(t.error,t.messageLimit),error_class:t.errorClass})})}function cs(e,t){if(!e)return!1;let n=t.event??"sdk.error",o=uo(t),i=0;try{let l=as(ss(n,o));if(!l.emit)return!0;i=l.suppressed}catch{}return e.capture({event:n,properties:i>0?{...o,suppressed_count:i}:o}),!0}function uo(e){return xt({...e.context??{},component:e.component,operation:e.operation,severity:e.severity??"error",handled:e.handled??!0,...Tt(e.error,e.messageLimit,e.errorMessage)})}function xt(e){let t={};for(let[n,o]of Object.entries(e))if(o!==void 0)t[n]=o;return t}function Tt(e,t=500,n){let o=gs(e)?e:void 0,i=e instanceof Error?e:void 0,l=me(n)??me(i?.message)??me(o?.message)??ms(e)??"Unknown error",d=fs(o?.code),c=bt(o?.status)??bt(o?.statusCode)??bt(o?.responseStatus);return{error_type:i?.name?.trim()||me(o?.name)||i?.constructor?.name||"Error",error_message:ps(us(l),t),...d!==void 0?{error_code:d}:{},...c!==void 0?{error_status:c}:{}}}function us(e){return e.replace(/(authorization=Bearer\s+)[^&\s]+/gi,"$1[redacted]").replace(/(api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|password|secret)=([^&\s]+)/gi,"$1=[redacted]").replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,"$1[redacted]").replace(/\/Users\/[^/\s]+/g,"/Users/[redacted]").replace(/\/home\/[^/\s]+/g,"/home/[redacted]").replace(/([A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s]+/g,"$1[redacted]")}function ps(e,t){let n=Math.max(1,Math.floor(t));return e.length>n?e.substring(0,n):e}function gs(e){return typeof e==="object"&&e!==null}function me(e){return typeof e==="string"&&e.trim().length>0?e:void 0}function ms(e){if(e instanceof Error)return;let t=typeof e==="string"?e:String(e);return t==="[object Object]"?void 0:me(t)}function fs(e){if(typeof e==="string"&&e.trim().length>0)return e;if(typeof e==="number"&&Number.isFinite(e))return e;return}function bt(e){return typeof e==="number"&&Number.isFinite(e)?e:void 0}function po(e){let t={};if(!e)return t;return e.split(",").forEach((n)=>{let o=n.indexOf("=");if(o<=0)return;try{let i=decodeURIComponent(n.substring(0,o).trim()),l=decodeURIComponent(n.substring(o+1).trim());if(!i||!l)return;t[i]=l}catch{}}),t}function ys(){if(!process.env)return{enabled:!1};return{enabled:process.env.OTEL_TELEMETRY_ENABLED==="1"||process.env.OTEL_TELEMETRY_ENABLED==="true",metricsExporter:process.env.OTEL_METRICS_EXPORTER||"otlp",logsExporter:process.env.OTEL_LOGS_EXPORTER||"otlp",tracesExporter:process.env.OTEL_TRACES_EXPORTER,otlpProtocol:process.env.OTEL_EXPORTER_OTLP_PROTOCOL||"http/json",otlpEndpoint:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,metricExportInterval:process.env.OTEL_METRIC_EXPORT_INTERVAL?Number.parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL,10):void 0,otlpHeaders:process.env.OTEL_EXPORTER_OTLP_HEADERS?po(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function go(e={}){return{extension_version:"unknown",cline_type:"unknown",platform:"terminal",platform_version:process?.version||"unknown",os_type:process?.platform||"unknown",os_version:process?.platform==="win32"?process?.env?.OS??"unknown":"unknown",...e}}function hs(e={}){return{...ys(),...e,metadata:go(e.metadata)}}function mo(e){let t=e?.trim();return t?t:void 0}function bs(e,t){if(!e)return;let n=typeof e==="function"?e(t):e;if(!n)return;let o=mo(n.rootSessionId);if(!o)return;return{rootSessionId:o}}function xs(e){return mo(e?.rootSessionId)}var Ts=(e)=>crypto.getRandomValues(new Uint8Array(e)),Ss=(e,t,n)=>{let o=256-256%e.length;if(o===256){let l=e.length-1;return(d=t)=>{if(!d)return"";let c="";while(!0){let m=n(d),f=d;while(f--)if(c+=e[m[f]&l],c.length>=d)return c}}}let i=Math.ceil(409.6*t/o);return(l=t)=>{if(!l)return"";let d="";while(!0){let c=n(i),m=i;while(m--)if(c[m]<o){if(d+=e[c[m]%e.length],d.length>=l)return d}}}},fo=(e,t=21)=>Ss(e,t|0,Ts);function As(e="",t=""){let n=fo("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${e}${Date.now()}_${n(5)}${t}`}var Es=["idle","running","pending","completed","failed","cancelled"];var St=["rules","skills","workflows","plugins","hooks"],yo=St,ks=new Set(St);function ho(e){return typeof e==="string"&&ks.has(e)}function Cs(e){if(!Array.isArray(e))return;let t=e.map((n)=>typeof n==="string"?n.trim():"").filter(ho);return[...new Set(t)]}function Rs(e,t){return new Set(e??yo).has(t)}import{z as O}from"zod";var Is=O.object({rootPath:O.string().min(1),hint:O.string().min(1).optional(),associatedRemoteUrls:O.array(O.string().min(1)).optional(),latestGitCommitHash:O.string().min(1).optional(),latestGitBranchName:O.string().min(1).optional()}),vs=O.object({currentWorkspacePath:O.string().min(1).optional(),workspaces:O.record(O.string().min(1),Is)});function Zl(){return{workspaces:{}}}function ed(e,t){let n={...e,workspaces:{...e.workspaces,[t.rootPath]:t}};if(!n.currentWorkspacePath)n.currentWorkspacePath=t.rootPath;return vs.parse(n)}var Ms="workspaces",Ps="chat";function _s(e){let t=e.trim(),n=/^[A-Za-z]:[\\/]/.test(t)||t.startsWith("\\\\"),o=t.startsWith("/");if(!n&&!o)return!1;let i=t.split(n?/[\\/]+/:/\/+/).filter(Boolean),l=i.at(-1)??"",d=i.at(-2)??"",c=i.at(-3)??"";return(i.at(-4)??"")===".cline"&&c==="data"&&d==="workspaces"&&l==="chat"}import{z as r}from"zod";var ws=["current_state","boundary_analysis","interface_proposal"],rd=3600000,id=240,sd=400,N=r.preprocess((e)=>e instanceof Date?e.toISOString():e,r.string().datetime()),ae=r.enum(["pending","in_progress","blocked","completed"]),bo=r.enum(["queued","running","completed","failed","cancelled","interrupted"]),ve=r.enum(["draft","in_review","finalized"]),Os=r.object({agentId:r.string(),role:r.enum(["lead","teammate"]),description:r.string().optional(),status:r.enum(["idle","running","stopped"])}),ad=r.object({agentId:r.string(),rolePrompt:r.string(),modelId:r.string().optional(),maxIterations:r.number().optional()});function k(e){return r.preprocess((t)=>t===null?void 0:t,e.optional())}var ld=r.object({agentId:r.string().min(1).describe("Teammate identifier"),rolePrompt:r.string().min(1).describe("System prompt describing teammate role")}).strict(),dd=r.object({agentId:r.string().min(1).describe("Teammate identifier"),reason:k(r.string().min(1)).describe("Optional shutdown reason")}),cd=r.object({}),Ns={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},ud={create:["status","taskId","summary","reason"]},pd=r.object({action:r.enum(["create","list","claim","complete","block"]),title:k(r.string().min(1)).describe("Task title"),description:k(r.string().min(1)).describe("Task details"),dependsOn:k(r.array(r.string().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:k(r.string().min(1)).describe("Optional assignee"),status:k(r.enum(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:k(r.string()).describe("Task ID"),summary:k(r.string().min(1)).describe("Completion summary"),reason:k(r.string().min(1)).describe("Blocking reason")}).superRefine((e,t)=>{for(let n of Ns[e.action]){if(e[n]!==void 0)continue;t.addIssue({code:"custom",path:[n],message:`Field "${n}" is required when action=${e.action}`})}}),gd=r.object({agentId:r.string().describe("Teammate agent ID"),task:r.string().min(1).describe("Task instructions for the teammate"),taskId:k(r.string()).describe("Optional shared task list ID"),runMode:k(r.enum(["sync","async"])).describe("Execution mode: 'sync' blocks until the teammate finishes and returns the result (default if omitted); 'async' queues the run and returns a runId immediately — use team_await_runs to collect results later."),continueConversation:k(r.boolean()).describe("If true, continue the teammate conversation; otherwise start fresh")}),md=r.object({status:k(r.enum(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:k(r.string().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:k(r.boolean()).describe("Include completed/failed runs (default true)")}),fd=r.object({runId:r.string().min(1).describe("Run ID"),reason:k(r.string().min(1)).describe("Optional cancellation reason")}),yd=r.object({runId:k(r.string().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),hd=r.object({toAgentId:r.string().min(1).describe("Recipient agent ID"),subject:r.string().min(1).describe("Message subject"),body:r.string().min(1).describe("Message body"),taskId:k(r.string().min(1)).describe("Optional task ID context")}),bd=r.object({subject:r.string().min(1).describe("Message subject"),body:r.string().min(1).describe("Message body"),taskId:k(r.string().min(1)).describe("Optional task ID context")}),xd=r.object({unreadOnly:k(r.boolean()).describe("Only unread messages for read action (default true)")}),Td=r.object({kind:r.enum(["progress","handoff","blocked","decision","done","error"]),summary:r.string().min(1).describe("Update summary"),taskId:k(r.string().min(1)).describe("Optional task ID context"),evidence:k(r.array(r.string().min(1))).describe("Optional evidence links/snippets"),nextAction:k(r.string().min(1)).describe("Planned next step")}),Sd=r.object({}),Ad=r.object({title:r.string().describe("Outcome title"),requiredSections:r.array(r.string()).default(ws).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),Ed=r.object({outcomeId:r.string().describe("Outcome ID"),section:r.string().describe("Section name"),sourceRunId:k(r.string()).describe("Optional source run ID"),content:r.string().describe("Section fragment content")}),kd=r.object({fragmentId:r.string().describe("Fragment ID"),approved:r.boolean().describe("Review decision")}),Cd=r.object({outcomeId:r.string().describe("Outcome ID")}),Rd=r.object({}),Id=r.object({teamId:r.string(),teamName:r.string(),members:r.array(Os),taskCounts:r.record(ae,r.number()),unreadMessages:r.number(),missionLogEntries:r.number(),activeRuns:r.number(),queuedRuns:r.number(),outcomeCounts:r.record(ve,r.number())}),Ls=r.object({id:r.string(),title:r.string(),description:r.string(),status:ae,createdAt:N,updatedAt:N,createdBy:r.string(),assignee:r.string().optional(),dependsOn:r.array(r.string()),summary:r.string().optional(),isReady:r.boolean(),blockedBy:r.array(r.string())}),vd=r.discriminatedUnion("action",[r.object({action:r.literal("create"),taskId:r.string(),status:ae,ignoredFields:r.array(r.string()).optional(),note:r.string().optional()}),r.object({action:r.literal("list"),tasks:r.array(Ls)}),r.object({action:r.literal("claim"),taskId:r.string(),status:ae,nextStep:r.string()}),r.object({action:r.literal("complete"),taskId:r.string(),status:ae}),r.object({action:r.literal("block"),taskId:r.string(),status:ae})]),Md=r.object({agentId:r.string(),mode:r.enum(["sync","async"]),status:r.enum(["dispatched","running","queued","joined"]),dispatched:r.boolean(),message:r.string(),deduped:r.boolean().optional(),runId:r.string().optional(),text:r.string().optional(),iterations:r.number().optional()}),Ds=r.object({textPreview:r.string(),iterations:r.number(),finishReason:r.string(),durationMs:r.number(),usage:r.object({inputTokens:r.number(),outputTokens:r.number(),cacheReadTokens:r.number().optional(),cacheWriteTokens:r.number().optional(),totalCost:r.number().optional()})}),Pd=r.object({id:r.string(),agentId:r.string(),taskId:r.string().optional(),status:bo,messagePreview:r.string(),priority:r.number(),retryCount:r.number(),maxRetries:r.number(),nextAttemptAt:N.optional(),continueConversation:r.boolean().optional(),startedAt:N,endedAt:N.optional(),leaseOwner:r.string().optional(),heartbeatAt:N.optional(),lastProgressAt:N.optional(),lastProgressMessage:r.string().optional(),currentActivity:r.string().optional(),error:r.string().optional(),resultSummary:Ds.optional()}),_d=r.object({id:r.string(),teamId:r.string(),fromAgentId:r.string(),toAgentId:r.string(),subject:r.string(),body:r.string(),taskId:r.string().optional(),sentAt:N,readAt:N.optional()}),wd=r.object({id:r.string(),teamId:r.string(),title:r.string(),status:ve,requiredSections:r.array(r.string()),createdBy:r.string(),createdAt:N,finalizedAt:N.optional()}),Od=r.object({outcomeId:r.string(),status:ve,requiredSections:r.array(r.string())}),Nd=r.object({agentId:r.string(),status:r.string()}),Ld=r.object({runId:r.string(),status:bo}),Dd=r.object({id:r.string(),toAgentId:r.string()}),Bd=r.object({delivered:r.number()}),Hd=r.object({id:r.string()}),Ud=r.object({status:r.string()}),Fd=r.object({fragmentId:r.string(),status:r.string()}),Gd=r.object({outcomeId:r.string(),status:ve});var Bs;((C)=>{C.TaskStart="task_start";C.TaskEnd="task_end";C.AgentEvent="agent_event";C.TeammateSpawned="teammate_spawned";C.TeammateShutdown="teammate_shutdown";C.TeamTaskUpdated="team_task_updated";C.TeamMessage="team_message";C.TeamMissionLog="team_mission_log";C.TeamTaskCompleted="team_task_completed";C.RunStarted="run_started";C.RunQueued="run_queued";C.RunProgress="run_progress";C.RunCompleted="run_completed";C.RunFailed="run_failed";C.RunCancelled="run_cancelled";C.RunInterrupted="run_interrupted";C.OutcomeCreated="outcome_created";C.OutcomeFragmentAttached="outcome_fragment_attached";C.OutcomeFragmentReviewed="outcome_fragment_reviewed";C.OutcomeFinalized="outcome_finalized"})(Bs||={});import{z as Hs}from"zod";function Us(e){let{$schema:t,...n}=e;if(typeof n.type==="string")return n;if("properties"in n||"required"in n||"additionalProperties"in n)return{type:"object",...n};for(let o of["oneOf","anyOf","allOf"]){let i=n[o];if(!Array.isArray(i)||i.length===0)continue;if(o==="allOf"){if(i.some((c)=>c&&typeof c==="object"&&c.type==="object"))return{type:"object",...n};throw Error('Tool inputSchema must describe an object at the top level, but the schema has a top-level "allOf" with no branch that asserts type: "object". Add type: "object" to at least one allOf branch to make the object constraint explicit.')}if(i.every((d)=>d&&typeof d==="object"&&d.type==="object"))return{type:"object",...n};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${o}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return n}function Fs(e){let t=Us(e.inputSchema instanceof Hs.ZodType?ut(e.inputSchema):e.inputSchema);return{name:e.name,resultPolicy:e.resultPolicy,description:e.description,inputSchema:t,lifecycle:e.lifecycle,executionMode:e.executionMode,timeoutMs:e.timeoutMs??30000,retryable:e.retryable??!0,maxRetries:e.maxRetries??3,execute:e.execute}}var xo=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function Gs(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return xo.some((n)=>t.includes(n))}export{Xi as AGENT_UNEXPECTED_REASONING_TOKENS_EVENT,Li as APIKeySchema,xo as AUTH_ERROR_PATTERNS,ta as AgentConfigSchema,Bo as AgentFinishReasonSchema,ea as AgentResultSchema,Ho as AgentUsageSchema,no as AllowedMCPServerSchema,eo as AnthropicModelSchema,to as AnthropicSchema,vo as ApiFormat,Mt as ApiFormatSchema,Wn as AwsBedrockCustomModelSchema,zn as AwsBedrockModelSchema,Kn as AwsBedrockSettingsSchema,jr as CHARS_PER_TOKEN,Ps as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,_i as CLINE_DEFAULT_MODEL_ID,Bi as CLINE_DEFAULT_RPC_ADDRESS,Di as CLINE_DEFAULT_RPC_PORT,ht as CLINE_ENVIRONMENTS,zi as CLINE_ENVIRONMENT_ENV,Wi as CLINE_ENVIRONMENT_OVERRIDE_ENV,Ms as CLINE_WORKSPACES_DIRECTORY_NAME,za as CONFIGURABLE_MODEL_TOOL_NAMES,Vt as CONNECTOR_CATALOG,qt as CONNECTOR_PLATFORMS,ma as CURRENT_HUB_PROTOCOL_VERSION,$n as ClineModelSchema,Jn as ClineSettingsSchema,Fo as ConnectorAuthorizationDecisionSchema,Uo as ConnectorAuthorizationRequestSchema,Ft as ConnectorEventActorSchema,Gt as ConnectorEventContextSchema,Ut as ConnectorHookEventNameSchema,Go as ConnectorHookEventSchema,Be as ContributionRegistry,Ki as DEFAULT_CLINE_ENVIRONMENT,Fe as DEFAULT_MAX_IMAGE_BASE64_BYTES,U as DEFAULT_MAX_IMAGE_DECODED_BYTES,D as DEFAULT_MAX_IMAGE_ENCODED_BYTES,cn as DEFAULT_MAX_TOTAL_MEDIA_BYTES,Xa as DEFAULT_MCP_TIMEOUT_SECONDS,ws as DEFAULT_OUTCOME_REQUIRED_SECTIONS,Ur as DEFAULT_REASONING_EFFORT,yo as DEFAULT_RUNTIME_CONFIG_EXTENSIONS,ce as EMPTY_CONTENT_TEXT,io as EnterpriseTelemetrySchema,er as FEATURE_FLAGS,Q as FeatureFlag,Zo as FeatureFlagDefaultValue,sn as GeneratedMediaModalitySchema,dn as GeneratedMediaSchema,an as GeneratedMediaSourceSchema,ft as GlobalInstructionsFileSchema,ha as HUB_CAPABILITIES,Pa as HUB_CHECKPOINT_CAPABILITY,xa as HUB_CLIENT_TOOL_APPROVAL_CAPABILITY,Ea as HUB_COMMAND_SLOW_LOG_MS,Ma as HUB_COMPACTION_CAPABILITY,Ia as HUB_CUSTOM_TOOL_CAPABILITY_PREFIX,ur as HUB_DEFAULT_COMMAND_TIMEOUT_MS,va as HUB_HOOK_CAPABILITY_PREFIX,_a as HUB_MISTAKE_LIMIT_CAPABILITY,Xt as HUB_SCHEDULE_MODES,Ra as HUB_TOOL_EXECUTOR_CAPABILITY_PREFIX,gr as HUB_TOOL_EXECUTOR_NAMES,wa as HUB_USER_INSTRUCTIONS_SNAPSHOT_CAPABILITY,Jt as HookEventNameSchema,Yt as HookEventPayloadSchema,Z as IMAGE_OMITTED_PLACEHOLDER,ee as IMAGE_UNSUPPORTED_PLACEHOLDER,Qn as LiteLLMModelSchema,Zn as LiteLLMSchema,ya as MAX_CLIENT_HUB_PROTOCOL_VERSION,Za as MAX_MCP_TIMEOUT_SECONDS,fa as MIN_CLIENT_HUB_PROTOCOL_VERSION,Qa as MIN_MCP_TIMEOUT_SECONDS,qa as MODEL_TOOL_NAMES,Un as MODE_TAG_INSTRUCTIONS,Pt as ModelCapabilitySchema,xe as ModelInfoSchema,Nt as ModelMetadataSchema,Lt as ModelModalitiesSchema,Ne as ModelModalitySchema,Ht as ModelOperationModeSchema,Bt as ModelOperationSchema,wt as ModelPricingSchema,Oe as ModelReasoningOptionSchema,_t as ModelStatusSchema,Ta as ONE_TIME_SCHEDULE_CRON_PATTERN,Sa as ONE_TIME_SCHEDULE_RUN_AT_METADATA_KEY,jn as OpenAiCompatibleModelSchema,qn as OpenAiCompatibleSchema,Gn as PLAN_MODE_INSTRUCTIONS,Vn as PLAN_MODE_INSTRUCTIONS_MANUAL_SWITCH,Qo as PLUGIN_FILE_EXTENSIONS,ro as PromptUploadingSchema,Hi as ProviderCapabilitySchema,Fi as ProviderClientSchema,Ui as ProviderProtocolSchema,pe as REASONING_EFFORT_RATIOS,he as REASONING_LEVELS,wi as REMOTE_URI_SCHEME,St as RUNTIME_CONFIG_EXTENSION_KINDS,be as ReasoningEffortSchema,we as ReasoningLevelSchema,Ni as RemoteConfigSchema,oo as RemoteMCPServerSchema,Ie as S3AccessKeySettingsSchema,rs as SDK_ERROR_TELEMETRY_EVENT,nn as SESSION_SEARCH_PREVIEW_MAX_LENGTH,tn as SESSION_SEARCH_TITLE_MAX_LENGTH,Es as SESSION_STATUS_VALUES,Ae as SUPPORTED_IMAGE_MEDIA_TYPES,ns as TASK_CANCELLED_EVENT,es as TASK_FIRST_CHUNK_RECEIVED_EVENT,os as TASK_MAX_TOKENS_RECOVERY_EVENT,Qi as TASK_PROVIDER_REQUEST_STARTED_EVENT,ts as TASK_PROVIDER_STREAM_FAILED_EVENT,Zi as TASK_PROVIDER_STREAM_STARTED_EVENT,rd as TEAM_AWAIT_TIMEOUT_MS,Vi as TEAM_LIFECYCLE_EVENT_TYPE,Gi as TEAM_PROGRESS_EVENT_TYPE,id as TEAM_RUN_MESSAGE_PREVIEW_LIMIT,sd as TEAM_RUN_TEXT_PREVIEW_LIMIT,ud as TEAM_TASK_IGNORED_FIELDS_BY_ACTION,Do as TOOL_REJECTION_SUFFIX,Ed as TeamAttachOutcomeFragmentInputSchema,yd as TeamAwaitRunsInputSchema,bd as TeamBroadcastInputSchema,Bd as TeamBroadcastToolResultSchema,fd as TeamCancelRunInputSchema,Ld as TeamCancelRunToolResultSchema,Sd as TeamCleanupInputSchema,Ud as TeamCleanupToolResultSchema,Ad as TeamCreateOutcomeInputSchema,Od as TeamCreateOutcomeToolResultSchema,Cd as TeamFinalizeOutcomeInputSchema,Gd as TeamFinalizeOutcomeToolResultSchema,Rd as TeamListOutcomesInputSchema,md as TeamListRunsInputSchema,_d as TeamMailboxMessageToolResultSchema,Bs as TeamMessageType,Td as TeamMissionLogInputSchema,Hd as TeamMissionLogToolResultSchema,Fd as TeamOutcomeFragmentToolResultSchema,wd as TeamOutcomeToolResultSchema,xd as TeamReadMailboxInputSchema,kd as TeamReviewOutcomeFragmentInputSchema,Ds as TeamRunResultSummarySchema,gd as TeamRunTaskInputSchema,Md as TeamRunTaskToolResultSchema,Pd as TeamRunToolSummarySchema,hd as TeamSendMessageInputSchema,Dd as TeamSendMessageToolResultSchema,dd as TeamShutdownTeammateInputSchema,Nd as TeamSimpleAgentStatusToolResultSchema,ld as TeamSpawnTeammateInputSchema,cd as TeamStatusInputSchema,Id as TeamStatusToolResultSchema,pd as TeamTaskInputSchema,Ls as TeamTaskListItemToolResultSchema,vd as TeamTaskToolResultSchema,ad as TeamTeammateSpecSchema,Ot as ThinkingConfigSchema,De as ToolCallRecordSchema,Ga as USAGE_COST_DISPLAYS,Lo as USER_REJECTED_TOOL_REASON,Yn as VertexModelSchema,Xn as VertexSettingsSchema,Is as WorkspaceInfoSchema,vs as WorkspaceManifestSchema,vi as buildClineSystemPrompt,uo as buildSdkErrorProperties,ls as captureAgentUnexpectedReasoningTokens,cs as captureSdkError,ds as captureTaskLifecycleEvent,Kr as clampMcpTimeoutSeconds,jo as connectorChannelsFromPlatforms,hs as createClineTelemetryServiceConfig,go as createClineTelemetryServiceMetadata,Xo as createContributionRegistry,Ee as createMediaBudgetState,br as createModeSwitchNoticeTracker,As as createSessionId,Fs as createTool,di as decodeJwtPayload,Oa as describeOutdatedHubSessions,Zl as emptyWorkspaceManifest,qr as estimateRequestInputTokens,Sn as estimateTokens,Ue as formatDisplayUserInput,He as formatFileContentBlock,Ci as formatHumanReadableDate,tl as formatMcpTimeoutErrorMessage,Br as formatMessagesForAiSdk,hr as formatModeSwitchNotice,Er as formatSessionSearchPreview,Ar as formatSessionSearchTitle,Ri as formatUptime,yr as formatUserCommandBlock,fr as formatUserInputBlock,Cr as generatedMediaModalityFromMediaType,qi as getClineClientIdentity,Yi as getClineEnvironmentConfig,pr as getDefaultHubCommandTimeoutMs,ui as getDefaultShell,Jr as getErrorCode,$r as getErrorMessage,xi as getShellArgs,On as getShellInvocation,ct as getShellKind,Rs as hasRuntimeConfigExtension,Ge as imageBase64DecodedByteLength,Rr as imageBase64EncodedByteLength,Ve as imageBase64LengthForDecodedBytes,Ir as imageFileMaxDecodedBytesForBase64Limit,un as isBase64Char,vr as isCanonicalBase64,Po as isChatCompatibleModel,_s as isChatWorkspacePath,pt as isClineProvider,kr as isGeneratedMedia,ba as isHubProtocolCompatible,cr as isHubScheduleMode,Ca as isHubToolExecutorName,Gs as isLikelyAuthError,Wr as isMcpTimeoutConfigured,ho as isRuntimeConfigExtensionKind,Mo as isTranscriptionModel,jt as listConnectorCatalog,Ei as maskSecret,Hr as mergeModelOptions,Le as modelHasCapability,_o as modelProducesImages,No as modelSupportsImageInput,Oo as modelSupportsToolCalling,zr as noopBasicLogger,dt as normalizeJsonLikeStringsForSchema,$t as normalizePluginManifest,Tt as normalizeSdkError,Zt as normalizeUserInput,ci as omitUndefinedValues,dr as parseHookEventPayload,oi as parseJsonStream,Cs as parseRuntimeConfigExtensions,Qt as parseUserCommandEnvelope,Aa as readHubScheduleMode,le as reserveImageMediaBytes,is as resetSdkErrorRateLimiterForTests,co as resolveClineEnvironment,Fr as resolveEffectiveReasoningEffort,bs as resolveHookSessionContext,ka as resolveHubCommandTimeoutMs,el as resolveMcpTimeoutSeconds,je as resolveMediaBudget,Mi as resolveProviderApiKeyOptional,Pi as resolveProviderLocalCli,Gr as resolveReasoningBudgetFromRatio,Tn as resolveReasoningEffortRatio,xs as resolveRootSessionId,ii as safeJsonParse,ri as safeJsonStringify,Ti as sanitizeFileName,_ as sanitizeSurrogates,Vr as serializeAbortReason,ji as setClineClientIdentity,Vo as shouldIncludeConnectorField,en as stripModeNotices,ki as stripUtf8Bom,Dt as supportsChatModalities,bn as toAiSdkToolResultOutput,Si as trimNonEmpty,Ai as truncateSplit,Nn as truncateStr,ed as upsertWorkspaceInfo,wo as usesImageGenerationOperation,Mr as validateAndReserveBase64Media,de as validateAndReserveImageMedia,gn as validateImageMedia,Ii as validateWithZod,rn as xmlTagsRemoval,ut as zodToJsonSchema};
|
package/dist/index.js
CHANGED
|
@@ -164,7 +164,7 @@ ${o}`}function Lh(e){let{ide:t="Terminal Shell",mode:n,platform:o="unknown",work
|
|
|
164
164
|
|
|
165
165
|
${od(d,r,i)}`.trim();return g}let m=n==="yolo"?qr.YOLO:qr.ACT,f=[s,n==="yolo"?void 0:rd,n==="plan"?l?sd:ad:void 0].filter(Boolean).join(`
|
|
166
166
|
|
|
167
|
-
`);return m.replace("{{PLATFORM_NAME}}",o).replace("{{CWD}}",d).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",p?od(d,r,i):"").replace("{{CLINE_RULES}}",f).trim()}function Dh(e){return e?.metadata?.apiKeyOptional===!0}function Bh(e){let t=e?.metadata?.localCliCommand;if(typeof t!=="string"||!t.trim())return;return{command:t.trim(),docsUrl:e?.docsUrl}}var Uh="anthropic/claude-sonnet-5";import ge from"node:fs/promises";import Kr from"node:path";async function Zh(e){try{return await ge.access(e),!0}catch{return!1}}class Wr{filePath;constructor(e){this.filePath=e}async read(){try{return JSON.parse(await ge.readFile(this.filePath,"utf8"))}catch(e){if(e.code==="ENOENT")return;throw e}}async write(e){await ge.mkdir(Kr.dirname(this.filePath),{recursive:!0}),await ge.writeFile(this.filePath,JSON.stringify(e,null,2),"utf8")}async clear(){await ge.rm(this.filePath,{force:!0})}}class En{async writeText(e,t){await ge.mkdir(Kr.dirname(e),{recursive:!0}),await ge.writeFile(e,t,"utf8")}async remove(e){await ge.rm(e,{recursive:!0,force:!0})}async removeChildren(e){if(!await Zh(e))return;let t=await ge.readdir(e);await Promise.all(t.map((n)=>ge.rm(Kr.join(e,n),{recursive:!0,force:!0})))}}import{createHmac as Vh}from"node:crypto";import{basename as qh}from"node:path";var Yr=new TextEncoder,Fh={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},Hh=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class Rn{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:n,service:o,region:r,cache:i,retries:s,initRetryMs:a}){if(e==null)throw TypeError("accessKeyId is a required option");if(t==null)throw TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n,this.service=o,this.region=r,this.cache=i||new Map,this.retries=s!=null?s:10,this.initRetryMs=a||50}async sign(e,t){if(e instanceof Request){let{method:r,url:i,headers:s,body:a}=e;if(t=Object.assign({method:r,url:i,headers:s},t),t.body==null&&s.has("Content-Type"))t.body=a!=null&&s.has("X-Amz-Content-Sha256")?a:await e.clone().arrayBuffer();e=i}let n=new dd(Object.assign({url:e.toString()},t,this,t&&t.aws)),o=Object.assign({},t,await n.sign());delete o.aws;try{return new Request(o.url.toString(),o)}catch(r){if(r instanceof TypeError)return new Request(o.url.toString(),Object.assign({duplex:"half"},o));throw r}}async fetch(e,t){for(let n=0;n<=this.retries;n++){let o=fetch(await this.sign(e,t));if(n===this.retries)return o;let r=await o;if(r.status<500&&r.status!==429)return r;await new Promise((i)=>setTimeout(i,Math.random()*this.initRetryMs*Math.pow(2,n)))}throw Error("An unknown error occurred, ensure retries is not negative")}}class dd{constructor({method:e,url:t,headers:n,body:o,accessKeyId:r,secretAccessKey:i,sessionToken:s,service:a,region:c,cache:l,datetime:d,signQuery:p,appendSessionToken:m,allHeaders:f,singleEncode:g}){if(t==null)throw TypeError("url is a required option");if(r==null)throw TypeError("accessKeyId is a required option");if(i==null)throw TypeError("secretAccessKey is a required option");this.method=e||(o?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(n||{}),this.body=o,this.accessKeyId=r,this.secretAccessKey=i,this.sessionToken=s;let y,S;if(!a||!c)[y,S]=jh(this.url,this.headers);if(this.service=a||y||"",this.region=c||S||"us-east-1",this.cache=l||new Map,this.datetime=d||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=p,this.appendSessionToken=m||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256"))this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");let v=this.signQuery?this.url.searchParams:this.headers;if(v.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken)v.set("X-Amz-Security-Token",this.sessionToken);if(this.signableHeaders=["host",...this.headers.keys()].filter((M)=>f||!Hh.has(M)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map((M)=>M+":"+(M==="host"?this.url.host:(this.headers.get(M)||"").replace(/\s+/g," "))).join(`
|
|
167
|
+
`);return m.replace("{{PLATFORM_NAME}}",o).replace("{{CWD}}",d).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",t).replace("{{CLINE_METADATA}}",p?od(d,r,i):"").replace("{{CLINE_RULES}}",f).trim()}function Dh(e){return e?.metadata?.apiKeyOptional===!0}function Bh(e){let t=e?.metadata?.localCliCommand;if(typeof t!=="string"||!t.trim())return;return{command:t.trim(),docsUrl:e?.docsUrl}}var Uh="anthropic/claude-sonnet-5.5";import ge from"node:fs/promises";import Kr from"node:path";async function Zh(e){try{return await ge.access(e),!0}catch{return!1}}class Wr{filePath;constructor(e){this.filePath=e}async read(){try{return JSON.parse(await ge.readFile(this.filePath,"utf8"))}catch(e){if(e.code==="ENOENT")return;throw e}}async write(e){await ge.mkdir(Kr.dirname(this.filePath),{recursive:!0}),await ge.writeFile(this.filePath,JSON.stringify(e,null,2),"utf8")}async clear(){await ge.rm(this.filePath,{force:!0})}}class En{async writeText(e,t){await ge.mkdir(Kr.dirname(e),{recursive:!0}),await ge.writeFile(e,t,"utf8")}async remove(e){await ge.rm(e,{recursive:!0,force:!0})}async removeChildren(e){if(!await Zh(e))return;let t=await ge.readdir(e);await Promise.all(t.map((n)=>ge.rm(Kr.join(e,n),{recursive:!0,force:!0})))}}import{createHmac as Vh}from"node:crypto";import{basename as qh}from"node:path";var Yr=new TextEncoder,Fh={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},Hh=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);class Rn{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:n,service:o,region:r,cache:i,retries:s,initRetryMs:a}){if(e==null)throw TypeError("accessKeyId is a required option");if(t==null)throw TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n,this.service=o,this.region=r,this.cache=i||new Map,this.retries=s!=null?s:10,this.initRetryMs=a||50}async sign(e,t){if(e instanceof Request){let{method:r,url:i,headers:s,body:a}=e;if(t=Object.assign({method:r,url:i,headers:s},t),t.body==null&&s.has("Content-Type"))t.body=a!=null&&s.has("X-Amz-Content-Sha256")?a:await e.clone().arrayBuffer();e=i}let n=new dd(Object.assign({url:e.toString()},t,this,t&&t.aws)),o=Object.assign({},t,await n.sign());delete o.aws;try{return new Request(o.url.toString(),o)}catch(r){if(r instanceof TypeError)return new Request(o.url.toString(),Object.assign({duplex:"half"},o));throw r}}async fetch(e,t){for(let n=0;n<=this.retries;n++){let o=fetch(await this.sign(e,t));if(n===this.retries)return o;let r=await o;if(r.status<500&&r.status!==429)return r;await new Promise((i)=>setTimeout(i,Math.random()*this.initRetryMs*Math.pow(2,n)))}throw Error("An unknown error occurred, ensure retries is not negative")}}class dd{constructor({method:e,url:t,headers:n,body:o,accessKeyId:r,secretAccessKey:i,sessionToken:s,service:a,region:c,cache:l,datetime:d,signQuery:p,appendSessionToken:m,allHeaders:f,singleEncode:g}){if(t==null)throw TypeError("url is a required option");if(r==null)throw TypeError("accessKeyId is a required option");if(i==null)throw TypeError("secretAccessKey is a required option");this.method=e||(o?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(n||{}),this.body=o,this.accessKeyId=r,this.secretAccessKey=i,this.sessionToken=s;let y,S;if(!a||!c)[y,S]=jh(this.url,this.headers);if(this.service=a||y||"",this.region=c||S||"us-east-1",this.cache=l||new Map,this.datetime=d||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=p,this.appendSessionToken=m||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256"))this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");let v=this.signQuery?this.url.searchParams:this.headers;if(v.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken)v.set("X-Amz-Security-Token",this.sessionToken);if(this.signableHeaders=["host",...this.headers.keys()].filter((M)=>f||!Hh.has(M)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map((M)=>M+":"+(M==="host"?this.url.host:(this.headers.get(M)||"").replace(/\s+/g," "))).join(`
|
|
168
168
|
`),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery){if(this.service==="s3"&&!v.has("X-Amz-Expires"))v.set("X-Amz-Expires","86400");v.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),v.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),v.set("X-Amz-SignedHeaders",this.signedHeaders)}if(this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch(M){this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");if(!g)this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/");this.encodedPath=ld(this.encodedPath);let k=new Set;this.encodedSearch=[...this.url.searchParams].filter(([M])=>{if(!M)return!1;if(this.service==="s3"){if(k.has(M))return!1;k.add(M)}return!0}).map((M)=>M.map((R)=>ld(encodeURIComponent(R)))).sort(([M,R],[B,A])=>M<B?-1:M>B?1:R<A?-1:R>A?1:0).map((M)=>M.join("=")).join("&")}async sign(){if(this.signQuery){if(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken)this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)}else this.headers.set("Authorization",await this.authHeader());return{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){let e=this.datetime.slice(0,8),t=[this.secretAccessKey,e,this.region,this.service].join(),n=this.cache.get(t);if(!n){let o=await Nt("AWS4"+this.secretAccessKey,e),r=await Nt(o,this.region),i=await Nt(r,this.service);n=await Nt(i,"aws4_request"),this.cache.set(t,n)}return Jr(await Nt(n,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,Jr(await cd(await this.canonicalString()))].join(`
|
|
169
169
|
`)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+`
|
|
170
170
|
`,this.signedHeaders,await this.hexBodyHash()].join(`
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Fallback default model for the Cline provider. The `cline` provider manifest
|
|
3
|
+
* in `@cline/llms` prefers the first entry of the Cline recommended-models list
|
|
4
|
+
* and falls back to this id when that list is empty.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CLINE_DEFAULT_MODEL_ID = "anthropic/claude-sonnet-5.5";
|
package/dist/storage/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as _,readdirSync as _e}from"node:fs";import{basename as j,dirname as V,join as J}from"node:path";var Se=/[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g,ve=" ";function K(e){return e.normalize("NFC").replace(Se," ")}function Ne(e){let r=j(e),n=r.replace(/ (AM|PM)\./gi,`${ve}$1.`);return n===r?e:J(V(e),n)}function Re(e){return e.normalize("NFD")}function U(e){return e.replace(/'/g,"’")}function Ie(e){let r=V(e),n=K(j(e));try{for(let o of _e(r))if(K(o)===n)return J(r,o)}catch{}return}function me(e){if(_(e))return e;let r=Ne(e);if(r!==e&&_(r))return r;let n=Re(e);if(n!==e&&_(n))return n;let o=U(e);if(o!==e&&_(o))return o;let s=U(n);if(s!==n&&s!==o&&_(s))return s;return Ie(e)}import{appendFileSync as Ae,existsSync as u,mkdirSync as
|
|
1
|
+
import{existsSync as _,readdirSync as _e}from"node:fs";import{basename as j,dirname as V,join as J}from"node:path";var Se=/[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g,ve=" ";function K(e){return e.normalize("NFC").replace(Se," ")}function Ne(e){let r=j(e),n=r.replace(/ (AM|PM)\./gi,`${ve}$1.`);return n===r?e:J(V(e),n)}function Re(e){return e.normalize("NFD")}function U(e){return e.replace(/'/g,"’")}function Ie(e){let r=V(e),n=K(j(e));try{for(let o of _e(r))if(K(o)===n)return J(r,o)}catch{}return}function me(e){if(_(e))return e;let r=Ne(e);if(r!==e&&_(r))return r;let n=Re(e);if(n!==e&&_(n))return n;let o=U(e);if(o!==e&&_(o))return o;let s=U(n);if(s!==n&&s!==o&&_(s))return s;return Ie(e)}import{appendFileSync as Ae,existsSync as u,mkdirSync as G,readdirSync as Pe,readFileSync as B,statSync as E}from"node:fs";import{homedir as he}from"node:os";import{basename as Oe,dirname as O,extname as xe,isAbsolute as Te,join as t,relative as de,resolve as g}from"node:path";var N="workspaces",R="chat";function z(e){let r=e.trim(),n=/^[A-Za-z]:[\\/]/.test(r)||r.startsWith("\\\\"),o=r.startsWith("/");if(!n&&!o)return!1;let s=r.split(n?/[\\/]+/:/\/+/).filter(Boolean),i=s.at(-1)??"",c=s.at(-2)??"",a=s.at(-3)??"";return(s.at(-4)??"")===".cline"&&a==="data"&&c==="workspaces"&&i==="chat"}var y=".clinerules",x=".cline",Le=".claude",T=".agents",ke=T,F="agents",I="hooks",A="skills",W="rules",m="workflows",k="plugins",b="AGENTS.md",X="plugin.json";function Me(){return t(p(),N,R)}var Z="cline_mcp_settings.json",q="settings.json";function Ge(){let e=process?.env?.HOME?.trim();if(e&&e!=="~")return e;let r=process?.env?.USERPROFILE?.trim();if(r)return r;let n=process?.env?.HOMEDRIVE?.trim(),o=process?.env?.HOMEPATH?.trim();if(n&&o)return`${n}${o}`;let s=he().trim();if(s&&s!=="~")return s;return"~"}var f=Ge(),Q=!1;function ye(e){let r=e.trim();if(!r)return;f=r,Q=!0}function Fe(e){if(Q)return;let r=e.trim();if(!r)return;f=r}var P,ee=!1;function We(e){let r=e.trim();if(!r)return;P=r,ee=!0}function be(e){if(ee)return;let r=e.trim();if(!r)return;P=r}function l(){if(P)return P;let e=process.env.CLINE_DIR?.trim();if(e)return e;return t(f,".cline")}function re(){return t(f,"Documents","Cline")}function v(e){return t(re(),e)}function p(){let e=process.env.CLINE_DATA_DIR?.trim();if(e)return e;return t(l(),"data")}function He(){let e=process.env.CLINE_SESSION_DATA_DIR?.trim();if(e)return e;return t(p(),"sessions")}function we(){let e=process.env.CLINE_TEAM_DATA_DIR?.trim();if(e)return e;return t(p(),"teams")}function te(){let e=process.env.CLINE_CONNECTOR_DATA_DIR?.trim();if(e)return e;return t(p(),"connectors")}function Ye(e,r){let n=e.replace(/[^a-zA-Z0-9._-]+/g,"_"),o=r.replace(/[^a-zA-Z0-9._-]+/g,"_");return t(p(),"logs","connectors",n,`${o}.log`)}function Ke(){let e=process.env.CLINE_CONNECTOR_SETTINGS_PATH?.trim();if(e)return e;return t(te(),q)}function d(){let e=process.env.CLINE_DB_DATA_DIR?.trim();if(e)return e;return t(p(),"db")}function Ue(){let e=process.env.CLINE_CONNECTORS_DB_PATH?.trim();if(e)return e;return t(d(),"connectors.db")}function je(){let e=process.env.CLINE_CRON_DB_PATH?.trim();if(e)return e;return t(d(),"cron.db")}function Ve(){let e=process.env.CLINE_TASKS_DB_PATH?.trim();if(e)return e;return t(d(),"tasks.db")}function Je(){return t(l(),"schedules")}function ne(){return t(l(),"tasks")}function se(e){let r=e.trim();if(!r)throw Error("workspaceRoot is required for workspace task scope");return t(r,".cline","tasks")}function $e(e){let r=e.taskSpecsDir?.trim();if(r)return r;if(e.scope==="workspace")return se(e.workspaceRoot??"");return ne()}function oe(){return t(l(),"cron")}function M(e){return t(e,".cline","cron")}function H(e){if(typeof e==="string")return M(e);if(e?.cronSpecsDir?.trim())return e.cronSpecsDir.trim();if(e?.scope==="workspace"){let r=e.workspaceRoot?.trim();if(!r)throw Error("workspaceRoot is required for workspace cron scope");return M(r)}return oe()}function ze(e){return t(H(e),"reports")}function Be(e){return t(H(e),"events")}function Xe(){let e=process.env.CLINE_PROVIDER_SETTINGS_PATH?.trim();if(e)return e;return t(p(),"settings","providers.json")}function Ze(){let e=process.env.CLINE_GLOBAL_SETTINGS_PATH?.trim();if(e)return e;return t(p(),"settings","global-settings.json")}function qe(){let e=process.env.CLINE_MCP_SETTINGS_PATH?.trim();if(e)return e;return t(p(),"settings",Z)}function C(e){let r=new Set,n=[];for(let o of e){if(!o||r.has(o))continue;r.add(o),n.push(o)}return n}function Qe(e){if(!e)return[];return[y,x,Le,T].map((r)=>t(e,r,A))}function ie(){return t(l(),F)}function er(e){return C([e?t(e,x,F):"",ie()])}function rr(e){let r=[v("Hooks"),t(l(),I)];if(e)r.push(t(e,y,I),t(e,x,I));return C(r)}function tr(e){return C([...Qe(e),t(l(),A),t(f,T,A)])}function ce(){return t(f,T,b)}function ae(e){return[t(e,y),t(e,x,W)]}function nr(){let e=[];for(let r of["OneDrive","OneDriveConsumer","OneDriveCommercial"]){let n=process.env[r]?.trim();if(n)e.push(t(n,"Documents"))}return e}function ue(){return C([t(l(),W),t(f,"Cline","Rules"),v("Rules"),...nr().map((e)=>t(e,"Cline","Rules"))])}function sr(e){let r=e?ae(e):[],n=e?[t(e,b)]:[];return C([...n,...r,ce(),...ue()])}function or(e){return C([e?t(e,".clinerules",m):"",v("Workflows"),t(l(),m),e?t(e,".cline",m):""])}function ir(e){return C([e?t(e,".cline",k):"",t(l(),k),v("Plugins")])}function cr(){return[t(f,ke,k)]}var le=new Set([".js",".ts"]),w="package.json",ar=["index.ts","index.js"],ur=new Set(["node_modules"]);function h(e){try{return E(t(e,X)).isFile()}catch{return!1}}function S(e){let r=e.lastIndexOf(".");if(r===-1)return!1;return le.has(e.slice(r))}function pe(e){try{let r=JSON.parse(B(e,"utf8"));if(!r.cline||typeof r.cline!=="object")return null;return r.cline}catch{return null}}function ge(e){let r=e?.plugins;if(!Array.isArray(r))return[];return r.flatMap((n)=>n.paths??[])}function fe(e){let r=g(e);if(!u(r)||!E(r).isDirectory())return null;if(h(r))return null;let n=t(r,w);if(u(n)){let o=pe(n),s=ge(o).map((i)=>g(r,i)).filter((i)=>u(i)&&E(i).isFile()&&S(i));if(s.length>0)return s}for(let o of ar){let s=t(r,o);if(u(s)&&E(s).isFile())return[s]}return null}function lr(e){try{let r=JSON.parse(B(e,"utf8"));return typeof r.name==="string"&&r.name.trim()?r.name.trim():void 0}catch{return}}function pr(e,r){let n=de(g(e),g(r));return n===""||!n.startsWith("..")&&!Te(n)}function gr(e,r){let n=O(e),o=g(r);while(pr(o,n)){let s=t(n,w);if(u(s)){let c=lr(s);if(c)return c;break}let i=g(n,"..");if(i===n)break;n=i}return Oe(e,xe(e))}function Ce(e){let r=g(e);if(!u(r))return[];if(h(r))return[];let n=[],o=[r];while(o.length>0){let s=o.pop();if(!s)continue;let i;try{i=Pe(s,{withFileTypes:!0})}catch{continue}for(let c of i){let a=t(s,c.name);if(c.isDirectory()){if(h(a))continue;if(ur.has(c.name)||c.name.startsWith("."))continue;let L=t(a,w);if(u(L)){let De=pe(L),Y=ge(De).map((D)=>g(a,D)).filter((D)=>u(D)&&E(D).isFile()&&S(D));if(Y.length>0){n.push(...Y);continue}}o.push(a);continue}if(c.name.startsWith("."))continue;if(c.isFile()&&S(a))n.push(a)}}return n.sort((s,i)=>s.localeCompare(i))}function fr(e,r){let n=[];for(let o of e){let s=o.trim();if(!s)continue;let i=g(r,s);if(!u(i))throw Error(`Plugin path does not exist: ${i}`);if(E(i).isDirectory()){let a=fe(i);if(a){n.push(...a);continue}n.push(...Ce(i));continue}if(!S(i))throw Error(`Plugin file must use a supported extension (${[...le].join(", ")}): ${i}`);n.push(i)}return n}function Ee(e){let r=O(e);if(!u(r))G(r,{recursive:!0})}function Cr(e){G(O(e),{recursive:!0}),Ae(e,"")}function Er(e){if(e?.trim())return Ee(e),O(e);let r=t(p(),"logs");if(!u(r))G(r,{recursive:!0});return r}export{b as AGENTS_RULES_FILE_NAME,F as AGENT_CONFIG_DIRECTORY_NAME,X as AGENT_PLUGIN_MANIFEST_FILE_NAME,R as CLINE_CHAT_WORKSPACE_DIRECTORY_NAME,q as CLINE_CONNECTOR_SETTINGS_FILE_NAME,Z as CLINE_MCP_SETTINGS_FILE_NAME,N as CLINE_WORKSPACES_DIRECTORY_NAME,I as HOOKS_CONFIG_DIRECTORY_NAME,W as RULES_CONFIG_DIRECTORY_NAME,A as SKILLS_CONFIG_DIRECTORY_NAME,m as WORKFLOWS_CONFIG_DIRECTORY_NAME,Ce as discoverPluginModulePaths,Cr as ensureFileExists,Er as ensureHookLogDir,Ee as ensureParentDir,gr as getPluginDisplayName,h as isAgentPluginDirectory,z as isChatWorkspacePath,S as isPluginModulePath,er as resolveAgentConfigSearchPaths,cr as resolveAgentPluginSearchPaths,Je as resolveAgentSchedulesDir,ie as resolveAgentsConfigDirPath,Me as resolveChatWorkspacePath,p as resolveClineDataDir,l as resolveClineDir,fr as resolveConfiguredPluginModulePaths,te as resolveConnectorDataDir,Ye as resolveConnectorLogPath,Ke as resolveConnectorSettingsPath,Ue as resolveConnectorsDbPath,je as resolveCronDbPath,Be as resolveCronEventsDir,ze as resolveCronReportsDir,H as resolveCronSpecsDir,d as resolveDbDataDir,re as resolveDocumentsClineDirectoryPath,v as resolveDocumentsExtensionPath,me as resolveExistingFilePath,ce as resolveGlobalAgentsRulesPath,oe as resolveGlobalCronSpecsDir,ue as resolveGlobalRulesConfigPaths,Ze as resolveGlobalSettingsPath,ne as resolveGlobalTaskSpecsDir,rr as resolveHooksConfigSearchPaths,qe as resolveMcpSettingsPath,ir as resolvePluginConfigSearchPaths,fe as resolvePluginModuleEntries,Xe as resolveProviderSettingsPath,sr as resolveRulesConfigSearchPaths,He as resolveSessionDataDir,tr as resolveSkillsConfigSearchPaths,$e as resolveTaskSpecsDir,Ve as resolveTasksDbPath,we as resolveTeamDataDir,or as resolveWorkflowsConfigSearchPaths,M as resolveWorkspaceCronSpecsDir,ae as resolveWorkspaceRulesConfigPaths,se as resolveWorkspaceTaskSpecsDir,We as setClineDir,be as setClineDirIfUnset,ye as setHomeDir,Fe as setHomeDirIfUnset};
|