@codingame/monaco-vscode-xterm-common 30.0.0 → 31.0.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.
Files changed (30) hide show
  1. package/package.json +4 -4
  2. package/vscode/src/vs/platform/agentHost/common/state/protocol/actions.d.ts +990 -0
  3. package/vscode/src/vs/platform/agentHost/common/state/protocol/actions.js +56 -0
  4. package/vscode/src/vs/platform/agentHost/common/state/protocol/notifications.d.ts +179 -0
  5. package/vscode/src/vs/platform/agentHost/common/state/protocol/notifications.js +16 -0
  6. package/vscode/src/vs/platform/agentHost/common/state/protocol/state.d.ts +1418 -0
  7. package/vscode/src/vs/platform/agentHost/common/state/protocol/state.js +118 -0
  8. package/vscode/src/vs/platform/agentHost/common/state/sessionState.d.ts +76 -0
  9. package/vscode/src/vs/platform/agentHost/common/state/sessionState.js +20 -0
  10. package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.d.ts +106 -0
  11. package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.js +276 -0
  12. package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.d.ts +56 -0
  13. package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.js +237 -0
  14. package/vscode/src/vs/workbench/contrib/terminal/browser/ahpTerminalCommandSource.d.ts +111 -0
  15. package/vscode/src/vs/workbench/contrib/terminal/browser/ahpTerminalCommandSource.js +138 -0
  16. package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +5 -5
  17. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +61 -61
  18. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +9 -2
  19. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +79 -40
  20. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +8 -4
  21. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +5 -5
  22. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +3 -3
  23. package/vscode/src/vs/workbench/contrib/terminal/common/basePty.d.ts +38 -0
  24. package/vscode/src/vs/workbench/contrib/terminal/common/basePty.js +127 -0
  25. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +3 -3
  26. package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +3 -3
  27. package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.d.ts +0 -38
  28. package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.js +0 -321
  29. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.d.ts +0 -59
  30. package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +0 -70
@@ -84,7 +84,7 @@ import { ProcessState, TERMINAL_VIEW_ID, TerminalCommandId, DEFAULT_COMMANDS_TO_
84
84
  import { ITerminalProfileResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal.service';
85
85
  import { TERMINAL_BACKGROUND_COLOR } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry';
86
86
  import { TerminalContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalContextKey';
87
- import { getShellIntegrationTimeout, preparePathForShell, getUriLabelForShell, getWorkspaceForTerminal } from '../common/terminalEnvironment.js';
87
+ import { getShellIntegrationTimeout, preparePathForShell, getUriLabelForShell, getWorkspaceForTerminal } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalEnvironment';
88
88
  import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
89
89
  import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
90
90
  import { IHistoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/history/common/history.service';
@@ -104,7 +104,7 @@ import { PromptInputState } from '@codingame/monaco-vscode-api/vscode/vs/platfor
104
104
  import { isString, hasKey, isNumber } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
105
105
  import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
106
106
 
107
- var TerminalInstance_1;
107
+ var TerminalInstance_1, TerminalLabelComputer_1;
108
108
  var Constants;
109
109
  (function(Constants) {
110
110
  Constants[Constants["WaitForContainerThreshold"] = 100] = "WaitForContainerThreshold";
@@ -119,6 +119,11 @@ const shellIntegrationSupportedShellTypes = [
119
119
  GeneralShellType.PowerShell,
120
120
  GeneralShellType.Python
121
121
  ];
122
+ const agentCliTitlePatterns = ( new Map([
123
+ [GeneralShellType.Claude, /claude\s*code/i],
124
+ [GeneralShellType.Copilot, /\bcopilot\b/i],
125
+ [GeneralShellType.Gemini, /\bgemini\b/i]
126
+ ]));
122
127
  let TerminalInstance = class TerminalInstance extends Disposable {
123
128
  static {
124
129
  TerminalInstance_1 = this;
@@ -770,13 +775,13 @@ let TerminalInstance = class TerminalInstance extends Disposable {
770
775
  }
771
776
  xtermConstructor = Promises.withAsyncBody(async resolve => {
772
777
  const Terminal = (await import('@xterm/xterm')).Terminal;
773
- Terminal.strings.promptLabel = ( localize(13415, "Terminal input"));
778
+ Terminal.strings.promptLabel = ( localize(13555, "Terminal input"));
774
779
  Terminal.strings.tooMuchOutput = keybinding ? ( localize(
775
- 13416,
780
+ 13556,
776
781
  "Use the accessible buffer {0} to manually review output",
777
782
  keybinding.getLabel()
778
783
  )) : ( localize(
779
- 13417,
784
+ 13557,
780
785
  "Use the Terminal: Focus Accessible Buffer command to manually review output"
781
786
  ));
782
787
  resolve(Terminal);
@@ -829,7 +834,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
829
834
  id: TerminalStatus.Bell,
830
835
  severity: Severity.Warning,
831
836
  icon: Codicon.bell,
832
- tooltip: ( localize(13418, "Bell"))
837
+ tooltip: ( localize(13558, "Bell"))
833
838
  }, this._terminalConfigurationService.config.bellDuration);
834
839
  }
835
840
  this._accessibilitySignalService.playSignal(AccessibilitySignal.terminalBell);
@@ -907,7 +912,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
907
912
  if (!instance.xterm) {
908
913
  return;
909
914
  }
910
- const cmdDetectionType = (instance.capabilities.get(TerminalCapability.CommandDetection)?.hasRichCommandDetection ? ( localize(13419, "Rich")) : ( instance.capabilities.has(TerminalCapability.CommandDetection)) ? ( localize(13420, "Basic")) : instance.usedShellIntegrationInjection ? ( localize(13421, "Injection failed to activate")) : ( localize(13422, "No")));
915
+ const cmdDetectionType = (instance.capabilities.get(TerminalCapability.CommandDetection)?.hasRichCommandDetection ? ( localize(13559, "Rich")) : ( instance.capabilities.has(TerminalCapability.CommandDetection)) ? ( localize(13560, "Basic")) : instance.usedShellIntegrationInjection ? ( localize(13561, "Injection failed to activate")) : ( localize(13562, "No")));
911
916
  const detailedAdditions = [];
912
917
  if (instance.shellType) {
913
918
  detailedAdditions.push(`Shell type: \`${instance.shellType}\``);
@@ -932,11 +937,17 @@ let TerminalInstance = class TerminalInstance extends Disposable {
932
937
  instance.statusList.add({
933
938
  id: TerminalStatus.ShellIntegrationInfo,
934
939
  severity: Severity.Info,
935
- tooltip: `${( localize(13423, "Shell integration"))}: ${cmdDetectionType}`,
936
- detailedTooltip: `${( localize(13423, "Shell integration"))}: ${cmdDetectionType}${detailedAdditionsString}`
940
+ tooltip: `${( localize(13563, "Shell integration"))}: ${cmdDetectionType}`,
941
+ detailedTooltip: `${( localize(13563, "Shell integration"))}: ${cmdDetectionType}${detailedAdditionsString}`
937
942
  });
938
943
  }
939
- async runCommand(commandLine, shouldExecute, commandId, forceBracketedPasteMode) {
944
+ async runCommand(
945
+ commandLine,
946
+ shouldExecute,
947
+ commandId,
948
+ forceBracketedPasteMode,
949
+ commandLineForMetadata
950
+ ) {
940
951
  let commandDetection = this.capabilities.get(TerminalCapability.CommandDetection);
941
952
  const siInjectionEnabled = this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled) === true;
942
953
  const timeoutMs = getShellIntegrationTimeout(
@@ -962,8 +973,9 @@ let TerminalInstance = class TerminalInstance extends Disposable {
962
973
  store.dispose();
963
974
  }
964
975
  if (commandId && commandDetection) {
965
- this.xterm?.shellIntegration.setNextCommandId(commandLine, commandId);
966
- await this._processManager.setNextCommandId(commandLine, commandId);
976
+ const commandLineToReport = commandLineForMetadata ?? commandLine;
977
+ this.xterm?.shellIntegration.setNextCommandId(commandLineToReport, commandId);
978
+ await this._processManager.setNextCommandId(commandLineToReport, commandId);
967
979
  }
968
980
  if (shouldExecute && (!commandDetection || commandDetection.promptInputModel.value.length > 0)) {
969
981
  await this.sendText("\u0003", false);
@@ -1367,7 +1379,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
1367
1379
  this._setResolvedShellLaunchConfig(value);
1368
1380
  break;
1369
1381
  case ProcessPropertyType.ShellType:
1370
- this.setShellType(value);
1382
+ this._handleShellTypeChange(value);
1371
1383
  break;
1372
1384
  case ProcessPropertyType.HasChildProcesses:
1373
1385
  this._onDidChangeHasChildProcesses.fire(value);
@@ -1395,7 +1407,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
1395
1407
  id: TerminalStatus.Disconnected,
1396
1408
  severity: Severity.Error,
1397
1409
  icon: Codicon.debugDisconnect,
1398
- tooltip: ( localize(13424, "Lost connection to process"))
1410
+ tooltip: ( localize(13564, "Lost connection to process"))
1399
1411
  });
1400
1412
  }));
1401
1413
  this._register(processManager.onPtyReconnect(() => {
@@ -1413,12 +1425,12 @@ let TerminalInstance = class TerminalInstance extends Disposable {
1413
1425
  const trusted = await this._trust();
1414
1426
  if (!trusted && !this.remoteAuthority && !this._workbenchEnvironmentService.remoteAuthority) {
1415
1427
  this._onProcessExit({
1416
- message: ( localize(13425, "Cannot launch a terminal process in an untrusted workspace"))
1428
+ message: ( localize(13565, "Cannot launch a terminal process in an untrusted workspace"))
1417
1429
  });
1418
1430
  } else if (this._workspaceContextService.getWorkspace().folders.length === 0 && this._cwd && this._userHome && normalizeDriveLetter(this._cwd) !== normalizeDriveLetter(this._userHome)) {
1419
1431
  this._onProcessExit({
1420
1432
  message: ( localize(
1421
- 13426,
1433
+ 13566,
1422
1434
  "Cannot launch a terminal process in an empty workspace with cwd {0} different from userHome {1}",
1423
1435
  this._cwd,
1424
1436
  this._userHome
@@ -1588,10 +1600,10 @@ let TerminalInstance = class TerminalInstance extends Disposable {
1588
1600
  id: TerminalStatus.ShellIntegrationAttentionNeeded,
1589
1601
  severity: Severity.Warning,
1590
1602
  icon: Codicon.warning,
1591
- tooltip: `${exitMessage} ` + ( localize(13427, "Disabling shell integration in user settings might help.")),
1603
+ tooltip: `${exitMessage} ` + ( localize(13567, "Disabling shell integration in user settings might help.")),
1592
1604
  hoverActions: [{
1593
1605
  commandId: TerminalCommandId.ShellIntegrationLearnMore,
1594
- label: ( localize(13428, "Learn more about shell integration")),
1606
+ label: ( localize(13568, "Learn more about shell integration")),
1595
1607
  run: () => {
1596
1608
  this._openerService.open(
1597
1609
  "https://code.visualstudio.com/docs/editor/integrated-terminal#_shell-integration"
@@ -1599,7 +1611,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
1599
1611
  }
1600
1612
  }, {
1601
1613
  commandId: "workbench.action.openSettings",
1602
- label: ( localize(13429, "Open user settings")),
1614
+ label: ( localize(13569, "Open user settings")),
1603
1615
  run: () => {
1604
1616
  this._commandService.executeCommand(
1605
1617
  "workbench.action.openSettings",
@@ -1677,6 +1689,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
1677
1689
  shell.initialText = " ";
1678
1690
  }
1679
1691
  this._shellLaunchConfig = shell;
1692
+ this._agentShellTypeFromSequence = undefined;
1680
1693
  await this._processManager.relaunch(
1681
1694
  this._shellLaunchConfig,
1682
1695
  this._cols || Constants.DefaultCols,
@@ -1707,6 +1720,22 @@ let TerminalInstance = class TerminalInstance extends Disposable {
1707
1720
  if (this.isTitleSetByProcess) {
1708
1721
  this._setTitle(title, TitleEventSource.Sequence);
1709
1722
  }
1723
+ for (const [shellType, pattern] of agentCliTitlePatterns) {
1724
+ if (pattern.test(title)) {
1725
+ this._agentShellTypeFromSequence = shellType;
1726
+ this.setShellType(shellType);
1727
+ break;
1728
+ }
1729
+ }
1730
+ }
1731
+ _handleShellTypeChange(shellType) {
1732
+ if (this._agentShellTypeFromSequence) {
1733
+ if (shellType === GeneralShellType.Node || shellType === undefined) {
1734
+ return;
1735
+ }
1736
+ this._agentShellTypeFromSequence = undefined;
1737
+ }
1738
+ this.setShellType(shellType);
1710
1739
  }
1711
1740
  async _trust() {
1712
1741
  if (this._configurationService.getValue(TerminalSettingId.AllowInUntrustedWorkspace)) {
@@ -1716,7 +1745,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
1716
1745
  return true;
1717
1746
  }
1718
1747
  const trustRequest = await this._workspaceTrustRequestService.requestWorkspaceTrust({
1719
- message: ( localize(13430, "Creating a terminal process requires executing code"))
1748
+ message: ( localize(13570, "Creating a terminal process requires executing code"))
1720
1749
  });
1721
1750
  return trustRequest === true;
1722
1751
  }
@@ -1842,26 +1871,27 @@ let TerminalInstance = class TerminalInstance extends Disposable {
1842
1871
  this._terminalShellTypeContextKey.set(shellType?.toString());
1843
1872
  }
1844
1873
  this._onDidChangeShellType.fire(shellType);
1874
+ this._labelComputer?.refreshLabel(this);
1845
1875
  }
1846
1876
  _setAriaLabel(xterm, terminalId, title) {
1847
1877
  const labelParts = [];
1848
1878
  if (xterm && xterm.textarea) {
1849
1879
  if (title && title.length > 0) {
1850
- labelParts.push(( localize(13431, "Terminal {0}, {1}", terminalId, title)));
1880
+ labelParts.push(( localize(13571, "Terminal {0}, {1}", terminalId, title)));
1851
1881
  } else {
1852
- labelParts.push(( localize(13432, "Terminal {0}", terminalId)));
1882
+ labelParts.push(( localize(13572, "Terminal {0}", terminalId)));
1853
1883
  }
1854
1884
  const screenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();
1855
1885
  if (!screenReaderOptimized) {
1856
1886
  labelParts.push(( localize(
1857
- 13433,
1887
+ 13573,
1858
1888
  "Run the command: Toggle Screen Reader Accessibility Mode for an optimized screen reader experience"
1859
1889
  )));
1860
1890
  }
1861
1891
  const accessibilityHelpKeybinding = this._keybindingService.lookupKeybinding(AccessibilityCommandId.OpenAccessibilityHelp)?.getLabel();
1862
1892
  if (this._configurationService.getValue(AccessibilityVerbositySettingId.Terminal) && accessibilityHelpKeybinding) {
1863
1893
  labelParts.push(( localize(
1864
- 13434,
1894
+ 13574,
1865
1895
  "Use {0} for terminal accessibility help",
1866
1896
  accessibilityHelpKeybinding
1867
1897
  )));
@@ -1915,7 +1945,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
1915
1945
  }
1916
1946
  async setFixedDimensions() {
1917
1947
  const cols = await this._quickInputService.input({
1918
- title: ( localize(13435, "Set Fixed Dimensions: Column")),
1948
+ title: ( localize(13575, "Set Fixed Dimensions: Column")),
1919
1949
  placeHolder: "Enter a number of columns or leave empty for automatic width",
1920
1950
  validateInput: async text => text.length > 0 && !text.match(/^\d+$/) ? {
1921
1951
  content: "Enter a number or leave empty size automatically",
@@ -1929,7 +1959,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
1929
1959
  this._labelComputer?.refreshLabel(this);
1930
1960
  this._terminalHasFixedWidth.set(!!this._fixedCols);
1931
1961
  const rows = await this._quickInputService.input({
1932
- title: ( localize(13436, "Set Fixed Dimensions: Row")),
1962
+ title: ( localize(13576, "Set Fixed Dimensions: Row")),
1933
1963
  placeHolder: "Enter a number of rows or leave empty for automatic height",
1934
1964
  validateInput: async text => text.length > 0 && !text.match(/^\d+$/) ? {
1935
1965
  content: "Enter a number or leave empty size automatically",
@@ -2039,7 +2069,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
2039
2069
  _onEnvironmentVariableInfoChanged(info) {
2040
2070
  if (info.requiresAction) {
2041
2071
  this.xterm?.raw.textarea?.setAttribute("aria-label", ( localize(
2042
- 13437,
2072
+ 13577,
2043
2073
  "Terminal {0} environment is stale, run the 'Show Environment Information' command for more information",
2044
2074
  this._instanceId
2045
2075
  )));
@@ -2195,7 +2225,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
2195
2225
  disposables.push(quickPick);
2196
2226
  quickPick.items = items;
2197
2227
  quickPick.matchOnDescription = true;
2198
- quickPick.placeholder = ( localize(13438, "Select a color for the terminal"));
2228
+ quickPick.placeholder = ( localize(13578, "Select a color for the terminal"));
2199
2229
  quickPick.show();
2200
2230
  const result = await ( new Promise(r => {
2201
2231
  disposables.push(quickPick.onDidHide(() => r(undefined)));
@@ -2391,12 +2421,23 @@ var TerminalLabelType;
2391
2421
  TerminalLabelType["Description"] = "description";
2392
2422
  })(TerminalLabelType || (TerminalLabelType = {}));
2393
2423
  let TerminalLabelComputer = class TerminalLabelComputer extends Disposable {
2424
+ static {
2425
+ TerminalLabelComputer_1 = this;
2426
+ }
2394
2427
  get title() {
2395
2428
  return this._title;
2396
2429
  }
2397
2430
  get description() {
2398
2431
  return this._description;
2399
2432
  }
2433
+ static {
2434
+ this.agentCliShellTypes = ( new Set([
2435
+ GeneralShellType.Claude,
2436
+ GeneralShellType.Codex,
2437
+ GeneralShellType.Copilot,
2438
+ GeneralShellType.Gemini
2439
+ ]));
2440
+ }
2400
2441
  constructor(_fileService, _terminalConfigurationService, _workspaceContextService) {
2401
2442
  super();
2402
2443
  this._fileService = _fileService;
@@ -2408,13 +2449,11 @@ let TerminalLabelComputer = class TerminalLabelComputer extends Disposable {
2408
2449
  this.onDidChangeLabel = this._onDidChangeLabel.event;
2409
2450
  }
2410
2451
  refreshLabel(instance, reset) {
2411
- const titleTemplate = instance.shellLaunchConfig.titleTemplate ?? this._terminalConfigurationService.config.tabs.title;
2452
+ const tabs = this._terminalConfigurationService.config.tabs;
2453
+ const useAgentCliTitle = tabs.allowAgentCliTitle && ( TerminalLabelComputer_1.agentCliShellTypes.has(instance.shellType));
2454
+ const titleTemplate = instance.shellLaunchConfig.titleTemplate ?? (useAgentCliTitle ? "${sequence}" : tabs.title);
2412
2455
  this._title = this.computeLabel(instance, titleTemplate, TerminalLabelType.Title, reset);
2413
- this._description = this.computeLabel(
2414
- instance,
2415
- this._terminalConfigurationService.config.tabs.description,
2416
- TerminalLabelType.Description
2417
- );
2456
+ this._description = this.computeLabel(instance, tabs.description, TerminalLabelType.Description);
2418
2457
  if (this._title !== instance.title || this._description !== instance.description || reset) {
2419
2458
  this._onDidChangeLabel.fire({
2420
2459
  title: this._title,
@@ -2498,7 +2537,7 @@ let TerminalLabelComputer = class TerminalLabelComputer extends Disposable {
2498
2537
  }
2499
2538
  }
2500
2539
  };
2501
- TerminalLabelComputer = ( __decorate([( __param(0, IFileService)), ( __param(1, ITerminalConfigurationService)), ( __param(2, IWorkspaceContextService))], TerminalLabelComputer));
2540
+ TerminalLabelComputer = TerminalLabelComputer_1 = ( __decorate([( __param(0, IFileService)), ( __param(1, ITerminalConfigurationService)), ( __param(2, IWorkspaceContextService))], TerminalLabelComputer));
2502
2541
  function parseExitResult(exitCodeOrError, shellLaunchConfig, processState, initialCwd) {
2503
2542
  if (exitCodeOrError === undefined || exitCodeOrError === 0) {
2504
2543
  return {
@@ -2523,24 +2562,24 @@ function parseExitResult(exitCodeOrError, shellLaunchConfig, processState, initi
2523
2562
  if (processState === ProcessState.KilledDuringLaunch) {
2524
2563
  if (commandLine) {
2525
2564
  message = ( localize(
2526
- 13439,
2565
+ 13579,
2527
2566
  "The terminal process \"{0}\" failed to launch (exit code: {1}).",
2528
2567
  commandLine,
2529
2568
  code
2530
2569
  ));
2531
2570
  } else {
2532
- message = ( localize(13440, "The terminal process failed to launch (exit code: {0}).", code));
2571
+ message = ( localize(13580, "The terminal process failed to launch (exit code: {0}).", code));
2533
2572
  }
2534
2573
  } else {
2535
2574
  if (commandLine) {
2536
2575
  message = ( localize(
2537
- 13441,
2576
+ 13581,
2538
2577
  "The terminal process \"{0}\" terminated with exit code: {1}.",
2539
2578
  commandLine,
2540
2579
  code
2541
2580
  ));
2542
2581
  } else {
2543
- message = ( localize(13442, "The terminal process terminated with exit code: {0}.", code));
2582
+ message = ( localize(13582, "The terminal process terminated with exit code: {0}.", code));
2544
2583
  }
2545
2584
  }
2546
2585
  break;
@@ -2566,7 +2605,7 @@ function parseExitResult(exitCodeOrError, shellLaunchConfig, processState, initi
2566
2605
  break;
2567
2606
  }
2568
2607
  }
2569
- message = ( localize(13443, "The terminal process failed to launch: {0}.", innerMessage));
2608
+ message = ( localize(13583, "The terminal process failed to launch: {0}.", innerMessage));
2570
2609
  break;
2571
2610
  }
2572
2611
  }
@@ -25,7 +25,7 @@ import { MergedEnvironmentVariableCollection } from '../../../../platform/termin
25
25
  import { serializeEnvironmentVariableCollections } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/environmentVariableShared';
26
26
  import { ProcessState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal';
27
27
  import { ITerminalProfileResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal.service';
28
- import { getWorkspaceForTerminal, mergeEnvironments, createVariableResolver, createTerminalEnvironment, getCwd } from '../common/terminalEnvironment.js';
28
+ import { getWorkspaceForTerminal, mergeEnvironments, createVariableResolver, createTerminalEnvironment, getCwd } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalEnvironment';
29
29
  import { IConfigurationResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolver.service';
30
30
  import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
31
31
  import { IHistoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/history/common/history.service';
@@ -202,7 +202,7 @@ let TerminalProcessManager = class TerminalProcessManager extends Disposable {
202
202
  } catch (e) {
203
203
  this._notificationService.notify({
204
204
  message: ( localize(
205
- 13474,
205
+ 13614,
206
206
  "Could not kill process listening on port {0}, command exited with error {1}",
207
207
  port,
208
208
  e
@@ -538,13 +538,17 @@ let TerminalProcessManager = class TerminalProcessManager extends Disposable {
538
538
  this._onExit(-1);
539
539
  } else {
540
540
  const message = ( localize(
541
- 13475,
541
+ 13615,
542
542
  "Restarting the terminal because the connection to the shell process was lost..."
543
543
  ));
544
+ let postRestartMessage = "";
545
+ if (this.os === OperatingSystem.Windows && this._dimensions.rows > 0) {
546
+ postRestartMessage = "\r\n".repeat(this._dimensions.rows - 1) + `\x1b[H`;
547
+ }
544
548
  this._onProcessData.fire({
545
549
  data: formatMessageForTerminal(message, {
546
550
  loudFormatting: true
547
- }),
551
+ }) + postRestartMessage,
548
552
  trackCommit: false
549
553
  });
550
554
  await this.relaunch(
@@ -435,7 +435,7 @@ let TerminalTabsRenderer = class TerminalTabsRenderer {
435
435
  };
436
436
  }
437
437
  },
438
- ariaLabel: ( localize(13502, "Type terminal name. Press Enter to confirm or Escape to cancel.")),
438
+ ariaLabel: ( localize(13642, "Type terminal name. Press Enter to confirm or Escape to cancel.")),
439
439
  inputBoxStyles: defaultInputBoxStyles
440
440
  }));
441
441
  inputBox.element.style.height = "22px";
@@ -566,7 +566,7 @@ let TerminalTabsAccessibilityProvider = class TerminalTabsAccessibilityProvider
566
566
  this._terminalGroupService = _terminalGroupService;
567
567
  }
568
568
  getWidgetAriaLabel() {
569
- return localize(13503, "Terminal tabs");
569
+ return localize(13643, "Terminal tabs");
570
570
  }
571
571
  getAriaLabel(instance) {
572
572
  let ariaLabel = "";
@@ -574,7 +574,7 @@ let TerminalTabsAccessibilityProvider = class TerminalTabsAccessibilityProvider
574
574
  if (tab && tab.terminalInstances?.length > 1) {
575
575
  const terminalIndex = tab.terminalInstances.indexOf(instance);
576
576
  ariaLabel = ( localize(
577
- 13504,
577
+ 13644,
578
578
  "Terminal {0} {1}, split {2} of {3}",
579
579
  instance.instanceId,
580
580
  instance.title,
@@ -582,7 +582,7 @@ let TerminalTabsAccessibilityProvider = class TerminalTabsAccessibilityProvider
582
582
  tab.terminalInstances.length
583
583
  ));
584
584
  } else {
585
- ariaLabel = ( localize(13505, "Terminal {0} {1}", instance.instanceId, instance.title));
585
+ ariaLabel = ( localize(13645, "Terminal {0} {1}", instance.instanceId, instance.title));
586
586
  }
587
587
  return ariaLabel;
588
588
  }
@@ -770,7 +770,7 @@ let TabDecorationsProvider = class TabDecorationsProvider extends Disposable {
770
770
  constructor(_terminalService) {
771
771
  super();
772
772
  this._terminalService = _terminalService;
773
- this.label = ( localize(13506, "Terminal"));
773
+ this.label = ( localize(13646, "Terminal"));
774
774
  this._onDidChange = this._register(( new Emitter()));
775
775
  this.onDidChange = this._onDidChange.event;
776
776
  this._register(
@@ -29,7 +29,7 @@ function getInstanceHoverInfo(instance, storageService) {
29
29
  }
30
30
  actions.push({
31
31
  commandId: "toggleDetailedInfo",
32
- label: showDetailed ? ( localize(13507, "Hide Details")) : ( localize(13508, "Show Details")),
32
+ label: showDetailed ? ( localize(13647, "Hide Details")) : ( localize(13648, "Show Details")),
33
33
  run() {
34
34
  storageService.store(
35
35
  TerminalStorageKeys.TabsShowDetailed,
@@ -51,7 +51,7 @@ function getInstanceHoverInfo(instance, storageService) {
51
51
  function getShellProcessTooltip(instance, showDetailed) {
52
52
  const lines = [];
53
53
  if (instance.processId && instance.processId > 0) {
54
- lines.push(( localize(13509, "Process ID ({0}): {1}", "PID", instance.processId)) + "\n");
54
+ lines.push(( localize(13649, "Process ID ({0}): {1}", "PID", instance.processId)) + "\n");
55
55
  }
56
56
  if (instance.shellLaunchConfig.executable) {
57
57
  let commandLine = "";
@@ -67,7 +67,7 @@ function getShellProcessTooltip(instance, showDetailed) {
67
67
  if (args) {
68
68
  commandLine += ` ${args}`;
69
69
  }
70
- lines.push(( localize(13510, "Command line: {0}", commandLine)));
70
+ lines.push(( localize(13650, "Command line: {0}", commandLine)));
71
71
  }
72
72
  return lines.length ? `\n\n---\n\n${lines.join("\n")}` : "";
73
73
  }
@@ -0,0 +1,38 @@
1
+ import { Emitter } 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 { IPtyHostProcessReplayEvent, ISerializedCommandDetectionCapability } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities";
4
+ import { ProcessPropertyType, type IProcessDataEvent, type IProcessProperty, type IProcessPropertyMap, type IProcessReadyEvent, type ITerminalChildProcess } from "@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal";
5
+ /**
6
+ * Responsible for establishing and maintaining a connection with an existing terminal process
7
+ * created on the local pty host.
8
+ */
9
+ export declare abstract class BasePty extends Disposable implements Partial<ITerminalChildProcess> {
10
+ readonly id: number;
11
+ readonly shouldPersist: boolean;
12
+ protected readonly _properties: IProcessPropertyMap;
13
+ protected readonly _lastDimensions: {
14
+ cols: number;
15
+ rows: number;
16
+ };
17
+ protected _inReplay: boolean;
18
+ protected readonly _onProcessData: Emitter<string | IProcessDataEvent>;
19
+ readonly onProcessData: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<string | IProcessDataEvent>;
20
+ protected readonly _onProcessReplayComplete: Emitter<void>;
21
+ readonly onProcessReplayComplete: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
22
+ protected readonly _onProcessReady: Emitter<IProcessReadyEvent>;
23
+ readonly onProcessReady: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<IProcessReadyEvent>;
24
+ protected readonly _onDidChangeProperty: Emitter<IProcessProperty<ProcessPropertyType>>;
25
+ readonly onDidChangeProperty: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<IProcessProperty<ProcessPropertyType>>;
26
+ protected readonly _onProcessExit: Emitter<number | undefined>;
27
+ readonly onProcessExit: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<number | undefined>;
28
+ protected readonly _onRestoreCommands: Emitter<ISerializedCommandDetectionCapability>;
29
+ readonly onRestoreCommands: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<ISerializedCommandDetectionCapability>;
30
+ constructor(id: number, shouldPersist: boolean);
31
+ getInitialCwd(): Promise<string>;
32
+ getCwd(): Promise<string>;
33
+ handleData(e: string | IProcessDataEvent): void;
34
+ handleExit(e: number | undefined): void;
35
+ handleReady(e: IProcessReadyEvent): void;
36
+ handleDidChangeProperty({ type, value }: IProcessProperty): void;
37
+ handleReplay(e: IPtyHostProcessReplayEvent): Promise<void>;
38
+ }
@@ -0,0 +1,127 @@
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 { mark } from '@codingame/monaco-vscode-api/vscode/vs/base/common/performance';
5
+ import { isString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
6
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
7
+ import { ProcessPropertyType } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal';
8
+
9
+ class BasePty extends Disposable {
10
+ constructor(id, shouldPersist) {
11
+ super();
12
+ this.id = id;
13
+ this.shouldPersist = shouldPersist;
14
+ this._properties = {
15
+ cwd: "",
16
+ initialCwd: "",
17
+ fixedDimensions: {
18
+ cols: undefined,
19
+ rows: undefined
20
+ },
21
+ title: "",
22
+ shellType: undefined,
23
+ hasChildProcesses: true,
24
+ resolvedShellLaunchConfig: {},
25
+ overrideDimensions: undefined,
26
+ failedShellIntegrationActivation: false,
27
+ usedShellIntegrationInjection: undefined,
28
+ shellIntegrationInjectionFailureReason: undefined
29
+ };
30
+ this._lastDimensions = {
31
+ cols: -1,
32
+ rows: -1
33
+ };
34
+ this._inReplay = false;
35
+ this._onProcessData = this._register(( new Emitter()));
36
+ this.onProcessData = this._onProcessData.event;
37
+ this._onProcessReplayComplete = this._register(( new Emitter()));
38
+ this.onProcessReplayComplete = this._onProcessReplayComplete.event;
39
+ this._onProcessReady = this._register(( new Emitter()));
40
+ this.onProcessReady = this._onProcessReady.event;
41
+ this._onDidChangeProperty = this._register(( new Emitter()));
42
+ this.onDidChangeProperty = this._onDidChangeProperty.event;
43
+ this._onProcessExit = this._register(( new Emitter()));
44
+ this.onProcessExit = this._onProcessExit.event;
45
+ this._onRestoreCommands = this._register(( new Emitter()));
46
+ this.onRestoreCommands = this._onRestoreCommands.event;
47
+ }
48
+ async getInitialCwd() {
49
+ return this._properties.initialCwd;
50
+ }
51
+ async getCwd() {
52
+ return this._properties.cwd || this._properties.initialCwd;
53
+ }
54
+ handleData(e) {
55
+ this._onProcessData.fire(e);
56
+ }
57
+ handleExit(e) {
58
+ this._onProcessExit.fire(e);
59
+ }
60
+ handleReady(e) {
61
+ this._onProcessReady.fire(e);
62
+ }
63
+ handleDidChangeProperty(
64
+ {
65
+ type,
66
+ value
67
+ }
68
+ ) {
69
+ switch (type) {
70
+ case ProcessPropertyType.Cwd:
71
+ this._properties.cwd = value;
72
+ break;
73
+ case ProcessPropertyType.InitialCwd:
74
+ this._properties.initialCwd = value;
75
+ break;
76
+ case ProcessPropertyType.ResolvedShellLaunchConfig:
77
+ {
78
+ const cast = value;
79
+ if (cast.cwd && !isString(cast.cwd)) {
80
+ cast.cwd = URI.revive(cast.cwd);
81
+ }
82
+ break;
83
+ }
84
+ }
85
+ this._onDidChangeProperty.fire({
86
+ type,
87
+ value
88
+ });
89
+ }
90
+ async handleReplay(e) {
91
+ mark(`code/terminal/willHandleReplay/${this.id}`);
92
+ try {
93
+ this._inReplay = true;
94
+ for (const innerEvent of e.events) {
95
+ if (innerEvent.cols !== 0 || innerEvent.rows !== 0) {
96
+ this._onDidChangeProperty.fire({
97
+ type: ProcessPropertyType.OverrideDimensions,
98
+ value: {
99
+ cols: innerEvent.cols,
100
+ rows: innerEvent.rows,
101
+ forceExactSize: true
102
+ }
103
+ });
104
+ }
105
+ const e = {
106
+ data: innerEvent.data,
107
+ trackCommit: true
108
+ };
109
+ this._onProcessData.fire(e);
110
+ await e.writePromise;
111
+ }
112
+ } finally {
113
+ this._inReplay = false;
114
+ }
115
+ if (e.commands) {
116
+ this._onRestoreCommands.fire(e.commands);
117
+ }
118
+ this._onDidChangeProperty.fire({
119
+ type: ProcessPropertyType.OverrideDimensions,
120
+ value: undefined
121
+ });
122
+ mark(`code/terminal/didHandleReplay/${this.id}`);
123
+ this._onProcessReplayComplete.fire();
124
+ }
125
+ }
126
+
127
+ export { BasePty };
@@ -3,7 +3,7 @@ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
3
3
  import { registerColor } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
4
4
 
5
5
  const terminalStickyScrollBackground = registerColor("terminalStickyScroll.background", null, ( localize(
6
- 14196,
6
+ 14349,
7
7
  "The background color of the sticky scroll overlay in the terminal."
8
8
  )));
9
9
  const terminalStickyScrollHoverBackground = registerColor("terminalStickyScrollHover.background", {
@@ -12,7 +12,7 @@ const terminalStickyScrollHoverBackground = registerColor("terminalStickyScrollH
12
12
  hcDark: "#E48B39",
13
13
  hcLight: "#0f4a85"
14
14
  }, ( localize(
15
- 14197,
15
+ 14350,
16
16
  "The background color of the sticky scroll overlay in the terminal when hovered."
17
17
  )));
18
18
  registerColor("terminalStickyScroll.border", {
@@ -20,6 +20,6 @@ registerColor("terminalStickyScroll.border", {
20
20
  light: null,
21
21
  hcDark: "#6fc3df",
22
22
  hcLight: "#0f4a85"
23
- }, ( localize(14198, "The border of the sticky scroll overlay in the terminal.")));
23
+ }, ( localize(14351, "The border of the sticky scroll overlay in the terminal.")));
24
24
 
25
25
  export { terminalStickyScrollBackground, terminalStickyScrollHoverBackground };