dsh-bash-terminal-ts 0.2.6 → 0.4.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/README.en.md +197 -197
- package/README.ja.md +196 -196
- package/README.ko.md +194 -194
- package/README.md +194 -194
- package/cordis.patch.yml +5 -5
- package/dist/client.core.js +132 -132
- package/dist/client.js +141 -141
- package/dsh.plugin.json +22 -22
- package/lib/dsh-types.d.ts +260 -260
- package/lib/dsh.d.ts +33 -33
- package/lib/index.d.ts +201 -201
- package/lib/index.js +759 -759
- package/lib/terminal.d.ts +87 -87
- package/lib/terminal.js +273 -273
- package/package.json +18 -16
package/lib/terminal.d.ts
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import type { BashTerminalContext, ResolvedPaths, TerminalHandle } from "./dsh-types.js";
|
|
2
|
-
declare const TERMINAL_SIGNALS: readonly ["SIGINT", "SIGTERM", "SIGKILL", "SIGTSTP", "SIGHUP"];
|
|
3
|
-
export type TerminalSignal = (typeof TERMINAL_SIGNALS)[number];
|
|
4
|
-
interface TerminalBufferRead {
|
|
5
|
-
delta: string;
|
|
6
|
-
nextOffset: number;
|
|
7
|
-
}
|
|
8
|
-
interface TerminalBuffer {
|
|
9
|
-
append(chunk: string): void;
|
|
10
|
-
readFrom(offset: number): TerminalBufferRead;
|
|
11
|
-
snapshot(): string;
|
|
12
|
-
}
|
|
13
|
-
/** Interactive-shell argv (no -c: the terminal itself is the session). */
|
|
14
|
-
export declare function terminalArgv(shell: string, paths: ResolvedPaths, distro?: string): Array<string | undefined>;
|
|
15
|
-
interface TerminalSession {
|
|
16
|
-
id: string;
|
|
17
|
-
handle: TerminalHandle;
|
|
18
|
-
buffer: TerminalBuffer;
|
|
19
|
-
shell: string;
|
|
20
|
-
distro?: string;
|
|
21
|
-
closed: boolean;
|
|
22
|
-
}
|
|
23
|
-
export interface TerminalOpenOptions {
|
|
24
|
-
argv: string[];
|
|
25
|
-
shell: string;
|
|
26
|
-
cwd: string;
|
|
27
|
-
env: Record<string, string | undefined>;
|
|
28
|
-
rows: number;
|
|
29
|
-
cols: number;
|
|
30
|
-
distro?: string;
|
|
31
|
-
initial?: string;
|
|
32
|
-
}
|
|
33
|
-
export interface TerminalRegistry {
|
|
34
|
-
open(options: TerminalOpenOptions): Promise<TerminalSession>;
|
|
35
|
-
get(id: string): TerminalSession;
|
|
36
|
-
send(id: string, input: string): Promise<TerminalBufferRead>;
|
|
37
|
-
read(id: string): TerminalBufferRead;
|
|
38
|
-
signal(id: string, sig: string): Promise<TerminalBufferRead>;
|
|
39
|
-
close(id: string): Promise<boolean>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Terminal-session registry owned by the plugin fiber: opens PTYs through
|
|
43
|
-
* the official seam, forwards output into a capped buffer, and tears every
|
|
44
|
-
* session down on plugin disposal.
|
|
45
|
-
*/
|
|
46
|
-
export declare function createTerminalRegistry(ctx: BashTerminalContext): TerminalRegistry;
|
|
47
|
-
/** The terminal tool's arguments after runtime validation (discriminated by action). */
|
|
48
|
-
export type ValidatedTerminalArgs = {
|
|
49
|
-
action: "open";
|
|
50
|
-
sessionId?: string;
|
|
51
|
-
command?: string;
|
|
52
|
-
distro?: string;
|
|
53
|
-
workdir?: string;
|
|
54
|
-
} | {
|
|
55
|
-
action: "send";
|
|
56
|
-
sessionId: string;
|
|
57
|
-
input: string;
|
|
58
|
-
} | {
|
|
59
|
-
action: "read";
|
|
60
|
-
sessionId: string;
|
|
61
|
-
} | {
|
|
62
|
-
action: "signal";
|
|
63
|
-
sessionId: string;
|
|
64
|
-
signal: TerminalSignal;
|
|
65
|
-
} | {
|
|
66
|
-
action: "close";
|
|
67
|
-
sessionId: string;
|
|
68
|
-
};
|
|
69
|
-
export declare function validateArgs(args: Record<string, unknown>): asserts args is ValidatedTerminalArgs;
|
|
70
|
-
export interface TerminalOpenResult {
|
|
71
|
-
kind: "open";
|
|
72
|
-
sessionId: string;
|
|
73
|
-
pid: number;
|
|
74
|
-
shell: string;
|
|
75
|
-
output: string;
|
|
76
|
-
}
|
|
77
|
-
export interface TerminalSessionResult {
|
|
78
|
-
kind: "session";
|
|
79
|
-
output: string;
|
|
80
|
-
}
|
|
81
|
-
export interface TerminalClosedResult {
|
|
82
|
-
kind: "closed";
|
|
83
|
-
sessionId: string;
|
|
84
|
-
}
|
|
85
|
-
export type TerminalToolResult = TerminalOpenResult | TerminalSessionResult | TerminalClosedResult;
|
|
86
|
-
export declare function terminalTool(ctx: BashTerminalContext, registry: TerminalRegistry, paths: ResolvedPaths, defaultShell: () => string): import("./dsh-types.js").ToolDefinition;
|
|
87
|
-
export {};
|
|
1
|
+
import type { BashTerminalContext, ResolvedPaths, TerminalHandle } from "./dsh-types.js";
|
|
2
|
+
declare const TERMINAL_SIGNALS: readonly ["SIGINT", "SIGTERM", "SIGKILL", "SIGTSTP", "SIGHUP"];
|
|
3
|
+
export type TerminalSignal = (typeof TERMINAL_SIGNALS)[number];
|
|
4
|
+
interface TerminalBufferRead {
|
|
5
|
+
delta: string;
|
|
6
|
+
nextOffset: number;
|
|
7
|
+
}
|
|
8
|
+
interface TerminalBuffer {
|
|
9
|
+
append(chunk: string): void;
|
|
10
|
+
readFrom(offset: number): TerminalBufferRead;
|
|
11
|
+
snapshot(): string;
|
|
12
|
+
}
|
|
13
|
+
/** Interactive-shell argv (no -c: the terminal itself is the session). */
|
|
14
|
+
export declare function terminalArgv(shell: string, paths: ResolvedPaths, distro?: string): Array<string | undefined>;
|
|
15
|
+
interface TerminalSession {
|
|
16
|
+
id: string;
|
|
17
|
+
handle: TerminalHandle;
|
|
18
|
+
buffer: TerminalBuffer;
|
|
19
|
+
shell: string;
|
|
20
|
+
distro?: string;
|
|
21
|
+
closed: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface TerminalOpenOptions {
|
|
24
|
+
argv: string[];
|
|
25
|
+
shell: string;
|
|
26
|
+
cwd: string;
|
|
27
|
+
env: Record<string, string | undefined>;
|
|
28
|
+
rows: number;
|
|
29
|
+
cols: number;
|
|
30
|
+
distro?: string;
|
|
31
|
+
initial?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface TerminalRegistry {
|
|
34
|
+
open(options: TerminalOpenOptions): Promise<TerminalSession>;
|
|
35
|
+
get(id: string): TerminalSession;
|
|
36
|
+
send(id: string, input: string): Promise<TerminalBufferRead>;
|
|
37
|
+
read(id: string): TerminalBufferRead;
|
|
38
|
+
signal(id: string, sig: string): Promise<TerminalBufferRead>;
|
|
39
|
+
close(id: string): Promise<boolean>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Terminal-session registry owned by the plugin fiber: opens PTYs through
|
|
43
|
+
* the official seam, forwards output into a capped buffer, and tears every
|
|
44
|
+
* session down on plugin disposal.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createTerminalRegistry(ctx: BashTerminalContext): TerminalRegistry;
|
|
47
|
+
/** The terminal tool's arguments after runtime validation (discriminated by action). */
|
|
48
|
+
export type ValidatedTerminalArgs = {
|
|
49
|
+
action: "open";
|
|
50
|
+
sessionId?: string;
|
|
51
|
+
command?: string;
|
|
52
|
+
distro?: string;
|
|
53
|
+
workdir?: string;
|
|
54
|
+
} | {
|
|
55
|
+
action: "send";
|
|
56
|
+
sessionId: string;
|
|
57
|
+
input: string;
|
|
58
|
+
} | {
|
|
59
|
+
action: "read";
|
|
60
|
+
sessionId: string;
|
|
61
|
+
} | {
|
|
62
|
+
action: "signal";
|
|
63
|
+
sessionId: string;
|
|
64
|
+
signal: TerminalSignal;
|
|
65
|
+
} | {
|
|
66
|
+
action: "close";
|
|
67
|
+
sessionId: string;
|
|
68
|
+
};
|
|
69
|
+
export declare function validateArgs(args: Record<string, unknown>): asserts args is ValidatedTerminalArgs;
|
|
70
|
+
export interface TerminalOpenResult {
|
|
71
|
+
kind: "open";
|
|
72
|
+
sessionId: string;
|
|
73
|
+
pid: number;
|
|
74
|
+
shell: string;
|
|
75
|
+
output: string;
|
|
76
|
+
}
|
|
77
|
+
export interface TerminalSessionResult {
|
|
78
|
+
kind: "session";
|
|
79
|
+
output: string;
|
|
80
|
+
}
|
|
81
|
+
export interface TerminalClosedResult {
|
|
82
|
+
kind: "closed";
|
|
83
|
+
sessionId: string;
|
|
84
|
+
}
|
|
85
|
+
export type TerminalToolResult = TerminalOpenResult | TerminalSessionResult | TerminalClosedResult;
|
|
86
|
+
export declare function terminalTool(ctx: BashTerminalContext, registry: TerminalRegistry, paths: ResolvedPaths, defaultShell: () => string): import("./dsh-types.js").ToolDefinition;
|
|
87
|
+
export {};
|