@stitchwire/client 0.0.0-stage → 0.31.1

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.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +296 -2
  3. package/dist/chunk-d3248e3w.js +728 -0
  4. package/dist/chunk-mva06nh4.js +709 -0
  5. package/dist/contracts.d.ts +1 -0
  6. package/dist/contracts.js +84 -0
  7. package/dist/enrollment.d.ts +1 -0
  8. package/dist/enrollment.js +503 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.js +1680 -0
  11. package/dist/types/client/src/contracts.d.ts +1 -0
  12. package/dist/types/client/src/enrollment.d.ts +11 -0
  13. package/dist/types/client/src/index.d.ts +1 -0
  14. package/dist/types/contracts/src/door/client-error.d.ts +20 -0
  15. package/dist/types/contracts/src/door/common.d.ts +3 -0
  16. package/dist/types/contracts/src/door/event-lifecycle.d.ts +22 -0
  17. package/dist/types/contracts/src/door/local-contract.d.ts +466 -0
  18. package/dist/types/contracts/src/door/paths.d.ts +17 -0
  19. package/dist/types/contracts/src/door/request-bounds.d.ts +4 -0
  20. package/dist/types/contracts/src/door/requests.d.ts +47 -0
  21. package/dist/types/contracts/src/door/results.d.ts +319 -0
  22. package/dist/types/contracts/src/door/status.d.ts +859 -0
  23. package/dist/types/contracts/src/door/streams.d.ts +226 -0
  24. package/dist/types/contracts/src/enrollment/fleet-admission.d.ts +413 -0
  25. package/dist/types/contracts/src/enrollment/outcome.d.ts +29 -0
  26. package/dist/types/contracts/src/enrollment/request.d.ts +281 -0
  27. package/dist/types/contracts/src/enrollment/result.d.ts +713 -0
  28. package/dist/types/contracts/src/fleet/bundle.d.ts +209 -0
  29. package/dist/types/contracts/src/fleet/identity.d.ts +4 -0
  30. package/dist/types/contracts/src/fleet/manifest.d.ts +71 -0
  31. package/dist/types/contracts/src/fleet/status.d.ts +56 -0
  32. package/dist/types/contracts/src/peer-contract.d.ts +78 -0
  33. package/dist/types/contracts/src/protocol/bounds.d.ts +37 -0
  34. package/dist/types/contracts/src/protocol/broker-health.d.ts +384 -0
  35. package/dist/types/contracts/src/protocol/event.d.ts +222 -0
  36. package/dist/types/contracts/src/protocol/failure.d.ts +146 -0
  37. package/dist/types/contracts/src/protocol/identity.d.ts +11 -0
  38. package/dist/types/contracts/src/protocol/json-bounds.d.ts +6 -0
  39. package/dist/types/contracts/src/protocol/lane-url.d.ts +16 -0
  40. package/dist/types/contracts/src/protocol/paths.d.ts +7 -0
  41. package/dist/types/contracts/src/protocol/payload.d.ts +25 -0
  42. package/dist/types/contracts/src/protocol/presence.d.ts +66 -0
  43. package/dist/types/contracts/src/protocol/release.d.ts +61 -0
  44. package/dist/types/contracts/src/protocol/result.d.ts +41 -0
  45. package/dist/types/contracts/src/protocol/rpc.d.ts +106 -0
  46. package/dist/types/contracts/src/protocol/schema-parse.d.ts +23 -0
  47. package/dist/types/contracts/src/protocol/stream.d.ts +290 -0
  48. package/dist/types/contracts/src/protocol/topic.d.ts +185 -0
  49. package/dist/types/contracts/src/service/budgets.d.ts +3 -0
  50. package/dist/types/contracts/src/service/contract-descriptor.d.ts +9 -0
  51. package/dist/types/contracts/src/service/contracts.d.ts +430 -0
  52. package/dist/types/contracts/src/service/declaration.d.ts +122 -0
  53. package/dist/types/contracts/src/service/diagnostics.d.ts +104 -0
  54. package/dist/types/contracts/src/service/owner-route-path.d.ts +11 -0
  55. package/dist/types/contracts/src/service/policy-schema.d.ts +154 -0
  56. package/dist/types/contracts/src/service/request-bounds.d.ts +5 -0
  57. package/dist/types/contracts/src/service/service-contract.d.ts +112 -0
  58. package/dist/types/local-client/src/broker-health.d.ts +18 -0
  59. package/dist/types/local-client/src/client.d.ts +377 -0
  60. package/dist/types/local-client/src/contracts.d.ts +112 -0
  61. package/dist/types/local-client/src/declarations.d.ts +57 -0
  62. package/dist/types/local-client/src/door-paths.d.ts +18 -0
  63. package/dist/types/local-client/src/errno.d.ts +6 -0
  64. package/dist/types/local-client/src/error-chain.d.ts +25 -0
  65. package/dist/types/local-client/src/errors.d.ts +39 -0
  66. package/dist/types/local-client/src/event-sequence.d.ts +4 -0
  67. package/dist/types/local-client/src/feed.d.ts +8 -0
  68. package/dist/types/local-client/src/http.d.ts +20 -0
  69. package/dist/types/local-client/src/index.d.ts +13 -0
  70. package/dist/types/local-client/src/ingress.d.ts +31 -0
  71. package/dist/types/local-client/src/operation.d.ts +37 -0
  72. package/dist/types/local-client/src/options.d.ts +18 -0
  73. package/dist/types/local-client/src/paths.d.ts +52 -0
  74. package/dist/types/local-client/src/readers.d.ts +143 -0
  75. package/dist/types/local-client/src/service.d.ts +33 -0
  76. package/dist/types/local-client/src/status-readers.d.ts +756 -0
  77. package/dist/types/local-client/src/unary.d.ts +10 -0
  78. package/package.json +58 -4
@@ -0,0 +1,384 @@
1
+ import { z } from 'zod';
2
+ /** `maxMs` is the worst delay inside the trailing `windowMs`, not since the broker started. */
3
+ export declare const EventLoopDelaySnapshotSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
+ state: z.ZodLiteral<"unknown">;
5
+ sampledAt: z.ZodNull;
6
+ lastMs: z.ZodNull;
7
+ maxMs: z.ZodNull;
8
+ windowMs: z.ZodNumber;
9
+ }, z.core.$strict>, z.ZodObject<{
10
+ state: z.ZodLiteral<"measured">;
11
+ sampledAt: z.ZodISODateTime;
12
+ lastMs: z.ZodNumber;
13
+ maxMs: z.ZodNumber;
14
+ windowMs: z.ZodNumber;
15
+ }, z.core.$strict>], "state">;
16
+ export type EventLoopDelaySnapshot = z.infer<typeof EventLoopDelaySnapshotSchema>;
17
+ export declare const TransportObservationSnapshotSchema: z.ZodObject<{
18
+ broker: z.ZodString;
19
+ lastDisconnect: z.ZodNullable<z.ZodObject<{
20
+ nodeId: z.ZodString;
21
+ reason: z.ZodString;
22
+ observedAt: z.ZodISODateTime;
23
+ }, z.core.$strict>>;
24
+ eventLoopDelay: z.ZodDiscriminatedUnion<[z.ZodObject<{
25
+ state: z.ZodLiteral<"unknown">;
26
+ sampledAt: z.ZodNull;
27
+ lastMs: z.ZodNull;
28
+ maxMs: z.ZodNull;
29
+ windowMs: z.ZodNumber;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ state: z.ZodLiteral<"measured">;
32
+ sampledAt: z.ZodISODateTime;
33
+ lastMs: z.ZodNumber;
34
+ maxMs: z.ZodNumber;
35
+ windowMs: z.ZodNumber;
36
+ }, z.core.$strict>], "state">;
37
+ }, z.core.$strict>;
38
+ export type TransportObservationSnapshot = z.infer<typeof TransportObservationSnapshotSchema>;
39
+ export declare const BrokerFleetMachineSchema: z.ZodObject<{
40
+ nodeId: z.ZodString;
41
+ online: z.ZodBoolean;
42
+ release: z.ZodObject<{
43
+ current: z.ZodNullable<z.ZodString>;
44
+ latest: z.ZodNullable<z.ZodString>;
45
+ latestAt: z.ZodNullable<z.ZodString>;
46
+ checkedAt: z.ZodNullable<z.ZodString>;
47
+ ok: z.ZodBoolean;
48
+ }, z.core.$strict>;
49
+ behind: z.ZodNullable<z.ZodEnum<{
50
+ major: "major";
51
+ minor: "minor";
52
+ patch: "patch";
53
+ }>>;
54
+ }, z.core.$strict>;
55
+ /**
56
+ * Which build every machine on this wire carries, and how far behind it is.
57
+ *
58
+ * The broker is the only party that can answer this. It is the reference by construction — it
59
+ * admits its own version and nothing else — and it is the only one that ever sees the build of a
60
+ * node it REFUSED, in the instant before refusing it. Without this, a node left on an older
61
+ * artifact reads as `offline`, the same word a broken network earns, and the two need opposite
62
+ * repairs.
63
+ */
64
+ export declare const BrokerFleetStatusSchema: z.ZodObject<{
65
+ latest: z.ZodString;
66
+ latestAt: z.ZodNullable<z.ZodString>;
67
+ machines: z.ZodArray<z.ZodObject<{
68
+ nodeId: z.ZodString;
69
+ online: z.ZodBoolean;
70
+ release: z.ZodObject<{
71
+ current: z.ZodNullable<z.ZodString>;
72
+ latest: z.ZodNullable<z.ZodString>;
73
+ latestAt: z.ZodNullable<z.ZodString>;
74
+ checkedAt: z.ZodNullable<z.ZodString>;
75
+ ok: z.ZodBoolean;
76
+ }, z.core.$strict>;
77
+ behind: z.ZodNullable<z.ZodEnum<{
78
+ major: "major";
79
+ minor: "minor";
80
+ patch: "patch";
81
+ }>>;
82
+ }, z.core.$strict>>;
83
+ }, z.core.$strict>;
84
+ export declare const BrokerEventsHealthSchema: z.ZodObject<{
85
+ subscriptions: z.ZodNumber;
86
+ accepted: z.ZodNumber;
87
+ topics: z.ZodNumber;
88
+ recent: z.ZodObject<{
89
+ count: z.ZodNumber;
90
+ windowMs: z.ZodNumber;
91
+ }, z.core.$strict>;
92
+ }, z.core.$strict>;
93
+ /** Declared bounds beside actual occupancy, because a window nobody ever falls inside and one that
94
+ * is always full need opposite repairs. */
95
+ export declare const BrokerTopicRetentionHealthSchema: z.ZodObject<{
96
+ maxAgeMs: z.ZodNumber;
97
+ maxBytes: z.ZodNumber;
98
+ events: z.ZodNumber;
99
+ bytes: z.ZodNumber;
100
+ oldestAgeMs: z.ZodNullable<z.ZodNumber>;
101
+ }, z.core.$strict>;
102
+ /** Per-topic flow and ceilings. Transport health says the broker is alive; this says whether
103
+ * anything is still arriving, which is the question a silent fleet actually raises. */
104
+ export declare const BrokerTopicHealthSchema: z.ZodObject<{
105
+ topic: z.ZodString;
106
+ source: z.ZodEnum<{
107
+ fleet: "fleet";
108
+ owner: "owner";
109
+ }>;
110
+ producer: z.ZodString;
111
+ publisherLive: z.ZodBoolean;
112
+ sinceLastPublishMs: z.ZodNullable<z.ZodNumber>;
113
+ cadence: z.ZodObject<{
114
+ count: z.ZodNumber;
115
+ windowMs: z.ZodNumber;
116
+ }, z.core.$strict>;
117
+ publicationMode: z.ZodEnum<{
118
+ "on-change": "on-change";
119
+ periodic: "periodic";
120
+ unknown: "unknown";
121
+ }>;
122
+ rejectedPublishes: z.ZodNumber;
123
+ sinceLastRejectionMs: z.ZodNullable<z.ZodNumber>;
124
+ subscribers: z.ZodNumber;
125
+ limits: z.ZodObject<{
126
+ maxSubscribers: z.ZodNumber;
127
+ maxEventsPerSecond: z.ZodNumber;
128
+ maxEventBytes: z.ZodNumber;
129
+ }, z.core.$strict>;
130
+ retention: z.ZodNullable<z.ZodObject<{
131
+ maxAgeMs: z.ZodNumber;
132
+ maxBytes: z.ZodNumber;
133
+ events: z.ZodNumber;
134
+ bytes: z.ZodNumber;
135
+ oldestAgeMs: z.ZodNullable<z.ZodNumber>;
136
+ }, z.core.$strict>>;
137
+ }, z.core.$strict>;
138
+ /** The per-caller ceilings this broker enforces. A client that knows them can pace itself; without
139
+ * them the only way to learn a limit is to be refused by it. */
140
+ export declare const BrokerAdmissionHealthSchema: z.ZodObject<{
141
+ maxInflightPerNode: z.ZodNumber;
142
+ maxCallsPerMinutePerNode: z.ZodNumber;
143
+ maxStreamsTotal: z.ZodNumber;
144
+ maxStreamsPerCaller: z.ZodNumber;
145
+ maxStreamsPerProducer: z.ZodNumber;
146
+ maxStreamOpensPerMinute: z.ZodNumber;
147
+ maxEventSubscriptionsTotal: z.ZodNumber;
148
+ maxEventSubscribesPerMinute: z.ZodNumber;
149
+ }, z.core.$strict>;
150
+ /**
151
+ * What a broker writes on `/health`. Strict, because this is the boundary of writing: a field the
152
+ * broker did not declare is a leak of its internals and fails the response rather than reaching a
153
+ * reader. Every reader — doctor, enrollment, operator tools, the SDK — reads it with the tolerant
154
+ * `BrokerHealthSchema` of `@stitchwire/client/contracts` instead, because a fleet always runs more
155
+ * than one release and a broker of the next one adds fields this one does not know.
156
+ */
157
+ export declare const BrokerHealthContractSchema: z.ZodObject<{
158
+ ok: z.ZodBoolean;
159
+ nodes: z.ZodArray<z.ZodObject<{
160
+ nodeId: z.ZodString;
161
+ online: z.ZodBoolean;
162
+ serves: z.ZodBoolean;
163
+ connections: z.ZodNumber;
164
+ since: z.ZodNullable<z.ZodString>;
165
+ version: z.ZodNullable<z.ZodString>;
166
+ behind: z.ZodNullable<z.ZodEnum<{
167
+ major: "major";
168
+ minor: "minor";
169
+ patch: "patch";
170
+ }>>;
171
+ versionSeenAt: z.ZodNullable<z.ZodString>;
172
+ departure: z.ZodNullable<z.ZodObject<{
173
+ at: z.ZodString;
174
+ reason: z.ZodString;
175
+ kind: z.ZodEnum<{
176
+ announced: "announced";
177
+ "broker-restart": "broker-restart";
178
+ lost: "lost";
179
+ }>;
180
+ }, z.core.$strict>>;
181
+ observingSince: z.ZodString;
182
+ }, z.core.$strict>>;
183
+ observingSince: z.ZodString;
184
+ transport: z.ZodObject<{
185
+ broker: z.ZodString;
186
+ lastDisconnect: z.ZodNullable<z.ZodObject<{
187
+ nodeId: z.ZodString;
188
+ reason: z.ZodString;
189
+ observedAt: z.ZodISODateTime;
190
+ }, z.core.$strict>>;
191
+ eventLoopDelay: z.ZodDiscriminatedUnion<[z.ZodObject<{
192
+ state: z.ZodLiteral<"unknown">;
193
+ sampledAt: z.ZodNull;
194
+ lastMs: z.ZodNull;
195
+ maxMs: z.ZodNull;
196
+ windowMs: z.ZodNumber;
197
+ }, z.core.$strict>, z.ZodObject<{
198
+ state: z.ZodLiteral<"measured">;
199
+ sampledAt: z.ZodISODateTime;
200
+ lastMs: z.ZodNumber;
201
+ maxMs: z.ZodNumber;
202
+ windowMs: z.ZodNumber;
203
+ }, z.core.$strict>], "state">;
204
+ }, z.core.$strict>;
205
+ audit: z.ZodObject<{
206
+ queued: z.ZodNumber;
207
+ dropped: z.ZodNumber;
208
+ writeFailures: z.ZodNumber;
209
+ lastFailure: z.ZodNullable<z.ZodString>;
210
+ recovery: z.ZodOptional<z.ZodObject<{
211
+ filesChecked: z.ZodNumber;
212
+ anomalies: z.ZodNumber;
213
+ skippedBytes: z.ZodNumber;
214
+ firstAnomaly: z.ZodOptional<z.ZodObject<{
215
+ file: z.ZodString;
216
+ offset: z.ZodNumber;
217
+ line: z.ZodNumber;
218
+ reason: z.ZodEnum<{
219
+ "invalid-event": "invalid-event";
220
+ "invalid-frame": "invalid-frame";
221
+ "invalid-json": "invalid-json";
222
+ "invalid-utf8": "invalid-utf8";
223
+ "nul-byte": "nul-byte";
224
+ "oversized-line": "oversized-line";
225
+ "unterminated-line": "unterminated-line";
226
+ }>;
227
+ position: z.ZodEnum<{
228
+ interior: "interior";
229
+ tail: "tail";
230
+ }>;
231
+ terminated: z.ZodBoolean;
232
+ skippedBytes: z.ZodNumber;
233
+ }, z.core.$strict>>;
234
+ lastAnomaly: z.ZodOptional<z.ZodObject<{
235
+ file: z.ZodString;
236
+ offset: z.ZodNumber;
237
+ line: z.ZodNumber;
238
+ reason: z.ZodEnum<{
239
+ "invalid-event": "invalid-event";
240
+ "invalid-frame": "invalid-frame";
241
+ "invalid-json": "invalid-json";
242
+ "invalid-utf8": "invalid-utf8";
243
+ "nul-byte": "nul-byte";
244
+ "oversized-line": "oversized-line";
245
+ "unterminated-line": "unterminated-line";
246
+ }>;
247
+ position: z.ZodEnum<{
248
+ interior: "interior";
249
+ tail: "tail";
250
+ }>;
251
+ terminated: z.ZodBoolean;
252
+ skippedBytes: z.ZodNumber;
253
+ }, z.core.$strict>>;
254
+ quarantined: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
255
+ file: z.ZodString;
256
+ quarantinedAs: z.ZodString;
257
+ reason: z.ZodOptional<z.ZodEnum<{
258
+ "not-a-regular-file": "not-a-regular-file";
259
+ "torn-without-retention-slot": "torn-without-retention-slot";
260
+ unreadable: "unreadable";
261
+ }>>;
262
+ code: z.ZodOptional<z.ZodString>;
263
+ }, z.core.$strict>>>>;
264
+ quarantinedUnlisted: z.ZodOptional<z.ZodNumber>;
265
+ }, z.core.$strict>>;
266
+ journal: z.ZodObject<{
267
+ path: z.ZodString;
268
+ bytes: z.ZodNumber;
269
+ generations: z.ZodNumber;
270
+ maxBytes: z.ZodNumber;
271
+ keep: z.ZodNumber;
272
+ rotations: z.ZodNumber;
273
+ }, z.core.$strict>;
274
+ }, z.core.$strict>;
275
+ fleet: z.ZodObject<{
276
+ latest: z.ZodString;
277
+ latestAt: z.ZodNullable<z.ZodString>;
278
+ machines: z.ZodArray<z.ZodObject<{
279
+ nodeId: z.ZodString;
280
+ online: z.ZodBoolean;
281
+ release: z.ZodObject<{
282
+ current: z.ZodNullable<z.ZodString>;
283
+ latest: z.ZodNullable<z.ZodString>;
284
+ latestAt: z.ZodNullable<z.ZodString>;
285
+ checkedAt: z.ZodNullable<z.ZodString>;
286
+ ok: z.ZodBoolean;
287
+ }, z.core.$strict>;
288
+ behind: z.ZodNullable<z.ZodEnum<{
289
+ major: "major";
290
+ minor: "minor";
291
+ patch: "patch";
292
+ }>>;
293
+ }, z.core.$strict>>;
294
+ }, z.core.$strict>;
295
+ application: z.ZodObject<{
296
+ id: z.ZodString;
297
+ lifecycle: z.ZodString;
298
+ health: z.ZodString;
299
+ ready: z.ZodBoolean;
300
+ capturedAt: z.ZodString;
301
+ resources: z.ZodObject<{
302
+ total: z.ZodNumber;
303
+ ready: z.ZodNumber;
304
+ degraded: z.ZodNumber;
305
+ failed: z.ZodNumber;
306
+ }, z.core.$strict>;
307
+ }, z.core.$strict>;
308
+ bundle: z.ZodObject<{
309
+ serial: z.ZodNullable<z.ZodNumber>;
310
+ issuedAt: z.ZodNullable<z.ZodISODateTime>;
311
+ signer: z.ZodNullable<z.ZodString>;
312
+ config: z.ZodEnum<{
313
+ aligned: "aligned";
314
+ drifted: "drifted";
315
+ unconfigured: "unconfigured";
316
+ unknown: "unknown";
317
+ }>;
318
+ detail: z.ZodNullable<z.ZodString>;
319
+ checkedAt: z.ZodNullable<z.ZodISODateTime>;
320
+ }, z.core.$strict>;
321
+ streams: z.ZodObject<{
322
+ active: z.ZodNumber;
323
+ }, z.core.$strict>;
324
+ events: z.ZodObject<{
325
+ subscriptions: z.ZodNumber;
326
+ accepted: z.ZodNumber;
327
+ topics: z.ZodNumber;
328
+ recent: z.ZodObject<{
329
+ count: z.ZodNumber;
330
+ windowMs: z.ZodNumber;
331
+ }, z.core.$strict>;
332
+ }, z.core.$strict>;
333
+ topics: z.ZodArray<z.ZodObject<{
334
+ topic: z.ZodString;
335
+ source: z.ZodEnum<{
336
+ fleet: "fleet";
337
+ owner: "owner";
338
+ }>;
339
+ producer: z.ZodString;
340
+ publisherLive: z.ZodBoolean;
341
+ sinceLastPublishMs: z.ZodNullable<z.ZodNumber>;
342
+ cadence: z.ZodObject<{
343
+ count: z.ZodNumber;
344
+ windowMs: z.ZodNumber;
345
+ }, z.core.$strict>;
346
+ publicationMode: z.ZodEnum<{
347
+ "on-change": "on-change";
348
+ periodic: "periodic";
349
+ unknown: "unknown";
350
+ }>;
351
+ rejectedPublishes: z.ZodNumber;
352
+ sinceLastRejectionMs: z.ZodNullable<z.ZodNumber>;
353
+ subscribers: z.ZodNumber;
354
+ limits: z.ZodObject<{
355
+ maxSubscribers: z.ZodNumber;
356
+ maxEventsPerSecond: z.ZodNumber;
357
+ maxEventBytes: z.ZodNumber;
358
+ }, z.core.$strict>;
359
+ retention: z.ZodNullable<z.ZodObject<{
360
+ maxAgeMs: z.ZodNumber;
361
+ maxBytes: z.ZodNumber;
362
+ events: z.ZodNumber;
363
+ bytes: z.ZodNumber;
364
+ oldestAgeMs: z.ZodNullable<z.ZodNumber>;
365
+ }, z.core.$strict>>;
366
+ }, z.core.$strict>>;
367
+ admission: z.ZodObject<{
368
+ maxInflightPerNode: z.ZodNumber;
369
+ maxCallsPerMinutePerNode: z.ZodNumber;
370
+ maxStreamsTotal: z.ZodNumber;
371
+ maxStreamsPerCaller: z.ZodNumber;
372
+ maxStreamsPerProducer: z.ZodNumber;
373
+ maxStreamOpensPerMinute: z.ZodNumber;
374
+ maxEventSubscriptionsTotal: z.ZodNumber;
375
+ maxEventSubscribesPerMinute: z.ZodNumber;
376
+ }, z.core.$strict>;
377
+ }, z.core.$strict>;
378
+ export type BrokerHealth = z.infer<typeof BrokerHealthContractSchema>;
379
+ /**
380
+ * Derive the HTTP(S) `/health` endpoint URL from a broker lane URL (`ws://`, `wss://`, `http://`,
381
+ * `https://`). The lane is judged by the one lane rule, `laneUrlRefusal`, so plain text outside
382
+ * loopback is refused here as everywhere else; the error names the rule, never the URL.
383
+ */
384
+ export declare function brokerHealthUrl(laneUrl: string): string;
@@ -0,0 +1,222 @@
1
+ import { z } from 'zod';
2
+ import { type Refused } from './failure.ts';
3
+ export declare const TopicNameSchema: z.ZodString;
4
+ /**
5
+ * What a returning subscriber knows: the producer boot it was following and the last sequence it
6
+ * actually saw. It is a claim about the subscriber's own past, never a demand — the broker answers
7
+ * with whatever it still holds and names the rest as a gap. A resume for a boot the broker no longer
8
+ * knows is not an error either; it is simply a gap that starts at the beginning of the new epoch.
9
+ */
10
+ export declare const EventResumeSchema: z.ZodObject<{
11
+ bootId: z.ZodUUID;
12
+ afterSeq: z.ZodNumber;
13
+ }, z.core.$strict>;
14
+ export type EventResume = z.infer<typeof EventResumeSchema>;
15
+ export declare const EventSubscribeSchema: z.ZodObject<{
16
+ subscriptionId: z.ZodUUID;
17
+ topic: z.ZodString;
18
+ subscriber: z.ZodString;
19
+ resume: z.ZodNullable<z.ZodObject<{
20
+ bootId: z.ZodUUID;
21
+ afterSeq: z.ZodNumber;
22
+ }, z.core.$strict>>;
23
+ }, z.core.$strict>;
24
+ export type EventSubscribe = z.infer<typeof EventSubscribeSchema>;
25
+ export declare const EventUnsubscribeSchema: z.ZodObject<{
26
+ subscriptionId: z.ZodUUID;
27
+ topic: z.ZodString;
28
+ subscriber: z.ZodString;
29
+ reason: z.ZodString;
30
+ }, z.core.$strict>;
31
+ export type EventUnsubscribe = z.infer<typeof EventUnsubscribeSchema>;
32
+ export declare const EventPayloadFields: {
33
+ topic: z.ZodString;
34
+ producer: z.ZodString;
35
+ bootId: z.ZodUUID;
36
+ seq: z.ZodNumber;
37
+ observedAt: z.ZodNullable<z.ZodISODateTime>;
38
+ cursor: z.ZodNullable<z.ZodString>;
39
+ encoding: z.ZodLiteral<"base64">;
40
+ data: z.ZodString;
41
+ bytes: z.ZodNumber;
42
+ };
43
+ export declare const EventPublishSchema: z.ZodObject<{
44
+ topic: z.ZodString;
45
+ producer: z.ZodString;
46
+ bootId: z.ZodUUID;
47
+ seq: z.ZodNumber;
48
+ observedAt: z.ZodNullable<z.ZodISODateTime>;
49
+ cursor: z.ZodNullable<z.ZodString>;
50
+ encoding: z.ZodLiteral<"base64">;
51
+ data: z.ZodString;
52
+ bytes: z.ZodNumber;
53
+ }, z.core.$strict>;
54
+ export type EventPublish = z.infer<typeof EventPublishSchema>;
55
+ export declare const EventFrameSchema: z.ZodObject<{
56
+ topic: z.ZodString;
57
+ producer: z.ZodString;
58
+ bootId: z.ZodUUID;
59
+ seq: z.ZodNumber;
60
+ observedAt: z.ZodNullable<z.ZodISODateTime>;
61
+ cursor: z.ZodNullable<z.ZodString>;
62
+ encoding: z.ZodLiteral<"base64">;
63
+ data: z.ZodString;
64
+ bytes: z.ZodNumber;
65
+ subscriptionId: z.ZodUUID;
66
+ }, z.core.$strict>;
67
+ export type EventFrame = z.infer<typeof EventFrameSchema>;
68
+ /**
69
+ * Why a subscriber is missing sequences. The reason is not decoration: an operator reading
70
+ * `overflow` goes and raises `queueDepth`, which is the wrong repair for a laptop that was asleep.
71
+ *
72
+ * - `latest-wins` — the topic coalesces by declaration; the skipped events were superseded.
73
+ * - `overflow` — the subscriber could not keep up and its bounded queue dropped frames.
74
+ * - `boot-change` — the producer restarted; the previous epoch ends here.
75
+ * - `resume` — the subscriber came back and the topic retains nothing. Expected, not a fault.
76
+ * - `retention` — the subscriber came back past the retention window; the head is gone.
77
+ */
78
+ export declare const EventGapReasonSchema: z.ZodEnum<{
79
+ "boot-change": "boot-change";
80
+ "latest-wins": "latest-wins";
81
+ overflow: "overflow";
82
+ resume: "resume";
83
+ retention: "retention";
84
+ }>;
85
+ /** The field list of a gap, shared so the door's view cannot drift from the wire's. */
86
+ export declare const EventGapFields: {
87
+ readonly subscriptionId: z.ZodUUID;
88
+ readonly topic: z.ZodString;
89
+ readonly producer: z.ZodString;
90
+ readonly bootId: z.ZodUUID;
91
+ readonly fromSeq: z.ZodNumber;
92
+ readonly toSeq: z.ZodNumber;
93
+ readonly reason: z.ZodEnum<{
94
+ "boot-change": "boot-change";
95
+ "latest-wins": "latest-wins";
96
+ overflow: "overflow";
97
+ resume: "resume";
98
+ retention: "retention";
99
+ }>;
100
+ readonly nextBootId: z.ZodOptional<z.ZodUUID>;
101
+ };
102
+ /**
103
+ * The two things a gap must satisfy and TypeScript cannot express.
104
+ *
105
+ * `nextBootId` is optional in the inferred type, so nothing but a refinement can say that it is
106
+ * required for `boot-change` and forbidden otherwise; and nothing but a refinement can say that a
107
+ * range runs forwards. They are exported because the door declares its own gap shape, and a copy
108
+ * of the fields WITHOUT these two once meant a locally built gap reached a consumer unchecked.
109
+ */
110
+ export declare const eventGapRangeIsOrdered: (gap: {
111
+ fromSeq: number;
112
+ toSeq: number;
113
+ }) => boolean;
114
+ export declare const EVENT_GAP_RANGE_MESSAGE = "gap sequence range is inverted";
115
+ export declare const eventGapBootTransitionIsExact: (gap: {
116
+ reason: string;
117
+ bootId: string;
118
+ nextBootId?: string | undefined;
119
+ }) => boolean;
120
+ export declare const EVENT_GAP_BOOT_MESSAGE = "boot transition requires its exact successor";
121
+ export declare const EventGapSchema: z.ZodObject<{
122
+ subscriptionId: z.ZodUUID;
123
+ topic: z.ZodString;
124
+ producer: z.ZodString;
125
+ bootId: z.ZodUUID;
126
+ fromSeq: z.ZodNumber;
127
+ toSeq: z.ZodNumber;
128
+ reason: z.ZodEnum<{
129
+ "boot-change": "boot-change";
130
+ "latest-wins": "latest-wins";
131
+ overflow: "overflow";
132
+ resume: "resume";
133
+ retention: "retention";
134
+ }>;
135
+ nextBootId: z.ZodOptional<z.ZodUUID>;
136
+ }, z.core.$strict>;
137
+ export type EventGap = z.infer<typeof EventGapSchema>;
138
+ /**
139
+ * The only place a gap is built.
140
+ *
141
+ * A gap was assembled as an object literal in six places across the broker and the node — three of
142
+ * them inside one file, two of them on a path that never reached the schema. An eight-field shape
143
+ * with two invariants that the compiler cannot check is exactly the shape that must have one
144
+ * constructor: here the invariants are enforced at construction, not at whichever exit happens to
145
+ * validate.
146
+ */
147
+ export declare function eventGap(gap: EventGap): EventGap;
148
+ export declare const EventErrorSchema: z.ZodObject<{
149
+ refusal: z.ZodEnum<{
150
+ capacity: "capacity";
151
+ none: "none";
152
+ policy: "policy";
153
+ request: "request";
154
+ }>;
155
+ retryAfterMs: z.ZodNullable<z.ZodNumber>;
156
+ transportCause: z.ZodNullable<z.ZodEnum<{
157
+ "acknowledgement-timeout": "acknowledgement-timeout";
158
+ "lane-lost-after-dispatch": "lane-lost-after-dispatch";
159
+ "no-connected-lane": "no-connected-lane";
160
+ "presence-pending-timeout": "presence-pending-timeout";
161
+ "target-offline": "target-offline";
162
+ }>>;
163
+ subscriptionId: z.ZodNullable<z.ZodUUID>;
164
+ topic: z.ZodString;
165
+ from: z.ZodLiteral<"broker">;
166
+ failure: z.ZodEnum<{
167
+ cancelled: "cancelled";
168
+ denied: "denied";
169
+ exec: "exec";
170
+ none: "none";
171
+ offline: "offline";
172
+ rejected: "rejected";
173
+ timeout: "timeout";
174
+ transport: "transport";
175
+ }>;
176
+ detail: z.ZodString;
177
+ }, z.core.$strict>;
178
+ export type EventError = z.infer<typeof EventErrorSchema>;
179
+ export declare const EventAckSchema: z.ZodObject<{
180
+ refusal: z.ZodEnum<{
181
+ capacity: "capacity";
182
+ none: "none";
183
+ policy: "policy";
184
+ request: "request";
185
+ }>;
186
+ retryAfterMs: z.ZodNullable<z.ZodNumber>;
187
+ transportCause: z.ZodNullable<z.ZodEnum<{
188
+ "acknowledgement-timeout": "acknowledgement-timeout";
189
+ "lane-lost-after-dispatch": "lane-lost-after-dispatch";
190
+ "no-connected-lane": "no-connected-lane";
191
+ "presence-pending-timeout": "presence-pending-timeout";
192
+ "target-offline": "target-offline";
193
+ }>>;
194
+ ok: z.ZodBoolean;
195
+ failure: z.ZodEnum<{
196
+ cancelled: "cancelled";
197
+ denied: "denied";
198
+ exec: "exec";
199
+ none: "none";
200
+ offline: "offline";
201
+ rejected: "rejected";
202
+ timeout: "timeout";
203
+ transport: "transport";
204
+ }>;
205
+ detail: z.ZodString;
206
+ }, z.core.$strict>;
207
+ export type EventAck = z.infer<typeof EventAckSchema>;
208
+ /** An accepted event operation. */
209
+ export declare const acceptedEventAck: () => EventAck;
210
+ /** A refused one, carrying the refusal as it was classified. */
211
+ export declare const rejectedEventAck: (refused: Refused) => EventAck;
212
+ export declare const EventDeliveryAckSchema: z.ZodObject<{
213
+ accepted: z.ZodBoolean;
214
+ refusal: z.ZodEnum<{
215
+ capacity: "capacity";
216
+ none: "none";
217
+ policy: "policy";
218
+ request: "request";
219
+ }>;
220
+ detail: z.ZodString;
221
+ }, z.core.$strict>;
222
+ export type EventDeliveryAck = z.infer<typeof EventDeliveryAckSchema>;