@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,430 @@
1
+ import { z } from 'zod';
2
+ import { type ServiceCancellationOrigin } from './diagnostics.ts';
3
+ import { type Refusal, type TransportCause } from '../protocol/failure.ts';
4
+ export declare const SERVICE_MAX_RESPONSE_BYTES = 1048576;
5
+ export declare const SERVICE_MAX_ENVELOPE_BYTES = 8388608;
6
+ export declare const SERVICE_MAX_TIMEOUT_MS = 30000;
7
+ export declare const SERVICE_MAX_INFLIGHT = 32;
8
+ /**
9
+ * The largest descriptor file a node reads, and the only bound on how many operations a descriptor
10
+ * holds. An operation projected from an owner contract takes a few hundred bytes, so this admits
11
+ * about a thousand of them; a bigger file is a wrong path or a runaway writer, and is refused on
12
+ * every call before more than one byte past this limit is read.
13
+ */
14
+ export declare const SERVICE_MAX_DESCRIPTOR_BYTES = 262144;
15
+ export declare const ServiceIdSchema: z.ZodString;
16
+ export declare const ServiceOperationIdSchema: z.ZodString;
17
+ export declare const ServiceRevisionSchema: z.ZodString;
18
+ export declare const ServiceRequestPayloadSchema: z.ZodString;
19
+ export declare const ServiceResponsePayloadSchema: z.ZodString;
20
+ export declare const ServiceCallSchema: z.ZodObject<{
21
+ traceId: z.ZodOptional<z.ZodUUID>;
22
+ to: z.ZodString;
23
+ service: z.ZodString;
24
+ revision: z.ZodString;
25
+ operation: z.ZodString;
26
+ payload: z.ZodString;
27
+ timeoutMs: z.ZodNumber;
28
+ }, z.core.$strict>;
29
+ export type ServiceCall = z.infer<typeof ServiceCallSchema>;
30
+ export declare const ServiceRouteSchema: z.ZodObject<{
31
+ traceId: z.ZodOptional<z.ZodUUID>;
32
+ to: z.ZodString;
33
+ service: z.ZodString;
34
+ revision: z.ZodString;
35
+ operation: z.ZodString;
36
+ payload: z.ZodString;
37
+ timeoutMs: z.ZodNumber;
38
+ id: z.ZodUUID;
39
+ from: z.ZodString;
40
+ }, z.core.$strict>;
41
+ export type ServiceRoute = z.infer<typeof ServiceRouteSchema>;
42
+ export declare const ServiceIngressSchema: z.ZodObject<{
43
+ v: z.ZodLiteral<1>;
44
+ id: z.ZodUUID;
45
+ caller: z.ZodString;
46
+ service: z.ZodString;
47
+ revision: z.ZodString;
48
+ operation: z.ZodString;
49
+ payload: z.ZodString;
50
+ }, z.core.$strict>;
51
+ export type ServiceIngress = z.infer<typeof ServiceIngressSchema>;
52
+ export declare const ServiceFailureCodeSchema: z.ZodEnum<{
53
+ cancelled: "cancelled";
54
+ capacity: "capacity";
55
+ denied: "denied";
56
+ "invalid-request": "invalid-request";
57
+ "invalid-response": "invalid-response";
58
+ offline: "offline";
59
+ timeout: "timeout";
60
+ unavailable: "unavailable";
61
+ unsupported: "unsupported";
62
+ }>;
63
+ export type ServiceFailureCode = z.infer<typeof ServiceFailureCodeSchema>;
64
+ export declare const ServiceFailureOutcomeSchema: z.ZodObject<{
65
+ status: z.ZodLiteral<"failure">;
66
+ code: z.ZodEnum<{
67
+ cancelled: "cancelled";
68
+ capacity: "capacity";
69
+ denied: "denied";
70
+ "invalid-request": "invalid-request";
71
+ "invalid-response": "invalid-response";
72
+ offline: "offline";
73
+ timeout: "timeout";
74
+ unavailable: "unavailable";
75
+ unsupported: "unsupported";
76
+ }>;
77
+ delivery: z.ZodEnum<{
78
+ "not-dispatched": "not-dispatched";
79
+ unknown: "unknown";
80
+ }>;
81
+ retryAfterMs: z.ZodNullable<z.ZodNumber>;
82
+ refusal: z.ZodEnum<{
83
+ capacity: "capacity";
84
+ none: "none";
85
+ policy: "policy";
86
+ request: "request";
87
+ }>;
88
+ detail: z.ZodOptional<z.ZodString>;
89
+ transportCause: z.ZodNullable<z.ZodEnum<{
90
+ "acknowledgement-timeout": "acknowledgement-timeout";
91
+ "lane-lost-after-dispatch": "lane-lost-after-dispatch";
92
+ "no-connected-lane": "no-connected-lane";
93
+ "presence-pending-timeout": "presence-pending-timeout";
94
+ "target-offline": "target-offline";
95
+ }>>;
96
+ cancellationOrigin: z.ZodOptional<z.ZodEnum<{
97
+ "agent-shutdown": "agent-shutdown";
98
+ "broker-deadline": "broker-deadline";
99
+ "broker-shutdown": "broker-shutdown";
100
+ "caller-abort": "caller-abort";
101
+ "caller-deadline": "caller-deadline";
102
+ "caller-disconnect": "caller-disconnect";
103
+ "door-deadline": "door-deadline";
104
+ "door-disconnect": "door-disconnect";
105
+ "executor-deadline": "executor-deadline";
106
+ "lane-disconnect": "lane-disconnect";
107
+ "target-disconnect": "target-disconnect";
108
+ }>>;
109
+ diagnostics: z.ZodOptional<z.ZodObject<{
110
+ traceId: z.ZodUUID;
111
+ requestId: z.ZodUUID;
112
+ phases: z.ZodArray<z.ZodObject<{
113
+ phase: z.ZodEnum<{
114
+ admitted: "admitted";
115
+ "body-end": "body-end";
116
+ "body-start": "body-start";
117
+ "descriptor-end": "descriptor-end";
118
+ "descriptor-start": "descriptor-start";
119
+ "endpoint-end": "endpoint-end";
120
+ "endpoint-start": "endpoint-start";
121
+ "http-headers": "http-headers";
122
+ "http-start": "http-start";
123
+ "target-received": "target-received";
124
+ terminal: "terminal";
125
+ }>;
126
+ elapsedMs: z.ZodNumber;
127
+ }, z.core.$strict>>;
128
+ }, z.core.$strict>>;
129
+ }, z.core.$strict>;
130
+ export declare const ServiceOutcomeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
131
+ status: z.ZodLiteral<"response">;
132
+ delivery: z.ZodLiteral<"received">;
133
+ httpStatus: z.ZodNumber;
134
+ payload: z.ZodString;
135
+ diagnostics: z.ZodOptional<z.ZodObject<{
136
+ traceId: z.ZodUUID;
137
+ requestId: z.ZodUUID;
138
+ phases: z.ZodArray<z.ZodObject<{
139
+ phase: z.ZodEnum<{
140
+ admitted: "admitted";
141
+ "body-end": "body-end";
142
+ "body-start": "body-start";
143
+ "descriptor-end": "descriptor-end";
144
+ "descriptor-start": "descriptor-start";
145
+ "endpoint-end": "endpoint-end";
146
+ "endpoint-start": "endpoint-start";
147
+ "http-headers": "http-headers";
148
+ "http-start": "http-start";
149
+ "target-received": "target-received";
150
+ terminal: "terminal";
151
+ }>;
152
+ elapsedMs: z.ZodNumber;
153
+ }, z.core.$strict>>;
154
+ }, z.core.$strict>>;
155
+ }, z.core.$strict>, z.ZodObject<{
156
+ status: z.ZodLiteral<"failure">;
157
+ code: z.ZodEnum<{
158
+ cancelled: "cancelled";
159
+ capacity: "capacity";
160
+ denied: "denied";
161
+ "invalid-request": "invalid-request";
162
+ "invalid-response": "invalid-response";
163
+ offline: "offline";
164
+ timeout: "timeout";
165
+ unavailable: "unavailable";
166
+ unsupported: "unsupported";
167
+ }>;
168
+ delivery: z.ZodEnum<{
169
+ "not-dispatched": "not-dispatched";
170
+ unknown: "unknown";
171
+ }>;
172
+ retryAfterMs: z.ZodNullable<z.ZodNumber>;
173
+ refusal: z.ZodEnum<{
174
+ capacity: "capacity";
175
+ none: "none";
176
+ policy: "policy";
177
+ request: "request";
178
+ }>;
179
+ detail: z.ZodOptional<z.ZodString>;
180
+ transportCause: z.ZodNullable<z.ZodEnum<{
181
+ "acknowledgement-timeout": "acknowledgement-timeout";
182
+ "lane-lost-after-dispatch": "lane-lost-after-dispatch";
183
+ "no-connected-lane": "no-connected-lane";
184
+ "presence-pending-timeout": "presence-pending-timeout";
185
+ "target-offline": "target-offline";
186
+ }>>;
187
+ cancellationOrigin: z.ZodOptional<z.ZodEnum<{
188
+ "agent-shutdown": "agent-shutdown";
189
+ "broker-deadline": "broker-deadline";
190
+ "broker-shutdown": "broker-shutdown";
191
+ "caller-abort": "caller-abort";
192
+ "caller-deadline": "caller-deadline";
193
+ "caller-disconnect": "caller-disconnect";
194
+ "door-deadline": "door-deadline";
195
+ "door-disconnect": "door-disconnect";
196
+ "executor-deadline": "executor-deadline";
197
+ "lane-disconnect": "lane-disconnect";
198
+ "target-disconnect": "target-disconnect";
199
+ }>>;
200
+ diagnostics: z.ZodOptional<z.ZodObject<{
201
+ traceId: z.ZodUUID;
202
+ requestId: z.ZodUUID;
203
+ phases: z.ZodArray<z.ZodObject<{
204
+ phase: z.ZodEnum<{
205
+ admitted: "admitted";
206
+ "body-end": "body-end";
207
+ "body-start": "body-start";
208
+ "descriptor-end": "descriptor-end";
209
+ "descriptor-start": "descriptor-start";
210
+ "endpoint-end": "endpoint-end";
211
+ "endpoint-start": "endpoint-start";
212
+ "http-headers": "http-headers";
213
+ "http-start": "http-start";
214
+ "target-received": "target-received";
215
+ terminal: "terminal";
216
+ }>;
217
+ elapsedMs: z.ZodNumber;
218
+ }, z.core.$strict>>;
219
+ }, z.core.$strict>>;
220
+ }, z.core.$strict>], "status">;
221
+ export type ServiceOutcome = z.infer<typeof ServiceOutcomeSchema>;
222
+ export declare const ServiceResultSchema: z.ZodObject<{
223
+ id: z.ZodUUID;
224
+ from: z.ZodString;
225
+ outcome: z.ZodDiscriminatedUnion<[z.ZodObject<{
226
+ status: z.ZodLiteral<"response">;
227
+ delivery: z.ZodLiteral<"received">;
228
+ httpStatus: z.ZodNumber;
229
+ payload: z.ZodString;
230
+ diagnostics: z.ZodOptional<z.ZodObject<{
231
+ traceId: z.ZodUUID;
232
+ requestId: z.ZodUUID;
233
+ phases: z.ZodArray<z.ZodObject<{
234
+ phase: z.ZodEnum<{
235
+ admitted: "admitted";
236
+ "body-end": "body-end";
237
+ "body-start": "body-start";
238
+ "descriptor-end": "descriptor-end";
239
+ "descriptor-start": "descriptor-start";
240
+ "endpoint-end": "endpoint-end";
241
+ "endpoint-start": "endpoint-start";
242
+ "http-headers": "http-headers";
243
+ "http-start": "http-start";
244
+ "target-received": "target-received";
245
+ terminal: "terminal";
246
+ }>;
247
+ elapsedMs: z.ZodNumber;
248
+ }, z.core.$strict>>;
249
+ }, z.core.$strict>>;
250
+ }, z.core.$strict>, z.ZodObject<{
251
+ status: z.ZodLiteral<"failure">;
252
+ code: z.ZodEnum<{
253
+ cancelled: "cancelled";
254
+ capacity: "capacity";
255
+ denied: "denied";
256
+ "invalid-request": "invalid-request";
257
+ "invalid-response": "invalid-response";
258
+ offline: "offline";
259
+ timeout: "timeout";
260
+ unavailable: "unavailable";
261
+ unsupported: "unsupported";
262
+ }>;
263
+ delivery: z.ZodEnum<{
264
+ "not-dispatched": "not-dispatched";
265
+ unknown: "unknown";
266
+ }>;
267
+ retryAfterMs: z.ZodNullable<z.ZodNumber>;
268
+ refusal: z.ZodEnum<{
269
+ capacity: "capacity";
270
+ none: "none";
271
+ policy: "policy";
272
+ request: "request";
273
+ }>;
274
+ detail: z.ZodOptional<z.ZodString>;
275
+ transportCause: z.ZodNullable<z.ZodEnum<{
276
+ "acknowledgement-timeout": "acknowledgement-timeout";
277
+ "lane-lost-after-dispatch": "lane-lost-after-dispatch";
278
+ "no-connected-lane": "no-connected-lane";
279
+ "presence-pending-timeout": "presence-pending-timeout";
280
+ "target-offline": "target-offline";
281
+ }>>;
282
+ cancellationOrigin: z.ZodOptional<z.ZodEnum<{
283
+ "agent-shutdown": "agent-shutdown";
284
+ "broker-deadline": "broker-deadline";
285
+ "broker-shutdown": "broker-shutdown";
286
+ "caller-abort": "caller-abort";
287
+ "caller-deadline": "caller-deadline";
288
+ "caller-disconnect": "caller-disconnect";
289
+ "door-deadline": "door-deadline";
290
+ "door-disconnect": "door-disconnect";
291
+ "executor-deadline": "executor-deadline";
292
+ "lane-disconnect": "lane-disconnect";
293
+ "target-disconnect": "target-disconnect";
294
+ }>>;
295
+ diagnostics: z.ZodOptional<z.ZodObject<{
296
+ traceId: z.ZodUUID;
297
+ requestId: z.ZodUUID;
298
+ phases: z.ZodArray<z.ZodObject<{
299
+ phase: z.ZodEnum<{
300
+ admitted: "admitted";
301
+ "body-end": "body-end";
302
+ "body-start": "body-start";
303
+ "descriptor-end": "descriptor-end";
304
+ "descriptor-start": "descriptor-start";
305
+ "endpoint-end": "endpoint-end";
306
+ "endpoint-start": "endpoint-start";
307
+ "http-headers": "http-headers";
308
+ "http-start": "http-start";
309
+ "target-received": "target-received";
310
+ terminal: "terminal";
311
+ }>;
312
+ elapsedMs: z.ZodNumber;
313
+ }, z.core.$strict>>;
314
+ }, z.core.$strict>>;
315
+ }, z.core.$strict>], "status">;
316
+ }, z.core.$strict>;
317
+ export declare const ServiceCancelSchema: z.ZodObject<{
318
+ id: z.ZodUUID;
319
+ to: z.ZodString;
320
+ origin: z.ZodEnum<{
321
+ "agent-shutdown": "agent-shutdown";
322
+ "broker-deadline": "broker-deadline";
323
+ "broker-shutdown": "broker-shutdown";
324
+ "caller-abort": "caller-abort";
325
+ "caller-deadline": "caller-deadline";
326
+ "caller-disconnect": "caller-disconnect";
327
+ "door-deadline": "door-deadline";
328
+ "door-disconnect": "door-disconnect";
329
+ "executor-deadline": "executor-deadline";
330
+ "lane-disconnect": "lane-disconnect";
331
+ "target-disconnect": "target-disconnect";
332
+ }>;
333
+ }, z.core.$strict>;
334
+ export type ServiceResult = z.infer<typeof ServiceResultSchema>;
335
+ export declare const LocalServiceResultSchema: z.ZodObject<{
336
+ v: z.ZodLiteral<7>;
337
+ outcome: z.ZodDiscriminatedUnion<[z.ZodObject<{
338
+ status: z.ZodLiteral<"response">;
339
+ delivery: z.ZodLiteral<"received">;
340
+ httpStatus: z.ZodNumber;
341
+ payload: z.ZodString;
342
+ diagnostics: z.ZodOptional<z.ZodObject<{
343
+ traceId: z.ZodUUID;
344
+ requestId: z.ZodUUID;
345
+ phases: z.ZodArray<z.ZodObject<{
346
+ phase: z.ZodEnum<{
347
+ admitted: "admitted";
348
+ "body-end": "body-end";
349
+ "body-start": "body-start";
350
+ "descriptor-end": "descriptor-end";
351
+ "descriptor-start": "descriptor-start";
352
+ "endpoint-end": "endpoint-end";
353
+ "endpoint-start": "endpoint-start";
354
+ "http-headers": "http-headers";
355
+ "http-start": "http-start";
356
+ "target-received": "target-received";
357
+ terminal: "terminal";
358
+ }>;
359
+ elapsedMs: z.ZodNumber;
360
+ }, z.core.$strict>>;
361
+ }, z.core.$strict>>;
362
+ }, z.core.$strict>, z.ZodObject<{
363
+ status: z.ZodLiteral<"failure">;
364
+ code: z.ZodEnum<{
365
+ cancelled: "cancelled";
366
+ capacity: "capacity";
367
+ denied: "denied";
368
+ "invalid-request": "invalid-request";
369
+ "invalid-response": "invalid-response";
370
+ offline: "offline";
371
+ timeout: "timeout";
372
+ unavailable: "unavailable";
373
+ unsupported: "unsupported";
374
+ }>;
375
+ delivery: z.ZodEnum<{
376
+ "not-dispatched": "not-dispatched";
377
+ unknown: "unknown";
378
+ }>;
379
+ retryAfterMs: z.ZodNullable<z.ZodNumber>;
380
+ refusal: z.ZodEnum<{
381
+ capacity: "capacity";
382
+ none: "none";
383
+ policy: "policy";
384
+ request: "request";
385
+ }>;
386
+ detail: z.ZodOptional<z.ZodString>;
387
+ transportCause: z.ZodNullable<z.ZodEnum<{
388
+ "acknowledgement-timeout": "acknowledgement-timeout";
389
+ "lane-lost-after-dispatch": "lane-lost-after-dispatch";
390
+ "no-connected-lane": "no-connected-lane";
391
+ "presence-pending-timeout": "presence-pending-timeout";
392
+ "target-offline": "target-offline";
393
+ }>>;
394
+ cancellationOrigin: z.ZodOptional<z.ZodEnum<{
395
+ "agent-shutdown": "agent-shutdown";
396
+ "broker-deadline": "broker-deadline";
397
+ "broker-shutdown": "broker-shutdown";
398
+ "caller-abort": "caller-abort";
399
+ "caller-deadline": "caller-deadline";
400
+ "caller-disconnect": "caller-disconnect";
401
+ "door-deadline": "door-deadline";
402
+ "door-disconnect": "door-disconnect";
403
+ "executor-deadline": "executor-deadline";
404
+ "lane-disconnect": "lane-disconnect";
405
+ "target-disconnect": "target-disconnect";
406
+ }>>;
407
+ diagnostics: z.ZodOptional<z.ZodObject<{
408
+ traceId: z.ZodUUID;
409
+ requestId: z.ZodUUID;
410
+ phases: z.ZodArray<z.ZodObject<{
411
+ phase: z.ZodEnum<{
412
+ admitted: "admitted";
413
+ "body-end": "body-end";
414
+ "body-start": "body-start";
415
+ "descriptor-end": "descriptor-end";
416
+ "descriptor-start": "descriptor-start";
417
+ "endpoint-end": "endpoint-end";
418
+ "endpoint-start": "endpoint-start";
419
+ "http-headers": "http-headers";
420
+ "http-start": "http-start";
421
+ "target-received": "target-received";
422
+ terminal: "terminal";
423
+ }>;
424
+ elapsedMs: z.ZodNumber;
425
+ }, z.core.$strict>>;
426
+ }, z.core.$strict>>;
427
+ }, z.core.$strict>], "status">;
428
+ traceId: z.ZodOptional<z.ZodUUID>;
429
+ }, z.core.$strict>;
430
+ export declare function serviceFailure(code: z.infer<typeof ServiceFailureCodeSchema>, delivery?: 'not-dispatched' | 'unknown', transportCause?: TransportCause | null, refusal?: Refusal, detail?: string, cancellationOrigin?: ServiceCancellationOrigin): ServiceOutcome;
@@ -0,0 +1,122 @@
1
+ import { z } from 'zod';
2
+ /** The most services one node's owners may declare: each costs an admission key and a socket budget. */
3
+ export declare const MAX_DECLARED_SERVICES = 32;
4
+ /**
5
+ * A prefix of service names the fleet lets one node serve, ending in a dot: `owner.` admits
6
+ * `owner.delivery` and `owner.analytics.read`, never `owner` itself and never `ownerx.delivery`.
7
+ */
8
+ export declare const ServiceNamespaceSchema: z.ZodString;
9
+ export declare function serviceInNamespace(namespace: string, service: string): boolean;
10
+ /** One node that may call the declared service, and what it may do there. */
11
+ export declare const DeclaredCallerSchema: z.ZodObject<{
12
+ caller: z.ZodString;
13
+ scope: z.ZodUnion<readonly [z.ZodObject<{
14
+ kind: z.ZodLiteral<"service-read">;
15
+ }, z.core.$strict>, z.ZodObject<{
16
+ kind: z.ZodLiteral<"operation">;
17
+ operation: z.ZodString;
18
+ }, z.core.$strict>]>;
19
+ }, z.core.$strict>;
20
+ /**
21
+ * What an owner installs beside its service: where the node reaches it, and who may call it.
22
+ *
23
+ * The file is the owner's. The node reads it and tells the brokers who may call; nobody else edits
24
+ * it, and adding a service or a reader is an edit here, not a request to whoever runs the fleet.
25
+ */
26
+ export declare const ServiceDeclarationSchema: z.ZodObject<{
27
+ binding: z.ZodObject<{
28
+ service: z.ZodString;
29
+ descriptorPath: z.ZodString;
30
+ socketPath: z.ZodString;
31
+ endpointPath: z.ZodString;
32
+ maxInflight: z.ZodNumber;
33
+ limits: z.ZodObject<{
34
+ requestBytes: z.ZodNumber;
35
+ responseBytes: z.ZodNumber;
36
+ timeoutMs: z.ZodNumber;
37
+ }, z.core.$strict>;
38
+ }, z.core.$strict>;
39
+ callers: z.ZodDefault<z.ZodArray<z.ZodObject<{
40
+ caller: z.ZodString;
41
+ scope: z.ZodUnion<readonly [z.ZodObject<{
42
+ kind: z.ZodLiteral<"service-read">;
43
+ }, z.core.$strict>, z.ZodObject<{
44
+ kind: z.ZodLiteral<"operation">;
45
+ operation: z.ZodString;
46
+ }, z.core.$strict>]>;
47
+ }, z.core.$strict>>>;
48
+ }, z.core.$strict>;
49
+ export type ServiceDeclaration = z.infer<typeof ServiceDeclarationSchema>;
50
+ export type ServiceDeclarationInput = z.input<typeof ServiceDeclarationSchema>;
51
+ /**
52
+ * The largest declaration file a node reads, and the only bound on how many callers it names. A
53
+ * caller entry takes under a hundred bytes, and a caller granted write operations one by one takes
54
+ * one entry per operation, so this admits several hundred; a bigger file is a wrong path, and the
55
+ * node polls it every few seconds.
56
+ */
57
+ export declare const SERVICE_MAX_DECLARATION_BYTES: number;
58
+ /**
59
+ * Validates a parsed declaration the way the node agent does, with the same one-line reason.
60
+ *
61
+ * The agent calls exactly this function for every declaration file it polls, so an owner's tooling
62
+ * that calls it before writing the file gets the verdict the node will reach, not a copy of it.
63
+ */
64
+ export declare const parseServiceDeclaration: import("../protocol/schema-parse.ts").SchemaParse<{
65
+ binding: {
66
+ service: string;
67
+ descriptorPath: string;
68
+ socketPath: string;
69
+ endpointPath: string;
70
+ maxInflight: number;
71
+ limits: {
72
+ requestBytes: number;
73
+ responseBytes: number;
74
+ timeoutMs: number;
75
+ };
76
+ };
77
+ callers: {
78
+ caller: string;
79
+ scope: {
80
+ kind: "service-read";
81
+ } | {
82
+ kind: "operation";
83
+ operation: string;
84
+ };
85
+ }[];
86
+ }>;
87
+ /** Node → broker: the complete set of grants to call services on this node that its owners declare. */
88
+ export declare const ServiceDeclareSchema: z.ZodObject<{
89
+ target: z.ZodString;
90
+ grants: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
91
+ caller: z.ZodString;
92
+ target: z.ZodString;
93
+ service: z.ZodString;
94
+ scope: z.ZodObject<{
95
+ kind: z.ZodLiteral<"service-read">;
96
+ }, z.core.$strict>;
97
+ }, z.core.$strict>, z.ZodObject<{
98
+ caller: z.ZodString;
99
+ target: z.ZodString;
100
+ service: z.ZodString;
101
+ scope: z.ZodObject<{
102
+ kind: z.ZodLiteral<"operation">;
103
+ operation: z.ZodString;
104
+ }, z.core.$strict>;
105
+ }, z.core.$strict>]>>;
106
+ }, z.core.$strict>;
107
+ export type ServiceDeclare = z.infer<typeof ServiceDeclareSchema>;
108
+ export declare const ServiceDeclareRefusalSchema: z.ZodObject<{
109
+ service: z.ZodString;
110
+ caller: z.ZodString;
111
+ detail: z.ZodString;
112
+ }, z.core.$strict>;
113
+ export type ServiceDeclareRefusal = z.infer<typeof ServiceDeclareRefusalSchema>;
114
+ export declare const ServiceDeclareAckSchema: z.ZodObject<{
115
+ accepted: z.ZodNumber;
116
+ refused: z.ZodArray<z.ZodObject<{
117
+ service: z.ZodString;
118
+ caller: z.ZodString;
119
+ detail: z.ZodString;
120
+ }, z.core.$strict>>;
121
+ }, z.core.$strict>;
122
+ export type ServiceDeclareAck = z.infer<typeof ServiceDeclareAckSchema>;
@@ -0,0 +1,104 @@
1
+ import { z } from 'zod';
2
+ /** The header that carries a call's trace id from the client through the door, the node and the owner's socket. */
3
+ export declare const SERVICE_TRACE_HEADER = "x-stitchwire-trace-id";
4
+ /** Observed causes, never inferred from a coincident timestamp or arbitrary AbortSignal reason. */
5
+ export declare const ServiceCancellationOriginSchema: z.ZodEnum<{
6
+ "agent-shutdown": "agent-shutdown";
7
+ "broker-deadline": "broker-deadline";
8
+ "broker-shutdown": "broker-shutdown";
9
+ "caller-abort": "caller-abort";
10
+ "caller-deadline": "caller-deadline";
11
+ "caller-disconnect": "caller-disconnect";
12
+ "door-deadline": "door-deadline";
13
+ "door-disconnect": "door-disconnect";
14
+ "executor-deadline": "executor-deadline";
15
+ "lane-disconnect": "lane-disconnect";
16
+ "target-disconnect": "target-disconnect";
17
+ }>;
18
+ export type ServiceCancellationOrigin = z.infer<typeof ServiceCancellationOriginSchema>;
19
+ export declare const CallerServiceCancellationSchema: z.ZodEnum<{
20
+ "agent-shutdown": "agent-shutdown";
21
+ "caller-abort": "caller-abort";
22
+ "caller-deadline": "caller-deadline";
23
+ "door-deadline": "door-deadline";
24
+ "door-disconnect": "door-disconnect";
25
+ }>;
26
+ export declare const ServicePhaseSchema: z.ZodObject<{
27
+ phase: z.ZodEnum<{
28
+ admitted: "admitted";
29
+ "body-end": "body-end";
30
+ "body-start": "body-start";
31
+ "descriptor-end": "descriptor-end";
32
+ "descriptor-start": "descriptor-start";
33
+ "endpoint-end": "endpoint-end";
34
+ "endpoint-start": "endpoint-start";
35
+ "http-headers": "http-headers";
36
+ "http-start": "http-start";
37
+ "target-received": "target-received";
38
+ terminal: "terminal";
39
+ }>;
40
+ elapsedMs: z.ZodNumber;
41
+ }, z.core.$strict>;
42
+ export type ServicePhase = z.infer<typeof ServicePhaseSchema>;
43
+ export declare const ServiceDiagnosticsSchema: z.ZodObject<{
44
+ traceId: z.ZodUUID;
45
+ requestId: z.ZodUUID;
46
+ phases: z.ZodArray<z.ZodObject<{
47
+ phase: z.ZodEnum<{
48
+ admitted: "admitted";
49
+ "body-end": "body-end";
50
+ "body-start": "body-start";
51
+ "descriptor-end": "descriptor-end";
52
+ "descriptor-start": "descriptor-start";
53
+ "endpoint-end": "endpoint-end";
54
+ "endpoint-start": "endpoint-start";
55
+ "http-headers": "http-headers";
56
+ "http-start": "http-start";
57
+ "target-received": "target-received";
58
+ terminal: "terminal";
59
+ }>;
60
+ elapsedMs: z.ZodNumber;
61
+ }, z.core.$strict>>;
62
+ }, z.core.$strict>;
63
+ export type ServiceDiagnostics = z.infer<typeof ServiceDiagnosticsSchema>;
64
+ export declare const ServiceClientTraceSchema: z.ZodObject<{
65
+ phase: z.ZodEnum<{
66
+ result: "result";
67
+ start: "start";
68
+ }>;
69
+ traceId: z.ZodUUID;
70
+ diagnostics: z.ZodOptional<z.ZodObject<{
71
+ traceId: z.ZodUUID;
72
+ requestId: z.ZodUUID;
73
+ phases: z.ZodArray<z.ZodObject<{
74
+ phase: z.ZodEnum<{
75
+ admitted: "admitted";
76
+ "body-end": "body-end";
77
+ "body-start": "body-start";
78
+ "descriptor-end": "descriptor-end";
79
+ "descriptor-start": "descriptor-start";
80
+ "endpoint-end": "endpoint-end";
81
+ "endpoint-start": "endpoint-start";
82
+ "http-headers": "http-headers";
83
+ "http-start": "http-start";
84
+ "target-received": "target-received";
85
+ terminal: "terminal";
86
+ }>;
87
+ elapsedMs: z.ZodNumber;
88
+ }, z.core.$strict>>;
89
+ }, z.core.$strict>>;
90
+ cancellationOrigin: z.ZodOptional<z.ZodEnum<{
91
+ "agent-shutdown": "agent-shutdown";
92
+ "broker-deadline": "broker-deadline";
93
+ "broker-shutdown": "broker-shutdown";
94
+ "caller-abort": "caller-abort";
95
+ "caller-deadline": "caller-deadline";
96
+ "caller-disconnect": "caller-disconnect";
97
+ "door-deadline": "door-deadline";
98
+ "door-disconnect": "door-disconnect";
99
+ "executor-deadline": "executor-deadline";
100
+ "lane-disconnect": "lane-disconnect";
101
+ "target-disconnect": "target-disconnect";
102
+ }>>;
103
+ }, z.core.$strict>;
104
+ export type ServiceClientTrace = z.infer<typeof ServiceClientTraceSchema>;
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The path of one route an owner serves: an operation's `path` and a binding's `endpointPath`.
4
+ *
5
+ * One rule for both, because a route path crosses a URL parser on its way to the owner: `.` and
6
+ * `..` segments are resolved there, so `/catalog/x/../erase` reaches the handler of `/catalog/erase`
7
+ * and a read operation would run a write route. A `.` inside a longer segment (`/v1.2/x`) is an
8
+ * ordinary character and stays allowed. The alphabet is the characters a URL path carries
9
+ * unescaped; no percent escapes, so no spelling of a dot segment the check cannot see.
10
+ */
11
+ export declare const OwnerRoutePathSchema: z.ZodString;