view

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 16 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 view is the dashboard's model: one account's row, and every cell a human table renders it into.

It exists so that a renderer outside package cli can exist at all. Package cli exports nine identifiers and none of them is a row, so a second renderer would have had to spell every percentage, every reset span and every "could not be read" a second time — and the two spellings would agree until the day one of them changed. That `ccdad status` and the terminal dashboard can never disagree is a property of there being ONE of each of these, not of two of them being written carefully.

Nothing here reads the clock, the filesystem or the environment. A Row is built from documents somebody else read.

Index

Constants

View Source
const (
	IdxHeader     = "IDX"
	AccountHeader = "ACCOUNT"
	TypeHeader    = "TYPE"
	TierHeader    = "TIER"
	WorstHeader   = "WORST"
	StateHeader   = "STATE"
	AutoHeader    = "AUTO"
	AgeHeader     = "AGE"
)

The heading each fixed column carries. The window and reset headings are the fleet's own and come off Columns.

View Source
const (
	ClaudeSection = "CLAUDE"
	CodexSection  = "CODEX"
)

The heading over each provider's rows.

Bare, all-caps and 7-bit, six display columns and five, which is what makes them safe in the one place they are drawn: a section heading is a table row carrying its text in the ACCOUNT cell, and the narrowest ACCOUNT is ever squeezed to is twelve columns. Both fit inside twelve at every width, so a heading can never be cut -- and a cut heading would read as a provider name that is not one.

Neither shares a substring with the `Codex:` that `ccdad status` prints in front of the codex half of the Active line, which three tests grep for case-sensitively to assert its ABSENCE. "CODEX" does not contain "Codex:" and "Codex:" does not contain "CODEX", so a sectioned table cannot make one of those greps pass or fail for a reason that has nothing to do with the line it is about.

View Source
const HeaderBudget = 10

HeaderBudget is the widest a window header may be, in display columns.

A scoped cap's display name is arbitrary wire text and the whole name is worse: `weekly_scoped:model:Fable` is 25 columns against a dashboard cell that reserves 20, and nothing between the cell and the terminal cut it, so the overflow came off the right where other columns live.

View Source
const HoverNote = "hover:    the live account is kept until it is handed off one point before any window's limit, " +
	"or earlier when the work running now would run it out within minutes of its next reading, " +
	"or, off a weekly-only account, once the work has rested an hour and another weekly-only account is at its limit; " +
	"then five-hour accounts first, then the soonest weekly reset"

HoverNote is the sentence a hover table prints under itself: the rule that moves the session, which no cell shows. The order lines follow it.

View Source
const HoverRecoveryNote = "hover:    recovery: every account is past its last point; accounts with something left come " +
	"before empty ones, and within each, those back within the hour come first, soonest first, " +
	"then the rest, the least past its line first"

HoverRecoveryNote is the line that says the order below it is the recovery order rather than hover's, and states that order's keys in the order strategy's lessRecovery applies them: an account with anything left before an empty one, then one back within the recovery horizon (an hour, strategy.DefaultRecoveryHorizon) before one that is not, the soonest first, and the rest by how little they are past their line.

View Source
const NoQuantity = "-"

NoQuantity is what a cell renders when the quantity does not exist here, as against Unreadable's "somebody tried to read it and could not". The two are different verdicts and both appear in one rendered row: an account with no cached reading has an unknown percentage and no window to name, so its USED cell is "?" and its WINDOW cell is "-". Collapsing them would tell a reader that a quantity which cannot exist merely went unread, and send them looking for the reading.

View Source
const PlaceholderHeader = "QUOTA"

PlaceholderHeader is the one quota column a table shows when no visible row carried a readable window.

The block is never omitted. A table that simply stopped having quota columns would look like a build with no quota feature rather than like a fleet nobody could read, and the cells under this header are all Unreadable, which is the honest statement.

View Source
const Unreadable = "?"

Unreadable is what a value that could not be read renders as. Never "0%" -- unknown is never read as zero, and cswap's version of that bug parked its engine on the account that reset last, because one expired token made every account look empty.

Variables

This section is empty.

Functions

func ActiveLine added in v0.11.0

func ActiveLine(claude, codex string) string

ActiveLine is who this machine is spending, in ONE line, for `ccdad which` and for nothing else.

One line is what `which` is: a command written to be read by a shell, whose whole output is the answer. Every surface with room for a block prints one line PER PROVIDER instead -- Snapshot.SummaryLines is where that lives -- so that a long account label cannot be cut in a way that takes the other provider beside it along.

It is a free function and no longer also a method on Snapshot. It was both while `ccdad status` printed this same joined sentence; status prints the two-line block now, so the method had no caller left, and an exported method that puts two accounts on one line is exactly the third spelling of "who is live" this package exists not to have.

With no codex account it is the Claude label ALONE, unlabelled. That is not a degradation -- it is the answer every reader and every script had before there was a second provider, and prefixing it with "Claude:" on a machine with one provider would be labelling a distinction that does not exist there.

func CompactRunwayLines added in v0.12.0

func CompactRunwayLines(f forecast.Fleet, now time.Time, loc *time.Location) []string

CompactRunwayLines is the terminal dashboard's vertical runway summary. The command-line status keeps RunwayLine's compact horizontal form; a full-screen page gives each axis and each supporting fact a row of its own.

func CompactTimestamp added in v0.12.0

func CompactTimestamp(t time.Time, loc *time.Location) string

CompactTimestamp is the dashboard's narrow absolute date: YYMMDD hh:mm. The dashboard is local and interactive, so its space budget wins over the zone suffix retained by the command-line and JSON forms.

func CurrentLine added in v0.12.0

func CurrentLine(m strategy.Mode) string

CurrentLine is the ranking mode currently in force. Recovery is the one a user needs told: the columns are identical to the ordinary case, so nothing else on the dashboard distinguishes "the engine is ranking by soonest reset because everything is spent" from "the engine has nothing to do".

The value begins after the `Current:` label and two spaces. No branch may contain the substring "exhaust": the human table keeps the projection to --json, and a mode line that used the word would put it back on the page the projection was kept off.

TestNoCurrentLineBranchSaysExhausted is what makes that red. It asks the question twice -- by rendering every mode this binary declares plus one it has never heard of, and by reading the branches below as source, so a case written for a mode nothing yet passes in is covered too -- and it pins the branch count, because a line added to a block without the test that covers the block growing with it is how this rule came to be held by prose.

func DaemonLine

func DaemonLine(report daemon.Report, now time.Time) string

DaemonLine is the liveness line `ccdad status` prints at the top of the dashboard. It is one of TWO wordings this repository ships, and the other is DescribeRunning below. They are not merged: this one leads a nine-column label field that the Active: and Current: lines below it line up with, and the other is a fragment that reads as the tail of a sentence.

The default arm is DaemonUnknown and every future value. "Cannot tell" is never folded into "no": a supervisor gating on that folding respawns forever on a filesystem where locks do not work.

func DescribeRunning

func DescribeRunning(report daemon.Report, now time.Time) string

DescribeRunning is the one-line human form of a live daemon. now is a parameter rather than a call because nothing in this package reads a clock; package cli passes timeNow(), which is what the old body called.

func HumanDuration

func HumanDuration(d time.Duration) string

HumanDuration renders a span at the scale a reader cares about. A reset already behind us is "due" rather than a negative number: the endpoint has not rolled the window over yet, which is a real state and not a clock error.

func RunwayAccounts added in v0.7.0

func RunwayAccounts(f forecast.Fleet) string

RunwayAccounts is the seat-count line under the axis block: how many accounts the run had to work with, how many it would take to survive the horizon at the measured rate, and the difference between the two.

It answers the axis block's question from the other end. The rows above say how much is left and when it runs out; this says how many seats it would take for it not to. Both come from the same runs, so a reader can never be told "runs dry" and "you have enough accounts" on adjacent lines.

The parenthetical is the actionable half and is present exactly when there is something to act on: a fleet already sitting on the smallest count that holds gets the count and nothing after it. The gap before it is two spaces, matching the dry moments in the block above, which a reader scans down the same column.

An unmeasured count is Unreadable and never NoQuantity. Every fleet has a smallest size that holds -- supply is linear in the seat count and burn is not a function of the fleet -- so the number exists and what failed was the measuring. NoQuantity would say there is no such number and stop a reader looking for the history that produces it.

A fleet with no usable accounts gets no line at all. "0 usable, ? needed" is a sentence about a fleet the rotation cannot reach, and the basis line above it already carries how many accounts there are and why none of them counted.

func RunwayBurn added in v0.7.0

func RunwayBurn(b forecast.Band) string

RunwayBurn is a measured consumption rate, in percentage points per hour.

Low is what is printed and High is not: the upper bound is what a claim of "holds" had to survive, so it belongs to the verdict cell rather than to this one, and printing an interval in a column that is meant to be added up would make the column unaddable.

A band that cleared no gate is Unreadable and never 0.0. A measured zero, on the other hand, IS a reading -- the account was up, was polled, and did not burn -- and one live login at a time means most per-account rows carry one.

func RunwayCreditBasis added in v0.10.0

func RunwayCreditBasis(c forecast.CreditFleet) string

RunwayCreditBasis is what the credit row was measured from, as a sentence: the money, the span it was spent over, and how many readings carried it.

The window axes have had a basis line since they existed and the credit row has never had one, which was survivable only while no credit rate had ever been measured. The first one that was is the reason this exists: a dry date a decade out, correctly computed, from two cents. A reader cannot weigh that from the date, and the row has room for the one sentence that lets them.

It is empty for a refused figure, and the caller prints nothing rather than a sentence about a measurement that did not happen. There is no singular arm for the reading count because minSamples is three and creditSpend refuses below it, so "1 reading" is a state no figure reaching here can be in.

func RunwayCreditBurn added in v0.7.0

func RunwayCreditBurn(c forecast.CreditFleet) string

RunwayCreditBurn is the fleet's paid spend, in the currency's major unit per hour with the code beside it. Money's own width, because the unit is money; the code, because amounts in two currencies do not add and a bare figure invites a reader to add them anyway. creditRate is where the width is decided, and why it is not always two decimals.

A figure that could not be assembled is Unreadable, never zero. Every way it can fail -- mixed currencies, an uncapped account that is spending, no measured spend at all -- is a reason to say nothing rather than to report a fleet spending nothing, which would lengthen a runway made of money.

func RunwayCreditReplenish added in v0.7.0

func RunwayCreditReplenish() string

RunwayCreditReplenish is the credit row's replenishment cell, and it is a function taking nothing because the answer never varies: the endpoint reports no renewal boundary for paid usage, so there is no quantity here to read. That is NoQuantity and not Unreadable -- a reader told "?" would go looking for a renewal rate that does not exist.

func RunwayCreditVerdict added in v0.7.0

func RunwayCreditVerdict(c forecast.CreditFleet, now time.Time, loc *time.Location) string

RunwayCreditVerdict is when the fleet's paid balance reaches zero, or Unreadable when the figure was refused.

It means something different from the window rows above it and the command says so in prose beside the block: those ask whether resets replenish faster than the fleet spends, and this is a balance divided by a rate with nothing coming back.

func RunwayEmpty added in v0.7.0

func RunwayEmpty(r forecast.AccountRow, now time.Time, loc *time.Location) string

RunwayEmpty is when the simulation first found one account out.

"now" comes first, ahead of any recorded moment, because it is a fact about this minute rather than a projection: an account that is out already must not be rendered as a date the reader could decide to wait for.

An account the run never found out is Unreadable. The run declining to empty an account is not the run promising it survives -- the axis may simply have held, or the band may have decided nothing.

func RunwayLeft added in v0.7.0

func RunwayLeft(pct float64) string

RunwayLeft is how much of an account's binding window is left, in percentage points and bare. No percent sign: the column is headed LEFT, it is summed into the fleet's points on the line above the table, and a percentage there would be read against the wrong window -- the one the account is REPORTED on elsewhere is not always this one.

func RunwayLine added in v0.7.0

func RunwayLine(f forecast.Fleet, now time.Time, loc *time.Location) string

RunwayLine is the one-line summary `ccdad status` renders. The dashboard uses the same verdict helpers in CompactRunwayLines.

It returns "" when there is nothing to say, and that empty string is load bearing: it is how both renderers know not to print a line at all, which is what keeps the dashboard's byte-compared golden fixtures from moving on a machine with no history behind it. A fleet with no basis gets no line, not a line saying it holds -- a promise resting on no reading is the one output this whole measurement exists to refuse.

The line carries VERDICTS, not rates. A rate is per axis, two of them do not fit a line that also has to carry the answer, and the number a dashboard owes a reader is when rather than how fast. It also carries no percentage, which is not a style choice: `ccdad status`'s human output is asserted to contain no "0%", "20%", "30m", "ahead" or "five_hour" anywhere, because each is a figure belonging to a window its table is not reporting.

The fleet run -- both axes burning at once -- appears only when it CONTRADICTS the two axes, which it can: it burns more windows and has more ways to end, so it can run dry, or run out of agreement between its two bands, while each axis alone holds. Printing it on every line would put a third verdict on a summary that already carries two and that agrees with them on every ordinary fleet; leaving it out when it disagrees would let "holds on both axes" stand over a fleet the arithmetic says empties.

A fleet that cannot hold also carries how many accounts would -- see RunwayNeedSegment for why only that fleet does.

func RunwayNeedSegment added in v0.7.0

func RunwayNeedSegment(f forecast.Fleet) string

RunwayNeedSegment is the seat count as one clause of RunwayLine, and it is carried only by a fleet that is SHORT.

A fleet that holds already has its answer in the word "holds", and the slack it has on top of that is a block-level figure rather than a dashboard one: the summary line is read at a glance beside Daemon:, Active: and Current:, and a clause spent on good news is a clause the short case needed. The full form, spare count and all, is in RunwayAccounts.

The parenthetical here is one space, not the two RunwayAccounts uses. The clauses of this line are already held apart by their own separator, and a second wide gap inside one of them would read as a third clause.

RunwayLine's both-axes-hold branch does not call this, and it does not need to: a fleet whose runs all hold was answered by a search counting downward, so its count is at most its usable seats. A fleet that claimed both -- holding and short -- would be a contradiction the run cannot produce, and printing both halves of it on one line is not an improvement on printing one.

func RunwayReplenish added in v0.7.0

func RunwayReplenish(perHour float64) string

RunwayReplenish is what an axis gives back, in percentage points per hour. It always exists for a window axis: an axis with no accounts replenishes at zero, which is a true statement about an empty fleet rather than a reading nobody could take.

func RunwayRowCells added in v0.7.0

func RunwayRowCells(r forecast.AccountRow) (window, left, burn string)

RunwayRowCells is one account row's three weekly cells -- the window its points are counted on, the room left in it, and this account's own measured burn -- rendered together because they stand or fall together.

An account whose response carried no weekly window at all gets NoQuantity in all three and not Unreadable. Nothing failed to be read: the account was read, and this quantity does not exist for it. Borrowing its five-hour window instead would put a five-hour room and a five-hour rate into a column that is summed into the weekly axis above it, and those are two different quantities.

func RunwayVerdict added in v0.7.0

func RunwayVerdict(a forecast.Axis, now time.Time, loc *time.Location) string

RunwayVerdict is an axis's answer as a cell: whether the fleet holds at the measured rate, and when it does not, the moment it empties.

An undecided axis renders Unreadable rather than either answer. The two runs of the band disagreeing means the evidence does not carry a claim, and both "holds" and a date would be claims.

func RunwayWrap added in v0.8.0

func RunwayWrap(label, line string, width int) string

RunwayWrap folds the runway line onto width display columns, breaking only at its own separators and hanging every line after the first under the first clause.

A width of zero means the caller does not know one -- a pipe, a redirect, the buffer a test renders into -- and returns the line exactly as it was joined, byte for byte. That is the case every non-terminal writer takes, and it is what keeps this function out of the way of everything that reads the output as data.

The width arrives as a PARAMETER for the reason the zone does: nothing in this package may read the environment, and the terminal is environment. The caller nearest the reader measures it.

Clauses are atomic. A clause wider than the room gets its own line and is allowed to overflow rather than be cut, because this line ends in an absolute moment and a span: `2026-08-26 08:1` reads as a shorter date, not as a line that did not fit. The dashboard cuts because a page has a right edge it cannot spend; a scrollback has one it can. That is the whole of why these two renderers of one wording answer this differently, and it is not drift.

Every width here is a display column count. The separator is U+00B7 -- one column, two bytes -- so a byte count is wrong by the number of separators on the line, which is the number that grows as the line gets longer.

func SectionLegend added in v0.19.0

func SectionLegend(header string, c Columns) string

SectionLegend is the legend for one section, prefixed with the provider it belongs to.

The prefix is what makes two legends readable as two: under a sectioned table with per-section columns there are now two "windows:" lines and nothing in the text of either says which half of the table it explains. It is the section's own Header, so the word a reader matches on is the word they just read over the rows.

The provider is LOWERCASED here, and that is not a style choice. ClaudeSection and CodexSection are all-caps and 7-bit precisely so that a grep for one of them finds a heading and nothing else -- three tests assert the ABSENCE of a string by searching for it, and a legend carrying "CLAUDE" would answer those greps from under the table. Lowercase is the same word to a reader and a different string to a search.

Empty when the section has no windows, which covers both the empty section and the one nobody could read -- there is no key to publish either way, and a legend naming the placeholder would be a mapping from QUOTA to nothing.

func StateLabel added in v0.18.0

func StateLabel(s daemon.AccountState) string

StateLabel is the word the STATE column prints for one engine state.

The default arm is mandatory and is not defensive tidiness. AccountState is a string type and the status document is additive by contract, so a newer daemon may publish a state this binary has never heard of -- which happens on the day somebody upgrades one half of a machine. Carry the value through and render it.

The empty string is its own arm and it is not an error either: AccountStatus.State is omitempty and is filled from a map lookup that answers the zero value on a miss, so an account no daemon has ever published carries "". It renders NoQuantity -- there is no state here, as against a state somebody tried to read and could not.

func StrategyLine added in v0.12.0

func StrategyLine(name string) string

StrategyLine describes the one policy selected through `ccdad strategy`.

func ThresholdsFor

func ThresholdsFor(cfg config.Config, now time.Time, plan strategy.Plan, planErr error) (
	resolve func(uuid string) strategy.Thresholds, notices []string)

ThresholdsFor returns notices alongside the resolver so both CLI and TUI callers can publish them through the output channel they own.

The plan is read only when hover is on; with hover off it is ignored entirely, including its error.

func Timestamp added in v0.7.0

func Timestamp(t time.Time, loc *time.Location) string

Timestamp is the one absolute-time rendering in this repository, and the zone is always in it. The two human-facing absolute formats that came before it carry neither a date nor a zone: internal/cli/hover.go's clock is "15:04", and internal/switcher/evaluate.go's Explain uses time.Kitchen. Both are fine for a moment inside the hour and useless for a runway that names one days out. Every remaining .Format in the tree is RFC 3339 or the daemon log's millisecond variant of it, which are machine formats and not an answer here. It lives in internal/view so the runway command, status, list and the dashboard spell one layout once rather than four times.

The zone is not optional, and it is not read here. The arithmetic that produces these moments must not touch the environment, so the location arrives as a parameter. A nil location falls back to UTC rather than to time.Local: a caller that passed none has not told us its zone, and time.Local would print a confidently wrong hour on any machine whose TZ is not the reader's -- including CI, where nothing sets it.

func TrailerLines added in v0.18.0

func TrailerLines(rows []Row, c Columns, hover []string) []string

TrailerLines is everything printed UNDER an account table that is not a legend, in order: the hover block, the unranked note, and one credit line per credit-metered seat.

The legend left this list when the table gained per-section columns. There is no longer ONE legend to print -- each provider's half of the table carries its own windows, so each carries its own mapping back to the wire keys -- and a list that still held a whole-fleet legend would print a third one naming columns no section draws. SectionLegend is where that lives now, and the surface emits one per section immediately under the table.

The Columns handed in is still the WHOLE FLEET's, because the unranked note is a statement about the fleet rather than about a section: a window nothing ranks is not something a reader should have to notice twice.

One ordered slice rather than a sequence of prints in each surface, because the order is a fact about the TABLE and not about the surface drawing it. Each line explains a column the reader is already looking at, and the two that describe the quota block come before the ones that describe a row.

hover is Snapshot.HoverLines, passed rather than derived because it is a fact about the RANKING and not about these rows, and empty for a surface that does not print it. It comes first because the order is what the table is for.

The lines arrive UNWRAPPED. Folding one onto a width is the caller's, and has to be: the width is a terminal's, and the label the fold hangs under is found in the line rather than passed, so a wrap belongs where the terminal is known.

func UpdateLine added in v0.9.0

func UpdateLine(report daemon.Report, running string) (string, bool)

UpdateLine is the release line `ccdad status` prints under the daemon line and the terminal dashboard prints under its liveness block.

The daemon publishes what it SAW -- a version string -- and never a verdict, so the comparison happens here, against the version of the binary doing the reading. That is not a preference: upgrading replaces the binary while the old daemon keeps publishing, so a boolean computed by a 0.6.1 daemon would tell a 0.7.0 CLI to upgrade to what it is already running.

It is SILENT -- ok false -- for every reading it cannot turn into that sentence: no published document, nothing recorded, a recorded release that does not parse, a running version that does not parse (every `dev` build, so every build a developer makes), or a release that is not newer. A line that says nothing useful under a dashboard people read every day is worse than no line.

func WindowHeader added in v0.11.0

func WindowHeader(n usage.WindowName) string

WindowHeader is the short name a column carries.

The wire key stays the vocabulary -- it is what `ccdad config` and `--json` use -- and the legend under the table maps one to the other, so shortening here costs a reader nothing they cannot look up two lines down.

func WrapLabeled added in v0.8.0

func WrapLabeled(line string, width int) string

WrapLabeled folds one line of the labelled block -- Daemon:, Active:, Strategy:, Current: -- onto width display columns, breaking at spaces and hanging every line after the first under the value.

Current's recovery explanation is wider than an 80-column terminal, so an unwrapped line folds wherever its own right edge falls -- mid-word or mid-clause.

It is a SEPARATE function from RunwayWrap, and the difference is not duplication. These lines are prose and break at spaces; the runway line is a row of values whose spaces are inside them, and a break at the one in `2026-08-26 08:19 KST` would produce a date that is not a date. Each knows where its own line may be cut, and neither may be pointed at the other's. What they share is the hanging alignment, which is `hang` below.

The label is found rather than passed, because these lines arrive with it already spelled: the block's contract is a name, a colon, and padding to nine columns, and that is what this looks for. A line with no colon has no label and no indent, which is the honest rendering of a line this block did not produce.

A width of zero -- every writer that is not a terminal -- returns the line exactly as its builder spelled it, and so does a terminal too narrow to hold the label, where there is no room to hang anything in.

Types

type ColumnKind added in v0.18.0

type ColumnKind int

ColumnKind is what a column IS.

It is separate from ListColumn below for the reason the dashboard's own ColKind was: a window column cannot be named by a constant, because how many there are and which windows they stand for is a fact about the fleet.

const (
	// ColumnIdx is the marker and the account's reference, together, in the
	// one cell that carries both: "* c1", "  x2".
	//
	// The reference is store.Account.Ref and not the bare number. The number
	// is per provider, so a mixed fleet shows "1" under both headings, and the
	// headings did not make it read as two different things: a reader looking
	// at a Claude row and a Codex row with the same email and the same "1" had
	// no way to tell what to type to act on one of them. Ref is what every
	// command takes, so the cell is now what the next command is given.
	ColumnIdx ColumnKind = iota
	ColumnAccount
	ColumnType
	ColumnTier
	// ColumnWindow is one window's cell, and ListColumn.Index indexes
	// Columns.Windows.
	ColumnWindow
	// ColumnReset is one rollover's countdown, and ListColumn.Index indexes
	// Columns.Resets.
	ColumnReset
	// ColumnWorst is the whole window block collapsed into one cell, for a
	// table too narrow to carry the block itself. It is never in ListColumns:
	// CollapseWindows is what puts it there.
	ColumnWorst
	ColumnState
	ColumnAuto
	ColumnAge
	// ColumnBlank is a column that holds nothing: the room a section's quota
	// block does not need and a wider section's does.
	//
	// It exists so that the columns AFTER the block -- STATE, AUTO, AGE -- land
	// at the same index in every section, which is what keeps them under one
	// another across the seam in a table whose two halves draw different
	// windows. Its cell is the empty string and never NoQuantity: "-" is a claim
	// that the quantity does not exist for this account, and this column carries
	// no claim at all.
	//
	// Appended LAST. Nothing persists these values, but they are switched on in
	// four packages, and a renumbering is a diff nobody can review.
	ColumnBlank
)

func (ColumnKind) String added in v0.18.0

func (k ColumnKind) String() string

String names a kind, for a test failure that would otherwise print an integer nobody can read back to a column.

type Columns added in v0.11.0

type Columns struct {
	Windows []WindowColumn
	Resets  []ResetColumn
}

Columns is the whole quota block: the window columns and the reset columns they point into.

func ColumnsOf added in v0.11.0

func ColumnsOf(rows []Row) Columns

ColumnsOf builds the block for a set of rows.

MEMBERSHIP is the union, over the visible rows, of every window each row actually carries. That is exactly the set `ccdad status --json` has published since it was written -- it walks the same windows and skips the absent ones -- so the human tables gain no new source here. They stop a derivation that threw away all but one of a set they already had.

cinder_cove can never appear and needs no filter: it is left out of the snapshot's own window list on purpose, because its reset is an EXPIRY rather than a rollover, so a countdown under a header meaning "rolls over in" would be counting down to a deletion.

func (Columns) Headers added in v0.11.0

func (c Columns) Headers() []string

Headers is the quota block's header row: one per window, then one per rollover. Both CLI tables and the dashboard call this rather than each assembling the same slice, which is what stops one of them growing a column the others do not have.

func (Columns) Legend added in v0.11.0

func (c Columns) Legend() string

Legend maps every header back to the wire key it stands for.

It is the only place a human table still shows the key `ccdad config` takes a threshold on, which is what a full-name window column used to buy -- at the price of being one column naming one window per row.

func (Columns) Names added in v0.11.0

func (c Columns) Names() []usage.WindowName

Names is every window column's wire key, in column order.

func (Columns) Unranked added in v0.11.0

func (c Columns) Unranked() []usage.WindowName

Unranked is the columns the engine does not bind on.

func (Columns) UnrankedNote added in v0.11.0

func (c Columns) UnrankedNote() string

UnrankedNote is the sentence for a column carrying real quota nothing switches away from, or empty when every column ranks.

It names the hand edit and NOT `ccdad config set`, deliberately: the setter refuses exactly these names while the loader carries them, so advice to run it would send the reader into the binary's own refusal.

type Exec

type Exec func(argv []string) (code int, stdout, stderr string)

Exec runs one ccdad command through a FRESH cobra root and reports what it wrote and what it exited with. It is a function value declared in this leaf package because internal/cli must import internal/tui to register a command, so internal/tui must never import internal/cli. internal/mcpsrv takes the identical seam.

type ListColumn added in v0.18.0

type ListColumn struct {
	Kind ColumnKind
	// Index indexes Columns.Windows for ColumnWindow and Columns.Resets for
	// ColumnReset. It is -1 for every kind that indexes nothing -- and for the
	// one ColumnWindow that indexes nothing either, the placeholder quota
	// column a fleet with no readable window gets.
	Index int
	// Header is the heading, and Content the widest cell. See the block above
	// for what Content is and is not.
	Header  string
	Content int
}

ListColumn is one column of the account table.

It is a comparable struct, so a drop list is still `==` and a caller can ask whether a column survived without writing a predicate for every kind.

func CollapseWindows added in v0.18.0

func CollapseWindows(cols []ListColumn) []ListColumn

CollapseWindows swaps the window columns for one ColumnWorst, in the place the first of them held, and leaves everything else where it was.

It declines on a fleet whose only quota column is the placeholder, and that is arithmetic rather than taste: the placeholder is windowContent wide under a five-column heading and ColumnWorst is fifteen wide, so collapsing there would WIDEN the table a caller is collapsing because it is too narrow -- and both cells say the same Unreadable either way.

func ListColumns added in v0.18.0

func ListColumns(c Columns) []ListColumn

ListColumns is the full fixed column order, once, for every surface that draws an account list.

It is the UNION of what the two surfaces show today and it holds each of them as a subsequence, which is what lets either adopt it without reordering anything a reader has learned: `ccdad status` draws IDX, ACCOUNT, TYPE, TIER, the quota block and AGE, and the dashboard draws IDX, ACCOUNT, TYPE, the quota block, STATE, AUTO and AGE. A surface that cannot fit all of them drops from ListDrops rather than picking its own set.

The quota block is never empty. With no visible row carrying a readable window there is one placeholder column under PlaceholderHeader whose cells are all Unreadable, which is the same answer Columns.Headers and Row.Cells have given since they were written: a table that simply stopped having quota columns reads as a build with no quota feature rather than as a fleet nobody could read.

func ListDrops added in v0.18.0

func ListDrops(c Columns) []ListColumn

ListDrops is the drop priority, LOWEST FIRST: a caller too narrow for every column walks this list from the front and removes each entry until what is left fits.

It is a fixed priority list and never a greedy packer, because greedy is non-monotone: a column can vanish when the terminal WIDENS. The price is that at some widths a table holds slack it cannot spend, and that is stated rather than hidden.

IDX, ACCOUNT and the window columns are absent from it, and that absence IS the argument. IDX and ACCOUNT say WHICH account. Every window column says how much of one limit is gone, and the one most likely to matter is exactly the one that is spent, because that is the row a reader came to look at. A table too narrow for the block collapses it with CollapseWindows instead, which is safe where dropping is not: with every cell reading percentage USED, the worst window is the MAX, so nothing the collapsed cell hides is worse than what it shows.

TIER goes first because it is the only column here that never changes: a plan name is a fact about the subscription and not about today's fleet, and a reader who needs it can ask for one account. The four after it keep the order the dashboard has always dropped them in, and the reset columns go from the LAST plan-order one back, so the rollover a reader is most likely to be waiting on -- the soonest, which sorts first -- is the last to go.

func SectionColumns added in v0.19.0

func SectionColumns(planned []ListColumn, c Columns) []ListColumn

SectionColumns is one section's column list, laid out in the slots a PLANNED list reserved.

It is the piece that lets two halves of one table draw different windows and still line up. The planned list is the widest section's, which is what a width ladder measured and what every column's width was reserved for; this swaps the quota block for the section's own and pads out the difference with blanks, so STATE, AUTO and AGE land at the same index in every section.

The columns in FRONT of the block are untouched, and that is what makes the swap safe rather than lucky: IDX, ACCOUNT, TYPE and TIER are the same columns in every section, so the block always starts at the same slot.

A COLLAPSED plan keeps its one ColumnWorst and still takes the section's own rollovers. The worst cell reads the block it is handed, so it is already this section's answer; the reset columns are the half that has to be re-indexed, because ListColumn.Index points into Columns.Resets and the planned list's indices are the widest section's. Handing that list back whole is what put a Claude rollover's index into a Codex block and read past the end of it.

A section needing more slots than the plan reserved is cut to fit, keeping the soonest rollovers -- which is the direction ListDrops takes them in anyway. It is reachable only from a caller that planned against some other list, and shearing every column after the block would be the alternative.

type ListRow added in v0.18.0

type ListRow struct {
	Row Row
	// Header is the section heading this line carries, and empty on every
	// account row. It is what tells the two apart.
	Header string
	// ColumnHeader marks the line of column names that follows a section
	// heading. It is a line of the table rather than the table's own header row
	// because there is now ONE PER SECTION: each provider's half draws its own
	// quota block, so each needs its own names over it, and a table library has
	// exactly one header row to give.
	//
	// It is a third kind of line rather than a second flag on Header for the
	// reason Header is not a nested list: every surface draws these by integer
	// and styles them by the same integer, so a line the renderer counts and the
	// style function does not is a line whose colour belongs to its neighbour.
	ColumnHeader bool
	// At is this account's index in the slice Sections was given, and -1 on a
	// heading.
	//
	// It has to be carried rather than derived because grouping REORDERS: a
	// codex account listed first in the store is drawn below every Claude one,
	// so a display position no longer names the same row. A cursor, a
	// selection or a per-account lookup that used the display position would
	// point at one account and act on another.
	At int
}

ListRow is one line of a rendered account list: an account row, or the heading over a section.

The two are ONE type and one slice on purpose. A table draws its rows by integer and styles them by the same integer, so a heading that lived outside the row slice would have to be counted twice -- once by the renderer and once by the style function -- and the two counts would agree until the day a section became empty.

func ListRows added in v0.18.0

func ListRows(secs []Section) []ListRow

ListRows is the sections as one drawable slice: each heading, then that section's accounts, in section order.

EVERY heading is drawn, including the one over a section with no rows in it, and that is a decision rather than a fallout of the loop being simple. A heading over nothing says the provider exists and this machine has no account on it -- which is the question a reader of a one-provider fleet is most likely to be asking, and the answer they would otherwise have to know ccdad's history to infer. The alternative, drawing a heading only where there are rows under it, makes the page silent about exactly the case the sections were added for: a machine with four Claude accounts and no Codex one renders identically to a build that has never heard of Codex.

Each section carries TWO lines of its own: the provider's name, and the column names under it. The second is what per-section quota blocks cost -- each half of the table draws its own windows, so each needs its own names over them -- and it is a line of the table rather than the table's own header row because a table library has exactly one of those to give.

The cost is four rows on a page that is short of them, and a surface short of rows gives them up like any other block rather than being handed a shorter list: the count is FIXED at two per section, so it can be budgeted, spent and handed back without knowing anything about the fleet.

type ResetColumn added in v0.11.0

type ResetColumn struct {
	Header  string
	Windows []usage.WindowName
}

ResetColumn is one rollover, shared by every window that rolls with it.

type Row

type Row struct {
	Account store.Account
	Active  bool
	// Serving is whether this is the Codex account the proxy serves new threads
	// from: the one Snapshot.CodexServingUUID names, read from the same pointer
	// as the "Active (Codex)" line above the table.
	//
	// It is Codex's half of what Active is for Claude, and a SEPARATE field
	// because Active means the Claude login everywhere else it is read -- the
	// --json "active" key and the switch key's already-live refusal among them.
	// Only the marker reads both.
	Serving  bool
	Entry    usage.Entry
	HasEntry bool
	Headroom strategy.Headroom
	// Thresholds is the bundle this row was MEASURED against, kept so a cell can
	// be coloured against the same numbers.
	//
	// It is resolved once in Rows and handed to HeadroomOrCredit from this
	// field, so the bundle a cell reads and the bundle the row was ranked on
	// are one object by construction rather than two calls that agree until the
	// day one of them moves. Under hover that matters twice over: the table is
	// hover's own, built per account from the engine's pass, so a second
	// resolution could hand a cell a number no part of this row was measured
	// with.
	Thresholds strategy.Thresholds
	Pace       map[usage.WindowName]usage.Pace
	Engine     daemon.AccountStatus
}

Row is one account with everything the dashboard knows about it, from each field's one authoritative source.

func Rows

func Rows(accounts []store.Account, cache *usage.Cache, active store.Account,
	hasActive bool, now time.Time, thresholds func(uuid string) strategy.Thresholds) []Row

Rows pairs every account with its cached reading.

Both status forms and the dashboard build their rows through this: one cache, read one way, into one shape. Separate renderers deriving headroom for themselves would agree until the day one of them changed.

Engine state is deliberately NOT filled in here. It comes from status.json, the daemon's own document, and loadSnapshot joins it after building rows.

func (Row) AgeLabel

func (r Row) AgeLabel(now time.Time) string

AgeLabel is how old this account's reading is.

func (Row) AutoLabel added in v0.18.0

func (r Row) AutoLabel() string

AutoLabel is whether the engine may rotate to this account. It is a rotation policy and not a lock: an explicit `ccdad switch` still activates a disabled account.

func (Row) CarriedWindows added in v0.11.0

func (r Row) CarriedWindows() []usage.NamedWindow

CarriedWindows is every window this row's reading actually carries, in wire order, plus the credit meter when it reported a percentage.

The Present filter is load-bearing rather than tidiness. Snapshot's fixed Claude keys are listed unconditionally, so an unfiltered walk hands every Claude fleet five columns with three of them null on every row forever.

func (Row) Cells added in v0.11.0

func (r Row) Cells(c Columns, now time.Time) []string

Cells is one row's quota block, in Headers' own order and always the same length, so a caller can append it between its own fixed columns.

func (Row) CreditLine added in v0.11.0

func (r Row) CreditLine() (string, bool)

CreditLine is the money sentence for a seat metered in credits, which no percentage column can carry.

A balance beats a percentage here: "795.23/2000.00 used, 1204.77 left (USD)" is what a person deciding whether to top up needs, and 40% is not.

func (Row) Empty added in v0.8.0

func (r Row) Empty() (empty, known bool)

func (Row) ListCell added in v0.18.0

func (r Row) ListCell(c ListColumn, block Columns, now time.Time) string

ListCell is one field of one row: the switch every surface drawing an account list used to own half of.

A quota cell is the window's own utilization on every surface and under every strategy. Hover once drew used against a threshold it derived per window; it holds every window to the same hand-off line now, and a column of identical thresholds beside every figure says nothing.

Three cells are deliberately shorter than what a surface finally prints, and in each case the missing half is something this package may not know:

  • IDX carries Row.Marker, which answers "which login would a session get". A surface with a CURSOR draws its own glyph in that column on the row the cursor is on; the marker is what it falls back to, and where the two meet the live account wins.
  • ACCOUNT is the whole address-and-handle label, uncut and unpadded. What it is cut to is a column width, which comes off a terminal.
  • STATE is the WORD alone. The dashboard prefixes a glyph, and which glyph set a console can carry is the machine fact this package never reads.

AGE is the age and only the age. `ccdad status` rides Row.StatusFlags on this cell as a suffix, and that is right where it is: the flags belong to the ACCOUNT rather than to the column, and a suffix reads better beside that account's own figure than at a fixed offset far to its right.

func (Row) ListLabel

func (r Row) ListLabel() string

ListLabel is both the address and the handle, which is NOT Account.Label(): that one returns the alias alone, and the dashboard is where a user learns which alias belongs to which address.

func (Row) Marked added in v0.25.0

func (r Row) Marked() bool

Marked is whether this row is the account a new session of its provider would get: the live Claude login, or the Codex account being served from.

func (Row) Marker

func (r Row) Marker() string

Marker is the marker printed in front of the IDX column, on whichever row is Marked. One per provider at most, and each table section is one provider, so a section never carries two.

func (Row) Reported

func (r Row) Reported() (usage.NamedWindow, bool)

Reported resolves ReportedName to the window itself, together with when it rolls over. It is what the USED, WINDOW, RESETS IN and PACE columns all read, so they always describe the same window.

The Known check is redundant TODAY and is kept deliberately: with no window reporting a utilization, strategy leaves both names as the empty WindowName and the loop below matches nothing anyway. A mutation removing it survives for exactly that reason. It stays because the alternative is for this function's correctness to rest on an invariant of another package's zero value.

func (Row) ReportedName

func (r Row) ReportedName() usage.WindowName

ReportedName is the window this account is REPORTED against, which is not always the one it is ordered on.

A tripped WEEKLY cap wins, because it is the one that will not come back for days: an account whose five-hour window rolls over in eight minutes is still unusable until Friday, and naming the five-hour window would tell the user to wait eight minutes for it. Ordering still runs on Headroom.Slack, which is the tightest window whichever family it belongs to, so this rule moves no account in the ordinary order. It is not inert in RECOVERY order: what an account has to wait out is the weekly floor, so the same field decides whether it counts as returning inside the horizon.

func (Row) ResetCell added in v0.11.0

func (r Row) ResetCell(c ResetColumn, now time.Time) string

ResetCell is one countdown, for the group a column points into.

func (Row) StatusFlags

func (r Row) StatusFlags() string

StatusFlags is the suffix `ccdad status` prints after the age column. An account may carry more than one flag, so they are joined in one suffix.

func (Row) StatusLabel

func (r Row) StatusLabel() string

func (Row) TierLabel

func (r Row) TierLabel() string

func (Row) TypeLabel

func (r Row) TypeLabel() string

TypeLabel is what the TYPE column says about an account.

It is shared by status and the dashboard because it cannot be derived from Kind alone. Every ChatGPT plan is a subscription, so a codex row rendered from Kind would say "subscription" -- true, and useless: it would be the word on every codex row and on most of the Claude rows beside them, distinguishing nothing. What a reader needs in that column is which side of the machine the row belongs to, because that is what decides which command moves it.

Status and the dashboard both call this rather than formatting Kind themselves. Two renderers formatting one value two ways is the exact failure package view exists to remove.

func (Row) WindowCell added in v0.11.0

func (r Row) WindowCell(n usage.WindowName) string

WindowCell is one quota cell: the percentage USED.

Used and not left, so that 100% means the same thing in every cell of the table and the eye can scan a row for the number that stops it. The polarity is stated once, here, and the header row says nothing about it.

func (Row) WindowPct added in v0.11.0

func (r Row) WindowPct(n usage.WindowName) (float64, WindowState)

WindowPct is this row's utilization of one window, and why there is no number when there is none.

func (Row) WindowReset added in v0.11.0

func (r Row) WindowReset(n usage.WindowName) (time.Time, bool)

WindowReset is when one window rolls over.

func (Row) WindowThreshold added in v0.12.0

func (r Row) WindowThreshold(n usage.WindowName) float64

WindowThreshold returns the threshold for the exact displayed axis. Credit has its own fail-closed threshold and must not fall through to the ordinary window default merely because it shares the table with quota windows.

func (Row) WorstCell added in v0.18.0

func (r Row) WorstCell(c Columns) string

WorstCell is the whole quota block in one cell, for a table too narrow to carry the block itself.

It names the window as well as the number, because a percentage with no window beside it is precisely what these tables stopped doing.

The trailing "+" is a claim about the claim: one window could not be read, so the max is a lower bound. Saying so costs one character and stops the cell asserting more than it knows.

type Section added in v0.18.0

type Section struct {
	Provider provider.ID
	Header   string
	// Rows are this section's account rows, each remembering where it came
	// from -- see ListRow.At for why that index has to survive the grouping.
	Rows []ListRow
}

Section is one provider's rows under one heading.

func Sections added in v0.18.0

func Sections(rows []Row) []Section

Sections groups rows by provider: Claude first, then Codex.

BOTH sections are always returned, including an empty one. A caller can then ask each for its rows without asking first whether it exists, and -- more to the point -- the total is the input by construction, so no grouping can lose a row.

A row is Codex IF AND ONLY IF its account names the Codex provider. Everything else is Claude, and the zero provider is the case that matters: a row read out of a version-1 document carries no provider at all, and a grouping that treated the zero value as Codex would file every one of those accounts under the wrong heading, while one that gave them a third bucket would leave them out of both sections and off the page entirely. The store fills the zero value in as Claude when it loads, and this agrees with it rather than depending on it.

Order WITHIN a section is the input's own, untouched. That order is the store's, which is what the IDX column numbers, so grouping changes which rows are adjacent and never which comes before which.

func (Section) Columns added in v0.19.0

func (s Section) Columns() Columns

Columns is the quota block this section's own rows need.

It is ColumnsOf over this section alone, which is the whole of the change: the union over a mixed fleet gives every Claude row a CX 1 cell it can only fill with "-" and every Codex row a 5H cell it can only fill the same way. Measured on a nine-account fleet: nine quota columns of which four were dead in each section, forty-two characters of table per row saying nothing.

A section with no rows has no windows, and its block is the placeholder -- one column headed QUOTA. That is the same answer the whole-fleet block gives for a fleet nobody could read, and it is right here for the same reason: a heading over an empty section says the provider exists, and a heading over nothing at all with no columns under it would read as a table that forgot a provider.

type Snapshot

type Snapshot struct {
	Now         time.Time
	Rows        []Row
	Report      daemon.Report
	ActiveLabel string // "work@example.com (work)", or "none of the managed accounts"
	// CodexServingLabel is the account ccdad's proxy tries first for the next
	// request in each unpinned Codex session, or "" when there is no pointer or it names no stored account.
	//
	// EMPTY IS LOAD-BEARING. It is what keeps every surface rendering the exact
	// bytes it rendered before codex existed on a machine that has no codex
	// account: `ccdad which` prints the bare Claude label, and the block
	// SummaryLines builds draws one Active line rather than two.
	CodexServingLabel string
	// CodexServingUUID is the same account's key, for the --json payloads. A
	// label is for a person and a uuid is what a script keys on, and deriving
	// one from the other at the payload builder would be a second lookup of a
	// pointer this snapshot has already read.
	CodexServingUUID string
	Strategy         string // the selected policy: hover, manual, headroom or consume-first
	AutoSort         bool   // account lists follow the nearest seven-day reset
	Hover            bool   // compatibility storage for the hover policy
	// HoverOrder is the main pool in the order hover's pass left it, empty when
	// hover is off or when no pass ran.
	//
	// It is carried because hover's whole decision IS the order, and no cell
	// on the table shows it: every quota cell is a raw utilization, and which
	// account the session goes to next -- or why an account with room is not
	// it -- is a fact about the ranking, not about any row. HoverLines turns it
	// into one sentence per account.
	HoverOrder []strategy.Ranked
	// Manual is compatibility storage for the manual policy. The selected
	// strategy remains explicit so a healthy ranking under manual cannot look
	// like a broken engine.
	Manual      bool
	Mode        strategy.Mode
	HasMode     bool
	Version     string   // buildinfo.String()'s first field, or a test constant
	Notices     []string // everything cli would have written to stderr
	UnknownKeys []string // unrecognised top-level credential keys retained by the store

	// Forecast is the measured burn and what it implies, and HasForecast is
	// whether one could be produced at all.
	//
	// The pair is a tri-state and not a nilable pointer, for the reason the
	// fields above it are: a dashboard reads this struct and must never be able
	// to dereference its way into a panic on a machine that has been recording
	// for ten minutes. HasForecast false is "no measurement", never "a fleet
	// burning nothing" -- the zero Fleet's verdicts are all VerdictUnknown, so
	// a renderer that ignored the flag would still print no promise.
	//
	// Package cli computes it, as it computes everything else here, so the same
	// value reaches the dashboard and the command line and no number is derived
	// in two places.
	Forecast    forecast.Fleet
	HasForecast bool
}

Snapshot is one complete read of the documents a dashboard renders. Package cli builds it — it owns the attribution probe and the notice stream — and package tui only reads it, so no number is derived in two places.

func (Snapshot) HoverLines added in v0.29.0

func (s Snapshot) HoverLines() []string

HoverLines is the hover block printed under the table: what the mode does, and then the order its pass left the pool in, one line per account.

Nothing when hover is off. The order lines are the half no cell can carry: a five-hour account at 85% that the session is not on reads like a mistake until the line beside it says it was left at its limit and is held out until its window rolls, and an Ultra seat holding half its week is explained only by whose week ends first.

In recovery mode the order is not hover's: every account is past its last point, and the pass ranks on emptiness, then on which comes back first. The lines then say so and describe each account by what that order ranked it on, because a rung printed beside an order the rungs did not make would explain a decision nobody took.

func (Snapshot) StrategyLabel added in v0.7.0

func (s Snapshot) StrategyLabel() string

StrategyLabel is the single user-facing switching policy. New snapshots already carry that value in Strategy; the boolean fallback keeps snapshots built by older callers and tests truthful during an in-process upgrade.

func (Snapshot) SummaryLines added in v0.18.0

func (s Snapshot) SummaryLines() []SummaryLine

SummaryLines is who is live, what the engine is set to, and what it decided.

Every fact owns one line, and Claude and Codex are separate facts: the codex line is present only when a codex account is actually being served, so a machine with one provider renders exactly what it rendered before there were two.

The Strategy line is StrategyLabel and never Strategy: under hover the configured strategy has stopped being read, and naming it here made a page under a fully automatic mode look exactly like one that was not.

The Current line is present only when the pass Decided. A zero Plan does not stringify to nothing -- it stringifies to plausible values, and the zero Mode is "headroom" -- so a line built from a pass that never ran would print a real answer nobody computed.

Strategy and Current are built by CALLING StrategyLine and CurrentLine and splitting the result, rather than by spelling a label here and a value there. That is the whole point of the shape: those two sentences have one author, the surfaces that draw them get the pair for free, and a label that changed in one place cannot go on being the old one in another.

type SummaryLine added in v0.18.0

type SummaryLine struct {
	Label string
	Value string
}

SummaryLine is one labelled fact from the block above an account table, kept as the PAIR rather than as a joined string.

The pair is what lets a surface paint the label without painting the value, which is the rule the table one block down already pays: the column headings carry the heading role and the cells underneath carry their own. Painting the whole line as one span would make the fleet's answers the loudest thing on the page and would make "Active:" and the address it names read as one word. A caller that wants the line back joins them.

type WindowColumn added in v0.11.0

type WindowColumn struct {
	// Name is the wire key. It is the key `ccdad config` takes a per-window
	// threshold on and the key `--json` files the window under, so a reader who
	// moves between the table and either of those reads one vocabulary.
	Name usage.WindowName
	// Header is short, and unique within its Columns by construction.
	Header string
	// Reset indexes Columns.Resets, or -1 when no visible row reported a
	// rollover for this window.
	Reset int
	// Ranked is whether the engine binds on this window without being asked.
	// A window it does not rank can sit at 100% with nothing switching away
	// from it, and a column that did not say so would be a lie by omission.
	Ranked bool
}

WindowColumn is one quota column.

type WindowState added in v0.11.0

type WindowState int

WindowState is why a cell says what it says. The three are kept apart because they are three different facts and one of them is a bug if it is guessed.

const (
	// WindowAbsent: the reading does not carry this window at all. Rendered
	// "-". It is a statement about the ACCOUNT -- a Codex seat has no
	// five-hour window and never will -- and it is only ever said about a
	// reading somebody actually took.
	WindowAbsent WindowState = iota
	// WindowUnreadable: nothing was read, or the window was carried and
	// reported no utilization. Rendered Unreadable.
	//
	// Never "-" and never "0%". An account nobody could read is not an account
	// with a fresh window, and cswap's engine parked itself permanently on
	// exactly that confusion. Present-with-null is a real shape on the wire --
	// a freshly reset window reports {"utilization":null,"resets_at":null} and
	// still HAS the window -- so the two absences are not the same absence.
	WindowUnreadable
	// WindowRead: a utilization came back.
	WindowRead
)

Jump to

Keyboard shortcuts

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