Mobile Runtime
Cloud Mobile Bridge
Hosted NyrA bridge for Android/browser swarm chat, tenant-scoped adaptive routing, voice setup, support logs, and updates. Source folder: cloud/mobile-bridge-worker.
Mobile Bridge Handoff Form
Cloud planHosted Bridge Snapshot
Current Internal Hosted Alpha
npm run alpha:hostedTemporary phone-testing host. This proves Android can reach the swarm bridge and download the current APK, but it is not the permanent paid-beta Worker.
Route Contract
npm run cloud:mobile-bridge:checkThese routes mirror the local mobile bridge so Android can switch from tunnel/local PC to a stable HTTPS Worker URL without app-side route changes.
| Route | Runtime Use |
|---|---|
GET /health | Public health or compatibility route. |
GET /api/nyra/model-policy | Sanitized, cacheable benchmark policy for task-aware model routing. |
GET /api/nyra/model-policy/v2 | Sanitized, cacheable benchmark policy for task-aware model routing. |
GET /api/nyra/status | Provider readiness and hosted bridge health for app settings. |
POST /api/nyra/tester/enroll | Allowlisted internal tester enrollment for passwordless device access. |
GET /api/nyra/update/latest | Android update metadata and hosted APK pointer. |
POST /api/nyra/update/android/download-ticket | Short-lived APK installer ticket for paid device-token update downloads. |
GET /api/nyra/update/android/apk | Hosted Android APK download route for app updates. |
HEAD /api/nyra/update/android/apk | APK metadata probe for phone self-tests without a full download. |
POST /api/nyra/chat | Swarm chat path with Captain/Crew council routing for deep requests. |
POST /api/nyra/cancel | Compatibility cancel acknowledgement for stateless Worker requests. |
POST /api/nyra/transcribe-audio | One-shot voice fallback transcription. |
POST /api/nyra/tts-audio | Text-to-speech audio fallback. |
POST /api/nyra/realtime-client-secret | Realtime voice ephemeral secret setup. |
POST /api/nyra/logs | Redacted support diagnostics upload and readback through R2. |
GET /api/nyra/logs | Redacted support diagnostics upload and readback through R2. |
GET /api/nyra/logs/:id | Redacted support diagnostics upload and readback through R2. |
Secret Store Requirements
Never paste raw API keys or bridge tokens into dashboard fields. Save status here, set real values with Wrangler or Cloudflare dashboard secrets.
| Secret | Status | Where It Belongs |
|---|---|---|
NYRA_MOBILE_BRIDGE_TOKEN | Secret store | Set with Wrangler secrets only. |
NYRA_OPENAI_API_KEY | Secret store | Set with Wrangler secrets only. |
NYRA_ANTHROPIC_API_KEY | Secret store | Set with Wrangler secrets only. |
NYRA_GEMINI_API_KEY | Secret store | Set with Wrangler secrets only. |
NYRA_GROK_API_KEY | Secret store | Set with Wrangler secrets only. |
NYRA_LICENSE_SIGNING_SECRET | Secret store | Set with Wrangler secrets only. |
NYRA_ANDROID_DOWNLOAD_TICKET_SECRET | Secret store | Set with Wrangler secrets only. |
Bootstrap Plan
npm run cloud:mobile-bridge:bootstrapThis is the executable path from local/tunnel phone testing to a durable HTTPS Worker with R2-hosted APK updates and support-log readback.
| Step | Command | Note |
|---|---|---|
| check-routes | npm.cmd run cloud:mobile-bridge:check | Run from npm before deploy. |
| whoami | C:\Program Files\nodejs\node.exe <repo>\node_modules\wrangler\bin\wrangler.js whoami | Confirms Cloudflare auth. |
| create-support-r2 | C:\Program Files\nodejs\node.exe <repo>\node_modules\wrangler\bin\wrangler.js r2 bucket create nyra-mobile-support-logs | |
| create-android-r2 | C:\Program Files\nodejs\node.exe <repo>\node_modules\wrangler\bin\wrangler.js r2 bucket create nyra-android-releases | |
| upload-apk | C:\Program Files\nodejs\node.exe <repo>\node_modules\wrangler\bin\wrangler.js r2 object put nyra-android-releases/alpha/0.1.0-alpha.83/NyrA.apk --file <repo>\release\current\android\NyrA.apk --remote |
Hosted Alpha Report
Hosted Alpha Status
Status: HOSTED_ALPHA_READY
Generated: 2026-07-17T04:53:45.084Z
This internal Android alpha is hosted by the durable bridge.porterlabz.com Worker with its token-free APK in R2. It is not customer-ready until customer authentication, physical-phone proof, and trusted distribution are complete.
Current Public Test URL
- Public URL:
https://bridge.porterlabz.com - Bridge token: stored locally at
.runtime-logs/hosted-alpha-bridge-token.txt; not written to this report. - Download token: stored locally at
.runtime-logs/hosted-alpha-download-token.txt; not written to this report. - Version: 0.1.0-alpha.83 (83)
- APK SHA256:
b92bbedcc86066f17edc620a105b04a6cdbd284b6d767abdb1b88ecfb07791b0
Health
- Hosting mode: durable Worker + R2
- Bridge: durable-worker
- APK proxy: not-required
- Tunnel: not-required
- Providers ready: 4/4
- Update manifest proof: usable by phone (https://bridge.porterlabz.com/api/nyra/update/android/apk)
- APK download proof: matches manifest (3477419 bytes)
- Chat proof: anthropic / claude-haiku-4-5-20251001 - HOSTED_ALPHA_OK
- Support-log proof: upload/list/readback passed; log id
2026-07-17T04-53-44-939Z-4ef1c4c3-4c15-45d9-80ac-4a7365b366d2; server path hidden=yes
Providers
- OpenAI: ready (gpt-5.6-sol)
- Anthropic: ready (claude-fable-5)
- Gemini: ready (gemini-3.5-flash)
- Grok/xAI: ready (grok-4.5)
No-Go Boundary
- Token-free APK verified: no shared bridge credential is bundled in the Android artifact.
- Paid beta still requires a complete fresh-install customer authentication flow, physical-phone proof, and a signed/trusted distribution path.
Bootstrap Report
Mobile Bridge Cloud Bootstrap
Status: MOBILE_BRIDGE_BOOTSTRAP_PLANNED
Generated: 2026-07-18T13:37:03.171Z
This prepares the durable Cloudflare Worker bridge that replaces the temporary trycloudflare tunnel for Android chat, updates, support logs, and phone self-tests.
APK
- Version: 0.1.0-alpha.83 (83)
- R2 key:
alpha/0.1.0-alpha.83/NyrA.apk - SHA256:
b92bbedcc86066f17edc620a105b04a6cdbd284b6d767abdb1b88ecfb07791b0
Non-Secret Config
- Allowed origin:
https://porterlabz.com - Support logs bucket:
nyra-mobile-support-logs - Android releases bucket:
nyra-android-releases - Env files loaded for secret upload: 3 (
server/.env.local,external env file,external env file)
Worker Config
- planned:
cloud/mobile-bridge-worker/wrangler.jsonc- Dry run only; Wrangler config was not written.
Command Center State
- skipped: Dry run cannot write deployment facts into command-center state.
Post-Deploy Verification
- not verified: dry run, deploy skipped, or Worker URL unavailable.
Step Status
- planned:
npm.cmd run cloud:mobile-bridge:check - planned:
C:\Program Files\nodejs\node.exe <repo>\node_modules\wrangler\bin\wrangler.js whoami - planned:
C:\Program Files\nodejs\node.exe <repo>\node_modules\wrangler\bin\wrangler.js r2 bucket create nyra-mobile-support-logs - planned:
C:\Program Files\nodejs\node.exe <repo>\node_modules\wrangler\bin\wrangler.js r2 bucket create nyra-android-releases - planned:
C:\Program Files\nodejs\node.exe <repo>\node_modules\wrangler\bin\wrangler.js r2 object put nyra-android-releases/alpha/0.1.0-alpha.83/NyrA.apk --file <repo>\release\current\android\NyrA.apk --remote
Secret Status
- Secret upload skipped, dry-run only, or failed before secret upload.
No-Secret Rule
Raw bridge/provider secrets are only read from process environment or approved local env files, then sent to Wrangler stdin. They are not written to reports, dashboard state, configs, or source files.
README
NyrA Mobile Bridge Worker
This Worker is the durable hosted replacement for the temporary local/tunnel mobile bridge. It exposes the same /api/nyra/* route contract already used by the Android and browser surfaces, so phones can keep using NyrA chat, provider status, app updates, realtime setup, audio fallback, and support-log upload after the development PC is offline.
Local Checks
npm run cloud:mobile-bridge:check
npm run test:cloud-mobile-bridge
npm run cloud:mobile-bridge:bootstrap -- --dry-run --skip-secrets --skip-deploy
Deploy Path
- Create or confirm the Cloudflare account and route for the hosted bridge, for example
https://bridge.porterlabz.com. - Run the bootstrap dry run and inspect
docs/launch_command_center/MOBILE_BRIDGE_CLOUD_BOOTSTRAP.md. - Confirm the
nyra-swarm-memoryD1 database exists. The productionSWARM_DBbinding inwrangler.jsoncmust point to it. - Run the full bootstrap after Wrangler is authenticated. It applies all D1 migrations before deploying:
npm run cloud:mobile-bridge:bootstrap -- --worker-url=https://bridge.porterlabz.com --write-state
- Only the full bootstrap can update command-center deployment facts. Dry runs never write stable bridge values into
command-center-state.json, even if--write-stateis passed. - A full bootstrap runs post-deploy verification before writing state:
/health, authenticated status, update metadata, APK HEAD, support-log upload/list/readback, and a live chat smoke must pass. - If secrets already exist in Cloudflare, use
--skip-secretsand set only missing secrets manually. - Replace the production
bucket_namevalues only if the deployed bucket names differ. - Save the deployed bridge URL in the command center and in Android build/runtime settings.
- Run a phone self-test from Settings > Updates > Bridge self-test.
The bootstrap creates the support-log and Android-release R2 buckets when needed, uploads the current signed APK to R2, writes non-secret Worker vars for the current APK SHA/version, and can deploy the Worker. It never writes raw bridge/provider secrets to reports, dashboard state, configs, or source files.
Routing Learning Storage
SWARM_DB is a D1 binding for tenant-scoped adaptive routing outcomes. Each authenticated account gets an irreversible SHA-256 tenant identifier. NyrA retains up to seven days of task category, provider, model, success/failure, latency, token counts, and an outcome code so future Worker isolates can choose better routes from measured results.
The table does not store prompts, answers, transcripts, email addresses, screenshots, files, API keys, bridge tokens, or other user content. GET /api/nyra/status reports routingLearning.storage: d1, durable: true, and storesUserContent: false when durable learning is active. If D1 is unavailable, chat remains fail-open with isolated in-memory routing evidence and status reports the degraded storage state.
For a manual production migration and deploy:
npm run cloud:mobile-bridge:migrate
npm run cloud:mobile-bridge:deploy
Secret Setup
npx wrangler secret put NYRA_MOBILE_BRIDGE_TOKEN --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_OPENAI_API_KEY --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_ANTHROPIC_API_KEY --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_GEMINI_API_KEY --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_GROK_API_KEY --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_LICENSE_SIGNING_SECRET --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_ANDROID_DOWNLOAD_TICKET_SECRET --cwd cloud/mobile-bridge-worker --env production
Routes
GET /health: public structural health check with storage/auth configuration only.GET /api/nyra/model-policy/v2: current public cacheable quality-gated routing policy without credentials or user data.GET /api/nyra/model-policy: legacy policy URL retained for older clients.GET /api/nyra/status: authenticated provider readiness and hosted bridge status.POST /api/nyra/tester/enroll: authenticated allowlisted internal-tester device enrollment.GET /api/nyra/update/latest: authenticated Android update metadata.POST /api/nyra/update/android/download-ticket: authenticated short-lived Android APK download ticket for paid/device-token installs.GET /api/nyra/update/android/apk: authenticated Android APK download. Streams from theANDROID_RELEASESR2 bucket whenNYRA_ANDROID_UPDATE_APK_R2_KEYis set, or redirects to an absoluteNYRA_ANDROID_UPDATE_APK_URL.HEAD /api/nyra/update/android/apk: authenticated APK metadata probe for phone self-tests without downloading the APK.POST /api/nyra/chat: authenticated swarm chat with Captain/Crew council routing for deeper prompts.POST /api/nyra/cancel: compatibility route. Hosted Workers are stateless per request, so this acknowledges but cannot cancel a completed fetch after the HTTP request is gone.POST /api/nyra/transcribe-audio: authenticated OpenAI transcription fallback.POST /api/nyra/tts-audio: authenticated OpenAI text-to-speech fallback.POST /api/nyra/realtime-client-secret: authenticated OpenAI realtime ephemeral secret setup.POST /api/nyra/logs: authenticated redacted support diagnostics upload to R2.GET /api/nyra/logsandGET /api/nyra/logs/:id: authenticated support-log listing/readback for Codex debugging.
No-Go Rules
- Do not deploy with
ALLOW_DEV_OPEN_API=truein production. - Do not ship a production Android build with a shared bridge token as customer authentication. Paid/customer builds must use the billing device access token plus short-lived APK download tickets.
- Do not store raw chats, API keys, card data, passwords, screenshots, or unrestricted transcripts in support logs.
- Do not claim phone/computer control is production-ready until Android accessibility, screen capture, and high-impact consent gates pass on the final build.
Deployment Checklist
NyrA Mobile Bridge Deployment Checklist
Preflight
cloud/mobile-bridge-worker/wrangler.jsonchasnodejs_compat, observability, productionALLOWED_ORIGIN, theSUPPORT_LOGSandANDROID_RELEASESR2 bindings, and theSWARM_DBD1 binding.- The
nyra-swarm-memoryD1 database exists and0001_tenant_routing_outcomes.sqlis present. ALLOW_DEV_OPEN_APIisfalsein production.NYRA_MOBILE_BRIDGE_TOKENis set through Wrangler secrets.NYRA_LICENSE_SIGNING_SECRETmatches the billing worker so paid device access tokens can authenticate to the bridge.NYRA_ANDROID_DOWNLOAD_TICKET_SECRETis set through Wrangler secrets for short-lived APK installer links.- Provider secrets are set through Wrangler secrets: OpenAI, Anthropic, Gemini, and Grok/xAI.
- Android update metadata vars are set if this Worker is the hosted update source.
- The Android APK is either uploaded to the
ANDROID_RELEASESR2 bucket withNYRA_ANDROID_UPDATE_APK_R2_KEY, orNYRA_ANDROID_UPDATE_APK_URLis an absolute external HTTPS URL.
Commands
npm run cloud:mobile-bridge:bootstrap -- --dry-run --skip-secrets --skip-deploy
npm run cloud:mobile-bridge:check
npx wrangler r2 bucket create nyra-mobile-support-logs
npx wrangler r2 bucket create nyra-android-releases
npx wrangler secret put NYRA_MOBILE_BRIDGE_TOKEN --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_OPENAI_API_KEY --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_ANTHROPIC_API_KEY --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_GEMINI_API_KEY --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_GROK_API_KEY --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_LICENSE_SIGNING_SECRET --cwd cloud/mobile-bridge-worker --env production
npx wrangler secret put NYRA_ANDROID_DOWNLOAD_TICKET_SECRET --cwd cloud/mobile-bridge-worker --env production
npm run cloud:mobile-bridge:migrate
npm run cloud:mobile-bridge:deploy
After Cloudflare authentication is working and secrets are available in environment variables, the preferred one-command path is:
npm run cloud:mobile-bridge:bootstrap -- --worker-url=https://bridge.porterlabz.com --write-state
Use --skip-secrets only when the Cloudflare Worker secrets have already been set manually. The bootstrap report is written to docs/launch_command_center/MOBILE_BRIDGE_CLOUD_BOOTSTRAP.md and docs/launch_command_center/mobile-bridge-cloud-bootstrap.json.
Dry runs are plan-only and cannot write deployment facts into docs/launch_command_center/command-center-state.json, even when --write-state is passed.
Full bootstrap state writes require post-deploy verification: /health, authenticated status, update manifest, APK HEAD, support-log roundtrip, and chat smoke.
Post-Deploy Verification
GET /healthreturnsservice: nyra-mobile-bridge-api.GET /healthreportsstorage.swarmRoutingD1: true.GET /api/nyra/statusrejects missing tokens.GET /api/nyra/statuswithX-NyrA-Bridge-Tokenshows provider readiness without returning secret values.GET /api/nyra/statuswith a signed paid device access token succeeds withoutX-NyrA-Bridge-Token.- Authenticated status reports
routingLearning.storage: d1,durable: true,scope: tenant, andstoresUserContent: false. - A chat outcome remains available to the same tenant in a fresh Worker isolate and is absent from a different tenant.
POST /api/nyra/chatreturns text andprovider/modelroute metadata.GET /api/nyra/update/latestreturns the alpha version, version code, SHA, and APK route or absolute APK URL.POST /api/nyra/update/android/download-ticketreturns a short-lived APK URL for Android installer handoff.GET /api/nyra/update/android/apkdownloads an APK or redirects to the configured absolute APK URL.HEAD /api/nyra/update/android/apkreturns APK content metadata for phone self-tests without a full download.POST /api/nyra/logs,GET /api/nyra/logs, andGET /api/nyra/logs/:idround-trip a redacted diagnostics bundle through R2.- Android Settings > Updates bridge self-test reaches the deployed URL.
Wrangler Config
{
"$schema": "../../node_modules/wrangler/config-schema.json",
"name": "nyra-mobile-bridge-api",
"main": "src/index.mjs",
"compatibility_date": "2026-06-09",
"compatibility_flags": [
"nodejs_compat"
],
"observability": {
"enabled": true
},
"vars": {
"ALLOWED_ORIGIN": "http://localhost:5173",
"ALLOW_DEV_OPEN_API": "false",
"NYRA_TESTER_EMAILS": "porter4040@gmail.com",
"NYRA_ADMIN_TESTER_EMAIL": "porter4040@gmail.com",
"NYRA_TESTER_DEVICE_TOKEN_SECONDS": "2592000",
"NYRA_ANDROID_UPDATE_CHANNEL": "alpha"
},
"d1_databases": [
{
"binding": "SWARM_DB",
"database_name": "nyra-swarm-memory",
"database_id": "5fa71710-ce4f-432f-a031-a36d8a28d317",
"migrations_dir": "migrations"
}
],
"r2_buckets": [
{
"binding": "SUPPORT_LOGS",
"bucket_name": "nyra-mobile-support-logs"
},
{
"binding": "ANDROID_RELEASES",
"bucket_name": "nyra-android-releases"
}
],
"env": {
"local": {
"vars": {
"ALLOWED_ORIGIN": "http://localhost:5173",
"ALLOW_DEV_OPEN_API": "true",
"NYRA_TESTER_EMAILS": "porter4040@gmail.com",
"NYRA_ADMIN_TESTER_EMAIL": "porter4040@gmail.com",
"NYRA_TESTER_DEVICE_TOKEN_SECONDS": "2592000",
"NYRA_ANDROID_UPDATE_CHANNEL": "alpha"
},
"d1_databases": [
{
"binding": "SWARM_DB",
"database_name": "nyra-swarm-memory",
"database_id": "5fa71710-ce4f-432f-a031-a36d8a28d317",
"migrations_dir": "migrations"
}
],
"r2_buckets": [
{
"binding": "SUPPORT_LOGS",
"bucket_name": "nyra-mobile-support-logs"
},
{
"binding": "ANDROID_RELEASES",
"bucket_name": "nyra-android-releases"
}
]
},
"production": {
"routes": [
{
"pattern": "bridge.porterlabz.com",
"custom_domain": true
}
],
"vars": {
"ALLOWED_ORIGIN": "https://porterlabz.com",
"ALLOW_DEV_OPEN_API": "false",
"NYRA_TESTER_EMAILS": "porter4040@gmail.com",
"NYRA_ADMIN_TESTER_EMAIL": "porter4040@gmail.com",
"NYRA_TESTER_DEVICE_TOKEN_SECONDS": "2592000",
"NYRA_ANDROID_UPDATE_CHANNEL": "alpha",
"NYRA_ANDROID_UPDATE_VERSION": "0.1.0-alpha.83",
"NYRA_ANDROID_UPDATE_VERSION_CODE": "83",
"NYRA_ANDROID_UPDATE_APK_R2_KEY": "alpha/0.1.0-alpha.83/NyrA.apk",
"NYRA_ANDROID_UPDATE_APK_FILENAME": "NyrA.apk",
"NYRA_ANDROID_UPDATE_SHA256": "b92bbedcc86066f17edc620a105b04a6cdbd284b6d767abdb1b88ecfb07791b0",
"NYRA_ANDROID_UPDATE_NOTES": "Builds the current Android app code as an installable alpha release APK.|Current alpha signing material is stored outside the repo under the Windows user profile.|Internal alpha APKs can include the hosted mobile bridge URL and token from local runtime handoff files so remote phones connect without manual bridge setup.|If a phone has an older NyrA APK signed by a different certificate, Android requires uninstalling that build before installing this signer lineage."
},
"d1_databases": [
{
"binding": "SWARM_DB",
"database_name": "nyra-swarm-memory",
"database_id": "5fa71710-ce4f-432f-a031-a36d8a28d317",
"migrations_dir": "migrations"
}
],
"r2_buckets": [
{
"binding": "SUPPORT_LOGS",
"bucket_name": "nyra-mobile-support-logs"
},
{
"binding": "ANDROID_RELEASES",
"bucket_name": "nyra-android-releases"
}
]
}
}
}