- All Known Implementing Classes:
InMemoryGeneratedArtifactStore
public interface GeneratedArtifactStore
Run-scoped, transient holder for the bytes a run emits via
CREATE_FILE, so a later deterministic step
(artifact validation) can read the authoritative emitted content in-process — never from disk and never from an
LLM-echoed copy.
Contract:
- Run isolation — entries are keyed by
runId; a run never observes another run's artifacts. - Last-write-wins — registering a
pathalready present for arunIdreplaces its content (honouring theCREATE_FILEoverwrite contract); a rewind that re-emits a captured path upserts rather than failing. - Bounds — implementations enforce configured limits and reject writes that exceed them, failing closed rather than growing without limit. The per-run artifact-count bound is evaluated only when registering a new path; an upsert of an existing path does not count against it.
- Eviction —
remove(String, String)drops a single captured path (used when a retry/rewind clears the emitting step's execution range). - Lifecycle —
clear(String)releases a run's artifacts when the run reaches a terminal state. The store is transient: bytes are not guaranteed to survive a suspend/resume (a distributed or restarted resume loses them), so validation must run in the same drive as capture; the persisted record is theArtifactDescriptorset on the run state. A rewind landing between two writes of the same captured path evicts that path rather than restoring the earlier write — capture feeds a same-driveVALIDATEstep, not general file history.
The default InMemoryGeneratedArtifactStore retains bytes in memory; embedding
applications may supply an alternative implementation.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the artifacts registered forrunId, in registration order.voidReleases all artifacts held forrunId.Returns the emitted content forpathwithinrunId, if present.voidRegisters the emitted bytes of a file produced by a step for the given run.voidRemoves the artifact atpathforrunId, if present.
-
Method Details
-
register
Registers the emitted bytes of a file produced by a step for the given run.- Parameters:
runId- non-blank owning run idstepId- non-blank producing step idpath- non-blank requested artifact pathcontent- emitted content; must not benull- Throws:
IllegalArgumentException- if a configured bound would be exceeded, or an argument is invalid. Re-registering an already-presentpathis not an error — it replaces the prior content (last-write-wins).
-
find
Returns the emitted content forpathwithinrunId, if present.- Parameters:
runId- non-blank run idpath- non-blank artifact path- Returns:
- the content, or empty when no artifact was registered at that path for the run
-
artifacts
Returns the artifacts registered forrunId, in registration order.- Parameters:
runId- non-blank run id- Returns:
- an immutable snapshot (empty when the run has no registered artifacts)
-
remove
Removes the artifact atpathforrunId, if present. Idempotent (a no-op when the run or path is absent).- Parameters:
runId- non-blank run idpath- non-blank artifact path to evict
-
clear
Releases all artifacts held forrunId. Idempotent.- Parameters:
runId- non-blank run id
-