Raxol.AgentClientProtocol.Schema.Diff (Raxol Agent Client Protocol v0.1.0)

Copy Markdown View Source

A diff representing file modifications.

Ported from the MIT f1729/agent_client_protocol (c) 2025 f1729; see NOTICE.md.

Fixed defect

Upstream's to_json/1 unconditionally emitted "oldText" => nil when old_text was absent (a new-file diff), instead of omitting the key. The ACP schema types oldText as optional (string | null); this port omits it like every other absent-optional field, rather than emitting an explicit wire null.

Summary

Functions

Total: never raises. Missing/non-string path or newText is the only failure mode.

Types

t()

@type t() :: %Raxol.AgentClientProtocol.Schema.Diff{
  _meta: map(),
  new_text: String.t(),
  old_text: String.t() | nil,
  path: String.t()
}

Functions

from_json(map)

@spec from_json(term()) :: {:ok, t()} | {:error, term()}

Total: never raises. Missing/non-string path or newText is the only failure mode.

new(path, new_text)

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

to_json(diff)

@spec to_json(t()) :: map()