History

ses fallback

Rhys Sullivan committed 8 months ago

Commit d85f3f01 parent 6d35a4e4 files · +19 −14Browse files

Unified · Split

4 files
  1. bun.lock +1 −0
  2. packages/control-plane/package.json +1 −0
  3. packages/control-plane/src/runtime/workspace-execution-environment.ts +17 −11
  4. packages/runtime-ses/src/index.ts +0 −3
bun.lock+1−0
@@ -148,6 +148,7 @@ · 147 unmodified lines
148 "@executor/codemode-mcp": "workspace:*",148 "@executor/codemode-mcp": "workspace:*",
149 "@executor/codemode-openapi": "workspace:*",149 "@executor/codemode-openapi": "workspace:*",
150 "@executor/runtime-deno-subprocess": "workspace:*",150 "@executor/runtime-deno-subprocess": "workspace:*",
151 "@executor/runtime-ses": "workspace:*",
151 "drizzle-orm": "1.0.0-beta.15-859cf75",152 "drizzle-orm": "1.0.0-beta.15-859cf75",
152 "effect": "catalog:",153 "effect": "catalog:",
153 "graphql": "^16.12.0",154 "graphql": "^16.12.0",
packages/control-plane/package.json+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
27 "@electric-sql/pglite": "^0.3.12",27 "@electric-sql/pglite": "^0.3.12",
28 "@executor/codemode-core": "workspace:*",28 "@executor/codemode-core": "workspace:*",
29 "@executor/codemode-mcp": "workspace:*",29 "@executor/codemode-mcp": "workspace:*",
30 "@executor/runtime-ses": "workspace:*",
30 "@executor/codemode-openapi": "workspace:*",31 "@executor/codemode-openapi": "workspace:*",
31 "@executor/runtime-deno-subprocess": "workspace:*",32 "@executor/runtime-deno-subprocess": "workspace:*",
32 "drizzle-orm": "1.0.0-beta.15-859cf75",33 "drizzle-orm": "1.0.0-beta.15-859cf75",
packages/control-plane/src/runtime/workspace-execution-environment.ts+17−11
@@ -23,7 +23,9 @@ import { · 22 unmodified lines
23 type OpenApiToolDefinition,23 type OpenApiToolDefinition,
24 type OpenApiToolManifest,24 type OpenApiToolManifest,
25} from "@executor/codemode-openapi";25} from "@executor/codemode-openapi";
26import { makeDenoSubprocessExecutor } from "@executor/runtime-deno-subprocess";26import { isDenoAvailable,
27 makeDenoSubprocessExecutor } from "@executor/runtime-deno-subprocess";
28import { makeSesExecutor } from "@executor/runtime-ses";
27import {29import {
28 SqlControlPlaneRowsService,30 SqlControlPlaneRowsService,
29 type SqlControlPlaneRows,31 type SqlControlPlaneRows,
@@ -389,7 +391,7 @@ const loadOpenApiWorkspaceTools = (input: { · 359 unmodified lines
389 description: definition.description,391 description: definition.description,
390 interaction:392 interaction:
391 definition.method.toUpperCase() === "GET"393 definition.method.toUpperCase() === "GET"
392 || definition.method.toUpperCase() === "HEAD"394 || definition.method.toUpperCase() === "HEAD"
393 ? "auto"395 ? "auto"
394 : "required",396 : "required",
395 inputType: presentation.inputType,397 inputType: presentation.inputType,
@@ -627,13 +629,13 @@ const authorizePersistedToolInvocation = (input: { · 231 unmodified lines
627 );629 );
628 const policies = Option.isSome(workspace)630 const policies = Option.isSome(workspace)
629 ? yield* input.rows.policies.listForWorkspaceContext({631 ? yield* input.rows.policies.listForWorkspaceContext({
630 organizationId: workspace.value.organizationId,632 organizationId: workspace.value.organizationId,
631 workspaceId: input.workspaceId,633 workspaceId: input.workspaceId,
632 }).pipe(634 }).pipe(
633 Effect.mapError((cause) =>635 Effect.mapError((cause) =>
634 cause instanceof Error ? cause : new Error(String(cause)),636 cause instanceof Error ? cause : new Error(String(cause)),
635 ),637 ),
636 )638 )
637 : [];639 : [];
638 640
639 const decision = evaluateInvocationPolicy({641 const decision = evaluateInvocationPolicy({
@@ -648,7 +650,7 @@ const authorizePersistedToolInvocation = (input: { · 8 unmodified lines
648 accountId: input.accountId,650 accountId: input.accountId,
649 clientId:651 clientId:
650 typeof input.context?.clientId === "string"652 typeof input.context?.clientId === "string"
651 && input.context.clientId.length > 0653 && input.context.clientId.length > 0
652 ? input.context.clientId654 ? input.context.clientId
653 : null,655 : null,
654 },656 },
@@ -1214,8 +1216,12 @@ export const createWorkspaceExecutionEnvironmentResolver = (input: { · 559 unmodified lines
1214 onElicitation,1216 onElicitation,
1215 });1217 });
1216 1218
1219 const executor = isDenoAvailable()
1220 ? makeDenoSubprocessExecutor()
1221 : makeSesExecutor();
1222
1217 return {1223 return {
1218 executor: makeDenoSubprocessExecutor(),1224 executor,
1219 toolInvoker,1225 toolInvoker,
1220 catalog,1226 catalog,
1221 } satisfies ExecutionEnvironment;1227 } satisfies ExecutionEnvironment;
packages/runtime-ses/src/index.ts+0−3
@@ -13,8 +13,6 @@ export type SesExecutorOptions = { · 12 unmodified lines
13 allowFetch?: boolean;13 allowFetch?: boolean;
14};14};
15 15
16export type InProcessExecutorOptions = SesExecutorOptions;
17
18const DEFAULT_TIMEOUT_MS = 5 * 60_000;16const DEFAULT_TIMEOUT_MS = 5 * 60_000;
19const DEFAULT_EVALUATION_ID = "evaluation";17const DEFAULT_EVALUATION_ID = "evaluation";
20const WORKER_PATH = fileURLToPath(new URL("./sandbox-worker.mjs", import.meta.url));18const WORKER_PATH = fileURLToPath(new URL("./sandbox-worker.mjs", import.meta.url));
@@ -240,4 +238,3 @@ export const makeSesExecutor = ( · 219 unmodified lines
240 execute: (code: string, toolInvoker: ToolInvoker) => runInSes(options, code, toolInvoker),238 execute: (code: string, toolInvoker: ToolInvoker) => runInSes(options, code, toolInvoker),
241});239});
242 240
243export const makeInProcessExecutor = makeSesExecutor;