@noldova/terminal 0.0.0-stage → 0.0.2

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 (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -2
  3. package/menus.json +53 -0
  4. package/module.json +28 -0
  5. package/package.json +50 -4
  6. package/settings.json +83 -0
  7. package/src/api/index.d.ts +131 -0
  8. package/src/api/index.js +11 -0
  9. package/src/api/window.d.ts +467 -0
  10. package/src/api/window.js +8 -0
  11. package/src/enums/escape-state.js +15 -0
  12. package/src/enums/escape-stripper-state.js +15 -0
  13. package/src/enums/mark-kind.js +18 -0
  14. package/src/enums/shell-family.js +14 -0
  15. package/src/enums/system-requirement.js +11 -0
  16. package/src/exceptions/agent-terminal-restart.exception.js +16 -0
  17. package/src/exceptions/command-exited.exception.js +23 -0
  18. package/src/exceptions/command-failed.exception.js +13 -0
  19. package/src/exceptions/command-not-started.exception.js +17 -0
  20. package/src/exceptions/command-output-too-long.exception.js +18 -0
  21. package/src/exceptions/command-timed-out.exception.js +18 -0
  22. package/src/exceptions/command-variable-not-set.exception.js +18 -0
  23. package/src/exceptions/default-shell-not-found.exception.js +14 -0
  24. package/src/exceptions/environment-export-invalid.exception.js +14 -0
  25. package/src/exceptions/environment-key-unreadable.exception.js +17 -0
  26. package/src/exceptions/environment-unreadable.exception.js +13 -0
  27. package/src/exceptions/folder-not-found.exception.js +16 -0
  28. package/src/exceptions/host-ended.exception.js +14 -0
  29. package/src/exceptions/session-not-found.exception.js +18 -0
  30. package/src/exceptions/shell-kind-not-found.exception.js +16 -0
  31. package/src/exceptions/shell-not-found.exception.js +18 -0
  32. package/src/exceptions/shells-unreadable.exception.js +13 -0
  33. package/src/exceptions/stored-lines-damaged.exception.js +15 -0
  34. package/src/exceptions/stored-lines-unwritable.exception.js +15 -0
  35. package/src/exceptions/system-root-missing.exception.js +14 -0
  36. package/src/exceptions/terminal.exception.js +13 -0
  37. package/src/exceptions/unknown-method.exception.js +16 -0
  38. package/src/exceptions/unsupported-system.exception.js +18 -0
  39. package/src/exceptions/visual-studio-unreadable.exception.js +15 -0
  40. package/src/exceptions/wsl-distributions-unreadable.exception.js +15 -0
  41. package/src/interfaces/i-command-runner.js +8 -0
  42. package/src/interfaces/i-disposable.js +8 -0
  43. package/src/interfaces/i-environment-source.js +8 -0
  44. package/src/interfaces/i-file-system-reader.js +8 -0
  45. package/src/interfaces/i-file-system-writer.js +8 -0
  46. package/src/interfaces/i-flow-controller-listener.js +8 -0
  47. package/src/interfaces/i-folder-access.js +8 -0
  48. package/src/interfaces/i-line-process-listener.js +8 -0
  49. package/src/interfaces/i-line-process-starter.js +8 -0
  50. package/src/interfaces/i-line-process.js +8 -0
  51. package/src/interfaces/i-output-batcher-listener.js +8 -0
  52. package/src/interfaces/i-process-signaller.js +8 -0
  53. package/src/interfaces/i-pseudo-terminal-listener.js +8 -0
  54. package/src/interfaces/i-pty-exit-event.js +8 -0
  55. package/src/interfaces/i-pty-process.js +8 -0
  56. package/src/interfaces/i-pty-spawner.js +8 -0
  57. package/src/interfaces/i-terminal-mirror-listener.js +8 -0
  58. package/src/interfaces/i-terminal-session-listener.js +8 -0
  59. package/src/interfaces/i-waiting-options-request.js +8 -0
  60. package/src/models/command-listing.js +17 -0
  61. package/src/models/completion-candidate.js +19 -0
  62. package/src/models/environment-tools.js +23 -0
  63. package/src/models/environment-variable.js +15 -0
  64. package/src/models/folder-entry.js +15 -0
  65. package/src/models/hosted-terminal.js +116 -0
  66. package/src/models/mirror-line.js +27 -0
  67. package/src/models/mirror-snapshot.js +19 -0
  68. package/src/models/one-shot-launch.js +42 -0
  69. package/src/models/pane-progress.js +15 -0
  70. package/src/models/powershell-cmdlet.js +21 -0
  71. package/src/models/powershell-lookup.js +17 -0
  72. package/src/models/powershell-parameter.js +19 -0
  73. package/src/models/registry-value.js +15 -0
  74. package/src/models/request-client.js +23 -0
  75. package/src/models/saved-terminal.js +25 -0
  76. package/src/models/shell-launch.js +23 -0
  77. package/src/models/shell-line.js +21 -0
  78. package/src/models/shell-mark.js +19 -0
  79. package/src/models/shell-options-reply.js +17 -0
  80. package/src/models/shell.js +29 -0
  81. package/src/models/started-shell.js +21 -0
  82. package/src/models/system-shortfall.js +15 -0
  83. package/src/models/terminal-events.js +37 -0
  84. package/src/models/terminal-history-paths.js +15 -0
  85. package/src/models/terminal-prompt.js +28 -0
  86. package/src/models/tracked-command.js +26 -0
  87. package/src/models/typed-line.js +40 -0
  88. package/src/models/visual-studio-installation.js +22 -0
  89. package/src/models/waiting-run.js +25 -0
  90. package/src/resources.js +1725 -0
  91. package/src/runtime-part.js +84 -0
  92. package/src/services/agent-terminal.js +137 -0
  93. package/src/services/agent-terminals.js +55 -0
  94. package/src/services/bounded-reads.js +57 -0
  95. package/src/services/change-signal.js +33 -0
  96. package/src/services/command-history.js +20 -0
  97. package/src/services/command-runner.js +67 -0
  98. package/src/services/command-tracker.js +161 -0
  99. package/src/services/completion-source.js +316 -0
  100. package/src/services/context-pty-process.js +79 -0
  101. package/src/services/context-pty-spawner.js +26 -0
  102. package/src/services/deferred-pty-process.js +94 -0
  103. package/src/services/escape-sequence-tracker.js +126 -0
  104. package/src/services/escape-stripper.js +91 -0
  105. package/src/services/failure-text.js +15 -0
  106. package/src/services/file-system-writer.js +35 -0
  107. package/src/services/file-system.reader.js +54 -0
  108. package/src/services/flow-controller.js +102 -0
  109. package/src/services/folder-access.js +19 -0
  110. package/src/services/inherited-environment.js +20 -0
  111. package/src/services/line-process-starter.js +17 -0
  112. package/src/services/line-process.js +72 -0
  113. package/src/services/log-file.js +57 -0
  114. package/src/services/mac-environment.js +81 -0
  115. package/src/services/mac-folder-access.js +17 -0
  116. package/src/services/mark-scanner.js +94 -0
  117. package/src/services/one-shot-command.js +119 -0
  118. package/src/services/output-batcher.js +62 -0
  119. package/src/services/output-log.js +50 -0
  120. package/src/services/powershell-binding.js +61 -0
  121. package/src/services/process-signaller.js +19 -0
  122. package/src/services/pseudo-terminal.js +54 -0
  123. package/src/services/registry-export.js +108 -0
  124. package/src/services/resize-wakeup.js +39 -0
  125. package/src/services/saved-terminals.js +52 -0
  126. package/src/services/shared-reads.js +41 -0
  127. package/src/services/shell-command.js +90 -0
  128. package/src/services/shell-environment.js +20 -0
  129. package/src/services/shell-integration.js +207 -0
  130. package/src/services/shell-locator.js +177 -0
  131. package/src/services/shell-options-queue.js +34 -0
  132. package/src/services/shell-words.js +80 -0
  133. package/src/services/system-requirements.js +46 -0
  134. package/src/services/terminal-audience.js +83 -0
  135. package/src/services/terminal-history-folder.js +97 -0
  136. package/src/services/terminal-history-segment.js +109 -0
  137. package/src/services/terminal-history.js +130 -0
  138. package/src/services/terminal-host.js +931 -0
  139. package/src/services/terminal-line-reader.js +101 -0
  140. package/src/services/terminal-mirror.js +221 -0
  141. package/src/services/terminal-owner.service.js +27 -0
  142. package/src/services/terminal-session.js +398 -0
  143. package/src/services/visual-studio.reader.js +76 -0
  144. package/src/services/windows-environment.js +218 -0
  145. package/src/services/windows-folder-access.js +23 -0
  146. package/src/services/wsl-distribution.reader.js +49 -0
  147. package/src/services/xterm-headless-loader.js +14 -0
  148. package/src/tools/enums/command-status.js +13 -0
  149. package/src/tools/enums/run-method.js +11 -0
  150. package/src/tools/exceptions/abort-reason-unknown.exception.js +17 -0
  151. package/src/tools/exceptions/stale-terminal.exception.js +16 -0
  152. package/src/tools/interfaces/i-agent-command.js +8 -0
  153. package/src/tools/interfaces/i-agent-terminal.js +8 -0
  154. package/src/tools/interfaces/i-agent-terminals.js +8 -0
  155. package/src/tools/interfaces/i-output-source.js +8 -0
  156. package/src/tools/interfaces/i-terminal-prompt.js +8 -0
  157. package/src/tools/models/agent-terminal-access.js +25 -0
  158. package/src/tools/models/agent-terminal-opening.js +29 -0
  159. package/src/tools/models/command-line.js +28 -0
  160. package/src/tools/models/key-sequence.js +27 -0
  161. package/src/tools/models/output-chunk.js +18 -0
  162. package/src/tools/models/output-excerpt.js +31 -0
  163. package/src/tools/models/permission-ask.js +34 -0
  164. package/src/tools/models/read-cursor.js +26 -0
  165. package/src/tools/models/read-cursors.js +25 -0
  166. package/src/tools/models/terminal-open-input.js +34 -0
  167. package/src/tools/models/terminal-output-report.js +61 -0
  168. package/src/tools/models/terminal-read-input.js +39 -0
  169. package/src/tools/models/terminal-run-input.js +52 -0
  170. package/src/tools/models/terminal-target-input.js +34 -0
  171. package/src/tools/models/terminal-write-input.js +38 -0
  172. package/src/tools/models/tool-call-context.js +61 -0
  173. package/src/tools/services/abort-reason-reader.js +25 -0
  174. package/src/tools/services/permission-details.js +42 -0
  175. package/src/tools/services/permission-gate.js +35 -0
  176. package/src/tools/services/signal-race.js +24 -0
  177. package/src/tools/services/terminal-access-policy.js +57 -0
  178. package/src/tools/services/terminal-close-tool.js +57 -0
  179. package/src/tools/services/terminal-interrupt-tool.js +57 -0
  180. package/src/tools/services/terminal-list-tool.js +69 -0
  181. package/src/tools/services/terminal-open-tool.js +71 -0
  182. package/src/tools/services/terminal-read-tool.js +58 -0
  183. package/src/tools/services/terminal-run-tool.js +78 -0
  184. package/src/tools/services/terminal-text-escaper.js +40 -0
  185. package/src/tools/services/terminal-tool.js +47 -0
  186. package/src/tools/services/terminal-tools.js +60 -0
  187. package/src/tools/services/terminal-write-tool.js +75 -0
  188. package/src/tools/services/tool-failures.js +28 -0
  189. package/src/tools/services/tool-results.js +13 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Noldova
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,11 @@
1
- # Temporary Holding Version
1
+ # @noldova/terminal
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The terminal module for apps on [Noldova Desktop](https://github.com/noldova-com/desktop): terminal panes over real shells, and agent tools that run commands through permission requests.
4
+ It holds the module's `module.json`, `menus.json` and `settings.json`, and its runtime part, which starts the shells in Noldova Desktop's pseudo-terminals, keeps a headless mirror of each terminal and registers the agent tools.
5
+
6
+ It exports `./runtime`, the runtime part, and `./window`, which re-exports the published API of the window part, [`@noldova/terminal.window`](https://github.com/noldova-com/terminal/tree/main/src/noldova.terminal.window).
7
+ It pins that package and [`@noldova/terminal.protocol`](https://github.com/noldova-com/terminal/tree/main/src/noldova.terminal.protocol) at its own version.
8
+
9
+ An app installs it pinned exactly and lists it in `desktop.modules`, as [documents/INTEGRATION.md](https://github.com/noldova-com/terminal/blob/main/documents/INTEGRATION.md) says.
10
+ [documents/ARCHITECTURE.md](https://github.com/noldova-com/terminal/blob/main/documents/ARCHITECTURE.md) says how it is built, and the [README](https://github.com/noldova-com/terminal#readme) how to build and test it.
11
+ It is licensed under the [MIT License](https://github.com/noldova-com/terminal/blob/main/LICENSE).
package/menus.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "places": [
3
+ {
4
+ "name": "terminal.tabRow",
5
+ "title": "Terminal"
6
+ },
7
+ {
8
+ "name": "terminal.shellMenu",
9
+ "title": "Choose a shell"
10
+ }
11
+ ],
12
+ "groups": [
13
+ {
14
+ "name": "terminal.tabRowActions",
15
+ "place": "terminal.tabRow",
16
+ "items": [
17
+ {
18
+ "command": "terminal.new",
19
+ "arguments": { "takesNewOwner": true },
20
+ "label": "New terminal"
21
+ },
22
+ {
23
+ "submenu": "terminal.shellMenu"
24
+ }
25
+ ]
26
+ },
27
+ {
28
+ "name": "terminal.shellList",
29
+ "place": "terminal.shellMenu",
30
+ "dynamic": true
31
+ },
32
+ {
33
+ "name": "terminal.tabActions",
34
+ "place": "desktop.tab",
35
+ "items": [
36
+ {
37
+ "command": "terminal.restartShell",
38
+ "label": "Restart"
39
+ }
40
+ ]
41
+ },
42
+ {
43
+ "name": "terminal.viewActions",
44
+ "place": "desktop.view",
45
+ "items": [
46
+ {
47
+ "command": "terminal.new",
48
+ "label": "New Terminal"
49
+ }
50
+ ]
51
+ }
52
+ ]
53
+ }
package/module.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "id": "terminal",
3
+ "version": "0.0.2",
4
+ "displayName": "Terminal",
5
+ "description": "Runs shells in terminal panes, and lets AI agents run commands in them through permission requests.",
6
+ "parts": ["runtime", "window"],
7
+ "pseudoTerminals": true,
8
+ "dependencies": {},
9
+ "noldovaDesktop": ">=0.0.1 <0.1.0",
10
+ "contributes": {
11
+ "methods": [
12
+ "terminal.shells", "terminal.open", "terminal.close", "terminal.restart", "terminal.sessions", "terminal.attach", "terminal.input", "terminal.resize",
13
+ "terminal.ack", "terminal.visibility", "terminal.detach", "terminal.lines", "terminal.restore", "terminal.closeOwner", "terminal.launch",
14
+ "terminal.run", "terminal.runOutput", "terminal.windowStarted", "terminal.showOwner", "terminal.rename",
15
+ "terminal.complete", "terminal.findCommands"
16
+ ],
17
+ "events": [
18
+ "terminal.output", "terminal.exited", "terminal.restarted", "terminal.titleChanged", "terminal.cwdChanged", "terminal.detached",
19
+ "terminal.closed", "terminal.opened", "terminal.launchCommandEnded", "terminal.runOpened", "terminal.runEnded",
20
+ "terminal.renamed", "terminal.commandAdded"
21
+ ],
22
+ "commands": ["terminal.new", "terminal.newWithShell", "terminal.toggle", "terminal.restartShell"],
23
+ "menus": ["terminal.tabRow", "terminal.shellMenu"],
24
+ "settings": ["terminal.defaultShell", "terminal.outputLimit", "terminal.fontSize", "terminal.suggestions", "terminal.commandColors", "terminal.completionList"],
25
+ "views": ["terminal.panel", "terminal.session"],
26
+ "tools": ["terminal_list", "terminal_read", "terminal_open", "terminal_run", "terminal_write", "terminal_interrupt", "terminal_close"]
27
+ }
28
+ }
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@noldova/terminal",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.2",
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
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/noldova-com/terminal.git",
10
+ "directory": "src/noldova.terminal"
11
+ },
12
+ "homepage": "https://github.com/noldova-com/terminal#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/noldova-com/terminal/issues"
15
+ },
16
+ "exports": {
17
+ "./runtime": {
18
+ "types": "./src/api/index.d.ts",
19
+ "default": "./src/api/index.js"
20
+ },
21
+ "./window": {
22
+ "types": "./src/api/window.d.ts",
23
+ "default": "./src/api/window.js"
24
+ },
25
+ "./package.json": "./package.json"
26
+ },
27
+ "files": [
28
+ "module.json",
29
+ "settings.json",
30
+ "menus.json",
31
+ "src/**/*.js",
32
+ "src/**/*.d.ts"
33
+ ],
34
+ "publishConfig": {
35
+ "access": "public",
36
+ "registry": "https://registry.npmjs.org/"
37
+ },
38
+ "dependencies": {
39
+ "@noldova/terminal.protocol": "0.0.2",
40
+ "@noldova/terminal.window": "0.0.2",
41
+ "@xterm/addon-serialize": "0.14.0",
42
+ "@xterm/headless": "6.0.0",
43
+ "node-pty": "1.2.0-beta.15"
44
+ },
45
+ "peerDependencies": {
46
+ "@noldova/desktop.protocol": ">=0.0.1 <0.1.0",
47
+ "@noldova/desktop.runtime": ">=0.0.1 <0.1.0",
48
+ "@noldova/context.exceptions": ">=0.0.7 <0.1.0",
49
+ "@noldova/context.json": ">=0.0.7 <0.1.0"
50
+ },
51
+ "gitHead": "316039e0b0bb4b5b351742560f9053dd72d7c1eb"
52
+ }
package/settings.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "settings": [
3
+ {
4
+ "name": "terminal.defaultShell",
5
+ "title": "Default shell",
6
+ "description": "What a new terminal runs. The menu beside + in a terminal tab row opens any other shell.",
7
+ "type": {
8
+ "kind": "Choice",
9
+ "dynamic": true
10
+ },
11
+ "default": "",
12
+ "locality": "Device",
13
+ "scopes": [],
14
+ "page": "Terminal",
15
+ "group": "Terminal"
16
+ },
17
+ {
18
+ "name": "terminal.outputLimit",
19
+ "title": "Output kept per terminal (MB)",
20
+ "description": "How much of a terminal's output you can scroll back through. Beyond it the oldest lines are dropped. Applies to terminals opened afterwards.",
21
+ "type": {
22
+ "kind": "Number",
23
+ "minimum": 10,
24
+ "maximum": 10000,
25
+ "step": 1
26
+ },
27
+ "default": 100,
28
+ "locality": "Shared",
29
+ "scopes": [],
30
+ "page": "Terminal",
31
+ "group": "Terminal"
32
+ },
33
+ {
34
+ "name": "terminal.fontSize",
35
+ "title": "Font size",
36
+ "description": "The size of the text in every terminal, in pixels. No text size under Appearance changes it.",
37
+ "type": {
38
+ "kind": "Number",
39
+ "minimum": 8,
40
+ "maximum": 32,
41
+ "step": 1
42
+ },
43
+ "default": 13,
44
+ "locality": "Device",
45
+ "scopes": [],
46
+ "page": "Terminal",
47
+ "group": "Terminal"
48
+ },
49
+ {
50
+ "name": "terminal.suggestions",
51
+ "title": "Suggest earlier commands",
52
+ "description": "Whether a terminal shows the rest of an earlier command in grey as you type at a bash, zsh or PowerShell prompt. → or End at the line's end takes it.",
53
+ "type": { "kind": "Boolean" },
54
+ "default": true,
55
+ "locality": "Shared",
56
+ "scopes": [],
57
+ "page": "Terminal",
58
+ "group": "Terminal"
59
+ },
60
+ {
61
+ "name": "terminal.commandColors",
62
+ "title": "Color typed commands",
63
+ "description": "Whether a terminal colors the command you type at a bash, zsh or PowerShell prompt: its name, options, strings, paths, variables, operators, keywords and comments. Text the shell colors itself keeps its own colors.",
64
+ "type": { "kind": "Boolean" },
65
+ "default": false,
66
+ "locality": "Shared",
67
+ "scopes": [],
68
+ "page": "Terminal",
69
+ "group": "Terminal"
70
+ },
71
+ {
72
+ "name": "terminal.completionList",
73
+ "title": "Complete with a list",
74
+ "description": "Whether Tab at a bash, zsh or PowerShell prompt opens a list of what can follow: files, folders, commands, branches, scripts and a command's options. Turned off, Tab goes to the shell, which completes as it does on its own.",
75
+ "type": { "kind": "Boolean" },
76
+ "default": true,
77
+ "locality": "Shared",
78
+ "scopes": [],
79
+ "page": "Terminal",
80
+ "group": "Terminal"
81
+ }
82
+ ]
83
+ }
@@ -0,0 +1,131 @@
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
+
9
+ import type { Exception, ExceptionOptions } from "@noldova/context.exceptions";
10
+ import type { IRuntimePart, IRuntimePartContext, Migration } from "@noldova/desktop.runtime";
11
+
12
+ /**
13
+ * The system requirements the runtime part checks before it starts: a Windows build, or the glibc version on Linux.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { SystemRequirement } from "@noldova/terminal/runtime";
18
+ *
19
+ * console.log(SystemRequirement.Glibc);
20
+ * ```
21
+ */
22
+ export declare const SystemRequirement: {
23
+ /** Windows build 17763 or later. */
24
+ readonly WindowsBuild: "WindowsBuild";
25
+ /** glibc 2.28 or later, on Linux. */
26
+ readonly Glibc: "Glibc";
27
+ };
28
+
29
+ /**
30
+ * A system requirement: `WindowsBuild` or `Glibc`.
31
+ */
32
+ export type SystemRequirement = (typeof SystemRequirement)[keyof typeof SystemRequirement];
33
+
34
+ /**
35
+ * The base of every exception the terminal module's runtime part throws.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * import { SystemRequirement, TerminalException, UnsupportedSystemException } from "@noldova/terminal/runtime";
40
+ *
41
+ * console.log(new UnsupportedSystemException(SystemRequirement.Glibc, "2.27") instanceof TerminalException);
42
+ * ```
43
+ */
44
+ export declare class TerminalException extends Exception {
45
+ /**
46
+ * @param message The exception's message.
47
+ * @param options Its cause, if any.
48
+ */
49
+ public constructor(message: string, options?: ExceptionOptions);
50
+ }
51
+
52
+ /**
53
+ * The runtime part refused to start on a system below its minimums: Windows below build 17763, or Linux below glibc 2.28.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * import { SystemRequirement, UnsupportedSystemException } from "@noldova/terminal/runtime";
58
+ *
59
+ * console.log(new UnsupportedSystemException(SystemRequirement.WindowsBuild, "17134").message);
60
+ * ```
61
+ */
62
+ export declare class UnsupportedSystemException extends TerminalException {
63
+ /** The requirement the system is below. */
64
+ public readonly requirement: SystemRequirement;
65
+
66
+ /** What the system has: its Windows build or its glibc version. */
67
+ public readonly found: string;
68
+
69
+ /**
70
+ * @param requirement The requirement the system is below.
71
+ * @param found What the system has.
72
+ */
73
+ public constructor(requirement: SystemRequirement, found: string);
74
+ }
75
+
76
+ /**
77
+ * The terminal module's runtime part, which Noldova Desktop's runtime loads and activates.
78
+ *
79
+ * @remarks
80
+ * Each terminal runs a shell in a pseudo-terminal and keeps its screen and scrollback in a headless mirror,
81
+ * which answers the shell's terminal queries while no window is attached.
82
+ * Output goes to windows in numbered batches, and the shell pauses while an attached, visible pane is too far behind.
83
+ */
84
+ export declare class RuntimePart implements IRuntimePart {
85
+ /**
86
+ * The module database's migrations: a table of the person's terminals, which
87
+ * the next run opens again through `terminal.restore`.
88
+ */
89
+ public readonly migrations: readonly Migration[];
90
+
91
+ /**
92
+ * Registers the `terminal.*` methods, declares the `terminal.*` events and publishes the `terminal.owners` service,
93
+ * which a module's runtime part reads with `getService("terminal.owners", RuntimeTerminalOwners)`, through `@noldova/terminal.protocol`'s contract.
94
+ *
95
+ * @param context The runtime's context for this part; its log receives shells that do not end in time.
96
+ * @returns A promise that resolves once every method is registered.
97
+ * @throws {@link UnsupportedSystemException} Through the promise, after writing the reason to the context's log, on Windows below build 17763 or
98
+ * Linux below glibc 2.28.
99
+ * @example
100
+ * ```ts
101
+ * import type { IRuntimePartContext } from "@noldova/desktop.runtime";
102
+ * import { RuntimePart } from "@noldova/terminal/runtime";
103
+ *
104
+ * export async function startTerminalAsync(context: IRuntimePartContext): Promise<RuntimePart> {
105
+ * const part = new RuntimePart();
106
+ * await part.activateAsync(context);
107
+ * return part;
108
+ * }
109
+ * ```
110
+ */
111
+ public activateAsync(context: IRuntimePartContext): Promise<void>;
112
+
113
+ /**
114
+ * Ends every terminal's shell and forgets every terminal.
115
+ *
116
+ * @returns A promise that resolves once every shell has ended or its grace has run out; it never rejects.
117
+ * Calling it again, or before {@link RuntimePart.activateAsync}, does nothing.
118
+ * @example
119
+ * ```ts
120
+ * import type { IRuntimePartContext } from "@noldova/desktop.runtime";
121
+ * import { RuntimePart } from "@noldova/terminal/runtime";
122
+ *
123
+ * export async function runTerminalOnceAsync(context: IRuntimePartContext): Promise<void> {
124
+ * const part = new RuntimePart();
125
+ * await part.activateAsync(context);
126
+ * await part.deactivateAsync();
127
+ * }
128
+ * ```
129
+ */
130
+ public deactivateAsync(): Promise<void>;
131
+ }
@@ -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 { SystemRequirement } from "../enums/system-requirement.js";
9
+ export { TerminalException } from "../exceptions/terminal.exception.js";
10
+ export { UnsupportedSystemException } from "../exceptions/unsupported-system.exception.js";
11
+ export { RuntimePart } from "../runtime-part.js";