CommBus.Prompts.OverrideStore.Memory (CommBus v0.1.0)

Copy Markdown View Source

In-memory override store for testing and local usage.

Summary

Functions

Stores a new prompt override in the in-memory agent. The override map should contain :slug, :content, and optionally :scope, :metadata, :active, and :priority keys.

Retrieves the highest-priority active override for the given prompt slug, optionally filtered by scope.

Starts the in-memory override store backed by an Agent process.

Functions

create_override(attrs)

Stores a new prompt override in the in-memory agent. The override map should contain :slug, :content, and optionally :scope, :metadata, :active, and :priority keys.

Parameters

  • attrs — A map of override attributes.

Returns

{:ok, normalized_override} on success.

get_active_override(slug, opts \\ [])

Retrieves the highest-priority active override for the given prompt slug, optionally filtered by scope.

Parameters

  • slug — The prompt slug to look up.
  • opts — Keyword options: :name (agent name), :scope (filter by scope).

Returns

A map with :slug, :content, :scope, :metadata, :active, :priority keys, or nil if no active override exists.

start_link(opts \\ [])

@spec start_link(keyword()) :: Agent.on_start()

Starts the in-memory override store backed by an Agent process.

Parameters

  • opts — Keyword options: :name (process name, defaults to module name).

Returns

{:ok, pid} on success.