MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / runInQuickJs

Function runInQuickJs

packages/kernel/runtime-quickjs/src/index.ts:467–483  ·  view source on GitHub ↗
(
  options: QuickJsExecutorOptions,
  code: string,
  toolInvoker: SandboxToolInvoker,
)

Source from the content-addressed store, hash-verified

465};
466
467const runInQuickJs = (
468 options: QuickJsExecutorOptions,
469 code: string,
470 toolInvoker: SandboxToolInvoker,
471): Effect.Effect<ExecuteResult, QuickJsExecutionError> =>
472 Effect.gen(function* () {
473 const context = yield* Effect.context<never>();
474 const runPromise = Effect.runPromiseWith(context);
475 return yield* Effect.tryPromise({
476 try: () => evaluateInQuickJs(options, code, toolInvoker, runPromise),
477 catch: (cause) => new QuickJsExecutionError({ message: String(cause) }),
478 });
479 }).pipe(
480 Effect.withSpan("executor.code.exec.quickjs", {
481 attributes: { "executor.runtime": "quickjs" },
482 }),
483 );
484
485export const makeQuickJsExecutor = (
486 options: QuickJsExecutorOptions = {},

Callers 1

makeQuickJsExecutorFunction · 0.85

Calls 1

evaluateInQuickJsFunction · 0.85

Tested by

no test coverage detected