kaizen-agent 1.57.0 → 1.58.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 +3 -3
- package/package.json +1 -1
- package/web/board/cards.ts +22 -2
- package/web/board/ideas.ts +3 -6
- package/web/board/panel.ts +5 -4
- package/web/board/run-view.ts +10 -1
- package/web/board/workspace.ts +11 -0
- package/web/board.js +36 -36
- package/web/notebook.js +19 -19
- package/web/term.js +1 -1
- package/web/video.js +18 -18
package/cli/web.ts
CHANGED
|
@@ -498,7 +498,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
498
498
|
// elsewhere only the popup opens and closes.
|
|
499
499
|
if (req.method === "POST" && (path === "/popup/open" || path === "/popup/board")) {
|
|
500
500
|
const body = await req.json().catch(() => ({}));
|
|
501
|
-
const chat = (...a: string[]) => Bun.spawn([process.execPath, join(import.meta.dir, "install.ts"), "chat", "--port", String(new URL(req.url).port || DEFAULT_PORT), ...a], { stdout: "ignore", stderr: "ignore" }).exited;
|
|
501
|
+
const chat = (...a: string[]) => Bun.spawn([process.execPath, join(import.meta.dir, "install.ts"), "chat", "--port", String(new URL(req.url).port || DEFAULT_PORT), ...a], { stdout: "ignore", stderr: "ignore", windowsHide: true }).exited;
|
|
502
502
|
const hypr = !!process.env.HYPRLAND_INSTANCE_SIGNATURE && !!Bun.which("hyprctl");
|
|
503
503
|
const json = async (cmd: string) => await Bun.$`hyprctl ${cmd} -j`.quiet().nothrow().json().catch(() => null);
|
|
504
504
|
// Several windows can show a board: Pop out takes the one clicked in (the active
|
|
@@ -724,7 +724,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
724
724
|
// Async: a hung tailscale must not stall every terminal socket on this event loop.
|
|
725
725
|
let out = "";
|
|
726
726
|
try {
|
|
727
|
-
const p = Bun.spawn(["tailscale", "status", "--json"], { stdout: "pipe", stderr: "ignore", timeout: 5000 });
|
|
727
|
+
const p = Bun.spawn(["tailscale", "status", "--json"], { stdout: "pipe", stderr: "ignore", timeout: 5000, windowsHide: true });
|
|
728
728
|
out = await new Response(p.stdout).text();
|
|
729
729
|
await p.exited;
|
|
730
730
|
} catch { return json({ tailscale: false }); }
|
|
@@ -1268,7 +1268,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
1268
1268
|
try { used = readdirSync(to).length > 0; } catch (e) { used = existsSync(to); }
|
|
1269
1269
|
if (used) return bad(`${to} already exists and is not empty`, 409);
|
|
1270
1270
|
mkdirSync(to, { recursive: true });
|
|
1271
|
-
const p = Bun.spawn(["git", "clone", "--", link, to], { stdin: "ignore", stdout: "ignore", stderr: "pipe", env: { ...process.env, GIT_TERMINAL_PROMPT: "0", GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND ?? "ssh -o BatchMode=yes" } });
|
|
1271
|
+
const p = Bun.spawn(["git", "clone", "--", link, to], { stdin: "ignore", stdout: "ignore", stderr: "pipe", env: { ...process.env, GIT_TERMINAL_PROMPT: "0", GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND ?? "ssh -o BatchMode=yes" }, windowsHide: true });
|
|
1272
1272
|
const [err, code] = await Promise.all([new Response(p.stderr).text(), p.exited]);
|
|
1273
1273
|
if (code !== 0) return bad(err.trim().split("\n").filter(Boolean).pop() || "git clone failed", 500);
|
|
1274
1274
|
mkdirSync(join(to, ".kaizen"), { recursive: true });
|
package/package.json
CHANGED
package/web/board/cards.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { askNotify, toast } from "./toast.ts";
|
|
|
12
12
|
import { answer, decided, resumable, resume } from "./approvals.ts";
|
|
13
13
|
import { termsBadge } from "./terms.ts";
|
|
14
14
|
import { boardBadge, waitingCount } from "./badge.ts";
|
|
15
|
+
import { openWorkspace } from "./run-view.ts";
|
|
15
16
|
|
|
16
17
|
let filter = null;
|
|
17
18
|
let query = ""; // the header filter box, matched against a card's title and request
|
|
@@ -392,7 +393,7 @@ function inlineForm(c) {
|
|
|
392
393
|
};
|
|
393
394
|
}
|
|
394
395
|
if (store.mode === "run") {
|
|
395
|
-
li.innerHTML =
|
|
396
|
+
li.innerHTML = runHtml(c);
|
|
396
397
|
li.querySelector("[data-a=s]").onclick = () => startRun(c, "full");
|
|
397
398
|
li.querySelector("[data-a=l]").onclick = () => startRun(c, "lite");
|
|
398
399
|
runForm(li, c);
|
|
@@ -422,6 +423,23 @@ function inlineForm(c) {
|
|
|
422
423
|
return li;
|
|
423
424
|
}
|
|
424
425
|
|
|
426
|
+
const runHtml = (c) =>
|
|
427
|
+
html`<div class="q">Run "${c.text}"</div><div class="q dim">Opens your agent with this request in a terminal.</div><div class="q dim">Full plans, builds, and checks with a separate reviewer. Lite does it in one session.</div><div id="run-pick" style="display:grid;gap:6px"><div id="run-agent" class="agents" role="radiogroup" aria-label="Agent"></div></div><div class="run-actions"><label class="yolo" id="run-yolo" title="Yolo: the agent runs every command and edit without asking" hidden><button type="button" class="chk" role="switch" aria-checked="false"></button>Yolo</label><div class="row"><button type="button" class="btn ghost" data-a="c">Cancel</button><button type="button" class="btn" data-a="l">Lite</button><button type="button" class="btn pri" data-a="s">Full run</button></div></div>`;
|
|
428
|
+
// The run form as a popup over any page: Start in the new-idea form and on Ideas.
|
|
429
|
+
export function runPopup(c) {
|
|
430
|
+
const dl = modal(runHtml(c)),
|
|
431
|
+
f = dl.querySelector("form");
|
|
432
|
+
const go = (kind) => {
|
|
433
|
+
// startRun reads the Yolo switch, so the dialog closes after it has.
|
|
434
|
+
void startRun(c, kind);
|
|
435
|
+
dl.close();
|
|
436
|
+
};
|
|
437
|
+
f.querySelector<HTMLElement>("[data-a=s]").onclick = () => go("full");
|
|
438
|
+
f.querySelector<HTMLElement>("[data-a=l]").onclick = () => go("lite");
|
|
439
|
+
f.querySelector<HTMLElement>("[data-a=c]").onclick = () => dl.close();
|
|
440
|
+
runForm(f, c);
|
|
441
|
+
}
|
|
442
|
+
|
|
425
443
|
let editFiles = { k: "", files: [] };
|
|
426
444
|
// The agent and Basic/Yolo picked in the open Run form. Kept here, not in the form:
|
|
427
445
|
// the board is rebuilt on every server change, and the choice must outlive that.
|
|
@@ -492,6 +510,8 @@ async function startRun(c, kind) {
|
|
|
492
510
|
toast((kind === "full" ? "Full" : kind === "lite" ? "Lite" : "Started") + (yolo ? " yolo" : "") + " run " + where(r) + ": " + via(r.agent));
|
|
493
511
|
// A backlog card has no terminal of its own; the run's card gets it once the run exists.
|
|
494
512
|
if (r.pty && !backlog) store.wantTerm = key(c);
|
|
513
|
+
// An idea's run opens in its workspace; the view follows it once the run card exists.
|
|
514
|
+
if (!backlog) openWorkspace(c);
|
|
495
515
|
}
|
|
496
516
|
load();
|
|
497
517
|
}
|
|
@@ -540,7 +560,7 @@ function ideaForm(f, shut) {
|
|
|
540
560
|
if (run) {
|
|
541
561
|
await load();
|
|
542
562
|
const c = store.S.cards.find((x) => x.kind === "idea" && x.text === text && (!dir || x.state === dir));
|
|
543
|
-
if (c) return
|
|
563
|
+
if (c) return runPopup(c);
|
|
544
564
|
}
|
|
545
565
|
}
|
|
546
566
|
load();
|
package/web/board/ideas.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { store } from "./store.ts";
|
|
6
6
|
import { $, html, ico, raw } from "./dom.ts";
|
|
7
7
|
import { age, NAMES } from "./labels.ts";
|
|
8
|
-
import { key,
|
|
8
|
+
import { key, runPopup } from "./cards.ts";
|
|
9
9
|
import { openWorkspace } from "./run-view.ts";
|
|
10
10
|
import { refreshBoardBadge } from "./badge.ts";
|
|
11
11
|
import { cardHref, drawSources, logo, railData, srcIcon, stateOf, titleOf } from "./workspace.ts";
|
|
@@ -117,7 +117,7 @@ function draw() {
|
|
|
117
117
|
mark();
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
// Start: the
|
|
120
|
+
// Start: the run form in a popup (agent pick, then go), then the run workspace. Open: the card.
|
|
121
121
|
// Cards of a project this board is not showing go through the board's deep link.
|
|
122
122
|
function act(c) {
|
|
123
123
|
const here = store.S.cards.find((x) => key(x) === key(c));
|
|
@@ -126,10 +126,7 @@ function act(c) {
|
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
if (c.kind === "run") return openWorkspace(here);
|
|
129
|
-
|
|
130
|
-
store.mode = "run";
|
|
131
|
-
store.modeKey = key(here);
|
|
132
|
-
render();
|
|
129
|
+
runPopup(here);
|
|
133
130
|
}
|
|
134
131
|
|
|
135
132
|
function mark() {
|
package/web/board/panel.ts
CHANGED
|
@@ -153,8 +153,8 @@ export async function openRun(c, refresh, again) {
|
|
|
153
153
|
// (a resumed agent's terminal, not the one that ended).
|
|
154
154
|
c = store.S.cards.find((x) => key(x) === store.openKey) || c;
|
|
155
155
|
// A refresh while notes are being typed would wipe the textarea.
|
|
156
|
-
|
|
157
|
-
if (refresh &&
|
|
156
|
+
// The textarea is hidden under the rich editor: focus anywhere in the notes counts.
|
|
157
|
+
if (refresh && $("pbody").querySelector(".notes")?.contains(document.activeElement)) return;
|
|
158
158
|
// The board's own status mark, then what it waits on: chips, not a dotted line.
|
|
159
159
|
$("psub").innerHTML = c.status === "abandoned" ? html`<span class="pst"><span class="st d-${ICON[c.status] || "idea"}"><svg><use href="#s-${ICON[c.status] || "idea"}"/></svg></span>${cap(WORD[c.status] || c.status)}</span>` +
|
|
160
160
|
(c.awaiting ? html`<span class="pst dim">${cap(need(c.awaiting))}</span>` : "") +
|
|
@@ -173,7 +173,8 @@ export async function openRun(c, refresh, again) {
|
|
|
173
173
|
store.wantTerm = null;
|
|
174
174
|
store.tab = "term";
|
|
175
175
|
}
|
|
176
|
-
|
|
176
|
+
// In the run workspace the agent is a centre tab, so the panel never shows a terminal.
|
|
177
|
+
if (store.tab === "term" && (!c.pty || view === "run")) store.tab = store.lastTab;
|
|
177
178
|
// In the run workspace Preview is a centre tab, so the panel never shows it.
|
|
178
179
|
if (view === "run" && store.tab === "preview") store.tab = "review";
|
|
179
180
|
// A tab not written yet falls back to the latest one that is.
|
|
@@ -182,7 +183,7 @@ export async function openRun(c, refresh, again) {
|
|
|
182
183
|
if (store.tab !== "term") store.lastTab = store.tab;
|
|
183
184
|
$("panel").classList.toggle("wide", store.tab === "term");
|
|
184
185
|
const pt = $("pterm");
|
|
185
|
-
pt.hidden = !c.pty;
|
|
186
|
+
pt.hidden = !c.pty || view === "run";
|
|
186
187
|
pt.classList.toggle("on", store.tab === "term");
|
|
187
188
|
pt.setAttribute("aria-pressed", store.tab === "term");
|
|
188
189
|
pt.title = pt.ariaLabel = store.tab === "term" ? "Close terminal" : "Terminal";
|
package/web/board/run-view.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { termLoad } from "./agent-term.ts";
|
|
|
13
13
|
import { load, post } from "./api.ts";
|
|
14
14
|
import { attach, md, preview } from "./markdown.ts";
|
|
15
15
|
import { layout } from "./terms.ts";
|
|
16
|
-
import { cardHref, railData } from "./workspace.ts";
|
|
16
|
+
import { cardHref, markCurrent, railData } from "./workspace.ts";
|
|
17
17
|
import { go } from "./views.ts";
|
|
18
18
|
|
|
19
19
|
type Tab = { id: string; kind: "agent" | "shell" | "local" | "preview" | "note" | "wait"; title: string; key?: string; note?: string; agent?: string };
|
|
@@ -115,6 +115,14 @@ export async function showRunView() {
|
|
|
115
115
|
idea = p.get("idea");
|
|
116
116
|
const find = (cs) => cs.find((x) => x.state === dir && (id ? x.kind === "run" && x.id === id : x.kind === "idea" && x.text === idea));
|
|
117
117
|
const c = find(store.S.cards);
|
|
118
|
+
// A launched idea becomes a run: its agent session moves to the run's card, and the view follows.
|
|
119
|
+
const pk = idea && (c ?? card)?.kind === "idea" && (c ?? card)?.pty?.key;
|
|
120
|
+
const run = pk && store.S.cards.find((x) => x.kind === "run" && x.state === dir && (x.pty?.key === pk || x.pty?.all?.includes(pk)));
|
|
121
|
+
if (run) {
|
|
122
|
+
history.replaceState(null, "", cardHref(run));
|
|
123
|
+
markCurrent();
|
|
124
|
+
return showRunView();
|
|
125
|
+
}
|
|
118
126
|
if (!c) {
|
|
119
127
|
// A project this board is not showing: the all-projects board has it.
|
|
120
128
|
if (!store.all && find(railData().cards)) location.href = "/?all=1&" + p.toString();
|
|
@@ -687,5 +695,6 @@ export function initRunView() {
|
|
|
687
695
|
export function openWorkspace(c) {
|
|
688
696
|
const u = cardHref(c);
|
|
689
697
|
if (location.pathname + location.search !== u) history.pushState(null, "", u);
|
|
698
|
+
markCurrent();
|
|
690
699
|
go("run");
|
|
691
700
|
}
|
package/web/board/workspace.ts
CHANGED
|
@@ -122,6 +122,17 @@ function drawList() {
|
|
|
122
122
|
if (d) (e.preventDefault(), fold(d));
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
+
// Moves the side menu's highlight to the card the address names: opening a card in place
|
|
126
|
+
// changes the address without redrawing the list.
|
|
127
|
+
export function markCurrent() {
|
|
128
|
+
const cur = new URLSearchParams(location.search);
|
|
129
|
+
for (const a of document.querySelectorAll<HTMLElement>("#plist a.row")) {
|
|
130
|
+
const on = cur.get("dir") === a.dataset.dir && (cur.get("id") === a.dataset.id || (!!a.dataset.text && cur.get("idea") === a.dataset.text));
|
|
131
|
+
if (on) a.setAttribute("aria-current", "true");
|
|
132
|
+
else a.removeAttribute("aria-current");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
addEventListener("popstate", markCurrent);
|
|
125
136
|
// The pages that can open a card in place (the board) answer this event and cancel it.
|
|
126
137
|
const ask = (name, detail) => !dispatchEvent(new CustomEvent(name, { cancelable: true, detail }));
|
|
127
138
|
|