{ "$schema": "node_modules/wrangler/config-schema.json", "main": "./src/server.ts", "name": "openstory", // Newest date workerd@1.20261001.1 (wrangler 4.147.0) will start. // A later date refuses to boot local dev and e2e. Still includes the // 2026-08-04 Node.js default and the 2026-10-01 Durable Object I/O // change. Production and test inherit it. Review: docs/deployment/cloudflare.md (#1999). "compatibility_date": "2026-10-08", // vite-plugin 1.67 emits Worker sourcemaps by default; ours exceed Cloudflare's 60 MiB cap (#2318). "upload_source_maps": false, // nodejs_compat is redundant at this date (Wrangler ignores it) and stays // so the intent is visible. enable_request_signal has no default date: // realtime closes its upstream DO streams on request.signal abort, and // without it disconnected SSE clients leave subscriptions and heartbeat // timers alive. Inherited by production/test. "compatibility_flags": ["nodejs_compat", "enable_request_signal"], "triggers": { // Sweep stuck generating-status rows every 5 minutes (#727) and refresh // the model_pricing table daily (#1069 — the expression must match // FAL_PRICING_CRON in src/billing/server/refresh-fal-pricing.ts). Hourly at // :53, diff this deployment's BytePlus asset group against the ledger // (#1519 — BYTEPLUS_ASSETS_RECONCILE_CRON). Production's same tick also // deletes leftover `openstory-virtual-pr-*` groups whose PRs are closed // (#1635). "crons": ["*/5 * * * *", "17 3 * * *", "37 * * * *", "53 * * * *"], }, "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "enabled": true, "head_sampling_rate": 1, "persist": true, // Disabled: redundant with our LogTape middleware (see // src/platform/middleware.fn.ts loggerMiddleware) which already emits // per-serverFn timing/outcome. The CF-emitted "fetch OK" / "GET OK" // lines flooded the dashboard with empty headlines. "invocation_logs": false, }, "traces": { "enabled": true, "persist": true, "head_sampling_rate": 1, }, }, // ───────────────────────────────────────────────────────────────────────── // DEFAULT env = local dev. The D1 here uses a placeholder `database_id` so // it can ONLY resolve to a local Miniflare D1 — there is no real Cloudflare // D1 with this id. If @cloudflare/vite-plugin ever auto-promotes a binding // to remote (it has done in the past with `remoteBindings` defaulting to // true), the request would 404 against Cloudflare rather than silently // writing to production. // // PROD D1 lives in [env.production] below. Prod builds MUST set // CLOUDFLARE_ENV=production (a Workers Builds build env var; see // docs/deployment/cloudflare.md) and the migrate step MUST pass // `--env=production` (wired in the `deploy:production` package script). // PR-preview deploys patch this default block in CI before deploying. // ───────────────────────────────────────────────────────────────────────── "d1_databases": [ { "binding": "DB", "database_name": "openstory-dev", "database_id": "dev-local-d1", // Flat *.sql rendering of drizzle/migrations (which nests files as // /migration.sql — wrangler silently reads zero of those). Built // by `bun scripts/flatten-migrations.ts`; consumed by // `wrangler d1 migrations apply` in the `deploy` / `db:migrate:prd` // package scripts. Local dev/e2e apply migrations via drizzle-orm // (scripts/migrate-local-d1.ts) and don't read this. "migrations_dir": "drizzle/migrations-wrangler", }, ], // Local-only R2 (Miniflare state in .wrangler/state). Stored media URLs are // origin-relative (`/r2/`, #894) and the worker's /r2/$ route // (src/routes/r2.$.ts) streams them from the binding when // R2_PUBLIC_STORAGE_DOMAIN is unset — so local dev needs no remote R2 and // no Cloudflare credentials. // To opt back into remote R2 (e.g. to repro a CDN-specific bug), set // `"remote": true` here plus R2_PUBLIC_STORAGE_DOMAIN in .env.local, and // revert when done. "r2_buckets": [ { "bucket_name": "openstory-public-assets", "binding": "R2_PUBLIC_ASSETS_BUCKET", }, { "binding": "R2_STORAGE_BUCKET", // Bucket name only matters when remote — locally it just namespaces // the Miniflare state. Kept distinct from prod's `openstory-storage`; // preview deploys patch this default to `openstory-storage-stg` // (see deploy-cloudflare.yml). "bucket_name": "openstory-dev", }, ], // Cloudflare Email Service (transactional sending). With no `remote` flag, // local dev SIMULATES sends — wrangler logs the email content to the // console instead of delivering it — so OTP sign-in works hermetically with // no API key. Set `"remote": true` temporarily to send real email from // local dev (requires the sending domain onboarded in the dashboard). "send_email": [ { "name": "SEND_EMAIL", }, ], // Per-IP throttle for the unauthenticated device-code login endpoints // (/api/v1/device/*, #1219). Native Workers rate limiting (per-colo, no // storage). Not inherited by env blocks — redeclared below. Local dev: // Miniflare simulates it. "ratelimits": [ { "name": "DEVICE_LOGIN_RATE_LIMITER", "namespace_id": "1219", "simple": { "limit": 30, "period": 60 }, }, // Per-user throttle for OAuth JWTs on POST /mcp (#1457). `osk_` keys // reuse the api-key plugin limiter (10/s) instead. Not inherited by env // blocks — redeclared below. 100 / 10s matches the key limiter. { "name": "MCP_JWT_RATE_LIMITER", "namespace_id": "1457", "simple": { "limit": 100, "period": 10 }, }, ], "workflows": [ // All durable async work runs on Cloudflare Workflows. Each class is // re-exported from src/server.ts (so it lands in the Worker bundle) and // its binding is resolved by `triggerWorkflow()` via TRIGGER_TO_BINDING in // src/platform/server/workflow/trigger-bindings.ts. The class also belongs // in WORKFLOW_CLASS_TO_BINDING so the sequence chip can status a child // id with no trigger key. Keep these in sync — the wiring-consistency // test enforces it. { "name": "image-workflow", "binding": "IMAGE_WORKFLOW", "class_name": "ImageWorkflow", }, { "name": "element-vision-workflow", "binding": "ELEMENT_VISION_WORKFLOW", "class_name": "ElementVisionWorkflow", }, { "name": "sheet-portrait-workflow", "binding": "SHEET_PORTRAIT_WORKFLOW", "class_name": "SheetPortraitWorkflow", }, { "name": "element-sheet-workflow", "binding": "ELEMENT_SHEET_WORKFLOW", "class_name": "ElementSheetWorkflow", }, { "name": "music-workflow", "binding": "MUSIC_WORKFLOW", "class_name": "MusicWorkflow", }, { "name": "motion-workflow", "binding": "MOTION_WORKFLOW", "class_name": "MotionWorkflow", }, { "name": "lipsync-workflow", "binding": "LIPSYNC_WORKFLOW", "class_name": "LipsyncWorkflow", }, { "name": "motion-batch-workflow", "binding": "MOTION_BATCH_WORKFLOW", "class_name": "MotionBatchWorkflow", }, { "name": "character-sheet-workflow", "binding": "CHARACTER_SHEET_WORKFLOW", "class_name": "CharacterSheetWorkflow", }, { "name": "character-voice-workflow", "binding": "CHARACTER_VOICE_WORKFLOW", "class_name": "CharacterVoiceWorkflow", }, { "name": "dialogue-audio-workflow", "binding": "DIALOGUE_AUDIO_WORKFLOW", "class_name": "DialogueAudioWorkflow", }, { "name": "dialogue-take-workflow", "binding": "DIALOGUE_TAKE_WORKFLOW", "class_name": "DialogueTakeWorkflow", }, { "name": "dialogue-upload-workflow", "binding": "DIALOGUE_UPLOAD_WORKFLOW", "class_name": "DialogueUploadWorkflow", }, { "name": "location-sheet-workflow", "binding": "LOCATION_SHEET_WORKFLOW", "class_name": "LocationSheetWorkflow", }, { "name": "shot-variant-workflow", "binding": "SHOT_VARIANT_WORKFLOW", "class_name": "ShotVariantWorkflow", }, { "name": "upscale-shot-variant-workflow", "binding": "UPSCALE_SHOT_VARIANT_WORKFLOW", "class_name": "UpscaleShotVariantWorkflow", }, { "name": "shot-spec-rewrite-workflow", "binding": "SHOT_SPEC_REWRITE_WORKFLOW", "class_name": "ShotSpecRewriteWorkflow", }, { "name": "music-prompt-workflow", "binding": "MUSIC_PROMPT_WORKFLOW", "class_name": "MusicPromptWorkflow", }, { "name": "location-matching-workflow", "binding": "LOCATION_MATCHING_WORKFLOW", "class_name": "LocationMatchingWorkflow", }, { "name": "shot-images-workflow", "binding": "SHOT_IMAGES_WORKFLOW", "class_name": "ShotImagesWorkflow", }, { "name": "character-bible-workflow", "binding": "CHARACTER_BIBLE_WORKFLOW", "class_name": "CharacterBibleWorkflow", }, { "name": "location-bible-workflow", "binding": "LOCATION_BIBLE_WORKFLOW", "class_name": "LocationBibleWorkflow", }, { "name": "motion-music-prompts-workflow", "binding": "MOTION_MUSIC_PROMPTS_WORKFLOW", "class_name": "MotionMusicPromptsWorkflow", }, { "name": "regenerate-shots-workflow", "binding": "REGENERATE_SHOTS_WORKFLOW", "class_name": "RegenerateShotsWorkflow", }, { "name": "update-stale-shots-workflow", "binding": "UPDATE_STALE_SHOTS_WORKFLOW", "class_name": "UpdateStaleShotsWorkflow", }, { "name": "recast-location-workflow", "binding": "RECAST_LOCATION_WORKFLOW", "class_name": "RecastLocationWorkflow", }, { "name": "replace-element-workflow", "binding": "REPLACE_ELEMENT_WORKFLOW", "class_name": "ReplaceElementWorkflow", }, { "name": "scene-split-workflow", "binding": "SCENE_SPLIT_WORKFLOW", "class_name": "SceneSplitWorkflow", }, { "name": "storyboard-workflow", "binding": "STORYBOARD_WORKFLOW", "class_name": "StoryboardWorkflow", }, { "name": "analyze-script-workflow", "binding": "ANALYZE_SCRIPT_WORKFLOW", "class_name": "AnalyzeScriptWorkflow", }, { "name": "sequence-export-workflow", "binding": "SEQUENCE_EXPORT_WORKFLOW", "class_name": "SequenceExportWorkflow", }, { "name": "asset-generation-workflow", "binding": "ASSET_WORKFLOW", "class_name": "AssetGenerationWorkflow", }, { "name": "studio-generation-workflow", "binding": "STUDIO_WORKFLOW", "class_name": "StudioGenerationWorkflow", }, { "name": "upload-check-workflow", "binding": "UPLOAD_CHECK_WORKFLOW", "class_name": "UploadCheckWorkflow", }, ], // Realtime broker (#802): one SQLite-backed Durable Object per channel holds // SSE subscribers open and persists replayable history. The `RealtimeChannel` // class is re-exported from src/server.ts. DO bindings + migrations are NOT // inherited across env blocks, so they are redeclared in [env.production] and // [env.test] below. "durable_objects": { "bindings": [ { "name": "REALTIME", "class_name": "RealtimeChannel", }, // BytePlus request governor (#1519): one token bucket per account so // the Assets OpenAPI stays under its per-account quota. Tag v3 — v2 is // the production/preview container, which the preview patch splices // in ahead of this. { "name": "BYTEPLUS_GOVERNOR", "class_name": "BytePlusGovernor", }, // Assistant stream log (#2155): one Durable Streams object per run, so // a reload or a second tab tails a reply still being written. The class // is @durable-streams/server-cloudflare's, which requires this exact // binding name. Tag v4. Only the assistant's server code talks to it, // in-process; the protocol is never routed from the edge. { "name": "STREAMS", "class_name": "StreamObject", }, ], }, "migrations": [ { "tag": "v1", "new_sqlite_classes": ["RealtimeChannel"], }, { "tag": "v3", "new_sqlite_classes": ["BytePlusGovernor"], }, { "tag": "v4", "new_sqlite_classes": ["StreamObject"], }, ], "env": { // Production deploy target. @cloudflare/vite-plugin selects the env at // BUILD time via CLOUDFLARE_ENV — Workers Builds sets it as a dashboard // build env var (manual deploys: `cf:deploy:prd` sets // `CLOUDFLARE_ENV=production bun run build`), which bakes these bindings // into dist/server/wrangler.json. The `--env=production` flag on // `wrangler deploy` is a no-op against that generated (already-flattened) // config; without CLOUDFLARE_ENV the build bakes the DEFAULT block (whose // D1 id is a placeholder), so the deploy fails loudly rather than // overwriting prod with the wrong DB. "production": { // Pin the worker name so the production env deploys to the EXISTING // `openstory` worker (with its routes + custom domain). Without this, // legacy_env (default true) derives the name as `-` = // `openstory-production`, which is a DIFFERENT worker — the deploy // would succeed but the live site would never update. "name": "openstory", // Replaces the top-level block wholesale (inheritable keys are not // merged), so logs are restated. Traces also go to PostHog Tracing via // the `posthog-traces-openstory-prd` destination (Cloudflare dashboard → // Workers → Observability → Destinations). Logs go to PostHog Logs via // `posthog-openstory-prd` with trace and span ids; PostHog's "JSON parse // logs" turns the LogTape line into attributes (#2280). // Traces sample 100% so every error has a trace. Every span is a billed // event from 2026-10-01; ~4M/month measured (Sep 2026) vs 20M included. "observability": { "enabled": true, "head_sampling_rate": 1, "logs": { "enabled": true, "head_sampling_rate": 1, "persist": true, "invocation_logs": false, "destinations": ["posthog-openstory-prd"], }, "traces": { "enabled": true, "persist": true, "head_sampling_rate": 1, "destinations": ["posthog-traces-openstory-prd"], }, }, "d1_databases": [ { "binding": "DB", // `database_id` is authoritative — it's what wrangler binds and // deploys against (`database_name` is just a label, and wrangler // requires the id; name-only resolution doesn't exist outside // auto-provisioning). The underlying D1 is still the pre-rename // `velro-prd` — D1 has NO rename, so the #897 cutover runbook // (docs/deployment/cloudflare.md) recreates it as `openstory-prd`: // create fresh → run all migrations → import data → update the // name + id here. "database_name": "openstory-prd", "database_id": "d5981bee-ef84-4006-b585-d1f2ebc81114", "migrations_dir": "drizzle/migrations-wrangler", }, ], "r2_buckets": [ { "bucket_name": "openstory-public-assets", "binding": "R2_PUBLIC_ASSETS_BUCKET", "remote": true, }, { "binding": "R2_STORAGE_BUCKET", "bucket_name": "openstory-storage", "remote": true, }, ], // Email Service binding — NOT inherited from the top-level block. // Deployed workers always send real email through Cloudflare Email // Service (the sending domain must be onboarded in the dashboard). "send_email": [ { "name": "SEND_EMAIL", }, ], // Device-code login throttle and MCP JWT throttle (not inherited; // see top-level block). "ratelimits": [ { "name": "DEVICE_LOGIN_RATE_LIMITER", "namespace_id": "1219", "simple": { "limit": 30, "period": 60 }, }, { "name": "MCP_JWT_RATE_LIMITER", "namespace_id": "1457", "simple": { "limit": 100, "period": 10 }, }, ], // Workflow bindings are NOT inherited from the top-level block, so // they must be redeclared here. Keep this list in sync with the // top-level workflows[] (the wiring-consistency test enforces parity). "workflows": [ { "name": "image-workflow", "binding": "IMAGE_WORKFLOW", "class_name": "ImageWorkflow", }, { "name": "element-vision-workflow", "binding": "ELEMENT_VISION_WORKFLOW", "class_name": "ElementVisionWorkflow", }, { "name": "sheet-portrait-workflow", "binding": "SHEET_PORTRAIT_WORKFLOW", "class_name": "SheetPortraitWorkflow", }, { "name": "element-sheet-workflow", "binding": "ELEMENT_SHEET_WORKFLOW", "class_name": "ElementSheetWorkflow", }, { "name": "music-workflow", "binding": "MUSIC_WORKFLOW", "class_name": "MusicWorkflow", }, { "name": "motion-workflow", "binding": "MOTION_WORKFLOW", "class_name": "MotionWorkflow", }, { "name": "lipsync-workflow", "binding": "LIPSYNC_WORKFLOW", "class_name": "LipsyncWorkflow", }, { "name": "motion-batch-workflow", "binding": "MOTION_BATCH_WORKFLOW", "class_name": "MotionBatchWorkflow", }, { "name": "character-sheet-workflow", "binding": "CHARACTER_SHEET_WORKFLOW", "class_name": "CharacterSheetWorkflow", }, { "name": "character-voice-workflow", "binding": "CHARACTER_VOICE_WORKFLOW", "class_name": "CharacterVoiceWorkflow", }, { "name": "dialogue-audio-workflow", "binding": "DIALOGUE_AUDIO_WORKFLOW", "class_name": "DialogueAudioWorkflow", }, { "name": "dialogue-take-workflow", "binding": "DIALOGUE_TAKE_WORKFLOW", "class_name": "DialogueTakeWorkflow", }, { "name": "dialogue-upload-workflow", "binding": "DIALOGUE_UPLOAD_WORKFLOW", "class_name": "DialogueUploadWorkflow", }, { "name": "location-sheet-workflow", "binding": "LOCATION_SHEET_WORKFLOW", "class_name": "LocationSheetWorkflow", }, { "name": "shot-variant-workflow", "binding": "SHOT_VARIANT_WORKFLOW", "class_name": "ShotVariantWorkflow", }, { "name": "upscale-shot-variant-workflow", "binding": "UPSCALE_SHOT_VARIANT_WORKFLOW", "class_name": "UpscaleShotVariantWorkflow", }, { "name": "shot-spec-rewrite-workflow", "binding": "SHOT_SPEC_REWRITE_WORKFLOW", "class_name": "ShotSpecRewriteWorkflow", }, { "name": "music-prompt-workflow", "binding": "MUSIC_PROMPT_WORKFLOW", "class_name": "MusicPromptWorkflow", }, { "name": "location-matching-workflow", "binding": "LOCATION_MATCHING_WORKFLOW", "class_name": "LocationMatchingWorkflow", }, { "name": "shot-images-workflow", "binding": "SHOT_IMAGES_WORKFLOW", "class_name": "ShotImagesWorkflow", }, { "name": "character-bible-workflow", "binding": "CHARACTER_BIBLE_WORKFLOW", "class_name": "CharacterBibleWorkflow", }, { "name": "location-bible-workflow", "binding": "LOCATION_BIBLE_WORKFLOW", "class_name": "LocationBibleWorkflow", }, { "name": "motion-music-prompts-workflow", "binding": "MOTION_MUSIC_PROMPTS_WORKFLOW", "class_name": "MotionMusicPromptsWorkflow", }, { "name": "regenerate-shots-workflow", "binding": "REGENERATE_SHOTS_WORKFLOW", "class_name": "RegenerateShotsWorkflow", }, { "name": "update-stale-shots-workflow", "binding": "UPDATE_STALE_SHOTS_WORKFLOW", "class_name": "UpdateStaleShotsWorkflow", }, { "name": "recast-location-workflow", "binding": "RECAST_LOCATION_WORKFLOW", "class_name": "RecastLocationWorkflow", }, { "name": "replace-element-workflow", "binding": "REPLACE_ELEMENT_WORKFLOW", "class_name": "ReplaceElementWorkflow", }, { "name": "scene-split-workflow", "binding": "SCENE_SPLIT_WORKFLOW", "class_name": "SceneSplitWorkflow", }, { "name": "storyboard-workflow", "binding": "STORYBOARD_WORKFLOW", "class_name": "StoryboardWorkflow", }, { "name": "analyze-script-workflow", "binding": "ANALYZE_SCRIPT_WORKFLOW", "class_name": "AnalyzeScriptWorkflow", }, { "name": "sequence-export-workflow", "binding": "SEQUENCE_EXPORT_WORKFLOW", "class_name": "SequenceExportWorkflow", }, { "name": "asset-generation-workflow", "binding": "ASSET_WORKFLOW", "class_name": "AssetGenerationWorkflow", }, { "name": "studio-generation-workflow", "binding": "STUDIO_WORKFLOW", "class_name": "StudioGenerationWorkflow", }, { "name": "upload-check-workflow", "binding": "UPLOAD_CHECK_WORKFLOW", "class_name": "UploadCheckWorkflow", }, ], // Server-side video export (#968). The `VideoExportContainer` Durable // Object fronts a Cloudflare Container (Node + @mediabunny/server) that // stitches a sequence's scene MP4s for the API. Declared in PRODUCTION // ONLY (not the default/test blocks) so `bun dev` and hermetic e2e need // no Docker — the image is built only on deploy. The // SequenceExportWorkflow tolerates the binding's absence outside prod. "containers": [ { "class_name": "VideoExportContainer", "image": "./containers/video-export/Dockerfile", // Mixed-res re-encode is decode+AVC encode; `standard` (½ vCPU) is // too small. `standard-4` is 4 vCPU / 12 GiB / 20 GB disk. "instance_type": "standard-4", "max_instances": 3, }, ], // Realtime broker DO — redeclared because durable_objects + migrations // are non-inheritable across env blocks. Keep the `v1` migration tag in // sync with the top-level block. The container DO is production-only. "durable_objects": { "bindings": [ { "name": "REALTIME", "class_name": "RealtimeChannel", }, { "name": "VIDEO_EXPORT_CONTAINER", "class_name": "VideoExportContainer", }, { "name": "BYTEPLUS_GOVERNOR", "class_name": "BytePlusGovernor", }, { "name": "STREAMS", "class_name": "StreamObject", }, ], }, "migrations": [ { "tag": "v1", "new_sqlite_classes": ["RealtimeChannel"], }, { "tag": "v2", "new_sqlite_classes": ["VideoExportContainer"], }, { "tag": "v3", "new_sqlite_classes": ["BytePlusGovernor"], }, { "tag": "v4", "new_sqlite_classes": ["StreamObject"], }, ], "triggers": { "crons": ["*/5 * * * *", "17 3 * * *", "37 * * * *", "53 * * * *"], }, }, // Playwright e2e environment. D1 AND R2 are local (Miniflare) for // hermetic runs — no remote bindings, so no Cloudflare credentials are // needed (CI included). Uploads do real puts into local R2; reads are // served by the worker's /r2/$ route (R2_PUBLIC_STORAGE_DOMAIN unset). // The actual asset bytes come from the real fal.media URLs recorded in // the aimock fixtures. Record mode (`E2E_RECORD=1`) also stays local: // outbound URLs sent to real fal/OpenRouter are made fetchable via // fal.storage.upload / data-URIs (see src/platform/server/storage/external-url.ts). "test": { // These vars are visible inside the worker via getEnv() when // CLOUDFLARE_ENV=test (used by Playwright webServer + CI). // E2E_TEST gates the entire /api/test/* route tree via testOnlyGuard. "vars": { // E2E_TEST gates /api/test/* routes (via testOnlyGuard) and many // test-specific branches in storage / workflow client code. "E2E_TEST": "true", // The admin e2e user (createTestUser({ admin: true })). "ADMIN_EMAILS": "e2e-admin@e2e.test", // Note: a developer's .env.local R2_PUBLIC_STORAGE_DOMAIN could leak // into this worker env via the env-file merge, but it can't break // e2e: isLocalStorageServing() (src/platform/server/storage/buckets.ts) forces // local /r2 serving whenever E2E_TEST is true. // E2E_FULL_PIPELINE and E2E_RECORD are intentionally NOT hardcoded here. // They're per-run flags: Playwright's webServer envPrefix sets them in // the launcher's process.env for `test:e2e:full[:record]`. Under // @cloudflare/vite-plugin the worker's getEnv() is built from these // `vars` + `.env*`/`.dev.vars` files, and only includes process.env when // CLOUDFLARE_INCLUDE_PROCESS_ENV=true (which the envPrefix now sets — see // playwright.config.ts). Hardcoding them "false" here shadowed the // process.env values (this merge layers env-files/process.env over these // vars, but a declared "false" still won for any path that didn't forward // process.env), so the worker saw "false": triggerWorkflow() skipped // every workflow and storage-cloudflare.ts's record branch never fired // (fixture-miss → 500). With them absent, the worker reads them straight // from the forwarded process.env; when unset (plain `bun test:e2e`, or // CI's non-full .dev.vars) they're undefined, which the `!== 'true'` / // `=== '1'` checks treat identically to "false" — hermetic replay intact. }, "d1_databases": [ { "binding": "DB", "database_name": "openstory-test", "database_id": "openstory-test-local", "migrations_dir": "drizzle/migrations-wrangler", }, ], "r2_buckets": [ { "bucket_name": "openstory-public-assets", "binding": "R2_PUBLIC_ASSETS_BUCKET", }, { "binding": "R2_STORAGE_BUCKET", "bucket_name": "openstory-test", }, ], // Email Service binding — NOT inherited from the top-level block. No // `remote` flag → e2e sends are simulated locally (logged, not // delivered), keeping CI hermetic with no Cloudflare credentials. "send_email": [ { "name": "SEND_EMAIL", }, ], // Device-code login throttle and MCP JWT throttle (not inherited; // see top-level block). "ratelimits": [ { "name": "DEVICE_LOGIN_RATE_LIMITER", "namespace_id": "1219", "simple": { "limit": 30, "period": 60 }, }, { "name": "MCP_JWT_RATE_LIMITER", "namespace_id": "1457", "simple": { "limit": 100, "period": 10 }, }, ], // Workflow bindings are NOT inherited from the top-level block, so // they must be redeclared here. Keep this list in sync with the // top-level workflows[] (the wiring-consistency test enforces parity). "workflows": [ { "name": "image-workflow", "binding": "IMAGE_WORKFLOW", "class_name": "ImageWorkflow", }, { "name": "element-vision-workflow", "binding": "ELEMENT_VISION_WORKFLOW", "class_name": "ElementVisionWorkflow", }, { "name": "sheet-portrait-workflow", "binding": "SHEET_PORTRAIT_WORKFLOW", "class_name": "SheetPortraitWorkflow", }, { "name": "element-sheet-workflow", "binding": "ELEMENT_SHEET_WORKFLOW", "class_name": "ElementSheetWorkflow", }, { "name": "music-workflow", "binding": "MUSIC_WORKFLOW", "class_name": "MusicWorkflow", }, { "name": "motion-workflow", "binding": "MOTION_WORKFLOW", "class_name": "MotionWorkflow", }, { "name": "lipsync-workflow", "binding": "LIPSYNC_WORKFLOW", "class_name": "LipsyncWorkflow", }, { "name": "motion-batch-workflow", "binding": "MOTION_BATCH_WORKFLOW", "class_name": "MotionBatchWorkflow", }, { "name": "character-sheet-workflow", "binding": "CHARACTER_SHEET_WORKFLOW", "class_name": "CharacterSheetWorkflow", }, { "name": "character-voice-workflow", "binding": "CHARACTER_VOICE_WORKFLOW", "class_name": "CharacterVoiceWorkflow", }, { "name": "dialogue-audio-workflow", "binding": "DIALOGUE_AUDIO_WORKFLOW", "class_name": "DialogueAudioWorkflow", }, { "name": "dialogue-take-workflow", "binding": "DIALOGUE_TAKE_WORKFLOW", "class_name": "DialogueTakeWorkflow", }, { "name": "dialogue-upload-workflow", "binding": "DIALOGUE_UPLOAD_WORKFLOW", "class_name": "DialogueUploadWorkflow", }, { "name": "location-sheet-workflow", "binding": "LOCATION_SHEET_WORKFLOW", "class_name": "LocationSheetWorkflow", }, { "name": "shot-variant-workflow", "binding": "SHOT_VARIANT_WORKFLOW", "class_name": "ShotVariantWorkflow", }, { "name": "upscale-shot-variant-workflow", "binding": "UPSCALE_SHOT_VARIANT_WORKFLOW", "class_name": "UpscaleShotVariantWorkflow", }, { "name": "shot-spec-rewrite-workflow", "binding": "SHOT_SPEC_REWRITE_WORKFLOW", "class_name": "ShotSpecRewriteWorkflow", }, { "name": "music-prompt-workflow", "binding": "MUSIC_PROMPT_WORKFLOW", "class_name": "MusicPromptWorkflow", }, { "name": "location-matching-workflow", "binding": "LOCATION_MATCHING_WORKFLOW", "class_name": "LocationMatchingWorkflow", }, { "name": "shot-images-workflow", "binding": "SHOT_IMAGES_WORKFLOW", "class_name": "ShotImagesWorkflow", }, { "name": "character-bible-workflow", "binding": "CHARACTER_BIBLE_WORKFLOW", "class_name": "CharacterBibleWorkflow", }, { "name": "location-bible-workflow", "binding": "LOCATION_BIBLE_WORKFLOW", "class_name": "LocationBibleWorkflow", }, { "name": "motion-music-prompts-workflow", "binding": "MOTION_MUSIC_PROMPTS_WORKFLOW", "class_name": "MotionMusicPromptsWorkflow", }, { "name": "regenerate-shots-workflow", "binding": "REGENERATE_SHOTS_WORKFLOW", "class_name": "RegenerateShotsWorkflow", }, { "name": "update-stale-shots-workflow", "binding": "UPDATE_STALE_SHOTS_WORKFLOW", "class_name": "UpdateStaleShotsWorkflow", }, { "name": "recast-location-workflow", "binding": "RECAST_LOCATION_WORKFLOW", "class_name": "RecastLocationWorkflow", }, { "name": "replace-element-workflow", "binding": "REPLACE_ELEMENT_WORKFLOW", "class_name": "ReplaceElementWorkflow", }, { "name": "scene-split-workflow", "binding": "SCENE_SPLIT_WORKFLOW", "class_name": "SceneSplitWorkflow", }, { "name": "storyboard-workflow", "binding": "STORYBOARD_WORKFLOW", "class_name": "StoryboardWorkflow", }, { "name": "analyze-script-workflow", "binding": "ANALYZE_SCRIPT_WORKFLOW", "class_name": "AnalyzeScriptWorkflow", }, { "name": "sequence-export-workflow", "binding": "SEQUENCE_EXPORT_WORKFLOW", "class_name": "SequenceExportWorkflow", }, { "name": "asset-generation-workflow", "binding": "ASSET_WORKFLOW", "class_name": "AssetGenerationWorkflow", }, { "name": "studio-generation-workflow", "binding": "STUDIO_WORKFLOW", "class_name": "StudioGenerationWorkflow", }, { "name": "upload-check-workflow", "binding": "UPLOAD_CHECK_WORKFLOW", "class_name": "UploadCheckWorkflow", }, ], // Realtime broker DO — redeclared because durable_objects + migrations // are non-inheritable across env blocks. Keep the `v1` migration tag in // sync with the top-level block. No container here: e2e stays hermetic // (Docker-free); without the binding the SequenceExportWorkflow fails the // export cleanly (marks the row `failed`) rather than rendering. "durable_objects": { "bindings": [ { "name": "REALTIME", "class_name": "RealtimeChannel", }, { "name": "BYTEPLUS_GOVERNOR", "class_name": "BytePlusGovernor", }, { "name": "STREAMS", "class_name": "StreamObject", }, ], }, "migrations": [ { "tag": "v1", "new_sqlite_classes": ["RealtimeChannel"], }, { "tag": "v3", "new_sqlite_classes": ["BytePlusGovernor"], }, { "tag": "v4", "new_sqlite_classes": ["StreamObject"], }, ], }, }, }