@azure-id/orc 1.4.0 → 1.4.2

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.
@@ -1,409 +1,431 @@
1
- "use strict";
2
- /**
3
- * fixtures/hookui.js — canned `orc statusline …` responses.
4
- *
5
- * ONE OF EVERY STATE, INCLUDING THE UGLY ONES. You cannot design a caution
6
- * strip on a layout that validates, a `5/5` chip on a line with two things on
7
- * it, or a refused palette row on a project where nothing is refused.
8
- *
9
- * So this set carries: the feature OFF with a saved layout, a line at 5/5, a
10
- * line 3 blocked by the dense-prefix rule, one hard error and two warnings, a
11
- * refused component, a component rendering an em dash, and a preview in all
12
- * three degraded forms.
13
- *
14
- * The ANSI here is REAL — the panel's job is to turn escape sequences into DOM,
15
- * and a fixture of plain text would exercise none of that.
16
- */
17
-
18
- const E = String.fromCharCode(27);
19
- const R = E + "[0m";
20
- const dim = (s) => E + "[90m" + s + R;
21
- const green = (s) => E + "[32m" + s + R;
22
- const amber = (s) => E + "[33m" + s + R;
23
- const red = (s) => E + "[31m" + s + R;
24
-
25
- // The rendered bar, in its four forms. Line 3 is deliberately the shortest —
26
- // the board's third line usually is.
27
- const previewText =
28
- amber("🚀") + " " + dim("ORC ") + "1.3.0 · Opus 5/high · " + dim("context ") + green("38%") + " · " + amber("██████░░░░") + "\n" +
29
- " ▰ " + dim("status ") + "quick · Q3 DO · " + dim("agents ") + " 7 · " + dim("Dur ") + " 48m · main\n" +
30
- " " + dim("cache ") + "●" + " " + green("███████▊░░") + " · " + dim("MTok ") + "412K · " + red("—");
31
-
32
- const previewNoColor =
33
- "🚀 ORC 1.3.0 · Opus 5/high · context 38% · ██████░░░░\n" +
34
- " ▰ status quick · Q3 DO · agents 7 · Dur 48m · main\n" +
35
- " cache ● ███████▊░░ · MTok 412K · —";
36
-
37
- const previewAscii =
38
- "++ ORC 1.3.0 - Opus 5/high - context 38% - ######....\n" +
39
- " = status quick - Q3 DO - agents 7 - Dur 48m - main\n" +
40
- " cache o #######|.. - MTok 412K - -";
41
-
42
- const preview = {
43
- ok: true,
44
- width: 120,
45
- state: "healthy",
46
- fixture: "a healthy session mid-run",
47
- fixtures: {
48
- healthy: "a healthy session mid-run",
49
- degraded: "the wrong tier, a full window, and nothing running",
50
- empty: "a payload with nothing in it — every component on its unknown form",
51
- },
52
- text: previewText,
53
- strippings: { no_color: previewNoColor, ascii: previewAscii, no_motion: previewNoColor },
54
- static_width: [58, 62, 44],
55
- errors: [],
56
- };
57
-
58
- // A rendered sample per renderer, which is what makes the shape gallery a
59
- // gallery rather than a dropdown of words.
60
- const P = (id) => ({
61
- bare: "38%",
62
- plain: dim(id + " ") + "38%",
63
- "label-value": dim(id.toUpperCase() + ": ") + "38%",
64
- bracket: "[" + dim(id.toUpperCase() + " ") + "38%]",
65
- paren: "(38%)",
66
- badge: "▏" + dim(id.toUpperCase() + " ") + "38%▕",
67
- pill: E + "[7m" + id.slice(0, 3).toUpperCase() + R + "38%",
68
- bar: "38% " + amber("███░░░░░░░"),
69
- blocks: amber("███░░░░░░░"),
70
- fine: amber("███▊ "),
71
- dots: "●●●○○",
72
- gauge: "◔",
73
- ring: "◔",
74
- shape: green("●"),
75
- word: green("ok"),
76
- icon: "✅",
77
- spark: "▁▂▃▅▆▇",
78
- trend: "▲",
79
- });
80
-
81
- const components = {
82
- ok: true,
83
- schema: 1,
84
- catalog_hash: "b7c1d2e3f4a5968708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f",
85
- count: 6,
86
- groups: { A: "Session and tier", B: "Quota and spend", D: "Knowledge", H: "Project and VCS" },
87
- components: [
88
- {
89
- id: "verdict", group: "A", label: null,
90
- summary: "The ORC-ready verdict icon.",
91
- renderers: ["icon", "shape", "word", "badge"],
92
- defaults: { render: "icon" },
93
- states: ["ready", "boosted", "degrade"],
94
- shapes: { ready: "✅", boosted: "🚀", degrade: "⛔" },
95
- bounded: false, series: null, unknown: "dash", cost: "free",
96
- refused_reason: null, params: null, binding: "verdict.state",
97
- composite: null, time_based: false,
98
- previews: { icon: "🚀", shape: "🚀", word: green("boosted"), badge: "▏🚀▕" },
99
- },
100
- {
101
- id: "context", group: "A", label: "context",
102
- summary: "How full the context window is.",
103
- renderers: ["plain", "label-value", "bar", "blocks", "fine", "dots", "gauge", "ring", "bare"],
104
- defaults: { render: "plain", format: "percent", min_width: 3, align: "right", ramp: "heat" },
105
- states: ["ok", "warn", "full"],
106
- shapes: { ok: "●", warn: "◐", full: "○" },
107
- bounded: true, series: null, unknown: "dash", cost: "free",
108
- refused_reason: null, params: null, binding: "ctx.used_pct",
109
- composite: null, time_based: false,
110
- previews: P("context"),
111
- },
112
- {
113
- id: "quota-5h", group: "B", label: "5h",
114
- summary: "The 5-hour usage window.",
115
- renderers: ["plain", "bar", "blocks", "spark", "bare"],
116
- defaults: { render: "plain", format: "percent", min_width: 3, align: "right", ramp: "heat" },
117
- states: ["ok", "warn", "critical"],
118
- shapes: { ok: "●", warn: "◐", critical: "○" },
119
- bounded: true, series: "quota5h", unknown: "dash", cost: "free",
120
- refused_reason: null, params: null, binding: "quota.5h.pct",
121
- composite: null, time_based: false,
122
- previews: P("5h"),
123
- },
124
- // A COMPONENT RENDERING AN EM DASH. Its file does not exist in this
125
- // project, so it says so — and it is still placeable, because `—` and "this
126
- // build has no such segment" are different facts.
127
- {
128
- id: "wiki", group: "D", label: "wiki",
129
- summary: "How old the project wiki is, from the wiki's own oldest anchor.",
130
- renderers: ["word", "shape", "badge"],
131
- defaults: { render: "word" },
132
- states: ["fresh", "aging", "stale", "unregistered", "none"],
133
- shapes: { fresh: "●", aging: "◐", stale: "○", unregistered: "?", none: "·" },
134
- bounded: false, series: null, unknown: "dash", cost: "new-read",
135
- refused_reason: null, params: null, binding: "wiki.tier",
136
- composite: null, time_based: false,
137
- previews: { word: "—", shape: "—", badge: "▏—▕" },
138
- },
139
- {
140
- id: "branch", group: "H", label: null,
141
- summary: "The current git branch, read from .git/HEAD with NO subprocess.",
142
- renderers: ["bare", "plain", "badge"],
143
- defaults: { render: "bare", truncate: "middle", max_len: 24 },
144
- states: null, shapes: null, bounded: false, series: null,
145
- unknown: "hide", cost: "scan", refused_reason: null, params: null,
146
- binding: "git.branch", composite: null, time_based: false,
147
- previews: { bare: "main", plain: dim("branch ") + "main", badge: "▏main▕" },
148
- },
149
- // A REFUSED ROW. It keeps its slot, carries the measurement, and gets NO
150
- // BUTTON AT ALL — never a disabled one. "We decided against this" and "we
151
- // forgot" must not look the same.
152
- {
153
- id: "git-dirty", group: "H", label: "±",
154
- summary: "Uncommitted changes.",
155
- renderers: ["plain", "label-value", "bare"],
156
- defaults: { render: "plain" },
157
- states: null, shapes: null, bounded: false, series: null,
158
- unknown: "dash", cost: "refused",
159
- refused_reason:
160
- "it needs a `git status` subprocess, and W0 measured one at 53ms against roughly 15ms of headroom on a surface that re-renders on every keystroke.",
161
- params: null, binding: null, composite: null, time_based: false,
162
- previews: {},
163
- },
164
- ],
165
- renderers: {
166
- bare: { kind: "text", form: "value", needs: null, width: null, decoration: false },
167
- plain: { kind: "text", form: "label value", needs: null, width: null, decoration: false },
168
- "label-value": { kind: "text", form: "LABEL: value", needs: null, width: null, decoration: false },
169
- bracket: { kind: "text", form: "[LABEL: value]", needs: null, width: null, decoration: false },
170
- paren: { kind: "text", form: "(value)", needs: null, width: null, decoration: false },
171
- badge: { kind: "text", form: "▏LABEL value▕", needs: null, width: null, decoration: false },
172
- pill: { kind: "text", form: "⟪LABEL⟫value", needs: null, width: null, decoration: false },
173
- word: { kind: "text", form: "STATE", needs: "states", width: null, decoration: false },
174
- bar: { kind: "bar", form: null, needs: "bounded", width: [4, 16], decoration: false },
175
- blocks: { kind: "bar", form: null, needs: "bounded", width: [2, 16], decoration: false },
176
- fine: { kind: "bar", form: null, needs: "bounded", width: [2, 16], decoration: false },
177
- dots: { kind: "bar", form: null, needs: "ordinal", width: [2, 10], decoration: false },
178
- gauge: { kind: "bar", form: null, needs: "bounded", width: [1, 1], decoration: false },
179
- ring: { kind: "bar", form: null, needs: "bounded", width: [1, 1], decoration: false },
180
- shape: { kind: "state", form: null, needs: "states", width: null, decoration: false },
181
- icon: { kind: "state", form: null, needs: "states", width: null, decoration: false },
182
- spark: { kind: "series", form: null, needs: "series", width: [4, 16], decoration: false },
183
- trend: { kind: "series", form: null, needs: "series", width: null, decoration: false },
184
- },
185
- glyph_sets: ["blocks", "bars", "pipes", "braille", "shade", "minimal", "ascii"],
186
- ramps: {
187
- heat: { stops: [0, 60, 85], colors: ["green", "yellow", "red"], why: "high is bad" },
188
- cool: { stops: [0, 60, 85], colors: ["red", "yellow", "green"], why: "high is good" },
189
- mono: { stops: [0, 60, 85], colors: [null, null, null], why: "NO_COLOR-safe: emphasis, not hue" },
190
- state: { stops: null, colors: null, why: "the component's own state colours" },
191
- },
192
- themes: {
193
- terminal: { ok: "green", warn: "yellow", critical: "red", muted: "bright-black", accent: "cyan", label: "bright-black", value: "default" },
194
- dim: { ok: "green", warn: "yellow", critical: "red", muted: "bright-black", accent: "bright-black", label: "bright-black", value: "bright-black" },
195
- "high-contrast": { ok: "bright-green", warn: "bright-yellow", critical: "bright-red", muted: "white", accent: "bright-cyan", label: "bright-white", value: "bright-white" },
196
- mono: { ok: null, warn: null, critical: null, muted: null, accent: null, label: null, value: null },
197
- },
198
- hide_when: [
199
- { id: "never", says: "always render. A state keeps its slot." },
200
- { id: "empty", says: "hide when the value is absent" },
201
- { id: "zero", says: "hide when the value is exactly 0" },
202
- { id: "unknown", says: "hide when the value could not be computed" },
203
- { id: "ok", says: "hide while healthy — show me only problems" },
204
- { id: "idle", says: "hide when no run is active" },
205
- { id: "no-run", says: "hide when no ORC run was opened this session" },
206
- { id: "narrow", says: "hide below this component's min_cols" },
207
- { id: "wide", says: "hide above this component's max_cols" },
208
- ],
209
- formats: ["percent", "ratio", "fraction", "decimal", "plain"],
210
- compact: ["off", "si", "bytes"],
211
- cases: ["none", "upper", "lower", "title"],
212
- truncate: ["end", "middle", "none"],
213
- emphasis: ["normal", "bold", "dim", "italic", "underline", "reverse", "strike"],
214
- refused_emphasis: ["blink"],
215
- colors: ["red", "green", "yellow", "blue", "magenta", "cyan", "bright-black", "bright-cyan", "default"],
216
- max_per_line: 5,
217
- lines: 3,
218
- dense_prefix: "A line may hold a component only if every line above it holds at least one.",
219
- };
220
-
221
- // THE FEATURE IS OFF WITH A LAYOUT SAVED the state a user is in for most of
222
- // the time they are composing, and the one the gate card exists for. Line 1 is
223
- // at 5/5; line 3 is empty, so the board can show a full line and an ordinary
224
- // one at once.
225
- const show = {
226
- ok: false,
227
- enabled: false,
228
- saved: true,
229
- preset: null,
230
- theme: "terminal",
231
- glyphs: "blocks",
232
- ansi: "auto",
233
- align_columns: false,
234
- lines: [
235
- {
236
- line: 1, separator: " · ", theme: null, max_width: 0, count: 5, counted: 5, full: true,
237
- items: [
238
- { pos: 1, id: "i1", type: "verdict", render: "icon", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "dash", known: true },
239
- { pos: 2, id: "i2", type: "context", render: "bar", label: "CTX", label_color: "bright-black", value_color: null, ramp: "heat", emphasis: ["bold"], hide_when: [], unknown: "dash", known: true },
240
- { pos: 3, id: "i3", type: "quota-5h", render: "plain", label: "5h", label_color: "bright-black", value_color: "default", ramp: "heat", emphasis: [], hide_when: [], unknown: "dash", known: true },
241
- { pos: 4, id: "i4", type: "branch", render: "bare", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "hide", known: true },
242
- { pos: 5, id: "i5", type: "wiki", render: "word", label: "wiki", label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "dash", known: true },
243
- ],
244
- },
245
- {
246
- line: 2, separator: " · ", theme: null, max_width: 0, count: 2, counted: 2, full: false,
247
- items: [
248
- { pos: 1, id: "i6", type: "context", render: "fine", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: ["ok"], unknown: "dash", known: true },
249
- // AN UNKNOWN COMPONENT ID — what an upgrade that retired a component
250
- // leaves behind. Reported, never auto-repaired.
251
- { pos: 2, id: "i7", type: "retired-thing", render: "bare", label: null, label_color: null, value_color: null, ramp: null, emphasis: [], hide_when: [], unknown: null, known: false },
252
- ],
253
- },
254
- { line: 3, separator: " · ", theme: null, max_width: 0, count: 0, counted: 0, full: false, items: [] },
255
- ],
256
- // ONE HARD ERROR and TWO WARNINGS, so the caution strip can show that an error
257
- // is a refusal and a warning is a fact the user then owns.
258
- errors: ['unknown component "retired-thing" on line 2 position 2 did you mean "resume"?'],
259
- warnings: [
260
- "line 1 shows the same value twice (context, context)",
261
- '"verdict" carries meaning in its colour (ready/boosted/degrade) and you set a flat colour a green is a status line that lies',
262
- ],
263
- preview: previewText,
264
- dense_prefix: components.dense_prefix,
265
- };
266
-
267
- const presets = {
268
- ok: true,
269
- presets: [
270
- { name: "orc-default", summary: "Today's two lines, exactly. The byte-identical baseline.", active: false, preview: previewNoColor.split("\n").slice(0, 2).join("\n") },
271
- { name: "minimal", summary: "One line, four slots, the dim theme. The support answer for a busy terminal.", active: false, preview: dim("🚀 ORC 1.3.0 · Opus 5/high · ") + amber("███▊ ") + dim(" · main") },
272
- { name: "cost-watch", summary: "What this session is spending, in every unit the payload gives for free.", active: true, preview: previewText.split("\n").slice(0, 2).join("\n") },
273
- { name: "mono", summary: "No colour anywhere — shapes and emphasis only. The right preset for a README screenshot.", active: false, preview: previewNoColor },
274
- ],
275
- };
276
-
277
- const explain = {
278
- ok: true,
279
- id: "i2",
280
- type: "context",
281
- line: 1,
282
- pos: 2,
283
- resolved: [
284
- { field: "render", value: "bar", source: "item" },
285
- { field: "label", value: "CTX", source: "item" },
286
- { field: "label_color", value: "bright-black", source: "theme:terminal" },
287
- { field: "glyphs", value: "blocks", source: "file" },
288
- { field: "min_width", value: 3, source: "catalogue" },
289
- { field: "ramp", value: "heat", source: "catalogue" },
290
- ],
291
- order: ["catalogue", "theme", "file", "line", "item"],
292
- };
293
-
294
-
295
- // ── the SECOND board (v1.4.0) ──────────────────────────────────────────────
296
- // A designer cannot lay out a per-agent row against the status line's
297
- // components, so the fixture set carries both boards. Same rule as everywhere
298
- // else here: one of every state, including the ugly ones — a failed agent, an
299
- // agent whose window size is unknown, and one whose token count has not been
300
- // seen yet.
301
- const subComponents = {
302
- ok: true,
303
- schema: 1,
304
- catalog_hash: components.catalog_hash,
305
- count: 4,
306
- board: "subagent",
307
- boards: ["status", "subagent"],
308
- config_key: "subagent_line_custom",
309
- setting: "subagentStatusLine",
310
- groups: { T: "One subagent (the agent-panel row)" },
311
- components: [
312
- {
313
- id: "task-name", group: "T", board: "subagent", label: null,
314
- summary: "The agent's name.",
315
- renderers: ["bare", "plain", "badge", "pill"],
316
- defaults: { render: "bare", truncate: "middle", max_len: 28 },
317
- states: null, shapes: null, bounded: false, series: null,
318
- unknown: "dash", cost: "free", refused_reason: null, params: null,
319
- binding: "task.name", composite: null, time_based: false,
320
- previews: { bare: "orc-executor-opus-5-low", plain: dim("task-name ") + "orc-executor-opus-5-low", badge: "▏orc-executor-opus-5-low▕", pill: E + "[7mTASK" + R + "orc-executor-opus-5-low" },
321
- },
322
- {
323
- id: "task-tier", group: "T", board: "subagent", label: null,
324
- summary: "The model and effort this agent is ACTUALLY running at — observed, not derived from its name and not self-reported.",
325
- renderers: ["bare", "plain", "label-value", "badge"],
326
- defaults: { render: "bare" },
327
- states: null, shapes: null, bounded: false, series: null,
328
- unknown: "dash", cost: "free", refused_reason: null, params: null,
329
- binding: "task.tier", composite: null, time_based: false,
330
- previews: { bare: "O5/low", plain: dim("tier ") + "O5/low", "label-value": dim("TIER: ") + "O5/low", badge: "▏O5/low▕" },
331
- },
332
- {
333
- id: "task-tokens", group: "T", board: "subagent", label: null,
334
- summary: "How many tokens this agent has used. THE NUMBER v1.2.0 SAID COULD NOT BE MEASURED.",
335
- renderers: ["plain", "label-value", "bare"],
336
- defaults: { render: "plain", compact: "si" },
337
- states: null, shapes: null, bounded: false, series: null,
338
- unknown: "dash", cost: "free", refused_reason: null, params: null,
339
- binding: "task.tokens", composite: null, time_based: false,
340
- previews: { plain: "84K", "label-value": dim("TOKENS: ") + "84K", bare: "84K" },
341
- },
342
- {
343
- id: "task-status", group: "T", board: "subagent", label: null,
344
- summary: "What this agent is doing.",
345
- renderers: ["word", "shape", "badge", "bare"],
346
- defaults: { render: "word" },
347
- states: ["pending", "running", "completed", "failed"],
348
- shapes: { pending: "", running: "", completed: "✓", failed: "▲" },
349
- bounded: false, series: null, unknown: "dash", cost: "free",
350
- refused_reason: null, params: null, binding: "task.status",
351
- composite: null, time_based: false,
352
- previews: { word: amber("running"), shape: amber("●"), badge: "▏" + amber("running") + "▕", bare: "running" },
353
- },
354
- ],
355
- renderers: components.renderers,
356
- glyph_sets: components.glyph_sets,
357
- ramps: components.ramps,
358
- themes: components.themes,
359
- hide_when: components.hide_when,
360
- formats: components.formats,
361
- compact: components.compact,
362
- cases: components.cases,
363
- truncate: components.truncate,
364
- emphasis: components.emphasis,
365
- refused_emphasis: components.refused_emphasis,
366
- colors: components.colors,
367
- max_per_line: 5,
368
- // ONE LINE by construction: Claude Code renders one row per task.
369
- lines: 1,
370
- dense_prefix: components.dense_prefix,
371
- };
372
-
373
- const subShow = {
374
- ok: true,
375
- enabled: true,
376
- saved: true,
377
- preset: "agent-default",
378
- theme: "terminal",
379
- glyphs: "blocks",
380
- ansi: "auto",
381
- align_columns: false,
382
- lines: [
383
- {
384
- line: 1, separator: " · ", theme: null, max_width: 0, count: 4, counted: 4, full: false,
385
- items: [
386
- { pos: 1, id: "s1", type: "task-status", render: "shape", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "dash", known: true },
387
- { pos: 2, id: "s2", type: "task-name", render: "bare", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "dash", known: true },
388
- { pos: 3, id: "s3", type: "task-tier", render: "bare", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: ["dim"], hide_when: [], unknown: "dash", known: true },
389
- { pos: 4, id: "s4", type: "task-tokens", render: "plain", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "dash", known: true },
390
- ],
391
- },
392
- ],
393
- errors: [],
394
- // A layout can be perfectly valid and still worth a caution.
395
- warnings: ["task-tokens is a FLOOR: an agent that finishes between two redraws is never counted"],
396
- preview: amber("●") + " orc-executor-opus-5-low · " + dim("O5/low") + " · 84K",
397
- dense_prefix: components.dense_prefix,
398
- };
399
-
400
- const subPresets = {
401
- ok: true,
402
- presets: [
403
- { name: "agent-default", board: "subagent", summary: "What the agent is, what it is running at, and what it has cost so far.", active: true, preview: "orc-executor-opus-5-low · " + dim("O5/low") + " · 84K · " + dim("for ") + " 17m" },
404
- { name: "agent-watch", board: "subagent", summary: "For a run you are watching: status, its own context window, and the clock.", active: false, preview: amber("●") + " orc-executor-opus-5-low · " + green("███▎░░░░") + " · " + dim("for ") + " 17m" },
405
- { name: "agent-tier", board: "subagent", summary: "The downgrade check, made visible: the model and effort ORC actually got, per agent.", active: false, preview: "orc-executor-opus-5-low · claude-opus-5 · low · " + amber("running") },
406
- ],
407
- };
408
-
409
- module.exports = { show, components, presets, preview, explain, subShow, subComponents, subPresets };
1
+ "use strict";
2
+ /**
3
+ * fixtures/hookui.js — canned `orc statusline …` responses.
4
+ *
5
+ * ONE OF EVERY STATE, INCLUDING THE UGLY ONES. You cannot design a caution
6
+ * strip on a layout that validates, a `5/5` chip on a line with two things on
7
+ * it, or a refused palette row on a project where nothing is refused.
8
+ *
9
+ * So this set carries: the feature OFF with a saved layout, a line at 5/5, a
10
+ * line 3 blocked by the dense-prefix rule, one hard error and two warnings, a
11
+ * refused component, a component rendering an em dash, and a preview in all
12
+ * three degraded forms.
13
+ *
14
+ * The ANSI here is REAL — the panel's job is to turn escape sequences into DOM,
15
+ * and a fixture of plain text would exercise none of that.
16
+ */
17
+
18
+ const E = String.fromCharCode(27);
19
+ const R = E + "[0m";
20
+ const dim = (s) => E + "[90m" + s + R;
21
+ const green = (s) => E + "[32m" + s + R;
22
+ const amber = (s) => E + "[33m" + s + R;
23
+ const red = (s) => E + "[31m" + s + R;
24
+
25
+ // The rendered bar, in its four forms. Line 3 is deliberately the shortest —
26
+ // the board's third line usually is.
27
+ const previewText =
28
+ amber("🚀") + " " + dim("ORC ") + "1.3.0 · Opus 5/high · " + dim("context ") + green("38%") + " · " + amber("██████░░░░") + "\n" +
29
+ " ▰ " + dim("status ") + "quick · Q3 DO · " + dim("agents ") + " 7 · " + dim("Dur ") + " 48m · main\n" +
30
+ " " + dim("cache ") + "●" + " " + green("███████▊░░") + " · " + dim("MTok ") + "412K · " + red("—");
31
+
32
+ const previewNoColor =
33
+ "🚀 ORC 1.3.0 · Opus 5/high · context 38% · ██████░░░░\n" +
34
+ " ▰ status quick · Q3 DO · agents 7 · Dur 48m · main\n" +
35
+ " cache ● ███████▊░░ · MTok 412K · —";
36
+
37
+ const previewAscii =
38
+ "++ ORC 1.3.0 - Opus 5/high - context 38% - ######....\n" +
39
+ " = status quick - Q3 DO - agents 7 - Dur 48m - main\n" +
40
+ " cache o #######|.. - MTok 412K - -";
41
+
42
+ const preview = {
43
+ ok: true,
44
+ width: 120,
45
+ state: "healthy",
46
+ fixture: "a healthy session mid-run",
47
+ fixtures: {
48
+ healthy: "a healthy session mid-run",
49
+ degraded: "the wrong tier, a full window, and nothing running",
50
+ empty: "a payload with nothing in it — every component on its unknown form",
51
+ },
52
+ text: previewText,
53
+ strippings: { no_color: previewNoColor, ascii: previewAscii, no_motion: previewNoColor },
54
+ static_width: [58, 62, 44],
55
+ errors: [],
56
+ };
57
+
58
+ // A rendered sample per renderer, which is what makes the shape gallery a
59
+ // gallery rather than a dropdown of words.
60
+ const P = (id) => ({
61
+ bare: "38%",
62
+ plain: dim(id + " ") + "38%",
63
+ "label-value": dim(id.toUpperCase() + ": ") + "38%",
64
+ bracket: "[" + dim(id.toUpperCase() + " ") + "38%]",
65
+ paren: "(38%)",
66
+ badge: "▏" + dim(id.toUpperCase() + " ") + "38%▕",
67
+ pill: E + "[7m" + id.slice(0, 3).toUpperCase() + R + "38%",
68
+ bar: "38% " + amber("███░░░░░░░"),
69
+ blocks: amber("███░░░░░░░"),
70
+ fine: amber("███▊ "),
71
+ dots: "●●●○○",
72
+ gauge: "◔",
73
+ ring: "◔",
74
+ shape: green("●"),
75
+ word: green("ok"),
76
+ icon: "✅",
77
+ spark: "▁▂▃▅▆▇",
78
+ trend: "▲",
79
+ });
80
+
81
+ const components = {
82
+ ok: true,
83
+ schema: 1,
84
+ catalog_hash: "b7c1d2e3f4a5968708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f",
85
+ count: 6,
86
+ groups: { A: "Session and tier", B: "Quota and spend", D: "Knowledge", H: "Project and VCS" },
87
+ components: [
88
+ {
89
+ id: "verdict", group: "A", label: null,
90
+ summary: "The ORC-ready verdict icon.",
91
+ renderers: ["icon", "shape", "word", "badge"],
92
+ defaults: { render: "icon" },
93
+ states: ["ready", "boosted", "degrade"],
94
+ shapes: { ready: "✅", boosted: "🚀", degrade: "⛔" },
95
+ bounded: false, series: null, unknown: "dash", cost: "free",
96
+ refused_reason: null, params: null, binding: "verdict.state",
97
+ composite: null, time_based: false, structural: false,
98
+ previews: { icon: "🚀", shape: "🚀", word: green("boosted"), badge: "▏🚀▕" },
99
+ },
100
+ {
101
+ id: "context", group: "A", label: "context",
102
+ summary: "How full the context window is.",
103
+ renderers: ["plain", "label-value", "bar", "blocks", "fine", "dots", "gauge", "ring", "bare"],
104
+ defaults: { render: "plain", format: "percent", min_width: 3, align: "right", ramp: "heat" },
105
+ states: ["ok", "warn", "full"],
106
+ shapes: { ok: "●", warn: "◐", full: "○" },
107
+ bounded: true, series: null, unknown: "dash", cost: "free",
108
+ refused_reason: null, params: null, binding: "ctx.used_pct",
109
+ composite: null, time_based: false, structural: false,
110
+ previews: P("context"),
111
+ },
112
+ {
113
+ id: "quota-5h", group: "B", label: "5h",
114
+ summary: "The 5-hour usage window.",
115
+ renderers: ["plain", "bar", "blocks", "spark", "bare"],
116
+ defaults: { render: "plain", format: "percent", min_width: 3, align: "right", ramp: "heat" },
117
+ states: ["ok", "warn", "critical"],
118
+ shapes: { ok: "●", warn: "◐", critical: "○" },
119
+ bounded: true, series: "quota5h", unknown: "dash", cost: "free",
120
+ refused_reason: null, params: null, binding: "quota.5h.pct",
121
+ composite: null, time_based: false, structural: false,
122
+ previews: P("5h"),
123
+ },
124
+ // A COMPONENT RENDERING AN EM DASH. Its file does not exist in this
125
+ // project, so it says so — and it is still placeable, because `—` and "this
126
+ // build has no such segment" are different facts.
127
+ {
128
+ id: "wiki", group: "D", label: "wiki",
129
+ summary: "How old the project wiki is, from the wiki's own oldest anchor.",
130
+ renderers: ["word", "shape", "badge"],
131
+ defaults: { render: "word" },
132
+ states: ["fresh", "aging", "stale", "unregistered", "none"],
133
+ shapes: { fresh: "●", aging: "◐", stale: "○", unregistered: "?", none: "·" },
134
+ bounded: false, series: null, unknown: "dash", cost: "new-read",
135
+ refused_reason: null, params: null, binding: "wiki.tier",
136
+ composite: null, time_based: false, structural: false,
137
+ previews: { word: "—", shape: "—", badge: "▏—▕" },
138
+ },
139
+ {
140
+ id: "branch", group: "H", label: null,
141
+ summary: "The current git branch, read from .git/HEAD with NO subprocess.",
142
+ renderers: ["bare", "plain", "badge"],
143
+ defaults: { render: "bare", truncate: "middle", max_len: 24 },
144
+ states: null, shapes: null, bounded: false, series: null,
145
+ unknown: "hide", cost: "scan", refused_reason: null, params: null,
146
+ binding: "git.branch", composite: null, time_based: false, structural: false,
147
+ previews: { bare: "main", plain: dim("branch ") + "main", badge: "▏main▕" },
148
+ },
149
+ // A REFUSED ROW. It keeps its slot, carries the measurement, and gets NO
150
+ // BUTTON AT ALL — never a disabled one. "We decided against this" and "we
151
+ // forgot" must not look the same.
152
+ {
153
+ id: "git-dirty", group: "H", label: "±",
154
+ summary: "Uncommitted changes.",
155
+ renderers: ["plain", "label-value", "bare"],
156
+ defaults: { render: "plain" },
157
+ states: null, shapes: null, bounded: false, series: null,
158
+ unknown: "dash", cost: "refused",
159
+ refused_reason:
160
+ "it needs a `git status` subprocess, and W0 measured one at 53ms against roughly 15ms of headroom on a surface that re-renders on every keystroke.",
161
+ params: null, binding: null, composite: null, time_based: false, structural: false,
162
+ previews: {},
163
+ },
164
+ ],
165
+ renderers: {
166
+ bare: { kind: "text", form: "value", needs: null, width: null, decoration: false },
167
+ plain: { kind: "text", form: "label value", needs: null, width: null, decoration: false },
168
+ "label-value": { kind: "text", form: "LABEL: value", needs: null, width: null, decoration: false },
169
+ bracket: { kind: "text", form: "[LABEL: value]", needs: null, width: null, decoration: false },
170
+ paren: { kind: "text", form: "(value)", needs: null, width: null, decoration: false },
171
+ badge: { kind: "text", form: "▏LABEL value▕", needs: null, width: null, decoration: false },
172
+ pill: { kind: "text", form: "⟪LABEL⟫value", needs: null, width: null, decoration: false },
173
+ word: { kind: "text", form: "STATE", needs: "states", width: null, decoration: false },
174
+ bar: { kind: "bar", form: null, needs: "bounded", width: [4, 16], decoration: false },
175
+ blocks: { kind: "bar", form: null, needs: "bounded", width: [2, 16], decoration: false },
176
+ fine: { kind: "bar", form: null, needs: "bounded", width: [2, 16], decoration: false },
177
+ dots: { kind: "bar", form: null, needs: "ordinal", width: [2, 10], decoration: false },
178
+ gauge: { kind: "bar", form: null, needs: "bounded", width: [1, 1], decoration: false },
179
+ ring: { kind: "bar", form: null, needs: "bounded", width: [1, 1], decoration: false },
180
+ shape: { kind: "state", form: null, needs: "states", width: null, decoration: false },
181
+ icon: { kind: "state", form: null, needs: "states", width: null, decoration: false },
182
+ spark: { kind: "series", form: null, needs: "series", width: [4, 16], decoration: false },
183
+ trend: { kind: "series", form: null, needs: "series", width: null, decoration: false },
184
+ },
185
+ glyph_sets: ["blocks", "bars", "pipes", "braille", "shade", "minimal", "ascii"],
186
+ ramps: {
187
+ heat: { stops: [0, 60, 85], colors: ["green", "yellow", "red"], why: "high is bad" },
188
+ cool: { stops: [0, 60, 85], colors: ["red", "yellow", "green"], why: "high is good" },
189
+ mono: { stops: [0, 60, 85], colors: [null, null, null], why: "NO_COLOR-safe: emphasis, not hue" },
190
+ state: { stops: null, colors: null, why: "the component's own state colours" },
191
+ },
192
+ themes: {
193
+ terminal: { ok: "green", warn: "yellow", critical: "red", muted: "bright-black", accent: "cyan", label: "bright-black", value: "default" },
194
+ dim: { ok: "green", warn: "yellow", critical: "red", muted: "bright-black", accent: "bright-black", label: "bright-black", value: "bright-black" },
195
+ "high-contrast": { ok: "bright-green", warn: "bright-yellow", critical: "bright-red", muted: "white", accent: "bright-cyan", label: "bright-white", value: "bright-white" },
196
+ mono: { ok: null, warn: null, critical: null, muted: null, accent: null, label: null, value: null },
197
+ },
198
+ hide_when: [
199
+ { id: "never", says: "always render. A state keeps its slot." },
200
+ { id: "empty", says: "hide when the value is absent" },
201
+ { id: "zero", says: "hide when the value is exactly 0" },
202
+ { id: "unknown", says: "hide when the value could not be computed" },
203
+ { id: "ok", says: "hide while healthy — show me only problems" },
204
+ { id: "idle", says: "hide when no run is active" },
205
+ { id: "no-run", says: "hide when no ORC run was opened this session" },
206
+ { id: "narrow", says: "hide below this component's min_cols" },
207
+ { id: "wide", says: "hide above this component's max_cols" },
208
+ ],
209
+ formats: ["percent", "ratio", "fraction", "decimal", "plain"],
210
+ compact: ["off", "si", "bytes"],
211
+ cases: ["none", "upper", "lower", "title"],
212
+ truncate: ["end", "middle", "none"],
213
+ emphasis: ["normal", "bold", "dim", "italic", "underline", "reverse", "strike"],
214
+ refused_emphasis: ["blink"],
215
+ colors: ["red", "green", "yellow", "blue", "magenta", "cyan", "bright-black", "bright-cyan", "default"],
216
+ separators: [
217
+ { value: " · ", name: "middle dot" },
218
+ { value: " ", name: "one space" },
219
+ { value: " ", name: "two spaces" },
220
+ { value: " │ ", name: "upright line" },
221
+ { value: "", name: "long dash" },
222
+ { value: " - ", name: "hyphen" },
223
+ { value: " / ", name: "slash" },
224
+ { value: " • ", name: "bullet" },
225
+ { value: " ▸ ", name: "small arrow" },
226
+ { value: " » ", name: "double arrow" },
227
+ { value: ", ", name: "comma" },
228
+ { value: " | ", name: "pipe" },
229
+ ],
230
+ themes_about: {
231
+ terminal: "the default: your terminal's own colours, one accent",
232
+ dim: "everything quiet — labels and values both greyed",
233
+ "high-contrast": "the brightest slot of every colour, for a pale terminal",
234
+ mono: "no colour at all; weight and shape carry every state",
235
+ },
236
+ max_per_line: 5,
237
+ lines: 3,
238
+ dense_prefix: "A line may hold a component only if every line above it holds at least one.",
239
+ };
240
+
241
+ // THE FEATURE IS OFF WITH A LAYOUT SAVED the state a user is in for most of
242
+ // the time they are composing, and the one the gate card exists for. Line 1 is
243
+ // at 5/5; line 3 is empty, so the board can show a full line and an ordinary
244
+ // one at once.
245
+ const show = {
246
+ ok: false,
247
+ enabled: false,
248
+ saved: true,
249
+ preset: null,
250
+ theme: "terminal",
251
+ glyphs: "blocks",
252
+ ansi: "auto",
253
+ align_columns: false,
254
+ lines: [
255
+ {
256
+ line: 1, separator: " · ", theme: null, max_width: 0, count: 5, counted: 5, full: true,
257
+ items: [
258
+ { pos: 1, id: "i1", type: "verdict", render: "icon", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "dash", known: true },
259
+ { pos: 2, id: "i2", type: "context", render: "bar", label: "CTX", label_color: "bright-black", value_color: null, ramp: "heat", emphasis: ["bold"], hide_when: [], unknown: "dash", known: true },
260
+ { pos: 3, id: "i3", type: "quota-5h", render: "plain", label: "5h", label_color: "bright-black", value_color: "default", ramp: "heat", emphasis: [], hide_when: [], unknown: "dash", known: true },
261
+ { pos: 4, id: "i4", type: "branch", render: "bare", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "hide", known: true },
262
+ { pos: 5, id: "i5", type: "wiki", render: "word", label: "wiki", label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "dash", known: true },
263
+ ],
264
+ },
265
+ {
266
+ line: 2, separator: " · ", theme: null, max_width: 0, count: 2, counted: 2, full: false,
267
+ items: [
268
+ { pos: 1, id: "i6", type: "context", render: "fine", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: ["ok"], unknown: "dash", known: true },
269
+ // AN UNKNOWN COMPONENT ID — what an upgrade that retired a component
270
+ // leaves behind. Reported, never auto-repaired.
271
+ { pos: 2, id: "i7", type: "retired-thing", render: "bare", label: null, label_color: null, value_color: null, ramp: null, emphasis: [], hide_when: [], unknown: null, known: false },
272
+ ],
273
+ },
274
+ { line: 3, separator: " · ", theme: null, max_width: 0, count: 0, counted: 0, full: false, items: [] },
275
+ ],
276
+ // ONE HARD ERROR and TWO WARNINGS, so the caution strip can show that an error
277
+ // is a refusal and a warning is a fact the user then owns.
278
+ errors: ['unknown component "retired-thing" on line 2 position 2 — did you mean "resume"?'],
279
+ warnings: [
280
+ "line 1 shows the same value twice (context, context)",
281
+ '"verdict" carries meaning in its colour (ready/boosted/degrade) and you set a flat colour — a green ⛔ is a status line that lies',
282
+ ],
283
+ preview: previewText,
284
+ dense_prefix: components.dense_prefix,
285
+ };
286
+
287
+ const presets = {
288
+ ok: true,
289
+ presets: [
290
+ { name: "orc-default", summary: "Today's two lines, exactly. The byte-identical baseline.", active: false, preview: previewNoColor.split("\n").slice(0, 2).join("\n") },
291
+ { name: "minimal", summary: "One line, four slots, the dim theme. The support answer for a busy terminal.", active: false, preview: dim("🚀 ORC 1.3.0 · Opus 5/high · ") + amber("███▊ ") + dim(" · main") },
292
+ { name: "cost-watch", summary: "What this session is spending, in every unit the payload gives for free.", active: true, preview: previewText.split("\n").slice(0, 2).join("\n") },
293
+ { name: "mono", summary: "No colour anywhere — shapes and emphasis only. The right preset for a README screenshot.", active: false, preview: previewNoColor },
294
+ ],
295
+ };
296
+
297
+ const explain = {
298
+ ok: true,
299
+ id: "i2",
300
+ type: "context",
301
+ line: 1,
302
+ pos: 2,
303
+ resolved: [
304
+ { field: "render", value: "bar", source: "item" },
305
+ { field: "label", value: "CTX", source: "item" },
306
+ { field: "label_color", value: "bright-black", source: "theme:terminal" },
307
+ { field: "glyphs", value: "blocks", source: "file" },
308
+ { field: "min_width", value: 3, source: "catalogue" },
309
+ { field: "ramp", value: "heat", source: "catalogue" },
310
+ ],
311
+ order: ["catalogue", "theme", "file", "line", "item"],
312
+ };
313
+
314
+
315
+ // ── the SECOND board (v1.4.0) ──────────────────────────────────────────────
316
+ // A designer cannot lay out a per-agent row against the status line's
317
+ // components, so the fixture set carries both boards. Same rule as everywhere
318
+ // else here: one of every state, including the ugly ones — a failed agent, an
319
+ // agent whose window size is unknown, and one whose token count has not been
320
+ // seen yet.
321
+ const subComponents = {
322
+ ok: true,
323
+ schema: 1,
324
+ catalog_hash: components.catalog_hash,
325
+ count: 4,
326
+ board: "subagent",
327
+ boards: ["status", "subagent"],
328
+ config_key: "subagent_line_custom",
329
+ setting: "subagentStatusLine",
330
+ groups: { T: "One subagent (the agent-panel row)" },
331
+ components: [
332
+ {
333
+ id: "task-name", group: "T", board: "subagent", label: null,
334
+ summary: "The agent's name.",
335
+ renderers: ["bare", "plain", "badge", "pill"],
336
+ defaults: { render: "bare", truncate: "middle", max_len: 28 },
337
+ states: null, shapes: null, bounded: false, series: null,
338
+ unknown: "dash", cost: "free", refused_reason: null, params: null,
339
+ binding: "task.name", composite: null, time_based: false, structural: false,
340
+ previews: { bare: "orc-executor-opus-5-low", plain: dim("task-name ") + "orc-executor-opus-5-low", badge: "▏orc-executor-opus-5-low▕", pill: E + "[7mTASK" + R + "orc-executor-opus-5-low" },
341
+ },
342
+ {
343
+ id: "task-tier", group: "T", board: "subagent", label: null,
344
+ summary: "The model and effort this agent is ACTUALLY running at — observed, not derived from its name and not self-reported.",
345
+ renderers: ["bare", "plain", "label-value", "badge"],
346
+ defaults: { render: "bare" },
347
+ states: null, shapes: null, bounded: false, series: null,
348
+ unknown: "dash", cost: "free", refused_reason: null, params: null,
349
+ binding: "task.tier", composite: null, time_based: false, structural: false,
350
+ previews: { bare: "O5/low", plain: dim("tier ") + "O5/low", "label-value": dim("TIER: ") + "O5/low", badge: "▏O5/low▕" },
351
+ },
352
+ {
353
+ id: "task-tokens", group: "T", board: "subagent", label: null,
354
+ summary: "How many tokens this agent has used. THE NUMBER v1.2.0 SAID COULD NOT BE MEASURED.",
355
+ renderers: ["plain", "label-value", "bare"],
356
+ defaults: { render: "plain", compact: "si" },
357
+ states: null, shapes: null, bounded: false, series: null,
358
+ unknown: "dash", cost: "free", refused_reason: null, params: null,
359
+ binding: "task.tokens", composite: null, time_based: false, structural: false,
360
+ previews: { plain: "84K", "label-value": dim("TOKENS: ") + "84K", bare: "84K" },
361
+ },
362
+ {
363
+ id: "task-status", group: "T", board: "subagent", label: null,
364
+ summary: "What this agent is doing.",
365
+ renderers: ["word", "shape", "badge", "bare"],
366
+ defaults: { render: "word" },
367
+ states: ["pending", "running", "completed", "failed"],
368
+ shapes: { pending: "○", running: "●", completed: "✓", failed: "▲" },
369
+ bounded: false, series: null, unknown: "dash", cost: "free",
370
+ refused_reason: null, params: null, binding: "task.status",
371
+ composite: null, time_based: false, structural: false,
372
+ previews: { word: amber("running"), shape: amber("●"), badge: "▏" + amber("running") + "▕", bare: "running" },
373
+ },
374
+ ],
375
+ renderers: components.renderers,
376
+ glyph_sets: components.glyph_sets,
377
+ ramps: components.ramps,
378
+ themes: components.themes,
379
+ hide_when: components.hide_when,
380
+ formats: components.formats,
381
+ compact: components.compact,
382
+ cases: components.cases,
383
+ truncate: components.truncate,
384
+ emphasis: components.emphasis,
385
+ refused_emphasis: components.refused_emphasis,
386
+ colors: components.colors,
387
+ separators: components.separators,
388
+ themes_about: components.themes_about,
389
+ max_per_line: 5,
390
+ // ONE LINE by construction: Claude Code renders one row per task.
391
+ lines: 1,
392
+ dense_prefix: components.dense_prefix,
393
+ };
394
+
395
+ const subShow = {
396
+ ok: true,
397
+ enabled: true,
398
+ saved: true,
399
+ preset: "agent-default",
400
+ theme: "terminal",
401
+ glyphs: "blocks",
402
+ ansi: "auto",
403
+ align_columns: false,
404
+ lines: [
405
+ {
406
+ line: 1, separator: " · ", theme: null, max_width: 0, count: 4, counted: 4, full: false,
407
+ items: [
408
+ { pos: 1, id: "s1", type: "task-status", render: "shape", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "dash", known: true },
409
+ { pos: 2, id: "s2", type: "task-name", render: "bare", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "dash", known: true },
410
+ { pos: 3, id: "s3", type: "task-tier", render: "bare", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: ["dim"], hide_when: [], unknown: "dash", known: true },
411
+ { pos: 4, id: "s4", type: "task-tokens", render: "plain", label: null, label_color: "bright-black", value_color: "default", ramp: null, emphasis: [], hide_when: [], unknown: "dash", known: true },
412
+ ],
413
+ },
414
+ ],
415
+ errors: [],
416
+ // A layout can be perfectly valid and still worth a caution.
417
+ warnings: ["task-tokens is a FLOOR: an agent that finishes between two redraws is never counted"],
418
+ preview: amber("●") + " orc-executor-opus-5-low · " + dim("O5/low") + " · 84K",
419
+ dense_prefix: components.dense_prefix,
420
+ };
421
+
422
+ const subPresets = {
423
+ ok: true,
424
+ presets: [
425
+ { name: "agent-default", board: "subagent", summary: "What the agent is, what it is running at, and what it has cost so far.", active: true, preview: "orc-executor-opus-5-low · " + dim("O5/low") + " · 84K · " + dim("for ") + " 17m" },
426
+ { name: "agent-watch", board: "subagent", summary: "For a run you are watching: status, its own context window, and the clock.", active: false, preview: amber("●") + " orc-executor-opus-5-low · " + green("███▎░░░░") + " · " + dim("for ") + " 17m" },
427
+ { name: "agent-tier", board: "subagent", summary: "The downgrade check, made visible: the model and effort ORC actually got, per agent.", active: false, preview: "orc-executor-opus-5-low · claude-opus-5 · low · " + amber("running") },
428
+ ],
429
+ };
430
+
431
+ module.exports = { show, components, presets, preview, explain, subShow, subComponents, subPresets };