config

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config holds the runtime-editable Agents config (General / Slack / Storage structs reflected into the configs DB table) plus the on-disk Layout — the single source of truth for path math under the platform default data directory (~/.<app>/agents). Every other agents subpackage receives a Layout, never hand-rolls paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveBaseDir

func ResolveBaseDir(_ StorageConfig) string

ResolveBaseDir returns the platform default base directory (~/.wick/agents). The cfg parameter is kept for call-site compatibility.

func SeedGateConfig

func SeedGateConfig() []pkgentity.Config

SeedGateConfig returns the StructToConfigs rows for GateConfig.

func SeedGeneralConfig

func SeedGeneralConfig() []pkgentity.Config

SeedGeneralConfig returns the StructToConfigs rows for GeneralConfig.

func SeedRestChannelConfig added in v0.10.0

func SeedRestChannelConfig() []pkgentity.Config

SeedRestChannelConfig returns UI field metadata for the REST (OpenAI- compatible) channel form. Values come from agent_channels table.

func SeedSlackChannelConfig

func SeedSlackChannelConfig() []pkgentity.Config

SeedSlackChannelConfig returns UI field metadata (key, label, type, description) for the Slack channel form. Used ONLY for rendering the config page — values come from agent_channels table, not from this seed.

func SeedStorageConfig added in v0.14.21

func SeedStorageConfig() []pkgentity.Config

SeedStorageConfig is the agents storage (base dir + default project) counterpart.

func SeedTelegramChannelConfig

func SeedTelegramChannelConfig() []pkgentity.Config

SeedTelegramChannelConfig returns UI field metadata (key, label, type, description) for the Telegram channel form. Used ONLY for rendering the config page — values come from agent_channels table, not from this seed.

Types

type GateConfig

type GateConfig struct {
	GateEnabled    bool   `` /* 180-byte string literal not displayed */
	PermissionMode string `` /* 187-byte string literal not displayed */
	AskUserMode    string `` /* 204-byte string literal not displayed */
	AllowedCmds    string `` /* 190-byte string literal not displayed */
}

GateConfig holds command-gate knobs.

  • PermissionMode: gates per-tool permission prompts (PreToolUse hook). "on" installs the hook; "bypass" skips it (use for non-interactive channels — Slack/HTTP — where no human can answer a prompt).
  • AskUserMode: gates the MCP `ask_user` tool. "on" routes the question to the web UI; "off" returns an error to the LLM so it picks a default instead of hanging the run.

GateEnabled is the master switch for the COMMAND gate only — the PreToolUse hook path (PermissionMode + AllowedCmds + the gate binary). Off = the hook is not installed and commands run unguarded.

AskUserMode is INDEPENDENT of GateEnabled. ask_user does not ride the hook — it uses wick's own socket/SSE channel — so turning the command gate off must not disable it. Only AskUserMode governs ask_user (and wick_session_workspace configure/add modals).

Per-channel override (planned phase 2) will let non-interactive channels (Slack/HTTP/cron) flip their own mode without changing the global config; until then the global mode applies everywhere.

func DefaultGateConfig

func DefaultGateConfig() GateConfig

DefaultGateConfig returns the seed values for the gate config. Defaults are safe-for-interactive: gate on, permission prompts on, ask_user routed to the UI. Operators using non-interactive channels (Slack/HTTP) flip PermissionMode=bypass and AskUserMode=off here, or — once per-channel override lands — set the override on the individual channel instead.

type GeneralConfig

type GeneralConfig struct {
	Enabled                   bool   `wick:"bool;desc=Enable the Agents feature."`
	MaxConcurrent             int    `wick:"number;desc=Max concurrent agent subprocesses across all providers. 0 = unlimited. Default: 2."`
	IdleTimeoutSec            int    `wick:"number;desc=Seconds of inactivity before subprocess is killed. Default: 120."`
	DefaultProvider           string `wick:"dropdown=claude|codex|gemini;desc=Default CLI provider."`
	KillAfterIdleSec          int    `` /* 134-byte string literal not displayed */
	PublicURL                 string `wick:"url;desc=Public base URL of this wick instance. Used for the dashboard meta-command."`
	AutoRescan                bool   `wick:"bool;desc=Auto re-probe provider binaries when cached version is older than 24h. Off = refresh only via Rescan button."`
	PreemptIdle               bool   `` /* 187-byte string literal not displayed */
	SystemPrompt              string `` /* 246-byte string literal not displayed */
	WorkflowGuardMode         string `` /* 171-byte string literal not displayed */
	WorkflowMaxParallelGlobal int    `` /* 238-byte string literal not displayed */
	WorkflowLokiURL           string `wick:"url;desc=Loki push endpoint for workflow run events (e.g. http://loki:3100). Empty = disabled."`
	WorkflowLokiLabels        string `wick:"text;desc=Extra Loki stream labels as comma-separated key=value pairs (e.g. env=prod,team=eng)."`
	MCPUninstalledClients     string `` /* 127-byte string literal not displayed */
	TraceEventInlineKB        int    `` /* 174-byte string literal not displayed */
	TraceEventMaxKB           int    `` /* 150-byte string literal not displayed */
	AdminSeeAll               bool   `` /* 279-byte string literal not displayed */
}

GeneralConfig holds top-level Agents knobs. Reflected into the configs table via pkg/entity.StructToConfigs (Owner = "agents" at registration time). See agents-design.md §8.1. Gate settings live in GateConfig; channel settings in SlackChannelConfig.

func DefaultGeneralConfig

func DefaultGeneralConfig() GeneralConfig

DefaultGeneralConfig returns the seed values used when the configs table has no row for a given key.

type Layout

type Layout struct {
	BaseDir string
}

Layout describes the on-disk folder layout rooted at BaseDir.

Tests construct a Layout pointing at `t.TempDir()`; production code builds one from StorageConfig.BaseDir (or the platform default).

func NewLayout

func NewLayout(baseDir string) Layout

func (Layout) EnsureLayout

func (l Layout) EnsureLayout() error

EnsureLayout creates the three top-level folders if they don't exist. Idempotent — safe to call on every boot.

func (Layout) PresetDir

func (l Layout) PresetDir(name string) string

func (Layout) PresetFile

func (l Layout) PresetFile(name string) string

func (Layout) PresetsDir

func (l Layout) PresetsDir() string

func (Layout) ProjectDir added in v0.14.21

func (l Layout) ProjectDir(id string) string

ProjectDir is the metadata folder for one project (`projects/<id>/`). For managed projects this also contains the `files/` subfolder used as the agent cwd; custom projects store no files here, only meta.json.

func (Layout) ProjectManagedPath added in v0.14.21

func (l Layout) ProjectManagedPath(id string) string

ProjectManagedPath is the cwd folder for a managed project (`projects/<id>/files/`). Use project.ResolvePath() instead of calling this directly — it transparently handles the custom path case.

func (Layout) ProjectMeta added in v0.14.21

func (l Layout) ProjectMeta(id string) string

func (Layout) ProjectsDir added in v0.14.21

func (l Layout) ProjectsDir() string

func (Layout) SessionAgentMD

func (l Layout) SessionAgentMD(id string) string

func (Layout) SessionAgents

func (l Layout) SessionAgents(id string) string

func (Layout) SessionCommands

func (l Layout) SessionCommands(id string) string

func (Layout) SessionConversation

func (l Layout) SessionConversation(id string) string

func (Layout) SessionDir

func (l Layout) SessionDir(id string) string

func (Layout) SessionInflight added in v0.14.3

func (l Layout) SessionInflight(id string) string

SessionInflight is an append-only JSONL of every event in the currently in-progress assistant turn: text_delta chunks, tool_use, tool_result, thinking. The store appends as events arrive and deletes the file the moment the turn flushes to conversation.jsonl, so the presence of inflight.jsonl on boot means "a turn was killed or the server crashed mid-stream; replay these for the operator". Provider-agnostic — claude, codex, gemini, future CLIs all write the same shape via store.Apply.

func (Layout) SessionMeta

func (l Layout) SessionMeta(id string) string

func (Layout) SessionRaw

func (l Layout) SessionRaw(id string) string

func (Layout) SessionThinking added in v0.15.0

func (l Layout) SessionThinking(sessionID, turnID string) string

SessionThinking returns the index file for one turn's trace: thinking/<turn_id>/index.json

func (Layout) SessionThinkingDir added in v0.15.0

func (l Layout) SessionThinkingDir(id string) string

SessionThinkingDir is the root folder for all turn trace dirs.

func (Layout) SessionThinkingEvent added in v0.15.0

func (l Layout) SessionThinkingEvent(sessionID, turnID, eventID string) string

SessionThinkingEvent returns the payload file for one large event: thinking/<turn_id>/<event_id>.json

func (Layout) SessionThinkingTurnDir added in v0.15.0

func (l Layout) SessionThinkingTurnDir(sessionID, turnID string) string

SessionThinkingTurnDir is the folder for one turn's trace: thinking/<turn_id>/

func (Layout) SessionWorkspace added in v0.17.0

func (l Layout) SessionWorkspace(id string) string

SessionWorkspace holds the per-session workspace: ephemeral connector instances cloned from a base module (the wick_session_workspace MCP tool + the session Config tab write here). Each instance carries its own config map (secret values stored as wick_cenc_ master tokens, system-decryptable only). The file dies with the session dir — the instances are by design throwaway, scoped to one agent session.

func (Layout) SessionsDir

func (l Layout) SessionsDir() string

func (Layout) WorkflowDir added in v0.13.0

func (l Layout) WorkflowDir(id string) string

WorkflowDir is the folder for one workflow (`workflows/<id>/`).

func (Layout) WorkflowDraftFile added in v0.13.0

func (l Layout) WorkflowDraftFile(id string) string

WorkflowDraftFile is the in-progress copy edited by the canvas. Save from the UI always writes here, never to workflow.json. Publish promotes this file to workflow.json and deletes the draft.

func (Layout) WorkflowEnvFile added in v0.13.0

func (l Layout) WorkflowEnvFile(id string) string

func (Layout) WorkflowFile added in v0.13.0

func (l Layout) WorkflowFile(id string) string

func (Layout) WorkflowIndexDir added in v0.13.0

func (l Layout) WorkflowIndexDir(id string) string

WorkflowIndexDir holds the sharded run-summary index files (YYYY-MM-DD-NN.jsonl, max 100 lines each) — sibling to runs/. Lets the Runs panel paginate cheaply without scanning every per-run subdir.

func (Layout) WorkflowNodesDir added in v0.13.0

func (l Layout) WorkflowNodesDir(id string) string

func (Layout) WorkflowRunDir added in v0.13.0

func (l Layout) WorkflowRunDir(id, runID string) string

func (Layout) WorkflowRunEvents added in v0.13.0

func (l Layout) WorkflowRunEvents(id, runID string) string

func (Layout) WorkflowRunState added in v0.13.0

func (l Layout) WorkflowRunState(id, runID string) string

func (Layout) WorkflowRunsDir added in v0.13.0

func (l Layout) WorkflowRunsDir(id string) string

func (Layout) WorkflowStateFile added in v0.13.0

func (l Layout) WorkflowStateFile(id string) string

func (Layout) WorkflowTestsDir added in v0.13.0

func (l Layout) WorkflowTestsDir(id string) string

func (Layout) WorkflowsDir added in v0.13.0

func (l Layout) WorkflowsDir() string

func (Layout) WorkspaceDir

func (l Layout) WorkspaceDir(name string) string

WorkspaceDir is the metadata folder for one workspace (`workspaces/<name>/`). For managed workspaces this also contains the `files/` subfolder used as the agent cwd; custom workspaces store no files here, only meta.json.

func (Layout) WorkspaceManagedPath

func (l Layout) WorkspaceManagedPath(name string) string

WorkspaceManagedPath is the cwd folder for a managed workspace (`workspaces/<name>/files/`). Use workspace.ResolvePath() instead of calling this directly — it transparently handles the custom path case.

func (Layout) WorkspaceMeta

func (l Layout) WorkspaceMeta(name string) string

func (Layout) WorkspacesDir

func (l Layout) WorkspacesDir() string

type RestChannelConfig added in v0.10.0

type RestChannelConfig struct {
	Enabled        string `` /* 147-byte string literal not displayed */
	AskUserEnabled bool   `` /* 226-byte string literal not displayed */
	ProjectID      string `` /* 211-byte string literal not displayed */
}

RestChannelConfig holds REST (OpenAI-compatible HTTP) channel settings. Auth uses Personal Access Tokens minted at /profile/tokens, so no token field is stored on the channel itself — every request carries its own Bearer.

func DefaultRestChannelConfig added in v0.10.0

func DefaultRestChannelConfig() RestChannelConfig

DefaultRestChannelConfig returns the empty REST defaults. REST stays off until the operator flips Enabled.

type SlackChannelConfig

type SlackChannelConfig struct {
	Mode          string `wick:"dropdown=socket|http;hidden;key=mode;desc=Connection mode."`
	BotToken      string `wick:"secret;hidden;key=bot_token;desc=Bot token (xoxb-...)."`
	AppToken      string `wick:"secret;hidden;key=app_token;desc=App token (xapp-...). Required for socket mode."`
	SigningSecret string `wick:"secret;hidden;key=signing_secret;desc=Signing secret. Required for http mode."`

	UsersMode       string `` /* 173-byte string literal not displayed */
	AllowedUsers    string `wick:"picker=slack.users;hidden;key=allowed_users;visible_when=users_mode:whitelist;desc=Allowed users."`
	GroupsMode      string `` /* 144-byte string literal not displayed */
	AllowedGroups   string `wick:"picker=slack.usergroups;hidden;key=allowed_groups;visible_when=groups_mode:whitelist;desc=Allowed user groups."`
	ChannelsMode    string `wick:"dropdown=all|whitelist;default=all;hidden;key=channels_mode;desc=Restrict which channels can trigger agents."`
	AllowedChannels string `wick:"picker=slack.channels;hidden;key=allowed_channels;visible_when=channels_mode:whitelist;desc=Allowed channels."`

	AskUserEnabled bool `` /* 261-byte string literal not displayed */

	GateApprovers      string `` /* 181-byte string literal not displayed */
	GateApproverUsers  string `wick:"picker=slack.users;hidden;key=gate_approver_users;visible_when=gate_approvers:custom;desc=Custom approver users."`
	GateApproverGroups string `` /* 131-byte string literal not displayed */

	ProjectID string `` /* 134-byte string literal not displayed */
	PublicURL string `wick:"hidden;key=public_url;desc=Public URL for Slack HTTP mode webhooks."`
}

SlackChannelConfig holds Slack transport credentials and access control. See agents-design.md §8.2.

Access control is per-resource: each of Users / Groups / Channels has its own *Mode (all|whitelist) and its own picker-backed allow list. A request passes when every whitelist that is active also contains the requester.

Approval gates have their own approver block: GateApprovers selects the role family (anyone who passed access / workspace admins / a custom list) allowed to resolve interactive gate buttons.

func DefaultSlackChannelConfig

func DefaultSlackChannelConfig() SlackChannelConfig

DefaultSlackChannelConfig returns the empty Slack defaults. Slack stays off until the operator sets a token. Per-list modes default to "all" via the `default=all` wick tag on each field, so first-boot config is permissive.

type StorageConfig added in v0.14.21

type StorageConfig struct {
	BaseDir string
	// DefaultProjectID is exposed in the agents Settings page as a
	// dropdown (options injected at render from the live project list).
	// New sessions with no explicit project — channels, API, quick-create
	// — bind here. Empty = unscoped (per-session temp cwd).
	DefaultProjectID string `` /* 153-byte string literal not displayed */
}

StorageConfig holds the base directory for all on-disk Agents state plus the global default project. See agents-design.md §8.3.

An empty BaseDir means "use the platform default" — see ResolveBaseDir. Persisting an empty value lets the operator change hosts without us hard-coding a user-specific path into the configs table.

DefaultProjectID is the project a session binds to when none is supplied (channels, API). Empty = no global default; the pool falls back to a per-session temp cwd.

func DefaultStorageConfig added in v0.14.21

func DefaultStorageConfig() StorageConfig

DefaultStorageConfig returns the empty default.

type TelegramChannelConfig

type TelegramChannelConfig struct {
	BotToken       string `wick:"secret;hidden;key=bot_token;desc=Bot token from @BotFather (format: 123456:ABC-...)."`
	AllowedIDs     string `wick:"kvlist;hidden;key=allowed_ids;desc=Allowed Telegram chat IDs. Leave empty to allow all chats."`
	AskUserEnabled bool   `` /* 267-byte string literal not displayed */
	ProjectID      string `` /* 137-byte string literal not displayed */
}

TelegramChannelConfig holds Telegram bot credentials and access control. Each channel type has its own JSON blob in agent_channels, so keys need no prefix.

func DefaultTelegramChannelConfig

func DefaultTelegramChannelConfig() TelegramChannelConfig

DefaultTelegramChannelConfig returns the empty Telegram defaults. Telegram stays off until the operator sets a bot token.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL