kaizen-agent 1.64.0 → 1.64.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.
Files changed (62) hide show
  1. package/README.md +10 -10
  2. package/agents/kaizen-planner.md +2 -2
  3. package/cli/backlog.test.ts +1 -1
  4. package/cli/board.test.ts +24 -24
  5. package/cli/dashboard.ts +15 -15
  6. package/cli/install.ts +6 -3
  7. package/cli/notes.test.ts +3 -3
  8. package/cli/notes.ts +1 -1
  9. package/cli/settings.ts +5 -5
  10. package/cli/sources.test.ts +32 -32
  11. package/cli/sources.ts +15 -15
  12. package/cli/state.test.ts +74 -51
  13. package/cli/state.ts +69 -48
  14. package/cli/web.ts +53 -33
  15. package/commands/kaizen-discover.md +1 -1
  16. package/package.json +1 -1
  17. package/skills/kaizen/README.md +2 -2
  18. package/skills/kaizen/SKILL.md +2 -2
  19. package/skills/kaizen/config.default.yml +22 -22
  20. package/skills/kaizen/discover.md +8 -8
  21. package/skills/kaizen/gather.md +2 -2
  22. package/skills/kaizen/spec-plan.md +1 -1
  23. package/skills/kaizen/spec.md +1 -1
  24. package/skills/kaizen-help/SKILL.md +2 -2
  25. package/web/board/api.ts +10 -10
  26. package/web/board/cards.ts +46 -46
  27. package/web/board/icebox.ts +14 -14
  28. package/web/board/keys.ts +3 -3
  29. package/web/board/labels.ts +2 -2
  30. package/web/board/live.ts +3 -3
  31. package/web/board/main.ts +1 -1
  32. package/web/board/markdown.ts +1 -1
  33. package/web/board/panel.ts +17 -17
  34. package/web/board/phone.ts +7 -7
  35. package/web/board/projects.ts +6 -6
  36. package/web/board/run-view.ts +8 -6
  37. package/web/board/search.ts +11 -11
  38. package/web/board/settings-cleanup.ts +42 -0
  39. package/web/board/settings-pages.ts +1 -1
  40. package/web/board/settings.ts +13 -0
  41. package/web/board/store.ts +1 -1
  42. package/web/board/{ideas.ts → tasks.ts} +22 -22
  43. package/web/board/terms.ts +3 -3
  44. package/web/board/views.ts +23 -12
  45. package/web/board/workspace.ts +7 -7
  46. package/web/board/ws-board-ui.ts +1 -1
  47. package/web/board/ws-board.test.ts +1 -1
  48. package/web/board/ws-board.ts +1 -1
  49. package/web/board/ws-tabs.test.ts +2 -2
  50. package/web/board/ws-tabs.ts +2 -2
  51. package/web/board.html +33 -33
  52. package/web/board.js +122 -122
  53. package/web/notebook.js +17 -17
  54. package/web/notebook.ts +5 -5
  55. package/web/notes-lib.ts +2 -2
  56. package/web/notes.html +11 -11
  57. package/web/term-font.test.ts +22 -0
  58. package/web/term-font.ts +30 -0
  59. package/web/term.js +40 -40
  60. package/web/term.ts +42 -4
  61. package/web/video.html +11 -11
  62. package/web/video.js +24 -24
@@ -4,12 +4,12 @@ import { load, post } from "./api.ts";
4
4
  import { via } from "./cards.ts";
5
5
  import { mic, stopDictation } from "./dictation.ts";
6
6
  import { $, dataUrls, html, ico, modal, motion, pageOf, pager, pagerHtml, raw, SKEL, wirePager } from "./dom.ts";
7
- import { ideaCombo, newDir, plogo, setShown, short, showable } from "./projects.ts";
7
+ import { taskCombo, newDir, plogo, setShown, short, showable } from "./projects.ts";
8
8
  import { playSound, soundPick, toast } from "./toast.ts";
9
9
  import { go, view } from "./views.ts";
10
10
 
11
11
  // ---- the icebox: requests gathered from request sources, read like an inbox, until
12
- // someone promotes them to ideas or dismisses them. The sources themselves sit in a
12
+ // someone promotes them to tasks or dismisses them. The sources themselves sit in a
13
13
  // section below, folded. Same panel as settings.
14
14
  const SRC = "Icebox";
15
15
  // What the page keeps across the rebuild every server change brings: the item whose
@@ -344,10 +344,10 @@ export async function openSources() {
344
344
  const bulk = iceSel.size
345
345
  ? html`<div class="ice-bulk" role="toolbar" aria-label="Selected requests"><span>${iceSel.size} selected</span><span class="end"></span><button class="btn sm" id="ice-bp" title="Promote (p)">${ico("plus")} Promote</button><button class="btn ghost sm" id="ice-bd" title="Dismiss (d)">${ico("x")} Dismiss</button><button class="btn ghost sm" id="ice-bc" title="Clear selection (Esc)">Clear</button></div>`
346
346
  : "";
347
- // The open item's form: a clean title for the idea's card and the person's own details;
348
- // what was gathered is added to the idea's notes by the server.
347
+ // The open item's form: a clean title for the task's card and the person's own details;
348
+ // what was gathered is added to the task's notes by the server.
349
349
  const form = (it) =>
350
- html`<div class="ice-form"><label for="ice-title" class="hint" style="margin:0">Idea title</label><input class="sel" id="ice-title" data-k="${iceKey(it)}" maxlength="200" value="${it.text}" aria-label="Idea title"><label for="ice-details" class="hint" style="margin:0">Details</label><textarea class="sel" id="ice-details" rows="3" aria-label="Details"></textarea><div class="ice-form-acts"><span class="end"></span><button class="btn ghost sm" id="ice-cancel">Cancel</button><button class="btn pri sm" id="ice-ok">Promote</button></div></div>`;
350
+ html`<div class="ice-form"><label for="ice-title" class="hint" style="margin:0">Task title</label><input class="sel" id="ice-title" data-k="${iceKey(it)}" maxlength="200" value="${it.text}" aria-label="Task title"><label for="ice-details" class="hint" style="margin:0">Details</label><textarea class="sel" id="ice-details" rows="3" aria-label="Details"></textarea><div class="ice-form-acts"><span class="end"></span><button class="btn ghost sm" id="ice-cancel">Cancel</button><button class="btn pri sm" id="ice-ok">Promote</button></div></div>`;
351
351
  // A gathered post can be answered: Reply drafts, the box is the approval, Send reply posts that text.
352
352
  const replyBox = (it) => {
353
353
  if (!it.post) return "";
@@ -369,7 +369,7 @@ export async function openSources() {
369
369
  const it = ice[i],
370
370
  k = iceKey(it),
371
371
  open = iceForm === k;
372
- const head = html`<div class="ice-row${iceCur === k ? " cur" : ""}${iceSel.has(k) ? " sel" : ""}" data-i="${i}" data-k="${k}"><input type="checkbox" id="ice-ck-${i}" data-ck="${i}"${iceSel.has(k) ? " checked" : ""} aria-label="Select: ${it.text}"><span class="ice-src" title="${srcName(it)}">${fav(it.source, "link", list.find((x) => x.dir === it.dir && x.url === it.source)?.social)}</span><button class="ice-t" id="ice-o-${i}" data-o="${i}" aria-expanded="${String(open)}" title="${it.text}">${it.text}</button><span class="ice-meta">${many ? html`<span class="nm" title="${it.project || ""}">${plogo(it.dir, it.project || "")}${short(it.project || "")}</span>` : ""}${it.status === "done" && it.written ? html`<span title="Written back ${ago(it.written)}">written back</span>` : ""}${it.status === "done" && it.writeError ? html`<span title="${it.writeError}">write-back failed</span>` : ""}${it.status === "promoted" ? html`<span title="Promoted to Ideas: ${it.idea || ""}">promoted</span>` : ""}${it.replied ? html`<span title="Replied ${ago(it.replied)}">replied</span>` : ""}<span class="ice-age">${ago(it.at)}</span><span class="ice-ra">${it.status === "promoted" || it.status === "done" ? "" : html`<button class="btn ghost sm" id="ice-pr-${i}" data-pr="${i}" title="Promote to Ideas (p)" aria-label="Promote to Ideas: ${it.text}">${ico("plus")}</button>`}${it.status === "promoted" || it.status === "done" ? "" : it.status === "dismissed" ? html`<button class="btn ghost sm" id="ice-rs-${i}" data-rs="${i}" title="Restore to waiting" aria-label="Restore: ${it.text}">Restore</button>` : html`<button class="btn ghost sm" id="ice-ds-${i}" data-ds="${i}" title="Dismiss (d)" aria-label="Dismiss: ${it.text}">${ico("x")}</button>`}</span></span></div>`;
372
+ const head = html`<div class="ice-row${iceCur === k ? " cur" : ""}${iceSel.has(k) ? " sel" : ""}" data-i="${i}" data-k="${k}"><input type="checkbox" id="ice-ck-${i}" data-ck="${i}"${iceSel.has(k) ? " checked" : ""} aria-label="Select: ${it.text}"><span class="ice-src" title="${srcName(it)}">${fav(it.source, "link", list.find((x) => x.dir === it.dir && x.url === it.source)?.social)}</span><button class="ice-t" id="ice-o-${i}" data-o="${i}" aria-expanded="${String(open)}" title="${it.text}">${it.text}</button><span class="ice-meta">${many ? html`<span class="nm" title="${it.project || ""}">${plogo(it.dir, it.project || "")}${short(it.project || "")}</span>` : ""}${it.status === "done" && it.written ? html`<span title="Written back ${ago(it.written)}">written back</span>` : ""}${it.status === "done" && it.writeError ? html`<span title="${it.writeError}">write-back failed</span>` : ""}${it.status === "promoted" ? html`<span title="Promoted to Tasks: ${it.idea || ""}">promoted</span>` : ""}${it.replied ? html`<span title="Replied ${ago(it.replied)}">replied</span>` : ""}<span class="ice-age">${ago(it.at)}</span><span class="ice-ra">${it.status === "promoted" || it.status === "done" ? "" : html`<button class="btn ghost sm" id="ice-pr-${i}" data-pr="${i}" title="Promote to Tasks (p)" aria-label="Promote to Tasks: ${it.text}">${ico("plus")}</button>`}${it.status === "promoted" || it.status === "done" ? "" : it.status === "dismissed" ? html`<button class="btn ghost sm" id="ice-rs-${i}" data-rs="${i}" title="Restore to waiting" aria-label="Restore: ${it.text}">Restore</button>` : html`<button class="btn ghost sm" id="ice-ds-${i}" data-ds="${i}" title="Dismiss (d)" aria-label="Dismiss: ${it.text}">${ico("x")}</button>`}</span></span></div>`;
373
373
  const more = open
374
374
  ? html`<div class="ice-open">${it.notes ? html`<div class="ice-notes">${it.notes}</div>` : ""}${imgs(it)}<span class="hint" style="margin:0">From ${srcName(it)} · ${ago(it.at)}${it.post ? html` · <a href="${it.post}" target="_blank" rel="noopener">open post</a>` : ""}</span>${replyBox(it)}${icePro === k ? form(it) : ""}</div>`
375
375
  : "";
@@ -380,13 +380,13 @@ export async function openSources() {
380
380
  ? html`<div class="ice-zero"><h4>No matches</h4><p style="margin-top:10px"><button class="btn sm" id="ice-unf">Clear filters</button></p></div>`
381
381
  : order.length
382
382
  ? html`<div class="tk-list ice-list">${[...groups].map(([g, ix]) => (ix.some((i) => onPage.has(i)) ? html`<div class="ice-cat">${g}<i>${ix.length}</i></div>${ix.filter((i) => onPage.has(i)).map(row)}` : ""))}${pagerHtml(icePg)}</div>`
383
- : html`<div class="ice-zero"><h4>Nothing waiting</h4><p>Requests gathered from your sources wait here until you turn them into ideas.</p>${list.length ? "" : html`<p style="margin-top:10px"><button class="btn sm pri" id="ice-addsrc">${ico("plus")} Add a source</button></p>`}</div>`;
383
+ : html`<div class="ice-zero"><h4>Nothing waiting</h4><p>Requests gathered from your sources wait here until you turn them into tasks.</p>${list.length ? "" : html`<p style="margin-top:10px"><button class="btn sm pri" id="ice-addsrc">${ico("plus")} Add a source</button></p>`}</div>`;
384
384
  // Swipe: the waiting requests the filters show, least skipped first; a restored one
385
385
  // comes back on top. Nothing is written by a skip.
386
386
  const deck = iceSwipe
387
387
  ? filtered.filter((i) => isWaiting(ice[i])).sort((a, b) => (iceSwipe.skip.get(iceKey(ice[a])) || 0) - (iceSwipe.skip.get(iceKey(ice[b])) || 0))
388
388
  : [];
389
- // The card always names its project: a swipe decides for that project's Ideas.
389
+ // The card always names its project: a swipe decides for that project's Tasks.
390
390
  const pName = (it) => it.project || store.S.projects.find((p) => p.dir === it.dir)?.label || "";
391
391
  const swCard = (i, back) => {
392
392
  const it = ice[i];
@@ -677,7 +677,7 @@ export async function openSources() {
677
677
  }
678
678
  if (srcOpen()) openSources().then(focusCur);
679
679
  })();
680
- // Bulk: one dismiss per project; promote one request at a time, each its own idea
680
+ // Bulk: one dismiss per project; promote one request at a time, each its own task
681
681
  // titled as gathered (one promote call with several ids would merge them into one).
682
682
  const bulkDo = async (op) => {
683
683
  const its = ice.filter((it) => iceSel.has(iceKey(it)));
@@ -699,7 +699,7 @@ export async function openSources() {
699
699
  iceSel.clear();
700
700
  if (ok)
701
701
  toast(
702
- `${ok} ${op === "promote" ? "promoted to Ideas" : "dismissed"}${ok < its.length ? `, ${its.length - ok} not` : ""}`,
702
+ `${ok} ${op === "promote" ? "promoted to Tasks" : "dismissed"}${ok < its.length ? `, ${its.length - ok} not` : ""}`,
703
703
  );
704
704
  load();
705
705
  if (srcOpen()) openSources().then(focusCur);
@@ -861,7 +861,7 @@ export async function openSources() {
861
861
  return;
862
862
  }
863
863
  $("ice-ok").disabled = true;
864
- iceAct("promote", open1, "Promoted to Ideas", { text: title, details: $("ice-details").value });
864
+ iceAct("promote", open1, "Promoted to Tasks", { text: title, details: $("ice-details").value });
865
865
  };
866
866
  $("ice-ok").onclick = ok;
867
867
  $("ice-cancel").onclick = () => {
@@ -908,7 +908,7 @@ export async function openSources() {
908
908
  if (j.ok) {
909
909
  S.n++;
910
910
  op === "promote" ? S.pro++ : S.dis++;
911
- // Only a dismiss can be undone here: a promote has already made an idea card.
911
+ // Only a dismiss can be undone here: a promote has already made a task card.
912
912
  S.last = op === "dismiss" ? it : null;
913
913
  S.pop = true;
914
914
  } else toast(`Could not ${op}: ${j.error || "kaizen did not answer"}`);
@@ -1181,7 +1181,7 @@ export async function openSources() {
1181
1181
  $("ice-new").onclick = () => {
1182
1182
  const all = !dir;
1183
1183
  if (!dir && !showable().length) return toast("Pick a project first");
1184
- // The new-idea form, cut down: the request, files, dictation and, in All projects, the project.
1184
+ // The new-task form, cut down: the request, files, dictation and, in All projects, the project.
1185
1185
  const dl = modal(
1186
1186
  `${all ? `<div class="combo" id="ndc"><button type="button" class="sel" id="newdir" aria-label="Project for this request" aria-haspopup="listbox" aria-expanded="false"></button><div class="menu-pop" hidden><input class="sel" aria-label="Search projects" placeholder="Search projects…" spellcheck="false" autocomplete="off"><div id="nds" role="listbox"></div></div></div>` : ""}<textarea id="newidea" placeholder="What did someone ask for?" aria-label="Request"></textarea><div class="att"></div><input type="file" multiple hidden><div class="row"><button type="button" class="ib" id="newpick" aria-label="Attach files" title="Attach files">${ico("clip")}</button><button type="button" class="btn ghost" value="">Cancel</button><button class="btn pri">Add</button></div>`,
1187
1187
  );
@@ -1206,7 +1206,7 @@ export async function openSources() {
1206
1206
  }
1207
1207
  };
1208
1208
  f.querySelector(".btn.ghost").onclick = () => dl.close();
1209
- if (all) ideaCombo(f);
1209
+ if (all) taskCombo(f);
1210
1210
  const m = mic([inp]);
1211
1211
  if (m) f.querySelector(".row").prepend(m);
1212
1212
  dl.addEventListener("close", () => stopDictation(false));
package/web/board/keys.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { store } from "./store.ts";
2
2
  import { load } from "./api.ts";
3
- import { focusedKey, formPopup, key, nav, newIdea, render, runPopup } from "./cards.ts";
3
+ import { focusedKey, formPopup, key, nav, newTask, render, runPopup } from "./cards.ts";
4
4
  import { $ } from "./dom.ts";
5
5
  import { iceNav, srcOpen } from "./icebox.ts";
6
6
  import { close, openRun } from "./panel.ts";
@@ -38,7 +38,7 @@ export function initKeys() {
38
38
  $("sq").focus();
39
39
  return;
40
40
  }
41
- if (e.key === "/" && (view === "board" || view === "ideas") && $("bq")) {
41
+ if (e.key === "/" && (view === "board" || view === "tasks") && $("bq")) {
42
42
  e.preventDefault();
43
43
  $("bq").focus();
44
44
  return;
@@ -54,7 +54,7 @@ export function initKeys() {
54
54
  // The Terminal page has no cards to move between; its keys are the terminals'.
55
55
  if (view === "terminal") return;
56
56
  if (e.key === "n" && !document.querySelector("dialog[open]")) {
57
- newIdea();
57
+ newTask();
58
58
  }
59
59
  if (e.key === "a") {
60
60
  store.all = !store.all;
@@ -16,11 +16,11 @@ export const NAMES = {
16
16
  unrechecked: "fix not rechecked",
17
17
  };
18
18
  export const MARKS = { claude: 1, codex: 1, agy: 1, opencode: 1, gemini: 1, cursor: 1, full: 1, lite: 1 };
19
- // The new-idea picker's starting project: the one asked for if it is offered, else none
19
+ // The new-task picker's starting project: the one asked for if it is offered, else none
20
20
  // when a choice is required, else the first offered.
21
21
  export const startDir = (offered: string[], want: string | null, choose: boolean) =>
22
22
  want && offered.includes(want) ? want : choose ? null : (offered[0] ?? null);
23
- export const COLS = ["Ideas", "Planning", "Building", "Review", "Done"];
23
+ export const COLS = ["Tasks", "Planning", "Building", "Review", "Done"];
24
24
  // state.ts statuses onto the icon set in the <defs> above.
25
25
  export const ICON = {
26
26
  idea: "idea",
package/web/board/live.ts CHANGED
@@ -33,7 +33,7 @@ function listen() {
33
33
  // Back to the project picked last time, unless the URL says which view it wants. A
34
34
  // plain fetch: a project that is gone should fall back to all, not raise a toast.
35
35
  // A page named in the address shows from the first paint; it is filled once the board has loaded.
36
- const v0 = ((v) => (v === "icebox" ? "sources" : v === "ws" ? "run" : v))(new URLSearchParams(location.search).get("view"));
36
+ const v0 = ((v) => (v === "icebox" ? "sources" : v === "ws" ? "run" : v === "ideas" ? "tasks" : v))(new URLSearchParams(location.search).get("view"));
37
37
 
38
38
  export function initLive() {
39
39
  addEventListener("kz-view", () => { if (pendingReload && !document.body.classList.contains("homev")) location.reload(); });
@@ -41,13 +41,13 @@ export function initLive() {
41
41
  addEventListener("focus", () => load(true));
42
42
  addEventListener("visibilitychange", flushLoad);
43
43
  // No view in the address is Home.
44
- const first = ["settings", "sources", "terminal", "board", "ideas", "run"].includes(v0) ? v0 : "home";
44
+ const first = ["settings", "sources", "terminal", "board", "tasks", "run"].includes(v0) ? v0 : "home";
45
45
  markView(first);
46
46
  document.body.classList.toggle("paged", first !== "board");
47
47
  document.body.classList.toggle("ice", v0 === "sources");
48
48
  document.body.classList.toggle("termv", v0 === "terminal");
49
49
  document.body.classList.toggle("homev", first === "home");
50
- document.body.classList.toggle("ideav", first === "ideas");
50
+ document.body.classList.toggle("taskv", first === "tasks");
51
51
  document.body.classList.toggle("runv", first === "run");
52
52
  (async () => {
53
53
  let d;
package/web/board/main.ts CHANGED
@@ -31,7 +31,7 @@ filterBox();
31
31
  statusSheet();
32
32
  initRail();
33
33
  initFooter(() => go("terminal", true));
34
- // The rail's rows and + open a card or the new-idea form here, on the board, when it has them.
34
+ // The rail's rows and + open a card or the new-task form here, on the board, when it has them.
35
35
  // A row of another project than the one picked switches the board to that project first.
36
36
  addEventListener("kz-open-card", (e: any) => {
37
37
  const { dir, id, text } = e.detail;
@@ -57,7 +57,7 @@ export function planQuestions(src) {
57
57
  const qs = out.filter((x) => x.options.length);
58
58
  return qs.length || !said ? qs : null;
59
59
  }
60
- // An idea is one inbox line, so a structured request arrives as one wall:
60
+ // A task is one inbox line, so a structured request arrives as one wall:
61
61
  // "Fix x Problem: … Scope: … Acceptance criteria: (1) … (2) …". Split it, for display
62
62
  // only, into the text before the first label and one part per label; inline (1) (2)
63
63
  // become a numbered list. Fewer than two labels is plain text and is left whole.
@@ -44,8 +44,8 @@ const readable = (t) =>
44
44
  let keepNext = false;
45
45
  export function open(c, keepTab) {
46
46
  // A run is worked on in its workspace, which docks this panel; so is everything on a phone.
47
- // Ideas keep the panel on the Board and Ideas pages. An archived run has no workspace row: it stays here to be restored.
48
- const here = view === "board" || view === "ideas";
47
+ // Tasks keep the panel on the Board and Tasks pages. An archived run has no workspace row: it stays here to be restored.
48
+ const here = view === "board" || view === "tasks";
49
49
  if (view !== "run" && (isPhone() || !here || (c.kind === "run" && !c.archived))) {
50
50
  keepNext = !!keepTab;
51
51
  return void openWorkspace(c);
@@ -64,15 +64,15 @@ export function open(c, keepTab) {
64
64
  $("pterm").hidden = true;
65
65
  if (c.kind === "idea") {
66
66
  store.runDoc = null;
67
- $("psub").innerHTML = c.status === "starting" && !c.archived ? steps(c) : html`<span class="pst"><span class="st d-idea"><svg><use href="#s-idea"/></svg></span>Idea</span><span class="pst dim">${c.where.split(/[\\/]/).pop() || c.where}</span>`;
67
+ $("psub").innerHTML = c.status === "starting" && !c.archived ? steps(c) : html`<span class="pst"><span class="st d-idea"><svg><use href="#s-idea"/></svg></span>Task</span><span class="pst dim">${c.where.split(/[\\/]/).pop() || c.where}</span>`;
68
68
  $("ptabs").innerHTML = "";
69
- ideaBody(c);
69
+ taskBody(c);
70
70
  const foot = $("pfoot");
71
71
  foot.innerHTML = c.archived
72
72
  ? `<button class="btn pri" data-a="restore">Restore</button>`
73
73
  : c.status === "idea"
74
74
  ? `<button class="btn ghost danger" data-a="delete">Delete</button><button class="btn ghost" data-a="archive">Archive</button><span class="dec"><button class="btn" data-a="reject">Reject</button><button class="btn" data-a="edit">Edit</button><button class="btn pri" data-a="run">Run</button></span>`
75
- : `<span class="note">${c.pty ? "Starting: the agent runs below." : "Starting: a run was launched for this idea. No terminal with your agent? Run it again."}</span><span class="dec"><button class="btn" data-a="run">Run again</button></span>`;
75
+ : `<span class="note">${c.pty ? "Starting: the agent runs below." : "Starting: a run was launched for this task. No terminal with your agent? Run it again."}</span><span class="dec"><button class="btn" data-a="run">Run again</button></span>`;
76
76
  foot.querySelectorAll("[data-a]").forEach(
77
77
  (b) =>
78
78
  (b.onclick = () => {
@@ -148,10 +148,10 @@ function meta(c) {
148
148
  });
149
149
  return html`<div class="rmeta" title="${[st.runner, st.agent, st.mode].filter(Boolean).join(", ")}">${proj}</div><div class="rprog s-${c.status}" title="${cap(WORD[c.status] || c.status) + (c.awaiting ? `: ${need(c.awaiting)}` : "")}"><span>${word}</span><b><i style="width:${w}%"></i></b></div>`;
150
150
  }
151
- // An idea's panel: its terminal while the run it started is being born there, else its notes.
152
- export function ideaBody(c) {
153
- // In the run workspace the agent is a centre tab; on the Ideas page an idea shows its notes only.
154
- if (c.pty && view !== "run" && view !== "ideas") showTerm(c);
151
+ // A task's panel: its terminal while the run it started is being born there, else its notes.
152
+ export function taskBody(c) {
153
+ // In the run workspace the agent is a centre tab; on the Tasks page a task shows its notes only.
154
+ if (c.pty && view !== "run" && view !== "tasks") showTerm(c);
155
155
  else {
156
156
  termStop();
157
157
  chat(c, c.notes, c.archived || c.status !== "idea");
@@ -272,7 +272,7 @@ export async function openRun(c, refresh, again) {
272
272
  ? ` ${qs.length === 1 ? "1 question" : qs.length + " questions"}.`
273
273
  : "";
274
274
  const more =
275
- `<button data-a="archive">Archive</button>${c.column === 1 ? `<button data-a="toidea">Back to idea</button>` : ""}<hr><button data-a="ab" class="danger">Abandon</button>`;
275
+ `<button data-a="archive">Archive</button>${c.column === 1 ? `<button data-a="toidea">Back to task</button>` : ""}<hr><button data-a="ab" class="danger">Abandon</button>`;
276
276
  foot.innerHTML = html`<span class="note">${sent ? "Sent to your agent." : APPROVAL[c.awaiting] + asks}</span><details class="more"><summary class="btn ghost">More</summary><div class="menu-pop">${raw(more)}</div></details>${raw(rs)}<span class="dec"><button class="btn" data-a="revise"${sent ? " disabled" : ""}>Revise</button><button class="btn pri" data-a="approve"${sent ? " disabled" : ""}>${c.awaiting === "findings" ? "Approve as-is" : "Approve"}</button></span>`;
277
277
  } else if (c.status === "waiting")
278
278
  foot.innerHTML = html`<span class="note">Waiting: ${need(c.awaiting)}.</span>${raw(arch)}<button class="btn ghost" data-a="ab">Abandon</button>${raw(rs)}`;
@@ -317,8 +317,8 @@ export async function openRun(c, refresh, again) {
317
317
  return;
318
318
  }
319
319
  if (a === "toidea") {
320
- post("/to-idea", { dir: c.state, id: c.id }).then((r) => {
321
- if (r.ok) toast("Back in Ideas");
320
+ post("/to-task", { dir: c.state, id: c.id }).then((r) => {
321
+ if (r.ok) toast("Back in Tasks");
322
322
  load();
323
323
  });
324
324
  return;
@@ -335,15 +335,15 @@ export function deep() {
335
335
  const p = new URLSearchParams(location.search),
336
336
  d = p.get("dir"),
337
337
  id = p.get("run"),
338
- idea = p.get("idea");
338
+ task = p.get("idea");
339
339
  // A workspace address (?view=run&idea=) is the run view's own, not a note's deep link.
340
- if ((!id && idea === null) || p.get("view") === "run") return;
340
+ if ((!id && task === null) || p.get("view") === "run") return;
341
341
  history.replaceState(null, "", location.pathname + "?all=1");
342
342
  const c = store.S.cards.find(
343
- (x) => x.state === d && (id ? x.kind === "run" && x.id === id : x.kind === "idea" && x.text === idea),
343
+ (x) => x.state === d && (id ? x.kind === "run" && x.id === id : x.kind === "idea" && x.text === task),
344
344
  );
345
345
  if (!c) {
346
- toast(id ? "That run was not found" : "That idea was not found");
346
+ toast(id ? "That run was not found" : "That task was not found");
347
347
  return;
348
348
  }
349
349
  const m = /^(finding|backlog)-(\d+)$/.exec(p.get("item") || "");
@@ -394,7 +394,7 @@ export async function toggleArchive(c, archived) {
394
394
  load();
395
395
  }
396
396
  export function close() {
397
- if (view !== "board" && view !== "run" && view !== "ideas") return;
397
+ if (view !== "board" && view !== "run" && view !== "tasks") return;
398
398
  const k = store.openKey;
399
399
  stopDictation(true);
400
400
  termStop();
@@ -1,5 +1,5 @@
1
1
  // ---- Phones: their own Home (devices, recent runs, usage) and the Runs page (this
2
- // machine's runs grouped waiting / active / done). The board, Ideas and Icebox are set up
2
+ // machine's runs grouped waiting / active / done). The board, Tasks and Icebox are set up
3
3
  // on a computer; a phone has Home, Chat, Runs and Settings.
4
4
  import { runPopup } from "./cards.ts";
5
5
  import { $, html, raw } from "./dom.ts";
@@ -17,8 +17,8 @@ let allDevices = false;
17
17
 
18
18
  const chev = raw(`<svg class="pchev" viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg>`);
19
19
  const runs = () => railData().cards.filter((c) => c.kind === "run" && !c.archived);
20
- // Ideas not started yet: a phone has no Ideas page, so the Runs page lists them.
21
- const ideas = () => railData().cards.filter((c) => c.kind === "idea" && !c.archived);
20
+ // Tasks not started yet: a phone has no Tasks page, so the Runs page lists them.
21
+ const tasks = () => railData().cards.filter((c) => c.kind === "idea" && !c.archived);
22
22
  const rowKey = (c) => (c.kind === "run" ? c.id : c.text);
23
23
  const projName = (dir: string) => {
24
24
  const l = railData().projects?.find((p) => p.dir === dir)?.label || dir.replace(/[\\/]\.kaizen$/, "");
@@ -130,8 +130,8 @@ function device() {
130
130
  const active = all.filter((c) => !wait.includes(c) && !done.includes(c));
131
131
  const group = (title: string, cs: any[], shut = false) =>
132
132
  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>` : "";
133
- const idle = ideas().sort((a, b) => (b.moved ?? b.added ?? 0) - (a.moved ?? a.added ?? 0));
134
- 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>`}`;
133
+ const idle = tasks().sort((a, b) => (b.moved ?? b.added ?? 0) - (a.moved ?? a.added ?? 0));
134
+ return html`${group("Waiting on you", wait)}${group("Active", active)}${group("Tasks", idle)}${group("Done", done, true)}${all.length || idle.length ? "" : html`<p class="pnote">No runs yet.</p>`}`;
135
135
  }
136
136
 
137
137
  function draw() {
@@ -204,10 +204,10 @@ export function initPhone(go: (v: string, push?: boolean) => void, openRun: (c)
204
204
  if (a.dataset.dev) return (e.preventDefault(), go("device", true));
205
205
  if (a.getAttribute("aria-disabled")) return e.preventDefault();
206
206
  if (a.classList.contains("prow")) {
207
- const c = [...runs(), ...ideas()].find((x) => x.state === a.dataset.dir && rowKey(x) === a.dataset.id);
207
+ const c = [...runs(), ...tasks()].find((x) => x.state === a.dataset.dir && rowKey(x) === a.dataset.id);
208
208
  if (!c) return;
209
209
  e.preventDefault();
210
- // An idea not started has nothing in a workspace yet: pick its agent and mode instead.
210
+ // A task not started has nothing in a workspace yet: pick its agent and mode instead.
211
211
  if (c.kind === "idea" && c.status === "idea") runPopup(c);
212
212
  else openRun(c);
213
213
  }
@@ -1,7 +1,7 @@
1
1
  import { store } from "./store.ts";
2
2
  import { startDir } from "./labels.ts";
3
3
  import { load, post } from "./api.ts";
4
- import { newIdea, render } from "./cards.ts";
4
+ import { newTask, render } from "./cards.ts";
5
5
  import { $, html, ico } from "./dom.ts";
6
6
  import { openSources, srcOpen } from "./icebox.ts";
7
7
  import { toast } from "./toast.ts";
@@ -75,11 +75,11 @@ export async function pick(v) {
75
75
  if (view === "sources") openSources();
76
76
  }
77
77
  // Known projects, plus any folder a card comes from that is not one (the global inbox).
78
- // New idea in All projects: the projects being shown, else every one.
78
+ // New task in All projects: the projects being shown, else every one.
79
79
  export let newDir = null;
80
80
  // Same combo as the header's project picker: a button, then a searchable list.
81
- export function ideaCombo(f, choose = false) {
82
- const ps = ideaDirs(),
81
+ export function taskCombo(f, choose = false) {
82
+ const ps = taskDirs(),
83
83
  btn = f.querySelector("#newdir"),
84
84
  pp = f.querySelector("#ndc .menu-pop"),
85
85
  q = pp.querySelector("input"),
@@ -174,7 +174,7 @@ export function projectPicker(host: HTMLElement, ps: { dir: string; label: strin
174
174
  if (e.key === "Enter") box.querySelector<HTMLElement>("button")?.click();
175
175
  };
176
176
  }
177
- function ideaDirs() {
177
+ function taskDirs() {
178
178
  const sp = showable(),
179
179
  pick = sp.filter((p) => store.shown.has(p.dir));
180
180
  return pick.length ? pick : sp;
@@ -273,5 +273,5 @@ export function initProjects() {
273
273
  $("show").setAttribute("aria-expanded", false);
274
274
  }
275
275
  });
276
- $("newtop").onclick = newIdea;
276
+ $("newtop").onclick = newTask;
277
277
  }
@@ -1,4 +1,4 @@
1
- // The workspace centre (?view=ws&dir=&ws=; a run's or idea's old address resolves to its
1
+ // The workspace centre (?view=ws&dir=&ws=; a run's or task's old address resolves to its
2
2
  // workspace and picks that run in the panel): a tab bar over one folder holding terminals and the
3
3
  // Browser, never runs. Agent terminals are tabs, named by stage for a run's ("Build · Claude"),
4
4
  // beside shells started with POST /shell {ws}, the project's localhost, the Preview, project
@@ -137,7 +137,7 @@ export async function showRunView(nav = false) {
137
137
  const p = new URLSearchParams(location.search),
138
138
  dir = p.get("dir"),
139
139
  id = p.get("id"),
140
- idea = p.get("idea");
140
+ task = p.get("idea");
141
141
  let ws = p.get("ws"),
142
142
  want: any = null; // the card the address names, whose tab is selected
143
143
  // A project this board is not showing: a deep link names its project, switched to once, as a rail click does.
@@ -150,10 +150,10 @@ export async function showRunView(nav = false) {
150
150
  if (p.get("view") === "ws" && ws) {
151
151
  if (await away()) return showRunView(nav);
152
152
  } else {
153
- const find = (cs) => cs.find((x) => x.state === dir && (id ? x.kind === "run" && x.id === id : x.kind === "idea" && x.text === idea));
153
+ const find = (cs) => cs.find((x) => x.state === dir && (id ? x.kind === "run" && x.id === id : x.kind === "idea" && x.text === task));
154
154
  const c = find(store.S.cards);
155
- // A launched idea becomes a run: its agent session moves to the run's card, and the view follows.
156
- const pk = idea && (c ?? card)?.kind === "idea" && (c ?? card)?.pty?.key;
155
+ // A launched task becomes a run: its agent session moves to the run's card, and the view follows.
156
+ const pk = task && (c ?? card)?.kind === "idea" && (c ?? card)?.pty?.key;
157
157
  const run = pk && store.S.cards.find((x) => x.kind === "run" && x.state === dir && (x.pty?.key === pk || x.pty?.all?.includes(pk)));
158
158
  if (run) {
159
159
  history.replaceState(null, "", cardHref(run));
@@ -234,7 +234,9 @@ function draw() {
234
234
  const PTY = !noPty;
235
235
  const mark = (a) => (MARKS.includes(a.cmd) ? raw(`<svg><use href="#i-${a.cmd}"/></svg>`) : ico("ai"));
236
236
  const dflt = agents.find((a) => a.cmd === defAgent);
237
- const menu = html`<div class="menu-pop">${PTY && dflt ? html`<button data-n="agent:${dflt.cmd}">${mark(dflt)}<span>New agent here<small>${dflt.name} in this folder</small></span></button>` : ""}${PTY ? html`<button data-n="shell">${ico("term")}<span>Shell<small>a terminal in this folder</small></span></button>` : ""}<button data-n="local">${ico("link")}<span>Browser<small>localhost pages, e.g. the dev server</small></span></button><button data-n="preview">${ico("eye")}<span>Preview<small>the run's Preview</small></span></button><button data-n="history">${ico("note")}<span>History<small>finished runs in this workspace</small></span></button>${PTY ? agents.filter((a) => a !== dflt).map((a) => html`<button data-n="agent:${a.cmd}">${mark(a)}<span>${a.name} session<small>the agent alone, no run</small></span></button>`) : ""}</div>`;
237
+ // Agents first, the default on top, then the tools.
238
+ const agentRow = (a) => html`<button data-n="agent:${a.cmd}">${mark(a)}<span>${a.name}<small>${a === dflt ? "default agent, in this folder" : "the agent alone, no run"}</small></span></button>`;
239
+ const menu = html`<div class="menu-pop">${PTY && agents.length ? html`${agentRow(dflt ?? agents[0])}${agents.filter((a) => a !== (dflt ?? agents[0])).map(agentRow)}<hr>` : ""}${PTY ? html`<button data-n="shell">${ico("term")}<span>Shell<small>a terminal in this folder</small></span></button>` : ""}<button data-n="local">${ico("link")}<span>Browser<small>localhost pages, e.g. the dev server</small></span></button><button data-n="preview">${ico("eye")}<span>Preview<small>the run's Preview</small></span></button><button data-n="history">${ico("note")}<span>History<small>finished runs in this workspace</small></span></button></div>`;
238
240
  $("rtabs").innerHTML = String(
239
241
  html`${scs.map((sc) => {
240
242
  const ids = leaves(sc.tree),
@@ -1,5 +1,5 @@
1
1
  // Global search: the "Search" entry on top of the side menu, and Ctrl/Cmd+K anywhere, open
2
- // one palette over workspaces, runs and ideas, chats, agent terminals, projects, pages and
2
+ // one palette over workspaces, runs and tasks, chats, agent terminals, projects, pages and
3
3
  // actions (modelled on Orca's "Jump to..." palette). Nothing is fetched but /chats; the rest
4
4
  // is what the side menu already holds. Stands alone like workspace.ts, so the notebook and
5
5
  // video pages carry it too: a pick the page cannot do in place navigates instead.
@@ -14,7 +14,7 @@ import { leaves, wsKey } from "./ws-tabs.ts";
14
14
  const ask = (name: string, detail: any) => !dispatchEvent(new CustomEvent(name, { cancelable: true, detail }));
15
15
  // A menu entry's own click: in place on the board, a page load elsewhere.
16
16
  const page = (v: string, href: string) => () => {
17
- const a = document.querySelector<HTMLElement>(`.rail a.it[data-view="${v}"]`);
17
+ const a = document.querySelector<HTMLElement>(`.rail a[data-view="${v}"]`);
18
18
  a ? a.click() : (location.href = href);
19
19
  };
20
20
  const openWs = (dir: string, ws: string) => {
@@ -107,11 +107,11 @@ function items(): Item[] {
107
107
  main ? openWs(p.dir, main.path) : page("board", "/?view=board")();
108
108
  } });
109
109
  }
110
- // Runs and ideas, not archived.
110
+ // Runs and tasks, not archived.
111
111
  for (const c of cards.filter((c) => !c.archived)) {
112
112
  const st = stateOf(c);
113
113
  out.push({
114
- group: c.kind === "run" ? "Runs" : "Ideas",
114
+ group: c.kind === "run" ? "Runs" : "Tasks",
115
115
  title: titleOf(c) || c.id,
116
116
  sub: projName(c.state, projects),
117
117
  when: c.moved ? age(c.moved, now) : undefined,
@@ -162,11 +162,11 @@ function items(): Item[] {
162
162
  const acts: [string, string, () => void, string?][] = [
163
163
  ["Home", "page", page("home", "/"), "chat"],
164
164
  ["Icebox", "page", page("sources", "/?view=icebox"), "requests sources gathered"],
165
- ["Ideas", "page", page("ideas", "/?view=ideas"), "backlog"],
165
+ ["Tasks", "page", page("tasks", "/?view=tasks"), "backlog"],
166
166
  ["Board", "page", page("board", "/?view=board"), "kanban runs"],
167
167
  ["Notes", "page", () => (location.href = "/notebook"), "notebook docs"],
168
168
  ["Settings", "page", page("settings", "/?view=settings"), "preferences config"],
169
- ["New idea", "act", () => ($("newtop") ? $("newtop").click() : (location.href = "/?view=board")), "create add run"],
169
+ ["New task", "act", () => ($("newtop") ? $("newtop").click() : (location.href = "/?view=board")), "create add run"],
170
170
  ["Add a project", "act", () => openAdd({ dir: null }), "clone folder create workspace"],
171
171
  ["Toggle theme", "act", click("themet"), "dark light"],
172
172
  ["Collapse or expand menu", "act", click("fold"), "sidebar rail"],
@@ -177,9 +177,9 @@ function items(): Item[] {
177
177
  return out;
178
178
  }
179
179
 
180
- const ORDER = ["Current", "Workspaces", "Tabs", "Chats & terminals", "Runs", "Ideas", "Projects", "Actions"];
180
+ const ORDER = ["Current", "Workspaces", "Tabs", "Chats & terminals", "Runs", "Tasks", "Projects", "Actions"];
181
181
  // With nothing typed each group shows its most recent few, as Orca's does.
182
- const CAP = { Workspaces: 5, Tabs: 4, "Chats & terminals": 5, Runs: 5, Ideas: 3, Projects: 5 };
182
+ const CAP = { Workspaces: 5, Tabs: 4, "Chats & terminals": 5, Runs: 5, Tasks: 3, Projects: 5 };
183
183
 
184
184
  let dl: HTMLDialogElement | null = null;
185
185
  let shown: Item[] = [];
@@ -195,9 +195,9 @@ function draw() {
195
195
  const rows = hit.filter((i) => i.group === g);
196
196
  shown.push(...rows.slice(0, q.trim() ? 8 : CAP[g] ?? rows.length));
197
197
  }
198
- // Orca offers to create what was typed; here that is a new idea.
198
+ // Orca offers to create what was typed; here that is a new task.
199
199
  if (q.trim())
200
- shown.push({ group: "Create", title: `New idea "${q.trim()}"`, hay: "", ico: "plus", act: () => newIdeaWith(q.trim()) });
200
+ shown.push({ group: "Create", title: `New task "${q.trim()}"`, hay: "", ico: "plus", act: () => newTaskWith(q.trim()) });
201
201
  sel = Math.min(sel, shown.length - 1);
202
202
  const list = dl!.querySelector(".gs-list")!;
203
203
  let g = "";
@@ -219,7 +219,7 @@ function mark(n: number) {
219
219
  dl!.querySelector("input")!.setAttribute("aria-activedescendant", "gs-" + n);
220
220
  r?.scrollIntoView({ block: "nearest" });
221
221
  }
222
- function newIdeaWith(text: string) {
222
+ function newTaskWith(text: string) {
223
223
  if (!$("newtop")) return void (location.href = "/?view=board");
224
224
  $("newtop").click();
225
225
  const t = document.querySelector<HTMLTextAreaElement>("dialog[open] textarea");
@@ -0,0 +1,42 @@
1
+ import { post } from "./api.ts";
2
+ import { $, html } from "./dom.ts";
3
+ import { toast } from "./toast.ts";
4
+
5
+ // Settings → General → Cleanup: the two halves of `kaizen prune`, one button each, so
6
+ // clearing dead launch records never takes run history with it.
7
+ export type Cleanup = { project: string | null; keep: number; records: { abandoned: number; unowned: number; gone: number }; runs: number; rescued: number };
8
+
9
+ const total = (d: Cleanup) => d.records.abandoned + d.records.unowned + d.records.gone;
10
+ const btn = (id: string, text: string, n: number) => html`<button type="button" class="btn" id="${id}"${n ? "" : " disabled"}>${text}</button>`;
11
+
12
+ export const cleanupRows = (d: Cleanup) => [
13
+ {
14
+ label: "Clean launch records",
15
+ control: btn("s-clean-records", "Clean up", total(d)),
16
+ hint: `${total(d)} older than a week: ${d.records.abandoned} abandoned · ${d.records.unowned} unowned · ${d.records.gone} run gone`,
17
+ id: "s-clean-records",
18
+ q: "cleanup clean launch records sessions prune",
19
+ },
20
+ {
21
+ label: "Delete old runs",
22
+ control: btn("s-clean-runs", "Delete", d.runs),
23
+ hint: `${d.runs} finished runs beyond the newest ${d.keep}${d.rescued ? `; ${d.rescued} open backlog items move to backlog.md` : ""}`,
24
+ id: "s-clean-runs",
25
+ q: "cleanup delete old runs prune history",
26
+ },
27
+ ];
28
+
29
+ export function wireCleanup(d: Cleanup, redraw: () => Promise<unknown>) {
30
+ const where = d.project ? ` in ${d.project}` : "";
31
+ const go = (id: string, what: string, ask: string) => {
32
+ const b = $(id);
33
+ if (b) b.onclick = async () => {
34
+ if (!confirm(ask)) return;
35
+ const j = await post("/cleanup", { what });
36
+ toast(j.error ?? `Removed ${j.removed}`);
37
+ await redraw();
38
+ };
39
+ };
40
+ go("s-clean-records", "records", `Delete ${total(d)} launch records${where}?`);
41
+ go("s-clean-runs", "runs", `Permanently delete ${d.runs} finished runs${where}? Their plans, reviews and reports go, and this cannot be undone.`);
42
+ }
@@ -41,7 +41,7 @@ const PLACES: [RegExp, string, string][] = [
41
41
  [/^git\./, "git", "Git"],
42
42
  [/^ui\./, "terminal", "Terminal"],
43
43
  [/^board\.chat_hotkey$/, "shortcuts", "Shortcuts"],
44
- [/^board\./, "general", "Board"],
44
+ [/^board\./, "general", "App"],
45
45
  [/^(review\.|state\.)/, "general", "Project"],
46
46
  ];
47
47
  // A setting nobody has placed yet still shows, on General.