Documentation
¶
Overview ¶
Package tools defines the tools available to the agent.
Index ¶
- func ChannelBindingFromContext(ctx context.Context) *memory.ChannelBinding
- func ConversationIDFromContext(ctx context.Context) string
- func FormatEntityState(state *homeassistant.State) string
- func HintsFromContext(ctx context.Context) map[string]string
- func IterationIndexFromContext(ctx context.Context) (int, bool)
- func LoopCompletionTargetFromContext(ctx context.Context) (looppkg.Completion, string, *looppkg.CompletionChannelTarget)
- func LoopIDFromContext(ctx context.Context) string
- func NotificationSource(ctx context.Context) string
- func SessionIDFromContext(ctx context.Context) string
- func ToolCallIDFromContext(ctx context.Context) string
- func WithChannelBinding(ctx context.Context, binding *memory.ChannelBinding) context.Context
- func WithConversationID(ctx context.Context, id string) context.Context
- func WithHints(ctx context.Context, hints map[string]string) context.Context
- func WithIterationIndex(ctx context.Context, idx int) context.Context
- func WithLoopID(ctx context.Context, id string) context.Context
- func WithSessionID(ctx context.Context, id string) context.Context
- func WithToolCallID(ctx context.Context, id string) context.Context
- type CallbackDispatcher
- type CapabilityManager
- type CapabilityManifest
- type ContentResolver
- type ConversationResetter
- type EntityMatch
- type ErrToolUnavailable
- type EscalationDeps
- type ExecResult
- type FileTools
- func (ft *FileTools) Edit(ctx context.Context, path, oldText, newText string) error
- func (ft *FileTools) Enabled() bool
- func (ft *FileTools) Grep(ctx context.Context, dir, pattern string, maxDepth int, caseInsensitive bool) (string, error)
- func (ft *FileTools) List(ctx context.Context, path string) ([]string, error)
- func (ft *FileTools) Read(ctx context.Context, path string, offset, limit int) (string, error)
- func (ft *FileTools) Search(ctx context.Context, dir, pattern string, maxDepth int) (string, error)
- func (ft *FileTools) SetResolver(r *paths.Resolver)
- func (ft *FileTools) Stat(ctx context.Context, paths string) (string, error)
- func (ft *FileTools) Tree(ctx context.Context, dir string, maxDepth int) (string, error)
- func (ft *FileTools) WorkspacePath() string
- func (ft *FileTools) Write(ctx context.Context, path, content string) error
- type FindEntityArgs
- type FindEntityResult
- type LensStore
- type LoopDefinitionToolDeps
- type ModelRegistryToolDeps
- type Registry
- func (r *Registry) AllToolNames() []string
- func (r *Registry) ConfigureLoopDefinitionTools(deps LoopDefinitionToolDeps)
- func (r *Registry) ConfigureModelRegistryTools(deps ModelRegistryToolDeps)
- func (r *Registry) EnablePlatformTools(caller platformCallFunc)
- func (r *Registry) Execute(ctx context.Context, name string, argsJSON string) (string, error)
- func (r *Registry) FilterByTags(tags []string) *Registry
- func (r *Registry) FilteredCopy(names []string) *Registry
- func (r *Registry) FilteredCopyExcluding(exclude []string) *Registry
- func (r *Registry) Get(name string) *Tool
- func (r *Registry) List() []map[string]any
- func (r *Registry) MetadataTagIndex() map[string][]string
- func (r *Registry) Register(t *Tool)
- func (r *Registry) SetArchiveStore(store *memory.ArchiveStore)
- func (r *Registry) SetAttachmentTools(at *attachments.Tools)
- func (r *Registry) SetCallbackDispatcher(d CallbackDispatcher)
- func (r *Registry) SetCapabilityTools(mgr CapabilityManager, manifest []CapabilityManifest)
- func (r *Registry) SetContactTools(ct *contacts.Tools)
- func (r *Registry) SetContentResolver(cr *ContentResolver)
- func (r *Registry) SetConversationResetter(resetter ConversationResetter)
- func (r *Registry) SetEmailTools(et *email.Tools)
- func (r *Registry) SetEscalationTools(deps EscalationDeps)
- func (r *Registry) SetFactTools(ft *knowledge.Tools)
- func (r *Registry) SetFetcher(f *search.Fetcher)
- func (r *Registry) SetFileTools(ft *FileTools)
- func (r *Registry) SetForgeTools(ft forgeHandler)
- func (r *Registry) SetHANotifier(s *notifications.Sender)
- func (r *Registry) SetLensTools(store *LensStore)
- func (r *Registry) SetLogIndexDB(db *sql.DB)
- func (r *Registry) SetMQTTSubscriptionTools(mt *mqtt.Tools)
- func (r *Registry) SetMediaAnalysisTools(at *media.AnalysisTools)
- func (r *Registry) SetMediaClient(c *media.Client)
- func (r *Registry) SetMediaFeedTools(ft *media.FeedTools)
- func (r *Registry) SetNotificationRecords(rs *notifications.RecordStore)
- func (r *Registry) SetNotificationRouter(router *notifications.NotificationRouter)
- func (r *Registry) SetSearchManager(mgr *search.Manager)
- func (r *Registry) SetSessionManager(mgr SessionManager)
- func (r *Registry) SetShellExec(se *ShellExec)
- func (r *Registry) SetTagIndex(tags map[string][]string)
- func (r *Registry) SetTempFileStore(tfs *TempFileStore)
- func (r *Registry) SetUsageStore(store *usage.Store)
- func (r *Registry) SetWatchlistStore(store *awareness.WatchlistStore)
- func (r *Registry) SetWorkingMemoryStore(store *memory.WorkingMemoryStore)
- func (r *Registry) TaggedToolNames(tag string) []string
- func (r *Registry) TempFileStore() *TempFileStore
- type SessionManager
- type ShellExec
- type ShellExecConfig
- type TempFileStore
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChannelBindingFromContext ¶ added in v0.9.1
func ChannelBindingFromContext(ctx context.Context) *memory.ChannelBinding
ChannelBindingFromContext extracts the typed channel binding from the context. Returns nil when unset.
func ConversationIDFromContext ¶ added in v0.4.0
ConversationIDFromContext extracts the conversation ID from the context. Returns "default" if not set.
func FormatEntityState ¶ added in v0.7.0
func FormatEntityState(state *homeassistant.State) string
FormatEntityState formats a Home Assistant entity state for LLM consumption. Used by get_state, control_device post-action verification, and context injection.
func HintsFromContext ¶ added in v0.7.0
HintsFromContext extracts routing hints from the context. Returns nil if no hints were set.
func IterationIndexFromContext ¶ added in v0.8.0
IterationIndexFromContext extracts the loop iteration index from the context. Returns -1 and false if not set.
func LoopCompletionTargetFromContext ¶ added in v0.9.1
func LoopCompletionTargetFromContext(ctx context.Context) (looppkg.Completion, string, *looppkg.CompletionChannelTarget)
LoopCompletionTargetFromContext derives the most natural detached completion target for the current tool call context. The returned conversation ID always reflects the current live conversation when one is available, even when the preferred detached delivery target is a channel target such as Signal or OWU.
func LoopIDFromContext ¶ added in v0.8.4
LoopIDFromContext extracts the calling loop's ID from the context. Returns an empty string if not set (e.g. non-loop API requests).
func NotificationSource ¶ added in v0.9.1
NotificationSource builds a source identifier from the request context for notification history logging. Returns a string like "metacognitive", "signal/+15125551234", or "agent".
func SessionIDFromContext ¶ added in v0.8.0
SessionIDFromContext extracts the archive session ID from the context. Returns an empty string if not set.
func ToolCallIDFromContext ¶ added in v0.8.0
ToolCallIDFromContext extracts the tool call ID from the context. Returns an empty string if not set.
func WithChannelBinding ¶ added in v0.9.1
WithChannelBinding adds a typed channel binding to the context. Nil bindings are ignored.
func WithConversationID ¶ added in v0.4.0
WithConversationID adds the conversation ID to the context.
func WithHints ¶ added in v0.7.0
WithHints adds routing hints to the context. Nil hints are ignored (the original context is returned unchanged).
func WithIterationIndex ¶ added in v0.8.0
WithIterationIndex adds the current loop iteration index to the context.
func WithLoopID ¶ added in v0.8.4
WithLoopID adds the calling loop's ID to the context. This allows tool handlers (e.g. delegate executor) to discover which loop invoked them for parent-child relationship tracking.
func WithSessionID ¶ added in v0.8.0
WithSessionID adds the archive session ID to the context. This allows downstream code (e.g. delegate executor) to discover its parent session.
Types ¶
type CallbackDispatcher ¶ added in v0.9.1
type CallbackDispatcher interface {
DispatchAction(record *notifications.Record, actionID string)
}
CallbackDispatcher routes notification responses to originating sessions. Implemented by notifications.CallbackDispatcher.
type CapabilityManager ¶ added in v0.7.0
type CapabilityManager interface {
// RequestCapability activates a capability tag for the current Run.
RequestCapability(ctx context.Context, tag string) error
// DropCapability deactivates a capability tag for the current Run.
DropCapability(ctx context.Context, tag string) error
// ResetCapabilities drops all voluntary tags for the current Run,
// returning the tags that were removed.
ResetCapabilities(ctx context.Context) ([]string, error)
// ActiveTags returns the set of currently active tags for the Run.
ActiveTags(ctx context.Context) map[string]bool
}
CapabilityManager controls per-Run capability tag activation. Implemented by agent.Loop. All methods operate on the context-scoped capability scope created at the start of each Run().
type CapabilityManifest ¶ added in v0.7.0
type CapabilityManifest = toolcatalog.CapabilitySurface
CapabilityManifest describes a capability tag for the manifest.
func BuildCapabilityManifest ¶ added in v0.7.0
func BuildCapabilityManifest(tags map[string][]string, descriptions map[string]string, alwaysActive map[string]bool, protected map[string]bool) []CapabilityManifest
BuildCapabilityManifest creates a sorted list of capability descriptions from the config map. This is used both for the tool description and for generating the capability manifest talent.
type ContentResolver ¶ added in v0.8.0
type ContentResolver struct {
// contains filtered or unexported fields
}
ContentResolver resolves bare prefix references (temp:LABEL, kb:file.md, etc.) in tool argument values to file content. It is nil-safe: calling methods on a nil *ContentResolver is a no-op.
func NewContentResolver ¶ added in v0.8.0
func NewContentResolver(pr *paths.Resolver, tfs *TempFileStore, logger *slog.Logger) *ContentResolver
NewContentResolver creates a ContentResolver backed by the given path resolver and temp file store. The path resolver may be nil — resolution for path-based prefixes is silently skipped. If the temp file store is nil, any temp: references will return an error (they are always intentional). Returns nil if both dependencies are nil (no resolution possible).
func (*ContentResolver) ResolveArgs ¶ added in v0.8.0
ResolveArgs recursively walks all values in args and replaces bare prefix references with file content. A "bare" reference is one where the entire string value is the prefix reference — no surrounding whitespace or text. Nested maps and arrays are traversed.
For temp: references, resolution failures are always treated as errors — these are intentional and a missing label (or unconfigured store) likely indicates a typo, stale reference, or misconfiguration. For path prefixes (kb:, scratchpad:, etc.), missing files pass through silently since a nonexistent file is valid state.
The method modifies args in place.
type ConversationResetter ¶ added in v0.4.0
ConversationResetter is the interface for resetting conversations. Implemented by agent.Loop.
type EntityMatch ¶
EntityMatch represents a fuzzy match result.
type ErrToolUnavailable ¶ added in v0.8.0
type ErrToolUnavailable struct {
}
ErrToolUnavailable is returned when a tool call targets a tool that is not present in the effective registry. This indicates a capability mismatch (filtered by tags, excluded by request, or nonexistent), not a transient execution failure. Callers should break the iteration loop rather than retrying.
func (*ErrToolUnavailable) Error ¶ added in v0.8.0
func (e *ErrToolUnavailable) Error() string
Error implements the error interface.
type EscalationDeps ¶ added in v0.9.1
type EscalationDeps struct {
Router *notifications.NotificationRouter
Records *notifications.RecordStore
Dispatcher *notifications.CallbackDispatcher
Waiter *notifications.ResponseWaiter
}
EscalationDeps holds the dependencies for escalation tools.
type ExecResult ¶
type ExecResult struct {
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
ExitCode int `json:"exitCode"`
TimedOut bool `json:"timedOut,omitempty"`
Error string `json:"error,omitempty"`
}
ExecResult contains the result of a command execution.
type FileTools ¶
type FileTools struct {
// contains filtered or unexported fields
}
FileTools provides file read/write/edit capabilities within a workspace.
func NewFileTools ¶
NewFileTools creates a new FileTools instance. If workspacePath is empty, file tools will be disabled.
func (*FileTools) Grep ¶ added in v0.5.1
func (ft *FileTools) Grep(ctx context.Context, dir, pattern string, maxDepth int, caseInsensitive bool) (string, error)
Grep searches file contents for a regular expression pattern. Results are formatted as path:line_number:matching_line.
func (*FileTools) Search ¶ added in v0.5.1
Search finds files matching a glob pattern within a directory tree. Results are returned as workspace-relative paths, one per line.
func (*FileTools) SetResolver ¶ added in v0.8.0
SetResolver configures the shared path prefix resolver for directory-based prefixes (kb:, scratchpad:, etc.). When set, prefixed paths are expanded to their configured directories before sandbox checks.
func (*FileTools) Stat ¶ added in v0.5.1
Stat returns detailed information about one or more files or directories. Paths should be comma-separated. Each path is resolved through the workspace sandbox.
func (*FileTools) Tree ¶ added in v0.5.1
Tree renders a directory tree with indentation. The output includes a summary of total directories and files.
func (*FileTools) WorkspacePath ¶
WorkspacePath returns the configured workspace path.
type FindEntityArgs ¶
type FindEntityArgs struct {
Description string `json:"description"` // e.g., "access point LED", "ceiling fan"
Area string `json:"area,omitempty"` // e.g., "office", "Nugget's Office"
Domain string `json:"domain,omitempty"` // e.g., "light", "switch", "fan"
}
FindEntityArgs represents the arguments for the find_entity tool.
type FindEntityResult ¶
type FindEntityResult struct {
Found bool `json:"found"`
EntityID string `json:"entity_id,omitempty"`
FriendlyName string `json:"friendly_name,omitempty"`
AreaName string `json:"area_name,omitempty"`
Confidence float64 `json:"confidence,omitempty"`
Error string `json:"error,omitempty"`
Candidates []string `json:"candidates,omitempty"` // When ambiguous or not found
}
FindEntityResult represents the result of entity discovery.
type LensStore ¶ added in v0.9.1
type LensStore struct {
// contains filtered or unexported fields
}
LensStore manages persistent behavioral lenses via opstate. Lenses are global — they apply to all conversations and survive restarts. Use activate_capability for per-conversation tool access.
func NewLensStore ¶ added in v0.9.1
NewLensStore creates a lens store backed by opstate.
func (*LensStore) ActiveLenses ¶ added in v0.9.1
ActiveLenses returns the currently active lens tags.
type LoopDefinitionToolDeps ¶ added in v0.9.1
type LoopDefinitionToolDeps struct {
Registry *looppkg.DefinitionRegistry
View func() *looppkg.DefinitionRegistryView
PersistSpec func(looppkg.Spec, time.Time) error
DeleteSpec func(string) error
PersistPolicy func(string, looppkg.DefinitionPolicy) error
DeletePolicy func(string) error
Reconcile func(context.Context, string) error
LaunchDefinition func(context.Context, string, looppkg.Launch) (looppkg.LaunchResult, error)
}
LoopDefinitionToolDeps wires the live loop-definition registry into the tool registry so the model can inspect and mutate the persistent loops-ng definition overlay.
type ModelRegistryToolDeps ¶ added in v0.9.1
type ModelRegistryToolDeps struct {
Registry *models.Registry
Router *routepkg.Router
SyncRouter func()
PersistDeploymentPolicy func(string, models.DeploymentPolicy) error
DeleteDeploymentPolicy func(string) error
PersistResourcePolicy func(string, models.ResourcePolicy) error
DeleteResourcePolicy func(string) error
}
ModelRegistryToolDeps wires the live model-registry and router state into the tool registry so model-facing operator tools can act on the same runtime machinery as the API surface.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds available tools.
func NewEmptyRegistry ¶ added in v0.5.0
func NewEmptyRegistry() *Registry
NewEmptyRegistry creates an empty tool registry with no built-in tools. Use this for testing or when constructing a registry manually.
func NewRegistry ¶
func NewRegistry(ha *homeassistant.Client, sched *scheduler.Scheduler) *Registry
NewRegistry creates a tool registry with HA integration.
func (*Registry) AllToolNames ¶ added in v0.5.0
AllToolNames returns the names of all registered tools.
func (*Registry) ConfigureLoopDefinitionTools ¶ added in v0.9.1
func (r *Registry) ConfigureLoopDefinitionTools(deps LoopDefinitionToolDeps)
ConfigureLoopDefinitionTools stores the runtime dependencies needed by the loop-definition tool family and registers the tools.
func (*Registry) ConfigureModelRegistryTools ¶ added in v0.9.1
func (r *Registry) ConfigureModelRegistryTools(deps ModelRegistryToolDeps)
ConfigureModelRegistryTools stores the runtime dependencies needed by the model-registry tool family and registers the tools.
func (*Registry) EnablePlatformTools ¶ added in v0.9.1
func (r *Registry) EnablePlatformTools(caller platformCallFunc)
EnablePlatformTools adds native platform-host tools to the registry.
func (*Registry) FilterByTags ¶ added in v0.7.0
FilterByTags creates a new Registry containing only the tools that belong to at least one of the given tags, plus any tools marked as AlwaysAvailable. If tags is empty or the tag index is nil, returns a copy of the full registry.
func (*Registry) FilteredCopy ¶ added in v0.5.0
FilteredCopy creates a new Registry containing only the named tools. Tools not found in the source are silently skipped. The returned registry shares tool handlers with the source but has its own map.
func (*Registry) FilteredCopyExcluding ¶ added in v0.5.0
FilteredCopyExcluding creates a new Registry containing all tools except those in the exclude list.
func (*Registry) MetadataTagIndex ¶ added in v0.9.1
MetadataTagIndex builds a tag-to-tool mapping from per-tool default metadata. Tags with no registered tools are omitted.
func (*Registry) SetArchiveStore ¶ added in v0.3.0
func (r *Registry) SetArchiveStore(store *memory.ArchiveStore)
SetArchiveStore adds conversation archive tools to the registry.
func (*Registry) SetAttachmentTools ¶ added in v0.8.4
func (r *Registry) SetAttachmentTools(at *attachments.Tools)
SetAttachmentTools adds attachment query and analysis tools to the registry.
func (*Registry) SetCallbackDispatcher ¶ added in v0.9.1
func (r *Registry) SetCallbackDispatcher(d CallbackDispatcher)
SetCallbackDispatcher configures callback routing for the resolve_actionable tool.
func (*Registry) SetCapabilityTools ¶ added in v0.7.0
func (r *Registry) SetCapabilityTools(mgr CapabilityManager, manifest []CapabilityManifest)
SetCapabilityTools adds activate_capability, deactivate_capability, reset_capabilities, and list_loaded_capabilities tools to the registry. These tools let the agent inspect and mutate capability tags mid-conversation.
These tools are intentionally not assigned to any tag group. They live in the base registry and survive all tag filtering, ensuring the agent can always activate or deactivate capabilities regardless of which tags are currently active.
func (*Registry) SetContactTools ¶ added in v0.7.0
SetContactTools adds contact management tools to the registry.
func (*Registry) SetContentResolver ¶ added in v0.8.0
func (r *Registry) SetContentResolver(cr *ContentResolver)
SetContentResolver configures universal prefix-to-content resolution for tool arguments. When set, string arguments matching a registered prefix (temp:, kb:, scratchpad:, etc.) are replaced with file content before the handler runs. Tools with SkipContentResolve=true are exempt.
func (*Registry) SetConversationResetter ¶ added in v0.4.0
func (r *Registry) SetConversationResetter(resetter ConversationResetter)
SetConversationResetter adds conversation management tools to the registry.
func (*Registry) SetEmailTools ¶ added in v0.7.0
SetEmailTools adds email tools to the registry.
func (*Registry) SetEscalationTools ¶ added in v0.9.1
func (r *Registry) SetEscalationTools(deps EscalationDeps)
SetEscalationTools registers the request_human_escalation and request_ai_escalation tools. Requires notification routing, record tracking, callback dispatch, and synchronous response waiting.
func (*Registry) SetFactTools ¶
SetFactTools adds fact management tools to the registry.
func (*Registry) SetFetcher ¶ added in v0.2.3
SetFetcher adds the web_fetch tool to the registry.
func (*Registry) SetFileTools ¶
SetFileTools adds file operation tools to the registry.
func (*Registry) SetForgeTools ¶ added in v0.7.1
func (r *Registry) SetForgeTools(ft forgeHandler)
SetForgeTools adds code forge tools to the registry. The handler must implement all forge tool operations — in practice this is *forge.Tools.
func (*Registry) SetHANotifier ¶ added in v0.8.0
func (r *Registry) SetHANotifier(s *notifications.Sender)
SetHANotifier adds the ha_notify tool to the registry.
func (*Registry) SetLensTools ¶ added in v0.9.1
SetLensTools registers activate_lens, deactivate_lens, and list_lenses tools. These manage persistent behavioral lenses that apply globally across all conversations. Lenses use the same tag system as capabilities — when a lens is active, KB articles and talents tagged with that lens name are loaded into every conversation.
func (*Registry) SetLogIndexDB ¶ added in v0.8.3
SetLogIndexDB adds the logs_query tool to the registry so the agent can query its own structured log index for self-diagnostics. If db is nil (log indexing disabled), the tool is not registered.
func (*Registry) SetMQTTSubscriptionTools ¶
SetMQTTSubscriptionTools adds MQTT wake subscription management tools to the registry.
func (*Registry) SetMediaAnalysisTools ¶ added in v0.8.0
func (r *Registry) SetMediaAnalysisTools(at *media.AnalysisTools)
SetMediaAnalysisTools adds the media analysis persistence tool to the registry. The tool lets the agent save structured analysis to an Obsidian-compatible vault and track engagement.
func (*Registry) SetMediaClient ¶ added in v0.7.1
SetMediaClient adds the media_transcript tool to the registry.
func (*Registry) SetMediaFeedTools ¶ added in v0.8.0
SetMediaFeedTools adds RSS/Atom feed management tools to the registry.
func (*Registry) SetNotificationRecords ¶ added in v0.8.0
func (r *Registry) SetNotificationRecords(rs *notifications.RecordStore)
SetNotificationRecords configures the notification record store used by the ha_notify tool to track actionable notifications.
func (*Registry) SetNotificationRouter ¶ added in v0.8.0
func (r *Registry) SetNotificationRouter(router *notifications.NotificationRouter)
SetNotificationRouter adds the provider-agnostic send_notification and request_human_decision tools to the registry.
func (*Registry) SetSearchManager ¶ added in v0.2.3
SetSearchManager adds the web_search tool to the registry.
func (*Registry) SetSessionManager ¶ added in v0.7.0
func (r *Registry) SetSessionManager(mgr SessionManager)
SetSessionManager adds granular session management tools to the registry.
func (*Registry) SetShellExec ¶
SetShellExec adds shell execution tools to the registry.
func (*Registry) SetTagIndex ¶ added in v0.7.0
SetTagIndex builds the tag-to-tool mapping from config. Each tag name maps to a list of tool names. Tools not found in the registry are silently skipped (they may not be registered yet or the MCP server may be down).
func (*Registry) SetTempFileStore ¶ added in v0.7.1
func (r *Registry) SetTempFileStore(tfs *TempFileStore)
SetTempFileStore adds the create_temp_file tool to the registry and stores the reference for label expansion and cleanup.
func (*Registry) SetUsageStore ¶ added in v0.7.1
SetUsageStore adds the cost_summary tool to the registry so the agent can query its own token usage and API costs.
func (*Registry) SetWatchlistStore ¶ added in v0.7.0
func (r *Registry) SetWatchlistStore(store *awareness.WatchlistStore)
SetWatchlistStore adds the add_context_entity and remove_context_entity tools to the registry.
func (*Registry) SetWorkingMemoryStore ¶ added in v0.5.0
func (r *Registry) SetWorkingMemoryStore(store *memory.WorkingMemoryStore)
SetWorkingMemoryStore adds the session_working_memory tool to the registry. This tool allows the agent to read and write free-form experiential notes for the current conversation, capturing texture that mechanical compaction destroys.
func (*Registry) TaggedToolNames ¶ added in v0.7.0
TaggedToolNames returns the tool names belonging to a tag. Returns nil for unknown tags.
func (*Registry) TempFileStore ¶ added in v0.7.1
func (r *Registry) TempFileStore() *TempFileStore
TempFileStore returns the temp file store, or nil if not configured. Used by the delegate executor for label expansion and by the agent loop for cleanup.
type SessionManager ¶ added in v0.7.0
type SessionManager interface {
// CloseSession gracefully closes the current session, archives messages,
// injects a carry-forward handoff into the new session, and starts fresh.
CloseSession(conversationID, reason, carryForward string) error
// CheckpointSession snapshots current conversation state without ending
// the session. A safety net against crashes or compaction losing state.
CheckpointSession(conversationID, label string) error
// SplitSession retroactively splits the current session at a past message
// boundary. Everything before the split point is archived; everything
// after becomes the current session. Exactly one of atIndex or atMessage
// must be provided (atIndex is a negative offset from the end).
SplitSession(conversationID string, atIndex int, atMessage string) error
}
SessionManager provides granular session lifecycle control beyond the nuclear conversation_reset. Implemented by agent.Loop.
type ShellExec ¶
type ShellExec struct {
// contains filtered or unexported fields
}
ShellExec provides command execution capabilities.
func NewShellExec ¶
func NewShellExec(cfg ShellExecConfig) *ShellExec
NewShellExec creates a new shell executor.
type ShellExecConfig ¶
type ShellExecConfig struct {
Enabled bool
WorkingDir string
AllowedCmds []string
DeniedCmds []string
DefaultTimeout time.Duration
MaxOutputBytes int
}
ShellExecConfig configures the shell executor.
func DefaultShellExecConfig ¶
func DefaultShellExecConfig() ShellExecConfig
DefaultShellExecConfig returns safe defaults.
type TempFileStore ¶ added in v0.7.1
type TempFileStore struct {
// contains filtered or unexported fields
}
TempFileStore manages temporary files created for orchestrator-delegate data passing. Files are written to a workspace subdirectory and tracked via opstate so labels can be expanded to paths and cleaned up when the conversation ends.
func NewTempFileStore ¶ added in v0.7.1
NewTempFileStore creates a TempFileStore rooted at baseDir. The directory is created on first write, not at construction time.
func (*TempFileStore) Cleanup ¶ added in v0.7.1
func (s *TempFileStore) Cleanup(convID string) error
Cleanup removes all temp files and opstate entries for a conversation. Errors on individual file removals are logged but do not prevent cleanup of remaining files.
func (*TempFileStore) Create ¶ added in v0.7.1
Create writes content to a temp file and maps the label to its path. The returned string is the label itself (not the path). If a label already exists for this conversation, the old file is removed and the mapping updated.
func (*TempFileStore) ExpandLabels ¶ added in v0.7.1
func (s *TempFileStore) ExpandLabels(convID, text string) string
ExpandLabels replaces all occurrences of "temp:LABEL" in text with the corresponding file path for the given conversation. Unknown labels are left as-is.
func (*TempFileStore) Resolve ¶ added in v0.7.1
func (s *TempFileStore) Resolve(convID, label string) string
Resolve returns the filesystem path for a label in the given conversation. Returns empty string if the label does not exist.
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters map[string]any `json:"parameters"`
Handler func(ctx context.Context, args map[string]any) (string, error) `json:"-"`
AlwaysAvailable bool `json:"-"` // Survives capability tag filtering.
SkipContentResolve bool `json:"-"` // Exempt from prefix-to-content resolution.
CanonicalID string `json:"-"`
Source string `json:"-"`
Origin string `json:"-"`
DefaultTags []string `json:"-"`
}
Tool represents a callable tool.
Source Files
¶
- analysis_tools.go
- archive_tools.go
- attachment_tools.go
- capability_tools.go
- contact_tools.go
- content_resolve.go
- context.go
- email_tools.go
- errors.go
- escalation_tools.go
- feed_tools.go
- file_tools.go
- find_entity.go
- forge_tools.go
- ha_automation_tools.go
- lens_tools.go
- log_tools.go
- loop_definition_mutation_tools.go
- loop_definition_read_tools.go
- loop_definition_tool_helpers.go
- loop_definition_tools.go
- model_registry_policy_tools.go
- model_registry_read_tools.go
- model_registry_tool_helpers.go
- model_registry_tools.go
- model_route_tools.go
- mqtt_tools.go
- notification_tools.go
- platform_tools.go
- session_tools.go
- shell_exec.go
- tempfiles.go
- tools.go
- usage_tools.go
- watchlist_tools.go
- working_memory_tools.go