kaizen-agent 1.87.2 → 1.87.4

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 (76) hide show
  1. package/cli/activity.ts +86 -0
  2. package/cli/add-project.ts +64 -1
  3. package/cli/auto-update.ts +33 -0
  4. package/cli/browser.ts +21 -0
  5. package/cli/chat.ts +88 -13
  6. package/cli/chatgpt.ts +1 -1
  7. package/cli/dashboard.ts +1 -1
  8. package/cli/install.ts +65 -36
  9. package/cli/look.ts +1 -0
  10. package/cli/models.ts +94 -0
  11. package/cli/onboarding.ts +9 -4
  12. package/cli/pty.ts +27 -12
  13. package/cli/release.ts +13 -1
  14. package/cli/settings.ts +39 -7
  15. package/cli/sources.ts +84 -20
  16. package/cli/state.ts +56 -3
  17. package/cli/task-service.ts +10 -3
  18. package/cli/usage.ts +15 -2
  19. package/cli/web.ts +119 -47
  20. package/cli/whats-new.json +38 -0
  21. package/cli/whats-new.ts +43 -0
  22. package/cli/workers.ts +2 -2
  23. package/package.json +1 -1
  24. package/skills/kaizen/config.default.yml +3 -0
  25. package/skills/kaizen/spec.md +6 -0
  26. package/skills/kaizen-explore/SKILL.md +7 -0
  27. package/web/components/home/home-window.tsx +0 -36
  28. package/web/components/home/index.ts +1 -0
  29. package/web/components/home/onboarding-dialog.tsx +44 -7
  30. package/web/components/home/works-flow.tsx +119 -0
  31. package/web/components/icebox/capture-box.tsx +11 -2
  32. package/web/components/icebox/request-card.tsx +33 -11
  33. package/web/components/project/add-project-dialog.tsx +1 -1
  34. package/web/components/rail/rail-list.tsx +51 -7
  35. package/web/components/run/doc-body.tsx +43 -0
  36. package/web/components/settings/agent-rows.tsx +15 -11
  37. package/web/components/settings/browser-row.tsx +1 -1
  38. package/web/components/settings/setting-row.tsx +10 -6
  39. package/web/components/settings/settings-section.tsx +5 -3
  40. package/web/components/settings/skill-card.tsx +32 -2
  41. package/web/components/settings/update-bar.tsx +53 -35
  42. package/web/components/settings/whats-new-card.tsx +70 -0
  43. package/web/components/shared/picker.tsx +21 -1
  44. package/web/components/shell/rail.tsx +8 -4
  45. package/web/dist/annotate.js +1 -1
  46. package/web/dist/board.css +6 -11
  47. package/web/dist/board.js +83 -56
  48. package/web/dist/boot.js +1 -1
  49. package/web/dist/notebook.css +2 -2
  50. package/web/dist/notebook.js +34 -34
  51. package/web/dist/popup.css +1 -1
  52. package/web/dist/popup.js +1 -1
  53. package/web/dist/term.js +1 -1
  54. package/web/dist/ui.css +2 -2
  55. package/web/dist/video.js +1 -1
  56. package/web/lib/footer/footer-rules.ts +8 -2
  57. package/web/lib/footer/footer-store.ts +2 -2
  58. package/web/lib/home/onboarding.ts +63 -17
  59. package/web/lib/icebox/icebox-actions.ts +24 -2
  60. package/web/lib/icebox/icebox-store.ts +7 -1
  61. package/web/lib/icebox/icebox-view.ts +3 -2
  62. package/web/lib/icebox/icebox.ts +24 -4
  63. package/web/lib/icebox/use-ice-keys.ts +5 -0
  64. package/web/lib/project/add-project.ts +6 -0
  65. package/web/lib/rail/rules.ts +4 -1
  66. package/web/lib/run/panel-derive.ts +1 -1
  67. package/web/lib/run/panel-store.ts +1 -0
  68. package/web/lib/settings/index.ts +2 -0
  69. package/web/lib/settings/settings-actions.ts +8 -0
  70. package/web/lib/settings/settings.ts +6 -4
  71. package/web/lib/settings/use-model-choices.ts +31 -0
  72. package/web/lib/settings/whats-new.ts +36 -0
  73. package/web/pages/board/App.tsx +3 -10
  74. package/web/pages/icebox-page.tsx +173 -125
  75. package/web/pages/task-page.tsx +17 -4
  76. package/web/ui/legacy/board.css +4 -9
@@ -45,7 +45,7 @@ export function BrowserRow({
45
45
  label={c.label}
46
46
  labelledBy={labelId}
47
47
  idPrefix={c.id}
48
- options={c.values.map((v) => ({ id: v, label: v }))}
48
+ options={c.values.map((v) => ({ id: v, label: v[0]!.toUpperCase() + v.slice(1) }))}
49
49
  value={prefs[kind]}
50
50
  onChange={(v) => setBrowserPref(kind, v)}
51
51
  />
@@ -6,9 +6,10 @@ import {
6
6
  saveSetting,
7
7
  useSettings,
8
8
  controlOf,
9
- MODEL_SUGGEST,
9
+ useModelChoices,
10
10
  modelName,
11
11
  modelTool,
12
+ optionText,
12
13
  rowHint,
13
14
  settingId,
14
15
  type Row,
@@ -29,7 +30,8 @@ export function SettingRow({ row, off }: { row: Row; off?: boolean }) {
29
30
  shown = useSettings((s) => s.local[row.key] ?? row.value),
30
31
  id = settingId(row.key),
31
32
  kind = controlOf(row),
32
- model = kind === "model";
33
+ model = kind === "model",
34
+ choices = useModelChoices(modelTool(row.key), model);
33
35
  const text = rowHint(row);
34
36
  const help: ReactNode =
35
37
  row.own && scoped ? (
@@ -82,7 +84,7 @@ export function SettingRow({ row, off }: { row: Row; off?: boolean }) {
82
84
  label={row.label}
83
85
  labelledBy={labelId}
84
86
  idPrefix={id}
85
- options={vals.map((v) => ({ id: v, label: kind === "preset" ? caps(v) : v }))}
87
+ options={vals.map((v) => ({ id: v, label: kind === "preset" ? caps(v) : optionText(row, v) }))}
86
88
  value={shown}
87
89
  onChange={(v) => v !== "custom" && save(v)}
88
90
  />
@@ -115,10 +117,12 @@ export function SettingRow({ row, off }: { row: Row; off?: boolean }) {
115
117
  return (
116
118
  <span>
117
119
  {field}
118
- {MODEL_SUGGEST[modelTool(row.key)] && (
120
+ {choices.length > 0 && (
119
121
  <datalist id={`${id}-dl`}>
120
- {MODEL_SUGGEST[modelTool(row.key)]!.map((m) => (
121
- <option key={m} value={m} />
122
+ {choices.map((m) => (
123
+ <option key={m.id} value={m.id}>
124
+ {m.name}
125
+ </option>
122
126
  ))}
123
127
  </datalist>
124
128
  )}
@@ -1,4 +1,4 @@
1
- import { loadSettings } from "@lib/settings";
1
+ import { recheck, useSettings } from "@lib/settings";
2
2
  import type { Section } from "@lib/settings";
3
3
  import { Button } from "@web/ui";
4
4
  import { SettingsItem } from "./settings-item.tsx";
@@ -6,6 +6,7 @@ import { SettingsItem } from "./settings-item.tsx";
6
6
  // A subsection: its name over a rounded box with hairline dividers between rows. A section with no name (Orchestration's
7
7
  // picture) draws its rows with no box. Refresh and Re-check read the page again.
8
8
  export function SettingsSection({ section }: { section: Section }) {
9
+ const busy = useSettings((s) => s.busy);
9
10
  if (!section.title) return section.items.map((i) => <SettingsItem key={i.id} item={i} />);
10
11
  return (
11
12
  <section className="mt-6 first:mt-0">
@@ -17,9 +18,10 @@ export function SettingsSection({ section }: { section: Section }) {
17
18
  variant="ghost"
18
19
  size="sm"
19
20
  className="text-primary"
20
- onClick={() => void loadSettings()}
21
+ disabled={busy === section.extra}
22
+ onClick={() => void recheck(section.extra!, section.extra === "refresh" ? "Refreshed" : "Checked again")}
21
23
  >
22
- {section.extra === "refresh" ? "Refresh" : "Re-check"}
24
+ {busy === section.extra ? "Checking…" : section.extra === "refresh" ? "Refresh" : "Re-check"}
23
25
  </Button>
24
26
  )}
25
27
  </h3>
@@ -1,7 +1,9 @@
1
- import { createElement } from "react";
1
+ import { createElement, useState } from "react";
2
2
  import { AGENT_FAVICONS, reaNode, reaSwitch, repairSkill, setSkill, useSettings, skillShapes } from "@lib/settings";
3
3
  import { cn } from "@lib/core";
4
- import { Button, Switch } from "@web/ui";
4
+ import { COPY, STEP } from "@lib/home";
5
+ import { Button, Dialog, DialogContent, DialogDescription, DialogTitle, Switch } from "@web/ui";
6
+ import { WorksFlow } from "@components/home";
5
7
 
6
8
  const WORD: Record<string, string> = { installed: "installed", missing: "missing", other: "your own copy" };
7
9
  const AGENT_CMD: Record<string, string> = {
@@ -38,6 +40,33 @@ function NodeButton({ n }: { n: Need }) {
38
40
  );
39
41
  }
40
42
 
43
+ // The "?" beside Kaizen workflow: the welcome's picture of how a run goes (ask, plan, approve, build, review), to look at again.
44
+ function HowItWorks() {
45
+ const [open, setOpen] = useState(false);
46
+ const c = COPY[STEP.works]!;
47
+ return (
48
+ <>
49
+ <button
50
+ type="button"
51
+ aria-label="How kaizen works"
52
+ title="How kaizen works"
53
+ data-how-it-works
54
+ onClick={() => setOpen(true)}
55
+ className="ml-1.5 inline-grid size-4 place-items-center rounded-full border border-border align-middle text-[10px] leading-none text-muted-foreground hover:text-foreground"
56
+ >
57
+ ?
58
+ </button>
59
+ <Dialog open={open} onOpenChange={setOpen}>
60
+ <DialogContent className="w-[min(720px,calc(100vw-32px))] gap-3 p-6">
61
+ <DialogTitle className="text-xl font-bold text-strong">{c.title}</DialogTitle>
62
+ <DialogDescription className="text-base">{c.sub}</DialogDescription>
63
+ <WorksFlow />
64
+ </DialogContent>
65
+ </Dialog>
66
+ </>
67
+ );
68
+ }
69
+
41
70
  // One skill: its mark, name and what it does, a switch (or Repair / Always on for a core one), and which agents have it.
42
71
  export function SkillCard({ id }: { id: string }) {
43
72
  const s = useSettings((st) => st.data?.skills?.skills.find((x: any) => x.id === id));
@@ -56,6 +85,7 @@ export function SkillCard({ id }: { id: string }) {
56
85
  <span className="min-w-0 flex-[1_1_200px]">
57
86
  <b className="block font-medium">
58
87
  {s.title}
88
+ {s.id === "kaizen" && <HowItWorks />}
59
89
  {s.status && s.status !== "stable" && (
60
90
  <em className="ml-1.5 rounded-xs border border-border px-1.5 text-[10.5px] font-normal not-italic text-muted-foreground">
61
91
  {s.status === "beta" ? "Beta" : "Experimental"}
@@ -8,10 +8,14 @@ import {
8
8
  later,
9
9
  upToDate,
10
10
  upgrade,
11
+ cardOpen,
12
+ toggleWhatsNew,
11
13
  useUpdate,
14
+ useWhatsNew,
12
15
  type Version,
13
16
  } from "@lib/settings";
14
17
  import { Button, Popover, PopoverContent, PopoverTrigger } from "@web/ui";
18
+ import { WhatsNewCard } from "./whats-new-card.tsx";
15
19
 
16
20
  // The Update button, shared by the About bar and the card: asks first, then shows what is happening.
17
21
  function UpdateButton({ v, label }: { v: Version; label: string }) {
@@ -35,13 +39,13 @@ function UpdateButton({ v, label }: { v: Version; label: string }) {
35
39
  );
36
40
  }
37
41
 
38
- // What's new: each newer release's one-line title, in a popover.
42
+ // What's in the update: each newer release's one-line title, in a popover, while an update is waiting.
39
43
  function News({ v }: { v: Version }) {
40
44
  if (!v.notes?.length) return null;
41
45
  return (
42
46
  <Popover>
43
47
  <PopoverTrigger asChild>
44
- <Button>What's new</Button>
48
+ <Button>What's in the update</Button>
45
49
  </PopoverTrigger>
46
50
  <PopoverContent className="w-[min(360px,calc(100vw-32px))] px-3.5 py-2.5 leading-normal">
47
51
  <ul className="mb-2 list-disc pl-[18px]">
@@ -92,47 +96,61 @@ export function UpdateBar() {
92
96
  if (v.update) queueMicrotask(() => go.current?.querySelector<HTMLElement>("#upd-go")?.focus());
93
97
  };
94
98
  const shown = msg || (ver ? (ver.behind ? behindMsg(ver) : `${name} ${ver.version}`) : name);
99
+ const hasNews = useWhatsNew((st) => !!st.data?.entry),
100
+ newsOpen = useWhatsNew((st) => cardOpen(st));
101
+ const newsBtn = hasNews && (
102
+ <Button id="wn-btn" aria-expanded={newsOpen} onClick={toggleWhatsNew}>
103
+ What's new
104
+ </Button>
105
+ );
95
106
  const checkBtn = (
96
107
  <Button id="upd-chk" disabled={checking} onClick={check}>
97
108
  {checking ? "Checking…" : label || "Check for updates"}
98
109
  </Button>
99
110
  );
100
111
  return (
101
- <div className="mb-6">
102
- <div className="mb-2 text-sm font-semibold text-strong">About</div>
103
- <div
104
- className={
105
- upd
106
- ? "relative flex flex-wrap items-center justify-between gap-3 rounded-lg border border-primary bg-[color-mix(in_srgb,var(--accent)_10%,var(--bg-2))] px-3.5 py-2.5 text-base"
107
- : "flex flex-wrap items-center justify-between gap-3 rounded-lg border border-border bg-card px-3.5 py-2.5 text-base text-strong"
108
- }
109
- >
110
- {ver?.failed && (
111
- <span role="alert" className="basis-full text-warning">
112
- Last update failed: {ver.failed}
113
- </span>
114
- )}
115
- {upd ? (
116
- <>
117
- <span>
118
- {name} <b>{upd.latest}</b> is available. You are running {upd.version}.
119
- </span>
120
- <span ref={go} className="flex items-center gap-2">
121
- <News v={upd} />
122
- {checkBtn}
123
- <UpdateButton v={upd} label={`Update ${name}`} />
124
- </span>
125
- </>
126
- ) : (
127
- <>
128
- <span id="upd-msg" aria-live="polite">
129
- {shown}
112
+ <>
113
+ <div className="mb-6">
114
+ <div className="mb-2 text-sm font-semibold text-strong">About</div>
115
+ <div
116
+ className={
117
+ upd
118
+ ? "relative flex flex-wrap items-center justify-between gap-3 rounded-lg border border-primary bg-[color-mix(in_srgb,var(--accent)_10%,var(--bg-2))] px-3.5 py-2.5 text-base"
119
+ : "flex flex-wrap items-center justify-between gap-3 rounded-lg border border-border bg-card px-3.5 py-2.5 text-base text-strong"
120
+ }
121
+ >
122
+ {ver?.failed && (
123
+ <span role="alert" className="basis-full text-warning">
124
+ Last update failed: {ver.failed}
130
125
  </span>
131
- {checkBtn}
132
- </>
133
- )}
126
+ )}
127
+ {upd ? (
128
+ <>
129
+ <span>
130
+ {name} <b>{upd.latest}</b> is available. You are running {upd.version}.
131
+ </span>
132
+ <span ref={go} className="flex items-center gap-2">
133
+ <News v={upd} />
134
+ {newsBtn}
135
+ {checkBtn}
136
+ <UpdateButton v={upd} label={`Update ${name}`} />
137
+ </span>
138
+ </>
139
+ ) : (
140
+ <>
141
+ <span id="upd-msg" aria-live="polite">
142
+ {shown}
143
+ </span>
144
+ <span className="flex items-center gap-2">
145
+ {newsBtn}
146
+ {checkBtn}
147
+ </span>
148
+ </>
149
+ )}
150
+ </div>
134
151
  </div>
135
- </div>
152
+ <WhatsNewCard />
153
+ </>
136
154
  );
137
155
  }
138
156
 
@@ -0,0 +1,70 @@
1
+ import { cardOpen, closeWhatsNew, useWhatsNew } from "@lib/settings";
2
+ import { Button } from "@web/ui";
3
+
4
+ // What's New, inline under About (not a dialog): the big improvements first, the fixes below, then Got it. Modelled on iOS's What's New:
5
+ // a short title and a version, each highlight a bold name over one grey line, one full-width button.
6
+ export function WhatsNewCard() {
7
+ const s = useWhatsNew();
8
+ const e = s.data?.entry;
9
+ if (!e || !cardOpen(s)) return null;
10
+ return (
11
+ <section
12
+ aria-label="What's new"
13
+ data-whats-new
14
+ className="mb-6 rounded-lg border border-border bg-card px-[26px] py-[22px] text-base"
15
+ >
16
+ <div className="mb-5 flex items-start justify-between gap-3">
17
+ <div>
18
+ <div
19
+ role="heading"
20
+ aria-level={2}
21
+ className="text-[22px] font-extrabold leading-tight tracking-tight text-strong"
22
+ >
23
+ What's New in kaizen
24
+ </div>
25
+ <div className="mt-0.5 text-sm text-muted-foreground">Version {e.version}</div>
26
+ </div>
27
+ <button
28
+ type="button"
29
+ className="px-0.5 py-1 text-sm text-muted-foreground underline underline-offset-[3px] hover:text-foreground"
30
+ onClick={() => void closeWhatsNew()}
31
+ >
32
+ Hide
33
+ </button>
34
+ </div>
35
+ {e.highlights.map((h) => (
36
+ <div key={h.title} className="mb-[18px]">
37
+ <b className="block text-[15px] font-semibold leading-snug text-strong">{h.title}</b>
38
+ <span className="mt-px block text-sm leading-[1.4] text-muted-foreground">{h.text}</span>
39
+ </div>
40
+ ))}
41
+ {e.fixes.length > 0 && (
42
+ <div className="mt-1.5 border-t border-border pt-4">
43
+ <b className="mb-1.5 block text-[15px] font-semibold text-strong">Fixes</b>
44
+ <ul className="m-0 list-disc pl-[18px] text-sm leading-normal text-muted-foreground">
45
+ {e.fixes.map((f) => (
46
+ <li key={f} className="my-0.5">
47
+ {f}
48
+ </li>
49
+ ))}
50
+ </ul>
51
+ </div>
52
+ )}
53
+ <a
54
+ className="mt-3.5 inline-block text-sm text-foreground underline underline-offset-[3px]"
55
+ href="https://github.com/hfadhlullah/kaizen/releases"
56
+ target="_blank"
57
+ rel="noopener"
58
+ >
59
+ Full release notes
60
+ </a>
61
+ <Button
62
+ variant="primary"
63
+ className="mt-4 w-full justify-center py-2.5 text-[15px] font-semibold"
64
+ onClick={() => void closeWhatsNew()}
65
+ >
66
+ Got it
67
+ </Button>
68
+ </section>
69
+ );
70
+ }
@@ -2,7 +2,8 @@ import { useState, type ReactNode } from "react";
2
2
  import { cn } from "@lib/core";
3
3
  import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, Icon, Popover, PopoverContent, PopoverTrigger } from "@web/ui";
4
4
 
5
- // `group` heads a run of rows (sources under their platform); `icon` leads the row and the button; `count` trails it.
5
+ // `group` heads a run of rows (sources under their platform); `icon` leads the row and the button; `count` trails it;
6
+ // `removable` puts a remove button on the row, which calls the Picker's `onRemove`.
6
7
  export type PickerOption = {
7
8
  value: string;
8
9
  label: string;
@@ -10,6 +11,7 @@ export type PickerOption = {
10
11
  icon?: ReactNode;
11
12
  count?: number;
12
13
  search?: string;
14
+ removable?: boolean;
13
15
  };
14
16
  // A searchable choice (project, source, category, agent): a button showing the choice that opens a list with a
15
17
  // search box. The search matches a row's words and its group's; Enter picks the first row left.
@@ -23,6 +25,7 @@ export function Picker({
23
25
  groupIcons,
24
26
  open: openProp,
25
27
  onOpenChange,
28
+ onRemove,
26
29
  }: {
27
30
  options: PickerOption[];
28
31
  value: string;
@@ -34,6 +37,7 @@ export function Picker({
34
37
  // Opened from outside (a form that needs a choice before it can send).
35
38
  open?: boolean;
36
39
  onOpenChange?: (o: boolean) => void;
40
+ onRemove?: (v: string) => void;
37
41
  }) {
38
42
  const [own, setOwn] = useState(false),
39
43
  open = openProp ?? own,
@@ -55,6 +59,22 @@ export function Picker({
55
59
  <span className="min-w-0 flex-1 truncate">{o.label}</span>
56
60
  {o.count != null && <i className="text-xs not-italic tabular-nums text-muted-foreground">{o.count}</i>}
57
61
  {o.value === value && <Icon name="check" className="size-3.5 text-primary" />}
62
+ {o.removable && onRemove && (
63
+ <button
64
+ type="button"
65
+ aria-label={`Remove ${o.label}`}
66
+ title={`Remove ${o.label}`}
67
+ onPointerDown={(e) => e.stopPropagation()}
68
+ onClick={(e) => {
69
+ e.stopPropagation();
70
+ setOpen(false);
71
+ onRemove(o.value);
72
+ }}
73
+ className="-mr-1 grid size-5 place-items-center rounded-xs text-muted-foreground opacity-60 hover:bg-muted hover:text-foreground hover:opacity-100"
74
+ >
75
+ <Icon name="x" className="size-3" />
76
+ </button>
77
+ )}
58
78
  </CommandItem>
59
79
  );
60
80
  const groups = [...new Set(options.map((o) => o.group).filter((g): g is string => !!g))];
@@ -1,6 +1,6 @@
1
1
  import { cn } from "@lib/core";
2
2
  import type { CSSProperties, ReactNode } from "react";
3
- import { useUpdate } from "@lib/settings";
3
+ import { useUpdate, useWhatsNew } from "@lib/settings";
4
4
  import { railActions } from "@lib/rail";
5
5
  import { useRoute } from "@lib/router";
6
6
  import { useServer, iceNewCount, needYouCount } from "@lib/server";
@@ -50,6 +50,8 @@ export function Rail(p: { srcs?: ReactNode; before?: ReactNode }) {
50
50
  lit = useRoute((r) => r.lit);
51
51
  // A dot on Settings while a newer kaizen is known (the About bar and the update card read the same store).
52
52
  const latest = useUpdate((s) => (s.ver?.update ? s.ver.latest : ""));
53
+ // The Settings gear carries the same dot while What's New has not been seen on this machine.
54
+ const unseen = useWhatsNew((s) => (s.data?.entry && s.data.unseen ? s.data.entry.version : ""));
53
55
  // Counts the server store gives the menu: tasks that need you, new Icebox requests, Terminal tiles hidden on its page.
54
56
  const need = useServer((s) => needYouCount(s.tasks)),
55
57
  known = useServer((s) => s.tasks !== null),
@@ -204,13 +206,15 @@ export function Rail(p: { srcs?: ReactNode; before?: ReactNode }) {
204
206
  </div>
205
207
  <div className="rbot">
206
208
  <Item
207
- className={cn("it fold", latest && "upd")}
209
+ className={cn("it fold", (latest || unseen) && "upd")}
208
210
  href="/?view=settings"
209
211
  view="settings"
210
212
  title={
211
213
  latest
212
- ? `Settings: ${(globalThis as { kaizenDesktop?: unknown }).kaizenDesktop ? "Kaizen" : "kaizen"} ${latest} is available`
213
- : "Settings"
214
+ ? `Settings: ${(globalThis as { kaizenDesktop?: unknown }).kaizenDesktop ? "Kaizen" : "kaizen"} ${latest} is available${unseen ? `, and see what's new in ${unseen}` : ""}`
215
+ : unseen
216
+ ? `Settings: see what's new in kaizen ${unseen}`
217
+ : "Settings"
214
218
  }
215
219
  aria="Settings"
216
220
  icon="i-gear"
@@ -1,4 +1,4 @@
1
- /* kaizen annotator page script df179b2b6cc14e38 -- generated by bun run build:web from web/annotate/annotate.ts; do not edit */
1
+ /* kaizen annotator page script afd2e1864afda466 -- generated by bun run build:web from web/annotate/annotate.ts; do not edit */
2
2
  (()=>{var Z=(o)=>o.length<24&&!/\d{3,}|^css-|^_|^sc-|^jsx-/.test(o),dt=(o)=>{let i=Math.min(...o.map((f)=>f.left)),d=Math.min(...o.map((f)=>f.top)),u=Math.max(...o.map((f)=>f.right)),b=Math.max(...o.map((f)=>f.bottom));return{left:i,top:d,right:u,bottom:b,width:u-i,height:b-d}},tt=(o)=>{let i=Math.min(o.x0,o.x1),d=Math.min(o.y0,o.y1),u=Math.abs(o.x1-o.x0),b=Math.abs(o.y1-o.y0);return{left:i,top:d,width:u,height:b,right:i+u,bottom:d+b}},pt=(o)=>o.width>=8&&o.height>=8,ut=(o,i)=>o.width>=4&&o.height>=4&&o.left>=i.left-1&&o.top>=i.top-1&&o.right<=i.right+1&&o.bottom<=i.bottom+1,mt=20,ft=(o,i)=>{let d=o.replace(/\s+/g," ").trim();return d?`"${d.slice(0,60)}${d.length>60?"…":""}"`:i},gt=(o,i)=>`area ${Math.round(o.width)}x${Math.round(o.height)} (${i} elements)`,ht=(o,i,d)=>({left:Math.max(8,Math.min(i-316,o.left)),top:o.bottom+330<d?Math.min(o.bottom+8,d-200):Math.max(8,o.top-190)}),xt=(o,i)=>({left:Math.min(i-12,o.left+o.width),top:Math.max(12,o.top)}),bt=(o,i,d)=>({left:Math.max(8,Math.min(i-268,o.left)),top:Math.min(o.top+o.height+8,d-90)}),yt=(o,i,d,u)=>({kind:o.kind,comment:d.comment,intent:d.intent,severity:d.severity,selector:i.selector,items:o.count>1?i.items:[],path:i.path,text:i.text.slice(0,200),tag:i.tag,url:i.url,box:`${Math.round(o.rect.left+u.x)},${Math.round(o.rect.top+u.y)} ${Math.round(o.rect.width)}x${Math.round(o.rect.height)}`,pb:{x:o.rect.left+u.x,y:o.rect.top+u.y,w:o.rect.width,h:o.rect.height},page:i.page,attrs:i.attrs,styles:i.styles,nearby:i.nearby,selected:o.selected||"",source:i.source,components:i.components});var wt=1500,kt=1300000,et=(o)=>o.width>2400||o.height>2400,vt=(o,i)=>{if(o.width<2||o.height<2||et(o))return null;let d=Math.ceil(o.width),u=Math.ceil(o.height),b=Math.max(0,i.left-o.left),f=Math.max(0,i.top-o.top),l=Math.min(d-b,i.width),C=Math.min(u-f,i.height);return l<2||C<2?null:{w:d,h:u,sx:b,sy:f,sw:l,sh:C}},Et=(o,i,d)=>{let u=[];for(let b=Math.min(2,d||1);b>=0.5;b-=0.5)u.push(Math.min(b,1600/Math.max(o,i)));return u};(()=>{let o=window,i=window.parent!==window||o.__kzHost===!0;if(o.__kzAnnotate||!i)return;o.__kzAnnotate=!0;let d=document.currentScript,u=typeof o.__kzAnnToken==="string"?o.__kzAnnToken:"";if(!u)try{u=new URL(d.src).searchParams.get("t")||""}catch{}let b=window.parent,f=(e)=>b.postMessage({kz:1,t:u,out:1,...e},"*"),l={on:!1,mode:"element",hide:!1,block:!0,color:"#3c82f7",components:!0},C=[],g=null,y=[],E=null,U=!1,j=[],I=[],F=[],nt=window.requestAnimationFrame.bind(window);window.requestAnimationFrame=(e)=>U?(F.push(e),F.length):nt(e);let H=document.createElement("style");H.textContent="*,*::before,*::after{animation-play-state:paused!important;transition:none!important}";function At(e){if(e===U)return;if(U=e,e){document.documentElement.append(H);try{j=document.getAnimations().filter((t)=>t.playState==="running"),j.forEach((t)=>t.pause())}catch{}I=[...document.querySelectorAll("video,audio")].filter((t)=>!t.paused),I.forEach((t)=>t.pause())}else H.remove(),j.forEach((t)=>{try{t.play()}catch{}}),I.forEach((t)=>t.play().catch(()=>{})),j=[],I=[],F.splice(0).forEach((t)=>nt(t))}let z=(e)=>window.CSS&&CSS.escape?CSS.escape(e):e.replace(/[^\w-]/g,"\\$&"),D=(e)=>{try{return document.querySelectorAll(e).length===1}catch{return!1}};function ot(e){if(e.id&&D("#"+z(e.id)))return"#"+z(e.id);let t=e.getAttribute("data-testid");if(t&&D(`[data-testid="${t.replace(/"/g,"\\\"")}"]`))return`[data-testid="${t.replace(/"/g,"\\\"")}"]`;let n=[];for(let r=e;r&&r.nodeType===1&&r!==document.documentElement;r=r.parentElement){let s=r.tagName.toLowerCase();if(r.id){if(n.unshift("#"+z(r.id)),D(n.join(" > ")))break;n.shift()}let c=[...r.classList].filter(Z).slice(0,2);if(c.length)s+=c.map((w)=>"."+z(w)).join("");let p=r.parentElement?[...r.parentElement.children].filter((w)=>w.tagName===r.tagName):[];if(p.length>1&&!(c.length&&r.parentElement.querySelectorAll(":scope > "+s).length===1))s+=`:nth-of-type(${p.indexOf(r)+1})`;if(n.unshift(s),D(n.join(" > ")))break}return n.join(" > ")}let Ct=(e)=>{let t=[];for(let n=e;n&&n.nodeType===1;n=n.parentElement)t.unshift(n.tagName.toLowerCase()+(n.id?"#"+n.id:""));return t.join(" > ")},K=(e)=>e.tagName.toLowerCase()+(e.id?"#"+e.id:"")+[...e.classList].filter(Z).slice(0,2).map((t)=>"."+t).join(""),Y=(e)=>(e.innerText||e.textContent||e.getAttribute("aria-label")||e.getAttribute("alt")||"").replace(/\s+/g," ").trim(),_t=["id","class","role","aria-label","href","type","name","placeholder","alt","data-testid"],St=(e)=>_t.filter((t)=>e.hasAttribute(t)).map((t)=>`${t}="${e.getAttribute(t).slice(0,80)}"`).join(" "),Rt=["color","background-color","font-family","font-size","font-weight","line-height","padding","margin","display","position","border-radius","width","height"],Mt=(e)=>{let t=getComputedStyle(e);return Rt.map((n)=>`${n}: ${t.getPropertyValue(n)}`).join("; ")};function $t(e){let t="",n=[];for(let r=e,s=0;r&&r.nodeType===1&&s<14;r=r.parentElement,s++){let c=r.getAttribute("data-astro-source-file");if(c&&!t)t=c+(r.getAttribute("data-astro-source-loc")?":"+r.getAttribute("data-astro-source-loc").replace(/:/,":"):"");let p=r.__svelte_meta&&r.__svelte_meta.loc;if(p&&!t)t=`${p.file}:${p.line}`;let w=r.__vueParentComponent;for(let a=w,v=0;a&&v<6;a=a.parent,v++){let m=a.type&&(a.type.name||a.type.__name);if(m&&!n.includes(m))n.push(m);if(a.type&&a.type.__file&&!t)t=a.type.__file}if(r.__vue__&&r.__vue__.$options){let a=r.__vue__.$options;if(a.name&&!n.includes(a.name))n.push(a.name);if(a.__file&&!t)t=a.__file}let P=Object.keys(r).find((a)=>a.startsWith("__reactFiber$"));if(P)for(let a=r[P],v=0;a&&v<40;a=a.return,v++){if(a._debugSource&&!t)t=`${a._debugSource.fileName}:${a._debugSource.lineNumber}`;let m=a.type;if(typeof m==="function"||m&&typeof m==="object"){let S=m.displayName||m.name||m.render&&m.render.name||"";if(S&&!n.includes(S)&&n.length<8)n.push(S)}}if(t&&n.length)break}return{source:t,components:n.reverse().join(" > ")}}let M=document.createElement("div");M.style.cssText="all:initial;position:fixed;inset:0;z-index:2147483647;pointer-events:none";let Tt=M.attachShadow({mode:"closed"}),rt=document.createElement("style");rt.textContent=`
3
3
  *{box-sizing:border-box;font:12px/1.4 system-ui,sans-serif}
4
4
  .b{position:fixed;pointer-events:none;border:2px solid var(--c);background:color-mix(in srgb,var(--c) 14%,transparent);border-radius:2px}