kaizen-agent 1.87.2 → 1.87.4
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/activity.ts +86 -0
- package/cli/add-project.ts +64 -1
- package/cli/auto-update.ts +33 -0
- package/cli/browser.ts +21 -0
- package/cli/chat.ts +88 -13
- package/cli/chatgpt.ts +1 -1
- package/cli/dashboard.ts +1 -1
- package/cli/install.ts +65 -36
- package/cli/look.ts +1 -0
- package/cli/models.ts +94 -0
- package/cli/onboarding.ts +9 -4
- package/cli/pty.ts +27 -12
- package/cli/release.ts +13 -1
- package/cli/settings.ts +39 -7
- package/cli/sources.ts +84 -20
- package/cli/state.ts +56 -3
- package/cli/task-service.ts +10 -3
- package/cli/usage.ts +15 -2
- package/cli/web.ts +119 -47
- package/cli/whats-new.json +38 -0
- package/cli/whats-new.ts +43 -0
- package/cli/workers.ts +2 -2
- package/package.json +1 -1
- package/skills/kaizen/config.default.yml +3 -0
- package/skills/kaizen/spec.md +6 -0
- package/skills/kaizen-explore/SKILL.md +7 -0
- package/web/components/home/home-window.tsx +0 -36
- package/web/components/home/index.ts +1 -0
- package/web/components/home/onboarding-dialog.tsx +44 -7
- package/web/components/home/works-flow.tsx +119 -0
- package/web/components/icebox/capture-box.tsx +11 -2
- package/web/components/icebox/request-card.tsx +33 -11
- package/web/components/project/add-project-dialog.tsx +1 -1
- package/web/components/rail/rail-list.tsx +51 -7
- package/web/components/run/doc-body.tsx +43 -0
- package/web/components/settings/agent-rows.tsx +15 -11
- package/web/components/settings/browser-row.tsx +1 -1
- package/web/components/settings/setting-row.tsx +10 -6
- package/web/components/settings/settings-section.tsx +5 -3
- package/web/components/settings/skill-card.tsx +32 -2
- package/web/components/settings/update-bar.tsx +53 -35
- package/web/components/settings/whats-new-card.tsx +70 -0
- package/web/components/shared/picker.tsx +21 -1
- package/web/components/shell/rail.tsx +8 -4
- package/web/dist/annotate.js +1 -1
- package/web/dist/board.css +6 -11
- package/web/dist/board.js +83 -56
- package/web/dist/boot.js +1 -1
- package/web/dist/notebook.css +2 -2
- package/web/dist/notebook.js +34 -34
- package/web/dist/popup.css +1 -1
- package/web/dist/popup.js +1 -1
- package/web/dist/term.js +1 -1
- package/web/dist/ui.css +2 -2
- package/web/dist/video.js +1 -1
- package/web/lib/footer/footer-rules.ts +8 -2
- package/web/lib/footer/footer-store.ts +2 -2
- package/web/lib/home/onboarding.ts +63 -17
- package/web/lib/icebox/icebox-actions.ts +24 -2
- package/web/lib/icebox/icebox-store.ts +7 -1
- package/web/lib/icebox/icebox-view.ts +3 -2
- package/web/lib/icebox/icebox.ts +24 -4
- package/web/lib/icebox/use-ice-keys.ts +5 -0
- package/web/lib/project/add-project.ts +6 -0
- package/web/lib/rail/rules.ts +4 -1
- package/web/lib/run/panel-derive.ts +1 -1
- package/web/lib/run/panel-store.ts +1 -0
- package/web/lib/settings/index.ts +2 -0
- package/web/lib/settings/settings-actions.ts +8 -0
- package/web/lib/settings/settings.ts +6 -4
- package/web/lib/settings/use-model-choices.ts +31 -0
- package/web/lib/settings/whats-new.ts +36 -0
- package/web/pages/board/App.tsx +3 -10
- package/web/pages/icebox-page.tsx +173 -125
- package/web/pages/task-page.tsx +17 -4
- package/web/ui/legacy/board.css +4 -9
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// First-run onboarding: one panel over the board with
|
|
2
|
-
// your first project". Where a user got to is kept by the board in ~/.kaizen/onboarding.json (/onboarding), so a skipped or
|
|
1
|
+
// First-run onboarding: one panel over the board with five steps (how kaizen works, default agent, how much to ask, look and
|
|
2
|
+
// notifications, phone), then "Add your first project". Where a user got to is kept by the board in ~/.kaizen/onboarding.json (/onboarding), so a skipped or
|
|
3
3
|
// half-done flow can be continued from the side menu's Setup row or the "Continue setup?" popup. Existing users, who have a
|
|
4
4
|
// project, never see it. This file is its rules and requests; components/home/onboarding-dialog.tsx draws it.
|
|
5
5
|
import { create } from "zustand";
|
|
6
|
-
import { openAdd } from "@lib/project";
|
|
6
|
+
import { onProjectAdded, openAdd } from "@lib/project";
|
|
7
7
|
import { ask } from "@lib/core";
|
|
8
8
|
import { setSetupRow, setShell, setTheme } from "@lib/shell";
|
|
9
9
|
|
|
@@ -13,6 +13,7 @@ export type Cfg = {
|
|
|
13
13
|
step: number;
|
|
14
14
|
total: number;
|
|
15
15
|
default: string;
|
|
16
|
+
preset: string;
|
|
16
17
|
installed: string[];
|
|
17
18
|
agents: { cmd: string; name: string }[];
|
|
18
19
|
install: Record<string, { command?: string; docs: string }>;
|
|
@@ -20,19 +21,42 @@ export type Cfg = {
|
|
|
20
21
|
export type Notif = "na" | "default" | "granted" | "denied";
|
|
21
22
|
// The tools agent.default accepts.
|
|
22
23
|
export const PICKABLE = ["claude", "codex", "agy", "opencode", "gemini"];
|
|
23
|
-
export const NAMES = ["Default agent", "
|
|
24
|
+
export const NAMES = ["How it works", "Default agent", "How much to ask", "Look and alerts", "Phone"];
|
|
24
25
|
export const COPY = [
|
|
26
|
+
{
|
|
27
|
+
title: "How kaizen works",
|
|
28
|
+
sub: "You describe what you want. An AI agent does it in steps, and you stay in charge.",
|
|
29
|
+
},
|
|
25
30
|
{
|
|
26
31
|
title: "Pick your default agent",
|
|
27
32
|
sub: "kaizen works with every CLI agent. Choose the one you will reach for most. You can change it any time in Settings.",
|
|
28
33
|
},
|
|
29
|
-
{
|
|
30
|
-
|
|
34
|
+
{
|
|
35
|
+
title: "How much should kaizen ask you?",
|
|
36
|
+
sub: "This sets how many agents work and when it stops to ask. Change it any time in Settings → Runs.",
|
|
37
|
+
},
|
|
38
|
+
{ title: "Make it yours", sub: "Pick a look, and choose whether kaizen may tell you when it needs you." },
|
|
31
39
|
{
|
|
32
40
|
title: "Use kaizen on your phone",
|
|
33
41
|
sub: "Optional. Check runs and answer agents from your phone. You can skip this now; it is also in Settings → Phone.",
|
|
34
42
|
},
|
|
35
43
|
];
|
|
44
|
+
// The steps by what they hold, so a step can move without every number changing.
|
|
45
|
+
export const STEP = { works: 0, agent: 1, ask: 2, look: 3, phone: 4 } as const;
|
|
46
|
+
// The three presets in plain words. `id` is the preset's own name, which Settings → Runs shows.
|
|
47
|
+
export const ASK = [
|
|
48
|
+
{ id: "low", name: "You approve every step", tag: "Low · cheapest", text: "One agent session does the work. You approve the plan and the result." },
|
|
49
|
+
{ id: "medium", name: "Balanced", tag: "Medium · recommended", text: "Separate agents plan, build and check. You approve the plan; problems the checker finds are fixed for you." },
|
|
50
|
+
{ id: "ultra", name: "Hands-off", tag: "Ultra · costs the most", text: "Runs start to finish without asking, fixes problems itself and saves the work in git." },
|
|
51
|
+
];
|
|
52
|
+
// The steps' order of the flow in the first card: who does each, for the picture's colours.
|
|
53
|
+
export const FLOW = [
|
|
54
|
+
{ name: "ask", you: true },
|
|
55
|
+
{ name: "plan", you: false },
|
|
56
|
+
{ name: "approve", you: true },
|
|
57
|
+
{ name: "build", you: false },
|
|
58
|
+
{ name: "review", you: false },
|
|
59
|
+
];
|
|
36
60
|
export const NOTIF_TEXT: Record<Notif, string> = {
|
|
37
61
|
na: "Notifications are not available at this address. Open kaizen at localhost or over HTTPS to turn them on.",
|
|
38
62
|
default: "Allow notifications so a run that needs you, or an agent that finishes, reaches you in another window.",
|
|
@@ -50,9 +74,10 @@ export function agentGroups(c: Cfg) {
|
|
|
50
74
|
all,
|
|
51
75
|
};
|
|
52
76
|
}
|
|
53
|
-
// The agent picked when the flow opens: the saved default, else the first one found.
|
|
77
|
+
// The agent picked when the flow opens: the saved default when it is installed, else the first one found, else none. A tool
|
|
78
|
+
// that is not installed is never ticked for someone; they may pick it to see how to install it.
|
|
54
79
|
export const defaultPick = (c: Cfg) =>
|
|
55
|
-
PICKABLE.includes(c.default)
|
|
80
|
+
PICKABLE.includes(c.default) && c.installed.includes(c.default)
|
|
56
81
|
? c.default
|
|
57
82
|
: (c.agents.find((a) => PICKABLE.includes(a.cmd) && c.installed.includes(a.cmd))?.cmd ?? "");
|
|
58
83
|
// The picked agent is not on PATH: how to install it (the panel under the cards), else nothing.
|
|
@@ -71,9 +96,11 @@ export function storedTheme(): "light" | "dark" | "system" {
|
|
|
71
96
|
}
|
|
72
97
|
}
|
|
73
98
|
export const offerText = (c: Pick<Cfg, "step" | "total">) =>
|
|
74
|
-
c.step
|
|
75
|
-
?
|
|
76
|
-
:
|
|
99
|
+
c.step >= c.total - 1
|
|
100
|
+
? "One step left: add your first project."
|
|
101
|
+
: c.step > 0
|
|
102
|
+
? `You are on step ${c.step + 1} of ${c.total}. It only takes a minute.`
|
|
103
|
+
: "You skipped setup. It only takes a minute.";
|
|
77
104
|
|
|
78
105
|
async function call(path: string, body?: object) {
|
|
79
106
|
try {
|
|
@@ -88,7 +115,8 @@ async function call(path: string, body?: object) {
|
|
|
88
115
|
return null;
|
|
89
116
|
}
|
|
90
117
|
}
|
|
91
|
-
|
|
118
|
+
// preset: the card ticked ("" when the board's settings are custom, so nothing is); picked: the user chose one, so it is saved.
|
|
119
|
+
export type Flow = { step: number; agent: string; theme: string; more: boolean; preset: string; picked: boolean };
|
|
92
120
|
export const useOnboarding = create<{ cfg: Cfg | null; flow: Flow | null; offer: boolean }>()(() => ({
|
|
93
121
|
cfg: null,
|
|
94
122
|
flow: null,
|
|
@@ -119,14 +147,25 @@ export function openFlow(at: number) {
|
|
|
119
147
|
agent: defaultPick(cfg),
|
|
120
148
|
theme: storedTheme(),
|
|
121
149
|
more: false,
|
|
150
|
+
preset: ASK.some((a) => a.id === cfg.preset) ? cfg.preset : "",
|
|
151
|
+
picked: false,
|
|
122
152
|
},
|
|
123
153
|
});
|
|
124
154
|
}
|
|
125
|
-
// The agent picked on
|
|
155
|
+
// The agent picked on its step is saved when the user leaves it, by Continue or by a progress bar.
|
|
126
156
|
const keepAgent = () => {
|
|
127
157
|
const f = get().flow;
|
|
128
|
-
return f && f.step ===
|
|
158
|
+
return f && f.step === STEP.agent && f.agent ? call("/settings", { key: "agent.default", value: f.agent }) : null;
|
|
159
|
+
};
|
|
160
|
+
// The preset is saved only when the user picked a card (and a different one than the board has): nothing changes silently, and
|
|
161
|
+
// custom settings are never replaced by a Continue.
|
|
162
|
+
const keepPreset = () => {
|
|
163
|
+
const { cfg, flow } = get();
|
|
164
|
+
if (!cfg || !flow || flow.step !== STEP.ask || !flow.picked || flow.preset === cfg.preset) return null;
|
|
165
|
+
set({ cfg: { ...cfg, preset: flow.preset } });
|
|
166
|
+
return call("/settings", { key: "preset", value: flow.preset });
|
|
129
167
|
};
|
|
168
|
+
export const pickPreset = (preset: string) => edit({ preset, picked: true });
|
|
130
169
|
export const pickAgent = (agent: string) => edit({ agent });
|
|
131
170
|
export const toggleMore = () => edit({ more: !get().flow?.more });
|
|
132
171
|
export function pickTheme(theme: string) {
|
|
@@ -136,12 +175,14 @@ export function pickTheme(theme: string) {
|
|
|
136
175
|
export async function next() {
|
|
137
176
|
const { cfg, flow } = get();
|
|
138
177
|
if (!cfg || !flow) return;
|
|
139
|
-
await keepAgent();
|
|
178
|
+
await Promise.all([keepAgent(), keepPreset()]);
|
|
140
179
|
if (flow.step < cfg.total - 1) {
|
|
141
180
|
edit({ step: flow.step + 1 });
|
|
142
181
|
return void save({ step: flow.step + 1 });
|
|
143
182
|
}
|
|
144
|
-
|
|
183
|
+
// Not "done": setup ends when a project exists (the board stops offering it then), so cancelling the add dialog leaves the Setup
|
|
184
|
+
// row and the Continue setup popup waiting.
|
|
185
|
+
void save({ step: flow.step });
|
|
145
186
|
close();
|
|
146
187
|
openAdd({ start: "folder" });
|
|
147
188
|
}
|
|
@@ -153,6 +194,7 @@ export function back() {
|
|
|
153
194
|
}
|
|
154
195
|
export function goto(step: number) {
|
|
155
196
|
void keepAgent();
|
|
197
|
+
void keepPreset();
|
|
156
198
|
edit({ step });
|
|
157
199
|
void save({ step });
|
|
158
200
|
}
|
|
@@ -180,6 +222,10 @@ export function answerOffer(r: "go" | "later" | "never") {
|
|
|
180
222
|
// late answer after that does nothing.
|
|
181
223
|
export function initOnboarding() {
|
|
182
224
|
let alive = true;
|
|
225
|
+
// A project was added: the board stops offering setup, so the Setup row goes now, not on the next reload.
|
|
226
|
+
const off = onProjectAdded(() =>
|
|
227
|
+
void call("/onboarding").then((c: Cfg | null) => c && alive && (set({ cfg: c }), setSetupRow(c))),
|
|
228
|
+
);
|
|
183
229
|
void (async () => {
|
|
184
230
|
const cfg: Cfg | null = await call("/onboarding");
|
|
185
231
|
if (!cfg || !alive) return;
|
|
@@ -195,5 +241,5 @@ export function initOnboarding() {
|
|
|
195
241
|
if (cfg.show) return openFlow(0);
|
|
196
242
|
if (cfg.resume) offer();
|
|
197
243
|
})();
|
|
198
|
-
return () => void (alive = false);
|
|
244
|
+
return () => (off(), void (alive = false));
|
|
199
245
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// toasts, and how the cursor, the selection and the open item move with them. Components call these; nothing here
|
|
3
3
|
// draws. Routes and payloads are the old page's, unchanged.
|
|
4
4
|
import { post, host, toast, toastUndo } from "@lib/core";
|
|
5
|
-
import { gatherLine, hostOf, iceKey, snoozedLine, stepPast, type IceItem, type Source, PLAT } from "./icebox.ts";
|
|
5
|
+
import { gatherLine, hostOf, iceKey, sameName, snoozedLine, stepPast, type IceItem, type Source, PLAT } from "./icebox.ts";
|
|
6
6
|
import { getIce, patchCap, setIce, type Ask, type Capture } from "./icebox-store.ts";
|
|
7
7
|
import { refreshIce } from "./use-icebox.ts";
|
|
8
8
|
|
|
@@ -369,14 +369,36 @@ export async function newCollection(to: string | null, where: string) {
|
|
|
369
369
|
// The capture picker's "New collection…": a client's one is made first, then it is the box's board.
|
|
370
370
|
export async function pickCaptureBoard(v: string, to: string | null) {
|
|
371
371
|
if (v === "\n") {
|
|
372
|
+
if (!to) return (toast("Pick a project first"), false);
|
|
372
373
|
const a = await askCollection();
|
|
373
374
|
if (!a) return false;
|
|
374
|
-
|
|
375
|
+
const j = await post("/icebox", { op: "boards", act: "add", dir: to, name: a.name, client: a.client });
|
|
376
|
+
if (!j.ok) return (toast(j.error || "Could not make the collection"), false);
|
|
377
|
+
toast(`Collection ${a.name} made`);
|
|
378
|
+
await refreshIce();
|
|
375
379
|
v = a.name;
|
|
376
380
|
}
|
|
377
381
|
patchCap({ board: v, boardDir: to });
|
|
378
382
|
return true;
|
|
379
383
|
}
|
|
384
|
+
// Remove a collection after asking; its items go back to the Inbox. A box or a filter on it falls back to the Inbox.
|
|
385
|
+
export async function removeCollection(dir: string, name: string, items: number) {
|
|
386
|
+
const ok = await askConfirm(
|
|
387
|
+
`Remove ${name}?`,
|
|
388
|
+
items ? `Its ${items} ${items === 1 ? "item goes" : "items go"} to the Inbox.` : "It has no items.",
|
|
389
|
+
"Remove",
|
|
390
|
+
true,
|
|
391
|
+
);
|
|
392
|
+
if (!ok) return;
|
|
393
|
+
const j = await post("/icebox", { op: "boards", act: "remove", dir, name });
|
|
394
|
+
if (!j.ok) return toast(j.error || "Could not remove the collection");
|
|
395
|
+
const s = getIce();
|
|
396
|
+
if (sameName(s.cap.board, name)) patchCap({ board: "", boardDir: null });
|
|
397
|
+
if (sameName(s.board, name)) setIce({ board: "" });
|
|
398
|
+
toast(`Collection ${name} removed`);
|
|
399
|
+
host.reload();
|
|
400
|
+
await refreshIce();
|
|
401
|
+
}
|
|
380
402
|
|
|
381
403
|
// ---- sources
|
|
382
404
|
// One change to a source, then what changed is shown.
|
|
@@ -46,6 +46,7 @@ export type IceState = {
|
|
|
46
46
|
view: "cards" | "sort";
|
|
47
47
|
board: string;
|
|
48
48
|
kinds: string[];
|
|
49
|
+
q: string; // the search box: every word must be in an item's words, link, tags or collection
|
|
49
50
|
cat: string;
|
|
50
51
|
src: string;
|
|
51
52
|
sel: string[]; // checked items, "<dir> <id>"
|
|
@@ -81,6 +82,7 @@ export const useIce = create<IceState>()(() => ({
|
|
|
81
82
|
view: saved("kz-ice-view") === "sort" ? "sort" : "cards",
|
|
82
83
|
board: "",
|
|
83
84
|
kinds: [],
|
|
85
|
+
q: "",
|
|
84
86
|
cat: "",
|
|
85
87
|
src: "",
|
|
86
88
|
sel: [],
|
|
@@ -106,7 +108,11 @@ export const useIce = create<IceState>()(() => ({
|
|
|
106
108
|
export const getIce = useIce.getState;
|
|
107
109
|
// Two elements the page reaches from outside their component, set as refs by the component that draws them: the swipe card the
|
|
108
110
|
// arrows and buttons fly away, and the Sources button the drawer gives focus back to.
|
|
109
|
-
export const iceEls: { swCard: HTMLElement | null; srcTog: HTMLElement | null
|
|
111
|
+
export const iceEls: { swCard: HTMLElement | null; srcTog: HTMLElement | null; search: HTMLInputElement | null } = {
|
|
112
|
+
swCard: null,
|
|
113
|
+
srcTog: null,
|
|
114
|
+
search: null, // the search box, which `/` focuses
|
|
115
|
+
};
|
|
110
116
|
export const setIce = useIce.setState;
|
|
111
117
|
export const patchCap = (p: Partial<Capture>) => setIce((s) => ({ cap: { ...s.cap, ...p } }));
|
|
112
118
|
export const patchDraft = (p: Partial<SourceDraft>) => setIce((s) => ({ draft: { ...s.draft, ...p } }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// How the Icebox page moves around: what a click on a row, a card, a chip or a bulk bar changes in the page's own
|
|
2
2
|
// state (open item, cursor, checked items, filters). No requests are made here (those are icebox-actions.ts).
|
|
3
3
|
import { clearShown } from "@lib/project";
|
|
4
|
-
import { iceKey, sameName, type Board, type IceItem } from "./icebox.ts";
|
|
4
|
+
import { iceKey, INBOX, sameName, type Board, type IceItem } from "./icebox.ts";
|
|
5
5
|
import { patchCap, setIce } from "./icebox-store.ts";
|
|
6
6
|
|
|
7
7
|
const focusTitle = (k: string) =>
|
|
@@ -36,6 +36,7 @@ export function openCard(it: IceItem) {
|
|
|
36
36
|
// A board chip filters, and the capture box follows it: its board and, in All projects, that board's project.
|
|
37
37
|
export function pickBoard(name: string, boards: Board[], single: boolean) {
|
|
38
38
|
setIce({ board: name });
|
|
39
|
+
if (name === INBOX) return patchCap({ board: "", boardDir: null });
|
|
39
40
|
const b = name && boards.find((x) => sameName(x.name, name));
|
|
40
41
|
if (b) patchCap({ board: b.name, boardDir: b.dir, ...(single ? {} : { dir: b.dir }) });
|
|
41
42
|
}
|
|
@@ -43,6 +44,6 @@ export const toggleKind = (kind: string) =>
|
|
|
43
44
|
setIce((s) => ({ kinds: s.kinds.includes(kind) ? s.kinds.filter((k) => k !== kind) : [...s.kinds, kind] }));
|
|
44
45
|
// "Clear filters": category, source, collection, kinds, and the board's "Showing" picker in All projects.
|
|
45
46
|
export function clearFilters(single: boolean) {
|
|
46
|
-
setIce({ cat: "", src: "", board: "", kinds: [] });
|
|
47
|
+
setIce({ cat: "", src: "", board: "", kinds: [], q: "" });
|
|
47
48
|
if (!single) clearShown();
|
|
48
49
|
}
|
package/web/lib/icebox/icebox.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type IceItem = {
|
|
|
17
17
|
board?: string;
|
|
18
18
|
tags?: string[];
|
|
19
19
|
images?: string[];
|
|
20
|
-
link?: { url: string; title?: string; summary?: string };
|
|
20
|
+
link?: { url: string; title?: string; summary?: string; image?: string };
|
|
21
21
|
post?: string | null;
|
|
22
22
|
replied?: string;
|
|
23
23
|
written?: string;
|
|
@@ -137,7 +137,22 @@ export function faviconUrl(u: string): string {
|
|
|
137
137
|
: origin + "/favicon.ico";
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
// A link's preview picture: the one read when it was saved, else Reddit's own for a post (links saved before pictures
|
|
141
|
+
// were read have none). Https only. Same address as redditPost() in cli/sources.ts.
|
|
142
|
+
export function linkImage(l: { url: string; image?: string }): string {
|
|
143
|
+
if (l.image && /^https:\/\//i.test(l.image)) return l.image;
|
|
144
|
+
const m = /^https:\/\/(?:(?:www|old|new|m)\.)?reddit\.com\/r\/[\w-]+\/comments\/([a-z0-9]+)/i.exec(l.url);
|
|
145
|
+
return m ? `https://share.redd.it/preview/post/${m[1]!.toLowerCase()}` : "";
|
|
146
|
+
}
|
|
147
|
+
// What the search box looks in: the words, notes, link, tags, collection and project, lowercased.
|
|
148
|
+
export const searchText = (it: IceItem) =>
|
|
149
|
+
[it.text, it.notes, it.link?.url, it.link?.title, it.link?.summary, ...(it.tags ?? []).map((t) => "#" + t), it.board, it.project]
|
|
150
|
+
.filter(Boolean)
|
|
151
|
+
.join("\n")
|
|
152
|
+
.toLowerCase();
|
|
153
|
+
// The Inbox chip's filter: items in no collection. A newline, so no collection name (one line) can equal it.
|
|
154
|
+
export const INBOX = "\ninbox";
|
|
155
|
+
export type Filters = { board: string; kinds: string[]; cat: string; src: string; q?: string };
|
|
141
156
|
export type Env = {
|
|
142
157
|
dir: string | null; // the one project the board shows, or null in All projects
|
|
143
158
|
shown: ReadonlySet<string>; // the "Showing" picker's projects; empty shows every one
|
|
@@ -157,6 +172,7 @@ export type Derived = {
|
|
|
157
172
|
src: string;
|
|
158
173
|
inProj: (it: IceItem) => boolean;
|
|
159
174
|
nOn: (b: Board) => number;
|
|
175
|
+
nInbox: number; // waiting items in no collection
|
|
160
176
|
};
|
|
161
177
|
const count = (xs: IceItem[], f: (it: IceItem) => string) => {
|
|
162
178
|
const m = new Map<string, { it: IceItem; n: number }>();
|
|
@@ -180,8 +196,8 @@ export function deriveIce(d: IceData, f: Filters, env: Env): Derived {
|
|
|
180
196
|
pv = ice.filter(inProj);
|
|
181
197
|
// A board is its name: two projects' boards of one name are one chip in All projects.
|
|
182
198
|
const boards = [...new Map((d.boards || []).filter(inProj).map((b) => [b.name.toLowerCase(), b])).values()];
|
|
183
|
-
const board = f.board && boards.some((b) => sameName(b.name, f.board)) ? f.board : "";
|
|
184
|
-
const onBoard = (it: IceItem) => !board || sameName(it.board, board),
|
|
199
|
+
const board = f.board === INBOX || (f.board && boards.some((b) => sameName(b.name, f.board))) ? f.board : "";
|
|
200
|
+
const onBoard = (it: IceItem) => !board || (board === INBOX ? !it.board : sameName(it.board, board)),
|
|
185
201
|
ofKind = (it: IceItem) => !f.kinds.length || f.kinds.includes(it.kind || ""),
|
|
186
202
|
base = pv.filter((it) => onBoard(it) && ofKind(it));
|
|
187
203
|
const byCat = count(base, (it) => catOf(list, it)),
|
|
@@ -189,10 +205,13 @@ export function deriveIce(d: IceData, f: Filters, env: Env): Derived {
|
|
|
189
205
|
const cv = base.filter((it) => !cat || catOf(list, it) === cat),
|
|
190
206
|
bySrc = count(cv, srcKey),
|
|
191
207
|
src = f.src && bySrc.has(f.src) ? f.src : "";
|
|
208
|
+
const words = (f.q ?? "").toLowerCase().split(/\s+/).filter(Boolean),
|
|
209
|
+
found = (it: IceItem) => !words.length || words.every((w) => searchText(it).includes(w));
|
|
192
210
|
const filtered = ice
|
|
193
211
|
.filter(
|
|
194
212
|
(it) =>
|
|
195
213
|
inProj(it) &&
|
|
214
|
+
found(it) &&
|
|
196
215
|
onBoard(it) &&
|
|
197
216
|
ofKind(it) &&
|
|
198
217
|
(cat ? catOf(list, it) === cat : it.status === "new") &&
|
|
@@ -213,6 +232,7 @@ export function deriveIce(d: IceData, f: Filters, env: Env): Derived {
|
|
|
213
232
|
src,
|
|
214
233
|
inProj,
|
|
215
234
|
nOn: (b) => pv.filter((it) => isWaiting(it) && sameName(it.board, b.name)).length,
|
|
235
|
+
nInbox: pv.filter((it) => isWaiting(it) && !it.board).length,
|
|
216
236
|
};
|
|
217
237
|
}
|
|
218
238
|
// Sources group by platform: two Threads searches sit under one Threads.
|
|
@@ -33,6 +33,11 @@ export function iceKeys(e: KeyboardEvent): boolean {
|
|
|
33
33
|
void f();
|
|
34
34
|
return true;
|
|
35
35
|
}
|
|
36
|
+
if (k === "/" && iceEls.search) {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
iceEls.search.focus();
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
36
41
|
if (k === "Escape") {
|
|
37
42
|
if (s.open) setIce(s.armed ? { armed: null } : { open: null });
|
|
38
43
|
else if (s.sel.length) setIce({ sel: [] });
|
|
@@ -12,6 +12,11 @@ let opened = 0;
|
|
|
12
12
|
export const openAdd = (o: AddOpts = {}) => useAddProject.setState({ open: { ...o, n: ++opened } });
|
|
13
13
|
export const closeAdd = () => useAddProject.setState({ open: null });
|
|
14
14
|
|
|
15
|
+
// Told when a project was added (an existing folder, a clone, a new one): first-run setup is finished by it, not by a click.
|
|
16
|
+
const added = new Set<() => void>();
|
|
17
|
+
export const onProjectAdded = (f: () => void) => (added.add(f), () => void added.delete(f));
|
|
18
|
+
const ADDS = ["/add-project", "/new-project", "/clone"];
|
|
19
|
+
|
|
15
20
|
export async function call(path: string, body?: object): Promise<{ ok: boolean; d: any }> {
|
|
16
21
|
try {
|
|
17
22
|
const r = await fetch(
|
|
@@ -21,6 +26,7 @@ export async function call(path: string, body?: object): Promise<{ ok: boolean;
|
|
|
21
26
|
: undefined,
|
|
22
27
|
);
|
|
23
28
|
const d = await r.json().catch(() => ({}));
|
|
29
|
+
if (r.ok && body && ADDS.includes(path)) added.forEach((f) => f());
|
|
24
30
|
return { ok: r.ok, d: r.ok ? d : { error: d.error || d.why || "that did not work" } };
|
|
25
31
|
} catch {
|
|
26
32
|
return { ok: false, d: { error: "kaizen is offline" } };
|
package/web/lib/rail/rules.ts
CHANGED
|
@@ -95,6 +95,7 @@ export type RailGroup = {
|
|
|
95
95
|
mainWs: string;
|
|
96
96
|
shut: boolean;
|
|
97
97
|
empty: boolean;
|
|
98
|
+
home: boolean; // Home: your own space outside any project (the global queue and the Home terminals)
|
|
98
99
|
rows: RailRow[];
|
|
99
100
|
};
|
|
100
101
|
export const pinKey = (dir: string, ws: string) => dir + "\0" + ws;
|
|
@@ -109,7 +110,8 @@ export function railGroups(
|
|
|
109
110
|
folded = new Set(o.folded),
|
|
110
111
|
tasks = d.tasks,
|
|
111
112
|
wsOf = (c) => wsOfCard(c, d.projects);
|
|
112
|
-
|
|
113
|
+
// Home (the global queue, `home`) heads the list; the rest keep the registry's order (stable sort).
|
|
114
|
+
const projects = d.projects.filter((p) => p.workspaces?.length).sort((a, b) => +!!b.home - +!!a.home);
|
|
113
115
|
// Cards by project and workspace: each lands on a row, the main checkout when its own is not listed.
|
|
114
116
|
const by = new Map<string, any[]>();
|
|
115
117
|
const shownAgents = (rs: ARow[]) => rs.filter((r) => (r.st === "done" ? filt.done : filt.running));
|
|
@@ -152,6 +154,7 @@ export function railGroups(
|
|
|
152
154
|
// A project with nothing to list stays as a collapsed header.
|
|
153
155
|
shut: folded.has(dir) || !rows.length,
|
|
154
156
|
empty: !rows.length,
|
|
157
|
+
home: !!p.home,
|
|
155
158
|
rows: rows.map(({ w, cs, ags }): RailRow => {
|
|
156
159
|
const st0 = cs.length ? st([...cs].sort((a, b) => RANK[st(a)] - RANK[st(b)])[0]) : "";
|
|
157
160
|
return {
|
|
@@ -139,7 +139,7 @@ export function deriveRun(i: RunIn): RunDraw {
|
|
|
139
139
|
doc:
|
|
140
140
|
k === "notes" || k === "git"
|
|
141
141
|
? null
|
|
142
|
-
: { k, id: c.id, text: doc || null, progress: k === "backlog" && c.column === 2 ? d.progress || null : null, needle: needle && !i.refresh ? needle : null, mark: 0 },
|
|
142
|
+
: { k, id: c.id, text: doc || null, progress: k === "backlog" && c.column === 2 ? d.progress || null : null, activity: k === "backlog" && c.column === 2 && Array.isArray(d.activity) ? d.activity : [], needle: needle && !i.refresh ? needle : null, mark: 0 },
|
|
143
143
|
notes: k === "notes" ? { card: c, src: doc, ro: !!c.archived || c.status === "done" || c.status === "abandoned", linked: d.linkedFrom } : null,
|
|
144
144
|
fix,
|
|
145
145
|
footer: { card: c, plan: d.plan, sourceControl: k !== "git" && i.git.pending },
|
|
@@ -21,6 +21,7 @@ export type PanelDoc = {
|
|
|
21
21
|
id: string;
|
|
22
22
|
text: string | null;
|
|
23
23
|
progress: string | null;
|
|
24
|
+
activity: { t: number; text: string }[]; // what the agent's hooks reported, oldest first (a building run's panel only)
|
|
24
25
|
needle: string | null;
|
|
25
26
|
mark: number;
|
|
26
27
|
};
|
|
@@ -100,6 +100,14 @@ export async function accountRemove(id: string, name: string) {
|
|
|
100
100
|
return accountSend({ op: "remove", id, deleteFolder });
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
// Re-check and Refresh: read the page again and say so, because when nothing changed the page looks the same.
|
|
104
|
+
export async function recheck(id: string, done: string) {
|
|
105
|
+
if (getSettings().busy === id) return;
|
|
106
|
+
setSettings({ busy: id });
|
|
107
|
+
await loadSettings();
|
|
108
|
+
setSettings({ busy: "" });
|
|
109
|
+
toast(done);
|
|
110
|
+
}
|
|
103
111
|
// ---- Skills (/skills, /rea)
|
|
104
112
|
const WARN: Record<string, string> = {
|
|
105
113
|
"kaizen-computer":
|
|
@@ -83,7 +83,7 @@ const PAGE_ALIAS: Record<string, string> = { voice: "keyboard", shortcuts: "keyb
|
|
|
83
83
|
export const pageId = (id: string) => PAGE_ALIAS[id] ?? id;
|
|
84
84
|
// Subsections that should come first on their page, whatever order their rows arrive in.
|
|
85
85
|
export const SUB_ORDER: Record<string, string[]> = {
|
|
86
|
-
general: ["Storage", "Folders", "App"],
|
|
86
|
+
general: ["Updates", "Storage", "Folders", "App"],
|
|
87
87
|
keyboard: ["Shortcuts", "Dictation"],
|
|
88
88
|
};
|
|
89
89
|
// First match wins: [key pattern, page, subsection].
|
|
@@ -104,6 +104,7 @@ const PLACES: [RegExp, string, string][] = [
|
|
|
104
104
|
[/^git\./, "git", "Git"],
|
|
105
105
|
[/^ui\./, "terminal", "Terminal"],
|
|
106
106
|
[/^board\.chat_hotkey$/, "keyboard", "Shortcuts"],
|
|
107
|
+
[/^board\.auto_update$/, "general", "Updates"],
|
|
107
108
|
[/^board\.(projects_dir|video_dir)$/, "general", "Folders"],
|
|
108
109
|
[/^board\./, "general", "App"],
|
|
109
110
|
[/^state\./, "general", "Storage"],
|
|
@@ -121,6 +122,8 @@ export type Row = {
|
|
|
121
122
|
help?: string;
|
|
122
123
|
group?: string;
|
|
123
124
|
values: string[];
|
|
125
|
+
// What an option is called on screen, by its stored value (cli/settings.ts); a value with no entry shows as it is.
|
|
126
|
+
labels?: Record<string, string>;
|
|
124
127
|
value: string;
|
|
125
128
|
own?: boolean;
|
|
126
129
|
idle?: string;
|
|
@@ -168,10 +171,9 @@ export function controlOf(r: Pick<Row, "key" | "values" | "text" | "folder">): C
|
|
|
168
171
|
return "segments";
|
|
169
172
|
return "stepper";
|
|
170
173
|
}
|
|
174
|
+
// An option as the page shows it.
|
|
175
|
+
export const optionText = (r: Pick<Row, "labels">, v: string) => r.labels?.[v] ?? v;
|
|
171
176
|
export const settingId = (key: string) => "s-" + key.replace(/\./g, "-");
|
|
172
|
-
// Names worth suggesting, per tool, from the tool's own docs; typing any other name stays allowed.
|
|
173
|
-
// ponytail: claude only, add another tool's names when its own CLI help lists them.
|
|
174
|
-
export const MODEL_SUGGEST: Record<string, string[]> = { claude: ["haiku", "sonnet", "opus"] };
|
|
175
177
|
export const modelTool = (key: string) => key.split(".").pop()!;
|
|
176
178
|
export const modelName = (label: string) => label.replace(/^(Worker|Handoff) model: /, "");
|
|
177
179
|
// A row's help line: its own help, then why it is idle.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
export type ModelChoice = { id: string; name: string };
|
|
4
|
+
|
|
5
|
+
// The models one agent tool offers, read by the board's server from the tool itself (`GET /models`). One request per
|
|
6
|
+
// tool per page: the rows of a tool share it. A failed read gives [] and the field stays a free text.
|
|
7
|
+
const asked = new Map<string, Promise<ModelChoice[]>>();
|
|
8
|
+
const ask = (tool: string) => {
|
|
9
|
+
let p = asked.get(tool);
|
|
10
|
+
if (!p) {
|
|
11
|
+
p = fetch("/models?agent=" + encodeURIComponent(tool))
|
|
12
|
+
.then((r) => (r.ok ? r.json() : { models: [] }))
|
|
13
|
+
.then((j) => (Array.isArray(j.models) ? (j.models as ModelChoice[]) : []))
|
|
14
|
+
.catch(() => []);
|
|
15
|
+
asked.set(tool, p);
|
|
16
|
+
}
|
|
17
|
+
return p;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function useModelChoices(tool: string, on: boolean): ModelChoice[] {
|
|
21
|
+
const [rows, setRows] = useState<ModelChoice[]>([]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!on) return;
|
|
24
|
+
let live = true;
|
|
25
|
+
void ask(tool).then((r) => live && setRows(r));
|
|
26
|
+
return () => {
|
|
27
|
+
live = false;
|
|
28
|
+
};
|
|
29
|
+
}, [tool, on]);
|
|
30
|
+
return rows;
|
|
31
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// What's New (cli/whats-new.ts): the installed version's highlights and fixes, shown as a card under Settings → General → About.
|
|
2
|
+
// It opens by itself the first time after an update (the Settings gear carries a dot until then), and the About bar's What's new
|
|
3
|
+
// button opens and closes it any time. Got it / Hide record it as seen on this machine, not just this browser.
|
|
4
|
+
import { create } from "zustand";
|
|
5
|
+
import { post } from "@lib/core";
|
|
6
|
+
|
|
7
|
+
export type WhatsNew = {
|
|
8
|
+
version: string;
|
|
9
|
+
entry: { version: string; highlights: { title: string; text: string }[]; fixes: string[] } | null;
|
|
10
|
+
unseen: boolean;
|
|
11
|
+
};
|
|
12
|
+
// open: null means "follow unseen", true / false is what the user chose.
|
|
13
|
+
export const useWhatsNew = create<{ data: WhatsNew | null; open: boolean | null }>()(() => ({
|
|
14
|
+
data: null,
|
|
15
|
+
open: null,
|
|
16
|
+
}));
|
|
17
|
+
export const loadWhatsNew = () =>
|
|
18
|
+
fetch("/whats-new")
|
|
19
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
20
|
+
.then((data: WhatsNew | null) => data && useWhatsNew.setState({ data }))
|
|
21
|
+
.catch(() => {});
|
|
22
|
+
// Whether the card is showing: what the user chose, else whether this machine has not seen it yet. Nothing without an entry.
|
|
23
|
+
export const cardOpen = (s: { data: WhatsNew | null; open: boolean | null }) =>
|
|
24
|
+
!!s.data?.entry && (s.open ?? s.data.unseen);
|
|
25
|
+
export const toggleWhatsNew = () => {
|
|
26
|
+
const s = useWhatsNew.getState();
|
|
27
|
+
if (cardOpen(s)) return void closeWhatsNew();
|
|
28
|
+
useWhatsNew.setState({ open: true });
|
|
29
|
+
};
|
|
30
|
+
export async function closeWhatsNew() {
|
|
31
|
+
useWhatsNew.setState({ open: false });
|
|
32
|
+
const s = useWhatsNew.getState();
|
|
33
|
+
if (!s.data?.unseen) return;
|
|
34
|
+
const r = await post("/whats-new", {});
|
|
35
|
+
if (r.ok) useWhatsNew.setState({ data: { ...s.data, unseen: false } });
|
|
36
|
+
}
|
package/web/pages/board/App.tsx
CHANGED
|
@@ -3,9 +3,8 @@ import { TooltipProvider } from "@web/ui";
|
|
|
3
3
|
import { useRouteClasses } from "@lib/router";
|
|
4
4
|
import { useBoard } from "@lib/board";
|
|
5
5
|
import { useRunView } from "@lib/run";
|
|
6
|
-
import { checkUpdate } from "@lib/settings";
|
|
6
|
+
import { checkUpdate, loadWhatsNew } from "@lib/settings";
|
|
7
7
|
import { SourceMarks } from "@components/rail";
|
|
8
|
-
import { HomeWsRow } from "@components/home";
|
|
9
8
|
import { Rail, Sprite } from "@components/shell";
|
|
10
9
|
import { FootBar } from "@components/footer";
|
|
11
10
|
import { ContextPanel } from "@components/context";
|
|
@@ -44,20 +43,14 @@ export function App() {
|
|
|
44
43
|
// Hourly so a tab left open still hears of a release; the server's cache limits npm to every 6 h.
|
|
45
44
|
useEffect(() => {
|
|
46
45
|
void checkUpdate();
|
|
46
|
+
void loadWhatsNew();
|
|
47
47
|
const t = setInterval(checkUpdate, 3600_000);
|
|
48
48
|
return () => clearInterval(t);
|
|
49
49
|
}, []);
|
|
50
50
|
return (
|
|
51
51
|
<TooltipProvider>
|
|
52
52
|
<Sprite />
|
|
53
|
-
<Rail
|
|
54
|
-
srcs={<SourceMarks />}
|
|
55
|
-
before={
|
|
56
|
-
<div style={{ display: "contents" }}>
|
|
57
|
-
<HomeWsRow />
|
|
58
|
-
</div>
|
|
59
|
-
}
|
|
60
|
-
/>
|
|
53
|
+
<Rail srcs={<SourceMarks />} />
|
|
61
54
|
<div className="app">
|
|
62
55
|
<Header />
|
|
63
56
|
<Pages />
|