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
27import type * as Cause from "effect/Cause";27import type * as Cause from "effect/Cause";
28 28
29import type { McpResource } from "@executor-js/host-mcp";29import type { McpResource } from "@executor-js/host-mcp";
30import type { AnyPlugin, Executor, ExecutorConfig, StorageFailure } from "@executor-js/sdk";30import type { AnyPlugin, Executor, ExecutorAccess, StorageFailure } from "@executor-js/sdk";
31import {31import {
32 createExecutionEngine,32 createExecutionEngine,
33 type ExecutionEngine,33 type ExecutionEngine,
@@ -112,11 +112,12 @@ export const makeExecutionStack = < · 78 unmodified lines
112 accountId: string,112 accountId: string,
113 organizationId: string,113 organizationId: string,
114 organizationName: string,114 organizationName: string,
115 options?: {115 options: {
116 readonly mcpResource?: McpResource;116 readonly mcpResource?: McpResource;
117 /** Workspace-settings permission for this binding (see117 /** The product's access decisions for this binding (see
118 * `ExecutorConfig.orgWrites`), derived from the acting member's role. */118 * `ExecutorConfig.access`), selected by the host — role-derived on the
119 readonly orgWrites?: ExecutorConfig<TPlugins>["orgWrites"];119 * HTTP plane, request-bound on MCP session stacks. */
120 readonly access: ExecutorAccess;
120 },121 },
121): Effect.Effect<122): Effect.Effect<
122 { readonly executor: Executor<TPlugins>; readonly engine: ExecutionEngine<Cause.YieldableError> },123 { readonly executor: Executor<TPlugins>; readonly engine: ExecutionEngine<Cause.YieldableError> },
@@ -129,8 +130,8 @@ export const makeExecutionStack = < · 6 unmodified lines
129 organizationId,130 organizationId,
130 organizationName,131 organizationName,
131 {132 {
132 plugins: { mcpResource: options?.mcpResource },133 plugins: { mcpResource: options.mcpResource },
133 ...(options?.orgWrites === undefined ? {} : { orgWrites: options.orgWrites }),134 access: options.access,
134 },135 },
135 ).pipe(Effect.withSpan("executor.stack.scoped_executor"));136 ).pipe(Effect.withSpan("executor.stack.scoped_executor"));
136 const codeExecutor = yield* CodeExecutorProvider.asEffect().pipe(137 const codeExecutor = yield* CodeExecutorProvider.asEffect().pipe(
@@ -147,7 +148,7 @@ export const makeExecutionStack = < · 10 unmodified lines
147 organizationId,148 organizationId,
148 organizationName,149 organizationName,
149 },150 },
150 { mcpResource: options?.mcpResource },151 { mcpResource: options.mcpResource },
151 ),152 ),
152 );153 );
153 return { executor, engine };154 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