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

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 (118) hide show
  1. package/dist/codegen/generate-contract.d.ts +1 -0
  2. package/dist/codegen/generate-contract.d.ts.map +1 -1
  3. package/dist/codegen/generate-contract.js +26 -2
  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/index.d.ts +3 -0
  10. package/dist/conformance/index.d.ts.map +1 -1
  11. package/dist/conformance/index.js +3 -0
  12. package/dist/conformance/index.js.map +1 -1
  13. package/dist/conformance/messaging-loopback-adapter.d.ts +23 -0
  14. package/dist/conformance/messaging-loopback-adapter.d.ts.map +1 -0
  15. package/dist/conformance/messaging-loopback-adapter.js +389 -0
  16. package/dist/conformance/messaging-loopback-adapter.js.map +1 -0
  17. package/dist/conformance/messaging-loopback-state.d.ts +22 -0
  18. package/dist/conformance/messaging-loopback-state.d.ts.map +1 -0
  19. package/dist/conformance/messaging-loopback-state.js +101 -0
  20. package/dist/conformance/messaging-loopback-state.js.map +1 -0
  21. package/dist/conformance/runner.d.ts +18 -1
  22. package/dist/conformance/runner.d.ts.map +1 -1
  23. package/dist/conformance/runner.js +133 -64
  24. package/dist/conformance/runner.js.map +1 -1
  25. package/dist/conformance/stdio-harness/child-process-harness.d.ts +59 -0
  26. package/dist/conformance/stdio-harness/child-process-harness.d.ts.map +1 -0
  27. package/dist/conformance/stdio-harness/child-process-harness.js +279 -0
  28. package/dist/conformance/stdio-harness/child-process-harness.js.map +1 -0
  29. package/dist/conformance/stdio-harness/dual-transport-oracle.d.ts +26 -0
  30. package/dist/conformance/stdio-harness/dual-transport-oracle.d.ts.map +1 -0
  31. package/dist/conformance/stdio-harness/dual-transport-oracle.js +32 -0
  32. package/dist/conformance/stdio-harness/dual-transport-oracle.js.map +1 -0
  33. package/dist/conformance/stdio-harness/harness-process-spawn.d.ts +27 -0
  34. package/dist/conformance/stdio-harness/harness-process-spawn.d.ts.map +1 -0
  35. package/dist/conformance/stdio-harness/harness-process-spawn.js +43 -0
  36. package/dist/conformance/stdio-harness/harness-process-spawn.js.map +1 -0
  37. package/dist/conformance/stdio-harness/index.d.ts +5 -0
  38. package/dist/conformance/stdio-harness/index.d.ts.map +1 -0
  39. package/dist/conformance/stdio-harness/index.js +4 -0
  40. package/dist/conformance/stdio-harness/index.js.map +1 -0
  41. package/dist/conformance/stdio-harness/ndjson-frame.d.ts +26 -0
  42. package/dist/conformance/stdio-harness/ndjson-frame.d.ts.map +1 -0
  43. package/dist/conformance/stdio-harness/ndjson-frame.js +119 -0
  44. package/dist/conformance/stdio-harness/ndjson-frame.js.map +1 -0
  45. package/dist/conformance/stdio-harness/node-process-tree-runtime.d.ts +15 -0
  46. package/dist/conformance/stdio-harness/node-process-tree-runtime.d.ts.map +1 -0
  47. package/dist/conformance/stdio-harness/node-process-tree-runtime.js +78 -0
  48. package/dist/conformance/stdio-harness/node-process-tree-runtime.js.map +1 -0
  49. package/dist/conformance/stdio-harness/process-tree-controller.d.ts +51 -0
  50. package/dist/conformance/stdio-harness/process-tree-controller.d.ts.map +1 -0
  51. package/dist/conformance/stdio-harness/process-tree-controller.js +162 -0
  52. package/dist/conformance/stdio-harness/process-tree-controller.js.map +1 -0
  53. package/dist/conformance/stdio-harness/windows-sentinel.d.ts +15 -0
  54. package/dist/conformance/stdio-harness/windows-sentinel.d.ts.map +1 -0
  55. package/dist/conformance/stdio-harness/windows-sentinel.js +160 -0
  56. package/dist/conformance/stdio-harness/windows-sentinel.js.map +1 -0
  57. package/dist/conformance/stdio-harness/wire-shape.d.ts +18 -0
  58. package/dist/conformance/stdio-harness/wire-shape.d.ts.map +1 -0
  59. package/dist/conformance/stdio-harness/wire-shape.js +2 -0
  60. package/dist/conformance/stdio-harness/wire-shape.js.map +1 -0
  61. package/dist/generated/contract.generated.d.ts +129 -1
  62. package/dist/generated/contract.generated.d.ts.map +1 -1
  63. package/dist/generated/contract.generated.js +1 -1
  64. package/dist/generated/contract.generated.js.map +1 -1
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +3 -0
  68. package/dist/index.js.map +1 -1
  69. package/dist/wire/constants.d.ts +36 -0
  70. package/dist/wire/constants.d.ts.map +1 -0
  71. package/dist/wire/constants.js +36 -0
  72. package/dist/wire/constants.js.map +1 -0
  73. package/dist/wire/disposition-fixtures.d.ts +99 -0
  74. package/dist/wire/disposition-fixtures.d.ts.map +1 -0
  75. package/dist/wire/disposition-fixtures.js +623 -0
  76. package/dist/wire/disposition-fixtures.js.map +1 -0
  77. package/dist/wire/disposition.d.ts +100 -0
  78. package/dist/wire/disposition.d.ts.map +1 -0
  79. package/dist/wire/disposition.js +205 -0
  80. package/dist/wire/disposition.js.map +1 -0
  81. package/dist/wire/envelope.d.ts +253 -0
  82. package/dist/wire/envelope.d.ts.map +1 -0
  83. package/dist/wire/envelope.js +19 -0
  84. package/dist/wire/envelope.js.map +1 -0
  85. package/dist/wire/errors.d.ts +222 -0
  86. package/dist/wire/errors.d.ts.map +1 -0
  87. package/dist/wire/errors.js +153 -0
  88. package/dist/wire/errors.js.map +1 -0
  89. package/dist/wire/grants.d.ts +57 -0
  90. package/dist/wire/grants.d.ts.map +1 -0
  91. package/dist/wire/grants.js +59 -0
  92. package/dist/wire/grants.js.map +1 -0
  93. package/dist/wire/handshake.d.ts +100 -0
  94. package/dist/wire/handshake.d.ts.map +1 -0
  95. package/dist/wire/handshake.js +70 -0
  96. package/dist/wire/handshake.js.map +1 -0
  97. package/dist/wire/index.d.ts +26 -0
  98. package/dist/wire/index.d.ts.map +1 -0
  99. package/dist/wire/index.js +45 -0
  100. package/dist/wire/index.js.map +1 -0
  101. package/dist/wire/registry.d.ts +90 -0
  102. package/dist/wire/registry.d.ts.map +1 -0
  103. package/dist/wire/registry.js +232 -0
  104. package/dist/wire/registry.js.map +1 -0
  105. package/dist/wire/request-id.d.ts +34 -0
  106. package/dist/wire/request-id.d.ts.map +1 -0
  107. package/dist/wire/request-id.js +40 -0
  108. package/dist/wire/request-id.js.map +1 -0
  109. package/dist/wire/row-shapes.d.ts +212 -0
  110. package/dist/wire/row-shapes.d.ts.map +1 -0
  111. package/dist/wire/row-shapes.js +59 -0
  112. package/dist/wire/row-shapes.js.map +1 -0
  113. package/dist/wire/wire-uint53.d.ts +26 -0
  114. package/dist/wire/wire-uint53.d.ts.map +1 -0
  115. package/dist/wire/wire-uint53.js +32 -0
  116. package/dist/wire/wire-uint53.js.map +1 -0
  117. package/fixtures/behavior/messaging/adversarial-invariants.json +56 -5
  118. package/package.json +7 -3
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Handshake types — CandidateHello, SessionBinding, BrokerReadyParams.
3
+ * Mechanized verbatim from #1165 frozen shape.
4
+ *
5
+ * Handshake flow:
6
+ * 1. Plugin sends CandidateHello (candidate claims only, no grants/session).
7
+ * 2. Host validates, mints instance/session ids, replies with SessionBinding.
8
+ * 3. Plugin sends broker.ready with the bindingNonce to activate.
9
+ *
10
+ * CandidateHello and BrokerReadyParams REJECT any additional
11
+ * identity/instance/grant/session fields (closed surface).
12
+ */
13
+ // ---------------------------------------------------------------------------
14
+ // Package digest constants (CLOSED — H2)
15
+ // ---------------------------------------------------------------------------
16
+ /** Exact character length of a sha512 SRI digest. */
17
+ export const PACKAGE_DIGEST_LENGTH = 95;
18
+ /**
19
+ * Pattern for a valid sha512 SRI package digest.
20
+ * 85 base64 chars + one of [AQgw] + '==' suffix.
21
+ */
22
+ export const PACKAGE_DIGEST_PATTERN = /^sha512-[A-Za-z0-9+/]{85}[AQgw]==$/;
23
+ /**
24
+ * Compact-JSON encoded byte count for the digest string.
25
+ * 95 chars (all ASCII) + 2 surrounding quotes = 97 bytes.
26
+ */
27
+ export const PACKAGE_DIGEST_ENCODED_BYTES = 97;
28
+ // ---------------------------------------------------------------------------
29
+ // Binding nonce bounds (CLOSED — H9)
30
+ // ---------------------------------------------------------------------------
31
+ /** Minimum code-point length for bindingNonce. */
32
+ export const BINDING_NONCE_MIN_LENGTH = 1;
33
+ /** Maximum code-point length for bindingNonce. */
34
+ export const BINDING_NONCE_MAX_LENGTH = 512;
35
+ /**
36
+ * Maximum compact-JSON encoded bytes for bindingNonce.
37
+ * Worst case: every code point is a 6-byte escape (\uXXXX) → 6 * 512 + 2 quotes.
38
+ */
39
+ export const BINDING_NONCE_MAX_ENCODED_BYTES = 3074;
40
+ // ---------------------------------------------------------------------------
41
+ // Validators
42
+ // ---------------------------------------------------------------------------
43
+ /**
44
+ * Validate a string as a conformant sha512 SRI package digest.
45
+ * Checks exact length (95) and pattern match.
46
+ */
47
+ export function validatePackageDigest(value) {
48
+ if (value.length !== PACKAGE_DIGEST_LENGTH)
49
+ return false;
50
+ return PACKAGE_DIGEST_PATTERN.test(value);
51
+ }
52
+ /**
53
+ * Validate a string as a conformant binding nonce.
54
+ * Checks code-point count is within [1, 512].
55
+ *
56
+ * Note: uses spread to count code points (not .length, which counts
57
+ * UTF-16 code units and misreports surrogate pairs).
58
+ */
59
+ export function validateBindingNonce(value) {
60
+ // Fast path: empty string
61
+ if (value.length === 0)
62
+ return false;
63
+ // Fast path: if byte length <= max, code-point count <= max
64
+ if (value.length <= BINDING_NONCE_MAX_LENGTH)
65
+ return true;
66
+ // Slow path: count actual code points for strings with surrogates
67
+ const codePointCount = [...value].length;
68
+ return codePointCount >= BINDING_NONCE_MIN_LENGTH && codePointCount <= BINDING_NONCE_MAX_LENGTH;
69
+ }
70
+ //# sourceMappingURL=handshake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handshake.js","sourceRoot":"","sources":["../../src/wire/handshake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,8EAA8E;AAC9E,yCAAyC;AACzC,8EAA8E;AAE9E,qDAAqD;AACrD,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAW,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,oCAAoC,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAW,CAAC;AAExD,8EAA8E;AAC9E,qCAAqC;AACrC,8EAA8E;AAE9E,kDAAkD;AAClD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAU,CAAC;AAEnD,kDAAkD;AAClD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAY,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAa,CAAC;AAqE7D,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAa;IACjD,IAAI,KAAK,CAAC,MAAM,KAAK,qBAAqB;QAAE,OAAO,KAAK,CAAC;IACzD,OAAO,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,0BAA0B;IAC1B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,4DAA4D;IAC5D,IAAI,KAAK,CAAC,MAAM,IAAI,wBAAwB;QAAE,OAAO,IAAI,CAAC;IAC1D,kEAAkE;IAClE,MAAM,cAAc,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC;IACzC,OAAO,cAAc,IAAI,wBAAwB,IAAI,cAAc,IAAI,wBAAwB,CAAC;AAClG,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Wire protocol module barrel export.
3
+ *
4
+ * Re-exports all wire-protocol types, constants, validators, and registry
5
+ * entries mechanized from the #1165 frozen shape (rev11).
6
+ *
7
+ * This module defines nothing new — it is a pure re-export surface.
8
+ */
9
+ export { MAX_FRAME_BYTES, WIRE_VERSION, CONTRACT_VERSION, JSONRPC_VERSION, MAX_ELEMENT_PAYLOAD_BYTES, MAX_TOTAL_PAYLOAD_BYTES, MAX_ELEMENTS_PER_OPERATION, MAX_ELEMENTS_PER_MESSAGE, MAX_WHISPER_TARGETS, } from './constants.js';
10
+ export type { RequestId } from './request-id.js';
11
+ export { REQUEST_ID_PATTERN, REQUEST_ID_MIN_LENGTH, REQUEST_ID_MAX_LENGTH, REQUEST_ID_MIN_ENCODED_BYTES, REQUEST_ID_MAX_ENCODED_BYTES, validateRequestId, isRequestIdShaped, } from './request-id.js';
12
+ export { WIRE_UINT53_MAX, WIRE_UINT53_RAW_PATTERN, WIRE_UINT53_MAX_RAW_LENGTH, isWireUInt53, isCanonicalUInt53Token, } from './wire-uint53.js';
13
+ export { HANDSHAKE_REJECTED_CODE, DELIVERY_REJECTED_CODE, DOMAIN_ERROR_CODE, DEADLINE_EXPIRED_CODE, SNAPSHOT_UNAVAILABLE_CODE, HANDSHAKE_REJECTED_MESSAGE, DELIVERY_REJECTED_MESSAGE, DOMAIN_ERROR_MESSAGE, DEADLINE_EXPIRED_MESSAGE, SNAPSHOT_UNAVAILABLE_MESSAGE, PARSE_ERROR_CODE, INVALID_REQUEST_CODE, METHOD_NOT_FOUND_CODE, INVALID_PARAMS_CODE, INTERNAL_ERROR_CODE, PARSE_ERROR_MESSAGE, INVALID_REQUEST_MESSAGE, METHOD_NOT_FOUND_MESSAGE, INVALID_PARAMS_MESSAGE, INTERNAL_ERROR_MESSAGE, ERROR_CODE_TO_MESSAGE, HANDSHAKE_REJECT_REASONS, DELIVERY_REJECT_REASONS, SNAPSHOT_UNAVAILABLE_REASONS, APPLICATION_ERROR_CODES, STANDARD_ERROR_CODES, ALL_ERROR_CODES, } from './errors.js';
14
+ export type { HandshakeRejectReason, DeliveryRejectReason, SnapshotUnavailableReason, MessagingErrorCode, HandshakeRejectedError, DeliveryRejectedError, DomainError, DeadlineExpiredError, SnapshotUnavailableError, ApplicationWireError, ParseError, InvalidRequestError, MethodNotFoundError, InvalidParamsError, InternalError, StandardWireError, WireError, } from './errors.js';
15
+ export { DISPOSITION_CLASSES, DISPOSITION_TABLE, CLOSE_CLASSES, RESPOND_CLASSES, ACCEPT_CLASSES, } from './disposition.js';
16
+ export type { DispositionClass, DispositionOutcome, DispositionEntry, } from './disposition.js';
17
+ export { PACKAGE_DIGEST_LENGTH, PACKAGE_DIGEST_PATTERN, PACKAGE_DIGEST_ENCODED_BYTES, BINDING_NONCE_MIN_LENGTH, BINDING_NONCE_MAX_LENGTH, BINDING_NONCE_MAX_ENCODED_BYTES, validatePackageDigest, validateBindingNonce, } from './handshake.js';
18
+ export type { CandidateHello, SessionBinding, BrokerReadyParams, } from './handshake.js';
19
+ export { MAX_GRANT_ITEMS, validateEffectiveGrants, VALID_CAPABILITIES, } from './grants.js';
20
+ export type { GrantSnapshot } from './grants.js';
21
+ export type { CallMeta, WireSuccessResponse, HandshakeRejectedEnvelope, DeliveryRejectedEnvelope, DomainErrorEnvelope, DeadlineExpiredEnvelope, SnapshotUnavailableEnvelope, ParseErrorEnvelope, InvalidRequestNullIdEnvelope, InvalidRequestValidIdEnvelope, MethodNotFoundEnvelope, InvalidParamsEnvelope, InternalErrorEnvelope, ClosedWireErrorResponse, WireErrorResponse, WireResponse, } from './envelope.js';
22
+ export { WIRE_METHOD_NAMES, WIRE_METHOD_REGISTRY, WIRE_METHOD_COUNT, PLUGIN_TO_HOST_METHODS, HOST_TO_PLUGIN_METHODS, NOTIFICATION_METHODS, CLOSED_LEAF_ROWS, RESERVED_LEAF_ROWS, getRegistryRow, isWireMethod, getMethodGrant, } from './registry.js';
23
+ export type { MethodDirection, GrantRequirement, LeafClosureStatus, RegistryRow, WireMethodName, } from './registry.js';
24
+ export type { SubscribeInput, SubscribeResult, MessagingAckRequest, MessagingAckResult, GrantsChangedInput, PingInput, PingResult, DrainInput, DrainResult, HelloInput, HelloResult, ReadyInput, ReadyResult, SendInput, SendResult, AppendInput, AppendResult, ReadInput, ReadResult, SnapshotInput, SnapshotResult, DeliverInput, DeliverResult, } from './row-shapes.js';
25
+ export { SUBSCRIBE_HANDLE_MIN_LENGTH, SUBSCRIBE_HANDLE_MAX_LENGTH, SUBSCRIBE_HANDLE_MAX_ENCODED_BYTES, SUBSCRIBE_SUBSCRIPTION_ID_MIN_LENGTH, SUBSCRIBE_SUBSCRIPTION_ID_MAX_LENGTH, SUBSCRIBE_SUBSCRIPTION_ID_MAX_ENCODED_BYTES, ACK_SUBSCRIPTION_ID_MIN_LENGTH, ACK_SUBSCRIPTION_ID_MAX_LENGTH, ACK_SUBSCRIPTION_ID_MAX_ENCODED_BYTES, ACK_TOKEN_MIN_LENGTH, ACK_TOKEN_MAX_LENGTH, ACK_TOKEN_MAX_ENCODED_BYTES, PING_NONCE_MIN_LENGTH, PING_NONCE_MAX_LENGTH, PING_NONCE_MAX_ENCODED_BYTES, } from './row-shapes.js';
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,EAC5B,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAEL,uBAAuB,E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EACR,mBAAmB,EAEnB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,2BAA2B,EAC3B,kBAAkB,EAClB,4BAA4B,EAC5B,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,GACb,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,cAAc,GACf,MAAM,eAAe,CAAC;AAGvB,YAAY,EAEV,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EAEX,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,aAAa,EACb,cAAc,EACd,YAAY,EACZ,aAAa,GACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEL,2BAA2B,EAC3B,2BAA2B,EAC3B,kCAAkC,EAClC,oCAAoC,EACpC,oCAAoC,EACpC,2CAA2C,EAE3C,8BAA8B,EAC9B,8BAA8B,EAC9B,qCAAqC,EACrC,oBAAoB,EACpB,oBAAoB,EACpB,2BAA2B,EAE3B,qBAAqB,EACrB,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Wire protocol module barrel export.
3
+ *
4
+ * Re-exports all wire-protocol types, constants, validators, and registry
5
+ * entries mechanized from the #1165 frozen shape (rev11).
6
+ *
7
+ * This module defines nothing new — it is a pure re-export surface.
8
+ */
9
+ // Framing constants
10
+ export { MAX_FRAME_BYTES, WIRE_VERSION, CONTRACT_VERSION, JSONRPC_VERSION, MAX_ELEMENT_PAYLOAD_BYTES, MAX_TOTAL_PAYLOAD_BYTES, MAX_ELEMENTS_PER_OPERATION, MAX_ELEMENTS_PER_MESSAGE, MAX_WHISPER_TARGETS, } from './constants.js';
11
+ export { REQUEST_ID_PATTERN, REQUEST_ID_MIN_LENGTH, REQUEST_ID_MAX_LENGTH, REQUEST_ID_MIN_ENCODED_BYTES, REQUEST_ID_MAX_ENCODED_BYTES, validateRequestId, isRequestIdShaped, } from './request-id.js';
12
+ // WireUInt53 — numeric profile
13
+ export { WIRE_UINT53_MAX, WIRE_UINT53_RAW_PATTERN, WIRE_UINT53_MAX_RAW_LENGTH, isWireUInt53, isCanonicalUInt53Token, } from './wire-uint53.js';
14
+ // Error codes, messages, reason taxonomies, and error variant types
15
+ export {
16
+ // Application error codes
17
+ HANDSHAKE_REJECTED_CODE, DELIVERY_REJECTED_CODE, DOMAIN_ERROR_CODE, DEADLINE_EXPIRED_CODE, SNAPSHOT_UNAVAILABLE_CODE,
18
+ // Application error messages
19
+ HANDSHAKE_REJECTED_MESSAGE, DELIVERY_REJECTED_MESSAGE, DOMAIN_ERROR_MESSAGE, DEADLINE_EXPIRED_MESSAGE, SNAPSHOT_UNAVAILABLE_MESSAGE,
20
+ // Standard error codes
21
+ PARSE_ERROR_CODE, INVALID_REQUEST_CODE, METHOD_NOT_FOUND_CODE, INVALID_PARAMS_CODE, INTERNAL_ERROR_CODE,
22
+ // Standard error messages
23
+ PARSE_ERROR_MESSAGE, INVALID_REQUEST_MESSAGE, METHOD_NOT_FOUND_MESSAGE, INVALID_PARAMS_MESSAGE, INTERNAL_ERROR_MESSAGE,
24
+ // Code-to-message mapping
25
+ ERROR_CODE_TO_MESSAGE,
26
+ // Reject-reason taxonomies
27
+ HANDSHAKE_REJECT_REASONS, DELIVERY_REJECT_REASONS, SNAPSHOT_UNAVAILABLE_REASONS,
28
+ // Collected code arrays
29
+ APPLICATION_ERROR_CODES, STANDARD_ERROR_CODES, ALL_ERROR_CODES, } from './errors.js';
30
+ // Pre-dispatch disposition table
31
+ export { DISPOSITION_CLASSES, DISPOSITION_TABLE, CLOSE_CLASSES, RESPOND_CLASSES, ACCEPT_CLASSES, } from './disposition.js';
32
+ // Handshake types + validators
33
+ export { PACKAGE_DIGEST_LENGTH, PACKAGE_DIGEST_PATTERN, PACKAGE_DIGEST_ENCODED_BYTES, BINDING_NONCE_MIN_LENGTH, BINDING_NONCE_MAX_LENGTH, BINDING_NONCE_MAX_ENCODED_BYTES, validatePackageDigest, validateBindingNonce, } from './handshake.js';
34
+ // Grant snapshot
35
+ export { MAX_GRANT_ITEMS, validateEffectiveGrants, VALID_CAPABILITIES, } from './grants.js';
36
+ // 12-row method registry
37
+ export { WIRE_METHOD_NAMES, WIRE_METHOD_REGISTRY, WIRE_METHOD_COUNT, PLUGIN_TO_HOST_METHODS, HOST_TO_PLUGIN_METHODS, NOTIFICATION_METHODS, CLOSED_LEAF_ROWS, RESERVED_LEAF_ROWS, getRegistryRow, isWireMethod, getMethodGrant, } from './registry.js';
38
+ export {
39
+ // Row 5 bounds
40
+ SUBSCRIBE_HANDLE_MIN_LENGTH, SUBSCRIBE_HANDLE_MAX_LENGTH, SUBSCRIBE_HANDLE_MAX_ENCODED_BYTES, SUBSCRIBE_SUBSCRIPTION_ID_MIN_LENGTH, SUBSCRIBE_SUBSCRIPTION_ID_MAX_LENGTH, SUBSCRIBE_SUBSCRIPTION_ID_MAX_ENCODED_BYTES,
41
+ // Row 7 bounds
42
+ ACK_SUBSCRIPTION_ID_MIN_LENGTH, ACK_SUBSCRIPTION_ID_MAX_LENGTH, ACK_SUBSCRIPTION_ID_MAX_ENCODED_BYTES, ACK_TOKEN_MIN_LENGTH, ACK_TOKEN_MAX_LENGTH, ACK_TOKEN_MAX_ENCODED_BYTES,
43
+ // Row 11 bounds
44
+ PING_NONCE_MIN_LENGTH, PING_NONCE_MAX_LENGTH, PING_NONCE_MAX_ENCODED_BYTES, } from './row-shapes.js';
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oBAAoB;AACpB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,EAC5B,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,+BAA+B;AAC/B,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,oEAAoE;AACpE,OAAO;AACL,0BAA0B;AAC1B,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB;AACzB,6BAA6B;AAC7B,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,4BAA4B;AAC5B,uBAAuB;AACvB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB;AACnB,0BAA0B;AAC1B,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB;AACtB,0BAA0B;AAC1B,qBAAqB;AACrB,2BAA2B;AAC3B,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B;AAC5B,wBAAwB;AACxB,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,GAChB,MAAM,aAAa,CAAC;AAyBrB,iCAAiC;AACjC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,cAAc,GACf,MAAM,kBAAkB,CAAC;AAQ1B,+BAA+B;AAC/B,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,+BAA+B,EAC/B,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAQxB,iBAAiB;AACjB,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAkCrB,yBAAyB;AACzB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,eAAe,CAAC;AAuCvB,OAAO;AACL,eAAe;AACf,2BAA2B,EAC3B,2BAA2B,EAC3B,kCAAkC,EAClC,oCAAoC,EACpC,oCAAoC,EACpC,2CAA2C;AAC3C,eAAe;AACf,8BAA8B,EAC9B,8BAA8B,EAC9B,qCAAqC,EACrC,oBAAoB,EACpB,oBAAoB,EACpB,2BAA2B;AAC3B,gBAAgB;AAChB,qBAAqB,EACrB,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * 12-row production method registry.
3
+ * Mechanized verbatim from the #1165 frozen shape (rev11).
4
+ *
5
+ * Every row carries machine-readable metadata:
6
+ * - method name, direction, grant requirement
7
+ * - notification flag (only row 10)
8
+ * - ready status (ALL false — reservation-only lifecycle, D0 = A)
9
+ * - leaf closure status and which matrix entries cause reservation
10
+ * - settlement key source
11
+ *
12
+ * A row may be marked `ready` only when its matrix entries all reach
13
+ * CLOSED + generated byte proofs + N/N+1 conformance pass.
14
+ * This module defines nothing new.
15
+ *
16
+ * ## Reserved matrix entry in-flight coordinates
17
+ *
18
+ * M7 — future-write admission half in review at clowder-ai#1185
19
+ * (exact 05ad80c6, gate PASS, Fable APPROVE current HEAD);
20
+ * stored-data attestation/migration half outstanding.
21
+ * Affects rows 6, 8, 9. M7 remains RESERVED.
22
+ */
23
+ import type { Capability } from '../generated/contract.generated.js';
24
+ /** Message direction on the wire. */
25
+ export type MethodDirection = 'plugin-to-host' | 'host-to-plugin';
26
+ /** Grant required to invoke a method, or protocol-intrinsic for handshake/lifecycle. */
27
+ export type GrantRequirement = Capability | 'protocol-intrinsic';
28
+ /** Leaf closure status from the variable-width leaf matrix. */
29
+ export type LeafClosureStatus = 'CLOSED' | 'RESERVED';
30
+ /**
31
+ * A single row of the production method registry.
32
+ * ready is typed as `false` — the reservation-only lifecycle means
33
+ * every row is unpublished and unadvertised.
34
+ */
35
+ export interface RegistryRow {
36
+ readonly rowNumber: number;
37
+ readonly method: string;
38
+ readonly direction: MethodDirection;
39
+ readonly grant: GrantRequirement;
40
+ readonly isNotification: boolean;
41
+ readonly ready: false;
42
+ readonly leafClosure: LeafClosureStatus;
43
+ readonly reservedEntries: readonly string[];
44
+ readonly settlementKeySource: string;
45
+ }
46
+ /**
47
+ * The exact 12 production method names, in registry order.
48
+ * No production method exists for fixture setup/observe, grant presets,
49
+ * revocation, permission-matrix inspection, or replay deletion.
50
+ */
51
+ export declare const WIRE_METHOD_NAMES: readonly ["broker.hello", "broker.ready", "messaging.send", "messaging.appendElements", "messaging.subscribe", "messaging.read", "messaging.ack", "messaging.snapshot", "host.messaging.deliver", "host.grants.changed", "host.lifecycle.ping", "host.lifecycle.drain"];
52
+ /** Union of all 12 production method names. */
53
+ export type WireMethodName = (typeof WIRE_METHOD_NAMES)[number];
54
+ /**
55
+ * Machine-readable registry of all 12 production methods.
56
+ *
57
+ * Every value traces to the #1165 frozen shape. Row metadata includes
58
+ * the exact matrix entry IDs that block leaf closure. Settlement key
59
+ * sources follow the canonical per-row specification.
60
+ *
61
+ * All 12 rows have ready=false (reservation-only lifecycle, D0 = A).
62
+ */
63
+ export declare const WIRE_METHOD_REGISTRY: Readonly<Record<WireMethodName, RegistryRow>>;
64
+ /** Plugin-to-host method names. */
65
+ export declare const PLUGIN_TO_HOST_METHODS: readonly WireMethodName[];
66
+ /** Host-to-plugin method names. */
67
+ export declare const HOST_TO_PLUGIN_METHODS: readonly WireMethodName[];
68
+ /** Notification method names (only row 10 in v0). */
69
+ export declare const NOTIFICATION_METHODS: readonly WireMethodName[];
70
+ /** Method names with CLOSED leaf shapes (frozen). */
71
+ export declare const CLOSED_LEAF_ROWS: readonly WireMethodName[];
72
+ /** Method names with RESERVED leaf shapes (may change). */
73
+ export declare const RESERVED_LEAF_ROWS: readonly WireMethodName[];
74
+ /** Total number of production methods. */
75
+ export declare const WIRE_METHOD_COUNT: 12;
76
+ /**
77
+ * Look up a registry row by method name.
78
+ * Returns undefined for unknown method names.
79
+ */
80
+ export declare function getRegistryRow(method: string): RegistryRow | undefined;
81
+ /**
82
+ * Check whether a method name is a valid wire method.
83
+ */
84
+ export declare function isWireMethod(method: string): method is WireMethodName;
85
+ /**
86
+ * Get the grant requirement for a method.
87
+ * Returns undefined for unknown method names.
88
+ */
89
+ export declare function getMethodGrant(method: string): GrantRequirement | undefined;
90
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/wire/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAMrE,qCAAqC;AACrC,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAElE,wFAAwF;AACxF,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,oBAAoB,CAAC;AAEjE,+DAA+D;AAC/D,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAMtD;;;;GAIG;AACH,MAAM,WAAW,WA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CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,cAAc,CAErE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAE3E"}
@@ -0,0 +1,232 @@
1
+ /**
2
+ * 12-row production method registry.
3
+ * Mechanized verbatim from the #1165 frozen shape (rev11).
4
+ *
5
+ * Every row carries machine-readable metadata:
6
+ * - method name, direction, grant requirement
7
+ * - notification flag (only row 10)
8
+ * - ready status (ALL false — reservation-only lifecycle, D0 = A)
9
+ * - leaf closure status and which matrix entries cause reservation
10
+ * - settlement key source
11
+ *
12
+ * A row may be marked `ready` only when its matrix entries all reach
13
+ * CLOSED + generated byte proofs + N/N+1 conformance pass.
14
+ * This module defines nothing new.
15
+ *
16
+ * ## Reserved matrix entry in-flight coordinates
17
+ *
18
+ * M7 — future-write admission half in review at clowder-ai#1185
19
+ * (exact 05ad80c6, gate PASS, Fable APPROVE current HEAD);
20
+ * stored-data attestation/migration half outstanding.
21
+ * Affects rows 6, 8, 9. M7 remains RESERVED.
22
+ */
23
+ // ---------------------------------------------------------------------------
24
+ // Method name enum
25
+ // ---------------------------------------------------------------------------
26
+ /**
27
+ * The exact 12 production method names, in registry order.
28
+ * No production method exists for fixture setup/observe, grant presets,
29
+ * revocation, permission-matrix inspection, or replay deletion.
30
+ */
31
+ export const WIRE_METHOD_NAMES = [
32
+ 'broker.hello',
33
+ 'broker.ready',
34
+ 'messaging.send',
35
+ 'messaging.appendElements',
36
+ 'messaging.subscribe',
37
+ 'messaging.read',
38
+ 'messaging.ack',
39
+ 'messaging.snapshot',
40
+ 'host.messaging.deliver',
41
+ 'host.grants.changed',
42
+ 'host.lifecycle.ping',
43
+ 'host.lifecycle.drain',
44
+ ];
45
+ // ---------------------------------------------------------------------------
46
+ // The complete registry (frozen)
47
+ // ---------------------------------------------------------------------------
48
+ /**
49
+ * Machine-readable registry of all 12 production methods.
50
+ *
51
+ * Every value traces to the #1165 frozen shape. Row metadata includes
52
+ * the exact matrix entry IDs that block leaf closure. Settlement key
53
+ * sources follow the canonical per-row specification.
54
+ *
55
+ * All 12 rows have ready=false (reservation-only lifecycle, D0 = A).
56
+ */
57
+ export const WIRE_METHOD_REGISTRY = {
58
+ 'broker.hello': {
59
+ rowNumber: 1,
60
+ method: 'broker.hello',
61
+ direction: 'plugin-to-host',
62
+ grant: 'protocol-intrinsic',
63
+ isNotification: false,
64
+ ready: false,
65
+ leafClosure: 'RESERVED',
66
+ reservedEntries: ['H1', 'H3', 'H4', 'H5', 'H6'],
67
+ settlementKeySource: '—',
68
+ },
69
+ // Row 2 own entries (H9 via W0/W1/W2/W3) are all CLOSED.
70
+ // RESERVED because activation cannot be advertised without a closed
71
+ // row-1 SessionBinding — H1/H3/H4/H5/H6 block through protocol dependency.
72
+ 'broker.ready': {
73
+ rowNumber: 2,
74
+ method: 'broker.ready',
75
+ direction: 'plugin-to-host',
76
+ grant: 'protocol-intrinsic',
77
+ isNotification: false,
78
+ ready: false,
79
+ leafClosure: 'RESERVED',
80
+ reservedEntries: ['H1', 'H3', 'H4', 'H5', 'H6'],
81
+ settlementKeySource: '—',
82
+ },
83
+ 'messaging.send': {
84
+ rowNumber: 3,
85
+ method: 'messaging.send',
86
+ direction: 'plugin-to-host',
87
+ grant: 'messaging.send',
88
+ isNotification: false,
89
+ ready: false,
90
+ leafClosure: 'RESERVED',
91
+ reservedEntries: ['M1', 'M2', 'M5', 'I1'],
92
+ settlementKeySource: 'input.idempotencyKey',
93
+ },
94
+ 'messaging.appendElements': {
95
+ rowNumber: 4,
96
+ method: 'messaging.appendElements',
97
+ direction: 'plugin-to-host',
98
+ grant: 'messaging.appendElements',
99
+ isNotification: false,
100
+ ready: false,
101
+ leafClosure: 'RESERVED',
102
+ reservedEntries: ['M1', 'M2', 'M5', 'I1'],
103
+ settlementKeySource: '(Host-resolved messageId from input.handle, input.operationId)',
104
+ },
105
+ 'messaging.subscribe': {
106
+ rowNumber: 5,
107
+ method: 'messaging.subscribe',
108
+ direction: 'plugin-to-host',
109
+ grant: 'message.event.subscribe',
110
+ isNotification: false,
111
+ ready: false,
112
+ leafClosure: 'CLOSED',
113
+ reservedEntries: [],
114
+ settlementKeySource: 'Host-resolved input.handle identity (K-1 create-or-get authoritative)',
115
+ },
116
+ 'messaging.read': {
117
+ rowNumber: 6,
118
+ method: 'messaging.read',
119
+ direction: 'plugin-to-host',
120
+ grant: 'message.event.subscribe',
121
+ isNotification: false,
122
+ ready: false,
123
+ leafClosure: 'RESERVED',
124
+ reservedEntries: ['M1', 'M2', 'M5', 'M6', 'M7', 'I1'],
125
+ settlementKeySource: 'none (at-least-once; bounded page assembly)',
126
+ },
127
+ 'messaging.ack': {
128
+ rowNumber: 7,
129
+ method: 'messaging.ack',
130
+ direction: 'plugin-to-host',
131
+ grant: 'message.event.subscribe',
132
+ isNotification: false,
133
+ ready: false,
134
+ leafClosure: 'CLOSED',
135
+ reservedEntries: [],
136
+ settlementKeySource: '(input.subscriptionId, input.ackToken)',
137
+ },
138
+ 'messaging.snapshot': {
139
+ rowNumber: 8,
140
+ method: 'messaging.snapshot',
141
+ direction: 'plugin-to-host',
142
+ grant: 'message.event.subscribe',
143
+ isNotification: false,
144
+ ready: false,
145
+ leafClosure: 'RESERVED',
146
+ reservedEntries: ['M1', 'M2', 'M5', 'M7', 'I1'],
147
+ settlementKeySource: 'none for traversal; completion = D1b Host entitlement through messaging.ack',
148
+ },
149
+ 'host.messaging.deliver': {
150
+ rowNumber: 9,
151
+ method: 'host.messaging.deliver',
152
+ direction: 'host-to-plugin',
153
+ grant: 'onMessage',
154
+ isNotification: false,
155
+ ready: false,
156
+ leafClosure: 'RESERVED',
157
+ reservedEntries: ['M1', 'M2', 'M5', 'M7', 'I1'],
158
+ settlementKeySource: 'input.deliveryId (Host-side authoritative)',
159
+ },
160
+ 'host.grants.changed': {
161
+ rowNumber: 10,
162
+ method: 'host.grants.changed',
163
+ direction: 'host-to-plugin',
164
+ grant: 'protocol-intrinsic',
165
+ isNotification: true,
166
+ ready: false,
167
+ leafClosure: 'CLOSED',
168
+ reservedEntries: [],
169
+ settlementKeySource: '(grantRevision monotonic)',
170
+ },
171
+ 'host.lifecycle.ping': {
172
+ rowNumber: 11,
173
+ method: 'host.lifecycle.ping',
174
+ direction: 'host-to-plugin',
175
+ grant: 'protocol-intrinsic',
176
+ isNotification: false,
177
+ ready: false,
178
+ leafClosure: 'CLOSED',
179
+ reservedEntries: [],
180
+ settlementKeySource: '—',
181
+ },
182
+ 'host.lifecycle.drain': {
183
+ rowNumber: 12,
184
+ method: 'host.lifecycle.drain',
185
+ direction: 'host-to-plugin',
186
+ grant: 'protocol-intrinsic',
187
+ isNotification: false,
188
+ ready: false,
189
+ leafClosure: 'CLOSED',
190
+ reservedEntries: [],
191
+ settlementKeySource: '—',
192
+ },
193
+ };
194
+ // ---------------------------------------------------------------------------
195
+ // Derived helpers
196
+ // ---------------------------------------------------------------------------
197
+ /** Plugin-to-host method names. */
198
+ export const PLUGIN_TO_HOST_METHODS = WIRE_METHOD_NAMES.filter(m => WIRE_METHOD_REGISTRY[m].direction === 'plugin-to-host');
199
+ /** Host-to-plugin method names. */
200
+ export const HOST_TO_PLUGIN_METHODS = WIRE_METHOD_NAMES.filter(m => WIRE_METHOD_REGISTRY[m].direction === 'host-to-plugin');
201
+ /** Notification method names (only row 10 in v0). */
202
+ export const NOTIFICATION_METHODS = WIRE_METHOD_NAMES.filter(m => WIRE_METHOD_REGISTRY[m].isNotification);
203
+ /** Method names with CLOSED leaf shapes (frozen). */
204
+ export const CLOSED_LEAF_ROWS = WIRE_METHOD_NAMES.filter(m => WIRE_METHOD_REGISTRY[m].leafClosure === 'CLOSED');
205
+ /** Method names with RESERVED leaf shapes (may change). */
206
+ export const RESERVED_LEAF_ROWS = WIRE_METHOD_NAMES.filter(m => WIRE_METHOD_REGISTRY[m].leafClosure === 'RESERVED');
207
+ /** Total number of production methods. */
208
+ export const WIRE_METHOD_COUNT = 12;
209
+ // ---------------------------------------------------------------------------
210
+ // Lookup helpers
211
+ // ---------------------------------------------------------------------------
212
+ /**
213
+ * Look up a registry row by method name.
214
+ * Returns undefined for unknown method names.
215
+ */
216
+ export function getRegistryRow(method) {
217
+ return WIRE_METHOD_REGISTRY[method];
218
+ }
219
+ /**
220
+ * Check whether a method name is a valid wire method.
221
+ */
222
+ export function isWireMethod(method) {
223
+ return WIRE_METHOD_NAMES.includes(method);
224
+ }
225
+ /**
226
+ * Get the grant requirement for a method.
227
+ * Returns undefined for unknown method names.
228
+ */
229
+ export function getMethodGrant(method) {
230
+ return getRegistryRow(method)?.grant;
231
+ }
232
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/wire/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAsCH,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,0BAA0B;IAC1B,qBAAqB;IACrB,gBAAgB;IAChB,eAAe;IACf,oBAAoB;IACpB,wBAAwB;IACxB,qBAAqB;IACrB,qBAAqB;IACrB,sBAAsB;CACd,CAAC;AAKX,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkD;IACjF,cAAc,EAAE;QACd,SAAS,EAAE,CAAC;QACZ,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,gBAAgB;QAC3B,KAAK,EAAE,oBAAoB;QAC3B,cAAc,EAAE,KAAK;QACrB,KAAK,EAAE,KAAK;QACZ,WAAW,EAAE,UAAU;QACvB,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QAC/C,mBAAmB,EAAE,GAAG;KACzB;IACD,y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oB,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;AAExE,qDAAqD;AACrD,MAAM,CAAC,MAAM,gBAAgB,GAC3B,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC;AAElF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,kBAAkB,GAC7B,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,UAAU,CAAC,CAAC;AAEpF,0CAA0C;AAC1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAW,CAAC;AAE7C,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAQ,oBAAoD,CAAC,MAAM,CAAC,CAAC;AACvE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,OAAQ,iBAAuC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACnE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,cAAc,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;AACvC,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * RequestId — wire-protocol request correlation identifier.
3
+ * Mechanized verbatim from #1165 maintainer R4-intake (5005069362).
4
+ *
5
+ * String-only, ASCII, attempt correlation only (not authoritative for settlement).
6
+ * Response echo must be byte-for-byte equal.
7
+ */
8
+ /** Branded RequestId type. */
9
+ export type RequestId = string & {
10
+ readonly __brand: 'RequestId';
11
+ };
12
+ /** ASCII grammar pattern for RequestId values. */
13
+ export declare const REQUEST_ID_PATTERN: RegExp;
14
+ /** Minimum length in characters/bytes (ASCII). */
15
+ export declare const REQUEST_ID_MIN_LENGTH: 1;
16
+ /** Maximum length in characters/bytes (ASCII). */
17
+ export declare const REQUEST_ID_MAX_LENGTH: 128;
18
+ /** Minimum compact-JSON encoded bytes (including quotes). */
19
+ export declare const REQUEST_ID_MIN_ENCODED_BYTES: 3;
20
+ /** Maximum compact-JSON encoded bytes (including quotes). */
21
+ export declare const REQUEST_ID_MAX_ENCODED_BYTES: 130;
22
+ /**
23
+ * Validate a value as a RequestId.
24
+ * Returns the validated RequestId or null if invalid.
25
+ * Does NOT check in-flight uniqueness (that is a runtime concern).
26
+ */
27
+ export declare function validateRequestId(value: unknown): RequestId | null;
28
+ /**
29
+ * Check if a raw JSON token could be a RequestId.
30
+ * Used in pre-dispatch: detects string tokens with valid grammar.
31
+ * Non-string types (numeric, null, boolean, object, array) return false.
32
+ */
33
+ export declare function isRequestIdShaped(value: unknown): value is string;
34
+ //# sourceMappingURL=request-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-id.d.ts","sourceRoot":"","sources":["../../src/wire/request-id.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8BAA8B;AAC9B,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC;AAEnE,kDAAkD;AAClD,eAAO,MAAM,kBAAkB,QAAwC,CAAC;AAExE,kDAAkD;AAClD,eAAO,MAAM,qBAAqB,EAAG,CAAU,CAAC;AAEhD,kDAAkD;AAClD,eAAO,MAAM,qBAAqB,EAAG,GAAY,CAAC;AAElD,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,EAAG,CAAU,CAAC;AAEvD,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,EAAG,GAAY,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAKlE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEjE"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * RequestId — wire-protocol request correlation identifier.
3
+ * Mechanized verbatim from #1165 maintainer R4-intake (5005069362).
4
+ *
5
+ * String-only, ASCII, attempt correlation only (not authoritative for settlement).
6
+ * Response echo must be byte-for-byte equal.
7
+ */
8
+ /** ASCII grammar pattern for RequestId values. */
9
+ export const REQUEST_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
10
+ /** Minimum length in characters/bytes (ASCII). */
11
+ export const REQUEST_ID_MIN_LENGTH = 1;
12
+ /** Maximum length in characters/bytes (ASCII). */
13
+ export const REQUEST_ID_MAX_LENGTH = 128;
14
+ /** Minimum compact-JSON encoded bytes (including quotes). */
15
+ export const REQUEST_ID_MIN_ENCODED_BYTES = 3; // 1 + 2 quotes
16
+ /** Maximum compact-JSON encoded bytes (including quotes). */
17
+ export const REQUEST_ID_MAX_ENCODED_BYTES = 130; // 128 + 2 quotes
18
+ /**
19
+ * Validate a value as a RequestId.
20
+ * Returns the validated RequestId or null if invalid.
21
+ * Does NOT check in-flight uniqueness (that is a runtime concern).
22
+ */
23
+ export function validateRequestId(value) {
24
+ if (typeof value !== 'string')
25
+ return null;
26
+ if (value.length < REQUEST_ID_MIN_LENGTH || value.length > REQUEST_ID_MAX_LENGTH)
27
+ return null;
28
+ if (!REQUEST_ID_PATTERN.test(value))
29
+ return null;
30
+ return value;
31
+ }
32
+ /**
33
+ * Check if a raw JSON token could be a RequestId.
34
+ * Used in pre-dispatch: detects string tokens with valid grammar.
35
+ * Non-string types (numeric, null, boolean, object, array) return false.
36
+ */
37
+ export function isRequestIdShaped(value) {
38
+ return typeof value === 'string';
39
+ }
40
+ //# sourceMappingURL=request-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-id.js","sourceRoot":"","sources":["../../src/wire/request-id.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,kDAAkD;AAClD,MAAM,CAAC,MAAM,kBAAkB,GAAG,qCAAqC,CAAC;AAExE,kDAAkD;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAU,CAAC;AAEhD,kDAAkD;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAY,CAAC;AAElD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAU,CAAC,CAAC,eAAe;AAEvE,6DAA6D;AAC7D,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAY,CAAC,CAAC,iBAAiB;AAE3E;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3C,IAAI,KAAK,CAAC,MAAM,GAAG,qBAAqB,IAAI,KAAK,CAAC,MAAM,GAAG,qBAAqB;QAAE,OAAO,IAAI,CAAC;IAC9F,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACjD,OAAO,KAAkB,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC"}