@volter/twin-vgauth
v1.0.0
Published
The vgauth twin (Protocol 3).
Readme
VGAI auth
This twin serves Volter Editor’s first-party account broker at auth.videogame.ai: discovery, PKCE broker wrapping, provider token forwarding, identity verification, and collaboration handoffs, invitations and redemption. Its source is the deployed archive/launch-scope-2026-09-20 tag of volter-ai/vgai-engine, whose packages/vgai-auth bytes match 8623e308 (spec/SOURCE.md).
The same-site /__clerk/{path} proxy accepts GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS and TRACE, as the pinned Worker routes it without a method guard. It forwards the incoming method, body bytes, query and headers to the Clerk companion at frontend-api.clerk.dev, adding the Worker’s three proxy headers. Bodies are opaque even when labelled JSON. Upstream bodies, cookies, status and manual redirects pass through unchanged; Cache-Control, Referrer-Policy, Strict-Transport-Security and X-Content-Type-Options are unconditionally replaced by the Worker’s hardened values; Clerk’s unsupported flows keep its own refusal.
The deployed public client is vgai-editor (wrangler.toml:36). The provider configuration door cannot change it. The pinned editor requests volter-editor (managed-account-defaults.ts:21; account-service.ts:1235), so its real authorization request gets 400. Fixing that editor default belongs in the editor repository.
POST /_twin/configuration sets synthetic Clerk secret/publishable keys, clerkApi, OAuth provider URLs, webCallback, authorizedParties, and binding switches. With the production default clerkApi empty, invitation delivery validates the host-bound authorization, reserves the source quota (20/hour, 50/day, five minutes per recipient), and creates an application invitation through the Clerk companion. Clerk owns the invitation and delivered inbox message. Explicit clerkApi selects the source development branch, which refuses public mail with 503. Users and sessions are made through Clerk’s own API.
Service-bound account projection: /v1/account is the Worker’s public operation, including its internal managed-account implementation. worker.ts:642-672 authenticates and merges identity over that binding’s snapshot. managed-account-service/src/app.ts:201-214,633-638 creates the row on the first authenticated read; database.ts:168-191,363-388 gives it Free/free defaults and refreshes identity without granting purchases. The pack stores that account under its Clerk user key. Its response includes source-defined spend alerts [50,80,100], empty account alerts, and generation admission read from Clerk’s private vgaiManagedServices flag (false for an ordinary new user).
The catalog is explicit deployment input, not a known live allowance: freePlan: {name, includedCredits} supplies the entry through the configuration door. The life and Editor cookbook serve the catalog the source ships for a non-production deployment: scripts/run-managed-services-dev.ts:71-73, Free with 100 included credits. This is the service-bound account path with non-production catalog values, not production’s values or allowance. Production’s catalog secret is not read. A missing entry answers the Worker’s documented ledger-unavailable 503. billingBound:false remains the separate source no-binding projection (zero credits and generation true). Gateway inference admission/grants remain unmodeled.
The editor only echoes modeled opaque state/code/delivery values to this Worker; secret-derived private token rows preserve expiry, binding and forgery checks without adding encryption to the kernel. Gateway-decoded inference grants are part of the ledger gap. Billing/catalog/usage/spend-policy paths absent from the public dispatch answer 404. Internal auth and relay flows are outside the editor demand. Discovery has no device grant. The Clerk companion serves hosted OAuth sign-in and consent; unsupported upstream flows keep their refusal. Application-invitation acceptance is outside the Clerk companion flow exercised here.
