Help us shape the future of Go! Take the 2026 Go Developer Survey

contextplan

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package contextplan assembles bounded committed-source context and plans typed questions without invoking a provider.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInput  = errors.New("invalid context input")
	ErrInvalidLimits = errors.New("invalid context limits")
	ErrLimit         = errors.New("context limit exceeded")
)

Functions

This section is empty.

Types

type Batch

type Batch struct {
	GroupIDs       []string
	Request        jev.Request
	ItemByQuestion map[string]string
}

Batch is one request against one state. ItemByQuestion maps answer IDs back to immutable Git work-item IDs for later diagnostic anchoring.

func Plan

func Plan(ctx context.Context, groups []Group, bindings []Binding, model string, limits Limits) ([]Batch, error)

Plan creates bounded System One requests. Every binding appears once, and equal state strings share a request whenever the complete request fits.

type Binding

type Binding struct {
	GroupID    string
	WorkItemID string
	QuestionID string
	Question   jev.Question
}

Binding ties one typed decision question to one anchored work item.

type Group

type Group struct {
	ID    string
	State string
	Items []git.WorkItem
}

Group retains the exact work-item anchors represented by State.

func Assemble

func Assemble(ctx context.Context, result git.Result, limits Limits) ([]Group, error)

Assemble renders committed source into deterministic bounded hunk groups. It returns no groups when any item is invalid or an indivisible hunk is too large.

type Limits

type Limits struct {
	MaxStateBytes        int
	MaxTotalStateBytes   int
	MaxRequestBytes      int
	ByteBudget           int
	MaxItems             int
	MaxGroups            int
	MaxQuestions         int
	MaxQuestionsPerBatch int
	MaxPlanBytes         int
}

Limits are local preflight caps. Zero selects a finite default; callers may lower a cap but cannot raise it above the hard maximum. ByteBudget is a conservative upper estimate of tokens: one serialized UTF-8 byte counts as one token. It is not the provider's tokenizer.

Jump to

Keyboard shortcuts

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