Unified · Split
| @@ -2,10 +2,6 @@ import { · 1 unmodified line | ||
| 2 | 2 | RunExecutionService, |
| 3 | 3 | RunExecutionServiceLive, |
| 4 | 4 | } from "@executor-v2/domain"; |
| 5 | −import { | |
| 6 | − ToolProviderRegistryService, | |
| 7 | − makeToolProviderRegistry, | |
| 8 | −} from "@executor-v2/engine"; | |
| 9 | 5 | import type { ExecuteRunInput, ExecuteRunResult } from "@executor-v2/sdk"; |
| 10 | 6 | import * as Context from "effect/Context"; |
| 11 | 7 | import * as Effect from "effect/Effect"; |
| @@ -36,7 +32,3 @@ export const ConvexRunExecutorLive = Layer.effect( · 24 unmodified lines | ||
| 36 | 32 | }), |
| 37 | 33 | ).pipe(Layer.provide(ConvexRunExecutionLive)); |
| 38 | 34 | |
| 39 | −export const ConvexToolProviderRegistryLive = Layer.succeed( | |
| 40 | − ToolProviderRegistryService, | |
| 41 | − makeToolProviderRegistry([]), | |
| 42 | −); | |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | "@executor-v2/domain": "workspace:*", |
| 15 | 15 | "@executor-v2/engine": "workspace:*", |
| 16 | 16 | "@executor-v2/mcp-gateway": "workspace:*", |
| 17 | + "@executor-v2/persistence-ports": "workspace:*", | |
| 17 | 18 | "@executor-v2/runtime-local-inproc": "workspace:*", |
| 18 | 19 | "@executor-v2/schema": "workspace:*", |
| 19 | 20 | "@executor-v2/sdk": "workspace:*", |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | }, |
| 25 | 25 | "devDependencies": { |
| 26 | 26 | "@effect/vitest": "catalog:", |
| 27 | + "@modelcontextprotocol/sdk": "^1.26.0", | |
| 27 | 28 | "vitest": "catalog:" |
| 28 | 29 | } |
| 29 | 30 | } |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | "@executor-v2/domain": "workspace:*", |
| 27 | 27 | "@executor-v2/engine": "workspace:*", |
| 28 | 28 | "@executor-v2/mcp-gateway": "workspace:*", |
| 29 | + "@executor-v2/persistence-ports": "workspace:*", | |
| 29 | 30 | "@executor-v2/runtime-local-inproc": "workspace:*", |
| 30 | 31 | "@executor-v2/schema": "workspace:*", |
| 31 | 32 | "@executor-v2/sdk": "workspace:*", |
| @@ -56,6 +57,7 @@ · 24 unmodified lines | ||
| 56 | 57 | }, |
| 57 | 58 | "devDependencies": { |
| 58 | 59 | "@effect/vitest": "catalog:", |
| 60 | + "@modelcontextprotocol/sdk": "^1.26.0", | |
| 59 | 61 | "vitest": "catalog:", |
| 60 | 62 | }, |
| 61 | 63 | }, |
| @@ -174,7 +176,6 @@ · 112 unmodified lines | ||
| 174 | 176 | "name": "@executor-v2/runtime-deno-subprocess", |
| 175 | 177 | "dependencies": { |
| 176 | 178 | "@executor-v2/engine": "workspace:*", |
| 177 | − "@executor-v2/schema": "workspace:*", | |
| 178 | 179 | "effect": "catalog:", |
| 179 | 180 | }, |
| 180 | 181 | }, |
| @@ -182,7 +183,6 @@ · 1 unmodified line | ||
| 182 | 183 | "name": "@executor-v2/runtime-local-inproc", |
| 183 | 184 | "dependencies": { |
| 184 | 185 | "@executor-v2/engine": "workspace:*", |
| 185 | − "@executor-v2/schema": "workspace:*", | |
| 186 | 186 | "effect": "catalog:", |
| 187 | 187 | }, |
| 188 | 188 | }, |
| @@ -3,13 +3,18 @@ import * as Data from "effect/Data"; · 2 unmodified lines | ||
| 3 | 3 | import * as Effect from "effect/Effect"; |
| 4 | 4 | import * as Layer from "effect/Layer"; |
| 5 | 5 | |
| 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"; | |
| 7 | 12 | |
| 8 | 13 | export type RuntimeAdapterKind = string; |
| 9 | 14 | |
| 10 | 15 | export type RuntimeRunnableTool = { |
| 11 | − descriptor: unknown; | |
| 12 | − source: unknown | null; | |
| 16 | + descriptor: CanonicalToolDescriptor; | |
| 17 | + source: Source | null; | |
| 13 | 18 | }; |
| 14 | 19 | |
| 15 | 20 | export type RuntimeExecuteInput = { |
| @@ -10,7 +10,6 @@ · 9 unmodified lines | ||
| 10 | 10 | }, |
| 11 | 11 | "dependencies": { |
| 12 | 12 | "@executor-v2/engine": "workspace:*", |
| 13 | − "@executor-v2/schema": "workspace:*", | |
| 14 | 13 | "effect": "catalog:" |
| 15 | 14 | } |
| 16 | 15 | } |
| @@ -1,19 +1,14 @@ | ||
| 1 | 1 | import { existsSync } from "node:fs"; |
| 2 | 2 | import { fileURLToPath } from "node:url"; |
| 3 | 3 | |
| 4 | −import type { Source } from "@executor-v2/schema"; | |
| 5 | 4 | import * as Effect from "effect/Effect"; |
| 6 | 5 | import * as Runtime from "effect/Runtime"; |
| 7 | 6 | import * as Schema from "effect/Schema"; |
| 8 | 7 | |
| 9 | 8 | import { |
| 10 | 9 | RuntimeAdapterError, |
| 11 | − type CanonicalToolDescriptor, | |
| 12 | 10 | type RuntimeAdapter, |
| 13 | − type RuntimeAdapterKind, | |
| 14 | 11 | type RuntimeRunnableTool, |
| 15 | − type ToolProviderError, | |
| 16 | − type ToolProviderRegistryError, | |
| 17 | 12 | ToolProviderRegistryService, |
| 18 | 13 | } from "@executor-v2/engine"; |
| 19 | 14 | import { spawnDenoWorkerProcess } from "./deno-worker-process"; |
| @@ -23,14 +18,11 @@ const runtimeKind = "deno-subprocess"; · 3 unmodified lines | ||
| 23 | 18 | export const DenoSubprocessRunnerError = RuntimeAdapterError; |
| 24 | 19 | export type DenoSubprocessRunnerError = RuntimeAdapterError; |
| 25 | 20 | |
| 26 | −export type DenoRunnableTool = { | |
| 27 | − descriptor: CanonicalToolDescriptor; | |
| 28 | − source: Source | null; | |
| 29 | −}; | |
| 21 | +export type DenoRunnableTool = RuntimeRunnableTool; | |
| 30 | 22 | |
| 31 | 23 | export type ExecuteJavaScriptInDenoInput = { |
| 32 | 24 | code: string; |
| 33 | − tools: ReadonlyArray<DenoRunnableTool>; | |
| 25 | + tools: ReadonlyArray<RuntimeRunnableTool>; | |
| 34 | 26 | timeoutMs?: number; |
| 35 | 27 | denoExecutable?: string; |
| 36 | 28 | }; |
| @@ -199,13 +191,10 @@ const handleToolCall = ( · 162 unmodified lines | ||
| 199 | 191 | toolBindings: ReadonlyMap<string, DenoRunnableTool>, |
| 200 | 192 | runPromise: <A, E>(effect: Effect.Effect<A, E, never>) => Promise<A>, |
| 201 | 193 | invokeTool: (input: { |
| 202 | − source: Source | null; | |
| 203 | − tool: CanonicalToolDescriptor; | |
| 194 | + source: RuntimeRunnableTool["source"]; | |
| 195 | + tool: RuntimeRunnableTool["descriptor"]; | |
| 204 | 196 | args: unknown; |
| 205 | − }) => Effect.Effect< | |
| 206 | − { output: unknown; isError: boolean }, | |
| 207 | − ToolProviderRegistryError | ToolProviderError | |
| 208 | − >, | |
| 197 | + }) => Effect.Effect<{ output: unknown; isError: boolean }, unknown>, | |
| 209 | 198 | stdin: NodeJS.WritableStream, |
| 210 | 199 | ): Effect.Effect<void, DenoSubprocessRunnerError> => |
| 211 | 200 | Effect.gen(function* () { |
| @@ -260,11 +249,7 @@ export const isDenoSubprocessRuntimeAvailable = ( · 48 unmodified lines | ||
| 260 | 249 | |
| 261 | 250 | export const executeJavaScriptInDenoSubprocess = ( |
| 262 | 251 | input: ExecuteJavaScriptInDenoInput, |
| 263 | −): Effect.Effect< | |
| 264 | − unknown, | |
| 265 | − DenoSubprocessRunnerError | ToolProviderRegistryError | ToolProviderError, | |
| 266 | − ToolProviderRegistryService | |
| 267 | −> => | |
| 252 | +): Effect.Effect<unknown, DenoSubprocessRunnerError, ToolProviderRegistryService> => | |
| 268 | 253 | Effect.gen(function* () { |
| 269 | 254 | const registry = yield* ToolProviderRegistryService; |
| 270 | 255 | const runtime = yield* Effect.runtime<never>(); |
| @@ -440,17 +425,6 @@ export const executeJavaScriptInDenoSubprocess = ( · 169 unmodified lines | ||
| 440 | 425 | }); |
| 441 | 426 | }); |
| 442 | 427 | |
| 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 | − | |
| 454 | 428 | export const makeDenoSubprocessRuntimeAdapter = ( |
| 455 | 429 | options: DenoSubprocessRuntimeAdapterOptions = {}, |
| 456 | 430 | ): RuntimeAdapter => ({ |
| @@ -459,12 +433,10 @@ export const makeDenoSubprocessRuntimeAdapter = ( · 2 unmodified lines | ||
| 459 | 433 | execute: (input) => |
| 460 | 434 | executeJavaScriptInDenoSubprocess({ |
| 461 | 435 | code: input.code, |
| 462 | − tools: input.tools as ReadonlyArray<DenoRunnableTool>, | |
| 436 | + tools: input.tools, | |
| 463 | 437 | timeoutMs: input.timeoutMs ?? options.defaultTimeoutMs, |
| 464 | 438 | denoExecutable: options.denoExecutable, |
| 465 | − }).pipe( | |
| 466 | − Effect.mapError((error) => toRuntimeAdapterError("deno-subprocess", error)), | |
| 467 | − ), | |
| 439 | + }), | |
| 468 | 440 | }); |
| 469 | 441 | |
| 470 | 442 | export type { RuntimeRunnableTool }; |
| @@ -10,7 +10,6 @@ · 9 unmodified lines | ||
| 10 | 10 | }, |
| 11 | 11 | "dependencies": { |
| 12 | 12 | "@executor-v2/engine": "workspace:*", |
| 13 | − "@executor-v2/schema": "workspace:*", | |
| 14 | 13 | "effect": "catalog:" |
| 15 | 14 | } |
| 16 | 15 | } |
| @@ -1,10 +1,8 @@ | ||
| 1 | −import type { Source } from "@executor-v2/schema"; | |
| 2 | 1 | import * as Effect from "effect/Effect"; |
| 3 | 2 | import * as Runtime from "effect/Runtime"; |
| 4 | 3 | |
| 5 | 4 | import { |
| 6 | 5 | RuntimeAdapterError, |
| 7 | − type CanonicalToolDescriptor, | |
| 8 | 6 | type RuntimeAdapter, |
| 9 | 7 | type RuntimeRunnableTool, |
| 10 | 8 | ToolProviderRegistryService, |
| @@ -12,14 +10,9 @@ import { · 1 unmodified line | ||
| 12 | 10 | |
| 13 | 11 | const runtimeKind = "local-inproc"; |
| 14 | 12 | |
| 15 | −export type RunnableTool = { | |
| 16 | − descriptor: CanonicalToolDescriptor; | |
| 17 | − source: Source | null; | |
| 18 | −}; | |
| 19 | − | |
| 20 | 13 | export type ExecuteJavaScriptInput = { |
| 21 | 14 | code: string; |
| 22 | − tools: ReadonlyArray<RunnableTool>; | |
| 15 | + tools: ReadonlyArray<RuntimeRunnableTool>; | |
| 23 | 16 | }; |
| 24 | 17 | |
| 25 | 18 | const runtimeError = ( |
| @@ -56,10 +49,10 @@ const toExecutionError = (cause: unknown): RuntimeAdapterError => · 30 unmodified lines | ||
| 56 | 49 | ); |
| 57 | 50 | |
| 58 | 51 | const buildToolBindings = ( |
| 59 | − tools: ReadonlyArray<RunnableTool>, | |
| 60 | −): Effect.Effect<Map<string, RunnableTool>, RuntimeAdapterError> => | |
| 52 | + tools: ReadonlyArray<RuntimeRunnableTool>, | |
| 53 | +): Effect.Effect<Map<string, RuntimeRunnableTool>, RuntimeAdapterError> => | |
| 61 | 54 | Effect.gen(function* () { |
| 62 | − const byToolId = new Map<string, RunnableTool>(); | |
| 55 | + const byToolId = new Map<string, RuntimeRunnableTool>(); | |
| 63 | 56 | |
| 64 | 57 | for (const tool of tools) { |
| 65 | 58 | const toolId = tool.descriptor.toolId; |
| @@ -129,7 +122,7 @@ export const makeLocalInProcessRuntimeAdapter = (): RuntimeAdapter => ({ · 63 unmodified lines | ||
| 129 | 122 | execute: (input) => |
| 130 | 123 | executeJavaScriptWithTools({ |
| 131 | 124 | code: input.code, |
| 132 | − tools: input.tools as ReadonlyArray<RunnableTool>, | |
| 125 | + tools: input.tools, | |
| 133 | 126 | }), |
| 134 | 127 | }); |
| 135 | 128 | |