Documentation
¶
Index ¶
- Constants
- Variables
- func BuildToolDefs(d *Dispatcher) []provider.ToolDefinition
- func ContainedInWorkDir(resolved, workDir string) error
- func HumanSize(b int64) string
- func LevenshteinBuf(a, b string, prev, curr []int) int
- func LevenshteinDistance(a, b string) int
- func NewDispatcherFactory(backupDir, sessionsDir string, permCfg *config.PermissionsConfig, ...) subagent.DispatcherFactory
- func ResolveAndContainPath(path, workDir string) (string, error)
- func ResolveAndContainPathExists(path, workDir string) (string, error)
- func SetVersion(v string)
- type Agent
- type AskUserQuestion
- type Bash
- type BatchApproval
- type CodeComplexity
- type CodeMap
- type ComplexityReport
- type DNSCache
- type DevServer
- type Dispatcher
- func (d *Dispatcher) ActiveBatchToolNames() string
- func (d *Dispatcher) ApproveBatch(toolName string, risk types.RiskLevel)
- func (d *Dispatcher) ApprovePermission(requestID int64, allowed bool, remember bool)
- func (d *Dispatcher) BatchApprovalCount() int
- func (d *Dispatcher) Execute(ctx context.Context, call types.ToolCall) (types.ToolResult, error)
- func (d *Dispatcher) GetTool(name string) (types.Tool, bool)
- func (d *Dispatcher) List() []string
- func (d *Dispatcher) PendingPermCount() int
- func (d *Dispatcher) QuestionRequestCh() chan QuestionRequest
- func (d *Dispatcher) QuestionResponseCh() chan QuestionResponse
- func (d *Dispatcher) Register(tool types.Tool) error
- func (d *Dispatcher) RequestCh() chan PermissionRequest
- func (d *Dispatcher) RespondQuestion(requestID int64, answer string)
- func (d *Dispatcher) RevokeBatchApprovals()
- func (d *Dispatcher) SelectAgent(agent string) error
- func (d *Dispatcher) SetCollector(c *metrics.Collector)
- func (d *Dispatcher) SetOutputStore(store *OutputStore)
- func (d *Dispatcher) SetPermission(toolName string, allowed bool)
- func (d *Dispatcher) SetSessionID(id string)
- func (d *Dispatcher) SetTodoWriteCallback(fn func(items []TodoItem))
- func (d *Dispatcher) Stop()
- func (d *Dispatcher) SyncTodoFromTasks(tasks []types.Task) error
- func (d *Dispatcher) Unregister(name string)
- func (d *Dispatcher) UpdatePermissions(cfg *config.PermissionsConfig)
- type Edit
- type FileDelete
- type FileList
- type FileMove
- type FileRead
- type FileStat
- type FileWrite
- type Glob
- type Grep
- type HTTPCheck
- type MetricsTool
- type OutputStore
- type PackageStat
- type PermissionContext
- type PermissionPolicy
- type PermissionRequest
- type PermissionResponse
- type PersistentPermissions
- type QuestionRequest
- type QuestionResponse
- type SafeFileOp
- type TodoItem
- type TodoRead
- func (t *TodoRead) Description() string
- func (t *TodoRead) Execute(ctx context.Context, input types.ToolInput) (types.ToolResult, error)
- func (t *TodoRead) Name() string
- func (t *TodoRead) ParameterSchema() string
- func (t *TodoRead) RiskLevel() types.RiskLevel
- func (t *TodoRead) SetSessionID(id string)
- type TodoWrite
- func (t *TodoWrite) Description() string
- func (t *TodoWrite) Execute(ctx context.Context, input types.ToolInput) (types.ToolResult, error)
- func (t *TodoWrite) Name() string
- func (t *TodoWrite) ParameterSchema() string
- func (t *TodoWrite) RiskLevel() types.RiskLevel
- func (t *TodoWrite) SetOnUpdate(fn func(items []TodoItem))
- func (t *TodoWrite) SetSessionID(id string)
- func (t *TodoWrite) SyncTodoFromTasks(tasks []types.Task) error
- type WebFetch
- type WebSearch
Constants ¶
const ( // MaxBackupDirSize is the maximum total size of the backup directory (100MB). MaxBackupDirSize = 100 * 1024 * 1024 // MinFreeDiskSpace is the minimum free disk space to maintain (50MB). MinFreeDiskSpace = 50 * 1024 * 1024 )
const ( BashKillGracePeriod = time.Duration(types.DefaultBashKillGraceSecs) * time.Second BashWaitTimeout = 30 * time.Second MaxBackupsPerFile = types.DefaultMaxBackupsPerFile DirPermission = types.DirPermission FilePermission = types.FilePermission MaxGlobResults = types.DefaultMaxGlobResults MaxGrepPatternLength = 1024 DefaultMaxGrepResults = types.DefaultMaxGrepResults MaxRedirects = types.DefaultWebfetchMaxRedirects DefaultTimeoutSecs = 30 MaxTimeoutSecs = 120 DNSCacheTTL = 5 * time.Minute MinLinesForFuzzy = 3 LevenshteinThreshold = 0.7 PermissionChannelBuffer = 8 QuestionChannelBuffer = 4 DefaultAgentName = "default" // Rate limiting: token bucket for tool execution. // Max 20 tools per second burst, sustained 10 tools/second. ToolRateLimitBurst = 20 ToolRateLimitPerSec = 10 // Per-risk-level rate limits (M6): dangerous tools get stricter limits. DangerousRateLimitBurst = 5 DangerousRateLimitPerSec = 2 // Max concurrent tool executions (M5): prevents resource exhaustion. MaxConcurrentTools = 8 DefaultSearchBaseURL = "https://search.sagibo.net" MaxSearchQueryLength = 500 DefaultMaxSearchResults = 5 MaxSearchResults = 10 DefaultOutputMaxLines = 2000 DefaultOutputMaxBytes = 51200 OutputRetentionDays = 7 )
const MaxAgentDepth = 2
MaxAgentDepth is the maximum nesting depth for subagents. Depth 0 is the root agent, depth 1 is a child, depth 2 is a grandchild. Going deeper is blocked to prevent runaway resource consumption.
Variables ¶
var DefaultExtensions = []string{
".go", ".py", ".js", ".ts", ".jsx", ".tsx",
".rs", ".java", ".c", ".cpp", ".h", ".hpp",
".rb", ".php", ".cs", ".swift", ".kt",
}
DefaultExtensions are the common source file extensions to analyze when no extensions are specified. Covers Go, Python, JS/TS, Rust, Java, C/C++.
var Version atomic.Value
Version is the application version used in User-Agent headers. Set via SetVersion() from cmd/m31a/main.go.
Functions ¶
func BuildToolDefs ¶
func BuildToolDefs(d *Dispatcher) []provider.ToolDefinition
BuildToolDefs creates provider.ToolDefinition slices from a Dispatcher's registered tools. This is shared between the workflow engine and the autonomous agent loop to avoid duplicating tool schema logic.
func ContainedInWorkDir ¶ added in v1.4.0
ContainedInWorkDir checks that resolved is either equal to workDir or is contained within it (with a trailing separator guard to prevent prefix attacks).
func LevenshteinBuf ¶ added in v1.4.0
LevenshteinBuf is like LevenshteinDistance but reuses pre-allocated buffers.
func LevenshteinDistance ¶ added in v1.4.0
LevenshteinDistance computes the edit distance between two strings.
func NewDispatcherFactory ¶
func NewDispatcherFactory(backupDir, sessionsDir string, permCfg *config.PermissionsConfig, toolsCfg *config.ToolsConfig, manager *subagent.Manager, profiles map[string]config.SubagentProfileConfig) subagent.DispatcherFactory
NewDispatcherFactory returns a DispatcherFactory that creates a fresh tools.Dispatcher for each subagent workspace. The factory registers the Agent tool (with isChild=true) on every dispatcher so a subagent can spawn its own child, but forced-foreground to block runaway fan-out.
backupDir and sessionsDir are shared across all dispatchers; permCfg is reused verbatim so permission rules apply uniformly.
func ResolveAndContainPath ¶ added in v1.4.0
ResolveAndContainPath resolves a path (joining relative to workDir if needed), resolves symlinks, and verifies the result is within workDir. If the file does not exist, it attempts to resolve the parent directory through symlinks instead. Returns the resolved absolute path or an error if it escapes the workDir.
func ResolveAndContainPathExists ¶ added in v1.4.0
ResolveAndContainPathExists resolves a path and verifies it is within workDir. Unlike ResolveAndContainPath, this requires the path to already exist on disk.
func SetVersion ¶
func SetVersion(v string)
SetVersion sets the application version for User-Agent headers.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is a tool that spawns a parallel subagent to perform an independent task. The parent conversation receives the subagent's ID immediately and can continue issuing other tool calls while the subagent runs.
Background mode (default) returns the agent ID and delivers the final summary to the parent via SubagentEvent messages consumed by the TUI. Foreground mode (run_in_background=false) blocks until the subagent finishes and returns its summary as this tool's output.
func NewAgent ¶
func NewAgent(m *subagent.Manager, isChild bool, depth int, profiles map[string]config.SubagentProfileConfig) *Agent
NewAgent creates an Agent tool backed by the given manager.
func (*Agent) Description ¶
func (*Agent) ParameterSchema ¶
ParameterSchema returns the JSON schema exposed to the LLM.
type AskUserQuestion ¶
type AskUserQuestion struct {
// contains filtered or unexported fields
}
func NewAskUserQuestion ¶
func NewAskUserQuestion(requestCh chan QuestionRequest, responseCh chan QuestionResponse, pending *sync.Map) *AskUserQuestion
func (*AskUserQuestion) Description ¶
func (t *AskUserQuestion) Description() string
func (*AskUserQuestion) Execute ¶
func (t *AskUserQuestion) Execute(ctx context.Context, input types.ToolInput) (types.ToolResult, error)
func (*AskUserQuestion) Name ¶
func (t *AskUserQuestion) Name() string
func (*AskUserQuestion) ParameterSchema ¶
func (t *AskUserQuestion) ParameterSchema() string
ParameterSchema returns the JSON Schema for AskUserQuestion tool parameters.
func (*AskUserQuestion) RiskLevel ¶
func (t *AskUserQuestion) RiskLevel() types.RiskLevel
type Bash ¶
type Bash struct {
// contains filtered or unexported fields
}
func (*Bash) Description ¶
func (*Bash) ParameterSchema ¶
ParameterSchema returns the JSON Schema for Bash tool parameters.
type BatchApproval ¶ added in v1.6.0
type BatchApproval struct {
ToolName string
RiskLevel types.RiskLevel
ExpiresAt time.Time // zero = never expires (manual SetPermission)
}
BatchApproval records a user's "approve all" decision for a tool+risk combination. Approvals are task-scoped: they expire when the current task completes or the workflow phase transitions.
type CodeComplexity ¶ added in v1.1.0
type CodeComplexity struct {
// contains filtered or unexported fields
}
CodeComplexity is a tool that analyzes the codebase and returns a complexity report with file counts, line counts, top packages, top files, and a complexity score. Default extensions cover all common languages.
func NewCodeComplexity ¶ added in v1.1.0
func NewCodeComplexity(workDir string, skipDirs []string) *CodeComplexity
NewCodeComplexity creates a new CodeComplexity tool. skipDirs is an optional override; if nil, types.SkipDirs is used.
func (*CodeComplexity) Description ¶ added in v1.1.0
func (t *CodeComplexity) Description() string
func (*CodeComplexity) Execute ¶ added in v1.1.0
func (t *CodeComplexity) Execute(ctx context.Context, input types.ToolInput) (types.ToolResult, error)
func (*CodeComplexity) Name ¶ added in v1.1.0
func (t *CodeComplexity) Name() string
func (*CodeComplexity) ParameterSchema ¶ added in v1.1.0
func (t *CodeComplexity) ParameterSchema() string
func (*CodeComplexity) RiskLevel ¶ added in v1.1.0
func (t *CodeComplexity) RiskLevel() types.RiskLevel
type CodeMap ¶
type CodeMap struct {
// contains filtered or unexported fields
}
CodeMap is a tool that queries the codebase intelligence layer for import graph, symbol definitions, and relevant file discovery.
func NewCodeMap ¶
func (*CodeMap) Description ¶
func (*CodeMap) ParameterSchema ¶
type ComplexityReport ¶ added in v1.1.0
type ComplexityReport struct {
TotalFiles int
TotalLines int
Packages []PackageStat
Files []FileStat
Score string
Languages map[string]int // extension → file count
}
ComplexityReport holds the results of a codebase complexity analysis.
type DNSCache ¶ added in v1.4.0
type DNSCache struct {
// contains filtered or unexported fields
}
DNSCache is a shared DNS cache backed by a sync.Map with configurable TTL, periodic eviction, and maximum size limit. Both WebFetch and WebSearch share this implementation.
func NewDNSCache ¶ added in v1.4.0
NewDNSCache creates a DNS cache with the given TTL, eviction threshold, and maximum size. Eviction runs when the number of inserts since last eviction reaches threshold. Cache size is capped at maxSize entries.
func NewDNSCacheWithMaxSize ¶ added in v1.4.0
NewDNSCacheWithMaxSize creates a DNS cache with explicit max size control.
type DevServer ¶ added in v1.3.0
type DevServer struct {
// contains filtered or unexported fields
}
func NewDevServer ¶ added in v1.3.0
func (*DevServer) Description ¶ added in v1.3.0
func (*DevServer) ParameterSchema ¶ added in v1.3.0
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
func DefaultDispatcher ¶
func DefaultDispatcher(workDir, backupDir, sessionsDir string, cfg *config.PermissionsConfig, toolsCfg *config.ToolsConfig) (*Dispatcher, error)
func NewDispatcher ¶
func NewDispatcher(cfg *config.PermissionsConfig) *Dispatcher
NewDispatcher creates a new Dispatcher with a background rate-limiter goroutine. The caller MUST call Stop() when the Dispatcher is no longer needed to prevent goroutine leaks (e.g., during session restart or app shutdown).
func (*Dispatcher) ActiveBatchToolNames ¶ added in v1.6.0
func (d *Dispatcher) ActiveBatchToolNames() string
ActiveBatchToolNames returns a comma-separated list of tool names with active batch approvals (e.g. "bash,edit"). Empty string if none.
func (*Dispatcher) ApproveBatch ¶ added in v1.6.0
func (d *Dispatcher) ApproveBatch(toolName string, risk types.RiskLevel)
ApproveBatch records a batch approval for the given tool+risk combination. When active, all future permission requests matching this tool+risk are auto-approved without prompting the user. Approvals are task-scoped: they expire when RevokeBatchApprovals() is called (typically on task completion or phase transition).
func (*Dispatcher) ApprovePermission ¶
func (d *Dispatcher) ApprovePermission(requestID int64, allowed bool, remember bool)
func (*Dispatcher) BatchApprovalCount ¶ added in v1.6.0
func (d *Dispatcher) BatchApprovalCount() int
BatchApprovalCount returns the number of active batch approvals.
func (*Dispatcher) Execute ¶
func (d *Dispatcher) Execute(ctx context.Context, call types.ToolCall) (types.ToolResult, error)
func (*Dispatcher) List ¶
func (d *Dispatcher) List() []string
func (*Dispatcher) PendingPermCount ¶ added in v1.6.0
func (d *Dispatcher) PendingPermCount() int
PendingPermCount returns the number of permission requests currently waiting in the queue (between send and TUI response).
func (*Dispatcher) QuestionRequestCh ¶
func (d *Dispatcher) QuestionRequestCh() chan QuestionRequest
func (*Dispatcher) QuestionResponseCh ¶
func (d *Dispatcher) QuestionResponseCh() chan QuestionResponse
func (*Dispatcher) RequestCh ¶
func (d *Dispatcher) RequestCh() chan PermissionRequest
func (*Dispatcher) RespondQuestion ¶
func (d *Dispatcher) RespondQuestion(requestID int64, answer string)
RespondQuestion routes a question response to the per-request channel for the given request ID. Falls back to the shared channel if no per-request channel exists. This prevents cross-caller response routing (H-2).
func (*Dispatcher) RevokeBatchApprovals ¶ added in v1.6.0
func (d *Dispatcher) RevokeBatchApprovals()
RevokeBatchApprovals clears all active batch approvals. Called on task completion or phase transition to reset session-scoped approvals.
func (*Dispatcher) SelectAgent ¶
func (d *Dispatcher) SelectAgent(agent string) error
func (*Dispatcher) SetCollector ¶ added in v1.5.0
func (d *Dispatcher) SetCollector(c *metrics.Collector)
SetCollector attaches a metrics collector for recording tool execution metrics. Also propagates the collector to tools that support it (e.g., Edit for strategy tracking).
func (*Dispatcher) SetOutputStore ¶ added in v1.3.0
func (d *Dispatcher) SetOutputStore(store *OutputStore)
SetOutputStore configures the output store for bounding tool output.
func (*Dispatcher) SetPermission ¶
func (d *Dispatcher) SetPermission(toolName string, allowed bool)
func (*Dispatcher) SetSessionID ¶
func (d *Dispatcher) SetSessionID(id string)
func (*Dispatcher) SetTodoWriteCallback ¶ added in v1.1.0
func (d *Dispatcher) SetTodoWriteCallback(fn func(items []TodoItem))
SetTodoWriteCallback sets the callback invoked after successful TodoWrite tool executions.
func (*Dispatcher) Stop ¶
func (d *Dispatcher) Stop()
Stop shuts down the rate limiter goroutine and ticker. Should be called when the Dispatcher is no longer needed (e.g., during app shutdown). C-12: Uses sync.Once to prevent TOCTOU race on concurrent calls.
func (*Dispatcher) SyncTodoFromTasks ¶ added in v1.4.0
func (d *Dispatcher) SyncTodoFromTasks(tasks []types.Task) error
SyncTodoFromTasks updates TODO.md from the task runner's current state. Called automatically after each execution group to keep the TODO in sync.
func (*Dispatcher) Unregister ¶ added in v1.3.0
func (d *Dispatcher) Unregister(name string)
Unregister removes a tool by name. Used by profile-based filtering to strip tools that a subagent profile should not access.
func (*Dispatcher) UpdatePermissions ¶
func (d *Dispatcher) UpdatePermissions(cfg *config.PermissionsConfig)
UpdatePermissions hot-reloads the permission configuration.
type Edit ¶
type Edit struct {
// contains filtered or unexported fields
}
func (*Edit) Description ¶
func (*Edit) ParameterSchema ¶
ParameterSchema returns the JSON Schema for Edit tool parameters.
func (*Edit) SetCollector ¶ added in v1.5.0
SetCollector attaches a metrics collector for recording edit strategy usage.
type FileDelete ¶
type FileDelete struct {
// contains filtered or unexported fields
}
func NewFileDelete ¶
func NewFileDelete(workDir, backupDir string) *FileDelete
func (*FileDelete) Description ¶
func (t *FileDelete) Description() string
func (*FileDelete) Execute ¶
func (t *FileDelete) Execute(ctx context.Context, input types.ToolInput) (types.ToolResult, error)
func (*FileDelete) Name ¶
func (t *FileDelete) Name() string
func (*FileDelete) ParameterSchema ¶
func (t *FileDelete) ParameterSchema() string
func (*FileDelete) RiskLevel ¶
func (t *FileDelete) RiskLevel() types.RiskLevel
type FileList ¶
type FileList struct {
// contains filtered or unexported fields
}
func NewFileList ¶
func (*FileList) Description ¶
func (*FileList) ParameterSchema ¶
type FileMove ¶
type FileMove struct {
// contains filtered or unexported fields
}
func NewFileMove ¶
func (*FileMove) Description ¶
func (*FileMove) ParameterSchema ¶
type FileRead ¶
type FileRead struct {
// contains filtered or unexported fields
}
func NewFileRead ¶
func (*FileRead) Description ¶
func (*FileRead) ParameterSchema ¶
ParameterSchema returns the JSON Schema for FileRead tool parameters.
type FileWrite ¶
type FileWrite struct {
// contains filtered or unexported fields
}
func NewFileWrite ¶
func (*FileWrite) Description ¶
func (*FileWrite) ParameterSchema ¶
ParameterSchema returns the JSON Schema for FileWrite tool parameters.
type Glob ¶
type Glob struct {
// contains filtered or unexported fields
}
func (*Glob) Description ¶
func (*Glob) ParameterSchema ¶
ParameterSchema returns the JSON Schema for Glob tool parameters.
type Grep ¶
type Grep struct {
// contains filtered or unexported fields
}
func (*Grep) Description ¶
func (*Grep) ParameterSchema ¶
ParameterSchema returns the JSON Schema for Grep tool parameters.
type HTTPCheck ¶ added in v1.3.0
type HTTPCheck struct {
// contains filtered or unexported fields
}
func NewHTTPCheck ¶ added in v1.3.0
func NewHTTPCheck() *HTTPCheck
func (*HTTPCheck) Description ¶ added in v1.3.0
func (*HTTPCheck) ParameterSchema ¶ added in v1.3.0
type MetricsTool ¶ added in v1.2.0
type MetricsTool struct {
// contains filtered or unexported fields
}
MetricsTool provides query access to session observability metrics. It supports four modes: summary, tool-stats, phase-stats, cost-report.
func NewMetricsTool ¶ added in v1.2.0
func NewMetricsTool(collector *metrics.Collector) *MetricsTool
NewMetricsTool creates a MetricsTool backed by the given collector.
func (*MetricsTool) Description ¶ added in v1.2.0
func (t *MetricsTool) Description() string
func (*MetricsTool) Execute ¶ added in v1.2.0
func (t *MetricsTool) Execute(ctx context.Context, input types.ToolInput) (types.ToolResult, error)
func (*MetricsTool) Name ¶ added in v1.2.0
func (t *MetricsTool) Name() string
func (*MetricsTool) ParameterSchema ¶ added in v1.2.0
func (t *MetricsTool) ParameterSchema() string
ParameterSchema returns the JSON Schema for Metrics tool parameters.
func (*MetricsTool) RiskLevel ¶ added in v1.2.0
func (t *MetricsTool) RiskLevel() types.RiskLevel
type OutputStore ¶ added in v1.3.0
type OutputStore struct {
// contains filtered or unexported fields
}
OutputStore bounds tool output to prevent single tool calls from consuming the entire context window. When output exceeds configured limits, the full output is saved to a managed directory and a head+tail preview is returned.
func NewOutputStore ¶ added in v1.3.0
func NewOutputStore(baseDir string, maxLines, maxBytes int) *OutputStore
NewOutputStore creates an OutputStore with the given limits. baseDir is the directory where truncated outputs are saved (e.g., ~/.m31a/tool-output/).
func (*OutputStore) Bound ¶ added in v1.3.0
func (s *OutputStore) Bound(output string) (string, string, bool)
Bound checks if the output exceeds configured limits. If so, it saves the full output to a file and returns a head+tail preview with a truncation marker. Returns (boundedOutput, savedPath, wasTruncated).
type PackageStat ¶ added in v1.1.0
PackageStat holds aggregate stats for a single package (directory).
type PermissionContext ¶
type PermissionContext struct {
RuleTool string // Tool name from the matched rule
RulePattern string // Pattern from the matched rule
RuleAction string // The action that triggered (allow/deny/ask)
Source string // Source of the decision: "rule", "agent_default", or "risk_level"
}
PermissionContext carries additional info about a matched rule for display in the permission modal.
type PermissionPolicy ¶ added in v1.6.0
type PermissionPolicy string
PermissionPolicy defines how permissions are handled in headless mode
const ( PolicyAllowSafe PermissionPolicy = "allow-safe" PolicyDenyAll PermissionPolicy = "deny-all" PolicyPrompt PermissionPolicy = "prompt" )
func (PermissionPolicy) IsValid ¶ added in v1.6.0
func (p PermissionPolicy) IsValid() bool
func (PermissionPolicy) ShouldAutoAllow ¶ added in v1.6.0
func (p PermissionPolicy) ShouldAutoAllow(toolName string, risk types.RiskLevel) bool
ShouldAutoAllow determines if a tool is automatically allowed based on policy
type PermissionRequest ¶
type PermissionRequest struct {
ID int64 `json:"id"`
ToolName string `json:"tool_name"`
Command string `json:"command"`
RiskLevel types.RiskLevel `json:"risk_level"`
TimeoutSecs int `json:"timeout_secs"`
// QueueDepth is the number of pending permission requests behind this one.
QueueDepth int `json:"queue_depth"`
// Rule context (populated when a permission rule matched)
RuleTool string `json:"rule_tool,omitempty"`
RulePattern string `json:"rule_pattern,omitempty"`
RuleAction string `json:"rule_action,omitempty"`
// Policy indicates how permissions should be handled (AllowSafe/DenyAll/Prompt)
Policy PermissionPolicy `json:"policy,omitempty"`
}
type PermissionResponse ¶
type PersistentPermissions ¶ added in v1.3.0
type PersistentPermissions struct {
// contains filtered or unexported fields
}
PersistentPermissions manages saved permission rules that survive across sessions. Rules are scoped by project directory and stored in ~/.m31a/permissions.json.
func NewPersistentPermissions ¶ added in v1.3.0
func NewPersistentPermissions() *PersistentPermissions
NewPersistentPermissions creates a PersistentPermissions instance that reads/writes to ~/.m31a/permissions.json.
func (*PersistentPermissions) Load ¶ added in v1.3.0
func (p *PersistentPermissions) Load(projectDir string) []config.PermissionRule
Load reads persistent permission rules for the given project directory.
func (*PersistentPermissions) Remove ¶ added in v1.3.0
func (p *PersistentPermissions) Remove(projectDir string) error
Remove clears all persistent rules for the given project directory.
func (*PersistentPermissions) Save ¶ added in v1.3.0
func (p *PersistentPermissions) Save(projectDir string, rule config.PermissionRule) error
Save adds a permission rule for the given project directory and persists it.
type QuestionRequest ¶
type QuestionRequest struct {
ID int64
Question string
Header string
Options []string
AllowCustom bool
TimeoutSecs int
}
QuestionRequest represents a question sent from the tool to the TUI.
type QuestionResponse ¶
type QuestionResponse struct {
Answer string
}
QuestionResponse represents the user's answer from the TUI.
type SafeFileOp ¶ added in v1.4.0
type SafeFileOp struct {
// contains filtered or unexported fields
}
SafeFileOp provides TOCTOU-safe file operations by opening a file descriptor and validating it before performing operations. This prevents race conditions where a symlink could be created between path resolution and file access.
func (*SafeFileOp) OpenAndValidate ¶ added in v1.4.0
func (s *SafeFileOp) OpenAndValidate(path, workDir string, flag int, perm os.FileMode) (*os.File, string, error)
OpenAndValidate opens a file and validates it's within the allowed directory. Returns the file handle and resolved path, or an error if validation fails. The caller is responsible for closing the returned file.
type TodoRead ¶ added in v1.5.0
type TodoRead struct {
// contains filtered or unexported fields
}
func NewTodoRead ¶ added in v1.5.0
func (*TodoRead) Description ¶ added in v1.5.0
func (*TodoRead) ParameterSchema ¶ added in v1.5.0
ParameterSchema returns the JSON Schema for TodoRead tool parameters.
func (*TodoRead) SetSessionID ¶ added in v1.5.0
type TodoWrite ¶
type TodoWrite struct {
// contains filtered or unexported fields
}
func NewTodoWrite ¶
func (*TodoWrite) Description ¶
func (*TodoWrite) ParameterSchema ¶
ParameterSchema returns the JSON Schema for TodoWrite tool parameters.
func (*TodoWrite) SetOnUpdate ¶ added in v1.1.0
SetOnUpdate sets the callback invoked after successful todo writes.
func (*TodoWrite) SetSessionID ¶
func (*TodoWrite) SyncTodoFromTasks ¶ added in v1.4.0
SyncTodoFromTasks generates TODO.md from a task runner's current state. This bridges the gap between the task runner (which tracks execution state) and the TODO.md file (which provides user-visible progress tracking). It is called automatically after each execution group and at phase boundaries.
type WebFetch ¶
type WebFetch struct {
// contains filtered or unexported fields
}
func NewWebFetch ¶
func (*WebFetch) Close ¶ added in v1.1.0
func (wf *WebFetch) Close()
Close releases idle connections held by the HTTP client's transport. Call this during shutdown to prevent connection leaks.
func (*WebFetch) Description ¶
func (*WebFetch) ParameterSchema ¶
ParameterSchema returns the JSON Schema for WebFetch tool parameters.
type WebSearch ¶
type WebSearch struct {
// contains filtered or unexported fields
}
func NewWebSearch ¶
func (*WebSearch) Close ¶ added in v1.0.2
func (t *WebSearch) Close()
Close releases idle connections held by the HTTP client's transport. Call this during shutdown to prevent connection leaks.
func (*WebSearch) Description ¶
func (*WebSearch) ParameterSchema ¶
Source Files
¶
- agent.go
- backup.go
- bash.go
- bash_unix.go
- codecomplexity.go
- codemap.go
- constants.go
- defaults.go
- devserver.go
- dispatcher.go
- dns_cache.go
- edit.go
- filedelete.go
- filelist.go
- filemove.go
- fileread.go
- filewrite.go
- glob.go
- grep.go
- httpcheck.go
- interface.go
- metrics.go
- output_store.go
- pathhelpers.go
- permissions.go
- persistent_permissions.go
- prockill_unix.go
- question.go
- strings.go
- todo.go
- todoread.go
- toolcall.go
- tooldefs.go
- webfetch.go
- websearch.go