History

more clean up

Rhys Sullivan committed 8 months ago

Commit ffbd44d1 parent 50606af9 files · +25 −63Browse files

Unified · Split

9 files
  1. v2/apps/convex/convex/run_executor.ts +0 −8
  2. v2/apps/convex/package.json +1 −0
  3. v2/apps/pm/package.json +1 −0
  4. v2/bun.lock +2 −2
  5. v2/packages/engine/src/runtime-adapters.ts +8 −3
  6. v2/packages/runtime-deno-subprocess/package.json +0 −1
  7. v2/packages/runtime-deno-subprocess/src/index.ts +8 −36
  8. v2/packages/runtime-local-inproc/package.json +0 −1
  9. v2/packages/runtime-local-inproc/src/index.ts +5 −12
v2/apps/convex/convex/run_executor.ts+0−8
@@ -2,10 +2,6 @@ import { · 1 unmodified line
22 RunExecutionService,
33 RunExecutionServiceLive,
44 } from "@executor-v2/domain";
5−import {
6− ToolProviderRegistryService,
7− makeToolProviderRegistry,
8−} from "@executor-v2/engine";
95 import type { ExecuteRunInput, ExecuteRunResult } from "@executor-v2/sdk";
106 import * as Context from "effect/Context";
117 import * as Effect from "effect/Effect";
@@ -36,7 +32,3 @@ export const ConvexRunExecutorLive = Layer.effect( · 24 unmodified lines
3632 }),
3733 ).pipe(Layer.provide(ConvexRunExecutionLive));
3834
39−export const ConvexToolProviderRegistryLive = Layer.succeed(
40− ToolProviderRegistryService,
41− makeToolProviderRegistry([]),
42−);
v2/apps/convex/package.json+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 "@executor-v2/domain": "workspace:*",
1515 "@executor-v2/engine": "workspace:*",
1616 "@executor-v2/mcp-gateway": "workspace:*",
17+ "@executor-v2/persistence-ports": "workspace:*",
1718 "@executor-v2/runtime-local-inproc": "workspace:*",
1819 "@executor-v2/schema": "workspace:*",
1920 "@executor-v2/sdk": "workspace:*",
v2/apps/pm/package.json+1−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 },
2525 "devDependencies": {
2626 "@effect/vitest": "catalog:",
27+ "@modelcontextprotocol/sdk": "^1.26.0",
2728 "vitest": "catalog:"
2829 }
2930 }
v2/bun.lock+2−2
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 "@executor-v2/domain": "workspace:*",
2727 "@executor-v2/engine": "workspace:*",
2828 "@executor-v2/mcp-gateway": "workspace:*",
29+ "@executor-v2/persistence-ports": "workspace:*",
2930 "@executor-v2/runtime-local-inproc": "workspace:*",
3031 "@executor-v2/schema": "workspace:*",
3132 "@executor-v2/sdk": "workspace:*",
@@ -56,6 +57,7 @@ · 24 unmodified lines
5657 },
5758 "devDependencies": {
5859 "@effect/vitest": "catalog:",
60+ "@modelcontextprotocol/sdk": "^1.26.0",
5961 "vitest": "catalog:",
6062 },
6163 },
@@ -174,7 +176,6 @@ · 112 unmodified lines
174176 "name": "@executor-v2/runtime-deno-subprocess",
175177 "dependencies": {
176178 "@executor-v2/engine": "workspace:*",
177− "@executor-v2/schema": "workspace:*",
178179 "effect": "catalog:",
179180 },
180181 },
@@ -182,7 +183,6 @@ · 1 unmodified line
182183 "name": "@executor-v2/runtime-local-inproc",
183184 "dependencies": {
184185 "@executor-v2/engine": "workspace:*",
185− "@executor-v2/schema": "workspace:*",
186186 "effect": "catalog:",
187187 },
188188 },
v2/packages/engine/src/runtime-adapters.ts+8−3
@@ -3,13 +3,18 @@ import * as Data from "effect/Data"; · 2 unmodified lines
33 import * as Effect from "effect/Effect";
44 import * as Layer from "effect/Layer";
55
6−import type { ToolProviderRegistryService } from "./tool-providers";
6+import type { Source } from "@executor-v2/schema";
7+
8+import type {
9+ CanonicalToolDescriptor,
10+ ToolProviderRegistryService,
11+} from "./tool-providers";
712
813 export type RuntimeAdapterKind = string;
914
1015 export type RuntimeRunnableTool = {
11− descriptor: unknown;
12− source: unknown | null;
16+ descriptor: CanonicalToolDescriptor;
17+ source: Source | null;
1318 };
1419
1520 export type RuntimeExecuteInput = {
v2/packages/runtime-deno-subprocess/package.json+0−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
1010 },
1111 "dependencies": {
1212 "@executor-v2/engine": "workspace:*",
13− "@executor-v2/schema": "workspace:*",
1413 "effect": "catalog:"
1514 }
1615 }
v2/packages/runtime-deno-subprocess/src/index.ts+8−36
@@ -1,19 +1,14 @@
11 import { existsSync } from "node:fs";
22 import { fileURLToPath } from "node:url";
33
4−import type { Source } from "@executor-v2/schema";
54 import * as Effect from "effect/Effect";
65 import * as Runtime from "effect/Runtime";
76 import * as Schema from "effect/Schema";
87
98 import {
109 RuntimeAdapterError,
11− type CanonicalToolDescriptor,
1210 type RuntimeAdapter,
13− type RuntimeAdapterKind,
1411 type RuntimeRunnableTool,
15− type ToolProviderError,
16− type ToolProviderRegistryError,
1712 ToolProviderRegistryService,
1813 } from "@executor-v2/engine";
1914 import { spawnDenoWorkerProcess } from "./deno-worker-process";
@@ -23,14 +18,11 @@ const runtimeKind = "deno-subprocess"; · 3 unmodified lines
2318 export const DenoSubprocessRunnerError = RuntimeAdapterError;
2419 export type DenoSubprocessRunnerError = RuntimeAdapterError;
2520
26−export type DenoRunnableTool = {
27− descriptor: CanonicalToolDescriptor;
28− source: Source | null;
29−};
21+export type DenoRunnableTool = RuntimeRunnableTool;
3022
3123 export type ExecuteJavaScriptInDenoInput = {
3224 code: string;
33− tools: ReadonlyArray<DenoRunnableTool>;
25+ tools: ReadonlyArray<RuntimeRunnableTool>;
3426 timeoutMs?: number;
3527 denoExecutable?: string;
3628 };
@@ -199,13 +191,10 @@ const handleToolCall = ( · 162 unmodified lines
199191 toolBindings: ReadonlyMap<string, DenoRunnableTool>,
200192 runPromise: <A, E>(effect: Effect.Effect<A, E, never>) => Promise<A>,
201193 invokeTool: (input: {
202− source: Source | null;
203− tool: CanonicalToolDescriptor;
194+ source: RuntimeRunnableTool["source"];
195+ tool: RuntimeRunnableTool["descriptor"];
204196 args: unknown;
205− }) => Effect.Effect<
206− { output: unknown; isError: boolean },
207− ToolProviderRegistryError | ToolProviderError
208− >,
197+ }) => Effect.Effect<{ output: unknown; isError: boolean }, unknown>,
209198 stdin: NodeJS.WritableStream,
210199 ): Effect.Effect<void, DenoSubprocessRunnerError> =>
211200 Effect.gen(function* () {
@@ -260,11 +249,7 @@ export const isDenoSubprocessRuntimeAvailable = ( · 48 unmodified lines
260249
261250 export const executeJavaScriptInDenoSubprocess = (
262251 input: ExecuteJavaScriptInDenoInput,
263−): Effect.Effect<
264− unknown,
265− DenoSubprocessRunnerError | ToolProviderRegistryError | ToolProviderError,
266− ToolProviderRegistryService
267−> =>
252+): Effect.Effect<unknown, DenoSubprocessRunnerError, ToolProviderRegistryService> =>
268253 Effect.gen(function* () {
269254 const registry = yield* ToolProviderRegistryService;
270255 const runtime = yield* Effect.runtime<never>();
@@ -440,17 +425,6 @@ export const executeJavaScriptInDenoSubprocess = ( · 169 unmodified lines
440425 });
441426 });
442427
443−const toRuntimeAdapterError = (
444− runtimeKind: RuntimeAdapterKind,
445− error: DenoSubprocessRunnerError | ToolProviderRegistryError | ToolProviderError,
446−): RuntimeAdapterError =>
447− new RuntimeAdapterError({
448− operation: error.operation,
449− runtimeKind,
450− message: error.message,
451− details: "details" in error ? error.details : null,
452− });
453−
454428 export const makeDenoSubprocessRuntimeAdapter = (
455429 options: DenoSubprocessRuntimeAdapterOptions = {},
456430 ): RuntimeAdapter => ({
@@ -459,12 +433,10 @@ export const makeDenoSubprocessRuntimeAdapter = ( · 2 unmodified lines
459433 execute: (input) =>
460434 executeJavaScriptInDenoSubprocess({
461435 code: input.code,
462− tools: input.tools as ReadonlyArray<DenoRunnableTool>,
436+ tools: input.tools,
463437 timeoutMs: input.timeoutMs ?? options.defaultTimeoutMs,
464438 denoExecutable: options.denoExecutable,
465− }).pipe(
466− Effect.mapError((error) => toRuntimeAdapterError("deno-subprocess", error)),
467− ),
439+ }),
468440 });
469441
470442 export type { RuntimeRunnableTool };
v2/packages/runtime-local-inproc/package.json+0−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
1010 },
1111 "dependencies": {
1212 "@executor-v2/engine": "workspace:*",
13− "@executor-v2/schema": "workspace:*",
1413 "effect": "catalog:"
1514 }
1615 }
v2/packages/runtime-local-inproc/src/index.ts+5−12
@@ -1,10 +1,8 @@
1−import type { Source } from "@executor-v2/schema";
21 import * as Effect from "effect/Effect";
32 import * as Runtime from "effect/Runtime";
43
54 import {
65 RuntimeAdapterError,
7− type CanonicalToolDescriptor,
86 type RuntimeAdapter,
97 type RuntimeRunnableTool,
108 ToolProviderRegistryService,
@@ -12,14 +10,9 @@ import { · 1 unmodified line
1210
1311 const runtimeKind = "local-inproc";
1412
15−export type RunnableTool = {
16− descriptor: CanonicalToolDescriptor;
17− source: Source | null;
18−};
19−
2013 export type ExecuteJavaScriptInput = {
2114 code: string;
22− tools: ReadonlyArray<RunnableTool>;
15+ tools: ReadonlyArray<RuntimeRunnableTool>;
2316 };
2417
2518 const runtimeError = (
@@ -56,10 +49,10 @@ const toExecutionError = (cause: unknown): RuntimeAdapterError => · 30 unmodified lines
5649 );
5750
5851 const buildToolBindings = (
59− tools: ReadonlyArray<RunnableTool>,
60−): Effect.Effect<Map<string, RunnableTool>, RuntimeAdapterError> =>
52+ tools: ReadonlyArray<RuntimeRunnableTool>,
53+): Effect.Effect<Map<string, RuntimeRunnableTool>, RuntimeAdapterError> =>
6154 Effect.gen(function* () {
62− const byToolId = new Map<string, RunnableTool>();
55+ const byToolId = new Map<string, RuntimeRunnableTool>();
6356
6457 for (const tool of tools) {
6558 const toolId = tool.descriptor.toolId;
@@ -129,7 +122,7 @@ export const makeLocalInProcessRuntimeAdapter = (): RuntimeAdapter => ({ · 63 unmodified lines
129122 execute: (input) =>
130123 executeJavaScriptWithTools({
131124 code: input.code,
132− tools: input.tools as ReadonlyArray<RunnableTool>,
125+ tools: input.tools,
133126 }),
134127 });
135128