Compatibility: Pactmark 0.1.x. Exact internal package versions share one release version for the v0.1 line. Every package is published under the @pactmark scope except create-pactmark.

Portable kernel

Provider-neutral domain
Schemas, ports, events, authority types, canonical JSON and digests, and the stable KAF_* error registry. Depends on Zod and nothing else.
Run orchestration kernel
Drives runs over the ports defined in core. Owns transitions, step execution, retry classification and the effect ledger interaction.
Default-deny decisions
Admission, canonicalization, authorization reservations, effect strategies, grants, kill switches, policy evaluation, reason codes and secret handling.
Artifacts, verification, evidence
Content-addressed artifacts, verification binding, evidence export, redaction and pattern maturity.
Authoring surface
What most applications import. defineAgent, defineTool, definePolicy, defineInstructions, createRuntime, createLocalRuntime, createLocalAuthorityIssuer, evaluateRuntimeReadiness, plus re-exports of the core pieces you need to author with.

Execution and test

Declared tool execution
createDeclaredToolExecutor and fail-closed egress brokers such as createDenyAllEgressBroker.
Deterministic fakes and contract suites
FakeClock, SequenceIdGenerator, FakeModelDriver, FakeTool, FakeToolExecutor, CrashInjector, crashAtEveryBoundary, ScenarioBuilder, store contract suites and contract fixtures. Never part of a production export.

Storage and workers

Development only
Deterministic, tenant-scoped, ephemeral stores. Excellent for tests; disqualifying for production, and readiness says so.
Durable stores
Tenant-scoped PostgreSQL stores. The Postgres driver is owned here and is never imported by core, runtime, agent or CLI production code.
Fenced worker loop
Durable wake-up claiming with database-time leases and fencing tokens.

Transport and protocol

Web-standard HTTP adapter
createAgentFetchHandler and createOpenApiDocument. Implements start, resume, inspect, events, input, decisions, reconciliation, compensation, cancellation, health and readiness.
node:http bridge
createPactmarkNodeServer, createNodeRequestListener, closeNodeServer, installGracefulShutdown. Streams responses and propagates client disconnects as an AbortSignal.
Next.js route adapter
createVercelRouteHandler. A thin wrapper over the HTTP handler supplying request-time environment, signal, waitUntil and capabilities.
Experimental Worker subset
Web-standard handler for the Workers runtime. Portable-core only; Node-specific capabilities fail closed.
Guarded MCP client
Tested stdio and Streamable HTTP transports. Server metadata and output are treated as untrusted; discovery never grants authority.

Integration and tooling

Vercel AI SDK adapter
Optional peer integration. Normalizes supported model calls while the Pactmark runtime keeps ownership of policy and tools.
Opt-in metadata telemetry
OpenTelemetry API as an optional peer. Metadata-only by default; remote export is off by default.
The pactmark binary
Run, inspect, doctor, eval, evidence, migrate, reconciliation and compensation surfaces over injected host adapters.
Deterministic offline initializer
Plans every file with a digest, prints the plan, then writes. Templates: vercel-next, node-server, cloudflare-worker, library.

The dependency rule

Core must not depend on a proprietary model gateway, provider HTTP client, platform SDK, deployment CLI, telemetry exporter, or hosted database SDK. This is enforced by dependency-boundary checks in CI, not by review discipline.
Provider clients belong to consuming applications or to the relevant adapter as peer or optional dependencies.

Typical import sets

Agent API

The full @pactmark/agent surface.

Architecture

Why the layering is shaped this way.