Help us shape the future of Go! Take the 2026 Go Developer Survey

tools

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package tools registry.go — re-exports rysh-shared/tools types as aliases. All CLI-specific tools (bash.go, file_read.go, etc.) implement the shared ToolExecutor interface and use the shared ToolRegistry/ToolSpec/ToolOutput types.

Index

Constants

View Source
const (
	ErrKindValidation       = sharedtools.ErrKindValidation
	ErrKindMissing          = sharedtools.ErrKindMissing
	ErrKindPermissionDenied = sharedtools.ErrKindPermissionDenied
	ErrKindTimeout          = sharedtools.ErrKindTimeout
	ErrKindTransient        = sharedtools.ErrKindTransient
	ErrKindLoopBlocked      = sharedtools.ErrKindLoopBlocked
	ErrKindStaleRead        = sharedtools.ErrKindStaleRead
	ErrKindCancelled        = sharedtools.ErrKindCancelled
	ErrKindInternal         = sharedtools.ErrKindInternal
)

Re-exported error-kind constants. Same string values as the shared package's source-of-truth so the wire format is identical.

Variables

View Source
var (
	ErrOutput  = sharedtools.ErrOutput
	ErrOutputf = sharedtools.ErrOutputf
)

Re-exported helpers for typed tool errors. Follow-up item 4.

View Source
var NewBrowserActionTool = sharedtools.NewBrowserActionTool

NewBrowserActionTool re-exports the shared browser_action tool (drives a web-mode pane's embedded browser via NATS browser.request/response).

View Source
var NewChildRegistry = sharedtools.NewChildRegistry

NewChildRegistry creates a registry that reads the given parent live (own tools override). Used so per-pane/per-agent registries pick up tools enabled/disabled on the shared registry after creation.

View Source
var NewToolRegistry = sharedtools.NewToolRegistry

NewToolRegistry creates a new empty ToolRegistry.

Functions

This section is empty.

Types

type AgentsListTool

type AgentsListTool struct {
	// contains filtered or unexported fields
}

AgentsListTool lists all panes (agents) in the current session.

func NewAgentsListTool

func NewAgentsListTool(nc *nats.Conn, session string, codecs *msg.CodecRegistry) *AgentsListTool

NewAgentsListTool creates an AgentsListTool.

func (*AgentsListTool) Execute

func (t *AgentsListTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute requests a workspace snapshot and extracts pane information.

func (*AgentsListTool) RequiresApproval

func (t *AgentsListTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false — read-only.

func (*AgentsListTool) Spec

func (t *AgentsListTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type AskUserParams

type AskUserParams struct {
	Question string   `json:"question"`
	Options  []string `json:"options,omitempty"`
}

AskUserParams holds the parameters for the ask_user tool.

type AskUserTool

type AskUserTool struct {
	// contains filtered or unexported fields
}

AskUserTool asks the user a clarifying question and waits for their answer.

func NewAskUserTool

func NewAskUserTool(nc *nats.Conn, pub *msg.NATSPublisher, paneID string) *AskUserTool

NewAskUserTool creates a new AskUserTool with NATS access for the given pane.

func (*AskUserTool) Execute

func (t *AskUserTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute publishes a question to the user and waits for their answer.

func (*AskUserTool) RequiresApproval

func (t *AskUserTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false — this tool IS the user interaction.

func (*AskUserTool) Spec

func (t *AskUserTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type BackgroundSession

type BackgroundSession struct {
	ID        string
	Command   string
	WorkDir   string
	StartedAt time.Time
	Cmd       *exec.Cmd
	// contains filtered or unexported fields
}

BackgroundSession tracks a single background shell process.

type BackgroundSessionInfo

type BackgroundSessionInfo struct {
	ID        string    `json:"id"`
	Command   string    `json:"command"`
	StartedAt time.Time `json:"started_at"`
	Finished  bool      `json:"finished"`
	ExitCode  int       `json:"exit_code"`
	PID       int       `json:"pid"`
}

BackgroundSessionInfo is a serializable view of a background session.

type BackgroundSessionManager

type BackgroundSessionManager struct {
	// contains filtered or unexported fields
}

BackgroundSessionManager manages background shell sessions.

func NewBackgroundSessionManager

func NewBackgroundSessionManager() *BackgroundSessionManager

NewBackgroundSessionManager creates a new manager.

func (*BackgroundSessionManager) Cleanup

func (m *BackgroundSessionManager) Cleanup()

Cleanup kills all running sessions and clears the map.

func (*BackgroundSessionManager) Get

Get retrieves a session by ID.

func (*BackgroundSessionManager) Kill

Kill terminates a background session.

func (*BackgroundSessionManager) List

List returns info about all sessions.

func (*BackgroundSessionManager) ReadOutput

func (m *BackgroundSessionManager) ReadOutput(id string, tailBytes int) (string, bool, error)

ReadOutput returns the current output from the session's ring buffer.

func (*BackgroundSessionManager) Remove

func (m *BackgroundSessionManager) Remove(id string)

Remove removes a finished session from the manager.

func (*BackgroundSessionManager) Start

func (m *BackgroundSessionManager) Start(id, command, workDir string) error

Start launches a background bash command and returns a session ID.

type BashBackgroundParams

type BashBackgroundParams struct {
	Command string `json:"command"`
	WorkDir string `json:"work_dir,omitempty"`
}

BashBackgroundParams holds the parameters for starting a background command.

type BashBackgroundTool

type BashBackgroundTool struct {
	// contains filtered or unexported fields
}

BashBackgroundTool starts a shell command in the background.

func NewBashBackgroundTool

func NewBashBackgroundTool(workDir string, mgr *BackgroundSessionManager) *BashBackgroundTool

NewBashBackgroundTool creates a BashBackgroundTool.

func (*BashBackgroundTool) CloneTool

func (t *BashBackgroundTool) CloneTool() ToolExecutor

func (*BashBackgroundTool) Execute

func (t *BashBackgroundTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute starts the background command.

func (*BashBackgroundTool) RequiresApproval

func (t *BashBackgroundTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns true — executing commands needs approval.

func (*BashBackgroundTool) SetWorkDir

func (t *BashBackgroundTool) SetWorkDir(dir string)

func (*BashBackgroundTool) Spec

func (t *BashBackgroundTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type BashOutputParams

type BashOutputParams struct {
	SessionID string `json:"session_id"`           // session to read from; empty lists all
	TailBytes int    `json:"tail_bytes,omitempty"` // read only the last N bytes of output (default: all)
}

BashOutputParams holds the parameters for reading background output.

type BashOutputTool

type BashOutputTool struct {
	// contains filtered or unexported fields
}

BashOutputTool reads output from a background shell session.

func NewBashOutputTool

func NewBashOutputTool(mgr *BackgroundSessionManager) *BashOutputTool

NewBashOutputTool creates a BashOutputTool.

func (*BashOutputTool) Execute

func (t *BashOutputTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute reads the output or lists sessions.

func (*BashOutputTool) RequiresApproval

func (t *BashOutputTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false — read-only.

func (*BashOutputTool) Spec

func (t *BashOutputTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type BashParams

type BashParams struct {
	Command string `json:"command"`
	Timeout int    `json:"timeout,omitempty"` // ms, overrides default
	WorkDir string `json:"work_dir,omitempty"`
}

BashParams holds the parameters for a bash command execution.

type BashSessionTool

type BashSessionTool struct {
	// contains filtered or unexported fields
}

BashSessionTool unifies the former bash_output and kill_shell tools behind a single `action` switch (read | list | kill) for managing background bash sessions started by bash_background. It delegates to the underlying executors so session logic lives in one place.

func NewBashSessionTool

func NewBashSessionTool(mgr *BackgroundSessionManager) *BashSessionTool

NewBashSessionTool builds a BashSessionTool backed by the given session manager.

func (*BashSessionTool) Execute

func (t *BashSessionTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute dispatches to the output or kill executor based on `action`.

func (*BashSessionTool) RequiresApproval

func (t *BashSessionTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval is always false — session inspection/termination is low-risk and bounded to sessions this process started.

func (*BashSessionTool) Spec

func (t *BashSessionTool) Spec() ToolSpec

Spec returns the unified tool specification for the LLM.

type BashTool

type BashTool struct {
	// contains filtered or unexported fields
}

BashTool executes shell commands via bash.

func NewBashTool

func NewBashTool(workDir string, timeout time.Duration, blockedPatterns []string) *BashTool

NewBashTool creates a BashTool with the given defaults.

func (*BashTool) CloneTool

func (t *BashTool) CloneTool() ToolExecutor

func (*BashTool) Execute

func (t *BashTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute runs the bash command described by params.

func (*BashTool) RequiresApproval

func (t *BashTool) RequiresApproval(params json.RawMessage) bool

RequiresApproval gates bash with an allowlist. Order of checks:

  1. user-configured + known-dangerous patterns → always approve;
  2. redirections / command substitution → approve (can hide mutations);
  3. each chained segment must be a known-safe prefix, else approve;
  4. otherwise (all segments read-only/idempotent) → no approval.

This is intentionally safe-by-default: an unrecognised mutating command (mkdir, cp, sed -i, make, npm run, …) requires approval. Repeat prompts are absorbed by the orchestrator's auto-approval ("yes, always") and any configured PermissionPolicy.

func (*BashTool) SetWorkDir

func (t *BashTool) SetWorkDir(dir string)

func (*BashTool) Spec

func (t *BashTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type BrowserActionPublisher

type BrowserActionPublisher = sharedtools.BrowserActionPublisher

BrowserActionPublisher is the publisher interface the browser_action tool needs.

type ClipboardParams

type ClipboardParams struct {
	Action  string `json:"action"`            // "read" or "write"
	Content string `json:"content,omitempty"` // content to write (required for action=write)
}

ClipboardParams holds the parameters for clipboard operations.

type ClipboardTool

type ClipboardTool struct{}

ClipboardTool reads from and writes to the system clipboard.

func NewClipboardTool

func NewClipboardTool() *ClipboardTool

NewClipboardTool creates a new ClipboardTool.

func (*ClipboardTool) Execute

func (t *ClipboardTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute performs the clipboard operation.

func (*ClipboardTool) RequiresApproval

func (t *ClipboardTool) RequiresApproval(params json.RawMessage) bool

RequiresApproval returns true for write operations.

func (*ClipboardTool) Spec

func (t *ClipboardTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type ContextRecallParams

type ContextRecallParams struct {
	Key    string `json:"key,omitempty"`    // specific key to recall
	Prefix string `json:"prefix,omitempty"` // list keys with this prefix
	List   bool   `json:"list,omitempty"`   // list all keys
}

ContextRecallParams holds the parameters for recalling context.

type ContextRecallTool

type ContextRecallTool struct {
	// contains filtered or unexported fields
}

ContextRecallTool retrieves values from the context KV store.

func NewContextRecallTool

func NewContextRecallTool(js nats.JetStreamContext) *ContextRecallTool

NewContextRecallTool creates a ContextRecallTool with the given JetStream context.

func (*ContextRecallTool) Execute

func (t *ContextRecallTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute retrieves the requested context.

func (*ContextRecallTool) RequiresApproval

func (t *ContextRecallTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false — read-only.

func (*ContextRecallTool) Spec

func (t *ContextRecallTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type ContextStoreParams

type ContextStoreParams struct {
	Key   string `json:"key"`   // key name (alphanumeric, dots, dashes, underscores)
	Value string `json:"value"` // value to store
}

ContextStoreParams holds the parameters for storing context.

type ContextStoreTool

type ContextStoreTool struct {
	// contains filtered or unexported fields
}

ContextStoreTool stores key-value pairs in JetStream KV for cross-turn persistence.

func NewContextStoreTool

func NewContextStoreTool(js nats.JetStreamContext) *ContextStoreTool

NewContextStoreTool creates a ContextStoreTool with the given JetStream context.

func (*ContextStoreTool) Execute

func (t *ContextStoreTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute stores the key-value pair.

func (*ContextStoreTool) RequiresApproval

func (t *ContextStoreTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false.

func (*ContextStoreTool) Spec

func (t *ContextStoreTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type ContextTool

type ContextTool struct {
	// contains filtered or unexported fields
}

ContextTool unifies the former context_store and context_recall tools behind a single `action` switch (store | recall | list). It delegates to the underlying executors so the persistence logic lives in one place.

func NewContextTool

func NewContextTool(js nats.JetStreamContext) *ContextTool

NewContextTool builds a ContextTool backed by the given JetStream context.

func (*ContextTool) Execute

func (t *ContextTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute dispatches to the store or recall executor based on `action`.

func (*ContextTool) RequiresApproval

func (t *ContextTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval is always false — context storage is non-destructive.

func (*ContextTool) Spec

func (t *ContextTool) Spec() ToolSpec

Spec returns the unified tool specification for the LLM.

type EditPair

type EditPair struct {
	OldString string `json:"old_string"`
	NewString string `json:"new_string"`
}

EditPair is a single old→new replacement. (Moved here from the retired multi_edit.go so the edits-array form keeps its schema.)

type EditParams

type EditParams struct {
	FilePath  string     `json:"file_path"`
	OldString string     `json:"old_string,omitempty"` // single-edit convenience form
	NewString string     `json:"new_string,omitempty"`
	Edits     []EditPair `json:"edits,omitempty"` // multi-edit (atomic) form
}

EditParams accepts both the single-edit and multi-edit shapes.

type EditTool

type EditTool struct {
	// contains filtered or unexported fields
}

EditTool performs exact-string replacement(s) in a single existing file.

It supersedes the former file_edit (single replace) and multi_edit (atomic multi-hunk) tools: callers pass either a single old_string/new_string pair, OR an ordered `edits` array applied atomically (all-or-nothing). The two input shapes share one code path. To create or overwrite a whole file use file_write instead.

func NewEditTool

func NewEditTool(workDir string) *EditTool

NewEditTool creates an EditTool rooted at the given working directory.

func (*EditTool) CloneTool

func (t *EditTool) CloneTool() ToolExecutor

func (*EditTool) Execute

func (t *EditTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute applies all edits in memory (rolling back on any failure) and writes the result, returning a unified diff of the combined change.

func (*EditTool) RequiresApproval

func (t *EditTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns true — file modifications go through the orchestrator's preview-then-approve flow.

func (*EditTool) SetWorkDir

func (t *EditTool) SetWorkDir(dir string)

func (*EditTool) Spec

func (t *EditTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type EmailAttachParams

type EmailAttachParams struct {
	DraftID  string `json:"draft_id"`
	FilePath string `json:"file_path"`
}

EmailAttachParams holds the parameters for the email_attach tool.

type EmailAttachTool

type EmailAttachTool struct {
	// contains filtered or unexported fields
}

EmailAttachTool adds a file attachment to an existing email draft.

func NewEmailAttachTool

func NewEmailAttachTool(drafts *channels.DraftStore) *EmailAttachTool

NewEmailAttachTool creates a new EmailAttachTool.

func (*EmailAttachTool) Execute

func (t *EmailAttachTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute reads a file and attaches it to an existing draft.

func (*EmailAttachTool) RequiresApproval

func (t *EmailAttachTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns false — attaching a file does not send anything.

func (*EmailAttachTool) Spec

func (t *EmailAttachTool) Spec() ToolSpec

Spec returns the tool specification.

type EmailDraftParams

type EmailDraftParams struct {
	To        string `json:"to"`
	Subject   string `json:"subject"`
	Body      string `json:"body"`
	InReplyTo string `json:"in_reply_to"`
}

EmailDraftParams holds the parameters for the email_draft tool.

type EmailDraftTool

type EmailDraftTool struct {
	// contains filtered or unexported fields
}

EmailDraftTool creates an email draft for review before sending.

func NewEmailDraftTool

func NewEmailDraftTool(drafts *channels.DraftStore) *EmailDraftTool

NewEmailDraftTool creates a new EmailDraftTool.

func (*EmailDraftTool) Execute

func (t *EmailDraftTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute creates a new email draft.

func (*EmailDraftTool) RequiresApproval

func (t *EmailDraftTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns false — creating a draft does not send anything.

func (*EmailDraftTool) Spec

func (t *EmailDraftTool) Spec() ToolSpec

Spec returns the tool specification.

type EmailListParams

type EmailListParams struct {
	Count  int    `json:"count"`
	Search string `json:"search"`
}

EmailListParams holds the parameters for the email_list tool.

type EmailListTool

type EmailListTool struct {
	// contains filtered or unexported fields
}

EmailListTool lists recent emails from an IMAP inbox.

func NewEmailListTool

func NewEmailListTool(adapter *channels.EmailAdapter) *EmailListTool

NewEmailListTool creates a new EmailListTool.

func (*EmailListTool) Execute

func (t *EmailListTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute lists recent emails from the inbox.

func (*EmailListTool) RequiresApproval

func (t *EmailListTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns false — listing emails is read-only.

func (*EmailListTool) Spec

func (t *EmailListTool) Spec() ToolSpec

Spec returns the tool specification.

type EmailReadParams

type EmailReadParams struct {
	ID  string `json:"id"`
	UID int    `json:"uid"`
}

EmailReadParams holds the parameters for the email_read tool. Prefer id (the short handle from email_list); uid is accepted as a fallback.

type EmailReadTool

type EmailReadTool struct {
	// contains filtered or unexported fields
}

EmailReadTool reads the full content of a single email by UID.

func NewEmailReadTool

func NewEmailReadTool(adapter *channels.EmailAdapter) *EmailReadTool

NewEmailReadTool creates a new EmailReadTool.

func (*EmailReadTool) Execute

func (t *EmailReadTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute reads a single email by UID.

func (*EmailReadTool) RequiresApproval

func (t *EmailReadTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns false — reading emails is read-only.

func (*EmailReadTool) Spec

func (t *EmailReadTool) Spec() ToolSpec

Spec returns the tool specification.

type EmailSendParams

type EmailSendParams struct {
	DraftID string `json:"draft_id"`
	// Direct send fields (used when draft_id is not provided).
	To        string `json:"to"`
	Subject   string `json:"subject"`
	Body      string `json:"body"`
	InReplyTo string `json:"in_reply_to"`
}

EmailSendParams holds the parameters for the email_send tool.

type EmailSendTool

type EmailSendTool struct {
	// contains filtered or unexported fields
}

EmailSendTool sends an email either from a draft or directly.

func NewEmailSendTool

func NewEmailSendTool(
	adapter *channels.EmailAdapter,
	drafts *channels.DraftStore,
	humanGoverned func() bool,
) *EmailSendTool

NewEmailSendTool creates a new EmailSendTool.

humanGoverned may be nil (never gated). When it reports true, Execute refuses anything but an owner-approved draft — see requireApprovedDraft.

func (*EmailSendTool) Execute

func (t *EmailSendTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute sends an email.

func (*EmailSendTool) RequiresApproval

func (t *EmailSendTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns true — sending email is a side-effecting operation.

func (*EmailSendTool) Spec

func (t *EmailSendTool) Spec() ToolSpec

Spec returns the tool specification.

type EnvReadParams

type EnvReadParams struct {
	Name   string `json:"name,omitempty"`   // specific variable name
	Prefix string `json:"prefix,omitempty"` // filter by prefix (e.g., "RYSH_", "AWS_")
	All    bool   `json:"all,omitempty"`    // list all variables (names only, not values)
}

EnvReadParams holds the parameters for reading env vars.

type EnvReadTool

type EnvReadTool struct{}

EnvReadTool reads environment variables safely.

func NewEnvReadTool

func NewEnvReadTool() *EnvReadTool

NewEnvReadTool creates a new EnvReadTool.

func (*EnvReadTool) Execute

func (t *EnvReadTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute reads environment variables.

func (*EnvReadTool) RequiresApproval

func (t *EnvReadTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false — read-only, with redaction.

func (*EnvReadTool) Spec

func (t *EnvReadTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type FileReadParams

type FileReadParams struct {
	FilePath string `json:"file_path"`
	Offset   int    `json:"offset,omitempty"` // line number to start from (0-based)
	Limit    int    `json:"limit,omitempty"`  // max lines to read (default 2000)
}

FileReadParams holds the parameters for reading a file.

type FileReadTool

type FileReadTool struct {
	// contains filtered or unexported fields
}

FileReadTool reads file contents with optional offset and limit.

func NewFileReadTool

func NewFileReadTool(workDir string) *FileReadTool

NewFileReadTool creates a FileReadTool with the given working directory.

func (*FileReadTool) CloneTool

func (t *FileReadTool) CloneTool() ToolExecutor

func (*FileReadTool) Execute

func (t *FileReadTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute reads the file described by params.

func (*FileReadTool) RequiresApproval

func (t *FileReadTool) RequiresApproval(params json.RawMessage) bool

RequiresApproval always returns false for read-only operations.

func (*FileReadTool) SetWorkDir

func (t *FileReadTool) SetWorkDir(dir string)

func (*FileReadTool) Spec

func (t *FileReadTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type FileWriteParams

type FileWriteParams struct {
	FilePath string `json:"file_path"`
	Content  string `json:"content"`
}

FileWriteParams holds the parameters for a file write operation.

type FileWriteTool

type FileWriteTool struct {
	// contains filtered or unexported fields
}

FileWriteTool creates or overwrites files.

func NewFileWriteTool

func NewFileWriteTool(workDir string) *FileWriteTool

NewFileWriteTool creates a FileWriteTool rooted at the given working directory.

func (*FileWriteTool) CloneTool

func (t *FileWriteTool) CloneTool() ToolExecutor

func (*FileWriteTool) Execute

func (t *FileWriteTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute writes the content to the specified file and returns a unified diff.

func (*FileWriteTool) RequiresApproval

func (t *FileWriteTool) RequiresApproval(params json.RawMessage) bool

RequiresApproval always returns true because file modifications need approval.

func (*FileWriteTool) SetWorkDir

func (t *FileWriteTool) SetWorkDir(dir string)

func (*FileWriteTool) Spec

func (t *FileWriteTool) Spec() ToolSpec

Spec returns the tool specification for file_write.

type ForgedAPIProxy

type ForgedAPIProxy struct {
	// contains filtered or unexported fields
}

ForgedAPIProxy is a subscriber-side stand-in for one of a remote owner's forged-API operations (Task 2). The subscriber's agent sees it as a normal tool; calling it forwards an `invoke_op` request to the owner, who runs the real operation and returns a (redacted) result.

  • phase 2a / inert (invoke == nil): registration and discovery work end-to-end (the op appears in the subscriber pane's tool list) but Execute returns a "discovery-only" message instead of performing a remote call.
  • phase 2b / active (invoke != nil): Execute delegates to the invoke callback, which performs the remote round-trip. The callback is supplied by the PaneActor and carries the NATS plumbing, so this package stays free of any NATS / message dependency.

There is no per-call approval for shared forged APIs (the owner's allow-list is the gate), so RequiresApproval always returns false.

func NewForgedAPIProxy

func NewForgedAPIProxy(shareID, name, description, schema string, mutating bool, invoke func(ctx context.Context, op string, args json.RawMessage) (*ToolOutput, error)) *ForgedAPIProxy

NewForgedAPIProxy builds an active (phase 2b) proxy for one shared op. Passing a nil invoke yields the inert (phase 2a) behaviour; prefer NewInertForgedAPIProxy for that to make the intent explicit.

func NewInertForgedAPIProxy

func NewInertForgedAPIProxy(shareID, name, description, schema string, mutating bool) *ForgedAPIProxy

NewInertForgedAPIProxy builds a phase-2a (inert) proxy for one shared op.

func (*ForgedAPIProxy) Execute

func (p *ForgedAPIProxy) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute delegates to the remote invoke callback, or returns a discovery-only message when inert.

func (*ForgedAPIProxy) RequiresApproval

func (p *ForgedAPIProxy) RequiresApproval(json.RawMessage) bool

RequiresApproval is always false — shared forged APIs have no per-call approval.

func (*ForgedAPIProxy) Spec

func (p *ForgedAPIProxy) Spec() ToolSpec

Spec returns the forwarded operation spec.

type GitCommitParams

type GitCommitParams struct {
	Message string   `json:"message"`         // commit message
	Files   []string `json:"files,omitempty"` // specific files to stage; empty = stage all tracked changes
	All     bool     `json:"all,omitempty"`   // stage all modified and deleted files (-a)
}

GitCommitParams holds the parameters for git commit.

type GitCommitTool

type GitCommitTool struct {
	// contains filtered or unexported fields
}

GitCommitTool stages files and creates a commit.

func NewGitCommitTool

func NewGitCommitTool(workDir string) *GitCommitTool

NewGitCommitTool creates a GitCommitTool with the given working directory.

func (*GitCommitTool) CloneTool

func (t *GitCommitTool) CloneTool() ToolExecutor

func (*GitCommitTool) Execute

func (t *GitCommitTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute stages files and creates a commit.

func (*GitCommitTool) RequiresApproval

func (t *GitCommitTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns true — commits are significant operations.

func (*GitCommitTool) SetWorkDir

func (t *GitCommitTool) SetWorkDir(dir string)

func (*GitCommitTool) Spec

func (t *GitCommitTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type GlobParams

type GlobParams struct {
	Pattern string `json:"pattern"`        // e.g., "**/*.go", "src/**/*.ts"
	Path    string `json:"path,omitempty"` // base directory, defaults to workDir
}

GlobParams holds the parameters for glob matching.

type GlobTool

type GlobTool struct {
	// contains filtered or unexported fields
}

GlobTool finds files matching a glob pattern.

func NewGlobTool

func NewGlobTool(workDir string) *GlobTool

NewGlobTool creates a GlobTool with the given working directory.

func (*GlobTool) CloneTool

func (t *GlobTool) CloneTool() ToolExecutor

func (*GlobTool) Execute

func (t *GlobTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute performs the glob matching described by params.

func (*GlobTool) RequiresApproval

func (t *GlobTool) RequiresApproval(params json.RawMessage) bool

RequiresApproval always returns false for read-only operations.

func (*GlobTool) SetWorkDir

func (t *GlobTool) SetWorkDir(dir string)

func (*GlobTool) Spec

func (t *GlobTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type GrepParams

type GrepParams struct {
	Pattern    string `json:"pattern"`               // regex pattern
	Path       string `json:"path,omitempty"`        // file or directory to search
	Glob       string `json:"glob,omitempty"`        // filter files by glob (e.g., "*.go")
	OutputMode string `json:"output_mode,omitempty"` // "content", "files_with_matches", "count"
	Context    int    `json:"context,omitempty"`     // lines of context around matches
}

GrepParams holds the parameters for grep searching.

type GrepTool

type GrepTool struct {
	// contains filtered or unexported fields
}

GrepTool searches file contents using regular expressions.

func NewGrepTool

func NewGrepTool(workDir string) *GrepTool

NewGrepTool creates a GrepTool with the given working directory.

func (*GrepTool) CloneTool

func (t *GrepTool) CloneTool() ToolExecutor

func (*GrepTool) Execute

func (t *GrepTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute performs the grep search described by params.

func (*GrepTool) RequiresApproval

func (t *GrepTool) RequiresApproval(params json.RawMessage) bool

RequiresApproval always returns false for read-only operations.

func (*GrepTool) SetWorkDir

func (t *GrepTool) SetWorkDir(dir string)

func (*GrepTool) Spec

func (t *GrepTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type GroundingReportTool

type GroundingReportTool struct{}

GroundingReportTool exposes the schema for the grounding_report tool. The tool itself is SPECIAL: OrchestratorActor (rysh-shared/agentic) intercepts tool calls named "grounding_report" before normal dispatch and routes them to its own handleGroundingReport method — declaring understanding opens the enforced grounding gate; declaring a question pauses the run until the user answers.

As with sub_agent, the Execute method below is effectively unreachable in the production flow; it is kept as a defensive fallback for direct registry calls.

func NewGroundingReportTool

func NewGroundingReportTool() *GroundingReportTool

NewGroundingReportTool creates a new GroundingReportTool.

func (*GroundingReportTool) Execute

Execute is a defensive no-op. In normal operation OrchestratorActor intercepts the tool name "grounding_report" and never invokes this method.

func (*GroundingReportTool) RequiresApproval

func (t *GroundingReportTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval is false: declaring understanding or asking a question is never destructive.

func (*GroundingReportTool) Spec

func (t *GroundingReportTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type KillShellParams

type KillShellParams struct {
	SessionID string `json:"session_id"`
}

KillShellParams holds the parameters for killing a background session.

type KillShellTool

type KillShellTool struct {
	// contains filtered or unexported fields
}

KillShellTool terminates a background shell session.

func NewKillShellTool

func NewKillShellTool(mgr *BackgroundSessionManager) *KillShellTool

NewKillShellTool creates a KillShellTool.

func (*KillShellTool) Execute

func (t *KillShellTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute kills the background session.

func (*KillShellTool) RequiresApproval

func (t *KillShellTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns true — killing processes is significant.

func (*KillShellTool) Spec

func (t *KillShellTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type ListToolsTool

type ListToolsTool struct {
	// contains filtered or unexported fields
}

ListToolsTool lists all available tools and their descriptions.

func NewListToolsTool

func NewListToolsTool(registry *ToolRegistry) *ListToolsTool

NewListToolsTool creates a new ListToolsTool that references the given registry.

func (*ListToolsTool) Execute

func (t *ListToolsTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute returns a formatted list of all registered tools.

func (*ListToolsTool) RequiresApproval

func (t *ListToolsTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false for list_tools.

func (*ListToolsTool) Spec

func (t *ListToolsTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type MemoryEditParams

type MemoryEditParams struct {
	Action  string `json:"action"`            // "read", "append", "write"
	Content string `json:"content,omitempty"` // content for append/write
	Section string `json:"section,omitempty"` // optional heading for append
}

MemoryEditParams holds the parameters for memory operations.

type MemoryEditTool

type MemoryEditTool struct {
	// contains filtered or unexported fields
}

MemoryEditTool lets the assistant persist durable facts (project conventions, user preferences, decisions) to the project memory file RYSH.md. Unlike the ephemeral context_store KV, this file is committed and auto-loaded into the system prompt on every session.

func NewMemoryEditTool

func NewMemoryEditTool(workDir string) *MemoryEditTool

NewMemoryEditTool creates a MemoryEditTool rooted at workDir.

func (*MemoryEditTool) CloneTool

func (t *MemoryEditTool) CloneTool() ToolExecutor

func (*MemoryEditTool) Execute

func (t *MemoryEditTool) Execute(_ context.Context, params json.RawMessage) (*ToolOutput, error)

Execute performs the memory operation.

func (*MemoryEditTool) RequiresApproval

func (t *MemoryEditTool) RequiresApproval(params json.RawMessage) bool

RequiresApproval asks for confirmation before replacing the whole file; appends and reads are allowed without approval.

func (*MemoryEditTool) SetWorkDir

func (t *MemoryEditTool) SetWorkDir(dir string)

func (*MemoryEditTool) Spec

func (t *MemoryEditTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type MonitorParams

type MonitorParams struct {
	Command  string `json:"command"`
	Duration int    `json:"duration,omitempty"` // seconds, default 10, max 60
	Pattern  string `json:"pattern,omitempty"`  // regex to filter output lines
}

MonitorParams holds the parameters for the monitor tool.

type MonitorTool

type MonitorTool struct {
	// contains filtered or unexported fields
}

MonitorTool runs a background command and returns output lines.

func NewMonitorTool

func NewMonitorTool(workDir string) *MonitorTool

NewMonitorTool creates a MonitorTool with the given working directory.

func (*MonitorTool) CloneTool

func (t *MonitorTool) CloneTool() ToolExecutor

func (*MonitorTool) Execute

func (t *MonitorTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute runs the command and collects output for the specified duration.

func (*MonitorTool) RequiresApproval

func (t *MonitorTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns true since this tool executes commands.

func (*MonitorTool) SetWorkDir

func (t *MonitorTool) SetWorkDir(dir string)

func (*MonitorTool) Spec

func (t *MonitorTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type PaneInspectParams

type PaneInspectParams struct {
	PaneID    string `json:"pane_id"`              // target pane ID
	TailLines int    `json:"tail_lines,omitempty"` // number of lines from the end (default 50)
}

PaneInspectParams holds the parameters for inspecting a pane.

type PaneInspectTool

type PaneInspectTool struct {
	// contains filtered or unexported fields
}

PaneInspectTool reads another pane's output buffer or status.

func NewPaneInspectTool

func NewPaneInspectTool(nc *nats.Conn, session string) *PaneInspectTool

NewPaneInspectTool creates a PaneInspectTool.

func (*PaneInspectTool) Execute

func (t *PaneInspectTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute requests a snapshot from the target pane via NATS.

func (*PaneInspectTool) RequiresApproval

func (t *PaneInspectTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false — read-only.

func (*PaneInspectTool) Spec

func (t *PaneInspectTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type PaneSendParams

type PaneSendParams struct {
	PaneID string `json:"pane_id"`        // target pane ID
	Input  string `json:"input"`          // command or prompt text
	Mode   string `json:"mode,omitempty"` // "shell" or "prompt" (default: uses the pane's current mode)
}

PaneSendParams holds the parameters for sending to a pane.

type PaneSendTool

type PaneSendTool struct {
	// contains filtered or unexported fields
}

PaneSendTool sends a command or prompt to another pane.

func NewPaneSendTool

func NewPaneSendTool(nc *nats.Conn, session string) *PaneSendTool

NewPaneSendTool creates a PaneSendTool.

func (*PaneSendTool) Execute

func (t *PaneSendTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute sends input to the target pane via NATS.

func (*PaneSendTool) RequiresApproval

func (t *PaneSendTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns true — sending input to other panes is a significant action.

func (*PaneSendTool) Spec

func (t *PaneSendTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type ProjectNotesParams

type ProjectNotesParams struct {
	Action  string `json:"action"`            // "read", "append", "write", "clear"
	Content string `json:"content,omitempty"` // content for append/write
	Section string `json:"section,omitempty"` // section heading for append
}

ProjectNotesParams holds the parameters for project notes operations.

type ProjectNotesTool

type ProjectNotesTool struct {
	// contains filtered or unexported fields
}

ProjectNotesTool manages project-level notes shared across panes.

func NewProjectNotesTool

func NewProjectNotesTool(workDir string) *ProjectNotesTool

NewProjectNotesTool creates a ProjectNotesTool with the given working directory.

func (*ProjectNotesTool) CloneTool

func (t *ProjectNotesTool) CloneTool() ToolExecutor

func (*ProjectNotesTool) Execute

func (t *ProjectNotesTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute performs the notes operation.

func (*ProjectNotesTool) RequiresApproval

func (t *ProjectNotesTool) RequiresApproval(params json.RawMessage) bool

RequiresApproval returns true for write/append/clear actions.

func (*ProjectNotesTool) SetWorkDir

func (t *ProjectNotesTool) SetWorkDir(dir string)

func (*ProjectNotesTool) Spec

func (t *ProjectNotesTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type RyshBuildPipelineTool

type RyshBuildPipelineTool struct {
	// contains filtered or unexported fields
}

RyshBuildPipelineTool parses .rysh/pipelines/*.rysh.yaml files and registers the resulting prompts into the pipeline overlay so that softdev events can trigger them.

func NewRyshBuildPipelineTool

func NewRyshBuildPipelineTool(workDir string, plKV nats.KeyValue) *RyshBuildPipelineTool

NewRyshBuildPipelineTool creates a RyshBuildPipelineTool rooted at workDir.

func (*RyshBuildPipelineTool) CloneTool

func (t *RyshBuildPipelineTool) CloneTool() ToolExecutor

func (*RyshBuildPipelineTool) Execute

func (t *RyshBuildPipelineTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute parses the pipeline YAML(s), builds augmented prompts, and registers them in the pipeline overlay.

func (*RyshBuildPipelineTool) RequiresApproval

func (t *RyshBuildPipelineTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false.

func (*RyshBuildPipelineTool) SetWorkDir

func (t *RyshBuildPipelineTool) SetWorkDir(dir string)

func (*RyshBuildPipelineTool) Spec

func (t *RyshBuildPipelineTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type RyshCommandParams

type RyshCommandParams struct {
	// Command is the command body, with or without the leading "##"
	// (e.g. "tab list", "##pane new", "agent list").
	Command string `json:"command"`
	// PaneID optionally pins where the command runs and whose rysh output is
	// read back. Defaults to the caller's pane.
	PaneID string `json:"pane_id,omitempty"`
}

RyshCommandParams holds the parameters for a rysh system command.

type RyshCommandTool

type RyshCommandTool struct {
	// contains filtered or unexported fields
}

RyshCommandTool executes a rysh system command via the WorkspaceActor and returns the command's output.

func NewRyshCommandTool

func NewRyshCommandTool(nc *nats.Conn, session, defaultPaneID string) *RyshCommandTool

NewRyshCommandTool creates a RyshCommandTool. defaultPaneID is the pane the command targets when the model does not name one — for a humanoid this is its chat output pane.

func (*RyshCommandTool) Execute

func (t *RyshCommandTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute publishes the command through the WorkspaceActor and collects the resulting rysh output.

func (*RyshCommandTool) RequiresApproval

func (t *RyshCommandTool) RequiresApproval(params json.RawMessage) bool

RequiresApproval is an allowlist: read-only/idempotent rysh commands run unprompted, everything else (including anything unrecognised) requires confirmation. Safe-by-default, matching BashTool's discipline.

func (*RyshCommandTool) Spec

func (t *RyshCommandTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type SessionHistoryParams

type SessionHistoryParams struct {
	PaneID string `json:"pane_id"`          // target pane ID
	LastN  int    `json:"last_n,omitempty"` // number of recent turns to retrieve (default 20)
}

SessionHistoryParams holds the parameters for requesting conversation history.

type SessionHistoryTool

type SessionHistoryTool struct {
	// contains filtered or unexported fields
}

SessionHistoryTool retrieves the conversation transcript from another pane's LLMPromptExecutionActor.

func NewSessionHistoryTool

func NewSessionHistoryTool(nc *nats.Conn, session string) *SessionHistoryTool

NewSessionHistoryTool creates a SessionHistoryTool.

func (*SessionHistoryTool) Execute

func (t *SessionHistoryTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute requests the conversation history from the target pane's LLMPromptExecutionActor.

func (*SessionHistoryTool) RequiresApproval

func (t *SessionHistoryTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false — read-only.

func (*SessionHistoryTool) Spec

func (t *SessionHistoryTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type SlackDraftParams

type SlackDraftParams struct {
	Channel  string `json:"channel"`
	ThreadTS string `json:"thread_ts"`
	Body     string `json:"body"`
}

SlackDraftParams holds the parameters for the slack_draft tool.

type SlackDraftTool

type SlackDraftTool struct {
	// contains filtered or unexported fields
}

SlackDraftTool creates a Slack reply draft for human review before sending. It reuses the shared DraftStore (To = channel ID, InReplyTo = thread_ts, Body = message text; Subject is unused for Slack).

func NewSlackDraftTool

func NewSlackDraftTool(drafts *channels.DraftStore) *SlackDraftTool

NewSlackDraftTool creates a new SlackDraftTool.

func (*SlackDraftTool) Execute

func (t *SlackDraftTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute creates a new Slack reply draft.

func (*SlackDraftTool) RequiresApproval

func (t *SlackDraftTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns false — creating a draft does not post anything.

func (*SlackDraftTool) Spec

func (t *SlackDraftTool) Spec() ToolSpec

Spec returns the tool specification.

type SlackListParams

type SlackListParams struct {
	Count int `json:"count"`
}

SlackListParams holds the parameters for the slack_list tool.

type SlackListTool

type SlackListTool struct {
	// contains filtered or unexported fields
}

SlackListTool lists recent inbound Slack messages from the adapter's in-memory history (populated by the Socket Mode event loop).

func NewSlackListTool

func NewSlackListTool(adapter *channels.SlackAdapter) *SlackListTool

NewSlackListTool creates a new SlackListTool.

func (*SlackListTool) Execute

func (t *SlackListTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute lists recent inbound Slack messages.

func (*SlackListTool) RequiresApproval

func (t *SlackListTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns false — listing messages is read-only.

func (*SlackListTool) Spec

func (t *SlackListTool) Spec() ToolSpec

Spec returns the tool specification.

type SlackReadParams

type SlackReadParams struct {
	ID string `json:"id"`
}

SlackReadParams holds the parameters for the slack_read tool.

type SlackReadTool

type SlackReadTool struct {
	// contains filtered or unexported fields
}

SlackReadTool returns the full content of a received Slack message.

func NewSlackReadTool

func NewSlackReadTool(adapter *channels.SlackAdapter) *SlackReadTool

NewSlackReadTool creates a new SlackReadTool.

func (*SlackReadTool) Execute

func (t *SlackReadTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute returns the full content of a received Slack message.

func (*SlackReadTool) RequiresApproval

func (t *SlackReadTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns false — reading a message is read-only.

func (*SlackReadTool) Spec

func (t *SlackReadTool) Spec() ToolSpec

Spec returns the tool specification.

type SlackSendParams

type SlackSendParams struct {
	DraftID string `json:"draft_id"`
	// Direct send fields (used when draft_id is not provided).
	Channel  string `json:"channel"`
	ThreadTS string `json:"thread_ts"`
	Body     string `json:"body"`
}

SlackSendParams holds the parameters for the slack_send tool.

type SlackSendTool

type SlackSendTool struct {
	// contains filtered or unexported fields
}

SlackSendTool posts a Slack message, either from a draft or directly.

func NewSlackSendTool

func NewSlackSendTool(
	adapter *channels.SlackAdapter,
	drafts *channels.DraftStore,
	humanGoverned func() bool,
) *SlackSendTool

NewSlackSendTool creates a new SlackSendTool.

humanGoverned may be nil (never gated). When it reports true, Execute refuses anything but an owner-approved draft — see the gate in Execute.

func (*SlackSendTool) Execute

func (t *SlackSendTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute posts a Slack message.

func (*SlackSendTool) RequiresApproval

func (t *SlackSendTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns true — posting a message is a side-effecting operation.

func (*SlackSendTool) Spec

func (t *SlackSendTool) Spec() ToolSpec

Spec returns the tool specification.

type SubAgentParams

type SubAgentParams struct {
	Task         string   `json:"task"`
	Context      string   `json:"context,omitempty"`
	SystemPrompt string   `json:"system_prompt,omitempty"`
	AllowedTools []string `json:"allowed_tools,omitempty"`
}

SubAgentParams documents the tool inputs. The shape mirrors agentic.SubAgentParams in rysh-shared so the orchestrator can parse the same JSON directly.

type SubAgentTool

type SubAgentTool struct{}

SubAgentTool exposes the schema for the sub_agent tool. The tool itself is SPECIAL: OrchestratorActor (rysh-shared/agentic) intercepts tool calls named "sub_agent" before normal dispatch and routes them to its own handleSubAgent method, which spawns a child OrchestratorActor with its own context window and returns only the child's summary to the parent.

As a result, the Execute method below is effectively unreachable in the production flow. It is kept as a defensive fallback so direct unit-testing of the registry (or a hypothetical caller that bypasses the orchestrator) receives a clear diagnostic instead of nil-dereferencing.

func NewSubAgentTool

func NewSubAgentTool() *SubAgentTool

NewSubAgentTool creates a new SubAgentTool.

func (*SubAgentTool) Execute

func (t *SubAgentTool) Execute(_ context.Context, params json.RawMessage) (*ToolOutput, error)

Execute is a defensive no-op. In normal operation OrchestratorActor intercepts the tool name "sub_agent" and never invokes this method. If it IS reached (direct registry call), surface a clear diagnostic so the caller understands the wiring.

func (*SubAgentTool) RequiresApproval

func (t *SubAgentTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval is false: spawning a focused child agent is not itself destructive; the child's own destructive tool calls go through the normal approval flow.

func (*SubAgentTool) Spec

func (t *SubAgentTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

Description guidance: the model is told this delegates to a focused child agent with its own context, that only the summary is returned, and that nested sub_agent calls are depth-limited.

type SymbolSearchParams

type SymbolSearchParams struct {
	Query    string `json:"query"`              // symbol name or pattern to search for
	Kind     string `json:"kind,omitempty"`     // "function", "type", "const", "var", "all" (default: "all")
	Language string `json:"language,omitempty"` // "go", "python", "javascript", "typescript", "rust" (auto-detect if empty)
	Path     string `json:"path,omitempty"`     // restrict search to this path
}

SymbolSearchParams holds the parameters for symbol search.

type SymbolSearchTool

type SymbolSearchTool struct {
	// contains filtered or unexported fields
}

SymbolSearchTool finds function, type, and variable declarations by name.

func NewSymbolSearchTool

func NewSymbolSearchTool(workDir string) *SymbolSearchTool

NewSymbolSearchTool creates a SymbolSearchTool with the given working directory.

func (*SymbolSearchTool) CloneTool

func (t *SymbolSearchTool) CloneTool() ToolExecutor

func (*SymbolSearchTool) Execute

func (t *SymbolSearchTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute searches for symbols matching the query.

func (*SymbolSearchTool) RequiresApproval

func (t *SymbolSearchTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false — read-only operation.

func (*SymbolSearchTool) SetWorkDir

func (t *SymbolSearchTool) SetWorkDir(dir string)

func (*SymbolSearchTool) Spec

func (t *SymbolSearchTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type TestRunParams

type TestRunParams struct {
	Path    string `json:"path,omitempty"`    // test path/package (e.g., "./...", "./internal/tools/")
	Pattern string `json:"pattern,omitempty"` // test name pattern (-run)
	Verbose bool   `json:"verbose,omitempty"` // verbose output (-v)
	Short   bool   `json:"short,omitempty"`   // run short tests only (-short)
	Count   int    `json:"count,omitempty"`   // run tests N times (-count)
}

TestRunParams holds the parameters for running tests.

type TestRunTool

type TestRunTool struct {
	// contains filtered or unexported fields
}

TestRunTool runs tests and returns structured results.

func NewTestRunTool

func NewTestRunTool(workDir string) *TestRunTool

NewTestRunTool creates a TestRunTool with the given working directory.

func (*TestRunTool) CloneTool

func (t *TestRunTool) CloneTool() ToolExecutor

func (*TestRunTool) Execute

func (t *TestRunTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute runs the tests and returns structured output.

func (*TestRunTool) RequiresApproval

func (t *TestRunTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns true — tests execute code.

func (*TestRunTool) SetWorkDir

func (t *TestRunTool) SetWorkDir(dir string)

func (*TestRunTool) Spec

func (t *TestRunTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type TodoItem

type TodoItem struct {
	ID        string     `json:"id"`
	Text      string     `json:"text"`
	Status    TodoStatus `json:"status"`
	CreatedAt string     `json:"created_at"`
	UpdatedAt string     `json:"updated_at"`
}

TodoItem is a single task entry.

type TodoList

type TodoList struct {
	Items []TodoItem `json:"items"`
}

TodoList is the persisted todo state for a pane.

type TodoParams

type TodoParams struct {
	Action string `json:"action"`           // "list", "add", "update", "complete", "remove", "clear"
	ID     string `json:"id,omitempty"`     // item ID (for update, complete, remove)
	Text   string `json:"text,omitempty"`   // task text (for add)
	Status string `json:"status,omitempty"` // new status (for update: "pending", "in_progress", "completed")
}

TodoParams holds the parameters for todo operations.

type TodoStatus

type TodoStatus string

TodoStatus represents the status of a todo item.

const (
	TodoStatusPending    TodoStatus = "pending"
	TodoStatusInProgress TodoStatus = "in_progress"
	TodoStatusCompleted  TodoStatus = "completed"
)

type TodoTool

type TodoTool struct {
	// contains filtered or unexported fields
}

TodoTool provides session-scoped task tracking backed by JetStream KV.

func NewTodoTool

func NewTodoTool(js nats.JetStreamContext, paneID string) *TodoTool

NewTodoTool creates a TodoTool for the given pane.

func (*TodoTool) Execute

func (t *TodoTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute performs the todo operation.

func (*TodoTool) RequiresApproval

func (t *TodoTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false.

func (*TodoTool) Spec

func (t *TodoTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type ToolConfig

type ToolConfig = sharedtools.ToolConfig

type ToolExecutor

type ToolExecutor = sharedtools.ToolExecutor

type ToolOutput

type ToolOutput = sharedtools.ToolOutput

type ToolRegistry

type ToolRegistry = sharedtools.ToolRegistry

Type aliases — same underlying types as rysh-shared/tools.

type ToolSpec

type ToolSpec = sharedtools.ToolSpec

type WebFetchParams

type WebFetchParams struct {
	URL         string `json:"url"`
	MaxLength   int    `json:"max_length,omitempty"`
	ExtractMode string `json:"extract_mode,omitempty"` // "text", "html", "raw"
}

WebFetchParams holds the parameters for a web fetch request.

type WebFetchTool

type WebFetchTool struct{}

WebFetchTool fetches and parses content from a specific URL.

func NewWebFetchTool

func NewWebFetchTool() *WebFetchTool

NewWebFetchTool creates a new WebFetchTool.

func (*WebFetchTool) Execute

func (t *WebFetchTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute fetches content from the specified URL.

func (*WebFetchTool) RequiresApproval

func (t *WebFetchTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval always returns false for web_fetch.

func (*WebFetchTool) Spec

func (t *WebFetchTool) Spec() ToolSpec

Spec returns the tool specification for the LLM.

type WebSearchParams

type WebSearchParams struct {
	Query string `json:"query"`
	Count int    `json:"count,omitempty"`
}

type WebSearchTool

type WebSearchTool struct {
	// contains filtered or unexported fields
}

func NewWebSearchTool

func NewWebSearchTool(apiKey string) *WebSearchTool

func (*WebSearchTool) Execute

func (t *WebSearchTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

func (*WebSearchTool) RequiresApproval

func (t *WebSearchTool) RequiresApproval(_ json.RawMessage) bool

func (*WebSearchTool) Spec

func (t *WebSearchTool) Spec() ToolSpec

type WhatsAppDraftParams

type WhatsAppDraftParams struct {
	To   string `json:"to"`
	Body string `json:"body"`
}

WhatsAppDraftParams holds the parameters for the whatsapp_draft tool.

type WhatsAppDraftTool

type WhatsAppDraftTool struct {
	// contains filtered or unexported fields
}

WhatsAppDraftTool creates a WhatsApp reply draft for human review before sending. It reuses the shared DraftStore (To = recipient phone, Body = message; Subject/InReplyTo are unused for WhatsApp).

func NewWhatsAppDraftTool

func NewWhatsAppDraftTool(drafts *channels.DraftStore) *WhatsAppDraftTool

NewWhatsAppDraftTool creates a new WhatsAppDraftTool.

func (*WhatsAppDraftTool) Execute

func (t *WhatsAppDraftTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute creates a new WhatsApp reply draft.

func (*WhatsAppDraftTool) RequiresApproval

func (t *WhatsAppDraftTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns false — creating a draft does not send anything.

func (*WhatsAppDraftTool) Spec

func (t *WhatsAppDraftTool) Spec() ToolSpec

Spec returns the tool specification.

type WhatsAppListParams

type WhatsAppListParams struct {
	Count int `json:"count"`
}

WhatsAppListParams holds the parameters for the whatsapp_list tool.

type WhatsAppListTool

type WhatsAppListTool struct {
	// contains filtered or unexported fields
}

WhatsAppListTool lists recent inbound WhatsApp messages from the adapter's in-memory history (the Cloud API has no server-side "list messages" endpoint).

func NewWhatsAppListTool

func NewWhatsAppListTool(adapter *channels.WhatsAppAdapter) *WhatsAppListTool

NewWhatsAppListTool creates a new WhatsAppListTool.

func (*WhatsAppListTool) Execute

func (t *WhatsAppListTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute lists recent inbound WhatsApp messages.

func (*WhatsAppListTool) RequiresApproval

func (t *WhatsAppListTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns false — listing messages is read-only.

func (*WhatsAppListTool) Spec

func (t *WhatsAppListTool) Spec() ToolSpec

Spec returns the tool specification.

type WhatsAppReadParams

type WhatsAppReadParams struct {
	ID string `json:"id"`
}

WhatsAppReadParams holds the parameters for the whatsapp_read tool.

type WhatsAppReadTool

type WhatsAppReadTool struct {
	// contains filtered or unexported fields
}

WhatsAppReadTool returns the full content of a received WhatsApp message.

func NewWhatsAppReadTool

func NewWhatsAppReadTool(adapter *channels.WhatsAppAdapter) *WhatsAppReadTool

NewWhatsAppReadTool creates a new WhatsAppReadTool.

func (*WhatsAppReadTool) Execute

func (t *WhatsAppReadTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute returns the full content of a received WhatsApp message.

func (*WhatsAppReadTool) RequiresApproval

func (t *WhatsAppReadTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns false — reading a message is read-only.

func (*WhatsAppReadTool) Spec

func (t *WhatsAppReadTool) Spec() ToolSpec

Spec returns the tool specification.

type WhatsAppSendParams

type WhatsAppSendParams struct {
	DraftID string `json:"draft_id"`
	// Direct send fields (used when draft_id is not provided).
	To   string `json:"to"`
	Body string `json:"body"`
}

WhatsAppSendParams holds the parameters for the whatsapp_send tool.

type WhatsAppSendTemplateParams

type WhatsAppSendTemplateParams struct {
	To           string   `json:"to"`
	TemplateName string   `json:"template_name"`
	Language     string   `json:"language"`
	Params       []string `json:"params"`
}

WhatsAppSendTemplateParams holds the parameters for the whatsapp_send_template tool.

type WhatsAppSendTemplateTool

type WhatsAppSendTemplateTool struct {
	// contains filtered or unexported fields
}

WhatsAppSendTemplateTool sends a pre-approved WhatsApp template message. It exists because free-form text is undeliverable outside WhatsApp's 24h customer-service window — re-engaging a recipient requires a template that was approved in Meta Business Manager, sent to a recipient who opted in.

func NewWhatsAppSendTemplateTool

func NewWhatsAppSendTemplateTool(
	adapter *channels.WhatsAppAdapter,
	humanGoverned func() bool,
) *WhatsAppSendTemplateTool

NewWhatsAppSendTemplateTool creates a new WhatsAppSendTemplateTool. humanGoverned may be nil (never gated).

func (*WhatsAppSendTemplateTool) Execute

Execute sends a WhatsApp template message.

func (*WhatsAppSendTemplateTool) RequiresApproval

func (t *WhatsAppSendTemplateTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns true — sending a message is a side-effecting operation.

func (*WhatsAppSendTemplateTool) Spec

Spec returns the tool specification.

type WhatsAppSendTool

type WhatsAppSendTool struct {
	// contains filtered or unexported fields
}

WhatsAppSendTool sends a WhatsApp message, either from a draft or directly.

func NewWhatsAppSendTool

func NewWhatsAppSendTool(
	adapter *channels.WhatsAppAdapter,
	drafts *channels.DraftStore,
	humanGoverned func() bool,
) *WhatsAppSendTool

NewWhatsAppSendTool creates a new WhatsAppSendTool.

humanGoverned may be nil (never gated). When it reports true, Execute refuses anything but an owner-approved draft — see requireApprovedDraft.

func (*WhatsAppSendTool) Execute

func (t *WhatsAppSendTool) Execute(ctx context.Context, params json.RawMessage) (*ToolOutput, error)

Execute sends a WhatsApp message.

func (*WhatsAppSendTool) RequiresApproval

func (t *WhatsAppSendTool) RequiresApproval(_ json.RawMessage) bool

RequiresApproval returns true — sending a message is a side-effecting operation.

func (*WhatsAppSendTool) Spec

func (t *WhatsAppSendTool) Spec() ToolSpec

Spec returns the tool specification.

Jump to

Keyboard shortcuts

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