kaizen-agent 1.59.1 → 1.59.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaizen-agent",
3
- "version": "1.59.1",
3
+ "version": "1.59.2",
4
4
  "description": "Staged workflow for AI agents — code, writing, research, operations: plan, human approval, build, independent review, bounded fix loop.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,6 +13,9 @@ let mode: "home" | "device" | null = null;
13
13
 
14
14
  const chev = raw(`<svg class="pchev" viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>`);
15
15
  const runs = () => railData().cards.filter((c) => c.kind === "run" && !c.archived);
16
+ // Ideas not started yet: a phone has no Ideas page, so the Runs page lists them.
17
+ const ideas = () => railData().cards.filter((c) => c.kind === "idea" && !c.archived);
18
+ const rowKey = (c) => (c.kind === "run" ? c.id : c.text);
16
19
  const projName = (dir: string) => {
17
20
  const l = railData().projects?.find((p) => p.dir === dir)?.label || dir.replace(/[\\/]\.kaizen$/, "");
18
21
  return l.split(/[\\/]/).pop() || l;
@@ -20,7 +23,7 @@ const projName = (dir: string) => {
20
23
 
21
24
  function row(c, now: number) {
22
25
  const name = projName(c.state);
23
- return html`<a class="prow" href="${cardHref(c)}" data-dir="${c.state}" data-id="${c.id}"><span class="si ${stateOf(c)}"></span><span class="pmain"><b>${titleOf(c)}</b><small>${logo(c.state, name, railData().projects)}${name}</small><code>${subline(c, now)}</code></span></a>`;
26
+ return html`<a class="prow" href="${cardHref(c)}" data-dir="${c.state}" data-id="${rowKey(c)}"><span class="si ${stateOf(c)}"></span><span class="pmain"><b>${titleOf(c)}</b><small>${logo(c.state, name, railData().projects)}${name}</small><code>${subline(c, now)}</code></span></a>`;
24
27
  }
25
28
 
26
29
  function home() {
@@ -47,7 +50,8 @@ function device() {
47
50
  const active = all.filter((c) => !wait.includes(c) && !done.includes(c));
48
51
  const group = (title: string, cs: any[], shut = false) =>
49
52
  cs.length ? html`<details class="pgrp"${raw(shut ? "" : " open")}><summary>${title}<span>${cs.length}</span></summary><div class="plist2">${cs.map((c) => row(c, now))}</div></details>` : "";
50
- return html`${group("Waiting on you", wait)}${group("Active", active)}${group("Done", done, true)}${all.length ? "" : html`<p class="pnote">No runs yet.</p>`}`;
53
+ const idle = ideas().sort((a, b) => (b.moved ?? b.added ?? 0) - (a.moved ?? a.added ?? 0));
54
+ return html`${group("Waiting on you", wait)}${group("Active", active)}${group("Ideas", idle)}${group("Done", done, true)}${all.length || idle.length ? "" : html`<p class="pnote">No runs yet.</p>`}`;
51
55
  }
52
56
 
53
57
  function draw() {
@@ -75,8 +79,27 @@ export function openPhone(m: "home" | "device" | null) {
75
79
  if (m === "home") void fetchNet();
76
80
  }
77
81
 
82
+ // A light tick on every tap of something pressable. Android has vibrate; iOS (18+) has none,
83
+ // but Safari ticks when a switch checkbox toggles, so a hidden one is toggled through its label.
84
+ let tick: HTMLLabelElement | null = null;
85
+ function haptic() {
86
+ if (navigator.vibrate) return void navigator.vibrate(8);
87
+ if (!tick) {
88
+ tick = document.createElement("label");
89
+ tick.hidden = true;
90
+ tick.innerHTML = `<input type="checkbox" switch>`;
91
+ document.body.append(tick);
92
+ }
93
+ tick.click();
94
+ }
95
+
78
96
  export function initPhone(go: (v: string, push?: boolean) => void, openRun: (c) => void) {
79
97
  addEventListener("kz-cards", draw);
98
+ addEventListener(
99
+ "click",
100
+ (e) => isPhone() && e.isTrusted && (e.target as HTMLElement).closest?.("button,a,summary,label,select,[role=button],input[type=checkbox]") && haptic(),
101
+ true,
102
+ );
80
103
  $("phome")?.addEventListener("click", (e) => {
81
104
  if ((e as MouseEvent).ctrlKey || (e as MouseEvent).metaKey) return;
82
105
  const a = (e.target as HTMLElement).closest<HTMLAnchorElement>("a");
@@ -84,7 +107,7 @@ export function initPhone(go: (v: string, push?: boolean) => void, openRun: (c)
84
107
  if (a.dataset.dev) return (e.preventDefault(), go("device", true));
85
108
  if (a.getAttribute("aria-disabled")) return e.preventDefault();
86
109
  if (a.classList.contains("prow")) {
87
- const c = runs().find((x) => x.state === a.dataset.dir && x.id === a.dataset.id);
110
+ const c = [...runs(), ...ideas()].find((x) => x.state === a.dataset.dir && rowKey(x) === a.dataset.id);
88
111
  if (c) (e.preventDefault(), openRun(c));
89
112
  }
90
113
  });
@@ -13,7 +13,7 @@ import { termLoad } from "./agent-term.ts";
13
13
  import { load, post } from "./api.ts";
14
14
  import { attach, md, preview } from "./markdown.ts";
15
15
  import { layout } from "./terms.ts";
16
- import { cardHref, markCurrent, railData } from "./workspace.ts";
16
+ import { cardHref, markCurrent, railData, titleOf } from "./workspace.ts";
17
17
  import { go } from "./views.ts";
18
18
 
19
19
  type Tab = { id: string; kind: "agent" | "shell" | "local" | "preview" | "note" | "wait"; title: string; key?: string; note?: string; agent?: string };
@@ -133,6 +133,8 @@ export async function showRunView() {
133
133
  // Each run has its own centre: switching runs unmounts this one's panes (its shells keep running on the server).
134
134
  if (fresh) stopPanes();
135
135
  card = c;
136
+ // A phone titles the workspace with the run, in the page header.
137
+ document.querySelector(".hdr h1")!.textContent = titleOf(c);
136
138
  if (fresh || store.openKey !== key(c)) open(c);
137
139
  try {
138
140
  const r = await fetch("/shells?dir=" + encodeURIComponent(c.state));
@@ -14,10 +14,12 @@ export let view = "board";
14
14
  // The board's own area, not the docked panel.
15
15
  const AREA = ["board", "terminal", "home", "ideas", "run", "chat", "device"];
16
16
  export const markView = (v) => {
17
+ // A phone's run workspace belongs to its Runs tab.
18
+ const lit = v === "run" && isPhone() ? "device" : v;
17
19
  document
18
20
  .querySelectorAll(".rail a.it")
19
21
  .forEach((a) =>
20
- a.dataset.view === v ? a.setAttribute("aria-current", "page") : a.removeAttribute("aria-current"),
22
+ a.dataset.view === lit ? a.setAttribute("aria-current", "page") : a.removeAttribute("aria-current"),
21
23
  );
22
24
  // The Icebox is titled in the header, top left, like the board.
23
25
  document.querySelector(".hdr h1").textContent = v === "sources" ? "Icebox" : v === "ideas" ? "Ideas" : v === "run" ? "Run" : v === "terminal" ? "Terminal" : v === "home" ? (isPhone() ? "kaizen" : "Home") : v === "chat" ? "Chat" : v === "device" ? "Runs" : "Board";
package/web/board.html CHANGED
@@ -27,6 +27,8 @@
27
27
  body{margin:0;background:var(--canvas);color:var(--ink);font:13px/1.5 var(--font);-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;height:100vh;height:100dvh;overflow:hidden;display:flex}
28
28
  html{background:var(--canvas);touch-action:manipulation}
29
29
  @media(display-mode:standalone){body{position:fixed;inset:0;height:auto;overscroll-behavior:none;touch-action:pan-x pan-y;-webkit-text-size-adjust:100%}}
30
+ /* iOS 26 stops a fixed inset:0 body short of the screen bottom on phones, leaving a strip under the tab bar */
31
+ @media(display-mode:standalone) and (max-width:640px){body{bottom:auto;height:100lvh}}
30
32
  @media(max-width:640px),(display-mode:standalone){body{padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}}
31
33
  /* iOS 26 blurs the page under the status bar unless a fixed bar touches the top edge: give it one in the page colour */
32
34
  @media(display-mode:standalone){body::before{content:"";position:fixed;top:0;left:0;right:0;height:env(safe-area-inset-top);background:inherit;z-index:100;pointer-events:none}}
@@ -125,7 +127,7 @@ body .rail a.upd::after{left:calc(50% + 6px);top:4px}body .toast{left:16px;botto
125
127
  .rail a.it:is([data-view=board],[data-view=ideas],[data-view=sources]),#foot,#ctx-open,body .rail .rbot .rib{display:none!important}
126
128
  .rail a.it.ponly{display:flex}
127
129
  .rail a.it[data-view=home]{order:1}.rail a.it[data-view=chat]{order:2}.rail a.it[data-view=device]{order:3}.rail a.it[data-view=settings]{order:4}
128
- .rail,[data-rail=min] .rail{padding:6px 8px calc(6px + env(safe-area-inset-bottom));border-top:1px solid color-mix(in srgb,var(--line) 70%,transparent)}
130
+ .rail,[data-rail=min] .rail{padding:6px 8px max(4px,calc(env(safe-area-inset-bottom) - 10px));border-top:1px solid color-mix(in srgb,var(--line) 70%,transparent)}
129
131
  .rail a.it,[data-rail=min] .rail a.it{min-height:50px;gap:3px;font-size:10.5px;letter-spacing:.01em}
130
132
  .rail a.it svg{width:44px;height:26px;padding:4px 12px;box-sizing:border-box;border-radius:13px;transition:background .15s}
131
133
  .rail a.it[aria-current=page] svg{background:color-mix(in srgb,var(--accent) 16%,transparent)}
@@ -133,13 +135,16 @@ body .rail a.upd::after{left:calc(50% + 6px);top:4px}body .toast{left:16px;botto
133
135
  }
134
136
  /* end side menu */
135
137
  @media(max-width:640px){
136
- body .hdr{padding:12px 16px 10px;gap:8px;border-bottom:0}
138
+ body .hdr{padding:28px 16px 12px;gap:8px;border-bottom:0}
137
139
  body.paged:is(.phomev,.homev) .hdr{display:flex!important;flex-wrap:nowrap}
138
- body .hdr h1{flex:1 1 auto;font-size:19px;letter-spacing:-.01em}
139
- body.homev #hnewtop{border-radius:19px}
140
+ body .hdr h1{flex:1 1 auto;min-width:0;font-size:20px;line-height:30px;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
141
+ /* one round + on every phone page; -4px keeps the header as tall as Settings' */
142
+ body.homev #hsidetop{margin:-4px 0}body.homev #hnewtop,body.phomev #newtop{display:inline-grid;place-items:center;flex:none;width:38px;height:38px;margin:-4px 0;padding:0;border-radius:19px;box-shadow:var(--shadow-2)}
143
+ body.homev #hnewtop svg,body.phomev #newtop svg{display:block;width:18px;height:18px}body.phomev #newtop span{display:none}
144
+ /* the run workspace: a page header with the run's title, the Runs tab lit; a lone pane drops its own header */
145
+ html body.runv .app{grid-template-rows:auto minmax(0,1fr)}html body.runv .hdr{display:flex!important;grid-area:1/1}html body.runv .hdr>:not(h1){display:none!important}html body.runv #runv{grid-area:2/1}
146
+ html body.runv #rtabs{padding:0 10px 6px}body.runv .rpane:not(.split)>.ph{display:none}
140
147
  body.phomev .hdr>:not(h1):not(#newtop),body.phomev #board{display:none!important}
141
- body.phomev #newtop{display:inline-grid;place-items:center;width:38px;height:38px;padding:0;font-size:0;border-radius:19px}
142
- body.phomev #newtop::before{content:"+";display:block;height:38px;font-size:24px;font-weight:300;line-height:36px}
143
148
  body.pdevv #newtop{display:none!important}
144
149
  body.phomev #phome{display:block;flex:1;min-height:0;overflow:auto;padding:4px 16px 24px;animation:fi .2s}
145
150
  }
@@ -795,7 +800,7 @@ body.ideav.paged .hdr{display:flex}body.ideav.paged #bq{display:block}body.ideav
795
800
  @media(min-width:641px){.app .hdr,#ideasv .hdr.ihdr,#rtabs,#panel.docked>header{height:52px;min-height:52px;box-sizing:border-box;padding-top:0;padding-bottom:0;border-bottom:1px solid var(--line);align-items:center;flex-wrap:nowrap}.itable th{border-bottom-color:var(--line)}}
796
801
 
797
802
  /* Ideas header on a small laptop: one row, nothing wraps; the search box gives way first. */
798
- #newtop{white-space:nowrap}@media(min-width:641px) and (max-width:1440px){body.ideav .app .hdr{gap:8px;padding:8px 12px 8px 20px;height:auto;flex-wrap:wrap}body.ideav #bq{flex:1 1 120px;width:auto;min-width:90px}body.ideav #hx{gap:6px;min-width:0}body.ideav #hx .iseg{gap:2px}body.ideav #hx .pill{padding:4px 8px}body.ideav #hx .ipop .sel{max-width:130px}}
803
+ #newtop{white-space:nowrap}#newtop svg{display:none}@media(min-width:641px) and (max-width:1440px){body.ideav .app .hdr{gap:8px;padding:8px 12px 8px 20px;height:auto;flex-wrap:wrap}body.ideav #bq{flex:1 1 120px;width:auto;min-width:90px}body.ideav #hx{gap:6px;min-width:0}body.ideav #hx .iseg{gap:2px}body.ideav #hx .pill{padding:4px 8px}body.ideav #hx .ipop .sel{max-width:130px}}
799
804
  </style>
800
805
  </head>
801
806
  <body>
@@ -937,7 +942,7 @@ body.ideav.paged .hdr{display:flex}body.ideav.paged #bq{display:block}body.ideav
937
942
  <span class="hx" id="hx"></span>
938
943
  <span class="sp"></span>
939
944
  <span class="bar" id="tmodes" role="group" aria-label="Layout"></span>
940
- <button class="btn pri" id="newtop">New idea</button>
945
+ <button class="btn pri" id="newtop"><svg><use href="#i-plus"/></svg><span>New idea</span></button>
941
946
  <button class="ib" id="ctx-open" aria-label="Open side panel" title="Notes, files and terminals"><svg><use href="#i-side"/></svg></button>
942
947
  <button class="ib" id="hpop" title="Pop out chat" aria-label="Pop out chat"><svg><use href="#i-popout"/></svg></button>
943
948
  <button class="btn pri" id="hnewtop" aria-label="New chat"><svg><use href="#i-plus"/></svg><span>New chat</span></button>