Expand description
The second stage of the two-stage pipeline: SpawnerAdapter.
From the engine’s viewpoint there is only one trait,
SpawnerAdapter; its spawn returns Box<dyn Worker> (see
crate::worker::Worker). Worker shape is an implementation detail of
each spawner; the engine only touches Workers through three
operations — id() / cancel_token() / join().
The old WorkerAdapter trait and InProcWorker struct — which
assumed a three-stage Spawner.spawn → WorkerAdapter → invoke
pipeline — were removed on this turn. Nothing instantiated or
dispatched them (dead code), and the multi-invocation path from
was collapsed in the implementation anyway.
The interface is now consolidated into the new trait Worker in
src/worker.rs.
Structs§
- InProc
Spawner agent-string →WorkerFnregistry. The generic parameterWpins the per-kind Worker concrete type at the type level, so AgentBlock / Lua / RustFn each produce their own Worker type throughInProcSpawner<W>and the type binding is preserved right up untilSpawnerAdapter::spawn()erases the return asBox<dyn Worker>.Wmust be constructible fromWorkerJoinHandlerviaFrom— i.e. a newtype that embeds the async-signal handle.- Worker
Invocation - Invocation context handed to a Worker fn. Bundles
token+task_id+prompt+sink. - Worker
Result - The value a
WorkerFnhands back on success, folded into anOutputEvent::Finalby the spawner.
Enums§
- Spawn
Error - Errors that can occur while
SpawnerAdapter::spawnis setting up a worker, before the worker itself starts running. - Worker
Error - Errors surfaced once a worker is running, via
Worker::join.
Traits§
- Spawner
Adapter - First stage of the two-stage pipeline: builds a
Box<dyn Worker>for one attempt. Every concrete spawner (InProcSpawner,ProcessSpawner, the Operator spawner) implements this; the engine only ever holds aArc<dyn SpawnerAdapter>and knows nothing about the Worker shape behind it.
Type Aliases§
- Worker
Fn - A registered agent implementation: takes a
WorkerInvocationand resolves to aWorkerResult(or aWorkerError). Boxed as a type-erasedFutureso heterogeneous agent implementations (async fns, closures capturing state, etc.) can share one registry entry type.