dirac-cli 0.4.2 → 0.4.3
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 +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/source/cli/package.json +1 -1
- 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 uI.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()}`,uI.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new kAl(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 c=n.attributeName(),f=this.getOptionValue(c),h=this.options.find(m=>m.negate&&c===m.attributeName()),p=this.options.find(m=>!m.negate&&c===m.attributeName());return h&&(h.presetArg===void 0&&f===!1||h.presetArg!==void 0&&f===h.presetArg)?h:p||n},a=n=>{let c=i(n),f=c.attributeName();return this.getOptionValueSource(f)==="env"?`environment variable '${c.envVar}'`:`option '${c.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(c=>c.long).map(c=>c.long);a=a.concat(n),o=o.parent}while(o&&!o._enablePositionalOptions);r=wEa(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=wEa(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=>DAl(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=Ole.basename(e,Ole.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=uI.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 DEa(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})}REa.Command=Nmn});var NEa=Ee(SV=>{"use strict";var{Argument:BEa}=gYt(),{Command:Omn}=kEa(),{CommanderError:BAl,InvalidArgumentError:PEa}=m1t(),{Help:PAl}=Tmn(),{Option:MEa}=kmn();SV.program=new Omn;SV.createCommand=t=>new Omn(t);SV.createOption=(t,e)=>new MEa(t,e);SV.createArgument=(t,e)=>new BEa(t,e);SV.Command=Omn;SV.Option=MEa;SV.Argument=BEa;SV.Help=PAl;SV.CommanderError=BAl;SV.InvalidArgumentError=PEa;SV.InvalidOptionArgumentError=PEa});var hN,rke=le(()=>{hN="0.4.2"});var Lmn={};$o(Lmn,{originalConsoleDebug:()=>QEa,originalConsoleError:()=>_Yt,originalConsoleInfo:()=>UEa,originalConsoleLog:()=>Fle,originalConsoleWarn:()=>LEa,restoreConsole:()=>NAl,suppressConsoleUnlessVerbose:()=>Fmn});function Fmn(t=process.argv){t.includes("-v")||t.includes("--verbose")||(console.log=()=>{},console.warn=()=>{},console.error=()=>{},console.debug=()=>{},console.info=()=>{})}function NAl(){console.log=Fle,console.error=_Yt,console.warn=LEa,console.info=UEa,console.debug=QEa}var Fle,_Yt,LEa,UEa,QEa,iVe=le(()=>{"use strict";Fle=console.log.bind(console),_Yt=console.error.bind(console),LEa=console.warn.bind(console),UEa=console.info.bind(console),QEa=console.debug.bind(console)});var Umn={};$o(Umn,{OPENAI_REASONING_EFFORT_OPTIONS:()=>Lle,isOpenaiReasoningEffort:()=>f1e,normalizeOpenaiReasoningEffort:()=>_k});function f1e(t){return typeof t=="string"&&Lle.includes(t)}function _k(t){let e=(t||"medium").toLowerCase();return f1e(e)?e:"medium"}var Lle,o7=le(()=>{"use strict";Lle=["none","low","medium","high","xhigh"]});var GEa={};$o(GEa,{COMMAND_CANCEL_TOKEN:()=>FAl,COMMAND_OUTPUT_STRING:()=>UAl,COMMAND_REQ_APP_STRING:()=>QAl,COMPLETION_RESULT_CHANGES_FLAG:()=>GAl,CardStatus:()=>Cg,DEFAULT_PLATFORM:()=>OAl,DiracMessageType:()=>cy,OPENAI_REASONING_EFFORT_OPTIONS:()=>Lle,TaskStatus:()=>s7,UIActionButtonType:()=>nke,browserActions:()=>LAl,isFinalStatus:()=>c7,isOpenaiReasoningEffort:()=>f1e});function c7(t){return t==="success"||t==="error"||t==="skipped"||t==="cancelled"||t==="abandoned"}var OAl,FAl,s7,cy,LAl,UAl,QAl,GAl,nke,Cg,tp=le(()=>{"use strict";o7();OAl="unknown",FAl="__dirac_command_cancel__",s7=(u=>(u.IDLE="idle",u.COMPLETED="completed",u.PREPARING="preparing",u.WAITING_FOR_API="waiting_for_api",u.THINKING="thinking",u.STREAMING_TEXT="streaming_text",u.BUILDING_TOOL_CALL="building_tool_call",u.EXECUTING_TOOL="executing_tool",u.AWAITING_USER_INPUT="awaiting_user_input",u.CANCELLING="cancelling",u.BUILDING_REQUEST="building_request",u.CANCELLED="cancelled",u))(s7||{}),cy=(a=>(a.MARKDOWN="markdown",a.CARD="card",a.API_STATUS="api_status",a.CHECKPOINT="checkpoint",a))(cy||{}),LAl=["launch","click","type","scroll_down","scroll_up","close"],UAl="Output:",QAl="REQ_APP",GAl="HAS_CHANGES",nke=(c=>(c.APPROVE="approve",c.REJECT="reject",c.NEW_TASK="new_task",c.CANCEL="cancel",c.PROCEED="proceed",c.RETRY="retry",c.UTILITY="utility",c))(nke||{}),Cg=(h=>(h.BUILDING="building",h.PENDING="pending",h.RUNNING="running",h.SUCCESS="success",h.ERROR="error",h.SKIPPED="skipped",h.CANCELLED="cancelled",h.ABANDONED="abandoned",h.WAITING_FOR_INPUT="waiting_for_input",h))(Cg||{})});var TT,qEa,OS,are,p1e=le(()=>{"use strict";TT={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"},qEa={primary:"#B1B9F9",plan:"yellow",success:"green",error:"red",warning:"yellow",info:"cyan",muted:"gray",brightWhite:"brightWhite",brightBlack:"brightBlack",brightCyan:"brightCyan",blue:"blue",magenta:"magenta",gray:"gray",cyan:"cyan",codeBg:"#2a2a3e"},OS={markdown:{heading:{bold:!0,color:"brightWhite"},headingSub:{bold:!0},strong:{bold:!0,color:"brightWhite"},emphasis:{italic:!0},link:{color:"blue",underline:!0},inlineCode:{color:"brightCyan",backgroundColor:"#2a2a3e"},codeBlock:{color:"brightCyan"},codeBorder:{color:"brightBlack"},blockquote:{dimColor:!0},blockquoteBar:{color:"brightBlack"},tableBorder:{color:"brightBlack"},tableHeader:{bold:!0},hr:{color:"gray"}},thinking:{shimmerDim:{color:"gray",dimColor:!0},shimmerBright:{color:"brightWhite",bold:!0},elapsed:{color:"gray"},breadcrumb:{color:"gray",dimColor:!0}},conversation:{user:{color:qEa.success},assistant:{color:qEa.primary},planModeTint:{color:"yellow"},completion:{color:"green",bold:!0},divider:{color:"gray",dimColor:!0},reasoning:{color:"gray"},reasoningTitle:{color:"gray",dimColor:!0},typeChangeSep:{color:"gray"}}},are={primary:"#B1B9F9",plan:"yellow",success:"green",error:"red",warning:"yellow",info:"cyan",muted:"gray",status:{success:"green",error:"red",cancelled:"red",running:"blue",waiting:"magenta",building:"yellow",pending:"yellow",skipped:"gray",abandoned:"gray",default:"gray"},diff:{addBg:"#080f0a",addFg:"#52C97A",removeBg:"#120707",removeFg:"#DD6B68",gutterFg:"#505866"},separator:"gray",border:"gray",dimText:"gray",costWarning:1,costDanger:5,contextWarning:.5,contextDanger:.8}});var WEa={};$o(WEa,{DEFAULT_ICON:()=>Qmn,ICON_MAP:()=>HEa,getIcon:()=>$U,getIconCategoryColor:()=>yYt,getStatusColor:()=>A1t,getStatusIcon:()=>Gmn,setIconMode:()=>HAl});function yYt(t){if(t)return qAl[t]}function HAl(t){VEa=t}function $U(t,e){let r=e??VEa??"emoji";return t?(HEa[t]||Qmn)[r]:Qmn[r]}function Gmn(t){switch(t){case"building":case"pending":return"\u22EF";case"running":return"\u280B";case"success":return"\u2713";case"error":return"\u2715";case"skipped":return"\u21B7";case"cancelled":return"\u2298";case"abandoned":return"\u{1F47B}";case"waiting_for_input":return"\u2370";default:return"\u2022"}}function A1t(t){switch(t){case"success":return"green";case"error":case"cancelled":return"red";case"running":return"blue";case"waiting_for_input":return"magenta";case"building":case"pending":return"yellow";case"skipped":case"abandoned":default:return"gray"}}var qAl,HEa,Qmn,VEa,g1t=le(()=>{"use strict";qAl={"file-text":"cyan",code:"cyan",edit:"cyan",search:"magenta",terminal:"green",eye:"blue",globe:"blue",cpu:"yellow"};HEa={"file-text":{emoji:"\u{1F4C4}",unicode:"\u2503",ascii:"FILE"},search:{emoji:"\u{1F50D}",unicode:"\u2315",ascii:"SEARCH"},terminal:{emoji:"\u{1F4BB}",unicode:"\u2318",ascii:"TERM"},code:{emoji:"\u{1F4DD}",unicode:"\u270E",ascii:"CODE"},folder:{emoji:"\u{1F4C1}",unicode:"\u25B8",ascii:"DIR"},check:{emoji:"\u2714",unicode:"\u2713",ascii:"OK"},"alert-triangle":{emoji:"\u26A0",unicode:"\u26A0",ascii:"WARN"},info:{emoji:"\u2139",unicode:"\u2139",ascii:"INFO"},"help-circle":{emoji:"\u2753",unicode:"?",ascii:"HELP"},"message-square":{emoji:"\u{1F4AC}",unicode:"\u276F",ascii:"MSG"},eye:{emoji:"\u{1F441}",unicode:"\u25C9",ascii:"VIEW"},play:{emoji:"\u25B6",unicode:"\u25B6",ascii:"RUN"},"stop-circle":{emoji:"\u{1F6D1}",unicode:"\u25A0",ascii:"STOP"},"refresh-cw":{emoji:"\u{1F504}",unicode:"\u21BB",ascii:"RELOAD"},"trash-2":{emoji:"\u{1F5D1}",unicode:"\u232B",ascii:"DEL"},plus:{emoji:"\u2795",unicode:"+",ascii:"ADD"},edit:{emoji:"\u270F",unicode:"\u270E",ascii:"EDIT"},"external-link":{emoji:"\u{1F517}",unicode:"\u2934",ascii:"LINK"},settings:{emoji:"\u2699",unicode:"\u2699",ascii:"SET"},user:{emoji:"\u{1F464}",unicode:"\u25C7",ascii:"USER"},cpu:{emoji:"\u{1F9E0}",unicode:"\u25C6",ascii:"CPU"},globe:{emoji:"\u{1F310}",unicode:"\u2295",ascii:"WEB"},"chevron-right":{emoji:"\u203A",unicode:"\u203A",ascii:">"},"chevron-down":{emoji:"\u2304",unicode:"\u2304",ascii:"v"},"check-circle":{emoji:"\u2714",unicode:"\u2713",ascii:"DONE"},"x-circle":{emoji:"\u2716",unicode:"\u2715",ascii:"FAIL"},fast_forward:{emoji:"\u23ED",unicode:"\u23ED",ascii:"SKIP"},ghost:{emoji:"\u{1F47B}",unicode:"\u25CC",ascii:"GHOST"}},Qmn={emoji:"\u{1F527}",unicode:"\u2699",ascii:"TOOL"},VEa=null});var AN={};$o(AN,{Spinner:()=>Hmn,centerText:()=>aVe,clearLine:()=>KAl,colorize:()=>uM,createContextBar:()=>Vmn,cursorUp:()=>YAl,formatMessage:()=>jEa,formatState:()=>JAl,formatTimestamp:()=>zEa,print:()=>oVe,printError:()=>_1t,printInfo:()=>t1,printSuccess:()=>$Al,printWarning:()=>mN,promptConfirmation:()=>XAl,promptUser:()=>KEa,separator:()=>qmn,setTerminalTitle:()=>y1t,style:()=>Zy,taskHeader:()=>JEa});function aVe(t,e){let r=e||process.stdout.columns||80,i=Math.max(0,Math.floor((r-t.length)/2));return" ".repeat(i)+t}function uM(t,...e){return e.join("")+t+TT.reset}function zEa(t){return new Date(t).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function VAl(t){let{content:e}=t;switch(e.type){case"markdown":return e.isReasoning?$U("cpu"):$U("message-square");case"card":{let{card:r}=e;return r.icon?r.icon:r.requireApproval?$U("terminal"):r.requireFeedback?$U("help-circle"):r.status==="success"?$U("check-circle"):r.status==="error"?$U("x-circle"):$U("settings")}case"api_status":return $U("refresh-cw");default:return" "}}function jEa(t,e=!1){let r=zEa(t.ts),i=VAl(t),a=`${Zy.dim(r)} ${i}`,{content:o}=t;switch(o.type){case"markdown":return WAl(t,a,e);case"card":return zAl(t,a,e);case"api_status":return jAl(t,a,e);default:return""}}function WAl(t,e,r){if(t.content.type!=="markdown")return"";let{content:i,isReasoning:a}=t.content;return a?`${e} ${Zy.dim("Thinking:")} ${Zy.italic(i)}`:`${e} ${Zy.assistant(i)}`}function zAl(t,e,r){if(t.content.type!=="card")return"";let{card:i}=t.content,a=[],o=i.status==="error"?Zy.error:Zy.tool,n=i.status==="success"?Zy.success("\u2713 "):i.status==="error"?Zy.error("\u2715 "):"",c=i.startTime&&i.endTime?` \xB7 ${((i.endTime-i.startTime)/1e3).toFixed(1)}s`:"",f=i.outcome?` \xB7 ${i.outcome}`:"",h=i.status!=="running"&&i.status!=="success"&&i.status!=="error"?` (${i.status})`:"";if(a.push(`${e} ${n}${o(i.header)}${h}${f}${c}`),i.body){let p=i.body.trim();if(p){let m=p.length>1e3?p.substring(0,1e3)+"...":p;a.push(m.split(`
|
|
31
|
+
`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(a=>r.is(a))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function DEa(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})}REa.Command=Nmn});var NEa=Ee(SV=>{"use strict";var{Argument:BEa}=gYt(),{Command:Omn}=kEa(),{CommanderError:BAl,InvalidArgumentError:PEa}=m1t(),{Help:PAl}=Tmn(),{Option:MEa}=kmn();SV.program=new Omn;SV.createCommand=t=>new Omn(t);SV.createOption=(t,e)=>new MEa(t,e);SV.createArgument=(t,e)=>new BEa(t,e);SV.Command=Omn;SV.Option=MEa;SV.Argument=BEa;SV.Help=PAl;SV.CommanderError=BAl;SV.InvalidArgumentError=PEa;SV.InvalidOptionArgumentError=PEa});var hN,rke=le(()=>{hN="0.4.3"});var Lmn={};$o(Lmn,{originalConsoleDebug:()=>QEa,originalConsoleError:()=>_Yt,originalConsoleInfo:()=>UEa,originalConsoleLog:()=>Fle,originalConsoleWarn:()=>LEa,restoreConsole:()=>NAl,suppressConsoleUnlessVerbose:()=>Fmn});function Fmn(t=process.argv){t.includes("-v")||t.includes("--verbose")||(console.log=()=>{},console.warn=()=>{},console.error=()=>{},console.debug=()=>{},console.info=()=>{})}function NAl(){console.log=Fle,console.error=_Yt,console.warn=LEa,console.info=UEa,console.debug=QEa}var Fle,_Yt,LEa,UEa,QEa,iVe=le(()=>{"use strict";Fle=console.log.bind(console),_Yt=console.error.bind(console),LEa=console.warn.bind(console),UEa=console.info.bind(console),QEa=console.debug.bind(console)});var Umn={};$o(Umn,{OPENAI_REASONING_EFFORT_OPTIONS:()=>Lle,isOpenaiReasoningEffort:()=>f1e,normalizeOpenaiReasoningEffort:()=>_k});function f1e(t){return typeof t=="string"&&Lle.includes(t)}function _k(t){let e=(t||"medium").toLowerCase();return f1e(e)?e:"medium"}var Lle,o7=le(()=>{"use strict";Lle=["none","low","medium","high","xhigh"]});var GEa={};$o(GEa,{COMMAND_CANCEL_TOKEN:()=>FAl,COMMAND_OUTPUT_STRING:()=>UAl,COMMAND_REQ_APP_STRING:()=>QAl,COMPLETION_RESULT_CHANGES_FLAG:()=>GAl,CardStatus:()=>Cg,DEFAULT_PLATFORM:()=>OAl,DiracMessageType:()=>cy,OPENAI_REASONING_EFFORT_OPTIONS:()=>Lle,TaskStatus:()=>s7,UIActionButtonType:()=>nke,browserActions:()=>LAl,isFinalStatus:()=>c7,isOpenaiReasoningEffort:()=>f1e});function c7(t){return t==="success"||t==="error"||t==="skipped"||t==="cancelled"||t==="abandoned"}var OAl,FAl,s7,cy,LAl,UAl,QAl,GAl,nke,Cg,tp=le(()=>{"use strict";o7();OAl="unknown",FAl="__dirac_command_cancel__",s7=(u=>(u.IDLE="idle",u.COMPLETED="completed",u.PREPARING="preparing",u.WAITING_FOR_API="waiting_for_api",u.THINKING="thinking",u.STREAMING_TEXT="streaming_text",u.BUILDING_TOOL_CALL="building_tool_call",u.EXECUTING_TOOL="executing_tool",u.AWAITING_USER_INPUT="awaiting_user_input",u.CANCELLING="cancelling",u.BUILDING_REQUEST="building_request",u.CANCELLED="cancelled",u))(s7||{}),cy=(a=>(a.MARKDOWN="markdown",a.CARD="card",a.API_STATUS="api_status",a.CHECKPOINT="checkpoint",a))(cy||{}),LAl=["launch","click","type","scroll_down","scroll_up","close"],UAl="Output:",QAl="REQ_APP",GAl="HAS_CHANGES",nke=(c=>(c.APPROVE="approve",c.REJECT="reject",c.NEW_TASK="new_task",c.CANCEL="cancel",c.PROCEED="proceed",c.RETRY="retry",c.UTILITY="utility",c))(nke||{}),Cg=(h=>(h.BUILDING="building",h.PENDING="pending",h.RUNNING="running",h.SUCCESS="success",h.ERROR="error",h.SKIPPED="skipped",h.CANCELLED="cancelled",h.ABANDONED="abandoned",h.WAITING_FOR_INPUT="waiting_for_input",h))(Cg||{})});var TT,qEa,OS,are,p1e=le(()=>{"use strict";TT={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"},qEa={primary:"#B1B9F9",plan:"yellow",success:"green",error:"red",warning:"yellow",info:"cyan",muted:"gray",brightWhite:"brightWhite",brightBlack:"brightBlack",brightCyan:"brightCyan",blue:"blue",magenta:"magenta",gray:"gray",cyan:"cyan",codeBg:"#2a2a3e"},OS={markdown:{heading:{bold:!0,color:"brightWhite"},headingSub:{bold:!0},strong:{bold:!0,color:"brightWhite"},emphasis:{italic:!0},link:{color:"blue",underline:!0},inlineCode:{color:"brightCyan",backgroundColor:"#2a2a3e"},codeBlock:{color:"brightCyan"},codeBorder:{color:"brightBlack"},blockquote:{dimColor:!0},blockquoteBar:{color:"brightBlack"},tableBorder:{color:"brightBlack"},tableHeader:{bold:!0},hr:{color:"gray"}},thinking:{shimmerDim:{color:"gray",dimColor:!0},shimmerBright:{color:"brightWhite",bold:!0},elapsed:{color:"gray"},breadcrumb:{color:"gray",dimColor:!0}},conversation:{user:{color:qEa.success},assistant:{color:qEa.primary},planModeTint:{color:"yellow"},completion:{color:"green",bold:!0},divider:{color:"gray",dimColor:!0},reasoning:{color:"gray"},reasoningTitle:{color:"gray",dimColor:!0},typeChangeSep:{color:"gray"}}},are={primary:"#B1B9F9",plan:"yellow",success:"green",error:"red",warning:"yellow",info:"cyan",muted:"gray",status:{success:"green",error:"red",cancelled:"red",running:"blue",waiting:"magenta",building:"yellow",pending:"yellow",skipped:"gray",abandoned:"gray",default:"gray"},diff:{addBg:"#080f0a",addFg:"#52C97A",removeBg:"#120707",removeFg:"#DD6B68",gutterFg:"#505866"},separator:"gray",border:"gray",dimText:"gray",costWarning:1,costDanger:5,contextWarning:.5,contextDanger:.8}});var WEa={};$o(WEa,{DEFAULT_ICON:()=>Qmn,ICON_MAP:()=>HEa,getIcon:()=>$U,getIconCategoryColor:()=>yYt,getStatusColor:()=>A1t,getStatusIcon:()=>Gmn,setIconMode:()=>HAl});function yYt(t){if(t)return qAl[t]}function HAl(t){VEa=t}function $U(t,e){let r=e??VEa??"emoji";return t?(HEa[t]||Qmn)[r]:Qmn[r]}function Gmn(t){switch(t){case"building":case"pending":return"\u22EF";case"running":return"\u280B";case"success":return"\u2713";case"error":return"\u2715";case"skipped":return"\u21B7";case"cancelled":return"\u2298";case"abandoned":return"\u{1F47B}";case"waiting_for_input":return"\u2370";default:return"\u2022"}}function A1t(t){switch(t){case"success":return"green";case"error":case"cancelled":return"red";case"running":return"blue";case"waiting_for_input":return"magenta";case"building":case"pending":return"yellow";case"skipped":case"abandoned":default:return"gray"}}var qAl,HEa,Qmn,VEa,g1t=le(()=>{"use strict";qAl={"file-text":"cyan",code:"cyan",edit:"cyan",search:"magenta",terminal:"green",eye:"blue",globe:"blue",cpu:"yellow"};HEa={"file-text":{emoji:"\u{1F4C4}",unicode:"\u2503",ascii:"FILE"},search:{emoji:"\u{1F50D}",unicode:"\u2315",ascii:"SEARCH"},terminal:{emoji:"\u{1F4BB}",unicode:"\u2318",ascii:"TERM"},code:{emoji:"\u{1F4DD}",unicode:"\u270E",ascii:"CODE"},folder:{emoji:"\u{1F4C1}",unicode:"\u25B8",ascii:"DIR"},check:{emoji:"\u2714",unicode:"\u2713",ascii:"OK"},"alert-triangle":{emoji:"\u26A0",unicode:"\u26A0",ascii:"WARN"},info:{emoji:"\u2139",unicode:"\u2139",ascii:"INFO"},"help-circle":{emoji:"\u2753",unicode:"?",ascii:"HELP"},"message-square":{emoji:"\u{1F4AC}",unicode:"\u276F",ascii:"MSG"},eye:{emoji:"\u{1F441}",unicode:"\u25C9",ascii:"VIEW"},play:{emoji:"\u25B6",unicode:"\u25B6",ascii:"RUN"},"stop-circle":{emoji:"\u{1F6D1}",unicode:"\u25A0",ascii:"STOP"},"refresh-cw":{emoji:"\u{1F504}",unicode:"\u21BB",ascii:"RELOAD"},"trash-2":{emoji:"\u{1F5D1}",unicode:"\u232B",ascii:"DEL"},plus:{emoji:"\u2795",unicode:"+",ascii:"ADD"},edit:{emoji:"\u270F",unicode:"\u270E",ascii:"EDIT"},"external-link":{emoji:"\u{1F517}",unicode:"\u2934",ascii:"LINK"},settings:{emoji:"\u2699",unicode:"\u2699",ascii:"SET"},user:{emoji:"\u{1F464}",unicode:"\u25C7",ascii:"USER"},cpu:{emoji:"\u{1F9E0}",unicode:"\u25C6",ascii:"CPU"},globe:{emoji:"\u{1F310}",unicode:"\u2295",ascii:"WEB"},"chevron-right":{emoji:"\u203A",unicode:"\u203A",ascii:">"},"chevron-down":{emoji:"\u2304",unicode:"\u2304",ascii:"v"},"check-circle":{emoji:"\u2714",unicode:"\u2713",ascii:"DONE"},"x-circle":{emoji:"\u2716",unicode:"\u2715",ascii:"FAIL"},fast_forward:{emoji:"\u23ED",unicode:"\u23ED",ascii:"SKIP"},ghost:{emoji:"\u{1F47B}",unicode:"\u25CC",ascii:"GHOST"}},Qmn={emoji:"\u{1F527}",unicode:"\u2699",ascii:"TOOL"},VEa=null});var AN={};$o(AN,{Spinner:()=>Hmn,centerText:()=>aVe,clearLine:()=>KAl,colorize:()=>uM,createContextBar:()=>Vmn,cursorUp:()=>YAl,formatMessage:()=>jEa,formatState:()=>JAl,formatTimestamp:()=>zEa,print:()=>oVe,printError:()=>_1t,printInfo:()=>t1,printSuccess:()=>$Al,printWarning:()=>mN,promptConfirmation:()=>XAl,promptUser:()=>KEa,separator:()=>qmn,setTerminalTitle:()=>y1t,style:()=>Zy,taskHeader:()=>JEa});function aVe(t,e){let r=e||process.stdout.columns||80,i=Math.max(0,Math.floor((r-t.length)/2));return" ".repeat(i)+t}function uM(t,...e){return e.join("")+t+TT.reset}function zEa(t){return new Date(t).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function VAl(t){let{content:e}=t;switch(e.type){case"markdown":return e.isReasoning?$U("cpu"):$U("message-square");case"card":{let{card:r}=e;return r.icon?r.icon:r.requireApproval?$U("terminal"):r.requireFeedback?$U("help-circle"):r.status==="success"?$U("check-circle"):r.status==="error"?$U("x-circle"):$U("settings")}case"api_status":return $U("refresh-cw");default:return" "}}function jEa(t,e=!1){let r=zEa(t.ts),i=VAl(t),a=`${Zy.dim(r)} ${i}`,{content:o}=t;switch(o.type){case"markdown":return WAl(t,a,e);case"card":return zAl(t,a,e);case"api_status":return jAl(t,a,e);default:return""}}function WAl(t,e,r){if(t.content.type!=="markdown")return"";let{content:i,isReasoning:a}=t.content;return a?`${e} ${Zy.dim("Thinking:")} ${Zy.italic(i)}`:`${e} ${Zy.assistant(i)}`}function zAl(t,e,r){if(t.content.type!=="card")return"";let{card:i}=t.content,a=[],o=i.status==="error"?Zy.error:Zy.tool,n=i.status==="success"?Zy.success("\u2713 "):i.status==="error"?Zy.error("\u2715 "):"",c=i.startTime&&i.endTime?` \xB7 ${((i.endTime-i.startTime)/1e3).toFixed(1)}s`:"",f=i.outcome?` \xB7 ${i.outcome}`:"",h=i.status!=="running"&&i.status!=="success"&&i.status!=="error"?` (${i.status})`:"";if(a.push(`${e} ${n}${o(i.header)}${h}${f}${c}`),i.body){let p=i.body.trim();if(p){let m=p.length>1e3?p.substring(0,1e3)+"...":p;a.push(m.split(`
|
|
32
32
|
`).map(u=>`${" ".repeat(e.length+1)}${Zy.dim(u)}`).join(`
|
|
33
33
|
`))}}return i.requireApproval&&a.push(`${" ".repeat(e.length+1)}${Zy.warning("Approval required")}`),i.requireFeedback&&a.push(`${" ".repeat(e.length+1)}${Zy.info("Feedback required")}`),a.join(`
|
|
34
34
|
`)}function jAl(t,e,r){if(t.content.type!=="api_status")return"";let{status:i}=t.content;if(!r&&!i.cost&&!i.tokensIn)return"";let a=i.tokensIn!==void 0?`Tokens: ${i.tokensIn.toLocaleString()} in, ${i.tokensOut?.toLocaleString()} out${i.reasoningTokens?` (+${i.reasoningTokens.toLocaleString()} thinking)`:""}`:"",o=i.cost!==void 0?`Cost: $${i.cost.toFixed(4)}`:"",n=i.cacheReads!==void 0||i.cacheWrites!==void 0?` (Cache: ${(i.cacheReads||0).toLocaleString()} read, ${(i.cacheWrites||0).toLocaleString()} write)`:"",c=i.contextWindow!==void 0?` | Context: ${i.contextUsagePercentage}% of ${(i.contextWindow/1e3).toFixed(0)}K`:"";return`${e} ${Zy.api("API Status")} ${Zy.dim(`[${a}${n}${c} | ${o}]`)}`}function qmn(t="\u2500",e=60){return Zy.dim(t.repeat(e))}function JEa(t,e){return[qmn("\u2550"),Zy.bold(` Task: ${t}`),e?` ${Zy.dim(e.substring(0,80))}${e.length>80?"...":""}`:"",qmn("\u2550")].filter(Boolean).join(`
|
package/dist/lib.mjs
CHANGED
|
@@ -4963,7 +4963,7 @@ ${T.serialize()}`})).finalize("error")}catch(k){Nt.error("[Task] Failed to emit
|
|
|
4963
4963
|
<div class="countdown">Feel free to close this window and continue in your ${r}</div>
|
|
4964
4964
|
</div>
|
|
4965
4965
|
</body>
|
|
4966
|
-
</html>`}var oLr=class{};var sLr=class extends oLr{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 uLr=class extends Hbe{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}};Zf();ka();var HRi="0.4.2";YHn();import VRi from"node:fs";import iju from"node:path";var WRi=iju.join(EEr.data,"acp-session-tasks.json");function aju(){try{let t=VRi.readFileSync(WRi,"utf-8");return JSON.parse(t)}catch{return{}}}function AHh(t){VRi.mkdirSync(iju.dirname(WRi),{recursive:!0}),VRi.writeFileSync(WRi,JSON.stringify(t,null,2))}async function oju(t,e){let r=aju(),i=r[t]??[];r[t]=[...i,e],AHh(r)}function sju(t){let r=aju()[t];return r&&r.length>0?r[r.length-1]:void 0}FM();Ng();_g();var uju=Kn(Kke(),1);Zf();import*as qkt from"fs/promises";CF();ka();var cLr=class extends lSe{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 Nt.debug("[ACPDiffViewProvider] Client does not support fs.readTextFile, falling back to local fs"),super.open(e,r);this.isEditing=!0;let i=await yv(),a=KT.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 ys.workspace.saveOpenDocumentIfDirty({filePath:this.absolutePath})}catch{}try{Nt.debug("[ACPDiffViewProvider] Reading file via ACP:",this.absolutePath);let f=await this.connection.readTextFile({sessionId:this.getSessionId(),path:this.absolutePath});this.originalContent=f.content,this.fileEncoding="utf8",Nt.debug("[ACPDiffViewProvider] Read file successfully, length:",f.content.length)}catch(f){Nt.debug("[ACPDiffViewProvider] ACP read failed, falling back to local fs:",f);let h=await qkt.readFile(this.absolutePath);this.fileEncoding=await cZe(h),this.originalContent=uju.decode(h,this.fileEncoding)}}else this.originalContent="",this.fileEncoding="utf8";let n=await pnr(this.absolutePath);if(this.createdDirs=n,!o)if(this.canWriteFile())try{await this.connection.writeTextFile({sessionId:this.getSessionId(),path:this.absolutePath,content:""})}catch{await qkt.writeFile(this.absolutePath,"")}else await qkt.writeFile(this.absolutePath,"");let u=[];try{u=(await ys.workspace.getDiagnostics({filePaths:[]})).fileDiagnostics}catch{u=[]}this.preDiagnostics=u,await this.openDiffEditor(),await this.scrollEditorToLine(0),this.streamedLines=[]}async scrollEditorToLine(e){}async openDiffEditor(){await super.openDiffEditor()}async saveDocument(){if(!this.canWriteFile())return Nt.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 Nt.debug("[ACPDiffViewProvider] Writing file via ACP:",{path:this.absolutePath,contentLength:e.length}),await this.connection.writeTextFile({sessionId:this.getSessionId(),path:this.absolutePath,content:e}),Nt.debug("[ACPDiffViewProvider] Write file successfully"),!0}catch(r){return Nt.debug("[ACPDiffViewProvider] ACP write failed, falling back to local fs:",r),super.saveDocument()}}};ka();var zRi=class{async openDiff(e){return Nt.debug("[ACPDiffServiceClient] openDiff called (stub)"),yg.OpenDiffResponse.create({})}async getDocumentText(e){return Nt.debug("[ACPDiffServiceClient] getDocumentText called (stub)",{diffId:e.diffId}),yg.GetDocumentTextResponse.create({content:""})}async replaceText(e){return Nt.debug("[ACPDiffServiceClient] replaceText called (stub)"),yg.ReplaceTextResponse.create({})}async scrollDiff(e){return Nt.debug("[ACPDiffServiceClient] scrollDiff called (stub)"),yg.ScrollDiffResponse.create({})}async truncateDocument(e){return Nt.debug("[ACPDiffServiceClient] truncateDocument called (stub)"),yg.TruncateDocumentResponse.create({})}async saveDocument(e){return Nt.debug("[ACPDiffServiceClient] saveDocument called (stub)"),yg.SaveDocumentResponse.create({})}async closeAllDiffs(e){return Nt.debug("[ACPDiffServiceClient] closeAllDiffs called (stub)"),yg.CloseAllDiffsResponse.create({})}async openMultiFileDiff(e){return Nt.debug("[ACPDiffServiceClient] openMultiFileDiff called (stub)"),yg.OpenMultiFileDiffResponse.create({})}},jRi=class{version;constructor(e,r,i){this.version=i}async debugLog(e){return Nt.debug(e.value),LK.Empty.create()}async clipboardWriteText(e){return Nt.debug("[ACPEnvServiceClient] clipboardWriteText called (stub)"),LK.Empty.create()}async clipboardReadText(e){return Nt.debug("[ACPEnvServiceClient] clipboardReadText called (stub)"),LK.String.create({value:""})}async getHostVersion(e){return yg.GetHostVersionResponse.create({version:this.version,platform:"Dirac ACP Agent",diracType:"CLI"})}async getIdeRedirectUri(e){return Nt.debug("[ACPEnvServiceClient] getIdeRedirectUri called (stub)"),LK.String.create({value:""})}async getTelemetrySettings(e){return yg.GetTelemetrySettingsResponse.create({isEnabled:yg.Setting.DISABLED})}subscribeToTelemetrySettings(e,r){return r.onResponse(yg.TelemetrySettingsEvent.create({isEnabled:yg.Setting.DISABLED})),()=>{}}async shutdown(e){return Nt.debug("[ACPEnvServiceClient] shutdown called (stub)"),LK.Empty.create()}async openExternal(e){let r=e.value||"";if(r){Nt.debug(`[ACPEnvServiceClient] openExternal: ${r}`);let{openUrlInBrowser:i}=await Promise.resolve().then(()=>(lju(),cju));await i(r)}return LK.Empty.create()}},JRi=class{constructor(e,r){}async showTextDocument(e){return Nt.debug("[ACPWindowServiceClient] showTextDocument called (stub)",{path:e.path}),yg.TextEditorInfo.create({documentPath:e.path})}async showOpenDialogue(e){return Nt.debug("[ACPWindowServiceClient] showOpenDialogue called (stub)"),yg.SelectedResources.create({paths:[]})}async showMessage(e){return Nt.debug("[ACPWindowServiceClient] showMessage called (stub)",{message:e.message,type:e.type}),yg.SelectedResponse.create({})}async showInputBox(e){return Nt.debug("[ACPWindowServiceClient] showInputBox called (stub)"),yg.ShowInputBoxResponse.create({response:""})}async showSaveDialog(e){return Nt.debug("[ACPWindowServiceClient] showSaveDialog called (stub)"),yg.ShowSaveDialogResponse.create({selectedPath:""})}async openFile(e){return Nt.debug("[ACPWindowServiceClient] openFile called (stub)",{filePath:e.filePath}),yg.OpenFileResponse.create({})}async openSettings(e){return Nt.debug("[ACPWindowServiceClient] openSettings called (stub)"),yg.OpenSettingsResponse.create({})}async getOpenTabs(e){return Nt.debug("[ACPWindowServiceClient] getOpenTabs called (stub)"),yg.GetOpenTabsResponse.create({paths:[]})}async getVisibleTabs(e){return Nt.debug("[ACPWindowServiceClient] getVisibleTabs called (stub)"),yg.GetVisibleTabsResponse.create({paths:[]})}async getActiveEditor(e){return Nt.debug("[ACPWindowServiceClient] getActiveEditor called (stub)"),yg.GetActiveEditorResponse.create({})}},KRi=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 Nt.debug("[ACPWorkspaceServiceClient] getWorkspacePaths called",{cwd:r}),yg.GetWorkspacePathsResponse.create({paths:[r]})}async saveOpenDocumentIfDirty(e){return Nt.debug("[ACPWorkspaceServiceClient] saveOpenDocumentIfDirty called (stub)"),yg.SaveOpenDocumentIfDirtyResponse.create({})}async getDiagnostics(e){return Nt.debug("[ACPWorkspaceServiceClient] getDiagnostics called (stub)"),yg.GetDiagnosticsResponse.create({fileDiagnostics:[]})}async openProblemsPanel(e){return Nt.debug("[ACPWorkspaceServiceClient] openProblemsPanel called (stub)"),yg.OpenProblemsPanelResponse.create({})}async openInFileExplorerPanel(e){return Nt.debug("[ACPWorkspaceServiceClient] openInFileExplorerPanel called (stub)",{path:e.path}),yg.OpenInFileExplorerPanelResponse.create({})}async openDiracSidebarPanel(e){return Nt.debug("[ACPWorkspaceServiceClient] openDiracSidebarPanel called (stub)"),yg.OpenDiracSidebarPanelResponse.create({})}async openTerminalPanel(e){return Nt.debug("[ACPWorkspaceServiceClient] openTerminalPanel called (stub)"),yg.OpenTerminalResponse.create({})}async executeCommandInTerminal(e){return Nt.debug("[ACPWorkspaceServiceClient] executeCommandInTerminal called (stub)",{command:e.command,hasTerminalCapability:this._clientCapabilities?.terminal}),yg.ExecuteCommandInTerminalResponse.create({})}async prepareDiagnostics(e){return yg.PrepareDiagnosticsResponse.create({success:!0})}async openFolder(e){return Nt.debug("[ACPWorkspaceServiceClient] openFolder called (stub)",{path:e.path}),yg.OpenFolderResponse.create({success:!0})}},lLr=class{workspaceClient;envClient;windowClient;diffClient;constructor(e,r,i,a){this.workspaceClient=new KRi(e,r,i),this.envClient=new jRi(e,r,a),this.windowClient=new JRi(e,r),this.diffClient=new zRi}};ka();import{EventEmitter as _Hh}from"events";var YRi=class extends _Hh{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(`
|
|
4966
|
+
</html>`}var oLr=class{};var sLr=class extends oLr{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 uLr=class extends Hbe{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}};Zf();ka();var HRi="0.4.3";YHn();import VRi from"node:fs";import iju from"node:path";var WRi=iju.join(EEr.data,"acp-session-tasks.json");function aju(){try{let t=VRi.readFileSync(WRi,"utf-8");return JSON.parse(t)}catch{return{}}}function AHh(t){VRi.mkdirSync(iju.dirname(WRi),{recursive:!0}),VRi.writeFileSync(WRi,JSON.stringify(t,null,2))}async function oju(t,e){let r=aju(),i=r[t]??[];r[t]=[...i,e],AHh(r)}function sju(t){let r=aju()[t];return r&&r.length>0?r[r.length-1]:void 0}FM();Ng();_g();var uju=Kn(Kke(),1);Zf();import*as qkt from"fs/promises";CF();ka();var cLr=class extends lSe{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 Nt.debug("[ACPDiffViewProvider] Client does not support fs.readTextFile, falling back to local fs"),super.open(e,r);this.isEditing=!0;let i=await yv(),a=KT.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 ys.workspace.saveOpenDocumentIfDirty({filePath:this.absolutePath})}catch{}try{Nt.debug("[ACPDiffViewProvider] Reading file via ACP:",this.absolutePath);let f=await this.connection.readTextFile({sessionId:this.getSessionId(),path:this.absolutePath});this.originalContent=f.content,this.fileEncoding="utf8",Nt.debug("[ACPDiffViewProvider] Read file successfully, length:",f.content.length)}catch(f){Nt.debug("[ACPDiffViewProvider] ACP read failed, falling back to local fs:",f);let h=await qkt.readFile(this.absolutePath);this.fileEncoding=await cZe(h),this.originalContent=uju.decode(h,this.fileEncoding)}}else this.originalContent="",this.fileEncoding="utf8";let n=await pnr(this.absolutePath);if(this.createdDirs=n,!o)if(this.canWriteFile())try{await this.connection.writeTextFile({sessionId:this.getSessionId(),path:this.absolutePath,content:""})}catch{await qkt.writeFile(this.absolutePath,"")}else await qkt.writeFile(this.absolutePath,"");let u=[];try{u=(await ys.workspace.getDiagnostics({filePaths:[]})).fileDiagnostics}catch{u=[]}this.preDiagnostics=u,await this.openDiffEditor(),await this.scrollEditorToLine(0),this.streamedLines=[]}async scrollEditorToLine(e){}async openDiffEditor(){await super.openDiffEditor()}async saveDocument(){if(!this.canWriteFile())return Nt.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 Nt.debug("[ACPDiffViewProvider] Writing file via ACP:",{path:this.absolutePath,contentLength:e.length}),await this.connection.writeTextFile({sessionId:this.getSessionId(),path:this.absolutePath,content:e}),Nt.debug("[ACPDiffViewProvider] Write file successfully"),!0}catch(r){return Nt.debug("[ACPDiffViewProvider] ACP write failed, falling back to local fs:",r),super.saveDocument()}}};ka();var zRi=class{async openDiff(e){return Nt.debug("[ACPDiffServiceClient] openDiff called (stub)"),yg.OpenDiffResponse.create({})}async getDocumentText(e){return Nt.debug("[ACPDiffServiceClient] getDocumentText called (stub)",{diffId:e.diffId}),yg.GetDocumentTextResponse.create({content:""})}async replaceText(e){return Nt.debug("[ACPDiffServiceClient] replaceText called (stub)"),yg.ReplaceTextResponse.create({})}async scrollDiff(e){return Nt.debug("[ACPDiffServiceClient] scrollDiff called (stub)"),yg.ScrollDiffResponse.create({})}async truncateDocument(e){return Nt.debug("[ACPDiffServiceClient] truncateDocument called (stub)"),yg.TruncateDocumentResponse.create({})}async saveDocument(e){return Nt.debug("[ACPDiffServiceClient] saveDocument called (stub)"),yg.SaveDocumentResponse.create({})}async closeAllDiffs(e){return Nt.debug("[ACPDiffServiceClient] closeAllDiffs called (stub)"),yg.CloseAllDiffsResponse.create({})}async openMultiFileDiff(e){return Nt.debug("[ACPDiffServiceClient] openMultiFileDiff called (stub)"),yg.OpenMultiFileDiffResponse.create({})}},jRi=class{version;constructor(e,r,i){this.version=i}async debugLog(e){return Nt.debug(e.value),LK.Empty.create()}async clipboardWriteText(e){return Nt.debug("[ACPEnvServiceClient] clipboardWriteText called (stub)"),LK.Empty.create()}async clipboardReadText(e){return Nt.debug("[ACPEnvServiceClient] clipboardReadText called (stub)"),LK.String.create({value:""})}async getHostVersion(e){return yg.GetHostVersionResponse.create({version:this.version,platform:"Dirac ACP Agent",diracType:"CLI"})}async getIdeRedirectUri(e){return Nt.debug("[ACPEnvServiceClient] getIdeRedirectUri called (stub)"),LK.String.create({value:""})}async getTelemetrySettings(e){return yg.GetTelemetrySettingsResponse.create({isEnabled:yg.Setting.DISABLED})}subscribeToTelemetrySettings(e,r){return r.onResponse(yg.TelemetrySettingsEvent.create({isEnabled:yg.Setting.DISABLED})),()=>{}}async shutdown(e){return Nt.debug("[ACPEnvServiceClient] shutdown called (stub)"),LK.Empty.create()}async openExternal(e){let r=e.value||"";if(r){Nt.debug(`[ACPEnvServiceClient] openExternal: ${r}`);let{openUrlInBrowser:i}=await Promise.resolve().then(()=>(lju(),cju));await i(r)}return LK.Empty.create()}},JRi=class{constructor(e,r){}async showTextDocument(e){return Nt.debug("[ACPWindowServiceClient] showTextDocument called (stub)",{path:e.path}),yg.TextEditorInfo.create({documentPath:e.path})}async showOpenDialogue(e){return Nt.debug("[ACPWindowServiceClient] showOpenDialogue called (stub)"),yg.SelectedResources.create({paths:[]})}async showMessage(e){return Nt.debug("[ACPWindowServiceClient] showMessage called (stub)",{message:e.message,type:e.type}),yg.SelectedResponse.create({})}async showInputBox(e){return Nt.debug("[ACPWindowServiceClient] showInputBox called (stub)"),yg.ShowInputBoxResponse.create({response:""})}async showSaveDialog(e){return Nt.debug("[ACPWindowServiceClient] showSaveDialog called (stub)"),yg.ShowSaveDialogResponse.create({selectedPath:""})}async openFile(e){return Nt.debug("[ACPWindowServiceClient] openFile called (stub)",{filePath:e.filePath}),yg.OpenFileResponse.create({})}async openSettings(e){return Nt.debug("[ACPWindowServiceClient] openSettings called (stub)"),yg.OpenSettingsResponse.create({})}async getOpenTabs(e){return Nt.debug("[ACPWindowServiceClient] getOpenTabs called (stub)"),yg.GetOpenTabsResponse.create({paths:[]})}async getVisibleTabs(e){return Nt.debug("[ACPWindowServiceClient] getVisibleTabs called (stub)"),yg.GetVisibleTabsResponse.create({paths:[]})}async getActiveEditor(e){return Nt.debug("[ACPWindowServiceClient] getActiveEditor called (stub)"),yg.GetActiveEditorResponse.create({})}},KRi=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 Nt.debug("[ACPWorkspaceServiceClient] getWorkspacePaths called",{cwd:r}),yg.GetWorkspacePathsResponse.create({paths:[r]})}async saveOpenDocumentIfDirty(e){return Nt.debug("[ACPWorkspaceServiceClient] saveOpenDocumentIfDirty called (stub)"),yg.SaveOpenDocumentIfDirtyResponse.create({})}async getDiagnostics(e){return Nt.debug("[ACPWorkspaceServiceClient] getDiagnostics called (stub)"),yg.GetDiagnosticsResponse.create({fileDiagnostics:[]})}async openProblemsPanel(e){return Nt.debug("[ACPWorkspaceServiceClient] openProblemsPanel called (stub)"),yg.OpenProblemsPanelResponse.create({})}async openInFileExplorerPanel(e){return Nt.debug("[ACPWorkspaceServiceClient] openInFileExplorerPanel called (stub)",{path:e.path}),yg.OpenInFileExplorerPanelResponse.create({})}async openDiracSidebarPanel(e){return Nt.debug("[ACPWorkspaceServiceClient] openDiracSidebarPanel called (stub)"),yg.OpenDiracSidebarPanelResponse.create({})}async openTerminalPanel(e){return Nt.debug("[ACPWorkspaceServiceClient] openTerminalPanel called (stub)"),yg.OpenTerminalResponse.create({})}async executeCommandInTerminal(e){return Nt.debug("[ACPWorkspaceServiceClient] executeCommandInTerminal called (stub)",{command:e.command,hasTerminalCapability:this._clientCapabilities?.terminal}),yg.ExecuteCommandInTerminalResponse.create({})}async prepareDiagnostics(e){return yg.PrepareDiagnosticsResponse.create({success:!0})}async openFolder(e){return Nt.debug("[ACPWorkspaceServiceClient] openFolder called (stub)",{path:e.path}),yg.OpenFolderResponse.create({success:!0})}},lLr=class{workspaceClient;envClient;windowClient;diffClient;constructor(e,r,i,a){this.workspaceClient=new KRi(e,r,i),this.envClient=new jRi(e,r,a),this.windowClient=new JRi(e,r),this.diffClient=new zRi}};ka();import{EventEmitter as _Hh}from"events";var YRi=class extends _Hh{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(`
|
|
4967
4967
|
`);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)}},$Ri=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){Nt.debug("[AcpTerminal] sendText not supported for ACP terminals")}show(){}hide(){}dispose(){this._manager.release(this._managedTerminal.id).catch(e=>{Nt.debug("[AcpTerminal] Error releasing terminal:",e)})}};function yHh(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 dLr=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 YRi(this,a.id);this.processes.set(a.numericId,o),o.once("completed",()=>{e.busy=!1,a.busy=!1}),o.once("error",u=>{e.busy=!1,a.busy=!1});let n=new Promise((u,f)=>{o.once("continue",()=>u()),o.once("completed",()=>u()),o.once("error",h=>f(h))});return this.runCommandInternal(a,r,o),yHh(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[u,f]of this.terminalInfos)if(!f.busy&&f.terminal._cwd===e)return f;if(this.terminalReuseEnabled){for(let[u,f]of this.terminalInfos)if(!f.busy){let h=f.terminal;return h._cwd=e,h.shellIntegration?.cwd&&(h.shellIntegration.cwd.fsPath=e),h._managedTerminal.cwd=e,f}}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 $Ri(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),Nt.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=>{Nt.debug("[AcpTerminalManager] Error releasing terminals:",e)}),this.terminals.clear(),this.numericIdToStringId.clear(),this.processes.clear(),this.terminalInfos.clear(),Nt.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(`
|
|
4968
4968
|
`)}
|
|
4969
4969
|
... (output truncated) ...
|