@7h3/protocol 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/README.md +6 -1317
  2. package/agentAdapter.d.ts +26 -0
  3. package/auditLog.d.ts +54 -0
  4. package/capability.d.ts +67 -0
  5. package/cborCodec.d.ts +34 -0
  6. package/conformanceVectors.d.ts +20 -0
  7. package/encryption.d.ts +85 -0
  8. package/envelopeCbor.d.ts +33 -0
  9. package/frameworkAdapters.d.ts +72 -0
  10. package/gateway.d.ts +53 -0
  11. package/grpcBinding.d.ts +29 -0
  12. package/httpBinding.d.ts +50 -0
  13. package/index.d.ts +39 -0
  14. package/index.js +3662 -0
  15. package/keyInfra.d.ts +64 -0
  16. package/keyRegistry.d.ts +9 -0
  17. package/keyRotation.d.ts +20 -0
  18. package/mcpGateway.d.ts +37 -0
  19. package/mcpTransports.d.ts +62 -0
  20. package/mcpWrapper.d.ts +83 -0
  21. package/otel.d.ts +65 -0
  22. package/package.json +13 -121
  23. package/policyEnforcer.d.ts +50 -0
  24. package/policyTelemetryFeedback.d.ts +11 -0
  25. package/{src/protocol.d.ts → protocol.d.ts} +1 -2
  26. package/protocolAgent.d.ts +58 -0
  27. package/protocolBinary.d.ts +8 -0
  28. package/protocolCapabilities.d.ts +24 -0
  29. package/protocolReplay.d.ts +35 -0
  30. package/protocolTransport.d.ts +73 -0
  31. package/queueBinding.d.ts +43 -0
  32. package/rateLimiter.d.ts +18 -0
  33. package/{src/redisClient.ts → redisClient.d.ts} +25 -75
  34. package/replayStores.d.ts +98 -0
  35. package/revocation.d.ts +71 -0
  36. package/routePolicy.d.ts +30 -0
  37. package/runtimePolicy.d.ts +24 -0
  38. package/runtimePolicyManager.d.ts +15 -0
  39. package/runtimePolicyPresets.d.ts +11 -0
  40. package/signedResponse.d.ts +21 -0
  41. package/stream.d.ts +59 -0
  42. package/telemetry.d.ts +79 -0
  43. package/webhookBinding.d.ts +30 -0
  44. package/wsBinding.d.ts +52 -0
  45. package/.dockerignore +0 -19
  46. package/.github/dependabot.yml +0 -32
  47. package/.github/workflows/ci.yml +0 -31
  48. package/.github/workflows/publish.yml +0 -59
  49. package/.github/workflows/scorecard.yml +0 -37
  50. package/7h3.example.yaml +0 -125
  51. package/CHANGELOG.md +0 -152
  52. package/CONTRIBUTING.md +0 -82
  53. package/Dockerfile +0 -73
  54. package/GOVERNANCE.md +0 -62
  55. package/SECURITY.md +0 -70
  56. package/bench-results/replay-cache-full-1777891033256.json +0 -10
  57. package/bench-results/replay-cache-full-1777896317488.json +0 -10
  58. package/bench-results/replay-cache-full-1777900993184.json +0 -10
  59. package/bench-results/replay-cache-full-1777901019285.json +0 -10
  60. package/bench-results/replay-cache-quick-1777870170126.json +0 -10
  61. package/bench-results/signature-profiles-quick-1775875160079.json +0 -85
  62. package/bench-results/signature-profiles-quick-1775983539716.json +0 -85
  63. package/bench-results/signature-profiles-quick-1776237913190.json +0 -85
  64. package/bench-results/wire-codecs-full-1777891019803.json +0 -93
  65. package/bench-results/wire-codecs-full-1777896260964.json +0 -93
  66. package/bench-results/wire-codecs-full-1777901004247.json +0 -93
  67. package/bench-results/wire-codecs-quick-1775972879056.json +0 -93
  68. package/bench-results/wire-codecs-quick-1775983541111.json +0 -93
  69. package/bench-results/wire-codecs-quick-1776237914299.json +0 -93
  70. package/bench-results/wire-codecs-quick-1777841285236.json +0 -93
  71. package/bench-results/wire-codecs-quick-1777841321772.json +0 -93
  72. package/bench-results/wire-codecs-quick-1777841330408.json +0 -93
  73. package/bench-results/wire-codecs-quick-1777852886082.json +0 -93
  74. package/bench-results/wire-codecs-quick-1777852988773.json +0 -93
  75. package/bench-results/wire-codecs-quick-1777870188095.json +0 -93
  76. package/bench-results/wire-codecs-quick-1777870263918.json +0 -93
  77. package/bench-results/wire-codecs-quick-1777870455034.json +0 -93
  78. package/bench-results/wire-codecs-quick-1778816163081.json +0 -93
  79. package/bench-results/wire-codecs-quick-1778843936130.json +0 -93
  80. package/bin/7h3.ts +0 -406
  81. package/conformance/7h3_v0_1.json +0 -77
  82. package/conformance/7h3_v0_1_binary.json +0 -20
  83. package/conformance/aip_v0_1_binary.json +0 -20
  84. package/docker-compose.yaml +0 -77
  85. package/docs/ADOPTION_PLAN.md +0 -120
  86. package/docs/AGENTS.md +0 -77
  87. package/docs/AIP_RFC_v0.1.md +0 -97
  88. package/docs/AI_DECISION_CARD.md +0 -122
  89. package/docs/AI_RUNTIME_POLICY.json +0 -126
  90. package/docs/AI_RUNTIME_POLICY.yaml +0 -110
  91. package/docs/BACKPRESSURE_TUNING.md +0 -65
  92. package/docs/BENCHMARK_CLAIM_MATRIX.md +0 -42
  93. package/docs/BENCHMARK_REPORT_TEMPLATE.md +0 -169
  94. package/docs/BINARY_CODEC_BENCH.md +0 -23
  95. package/docs/CLEAN_CLONE_RUNBOOK.md +0 -36
  96. package/docs/CLOCK_SKEW_POLICY.md +0 -30
  97. package/docs/DISTRIBUTED_REPLAY.md +0 -142
  98. package/docs/FUZZ_CAMPAIGN.md +0 -121
  99. package/docs/GATEWAY.md +0 -195
  100. package/docs/KEY_MANAGEMENT_POLICY.md +0 -53
  101. package/docs/KEY_REVOCATION.md +0 -69
  102. package/docs/MCP_WRAPPER.md +0 -159
  103. package/docs/MIGRATION_GUIDE.md +0 -40
  104. package/docs/OPERATORS.md +0 -184
  105. package/docs/PERF_REGRESSION_POLICY.md +0 -34
  106. package/docs/PROJECT_EXAMINATION_2026-05-31.md +0 -219
  107. package/docs/RELEASE_BENCHMARK_REPORT_2026-05-15.md +0 -135
  108. package/docs/RELEASE_GATE.md +0 -25
  109. package/docs/RELEASE_NOTES_v0.1.0.md +0 -54
  110. package/docs/SECURITY_REVIEW_2026-06-05.md +0 -165
  111. package/docs/TELEMETRY.md +0 -41
  112. package/docs/THREAT_MODEL.md +0 -89
  113. package/docs/VERSIONING_POLICY.md +0 -30
  114. package/docs/assets/banner-github.png +0 -0
  115. package/docs/assets/banner.png +0 -0
  116. package/docs/assets/banner.svg +0 -123
  117. package/eslint.config.js +0 -15
  118. package/fuzz/ts/harness-decode.ts +0 -136
  119. package/fuzz/ts/harness-verify.ts +0 -121
  120. package/fuzz/ts/run.ts +0 -35
  121. package/mcp-server/README.md +0 -38
  122. package/mcp-server/package-lock.json +0 -1187
  123. package/mcp-server/package.json +0 -35
  124. package/mcp-server/src/index.ts +0 -236
  125. package/mcp-server/tsconfig.json +0 -14
  126. package/scripts/aip-framework-quickstart.ts +0 -110
  127. package/scripts/aip-mcp-gateway.ts +0 -38
  128. package/scripts/aip-mcp-wrap-demo.ts +0 -72
  129. package/scripts/aip-quickstart.ts +0 -60
  130. package/scripts/bench-diff.ts +0 -118
  131. package/scripts/bench-protocol-e2e.ts +0 -937
  132. package/scripts/bench-protocol-openloop.ts +0 -1397
  133. package/scripts/bench-replay-cache.ts +0 -76
  134. package/scripts/bench-signature-profiles.ts +0 -180
  135. package/scripts/bench-wire-codecs.ts +0 -161
  136. package/scripts/build-binary-conformance.ts +0 -36
  137. package/scripts/build-release-dashboard.ts +0 -175
  138. package/scripts/canary-rollout.ts +0 -38
  139. package/scripts/mcpGatewayCli.test.ts +0 -116
  140. package/scripts/prepare-aip-package.ts +0 -88
  141. package/scripts/regen-conformance-sigs.ts +0 -18
  142. package/scripts/release-gate.ts +0 -19
  143. package/scripts/validate-runtime-policy.ts +0 -18
  144. package/sdk/browser/index.test.ts +0 -162
  145. package/sdk/browser/index.ts +0 -257
  146. package/sdk/browser/package.json +0 -13
  147. package/sdk/go/cbor.go +0 -551
  148. package/sdk/go/cbor_test.go +0 -232
  149. package/sdk/go/encryption.go +0 -280
  150. package/sdk/go/encryption_test.go +0 -318
  151. package/sdk/go/go.mod +0 -7
  152. package/sdk/go/go.sum +0 -4
  153. package/sdk/go/http.go +0 -135
  154. package/sdk/go/protocol.go +0 -324
  155. package/sdk/go/protocol_test.go +0 -334
  156. package/sdk/go/replay.go +0 -121
  157. package/sdk/go/replay_test.go +0 -149
  158. package/sdk/go/webhook.go +0 -136
  159. package/sdk/pq/package-lock.json +0 -1358
  160. package/sdk/pq/package.json +0 -42
  161. package/sdk/pq/src/index.test.ts +0 -143
  162. package/sdk/pq/src/index.ts +0 -166
  163. package/sdk/pq/tsconfig.json +0 -14
  164. package/sdk/pq/vitest.config.ts +0 -7
  165. package/sdk/python/README.md +0 -18
  166. package/sdk/python/protocol_7h3/__init__.py +0 -46
  167. package/sdk/python/protocol_7h3/encryption.py +0 -252
  168. package/sdk/python/protocol_7h3/http.py +0 -212
  169. package/sdk/python/protocol_7h3/keys.py +0 -149
  170. package/sdk/python/protocol_7h3/pq.py +0 -244
  171. package/sdk/python/protocol_7h3/protocol.py +0 -525
  172. package/sdk/python/protocol_7h3/queue.py +0 -118
  173. package/sdk/python/protocol_7h3/replay.py +0 -98
  174. package/sdk/python/protocol_7h3/webhook.py +0 -116
  175. package/sdk/python/pyproject.toml +0 -40
  176. package/sdk/python/tests/test_conformance.py +0 -110
  177. package/sdk/python/tests/test_encryption.py +0 -206
  178. package/sdk/python/tests/test_http.py +0 -305
  179. package/sdk/python/tests/test_keys.py +0 -417
  180. package/sdk/python/tests/test_queue.py +0 -120
  181. package/sdk/python/tests/test_webhook.py +0 -345
  182. package/sdk/rust/Cargo.lock +0 -371
  183. package/sdk/rust/Cargo.toml +0 -25
  184. package/sdk/rust/README.md +0 -31
  185. package/sdk/rust/fuzz/Cargo.toml +0 -29
  186. package/sdk/rust/fuzz/fuzz_targets/fuzz_canonicalize.rs +0 -46
  187. package/sdk/rust/fuzz/fuzz_targets/fuzz_decode.rs +0 -11
  188. package/sdk/rust/src/bin/aip_mcp_gateway.rs +0 -59
  189. package/sdk/rust/src/http.rs +0 -145
  190. package/sdk/rust/src/keys.rs +0 -161
  191. package/sdk/rust/src/lib.rs +0 -688
  192. package/sdk/rust/src/queue.rs +0 -79
  193. package/sdk/rust/src/webhook.rs +0 -86
  194. package/sdk/rust/tests/conformance.rs +0 -148
  195. package/sdk/rust/tests/gateway.rs +0 -130
  196. package/sdk/rust/tests/http_webhook_queue.rs +0 -201
  197. package/sdk/rust/tests/keys.rs +0 -189
  198. package/sdk/threshold/index.d.ts +0 -68
  199. package/sdk/threshold/index.d.ts.map +0 -1
  200. package/sdk/threshold/index.js +0 -254
  201. package/sdk/threshold/package-lock.json +0 -1361
  202. package/sdk/threshold/package.json +0 -39
  203. package/sdk/threshold/src/index.d.ts +0 -68
  204. package/sdk/threshold/src/index.d.ts.map +0 -1
  205. package/sdk/threshold/src/index.js +0 -254
  206. package/sdk/threshold/src/index.test.ts +0 -238
  207. package/sdk/threshold/src/index.ts +0 -355
  208. package/sdk/threshold/tsconfig.json +0 -19
  209. package/sdk/threshold/vitest.config.ts +0 -12
  210. package/src/agentAdapter.test.ts +0 -48
  211. package/src/agentAdapter.ts +0 -56
  212. package/src/auditLog.test.ts +0 -145
  213. package/src/auditLog.ts +0 -147
  214. package/src/capability.test.ts +0 -504
  215. package/src/capability.ts +0 -380
  216. package/src/cborCodec.test.ts +0 -263
  217. package/src/cborCodec.ts +0 -339
  218. package/src/conformance.test.ts +0 -136
  219. package/src/conformanceVectors.ts +0 -99
  220. package/src/encryption.test.ts +0 -206
  221. package/src/encryption.ts +0 -245
  222. package/src/envelopeCbor.ts +0 -140
  223. package/src/frameworkAdapters.test.ts +0 -290
  224. package/src/frameworkAdapters.ts +0 -261
  225. package/src/gateway.test.ts +0 -343
  226. package/src/gateway.ts +0 -246
  227. package/src/grpcBinding.test.ts +0 -211
  228. package/src/grpcBinding.ts +0 -103
  229. package/src/httpBinding.test.ts +0 -376
  230. package/src/httpBinding.ts +0 -189
  231. package/src/index.ts +0 -39
  232. package/src/keyInfra.test.ts +0 -278
  233. package/src/keyInfra.ts +0 -228
  234. package/src/keyRegistry.ts +0 -59
  235. package/src/keyRotation.test.ts +0 -78
  236. package/src/keyRotation.ts +0 -72
  237. package/src/mcpGateway.test.ts +0 -129
  238. package/src/mcpGateway.ts +0 -250
  239. package/src/mcpTransports.test.ts +0 -92
  240. package/src/mcpTransports.ts +0 -169
  241. package/src/mcpWrapper.test.ts +0 -179
  242. package/src/mcpWrapper.ts +0 -206
  243. package/src/otel.ts +0 -136
  244. package/src/policyEnforcer.test.ts +0 -99
  245. package/src/policyEnforcer.ts +0 -169
  246. package/src/policyTelemetryFeedback.test.ts +0 -25
  247. package/src/policyTelemetryFeedback.ts +0 -38
  248. package/src/protocol.bench.ts +0 -37
  249. package/src/protocol.d.ts.map +0 -1
  250. package/src/protocol.js +0 -294
  251. package/src/protocol.test.ts +0 -155
  252. package/src/protocol.ts +0 -414
  253. package/src/protocolAgent.test.ts +0 -105
  254. package/src/protocolAgent.ts +0 -169
  255. package/src/protocolBinary.test.ts +0 -165
  256. package/src/protocolBinary.ts +0 -312
  257. package/src/protocolCapabilities.ts +0 -70
  258. package/src/protocolFuzz.advanced.test.ts +0 -235
  259. package/src/protocolFuzz.test.ts +0 -111
  260. package/src/protocolNegative.test.ts +0 -97
  261. package/src/protocolReplay.test.ts +0 -71
  262. package/src/protocolReplay.ts +0 -194
  263. package/src/protocolTransport.test.ts +0 -556
  264. package/src/protocolTransport.ts +0 -483
  265. package/src/queueBinding.test.ts +0 -130
  266. package/src/queueBinding.ts +0 -102
  267. package/src/rateLimiter.test.ts +0 -96
  268. package/src/rateLimiter.ts +0 -46
  269. package/src/redisIntegration.test.ts +0 -134
  270. package/src/replayStores.test.ts +0 -273
  271. package/src/replayStores.ts +0 -215
  272. package/src/revocation.test.ts +0 -98
  273. package/src/revocation.ts +0 -0
  274. package/src/routePolicy.test.ts +0 -87
  275. package/src/routePolicy.ts +0 -72
  276. package/src/runtimePolicy.test.ts +0 -49
  277. package/src/runtimePolicy.ts +0 -81
  278. package/src/runtimePolicyManager.test.ts +0 -29
  279. package/src/runtimePolicyManager.ts +0 -50
  280. package/src/runtimePolicyPresets.ts +0 -43
  281. package/src/signedResponse.test.ts +0 -111
  282. package/src/signedResponse.ts +0 -83
  283. package/src/stream.test.ts +0 -254
  284. package/src/stream.ts +0 -417
  285. package/src/telemetry.test.ts +0 -251
  286. package/src/telemetry.ts +0 -299
  287. package/src/webhookBinding.test.ts +0 -144
  288. package/src/webhookBinding.ts +0 -115
  289. package/src/wsBinding.test.ts +0 -221
  290. package/src/wsBinding.ts +0 -200
  291. package/tsconfig.json +0 -15
  292. package/tsconfig.lib.json +0 -23
  293. package/vite.lib.config.ts +0 -16
  294. package/vitest.config.ts +0 -11
@@ -1,110 +0,0 @@
1
- version: "1.0"
2
- name: "gluv-runtime-policy"
3
- status: "active"
4
- owner: "platform-ai-ops"
5
- updated_at: "2026-05-10"
6
-
7
- purpose:
8
- summary: "Deterministic runtime policy for selecting GLUV transport, batching, retries, and safety controls."
9
- intent: "Maximize sustainable throughput while preserving protocol integrity and low drop rates."
10
-
11
- hard_invariants:
12
- require_signature_verification: true
13
- require_canonicalization: true
14
- require_replay_defense: true
15
- require_ttl_clock_skew_enforcement: true
16
- disallow_invariant_bypass: true
17
-
18
- slo_defaults:
19
- drop_pct_max: 0.1
20
- p99_ms_max: 20
21
- enforce_over_window: "5m"
22
- fail_release_on_breach: true
23
-
24
- mode_selection:
25
- rules:
26
- - when:
27
- concurrency_gte: 100
28
- use: "http-binary-batch"
29
- fallback: "ws-binary-batch"
30
- rationale: "High-concurrency lanes require binary+batch to avoid plain-http collapse."
31
- - when:
32
- latency_sensitive: true
33
- concurrency_lt: 100
34
- use: "ws-batch"
35
- rationale: "Balanced p99 and throughput."
36
- - when:
37
- compatibility_first: true
38
- concurrency_lt: 100
39
- use: "http"
40
- rationale: "Lowest integration friction for low/medium load."
41
-
42
- guardrails:
43
- block_plain_http_high_concurrency: true
44
- plain_http_block_threshold_concurrency: 100
45
- allow_override_flag: "--allow-unsafe-http"
46
- override_allowed_only_for: "stress-benchmarks"
47
-
48
- tuning:
49
- batch_size:
50
- low_traffic: [4, 8]
51
- medium_traffic: [8, 32]
52
- high_traffic: [32, 64]
53
- inflight_cap:
54
- low_traffic: [16, 64]
55
- medium_traffic: [64, 256]
56
- high_traffic: [256, 1024]
57
- retry_backoff_ms:
58
- low_traffic: [1, 2]
59
- medium_traffic: [2, 8]
60
- high_traffic: [4, 16]
61
- max_retry_attempts: 3
62
- retriable_status_codes: [503]
63
-
64
- adaptive_flow:
65
- enabled: true
66
- ewma_latency_alpha: 0.15
67
- degrade_if_latency_ms_gt: 25
68
- recover_if_latency_ms_lt: 8
69
- reduce_inflight_factor_on_error: 0.85
70
- reduce_batch_factor_on_error: 0.8
71
-
72
- benchmark_policy:
73
- production_readiness:
74
- require_adaptive_mode: true
75
- commands:
76
- - "npm run bench:openloop:quick"
77
- - "npm run bench:openloop:full"
78
- stress_characterization:
79
- allowed: true
80
- commands:
81
- - "npm run bench:openloop:stress:quick"
82
- - "npm run bench:openloop:stress:full"
83
- note: "Stress outputs must not be used as direct SLO acceptance."
84
-
85
- runtime_decision_tree:
86
- - if: "concurrency >= 100"
87
- then: "use http-binary-batch"
88
- - if: "drop_pct > drop_pct_max"
89
- then:
90
- - "reduce inflight cap"
91
- - "reduce batch size"
92
- - "increase retry backoff"
93
- - "switch to binary-batch mode"
94
- - if: "p99_ms > p99_ms_max"
95
- then:
96
- - "reduce batch size"
97
- - "reduce inflight cap"
98
- - "re-run adaptive benchmark"
99
-
100
- operator_handoff_required_fields:
101
- - mode
102
- - payload_bytes
103
- - concurrency
104
- - benchmark_type
105
- - p50_ms
106
- - p95_ms
107
- - p99_ms
108
- - drop_pct
109
- - retry_count
110
- - overload_signals
@@ -1,65 +0,0 @@
1
- # Backpressure and Saturation Tuning
2
-
3
- This guide documents practical tuning for GLUV transport behavior under contention.
4
-
5
- ## Baseline methodology
6
-
7
- Run these commands before tuning changes:
8
-
9
- ```bash
10
- npm run bench:openloop:quick
11
- npm run bench:openloop:adaptive:quick
12
- npm run bench:e2e:quick
13
- ```
14
-
15
- Focus on:
16
-
17
- - `dropPct` under target load
18
- - `p99Ms` tail latency
19
- - `stageQueueMsPerOp` and `stageTransportMsPerOp`
20
-
21
- ## Tuning priorities
22
-
23
- 1. Prefer `ws` / `ws-batch` for high concurrency when tail latency dominates.
24
- 2. Prefer `ws-binary-batch` when p99 latency is more important than single-message peak throughput.
25
- 3. Reduce per-request payload size first; large payloads amplify queue and transport tails.
26
- 4. Set `batchConcurrency` on receive paths when verification work starts starving the event loop.
27
- 5. Use adaptive gate thresholds to cap unstable targets in CI.
28
- 6. Keep replay and signature verification enabled; tune concurrency and batching instead.
29
-
30
- ## Batch receive guidance
31
-
32
- - Start with `batchConcurrency = 8` for service-side receive loops.
33
- - Lower it when p99 grows faster than throughput.
34
- - Raise it only when `stageVerifyMsPerOp` dominates and drop rate remains stable.
35
- - Keep replay caches shared across the whole session so duplicate messages inside one batch are rejected.
36
-
37
- ## Binary WebSocket guidance
38
-
39
- Use the open-loop benchmark modes below before changing runtime defaults:
40
-
41
- ```bash
42
- npm run bench:openloop:adaptive:quick -- --modes ws,ws-batch,ws-binary,ws-binary-batch --payloads 256 --concurrency 10
43
- ```
44
-
45
- Current policy: binary WebSocket modes are opt-in until full-profile benchmarks prove a stable throughput gain. Compact WebSocket remains the compatibility default.
46
-
47
- ## CI gate defaults
48
-
49
- Use:
50
-
51
- ```bash
52
- npm run bench:openloop:adaptive:ci
53
- ```
54
-
55
- This gate enforces sustained operation bounds through adaptive search with p99 and drop-rate constraints.
56
-
57
- ## Regression check
58
-
59
- Compare candidate against baseline:
60
-
61
- ```bash
62
- npm run bench:diff -- --baseline <path/to/baseline.json> --candidate <path/to/candidate.json>
63
- ```
64
-
65
- Block merges/releases when tail latency or drop-rate regresses beyond accepted limits.
@@ -1,42 +0,0 @@
1
- # 7h3 Protocol AIP Benchmark Claim Matrix (v1.0)
2
-
3
- Use this matrix when making public performance claims.
4
-
5
- ## Standard environment
6
-
7
- - OS: Linux (x86_64)
8
- - Node: 22.x
9
- - CPU: publish model and core count in benchmark report
10
- - Memory: publish total RAM in benchmark report
11
- - Command profile: `quick` for PR signal, `full` for release evidence
12
-
13
- ## Required benchmark suites
14
-
15
- - `npm run bench:protocol`
16
- - `npm run bench:e2e:quick`
17
- - `npm run bench:e2e:full`
18
- - `npm run bench:openloop:quick`
19
- - `npm run bench:openloop:full`
20
- - `npm run bench:openloop:adaptive:ci`
21
- - `npm run bench:signatures:quick`
22
- - `npm run bench:signatures:full`
23
-
24
- ## Mandatory dimensions
25
-
26
- - Payload sizes: `256`, `1024`, `4096`, `16384` bytes
27
- - Concurrency: `1`, `10`, `100`, `1000`
28
- - Transport modes: `inproc`, `http`, `ws`, `agent-loop` where applicable
29
- - Signature profiles: `HS256`, `ED25519`
30
-
31
- ## Required metrics
32
-
33
- - Throughput: ops/s
34
- - Latency: p50, p95, p99
35
- - Drop rate percentage (open-loop)
36
- - Stage timings where available (build/canonicalize/mac/queue/transport/verify/decode)
37
-
38
- ## Evidence requirements
39
-
40
- - Store JSON outputs under `bench-results/` (ignored by git, attached in CI/release notes)
41
- - Include baseline and candidate runs for release branch
42
- - Include `bench:diff` summary for release signoff
@@ -1,169 +0,0 @@
1
- # Benchmark Report Template (Release-Grade)
2
-
3
- Use this template for every candidate release benchmark report.
4
-
5
- ---
6
-
7
- ## 1) Metadata
8
-
9
- - Report ID:
10
- - Date/Time (UTC):
11
- - Author:
12
- - Branch/Commit:
13
- - Environment:
14
- - CPU:
15
- - Memory:
16
- - OS/Kernel:
17
- - Node/npm versions:
18
- - Network locality (loopback/LAN/WAN):
19
-
20
- ---
21
-
22
- ## 2) Benchmark Scope
23
-
24
- - Profile: `quick` / `full`
25
- - Modes tested:
26
- - Payload sizes:
27
- - Concurrency levels:
28
- - Adaptive thresholds:
29
- - p99 threshold:
30
- - drop threshold:
31
-
32
- ---
33
-
34
- ## 3) Security Configuration Matrix (Required)
35
-
36
- Mark each row as enabled/disabled and include exact settings.
37
-
38
- | Check | Transport-only Baseline | Full Secure Protocol |
39
- |---|---:|---:|
40
- | Signature verification | | |
41
- | Canonicalization | | |
42
- | Replay defense | | |
43
- | TTL/clock-skew enforcement | | |
44
- | Policy checks/guardrails | | |
45
-
46
- > Rule: Any public “protocol performance” claim must reference **Full Secure Protocol** results.
47
-
48
- ---
49
-
50
- ## 4) Commands Executed
51
-
52
- Include exact commands and flags.
53
-
54
- ```bash
55
- # adaptive sustainable runs
56
- npm run bench:openloop:quick
57
- npm run bench:openloop:full
58
-
59
- # explicit stress runs
60
- npm run bench:openloop:stress:quick
61
- npm run bench:openloop:stress:full
62
-
63
- # optional focused modes
64
- npx tsx scripts/bench-protocol-openloop.ts --profile quick --adaptive --modes http-binary-batch,ws-binary-batch --payload-sizes 256,1024
65
- ```
66
-
67
- ---
68
-
69
- ## 5) Results Summary (Required)
70
-
71
- ### A) Full Secure Protocol (authoritative)
72
-
73
- | Mode | Payload | Concurrency | Ops/s | Drop % | p99 ms | Sustainable |
74
- |---|---:|---:|---:|---:|---:|---|
75
- | | | | | | | |
76
-
77
- ### B) Transport-only Baseline (optional reference)
78
-
79
- | Mode | Payload | Concurrency | Ops/s | Drop % | p99 ms | Sustainable |
80
- |---|---:|---:|---:|---:|---:|---|
81
- | | | | | | | |
82
-
83
- ---
84
-
85
- ## 6) SLO Gates (Pass/Fail)
86
-
87
- Define and evaluate lane-specific gates.
88
-
89
- | Lane | Gate | Result | Pass/Fail |
90
- |---|---|---|---|
91
- | Interactive (<=100 concurrency) | p99 <= 25ms, drop <= 0.1% | | |
92
- | High-throughput (1000 concurrency) | p99 <= 100ms, drop <= 0.5% | | |
93
- | Security invariants | all enforced | | |
94
-
95
- Overall decision:
96
-
97
- - [ ] PASS
98
- - [ ] FAIL
99
-
100
- ---
101
-
102
- ## 7) Pressure Signals and Interpretation
103
-
104
- Document pressure points and likely causes.
105
-
106
- - Queueing/scheduling pressure observed at:
107
- - Session/stream pressure observed at:
108
- - Retry/backoff behavior:
109
- - Mode-level instability (if any):
110
-
111
- Interpretation:
112
-
113
- - Is degradation expected under stress, or present in adaptive sustainable lane?
114
- - Are drops due to overload policy or protocol correctness issues?
115
-
116
- ---
117
-
118
- ## 8) Remediation / Tuning Actions
119
-
120
- List actions taken or recommended.
121
-
122
- - [ ] Lower inflight cap
123
- - [ ] Reduce batch size
124
- - [ ] Increase retry backoff
125
- - [ ] Move lane to `*-binary-batch`
126
- - [ ] Tighten queue bounds/backpressure
127
- - [ ] Adjust priority lanes
128
-
129
- ---
130
-
131
- ## 9) Claim Language (Publish-safe)
132
-
133
- Use this format:
134
-
135
- > "In full secure mode (signature + canonicalization + replay + TTL + policy enabled), mode X achieved Y ops/s at payload Z and concurrency C with drop D% and p99 P ms under adaptive sustainable thresholds."
136
-
137
- Avoid:
138
-
139
- - mixing stress outputs into production SLO claims,
140
- - reporting transport-only baseline as secure protocol performance.
141
-
142
- ---
143
-
144
- ## 10) Evidence Attachments
145
-
146
- - Raw JSON output paths:
147
- - Markdown output paths:
148
- - `bench:diff` output:
149
- - `release:dashboard` output:
150
- - Relevant logs (if anomalies):
151
-
152
- ---
153
-
154
- ## 11) Security Review Checklist
155
-
156
- - [ ] Signature verification enabled
157
- - [ ] Replay defense enabled
158
- - [ ] TTL/clock-skew checks enabled
159
- - [ ] No bypass flags used in production benchmark lane
160
- - [ ] Policy file validated (`npm run policy:validate`)
161
-
162
- ---
163
-
164
- ## 12) Release Recommendation
165
-
166
- - Recommendation: `GO` / `NO-GO`
167
- - Conditions for GO:
168
- - Conditions requiring re-test:
169
- - Risk notes:
@@ -1,23 +0,0 @@
1
- # Binary Codec Benchmark
2
-
3
- GLUV includes a binary wire codec prototype in `src/protocolBinary.ts`.
4
-
5
- ## Run comparison
6
-
7
- ```bash
8
- npm run bench:wire:quick
9
- npm run bench:wire:full
10
- ```
11
-
12
- The benchmark compares `compact-json` vs `binary` for:
13
-
14
- - encoded size
15
- - encode/decode micro-latency
16
- - encode/decode ops/s
17
-
18
- Results are written to `bench-results/wire-codecs-*.json`.
19
-
20
- ## Notes
21
-
22
- - Binary codec currently targets envelope transport efficiency and deterministic roundtrip.
23
- - Keep compact JSON path for compatibility while binary path is evaluated for broader rollout.
@@ -1,36 +0,0 @@
1
- # Clean Clone Runbook
2
-
3
- Use this to verify deterministic setup from a fresh checkout.
4
-
5
- ## TypeScript path
6
-
7
- ```bash
8
- git clone https://github.com/IceMasterT/GLUV-Protocol.git
9
- cd GLUV-Protocol
10
- npm install
11
- npm run lint
12
- npm run test
13
- npm run build
14
- ```
15
-
16
- ## Conformance path
17
-
18
- ```bash
19
- npm run conformance:python
20
- npm run conformance:rust
21
- ```
22
-
23
- ## Quickstart path
24
-
25
- ```bash
26
- npm run aip:quickstart
27
- npm run aip:framework:quickstart
28
- printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"planner"}}' | npm run aip:mcp:gateway
29
- ```
30
-
31
- ## Rust gateway path
32
-
33
- ```bash
34
- cargo test --manifest-path sdk/rust/Cargo.toml
35
- printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"planner"}}' | cargo run --manifest-path sdk/rust/Cargo.toml --bin aip_mcp_gateway
36
- ```
@@ -1,30 +0,0 @@
1
- # Clock Skew Policy
2
-
3
- GLUV transport enforces a configurable future timestamp tolerance.
4
-
5
- ## Default
6
-
7
- - `maxClockSkewMs`: `30000` (30s)
8
-
9
- Messages with `header.timestampMs > nowMs + maxClockSkewMs` are rejected with:
10
-
11
- - `Message timestamp exceeds allowed clock skew`
12
-
13
- ## Usage
14
-
15
- ```ts
16
- import { receiveEnvelope } from './src/protocolTransport'
17
-
18
- const result = await receiveEnvelope(rawEnvelope, {
19
- nowMs: Date.now(),
20
- maxClockSkewMs: 10_000,
21
- replayCache,
22
- secretResolver: async () => sharedSecret,
23
- })
24
- ```
25
-
26
- ## Operational guidance
27
-
28
- - Keep NTP enabled for all nodes.
29
- - Use tighter skew windows for low-latency trusted clusters.
30
- - Use slightly wider windows for geo-distributed deployments.
@@ -1,142 +0,0 @@
1
- # Distributed Replay Defense
2
-
3
- 7h3 Protocol AIP protects against replay through pluggable cache interfaces.
4
-
5
- ## Interfaces
6
-
7
- - `InMemoryReplayCache`: single-process replay protection.
8
- - `DistributedReplayCache`: wraps a shared `DistributedReplayStore` for multi-node deployments.
9
- - `createRedisReplayStore`: a production `DistributedReplayStore` backed by Redis-style `SET NX PX`.
10
-
11
- Source: `src/protocolReplay.ts`, `src/replayStores.ts`.
12
-
13
- ## Client-agnostic by design
14
-
15
- The library ships **no Redis dependency**. You inject any client matching the
16
- small `RedisLikeClient` surface (`set` with `nx`/`pxMs`, optional `get`/`del`,
17
- optional `pipeline`). `ioredis`, `node-redis`, Upstash, or a cluster proxy all
18
- adapt in a few lines. An `InMemoryRedisLikeClient` reference implementation is
19
- provided for tests and local development.
20
-
21
- ## Usage
22
-
23
- ```ts
24
- import { DistributedReplayCache, createRedisReplayStore, receiveEnvelope } from '@7h3/protocol'
25
- import Redis from 'ioredis'
26
-
27
- const redis = new Redis(process.env.REDIS_URL)
28
-
29
- const replayCache = new DistributedReplayCache(
30
- createRedisReplayStore(
31
- // adapt ioredis' set(key, val, 'PX', ms, 'NX') to the RedisLikeClient shape:
32
- {
33
- set: async (key, value, opts = {}) => {
34
- const args = []
35
- if (opts.pxMs !== undefined) args.push('PX', opts.pxMs)
36
- if (opts.nx) args.push('NX')
37
- return (await redis.set(key, value, ...args)) === 'OK' ? 'OK' : null
38
- },
39
- },
40
- {
41
- keyPrefix: 'aip:replay:',
42
- errorBehavior: 'fallback', // degrade to local store on a Redis outage
43
- onDegraded: (err) => metrics.increment('aip.replay.degraded'),
44
- },
45
- ),
46
- )
47
-
48
- await receiveEnvelope(rawEnvelope, { replayCache, secretResolver: async () => sharedSecret })
49
- ```
50
-
51
- ## Shared store contract
52
-
53
- `DistributedReplayStore.reserve(key, expiresAtMs, nowMs)` must be atomic:
54
-
55
- - Return `true` when the key is newly reserved.
56
- - Return `false` when the key is already reserved and still valid.
57
-
58
- `key` format is `sender|messageId|nonce`. The optional `reserveMany(entries, nowMs)`
59
- performs a batched reserve (one round-trip via a client pipeline) and is used
60
- automatically by `DistributedReplayCache.consumeMany` when present.
61
-
62
- ## Behavior on Redis outage (`errorBehavior`)
63
-
64
- | Value | On client error | Use when |
65
- |---|---|---|
66
- | `fallback` (default) | Degrade to a local in-memory store — traffic flows, single-node replay protection stays in force, and TTL still bounds replays | Default; balances safety and uptime |
67
- | `reject` | Fail closed — deny the message | Strictest security posture |
68
- | `allow` | Fail open — accept the message | Uptime outweighs the narrow replay risk |
69
-
70
- Every degraded decision fires `onDegraded` so the condition is observable — degradation is never silent.
71
-
72
- ## High-availability topologies
73
-
74
- ### Redis Sentinel
75
-
76
- ioredis connects to Sentinel transparently. The adapter wrapper is identical to standalone Redis:
77
-
78
- ```ts
79
- import Redis from 'ioredis'
80
-
81
- const redis = new Redis({
82
- sentinels: [
83
- { host: 'sentinel-1', port: 26379 },
84
- { host: 'sentinel-2', port: 26379 },
85
- { host: 'sentinel-3', port: 26379 },
86
- ],
87
- name: 'mymaster',
88
- })
89
-
90
- const aipRedis = {
91
- set: async (key: string, value: string, opts: { nx?: boolean; pxMs?: number } = {}) => {
92
- const args: (string | number)[] = []
93
- if (opts.pxMs !== undefined) args.push('PX', opts.pxMs)
94
- if (opts.nx) args.push('NX')
95
- return (await redis.set(key, value, ...(args as [string, number, string]))) === 'OK'
96
- ? ('OK' as const)
97
- : null
98
- },
99
- }
100
-
101
- const replayCache = new DistributedReplayCache(
102
- createRedisReplayStore(aipRedis, { errorBehavior: 'fallback' }),
103
- )
104
- ```
105
-
106
- Sentinel handles leader election automatically. During failover (typically < 30 s), `errorBehavior` controls whether requests are rejected or degrade to local replay protection.
107
-
108
- ### Redis Cluster
109
-
110
- AIP replay keys (`aip:replay:{sender}:{messageId}:{nonce}`) and revocation keys (`aip:revoked:{keyId}`) are independent — no cross-slot transactions required. Cluster mode works without modification. Adapt a Cluster client the same way as standalone.
111
-
112
- ```ts
113
- const cluster = new Redis.Cluster([
114
- { host: 'node-1', port: 7000 },
115
- { host: 'node-2', port: 7001 },
116
- { host: 'node-3', port: 7002 },
117
- ])
118
- // adapter wrapper identical to standalone
119
- ```
120
-
121
- ### Upstash (serverless / edge)
122
-
123
- Upstash's `@upstash/redis` client's `set` method matches `RedisLikeClient` directly:
124
-
125
- ```ts
126
- import { Redis } from '@upstash/redis'
127
-
128
- const redis = new Redis({ url: process.env.UPSTASH_URL!, token: process.env.UPSTASH_TOKEN! })
129
-
130
- const aipRedis = {
131
- set: async (key: string, value: string, opts: { nx?: boolean; pxMs?: number } = {}) =>
132
- redis.set(key, value, { nx: opts.nx, px: opts.pxMs }),
133
- }
134
- ```
135
-
136
- ## Operational guidance
137
-
138
- - Use a distributed replay cache for any horizontally scaled gateway.
139
- - Keep clocks synchronized (NTP / PTP) — AIP TTL checks require clocks within the configured skew window (default ±30 s) across all nodes and Sentinel/Cluster members.
140
- - Monitor replay reject rate and `onDegraded` rate as security / health signals.
141
- - During Redis failover, `errorBehavior: 'fallback'` keeps traffic flowing under single-node replay protection. `errorBehavior: 'reject'` is safer but means failover = downtime for inbound envelopes. Choose the posture that matches your threat model.
142
- - The replay store is the only component AIP requires Redis for. The revocation store (`createRedisRevocationStore`) uses the same `RedisLikeClient` interface and the same HA patterns apply.