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

Function runInQuickJs

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

Source from the content-addressed store, hash-verified

528};
529
530const runInQuickJs = (
531 options: QuickJsExecutorOptions,
532 code: string,
533 toolInvoker: SandboxToolInvoker,
534): Effect.Effect<ExecuteResult, QuickJsExecutionError> =>
535 Effect.gen(function* () {
536 const context = yield* Effect.context<never>();
537 const runPromise = Effect.runPromiseWith(context);
538 return yield* Effect.tryPromise({
539 try: () => evaluateInQuickJs(options, code, toolInvoker, runPromise),
540 catch: (cause) => new QuickJsExecutionError({ message: String(cause) }),
541 });
542 }).pipe(
543 Effect.withSpan("executor.code.exec.quickjs", {
544 attributes: { "executor.runtime": "quickjs" },
545 }),
546 );
547
548export const makeQuickJsExecutor = (
549 options: QuickJsExecutorOptions = {},

Callers 1

makeQuickJsExecutorFunction · 0.85

Calls 1

evaluateInQuickJsFunction · 0.85

Tested by

no test coverage detected