@codingame/monaco-vscode-xterm-common 36.2.7 → 37.2.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.
- package/package.json +4 -4
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostOutputChannel.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostOutputChannel.js +48 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.d.ts +17 -5
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.js +173 -63
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.d.ts +13 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.js +119 -56
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +5 -5
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +61 -61
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +71 -49
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +9 -7
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +5 -5
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +3 -3
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/notifications.d.ts +0 -51
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/notifications.js +0 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.d.ts +0 -78
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +0 -83
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { SequencerByKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
3
|
import { Disposable, DisposableMap, toDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
4
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
6
5
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
7
6
|
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
8
7
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
9
8
|
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
9
|
+
import { ITerminalLogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service';
|
|
10
10
|
import { AgentHostPty } from './agentHostPty.js';
|
|
11
|
+
import { AgentHostOutputChannel } from './agentHostOutputChannel.js';
|
|
11
12
|
import { AhpTerminalCommandSource } from './ahpTerminalCommandSource.js';
|
|
12
13
|
import { ITerminalService, ITerminalChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
13
14
|
import { ITerminalProfileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal.service';
|
|
@@ -20,13 +21,15 @@ let AgentHostTerminalService = class AgentHostTerminalService extends Disposable
|
|
|
20
21
|
_terminalService,
|
|
21
22
|
_terminalChatService,
|
|
22
23
|
_terminalProfileService,
|
|
23
|
-
_quickInputService
|
|
24
|
+
_quickInputService,
|
|
25
|
+
_logService
|
|
24
26
|
) {
|
|
25
27
|
super();
|
|
26
28
|
this._terminalService = _terminalService;
|
|
27
29
|
this._terminalChatService = _terminalChatService;
|
|
28
30
|
this._terminalProfileService = _terminalProfileService;
|
|
29
31
|
this._quickInputService = _quickInputService;
|
|
32
|
+
this._logService = _logService;
|
|
30
33
|
this._entries = [];
|
|
31
34
|
this._usedHosts = ( new Set());
|
|
32
35
|
this._profileRegistrations = this._register(( new DisposableMap()));
|
|
@@ -34,7 +37,7 @@ let AgentHostTerminalService = class AgentHostTerminalService extends Disposable
|
|
|
34
37
|
this.profiles = this._profiles;
|
|
35
38
|
this._revivedInstances = ( new Map());
|
|
36
39
|
this._activePtys = ( new Map());
|
|
37
|
-
this.
|
|
40
|
+
this._pendingRevives = ( new Map());
|
|
38
41
|
}
|
|
39
42
|
registerEntry(entry) {
|
|
40
43
|
this._entries.push(entry);
|
|
@@ -83,7 +86,7 @@ let AgentHostTerminalService = class AgentHostTerminalService extends Disposable
|
|
|
83
86
|
}
|
|
84
87
|
} else if (displaying < entries.length) {
|
|
85
88
|
desiredProfiles.set("__quickpick__", {
|
|
86
|
-
name: ( localize(
|
|
89
|
+
name: ( localize(16804, "Agent Host…")),
|
|
87
90
|
address: "__quickpick__",
|
|
88
91
|
getConnection: () => undefined
|
|
89
92
|
});
|
|
@@ -104,7 +107,7 @@ let AgentHostTerminalService = class AgentHostTerminalService extends Disposable
|
|
|
104
107
|
infos.push({
|
|
105
108
|
extensionIdentifier: AGENT_HOST_PROFILE_EXT_ID,
|
|
106
109
|
profileId: key,
|
|
107
|
-
title: key === "__quickpick__" ? ( localize(
|
|
110
|
+
title: key === "__quickpick__" ? ( localize(16804, "Agent Host…")) : ( localize(16805, "Agent Host ({0})", desiredProfiles.get(key).name)),
|
|
108
111
|
address: key
|
|
109
112
|
});
|
|
110
113
|
}
|
|
@@ -119,12 +122,12 @@ let AgentHostTerminalService = class AgentHostTerminalService extends Disposable
|
|
|
119
122
|
let displayName = entry.name;
|
|
120
123
|
if (key === "__quickpick__") {
|
|
121
124
|
const picks = ( allEntries.map(e => ({
|
|
122
|
-
label: ( localize(
|
|
125
|
+
label: ( localize(16805, "Agent Host ({0})", e.name)),
|
|
123
126
|
address: e.address,
|
|
124
127
|
hostName: e.name
|
|
125
128
|
})));
|
|
126
129
|
const pick = await this._quickInputService.pick(picks, {
|
|
127
|
-
placeHolder: ( localize(
|
|
130
|
+
placeHolder: ( localize(16806, "Select an agent host to open a terminal on"))
|
|
128
131
|
});
|
|
129
132
|
if (!pick) {
|
|
130
133
|
return;
|
|
@@ -140,13 +143,13 @@ let AgentHostTerminalService = class AgentHostTerminalService extends Disposable
|
|
|
140
143
|
return;
|
|
141
144
|
}
|
|
142
145
|
await this.createTerminal(connection, {
|
|
143
|
-
name: ( localize(
|
|
146
|
+
name: ( localize(16805, "Agent Host ({0})", displayName)),
|
|
144
147
|
cwd: options.cwd ? (typeof options.cwd === "string" ? URI.file(options.cwd) : options.cwd) : this._defaultCwd,
|
|
145
148
|
location: options.location
|
|
146
149
|
});
|
|
147
150
|
}
|
|
148
151
|
};
|
|
149
|
-
const title = key === "__quickpick__" ? ( localize(
|
|
152
|
+
const title = key === "__quickpick__" ? ( localize(16804, "Agent Host…")) : ( localize(16805, "Agent Host ({0})", entry.name));
|
|
150
153
|
const store = ( new DisposableStore());
|
|
151
154
|
store.add(
|
|
152
155
|
this._terminalProfileService.registerTerminalProfileProvider(AGENT_HOST_PROFILE_EXT_ID, key, provider)
|
|
@@ -175,43 +178,60 @@ let AgentHostTerminalService = class AgentHostTerminalService extends Disposable
|
|
|
175
178
|
scheme: "agenthost-terminal",
|
|
176
179
|
path: `/${generateUuid()}`
|
|
177
180
|
}));
|
|
178
|
-
const name = options?.name ?? ( localize(
|
|
181
|
+
const name = options?.name ?? ( localize(16807, "Agent Host Terminal"));
|
|
179
182
|
const key = ( terminalUri.toString());
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
183
|
+
const ptyRegistration = this._createPtyRegistration(key, connection.clientId);
|
|
184
|
+
let instance;
|
|
185
|
+
try {
|
|
186
|
+
instance = await this._terminalService.createTerminal({
|
|
187
|
+
config: {
|
|
188
|
+
customPtyImplementation: (id, cols, rows) => {
|
|
189
|
+
const pty = ( new AgentHostPty(id, connection, terminalUri, {
|
|
190
|
+
name,
|
|
191
|
+
cwd: options?.cwd
|
|
192
|
+
}, this._logService));
|
|
193
|
+
if (cols > 0 && rows > 0) {
|
|
194
|
+
pty.resize(cols, rows);
|
|
195
|
+
}
|
|
196
|
+
ptyRegistration.setPty(pty);
|
|
197
|
+
return pty;
|
|
198
|
+
},
|
|
199
|
+
name,
|
|
200
|
+
icon: {
|
|
201
|
+
id: "remote"
|
|
202
|
+
},
|
|
203
|
+
isFeatureTerminal: false
|
|
199
204
|
},
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
location: options?.location
|
|
206
|
+
});
|
|
207
|
+
} catch (error) {
|
|
208
|
+
ptyRegistration.dispose();
|
|
209
|
+
throw error;
|
|
210
|
+
}
|
|
211
|
+
this._registerInstancePtyCleanup(instance, key, ptyRegistration);
|
|
207
212
|
return instance;
|
|
208
213
|
}
|
|
209
214
|
async reviveTerminal(connection, terminalUri, terminalToolSessionId) {
|
|
210
215
|
const key = ( terminalUri.toString());
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
216
|
+
const pending = this._pendingRevives.get(key);
|
|
217
|
+
if (pending) {
|
|
218
|
+
return pending;
|
|
219
|
+
}
|
|
220
|
+
const revive = this._doReviveTerminal(connection, terminalUri, terminalToolSessionId, key).finally(() => {
|
|
221
|
+
if (this._pendingRevives.get(key) === revive) {
|
|
222
|
+
this._pendingRevives.delete(key);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
this._pendingRevives.set(key, revive);
|
|
226
|
+
return revive;
|
|
227
|
+
}
|
|
228
|
+
attachOutputTerminal(connection, terminalUri, terminalToolSessionId) {
|
|
229
|
+
const store = ( new DisposableStore());
|
|
230
|
+
const source = store.add(( new AgentHostOutputChannel(connection, terminalUri)));
|
|
231
|
+
store.add(
|
|
232
|
+
this._terminalChatService.registerOutputSource(terminalToolSessionId, source)
|
|
214
233
|
);
|
|
234
|
+
return store;
|
|
215
235
|
}
|
|
216
236
|
async _doReviveTerminal(connection, terminalUri, terminalToolSessionId, key) {
|
|
217
237
|
const existing = this._revivedInstances.get(key);
|
|
@@ -220,41 +240,84 @@ let AgentHostTerminalService = class AgentHostTerminalService extends Disposable
|
|
|
220
240
|
}
|
|
221
241
|
const store = ( new DisposableStore());
|
|
222
242
|
const commandSource = store.add(( new AhpTerminalCommandSource()));
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
);
|
|
226
|
-
const instance = await this._terminalService.createTerminal({
|
|
243
|
+
const ptyRegistration = this._createPtyRegistration(key, connection.clientId);
|
|
244
|
+
const instancePromise = Promise.resolve().then(() => this._terminalService.createTerminal({
|
|
227
245
|
config: {
|
|
228
246
|
customPtyImplementation: (id, cols, rows) => {
|
|
229
247
|
const pty = ( new AgentHostPty(id, connection, terminalUri, {
|
|
230
248
|
attachOnly: true
|
|
231
|
-
}));
|
|
249
|
+
}, this._logService));
|
|
232
250
|
if (cols > 0 && rows > 0) {
|
|
233
251
|
pty.resize(cols, rows);
|
|
234
252
|
}
|
|
235
253
|
if (!store.isDisposed) {
|
|
236
254
|
commandSource.connect(instance, pty);
|
|
237
255
|
}
|
|
238
|
-
|
|
239
|
-
pty,
|
|
240
|
-
clientId: connection.clientId
|
|
241
|
-
});
|
|
256
|
+
ptyRegistration.setPty(pty);
|
|
242
257
|
return pty;
|
|
243
258
|
},
|
|
244
|
-
name: ( localize(
|
|
259
|
+
name: ( localize(16808, "Agent Host Terminal")),
|
|
245
260
|
isFeatureTerminal: true,
|
|
246
261
|
hideFromUser: true
|
|
247
262
|
}
|
|
248
|
-
});
|
|
263
|
+
}));
|
|
264
|
+
store.add(
|
|
265
|
+
this._terminalChatService.registerAhpCommandSource(terminalToolSessionId, commandSource, instancePromise)
|
|
266
|
+
);
|
|
267
|
+
let instance;
|
|
268
|
+
try {
|
|
269
|
+
instance = await instancePromise;
|
|
270
|
+
} catch (error) {
|
|
271
|
+
store.dispose();
|
|
272
|
+
ptyRegistration.dispose();
|
|
273
|
+
throw error;
|
|
274
|
+
}
|
|
249
275
|
this._terminalChatService.registerTerminalInstanceWithToolSession(terminalToolSessionId, instance);
|
|
250
276
|
this._revivedInstances.set(key, instance);
|
|
251
277
|
instance.store.add(store);
|
|
252
|
-
this.
|
|
253
|
-
this._revivedInstances.delete(key);
|
|
254
|
-
this._activePtys.delete(key);
|
|
255
|
-
}));
|
|
278
|
+
this._registerInstancePtyCleanup(instance, key, ptyRegistration);
|
|
256
279
|
return instance;
|
|
257
280
|
}
|
|
281
|
+
_createPtyRegistration(key, clientId) {
|
|
282
|
+
let pty;
|
|
283
|
+
let isDisposed = false;
|
|
284
|
+
return {
|
|
285
|
+
setPty: value => {
|
|
286
|
+
if (isDisposed) {
|
|
287
|
+
value.dispose();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
pty = value;
|
|
291
|
+
this._activePtys.set(key, {
|
|
292
|
+
pty,
|
|
293
|
+
clientId
|
|
294
|
+
});
|
|
295
|
+
},
|
|
296
|
+
dispose: () => {
|
|
297
|
+
if (isDisposed) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
isDisposed = true;
|
|
301
|
+
if (this._activePtys.get(key)?.pty === pty) {
|
|
302
|
+
this._activePtys.delete(key);
|
|
303
|
+
}
|
|
304
|
+
pty?.dispose();
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
_registerInstancePtyCleanup(instance, key, ptyRegistration) {
|
|
309
|
+
const cleanup = () => {
|
|
310
|
+
if (this._revivedInstances.get(key) === instance) {
|
|
311
|
+
this._revivedInstances.delete(key);
|
|
312
|
+
}
|
|
313
|
+
ptyRegistration.dispose();
|
|
314
|
+
};
|
|
315
|
+
if (instance.isDisposed) {
|
|
316
|
+
cleanup();
|
|
317
|
+
} else {
|
|
318
|
+
instance.store.add(instance.onDisposed(cleanup));
|
|
319
|
+
}
|
|
320
|
+
}
|
|
258
321
|
async reconnectTerminals(newConnection, oldClientId) {
|
|
259
322
|
const entries = [...this._activePtys.entries()].filter(([, entry]) => entry.clientId === oldClientId);
|
|
260
323
|
const total = entries.length;
|
|
@@ -266,7 +329,7 @@ let AgentHostTerminalService = class AgentHostTerminalService extends Disposable
|
|
|
266
329
|
recovered++;
|
|
267
330
|
entry.clientId = newConnection.clientId;
|
|
268
331
|
} else {
|
|
269
|
-
|
|
332
|
+
this._logService.warn(`[AgentHostTerminalService] Failed to reconnect terminal: ${key}`);
|
|
270
333
|
}
|
|
271
334
|
}));
|
|
272
335
|
}
|
|
@@ -277,6 +340,6 @@ let AgentHostTerminalService = class AgentHostTerminalService extends Disposable
|
|
|
277
340
|
};
|
|
278
341
|
}
|
|
279
342
|
};
|
|
280
|
-
AgentHostTerminalService = ( __decorate([( __param(0, ITerminalService)), ( __param(1, ITerminalChatService)), ( __param(2, ITerminalProfileService)), ( __param(3, IQuickInputService))], AgentHostTerminalService));
|
|
343
|
+
AgentHostTerminalService = ( __decorate([( __param(0, ITerminalService)), ( __param(1, ITerminalChatService)), ( __param(2, ITerminalProfileService)), ( __param(3, IQuickInputService)), ( __param(4, ITerminalLogService))], AgentHostTerminalService));
|
|
281
344
|
|
|
282
345
|
export { AgentHostTerminalService };
|
|
@@ -24,7 +24,7 @@ let EnvironmentVariableInfoStale = class EnvironmentVariableInfoStale {
|
|
|
24
24
|
addExtensionIdentifiers(extSet, ( this._diff.removed.values()));
|
|
25
25
|
addExtensionIdentifiers(extSet, ( this._diff.changed.values()));
|
|
26
26
|
let message = ( localize(
|
|
27
|
-
|
|
27
|
+
16813,
|
|
28
28
|
"The following extensions want to relaunch the terminal to contribute to its environment:"
|
|
29
29
|
));
|
|
30
30
|
message += getMergedDescription(this._collection, scope, this._extensionService, extSet);
|
|
@@ -32,7 +32,7 @@ let EnvironmentVariableInfoStale = class EnvironmentVariableInfoStale {
|
|
|
32
32
|
}
|
|
33
33
|
_getActions() {
|
|
34
34
|
return [{
|
|
35
|
-
label: ( localize(
|
|
35
|
+
label: ( localize(16814, "Relaunch Terminal")),
|
|
36
36
|
run: () => this._terminalService.getInstanceFromId(this._terminalId)?.relaunch(),
|
|
37
37
|
commandId: TerminalCommandId.Relaunch
|
|
38
38
|
}];
|
|
@@ -59,7 +59,7 @@ let EnvironmentVariableInfoChangesActive = class EnvironmentVariableInfoChangesA
|
|
|
59
59
|
const extSet = ( new Set());
|
|
60
60
|
addExtensionIdentifiers(extSet, ( this._collection.getVariableMap(scope).values()));
|
|
61
61
|
let message = ( localize(
|
|
62
|
-
|
|
62
|
+
16815,
|
|
63
63
|
"The following extensions have contributed to this terminal's environment:"
|
|
64
64
|
));
|
|
65
65
|
message += getMergedDescription(this._collection, scope, this._extensionService, extSet);
|
|
@@ -67,7 +67,7 @@ let EnvironmentVariableInfoChangesActive = class EnvironmentVariableInfoChangesA
|
|
|
67
67
|
}
|
|
68
68
|
_getActions(scope) {
|
|
69
69
|
return [{
|
|
70
|
-
label: ( localize(
|
|
70
|
+
label: ( localize(16816, "Show Environment Contributions")),
|
|
71
71
|
run: () => this._commandService.executeCommand(TerminalCommandId.ShowEnvironmentContributions, scope),
|
|
72
72
|
commandId: TerminalCommandId.ShowEnvironmentContributions
|
|
73
73
|
}];
|
|
@@ -95,7 +95,7 @@ function getMergedDescription(collection, scope, extensionService, extSet) {
|
|
|
95
95
|
}
|
|
96
96
|
const workspaceDescription = workspaceDescriptions.get(ext);
|
|
97
97
|
if (workspaceDescription) {
|
|
98
|
-
const workspaceSuffix = globalDescription ? ` (${( localize(
|
|
98
|
+
const workspaceSuffix = globalDescription ? ` (${( localize(16817, "workspace"))})` : "";
|
|
99
99
|
message.push(`\n- \`${getExtensionName(ext, extensionService)}${workspaceSuffix}\``);
|
|
100
100
|
message.push(`: ${workspaceDescription}`);
|
|
101
101
|
}
|