api: development routes NEXT Cloud to cmux-platform-development

Merged
TE
4d ago
+69-3

Platform side is live: cmux-platform#332 (merged as 377d2387, cmux-platform-development owns CloudDO; its four Worker secrets are set) and cmux-platform#340 (merged as d5072ab9, the CloudDO drift port with trajectoryScope).

The development Worker hands NEXT Cloud to cmux-platform-development. That Worker owns CloudDO in development (cmux-platform#332, merged as 377d2387; cmux-platform docs/port-cloud-worker.md §3.3, fresh data). Staging (#29488, held) and production are unchanged.

Changes (backend/apps/api/wrangler.jsonc env.development only)

  • "PLATFORM_SURFACES": "cloud" in vars: src/platform-forward.ts sends NEXT Cloud's machine routes and the CloudDO ops on /v1/ops and /v1/read to the platform.
  • "services": [{ "binding": "PLATFORM", "service": "cmux-platform-development" }].
  • CLOUD_DO becomes { "name": "CLOUD_DO", "class_name": "CloudDO", "script_name": "cmux-platform-development" }, so this Worker's own callers reach the same objects the forwarded requests do. Those callers are PlatformMachines, the TeamDO and FeedDO outbox deliveries, the socket route, the UserDO socket registry, admin outbox replay and the automation workflow.
  • The CloudDO class export and its v11 migration stay. There are no deleted_classes yet.
  • New test/platform-cloud-development.test.ts pins this, and checks that staging and production keep their own CloudDO.

Rollback: drop the var and the script_name.

CLOUD_DO RPCs cmux-api calls, checked against the platform's CloudDO

These are present with the same signature: submit, readOp, fetch (socket), systemDeliver, closeInstall, replayDeadLetters, bindMachine, vmOp, mintLinkToken, acpmuxKeyedStart, acpmuxPersonHolds, mintClientSession, ownerExec, automationExec, platformMachine(e, u, call, recoveryOnly) and clearAbandoned.

One was missing until #340: trajectoryScope (cloud-trajectory.ts, cmux#25682). It is ported in cmux-platform#340 (merged as d5072ab9) along with the other CloudDO changes made since the port (cmux#28758, #28781, #28789; #30295's "*" allowed-teams rule already landed with #332).

Known after the flip (development only)

  • Machines that cmux-api-development's CloudDO made are not visible through the platform's fresh CloudDO.
  • Approvals are wired on the platform (cmux-platform#332, over this Worker's FeedDO, UserDO and TeamDO). Environment projection rows wait for a projection port (cmux-platform#376); nothing reads that table today.

Changelog

none

Observed / Not run

  • Ran locally: bun x vitest run test/platform-cloud-development.test.ts test/cloud-plan-production.test.ts (10 passed), and wrangler deploy --dry-run --env development, which resolves env.CLOUD_DO (CloudDO, defined in cmux-platform-development) and env.PLATFORM.
  • Not run: the full api suite. Tests use the top-level config, not env.development, so this change does not reach them.

Agent session: agent session

🤖 Generated with Claude Code