- 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/services/execution-stack.ts (1 of 25 files). Show all
Unified · Split
| @@ -14,11 +14,17 @@ import { withExecutionUsageTracking } from "../api/execution-usage"; · 13 unmodified lines | |||
| 14 | import { AutumnService } from "./autumn"; | 14 | import { AutumnService } from "./autumn"; |
| 15 | import { createScopedExecutor } from "./executor"; | 15 | import { createScopedExecutor } from "./executor"; |
| 16 | 16 | ||
| 17 | export const makeExecutionStack = (organizationId: string, organizationName: string) => | 17 | export const makeExecutionStack = ( |
| 18 | userId: string, | ||
| 19 | organizationId: string, | ||
| 20 | organizationName: string, | ||
| 21 | ) => | ||
| 18 | Effect.gen(function* () { | 22 | Effect.gen(function* () { |
| 19 | const executor = yield* createScopedExecutor(organizationId, organizationName).pipe( | 23 | const executor = yield* createScopedExecutor( |
| 20 | Effect.withSpan("McpSessionDO.createScopedExecutor"), | 24 | userId, |
| 21 | ); | 25 | organizationId, |
| 26 | organizationName, | ||
| 27 | ).pipe(Effect.withSpan("McpSessionDO.createScopedExecutor")); | ||
| 22 | const codeExecutor = makeDynamicWorkerExecutor({ loader: env.LOADER }); | 28 | const codeExecutor = makeDynamicWorkerExecutor({ loader: env.LOADER }); |
| 23 | const autumn = yield* AutumnService; | 29 | const autumn = yield* AutumnService; |
| 24 | const engine = withExecutionUsageTracking( | 30 | const engine = withExecutionUsageTracking( |