kaizen-agent 1.87.2 → 1.87.3

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 (40) hide show
  1. package/cli/browser.ts +21 -0
  2. package/cli/chatgpt.ts +1 -1
  3. package/cli/dashboard.ts +1 -1
  4. package/cli/models.ts +94 -0
  5. package/cli/sources.ts +84 -20
  6. package/cli/state.ts +2 -2
  7. package/cli/task-service.ts +2 -0
  8. package/cli/web.ts +31 -6
  9. package/package.json +1 -1
  10. package/web/components/home/home-window.tsx +0 -36
  11. package/web/components/icebox/capture-box.tsx +11 -2
  12. package/web/components/icebox/request-card.tsx +33 -11
  13. package/web/components/rail/rail-list.tsx +43 -1
  14. package/web/components/settings/setting-row.tsx +8 -5
  15. package/web/components/settings/settings-section.tsx +5 -3
  16. package/web/components/shared/picker.tsx +21 -1
  17. package/web/dist/annotate.js +1 -1
  18. package/web/dist/board.css +5 -10
  19. package/web/dist/board.js +57 -55
  20. package/web/dist/boot.js +1 -1
  21. package/web/dist/notebook.css +2 -2
  22. package/web/dist/notebook.js +34 -34
  23. package/web/dist/popup.css +1 -1
  24. package/web/dist/popup.js +1 -1
  25. package/web/dist/term.js +1 -1
  26. package/web/dist/ui.css +2 -2
  27. package/web/dist/video.js +1 -1
  28. package/web/lib/icebox/icebox-actions.ts +24 -2
  29. package/web/lib/icebox/icebox-store.ts +7 -1
  30. package/web/lib/icebox/icebox-view.ts +3 -2
  31. package/web/lib/icebox/icebox.ts +24 -4
  32. package/web/lib/icebox/use-ice-keys.ts +5 -0
  33. package/web/lib/rail/rules.ts +4 -1
  34. package/web/lib/settings/index.ts +1 -0
  35. package/web/lib/settings/settings-actions.ts +8 -0
  36. package/web/lib/settings/settings.ts +0 -3
  37. package/web/lib/settings/use-model-choices.ts +31 -0
  38. package/web/pages/board/App.tsx +1 -9
  39. package/web/pages/icebox-page.tsx +173 -125
  40. package/web/ui/legacy/board.css +3 -8
@@ -14,7 +14,7 @@ import {
14
14
  SourceDrawer,
15
15
  SwipeDeck,
16
16
  } from "@components/icebox";
17
- import { Chip, ConfirmDialog, EmptyState, FilterPopover, Pager, Picker, Segmented } from "@components/shared";
17
+ import { ActionMenu, Chip, ConfirmDialog, EmptyState, IconButton, Pager, Picker, Segmented } from "@components/shared";
18
18
  import {
19
19
  useIceData,
20
20
  deckOf,
@@ -42,6 +42,7 @@ import {
42
42
  clearFilters,
43
43
  iceEls,
44
44
  pickBoard,
45
+ INBOX,
45
46
  selectPage,
46
47
  setView,
47
48
  toggleKind,
@@ -50,7 +51,7 @@ import { useNarrow, usePager } from "@lib/shared";
50
51
  import { host } from "@lib/core";
51
52
  import { showable as showableProjects, useShown } from "@lib/project";
52
53
  import { stopDictation } from "@lib/dictation";
53
- import { Button, Checkbox, Icon, Skeleton } from "@web/ui";
54
+ import { Button, Checkbox, Icon, Input, Popover, PopoverContent, PopoverTrigger, Skeleton } from "@web/ui";
54
55
 
55
56
  // The Icebox: requests gathered from request sources, read like an inbox, until someone promotes them to tasks or
56
57
  // dismisses them. A capture box on top, collections and kinds, then the requests as cards or a list, one at a time in
@@ -58,14 +59,7 @@ import { Button, Checkbox, Icon, Skeleton } from "@web/ui";
58
59
  export function IceboxPage() {
59
60
  return useRoute((r) => r.page === "icebox") ? <Icebox /> : null;
60
61
  }
61
- const TONE: Record<string, string> = {
62
- client:
63
- "text-kind-client data-[state=on]:border-kind-client data-[state=on]:bg-kind-client data-[state=on]:text-card",
64
- finding:
65
- "text-kind-finding data-[state=on]:border-kind-finding data-[state=on]:bg-kind-finding data-[state=on]:text-card",
66
- people:
67
- "text-kind-people data-[state=on]:border-kind-people data-[state=on]:bg-kind-people data-[state=on]:text-card",
68
- };
62
+ const KIND_TEXT: Record<string, string> = { client: "text-kind-client", finding: "text-kind-finding", people: "text-kind-people" };
69
63
  function Icebox() {
70
64
  useIceData();
71
65
  // The board's project pickers change what shows: the "Showing" choice is a store, the board's data redraws it.
@@ -84,6 +78,7 @@ function Icebox() {
84
78
  view: s.view,
85
79
  board: s.board,
86
80
  kinds: s.kinds,
81
+ q: s.q,
87
82
  cat: s.cat,
88
83
  src: s.src,
89
84
  sel: s.sel,
@@ -174,7 +169,7 @@ function Icebox() {
174
169
  capBoards = (data.boards || []).filter((b) => b.dir === to),
175
170
  groups = srcGroups(d.list, d.bySrc),
176
171
  hidden = hiddenCat(d.cat),
177
- filtering = !!(d.cat || d.src),
172
+ nFilt = s.kinds.length + (d.cat ? 1 : 0) + (d.src ? 1 : 0),
178
173
  single = !!dir;
179
174
  const dialogs = (
180
175
  <>
@@ -253,6 +248,42 @@ function Icebox() {
253
248
  );
254
249
  return (
255
250
  <Shell>
251
+ <div className="mb-3 flex items-center gap-3 max-sm:flex-wrap">
252
+ <span className="text-base font-semibold text-foreground">{countText}</span>
253
+ <span className="flex-1" />
254
+ <label className="relative flex w-72 items-center max-sm:order-last max-sm:w-full">
255
+ <Icon name="search" className="pointer-events-none absolute left-2.5 size-3.5 text-muted-foreground" />
256
+ <Input
257
+ ref={(el) => void (iceEls.search = el)}
258
+ type="search"
259
+ value={s.q}
260
+ onChange={(e) => setIce({ q: e.target.value })}
261
+ onKeyDown={(e) => e.key === "Escape" && (setIce({ q: "" }), e.currentTarget.blur())}
262
+ placeholder="Search icebox…"
263
+ aria-label="Search the icebox"
264
+ spellCheck={false}
265
+ className="h-8 pl-8 pr-8 text-sm"
266
+ />
267
+ {!s.q && (
268
+ <kbd className="pointer-events-none absolute right-2 rounded-xs border border-border px-1 text-[11px] text-muted-foreground max-sm:hidden">
269
+ /
270
+ </kbd>
271
+ )}
272
+ </label>
273
+ {!narrow && (
274
+ <Button
275
+ id="src-tog"
276
+ ref={(el) => void (iceEls.srcTog = el)}
277
+ size="sm"
278
+ aria-expanded={s.srcShow}
279
+ aria-controls="src-sec"
280
+ title="Sources, and Gather all"
281
+ onClick={() => setIce({ srcShow: true })}
282
+ >
283
+ <Icon name="link" className="size-3.5" /> Sources · {d.list.length}
284
+ </Button>
285
+ )}
286
+ </div>
256
287
  <CaptureBox
257
288
  to={to}
258
289
  projects={single ? [] : showable}
@@ -271,15 +302,31 @@ function Icebox() {
271
302
  </Button>
272
303
  </div>
273
304
  )}
274
- <div className="mb-2.5 flex items-start justify-between gap-4 max-sm:-mx-4 max-sm:mb-1.5 max-sm:flex-nowrap max-sm:gap-1.5 max-sm:overflow-x-auto max-sm:px-4 max-sm:pb-0.5 max-sm:[scrollbar-width:none]">
305
+ <div className="mb-2.5 flex items-center justify-between gap-3 max-sm:-mx-4 max-sm:mb-1.5 max-sm:gap-1.5 max-sm:overflow-x-auto max-sm:px-4 max-sm:pb-0.5 max-sm:[scrollbar-width:none]">
275
306
  <div
276
307
  role="group"
277
308
  aria-label="Collections"
278
- className="flex min-w-0 flex-wrap gap-1.5 max-sm:flex-none max-sm:flex-nowrap"
309
+ className="flex min-w-0 flex-wrap items-center gap-1.5 max-sm:flex-none max-sm:flex-nowrap"
279
310
  >
311
+ {!cardsOn && !narrow && order.length > 0 && (
312
+ <Checkbox
313
+ className="mr-1"
314
+ aria-label="Select every request shown"
315
+ checked={nSel > 0 && nSel === order.length ? true : nSel > 0 ? "indeterminate" : false}
316
+ onCheckedChange={() => selectPage(order, nSel !== order.length)}
317
+ />
318
+ )}
280
319
  <Chip pressed={!d.board} onPressedChange={() => pickBoard("", d.boards, single)}>
281
320
  All
282
321
  </Chip>
322
+ <Chip
323
+ count={d.nInbox}
324
+ pressed={d.board === INBOX}
325
+ title="Items in no collection"
326
+ onPressedChange={() => pickBoard(INBOX, d.boards, single)}
327
+ >
328
+ Inbox
329
+ </Chip>
283
330
  {d.boards.map((b) => (
284
331
  <BoardChip
285
332
  key={b.name}
@@ -289,121 +336,118 @@ function Icebox() {
289
336
  onPress={() => pickBoard(b.name, d.boards, single)}
290
337
  />
291
338
  ))}
292
- <Button
293
- size="sm"
339
+ <IconButton
294
340
  id="ice-nb"
295
- title="Make a collection for a client or a topic"
296
- className="h-[26px] border-dashed text-muted-foreground"
341
+ icon="plus"
342
+ label="New collection, for a client or a topic"
343
+ className="size-[26px] [&_svg]:size-[13px]"
297
344
  onClick={() => void newCollection(to, single ? "" : capP?.label || "this project")}
298
- >
299
- <Icon name="plus" className="size-[13px]" />
300
- Collection
301
- </Button>
302
- </div>
303
- <div
304
- role="group"
305
- aria-label="Kinds"
306
- className="flex min-w-0 flex-wrap gap-1.5 max-sm:flex-none max-sm:flex-nowrap max-sm:border-l max-sm:border-border max-sm:pl-1.5"
307
- >
308
- {Object.entries(KIND).map(([k, l]) => (
309
- <Chip key={k} className={TONE[k]} pressed={s.kinds.includes(k)} onPressedChange={() => toggleKind(k)}>
310
- {l}
311
- </Chip>
312
- ))}
313
- </div>
314
- </div>
315
- <div className="mb-2.5 flex items-center gap-2 max-sm:flex-wrap">
316
- {!cardsOn && !narrow && order.length > 0 && (
317
- <Checkbox
318
- aria-label="Select every request shown"
319
- checked={nSel > 0 && nSel === order.length ? true : nSel > 0 ? "indeterminate" : false}
320
- onCheckedChange={() => selectPage(order, nSel !== order.length)}
321
345
  />
322
- )}
323
- {!narrow && (
324
- <Segmented
325
- label="View"
326
- value={cardsOn ? "cards" : "sort"}
327
- options={[
328
- { id: "cards", label: "Cards" },
329
- { id: "sort", label: "Sort" },
346
+ </div>
347
+ <div className="flex flex-none items-center gap-1.5">
348
+ <Popover>
349
+ <PopoverTrigger asChild>
350
+ <Button
351
+ variant="ghost"
352
+ size="sm"
353
+ aria-label="Filter requests"
354
+ className={nFilt ? "text-foreground" : "text-muted-foreground"}
355
+ >
356
+ <Icon name="filter" className="size-3.5" />
357
+ {nFilt ? `Filter · ${nFilt}` : "Filter"}
358
+ </Button>
359
+ </PopoverTrigger>
360
+ <PopoverContent align="end" className="flex w-64 flex-col gap-1 p-2">
361
+ <b className="px-1.5 pt-1 text-xs font-medium text-muted-foreground">Kind</b>
362
+ {Object.entries(KIND).map(([k, l]) => (
363
+ <label
364
+ key={k}
365
+ className="flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1 text-sm hover:bg-muted"
366
+ >
367
+ <Checkbox checked={s.kinds.includes(k)} onCheckedChange={() => toggleKind(k)} />
368
+ <span className={KIND_TEXT[k]}>{l}</span>
369
+ </label>
370
+ ))}
371
+ {(d.byCat.size > 1 || d.byCat.has("Dismissed") || d.byCat.has("Done") || d.byCat.has("Promoted")) && (
372
+ <>
373
+ <b className="mt-1.5 px-1.5 text-xs font-medium text-muted-foreground">Category</b>
374
+ <Picker
375
+ label="Category"
376
+ value={d.cat}
377
+ placeholder="All categories"
378
+ options={[
379
+ { value: "", label: "All categories" },
380
+ ...[...d.byCat].map(([k, { n }]) => ({ value: k, label: k, count: n })),
381
+ ]}
382
+ onChange={(v) => setIce({ cat: v })}
383
+ />
384
+ </>
385
+ )}
386
+ {d.bySrc.size > 1 && (
387
+ <>
388
+ <b className="mt-1.5 px-1.5 text-xs font-medium text-muted-foreground">Source</b>
389
+ <Picker
390
+ label="Source"
391
+ value={d.src}
392
+ placeholder="All sources"
393
+ options={[
394
+ { value: "", label: "All sources" },
395
+ ...[...groups].flatMap(([g, xs]) =>
396
+ xs.map(([k, it]) => ({
397
+ value: k,
398
+ group: g,
399
+ label: subName(srcName(d.list, it), g),
400
+ search: srcName(d.list, it),
401
+ count: d.bySrc.get(k)!.n,
402
+ icon: <Favicon url={it.source} social={srcOf(d.list, it)?.social} size={15} />,
403
+ })),
404
+ ),
405
+ ]}
406
+ groupIcons={Object.fromEntries(
407
+ [...groups].map(([g, xs]) => [
408
+ g,
409
+ <Favicon key={g} url={xs[0]![1].source} social={srcOf(d.list, xs[0]![1])?.social} size={15} />,
410
+ ]),
411
+ )}
412
+ onChange={(v) => setIce({ src: v })}
413
+ />
414
+ </>
415
+ )}
416
+ {nFilt > 0 && (
417
+ <Button
418
+ variant="ghost"
419
+ size="sm"
420
+ className="mt-1 justify-start"
421
+ onClick={() => setIce({ kinds: [], cat: "", src: "" })}
422
+ >
423
+ Clear filters
424
+ </Button>
425
+ )}
426
+ </PopoverContent>
427
+ </Popover>
428
+ {!narrow && (
429
+ <Segmented
430
+ label="View"
431
+ value={cardsOn ? "cards" : "sort"}
432
+ options={[
433
+ { id: "cards", label: "Cards" },
434
+ { id: "sort", label: "List" },
435
+ ]}
436
+ onChange={setView}
437
+ />
438
+ )}
439
+ <ActionMenu
440
+ label="More"
441
+ className="w-56"
442
+ items={[
443
+ ...(order.some(isWaiting)
444
+ ? [{ id: "ice-sw", label: "Swipe through them", onSelect: startSwipe }]
445
+ : []),
446
+ ...(narrow ? [{ id: "src-tog", label: `Sources · ${d.list.length}`, onSelect: () => setIce({ srcShow: true }) }] : []),
447
+ { id: "ice-nb2", label: "New collection…", onSelect: () => void newCollection(to, single ? "" : capP?.label || "this project") },
330
448
  ]}
331
- onChange={setView}
332
449
  />
333
- )}
334
- <span className="text-base font-semibold text-foreground">{countText}</span>
335
- <span className="flex-1" />
336
- {(d.byCat.size > 1 ||
337
- d.byCat.has("Dismissed") ||
338
- d.byCat.has("Done") ||
339
- d.byCat.has("Promoted") ||
340
- d.bySrc.size > 1) && (
341
- <FilterPopover label="Filter requests" active={filtering} className="flex flex-col gap-1.5 p-2">
342
- {(d.byCat.size > 1 || d.byCat.has("Dismissed") || d.byCat.has("Done") || d.byCat.has("Promoted")) && (
343
- <Picker
344
- label="Category"
345
- value={d.cat}
346
- placeholder="All categories"
347
- options={[
348
- { value: "", label: "All categories" },
349
- ...[...d.byCat].map(([k, { n }]) => ({ value: k, label: k, count: n })),
350
- ]}
351
- onChange={(v) => setIce({ cat: v })}
352
- />
353
- )}
354
- {d.bySrc.size > 1 && (
355
- <Picker
356
- label="Source"
357
- value={d.src}
358
- placeholder="All sources"
359
- options={[
360
- { value: "", label: "All sources" },
361
- ...[...groups].flatMap(([g, xs]) =>
362
- xs.map(([k, it]) => ({
363
- value: k,
364
- group: g,
365
- label: subName(srcName(d.list, it), g),
366
- search: srcName(d.list, it),
367
- count: d.bySrc.get(k)!.n,
368
- icon: <Favicon url={it.source} social={srcOf(d.list, it)?.social} size={15} />,
369
- })),
370
- ),
371
- ]}
372
- groupIcons={Object.fromEntries(
373
- [...groups].map(([g, xs]) => [
374
- g,
375
- <Favicon key={g} url={xs[0]![1].source} social={srcOf(d.list, xs[0]![1])?.social} size={15} />,
376
- ]),
377
- )}
378
- onChange={(v) => setIce({ src: v })}
379
- />
380
- )}
381
- </FilterPopover>
382
- )}
383
- {order.some(isWaiting) && (
384
- <Button
385
- variant="ghost"
386
- size="sm"
387
- id="ice-sw"
388
- title="Sort one at a time: swipe right to promote, left to dismiss"
389
- onClick={startSwipe}
390
- >
391
- <span aria-hidden="true">⇆</span> Swipe
392
- </Button>
393
- )}
394
- {!narrow && (
395
- <Button
396
- id="src-tog"
397
- ref={(el) => void (iceEls.srcTog = el)}
398
- size="sm"
399
- aria-expanded={s.srcShow}
400
- aria-controls="src-sec"
401
- title="Sources, and Gather all"
402
- onClick={() => setIce({ srcShow: true })}
403
- >
404
- <Icon name="link" className="size-3.5" /> Sources · {d.list.length}
405
- </Button>
406
- )}
450
+ </div>
407
451
  </div>
408
452
  {s.sel.length > 0 && (
409
453
  <BulkBar
@@ -431,9 +475,13 @@ function Icebox() {
431
475
  </Shell>
432
476
  );
433
477
  }
434
- // The page's one scroll area: it takes the board's page padding (28 px, 16 on a phone).
478
+ // The page's one scroll area: it takes the board's page padding (28 px, 16 on a phone). The bottom space is a spacer,
479
+ // not padding: a sticky pager stops at a scroll area's padding, and the cards would show through the gap under it.
435
480
  const Shell = ({ children }: { children: React.ReactNode }) => (
436
- <div className="flex min-h-0 flex-1 flex-col overflow-auto px-7 pt-6 pb-6 max-[900px]:px-4">{children}</div>
481
+ <div className="flex min-h-0 flex-1 flex-col overflow-auto px-7 pt-6 max-[900px]:px-4">
482
+ {children}
483
+ <div aria-hidden className="h-6 shrink-0" />
484
+ </div>
437
485
  );
438
486
  const Zero = ({ children }: { children: React.ReactNode }) => (
439
487
  <div className="rounded-md border border-[color:color-mix(in_srgb,var(--line)_50%,transparent)]">{children}</div>
@@ -402,8 +402,9 @@ body.runv .app{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-templa
402
402
  body.runv #runv{grid-area:1/1;display:flex;flex-direction:column;min-width:0;min-height:0}
403
403
  #rtabs{display:flex;align-items:center;gap:2px;height:var(--tabbar);min-height:var(--tabbar);padding:0 6px;overflow-x:auto;scrollbar-width:none;flex:1;min-width:0}#rtabs .sp{flex:1}#rbar{display:flex;align-items:center;flex:none;border-bottom:1px solid var(--line);padding-right:6px}
404
404
  /* the floating Home workspace (components/home/home-window.tsx): agents in kaizen's own folder, over every view; minimized to a row above the projects */
405
- .rail .plist.hwsslot{flex:none;min-height:0;overflow:visible}.rail .plist.hwsslot[hidden]{display:none}.hwsslot .proj .c{margin-left:auto}.hwsslot .wadd{opacity:.6}.hwsslot .plogo.hwsico{background:none;color:var(--ink);fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}[data-rail=min] .hwsslot .proj .hwsico use{display:inline}
406
- @media(max-width:640px){.hwsslot{display:none!important}}
405
+ /* Home's group: a house for its mark, and its open terminals as a small count button. */
406
+ .proj .plogo.hwsico{background:none;color:var(--ink);fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}[data-rail=min] .proj .hwsico use{display:inline}
407
+ .pgrp .hterm{display:inline-flex;align-items:center;flex:none;height:22px;margin-right:4px;border:1px solid var(--line);border-radius:var(--r-pill,999px);background:var(--bg-2);color:var(--muted);font-size:12px;font-variant-numeric:tabular-nums;overflow:hidden}.pgrp .hterm button{display:inline-flex;align-items:center;gap:3px;height:100%;padding:0 4px 0 7px;color:inherit}.pgrp .hterm button.hx{padding:0 6px 0 3px}.pgrp .hterm button:hover{background:var(--hover);color:var(--ink)}.pgrp .hterm svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.8}.pgrp .hterm .hx svg{width:11px;height:11px;stroke-width:2.2}[data-rail=min] .pgrp .hterm{display:none}
407
408
 
408
409
  #rpanes{flex:1;min-height:0;position:relative}
409
410
  .rframe{flex:1;min-height:0;width:100%;border:0;background:var(--bg-2)}webview.rframe{display:flex}.rframe[hidden]{display:none}
@@ -695,12 +696,6 @@ body.taskv .hdr #bq,body.taskv .hdr #newtop{display:none!important}
695
696
  @media(min-width:641px){.rail .top{margin-top:-2px}}
696
697
  /* A floating window held by its bar: the grabbing hand everywhere until it is let go (the bar itself shows the plain pointer). */
697
698
  html.grabbing,html.grabbing *{cursor:grabbing!important}
698
- /* The Home row is one rounded badge (a pill with a soft border), the count inside it. */
699
- .hwsslot .pgrp{margin:2px 0 6px;padding:0 4px 0 2px;border:1px solid var(--line);border-radius:var(--r-pill,999px);background:var(--bg-2)}
700
- .hwsslot .pgrp:hover{background:var(--hover)}
701
- /* Collapsed side menu: the Home pill is a round icon button, centred (not a tall oval). */
702
- [data-rail=min] .hwsslot .pgrp{width:32px;height:32px;margin:4px auto 6px;padding:0;border-radius:50%;display:grid;place-items:center}
703
- [data-rail=min] .hwsslot .proj{width:32px;height:32px;padding:0;margin:0;display:grid;place-items:center}
704
699
  /* The Terminal page's header bar: 40px like the run workspace's tab bar. */
705
700
  @media(min-width:641px){body.termv .hdr{height:40px;min-height:40px}}
706
701
  /* The run workspace's first tab starts at the card's edge (the tab's own 12px is the margin), not 6px further in. */