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

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 (157) 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 +9 -0
  10. package/dist/conformance/fixtures.d.ts.map +1 -0
  11. package/dist/conformance/fixtures.js +8 -0
  12. package/dist/conformance/fixtures.js.map +1 -0
  13. package/dist/conformance/index.d.ts +5 -0
  14. package/dist/conformance/index.d.ts.map +1 -1
  15. package/dist/conformance/index.js +4 -0
  16. package/dist/conformance/index.js.map +1 -1
  17. package/dist/conformance/messaging-loopback-adapter.d.ts +23 -0
  18. package/dist/conformance/messaging-loopback-adapter.d.ts.map +1 -0
  19. package/dist/conformance/messaging-loopback-adapter.js +389 -0
  20. package/dist/conformance/messaging-loopback-adapter.js.map +1 -0
  21. package/dist/conformance/messaging-loopback-state.d.ts +22 -0
  22. package/dist/conformance/messaging-loopback-state.d.ts.map +1 -0
  23. package/dist/conformance/messaging-loopback-state.js +101 -0
  24. package/dist/conformance/messaging-loopback-state.js.map +1 -0
  25. package/dist/conformance/runner.d.ts +18 -1
  26. package/dist/conformance/runner.d.ts.map +1 -1
  27. package/dist/conformance/runner.js +153 -66
  28. package/dist/conformance/runner.js.map +1 -1
  29. package/dist/conformance/stdio-harness/child-process-harness.d.ts +65 -0
  30. package/dist/conformance/stdio-harness/child-process-harness.d.ts.map +1 -0
  31. package/dist/conformance/stdio-harness/child-process-harness.js +296 -0
  32. package/dist/conformance/stdio-harness/child-process-harness.js.map +1 -0
  33. package/dist/conformance/stdio-harness/dual-transport-oracle.d.ts +26 -0
  34. package/dist/conformance/stdio-harness/dual-transport-oracle.d.ts.map +1 -0
  35. package/dist/conformance/stdio-harness/dual-transport-oracle.js +32 -0
  36. package/dist/conformance/stdio-harness/dual-transport-oracle.js.map +1 -0
  37. package/dist/conformance/stdio-harness/harness-process-spawn.d.ts +27 -0
  38. package/dist/conformance/stdio-harness/harness-process-spawn.d.ts.map +1 -0
  39. package/dist/conformance/stdio-harness/harness-process-spawn.js +43 -0
  40. package/dist/conformance/stdio-harness/harness-process-spawn.js.map +1 -0
  41. package/dist/conformance/stdio-harness/index.d.ts +5 -0
  42. package/dist/conformance/stdio-harness/index.d.ts.map +1 -0
  43. package/dist/conformance/stdio-harness/index.js +4 -0
  44. package/dist/conformance/stdio-harness/index.js.map +1 -0
  45. package/dist/conformance/stdio-harness/ndjson-frame.d.ts +31 -0
  46. package/dist/conformance/stdio-harness/ndjson-frame.d.ts.map +1 -0
  47. package/dist/conformance/stdio-harness/ndjson-frame.js +125 -0
  48. package/dist/conformance/stdio-harness/ndjson-frame.js.map +1 -0
  49. package/dist/conformance/stdio-harness/node-process-tree-runtime.d.ts +15 -0
  50. package/dist/conformance/stdio-harness/node-process-tree-runtime.d.ts.map +1 -0
  51. package/dist/conformance/stdio-harness/node-process-tree-runtime.js +78 -0
  52. package/dist/conformance/stdio-harness/node-process-tree-runtime.js.map +1 -0
  53. package/dist/conformance/stdio-harness/process-tree-controller.d.ts +51 -0
  54. package/dist/conformance/stdio-harness/process-tree-controller.d.ts.map +1 -0
  55. package/dist/conformance/stdio-harness/process-tree-controller.js +162 -0
  56. package/dist/conformance/stdio-harness/process-tree-controller.js.map +1 -0
  57. package/dist/conformance/stdio-harness/windows-sentinel.d.ts +15 -0
  58. package/dist/conformance/stdio-harness/windows-sentinel.d.ts.map +1 -0
  59. package/dist/conformance/stdio-harness/windows-sentinel.js +160 -0
  60. package/dist/conformance/stdio-harness/windows-sentinel.js.map +1 -0
  61. package/dist/conformance/stdio-harness/wire-shape.d.ts +18 -0
  62. package/dist/conformance/stdio-harness/wire-shape.d.ts.map +1 -0
  63. package/dist/conformance/stdio-harness/wire-shape.js +2 -0
  64. package/dist/conformance/stdio-harness/wire-shape.js.map +1 -0
  65. package/dist/generated/contract.generated.d.ts +305 -1
  66. package/dist/generated/contract.generated.d.ts.map +1 -1
  67. package/dist/generated/contract.generated.js +1 -1
  68. package/dist/generated/contract.generated.js.map +1 -1
  69. package/dist/index.d.ts +3 -1
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +5 -1
  72. package/dist/index.js.map +1 -1
  73. package/dist/validation/index.d.ts +2 -0
  74. package/dist/validation/index.d.ts.map +1 -1
  75. package/dist/validation/index.js +2 -0
  76. package/dist/validation/index.js.map +1 -1
  77. package/dist/validation/manifest.d.ts +23 -0
  78. package/dist/validation/manifest.d.ts.map +1 -0
  79. package/dist/validation/manifest.js +53 -0
  80. package/dist/validation/manifest.js.map +1 -0
  81. package/dist/validation/signals.d.ts +26 -0
  82. package/dist/validation/signals.d.ts.map +1 -0
  83. package/dist/validation/signals.js +206 -0
  84. package/dist/validation/signals.js.map +1 -0
  85. package/dist/wire/constants.d.ts +36 -0
  86. package/dist/wire/constants.d.ts.map +1 -0
  87. package/dist/wire/constants.js +36 -0
  88. package/dist/wire/constants.js.map +1 -0
  89. package/dist/wire/disposition-fixtures.d.ts +110 -0
  90. package/dist/wire/disposition-fixtures.d.ts.map +1 -0
  91. package/dist/wire/disposition-fixtures.js +1462 -0
  92. package/dist/wire/disposition-fixtures.js.map +1 -0
  93. package/dist/wire/disposition.d.ts +102 -0
  94. package/dist/wire/disposition.d.ts.map +1 -0
  95. package/dist/wire/disposition.js +217 -0
  96. package/dist/wire/disposition.js.map +1 -0
  97. package/dist/wire/envelope.d.ts +253 -0
  98. package/dist/wire/envelope.d.ts.map +1 -0
  99. package/dist/wire/envelope.js +19 -0
  100. package/dist/wire/envelope.js.map +1 -0
  101. package/dist/wire/errors.d.ts +222 -0
  102. package/dist/wire/errors.d.ts.map +1 -0
  103. package/dist/wire/errors.js +153 -0
  104. package/dist/wire/errors.js.map +1 -0
  105. package/dist/wire/grants.d.ts +57 -0
  106. package/dist/wire/grants.d.ts.map +1 -0
  107. package/dist/wire/grants.js +59 -0
  108. package/dist/wire/grants.js.map +1 -0
  109. package/dist/wire/handshake-byte-bounds.d.ts +69 -0
  110. package/dist/wire/handshake-byte-bounds.d.ts.map +1 -0
  111. package/dist/wire/handshake-byte-bounds.js +173 -0
  112. package/dist/wire/handshake-byte-bounds.js.map +1 -0
  113. package/dist/wire/handshake.d.ts +146 -0
  114. package/dist/wire/handshake.d.ts.map +1 -0
  115. package/dist/wire/handshake.js +189 -0
  116. package/dist/wire/handshake.js.map +1 -0
  117. package/dist/wire/index.d.ts +35 -0
  118. package/dist/wire/index.d.ts.map +1 -0
  119. package/dist/wire/index.js +53 -0
  120. package/dist/wire/index.js.map +1 -0
  121. package/dist/wire/lifecycle-byte-bounds.d.ts +55 -0
  122. package/dist/wire/lifecycle-byte-bounds.d.ts.map +1 -0
  123. package/dist/wire/lifecycle-byte-bounds.js +209 -0
  124. package/dist/wire/lifecycle-byte-bounds.js.map +1 -0
  125. package/dist/wire/registry.d.ts +283 -0
  126. package/dist/wire/registry.d.ts.map +1 -0
  127. package/dist/wire/registry.js +258 -0
  128. package/dist/wire/registry.js.map +1 -0
  129. package/dist/wire/request-id.d.ts +34 -0
  130. package/dist/wire/request-id.d.ts.map +1 -0
  131. package/dist/wire/request-id.js +40 -0
  132. package/dist/wire/request-id.js.map +1 -0
  133. package/dist/wire/row-shapes.d.ts +212 -0
  134. package/dist/wire/row-shapes.d.ts.map +1 -0
  135. package/dist/wire/row-shapes.js +59 -0
  136. package/dist/wire/row-shapes.js.map +1 -0
  137. package/dist/wire/signal-byte-bounds.d.ts +97 -0
  138. package/dist/wire/signal-byte-bounds.d.ts.map +1 -0
  139. package/dist/wire/signal-byte-bounds.js +229 -0
  140. package/dist/wire/signal-byte-bounds.js.map +1 -0
  141. package/dist/wire/wire-uint53.d.ts +26 -0
  142. package/dist/wire/wire-uint53.d.ts.map +1 -0
  143. package/dist/wire/wire-uint53.js +32 -0
  144. package/dist/wire/wire-uint53.js.map +1 -0
  145. package/fixtures/behavior/messaging/adversarial-invariants.json +56 -5
  146. package/fixtures/manifest/invalid/duplicate-signal-type.json +33 -0
  147. package/fixtures/signals/invalid/destination-injection.json +15 -0
  148. package/fixtures/signals/invalid/dynamic-schema-url.json +10 -0
  149. package/fixtures/signals/invalid/forbidden-raw-privacy.json +10 -0
  150. package/fixtures/signals/invalid/non-utc-occurred-at.json +12 -0
  151. package/fixtures/signals/valid/feishu-meeting-artifact.json +18 -0
  152. package/fixtures/signals/valid/remote-service-declaration.json +10 -0
  153. package/package.json +13 -5
  154. package/src/schemas/manifest.schema.json +5 -2
  155. package/src/schemas/messaging.schema.json +1 -0
  156. package/src/schemas/physical-limb.schema.json +319 -0
  157. package/src/schemas/signal.schema.json +129 -0
@@ -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,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G;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,e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AAC;AAMjE,mCAAmC;AACnC,eAAO,MAAM,uBAAuB,mDAM1B,CAAC;AAEX,yCAAyC;AACzC,eAAO,MAAM,oBAAoB,mDAMvB,CAAC;AAEX,qDAAqD;AACrD,eAAO,MAAM,eAAe,2FAGlB,CAAC"}
@@ -0,0 +1,153 @@
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
+ // ---------------------------------------------------------------------------
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,y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mB;IACnB,mBAAmB;CACX,CAAC;AAEX,qDAAqD;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,GAAG,uBAAuB;IAC1B,GAAG,oBAAoB;CACf,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Grant snapshot types — GrantSnapshot for SessionBinding and host.grants.changed.
3
+ * Mechanized verbatim from #1165 frozen shape.
4
+ *
5
+ * GrantSnapshot represents the effective capability set at a point in time.
6
+ * It appears in two locations:
7
+ * - SessionBinding (initial grant state at handshake)
8
+ * - host.grants.changed notification (runtime grant mutations)
9
+ *
10
+ * grantRevision is strictly monotonic per plugin instance — the Host
11
+ * increments it on every grant mutation. A plugin that observes
12
+ * revision N may discard any notification with revision < N.
13
+ */
14
+ import type { Capability } from '../generated/contract.generated.js';
15
+ /**
16
+ * Maximum number of items in effectiveGrants.
17
+ * Derived from the 17-value Capability enum — a plugin cannot hold
18
+ * more capabilities than exist.
19
+ */
20
+ export declare const MAX_GRANT_ITEMS: 17;
21
+ /**
22
+ * GrantSnapshot captures a versioned capability set.
23
+ *
24
+ * Used in SessionBinding (handshake) and host.grants.changed (notification).
25
+ * The two fields are always paired and always travel together.
26
+ */
27
+ export interface GrantSnapshot {
28
+ /**
29
+ * WireUInt53(0, 9_007_199_254_740_991).
30
+ * Monotonically increasing per plugin instance.
31
+ * The Host is the sole writer; plugins observe only.
32
+ */
33
+ readonly grantRevision: number;
34
+ /**
35
+ * Unique Capability[], 0..17 items.
36
+ * Duplicates are a protocol violation (Host guarantees uniqueness).
37
+ * Empty array is valid (plugin has no capabilities).
38
+ */
39
+ readonly effectiveGrants: readonly Capability[];
40
+ }
41
+ /**
42
+ * Frozen set of all valid Capability values, derived from the generated
43
+ * L0/L1/L2 capability arrays. Used for closed-enum membership checks.
44
+ */
45
+ export declare const VALID_CAPABILITIES: ReadonlySet<string>;
46
+ /**
47
+ * Validate that effectiveGrants:
48
+ * 1. Does not exceed MAX_GRANT_ITEMS (17).
49
+ * 2. Contains no duplicates.
50
+ * 3. Contains only valid Capability enum members (closed-enum check).
51
+ *
52
+ * Fail-closed: any unrecognized capability value returns false.
53
+ * This is an authorization boundary — fail-open would allow
54
+ * uncontrolled privilege escalation.
55
+ */
56
+ export declare function validateEffectiveGrants(grants: readonly string[]): boolean;
57
+ //# sourceMappingURL=grants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../../src/wire/grants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAWrE;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAG,EAAW,CAAC;AAM3C;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,eAAe,EAAE,SAAS,UAAU,EAAE,CAAC;CACjD;AAMD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAIjD,CAAC;AAEH;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAS1E"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Grant snapshot types — GrantSnapshot for SessionBinding and host.grants.changed.
3
+ * Mechanized verbatim from #1165 frozen shape.
4
+ *
5
+ * GrantSnapshot represents the effective capability set at a point in time.
6
+ * It appears in two locations:
7
+ * - SessionBinding (initial grant state at handshake)
8
+ * - host.grants.changed notification (runtime grant mutations)
9
+ *
10
+ * grantRevision is strictly monotonic per plugin instance — the Host
11
+ * increments it on every grant mutation. A plugin that observes
12
+ * revision N may discard any notification with revision < N.
13
+ */
14
+ import { L0_CAPABILITIES, L1_CAPABILITIES, L2_CAPABILITIES, } from '../generated/contract.generated.js';
15
+ // ---------------------------------------------------------------------------
16
+ // Constants
17
+ // ---------------------------------------------------------------------------
18
+ /**
19
+ * Maximum number of items in effectiveGrants.
20
+ * Derived from the 17-value Capability enum — a plugin cannot hold
21
+ * more capabilities than exist.
22
+ */
23
+ export const MAX_GRANT_ITEMS = 17;
24
+ // ---------------------------------------------------------------------------
25
+ // Validators
26
+ // ---------------------------------------------------------------------------
27
+ /**
28
+ * Frozen set of all valid Capability values, derived from the generated
29
+ * L0/L1/L2 capability arrays. Used for closed-enum membership checks.
30
+ */
31
+ export const VALID_CAPABILITIES = new Set([
32
+ ...L0_CAPABILITIES,
33
+ ...L1_CAPABILITIES,
34
+ ...L2_CAPABILITIES,
35
+ ]);
36
+ /**
37
+ * Validate that effectiveGrants:
38
+ * 1. Does not exceed MAX_GRANT_ITEMS (17).
39
+ * 2. Contains no duplicates.
40
+ * 3. Contains only valid Capability enum members (closed-enum check).
41
+ *
42
+ * Fail-closed: any unrecognized capability value returns false.
43
+ * This is an authorization boundary — fail-open would allow
44
+ * uncontrolled privilege escalation.
45
+ */
46
+ export function validateEffectiveGrants(grants) {
47
+ if (grants.length > MAX_GRANT_ITEMS)
48
+ return false;
49
+ const seen = new Set();
50
+ for (const g of grants) {
51
+ if (!VALID_CAPABILITIES.has(g))
52
+ return false; // unknown capability
53
+ if (seen.has(g))
54
+ return false; // duplicate
55
+ seen.add(g);
56
+ }
57
+ return true;
58
+ }
59
+ //# sourceMappingURL=grants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grants.js","sourceRoot":"","sources":["../../src/wire/grants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,GAChB,MAAM,oCAAoC,CAAC;AAE5C,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAW,CAAC;AA2B3C,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAS;IACrE,GAAG,eAAe;IAClB,GAAG,eAAe;IAClB,GAAG,eAAe;CACnB,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAyB;IAC/D,IAAI,MAAM,CAAC,MAAM,GAAG,eAAe;QAAE,OAAO,KAAK,CAAC;IAClD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC,CAAC,qBAAqB;QACnE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC,CAAgB,YAAY;QAC1D,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Derived compact-JSON byte bounds for the beta.8 handshake rows.
3
+ *
4
+ * This production module owns only the published summary metadata. The
5
+ * generic byte-proof kernel remains test-only; keeping it out of the packed
6
+ * artifact prevents consumers from accidentally treating a proof generator
7
+ * as a runtime protocol dependency. The test-only templates independently
8
+ * recompute these values from the same closed grammar.
9
+ */
10
+ /** Encoding families used for raw UTF-8 boundary evidence. */
11
+ export declare const HANDSHAKE_BYTE_PROOF_ENCODING_FAMILIES: readonly ["ascii", "multibyte", "escaping"];
12
+ export type HandshakeByteProofEncodingFamily = (typeof HANDSHAKE_BYTE_PROOF_ENCODING_FAMILIES)[number];
13
+ /** One rejected N+1 candidate measured alongside a maximum frame. */
14
+ export interface HandshakeNPlusOneByteProof {
15
+ readonly leaf: string;
16
+ readonly encodedBytes: number;
17
+ readonly fitsFrame: boolean;
18
+ }
19
+ /** Raw UTF-8 measurement for one encoding family. */
20
+ export interface HandshakeEncodedByteProofCase {
21
+ readonly family: HandshakeByteProofEncodingFamily;
22
+ readonly encodedBytes: number;
23
+ readonly fitsFrame: boolean;
24
+ readonly nPlusOne: readonly HandshakeNPlusOneByteProof[];
25
+ }
26
+ /** Published max plus the raw-family proof cases from which it is derived. */
27
+ export interface HandshakeEncodedByteProof {
28
+ readonly maxEncodedBytes: number;
29
+ readonly cases: readonly HandshakeEncodedByteProofCase[];
30
+ }
31
+ /** Per-row frame maxima consumed by the public method registry. */
32
+ export interface HandshakeRowEncodedByteBounds {
33
+ readonly maxEncodedRequestBytes: number;
34
+ readonly maxEncodedResultBytes: number;
35
+ readonly maxEncodedErrorBytes: number;
36
+ }
37
+ /** Raw proof of the largest legal broker.hello request. */
38
+ export declare const BROKER_HELLO_REQUEST_BYTE_PROOF: HandshakeEncodedByteProof;
39
+ /** Raw proof of the largest legal broker.hello success result. */
40
+ export declare const BROKER_HELLO_RESULT_BYTE_PROOF: HandshakeEncodedByteProof;
41
+ /** Raw proof of the largest legal broker.ready request. */
42
+ export declare const BROKER_READY_REQUEST_BYTE_PROOF: HandshakeEncodedByteProof;
43
+ /** Raw proof of the largest handshake rejection envelope. */
44
+ export declare const HANDSHAKE_REJECTED_ERROR_BYTE_PROOF: HandshakeEncodedByteProof;
45
+ /** broker.ready succeeds with the exact JSON-RPC result `null`. */
46
+ export declare const BROKER_READY_MAX_ENCODED_RESULT_BYTES: number;
47
+ export declare const BROKER_HELLO_MAX_ENCODED_REQUEST_BYTES: number;
48
+ export declare const BROKER_HELLO_MAX_ENCODED_RESULT_BYTES: number;
49
+ export declare const BROKER_HELLO_MAX_ENCODED_ERROR_BYTES: number;
50
+ export declare const BROKER_READY_MAX_ENCODED_REQUEST_BYTES: number;
51
+ export declare const BROKER_READY_MAX_ENCODED_ERROR_BYTES: number;
52
+ /**
53
+ * The exact per-row summary consumed by the registry. No byte value is
54
+ * hand-entered in the registry; all maxima are derived above from the closed
55
+ * grammar and raw UTF-8 serialization.
56
+ */
57
+ export declare const HANDSHAKE_ROW_ENCODED_BYTE_BOUNDS: {
58
+ readonly 'broker.hello': {
59
+ readonly maxEncodedRequestBytes: number;
60
+ readonly maxEncodedResultBytes: number;
61
+ readonly maxEncodedErrorBytes: number;
62
+ };
63
+ readonly 'broker.ready': {
64
+ readonly maxEncodedRequestBytes: number;
65
+ readonly maxEncodedResultBytes: number;
66
+ readonly maxEncodedErrorBytes: number;
67
+ };
68
+ };
69
+ //# sourceMappingURL=handshake-byte-bounds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handshake-byte-bounds.d.ts","sourceRoot":"","sources":["../../src/wire/handshake-byte-bounds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmBH,8DAA8D;AAC9D,eAAO,MAAM,sCAAsC,6CAIzC,CAAC;AAEX,MAAM,MAAM,gCAAgC,GAC1C,CAAC,OAAO,sCAAsC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,qEAAqE;AACrE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,qDAAqD;AACrD,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,MAAM,EAAE,gCAAgC,CAAC;IAClD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,SAAS,0BAA0B,EAAE,CAAC;CAC1D;AAED,8EAA8E;AAC9E,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,6BAA6B,EAAE,CAAC;CAC1D;AAED,mEAAmE;AACnE,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,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