@orchestree/acceptance-schema
v1.0.0
Published
Canonical JSON schema for Crowgent acceptance events. Capability 0.2 of the Self-Improvement Layer Spec.
Readme
@orchestree/acceptance-schema
Canonical JSON schema for the 17 Crowgent acceptance-signal event types. Capability 0.2 of the Self-Improvement Layer Spec (2026-05-27).
Why this package
The Wave C ingest endpoint (POST /v1/agents/:id/eval) validates events with a hand-rolled validateEvent function. That works but couples the validation contract to the runtime code. This package extracts the contract into a JSON Schema (draft-07) so that:
- Frontend can validate locally before POSTing (saves a round-trip on malformed payloads).
- SDK consumers can validate their telemetry emission against the same schema the backend enforces.
- Auditors can inspect the contract as data, not code.
- Future versions can be tracked as
v2.json,v3.json, … without conditional code-branch logic in the runtime validator.
Usage
import schema from '@orchestree/acceptance-schema/v1.json'
import Ajv from 'ajv'
const ajv = new Ajv({ allErrors: false, useDefaults: false })
const validate = ajv.compile(schema)
if (!validate(payload)) {
// validate.errors is an array of { instancePath, message, ... }
}Versioning policy
- v1 (this version): the 17-event union as of 2026-05-27. Adding new optional fields is backward-compatible and stays in v1. Adding new event types is backward-compatible (older clients don't emit them; newer clients do) and stays in v1.
- v2: only if a breaking change ships (e.g., a required field changes type, a field is removed). Backwards-compat strictly maintained — the backend accepts both v1 and v2 for the deprecation window.
Schema shape
Every event has these required top-level fields:
type(enum of 17 values)ts(ms-since-epoch number)agentId(non-empty string; server-validates it matches the route's:id)userId(string or null; server-resolved from auth session)surface(one ofharness | chat | workflow | connector | replay | catalog)
Each event type has its own additional required fields, enforced via JSON Schema if/then clauses. See v1.json for the full per-type requirements.
Out of scope for this package
- Runtime validation — that lives in
apps/api/src/conductor/eval/validateEventV1.tsand consumes this schema. - Type definitions — TypeScript types are derived from the discriminated union at
apps/web/src/features/crowgent/lib/useAcceptanceSignalStore.ts. This schema is the runtime-validatable parallel of that TS union. - Server-side enforcement of
agentIdroute-param match — that's a route-handler concern, not a schema concern.
