@codingame/monaco-vscode-xterm-common 37.2.0 → 37.3.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 +3 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +39 -39
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollContribution.js +3 -3
- package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.d.ts +0 -11
- package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.js +0 -26
- package/vscode/src/vs/platform/terminal/common/environmentVariable.d.ts +0 -86
- package/vscode/src/vs/platform/terminal/common/environmentVariable.js +0 -10
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.d.ts +0 -17
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.js +0 -218
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.d.ts +0 -14
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.js +0 -84
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostOutputChannel.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostOutputChannel.js +0 -48
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.d.ts +0 -129
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.js +0 -439
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.d.ts +0 -77
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.js +0 -345
- package/vscode/src/vs/workbench/contrib/terminal/browser/ahpTerminalCommandSource.d.ts +0 -111
- package/vscode/src/vs/workbench/contrib/terminal/browser/ahpTerminalCommandSource.js +0 -138
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +0 -119
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.d.ts +0 -104
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +0 -1643
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.js +0 -54
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.js +0 -78
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.d.ts +0 -144
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +0 -806
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.js +0 -83
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.js +0 -139
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.d.ts +0 -45
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +0 -804
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +0 -75
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.js +0 -61
- package/vscode/src/vs/workbench/contrib/terminal/common/basePty.d.ts +0 -38
- package/vscode/src/vs/workbench/contrib/terminal/common/basePty.js +0 -127
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.d.ts +0 -38
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.js +0 -321
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.js +0 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/media/stickyScroll.css +0 -49
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +0 -25
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +0 -58
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +0 -462
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { Disposable, DisposableMap, toDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
5
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
6
|
-
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
7
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
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
|
-
import { AgentHostPty } from './agentHostPty.js';
|
|
11
|
-
import { AgentHostOutputChannel } from './agentHostOutputChannel.js';
|
|
12
|
-
import { AhpTerminalCommandSource } from './ahpTerminalCommandSource.js';
|
|
13
|
-
import { ITerminalService, ITerminalChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
14
|
-
import { ITerminalProfileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal.service';
|
|
15
|
-
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
16
|
-
import { transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/transaction';
|
|
17
|
-
|
|
18
|
-
const AGENT_HOST_PROFILE_EXT_ID = "vscode.agent-host-terminal";
|
|
19
|
-
let AgentHostTerminalService = class AgentHostTerminalService extends Disposable {
|
|
20
|
-
constructor(
|
|
21
|
-
_terminalService,
|
|
22
|
-
_terminalChatService,
|
|
23
|
-
_terminalProfileService,
|
|
24
|
-
_quickInputService,
|
|
25
|
-
_logService
|
|
26
|
-
) {
|
|
27
|
-
super();
|
|
28
|
-
this._terminalService = _terminalService;
|
|
29
|
-
this._terminalChatService = _terminalChatService;
|
|
30
|
-
this._terminalProfileService = _terminalProfileService;
|
|
31
|
-
this._quickInputService = _quickInputService;
|
|
32
|
-
this._logService = _logService;
|
|
33
|
-
this._entries = [];
|
|
34
|
-
this._usedHosts = ( new Set());
|
|
35
|
-
this._profileRegistrations = this._register(( new DisposableMap()));
|
|
36
|
-
this._profiles = observableValue("agentHostTerminalProfiles", []);
|
|
37
|
-
this.profiles = this._profiles;
|
|
38
|
-
this._revivedInstances = ( new Map());
|
|
39
|
-
this._activePtys = ( new Map());
|
|
40
|
-
this._pendingRevives = ( new Map());
|
|
41
|
-
}
|
|
42
|
-
registerEntry(entry) {
|
|
43
|
-
this._entries.push(entry);
|
|
44
|
-
this._reconcile();
|
|
45
|
-
return toDisposable(() => {
|
|
46
|
-
const idx = this._entries.indexOf(entry);
|
|
47
|
-
if (idx >= 0) {
|
|
48
|
-
this._entries.splice(idx, 1);
|
|
49
|
-
this._reconcile();
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
getProfileForConnection(address) {
|
|
54
|
-
const entry = this._entries.find(e => e.address === address);
|
|
55
|
-
if (!entry) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
if (!( this._profileRegistrations.has(address))) {
|
|
59
|
-
this._usedHosts.add(address);
|
|
60
|
-
this._reconcile();
|
|
61
|
-
}
|
|
62
|
-
return this._profiles.get().find(p => p.address === address);
|
|
63
|
-
}
|
|
64
|
-
setDefaultCwd(cwd) {
|
|
65
|
-
this._defaultCwd = cwd;
|
|
66
|
-
}
|
|
67
|
-
_reconcile() {
|
|
68
|
-
const entries = this._entries;
|
|
69
|
-
const desiredProfiles = ( new Map());
|
|
70
|
-
if (entries.length === 0)
|
|
71
|
-
; else if (entries.length === 1) {
|
|
72
|
-
desiredProfiles.set(entries[0].address, entries[0]);
|
|
73
|
-
} else {
|
|
74
|
-
let displaying = 0;
|
|
75
|
-
for (const address of this._usedHosts) {
|
|
76
|
-
const entry = entries.find(e => e.address === address);
|
|
77
|
-
if (entry) {
|
|
78
|
-
displaying++;
|
|
79
|
-
desiredProfiles.set(entry.address, entry);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (displaying === entries.length - 1) {
|
|
83
|
-
const missing = entries.find(e => !( this._usedHosts.has(e.address)));
|
|
84
|
-
if (missing) {
|
|
85
|
-
desiredProfiles.set(missing.address, missing);
|
|
86
|
-
}
|
|
87
|
-
} else if (displaying < entries.length) {
|
|
88
|
-
desiredProfiles.set("__quickpick__", {
|
|
89
|
-
name: ( localize(16804, "Agent Host…")),
|
|
90
|
-
address: "__quickpick__",
|
|
91
|
-
getConnection: () => undefined
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
for (const [key, entry] of desiredProfiles) {
|
|
96
|
-
if (!( this._profileRegistrations.has(key))) {
|
|
97
|
-
this._registerProfile(key, entry, entries);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
for (const key of ( this._profileRegistrations.keys())) {
|
|
101
|
-
if (!( desiredProfiles.has(key))) {
|
|
102
|
-
this._profileRegistrations.deleteAndDispose(key);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
const infos = [];
|
|
106
|
-
for (const [key] of desiredProfiles) {
|
|
107
|
-
infos.push({
|
|
108
|
-
extensionIdentifier: AGENT_HOST_PROFILE_EXT_ID,
|
|
109
|
-
profileId: key,
|
|
110
|
-
title: key === "__quickpick__" ? ( localize(16804, "Agent Host…")) : ( localize(16805, "Agent Host ({0})", desiredProfiles.get(key).name)),
|
|
111
|
-
address: key
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
transaction(tx => {
|
|
115
|
-
this._profiles.set(infos, tx);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
_registerProfile(key, entry, allEntries) {
|
|
119
|
-
const provider = {
|
|
120
|
-
createContributedTerminalProfile: async options => {
|
|
121
|
-
let connection;
|
|
122
|
-
let displayName = entry.name;
|
|
123
|
-
if (key === "__quickpick__") {
|
|
124
|
-
const picks = ( allEntries.map(e => ({
|
|
125
|
-
label: ( localize(16805, "Agent Host ({0})", e.name)),
|
|
126
|
-
address: e.address,
|
|
127
|
-
hostName: e.name
|
|
128
|
-
})));
|
|
129
|
-
const pick = await this._quickInputService.pick(picks, {
|
|
130
|
-
placeHolder: ( localize(16806, "Select an agent host to open a terminal on"))
|
|
131
|
-
});
|
|
132
|
-
if (!pick) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
this._usedHosts.add(pick.address);
|
|
136
|
-
this._reconcile();
|
|
137
|
-
displayName = pick.hostName;
|
|
138
|
-
connection = allEntries.find(e => e.address === pick.address)?.getConnection();
|
|
139
|
-
} else {
|
|
140
|
-
connection = entry.getConnection();
|
|
141
|
-
}
|
|
142
|
-
if (!connection) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
await this.createTerminal(connection, {
|
|
146
|
-
name: ( localize(16805, "Agent Host ({0})", displayName)),
|
|
147
|
-
cwd: options.cwd ? (typeof options.cwd === "string" ? URI.file(options.cwd) : options.cwd) : this._defaultCwd,
|
|
148
|
-
location: options.location
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
const title = key === "__quickpick__" ? ( localize(16804, "Agent Host…")) : ( localize(16805, "Agent Host ({0})", entry.name));
|
|
153
|
-
const store = ( new DisposableStore());
|
|
154
|
-
store.add(
|
|
155
|
-
this._terminalProfileService.registerTerminalProfileProvider(AGENT_HOST_PROFILE_EXT_ID, key, provider)
|
|
156
|
-
);
|
|
157
|
-
store.add(this._terminalProfileService.registerInternalContributedProfile({
|
|
158
|
-
extensionIdentifier: AGENT_HOST_PROFILE_EXT_ID,
|
|
159
|
-
id: key,
|
|
160
|
-
title,
|
|
161
|
-
icon: "remote"
|
|
162
|
-
}));
|
|
163
|
-
this._profileRegistrations.set(key, store);
|
|
164
|
-
}
|
|
165
|
-
async createTerminalForEntry(address, options) {
|
|
166
|
-
const entry = this._entries.find(e => e.address === address);
|
|
167
|
-
if (!entry) {
|
|
168
|
-
return undefined;
|
|
169
|
-
}
|
|
170
|
-
const connection = entry.getConnection();
|
|
171
|
-
if (!connection) {
|
|
172
|
-
return undefined;
|
|
173
|
-
}
|
|
174
|
-
return this.createTerminal(connection, options);
|
|
175
|
-
}
|
|
176
|
-
async createTerminal(connection, options) {
|
|
177
|
-
const terminalUri = ( URI.from({
|
|
178
|
-
scheme: "agenthost-terminal",
|
|
179
|
-
path: `/${generateUuid()}`
|
|
180
|
-
}));
|
|
181
|
-
const name = options?.name ?? ( localize(16807, "Agent Host Terminal"));
|
|
182
|
-
const key = ( terminalUri.toString());
|
|
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
|
|
204
|
-
},
|
|
205
|
-
location: options?.location
|
|
206
|
-
});
|
|
207
|
-
} catch (error) {
|
|
208
|
-
ptyRegistration.dispose();
|
|
209
|
-
throw error;
|
|
210
|
-
}
|
|
211
|
-
this._registerInstancePtyCleanup(instance, key, ptyRegistration);
|
|
212
|
-
return instance;
|
|
213
|
-
}
|
|
214
|
-
async reviveTerminal(connection, terminalUri, terminalToolSessionId) {
|
|
215
|
-
const key = ( terminalUri.toString());
|
|
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)
|
|
233
|
-
);
|
|
234
|
-
return store;
|
|
235
|
-
}
|
|
236
|
-
async _doReviveTerminal(connection, terminalUri, terminalToolSessionId, key) {
|
|
237
|
-
const existing = this._revivedInstances.get(key);
|
|
238
|
-
if (existing) {
|
|
239
|
-
return existing;
|
|
240
|
-
}
|
|
241
|
-
const store = ( new DisposableStore());
|
|
242
|
-
const commandSource = store.add(( new AhpTerminalCommandSource()));
|
|
243
|
-
const ptyRegistration = this._createPtyRegistration(key, connection.clientId);
|
|
244
|
-
const instancePromise = Promise.resolve().then(() => this._terminalService.createTerminal({
|
|
245
|
-
config: {
|
|
246
|
-
customPtyImplementation: (id, cols, rows) => {
|
|
247
|
-
const pty = ( new AgentHostPty(id, connection, terminalUri, {
|
|
248
|
-
attachOnly: true
|
|
249
|
-
}, this._logService));
|
|
250
|
-
if (cols > 0 && rows > 0) {
|
|
251
|
-
pty.resize(cols, rows);
|
|
252
|
-
}
|
|
253
|
-
if (!store.isDisposed) {
|
|
254
|
-
commandSource.connect(instance, pty);
|
|
255
|
-
}
|
|
256
|
-
ptyRegistration.setPty(pty);
|
|
257
|
-
return pty;
|
|
258
|
-
},
|
|
259
|
-
name: ( localize(16808, "Agent Host Terminal")),
|
|
260
|
-
isFeatureTerminal: true,
|
|
261
|
-
hideFromUser: true
|
|
262
|
-
}
|
|
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
|
-
}
|
|
275
|
-
this._terminalChatService.registerTerminalInstanceWithToolSession(terminalToolSessionId, instance);
|
|
276
|
-
this._revivedInstances.set(key, instance);
|
|
277
|
-
instance.store.add(store);
|
|
278
|
-
this._registerInstancePtyCleanup(instance, key, ptyRegistration);
|
|
279
|
-
return instance;
|
|
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
|
-
}
|
|
321
|
-
async reconnectTerminals(newConnection, oldClientId) {
|
|
322
|
-
const entries = [...this._activePtys.entries()].filter(([, entry]) => entry.clientId === oldClientId);
|
|
323
|
-
const total = entries.length;
|
|
324
|
-
let recovered = 0;
|
|
325
|
-
const promises = [];
|
|
326
|
-
for (const [key, entry] of entries) {
|
|
327
|
-
promises.push(entry.pty.reconnect(newConnection).then(success => {
|
|
328
|
-
if (success) {
|
|
329
|
-
recovered++;
|
|
330
|
-
entry.clientId = newConnection.clientId;
|
|
331
|
-
} else {
|
|
332
|
-
this._logService.warn(`[AgentHostTerminalService] Failed to reconnect terminal: ${key}`);
|
|
333
|
-
}
|
|
334
|
-
}));
|
|
335
|
-
}
|
|
336
|
-
await Promise.all(promises);
|
|
337
|
-
return {
|
|
338
|
-
recovered,
|
|
339
|
-
total
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
AgentHostTerminalService = ( __decorate([( __param(0, ITerminalService)), ( __param(1, ITerminalChatService)), ( __param(2, ITerminalProfileService)), ( __param(3, IQuickInputService)), ( __param(4, ITerminalLogService))], AgentHostTerminalService));
|
|
344
|
-
|
|
345
|
-
export { AgentHostTerminalService };
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
2
|
-
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
-
import type { IMarker } from "@xterm/xterm";
|
|
4
|
-
import { type ITerminalCommand, type IMarkProperties } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities";
|
|
5
|
-
import type { ITerminalOutputMatch, ITerminalOutputMatcher } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal";
|
|
6
|
-
import type { IAhpTerminalCommandSource, ITerminalInstance } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal";
|
|
7
|
-
import { AhpCommandMarkKind, type AgentHostPty } from "./agentHostPty.js";
|
|
8
|
-
/**
|
|
9
|
-
* An implementation of {@link ITerminalCommand} backed by AHP protocol data
|
|
10
|
-
* rather than local shell integration markers. For streaming commands (arriving
|
|
11
|
-
* after initial subscription), real xterm markers are registered via
|
|
12
|
-
* {@link ITerminalInstance.registerMarker}. For replayed commands (from state
|
|
13
|
-
* snapshot), stored VT output is used as a fallback since marker positions are
|
|
14
|
-
* unreliable during bulk replay.
|
|
15
|
-
*/
|
|
16
|
-
export declare class AhpTerminalCommand implements ITerminalCommand {
|
|
17
|
-
command: string;
|
|
18
|
-
readonly commandLineConfidence: "low" | "medium" | "high";
|
|
19
|
-
readonly isTrusted: boolean;
|
|
20
|
-
timestamp: number;
|
|
21
|
-
duration: number;
|
|
22
|
-
readonly id: string;
|
|
23
|
-
readonly cwd: string | undefined;
|
|
24
|
-
exitCode: number | undefined;
|
|
25
|
-
readonly commandStartLineContent: string | undefined;
|
|
26
|
-
readonly markProperties: IMarkProperties | undefined;
|
|
27
|
-
readonly executedX: number | undefined;
|
|
28
|
-
readonly startX: number | undefined;
|
|
29
|
-
readonly promptStartMarker?: IMarker;
|
|
30
|
-
readonly marker?: IMarker;
|
|
31
|
-
readonly aliases?: string[][];
|
|
32
|
-
readonly wasReplayed?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Lazily resolved executed marker. Uses a getter so that the marker is
|
|
35
|
-
* resolved on first access rather than at construction time, giving xterm
|
|
36
|
-
* a chance to flush the SetMark sequence through its async write queue.
|
|
37
|
-
*/
|
|
38
|
-
get executedMarker(): IMarker | undefined;
|
|
39
|
-
private _executedMarker;
|
|
40
|
-
/**
|
|
41
|
-
* Lazily resolved end marker, same rationale as {@link executedMarker}.
|
|
42
|
-
*/
|
|
43
|
-
get endMarker(): IMarker | undefined;
|
|
44
|
-
set endMarker(value: IMarker | undefined);
|
|
45
|
-
private _endMarker;
|
|
46
|
-
private _isComplete;
|
|
47
|
-
/**
|
|
48
|
-
* Stored VT output from the AHP content part. Used as a fallback when
|
|
49
|
-
* xterm markers are not available (e.g. during content replay).
|
|
50
|
-
*/
|
|
51
|
-
private _storedOutput;
|
|
52
|
-
/**
|
|
53
|
-
* Optional function to lazily resolve markers from the terminal's
|
|
54
|
-
* {@link IBufferMarkCapability}. Set during construction.
|
|
55
|
-
*/
|
|
56
|
-
private readonly _resolveMarker?;
|
|
57
|
-
constructor(commandId: string, commandLine: string, timestamp: number, options?: {
|
|
58
|
-
resolveMarker?: (kind: AhpCommandMarkKind) => IMarker | undefined;
|
|
59
|
-
storedOutput?: string;
|
|
60
|
-
wasReplayed?: boolean;
|
|
61
|
-
});
|
|
62
|
-
extractCommandLine(): string;
|
|
63
|
-
getOutput(): string | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* Get the raw VT output (with ANSI escape codes preserved).
|
|
66
|
-
* Used by the terminal mirror for rendering.
|
|
67
|
-
*/
|
|
68
|
-
getRawOutput(): string | undefined;
|
|
69
|
-
hasOutput(): boolean;
|
|
70
|
-
getOutputMatch(_outputMatcher: ITerminalOutputMatcher): ITerminalOutputMatch | undefined;
|
|
71
|
-
getPromptRowCount(): number;
|
|
72
|
-
getCommandRowCount(): number;
|
|
73
|
-
/**
|
|
74
|
-
* Append VT output to the stored output buffer. Called during streaming
|
|
75
|
-
* as `terminal/data` actions arrive.
|
|
76
|
-
*/
|
|
77
|
-
appendOutput(data: string): void;
|
|
78
|
-
/**
|
|
79
|
-
* Mark this command as finished with the given exit code and duration.
|
|
80
|
-
*/
|
|
81
|
-
finish(exitCode: number | undefined, durationMs: number | undefined): void;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* A command detection source for AHP terminals. Listens to
|
|
85
|
-
* {@link AgentHostPty} command lifecycle events and maintains a list of
|
|
86
|
-
* {@link AhpTerminalCommand} objects, exposing an interface compatible with
|
|
87
|
-
* {@link IAhpTerminalCommandSource}.
|
|
88
|
-
*/
|
|
89
|
-
export declare class AhpTerminalCommandSource extends Disposable implements IAhpTerminalCommandSource {
|
|
90
|
-
private readonly _commands;
|
|
91
|
-
private _executingCommand;
|
|
92
|
-
private readonly _onCommandExecuted;
|
|
93
|
-
readonly onCommandExecuted: Event<ITerminalCommand>;
|
|
94
|
-
private readonly _onCommandFinished;
|
|
95
|
-
readonly onCommandFinished: Event<ITerminalCommand>;
|
|
96
|
-
private _terminalInstance;
|
|
97
|
-
get commands(): readonly ITerminalCommand[];
|
|
98
|
-
get executingCommandObject(): ITerminalCommand | undefined;
|
|
99
|
-
connect(terminalInstance: ITerminalInstance, pty: AgentHostPty): void;
|
|
100
|
-
getCommandById(id: string): ITerminalCommand | undefined;
|
|
101
|
-
/**
|
|
102
|
-
* Resolves an xterm marker by its AHP command mark ID from the
|
|
103
|
-
* {@link IBufferMarkCapability}. The marker is placed by xterm's OSC 633
|
|
104
|
-
* parser when it processes the SetMark sequence injected by
|
|
105
|
-
* {@link AgentHostPty}, so it is always at the correct cursor position
|
|
106
|
-
* regardless of whether the data was replayed or streamed.
|
|
107
|
-
*/
|
|
108
|
-
private _resolveMarkById;
|
|
109
|
-
private _handleCommandExecuted;
|
|
110
|
-
private _handleCommandFinished;
|
|
111
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
3
|
-
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import { removeAnsiEscapeCodes } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
5
|
-
import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
|
|
6
|
-
import { AhpCommandMarkKind, getAhpCommandMarkId } from './agentHostPty.js';
|
|
7
|
-
|
|
8
|
-
class AhpTerminalCommand {
|
|
9
|
-
get executedMarker() {
|
|
10
|
-
if (this._executedMarker === undefined && this._resolveMarker) {
|
|
11
|
-
this._executedMarker = this._resolveMarker(AhpCommandMarkKind.Executed);
|
|
12
|
-
}
|
|
13
|
-
return this._executedMarker;
|
|
14
|
-
}
|
|
15
|
-
get endMarker() {
|
|
16
|
-
if (this._endMarker === undefined && this._isComplete && this._resolveMarker) {
|
|
17
|
-
this._endMarker = this._resolveMarker(AhpCommandMarkKind.End);
|
|
18
|
-
}
|
|
19
|
-
return this._endMarker;
|
|
20
|
-
}
|
|
21
|
-
set endMarker(value) {
|
|
22
|
-
this._endMarker = value;
|
|
23
|
-
}
|
|
24
|
-
constructor(commandId, commandLine, timestamp, options) {
|
|
25
|
-
this.commandLineConfidence = "high";
|
|
26
|
-
this.isTrusted = false;
|
|
27
|
-
this.duration = 0;
|
|
28
|
-
this.cwd = undefined;
|
|
29
|
-
this.exitCode = undefined;
|
|
30
|
-
this.commandStartLineContent = undefined;
|
|
31
|
-
this.markProperties = undefined;
|
|
32
|
-
this.executedX = undefined;
|
|
33
|
-
this.startX = undefined;
|
|
34
|
-
this._isComplete = false;
|
|
35
|
-
this.id = commandId;
|
|
36
|
-
this.command = commandLine;
|
|
37
|
-
this.timestamp = timestamp;
|
|
38
|
-
this._resolveMarker = options?.resolveMarker;
|
|
39
|
-
this._storedOutput = options?.storedOutput;
|
|
40
|
-
this.wasReplayed = options?.wasReplayed;
|
|
41
|
-
}
|
|
42
|
-
extractCommandLine() {
|
|
43
|
-
return this.command;
|
|
44
|
-
}
|
|
45
|
-
getOutput() {
|
|
46
|
-
return this._storedOutput !== undefined ? removeAnsiEscapeCodes(this._storedOutput) : undefined;
|
|
47
|
-
}
|
|
48
|
-
getRawOutput() {
|
|
49
|
-
return this._storedOutput;
|
|
50
|
-
}
|
|
51
|
-
hasOutput() {
|
|
52
|
-
if (this._storedOutput !== undefined) {
|
|
53
|
-
return this._storedOutput.length > 0;
|
|
54
|
-
}
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
getOutputMatch(_outputMatcher) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
getPromptRowCount() {
|
|
61
|
-
return 1;
|
|
62
|
-
}
|
|
63
|
-
getCommandRowCount() {
|
|
64
|
-
return 1;
|
|
65
|
-
}
|
|
66
|
-
appendOutput(data) {
|
|
67
|
-
if (this._storedOutput === undefined) {
|
|
68
|
-
this._storedOutput = data;
|
|
69
|
-
} else {
|
|
70
|
-
this._storedOutput += data;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
finish(exitCode, durationMs) {
|
|
74
|
-
this.exitCode = exitCode;
|
|
75
|
-
this.duration = durationMs ?? 0;
|
|
76
|
-
this._isComplete = true;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
class AhpTerminalCommandSource extends Disposable {
|
|
80
|
-
constructor() {
|
|
81
|
-
super(...arguments);
|
|
82
|
-
this._commands = [];
|
|
83
|
-
this._onCommandExecuted = this._register(( new Emitter()));
|
|
84
|
-
this.onCommandExecuted = this._onCommandExecuted.event;
|
|
85
|
-
this._onCommandFinished = this._register(( new Emitter()));
|
|
86
|
-
this.onCommandFinished = this._onCommandFinished.event;
|
|
87
|
-
}
|
|
88
|
-
get commands() {
|
|
89
|
-
return this._commands;
|
|
90
|
-
}
|
|
91
|
-
get executingCommandObject() {
|
|
92
|
-
return this._executingCommand;
|
|
93
|
-
}
|
|
94
|
-
connect(terminalInstance, pty) {
|
|
95
|
-
this._terminalInstance = terminalInstance;
|
|
96
|
-
this._register(pty.onCommandExecuted(e => this._handleCommandExecuted(e)));
|
|
97
|
-
this._register(pty.onCommandFinished(e => this._handleCommandFinished(e)));
|
|
98
|
-
this._register(terminalInstance.onWillData(data => {
|
|
99
|
-
if (this._executingCommand && !this._executingCommand.wasReplayed) {
|
|
100
|
-
this._executingCommand.appendOutput(data);
|
|
101
|
-
}
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
104
|
-
getCommandById(id) {
|
|
105
|
-
if (this._executingCommand?.id === id) {
|
|
106
|
-
return this._executingCommand;
|
|
107
|
-
}
|
|
108
|
-
return this._commands.find(c => c.id === id);
|
|
109
|
-
}
|
|
110
|
-
_resolveMarkById(commandId, kind) {
|
|
111
|
-
const markId = getAhpCommandMarkId(commandId, kind);
|
|
112
|
-
const bufferMarkCapability = this._terminalInstance?.capabilities.get(TerminalCapability.BufferMarkDetection);
|
|
113
|
-
return bufferMarkCapability?.getMark(markId);
|
|
114
|
-
}
|
|
115
|
-
_handleCommandExecuted(event) {
|
|
116
|
-
const command = ( new AhpTerminalCommand(event.commandId, event.commandLine, event.timestamp, {
|
|
117
|
-
resolveMarker: kind => this._resolveMarkById(event.commandId, kind),
|
|
118
|
-
storedOutput: event.storedOutput,
|
|
119
|
-
wasReplayed: event.storedOutput !== undefined
|
|
120
|
-
}));
|
|
121
|
-
this._executingCommand = command;
|
|
122
|
-
this._onCommandExecuted.fire(command);
|
|
123
|
-
}
|
|
124
|
-
_handleCommandFinished(event) {
|
|
125
|
-
const command = this._executingCommand?.id === event.commandId ? this._executingCommand : this._commands.find(c => c.id === event.commandId);
|
|
126
|
-
if (!command) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
command.finish(event.exitCode, event.durationMs);
|
|
130
|
-
if (this._executingCommand === command) {
|
|
131
|
-
this._executingCommand = undefined;
|
|
132
|
-
this._commands.push(command);
|
|
133
|
-
}
|
|
134
|
-
this._onCommandFinished.fire(command);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export { AhpTerminalCommand, AhpTerminalCommandSource };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { IEnvironmentVariableInfo } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/environmentVariable";
|
|
2
|
-
import { ITerminalStatus } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal";
|
|
3
|
-
import { ITerminalService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service";
|
|
4
|
-
import { EnvironmentVariableScope, IMergedEnvironmentVariableCollection, IMergedEnvironmentVariableCollectionDiff } from "../../../../platform/terminal/common/environmentVariable.js";
|
|
5
|
-
import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
|
|
6
|
-
import { IExtensionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service";
|
|
7
|
-
export declare class EnvironmentVariableInfoStale implements IEnvironmentVariableInfo {
|
|
8
|
-
private readonly _diff;
|
|
9
|
-
private readonly _terminalId;
|
|
10
|
-
private readonly _collection;
|
|
11
|
-
private readonly _terminalService;
|
|
12
|
-
private readonly _extensionService;
|
|
13
|
-
readonly requiresAction = true;
|
|
14
|
-
constructor(_diff: IMergedEnvironmentVariableCollectionDiff, _terminalId: number, _collection: IMergedEnvironmentVariableCollection, _terminalService: ITerminalService, _extensionService: IExtensionService);
|
|
15
|
-
private _getInfo;
|
|
16
|
-
private _getActions;
|
|
17
|
-
getStatus(scope: EnvironmentVariableScope | undefined): ITerminalStatus;
|
|
18
|
-
}
|
|
19
|
-
export declare class EnvironmentVariableInfoChangesActive implements IEnvironmentVariableInfo {
|
|
20
|
-
private readonly _collection;
|
|
21
|
-
private readonly _commandService;
|
|
22
|
-
private readonly _extensionService;
|
|
23
|
-
readonly requiresAction = false;
|
|
24
|
-
constructor(_collection: IMergedEnvironmentVariableCollection, _commandService: ICommandService, _extensionService: IExtensionService);
|
|
25
|
-
private _getInfo;
|
|
26
|
-
private _getActions;
|
|
27
|
-
getStatus(scope: EnvironmentVariableScope | undefined): ITerminalStatus;
|
|
28
|
-
}
|