java.lang.Object
com.agentforge4j.llm.fake.StaticFakeResponseSource
- All Implemented Interfaces:
FakeResponseSource
A
FakeResponseSource backed by a single, run-agnostic FakeScript: every run is served the same
script. For single-workflow dev and demos where there is no per-run registration.
Counters are still strictly run-scoped — each run id gets its own ordinal sequences and is
TTL-evicted — so repeated runs do not share an ever-climbing counter and the counter map does not leak. This source
therefore never reports FakeResolution.RunNotScripted: the run's entry is created on first use from the
single script.
-
Constructor Summary
ConstructorsConstructorDescriptionStaticFakeResponseSource(FakeScript script) Creates a static source with default (no TTL, no cap) run-scoped counters.StaticFakeResponseSource(FakeScript script, FakeRunLifecycle counters) Creates a static source whose run-scoped counters use the given lifecycle store (for TTL/cap leak guards). -
Method Summary
Modifier and TypeMethodDescriptionnextResponse(FakeInvocation invocation) Atomically advances the per-sequence ordinal for this invocation and resolves the response.
-
Constructor Details
-
StaticFakeResponseSource
Creates a static source with default (no TTL, no cap) run-scoped counters.- Parameters:
script- the single script served to every run; must not benull
-
StaticFakeResponseSource
Creates a static source whose run-scoped counters use the given lifecycle store (for TTL/cap leak guards). The store is used only for counters and per-run TTL; scripts are not registered against it explicitly.- Parameters:
script- the single script served to every run; must not benullcounters- lifecycle store for run-scoped counters; must not benull
-
-
Method Details
-
nextResponse
Description copied from interface:FakeResponseSourceAtomically advances the per-sequence ordinal for this invocation and resolves the response. Implementations must keep counters isolated perFakeInvocation.runId()so concurrent runs never interleave. When no script is available for the run, no counter is advanced andFakeResolution.RunNotScriptedis returned.- Specified by:
nextResponsein interfaceFakeResponseSource- Parameters:
invocation- the invocation identity (run, workflow, step, agent); nevernull- Returns:
- the resolution: a found response, a missing key, or an unscripted run
-