- cloud: resolves userId from the authenticated session and builds a [userOrgScope, orgScope] stack via createScopedExecutor(userId, orgId, orgName). userId threaded through execution-stack, mcp-session, and MCP dispatch init. - cloud env refactor: deletes the lazy Proxy apps/cloud/src/env.ts in favor of cloudflare:workers env imported at call sites; adds env-augment.d.ts to type secrets not present in generated wrangler types. - cloud/server.ts: env-guarded OTEL wiring (skips instrument() when AXIOM_TOKEN absent); captures rawFetch before instrument() mutates it so dev requests still land on the Hono app. - cloud/services/db.ts: prefers DATABASE_URL over the hyperdrive proxy so local dev works without the tunnel. - vite.config.ts: devCrashGuard plugin that prints uncaught Worker errors with a stable exit. - hosts/mcp: optional debug flag surfaces verbose session logging, wired up from cloud mcp-session. - local/examples/marketing: migrated to scopes: [scope].
Showing the changes to apps/cloud/src/env-augment.d.ts (1 of 25 files). Show all
Unified · Split
| @@ -0,0 +1,33 @@ | ||
| 1 | +// Augment the wrangler-generated `Cloudflare.Env` with secrets / vars set at | |
| 2 | +// deploy time (via `wrangler secret put`, dashboard, or `.dev.vars`) that | |
| 3 | +// don't show up in `wrangler types` output because they aren't declared in | |
| 4 | +// wrangler.jsonc, but are what `env.X` resolves to at runtime. | |
| 5 | +declare global { | |
| 6 | + namespace Cloudflare { | |
| 7 | + interface Env { | |
| 8 | + // Observability | |
| 9 | + AXIOM_TOKEN?: string; | |
| 10 | + AXIOM_DATASET?: string; | |
| 11 | + AXIOM_TRACES_URL?: string; | |
| 12 | + AXIOM_TRACES_SAMPLE_RATIO?: string; | |
| 13 | + SENTRY_DSN?: string; | |
| 14 | + | |
| 15 | + // Datastore (dev only — prod uses HYPERDRIVE binding) | |
| 16 | + DATABASE_URL?: string; | |
| 17 | + | |
| 18 | + // Billing | |
| 19 | + AUTUMN_SECRET_KEY?: string; | |
| 20 | + | |
| 21 | + // MCP | |
| 22 | + MCP_SESSION_REQUEST_SCOPED_RUNTIME?: string; | |
| 23 | + EXECUTOR_MCP_DEBUG?: string; | |
| 24 | + MCP_AUTHKIT_DOMAIN?: string; | |
| 25 | + MCP_RESOURCE_ORIGIN?: string; | |
| 26 | + | |
| 27 | + // Shared with frontend | |
| 28 | + VITE_PUBLIC_SITE_URL?: string; | |
| 29 | + } | |
| 30 | + } | |
| 31 | +} | |
| 32 | + | |
| 33 | +export {}; | |