@loop-engine/runtime-routes
v1.0.0-rc.1
Published
Route handler factories for the RT-01 frozen Loop Engine runtime API. Mounted by the OSS self-host app (`apps/loop-engine-runtime`).
Downloads
104
Maintainers
Readme
@loop-engine/runtime-routes
Route handler factories for the RT-01 frozen Loop Engine runtime API surface, consumed by the OSS self-host app apps/loop-engine-runtime.
What's inside
| Factory | Mounts |
| --- | --- |
| createRunDetailHandler(ctx) | GET /api/v1/runs/{id} |
| createRunHistoryHandler(ctx) | GET /api/v1/runs/{id}/history |
| createRunEvidenceHandler(ctx) | GET /api/v1/runs/{id}/evidence |
| createRunTimelineHandler(ctx) | GET /api/v1/runs/{id}/timeline |
| createRunReplaySummaryHandler(ctx) | GET /api/v1/runs/{id}/replay-summary |
| createMetadataConnectionsHandler() | GET /api/v1/metadata/connections |
Each factory takes the RuntimeContext exported from @loop-engine/runtime-core (auth adapter, entitlements adapter, trace store, trace repository, traceReadEnabled flag) and returns a Web standard (request, ctx) => Promise<Response> handler. The OSS app re-exports each as GET from its Next.js Route Handler files.
Run-scoped routes go through withPersistedRunRead, which enforces the frozen RT-01 contract:
LOOP_TRACE_ENABLEDgate (503 when disabled).AuthAdapter.authenticate(401 on miss).assertRuntimeAllowedon the entitlements snapshot (403 on tier 0).- In-process sliding-window rate limit per tenant (429 on overrun).
traceRepository.getRunSummary→ 404 if missing.- Build response and serialize as JSON.
Tests
pnpm --filter @loop-engine/runtime-routes testTests use MemoryAuthAdapter, MemoryEntitlementsAdapter, and an in-memory trace store/repository — no Postgres required.
License
Apache-2.0. See LICENSE.
