@ever-works/pty-local-plugin 1.0.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.
@@ -0,0 +1,58 @@
1
+ import { IPlugin, ITerminalStreamPlugin, PluginCategory, JsonSchema, TerminalSpawnInput, TerminalTransport, TerminalSessionHandle, PluginSettings, PluginContext, PluginHealthCheck, PluginManifest } from '@ever-works/plugin';
2
+
3
+ /**
4
+ * Mint the provider-scoped session id reported on the handle (persisted
5
+ * by the platform as the run's `cliSessionId`).
6
+ *
7
+ * `pty-local:<runId>:<pid>` — provider-prefixed so a value minted by a
8
+ * DIFFERENT terminal-stream provider can never be mistaken for one of
9
+ * ours, and pid-scoped so two sessions for the same run (a resume after
10
+ * a worker restart) are distinguishable. `no-pid` when the platform
11
+ * reported none rather than pretending to know it.
12
+ */
13
+ declare function makePtyLocalSessionId(runId: string, pid?: number): string;
14
+ /**
15
+ * `pty-local` — first-party `terminal-stream` provider.
16
+ *
17
+ * Runs the agent CLI in THIS process's runtime (the job-runtime worker
18
+ * that called the facade), pumping bytes against the platform-supplied
19
+ * transport:
20
+ *
21
+ * - **PTY path**: `@homebridge/node-pty-prebuilt-multiarch` via runtime
22
+ * require — full interactive terminal, resizable, TUIs render.
23
+ * - **Pipe floor**: plain `child_process.spawn` with piped stdio when
24
+ * the prebuild is unavailable (bundled image without the addon,
25
+ * unsupported platform). No resize, but bytes still stream — the
26
+ * handle reports `isPty: false` so the UI shows an honest banner.
27
+ *
28
+ * Both paths share the same pump contract: preamble frames first, then
29
+ * monotonically-sequenced stdout frames; inbound stdin/resize consumed
30
+ * from the transport; the final `exit` frame is published BEFORE the
31
+ * handle's `exited` promise resolves (a viewer must always learn the
32
+ * session ended).
33
+ */
34
+ declare class PtyLocalPlugin implements IPlugin, ITerminalStreamPlugin {
35
+ readonly id = "pty-local";
36
+ readonly name = "Local PTY Terminal Host";
37
+ readonly version = "1.0.0";
38
+ readonly category: PluginCategory;
39
+ readonly capabilities: readonly string[];
40
+ readonly providerName = "pty-local";
41
+ readonly settingsSchema: JsonSchema;
42
+ private context?;
43
+ spawn(input: TerminalSpawnInput, transport: TerminalTransport): Promise<TerminalSessionHandle>;
44
+ probe(_settings?: PluginSettings): Promise<{
45
+ ok: boolean;
46
+ detail?: string;
47
+ }>;
48
+ private spawnPty;
49
+ private spawnPipeFloor;
50
+ private consumeInbound;
51
+ private tryLoadPty;
52
+ onLoad(context: PluginContext): Promise<void>;
53
+ onUnload(): Promise<void>;
54
+ healthCheck(): Promise<PluginHealthCheck>;
55
+ getManifest(): PluginManifest;
56
+ }
57
+
58
+ export { PtyLocalPlugin, PtyLocalPlugin as default, makePtyLocalSessionId };
@@ -0,0 +1,58 @@
1
+ import { IPlugin, ITerminalStreamPlugin, PluginCategory, JsonSchema, TerminalSpawnInput, TerminalTransport, TerminalSessionHandle, PluginSettings, PluginContext, PluginHealthCheck, PluginManifest } from '@ever-works/plugin';
2
+
3
+ /**
4
+ * Mint the provider-scoped session id reported on the handle (persisted
5
+ * by the platform as the run's `cliSessionId`).
6
+ *
7
+ * `pty-local:<runId>:<pid>` — provider-prefixed so a value minted by a
8
+ * DIFFERENT terminal-stream provider can never be mistaken for one of
9
+ * ours, and pid-scoped so two sessions for the same run (a resume after
10
+ * a worker restart) are distinguishable. `no-pid` when the platform
11
+ * reported none rather than pretending to know it.
12
+ */
13
+ declare function makePtyLocalSessionId(runId: string, pid?: number): string;
14
+ /**
15
+ * `pty-local` — first-party `terminal-stream` provider.
16
+ *
17
+ * Runs the agent CLI in THIS process's runtime (the job-runtime worker
18
+ * that called the facade), pumping bytes against the platform-supplied
19
+ * transport:
20
+ *
21
+ * - **PTY path**: `@homebridge/node-pty-prebuilt-multiarch` via runtime
22
+ * require — full interactive terminal, resizable, TUIs render.
23
+ * - **Pipe floor**: plain `child_process.spawn` with piped stdio when
24
+ * the prebuild is unavailable (bundled image without the addon,
25
+ * unsupported platform). No resize, but bytes still stream — the
26
+ * handle reports `isPty: false` so the UI shows an honest banner.
27
+ *
28
+ * Both paths share the same pump contract: preamble frames first, then
29
+ * monotonically-sequenced stdout frames; inbound stdin/resize consumed
30
+ * from the transport; the final `exit` frame is published BEFORE the
31
+ * handle's `exited` promise resolves (a viewer must always learn the
32
+ * session ended).
33
+ */
34
+ declare class PtyLocalPlugin implements IPlugin, ITerminalStreamPlugin {
35
+ readonly id = "pty-local";
36
+ readonly name = "Local PTY Terminal Host";
37
+ readonly version = "1.0.0";
38
+ readonly category: PluginCategory;
39
+ readonly capabilities: readonly string[];
40
+ readonly providerName = "pty-local";
41
+ readonly settingsSchema: JsonSchema;
42
+ private context?;
43
+ spawn(input: TerminalSpawnInput, transport: TerminalTransport): Promise<TerminalSessionHandle>;
44
+ probe(_settings?: PluginSettings): Promise<{
45
+ ok: boolean;
46
+ detail?: string;
47
+ }>;
48
+ private spawnPty;
49
+ private spawnPipeFloor;
50
+ private consumeInbound;
51
+ private tryLoadPty;
52
+ onLoad(context: PluginContext): Promise<void>;
53
+ onUnload(): Promise<void>;
54
+ healthCheck(): Promise<PluginHealthCheck>;
55
+ getManifest(): PluginManifest;
56
+ }
57
+
58
+ export { PtyLocalPlugin, PtyLocalPlugin as default, makePtyLocalSessionId };