Skip to content

TrajectoryRepository ​

python
TrajectoryRepository() -> None

Owns canonical trajectories and materializes retained references on demand.

Source

Methods ​

add_recordings ​

python
add_recordings(recordings: list[TrajectoryRecording], *, priority: float = 0.0, archive_eligible: bool = True) -> list[TrajectoryReferenceRecording]

Source

diagnostics ​

python
diagnostics(directly_visible_trajectory_ids: set[int] | None = None) -> TrajectoryRepositoryDiagnostics

Return live repository diagnostics for debugging retention growth.

Source

frame_stack_coverage ​

python
frame_stack_coverage() -> tuple[int, int]

Return (restorable segments with a frame stack, total restorable segments) across all paths.

Only start-eligible segments count: they are the ones midpoint sampling may draw, and gating makes an unseeded segment unsampleable, so this ratio is the fraction of the store restarts can reach.

Returns:

  • tuple[int, int] – The seeded and total start-eligible restorable segment counts.

Source

load_state_dict ​

python
load_state_dict(state: dict[str, Any]) -> None

Reconstruct full routes from the deduplicated snapshot pool, restoring blob sharing.

Source

materialize ​

python
materialize(recording: TrajectoryReferenceRecording) -> TrajectoryRecording

Source

materialize_prefix_segments ​

python
materialize_prefix_segments(reference: TrajectorySliceReference) -> list[TrajectoryRecording]

Source

materialize_slice ​

python
materialize_slice(trajectory_id: int, *, start_segment: int, min_actions: int = 16, max_actions: int = 48) -> TrajectoryRecording

Materialize one contiguous multi-segment slice of a stored route for behaviour cloning.

Starting from start_segment the window is extended forward, accumulating whole segments, until it holds at least min_actions actions without exceeding max_actions. min_actions is a hard floor: when the forward tail from start_segment is too short (the chosen start sat near the end of the route) the start is backed up one segment at a time until the window reaches the floor while staying within max_actions. Only when the entire route holds fewer than min_actions actions is the whole route returned. Every emitted slice therefore carries a genuine stored initial_state, so a deterministic replay reproduces its frames.

Parameters:

  • trajectory_id (int) – The stored route to slice.
  • start_segment (int) – The preferred first segment of the slice.
  • min_actions (int) – The minimum number of actions the slice must contain.
  • max_actions (int) – The maximum number of actions the slice may contain.

Returns:

  • TrajectoryRecording – The materialized slice recording.

Source

path ​

python
path(trajectory_id: int) -> TrajectoryRepositoryPath | None

Return the stored route for trajectory_id, or None when absent.

Source

path_priorities ​

python
path_priorities() -> dict[int, float]

Return the route-level priority of every ARCHIVE-ELIGIBLE stored route keyed by trajectory id.

Consumed by the best-route archive's rebuild on restore, so ineligible paths (bare mid-route tails) are excluded here exactly as they are excluded from live admission.

Source

paths_needing_frame_stacks ​

python
paths_needing_frame_stacks(limit: int) -> list[tuple[int, TrajectoryRepositoryPath]]

Return up to limit stored paths with at least one restorable segment missing its frame stack.

Newest paths first. A fresh path reflects the current policy's reach, so seeding it first gets the deepest bands sampleable soonest; older unseeded paths are ground away by retention anyway.

Parameters:

  • limit (int) – The maximum number of paths to return.

Returns:

  • list[tuple[int, TrajectoryRepositoryPath]] – (trajectory_id, path) pairs needing a frame-stack replay.

Source

release ​

python
release(reference: TrajectorySliceReference) -> None

Source

retain ​

python
retain(reference: TrajectorySliceReference) -> None

Source

segment ​

python
segment(reference: TrajectorySliceReference) -> TrajectoryRepositorySegment | None

Return the segment a restart from reference would restore to, or None when gone.

A restart resumes at the END of the referenced slice, so this is the stop_index - 1 segment.

Parameters:

  • reference (TrajectorySliceReference) – The slice reference to resolve.

Returns:

  • TrajectoryRepositorySegment | None – The final segment of the slice, or None when the path or index is absent.

Source

set_frame_stacks ​

python
set_frame_stacks(trajectory_id: int, frame_stacks: dict[int, bytes]) -> bool

Attach rebuilt observation frame stacks to a stored route's segments.

Parameters:

  • trajectory_id (int) – The route to attach to.
  • frame_stacks (dict[int, bytes]) – Segment index -> the stack at that segment's end state.

Returns:

  • bool – Whether the route was present and updated.

Source

state_dict ​

python
state_dict() -> dict[str, Any]

Serialise the repository as full routes with deduplicated state snapshots.

Every unique state snapshot blob (the heavy ~tens-of-KB emulator states) is written once into a pool and referenced by index, so a stitched route's shared prefix segments do not duplicate the prefix's snapshots on disk -- matching how they are shared by identity in memory. Each path is stored whole (its action buffer, priority, and segments referencing pool blobs), so loading reconstructs the full multi-segment routes, not flattened single segments.

Source

whole_path_reference ​

python
whole_path_reference(trajectory_id: int) -> TrajectorySliceReference

Build a reference spanning every segment of one stored route.

Parameters:

  • trajectory_id (int) – The route to reference.

Returns:

  • TrajectorySliceReference – A reference covering the whole route.

Source