kaizen-agent 1.66.0 → 1.68.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/onboarding.ts +1 -1
- package/cli/phone-setup.ts +96 -0
- package/cli/pty.ts +24 -2
- package/cli/settings.ts +1 -1
- package/cli/web.ts +55 -5
- package/package.json +2 -1
- package/skills/kaizen/config.default.yml +4 -0
- package/skills/kaizen/spec-build.md +4 -1
- package/web/board/onboarding.ts +8 -4
- package/web/board/phone-setup.ts +79 -0
- package/web/board/run-view.ts +62 -2
- package/web/board/settings.ts +3 -1
- package/web/board/update.ts +60 -14
- package/web/board/workspace.ts +2 -2
- package/web/board.html +96 -81
- package/web/board.js +147 -128
- package/web/notebook.js +17 -17
- package/web/notes.html +23 -21
- package/web/term.js +69 -43
- package/web/term.ts +17 -1
- package/web/video.html +27 -25
- package/web/video.js +19 -19
package/web/board/update.ts
CHANGED
|
@@ -9,41 +9,66 @@ import { view } from "./views.ts";
|
|
|
9
9
|
// is a quiet row whose Check for updates asks npm now instead of the server's 6 h cache.
|
|
10
10
|
let upd = null,
|
|
11
11
|
ver = null;
|
|
12
|
+
// Inside the desktop app (desktop/src/preload.ts) the version and the update are the
|
|
13
|
+
// app's own, from GitHub Releases; anywhere else, kaizen's npm package.
|
|
14
|
+
const desk = globalThis.kaizenDesktop;
|
|
15
|
+
const name = desk ? "Kaizen" : "kaizen";
|
|
16
|
+
const getVer = (fresh) => (desk ? desk.check() : fetch(fresh ? "/version?fresh=1" : "/version").then((r) => r.json()));
|
|
12
17
|
export function gotVer(v) {
|
|
13
18
|
ver = v;
|
|
14
19
|
upd = v.update ? v : null;
|
|
15
20
|
const a = document.querySelector('.rail a[data-view="settings"]');
|
|
16
21
|
a.classList.toggle("upd", !!upd);
|
|
17
|
-
a.title = upd ? `Settings:
|
|
22
|
+
a.title = upd ? `Settings: ${name} ${v.latest} is available` : "Settings";
|
|
18
23
|
return !!upd;
|
|
19
24
|
}
|
|
20
25
|
export function updBar() {
|
|
21
26
|
const d = document.createElement("div");
|
|
22
27
|
d.className = `updbar${upd ? "" : " quiet"}`;
|
|
23
28
|
if (!upd) {
|
|
24
|
-
d.innerHTML = html`<span id="upd-msg" aria-live="polite">${ver ?
|
|
29
|
+
d.innerHTML = html`<span id="upd-msg" aria-live="polite">${ver ? `${name} ${ver.version}` : name}</span
|
|
30
|
+
><button class="btn" id="upd-chk">Check for updates</button>`;
|
|
25
31
|
} else {
|
|
26
32
|
// What's new: each newer release's one-line title, shown on hover, focus or click.
|
|
27
33
|
const notes = (upd.notes || []).map((n) => html`<li><b>${n.v}</b> ${n.text}</li>`);
|
|
28
34
|
const news = notes.length
|
|
29
|
-
? html`<span class="updnew"
|
|
35
|
+
? html`<span class="updnew"
|
|
36
|
+
><button class="btn" aria-describedby="upd-notes">What's new</button
|
|
37
|
+
><span class="updpop" id="upd-notes" role="tooltip"
|
|
38
|
+
><ul>
|
|
39
|
+
${notes}
|
|
40
|
+
</ul>
|
|
41
|
+
<a href="https://github.com/hfadhlullah/kaizen/releases" target="_blank" rel="noopener"
|
|
42
|
+
>All release notes</a
|
|
43
|
+
></span
|
|
44
|
+
></span
|
|
45
|
+
>`
|
|
30
46
|
: "";
|
|
31
|
-
d.innerHTML = html`<span
|
|
47
|
+
d.innerHTML = html`<span>${name} <b>${upd.latest}</b> is available. You are running ${upd.version}.</span
|
|
48
|
+
><span class="updact"
|
|
49
|
+
>${news}<button class="btn" id="upd-chk">Check for updates</button
|
|
50
|
+
><button class="btn pri" id="upd-go">Update ${name}</button></span
|
|
51
|
+
>`;
|
|
32
52
|
}
|
|
33
|
-
if (ver && ver.failed)
|
|
53
|
+
if (ver && ver.failed)
|
|
54
|
+
d.insertAdjacentHTML(
|
|
55
|
+
"afterbegin",
|
|
56
|
+
html`<span class="updfail" role="alert">Last update failed: ${ver.failed}</span>`,
|
|
57
|
+
);
|
|
34
58
|
($("supd") || $("pbody")).prepend(d);
|
|
35
59
|
const check = $("upd-chk");
|
|
36
60
|
check.onclick = async () => {
|
|
37
61
|
check.disabled = true;
|
|
38
62
|
check.textContent = "Checking…";
|
|
39
|
-
const v = await
|
|
40
|
-
.then((r) => r.json())
|
|
41
|
-
.catch(() => null);
|
|
63
|
+
const v = await getVer(true).catch(() => null);
|
|
42
64
|
if (!d.isConnected) return;
|
|
43
65
|
check.disabled = false;
|
|
44
66
|
if (!v || !v.latest) {
|
|
45
67
|
if (upd) check.textContent = "Could not check. Try again";
|
|
46
|
-
else
|
|
68
|
+
else
|
|
69
|
+
$("upd-msg").textContent = desk
|
|
70
|
+
? "Could not reach GitHub Releases. Try again later."
|
|
71
|
+
: "Could not reach npm. Try again later.";
|
|
47
72
|
return;
|
|
48
73
|
}
|
|
49
74
|
gotVer(v);
|
|
@@ -52,7 +77,7 @@ export function updBar() {
|
|
|
52
77
|
updBar();
|
|
53
78
|
if (upd) $("upd-go").focus();
|
|
54
79
|
else {
|
|
55
|
-
$("upd-msg").textContent =
|
|
80
|
+
$("upd-msg").textContent = `${name} ${v.version} is up to date.`;
|
|
56
81
|
$("upd-chk").focus();
|
|
57
82
|
}
|
|
58
83
|
};
|
|
@@ -62,6 +87,7 @@ export function updBar() {
|
|
|
62
87
|
}
|
|
63
88
|
|
|
64
89
|
async function upgrade(b) {
|
|
90
|
+
if (desk) return installApp(b);
|
|
65
91
|
if (!confirm(`Update kaizen to ${upd.latest}? kaizen restarts, and agents it runs stop.`)) return;
|
|
66
92
|
const label = b.textContent;
|
|
67
93
|
b.disabled = true;
|
|
@@ -76,6 +102,23 @@ async function upgrade(b) {
|
|
|
76
102
|
setTimeout(() => location.reload(), 20000);
|
|
77
103
|
}
|
|
78
104
|
|
|
105
|
+
// The desktop app installs its newest build and restarts into it; an unsigned macOS
|
|
106
|
+
// build cannot replace itself, so there the app opens the download page instead.
|
|
107
|
+
async function installApp(b) {
|
|
108
|
+
if (!confirm(`Install Kaizen ${upd.latest}? The app restarts, and agents it runs stop.`)) return;
|
|
109
|
+
const label = b.textContent;
|
|
110
|
+
b.disabled = true;
|
|
111
|
+
b.textContent = "Downloading…";
|
|
112
|
+
const r = await desk.install().catch((e) => ({ ok: false, error: String(e) }));
|
|
113
|
+
if (r && r.ok && !r.opened) {
|
|
114
|
+
b.textContent = "Restarting…";
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
b.disabled = false;
|
|
118
|
+
b.textContent = r && r.opened ? "Opened the download page" : label;
|
|
119
|
+
if (r && !r.ok) alert(`Could not install the update: ${r.error}`);
|
|
120
|
+
}
|
|
121
|
+
|
|
79
122
|
// The bottom-right popup for a new release. Later silences that version in this browser;
|
|
80
123
|
// the next release asks again.
|
|
81
124
|
function updPop() {
|
|
@@ -85,7 +128,7 @@ function updPop() {
|
|
|
85
128
|
} catch {}
|
|
86
129
|
const open = $("updcard");
|
|
87
130
|
if (!upd || later === upd.latest) return open?.remove();
|
|
88
|
-
const msg = html
|
|
131
|
+
const msg = html`${name} <b>${upd.latest}</b> is available. You are running ${upd.version}.`;
|
|
89
132
|
if (open) {
|
|
90
133
|
open.firstElementChild.innerHTML = msg;
|
|
91
134
|
return;
|
|
@@ -93,7 +136,11 @@ function updPop() {
|
|
|
93
136
|
const d = document.createElement("div");
|
|
94
137
|
d.id = "updcard";
|
|
95
138
|
d.setAttribute("role", "status");
|
|
96
|
-
d.innerHTML = html`<span>${msg}</span
|
|
139
|
+
d.innerHTML = html`<span>${msg}</span
|
|
140
|
+
><span class="updact"
|
|
141
|
+
><button class="btn" id="updcard-later">Later</button
|
|
142
|
+
><button class="btn pri" id="updcard-go">Update now</button></span
|
|
143
|
+
>`;
|
|
97
144
|
document.body.append(d);
|
|
98
145
|
$("updcard-later").onclick = () => {
|
|
99
146
|
try {
|
|
@@ -107,8 +154,7 @@ function updPop() {
|
|
|
107
154
|
|
|
108
155
|
function checkUpdate() {
|
|
109
156
|
const had = !!upd;
|
|
110
|
-
|
|
111
|
-
.then((r) => r.json())
|
|
157
|
+
getVer(false)
|
|
112
158
|
.then((v) => {
|
|
113
159
|
if (gotVer(v) && !had && view === "settings") openSettings();
|
|
114
160
|
updPop();
|
package/web/board/workspace.ts
CHANGED
|
@@ -246,14 +246,14 @@ function drawList() {
|
|
|
246
246
|
shut = folded.has(dir);
|
|
247
247
|
// A + for a new worktree on git projects (the main checkout has a branch).
|
|
248
248
|
const git = p.workspaces.some((w) => w.branch);
|
|
249
|
-
return html`<div class="pgrp"><button type="button" class="proj${shut ? " shut" : ""}" data-fold="${dir}" title="${dir}" aria-expanded="${String(!shut)}">${logo(dir, name, last.projects)}<span class="pname">${name}</span><svg class="fchev" viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6l6 6-6 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>${git ? html`<button type="button" class="wadd" data-wadd="${dir}" title="New workspace in ${name}" aria-label="New workspace in ${name}"><svg aria-hidden="true"><use href="#i-plus"/></svg></button>` : ""}</div>${shut ? "" : rows.map(({ w, cs }) => {
|
|
249
|
+
return html`<div class="pgrp"><button type="button" class="proj${shut ? " shut" : ""}" data-fold="${dir}" title="${dir}" aria-expanded="${String(!shut)}">${logo(dir, name, last.projects)}<span class="pname">${name}</span><svg class="fchev" viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6l6 6-6 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>${git ? html`<button type="button" class="wadd" data-wadd="${dir}" title="New workspace in ${name}" aria-label="New workspace in ${name}"><svg aria-hidden="true"><use href="#i-plus"/></svg></button>` : ""}</div>${shut ? "" : raw('<div class="pws">')}${shut ? "" : rows.map(({ w, cs }) => {
|
|
250
250
|
// The dot: the most urgent run there, or an agent asking (amber) or working (spinner).
|
|
251
251
|
const rows = wsAgents(last.agents ?? [], dir, w.path, wsOfCard, now);
|
|
252
252
|
const st0 = cs.length ? stateOf([...cs].sort((a, b) => RANK[stateOf(a)] - RANK[stateOf(b)])[0]) : "";
|
|
253
253
|
const st = st0 === "wait" || rows[0]?.st === "asking" ? "wait" : rows.some((r) => r.st === "working") ? "build" : st0 || (rows.length ? "done" : "");
|
|
254
254
|
// The agent buttons are siblings of the link (a button inside a link is invalid).
|
|
255
255
|
return html`<div class="wsr wsc"><a class="row ws" href="${wsHref(dir, w.path)}" data-dir="${dir}" data-ws="${w.path}" title="${w.path}"><span class="si ${st || "none"}"></span><div class="wl"><span class="l1"><b>${wsLabel(w)}</b>${pins.has(dir + "\0" + w.path) ? PIN : ""}</span><span class="l2"><span>${folderOf(w)}</span>${w.main ? "" : WT}</span></div></a>${agentsHtml(rows, now, !!wsOpen[dir + "\0" + w.path], dir, w.path)}</div>`;
|
|
256
|
-
})}`;
|
|
256
|
+
})}${shut ? "" : raw("</div>")}`;
|
|
257
257
|
})
|
|
258
258
|
.join("") || `<div class="none">No projects</div>`;
|
|
259
259
|
// The same markup is not written again: hover and focus stay, and a tick that changed nothing costs no layout.
|