@theia/process 1.70.0-next.71 → 1.70.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.
|
@@ -6,6 +6,22 @@ export interface TaskTerminalProcessFactory {
|
|
|
6
6
|
export declare class TaskTerminalProcess extends TerminalProcess {
|
|
7
7
|
exited: boolean;
|
|
8
8
|
attachmentAttempted: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Runtime-only property: whether to enable command history tracking for this task's terminal.
|
|
11
|
+
* This value is injected from the `terminal.integrated.enableCommandHistory` preference
|
|
12
|
+
* before the task is sent to the backend. It is not part of the task definition schema
|
|
13
|
+
* and should not be persisted in tasks.json.
|
|
14
|
+
*/
|
|
15
|
+
protected _enableCommandHistory: boolean;
|
|
16
|
+
protected _endOscInjected: boolean;
|
|
17
|
+
setEnableCommandHistory(enable: boolean): void;
|
|
18
|
+
/**
|
|
19
|
+
* injects the command to be tracked into the terminal output stream
|
|
20
|
+
* only if command history tracking is enabled
|
|
21
|
+
*/
|
|
22
|
+
injectCommandStartOsc(command: string): void;
|
|
9
23
|
protected onTerminalExit(code: number | undefined, signal: string | undefined): void;
|
|
24
|
+
kill(signal?: string): void;
|
|
25
|
+
protected injectCommandEndOsc(): void;
|
|
10
26
|
}
|
|
11
27
|
//# sourceMappingURL=task-terminal-process.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-terminal-process.d.ts","sourceRoot":"","sources":["../../src/node/task-terminal-process.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,eAAO,MAAM,0BAA0B,eAAuC,CAAC;AAC/E,MAAM,WAAW,0BAA0B;IACvC,CAAC,OAAO,EAAE,sBAAsB,GAAG,mBAAmB,CAAC;CAC1D;AAED,qBACa,mBAAoB,SAAQ,eAAe;IAE7C,MAAM,UAAS;IACf,mBAAmB,UAAS;
|
|
1
|
+
{"version":3,"file":"task-terminal-process.d.ts","sourceRoot":"","sources":["../../src/node/task-terminal-process.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,eAAO,MAAM,0BAA0B,eAAuC,CAAC;AAC/E,MAAM,WAAW,0BAA0B;IACvC,CAAC,OAAO,EAAE,sBAAsB,GAAG,mBAAmB,CAAC;CAC1D;AAED,qBACa,mBAAoB,SAAQ,eAAe;IAE7C,MAAM,UAAS;IACf,mBAAmB,UAAS;IACnC;;;;;OAKG;IACH,SAAS,CAAC,qBAAqB,UAAS;IAGxC,SAAS,CAAC,eAAe,UAAS;IAElC,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAI9C;;;OAGG;IACH,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;cAQzB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAWpF,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAKpC,SAAS,CAAC,mBAAmB,IAAI,IAAI;CASxC"}
|
|
@@ -25,8 +25,32 @@ let TaskTerminalProcess = class TaskTerminalProcess extends terminal_process_1.T
|
|
|
25
25
|
super(...arguments);
|
|
26
26
|
this.exited = false;
|
|
27
27
|
this.attachmentAttempted = false;
|
|
28
|
+
/**
|
|
29
|
+
* Runtime-only property: whether to enable command history tracking for this task's terminal.
|
|
30
|
+
* This value is injected from the `terminal.integrated.enableCommandHistory` preference
|
|
31
|
+
* before the task is sent to the backend. It is not part of the task definition schema
|
|
32
|
+
* and should not be persisted in tasks.json.
|
|
33
|
+
*/
|
|
34
|
+
this._enableCommandHistory = false;
|
|
35
|
+
// to avoid multiple end OSC injections
|
|
36
|
+
this._endOscInjected = false;
|
|
37
|
+
}
|
|
38
|
+
setEnableCommandHistory(enable) {
|
|
39
|
+
this._enableCommandHistory = enable;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* injects the command to be tracked into the terminal output stream
|
|
43
|
+
* only if command history tracking is enabled
|
|
44
|
+
*/
|
|
45
|
+
injectCommandStartOsc(command) {
|
|
46
|
+
if (this._enableCommandHistory) {
|
|
47
|
+
const encoded = Buffer.from(command).toString('hex');
|
|
48
|
+
this.ringBuffer.enq(`\x1b]133;command_started;${encoded}\x07`);
|
|
49
|
+
this._endOscInjected = false;
|
|
50
|
+
}
|
|
28
51
|
}
|
|
29
52
|
onTerminalExit(code, signal) {
|
|
53
|
+
this.injectCommandEndOsc();
|
|
30
54
|
this.emitOnExit(code, signal);
|
|
31
55
|
this.exited = true;
|
|
32
56
|
// Unregister process only if task terminal already attached (or failed attach),
|
|
@@ -35,6 +59,18 @@ let TaskTerminalProcess = class TaskTerminalProcess extends terminal_process_1.T
|
|
|
35
59
|
this.unregisterProcess();
|
|
36
60
|
}
|
|
37
61
|
}
|
|
62
|
+
kill(signal) {
|
|
63
|
+
this.injectCommandEndOsc();
|
|
64
|
+
super.kill(signal);
|
|
65
|
+
}
|
|
66
|
+
injectCommandEndOsc() {
|
|
67
|
+
if (this._enableCommandHistory && !this._endOscInjected) {
|
|
68
|
+
// Mark the task command as finished in command history tracking.
|
|
69
|
+
// OSC 133 'prompt_started' signals the end of command execution.
|
|
70
|
+
this.ringBuffer.enq('\x1b]133;prompt_started\x07');
|
|
71
|
+
this._endOscInjected = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
38
74
|
};
|
|
39
75
|
exports.TaskTerminalProcess = TaskTerminalProcess;
|
|
40
76
|
exports.TaskTerminalProcess = TaskTerminalProcess = tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-terminal-process.js","sourceRoot":"","sources":["../../src/node/task-terminal-process.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oEAAoE;AACpE,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC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K,CAAC,CAAC;YACrD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,4BAA4B,OAAO,MAAM,CAAC,CAAC;YAC/D,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QACjC,CAAC;IACL,CAAC;IAEkB,cAAc,CAAC,IAAwB,EAAE,MAA0B;QAClF,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,gFAAgF;QAChF,2DAA2D;QAC3D,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC7B,CAAC;IACL,CAAC;IAEQ,IAAI,CAAC,MAAe;QACzB,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAES,mBAAmB;QACzB,IAAI,IAAI,CAAC,qBAAqB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YACtD,iEAAiE;YACjE,iEAAiE;YACjE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;YACnD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAChC,CAAC;IACL,CAAC;CAEJ,CAAA;AAxDY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,sBAAU,GAAE;GACA,mBAAmB,CAwD/B"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/process",
|
|
3
|
-
"version": "1.70.0
|
|
3
|
+
"version": "1.70.0",
|
|
4
4
|
"description": "Theia process support.",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.70.0
|
|
7
|
-
"node-pty": "1.
|
|
6
|
+
"@theia/core": "1.70.0",
|
|
7
|
+
"node-pty": "1.2.0-beta.12",
|
|
8
8
|
"string-argv": "^0.1.1",
|
|
9
9
|
"tslib": "^2.6.2"
|
|
10
10
|
},
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"watch": "theiaext watch"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@theia/ext-scripts": "1.
|
|
48
|
+
"@theia/ext-scripts": "1.70.0"
|
|
49
49
|
},
|
|
50
50
|
"nyc": {
|
|
51
51
|
"extends": "../../configs/nyc.json"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "d2e3d1ecaa9b1df7992eeaa1ad4584f436a83e67"
|
|
54
54
|
}
|
|
@@ -27,8 +27,35 @@ export class TaskTerminalProcess extends TerminalProcess {
|
|
|
27
27
|
|
|
28
28
|
public exited = false;
|
|
29
29
|
public attachmentAttempted = false;
|
|
30
|
+
/**
|
|
31
|
+
* Runtime-only property: whether to enable command history tracking for this task's terminal.
|
|
32
|
+
* This value is injected from the `terminal.integrated.enableCommandHistory` preference
|
|
33
|
+
* before the task is sent to the backend. It is not part of the task definition schema
|
|
34
|
+
* and should not be persisted in tasks.json.
|
|
35
|
+
*/
|
|
36
|
+
protected _enableCommandHistory = false;
|
|
37
|
+
|
|
38
|
+
// to avoid multiple end OSC injections
|
|
39
|
+
protected _endOscInjected = false;
|
|
40
|
+
|
|
41
|
+
setEnableCommandHistory(enable: boolean): void {
|
|
42
|
+
this._enableCommandHistory = enable;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* injects the command to be tracked into the terminal output stream
|
|
47
|
+
* only if command history tracking is enabled
|
|
48
|
+
*/
|
|
49
|
+
injectCommandStartOsc(command: string): void {
|
|
50
|
+
if (this._enableCommandHistory) {
|
|
51
|
+
const encoded = Buffer.from(command).toString('hex');
|
|
52
|
+
this.ringBuffer.enq(`\x1b]133;command_started;${encoded}\x07`);
|
|
53
|
+
this._endOscInjected = false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
30
56
|
|
|
31
57
|
protected override onTerminalExit(code: number | undefined, signal: string | undefined): void {
|
|
58
|
+
this.injectCommandEndOsc();
|
|
32
59
|
this.emitOnExit(code, signal);
|
|
33
60
|
this.exited = true;
|
|
34
61
|
// Unregister process only if task terminal already attached (or failed attach),
|
|
@@ -38,4 +65,18 @@ export class TaskTerminalProcess extends TerminalProcess {
|
|
|
38
65
|
}
|
|
39
66
|
}
|
|
40
67
|
|
|
68
|
+
override kill(signal?: string): void {
|
|
69
|
+
this.injectCommandEndOsc();
|
|
70
|
+
super.kill(signal);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
protected injectCommandEndOsc(): void {
|
|
74
|
+
if (this._enableCommandHistory && !this._endOscInjected) {
|
|
75
|
+
// Mark the task command as finished in command history tracking.
|
|
76
|
+
// OSC 133 'prompt_started' signals the end of command execution.
|
|
77
|
+
this.ringBuffer.enq('\x1b]133;prompt_started\x07');
|
|
78
|
+
this._endOscInjected = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
41
82
|
}
|