register-kinds

Extension API register kinds.

auth-backend

Auth credential backend. Resolves an api-key or rotates an OAuth token for one or more providers.

Fields for auth-backend register-kind contract
FieldTypeRequiredSummary
:api-key () -> string|nilyesReturn the current bearer/API key, refreshing or loading secrets as needed.
:login! (opts) -> anyOptional. Drives fen --login <name>.
:logout! () -> anyOptional. Drives fen --logout <name>.
:name keyword|stringyesAuth backend name selected by provider configuration or CLI login/logout flags.

command

Slash command contribution. Looked up by name when the user submits /<name> <args> from a presenter.

Fields for command register-kind contract
FieldTypeRequiredSummary
:description stringHuman-readable command help shown in command listings and docs.
:handler (args caller-state) -> anyyesCallback invoked with raw command arguments and the caller's runtime state.
:idle-only? booleanRefuse the command while the agent is busy.
:name keyword|stringyesCommand name without the leading slash.
:order numberSort hint for /help.

control

Keyboard/UI control surface for presenters that support typed input bindings.

Fields for control register-kind contract
FieldTypeRequiredSummary
:description stringHuman-readable explanation of the control's UI effect.
:handler (ctx) -> anyyesCallback invoked by the presenter when the control is activated.
:name keyword|stringyesStable control name exposed to presenter help and docs.

hook

Lifecycle hook (currently before-tool). Inspects a tool call before it executes.

Fields for hook register-kind contract
FieldTypeRequiredSummary
:before-tool (tool-name args ctx) -> anyyesReturn {:block true :reason string} to veto.

introspect

Read-only extension state snapshot provider. Collected on demand for agent_state, /extensions, and runtime diagnostics.

Fields for introspect register-kind contract
FieldTypeRequiredSummary
:description stringHuman-readable description shown by diagnostics and docs.
:name keyword|stringyesOwner-scoped snapshot name. Multiple extensions may reuse the same name.
:snapshot (ctx) -> tableyesCheap, side-effect-free thunk returning JSON-friendly data. It is pcall-isolated and should not expose secrets.

panel

Non-modal side panel contribution rendered by presenters that support panels.

Fields for panel register-kind contract
FieldTypeRequiredSummary
:enabled? (ctx) -> booleanOptional predicate that hides the panel without unregistering it.
:name keyword|stringyesStable panel name used for toggles, docs, and diagnostics.
:render (ctx) -> anyyesCallback returning rows or presenter-specific content for the panel body.
:title stringOptional display title when the presenter renders panel chrome.

presenter

UI driver. Owns the input/output loop. Exactly one is active per run; the loader picks based on flags and manifest hints.

Fields for presenter register-kind contract
FieldTypeRequiredSummary
:init (ctx) -> nilOptional lifecycle callback run before the presenter loop starts.
:name keyword|stringyesPresenter name selected by CLI flags or extension activation rules.
:run (ctx) -> nilyesMain input/output loop for the selected presenter.
:shutdown (ctx) -> nilOptional lifecycle callback used to release terminal, socket, or other UI resources.

provider

LLM provider contribution. See the :provider-interface contract for the required record.

Fields for provider register-kind contract
FieldTypeRequiredSummary
:api keywordyesProtocol family (:openai-completions, :anthropic-messages, ...). Many providers may share an :api.
:build-body (model ctx options) -> tableyesBuild the provider request body from a model id, AgentContext, and call options.
:complete (model ctx options ?on-event ?yield-fn) -> AssistantMessageyesHigh-level provider entry point that runs one model turn and returns a canonical assistant message.
:convert-messages ([Message]) -> [WireMessage]yesTranslate canonical conversation messages into this provider's wire message format.
:convert-tools ([Tool]) -> [WireTool]yesTranslate canonical tool specs into this provider's wire tool schema.
:map-stop-reason (string) -> StopReasonyesNormalize provider stop reasons into fen's canonical StopReason enum.
:name keyword|stringyesProvider name selected by settings or CLI options.
:parse-response (WireResponse) -> AssistantMessageyesConvert a non-streaming provider response payload into an AssistantMessage.

session-backend

Persistence backend for canonical JSONL-style sessions. The --session flag selects one and fen.core.extensions.register.session_backend.set-active! activates it.

Fields for session-backend register-kind contract
FieldTypeRequiredSummary
:append (session message) -> nilyesPersist one canonical Message to the active session.
:close (session) -> nilyesFlush and release backend resources for an open session.
:find (opts) -> [SessionInfo]yesSearch sessions using backend-specific filters.
:latest (opts) -> SessionInfo|nilyesReturn the newest matching session, if any.
:list (opts) -> [SessionInfo]yesList sessions visible to this backend in a stable display order.
:load (path opts) -> [Message]yesRead canonical messages from a stored session path.
:name keyword|stringyesSession backend name selected by CLI flags or extension configuration.
:open (opts) -> sessionyesCreate or open the active session for a new run.
:open-existing (path opts) -> sessionyesOpen an existing session file or directory for appending.

status

Status-line contributor — produces a short string for the presenter's status row.

Fields for status register-kind contract
FieldTypeRequiredSummary
:name keyword|stringyesStable status item name used for sorting, diagnostics, and docs.
:order numberSort hint within the status side; lower values render earlier.
:render (ctx) -> string|nilyesCallback returning the current status text, or nil/empty text to hide it.

tool

Agent tool contribution. Merged into the per-step AgentContext.tools and dispatched by name when the assistant emits a ToolCall.

Fields for tool register-kind contract
FieldTypeRequiredSummary
:description stringyesProvider-facing guidance explaining when the model should call this tool.
:execute (args ?yield-fn) -> AgentToolResultyesRuntime callback that executes decoded arguments and returns canonical tool content.
:label stringOptional short UI label shown by presenters while the tool runs.
:name stringyesUnique tool name exposed to providers and matched against ToolCall.name.
:parameters JSONSchemayesJSON object schema describing the tool arguments providers may emit.