Files
orca/cloud/apps/sandbox-control/wrangler.dev.jsonc
T
Neil 777f078c76 feat(cloud): W4 team collaboration on cloud workspaces
## W4: team collaboration on Orca Cloud workspaces

### Control plane (`cloud/apps/sandbox-control`)
- **Registry** (`0024_workspace_registry.sql`, applied on dev D1): owner (reassignable), `created_by`, branch, `visibility` (private default / team), section, last activity, token spend. Reuses 0020's `name`/`archived_at`.
- **Routes under `/v1/team/*`** (W5 owns `/v1/workspaces`): list with Mine/Team/All, By, In, Archived filters; PATCH (rename, share or make private, section, archive, reassign owner); presence heartbeats; wake and lease for teammates; links resolve; org prompts/PR instructions (compare-and-set).
- **Security fix:** `/v1/sandboxes/:id` used to be account-scoped, so any org member could resume a teammate's sandbox and receive its orcad pairing code. It is now owner-only; admins can still suspend and destroy.
- **Per-member, per-device E2EE grants:**
  - The VM mints a single-device orcad offer and seals it to the requesting device's X25519 key.
  - The control plane stores only the orcad device id.
  - Revocation runs `orca pair --revoke`, which closes the device's live sockets, plus an on-disk registry removal.
  - When the VM is asleep, the revoke is queued and applied at boot before orcad starts.
  - Triggers: explicit revoke, making a workspace private, archive, reassign, member removal (internal route), and phone device-session revoke (W8).
  - VMs from older images get the entry points installed on demand.
- **Git as the sender:** a member's own GitHub user-to-server token (App OAuth, envelope-encrypted) is swapped in at egress only for the workspace repo. The VM gets per-member git configs and `orca-git-as`.
- **Cost:** metered compute × billing rate, plus optional token spend.

### orcad (generic)
- New owner-only RPC `pairing.revokeDevice` and `orca pair --revoke <device-id>`: revokes a device and closes its open connections immediately.

### Desktop
- A "Cloud workspaces" section on Home: Team/Mine, By, In and Archived filters; sections; live presence; cost; last activity. Single-click Open on a teammate workspace pairs this device through an E2EE grant. Also a row menu (share/private, move to section, reassign, archive) and copy link.
- Deep links `orca://cloud/w/<id>[/c/<chat>]` (open-url, argv, second instance, sidecar handoff) and the `cloudWorkspace.copyLink` keybinding.
- Messages to agents in shared workspaces carry a sender envelope.
- Uses the W10 shared primitives.
- Two rounds of adversarial design and frontend review.

### Evidence
Real Vercel VMs; see the W4 report. Numbers:
- grant issued in 0.55 s, paired in 1.35 s
- revoke closes the live desktop socket ~30 ms after the PATCH returns
- two members' pushes land on GitHub with their own author identities (shared dev Worker, preview alias w4); a push to another repo gets 403
2026-11-09 06:53:24 -08:00

46 lines
2.4 KiB
JSON

{
"$schema": "node_modules/wrangler/config-schema.json",
// DEV deployment only (workers.dev, no custom domain). Deploy:
// wrangler deploy -c wrangler.dev.jsonc
// Secrets (wrangler secret put -c wrangler.dev.jsonc, never here): VERCEL_TOKEN, SANDBOX_DEV_JWKS,
// EGRESS_DEV_STATIC_AUTHORIZATION, CONTROL_PLANE_TOKEN (same value as on
// orca-billing-dev), GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY (PKCS#8), SECRETS_KEK (base64 32 bytes),
// OPERATOR_TOKEN (/v1/internal/*), GITHUB_STATE_SECRET; for the GitHub connect flow also
// GITHUB_APP_CLIENT_ID + GITHUB_APP_CLIENT_SECRET (app settings → generate a client secret).
"name": "orca-sandbox-control-dev",
"main": "src/index.ts",
"compatibility_date": "2026-11-01",
"workers_dev": true,
"d1_databases": [
{
"binding": "SANDBOX_DB",
"database_name": "orca-sandbox-control-dev",
"database_id": "e9f259e9-94b3-4e18-a132-2d807693a498",
"migrations_dir": "migrations"
}
],
// Same-account Workers cannot call each other over workers.dev (error 1042); BILLING_URL names the origin.
"services": [{ "binding": "BILLING", "service": "orca-billing-dev" }],
// Every minute for routines (src/routines); the rest of the cron work runs on minute % 5 == 0.
"triggers": { "crons": ["* * * * *"] },
"vars": {
"SANDBOX_ENV": "dev",
"SANDBOX_POOL_SIZE": "2",
// The golden orcad tracks this branch (host RPCs ship there first); rebuilt when HEAD touches VM code.
"GOLDEN_IMAGE_SOURCE": "git:https://github.com/nwparker/orca-private#cloud/integration",
"SANDBOX_JWT_AUDIENCE": "orca-sandbox",
"SANDBOX_JWKS_URL": "https://login.onorca.dev/.well-known/jwks.json",
"SANDBOX_AUTH_ISSUER": "https://login.onorca.dev",
"VERCEL_TEAM_ID": "team_c5IO9DfEYAxKEUgMxrbEtO0a",
"VERCEL_PROJECT_ID": "prj_SkVtv6zJurF9dUHpfTRy4v9avwPq",
"VERCEL_REGION": "iad1",
"BILLING_URL": "https://orca-billing-dev.lovecast.workers.dev",
// Golden image from image/build-golden-image.ts; lifecycle routes answer 503 without one.
"GOLDEN_SNAPSHOT_ID": "snap_vpcmcCAgTtISiTZgsCosOlThQbFd",
"GITHUB_APP_SLUG": "orca-cloud-dev",
"EGRESS_PROXY_URL": "https://orca-sandbox-control-dev.lovecast.workers.dev/v1/egress/proxy",
// Git as the sender is opt-in per org (see memberGitEnabled); dev: only the W4 rehearsal org.
"MEMBER_GIT_IDENTITY": "accounts:dev:org:w4org"
}
}