@opencode-cockpit/protocol 0.2.0 → 0.2.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.
package/README.md CHANGED
@@ -1,11 +1,88 @@
1
1
  # @opencode-cockpit/protocol
2
2
 
3
- Wire protocol for cockpitd: JSON-RPC 2.0 over NDJSON on a unix socket. Zod schemas for every method and event, error codes, filesystem layout and the daemon build id. No runtime I/O beyond path and hash helpers.
3
+ **The contract between `cockpitd` and everything that talks to it.** Zod schemas for every method
4
+ and event, the types generated from them, the socket paths, the framing, and the build identity used
5
+ to decide which daemon should be running.
4
6
 
5
- Part of [opencode-cockpit](https://github.com/Codestz/opencode-cockpit). Install the plugin, not this package, unless you are building your own front end:
7
+ Client and daemon import the *same* file, so a change to a shape is a compile error on both sides
8
+ rather than a runtime surprise in one of them.
6
9
 
7
- ```sh
8
- opencode plugin opencode-cockpit --global
10
+ > Installing the plugin is what you usually want. This package matters if you are writing a
11
+ > capability, or a client of your own.
12
+
13
+ ---
14
+
15
+ ## What is in it
16
+
17
+ | Export | What it gives you |
18
+ | --- | --- |
19
+ | `contract`, `Methods`, `MethodName` | Every method, its params and its result |
20
+ | `events`, `Events`, `Topic` | Every event topic and its payload |
21
+ | `PROTOCOL_VERSION` | `{ major, minor }` — the wire version |
22
+ | `shell` | The shell capability's schemas: `ShellInfo`, `StartParams`, `WatchRule`, `ReadResult`, … |
23
+ | `resolvePaths`, `CockpitPaths` | Where the socket, logs and registry live |
24
+ | `daemonBuildId` | Content identity of a daemon build |
25
+ | `encodeFrame`, `decodeFrames` | NDJSON framing |
26
+ | `RpcError`, `ErrorCode` | The error shape both sides speak |
27
+
28
+ ## The shape of a call
29
+
30
+ ```ts
31
+ import { contract, shell } from "@opencode-cockpit/protocol"
32
+
33
+ // Every method is params → result, both zod schemas:
34
+ contract["shell.start"].params // StartParams
35
+ contract["shell.start"].result // ShellInfo
36
+
37
+ // Schemas are usable on their own, so a UI can parse what it receives:
38
+ const info = shell.ShellInfo.parse(payload)
39
+ ```
40
+
41
+ Requests and responses are JSON-RPC 2.0, one object per line (NDJSON) over a unix socket. Events are
42
+ notifications, delivered only to peers subscribed to the topic.
43
+
44
+ ## Versioning
45
+
46
+ `PROTOCOL_VERSION` is `major.minor`:
47
+
48
+ - **Minor** goes up when something is added — a new method, a new optional field. Old clients keep
49
+ working, so a daemon may serve a client that predates the addition.
50
+ - **Major** goes up when something existing changes meaning or disappears. A mismatch is refused at
51
+ the handshake with a message naming both versions, instead of failing halfway through a call.
52
+
53
+ The handshake carries the version, so both ends know where they stand before any work starts.
54
+
55
+ ## Build identity
56
+
57
+ ```ts
58
+ import { daemonBuildId } from "@opencode-cockpit/protocol"
59
+
60
+ daemonBuildId(entry, version) // → "0.2.1+4eac93214393"
9
61
  ```
10
62
 
11
- Requires Bun 1.3.5 (OpenCode's embedded runtime qualifies). License: MIT.
63
+ A hash of the daemon's own files plus its version. Equal versions with different hashes are how a
64
+ development build is recognised as newer than the daemon already running — which is what lets a
65
+ plugin under active work replace an idle daemon without a version bump.
66
+
67
+ ## Adding a method
68
+
69
+ 1. Add the schema to the capability's contract file (`src/shell/contract.ts`, or a new namespace).
70
+ 2. Bump `PROTOCOL_VERSION.minor`.
71
+ 3. Implement the handler in the daemon module — it is typed from the contract, so a missing or
72
+ mis-shaped handler will not compile.
73
+ 4. Call it from the client. No client-side wiring: `call` picks up the new name.
74
+
75
+ Schemas are split by concern rather than piled into one file — for shell that is `common`, `info`,
76
+ `params`, `watch` and `contract` — so a capability's surface stays readable as it grows.
77
+
78
+ ## Requirements
79
+
80
+ Bun ≥ 1.3.5 or Node ≥ 20 for the schemas alone. Runs anywhere zod runs.
81
+
82
+ ## More
83
+
84
+ [Architecture](https://codestz.github.io/opencode-cockpit/platform/architecture/) ·
85
+ [Daemon](../daemon) · [Client](../client) ·
86
+ [Repository](https://github.com/Codestz/opencode-cockpit)
87
+
88
+ MIT
package/dist/daemon.js CHANGED
@@ -3,7 +3,12 @@ import { method } from "./contract.js";
3
3
  export const ClientInfo = z.object({
4
4
  name: z.string().min(1),
5
5
  version: z.string().min(1),
6
- pid: z.number().int().optional()
6
+ pid: z.number().int().optional(),
7
+ /**
8
+ * Opaque id of the OpenCode window this client belongs to. Both halves of a plugin share one, so
9
+ * the daemon can tell "this window went away" from "one of its two connections dropped".
10
+ */
11
+ instance: z.string().min(1).optional()
7
12
  });
8
13
  export const Version = z.object({
9
14
  major: z.number().int(),
package/dist/rpc.js CHANGED
@@ -3,7 +3,7 @@
3
3
  /** Bump MAJOR on breaking changes to methods, events or framing. */
4
4
  export const PROTOCOL_VERSION = {
5
5
  major: 1,
6
- minor: 2
6
+ minor: 4
7
7
  };
8
8
  export const ErrorCode = {
9
9
  ParseError: -32700,
@@ -16,6 +16,10 @@ export const ShellInfo = z.object({
16
16
  error: z.string().optional(),
17
17
  /** Set when a run ends: the last error-looking line of the run, else its last line. */
18
18
  summary: z.string().optional(),
19
+ /** Why the shell stopped, when it did not end on its own. */
20
+ stopReason: z.enum(["timeout", "idle", "request", "shutdown"]).optional(),
21
+ /** The client that asked for the stop, for `stopReason: "request"`. */
22
+ stoppedBy: z.string().optional(),
19
23
  startedAt: z.number(),
20
24
  endedAt: z.number().optional(),
21
25
  cols: z.number().int(),
@@ -20,6 +20,13 @@ export const StartParams = z.object({
20
20
  idleTimeoutMs: z.number().int().positive().optional(),
21
21
  /** Also write the clean log to a file, for debugging after the buffer has evicted old lines. */
22
22
  logFile: z.boolean().default(false),
23
+ /** Stop this shell when the OpenCode window that started it goes away. */
24
+ stopOnExit: z.boolean().optional(),
25
+ /**
26
+ * Stop it after this long with nothing from its window connected. The answer to a shell that
27
+ * would otherwise run for a week because everyone who knew about it has gone.
28
+ */
29
+ orphanAfterMs: z.number().int().positive().optional(),
23
30
  /**
24
31
  * Restart a finished shell with the same command, args, cwd, project and session instead of
25
32
  * creating a new one. Repeated runs then share one id and one log.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencode-cockpit/protocol",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Wire protocol, method and event contracts for cockpitd (opencode-cockpit)",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/types/daemon.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const ClientInfo: z.ZodObject<{
3
3
  name: z.ZodString;
4
4
  version: z.ZodString;
5
5
  pid: z.ZodOptional<z.ZodNumber>;
6
+ instance: z.ZodOptional<z.ZodString>;
6
7
  }, z.core.$strip>;
7
8
  export declare const Version: z.ZodObject<{
8
9
  major: z.ZodNumber;
@@ -34,6 +35,7 @@ export declare const daemonContract: {
34
35
  name: z.ZodString;
35
36
  version: z.ZodString;
36
37
  pid: z.ZodOptional<z.ZodNumber>;
38
+ instance: z.ZodOptional<z.ZodString>;
37
39
  }, z.core.$strip>;
38
40
  protocol: z.ZodObject<{
39
41
  major: z.ZodNumber;
package/types/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export declare const contract: {
12
12
  name: import("zod").ZodString;
13
13
  version: import("zod").ZodString;
14
14
  pid: import("zod").ZodOptional<import("zod").ZodNumber>;
15
+ instance: import("zod").ZodOptional<import("zod").ZodString>;
15
16
  }, import("zod/v4/core").$strip>;
16
17
  protocol: import("zod").ZodObject<{
17
18
  major: import("zod").ZodNumber;
@@ -68,6 +69,8 @@ export declare const contract: {
68
69
  timeoutMs: import("zod").ZodOptional<import("zod").ZodNumber>;
69
70
  idleTimeoutMs: import("zod").ZodOptional<import("zod").ZodNumber>;
70
71
  logFile: import("zod").ZodDefault<import("zod").ZodBoolean>;
72
+ stopOnExit: import("zod").ZodOptional<import("zod").ZodBoolean>;
73
+ orphanAfterMs: import("zod").ZodOptional<import("zod").ZodNumber>;
71
74
  reuse: import("zod").ZodDefault<import("zod").ZodBoolean>;
72
75
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
73
76
  id: import("zod").ZodString;
@@ -92,6 +95,13 @@ export declare const contract: {
92
95
  signal: import("zod").ZodOptional<import("zod").ZodString>;
93
96
  error: import("zod").ZodOptional<import("zod").ZodString>;
94
97
  summary: import("zod").ZodOptional<import("zod").ZodString>;
98
+ stopReason: import("zod").ZodOptional<import("zod").ZodEnum<{
99
+ idle: "idle";
100
+ request: "request";
101
+ shutdown: "shutdown";
102
+ timeout: "timeout";
103
+ }>>;
104
+ stoppedBy: import("zod").ZodOptional<import("zod").ZodString>;
95
105
  startedAt: import("zod").ZodNumber;
96
106
  endedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
97
107
  cols: import("zod").ZodNumber;
@@ -145,6 +155,13 @@ export declare const contract: {
145
155
  signal: import("zod").ZodOptional<import("zod").ZodString>;
146
156
  error: import("zod").ZodOptional<import("zod").ZodString>;
147
157
  summary: import("zod").ZodOptional<import("zod").ZodString>;
158
+ stopReason: import("zod").ZodOptional<import("zod").ZodEnum<{
159
+ idle: "idle";
160
+ request: "request";
161
+ shutdown: "shutdown";
162
+ timeout: "timeout";
163
+ }>>;
164
+ stoppedBy: import("zod").ZodOptional<import("zod").ZodString>;
148
165
  startedAt: import("zod").ZodNumber;
149
166
  endedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
150
167
  cols: import("zod").ZodNumber;
@@ -193,6 +210,13 @@ export declare const contract: {
193
210
  signal: import("zod").ZodOptional<import("zod").ZodString>;
194
211
  error: import("zod").ZodOptional<import("zod").ZodString>;
195
212
  summary: import("zod").ZodOptional<import("zod").ZodString>;
213
+ stopReason: import("zod").ZodOptional<import("zod").ZodEnum<{
214
+ idle: "idle";
215
+ request: "request";
216
+ shutdown: "shutdown";
217
+ timeout: "timeout";
218
+ }>>;
219
+ stoppedBy: import("zod").ZodOptional<import("zod").ZodString>;
196
220
  startedAt: import("zod").ZodNumber;
197
221
  endedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
198
222
  cols: import("zod").ZodNumber;
@@ -318,6 +342,13 @@ export declare const contract: {
318
342
  signal: import("zod").ZodOptional<import("zod").ZodString>;
319
343
  error: import("zod").ZodOptional<import("zod").ZodString>;
320
344
  summary: import("zod").ZodOptional<import("zod").ZodString>;
345
+ stopReason: import("zod").ZodOptional<import("zod").ZodEnum<{
346
+ idle: "idle";
347
+ request: "request";
348
+ shutdown: "shutdown";
349
+ timeout: "timeout";
350
+ }>>;
351
+ stoppedBy: import("zod").ZodOptional<import("zod").ZodString>;
321
352
  startedAt: import("zod").ZodNumber;
322
353
  endedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
323
354
  cols: import("zod").ZodNumber;
@@ -374,6 +405,13 @@ export declare const contract: {
374
405
  signal: import("zod").ZodOptional<import("zod").ZodString>;
375
406
  error: import("zod").ZodOptional<import("zod").ZodString>;
376
407
  summary: import("zod").ZodOptional<import("zod").ZodString>;
408
+ stopReason: import("zod").ZodOptional<import("zod").ZodEnum<{
409
+ idle: "idle";
410
+ request: "request";
411
+ shutdown: "shutdown";
412
+ timeout: "timeout";
413
+ }>>;
414
+ stoppedBy: import("zod").ZodOptional<import("zod").ZodString>;
377
415
  startedAt: import("zod").ZodNumber;
378
416
  endedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
379
417
  cols: import("zod").ZodNumber;
@@ -422,6 +460,13 @@ export declare const contract: {
422
460
  signal: import("zod").ZodOptional<import("zod").ZodString>;
423
461
  error: import("zod").ZodOptional<import("zod").ZodString>;
424
462
  summary: import("zod").ZodOptional<import("zod").ZodString>;
463
+ stopReason: import("zod").ZodOptional<import("zod").ZodEnum<{
464
+ idle: "idle";
465
+ request: "request";
466
+ shutdown: "shutdown";
467
+ timeout: "timeout";
468
+ }>>;
469
+ stoppedBy: import("zod").ZodOptional<import("zod").ZodString>;
425
470
  startedAt: import("zod").ZodNumber;
426
471
  endedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
427
472
  cols: import("zod").ZodNumber;
@@ -491,6 +536,13 @@ export declare const contract: {
491
536
  signal: import("zod").ZodOptional<import("zod").ZodString>;
492
537
  error: import("zod").ZodOptional<import("zod").ZodString>;
493
538
  summary: import("zod").ZodOptional<import("zod").ZodString>;
539
+ stopReason: import("zod").ZodOptional<import("zod").ZodEnum<{
540
+ idle: "idle";
541
+ request: "request";
542
+ shutdown: "shutdown";
543
+ timeout: "timeout";
544
+ }>>;
545
+ stoppedBy: import("zod").ZodOptional<import("zod").ZodString>;
494
546
  startedAt: import("zod").ZodNumber;
495
547
  endedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
496
548
  cols: import("zod").ZodNumber;
@@ -539,6 +591,13 @@ export declare const contract: {
539
591
  signal: import("zod").ZodOptional<import("zod").ZodString>;
540
592
  error: import("zod").ZodOptional<import("zod").ZodString>;
541
593
  summary: import("zod").ZodOptional<import("zod").ZodString>;
594
+ stopReason: import("zod").ZodOptional<import("zod").ZodEnum<{
595
+ idle: "idle";
596
+ request: "request";
597
+ shutdown: "shutdown";
598
+ timeout: "timeout";
599
+ }>>;
600
+ stoppedBy: import("zod").ZodOptional<import("zod").ZodString>;
542
601
  startedAt: import("zod").ZodNumber;
543
602
  endedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
544
603
  cols: import("zod").ZodNumber;
@@ -611,6 +670,13 @@ export declare const events: {
611
670
  signal: import("zod").ZodOptional<import("zod").ZodString>;
612
671
  error: import("zod").ZodOptional<import("zod").ZodString>;
613
672
  summary: import("zod").ZodOptional<import("zod").ZodString>;
673
+ stopReason: import("zod").ZodOptional<import("zod").ZodEnum<{
674
+ idle: "idle";
675
+ request: "request";
676
+ shutdown: "shutdown";
677
+ timeout: "timeout";
678
+ }>>;
679
+ stoppedBy: import("zod").ZodOptional<import("zod").ZodString>;
614
680
  startedAt: import("zod").ZodNumber;
615
681
  endedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
616
682
  cols: import("zod").ZodNumber;
@@ -657,6 +723,13 @@ export declare const events: {
657
723
  signal: import("zod").ZodOptional<import("zod").ZodString>;
658
724
  error: import("zod").ZodOptional<import("zod").ZodString>;
659
725
  summary: import("zod").ZodOptional<import("zod").ZodString>;
726
+ stopReason: import("zod").ZodOptional<import("zod").ZodEnum<{
727
+ idle: "idle";
728
+ request: "request";
729
+ shutdown: "shutdown";
730
+ timeout: "timeout";
731
+ }>>;
732
+ stoppedBy: import("zod").ZodOptional<import("zod").ZodString>;
660
733
  startedAt: import("zod").ZodNumber;
661
734
  endedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
662
735
  cols: import("zod").ZodNumber;
@@ -712,6 +785,13 @@ export declare const events: {
712
785
  signal: import("zod").ZodOptional<import("zod").ZodString>;
713
786
  error: import("zod").ZodOptional<import("zod").ZodString>;
714
787
  summary: import("zod").ZodOptional<import("zod").ZodString>;
788
+ stopReason: import("zod").ZodOptional<import("zod").ZodEnum<{
789
+ idle: "idle";
790
+ request: "request";
791
+ shutdown: "shutdown";
792
+ timeout: "timeout";
793
+ }>>;
794
+ stoppedBy: import("zod").ZodOptional<import("zod").ZodString>;
715
795
  startedAt: import("zod").ZodNumber;
716
796
  endedAt: import("zod").ZodOptional<import("zod").ZodNumber>;
717
797
  cols: import("zod").ZodNumber;
package/types/rpc.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  /** Bump MAJOR on breaking changes to methods, events or framing. */
3
3
  export declare const PROTOCOL_VERSION: {
4
4
  readonly major: 1;
5
- readonly minor: 2;
5
+ readonly minor: 4;
6
6
  };
7
7
  export type RequestId = number | string;
8
8
  export interface RpcRequest {
@@ -16,6 +16,8 @@ export declare const shellContract: {
16
16
  timeoutMs: z.ZodOptional<z.ZodNumber>;
17
17
  idleTimeoutMs: z.ZodOptional<z.ZodNumber>;
18
18
  logFile: z.ZodDefault<z.ZodBoolean>;
19
+ stopOnExit: z.ZodOptional<z.ZodBoolean>;
20
+ orphanAfterMs: z.ZodOptional<z.ZodNumber>;
19
21
  reuse: z.ZodDefault<z.ZodBoolean>;
20
22
  }, z.core.$strip>, z.ZodObject<{
21
23
  id: z.ZodString;
@@ -40,6 +42,13 @@ export declare const shellContract: {
40
42
  signal: z.ZodOptional<z.ZodString>;
41
43
  error: z.ZodOptional<z.ZodString>;
42
44
  summary: z.ZodOptional<z.ZodString>;
45
+ stopReason: z.ZodOptional<z.ZodEnum<{
46
+ idle: "idle";
47
+ request: "request";
48
+ shutdown: "shutdown";
49
+ timeout: "timeout";
50
+ }>>;
51
+ stoppedBy: z.ZodOptional<z.ZodString>;
43
52
  startedAt: z.ZodNumber;
44
53
  endedAt: z.ZodOptional<z.ZodNumber>;
45
54
  cols: z.ZodNumber;
@@ -93,6 +102,13 @@ export declare const shellContract: {
93
102
  signal: z.ZodOptional<z.ZodString>;
94
103
  error: z.ZodOptional<z.ZodString>;
95
104
  summary: z.ZodOptional<z.ZodString>;
105
+ stopReason: z.ZodOptional<z.ZodEnum<{
106
+ idle: "idle";
107
+ request: "request";
108
+ shutdown: "shutdown";
109
+ timeout: "timeout";
110
+ }>>;
111
+ stoppedBy: z.ZodOptional<z.ZodString>;
96
112
  startedAt: z.ZodNumber;
97
113
  endedAt: z.ZodOptional<z.ZodNumber>;
98
114
  cols: z.ZodNumber;
@@ -141,6 +157,13 @@ export declare const shellContract: {
141
157
  signal: z.ZodOptional<z.ZodString>;
142
158
  error: z.ZodOptional<z.ZodString>;
143
159
  summary: z.ZodOptional<z.ZodString>;
160
+ stopReason: z.ZodOptional<z.ZodEnum<{
161
+ idle: "idle";
162
+ request: "request";
163
+ shutdown: "shutdown";
164
+ timeout: "timeout";
165
+ }>>;
166
+ stoppedBy: z.ZodOptional<z.ZodString>;
144
167
  startedAt: z.ZodNumber;
145
168
  endedAt: z.ZodOptional<z.ZodNumber>;
146
169
  cols: z.ZodNumber;
@@ -266,6 +289,13 @@ export declare const shellContract: {
266
289
  signal: z.ZodOptional<z.ZodString>;
267
290
  error: z.ZodOptional<z.ZodString>;
268
291
  summary: z.ZodOptional<z.ZodString>;
292
+ stopReason: z.ZodOptional<z.ZodEnum<{
293
+ idle: "idle";
294
+ request: "request";
295
+ shutdown: "shutdown";
296
+ timeout: "timeout";
297
+ }>>;
298
+ stoppedBy: z.ZodOptional<z.ZodString>;
269
299
  startedAt: z.ZodNumber;
270
300
  endedAt: z.ZodOptional<z.ZodNumber>;
271
301
  cols: z.ZodNumber;
@@ -322,6 +352,13 @@ export declare const shellContract: {
322
352
  signal: z.ZodOptional<z.ZodString>;
323
353
  error: z.ZodOptional<z.ZodString>;
324
354
  summary: z.ZodOptional<z.ZodString>;
355
+ stopReason: z.ZodOptional<z.ZodEnum<{
356
+ idle: "idle";
357
+ request: "request";
358
+ shutdown: "shutdown";
359
+ timeout: "timeout";
360
+ }>>;
361
+ stoppedBy: z.ZodOptional<z.ZodString>;
325
362
  startedAt: z.ZodNumber;
326
363
  endedAt: z.ZodOptional<z.ZodNumber>;
327
364
  cols: z.ZodNumber;
@@ -370,6 +407,13 @@ export declare const shellContract: {
370
407
  signal: z.ZodOptional<z.ZodString>;
371
408
  error: z.ZodOptional<z.ZodString>;
372
409
  summary: z.ZodOptional<z.ZodString>;
410
+ stopReason: z.ZodOptional<z.ZodEnum<{
411
+ idle: "idle";
412
+ request: "request";
413
+ shutdown: "shutdown";
414
+ timeout: "timeout";
415
+ }>>;
416
+ stoppedBy: z.ZodOptional<z.ZodString>;
373
417
  startedAt: z.ZodNumber;
374
418
  endedAt: z.ZodOptional<z.ZodNumber>;
375
419
  cols: z.ZodNumber;
@@ -439,6 +483,13 @@ export declare const shellContract: {
439
483
  signal: z.ZodOptional<z.ZodString>;
440
484
  error: z.ZodOptional<z.ZodString>;
441
485
  summary: z.ZodOptional<z.ZodString>;
486
+ stopReason: z.ZodOptional<z.ZodEnum<{
487
+ idle: "idle";
488
+ request: "request";
489
+ shutdown: "shutdown";
490
+ timeout: "timeout";
491
+ }>>;
492
+ stoppedBy: z.ZodOptional<z.ZodString>;
442
493
  startedAt: z.ZodNumber;
443
494
  endedAt: z.ZodOptional<z.ZodNumber>;
444
495
  cols: z.ZodNumber;
@@ -487,6 +538,13 @@ export declare const shellContract: {
487
538
  signal: z.ZodOptional<z.ZodString>;
488
539
  error: z.ZodOptional<z.ZodString>;
489
540
  summary: z.ZodOptional<z.ZodString>;
541
+ stopReason: z.ZodOptional<z.ZodEnum<{
542
+ idle: "idle";
543
+ request: "request";
544
+ shutdown: "shutdown";
545
+ timeout: "timeout";
546
+ }>>;
547
+ stoppedBy: z.ZodOptional<z.ZodString>;
490
548
  startedAt: z.ZodNumber;
491
549
  endedAt: z.ZodOptional<z.ZodNumber>;
492
550
  cols: z.ZodNumber;
@@ -556,6 +614,13 @@ export declare const shellEvents: {
556
614
  signal: z.ZodOptional<z.ZodString>;
557
615
  error: z.ZodOptional<z.ZodString>;
558
616
  summary: z.ZodOptional<z.ZodString>;
617
+ stopReason: z.ZodOptional<z.ZodEnum<{
618
+ idle: "idle";
619
+ request: "request";
620
+ shutdown: "shutdown";
621
+ timeout: "timeout";
622
+ }>>;
623
+ stoppedBy: z.ZodOptional<z.ZodString>;
559
624
  startedAt: z.ZodNumber;
560
625
  endedAt: z.ZodOptional<z.ZodNumber>;
561
626
  cols: z.ZodNumber;
@@ -602,6 +667,13 @@ export declare const shellEvents: {
602
667
  signal: z.ZodOptional<z.ZodString>;
603
668
  error: z.ZodOptional<z.ZodString>;
604
669
  summary: z.ZodOptional<z.ZodString>;
670
+ stopReason: z.ZodOptional<z.ZodEnum<{
671
+ idle: "idle";
672
+ request: "request";
673
+ shutdown: "shutdown";
674
+ timeout: "timeout";
675
+ }>>;
676
+ stoppedBy: z.ZodOptional<z.ZodString>;
605
677
  startedAt: z.ZodNumber;
606
678
  endedAt: z.ZodOptional<z.ZodNumber>;
607
679
  cols: z.ZodNumber;
@@ -658,6 +730,13 @@ export declare const shellEvents: {
658
730
  signal: z.ZodOptional<z.ZodString>;
659
731
  error: z.ZodOptional<z.ZodString>;
660
732
  summary: z.ZodOptional<z.ZodString>;
733
+ stopReason: z.ZodOptional<z.ZodEnum<{
734
+ idle: "idle";
735
+ request: "request";
736
+ shutdown: "shutdown";
737
+ timeout: "timeout";
738
+ }>>;
739
+ stoppedBy: z.ZodOptional<z.ZodString>;
661
740
  startedAt: z.ZodNumber;
662
741
  endedAt: z.ZodOptional<z.ZodNumber>;
663
742
  cols: z.ZodNumber;
@@ -22,6 +22,13 @@ export declare const ShellInfo: z.ZodObject<{
22
22
  signal: z.ZodOptional<z.ZodString>;
23
23
  error: z.ZodOptional<z.ZodString>;
24
24
  summary: z.ZodOptional<z.ZodString>;
25
+ stopReason: z.ZodOptional<z.ZodEnum<{
26
+ idle: "idle";
27
+ request: "request";
28
+ shutdown: "shutdown";
29
+ timeout: "timeout";
30
+ }>>;
31
+ stoppedBy: z.ZodOptional<z.ZodString>;
25
32
  startedAt: z.ZodNumber;
26
33
  endedAt: z.ZodOptional<z.ZodNumber>;
27
34
  cols: z.ZodNumber;
@@ -46,3 +53,4 @@ export declare const ShellInfo: z.ZodObject<{
46
53
  logFile: z.ZodOptional<z.ZodString>;
47
54
  }, z.core.$strip>;
48
55
  export type ShellInfo = z.output<typeof ShellInfo>;
56
+ export type StopReason = NonNullable<ShellInfo["stopReason"]>;
@@ -15,6 +15,8 @@ export declare const StartParams: z.ZodObject<{
15
15
  timeoutMs: z.ZodOptional<z.ZodNumber>;
16
16
  idleTimeoutMs: z.ZodOptional<z.ZodNumber>;
17
17
  logFile: z.ZodDefault<z.ZodBoolean>;
18
+ stopOnExit: z.ZodOptional<z.ZodBoolean>;
19
+ orphanAfterMs: z.ZodOptional<z.ZodNumber>;
18
20
  reuse: z.ZodDefault<z.ZodBoolean>;
19
21
  }, z.core.$strip>;
20
22
  export declare const ClearParams: z.ZodDefault<z.ZodObject<{
@@ -165,6 +167,13 @@ export declare const WaitResult: z.ZodObject<{
165
167
  signal: z.ZodOptional<z.ZodString>;
166
168
  error: z.ZodOptional<z.ZodString>;
167
169
  summary: z.ZodOptional<z.ZodString>;
170
+ stopReason: z.ZodOptional<z.ZodEnum<{
171
+ idle: "idle";
172
+ request: "request";
173
+ shutdown: "shutdown";
174
+ timeout: "timeout";
175
+ }>>;
176
+ stoppedBy: z.ZodOptional<z.ZodString>;
168
177
  startedAt: z.ZodNumber;
169
178
  endedAt: z.ZodOptional<z.ZodNumber>;
170
179
  cols: z.ZodNumber;