Completing the next-phase specs (P6-P10 now all coded): P6 Collaboration (specs/collaboration) — project roles owner/editor/viewer enforced server-side at every mutation (viewer 403, owner-only membership + approval); immutable world revision lineage (content hash + derivation discovered/edited/composed/imported + monotonic number, retrievable); annotations + review state machine (draft->in_review->approved|rejected, audit events to the bus); deterministic index merge that returns conflicts rather than overwriting. +15 API tests (168 pass native-absent). P7 Streaming discovery (specs/streaming-discovery) — CLI lawsynth stream + SDK Study.stream/stream_discover: explicit window policy (sliding/growing, time units, bounded memory), sustained-drift-triggered re-discovery (distinguishes outlier from regime change), change records with per-law term diffs, byte-for- byte replay determinism. Honestly documented as batched re-discovery, not incremental. Regime switch at t=8 detected with exact differing terms. +CLI/SDK tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
LawSynth API
lawsynth-api is the HTTP process for LawSynth's Python domain core. It is a
stdlib WSGI adapter, not a second implementation of projects, datasets,
worlds, simulations, artifacts, events, or idempotency. Those operations are
dispatched directly to lawsynth_server.Application.
Run the loopback-only development process after installing both local packages:
lawsynth-api --host 127.0.0.1 --port 8080
For a deployment, run a WSGI server behind TLS and import
lawsynth_api.main:application:
gunicorn --bind 127.0.0.1:8080 --workers 1 lawsynth_api.main:application
The alpha domain repositories are intentionally process-local, so run one API worker behind a load balancer; the service does not claim distributed metadata or remote worker execution it does not have.
The process accepts JSON objects only. Writes require both a bearer token and
an Idempotency-Key; those are passed unchanged to the domain core. Configure
local bearer grants through LAWSYNTH_API_TOKENS_JSON, for example:
{"a-long-secret-token":{"organization_id":"acme","scopes":["read","write"]}}
In production, LAWSYNTH_DATABASE_URL must name durable SQLite storage and
LAWSYNTH_OBJECT_ROOT must be an absolute path. The API deliberately returns
503 native_unavailable when an executable native LawSynth runtime is absent,
and 501 worker_transport_unavailable for /v1/worker/*: this process does
not pretend to be a worker gateway.