ExAthena.Providers.ClaudeCode.ModelSource behaviour (ExAthena v0.17.0)

Copy Markdown View Source

Boundary for discovering the models the local Claude Code CLI supports.

The claude_code SDK reports its available models through the control-protocol initialize handshake (ClaudeCode.Session.supported_models/1). That requires a live CLI session, so we wrap it behind this behaviour: the real implementation (SDKModelSource) talks to the SDK, while tests supply a stub. Pick the implementation via app config (:ex_athena, :claude_code_model_source).

Summary

Callbacks

Returns the models the CLI reports, as ClaudeCode.Model.Info structs (or plain maps with a :value/"value" key). {:error, reason} when the CLI is unavailable or the handshake fails.

Callbacks

supported_models()

@callback supported_models() :: {:ok, [struct() | map()]} | {:error, term()}

Returns the models the CLI reports, as ClaudeCode.Model.Info structs (or plain maps with a :value/"value" key). {:error, reason} when the CLI is unavailable or the handshake fails.