Planck.Headless.ResourceStore (Planck.Headless v0.1.5)

Copy Markdown View Source

GenServer started at application boot that holds the loaded resources — the single source of truth for skills, teams, and available models.

Resources are loaded once at startup from the directories configured in Planck.Headless.Config. New sessions pick up whatever is in the store at the time they start; in-flight sessions are not affected by reloads.

Reload

Planck.Headless.ResourceStore.reload()

Triggers a synchronous reload of tools, skills, and teams from disk. Available models are also re-resolved.

Summary

Functions

Returns a specification to start this module under a supervisor.

Clear all sidecar tools. Called by SidecarManager on nodedown.

Return the full resource store state.

Replace the sidecar tool list. Called by SidecarManager on nodeup.

Register a zero-arity function to be called after every reload/0.

Register a local-node tool globally. Replaces any existing tool with the same name.

Reload tools, skills, and teams from disk.

Start the ResourceStore under its supervisor.

Remove a globally registered tool by name. No-op if not found.

Types

t()

@type t() :: %Planck.Headless.ResourceStore{
  available_models: [Planck.AI.Model.t()],
  on_reload: term(),
  registered_tools: [Planck.Agent.Tool.t()],
  skills: [Planck.Agent.Skill.t()],
  teams: %{required(String.t()) => Planck.Agent.Team.t()},
  tools: [Planck.Agent.Tool.t()]
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear_tools()

@spec clear_tools() :: :ok

Clear all sidecar tools. Called by SidecarManager on nodedown.

get()

@spec get() :: t()

Return the full resource store state.

put_tools(tools)

@spec put_tools([Planck.Agent.Tool.t()]) :: :ok

Replace the sidecar tool list. Called by SidecarManager on nodeup.

register_on_reload(fun)

@spec register_on_reload((-> any())) :: :ok

Register a zero-arity function to be called after every reload/0.

Useful for packages that sit above planck_headless in the dependency tree and need to invalidate their own caches (e.g. Skogsra config values) when files change on disk. Callbacks are preserved across reloads.

register_tool(tool)

@spec register_tool(Planck.Agent.Tool.t()) :: :ok

Register a local-node tool globally. Replaces any existing tool with the same name.

reload()

@spec reload() :: :ok

Reload tools, skills, and teams from disk.

In-flight sessions keep their original resources. Only new sessions created after this call will see the updated resources.

start_link(opts \\ [])

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

Start the ResourceStore under its supervisor.

unregister_tool(name)

@spec unregister_tool(String.t()) :: :ok

Remove a globally registered tool by name. No-op if not found.