@clowder-ai/plugin-contract 0.1.0-beta.1 → 0.1.0-beta.11

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 (173) hide show
  1. package/dist/codegen/generate-contract.d.ts +5 -0
  2. package/dist/codegen/generate-contract.d.ts.map +1 -1
  3. package/dist/codegen/generate-contract.js +45 -4
  4. package/dist/codegen/generate-contract.js.map +1 -1
  5. package/dist/conformance/behavior-executor.d.ts +18 -0
  6. package/dist/conformance/behavior-executor.d.ts.map +1 -0
  7. package/dist/conformance/behavior-executor.js +52 -0
  8. package/dist/conformance/behavior-executor.js.map +1 -0
  9. package/dist/conformance/fixtures.d.ts +11 -0
  10. package/dist/conformance/fixtures.d.ts.map +1 -0
  11. package/dist/conformance/fixtures.js +9 -0
  12. package/dist/conformance/fixtures.js.map +1 -0
  13. package/dist/conformance/index.d.ts +6 -0
  14. package/dist/conformance/index.d.ts.map +1 -1
  15. package/dist/conformance/index.js +5 -0
  16. package/dist/conformance/index.js.map +1 -1
  17. package/dist/conformance/messaging-behavior-fixture.d.ts +12 -0
  18. package/dist/conformance/messaging-behavior-fixture.d.ts.map +1 -0
  19. package/dist/conformance/messaging-behavior-fixture.js +30 -0
  20. package/dist/conformance/messaging-behavior-fixture.js.map +1 -0
  21. package/dist/conformance/messaging-loopback-adapter.d.ts +23 -0
  22. package/dist/conformance/messaging-loopback-adapter.d.ts.map +1 -0
  23. package/dist/conformance/messaging-loopback-adapter.js +389 -0
  24. package/dist/conformance/messaging-loopback-adapter.js.map +1 -0
  25. package/dist/conformance/messaging-loopback-state.d.ts +22 -0
  26. package/dist/conformance/messaging-loopback-state.d.ts.map +1 -0
  27. package/dist/conformance/messaging-loopback-state.js +101 -0
  28. package/dist/conformance/messaging-loopback-state.js.map +1 -0
  29. package/dist/conformance/runner.d.ts +18 -1
  30. package/dist/conformance/runner.d.ts.map +1 -1
  31. package/dist/conformance/runner.js +153 -66
  32. package/dist/conformance/runner.js.map +1 -1
  33. package/dist/conformance/stdio-harness/child-process-harness.d.ts +65 -0
  34. package/dist/conformance/stdio-harness/child-process-harness.d.ts.map +1 -0
  35. package/dist/conformance/stdio-harness/child-process-harness.js +296 -0
  36. package/dist/conformance/stdio-harness/child-process-harness.js.map +1 -0
  37. package/dist/conformance/stdio-harness/dual-transport-oracle.d.ts +26 -0
  38. package/dist/conformance/stdio-harness/dual-transport-oracle.d.ts.map +1 -0
  39. package/dist/conformance/stdio-harness/dual-transport-oracle.js +32 -0
  40. package/dist/conformance/stdio-harness/dual-transport-oracle.js.map +1 -0
  41. package/dist/conformance/stdio-harness/harness-process-spawn.d.ts +27 -0
  42. package/dist/conformance/stdio-harness/harness-process-spawn.d.ts.map +1 -0
  43. package/dist/conformance/stdio-harness/harness-process-spawn.js +43 -0
  44. package/dist/conformance/stdio-harness/harness-process-spawn.js.map +1 -0
  45. package/dist/conformance/stdio-harness/index.d.ts +5 -0
  46. package/dist/conformance/stdio-harness/index.d.ts.map +1 -0
  47. package/dist/conformance/stdio-harness/index.js +4 -0
  48. package/dist/conformance/stdio-harness/index.js.map +1 -0
  49. package/dist/conformance/stdio-harness/ndjson-frame.d.ts +31 -0
  50. package/dist/conformance/stdio-harness/ndjson-frame.d.ts.map +1 -0
  51. package/dist/conformance/stdio-harness/ndjson-frame.js +125 -0
  52. package/dist/conformance/stdio-harness/ndjson-frame.js.map +1 -0
  53. package/dist/conformance/stdio-harness/node-process-tree-runtime.d.ts +15 -0
  54. package/dist/conformance/stdio-harness/node-process-tree-runtime.d.ts.map +1 -0
  55. package/dist/conformance/stdio-harness/node-process-tree-runtime.js +78 -0
  56. package/dist/conformance/stdio-harness/node-process-tree-runtime.js.map +1 -0
  57. package/dist/conformance/stdio-harness/process-tree-controller.d.ts +51 -0
  58. package/dist/conformance/stdio-harness/process-tree-controller.d.ts.map +1 -0
  59. package/dist/conformance/stdio-harness/process-tree-controller.js +162 -0
  60. package/dist/conformance/stdio-harness/process-tree-controller.js.map +1 -0
  61. package/dist/conformance/stdio-harness/windows-sentinel.d.ts +15 -0
  62. package/dist/conformance/stdio-harness/windows-sentinel.d.ts.map +1 -0
  63. package/dist/conformance/stdio-harness/windows-sentinel.js +160 -0
  64. package/dist/conformance/stdio-harness/windows-sentinel.js.map +1 -0
  65. package/dist/conformance/stdio-harness/wire-shape.d.ts +18 -0
  66. package/dist/conformance/stdio-harness/wire-shape.d.ts.map +1 -0
  67. package/dist/conformance/stdio-harness/wire-shape.js +2 -0
  68. package/dist/conformance/stdio-harness/wire-shape.js.map +1 -0
  69. package/dist/generated/contract.generated.d.ts +370 -4
  70. package/dist/generated/contract.generated.d.ts.map +1 -1
  71. package/dist/generated/contract.generated.js +7 -1
  72. package/dist/generated/contract.generated.js.map +1 -1
  73. package/dist/index.d.ts +3 -1
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +5 -1
  76. package/dist/index.js.map +1 -1
  77. package/dist/validation/index.d.ts +3 -0
  78. package/dist/validation/index.d.ts.map +1 -1
  79. package/dist/validation/index.js +3 -0
  80. package/dist/validation/index.js.map +1 -1
  81. package/dist/validation/manifest.d.ts +23 -0
  82. package/dist/validation/manifest.d.ts.map +1 -0
  83. package/dist/validation/manifest.js +53 -0
  84. package/dist/validation/manifest.js.map +1 -0
  85. package/dist/validation/messaging-semantic.d.ts.map +1 -1
  86. package/dist/validation/messaging-semantic.js +49 -0
  87. package/dist/validation/messaging-semantic.js.map +1 -1
  88. package/dist/validation/messaging-wire.d.ts +38 -0
  89. package/dist/validation/messaging-wire.d.ts.map +1 -0
  90. package/dist/validation/messaging-wire.js +164 -0
  91. package/dist/validation/messaging-wire.js.map +1 -0
  92. package/dist/validation/signals.d.ts +26 -0
  93. package/dist/validation/signals.d.ts.map +1 -0
  94. package/dist/validation/signals.js +206 -0
  95. package/dist/validation/signals.js.map +1 -0
  96. package/dist/wire/constants.d.ts +36 -0
  97. package/dist/wire/constants.d.ts.map +1 -0
  98. package/dist/wire/constants.js +36 -0
  99. package/dist/wire/constants.js.map +1 -0
  100. package/dist/wire/disposition-fixtures.d.ts +118 -0
  101. package/dist/wire/disposition-fixtures.d.ts.map +1 -0
  102. package/dist/wire/disposition-fixtures.js +1881 -0
  103. package/dist/wire/disposition-fixtures.js.map +1 -0
  104. package/dist/wire/disposition.d.ts +102 -0
  105. package/dist/wire/disposition.d.ts.map +1 -0
  106. package/dist/wire/disposition.js +217 -0
  107. package/dist/wire/disposition.js.map +1 -0
  108. package/dist/wire/envelope.d.ts +253 -0
  109. package/dist/wire/envelope.d.ts.map +1 -0
  110. package/dist/wire/envelope.js +19 -0
  111. package/dist/wire/envelope.js.map +1 -0
  112. package/dist/wire/errors.d.ts +222 -0
  113. package/dist/wire/errors.d.ts.map +1 -0
  114. package/dist/wire/errors.js +153 -0
  115. package/dist/wire/errors.js.map +1 -0
  116. package/dist/wire/grants.d.ts +57 -0
  117. package/dist/wire/grants.d.ts.map +1 -0
  118. package/dist/wire/grants.js +59 -0
  119. package/dist/wire/grants.js.map +1 -0
  120. package/dist/wire/handshake-byte-bounds.d.ts +69 -0
  121. package/dist/wire/handshake-byte-bounds.d.ts.map +1 -0
  122. package/dist/wire/handshake-byte-bounds.js +173 -0
  123. package/dist/wire/handshake-byte-bounds.js.map +1 -0
  124. package/dist/wire/handshake.d.ts +146 -0
  125. package/dist/wire/handshake.d.ts.map +1 -0
  126. package/dist/wire/handshake.js +189 -0
  127. package/dist/wire/handshake.js.map +1 -0
  128. package/dist/wire/index.d.ts +37 -0
  129. package/dist/wire/index.d.ts.map +1 -0
  130. package/dist/wire/index.js +61 -0
  131. package/dist/wire/index.js.map +1 -0
  132. package/dist/wire/lifecycle-byte-bounds.d.ts +55 -0
  133. package/dist/wire/lifecycle-byte-bounds.d.ts.map +1 -0
  134. package/dist/wire/lifecycle-byte-bounds.js +209 -0
  135. package/dist/wire/lifecycle-byte-bounds.js.map +1 -0
  136. package/dist/wire/messaging-byte-bounds.d.ts +61 -0
  137. package/dist/wire/messaging-byte-bounds.d.ts.map +1 -0
  138. package/dist/wire/messaging-byte-bounds.js +459 -0
  139. package/dist/wire/messaging-byte-bounds.js.map +1 -0
  140. package/dist/wire/registry.d.ts +294 -0
  141. package/dist/wire/registry.d.ts.map +1 -0
  142. package/dist/wire/registry.js +256 -0
  143. package/dist/wire/registry.js.map +1 -0
  144. package/dist/wire/request-id.d.ts +34 -0
  145. package/dist/wire/request-id.d.ts.map +1 -0
  146. package/dist/wire/request-id.js +40 -0
  147. package/dist/wire/request-id.js.map +1 -0
  148. package/dist/wire/row-shapes.d.ts +217 -0
  149. package/dist/wire/row-shapes.d.ts.map +1 -0
  150. package/dist/wire/row-shapes.js +75 -0
  151. package/dist/wire/row-shapes.js.map +1 -0
  152. package/dist/wire/signal-byte-bounds.d.ts +97 -0
  153. package/dist/wire/signal-byte-bounds.d.ts.map +1 -0
  154. package/dist/wire/signal-byte-bounds.js +229 -0
  155. package/dist/wire/signal-byte-bounds.js.map +1 -0
  156. package/dist/wire/wire-uint53.d.ts +26 -0
  157. package/dist/wire/wire-uint53.d.ts.map +1 -0
  158. package/dist/wire/wire-uint53.js +32 -0
  159. package/dist/wire/wire-uint53.js.map +1 -0
  160. package/fixtures/behavior/messaging/adversarial-invariants.json +56 -5
  161. package/fixtures/manifest/invalid/duplicate-signal-type.json +33 -0
  162. package/fixtures/messaging/valid/subscription-delivery.json +1 -1
  163. package/fixtures/signals/invalid/destination-injection.json +15 -0
  164. package/fixtures/signals/invalid/dynamic-schema-url.json +10 -0
  165. package/fixtures/signals/invalid/forbidden-raw-privacy.json +10 -0
  166. package/fixtures/signals/invalid/non-utc-occurred-at.json +12 -0
  167. package/fixtures/signals/valid/feishu-meeting-artifact.json +18 -0
  168. package/fixtures/signals/valid/remote-service-declaration.json +10 -0
  169. package/package.json +15 -6
  170. package/src/schemas/manifest.schema.json +5 -2
  171. package/src/schemas/messaging.schema.json +209 -32
  172. package/src/schemas/physical-limb.schema.json +319 -0
  173. package/src/schemas/signal.schema.json +129 -0
@@ -0,0 +1,253 @@
1
+ /**
2
+ * Wire envelope family — closed outer JSON-RPC structures.
3
+ * Mechanized from #1165 R23/R24/R26.
4
+ *
5
+ * The outer envelope family is closed (additionalProperties: false):
6
+ * - WireRequest: id + method + params (request/response)
7
+ * - WireNotification: method + params, no id (row 10 only in v0)
8
+ * - WireSuccessResponse: id + result, no error
9
+ * - WireApplicationErrorResponse: id + error (with data)
10
+ * - WireStandardErrorResponse: id|null + error (no data)
11
+ *
12
+ * Result/error mutual exclusivity is structural — a response carries
13
+ * exactly one of result or error, never both, never neither.
14
+ *
15
+ * This module defines nothing new — every shape traces to a frozen
16
+ * #1165 revision.
17
+ */
18
+ import type { RequestId } from './request-id.js';
19
+ import type { HandshakeRejectedError, DeliveryRejectedError, DomainError, DeadlineExpiredError, SnapshotUnavailableError, ParseError, InvalidRequestError, MethodNotFoundError, InvalidParamsError, InternalError } from './errors.js';
20
+ /**
21
+ * Call metadata carried in every request's `params.meta`.
22
+ * Closed surface — v0 defines exactly one field.
23
+ *
24
+ * additionalProperties: false — no members beyond deadlineUnixMs.
25
+ */
26
+ export interface CallMeta {
27
+ /**
28
+ * Host-capped absolute deadline.
29
+ * WireUInt53(1, 9_007_199_254_740_991) — zero is forbidden.
30
+ *
31
+ * The Host sets this ceiling; plugins observe it.
32
+ * Must be a positive safe integer (never 0, never negative).
33
+ */
34
+ readonly deadlineUnixMs: number;
35
+ }
36
+ /**
37
+ * Generic JSON-RPC request envelope.
38
+ *
39
+ * An object carrying an `id` is a Request — the peer MUST respond.
40
+ * Parameterized by method name M and input shape I.
41
+ *
42
+ * additionalProperties: false — no members beyond jsonrpc, id, method, params.
43
+ */
44
+ export interface WireRequest<M extends string = string, I = unknown> {
45
+ readonly jsonrpc: '2.0';
46
+ /** Validated RequestId — byte-equal echo expected in the response. */
47
+ readonly id: RequestId;
48
+ readonly method: M;
49
+ readonly params: {
50
+ readonly meta: CallMeta;
51
+ readonly input: I;
52
+ };
53
+ }
54
+ /**
55
+ * Generic JSON-RPC notification envelope (no `id`).
56
+ *
57
+ * In v0, only row 10 (host.grants.changed) is a legal notification.
58
+ * An object without `id` is a notification — no response may be sent.
59
+ *
60
+ * additionalProperties: false — no members beyond jsonrpc, method, params.
61
+ */
62
+ export interface WireNotification<M extends string = string, I = unknown> {
63
+ readonly jsonrpc: '2.0';
64
+ readonly method: M;
65
+ readonly params: {
66
+ readonly meta: CallMeta;
67
+ readonly input: I;
68
+ };
69
+ }
70
+ /**
71
+ * Generic JSON-RPC success response envelope.
72
+ *
73
+ * Carries `result`, never `error`. Mutual exclusivity is structural.
74
+ * additionalProperties: false — no members beyond jsonrpc, id, result.
75
+ */
76
+ export interface WireSuccessResponse<R = unknown> {
77
+ readonly jsonrpc: '2.0';
78
+ /** Byte-equal echo of the originating request's id. */
79
+ readonly id: RequestId;
80
+ readonly result: R;
81
+ }
82
+ /**
83
+ * JSON-RPC error response — application variant (with typed `data`).
84
+ *
85
+ * Application errors (-32090 through -32094) carry a `data` field
86
+ * with domain-specific payload. See errors.ts for the 5 concrete
87
+ * application error shapes.
88
+ *
89
+ * The `result` member is forbidden (structural mutual exclusivity).
90
+ * additionalProperties: false.
91
+ */
92
+ export interface WireApplicationErrorResponse<D = unknown> {
93
+ readonly jsonrpc: '2.0';
94
+ /** Byte-equal echo of the originating request's id. */
95
+ readonly id: RequestId;
96
+ readonly error: {
97
+ readonly code: number;
98
+ readonly message: string;
99
+ readonly data: D;
100
+ };
101
+ }
102
+ /**
103
+ * JSON-RPC error response — standard variant (no `data` field).
104
+ *
105
+ * Standard errors (-32700, -32600, -32601, -32602, -32603) never carry
106
+ * `data`. See errors.ts for the 6 concrete standard error variants.
107
+ *
108
+ * The id field is `RequestId | null`:
109
+ * - null occurs only for Parse error (-32700) and Invalid Request
110
+ * (-32600) when no valid id could be extracted from the frame.
111
+ * - All other standard errors echo the originating request's id.
112
+ *
113
+ * The `result` member is forbidden (structural mutual exclusivity).
114
+ * additionalProperties: false.
115
+ */
116
+ export interface WireStandardErrorResponse {
117
+ readonly jsonrpc: '2.0';
118
+ /** RequestId echo, or null for Parse error / Invalid Request no-id arm. */
119
+ readonly id: RequestId | null;
120
+ readonly error: {
121
+ readonly code: number;
122
+ readonly message: string;
123
+ };
124
+ }
125
+ /**
126
+ * HANDSHAKE_REJECTED (-32090) envelope.
127
+ * additionalProperties: false.
128
+ */
129
+ export interface HandshakeRejectedEnvelope {
130
+ readonly jsonrpc: '2.0';
131
+ readonly id: RequestId;
132
+ readonly error: HandshakeRejectedError;
133
+ }
134
+ /**
135
+ * DELIVERY_REJECTED (-32091) envelope.
136
+ * additionalProperties: false.
137
+ */
138
+ export interface DeliveryRejectedEnvelope {
139
+ readonly jsonrpc: '2.0';
140
+ readonly id: RequestId;
141
+ readonly error: DeliveryRejectedError;
142
+ }
143
+ /**
144
+ * DOMAIN_ERROR (-32092) envelope.
145
+ * additionalProperties: false.
146
+ */
147
+ export interface DomainErrorEnvelope {
148
+ readonly jsonrpc: '2.0';
149
+ readonly id: RequestId;
150
+ readonly error: DomainError;
151
+ }
152
+ /**
153
+ * DEADLINE_EXPIRED (-32093) envelope.
154
+ * additionalProperties: false.
155
+ */
156
+ export interface DeadlineExpiredEnvelope {
157
+ readonly jsonrpc: '2.0';
158
+ readonly id: RequestId;
159
+ readonly error: DeadlineExpiredError;
160
+ }
161
+ /**
162
+ * SNAPSHOT_UNAVAILABLE (-32094) envelope.
163
+ * additionalProperties: false.
164
+ */
165
+ export interface SnapshotUnavailableEnvelope {
166
+ readonly jsonrpc: '2.0';
167
+ readonly id: RequestId;
168
+ readonly error: SnapshotUnavailableError;
169
+ }
170
+ /**
171
+ * Parse error (-32700) envelope.
172
+ * id is ALWAYS null — no valid frame was parsed.
173
+ * additionalProperties: false.
174
+ */
175
+ export interface ParseErrorEnvelope {
176
+ readonly jsonrpc: '2.0';
177
+ readonly id: null;
178
+ readonly error: ParseError;
179
+ }
180
+ /**
181
+ * Invalid Request (-32600) null-id arm envelope.
182
+ * id is null — true detection failure, no valid id could be extracted.
183
+ * additionalProperties: false.
184
+ */
185
+ export interface InvalidRequestNullIdEnvelope {
186
+ readonly jsonrpc: '2.0';
187
+ readonly id: null;
188
+ readonly error: InvalidRequestError;
189
+ }
190
+ /**
191
+ * Invalid Request (-32600) valid-id arm envelope.
192
+ * id is a byte-equal RequestId echo from the malformed request.
193
+ * additionalProperties: false.
194
+ */
195
+ export interface InvalidRequestValidIdEnvelope {
196
+ readonly jsonrpc: '2.0';
197
+ readonly id: RequestId;
198
+ readonly error: InvalidRequestError;
199
+ }
200
+ /**
201
+ * Method not found (-32601) envelope.
202
+ * id is a byte-equal RequestId echo.
203
+ * additionalProperties: false.
204
+ */
205
+ export interface MethodNotFoundEnvelope {
206
+ readonly jsonrpc: '2.0';
207
+ readonly id: RequestId;
208
+ readonly error: MethodNotFoundError;
209
+ }
210
+ /**
211
+ * Invalid params (-32602) envelope.
212
+ * id is a byte-equal RequestId echo.
213
+ * additionalProperties: false.
214
+ */
215
+ export interface InvalidParamsEnvelope {
216
+ readonly jsonrpc: '2.0';
217
+ readonly id: RequestId;
218
+ readonly error: InvalidParamsError;
219
+ }
220
+ /**
221
+ * Internal error (-32603) envelope.
222
+ * id is a byte-equal RequestId echo.
223
+ * additionalProperties: false.
224
+ */
225
+ export interface InternalErrorEnvelope {
226
+ readonly jsonrpc: '2.0';
227
+ readonly id: RequestId;
228
+ readonly error: InternalError;
229
+ }
230
+ /**
231
+ * Closed union of all 11 error envelope variants.
232
+ *
233
+ * 5 application error envelopes (all id: RequestId, error carries data):
234
+ * HandshakeRejected, DeliveryRejected, DomainError,
235
+ * DeadlineExpired, SnapshotUnavailable
236
+ *
237
+ * 6 standard error envelopes (no data, varying id):
238
+ * ParseError (id: null), InvalidRequest null-id (id: null),
239
+ * InvalidRequest valid-id (id: RequestId),
240
+ * MethodNotFound, InvalidParams, InternalError (all id: RequestId)
241
+ */
242
+ export type ClosedWireErrorResponse = HandshakeRejectedEnvelope | DeliveryRejectedEnvelope | DomainErrorEnvelope | DeadlineExpiredEnvelope | SnapshotUnavailableEnvelope | ParseErrorEnvelope | InvalidRequestNullIdEnvelope | InvalidRequestValidIdEnvelope | MethodNotFoundEnvelope | InvalidParamsEnvelope | InternalErrorEnvelope;
243
+ /**
244
+ * Either error variant — closed union of all 11 concrete error envelope shapes.
245
+ * Replaces the previous generic union with the mechanized closed form.
246
+ */
247
+ export type WireErrorResponse = ClosedWireErrorResponse;
248
+ /**
249
+ * Any JSON-RPC response — success or error, never both.
250
+ * Discriminated at runtime by the presence of `result` vs `error`.
251
+ */
252
+ export type WireResponse = WireSuccessResponse | WireErrorResponse;
253
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/wire/envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,EACX,oBAAoB,EACpB,wBAAwB,EACxB,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACd,MAAM,aAAa,CAAC;AAMrB;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAMD;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO;IACjE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;QACxB,QAAQ,CAAC,KAAK,EAAE,CAAC,C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;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;CACrC;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;CACrC;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;CACpC;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;CAC/B;AAMD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,uBAAuB,GAC/B,yBAAyB,GACzB,wBAAwB,GACxB,mBAAmB,GACnB,uBAAuB,GACvB,2BAA2B,GAC3B,kBAAkB,GAClB,4BAA4B,GAC5B,6BAA6B,GAC7B,sBAAsB,GACtB,qBAAqB,GACrB,qBAAqB,CAAC;AAM1B;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Wire envelope family — closed outer JSON-RPC structures.
3
+ * Mechanized from #1165 R23/R24/R26.
4
+ *
5
+ * The outer envelope family is closed (additionalProperties: false):
6
+ * - WireRequest: id + method + params (request/response)
7
+ * - WireNotification: method + params, no id (row 10 only in v0)
8
+ * - WireSuccessResponse: id + result, no error
9
+ * - WireApplicationErrorResponse: id + error (with data)
10
+ * - WireStandardErrorResponse: id|null + error (no data)
11
+ *
12
+ * Result/error mutual exclusivity is structural — a response carries
13
+ * exactly one of result or error, never both, never neither.
14
+ *
15
+ * This module defines nothing new — every shape traces to a frozen
16
+ * #1165 revision.
17
+ */
18
+ export {};
19
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/wire/envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
@@ -0,0 +1,222 @@
1
+ /**
2
+ * Wire-protocol error types — application and standard variants.
3
+ * Mechanized verbatim from the #1165 frozen shape.
4
+ *
5
+ * Application errors (R2 co-signed):
6
+ * HANDSHAKE_REJECTED (-32090), DELIVERY_REJECTED (-32091),
7
+ * DOMAIN_ERROR (-32092), DEADLINE_EXPIRED (-32093),
8
+ * SNAPSHOT_UNAVAILABLE (-32094).
9
+ *
10
+ * Standard JSON-RPC errors (R29):
11
+ * Parse error (-32700), Invalid Request (-32600, two id arms),
12
+ * Method not found (-32601), Invalid params (-32602),
13
+ * Internal error (-32603).
14
+ *
15
+ * Total: 5 application classes + 5 standard error body types = 10 error
16
+ * body types. Invalid Request has two id arms at the ENVELOPE level
17
+ * (valid-id echo vs null), but the error body is identical — yielding
18
+ * 11 closed envelope-level variants for byte-proof purposes.
19
+ *
20
+ * This module defines nothing new — every value traces to a frozen
21
+ * #1165 revision.
22
+ */
23
+ import type { MessagingErrorCode } from '../generated/contract.generated.js';
24
+ /** Handshake rejected by host or plugin. */
25
+ export declare const HANDSHAKE_REJECTED_CODE: -32090;
26
+ /** Delivery rejected — message could not be dispatched to handler. */
27
+ export declare const DELIVERY_REJECTED_CODE: -32091;
28
+ /** Domain-level error surfaced through the messaging layer. */
29
+ export declare const DOMAIN_ERROR_CODE: -32092;
30
+ /** Operation exceeded its time budget. */
31
+ export declare const DEADLINE_EXPIRED_CODE: -32093;
32
+ /** Requested snapshot state is not available. */
33
+ export declare const SNAPSHOT_UNAVAILABLE_CODE: -32094;
34
+ /** Canonical message for HANDSHAKE_REJECTED. */
35
+ export declare const HANDSHAKE_REJECTED_MESSAGE: "handshake rejected";
36
+ /** Canonical message for DELIVERY_REJECTED. */
37
+ export declare const DELIVERY_REJECTED_MESSAGE: "delivery rejected";
38
+ /** Canonical message for DOMAIN_ERROR. */
39
+ export declare const DOMAIN_ERROR_MESSAGE: "domain error";
40
+ /** Canonical message for DEADLINE_EXPIRED. */
41
+ export declare const DEADLINE_EXPIRED_MESSAGE: "deadline expired";
42
+ /** Canonical message for SNAPSHOT_UNAVAILABLE. */
43
+ export declare const SNAPSHOT_UNAVAILABLE_MESSAGE: "snapshot unavailable";
44
+ /** JSON could not be parsed. */
45
+ export declare const PARSE_ERROR_CODE: -32700;
46
+ /** The JSON sent is not a valid Request object. */
47
+ export declare const INVALID_REQUEST_CODE: -32600;
48
+ /** The method does not exist or is not available. */
49
+ export declare const METHOD_NOT_FOUND_CODE: -32601;
50
+ /** Invalid method parameter(s). */
51
+ export declare const INVALID_PARAMS_CODE: -32602;
52
+ /** Internal JSON-RPC error. */
53
+ export declare const INTERNAL_ERROR_CODE: -32603;
54
+ /** Canonical message for Parse error. */
55
+ export declare const PARSE_ERROR_MESSAGE: "Parse error";
56
+ /** Canonical message for Invalid Request. */
57
+ export declare const INVALID_REQUEST_MESSAGE: "Invalid Request";
58
+ /** Canonical message for Method not found. */
59
+ export declare const METHOD_NOT_FOUND_MESSAGE: "Method not found";
60
+ /** Canonical message for Invalid params. */
61
+ export declare const INVALID_PARAMS_MESSAGE: "Invalid params";
62
+ /** Canonical message for Internal error. */
63
+ export declare const INTERNAL_ERROR_MESSAGE: "Internal error";
64
+ /**
65
+ * Maps every wire error code to its canonical error message constant.
66
+ * Covers all 10 distinct codes (Invalid Request's two id-arms share one code).
67
+ */
68
+ export declare const ERROR_CODE_TO_MESSAGE: {
69
+ readonly [-32090]: "handshake rejected";
70
+ readonly [-32091]: "delivery rejected";
71
+ readonly [-32092]: "domain error";
72
+ readonly [-32093]: "deadline expired";
73
+ readonly [-32094]: "snapshot unavailable";
74
+ readonly [-32700]: "Parse error";
75
+ readonly [-32600]: "Invalid Request";
76
+ readonly [-32601]: "Method not found";
77
+ readonly [-32602]: "Invalid params";
78
+ readonly [-32603]: "Internal error";
79
+ };
80
+ /**
81
+ * Closed set of reasons a handshake may be rejected.
82
+ * Mechanized from #1165 R2.
83
+ */
84
+ export declare const HANDSHAKE_REJECT_REASONS: readonly ["MALFORMED_HELLO", "PACKAGE_MISMATCH", "CONTRACT_INCOMPATIBLE", "WIRE_INCOMPATIBLE", "AUTHORITY_VIOLATION", "DEADLINE_EXPIRED", "BINDING_REPLAY"];
85
+ /** Union of all handshake-rejection reasons. */
86
+ export type HandshakeRejectReason = (typeof HANDSHAKE_REJECT_REASONS)[number];
87
+ /**
88
+ * Closed set of reasons a delivery may be rejected.
89
+ * Mechanized from #1165 R2.
90
+ */
91
+ export declare const DELIVERY_REJECT_REASONS: readonly ["UNSUPPORTED_PAYLOAD", "NO_HANDLER", "PLUGIN_BUSY", "PLUGIN_INTERNAL"];
92
+ /** Union of all delivery-rejection reasons. */
93
+ export type DeliveryRejectReason = (typeof DELIVERY_REJECT_REASONS)[number];
94
+ /**
95
+ * Closed set of reasons a snapshot may be unavailable.
96
+ * Mechanized from #1165 R2.
97
+ */
98
+ export declare const SNAPSHOT_UNAVAILABLE_REASONS: readonly ["OVERSIZED_ITEM", "VIEW_EXPIRED", "STORE_UNAVAILABLE"];
99
+ /** Union of all snapshot-unavailability reasons. */
100
+ export type SnapshotUnavailableReason = (typeof SNAPSHOT_UNAVAILABLE_REASONS)[number];
101
+ export type { MessagingErrorCode } from '../generated/contract.generated.js';
102
+ /**
103
+ * HANDSHAKE_REJECTED (-32090).
104
+ * Sent when the handshake is refused for a well-typed reason.
105
+ */
106
+ export type HandshakeRejectedError = {
107
+ readonly code: typeof HANDSHAKE_REJECTED_CODE;
108
+ readonly message: typeof HANDSHAKE_REJECTED_MESSAGE;
109
+ readonly data: {
110
+ readonly reason: HandshakeRejectReason;
111
+ };
112
+ };
113
+ /**
114
+ * DELIVERY_REJECTED (-32091).
115
+ * Sent when a dispatched message cannot be accepted by the plugin.
116
+ */
117
+ export type DeliveryRejectedError = {
118
+ readonly code: typeof DELIVERY_REJECTED_CODE;
119
+ readonly message: typeof DELIVERY_REJECTED_MESSAGE;
120
+ readonly data: {
121
+ readonly reason: DeliveryRejectReason;
122
+ };
123
+ };
124
+ /**
125
+ * DOMAIN_ERROR (-32092).
126
+ * Domain-level failure surfaced through the messaging error taxonomy.
127
+ */
128
+ export type DomainError = {
129
+ readonly code: typeof DOMAIN_ERROR_CODE;
130
+ readonly message: typeof DOMAIN_ERROR_MESSAGE;
131
+ readonly data: {
132
+ readonly code: MessagingErrorCode;
133
+ };
134
+ };
135
+ /**
136
+ * DEADLINE_EXPIRED (-32093).
137
+ * The operation's time budget was exhausted. Data is an empty object.
138
+ */
139
+ export type DeadlineExpiredError = {
140
+ readonly code: typeof DEADLINE_EXPIRED_CODE;
141
+ readonly message: typeof DEADLINE_EXPIRED_MESSAGE;
142
+ readonly data: Record<string, never>;
143
+ };
144
+ /**
145
+ * SNAPSHOT_UNAVAILABLE (-32094).
146
+ * Requested snapshot state cannot be provided.
147
+ */
148
+ export type SnapshotUnavailableError = {
149
+ readonly code: typeof SNAPSHOT_UNAVAILABLE_CODE;
150
+ readonly message: typeof SNAPSHOT_UNAVAILABLE_MESSAGE;
151
+ readonly data: {
152
+ readonly reason: SnapshotUnavailableReason;
153
+ };
154
+ };
155
+ /** Union of all 5 application wire errors. */
156
+ export type ApplicationWireError = HandshakeRejectedError | DeliveryRejectedError | DomainError | DeadlineExpiredError | SnapshotUnavailableError;
157
+ /**
158
+ * Parse error (-32700).
159
+ * JSON could not be parsed. id is always null, no data field.
160
+ */
161
+ export type ParseError = {
162
+ readonly code: typeof PARSE_ERROR_CODE;
163
+ readonly message: typeof PARSE_ERROR_MESSAGE;
164
+ };
165
+ /**
166
+ * Invalid Request (-32600).
167
+ * The JSON sent is not a valid Request object.
168
+ *
169
+ * Two id arms at the envelope level (WireErrorResponse):
170
+ * - valid-id arm: envelope id = byte-equal RequestId echo
171
+ * - no-id arm: envelope id = null (true detection failure)
172
+ * The error body itself is identical for both arms.
173
+ */
174
+ export type InvalidRequestError = {
175
+ readonly code: typeof INVALID_REQUEST_CODE;
176
+ readonly message: typeof INVALID_REQUEST_MESSAGE;
177
+ };
178
+ /**
179
+ * Method not found (-32601).
180
+ * The requested method does not exist.
181
+ * Envelope id = byte-equal RequestId echo.
182
+ */
183
+ export type MethodNotFoundError = {
184
+ readonly code: typeof METHOD_NOT_FOUND_CODE;
185
+ readonly message: typeof METHOD_NOT_FOUND_MESSAGE;
186
+ };
187
+ /**
188
+ * Invalid params (-32602).
189
+ * Method parameters are invalid.
190
+ * Envelope id = byte-equal RequestId echo.
191
+ */
192
+ export type InvalidParamsError = {
193
+ readonly code: typeof INVALID_PARAMS_CODE;
194
+ readonly message: typeof INVALID_PARAMS_MESSAGE;
195
+ };
196
+ /**
197
+ * Internal error (-32603).
198
+ * Internal JSON-RPC processing failure.
199
+ * Envelope id = byte-equal RequestId echo.
200
+ */
201
+ export type InternalError = {
202
+ readonly code: typeof INTERNAL_ERROR_CODE;
203
+ readonly message: typeof INTERNAL_ERROR_MESSAGE;
204
+ };
205
+ /** Union of all 5 standard wire-error body types. */
206
+ export type StandardWireError = ParseError | InvalidRequestError | MethodNotFoundError | InvalidParamsError | InternalError;
207
+ /**
208
+ * The complete closed union of all wire-protocol error variants.
209
+ * 5 application + 6 standard = 11 variants.
210
+ *
211
+ * This type is exhaustive: any wire error returned on the protocol
212
+ * MUST be narrowable to one of these 11 shapes. Adding a variant
213
+ * requires a contract revision.
214
+ */
215
+ export type WireError = ApplicationWireError | StandardWireError;
216
+ /** All application error codes. */
217
+ export declare const APPLICATION_ERROR_CODES: readonly [-32090, -32091, -32092, -32093, -32094];
218
+ /** All standard JSON-RPC error codes. */
219
+ export declare const STANDARD_ERROR_CODES: readonly [-32700, -32600, -32601, -32602, -32603];
220
+ /** All wire error codes (application + standard). */
221
+ export declare const ALL_ERROR_CODES: readonly [-32090, -32091, -32092, -32093, -32094, -32700, -32600, -32601, -32602, -32603];
222
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/wire/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAM7E,4CAA4C;AAC5C,eAAO,MAAM,uBAAuB,EAAG,CAAC,KAAc,CAAC;AAEvD,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,EAAG,CAAC,KAAc,CAAC;AAEtD,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB,EAAG,CAAC,KAAc,CAAC;AAEjD,0CAA0C;AAC1C,eAAO,MAAM,qBAAqB,EAAG,CAAC,KAAc,CAAC;AAErD,iDAAiD;AACjD,eAAO,MAAM,yBAAyB,EAAG,CAAC,KAAc,CAAC;AAMzD,gDAAgD;AAChD,eAAO,MAAM,0BAA0B,EAAG,oBAA6B,CAAC;AAExE,+CAA+C;AAC/C,eAAO,MAAM,yBAAyB,EAAG,mBAA4B,CAAC;AAEtE,0CAA0C;AAC1C,eAAO,MAAM,oBAAoB,EAAG,cAAuB,CAAC;AAE5D,8CAA8C;AAC9C,eAAO,MAAM,wBAAwB,EAAG,kBAA2B,CAAC;AAEpE,kDAAkD;AAClD,eAAO,MAAM,4BAA4B,EAAG,sBAA+B,CAAC;AAM5E,gCAAgC;AAChC,eAAO,MAAM,gBAAgB,EAAG,CAAC,KAAc,CAAC;AAEhD,mDAAmD;AACnD,eAAO,MAAM,oBAAoB,EAAG,CAAC,KAAc,CAA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* Mechanized verbatim from the #1165 frozen shape.
4
+ *
5
+ * Application errors (R2 co-signed):
6
+ * HANDSHAKE_REJECTED (-32090), DELIVERY_REJECTED (-32091),
7
+ * DOMAIN_ERROR (-32092), DEADLINE_EXPIRED (-32093),
8
+ * SNAPSHOT_UNAVAILABLE (-32094).
9
+ *
10
+ * Standard JSON-RPC errors (R29):
11
+ * Parse error (-32700), Invalid Request (-32600, two id arms),
12
+ * Method not found (-32601), Invalid params (-32602),
13
+ * Internal error (-32603).
14
+ *
15
+ * Total: 5 application classes + 5 standard error body types = 10 error
16
+ * body types. Invalid Request has two id arms at the ENVELOPE level
17
+ * (valid-id echo vs null), but the error body is identical — yielding
18
+ * 11 closed envelope-level variants for byte-proof purposes.
19
+ *
20
+ * This module defines nothing new — every value traces to a frozen
21
+ * #1165 revision.
22
+ */
23
+ // ---------------------------------------------------------------------------
24
+ // Application error codes (R2)
25
+ // ---------------------------------------------------------------------------
26
+ /** Handshake rejected by host or plugin. */
27
+ export const HANDSHAKE_REJECTED_CODE = -32090;
28
+ /** Delivery rejected — message could not be dispatched to handler. */
29
+ export const DELIVERY_REJECTED_CODE = -32091;
30
+ /** Domain-level error surfaced through the messaging layer. */
31
+ export const DOMAIN_ERROR_CODE = -32092;
32
+ /** Operation exceeded its time budget. */
33
+ export const DEADLINE_EXPIRED_CODE = -32093;
34
+ /** Requested snapshot state is not available. */
35
+ export const SNAPSHOT_UNAVAILABLE_CODE = -32094;
36
+ // ---------------------------------------------------------------------------
37
+ // Application error messages (R2, exact const strings)
38
+ // ---------------------------------------------------------------------------
39
+ /** Canonical message for HANDSHAKE_REJECTED. */
40
+ export const HANDSHAKE_REJECTED_MESSAGE = 'handshake rejected';
41
+ /** Canonical message for DELIVERY_REJECTED. */
42
+ export const DELIVERY_REJECTED_MESSAGE = 'delivery rejected';
43
+ /** Canonical message for DOMAIN_ERROR. */
44
+ export const DOMAIN_ERROR_MESSAGE = 'domain error';
45
+ /** Canonical message for DEADLINE_EXPIRED. */
46
+ export const DEADLINE_EXPIRED_MESSAGE = 'deadline expired';
47
+ /** Canonical message for SNAPSHOT_UNAVAILABLE. */
48
+ export const SNAPSHOT_UNAVAILABLE_MESSAGE = 'snapshot unavailable';
49
+ // ---------------------------------------------------------------------------
50
+ // Standard JSON-RPC error codes (R29)
51
+ // ---------------------------------------------------------------------------
52
+ /** JSON could not be parsed. */
53
+ export const PARSE_ERROR_CODE = -32700;
54
+ /** The JSON sent is not a valid Request object. */
55
+ export const INVALID_REQUEST_CODE = -32600;
56
+ /** The method does not exist or is not available. */
57
+ export const METHOD_NOT_FOUND_CODE = -32601;
58
+ /** Invalid method parameter(s). */
59
+ export const INVALID_PARAMS_CODE = -32602;
60
+ /** Internal JSON-RPC error. */
61
+ export const INTERNAL_ERROR_CODE = -32603;
62
+ // ---------------------------------------------------------------------------
63
+ // Standard JSON-RPC error messages (R29, exact const strings)
64
+ // ---------------------------------------------------------------------------
65
+ /** Canonical message for Parse error. */
66
+ export const PARSE_ERROR_MESSAGE = 'Parse error';
67
+ /** Canonical message for Invalid Request. */
68
+ export const INVALID_REQUEST_MESSAGE = 'Invalid Request';
69
+ /** Canonical message for Method not found. */
70
+ export const METHOD_NOT_FOUND_MESSAGE = 'Method not found';
71
+ /** Canonical message for Invalid params. */
72
+ export const INVALID_PARAMS_MESSAGE = 'Invalid params';
73
+ /** Canonical message for Internal error. */
74
+ export const INTERNAL_ERROR_MESSAGE = 'Internal error';
75
+ // ---------------------------------------------------------------------------
76
+ // Code-to-message mapping
77
+ // ---------------------------------------------------------------------------
78
+ /**
79
+ * Maps every wire error code to its canonical error message constant.
80
+ * Covers all 10 distinct codes (Invalid Request's two id-arms share one code).
81
+ */
82
+ export const ERROR_CODE_TO_MESSAGE = {
83
+ [HANDSHAKE_REJECTED_CODE]: HANDSHAKE_REJECTED_MESSAGE,
84
+ [DELIVERY_REJECTED_CODE]: DELIVERY_REJECTED_MESSAGE,
85
+ [DOMAIN_ERROR_CODE]: DOMAIN_ERROR_MESSAGE,
86
+ [DEADLINE_EXPIRED_CODE]: DEADLINE_EXPIRED_MESSAGE,
87
+ [SNAPSHOT_UNAVAILABLE_CODE]: SNAPSHOT_UNAVAILABLE_MESSAGE,
88
+ [PARSE_ERROR_CODE]: PARSE_ERROR_MESSAGE,
89
+ [INVALID_REQUEST_CODE]: INVALID_REQUEST_MESSAGE,
90
+ [METHOD_NOT_FOUND_CODE]: METHOD_NOT_FOUND_MESSAGE,
91
+ [INVALID_PARAMS_CODE]: INVALID_PARAMS_MESSAGE,
92
+ [INTERNAL_ERROR_CODE]: INTERNAL_ERROR_MESSAGE,
93
+ };
94
+ // ---------------------------------------------------------------------------
95
+ // Reject-reason taxonomies (closed enums, R2)
96
+ // ---------------------------------------------------------------------------
97
+ /**
98
+ * Closed set of reasons a handshake may be rejected.
99
+ * Mechanized from #1165 R2.
100
+ */
101
+ export const HANDSHAKE_REJECT_REASONS = [
102
+ 'MALFORMED_HELLO',
103
+ 'PACKAGE_MISMATCH',
104
+ 'CONTRACT_INCOMPATIBLE',
105
+ 'WIRE_INCOMPATIBLE',
106
+ 'AUTHORITY_VIOLATION',
107
+ 'DEADLINE_EXPIRED',
108
+ 'BINDING_REPLAY',
109
+ ];
110
+ /**
111
+ * Closed set of reasons a delivery may be rejected.
112
+ * Mechanized from #1165 R2.
113
+ */
114
+ export const DELIVERY_REJECT_REASONS = [
115
+ 'UNSUPPORTED_PAYLOAD',
116
+ 'NO_HANDLER',
117
+ 'PLUGIN_BUSY',
118
+ 'PLUGIN_INTERNAL',
119
+ ];
120
+ /**
121
+ * Closed set of reasons a snapshot may be unavailable.
122
+ * Mechanized from #1165 R2.
123
+ */
124
+ export const SNAPSHOT_UNAVAILABLE_REASONS = [
125
+ 'OVERSIZED_ITEM',
126
+ 'VIEW_EXPIRED',
127
+ 'STORE_UNAVAILABLE',
128
+ ];
129
+ // ---------------------------------------------------------------------------
130
+ // All error codes collected for iteration
131
+ // ---------------------------------------------------------------------------
132
+ /** All application error codes. */
133
+ export const APPLICATION_ERROR_CODES = [
134
+ HANDSHAKE_REJECTED_CODE,
135
+ DELIVERY_REJECTED_CODE,
136
+ DOMAIN_ERROR_CODE,
137
+ DEADLINE_EXPIRED_CODE,
138
+ SNAPSHOT_UNAVAILABLE_CODE,
139
+ ];
140
+ /** All standard JSON-RPC error codes. */
141
+ export const STANDARD_ERROR_CODES = [
142
+ PARSE_ERROR_CODE,
143
+ INVALID_REQUEST_CODE,
144
+ METHOD_NOT_FOUND_CODE,
145
+ INVALID_PARAMS_CODE,
146
+ INTERNAL_ERROR_CODE,
147
+ ];
148
+ /** All wire error codes (application + standard). */
149
+ export const ALL_ERROR_CODES = [
150
+ ...APPLICATION_ERROR_CODES,
151
+ ...STANDARD_ERROR_CODES,
152
+ ];
153
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/wire/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,8EAA8E;AAC9E,+BAA+B;AAC/B,8EAA8E;AAE9E,4CAA4C;AAC5C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAc,CAAC;AAEvD,sEAAsE;AACtE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAc,CAAC;AAEtD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAc,CAAC;AAEjD,0CAA0C;AAC1C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAc,CAAC;AAErD,iDAAiD;AACjD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,KAAc,CAAC;AAEzD,8EAA8E;AAC9E,uDAAuD;AACvD,8EAA8E;AAE9E,gDAAgD;AAChD,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAA6B,CAAC;AAExE,+CAA+C;AAC/C,MAAM,CAAC,MAAM,yBAAyB,GAAG,mBAA4B,CAAC;AAEtE,0CAA0C;AA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