Documentation
¶
Index ¶
- func NewAppendDiaryTool(workspacePath string) (tool.InvokableTool, error)
- func NewAppendFileTool(workspacePath string) (tool.InvokableTool, error)
- func NewCronTool(service *cron.Service) (tool.InvokableTool, error)
- func NewEditFileTool(workspacePath string) (tool.InvokableTool, error)
- func NewExecTool(timeoutSec int, restrictToWorkspace bool, workspaceDir string) (tool.InvokableTool, error)
- func NewListDirTool(workspacePath string) (tool.InvokableTool, error)
- func NewMessageTool(publisher interface{ ... }) (tool.InvokableTool, error)
- func NewReadFileTool(workspacePath string) (tool.InvokableTool, error)
- func NewReadMemoryTool(workspacePath string) (tool.InvokableTool, error)
- func NewSpawnTool(executor SubagentExecutor) (tool.InvokableTool, error)
- func NewSubagentTool(executor SubagentExecutor) (tool.InvokableTool, error)
- func NewWebFetchTool() (tool.InvokableTool, error)
- func NewWebSearchTool(apiKey string, maxResults int) (tool.InvokableTool, error)
- func NewWorkflowTool(executor WorkflowExecutor) (tool.InvokableTool, error)
- func NewWriteFileTool(workspacePath string) (tool.InvokableTool, error)
- func NewWriteMemoryTool(workspacePath string) (tool.InvokableTool, error)
- func WithInvocationContext(ctx context.Context, meta InvocationContext) context.Context
- type AppendDiaryInput
- type AppendDiaryOutput
- type AppendFileInput
- type CronToolInput
- type EditFileInput
- type ExecInput
- type ExecOutput
- type GuardAction
- type GuardFunc
- type GuardResult
- type InvocationContext
- type ListDirInput
- type MessageInput
- type ReadFileInput
- type ReadFileOutput
- type ReadMemoryInput
- type ReadMemoryOutput
- type Registry
- func (r *Registry) Execute(ctx context.Context, name string, argsJSON string) (string, error)
- func (r *Registry) Get(name string) (tool.InvokableTool, bool)
- func (r *Registry) GetToolInfos(ctx context.Context) ([]*schema.ToolInfo, error)
- func (r *Registry) List() []tool.InvokableTool
- func (r *Registry) Names() []string
- func (r *Registry) Register(t tool.InvokableTool) error
- func (r *Registry) SetGuard(fn GuardFunc)
- type SpawnInput
- type SubagentExecutor
- type SubagentInput
- type SubagentRequest
- type WebFetchInput
- type WebFetchOutput
- type WebSearchInput
- type WebSearchOutput
- type WebSearchResult
- type WorkflowExecutor
- type WorkflowInput
- type WorkflowRequest
- type WriteFileInput
- type WriteMemoryInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAppendDiaryTool ¶ added in v0.1.4
func NewAppendDiaryTool(workspacePath string) (tool.InvokableTool, error)
func NewAppendFileTool ¶ added in v0.3.1
func NewAppendFileTool(workspacePath string) (tool.InvokableTool, error)
NewAppendFileTool creates the append_file tool.
func NewCronTool ¶ added in v0.2.0
func NewCronTool(service *cron.Service) (tool.InvokableTool, error)
NewCronTool creates an agent tool for managing cron jobs.
func NewEditFileTool ¶ added in v0.3.1
func NewEditFileTool(workspacePath string) (tool.InvokableTool, error)
NewEditFileTool creates the edit_file tool.
func NewExecTool ¶
func NewExecTool(timeoutSec int, restrictToWorkspace bool, workspaceDir string) (tool.InvokableTool, error)
NewExecTool creates the exec tool
func NewListDirTool ¶
func NewListDirTool(workspacePath string) (tool.InvokableTool, error)
NewListDirTool creates the list_dir tool
func NewMessageTool ¶ added in v0.3.0
func NewMessageTool(publisher interface {
PublishOutbound(msg *bus.OutboundMessage)
}) (tool.InvokableTool, error)
NewMessageTool creates a tool that sends a message through the message bus.
func NewReadFileTool ¶
func NewReadFileTool(workspacePath string) (tool.InvokableTool, error)
NewReadFileTool creates the read_file tool
func NewReadMemoryTool ¶ added in v0.1.4
func NewReadMemoryTool(workspacePath string) (tool.InvokableTool, error)
func NewSpawnTool ¶ added in v0.3.0
func NewSpawnTool(executor SubagentExecutor) (tool.InvokableTool, error)
NewSpawnTool creates an async subagent delegation tool.
func NewSubagentTool ¶ added in v0.3.0
func NewSubagentTool(executor SubagentExecutor) (tool.InvokableTool, error)
NewSubagentTool creates a sync subagent delegation tool.
func NewWebFetchTool ¶ added in v0.1.4
func NewWebFetchTool() (tool.InvokableTool, error)
func NewWebSearchTool ¶ added in v0.1.4
func NewWebSearchTool(apiKey string, maxResults int) (tool.InvokableTool, error)
func NewWorkflowTool ¶ added in v0.5.0
func NewWorkflowTool(executor WorkflowExecutor) (tool.InvokableTool, error)
NewWorkflowTool creates a workflow orchestration tool.
func NewWriteFileTool ¶
func NewWriteFileTool(workspacePath string) (tool.InvokableTool, error)
NewWriteFileTool creates the write_file tool
func NewWriteMemoryTool ¶ added in v0.1.4
func NewWriteMemoryTool(workspacePath string) (tool.InvokableTool, error)
func WithInvocationContext ¶ added in v0.3.0
func WithInvocationContext(ctx context.Context, meta InvocationContext) context.Context
WithInvocationContext stores invocation metadata in context for tools.
Types ¶
type AppendDiaryInput ¶ added in v0.1.4
type AppendDiaryInput struct {
Entry string `json:"entry" jsonschema:"required,description=Diary entry content to append"`
}
type AppendDiaryOutput ¶ added in v0.1.4
type AppendDiaryOutput struct {
DiaryPath string `json:"diary_path"`
}
type AppendFileInput ¶ added in v0.3.1
type AppendFileInput struct {
Path string `json:"path" jsonschema:"required,description=Absolute path to the file"`
Content string `json:"content" jsonschema:"required,description=Content to append to file end"`
}
AppendFileInput parameters for append_file tool.
type CronToolInput ¶ added in v0.2.0
type CronToolInput struct {
Action string `` /* 153-byte string literal not displayed */
Name string `json:"name,omitempty" jsonschema:"description=Job name (required for add)"`
Message string `json:"message,omitempty" jsonschema:"description=Message to send to agent (required for add)"`
EverySeconds int64 `json:"every_seconds,omitempty" jsonschema:"description=Repeat interval in seconds (for add with every schedule)"`
CronExpr string `json:"cron_expr,omitempty" jsonschema:"description=Cron expression like '0 9 * * *' (for add with cron schedule)"`
AtTimestamp string `json:"at_timestamp,omitempty" jsonschema:"description=RFC3339 timestamp for one-shot (for add with at schedule)"`
JobID string `json:"job_id,omitempty" jsonschema:"description=Job ID (required for remove/enable/disable)"`
Deliver bool `json:"deliver,omitempty" jsonschema:"description=If true deliver response directly without agent processing"`
}
type EditFileInput ¶ added in v0.3.1
type EditFileInput struct {
Path string `json:"path" jsonschema:"required,description=Absolute path to the file"`
OldText string `json:"old_text" jsonschema:"required,description=Exact existing text to replace"`
NewText string `json:"new_text" jsonschema:"required,description=Replacement text"`
}
EditFileInput parameters for edit_file tool.
type ExecInput ¶
type ExecInput struct {
Command string `json:"command" jsonschema:"required,description=Shell command to execute"`
WorkingDir string `json:"working_dir" jsonschema:"description=Working directory for the command"`
}
ExecInput parameters for exec tool
type ExecOutput ¶
type ExecOutput struct {
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
ExitCode int `json:"exit_code"`
}
ExecOutput result of exec tool
type GuardAction ¶ added in v0.4.0
type GuardAction string
const ( GuardAllow GuardAction = "allow" GuardDeny GuardAction = "deny" GuardRequireApproval GuardAction = "require_approval" )
type GuardFunc ¶ added in v0.4.0
type GuardFunc func(ctx context.Context, name, argsJSON string) (GuardResult, error)
type GuardResult ¶ added in v0.4.0
type GuardResult struct {
Action GuardAction
Message string
}
type InvocationContext ¶ added in v0.3.0
type InvocationContext struct {
Channel string
ChatID string
SenderID string
RequestID string
SessionID string
}
InvocationContext carries caller metadata for tool execution.
func InvocationFromContext ¶ added in v0.3.0
func InvocationFromContext(ctx context.Context) InvocationContext
InvocationFromContext reads invocation metadata from context.
type ListDirInput ¶
type ListDirInput struct {
Path string `json:"path" jsonschema:"required,description=Directory path to list"`
}
ListDirInput parameters for list_dir tool
type MessageInput ¶ added in v0.3.0
type MessageInput struct {
Content string `json:"content" jsonschema:"required,description=Message content to send"`
Channel string `json:"channel,omitempty" jsonschema:"description=Target channel (optional; defaults to current channel)"`
ChatID string `json:"chat_id,omitempty" jsonschema:"description=Target chat/session id (optional; defaults to current chat)"`
}
type ReadFileInput ¶
type ReadFileInput struct {
Path string `json:"path" jsonschema:"required,description=Absolute path to the file"`
Offset int `json:"offset" jsonschema:"description=Starting line number (0-based)"`
Limit int `json:"limit" jsonschema:"description=Maximum number of lines to read"`
}
ReadFileInput parameters for read_file tool
type ReadFileOutput ¶
ReadFileOutput result of read_file tool
type ReadMemoryInput ¶ added in v0.1.4
type ReadMemoryInput struct{}
type ReadMemoryOutput ¶ added in v0.1.4
type ReadMemoryOutput struct {
Content string `json:"content"`
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages tools by name
func (*Registry) Get ¶
func (r *Registry) Get(name string) (tool.InvokableTool, bool)
Get retrieves a tool by name
func (*Registry) GetToolInfos ¶
GetToolInfos returns all tool schemas for ChatModel binding
type SpawnInput ¶ added in v0.3.0
type SpawnInput struct {
Task string `json:"task" jsonschema:"required,description=Task to delegate to a background subagent"`
Label string `json:"label,omitempty" jsonschema:"description=Optional label for task tracking"`
Channel string `json:"channel,omitempty" jsonschema:"description=Optional origin channel override"`
ChatID string `json:"chat_id,omitempty" jsonschema:"description=Optional origin chat id override"`
}
type SubagentExecutor ¶ added in v0.3.0
type SubagentExecutor interface {
Spawn(ctx context.Context, req SubagentRequest) (string, error)
RunSync(ctx context.Context, req SubagentRequest) (string, error)
}
SubagentExecutor executes delegated subagent tasks.
type SubagentInput ¶ added in v0.3.0
type SubagentInput struct {
Task string `json:"task" jsonschema:"required,description=Task to execute via a delegated subagent"`
Label string `json:"label,omitempty" jsonschema:"description=Optional label for this delegated run"`
Channel string `json:"channel,omitempty" jsonschema:"description=Optional origin channel override"`
ChatID string `json:"chat_id,omitempty" jsonschema:"description=Optional origin chat id override"`
}
type SubagentRequest ¶ added in v0.3.0
type SubagentRequest struct {
Task string
Label string
OriginChannel string
OriginChatID string
OriginSenderID string
RequestID string
}
SubagentRequest is the normalized execution request for subagent tools.
type WebFetchInput ¶ added in v0.1.4
type WebFetchOutput ¶ added in v0.1.4
type WebSearchInput ¶ added in v0.1.4
type WebSearchOutput ¶ added in v0.1.4
type WebSearchOutput struct {
Query string `json:"query"`
Results []WebSearchResult `json:"results"`
}
type WebSearchResult ¶ added in v0.1.4
type WorkflowExecutor ¶ added in v0.5.0
type WorkflowExecutor interface {
RunWorkflow(ctx context.Context, req WorkflowRequest) (string, error)
}
WorkflowExecutor executes delegated subagent workflows.
type WorkflowInput ¶ added in v0.5.0
type WorkflowInput struct {
Goal string `json:"goal" jsonschema:"required,description=Overall workflow goal for decomposition and execution"`
Mode string `json:"mode,omitempty" jsonschema:"description=Execution mode: sequential or parallel"`
Subtasks []string `json:"subtasks,omitempty" jsonschema:"description=Optional predefined subtasks"`
Label string `json:"label,omitempty" jsonschema:"description=Optional workflow label for tracking"`
}
type WorkflowRequest ¶ added in v0.5.0
type WorkflowRequest struct {
Goal string
Mode string
Subtasks []string
Label string
OriginChannel string
OriginChatID string
OriginSenderID string
RequestID string
}
WorkflowRequest describes a structured subagent workflow run.
type WriteFileInput ¶
type WriteFileInput struct {
Path string `json:"path" jsonschema:"required,description=Absolute path to the file"`
Content string `json:"content" jsonschema:"required,description=Content to write"`
}
WriteFileInput parameters for write_file tool
type WriteMemoryInput ¶ added in v0.1.4
type WriteMemoryInput struct {
Content string `json:"content" jsonschema:"required,description=Content to store as long-term memory"`
}