dirac-cli 0.2.35 → 0.2.36
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/cli.mjs +4 -4
- package/dist/lib.mjs +4 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -28,7 +28,7 @@ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
28
28
|
`),this.outputHelp({error:!0}));let i=r||{},a=i.exitCode||1,o=i.code||"commander.error";this._exit(a,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Mg.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Mg.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new iac(this.options),r=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&r(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(a=>!r(a)).forEach(a=>{this.setOptionValueWithSource(a,i.implied[a],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let i=n=>{let s=n.attributeName(),u=this.getOptionValue(s),d=this.options.find(p=>p.negate&&s===p.attributeName()),f=this.options.find(p=>!p.negate&&s===p.attributeName());return d&&(d.presetArg===void 0&&u===!1||d.presetArg!==void 0&&u===d.presetArg)?d:f||n},a=n=>{let s=i(n),u=s.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${s.envVar}'`:`option '${s.flags}'`},o=`error: ${a(e)} cannot be used with ${a(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let a=[],o=this;do{let n=o.createHelp().visibleOptions(o).filter(s=>s.long).map(s=>s.long);a=a.concat(n),o=o.parent}while(o&&!o._enablePositionalOptions);r=sfi(e,a)}let i=`error: unknown option '${e}'${r}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,i=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${i} but got ${e.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let a=[];this.createHelp().visibleCommands(this).forEach(o=>{a.push(o.name()),o.alias()&&a.push(o.alias())}),r=sfi(e,a)}let i=`error: unknown command '${e}'${r}`;this.error(i,{code:"commander.unknownCommand"})}version(e,r,i){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",i=i||"output the version number";let a=this.createOption(r,i);return this._versionOptionName=a.attributeName(),this._registerOption(a),this.on("option:"+a.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
29
29
|
`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(e);if(i){let a=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${a}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(i=>rac(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=IQ.basename(e,IQ.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp();return r.helpWidth===void 0&&(r.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),r.formatHelp(this,r)}_getHelpContext(e){e=e||{};let r={error:!!e.error},i;return r.error?i=a=>this._outputConfiguration.writeErr(a):i=a=>this._outputConfiguration.writeOut(a),r.write=e.write||i,r.command=this,r}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let a=this.helpInformation(i);if(r&&(a=r(a),typeof a!="string"&&!Buffer.isBuffer(a)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(a),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(o=>o.emit("afterAllHelp",i))}helpOption(e,r){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",r=r??"display help for command",this._helpOption=this.createOption(e,r),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let r=Mg.exitCode||0;r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
30
30
|
Expecting one of '${i.join("', '")}'`);let a=`${e}Help`;return this.on(a,o=>{let n;typeof r=="function"?n=r({error:o.error,command:o.command}):n=r,n&&o.write(`${n}
|
|
31
|
-
`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(a=>r.is(a))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function ufi(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,i="127.0.0.1",a="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?a=o[3]:i=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],i=o[3],a=o[4]),r&&a!=="0"?`${r}=${i}:${parseInt(a)+1}`:e})}cfi.Command=B1r});var hfi=X(lD=>{"use strict";var{Argument:dfi}=spt(),{Command:D1r}=lfi(),{CommanderError:aac,InvalidArgumentError:ffi}=aFe(),{Help:oac}=b1r(),{Option:pfi}=_1r();lD.program=new D1r;lD.createCommand=t=>new D1r(t);lD.createOption=(t,e)=>new pfi(t,e);lD.createArgument=(t,e)=>new dfi(t,e);lD.Command=D1r;lD.Option=pfi;lD.Argument=dfi;lD.Help=oac;lD.CommanderError=aac;lD.InvalidArgumentError=ffi;lD.InvalidOptionArgumentError=ffi});var dD,oFe=j(()=>{dD="0.2.
|
|
31
|
+
`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(a=>r.is(a))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function ufi(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,i="127.0.0.1",a="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?a=o[3]:i=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],i=o[3],a=o[4]),r&&a!=="0"?`${r}=${i}:${parseInt(a)+1}`:e})}cfi.Command=B1r});var hfi=X(lD=>{"use strict";var{Argument:dfi}=spt(),{Command:D1r}=lfi(),{CommanderError:aac,InvalidArgumentError:ffi}=aFe(),{Help:oac}=b1r(),{Option:pfi}=_1r();lD.program=new D1r;lD.createCommand=t=>new D1r(t);lD.createOption=(t,e)=>new pfi(t,e);lD.createArgument=(t,e)=>new dfi(t,e);lD.Command=D1r;lD.Option=pfi;lD.Argument=dfi;lD.Help=oac;lD.CommanderError=aac;lD.InvalidArgumentError=ffi;lD.InvalidOptionArgumentError=ffi});var dD,oFe=j(()=>{dD="0.2.36"});var M1r={};ni(M1r,{originalConsoleDebug:()=>yfi,originalConsoleError:()=>upt,originalConsoleInfo:()=>Efi,originalConsoleLog:()=>_Q,originalConsoleWarn:()=>mfi,restoreConsole:()=>uac,suppressConsoleUnlessVerbose:()=>k1r});function k1r(t=process.argv){t.includes("-v")||t.includes("--verbose")||(console.log=()=>{},console.warn=()=>{},console.error=()=>{},console.debug=()=>{},console.info=()=>{})}function uac(){console.log=_Q,console.error=upt,console.warn=mfi,console.info=Efi,console.debug=yfi}var _Q,upt,mfi,Efi,yfi,F1e=j(()=>{"use strict";_Q=console.log.bind(console),upt=console.error.bind(console),mfi=console.warn.bind(console),Efi=console.info.bind(console),yfi=console.debug.bind(console)});var k2={};ni(k2,{Spinner:()=>O1r,clearLine:()=>pac,colorize:()=>yS,cursorUp:()=>hac,formatMessage:()=>vfi,formatState:()=>fac,formatTimestamp:()=>Cfi,print:()=>L1e,printError:()=>sFe,printInfo:()=>Sd,printSuccess:()=>Aac,printWarning:()=>OI,promptConfirmation:()=>gac,promptUser:()=>Sfi,separator:()=>P1r,setTerminalTitle:()=>cpt,style:()=>hu,taskHeader:()=>bfi});function yS(t,...e){return e.join("")+t+NE.reset}function Cfi(t){return new Date(t).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function cac(t){if(t.type==="ask")switch(t.ask){case"followup":return"\u2753";case"command":case"command_output":return"\u2699\uFE0F ";case"tool":return"\u{1F527}";case"completion_result":return"\u2705";case"api_req_failed":return"\u274C";case"resume_task":case"resume_completed_task":return"\u25B6\uFE0F ";case"browser_action_launch":return"\u{1F310}";default:return"\u2754"}switch(t.say){case"task":return"\u{1F4CB}";case"error":return"\u274C";case"text":return"\u{1F4AC}";case"reasoning":return"\u{1F9E0}";case"completion_result":return"\u2705";case"user_feedback":return"\u{1F464}";case"command":case"command_output":return"\u2699\uFE0F ";case"tool":return"\u{1F527}";case"browser_action":case"browser_action_launch":case"browser_action_result":return"\u{1F310}";case"api_req_started":case"api_req_finished":return"\u{1F504}";case"checkpoint_created":return"\u{1F4BE}";case"info":return"\u2139\uFE0F ";default:return" "}}function vfi(t,e=!1){let r=cac(t),i=Cfi(t.ts),a=[],o=`${hu.dim(i)} ${r}`;return t.type==="ask"?a.push(lac(t,o,e)):a.push(dac(t,o,e)),a.filter(Boolean).join(`
|
|
32
32
|
`)}function lac(t,e,r){let i=t.ask;switch(i){case"followup":{let a=t.text||"";try{a=JSON.parse(t.text||"{}").question||a}catch{a=t.text||""}return`${e} ${hu.info("Question:")} ${a}`}case"command":return`${e} ${hu.command("Execute command?")} ${hu.code(t.text||"")}`;case"tool":return`${e} ${hu.tool("Use tool?")} ${t.text||""}`;case"completion_result":return`${e} ${hu.success("Task completed")} ${t.text?`- ${t.text}`:""}`;case"api_req_failed":return`${e} ${hu.error("API request failed")} ${t.text||""}`;case"resume_task":case"resume_completed_task":return`${e} ${hu.info("Resume task?")} ${t.text||""}`;case"browser_action_launch":return`${e} ${hu.info("Launch browser?")} ${t.text||""}`;case"plan_mode_respond":return`${e} ${hu.info("Plan mode response:")} ${t.text||""}`;default:return r?`${e} [ASK:${i}] ${t.text||""}`:""}}function dac(t,e,r){let i=t.say;switch(i){case"task":return`${e} ${hu.task("Task:")} ${t.text||""}`;case"text":return`${e} ${hu.assistant(t.text||"")}`;case"reasoning":return`${e} ${hu.dim("Thinking:")} ${hu.italic(t.text||"")}`;case"error":return`${e} ${hu.error("Error:")} ${t.text||""}`;case"completion_result":return`${e} ${hu.success("\u2713 Completed:")} ${t.text||""}`;case"user_feedback":return`${e} ${hu.user("User:")} ${t.text||""}`;case"command":return`${e} ${hu.command("Command:")} ${hu.code(t.text||"")}`;case"command_output":let a=t.text||"",o=a.length>500?a.substring(0,500)+"...":a;return`${e} ${hu.dim("Output:")} ${o}`;case"tool":return`${e} ${hu.tool("Tool:")} ${t.text||""}`;case"browser_action":case"browser_action_launch":return`${e} ${hu.info("Browser:")} ${t.text||""}`;case"browser_action_result":return`${e} ${hu.dim("Browser result")} ${t.text?`- ${t.text.substring(0,100)}...`:""}`;case"api_req_started":{if(r)return`${e} ${hu.api("API request started")}`;try{let n=JSON.parse(t.text||"{}");if(n.cost!==void 0||n.tokensIn!==void 0){let s=n.cost!==void 0?`Cost: $${n.cost.toFixed(4)}`:"",u=n.tokensIn!==void 0?`Tokens: ${n.tokensIn.toLocaleString()} in, ${n.tokensOut.toLocaleString()} out`:"",d=n.cacheReadTokens!==void 0||n.cacheWriteTokens!==void 0?` (Cache: ${(n.cacheReadTokens||0).toLocaleString()} read, ${(n.cacheWriteTokens||0).toLocaleString()} write)`:"",f=n.contextWindow!==void 0?` | Context: ${n.contextUsagePercentage}% of ${(n.contextWindow/1e3).toFixed(0)}K`:"";return`${e} ${hu.api("API request finished")} ${hu.dim(`[${u}${d}${f} | ${s}]`)}`}}catch{return`${t.text||""}`}return""}case"api_req_finished":return r?`${e} ${hu.api("API request finished")}`:"";case"checkpoint_created":return`${e} ${hu.success("Checkpoint created")} ${t.text||""}`;case"info":return`${e} ${hu.info(t.text||"")}`;case"hook_status":return`${e} ${hu.dim("Hook:")} ${t.text||""}`;default:return r?`${e} [SAY:${i}] ${t.text||""}`:""}}function P1r(t="\u2500",e=60){return hu.dim(t.repeat(e))}function bfi(t,e){return[P1r("\u2550"),hu.bold(` Task: ${t}`),e?` ${hu.dim(e.substring(0,80))}${e.length>80?"...":""}`:"",P1r("\u2550")].filter(Boolean).join(`
|
|
33
33
|
`)}function fac(t,e=!1){let r=[];if(t.currentTaskItem&&r.push(bfi(t.currentTaskItem.id,t.currentTaskItem.task)),t.diracMessages&&t.diracMessages.length>0){let i=e?t.diracMessages:t.diracMessages.filter(a=>!0);for(let a of i){let o=vfi(a,e);o&&r.push(o)}}return r.join(`
|
|
34
34
|
`)}function pac(){process.stdout.write("\r\x1B[K")}function hac(t=1){process.stdout.write(`\x1B[${t}A`)}function L1e(t){_Q(t)}function sFe(t){upt(hu.error(t))}function Aac(t){_Q(hu.success(t))}function Sd(t){_Q(hu.info(t))}function OI(t){_Q(hu.warning(t))}async function Sfi(t){let r=(await import("readline")).createInterface({input:process.stdin,output:process.stdout});return new Promise(i=>{r.question(hu.info(t)+" ",a=>{r.close(),i(a.trim())})})}async function gac(t){let e=await Sfi(`${t} ${hu.dim("(y/n)")}`);return e.toLowerCase()==="y"||e.toLowerCase()==="yes"}function cpt(t){if(process.stdout.isTTY){let r=t.length>80?t.slice(0,80)+"...":t;process.stdout.write(`\x1B]0;${r}\x07`)}}var NE,hu,O1r,z1=j(()=>{"use strict";F1e();NE={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m"};hu={bold:t=>yS(t,NE.bold),dim:t=>yS(t,NE.dim),italic:t=>yS(t,NE.italic),error:t=>yS(t,NE.red,NE.bold),warning:t=>yS(t,NE.yellow),success:t=>yS(t,NE.green),info:t=>yS(t,NE.cyan),task:t=>yS(t,NE.brightWhite,NE.bold),tool:t=>yS(t,NE.blue),command:t=>yS(t,NE.magenta),api:t=>yS(t,NE.brightBlack),user:t=>yS(t,NE.green),assistant:t=>yS(t,NE.cyan),path:t=>yS(t,NE.underline,NE.blue),code:t=>yS(t,NE.bgBlack,NE.brightWhite)};O1r=class{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];frameIndex=0;interval=null;message="";start(e){this.message=e,this.interval=setInterval(()=>{let r=this.frames[this.frameIndex];process.stdout.write(`\r${hu.info(r)} ${this.message}`),this.frameIndex=(this.frameIndex+1)%this.frames.length},80)}update(e){this.message=e}stop(e){this.interval&&(clearInterval(this.interval),this.interval=null),e?process.stdout.write(`\r${hu.success("\u2713")} ${e}
|
|
@@ -2321,19 +2321,19 @@ You MUST batch all non-overlapping edits into a single tool call. As long as the
|
|
|
2321
2321
|
- The query must be at least 2 characters
|
|
2322
2322
|
- You may provide either allowed_domains OR blocked_domains, but NOT both
|
|
2323
2323
|
- Domains should be provided as a JSON array of strings
|
|
2324
|
-
- This tool is read-only and does not modify any files`,contextRequirements:t=>t.diracWebToolsEnabled===!0,parameters:[{name:"query",required:!0,instruction:"The search query to use",usage:"latest developments in AI"},{name:"allowed_domains",required:!1,instruction:"JSON array of domains to restrict results to",usage:'["example.com", "github.com"]'},{name:"blocked_domains",required:!1,instruction:"JSON array of domains to exclude from results",usage:'["ads.com", "spam.com"]'}]}});var rUh,qFu,GFu=j(()=>{"use strict";ds();rUh="write_to_file",qFu={id:rUh,name:"write_to_file",description:"Creates a new file or completely overwrites an existing file. Automatically creates required directories.",parameters:[{name:"path",required:!0,instruction:"The path of the file to write to.",usage:"File path here"},{name:"content",required:!0,instruction:"The COMPLETE intended content of the file. Do not truncate or omit any parts.",usage:"Full file content here"}]}});function HFu(){[tFu,nFu,aFu,sFu,cFu,TFu,RFu,dFu,mFu,AFu,pFu,yFu,vFu,SFu,IFu,DFu,MFu,OFu,FFu,UFu,qFu].forEach(e=>{LU.register(e)})}var VFu=j(()=>{"use strict";nhr();rFu();iFu();oFu();uFu();lFu();fFu();hFu();gFu();EFu();CFu();bFu();xFu();_Fu();wFu();BFu();kFu();PFu();NFu();LFu();QFu();GFu()});var WFu,zFu=j(()=>{"use strict";WFu=t=>{let{cwd:e,ide:r,supportsBrowserUse:i,yoloModeToggled:a,diracWebToolsEnabled:o,providerInfo:n,preferredLanguageInstructions:s,diracIgnoreInstructions:u,globalDiracRulesFileInstructions:d,localDiracRulesFileInstructions:f,localCursorRulesFileInstructions:p,localCursorRulesDirInstructions:c,localWindsurfRulesFileInstructions:h,localAgentsRulesFileInstructions:A,enableParallelToolCalling:g,userInstructions:E,diracRules:I}=t,w=e||process.cwd();return`You are Dirac, an
|
|
2324
|
+
- This tool is read-only and does not modify any files`,contextRequirements:t=>t.diracWebToolsEnabled===!0,parameters:[{name:"query",required:!0,instruction:"The search query to use",usage:"latest developments in AI"},{name:"allowed_domains",required:!1,instruction:"JSON array of domains to restrict results to",usage:'["example.com", "github.com"]'},{name:"blocked_domains",required:!1,instruction:"JSON array of domains to exclude from results",usage:'["ads.com", "spam.com"]'}]}});var rUh,qFu,GFu=j(()=>{"use strict";ds();rUh="write_to_file",qFu={id:rUh,name:"write_to_file",description:"Creates a new file or completely overwrites an existing file. Automatically creates required directories.",parameters:[{name:"path",required:!0,instruction:"The path of the file to write to.",usage:"File path here"},{name:"content",required:!0,instruction:"The COMPLETE intended content of the file. Do not truncate or omit any parts.",usage:"Full file content here"}]}});function HFu(){[tFu,nFu,aFu,sFu,cFu,TFu,RFu,dFu,mFu,AFu,pFu,yFu,vFu,SFu,IFu,DFu,MFu,OFu,FFu,UFu,qFu].forEach(e=>{LU.register(e)})}var VFu=j(()=>{"use strict";nhr();rFu();iFu();oFu();uFu();lFu();fFu();hFu();gFu();EFu();CFu();bFu();xFu();_Fu();wFu();BFu();kFu();PFu();NFu();LFu();QFu();GFu()});var WFu,zFu=j(()=>{"use strict";WFu=t=>{let{cwd:e,ide:r,supportsBrowserUse:i,yoloModeToggled:a,diracWebToolsEnabled:o,providerInfo:n,preferredLanguageInstructions:s,diracIgnoreInstructions:u,globalDiracRulesFileInstructions:d,localDiracRulesFileInstructions:f,localCursorRulesFileInstructions:p,localCursorRulesDirInstructions:c,localWindsurfRulesFileInstructions:h,localAgentsRulesFileInstructions:A,enableParallelToolCalling:g,userInstructions:E,diracRules:I}=t,w=e||process.cwd();return`You are Dirac, an exceptionally skilled AI agent at solving problems with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
|
|
2325
2325
|
|
|
2326
2326
|
PRIME DIRECTIVES
|
|
2327
2327
|
|
|
2328
2328
|
1. ACCOMPLISH THE TASK HUMAN GIVES YOU WITH CORRECT, ROBUST AND WELL ENGINEERED CODE.
|
|
2329
|
-
2.
|
|
2329
|
+
2. MINIMIZE THE NUMBER OF ROUND TRIPS NEEDED TO DO THIS. BATCH TOOLCALLS TOGETHER TO AVOID MULTIPLE ROUND TRIPS.
|
|
2330
2330
|
|
|
2331
2331
|
TOOL USE
|
|
2332
2332
|
|
|
2333
2333
|
${g?" You may use multiple tools in a single response when the operations are independent (e.g., reading several files, searching in parallel). When refactoring a single file, multiple edits to different sections of the file are considered INDEPENDENT operations because we have stable hash anchors. You should batch them into a single response to save roundtrips.":""}
|
|
2334
2334
|
|
|
2335
2335
|
|
|
2336
|
-
ACT MODE
|
|
2336
|
+
ACT MODE VS PLAN MODE
|
|
2337
2337
|
|
|
2338
2338
|
In each user message, the environment_details will specify the current mode. There are two modes:
|
|
2339
2339
|
|
package/dist/lib.mjs
CHANGED
|
@@ -1989,19 +1989,19 @@ You MUST batch all non-overlapping edits into a single tool call. As long as the
|
|
|
1989
1989
|
- The query must be at least 2 characters
|
|
1990
1990
|
- You may provide either allowed_domains OR blocked_domains, but NOT both
|
|
1991
1991
|
- Domains should be provided as a JSON array of strings
|
|
1992
|
-
- This tool is read-only and does not modify any files`,contextRequirements:t=>t.diracWebToolsEnabled===!0,parameters:[{name:"query",required:!0,instruction:"The search query to use",usage:"latest developments in AI"},{name:"allowed_domains",required:!1,instruction:"JSON array of domains to restrict results to",usage:'["example.com", "github.com"]'},{name:"blocked_domains",required:!1,instruction:"JSON array of domains to exclude from results",usage:'["ads.com", "spam.com"]'}]};Go();var gCf="write_to_file",$Qo={id:gCf,name:"write_to_file",description:"Creates a new file or completely overwrites an existing file. Automatically creates required directories.",parameters:[{name:"path",required:!0,instruction:"The path of the file to write to.",usage:"File path here"},{name:"content",required:!0,instruction:"The COMPLETE intended content of the file. Do not truncate or omit any parts.",usage:"Full file content here"}]};function YQo(){[yQo,CQo,vQo,bQo,MQo,GQo,HQo,PQo,FQo,NQo,OQo,LQo,UQo,QQo,qQo,VQo,WQo,zQo,KQo,jQo,$Qo].forEach(e=>{bN.register(e)})}var JQo=t=>{let{cwd:e,ide:r,supportsBrowserUse:i,yoloModeToggled:a,diracWebToolsEnabled:o,providerInfo:n,preferredLanguageInstructions:s,diracIgnoreInstructions:u,globalDiracRulesFileInstructions:d,localDiracRulesFileInstructions:f,localCursorRulesFileInstructions:h,localCursorRulesDirInstructions:c,localWindsurfRulesFileInstructions:p,localAgentsRulesFileInstructions:A,enableParallelToolCalling:g,userInstructions:y,diracRules:I}=t,w=e||process.cwd();return`You are Dirac, an
|
|
1992
|
+
- This tool is read-only and does not modify any files`,contextRequirements:t=>t.diracWebToolsEnabled===!0,parameters:[{name:"query",required:!0,instruction:"The search query to use",usage:"latest developments in AI"},{name:"allowed_domains",required:!1,instruction:"JSON array of domains to restrict results to",usage:'["example.com", "github.com"]'},{name:"blocked_domains",required:!1,instruction:"JSON array of domains to exclude from results",usage:'["ads.com", "spam.com"]'}]};Go();var gCf="write_to_file",$Qo={id:gCf,name:"write_to_file",description:"Creates a new file or completely overwrites an existing file. Automatically creates required directories.",parameters:[{name:"path",required:!0,instruction:"The path of the file to write to.",usage:"File path here"},{name:"content",required:!0,instruction:"The COMPLETE intended content of the file. Do not truncate or omit any parts.",usage:"Full file content here"}]};function YQo(){[yQo,CQo,vQo,bQo,MQo,GQo,HQo,PQo,FQo,NQo,OQo,LQo,UQo,QQo,qQo,VQo,WQo,zQo,KQo,jQo,$Qo].forEach(e=>{bN.register(e)})}var JQo=t=>{let{cwd:e,ide:r,supportsBrowserUse:i,yoloModeToggled:a,diracWebToolsEnabled:o,providerInfo:n,preferredLanguageInstructions:s,diracIgnoreInstructions:u,globalDiracRulesFileInstructions:d,localDiracRulesFileInstructions:f,localCursorRulesFileInstructions:h,localCursorRulesDirInstructions:c,localWindsurfRulesFileInstructions:p,localAgentsRulesFileInstructions:A,enableParallelToolCalling:g,userInstructions:y,diracRules:I}=t,w=e||process.cwd();return`You are Dirac, an exceptionally skilled AI agent at solving problems with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.
|
|
1993
1993
|
|
|
1994
1994
|
PRIME DIRECTIVES
|
|
1995
1995
|
|
|
1996
1996
|
1. ACCOMPLISH THE TASK HUMAN GIVES YOU WITH CORRECT, ROBUST AND WELL ENGINEERED CODE.
|
|
1997
|
-
2.
|
|
1997
|
+
2. MINIMIZE THE NUMBER OF ROUND TRIPS NEEDED TO DO THIS. BATCH TOOLCALLS TOGETHER TO AVOID MULTIPLE ROUND TRIPS.
|
|
1998
1998
|
|
|
1999
1999
|
TOOL USE
|
|
2000
2000
|
|
|
2001
2001
|
${g?" You may use multiple tools in a single response when the operations are independent (e.g., reading several files, searching in parallel). When refactoring a single file, multiple edits to different sections of the file are considered INDEPENDENT operations because we have stable hash anchors. You should batch them into a single response to save roundtrips.":""}
|
|
2002
2002
|
|
|
2003
2003
|
|
|
2004
|
-
ACT MODE
|
|
2004
|
+
ACT MODE VS PLAN MODE
|
|
2005
2005
|
|
|
2006
2006
|
In each user message, the environment_details will specify the current mode. There are two modes:
|
|
2007
2007
|
|
|
@@ -5841,7 +5841,7 @@ Speak in ${h}.`:"",{globalToggles:p,localToggles:A}=await lFt(this.controller,th
|
|
|
5841
5841
|
<div class="countdown">Feel free to close this window and continue in your ${r}</div>
|
|
5842
5842
|
</div>
|
|
5843
5843
|
</body>
|
|
5844
|
-
</html>`}var car=class{};var lar=class extends car{setOnReplyCallback(e){}async ensureCommentsViewDisabled(){}addReviewComment(e){}startStreamingComment(e,r,i,a,o,n){}appendToStreamingComment(e){}endStreamingComment(){}addReviewComments(e){}clearAllComments(){}clearCommentsForFile(e){}getThreadCount(){return 0}async closeDiffViews(){}dispose(){}};var dar=class extends gee{RESOURCE_HOSTNAME="internal.resources";getWebviewUrl(e){let r=new URL(`https://${this.RESOURCE_HOSTNAME}/`);return r.pathname=e,r.toString()}getCspSource(){return`'self' https://${this.RESOURCE_HOSTNAME}`}isVisible(){return!0}};io();Pr();var PLn="0.2.35";n0();Pc();ru();var Pnu=Pt(Wfe(),1);io();import*as Trt from"fs/promises";gv();Pr();var far=class extends Nee{connection;clientCapabilities;sessionIdResolver;constructor(e,r,i){super(),this.connection=e,this.clientCapabilities=r,this.sessionIdResolver=i}getSessionId(){let e=this.sessionIdResolver();if(!e)throw new Error("No active ACP session. Cannot perform file operation.");return e}canReadFile(){return this.clientCapabilities?.fs?.readTextFile===!0}canWriteFile(){return this.clientCapabilities?.fs?.writeTextFile===!0}async open(e,r){if(!this.canReadFile())return Le.debug("[ACPDiffViewProvider] Client does not support fs.readTextFile, falling back to local fs"),super.open(e,r);this.isEditing=!0;let i=await ih(),a=NA.resolveWorkspacePath(i,e,"ACPDiffViewProvider.open.absolutePath");this.absolutePath=typeof a=="string"?a:a.absolutePath,this.relPath=r?.displayPath??e;let o=this.editType==="modify";if(o){try{await In.workspace.saveOpenDocumentIfDirty({filePath:this.absolutePath})}catch{}try{Le.debug("[ACPDiffViewProvider] Reading file via ACP:",this.absolutePath);let u=await this.connection.readTextFile({sessionId:this.getSessionId(),path:this.absolutePath});this.originalContent=u.content,this.fileEncoding="utf8",Le.debug("[ACPDiffViewProvider] Read file successfully, length:",u.content.length)}catch(u){Le.debug("[ACPDiffViewProvider] ACP read failed, falling back to local fs:",u);let d=await Trt.readFile(this.absolutePath);this.fileEncoding=await ghe(d),this.originalContent=Pnu.decode(d,this.fileEncoding)}}else this.originalContent="",this.fileEncoding="utf8";let n=await zEt(this.absolutePath);if(this.createdDirs=n,!o)if(this.canWriteFile())try{await this.connection.writeTextFile({sessionId:this.getSessionId(),path:this.absolutePath,content:""})}catch{await Trt.writeFile(this.absolutePath,"")}else await Trt.writeFile(this.absolutePath,"");let s=[];try{s=(await In.workspace.getDiagnostics({filePaths:[]})).fileDiagnostics}catch{s=[]}this.preDiagnostics=s,await this.openDiffEditor(),await this.scrollEditorToLine(0),this.streamedLines=[]}async scrollEditorToLine(e){}async openDiffEditor(){}async saveDocument(){if(!this.canWriteFile())return Le.debug("[ACPDiffViewProvider] Client does not support fs.writeTextFile, falling back to local fs"),super.saveDocument();let e=await this.getContent();if(!this.absolutePath||e===void 0)return!1;try{return Le.debug("[ACPDiffViewProvider] Writing file via ACP:",{path:this.absolutePath,contentLength:e.length}),await this.connection.writeTextFile({sessionId:this.getSessionId(),path:this.absolutePath,content:e}),Le.debug("[ACPDiffViewProvider] Write file successfully"),!0}catch(r){return Le.debug("[ACPDiffViewProvider] ACP write failed, falling back to local fs:",r),super.saveDocument()}}};Pr();var OLn=class{async openDiff(e){return Le.debug("[ACPDiffServiceClient] openDiff called (stub)"),jc.OpenDiffResponse.create({})}async getDocumentText(e){return Le.debug("[ACPDiffServiceClient] getDocumentText called (stub)",{diffId:e.diffId}),jc.GetDocumentTextResponse.create({content:""})}async replaceText(e){return Le.debug("[ACPDiffServiceClient] replaceText called (stub)"),jc.ReplaceTextResponse.create({})}async scrollDiff(e){return Le.debug("[ACPDiffServiceClient] scrollDiff called (stub)"),jc.ScrollDiffResponse.create({})}async truncateDocument(e){return Le.debug("[ACPDiffServiceClient] truncateDocument called (stub)"),jc.TruncateDocumentResponse.create({})}async saveDocument(e){return Le.debug("[ACPDiffServiceClient] saveDocument called (stub)"),jc.SaveDocumentResponse.create({})}async closeAllDiffs(e){return Le.debug("[ACPDiffServiceClient] closeAllDiffs called (stub)"),jc.CloseAllDiffsResponse.create({})}async openMultiFileDiff(e){return Le.debug("[ACPDiffServiceClient] openMultiFileDiff called (stub)"),jc.OpenMultiFileDiffResponse.create({})}},NLn=class{version;constructor(e,r,i){this.version=i}async debugLog(e){return Le.debug(e.value),KM.Empty.create()}async clipboardWriteText(e){return Le.debug("[ACPEnvServiceClient] clipboardWriteText called (stub)"),KM.Empty.create()}async clipboardReadText(e){return Le.debug("[ACPEnvServiceClient] clipboardReadText called (stub)"),KM.String.create({value:""})}async getHostVersion(e){return jc.GetHostVersionResponse.create({version:this.version,platform:"Dirac ACP Agent",diracType:"CLI"})}async getIdeRedirectUri(e){return Le.debug("[ACPEnvServiceClient] getIdeRedirectUri called (stub)"),KM.String.create({value:""})}async getTelemetrySettings(e){return jc.GetTelemetrySettingsResponse.create({isEnabled:jc.Setting.DISABLED})}subscribeToTelemetrySettings(e,r){return r.onResponse(jc.TelemetrySettingsEvent.create({isEnabled:jc.Setting.DISABLED})),()=>{}}async shutdown(e){return Le.debug("[ACPEnvServiceClient] shutdown called (stub)"),KM.Empty.create()}async openExternal(e){let r=e.value||"";if(r){Le.debug(`[ACPEnvServiceClient] openExternal: ${r}`);let{openUrlInBrowser:i}=await Promise.resolve().then(()=>(Nnu(),Onu));await i(r)}return KM.Empty.create()}},FLn=class{constructor(e,r){}async showTextDocument(e){return Le.debug("[ACPWindowServiceClient] showTextDocument called (stub)",{path:e.path}),jc.TextEditorInfo.create({documentPath:e.path})}async showOpenDialogue(e){return Le.debug("[ACPWindowServiceClient] showOpenDialogue called (stub)"),jc.SelectedResources.create({paths:[]})}async showMessage(e){return Le.debug("[ACPWindowServiceClient] showMessage called (stub)",{message:e.message,type:e.type}),jc.SelectedResponse.create({})}async showInputBox(e){return Le.debug("[ACPWindowServiceClient] showInputBox called (stub)"),jc.ShowInputBoxResponse.create({response:""})}async showSaveDialog(e){return Le.debug("[ACPWindowServiceClient] showSaveDialog called (stub)"),jc.ShowSaveDialogResponse.create({selectedPath:""})}async openFile(e){return Le.debug("[ACPWindowServiceClient] openFile called (stub)",{filePath:e.filePath}),jc.OpenFileResponse.create({})}async openSettings(e){return Le.debug("[ACPWindowServiceClient] openSettings called (stub)"),jc.OpenSettingsResponse.create({})}async getOpenTabs(e){return Le.debug("[ACPWindowServiceClient] getOpenTabs called (stub)"),jc.GetOpenTabsResponse.create({paths:[]})}async getVisibleTabs(e){return Le.debug("[ACPWindowServiceClient] getVisibleTabs called (stub)"),jc.GetVisibleTabsResponse.create({paths:[]})}async getActiveEditor(e){return Le.debug("[ACPWindowServiceClient] getActiveEditor called (stub)"),jc.GetActiveEditorResponse.create({})}},LLn=class{_clientCapabilities;cwdResolver;constructor(e,r,i){this._clientCapabilities=e,this.cwdResolver=i}getCwd(){return this.cwdResolver()??process.cwd()}async getWorkspacePaths(e){let r=this.getCwd();return Le.debug("[ACPWorkspaceServiceClient] getWorkspacePaths called",{cwd:r}),jc.GetWorkspacePathsResponse.create({paths:[r]})}async saveOpenDocumentIfDirty(e){return Le.debug("[ACPWorkspaceServiceClient] saveOpenDocumentIfDirty called (stub)"),jc.SaveOpenDocumentIfDirtyResponse.create({})}async getDiagnostics(e){return Le.debug("[ACPWorkspaceServiceClient] getDiagnostics called (stub)"),jc.GetDiagnosticsResponse.create({fileDiagnostics:[]})}async openProblemsPanel(e){return Le.debug("[ACPWorkspaceServiceClient] openProblemsPanel called (stub)"),jc.OpenProblemsPanelResponse.create({})}async openInFileExplorerPanel(e){return Le.debug("[ACPWorkspaceServiceClient] openInFileExplorerPanel called (stub)",{path:e.path}),jc.OpenInFileExplorerPanelResponse.create({})}async openDiracSidebarPanel(e){return Le.debug("[ACPWorkspaceServiceClient] openDiracSidebarPanel called (stub)"),jc.OpenDiracSidebarPanelResponse.create({})}async openTerminalPanel(e){return Le.debug("[ACPWorkspaceServiceClient] openTerminalPanel called (stub)"),jc.OpenTerminalResponse.create({})}async executeCommandInTerminal(e){return Le.debug("[ACPWorkspaceServiceClient] executeCommandInTerminal called (stub)",{command:e.command,hasTerminalCapability:this._clientCapabilities?.terminal}),jc.ExecuteCommandInTerminalResponse.create({})}async prepareDiagnostics(e){return jc.PrepareDiagnosticsResponse.create({success:!0})}async openFolder(e){return Le.debug("[ACPWorkspaceServiceClient] openFolder called (stub)",{path:e.path}),jc.OpenFolderResponse.create({success:!0})}},har=class{workspaceClient;envClient;windowClient;diffClient;constructor(e,r,i,a){this.workspaceClient=new LLn(e,r,i),this.envClient=new NLn(e,r,a),this.windowClient=new FLn(e,r),this.diffClient=new OLn}};Pr();import{EventEmitter as iop}from"events";var ULn=class extends iop{isHot=!1;waitForShellIntegration=!1;_unretrievedOutput="";_continued=!1;_completed=!1;_hotTimeout=null;_exitWaitTimeout=null;manager;terminalId;pollInterval=null;constructor(e,r){super(),this.manager=e,this.terminalId=r}continue(){this._continued=!0,this.cleanup(),this.emit("continue")}getUnretrievedOutput(){let e=this._unretrievedOutput;return this._unretrievedOutput="",e}async terminate(){this.cleanup(),await this.manager.kill(this.terminalId)}cleanup(){this.stopPolling(),this._hotTimeout&&(clearTimeout(this._hotTimeout),this._hotTimeout=null),this._exitWaitTimeout&&(clearTimeout(this._exitWaitTimeout),this._exitWaitTimeout=null)}stopPolling(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}run(e){let r="";this.pollInterval=setInterval(async()=>{if(this._continued||this._completed){this.stopPolling();return}try{let i=await this.manager.getOutput(this.terminalId);if(!i.success){this.stopPolling(),this.emit("error",new Error(i.error||"Failed to get output"));return}if(i.output.length>r.length){let a=i.output.slice(r.length);this._unretrievedOutput+=a,r=i.output,this.setHot();let o=a.split(`
|
|
5844
|
+
</html>`}var car=class{};var lar=class extends car{setOnReplyCallback(e){}async ensureCommentsViewDisabled(){}addReviewComment(e){}startStreamingComment(e,r,i,a,o,n){}appendToStreamingComment(e){}endStreamingComment(){}addReviewComments(e){}clearAllComments(){}clearCommentsForFile(e){}getThreadCount(){return 0}async closeDiffViews(){}dispose(){}};var dar=class extends gee{RESOURCE_HOSTNAME="internal.resources";getWebviewUrl(e){let r=new URL(`https://${this.RESOURCE_HOSTNAME}/`);return r.pathname=e,r.toString()}getCspSource(){return`'self' https://${this.RESOURCE_HOSTNAME}`}isVisible(){return!0}};io();Pr();var PLn="0.2.36";n0();Pc();ru();var Pnu=Pt(Wfe(),1);io();import*as Trt from"fs/promises";gv();Pr();var far=class extends Nee{connection;clientCapabilities;sessionIdResolver;constructor(e,r,i){super(),this.connection=e,this.clientCapabilities=r,this.sessionIdResolver=i}getSessionId(){let e=this.sessionIdResolver();if(!e)throw new Error("No active ACP session. Cannot perform file operation.");return e}canReadFile(){return this.clientCapabilities?.fs?.readTextFile===!0}canWriteFile(){return this.clientCapabilities?.fs?.writeTextFile===!0}async open(e,r){if(!this.canReadFile())return Le.debug("[ACPDiffViewProvider] Client does not support fs.readTextFile, falling back to local fs"),super.open(e,r);this.isEditing=!0;let i=await ih(),a=NA.resolveWorkspacePath(i,e,"ACPDiffViewProvider.open.absolutePath");this.absolutePath=typeof a=="string"?a:a.absolutePath,this.relPath=r?.displayPath??e;let o=this.editType==="modify";if(o){try{await In.workspace.saveOpenDocumentIfDirty({filePath:this.absolutePath})}catch{}try{Le.debug("[ACPDiffViewProvider] Reading file via ACP:",this.absolutePath);let u=await this.connection.readTextFile({sessionId:this.getSessionId(),path:this.absolutePath});this.originalContent=u.content,this.fileEncoding="utf8",Le.debug("[ACPDiffViewProvider] Read file successfully, length:",u.content.length)}catch(u){Le.debug("[ACPDiffViewProvider] ACP read failed, falling back to local fs:",u);let d=await Trt.readFile(this.absolutePath);this.fileEncoding=await ghe(d),this.originalContent=Pnu.decode(d,this.fileEncoding)}}else this.originalContent="",this.fileEncoding="utf8";let n=await zEt(this.absolutePath);if(this.createdDirs=n,!o)if(this.canWriteFile())try{await this.connection.writeTextFile({sessionId:this.getSessionId(),path:this.absolutePath,content:""})}catch{await Trt.writeFile(this.absolutePath,"")}else await Trt.writeFile(this.absolutePath,"");let s=[];try{s=(await In.workspace.getDiagnostics({filePaths:[]})).fileDiagnostics}catch{s=[]}this.preDiagnostics=s,await this.openDiffEditor(),await this.scrollEditorToLine(0),this.streamedLines=[]}async scrollEditorToLine(e){}async openDiffEditor(){}async saveDocument(){if(!this.canWriteFile())return Le.debug("[ACPDiffViewProvider] Client does not support fs.writeTextFile, falling back to local fs"),super.saveDocument();let e=await this.getContent();if(!this.absolutePath||e===void 0)return!1;try{return Le.debug("[ACPDiffViewProvider] Writing file via ACP:",{path:this.absolutePath,contentLength:e.length}),await this.connection.writeTextFile({sessionId:this.getSessionId(),path:this.absolutePath,content:e}),Le.debug("[ACPDiffViewProvider] Write file successfully"),!0}catch(r){return Le.debug("[ACPDiffViewProvider] ACP write failed, falling back to local fs:",r),super.saveDocument()}}};Pr();var OLn=class{async openDiff(e){return Le.debug("[ACPDiffServiceClient] openDiff called (stub)"),jc.OpenDiffResponse.create({})}async getDocumentText(e){return Le.debug("[ACPDiffServiceClient] getDocumentText called (stub)",{diffId:e.diffId}),jc.GetDocumentTextResponse.create({content:""})}async replaceText(e){return Le.debug("[ACPDiffServiceClient] replaceText called (stub)"),jc.ReplaceTextResponse.create({})}async scrollDiff(e){return Le.debug("[ACPDiffServiceClient] scrollDiff called (stub)"),jc.ScrollDiffResponse.create({})}async truncateDocument(e){return Le.debug("[ACPDiffServiceClient] truncateDocument called (stub)"),jc.TruncateDocumentResponse.create({})}async saveDocument(e){return Le.debug("[ACPDiffServiceClient] saveDocument called (stub)"),jc.SaveDocumentResponse.create({})}async closeAllDiffs(e){return Le.debug("[ACPDiffServiceClient] closeAllDiffs called (stub)"),jc.CloseAllDiffsResponse.create({})}async openMultiFileDiff(e){return Le.debug("[ACPDiffServiceClient] openMultiFileDiff called (stub)"),jc.OpenMultiFileDiffResponse.create({})}},NLn=class{version;constructor(e,r,i){this.version=i}async debugLog(e){return Le.debug(e.value),KM.Empty.create()}async clipboardWriteText(e){return Le.debug("[ACPEnvServiceClient] clipboardWriteText called (stub)"),KM.Empty.create()}async clipboardReadText(e){return Le.debug("[ACPEnvServiceClient] clipboardReadText called (stub)"),KM.String.create({value:""})}async getHostVersion(e){return jc.GetHostVersionResponse.create({version:this.version,platform:"Dirac ACP Agent",diracType:"CLI"})}async getIdeRedirectUri(e){return Le.debug("[ACPEnvServiceClient] getIdeRedirectUri called (stub)"),KM.String.create({value:""})}async getTelemetrySettings(e){return jc.GetTelemetrySettingsResponse.create({isEnabled:jc.Setting.DISABLED})}subscribeToTelemetrySettings(e,r){return r.onResponse(jc.TelemetrySettingsEvent.create({isEnabled:jc.Setting.DISABLED})),()=>{}}async shutdown(e){return Le.debug("[ACPEnvServiceClient] shutdown called (stub)"),KM.Empty.create()}async openExternal(e){let r=e.value||"";if(r){Le.debug(`[ACPEnvServiceClient] openExternal: ${r}`);let{openUrlInBrowser:i}=await Promise.resolve().then(()=>(Nnu(),Onu));await i(r)}return KM.Empty.create()}},FLn=class{constructor(e,r){}async showTextDocument(e){return Le.debug("[ACPWindowServiceClient] showTextDocument called (stub)",{path:e.path}),jc.TextEditorInfo.create({documentPath:e.path})}async showOpenDialogue(e){return Le.debug("[ACPWindowServiceClient] showOpenDialogue called (stub)"),jc.SelectedResources.create({paths:[]})}async showMessage(e){return Le.debug("[ACPWindowServiceClient] showMessage called (stub)",{message:e.message,type:e.type}),jc.SelectedResponse.create({})}async showInputBox(e){return Le.debug("[ACPWindowServiceClient] showInputBox called (stub)"),jc.ShowInputBoxResponse.create({response:""})}async showSaveDialog(e){return Le.debug("[ACPWindowServiceClient] showSaveDialog called (stub)"),jc.ShowSaveDialogResponse.create({selectedPath:""})}async openFile(e){return Le.debug("[ACPWindowServiceClient] openFile called (stub)",{filePath:e.filePath}),jc.OpenFileResponse.create({})}async openSettings(e){return Le.debug("[ACPWindowServiceClient] openSettings called (stub)"),jc.OpenSettingsResponse.create({})}async getOpenTabs(e){return Le.debug("[ACPWindowServiceClient] getOpenTabs called (stub)"),jc.GetOpenTabsResponse.create({paths:[]})}async getVisibleTabs(e){return Le.debug("[ACPWindowServiceClient] getVisibleTabs called (stub)"),jc.GetVisibleTabsResponse.create({paths:[]})}async getActiveEditor(e){return Le.debug("[ACPWindowServiceClient] getActiveEditor called (stub)"),jc.GetActiveEditorResponse.create({})}},LLn=class{_clientCapabilities;cwdResolver;constructor(e,r,i){this._clientCapabilities=e,this.cwdResolver=i}getCwd(){return this.cwdResolver()??process.cwd()}async getWorkspacePaths(e){let r=this.getCwd();return Le.debug("[ACPWorkspaceServiceClient] getWorkspacePaths called",{cwd:r}),jc.GetWorkspacePathsResponse.create({paths:[r]})}async saveOpenDocumentIfDirty(e){return Le.debug("[ACPWorkspaceServiceClient] saveOpenDocumentIfDirty called (stub)"),jc.SaveOpenDocumentIfDirtyResponse.create({})}async getDiagnostics(e){return Le.debug("[ACPWorkspaceServiceClient] getDiagnostics called (stub)"),jc.GetDiagnosticsResponse.create({fileDiagnostics:[]})}async openProblemsPanel(e){return Le.debug("[ACPWorkspaceServiceClient] openProblemsPanel called (stub)"),jc.OpenProblemsPanelResponse.create({})}async openInFileExplorerPanel(e){return Le.debug("[ACPWorkspaceServiceClient] openInFileExplorerPanel called (stub)",{path:e.path}),jc.OpenInFileExplorerPanelResponse.create({})}async openDiracSidebarPanel(e){return Le.debug("[ACPWorkspaceServiceClient] openDiracSidebarPanel called (stub)"),jc.OpenDiracSidebarPanelResponse.create({})}async openTerminalPanel(e){return Le.debug("[ACPWorkspaceServiceClient] openTerminalPanel called (stub)"),jc.OpenTerminalResponse.create({})}async executeCommandInTerminal(e){return Le.debug("[ACPWorkspaceServiceClient] executeCommandInTerminal called (stub)",{command:e.command,hasTerminalCapability:this._clientCapabilities?.terminal}),jc.ExecuteCommandInTerminalResponse.create({})}async prepareDiagnostics(e){return jc.PrepareDiagnosticsResponse.create({success:!0})}async openFolder(e){return Le.debug("[ACPWorkspaceServiceClient] openFolder called (stub)",{path:e.path}),jc.OpenFolderResponse.create({success:!0})}},har=class{workspaceClient;envClient;windowClient;diffClient;constructor(e,r,i,a){this.workspaceClient=new LLn(e,r,i),this.envClient=new NLn(e,r,a),this.windowClient=new FLn(e,r),this.diffClient=new OLn}};Pr();import{EventEmitter as iop}from"events";var ULn=class extends iop{isHot=!1;waitForShellIntegration=!1;_unretrievedOutput="";_continued=!1;_completed=!1;_hotTimeout=null;_exitWaitTimeout=null;manager;terminalId;pollInterval=null;constructor(e,r){super(),this.manager=e,this.terminalId=r}continue(){this._continued=!0,this.cleanup(),this.emit("continue")}getUnretrievedOutput(){let e=this._unretrievedOutput;return this._unretrievedOutput="",e}async terminate(){this.cleanup(),await this.manager.kill(this.terminalId)}cleanup(){this.stopPolling(),this._hotTimeout&&(clearTimeout(this._hotTimeout),this._hotTimeout=null),this._exitWaitTimeout&&(clearTimeout(this._exitWaitTimeout),this._exitWaitTimeout=null)}stopPolling(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}run(e){let r="";this.pollInterval=setInterval(async()=>{if(this._continued||this._completed){this.stopPolling();return}try{let i=await this.manager.getOutput(this.terminalId);if(!i.success){this.stopPolling(),this.emit("error",new Error(i.error||"Failed to get output"));return}if(i.output.length>r.length){let a=i.output.slice(r.length);this._unretrievedOutput+=a,r=i.output,this.setHot();let o=a.split(`
|
|
5845
5845
|
`);for(let n of o)n&&this.emit("line",n)}i.exitStatus&&(this._completed=!0,this.stopPolling(),this.emit("completed"))}catch(i){this.stopPolling(),this.emit("error",i instanceof Error?i:new Error(String(i)))}},100),this.manager.waitForExit(this.terminalId).then(i=>{i.success&&!this._continued&&!this._completed&&(this._exitWaitTimeout=setTimeout(()=>{!this._continued&&!this._completed&&(this._completed=!0,this.cleanup(),this.emit("completed"))},200))})}setHot(){this.isHot=!0,this._hotTimeout&&clearTimeout(this._hotTimeout),this._hotTimeout=setTimeout(()=>{this.isHot=!1},2e3)}},QLn=class{name;processId;shellIntegration;_managedTerminal;_manager;_cwd;constructor(e,r){this._managedTerminal=e,this._manager=r,this._cwd=e.cwd||"",this.name=`ACP Terminal ${e.numericId}`,this.processId=Promise.resolve(e.numericId),this.shellIntegration={cwd:{fsPath:this._cwd}}}sendText(e,r){Le.debug("[AcpTerminal] sendText not supported for ACP terminals")}show(){}hide(){}dispose(){this._manager.release(this._managedTerminal.id).catch(e=>{Le.debug("[AcpTerminal] Error releasing terminal:",e)})}};function aop(t,e){let r=(async()=>{})().constructor.prototype,i=["then","catch","finally"].map(a=>[a,Reflect.getOwnPropertyDescriptor(r,a)]);for(let[a,o]of i)if(o){let n=o.value.bind(e);Reflect.defineProperty(t,a,{...o,value:n})}return t.terminate&&typeof t.terminate=="function"&&Object.defineProperty(t,"terminate",{value:t.terminate.bind(t),writable:!1,enumerable:!1,configurable:!1}),t}var par=class{connection;clientCapabilities;sessionIdResolver;terminals=new Map;numericIdToStringId=new Map;nextNumericId=1;processes=new Map;terminalInfos=new Map;terminalReuseEnabled=!0;terminalOutputLineLimit=500;constructor(e,r,i){this.connection=e,this.clientCapabilities=r,this.sessionIdResolver=i}runCommand(e,r){let a=e.terminal._managedTerminal;e.busy=!0,e.lastCommand=r,e.lastActive=Date.now(),a.busy=!0,a.lastCommand=r;let o=new ULn(this,a.id);this.processes.set(a.numericId,o),o.once("completed",()=>{e.busy=!1,a.busy=!1}),o.once("error",s=>{e.busy=!1,a.busy=!1});let n=new Promise((s,u)=>{o.once("continue",()=>s()),o.once("completed",()=>s()),o.once("error",d=>u(d))});return this.runCommandInternal(a,r,o),aop(o,n)}async runCommandInternal(e,r,i){try{let a={sessionId:this.getSessionId(),command:r,cwd:e.cwd},o=await this.connection.createTerminal(a);e.id&&this.terminals.has(e.id)&&this.terminals.delete(e.id),e.handle=o,e.id=o.id,this.terminals.set(o.id,e),this.numericIdToStringId.set(e.numericId,o.id),i.terminalId=o.id,i.run(r)}catch(a){i.emit("error",a instanceof Error?a:new Error(String(a)))}}async getOrCreateTerminal(e){for(let[s,u]of this.terminalInfos)if(!u.busy&&u.terminal._cwd===e)return u;if(this.terminalReuseEnabled){for(let[s,u]of this.terminalInfos)if(!u.busy){let d=u.terminal;return d._cwd=e,d.shellIntegration?.cwd&&(d.shellIntegration.cwd.fsPath=e),d._managedTerminal.cwd=e,u}}let r=this.nextNumericId++,a={id:`pending-${r}`,numericId:r,handle:null,command:"",cwd:e,createdAt:Date.now(),released:!1,busy:!1,lastCommand:""},o=new QLn(a,this),n={id:r,terminal:o,busy:!1,lastCommand:"",lastActive:Date.now()};return this.terminals.set(a.id,a),this.numericIdToStringId.set(r,a.id),this.terminalInfos.set(r,n),Le.debug("[AcpTerminalManager] Created terminal:",{numericId:r,cwd:e}),n}getTerminals(e){let r=[];for(let[i,a]of this.terminalInfos)a.busy===e&&r.push({id:i,lastCommand:a.lastCommand});return r}getUnretrievedOutput(e){let r=this.processes.get(e);return r?r.getUnretrievedOutput():""}isProcessHot(e){let r=this.processes.get(e);return r?r.isHot:!1}disposeAll(){this.releaseAll().catch(e=>{Le.debug("[AcpTerminalManager] Error releasing terminals:",e)}),this.terminals.clear(),this.numericIdToStringId.clear(),this.processes.clear(),this.terminalInfos.clear(),Le.debug("[AcpTerminalManager] disposeAll complete")}setShellIntegrationTimeout(e){}setTerminalReuseEnabled(e){this.terminalReuseEnabled=e}setTerminalOutputLineLimit(e){this.terminalOutputLineLimit=e}setDefaultTerminalProfile(e){}processOutput(e,r){let i=r!==void 0?r:this.terminalOutputLineLimit;if(e.length>i){let a=Math.floor(i/2),o=e.slice(0,a),n=e.slice(e.length-a);return`${o.join(`
|
|
5846
5846
|
`)}
|
|
5847
5847
|
... (output truncated) ...
|