@adeildo/pi-look 5.15.0 → 6.0.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 +54 -44
- package/assets/preview.png +0 -0
- package/package.json +3 -2
- package/src/data/git.ts +1 -1
- package/src/data/github.ts +6 -17
- package/src/data/runner.ts +3 -4
- package/src/data/snapshot.ts +24 -13
- package/src/data/start-notes.ts +2 -6
- package/src/data/telemetry.ts +13 -16
- package/src/data/totals.ts +14 -73
- package/src/data/visits.ts +2 -3
- package/src/index.ts +66 -18
- package/src/render/diff.ts +104 -0
- package/src/render/fit.ts +1 -1
- package/src/render/format.ts +1 -2
- package/src/render/glyphs.ts +23 -10
- package/src/render/paint.ts +4 -4
- package/src/render/segments.ts +112 -33
- package/src/render/streaming.ts +17 -40
- package/src/render/tools.ts +4 -6
- package/src/settings.ts +5 -7
- package/src/ui/editor.ts +11 -8
- package/src/ui/footer.ts +4 -11
- package/src/ui/header.ts +25 -18
- package/src/ui/outputs.ts +5 -11
- package/src/ui/pi-entries.ts +29 -27
- package/src/ui/previews.ts +2 -6
- package/src/ui/queue.ts +8 -8
- package/src/ui/screen.ts +1 -8
- package/src/ui/tool-frame.ts +59 -82
- package/src/view/state.ts +97 -0
- package/src/view/transcript.ts +175 -0
- package/src/view/view.ts +161 -0
package/src/data/visits.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
// The start screen says what changed since the last session in a folder, so it remembers when that
|
|
2
|
-
// was and which harness version ran it. One small file for every folder.
|
|
1
|
+
// The start screen says what changed since the last session in a folder, so it remembers when that was.
|
|
3
2
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
3
|
import { dirname } from "node:path";
|
|
5
4
|
|
|
@@ -9,7 +8,7 @@ import type { LastVisit } from "./start-notes.ts";
|
|
|
9
8
|
|
|
10
9
|
type Visits = Record<string, LastVisit>;
|
|
11
10
|
|
|
12
|
-
/**
|
|
11
|
+
/** Records this visit too. */
|
|
13
12
|
export function visit(
|
|
14
13
|
file: string,
|
|
15
14
|
cwd: string,
|
package/src/index.ts
CHANGED
|
@@ -3,15 +3,20 @@ import { dirname, join } from "node:path";
|
|
|
3
3
|
import {
|
|
4
4
|
ACCOUNT,
|
|
5
5
|
type AccountState,
|
|
6
|
+
BOARD,
|
|
6
7
|
createApp,
|
|
7
8
|
PEERS,
|
|
8
|
-
|
|
9
|
+
PROMPT_FROM,
|
|
9
10
|
defineFeature,
|
|
10
11
|
drawSkillRefs,
|
|
11
12
|
type FeatureScope,
|
|
12
13
|
hideImagesUnderOverlays,
|
|
14
|
+
NAMES,
|
|
13
15
|
SKILL_REF,
|
|
16
|
+
provideViews,
|
|
17
|
+
type SessionSource,
|
|
14
18
|
skillNames,
|
|
19
|
+
sourceFor,
|
|
15
20
|
} from "@adeildo/pi-kit";
|
|
16
21
|
import type {
|
|
17
22
|
ExtensionAPI,
|
|
@@ -26,7 +31,7 @@ import { emptySnapshot, type LiveInputs, type Snapshot, SnapshotReader } from ".
|
|
|
26
31
|
import type { LastVisit } from "./data/start-notes.ts";
|
|
27
32
|
import { Telemetry } from "./data/telemetry.ts";
|
|
28
33
|
import type { DeltaKind } from "./data/telemetry.ts";
|
|
29
|
-
import {
|
|
34
|
+
import { REQUEST_CHANGES, type RequestRecord } from "./data/totals.ts";
|
|
30
35
|
import { visit } from "./data/visits.ts";
|
|
31
36
|
import { type Glyphs, glyphsOf } from "./render/glyphs.ts";
|
|
32
37
|
import { PLAIN, themePaint } from "./render/paint.ts";
|
|
@@ -54,6 +59,7 @@ import { frameQueue } from "./ui/queue.ts";
|
|
|
54
59
|
import type { Screen, SlotName } from "./ui/screen.ts";
|
|
55
60
|
import { registerToolFrames } from "./ui/tool-frame.ts";
|
|
56
61
|
import { type Activity, describe, draftedTool } from "./ui/working.ts";
|
|
62
|
+
import { SessionView } from "./view/view.ts";
|
|
57
63
|
|
|
58
64
|
export { SEGMENT_IDS, SEGMENTS, type SegmentId } from "./render/segments.ts";
|
|
59
65
|
import type { SegmentId } from "./render/segments.ts";
|
|
@@ -61,7 +67,7 @@ export { ROLE_TOKENS } from "./render/paint.ts";
|
|
|
61
67
|
|
|
62
68
|
const STRIP_WIDGET = "pi-look:strip";
|
|
63
69
|
const TICK_MS = 500;
|
|
64
|
-
|
|
70
|
+
// Once per process, however many sessions it opens.
|
|
65
71
|
let probedGithub = false;
|
|
66
72
|
|
|
67
73
|
interface Live {
|
|
@@ -104,7 +110,12 @@ export const look = defineFeature({
|
|
|
104
110
|
registerToolFrames(scope);
|
|
105
111
|
framePiEntries(() => {
|
|
106
112
|
if (live.ctx === undefined) return undefined;
|
|
107
|
-
return {
|
|
113
|
+
return {
|
|
114
|
+
theme: live.ctx.ui.theme,
|
|
115
|
+
set: glyphs().set,
|
|
116
|
+
you: userFrame.get(scope),
|
|
117
|
+
from: (text: string) => PROMPT_FROM.current(scope, text)?.name,
|
|
118
|
+
};
|
|
108
119
|
});
|
|
109
120
|
frameQueue(() => live.ctx?.ui.theme);
|
|
110
121
|
const repaint = () => {
|
|
@@ -118,6 +129,20 @@ export const look = defineFeature({
|
|
|
118
129
|
let visited = false;
|
|
119
130
|
let lastVisit: LastVisit | undefined;
|
|
120
131
|
|
|
132
|
+
provideViews(
|
|
133
|
+
scope.events,
|
|
134
|
+
(address) => {
|
|
135
|
+
const ctx = live.ctx;
|
|
136
|
+
const source = sourceFor(scope.events, address);
|
|
137
|
+
if (ctx === undefined || ctx.mode !== "tui" || source === undefined) return false;
|
|
138
|
+
openView(ctx, screen, source).catch((error: unknown) => {
|
|
139
|
+
scope.warn(`pi-look: could not show ${address.session}: ${String(error)}`);
|
|
140
|
+
});
|
|
141
|
+
return true;
|
|
142
|
+
},
|
|
143
|
+
() => live.ctx?.mode === "tui",
|
|
144
|
+
);
|
|
145
|
+
|
|
121
146
|
scope.registerShortcut(Key.alt("o"), {
|
|
122
147
|
description: "A tool call's whole output, to scroll; the arrows move between calls",
|
|
123
148
|
handler: (ctx) => openOutputs(ctx),
|
|
@@ -134,8 +159,7 @@ export const look = defineFeature({
|
|
|
134
159
|
new FooterComponent(tui, data, screen, {
|
|
135
160
|
attach: (footerData, paint) => {
|
|
136
161
|
live.footerData = footerData;
|
|
137
|
-
//
|
|
138
|
-
// what a component that keeps its drawing for a moment compares.
|
|
162
|
+
// Anything that asks for a redraw bumps the revision that kept drawings compare.
|
|
139
163
|
live.repaint = () => {
|
|
140
164
|
screen.bump();
|
|
141
165
|
paint();
|
|
@@ -151,12 +175,12 @@ export const look = defineFeature({
|
|
|
151
175
|
placement: "aboveEditor",
|
|
152
176
|
});
|
|
153
177
|
installEditor(ctx, screen, live, scope);
|
|
154
|
-
//
|
|
178
|
+
// A new session in the same pi is not a return to the folder.
|
|
155
179
|
if (!visited) {
|
|
156
180
|
visited = true;
|
|
157
181
|
lastVisit = visit(visitsFile, ctx.cwd, HARNESS_VERSION, Date.now());
|
|
158
182
|
}
|
|
159
|
-
//
|
|
183
|
+
// Off the critical path: the card shows these lines when the answers arrive.
|
|
160
184
|
if (!probedGithub) {
|
|
161
185
|
probedGithub = true;
|
|
162
186
|
void probeGithub(live, lastVisit?.at);
|
|
@@ -185,8 +209,7 @@ export const look = defineFeature({
|
|
|
185
209
|
live.tui = undefined;
|
|
186
210
|
});
|
|
187
211
|
|
|
188
|
-
//
|
|
189
|
-
// provider on its own: the marks always belong to the answer being measured.
|
|
212
|
+
// Only for the agent's calls, not pi's cache warming.
|
|
190
213
|
scope.on("before_provider_request", () => telemetry.providerRequestSent());
|
|
191
214
|
scope.on("after_provider_response", () => telemetry.providerResponseArrived());
|
|
192
215
|
|
|
@@ -227,7 +250,7 @@ export const look = defineFeature({
|
|
|
227
250
|
if (event.message.role !== "assistant") return;
|
|
228
251
|
const record = telemetry.answerEnded(event.message.usage);
|
|
229
252
|
// Pi records usage without a duration, so the session keeps it for the speeds after a resume.
|
|
230
|
-
if (record !== undefined) scope.appendEntry<RequestRecord>(
|
|
253
|
+
if (record !== undefined) scope.appendEntry<RequestRecord>(REQUEST_CHANGES, record);
|
|
231
254
|
repaint();
|
|
232
255
|
});
|
|
233
256
|
|
|
@@ -281,7 +304,7 @@ function explain(screen: Screen): string {
|
|
|
281
304
|
SLOT_TITLES[name],
|
|
282
305
|
screen.slot(name),
|
|
283
306
|
]),
|
|
284
|
-
// Not on screen:
|
|
307
|
+
// Not on screen: kept for when an answer feels slow.
|
|
285
308
|
["The last call to the model", ["last", "wait", "speed", "server", "request"]],
|
|
286
309
|
];
|
|
287
310
|
for (const [title, ids] of groups) {
|
|
@@ -312,7 +335,6 @@ function createScreen(
|
|
|
312
335
|
telemetry: Telemetry,
|
|
313
336
|
glyphs: () => Glyphs,
|
|
314
337
|
): Screen {
|
|
315
|
-
// What the components that keep a drawing for a moment compare: an event, a probe, a new branch.
|
|
316
338
|
let revision = 0;
|
|
317
339
|
return {
|
|
318
340
|
snapshot() {
|
|
@@ -327,7 +349,7 @@ function createScreen(
|
|
|
327
349
|
last: telemetry.last(),
|
|
328
350
|
run: telemetry.run(),
|
|
329
351
|
statuses: live.footerData?.getExtensionStatuses() ?? new Map(),
|
|
330
|
-
...
|
|
352
|
+
...boardAndPeersOf(scope),
|
|
331
353
|
});
|
|
332
354
|
live.frame = snapshot;
|
|
333
355
|
queueMicrotask(() => {
|
|
@@ -366,12 +388,19 @@ function accountOf(scope: FeatureScope, provider: string | undefined): AccountSt
|
|
|
366
388
|
return provider === undefined ? undefined : ACCOUNT.current(scope, provider);
|
|
367
389
|
}
|
|
368
390
|
|
|
369
|
-
function
|
|
391
|
+
function boardAndPeersOf(
|
|
392
|
+
scope: FeatureScope,
|
|
393
|
+
): Pick<LiveInputs, "board" | "me" | "peers" | "peersRooms" | "peersUnread" | "peersWriting"> {
|
|
370
394
|
const peers = PEERS.current(scope);
|
|
395
|
+
const handle = NAMES.current(scope)?.handle;
|
|
396
|
+
const color = peers?.me?.handle === handle ? peers?.me?.color : undefined;
|
|
371
397
|
return {
|
|
372
|
-
|
|
398
|
+
board: BOARD.current(scope),
|
|
399
|
+
me: handle === undefined ? undefined : { handle, ...(color === undefined ? {} : { color }) },
|
|
373
400
|
peers: peers?.peers,
|
|
401
|
+
peersRooms: peers?.rooms,
|
|
374
402
|
peersUnread: peers?.unread,
|
|
403
|
+
peersWriting: peers?.writing,
|
|
375
404
|
};
|
|
376
405
|
}
|
|
377
406
|
|
|
@@ -447,7 +476,7 @@ async function probeGithub(live: Live, since: number | undefined): Promise<void>
|
|
|
447
476
|
const github = await readGithub(ctx.cwd, since);
|
|
448
477
|
if (live.ctx === undefined) return;
|
|
449
478
|
live.github = github;
|
|
450
|
-
// The card keeps its drawing for a second; this
|
|
479
|
+
// The card keeps its drawing for a second; this makes the new lines appear.
|
|
451
480
|
live.repaint?.();
|
|
452
481
|
}
|
|
453
482
|
|
|
@@ -479,7 +508,26 @@ export default function piLook(pi: ExtensionAPI): void {
|
|
|
479
508
|
createApp(pi, { name: "pi-look" }).use(look).build();
|
|
480
509
|
}
|
|
481
510
|
|
|
482
|
-
|
|
511
|
+
async function openView(
|
|
512
|
+
ctx: ExtensionContext,
|
|
513
|
+
screen: Screen,
|
|
514
|
+
source: SessionSource,
|
|
515
|
+
): Promise<void> {
|
|
516
|
+
let view: SessionView | undefined;
|
|
517
|
+
await ctx.ui.custom<void>(
|
|
518
|
+
(tui, theme, _keybindings, done) => {
|
|
519
|
+
hideImagesUnderOverlays(tui);
|
|
520
|
+
view = new SessionView({ tui, theme, screen, source, close: () => done() });
|
|
521
|
+
return view;
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
overlay: true,
|
|
525
|
+
overlayOptions: { anchor: "center", width: "100%", maxHeight: "100%" },
|
|
526
|
+
},
|
|
527
|
+
);
|
|
528
|
+
view?.dispose();
|
|
529
|
+
}
|
|
530
|
+
|
|
483
531
|
async function openOutputs(ctx: ExtensionContext): Promise<void> {
|
|
484
532
|
if (ctx.mode !== "tui") return;
|
|
485
533
|
const outputs = outputsOf(ctx.sessionManager.getBranch());
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// An edit's diff inside the frame, without pi's colored box behind it: the line numbers in a gutter,
|
|
2
|
+
// the sign and the text in the diff colors, and only the changed words on a tinted background.
|
|
3
|
+
import { GLYPH, isObject } from "@adeildo/pi-kit";
|
|
4
|
+
import type { Theme, ThemeColor } from "@earendil-works/pi-coding-agent";
|
|
5
|
+
import { type Component, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
6
|
+
import { diffWords } from "diff";
|
|
7
|
+
|
|
8
|
+
import { printable } from "./streaming.ts";
|
|
9
|
+
|
|
10
|
+
interface DiffLine {
|
|
11
|
+
sign: "-" | "+" | " ";
|
|
12
|
+
number: string;
|
|
13
|
+
text: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const COLORS: Record<DiffLine["sign"], ThemeColor> = {
|
|
17
|
+
"-": "toolDiffRemoved",
|
|
18
|
+
"+": "toolDiffAdded",
|
|
19
|
+
" ": "toolDiffContext",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** Pi's diff text, one line per row, with the number gutter and the wrapped text hanging under itself. */
|
|
23
|
+
export function drawDiff(diff: string, theme: Theme, width: number): string[] {
|
|
24
|
+
const lines = diff.split("\n").map(parse);
|
|
25
|
+
const gutter = Math.max(...lines.map((line) => line?.number.length ?? 0), 1);
|
|
26
|
+
const texts = changedWords(lines, theme);
|
|
27
|
+
// The number, a space, the sign and a space; wrapped text hangs under its first character.
|
|
28
|
+
const hang = " ".repeat(gutter + 3);
|
|
29
|
+
return lines.flatMap((line, index) => {
|
|
30
|
+
if (line === undefined) return [];
|
|
31
|
+
if (line.number === "" && line.text === "...")
|
|
32
|
+
return [`${hang}${theme.fg("dim", GLYPH.ellipsisAcross)}`];
|
|
33
|
+
const lead = `${theme.fg("dim", line.number.padStart(gutter))} ${theme.fg(COLORS[line.sign], line.sign)} `;
|
|
34
|
+
const text = texts[index] ?? theme.fg(COLORS[line.sign], line.text);
|
|
35
|
+
return wrapTextWithAnsi(text, Math.max(1, width - hang.length)).map((part, at) =>
|
|
36
|
+
at === 0 ? `${lead}${part}` : `${hang}${part}`,
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Pi's edit body while it holds the file's diff, drawn here; before that, pi's own drawing.
|
|
43
|
+
* Pi keeps the diff on the component it returns, as `preview`.
|
|
44
|
+
*/
|
|
45
|
+
export function editBody(own: Component, header: string, theme: Theme): Component {
|
|
46
|
+
// The screen redraws on every keystroke and every piece the model writes; the diff is drawn once.
|
|
47
|
+
let drawn: { error?: string; diff?: string; width: number; lines: string[] } | undefined;
|
|
48
|
+
return {
|
|
49
|
+
render(width) {
|
|
50
|
+
const preview = isObject(own) && "preview" in own ? own.preview : undefined;
|
|
51
|
+
if (!isObject(preview)) return own.render(width);
|
|
52
|
+
const error = typeof preview.error === "string" ? preview.error : undefined;
|
|
53
|
+
const diff = typeof preview.diff === "string" ? preview.diff : undefined;
|
|
54
|
+
if (error === undefined && diff === undefined) return own.render(width);
|
|
55
|
+
if (drawn?.width !== width || drawn.error !== error || drawn.diff !== diff) {
|
|
56
|
+
const body =
|
|
57
|
+
error === undefined
|
|
58
|
+
? drawDiff(diff ?? "", theme, width)
|
|
59
|
+
: wrapTextWithAnsi(theme.fg("error", error), width);
|
|
60
|
+
drawn = { error, diff, width, lines: [header, "", ...body] };
|
|
61
|
+
}
|
|
62
|
+
return drawn.lines;
|
|
63
|
+
},
|
|
64
|
+
invalidate() {
|
|
65
|
+
drawn = undefined;
|
|
66
|
+
own.invalidate();
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function parse(line: string): DiffLine | undefined {
|
|
72
|
+
if (line === "") return undefined;
|
|
73
|
+
const match = /^([+\- ])( *\d*) (.*)$/.exec(line);
|
|
74
|
+
if (match === null) return { sign: " ", number: "", text: printable(line) };
|
|
75
|
+
const sign = match[1] as DiffLine["sign"];
|
|
76
|
+
return { sign, number: (match[2] ?? "").trim(), text: printable(match[3] ?? "") };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** One line taken out and one put in is a changed line: its changed words get the tint. */
|
|
80
|
+
function changedWords(
|
|
81
|
+
lines: readonly (DiffLine | undefined)[],
|
|
82
|
+
theme: Theme,
|
|
83
|
+
): (string | undefined)[] {
|
|
84
|
+
const texts: (string | undefined)[] = [];
|
|
85
|
+
for (let index = 0; index + 1 < lines.length; index++) {
|
|
86
|
+
const out = lines[index];
|
|
87
|
+
const into = lines[index + 1];
|
|
88
|
+
if (out?.sign !== "-" || into?.sign !== "+") continue;
|
|
89
|
+
if (lines[index - 1]?.sign === "-" || lines[index + 2]?.sign === "+") continue;
|
|
90
|
+
let removed = "";
|
|
91
|
+
let added = "";
|
|
92
|
+
for (const part of diffWords(out.text, into.text)) {
|
|
93
|
+
if (part.removed) removed += theme.bg("toolErrorBg", part.value);
|
|
94
|
+
else if (part.added) added += theme.bg("toolSuccessBg", part.value);
|
|
95
|
+
else {
|
|
96
|
+
removed += part.value;
|
|
97
|
+
added += part.value;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
texts[index] = theme.fg("toolDiffRemoved", removed);
|
|
101
|
+
texts[index + 1] = theme.fg("toolDiffAdded", added);
|
|
102
|
+
}
|
|
103
|
+
return texts;
|
|
104
|
+
}
|
package/src/render/fit.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface Piece {
|
|
|
5
5
|
text: string;
|
|
6
6
|
compact?: string | undefined;
|
|
7
7
|
priority: number;
|
|
8
|
-
/**
|
|
8
|
+
/** When it is alone on the line. */
|
|
9
9
|
shrink?: (width: number) => string;
|
|
10
10
|
}
|
|
11
11
|
|
package/src/render/format.ts
CHANGED
|
@@ -18,7 +18,6 @@ export function cell(text: string, width: number): string {
|
|
|
18
18
|
|
|
19
19
|
export const UNKNOWN = "–";
|
|
20
20
|
|
|
21
|
-
/** The look's word for the kit's format, which is where the shape was decided. */
|
|
22
21
|
export const count = formatTokens;
|
|
23
22
|
|
|
24
23
|
export function rate(perSecond: number): string {
|
|
@@ -99,7 +98,7 @@ export function fitWidth(text: string, width: number, ellipsis = "..."): string
|
|
|
99
98
|
return truncateToWidth(text, Math.max(0, width), ellipsis);
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
/**
|
|
101
|
+
/** A tab is as wide as the terminal says, and these lines have a width. */
|
|
103
102
|
export function tabs(text: string): string {
|
|
104
103
|
return text.replace(/\t/g, " ");
|
|
105
104
|
}
|
package/src/render/glyphs.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface Glyphs {
|
|
|
7
7
|
branch: string;
|
|
8
8
|
host: string;
|
|
9
9
|
session: string;
|
|
10
|
-
|
|
10
|
+
board: string;
|
|
11
11
|
peers: string;
|
|
12
12
|
waiting: string;
|
|
13
13
|
queued: string;
|
|
@@ -37,8 +37,15 @@ export interface Glyphs {
|
|
|
37
37
|
empty: string;
|
|
38
38
|
levels: readonly string[];
|
|
39
39
|
ellipsis: string;
|
|
40
|
-
/** Between the agents
|
|
40
|
+
/** Between the folder's agents and each shared room's. */
|
|
41
41
|
apart: string;
|
|
42
|
+
/** How this session stands in a room, as the rooms panel marks it. */
|
|
43
|
+
roomIn: string;
|
|
44
|
+
roomListening: string;
|
|
45
|
+
roomOut: string;
|
|
46
|
+
/** An agent at work and one waiting for work, as the panel and the board mark them. */
|
|
47
|
+
agentWorking: string;
|
|
48
|
+
agentIdle: string;
|
|
42
49
|
}
|
|
43
50
|
|
|
44
51
|
const COMMON = {
|
|
@@ -51,6 +58,11 @@ const COMMON = {
|
|
|
51
58
|
sent: "↑",
|
|
52
59
|
received: "↓",
|
|
53
60
|
apart: "│",
|
|
61
|
+
roomIn: "●",
|
|
62
|
+
roomListening: "◐",
|
|
63
|
+
roomOut: "○",
|
|
64
|
+
agentWorking: "◆",
|
|
65
|
+
agentIdle: "◇",
|
|
54
66
|
};
|
|
55
67
|
|
|
56
68
|
export const NERD: Glyphs = {
|
|
@@ -60,7 +72,7 @@ export const NERD: Glyphs = {
|
|
|
60
72
|
branch: "\u{e0a0}", // nf-pl-branch
|
|
61
73
|
host: "\u{f108}", // nf-fa-desktop
|
|
62
74
|
session: "\u{f02b}", // nf-fa-tag
|
|
63
|
-
|
|
75
|
+
board: "\u{f04fe}", // nf-md-target
|
|
64
76
|
peers: "\u{f0c0}", // nf-fa-users
|
|
65
77
|
waiting: "\u{f024}", // nf-fa-flag
|
|
66
78
|
queued: "\u{f051f}", // nf-md-timer_sand
|
|
@@ -91,7 +103,7 @@ export const UNICODE: Glyphs = {
|
|
|
91
103
|
branch: "⎇",
|
|
92
104
|
host: "⌂",
|
|
93
105
|
session: "#",
|
|
94
|
-
|
|
106
|
+
board: "▸",
|
|
95
107
|
peers: "◆",
|
|
96
108
|
waiting: "⚑",
|
|
97
109
|
queued: "⧗",
|
|
@@ -118,11 +130,16 @@ export const UNICODE: Glyphs = {
|
|
|
118
130
|
export const ASCII: Glyphs = {
|
|
119
131
|
set: "ascii",
|
|
120
132
|
apart: "|",
|
|
133
|
+
roomIn: "+",
|
|
134
|
+
roomListening: "~",
|
|
135
|
+
roomOut: "-",
|
|
136
|
+
agentWorking: ">",
|
|
137
|
+
agentIdle: "-",
|
|
121
138
|
folder: "",
|
|
122
139
|
branch: "",
|
|
123
140
|
host: "@",
|
|
124
141
|
session: "#",
|
|
125
|
-
|
|
142
|
+
board: ">",
|
|
126
143
|
peers: "@",
|
|
127
144
|
waiting: "",
|
|
128
145
|
queued: "",
|
|
@@ -165,11 +182,7 @@ export function resolveIcons(mode: IconMode, env: NodeJS.ProcessEnv = process.en
|
|
|
165
182
|
return NERD;
|
|
166
183
|
}
|
|
167
184
|
|
|
168
|
-
/**
|
|
169
|
-
* The glyphs for a scope, resolved once and again only when the setting behind them changes. Every
|
|
170
|
-
* frame, rule and slot of the screen asks for them on each drawing, and resolving each time was a
|
|
171
|
-
* fifth of what typing cost.
|
|
172
|
-
*/
|
|
185
|
+
/** Resolved again only when the setting changes; resolving per drawing was a fifth of typing's cost. */
|
|
173
186
|
export function glyphsOf(modeOf: () => IconMode): () => Glyphs {
|
|
174
187
|
let known: { mode: IconMode; glyphs: Glyphs } | undefined;
|
|
175
188
|
return () => {
|
package/src/render/paint.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type Role =
|
|
|
11
11
|
| "conflicted"
|
|
12
12
|
| "host"
|
|
13
13
|
| "session"
|
|
14
|
-
| "
|
|
14
|
+
| "board"
|
|
15
15
|
| "waiting"
|
|
16
16
|
| "queued"
|
|
17
17
|
| "version"
|
|
@@ -39,7 +39,7 @@ export const ROLE_TOKENS: Record<Role, ThemeColor> = {
|
|
|
39
39
|
conflicted: "error",
|
|
40
40
|
host: "syntaxType",
|
|
41
41
|
session: "mdHeading",
|
|
42
|
-
|
|
42
|
+
board: "accent",
|
|
43
43
|
waiting: "warning",
|
|
44
44
|
queued: "muted",
|
|
45
45
|
version: "muted",
|
|
@@ -80,7 +80,7 @@ export interface Paint {
|
|
|
80
80
|
stress(percent: number, text: string): string;
|
|
81
81
|
money(amount: number, text: string): string;
|
|
82
82
|
frame(text: string): string;
|
|
83
|
-
/** A theme
|
|
83
|
+
/** A theme color a package named in a contract, like a peer's. */
|
|
84
84
|
raw(color: string, text: string): string;
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -104,7 +104,7 @@ export function themePaint(theme: Theme, frame?: (text: string) => string): Pain
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
function stressToken(percent: number): ThemeColor {
|
|
108
108
|
if (percent >= 90) return "error";
|
|
109
109
|
if (percent >= 70) return "warning";
|
|
110
110
|
return "success";
|