Documentation
¶
Overview ¶
Package start opens a task: its checkout, its workspace and its agent, prompted, or a PR picked up to continue.
Index ¶
- Variables
- func AfterFromBody(ctx context.Context, tr stack.Tracker, main string, task ref.Ref) (string, []string, error)
- func AgentArgs(p agentctl.Profile, root storage.Root, worktree string) []string
- func Discussing(ctx context.Context, t *target.Target) (string, error)
- func FetchPickup(ctx context.Context, main string, pick *hostops.Pickup) error
- func MarkStarted(ctx context.Context, started func(context.Context, ref.Ref) error, ...) []string
- func PickedTask(prefix string, hostIssues bool, pick *hostops.Pickup, pr forge.PR, task string) (string, error)
- func PickupFor(ctx context.Context, t *target.Target, token string) (*hostops.Pickup, forge.PR, error)
- func RefuseFlags(req Request) error
- func RefuseLandedPlan(mode string, pick *hostops.Pickup) error
- func RefuseNote(mode string, pick *hostops.Pickup, note string) error
- func RefusePickupFlags(flow, after, base string) error
- func RefuseStalled(in StallCheck, ws *agentctl.Workspace, agent, root string) error
- func Start(ctx context.Context, w io.Writer, in StartInput) error
- func StartedMove(t *target.Target) func(context.Context, ref.Ref) error
- func SwitchNote(labels, dropped []string, profile string) string
- func WriteLaunched(ctx context.Context, w io.Writer, in StartInput, l Launched) error
- type ForwardInput
- type Forwarded
- type HandOver
- type Launched
- type OpenedTask
- type Request
- type StallCheck
- type StartInput
- type Switch
Constants ¶
This section is empty.
Variables ¶
var ClosedStart = func(ctx context.Context, t *target.Target, ids []string) []string {
return closedCheckFor(t).all(ctx, ids)
}
ClosedStart is the labels of the closed tasks when the start should open a discussion instead, else nil. It switches when every task is closed with no branch, or when a bundle has a closed member, because the drive judges a bundle by its lead and would ship that member again. A failed read counts as open, so the check never blocks a start. A var, so a test of a caller fakes the tracker's answer.
Functions ¶
func AfterFromBody ¶
func AfterFromBody(ctx context.Context, tr stack.Tracker, main string, task ref.Ref) (string, []string, error)
AfterFromBody reads the task's body for an After: line. A body that cannot be read is a note, never a refusal: --after stays the explicit way.
func AgentArgs ¶
AgentArgs is the agent's command line: the profile's flags through its kind, and each task-file dir of the storage root when that root sits outside the worktree, so writing plans and findings there asks no permission.
func Discussing ¶ added in v0.64.0
Discussing is the branch of t's checkout when a discussion opened it, else "": a start run there hands the worktree on.
func FetchPickup ¶
FetchPickup: a handover has not fetched the request's branch yet. A landed request's commit must be here before its worktree is made, and a closed request's head comes only through the host's own ref for it.
func MarkStarted ¶
func MarkStarted(ctx context.Context, started func(context.Context, ref.Ref) error, task ref.Ref) []string
MarkStarted moves every member to its started status. The worktree is the result, so a failure is a note, never a refusal.
func PickedTask ¶
func PickedTask(prefix string, hostIssues bool, pick *hostops.Pickup, pr forge.PR, task string) (string, error)
PickedTask is the task id for a picked-up PR: --task, else the one the PR names. A PR naming none exits with ui.ExitDeclined, which the start skill turns into a question; --task with no PR is a refusal.
func PickupFor ¶
func PickupFor(ctx context.Context, t *target.Target, token string) (*hostops.Pickup, forge.PR, error)
PickupFor is the PR the start argument names, or nil for a task id; a bare #n the host knows as no PR is a task id.
func RefuseFlags ¶ added in v0.62.0
RefuseFlags refuses the exclusive pairs before anything is looked up.
func RefuseLandedPlan ¶ added in v0.62.0
RefuseLandedPlan stops --plan on a merged or closed PR: its diff is no starting point once it landed, and going on from it is a task of its own.
func RefuseNote ¶ added in v0.62.0
RefuseNote stops a note no prompt can carry: only the prompts that stop and wait are plain text, and a driven chain's arguments belong to its skills.
func RefusePickupFlags ¶ added in v0.62.0
RefusePickupFlags stops the flags a picked-up PR has no use for: its branch and base are the PR's, and nobody ships someone else's PR unread.
func RefuseStalled ¶
func RefuseStalled(in StallCheck, ws *agentctl.Workspace, agent, root string) error
RefuseStalled stops a drive's prompt to an agent idle while its run says running: it may sit on a permission dialog, and a new skill prompt typed there could answer it. Forward reads the screen instead (forwardReady).
func Start ¶
Start runs the flow: the checkout and its agent, the prompt, the report. A workspace Herdr already showed keeps its agent, and nothing is prompted twice; one left with no agent gets its agent and its prompt.
func StartedMove ¶
StartedMove moves a task to tracker.status's started word, or is nil when none is declared.
func SwitchNote ¶ added in v0.65.0
SwitchNote is the line a start that became a discussion prints, naming the flags a discussion has no use for.
func WriteLaunched ¶ added in v0.62.0
WriteLaunched is start's report on l.
Types ¶
type ForwardInput ¶ added in v0.62.0
type ForwardInput struct {
Main string // the main checkout: worktrees are its siblings
Here string // the checkout the caller answers for: a task here is not forwarded
Driver *trackerdriver.Driver // nil without one
Task ref.Ref
Suffix string
Text string // what the agent is told, before the marker
StateDir string // where run state lives, for the note on where the text lands
Ttl time.Duration // how long a run counts as live
Now time.Time
Since time.Time // runs last updated before it are not read: the agent that wrote them is gone
}
ForwardInput is everything forward needs once the target is settled, so the flow can be tested without a checkout.
type Forwarded ¶ added in v0.62.0
Forwarded is where a forward went: the workspace, the text as sent, and the notes: where the text lands and what the Enter check saw.
func Forward ¶ added in v0.62.0
func Forward(ctx context.Context, in ForwardInput) (Forwarded, error)
Forward hands text to the agent working on in.Task in another checkout. Every refusal comes before the one thing that leaves this process.
func ForwardReport ¶ added in v0.62.0
ForwardReport hands the text on and reports where it went, as f10 forward prints it.
type HandOver ¶ added in v0.64.0
type HandOver struct {
Main, Path string // the main checkout, and the discussion's worktree
Branch string // the discussion's branch
Task ref.Ref
Suffix string
Name string // the branch name a start for Task gives
Tracker stack.Tracker
}
A HandOver is a discussion's worktree given to the first group of the start that ends it: the branch and the agent take the lead's names, so the drive finds both as that task's.
func PrepareHandOver ¶ added in v0.64.0
PrepareHandOver settles the hand-off of the discussion's branch to the start's first token; every refusal happens here, before anything moves.
type Launched ¶ added in v0.62.0
type Launched struct {
OpenedTask
Agent string
}
Launched is a started task: what OpenTask opened, and the agent that works on it.
type OpenedTask ¶
type OpenedTask struct {
Task ref.Ref // the task, with the riders its branch ships
Branch string
Path string
Ws agentctl.Opened
Dep *launch.Dependency
Plan string // the task's plan the worktree reads, or "" when none was saved or no agent was started
Fresh bool
Notes []string
// Profile is what the agent was started on, when fresh; a report names
// it when it is not the kind's default
Profile agentctl.Profile
// contains filtered or unexported fields
}
An OpenedTask is what OpenTask leaves behind; fresh says this call is to start the agent, which deliver does with its first prompt.
func OpenTask ¶
func OpenTask(ctx context.Context, in StartInput) (OpenedTask, error)
OpenTask runs everything start does short of starting and prompting the agent, which deliver does with the first text. Every lookup that can refuse runs before the first thing is created, the worktree; drive adopts main's plan too but prompts the agent itself, skill by skill.
func (*OpenedTask) Deliver ¶
Deliver sends text to the task's agent, starting it when its launch is pending: on its command line when the kind takes a first prompt, else typed right after. It names the agent that took the text, and typed says the text went through the input box, where its Enter can be lost.
type Request ¶ added in v0.62.0
type Request struct {
Token string // the task id, with an optional suffix, or a PR url or #n
Mode string // "" ships; launch.ModePlan or launch.ModeDiscuss stop earlier
Flow string
Pace string
After string // the task this one builds on
Base string // a branch to start from
Task string // the task a picked-up PR is for
Agent string
Model string
Note string
Also []string // the other tasks a discussion covers, after Token
}
A Request is a start as its caller words it: the task or PR, how far the agent runs, and the flow, pace, base and agent profile, any of them empty.
type StallCheck ¶
A StallCheck is what RefuseStalled reads run state with: runs updated before since were written by an agent that is gone.
type StartInput ¶
type StartInput struct {
Main string // the main checkout: worktrees are its siblings
Driver *trackerdriver.Driver // nil without one
Task ref.Ref
Suffix string
Mode string
Flow runplan.ShipFlow // the flow ship runs; zero for default
FlowKept bool // drive records the flow and the pace itself, keeping what the branch has
Pace string // the --pace typed, recorded on the branch; "" records none
After string // task id whose branch is the base and whose plan is the contract, or ""
Base string // branch whose ref is the base, or ""
Storage storage.Root // the storage root every checkout shares
Title func(context.Context) (string, error) // the task's title, for the default branch's slug; nil when nothing answers
Notes []string // notes settled before the flow, printed beneath the report
// Profile is what the agent starts on, resolved; profileFlagged says a
// flag chose it, which wins over the profile the branch recorded
Profile agentctl.Profile
ProfileFlagged bool
Progress io.Writer // where a wait in progress is reported, or nil for nowhere
Pick *hostops.Pickup // the PR picked up, or nil for a task started by its id
Note string // the user's words after the id, for the agent before it waits, or ""
// Discussion is what a discussion of a parent or of several tasks
// covers, nil for any other start
Discussion *launch.Discussion
// Closed is the discussed tasks the tracker already closed, each with
// what shipped it
Closed []launch.Closed
// Started moves a task to tracker.status's started word; nil when none
// is declared, or for a PR picked up, whose task someone else started
Started func(ctx context.Context, task ref.Ref) error
}
StartInput is everything start needs once the target is settled, so the flow can be tested without a checkout.
type Switch ¶ added in v0.65.0
type Switch struct {
Note string // what the user is told first
Token string
Tasks []string // the other ids, after Token
After string
Base string
Agent string
}
A Switch is a flow start turned into a discussion, because every task it names is closed.
func ClosedSwitch ¶ added in v0.65.0
ClosedSwitch is the discussion the flow start a becomes when every task it names is closed, nil otherwise. The CLI and the API both call it, so the switch reads one way wherever a start comes from. A resume, a range or an answer goes on with a drive already agreed, so it is never switched. The daemon's own drive process is not switched either, because its caller already checked.