@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
package/src/wsBinding.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
signEnvelopeEd25519, verifyEnvelopeEd25519,
|
|
3
|
+
createEnvelope, validateEnvelope,
|
|
4
|
+
generateEd25519KeypairBase64Url, type ProtocolEnvelope
|
|
5
|
+
} from './protocol'
|
|
6
|
+
import type { KeyRegistry } from './keyRegistry'
|
|
7
|
+
|
|
8
|
+
export { type KeyRegistry, generateEd25519KeypairBase64Url }
|
|
9
|
+
|
|
10
|
+
// Minimal WebSocket interface (works with browser WebSocket, ws library, etc.)
|
|
11
|
+
export interface WebSocketLike {
|
|
12
|
+
send(data: string): void
|
|
13
|
+
addEventListener(event: 'message', handler: (e: { data: string | Buffer }) => void): void
|
|
14
|
+
addEventListener(event: 'close', handler: () => void): void
|
|
15
|
+
removeEventListener(event: string, handler: (...args: unknown[]) => void): void
|
|
16
|
+
readyState?: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface WsBindingOptions {
|
|
20
|
+
privateKey: string
|
|
21
|
+
sender: string
|
|
22
|
+
recipient?: string
|
|
23
|
+
keyRegistry: KeyRegistry // to look up peer public keys by sender ID
|
|
24
|
+
ttlMs?: number // per-frame TTL, default 30_000
|
|
25
|
+
onVerifyFail?: (err: Error, rawData: string) => void
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ProtectedWebSocket {
|
|
29
|
+
// Send a payload — automatically signs it
|
|
30
|
+
send(payload: unknown): Promise<void>
|
|
31
|
+
// Register handler for verified incoming messages
|
|
32
|
+
onMessage(handler: (payload: unknown, envelope: ProtocolEnvelope) => void): void
|
|
33
|
+
// Register handler for verify failures (optional)
|
|
34
|
+
onVerifyFail(handler: (err: Error, rawData: string) => void): void
|
|
35
|
+
// Sequence number of last sent message
|
|
36
|
+
readonly seq: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function wrapWebSocket(ws: WebSocketLike, opts: WsBindingOptions): ProtectedWebSocket {
|
|
40
|
+
let seq = 0
|
|
41
|
+
const messageHandlers: Array<(payload: unknown, envelope: ProtocolEnvelope) => void> = []
|
|
42
|
+
const failHandlers: Array<(err: Error, rawData: string) => void> = []
|
|
43
|
+
|
|
44
|
+
function fireVerifyFail(err: Error, raw: string) {
|
|
45
|
+
opts.onVerifyFail?.(err, raw)
|
|
46
|
+
for (const h of failHandlers) h(err, raw)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Listen for incoming frames
|
|
50
|
+
const messageListener = async (e: { data: string | Buffer }) => {
|
|
51
|
+
const raw = typeof e.data === 'string' ? e.data : e.data.toString('utf8')
|
|
52
|
+
let envelope: ProtocolEnvelope
|
|
53
|
+
try { envelope = JSON.parse(raw) as ProtocolEnvelope }
|
|
54
|
+
catch (err) { fireVerifyFail(new Error('malformed frame'), raw); return }
|
|
55
|
+
|
|
56
|
+
const sender = envelope?.header?.sender
|
|
57
|
+
if (!sender) { fireVerifyFail(new Error('missing sender'), raw); return }
|
|
58
|
+
|
|
59
|
+
const publicKey = await opts.keyRegistry.getPublicKey(sender)
|
|
60
|
+
if (!publicKey) { fireVerifyFail(new Error(`unknown sender: ${sender}`), raw); return }
|
|
61
|
+
|
|
62
|
+
const valid = await verifyEnvelopeEd25519(envelope, publicKey).catch(() => false)
|
|
63
|
+
if (!valid) { fireVerifyFail(new Error('invalid signature'), raw); return }
|
|
64
|
+
|
|
65
|
+
const diags = validateEnvelope(envelope)
|
|
66
|
+
if (diags.some(d => d.level === 'error')) {
|
|
67
|
+
fireVerifyFail(new Error(`envelope invalid: ${diags.map(d => d.message).join('; ')}`), raw)
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let payload: unknown = envelope.body.content
|
|
72
|
+
try { payload = JSON.parse(envelope.body.content) } catch { /* keep as string */ }
|
|
73
|
+
for (const h of messageHandlers) h(payload, envelope)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
ws.addEventListener('message', messageListener as any)
|
|
77
|
+
ws.addEventListener('close', () => {
|
|
78
|
+
ws.removeEventListener('message', messageListener as any)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
get seq() { return seq },
|
|
83
|
+
async send(payload: unknown): Promise<void> {
|
|
84
|
+
const content = typeof payload === 'string' ? payload : JSON.stringify(payload)
|
|
85
|
+
const envelope = createEnvelope({
|
|
86
|
+
sender: opts.sender,
|
|
87
|
+
recipient: opts.recipient,
|
|
88
|
+
ttlMs: opts.ttlMs ?? 30_000,
|
|
89
|
+
intent: 'TASK',
|
|
90
|
+
content,
|
|
91
|
+
})
|
|
92
|
+
// embed sequence number in correlationId to help downstream ordering
|
|
93
|
+
;(envelope.body as any).correlationId = String(++seq)
|
|
94
|
+
const signed = await signEnvelopeEd25519(envelope, opts.privateKey)
|
|
95
|
+
ws.send(JSON.stringify(signed))
|
|
96
|
+
},
|
|
97
|
+
onMessage(handler) { messageHandlers.push(handler) },
|
|
98
|
+
onVerifyFail(handler) { failHandlers.push(handler) },
|
|
99
|
+
}
|
|
100
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2023", "DOM"],
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"verbatimModuleSyntax": false
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*.ts", "scripts/**/*.ts"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"emitDeclarationOnly": true,
|
|
8
|
+
"declarationMap": false,
|
|
9
|
+
"sourceMap": false,
|
|
10
|
+
"outDir": "./dist/protocol",
|
|
11
|
+
"rootDir": "./src",
|
|
12
|
+
"stripInternal": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"types": ["node"],
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true,
|
|
18
|
+
"noFallthroughCasesInSwitch": true,
|
|
19
|
+
"noUncheckedSideEffectImports": true
|
|
20
|
+
},
|
|
21
|
+
"include": ["src/**/*.ts"],
|
|
22
|
+
"exclude": ["src/**/*.test.ts", "src/**/*.bench.ts"]
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
build: {
|
|
5
|
+
lib: {
|
|
6
|
+
entry: 'src/index.ts',
|
|
7
|
+
formats: ['es'],
|
|
8
|
+
fileName: () => 'index.js',
|
|
9
|
+
},
|
|
10
|
+
outDir: 'dist/protocol',
|
|
11
|
+
emptyOutDir: false,
|
|
12
|
+
rollupOptions: {
|
|
13
|
+
external: [],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
})
|
package/agentAdapter.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type AgentReceiveResult, type AgentSessionConfig } from './protocolAgent';
|
|
2
|
-
import { type IntentKind, type ProtocolEnvelope } from './protocol';
|
|
3
|
-
import { type WireEnvelope, type WireFormat } from './protocolTransport';
|
|
4
|
-
export interface AipAdapterConfig extends AgentSessionConfig {
|
|
5
|
-
wireFormat?: WireFormat;
|
|
6
|
-
}
|
|
7
|
-
export declare class AipAgentAdapter {
|
|
8
|
-
private readonly session;
|
|
9
|
-
private readonly wireFormat;
|
|
10
|
-
constructor(config: AipAdapterConfig);
|
|
11
|
-
toRaw(envelope: ProtocolEnvelope): WireEnvelope;
|
|
12
|
-
createRawIntent(input: {
|
|
13
|
-
recipient?: string;
|
|
14
|
-
intent: IntentKind;
|
|
15
|
-
content: string;
|
|
16
|
-
capability?: string;
|
|
17
|
-
correlationId?: string;
|
|
18
|
-
ttlMs?: number;
|
|
19
|
-
messageId?: string;
|
|
20
|
-
nonce?: string;
|
|
21
|
-
nowMs?: number;
|
|
22
|
-
}): Promise<WireEnvelope>;
|
|
23
|
-
receiveRaw(raw: WireEnvelope, nowMs?: number): Promise<AgentReceiveResult>;
|
|
24
|
-
handleRaw(raw: WireEnvelope, emitResponseRaw: (rawResponse: WireEnvelope, responseEnvelope: ProtocolEnvelope) => void | Promise<void>, nowMs?: number): Promise<AgentReceiveResult>;
|
|
25
|
-
}
|
|
26
|
-
export declare function createAipAgentAdapter(config: AipAdapterConfig): AipAgentAdapter;
|
package/conformanceVectors.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ProtocolEnvelope } from './protocol';
|
|
2
|
-
export interface ConformanceVector {
|
|
3
|
-
id: string;
|
|
4
|
-
secret: string;
|
|
5
|
-
keyId: string;
|
|
6
|
-
envelope: Omit<ProtocolEnvelope, 'signature'>;
|
|
7
|
-
canonical: string;
|
|
8
|
-
signature: string;
|
|
9
|
-
}
|
|
10
|
-
export interface Ed25519ConformanceVector {
|
|
11
|
-
id: string;
|
|
12
|
-
keyId: string;
|
|
13
|
-
publicKey: string;
|
|
14
|
-
privateKey: string;
|
|
15
|
-
envelope: Omit<ProtocolEnvelope, 'signature'>;
|
|
16
|
-
canonical: string;
|
|
17
|
-
signature: string;
|
|
18
|
-
}
|
|
19
|
-
export declare const AIP_V01_CONFORMANCE_VECTORS: ConformanceVector[];
|
|
20
|
-
export declare const AIP_V01_ED25519_CONFORMANCE_VECTORS: Ed25519ConformanceVector[];
|
package/frameworkAdapters.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { type AipAgentAdapter } from './agentAdapter';
|
|
2
|
-
import { type ProtocolEnvelope } from './protocol';
|
|
3
|
-
import { type WireEnvelope } from './protocolTransport';
|
|
4
|
-
export interface LangChainMessageLike {
|
|
5
|
-
content: string;
|
|
6
|
-
name?: string;
|
|
7
|
-
additionalKwargs?: Record<string, unknown>;
|
|
8
|
-
}
|
|
9
|
-
export interface LlamaIndexMessageLike {
|
|
10
|
-
role: 'user' | 'assistant' | 'system';
|
|
11
|
-
content: string;
|
|
12
|
-
additionalKwargs?: Record<string, unknown>;
|
|
13
|
-
}
|
|
14
|
-
export interface JsonRpcError {
|
|
15
|
-
code: number;
|
|
16
|
-
message: string;
|
|
17
|
-
data?: unknown;
|
|
18
|
-
}
|
|
19
|
-
export interface JsonRpcRequestLike {
|
|
20
|
-
jsonrpc: '2.0';
|
|
21
|
-
id: string | number;
|
|
22
|
-
method: string;
|
|
23
|
-
params?: unknown;
|
|
24
|
-
}
|
|
25
|
-
export interface JsonRpcResponseLike {
|
|
26
|
-
jsonrpc: '2.0';
|
|
27
|
-
id: string | number;
|
|
28
|
-
result?: unknown;
|
|
29
|
-
error?: JsonRpcError;
|
|
30
|
-
}
|
|
31
|
-
export interface JsonRpcBridgeOptions {
|
|
32
|
-
recipient?: string;
|
|
33
|
-
allowedMethods?: readonly string[];
|
|
34
|
-
methodToCapability?: (method: string) => string;
|
|
35
|
-
authorizeMethod?: (request: JsonRpcRequestLike, context: JsonRpcPolicyContext) => boolean | Promise<boolean>;
|
|
36
|
-
rateLimitKey?: (request: JsonRpcRequestLike, context: JsonRpcPolicyContext) => string;
|
|
37
|
-
rateLimiter?: {
|
|
38
|
-
consume: (key: string, request: JsonRpcRequestLike, context: JsonRpcPolicyContext) => boolean | Promise<boolean>;
|
|
39
|
-
};
|
|
40
|
-
onPolicyEvent?: (event: JsonRpcPolicyEvent) => void | Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
export interface JsonRpcPolicyContext {
|
|
43
|
-
intent: 'TASK';
|
|
44
|
-
recipient?: string;
|
|
45
|
-
capability: string;
|
|
46
|
-
correlationId: string;
|
|
47
|
-
createdAtMs: number;
|
|
48
|
-
}
|
|
49
|
-
export interface JsonRpcPolicyEvent {
|
|
50
|
-
stage: 'allowlist' | 'authorize' | 'rateLimit';
|
|
51
|
-
decision: 'allow' | 'deny';
|
|
52
|
-
method: string;
|
|
53
|
-
context: JsonRpcPolicyContext;
|
|
54
|
-
reason?: string;
|
|
55
|
-
}
|
|
56
|
-
export interface JsonRpcResponseOptions {
|
|
57
|
-
defaultErrorCode?: number;
|
|
58
|
-
}
|
|
59
|
-
export declare function createRawTaskFromLangChain(adapter: AipAgentAdapter, message: LangChainMessageLike, options?: {
|
|
60
|
-
recipient?: string;
|
|
61
|
-
capability?: string;
|
|
62
|
-
correlationId?: string;
|
|
63
|
-
}): Promise<WireEnvelope>;
|
|
64
|
-
export declare function toLangChainMessage(envelope: ProtocolEnvelope): LangChainMessageLike;
|
|
65
|
-
export declare function createRawTaskFromLlamaIndex(adapter: AipAgentAdapter, message: LlamaIndexMessageLike, options?: {
|
|
66
|
-
recipient?: string;
|
|
67
|
-
capability?: string;
|
|
68
|
-
correlationId?: string;
|
|
69
|
-
}): Promise<WireEnvelope>;
|
|
70
|
-
export declare function toLlamaIndexMessage(envelope: ProtocolEnvelope): LlamaIndexMessageLike;
|
|
71
|
-
export declare function createRawTaskFromJsonRpc(adapter: AipAgentAdapter, request: JsonRpcRequestLike, options?: JsonRpcBridgeOptions): Promise<WireEnvelope>;
|
|
72
|
-
export declare function toJsonRpcResponse(envelope: ProtocolEnvelope, id: string | number, options?: JsonRpcResponseOptions): JsonRpcResponseLike;
|
package/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export * from './protocol';
|
|
2
|
-
export * from './protocolTransport';
|
|
3
|
-
export * from './protocolBinary';
|
|
4
|
-
export * from './protocolCapabilities';
|
|
5
|
-
export * from './protocolReplay';
|
|
6
|
-
export * from './keyRotation';
|
|
7
|
-
export * from './protocolAgent';
|
|
8
|
-
export * from './agentAdapter';
|
|
9
|
-
export * from './frameworkAdapters';
|
|
10
|
-
export * from './mcpGateway';
|
|
11
|
-
export * from './runtimePolicy';
|
|
12
|
-
export * from './policyEnforcer';
|
|
13
|
-
export * from './runtimePolicyManager';
|
|
14
|
-
export * from './runtimePolicyPresets';
|
|
15
|
-
export * from './policyTelemetryFeedback';
|
|
16
|
-
export * from './redisClient';
|
|
17
|
-
export * from './replayStores';
|
|
18
|
-
export * from './revocation';
|
|
19
|
-
export * from './mcpWrapper';
|
|
20
|
-
export * from './mcpTransports';
|