kaizen-agent 1.63.0 → 1.64.1
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/README.md +10 -10
- package/agents/kaizen-planner.md +2 -2
- package/cli/backlog.test.ts +1 -1
- package/cli/board.test.ts +24 -24
- package/cli/dashboard.ts +15 -15
- package/cli/handoff.test.ts +133 -0
- package/cli/handoff.ts +122 -0
- package/cli/install.ts +31 -5
- package/cli/notes.test.ts +3 -3
- package/cli/notes.ts +1 -1
- package/cli/pty.ts +16 -2
- package/cli/resources.test.ts +50 -0
- package/cli/resources.ts +113 -0
- package/cli/restart.test.ts +28 -1
- package/cli/settings.ts +8 -5
- package/cli/sources.test.ts +32 -32
- package/cli/sources.ts +15 -15
- package/cli/state.test.ts +74 -51
- package/cli/state.ts +77 -49
- package/cli/usage.test.ts +11 -0
- package/cli/web.ts +139 -38
- package/cli/workers.ts +11 -4
- package/cli/worktree.test.ts +174 -1
- package/cli/worktree.ts +190 -35
- package/commands/kaizen-discover.md +1 -1
- package/package.json +1 -1
- package/skills/kaizen/README.md +2 -2
- package/skills/kaizen/SKILL.md +2 -2
- package/skills/kaizen/config.default.yml +32 -22
- package/skills/kaizen/discover.md +8 -8
- package/skills/kaizen/gather.md +2 -2
- package/skills/kaizen/settings.md +3 -0
- package/skills/kaizen/spec-build.md +13 -0
- package/skills/kaizen/spec-main.md +13 -0
- package/skills/kaizen/spec-plan.md +1 -1
- package/skills/kaizen/spec.md +1 -1
- package/skills/kaizen-help/SKILL.md +2 -2
- package/web/board/api.ts +10 -10
- package/web/board/cards.ts +47 -46
- package/web/board/git.ts +4 -4
- package/web/board/icebox.ts +14 -14
- package/web/board/keys.ts +3 -3
- package/web/board/labels.ts +2 -2
- package/web/board/live.ts +3 -3
- package/web/board/main.ts +1 -1
- package/web/board/markdown.ts +1 -1
- package/web/board/panel.ts +17 -17
- package/web/board/phone.ts +10 -12
- package/web/board/projects.ts +6 -6
- package/web/board/resources.ts +152 -0
- package/web/board/run-view.ts +5 -5
- package/web/board/search.ts +11 -11
- package/web/board/settings-cleanup.ts +42 -0
- package/web/board/settings-pages.ts +1 -1
- package/web/board/settings.ts +13 -0
- package/web/board/store.ts +1 -1
- package/web/board/{ideas.ts → tasks.ts} +22 -22
- package/web/board/terms.ts +3 -3
- package/web/board/views.ts +23 -12
- package/web/board/workspace.ts +9 -7
- package/web/board/ws-board-ui.ts +1 -1
- package/web/board/ws-board.test.ts +1 -1
- package/web/board/ws-board.ts +1 -1
- package/web/board/ws-tabs.test.ts +10 -2
- package/web/board/ws-tabs.ts +10 -9
- package/web/board.html +46 -34
- package/web/board.js +107 -97
- package/web/notebook.js +22 -22
- package/web/notebook.ts +5 -5
- package/web/notes-lib.ts +2 -2
- package/web/notes.html +12 -11
- package/web/term-font.test.ts +22 -0
- package/web/term-font.ts +30 -0
- package/web/term.js +38 -38
- package/web/term.ts +13 -2
- package/web/video.html +12 -11
- package/web/video.js +48 -48
package/web/board/settings.ts
CHANGED
|
@@ -2,11 +2,13 @@ import { store } from "./store.ts";
|
|
|
2
2
|
import { termStop } from "./agent-term.ts";
|
|
3
3
|
import { dirHeader, load, post } from "./api.ts";
|
|
4
4
|
import { stopDictation } from "./dictation.ts";
|
|
5
|
+
import { FONT_MAX, FONT_MIN, fontRead, fontSet } from "../term-font.ts";
|
|
5
6
|
import { $, html, ico, raw } from "./dom.ts";
|
|
6
7
|
import { close } from "./panel.ts";
|
|
7
8
|
import { accountRows, wireAccounts } from "./settings-accounts.ts";
|
|
8
9
|
import { agentRows, wireAgents } from "./settings-agents.ts";
|
|
9
10
|
import { modelInput, modelLabel, orchestrationRows } from "./settings-orchestration.ts";
|
|
11
|
+
import { cleanupRows, wireCleanup } from "./settings-cleanup.ts";
|
|
10
12
|
import { automationRows, wireAutomations } from "./settings-automations.ts";
|
|
11
13
|
import { skillRows, wireSkills } from "./settings-skills.ts";
|
|
12
14
|
import { fillMics, micRow } from "./settings-voice.ts";
|
|
@@ -74,6 +76,9 @@ export async function openSettings() {
|
|
|
74
76
|
const au = await fetch("/automations", { headers: dirHeader() })
|
|
75
77
|
.then((r) => (r.ok ? r.json() : null))
|
|
76
78
|
.catch(() => null);
|
|
79
|
+
const cl = await fetch("/cleanup", { headers: dirHeader() })
|
|
80
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
81
|
+
.catch(() => null);
|
|
77
82
|
if (gen !== store.pageGen) return;
|
|
78
83
|
$("psub").textContent = "";
|
|
79
84
|
$("psub").title = "";
|
|
@@ -121,6 +126,7 @@ export async function openSettings() {
|
|
|
121
126
|
m.get(sub).push(r);
|
|
122
127
|
};
|
|
123
128
|
const defaultAgent = cfg?.rows.find((r) => r.key === "agent.default")?.value ?? "auto";
|
|
129
|
+
if (cl) for (const r of cleanupRows(cl)) put("general", "Cleanup", row(r.label, r.control, r.hint, r.id, r.q));
|
|
124
130
|
if (cfg) {
|
|
125
131
|
put("general", "Scope", row(
|
|
126
132
|
"Settings for",
|
|
@@ -165,6 +171,7 @@ export async function openSettings() {
|
|
|
165
171
|
put("appearance", "Browser", row("Theme", ctl("th", ["system", "light", "dark"], cur), "", "th", "theme light dark system browser"));
|
|
166
172
|
put("appearance", "Browser", row("Color", ctl("co", ["monochrome", "blue"], colour), "", "co", "color colour palette monochrome blue theme browser"));
|
|
167
173
|
put("appearance", "Browser", row("Motion", ctl("mo", ["system", "full", "reduce"], document.documentElement.dataset.motion || "system"), "Animations across kaizen. System follows the device's reduce-motion setting.", "mo", "motion animation reduce reduced browser"));
|
|
174
|
+
put("terminal", "Browser", row("Terminal font size", html`<input id="tf" class="sel" style="width:80px" type="number" min="${String(FONT_MIN)}" max="${String(FONT_MAX)}" value="${String(fontRead())}" aria-label="Terminal font size in pixels">`, "In every board terminal. Ctrl+= and Ctrl+- change it from a terminal, Ctrl+0 resets it.", "tf", "terminal font size text zoom browser"));
|
|
168
175
|
put("notifications", "Browser", row("Notifications", html`<button class="chk sm${nton ? " on" : ""}" id="nt" role="switch" aria-checked="${String(nton)}"></button>`, ntHelp, "nt", "notifications " + ntHelp + " browser"));
|
|
169
176
|
put("notifications", "Browser", row("Haptic feedback", html`<button class="chk sm${hapton ? " on" : ""}" id="hp" role="switch" aria-checked="${String(hapton)}"></button>`, "A light tick when you tap something on a phone.", "hp", "haptic feedback vibrate vibration touch tap phone browser"));
|
|
170
177
|
put("notifications", "Browser", row("Notification sound", ctl("ns", SOUNDS, soundPick()), "Plays with each notice. Changing it plays it.", "ns", "notification sound audio browser " + SOUNDS.join(" "), !nton));
|
|
@@ -250,6 +257,7 @@ export async function openSettings() {
|
|
|
250
257
|
if (ap) wireAgents(openSettings, cfg?.scope ?? null);
|
|
251
258
|
if (sk) wireSkills(openSettings, sk.token);
|
|
252
259
|
if (au) wireAutomations(au, openSettings);
|
|
260
|
+
if (cl) wireCleanup(cl, openSettings);
|
|
253
261
|
fillMics();
|
|
254
262
|
if (ac) wireAccounts(openSettings);
|
|
255
263
|
filter();
|
|
@@ -318,6 +326,11 @@ export async function openSettings() {
|
|
|
318
326
|
choice($("th"), ["system", "light", "dark"], cur, setTheme);
|
|
319
327
|
choice($("co"), ["monochrome", "blue"], colour, setColor);
|
|
320
328
|
choice($("mo"), ["system", "full", "reduce"], document.documentElement.dataset.motion || "system", setMotion);
|
|
329
|
+
$("tf").onchange = (e) => {
|
|
330
|
+
const n = Math.round(Math.min(FONT_MAX, Math.max(FONT_MIN, +e.target.value || fontRead())));
|
|
331
|
+
e.target.value = n;
|
|
332
|
+
fontSet(n);
|
|
333
|
+
};
|
|
321
334
|
$("nt").onclick = () => {
|
|
322
335
|
const on = !notifyOn();
|
|
323
336
|
try {
|
package/web/board/store.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const store = {
|
|
|
16
16
|
lastTab: "request",
|
|
17
17
|
runDoc: null,
|
|
18
18
|
clearMenu: false,
|
|
19
|
-
// The
|
|
19
|
+
// The Tasks column's severity menu, on its Backlog tab.
|
|
20
20
|
sevMenu: false,
|
|
21
21
|
wantTerm: null,
|
|
22
22
|
// The terminal a launch just opened (its pty key), selected in the run workspace once its tab exists.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The Ideas page (?view=
|
|
1
|
+
// The Ideas page (?view=tasks): every idea and run across projects as one table, with
|
|
2
2
|
// source, project, Open/Running/Done and text filters. A card's source is the icebox
|
|
3
3
|
// signal it came from (its `idea` text or `run` id); one typed by hand is "Manual".
|
|
4
4
|
// The data is the rail's (workspace.ts): no fetch of its own.
|
|
@@ -13,11 +13,11 @@ import { open } from "./panel.ts";
|
|
|
13
13
|
import { refreshBoardBadge } from "./badge.ts";
|
|
14
14
|
import { cardHref, drawSources, logo, railData, srcIcon, stateOf, titleOf } from "./workspace.ts";
|
|
15
15
|
|
|
16
|
-
const WORDS = { idle: "
|
|
16
|
+
const WORDS = { idle: "Task", plan: "Planning", build: "Building", review: "Reviewing", wait: "Waiting on you", done: "Done", aband: "Abandoned", stalled: "Stalled" };
|
|
17
17
|
const PLAT = { x: "X", tiktok: "TikTok", instagram: "Instagram", threads: "Threads" };
|
|
18
18
|
const SEARCH = raw('<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>');
|
|
19
19
|
const AGENTS = ["claude", "codex", "agy", "opencode", "gemini", "cursor"];
|
|
20
|
-
// sort: on Open,
|
|
20
|
+
// sort: on Open, tasks first or running first (kept per browser).
|
|
21
21
|
const f = { src: "all", proj: "", show: "open", q: "", sort: (() => { try { return localStorage.getItem("kz-ideas-sort") || "runs"; } catch { return "runs"; } })() };
|
|
22
22
|
let go: (v: string, push?: boolean) => void = () => {};
|
|
23
23
|
|
|
@@ -43,11 +43,11 @@ function sourcesOf(cards, d) {
|
|
|
43
43
|
let sel = 0;
|
|
44
44
|
const pg = pager("ideas");
|
|
45
45
|
let shownRows: any[] = [];
|
|
46
|
-
// Orca's Tasks shape: a toolbar over a list. The search box, the page's filters and New
|
|
46
|
+
// Orca's Tasks shape: a toolbar over a list. The search box, the page's filters and New task
|
|
47
47
|
// live in the shared header elsewhere, so they move in here and go back on leaving.
|
|
48
48
|
let docked: [Comment, HTMLElement][] = [];
|
|
49
49
|
function dock() {
|
|
50
|
-
if (!$("tk-bar")) $("
|
|
50
|
+
if (!$("tk-bar")) $("tasksv").innerHTML = String(html`<div class="tk-bar" id="tk-bar"><div class="tk-row" id="tk-chips"></div><div class="tk-row"><label class="tk-q" id="tk-q">${SEARCH}</label><span id="tk-tools"></span></div></div><div class="tk-list" id="tk-list"></div>`);
|
|
51
51
|
if (docked.length) return;
|
|
52
52
|
for (const [id, to] of [["bq", "tk-q"], ["hx", "tk-tools"], ["newtop", "tk-tools"]]) {
|
|
53
53
|
const el = $(id),
|
|
@@ -62,8 +62,8 @@ function undock() {
|
|
|
62
62
|
docked = [];
|
|
63
63
|
}
|
|
64
64
|
function draw() {
|
|
65
|
-
const box = $("
|
|
66
|
-
if (!document.body.classList.contains("
|
|
65
|
+
const box = $("tasksv");
|
|
66
|
+
if (!document.body.classList.contains("taskv")) return;
|
|
67
67
|
dock();
|
|
68
68
|
const { cards: all, projects, srcs } = railData();
|
|
69
69
|
const cards = all.filter((c) => !c.archived);
|
|
@@ -74,7 +74,7 @@ function draw() {
|
|
|
74
74
|
const dirs = [...new Set(cards.map((c) => c.state))];
|
|
75
75
|
// "Showing": the same projects-shown set as the Board and the Icebox (store.shown).
|
|
76
76
|
const shownDirs = dirs.filter((d) => store.shown.has(d));
|
|
77
|
-
// The Board's header is the
|
|
77
|
+
// The Board's header is the Tasks header too (as on the Icebox): its project picker, its
|
|
78
78
|
// Showing list and its search box drive this table.
|
|
79
79
|
const proj = store.all ? "" : store.S?.dir ?? "";
|
|
80
80
|
const q = (($("bq") as HTMLInputElement | null)?.value ?? "").trim().toLowerCase();
|
|
@@ -82,10 +82,10 @@ function draw() {
|
|
|
82
82
|
const matched = cards
|
|
83
83
|
.filter((c) => f.src === "all" || src.get(c) === f.src)
|
|
84
84
|
.filter((c) => (proj ? c.state === proj : !shownDirs.length || shownDirs.includes(c.state)))
|
|
85
|
-
// Open:
|
|
85
|
+
// Open: tasks not started yet and runs in flight. Running: runs in flight only. Done: finished runs.
|
|
86
86
|
.filter((c) => (f.show === "done" ? fin(c) : f.show === "running" ? c.kind === "run" && !fin(c) : !fin(c)))
|
|
87
87
|
.filter((c) => !q || (titleOf(c) + " " + nameOf(c.state, projects)).toLowerCase().includes(q))
|
|
88
|
-
// On Open,
|
|
88
|
+
// On Open, tasks above runs or runs above tasks, as chosen; newest first within each.
|
|
89
89
|
.sort((a, b) => (f.show === "open" ? (a.kind === b.kind ? 0 : (a.kind === "idea") === (f.sort === "ideas") ? -1 : 1) : 0) || (b.moved ?? b.added ?? 0) - (a.moved ?? a.added ?? 0));
|
|
90
90
|
const rows = pageOf(pg, matched);
|
|
91
91
|
const now = Date.now();
|
|
@@ -101,23 +101,23 @@ function draw() {
|
|
|
101
101
|
html`${srcMark(f.src)}<span>${srcName(f.src)}</span>`,
|
|
102
102
|
html`${srcList.map((u) => html`<button type="button" role="menuitemradio" data-src="${u}" aria-checked="${String(f.src === u)}">${srcMark(u)}<span>${srcName(u)}</span>${ck}</button>`)}`,
|
|
103
103
|
);
|
|
104
|
-
//
|
|
104
|
+
// Tasks' own filters, placed in the shared header after its search box.
|
|
105
105
|
const sortPop =
|
|
106
106
|
f.show === "open"
|
|
107
107
|
? pop(
|
|
108
108
|
"ideas-sort",
|
|
109
|
-
html`<span>${f.sort === "ideas" ? "
|
|
110
|
-
html`${[["ideas", "
|
|
109
|
+
html`<span>${f.sort === "ideas" ? "Tasks first" : "Running first"}</span>`,
|
|
110
|
+
html`${[["ideas", "Tasks first"], ["runs", "Running first"]].map(([v, l]) => html`<button type="button" role="menuitemradio" data-sort="${v}" aria-checked="${String(f.sort === v)}"><span>${l}</span>${ck}</button>`)}`,
|
|
111
111
|
)
|
|
112
112
|
: "";
|
|
113
|
-
// Scope and filters first; search, refresh and New
|
|
113
|
+
// Scope and filters first; search, refresh and New task sit at the right (CSS order).
|
|
114
114
|
const chips = html`${seg("open", "Open")}${seg("running", "Running")}${seg("done", "Done")}`;
|
|
115
115
|
const extra = html`${sources}${sortPop}<button class="ib" id="ideas-ref" title="Refresh" aria-label="Refresh">${ico("refresh")}</button>`;
|
|
116
116
|
const table = !rows.length ? html`<div class="tk-empty">${raw('<svg><use href="#r-bulb"/></svg>')}<p>Nothing matches.</p><span>Try a different search or filter.</span></div>` : html`<table class="itable"><thead><tr><th></th><th>Title / context</th><th>Status</th><th>Updated</th><th></th></tr></thead><tbody>${rows.map((c, i) => {
|
|
117
117
|
const name = nameOf(c.state, projects),
|
|
118
118
|
st = stateOf(c),
|
|
119
119
|
agent = (c.tags ?? []).find((t) => AGENTS.includes(t));
|
|
120
|
-
return html`<tr><td>${logo(c.state, name, projects)}</td><td><b>${titleOf(c)}</b><div class="ctx">${name}${agent ? html`<span class="tag">${NAMES[agent]}</span>` : ""}</div></td><td><span class="stc"><span class="si ${st}"></span>${WORDS[st]}</span></td><td class="d">${c.moved || c.added ? age(c.moved || c.added, now) + " ago" : ""}</td><td><div class="acts">${asking === key(c) ? html`<span class="q">Delete?</span><button class="btn ghost" data-keep="1">Keep</button><button class="btn danger" data-yes="${i}">Delete</button>` : html`${c.kind === "idea" ? html`<button class="del" data-i="${i}" title="Delete
|
|
120
|
+
return html`<tr><td>${logo(c.state, name, projects)}</td><td><b>${titleOf(c)}</b><div class="ctx">${name}${agent ? html`<span class="tag">${NAMES[agent]}</span>` : ""}</div></td><td><span class="stc"><span class="si ${st}"></span>${WORDS[st]}</span></td><td class="d">${c.moved || c.added ? age(c.moved || c.added, now) + " ago" : ""}</td><td><div class="acts">${asking === key(c) ? html`<span class="q">Delete?</span><button class="btn ghost" data-keep="1">Keep</button><button class="btn danger" data-yes="${i}">Delete</button>` : html`${c.kind === "idea" ? html`<button class="del" data-i="${i}" title="Delete task" aria-label="Delete task">${ico("trash")}</button>` : ""}<button class="go" data-i="${i}">${c.kind === "idea" ? "Start" : "Open"} ${ico("arrow")}</button>`}</div></td></tr>`;
|
|
121
121
|
})}</tbody></table>`;
|
|
122
122
|
const hx = $("hx");
|
|
123
123
|
// Not while a pop-up in it is open: redrawing would close it under the pointer.
|
|
@@ -164,7 +164,7 @@ function act(c) {
|
|
|
164
164
|
runPopup(here);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
//
|
|
167
|
+
// A task is deleted as the board's card menu does it, not recorded anywhere.
|
|
168
168
|
let asking: string | null = null;
|
|
169
169
|
async function del(c) {
|
|
170
170
|
asking = null;
|
|
@@ -183,12 +183,12 @@ function detail(c) {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
function mark() {
|
|
186
|
-
const trs = [...document.querySelectorAll<HTMLElement>("#
|
|
186
|
+
const trs = [...document.querySelectorAll<HTMLElement>("#tasksv tbody tr")];
|
|
187
187
|
trs.forEach((tr, i) => tr.classList.toggle("kb", i === sel));
|
|
188
188
|
trs[sel]?.scrollIntoView({ block: "nearest" });
|
|
189
189
|
}
|
|
190
190
|
addEventListener("keydown", (e) => {
|
|
191
|
-
if (!document.body.classList.contains("
|
|
191
|
+
if (!document.body.classList.contains("taskv") || !shownRows.length) return;
|
|
192
192
|
const t = e.target as HTMLElement;
|
|
193
193
|
// From the search box, or anywhere on the page that is not another field or a menu.
|
|
194
194
|
if (t.id !== "bq" && (t.closest("input,textarea,select,[contenteditable],details,dialog") || t.isContentEditable)) return;
|
|
@@ -201,13 +201,13 @@ addEventListener("keydown", (e) => {
|
|
|
201
201
|
act(shownRows[sel]);
|
|
202
202
|
}
|
|
203
203
|
});
|
|
204
|
-
export function
|
|
205
|
-
$("bq").placeholder = "Search
|
|
204
|
+
export function openTasks() {
|
|
205
|
+
$("bq").placeholder = "Search tasks (press /)";
|
|
206
206
|
addEventListener("kz-view", () => (undock(), ($("bq").placeholder = "Filter cards (press /)")), { once: true });
|
|
207
207
|
void drawSources(true);
|
|
208
208
|
draw();
|
|
209
209
|
}
|
|
210
|
-
export function
|
|
210
|
+
export function initTasks(goTo: typeof go) {
|
|
211
211
|
go = goTo;
|
|
212
212
|
addEventListener("kz-rail", draw);
|
|
213
213
|
// The shared header's search box, project picker and Showing list.
|
|
@@ -216,7 +216,7 @@ export function initIdeas(goTo: typeof go) {
|
|
|
216
216
|
$("shows")?.addEventListener("click", () => queueMicrotask(draw));
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
// A click outside the
|
|
219
|
+
// A click outside the Tasks header's pop-ups closes them.
|
|
220
220
|
addEventListener(
|
|
221
221
|
"pointerdown",
|
|
222
222
|
(e) => {
|
package/web/board/terms.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { termLoad } from "./agent-term.ts";
|
|
|
5
5
|
import { open } from "./panel.ts";
|
|
6
6
|
import { resume } from "./approvals.ts";
|
|
7
7
|
|
|
8
|
-
// ---- the Terminal page: every in-card agent session the board knows,
|
|
8
|
+
// ---- the Terminal page: every in-card agent session the board knows, Tasks to Done, tiled.
|
|
9
9
|
// A tile is one more kzTerm mount on /pty beside the card panel's (attachPty takes many
|
|
10
10
|
// listeners). Mounts outlive redraws: a /state tick moves tiles around, it never reconnects.
|
|
11
11
|
// Layout is per browser in kz-terms: tile order, hidden tiles, the maximised one, and the
|
|
@@ -178,7 +178,7 @@ export function openTerms() {
|
|
|
178
178
|
grid.querySelectorAll(".tsplit").forEach((s) => s.remove());
|
|
179
179
|
grid.insertAdjacentHTML(
|
|
180
180
|
"beforeend",
|
|
181
|
-
html`<div class="empty tempty"><div class="mascot"></div><b>${hid.length ? "Every terminal is hidden" : "No terminals running"}</b><p>Runs with an agent open in kaizen show here, from
|
|
181
|
+
html`<div class="empty tempty"><div class="mascot"></div><b>${hid.length ? "Every terminal is hidden" : "No terminals running"}</b><p>Runs with an agent open in kaizen show here, from Tasks to Done.</p></div>`.s,
|
|
182
182
|
);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
@@ -201,7 +201,7 @@ export function openTerms() {
|
|
|
201
201
|
off = st === "ended";
|
|
202
202
|
const hd = t.el.querySelector("header")!;
|
|
203
203
|
hd.title = (c.kind === "run" ? c.id : c.text) + " · " + c.where + (i < 9 ? ` · Alt+${i + 1}` : "");
|
|
204
|
-
// An ended run can be resumed from here;
|
|
204
|
+
// An ended run can be resumed from here; a task whose agent ended has no run to resume.
|
|
205
205
|
hd.innerHTML = html`<span class="tdot ${st}" role="img" title="${st}" aria-label="${st}"></span><b>${nameOf(c)} - ${projOf(c)}</b>${off ? html`<span class="tend">ended</span>` : ""}<span class="sp"></span>${off && c.kind === "run" ? html`<button class="btn sm" data-a="resume" title="Continue this run's agent">Resume</button>` : ""}${c.kind === "shell" ? "" : html`<button class="ib sm" data-a="card" title="Open card" aria-label="Open card">${ico("open")}</button>`}<button class="ib sm" data-a="max" title="${lay.max === k ? "Restore" : "Maximise"} (Ctrl+Shift+M)" aria-label="${lay.max === k ? "Restore" : "Maximise"}">${ico(lay.max === k ? "min" : "max")}</button>${off ? "" : html`<button class="ib sm" data-a="hide" title="Hide" aria-label="Hide">${ico("dash")}</button>`}<button class="ib sm" data-a="${off ? "hide" : "exit"}" title="${off ? "Close" : "Exit session"}" aria-label="${off ? "Close" : "Exit session"}">${ico("close")}</button>`.s;
|
|
206
206
|
t.el.classList.toggle("ended", off);
|
|
207
207
|
t.el.classList.toggle("asking", st === "asking");
|
package/web/board/views.ts
CHANGED
|
@@ -5,24 +5,25 @@ import { close } from "./panel.ts";
|
|
|
5
5
|
import { openSettings } from "./settings.ts";
|
|
6
6
|
import { openTerms, termsStop } from "./terms.ts";
|
|
7
7
|
import { openHome } from "./home.ts";
|
|
8
|
-
import {
|
|
8
|
+
import { initTasks, openTasks } from "./tasks.ts";
|
|
9
9
|
import { initRunView, openWorkspace, runStop, showRunView } from "./run-view.ts";
|
|
10
10
|
import { initPhone, isPhone, openPhone } from "./phone.ts";
|
|
11
11
|
|
|
12
12
|
// ---- views: Home (the chat, at /), the board, Settings and the Icebox as pages in the docked panel, or the Terminal page; each with its own address
|
|
13
13
|
export let view = "board";
|
|
14
|
+
let boardBack = false;
|
|
14
15
|
// The board's own area, not the docked panel.
|
|
15
|
-
const AREA = ["board", "terminal", "home", "
|
|
16
|
+
const AREA = ["board", "terminal", "home", "tasks", "run", "chat", "device"];
|
|
16
17
|
export const markView = (v) => {
|
|
17
18
|
// A phone's run workspace belongs to its Runs tab.
|
|
18
19
|
const lit = v === "run" && isPhone() ? "device" : v;
|
|
19
20
|
document
|
|
20
|
-
.querySelectorAll(".rail a
|
|
21
|
+
.querySelectorAll(".rail a[data-view]")
|
|
21
22
|
.forEach((a) =>
|
|
22
23
|
a.dataset.view === lit ? a.setAttribute("aria-current", "page") : a.removeAttribute("aria-current"),
|
|
23
24
|
);
|
|
24
25
|
// The Icebox is titled in the header, top left, like the board.
|
|
25
|
-
document.querySelector(".hdr h1").textContent = v === "sources" ? "Icebox" : v === "
|
|
26
|
+
document.querySelector(".hdr h1").textContent = v === "sources" ? "Icebox" : v === "tasks" ? "Tasks" : v === "run" ? "Run" : v === "terminal" ? "Terminal" : v === "home" ? (isPhone() ? "kaizen" : "Home") : v === "chat" ? "Chat" : v === "device" ? "Runs" : "Board";
|
|
26
27
|
if (v === "home" && isPhone()) document.querySelector(".hdr h1").innerHTML = '<pre class="mark" role="img" aria-label="kaizen">' + document.querySelector(".rail pre.mark").innerHTML + "</pre>";
|
|
27
28
|
};
|
|
28
29
|
export function go(v, push) {
|
|
@@ -30,10 +31,10 @@ export function go(v, push) {
|
|
|
30
31
|
if (v === "icebox") v = "sources";
|
|
31
32
|
// A workspace address shows in the run view, which resolves it to a card.
|
|
32
33
|
if (v === "ws") v = "run";
|
|
33
|
-
if (!["settings", "sources", "terminal", "board", "
|
|
34
|
-
// A phone has Home, Chat, Runs and Settings: the board,
|
|
34
|
+
if (!["settings", "sources", "terminal", "board", "tasks", "run", "chat", "device"].includes(v)) v = "home";
|
|
35
|
+
// A phone has Home, Chat, Runs and Settings: the board, Tasks and the Icebox are set up on a computer,
|
|
35
36
|
// whose Home is the chat.
|
|
36
|
-
if (isPhone() ? ["board", "
|
|
37
|
+
if (isPhone() ? ["board", "tasks", "sources"].includes(v) : v === "chat" || v === "device") v = "home";
|
|
37
38
|
const was = view;
|
|
38
39
|
view = v;
|
|
39
40
|
markView(v);
|
|
@@ -45,7 +46,7 @@ export function go(v, push) {
|
|
|
45
46
|
document.body.classList.toggle("homev", (v === "home" && !ph) || v === "chat");
|
|
46
47
|
document.body.classList.toggle("phomev", ph || v === "device");
|
|
47
48
|
document.body.classList.toggle("pdevv", v === "device");
|
|
48
|
-
document.body.classList.toggle("
|
|
49
|
+
document.body.classList.toggle("taskv", v === "tasks");
|
|
49
50
|
document.body.classList.toggle("runv", v === "run");
|
|
50
51
|
// Leaving a workspace: its panel closes as the board's would, its terminals unmount.
|
|
51
52
|
if (was === "run" && v !== "run") {
|
|
@@ -63,13 +64,13 @@ export function go(v, push) {
|
|
|
63
64
|
else termsStop();
|
|
64
65
|
if ((v === "home" && !ph) || v === "chat") openHome();
|
|
65
66
|
openPhone(ph ? "home" : v === "device" ? "device" : null);
|
|
66
|
-
if (v === "
|
|
67
|
+
if (v === "tasks") openTasks();
|
|
67
68
|
// After the panel handling below, which closes the board's panel on the way in.
|
|
68
69
|
if (v === "run") queueMicrotask(() => void showRunView(true));
|
|
69
70
|
// The Terminal page is the board's own area, not the docked panel: the panel closes as on the board.
|
|
70
71
|
if (AREA.includes(v)) {
|
|
71
72
|
if (AREA.includes(was)) {
|
|
72
|
-
if (v !== "board" && (was === "board" || was === "
|
|
73
|
+
if (v !== "board" && (was === "board" || was === "tasks")) {
|
|
73
74
|
view = "board";
|
|
74
75
|
close();
|
|
75
76
|
view = v;
|
|
@@ -92,7 +93,7 @@ export function go(v, push) {
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
export function initViews() {
|
|
95
|
-
|
|
96
|
+
initTasks(go);
|
|
96
97
|
initRunView();
|
|
97
98
|
initPhone(go, openWorkspace);
|
|
98
99
|
document.querySelectorAll(".rail a[data-view]").forEach((a) => {
|
|
@@ -104,7 +105,17 @@ export function initViews() {
|
|
|
104
105
|
store.setQ = "";
|
|
105
106
|
store.setBack = view !== "settings";
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
+
// Board is a toggle: a second click goes back to where the first one came from.
|
|
109
|
+
if (a.dataset.view === "board" && view === "board") {
|
|
110
|
+
const back = boardBack;
|
|
111
|
+
boardBack = false;
|
|
112
|
+
return void (back ? history.back() : vt(() => go("home", true)));
|
|
113
|
+
}
|
|
114
|
+
const opening = a.dataset.view === "board";
|
|
115
|
+
vt(() => {
|
|
116
|
+
go(a.dataset.view, true);
|
|
117
|
+
boardBack = opening;
|
|
118
|
+
});
|
|
108
119
|
};
|
|
109
120
|
});
|
|
110
121
|
document.querySelector(".rail .home").onclick = (e) => {
|
package/web/board/workspace.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// The side menu's live parts on every page (board, notebook, video): the Icebox count,
|
|
2
|
-
// the
|
|
2
|
+
// the Tasks entry's source icons and the Projects list; and the board's flat footer
|
|
3
3
|
// (agent usage, terminal count, phone). Stands alone, so the notebook and video
|
|
4
4
|
// bundles can carry it without the board.
|
|
5
5
|
import { onBoardCards } from "./badge.ts";
|
|
6
6
|
import { store } from "./store.ts";
|
|
7
7
|
import { $, html, modal, raw } from "./dom.ts";
|
|
8
|
+
import { initResources } from "./resources.ts";
|
|
8
9
|
import { age, need } from "./labels.ts";
|
|
9
10
|
import { openAdd } from "./add-project.ts";
|
|
10
11
|
import { initSearch } from "./search.ts";
|
|
@@ -14,7 +15,7 @@ const DAY = 864e5;
|
|
|
14
15
|
const STAGE = ["idea", "planning", "building", "reviewing", "done"];
|
|
15
16
|
// A card's state icon (.si) and the word under its title.
|
|
16
17
|
export function stateOf(c) {
|
|
17
|
-
//
|
|
18
|
+
// A task whose agent is working is a run being born: show it as planning.
|
|
18
19
|
if (c.kind === "idea") return !c.pty?.alive ? "idle" : c.pty.asking ? "wait" : c.pty.busy ? "plan" : "idle";
|
|
19
20
|
if (c.status === "waiting" || (c.pty?.alive && c.pty.asking)) return "wait";
|
|
20
21
|
if (c.status === "done") return c.accept === "needs" || gitDue(c) ? "wait" : "done";
|
|
@@ -35,8 +36,8 @@ export function subline(c, now) {
|
|
|
35
36
|
return `${STAGE[c.column] ?? c.status} · ${age(t, now)}`;
|
|
36
37
|
}
|
|
37
38
|
export const titleOf = (c) => (c.title || c.text || "").split("\n")[0];
|
|
38
|
-
// Shown in the list: runs not archived, a finished one only for a day.
|
|
39
|
-
// live on the
|
|
39
|
+
// Shown in the list: runs not archived, a finished one only for a day. Tasks not started yet
|
|
40
|
+
// live on the Tasks page; one whose agent is starting (it has a terminal) shows here.
|
|
40
41
|
export const listed = (c, now) =>
|
|
41
42
|
!c.archived && (c.kind === "idea" ? !!c.pty : !["done", "abandoned"].includes(c.status) || now - (c.moved ?? 0) < DAY);
|
|
42
43
|
export const projName = (dir, projects) => {
|
|
@@ -49,7 +50,7 @@ export const logo = (dir, name, projects) => {
|
|
|
49
50
|
? html`<img class="plogo" src="/project-logo?dir=${encodeURIComponent(dir)}" alt="" loading="lazy" onerror="this.outerHTML=this.dataset.f" data-f="${String(ini)}">`
|
|
50
51
|
: ini;
|
|
51
52
|
};
|
|
52
|
-
// A card's address: its run workspace (?view=run&dir=&id=, or &idea= for
|
|
53
|
+
// A card's address: its run workspace (?view=run&dir=&id=, or &idea= for a task).
|
|
53
54
|
export const cardHref = (c) =>
|
|
54
55
|
`/?view=run&dir=${encodeURIComponent(c.state)}&` + (c.kind === "run" ? "id=" + encodeURIComponent(c.id) : "idea=" + encodeURIComponent(c.text));
|
|
55
56
|
|
|
@@ -184,7 +185,7 @@ const foldAll = (shut: boolean) => {
|
|
|
184
185
|
drawList();
|
|
185
186
|
};
|
|
186
187
|
// A card's workspace row: its own (a run's worktree) when the project lists it, else the
|
|
187
|
-
// main checkout's, so a run whose worktree is gone,
|
|
188
|
+
// main checkout's, so a run whose worktree is gone, a task or an old run never vanishes.
|
|
188
189
|
export function wsOfCard(c, projects = last.projects) {
|
|
189
190
|
const ws = projects?.find((p) => p.dir === c.state)?.workspaces ?? [];
|
|
190
191
|
return ws.find((w) => w.path === c.ws)?.path ?? ws.find((w) => w.main)?.path ?? c.ws ?? "";
|
|
@@ -294,7 +295,7 @@ addEventListener("popstate", markCurrent);
|
|
|
294
295
|
// The pages that can open a card in place (the board) answer this event and cancel it.
|
|
295
296
|
const ask = (name, detail) => !dispatchEvent(new CustomEvent(name, { cancelable: true, detail }));
|
|
296
297
|
|
|
297
|
-
// What the
|
|
298
|
+
// What the Tasks page reads too: the cards, and /sources (sources plus every icebox signal).
|
|
298
299
|
let srcs: any = null;
|
|
299
300
|
export const railData = () => ({ ...last, srcs });
|
|
300
301
|
const told = () => dispatchEvent(new Event("kz-rail"));
|
|
@@ -497,6 +498,7 @@ export function initFooter(goTerminal: () => void) {
|
|
|
497
498
|
const fh = () => document.documentElement.style.setProperty("--foot-h", $("foot").offsetHeight + "px");
|
|
498
499
|
new ResizeObserver(fh).observe($("foot"));
|
|
499
500
|
fh();
|
|
501
|
+
initResources();
|
|
500
502
|
void usage();
|
|
501
503
|
void phone();
|
|
502
504
|
setInterval(() => void usage(), 5 * 60_000);
|
package/web/board/ws-board-ui.ts
CHANGED
|
@@ -80,7 +80,7 @@ export function drawWsBoard(inScope: (dir: string) => boolean) {
|
|
|
80
80
|
if (col !== 2 && !inScope(dir)) continue;
|
|
81
81
|
if (q && col !== 2 && !`${wsLabel(w)} ${name} ${cs.map(titleOf).join(" ")}`.toLowerCase().includes(q)) continue;
|
|
82
82
|
const lead = [...open].sort((x, y) => RANK[stateOf(x)] - RANK[stateOf(y)])[0] ?? last;
|
|
83
|
-
//
|
|
83
|
+
// A task whose agent asks adds the waiting dot; its column never changes.
|
|
84
84
|
const asks = cs.some((c) => c.kind === "idea" && stateOf(c) === "wait");
|
|
85
85
|
const st = asks ? "wait" : lead ? stateOf(lead) : "idle";
|
|
86
86
|
cols[col].push(
|
|
@@ -13,7 +13,7 @@ const stateOf = (c) =>
|
|
|
13
13
|
: c.column >= 3 ? "review" : c.column === 2 ? "build" : "plan";
|
|
14
14
|
const col = (cs: any[], ws = "/p") => columnOf(cs, D, ws, wsOf, stateOf).col;
|
|
15
15
|
|
|
16
|
-
test("no runs, only
|
|
16
|
+
test("no runs, only tasks, an asking idea: Todo", () => {
|
|
17
17
|
expect(col([])).toBe(0);
|
|
18
18
|
expect(col([{ kind: "idea", state: D, text: "t", ws: "/p" }])).toBe(0);
|
|
19
19
|
expect(col([{ kind: "idea", state: D, text: "t", ws: "/p", pty: { alive: true, asking: true } }])).toBe(0);
|
package/web/board/ws-board.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { finished } from "./ws-tabs.ts";
|
|
4
4
|
|
|
5
5
|
export const WS_COLS = ["Todo", "In progress", "In review", "Done"];
|
|
6
|
-
// A workspace's column from its runs (
|
|
6
|
+
// A workspace's column from its runs (tasks never move it). Archived runs still count as
|
|
7
7
|
// finished ones, so a workspace whose newest run is done stays Done until a new run starts.
|
|
8
8
|
// Returns the open runs (not finished, not archived) and the newest finished run, for the card.
|
|
9
9
|
export function columnOf(cards: any[], dir: string, ws: string, wsOfCard, stateOf) {
|
|
@@ -15,7 +15,7 @@ const cards = [
|
|
|
15
15
|
{ kind: "idea", state: "/p/.kaizen", text: "no agent", ws: "/p" },
|
|
16
16
|
];
|
|
17
17
|
|
|
18
|
-
test("live runs get terminals;
|
|
18
|
+
test("live runs get terminals; a task only with its agent; a run waiting on approval stays", () => {
|
|
19
19
|
expect(liveIn(cards, "/p/.kaizen", "/p", wsOf).map((c) => c.id ?? c.text)).toEqual(["a", "b", "e", "t"]);
|
|
20
20
|
expect(liveIn(cards, "/p/.kaizen", "/p/.kaizen/wt/x", wsOf).map((c) => c.id)).toEqual(["f"]);
|
|
21
21
|
expect(finished(cards[4])).toBe(false);
|
|
@@ -84,7 +84,7 @@ test("toOpen: a run that moves into review or done opens the Browser once; other
|
|
|
84
84
|
expect(toOpen(cs, new Set(), ["c"], key).map(key)).toEqual(["b"]); // c already opened once
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
test("pickable: waiting first, then newest; done+approved, abandoned, archived and
|
|
87
|
+
test("pickable: waiting first, then newest; done+approved, abandoned, archived and tasks are not listed", () => {
|
|
88
88
|
const cs = [run("old", "building", { moved: 1 }), run("new", "building", { moved: 9 }), run("w", "waiting", { moved: 2 }), run("e", "done", { accept: "needs", moved: 3 }), ...cards.slice(2, 4), cards[6], cards[7], cards[5]];
|
|
89
89
|
expect(pickable(cs, "/p/.kaizen", "/p", wsOf).map((c) => c.id)).toEqual(["e", "w", "new", "old"]);
|
|
90
90
|
expect(pickable(cs, "/p/.kaizen", "/p/.kaizen/wt/x", wsOf).map((c) => c.id)).toEqual(["f"]);
|
|
@@ -203,3 +203,11 @@ test("nearestPane walks a split like tmux", () => {
|
|
|
203
203
|
expect(nearestPane(b, "a", "r")).toBe("b");
|
|
204
204
|
expect(nearestPane(b, "gone", "r")).toBeNull();
|
|
205
205
|
});
|
|
206
|
+
|
|
207
|
+
test("a failed land outranks every other agent status", () => {
|
|
208
|
+
const a = { key: "k", dir: "d", name: "Claude", asking: true, busy: true };
|
|
209
|
+
expect(agentStatus({ ...a, land: "conflict" }, 0, new Map())).toBe("conflict");
|
|
210
|
+
expect(agentStatus({ ...a, land: "check" }, 0, new Map())).toBe("failed");
|
|
211
|
+
expect(lineOf({ a: { ...a, land: "conflict", last: "x" }, st: "conflict" })).toBe("Conflict - Claude");
|
|
212
|
+
expect(agentStatus(a, 0, new Map())).toBe("asking");
|
|
213
|
+
});
|
package/web/board/ws-tabs.ts
CHANGED
|
@@ -48,7 +48,7 @@ export const dueWord = (c) => (c.gitDue === "push" ? "push" : "commit");
|
|
|
48
48
|
// A run that is over: abandoned, or done and neither waiting on an approval nor on its commit. It is History.
|
|
49
49
|
export const finished = (c) => c.kind === "run" && (c.status === "abandoned" || (c.status === "done" && c.accept !== "needs" && !gitDue(c)));
|
|
50
50
|
const here = (c, dir: string, ws: string, wsOfCard) => c.state === dir && wsOfCard(c) === ws;
|
|
51
|
-
// The cards whose agent terminals get tabs in a workspace: runs not over, and
|
|
51
|
+
// The cards whose agent terminals get tabs in a workspace: runs not over, and tasks whose agent is open.
|
|
52
52
|
export const liveIn = (cards: any[], dir: string, ws: string, wsOfCard) =>
|
|
53
53
|
cards.filter((c) => !c.archived && here(c, dir, ws, wsOfCard) && (c.kind === "idea" ? !!c.pty : c.kind === "run" && !finished(c)));
|
|
54
54
|
// History: the workspace's finished runs, newest first.
|
|
@@ -98,7 +98,7 @@ export const chosen = (live: any[], hist: any[], picked?: string | null, keyOf:
|
|
|
98
98
|
export const newRun = (live: any[], seen: Set<string>, keyOf: (c) => string = (c) => c.id) => live.find((c) => !seen.has(keyOf(c)));
|
|
99
99
|
|
|
100
100
|
// The terminal the board launched for each stage of a run: plan/impl/review sub-tab -> pty key.
|
|
101
|
-
// plan, impl and review are recorded when the board launches them (the
|
|
101
|
+
// plan, impl and review are recorded when the board launches them (the task's agent once its run
|
|
102
102
|
// exists, /decide, /fix). A plan that was not recorded falls back to the session no stage claims,
|
|
103
103
|
// and only until a later stage has been launched.
|
|
104
104
|
export function stageKeys(c): Record<string, string> {
|
|
@@ -139,17 +139,18 @@ export const loopbackUrl = (pv?: string | null) => (pv ? /https?:\/\/(?:localhos
|
|
|
139
139
|
export const toOpen = (cards: any[], was: Set<string>, seen: string[], keyOf: (c) => string) => cards.filter((c) => reviewing(c) && !was.has(keyOf(c)) && !seen.includes(keyOf(c)));
|
|
140
140
|
|
|
141
141
|
// ---- the sidebar card's agents (/state `agents`, one entry per open agent terminal)
|
|
142
|
-
export type Agent = { key: string; dir: string; ws?: string; agent?: string; name: string; run?: string; asking: boolean; busy: boolean; last?: string; at?: number; born?: number };
|
|
143
|
-
export type Status = "asking" | "working" | "done";
|
|
142
|
+
export type Agent = { key: string; dir: string; ws?: string; agent?: string; name: string; run?: string; asking: boolean; busy: boolean; last?: string; at?: number; born?: number; land?: string };
|
|
143
|
+
export type Status = "conflict" | "failed" | "asking" | "working" | "done";
|
|
144
144
|
// Output flickers: entering "working" is immediate, leaving it for "done" waits this long after the last busy tick.
|
|
145
145
|
export const SETTLE_MS = 3000;
|
|
146
146
|
const seenBusy = new Map<string, number>(); // pty key + start time -> when it was last seen busy
|
|
147
147
|
const id = (a: Agent) => a.key + "@" + (a.born ?? 0); // a restarted pty under the same key is a new agent
|
|
148
|
-
const ORDER: Record<Status, number> = { asking: 0, working: 1, done: 2 };
|
|
149
|
-
const WORD: Record<Status, string> = { asking: "Asking", working: "Working", done: "Done" };
|
|
150
|
-
const DOT: Record<Status, string> = { asking: "wait", working: "build", done: "done" }; // the .si icons
|
|
148
|
+
const ORDER: Record<Status, number> = { conflict: 0, failed: 0, asking: 0, working: 1, done: 2 };
|
|
149
|
+
export const WORD: Record<Status, string> = { conflict: "Conflict", failed: "Land failed", asking: "Asking", working: "Working", done: "Done" };
|
|
150
|
+
export const DOT: Record<Status, string> = { conflict: "fail", failed: "fail", asking: "wait", working: "build", done: "done" }; // the .si icons
|
|
151
151
|
// asking comes first and is immediate both ways (the server already waits for the screen to settle).
|
|
152
152
|
export function agentStatus(a: Agent, now: number, seen = seenBusy): Status {
|
|
153
|
+
if (a.land) return a.land === "conflict" ? "conflict" : "failed";
|
|
153
154
|
if (a.asking) return "asking";
|
|
154
155
|
if (a.busy) return (seen.set(id(a), now), "working");
|
|
155
156
|
return now - (seen.get(id(a)) ?? -Infinity) < SETTLE_MS ? "working" : "done";
|
|
@@ -166,7 +167,7 @@ export const wsAgents = (as: Agent[], dir: string, ws: string, wsOf, now: number
|
|
|
166
167
|
.map((a) => ({ a, st: agentStatus(a, now, seen) }))
|
|
167
168
|
.sort((x, y) => ORDER[x.st] - ORDER[y.st]);
|
|
168
169
|
// An expanded card's row text: the agent's latest output line, else the status and the agent.
|
|
169
|
-
export const lineOf = ({ a, st }: ARow) => a.last || `${WORD[st]} - ${a.name}`;
|
|
170
|
+
export const lineOf = ({ a, st }: ARow) => (a.land ? "" : a.last) || `${WORD[st]} - ${a.name}`;
|
|
170
171
|
const ago = (t: number | undefined, now: number) => (!t ? "" : now - t < 60e3 ? "now" : age(t, now));
|
|
171
172
|
// Expanded cards, remembered per workspace (localStorage kz-wsopen): the map of dir\0ws to true.
|
|
172
173
|
export const openKey = (dir: string, ws: string) => dir + "\0" + ws;
|
|
@@ -192,7 +193,7 @@ export function agentsHtml(rows: ARow[], now: number, open: boolean, dir: string
|
|
|
192
193
|
const chev = html`<button type="button" class="wchev${open ? " on" : ""}" data-wopen ${at} aria-expanded="${String(open)}" aria-label="${String(rows.length)} agents: ${open ? "hide" : "show"} the list">${CHEV}</button>`;
|
|
193
194
|
if (open)
|
|
194
195
|
return html`<div class="wag"><span class="aht">${String(rows.length)} agents</span>${chev}</div><div class="alist">${rows.map((r) => html`<button type="button" class="arow" data-term="${r.a.key}" ${at} title="${lineOf(r)}">${dot(r.st)}${mark(r.a)}<span class="atx">${lineOf(r)}</span><small>${ago(r.a.at, now)}</small></button>`)}</div>`;
|
|
195
|
-
const chips = (["asking", "working", "done"] as Status[]).map((st) => ({ st, rs: rows.filter((r) => r.st === st) })).filter((g) => g.rs.length);
|
|
196
|
+
const chips = (["conflict", "failed", "asking", "working", "done"] as Status[]).map((st) => ({ st, rs: rows.filter((r) => r.st === st) })).filter((g) => g.rs.length);
|
|
196
197
|
return html`<div class="wag"><span class="chips">${chips.map((g) => html`<span class="chip">${dot(g.st)}${g.rs.map((r) => html`<button type="button" class="amark" data-term="${r.a.key}" ${at} title="${r.a.name} - ${WORD[g.st]}: open its terminal" aria-label="${r.a.name} - ${WORD[g.st]}: open its terminal">${mark(r.a)}</button>`)}</span>`)}</span>${chev}</div>`;
|
|
197
198
|
}
|
|
198
199
|
|