MingaEditor.Agent.EditTimeline (Minga v0.1.0)

Copy Markdown View Source

Per-file ordered sequence of agent edit snapshots.

Records a snapshot after each tool-driven file change so the user can scrub through the agent's edit history. Each entry stores the file content after that edit, keyed by tool call ID.

Baselines (the content before the first edit) are stored separately so the timeline can show the full range from "before agent touched the file" to the current state.

Summary

Types

t()

@type t() :: %MingaEditor.Agent.EditTimeline{
  baselines: %{required(String.t()) => MingaEditor.Agent.DiffSnapshot.t()},
  entries: %{required(String.t()) => [MingaEditor.Agent.EditTimeline.Entry.t()]},
  viewing: %{required(String.t()) => non_neg_integer() | nil}
}

Functions

baseline_content(edit_timeline, path)

@spec baseline_content(t(), String.t()) :: {:ok, String.t()} | :error

baseline_for(edit_timeline, path)

@spec baseline_for(t(), String.t()) :: MingaEditor.Agent.DiffSnapshot.t() | nil

cleanup(edit_timeline)

@spec cleanup(t()) :: :ok

content_at(timeline, path, index)

@spec content_at(t(), String.t(), non_neg_integer()) :: {:ok, String.t()} | :error

entries_for(edit_timeline, path)

@spec entries_for(t(), String.t()) :: [MingaEditor.Agent.EditTimeline.Entry.t()]

entry_count(edit_timeline, path)

@spec entry_count(t(), String.t()) :: non_neg_integer()

go_live(timeline, path)

@spec go_live(t(), String.t()) :: t()

has_entries?(edit_timeline, path)

@spec has_entries?(t(), String.t()) :: boolean()

new()

@spec new() :: t()

record_edit(timeline, path, tool_call_id, tool_name, before_content, after_content)

@spec record_edit(t(), String.t(), String.t(), String.t(), String.t(), String.t()) ::
  t()

set_viewing(timeline, path, index)

@spec set_viewing(t(), String.t(), non_neg_integer()) :: t()

viewing_index(edit_timeline, path)

@spec viewing_index(t(), String.t()) :: non_neg_integer() | nil