Documentation
¶
Index ¶
- Constants
- Variables
- func CleanThreadTitle(title string) string
- func ContextWithStateWriter(ctx context.Context, w io.Writer) context.Context
- func FetchGitCommits(ctx context.Context, workingDir, base, head string) (string, error)
- func FetchGitDiff(ctx context.Context, workingDir, base, head string, ignoredLockFiles []string) (string, []string, error)
- func FetchPRDiff(ctx context.Context, client *github.Client, owner, repo string, prNumber int, ...) (string, error)
- func FetchPRFiles(ctx context.Context, client *github.Client, owner, repo string, prNumber int, ...) ([]string, error)
- func FormatThreadTitle(emoji, baseTitle string) string
- func GetCurrentThreadTitle(ctx context.Context) (string, error)
- func IsT3Session() bool
- func ParseRepoSlug(raw string) (owner, repo string, err error)
- func RegisterLocalTools(r *Registry, root, base, head string, ignoredLockFiles []string, ...)
- func RegisterToolWithArgs[T any](r *Registry, def llm.ToolDef, ...)
- func StateWriterFromContext(ctx context.Context) io.Writer
- func UpdateThreadTitlePrefix(ctx context.Context, emoji string) error
- func WithAskDeveloperTimeout(ctx context.Context, d time.Duration) context.Context
- func WithTestStreams(ctx context.Context, in io.Reader, out io.Writer) context.Context
- type ModelSelection
- type NoOpUserNotifier
- type PRStackItem
- type PRSummary
- type Registry
- type ThreadLaunchArgs
- type ToolHandler
- type UserNotifier
- type VerdictChangeListener
- type WorkspaceStrategy
Constants ¶
const ( // ReviewStatePending indicates that the review or pre-review is in progress. ReviewStatePending = "⏳" // ReviewStateApproved indicates that the review concluded with an approval. ReviewStateApproved = "✅" // ReviewStateRejected indicates that the review concluded with a rejection. ReviewStateRejected = "❎" // ReviewStateElse indicates non-blocking feedback, uncertain outcome, or general completion. ReviewStateElse = "✳️" )
Variables ¶
var ErrDiffTooLarge = errors.New("PR diff exceeds GitHub API limit (406)")
ErrDiffTooLarge is returned when GitHub rejects a PR diff request with HTTP 406 (e.g. diff exceeds limit).
Functions ¶
func CleanThreadTitle ¶ added in v0.8.0
CleanThreadTitle strips existing review status emoji prefixes (and following spaces) from a thread title.
func ContextWithStateWriter ¶ added in v0.6.0
ContextWithStateWriter returns a new context carrying the given state writer. This is retained for test assertions and potential downstream integrations where state is logged directly via context (rather than through reporter callbacks).
func FetchGitCommits ¶
FetchGitCommits returns a bulleted list of commit subjects (first line of message) between base and head, excluding merge commits.
func FetchGitDiff ¶
func FetchPRDiff ¶ added in v0.8.0
func FetchPRDiff(ctx context.Context, client *github.Client, owner, repo string, prNumber int, paths []string, ignoredLockFiles []string) (string, error)
FetchPRDiff fetches the git diff for a PR. If paths are supplied, only diffs for those paths are returned. Lockfiles in ignoredLockFiles are omitted.
func FetchPRFiles ¶ added in v0.8.0
func FetchPRFiles(ctx context.Context, client *github.Client, owner, repo string, prNumber int, ignoredLockFiles []string) ([]string, error)
FetchPRFiles fetches the list of changed files for a pull request, excluding ignored lock files.
func FormatThreadTitle ¶ added in v0.8.0
FormatThreadTitle formats a thread title with the specified review status emoji prefix.
func GetCurrentThreadTitle ¶ added in v0.8.0
GetCurrentThreadTitle returns the title of the current T3 thread if running in a T3 session.
func IsT3Session ¶ added in v0.8.0
func IsT3Session() bool
IsT3Session returns true if Cassandra is currently running inside a T3 Code environment.
func ParseRepoSlug ¶ added in v0.8.0
ParseRepoSlug parses owner and repo from an owner/repo slug or git URL.
func RegisterLocalTools ¶
func RegisterToolWithArgs ¶ added in v0.5.0
func StateWriterFromContext ¶ added in v0.6.0
StateWriterFromContext extracts the state writer from the context, if present.
func UpdateThreadTitlePrefix ¶ added in v0.8.0
UpdateThreadTitlePrefix updates the current T3 thread title with the specified review status emoji prefix. If not in a T3 session, it is a no-op and returns nil.
func WithAskDeveloperTimeout ¶ added in v0.6.0
WithAskDeveloperTimeout wraps a context to override the ask_developer timeout.
Types ¶
type ModelSelection ¶ added in v0.8.0
type ModelSelection struct {
InstanceID string `json:"instanceId,omitempty"`
Model string `json:"model"`
Options any `json:"options,omitempty"`
Provider string `json:"provider,omitempty"`
}
ModelSelection specifies provider instance and model parameters for thread launch.
type NoOpUserNotifier ¶ added in v0.6.0
type NoOpUserNotifier struct{}
func (NoOpUserNotifier) NotifyUser ¶ added in v0.6.0
func (NoOpUserNotifier) NotifyUser()
type PRStackItem ¶ added in v0.8.0
type PRStackItem struct {
PRNumber int `json:"pr_number"`
Title string `json:"title"`
Branch string `json:"branch"`
Base string `json:"base"`
Head string `json:"head"`
}
PRStackItem represents a pull request in a stacked PR chain.
func FetchPRStack ¶ added in v0.8.0
func FetchPRStack(ctx context.Context, client *github.Client, owner, repo string, prNumber int) ([]PRStackItem, error)
FetchPRStack fetches the stacked PR chain for the given PR number using GitHub's native Stacks API. If the PR is not part of a stack (or if stacks are not enabled/available), it returns (nil, nil).
type PRSummary ¶ added in v0.8.0
type PRSummary struct {
PRNumber int `json:"pr_number"`
RepoFullName string `json:"repo_full_name"`
Title string `json:"title"`
Description string `json:"description"`
Author string `json:"author"`
Branch string `json:"branch"`
Base string `json:"base"`
Head string `json:"head"`
ChangedFiles []string `json:"changed_files"`
}
PRSummary represents pull request details and changed files for agent tools.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) HandleCall ¶
func (*Registry) RegisterTool ¶
func (r *Registry) RegisterTool(def llm.ToolDef, handler ToolHandler)
func (*Registry) SetVerdictChangeListener ¶ added in v0.8.0
func (r *Registry) SetVerdictChangeListener(l VerdictChangeListener)
type ThreadLaunchArgs ¶ added in v0.8.0
type ThreadLaunchArgs struct {
Title string `json:"title"`
Message string `json:"message,omitempty"`
ModelSelection *ModelSelection `json:"modelSelection,omitempty"`
WorkspaceStrategy *WorkspaceStrategy `json:"workspaceStrategy,omitempty"`
RuntimeMode string `json:"runtimeMode,omitempty"`
InteractionMode string `json:"interactionMode,omitempty"`
ProjectID string `json:"projectId,omitempty"`
Scratch *bool `json:"scratch,omitempty"`
}
ThreadLaunchArgs represents arguments passed to t3_thread_launch.
type UserNotifier ¶ added in v0.6.0
type UserNotifier interface {
NotifyUser()
}
type VerdictChangeListener ¶ added in v0.8.0
VerdictChangeListener is invoked whenever the review verdict is updated via update_review_verdict.
type WorkspaceStrategy ¶ added in v0.8.0
type WorkspaceStrategy struct {
Type string `json:"type"`
BaseRef string `json:"baseRef,omitempty"`
Branch string `json:"branch,omitempty"`
StartFromOrigin *bool `json:"startFromOrigin,omitempty"`
WorktreePath string `json:"worktreePath,omitempty"`
}
WorkspaceStrategy specifies workspace configuration for a launched thread.