@cline/cli-windows-arm64 3.0.47 → 3.0.48
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/bin/cline.exe +0 -0
- package/cline-hub/webview/assets/Chat-BQNWv73R.js +197 -0
- package/cline-hub/webview/assets/{extensions-view-DXvL0IXH.js → extensions-view-CJ08jm5E.js} +1 -1
- package/cline-hub/webview/assets/{index-Be-mNsEe.js → index-jvbYRXxp.js} +2 -2
- package/cline-hub/webview/assets/{label-BwsGMt3P.js → label-GlIPa0AI.js} +1 -1
- package/cline-hub/webview/assets/settings-view-D5cF4Vg-.js +65 -0
- package/cline-hub/webview/index.html +1 -1
- package/extensions/plugin-sandbox-bootstrap.js +1 -1
- package/package.json +1 -1
- package/cline-hub/webview/assets/Chat-BA-cxecm.js +0 -201
- package/cline-hub/webview/assets/settings-view-B3OOmDmW.js +0 -65
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="./cline-logo-filled.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Cline Hub</title>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-jvbYRXxp.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-CNC7AqOf.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="./assets/bundle-mjs-D3mlU5Wg.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="./assets/react-dom-Cmec2Q1Q.js">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as GG}from"node:module";var QG=GG(import.meta.url);import{normalizePluginManifest as IG}from"@cline/shared";import{existsSync as _,readFileSync as C}from"node:fs";import{builtinModules as UG,createRequire as y}from"node:module";import{dirname as M,extname as I,isAbsolute as XG,resolve as K}from"node:path";import{fileURLToPath as P}from"node:url";import{PLUGIN_FILE_EXTENSIONS as YG}from"@cline/shared";var m=M(P(import.meta.url)),ZG=y(import.meta.url),$G=K(m,"..","..","..","..",".."),S=WG($G),qG=["@cline/sdk","@cline/agents","@cline/core","@cline/core/hub","@cline/core/hub/daemon-entry","@cline/core/telemetry","@cline/llms","@cline/llms/browser","@cline/shared","@cline/shared/automation","@cline/shared/browser","@cline/shared/storage","@cline/shared/db","@cline/shared/types"],b=new Set(UG.flatMap((G)=>[G,G.replace(/^node:/,"")])),j=new Set(YG),KG=["development","node","import","require","default"];function WG(G){let Q={},U={"@cline/sdk":K(G,"packages/sdk/src/index.ts"),"@cline/agents":K(G,"packages/agents/src/index.ts"),"@cline/core":K(G,"packages/core/src/index.ts"),"@cline/llms":K(G,"packages/llms/src/index.ts"),"@cline/shared":K(G,"packages/shared/src/index.ts"),"@cline/shared/storage":K(G,"packages/shared/src/storage/index.ts"),"@cline/shared/db":K(G,"packages/shared/src/db/index.ts")};for(let[Y,Z]of Object.entries(U))if(_(Z))Q[Y]=Z;for(let Y of["agents","core","llms","shared"]){let Z=K(G,"packages",Y),$=K(Z,"package.json");if(!_($))continue;try{let X=JSON.parse(C($,"utf8"));if(typeof X.name!=="string"||!X.exports)continue;if(typeof X.exports==="string"){let q=K(Z,X.exports);if(_(q))Q[X.name]=q;continue}if(typeof X.exports!=="object")continue;for(let[q,w]of Object.entries(X.exports)){let A=_G(Z,w);if(!A)continue;let L=q==="."?X.name:`${X.name}/${q.replace(/^\.\//,"")}`;Q[L]=A}}catch{}}return Q}function _G(G,Q){let U=R(Q);if(!U)return null;let Y=h(G,U);for(let Z of Y)if(_(Z))return Z;return null}function R(G,Q=new Set){if(typeof G==="string")return G;if(!G||typeof G!=="object")return null;if(Q.has(G))return null;Q.add(G);let U=G;for(let Y of KG){let Z=R(U[Y],Q);if(Z)return Z}return null}function h(G,Q){let U=Q.replace(/^\.\//,""),Y=[K(G,Q)];if(U.startsWith("dist/")){let Z=U.replace(/^dist\//,"src/").replace(/\.(mjs|cjs|js)$/,"");return[K(G,`${Z}.ts`),K(G,`${Z}.tsx`),K(G,`${Z}.mts`),K(G,`${Z}.cts`),...Y]}return Y}function LG(G){return Object.fromEntries(Object.entries(G).sort(([Q],[U])=>U.length-Q.length))}function H(G){return!(G.startsWith(".")||G.startsWith("/")||G.startsWith("file:")||G.startsWith("data:")||G.startsWith("http:")||G.startsWith("https:"))}function J(G){if(G.startsWith("@")){let[Q,U]=G.split("/",3);return U?`${Q}/${U}`:G}return G.split("/",1)[0]??G}function wG(G){let Q=J(G);if(G===Q)return".";return`.${G.slice(Q.length)}`}function d(G){return J(G).startsWith("@cline/")}function V(G,Q){let U=J(Q),Y=M(G);while(!0){let Z=K(Y,"node_modules",U);if(_(Z)||_(K(Z,"package.json")))return!0;let $=K(Y,"..");if($===Y)return!1;Y=$}}function f(G){return T(G)!==null}function T(G){try{return ZG.resolve(G)}catch{}return AG(G)}function AG(G){let Q=J(G),U=u(Q);if(!U)return null;let Y=K(U,"package.json");try{let Z=JSON.parse(C(Y,"utf8")),$=wG(G),X=$==="."&&typeof Z.exports==="string"?Z.exports:Z.exports&&typeof Z.exports==="object"&&Object.hasOwn(Z.exports,$)?Z.exports[$]:void 0,q=R(X)??($==="."&&typeof Z.main==="string"?Z.main:null);if(!q)return null;let w=K(U,q),A=[w,...h(U,q).filter((L)=>L!==w)];for(let L of A)if(_(L))return L;return null}catch{return null}}function zG(){let G=[m],Q=process.env.CLINE_WRAPPER_PATH?.trim();if(Q)G.push(M(M(Q)));let U=process.execPath?.trim();if(U)G.push(M(U));return[...new Set(G.map((Y)=>K(Y)))]}function MG(G,Q){let U=G;while(!0){let Y=K(U,"package.json");if(_(Y))try{if(JSON.parse(C(Y,"utf8")).name===Q)return U}catch{}let Z=K(U,"node_modules",Q,"package.json");if(_(Z))return M(Z);let $=K(U,"..");if($===U)return null;U=$}}function u(G){for(let Q of zG()){let U=MG(Q,G);if(U)return U}return null}function FG(G){let U=M(G);for(let Y=0;Y<4;Y++){let Z=K(U,"package.json");if(_(Z))try{let X=JSON.parse(C(Z,"utf8"));return X!=null&&typeof X==="object"&&"cline"in X}catch{return!1}let $=K(U,"..");if($===U)return!1;U=$}return!1}function c(G,Q){let U=Q.startsWith("file:")?P(Q):XG(Q)?Q:K(M(G),Q);if(_(U)&&j.has(I(U)))return U;for(let Y of j){let Z=`${U}${Y}`;if(_(Z))return Z}for(let Y of j){let Z=K(U,`index${Y}`);if(_(Z))return Z}return null}function l(G){let Q=new Set,U=[/\bimport\s+(?:type\s+)?[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bexport\s+[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bimport\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g,/\brequire\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g];for(let Y of U)for(let Z of G.matchAll(Y)){let $=Z[1];if($)Q.add($)}return[...Q]}function JG(G){return I(G)!==".ts"}function g(G,Q,U=new Set){if(U.has(G)||!_(G))return;if(U.add(G),!j.has(I(G)))return;let Y=C(G,"utf8"),Z=JG(G);for(let $ of l(Y)){if($.startsWith("node:")||b.has($))continue;if(H($)){if(!Z)continue;if(Object.hasOwn(S,$)||Object.hasOwn(S,J($))||V(G,$)||d($)&&f($)||Q&&f($))continue;throw Error(`Cannot find module '${J($)}'`)}let X=c(G,$);if(X)g(X,Q,U)}}function n(G,Q=new Set,U=new Set){if(Q.has(G)||!_(G))return U;if(Q.add(G),!j.has(I(G)))return U;let Y=C(G,"utf8");for(let Z of l(Y)){if(U.add(Z),H(Z))continue;let $=c(G,Z);if($)n($,Q,U)}return U}function CG(G,Q){let U=y(G),Y={},Z=n(G),$=new Set(qG);for(let[X,q]of Object.entries(S)){try{U.resolve(X);continue}catch{}Y[X]=q}for(let X of Z)if(H(X)&&(d(X)||Q))$.add(X);for(let X of $){if(Object.hasOwn(Y,X)||V(G,X))continue;let q=T(X);if(q)Y[X]=q}if(!Q)return Y;for(let X of Z){if(!H(X)||Object.hasOwn(Y,X)||V(G,X)||X.startsWith("node:")||b.has(X))continue;let q=T(X);if(q)Y[X]=q}return Y}function OG(G){let Q=I(G);return Q===".ts"||Q===".tsx"||Q===".mts"||Q===".cts"}var F;function jG(){if(F!==void 0)return F;let G=u("jiti");if(!G)return F=null,null;let Q=K(G,"dist","babel.cjs");if(!_(Q))return F=null,null;try{let Y=y(Q)(Q);F=typeof Y==="function"?Y:null}catch{F=null}return F}async function o(G,Q={}){let U=!FG(G);g(G,U);let Y=CG(G,U),Z=LG(Y),$=await import("jiti"),X=typeof $==="function"?$:typeof $.default==="function"?$.default:void 0;if(!X)throw Error("Unable to load jiti");let q=Object.entries(Z).filter(([,W])=>OG(W)).map(([W])=>W),w=jG(),A=w?(W)=>w({...W,interopDefault:!0}):void 0;return await X(G,{alias:Z,cache:Q.useCache,requireCache:Q.useCache,esmResolve:!0,interopDefault:!1,nativeModules:[...b],transformModules:q,tryNative:!1,...A?{transform:A}:{}}).import(G,{})}function p(G,Q){if(!G)return!0;if(G.providerIds?.length){if(!Q?.providerId||!G.providerIds.includes(Q.providerId))return!1}if(G.modelIds?.length){if(!Q?.modelId||!G.modelIds.includes(Q.modelId))return!1}return!0}function z(G){return typeof G==="object"&&G!==null}function s(G){return Array.isArray(G)&&G.every((Q)=>typeof Q==="string")}function BG(G,Q){if(!z(G))throw Error(`Invalid plugin module: ${Q}`);if(typeof G.name!=="string"||!G.name)throw Error(`Invalid plugin name: ${Q}`);if(!z(G.manifest))throw Error(`Invalid plugin manifest: ${Q}`);if(Object.hasOwn(G.manifest,"providerIds")&&!s(G.manifest.providerIds))throw Error(`Invalid plugin manifest.providerIds: ${Q}`);if(Object.hasOwn(G.manifest,"modelIds")&&!s(G.manifest.modelIds))throw Error(`Invalid plugin manifest.modelIds: ${Q}`)}function DG(G){if(!z(G))throw Error("Plugin setup context must be an object");if(G.session!==void 0&&!z(G.session))throw Error("Plugin setup context session must be an object");if(G.client!==void 0&&!z(G.client))throw Error("Plugin setup context client must be an object");if(G.user!==void 0&&!z(G.user))throw Error("Plugin setup context user must be an object");if(G.workspaceInfo!==void 0&&!z(G.workspaceInfo))throw Error("Plugin setup context workspaceInfo must be an object");if(G.automation!==void 0&&!z(G.automation))throw Error("Plugin setup context automation must be an object");if(G.automation!==void 0&&typeof G.automation.ingestEvent!=="function")throw Error("Plugin setup context automation.ingestEvent must be a function");if(G.logger!==void 0&&!z(G.logger))throw Error("Plugin setup context logger must be an object")}var t=0,N=new Map,v=new Map;function HG(G){let Q=G instanceof Error?G.message:String(G),U=G instanceof Error?G.stack:void 0;return{message:Q,stack:U}}function k(G,Q,U,Y){if(!process.send)return;process.send({type:"response",id:G,ok:Q,result:U,error:Y})}function x(G,Q){if(!process.send)return;process.send({type:"event",name:G,payload:Q})}globalThis.__clinePluginHost={emitEvent:x};globalThis.__clineSessionEnv={cwd:void 0,workspaceInfo:void 0};function i(G){if(!G||typeof G!=="object")return{};return G}function NG(G){if(!G||typeof G!=="object")return;let Q={...G};if(Q.error instanceof Error)Q.error={name:Q.error.name,message:Q.error.message,stack:Q.error.stack};return Q}function EG(G){let Q=(U,Y,Z)=>{x("plugin_log",{level:U,pluginName:G,message:Y,metadata:NG(Z)})};return{debug:(U,Y)=>Q("debug",U,Y),log:(U,Y)=>Q("log",U,Y),error:(U,Y)=>Q("error",U,Y)}}function O(G,Q){let U=`${G}:${Q}`,Y=(v.get(U)??0)+1;return v.set(U,Y),`${G}_${Q}_${Y}`}function SG(G){let Q=typeof G.eventType==="string"?G.eventType.trim():"",U=typeof G.source==="string"?G.source.trim():"";if(!Q)throw Error("Automation event type contribution requires eventType");if(!U)throw Error("Automation event type contribution requires source");return{...G,eventType:Q,source:U,examples:G.examples?[...G.examples]:void 0,metadata:G.metadata?i(G.metadata):void 0}}function B(G){let Q=N.get(G);if(!Q)throw Error(`Unknown sandbox plugin id: ${G}`);return Q}async function VG(G){let Q;try{let U=await o(G.pluginPath);if(Q=U.default??U[G.exportName],BG(Q,G.pluginPath),Q.manifest=IG(Q.manifest),!p(Q.manifest,G.targeting))return{type:"skipped"};let Y={tools:[],commands:[],rules:[],messageBuilders:[],providers:[],automationEventTypes:[],mcpServers:[],shortcuts:[],flags:[]},Z={tools:new Map,commands:new Map,rules:new Map,messageBuilders:new Map},$={registerTool:(X)=>{let q=O(G.pluginId,"tool");Z.tools.set(q,X.execute),Y.tools.push({id:q,name:X.name,description:X.description,inputSchema:X.inputSchema,timeoutMs:X.timeoutMs,retryable:X.retryable})},registerCommand:(X)=>{let q=O(G.pluginId,"command");if(typeof X.handler==="function")Z.commands.set(q,X.handler);Y.commands.push({id:q,name:X.name,description:X.description})},registerRule:(X)=>{let q=O(G.pluginId,"rule");if(typeof X.content==="function"){Z.rules.set(q,X.content),Y.rules.push({id:q,ruleId:X.id,source:X.source,hasContentHandler:!0});return}Y.rules.push({id:q,ruleId:X.id,content:X.content,source:X.source})},registerMessageBuilder:(X)=>{let q=O(G.pluginId,"builder");Z.messageBuilders.set(q,X.build),Y.messageBuilders.push({id:q,name:X.name})},registerProvider:(X)=>{Y.providers.push({id:O(G.pluginId,"provider"),name:X.name,description:X.description,metadata:i(X.metadata)})},registerAutomationEventType:(X)=>{Y.automationEventTypes.push({id:O(G.pluginId,"automation_event"),...SG(X)})},registerMcpServer:(X)=>{Y.mcpServers.push(X)}};if(typeof Q.setup==="function")try{let X={...G.setupCtxBase,...G.loggerEnabled?{logger:EG(Q.name)}:{},...Q.manifest.capabilities.includes("automationEvents")?{automation:{ingestEvent:(q)=>{x("automation_event",q)}}}:{}};DG(X),await Q.setup($,X)}catch(X){return{type:"failure",failure:{pluginPath:G.pluginPath,pluginName:Q.name,phase:"setup",message:X instanceof Error?X.message:String(X),stack:X instanceof Error?X.stack:void 0}}}return{type:"loaded",state:{plugin:Q,handlers:Z},descriptor:{pluginId:G.pluginId,pluginPath:G.pluginPath,name:Q.name,manifest:Q.manifest,hooks:Q.hooks?Object.entries(Q.hooks).filter(([,X])=>typeof X==="function").map(([X])=>X):void 0,contributions:Y}}}catch(U){return{type:"failure",failure:{pluginPath:G.pluginPath,pluginName:Q?.name,phase:"load",message:U instanceof Error?U.message:String(U),stack:U instanceof Error?U.stack:void 0}}}}async function TG(G){if(N.clear(),t=0,v.clear(),G.cwd)try{process.chdir(G.cwd)}catch{}let Q=globalThis.__clineSessionEnv;if(Q)Q.cwd=G.cwd,Q.workspaceInfo=G.workspaceInfo;let U=[],Y=[],Z=[],$=G.exportName||"plugin",X=new Map,q={providerId:G.providerId,modelId:G.modelId},w={session:G.session,client:G.client,user:G.user,workspaceInfo:G.workspaceInfo},A=await Promise.all((G.pluginPaths||[]).map((L)=>{let W=`plugin_${++t}`;return VG({pluginPath:L,pluginId:W,exportName:$,targeting:q,setupCtxBase:w,loggerEnabled:G.loggerEnabled})}));for(let L of A){if(L.type==="skipped")continue;if(L.type==="failure"){Y.push(L.failure);continue}let{descriptor:W,state:r}=L,E=X.get(W.name);if(E!==void 0){let D=U[E];if(!D)X.delete(W.name);else{Z.push({type:"duplicate_plugin_override",pluginName:W.name,pluginPath:W.pluginPath,overriddenPluginPath:D.pluginPath,message:`Plugin "${W.name}" from ${W.pluginPath} overrides ${D.pluginPath}`}),N.delete(D.pluginId),U.splice(E,1),X.clear();for(let[a,e]of U.entries())X.set(e.name,a)}}N.set(W.pluginId,r),X.set(W.name,U.length),U.push(W)}return{plugins:U,failures:Y,warnings:Z}}async function yG(G){let U=B(G.pluginId).plugin.hooks?.[G.hookName];if(typeof U!=="function")return;return await U(G.payload)}async function bG(G){let U=B(G.pluginId).handlers.tools.get(G.contributionId);if(typeof U!=="function")throw Error("Unknown sandbox tool contribution");return await U(G.input,G.context)}async function RG(G){let U=B(G.pluginId).handlers.commands.get(G.contributionId);if(typeof U!=="function")return"";return await U(G.input)}async function kG(G){let U=B(G.pluginId).handlers.messageBuilders.get(G.contributionId);if(typeof U!=="function")return[];return await U(G.messages)}async function vG(G){let U=B(G.pluginId).handlers.rules.get(G.contributionId);if(typeof U!=="function")return"";return await U()}var xG={initialize:TG,invokeHook:yG,executeTool:bG,executeCommand:RG,buildMessages:kG,resolveRuleContent:vG};process.on("message",async(G)=>{if(!G||G.type!=="call")return;let Q=xG[G.method];if(!Q){k(G.id,!1,void 0,{message:`Unknown method: ${String(G.method)}`});return}try{let U=await Q(G.args||{});k(G.id,!0,U)}catch(U){k(G.id,!1,void 0,HG(U))}});
|
|
1
|
+
import{createRequire as QG}from"node:module";var UG=QG(import.meta.url);import{normalizePluginManifest as BG}from"@cline/shared";import{existsSync as _,readFileSync as C}from"node:fs";import{builtinModules as XG,createRequire as R}from"node:module";import{dirname as J,extname as I,isAbsolute as YG,resolve as q}from"node:path";import{fileURLToPath as h}from"node:url";import{PLUGIN_FILE_EXTENSIONS as ZG}from"@cline/shared";var m=J(h(import.meta.url)),$G=R(import.meta.url),KG=q(m,"..","..","..","..",".."),T=_G(KG),qG=["@cline/sdk","@cline/agents","@cline/core","@cline/core/hub","@cline/core/hub/daemon-entry","@cline/core/telemetry","@cline/llms","@cline/llms/browser","@cline/shared","@cline/shared/automation","@cline/shared/browser","@cline/shared/storage","@cline/shared/db","@cline/shared/types"],k=new Set(XG.flatMap((G)=>[G,G.replace(/^node:/,"")])),j=new Set(ZG),WG=["development","node","import","require","default"];function _G(G){let Q={},U={"@cline/sdk":q(G,"packages/sdk/src/index.ts"),"@cline/agents":q(G,"packages/agents/src/index.ts"),"@cline/core":q(G,"packages/core/src/index.ts"),"@cline/llms":q(G,"packages/llms/src/index.ts"),"@cline/shared":q(G,"packages/shared/src/index.ts"),"@cline/shared/storage":q(G,"packages/shared/src/storage/index.ts"),"@cline/shared/db":q(G,"packages/shared/src/db/index.ts")};for(let[Y,Z]of Object.entries(U))if(_(Z))Q[Y]=Z;for(let Y of["agents","core","llms","shared"]){let Z=q(G,"packages",Y),$=q(Z,"package.json");if(!_($))continue;try{let X=JSON.parse(C($,"utf8"));if(typeof X.name!=="string"||!X.exports)continue;if(typeof X.exports==="string"){let K=q(Z,X.exports);if(_(K))Q[X.name]=K;continue}if(typeof X.exports!=="object")continue;for(let[K,A]of Object.entries(X.exports)){let L=wG(Z,A);if(!L)continue;let w=K==="."?X.name:`${X.name}/${K.replace(/^\.\//,"")}`;Q[w]=L}}catch{}}return Q}function wG(G,Q){let U=v(Q);if(!U)return null;let Y=d(G,U);for(let Z of Y)if(_(Z))return Z;return null}function v(G,Q=new Set){if(typeof G==="string")return G;if(!G||typeof G!=="object")return null;if(Q.has(G))return null;Q.add(G);let U=G;for(let Y of WG){let Z=v(U[Y],Q);if(Z)return Z}return null}function d(G,Q){let U=Q.replace(/^\.\//,""),Y=[q(G,Q)];if(U.startsWith("dist/")){let Z=U.replace(/^dist\//,"src/").replace(/\.(mjs|cjs|js)$/,"");return[q(G,`${Z}.ts`),q(G,`${Z}.tsx`),q(G,`${Z}.mts`),q(G,`${Z}.cts`),...Y]}return Y}function AG(G){return Object.fromEntries(Object.entries(G).sort(([Q],[U])=>U.length-Q.length))}function H(G){return!(G.startsWith(".")||G.startsWith("/")||G.startsWith("file:")||G.startsWith("data:")||G.startsWith("http:")||G.startsWith("https:"))}function M(G){if(G.startsWith("@")){let[Q,U]=G.split("/",3);return U?`${Q}/${U}`:G}return G.split("/",1)[0]??G}function LG(G){let Q=M(G);if(G===Q)return".";return`.${G.slice(Q.length)}`}function u(G){return M(G).startsWith("@cline/")}function y(G,Q){let U=M(Q),Y=J(G);while(!0){let Z=q(Y,"node_modules",U);if(_(Z)||_(q(Z,"package.json")))return!0;let $=q(Y,"..");if($===Y)return!1;Y=$}}function P(G){return b(G)!==null}function b(G){try{return $G.resolve(G)}catch{}return FG(G)}function FG(G){let Q=M(G),U=c(Q);if(!U)return null;let Y=q(U,"package.json");try{let Z=JSON.parse(C(Y,"utf8")),$=LG(G),X=$==="."&&typeof Z.exports==="string"?Z.exports:Z.exports&&typeof Z.exports==="object"&&Object.hasOwn(Z.exports,$)?Z.exports[$]:void 0,K=v(X)??($==="."&&typeof Z.main==="string"?Z.main:null);if(!K)return null;let A=q(U,K),L=[A,...d(U,K).filter((w)=>w!==A)];for(let w of L)if(_(w))return w;return null}catch{return null}}function JG(){let G=[m],Q=process.env.CLINE_WRAPPER_PATH?.trim();if(Q)G.push(J(J(Q)));let U=process.execPath?.trim();if(U)G.push(J(U));return[...new Set(G.map((Y)=>q(Y)))]}function zG(G,Q){let U=G;while(!0){let Y=q(U,"package.json");if(_(Y))try{if(JSON.parse(C(Y,"utf8")).name===Q)return U}catch{}let Z=q(U,"node_modules",Q,"package.json");if(_(Z))return J(Z);let $=q(U,"..");if($===U)return null;U=$}}function c(G){for(let Q of JG()){let U=zG(Q,G);if(U)return U}return null}function MG(G){let U=J(G);for(let Y=0;Y<4;Y++){let Z=q(U,"package.json");if(_(Z))try{let X=JSON.parse(C(Z,"utf8"));return X!=null&&typeof X==="object"&&"cline"in X}catch{return!1}let $=q(U,"..");if($===U)return!1;U=$}return!1}function l(G,Q){let U=Q.startsWith("file:")?h(Q):YG(Q)?Q:q(J(G),Q);if(_(U)&&j.has(I(U)))return U;for(let Y of j){let Z=`${U}${Y}`;if(_(Z))return Z}for(let Y of j){let Z=q(U,`index${Y}`);if(_(Z))return Z}return null}function g(G){let Q=new Set,U=[/\bimport\s+(?:type\s+)?[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bexport\s+[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bimport\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g,/\brequire\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g];for(let Y of U)for(let Z of G.matchAll(Y)){let $=Z[1];if($)Q.add($)}return[...Q]}function CG(G){return I(G)!==".ts"}function n(G,Q,U=new Set){if(U.has(G)||!_(G))return;if(U.add(G),!j.has(I(G)))return;let Y=C(G,"utf8"),Z=CG(G);for(let $ of g(Y)){if($.startsWith("node:")||k.has($))continue;if(H($)){if(!Z)continue;if(Object.hasOwn(T,$)||Object.hasOwn(T,M($))||y(G,$)||u($)&&P($)||Q&&P($))continue;throw Error(`Cannot find module '${M($)}'`)}let X=l(G,$);if(X)n(X,Q,U)}}function o(G,Q=new Set,U=new Set){if(Q.has(G)||!_(G))return U;if(Q.add(G),!j.has(I(G)))return U;let Y=C(G,"utf8");for(let Z of g(Y)){if(U.add(Z),H(Z))continue;let $=l(G,Z);if($)o($,Q,U)}return U}function OG(G,Q){let U=R(G),Y={},Z=o(G),$=new Set(qG);for(let[X,K]of Object.entries(T)){try{U.resolve(X);continue}catch{}Y[X]=K}for(let X of Z)if(H(X)&&(u(X)||Q))$.add(X);for(let X of $){if(Object.hasOwn(Y,X)||y(G,X))continue;let K=b(X);if(K)Y[X]=K}if(!Q)return Y;for(let X of Z){if(!H(X)||Object.hasOwn(Y,X)||y(G,X)||X.startsWith("node:")||k.has(X))continue;let K=b(X);if(K)Y[X]=K}return Y}function jG(G){let Q=I(G);return Q===".ts"||Q===".tsx"||Q===".mts"||Q===".cts"}var z;function IG(){if(z!==void 0)return z;let G=c("jiti");if(!G)return z=null,null;let Q=q(G,"dist","babel.cjs");if(!_(Q))return z=null,null;try{let Y=R(Q)(Q);z=typeof Y==="function"?Y:null}catch{z=null}return z}async function p(G,Q={}){let U=!MG(G);n(G,U);let Y=OG(G,U),Z=AG(Y),$=await import("jiti"),X=typeof $==="function"?$:typeof $.default==="function"?$.default:void 0;if(!X)throw Error("Unable to load jiti");let K=Object.entries(Z).filter(([,W])=>jG(W)).map(([W])=>W),A=IG(),L=A?(W)=>A({...W,interopDefault:!0}):void 0;return await X(G,{alias:Z,cache:Q.useCache,requireCache:Q.useCache,esmResolve:!0,interopDefault:!1,nativeModules:[...k],transformModules:K,tryNative:!1,...L?{transform:L}:{}}).import(G,{})}function s(G,Q){if(!G)return!0;if(G.providerIds?.length){if(!Q?.providerId||!G.providerIds.includes(Q.providerId))return!1}if(G.modelIds?.length){if(!Q?.modelId||!G.modelIds.includes(Q.modelId))return!1}return!0}function F(G){return typeof G==="object"&&G!==null}function t(G){return Array.isArray(G)&&G.every((Q)=>typeof Q==="string")}function DG(G,Q){if(!F(G))throw Error(`Invalid plugin module: ${Q}`);if(typeof G.name!=="string"||!G.name)throw Error(`Invalid plugin name: ${Q}`);if(!F(G.manifest))throw Error(`Invalid plugin manifest: ${Q}`);if(Object.hasOwn(G.manifest,"providerIds")&&!t(G.manifest.providerIds))throw Error(`Invalid plugin manifest.providerIds: ${Q}`);if(Object.hasOwn(G.manifest,"modelIds")&&!t(G.manifest.modelIds))throw Error(`Invalid plugin manifest.modelIds: ${Q}`)}function HG(G){if(!F(G))throw Error("Plugin setup context must be an object");if(G.session!==void 0&&!F(G.session))throw Error("Plugin setup context session must be an object");if(G.client!==void 0&&!F(G.client))throw Error("Plugin setup context client must be an object");if(G.user!==void 0&&!F(G.user))throw Error("Plugin setup context user must be an object");if(G.workspaceInfo!==void 0&&!F(G.workspaceInfo))throw Error("Plugin setup context workspaceInfo must be an object");if(G.automation!==void 0&&!F(G.automation))throw Error("Plugin setup context automation must be an object");if(G.automation!==void 0&&typeof G.automation.ingestEvent!=="function")throw Error("Plugin setup context automation.ingestEvent must be a function");if(G.logger!==void 0&&!F(G.logger))throw Error("Plugin setup context logger must be an object")}var i=0,N=new Map,f=new Map;function NG(G){let Q=G instanceof Error?G.message:String(G),U=G instanceof Error?G.stack:void 0;return{message:Q,stack:U}}function x(G,Q,U,Y){if(!process.send)return;process.send({type:"response",id:G,ok:Q,result:U,error:Y})}function E(G,Q){if(!process.send)return;process.send({type:"event",name:G,payload:Q})}globalThis.__clinePluginHost={emitEvent:E};globalThis.__clineSessionEnv={cwd:void 0,workspaceInfo:void 0};function r(G){if(!G||typeof G!=="object")return{};return G}function S(G){if(!G||typeof G!=="object")return;let Q={...G};if(Q.error instanceof Error)Q.error={name:Q.error.name,message:Q.error.message,stack:Q.error.stack};return Q}function SG(G){let Q=(U,Y,Z)=>{E("plugin_log",{level:U,pluginName:G,message:Y,metadata:S(Z)})};return{debug:(U,Y)=>Q("debug",U,Y),log:(U,Y)=>Q("log",U,Y),error:(U,Y)=>Q("error",U,Y)}}function EG(G){let Q=(Z)=>{E("plugin_telemetry",{pluginName:G,...Z})},U=(Z)=>($,X,K,A,L)=>{Q({kind:"metric",metric:Z,name:$,value:X,attributes:S(K),description:A,required:L})},Y=()=>{};return{capture:(Z)=>{Q({kind:"event",event:Z?.event,properties:S(Z?.properties)})},captureRequired:(Z,$)=>{Q({kind:"event",event:Z,properties:S($),required:!0})},recordCounter:U("counter"),recordHistogram:U("histogram"),recordGauge:U("gauge"),isEnabled:()=>!0,setDistinctId:Y,setMetadata:Y,updateMetadata:Y,setCommonProperties:Y,updateCommonProperties:Y,flush:async()=>{},dispose:async()=>{}}}function O(G,Q){let U=`${G}:${Q}`,Y=(f.get(U)??0)+1;return f.set(U,Y),`${G}_${Q}_${Y}`}function VG(G){let Q=typeof G.eventType==="string"?G.eventType.trim():"",U=typeof G.source==="string"?G.source.trim():"";if(!Q)throw Error("Automation event type contribution requires eventType");if(!U)throw Error("Automation event type contribution requires source");return{...G,eventType:Q,source:U,examples:G.examples?[...G.examples]:void 0,metadata:G.metadata?r(G.metadata):void 0}}function B(G){let Q=N.get(G);if(!Q)throw Error(`Unknown sandbox plugin id: ${G}`);return Q}async function TG(G){let Q;try{let U=await p(G.pluginPath);if(Q=U.default??U[G.exportName],DG(Q,G.pluginPath),Q.manifest=BG(Q.manifest),!s(Q.manifest,G.targeting))return{type:"skipped"};let Y={tools:[],commands:[],rules:[],messageBuilders:[],providers:[],automationEventTypes:[],mcpServers:[],shortcuts:[],flags:[]},Z={tools:new Map,commands:new Map,rules:new Map,messageBuilders:new Map},$={registerTool:(X)=>{let K=O(G.pluginId,"tool");Z.tools.set(K,X.execute),Y.tools.push({id:K,name:X.name,description:X.description,inputSchema:X.inputSchema,timeoutMs:X.timeoutMs,retryable:X.retryable})},registerCommand:(X)=>{let K=O(G.pluginId,"command");if(typeof X.handler==="function")Z.commands.set(K,X.handler);Y.commands.push({id:K,name:X.name,description:X.description})},registerRule:(X)=>{let K=O(G.pluginId,"rule");if(typeof X.content==="function"){Z.rules.set(K,X.content),Y.rules.push({id:K,ruleId:X.id,source:X.source,hasContentHandler:!0});return}Y.rules.push({id:K,ruleId:X.id,content:X.content,source:X.source})},registerMessageBuilder:(X)=>{let K=O(G.pluginId,"builder");Z.messageBuilders.set(K,X.build),Y.messageBuilders.push({id:K,name:X.name})},registerProvider:(X)=>{Y.providers.push({id:O(G.pluginId,"provider"),name:X.name,description:X.description,metadata:r(X.metadata)})},registerAutomationEventType:(X)=>{Y.automationEventTypes.push({id:O(G.pluginId,"automation_event"),...VG(X)})},registerMcpServer:(X)=>{Y.mcpServers.push(X)}};if(typeof Q.setup==="function")try{let X={...G.setupCtxBase,...G.telemetryEnabled?{telemetry:EG(Q.name)}:{},...G.loggerEnabled?{logger:SG(Q.name)}:{},...Q.manifest.capabilities.includes("automationEvents")?{automation:{ingestEvent:(K)=>{E("automation_event",K)}}}:{}};HG(X),await Q.setup($,X)}catch(X){return{type:"failure",failure:{pluginPath:G.pluginPath,pluginName:Q.name,phase:"setup",message:X instanceof Error?X.message:String(X),stack:X instanceof Error?X.stack:void 0}}}return{type:"loaded",state:{plugin:Q,handlers:Z},descriptor:{pluginId:G.pluginId,pluginPath:G.pluginPath,name:Q.name,manifest:Q.manifest,hooks:Q.hooks?Object.entries(Q.hooks).filter(([,X])=>typeof X==="function").map(([X])=>X):void 0,contributions:Y}}}catch(U){return{type:"failure",failure:{pluginPath:G.pluginPath,pluginName:Q?.name,phase:"load",message:U instanceof Error?U.message:String(U),stack:U instanceof Error?U.stack:void 0}}}}async function yG(G){if(N.clear(),i=0,f.clear(),G.cwd)try{process.chdir(G.cwd)}catch{}let Q=globalThis.__clineSessionEnv;if(Q)Q.cwd=G.cwd,Q.workspaceInfo=G.workspaceInfo;let U=[],Y=[],Z=[],$=G.exportName||"plugin",X=new Map,K={providerId:G.providerId,modelId:G.modelId},A={session:G.session,client:G.client,user:G.user,workspaceInfo:G.workspaceInfo},L=await Promise.all((G.pluginPaths||[]).map((w)=>{let W=`plugin_${++i}`;return TG({pluginPath:w,pluginId:W,exportName:$,targeting:K,setupCtxBase:A,loggerEnabled:G.loggerEnabled,telemetryEnabled:G.telemetryEnabled})}));for(let w of L){if(w.type==="skipped")continue;if(w.type==="failure"){Y.push(w.failure);continue}let{descriptor:W,state:a}=w,V=X.get(W.name);if(V!==void 0){let D=U[V];if(!D)X.delete(W.name);else{Z.push({type:"duplicate_plugin_override",pluginName:W.name,pluginPath:W.pluginPath,overriddenPluginPath:D.pluginPath,message:`Plugin "${W.name}" from ${W.pluginPath} overrides ${D.pluginPath}`}),N.delete(D.pluginId),U.splice(V,1),X.clear();for(let[e,GG]of U.entries())X.set(GG.name,e)}}N.set(W.pluginId,a),X.set(W.name,U.length),U.push(W)}return{plugins:U,failures:Y,warnings:Z}}async function bG(G){let U=B(G.pluginId).plugin.hooks?.[G.hookName];if(typeof U!=="function")return;return await U(G.payload)}async function RG(G){let U=B(G.pluginId).handlers.tools.get(G.contributionId);if(typeof U!=="function")throw Error("Unknown sandbox tool contribution");return await U(G.input,G.context)}async function kG(G){let U=B(G.pluginId).handlers.commands.get(G.contributionId);if(typeof U!=="function")return"";return await U(G.input)}async function vG(G){let U=B(G.pluginId).handlers.messageBuilders.get(G.contributionId);if(typeof U!=="function")return[];return await U(G.messages)}async function xG(G){let U=B(G.pluginId).handlers.rules.get(G.contributionId);if(typeof U!=="function")return"";return await U()}var fG={initialize:yG,invokeHook:bG,executeTool:RG,executeCommand:kG,buildMessages:vG,resolveRuleContent:xG};process.on("message",async(G)=>{if(!G||G.type!=="call")return;let Q=fG[G.method];if(!Q){x(G.id,!1,void 0,{message:`Unknown method: ${String(G.method)}`});return}try{let U=await Q(G.args||{});x(G.id,!0,U)}catch(U){x(G.id,!1,void 0,NG(U))}});
|