- 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/local/src (2 of 25 files). Show all
Unified · Split
| @@ -84,10 +84,16 @@ const addSourceFromConfig = ( · 83 unmodified lines | ||
| 84 | 84 | executor: LocalExecutor, |
| 85 | 85 | source: SourceConfig, |
| 86 | 86 | ): Effect.Effect<void, unknown> => { |
| 87 | + // `executor.jsonc` is a single-scope artifact today — the file isn't | |
| 88 | + // aware of per-user tenancy. Pin replayed sources to the outermost | |
| 89 | + // scope so a future `[user, org]` stack still sees them via org | |
| 90 | + // fall-through. | |
| 91 | + const scope = executor.scopes.at(-1)!.id as string; | |
| 87 | 92 | switch (source.kind) { |
| 88 | 93 | case "openapi": |
| 89 | 94 | return executor.openapi.addSpec({ |
| 90 | 95 | spec: source.spec, |
| 96 | + scope, | |
| 91 | 97 | baseUrl: source.baseUrl, |
| 92 | 98 | namespace: source.namespace, |
| 93 | 99 | headers: translateHeaders(source.headers), |
| @@ -96,6 +102,7 @@ const addSourceFromConfig = ( · 2 unmodified lines | ||
| 96 | 102 | case "graphql": |
| 97 | 103 | return executor.graphql.addSource({ |
| 98 | 104 | endpoint: source.endpoint, |
| 105 | + scope, | |
| 99 | 106 | namespace: source.namespace, |
| 100 | 107 | headers: translateHeaders(source.headers) as Record<string, string> | undefined, |
| 101 | 108 | }).pipe(Effect.asVoid); |
| @@ -104,6 +111,7 @@ const addSourceFromConfig = ( · 2 unmodified lines | ||
| 104 | 111 | if (source.transport === "stdio") { |
| 105 | 112 | return executor.mcp.addSource({ |
| 106 | 113 | transport: "stdio", |
| 114 | + scope, | |
| 107 | 115 | name: source.name, |
| 108 | 116 | command: source.command, |
| 109 | 117 | args: source.args ? [...source.args] : undefined, |
| @@ -114,6 +122,7 @@ const addSourceFromConfig = ( · 4 unmodified lines | ||
| 114 | 122 | } |
| 115 | 123 | return executor.mcp.addSource({ |
| 116 | 124 | transport: "remote", |
| 125 | + scope, | |
| 117 | 126 | name: source.name, |
| 118 | 127 | endpoint: source.endpoint, |
| 119 | 128 | remoteTransport: source.remoteTransport, |
| @@ -154,7 +154,7 @@ const createLocalExecutorLayer = () => { · 153 unmodified lines | ||
| 154 | 154 | }); |
| 155 | 155 | |
| 156 | 156 | const executor = yield* createExecutor({ |
| 157 | − scope, | |
| 157 | + scopes: [scope], | |
| 158 | 158 | adapter, |
| 159 | 159 | blobs, |
| 160 | 160 | plugins, |