TypeScript SDK Parity
The Pavri TypeScript SDK (@pavri/sdk) is at capability parity with the Python SDK for all P0 and P1 features as of P2-S6.
Current Status: Signed Off (P2-S6)
All required capabilities have been implemented, tested, and signed off. See the full parity matrix at docs/phase2/typescript-sdk-parity-matrix.md.
Capability Summary
| # | Capability | Status | Location |
|---|---|---|---|
| 1 | Config / Bootstrap | Complete | src/config.ts |
| 2 | Agent Registration | Complete | src/identity.ts |
| 3 | Telemetry / Event Export | Complete | src/telemetry.ts |
| 4 | Policy Fetch & Cache | Complete | src/policy.ts |
| 5 | Runtime Log Forwarding | Complete | src/models.ts (RuntimeLogRecord) |
| 6 | Trace Link Capture | Complete | src/models.ts (ProviderTraceLink) |
| 7 | Policy Enforcement | Complete | src/policy.ts + src/errors.ts |
| 8 | Execution Governance Hooks | Complete | src/models.ts (GovernanceMetadata) |
| 9 | Threat Detection (Local) | Out of scope | Python-only; TS uses backend API |
| 10 | Framework Plugins | Complete | src/plugins/generic.ts |
| 11 | Transport | Complete | src/transport.ts + src/client.ts |
| 12 | Identity / Fingerprinting | Complete | src/identity.ts |
Quick Start (Node.js)
import { secure, createConfig } from "@pavri/sdk";
const config = createConfig({
endpoint: "http://localhost:50051",
agentName: "my-node-agent",
framework: "generic",
team: "platform",
environment: "production",
});
const runtime = await secure(config);
Policy Enforcement
The TypeScript SDK enforces policies and throws PolicyDeniedError for denied actions:
import { PolicyDeniedError } from "@pavri/sdk";
try {
await runtime.enforce({ action: "tool_call", target: "exec_shell" });
} catch (err) {
if (err instanceof PolicyDeniedError) {
console.log("Denied by policy:", err.policyId, err.ruleId);
}
}
Governance Metadata
Governance metadata is emitted alongside telemetry:
import { GovernanceMetadata } from "@pavri/sdk";
// GovernanceMetadata is automatically attached to telemetry events
// by the PavriRuntime when enforcement runs
Differences from Python SDK
| Area | Python SDK | TypeScript SDK |
|---|---|---|
| Local threat detection | Built-in heuristics + ML baseline | Not available (backend detection only) |
| MCP scanner | CLI preflight tool | Not available |
| Framework plugins | 7 (LangGraph, CrewAI, OpenAI, Claude, ADK, AutoGen, Generic) | 1 (GenericAdapter + plugin registry) |
| Behavioral baselining | Available (core/behavioral_baseline.py) | Not available |
These differences are intentional. TS agents rely on the Pavri backend for detection and scoring.
Contract Verification
Cross-SDK contract tests are at:
sdk/typescript/tests/unit/models.test.ts— model structural paritysdk/typescript/tests/unit/enums.test.ts— enum value paritysdk/typescript/tests/unit/audit-contract.test.ts— audit event contractssdk/typescript/tests/unit/discovery-contract.test.ts— discovery contractssdk/typescript/tests/unit/rbac-contract.test.ts— RBAC contracts