@useavalon/caelence-agent 0.2.0 → 0.2.1-canary.1
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 +8 -5
- package/desktop/README.md +26 -0
- package/desktop/bun.lock +321 -0
- package/desktop/index.html +20 -0
- package/desktop/package.json +28 -0
- package/desktop/scripts/make-icons.ts +105 -0
- package/desktop/scripts/run-tauri.ts +40 -0
- package/desktop/src/App.tsx +2657 -0
- package/desktop/src/ComposerAttach.tsx +111 -0
- package/desktop/src/FloatNotice.test.ts +23 -0
- package/desktop/src/FloatNotice.tsx +30 -0
- package/desktop/src/LogoMark.tsx +37 -0
- package/desktop/src/SkillsPanel.tsx +409 -0
- package/desktop/src/api.ts +503 -0
- package/desktop/src/app.css +1749 -0
- package/desktop/src/composer-files.test.ts +46 -0
- package/desktop/src/composer-files.ts +135 -0
- package/desktop/src/dictation.test.ts +22 -0
- package/desktop/src/dictation.ts +59 -0
- package/desktop/src/integration-search.test.ts +13 -0
- package/desktop/src/integration-search.ts +8 -0
- package/desktop/src/main.tsx +43 -0
- package/desktop/src/picker-nav.test.ts +27 -0
- package/desktop/src/picker-nav.ts +26 -0
- package/desktop/src/queue.test.ts +37 -0
- package/desktop/src/queue.ts +40 -0
- package/desktop/src/rich-text.test.ts +85 -0
- package/desktop/src/rich-text.ts +193 -0
- package/desktop/src/session-menu.test.ts +19 -0
- package/desktop/src/session-menu.ts +12 -0
- package/desktop/src/skill-search.test.ts +37 -0
- package/desktop/src/skill-search.ts +25 -0
- package/desktop/src/stream.test.ts +93 -0
- package/desktop/src/stream.ts +197 -0
- package/desktop/src/styles/fonts/chivo-mono-latin-ext-wght-normal.woff2 +0 -0
- package/desktop/src/styles/fonts/chivo-mono-latin-wght-normal.ttf +0 -0
- package/desktop/src/styles/fonts/chivo-mono-latin-wght-normal.woff2 +0 -0
- package/desktop/src/styles/fonts/instrument-sans-latin-ext-wght-normal.woff2 +0 -0
- package/desktop/src/styles/fonts/instrument-sans-latin-wght-normal.ttf +0 -0
- package/desktop/src/styles/fonts/instrument-sans-latin-wght-normal.woff2 +0 -0
- package/desktop/src/styles/fonts.css +53 -0
- package/desktop/src/styles/primitives.css +600 -0
- package/desktop/src/styles/tokens-matte.css +354 -0
- package/desktop/src/thought.test.ts +96 -0
- package/desktop/src/thought.ts +87 -0
- package/desktop/src/tool-label.test.ts +17 -0
- package/desktop/src/tool-label.ts +70 -0
- package/desktop/src/vite-env.d.ts +15 -0
- package/desktop/src-tauri/Cargo.lock +4791 -0
- package/desktop/src-tauri/Cargo.toml +21 -0
- package/desktop/src-tauri/Entitlements.plist +8 -0
- package/desktop/src-tauri/Info.plist +12 -0
- package/desktop/src-tauri/build.rs +16 -0
- package/desktop/src-tauri/capabilities/default.json +15 -0
- package/desktop/src-tauri/icons/128x128.png +0 -0
- package/desktop/src-tauri/icons/16x16.png +0 -0
- package/desktop/src-tauri/icons/32x32.png +0 -0
- package/desktop/src-tauri/icons/henry.w@example.net +0 -0
- package/desktop/src-tauri/icons/icon.icns +0 -0
- package/desktop/src-tauri/icons/icon.ico +0 -0
- package/desktop/src-tauri/icons/icon.png +0 -0
- package/desktop/src-tauri/icons/icon.svg +7 -0
- package/desktop/src-tauri/permissions/bridge.toml +24 -0
- package/desktop/src-tauri/src/main.rs +312 -0
- package/desktop/src-tauri/src/mic.rs +216 -0
- package/desktop/src-tauri/tauri.conf.json +46 -0
- package/desktop/tsconfig.json +21 -0
- package/desktop/vite.config.ts +18 -0
- package/package.json +5 -4
- package/src/cli/main.test.ts +6 -0
- package/src/cli/main.ts +5 -2
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
/* ============================================================
|
|
2
|
+
Caelence tokens — matte system
|
|
3
|
+
Green primary, no red, no orange accent. Two neutral families
|
|
4
|
+
used for different jobs. Import first, before any component CSS.
|
|
5
|
+
============================================================ */
|
|
6
|
+
|
|
7
|
+
:root {
|
|
8
|
+
/* ---------- GREEN · the brand ---------- */
|
|
9
|
+
--g-50: #f2f5e6; /* wash, hover beds */
|
|
10
|
+
--g-100: #e4ebca; /* tint fill */
|
|
11
|
+
--g-200: #cddaa4; /* icon tile background */
|
|
12
|
+
--g-400: #afc378;
|
|
13
|
+
--g-500: #9bb35b; /* the logo green. fills, icons, marks */
|
|
14
|
+
--g-600: #89a04b; /* hover on fills */
|
|
15
|
+
--g-700: #667a33; /* buttons and any white text on green */
|
|
16
|
+
--g-800: #4f5f26; /* pressed, dark surfaces */
|
|
17
|
+
|
|
18
|
+
/* white on --g-700 is roughly 4.9:1 and passes AA.
|
|
19
|
+
white on --g-600 is 3.6:1 and does not.
|
|
20
|
+
Never put white on --g-500 or lighter: use --ink instead. */
|
|
21
|
+
|
|
22
|
+
/* ---------- SAND · warm neutrals ---------- */
|
|
23
|
+
/* Pages, cards, canvas beds. The default surface family. */
|
|
24
|
+
--s-25: #fdfcf8;
|
|
25
|
+
--s-50: #f8f6f0;
|
|
26
|
+
--s-100: #f3f0e8; /* your sand */
|
|
27
|
+
--s-200: #e8e3d6;
|
|
28
|
+
--s-300: #d8d2c2;
|
|
29
|
+
|
|
30
|
+
/* ---------- GREY · cool neutrals ---------- */
|
|
31
|
+
/* Rulers, grids, measurement chrome, UI in product scenes.
|
|
32
|
+
Deliberately a different temperature from sand: the warm
|
|
33
|
+
family is paper, the cool family is instrument. */
|
|
34
|
+
--n-50: #f8f8f8;
|
|
35
|
+
--n-100: #eeeeee; /* your light grey */
|
|
36
|
+
--n-200: #e4e4e4;
|
|
37
|
+
--n-300: #d9d9d9; /* your mid grey */
|
|
38
|
+
--n-400: #b6b4ae;
|
|
39
|
+
--n-500: #93918b;
|
|
40
|
+
--n-600: #72726e;
|
|
41
|
+
|
|
42
|
+
/* ---------- INK ---------- */
|
|
43
|
+
--k-700: #4e4d4b;
|
|
44
|
+
--k-800: #363635;
|
|
45
|
+
--k-850: #292929; /* dark surfaces */
|
|
46
|
+
--k-900: #212227; /* deepest surface */
|
|
47
|
+
--k-950: #1a1a19;
|
|
48
|
+
--ink: var(--k-900);
|
|
49
|
+
--subtle: #a8a49f;
|
|
50
|
+
|
|
51
|
+
/* ---------- RED · stop ---------- */
|
|
52
|
+
--r-50: #fbeeec;
|
|
53
|
+
--r-100: #f4d6d2;
|
|
54
|
+
--r-500: #d9584b; /* icons, marks, borders */
|
|
55
|
+
--r-600: #c44a3e;
|
|
56
|
+
--r-700: #b23f33; /* buttons, and red text on a light surface */
|
|
57
|
+
--r-800: #8e3228;
|
|
58
|
+
|
|
59
|
+
/* ---------- ORANGE · attention ---------- */
|
|
60
|
+
--o-50: #fdf4e4;
|
|
61
|
+
--o-100: #f8e3be;
|
|
62
|
+
--o-500: #e0a03c; /* icons, marks, badge fills with dark text */
|
|
63
|
+
--o-600: #c98a2c;
|
|
64
|
+
--o-700: #8f6420; /* orange text on a light surface */
|
|
65
|
+
|
|
66
|
+
/* ---------- BLUE · instrument ---------- */
|
|
67
|
+
--b-50: #edf2f7;
|
|
68
|
+
--b-100: #c8d8e6; /* ruler highlight, soft measurement fill */
|
|
69
|
+
--b-500: #7e97ae;
|
|
70
|
+
--b-600: #6e93b8; /* selection outlines, active handles */
|
|
71
|
+
--b-700: #4e6b87; /* blue text on a light surface */
|
|
72
|
+
|
|
73
|
+
/* ---------- PURPLE · people ---------- */
|
|
74
|
+
--p-50: #f1eff5;
|
|
75
|
+
--p-100: #dcd6e5;
|
|
76
|
+
--p-500: #9a8fae; /* presence, cursors, comments */
|
|
77
|
+
--p-700: #6b6083;
|
|
78
|
+
|
|
79
|
+
/* ============================================================
|
|
80
|
+
ROLES · what each colour is allowed to mean
|
|
81
|
+
Use these aliases in components. Never reach past them to a
|
|
82
|
+
raw ramp step, because that is how intent drifts.
|
|
83
|
+
============================================================ */
|
|
84
|
+
|
|
85
|
+
/* brand and action.
|
|
86
|
+
Four button levels. Ink is the workhorse, green is the
|
|
87
|
+
exception. One green button per screen, maximum. If a screen
|
|
88
|
+
seems to need two, one of them is not primary. */
|
|
89
|
+
--action: var(--g-700); /* PRIMARY fill. white label */
|
|
90
|
+
--action-hover: var(--g-800);
|
|
91
|
+
--action-fg: #ffffff;
|
|
92
|
+
|
|
93
|
+
--action-2: var(--k-900); /* SECONDARY fill. the workhorse */
|
|
94
|
+
--action-2-hover: var(--k-800);
|
|
95
|
+
--action-2-fg: var(--s-25);
|
|
96
|
+
|
|
97
|
+
--action-3-border: var(--n-300); /* TERTIARY. hairline, no fill */
|
|
98
|
+
--action-3-hover: var(--ink);
|
|
99
|
+
--action-3-fg: var(--ink);
|
|
100
|
+
|
|
101
|
+
/* QUIET is text plus arrow. No token needed, no border, no fill. */
|
|
102
|
+
|
|
103
|
+
--brand: var(--g-500); /* logo, marks, icon tiles */
|
|
104
|
+
--brand-tint: var(--g-200);
|
|
105
|
+
--brand-glyph: var(--g-800); /* darkened mark on --brand-tint */
|
|
106
|
+
|
|
107
|
+
/* Category glyphs in the asset list only. Never a row or tile fill. */
|
|
108
|
+
--m-blue: var(--b-500);
|
|
109
|
+
--m-purple: var(--p-500);
|
|
110
|
+
|
|
111
|
+
/* progress and completion. Both green, separated by motion:
|
|
112
|
+
in-progress is green that MOVES, done is green that does not.
|
|
113
|
+
Never show a static green fill for something still running. */
|
|
114
|
+
--running: var(--g-500); /* travelling dash, pulsing ring */
|
|
115
|
+
--done: var(--g-700); /* check glyph, completed step */
|
|
116
|
+
--done-bg: var(--g-50);
|
|
117
|
+
|
|
118
|
+
/* instrument. Blue is never an action and never a status. */
|
|
119
|
+
--measure: var(--b-600); /* selection outline, active handle */
|
|
120
|
+
--measure-soft: var(--b-100); /* ruler highlight band */
|
|
121
|
+
--edit: var(--b-600); /* edit mode, resize, snap guides */
|
|
122
|
+
|
|
123
|
+
/* people */
|
|
124
|
+
--presence: var(--p-500); /* cursors, avatars, comment pins */
|
|
125
|
+
--presence-deep: var(--p-700); /* avatar fill that carries a light label */
|
|
126
|
+
|
|
127
|
+
/* status */
|
|
128
|
+
--danger: var(--r-700); /* destructive button, error text */
|
|
129
|
+
--danger-mark: var(--r-500); /* trash icon, error dot, border */
|
|
130
|
+
--danger-bg: var(--r-50);
|
|
131
|
+
--danger-fill: var(--r-700); /* destructive fill. white label */
|
|
132
|
+
--danger-fg: #ffffff;
|
|
133
|
+
--warning: var(--o-500); /* warning icon, badge fill */
|
|
134
|
+
--warning-text: var(--o-700); /* warning text on a light surface */
|
|
135
|
+
--warning-bg: var(--o-50);
|
|
136
|
+
--info: var(--b-700);
|
|
137
|
+
--info-bg: var(--b-50);
|
|
138
|
+
|
|
139
|
+
/* ---------- CONTRAST FACTS ---------- */
|
|
140
|
+
/* Checked, not assumed. White text passes only on:
|
|
141
|
+
--g-700 4.9:1 --r-700 5.8:1
|
|
142
|
+
--b-700 5.5:1 --p-700 5.8:1
|
|
143
|
+
White FAILS on --g-500, --g-600, --r-500, --o-500, --o-600,
|
|
144
|
+
--b-500, --b-600 and --p-500.
|
|
145
|
+
--o-500 takes --ink at about 6.9:1 and is the correct way to
|
|
146
|
+
use orange as a fill. Orange never carries white. */
|
|
147
|
+
|
|
148
|
+
/* ---------- SEMANTIC ---------- */
|
|
149
|
+
--bg: var(--s-50);
|
|
150
|
+
--bg-sand: var(--s-100);
|
|
151
|
+
/* Canvas beds: one step deeper than --bg-sand so cream page frames read as cards. */
|
|
152
|
+
--bg-canvas: var(--s-200);
|
|
153
|
+
--card: var(--s-25);
|
|
154
|
+
--bg-inset: var(--n-100); /* recessed: wells, code, icon tiles */
|
|
155
|
+
--line: var(--n-200);
|
|
156
|
+
--line-2: var(--n-300);
|
|
157
|
+
--rule: var(--n-400); /* rulers and measurement lines */
|
|
158
|
+
--text: var(--ink);
|
|
159
|
+
--text-secondary: var(--n-600);
|
|
160
|
+
--text-tertiary: var(--n-500);
|
|
161
|
+
|
|
162
|
+
/* ---------- ICONS ---------- */
|
|
163
|
+
/* Phosphor. Light at 20px and up, Regular at 16px and below.
|
|
164
|
+
One weight per context. Never line mixed with filled or duotone.
|
|
165
|
+
Default --icon. Role colour only when the icon carries that role.
|
|
166
|
+
The tile takes the colour, never the row behind it. */
|
|
167
|
+
--icon: var(--n-600);
|
|
168
|
+
--icon-hover: var(--ink);
|
|
169
|
+
--icon-tile: 38px;
|
|
170
|
+
--icon-glyph: 19px;
|
|
171
|
+
--r-tile: 9px;
|
|
172
|
+
|
|
173
|
+
/* ---------- HANDLES ---------- */
|
|
174
|
+
/* Always round. Never square. The dot is the same object at
|
|
175
|
+
every scale: rule intersections, selection corners, connection
|
|
176
|
+
ends, bezier points. */
|
|
177
|
+
--handle: 9px;
|
|
178
|
+
--handle-sm: 7px;
|
|
179
|
+
--handle-ring: 1.6px;
|
|
180
|
+
|
|
181
|
+
/* ---------- SHAPE ---------- */
|
|
182
|
+
--r-sm: 4px;
|
|
183
|
+
--r-md: 8px;
|
|
184
|
+
--r-lg: 12px;
|
|
185
|
+
--r-full: 999px;
|
|
186
|
+
--gutter: 40px;
|
|
187
|
+
--container: 1200px;
|
|
188
|
+
--section: 96px;
|
|
189
|
+
|
|
190
|
+
/* ---------- TYPE ---------- */
|
|
191
|
+
--sans: "Instrument Sans", system-ui, sans-serif;
|
|
192
|
+
--mono: "Chivo Mono", ui-monospace, monospace;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* ============================================================
|
|
196
|
+
DARK
|
|
197
|
+
Follows the system preference by default; an explicit user
|
|
198
|
+
choice overrides it. See the delivery block at the end.
|
|
199
|
+
|
|
200
|
+
The VALUES are not an inversion of the light palette. The sand
|
|
201
|
+
family has no dark equivalent, --g-700 collapses to 3.3:1 and
|
|
202
|
+
stops working as a button, red needs lifting and orange does
|
|
203
|
+
not. Each token was measured against the surface it actually
|
|
204
|
+
sits on. Only this semantic block changes; no component branches
|
|
205
|
+
on theme.
|
|
206
|
+
============================================================ */
|
|
207
|
+
:root[data-theme="dark"] {
|
|
208
|
+
/* surfaces */
|
|
209
|
+
--bg: #1a1a19; /* page. the deepest step */
|
|
210
|
+
--bg-sand: #232321; /* paper: canvas beds, work surfaces */
|
|
211
|
+
--bg-canvas: #1e1e1c; /* board behind page frames; cards lift on top */
|
|
212
|
+
--card: #292929; /* raised: panels, cards, nav */
|
|
213
|
+
--bg-inset: #212227; /* recessed: wells, code blocks */
|
|
214
|
+
|
|
215
|
+
/* lines. two steps, because one is never enough on dark */
|
|
216
|
+
--line: #34343a; /* default separation */
|
|
217
|
+
--line-2: #43434a; /* interactive borders, hover */
|
|
218
|
+
--rule: #55555c; /* rulers, ticks, measurement chrome */
|
|
219
|
+
|
|
220
|
+
/* text. all four pass on every surface above */
|
|
221
|
+
--text: #f6f4ee;
|
|
222
|
+
--text-secondary: #b6b4ae;
|
|
223
|
+
--text-tertiary: #93918b;
|
|
224
|
+
|
|
225
|
+
/* green. --g-700 is only 3.3:1 on --card and must not carry
|
|
226
|
+
small text or act as a button fill here. On dark the button
|
|
227
|
+
inverts: brand green fill, ink label at 7.5:1. */
|
|
228
|
+
--brand: var(--g-500); /* 6.8:1 on --card */
|
|
229
|
+
--brand-glyph: var(--g-500); /* lifted so the tile mark reads on --brand-tint */
|
|
230
|
+
--action: var(--g-500);
|
|
231
|
+
--action-hover: var(--g-400);
|
|
232
|
+
--action-fg: #1a1a19; /* dark label on green, not white */
|
|
233
|
+
--action-2: #f6f4ee;
|
|
234
|
+
--action-2-hover: #e8e3d6;
|
|
235
|
+
--action-2-fg: #1a1a19;
|
|
236
|
+
--action-3-border: var(--line-2);
|
|
237
|
+
--action-3-hover: var(--text);
|
|
238
|
+
--action-3-fg: var(--text);
|
|
239
|
+
--brand-tint: #2e3521; /* icon tile bed */
|
|
240
|
+
--running: var(--g-400);
|
|
241
|
+
--done: var(--g-400);
|
|
242
|
+
--done-bg: #23291a;
|
|
243
|
+
|
|
244
|
+
/* status. red is the one that needs lifting: --r-500 is 4.1:1
|
|
245
|
+
on --card, so small red text uses --r-400. */
|
|
246
|
+
--danger: #e4796e; /* lifted for text */
|
|
247
|
+
--danger-mark: var(--r-500); /* icons and borders only */
|
|
248
|
+
--danger-bg: #2e1e1c;
|
|
249
|
+
--danger-fill: var(--r-700); /* keep the 700 fill so --danger-fg stays white */
|
|
250
|
+
--danger-fg: #ffffff;
|
|
251
|
+
--warning: var(--o-500); /* 7.0:1, no lift needed */
|
|
252
|
+
--warning-text: var(--o-500);
|
|
253
|
+
--warning-bg: #2e2519;
|
|
254
|
+
--info: var(--b-500);
|
|
255
|
+
--info-bg: #1e2429;
|
|
256
|
+
|
|
257
|
+
/* instrument */
|
|
258
|
+
--measure: var(--b-500); /* 5.2:1 on --card */
|
|
259
|
+
--measure-soft: #2a3641;
|
|
260
|
+
--edit: var(--b-500);
|
|
261
|
+
--presence: var(--p-500); /* 5.2:1 */
|
|
262
|
+
--presence-deep: var(--p-700);
|
|
263
|
+
|
|
264
|
+
/* icons. --n-400 is 7.5:1 on --card but Light-weight 19px strokes
|
|
265
|
+
still read dim; lift toward --text for chrome glyphs. */
|
|
266
|
+
--icon: #d0cec6;
|
|
267
|
+
--icon-hover: var(--text);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* ---------- dark rules that are not colours ----------
|
|
271
|
+
|
|
272
|
+
1. The logo keeps #9BB35B. Never the lifted green. It is 6.8:1
|
|
273
|
+
on --card and needs no help.
|
|
274
|
+
2. Elevation inverts. On light, floating layers get a shadow.
|
|
275
|
+
On dark, shadows are invisible: a floating layer lifts by
|
|
276
|
+
going one step lighter (--card over --bg) plus a --line-2
|
|
277
|
+
border. Keep the shadow tokens for depth on top of that,
|
|
278
|
+
never as the only signal.
|
|
279
|
+
3. Grain drops from 5.5% to about 3%. Noise reads roughly twice
|
|
280
|
+
as strong on a dark field and turns to visible dirt.
|
|
281
|
+
4. Hairlines need more contrast, not less. A 1px --line on dark
|
|
282
|
+
disappears at 100% zoom on some panels; that is what --line-2
|
|
283
|
+
is for.
|
|
284
|
+
5. The canvas dot grid uses --rule at 40% opacity, not --line.
|
|
285
|
+
A dot field tuned for sand vanishes on ink.
|
|
286
|
+
6. Green fills stay rare, same as light. In progress moves,
|
|
287
|
+
done is still. The motion rule is theme-independent.
|
|
288
|
+
------------------------------------------------------------ */
|
|
289
|
+
|
|
290
|
+
/* Same values, applied when the system asks for dark and the user
|
|
291
|
+
has not chosen otherwise. Keep the two blocks identical: if you
|
|
292
|
+
change one, change the other. */
|
|
293
|
+
@media (prefers-color-scheme: dark) {
|
|
294
|
+
:root:not([data-theme="light"]) {
|
|
295
|
+
--bg: #1a1a19;
|
|
296
|
+
--bg-sand: #232321;
|
|
297
|
+
--bg-canvas: #1e1e1c;
|
|
298
|
+
--card: #292929;
|
|
299
|
+
--bg-inset: #212227;
|
|
300
|
+
--line: #34343a;
|
|
301
|
+
--line-2: #43434a;
|
|
302
|
+
--rule: #55555c;
|
|
303
|
+
--text: #f6f4ee;
|
|
304
|
+
--text-secondary: #b6b4ae;
|
|
305
|
+
--text-tertiary: #93918b;
|
|
306
|
+
--brand: var(--g-500);
|
|
307
|
+
--brand-glyph: var(--g-500);
|
|
308
|
+
--action: var(--g-500);
|
|
309
|
+
--action-hover: var(--g-400);
|
|
310
|
+
--action-fg: #1a1a19;
|
|
311
|
+
--brand-tint: #2e3521;
|
|
312
|
+
--action-2: #f6f4ee;
|
|
313
|
+
--action-2-hover: #e8e3d6;
|
|
314
|
+
--action-2-fg: #1a1a19;
|
|
315
|
+
--action-3-border: #43434a;
|
|
316
|
+
--action-3-hover: #f6f4ee;
|
|
317
|
+
--action-3-fg: #f6f4ee;
|
|
318
|
+
--running: var(--g-400);
|
|
319
|
+
--done: var(--g-400);
|
|
320
|
+
--done-bg: #23291a;
|
|
321
|
+
--danger: #e4796e;
|
|
322
|
+
--danger-mark: var(--r-500);
|
|
323
|
+
--danger-bg: #2e1e1c;
|
|
324
|
+
--danger-fill: var(--r-700);
|
|
325
|
+
--danger-fg: #ffffff;
|
|
326
|
+
--warning: var(--o-500);
|
|
327
|
+
--warning-text: var(--o-500);
|
|
328
|
+
--warning-bg: #2e2519;
|
|
329
|
+
--info: var(--b-500);
|
|
330
|
+
--info-bg: #1e2429;
|
|
331
|
+
--measure: var(--b-500);
|
|
332
|
+
--measure-soft: #2a3641;
|
|
333
|
+
--edit: var(--b-500);
|
|
334
|
+
--presence: var(--p-500);
|
|
335
|
+
--presence-deep: var(--p-700);
|
|
336
|
+
--icon: #d0cec6;
|
|
337
|
+
--icon-hover: var(--text);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/* Tells the browser to theme its own UI: form controls, scrollbars,
|
|
342
|
+
spellcheck underlines, the lot. Without this they stay light on a
|
|
343
|
+
dark page, which is the most common dark-mode oversight. */
|
|
344
|
+
:root {
|
|
345
|
+
color-scheme: light;
|
|
346
|
+
}
|
|
347
|
+
:root[data-theme="dark"] {
|
|
348
|
+
color-scheme: dark;
|
|
349
|
+
}
|
|
350
|
+
@media (prefers-color-scheme: dark) {
|
|
351
|
+
:root:not([data-theme="light"]) {
|
|
352
|
+
color-scheme: dark;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import {
|
|
3
|
+
groupTranscriptLines,
|
|
4
|
+
type ToolLine,
|
|
5
|
+
thoughtSummary,
|
|
6
|
+
thoughtTools,
|
|
7
|
+
warmupHeadline,
|
|
8
|
+
} from "./thought.ts";
|
|
9
|
+
|
|
10
|
+
function tool(partial: Partial<ToolLine> & Pick<ToolLine, "key" | "label" | "status">): ToolLine {
|
|
11
|
+
return {
|
|
12
|
+
type: "tool",
|
|
13
|
+
name: "notion__notion_fetch",
|
|
14
|
+
callId: partial.key,
|
|
15
|
+
count: 1,
|
|
16
|
+
preview: "",
|
|
17
|
+
...partial,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe("thought fold", () => {
|
|
22
|
+
test("hides consecutive tool rows behind one thought block", () => {
|
|
23
|
+
const blocks = groupTranscriptLines([
|
|
24
|
+
{ key: "u-0", type: "user", text: "cv", userTurnIndex: 0 },
|
|
25
|
+
tool({ key: "t1", label: "Notion fetch", status: "ok" }),
|
|
26
|
+
tool({ key: "t2", label: "Notion search", status: "ok", name: "notion__notion_search" }),
|
|
27
|
+
{ key: "a-1", type: "assistant", text: "done" },
|
|
28
|
+
]);
|
|
29
|
+
expect(blocks.map((block) => block.type)).toEqual(["line", "thought", "line"]);
|
|
30
|
+
expect(blocks[1]?.type === "thought" && thoughtTools(blocks[1].entries)).toHaveLength(2);
|
|
31
|
+
expect(
|
|
32
|
+
thoughtSummary(blocks[1]?.type === "thought" ? thoughtTools(blocks[1].entries) : [], false)
|
|
33
|
+
.headline,
|
|
34
|
+
).toBe("Explored 1 search");
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("stays live between tool calls until the assistant replies", () => {
|
|
38
|
+
const blocks = groupTranscriptLines([
|
|
39
|
+
{ key: "u-0", type: "user", text: "cv", userTurnIndex: 0 },
|
|
40
|
+
tool({ key: "t1", label: "Notion fetch", status: "ok" }),
|
|
41
|
+
tool({ key: "t2", label: "Notion search", status: "ok" }),
|
|
42
|
+
]);
|
|
43
|
+
expect(blocks[1]?.type === "thought" && blocks[1].live).toBe(true);
|
|
44
|
+
const settled = groupTranscriptLines([
|
|
45
|
+
{ key: "u-0", type: "user", text: "cv", userTurnIndex: 0 },
|
|
46
|
+
tool({ key: "t1", label: "Notion fetch", status: "ok" }),
|
|
47
|
+
{ key: "a-1", type: "assistant", text: "done" },
|
|
48
|
+
]);
|
|
49
|
+
expect(settled[1]?.type === "thought" && settled[1].live).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("warmup headlines rotate without inventing a duration", () => {
|
|
53
|
+
expect(warmupHeadline(0)).toBe("Getting ready");
|
|
54
|
+
expect(warmupHeadline(1)).toBe("Loading");
|
|
55
|
+
expect(warmupHeadline(2)).toBe("Warming up");
|
|
56
|
+
expect(warmupHeadline(3)).toBe("Getting ready");
|
|
57
|
+
expect(thoughtSummary([], true, { warmup: true, seed: 1 }).headline).toBe("Loading");
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("live thought keeps Thinking and names the in-flight tool", () => {
|
|
61
|
+
const tools = [
|
|
62
|
+
tool({ key: "t1", label: "Notion search", status: "ok", name: "notion__notion_search" }),
|
|
63
|
+
tool({ key: "t2", label: "Notion fetch", status: "running" }),
|
|
64
|
+
];
|
|
65
|
+
expect(thoughtSummary(tools, true)).toEqual({
|
|
66
|
+
headline: "Thinking",
|
|
67
|
+
activity: "Notion fetch",
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("done headlines follow thought, explored, or worked", () => {
|
|
72
|
+
expect(thoughtSummary([], false).headline).toBe("Thought");
|
|
73
|
+
expect(
|
|
74
|
+
thoughtSummary([tool({ key: "t1", label: "Notion fetch", status: "ok" })], false).headline,
|
|
75
|
+
).toBe("Explored");
|
|
76
|
+
expect(
|
|
77
|
+
thoughtSummary(
|
|
78
|
+
[tool({ key: "w1", label: "Writing src/a.ts", status: "ok", name: "write_file" })],
|
|
79
|
+
false,
|
|
80
|
+
).headline,
|
|
81
|
+
).toBe("Worked");
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test("folds reasoning notes with the tools", () => {
|
|
85
|
+
const blocks = groupTranscriptLines([
|
|
86
|
+
{ key: "u-0", type: "user", text: "cv", userTurnIndex: 0 },
|
|
87
|
+
{ key: "th-1", type: "thought", text: "I should look this up." },
|
|
88
|
+
tool({ key: "t1", label: "Notion fetch", status: "ok" }),
|
|
89
|
+
{ key: "a-2", type: "assistant", text: "done" },
|
|
90
|
+
]);
|
|
91
|
+
expect(blocks[1]?.type).toBe("thought");
|
|
92
|
+
if (blocks[1]?.type !== "thought") return;
|
|
93
|
+
expect(blocks[1].entries[0]).toEqual({ type: "note", text: "I should look this up." });
|
|
94
|
+
expect(blocks[1].entries[1]?.type).toBe("tool");
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { StreamLine } from "./stream";
|
|
2
|
+
import { eventCountSuffix } from "./tool-label";
|
|
3
|
+
|
|
4
|
+
export type ToolLine = Extract<StreamLine, { type: "tool" }>;
|
|
5
|
+
|
|
6
|
+
export type FoldEntry = { type: "note"; text: string } | { type: "tool"; tool: ToolLine };
|
|
7
|
+
|
|
8
|
+
export type TranscriptBlock =
|
|
9
|
+
| { type: "line"; line: StreamLine }
|
|
10
|
+
| { type: "thought"; entries: FoldEntry[]; live: boolean };
|
|
11
|
+
|
|
12
|
+
function isFoldLine(line: StreamLine): line is ToolLine | Extract<StreamLine, { type: "thought" }> {
|
|
13
|
+
return line.type === "tool" || line.type === "thought";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function thoughtTools(entries: FoldEntry[]): ToolLine[] {
|
|
17
|
+
return entries.flatMap((entry) => (entry.type === "tool" ? [entry.tool] : []));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function groupTranscriptLines(lines: StreamLine[]): TranscriptBlock[] {
|
|
21
|
+
const out: TranscriptBlock[] = [];
|
|
22
|
+
let i = 0;
|
|
23
|
+
while (i < lines.length) {
|
|
24
|
+
const line = lines[i];
|
|
25
|
+
if (!line || !isFoldLine(line)) {
|
|
26
|
+
if (line) out.push({ type: "line", line });
|
|
27
|
+
i += 1;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const entries: FoldEntry[] = [];
|
|
31
|
+
while (i < lines.length) {
|
|
32
|
+
const next = lines[i];
|
|
33
|
+
if (!next || !isFoldLine(next)) break;
|
|
34
|
+
if (next.type === "tool") entries.push({ type: "tool", tool: next });
|
|
35
|
+
else {
|
|
36
|
+
const last = entries.at(-1);
|
|
37
|
+
if (last?.type === "note") last.text += next.text;
|
|
38
|
+
else entries.push({ type: "note", text: next.text });
|
|
39
|
+
}
|
|
40
|
+
i += 1;
|
|
41
|
+
}
|
|
42
|
+
out.push({ type: "thought", entries, live: i >= lines.length });
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const WRITE_LABEL = /^(?:Writing|Editing)\b/u;
|
|
48
|
+
const WRITE_NAME = /write_file|edit_file|str_replace|apply_patch|shell|bash|git_commit/i;
|
|
49
|
+
const WARMUP_HEADLINES = ["Getting ready", "Loading", "Warming up"] as const;
|
|
50
|
+
|
|
51
|
+
function isWriteTool(tool: ToolLine): boolean {
|
|
52
|
+
return WRITE_LABEL.test(tool.label) || WRITE_NAME.test(tool.name);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function warmupHeadline(seed: number): string {
|
|
56
|
+
return WARMUP_HEADLINES[Math.abs(seed) % WARMUP_HEADLINES.length] ?? "Getting ready";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function thoughtSummary(
|
|
60
|
+
tools: ToolLine[],
|
|
61
|
+
live: boolean,
|
|
62
|
+
options?: { warmup?: boolean; seed?: number },
|
|
63
|
+
): { headline: string; activity?: string } {
|
|
64
|
+
if (live && options?.warmup) {
|
|
65
|
+
return { headline: warmupHeadline(options.seed ?? 0) };
|
|
66
|
+
}
|
|
67
|
+
if (live) {
|
|
68
|
+
const running = [...tools].reverse().find((tool) => tool.status === "running");
|
|
69
|
+
return {
|
|
70
|
+
headline: "Thinking",
|
|
71
|
+
...(running ? { activity: `${running.label}${eventCountSuffix(running.count)}` } : {}),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (tools.some(isWriteTool)) return { headline: "Worked" };
|
|
75
|
+
if (tools.length === 0) return { headline: "Thought" };
|
|
76
|
+
const files = new Set<string>();
|
|
77
|
+
let searches = 0;
|
|
78
|
+
for (const tool of tools) {
|
|
79
|
+
const file = /^(?:Reading|Writing|Editing)\s+(\S+)/u.exec(tool.label);
|
|
80
|
+
if (file?.[1]) files.add(file[1]);
|
|
81
|
+
if (/search/i.test(tool.name) || /^Searching\b/u.test(tool.label)) searches += 1;
|
|
82
|
+
}
|
|
83
|
+
const parts: string[] = [];
|
|
84
|
+
if (files.size > 0) parts.push(`${files.size} ${files.size === 1 ? "file" : "files"}`);
|
|
85
|
+
if (searches > 0) parts.push(`${searches} ${searches === 1 ? "search" : "searches"}`);
|
|
86
|
+
return { headline: parts.length > 0 ? `Explored ${parts.join(", ")}` : "Explored" };
|
|
87
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { prettifyToolName, toolLabel } from "./tool-label.ts";
|
|
3
|
+
|
|
4
|
+
describe("tool labels", () => {
|
|
5
|
+
test("sentence-cases snake names and drops MCP namespaces", () => {
|
|
6
|
+
expect(prettifyToolName("write_file")).toBe("Write file");
|
|
7
|
+
expect(toolLabel("notion__notion_fetch")).toBe("Notion fetch");
|
|
8
|
+
expect(toolLabel("notion__notion_list_recent_pages")).toBe("Notion list recent pages");
|
|
9
|
+
expect(toolLabel("google-sheets__get_range")).toBe("Google sheets get range");
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test("uses path and command when the builder would", () => {
|
|
13
|
+
expect(toolLabel("write_file", { path: "src/app.css" })).toBe("Writing src/app.css");
|
|
14
|
+
expect(toolLabel("exec", { command: "bun test" })).toBe("Running: bun test");
|
|
15
|
+
expect(toolLabel("web_search")).toBe("Searching the web");
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** Human labels for transcript tool rows, matching the builder event rows. */
|
|
2
|
+
|
|
3
|
+
const TOOL_LABELS: Record<string, string> = {
|
|
4
|
+
get_preview_url: "Refreshing preview",
|
|
5
|
+
search_avalon_docs: "Searching Avalon docs",
|
|
6
|
+
get_component_pattern: "Fetching component pattern",
|
|
7
|
+
get_doc: "Reading Avalon docs",
|
|
8
|
+
list_docs: "Listing Avalon docs",
|
|
9
|
+
validate_avalon_component: "Validating component",
|
|
10
|
+
firecrawl_search: "Searching the web",
|
|
11
|
+
web_search: "Searching the web",
|
|
12
|
+
todo_write: "Updating todos",
|
|
13
|
+
grep: "Searching files",
|
|
14
|
+
glob: "Finding files",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const EVENT_COUNT_RE = /\s×(\d+)$/u;
|
|
18
|
+
|
|
19
|
+
export function prettifyToolName(name: string): string {
|
|
20
|
+
const local = name.includes("__") ? (name.split("__").at(-1) ?? name) : name;
|
|
21
|
+
const stripped = local.replace(/^[a-z0-9]+_/i, (prefix) => {
|
|
22
|
+
const ns = name.split("__")[0];
|
|
23
|
+
return ns && prefix.toLowerCase() === `${ns.toLowerCase()}_` ? "" : prefix;
|
|
24
|
+
});
|
|
25
|
+
const s = stripped.replace(/[_-]+/g, " ").trim();
|
|
26
|
+
return s.length > 0 ? s.charAt(0).toUpperCase() + s.slice(1) : name;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function toolLabel(toolName: string, input: Record<string, unknown> = {}): string {
|
|
30
|
+
const path = typeof input.path === "string" ? input.path : undefined;
|
|
31
|
+
const command = typeof input.command === "string" ? input.command : undefined;
|
|
32
|
+
if (toolName === "write_file" && path) return `Writing ${path}`;
|
|
33
|
+
if (toolName === "edit_file" && path) return `Editing ${path}`;
|
|
34
|
+
if (toolName === "read_file" && path) return `Reading ${path}`;
|
|
35
|
+
if (toolName === "exec" && command) return `Running: ${command}`;
|
|
36
|
+
const known = TOOL_LABELS[toolName];
|
|
37
|
+
if (known) return known;
|
|
38
|
+
const pretty = prettifyToolName(toolName);
|
|
39
|
+
const ns = toolName.includes("__") ? toolName.split("__")[0] : undefined;
|
|
40
|
+
if (ns && !pretty.toLowerCase().startsWith(ns.replace(/[_-]+/g, " ").toLowerCase())) {
|
|
41
|
+
const host = ns.replace(/[_-]+/g, " ");
|
|
42
|
+
const hostLabel = host.charAt(0).toUpperCase() + host.slice(1);
|
|
43
|
+
return `${hostLabel} ${pretty.toLowerCase()}`;
|
|
44
|
+
}
|
|
45
|
+
return pretty;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function inputFromPreview(preview: string): Record<string, unknown> {
|
|
49
|
+
const raw = preview.trim();
|
|
50
|
+
if (!raw) return {};
|
|
51
|
+
if (raw.startsWith("{") || raw.startsWith("[")) {
|
|
52
|
+
try {
|
|
53
|
+
const parsed: unknown = JSON.parse(raw);
|
|
54
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
55
|
+
return parsed as Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
} catch {
|
|
58
|
+
return { label: raw };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return { path: raw, command: raw, query: raw, label: raw };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function eventCountSuffix(count: number): string {
|
|
65
|
+
return count > 1 ? ` ×${count}` : "";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function baseEventLabel(label: string): string {
|
|
69
|
+
return label.replace(EVENT_COUNT_RE, "");
|
|
70
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
interface ImportMetaEnv {
|
|
4
|
+
readonly VITE_HARNESS_BRIDGE?: string;
|
|
5
|
+
readonly VITE_HARNESS_TOKEN?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface ImportMeta {
|
|
9
|
+
readonly env: ImportMetaEnv;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface Window {
|
|
13
|
+
__HARNESS_BRIDGE?: string;
|
|
14
|
+
__HARNESS_TOKEN?: string;
|
|
15
|
+
}
|