MingaEditor.Agent.DiffSnapshot (Minga v0.1.0)

Copy Markdown View Source

File-backed snapshots for large-file edit timeline entries.

When a file exceeds the :agent_diff_size_threshold config, entry post-image content is written to temp files instead of held in memory. Temp files are cleaned up when the edit timeline is reset or the session ends.

Summary

Types

t()

A diff snapshot, either memory-backed or file-backed.

Functions

Cleans up temp files for file-backed snapshots.

Returns the raw content from a snapshot.

Creates a snapshot from file content. If the content exceeds the threshold, writes it to a temp file. Otherwise, keeps it in memory.

Types

t()

@type t() :: {:memory, String.t()} | {:file, String.t()}

A diff snapshot, either memory-backed or file-backed.

Functions

cleanup(arg)

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

Cleans up temp files for file-backed snapshots.

content(arg)

@spec content(t()) :: String.t()

Returns the raw content from a snapshot.

from_content(content)

@spec from_content(String.t()) :: t()

Creates a snapshot from file content. If the content exceeds the threshold, writes it to a temp file. Otherwise, keeps it in memory.