@noldova/terminal 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +10 -2
- package/menus.json +53 -0
- package/module.json +28 -0
- package/package.json +50 -4
- package/settings.json +83 -0
- package/src/api/index.d.ts +131 -0
- package/src/api/index.js +11 -0
- package/src/api/window.d.ts +467 -0
- package/src/api/window.js +8 -0
- package/src/enums/escape-state.js +15 -0
- package/src/enums/escape-stripper-state.js +15 -0
- package/src/enums/mark-kind.js +18 -0
- package/src/enums/shell-family.js +14 -0
- package/src/enums/system-requirement.js +11 -0
- package/src/exceptions/agent-terminal-restart.exception.js +16 -0
- package/src/exceptions/command-exited.exception.js +23 -0
- package/src/exceptions/command-failed.exception.js +13 -0
- package/src/exceptions/command-not-started.exception.js +17 -0
- package/src/exceptions/command-output-too-long.exception.js +18 -0
- package/src/exceptions/command-timed-out.exception.js +18 -0
- package/src/exceptions/command-variable-not-set.exception.js +18 -0
- package/src/exceptions/default-shell-not-found.exception.js +14 -0
- package/src/exceptions/environment-export-invalid.exception.js +14 -0
- package/src/exceptions/environment-key-unreadable.exception.js +17 -0
- package/src/exceptions/environment-unreadable.exception.js +13 -0
- package/src/exceptions/folder-not-found.exception.js +16 -0
- package/src/exceptions/host-ended.exception.js +14 -0
- package/src/exceptions/session-not-found.exception.js +18 -0
- package/src/exceptions/shell-kind-not-found.exception.js +16 -0
- package/src/exceptions/shell-not-found.exception.js +18 -0
- package/src/exceptions/shells-unreadable.exception.js +13 -0
- package/src/exceptions/stored-lines-damaged.exception.js +15 -0
- package/src/exceptions/stored-lines-unwritable.exception.js +15 -0
- package/src/exceptions/system-root-missing.exception.js +14 -0
- package/src/exceptions/terminal.exception.js +13 -0
- package/src/exceptions/unknown-method.exception.js +16 -0
- package/src/exceptions/unsupported-system.exception.js +18 -0
- package/src/exceptions/visual-studio-unreadable.exception.js +15 -0
- package/src/exceptions/wsl-distributions-unreadable.exception.js +15 -0
- package/src/interfaces/i-command-runner.js +8 -0
- package/src/interfaces/i-disposable.js +8 -0
- package/src/interfaces/i-environment-source.js +8 -0
- package/src/interfaces/i-file-system-reader.js +8 -0
- package/src/interfaces/i-file-system-writer.js +8 -0
- package/src/interfaces/i-flow-controller-listener.js +8 -0
- package/src/interfaces/i-folder-access.js +8 -0
- package/src/interfaces/i-line-process-listener.js +8 -0
- package/src/interfaces/i-line-process-starter.js +8 -0
- package/src/interfaces/i-line-process.js +8 -0
- package/src/interfaces/i-output-batcher-listener.js +8 -0
- package/src/interfaces/i-process-signaller.js +8 -0
- package/src/interfaces/i-pseudo-terminal-listener.js +8 -0
- package/src/interfaces/i-pty-exit-event.js +8 -0
- package/src/interfaces/i-pty-process.js +8 -0
- package/src/interfaces/i-pty-spawner.js +8 -0
- package/src/interfaces/i-terminal-mirror-listener.js +8 -0
- package/src/interfaces/i-terminal-session-listener.js +8 -0
- package/src/interfaces/i-waiting-options-request.js +8 -0
- package/src/models/command-listing.js +17 -0
- package/src/models/completion-candidate.js +19 -0
- package/src/models/environment-tools.js +23 -0
- package/src/models/environment-variable.js +15 -0
- package/src/models/folder-entry.js +15 -0
- package/src/models/hosted-terminal.js +116 -0
- package/src/models/mirror-line.js +27 -0
- package/src/models/mirror-snapshot.js +19 -0
- package/src/models/one-shot-launch.js +42 -0
- package/src/models/pane-progress.js +15 -0
- package/src/models/powershell-cmdlet.js +21 -0
- package/src/models/powershell-lookup.js +17 -0
- package/src/models/powershell-parameter.js +19 -0
- package/src/models/registry-value.js +15 -0
- package/src/models/request-client.js +23 -0
- package/src/models/saved-terminal.js +25 -0
- package/src/models/shell-launch.js +23 -0
- package/src/models/shell-line.js +21 -0
- package/src/models/shell-mark.js +19 -0
- package/src/models/shell-options-reply.js +17 -0
- package/src/models/shell.js +29 -0
- package/src/models/started-shell.js +21 -0
- package/src/models/system-shortfall.js +15 -0
- package/src/models/terminal-events.js +37 -0
- package/src/models/terminal-history-paths.js +15 -0
- package/src/models/terminal-prompt.js +28 -0
- package/src/models/tracked-command.js +26 -0
- package/src/models/typed-line.js +40 -0
- package/src/models/visual-studio-installation.js +22 -0
- package/src/models/waiting-run.js +25 -0
- package/src/resources.js +1725 -0
- package/src/runtime-part.js +84 -0
- package/src/services/agent-terminal.js +137 -0
- package/src/services/agent-terminals.js +55 -0
- package/src/services/bounded-reads.js +57 -0
- package/src/services/change-signal.js +33 -0
- package/src/services/command-history.js +20 -0
- package/src/services/command-runner.js +67 -0
- package/src/services/command-tracker.js +161 -0
- package/src/services/completion-source.js +316 -0
- package/src/services/context-pty-process.js +79 -0
- package/src/services/context-pty-spawner.js +26 -0
- package/src/services/deferred-pty-process.js +94 -0
- package/src/services/escape-sequence-tracker.js +126 -0
- package/src/services/escape-stripper.js +91 -0
- package/src/services/failure-text.js +15 -0
- package/src/services/file-system-writer.js +35 -0
- package/src/services/file-system.reader.js +54 -0
- package/src/services/flow-controller.js +102 -0
- package/src/services/folder-access.js +19 -0
- package/src/services/inherited-environment.js +20 -0
- package/src/services/line-process-starter.js +17 -0
- package/src/services/line-process.js +72 -0
- package/src/services/log-file.js +57 -0
- package/src/services/mac-environment.js +81 -0
- package/src/services/mac-folder-access.js +17 -0
- package/src/services/mark-scanner.js +94 -0
- package/src/services/one-shot-command.js +119 -0
- package/src/services/output-batcher.js +62 -0
- package/src/services/output-log.js +50 -0
- package/src/services/powershell-binding.js +61 -0
- package/src/services/process-signaller.js +19 -0
- package/src/services/pseudo-terminal.js +54 -0
- package/src/services/registry-export.js +108 -0
- package/src/services/resize-wakeup.js +39 -0
- package/src/services/saved-terminals.js +52 -0
- package/src/services/shared-reads.js +41 -0
- package/src/services/shell-command.js +90 -0
- package/src/services/shell-environment.js +20 -0
- package/src/services/shell-integration.js +207 -0
- package/src/services/shell-locator.js +177 -0
- package/src/services/shell-options-queue.js +34 -0
- package/src/services/shell-words.js +80 -0
- package/src/services/system-requirements.js +46 -0
- package/src/services/terminal-audience.js +83 -0
- package/src/services/terminal-history-folder.js +97 -0
- package/src/services/terminal-history-segment.js +109 -0
- package/src/services/terminal-history.js +130 -0
- package/src/services/terminal-host.js +931 -0
- package/src/services/terminal-line-reader.js +101 -0
- package/src/services/terminal-mirror.js +221 -0
- package/src/services/terminal-owner.service.js +27 -0
- package/src/services/terminal-session.js +398 -0
- package/src/services/visual-studio.reader.js +76 -0
- package/src/services/windows-environment.js +218 -0
- package/src/services/windows-folder-access.js +23 -0
- package/src/services/wsl-distribution.reader.js +49 -0
- package/src/services/xterm-headless-loader.js +14 -0
- package/src/tools/enums/command-status.js +13 -0
- package/src/tools/enums/run-method.js +11 -0
- package/src/tools/exceptions/abort-reason-unknown.exception.js +17 -0
- package/src/tools/exceptions/stale-terminal.exception.js +16 -0
- package/src/tools/interfaces/i-agent-command.js +8 -0
- package/src/tools/interfaces/i-agent-terminal.js +8 -0
- package/src/tools/interfaces/i-agent-terminals.js +8 -0
- package/src/tools/interfaces/i-output-source.js +8 -0
- package/src/tools/interfaces/i-terminal-prompt.js +8 -0
- package/src/tools/models/agent-terminal-access.js +25 -0
- package/src/tools/models/agent-terminal-opening.js +29 -0
- package/src/tools/models/command-line.js +28 -0
- package/src/tools/models/key-sequence.js +27 -0
- package/src/tools/models/output-chunk.js +18 -0
- package/src/tools/models/output-excerpt.js +31 -0
- package/src/tools/models/permission-ask.js +34 -0
- package/src/tools/models/read-cursor.js +26 -0
- package/src/tools/models/read-cursors.js +25 -0
- package/src/tools/models/terminal-open-input.js +34 -0
- package/src/tools/models/terminal-output-report.js +61 -0
- package/src/tools/models/terminal-read-input.js +39 -0
- package/src/tools/models/terminal-run-input.js +52 -0
- package/src/tools/models/terminal-target-input.js +34 -0
- package/src/tools/models/terminal-write-input.js +38 -0
- package/src/tools/models/tool-call-context.js +61 -0
- package/src/tools/services/abort-reason-reader.js +25 -0
- package/src/tools/services/permission-details.js +42 -0
- package/src/tools/services/permission-gate.js +35 -0
- package/src/tools/services/signal-race.js +24 -0
- package/src/tools/services/terminal-access-policy.js +57 -0
- package/src/tools/services/terminal-close-tool.js +57 -0
- package/src/tools/services/terminal-interrupt-tool.js +57 -0
- package/src/tools/services/terminal-list-tool.js +69 -0
- package/src/tools/services/terminal-open-tool.js +71 -0
- package/src/tools/services/terminal-read-tool.js +58 -0
- package/src/tools/services/terminal-run-tool.js +78 -0
- package/src/tools/services/terminal-text-escaper.js +40 -0
- package/src/tools/services/terminal-tool.js +47 -0
- package/src/tools/services/terminal-tools.js +60 -0
- package/src/tools/services/terminal-write-tool.js +75 -0
- package/src/tools/services/tool-failures.js +28 -0
- package/src/tools/services/tool-results.js +13 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { Resources } from "../resources.js";
|
|
9
|
+
export class HostedTerminal {
|
|
10
|
+
pendingInterrupt = null;
|
|
11
|
+
session;
|
|
12
|
+
shell;
|
|
13
|
+
folder;
|
|
14
|
+
ownerSessionId;
|
|
15
|
+
isPanelTerminal;
|
|
16
|
+
owner;
|
|
17
|
+
connection;
|
|
18
|
+
environment;
|
|
19
|
+
isRestarting = false;
|
|
20
|
+
isEndSent = false;
|
|
21
|
+
heldExit = null;
|
|
22
|
+
inputCount = 0;
|
|
23
|
+
keyCount = 0;
|
|
24
|
+
inputReceivedLength = null;
|
|
25
|
+
inputTime = 0;
|
|
26
|
+
inputPrompt = null;
|
|
27
|
+
inputCommandMarks = 0;
|
|
28
|
+
restarts = Promise.resolve();
|
|
29
|
+
isSized = false;
|
|
30
|
+
opensTab = true;
|
|
31
|
+
launcher = null;
|
|
32
|
+
fitWindow = null;
|
|
33
|
+
deferredShell = null;
|
|
34
|
+
startTemporaryFolder = null;
|
|
35
|
+
pendingCommand = null;
|
|
36
|
+
launchCommandOffset = null;
|
|
37
|
+
runs = new Map();
|
|
38
|
+
name = null;
|
|
39
|
+
isRunStarting = false;
|
|
40
|
+
waitingRun = null;
|
|
41
|
+
typedEnds = 1;
|
|
42
|
+
paste = "";
|
|
43
|
+
constructor(session, shell, folder, ownerSessionId, isPanelTerminal, owner, connection, environment = null) {
|
|
44
|
+
this.session = session;
|
|
45
|
+
this.shell = shell;
|
|
46
|
+
this.folder = folder;
|
|
47
|
+
this.ownerSessionId = ownerSessionId;
|
|
48
|
+
this.isPanelTerminal = isPanelTerminal;
|
|
49
|
+
this.owner = owner;
|
|
50
|
+
this.connection = connection;
|
|
51
|
+
this.environment = environment;
|
|
52
|
+
}
|
|
53
|
+
get hasRecentInput() {
|
|
54
|
+
return Date.now() - this.inputTime < Resources.echoSettleMilliseconds;
|
|
55
|
+
}
|
|
56
|
+
get hasUnreadInput() {
|
|
57
|
+
const commands = this.session.commands;
|
|
58
|
+
const prompt = commands.promptIdentity;
|
|
59
|
+
return this.hasRecentInput && (this.inputPrompt === null || prompt === null || prompt === this.inputPrompt
|
|
60
|
+
|| commands.commandMarks === this.inputCommandMarks);
|
|
61
|
+
}
|
|
62
|
+
get isFree() {
|
|
63
|
+
return this.ownerSessionId === null && !this.session.hasExited && !this.isRestarting && this.pendingCommand === null
|
|
64
|
+
&& this.session.commands.hasMarks && !this.hasUnreadInput && this.session.readPromptLine() === "";
|
|
65
|
+
}
|
|
66
|
+
recordInput(isReply = false, data = "") {
|
|
67
|
+
this.inputReceivedLength = this.session.receivedLength;
|
|
68
|
+
if (isReply)
|
|
69
|
+
return;
|
|
70
|
+
const commands = this.session.commands;
|
|
71
|
+
this.record(commands.isWaitingAtPrompt && !HostedTerminal.hasTextAfterLineBreak(data) ? commands.promptIdentity : null);
|
|
72
|
+
}
|
|
73
|
+
recordRunInput() {
|
|
74
|
+
this.inputReceivedLength = this.session.receivedLength;
|
|
75
|
+
this.record(this.typedEnds === 1 ? this.session.commands.promptIdentity : null);
|
|
76
|
+
}
|
|
77
|
+
addRun(runId, startLine) {
|
|
78
|
+
this.runs.set(runId, startLine);
|
|
79
|
+
for (const [oldest, start] of [...this.runs].slice(0, Math.max(0, this.runs.size - Resources.maximumKeptRuns)))
|
|
80
|
+
this.forgetRun(oldest, start);
|
|
81
|
+
}
|
|
82
|
+
clearRuns() {
|
|
83
|
+
for (const [runId, start] of [...this.runs])
|
|
84
|
+
this.forgetRun(runId, start);
|
|
85
|
+
}
|
|
86
|
+
beginInterrupt() {
|
|
87
|
+
const interrupting = new AbortController();
|
|
88
|
+
this.pendingInterrupt = interrupting;
|
|
89
|
+
return interrupting.signal;
|
|
90
|
+
}
|
|
91
|
+
endInterrupt() {
|
|
92
|
+
this.pendingInterrupt = null;
|
|
93
|
+
}
|
|
94
|
+
cancelCommand() {
|
|
95
|
+
this.pendingCommand?.abort();
|
|
96
|
+
this.pendingCommand = null;
|
|
97
|
+
this.pendingInterrupt?.abort();
|
|
98
|
+
this.pendingInterrupt = null;
|
|
99
|
+
}
|
|
100
|
+
isReachedBy(connection, isApp) {
|
|
101
|
+
return this.connection === null ? this.owner !== null && isApp : this.connection === connection;
|
|
102
|
+
}
|
|
103
|
+
record(prompt) {
|
|
104
|
+
this.inputCount++;
|
|
105
|
+
this.inputTime = Date.now();
|
|
106
|
+
this.inputPrompt = prompt;
|
|
107
|
+
this.inputCommandMarks = this.session.commands.commandMarks;
|
|
108
|
+
}
|
|
109
|
+
static hasTextAfterLineBreak(data) {
|
|
110
|
+
return data.replace(Resources.bracketedPastes, "").split(Resources.lineBreaks).slice(1).some(t => t !== "");
|
|
111
|
+
}
|
|
112
|
+
forgetRun(runId, start) {
|
|
113
|
+
void start.then(t => t.dispose(), () => undefined);
|
|
114
|
+
this.runs.delete(runId);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class MirrorLine {
|
|
9
|
+
currentNumber;
|
|
10
|
+
marker;
|
|
11
|
+
constructor(number, marker) {
|
|
12
|
+
this.currentNumber = number;
|
|
13
|
+
this.marker = marker;
|
|
14
|
+
}
|
|
15
|
+
get number() {
|
|
16
|
+
return this.currentNumber;
|
|
17
|
+
}
|
|
18
|
+
get index() {
|
|
19
|
+
return this.marker === undefined || this.marker.isDisposed ? null : this.marker.line;
|
|
20
|
+
}
|
|
21
|
+
renumber(number) {
|
|
22
|
+
this.currentNumber = number;
|
|
23
|
+
}
|
|
24
|
+
dispose() {
|
|
25
|
+
this.marker?.dispose();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class MirrorSnapshot {
|
|
9
|
+
snapshot;
|
|
10
|
+
pending;
|
|
11
|
+
offset;
|
|
12
|
+
input;
|
|
13
|
+
constructor(snapshot, pending, offset, input = null) {
|
|
14
|
+
this.snapshot = snapshot;
|
|
15
|
+
this.pending = pending;
|
|
16
|
+
this.offset = offset;
|
|
17
|
+
this.input = input;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { Resources } from "../resources.js";
|
|
9
|
+
export class OneShotLaunch {
|
|
10
|
+
file;
|
|
11
|
+
args;
|
|
12
|
+
environment;
|
|
13
|
+
constructor(file, args, environment = {}) {
|
|
14
|
+
this.file = file;
|
|
15
|
+
this.args = args;
|
|
16
|
+
this.environment = environment;
|
|
17
|
+
}
|
|
18
|
+
get commandLine() {
|
|
19
|
+
if (typeof this.args !== "string")
|
|
20
|
+
return [this.file, ...this.args].map(t => OneShotLaunch.quote(t)).join(Resources.oneShotLaunchArgumentSeparator);
|
|
21
|
+
let line = this.args;
|
|
22
|
+
for (const [name, value] of Object.entries(this.environment))
|
|
23
|
+
line = line.replaceAll(Resources.formatOneShotLaunchDelayedVariable(name), value);
|
|
24
|
+
return Resources.formatOneShotLaunchCommandLine(OneShotLaunch.quote(this.file), line);
|
|
25
|
+
}
|
|
26
|
+
static quote(argument) {
|
|
27
|
+
const isQuoted = argument === "" || (Resources.oneShotLaunchArgumentBreak.test(argument) && argument.length > 1
|
|
28
|
+
&& !(argument.startsWith(Resources.doubleQuote) && argument.endsWith(Resources.doubleQuote)));
|
|
29
|
+
let quoted = isQuoted ? Resources.doubleQuote : "";
|
|
30
|
+
let backslashes = 0;
|
|
31
|
+
for (const unit of argument) {
|
|
32
|
+
if (unit === Resources.backslash)
|
|
33
|
+
backslashes++;
|
|
34
|
+
else {
|
|
35
|
+
quoted += Resources.backslash.repeat(unit === Resources.doubleQuote ? backslashes * 2 + 1 : backslashes) + unit;
|
|
36
|
+
backslashes = 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return isQuoted ? `${quoted}${Resources.backslash.repeat(backslashes * 2)}${Resources.doubleQuote}`
|
|
40
|
+
: quoted + Resources.backslash.repeat(backslashes);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class PaneProgress {
|
|
9
|
+
offset;
|
|
10
|
+
isVisible = true;
|
|
11
|
+
stallTimer = null;
|
|
12
|
+
constructor(offset) {
|
|
13
|
+
this.offset = offset;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class PowerShellCmdlet {
|
|
9
|
+
names;
|
|
10
|
+
windowsAliases;
|
|
11
|
+
positions;
|
|
12
|
+
parameters;
|
|
13
|
+
dynamicParameters;
|
|
14
|
+
constructor(names, windowsAliases, positions, parameters, dynamicParameters = []) {
|
|
15
|
+
this.names = names;
|
|
16
|
+
this.windowsAliases = windowsAliases;
|
|
17
|
+
this.positions = positions;
|
|
18
|
+
this.parameters = parameters;
|
|
19
|
+
this.dynamicParameters = dynamicParameters;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class PowerShellLookup {
|
|
9
|
+
shellNames;
|
|
10
|
+
search;
|
|
11
|
+
answers;
|
|
12
|
+
constructor(shellNames, search, answers) {
|
|
13
|
+
this.shellNames = shellNames;
|
|
14
|
+
this.search = search;
|
|
15
|
+
this.answers = answers;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class PowerShellParameter {
|
|
9
|
+
name;
|
|
10
|
+
isSwitch;
|
|
11
|
+
aliases;
|
|
12
|
+
slot;
|
|
13
|
+
constructor(name, isSwitch, aliases = [], slot = name) {
|
|
14
|
+
this.name = name;
|
|
15
|
+
this.isSwitch = isSwitch;
|
|
16
|
+
this.aliases = aliases;
|
|
17
|
+
this.slot = slot;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class RegistryValue {
|
|
9
|
+
text;
|
|
10
|
+
isExpandable;
|
|
11
|
+
constructor(text, isExpandable) {
|
|
12
|
+
this.text = text;
|
|
13
|
+
this.isExpandable = isExpandable;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { ShellClients } from "@noldova/desktop.protocol";
|
|
9
|
+
export class RequestClient {
|
|
10
|
+
connection;
|
|
11
|
+
window;
|
|
12
|
+
isApp;
|
|
13
|
+
page;
|
|
14
|
+
constructor(connection, window, isApp, page = null) {
|
|
15
|
+
this.connection = connection;
|
|
16
|
+
this.window = window;
|
|
17
|
+
this.isApp = isApp;
|
|
18
|
+
this.page = page;
|
|
19
|
+
}
|
|
20
|
+
static fromContext(context) {
|
|
21
|
+
return new RequestClient(context.connection, context.window, context.client === ShellClients.mainProcess, context.page);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class SavedTerminal {
|
|
9
|
+
sessionId;
|
|
10
|
+
shellId;
|
|
11
|
+
folder;
|
|
12
|
+
isPanelTerminal;
|
|
13
|
+
owner;
|
|
14
|
+
opensTab;
|
|
15
|
+
name;
|
|
16
|
+
constructor(sessionId, shellId, folder, isPanelTerminal, owner = null, opensTab = true, name = null) {
|
|
17
|
+
this.sessionId = sessionId;
|
|
18
|
+
this.shellId = shellId;
|
|
19
|
+
this.folder = folder;
|
|
20
|
+
this.isPanelTerminal = isPanelTerminal;
|
|
21
|
+
this.owner = owner;
|
|
22
|
+
this.opensTab = opensTab;
|
|
23
|
+
this.name = name;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class ShellLaunch {
|
|
9
|
+
file;
|
|
10
|
+
args;
|
|
11
|
+
environment;
|
|
12
|
+
nonce;
|
|
13
|
+
nonceFile;
|
|
14
|
+
printsNote;
|
|
15
|
+
constructor(file, args, environment, nonce, nonceFile = null, printsNote = false) {
|
|
16
|
+
this.file = file;
|
|
17
|
+
this.args = args;
|
|
18
|
+
this.environment = environment;
|
|
19
|
+
this.nonce = nonce;
|
|
20
|
+
this.nonceFile = nonceFile;
|
|
21
|
+
this.printsNote = printsNote;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class ShellLine {
|
|
9
|
+
words;
|
|
10
|
+
start;
|
|
11
|
+
value;
|
|
12
|
+
quote;
|
|
13
|
+
startsQuoted;
|
|
14
|
+
constructor(words, start, value, quote, startsQuoted) {
|
|
15
|
+
this.words = words;
|
|
16
|
+
this.start = start;
|
|
17
|
+
this.value = value;
|
|
18
|
+
this.quote = quote;
|
|
19
|
+
this.startsQuoted = startsQuoted;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class ShellMark {
|
|
9
|
+
kind;
|
|
10
|
+
value;
|
|
11
|
+
offset;
|
|
12
|
+
values;
|
|
13
|
+
constructor(kind, value, offset, values = value === null ? [] : [value]) {
|
|
14
|
+
this.kind = kind;
|
|
15
|
+
this.value = value;
|
|
16
|
+
this.offset = offset;
|
|
17
|
+
this.values = values;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class ShellOptionsReply {
|
|
9
|
+
static none = new ShellOptionsReply(null, false);
|
|
10
|
+
static timedOut = new ShellOptionsReply(null, true);
|
|
11
|
+
options;
|
|
12
|
+
isTimedOut;
|
|
13
|
+
constructor(options, isTimedOut) {
|
|
14
|
+
this.options = options;
|
|
15
|
+
this.isTimedOut = isTimedOut;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { TerminalShell } from "@noldova/terminal.protocol";
|
|
9
|
+
export class Shell {
|
|
10
|
+
id;
|
|
11
|
+
name;
|
|
12
|
+
kind;
|
|
13
|
+
file;
|
|
14
|
+
args;
|
|
15
|
+
isDefault;
|
|
16
|
+
startCommand;
|
|
17
|
+
constructor(id, name, kind, file, args, isDefault, startCommand = null) {
|
|
18
|
+
this.id = id;
|
|
19
|
+
this.name = name;
|
|
20
|
+
this.kind = kind;
|
|
21
|
+
this.file = file;
|
|
22
|
+
this.args = args;
|
|
23
|
+
this.isDefault = isDefault;
|
|
24
|
+
this.startCommand = startCommand;
|
|
25
|
+
}
|
|
26
|
+
toTerminalShell() {
|
|
27
|
+
return new TerminalShell(this.id, this.name, this.kind, this.isDefault);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class StartedShell {
|
|
9
|
+
process;
|
|
10
|
+
nonce;
|
|
11
|
+
printsNote;
|
|
12
|
+
deferred;
|
|
13
|
+
temporaryFolder;
|
|
14
|
+
constructor(process, nonce, printsNote, deferred, temporaryFolder) {
|
|
15
|
+
this.process = process;
|
|
16
|
+
this.nonce = nonce;
|
|
17
|
+
this.printsNote = printsNote;
|
|
18
|
+
this.deferred = deferred;
|
|
19
|
+
this.temporaryFolder = temporaryFolder;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class SystemShortfall {
|
|
9
|
+
requirement;
|
|
10
|
+
found;
|
|
11
|
+
constructor(requirement, found) {
|
|
12
|
+
this.requirement = requirement;
|
|
13
|
+
this.found = found;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class TerminalEvents {
|
|
9
|
+
output;
|
|
10
|
+
exited;
|
|
11
|
+
restarted;
|
|
12
|
+
titleChanged;
|
|
13
|
+
cwdChanged;
|
|
14
|
+
detached;
|
|
15
|
+
closed;
|
|
16
|
+
opened;
|
|
17
|
+
launchCommandEnded;
|
|
18
|
+
runOpened;
|
|
19
|
+
runEnded;
|
|
20
|
+
renamed;
|
|
21
|
+
commandAdded;
|
|
22
|
+
constructor(output, exited, restarted, titleChanged, cwdChanged, detached, closed, opened, launchCommandEnded, runOpened, runEnded, renamed, commandAdded) {
|
|
23
|
+
this.output = output;
|
|
24
|
+
this.exited = exited;
|
|
25
|
+
this.restarted = restarted;
|
|
26
|
+
this.titleChanged = titleChanged;
|
|
27
|
+
this.cwdChanged = cwdChanged;
|
|
28
|
+
this.detached = detached;
|
|
29
|
+
this.closed = closed;
|
|
30
|
+
this.opened = opened;
|
|
31
|
+
this.launchCommandEnded = launchCommandEnded;
|
|
32
|
+
this.runOpened = runOpened;
|
|
33
|
+
this.runEnded = runEnded;
|
|
34
|
+
this.renamed = renamed;
|
|
35
|
+
this.commandAdded = commandAdded;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class TerminalHistoryPaths {
|
|
9
|
+
first;
|
|
10
|
+
second;
|
|
11
|
+
constructor(first, second) {
|
|
12
|
+
this.first = first;
|
|
13
|
+
this.second = second;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class TerminalPrompt {
|
|
9
|
+
isIdle;
|
|
10
|
+
cwd;
|
|
11
|
+
promptOffset;
|
|
12
|
+
isAwaitingSecret;
|
|
13
|
+
inputCount;
|
|
14
|
+
constructor(isIdle, cwd, promptOffset, isAwaitingSecret, inputCount) {
|
|
15
|
+
this.isIdle = isIdle;
|
|
16
|
+
this.cwd = cwd;
|
|
17
|
+
this.promptOffset = promptOffset;
|
|
18
|
+
this.isAwaitingSecret = isAwaitingSecret;
|
|
19
|
+
this.inputCount = inputCount;
|
|
20
|
+
}
|
|
21
|
+
equals(other) {
|
|
22
|
+
return other.isIdle === this.isIdle
|
|
23
|
+
&& other.cwd === this.cwd
|
|
24
|
+
&& other.promptOffset === this.promptOffset
|
|
25
|
+
&& other.isAwaitingSecret === this.isAwaitingSecret
|
|
26
|
+
&& other.inputCount === this.inputCount;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class TrackedCommand {
|
|
9
|
+
outputStart;
|
|
10
|
+
hasOutputStart;
|
|
11
|
+
outputEnd = null;
|
|
12
|
+
exitCode = null;
|
|
13
|
+
cwd = null;
|
|
14
|
+
constructor(outputStart, hasOutputStart) {
|
|
15
|
+
this.outputStart = outputStart;
|
|
16
|
+
this.hasOutputStart = hasOutputStart;
|
|
17
|
+
}
|
|
18
|
+
get hasEnded() {
|
|
19
|
+
return this.outputEnd !== null;
|
|
20
|
+
}
|
|
21
|
+
end(outputEnd, exitCode, cwd) {
|
|
22
|
+
this.outputEnd = outputEnd;
|
|
23
|
+
this.exitCode = exitCode;
|
|
24
|
+
this.cwd = cwd;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { Resources } from "../resources.js";
|
|
9
|
+
export class TypedLine {
|
|
10
|
+
echo;
|
|
11
|
+
tail = "";
|
|
12
|
+
isEchoed = false;
|
|
13
|
+
startOffset;
|
|
14
|
+
command = null;
|
|
15
|
+
endOffset = null;
|
|
16
|
+
constructor(startOffset, text) {
|
|
17
|
+
this.startOffset = startOffset;
|
|
18
|
+
this.echo = TypedLine.compact(text.slice(Math.max(text.lastIndexOf(Resources.lineFeed), text.lastIndexOf(Resources.enterKey)) + 1));
|
|
19
|
+
}
|
|
20
|
+
get isOpen() {
|
|
21
|
+
return this.command === null && this.endOffset === null;
|
|
22
|
+
}
|
|
23
|
+
read(text) {
|
|
24
|
+
const lines = text.split(Resources.lineFeed);
|
|
25
|
+
for (const [index, line] of lines.entries()) {
|
|
26
|
+
if (this.isEchoed)
|
|
27
|
+
return;
|
|
28
|
+
const joined = this.tail + TypedLine.compact(line);
|
|
29
|
+
this.tail = joined.slice(Math.max(0, joined.length - this.echo.length));
|
|
30
|
+
this.isEchoed = index < lines.length - 1 && this.tail === this.echo;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
prompt(offset) {
|
|
34
|
+
if (this.isEchoed)
|
|
35
|
+
this.endOffset = offset;
|
|
36
|
+
}
|
|
37
|
+
static compact(text) {
|
|
38
|
+
return text.replace(Resources.whiteSpace, "");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { ArgumentValidator, Resources as ProtocolResources } from "@noldova/terminal.protocol";
|
|
9
|
+
import { Resources } from "../resources.js";
|
|
10
|
+
export class VisualStudioInstallation {
|
|
11
|
+
instanceId;
|
|
12
|
+
name;
|
|
13
|
+
path;
|
|
14
|
+
constructor(instanceId, name, path) {
|
|
15
|
+
ArgumentValidator.requireIdentifier(Resources.visualStudioInstallationInstanceIdField, instanceId);
|
|
16
|
+
ArgumentValidator.requireNonBlank(Resources.visualStudioInstallationNameField, name, ProtocolResources.maximumNameLength);
|
|
17
|
+
ArgumentValidator.requireNonBlank(Resources.visualStudioInstallationPathField, path, ProtocolResources.maximumPathLength);
|
|
18
|
+
this.instanceId = instanceId;
|
|
19
|
+
this.name = name;
|
|
20
|
+
this.path = path;
|
|
21
|
+
}
|
|
22
|
+
}
|