@github/copilot-language-server 1.476.0 → 1.478.0
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.
|
@@ -169606,7 +169606,11 @@ function vVe(t) {
|
|
|
169606
169606
|
return new Promise((c) => {
|
|
169607
169607
|
let u = false, d = /* @__PURE__ */ __name((b) => {
|
|
169608
169608
|
u || (u = true, p && clearTimeout(p), c(b));
|
|
169609
|
-
}, "d"), h = (0, import_child_process13.spawn)(T$r(), e, {
|
|
169609
|
+
}, "d"), h = (0, import_child_process13.spawn)(T$r(), e, {
|
|
169610
|
+
/*CLS_PATCH:ripgrep-spawn-cwd*/
|
|
169611
|
+
cwd: require("fs").existsSync(r.location) ? r.location : require("os").homedir(),
|
|
169612
|
+
env: bK()
|
|
169613
|
+
}), p = t.timeoutMs ? setTimeout(() => {
|
|
169610
169614
|
let b = t.timeoutMs / 1e3, C = a ?? "ripgrep";
|
|
169611
169615
|
try {
|
|
169612
169616
|
let y = `${C} timed out after ${b} seconds.`, G = "Narrow the search further with glob patterns and/or path filters for faster performance.", E = m.getOutputSnapshot(), R = E.isLargeOutput, w = R ? "" : E.output.trim(), v = R ? E.filePath : "", Y = R ? E.totalBytes : 0, k = w.length > 0 || R, L = "Note: These results may be incomplete. " + G, Z;
|
|
@@ -4761,7 +4761,7 @@ eof_line: "*** End of File" LF
|
|
|
4761
4761
|
`)}function U$o(t){let e=new Set;for(let r of Object.values(t.properties)){let n=r;n.type==="array"?e.add("multi-enum"):n.type==="string"&&(n.enum||n.oneOf)?e.add("enum"):e.add(n.type)}return[...e].sort()}function O$r(t,e){let r=Object.keys(t.requestedSchema.properties).length,n=U$o(t.requestedSchema);return{properties:{elicitation_action:e,elicitation_field_types:JSON.stringify(n)},metrics:{elicitation_field_count:r}}}function Z$r(t){return{name:op,title:"Asking user",description:["Ask the user a question and wait for their response.","Use this tool when you need to ask the user questions during execution. This allows you to:","1. Gather user preferences or requirements","2. Clarify ambiguous instructions","3. Get decisions on implementation choices as you work","4. Collect multiple related pieces of information in a single interaction"].join(`
|
|
4762
4762
|
`),input_schema:Wr(r2t),callback:Dn(r2t,async(e,r)=>{try{let n=await t({message:e.message,requestedSchema:{type:"object",...e.requestedSchema},toolCallId:r?.toolCallId}),o=O$r(e,n.action);switch(n.action){case"accept":{let s=n.content;if(!s||Object.keys(s).length===0)return{textResultForLlm:"User accepted but provided no values.",resultType:"success",toolTelemetry:o};let a=X$o(s),l=M$o(s);return{textResultForLlm:`User responded: ${a}`,sessionLog:`User responded:
|
|
4763
4763
|
${l}`,resultType:"success",toolTelemetry:o}}case"decline":return{textResultForLlm:MMt,resultType:"success",toolTelemetry:o};case"cancel":return{textResultForLlm:"User cancelled the request.",resultType:"success",toolTelemetry:o};default:return{textResultForLlm:`Unknown user action: ${String(n.action)}`,resultType:"failure",error:`Unknown action: ${String(n.action)}`,toolTelemetry:o}}}catch(n){let o=M(n);return{textResultForLlm:`Error asking user: ${o}`,resultType:"failure",error:o,toolTelemetry:O$r(e,"error")}}}),safeForTelemetry:!0,summariseIntention:ah(r2t,e=>e.message.length>60?e.message.slice(0,57)+"...":e.message,"Waiting for response"),instructions:[`Use the ${op} tool to ask the user clarifying questions when needed.`,"","**IMPORTANT: Never ask questions via plain text output.** When you need input from the user, use this tool instead of asking in your response text. The tool provides a better UX and ensures the user's answer is captured properly.","","This tool presents a structured form to the user. You provide a `message` describing what you need, and a `requestedSchema` defining the form fields. The schema follows JSON Schema conventions \u2014 the input_schema for this tool already describes the exact shape.","","**When to use this tool:**","- You need the user to make a decision before you can proceed (e.g., choosing between implementation approaches)","- Requirements are ambiguous and you need specific, structured input to resolve them","- You want to collect several related preferences at once rather than asking one at a time","- The user should confirm or override defaults before you act on them","","**Choosing field types:**","- **Enum** \u2014 when you know the valid options and the user must pick one (e.g., database engine, auth strategy, log level)",'- **Boolean** \u2014 for yes/no decisions (e.g., "enable caching?", "run migrations?")',"- **Multi-select array** \u2014 when the user should pick one or more from a known set (e.g., which features to include, which platforms to target)","- **Number/integer** \u2014 for numeric configuration the user may want to tune (e.g., port, timeout, retry count)","- **String** \u2014 only when the answer is truly open-ended and can't be predicted (e.g., project name, custom path). Use `format` to hint at structure when applicable (email, URI, date).","","**Guidelines:**","- Keep forms focused on one topic \u2014 don't mix unrelated questions in a single form","- Provide clear `title` and `description` on each field so the user understands what they're choosing","- Set sensible `default` values when a reasonable default exists \u2014 if you recommend a specific option, make it the default","- A single-field form is perfectly fine for a simple yes/no or single choice","- Order `properties` keys in the same sequence you discuss the topics in `message` \u2014 the form renders fields in property order, so matching the description avoids forcing the user to jump around","","**Example \u2014 simple single-choice question:**","```json","{",' "message": "What database should I use?",',' "requestedSchema": {',' "properties": {',' "database": {',' "type": "string",',' "title": "Database engine",',' "enum": ["PostgreSQL", "MySQL", "SQLite"],',' "default": "PostgreSQL"'," }"," },",' "required": ["database"]'," }","}","```","","**User actions:**","- The user may **accept** the form (you receive their field values)","- The user may **decline** (they chose not to answer \u2014 respect this and proceed with reasonable defaults)","- The user may **cancel** (they want to abort the current interaction)","","**When to STOP and ask (do not assume):**","- Design decisions that significantly affect implementation approach",'- Behavioral questions (e.g., "should this be unlimited or capped?")',"- Scope ambiguity (e.g., which features to include/exclude)","- Edge cases where multiple reasonable approaches exist"].join(`
|
|
4764
|
-
`)}}var D$o,r2t,x$r=A(()=>{"use strict";tr();Et();cye();Vs();DRt();D$o=T.object({properties:T.record(T.string(),z4e),required:T.array(T.string()).optional()}),r2t=T.object({message:T.string().describe("A message describing what information you need from the user. Be clear and specific."),requestedSchema:D$o.describe("A JSON Schema object defining the form fields to present to the user.")})});import*as o2t from"path";function T$r(){if(process.env.USE_BUILTIN_RIPGREP==="false")return"rg";if(process.env.GITHUB_COPILOT_RIPGREP_PATH_OVERRIDE)return process.env.GITHUB_COPILOT_RIPGREP_PATH_OVERRIDE;let t=process.platform==="win32"?".exe":"",e=`ripgrep/bin/${process.platform}-${process.arch}/rg${t}`;return o2t.join(import.meta.dirname,e)}var _$r=A(()=>{"use strict"});var F$r,s2t,h8,i2t=A(()=>{"use strict";h4();Ln();WRt();Et();OJe();F$r=500,s2t=128,h8=class{constructor(e,r,n){this.threshold=e;this.ignoreContentBefore=r;this.ignoreContentAfter=n.ignoreContentAfter,this.onTempFileCreated=n.onTempFileCreated,this.sessionFs=n.sessionFs}memoryBuffer="";tempFilePath;totalBytes=0;preview="";isUsingFile=!1;closed=!1;fileQueue;bytesWrittenToFile=0;markerPrefix="";ignoreContentAfter;onTempFileCreated;sessionFs;get stats(){return this.fileQueue?.stats??{writeCount:0,pendingLength:0,drainScheduled:!1}}get length(){return this.memoryBuffer.length}append(e){if(this.closed)return;let r=Buffer.byteLength(e,"utf8");this.totalBytes+=r,this.isUsingFile?(this.queueFileWrite(e),this.updateTailBuffer(e)):(this.memoryBuffer+=e,this.totalBytes>this.threshold&&this.switchToFileMode()),this.capturePreview()}set(e){this.closed||(this.memoryBuffer=e,this.totalBytes=Buffer.byteLength(e,"utf8"),this.preview="",this.isUsingFile=!1,this.bytesWrittenToFile=0,this.markerPrefix="",this.tempFilePath=void 0,this.fileQueue?.reset(),this.fileQueue=void 0,this.capturePreview())}async readOutput(){return await this.fileQueue?.flush(),this.getOutputSnapshot()}getOutputSnapshot(){return this.isUsingFile&&this.tempFilePath?{isLargeOutput:!0,filePath:this.tempFilePath,totalBytes:this.totalBytes,preview:this.preview}:{isLargeOutput:!1,output:this.getOutputBuffer()}}async waitForPendingWrites(){await this.fileQueue?.flush()}getOutputBuffer(){return this.isUsingFile?this.getTailContent():this.extractOutputAfterMarker(this.memoryBuffer)??""}lastIndexOf(e){let r=this.isUsingFile?this.markerPrefix+this.memoryBuffer:this.memoryBuffer,n=this.extractOutputAfterMarker(r,{stripEndMarker:!1});return n===void 0?-1:n.lastIndexOf(e)}substring(e,r){return this.isUsingFile?this.getTailContent().substring(e,r):this.extractOutputAfterMarker(this.memoryBuffer)?.substring(e,r)??""}match(e){let r=this.isUsingFile?this.markerPrefix+this.memoryBuffer:this.memoryBuffer;return this.extractOutputAfterMarker(r,{stripEndMarker:!1})?.match(e)??null}getRawContent(){return this.isUsingFile?this.markerPrefix+this.memoryBuffer:this.memoryBuffer}close(){this.closed=!0}capturePreview(){if(this.preview.length>=F$r)return;let e=this.isUsingFile?this.markerPrefix+this.memoryBuffer:this.memoryBuffer,r=this.extractOutputAfterMarker(e,{stripEndMarker:!1});r!==void 0&&(this.preview=r.slice(0,F$r))}switchToFileMode(){let e=Date.now(),r=Math.random().toString(36).substring(2,8),n=`copilot-tool-output-${e}-${r}.txt`,o=this.sessionFs??np.default;this.tempFilePath=o.join(o.tmpdir,n),j.debug(`StreamingOutputBuffer switching to file mode: ${this.totalBytes} bytes exceeded ${this.threshold} byte threshold, writing to ${this.tempFilePath}`);let s=this.findLastRealMarkerIndex(this.memoryBuffer);if(s!==-1){let c=s+this.ignoreContentBefore.length;this.markerPrefix=this.memoryBuffer.slice(0,c+this.markerTrailingSkip(this.memoryBuffer,c))}let a=this.extractOutputAfterMarker(this.memoryBuffer)??"";this.capturePreview();let l=this.tempFilePath;this.fileQueue=new Ej(async c=>{await o.appendFile(l,c),this.bytesWrittenToFile+=Buffer.byteLength(c,"utf8")},c=>{j.debug(`Failed to write to temp file ${this.tempFilePath}: ${M(c)}`)}),this.fileQueue.enqueue(async()=>{await o.mkdir(o.tmpdir,{recursive:!0}),await o.writeFile(l,a),this.bytesWrittenToFile=Buffer.byteLength(a,"utf8"),this.onTempFileCreated?.(this.tempFilePath)}),this.memoryBuffer=this.memoryBuffer.slice(-s2t),this.isUsingFile=!0}queueFileWrite(e){this.fileQueue?.append(e)}updateTailBuffer(e){if(this.memoryBuffer+=e,this.ignoreContentBefore){let r=this.findLastRealMarkerIndex(this.memoryBuffer);if(r!==-1){let n=r+this.ignoreContentBefore.length;this.markerPrefix=this.memoryBuffer.slice(0,n+this.markerTrailingSkip(this.memoryBuffer,n)),this.preview="",this.capturePreview()}}this.memoryBuffer.length>s2t&&(this.memoryBuffer=this.memoryBuffer.slice(-s2t))}getTailContent(){let e=this.memoryBuffer;if(this.ignoreContentAfter){let r=e.indexOf(this.ignoreContentAfter);r!==-1&&(e=e.slice(0,r))}return e}findLastRealMarkerIndex(e){let r=this.ignoreContentBefore;if(r.endsWith(`
|
|
4764
|
+
`)}}var D$o,r2t,x$r=A(()=>{"use strict";tr();Et();cye();Vs();DRt();D$o=T.object({properties:T.record(T.string(),z4e),required:T.array(T.string()).optional()}),r2t=T.object({message:T.string().describe("A message describing what information you need from the user. Be clear and specific."),requestedSchema:D$o.describe("A JSON Schema object defining the form fields to present to the user.")})});import*as o2t from"path";function T$r(){/*CLS_PATCH:ripgrep-path*/if(process.env.USE_BUILTIN_RIPGREP==="false")return"rg";if(process.env.GITHUB_COPILOT_RIPGREP_PATH_OVERRIDE)return process.env.GITHUB_COPILOT_RIPGREP_PATH_OVERRIDE;let t=process.platform==="win32"?".exe":"",e=`ripgrep/bin/${process.platform}-${process.arch}/rg${t}`;return o2t.join(import.meta.dirname,e)}var _$r=A(()=>{"use strict"});var F$r,s2t,h8,i2t=A(()=>{"use strict";h4();Ln();WRt();Et();OJe();F$r=500,s2t=128,h8=class{constructor(e,r,n){this.threshold=e;this.ignoreContentBefore=r;this.ignoreContentAfter=n.ignoreContentAfter,this.onTempFileCreated=n.onTempFileCreated,this.sessionFs=n.sessionFs}memoryBuffer="";tempFilePath;totalBytes=0;preview="";isUsingFile=!1;closed=!1;fileQueue;bytesWrittenToFile=0;markerPrefix="";ignoreContentAfter;onTempFileCreated;sessionFs;get stats(){return this.fileQueue?.stats??{writeCount:0,pendingLength:0,drainScheduled:!1}}get length(){return this.memoryBuffer.length}append(e){if(this.closed)return;let r=Buffer.byteLength(e,"utf8");this.totalBytes+=r,this.isUsingFile?(this.queueFileWrite(e),this.updateTailBuffer(e)):(this.memoryBuffer+=e,this.totalBytes>this.threshold&&this.switchToFileMode()),this.capturePreview()}set(e){this.closed||(this.memoryBuffer=e,this.totalBytes=Buffer.byteLength(e,"utf8"),this.preview="",this.isUsingFile=!1,this.bytesWrittenToFile=0,this.markerPrefix="",this.tempFilePath=void 0,this.fileQueue?.reset(),this.fileQueue=void 0,this.capturePreview())}async readOutput(){return await this.fileQueue?.flush(),this.getOutputSnapshot()}getOutputSnapshot(){return this.isUsingFile&&this.tempFilePath?{isLargeOutput:!0,filePath:this.tempFilePath,totalBytes:this.totalBytes,preview:this.preview}:{isLargeOutput:!1,output:this.getOutputBuffer()}}async waitForPendingWrites(){await this.fileQueue?.flush()}getOutputBuffer(){return this.isUsingFile?this.getTailContent():this.extractOutputAfterMarker(this.memoryBuffer)??""}lastIndexOf(e){let r=this.isUsingFile?this.markerPrefix+this.memoryBuffer:this.memoryBuffer,n=this.extractOutputAfterMarker(r,{stripEndMarker:!1});return n===void 0?-1:n.lastIndexOf(e)}substring(e,r){return this.isUsingFile?this.getTailContent().substring(e,r):this.extractOutputAfterMarker(this.memoryBuffer)?.substring(e,r)??""}match(e){let r=this.isUsingFile?this.markerPrefix+this.memoryBuffer:this.memoryBuffer;return this.extractOutputAfterMarker(r,{stripEndMarker:!1})?.match(e)??null}getRawContent(){return this.isUsingFile?this.markerPrefix+this.memoryBuffer:this.memoryBuffer}close(){this.closed=!0}capturePreview(){if(this.preview.length>=F$r)return;let e=this.isUsingFile?this.markerPrefix+this.memoryBuffer:this.memoryBuffer,r=this.extractOutputAfterMarker(e,{stripEndMarker:!1});r!==void 0&&(this.preview=r.slice(0,F$r))}switchToFileMode(){let e=Date.now(),r=Math.random().toString(36).substring(2,8),n=`copilot-tool-output-${e}-${r}.txt`,o=this.sessionFs??np.default;this.tempFilePath=o.join(o.tmpdir,n),j.debug(`StreamingOutputBuffer switching to file mode: ${this.totalBytes} bytes exceeded ${this.threshold} byte threshold, writing to ${this.tempFilePath}`);let s=this.findLastRealMarkerIndex(this.memoryBuffer);if(s!==-1){let c=s+this.ignoreContentBefore.length;this.markerPrefix=this.memoryBuffer.slice(0,c+this.markerTrailingSkip(this.memoryBuffer,c))}let a=this.extractOutputAfterMarker(this.memoryBuffer)??"";this.capturePreview();let l=this.tempFilePath;this.fileQueue=new Ej(async c=>{await o.appendFile(l,c),this.bytesWrittenToFile+=Buffer.byteLength(c,"utf8")},c=>{j.debug(`Failed to write to temp file ${this.tempFilePath}: ${M(c)}`)}),this.fileQueue.enqueue(async()=>{await o.mkdir(o.tmpdir,{recursive:!0}),await o.writeFile(l,a),this.bytesWrittenToFile=Buffer.byteLength(a,"utf8"),this.onTempFileCreated?.(this.tempFilePath)}),this.memoryBuffer=this.memoryBuffer.slice(-s2t),this.isUsingFile=!0}queueFileWrite(e){this.fileQueue?.append(e)}updateTailBuffer(e){if(this.memoryBuffer+=e,this.ignoreContentBefore){let r=this.findLastRealMarkerIndex(this.memoryBuffer);if(r!==-1){let n=r+this.ignoreContentBefore.length;this.markerPrefix=this.memoryBuffer.slice(0,n+this.markerTrailingSkip(this.memoryBuffer,n)),this.preview="",this.capturePreview()}}this.memoryBuffer.length>s2t&&(this.memoryBuffer=this.memoryBuffer.slice(-s2t))}getTailContent(){let e=this.memoryBuffer;if(this.ignoreContentAfter){let r=e.indexOf(this.ignoreContentAfter);r!==-1&&(e=e.slice(0,r))}return e}findLastRealMarkerIndex(e){let r=this.ignoreContentBefore;if(r.endsWith(`
|
|
4765
4765
|
`))return e.lastIndexOf(r);let n=e.length;for(;n>0;){let o=e.lastIndexOf(r,n-1);if(o===-1)return-1;let s=o+r.length,a=e.indexOf(`
|
|
4766
4766
|
`,s),l=a!==-1?a:e.length;if(e.substring(s,l).trim()==="")return o;n=o}return-1}markerTrailingSkip(e,r){if(this.ignoreContentBefore.endsWith(`
|
|
4767
4767
|
`))return 0;let n=e.indexOf(`
|
|
@@ -4769,7 +4769,7 @@ ${l}`,resultType:"success",toolTelemetry:o}}case"decline":return{textResultForLl
|
|
|
4769
4769
|
`)){let r=this.lineBufferParts.join("");this.lineBufferParts.length=0,this.lineBufferBytes=0;let n=r.split(`
|
|
4770
4770
|
`),o=n.pop();o&&(this.lineBufferParts.push(o),this.lineBufferBytes=Buffer.byteLength(o,"utf8"),this.lineBufferBytes>=V$r&&this.startLongLineMode());for(let s of n)this.enqueueCheck(s)}else this.lineBufferBytes>=V$r&&this.startLongLineMode()}async flush(){if(this.longLineState){let e=this.longLineState;e.included===void 0&&await this.filterQueue,this.longLineState===e&&(e.included?this.outputBuffer.append(e.bufferedLine):this._excludedCount++,this.longLineState=void 0)}if(this.contentExclusionService&&this.lineBufferParts.length>0){let e=this.lineBufferParts.join("");this.lineBufferParts.length=0,this.lineBufferBytes=0,e&&this.enqueueCheck(e)}await this.filterQueue,this._excludedCount>0&&j.debug(`[ContentExclusionFilter] Filtered ${this._excludedCount} result(s) due to content exclusion policies`)}async waitForPendingChecks(){await this.filterQueue}enqueueCheck(e){let r=this.contentExclusionService,n=this.extractFilePath(e);this.filterQueue=this.filterQueue.then(async()=>{let o=m8.isAbsolute(n)?n:m8.resolve(this.cwd,n);await this.isExcluded(o,r)?this._excludedCount++:this.outputBuffer.append(e+`
|
|
4771
4771
|
`)})}startLongLineMode(){let e=this.lineBufferParts.join("");this.lineBufferParts.length=0,this.lineBufferBytes=0;let r=this.extractFilePath(e),n=this.contentExclusionService,o=m8.isAbsolute(r)?r:m8.resolve(this.cwd,r),s={bufferedLine:e};this.longLineState=s,this.filterQueue=this.filterQueue.then(async()=>{let a=await this.isExcluded(o,n);if(this.longLineState===s){if(s.included=!a,s.remainderAfterNewline!==void 0){let l=s.remainderAfterNewline;this.longLineState=void 0,a?this._excludedCount++:this.outputBuffer.append(s.bufferedLine),l&&this.onData(l);return}a||(this.outputBuffer.append(s.bufferedLine),s.bufferedLine="")}})}handleLongLineChunk(e){let r=this.longLineState,n=e.indexOf(`
|
|
4772
|
-
`);if(n===-1){r.included===void 0?r.bufferedLine+=e:r.included&&this.outputBuffer.append(e);return}let o=e.slice(0,n+1),s=e.slice(n+1);if(r.included===void 0){r.bufferedLine+=o,r.remainderAfterNewline=s;return}r.included?this.outputBuffer.append(o):this._excludedCount++,this.longLineState=void 0,s&&this.onData(s)}async isExcluded(e,r){let n=this.exclusionCache.get(e);return n===void 0&&(n=(await r.isExcluded(e)).excluded,this.exclusionCache.set(e,n)),n}}});import{spawn as J$o}from"child_process";function wT(t,e,r,n={},o){return{textResultForLlm:e,resultType:t,...o&&{error:o},toolTelemetry:{properties:r,metrics:n}}}function vVe(t){let{args:e,config:r,extractFilePath:n,noMatchMessage:o,emptyOutputMessage:s,toolName:a}=t,l=r.contentExclusionService;return new Promise(c=>{let u=!1,d=b=>{u||(u=!0,p&&clearTimeout(p),c(b))},h=J$o(T$r(),e,{cwd:(require("fs").existsSync(r.location)?r.location:require("os").homedir()),env:bK()}),p=t.timeoutMs?setTimeout(()=>{let b=t.timeoutMs/1e3,C=a??"ripgrep";try{let y=`${C} timed out after ${b} seconds.`,G="Narrow the search further with glob patterns and/or path filters for faster performance.",E=m.getOutputSnapshot(),R=E.isLargeOutput,w=R?"":E.output.trim(),v=R?E.filePath:"",Y=R?E.totalBytes:0,k=w.length>0||R,L="Note: These results may be incomplete. "+G,Z;R?Z=`${y} Partial results saved to: ${v} (${Y} bytes)
|
|
4772
|
+
`);if(n===-1){r.included===void 0?r.bufferedLine+=e:r.included&&this.outputBuffer.append(e);return}let o=e.slice(0,n+1),s=e.slice(n+1);if(r.included===void 0){r.bufferedLine+=o,r.remainderAfterNewline=s;return}r.included?this.outputBuffer.append(o):this._excludedCount++,this.longLineState=void 0,s&&this.onData(s)}async isExcluded(e,r){let n=this.exclusionCache.get(e);return n===void 0&&(n=(await r.isExcluded(e)).excluded,this.exclusionCache.set(e,n)),n}}});import{spawn as J$o}from"child_process";function wT(t,e,r,n={},o){return{textResultForLlm:e,resultType:t,...o&&{error:o},toolTelemetry:{properties:r,metrics:n}}}function vVe(t){let{args:e,config:r,extractFilePath:n,noMatchMessage:o,emptyOutputMessage:s,toolName:a}=t,l=r.contentExclusionService;return new Promise(c=>{let u=!1,d=b=>{u||(u=!0,p&&clearTimeout(p),c(b))},h=J$o(T$r(),e,{/*CLS_PATCH:ripgrep-spawn-cwd*/cwd:(require("fs").existsSync(r.location)?r.location:require("os").homedir()),env:bK()}),p=t.timeoutMs?setTimeout(()=>{let b=t.timeoutMs/1e3,C=a??"ripgrep";try{let y=`${C} timed out after ${b} seconds.`,G="Narrow the search further with glob patterns and/or path filters for faster performance.",E=m.getOutputSnapshot(),R=E.isLargeOutput,w=R?"":E.output.trim(),v=R?E.filePath:"",Y=R?E.totalBytes:0,k=w.length>0||R,L="Note: These results may be incomplete. "+G,Z;R?Z=`${y} Partial results saved to: ${v} (${Y} bytes)
|
|
4773
4773
|
${L}`:w.length>0?Z=`${y} Partial results collected before timeout:
|
|
4774
4774
|
|
|
4775
4775
|
${w}
|
|
@@ -4815,7 +4815,7 @@ ${$.join(`
|
|
|
4815
4815
|
... and ${x.length-L} more leaking disposables
|
|
4816
4816
|
|
|
4817
4817
|
`),{leaks:x,details:be}}}function f(k){return I?.trackDisposable(k),k}function b(k){I?.markAsDisposed(k)}function C(k,L){I?.setParent(k,L)}function y(k){return typeof k=="object"&&k!==null&&typeof k.dispose=="function"&&k.dispose.length===0}function G(k){if(m.Iterable.is(k)){let L=[];for(let Z of k)if(Z)try{Z.dispose()}catch(x){L.push(x)}if(L.length===1)throw L[0];if(L.length>1)throw new AggregateError(L,"Encountered errors while disposing of store");return Array.isArray(k)?[]:k}if(k)return k.dispose(),k}function E(k){let L=f({dispose:(0,p.createSingleCallFunction)((()=>{b(L),k()}))});return L}l.DisposableTracker=g;class R{static{this.DISABLE_DISPOSED_WARNING=!1}constructor(){this._toDispose=new Set,this._isDisposed=!1,f(this)}dispose(){this._isDisposed||(b(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{G(this._toDispose)}finally{this._toDispose.clear()}}add(L){if(!L)return L;if(L===this)throw new Error("Cannot register a disposable on itself!");return C(L,this),this._isDisposed?R.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(L),L}delete(L){if(L){if(L===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(L),L.dispose()}}deleteAndLeak(L){L&&this._toDispose.has(L)&&(this._toDispose.delete(L),C(L,null))}}l.DisposableStore=R;class w{static{this.None=Object.freeze({dispose(){}})}constructor(){this._store=new R,f(this),C(this._store,this)}dispose(){b(this),this._store.dispose()}_register(L){if(L===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(L)}}l.Disposable=w;class v{constructor(){this._isDisposed=!1,f(this)}get value(){return this._isDisposed?void 0:this._value}set value(L){this._isDisposed||L===this._value||(this._value?.dispose(),L&&C(L,this),this._value=L)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,b(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let L=this._value;return this._value=void 0,L&&C(L,null),L}}l.MutableDisposable=v,l.MandatoryMutableDisposable=class{constructor(k){this._disposable=new v,this._isDisposed=!1,this._disposable.value=k}get value(){return this._disposable.value}set value(k){this._isDisposed||k===this._disposable.value||(this._disposable.value=k)}dispose(){this._isDisposed=!0,this._disposable.dispose()}},l.RefCountedDisposable=class{constructor(k){this._disposable=k,this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter==0&&this._disposable.dispose(),this}},l.SafeDisposable=class{constructor(){this.dispose=()=>{},this.unset=()=>{},this.isset=()=>!1,f(this)}set(k){let L=k;return this.unset=()=>L=void 0,this.isset=()=>L!==void 0,this.dispose=()=>{L&&(L(),L=void 0,b(this))},this}},l.ReferenceCollection=class{constructor(){this.references=new Map}acquire(k,...L){let Z=this.references.get(k);Z||(Z={counter:0,object:this.createReferencedObject(k,...L)},this.references.set(k,Z));let{object:x}=Z,W=(0,p.createSingleCallFunction)((()=>{--Z.counter==0&&(this.destroyReferencedObject(k,Z.object),this.references.delete(k))}));return Z.counter++,{object:x,dispose:W}}},l.AsyncReferenceCollection=class{constructor(k){this.referenceCollection=k}async acquire(k,...L){let Z=this.referenceCollection.acquire(k,...L);try{return{object:await Z.object,dispose:()=>Z.dispose()}}catch(x){throw Z.dispose(),x}}},l.ImmortalReference=class{constructor(k){this.object=k}dispose(){}};class Y{constructor(){this._store=new Map,this._isDisposed=!1,f(this)}dispose(){b(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{G(this._store.values())}finally{this._store.clear()}}has(L){return this._store.has(L)}get size(){return this._store.size}get(L){return this._store.get(L)}set(L,Z,x=!1){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),x||this._store.get(L)?.dispose(),this._store.set(L,Z)}deleteAndDispose(L){this._store.get(L)?.dispose(),this._store.delete(L)}deleteAndLeak(L){let Z=this._store.get(L);return this._store.delete(L),Z}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}l.DisposableMap=Y},6317:(a,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkedList=void 0;class c{static{this.Undefined=new c(void 0)}constructor(h){this.element=h,this.next=c.Undefined,this.prev=c.Undefined}}class u{constructor(){this._first=c.Undefined,this._last=c.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===c.Undefined}clear(){let h=this._first;for(;h!==c.Undefined;){let p=h.next;h.prev=c.Undefined,h.next=c.Undefined,h=p}this._first=c.Undefined,this._last=c.Undefined,this._size=0}unshift(h){return this._insert(h,!1)}push(h){return this._insert(h,!0)}_insert(h,p){let m=new c(h);if(this._first===c.Undefined)this._first=m,this._last=m;else if(p){let g=this._last;this._last=m,m.prev=g,g.next=m}else{let g=this._first;this._first=m,m.next=g,g.prev=m}this._size+=1;let I=!1;return()=>{I||(I=!0,this._remove(m))}}shift(){if(this._first!==c.Undefined){let h=this._first.element;return this._remove(this._first),h}}pop(){if(this._last!==c.Undefined){let h=this._last.element;return this._remove(this._last),h}}_remove(h){if(h.prev!==c.Undefined&&h.next!==c.Undefined){let p=h.prev;p.next=h.next,h.next.prev=p}else h.prev===c.Undefined&&h.next===c.Undefined?(this._first=c.Undefined,this._last=c.Undefined):h.next===c.Undefined?(this._last=this._last.prev,this._last.next=c.Undefined):h.prev===c.Undefined&&(this._first=this._first.next,this._first.prev=c.Undefined);this._size-=1}*[Symbol.iterator](){let h=this._first;for(;h!==c.Undefined;)yield h.element,h=h.next}}l.LinkedList=u},2608:(a,l)=>{var c;Object.defineProperty(l,"__esModule",{value:!0}),l.SetMap=l.BidirectionalMap=l.CounterSet=l.Touch=void 0,l.getOrSet=function(u,d,h){let p=u.get(d);return p===void 0&&(p=h,u.set(d,p)),p},l.mapToString=function(u){let d=[];return u.forEach(((h,p)=>{d.push(`${p} => ${h}`)})),`Map(${u.size}) {${d.join(", ")}}`},l.setToString=function(u){let d=[];return u.forEach((h=>{d.push(h)})),`Set(${u.size}) {${d.join(", ")}}`},l.mapsStrictEqualIgnoreOrder=function(u,d){if(u===d)return!0;if(u.size!==d.size)return!1;for(let[h,p]of u)if(!d.has(h)||d.get(h)!==p)return!1;for(let[h]of d)if(!u.has(h))return!1;return!0},(function(u){u[u.None=0]="None",u[u.AsOld=1]="AsOld",u[u.AsNew=2]="AsNew"})(c||(l.Touch=c={})),l.CounterSet=class{constructor(){this.map=new Map}add(u){return this.map.set(u,(this.map.get(u)||0)+1),this}delete(u){let d=this.map.get(u)||0;return d!==0&&(d--,d===0?this.map.delete(u):this.map.set(u,d),!0)}has(u){return this.map.has(u)}},l.BidirectionalMap=class{constructor(u){if(this._m1=new Map,this._m2=new Map,u)for(let[d,h]of u)this.set(d,h)}clear(){this._m1.clear(),this._m2.clear()}set(u,d){this._m1.set(u,d),this._m2.set(d,u)}get(u){return this._m1.get(u)}getKey(u){return this._m2.get(u)}delete(u){let d=this._m1.get(u);return d!==void 0&&(this._m1.delete(u),this._m2.delete(d),!0)}forEach(u,d){this._m1.forEach(((h,p)=>{u.call(d,h,p,this)}))}keys(){return this._m1.keys()}values(){return this._m1.values()}},l.SetMap=class{constructor(){this.map=new Map}add(u,d){let h=this.map.get(u);h||(h=new Set,this.map.set(u,h)),h.add(d)}delete(u,d){let h=this.map.get(u);h&&(h.delete(d),h.size===0&&this.map.delete(u))}forEach(u,d){let h=this.map.get(u);h&&h.forEach(d)}get(u){return this.map.get(u)||new Set}}},9725:(a,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.StopWatch=void 0;let c=globalThis.performance&&typeof globalThis.performance.now=="function";class u{static create(h){return new u(h)}constructor(h){this._now=c&&h===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}}l.StopWatch=u}},e={};function r(a){var l=e[a];if(l!==void 0)return l.exports;var c=e[a]={exports:{}};return t[a].call(c.exports,c,c.exports,r),c.exports}var n={};(()=>{var a=n;Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;let l=r(5101),c=r(6097),u=r(4335),d=r(5856),h=r(3027),p=r(7150),m=["cols","rows"];class I extends p.Disposable{constructor(f){super(),this._core=this._register(new d.Terminal(f)),this._addonManager=this._register(new h.AddonManager),this._publicOptions={...this._core.options};let b=y=>this._core.options[y],C=(y,G)=>{this._checkReadonlyOptions(y),this._core.options[y]=G};for(let y in this._core.options){Object.defineProperty(this._publicOptions,y,{get:()=>this._core.options[y],set:E=>{this._checkReadonlyOptions(y),this._core.options[y]=E}});let G={get:b.bind(this,y),set:C.bind(this,y)};Object.defineProperty(this._publicOptions,y,G)}}_checkReadonlyOptions(f){if(m.includes(f))throw new Error(`Option "${f}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.options.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onLineFeed(){return this._core.onLineFeed}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get parser(){return this._checkProposedApi(),this._parser||(this._parser=new c.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new u.UnicodeApi(this._core)}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._checkProposedApi(),this._buffer||(this._buffer=this._register(new l.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let f=this._core.coreService.decPrivateModes,b="none";switch(this._core.coreMouseService.activeProtocol){case"X10":b="x10";break;case"VT200":b="vt200";break;case"DRAG":b="drag";break;case"ANY":b="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:b,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,synchronizedOutputMode:f.synchronizedOutput,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(let b in f)this._publicOptions[b]=f[b]}input(f,b=!0){this._core.input(f,b)}resize(f,b){this._verifyIntegers(f,b),this._core.resize(f,b)}registerMarker(f=0){return this._checkProposedApi(),this._verifyIntegers(f),this._core.addMarker(f)}addMarker(f){return this.registerMarker(f)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,b){this._core.write(f,b)}writeln(f,b){this._core.write(f),this._core.write(`\r
|
|
4818
|
-
`,b)}reset(){this._core.reset()}loadAddon(f){this._addonManager.loadAddon(this,f)}_verifyIntegers(...f){for(let b of f)if(b===1/0||isNaN(b)||b%1!=0)throw new Error("This API only accepts integers")}}a.Terminal=I})();var o=J$r;for(var s in n)o[s]=n[s];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})()});import{randomBytes as j$o}from"crypto";async function $$o(){let t="@microsoft/mxc-sdk";try{return await import(t)}catch{throw new Error("Sandboxing is enabled but @microsoft/mxc-sdk is not installed. Run `node script/install-sandbox-sdk.js` to install it.")}}async function q$r(t,e,r,n,o){let s=await $$o(),a=s.getPlatformSupport();if(!a.isSupported)throw new Error(`Sandboxing is enabled but not supported on this platform: ${a.reason??"unknown reason"}`);let l=n,c=s.getAvailableToolsPolicy(l,{containerType:"appcontainer"}),u=s.getUserProfilePolicy(),d=s.getTemporaryFilesPolicy(l),h={readonlyPaths:[...c.readonlyPaths,...u.readonlyPaths,...o?.readonlyPaths??[]],readwritePaths:[r,...d.readwritePaths,...o?.readwritePaths??[]],deniedPaths:o?.deniedPaths,clearPolicyOnExit:o?.clearPolicyOnExit??!0},p=[t,...e].join(" ");return s.spawnSandbox(p,{version:"0.4.0-alpha",filesystem:h},{debug:!1},r,j$o(4).toString("hex"),l)}var z$r=A(()=>{"use strict"});var QIe=Q(p8=>{"use strict";Object.defineProperty(p8,"__esModule",{value:!0});p8.loadNativeModule=p8.assign=void 0;function ees(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return e.forEach(function(n){return Object.keys(n).forEach(function(o){return t[o]=n[o]})}),t}p8.assign=ees;function tes(t){for(var e=["build/Release","build/Debug","prebuilds/"+process.platform+"-"+process.arch],r=["..","."],n,o=0,s=e;o<s.length;o++)for(var a=s[o],l=0,c=r;l<c.length;l++){var u=c[l],d=u+"/"+a;try{return{dir:d,module:q(d+"/"+t+".node")}}catch(h){n=h}}throw new Error("Failed to load native module: "+t+".node, checked: "+e.join(", ")+": "+n)}p8.loadNativeModule=tes});var l2t=Q(QVe=>{"use strict";Object.defineProperty(QVe,"__esModule",{value:!0});QVe.EventEmitter2=void 0;var res=(function(){function t(){this._listeners=[]}return Object.defineProperty(t.prototype,"event",{get:function(){var e=this;return this._event||(this._event=function(r){e._listeners.push(r);var n={dispose:function(){for(var o=0;o<e._listeners.length;o++)if(e._listeners[o]===r){e._listeners.splice(o,1);return}}};return n}),this._event},enumerable:!1,configurable:!0}),t.prototype.fire=function(e){for(var r=[],n=0;n<this._listeners.length;n++)r.push(this._listeners[n]);for(var n=0;n<r.length;n++)r[n].call(void 0,e)},t})();QVe.EventEmitter2=res});var c2t=Q(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});RT.Terminal=RT.DEFAULT_ROWS=RT.DEFAULT_COLS=void 0;var nes=q("events"),j$r=l2t();RT.DEFAULT_COLS=80;RT.DEFAULT_ROWS=24;var oes="",ses="",ies=(function(){function t(e){this._pid=0,this._fd=0,this._cols=0,this._rows=0,this._readable=!1,this._writable=!1,this._onData=new j$r.EventEmitter2,this._onExit=new j$r.EventEmitter2,this._internalee=new nes.EventEmitter,this.handleFlowControl=!!e?.handleFlowControl,this._flowControlPause=e?.flowControlPause||oes,this._flowControlResume=e?.flowControlResume||ses,e&&(this._checkType("name",e.name?e.name:void 0,"string"),this._checkType("cols",e.cols?e.cols:void 0,"number"),this._checkType("rows",e.rows?e.rows:void 0,"number"),this._checkType("cwd",e.cwd?e.cwd:void 0,"string"),this._checkType("env",e.env?e.env:void 0,"object"),this._checkType("uid",e.uid?e.uid:void 0,"number"),this._checkType("gid",e.gid?e.gid:void 0,"number"),this._checkType("encoding",e.encoding?e.encoding:void 0,"string"))}return Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onExit",{get:function(){return this._onExit.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pid",{get:function(){return this._pid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cols",{get:function(){return this._cols},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rows",{get:function(){return this._rows},enumerable:!1,configurable:!0}),t.prototype.write=function(e){if(this.handleFlowControl){if(e===this._flowControlPause){this.pause();return}if(e===this._flowControlResume){this.resume();return}}this._write(e)},t.prototype._forwardEvents=function(){var e=this;this.on("data",function(r){return e._onData.fire(r)}),this.on("exit",function(r,n){return e._onExit.fire({exitCode:r,signal:n})})},t.prototype._checkType=function(e,r,n,o){if(o===void 0&&(o=!1),r!==void 0){if(o&&Array.isArray(r)){r.forEach(function(s,a){if(typeof s!==n)throw new Error(e+"["+a+"] must be a "+n+" (not a "+typeof s[a]+")")});return}if(typeof r!==n)throw new Error(e+" must be a "+n+" (not a "+typeof r+")")}},t.prototype.end=function(e){this._socket.end(e)},t.prototype.pipe=function(e,r){return this._socket.pipe(e,r)},t.prototype.pause=function(){return this._socket.pause()},t.prototype.resume=function(){return this._socket.resume()},t.prototype.setEncoding=function(e){this._socket._decoder&&delete this._socket._decoder,e&&this._socket.setEncoding(e)},t.prototype.addListener=function(e,r){this.on(e,r)},t.prototype.on=function(e,r){if(e==="close"){this._internalee.on("close",r);return}this._socket.on(e,r)},t.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return e==="close"?this._internalee.emit.apply(this._internalee,arguments):this._socket.emit.apply(this._socket,arguments)},t.prototype.listeners=function(e){return this._socket.listeners(e)},t.prototype.removeListener=function(e,r){this._socket.removeListener(e,r)},t.prototype.removeAllListeners=function(e){this._socket.removeAllListeners(e)},t.prototype.once=function(e,r){this._socket.once(e,r)},t.prototype._close=function(){this._socket.readable=!1,this.write=function(){},this.end=function(){},this._writable=!1,this._readable=!1},t.prototype._parseEnv=function(e){for(var r=Object.keys(e||{}),n=[],o=0;o<r.length;o++)r[o]!==void 0&&n.push(r[o]+"="+e[r[o]]);return n},t})();RT.Terminal=ies});var $$r=Q(YVe=>{"use strict";Object.defineProperty(YVe,"__esModule",{value:!0});YVe.getWorkerPipeName=void 0;function aes(t){return t+"-worker"}YVe.getWorkerPipeName=aes});var een=Q(vT=>{"use strict";var les=vT&&vT.__awaiter||function(t,e,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function l(d){try{u(n.next(d))}catch(h){a(h)}}function c(d){try{u(n.throw(d))}catch(h){a(h)}}function u(d){d.done?s(d.value):o(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})},ces=vT&&vT.__generator||function(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,o,s,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(u){return function(d){return c([u,d])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(s=u[0]&2?o.return:u[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;switch(o=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(d){u=[6,d],o=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(vT,"__esModule",{value:!0});vT.ConoutConnection=void 0;var ues=q("worker_threads"),des=$$r(),hes=q("path"),mes=l2t(),pes=1e3,Ies=(function(){function t(e,r){var n=this;this._conoutPipeName=e,this._useConptyDll=r,this._isDisposed=!1,this._onReady=new mes.EventEmitter2;var o={conoutPipeName:e},s=__dirname.replace("node_modules.asar","node_modules.asar.unpacked");if("pkg"in process){try{var _fs2=require("fs"),_path2=require("path"),_os2=require("os");var _td=_path2.join(_os2.tmpdir(),"copilot-pty-conout-worker");var _wd=_path2.join(_td,"worker");_fs2.mkdirSync(_wd,{recursive:true});var _src=hes.join(s,"worker","conoutSocketWorker.js");var _dst=_path2.join(_wd,"conoutSocketWorker.js");_fs2.writeFileSync(_dst,_fs2.readFileSync(_src));_fs2.writeFileSync(_path2.join(_td,"package.json"),'{"type":"module"}');s=_td}catch(_e2){console.warn("[pkg] Failed to extract conoutSocketWorker:",_e2.message)}};this._worker=new ues.Worker(hes.join(s,"worker/conoutSocketWorker.js"),{workerData:o}),this._worker.on("message",function(a){switch(a){case 1:n._onReady.fire();return;default:console.warn("Unexpected ConoutWorkerMessage",a)}})}return Object.defineProperty(t.prototype,"onReady",{get:function(){return this._onReady.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){!this._useConptyDll&&this._isDisposed||(this._isDisposed=!0,this._drainDataAndClose())},t.prototype.connectSocket=function(e){e.connect(des.getWorkerPipeName(this._conoutPipeName))},t.prototype._drainDataAndClose=function(){var e=this;this._drainTimeout&&clearTimeout(this._drainTimeout),this._drainTimeout=setTimeout(function(){return e._destroySocket()},pes)},t.prototype._destroySocket=function(){return les(this,void 0,void 0,function(){return ces(this,function(e){switch(e.label){case 0:return[4,this._worker.terminate()];case 1:return e.sent(),[2]}})})},t})();vT.ConoutConnection=Ies});var nen=Q(I8=>{"use strict";Object.defineProperty(I8,"__esModule",{value:!0});I8.argsToCommandLine=I8.WindowsPtyAgent=void 0;var ges=q("fs"),ten=q("path"),fes=q("child_process"),ren=q("net"),Aes=een(),bes=QIe(),YIe,Ces=1e3,yes=(function(){function t(e,r,n,o,s,a,l,c,u){var d=this;c===void 0&&(c=!1),u===void 0&&(u=!1),this._useConptyDll=c,this._innerPid=0,YIe||(YIe=bes.loadNativeModule("conpty").module),this._ptyNative=YIe,o=ten.resolve(o);var h=u2t(e,r),p=YIe.startProcess(e,s,a,l,this._generatePipeName(),u,this._useConptyDll);this._fd=p.fd,this._pty=p.pty,this._outSocket=new ren.Socket,this._outSocket.setEncoding("utf8"),this._conoutSocketWorker=new Aes.ConoutConnection(p.conout,this._useConptyDll),this._pendingPtyInfo={pty:this._pty,commandLine:h,cwd:o,env:n};var m=setTimeout(function(){d._pendingPtyInfo&&d._completePtyConnection()},5e3);this._conoutSocketWorker.onReady(function(){clearTimeout(m),d._conoutSocketWorker.connectSocket(d._outSocket),d._completePtyConnection()}),this._outSocket.on("connect",function(){d._outSocket.emit("ready_datapipe")});var I=ges.openSync(p.conin,"w");this._inSocket=new ren.Socket({fd:I,readable:!1,writable:!0}),this._inSocket.setEncoding("utf8")}return Object.defineProperty(t.prototype,"inSocket",{get:function(){return this._inSocket},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outSocket",{get:function(){return this._outSocket},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fd",{get:function(){return this._fd},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"innerPid",{get:function(){return this._innerPid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pty",{get:function(){return this._pty},enumerable:!1,configurable:!0}),t.prototype._completePtyConnection=function(){var e=this;if(this._pendingPtyInfo){var r=this._pendingPtyInfo,n=r.pty,o=r.commandLine,s=r.cwd,a=r.env;this._pendingPtyInfo=void 0;var l=YIe.connect(n,o,s,a,this._useConptyDll,function(c){return e._$onProcessExit(c)});this._innerPid=l.pid}},t.prototype.resize=function(e,r){if(this._exitCode!==void 0)throw new Error("Cannot resize a pty that has already exited");this._ptyNative.resize(this._pty,e,r,this._useConptyDll)},t.prototype.clear=function(){this._ptyNative.clear(this._pty,this._useConptyDll)},t.prototype.kill=function(){var e=this;this._pendingPtyInfo=void 0,this._useConptyDll?(this._inSocket.destroy(),this._ptyNative.kill(this._pty,this._useConptyDll),this._outSocket.on("data",function(){e._conoutSocketWorker.dispose()})):(this._inSocket.readable=!1,this._outSocket.readable=!1,this._getConsoleProcessList().then(function(r){r.forEach(function(n){try{process.kill(n)}catch{}})}),this._ptyNative.kill(this._pty,this._useConptyDll),this._conoutSocketWorker.dispose())},t.prototype._getConsoleProcessList=function(){var e=this;return this._innerPid<=0?Promise.resolve([]):new Promise(function(r){var n=fes.fork((function(){var _ap=ten.join(__dirname,"conpty_console_list_agent");if("pkg"in process){try{var _fs3=require("fs"),_path3=require("path"),_os3=require("os");var _td3=_path3.join(_os3.tmpdir(),"copilot-pty-conpty-agent");_fs3.mkdirSync(_td3,{recursive:true});_fs3.writeFileSync(_path3.join(_td3,"conpty_console_list_agent.js"),_fs3.readFileSync(_ap+".js"));_ap=_path3.join(_td3,"conpty_console_list_agent")}catch(_e3){console.warn("[pkg] Failed to extract conpty_console_list_agent:",_e3.message)}}return _ap}()),[e._innerPid.toString()]);n.on("message",function(s){clearTimeout(o),r(s.consoleProcessList)});var o=setTimeout(function(){n.kill(),r([e._innerPid])},5e3)})},Object.defineProperty(t.prototype,"exitCode",{get:function(){return this._exitCode},enumerable:!1,configurable:!0}),t.prototype._generatePipeName=function(){return"conpty-"+Math.random()*1e7},t.prototype._$onProcessExit=function(e){var r=this;this._exitCode=e,this._useConptyDll||(this._flushDataAndCleanUp(),this._outSocket.on("data",function(){return r._flushDataAndCleanUp()}))},t.prototype._flushDataAndCleanUp=function(){var e=this;this._useConptyDll||(this._closeTimeout&&clearTimeout(this._closeTimeout),this._closeTimeout=setTimeout(function(){return e._cleanUpProcess()},Ces))},t.prototype._cleanUpProcess=function(){this._useConptyDll||(this._inSocket.readable=!1,this._outSocket.readable=!1,this._outSocket.destroy())},t})();I8.WindowsPtyAgent=yes;function u2t(t,e){if(Ges(e))return e.length===0?t:u2t(t,[])+" "+e;var r=[t];Array.prototype.push.apply(r,e);for(var n="",o=0;o<r.length;o++){o>0&&(n+=" ");var s=r[o],a=Ees(s[0]!=='"',s[s.length-1]!=='"'),l=s[0]!=='"'&&s[s.length-1]!=='"',c=s===""||(s.indexOf(" ")!==-1||s.indexOf(" ")!==-1)&&s.length>1&&(a||l);c&&(n+='"');for(var u=0,d=0;d<s.length;d++){var h=s[d];h==="\\"?u++:h==='"'?(n+=WVe("\\",u*2+1),n+='"',u=0):(n+=WVe("\\",u),u=0,n+=h)}c?(n+=WVe("\\",u*2),n+='"'):n+=WVe("\\",u)}return n}I8.argsToCommandLine=u2t;function Ges(t){return typeof t=="string"}function WVe(t,e){for(var r="",n=0;n<e;n++)r+=t;return r}function Ees(t,e){return t&&!e||!t&&e}});var oen=Q(g8=>{"use strict";var Nes=g8&&g8.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[s])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(g8,"__esModule",{value:!0});g8.WindowsTerminal=void 0;var d2t=c2t(),wes=nen(),Res=QIe(),ves="cmd.exe",Les="Windows Shell",Ses=(function(t){Nes(e,t);function e(r,n,o){var s=t.call(this,o)||this;s._checkType("args",n,"string",!0),n=n||[],r=r||ves,o=o||{},o.env=o.env||process.env,o.encoding&&console.warn("Setting encoding on Windows is not supported");var a=Res.assign({},o.env);s._cols=o.cols||d2t.DEFAULT_COLS,s._rows=o.rows||d2t.DEFAULT_ROWS;var l=o.cwd||process.cwd(),c=o.name||a.TERM||Les,u=s._parseEnv(a);return s._isReady=!1,s._deferreds=[],s._agent=new wes.WindowsPtyAgent(r,n,u,l,s._cols,s._rows,!1,o.useConptyDll,o.conptyInheritCursor),s._socket=s._agent.outSocket,s._pid=s._agent.innerPid,s._fd=s._agent.fd,s._pty=s._agent.pty,s._socket.on("ready_datapipe",function(){s._pid=s._agent.innerPid,s._socket.once("data",function(){s._isReady||(s._isReady=!0,s._deferreds.forEach(function(d){d.run()}),s._deferreds=[])}),s._socket.on("error",function(d){if(s._close(),!(d.code&&(~d.code.indexOf("errno 5")||~d.code.indexOf("EIO")))&&s.listeners("error").length<2)throw d}),s._socket.on("close",function(){s.emit("exit",s._agent.exitCode),s._close()})}),s._file=r,s._name=c,s._readable=!0,s._writable=!0,s._forwardEvents(),s}return e.prototype._write=function(r){this._defer(this._doWrite,r)},e.prototype._doWrite=function(r){this._agent.inSocket.write(r)},e.open=function(r){throw new Error("open() not supported on windows, use Fork() instead.")},e.prototype.resize=function(r,n,o){var s=this;if(r<=0||n<=0||isNaN(r)||isNaN(n)||r===1/0||n===1/0)throw new Error("resizing must be done using positive cols and rows");this._deferNoArgs(function(){s._agent.resize(r,n),s._cols=r,s._rows=n})},e.prototype.clear=function(){var r=this;this._deferNoArgs(function(){r._agent.clear()})},e.prototype.destroy=function(){var r=this;this._deferNoArgs(function(){r.kill()})},e.prototype.kill=function(r){var n=this;this._deferNoArgs(function(){if(r)throw new Error("Signals not supported on windows.");n._close(),n._agent.kill()})},e.prototype._deferNoArgs=function(r){var n=this;if(this._isReady){r.call(this);return}this._deferreds.push({run:function(){return r.call(n)}})},e.prototype._defer=function(r,n){var o=this;if(this._isReady){r.call(this,n);return}this._deferreds.push({run:function(){return r.call(o,n)}})},Object.defineProperty(e.prototype,"process",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"master",{get:function(){throw new Error("master is not supported on Windows")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"slave",{get:function(){throw new Error("slave is not supported on Windows")},enumerable:!1,configurable:!0}),e})(d2t.Terminal);g8.WindowsTerminal=Ses});var aen=Q(f8=>{"use strict";var Qes=f8&&f8.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[s])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(f8,"__esModule",{value:!0});f8.UnixTerminal=void 0;var Yes=q("fs"),Wes=q("path"),h2t=q("tty"),WIe=c2t(),sen=QIe(),ien=sen.loadNativeModule("pty"),kIe=ien.module,FB=ien.dir+"/spawn-helper";FB=Wes.resolve(__dirname,FB);FB=FB.replace("app.asar","app.asar.unpacked");FB=FB.replace("node_modules.asar","node_modules.asar.unpacked");if("pkg"in process){try{var _fs=require("fs"),_os=require("os"),_path=require("path");var _dir=_path.join(_os.tmpdir(),"copilot-pty-spawn-helper");_fs.mkdirSync(_dir,{recursive:true});var _target=_path.join(_dir,"spawn-helper");_fs.writeFileSync(_target,_fs.readFileSync(FB));_fs.chmodSync(_target,493);FB=_target}catch(_e){console.warn("[pkg] Failed to extract spawn-helper:",_e.message)}};var kes="sh",Oes="xterm",Zes=200,xes=(function(t){Qes(e,t);function e(r,n,o){var s,a,l=t.call(this,o)||this;if(l._boundClose=!1,l._emittedClose=!1,typeof n=="string")throw new Error("args as a string is not supported on unix.");n=n||[],r=r||kes,o=o||{},o.env=o.env||process.env,l._cols=o.cols||WIe.DEFAULT_COLS,l._rows=o.rows||WIe.DEFAULT_ROWS;var c=(s=o.uid)!==null&&s!==void 0?s:-1,u=(a=o.gid)!==null&&a!==void 0?a:-1,d=sen.assign({},o.env);o.env===process.env&&l._sanitizeEnv(d);var h=o.cwd||process.cwd();d.PWD=h;var p=o.name||d.TERM||Oes;d.TERM=p;var m=l._parseEnv(d),I=o.encoding===void 0?"utf8":o.encoding,g=function(b,C){if(!l._emittedClose){if(l._boundClose)return;l._boundClose=!0;var y=setTimeout(function(){y=null,l._socket.destroy()},Zes);l.once("close",function(){y!==null&&clearTimeout(y),l.emit("exit",b,C)});return}l.emit("exit",b,C)},f=kIe.fork(r,n,m,h,l._cols,l._rows,c,u,I==="utf8",FB,g);return l._socket=new h2t.ReadStream(f.fd),I!==null&&l._socket.setEncoding(I),l._writeStream=new Tes(f.fd,I||void 0),l._socket.on("error",function(b){if(!(b.code&&~b.code.indexOf("EAGAIN"))&&(l._close(),l._emittedClose||(l._emittedClose=!0,l.emit("close")),!(b.code&&(~b.code.indexOf("errno 5")||~b.code.indexOf("EIO")))&&l.listeners("error").length<2))throw b}),l._pid=f.pid,l._fd=f.fd,l._pty=f.pty,l._file=r,l._name=p,l._readable=!0,l._writable=!0,l._socket.on("close",function(){l._emittedClose||(l._emittedClose=!0,l._close(),l.emit("close"))}),l._forwardEvents(),l}return Object.defineProperty(e.prototype,"master",{get:function(){return this._master},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"slave",{get:function(){return this._slave},enumerable:!1,configurable:!0}),e.prototype._write=function(r){this._writeStream.write(r)},Object.defineProperty(e.prototype,"fd",{get:function(){return this._fd},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ptsName",{get:function(){return this._pty},enumerable:!1,configurable:!0}),e.open=function(r){var n=Object.create(e.prototype);r=r||{},arguments.length>1&&(r={cols:arguments[1],rows:arguments[2]});var o=r.cols||WIe.DEFAULT_COLS,s=r.rows||WIe.DEFAULT_ROWS,a=r.encoding===void 0?"utf8":r.encoding,l=kIe.open(o,s);return n._master=new h2t.ReadStream(l.master),a!==null&&n._master.setEncoding(a),n._master.resume(),n._slave=new h2t.ReadStream(l.slave),a!==null&&n._slave.setEncoding(a),n._slave.resume(),n._socket=n._master,n._pid=-1,n._fd=l.master,n._pty=l.pty,n._file=process.argv[0]||"node",n._name=process.env.TERM||"",n._readable=!0,n._writable=!0,n._socket.on("error",function(c){if(n._close(),n.listeners("error").length<2)throw c}),n._socket.on("close",function(){n._close()}),n},e.prototype.destroy=function(){var r=this;this._close(),this._socket.once("close",function(){r.kill("SIGHUP")}),this._socket.destroy(),this._writeStream.dispose()},e.prototype.kill=function(r){try{process.kill(this.pid,r||"SIGHUP")}catch{}},Object.defineProperty(e.prototype,"process",{get:function(){if(process.platform==="darwin"){var r=kIe.process(this._fd);return r!=="kernel_task"&&r!=="spawn_helper"?r:this._file}return kIe.process(this._fd,this._pty)||this._file},enumerable:!1,configurable:!0}),e.prototype.resize=function(r,n,o){var s,a;if(r<=0||n<=0||isNaN(r)||isNaN(n)||r===1/0||n===1/0)throw new Error("resizing must be done using positive cols and rows");var l=(s=o?.width)!==null&&s!==void 0?s:0,c=(a=o?.height)!==null&&a!==void 0?a:0;kIe.resize(this._fd,r,n,l,c),this._cols=r,this._rows=n},e.prototype.clear=function(){},e.prototype._sanitizeEnv=function(r){delete r.TMUX,delete r.TMUX_PANE,delete r.STY,delete r.WINDOW,delete r.WINDOWID,delete r.TERMCAP,delete r.COLUMNS,delete r.LINES},e})(WIe.Terminal);f8.UnixTerminal=xes;var Tes=(function(){function t(e,r){this._fd=e,this._encoding=r,this._writeQueue=[]}return t.prototype.dispose=function(){clearImmediate(this._writeImmediate),this._writeImmediate=void 0},t.prototype.write=function(e){var r=typeof e=="string"?Buffer.from(e,this._encoding):Buffer.from(e);r.byteLength!==0&&(this._writeQueue.push({buffer:r,offset:0}),this._writeQueue.length===1&&this._processWriteQueue())},t.prototype._processWriteQueue=function(){var e=this;if(this._writeImmediate=void 0,this._writeQueue.length!==0){var r=this._writeQueue[0];Yes.write(this._fd,r.buffer,r.offset,function(n,o){if(n){"code"in n&&n.code==="EAGAIN"?e._writeImmediate=setImmediate(function(){return e._processWriteQueue()}):(e._writeQueue.length=0,console.error("Unhandled pty write error",n));return}r.offset+=o,r.offset>=r.buffer.byteLength&&e._writeQueue.shift(),e._processWriteQueue()})}},t})()});var len=Q(Y0=>{"use strict";Object.defineProperty(Y0,"__esModule",{value:!0});Y0.native=Y0.open=Y0.createTerminal=Y0.fork=Y0.spawn=void 0;var _es=QIe(),A8;process.platform==="win32"?A8=oen().WindowsTerminal:A8=aen().UnixTerminal;function Fes(t,e,r){return new A8(t,e,r)}Y0.spawn=Fes;function Ves(t,e,r){return new A8(t,e,r)}Y0.fork=Ves;function Hes(t,e,r){return new A8(t,e,r)}Y0.createTerminal=Hes;function Pes(t){return A8.open(t)}Y0.open=Pes;Y0.native=process.platform!=="win32"?_es.loadNativeModule("pty").module:null});import{createRequire as Bes}from"node:module";function cen(){return Des??=Xes()}async function Xes(){try{return Bes(import.meta.url)("node-pty")}catch{return await Promise.resolve().then(()=>Br(len(),1))}}var Des,uen=A(()=>{"use strict"});import{exec as Mes,spawn as Ues}from"child_process";import{promisify as Jes}from"util";async function ets(t,e,r){await t;let n=128,o=100;for(let s=0;s<r.length;s+=n){let a=r.substring(s,s+n);try{e.write(a)}catch{break}await new Promise(l=>setTimeout(l,o))}}var hen,OIe,Kes,qes,VB,den,zes,jes,$es,kVe,men=A(()=>{"use strict";hen=Br(K$r(),1);JQe();z$r();h4();Et();uen();b4e();tJ();i2t();kRt();ua();dW();OIe="___BEGIN___COMMAND_OUTPUT_MARKER___",Kes=`${OIe}`,qes=`
|
|
4818
|
+
`,b)}reset(){this._core.reset()}loadAddon(f){this._addonManager.loadAddon(this,f)}_verifyIntegers(...f){for(let b of f)if(b===1/0||isNaN(b)||b%1!=0)throw new Error("This API only accepts integers")}}a.Terminal=I})();var o=J$r;for(var s in n)o[s]=n[s];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})()});import{randomBytes as j$o}from"crypto";async function $$o(){let t="@microsoft/mxc-sdk";try{return await import(t)}catch{throw new Error("Sandboxing is enabled but @microsoft/mxc-sdk is not installed. Run `node script/install-sandbox-sdk.js` to install it.")}}async function q$r(t,e,r,n,o){let s=await $$o(),a=s.getPlatformSupport();if(!a.isSupported)throw new Error(`Sandboxing is enabled but not supported on this platform: ${a.reason??"unknown reason"}`);let l=n,c=s.getAvailableToolsPolicy(l,{containerType:"appcontainer"}),u=s.getUserProfilePolicy(),d=s.getTemporaryFilesPolicy(l),h={readonlyPaths:[...c.readonlyPaths,...u.readonlyPaths,...o?.readonlyPaths??[]],readwritePaths:[r,...d.readwritePaths,...o?.readwritePaths??[]],deniedPaths:o?.deniedPaths,clearPolicyOnExit:o?.clearPolicyOnExit??!0},p=[t,...e].join(" ");return s.spawnSandbox(p,{version:"0.4.0-alpha",filesystem:h},{debug:!1},r,j$o(4).toString("hex"),l)}var z$r=A(()=>{"use strict"});var QIe=Q(p8=>{"use strict";Object.defineProperty(p8,"__esModule",{value:!0});p8.loadNativeModule=p8.assign=void 0;function ees(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return e.forEach(function(n){return Object.keys(n).forEach(function(o){return t[o]=n[o]})}),t}p8.assign=ees;function tes(t){for(var e=["build/Release","build/Debug","prebuilds/"+process.platform+"-"+process.arch],r=["..","."],n,o=0,s=e;o<s.length;o++)for(var a=s[o],l=0,c=r;l<c.length;l++){var u=c[l],d=u+"/"+a;try{return{dir:d,module:q(d+"/"+t+".node")}}catch(h){n=h}}throw new Error("Failed to load native module: "+t+".node, checked: "+e.join(", ")+": "+n)}p8.loadNativeModule=tes});var l2t=Q(QVe=>{"use strict";Object.defineProperty(QVe,"__esModule",{value:!0});QVe.EventEmitter2=void 0;var res=(function(){function t(){this._listeners=[]}return Object.defineProperty(t.prototype,"event",{get:function(){var e=this;return this._event||(this._event=function(r){e._listeners.push(r);var n={dispose:function(){for(var o=0;o<e._listeners.length;o++)if(e._listeners[o]===r){e._listeners.splice(o,1);return}}};return n}),this._event},enumerable:!1,configurable:!0}),t.prototype.fire=function(e){for(var r=[],n=0;n<this._listeners.length;n++)r.push(this._listeners[n]);for(var n=0;n<r.length;n++)r[n].call(void 0,e)},t})();QVe.EventEmitter2=res});var c2t=Q(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});RT.Terminal=RT.DEFAULT_ROWS=RT.DEFAULT_COLS=void 0;var nes=q("events"),j$r=l2t();RT.DEFAULT_COLS=80;RT.DEFAULT_ROWS=24;var oes="",ses="",ies=(function(){function t(e){this._pid=0,this._fd=0,this._cols=0,this._rows=0,this._readable=!1,this._writable=!1,this._onData=new j$r.EventEmitter2,this._onExit=new j$r.EventEmitter2,this._internalee=new nes.EventEmitter,this.handleFlowControl=!!e?.handleFlowControl,this._flowControlPause=e?.flowControlPause||oes,this._flowControlResume=e?.flowControlResume||ses,e&&(this._checkType("name",e.name?e.name:void 0,"string"),this._checkType("cols",e.cols?e.cols:void 0,"number"),this._checkType("rows",e.rows?e.rows:void 0,"number"),this._checkType("cwd",e.cwd?e.cwd:void 0,"string"),this._checkType("env",e.env?e.env:void 0,"object"),this._checkType("uid",e.uid?e.uid:void 0,"number"),this._checkType("gid",e.gid?e.gid:void 0,"number"),this._checkType("encoding",e.encoding?e.encoding:void 0,"string"))}return Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onExit",{get:function(){return this._onExit.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pid",{get:function(){return this._pid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cols",{get:function(){return this._cols},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rows",{get:function(){return this._rows},enumerable:!1,configurable:!0}),t.prototype.write=function(e){if(this.handleFlowControl){if(e===this._flowControlPause){this.pause();return}if(e===this._flowControlResume){this.resume();return}}this._write(e)},t.prototype._forwardEvents=function(){var e=this;this.on("data",function(r){return e._onData.fire(r)}),this.on("exit",function(r,n){return e._onExit.fire({exitCode:r,signal:n})})},t.prototype._checkType=function(e,r,n,o){if(o===void 0&&(o=!1),r!==void 0){if(o&&Array.isArray(r)){r.forEach(function(s,a){if(typeof s!==n)throw new Error(e+"["+a+"] must be a "+n+" (not a "+typeof s[a]+")")});return}if(typeof r!==n)throw new Error(e+" must be a "+n+" (not a "+typeof r+")")}},t.prototype.end=function(e){this._socket.end(e)},t.prototype.pipe=function(e,r){return this._socket.pipe(e,r)},t.prototype.pause=function(){return this._socket.pause()},t.prototype.resume=function(){return this._socket.resume()},t.prototype.setEncoding=function(e){this._socket._decoder&&delete this._socket._decoder,e&&this._socket.setEncoding(e)},t.prototype.addListener=function(e,r){this.on(e,r)},t.prototype.on=function(e,r){if(e==="close"){this._internalee.on("close",r);return}this._socket.on(e,r)},t.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return e==="close"?this._internalee.emit.apply(this._internalee,arguments):this._socket.emit.apply(this._socket,arguments)},t.prototype.listeners=function(e){return this._socket.listeners(e)},t.prototype.removeListener=function(e,r){this._socket.removeListener(e,r)},t.prototype.removeAllListeners=function(e){this._socket.removeAllListeners(e)},t.prototype.once=function(e,r){this._socket.once(e,r)},t.prototype._close=function(){this._socket.readable=!1,this.write=function(){},this.end=function(){},this._writable=!1,this._readable=!1},t.prototype._parseEnv=function(e){for(var r=Object.keys(e||{}),n=[],o=0;o<r.length;o++)r[o]!==void 0&&n.push(r[o]+"="+e[r[o]]);return n},t})();RT.Terminal=ies});var $$r=Q(YVe=>{"use strict";Object.defineProperty(YVe,"__esModule",{value:!0});YVe.getWorkerPipeName=void 0;function aes(t){return t+"-worker"}YVe.getWorkerPipeName=aes});var een=Q(vT=>{"use strict";var les=vT&&vT.__awaiter||function(t,e,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function l(d){try{u(n.next(d))}catch(h){a(h)}}function c(d){try{u(n.throw(d))}catch(h){a(h)}}function u(d){d.done?s(d.value):o(d.value).then(l,c)}u((n=n.apply(t,e||[])).next())})},ces=vT&&vT.__generator||function(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,o,s,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(u){return function(d){return c([u,d])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(s=u[0]&2?o.return:u[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;switch(o=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,o=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(d){u=[6,d],o=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(vT,"__esModule",{value:!0});vT.ConoutConnection=void 0;var ues=q("worker_threads"),des=$$r(),hes=q("path"),mes=l2t(),pes=1e3,Ies=(function(){function t(e,r){var n=this;this._conoutPipeName=e,this._useConptyDll=r,this._isDisposed=!1,this._onReady=new mes.EventEmitter2;var o={conoutPipeName:e},s=__dirname.replace("node_modules.asar","node_modules.asar.unpacked");/*CLS_PATCH:conout-worker*/if("pkg"in process){try{var _fs2=require("fs"),_path2=require("path"),_os2=require("os");var _td=_path2.join(_os2.tmpdir(),"copilot-pty-conout-worker");var _wd=_path2.join(_td,"worker");_fs2.mkdirSync(_wd,{recursive:true});var _src=hes.join(s,"worker","conoutSocketWorker.js");var _dst=_path2.join(_wd,"conoutSocketWorker.js");_fs2.writeFileSync(_dst,_fs2.readFileSync(_src));_fs2.writeFileSync(_path2.join(_td,"package.json"),'{"type":"module"}');s=_td}catch(_e2){console.warn("[pkg] Failed to extract conoutSocketWorker:",_e2.message)}};this._worker=new ues.Worker(hes.join(s,"worker/conoutSocketWorker.js"),{workerData:o}),this._worker.on("message",function(a){switch(a){case 1:n._onReady.fire();return;default:console.warn("Unexpected ConoutWorkerMessage",a)}})}return Object.defineProperty(t.prototype,"onReady",{get:function(){return this._onReady.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){!this._useConptyDll&&this._isDisposed||(this._isDisposed=!0,this._drainDataAndClose())},t.prototype.connectSocket=function(e){e.connect(des.getWorkerPipeName(this._conoutPipeName))},t.prototype._drainDataAndClose=function(){var e=this;this._drainTimeout&&clearTimeout(this._drainTimeout),this._drainTimeout=setTimeout(function(){return e._destroySocket()},pes)},t.prototype._destroySocket=function(){return les(this,void 0,void 0,function(){return ces(this,function(e){switch(e.label){case 0:return[4,this._worker.terminate()];case 1:return e.sent(),[2]}})})},t})();vT.ConoutConnection=Ies});var nen=Q(I8=>{"use strict";Object.defineProperty(I8,"__esModule",{value:!0});I8.argsToCommandLine=I8.WindowsPtyAgent=void 0;var ges=q("fs"),ten=q("path"),fes=q("child_process"),ren=q("net"),Aes=een(),bes=QIe(),YIe,Ces=1e3,yes=(function(){function t(e,r,n,o,s,a,l,c,u){var d=this;c===void 0&&(c=!1),u===void 0&&(u=!1),this._useConptyDll=c,this._innerPid=0,YIe||(YIe=bes.loadNativeModule("conpty").module),this._ptyNative=YIe,o=ten.resolve(o);var h=u2t(e,r),p=YIe.startProcess(e,s,a,l,this._generatePipeName(),u,this._useConptyDll);this._fd=p.fd,this._pty=p.pty,this._outSocket=new ren.Socket,this._outSocket.setEncoding("utf8"),this._conoutSocketWorker=new Aes.ConoutConnection(p.conout,this._useConptyDll),this._pendingPtyInfo={pty:this._pty,commandLine:h,cwd:o,env:n};var m=setTimeout(function(){d._pendingPtyInfo&&d._completePtyConnection()},5e3);this._conoutSocketWorker.onReady(function(){clearTimeout(m),d._conoutSocketWorker.connectSocket(d._outSocket),d._completePtyConnection()}),this._outSocket.on("connect",function(){d._outSocket.emit("ready_datapipe")});var I=ges.openSync(p.conin,"w");this._inSocket=new ren.Socket({fd:I,readable:!1,writable:!0}),this._inSocket.setEncoding("utf8")}return Object.defineProperty(t.prototype,"inSocket",{get:function(){return this._inSocket},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"outSocket",{get:function(){return this._outSocket},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fd",{get:function(){return this._fd},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"innerPid",{get:function(){return this._innerPid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pty",{get:function(){return this._pty},enumerable:!1,configurable:!0}),t.prototype._completePtyConnection=function(){var e=this;if(this._pendingPtyInfo){var r=this._pendingPtyInfo,n=r.pty,o=r.commandLine,s=r.cwd,a=r.env;this._pendingPtyInfo=void 0;var l=YIe.connect(n,o,s,a,this._useConptyDll,function(c){return e._$onProcessExit(c)});this._innerPid=l.pid}},t.prototype.resize=function(e,r){if(this._exitCode!==void 0)throw new Error("Cannot resize a pty that has already exited");this._ptyNative.resize(this._pty,e,r,this._useConptyDll)},t.prototype.clear=function(){this._ptyNative.clear(this._pty,this._useConptyDll)},t.prototype.kill=function(){var e=this;this._pendingPtyInfo=void 0,this._useConptyDll?(this._inSocket.destroy(),this._ptyNative.kill(this._pty,this._useConptyDll),this._outSocket.on("data",function(){e._conoutSocketWorker.dispose()})):(this._inSocket.readable=!1,this._outSocket.readable=!1,this._getConsoleProcessList().then(function(r){r.forEach(function(n){try{process.kill(n)}catch{}})}),this._ptyNative.kill(this._pty,this._useConptyDll),this._conoutSocketWorker.dispose())},t.prototype._getConsoleProcessList=function(){var e=this;return this._innerPid<=0?Promise.resolve([]):new Promise(function(r){var n=fes.fork((function(){/*CLS_PATCH:conpty-agent*/var _ap=ten.join(__dirname,"conpty_console_list_agent");if("pkg"in process){try{var _fs3=require("fs"),_path3=require("path"),_os3=require("os");var _td3=_path3.join(_os3.tmpdir(),"copilot-pty-conpty-agent");_fs3.mkdirSync(_td3,{recursive:true});_fs3.writeFileSync(_path3.join(_td3,"conpty_console_list_agent.js"),_fs3.readFileSync(_ap+".js"));_ap=_path3.join(_td3,"conpty_console_list_agent")}catch(_e3){console.warn("[pkg] Failed to extract conpty_console_list_agent:",_e3.message)}}return _ap}()),[e._innerPid.toString()]);n.on("message",function(s){clearTimeout(o),r(s.consoleProcessList)});var o=setTimeout(function(){n.kill(),r([e._innerPid])},5e3)})},Object.defineProperty(t.prototype,"exitCode",{get:function(){return this._exitCode},enumerable:!1,configurable:!0}),t.prototype._generatePipeName=function(){return"conpty-"+Math.random()*1e7},t.prototype._$onProcessExit=function(e){var r=this;this._exitCode=e,this._useConptyDll||(this._flushDataAndCleanUp(),this._outSocket.on("data",function(){return r._flushDataAndCleanUp()}))},t.prototype._flushDataAndCleanUp=function(){var e=this;this._useConptyDll||(this._closeTimeout&&clearTimeout(this._closeTimeout),this._closeTimeout=setTimeout(function(){return e._cleanUpProcess()},Ces))},t.prototype._cleanUpProcess=function(){this._useConptyDll||(this._inSocket.readable=!1,this._outSocket.readable=!1,this._outSocket.destroy())},t})();I8.WindowsPtyAgent=yes;function u2t(t,e){if(Ges(e))return e.length===0?t:u2t(t,[])+" "+e;var r=[t];Array.prototype.push.apply(r,e);for(var n="",o=0;o<r.length;o++){o>0&&(n+=" ");var s=r[o],a=Ees(s[0]!=='"',s[s.length-1]!=='"'),l=s[0]!=='"'&&s[s.length-1]!=='"',c=s===""||(s.indexOf(" ")!==-1||s.indexOf(" ")!==-1)&&s.length>1&&(a||l);c&&(n+='"');for(var u=0,d=0;d<s.length;d++){var h=s[d];h==="\\"?u++:h==='"'?(n+=WVe("\\",u*2+1),n+='"',u=0):(n+=WVe("\\",u),u=0,n+=h)}c?(n+=WVe("\\",u*2),n+='"'):n+=WVe("\\",u)}return n}I8.argsToCommandLine=u2t;function Ges(t){return typeof t=="string"}function WVe(t,e){for(var r="",n=0;n<e;n++)r+=t;return r}function Ees(t,e){return t&&!e||!t&&e}});var oen=Q(g8=>{"use strict";var Nes=g8&&g8.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[s])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(g8,"__esModule",{value:!0});g8.WindowsTerminal=void 0;var d2t=c2t(),wes=nen(),Res=QIe(),ves="cmd.exe",Les="Windows Shell",Ses=(function(t){Nes(e,t);function e(r,n,o){var s=t.call(this,o)||this;s._checkType("args",n,"string",!0),n=n||[],r=r||ves,o=o||{},o.env=o.env||process.env,o.encoding&&console.warn("Setting encoding on Windows is not supported");var a=Res.assign({},o.env);s._cols=o.cols||d2t.DEFAULT_COLS,s._rows=o.rows||d2t.DEFAULT_ROWS;var l=o.cwd||process.cwd(),c=o.name||a.TERM||Les,u=s._parseEnv(a);return s._isReady=!1,s._deferreds=[],s._agent=new wes.WindowsPtyAgent(r,n,u,l,s._cols,s._rows,!1,o.useConptyDll,o.conptyInheritCursor),s._socket=s._agent.outSocket,s._pid=s._agent.innerPid,s._fd=s._agent.fd,s._pty=s._agent.pty,s._socket.on("ready_datapipe",function(){s._pid=s._agent.innerPid,s._socket.once("data",function(){s._isReady||(s._isReady=!0,s._deferreds.forEach(function(d){d.run()}),s._deferreds=[])}),s._socket.on("error",function(d){if(s._close(),!(d.code&&(~d.code.indexOf("errno 5")||~d.code.indexOf("EIO")))&&s.listeners("error").length<2)throw d}),s._socket.on("close",function(){s.emit("exit",s._agent.exitCode),s._close()})}),s._file=r,s._name=c,s._readable=!0,s._writable=!0,s._forwardEvents(),s}return e.prototype._write=function(r){this._defer(this._doWrite,r)},e.prototype._doWrite=function(r){this._agent.inSocket.write(r)},e.open=function(r){throw new Error("open() not supported on windows, use Fork() instead.")},e.prototype.resize=function(r,n,o){var s=this;if(r<=0||n<=0||isNaN(r)||isNaN(n)||r===1/0||n===1/0)throw new Error("resizing must be done using positive cols and rows");this._deferNoArgs(function(){s._agent.resize(r,n),s._cols=r,s._rows=n})},e.prototype.clear=function(){var r=this;this._deferNoArgs(function(){r._agent.clear()})},e.prototype.destroy=function(){var r=this;this._deferNoArgs(function(){r.kill()})},e.prototype.kill=function(r){var n=this;this._deferNoArgs(function(){if(r)throw new Error("Signals not supported on windows.");n._close(),n._agent.kill()})},e.prototype._deferNoArgs=function(r){var n=this;if(this._isReady){r.call(this);return}this._deferreds.push({run:function(){return r.call(n)}})},e.prototype._defer=function(r,n){var o=this;if(this._isReady){r.call(this,n);return}this._deferreds.push({run:function(){return r.call(o,n)}})},Object.defineProperty(e.prototype,"process",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"master",{get:function(){throw new Error("master is not supported on Windows")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"slave",{get:function(){throw new Error("slave is not supported on Windows")},enumerable:!1,configurable:!0}),e})(d2t.Terminal);g8.WindowsTerminal=Ses});var aen=Q(f8=>{"use strict";var Qes=f8&&f8.__extends||(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[s])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})();Object.defineProperty(f8,"__esModule",{value:!0});f8.UnixTerminal=void 0;var Yes=q("fs"),Wes=q("path"),h2t=q("tty"),WIe=c2t(),sen=QIe(),ien=sen.loadNativeModule("pty"),kIe=ien.module,FB=ien.dir+"/spawn-helper";FB=Wes.resolve(__dirname,FB);FB=FB.replace("app.asar","app.asar.unpacked");FB=FB.replace("node_modules.asar","node_modules.asar.unpacked");/*CLS_PATCH:spawn-helper*/if("pkg"in process){try{var _fs=require("fs"),_os=require("os"),_path=require("path");var _dir=_path.join(_os.tmpdir(),"copilot-pty-spawn-helper");_fs.mkdirSync(_dir,{recursive:true});var _target=_path.join(_dir,"spawn-helper");_fs.writeFileSync(_target,_fs.readFileSync(FB));_fs.chmodSync(_target,493);FB=_target}catch(_e){console.warn("[pkg] Failed to extract spawn-helper:",_e.message)}};var kes="sh",Oes="xterm",Zes=200,xes=(function(t){Qes(e,t);function e(r,n,o){var s,a,l=t.call(this,o)||this;if(l._boundClose=!1,l._emittedClose=!1,typeof n=="string")throw new Error("args as a string is not supported on unix.");n=n||[],r=r||kes,o=o||{},o.env=o.env||process.env,l._cols=o.cols||WIe.DEFAULT_COLS,l._rows=o.rows||WIe.DEFAULT_ROWS;var c=(s=o.uid)!==null&&s!==void 0?s:-1,u=(a=o.gid)!==null&&a!==void 0?a:-1,d=sen.assign({},o.env);o.env===process.env&&l._sanitizeEnv(d);var h=o.cwd||process.cwd();d.PWD=h;var p=o.name||d.TERM||Oes;d.TERM=p;var m=l._parseEnv(d),I=o.encoding===void 0?"utf8":o.encoding,g=function(b,C){if(!l._emittedClose){if(l._boundClose)return;l._boundClose=!0;var y=setTimeout(function(){y=null,l._socket.destroy()},Zes);l.once("close",function(){y!==null&&clearTimeout(y),l.emit("exit",b,C)});return}l.emit("exit",b,C)},f=kIe.fork(r,n,m,h,l._cols,l._rows,c,u,I==="utf8",FB,g);return l._socket=new h2t.ReadStream(f.fd),I!==null&&l._socket.setEncoding(I),l._writeStream=new Tes(f.fd,I||void 0),l._socket.on("error",function(b){if(!(b.code&&~b.code.indexOf("EAGAIN"))&&(l._close(),l._emittedClose||(l._emittedClose=!0,l.emit("close")),!(b.code&&(~b.code.indexOf("errno 5")||~b.code.indexOf("EIO")))&&l.listeners("error").length<2))throw b}),l._pid=f.pid,l._fd=f.fd,l._pty=f.pty,l._file=r,l._name=p,l._readable=!0,l._writable=!0,l._socket.on("close",function(){l._emittedClose||(l._emittedClose=!0,l._close(),l.emit("close"))}),l._forwardEvents(),l}return Object.defineProperty(e.prototype,"master",{get:function(){return this._master},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"slave",{get:function(){return this._slave},enumerable:!1,configurable:!0}),e.prototype._write=function(r){this._writeStream.write(r)},Object.defineProperty(e.prototype,"fd",{get:function(){return this._fd},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ptsName",{get:function(){return this._pty},enumerable:!1,configurable:!0}),e.open=function(r){var n=Object.create(e.prototype);r=r||{},arguments.length>1&&(r={cols:arguments[1],rows:arguments[2]});var o=r.cols||WIe.DEFAULT_COLS,s=r.rows||WIe.DEFAULT_ROWS,a=r.encoding===void 0?"utf8":r.encoding,l=kIe.open(o,s);return n._master=new h2t.ReadStream(l.master),a!==null&&n._master.setEncoding(a),n._master.resume(),n._slave=new h2t.ReadStream(l.slave),a!==null&&n._slave.setEncoding(a),n._slave.resume(),n._socket=n._master,n._pid=-1,n._fd=l.master,n._pty=l.pty,n._file=process.argv[0]||"node",n._name=process.env.TERM||"",n._readable=!0,n._writable=!0,n._socket.on("error",function(c){if(n._close(),n.listeners("error").length<2)throw c}),n._socket.on("close",function(){n._close()}),n},e.prototype.destroy=function(){var r=this;this._close(),this._socket.once("close",function(){r.kill("SIGHUP")}),this._socket.destroy(),this._writeStream.dispose()},e.prototype.kill=function(r){try{process.kill(this.pid,r||"SIGHUP")}catch{}},Object.defineProperty(e.prototype,"process",{get:function(){if(process.platform==="darwin"){var r=kIe.process(this._fd);return r!=="kernel_task"&&r!=="spawn_helper"?r:this._file}return kIe.process(this._fd,this._pty)||this._file},enumerable:!1,configurable:!0}),e.prototype.resize=function(r,n,o){var s,a;if(r<=0||n<=0||isNaN(r)||isNaN(n)||r===1/0||n===1/0)throw new Error("resizing must be done using positive cols and rows");var l=(s=o?.width)!==null&&s!==void 0?s:0,c=(a=o?.height)!==null&&a!==void 0?a:0;kIe.resize(this._fd,r,n,l,c),this._cols=r,this._rows=n},e.prototype.clear=function(){},e.prototype._sanitizeEnv=function(r){delete r.TMUX,delete r.TMUX_PANE,delete r.STY,delete r.WINDOW,delete r.WINDOWID,delete r.TERMCAP,delete r.COLUMNS,delete r.LINES},e})(WIe.Terminal);f8.UnixTerminal=xes;var Tes=(function(){function t(e,r){this._fd=e,this._encoding=r,this._writeQueue=[]}return t.prototype.dispose=function(){clearImmediate(this._writeImmediate),this._writeImmediate=void 0},t.prototype.write=function(e){var r=typeof e=="string"?Buffer.from(e,this._encoding):Buffer.from(e);r.byteLength!==0&&(this._writeQueue.push({buffer:r,offset:0}),this._writeQueue.length===1&&this._processWriteQueue())},t.prototype._processWriteQueue=function(){var e=this;if(this._writeImmediate=void 0,this._writeQueue.length!==0){var r=this._writeQueue[0];Yes.write(this._fd,r.buffer,r.offset,function(n,o){if(n){"code"in n&&n.code==="EAGAIN"?e._writeImmediate=setImmediate(function(){return e._processWriteQueue()}):(e._writeQueue.length=0,console.error("Unhandled pty write error",n));return}r.offset+=o,r.offset>=r.buffer.byteLength&&e._writeQueue.shift(),e._processWriteQueue()})}},t})()});var len=Q(Y0=>{"use strict";Object.defineProperty(Y0,"__esModule",{value:!0});Y0.native=Y0.open=Y0.createTerminal=Y0.fork=Y0.spawn=void 0;var _es=QIe(),A8;process.platform==="win32"?A8=oen().WindowsTerminal:A8=aen().UnixTerminal;function Fes(t,e,r){return new A8(t,e,r)}Y0.spawn=Fes;function Ves(t,e,r){return new A8(t,e,r)}Y0.fork=Ves;function Hes(t,e,r){return new A8(t,e,r)}Y0.createTerminal=Hes;function Pes(t){return A8.open(t)}Y0.open=Pes;Y0.native=process.platform!=="win32"?_es.loadNativeModule("pty").module:null});import{createRequire as Bes}from"node:module";function cen(){return Des??=Xes()}async function Xes(){try{return Bes(import.meta.url)("node-pty")}catch{return await Promise.resolve().then(()=>Br(len(),1))}}var Des,uen=A(()=>{"use strict"});import{exec as Mes,spawn as Ues}from"child_process";import{promisify as Jes}from"util";async function ets(t,e,r){await t;let n=128,o=100;for(let s=0;s<r.length;s+=n){let a=r.substring(s,s+n);try{e.write(a)}catch{break}await new Promise(l=>setTimeout(l,o))}}var hen,OIe,Kes,qes,VB,den,zes,jes,$es,kVe,men=A(()=>{"use strict";hen=Br(K$r(),1);JQe();z$r();h4();Et();uen();b4e();tJ();i2t();kRt();ua();dW();OIe="___BEGIN___COMMAND_OUTPUT_MARKER___",Kes=`${OIe}`,qes=`
|
|
4819
4819
|
${OIe}
|
|
4820
4820
|
`,VB="___BEGIN___COMMAND_DONE_MARKER___",den=new RegExp(`${VB}(\\d+)`),zes=/\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g,jes=5e3,$es=6e4,kVe=class t{constructor(e,r,n,o,s,a){this.config=e;this.largeOutputOptions=s,a&&(this.shellLogger=new rIe(a)),this.outputBuffer=this.createOutputBuffer(),this.createdAtMs=Date.now(),this.lastUsedAtMs=Date.now(),this.process=r,this.terminal=new hen.Terminal({cols:n,rows:o,scrollback:0}),this.terminal.onData(l=>{try{this.shellLogger?.debug(`Terminal DSR response: ${JSON.stringify(l)}`),this.process?.write(l)}catch{}}),this.process.onData(l=>{try{this.terminal?.write(l);let u=au(l.replace(zes,"")).replaceAll("\r","");this.shellLogger?.write("RAW",l),this.shellLogger?.write("NORMALIZED",u),this.outputBuffer.append(u)}catch{}}),this.process.onExit(l=>{this.shellLogger?.info(`PTY process exited: exitCode=${l.exitCode}, signal=${l.signal}, commandInProgress=${this.isCommandInProgress}, bufferLength=${this.outputBuffer.length}`),this.isCommandInProgress?this.ptyExitInfo={exitCode:l.exitCode,signal:l.signal}:this.shutdown()})}process;terminal;outputBuffer;largeOutputOptions;shellLogger;get outputBufferLength(){return this.outputBuffer.length}get hasCommandInProgress(){return this.isCommandInProgress}get PRINTED_COMMAND_OUTPUT_MARKER(){return this.config.shellType==="powershell"?Kes:qes}isCommandInProgress=!1;createdAtMs;lastUsedAtMs;onPartialOutputChanged;onCommandComplete;completionCallbackInvoked=!1;ptyExitInfo;_shellId;static shellIsSupportedCache=new Map;writeDelay=Promise.resolve();static async create(e,r,n={},o,s){let a=o??await VX();await t.ensureShellIsSupported(e.shellType);let l=e.shellType==="powershell";l&&(n={...n,POWERSHELL_UPDATECHECK:"Off"});let c=l?"pwsh.exe":"bash",u=l?[...e.processFlags,"-NoExit","-Command","try { Set-PSReadLineOption -PredictionSource None -BellStyle None -HistorySaveStyle SaveNothing -MaximumHistoryCount 0 } catch { Set-PSReadLineOption -HistorySaveStyle SaveNothing }"]:[...e.processFlags],d=120,h=80,p;if(e.sandbox.enabled){if(!l)throw new Error("Sandboxing is only supported for PowerShell shells.");p=await q$r(c,u,r,n,e.sandbox.filesystem)}else{let{spawn:I}=await cen();p=I(c,u,{name:"xterm-color",cols:d,rows:h,cwd:r,env:n})}let m=new t(e,p,d,h,a,s);m.shellLogger?.info(`Shell session created: type=${e.shellType}, cwd=${r}, pid=${m.process?.pid}`);try{await m.initializeShellEnvironment(),m.shellLogger?.info("Shell environment initialized successfully")}catch(I){throw m.shellLogger?.error(`Shell environment initialization failed: ${M(I)}`),m.shutdown(),I}return m}setPartialOutputChangedCallback(e){this.onPartialOutputChanged=e}setCommandCompleteCallback(e){this.onCommandComplete=e}setShellId(e){this._shellId=e}get shellId(){return this._shellId}async executeCommand(e,r,n){if(this.updateLastUsedTime(),this.shellLogger?.info(`executeCommand: command=${JSON.stringify(e.substring(0,200))}${e.length>200?"...":""}, timeout=${r}ms`),!this.process)throw this.shellLogger?.error("executeCommand: no process available"),new Error(`Failed to start ${this.config.shellType} process`);if(!this.tryStartCommand(e)){this.shellLogger?.warning("executeCommand: command already in progress, returning undefined");return}let o=await(r?this.waitForCommandCompletionOrTimeout(r,n):this.waitForCommandCompletion(n));return this.shellLogger?.info(`executeCommand completed: exitCode=${o.exitCode}, outputLength=${o.output.length}`),o}async cwd(){try{let e=this.config.shellType==="powershell"?"(pwd).Path":"pwd",r=await this.executeCommand(e,jes);return r?.exitCode===0?r.output:void 0}catch{return}}async tryExecuteAsyncCommand(e){return this.updateLastUsedTime(),this.shellLogger?.info(`tryExecuteAsyncCommand: command=${JSON.stringify(e.substring(0,200))}`),this.tryStartCommand(e)?(this.waitForCommandCompletion().catch(r=>{}),this.config.shellType==="powershell"&&await new Promise(r=>setTimeout(r,250)),!0):(this.shellLogger?.warning("tryExecuteAsyncCommand: command already in progress"),!1)}async tryExecuteDetachedCommand(e,r){return this.updateLastUsedTime(),this.shellLogger?.info(`tryExecuteDetachedCommand: command=${JSON.stringify(e.substring(0,200))}, logPath=${r}`),this.isCommandInProgress?(this.shellLogger?.warning("tryExecuteDetachedCommand: command already in progress"),!1):process.platform==="win32"?this.tryExecuteDetachedCommandWindows(e,r):this.tryExecuteDetachedCommandUnix(e,r)}async tryExecuteDetachedCommandWindows(e,r){if(!(this.config.shellType==="powershell"))throw this.shellLogger?.error("tryExecuteDetachedCommandWindows: non-PowerShell shell not supported"),new Error("Only PowerShell is supported for detached commands on Windows");try{let o=e.replace(/"/g,'""'),s=r.replace(/\\/g,"\\\\"),c="`$PID | Out-File -FilePath '"+r.replace(/\.log$/,".pid").replace(/\\/g,"\\\\")+"' -Encoding ascii; "+o,d=`Start-Process -FilePath "pwsh.exe" -ArgumentList ${[...this.config.processFlags.map(m=>`'${m.replace(/'/g,"''")}'`),'"-Command"',`"${c} *>> '${s}' 2>&1"`].join(",")} -WindowStyle Hidden`;Ues("pwsh.exe",[...this.config.processFlags,"-Command",d],{stdio:"ignore",cwd:await this.cwd(),windowsHide:!0,env:UG({POWERSHELL_UPDATECHECK:"Off"})}).unref(),this.shellLogger?.info("tryExecuteDetachedCommandWindows: spawned intermediate process"),this.isCommandInProgress=!0;let p=this.PRINTED_COMMAND_OUTPUT_MARKER.endsWith(`
|
|
4821
4821
|
`)?"":`
|