History

Move product access rules out of the SDK

Rhys Sullivan committed 2 months ago

Commit c676e561 parent a72e51d161 files · +3935 −867Browse files

Showing the changes to packages/core/api/src/server/execution-stack.ts (1 of 161 files). Show all

Unified · Split

packages/core/api/src/server/execution-stack.ts+9−8
@@ -27,7 +27,7 @@ import { Context, Effect, Layer } from "effect"; · 26 unmodified lines
2727 import type * as Cause from "effect/Cause";
2828
2929 import type { McpResource } from "@executor-js/host-mcp";
30−import type { AnyPlugin, Executor, ExecutorConfig, StorageFailure } from "@executor-js/sdk";
30+import type { AnyPlugin, Executor, ExecutorAccess, StorageFailure } from "@executor-js/sdk";
3131 import {
3232 createExecutionEngine,
3333 type ExecutionEngine,
@@ -112,11 +112,12 @@ export const makeExecutionStack = < · 78 unmodified lines
112112 accountId: string,
113113 organizationId: string,
114114 organizationName: string,
115− options?: {
115+ options: {
116116 readonly mcpResource?: McpResource;
117− /** Workspace-settings permission for this binding (see
118− * `ExecutorConfig.orgWrites`), derived from the acting member's role. */
119− readonly orgWrites?: ExecutorConfig<TPlugins>["orgWrites"];
117+ /** The product's access decisions for this binding (see
118+ * `ExecutorConfig.access`), selected by the host — role-derived on the
119+ * HTTP plane, request-bound on MCP session stacks. */
120+ readonly access: ExecutorAccess;
120121 },
121122 ): Effect.Effect<
122123 { readonly executor: Executor<TPlugins>; readonly engine: ExecutionEngine<Cause.YieldableError> },
@@ -129,8 +130,8 @@ export const makeExecutionStack = < · 6 unmodified lines
129130 organizationId,
130131 organizationName,
131132 {
132− plugins: { mcpResource: options?.mcpResource },
133− ...(options?.orgWrites === undefined ? {} : { orgWrites: options.orgWrites }),
133+ plugins: { mcpResource: options.mcpResource },
134+ access: options.access,
134135 },
135136 ).pipe(Effect.withSpan("executor.stack.scoped_executor"));
136137 const codeExecutor = yield* CodeExecutorProvider.asEffect().pipe(
@@ -147,7 +148,7 @@ export const makeExecutionStack = < · 10 unmodified lines
147148 organizationId,
148149 organizationName,
149150 },
150− { mcpResource: options?.mcpResource },
151+ { mcpResource: options.mcpResource },
151152 ),
152153 );
153154 return { executor, engine };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t