kaizen-agent 1.31.3 → 1.32.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.
package/cli/web.ts CHANGED
@@ -49,10 +49,11 @@ export async function current(url: string) {
49
49
  }
50
50
 
51
51
  // The newest kaizen on npm, asked at most every six hours; a failed ask is retried
52
- // on the next one. Same registry call as npmLatest() in install.ts, which exports nothing.
52
+ // on the next one; fresh (Settings' Check for updates) skips the cache. Same registry
53
+ // call as npmLatest() in install.ts, which exports nothing.
53
54
  let latest: { v: string | null; at: number } = { v: null, at: 0 };
54
- async function npmLatest() {
55
- if (latest.v && Date.now() - latest.at < 6 * 3600_000) return latest.v;
55
+ async function npmLatest(fresh = false) {
56
+ if (!fresh && latest.v && Date.now() - latest.at < 6 * 3600_000) return latest.v;
56
57
  try {
57
58
  const r = await fetch("https://registry.npmjs.org/kaizen-agent/latest", { signal: AbortSignal.timeout(10000) });
58
59
  const v = ((await r.json()) as { version?: string }).version ?? null;
@@ -461,7 +462,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
461
462
 
462
463
  // What this board runs and what npm has: the page shows an Update button on a newer one.
463
464
  if (req.method === "GET" && path === "/version") {
464
- const v = await npmLatest();
465
+ const v = await npmLatest(url.searchParams.has("fresh"));
465
466
  return json({ version: VERSION, latest: v, update: !!v && newer(v, VERSION) });
466
467
  }
467
468
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaizen-agent",
3
- "version": "1.31.3",
3
+ "version": "1.32.0",
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": {
package/web/board.html CHANGED
@@ -288,6 +288,7 @@ aside .foot .more .menu-pop{left:0;right:auto;top:auto;bottom:calc(100% + 4px)}.
288
288
  .toast.on{opacity:1}
289
289
  .rail a.upd svg{overflow:visible}.rail a.upd{position:relative}.rail a.upd::after{content:"";position:absolute;left:28px;top:8px;width:8px;height:8px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 2px var(--bg)}
290
290
  .updbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;justify-content:space-between;margin:0 0 36px;padding:10px 14px;border:1px solid var(--accent);border-radius:var(--r);background:color-mix(in srgb,var(--accent) 10%,var(--bg-2));font-size:13px}
291
+ .updbar.quiet{border-color:var(--line);background:var(--bg-2);color:var(--dim)}
291
292
  .toast.on.rep{pointer-events:auto}.toast a{color:inherit;margin-left:8px;text-decoration:underline;text-underline-offset:2px}
292
293
  .help{position:fixed;inset:0;z-index:12;display:none;align-items:center;justify-content:center;background:color-mix(in srgb,var(--bg) 60%,transparent);backdrop-filter:blur(3px)}
293
294
  .help.on{display:flex}.help div{background:var(--bg-2);border:1px solid var(--line);border-radius:var(--r);padding:24px 28px;box-shadow:var(--shadow-2)}
@@ -1445,10 +1446,17 @@ document.addEventListener("click",e=>{if(!e.target.closest("#showc")){$("showpop
1445
1446
  $("newtop").onclick=()=>{mode="new";render();$("board").scrollTo(0,0)};
1446
1447
  // A newer kaizen on npm: a dot on Settings, and an Update bar at the top of that page.
1447
1448
  // The server upgrades and starts a board on the new version, which replaces this one;
1448
- // the hello with its new boot id reloads the page (listen()).
1449
- let upd=null;
1450
- fetch("/version").then(r=>r.json()).then(v=>{if(!v.update)return;upd=v;const a=document.querySelector('.rail a[data-view="settings"]');a.classList.add("upd");a.title=`Settings: kaizen ${v.latest} is available`;if(view==="settings")openSettings()}).catch(()=>{});
1451
- function updBar(){if(!upd)return;const d=document.createElement("div");d.className="updbar";d.innerHTML=`<span>kaizen <b>${esc(upd.latest)}</b> is available. You are running ${esc(upd.version)}.</span><button class="btn pri" id="upd-go">Update kaizen</button>`;$("pbody").prepend(d);
1449
+ // the hello with its new boot id reloads the page (listen()). With none known, the bar
1450
+ // is a quiet row whose Check for updates asks npm now instead of the server's 6 h cache.
1451
+ let upd=null,ver=null;
1452
+ function gotVer(v){ver=v;if(!v.update)return false;upd=v;const a=document.querySelector('.rail a[data-view="settings"]');a.classList.add("upd");a.title=`Settings: kaizen ${v.latest} is available`;return true}
1453
+ fetch("/version").then(r=>r.json()).then(v=>{if(gotVer(v)&&view==="settings")openSettings()}).catch(()=>{});
1454
+ function updBar(){if(!upd){const d=document.createElement("div");d.className="updbar quiet";d.innerHTML=`<span id="upd-msg" aria-live="polite">${ver?`You are running kaizen ${esc(ver.version)}.`:"kaizen"}</span><button class="btn" id="upd-chk">Check for updates</button>`;$("pbody").prepend(d);
1455
+ const b=$("upd-chk");b.onclick=async()=>{b.disabled=true;b.textContent="Checking…";const v=await fetch("/version?fresh=1").then(r=>r.json()).catch(()=>null);
1456
+ if(!d.isConnected)return;b.disabled=false;b.textContent="Check for updates";
1457
+ if(v&&gotVer(v)){d.remove();updBar();$("upd-go").focus();return}
1458
+ $("upd-msg").textContent=!v||!v.latest?"Could not reach npm. Try again later.":`kaizen ${v.version} is up to date.`};return}
1459
+ const d=document.createElement("div");d.className="updbar";d.innerHTML=`<span>kaizen <b>${esc(upd.latest)}</b> is available. You are running ${esc(upd.version)}.</span><button class="btn pri" id="upd-go">Update kaizen</button>`;$("pbody").prepend(d);
1452
1460
  const b=$("upd-go");b.onclick=async()=>{if(!confirm(`Update kaizen to ${upd.latest}? The board restarts, and agents running inside cards stop.`))return;b.disabled=true;b.textContent="Updating…";
1453
1461
  const r=await post("/upgrade",{});if(!r.ok){b.disabled=false;b.textContent="Update kaizen";return}b.textContent="Restarting…";setTimeout(()=>location.reload(),20000)}}
1454
1462
  $("kbd").onclick=()=>$("help").classList.add("on");$("help").onclick=()=>$("help").classList.remove("on");