pulls

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 31 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ChangesFilesMax = 400
	ChangesHunksMax = 2 << 20
	ChangesFileMax  = 256 << 10

	// listMax bounds the file lists git prints, which are paths and counts and never hunks.
	// PatchMax is what is read of one patch: the total hunk bound, a file that would be cut anyway, and slack.
	PatchMax = ChangesHunksMax + ChangesFileMax + 64<<10
)

Variables

View Source
var ListMax = 16 << 20

ListMax is a variable so a test can use a small cap.

Functions

func HubCI

func HubCI(hub func() *forge.Remote, noHub error) http.HandlerFunc

HubCI is POST /v1/hub/ci: a CI question (atrium_ci) asked of the hub over the link. The room never runs a forge CLI, so a room with no hub answers noHub, and the hub's refusal is passed on as its own sentence.

func InsideWorktreeVia

func InsideWorktreeVia(worktree string, calls []editCall, resolve func(worktree, realRoot, p string) (string, bool)) (rels []string, outside int)

func ResolveInsideMemo

func ResolveInsideMemo(worktree, realRoot, p string) (string, bool)

func TurnsOf

func TurnsOf(path string) (*turnIndex, error)

Types

type ChangeFile

type ChangeFile struct {
	Path    string `json:"path"`
	OldPath string `json:"old_path,omitempty"`
	// Status is added, modified, deleted, renamed or binary.
	Status string `json:"status"`
	// Size is the byte size of an untracked file listed with no body.
	Size    int64 `json:"size,omitempty"`
	Added   int   `json:"added"`
	Removed int   `json:"removed"`
	// Hunks is the unified diff as text. Empty for a binary file, and for a file whose diff was
	// over the bound, which HunksCut says.
	Hunks    string `json:"hunks"`
	HunksCut bool   `json:"hunks_cut,omitempty"`
	// Via, in a `turn` answer, is where the file's change was found: `edits` (uncommitted) or
	// `commits` (the turn committed it).
	Via string `json:"via,omitempty"`
	// Cumulative says the numbers include more than this turn: the transcript shows the file
	// edited in another turn since the last commit.
	Cumulative bool `json:"cumulative,omitempty"`
}

ChangeFile is one file in an answer.

type Changes

type Changes struct {
	Get        func(id string) (*store.Task, error)
	Transcript func(t *store.Task) string
	ListMax    int
}

Changes is what answering for one card reads from the daemon: the card, its transcript and the list bound.

func (Changes) For

func (c Changes) For(ctx context.Context, taskID, against string, turn time.Time) (any, error)

For answers the endpoint for one card.

type ChangesCut

type ChangesCut struct {
	// Files is how many files were left off the list.
	Files int `json:"files"`
	// Hunks is how many listed files carry counts and no hunks.
	Hunks int    `json:"hunks"`
	Why   string `json:"why"`
}

ChangesCut says what the bounds left out, so the view never claims to be the whole change.

type ChangesView

type ChangesView struct {
	// Against is head, base, or turn.
	Against string `json:"against"`
	// Note says why the answer is not the one asked for.
	Note  string       `json:"note,omitempty"`
	Base  string       `json:"base"`
	Head  string       `json:"head"`
	Dirty bool         `json:"dirty"`
	Total int          `json:"total"`
	Files []ChangeFile `json:"files"`
	Cut   *ChangesCut  `json:"cut,omitempty"`
	// Partial, Why and Outside are set on a `turn` answer. Outside counts edit paths that
	// resolved outside the worktree. It never names them.
	Partial *bool  `json:"partial,omitempty"`
	Why     string `json:"why,omitempty"`
	Outside int    `json:"outside,omitempty"`
}

ChangesView is the answer, for a card or for one turn.

type Config

type Config struct {
	Fork         func(ctx context.Context, spec ForkSpec) ([]byte, error)
	UserSettings func() []byte
	LeanArgs     func(args []string, userSettings []byte, gateway string) ([]string, error)
	ForkEnv      func(extra, harnessEnv map[string]string)
	ChildEnv     func(base []string, harnessEnv map[string]string, atrium map[string]string) []string
	Cost         func(raw []byte) float64
	OnAccess     func(kind string, err error) bool
	OnWorked     func(kind, host string)
	Hub          func() *forge.Remote
	HubSource    func(ctx context.Context, name string) (string, func(), error)
}

Config is what the daemon passes in: the seams a run reads and the board alert hooks. See pulls_fork.go.

type ForkSpec

type ForkSpec struct {
	Exe  string
	Args []string
	Dir  string
	Env  []string
	// Stdin is the prompt, too long for a command line.
	Stdin []byte
	// Timeout bounds the run.
	Timeout time.Duration
}

ForkSpec is one claude call's command line. The daemon runs it, see pulls_fork.go.

type PRRunner

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

PRRunner is the daemon's PRRunner.

func NewPRRunner

func NewPRRunner(st *store.Store, publish func(string), c Config) *PRRunner

func (*PRRunner) Abort

func (r *PRRunner) Abort(id string)

Abort cancels the run, which kills its forks. The API has already marked the row aborted and deletes the folder.

func (*PRRunner) ForgeFor

func (r *PRRunner) ForgeFor(host string) (forge.Forge, error)

func (*PRRunner) Start

func (r *PRRunner) Start(id string)

Start moves a queued row to fetching and runs it in the background. A row that is not queued is somebody else's run and is left alone.

func (*PRRunner) Stop

func (r *PRRunner) Stop()

Stop cancels every run, for the daemon's shutdown.

func (*PRRunner) Wait

func (r *PRRunner) Wait()

Wait blocks until every run has ended. For tests.

func (*PRRunner) Wired

func (r *PRRunner) Wired() bool

Wired says whether the daemon filled the board alert hooks.

type Receipt

type Receipt struct {
	Subtype           string            `json:"subtype"`
	IsError           bool              `json:"is_error"`
	Result            string            `json:"result"`
	NumTurns          int               `json:"num_turns"`
	SessionID         string            `json:"session_id"`
	PermissionDenials []json.RawMessage `json:"permission_denials"`
	Usage             *struct {
		Input      int64 `json:"input_tokens"`
		CacheWrite int64 `json:"cache_creation_input_tokens"`
		CacheRead  int64 `json:"cache_read_input_tokens"`
		Output     int64 `json:"output_tokens"`
	} `json:"usage"`
}

Receipt is the part of `claude -p --output-format json` a run reads.

Jump to

Keyboard shortcuts

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