@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
@@ -0,0 +1,467 @@
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
+ /**
10
+ * The terminal module's window part, which comes from its own package, `@noldova/terminal.window`, that this package pins exactly.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { windowPart } from "@noldova/terminal/window";
15
+ *
16
+ * console.log(windowPart.moduleId);
17
+ * ```
18
+ */
19
+ export { windowPart } from "@noldova/terminal.window";
20
+
21
+ /**
22
+ * The folder an app starts new terminals in, from `@noldova/terminal.window`.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * import type { IWindowPartContext } from "@noldova/desktop.window";
27
+ * import { TerminalStartFolder } from "@noldova/terminal/window";
28
+ *
29
+ * export function provideProjectFolder(context: IWindowPartContext): () => void {
30
+ * const unregister: () => void = TerminalStartFolder.provide(context, () => "/work/project");
31
+ * return unregister;
32
+ * }
33
+ * ```
34
+ */
35
+ export { TerminalStartFolder } from "@noldova/terminal.window";
36
+
37
+ /**
38
+ * The base of every exception the window part throws, from `@noldova/terminal.window`.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * import { TerminalNotActiveException, TerminalWindowException } from "@noldova/terminal/window";
43
+ *
44
+ * console.log(new TerminalNotActiveException() instanceof TerminalWindowException);
45
+ * ```
46
+ */
47
+ export { TerminalWindowException } from "@noldova/terminal.window";
48
+
49
+ /**
50
+ * Thrown when a window that already has a start folder provider is given another, from `@noldova/terminal.window`.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * import { StartFolderProvidedException } from "@noldova/terminal/window";
55
+ *
56
+ * console.log(new StartFolderProvidedException().name);
57
+ * ```
58
+ */
59
+ export { StartFolderProvidedException } from "@noldova/terminal.window";
60
+
61
+ /**
62
+ * What an app ties a window's terminals to, such as its chats, from `@noldova/terminal.window`.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * import type { IWindowPartContext } from "@noldova/desktop.window";
67
+ * import { TerminalOwners } from "@noldova/terminal/window";
68
+ *
69
+ * export function provideChatOwners(context: IWindowPartContext): TerminalOwners {
70
+ * const owners = TerminalOwners.provide(context, () => "example.chat/42");
71
+ * return owners;
72
+ * }
73
+ * ```
74
+ */
75
+ export { TerminalOwners } from "@noldova/terminal.window";
76
+
77
+ /**
78
+ * Thrown when a window that already has an owners provider is given another, from `@noldova/terminal.window`.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * import { OwnersProvidedException } from "@noldova/terminal/window";
83
+ *
84
+ * console.log(new OwnersProvidedException().name);
85
+ * ```
86
+ */
87
+ export { OwnersProvidedException } from "@noldova/terminal.window";
88
+
89
+ /**
90
+ * The base of every refusal of a run of an app's commands, before anything opens or is typed, from `@noldova/terminal.window`.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * import { RunPartInactiveException, TerminalRunRefusedException } from "@noldova/terminal/window";
95
+ *
96
+ * console.log(new RunPartInactiveException() instanceof TerminalRunRefusedException);
97
+ * ```
98
+ */
99
+ export { TerminalRunRefusedException } from "@noldova/terminal.window";
100
+
101
+ /**
102
+ * Thrown when a run is refused because Terminal's window part isn't active in the window, from `@noldova/terminal.window`.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * import { RunPartInactiveException } from "@noldova/terminal/window";
107
+ *
108
+ * console.log(new RunPartInactiveException().message);
109
+ * ```
110
+ */
111
+ export { RunPartInactiveException } from "@noldova/terminal.window";
112
+
113
+ /**
114
+ * Thrown when a run is refused for one of its arguments, naming the parameter and why, from `@noldova/terminal.window`.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * import { RunArgumentRefusedException } from "@noldova/terminal/window";
119
+ *
120
+ * console.log(new RunArgumentRefusedException("owner", "Expected a string that is not blank.").parameter);
121
+ * ```
122
+ */
123
+ export { RunArgumentRefusedException } from "@noldova/terminal.window";
124
+
125
+ /**
126
+ * Thrown when a run is refused because no installed shell is of the kinds it takes, from `@noldova/terminal.window`.
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * import { RunShellKindsMissingException, TerminalShellKind } from "@noldova/terminal/window";
131
+ *
132
+ * console.log(new RunShellKindsMissingException([TerminalShellKind.Bash, TerminalShellKind.Zsh]).message);
133
+ * ```
134
+ */
135
+ export { RunShellKindsMissingException } from "@noldova/terminal.window";
136
+
137
+ /**
138
+ * Thrown when the number of a run's output lines asked for isn't a whole number in its range, from `@noldova/terminal.window`.
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * import { RunLinesRefusedException, TerminalOwners } from "@noldova/terminal/window";
143
+ *
144
+ * console.log(new RunLinesRefusedException(0, TerminalOwners.maximumRunLines).lines);
145
+ * ```
146
+ */
147
+ export { RunLinesRefusedException } from "@noldova/terminal.window";
148
+
149
+ /**
150
+ * Thrown when a run picked, opened or was given a terminal but its commands weren't typed, saying why, from `@noldova/terminal.window`.
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * import { TerminalRunNotTypedException, TerminalRunOutcome } from "@noldova/terminal/window";
155
+ *
156
+ * console.log(new TerminalRunNotTypedException("session-1", TerminalRunOutcome.Input).reason);
157
+ * ```
158
+ */
159
+ export { TerminalRunNotTypedException } from "@noldova/terminal.window";
160
+
161
+ /**
162
+ * What became of a run's commands: `Typed`, `Input`, `Tab`, `Ended`, `NoShell` or `Busy`, from `@noldova/terminal.window`.
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * import { TerminalRunOutcome } from "@noldova/terminal/window";
167
+ *
168
+ * console.log(TerminalRunOutcome.Tab);
169
+ * ```
170
+ */
171
+ export { TerminalRunOutcome } from "@noldova/terminal.window";
172
+
173
+ /**
174
+ * A run an app started: the terminal its commands went into and the run's id, which reads its output, from `@noldova/terminal.window`.
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * import { TerminalRun } from "@noldova/terminal/window";
179
+ *
180
+ * console.log(new TerminalRun("session-1", "run-1").runId);
181
+ * ```
182
+ */
183
+ export { TerminalRun } from "@noldova/terminal.window";
184
+
185
+ /**
186
+ * How a run's commands ended, which a run's `ended` gives, from `@noldova/terminal.window`.
187
+ *
188
+ * @example
189
+ * ```ts
190
+ * import { TerminalRunEnd } from "@noldova/terminal/window";
191
+ *
192
+ * console.log(new TerminalRunEnd("Command", 0).exitCode);
193
+ * ```
194
+ */
195
+ export { TerminalRunEnd } from "@noldova/terminal.window";
196
+
197
+ /**
198
+ * The terminal a run goes into, and what the run does while its shell is busy, from `@noldova/terminal.window`.
199
+ *
200
+ * @example
201
+ * ```ts
202
+ * import { TerminalRunBusy, TerminalRunTarget } from "@noldova/terminal/window";
203
+ *
204
+ * console.log(new TerminalRunTarget("session-1", TerminalRunBusy.Interrupt).whenBusy);
205
+ * ```
206
+ */
207
+ export { TerminalRunTarget } from "@noldova/terminal.window";
208
+
209
+ /**
210
+ * What a run into a given terminal does while its shell is busy: `Refuse` or `Interrupt`, from `@noldova/terminal.window`.
211
+ *
212
+ * @example
213
+ * ```ts
214
+ * import { TerminalRunBusy } from "@noldova/terminal/window";
215
+ *
216
+ * console.log(TerminalRunBusy.Refuse);
217
+ * ```
218
+ */
219
+ export { TerminalRunBusy } from "@noldova/terminal.window";
220
+
221
+ /**
222
+ * Thrown when the runtime can't give a run's output, from `@noldova/terminal.window`.
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * import { TerminalRunNotFoundException } from "@noldova/terminal/window";
227
+ *
228
+ * console.log(new TerminalRunNotFoundException("session-1", "run-1").sessionId);
229
+ * ```
230
+ */
231
+ export { TerminalRunNotFoundException } from "@noldova/terminal.window";
232
+
233
+ /**
234
+ * A run's output with its colors: its last lines, and how many earlier ones were cut, from `@noldova/terminal.window`.
235
+ *
236
+ * @example
237
+ * ```ts
238
+ * import { TerminalRunOutput } from "@noldova/terminal/window";
239
+ *
240
+ * console.log(new TerminalRunOutput([], 0).cutLines);
241
+ * ```
242
+ */
243
+ export { TerminalRunOutput } from "@noldova/terminal.window";
244
+
245
+ /**
246
+ * A line of a run's output: its text, whether it continues the line before, and its runs of color and style, from
247
+ * `@noldova/terminal.window`.
248
+ *
249
+ * @example
250
+ * ```ts
251
+ * import { TerminalLine } from "@noldova/terminal/window";
252
+ *
253
+ * console.log(new TerminalLine("", false, []).isWrapped);
254
+ * ```
255
+ */
256
+ export { TerminalLine } from "@noldova/terminal.window";
257
+
258
+ /**
259
+ * A run of a line's text in one color and style, from `@noldova/terminal.window`.
260
+ *
261
+ * @example
262
+ * ```ts
263
+ * import { TerminalOwners, TerminalTextRun } from "@noldova/terminal/window";
264
+ *
265
+ * console.log(new TerminalTextRun(2, TerminalOwners.rgbColor + 0xff8800, TerminalOwners.defaultColor, 0).foreground);
266
+ * ```
267
+ */
268
+ export { TerminalTextRun } from "@noldova/terminal.window";
269
+
270
+ /**
271
+ * The style flags of a line's text run, whose sum is the run's style, from `@noldova/terminal.window`.
272
+ *
273
+ * @example
274
+ * ```ts
275
+ * import { TerminalTextStyle } from "@noldova/terminal/window";
276
+ *
277
+ * console.log(TerminalTextStyle.Bold + TerminalTextStyle.Underline);
278
+ * ```
279
+ */
280
+ export { TerminalTextStyle } from "@noldova/terminal.window";
281
+
282
+ /**
283
+ * The kinds of shell a run of an app's commands can ask for, from `@noldova/terminal.window`.
284
+ *
285
+ * @example
286
+ * ```ts
287
+ * import { TerminalShellKind } from "@noldova/terminal/window";
288
+ *
289
+ * console.log([TerminalShellKind.Bash, TerminalShellKind.Zsh]);
290
+ * ```
291
+ */
292
+ export { TerminalShellKind } from "@noldova/terminal.window";
293
+
294
+ /**
295
+ * Opens terminals for an app, with its variables and a notice, and tells it when their shells end, from `@noldova/terminal.window`.
296
+ *
297
+ * @example
298
+ * ```ts
299
+ * import type { IWindowPartContext } from "@noldova/desktop.window";
300
+ * import { TerminalLaunch, TerminalLauncher, type LaunchedTerminal } from "@noldova/terminal/window";
301
+ *
302
+ * export async function launchAgentAsync(context: IWindowPartContext): Promise<LaunchedTerminal> {
303
+ * const launched = await TerminalLauncher.openAsync(context, new TerminalLaunch("/work/project", { AGENT_HOME: "/work/agent" }));
304
+ * return launched;
305
+ * }
306
+ * ```
307
+ */
308
+ export { TerminalLauncher } from "@noldova/terminal.window";
309
+
310
+ /**
311
+ * What an app asks of a terminal it launches, from `@noldova/terminal.window`.
312
+ *
313
+ * @example
314
+ * ```ts
315
+ * import { TerminalLaunch } from "@noldova/terminal/window";
316
+ *
317
+ * console.log(new TerminalLaunch(null).folder);
318
+ * ```
319
+ */
320
+ export { TerminalLaunch } from "@noldova/terminal.window";
321
+
322
+ /**
323
+ * A terminal the launcher opened, with the promise of its end, from `@noldova/terminal.window`.
324
+ *
325
+ * @example
326
+ * ```ts
327
+ * import { LaunchedTerminal, TerminalEnd } from "@noldova/terminal/window";
328
+ *
329
+ * console.log(new LaunchedTerminal("session-1", Promise.resolve(new TerminalEnd("Exit", 0))).sessionId);
330
+ * ```
331
+ */
332
+ export { LaunchedTerminal } from "@noldova/terminal.window";
333
+
334
+ /**
335
+ * How a launched terminal's shell ended, from `@noldova/terminal.window`.
336
+ *
337
+ * @example
338
+ * ```ts
339
+ * import { TerminalEnd } from "@noldova/terminal/window";
340
+ *
341
+ * console.log(new TerminalEnd("Close", null).endedBy);
342
+ * ```
343
+ */
344
+ export { TerminalEnd } from "@noldova/terminal.window";
345
+
346
+ /**
347
+ * The base of every refusal of a launch by the launcher, before anything opens, from `@noldova/terminal.window`.
348
+ *
349
+ * @example
350
+ * ```ts
351
+ * import { LaunchPartInactiveException, TerminalLaunchRefusedException } from "@noldova/terminal/window";
352
+ *
353
+ * console.log(new LaunchPartInactiveException() instanceof TerminalLaunchRefusedException);
354
+ * ```
355
+ */
356
+ export { TerminalLaunchRefusedException } from "@noldova/terminal.window";
357
+
358
+ /**
359
+ * Thrown when a launch is refused because Terminal's window part isn't active in the window, from `@noldova/terminal.window`.
360
+ *
361
+ * @example
362
+ * ```ts
363
+ * import { LaunchPartInactiveException } from "@noldova/terminal/window";
364
+ *
365
+ * console.log(new LaunchPartInactiveException().message);
366
+ * ```
367
+ */
368
+ export { LaunchPartInactiveException } from "@noldova/terminal.window";
369
+
370
+ /**
371
+ * Thrown when a launch is refused because its folder doesn't exist, naming the folder, from `@noldova/terminal.window`.
372
+ *
373
+ * @example
374
+ * ```ts
375
+ * import { LaunchFolderMissingException } from "@noldova/terminal/window";
376
+ *
377
+ * console.log(new LaunchFolderMissingException("/work/gone").folder);
378
+ * ```
379
+ */
380
+ export { LaunchFolderMissingException } from "@noldova/terminal.window";
381
+
382
+ /**
383
+ * Thrown when a launch is refused because its title is longer than the limit, from `@noldova/terminal.window`.
384
+ *
385
+ * @example
386
+ * ```ts
387
+ * import { LaunchTitleRefusedException } from "@noldova/terminal/window";
388
+ *
389
+ * console.log(new LaunchTitleRefusedException(200).maximumLength);
390
+ * ```
391
+ */
392
+ export { LaunchTitleRefusedException } from "@noldova/terminal.window";
393
+
394
+ /**
395
+ * Thrown when a launch is refused because it asks for more minimum rows than the most, from `@noldova/terminal.window`.
396
+ *
397
+ * @example
398
+ * ```ts
399
+ * import { LaunchRowsRefusedException } from "@noldova/terminal/window";
400
+ *
401
+ * console.log(new LaunchRowsRefusedException(100).maximum);
402
+ * ```
403
+ */
404
+ export { LaunchRowsRefusedException } from "@noldova/terminal.window";
405
+
406
+ /**
407
+ * Thrown when a launch is refused because it asks for minimum rows without opening a tab, from `@noldova/terminal.window`.
408
+ *
409
+ * @example
410
+ * ```ts
411
+ * import { LaunchRowsWithoutTabException } from "@noldova/terminal/window";
412
+ *
413
+ * console.log(new LaunchRowsWithoutTabException().message);
414
+ * ```
415
+ */
416
+ export { LaunchRowsWithoutTabException } from "@noldova/terminal.window";
417
+
418
+ /**
419
+ * Thrown when a launch is refused for one of its arguments, naming the parameter and why, from `@noldova/terminal.window`.
420
+ *
421
+ * @example
422
+ * ```ts
423
+ * import { LaunchArgumentRefusedException } from "@noldova/terminal/window";
424
+ *
425
+ * console.log(new LaunchArgumentRefusedException("folder", "Expected an absolute path.").parameter);
426
+ * ```
427
+ */
428
+ export { LaunchArgumentRefusedException } from "@noldova/terminal.window";
429
+
430
+ /**
431
+ * A live terminal session an app shows in its own page, Terminal's own pane in an element the app places, from `@noldova/terminal.window`.
432
+ *
433
+ * @example
434
+ * ```ts
435
+ * import type { EnvironmentInjector } from "@angular/core";
436
+ * import { EmbeddedTerminal } from "@noldova/terminal/window";
437
+ *
438
+ * export function showEmbedded(sessionId: string, environmentInjector: EnvironmentInjector, host: HTMLElement): void {
439
+ * host.append(EmbeddedTerminal.open(sessionId, environmentInjector, 15).element);
440
+ * }
441
+ * ```
442
+ */
443
+ export { EmbeddedTerminal } from "@noldova/terminal.window";
444
+
445
+ /**
446
+ * Thrown when an embedded terminal is asked for rows that aren't a whole number in its range, from `@noldova/terminal.window`.
447
+ *
448
+ * @example
449
+ * ```ts
450
+ * import { EmbeddedRowsRefusedException } from "@noldova/terminal/window";
451
+ *
452
+ * console.log(new EmbeddedRowsRefusedException(0, 1, 1000).rows);
453
+ * ```
454
+ */
455
+ export { EmbeddedRowsRefusedException } from "@noldova/terminal.window";
456
+
457
+ /**
458
+ * Thrown when Terminal's window part isn't active in the window, from `@noldova/terminal.window`.
459
+ *
460
+ * @example
461
+ * ```ts
462
+ * import { TerminalNotActiveException } from "@noldova/terminal/window";
463
+ *
464
+ * console.log(new TerminalNotActiveException().name);
465
+ * ```
466
+ */
467
+ export { TerminalNotActiveException } from "@noldova/terminal.window";
@@ -0,0 +1,8 @@
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 { EmbeddedRowsRefusedException, EmbeddedTerminal, LaunchArgumentRefusedException, LaunchedTerminal, LaunchFolderMissingException, LaunchPartInactiveException, LaunchRowsRefusedException, LaunchRowsWithoutTabException, LaunchTitleRefusedException, OwnersProvidedException, RunArgumentRefusedException, RunLinesRefusedException, RunPartInactiveException, RunShellKindsMissingException, StartFolderProvidedException, TerminalEnd, TerminalLaunch, TerminalLauncher, TerminalLaunchRefusedException, TerminalNotActiveException, TerminalLine, TerminalOwners, TerminalRun, TerminalRunBusy, TerminalRunEnd, TerminalRunNotFoundException, TerminalRunNotTypedException, TerminalRunOutcome, TerminalRunOutput, TerminalRunRefusedException, TerminalRunTarget, TerminalShellKind, TerminalStartFolder, TerminalTextRun, TerminalTextStyle, TerminalWindowException, windowPart } from "@noldova/terminal.window";
@@ -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 const EscapeState = {
9
+ Ground: "Ground",
10
+ Escape: "Escape",
11
+ EscapeIntermediate: "EscapeIntermediate",
12
+ ControlSequence: "ControlSequence",
13
+ OperatingSystemCommand: "OperatingSystemCommand",
14
+ ControlString: "ControlString"
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 const EscapeStripperState = {
9
+ Ground: "Ground",
10
+ Escape: "Escape",
11
+ Intermediate: "Intermediate",
12
+ Control: "Control",
13
+ String: "String",
14
+ StringEscape: "StringEscape"
15
+ };
@@ -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
+ export const MarkKind = {
9
+ PromptStart: "PromptStart",
10
+ PromptEnd: "PromptEnd",
11
+ OutputStart: "OutputStart",
12
+ CommandEnd: "CommandEnd",
13
+ Property: "Property",
14
+ RightPrompt: "RightPrompt",
15
+ ContinuationEnd: "ContinuationEnd",
16
+ Options: "Options",
17
+ Loaded: "Loaded"
18
+ };
@@ -0,0 +1,14 @@
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 const ShellFamily = {
9
+ Bash: "Bash",
10
+ Zsh: "Zsh",
11
+ PowerShell: "PowerShell",
12
+ CommandPrompt: "CommandPrompt",
13
+ Other: "Other"
14
+ };
@@ -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 const SystemRequirement = {
9
+ WindowsBuild: "WindowsBuild",
10
+ Glibc: "Glibc"
11
+ };
@@ -0,0 +1,16 @@
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
+ import { TerminalException } from "./terminal.exception.js";
10
+ export class AgentTerminalRestartException extends TerminalException {
11
+ sessionId;
12
+ constructor(sessionId) {
13
+ super(Resources.formatAgentTerminalRestart(sessionId));
14
+ this.sessionId = sessionId;
15
+ }
16
+ }
@@ -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 { Resources } from "../resources.js";
9
+ import { CommandFailedException } from "./command-failed.exception.js";
10
+ export class CommandExitedException extends CommandFailedException {
11
+ command;
12
+ exitCode;
13
+ signal;
14
+ errorText;
15
+ constructor(command, exit, errorText = "") {
16
+ const text = errorText.replace(Resources.whitespaceRuns, " ").trim();
17
+ super(Resources.formatCommandExited(command, exit.code, exit.signal, text));
18
+ this.command = command;
19
+ this.exitCode = exit.code;
20
+ this.signal = exit.signal;
21
+ this.errorText = text;
22
+ }
23
+ }
@@ -0,0 +1,13 @@
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 { TerminalException } from "./terminal.exception.js";
9
+ export class CommandFailedException extends TerminalException {
10
+ constructor(message, options) {
11
+ super(message, options);
12
+ }
13
+ }
@@ -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
+ import { ExceptionOptions } from "@noldova/context.exceptions";
9
+ import { Resources } from "../resources.js";
10
+ import { CommandFailedException } from "./command-failed.exception.js";
11
+ export class CommandNotStartedException extends CommandFailedException {
12
+ command;
13
+ constructor(command, cause) {
14
+ super(Resources.formatCommandNotStarted(command), new ExceptionOptions(cause));
15
+ this.command = command;
16
+ }
17
+ }
@@ -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
+ import { CommandFailedException } from "./command-failed.exception.js";
10
+ export class CommandOutputTooLongException extends CommandFailedException {
11
+ command;
12
+ limit;
13
+ constructor(command, limit) {
14
+ super(Resources.formatCommandOutputTooLong(command));
15
+ this.command = command;
16
+ this.limit = limit;
17
+ }
18
+ }
@@ -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
+ import { CommandFailedException } from "./command-failed.exception.js";
10
+ export class CommandTimedOutException extends CommandFailedException {
11
+ command;
12
+ timeoutMilliseconds;
13
+ constructor(command, timeoutMilliseconds) {
14
+ super(Resources.formatCommandTimedOut(command, timeoutMilliseconds));
15
+ this.command = command;
16
+ this.timeoutMilliseconds = timeoutMilliseconds;
17
+ }
18
+ }
@@ -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
+ import { CommandFailedException } from "./command-failed.exception.js";
10
+ export class CommandVariableNotSetException extends CommandFailedException {
11
+ command;
12
+ variable;
13
+ constructor(command, variable) {
14
+ super(Resources.formatCommandVariableNotSet(command, variable));
15
+ this.command = command;
16
+ this.variable = variable;
17
+ }
18
+ }