@omnicross/cli-launcher 0.1.0 → 0.1.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.
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Process Supervisor types.
3
+ *
4
+ * Defines all interfaces for subprocess lifecycle management:
5
+ * spawn inputs, run records, exit results, and module contracts.
6
+ *
7
+ * @module types
8
+ */
9
+ type RunState = 'starting' | 'running' | 'exiting' | 'exited';
10
+ type TerminationReason = 'manual-cancel' | 'overall-timeout' | 'no-output-timeout' | 'spawn-error' | 'signal' | 'exit';
11
+ interface SpawnBaseInput {
12
+ runId?: string;
13
+ sessionId: string;
14
+ backendId: string;
15
+ scopeKey?: string;
16
+ replaceExistingScope?: boolean;
17
+ cwd?: string;
18
+ env?: Record<string, string>;
19
+ timeoutMs?: number;
20
+ noOutputTimeoutMs?: number;
21
+ captureOutput?: boolean;
22
+ onStdout?: (chunk: string) => void;
23
+ onStderr?: (chunk: string) => void;
24
+ }
25
+ interface SpawnChildInput extends SpawnBaseInput {
26
+ mode: 'child';
27
+ argv: string[];
28
+ windowsVerbatimArguments?: boolean;
29
+ input?: string;
30
+ stdinMode?: 'inherit' | 'pipe-open' | 'pipe-closed';
31
+ }
32
+ interface SpawnPtyInput extends SpawnBaseInput {
33
+ mode: 'pty';
34
+ /** Shell executable (defaults: powershell.exe on Windows, /bin/bash on Unix). */
35
+ shell?: string;
36
+ /** Arguments passed to the shell. */
37
+ args?: string[];
38
+ /** Terminal columns (default: 120). */
39
+ cols?: number;
40
+ /** Terminal rows (default: 30). */
41
+ rows?: number;
42
+ }
43
+ /** Spawn input union — child-process or PTY mode. */
44
+ type SpawnInput = SpawnChildInput | SpawnPtyInput;
45
+ interface RunRecord {
46
+ runId: string;
47
+ sessionId: string;
48
+ backendId: string;
49
+ scopeKey?: string;
50
+ pid?: number;
51
+ startedAtMs: number;
52
+ lastOutputAtMs: number;
53
+ createdAtMs: number;
54
+ updatedAtMs: number;
55
+ state: RunState;
56
+ terminationReason?: TerminationReason;
57
+ exitCode?: number | null;
58
+ exitSignal?: string | null;
59
+ }
60
+ interface RunExit {
61
+ reason: TerminationReason;
62
+ exitCode: number | null;
63
+ exitSignal: string | null;
64
+ durationMs: number;
65
+ stdout: string;
66
+ stderr: string;
67
+ timedOut: boolean;
68
+ noOutputTimedOut: boolean;
69
+ }
70
+ interface ManagedRunStdin {
71
+ write(data: string): void;
72
+ end(): void;
73
+ destroy(): void;
74
+ }
75
+ interface ManagedRun {
76
+ runId: string;
77
+ pid?: number;
78
+ startedAtMs: number;
79
+ stdin?: ManagedRunStdin;
80
+ wait: () => Promise<RunExit>;
81
+ cancel: (reason?: TerminationReason) => void;
82
+ }
83
+ interface ProcessSupervisor {
84
+ spawn(input: SpawnInput): ManagedRun;
85
+ cancel(runId: string, reason?: TerminationReason): void;
86
+ cancelScope(scopeKey: string, reason?: TerminationReason): void;
87
+ getRecord(runId: string): RunRecord | undefined;
88
+ /** Resize the PTY terminal. No-op for non-PTY runs. */
89
+ resizePty(runId: string, cols: number, rows: number): boolean;
90
+ }
91
+ interface RunRegistry {
92
+ add(record: RunRecord): void;
93
+ get(runId: string): RunRecord | undefined;
94
+ list(): RunRecord[];
95
+ listByScope(scopeKey: string): RunRecord[];
96
+ updateState(runId: string, state: RunState, patch?: Partial<RunRecord>): void;
97
+ touchOutput(runId: string): void;
98
+ finalize(runId: string, reason: TerminationReason, exitCode?: number | null, exitSignal?: string | null): void;
99
+ delete(runId: string): void;
100
+ }
101
+
102
+ export type { ManagedRun, ManagedRunStdin, ProcessSupervisor, RunExit, RunRecord, RunRegistry, RunState, SpawnBaseInput, SpawnChildInput, SpawnInput, SpawnPtyInput, TerminationReason };
package/dist/types.js ADDED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnicross/cli-launcher",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Omnicross CLI-launcher — the ProcessSupervisor subprocess-lifecycle mechanism + per-CLI proxy-env wiring.",
5
5
  "license": "MIT",
6
6
  "author": "Sayo (https://github.com/Dumoedss)",
@@ -50,7 +50,9 @@
50
50
  "typecheck": "tsc -p tsconfig.typecheck.json --noEmit"
51
51
  },
52
52
  "dependencies": {
53
- "@omnicross/core": "^0.1.0",
53
+ "@omnicross/core": "^0.1.0"
54
+ },
55
+ "optionalDependencies": {
54
56
  "node-pty": "npm:@karinjs/node-pty@^1.1.3"
55
57
  }
56
58
  }