TypeScript SDK
Server SDK
Connect TypeScript agents to the hosted Edictum control plane.
AI Assistance
Right page if: you want the current TypeScript server package and createServerGuard() flow. Wrong page if: you want local-only rulesets without a server -- see https://docs.edictum.ai/docs/typescript. Gotcha: the current TypeScript server package requires bundleName on the canonical /v1 API.
Use @edictum/server when you want remote rulesets, SSE hot reload, approval
integration, and workspace event delivery from the hosted control plane.
Install
pnpm add @edictum/core @edictum/server js-yamlQuick Start
import { createServerGuard } from '@edictum/server'
const { guard, client, close } = await createServerGuard({
url: 'https://api.edictum.ai',
apiKey: 'edk_...',
agentId: 'docs-agent',
environment: 'production',
bundleName: 'production-rules',
})Important Current Behavior
createServerGuard()is async- the current TypeScript package requires
bundleName - server-assigned bundle mode is not supported by the canonical
/v1API path in TypeScript close()should be called on shutdown
Key Options
| Option | Meaning |
|---|---|
url | Base URL for edictum-api |
apiKey | Workspace API key with edk_ prefix |
agentId | Stable agent identity |
environment | Environment label, default production |
bundleName | Required ruleset name for the current TS server path |
autoWatch | Enables SSE hot reload |
verifySignatures | Enables ruleset signature verification |
signingPublicKey | Public key used for verification |
allowInsecure | Dev-only override for non-loopback HTTP |
onWatchError | Callback for stream/reload errors |
Transport Surface
The TypeScript server package talks to:
GET /v1/rulesets/{name}/currentGET /v1/streamPOST /v1/events/v1/approvals/v1/sessions/*
Example with an Adapter
import { createServerGuard } from '@edictum/server'
import { VercelAIAdapter } from '@edictum/vercel-ai'
const { guard, close } = await createServerGuard({
url: 'https://api.edictum.ai',
apiKey: 'edk_...',
agentId: 'docs-agent',
environment: 'production',
bundleName: 'production-rules',
})
const adapter = new VercelAIAdapter(guard)Low-Level Client
import { EdictumServerClient } from '@edictum/server'
const client = new EdictumServerClient({
baseUrl: 'https://api.edictum.ai',
apiKey: 'edk_...',
agentId: 'docs-agent',
env: 'production',
bundleName: 'production-rules',
})Related
Last updated on