@tangle-network/charts 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -7
- package/dist/figure.css +96 -2
- package/dist/index.d.ts +39 -4
- package/dist/index.js +732 -377
- package/dist/react/index.d.ts +12 -6
- package/dist/react/index.js +57 -7
- package/dist/react/live.css +20 -1
- package/dist/timeline-BAwebuqb.js +1185 -0
- package/dist/timeline-CNHABOS1.d.ts +293 -0
- package/package.json +1 -1
- package/dist/events-Cw6abvgR.js +0 -491
- package/dist/timeline-BAjzF-wL.d.ts +0 -183
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Inputs and outputs of the figure functions.
|
|
4
|
+
*
|
|
5
|
+
* The library draws and never decides. Ranks, intervals, frontier membership,
|
|
6
|
+
* estimate labels and pass counts arrive from the producer (a board record, a
|
|
7
|
+
* VerticalBench report, an agent-eval lens). A figure function returns a
|
|
8
|
+
* `Refusal` instead of a figure it cannot draw honestly.
|
|
9
|
+
*/
|
|
10
|
+
/** agent-eval `SearchEstimateMethod`, the same strings: what a unit count supports. */
|
|
11
|
+
type Estimate = "none" | "insufficient" | "descriptive" | "bootstrap";
|
|
12
|
+
type IntervalMethod = "task-cluster-bootstrap" | "mcnemar-exact" | "wilson";
|
|
13
|
+
/**
|
|
14
|
+
* A confidence interval as the producer recorded it. `level` and `method` are
|
|
15
|
+
* nullable because real records omit them; a figure refuses to draw an
|
|
16
|
+
* interval that does not name both.
|
|
17
|
+
*/
|
|
18
|
+
interface Interval {
|
|
19
|
+
lower: number;
|
|
20
|
+
upper: number;
|
|
21
|
+
level: number | null;
|
|
22
|
+
method: IntervalMethod | null;
|
|
23
|
+
}
|
|
24
|
+
/** The App Grade ladder, lowest first. U (unable to measure) is not on it. */
|
|
25
|
+
type Tier = "F" | "C" | "B" | "A" | "S";
|
|
26
|
+
type TierCounts = Record<Tier, number>;
|
|
27
|
+
/** Where a cost comes from. Only `receipts` is billed spend. */
|
|
28
|
+
type CostBasis = "receipts" | "estimated" | "unknown";
|
|
29
|
+
/** A column or row identity: an AgentProfile, a model, a judge, a search node. */
|
|
30
|
+
interface Setup {
|
|
31
|
+
id: string;
|
|
32
|
+
label: string;
|
|
33
|
+
/** Null when the order is a sort, not a ranking backed by comparisons. */
|
|
34
|
+
rank: number | null;
|
|
35
|
+
}
|
|
36
|
+
/** One setup's rate. Field names follow the board record's `BoardProfile`. */
|
|
37
|
+
interface RateRow extends Setup {
|
|
38
|
+
solved: number;
|
|
39
|
+
attempts: number;
|
|
40
|
+
rate: number;
|
|
41
|
+
/** The producer's label for what `attempts` supports; the library holds no threshold. */
|
|
42
|
+
estimate: Estimate;
|
|
43
|
+
interval: Interval | null;
|
|
44
|
+
tiers: TierCounts | null;
|
|
45
|
+
cost: {
|
|
46
|
+
perSolvedUsd: number | null;
|
|
47
|
+
basis: CostBasis;
|
|
48
|
+
receipts: number | null;
|
|
49
|
+
};
|
|
50
|
+
medianWallMs: number | null;
|
|
51
|
+
/** Null when the producer computed no frontier. */
|
|
52
|
+
onFront: boolean | null;
|
|
53
|
+
}
|
|
54
|
+
/** One task × setup cell. */
|
|
55
|
+
interface MatrixCell {
|
|
56
|
+
task: string;
|
|
57
|
+
setup: string;
|
|
58
|
+
/** Attempts that count; null when the cell never ran. */
|
|
59
|
+
attempts: number | null;
|
|
60
|
+
/** Attempts that passed; null when no pass rule applies. */
|
|
61
|
+
solved: number | null;
|
|
62
|
+
/** Attempts graded on the App Grade ladder. */
|
|
63
|
+
tiers: TierCounts | null;
|
|
64
|
+
/** Attempts graded U: no floor check failed, but one could not be observed. */
|
|
65
|
+
unmeasured?: number;
|
|
66
|
+
/** Attempts whose grade failed an integrity check and awaits human review. */
|
|
67
|
+
flagged?: number;
|
|
68
|
+
/** A lens cell's mean score; null when the setup never scored the task. */
|
|
69
|
+
mean: number | null;
|
|
70
|
+
costUsd: number | null;
|
|
71
|
+
}
|
|
72
|
+
interface ComparisonRow {
|
|
73
|
+
/** Setup ids. */
|
|
74
|
+
favored: string;
|
|
75
|
+
other: string;
|
|
76
|
+
pairs: number | null;
|
|
77
|
+
minimumEffect: number | null;
|
|
78
|
+
/** The clustered interval on the difference, in the measure's units. */
|
|
79
|
+
interval: Interval | null;
|
|
80
|
+
/** The exact interval, drawn under the clustered one when present. */
|
|
81
|
+
exactInterval: Interval | null;
|
|
82
|
+
}
|
|
83
|
+
interface BreakdownInput {
|
|
84
|
+
reasons: string[];
|
|
85
|
+
setups: Array<{
|
|
86
|
+
id: string;
|
|
87
|
+
label: string;
|
|
88
|
+
n: number | null;
|
|
89
|
+
}>;
|
|
90
|
+
counts: Array<{
|
|
91
|
+
reason: string;
|
|
92
|
+
setup: string;
|
|
93
|
+
count: number | null;
|
|
94
|
+
}>;
|
|
95
|
+
excluded: {
|
|
96
|
+
count: number;
|
|
97
|
+
why: string;
|
|
98
|
+
} | null;
|
|
99
|
+
/** True when one attempt can count under several reasons. */
|
|
100
|
+
overlapping?: boolean;
|
|
101
|
+
}
|
|
102
|
+
/** Attempts left out of a figure, stated in its note. */
|
|
103
|
+
interface Exclusion {
|
|
104
|
+
count: number;
|
|
105
|
+
why: string;
|
|
106
|
+
}
|
|
107
|
+
interface Figure {
|
|
108
|
+
id: string;
|
|
109
|
+
/** Generated from the input; no function accepts heading text. */
|
|
110
|
+
finding: string;
|
|
111
|
+
/** One quantified sentence. */
|
|
112
|
+
lede: string;
|
|
113
|
+
/** How to read the marks. */
|
|
114
|
+
read: string;
|
|
115
|
+
/** Wide and phone renders; vertical columns retain a readable minimum width. Null means the phone view uses the table. */
|
|
116
|
+
svg: {
|
|
117
|
+
wide: string;
|
|
118
|
+
narrow: string | null;
|
|
119
|
+
interactive?: boolean;
|
|
120
|
+
};
|
|
121
|
+
/** An HTML table with every number the plot shows. */
|
|
122
|
+
table: string;
|
|
123
|
+
note: {
|
|
124
|
+
method: string;
|
|
125
|
+
n: string;
|
|
126
|
+
exclusions: string[];
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
interface Refusal {
|
|
130
|
+
id: string;
|
|
131
|
+
refused: string;
|
|
132
|
+
}
|
|
133
|
+
declare function isRefusal(value: Figure | Refusal): value is Refusal;
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/axis.d.ts
|
|
136
|
+
/** One column of an ordinal x axis. Points sit at a category's `at`; `weight` scales its width (default 1). */
|
|
137
|
+
interface XCategory {
|
|
138
|
+
at: number;
|
|
139
|
+
label: string;
|
|
140
|
+
weight?: number;
|
|
141
|
+
}
|
|
142
|
+
/** A recorded goal on the y axis, such as a paper's bar: a band from `from` to `to`, or a line when they are equal. */
|
|
143
|
+
interface YTarget {
|
|
144
|
+
from: number;
|
|
145
|
+
to: number;
|
|
146
|
+
label: string;
|
|
147
|
+
kind: "target" | "stretch";
|
|
148
|
+
}
|
|
149
|
+
/** A caller-named gridline, such as a check stage. */
|
|
150
|
+
interface YTick {
|
|
151
|
+
at: number;
|
|
152
|
+
label: string;
|
|
153
|
+
}
|
|
154
|
+
type YScale = "linear" | "log";
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/svg.d.ts
|
|
157
|
+
/** Point shapes: the second channel that keeps series distinct without colour. */
|
|
158
|
+
type MarkerShape = "circle" | "square" | "triangle" | "diamond";
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/events.d.ts
|
|
161
|
+
/**
|
|
162
|
+
* `pass` is solid, `deadline` dashed, `died` ends in a cross and `event` is dotted. `release`, `steer`, `ruling` and
|
|
163
|
+
* `wake` carry a head shape (diamond, triangle, square, circle), so every kind reads without colour.
|
|
164
|
+
*/
|
|
165
|
+
type MarkKind = "pass" | "deadline" | "died" | "event" | "release" | "steer" | "ruling" | "wake";
|
|
166
|
+
/** A recorded verdict, such as a release tag's check: pass and fail take the status tones, unknown the muted tone. */
|
|
167
|
+
type MarkVerdict = "pass" | "fail" | "unknown";
|
|
168
|
+
interface ChartMark {
|
|
169
|
+
at: number;
|
|
170
|
+
label: string;
|
|
171
|
+
kind: MarkKind;
|
|
172
|
+
verdict?: MarkVerdict;
|
|
173
|
+
/** Who made the event, such as the operator or the keeper for a steer. Shown with the label and in the table. */
|
|
174
|
+
source?: string;
|
|
175
|
+
/** `timeline` only: the lane the event belongs to. It is drawn on that lane instead of across every lane. */
|
|
176
|
+
lane?: string;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* `missing` is hatched: a span with no data is never drawn as zero. `blocked` is a system-wide wall, such as a quota
|
|
180
|
+
* window. `group` labels a run of positions in a header row above the data, such as one run's release tags, with a
|
|
181
|
+
* rule at each edge; a group may cover a single position (`from` equal to `to`).
|
|
182
|
+
*/
|
|
183
|
+
type BandKind = "after-pass" | "idle" | "missing" | "blocked" | "group";
|
|
184
|
+
interface ChartBand {
|
|
185
|
+
from: number;
|
|
186
|
+
to: number;
|
|
187
|
+
label: string;
|
|
188
|
+
kind: BandKind;
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/points.d.ts
|
|
192
|
+
/** A status glyph beside a mark: `check` for a solve, `cross` for a failing candidate. */
|
|
193
|
+
type PointGlyph = "check" | "cross";
|
|
194
|
+
interface PointFields {
|
|
195
|
+
/**
|
|
196
|
+
* A recorded verdict: `pass` draws a filled mark (solved, contract held), `fail` an outline (not solved, contract
|
|
197
|
+
* failed), `unknown` a dashed outline (undecided). A verdict with a null value is drawn in the strip under the plot.
|
|
198
|
+
*/
|
|
199
|
+
verdict?: MarkVerdict;
|
|
200
|
+
/** How many recorded rows this mark stands for. Above 1 it carries a `×n` badge. */
|
|
201
|
+
count?: number;
|
|
202
|
+
/** Epoch milliseconds of the first and last recorded row, shown on hover and in the table. */
|
|
203
|
+
firstAt?: number;
|
|
204
|
+
lastAt?: number;
|
|
205
|
+
/** Whether the value can be compared with the goal: false is an outline with `*`, null (unknown) an outline with `?`. */
|
|
206
|
+
comparable?: boolean | null;
|
|
207
|
+
glyph?: PointGlyph;
|
|
208
|
+
/** This mark's shape, such as a diamond for a gate among circles for checks. Default: the series' shape. */
|
|
209
|
+
marker?: MarkerShape;
|
|
210
|
+
/** A short direct label beside the mark, such as `9/15`. */
|
|
211
|
+
label?: string;
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/outcomes.d.ts
|
|
215
|
+
/**
|
|
216
|
+
* The fixed palettes every Discovery view shares: attempt outcomes (stack order) and check versions (checkers).
|
|
217
|
+
* The colours live once, as `--chart-outcome-*` and `--chart-checker-*` custom properties in `figure.css`, each a
|
|
218
|
+
* `light-dark()` pair chosen by the page's `color-scheme`. `node scripts/palette-check.mjs <validate_palette.js>`
|
|
219
|
+
* runs both palettes through the dataviz validator on the light surface and on #161616.
|
|
220
|
+
*/
|
|
221
|
+
/**
|
|
222
|
+
* How one recorded attempt ended. `ok` succeeded; every other outcome counts as failed. `lost` is a turn the
|
|
223
|
+
* platform lost without a kill (a sandbox that vanished), distinct from `oom`, a turn killed for memory.
|
|
224
|
+
*/
|
|
225
|
+
type TickOutcome = "ok" | "quota" | "lost" | "rate-limit" | "oom" | "refused" | "aborted" | "other";
|
|
226
|
+
/**
|
|
227
|
+
* Outcomes in stack order. Adjacent outcomes pass the colour-vision checks in both themes in this order, so a stacked
|
|
228
|
+
* bar keeps it; `aborted` and `other` share the neutral tone and always carry a label. An attempt still running is
|
|
229
|
+
* `open` and is drawn hatched, never as an outcome.
|
|
230
|
+
*/
|
|
231
|
+
declare const OUTCOME_ORDER: readonly TickOutcome[];
|
|
232
|
+
/** The CSS colour of each outcome, for a caller that paints its own marks (a legend, a stacked bar). */
|
|
233
|
+
declare const OUTCOME_COLORS: Readonly<Record<TickOutcome, string>>;
|
|
234
|
+
/** How many checkers have their own hue. Index 0 is the current checker; later indexes are older checkers. */
|
|
235
|
+
declare const CHECKER_HUES = 4;
|
|
236
|
+
/** The CSS colour of checker `index` (0 is current). Indexes past the fourth hue fold into the muted tone. */
|
|
237
|
+
declare function checkerColor(index: number): string;
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/timeline.d.ts
|
|
240
|
+
/** Epoch milliseconds. `end: null` is an open span; it needs the figure's `now`. */
|
|
241
|
+
interface TimelineSpan {
|
|
242
|
+
start: number;
|
|
243
|
+
end: number | null;
|
|
244
|
+
state: string;
|
|
245
|
+
note?: string;
|
|
246
|
+
}
|
|
247
|
+
/** One recorded attempt on a lane, such as a driver turn, at the time it ended. `note` (an error line) shows on hover. */
|
|
248
|
+
interface TimelineTick {
|
|
249
|
+
at: number;
|
|
250
|
+
outcome: TickOutcome;
|
|
251
|
+
note?: string;
|
|
252
|
+
}
|
|
253
|
+
interface TimelineLane {
|
|
254
|
+
id: string;
|
|
255
|
+
label: string;
|
|
256
|
+
spans: TimelineSpan[];
|
|
257
|
+
/** The lane that started this one. The lane is drawn under its parent with a tree connector. */
|
|
258
|
+
parent?: string;
|
|
259
|
+
/** Tree depth: 0 for a root. Defaults to the parent's depth plus one, or 0 without a parent. */
|
|
260
|
+
depth?: number;
|
|
261
|
+
/** Recorded attempts, drawn as ticks with ok and failed counts at the lane's end. Omit when attempts are not recorded. */
|
|
262
|
+
ticks?: TimelineTick[];
|
|
263
|
+
/** Caller-composed facts, one per hover line on the lane and each of its spans: profile, model, status, attempts, cost, top error. */
|
|
264
|
+
detail?: string[];
|
|
265
|
+
}
|
|
266
|
+
interface TimelineOptions {
|
|
267
|
+
measure: string;
|
|
268
|
+
/**
|
|
269
|
+
* The recorded window; defaults to the extent of the data (spans, ticks and `now`). Spans, ticks and `now` must fall
|
|
270
|
+
* inside it. Marks outside it, such as a later deadline, are named at the edge they fall past; bands are clipped.
|
|
271
|
+
*/
|
|
272
|
+
start?: number;
|
|
273
|
+
end?: number;
|
|
274
|
+
/** The time an open span is drawn to. Required when any span is open. */
|
|
275
|
+
now?: number;
|
|
276
|
+
marks?: ChartMark[];
|
|
277
|
+
bands?: ChartBand[];
|
|
278
|
+
/** States drawn hatched because their time has no data. Default: missing, untraced. */
|
|
279
|
+
hatch?: string[];
|
|
280
|
+
/** States drawn in the muted tone, such as idle. Default: idle. */
|
|
281
|
+
muted?: string[];
|
|
282
|
+
/**
|
|
283
|
+
* Lane ids whose subtrees are folded: descendants are hidden and the lane's ticks and counts include them. Passing
|
|
284
|
+
* it, even empty, makes each parent lane's label a fold toggle (`data-toggle`), which React `TimelineView` wires up.
|
|
285
|
+
* Ids that name no lane are ignored, so a fold state can outlive the lanes it was made for.
|
|
286
|
+
*/
|
|
287
|
+
collapsed?: string[];
|
|
288
|
+
formatTime?: (ms: number) => string;
|
|
289
|
+
id?: string;
|
|
290
|
+
}
|
|
291
|
+
declare function timeline(lanes: TimelineLane[], o: TimelineOptions): Figure | Refusal;
|
|
292
|
+
//#endregion
|
|
293
|
+
export { IntervalMethod as A, BreakdownInput as C, Exclusion as D, Estimate as E, Tier as F, TierCounts as I, isRefusal as L, RateRow as M, Refusal as N, Figure as O, Setup as P, YTick as S, CostBasis as T, MarkVerdict as _, timeline as a, YScale as b, OUTCOME_ORDER as c, PointFields as d, PointGlyph as f, MarkKind as g, ChartMark as h, TimelineTick as i, MatrixCell as j, Interval as k, TickOutcome as l, ChartBand as m, TimelineOptions as n, CHECKER_HUES as o, BandKind as p, TimelineSpan as r, OUTCOME_COLORS as s, TimelineLane as t, checkerColor as u, MarkerShape as v, ComparisonRow as w, YTarget as x, XCategory as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/charts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Static SVG and HTML figures for benchmarks and operational timing. Draws from producer data and refuses what it cannot draw honestly.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|