@oh-my-pi/pi-natives 11.13.0 → 11.14.0
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/native/pi_natives.darwin-arm64.node +0 -0
- package/native/pi_natives.darwin-x64.node +0 -0
- package/native/pi_natives.linux-arm64.node +0 -0
- package/native/pi_natives.linux-x64.node +0 -0
- package/native/pi_natives.win32-x64.node +0 -0
- package/package.json +2 -2
- package/src/index.ts +5 -0
- package/src/native.ts +2 -0
- package/src/pty/index.ts +10 -0
- package/src/pty/types.ts +57 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.14.0",
|
|
4
4
|
"description": "Native Rust functionality via N-API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"directory": "packages/natives"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@oh-my-pi/pi-utils": "11.
|
|
35
|
+
"@oh-my-pi/pi-utils": "11.14.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/bun": "^1.3.9"
|
package/src/index.ts
CHANGED
|
@@ -111,6 +111,11 @@ export {
|
|
|
111
111
|
type ShellRunResult,
|
|
112
112
|
} from "./shell";
|
|
113
113
|
|
|
114
|
+
// =============================================================================
|
|
115
|
+
// PTY execution
|
|
116
|
+
// =============================================================================
|
|
117
|
+
|
|
118
|
+
export { type PtyRunResult, PtySession, type PtyStartOptions } from "./pty";
|
|
114
119
|
// =============================================================================
|
|
115
120
|
// Process management
|
|
116
121
|
// =============================================================================
|
package/src/native.ts
CHANGED
|
@@ -23,6 +23,7 @@ import "./html/types";
|
|
|
23
23
|
import "./image/types";
|
|
24
24
|
import "./keys/types";
|
|
25
25
|
import "./ps/types";
|
|
26
|
+
import "./pty/types";
|
|
26
27
|
import "./shell/types";
|
|
27
28
|
import "./system-info/types";
|
|
28
29
|
import "./text/types";
|
|
@@ -170,6 +171,7 @@ function validateNative(bindings: NativeBindings, source: string): void {
|
|
|
170
171
|
checkFn("extractSegments");
|
|
171
172
|
checkFn("matchesKittySequence");
|
|
172
173
|
checkFn("executeShell");
|
|
174
|
+
checkFn("PtySession");
|
|
173
175
|
checkFn("Shell");
|
|
174
176
|
checkFn("parseKey");
|
|
175
177
|
checkFn("matchesLegacySequence");
|
package/src/pty/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PTY-backed interactive execution.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { native } from "../native";
|
|
6
|
+
|
|
7
|
+
export type { PtyRunResult, PtySessionConstructor, PtyStartOptions } from "./types";
|
|
8
|
+
|
|
9
|
+
export const { PtySession } = native;
|
|
10
|
+
export type PtySession = import("./types").PtySession;
|
package/src/pty/types.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for PTY-backed interactive execution.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Cancellable, TsFunc } from "../bindings";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Options for starting a command in a pseudo-terminal session.
|
|
9
|
+
*/
|
|
10
|
+
export interface PtyStartOptions extends Cancellable {
|
|
11
|
+
/** Command to execute. */
|
|
12
|
+
command: string;
|
|
13
|
+
/** Working directory for command execution. */
|
|
14
|
+
cwd?: string;
|
|
15
|
+
/** Environment variables for this command. */
|
|
16
|
+
env?: Record<string, string>;
|
|
17
|
+
/** PTY column count. */
|
|
18
|
+
cols?: number;
|
|
19
|
+
/** PTY row count. */
|
|
20
|
+
rows?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Result of a PTY command run.
|
|
25
|
+
*/
|
|
26
|
+
export interface PtyRunResult {
|
|
27
|
+
/** Exit code of the command, if available. */
|
|
28
|
+
exitCode?: number;
|
|
29
|
+
/** Whether the command was cancelled by abort signal or kill request. */
|
|
30
|
+
cancelled: boolean;
|
|
31
|
+
/** Whether the command timed out. */
|
|
32
|
+
timedOut: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Stateful PTY session instance. */
|
|
36
|
+
export interface PtySession {
|
|
37
|
+
/** Start command execution and stream output while it runs. */
|
|
38
|
+
start(options: PtyStartOptions, onChunk?: TsFunc<string>): Promise<PtyRunResult>;
|
|
39
|
+
/** Write raw input bytes to PTY stdin. */
|
|
40
|
+
write(data: string): void;
|
|
41
|
+
/** Resize active PTY. */
|
|
42
|
+
resize(cols: number, rows: number): void;
|
|
43
|
+
/** Force-kill active command. */
|
|
44
|
+
kill(): void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Native PTY session constructor. */
|
|
48
|
+
export interface PtySessionConstructor {
|
|
49
|
+
new (): PtySession;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare module "../bindings" {
|
|
53
|
+
interface NativeBindings {
|
|
54
|
+
/** Stateful PTY session constructor for interactive terminal passthrough. */
|
|
55
|
+
PtySession: PtySessionConstructor;
|
|
56
|
+
}
|
|
57
|
+
}
|