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

Function elicitationHandler

packages/core/execution/src/engine.ts:698–721  ·  view source on GitHub ↗
(ctx)

Source from the content-addressed store, hash-verified

696 let fiber: Fiber.Fiber<ExecuteResult, E>;
697
698 const elicitationHandler: ElicitationHandler = (ctx) =>
699 Effect.gen(function* () {
700 const responseDeferred = yield* Deferred.make<typeof ElicitationResponse.Type>();
701 // Globally unique — engine instances are rebuilt on host restarts
702 // (Durable Object cold restores, redeploys), so a counter would
703 // re-mint the same ids and let a stale client resume bind to a
704 // different execution's pause.
705 const id = `exec_${crypto.randomUUID()}`;
706
707 const paused: InternalPausedExecution<E> = {
708 id,
709 elicitationContext: ctx,
710 response: responseDeferred,
711 orgWriteAccess,
712 fiber: fiber!,
713 pauseQueue,
714 };
715 pausedExecutions.set(id, paused);
716
717 yield* Queue.offer(pauseQueue, paused);
718
719 // Suspend until resume() completes responseDeferred.
720 return yield* Deferred.await(responseDeferred);
721 });
722
723 const toolPaths: string[] = [];
724 const invoker = makeFullInvoker(

Callers

nothing calls this directly

Calls 1

setMethod · 0.65

Tested by

no test coverage detected