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

Function runInQuickJs

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

Source from the content-addressed store, hash-verified

475};
476
477const runInQuickJs = (
478 options: QuickJsExecutorOptions,
479 code: string,
480 toolInvoker: SandboxToolInvoker,
481): Effect.Effect<ExecuteResult, QuickJsExecutionError> =>
482 Effect.gen(function* () {
483 const context = yield* Effect.context<never>();
484 const runPromise = Effect.runPromiseWith(context);
485 return yield* Effect.tryPromise({
486 try: () => evaluateInQuickJs(options, code, toolInvoker, runPromise),
487 catch: (cause) => new QuickJsExecutionError({ message: String(cause) }),
488 });
489 }).pipe(
490 Effect.withSpan("executor.code.exec.quickjs", {
491 attributes: { "executor.runtime": "quickjs" },
492 }),
493 );
494
495export const makeQuickJsExecutor = (
496 options: QuickJsExecutorOptions = {},

Callers 1

makeQuickJsExecutorFunction · 0.85

Calls 1

evaluateInQuickJsFunction · 0.85

Tested by

no test coverage detected