Edictum
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-yaml

Quick 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 /v1 API path in TypeScript
  • close() should be called on shutdown

Key Options

OptionMeaning
urlBase URL for edictum-api
apiKeyWorkspace API key with edk_ prefix
agentIdStable agent identity
environmentEnvironment label, default production
bundleNameRequired ruleset name for the current TS server path
autoWatchEnables SSE hot reload
verifySignaturesEnables ruleset signature verification
signingPublicKeyPublic key used for verification
allowInsecureDev-only override for non-loopback HTTP
onWatchErrorCallback for stream/reload errors

Transport Surface

The TypeScript server package talks to:

  • GET /v1/rulesets/{name}/current
  • GET /v1/stream
  • POST /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',
})

Last updated on

On this page