asks

package
v0.69.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 21 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

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

View Source
const (
	ByPane      = "pane"      // typed in the agent's own pane
	ByAsks      = "asks"      // f10 inbox answer, or its walk
	BySkill     = "skill"     // /f10:inbox
	ByDrive     = "drive"     // f10 start --answer
	ByCancelled = "cancelled" // its drive was cancelled
	ByAPI       = "api"       // a client of the control-plane API
)

Ways in an ask was answered by.

View Source
const (
	AskIcon   = "\U000F1738"
	InboxIcon = "\U000F0687"
)

Nerd Font Material Design icons, the only range Claude Code keeps: md-chat_question heads a banner, md-inbox marks the inbox's counts and rows.

View Source
const BannerFooter = "Answer here, or /f10:inbox from the main session"

BannerFooter is the banner's last line: where an answer goes.

Variables

This section is empty.

Functions

func Banner(a Ask, name string) string

Banner renders a as the one shape every way in prints it. It renders the questions Parse read, so what the user sees is what an answer resolves against. name labels the task, such as project:task in a list spanning projects, or a terminal's link. Empty is the task id.

func Dir

func Dir() string

Dir is the inbox: F10_INBOX_DIR, else ~/.claude/f10/inbox, beside the run state and outside every project.

func Format

func Format(qs []Question, answers map[int]string) string

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

func Key(root, task string) string

Key names a task's ask: the project's hash, so two projects' FT-1 differ, and the task id.

func Labels added in v0.62.0

func Labels(a Ask) map[string]string

Labels are what f10 adds to an ask, kept out of the generic ask's fields.

func Letters

func Letters(opts []string) string

Letters lists options as `a) reuse, b) re-plan`.

func Lint added in v0.69.0

func Lint(qs []Question) []string

Lint names each question that lists choices in its text but has no bracketed options, so the walk could not offer them as choices.

func Message added in v0.62.0

func Message(a Ask) *agentsv1.Ask

Message is an inbox ask as agents.v1 carries it, for the API and the ledger alike: what f10 adds (the task, its project and drive) goes in the labels, so the core grows no task field.

func ProjectHash added in v0.68.0

func ProjectHash(root string) string

ProjectHash names a project by its storage root: the prefix of every ask key under it, which the status line globs without opening a file.

func Prune

func Prune(dir string, now time.Time)

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

func Resolve(q Question, value string) (string, error)

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.

func Sentences added in v0.69.0

func Sentences(text string) []string

Sentences splits text after a ., ? or ! that a space and an upper-case letter or a digit follow, so "e.g. this" and "v0.68.0" stay whole.

func Source added in v0.62.0

func Source(by string) agentsv1.AnswerSource

Source is the way in an answer came by, as agents.v1 names it.

func Update

func Update(dir, key string, fn func(a *Ask)) error

Update rewrites the answered ask key through fn.

func Way

func Way(by string) string

Way names a way in for a sentence: `in its pane`, `with f10 inbox`.

Types

type Ask

type Ask struct {
	Task      string     `yaml:"task"              json:"task"`
	URL       string     `yaml:"url,omitempty"     json:"url,omitempty"`
	Root      string     `yaml:"root"              json:"root"`              // the storage root
	Main      string     `yaml:"main,omitempty"    json:"main,omitempty"`    // the main checkout, where a drive is resumed from
	Project   string     `yaml:"project,omitempty" json:"project,omitempty"` // the main checkout's basename, for display
	Worktree  string     `yaml:"worktree"          json:"worktree"`          // the asking agent's checkout
	Suffix    string     `yaml:"suffix,omitempty"  json:"suffix,omitempty"`  // the agent's name suffix, for a second attempt at a task
	Pane      string     `yaml:"pane,omitempty"    json:"pane,omitempty"`    // the asking agent's herdr pane, reported blocked while open
	Drive     int        `yaml:"drive,omitempty"   json:"drive,omitempty"`   // the drive whose task asks, 0 for none
	Skill     string     `yaml:"skill,omitempty"   json:"skill,omitempty"`   // where it asked; finish for finish's own question
	Text      string     `yaml:"text"              json:"text"`              // the ask as written, one line
	Context   string     `yaml:"context,omitempty" json:"context,omitempty"` // background kept apart from the questions
	Questions []Question `yaml:"questions"         json:"questions"`
	AskedAt   time.Time  `yaml:"asked_at"          json:"asked_at"`

	Answer     string    `yaml:"answer,omitempty"      json:"answer,omitempty"` // what the agent, or finish, receives
	By         string    `yaml:"by,omitempty"          json:"by,omitempty"`     // which way in answered it
	AnsweredAt time.Time `yaml:"answered_at,omitempty" json:"answered_at,omitzero"`
	// 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" json:"delivered_at,omitzero"`
	// TakenAt is when a drive acted on the answer, so no later run of it
	// acts again
	TakenAt time.Time `yaml:"taken_at,omitempty" json:"taken_at,omitzero"`
}

An Ask is one question set a driven agent, or a drive's finish, stopped on.

func Answered

func Answered(dir string, since time.Time) ([]Ask, error)

Answered lists asks answered since, oldest answer first.

func AnsweredIn added in v0.68.0

func AnsweredIn(dir, root string, since time.Time) ([]Ask, error)

AnsweredIn is Answered for the project at root, every project when empty.

func Claim

func Claim(dir, key, by, answer string, delivered bool, now time.Time) (Ask, error)

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 Get

func Get(dir, key string) (*Ask, bool, error)

Get is the open ask key, else its answered one, with whether it is open.

func Open

func Open(dir string) ([]Ask, error)

Open lists the open asks, oldest first.

func OpenIn added in v0.68.0

func OpenIn(dir, root string) ([]Ask, error)

OpenIn lists the open asks of the project at root, every project's when root is empty.

func Raise

func Raise(dir string, a Ask, now time.Time) (Ask, bool, error)

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.

func Untaken

func Untaken(dir, root string) ([]Ask, error)

Untaken lists answered asks under root that no drive has acted on.

func (*Ask) Key

func (a *Ask) Key() string

Key is the ask's own key.

func (*Ask) ParseText added in v0.69.0

func (a *Ask) ParseText()

ParseText sets a's questions from its text, and adds any background written before question 1 to its context.

type ClosedError

type ClosedError struct {
	By string
	At time.Time
}

ClosedError is an ask no longer open: another way in answered it first.

func (ClosedError) Error

func (e ClosedError) Error() string

type Inbox added in v0.62.0

type Inbox struct {
	Open     []Ask                        `json:"open"`
	Answered []Ask                        `json:"answered"`
	Links    map[string]map[string]string `json:"links,omitempty"`
}

An Inbox is the asks a list shows, open then answered, with the task urls known for them by display project and task id, so a terminal's list links them.

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.

func Parse

func Parse(text string) []Question

Parse splits `1. Reuse the plan? [reuse | re-plan] 2. ...` into questions. Text with no question numbered 1 is one free-text question, so an odd ask still reaches the user whole. Split also keeps the prose before question 1.

func Split added in v0.69.0

func Split(text string) (string, []Question)

Split is Parse that also returns the prose before question 1, the background an agent wrote first, so it never swallows the questions.

func (Question) Default

func (q Question) Default() string

Default is the answer the question takes when none is given.

type Recovered added in v0.69.0

type Recovered struct {
	Context  string
	Question Question
	Note     string
}

Recovered is a question whose choices were written as prose, laid out as the walk shows it. The recommended option comes first as the default, and Note keeps why it is recommended.

func Recover added in v0.69.0

func Recover(q Question) (Recovered, bool)

Recover finds the choices that a question without options lists in its text, so the walk can offer them. It recovers every shape Lint warns about. The stored ask stays as it was.

Jump to

Keyboard shortcuts

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