Documentation
¶
Index ¶
- func ClassifyDestructiveCommand(cmdLine string) (bool, string)
- func IsCommandBlockedForMode(mode policy.PermissionMode, command string) (bool, string)
- func IsPushToProtectedBranch(cmd string) bool
- type AsyncManager
- type BashKillTool
- func (t *BashKillTool) Description() string
- func (t *BashKillTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
- func (t *BashKillTool) InputSchema() json.RawMessage
- func (t *BashKillTool) IsEnabled(ctx *agentsdk.RunContext) bool
- func (t *BashKillTool) IsReadOnly() bool
- func (t *BashKillTool) Name() string
- func (t *BashKillTool) NeedsApproval() bool
- func (t *BashKillTool) TimeoutSeconds() int
- type BashPollTool
- func (t *BashPollTool) Description() string
- func (t *BashPollTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
- func (t *BashPollTool) InputSchema() json.RawMessage
- func (t *BashPollTool) IsEnabled(context *agentsdk.RunContext) bool
- func (t *BashPollTool) IsReadOnly() bool
- func (t *BashPollTool) Name() string
- func (t *BashPollTool) NeedsApproval() bool
- func (t *BashPollTool) TimeoutSeconds() int
- type BashStartTool
- func (t *BashStartTool) Description() string
- func (t *BashStartTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
- func (t *BashStartTool) InputSchema() json.RawMessage
- func (t *BashStartTool) IsEnabled(ctx *agentsdk.RunContext) bool
- func (t *BashStartTool) IsReadOnly() bool
- func (t *BashStartTool) Name() string
- func (t *BashStartTool) NeedsApproval() bool
- func (t *BashStartTool) TimeoutSeconds() int
- type BashTool
- func (t *BashTool) Description() string
- func (t *BashTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
- func (t *BashTool) InputSchema() json.RawMessage
- func (t *BashTool) IsEnabled(ctx *agentsdk.RunContext) bool
- func (t *BashTool) IsReadOnly() bool
- func (t *BashTool) Name() string
- func (t *BashTool) NeedsApproval() bool
- func (t *BashTool) TimeoutSeconds() int
- func (t *BashTool) ToolForAccess(level agentsdk.ToolAccessLevel) agentsdk.Tool
- type ReadOnlyBashTool
- func (t *ReadOnlyBashTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
- func (t *ReadOnlyBashTool) IsEnabled(_ *agentsdk.RunContext) bool
- func (t *ReadOnlyBashTool) IsReadOnly() bool
- func (t *ReadOnlyBashTool) ToolForAccess(agentsdk.ToolAccessLevel) agentsdk.Tool
- type TerminalManager
- type TerminalTool
- func (t *TerminalTool) Description() string
- func (t *TerminalTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
- func (t *TerminalTool) InputSchema() json.RawMessage
- func (t *TerminalTool) IsEnabled(ctx *agentsdk.RunContext) bool
- func (t *TerminalTool) IsReadOnly() bool
- func (t *TerminalTool) Name() string
- func (t *TerminalTool) NeedsApproval() bool
- func (t *TerminalTool) TimeoutSeconds() int
- func (t *TerminalTool) WritesGitRemote() bool
- type WorkspaceWriteBashTool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClassifyDestructiveCommand ¶ added in v0.0.8
ClassifyDestructiveCommand reports whether cmdLine is judged destructive by the shared denylist classifier, and why. It is the exported entry point for callers outside the bash tools (e.g. the built-in destructive-command guardrail) that need tokenizer-backed classification without the per-mode git policy applied by IsCommandBlockedForMode.
func IsCommandBlockedForMode ¶
func IsCommandBlockedForMode(mode policy.PermissionMode, command string) (bool, string)
IsCommandBlockedForMode is the public entry point for the Bash tools' command guard. Restricted modes reject dynamic shell syntax that cannot be authorized statically, then apply destructive and remote-side-effect policy.
NOTE on policy boundaries: this tool-layer denylist is defense in depth for hosts running commands without an enforcing OS sandbox. When the platform subprocess sandbox enforces the filesystem boundary (see pkg/agentsdk/sandbox), the bash tools skip the destructive classifier and apply only git policy, which guards remote-side effects the sandbox cannot contain.
func IsPushToProtectedBranch ¶
Types ¶
type AsyncManager ¶
type AsyncManager struct {
// contains filtered or unexported fields
}
AsyncManager owns background shell jobs started by the async Bash tools.
func NewAsyncManager ¶
func NewAsyncManager(executor sandbox.Executor) *AsyncManager
NewAsyncManager creates a manager for async shell jobs.
func (*AsyncManager) Close ¶
func (m *AsyncManager) Close() error
Close terminates all running jobs.
type BashKillTool ¶
type BashKillTool struct {
Manager *AsyncManager
}
BashKillTool terminates a background shell job.
func (*BashKillTool) Description ¶
func (t *BashKillTool) Description() string
func (*BashKillTool) Execute ¶
func (t *BashKillTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
func (*BashKillTool) InputSchema ¶
func (t *BashKillTool) InputSchema() json.RawMessage
func (*BashKillTool) IsEnabled ¶
func (t *BashKillTool) IsEnabled(ctx *agentsdk.RunContext) bool
func (*BashKillTool) IsReadOnly ¶
func (t *BashKillTool) IsReadOnly() bool
func (*BashKillTool) Name ¶
func (t *BashKillTool) Name() string
func (*BashKillTool) NeedsApproval ¶
func (t *BashKillTool) NeedsApproval() bool
func (*BashKillTool) TimeoutSeconds ¶
func (t *BashKillTool) TimeoutSeconds() int
type BashPollTool ¶
type BashPollTool struct {
Manager *AsyncManager
}
BashPollTool polls a background shell job.
func (*BashPollTool) Description ¶
func (t *BashPollTool) Description() string
func (*BashPollTool) Execute ¶
func (t *BashPollTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
func (*BashPollTool) InputSchema ¶
func (t *BashPollTool) InputSchema() json.RawMessage
func (*BashPollTool) IsEnabled ¶
func (t *BashPollTool) IsEnabled(context *agentsdk.RunContext) bool
func (*BashPollTool) IsReadOnly ¶
func (t *BashPollTool) IsReadOnly() bool
func (*BashPollTool) Name ¶
func (t *BashPollTool) Name() string
func (*BashPollTool) NeedsApproval ¶
func (t *BashPollTool) NeedsApproval() bool
func (*BashPollTool) TimeoutSeconds ¶
func (t *BashPollTool) TimeoutSeconds() int
type BashStartTool ¶
type BashStartTool struct {
Manager *AsyncManager
Mode policy.PermissionMode
GitRemoteWrites policy.GitRemoteWrites
}
BashStartTool starts a long-running shell command in the background.
func (*BashStartTool) Description ¶
func (t *BashStartTool) Description() string
func (*BashStartTool) Execute ¶
func (t *BashStartTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
func (*BashStartTool) InputSchema ¶
func (t *BashStartTool) InputSchema() json.RawMessage
func (*BashStartTool) IsEnabled ¶
func (t *BashStartTool) IsEnabled(ctx *agentsdk.RunContext) bool
func (*BashStartTool) IsReadOnly ¶
func (t *BashStartTool) IsReadOnly() bool
func (*BashStartTool) Name ¶
func (t *BashStartTool) Name() string
func (*BashStartTool) NeedsApproval ¶
func (t *BashStartTool) NeedsApproval() bool
func (*BashStartTool) TimeoutSeconds ¶
func (t *BashStartTool) TimeoutSeconds() int
type BashTool ¶
type BashTool struct {
Executor sandbox.Executor
GitRemoteWrites policy.GitRemoteWrites
}
BashTool executes shell commands.
func (*BashTool) Description ¶
func (*BashTool) Execute ¶
func (t *BashTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
func (*BashTool) InputSchema ¶
func (t *BashTool) InputSchema() json.RawMessage
func (*BashTool) IsReadOnly ¶
func (*BashTool) NeedsApproval ¶
func (*BashTool) TimeoutSeconds ¶
func (*BashTool) ToolForAccess ¶
func (t *BashTool) ToolForAccess(level agentsdk.ToolAccessLevel) agentsdk.Tool
type ReadOnlyBashTool ¶
type ReadOnlyBashTool struct {
BashTool
}
ReadOnlyBashTool is a Bash tool restricted to safe commands and read-only sandboxing.
func (*ReadOnlyBashTool) Execute ¶
func (t *ReadOnlyBashTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
func (*ReadOnlyBashTool) IsEnabled ¶
func (t *ReadOnlyBashTool) IsEnabled(_ *agentsdk.RunContext) bool
func (*ReadOnlyBashTool) IsReadOnly ¶
func (t *ReadOnlyBashTool) IsReadOnly() bool
func (*ReadOnlyBashTool) ToolForAccess ¶
func (t *ReadOnlyBashTool) ToolForAccess(agentsdk.ToolAccessLevel) agentsdk.Tool
type TerminalManager ¶ added in v0.0.9
type TerminalManager struct {
// contains filtered or unexported fields
}
TerminalManager owns interactive PTY sessions started by the Terminal tool.
func NewTerminalManager ¶ added in v0.0.9
func NewTerminalManager(executor sandbox.Executor) *TerminalManager
NewTerminalManager creates a manager for interactive terminal sessions.
func (*TerminalManager) Close ¶ added in v0.0.9
func (m *TerminalManager) Close() error
Close terminates all sessions.
type TerminalTool ¶ added in v0.0.9
type TerminalTool struct {
Manager *TerminalManager
Mode policy.PermissionMode
GitRemoteWrites policy.GitRemoteWrites
}
TerminalTool drives a persistent interactive PTY session. It exists for workflows one-shot Bash cannot handle: TUIs (vim, less, htop), debuggers, REPLs, ssh prompts, and long-lived foreground processes.
func (*TerminalTool) Description ¶ added in v0.0.9
func (t *TerminalTool) Description() string
func (*TerminalTool) Execute ¶ added in v0.0.9
func (t *TerminalTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
func (*TerminalTool) InputSchema ¶ added in v0.0.9
func (t *TerminalTool) InputSchema() json.RawMessage
func (*TerminalTool) IsEnabled ¶ added in v0.0.9
func (t *TerminalTool) IsEnabled(ctx *agentsdk.RunContext) bool
func (*TerminalTool) IsReadOnly ¶ added in v0.0.9
func (t *TerminalTool) IsReadOnly() bool
func (*TerminalTool) Name ¶ added in v0.0.9
func (t *TerminalTool) Name() string
func (*TerminalTool) NeedsApproval ¶ added in v0.0.9
func (t *TerminalTool) NeedsApproval() bool
func (*TerminalTool) TimeoutSeconds ¶ added in v0.0.9
func (t *TerminalTool) TimeoutSeconds() int
func (*TerminalTool) WritesGitRemote ¶ added in v0.0.89
func (t *TerminalTool) WritesGitRemote() bool
type WorkspaceWriteBashTool ¶
type WorkspaceWriteBashTool struct {
BashTool
}
WorkspaceWriteBashTool allows local workspace edits while still blocking orchestrator-owned or clearly destructive shell commands.
func (*WorkspaceWriteBashTool) Execute ¶
func (t *WorkspaceWriteBashTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
func (*WorkspaceWriteBashTool) ToolForAccess ¶
func (t *WorkspaceWriteBashTool) ToolForAccess(level agentsdk.ToolAccessLevel) agentsdk.Tool