waygraph 0.15.29 → 0.15.30
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/dist/pilot-overlay/fixtures.d.ts +81 -0
- package/dist/pilot-overlay/fixtures.js +334 -0
- package/dist/pilot-overlay/panel.d.ts +34 -0
- package/dist/pilot-overlay/panel.js +155 -0
- package/dist/pilot-overlay/shell.d.ts +48 -0
- package/dist/pilot-overlay/shell.js +276 -0
- package/dist/pilot-overlay.d.ts +3 -158
- package/dist/pilot-overlay.js +4 -778
- package/examples/saucedemo/.waygraph-auto/bb0e0e46.log +0 -0
- package/examples/saucedemo/.waygraph-auto/e230f24e.log +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
// Split out of the former 950-line pilot-overlay.ts (see src/ARCHITECTURE.md). Behavior unchanged.
|
|
2
|
+
import { SURFACE } from "../ui/tokens.js";
|
|
3
|
+
import { pilotFxRingCss } from "../ui/components/ring.js";
|
|
4
|
+
import { WAYGRAPH_RING_CSS } from "../highlights.js";
|
|
5
|
+
// Real, direct user request: this overlay's own colors were an improvised
|
|
6
|
+
// purple/white scheme (#a78bfa / #1a1033) that didn't match anything else -
|
|
7
|
+
// "our design here seems like barely shares with the ui on the stepper
|
|
8
|
+
// design... looks a bit different and out of sync". These are the SAME
|
|
9
|
+
// colors `cli.ts`'s own demo panel/ring already use (#7C3AED primary
|
|
10
|
+
// purple, the dark rgba(20,10,40,.94) panel background + white text,
|
|
11
|
+
// #c9a6ff for a secondary purple accent on that dark background - all
|
|
12
|
+
// copied verbatim from cli.ts's own `#wg-panel`/`RING_CSS`, not
|
|
13
|
+
// re-invented) - genuinely the same visual language, not just the ring CSS
|
|
14
|
+
// this file already shared via WAYGRAPH_RING_CSS.
|
|
15
|
+
const OVERLAY_CSS = `
|
|
16
|
+
#wg-pilot-overlay {
|
|
17
|
+
position: fixed; z-index: 2147483000; bottom: 12px; right: 12px;
|
|
18
|
+
font: 12px/1.4 ui-monospace, "SF Mono", Consolas, monospace;
|
|
19
|
+
color: #fff; pointer-events: auto;
|
|
20
|
+
}
|
|
21
|
+
#wg-pilot-badge {
|
|
22
|
+
background: #7C3AED; color: #fff; padding: 6px 10px; border-radius: 8px;
|
|
23
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.25); cursor: pointer; white-space: nowrap;
|
|
24
|
+
font-weight: 600; user-select: none;
|
|
25
|
+
}
|
|
26
|
+
#wg-pilot-panel {
|
|
27
|
+
display: none; margin-top: 6px; max-width: 420px; max-height: 320px;
|
|
28
|
+
overflow-y: auto; background: ${SURFACE}; color: #fff; border-radius: 8px;
|
|
29
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.25); padding: 8px 10px;
|
|
30
|
+
}
|
|
31
|
+
/* The graph tab renders a real Mermaid flowchart, which needs more room than
|
|
32
|
+
the flat-list "Here" tab and its own scroll - real, direct user request:
|
|
33
|
+
"a 2d version. left to right stuff. maybe mermaid?" replacing the original
|
|
34
|
+
flat indented-text tree. Widened+its own scrollbox rather than growing
|
|
35
|
+
the shared panel unconditionally, so "Here" stays compact. */
|
|
36
|
+
#wg-pilot-panel:has(#wg-pilot-panel-graph:not([style*="display: none"])) {
|
|
37
|
+
max-width: 640px; max-height: 460px;
|
|
38
|
+
}
|
|
39
|
+
#wg-pilot-panel-graph { overflow: auto; }
|
|
40
|
+
#wg-pilot-panel-graph svg { max-width: none; }
|
|
41
|
+
#wg-pilot-panel-graph .wg-pilot-graph-note { color: #999; font-style: italic; font-size: 11px; padding: 4px 2px 0; }
|
|
42
|
+
#wg-pilot-panel.wg-pilot-open { display: block; }
|
|
43
|
+
#wg-pilot-panel-toggle { display: flex; gap: 6px; margin-bottom: 8px; }
|
|
44
|
+
#wg-pilot-panel-toggle button {
|
|
45
|
+
background: transparent; color: #bbb; border: 1px solid rgba(255,255,255,.2);
|
|
46
|
+
border-radius: 6px; padding: 3px 8px; font: inherit; cursor: pointer;
|
|
47
|
+
}
|
|
48
|
+
#wg-pilot-panel-toggle button.wg-pilot-tab-active { background: #7C3AED; color: #fff; border-color: #7C3AED; }
|
|
49
|
+
#wg-pilot-panel .wg-pilot-section { font-weight: 700; margin: 6px 0 2px; color: #c9a6ff; }
|
|
50
|
+
#wg-pilot-panel .wg-pilot-edge { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
|
|
51
|
+
#wg-pilot-panel .wg-pilot-kind { color: #c9a6ff; font-weight: 600; }
|
|
52
|
+
#wg-pilot-panel .wg-pilot-desc { color: #bbb; }
|
|
53
|
+
#wg-pilot-panel .wg-pilot-empty { color: #999; font-style: italic; }
|
|
54
|
+
#wg-pilot-panel-graph .wg-pilot-graph-node { margin: 6px 0; }
|
|
55
|
+
#wg-pilot-panel-graph .wg-pilot-graph-checkpoint { color: #c9a6ff; font-weight: 700; }
|
|
56
|
+
#wg-pilot-panel-graph .wg-pilot-graph-edge { padding: 2px 0 2px 14px; border-left: 2px solid rgba(255,255,255,.15); font-size: 11px; }
|
|
57
|
+
#wg-pilot-panel-graph .wg-pilot-graph-edge .wg-pilot-kind { color: #c9a6ff; }
|
|
58
|
+
#wg-pilot-activity {
|
|
59
|
+
position: fixed; z-index: 2147483000; bottom: 12px; left: 12px;
|
|
60
|
+
font: 12px/1.4 ui-monospace, "SF Mono", Consolas, monospace;
|
|
61
|
+
background: ${SURFACE}; color: #fff; padding: 6px 10px; border-radius: 8px;
|
|
62
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.25); white-space: nowrap; pointer-events: none;
|
|
63
|
+
opacity: 0; transform: translateY(4px); transition: opacity 0.15s, transform 0.15s;
|
|
64
|
+
}
|
|
65
|
+
#wg-pilot-activity.wg-pilot-toast-show { opacity: 1; transform: translateY(0); }
|
|
66
|
+
/* Agent-sent fixture rings: generated from ui/tokens (tones shared with #wg-ring). */
|
|
67
|
+
${pilotFxRingCss()}
|
|
68
|
+
#wg-pilot-fx-todos{
|
|
69
|
+
position:fixed;z-index:2147483645;top:72px;max-width:280px;max-height:calc(100vh - 100px);overflow:auto;
|
|
70
|
+
font:12px/1.4 ui-sans-serif,system-ui,sans-serif;color:#fff;
|
|
71
|
+
background:${SURFACE};border-radius:10px;padding:10px 12px;
|
|
72
|
+
box-shadow:0 2px 10px rgba(0,0,0,.3);pointer-events:auto;
|
|
73
|
+
transition:opacity .25s ease;
|
|
74
|
+
}
|
|
75
|
+
#wg-pilot-fx-todos.wg-todo-behind{z-index:2147483643;opacity:.42;pointer-events:none;}
|
|
76
|
+
#wg-pilot-fx-todos[data-pos=left]{left:14px;right:auto;}
|
|
77
|
+
#wg-pilot-fx-todos[data-pos=right]{right:14px;left:auto;}
|
|
78
|
+
#wg-pilot-fx-todos .wg-pilot-fx-todo-title{font-weight:700;color:#c9a6ff;margin-bottom:6px;}
|
|
79
|
+
#wg-pilot-fx-todos ol{margin:0;padding-left:18px;}
|
|
80
|
+
#wg-pilot-fx-todos li{margin:3px 0;color:#ddd;}
|
|
81
|
+
#wg-pilot-fx-todos li.wg-pilot-fx-todo-done{color:#888;text-decoration:line-through;}
|
|
82
|
+
#wg-pilot-fx-todos li.wg-pilot-fx-todo-now{color:#fff;font-weight:700;}
|
|
83
|
+
#wg-pilot-fx-todos[data-compact="1"]:not(:hover) li.wg-todo-fold{display:none;}
|
|
84
|
+
#wg-pilot-fx-todos .wg-todo-more{margin-top:6px;padding:4px 8px;border-radius:8px;
|
|
85
|
+
background:rgba(124,58,237,.22);font:700 11px/1.2 system-ui,sans-serif;color:#e8dcff;}
|
|
86
|
+
/* Spotlight (demo focus:true) - dim page, cutout around target. */
|
|
87
|
+
#wg-pilot-fx-focus{position:fixed;z-index:2147483644;pointer-events:none;
|
|
88
|
+
border-radius:12px;box-shadow:0 0 0 9999px rgba(8,4,20,.62);
|
|
89
|
+
opacity:0;transition:opacity .3s ease,left .3s ease,top .3s ease,width .3s ease,height .3s ease;}
|
|
90
|
+
#wg-pilot-fx-focus.wg-in{opacity:1;}
|
|
91
|
+
/* Zoom HUD (demo parity - badge only; no CSS scale of the page). */
|
|
92
|
+
#wg-pilot-fx-zoom{position:fixed;z-index:2147483646;bottom:14px;right:14px;
|
|
93
|
+
display:flex;align-items:center;gap:7px;padding:6px 11px 6px 8px;
|
|
94
|
+
border-radius:999px;background:${SURFACE};color:#f0e8ff;
|
|
95
|
+
border:1px solid rgba(250,204,21,.6);box-shadow:0 6px 18px rgba(0,0,0,.4);
|
|
96
|
+
font:700 12px/1.2 system-ui,sans-serif;pointer-events:none;}
|
|
97
|
+
#wg-pilot-fx-zoom .wg-pilot-fx-zoom-ico{width:18px;height:18px;display:flex;align-items:center;justify-content:center;
|
|
98
|
+
border-radius:6px;background:rgba(250,204,21,.22);}
|
|
99
|
+
#wg-pilot-fx-zoom .wg-pilot-fx-zoom-ico svg{width:14px;height:14px;display:block;}
|
|
100
|
+
#wg-pilot-fx-zoom .wg-pilot-fx-zoom-val{color:#fde68a;font-variant-numeric:tabular-nums;font-weight:800;min-width:3.2em;}
|
|
101
|
+
#wg-pilot-fx-zoom[data-zoomed="1"]{border-color:#fbbf24;}
|
|
102
|
+
#wg-pilot-fx-device{position:fixed;z-index:2147483646;top:14px;right:14px;
|
|
103
|
+
padding:8px 12px;border-radius:10px;background:${SURFACE};color:#f0e8ff;
|
|
104
|
+
border:1px solid rgba(124,58,237,.55);font:700 12px/1.2 system-ui,sans-serif;
|
|
105
|
+
pointer-events:none;box-shadow:0 6px 18px rgba(0,0,0,.35);}
|
|
106
|
+
#wg-pilot-fx-device[data-preset=mobile]{border-color:#3B82F6;}
|
|
107
|
+
#wg-pilot-fx-device[data-preset=tablet]{border-color:#22C55E;}
|
|
108
|
+
#wg-pilot-fx-device[data-preset=desktop]{border-color:#9CA3AF;}
|
|
109
|
+
` + WAYGRAPH_RING_CSS;
|
|
110
|
+
/** Browser-side shell install — runs on every document via context.addInitScript. */
|
|
111
|
+
function installPilotOverlayShell(css) {
|
|
112
|
+
if (document.getElementById("wg-pilot-overlay"))
|
|
113
|
+
return;
|
|
114
|
+
const style = document.createElement("style");
|
|
115
|
+
style.id = "wg-pilot-overlay-css";
|
|
116
|
+
style.textContent = css;
|
|
117
|
+
document.documentElement.appendChild(style);
|
|
118
|
+
const root = document.createElement("div");
|
|
119
|
+
root.id = "wg-pilot-overlay";
|
|
120
|
+
root.innerHTML =
|
|
121
|
+
'<div id="wg-pilot-badge">Waygraph Pilot</div>' +
|
|
122
|
+
'<div id="wg-pilot-panel">' +
|
|
123
|
+
'<div id="wg-pilot-panel-toggle"><button id="wg-pilot-view-current" class="wg-pilot-tab-active">Here</button>' +
|
|
124
|
+
'<button id="wg-pilot-view-graph">All nodes</button></div>' +
|
|
125
|
+
'<div id="wg-pilot-panel-current"></div>' +
|
|
126
|
+
'<div id="wg-pilot-panel-graph" style="display:none"></div>' +
|
|
127
|
+
"</div>";
|
|
128
|
+
document.documentElement.appendChild(root);
|
|
129
|
+
document.getElementById("wg-pilot-badge").addEventListener("click", () => {
|
|
130
|
+
document.getElementById("wg-pilot-panel").classList.toggle("wg-pilot-open");
|
|
131
|
+
});
|
|
132
|
+
document.getElementById("wg-pilot-view-current").addEventListener("click", () => {
|
|
133
|
+
document.getElementById("wg-pilot-view-current").classList.add("wg-pilot-tab-active");
|
|
134
|
+
document.getElementById("wg-pilot-view-graph").classList.remove("wg-pilot-tab-active");
|
|
135
|
+
document.getElementById("wg-pilot-panel-current").style.display = "";
|
|
136
|
+
document.getElementById("wg-pilot-panel-graph").style.display = "none";
|
|
137
|
+
});
|
|
138
|
+
document.getElementById("wg-pilot-view-graph").addEventListener("click", () => {
|
|
139
|
+
document.getElementById("wg-pilot-view-graph").classList.add("wg-pilot-tab-active");
|
|
140
|
+
document.getElementById("wg-pilot-view-current").classList.remove("wg-pilot-tab-active");
|
|
141
|
+
document.getElementById("wg-pilot-panel-graph").style.display = "";
|
|
142
|
+
document.getElementById("wg-pilot-panel-current").style.display = "none";
|
|
143
|
+
});
|
|
144
|
+
if (!document.getElementById("wg-pilot-activity")) {
|
|
145
|
+
const toast = document.createElement("div");
|
|
146
|
+
toast.id = "wg-pilot-activity";
|
|
147
|
+
document.documentElement.appendChild(toast);
|
|
148
|
+
}
|
|
149
|
+
if (!document.getElementById("wg-ring")) {
|
|
150
|
+
const ring = document.createElement("div");
|
|
151
|
+
ring.id = "wg-ring";
|
|
152
|
+
document.documentElement.appendChild(ring);
|
|
153
|
+
}
|
|
154
|
+
if (!document.getElementById("wg-ring-label")) {
|
|
155
|
+
const ringLabel = document.createElement("div");
|
|
156
|
+
ringLabel.id = "wg-ring-label";
|
|
157
|
+
document.documentElement.appendChild(ringLabel);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Re-install the overlay shell on every navigation (about:blank, goto, etc.)
|
|
162
|
+
* so the badge/panel persist outside the app's own DOM — not lost when the
|
|
163
|
+
* page is blank or replaced.
|
|
164
|
+
*/
|
|
165
|
+
export async function installPersistentPilotOverlay(context) {
|
|
166
|
+
await context.addInitScript(installPilotOverlayShell, OVERLAY_CSS);
|
|
167
|
+
}
|
|
168
|
+
/** Idempotent - safe to call before every update, matching narrate mode's own precedent. */
|
|
169
|
+
export async function ensureInstalled(page) {
|
|
170
|
+
await page.evaluate(installPilotOverlayShell, OVERLAY_CSS).catch(() => { });
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Bottom-left transient toast, separate from the persistent bottom-right
|
|
174
|
+
* badge - real, direct user request: something that visibly flags "a
|
|
175
|
+
* command is running" / "the map just changed" distinct from the
|
|
176
|
+
* always-on Checkpoint badge. Self-clearing (CSS fade after a timeout),
|
|
177
|
+
* not tied to the next `currentMenu()` snapshot the way the badge is,
|
|
178
|
+
* since some callers (rawClick/rawType/rawGoto/reloadLibrary/applyPick)
|
|
179
|
+
* only call `currentMenu()` again once the whole operation - including
|
|
180
|
+
* this toast's own lifetime - should already be over.
|
|
181
|
+
*/
|
|
182
|
+
export async function showPilotActivity(page, text) {
|
|
183
|
+
await ensureInstalled(page);
|
|
184
|
+
await page
|
|
185
|
+
.evaluate((text) => {
|
|
186
|
+
const toast = document.getElementById("wg-pilot-activity");
|
|
187
|
+
if (!toast)
|
|
188
|
+
return;
|
|
189
|
+
toast.textContent = text;
|
|
190
|
+
toast.classList.add("wg-pilot-toast-show");
|
|
191
|
+
const w = window;
|
|
192
|
+
if (w.__wgPilotToastTimer)
|
|
193
|
+
clearTimeout(w.__wgPilotToastTimer);
|
|
194
|
+
w.__wgPilotToastTimer = setTimeout(() => {
|
|
195
|
+
toast.classList.remove("wg-pilot-toast-show");
|
|
196
|
+
}, 2500);
|
|
197
|
+
}, text)
|
|
198
|
+
.catch(() => { });
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* "browser-use"-style vision box: a ring drawn around the exact element
|
|
202
|
+
* `auto dom --selector <sel>` just inspected, so a human watching a headful
|
|
203
|
+
* Pilot session can see what the agent is actually looking at, not just a
|
|
204
|
+
* JSON blob in a terminal. Real, direct user request.
|
|
205
|
+
*
|
|
206
|
+
* Reuses the real `#wg-ring`/`#wg-ring-label` elements + `WAYGRAPH_RING_CSS`
|
|
207
|
+
* (see `highlights.ts`) - the exact same visual language `cli.ts`'s own demo
|
|
208
|
+
* stepper paints rings with, not a separate look-alike. Still a purpose-built
|
|
209
|
+
* renderer here (position/show/hide only, via plain `getBoundingClientRect` -
|
|
210
|
+
* no camera zoom/spotlight/todo-dock/pacing), since that whole engine still
|
|
211
|
+
* lives in `cli.ts`, which this file continues to avoid importing (see this
|
|
212
|
+
* file's own header). Auto-fades a few real seconds after showing (or
|
|
213
|
+
* sooner if explicitly replaced/hidden first) - tuned live twice: an
|
|
214
|
+
* original 2.5s fade read as gone before it could be seen, a since-tried
|
|
215
|
+
* "stay up indefinitely" alternative read as lingering clutter instead.
|
|
216
|
+
*
|
|
217
|
+
* `tone` defaults to "auto" (gray) - real, direct user request: "gray is
|
|
218
|
+
* waygraph playwright run. orange is dom check" - a real Block run or a
|
|
219
|
+
* raw click/type/upload IS a real Playwright-driven action (`auto` was
|
|
220
|
+
* always documented as meaning exactly that), while a pure `auto dom` read
|
|
221
|
+
* touches nothing, so it gets its own "orange" tone instead.
|
|
222
|
+
*
|
|
223
|
+
* For agent-authored multi-ring / todo narration, use {@link showPilotFixtures}
|
|
224
|
+
* (`auto highlight`) instead - this vision ring is one-shot inspect feedback.
|
|
225
|
+
*/
|
|
226
|
+
export async function showPilotVision(page, selector, label, tone = "auto") {
|
|
227
|
+
await ensureInstalled(page);
|
|
228
|
+
await page
|
|
229
|
+
.evaluate(({ selector, label, tone }) => {
|
|
230
|
+
const ring = document.getElementById("wg-ring");
|
|
231
|
+
const tag = document.getElementById("wg-ring-label");
|
|
232
|
+
if (!ring || !tag)
|
|
233
|
+
return;
|
|
234
|
+
const w = window;
|
|
235
|
+
if (w.__wgVisionHideTimer)
|
|
236
|
+
clearTimeout(w.__wgVisionHideTimer);
|
|
237
|
+
const el = document.querySelector(selector);
|
|
238
|
+
if (!el) {
|
|
239
|
+
ring.style.opacity = "0";
|
|
240
|
+
tag.style.opacity = "0";
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const rect = el.getBoundingClientRect();
|
|
244
|
+
if (rect.width === 0 && rect.height === 0) {
|
|
245
|
+
ring.style.opacity = "0";
|
|
246
|
+
tag.style.opacity = "0";
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
ring.dataset.tone = tone;
|
|
250
|
+
ring.dataset.size = "md";
|
|
251
|
+
tag.dataset.tone = tone;
|
|
252
|
+
tag.dataset.size = "md";
|
|
253
|
+
tag.dataset.weight = "normal";
|
|
254
|
+
ring.style.left = `${rect.left - 3}px`;
|
|
255
|
+
ring.style.top = `${rect.top - 3}px`;
|
|
256
|
+
ring.style.width = `${rect.width + 6}px`;
|
|
257
|
+
ring.style.height = `${rect.height + 6}px`;
|
|
258
|
+
tag.textContent = label;
|
|
259
|
+
tag.style.left = `${Math.max(0, rect.left)}px`;
|
|
260
|
+
tag.style.top = `${Math.max(0, rect.top - 24)}px`;
|
|
261
|
+
ring.style.opacity = "1";
|
|
262
|
+
tag.style.opacity = "1";
|
|
263
|
+
// Real, direct user correction: this used to be a 30s "long
|
|
264
|
+
// fallback" (stay up until explicitly replaced) - after actually
|
|
265
|
+
// watching it, the user wants it to auto-clear after a few real
|
|
266
|
+
// seconds instead, not linger. Short enough to still read as "just
|
|
267
|
+
// happened", not so short it's gone before you look (that was the
|
|
268
|
+
// ORIGINAL complaint this session, at 2.5s - this is deliberately
|
|
269
|
+
// in between).
|
|
270
|
+
w.__wgVisionHideTimer = setTimeout(() => {
|
|
271
|
+
ring.style.opacity = "0";
|
|
272
|
+
tag.style.opacity = "0";
|
|
273
|
+
}, 4_000);
|
|
274
|
+
}, { selector, label, tone })
|
|
275
|
+
.catch(() => { });
|
|
276
|
+
}
|
package/dist/pilot-overlay.d.ts
CHANGED
|
@@ -1,158 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Re-install the overlay shell on every navigation (about:blank, goto, etc.)
|
|
6
|
-
* so the badge/panel persist outside the app's own DOM — not lost when the
|
|
7
|
-
* page is blank or replaced.
|
|
8
|
-
*/
|
|
9
|
-
export declare function installPersistentPilotOverlay(context: BrowserContext): Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* Bottom-left transient toast, separate from the persistent bottom-right
|
|
12
|
-
* badge - real, direct user request: something that visibly flags "a
|
|
13
|
-
* command is running" / "the map just changed" distinct from the
|
|
14
|
-
* always-on Checkpoint badge. Self-clearing (CSS fade after a timeout),
|
|
15
|
-
* not tied to the next `currentMenu()` snapshot the way the badge is,
|
|
16
|
-
* since some callers (rawClick/rawType/rawGoto/reloadLibrary/applyPick)
|
|
17
|
-
* only call `currentMenu()` again once the whole operation - including
|
|
18
|
-
* this toast's own lifetime - should already be over.
|
|
19
|
-
*/
|
|
20
|
-
export declare function showPilotActivity(page: Page, text: string): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* "browser-use"-style vision box: a ring drawn around the exact element
|
|
23
|
-
* `auto dom --selector <sel>` just inspected, so a human watching a headful
|
|
24
|
-
* Pilot session can see what the agent is actually looking at, not just a
|
|
25
|
-
* JSON blob in a terminal. Real, direct user request.
|
|
26
|
-
*
|
|
27
|
-
* Reuses the real `#wg-ring`/`#wg-ring-label` elements + `WAYGRAPH_RING_CSS`
|
|
28
|
-
* (see `highlights.ts`) - the exact same visual language `cli.ts`'s own demo
|
|
29
|
-
* stepper paints rings with, not a separate look-alike. Still a purpose-built
|
|
30
|
-
* renderer here (position/show/hide only, via plain `getBoundingClientRect` -
|
|
31
|
-
* no camera zoom/spotlight/todo-dock/pacing), since that whole engine still
|
|
32
|
-
* lives in `cli.ts`, which this file continues to avoid importing (see this
|
|
33
|
-
* file's own header). Auto-fades a few real seconds after showing (or
|
|
34
|
-
* sooner if explicitly replaced/hidden first) - tuned live twice: an
|
|
35
|
-
* original 2.5s fade read as gone before it could be seen, a since-tried
|
|
36
|
-
* "stay up indefinitely" alternative read as lingering clutter instead.
|
|
37
|
-
*
|
|
38
|
-
* `tone` defaults to "auto" (gray) - real, direct user request: "gray is
|
|
39
|
-
* waygraph playwright run. orange is dom check" - a real Block run or a
|
|
40
|
-
* raw click/type/upload IS a real Playwright-driven action (`auto` was
|
|
41
|
-
* always documented as meaning exactly that), while a pure `auto dom` read
|
|
42
|
-
* touches nothing, so it gets its own "orange" tone instead.
|
|
43
|
-
*
|
|
44
|
-
* For agent-authored multi-ring / todo narration, use {@link showPilotFixtures}
|
|
45
|
-
* (`auto highlight`) instead - this vision ring is one-shot inspect feedback.
|
|
46
|
-
*/
|
|
47
|
-
export declare function showPilotVision(page: Page, selector: string, label: string, tone?: HighlightTone): Promise<void>;
|
|
48
|
-
/** One ring the Pilot agent wants painted (same fields as demo stub rings). */
|
|
49
|
-
export type PilotFixtureRing = {
|
|
50
|
-
selector: string;
|
|
51
|
-
label: string;
|
|
52
|
-
/** Extra caption line (demo `detail`). */
|
|
53
|
-
detail?: string;
|
|
54
|
-
/** Short badge, e.g. AC / BUG / GATE. */
|
|
55
|
-
tag?: string;
|
|
56
|
-
/** Any {@link HighlightTone} or alias (`error`/`blue`/…). Normalized on paint. */
|
|
57
|
-
tone?: HighlightTone | string;
|
|
58
|
-
size?: "sm" | "md" | "lg" | string;
|
|
59
|
-
weight?: "normal" | "bold" | string;
|
|
60
|
-
/** Caption text color (CSS). Overrides tone label color when set. */
|
|
61
|
-
color?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Camera zoom while this ring is up (demo parity: scroll + zoom badge;
|
|
64
|
-
* does not CSS-scale the page). Typical `1.25`..`2`.
|
|
65
|
-
*/
|
|
66
|
-
zoom?: number;
|
|
67
|
-
/** When false, keep zoom after this paint / holdMs. Default true. */
|
|
68
|
-
zoomOut?: boolean;
|
|
69
|
-
/** Spotlight: dim the rest of the page around this target. */
|
|
70
|
-
focus?: boolean;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Agent-sent highlight fixtures for a live Pilot / auto session.
|
|
74
|
-
* Painted by {@link showPilotFixtures}; driven via IPC `op: "highlight"`.
|
|
75
|
-
* Mirrors demo stub surface: rings, todos, zoom, focus, device.
|
|
76
|
-
*/
|
|
77
|
-
export type PilotHighlightFixtures = {
|
|
78
|
-
/** Replace current fixture rings with these (empty + no todos = clear). */
|
|
79
|
-
rings?: readonly PilotFixtureRing[];
|
|
80
|
-
/** Optional floating todo list (demo-dock language, simplified). */
|
|
81
|
-
todos?: readonly string[];
|
|
82
|
-
/** 0-based index of the "current" todo row (others before it = done). */
|
|
83
|
-
todoIndex?: number;
|
|
84
|
-
/** Optional title above the todo list. */
|
|
85
|
-
todoTitle?: string;
|
|
86
|
-
/** Todo dock side. Default `right`. */
|
|
87
|
-
todoPos?: "left" | "right";
|
|
88
|
-
/**
|
|
89
|
-
* Todo-dock UX (compact / collision / behind-ring). Defaults smart-on;
|
|
90
|
-
* pass false fields to opt out. See {@link TodoDockUiOpts}.
|
|
91
|
-
*/
|
|
92
|
-
todoUi?: TodoDockUiOpts;
|
|
93
|
-
/**
|
|
94
|
-
* How long fixtures stay visible (ms). `0` = until the next highlight /
|
|
95
|
-
* clear. Default `30000` (30s) unless specified.
|
|
96
|
-
*/
|
|
97
|
-
holdMs?: number;
|
|
98
|
-
/**
|
|
99
|
-
* Camera zoom toward a selector (demo parity: scrollIntoView + zoom badge).
|
|
100
|
-
* Defaults the zoom target to {@link zoomSelector}, else the last ring's
|
|
101
|
-
* selector (or a ring that sets its own `zoom`). Cleared on `clear: true`
|
|
102
|
-
* or when holdMs expires (if zoomOut).
|
|
103
|
-
*/
|
|
104
|
-
zoom?: number;
|
|
105
|
-
/** Element to zoom toward when {@link zoom} is set (defaults to last ring). */
|
|
106
|
-
zoomSelector?: string;
|
|
107
|
-
/** When false, keep zoom after fixtures clear/expire. Default true. */
|
|
108
|
-
zoomOut?: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Viewport / device fixture (`mobile` | `tablet` | `desktop`, or a full
|
|
111
|
-
* {@link DeviceState}). Applied via Playwright `setViewportSize`.
|
|
112
|
-
*/
|
|
113
|
-
device?: DevicePreset | DeviceState;
|
|
114
|
-
/** Drop every agent fixture ring/todo/focus/zoom immediately. */
|
|
115
|
-
clear?: boolean;
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Paint (or clear) agent-authored highlight fixtures on the live page.
|
|
119
|
-
* Multi-ring + optional todo strip + zoom/focus/device - the Pilot equivalent
|
|
120
|
-
* of Block `stubBefore` narration in `waygraph demo`.
|
|
121
|
-
* Does not import `cli.ts` (see file header).
|
|
122
|
-
*/
|
|
123
|
-
export declare function showPilotFixtures(page: Page, fixtures: PilotHighlightFixtures): Promise<{
|
|
124
|
-
painted: number;
|
|
125
|
-
missing: string[];
|
|
126
|
-
}>;
|
|
127
|
-
/** Minimal shape needed to render the graph tree - matches WaygraphGraph. */
|
|
128
|
-
export interface PilotOverlayGraph {
|
|
129
|
-
nodes: readonly {
|
|
130
|
-
checkpoint: string;
|
|
131
|
-
}[];
|
|
132
|
-
edges: readonly {
|
|
133
|
-
block: string;
|
|
134
|
-
from: string;
|
|
135
|
-
to: string;
|
|
136
|
-
kind: "nav" | "action";
|
|
137
|
-
}[];
|
|
138
|
-
}
|
|
139
|
-
export interface PilotOverlayInfo {
|
|
140
|
-
sessionId: string | undefined;
|
|
141
|
-
snapshot: SessionSnapshot;
|
|
142
|
-
/**
|
|
143
|
-
* The WHOLE project's graph, not just what's reachable from the current
|
|
144
|
-
* page - real, direct user request: "i have a button where it shows all
|
|
145
|
-
* the nodes like a node tree stuff". Optional so a caller that doesn't
|
|
146
|
-
* have it handy (or doesn't want the extra payload every call) can omit
|
|
147
|
-
* it; the "All nodes" tab just shows nothing until one arrives.
|
|
148
|
-
*/
|
|
149
|
-
graph?: PilotOverlayGraph;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Refreshes the badge text and the (possibly-collapsed) panel's two tabs
|
|
153
|
-
* ("Here" - current live menu; "All nodes" - whole project graph as a
|
|
154
|
-
* tree). Never throws - a page mid-navigation when this fires is a real,
|
|
155
|
-
* expected timing case, not an error worth failing the caller's own real
|
|
156
|
-
* operation over.
|
|
157
|
-
*/
|
|
158
|
-
export declare function updatePilotOverlay(page: Page, info: PilotOverlayInfo): Promise<void>;
|
|
1
|
+
export * from "./pilot-overlay/shell.js";
|
|
2
|
+
export * from "./pilot-overlay/fixtures.js";
|
|
3
|
+
export * from "./pilot-overlay/panel.js";
|