@plitzi/sdk-dev-tools 0.38.23 → 0.39.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +172 -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/DevToolsOverlay/DevToolsOverlay.d.ts +3 -4
  18. package/dist/components/DevToolsOverlay/DevToolsOverlay.mjs +4 -4
  19. package/dist/components/DevToolsPanel/DevToolsBody.d.ts +4 -1
  20. package/dist/components/DevToolsPanel/DevToolsBody.mjs +33 -31
  21. package/dist/components/DevToolsPanel/DevToolsButton.d.ts +3 -1
  22. package/dist/components/DevToolsPanel/DevToolsButton.mjs +4 -3
  23. package/dist/components/DevToolsPanel/DevToolsHeader.d.ts +3 -1
  24. package/dist/components/DevToolsPanel/DevToolsHeader.mjs +52 -34
  25. package/dist/components/DevToolsPanel/DevToolsPanel.d.ts +3 -1
  26. package/dist/components/DevToolsPanel/DevToolsPanel.mjs +50 -47
  27. package/dist/components/DevToolsPanel/tabs/QaViewer/QaReplayButton.mjs +2 -2
  28. package/dist/components/DevToolsPanel/tabs/RunViewer/RunReport.d.ts +7 -0
  29. package/dist/components/DevToolsPanel/tabs/RunViewer/RunReport.mjs +97 -0
  30. package/dist/components/DevToolsPanel/tabs/RunViewer/RunTaskRow.d.ts +6 -0
  31. package/dist/components/DevToolsPanel/tabs/RunViewer/RunTaskRow.mjs +79 -0
  32. package/dist/components/DevToolsPanel/tabs/RunViewer/RunViewer.d.ts +11 -0
  33. package/dist/components/DevToolsPanel/tabs/RunViewer/RunViewer.mjs +222 -0
  34. package/dist/components/DevToolsPanel/tabs/RunViewer/index.d.ts +3 -0
  35. package/dist/components/DevToolsPanel/tabs/RunViewer/index.mjs +6 -0
  36. package/dist/components/DevToolsPanel/tabs/RunViewer/reportHelpers.d.ts +9 -0
  37. package/dist/components/DevToolsPanel/tabs/RunViewer/reportHelpers.mjs +39 -0
  38. package/dist/components/DevToolsPanel/tabs/RunViewer/stepRecorder.d.ts +27 -0
  39. package/dist/components/DevToolsPanel/tabs/RunViewer/stepRecorder.mjs +51 -0
  40. package/dist/components/DevToolsPanel/tabs/RunViewer/usePointAt.d.ts +14 -0
  41. package/dist/components/DevToolsPanel/tabs/RunViewer/usePointAt.mjs +33 -0
  42. package/dist/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.d.ts +9 -0
  43. package/dist/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.mjs +22 -0
  44. package/dist/qa/QaContext.d.ts +2 -5
  45. package/dist/qa/QaContext.mjs +28 -31
  46. package/dist/qa/QaLayer.mjs +78 -77
  47. package/dist/qa/overlays/QaInspector.mjs +28 -27
  48. package/dist/qa/overlays/QaTabOrder.mjs +2 -2
  49. package/dist/qa/overlays/QaXrayTags.mjs +22 -22
  50. package/dist/useNarrowWindow.d.ts +8 -0
  51. package/dist/useNarrowWindow.mjs +13 -0
  52. package/package.json +4 -4
@@ -1,62 +1,65 @@
1
- import e from "./DevToolsBody.mjs";
2
- import t from "./DevToolsHeader.mjs";
3
- import n from "./DevToolsSubHeader.mjs";
4
- import r from "@plitzi/plitzi-ui/hooks/useStorage";
5
- import i from "clsx";
6
- import { useCallback as a, useMemo as o, useRef as s, useState as c } from "react";
7
- import { DEV_TOOLS_ATTRIBUTE as l } from "@plitzi/sdk-shared/devTools";
8
- import { useCommonStore as u } from "@plitzi/sdk-shared/store";
9
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
- import p from "@plitzi/plitzi-ui/ContainerResizable";
1
+ import e from "./tabs/RunViewer/useRunSnapshot.mjs";
2
+ import t from "./DevToolsBody.mjs";
3
+ import n from "./DevToolsHeader.mjs";
4
+ import r from "./DevToolsSubHeader.mjs";
5
+ import i from "@plitzi/plitzi-ui/hooks/useStorage";
6
+ import a from "clsx";
7
+ import { useCallback as o, useMemo as s, useRef as c, useState as l } from "react";
8
+ import { DEV_TOOLS_ATTRIBUTE as u } from "@plitzi/sdk-shared/devTools";
9
+ import { useCommonStore as d } from "@plitzi/sdk-shared/store";
10
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
11
+ import m from "@plitzi/plitzi-ui/ContainerResizable";
11
12
  //#region src/components/DevToolsPanel/DevToolsPanel.tsx
12
- var m = "vertical", h = "horizontal", g = ({ className: m, orientation: h = "vertical", tabSelected: g, logTypeFilter: _, onCollapse: v, onTabSelect: y, onChangeOrientation: b, qa: x = !1 }) => {
13
- let [S, C] = r("plitzi-sdk.dev-tools.size", {
13
+ var h = "vertical", g = "horizontal", _ = ({ className: h, orientation: g = "vertical", tabSelected: _, logTypeFilter: v, onCollapse: y, onTabSelect: b, onChangeOrientation: x, qa: S = !1, run: C = !1 }) => {
14
+ let [w, T] = i("plitzi-sdk.dev-tools.size", {
14
15
  width: 500,
15
16
  height: 200
16
- }), [w] = u("navigation.currentPageId"), [T, E] = c(), D = o(() => h === "vertical" ? ["w"] : ["n"], [h]), O = s(typeof document < "u" ? document.querySelector(".plitzi-sdk") : null), k = a((e) => E(e), [E]), A = a((e, t) => C((n) => ({
17
+ }), [E] = d("navigation.currentPageId"), [D, O] = l(), k = e(C), A = _ === "run" && k === void 0 || _ === "qa" && !S ? "logs" : _, j = s(() => g === "vertical" ? ["w"] : ["n"], [g]), M = c(typeof document < "u" ? document.querySelector(".plitzi-sdk") : null), N = o((e) => O(e), [O]), P = o((e, t) => T((n) => ({
17
18
  width: Number.isFinite(e) ? e : n.width,
18
19
  height: Number.isFinite(t) ? t : n.height
19
- })), [C]);
20
- return /* @__PURE__ */ d(p, {
21
- className: i("component__container-resizable-sidebar relative z-[1000000] text-xs", m, { "h-full": h === "vertical" }),
22
- minConstraintsX: h === "vertical" ? 500 : Infinity,
23
- maxConstraintsX: h === "vertical" ? 1e3 : Infinity,
24
- minConstraintsY: h === "vertical" ? Infinity : 34,
25
- maxConstraintsY: h === "vertical" ? Infinity : 600,
26
- width: h === "vertical" ? S.width : Infinity,
27
- height: h === "vertical" ? Infinity : S.height,
28
- resizeHandles: D,
29
- parentRef: O,
20
+ })), [T]);
21
+ return /* @__PURE__ */ f(m, {
22
+ className: a("component__container-resizable-sidebar relative z-[1000000] text-xs", h, { "h-full": g === "vertical" }),
23
+ minConstraintsX: g === "vertical" ? 500 : Infinity,
24
+ maxConstraintsX: g === "vertical" ? 1e3 : Infinity,
25
+ minConstraintsY: g === "vertical" ? Infinity : 34,
26
+ maxConstraintsY: g === "vertical" ? Infinity : 600,
27
+ width: g === "vertical" ? w.width : Infinity,
28
+ height: g === "vertical" ? Infinity : w.height,
29
+ resizeHandles: j,
30
+ parentRef: M,
30
31
  autoGrow: !1,
31
- onChange: A,
32
- children: /* @__PURE__ */ f("div", {
33
- className: "flex h-full w-full flex-col bg-white text-zinc-800 dark:bg-zinc-900 dark:text-zinc-200",
34
- [l]: "",
32
+ onChange: P,
33
+ children: /* @__PURE__ */ p("div", {
34
+ className: "flex h-full min-h-0 w-full flex-col overflow-hidden bg-white text-zinc-800 dark:bg-zinc-900 dark:text-zinc-200",
35
+ [u]: "",
35
36
  children: [
36
- /* @__PURE__ */ d(t, {
37
- orientation: h,
38
- onChangeOrientation: b,
39
- onCollapse: v,
40
- onTabSelect: y,
41
- tabSelected: g,
42
- qa: x
37
+ /* @__PURE__ */ f(n, {
38
+ orientation: g,
39
+ onChangeOrientation: x,
40
+ onCollapse: y,
41
+ onTabSelect: b,
42
+ tabSelected: A,
43
+ qa: S,
44
+ run: k !== void 0
43
45
  }),
44
- ["store", "elements"].includes(g) && /* @__PURE__ */ d(n, {
45
- elementSelected: T,
46
- onSelectElement: k,
47
- currentPageId: w
46
+ ["store", "elements"].includes(A) && /* @__PURE__ */ f(r, {
47
+ elementSelected: D,
48
+ onSelectElement: N,
49
+ currentPageId: E
48
50
  }),
49
- /* @__PURE__ */ d(e, {
50
- orientation: h,
51
- tabSelected: g,
52
- logTypeFilter: _,
53
- elementSelected: T,
54
- onSelectElement: k,
55
- qa: x
51
+ /* @__PURE__ */ f(t, {
52
+ orientation: g,
53
+ tabSelected: A,
54
+ logTypeFilter: v,
55
+ elementSelected: D,
56
+ onSelectElement: N,
57
+ qa: S,
58
+ run: k
56
59
  })
57
60
  ]
58
61
  })
59
62
  });
60
63
  };
61
64
  //#endregion
62
- export { h as ORIENTATION_HORIZONTAL, m as ORIENTATION_VERTICAL, g as default };
65
+ export { g as ORIENTATION_HORIZONTAL, h as ORIENTATION_VERTICAL, _ as default };
@@ -1,10 +1,10 @@
1
- import e from "../../../../qa/QaContext.mjs";
1
+ import e from "../../../../PageContext.mjs";
2
2
  import { use as t, useCallback as n } from "react";
3
3
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
4
  import { isMotionAnimation as a } from "@plitzi/sdk-shared/schema";
5
5
  //#region src/components/DevToolsPanel/tabs/QaViewer/QaReplayButton.tsx
6
6
  var o = () => {
7
- let { pageRef: o } = t(e), s = n(() => {
7
+ let o = t(e), s = n(() => {
8
8
  o.current?.getAnimations({ subtree: !0 }).filter(a).forEach((e) => {
9
9
  e.cancel(), e.play();
10
10
  });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A bug the person sees on the preview, handed to the run's lead as it is: they point at the element and say what is
3
+ * wrong; the address, the window, the theme and what they did since the page loaded go with it, and the lead gets the
4
+ * command that plays it again. Nothing of it is sent until they press Send.
5
+ */
6
+ declare const RunReport: () => import('react').JSX.Element;
7
+ export default RunReport;
@@ -0,0 +1,97 @@
1
+ import { clearRecordedSteps as e } from "./stepRecorder.mjs";
2
+ import t from "../../../../PageContext.mjs";
3
+ import { reportOf as n, sendReport as r } from "./reportHelpers.mjs";
4
+ import i from "./usePointAt.mjs";
5
+ import a from "clsx";
6
+ import { use as o, useCallback as s, useState as c } from "react";
7
+ import { useTheme as l } from "@plitzi/sdk-shared/theme";
8
+ import { RUN_REPORT_TEXT_MOST as u } from "@plitzi/sdk-shared/runs";
9
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
+ //#region src/components/DevToolsPanel/tabs/RunViewer/RunReport.tsx
11
+ var p = () => {
12
+ let { resolvedTheme: p } = l(), m = o(t), { pointing: h, element: g, missed: _, point: v, forget: y } = i(), [b, x] = c(""), [S, C] = c({ kind: "idle" }), w = s((e) => x(e.target.value), []), T = s(async () => {
13
+ C({ kind: "sending" });
14
+ let t = await r(n(b, g, p === "dark" ? "dark" : "light", m.current));
15
+ "failed" in t ? C({
16
+ kind: "failed",
17
+ why: t.failed
18
+ }) : (e(), x(""), y(), C({
19
+ kind: "sent",
20
+ note: t.sent
21
+ }));
22
+ }, [
23
+ b,
24
+ g,
25
+ p,
26
+ m,
27
+ y
28
+ ]), E = s(() => void T(), [T]);
29
+ return /* @__PURE__ */ f("div", {
30
+ className: "flex flex-col gap-1.5",
31
+ children: [
32
+ /* @__PURE__ */ f("div", {
33
+ className: "flex flex-wrap items-center gap-1.5",
34
+ children: [
35
+ /* @__PURE__ */ f("button", {
36
+ type: "button",
37
+ onClick: v,
38
+ "aria-pressed": h,
39
+ className: a("flex h-6 items-center gap-1 rounded px-2 text-xs font-medium transition-colors", {
40
+ "bg-violet-500 text-white": h,
41
+ "text-zinc-600 hover:bg-zinc-200 dark:text-zinc-300 dark:hover:bg-zinc-700": !h
42
+ }),
43
+ children: [/* @__PURE__ */ d("i", { className: "fa-solid fa-crosshairs" }), "Point at it"]
44
+ }),
45
+ h && /* @__PURE__ */ d("span", {
46
+ className: "text-[11px] text-zinc-500 dark:text-zinc-400",
47
+ children: "Click the element on the page — Esc stops"
48
+ }),
49
+ !h && g && /* @__PURE__ */ f("span", {
50
+ className: "flex items-center gap-1 rounded bg-zinc-100 px-1.5 py-0.5 font-mono text-[11px] dark:bg-zinc-800",
51
+ children: [g, /* @__PURE__ */ d("button", {
52
+ type: "button",
53
+ onClick: y,
54
+ title: "Point at nothing",
55
+ className: "text-zinc-400 hover:text-zinc-600",
56
+ children: /* @__PURE__ */ d("i", { className: "fa-solid fa-xmark" })
57
+ })]
58
+ }),
59
+ !h && _ && /* @__PURE__ */ d("span", {
60
+ className: "text-[11px] text-amber-700 dark:text-amber-300",
61
+ children: "That is nothing of the page’s own: point at another, or send it for the page as a whole"
62
+ })
63
+ ]
64
+ }),
65
+ /* @__PURE__ */ d("textarea", {
66
+ value: b,
67
+ onChange: w,
68
+ maxLength: u,
69
+ rows: 2,
70
+ placeholder: "What is wrong — sent with where you are, the width and what you did on the page",
71
+ className: "w-full resize-y rounded border border-zinc-200 bg-white px-1.5 py-1 text-zinc-700 outline-none placeholder:text-zinc-400 focus:border-violet-400 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100 dark:placeholder:text-zinc-500"
72
+ }),
73
+ /* @__PURE__ */ f("div", {
74
+ className: "flex flex-wrap items-center gap-2",
75
+ children: [
76
+ /* @__PURE__ */ f("button", {
77
+ type: "button",
78
+ onClick: E,
79
+ disabled: b.trim() === "" || S.kind === "sending",
80
+ className: "flex h-6 items-center gap-1 rounded bg-violet-500 px-2 text-xs font-medium text-white hover:bg-violet-600 disabled:opacity-50",
81
+ children: [/* @__PURE__ */ d("i", { className: "fa-solid fa-paper-plane" }), "Send to the lead"]
82
+ }),
83
+ S.kind === "sent" && /* @__PURE__ */ d("span", {
84
+ className: "text-[11px] text-emerald-700 dark:text-emerald-400",
85
+ children: S.note
86
+ }),
87
+ S.kind === "failed" && /* @__PURE__ */ f("span", {
88
+ className: "text-[11px] text-red-600 dark:text-red-400",
89
+ children: ["Not sent: ", S.why]
90
+ })
91
+ ]
92
+ })
93
+ ]
94
+ });
95
+ };
96
+ //#endregion
97
+ export { p as default };
@@ -0,0 +1,6 @@
1
+ import { RunSnapshotTask } from '@plitzi/sdk-shared/runs';
2
+ /** One task of the run: its state, who has it, how far, why it waits — and, opened, the files it writes. */
3
+ declare const RunTaskRow: ({ task }: {
4
+ task: RunSnapshotTask;
5
+ }) => import('react').JSX.Element;
6
+ export default RunTaskRow;
@@ -0,0 +1,79 @@
1
+ import e from "clsx";
2
+ import { useCallback as t, useState as n } from "react";
3
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ //#region src/components/DevToolsPanel/tabs/RunViewer/RunTaskRow.tsx
5
+ var a = {
6
+ pending: "fa-regular fa-circle",
7
+ ready: "fa-regular fa-circle-dot",
8
+ "in-progress": "fa-solid fa-play",
9
+ waiting: "fa-solid fa-hourglass-half",
10
+ "in-review": "fa-solid fa-magnifying-glass",
11
+ "changes-requested": "fa-solid fa-rotate-left",
12
+ done: "fa-solid fa-check",
13
+ blocked: "fa-solid fa-ban",
14
+ failed: "fa-solid fa-xmark"
15
+ }, o = {
16
+ done: "text-emerald-600 dark:text-emerald-400",
17
+ "in-review": "text-violet-600 dark:text-violet-400",
18
+ "in-progress": "text-sky-600 dark:text-sky-400",
19
+ "changes-requested": "text-amber-600 dark:text-amber-400",
20
+ blocked: "text-red-600 dark:text-red-400",
21
+ failed: "text-red-600 dark:text-red-400"
22
+ }, s = (e) => [e.agent, e.reviewer ? `reviewed by ${e.reviewer}` : void 0].filter(Boolean).join(" · "), c = ({ task: t }) => t.status === "done" || t.urgency !== "critical" && t.urgency !== "high" ? null : /* @__PURE__ */ r("span", {
23
+ title: `${t.urgency}: its priority, or that of a task waiting on it`,
24
+ className: e("shrink-0 text-[10px] font-bold", t.urgency === "critical" ? "text-red-600 dark:text-red-400" : "text-amber-600 dark:text-amber-400"),
25
+ children: t.urgency === "critical" ? "‼" : "!"
26
+ }), l = ({ task: l }) => {
27
+ let [u, d] = n(!1), f = t(() => d((e) => !e), []);
28
+ return /* @__PURE__ */ i("div", {
29
+ className: "border-b border-zinc-200 last:border-b-0 dark:border-zinc-700",
30
+ children: [
31
+ /* @__PURE__ */ i("button", {
32
+ type: "button",
33
+ onClick: f,
34
+ "aria-expanded": u,
35
+ className: "flex w-full items-center gap-2 px-2 py-1.5 text-left hover:bg-zinc-50 dark:hover:bg-zinc-800",
36
+ children: [
37
+ /* @__PURE__ */ r("i", { className: e(a[l.status] ?? "fa-regular fa-circle", "w-3 text-[10px]", o[l.status]) }),
38
+ /* @__PURE__ */ r(c, { task: l }),
39
+ /* @__PURE__ */ r("span", {
40
+ className: "shrink-0 font-mono text-[11px] text-zinc-500 dark:text-zinc-400",
41
+ children: l.id
42
+ }),
43
+ /* @__PURE__ */ r("span", {
44
+ className: "min-w-0 grow truncate",
45
+ children: l.title
46
+ }),
47
+ l.fraction !== void 0 && /* @__PURE__ */ i("span", {
48
+ className: "shrink-0 text-[10px] text-zinc-400",
49
+ children: [Math.round(l.fraction * 100), " %"]
50
+ }),
51
+ /* @__PURE__ */ r("span", {
52
+ className: "shrink-0 text-[10px] text-zinc-400",
53
+ children: s(l)
54
+ })
55
+ ]
56
+ }),
57
+ l.why && /* @__PURE__ */ r("div", {
58
+ className: e("truncate px-7 pb-1 text-[10px]", l.status === "blocked" ? "text-red-600 dark:text-red-400" : "text-zinc-500 dark:text-zinc-400"),
59
+ title: l.why,
60
+ children: l.why
61
+ }),
62
+ u && /* @__PURE__ */ i("div", {
63
+ className: "flex flex-col gap-0.5 px-7 pb-2 text-[11px] text-zinc-500 dark:text-zinc-400",
64
+ children: [/* @__PURE__ */ i("span", { children: [
65
+ l.status,
66
+ l.round > 0 ? ` · round ${String(l.round)}` : "",
67
+ " · ",
68
+ l.role,
69
+ l.step ? ` · ${l.step}` : ""
70
+ ] }), l.files.map((e) => /* @__PURE__ */ r("span", {
71
+ className: "font-mono",
72
+ children: e
73
+ }, e))]
74
+ })
75
+ ]
76
+ });
77
+ };
78
+ //#endregion
79
+ export { l as default };
@@ -0,0 +1,11 @@
1
+ import { RunSnapshot } from '@plitzi/sdk-shared/runs';
2
+ /**
3
+ * The run of agents this preview serves (`plitzi run preview`): what the page is being built by — how far it is, each
4
+ * task by where it stands, who has it and who reviews it, every agent, and what happened last. The page shows the
5
+ * approved work as each task is approved; this says what is coming. The run is worked from the terminal; what the
6
+ * person sees wrong on the page is reported from here, to its lead (`RunReport`).
7
+ */
8
+ declare const RunViewer: ({ snapshot }: {
9
+ snapshot?: RunSnapshot;
10
+ }) => import('react').JSX.Element;
11
+ export default RunViewer;
@@ -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;