@plitzi/sdk-dev-tools 0.38.24 → 0.39.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +162 -1
  2. package/dist/DevToolsContainer.d.ts +11 -1
  3. package/dist/DevToolsContainer.mjs +68 -62
  4. package/dist/DevToolsContextProvider.mjs +5 -3
  5. package/dist/PageContext.d.ts +7 -0
  6. package/dist/PageContext.mjs +6 -0
  7. package/dist/agentInspector/flowRuns.d.ts +1 -1
  8. package/dist/agentInspector/flowRuns.mjs +22 -15
  9. package/dist/agentInspector/index.d.ts +2 -0
  10. package/dist/agentInspector/index.mjs +1 -0
  11. package/dist/agentInspector/inspector.d.ts +31 -1
  12. package/dist/agentInspector/inspector.mjs +57 -19
  13. package/dist/agentInspector/report.d.ts +27 -2
  14. package/dist/agentInspector/report.mjs +59 -38
  15. package/dist/agentInspector/useAgentInspector.d.ts +3 -2
  16. package/dist/agentInspector/useAgentInspector.mjs +20 -16
  17. package/dist/components/DevToolsIndicator/DevToolsIndicator.mjs +47 -25
  18. package/dist/components/DevToolsIndicator/sideAt.d.ts +7 -0
  19. package/dist/components/DevToolsIndicator/sideAt.mjs +4 -0
  20. package/dist/components/DevToolsOverlay/DevToolsOverlay.d.ts +3 -4
  21. package/dist/components/DevToolsOverlay/DevToolsOverlay.mjs +4 -4
  22. package/dist/components/DevToolsPanel/DevToolsBody.d.ts +4 -1
  23. package/dist/components/DevToolsPanel/DevToolsBody.mjs +33 -31
  24. package/dist/components/DevToolsPanel/DevToolsButton.d.ts +3 -1
  25. package/dist/components/DevToolsPanel/DevToolsButton.mjs +4 -3
  26. package/dist/components/DevToolsPanel/DevToolsHeader.d.ts +3 -1
  27. package/dist/components/DevToolsPanel/DevToolsHeader.mjs +52 -34
  28. package/dist/components/DevToolsPanel/DevToolsPanel.d.ts +3 -1
  29. package/dist/components/DevToolsPanel/DevToolsPanel.mjs +50 -47
  30. package/dist/components/DevToolsPanel/tabs/QaViewer/QaReplayButton.mjs +2 -2
  31. package/dist/components/DevToolsPanel/tabs/RunViewer/RunReport.d.ts +7 -0
  32. package/dist/components/DevToolsPanel/tabs/RunViewer/RunReport.mjs +97 -0
  33. package/dist/components/DevToolsPanel/tabs/RunViewer/RunTaskRow.d.ts +6 -0
  34. package/dist/components/DevToolsPanel/tabs/RunViewer/RunTaskRow.mjs +79 -0
  35. package/dist/components/DevToolsPanel/tabs/RunViewer/RunViewer.d.ts +11 -0
  36. package/dist/components/DevToolsPanel/tabs/RunViewer/RunViewer.mjs +222 -0
  37. package/dist/components/DevToolsPanel/tabs/RunViewer/index.d.ts +3 -0
  38. package/dist/components/DevToolsPanel/tabs/RunViewer/index.mjs +6 -0
  39. package/dist/components/DevToolsPanel/tabs/RunViewer/reportHelpers.d.ts +9 -0
  40. package/dist/components/DevToolsPanel/tabs/RunViewer/reportHelpers.mjs +39 -0
  41. package/dist/components/DevToolsPanel/tabs/RunViewer/stepRecorder.d.ts +27 -0
  42. package/dist/components/DevToolsPanel/tabs/RunViewer/stepRecorder.mjs +51 -0
  43. package/dist/components/DevToolsPanel/tabs/RunViewer/usePointAt.d.ts +14 -0
  44. package/dist/components/DevToolsPanel/tabs/RunViewer/usePointAt.mjs +33 -0
  45. package/dist/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.d.ts +9 -0
  46. package/dist/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.mjs +22 -0
  47. package/dist/qa/QaContext.d.ts +2 -5
  48. package/dist/qa/QaContext.mjs +28 -31
  49. package/dist/qa/QaLayer.mjs +78 -77
  50. package/dist/qa/overlays/QaInspector.mjs +28 -27
  51. package/dist/qa/overlays/QaTabOrder.mjs +2 -2
  52. package/dist/qa/overlays/QaXrayTags.mjs +22 -22
  53. package/dist/useNarrowWindow.d.ts +8 -0
  54. package/dist/useNarrowWindow.mjs +13 -0
  55. package/package.json +4 -4
@@ -0,0 +1,222 @@
1
+ import e from "./RunReport.mjs";
2
+ import t from "./RunTaskRow.mjs";
3
+ import n from "clsx";
4
+ import { Fragment as r } from "react";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region src/components/DevToolsPanel/tabs/RunViewer/RunViewer.tsx
7
+ var o = (e) => `${e.slice(11, 16)} UTC`, s = [
8
+ {
9
+ label: "At work",
10
+ statuses: [
11
+ "in-progress",
12
+ "changes-requested",
13
+ "waiting"
14
+ ]
15
+ },
16
+ {
17
+ label: "In review",
18
+ statuses: ["in-review"]
19
+ },
20
+ {
21
+ label: "Blocked",
22
+ statuses: ["blocked", "failed"]
23
+ },
24
+ {
25
+ label: "To do",
26
+ statuses: ["ready", "pending"]
27
+ },
28
+ {
29
+ label: "Approved",
30
+ statuses: ["done"]
31
+ }
32
+ ], c = new Set(s.flatMap((e) => e.statuses)), l = {
33
+ working: "bg-sky-500",
34
+ reviewing: "bg-violet-500",
35
+ blocked: "bg-amber-500",
36
+ asking: "bg-amber-400",
37
+ waiting: "bg-sky-300",
38
+ "no-signal": "bg-red-500"
39
+ }, u = ({ title: e, count: t, children: n }) => /* @__PURE__ */ a("section", {
40
+ className: "flex min-w-0 flex-col gap-1",
41
+ children: [/* @__PURE__ */ i("h3", {
42
+ className: "text-[10px] font-semibold tracking-wider text-zinc-400 uppercase dark:text-zinc-500",
43
+ children: /* @__PURE__ */ a("span", { children: [e, t !== void 0 && /* @__PURE__ */ a("span", {
44
+ className: "ml-1 font-normal",
45
+ children: [
46
+ "(",
47
+ t,
48
+ ")"
49
+ ]
50
+ })] })
51
+ }), n]
52
+ }), d = ({ children: e }) => /* @__PURE__ */ i("div", {
53
+ className: "w-full overflow-hidden rounded border border-zinc-200 dark:border-zinc-700",
54
+ children: e
55
+ }), f = ({ agent: e }) => /* @__PURE__ */ a("div", {
56
+ className: "flex items-center gap-2 px-2 py-1",
57
+ children: [
58
+ /* @__PURE__ */ i("span", {
59
+ className: n("h-2 w-2 shrink-0 rounded-full", l[e.status] ?? "bg-zinc-300 dark:bg-zinc-600"),
60
+ title: e.status
61
+ }),
62
+ /* @__PURE__ */ i("span", {
63
+ className: "w-20 shrink-0 font-medium",
64
+ children: e.agent
65
+ }),
66
+ /* @__PURE__ */ i("span", {
67
+ className: "w-28 shrink-0 truncate text-[10px] text-zinc-400",
68
+ children: e.model ?? "harness model"
69
+ }),
70
+ /* @__PURE__ */ i("span", {
71
+ className: "min-w-0 grow truncate text-zinc-600 dark:text-zinc-300",
72
+ children: e.doing
73
+ })
74
+ ]
75
+ }), p = ({ snapshot: l }) => {
76
+ if (!l) return /* @__PURE__ */ i("div", {
77
+ className: "py-4 text-center text-xs text-zinc-400 italic dark:text-zinc-600",
78
+ children: "No run of agents behind this page: only a run's preview (npm run start:preview) has one"
79
+ });
80
+ let p = l.total === 0 ? 0 : Math.round(l.done / l.total * 100), m = [...s.map((e) => ({
81
+ label: e.label,
82
+ tasks: l.tasks.filter((t) => e.statuses.includes(t.status))
83
+ })), {
84
+ label: "Other",
85
+ tasks: l.tasks.filter((e) => !c.has(e.status))
86
+ }].filter((e) => e.tasks.length > 0), h = l.feed ?? [];
87
+ return /* @__PURE__ */ a("div", {
88
+ className: "@container flex h-full min-h-0 w-full flex-col gap-3 overflow-y-auto p-3",
89
+ children: [
90
+ /* @__PURE__ */ a("div", {
91
+ className: "flex flex-col gap-1",
92
+ children: [
93
+ /* @__PURE__ */ a("div", {
94
+ className: "flex items-baseline justify-between gap-2",
95
+ children: [/* @__PURE__ */ a("span", {
96
+ className: "truncate font-semibold",
97
+ children: [
98
+ /* @__PURE__ */ i("i", { className: "fa-solid fa-people-group mr-2 text-violet-500" }),
99
+ l.runId,
100
+ /* @__PURE__ */ i("span", {
101
+ className: "ml-2 rounded bg-zinc-100 px-1.5 py-0.5 text-[10px] font-medium text-zinc-500 uppercase dark:bg-zinc-800 dark:text-zinc-400",
102
+ children: l.status
103
+ })
104
+ ]
105
+ }), /* @__PURE__ */ a("span", {
106
+ className: "shrink-0 text-[10px] text-zinc-400",
107
+ children: ["as of ", o(l.at)]
108
+ })]
109
+ }),
110
+ /* @__PURE__ */ i("span", {
111
+ className: "text-[11px] text-zinc-500 dark:text-zinc-400",
112
+ children: l.goal
113
+ }),
114
+ /* @__PURE__ */ i("div", {
115
+ className: "h-1.5 w-full overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-700",
116
+ role: "progressbar",
117
+ "aria-valuenow": p,
118
+ "aria-valuemin": 0,
119
+ "aria-valuemax": 100,
120
+ "aria-label": "Tasks approved",
121
+ children: /* @__PURE__ */ i("div", {
122
+ className: "h-full rounded-full bg-emerald-500",
123
+ style: { width: `${String(p)}%` }
124
+ })
125
+ }),
126
+ /* @__PURE__ */ a("span", {
127
+ className: "text-[11px] text-zinc-500 dark:text-zinc-400",
128
+ children: [
129
+ l.done,
130
+ " of ",
131
+ l.total,
132
+ " tasks approved",
133
+ l.expectedEnd ? ` · expected end ${o(l.expectedEnd)}` : ""
134
+ ]
135
+ })
136
+ ]
137
+ }),
138
+ /* @__PURE__ */ i(u, {
139
+ title: "Report what you see",
140
+ children: /* @__PURE__ */ i(e, {})
141
+ }),
142
+ /* @__PURE__ */ a("div", {
143
+ className: "grid grid-cols-1 items-start gap-3 @2xl:grid-cols-2",
144
+ children: [l.tasks.length > 0 && /* @__PURE__ */ i(u, {
145
+ title: "Tasks",
146
+ count: l.tasks.length,
147
+ children: /* @__PURE__ */ i("div", {
148
+ className: "max-h-62 w-full overflow-y-auto rounded border border-zinc-200 dark:border-zinc-700",
149
+ children: m.map((e) => /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ a("div", {
150
+ className: "sticky top-0 z-10 border-b border-zinc-200 bg-zinc-50 px-2 py-0.5 text-[10px] font-semibold tracking-wider text-zinc-400 uppercase dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-500",
151
+ children: [
152
+ e.label,
153
+ " ",
154
+ /* @__PURE__ */ a("span", {
155
+ className: "font-normal",
156
+ children: [
157
+ "(",
158
+ e.tasks.length,
159
+ ")"
160
+ ]
161
+ })
162
+ ]
163
+ }), e.tasks.map((e) => /* @__PURE__ */ i(t, { task: e }, e.id))] }, e.label))
164
+ })
165
+ }), /* @__PURE__ */ a("div", {
166
+ className: "flex min-w-0 flex-col gap-3",
167
+ children: [l.agents && l.agents.length > 0 && /* @__PURE__ */ i(u, {
168
+ title: "Agents",
169
+ count: l.agents.length,
170
+ children: /* @__PURE__ */ i(d, { children: l.agents.map((e) => /* @__PURE__ */ i(f, { agent: e }, e.agent)) })
171
+ }), l.attention.length > 0 && /* @__PURE__ */ i(u, {
172
+ title: "Needs attention",
173
+ count: l.attention.length,
174
+ children: /* @__PURE__ */ i("div", {
175
+ className: "flex max-h-48 flex-col gap-1 overflow-y-auto pr-1",
176
+ children: l.attention.map((e) => /* @__PURE__ */ i("span", {
177
+ className: "shrink-0 rounded-r border-l-2 border-amber-500 bg-amber-50 px-2 py-1 text-[11px] break-words text-amber-800 dark:bg-amber-950/40 dark:text-amber-300",
178
+ children: e.text
179
+ }, e.text))
180
+ })
181
+ })]
182
+ })]
183
+ }),
184
+ h.length > 0 && /* @__PURE__ */ a("section", {
185
+ className: "flex min-h-32 flex-1 flex-col gap-1",
186
+ children: [/* @__PURE__ */ a("h3", {
187
+ className: "text-[10px] font-semibold tracking-wider text-zinc-400 uppercase dark:text-zinc-500",
188
+ children: ["Activity ", /* @__PURE__ */ a("span", {
189
+ className: "ml-1 font-normal",
190
+ children: [
191
+ "(",
192
+ h.length,
193
+ ")"
194
+ ]
195
+ })]
196
+ }), /* @__PURE__ */ i("div", {
197
+ className: "flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto rounded border border-zinc-200 p-1.5 dark:border-zinc-700",
198
+ children: h.map((e) => /* @__PURE__ */ a("div", {
199
+ className: "flex gap-2 text-[11px]",
200
+ children: [
201
+ /* @__PURE__ */ i("span", {
202
+ className: "shrink-0 text-zinc-400",
203
+ children: e.at.slice(11, 16)
204
+ }),
205
+ /* @__PURE__ */ i("span", {
206
+ className: "w-24 shrink-0 truncate font-medium",
207
+ children: e.by
208
+ }),
209
+ /* @__PURE__ */ i("span", {
210
+ className: n("min-w-0 grow", e.kind === "problem" ? "text-red-600 dark:text-red-400" : "text-zinc-600 dark:text-zinc-300"),
211
+ title: e.detail,
212
+ children: e.text
213
+ })
214
+ ]
215
+ }, `${e.at}-${e.by}-${e.text}`))
216
+ })]
217
+ })
218
+ ]
219
+ });
220
+ };
221
+ //#endregion
222
+ export { p as default };
@@ -0,0 +1,3 @@
1
+ import { default as RunViewer } from './RunViewer';
2
+ export { default as useRunSnapshot } from './useRunSnapshot';
3
+ export default RunViewer;
@@ -0,0 +1,6 @@
1
+ import e from "./RunViewer.mjs";
2
+ import t from "./useRunSnapshot.mjs";
3
+ //#region src/components/DevToolsPanel/tabs/RunViewer/index.ts
4
+ var n = e;
5
+ //#endregion
6
+ export { n as default, t as useRunSnapshot };
@@ -0,0 +1,9 @@
1
+ import { RunReport } from '@plitzi/sdk-shared/runs';
2
+ /** What the person reports, as the page is now: where, how wide, which theme, what they pointed at and did. */
3
+ export declare const reportOf: (text: string, element: string | undefined, scheme: "light" | "dark", page: HTMLElement | null) => RunReport;
4
+ /** Sent to the preview's server: its note when kept, or why not — its own words, or the request's failure. */
5
+ export declare const sendReport: (report: RunReport) => Promise<{
6
+ sent: string;
7
+ } | {
8
+ failed: string;
9
+ }>;
@@ -0,0 +1,39 @@
1
+ import { recordedSteps as e } from "./stepRecorder.mjs";
2
+ import { isRecord as t } from "@plitzi/sdk-shared/helpers";
3
+ import { RUN_REPORT_PATH as n } from "@plitzi/sdk-shared/runs";
4
+ //#region src/components/DevToolsPanel/tabs/RunViewer/reportHelpers.ts
5
+ var r = (e) => {
6
+ let t = e ? Math.round(e.getBoundingClientRect().width) : void 0;
7
+ return t !== void 0 && t > 0 && Math.abs(t - window.innerWidth) > 1 ? t : void 0;
8
+ }, i = (t, n, i, a) => {
9
+ let { steps: o, earlier: s, from: c } = e(), l = r(a), u = `${window.location.pathname}${window.location.search}`;
10
+ return {
11
+ text: t.trim(),
12
+ path: c,
13
+ ...u === c ? {} : { seenOn: u },
14
+ width: window.innerWidth,
15
+ height: window.innerHeight,
16
+ ...l === void 0 ? {} : { pageWidth: l },
17
+ scheme: i,
18
+ ...n ? { element: n } : {},
19
+ steps: o,
20
+ ...s > 0 ? { earlier: s } : {},
21
+ at: (/* @__PURE__ */ new Date()).toISOString()
22
+ };
23
+ }, a = async (e) => {
24
+ try {
25
+ let r = await fetch(n, {
26
+ method: "POST",
27
+ headers: { "Content-Type": "application/json" },
28
+ body: JSON.stringify(e)
29
+ }), i = await r.json().catch(() => void 0), a = (e) => {
30
+ let n = t(i) ? i[e] : void 0;
31
+ return typeof n == "string" ? n : void 0;
32
+ };
33
+ return r.ok ? { sent: a("note") ?? "Sent to the run’s lead" } : { failed: a("error") ?? `The preview answered ${String(r.status)}` };
34
+ } catch (e) {
35
+ return { failed: `The preview did not answer: ${e instanceof Error ? e.message : String(e)}` };
36
+ }
37
+ };
38
+ //#endregion
39
+ export { i as reportOf, a as sendReport };
@@ -0,0 +1,27 @@
1
+ import { RunReportStep } from '@plitzi/sdk-shared/runs';
2
+ /**
3
+ * Runs in the page: an element as a step names it — its id, and which copy a list draws when it draws more than one
4
+ * (`bin-bar:3`) — or none, when it is no element of the space. A press is named by the control it went to (`pressed`):
5
+ * a click on a button's label read `layer-quakes-label`, where the person pressed `layer-quakes`.
6
+ */
7
+ export declare const elementName: (node: EventTarget | null, pressed?: boolean) => string | undefined;
8
+ export declare const recordClick: (event: Event) => void;
9
+ /** What a field holds once typed in, one step a field: typing on in it changes the step, never adds one a key. */
10
+ export declare const recordInput: (event: Event) => void;
11
+ /**
12
+ * What was kept so far, oldest first, how many earlier steps were left out, and the address they play again from —
13
+ * where the first was taken (a link pressed moves the page on): the page as it is now when none was.
14
+ */
15
+ export declare const recordedSteps: () => {
16
+ steps: RunReportStep[];
17
+ earlier: number;
18
+ from: string;
19
+ };
20
+ /**
21
+ * Starts again from nothing: what a report sent was made of is not said twice — and the browser's back or forward
22
+ * moved the page where no press took it, so the steps kept no longer play to it.
23
+ */
24
+ export declare const clearRecordedSteps: () => void;
25
+ /** Keeps what the person does on the page while `on` — a run's preview only. */
26
+ declare const useStepRecorder: (on: boolean) => void;
27
+ export default useStepRecorder;
@@ -0,0 +1,51 @@
1
+ import { useEffect as e } from "react";
2
+ import { DEV_TOOLS_ATTRIBUTE as t } from "@plitzi/sdk-shared/devTools";
3
+ import { RUN_REPORT_STEPS_MOST as n } from "@plitzi/sdk-shared/runs";
4
+ //#region src/components/DevToolsPanel/tabs/RunViewer/stepRecorder.ts
5
+ var r = [], i = 0, a = () => `${window.location.pathname}${window.location.search}`, o = "button, a[href], input, select, textarea, summary, label, [role=\"button\"], [role=\"tab\"], [role=\"link\"]", s = (e, t = !1) => {
6
+ let n = e instanceof Element && t ? e.closest(o) ?? e : e, r = n instanceof Element ? n.closest("[data-plitzi-el]") : null, i = r?.getAttribute("data-plitzi-el");
7
+ if (!r || !i) return;
8
+ let a = Array.from(document.querySelectorAll(`[data-plitzi-el="${CSS.escape(i)}"]`));
9
+ return a.length > 1 ? `${i}:${String(a.indexOf(r) + 1)}` : i;
10
+ }, c = (e) => e instanceof Element && e.closest(`[${t}]`) !== null, l = (e) => {
11
+ r = [...r, {
12
+ step: e,
13
+ path: a()
14
+ }], r.length > n && (i += r.length - n, r = r.slice(-n));
15
+ }, u = (e) => {
16
+ let t = c(e.target) ? void 0 : s(e.target, !0);
17
+ t && l({
18
+ kind: "click",
19
+ element: t
20
+ });
21
+ }, d = (e) => {
22
+ let t = e.target, n = c(t) ? void 0 : s(t);
23
+ if (!n || !(t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement)) return;
24
+ let i = t instanceof HTMLInputElement && t.type === "password" ? {
25
+ kind: "type",
26
+ element: n,
27
+ secret: !0
28
+ } : {
29
+ kind: "type",
30
+ element: n,
31
+ text: t.value
32
+ }, a = r.at(-1);
33
+ a?.step.kind === "type" && a.step.element === n ? r = [...r.slice(0, -1), {
34
+ ...a,
35
+ step: i
36
+ }] : l(i);
37
+ }, f = () => ({
38
+ steps: r.map((e) => e.step),
39
+ earlier: i,
40
+ from: r.at(0)?.path ?? a()
41
+ }), p = () => {
42
+ r = [], i = 0;
43
+ }, m = (t) => {
44
+ e(() => {
45
+ if (t && typeof document < "u") return document.addEventListener("click", u, !0), document.addEventListener("input", d, !0), window.addEventListener("popstate", p), () => {
46
+ document.removeEventListener("click", u, !0), document.removeEventListener("input", d, !0), window.removeEventListener("popstate", p);
47
+ };
48
+ }, [t]);
49
+ };
50
+ //#endregion
51
+ export { p as clearRecordedSteps, m as default, s as elementName, u as recordClick, d as recordInput, f as recordedSteps };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The element the person points at on the page, for a report: the next click on the page picks it — taken before the
3
+ * page sees it, so it neither presses anything nor counts as a step — and Escape stops pointing. A click in the dev
4
+ * tools is theirs, and goes on.
5
+ */
6
+ declare const usePointAt: () => {
7
+ pointing: boolean;
8
+ element?: string;
9
+ /** The last click was on nothing of the space's — the page's margin, a plugin's own drawing: said, not taken. */
10
+ missed: boolean;
11
+ point: () => void;
12
+ forget: () => void;
13
+ };
14
+ export default usePointAt;
@@ -0,0 +1,33 @@
1
+ import { elementName as e } from "./stepRecorder.mjs";
2
+ import { useCallback as t, useEffect as n, useState as r } from "react";
3
+ import { DEV_TOOLS_ATTRIBUTE as i } from "@plitzi/sdk-shared/devTools";
4
+ //#region src/components/DevToolsPanel/tabs/RunViewer/usePointAt.ts
5
+ var a = () => {
6
+ let [a, o] = r(!1), [s, c] = r(), [l, u] = r(!1);
7
+ return n(() => {
8
+ if (!a) return;
9
+ let t = (t) => {
10
+ if (t.target instanceof Element && t.target.closest(`[${i}]`)) return;
11
+ t.preventDefault(), t.stopPropagation();
12
+ let n = e(t.target);
13
+ c(n), u(n === void 0), o(!1);
14
+ }, n = (e) => {
15
+ e.key === "Escape" && o(!1);
16
+ };
17
+ return window.addEventListener("click", t, !0), window.addEventListener("keydown", n, !0), document.body.style.cursor = "crosshair", () => {
18
+ window.removeEventListener("click", t, !0), window.removeEventListener("keydown", n, !0), document.body.style.cursor = "";
19
+ };
20
+ }, [a]), {
21
+ pointing: a,
22
+ element: s,
23
+ missed: l,
24
+ point: t(() => {
25
+ u(!1), o(!0);
26
+ }, []),
27
+ forget: t(() => {
28
+ c(void 0), u(!1);
29
+ }, [])
30
+ };
31
+ };
32
+ //#endregion
33
+ export { a as default };
@@ -0,0 +1,9 @@
1
+ import { RunSnapshot } from '@plitzi/sdk-shared/runs';
2
+ /**
3
+ * The run of agents this page's server previews (`plitzi run preview`), as the CLI keeps it — asked for only when the
4
+ * server said it previews one (`previews`): any other server has no run, and asking it every few seconds left a 404 in
5
+ * the page's console each time. The Run tab is offered from the first run read, and stays: a run that finished, or a
6
+ * preview that stopped answering, leaves the last one read — never a tab that vanishes while it is read.
7
+ */
8
+ declare const useRunSnapshot: (previews: boolean) => RunSnapshot | undefined;
9
+ export default useRunSnapshot;
@@ -0,0 +1,22 @@
1
+ import { useEffect as e, useState as t } from "react";
2
+ import { RUN_STATUS_PATH as n, isRunSnapshot as r } from "@plitzi/sdk-shared/runs";
3
+ //#region src/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.ts
4
+ var i = 3e3, a = (a) => {
5
+ let [o, s] = t();
6
+ return e(() => {
7
+ if (!a || typeof window > "u") return;
8
+ let e = !1, t = async () => {
9
+ try {
10
+ let t = await fetch(n, { cache: "no-store" }), i = t.ok ? await t.json() : void 0;
11
+ !e && r(i) && s(i);
12
+ } catch {}
13
+ };
14
+ t();
15
+ let o = window.setInterval(() => void t(), i);
16
+ return () => {
17
+ e = !0, window.clearInterval(o);
18
+ };
19
+ }, [a]), o;
20
+ };
21
+ //#endregion
22
+ export { a as default };
@@ -1,7 +1,7 @@
1
1
  import { QaFindings } from './findings';
2
2
  import { QaCheck, QaSettings } from './qaSettings';
3
3
  import { XrayCounts } from './xray';
4
- import { ReactNode, RefObject } from 'react';
4
+ import { ReactNode } from 'react';
5
5
  export interface QaContextValue {
6
6
  settings: QaSettings;
7
7
  setSetting: <K extends Exclude<keyof QaSettings, 'checks'>>(key: K, value: QaSettings[K]) => void;
@@ -15,8 +15,6 @@ export interface QaContextValue {
15
15
  /** Bumped to make the checks look again. */
16
16
  round: number;
17
17
  rescan: () => void;
18
- /** The page's own box: what the tools draw over and what the checks look in — never the panel. */
19
- pageRef: RefObject<HTMLElement | null>;
20
18
  /** The element the inspector was clicked on, kept in the tab until another is. */
21
19
  pinned: Element | undefined;
22
20
  setPinned: (element: Element | undefined) => void;
@@ -24,10 +22,9 @@ export interface QaContextValue {
24
22
  declare const QaContext: import('react').Context<QaContextValue>;
25
23
  export type QaProviderProps = {
26
24
  children?: ReactNode;
27
- pageRef: RefObject<HTMLElement | null>;
28
25
  /** The panel is folded away: what works on the page's own clicks and marks its elements stops with it. */
29
26
  collapsed: boolean;
30
27
  };
31
28
  /** The QA tab's settings, kept in this browser, and what its checks found — shared by the tab and the layer. */
32
- export declare const QaProvider: ({ children, pageRef, collapsed }: QaProviderProps) => import('react').JSX.Element;
29
+ export declare const QaProvider: ({ children, collapsed }: QaProviderProps) => import('react').JSX.Element;
33
30
  export default QaContext;
@@ -15,63 +15,60 @@ var u = i({
15
15
  setXrayCounts: () => void 0,
16
16
  round: 0,
17
17
  rescan: () => void 0,
18
- pageRef: { current: null },
19
18
  pinned: void 0,
20
19
  setPinned: () => void 0
21
20
  });
22
21
  u.displayName = "QaContext";
23
- var d = ({ children: i, pageRef: d, collapsed: f }) => {
24
- let [p, m] = r("plitzi-sdk-dev-tools-qa", t), [h, g] = c(e), [_, v] = c(n), [y, b] = c(0), [x, S] = c(), C = s(() => ({
22
+ var d = ({ children: i, collapsed: d }) => {
23
+ let [f, p] = r("plitzi-sdk-dev-tools-qa", t), [m, h] = c(e), [g, _] = c(n), [v, y] = c(0), [b, x] = c(), S = s(() => ({
25
24
  ...t,
26
- ...p,
25
+ ...f,
27
26
  checks: {
28
27
  ...t.checks,
29
- ...p.checks
28
+ ...f.checks
30
29
  }
31
- }), [p]), w = a((e, t) => m((n) => ({
30
+ }), [f]), C = a((e, t) => p((n) => ({
32
31
  ...n,
33
32
  [e]: t
34
- })), [m]), T = a((e, n) => m((r) => ({
33
+ })), [p]), w = a((e, n) => p((r) => ({
35
34
  ...r,
36
35
  checks: {
37
36
  ...t.checks,
38
37
  ...r.checks,
39
38
  [e]: n
40
39
  }
41
- })), [m]), E = a(() => b((e) => e + 1), []);
40
+ })), [p]), T = a(() => y((e) => e + 1), []);
42
41
  o(() => {
43
- f && (m((e) => ({
42
+ d && (p((e) => ({
44
43
  ...e,
45
44
  inspect: !1,
46
45
  checks: t.checks
47
- })), S(void 0));
48
- }, [f, m]);
49
- let D = s(() => ({
50
- settings: C,
51
- setSetting: w,
52
- setCheck: T,
53
- findings: h,
54
- setFindings: g,
55
- xrayCounts: _,
56
- setXrayCounts: v,
57
- round: y,
58
- rescan: E,
59
- pageRef: d,
60
- pinned: x,
61
- setPinned: S
46
+ })), x(void 0));
47
+ }, [d, p]);
48
+ let E = s(() => ({
49
+ settings: S,
50
+ setSetting: C,
51
+ setCheck: w,
52
+ findings: m,
53
+ setFindings: h,
54
+ xrayCounts: g,
55
+ setXrayCounts: _,
56
+ round: v,
57
+ rescan: T,
58
+ pinned: b,
59
+ setPinned: x
62
60
  }), [
61
+ S,
63
62
  C,
64
63
  w,
64
+ m,
65
+ g,
66
+ v,
65
67
  T,
66
- h,
67
- _,
68
- y,
69
- E,
70
- d,
71
- x
68
+ b
72
69
  ]);
73
70
  return /* @__PURE__ */ l(u, {
74
- value: D,
71
+ value: E,
75
72
  children: i
76
73
  });
77
74
  };