@spctre/policy-schema
v0.9.0
Published
Shared types and logic for governed agent systems
Readme
@spctre/policy-schema
Shared types and logic for governed agent systems — the schema layer that Spctre and AGT-compatible enforcement runtimes use to author, compose, evaluate, and prove policies.
This package is stack-neutral TypeScript. A small, performance-critical subset (gateway/policy evaluation and operations-log integrity hashing) is backed by a native Rust addon that loads lazily on first use.
Install
npm install @spctre/policy-schemaUsage
Types, policy packs, and the import/export and composition helpers are pure TypeScript and work on any platform:
import { POLICY_PACKS, getPackVersion } from "@spctre/policy-schema/packs";
import type { PolicyPack } from "@spctre/policy-schema/types";
for (const pack of POLICY_PACKS) {
console.log(pack.id, getPackVersion(pack));
}import { evaluatePublishReadiness, buildPolicyBundleExport } from "@spctre/policy-schema";Native-backed functions
evaluateGatewayDecision, evaluateRuntimePolicyDecision,
buildOperationsContentHash, and validateOperationsLogChain call into the
native addon. They resolve the prebuilt binary the first time they are invoked;
importing the package never requires the addon.
import { evaluateGatewayDecision } from "@spctre/policy-schema";
const result = evaluateGatewayDecision(input); // loads the native addon on first callPlatform support
Prebuilt binaries are published for:
darwin-arm64,darwin-x64linux-x64-gnu,linux-arm64-gnu
On other platforms the pure-TypeScript surface still works; the native-backed functions throw a clear error explaining how to build the addon from source:
pnpm --filter @spctre/policy-schema build:nativeBuilding from source requires a Rust toolchain (see native/rust-toolchain.toml).
License
Apache-2.0.
