executors

package
v1.0.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package executors provides tool executor implementations for the agentic-tools component.

Package executors provides tool executor implementations for the agentic-tools component.

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errs.ErrKeyNotFound

ErrKeyNotFound is returned when a key is not found in the KV store.

Functions

This section is empty.

Types

type GitHubClient

type GitHubClient interface {
	GetIssue(ctx context.Context, owner, repo string, number int) (*GitHubIssue, error)
	ListIssues(ctx context.Context, owner, repo string, opts ListIssuesOpts) ([]GitHubIssue, error)
	SearchIssues(ctx context.Context, query string) ([]GitHubIssue, error)
	GetPullRequest(ctx context.Context, owner, repo string, number int) (*GitHubPR, error)
	GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)
	CreateBranch(ctx context.Context, owner, repo, branch, baseSHA string) error
	CommitFile(ctx context.Context, owner, repo, branch, path, content, message string) error
	CreatePullRequest(ctx context.Context, owner, repo, title, body, head, base string) (*GitHubPR, error)
	AddComment(ctx context.Context, owner, repo string, number int, body string) error
	AddLabels(ctx context.Context, owner, repo string, number int, labels []string) error
}

GitHubClient defines the interface for GitHub API operations. All methods accept context for cancellation and timeout propagation.

type GitHubHTTPClient

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

GitHubHTTPClient implements GitHubClient using the GitHub REST API v3. It authenticates via a Bearer token and parses only the fields the system needs.

func NewGitHubHTTPClient

func NewGitHubHTTPClient(token string) *GitHubHTTPClient

NewGitHubHTTPClient creates a new GitHubHTTPClient with the given personal access token.

func (*GitHubHTTPClient) AddComment

func (c *GitHubHTTPClient) AddComment(ctx context.Context, owner, repo string, number int, body string) error

AddComment posts a comment on an issue or pull request.

func (*GitHubHTTPClient) AddLabels

func (c *GitHubHTTPClient) AddLabels(ctx context.Context, owner, repo string, number int, labels []string) error

AddLabels applies labels to an issue or pull request.

func (*GitHubHTTPClient) CommitFile

func (c *GitHubHTTPClient) CommitFile(ctx context.Context, owner, repo, branch, path, content, message string) error

CommitFile creates or updates a single file on a branch using the Contents API. content is the raw file text; this method handles base64 encoding.

func (*GitHubHTTPClient) CreateBranch

func (c *GitHubHTTPClient) CreateBranch(ctx context.Context, owner, repo, branch, baseSHA string) error

CreateBranch creates a new branch from the given base SHA. It uses the Git refs API rather than the higher-level branch API so the caller controls exactly which commit the branch points at.

func (*GitHubHTTPClient) CreatePullRequest

func (c *GitHubHTTPClient) CreatePullRequest(ctx context.Context, owner, repo, title, body, head, base string) (*GitHubPR, error)

CreatePullRequest opens a new pull request from head into base.

func (*GitHubHTTPClient) GetFileContent

func (c *GitHubHTTPClient) GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)

GetFileContent retrieves the decoded text content of a file at a specific ref.

func (*GitHubHTTPClient) GetIssue

func (c *GitHubHTTPClient) GetIssue(ctx context.Context, owner, repo string, number int) (*GitHubIssue, error)

GetIssue fetches a single issue by number.

func (*GitHubHTTPClient) GetPullRequest

func (c *GitHubHTTPClient) GetPullRequest(ctx context.Context, owner, repo string, number int) (*GitHubPR, error)

GetPullRequest fetches a single pull request by number.

func (*GitHubHTTPClient) ListIssues

func (c *GitHubHTTPClient) ListIssues(ctx context.Context, owner, repo string, opts ListIssuesOpts) ([]GitHubIssue, error)

ListIssues returns a list of issues for a repository filtered by opts.

func (*GitHubHTTPClient) SearchIssues

func (c *GitHubHTTPClient) SearchIssues(ctx context.Context, query string) ([]GitHubIssue, error)

SearchIssues executes a GitHub issue search query.

type GitHubIssue

type GitHubIssue struct {
	Number    int       `json:"number"`
	Title     string    `json:"title"`
	Body      string    `json:"body"`
	State     string    `json:"state"`
	Labels    []string  `json:"labels"`
	Assignee  string    `json:"assignee,omitempty"`
	Author    string    `json:"author"`
	HTMLURL   string    `json:"html_url"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Comments  int       `json:"comments"`
}

GitHubIssue represents a GitHub issue with the fields relevant to the agentic system.

type GitHubPR

type GitHubPR struct {
	Number    int       `json:"number"`
	Title     string    `json:"title"`
	Body      string    `json:"body"`
	State     string    `json:"state"`
	HTMLURL   string    `json:"html_url"`
	Head      string    `json:"head"`
	Base      string    `json:"base"`
	Mergeable *bool     `json:"mergeable,omitempty"`
	Additions int       `json:"additions"`
	Deletions int       `json:"deletions"`
	DiffURL   string    `json:"diff_url"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

GitHubPR represents a GitHub pull request with the fields relevant to the agentic system.

type GitHubReadExecutor

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

GitHubReadExecutor provides read-only GitHub tools to agentic agents. It fetches issues, pull requests, and file content without mutating any state.

func NewGitHubReadExecutor

func NewGitHubReadExecutor(client GitHubClient) *GitHubReadExecutor

NewGitHubReadExecutor creates a new GitHubReadExecutor backed by the given client.

func (*GitHubReadExecutor) Execute

Execute dispatches the tool call to the appropriate handler.

func (*GitHubReadExecutor) ListTools

func (e *GitHubReadExecutor) ListTools() []agentic.ToolDefinition

ListTools returns the tool definitions provided by this executor.

type GitHubWriteExecutor

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

GitHubWriteExecutor provides write tools that let agentic agents mutate GitHub state. Operations include branch creation, file commits, PR creation, comments, and labels.

func NewGitHubWriteExecutor

func NewGitHubWriteExecutor(client GitHubClient) *GitHubWriteExecutor

NewGitHubWriteExecutor creates a new GitHubWriteExecutor backed by the given client.

func (*GitHubWriteExecutor) Execute

Execute dispatches the tool call to the appropriate handler.

func (*GitHubWriteExecutor) ListTools

func (e *GitHubWriteExecutor) ListTools() []agentic.ToolDefinition

ListTools returns the tool definitions provided by this executor.

type GraphQueryExecutor

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

GraphQueryExecutor executes graph queries against the ENTITY_STATES KV bucket.

func NewGraphQueryExecutor

func NewGraphQueryExecutor(kvGetter KVGetter) *GraphQueryExecutor

NewGraphQueryExecutor creates a new GraphQueryExecutor with the given KV getter.

func (*GraphQueryExecutor) Execute

Execute executes a tool call and returns the result.

func (*GraphQueryExecutor) ListTools

func (e *GraphQueryExecutor) ListTools() []agentic.ToolDefinition

ListTools returns the tool definitions provided by this executor.

type JetStreamKVAdapter

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

JetStreamKVAdapter adapts a jetstream.KeyValue to our KVGetter interface.

func NewJetStreamKVAdapter

func NewJetStreamKVAdapter(kv any) *JetStreamKVAdapter

NewJetStreamKVAdapter creates a new adapter for jetstream.KeyValue. Usage: NewJetStreamKVAdapter(kvBucket) where kvBucket is a jetstream.KeyValue

func (*JetStreamKVAdapter) Get

func (a *JetStreamKVAdapter) Get(ctx context.Context, key string) (KVEntry, error)

Get implements KVGetter.

type KVEntry

type KVEntry interface {
	Value() []byte
	Revision() uint64
}

KVEntry defines the minimal interface needed to read an entry from the KV store.

type KVGetter

type KVGetter interface {
	Get(ctx context.Context, key string) (KVEntry, error)
}

KVGetter defines the minimal interface needed to query entities from a KV store. This allows for easier testing and decouples the executor from the full jetstream.KeyValue interface.

type ListIssuesOpts

type ListIssuesOpts struct {
	State  string // open, closed, all
	Labels []string
	Sort   string // created, updated, comments
	Limit  int
}

ListIssuesOpts configures the issue listing query.

Jump to

Keyboard shortcuts

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