Definitively.Maestro.RunState (definitively v0.4.0)

Copy Markdown

Read/write maestro run context under .definitively/state/.

maestro-run.json is the working copy (may be read by LLM prompts). maestro-sealed.json holds definitively-owned keys that LLM steps must not clobber.

Summary

Functions

Returns a value from sealed state first, then working state.

Initializes plan file from run inputs, options, or deprecated env vars.

Loads run state; missing file returns empty map.

Loads sealed state; missing file returns empty map.

Returns the state file path under the workspace .definitively/state/ directory.

Merges keys into run state and persists.

Persists protected keys to sealed state (definitively maestro nodes only).

Returns the sealed state file path.

Types

t()

@type t() :: map()

Functions

get(workspace_root, key)

@spec get(Path.t(), String.t()) :: term()

Returns a value from sealed state first, then working state.

init_plan(workspace_root, opts \\ nil)

@spec init_plan(Path.t(), map() | nil) :: :ok | {:error, term()}

Initializes plan file from run inputs, options, or deprecated env vars.

load(workspace_root)

@spec load(Path.t()) :: t()

Loads run state; missing file returns empty map.

load_sealed(workspace_root)

@spec load_sealed(Path.t()) :: t()

Loads sealed state; missing file returns empty map.

path(workspace_root)

@spec path(Path.t()) :: Path.t()

Returns the state file path under the workspace .definitively/state/ directory.

put(workspace_root, attrs)

@spec put(Path.t(), t()) :: :ok | {:error, term()}

Merges keys into run state and persists.

seal(workspace_root, attrs)

@spec seal(Path.t(), t()) :: :ok | {:error, term()}

Persists protected keys to sealed state (definitively maestro nodes only).

sealed_path(workspace_root)

@spec sealed_path(Path.t()) :: Path.t()

Returns the sealed state file path.