@cleocode/contracts 2026.5.129 → 2026.5.131
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/dist/__tests__/atomic-tools-contract.test.d.ts +14 -0
- package/dist/__tests__/atomic-tools-contract.test.d.ts.map +1 -0
- package/dist/__tests__/atomic-tools-contract.test.js +55 -0
- package/dist/__tests__/atomic-tools-contract.test.js.map +1 -0
- package/dist/__tests__/gateway-contract.test.d.ts +18 -0
- package/dist/__tests__/gateway-contract.test.d.ts.map +1 -0
- package/dist/__tests__/gateway-contract.test.js +187 -0
- package/dist/__tests__/gateway-contract.test.js.map +1 -0
- package/dist/__tests__/mvi.test.d.ts +17 -0
- package/dist/__tests__/mvi.test.d.ts.map +1 -0
- package/dist/__tests__/mvi.test.js +147 -0
- package/dist/__tests__/mvi.test.js.map +1 -0
- package/dist/__tests__/operation-def.test.js +1 -1
- package/dist/__tests__/operation-def.test.js.map +1 -1
- package/dist/boundary.d.ts +26 -0
- package/dist/boundary.d.ts.map +1 -1
- package/dist/boundary.js +42 -4
- package/dist/boundary.js.map +1 -1
- package/dist/branch-lock.d.ts +35 -1
- package/dist/branch-lock.d.ts.map +1 -1
- package/dist/branch-lock.js +23 -2
- package/dist/branch-lock.js.map +1 -1
- package/dist/daemon/__tests__/health-roundtrip.test.d.ts +13 -0
- package/dist/daemon/__tests__/health-roundtrip.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/health-roundtrip.test.js +69 -0
- package/dist/daemon/__tests__/health-roundtrip.test.js.map +1 -0
- package/dist/daemon/health.d.ts +108 -0
- package/dist/daemon/health.d.ts.map +1 -0
- package/dist/daemon/health.js +95 -0
- package/dist/daemon/health.js.map +1 -0
- package/dist/daemon/index.d.ts +24 -0
- package/dist/daemon/index.d.ts.map +1 -0
- package/dist/daemon/index.js +22 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/daemon/subsystem.d.ts +121 -0
- package/dist/daemon/subsystem.d.ts.map +1 -0
- package/dist/daemon/subsystem.js +28 -0
- package/dist/daemon/subsystem.js.map +1 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.d.ts +15 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.d.ts.map +1 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.js +40 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.js.map +1 -0
- package/dist/daemon-ipc/index.d.ts +44 -0
- package/dist/daemon-ipc/index.d.ts.map +1 -0
- package/dist/daemon-ipc/index.js +43 -0
- package/dist/daemon-ipc/index.js.map +1 -0
- package/dist/db-inventory.json +8 -8
- package/dist/dispatch/identity.d.ts +1 -1
- package/dist/dispatch/identity.d.ts.map +1 -1
- package/dist/dispatch/identity.js +3 -0
- package/dist/dispatch/identity.js.map +1 -1
- package/dist/dispatch/operation-def.d.ts +16 -0
- package/dist/dispatch/operation-def.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +133 -0
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/exit-codes.d.ts +1 -1
- package/dist/exit-codes.js +1 -1
- package/dist/gateway/rpc/__tests__/freeze.test.d.ts +20 -0
- package/dist/gateway/rpc/__tests__/freeze.test.d.ts.map +1 -0
- package/dist/gateway/rpc/__tests__/freeze.test.js +122 -0
- package/dist/gateway/rpc/__tests__/freeze.test.js.map +1 -0
- package/dist/gateway/rpc/index.d.ts +23 -0
- package/dist/gateway/rpc/index.d.ts.map +1 -0
- package/dist/gateway/rpc/index.js +22 -0
- package/dist/gateway/rpc/index.js.map +1 -0
- package/dist/gateway/rpc/messages.d.ts +263 -0
- package/dist/gateway/rpc/messages.d.ts.map +1 -0
- package/dist/gateway/rpc/messages.js +152 -0
- package/dist/gateway/rpc/messages.js.map +1 -0
- package/dist/gateway/rpc/version.d.ts +39 -0
- package/dist/gateway/rpc/version.d.ts.map +1 -0
- package/dist/gateway/rpc/version.js +39 -0
- package/dist/gateway/rpc/version.js.map +1 -0
- package/dist/gateway.d.ts +239 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +171 -0
- package/dist/gateway.js.map +1 -0
- package/dist/goal.d.ts +314 -0
- package/dist/goal.d.ts.map +1 -0
- package/dist/goal.js +118 -0
- package/dist/goal.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/mvi.d.ts +209 -0
- package/dist/mvi.d.ts.map +1 -0
- package/dist/mvi.js +99 -0
- package/dist/mvi.js.map +1 -0
- package/dist/operations/attention.d.ts +114 -0
- package/dist/operations/attention.d.ts.map +1 -0
- package/dist/operations/attention.js +22 -0
- package/dist/operations/attention.js.map +1 -0
- package/dist/operations/docs.d.ts +7 -1
- package/dist/operations/docs.d.ts.map +1 -1
- package/dist/operations/docs.js.map +1 -1
- package/dist/operations/focus.d.ts +25 -0
- package/dist/operations/focus.d.ts.map +1 -1
- package/dist/operations/index.d.ts +1 -0
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +1 -0
- package/dist/operations/index.js.map +1 -1
- package/dist/operations/session.d.ts +11 -0
- package/dist/operations/session.d.ts.map +1 -1
- package/dist/sdk-tool.d.ts +1 -1
- package/dist/sdk-tool.js +1 -1
- package/dist/supervisor-ipc/__tests__/freeze.test.d.ts +15 -0
- package/dist/supervisor-ipc/__tests__/freeze.test.d.ts.map +1 -0
- package/dist/supervisor-ipc/__tests__/freeze.test.js +159 -0
- package/dist/supervisor-ipc/__tests__/freeze.test.js.map +1 -0
- package/dist/supervisor-ipc/index.d.ts +15 -0
- package/dist/supervisor-ipc/index.d.ts.map +1 -0
- package/dist/supervisor-ipc/index.js +14 -0
- package/dist/supervisor-ipc/index.js.map +1 -0
- package/dist/supervisor-ipc/messages.d.ts +457 -0
- package/dist/supervisor-ipc/messages.d.ts.map +1 -0
- package/dist/supervisor-ipc/messages.js +312 -0
- package/dist/supervisor-ipc/messages.js.map +1 -0
- package/dist/supervisor-ipc/version.d.ts +29 -0
- package/dist/supervisor-ipc/version.d.ts.map +1 -0
- package/dist/supervisor-ipc/version.js +29 -0
- package/dist/supervisor-ipc/version.js.map +1 -0
- package/dist/tools/__tests__/composite.test.d.ts +14 -0
- package/dist/tools/__tests__/composite.test.d.ts.map +1 -0
- package/dist/tools/__tests__/composite.test.js +75 -0
- package/dist/tools/__tests__/composite.test.js.map +1 -0
- package/dist/tools/atomic.d.ts +195 -0
- package/dist/tools/atomic.d.ts.map +1 -0
- package/dist/tools/atomic.js +82 -0
- package/dist/tools/atomic.js.map +1 -0
- package/dist/tools/composite.d.ts +128 -0
- package/dist/tools/composite.d.ts.map +1 -0
- package/dist/tools/composite.js +88 -0
- package/dist/tools/composite.js.map +1 -0
- package/package.json +35 -3
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/__tests__/atomic-tools-contract.test.ts +67 -0
- package/src/__tests__/gateway-contract.test.ts +219 -0
- package/src/__tests__/mvi.test.ts +175 -0
- package/src/__tests__/operation-def.test.ts +2 -1
- package/src/boundary.ts +74 -4
- package/src/branch-lock.ts +49 -2
- package/src/daemon/__tests__/health-roundtrip.test.ts +84 -0
- package/src/daemon/health.ts +121 -0
- package/src/daemon/index.ts +35 -0
- package/src/daemon/subsystem.ts +126 -0
- package/src/daemon-ipc/__tests__/daemon-ipc-freeze.test.ts +53 -0
- package/src/daemon-ipc/index.ts +90 -0
- package/src/db-inventory.json +8 -8
- package/src/dispatch/identity.ts +3 -0
- package/src/dispatch/operation-def.ts +16 -0
- package/src/dispatch/operations-registry.ts +140 -0
- package/src/exit-codes.ts +1 -1
- package/src/gateway/rpc/__tests__/freeze.test.ts +139 -0
- package/src/gateway/rpc/index.ts +43 -0
- package/src/gateway/rpc/messages.ts +187 -0
- package/src/gateway/rpc/version.ts +40 -0
- package/src/gateway.ts +252 -0
- package/src/goal.ts +348 -0
- package/src/index.ts +109 -0
- package/src/mvi.ts +236 -0
- package/src/operations/attention.ts +117 -0
- package/src/operations/docs.ts +7 -1
- package/src/operations/focus.ts +26 -0
- package/src/operations/index.ts +1 -0
- package/src/operations/session.ts +11 -0
- package/src/sdk-tool.ts +1 -1
- package/src/supervisor-ipc/__tests__/freeze.test.ts +180 -0
- package/src/supervisor-ipc/index.ts +62 -0
- package/src/supervisor-ipc/messages.ts +396 -0
- package/src/supervisor-ipc/version.ts +30 -0
- package/src/tools/__tests__/composite.test.ts +88 -0
- package/src/tools/atomic.ts +274 -0
- package/src/tools/composite.ts +173 -0
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `supervisor-ipc` v1.0 — FROZEN message contract (Zod schemas).
|
|
3
|
+
*
|
|
4
|
+
* This is the byte-for-byte TypeScript mirror of the Rust serde types in
|
|
5
|
+
* `crates/cleo-supervisor/src/ipc.rs`. The wire format is newline-delimited
|
|
6
|
+
* JSON (NDJSON): one {@link SupervisorIpcEnvelope} per line. The supervisor
|
|
7
|
+
* (Rust) is the server; CLEO/Studio (TypeScript) are clients that send
|
|
8
|
+
* {@link SupervisorIpcRequest}s and receive {@link SupervisorIpcResponse}s and
|
|
9
|
+
* unsolicited {@link LifecycleEvent}s.
|
|
10
|
+
*
|
|
11
|
+
* Wire-shape contract (snake_case keys — matches serde defaults):
|
|
12
|
+
*
|
|
13
|
+
* ```jsonc
|
|
14
|
+
* // request
|
|
15
|
+
* { "protocol_version": "1.0.0", "id": "abc", "direction": "request",
|
|
16
|
+
* "request": { "kind": "spawn", "child_id": "w1", "program": "/bin/node",
|
|
17
|
+
* "args": [], "env": [] } }
|
|
18
|
+
* // response
|
|
19
|
+
* { "protocol_version": "1.0.0", "id": "abc", "direction": "response",
|
|
20
|
+
* "response": { "kind": "spawned", "child_id": "w1", "pid": 4242 } }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* FROZEN v1.0: R2 (T11253) consumes this exact set. Do not add/rename/remove
|
|
24
|
+
* fields in place — see {@link SUPERVISOR_IPC_PROTOCOL_VERSION}.
|
|
25
|
+
*
|
|
26
|
+
* @task T11339
|
|
27
|
+
* @packageDocumentation
|
|
28
|
+
*/
|
|
29
|
+
import { z } from 'zod';
|
|
30
|
+
/**
|
|
31
|
+
* A single environment key/value override applied to a spawned child, layered
|
|
32
|
+
* on top of the supervisor's own environment. Mirrors `EnvPair` in Rust.
|
|
33
|
+
*/
|
|
34
|
+
export declare const EnvPairSchema: z.ZodObject<{
|
|
35
|
+
key: z.ZodString;
|
|
36
|
+
value: z.ZodString;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
/** A single environment key/value override (inferred from {@link EnvPairSchema}). */
|
|
39
|
+
export type EnvPair = z.infer<typeof EnvPairSchema>;
|
|
40
|
+
/**
|
|
41
|
+
* Liveness state of a supervised child. Mirrors `ChildState` in Rust.
|
|
42
|
+
*
|
|
43
|
+
* - `running` — the child process is alive.
|
|
44
|
+
* - `restarting` — the child exited and a backoff-delayed restart is pending.
|
|
45
|
+
* - `stopped` — the child exited and will not be restarted.
|
|
46
|
+
*/
|
|
47
|
+
export declare const ChildStateSchema: z.ZodEnum<{
|
|
48
|
+
running: "running";
|
|
49
|
+
restarting: "restarting";
|
|
50
|
+
stopped: "stopped";
|
|
51
|
+
}>;
|
|
52
|
+
/** Liveness state of a supervised child (inferred). */
|
|
53
|
+
export type ChildState = z.infer<typeof ChildStateSchema>;
|
|
54
|
+
/**
|
|
55
|
+
* A single child's status row in a monitor snapshot. Mirrors `ChildStatus`.
|
|
56
|
+
*/
|
|
57
|
+
export declare const ChildStatusSchema: z.ZodObject<{
|
|
58
|
+
child_id: z.ZodString;
|
|
59
|
+
pid: z.ZodNumber;
|
|
60
|
+
state: z.ZodEnum<{
|
|
61
|
+
running: "running";
|
|
62
|
+
restarting: "restarting";
|
|
63
|
+
stopped: "stopped";
|
|
64
|
+
}>;
|
|
65
|
+
restart_count: z.ZodNumber;
|
|
66
|
+
}, z.core.$strict>;
|
|
67
|
+
/** A single child's status row (inferred from {@link ChildStatusSchema}). */
|
|
68
|
+
export type ChildStatus = z.infer<typeof ChildStatusSchema>;
|
|
69
|
+
/**
|
|
70
|
+
* Ask the supervisor to spawn a new child worker. Mirrors `SpawnRequest`.
|
|
71
|
+
*/
|
|
72
|
+
export declare const SpawnRequestSchema: z.ZodObject<{
|
|
73
|
+
kind: z.ZodLiteral<"spawn">;
|
|
74
|
+
child_id: z.ZodString;
|
|
75
|
+
program: z.ZodString;
|
|
76
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
77
|
+
env: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
78
|
+
key: z.ZodString;
|
|
79
|
+
value: z.ZodString;
|
|
80
|
+
}, z.core.$strict>>>;
|
|
81
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
/** Spawn request payload (inferred from {@link SpawnRequestSchema}). */
|
|
84
|
+
export type SpawnRequest = z.infer<typeof SpawnRequestSchema>;
|
|
85
|
+
/**
|
|
86
|
+
* Ask the supervisor to restart an existing child by id. Mirrors `RestartRequest`.
|
|
87
|
+
*/
|
|
88
|
+
export declare const RestartRequestSchema: z.ZodObject<{
|
|
89
|
+
kind: z.ZodLiteral<"restart">;
|
|
90
|
+
child_id: z.ZodString;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
/** Restart request payload (inferred from {@link RestartRequestSchema}). */
|
|
93
|
+
export type RestartRequest = z.infer<typeof RestartRequestSchema>;
|
|
94
|
+
/**
|
|
95
|
+
* Ask the supervisor for the status of one or all children. Mirrors `MonitorRequest`.
|
|
96
|
+
*/
|
|
97
|
+
export declare const MonitorRequestSchema: z.ZodObject<{
|
|
98
|
+
kind: z.ZodLiteral<"monitor">;
|
|
99
|
+
child_id: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strict>;
|
|
101
|
+
/** Monitor request payload (inferred from {@link MonitorRequestSchema}). */
|
|
102
|
+
export type MonitorRequest = z.infer<typeof MonitorRequestSchema>;
|
|
103
|
+
/**
|
|
104
|
+
* Ask the supervisor for its own health. Mirrors `HealthRequest` (no fields
|
|
105
|
+
* beyond the discriminator).
|
|
106
|
+
*/
|
|
107
|
+
export declare const HealthRequestSchema: z.ZodObject<{
|
|
108
|
+
kind: z.ZodLiteral<"health">;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
/** Health request payload (inferred from {@link HealthRequestSchema}). */
|
|
111
|
+
export type HealthRequest = z.infer<typeof HealthRequestSchema>;
|
|
112
|
+
/**
|
|
113
|
+
* The discriminated union of all client → supervisor requests. The `kind`
|
|
114
|
+
* field selects the variant, matching the serde `#[serde(tag = "kind")]`
|
|
115
|
+
* tagging on the Rust `IpcRequest` enum.
|
|
116
|
+
*/
|
|
117
|
+
export declare const SupervisorIpcRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
118
|
+
kind: z.ZodLiteral<"spawn">;
|
|
119
|
+
child_id: z.ZodString;
|
|
120
|
+
program: z.ZodString;
|
|
121
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
122
|
+
env: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
123
|
+
key: z.ZodString;
|
|
124
|
+
value: z.ZodString;
|
|
125
|
+
}, z.core.$strict>>>;
|
|
126
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
128
|
+
kind: z.ZodLiteral<"restart">;
|
|
129
|
+
child_id: z.ZodString;
|
|
130
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
131
|
+
kind: z.ZodLiteral<"monitor">;
|
|
132
|
+
child_id: z.ZodOptional<z.ZodString>;
|
|
133
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
134
|
+
kind: z.ZodLiteral<"health">;
|
|
135
|
+
}, z.core.$strict>], "kind">;
|
|
136
|
+
/** Any supervisor IPC request (inferred from {@link SupervisorIpcRequestSchema}). */
|
|
137
|
+
export type SupervisorIpcRequest = z.infer<typeof SupervisorIpcRequestSchema>;
|
|
138
|
+
/**
|
|
139
|
+
* Result of a {@link SpawnRequest}. Mirrors `SpawnResult` carried by the
|
|
140
|
+
* `spawned` response variant.
|
|
141
|
+
*/
|
|
142
|
+
export declare const SpawnedResponseSchema: z.ZodObject<{
|
|
143
|
+
kind: z.ZodLiteral<"spawned">;
|
|
144
|
+
child_id: z.ZodString;
|
|
145
|
+
pid: z.ZodNumber;
|
|
146
|
+
}, z.core.$strict>;
|
|
147
|
+
/** Spawned response payload (inferred from {@link SpawnedResponseSchema}). */
|
|
148
|
+
export type SpawnedResponse = z.infer<typeof SpawnedResponseSchema>;
|
|
149
|
+
/**
|
|
150
|
+
* Result of a {@link RestartRequest}. Mirrors `RestartResult`.
|
|
151
|
+
*/
|
|
152
|
+
export declare const RestartedResponseSchema: z.ZodObject<{
|
|
153
|
+
kind: z.ZodLiteral<"restarted">;
|
|
154
|
+
child_id: z.ZodString;
|
|
155
|
+
pid: z.ZodNumber;
|
|
156
|
+
restart_count: z.ZodNumber;
|
|
157
|
+
}, z.core.$strict>;
|
|
158
|
+
/** Restarted response payload (inferred from {@link RestartedResponseSchema}). */
|
|
159
|
+
export type RestartedResponse = z.infer<typeof RestartedResponseSchema>;
|
|
160
|
+
/**
|
|
161
|
+
* A monitor snapshot for one or more children. Mirrors `MonitorResult`.
|
|
162
|
+
*/
|
|
163
|
+
export declare const MonitorResponseSchema: z.ZodObject<{
|
|
164
|
+
kind: z.ZodLiteral<"monitor">;
|
|
165
|
+
children: z.ZodArray<z.ZodObject<{
|
|
166
|
+
child_id: z.ZodString;
|
|
167
|
+
pid: z.ZodNumber;
|
|
168
|
+
state: z.ZodEnum<{
|
|
169
|
+
running: "running";
|
|
170
|
+
restarting: "restarting";
|
|
171
|
+
stopped: "stopped";
|
|
172
|
+
}>;
|
|
173
|
+
restart_count: z.ZodNumber;
|
|
174
|
+
}, z.core.$strict>>;
|
|
175
|
+
}, z.core.$strict>;
|
|
176
|
+
/** Monitor response payload (inferred from {@link MonitorResponseSchema}). */
|
|
177
|
+
export type MonitorResponse = z.infer<typeof MonitorResponseSchema>;
|
|
178
|
+
/**
|
|
179
|
+
* A health snapshot for the supervisor itself. Mirrors `HealthResult`.
|
|
180
|
+
*/
|
|
181
|
+
export declare const HealthResponseSchema: z.ZodObject<{
|
|
182
|
+
kind: z.ZodLiteral<"health">;
|
|
183
|
+
pid: z.ZodNumber;
|
|
184
|
+
child_count: z.ZodNumber;
|
|
185
|
+
uptime_secs: z.ZodNumber;
|
|
186
|
+
protocol_version: z.ZodString;
|
|
187
|
+
}, z.core.$strict>;
|
|
188
|
+
/** Health response payload (inferred from {@link HealthResponseSchema}). */
|
|
189
|
+
export type HealthResponse = z.infer<typeof HealthResponseSchema>;
|
|
190
|
+
/**
|
|
191
|
+
* Lifecycle event kind. Mirrors `LifecycleEventKind`.
|
|
192
|
+
*
|
|
193
|
+
* - `child_exited` — a child process exited.
|
|
194
|
+
* - `child_restarted` — a child was restarted after a crash.
|
|
195
|
+
*/
|
|
196
|
+
export declare const LifecycleEventKindSchema: z.ZodEnum<{
|
|
197
|
+
child_exited: "child_exited";
|
|
198
|
+
child_restarted: "child_restarted";
|
|
199
|
+
}>;
|
|
200
|
+
/** Lifecycle event kind (inferred from {@link LifecycleEventKindSchema}). */
|
|
201
|
+
export type LifecycleEventKind = z.infer<typeof LifecycleEventKindSchema>;
|
|
202
|
+
/**
|
|
203
|
+
* An unsolicited lifecycle event broadcast to all connected clients. Mirrors
|
|
204
|
+
* the `event` response variant wrapping `LifecycleEvent`.
|
|
205
|
+
*/
|
|
206
|
+
export declare const LifecycleEventResponseSchema: z.ZodObject<{
|
|
207
|
+
kind: z.ZodLiteral<"event">;
|
|
208
|
+
event: z.ZodEnum<{
|
|
209
|
+
child_exited: "child_exited";
|
|
210
|
+
child_restarted: "child_restarted";
|
|
211
|
+
}>;
|
|
212
|
+
child_id: z.ZodString;
|
|
213
|
+
exit_code: z.ZodOptional<z.ZodNumber>;
|
|
214
|
+
signal: z.ZodOptional<z.ZodString>;
|
|
215
|
+
restart_delay_ms: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
}, z.core.$strict>;
|
|
217
|
+
/** Lifecycle event response payload (inferred from {@link LifecycleEventResponseSchema}). */
|
|
218
|
+
export type LifecycleEventResponse = z.infer<typeof LifecycleEventResponseSchema>;
|
|
219
|
+
/**
|
|
220
|
+
* An error response correlated to a request. Mirrors `ErrorResult`.
|
|
221
|
+
*/
|
|
222
|
+
export declare const ErrorResponseSchema: z.ZodObject<{
|
|
223
|
+
kind: z.ZodLiteral<"error">;
|
|
224
|
+
code: z.ZodString;
|
|
225
|
+
message: z.ZodString;
|
|
226
|
+
}, z.core.$strict>;
|
|
227
|
+
/** Error response payload (inferred from {@link ErrorResponseSchema}). */
|
|
228
|
+
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
229
|
+
/**
|
|
230
|
+
* The discriminated union of all supervisor → client responses and events. The
|
|
231
|
+
* `kind` field selects the variant, matching the serde `#[serde(tag = "kind")]`
|
|
232
|
+
* tagging on the Rust `IpcResponse` enum.
|
|
233
|
+
*/
|
|
234
|
+
export declare const SupervisorIpcResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
235
|
+
kind: z.ZodLiteral<"spawned">;
|
|
236
|
+
child_id: z.ZodString;
|
|
237
|
+
pid: z.ZodNumber;
|
|
238
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
239
|
+
kind: z.ZodLiteral<"restarted">;
|
|
240
|
+
child_id: z.ZodString;
|
|
241
|
+
pid: z.ZodNumber;
|
|
242
|
+
restart_count: z.ZodNumber;
|
|
243
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
244
|
+
kind: z.ZodLiteral<"monitor">;
|
|
245
|
+
children: z.ZodArray<z.ZodObject<{
|
|
246
|
+
child_id: z.ZodString;
|
|
247
|
+
pid: z.ZodNumber;
|
|
248
|
+
state: z.ZodEnum<{
|
|
249
|
+
running: "running";
|
|
250
|
+
restarting: "restarting";
|
|
251
|
+
stopped: "stopped";
|
|
252
|
+
}>;
|
|
253
|
+
restart_count: z.ZodNumber;
|
|
254
|
+
}, z.core.$strict>>;
|
|
255
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
256
|
+
kind: z.ZodLiteral<"health">;
|
|
257
|
+
pid: z.ZodNumber;
|
|
258
|
+
child_count: z.ZodNumber;
|
|
259
|
+
uptime_secs: z.ZodNumber;
|
|
260
|
+
protocol_version: z.ZodString;
|
|
261
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
262
|
+
kind: z.ZodLiteral<"event">;
|
|
263
|
+
event: z.ZodEnum<{
|
|
264
|
+
child_exited: "child_exited";
|
|
265
|
+
child_restarted: "child_restarted";
|
|
266
|
+
}>;
|
|
267
|
+
child_id: z.ZodString;
|
|
268
|
+
exit_code: z.ZodOptional<z.ZodNumber>;
|
|
269
|
+
signal: z.ZodOptional<z.ZodString>;
|
|
270
|
+
restart_delay_ms: z.ZodOptional<z.ZodNumber>;
|
|
271
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
272
|
+
kind: z.ZodLiteral<"error">;
|
|
273
|
+
code: z.ZodString;
|
|
274
|
+
message: z.ZodString;
|
|
275
|
+
}, z.core.$strict>], "kind">;
|
|
276
|
+
/** Any supervisor IPC response (inferred from {@link SupervisorIpcResponseSchema}). */
|
|
277
|
+
export type SupervisorIpcResponse = z.infer<typeof SupervisorIpcResponseSchema>;
|
|
278
|
+
/**
|
|
279
|
+
* A client → supervisor request envelope.
|
|
280
|
+
*
|
|
281
|
+
* The `direction` discriminator + flattened `request` payload mirror the serde
|
|
282
|
+
* `#[serde(tag = "direction")]` `IpcPayload::Request { request }` variant.
|
|
283
|
+
*/
|
|
284
|
+
export declare const SupervisorIpcRequestEnvelopeSchema: z.ZodObject<{
|
|
285
|
+
protocol_version: z.ZodString;
|
|
286
|
+
id: z.ZodString;
|
|
287
|
+
direction: z.ZodLiteral<"request">;
|
|
288
|
+
request: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
289
|
+
kind: z.ZodLiteral<"spawn">;
|
|
290
|
+
child_id: z.ZodString;
|
|
291
|
+
program: z.ZodString;
|
|
292
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
293
|
+
env: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
294
|
+
key: z.ZodString;
|
|
295
|
+
value: z.ZodString;
|
|
296
|
+
}, z.core.$strict>>>;
|
|
297
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
298
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
299
|
+
kind: z.ZodLiteral<"restart">;
|
|
300
|
+
child_id: z.ZodString;
|
|
301
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
302
|
+
kind: z.ZodLiteral<"monitor">;
|
|
303
|
+
child_id: z.ZodOptional<z.ZodString>;
|
|
304
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
305
|
+
kind: z.ZodLiteral<"health">;
|
|
306
|
+
}, z.core.$strict>], "kind">;
|
|
307
|
+
}, z.core.$strict>;
|
|
308
|
+
/** Request envelope (inferred from {@link SupervisorIpcRequestEnvelopeSchema}). */
|
|
309
|
+
export type SupervisorIpcRequestEnvelope = z.infer<typeof SupervisorIpcRequestEnvelopeSchema>;
|
|
310
|
+
/**
|
|
311
|
+
* A supervisor → client response/event envelope.
|
|
312
|
+
*
|
|
313
|
+
* The `direction` discriminator + flattened `response` payload mirror the serde
|
|
314
|
+
* `IpcPayload::Response { response }` variant.
|
|
315
|
+
*/
|
|
316
|
+
export declare const SupervisorIpcResponseEnvelopeSchema: z.ZodObject<{
|
|
317
|
+
protocol_version: z.ZodString;
|
|
318
|
+
id: z.ZodString;
|
|
319
|
+
direction: z.ZodLiteral<"response">;
|
|
320
|
+
response: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
321
|
+
kind: z.ZodLiteral<"spawned">;
|
|
322
|
+
child_id: z.ZodString;
|
|
323
|
+
pid: z.ZodNumber;
|
|
324
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
325
|
+
kind: z.ZodLiteral<"restarted">;
|
|
326
|
+
child_id: z.ZodString;
|
|
327
|
+
pid: z.ZodNumber;
|
|
328
|
+
restart_count: z.ZodNumber;
|
|
329
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
330
|
+
kind: z.ZodLiteral<"monitor">;
|
|
331
|
+
children: z.ZodArray<z.ZodObject<{
|
|
332
|
+
child_id: z.ZodString;
|
|
333
|
+
pid: z.ZodNumber;
|
|
334
|
+
state: z.ZodEnum<{
|
|
335
|
+
running: "running";
|
|
336
|
+
restarting: "restarting";
|
|
337
|
+
stopped: "stopped";
|
|
338
|
+
}>;
|
|
339
|
+
restart_count: z.ZodNumber;
|
|
340
|
+
}, z.core.$strict>>;
|
|
341
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
342
|
+
kind: z.ZodLiteral<"health">;
|
|
343
|
+
pid: z.ZodNumber;
|
|
344
|
+
child_count: z.ZodNumber;
|
|
345
|
+
uptime_secs: z.ZodNumber;
|
|
346
|
+
protocol_version: z.ZodString;
|
|
347
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
348
|
+
kind: z.ZodLiteral<"event">;
|
|
349
|
+
event: z.ZodEnum<{
|
|
350
|
+
child_exited: "child_exited";
|
|
351
|
+
child_restarted: "child_restarted";
|
|
352
|
+
}>;
|
|
353
|
+
child_id: z.ZodString;
|
|
354
|
+
exit_code: z.ZodOptional<z.ZodNumber>;
|
|
355
|
+
signal: z.ZodOptional<z.ZodString>;
|
|
356
|
+
restart_delay_ms: z.ZodOptional<z.ZodNumber>;
|
|
357
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
358
|
+
kind: z.ZodLiteral<"error">;
|
|
359
|
+
code: z.ZodString;
|
|
360
|
+
message: z.ZodString;
|
|
361
|
+
}, z.core.$strict>], "kind">;
|
|
362
|
+
}, z.core.$strict>;
|
|
363
|
+
/** Response envelope (inferred from {@link SupervisorIpcResponseEnvelopeSchema}). */
|
|
364
|
+
export type SupervisorIpcResponseEnvelope = z.infer<typeof SupervisorIpcResponseEnvelopeSchema>;
|
|
365
|
+
/**
|
|
366
|
+
* The top-level IPC envelope: a versioned, correlated wrapper that is either a
|
|
367
|
+
* request or a response, discriminated by `direction`. One envelope per NDJSON
|
|
368
|
+
* line. Mirrors the Rust `IpcEnvelope`.
|
|
369
|
+
*/
|
|
370
|
+
export declare const SupervisorIpcEnvelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
371
|
+
protocol_version: z.ZodString;
|
|
372
|
+
id: z.ZodString;
|
|
373
|
+
direction: z.ZodLiteral<"request">;
|
|
374
|
+
request: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
375
|
+
kind: z.ZodLiteral<"spawn">;
|
|
376
|
+
child_id: z.ZodString;
|
|
377
|
+
program: z.ZodString;
|
|
378
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
379
|
+
env: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
380
|
+
key: z.ZodString;
|
|
381
|
+
value: z.ZodString;
|
|
382
|
+
}, z.core.$strict>>>;
|
|
383
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
384
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
385
|
+
kind: z.ZodLiteral<"restart">;
|
|
386
|
+
child_id: z.ZodString;
|
|
387
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
388
|
+
kind: z.ZodLiteral<"monitor">;
|
|
389
|
+
child_id: z.ZodOptional<z.ZodString>;
|
|
390
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
391
|
+
kind: z.ZodLiteral<"health">;
|
|
392
|
+
}, z.core.$strict>], "kind">;
|
|
393
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
394
|
+
protocol_version: z.ZodString;
|
|
395
|
+
id: z.ZodString;
|
|
396
|
+
direction: z.ZodLiteral<"response">;
|
|
397
|
+
response: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
398
|
+
kind: z.ZodLiteral<"spawned">;
|
|
399
|
+
child_id: z.ZodString;
|
|
400
|
+
pid: z.ZodNumber;
|
|
401
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
402
|
+
kind: z.ZodLiteral<"restarted">;
|
|
403
|
+
child_id: z.ZodString;
|
|
404
|
+
pid: z.ZodNumber;
|
|
405
|
+
restart_count: z.ZodNumber;
|
|
406
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
407
|
+
kind: z.ZodLiteral<"monitor">;
|
|
408
|
+
children: z.ZodArray<z.ZodObject<{
|
|
409
|
+
child_id: z.ZodString;
|
|
410
|
+
pid: z.ZodNumber;
|
|
411
|
+
state: z.ZodEnum<{
|
|
412
|
+
running: "running";
|
|
413
|
+
restarting: "restarting";
|
|
414
|
+
stopped: "stopped";
|
|
415
|
+
}>;
|
|
416
|
+
restart_count: z.ZodNumber;
|
|
417
|
+
}, z.core.$strict>>;
|
|
418
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
419
|
+
kind: z.ZodLiteral<"health">;
|
|
420
|
+
pid: z.ZodNumber;
|
|
421
|
+
child_count: z.ZodNumber;
|
|
422
|
+
uptime_secs: z.ZodNumber;
|
|
423
|
+
protocol_version: z.ZodString;
|
|
424
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
425
|
+
kind: z.ZodLiteral<"event">;
|
|
426
|
+
event: z.ZodEnum<{
|
|
427
|
+
child_exited: "child_exited";
|
|
428
|
+
child_restarted: "child_restarted";
|
|
429
|
+
}>;
|
|
430
|
+
child_id: z.ZodString;
|
|
431
|
+
exit_code: z.ZodOptional<z.ZodNumber>;
|
|
432
|
+
signal: z.ZodOptional<z.ZodString>;
|
|
433
|
+
restart_delay_ms: z.ZodOptional<z.ZodNumber>;
|
|
434
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
435
|
+
kind: z.ZodLiteral<"error">;
|
|
436
|
+
code: z.ZodString;
|
|
437
|
+
message: z.ZodString;
|
|
438
|
+
}, z.core.$strict>], "kind">;
|
|
439
|
+
}, z.core.$strict>], "direction">;
|
|
440
|
+
/** Any supervisor IPC envelope (inferred from {@link SupervisorIpcEnvelopeSchema}). */
|
|
441
|
+
export type SupervisorIpcEnvelope = z.infer<typeof SupervisorIpcEnvelopeSchema>;
|
|
442
|
+
/**
|
|
443
|
+
* The FROZEN v1.0 request `kind` values. The schema-drift guard test pins this
|
|
444
|
+
* tuple; any addition/removal is a contract-breaking change.
|
|
445
|
+
*/
|
|
446
|
+
export declare const SUPERVISOR_IPC_REQUEST_KINDS: readonly ["spawn", "restart", "monitor", "health"];
|
|
447
|
+
/**
|
|
448
|
+
* The FROZEN v1.0 response `kind` values. The schema-drift guard test pins this
|
|
449
|
+
* tuple; any addition/removal is a contract-breaking change.
|
|
450
|
+
*/
|
|
451
|
+
export declare const SUPERVISOR_IPC_RESPONSE_KINDS: readonly ["spawned", "restarted", "monitor", "health", "event", "error"];
|
|
452
|
+
/**
|
|
453
|
+
* The complete FROZEN v1.0 message kind set (requests + responses), used by the
|
|
454
|
+
* drift guard on both the TS and Rust sides.
|
|
455
|
+
*/
|
|
456
|
+
export declare const SUPERVISOR_IPC_MESSAGE_KINDS: readonly ["spawn", "restart", "monitor", "health", "spawned", "restarted", "monitor", "health", "event", "error"];
|
|
457
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/supervisor-ipc/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;GAGG;AACH,eAAO,MAAM,aAAa;;;kBAOf,CAAC;AAEZ,qFAAqF;AACrF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD;;;;;;GAMG;AACH,eAA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