kaizen-agent 1.53.1 → 1.55.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.
@@ -0,0 +1,77 @@
1
+ import { test, expect } from "bun:test";
2
+ import { existsSync } from "node:fs";
3
+ import { join, dirname } from "node:path";
4
+
5
+ test("new notification sounds play real files while saved choices stay intact", async () => {
6
+ const oldListener = globalThis.addEventListener;
7
+ const oldStorage = globalThis.localStorage;
8
+ const oldAudio = globalThis.Audio;
9
+ const oldContext = globalThis.AudioContext;
10
+ const values = new Map<string, string>();
11
+ const played: string[] = [];
12
+ const tones: number[] = [];
13
+ (globalThis as any).addEventListener = () => {};
14
+ (globalThis as any).localStorage = { getItem: (key: string) => values.get(key) ?? null };
15
+ (globalThis as any).Audio = class {
16
+ constructor(readonly src: string) {}
17
+ play() {
18
+ played.push(this.src);
19
+ return Promise.resolve();
20
+ }
21
+ };
22
+ (globalThis as any).AudioContext = class {
23
+ currentTime = 0;
24
+ destination = {};
25
+ resume() {
26
+ return Promise.resolve();
27
+ }
28
+ createOscillator() {
29
+ return {
30
+ type: "",
31
+ frequency: { value: 0 },
32
+ connect(g: unknown) {
33
+ return g;
34
+ },
35
+ start() {
36
+ tones.push(1);
37
+ },
38
+ stop() {},
39
+ };
40
+ }
41
+ createGain() {
42
+ return {
43
+ gain: { setValueAtTime() {}, exponentialRampToValueAtTime() {} },
44
+ connect() {
45
+ return this;
46
+ },
47
+ };
48
+ }
49
+ };
50
+ try {
51
+ const { SOUNDS, soundPick, playSound, notifyUser } = await import("./toast.ts");
52
+ const samples = SOUNDS.filter((s) => !["off", "chime", "bell", "pop"].includes(s));
53
+ expect(samples).toHaveLength(10);
54
+ expect(soundPick()).toBe("Bellatrix");
55
+ notifyUser("done");
56
+ expect(played).toEqual(["/sounds/Bellatrix.mp3"]);
57
+ for (const name of samples) {
58
+ expect(existsSync(join(dirname(import.meta.dir), "sounds", `${name}.mp3`))).toBe(true);
59
+ playSound(name);
60
+ }
61
+ expect(played.slice(1)).toEqual(samples.map((name) => `/sounds/${name}.mp3`));
62
+ values.set("kz-sound", "off");
63
+ notifyUser("quiet");
64
+ expect(played).toHaveLength(11);
65
+ for (const name of ["chime", "bell", "pop"]) {
66
+ values.set("kz-sound", name);
67
+ expect(soundPick()).toBe(name);
68
+ notifyUser("legacy");
69
+ }
70
+ expect(tones).toHaveLength(4);
71
+ } finally {
72
+ globalThis.addEventListener = oldListener;
73
+ globalThis.localStorage = oldStorage;
74
+ globalThis.Audio = oldAudio;
75
+ globalThis.AudioContext = oldContext;
76
+ }
77
+ });
@@ -26,7 +26,7 @@ export function askNotify() {
26
26
  }
27
27
  // Per browser: whether notices go out at all, and the sound each one plays. The OS
28
28
  // notification's own sound is often silent (Windows toasts, focus assist), so the page
29
- // plays its own, synthesized: no audio files to ship.
29
+ // plays its own sound.
30
30
  const pref = (k, d) => {
31
31
  try {
32
32
  return localStorage.getItem(k) || d;
@@ -35,13 +35,18 @@ const pref = (k, d) => {
35
35
  }
36
36
  };
37
37
  export const notifyOn = () => pref("kz-notify", "on") === "on";
38
- export const soundPick = () => pref("kz-sound", "chime");
39
- export const SOUNDS = ["off", "chime", "bell", "pop"];
38
+ export const soundPick = () => pref("kz-sound", "Bellatrix");
39
+ const SAMPLES = ["Adara", "Alya", "Bellatrix", "Beryllium", "Cobalt", "Fluorine", "Krypton", "Palladium", "Rubidium", "Xenon"];
40
+ export const SOUNDS = ["off", ...SAMPLES, "chime", "bell", "pop"];
40
41
  // [frequency Hz, start s, length s] per note.
41
42
  const NOTES = { chime: [[880, 0, 0.25], [1320, 0.12, 0.35]], bell: [[660, 0, 0.9]], pop: [[520, 0, 0.08]] };
42
43
  let actx;
43
44
  export function playSound(name = soundPick()) {
44
45
  try {
46
+ if (SAMPLES.includes(name)) {
47
+ new Audio(`/sounds/${name}.mp3`).play().catch(() => {});
48
+ return;
49
+ }
45
50
  if (!NOTES[name]) return;
46
51
  actx = actx || new AudioContext();
47
52
  actx.resume();
package/web/board.html CHANGED
@@ -485,6 +485,33 @@ aside .foot .more .menu-pop{left:0;right:auto;top:auto;bottom:calc(100% + 4px)}.
485
485
  .ice-row:hover .ice-ra,.ice-row.cur .ice-ra,.ice-row:focus-within .ice-ra{display:flex}
486
486
  .ice-open{display:grid;gap:8px;padding:6px 12px 12px 61px}
487
487
  .ice-zero{padding:40px 16px;text-align:center;border:1px solid var(--line);border-radius:var(--r);background:var(--bg-2)}
488
+ /* Swipe view: one request at a time. On a phone it takes the whole screen. */
489
+ .sw{display:flex;flex-direction:column;gap:14px;width:100%;height:calc(100dvh - var(--sw-top,130px));min-height:420px}
490
+ .sw-top{display:flex;align-items:center;gap:10px}.sw-top .btn{flex-shrink:0}
491
+ .sw-prog{flex:1;height:6px;border-radius:3px;background:var(--line);overflow:hidden}.sw-prog i{display:block;height:100%;background:var(--accent);transition:width .3s}
492
+ .sw-of{color:var(--dim);font-size:12px;white-space:nowrap}
493
+ .sw-streak{position:relative;font-size:13px;white-space:nowrap}
494
+ .sw-plus{position:absolute;right:-4px;top:-14px;color:var(--ok);font-size:12px;animation:sw-up .8s ease-out forwards}@keyframes sw-up{to{transform:translateY(-14px);opacity:0}}
495
+ .sw-stack{position:relative;flex:1;display:grid;min-height:300px}
496
+ .sw-card{grid-area:1/1;position:relative;display:flex;flex-direction:column;gap:10px;padding:20px;border:1px solid var(--line);border-radius:var(--r);background:var(--bg-2);box-shadow:0 6px 24px rgb(0 0 0/.12);touch-action:pan-y;user-select:none;cursor:grab;overflow:auto}
497
+ .sw-card.drag{transition:none;cursor:grabbing}.sw-card:focus{outline:none}.sw-card:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
498
+ .sw-card.back{transform:scale(.95) translateY(10px);opacity:.6;pointer-events:none;overflow:hidden}
499
+ .sw-card.lift{position:fixed;z-index:95;margin:0}
500
+ .sw-hd{display:flex;align-items:center;gap:8px;color:var(--dim);font-size:12px}.sw-proj{display:inline-flex;align-items:center;gap:5px;padding:2px 8px;border:1px solid var(--line);border-radius:999px;color:var(--ink);max-width:45%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sw-src{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
501
+ .sw-t{font-size:clamp(20px,2vw,34px);line-height:1.45;margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
502
+ .sw-card .ice-notes{max-height:none}
503
+ .sw-stamp{position:absolute;top:18px;padding:4px 12px;border:3px solid;border-radius:8px;font-weight:700;font-size:20px;letter-spacing:.06em;text-transform:uppercase;pointer-events:none;opacity:0}
504
+ .sw-stamp.pro{left:18px;color:var(--ok);transform:rotate(-12deg);opacity:max(0,var(--p,0))}
505
+ .sw-stamp.dis{right:18px;color:var(--danger);transform:rotate(12deg);opacity:max(0,calc(-1*var(--p,0)))}
506
+ .sw-acts{display:flex;justify-content:center;gap:18px;padding-bottom:4px}
507
+ .sw-b{display:flex;flex-direction:column;align-items:center;gap:4px;background:none;border:0;color:var(--ink);cursor:pointer;font:inherit}
508
+ .sw-b span{display:grid;place-items:center;width:52px;height:52px;border-radius:50%;border:1px solid var(--line);background:var(--bg-2);font-size:18px;transition:transform .12s}
509
+ .sw-b span svg{width:20px;height:20px}.sw-b small{color:var(--dim);font-size:11px}
510
+ .sw-b.pro span,.sw-b.dis span{width:62px;height:62px}.sw-b.pro span{color:var(--ok);border-color:currentColor}.sw-b.dis span{color:var(--danger);border-color:currentColor}
511
+ .sw-b:hover:not(:disabled) span{transform:scale(1.08)}.sw-b:disabled{opacity:.35;cursor:default}
512
+ .sw-zero{position:relative;flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;text-align:center;padding:40px 16px;border:1px solid var(--line);border-radius:var(--r);background:var(--bg-2);overflow:hidden}.sw-zero h4{font-size:20px;margin:0}.sw-zero p{margin:0;color:var(--dim)}
513
+ .sw-confetti i{position:absolute;top:-10px;left:var(--x);width:8px;height:12px;background:hsl(var(--h) 80% 60%);animation:sw-fall 1.6s var(--d) ease-in forwards}@keyframes sw-fall{to{transform:translateY(420px) rotate(540deg);opacity:0}}
514
+ @media (max-width:640px){.sw{position:fixed;inset:0;z-index:90;height:auto;min-height:0;padding:max(12px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom));background:var(--bg)}.sw-t{font-size:20px}.sw-acts{gap:22px}}
488
515
  .ice-zero h4{margin:0 0 6px;font-size:14px;font-weight:600;color:var(--ink)}
489
516
  .ice-zero p{margin:0 auto;font-size:12px;color:var(--dim);line-height:1.5}
490
517
  .ice-open .hint{font-size:12px;color:var(--dim)}
@@ -526,7 +553,9 @@ body:not(.paged) .src-sec,body:not(.paged) .src-scrim{display:none}
526
553
  .src-f .sel:hover,.src-f .sel:focus{border-color:var(--line);background-color:var(--bg)}
527
554
  .src-f .btn{height:26px;padding:0 9px;font-size:12px}.src-f .btn:disabled{display:none}
528
555
  .src-f .plogo{width:16px;height:16px}
529
- .src-wb{grid-column:1/-1;display:flex;align-items:center;gap:6px;font-size:11px;color:var(--dim);cursor:pointer}.src-wb input{accent-color:var(--accent);margin:0}
556
+ .src-sws{display:flex;flex-wrap:wrap;gap:6px 20px;margin-top:10px}.src-sws:empty{display:none}
557
+ .src-sw{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--dim);cursor:pointer}
558
+ .chk.sm{width:34px;height:20px}.chk.sm::after{top:2px;left:2px;width:16px;height:16px}.chk.sm.on::after{transform:translateX(14px)}
530
559
  @media(max-width:640px){.src-fields{grid-template-columns:1fr}}
531
560
  .src-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
532
561
  .schip{display:inline-flex;align-items:center;gap:5px;height:24px;padding:0 9px;border-radius:var(--r-pill);border:1px solid var(--line);font-size:12px;color:var(--dim);text-decoration:none;cursor:pointer;white-space:nowrap}