Documentation
¶
Overview ¶
Package asks keeps the questions driven agents stop on in one per-user inbox, so the user can answer from anywhere. An ask is a file: open while it waits, moved to answered/ by the first answer from any way in.
Index ¶
- Constants
- func Dir() string
- func Format(qs []Question, answers map[int]string) string
- func Key(root, task string) string
- func Letters(opts []string) string
- func Prune(dir string, now time.Time)
- func Resolve(q Question, value string) (string, error)
- func Update(dir, key string, fn func(a *Ask)) error
- func Way(by string) string
- type Ask
- func Answered(dir string, since time.Time) ([]Ask, error)
- func Claim(dir, key, by, answer string, delivered bool, now time.Time) (Ask, error)
- func Get(dir, key string) (*Ask, bool, error)
- func Open(dir string) ([]Ask, error)
- func Raise(dir string, a Ask, now time.Time) (Ask, bool, error)
- func Untaken(dir, root string) ([]Ask, error)
- type ClosedError
- type Question
Constants ¶
const ( ByPane = "pane" // typed in the agent's own pane ByAsks = "asks" // f10 asks answer, or its walk BySkill = "skill" // /f10:asks ByDrive = "drive" // f10 drive --answer ByCancelled = "cancelled" // its drive was cancelled )
Ways in an ask was answered by.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
func Dir() string
Dir is the inbox: F10_ASKS_DIR, else ~/.claude/f10/asks, beside the run state and outside every project.
func Format ¶
Format renders answers, by question number, as `1. re-plan 2. wait`, numbered as the ask was; a question with no answer takes its default.
func Key ¶
Key names a task's ask: the storage root's hash, so two projects' FT-1 differ, and the task id.
func Prune ¶
Prune drops answered asks older than a week, and open ones whose worktree is gone: a task finished or removed has no agent left to ask.
func Resolve ¶
Resolve maps value to an option by letter (`b`), number (`2`) or text; free text answers only a question without options, so a typo never picks a choice.
Types ¶
type Ask ¶
type Ask struct {
Task string `yaml:"task"`
URL string `yaml:"url,omitempty"`
Root string `yaml:"root"` // the storage root
Main string `yaml:"main,omitempty"` // the main checkout, where a drive is resumed from
Project string `yaml:"project,omitempty"` // the main checkout's basename, for display
Worktree string `yaml:"worktree"` // the asking agent's checkout
Suffix string `yaml:"suffix,omitempty"` // the agent's name suffix, for a second attempt at a task
Drive int `yaml:"drive,omitempty"` // the drive whose task asks, 0 for none
Skill string `yaml:"skill,omitempty"` // where it asked; finish for finish's own question
Text string `yaml:"text"` // the ask as written, one line
Questions []Question `yaml:"questions"`
AskedAt time.Time `yaml:"asked_at"`
Answer string `yaml:"answer,omitempty"` // what the agent, or finish, receives
By string `yaml:"by,omitempty"` // which way in answered it
AnsweredAt time.Time `yaml:"answered_at,omitempty"`
// DeliveredAt is when the answer reached the agent: at once when typed in
// its pane or prompted by the answering command, else when a drive sends it
DeliveredAt time.Time `yaml:"delivered_at,omitempty"`
// TakenAt is when a drive acted on the answer, so no later run of it
// acts again
TakenAt time.Time `yaml:"taken_at,omitempty"`
}
An Ask is one question set a driven agent, or a drive's finish, stopped on.
func Claim ¶
Claim answers the open ask key; the first claim wins and a later one gets ClosedError naming the winner. delivered says the answer already reached the agent; delivered with no drive to take it, the ask is marked taken.
func Raise ¶
Raise reports whether a is new. An open ask with the same text is the same ask, and so is an answered one no drive has taken yet: it keeps its time and answer and takes what a adds (the drive, the url), so the agent's ask and its drive's report tell the user once. An answer the agent already heard, with no drive to take it, is done: asking again is a new ask.
type ClosedError ¶
ClosedError is an ask no longer open: another way in answered it first.
func (ClosedError) Error ¶
func (e ClosedError) Error() string
type Question ¶
type Question struct {
N int `json:"n" yaml:"n"`
Text string `json:"text" yaml:"text"`
Options []string `json:"options,omitempty" yaml:"options,omitempty"`
}
A Question is one numbered question of an ask; Options[0] is the default.