@7h3/protocol 0.1.2 → 0.4.0
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/.dockerignore +19 -0
- package/.github/dependabot.yml +32 -0
- package/.github/workflows/ci.yml +31 -0
- package/.github/workflows/publish.yml +59 -0
- package/.github/workflows/scorecard.yml +37 -0
- package/7h3.example.yaml +125 -0
- package/CHANGELOG.md +92 -0
- package/CONTRIBUTING.md +82 -0
- package/Dockerfile +73 -0
- package/GOVERNANCE.md +62 -0
- package/README.md +323 -6
- package/SECURITY.md +70 -0
- package/bench-results/replay-cache-full-1777891033256.json +10 -0
- package/bench-results/replay-cache-full-1777896317488.json +10 -0
- package/bench-results/replay-cache-full-1777900993184.json +10 -0
- package/bench-results/replay-cache-full-1777901019285.json +10 -0
- package/bench-results/replay-cache-quick-1777870170126.json +10 -0
- package/bench-results/signature-profiles-quick-1775875160079.json +85 -0
- package/bench-results/signature-profiles-quick-1775983539716.json +85 -0
- package/bench-results/signature-profiles-quick-1776237913190.json +85 -0
- package/bench-results/wire-codecs-full-1777891019803.json +93 -0
- package/bench-results/wire-codecs-full-1777896260964.json +93 -0
- package/bench-results/wire-codecs-full-1777901004247.json +93 -0
- package/bench-results/wire-codecs-quick-1775972879056.json +93 -0
- package/bench-results/wire-codecs-quick-1775983541111.json +93 -0
- package/bench-results/wire-codecs-quick-1776237914299.json +93 -0
- package/bench-results/wire-codecs-quick-1777841285236.json +93 -0
- package/bench-results/wire-codecs-quick-1777841321772.json +93 -0
- package/bench-results/wire-codecs-quick-1777841330408.json +93 -0
- package/bench-results/wire-codecs-quick-1777852886082.json +93 -0
- package/bench-results/wire-codecs-quick-1777852988773.json +93 -0
- package/bench-results/wire-codecs-quick-1777870188095.json +93 -0
- package/bench-results/wire-codecs-quick-1777870263918.json +93 -0
- package/bench-results/wire-codecs-quick-1777870455034.json +93 -0
- package/bench-results/wire-codecs-quick-1778816163081.json +93 -0
- package/bench-results/wire-codecs-quick-1778843936130.json +93 -0
- package/bin/7h3.ts +385 -0
- package/conformance/7h3_v0_1.json +77 -0
- package/conformance/7h3_v0_1_binary.json +20 -0
- package/conformance/aip_v0_1_binary.json +20 -0
- package/docker-compose.yaml +77 -0
- package/docs/ADOPTION_PLAN.md +120 -0
- package/docs/AGENTS.md +77 -0
- package/docs/AIP_RFC_v0.1.md +97 -0
- package/docs/AI_DECISION_CARD.md +122 -0
- package/docs/AI_RUNTIME_POLICY.json +126 -0
- package/docs/AI_RUNTIME_POLICY.yaml +110 -0
- package/docs/BACKPRESSURE_TUNING.md +65 -0
- package/docs/BENCHMARK_CLAIM_MATRIX.md +42 -0
- package/docs/BENCHMARK_REPORT_TEMPLATE.md +169 -0
- package/docs/BINARY_CODEC_BENCH.md +23 -0
- package/docs/CLEAN_CLONE_RUNBOOK.md +36 -0
- package/docs/CLOCK_SKEW_POLICY.md +30 -0
- package/docs/DISTRIBUTED_REPLAY.md +142 -0
- package/docs/FUZZ_CAMPAIGN.md +121 -0
- package/docs/GATEWAY.md +195 -0
- package/docs/KEY_MANAGEMENT_POLICY.md +53 -0
- package/docs/KEY_REVOCATION.md +69 -0
- package/docs/MCP_WRAPPER.md +159 -0
- package/docs/MIGRATION_GUIDE.md +40 -0
- package/docs/OPERATORS.md +184 -0
- package/docs/PERF_REGRESSION_POLICY.md +34 -0
- package/docs/PROJECT_EXAMINATION_2026-05-31.md +219 -0
- package/docs/RELEASE_BENCHMARK_REPORT_2026-05-15.md +135 -0
- package/docs/RELEASE_GATE.md +25 -0
- package/docs/RELEASE_NOTES_v0.1.0.md +54 -0
- package/docs/SECURITY_REVIEW_2026-06-05.md +165 -0
- package/docs/TELEMETRY.md +41 -0
- package/docs/THREAT_MODEL.md +89 -0
- package/docs/VERSIONING_POLICY.md +30 -0
- package/docs/assets/banner.png +0 -0
- package/eslint.config.js +15 -0
- package/fuzz/ts/harness-decode.ts +136 -0
- package/fuzz/ts/harness-verify.ts +121 -0
- package/fuzz/ts/run.ts +35 -0
- package/mcp-server/README.md +38 -0
- package/mcp-server/package-lock.json +1187 -0
- package/mcp-server/package.json +35 -0
- package/mcp-server/src/index.ts +236 -0
- package/mcp-server/tsconfig.json +14 -0
- package/package.json +79 -13
- package/scripts/aip-framework-quickstart.ts +110 -0
- package/scripts/aip-mcp-gateway.ts +38 -0
- package/scripts/aip-mcp-wrap-demo.ts +72 -0
- package/scripts/aip-quickstart.ts +60 -0
- package/scripts/bench-diff.ts +118 -0
- package/scripts/bench-protocol-e2e.ts +937 -0
- package/scripts/bench-protocol-openloop.ts +1397 -0
- package/scripts/bench-replay-cache.ts +76 -0
- package/scripts/bench-signature-profiles.ts +180 -0
- package/scripts/bench-wire-codecs.ts +161 -0
- package/scripts/build-binary-conformance.ts +36 -0
- package/scripts/build-release-dashboard.ts +175 -0
- package/scripts/canary-rollout.ts +38 -0
- package/scripts/mcpGatewayCli.test.ts +116 -0
- package/scripts/prepare-aip-package.ts +88 -0
- package/scripts/regen-conformance-sigs.ts +18 -0
- package/scripts/release-gate.ts +19 -0
- package/scripts/validate-runtime-policy.ts +18 -0
- package/sdk/browser/index.test.ts +162 -0
- package/sdk/browser/index.ts +257 -0
- package/sdk/browser/package.json +13 -0
- package/sdk/go/go.mod +3 -0
- package/sdk/go/http.go +135 -0
- package/sdk/go/protocol.go +324 -0
- package/sdk/go/protocol_test.go +334 -0
- package/sdk/go/webhook.go +136 -0
- package/sdk/python/README.md +18 -0
- package/sdk/python/protocol_7h3/__init__.py +46 -0
- package/sdk/python/protocol_7h3/http.py +212 -0
- package/sdk/python/protocol_7h3/keys.py +149 -0
- package/sdk/python/protocol_7h3/protocol.py +525 -0
- package/sdk/python/protocol_7h3/queue.py +118 -0
- package/sdk/python/protocol_7h3/webhook.py +116 -0
- package/sdk/python/pyproject.toml +40 -0
- package/sdk/python/tests/test_conformance.py +110 -0
- package/sdk/python/tests/test_http.py +305 -0
- package/sdk/python/tests/test_keys.py +417 -0
- package/sdk/python/tests/test_queue.py +120 -0
- package/sdk/python/tests/test_webhook.py +345 -0
- package/sdk/rust/Cargo.lock +371 -0
- package/sdk/rust/Cargo.toml +25 -0
- package/sdk/rust/README.md +31 -0
- package/sdk/rust/fuzz/Cargo.toml +29 -0
- package/sdk/rust/fuzz/fuzz_targets/fuzz_canonicalize.rs +46 -0
- package/sdk/rust/fuzz/fuzz_targets/fuzz_decode.rs +11 -0
- package/sdk/rust/src/bin/aip_mcp_gateway.rs +59 -0
- package/sdk/rust/src/http.rs +145 -0
- package/sdk/rust/src/keys.rs +161 -0
- package/sdk/rust/src/lib.rs +688 -0
- package/sdk/rust/src/queue.rs +79 -0
- package/sdk/rust/src/webhook.rs +86 -0
- package/sdk/rust/tests/conformance.rs +148 -0
- package/sdk/rust/tests/gateway.rs +130 -0
- package/sdk/rust/tests/http_webhook_queue.rs +201 -0
- package/sdk/rust/tests/keys.rs +189 -0
- package/src/agentAdapter.test.ts +48 -0
- package/src/agentAdapter.ts +56 -0
- package/src/auditLog.test.ts +145 -0
- package/src/auditLog.ts +147 -0
- package/src/conformance.test.ts +136 -0
- package/src/conformanceVectors.ts +99 -0
- package/src/frameworkAdapters.test.ts +290 -0
- package/src/frameworkAdapters.ts +261 -0
- package/src/gateway.test.ts +343 -0
- package/src/gateway.ts +171 -0
- package/src/grpcBinding.test.ts +211 -0
- package/src/grpcBinding.ts +103 -0
- package/src/httpBinding.test.ts +376 -0
- package/src/httpBinding.ts +163 -0
- package/src/index.ts +32 -0
- package/src/keyInfra.test.ts +278 -0
- package/src/keyInfra.ts +228 -0
- package/src/keyRegistry.ts +59 -0
- package/src/keyRotation.test.ts +78 -0
- package/src/keyRotation.ts +72 -0
- package/src/mcpGateway.test.ts +129 -0
- package/src/mcpGateway.ts +250 -0
- package/src/mcpTransports.test.ts +92 -0
- package/src/mcpTransports.ts +169 -0
- package/src/mcpWrapper.test.ts +179 -0
- package/src/mcpWrapper.ts +206 -0
- package/src/policyEnforcer.test.ts +99 -0
- package/src/policyEnforcer.ts +169 -0
- package/src/policyTelemetryFeedback.test.ts +25 -0
- package/src/policyTelemetryFeedback.ts +38 -0
- package/src/protocol.bench.ts +37 -0
- package/src/protocol.test.ts +155 -0
- package/src/protocol.ts +413 -0
- package/src/protocolAgent.test.ts +105 -0
- package/src/protocolAgent.ts +169 -0
- package/src/protocolBinary.test.ts +165 -0
- package/src/protocolBinary.ts +312 -0
- package/src/protocolCapabilities.ts +70 -0
- package/src/protocolFuzz.advanced.test.ts +235 -0
- package/src/protocolFuzz.test.ts +111 -0
- package/src/protocolNegative.test.ts +97 -0
- package/src/protocolReplay.test.ts +71 -0
- package/src/protocolReplay.ts +194 -0
- package/src/protocolTransport.test.ts +556 -0
- package/src/protocolTransport.ts +483 -0
- package/src/queueBinding.test.ts +130 -0
- package/src/queueBinding.ts +102 -0
- package/src/rateLimiter.test.ts +96 -0
- package/src/rateLimiter.ts +46 -0
- package/src/redisClient.ts +140 -0
- package/src/redisIntegration.test.ts +134 -0
- package/src/replayStores.test.ts +141 -0
- package/src/replayStores.ts +82 -0
- package/src/revocation.test.ts +98 -0
- package/src/revocation.ts +0 -0
- package/src/routePolicy.test.ts +87 -0
- package/src/routePolicy.ts +72 -0
- package/src/runtimePolicy.test.ts +49 -0
- package/src/runtimePolicy.ts +81 -0
- package/src/runtimePolicyManager.test.ts +29 -0
- package/src/runtimePolicyManager.ts +50 -0
- package/src/runtimePolicyPresets.ts +43 -0
- package/src/signedResponse.test.ts +111 -0
- package/src/signedResponse.ts +83 -0
- package/src/webhookBinding.test.ts +144 -0
- package/src/webhookBinding.ts +115 -0
- package/src/wsBinding.test.ts +221 -0
- package/src/wsBinding.ts +100 -0
- package/tsconfig.json +15 -0
- package/tsconfig.lib.json +23 -0
- package/vite.lib.config.ts +16 -0
- package/agentAdapter.d.ts +0 -26
- package/conformanceVectors.d.ts +0 -20
- package/frameworkAdapters.d.ts +0 -72
- package/index.d.ts +0 -20
- package/index.js +0 -1702
- package/keyRotation.d.ts +0 -20
- package/mcpGateway.d.ts +0 -37
- package/mcpTransports.d.ts +0 -62
- package/mcpWrapper.d.ts +0 -83
- package/policyEnforcer.d.ts +0 -50
- package/policyTelemetryFeedback.d.ts +0 -11
- package/protocol.d.ts +0 -66
- package/protocolAgent.d.ts +0 -58
- package/protocolBinary.d.ts +0 -8
- package/protocolCapabilities.d.ts +0 -24
- package/protocolReplay.d.ts +0 -35
- package/protocolTransport.d.ts +0 -73
- package/redisClient.d.ts +0 -49
- package/replayStores.d.ts +0 -32
- package/revocation.d.ts +0 -71
- package/runtimePolicy.d.ts +0 -24
- package/runtimePolicyManager.d.ts +0 -15
- package/runtimePolicyPresets.d.ts +0 -11
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0",
|
|
3
|
+
"name": "gluv-runtime-policy",
|
|
4
|
+
"status": "active",
|
|
5
|
+
"owner": "platform-ai-ops",
|
|
6
|
+
"updated_at": "2026-05-10",
|
|
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
|
+
{
|
|
27
|
+
"when": { "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
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"when": { "latency_sensitive": true, "concurrency_lt": 100 },
|
|
34
|
+
"use": "ws-batch",
|
|
35
|
+
"rationale": "Balanced p99 and throughput."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"when": { "compatibility_first": true, "concurrency_lt": 100 },
|
|
39
|
+
"use": "http",
|
|
40
|
+
"rationale": "Lowest integration friction for low/medium load."
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"guardrails": {
|
|
45
|
+
"block_plain_http_high_concurrency": true,
|
|
46
|
+
"plain_http_block_threshold_concurrency": 100,
|
|
47
|
+
"allow_override_flag": "--allow-unsafe-http",
|
|
48
|
+
"override_allowed_only_for": "stress-benchmarks"
|
|
49
|
+
},
|
|
50
|
+
"tuning": {
|
|
51
|
+
"batch_size": {
|
|
52
|
+
"low_traffic": [4, 8],
|
|
53
|
+
"medium_traffic": [8, 32],
|
|
54
|
+
"high_traffic": [32, 64]
|
|
55
|
+
},
|
|
56
|
+
"inflight_cap": {
|
|
57
|
+
"low_traffic": [16, 64],
|
|
58
|
+
"medium_traffic": [64, 256],
|
|
59
|
+
"high_traffic": [256, 1024]
|
|
60
|
+
},
|
|
61
|
+
"retry_backoff_ms": {
|
|
62
|
+
"low_traffic": [1, 2],
|
|
63
|
+
"medium_traffic": [2, 8],
|
|
64
|
+
"high_traffic": [4, 16]
|
|
65
|
+
},
|
|
66
|
+
"max_retry_attempts": 3,
|
|
67
|
+
"retriable_status_codes": [503]
|
|
68
|
+
},
|
|
69
|
+
"adaptive_flow": {
|
|
70
|
+
"enabled": true,
|
|
71
|
+
"ewma_latency_alpha": 0.15,
|
|
72
|
+
"degrade_if_latency_ms_gt": 25,
|
|
73
|
+
"recover_if_latency_ms_lt": 8,
|
|
74
|
+
"reduce_inflight_factor_on_error": 0.85,
|
|
75
|
+
"reduce_batch_factor_on_error": 0.8
|
|
76
|
+
},
|
|
77
|
+
"benchmark_policy": {
|
|
78
|
+
"production_readiness": {
|
|
79
|
+
"require_adaptive_mode": true,
|
|
80
|
+
"commands": [
|
|
81
|
+
"npm run bench:openloop:quick",
|
|
82
|
+
"npm run bench:openloop:full"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"stress_characterization": {
|
|
86
|
+
"allowed": true,
|
|
87
|
+
"commands": [
|
|
88
|
+
"npm run bench:openloop:stress:quick",
|
|
89
|
+
"npm run bench:openloop:stress:full"
|
|
90
|
+
],
|
|
91
|
+
"note": "Stress outputs must not be used as direct SLO acceptance."
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"runtime_decision_tree": [
|
|
95
|
+
{ "if": "concurrency >= 100", "then": "use http-binary-batch" },
|
|
96
|
+
{
|
|
97
|
+
"if": "drop_pct > drop_pct_max",
|
|
98
|
+
"then": [
|
|
99
|
+
"reduce inflight cap",
|
|
100
|
+
"reduce batch size",
|
|
101
|
+
"increase retry backoff",
|
|
102
|
+
"switch to binary-batch mode"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"if": "p99_ms > p99_ms_max",
|
|
107
|
+
"then": [
|
|
108
|
+
"reduce batch size",
|
|
109
|
+
"reduce inflight cap",
|
|
110
|
+
"re-run adaptive benchmark"
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"operator_handoff_required_fields": [
|
|
115
|
+
"mode",
|
|
116
|
+
"payload_bytes",
|
|
117
|
+
"concurrency",
|
|
118
|
+
"benchmark_type",
|
|
119
|
+
"p50_ms",
|
|
120
|
+
"p95_ms",
|
|
121
|
+
"p99_ms",
|
|
122
|
+
"drop_pct",
|
|
123
|
+
"retry_count",
|
|
124
|
+
"overload_signals"
|
|
125
|
+
]
|
|
126
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
|
@@ -0,0 +1,65 @@
|
|
|
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.
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
|
@@ -0,0 +1,169 @@
|
|
|
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:
|
|
@@ -0,0 +1,23 @@
|
|
|
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.
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
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.
|