Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentOptions ¶
type AgentOptions struct {
Iterations int `yaml:"iterations"`
MaxAttempts int `yaml:"max_attempts"`
MaxRetries int `yaml:"max_retries"`
ForceReasoning bool `yaml:"force_reasoning"`
}
AgentOptions holds configuration for the cogito ExecuteTools function
type AgentTypeConfig ¶
type AgentTypeConfig struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
SystemPrompt string `yaml:"system_prompt"`
Tools []string `yaml:"tools"`
Model string `yaml:"model"`
Temperature float32 `yaml:"temperature"`
Iterations int `yaml:"iterations"`
MaxAttempts int `yaml:"max_attempts"`
MaxRetries int `yaml:"max_retries"`
// Metadata overlays the global Config.Metadata for this agent type
// (per-key: agent keys win, global-only keys are inherited).
Metadata map[string]string `yaml:"metadata,omitempty"`
}
AgentTypeConfig is a wiz-facing sub-agent type. It maps 1:1 to a cogito.AgentDefinition. Zero-valued numeric fields mean "inherit".
type CommandConfig ¶
type CommandConfig struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Prompt string `yaml:"prompt"`
Agent string `yaml:"agent,omitempty"`
}
CommandConfig is a named slash command: a prompt template (text/template with {{.Args}} and {{.CurrentDirectory}}) optionally routed through a sub-agent.
type CompactionConfig ¶
type CompactionConfig struct {
// Disabled turns OFF automatic compaction. Zero value (false) = auto ON.
Disabled bool `yaml:"disabled"`
// MaxContextTokens is the model context window used to compute the trigger.
// 0 → default 128000.
MaxContextTokens int `yaml:"max_context_tokens"`
// Threshold is the fraction of MaxContextTokens at which auto-compaction
// fires. 0 → default 0.8.
Threshold float64 `yaml:"threshold"`
// KeepRecent is the number of trailing messages kept verbatim. 0 → default 8.
KeepRecent int `yaml:"keep_recent"`
}
CompactionConfig controls conversation compaction: summarizing older turns into a single summary message while keeping recent turns verbatim.
type Config ¶
type Config struct {
Model string `yaml:"model"`
APIKey string `yaml:"api_key"`
BaseURL string `yaml:"base_url"`
// Specialist models for attachment handling. Empty ⇒ LocalAI auto-selects
// by usecase (FLAG_TRANSCRIPT / FLAG_VISION).
TranscribeModel string `yaml:"transcribe_model,omitempty" json:"transcribe_model,omitempty"`
VisionModel string `yaml:"vision_model,omitempty" json:"vision_model,omitempty"`
VideoModel string `yaml:"video_model,omitempty" json:"video_model,omitempty"`
LogLevel string `yaml:"log_level"`
Prompt string `yaml:"prompt"`
// Metadata is a per-request metadata object attached verbatim to every
// chat-completion request (the OpenAI "metadata" field). Backends such as
// LocalAI use it for per-request flags, e.g. {"enable_thinking": "false"}
// to disable reasoning. Applied to the main session and inherited by
// sub-agents (see AgentTypeConfig.Metadata for per-agent overrides).
Metadata map[string]string `yaml:"metadata,omitempty"`
// ReasoningEffort sets the OpenAI "reasoning_effort" on every request
// ("none"/"low"/"medium"/"high"). Unlike Metadata.enable_thinking, this binds
// even when the model's chat template has no enable_thinking toggle (e.g.
// LFM2.5), so it's the reliable way to disable a reasoning model's thinking
// ("none"). Empty leaves the field unset.
ReasoningEffort string `yaml:"reasoning_effort,omitempty"`
MCPServers map[string]MCPServer `yaml:"mcp_servers"`
AgentOptions AgentOptions `yaml:"agent_options"`
Compaction CompactionConfig `yaml:"compaction"`
Agents []AgentTypeConfig `yaml:"agents"`
PromptFragments []string `yaml:"prompt_fragments"`
Skills []Skill `yaml:"skills"`
Commands []CommandConfig `yaml:"commands"`
Hooks []HookConfig `yaml:"hooks"`
// ApprovalMode controls tool-call gating:
// "" / "prompt" ask the user, but auto-approve read-only calls
// "strict" ask the user for every call (no read-only auto-approval)
// "allowlist" auto-approve only the tools in AllowedTools, prompt the rest
// "auto" approve every tool call
ApprovalMode string `yaml:"approval_mode"`
// AllowedTools are tool names pre-approved without prompting (always honored;
// the basis of "allowlist" mode).
AllowedTools []string `yaml:"allowed_tools"`
// BuiltinTools, if non-empty, restricts which built-in tools and
// self-config tools are exposed to the model (by name) — an allowlist.
// Empty means all of them. Trims the prompt for small local models;
// independent of AllowedTools (which gates approval). Never restricts
// tools from user-configured MCP servers (mcp_servers:) — those are
// always exposed, since restricting them would defeat the point of
// configuring the server. See chat.Session's MCP tool filter.
BuiltinTools []string `yaml:"builtin_tools,omitempty"`
// ReadOnlyCommands extends the built-in set of bash commands treated as
// read-only (auto-approved in the default "prompt" mode). An entry with a
// space is a command+subcommand pair (e.g. "terraform plan"); otherwise it
// matches that command at any arguments. User entries are merged with, not
// replacing, the built-in set.
ReadOnlyCommands []string `yaml:"read_only_commands"`
// TraceDir, when non-empty, enables session tracing: each LLM call's raw
// request/response is appended to <TraceDir>/trace.ndjson. Set at runtime
// from the --trace-dir flag or NIB_TRACE_DIR env, not from the YAML config.
TraceDir string `yaml:"-"`
// InitialHistory seeds a new session with a prior conversation so the very
// next SendMessage continues with full memory of it (resume/rehydration).
// Typically these are the messages a previous session returned from
// Session.ExportHistory, persisted to disk and reloaded. They MUST NOT
// include the system prompt: it is regenerated per-model/locale from Prompt
// and re-applied on every turn (see Session.SendMessage), so a seeded system
// message would duplicate it. Set at runtime, never from the YAML config.
InitialHistory []openai.ChatCompletionMessage `yaml:"-"`
// WorkingDir, when non-empty, is the directory host tools (bash, filesystem)
// operate in. Runtime-only; empty means the process cwd (legacy behavior).
WorkingDir string `yaml:"-"`
}
Config holds configuration for creating a new session
type HookConfig ¶
type HookConfig struct {
Event string `yaml:"event"`
Matcher string `yaml:"matcher,omitempty"`
Command string `yaml:"command"`
Dir string `yaml:"-"` // plugin root; set during merge, not parsed
}
HookConfig is a shell command bound to a lifecycle event. Matcher (optional) is matched against the tool name for PreToolUse/PostToolUse. Dir is the plugin root (set during merge); it is the command's working directory and is exported as ${NIB_PLUGIN_ROOT}/${CLAUDE_PLUGIN_ROOT}.
type MCPServer ¶
type MCPServer struct {
Command string `yaml:"command,omitempty"`
Args []string `yaml:"args,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
URL string `yaml:"url,omitempty"` // remote: presence selects an HTTP/SSE transport
Transport string `yaml:"transport,omitempty"` // remote transport: "http" (default) or "sse"
BearerToken string `yaml:"token,omitempty"` // remote only: sent as "Authorization: Bearer <token>"
Headers map[string]string `yaml:"headers,omitempty"` // remote only: custom HTTP headers
// Disabled, when true, keeps the server in config (so the UI can list and
// re-enable it) but excludes it from EffectiveConfig, so it starts no
// transport. Absent (omitempty) reads as enabled — no migration needed.
Disabled bool `yaml:"disabled,omitempty"`
}
type Skill ¶
type Skill struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Instructions string `yaml:"instructions"` // resolved body (inline, or loaded from a plugin file)
Tools []string `yaml:"tools,omitempty"`
Dir string `yaml:"-"` // absolute on-disk dir for bundled files; runtime-only, never serialized
}
Skill is a named, on-demand instruction set. Its Description is listed in the system prompt; the agent calls the load_skill tool to read Instructions.