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
148148 "@executor/codemode-mcp": "workspace:*",
149149 "@executor/codemode-openapi": "workspace:*",
150150 "@executor/runtime-deno-subprocess": "workspace:*",
151+ "@executor/runtime-ses": "workspace:*",
151152 "drizzle-orm": "1.0.0-beta.15-859cf75",
152153 "effect": "catalog:",
153154 "graphql": "^16.12.0",
packages/control-plane/package.json+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 "@electric-sql/pglite": "^0.3.12",
2828 "@executor/codemode-core": "workspace:*",
2929 "@executor/codemode-mcp": "workspace:*",
30+ "@executor/runtime-ses": "workspace:*",
3031 "@executor/codemode-openapi": "workspace:*",
3132 "@executor/runtime-deno-subprocess": "workspace:*",
3233 "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
2323 type OpenApiToolDefinition,
2424 type OpenApiToolManifest,
2525 } from "@executor/codemode-openapi";
26−import { makeDenoSubprocessExecutor } from "@executor/runtime-deno-subprocess";
26+import { isDenoAvailable,
27+ makeDenoSubprocessExecutor } from "@executor/runtime-deno-subprocess";
28+import { makeSesExecutor } from "@executor/runtime-ses";
2729 import {
2830 SqlControlPlaneRowsService,
2931 type SqlControlPlaneRows,
@@ -389,7 +391,7 @@ const loadOpenApiWorkspaceTools = (input: { · 359 unmodified lines
389391 description: definition.description,
390392 interaction:
391393 definition.method.toUpperCase() === "GET"
392− || definition.method.toUpperCase() === "HEAD"
394+ || definition.method.toUpperCase() === "HEAD"
393395 ? "auto"
394396 : "required",
395397 inputType: presentation.inputType,
@@ -627,13 +629,13 @@ const authorizePersistedToolInvocation = (input: { · 231 unmodified lines
627629 );
628630 const policies = Option.isSome(workspace)
629631 ? yield* input.rows.policies.listForWorkspaceContext({
630− organizationId: workspace.value.organizationId,
631− workspaceId: input.workspaceId,
632− }).pipe(
633− Effect.mapError((cause) =>
634− cause instanceof Error ? cause : new Error(String(cause)),
635− ),
636− )
632+ organizationId: workspace.value.organizationId,
633+ workspaceId: input.workspaceId,
634+ }).pipe(
635+ Effect.mapError((cause) =>
636+ cause instanceof Error ? cause : new Error(String(cause)),
637+ ),
638+ )
637639 : [];
638640
639641 const decision = evaluateInvocationPolicy({
@@ -648,7 +650,7 @@ const authorizePersistedToolInvocation = (input: { · 8 unmodified lines
648650 accountId: input.accountId,
649651 clientId:
650652 typeof input.context?.clientId === "string"
651− && input.context.clientId.length > 0
653+ && input.context.clientId.length > 0
652654 ? input.context.clientId
653655 : null,
654656 },
@@ -1214,8 +1216,12 @@ export const createWorkspaceExecutionEnvironmentResolver = (input: { · 559 unmodified lines
12141216 onElicitation,
12151217 });
12161218
1219+ const executor = isDenoAvailable()
1220+ ? makeDenoSubprocessExecutor()
1221+ : makeSesExecutor();
1222+
12171223 return {
1218− executor: makeDenoSubprocessExecutor(),
1224+ executor,
12191225 toolInvoker,
12201226 catalog,
12211227 } satisfies ExecutionEnvironment;
packages/runtime-ses/src/index.ts+0−3
@@ -13,8 +13,6 @@ export type SesExecutorOptions = { · 12 unmodified lines
1313 allowFetch?: boolean;
1414 };
1515
16−export type InProcessExecutorOptions = SesExecutorOptions;
17−
1816 const DEFAULT_TIMEOUT_MS = 5 * 60_000;
1917 const DEFAULT_EVALUATION_ID = "evaluation";
2018 const WORKER_PATH = fileURLToPath(new URL("./sandbox-worker.mjs", import.meta.url));
@@ -240,4 +238,3 @@ export const makeSesExecutor = ( · 219 unmodified lines
240238 execute: (code: string, toolInvoker: ToolInvoker) => runInSes(options, code, toolInvoker),
241239 });
242240
243−export const makeInProcessExecutor = makeSesExecutor;