Class RegistryFakeResponseSource

java.lang.Object
com.agentforge4j.llm.fake.RegistryFakeResponseSource
All Implemented Interfaces:
FakeResponseSource

public final class RegistryFakeResponseSource extends Object implements FakeResponseSource
The read face of a FakeRunLifecycle: resolves responses against scripts explicitly registered per run. The same FakeRunLifecycle instance is the write/lifecycle face (register/deregister/sweep) handed to the test runner or demo flow, so the client and the registration API share one per-run store.

When a run has no registered script, nextResponse(FakeInvocation) returns FakeResolution.RunNotScripted.

  • Constructor Details

    • RegistryFakeResponseSource

      public RegistryFakeResponseSource(FakeRunLifecycle lifecycle)
      Creates a source backed by the given lifecycle store.
      Parameters:
      lifecycle - the shared per-run store; must not be null
  • Method Details

    • nextResponse

      public FakeResolution nextResponse(FakeInvocation invocation)
      Description copied from interface: FakeResponseSource
      Atomically advances the per-sequence ordinal for this invocation and resolves the response. Implementations must keep counters isolated per FakeInvocation.runId() so concurrent runs never interleave. When no script is available for the run, no counter is advanced and FakeResolution.RunNotScripted is returned.
      Specified by:
      nextResponse in interface FakeResponseSource
      Parameters:
      invocation - the invocation identity (run, workflow, step, agent); never null
      Returns:
      the resolution: a found response, a missing key, or an unscripted run