today

package
v0.145.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 18 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 today is the N3 「今天」 decision home (design docs/design/2026-10-09-n3-today-decision-home-design.md §1/§2): it folds every "a person must decide" signal — pending interactions, OPEN decisions, relay turns, needs_review jobs, jobs held for approval, work items that wait for the person, the status / goal tidy-up suggestions, merge suggestions and blocked plans — into one ordered card queue, plus the one-line digest and the status bar. It only READS existing sources: every card action maps to an existing write API, which the console calls directly.

The httpapi layer binds / validates and forwards here (G021).

Index

Constants

View Source
const (
	AdviceTextRunes   = 60
	AdviceDigestLines = 5
)

Advice limits.

View Source
const (
	LaneWork = "work"
	LanePlan = "plan"
)

Lane kinds.

View Source
const (
	AgentRunning       = "running"
	AgentAwaitingInput = "awaiting_input"
	AgentIdle          = "idle"
)

Agent states on a lane.

View Source
const (
	PipDone        = "done"
	PipRunning     = "running"
	PipNeedsReview = "needs_review"
	PipFailed      = "failed"
	PipPending     = "pending"
)

Progress pip states (a plan's todo nodes).

View Source
const (
	MemoryActArchive = "archive"
	MemoryActMerge   = "merge"
	MemoryActKind    = "kind"
	MemoryActSummary = "summary"
	MemoryActWhen    = "when"
)

Memory suggestion actions.

View Source
const (
	// MemorySuggestDailyCap is how many memory suggestions may be created per local day.
	MemorySuggestDailyCap = 5
	// MemorySuggestCooldown keeps a dismissed (key, action) from being proposed again.
	MemorySuggestCooldown = 30 * 24 * time.Hour
)

Limits.

View Source
const (
	WokeTime     = "time"
	WokeJob      = "job"
	WokeActivity = "activity"
)

Wake reasons (Card.WokeReason).

View Source
const (
	KindInteraction = "interaction"
	KindDecision    = "decision"
	KindRelay       = "relay"
	// KindPermission is a terminal agent's tool permission prompt waiting on the web
	// (Claude Code PermissionRequest; only the session's owner may answer it).
	KindPermission = "permission"
	KindReview     = "review"
	// KindApproval is a job held for a person's approval (gofer-9b1b, status
	// awaiting_approval): approve it (it then runs) or reject it (cancelled, never run).
	KindApproval    = "approval"
	KindWork        = "work"
	KindSuggestion  = "suggestion"
	KindMerge       = "merge"
	KindPlanBlocked = "plan_blocked"
	// KindMemory is a steward's memory hygiene suggestion (memory_suggest.go).
	KindMemory = "memory"
)

Card kinds (DecisionCard.kind).

View Source
const (
	UrgencyNow      = "now"
	UrgencyBlocking = "blocking"
	UrgencyNormal   = "normal"
)

Urgency values. now = will time out soon, blocking = something waits on it.

View Source
const MaxHandledDays = 30

MaxHandledDays caps GET /v1/today/handled?days=.

View Source
const (
	// MaxSnoozeSec caps until_at (30 days ahead).
	MaxSnoozeSec = 30 * 86400
)
View Source
const SnoozeActionID = "snooze"

SnoozeActionID is the today.action audit id a snooze records.

Variables

View Source
var (
	// ErrInvalidAdvice is a malformed advice (text / digest / action).
	ErrInvalidAdvice = errors.New("today: invalid advice")
	// ErrUnknownCard is advice on a card that is not in the current queue.
	ErrUnknownCard = errors.New("today: no such card in the current queue")
)
View Source
var (
	// ErrInvalidMemorySuggestion is a malformed suggestion.
	ErrInvalidMemorySuggestion = errors.New("today: invalid memory suggestion")
	// ErrMemoryNotFound: the memory (or merge target) is not live in the server mirror.
	ErrMemoryNotFound = errors.New("today: memory not found in the server mirror")
	// ErrMemorySuggestCooldown: the same key + action was dismissed within the cooldown.
	ErrMemorySuggestCooldown = errors.New("today: dismissed recently")
	// ErrMemorySuggestCap: today's memory suggestions are used up.
	ErrMemorySuggestCap = errors.New("today: daily memory suggestion cap reached")
	// ErrMemorySuggestionStale: the memory (or merge target) changed after the suggestion
	// was made; the suggestion is marked stale instead of applied.
	ErrMemorySuggestionStale = errors.New("记忆在建议之后被改过,请重新整理")
)
View Source
var (
	// ErrInvalidSnooze is a malformed snooze request.
	ErrInvalidSnooze = errors.New("today: invalid snooze")
	// ErrCardNotQueued is a snooze for a card that is not in the queue (any more).
	ErrCardNotQueued = errors.New("today: card not in the queue")
)
View Source
var ErrInvalidAction = errors.New("today: invalid action")

ErrInvalidAction is a malformed POST /v1/today/actions body.

Functions

func ActionKey

func ActionKey(a Action) string

ActionKey is the stable id of a card action: answer actions are told apart by value (answer:<value>), the rest by id. Advice action_id uses it.

func Advisable

func Advisable(kind string, a Action) bool

Advisable reports whether an action of a card of this kind can be 「按建议」: a one-click decision — not a reply box, not a navigation link, and never an option of a decision card (the steward only adds background there; design §5).

func DiagnoseMirror

func DiagnoseMirror(recs []jobstore.TrackerRecord, now time.Time) map[string][]tracker.DoctorFinding

DiagnoseMirror runs the server-side doctor over mirrored records and returns the findings per key (keys without findings are absent).

func MirrorMemories

func MirrorMemories(recs []jobstore.TrackerRecord) []tracker.Memory

MirrorMemories decodes the live (non-tombstone) mirrored memories.

func SortCards

func SortCards(cards []Card)

SortCards orders the queue: urgency=now first (soonest deadline first), then score descending, then the longest wait first; the key breaks remaining ties.

func SortLanes

func SortLanes(lanes []Lane)

SortLanes orders lanes worst health first, then a lane with a running agent before one without, then the most recent activity, then the id (stable).

func TopoTodos

func TopoTodos(todos []jobstore.PlanTodo) []jobstore.PlanTodo

TopoTodos orders a plan's todos so every item comes after the items it waits for (`after`), keeping the display order among items that are free at the same time. Unknown dependencies are ignored; a cycle falls back to display order for the rest.

func ValidMemoryAction

func ValidMemoryAction(action string) bool

ValidMemoryAction reports whether action is a known memory suggestion action.

Types

type Action

type Action struct {
	ID           string `json:"id"`
	Label        string `json:"label"`
	Style        string `json:"style,omitempty"`
	Value        string `json:"value,omitempty"`
	NeedsText    bool   `json:"needs_text,omitempty"`
	OptionalText bool   `json:"optional_text,omitempty"`
}

Action is one card button. ID names the existing write API the console calls (answer / reply / ack / accept / rerun / diff / report / park / adopt / dismiss / resume / approve / reject / open); Value is the answer token for answer actions. NeedsText asks for a text the action cannot go without; OptionalText offers a text box the person may leave empty (an approval card's 「拒绝」 reason).

type ActionInput

type ActionInput struct {
	CardKey        string `json:"card_key"`
	ActionID       string `json:"action_id"`
	AdviceActionID string `json:"advice_action_id,omitempty"`
	Title          string `json:"title,omitempty"`
	Label          string `json:"label,omitempty"`
	Kind           string `json:"kind,omitempty"`
	// T4: the advice text / its action label at that moment, and whether the person
	// clicked 「按建议」. A missing advice is filled from the stored one.
	AdviceText  string `json:"advice_text,omitempty"`
	AdviceLabel string `json:"advice_label,omitempty"`
	ViaAdvice   bool   `json:"via_advice,omitempty"`
}

ActionInput is what the console records after a card action succeeded (design §2.3): the card, the action it took, the steward's advice action at that moment (T4), and the display bits the 「已处理」 drawer shows once the card is gone.

type Advice

type Advice struct {
	Text     string `json:"text"`
	ActionID string `json:"action_id,omitempty"`
	Digest   string `json:"digest,omitempty"`
	By       string `json:"by,omitempty"`
	At       int64  `json:"at,omitempty"`
}

Advice is the steward's one-line suggestion (T4, advice.go): ActionID (an ActionKey of the card) becomes the 「按建议:X」 button, Digest (≤5 lines) sits in 「详情」.

type AdviceInput

type AdviceInput struct {
	CardKey  string `json:"card_key"`
	Text     string `json:"text"`
	ActionID string `json:"action_id,omitempty"`
	Digest   string `json:"digest,omitempty"`
}

AdviceInput is POST /v1/today/advice and gofer_today_advise.

type Approval added in v0.137.0

type Approval struct {
	Reason        string   `json:"reason,omitempty"`
	Origin        string   `json:"origin,omitempty"`
	Command       []string `json:"command,omitempty"`
	PromptPreview string   `json:"prompt_preview,omitempty"`
	TimeoutSec    int      `json:"timeout_sec,omitempty"`
}

Approval is the hard data of an approval card's 「详情」 (gofer-9b1b): why the job is held, who submitted it, and what it would run (an exec job's argv, or the head of an agent job's prompt) — the full thing is on the job page.

type Blocks

type Blocks struct {
	Score int    `json:"score"`
	Items int    `json:"items"`
	Text  string `json:"text,omitempty"`
}

Blocks says what a card holds up (design §2.2). Score drives the ordering, Items is the count behind the short 「卡住 N」 label and Text lists the sources.

type Card

type Card struct {
	Key          string       `json:"key"`
	Kind         string       `json:"kind"`
	Tag          string       `json:"tag"`
	Urgency      string       `json:"urgency"`
	Blocks       Blocks       `json:"blocks"`
	Title        string       `json:"title"`
	ProjectKey   string       `json:"project_key,omitempty"`
	Agent        string       `json:"agent,omitempty"`
	WaitingSince int64        `json:"waiting_since"`
	ExpiresAt    int64        `json:"expires_at,omitempty"`
	ActivityAt   int64        `json:"activity_at"`
	Summary      string       `json:"summary"`
	Review       *Review      `json:"review,omitempty"`
	Approval     *Approval    `json:"approval,omitempty"`
	Suggestions  []Suggestion `json:"suggestions,omitempty"`
	Memory       *MemoryCard  `json:"memory,omitempty"`
	Refs         Refs         `json:"refs"`
	Actions      []Action     `json:"actions"`
	Advice       *Advice      `json:"advice"`
	// Woke marks a card back from 「稍后」; WokeReason is time / job / activity (snooze.go).
	Woke       bool   `json:"woke,omitempty"`
	WokeReason string `json:"woke_reason,omitempty"`
}

Card is one DecisionCard.

type Deps

type Deps struct {
	Store   *jobstore.Store
	Work    *work.Service
	Steward StewardStatus
	Runners func() RunnerStatus
	Version func() string
	Now     func() time.Time
}

Deps are the sources the service reads.

type Digest

type Digest struct {
	SinceLast  SinceLast `json:"since_last"`
	Title      string    `json:"title"`
	Text       string    `json:"text"`
	Commentary string    `json:"commentary,omitempty"`
}

Digest is the folded one-line digest plus today's work digest (work.BuildDigest).

type Handled

type Handled struct {
	At             int64  `json:"at"`
	Actor          string `json:"actor,omitempty"`
	CardKey        string `json:"card_key"`
	Kind           string `json:"kind,omitempty"`
	Title          string `json:"title,omitempty"`
	ActionID       string `json:"action_id"`
	Label          string `json:"label,omitempty"`
	AdviceActionID string `json:"advice_action_id,omitempty"`
	AdviceText     string `json:"advice_text,omitempty"`
	AdviceLabel    string `json:"advice_label,omitempty"`
	ViaAdvice      bool   `json:"via_advice,omitempty"`
}

Handled is one 「已处理」 row.

type Lane

type Lane struct {
	// ID is the work item id or the plan id.
	ID         string `json:"id"`
	Kind       string `json:"kind"`
	Title      string `json:"title"`
	ProjectKey string `json:"project_key,omitempty"`
	// Status is the work item status, or the plan status (open | blocked).
	Status       string       `json:"status"`
	Agents       []LaneAgent  `json:"agents"`
	Progress     LaneProgress `json:"progress"`
	Health       string       `json:"health"`
	HealthReason string       `json:"health_reason,omitempty"`
	StartedAt    int64        `json:"started_at"`
	ElapsedSec   int64        `json:"elapsed_sec"`
	// ActivityAt is the newest activity seen (the secondary sort key).
	ActivityAt int64      `json:"activity_at"`
	Usage      *LaneUsage `json:"usage,omitempty"`
	Links      LaneLinks  `json:"links"`
}

Lane is one row of 「并行中」.

type LaneAgent

type LaneAgent struct {
	Agent string `json:"agent"`
	// State is running | awaiting_input | idle.
	State string `json:"state"`
	// Kind is "session" (a terminal relay session) or "job"; Ref is its id.
	Kind string `json:"kind"`
	Ref  string `json:"ref"`
}

LaneAgent is one agent working on a lane: a terminal session or a job.

type LaneLinks struct {
	WorkItemID string   `json:"work_item_id,omitempty"`
	PlanID     string   `json:"plan_id,omitempty"`
	JobIDs     []string `json:"job_ids,omitempty"`
	SessionIDs []string `json:"session_ids,omitempty"`
}

LaneLinks are the jump targets of a lane.

type LanePip

type LanePip struct {
	TodoID string `json:"todo_id"`
	Title  string `json:"title"`
	// Status is done | running | needs_review | failed | pending.
	Status string `json:"status"`
}

LanePip is one todo node of a plan, in dependency order.

type LaneProgress

type LaneProgress struct {
	Pips []LanePip `json:"pips,omitempty"`
	// Current is the current step's title (plan) or the latest milestone's text.
	Current   string `json:"current,omitempty"`
	CurrentAt int64  `json:"current_at,omitempty"`
}

LaneProgress is a plan's todo pips plus its current step, or (without a plan) the latest milestone.

type LaneUsage

type LaneUsage struct {
	TotalTokens int64   `json:"total_tokens"`
	CostUSD     float64 `json:"cost_usd,omitempty"`
}

LaneUsage is the token / cost total behind a lane.

type LanesBuilder

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

LanesBuilder assembles the lanes from the work service and its store.

func NewLanesBuilder

func NewLanesBuilder(w *work.Service) *LanesBuilder

NewLanesBuilder builds over the work service (its store is the data source).

func (*LanesBuilder) Build

func (b *LanesBuilder) Build() (LanesView, error)

Build reads every lane, sorts them (blocked > stalled > at_risk > a running agent > the rest, then most recent activity) and sums the header.

func (*LanesBuilder) SetNow

func (b *LanesBuilder) SetNow(fn func() time.Time)

SetNow overrides the clock (tests).

type LanesSummary

type LanesSummary struct {
	Total         int `json:"total"`
	AgentsRunning int `json:"agents_running"`
	Attention     int `json:"attention"`
}

LanesSummary is the header line: total lanes, agents running, lanes needing attention (health not ok).

func Summarize

func Summarize(lanes []Lane) LanesSummary

Summarize counts the header line.

type LanesView

type LanesView struct {
	Lanes       []Lane       `json:"lanes"`
	Summary     LanesSummary `json:"summary"`
	GeneratedAt int64        `json:"generated_at"`
}

LanesView is the GET /v1/today/lanes body.

type MemoryCard

type MemoryCard struct {
	TrackerID      string        `json:"tracker_id"`
	Key            string        `json:"key"`
	Action         string        `json:"action"`
	Payload        MemoryPayload `json:"payload"`
	CurrentKind    string        `json:"current_kind,omitempty"`
	CurrentSummary string        `json:"current_summary,omitempty"`
	Age            string        `json:"age,omitempty"`
	Content        string        `json:"content,omitempty"`
}

MemoryCard is the 「详情」 of a memory card: the proposal and the memory as it is now.

type MemoryFinding

type MemoryFinding struct {
	TrackerID  string                  `json:"tracker_id"`
	ProjectKey string                  `json:"project_key,omitempty"`
	Key        string                  `json:"key"`
	Kind       string                  `json:"kind"`
	Summary    string                  `json:"summary,omitempty"`
	UpdatedAt  string                  `json:"updated_at,omitempty"`
	Age        string                  `json:"age,omitempty"`
	Findings   []tracker.DoctorFinding `json:"findings"`
	// Actions are the cleanups the findings call for that are still open: not pending as a
	// suggestion and not dismissed within the cooldown.
	Actions []string `json:"actions"`
	Content string   `json:"content,omitempty"`
}

MemoryFinding is one flagged mirrored memory (GET /v1/memory-findings, gofer_memory_findings).

type MemoryFindingsQuery

type MemoryFindingsQuery struct {
	TrackerID string
	// All keeps findings whose actions are already pending or were dismissed recently.
	All bool
}

MemoryFindingsQuery filters MemoryFindings.

type MemoryPayload

type MemoryPayload struct {
	// Into is the merge target key.
	Into string `json:"into,omitempty"`
	// Content is the merged body written to the target (merge; empty = target + source).
	Content  string   `json:"content,omitempty"`
	Kind     string   `json:"kind,omitempty"`
	Summary  string   `json:"summary,omitempty"`
	Keywords []string `json:"keywords,omitempty"`
}

MemoryPayload is the proposed value of a memory suggestion (only the field of its action).

type MemorySuggestInput

type MemorySuggestInput struct {
	TrackerID string        `json:"tracker_id"`
	Key       string        `json:"key"`
	Action    string        `json:"action"`
	Payload   MemoryPayload `json:"payload,omitempty"`
	Reason    string        `json:"reason"`
}

MemorySuggestInput is POST /v1/memory-suggestions and gofer_memory_suggest.

type MemorySuggestion

type MemorySuggestion struct {
	ID         int64         `json:"id"`
	TrackerID  string        `json:"tracker_id"`
	ProjectKey string        `json:"project_key,omitempty"`
	Key        string        `json:"key"`
	Action     string        `json:"action"`
	Payload    MemoryPayload `json:"payload"`
	// Text is the one-line proposal (「建议归档」「建议合并到 x」…).
	Text      string `json:"text"`
	Reason    string `json:"reason"`
	State     string `json:"state"`
	By        string `json:"by,omitempty"`
	CreatedAt int64  `json:"created_at"`
	DecidedAt int64  `json:"decided_at,omitempty"`
	DecidedBy string `json:"decided_by,omitempty"`
	Note      string `json:"note,omitempty"`
}

MemorySuggestion is the API view of one suggestion.

type Query

type Query struct {
	// Since is the 「自上次打开」 watermark (unix seconds); 0 = local midnight today.
	Since int64
	// IncludeExec also lists needs_review jobs of the exec agent (off by default).
	IncludeExec bool
}

Query is the GET /v1/today input.

type Refs

type Refs struct {
	JobID         string `json:"job_id,omitempty"`
	InteractionID string `json:"interaction_id,omitempty"`
	DecisionID    string `json:"decision_id,omitempty"`
	// DecisionIDs (relay cards) are every unread open turn of the session, oldest
	// first: 「已读」 acks them all, since the card stands for all of them.
	DecisionIDs []string `json:"decision_ids,omitempty"`
	SessionID   string   `json:"session_id,omitempty"`
	ThreadID    string   `json:"thread_id,omitempty"`
	WorkItemID  string   `json:"work_item_id,omitempty"`
	PlanID      string   `json:"plan_id,omitempty"`
	TodoID      string   `json:"todo_id,omitempty"`
	Field       string   `json:"field,omitempty"`
	MergeID     int64    `json:"merge_id,omitempty"`
	// Memory cards: the suggestion id and the repo-tracker memory it is about.
	MemorySuggestionID int64  `json:"memory_suggestion_id,omitempty"`
	TrackerID          string `json:"tracker_id,omitempty"`
	MemoryKey          string `json:"memory_key,omitempty"`
}

Refs are the ids a card's actions and links need.

type Response

type Response struct {
	Digest    Digest `json:"digest"`
	Decisions []Card `json:"decisions"`
	// Snoozed counts the cards held back by an active 「稍后」 (T3, snooze.go).
	Snoozed     int    `json:"snoozed"`
	Status      Status `json:"status"`
	GeneratedAt int64  `json:"generated_at"`
}

Response is the GET /v1/today payload (design §2.1).

type Review

type Review struct {
	Commits int    `json:"commits"`
	Adds    int    `json:"adds"`
	Dels    int    `json:"dels"`
	Verify  string `json:"verify,omitempty"`
	Digest  string `json:"digest,omitempty"`
}

Review is the hard data of a review card's 「详情」.

type RunnerStatus

type RunnerStatus struct {
	Online  int      `json:"online"`
	Total   int      `json:"total"`
	Offline []string `json:"offline,omitempty"`
}

RunnerStatus is the runner part of the status bar, supplied by the server (it knows which workers are connected).

type Runners

type Runners struct {
	RunnerStatus
	RunningJobs int `json:"running_jobs"`
}

Runners is the runner part of the status bar plus the jobs running now.

type Service

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

Service builds the home page payloads.

func New

func New(d Deps) *Service

New returns a service over deps; a nil Now uses time.Now.

func (*Service) AdoptMemorySuggestion

func (s *Service) AdoptMemorySuggestion(id int64, by string) (MemorySuggestion, error)

AdoptMemorySuggestion applies a pending suggestion to the server copy of the memory and marks it adopted. A memory (or merge target) that is gone marks the suggestion stale and returns ErrMemoryNotFound; a memory changed since the suggestion (rev moved, or a concurrent write won the compare-and-set) marks it stale and returns ErrMemorySuggestionStale. Other errors leave it pending; adopting again is idempotent.

func (*Service) Advise

func (s *Service) Advise(in AdviceInput, by, jobID string) (Advice, error)

Advise validates and stores the advice for one card of the current queue. by is the speaker label (steward(<agent>) or human:<id>), jobID the steward's job when it wrote it.

func (*Service) CurrentAdvice

func (s *Service) CurrentAdvice(cardKey string) (*Advice, error)

CurrentAdvice reads one card's stored advice (nil when there is none).

func (*Service) Decisions

func (s *Service) Decisions(includeExec bool) ([]Card, error)

Decisions builds the ordered card queue.

func (*Service) DismissMemorySuggestion

func (s *Service) DismissMemorySuggestion(id int64, by string) (MemorySuggestion, error)

DismissMemorySuggestion records 「忽略」: the same key + action is not proposed again for MemorySuggestCooldown.

func (*Service) HandledSince

func (s *Service) HandledSince(days int) ([]Handled, error)

HandledSince lists the today.action rows of the last `days` days, newest first.

func (*Service) ListMemorySuggestions

func (s *Service) ListMemorySuggestions(state string) ([]MemorySuggestion, error)

ListMemorySuggestions lists suggestions in one state ("" = pending).

func (*Service) MemoryFindings

func (s *Service) MemoryFindings(q MemoryFindingsQuery) ([]MemoryFinding, error)

MemoryFindings runs the server-side doctor over every mirrored repository (or one).

func (*Service) MemoryHygiene

func (s *Service) MemoryHygiene() (steward.MemoryHygiene, error)

MemoryHygiene is the steward's trigger for the memory step of a review: the open findings (one signature per tracker/key/action) and how many suggestions today still allows. A review only wakes for signatures it has not been shown (steward side).

func (*Service) Now

func (s *Service) Now() time.Time

Now is the service clock.

func (*Service) PruneAdvice

func (s *Service) PruneAdvice() (int, error)

PruneAdvice drops the advice of every card that is gone; it returns how many it removed.

func (*Service) RecordAction

func (s *Service) RecordAction(in ActionInput, actor string) (Handled, error)

RecordAction appends one today.action audit row.

func (*Service) Snooze

func (s *Service) Snooze(in SnoozeInput, actor string) (SnoozedCard, error)

Snooze takes a card out of the queue and records the today.action audit.

func (*Service) Snoozed

func (s *Service) Snoozed(includeExec bool) ([]SnoozedCard, error)

Snoozed lists the cards that are snoozed right now (wake rules applied first).

func (*Service) Store

func (s *Service) Store() *jobstore.Store

Store exposes the underlying store (sibling aggregations reuse it).

func (*Service) SuggestMemory

func (s *Service) SuggestMemory(in MemorySuggestInput, by, jobID string) (MemorySuggestion, bool, error)

SuggestMemory validates and records one memory suggestion. recorded is false when the same key + action is already pending (that suggestion is returned).

func (*Service) Today

func (s *Service) Today(q Query) (Response, error)

Today builds the GET /v1/today payload.

func (*Service) UnadvisedCount

func (s *Service) UnadvisedCount() (int, error)

UnadvisedCount is len(UnadvisedKeys).

func (*Service) UnadvisedKeys

func (s *Service) UnadvisedKeys() ([]string, error)

UnadvisedKeys lists the keys of the queue's cards of the advised kinds that have no advice yet (the steward's review trigger and its prompt count).

func (*Service) Unsnooze

func (s *Service) Unsnooze(cardKey string) (bool, error)

Unsnooze puts a card back in the queue; ok is false when it was not snoozed.

type SinceLast

type SinceLast struct {
	Since      int64 `json:"since"`
	JobsDone   int   `json:"jobs_done"`
	JobsFailed int   `json:"jobs_failed"`
	Commits    int   `json:"commits"`
}

SinceLast is the 「自上次打开:完成 N · 失败 M · 新提交 K」 line.

type SnoozeInput

type SnoozeInput struct {
	CardKey    string `json:"card_key"`
	UntilAt    int64  `json:"until_at,omitempty"`
	UntilJobID string `json:"until_job_id,omitempty"`
}

SnoozeInput is the POST /v1/today/snooze body: exactly one of UntilAt / UntilJobID.

type SnoozedCard

type SnoozedCard struct {
	CardKey    string `json:"card_key"`
	Kind       string `json:"kind"`
	Tag        string `json:"tag,omitempty"`
	Title      string `json:"title"`
	ProjectKey string `json:"project_key,omitempty"`
	UntilAt    int64  `json:"until_at,omitempty"`
	UntilJobID string `json:"until_job_id,omitempty"`
	ExpiresAt  int64  `json:"expires_at,omitempty"`
	CreatedAt  int64  `json:"created_at"`
}

SnoozedCard is one 「已稍后」 row.

type Status

type Status struct {
	UsageToday   UsageToday   `json:"usage_today"`
	StewardToday StewardToday `json:"steward_today"`
	Runners      Runners      `json:"runners"`
	Version      string       `json:"version"`
	Alerts       []string     `json:"alerts"`
}

Status is the bottom status bar (design §1.4): runner, today's usage, the steward and the version, plus the alerts that turn an item red and move it first.

type StewardStatus

type StewardStatus interface {
	Status() steward.Status
}

StewardStatus reads the steward's live status (nil-safe through Deps).

type StewardToday

type StewardToday struct {
	Enabled   bool   `json:"enabled"`
	State     string `json:"state,omitempty"`
	Notes     int    `json:"notes"`
	Summaries int    `json:"summaries"`
	// Advice counts the cards the steward advised today (T4; a person's advice is not counted).
	Advice int    `json:"advice"`
	Review string `json:"review,omitempty"`
}

StewardToday is the steward's day: whether it runs, its state, the notes it wrote and the auto tidy-ups done today, and today's review state.

type Suggestion

type Suggestion struct {
	Field string `json:"field"`
	Value string `json:"value"`
	Text  string `json:"text"`
}

Suggestion is a pending tidy-up suggestion folded into a work card.

type UsageToday

type UsageToday struct {
	Jobs          int     `json:"jobs"`
	TotalTokens   int64   `json:"total_tokens"`
	CostUSD       float64 `json:"cost_usd"`
	SessionTokens int64   `json:"session_tokens"`
}

UsageToday sums today's job usage (by start time, server-local day) and today's terminal-session usage (OBS-14, tallied per UTC day).

Jump to

Keyboard shortcuts

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