Boundary
Runtime credentials stay scoped to project, application, environment, and capability.
FRAMEWORK
Resolve governed behavior before generation, preserve native AI SDK streaming, and record the exact behavior identity when generation finishes.
EXECUTION BOUNDARY
IDENTITY PRESERVED
SUPPORTED OPERATIONS
resolve before generation
prepend the compiled provider projection
preserve streaming and non-streaming calls
record finish output against the resolve-issued trace
run shadow execution out of band when configured
IMPLEMENTATION HOOK
This example mirrors the repository documentation. The exact API contract remains in Docs and source.
import { createViraMiddleware } from "@vira-behavior/ai-sdk";
const runtimeClient = { resolve: async (request: Parameters<typeof vira.resolve>[0]) => { const resolved = await vira.resolve(request); if (!resolved) throw new Error("VIRA_BEHAVIOR_NOT_RESOLVED"); return resolved; } };
const middleware = createViraMiddleware({ client: runtimeClient, request: resolveRequest });
// Wrap the existing model; streaming stays native.SECURITY BOUNDARY
Runtime credentials stay scoped to project, application, environment, and capability.
Control-plane publish authority is not granted to ordinary runtime middleware.
LIMITATIONS