- 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/org (1 of 25 files). Show all
Unified · Split
| @@ -3,8 +3,8 @@ import { Effect } from "effect"; · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | import { UserStoreService } from "../auth/context"; | 4 | import { UserStoreService } from "../auth/context"; |
| 5 | import { AuthContext } from "../auth/middleware"; | 5 | import { AuthContext } from "../auth/middleware"; |
| 6 | import { env } from "cloudflare:workers"; | ||
| 6 | import { WorkOSAuth } from "../auth/workos"; | 7 | import { WorkOSAuth } from "../auth/workos"; |
| 7 | import { server } from "../env"; | ||
| 8 | import { AutumnService } from "../services/autumn"; | 8 | import { AutumnService } from "../services/autumn"; |
| 9 | import { OrgHttpApi } from "./compose"; | 9 | import { OrgHttpApi } from "./compose"; |
| 10 | import { Forbidden } from "./api"; | 10 | import { Forbidden } from "./api"; |
| @@ -144,7 +144,7 @@ export const OrgHandlers = HttpApiBuilder.group(OrgHttpApi, "org", (handlers) => · 133 unmodified lines | |||
| 144 | const workos = yield* WorkOSAuth; | 144 | const workos = yield* WorkOSAuth; |
| 145 | const { link } = yield* workos.generateDomainVerificationPortalLink( | 145 | const { link } = yield* workos.generateDomainVerificationPortalLink( |
| 146 | auth.organizationId, | 146 | auth.organizationId, |
| 147 | server.VITE_PUBLIC_SITE_URL ? `${server.VITE_PUBLIC_SITE_URL}/org` : "/org", | 147 | env.VITE_PUBLIC_SITE_URL ? `${env.VITE_PUBLIC_SITE_URL}/org` : "/org", |
| 148 | ); | 148 | ); |
| 149 | return { link }; | 149 | return { link }; |
| 150 | }), | 150 | }), |