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

Function runInQuickJs

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

Source from the content-addressed store, hash-verified

548};
549
550const runInQuickJs = (
551 options: QuickJsExecutorOptions,
552 code: string,
553 toolInvoker: SandboxToolInvoker,
554): Effect.Effect<ExecuteResult, QuickJsExecutionError> =>
555 Effect.gen(function* () {
556 const context = yield* Effect.context<never>();
557 const runPromise = Effect.runPromiseWith(context);
558 return yield* Effect.tryPromise({
559 try: () => evaluateInQuickJs(options, code, toolInvoker, runPromise),
560 catch: (cause) => new QuickJsExecutionError({ message: String(cause) }),
561 });
562 }).pipe(
563 Effect.withSpan("executor.code.exec.quickjs", {
564 attributes: { "executor.runtime": "quickjs" },
565 }),
566 );
567
568export const makeQuickJsExecutor = (
569 options: QuickJsExecutorOptions = {},

Callers 1

makeQuickJsExecutorFunction · 0.85

Calls 1

evaluateInQuickJsFunction · 0.85

Tested by

no test coverage detected