trackerwrite

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package trackerwrite implements the tracker_write Eino tool.

The model-facing tool is a discriminated union over comment, transition, close, and link_pr operations. V0.1 always executes close through tracker.CloseWriter and executes transition and comment when the configured writer also satisfies tracker.TransitionWriter or tracker.CommentWriter. Unsupported operations, including link_pr, return a structured unsupported_op result so existing prompts receive an actionable response.

Writer error mapping is intentionally coarse: only context deadline and cancellation map to the timeout/canceled categories; every other writer error (including a permanently invalid transition target state) surfaces as the retryable unknown category. Writers are therefore responsible for not returning permanent failures in a way the agent loop will retry indefinitely; richer category mapping remains a future tracker API design.

Index

Constants

View Source
const (
	ErrCategoryUnsupportedOp = "unsupported_op"
	ErrCategoryValidation    = "validation"
	ErrCategoryNotFound      = "not_found"
	ErrCategoryAuthFailed    = "auth_failed"
	ErrCategoryConflict      = "conflict"
	ErrCategoryAPIRequest    = "api_request"
	ErrCategoryAPIStatus     = "api_status"
	ErrCategoryRateLimited   = "rate_limited"
	ErrCategoryTimeout       = "timeout"
	ErrCategoryUnsupported   = "unsupported"
	ErrCategoryUnknown       = "unknown"
	ErrCategoryCanceled      = "canceled"
)
View Source
const Name = "tracker_write"

Name is the tool's registered name.

Variables

This section is empty.

Functions

func Schema

func Schema() json.RawMessage

Schema returns a fresh JSON Schema copy for tracker_write arguments.

Types

type Args

type Args struct {
	Op      Op     `json:"op"`
	ID      string `json:"id"`
	Body    string `json:"body,omitempty"`
	ToState string `json:"toState,omitempty"`
	Reason  string `json:"reason,omitempty"`
	PRURL   string `json:"prURL,omitempty"`
}

Args is the parsed tracker_write input shape.

type Op

type Op string

Op is the discriminator for tracker_write arguments.

const (
	OpComment    Op = "comment"
	OpTransition Op = "transition"
	OpClose      Op = "close"
	OpLinkPR     Op = "link_pr"
)

func (Op) Valid

func (o Op) Valid() bool

Valid reports whether o is one of the model-facing ops.

type Result

type Result struct {
	Outcome result.Outcome  `json:"outcome"`
	Op      Op              `json:"op,omitempty"`
	ID      string          `json:"id,omitempty"`
	Error   *ResultError    `json:"error,omitempty"`
	RawJSON json.RawMessage `json:"-"`
}

Result is the structured envelope returned to the model.

func (Result) IsRetryable

func (r Result) IsRetryable() bool

IsRetryable reports whether the agent loop should retry the same call.

func (*Result) UnmarshalJSON

func (r *Result) UnmarshalJSON(raw []byte) error

UnmarshalJSON decodes Result and preserves the original object in RawJSON.

type ResultError

type ResultError struct {
	Category string `json:"category"`
	Message  string `json:"message"`
	Op       string `json:"op,omitempty"`
}

ResultError is the structured failure envelope nested inside Result.

type Tool

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

Tool is the v0.1 tracker_write tool.

func New

func New(w tracker.CloseWriter) (*Tool, error)

New constructs a Tool.

func (*Tool) Info

func (t *Tool) Info(_ context.Context) (*schema.ToolInfo, error)

Info returns the Eino ToolInfo for tracker_write.

func (*Tool) InvokableRun

func (t *Tool) InvokableRun(ctx context.Context, argsJSON string, _ ...tool.Option) (string, error)

InvokableRun is the Eino tool entry point.

func (*Tool) Run

func (t *Tool) Run(ctx context.Context, args Args) Result

Run executes tracker_write against parsed args.

Jump to

Keyboard shortcuts

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