MingaAgent.ModelResolver (Minga v0.1.0)

Copy Markdown View Source

Resolves boundary input into one exact executable ModelSelection.

Catalog lookup happens only at selection and restore boundaries. Restore validates the persisted exact route against its current source-owned declaration and never substitutes another route.

Summary

Functions

Lists exact credential-backed executable routes suitable for the picker.

Formats an actionable, secret-free resolution error.

Resolves raw config, picker, command, or migration input to one exact selection.

Validates persisted exact route data against its source without route substitution.

Types

context()

@type context() :: %{
  spec: MingaAgent.Provider.Spec.t(),
  config: MingaAgent.Config.t(),
  snapshot: MingaAgent.Credentials.Snapshot.t(),
  opts: keyword()
}

intent()

resolution_error()

@type resolution_error() ::
  :no_available_model
  | {:invalid_model_selection, String.t()}
  | {:model_not_found, String.t()}
  | {:backend_unavailable, String.t()}
  | {:credential_unavailable, String.t()}
  | {:route_unavailable, String.t()}
  | {:incompatible_selection, String.t()}
  | {:selection_correction_required, String.t()}

source()

@type source() :: {:catalog, map()}

Functions

candidates(opts \\ [])

@spec candidates(keyword()) :: [MingaAgent.ModelCandidate.t()]

Lists exact credential-backed executable routes suitable for the picker.

message(other)

@spec message(resolution_error() | term()) :: String.t()

Formats an actionable, secret-free resolution error.

resolve(intent, opts \\ [])

@spec resolve(intent(), keyword()) ::
  {:ok, MingaAgent.ModelSelection.t()} | {:error, resolution_error()}

Resolves raw config, picker, command, or migration input to one exact selection.

restore(value, opts \\ [])

Validates persisted exact route data against its source without route substitution.