@noldova/terminal 0.0.10 → 0.0.12
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/module.json +4 -4
- package/package.json +6 -6
- package/src/api/window.d.ts +94 -1
- package/src/api/window.js +1 -1
- package/src/interfaces/i-shell-adapter.js +1 -0
- package/src/models/completion-candidate.js +8 -1
- package/src/models/describe-group.js +11 -0
- package/src/models/environment-tools.js +5 -1
- package/src/models/known-description.js +18 -0
- package/src/models/terminal-events.js +3 -1
- package/src/models/tool-command.js +15 -0
- package/src/models/tool-word.js +15 -0
- package/src/resources.js +251 -6
- package/src/runtime-part.js +5 -3
- package/src/services/command-describer.js +133 -0
- package/src/services/command-tracker.js +3 -0
- package/src/services/completion-source.js +62 -47
- package/src/services/folder-change-line.js +23 -0
- package/src/services/leftover-folders.js +42 -0
- package/src/services/posix-shell-adapter.js +54 -0
- package/src/services/powershell-shell-adapter.js +42 -0
- package/src/services/printed-text.js +40 -0
- package/src/services/pseudo-terminal.js +9 -3
- package/src/services/shell-adapters.js +25 -0
- package/src/services/terminal-history-folder.js +5 -16
- package/src/services/terminal-host.js +61 -8
- package/src/services/terminal-session.js +26 -3
- package/src/services/windows-environment.js +8 -1
package/module.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "terminal",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"displayName": "Terminal",
|
|
5
5
|
"description": "Runs shells in terminal panes, and lets AI agents run commands in them through permission requests.",
|
|
6
6
|
"parts": ["runtime", "window"],
|
|
7
7
|
"pseudoTerminals": true,
|
|
8
8
|
"dependencies": {},
|
|
9
|
-
"noldovaDesktop": ">=0.0.
|
|
9
|
+
"noldovaDesktop": ">=0.0.29 <0.1.0",
|
|
10
10
|
"contributes": {
|
|
11
11
|
"methods": [
|
|
12
12
|
"terminal.shells", "terminal.open", "terminal.close", "terminal.restart", "terminal.sessions", "terminal.attach", "terminal.input", "terminal.resize",
|
|
13
13
|
"terminal.ack", "terminal.visibility", "terminal.detach", "terminal.lines", "terminal.restore", "terminal.closeOwner", "terminal.launch",
|
|
14
14
|
"terminal.run", "terminal.runOutput", "terminal.windowStarted", "terminal.showOwner", "terminal.rename",
|
|
15
|
-
"terminal.complete", "terminal.findCommands", "terminal.write"
|
|
15
|
+
"terminal.complete", "terminal.findCommands", "terminal.describe", "terminal.write", "terminal.changeFolder"
|
|
16
16
|
],
|
|
17
17
|
"events": [
|
|
18
18
|
"terminal.output", "terminal.exited", "terminal.restarted", "terminal.titleChanged", "terminal.cwdChanged", "terminal.detached",
|
|
19
19
|
"terminal.closed", "terminal.opened", "terminal.launchCommandEnded", "terminal.runOpened", "terminal.runEnded",
|
|
20
|
-
"terminal.renamed", "terminal.commandAdded", "terminal.commandStarted", "terminal.outputStarted",
|
|
20
|
+
"terminal.renamed", "terminal.commandAdded", "terminal.commandStarted", "terminal.outputStarted", "terminal.outputPrinted",
|
|
21
21
|
"terminal.commandEnded", "terminal.promptStarted", "terminal.screenChanged"
|
|
22
22
|
],
|
|
23
23
|
"commands": ["terminal.new", "terminal.newWithShell", "terminal.toggle", "terminal.restartShell"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noldova/terminal",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "The terminal module for apps on Noldova Desktop: terminal panes over real shells, and agent tools that run commands through permission requests.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"registry": "https://registry.npmjs.org/"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@noldova/terminal.protocol": "0.0.
|
|
41
|
-
"@noldova/terminal.window": "0.0.
|
|
40
|
+
"@noldova/terminal.protocol": "0.0.12",
|
|
41
|
+
"@noldova/terminal.window": "0.0.12",
|
|
42
42
|
"@xterm/addon-serialize": "0.14.0",
|
|
43
43
|
"@xterm/headless": "6.0.0",
|
|
44
44
|
"node-pty": "1.2.0-beta.15"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@noldova/desktop.protocol": ">=0.0.
|
|
48
|
-
"@noldova/desktop.runtime": ">=0.0.
|
|
47
|
+
"@noldova/desktop.protocol": ">=0.0.29 <0.1.0",
|
|
48
|
+
"@noldova/desktop.runtime": ">=0.0.29 <0.1.0",
|
|
49
49
|
"@noldova/context.core": ">=0.0.18 <0.1.0",
|
|
50
50
|
"@noldova/context.exceptions": ">=0.0.18 <0.1.0",
|
|
51
51
|
"@noldova/context.json": ">=0.0.18 <0.1.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "78f6600e1848b0ee2bde8fb510f0df54ba5f0eec"
|
|
54
54
|
}
|
package/src/api/window.d.ts
CHANGED
|
@@ -58,6 +58,36 @@ export { TerminalWindowException } from "@noldova/terminal.window";
|
|
|
58
58
|
*/
|
|
59
59
|
export { StartFolderProvidedException } from "@noldova/terminal.window";
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* What Toggle Terminal does in a window whose app shows a terminal of its own, from `@noldova/terminal.window`.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import type { IWindowPartContext } from "@noldova/desktop.window";
|
|
67
|
+
* import { TerminalToggle } from "@noldova/terminal/window";
|
|
68
|
+
*
|
|
69
|
+
* export function provideLineToggle(context: IWindowPartContext, line: HTMLElement): () => void {
|
|
70
|
+
* return TerminalToggle.provide(context, () => {
|
|
71
|
+
* line.focus();
|
|
72
|
+
* return true;
|
|
73
|
+
* });
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export { TerminalToggle } from "@noldova/terminal.window";
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Thrown when a window that already has a toggle provider is given another, from `@noldova/terminal.window`.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* import { ToggleProvidedException } from "@noldova/terminal/window";
|
|
85
|
+
*
|
|
86
|
+
* console.log(new ToggleProvidedException().name);
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export { ToggleProvidedException } from "@noldova/terminal.window";
|
|
90
|
+
|
|
61
91
|
/**
|
|
62
92
|
* What an app ties a window's terminals to, such as its chats, from `@noldova/terminal.window`.
|
|
63
93
|
*
|
|
@@ -147,7 +177,8 @@ export { RunShellKindsMissingException } from "@noldova/terminal.window";
|
|
|
147
177
|
export { RunLinesRefusedException } from "@noldova/terminal.window";
|
|
148
178
|
|
|
149
179
|
/**
|
|
150
|
-
* Thrown when a run picked, opened or was given a terminal but its commands weren't typed,
|
|
180
|
+
* Thrown when a run picked, opened or was given a terminal but its commands weren't typed, or a folder move found the terminal not free,
|
|
181
|
+
* saying why, from `@noldova/terminal.window`.
|
|
151
182
|
*
|
|
152
183
|
* @example
|
|
153
184
|
* ```ts
|
|
@@ -319,6 +350,18 @@ export { TerminalLauncher } from "@noldova/terminal.window";
|
|
|
319
350
|
*/
|
|
320
351
|
export { TerminalLaunch } from "@noldova/terminal.window";
|
|
321
352
|
|
|
353
|
+
/**
|
|
354
|
+
* The tab of a launched terminal, from `@noldova/terminal.window`.
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```ts
|
|
358
|
+
* import { LaunchedTab } from "@noldova/terminal/window";
|
|
359
|
+
*
|
|
360
|
+
* console.log(LaunchedTab.none.isShown());
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
export { LaunchedTab } from "@noldova/terminal.window";
|
|
364
|
+
|
|
322
365
|
/**
|
|
323
366
|
* A terminal the launcher opened, with the promise of its end, from `@noldova/terminal.window`.
|
|
324
367
|
*
|
|
@@ -344,6 +387,31 @@ export { LaunchedTerminal } from "@noldova/terminal.window";
|
|
|
344
387
|
*/
|
|
345
388
|
export type { ITerminalWriteOptions } from "@noldova/terminal.window";
|
|
346
389
|
|
|
390
|
+
/**
|
|
391
|
+
* How a launched terminal's `showAsync` shows its tab, from `@noldova/terminal.window`.
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```ts
|
|
395
|
+
* import type { ITerminalShowOptions } from "@noldova/terminal/window";
|
|
396
|
+
*
|
|
397
|
+
* const options: ITerminalShowOptions = { focus: true };
|
|
398
|
+
* console.log(options.focus);
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
export type { ITerminalShowOptions } from "@noldova/terminal.window";
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Thrown when a launched terminal's tab can't be shown because it was launched without one, from `@noldova/terminal.window`.
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* ```ts
|
|
408
|
+
* import { TerminalWithoutTabException } from "@noldova/terminal/window";
|
|
409
|
+
*
|
|
410
|
+
* console.log(new TerminalWithoutTabException("session-1").sessionId);
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
export { TerminalWithoutTabException } from "@noldova/terminal.window";
|
|
414
|
+
|
|
347
415
|
/**
|
|
348
416
|
* Thrown when a launched terminal's text can't be written because it ended, from `@noldova/terminal.window`.
|
|
349
417
|
*
|
|
@@ -356,6 +424,31 @@ export type { ITerminalWriteOptions } from "@noldova/terminal.window";
|
|
|
356
424
|
*/
|
|
357
425
|
export { TerminalEndedException } from "@noldova/terminal.window";
|
|
358
426
|
|
|
427
|
+
/**
|
|
428
|
+
* Thrown when a launched terminal's shell can't be moved to a folder because its kind doesn't report its folder, from
|
|
429
|
+
* `@noldova/terminal.window`.
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```ts
|
|
433
|
+
* import { TerminalFolderNotFollowedException } from "@noldova/terminal/window";
|
|
434
|
+
*
|
|
435
|
+
* console.log(new TerminalFolderNotFollowedException("session-1", "CommandPrompt").shellKind);
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
export { TerminalFolderNotFollowedException } from "@noldova/terminal.window";
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Thrown when a launched terminal's shell didn't move to a folder, from `@noldova/terminal.window`.
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```ts
|
|
445
|
+
* import { TerminalFolderRefusedException } from "@noldova/terminal/window";
|
|
446
|
+
*
|
|
447
|
+
* console.log(new TerminalFolderRefusedException("session-1", "/gone").folder);
|
|
448
|
+
* ```
|
|
449
|
+
*/
|
|
450
|
+
export { TerminalFolderRefusedException } from "@noldova/terminal.window";
|
|
451
|
+
|
|
359
452
|
/**
|
|
360
453
|
* Tells an app the events of a terminal session it reaches, from `@noldova/terminal.window`.
|
|
361
454
|
*
|
package/src/api/window.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* This source code is licensed under the license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
export { EmbeddedRowsRefusedException, EmbeddedTerminal, LaunchArgumentRefusedException, LaunchedTerminal, LaunchFolderMissingException, LaunchPartInactiveException, LaunchRowsRefusedException, LaunchRowsWithoutTabException, LaunchTitleRefusedException, OwnersProvidedException, RunArgumentRefusedException, RunLinesRefusedException, RunPartInactiveException, RunShellKindsMissingException, StartFolderProvidedException, TerminalEnd, TerminalLaunch, TerminalLauncher, TerminalLaunchRefusedException, TerminalEndedException, TerminalNotActiveException, TerminalLine, TerminalListener, TerminalOwners, TerminalRun, TerminalRunBusy, TerminalRunEnd, TerminalRunNotFoundException, TerminalRunNotTypedException, TerminalRunOutcome, TerminalRunOutput, TerminalRunRefusedException, TerminalRunTarget, TerminalShellKind, TerminalStartFolder, TerminalTextRun, TerminalTextStyle, TerminalWindowException, windowPart } from "@noldova/terminal.window";
|
|
8
|
+
export { EmbeddedRowsRefusedException, EmbeddedTerminal, LaunchArgumentRefusedException, LaunchedTab, LaunchedTerminal, LaunchFolderMissingException, LaunchPartInactiveException, LaunchRowsRefusedException, LaunchRowsWithoutTabException, LaunchTitleRefusedException, OwnersProvidedException, RunArgumentRefusedException, RunLinesRefusedException, RunPartInactiveException, RunShellKindsMissingException, StartFolderProvidedException, TerminalEnd, TerminalLaunch, TerminalLauncher, TerminalLaunchRefusedException, TerminalEndedException, TerminalFolderNotFollowedException, TerminalFolderRefusedException, TerminalNotActiveException, TerminalLine, TerminalListener, TerminalOwners, TerminalRun, TerminalRunBusy, TerminalRunEnd, TerminalRunNotFoundException, TerminalRunNotTypedException, TerminalRunOutcome, TerminalRunOutput, TerminalRunRefusedException, TerminalRunTarget, TerminalShellKind, TerminalStartFolder, TerminalTextRun, TerminalTextStyle, TerminalToggle, TerminalWindowException, TerminalWithoutTabException, ToggleProvidedException, windowPart } from "@noldova/terminal.window";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,10 +10,17 @@ export class CompletionCandidate {
|
|
|
10
10
|
label;
|
|
11
11
|
kind;
|
|
12
12
|
closesQuote;
|
|
13
|
-
|
|
13
|
+
description;
|
|
14
|
+
rank;
|
|
15
|
+
constructor(value, label, kind, closesQuote, description = null, rank = 0) {
|
|
14
16
|
this.value = value;
|
|
15
17
|
this.label = label;
|
|
16
18
|
this.kind = kind;
|
|
17
19
|
this.closesQuote = closesQuote;
|
|
20
|
+
this.description = description;
|
|
21
|
+
this.rank = rank;
|
|
22
|
+
}
|
|
23
|
+
ranked(rank) {
|
|
24
|
+
return new CompletionCandidate(this.value, this.label, this.kind, this.closesQuote, this.description, rank);
|
|
18
25
|
}
|
|
19
26
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
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 DescribeGroup {
|
|
9
|
+
names = [];
|
|
10
|
+
answer = Promise.withResolvers();
|
|
11
|
+
}
|
|
@@ -12,12 +12,16 @@ export class EnvironmentTools {
|
|
|
12
12
|
writer;
|
|
13
13
|
access;
|
|
14
14
|
temporaryFolder;
|
|
15
|
-
|
|
15
|
+
signaller;
|
|
16
|
+
pid;
|
|
17
|
+
constructor(starter, runner, reader, writer, access, temporaryFolder, signaller, pid) {
|
|
16
18
|
this.starter = starter;
|
|
17
19
|
this.runner = runner;
|
|
18
20
|
this.reader = reader;
|
|
19
21
|
this.writer = writer;
|
|
20
22
|
this.access = access;
|
|
21
23
|
this.temporaryFolder = temporaryFolder;
|
|
24
|
+
this.signaller = signaller;
|
|
25
|
+
this.pid = pid;
|
|
22
26
|
}
|
|
23
27
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 KnownDescription {
|
|
10
|
+
description;
|
|
11
|
+
failedAt = null;
|
|
12
|
+
constructor(description) {
|
|
13
|
+
this.description = description;
|
|
14
|
+
}
|
|
15
|
+
isFresh(now) {
|
|
16
|
+
return Object.isNull(this.failedAt) || now - this.failedAt < Resources.describeRetryMilliseconds;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -21,10 +21,11 @@ export class TerminalEvents {
|
|
|
21
21
|
commandAdded;
|
|
22
22
|
commandStarted;
|
|
23
23
|
outputStarted;
|
|
24
|
+
outputPrinted;
|
|
24
25
|
commandEnded;
|
|
25
26
|
promptStarted;
|
|
26
27
|
screenChanged;
|
|
27
|
-
constructor(output, exited, restarted, titleChanged, cwdChanged, detached, closed, opened, launchCommandEnded, runOpened, runEnded, renamed, commandAdded, commandStarted, outputStarted, commandEnded, promptStarted, screenChanged) {
|
|
28
|
+
constructor(output, exited, restarted, titleChanged, cwdChanged, detached, closed, opened, launchCommandEnded, runOpened, runEnded, renamed, commandAdded, commandStarted, outputStarted, outputPrinted, commandEnded, promptStarted, screenChanged) {
|
|
28
29
|
this.output = output;
|
|
29
30
|
this.exited = exited;
|
|
30
31
|
this.restarted = restarted;
|
|
@@ -40,6 +41,7 @@ export class TerminalEvents {
|
|
|
40
41
|
this.commandAdded = commandAdded;
|
|
41
42
|
this.commandStarted = commandStarted;
|
|
42
43
|
this.outputStarted = outputStarted;
|
|
44
|
+
this.outputPrinted = outputPrinted;
|
|
43
45
|
this.commandEnded = commandEnded;
|
|
44
46
|
this.promptStarted = promptStarted;
|
|
45
47
|
this.screenChanged = screenChanged;
|
|
@@ -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 ToolCommand {
|
|
9
|
+
name;
|
|
10
|
+
words;
|
|
11
|
+
constructor(name, words) {
|
|
12
|
+
this.name = name;
|
|
13
|
+
this.words = words;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -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 ToolWord {
|
|
9
|
+
name;
|
|
10
|
+
description;
|
|
11
|
+
constructor(name, description) {
|
|
12
|
+
this.name = name;
|
|
13
|
+
this.description = description;
|
|
14
|
+
}
|
|
15
|
+
}
|