@7h3/protocol 0.4.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.
- package/README.md +6 -323
- package/agentAdapter.d.ts +26 -0
- package/auditLog.d.ts +54 -0
- package/capability.d.ts +67 -0
- package/cborCodec.d.ts +34 -0
- package/conformanceVectors.d.ts +20 -0
- package/encryption.d.ts +85 -0
- package/envelopeCbor.d.ts +33 -0
- package/frameworkAdapters.d.ts +72 -0
- package/gateway.d.ts +53 -0
- package/grpcBinding.d.ts +29 -0
- package/httpBinding.d.ts +50 -0
- package/index.d.ts +39 -0
- package/index.js +3662 -0
- package/keyInfra.d.ts +64 -0
- package/keyRegistry.d.ts +9 -0
- package/keyRotation.d.ts +20 -0
- package/mcpGateway.d.ts +37 -0
- package/mcpTransports.d.ts +62 -0
- package/mcpWrapper.d.ts +83 -0
- package/otel.d.ts +65 -0
- package/package.json +13 -79
- package/policyEnforcer.d.ts +50 -0
- package/policyTelemetryFeedback.d.ts +11 -0
- package/protocol.d.ts +66 -0
- package/protocolAgent.d.ts +58 -0
- package/protocolBinary.d.ts +8 -0
- package/protocolCapabilities.d.ts +24 -0
- package/protocolReplay.d.ts +35 -0
- package/protocolTransport.d.ts +73 -0
- package/queueBinding.d.ts +43 -0
- package/rateLimiter.d.ts +18 -0
- package/{src/redisClient.ts → redisClient.d.ts} +25 -75
- package/replayStores.d.ts +98 -0
- package/revocation.d.ts +71 -0
- package/routePolicy.d.ts +30 -0
- package/runtimePolicy.d.ts +24 -0
- package/runtimePolicyManager.d.ts +15 -0
- package/runtimePolicyPresets.d.ts +11 -0
- package/signedResponse.d.ts +21 -0
- package/stream.d.ts +59 -0
- package/telemetry.d.ts +79 -0
- package/webhookBinding.d.ts +30 -0
- package/wsBinding.d.ts +52 -0
- package/.dockerignore +0 -19
- package/.github/dependabot.yml +0 -32
- package/.github/workflows/ci.yml +0 -31
- package/.github/workflows/publish.yml +0 -59
- package/.github/workflows/scorecard.yml +0 -37
- package/7h3.example.yaml +0 -125
- package/CHANGELOG.md +0 -92
- package/CONTRIBUTING.md +0 -82
- package/Dockerfile +0 -73
- package/GOVERNANCE.md +0 -62
- package/SECURITY.md +0 -70
- package/bench-results/replay-cache-full-1777891033256.json +0 -10
- package/bench-results/replay-cache-full-1777896317488.json +0 -10
- package/bench-results/replay-cache-full-1777900993184.json +0 -10
- package/bench-results/replay-cache-full-1777901019285.json +0 -10
- package/bench-results/replay-cache-quick-1777870170126.json +0 -10
- package/bench-results/signature-profiles-quick-1775875160079.json +0 -85
- package/bench-results/signature-profiles-quick-1775983539716.json +0 -85
- package/bench-results/signature-profiles-quick-1776237913190.json +0 -85
- package/bench-results/wire-codecs-full-1777891019803.json +0 -93
- package/bench-results/wire-codecs-full-1777896260964.json +0 -93
- package/bench-results/wire-codecs-full-1777901004247.json +0 -93
- package/bench-results/wire-codecs-quick-1775972879056.json +0 -93
- package/bench-results/wire-codecs-quick-1775983541111.json +0 -93
- package/bench-results/wire-codecs-quick-1776237914299.json +0 -93
- package/bench-results/wire-codecs-quick-1777841285236.json +0 -93
- package/bench-results/wire-codecs-quick-1777841321772.json +0 -93
- package/bench-results/wire-codecs-quick-1777841330408.json +0 -93
- package/bench-results/wire-codecs-quick-1777852886082.json +0 -93
- package/bench-results/wire-codecs-quick-1777852988773.json +0 -93
- package/bench-results/wire-codecs-quick-1777870188095.json +0 -93
- package/bench-results/wire-codecs-quick-1777870263918.json +0 -93
- package/bench-results/wire-codecs-quick-1777870455034.json +0 -93
- package/bench-results/wire-codecs-quick-1778816163081.json +0 -93
- package/bench-results/wire-codecs-quick-1778843936130.json +0 -93
- package/bin/7h3.ts +0 -385
- package/conformance/7h3_v0_1.json +0 -77
- package/conformance/7h3_v0_1_binary.json +0 -20
- package/conformance/aip_v0_1_binary.json +0 -20
- package/docker-compose.yaml +0 -77
- package/docs/ADOPTION_PLAN.md +0 -120
- package/docs/AGENTS.md +0 -77
- package/docs/AIP_RFC_v0.1.md +0 -97
- package/docs/AI_DECISION_CARD.md +0 -122
- package/docs/AI_RUNTIME_POLICY.json +0 -126
- package/docs/AI_RUNTIME_POLICY.yaml +0 -110
- package/docs/BACKPRESSURE_TUNING.md +0 -65
- package/docs/BENCHMARK_CLAIM_MATRIX.md +0 -42
- package/docs/BENCHMARK_REPORT_TEMPLATE.md +0 -169
- package/docs/BINARY_CODEC_BENCH.md +0 -23
- package/docs/CLEAN_CLONE_RUNBOOK.md +0 -36
- package/docs/CLOCK_SKEW_POLICY.md +0 -30
- package/docs/DISTRIBUTED_REPLAY.md +0 -142
- package/docs/FUZZ_CAMPAIGN.md +0 -121
- package/docs/GATEWAY.md +0 -195
- package/docs/KEY_MANAGEMENT_POLICY.md +0 -53
- package/docs/KEY_REVOCATION.md +0 -69
- package/docs/MCP_WRAPPER.md +0 -159
- package/docs/MIGRATION_GUIDE.md +0 -40
- package/docs/OPERATORS.md +0 -184
- package/docs/PERF_REGRESSION_POLICY.md +0 -34
- package/docs/PROJECT_EXAMINATION_2026-05-31.md +0 -219
- package/docs/RELEASE_BENCHMARK_REPORT_2026-05-15.md +0 -135
- package/docs/RELEASE_GATE.md +0 -25
- package/docs/RELEASE_NOTES_v0.1.0.md +0 -54
- package/docs/SECURITY_REVIEW_2026-06-05.md +0 -165
- package/docs/TELEMETRY.md +0 -41
- package/docs/THREAT_MODEL.md +0 -89
- package/docs/VERSIONING_POLICY.md +0 -30
- package/docs/assets/banner.png +0 -0
- package/eslint.config.js +0 -15
- package/fuzz/ts/harness-decode.ts +0 -136
- package/fuzz/ts/harness-verify.ts +0 -121
- package/fuzz/ts/run.ts +0 -35
- package/mcp-server/README.md +0 -38
- package/mcp-server/package-lock.json +0 -1187
- package/mcp-server/package.json +0 -35
- package/mcp-server/src/index.ts +0 -236
- package/mcp-server/tsconfig.json +0 -14
- package/scripts/aip-framework-quickstart.ts +0 -110
- package/scripts/aip-mcp-gateway.ts +0 -38
- package/scripts/aip-mcp-wrap-demo.ts +0 -72
- package/scripts/aip-quickstart.ts +0 -60
- package/scripts/bench-diff.ts +0 -118
- package/scripts/bench-protocol-e2e.ts +0 -937
- package/scripts/bench-protocol-openloop.ts +0 -1397
- package/scripts/bench-replay-cache.ts +0 -76
- package/scripts/bench-signature-profiles.ts +0 -180
- package/scripts/bench-wire-codecs.ts +0 -161
- package/scripts/build-binary-conformance.ts +0 -36
- package/scripts/build-release-dashboard.ts +0 -175
- package/scripts/canary-rollout.ts +0 -38
- package/scripts/mcpGatewayCli.test.ts +0 -116
- package/scripts/prepare-aip-package.ts +0 -88
- package/scripts/regen-conformance-sigs.ts +0 -18
- package/scripts/release-gate.ts +0 -19
- package/scripts/validate-runtime-policy.ts +0 -18
- package/sdk/browser/index.test.ts +0 -162
- package/sdk/browser/index.ts +0 -257
- package/sdk/browser/package.json +0 -13
- package/sdk/go/go.mod +0 -3
- package/sdk/go/http.go +0 -135
- package/sdk/go/protocol.go +0 -324
- package/sdk/go/protocol_test.go +0 -334
- package/sdk/go/webhook.go +0 -136
- package/sdk/python/README.md +0 -18
- package/sdk/python/protocol_7h3/__init__.py +0 -46
- package/sdk/python/protocol_7h3/http.py +0 -212
- package/sdk/python/protocol_7h3/keys.py +0 -149
- package/sdk/python/protocol_7h3/protocol.py +0 -525
- package/sdk/python/protocol_7h3/queue.py +0 -118
- package/sdk/python/protocol_7h3/webhook.py +0 -116
- package/sdk/python/pyproject.toml +0 -40
- package/sdk/python/tests/test_conformance.py +0 -110
- package/sdk/python/tests/test_http.py +0 -305
- package/sdk/python/tests/test_keys.py +0 -417
- package/sdk/python/tests/test_queue.py +0 -120
- package/sdk/python/tests/test_webhook.py +0 -345
- package/sdk/rust/Cargo.lock +0 -371
- package/sdk/rust/Cargo.toml +0 -25
- package/sdk/rust/README.md +0 -31
- package/sdk/rust/fuzz/Cargo.toml +0 -29
- package/sdk/rust/fuzz/fuzz_targets/fuzz_canonicalize.rs +0 -46
- package/sdk/rust/fuzz/fuzz_targets/fuzz_decode.rs +0 -11
- package/sdk/rust/src/bin/aip_mcp_gateway.rs +0 -59
- package/sdk/rust/src/http.rs +0 -145
- package/sdk/rust/src/keys.rs +0 -161
- package/sdk/rust/src/lib.rs +0 -688
- package/sdk/rust/src/queue.rs +0 -79
- package/sdk/rust/src/webhook.rs +0 -86
- package/sdk/rust/tests/conformance.rs +0 -148
- package/sdk/rust/tests/gateway.rs +0 -130
- package/sdk/rust/tests/http_webhook_queue.rs +0 -201
- package/sdk/rust/tests/keys.rs +0 -189
- package/src/agentAdapter.test.ts +0 -48
- package/src/agentAdapter.ts +0 -56
- package/src/auditLog.test.ts +0 -145
- package/src/auditLog.ts +0 -147
- package/src/conformance.test.ts +0 -136
- package/src/conformanceVectors.ts +0 -99
- package/src/frameworkAdapters.test.ts +0 -290
- package/src/frameworkAdapters.ts +0 -261
- package/src/gateway.test.ts +0 -343
- package/src/gateway.ts +0 -171
- package/src/grpcBinding.test.ts +0 -211
- package/src/grpcBinding.ts +0 -103
- package/src/httpBinding.test.ts +0 -376
- package/src/httpBinding.ts +0 -163
- package/src/index.ts +0 -32
- package/src/keyInfra.test.ts +0 -278
- package/src/keyInfra.ts +0 -228
- package/src/keyRegistry.ts +0 -59
- package/src/keyRotation.test.ts +0 -78
- package/src/keyRotation.ts +0 -72
- package/src/mcpGateway.test.ts +0 -129
- package/src/mcpGateway.ts +0 -250
- package/src/mcpTransports.test.ts +0 -92
- package/src/mcpTransports.ts +0 -169
- package/src/mcpWrapper.test.ts +0 -179
- package/src/mcpWrapper.ts +0 -206
- package/src/policyEnforcer.test.ts +0 -99
- package/src/policyEnforcer.ts +0 -169
- package/src/policyTelemetryFeedback.test.ts +0 -25
- package/src/policyTelemetryFeedback.ts +0 -38
- package/src/protocol.bench.ts +0 -37
- package/src/protocol.test.ts +0 -155
- package/src/protocol.ts +0 -413
- package/src/protocolAgent.test.ts +0 -105
- package/src/protocolAgent.ts +0 -169
- package/src/protocolBinary.test.ts +0 -165
- package/src/protocolBinary.ts +0 -312
- package/src/protocolCapabilities.ts +0 -70
- package/src/protocolFuzz.advanced.test.ts +0 -235
- package/src/protocolFuzz.test.ts +0 -111
- package/src/protocolNegative.test.ts +0 -97
- package/src/protocolReplay.test.ts +0 -71
- package/src/protocolReplay.ts +0 -194
- package/src/protocolTransport.test.ts +0 -556
- package/src/protocolTransport.ts +0 -483
- package/src/queueBinding.test.ts +0 -130
- package/src/queueBinding.ts +0 -102
- package/src/rateLimiter.test.ts +0 -96
- package/src/rateLimiter.ts +0 -46
- package/src/redisIntegration.test.ts +0 -134
- package/src/replayStores.test.ts +0 -141
- package/src/replayStores.ts +0 -82
- package/src/revocation.test.ts +0 -98
- package/src/revocation.ts +0 -0
- package/src/routePolicy.test.ts +0 -87
- package/src/routePolicy.ts +0 -72
- package/src/runtimePolicy.test.ts +0 -49
- package/src/runtimePolicy.ts +0 -81
- package/src/runtimePolicyManager.test.ts +0 -29
- package/src/runtimePolicyManager.ts +0 -50
- package/src/runtimePolicyPresets.ts +0 -43
- package/src/signedResponse.test.ts +0 -111
- package/src/signedResponse.ts +0 -83
- package/src/webhookBinding.test.ts +0 -144
- package/src/webhookBinding.ts +0 -115
- package/src/wsBinding.test.ts +0 -221
- package/src/wsBinding.ts +0 -100
- package/tsconfig.json +0 -15
- package/tsconfig.lib.json +0 -23
- package/vite.lib.config.ts +0 -16
|
@@ -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.
|
package/docs/FUZZ_CAMPAIGN.md
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
# Fuzz Campaign
|
|
2
|
-
|
|
3
|
-
AIP employs two complementary fuzzing strategies: mutation-based harnesses for TypeScript and coverage-guided libFuzzer targets for Rust.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## TypeScript — mutation-based harnesses
|
|
8
|
-
|
|
9
|
-
**Location:** `fuzz/ts/`
|
|
10
|
-
|
|
11
|
-
**Run:**
|
|
12
|
-
```bash
|
|
13
|
-
npm run fuzz:ts # both harnesses, default rounds
|
|
14
|
-
FUZZ_ROUNDS=200000 npm run fuzz:ts # heavier run
|
|
15
|
-
npm run fuzz:ts:decode # decoder only
|
|
16
|
-
npm run fuzz:ts:verify # verifier only
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Harness: `harness-decode.ts`
|
|
20
|
-
|
|
21
|
-
**Target:** `decodeEnvelope`
|
|
22
|
-
**Invariant:** Must never throw on any input — garbage returns `{ok: false}`, not a crash.
|
|
23
|
-
|
|
24
|
-
**Strategy:**
|
|
25
|
-
1. Seed corpus: conformance vectors (JSON full form + compact form) + known-bad inputs (`{}`, `[]`, `null`, `"string"`, `{`, etc.)
|
|
26
|
-
2. Each round: pick a mutator, apply it to the current input
|
|
27
|
-
3. Reset to a fresh corpus item every 500 rounds
|
|
28
|
-
|
|
29
|
-
**Mutators:**
|
|
30
|
-
- Bit flip at a random byte position
|
|
31
|
-
- Random byte insertion
|
|
32
|
-
- Random byte deletion
|
|
33
|
-
- Truncation to a random prefix length
|
|
34
|
-
- JSON field mutation (null, type change)
|
|
35
|
-
- Token substitution (e.g. `"aip/0.1"` → `"aip/0.2"`)
|
|
36
|
-
|
|
37
|
-
**Initial run result (2026-06-05):**
|
|
38
|
-
```
|
|
39
|
-
[harness-decode] rounds=50000 ok=98 ok:false=49902 crashes=0
|
|
40
|
-
```
|
|
41
|
-
No crashes. Decoder tolerates all 50,000 mutated inputs.
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
### Harness: `harness-verify.ts`
|
|
46
|
-
|
|
47
|
-
**Target:** `verifyEnvelopeHmac`
|
|
48
|
-
**Invariants:**
|
|
49
|
-
1. Must never throw on a tampered envelope.
|
|
50
|
-
2. Any tampered envelope must verify as `false` (no false positives).
|
|
51
|
-
|
|
52
|
-
**Strategy:**
|
|
53
|
-
1. Sign a fresh baseline envelope
|
|
54
|
-
2. Each round: deep-clone and randomly mutate one field in `header` or `body`
|
|
55
|
-
3. Guard: if mutation produced no net change, force `body.content` to a sentinel value
|
|
56
|
-
4. Every 200 rounds: test with a fully broken envelope (`{}` headers/body)
|
|
57
|
-
|
|
58
|
-
**Mutation operators:**
|
|
59
|
-
- String fields: bit flip a random byte, UTF-8 round-tripped (invalid sequences → replacement char)
|
|
60
|
-
- Numeric fields: add a non-zero delta (−500 to −1 or +1 to +500)
|
|
61
|
-
- Optional fields: set to `null`
|
|
62
|
-
|
|
63
|
-
**Initial run result (2026-06-05):**
|
|
64
|
-
```
|
|
65
|
-
[harness-verify] rounds=20000 tamper-false-positives=0 crashes=0
|
|
66
|
-
```
|
|
67
|
-
No crashes, no false positives. No tampered envelope verified as valid.
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## Rust — cargo-fuzz (libFuzzer)
|
|
72
|
-
|
|
73
|
-
**Location:** `sdk/rust/fuzz/`
|
|
74
|
-
|
|
75
|
-
**Prerequisites:**
|
|
76
|
-
```bash
|
|
77
|
-
rustup toolchain install nightly
|
|
78
|
-
cargo install cargo-fuzz
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
**Run:**
|
|
82
|
-
```bash
|
|
83
|
-
npm run fuzz:rust:decode # 60-second decode fuzzing session
|
|
84
|
-
npm run fuzz:rust:canonicalize # 60-second canonicalize fuzzing session
|
|
85
|
-
|
|
86
|
-
# Or run directly:
|
|
87
|
-
cargo +nightly fuzz run fuzz_decode --manifest-path sdk/rust/fuzz/Cargo.toml
|
|
88
|
-
cargo +nightly fuzz run fuzz_canonicalize --manifest-path sdk/rust/fuzz/Cargo.toml
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Target: `fuzz_decode`
|
|
92
|
-
|
|
93
|
-
**Target:** `aip7h3::decode_envelope`
|
|
94
|
-
**Invariant:** Must never panic on any UTF-8-valid input — errors are `Err(...)`, not panics.
|
|
95
|
-
|
|
96
|
-
Input: arbitrary byte sequences converted to UTF-8 via `std::str::from_utf8`.
|
|
97
|
-
|
|
98
|
-
### Target: `fuzz_canonicalize`
|
|
99
|
-
|
|
100
|
-
**Target:** `aip7h3::canonicalize_envelope`
|
|
101
|
-
**Invariant:** Calling it twice on the same envelope returns the same string (idempotence / purity).
|
|
102
|
-
|
|
103
|
-
Input: fuzz bytes carved into envelope fields (`messageId`, `content`) to exercise the canonicalization path under arbitrary field content.
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## Coverage gaps and known limitations
|
|
108
|
-
|
|
109
|
-
| Gap | Notes |
|
|
110
|
-
|---|---|
|
|
111
|
-
| TypeScript fuzzing is mutation-based, not coverage-guided | Coverage-guided fuzzing (e.g. jazzer.js) requires Java; out of scope for CI. The mutation harnesses provide meaningful parser boundary coverage without the dependency. |
|
|
112
|
-
| Binary decoder (`decodeEnvelope` with `Uint8Array`) | The existing property-based tests (fast-check) cover this path (`src/protocolFuzz.advanced.test.ts`). A dedicated fuzz harness is a future addition. |
|
|
113
|
-
| Ed25519 verification paths | These depend on WebCrypto internals; crash surface is on the envelope parsing/canonicalization layer (covered). |
|
|
114
|
-
| No crash corpus retained | Extend the harnesses with a `fuzz/corpus/` directory to persist and replay interesting inputs. |
|
|
115
|
-
| Python | No standalone fuzz harness — Python correctness is covered by conformance vectors and the property-based TS tests. |
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## Pre-release fuzz policy
|
|
120
|
-
|
|
121
|
-
Per `docs/RELEASE_GATE.md`, at minimum the TypeScript harnesses run at default round counts as part of every release gate check. Rust fuzzing is optional for patch releases and required for minor/major bumps.
|