( options: QuickJsExecutorOptions, code: string, toolInvoker: SandboxToolInvoker, )
| 528 | }; |
| 529 | |
| 530 | const 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 | |
| 548 | export const makeQuickJsExecutor = ( |
| 549 | options: QuickJsExecutorOptions = {}, |
no test coverage detected