Documentation
¶
Index ¶
- func GuardBranchForPush(ctx context.Context, runner CommandRunner, repoDir, baseBranch string) error
- type ArtifactSink
- type AttachRepositoryOption
- type AttachRepositoryTool
- func (t *AttachRepositoryTool) Description() string
- func (t *AttachRepositoryTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
- func (t *AttachRepositoryTool) InputSchema() json.RawMessage
- func (t *AttachRepositoryTool) IsEnabled(ctx *agentsdk.RunContext) bool
- func (t *AttachRepositoryTool) IsReadOnly() bool
- func (t *AttachRepositoryTool) Name() string
- func (t *AttachRepositoryTool) NeedsApproval() bool
- func (t *AttachRepositoryTool) TimeoutSeconds() int
- type CommandRunner
- type CreateIssueTool
- func (t *CreateIssueTool) Description() string
- func (t *CreateIssueTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
- func (t *CreateIssueTool) InputSchema() json.RawMessage
- func (t *CreateIssueTool) IsEnabled(ctx *agentsdk.RunContext) bool
- func (t *CreateIssueTool) IsReadOnly() bool
- func (t *CreateIssueTool) Name() string
- func (t *CreateIssueTool) NeedsApproval() bool
- func (t *CreateIssueTool) TimeoutSeconds() int
- type CreatePullRequestTool
- func (t *CreatePullRequestTool) Description() string
- func (t *CreatePullRequestTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
- func (t *CreatePullRequestTool) InputSchema() json.RawMessage
- func (t *CreatePullRequestTool) IsEnabled(ctx *agentsdk.RunContext) bool
- func (t *CreatePullRequestTool) IsReadOnly() bool
- func (t *CreatePullRequestTool) Name() string
- func (t *CreatePullRequestTool) NeedsApproval() bool
- func (t *CreatePullRequestTool) TimeoutSeconds() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GuardBranchForPush ¶ added in v0.0.45
func GuardBranchForPush(ctx context.Context, runner CommandRunner, repoDir, baseBranch string) error
GuardBranchForPush refuses to push from a branch that must never receive direct pushes: the repository default branch (resolved from refs/remotes/origin/HEAD when available), main, master, a detached HEAD, or a branch equal to the requested PR base. Hosts can reuse it to guard their own push paths. A nil error means the current branch is a pushable work branch.
Types ¶
type ArtifactSink ¶
type ArtifactSink interface {
RecordPullRequestURL(ctx context.Context, url string) error
RecordIssueURL(ctx context.Context, url string) error
}
ArtifactSink records GitHub artifacts created by the tools.
type AttachRepositoryOption ¶ added in v0.0.32
type AttachRepositoryOption func(*AttachRepositoryTool)
AttachRepositoryOption configures AttachRepositoryTool.
func WithAttachRepositoryDefaultBaseBranch ¶ added in v0.0.32
func WithAttachRepositoryDefaultBaseBranch(branch string) AttachRepositoryOption
WithAttachRepositoryDefaultBaseBranch sets the branch used when input omits base_branch.
func WithAttachRepositoryDefaultBranchName ¶ added in v0.0.32
func WithAttachRepositoryDefaultBranchName(branch string) AttachRepositoryOption
WithAttachRepositoryDefaultBranchName sets the branch checked out after clone when input omits branch_name.
func WithAttachRepositoryStoreDir ¶ added in v0.0.32
func WithAttachRepositoryStoreDir(path string) AttachRepositoryOption
WithAttachRepositoryStoreDir sets the workspace-relative parent directory for repositories. The default is repos.
type AttachRepositoryTool ¶ added in v0.0.32
type AttachRepositoryTool struct {
Runner CommandRunner
DefaultBaseBranch string
DefaultBranchName string
RepoStoreDir string
}
AttachRepositoryTool clones git repositories into the SDK workspace.
Repositories are cloned under repos/<alias> by default, keeping every clone inside the existing workspace boundary so file, search, shell, and GitHub tools can address them by workspace-relative paths.
func NewAttachRepositoryTool ¶ added in v0.0.32
func NewAttachRepositoryTool(runner CommandRunner, opts ...AttachRepositoryOption) *AttachRepositoryTool
func (*AttachRepositoryTool) Description ¶ added in v0.0.32
func (t *AttachRepositoryTool) Description() string
func (*AttachRepositoryTool) Execute ¶ added in v0.0.32
func (t *AttachRepositoryTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
func (*AttachRepositoryTool) InputSchema ¶ added in v0.0.32
func (t *AttachRepositoryTool) InputSchema() json.RawMessage
func (*AttachRepositoryTool) IsEnabled ¶ added in v0.0.32
func (t *AttachRepositoryTool) IsEnabled(ctx *agentsdk.RunContext) bool
func (*AttachRepositoryTool) IsReadOnly ¶ added in v0.0.32
func (t *AttachRepositoryTool) IsReadOnly() bool
func (*AttachRepositoryTool) Name ¶ added in v0.0.32
func (t *AttachRepositoryTool) Name() string
func (*AttachRepositoryTool) NeedsApproval ¶ added in v0.0.32
func (t *AttachRepositoryTool) NeedsApproval() bool
func (*AttachRepositoryTool) TimeoutSeconds ¶ added in v0.0.32
func (t *AttachRepositoryTool) TimeoutSeconds() int
type CommandRunner ¶
type CommandRunner interface {
RunGit(ctx context.Context, workDir string, args ...string) (string, error)
RunGH(ctx context.Context, workDir string, args ...string) (string, error)
}
CommandRunner runs git and gh commands. Tests and hosts may replace it.
type CreateIssueTool ¶
type CreateIssueTool struct {
Runner CommandRunner
Sink ArtifactSink
}
CreateIssueTool creates a GitHub issue in the current repository.
func NewCreateIssueTool ¶
func NewCreateIssueTool(runner CommandRunner, sink ArtifactSink) *CreateIssueTool
func (*CreateIssueTool) Description ¶
func (t *CreateIssueTool) Description() string
func (*CreateIssueTool) Execute ¶
func (t *CreateIssueTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
func (*CreateIssueTool) InputSchema ¶
func (t *CreateIssueTool) InputSchema() json.RawMessage
func (*CreateIssueTool) IsEnabled ¶
func (t *CreateIssueTool) IsEnabled(ctx *agentsdk.RunContext) bool
func (*CreateIssueTool) IsReadOnly ¶
func (t *CreateIssueTool) IsReadOnly() bool
func (*CreateIssueTool) Name ¶
func (t *CreateIssueTool) Name() string
func (*CreateIssueTool) NeedsApproval ¶
func (t *CreateIssueTool) NeedsApproval() bool
func (*CreateIssueTool) TimeoutSeconds ¶
func (t *CreateIssueTool) TimeoutSeconds() int
type CreatePullRequestTool ¶
type CreatePullRequestTool struct {
Runner CommandRunner
Sink ArtifactSink
}
CreatePullRequestTool creates a GitHub pull request from the current branch.
func NewCreatePullRequestTool ¶
func NewCreatePullRequestTool(runner CommandRunner, sink ArtifactSink) *CreatePullRequestTool
func (*CreatePullRequestTool) Description ¶
func (t *CreatePullRequestTool) Description() string
func (*CreatePullRequestTool) Execute ¶
func (t *CreatePullRequestTool) Execute(ctx context.Context, input json.RawMessage, workDir string) (agentsdk.ToolResult, error)
func (*CreatePullRequestTool) InputSchema ¶
func (t *CreatePullRequestTool) InputSchema() json.RawMessage
func (*CreatePullRequestTool) IsEnabled ¶
func (t *CreatePullRequestTool) IsEnabled(ctx *agentsdk.RunContext) bool
func (*CreatePullRequestTool) IsReadOnly ¶
func (t *CreatePullRequestTool) IsReadOnly() bool
func (*CreatePullRequestTool) Name ¶
func (t *CreatePullRequestTool) Name() string
func (*CreatePullRequestTool) NeedsApproval ¶
func (t *CreatePullRequestTool) NeedsApproval() bool
func (*CreatePullRequestTool) TimeoutSeconds ¶
func (t *CreatePullRequestTool) TimeoutSeconds() int