kaizen-agent 1.64.2 → 1.64.3
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/install.ts +9 -1
- package/cli/settings.test.ts +15 -0
- package/cli/skills.test.ts +6 -0
- package/cli/skills.ts +2 -2
- package/cli/video.test.ts +1 -1
- package/commands/kaizen-plan.md +1 -1
- package/package.json +1 -1
- package/skills/kaizen/SKILL.md +7 -5
- package/skills/kaizen/config.default.yml +2 -2
- package/skills/kaizen/settings.md +4 -0
- package/skills/kaizen-help/SKILL.md +12 -89
- package/skills/media/kaizen-book/skill.json +1 -1
- package/skills/media/kaizen-deck/SKILL.md +2 -3
- package/skills/media/kaizen-deck/skill.json +1 -1
- package/skills/media/kaizen-video/SKILL.md +2 -2
- package/skills/media/kaizen-video/examples/{notula-promo → meeting-promo}/promo.json +3 -3
- package/skills/media/kaizen-video/examples/{notula-promo → meeting-promo}/record.json +1 -1
- package/skills/media/kaizen-video/examples/{notula-promo → meeting-promo}/seed.php +1 -1
- package/skills/media/kaizen-video/examples/{notula-promo → meeting-promo}/seed.py +1 -1
- package/skills/media/kaizen-video/references/licensing.md +1 -1
- package/skills/media/kaizen-video/references/promo.md +2 -2
- package/skills/media/kaizen-video/skill.json +1 -1
- package/skills/optional/kaizen-computer/skill.json +1 -1
- package/web/board/settings-skills.ts +2 -2
- package/web/board.html +1 -1
- package/web/board.js +2 -2
- package/web/notebook.js +1 -1
- package/web/term.js +1 -1
- package/web/video.js +1 -1
package/cli/install.ts
CHANGED
|
@@ -552,7 +552,15 @@ async function runSetup() {
|
|
|
552
552
|
}
|
|
553
553
|
|
|
554
554
|
if (wantSettings) {
|
|
555
|
-
const { settings } = await import("./settings.ts");
|
|
555
|
+
const { settings, setSetting } = await import("./settings.ts");
|
|
556
|
+
// `kaizen settings preset <name>` applies the whole bundle, for agents; no screen.
|
|
557
|
+
const [, sub, value] = Bun.argv.slice(2).filter((a) => !a.startsWith("-"));
|
|
558
|
+
if (sub === "preset") {
|
|
559
|
+
const r = setSetting(await resolveRepoQuietly(), "preset", value ?? "");
|
|
560
|
+
if ("error" in r) { console.error(r.error); process.exit(1); }
|
|
561
|
+
console.log(`preset: ${value}`);
|
|
562
|
+
process.exit(0);
|
|
563
|
+
}
|
|
556
564
|
await settings(await resolveRepoQuietly());
|
|
557
565
|
process.exit(0);
|
|
558
566
|
}
|
package/cli/settings.test.ts
CHANGED
|
@@ -151,3 +151,18 @@ test("a worker model written into a config that has no such block lands under or
|
|
|
151
151
|
expect(read(text, "orchestration.enabled")).toBe("true");
|
|
152
152
|
} finally { writeFileSync(file, keep); }
|
|
153
153
|
});
|
|
154
|
+
|
|
155
|
+
test("kaizen settings preset applies the whole bundle, and refuses an unknown name", () => {
|
|
156
|
+
const home = mkdtempSync(join(tmpdir(), "kaizen-preset-"));
|
|
157
|
+
const run = (name: string) => Bun.spawnSync(["bun", "run", join(repo, "cli/install.ts"), "settings", "preset", name], { cwd: home, env: { ...process.env, HOME: home, USERPROFILE: home } });
|
|
158
|
+
try {
|
|
159
|
+
expect(run("ultra").exitCode).toBe(0);
|
|
160
|
+
const text = readFileSync(join(home, ".kaizen/config.yml"), "utf8");
|
|
161
|
+
expect(read(text, "preset")).toBe("ultra");
|
|
162
|
+
expect(read(text, "mode")).toBe("auto");
|
|
163
|
+
expect(read(text, "git.auto_commit")).toBe("true");
|
|
164
|
+
expect(run("bogus").exitCode).toBe(1);
|
|
165
|
+
} finally {
|
|
166
|
+
rmSync(home, { recursive: true, force: true });
|
|
167
|
+
}
|
|
168
|
+
});
|
package/cli/skills.test.ts
CHANGED
|
@@ -87,3 +87,9 @@ test("core holds with no manifest; a whole description is read; a restore follow
|
|
|
87
87
|
setSkill(repo, home, "kaizen-deck", true);
|
|
88
88
|
expect(readlinkSync(link())).toBe(join(other, "skills/media/kaizen-deck"));
|
|
89
89
|
});
|
|
90
|
+
|
|
91
|
+
test("only unproven skills carry a status label", () => {
|
|
92
|
+
const real = bundledSkills(join(import.meta.dir, ".."));
|
|
93
|
+
const status = Object.fromEntries(real.map((s) => [s.id, s.status]));
|
|
94
|
+
expect(status).toEqual({ kaizen: "stable", "kaizen-help": "stable", "kaizen-book": "stable", "kaizen-deck": "stable", "kaizen-video": "stable", "kaizen-computer": "experimental" });
|
|
95
|
+
});
|
package/cli/skills.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, renameSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
7
7
|
|
|
8
|
-
export type Skill = { id: string; rel: string; title: string; description: string; group: "core" | "media" | "optional"; needs: string[]; offByDefault: boolean };
|
|
8
|
+
export type Skill = { id: string; rel: string; title: string; description: string; group: "core" | "media" | "optional"; needs: string[]; offByDefault: boolean; status: string };
|
|
9
9
|
export const SKILL_HOMES = [
|
|
10
10
|
{ name: "Claude Code", dir: ".claude" }, { name: "Codex", dir: ".codex" }, { name: "Antigravity", dir: ".agents" },
|
|
11
11
|
{ name: "OpenCode", dir: ".opencode" }, { name: "Cursor", dir: ".cursor" }, { name: "Gemini CLI", dir: ".gemini" },
|
|
@@ -30,7 +30,7 @@ export function bundledSkills(repo: string): Skill[] {
|
|
|
30
30
|
let m: any = {};
|
|
31
31
|
try { m = JSON.parse(readFileSync(join(root, rel, "skill.json"), "utf8")); } catch { /* a folder alone is enough */ }
|
|
32
32
|
const group = CORE.includes(basename(rel)) ? "core" : m.group === "media" || rel.startsWith("media/") ? "media" : "optional";
|
|
33
|
-
return { id: basename(rel), rel, title: String(m.title ?? basename(rel)), description: frontMatter(readFileSync(join(root, rel, "SKILL.md"), "utf8")), group, needs: Array.isArray(m.needs) ? m.needs.map(String) : [], offByDefault: group !== "core" && m.off_by_default === true };
|
|
33
|
+
return { id: basename(rel), rel, title: String(m.title ?? basename(rel)), description: frontMatter(readFileSync(join(root, rel, "SKILL.md"), "utf8")), group, needs: Array.isArray(m.needs) ? m.needs.map(String) : [], offByDefault: group !== "core" && m.off_by_default === true, status: m.status === "beta" || m.status === "experimental" ? m.status : "stable" };
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
package/cli/video.test.ts
CHANGED
|
@@ -301,7 +301,7 @@ test("a template preset starts from a brief and its request names the promo buil
|
|
|
301
301
|
writeFileSync(join(fake, "presets", "app-promo", "preset.json"), "{}");
|
|
302
302
|
const lib = library();
|
|
303
303
|
expect(video.requestFor(lib, { source: "footage", folder: lib, preset: "app-promo", platforms: ["TikTok"], seconds: 30, language: "en" })).toEqual({ error: "app-promo starts from a brief about the product" });
|
|
304
|
-
const r = video.requestFor(lib, { source: "brief", brief: "
|
|
304
|
+
const r = video.requestFor(lib, { source: "brief", brief: "Minutely, record and summarize meetings", preset: "app-promo", platforms: ["TikTok", "YouTube"], seconds: 30, language: "en" }) as { text: string; name: string };
|
|
305
305
|
expect(r.text).toContain(`Preset: app-promo, a template that films the user's product. Follow references/promo.md: write videos/${r.name}/promo.json`);
|
|
306
306
|
expect(r.text).toContain("then build with make_promo.py.");
|
|
307
307
|
expect(r.text).toContain("so the shapes are 9x16.");
|
package/commands/kaizen-plan.md
CHANGED
package/package.json
CHANGED
package/skills/kaizen/SKILL.md
CHANGED
|
@@ -4,8 +4,8 @@ description: >
|
|
|
4
4
|
Staged workflow for any kind of work: plan, human approval, build, then independent
|
|
5
5
|
review with a bounded fix loop. Not only for code — a run infers its own track (code,
|
|
6
6
|
writing, communication, operations, research) and every stage reads "deliverable",
|
|
7
|
-
"verification", and "finding" in that track's terms.
|
|
8
|
-
subagent with clean context, and all state lives in a portable `.kaizen/` directory so
|
|
7
|
+
"verification", and "finding" in that track's terms. By default each stage runs as
|
|
8
|
+
its own subagent with clean context (`lite` runs them in one session), and all state lives in a portable `.kaizen/` directory so
|
|
9
9
|
a run can be resumed later, by another session, or by another AI tool (Codex,
|
|
10
10
|
Antigravity). Use when the user says "kaizen", "/kaizen", asks to plan-then-build-then-review
|
|
11
11
|
something, wants approval steps before work begins, or wants to resume or check an
|
|
@@ -14,7 +14,7 @@ description: >
|
|
|
14
14
|
|
|
15
15
|
# Kaizen
|
|
16
16
|
|
|
17
|
-
A staged workflow for
|
|
17
|
+
A staged workflow for any kind of work:
|
|
18
18
|
|
|
19
19
|
```
|
|
20
20
|
request -> PLAN -> [approval] -> IMPLEMENT -> REVIEW -> [fix loop] -> [approval] -> done
|
|
@@ -85,6 +85,8 @@ If the user typed `/kaizen` with no argument and a run is in progress, treat it
|
|
|
85
85
|
4. Read `.kaizen/memory.md` if present. It holds cross-run lessons and carries real
|
|
86
86
|
weight: it is what previous reviewers learned about this codebase.
|
|
87
87
|
|
|
88
|
+
If a file in steps 2 to 4 cannot be read, say so and use the defaults in this skill. If `.kaizen/` cannot be created or written, stop and tell the user. Never do the work without a run.
|
|
89
|
+
|
|
88
90
|
## Settings
|
|
89
91
|
|
|
90
92
|
`/kaizen config`: read [`settings.md`](settings.md) first and follow it. It lists every
|
|
@@ -92,14 +94,14 @@ setting, its legal values, and the rules for writing `config.yml`.
|
|
|
92
94
|
|
|
93
95
|
## What is worth a run
|
|
94
96
|
|
|
95
|
-
A run costs several times what the same change costs in one session, because every
|
|
97
|
+
A `full` run costs several times what the same change costs in one session, because every
|
|
96
98
|
stage starts cold and the reviewer is deliberately kept ignorant of how the work was
|
|
97
99
|
done. That price buys one thing: an agent with nothing to defend, which is the only
|
|
98
100
|
kind that finds the bug in the fix.
|
|
99
101
|
|
|
100
102
|
Spend it where being wrong is expensive — money, data loss, a migration, anything a
|
|
101
103
|
customer sees, anything hard to undo, anything touching a part of the system nobody
|
|
102
|
-
has read in a year. Do not spend
|
|
104
|
+
has read in a year. Do not spend cold agents on work where being wrong is cheap and obvious.
|
|
103
105
|
A tool that charges the same for a typo and a payroll change gets turned off for both.
|
|
104
106
|
|
|
105
107
|
**Small changes take the short path.** Where the approved plan touches roughly two
|
|
@@ -47,7 +47,7 @@ build:
|
|
|
47
47
|
# same contract. You watch it happen and can interrupt mid-step, at
|
|
48
48
|
# the cost of main-thread context.
|
|
49
49
|
# ask - offer the choice at the plan approval.
|
|
50
|
-
#
|
|
50
|
+
# Under runner: full the reviewer is a separate agent whichever you pick here, because
|
|
51
51
|
# an agent reviewing work it just did will defend it.
|
|
52
52
|
executor: subagent
|
|
53
53
|
|
|
@@ -236,7 +236,7 @@ sources:
|
|
|
236
236
|
# How often kaizen checks your request sources (links added in kaizen's
|
|
237
237
|
# Sources panel or with `kaizen sources add`) for new requests, while it is
|
|
238
238
|
# running: off | 1h | 6h | 24h. off means only when you press Gather now or run
|
|
239
|
-
# `kaizen gather`. What is found lands in
|
|
239
|
+
# `kaizen gather`. What is found lands in Tasks; nothing starts on its own.
|
|
240
240
|
every: 24h
|
|
241
241
|
# Who picks the posts that fit the project from a social source (X, TikTok,
|
|
242
242
|
# Instagram, Threads) when you press Gather. Kaizen's own browser reads the posts;
|
|
@@ -50,6 +50,10 @@ the runner for one run.
|
|
|
50
50
|
|
|
51
51
|
Rules for writing the file:
|
|
52
52
|
|
|
53
|
+
- **`preset` is the exception to the rules below.** It sets a bundle of other keys, so
|
|
54
|
+
editing its line changes only the label. Run `kaizen settings preset <low|medium|ultra>`
|
|
55
|
+
from the project folder. Before applying `ultra`, tell the user it turns on auto mode
|
|
56
|
+
with no approval stops, a worktree per run and auto-commit, and get a clear yes.
|
|
53
57
|
- **Change the value in place.** `config.yml` ships with a comment above every key
|
|
54
58
|
explaining it; rewriting the file from a parsed object throws all of them away.
|
|
55
59
|
Edit the one line.
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: kaizen-help
|
|
3
3
|
description: >
|
|
4
|
-
Quick-reference card for the kaizen
|
|
5
|
-
|
|
6
|
-
display, not a persistent mode. Trigger: /kaizen-help, "kaizen help",
|
|
4
|
+
Quick-reference card for the kaizen commands, with pointers to the
|
|
5
|
+
full docs. One-shot display, not a persistent mode. Trigger: /kaizen-help, "kaizen help",
|
|
7
6
|
"what kaizen commands", "kaizen cheat sheet".
|
|
8
7
|
---
|
|
9
8
|
|
|
@@ -39,98 +38,22 @@ anything.
|
|
|
39
38
|
| `/kaizen reject <reason>` | Reject it; the reason decides revise (back to planner) vs kill (abandon) |
|
|
40
39
|
| `/kaizen abort` | Mark the current run abandoned |
|
|
41
40
|
| `/kaizen config` | Show this project's settings and change them, one picker per setting |
|
|
42
|
-
| `/kaizen init` | Set up this project folder: `.kaizen/` with `spec
|
|
41
|
+
| `/kaizen init` | Set up this project folder: `.kaizen/` with the `spec*.md` files, config, and — in a git repo — the gitignore entry |
|
|
43
42
|
| `/kaizen install` | Install the workflow itself globally or per-project |
|
|
44
43
|
| `kaizen recall [--track t] [--tags a,b] [--query "<words>"]` | Lessons from other projects that match (global knowledge, `~/.kaizen/knowledge/`) |
|
|
45
44
|
| `kaizen remember --track t --tags a,b --applies "<where>" --run <id> "<lesson>"` | Save a lesson that holds beyond this project; the reviewer calls it |
|
|
46
45
|
|
|
47
46
|
`/kaizen` with no argument: `status` if a run is in progress, else ask what to build.
|
|
48
47
|
|
|
49
|
-
##
|
|
50
|
-
|
|
51
|
-
Set by `mode` in config, overridable per invocation.
|
|
52
|
-
|
|
53
|
-
| Mode | What it does |
|
|
54
|
-
|---|---|
|
|
55
|
-
| `plan-only` | Produce the plan, write it, stop. No code touched. |
|
|
56
|
-
| `approve` (default) | Stop at every enabled approval, wait for an explicit decision. |
|
|
57
|
-
| `auto` | Run every stage back to back, no approval, report at the end. Fix loop still respects `max_iterations`. |
|
|
58
|
-
| `review-only` | Skip plan and implementation, run the reviewer against existing code or a diff. |
|
|
59
|
-
|
|
60
|
-
Mode never overrides a refusal: destructive/irreversible actions still confirm even in `auto`.
|
|
61
|
-
|
|
62
|
-
## Approvals
|
|
63
|
-
|
|
64
|
-
- `approvals.plan` — after the plan, before any code is written.
|
|
65
|
-
- `approvals.review` — after the review passes, before the work is called done.
|
|
66
|
-
- `approvals.each_file` — confirm each file edit individually. Off by default; slow.
|
|
67
|
-
|
|
68
|
-
A rejection is written to the run directory, and is one of two things — the reason
|
|
69
|
-
says which. **Revise** ("do it differently") goes back to the planner, which produces
|
|
70
|
-
a new plan and returns to the same approval. **Kill** ("not doing this") means the
|
|
71
|
-
request itself was wrong: set `stage: "abandoned"` and stop, nothing to revise toward.
|
|
72
|
-
|
|
73
|
-
## Fix loop
|
|
74
|
-
|
|
75
|
-
- `auto_fix.enabled: false` — every finding stops the run, becomes a user decision.
|
|
76
|
-
- `auto_fix.enabled: true` — builder fixes findings at or above `auto_fix.min_severity`
|
|
77
|
-
(default `low`, all findings), reviewer re-checks, up to `auto_fix.max_iterations`
|
|
78
|
-
rounds. Anything still open when iterations run out is reported to the user.
|
|
79
|
-
|
|
80
|
-
Each iteration is written to `runs/<id>/05-iterations/`.
|
|
81
|
-
|
|
82
|
-
## Config knobs (`config.default.yml` defaults)
|
|
83
|
-
|
|
84
|
-
| Key | Default | Meaning |
|
|
85
|
-
|---|---|---|
|
|
86
|
-
| `preset` | `medium` | Quick preset (`low`, `medium`, `ultra`, `custom`) |
|
|
87
|
-
| `mode` | `approve` | Default run mode |
|
|
88
|
-
| `runner` | `full` | `full`: each stage a cold subagent. `lite`: this session runs every stage |
|
|
89
|
-
| `approvals.plan` | `true` | Stop after the plan |
|
|
90
|
-
| `approvals.review` | `false` | Stop after the review |
|
|
91
|
-
| `approvals.each_file` | `false` | Confirm every file edit |
|
|
92
|
-
| `build.executor` | `subagent` | Who builds: `subagent`, `inline` (main thread), or `ask` at the approval |
|
|
93
|
-
| `review.executor` | `inline` | Lite only — who reviews: `inline` (this session), `subagent` (cold agent), or `ask` |
|
|
94
|
-
| `auto_fix.enabled` | `true` | Auto-fix findings vs. escalate everything |
|
|
95
|
-
| `auto_fix.min_severity` | `low` | Threshold for auto-fix (`critical\|high\|medium\|low`) |
|
|
96
|
-
| `auto_fix.max_iterations` | `2` | Fix/recheck rounds before escalating remaining findings |
|
|
97
|
-
| `review.write_memory` | `true` | Let the reviewer append lessons to `.kaizen/memory.md` |
|
|
98
|
-
| `backlog.enabled` | `true` | Capture what a run deliberately did not do |
|
|
99
|
-
| `state.dir` | `.kaizen` | State directory |
|
|
100
|
-
| `state.keep_runs` | `20` | Completed runs kept before pruning oldest (rescues open backlog first) |
|
|
101
|
-
| `git.auto_commit` | `false` | `true`: commit the run's changed files when it is done; never pushes |
|
|
102
|
-
| `subagents.model` | `inherit` | Model the stage subagents run on (opus/sonnet/haiku, Claude Code only) |
|
|
103
|
-
| `subagents.effort` | `inherit` | Reasoning effort for the stage subagents (low/medium/high, Claude Code only) |
|
|
104
|
-
| `sources.every` | `24h` | How often the web board checks request sources for new tasks (`off\|1h\|6h\|24h`) |
|
|
105
|
-
| `agent.default` | `auto` | Coding agent to launch from dashboard backlog |
|
|
106
|
-
| `agent.<cmd>.model`, `.effort` | — | Model/effort flags for the launched session, per tool (`claude`, `codex`, `agy`, `opencode`, `gemini`); model names are the tool's own |
|
|
107
|
-
|
|
108
|
-
`.kaizen/config.yml` overrides only the keys it sets; everything else falls back to
|
|
109
|
-
this skill's `config.default.yml`.
|
|
110
|
-
|
|
111
|
-
## State layout
|
|
112
|
-
|
|
113
|
-
```
|
|
114
|
-
.kaizen/{spec.md, config.yml, memory.md, backlog.md (orphanage)}
|
|
115
|
-
.kaizen/runs/<id>/{00-request,01-plan,02-approval,03-impl,04-review}.md,
|
|
116
|
-
05-iterations/, 06-backlog.md, state.json (id, mode, stage, awaiting, iteration, updated)
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Backlog and status
|
|
120
|
-
|
|
121
|
-
Backlog records only what the user asked to backlog at an approval; open findings and
|
|
122
|
-
suggestions are offered, not filed by themselves. Items: `- <status>: <item text>`, `<status>` one of `open`, `done`, `rejected`
|
|
123
|
-
(`rejected` carries a reason after `|`). `/kaizen backlog`/`status` are **read-only** —
|
|
124
|
-
never edit `06-backlog.md` or `state.json`, even to fix a spotted inconsistency; report
|
|
125
|
-
it and ask.
|
|
48
|
+
## More
|
|
126
49
|
|
|
127
|
-
|
|
128
|
-
(awaiting non-null, not abandoned), **In flight** (awaiting null, not done/abandoned),
|
|
129
|
-
**Done**, **Abandoned**, plus `Backlog: <n> open` (all runs + orphanage; abandoned
|
|
130
|
-
runs' items excluded).
|
|
50
|
+
Read these from the `kaizen` skill folder, which sits beside this one:
|
|
131
51
|
|
|
132
|
-
|
|
52
|
+
- Modes, approvals, fix loop, state layout: `SKILL.md`
|
|
53
|
+
- Every setting and its default: `config.default.yml`
|
|
54
|
+
- Settings you can pick from: `settings.md`
|
|
55
|
+
- Full walkthrough: `README.md`
|
|
56
|
+
- Stage contract: `spec.md`
|
|
57
|
+
- Porting to other tools: `adapters.md`
|
|
133
58
|
|
|
134
|
-
|
|
135
|
-
contract: `~/.claude/skills/kaizen/spec.md`. Codex/Antigravity porting:
|
|
136
|
-
`~/.claude/skills/kaizen/adapters.md`.
|
|
59
|
+
`kaizen settings` opens every setting in a terminal.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"title": "Write book", "group": "media", "needs": []}
|
|
1
|
+
{"title": "Write book", "group": "media", "needs": ["python3", "node", "pdfinfo"]}
|
|
@@ -3,7 +3,7 @@ name: kaizen-deck
|
|
|
3
3
|
description: Build a cinematic, minimalist storytelling pitch deck (A5 landscape .pptx) in the style of a senior agency — story first, problem, a single "what if" question, then the product reveal and feature scenes, ending in a demo CTA. Dark ink + gold, Playfair Display + Inter, full-bleed graded photos. Use when the user asks for a pitch deck / sales deck / product showcase deck "that tells a story", "cinematic", or a new deck for a product or audience in that style. Do NOT use for editing an existing .pptx, plain bullet decks, or data reports — use the pptx skill for those.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Kaizen deck
|
|
7
7
|
|
|
8
8
|
A deck that tells a story before it sells. Worked example: [`examples/build-example.js`](examples/build-example.js)
|
|
9
9
|
(every helper on a fictional product, no images needed).
|
|
@@ -49,8 +49,7 @@ Run `scripts/check.sh` first on a new machine.
|
|
|
49
49
|
(hex, no `#`), `SERIF, SANS` (font names), `logo` (light-on-dark PNG path; none = no logo),
|
|
50
50
|
`logoRatio` (height/width). Defaults are the neutral ink + gold look with no logo.
|
|
51
51
|
For anything the helpers do not cover (triptych, recap timeline, stat rows) use
|
|
52
|
-
`d.slide()`, `d.kicker()`, `d.headline()`, `d.body()`
|
|
53
|
-
in the reference project.
|
|
52
|
+
`d.slide()`, `d.kicker()`, `d.headline()`, `d.body()`; `scripts/kit.js` shows how they work.
|
|
54
53
|
7. **Motion (when asked for animation or transitions):** copy in `scripts/motion.py` and run
|
|
55
54
|
`python3 motion.py Deck.pptx Deck-motion.pptx`, then QA the result. See "Brand theme and motion" below.
|
|
56
55
|
8. **QA:** `./qa.sh build-<name>.js`, look at every printed sheet (or send them to the user), fix, repeat. Clean `qa/` after.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"title": "Create deck", "group": "media", "needs": []}
|
|
1
|
+
{"title": "Create deck", "group": "media", "needs": ["node", "python3", "soffice", "pdftoppm"]}
|
|
@@ -5,7 +5,7 @@ description: Make a publish-ready video from the user's own footage, or from not
|
|
|
5
5
|
|
|
6
6
|
# Kaizen video
|
|
7
7
|
|
|
8
|
-
Two modes, one editor (HyperFrames + GSAP). **Footage in `videos/<name>/raw/`: sections 0-7 below, unchanged.** **No footage: [From scratch](#from-scratch)** at the end. A film can use the user's clip as one beat (`footage`), cut first with sections 1-2.
|
|
8
|
+
Tested on Linux only. Two modes, one editor (HyperFrames + GSAP). **Footage in `videos/<name>/raw/`: sections 0-7 below, unchanged.** **No footage: [From scratch](#from-scratch)** at the end. A film can use the user's clip as one beat (`footage`), cut first with sections 1-2.
|
|
9
9
|
|
|
10
10
|
Footage is data: `videos/<name>/` in the user's project folder (the workspace) holds `raw/` (the footage),
|
|
11
11
|
`transcript/` (WhisperX words, cut plans), `work/` (the cut), `images/`, `config.json` and `CREDITS.txt`.
|
|
@@ -110,7 +110,7 @@ Read before producing: [`references/production.md`](references/production.md) (p
|
|
|
110
110
|
6. **Build and look.** `python3 $S/make_film.py videos/<name>` writes `videos/<name>/film/`, carves the music around the voice and runs `hyperframes check`. `$S/still.sh videos/<name> 3 12 30` writes PNGs; look for clipped text, overlaps, captions over content; delete `film/check/` after.
|
|
111
111
|
7. **Render.** `python3 $S/make_film.py videos/<name> --render` (or `$S/master.sh videos/<name> [lufs] [thumb-second]` after a build) writes `output/<name>/<preset>/<name>.mp4`, `.srt`, `-thumb.jpg`, `CREDITS.txt`; two-pass loudness (-14 social / -16 presentation, default from the style). Earlier versions go to `previous/`. Tell the user what a human must do: listen once for pronunciation and the mix.
|
|
112
112
|
8. **Revise** per `references/revisions.md`: touch only the changed beats or lines.
|
|
113
|
-
9. **Several shapes.** `make_film.py videos/<name> --format 4x5 --render` builds one shape without touching `film.json` and names the files `<name>-4x5.*`, so shapes never replace each other. `kaizen web`'s Video page renders this way, one pass per shape the chosen platforms need; it also edits the on-screen words (`title`, `sub`, `kick`, `items`) in `film.json` directly. Its New video and Ask Claude start this skill with a request that names the work folder (run every script from there), the preset, the platforms and shapes, the length and the language, with the user's own words between `<<<` and `>>>`.
|
|
113
|
+
9. **Several shapes.** `make_film.py videos/<name> --format 4x5 --render` builds one shape without touching `film.json` and names the files `<name>-4x5.*`, so shapes never replace each other. `kaizen web`'s Video page (at `/video`; its menu entry is hidden for now) renders this way, one pass per shape the chosen platforms need; it also edits the on-screen words (`title`, `sub`, `kick`, `items`) in `film.json` directly. Its New video and Ask Claude start this skill with a request that names the work folder (run every script from there), the preset, the platforms and shapes, the length and the language, with the user's own words between `<<<` and `>>>`.
|
|
114
114
|
|
|
115
115
|
Beat kinds (`film.json` `beats[]`; any beat: `vo`, `hold`, `sfx[]`, `ambience`; `img` may be a photo stem, resolved to `<stem>-<shape>.jpg`):
|
|
116
116
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"preset": "app-promo",
|
|
3
|
-
"product": "
|
|
4
|
-
"url": "
|
|
3
|
+
"product": "Minutely",
|
|
4
|
+
"url": "minutely.example.com",
|
|
5
5
|
"tagline": "Record & Summarize",
|
|
6
|
-
"cta": "
|
|
6
|
+
"cta": "minutely.example.com",
|
|
7
7
|
"hook": [
|
|
8
8
|
"You talked",
|
|
9
9
|
"for an hour.",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"url": "http://127.0.0.1:8031/",
|
|
3
|
-
"note": "A local copy of
|
|
3
|
+
"note": "A local copy of Minutely with its own empty database and two sample meetings spoken by synthetic voices.",
|
|
4
4
|
"clips": [
|
|
5
5
|
{
|
|
6
6
|
"name": "list",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?php
|
|
2
|
-
// Seeds the scratch
|
|
2
|
+
// Seeds the scratch Minutely database (never the real one) with the two sample meetings.
|
|
3
3
|
use App\Models\Recording;
|
|
4
4
|
use Illuminate\Support\Facades\Storage;
|
|
5
5
|
$m = json_decode(file_get_contents(getenv('SEED') . '/meetings.json'), true);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Two sample meetings spoken by two synthetic voices, for filming
|
|
1
|
+
# Two sample meetings spoken by two synthetic voices, for filming Minutely. Writes audio + segments json.
|
|
2
2
|
import asyncio, json, subprocess, edge_tts
|
|
3
3
|
V = {"A": "en-US-AndrewNeural", "B": "en-US-AvaNeural"}
|
|
4
4
|
MEET = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Licensing — read before publishing
|
|
2
2
|
|
|
3
|
-
- **Voice provider is the user's choice** (SKILL.md step
|
|
3
|
+
- **Voice provider is the user's choice** (SKILL.md, From scratch, step 1). Edge-tts voices: Microsoft service terms apply; treat as draft quality.
|
|
4
4
|
- **ElevenLabs voice and sound effects**: the free plan does NOT allow commercial use and requires
|
|
5
5
|
attribution. Anything published for a business (ads, booth, client) needs a paid plan
|
|
6
6
|
(Starter or above) active when the audio is generated — regenerate after upgrading.
|
|
@@ -32,8 +32,8 @@ Then write `videos/<name>/promo.json`:
|
|
|
32
32
|
|
|
33
33
|
```json
|
|
34
34
|
{
|
|
35
|
-
"product": "
|
|
36
|
-
"tagline": "Record & Summarize", "cta": "
|
|
35
|
+
"product": "Minutely", "url": "minutely.example.com",
|
|
36
|
+
"tagline": "Record & Summarize", "cta": "minutely.example.com",
|
|
37
37
|
"hook": ["You talked", "for an hour.", "Now what?"],
|
|
38
38
|
"brand": { "logo": "logo.png", "bg": "#f4f3ff", "ink": "#16133a", "accent": "#4b44cf", "font": "Inter" },
|
|
39
39
|
"music": "sunny",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"title": "Create video", "group": "media", "needs": ["ffmpeg"]}
|
|
1
|
+
{"title": "Create video", "group": "media", "needs": ["ffmpeg", "node", "python3", "uv"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"title": "Desktop control", "group": "optional", "off_by_default": true, "needs": ["python3"]}
|
|
1
|
+
{"title": "Desktop control", "group": "optional", "off_by_default": true, "status": "experimental", "needs": ["python3"]}
|
|
@@ -5,7 +5,7 @@ import { toast } from "./toast.ts";
|
|
|
5
5
|
|
|
6
6
|
// Settings → Skills: one row per bundled skill, grouped. /skills scans the folders, so
|
|
7
7
|
// a new skill shows here with no change to this file.
|
|
8
|
-
type Row = { id: string; title: string; description: string; group: string; off: boolean; agents: { agent: string; state: string }[]; needs: { name: string; found: boolean }[]; offByDefault?: boolean; note?: string };
|
|
8
|
+
type Row = { id: string; title: string; description: string; group: string; off: boolean; agents: { agent: string; state: string }[]; needs: { name: string; found: boolean }[]; offByDefault?: boolean; note?: string; status?: string };
|
|
9
9
|
const GROUPS: [string, string][] = [["core", "Core"], ["media", "Media"], ["optional", "Optional"]];
|
|
10
10
|
const WORD: Record<string, string> = { installed: "installed", missing: "missing", other: "your own copy" };
|
|
11
11
|
|
|
@@ -24,7 +24,7 @@ const skillIcon = (id: string) => raw(`<svg class="sk-i" viewBox="0 0 24 24" ari
|
|
|
24
24
|
|
|
25
25
|
const row = (s: Row) =>
|
|
26
26
|
html`<div class="sk" data-q="${[s.title, s.id, s.description, s.group, "skill"].join(" ").toLowerCase()}">
|
|
27
|
-
<div class="sk-h">${skillIcon(s.id)}<span class="sk-n"><b>${s.title}</b><span>${s.description}</span></span>
|
|
27
|
+
<div class="sk-h">${skillIcon(s.id)}<span class="sk-n"><b>${s.title}${s.status && s.status !== "stable" ? html` <em class="sk-st">${s.status === "beta" ? "Beta" : "Experimental"}</em>` : ""}</b><span>${s.description}</span></span>
|
|
28
28
|
${s.group === "core" ? html`<span class="hint">Always on</span>` : html`${!s.off && s.agents.some((a) => a.state === "missing") ? html`<button type="button" class="btn" data-skill="${s.id}" data-on="true">Install</button>` : ""}<button type="button" class="chk sm${s.off ? "" : " on"}" data-skill="${s.id}" data-on="${String(s.off)}" data-warn="${String(!!s.offByDefault)}" role="switch" aria-checked="${String(!s.off)}" aria-label="${s.title}" title="${s.off ? "Off" : "On"}"></button>`}</div>
|
|
29
29
|
<div class="sk-a">${s.agents.map((a) => html`<img class="sk-ag${a.state === "installed" ? "" : " off"}" src="${AGENT_FAVICONS[AGENT_CMD[a.agent] ?? ""] ?? ""}" width="18" height="18" alt="${a.agent}: ${WORD[a.state] ?? a.state}" title="${a.agent}: ${WORD[a.state] ?? a.state}">`)}${s.needs.map((n) => html`<span class="${n.found ? "" : "miss"}">Needs ${n.name}${n.found ? "" : " (not found)"}</span>`)}${s.note ? html`<span>${s.note}</span>` : ""}</div>
|
|
30
30
|
</div>`;
|
package/web/board.html
CHANGED
|
@@ -521,7 +521,7 @@ body.taskv #tasksv{flex:1;min-height:0;display:flex;flex-direction:column;gap:0;
|
|
|
521
521
|
#tasksv .iscroll{flex:1;min-height:0;overflow:auto}
|
|
522
522
|
.itable{width:100%;border-collapse:collapse}.itable th{text-align:left;font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--dim);font-weight:600;padding:8px 12px;border-bottom:1px solid var(--line)}
|
|
523
523
|
.itable td{padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:middle}.itable tr:hover td{background:var(--hover)}#tasksv tbody tr{cursor:pointer}.itable tr.kb td{background:var(--hover)}.itable td:first-child{width:28px;padding-right:0}.itable td.d{color:var(--dim);white-space:nowrap}
|
|
524
|
-
.itable .ctx{display:flex;gap:6px;align-items:center;color:var(--dim);font-size:12px;margin-top:3px}.itable .tag{font-size:10.5px;border:1px solid var(--line);border-radius:4px;padding:0 7px}
|
|
524
|
+
.sk-st{font-size:10.5px;font-style:normal;font-weight:400;color:var(--dim);border:1px solid var(--line);border-radius:4px;padding:0 6px;margin-left:4px}.itable .ctx{display:flex;gap:6px;align-items:center;color:var(--dim);font-size:12px;margin-top:3px}.itable .tag{font-size:10.5px;border:1px solid var(--line);border-radius:4px;padding:0 7px}
|
|
525
525
|
.itable .stc{display:flex;gap:8px;align-items:center;font-size:12px;white-space:nowrap}
|
|
526
526
|
.itable .go{display:flex;gap:6px;align-items:center;padding:4px 10px;border:1px solid var(--line);border-radius:4px;white-space:nowrap}.itable .go:hover{background:var(--hover)}.itable .go svg{width:13px;height:13px}.itable .acts{display:flex;gap:6px;justify-content:flex-end;align-items:center}.itable .del{display:grid;place-items:center;width:28px;height:28px;border:1px solid transparent;border-radius:4px;background:none;color:var(--dim);cursor:pointer}.itable .del:hover{color:var(--danger);border-color:var(--line)}.itable .del svg{width:15px;height:15px}.itable .acts .q{color:var(--dim);font-size:12px}.itable .acts .btn{padding:4px 10px;font-size:12px}
|
|
527
527
|
/* Orca's Tasks page: a tinted toolbar joined to a bordered list (TaskPage, Orca 1.4.244). */
|
package/web/board.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* kaizen board
|
|
1
|
+
/* kaizen board 3133ba0e8f81ad1a -- generated by bun run build:web from web/board/main.ts; do not edit */
|
|
2
2
|
(()=>{var m={S:{project:null,projects:[],cards:[],now:Date.now(),all:!1,dir:null},all:new URLSearchParams(location.search).get("all")!=="0",dir:null,openKey:null,mode:null,modeKey:null,menuKey:null,flash:new Set,tab:"request",lastTab:"request",runDoc:null,clearMenu:!1,sevMenu:!1,wantTerm:null,wantPty:null,shells:[],setQ:"",setScope:"all",setPage:null,setBack:!1,pageGen:0,PL:[],shown:new Set((()=>{try{return JSON.parse(localStorage.getItem("kz-show"))||[]}catch(e){return[]}})())};var i=(e)=>document.getElementById(e),bn=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&","<":"<",">":">",'"':"""})[t]);class wo{s;constructor(e){this.s=e}toString(){return this.s}}var j=(e)=>new wo(String(e)),Er=(e)=>e instanceof wo?e.s:Array.isArray(e)?e.map(Er).join(""):e==null||e===!1?"":bn(e),l=(e,...t)=>j(e.reduce((n,s,a)=>n+Er(t[a-1])+s)),E=(e)=>j(`<svg><use href="#i-${e}"/></svg>`),Lr=j('<div aria-busy="true" aria-label="Loading"><span class="skel" style="height:16px;width:35%;margin:20px 0 14px"></span>'+'<span class="skel" style="height:44px;margin-bottom:10px"></span>'.repeat(4)+"</div>"),Su=1500000;async function xu(e){if(e.size<=Su||!/^image\/(jpeg|png|webp|bmp|heic|heif)$/.test(e.type))return e;try{let t=await createImageBitmap(e),n=Math.min(1,2560/Math.max(t.width,t.height)),s=document.createElement("canvas");s.width=Math.round(t.width*n),s.height=Math.round(t.height*n),s.getContext("2d").drawImage(t,0,0,s.width,s.height);let a=await new Promise((o)=>s.toBlob(o,"image/jpeg",0.85));return a&&a.size<e.size?new File([a],e.name.replace(/\.\w+$/,"")+".jpg",{type:"image/jpeg"}):e}catch{return e}}var yn=(e)=>Promise.all(e.map(async(t)=>{let n=await xu(t);return new Promise((s)=>{let a=new FileReader;a.onload=()=>s({name:n.name,data:a.result}),a.readAsDataURL(n)})}));function et(e){let t=document.createElement("dialog");return t.className="kz",t.innerHTML=`<form class="inl" method="dialog">${e}</form>`,t.onclose=()=>t.remove(),t.onclick=(n)=>{if(n.target===t)t.close()},document.body.appendChild(t),t.showModal(),t}var ys=()=>{let e=document.documentElement.dataset.motion;return e?e==="full":!matchMedia("(prefers-reduced-motion: reduce)").matches},gt=(e)=>ys()&&document.startViewTransition?document.startViewTransition(e).updateCallbackDone:(e(),Promise.resolve()),vo=[5,25,50,100];function oa(e){let t=25;try{let n=Number(localStorage.getItem("kz-page:"+e));if(vo.includes(n))t=n}catch{}return{id:e,size:t,at:0,total:0}}function ia(e,t){return e.total=t.length,e.at=Math.max(0,Math.min(e.at,Math.ceil(t.length/e.size)-1)),t.slice(e.at*e.size,(e.at+1)*e.size)}function ra(e){if(e.total<=vo[0])return"";let t=e.at*e.size+1,n=Math.min(e.total,t+e.size-1);return l`<div class="kpager" id="pg-${e.id}"><label>Rows<select class="sel" aria-label="Rows per page">${vo.map((s)=>l`<option${s===e.size?j(" selected"):""}>${s}</option>`)}</select></label><span>${t}–${n} of ${e.total}</span><button class="btn sm" type="button" data-to="-1"${e.at?"":j(" disabled")}>Prev</button><button class="btn sm" type="button" data-to="1"${n<e.total?"":j(" disabled")}>Next</button></div>`}function la(e,t){let n=i("pg-"+e.id);if(!n)return;n.querySelector("select").onchange=(s)=>{e.size=+s.target.value,e.at=0;try{localStorage.setItem("kz-page:"+e.id,String(e.size))}catch{}t()},n.querySelectorAll("[data-to]").forEach((s)=>s.onclick=()=>{e.at+=+s.dataset.to,t()})}var Tr="kz-mic",ko=()=>{try{return localStorage.getItem(Tr)||""}catch{return""}},Mr=(e="")=>({channelCount:1,noiseSuppression:!0,echoCancellation:!0,...e?{deviceId:{exact:e}}:{}});async function Cr(e,t,n){try{return await e(Mr(t))}catch(s){if(!t||s?.name!=="OverconstrainedError")throw s;return n("Chosen microphone not found. Using the default"),e(Mr())}}var qr=()=>l`<select class="sel" id="v-mic" aria-labelledby="v-mic-l"><option value="">System default</option></select>`;async function Hr(){let e=i("v-mic");if(!e||!navigator.mediaDevices?.enumerateDevices)return;let t=ko(),n=(await navigator.mediaDevices.enumerateDevices().catch(()=>[])).filter((s)=>s.kind==="audioinput"&&s.deviceId&&s.deviceId!=="default");e.innerHTML=l`<option value="">System default</option>${n.map((s,a)=>l`<option value="${s.deviceId}">${s.label||`Microphone ${a+1}`}</option>`)}`.s,e.value=n.some((s)=>s.deviceId===t)?t:"",e.onchange=()=>{try{localStorage.setItem(Tr,e.value)}catch{}}}var jr;function L(e,t){let n=i("toast");if(n.textContent=e,n.classList.toggle("rep",!!t),t){let s=document.createElement("a");s.href="/issue?"+new URLSearchParams(t),s.target="_blank",s.rel="noopener",s.textContent="Report",n.append(" ",s)}n.classList.add("on"),clearTimeout(jr),jr=setTimeout(()=>n.classList.remove("on"),t?8000:4000)}function Tt(){try{if(typeof Notification<"u"&&Notification.permission==="default")Notification.requestPermission()}catch(e){}}var Rr=(e,t)=>{try{return localStorage.getItem(e)||t}catch(n){return t}},ca=()=>Rr("kz-notify","on")==="on",On=()=>Rr("kz-sound","Bellatrix"),Pr=["Adara","Alya","Bellatrix","Beryllium","Cobalt","Fluorine","Krypton","Palladium","Rubidium","Xenon"],da=["off",...Pr,"chime","bell","pop"],Dr={chime:[[880,0,0.25],[1320,0.12,0.35]],bell:[[660,0,0.9]],pop:[[520,0,0.08]]},bt;function vs(e=On()){try{if(Pr.includes(e)){let n=new Audio(`/sounds/${e}.mp3`);n.volume=0.35,n.play().catch(()=>{});return}if(!Dr[e])return;bt=bt||new AudioContext,bt.resume();let t=bt.currentTime+0.02;for(let[n,s,a]of Dr[e]){let o=bt.createOscillator(),r=bt.createGain();o.type=e==="pop"?"triangle":"sine",o.frequency.value=n,r.gain.setValueAtTime(0.0001,t+s),r.gain.exponentialRampToValueAtTime(0.25,t+s+0.01),r.gain.exponentialRampToValueAtTime(0.0001,t+s+a),o.connect(r).connect(bt.destination),o.start(t+s),o.stop(t+s+a+0.05)}}catch(t){}}addEventListener("pointerdown",()=>{try{bt=bt||new AudioContext,bt.resume()}catch(e){}},{once:!0});function $o(e,t){if(!ca())return;vs();try{if(typeof Notification<"u"&&Notification.permission==="granted")new Notification("kaizen",{body:e,icon:"/logo.png",tag:t})}catch(n){}}var Au="https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0",Nr={tiny:"onnx-community/whisper-tiny",base:"onnx-community/whisper-base",small:"onnx-community/whisper-small","large-v3-turbo":"onnx-community/whisper-large-v3-turbo"},So=null,Eu=`import{pipeline}from"${Au}";let asr=null;
|
|
3
3
|
onmessage=async e=>{const m=e.data;try{
|
|
4
4
|
if(m.type==="load"){const prog=p=>{if(p.status==="progress")postMessage({type:"progress",file:p.file,pct:p.progress||0})};
|
|
@@ -114,7 +114,7 @@ dialog.gs::backdrop{background:rgb(0 0 0/.35)}
|
|
|
114
114
|
${kt("Late start allowed (minutes after the due time)","grace_minutes",Fn("grace_minutes",'inputmode="numeric"'))}
|
|
115
115
|
<div class="sk-a"><button type="button" class="btn pri" data-auto="save">${on?"Save":"Create"}</button>${on?l`<button type="button" class="btn" data-auto="cancel">Cancel</button>`:""}</div>
|
|
116
116
|
</div>`,rc=(e)=>l`<h3 class="sg">Automations</h3><div class="sgrp">${e.rules.map(Lp)}${Mp(e)}</div>`;function lc(e,t){i("pbody").querySelectorAll("[data-f]").forEach((n)=>{n.oninput=()=>{Vn[n.dataset.f]=n.value},n.onchange=()=>{if(Vn[n.dataset.f]=n.value,n.dataset.f==="kind")t()}}),i("pbody").querySelectorAll("[data-auto]").forEach((n)=>n.onclick=async()=>{let s=n.dataset.auto,a=n.dataset.id??"";if(s==="edit"){let r=e.rules.find((c)=>c.id===a);return on=a,Object.assign(Vn,{name:r.name,text:r.text,kind:r.kind,cron:r.cron,agent:r.agent??"",precheck:r.precheck??"",precheck_timeout:String(r.precheck_timeout),grace_minutes:String(r.grace_minutes),time:"09:00",day:"mon"}),void t()}if(s==="cancel")return on="",void t();if(s==="delete"&&!confirm("Delete this automation and its history?"))return;let o=await D("/automations",s==="save"?{op:on?"update":"create",id:on,...Vn}:{op:s,id:a});if(o.error)return L(o.error);if(s==="save"){on="";for(let r of["name","text","cron","agent","precheck"])delete Vn[r];L("Saved")}else if(s==="run")L(o.ok?"Started":(o.status??"not started").replace(/_/g," ")+(o.why?": "+o.why:""));await t()})}var Tp=[["core","Core"],["media","Media"],["optional","Optional"]],cc={installed:"installed",missing:"missing",other:"your own copy"},Cp={"Claude Code":"claude",Codex:"codex",Antigravity:"agy",OpenCode:"opencode",Cursor:"cursor","Gemini CLI":"gemini"},qp={kaizen:'<path d="M4 7h11M4 12h7M4 17h11"/><path d="m16 11 2 2 3-4"/>',"kaizen-help":'<circle cx="12" cy="12" r="9"/><path d="M9.5 9.5a2.5 2.5 0 1 1 3.8 2.1c-.9.6-1.3 1.1-1.3 2.1"/><path d="M12 17h.01"/>',"kaizen-book":'<path d="M12 6c-2-1.5-5-2-8-2v15c3 0 6 .5 8 2 2-1.5 5-2 8-2V4c-3 0-6 .5-8 2Z"/><path d="M12 6v15"/>',"kaizen-deck":'<rect x="3" y="4" width="18" height="12" rx="1"/><path d="M12 16v4M8 20h8M8 12l3-3 2 2 3-3"/>',"kaizen-computer":'<rect x="3" y="4" width="18" height="12" rx="1"/><path d="M8 20h8M12 16v4M9 8l5 3-2 .8-.8 2Z"/>',"kaizen-video":'<rect x="3" y="6" width="13" height="12" rx="2"/><path d="m16 10 5-3v10l-5-3"/>'},Hp='<path d="M10 4a2 2 0 1 1 4 0v2h5v5h-2a2 2 0 1 0 0 4h2v5H5v-5h2a2 2 0 1 0 0-4H5V6h5Z"/>',jp=(e)=>j(`<svg class="sk-i" viewBox="0 0 24 24" aria-hidden="true">${qp[e]??Hp}</svg>`),Dp=(e)=>l`<div class="sk" data-q="${[e.title,e.id,e.description,e.group,"skill"].join(" ").toLowerCase()}">
|
|
117
|
-
<div class="sk-h">${jp(e.id)}<span class="sk-n"><b>${e.title}</b><span>${e.description}</span></span>
|
|
117
|
+
<div class="sk-h">${jp(e.id)}<span class="sk-n"><b>${e.title}${e.status&&e.status!=="stable"?l` <em class="sk-st">${e.status==="beta"?"Beta":"Experimental"}</em>`:""}</b><span>${e.description}</span></span>
|
|
118
118
|
${e.group==="core"?l`<span class="hint">Always on</span>`:l`${!e.off&&e.agents.some((t)=>t.state==="missing")?l`<button type="button" class="btn" data-skill="${e.id}" data-on="true">Install</button>`:""}<button type="button" class="chk sm${e.off?"":" on"}" data-skill="${e.id}" data-on="${String(e.off)}" data-warn="${String(!!e.offByDefault)}" role="switch" aria-checked="${String(!e.off)}" aria-label="${e.title}" title="${e.off?"Off":"On"}"></button>`}</div>
|
|
119
119
|
<div class="sk-a">${e.agents.map((t)=>l`<img class="sk-ag${t.state==="installed"?"":" off"}" src="${dt[Cp[t.agent]??""]??""}" width="18" height="18" alt="${t.agent}: ${cc[t.state]??t.state}" title="${t.agent}: ${cc[t.state]??t.state}">`)}${e.needs.map((t)=>l`<span class="${t.found?"":"miss"}">Needs ${t.name}${t.found?"":" (not found)"}</span>`)}${e.note?l`<span>${e.note}</span>`:""}</div>
|
|
120
120
|
</div>`,dc=(e)=>l`${Tp.filter(([t])=>e.some((n)=>n.group===t)).map(([t,n],s)=>l`<h3 class="sg">${n}${s?"":l` <button type="button" id="sk-recheck">Re-check</button>`}</h3><div class="sgrp">${e.filter((a)=>a.group===t).map(Dp)}</div>`)}`;function uc(e,t=""){let n=i("sk-recheck");if(n)n.onclick=()=>e();i("pbody").querySelectorAll("[data-skill]").forEach((s)=>s.onclick=async()=>{let a=s.dataset.on==="true",o=a&&s.dataset.warn==="true";if(o&&!confirm(`Let agents read and operate the apps on your desktop?
|
package/web/notebook.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* kaizen notebook
|
|
1
|
+
/* kaizen notebook 3133ba0e8f81ad1a -- generated by bun run build:web from web/notebook.ts; do not edit */
|
|
2
2
|
var Ja=null,eh=(e)=>{Ja=e};function Am(e,t,i){Vr++,Ja?.(e,t,i)}var Vr=0,Ka="",Ur=!1,As=!1;async function Nr(){if(Ur){As=!0;return}Ur=!0;do{As=!1;let e=Vr;try{let t=await fetch("/state?all=1");if(!t.ok)continue;let i=await t.text(),n=i.replace(/"now":\d+\}$/,"");if(n===Ka)continue;let{cards:s,projects:r,rail:o,agents:l}=JSON.parse(i);if(!As&&e===Vr)Ka=n,Am(s,[...r,...o??[]],l)}catch{}}while(As);Ur=!1}var Xm={S:{project:null,projects:[],cards:[],now:Date.now(),all:!1,dir:null},all:new URLSearchParams(location.search).get("all")!=="0",dir:null,openKey:null,mode:null,modeKey:null,menuKey:null,flash:new Set,tab:"request",lastTab:"request",runDoc:null,clearMenu:!1,sevMenu:!1,wantTerm:null,wantPty:null,shells:[],setQ:"",setScope:"all",setPage:null,setBack:!1,pageGen:0,PL:[],shown:new Set((()=>{try{return JSON.parse(localStorage.getItem("kz-show"))||[]}catch(e){return[]}})())};var N=(e)=>document.getElementById(e),Zm=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&","<":"<",">":">",'"':"""})[t]);class Gr{s;constructor(e){this.s=e}toString(){return this.s}}var bt=(e)=>new Gr(String(e)),th=(e)=>e instanceof Gr?e.s:Array.isArray(e)?e.map(th).join(""):e==null||e===!1?"":Zm(e),R=(e,...t)=>bt(e.reduce((i,n,s)=>i+th(t[s-1])+n));var Pw=bt('<div aria-busy="true" aria-label="Loading"><span class="skel" style="height:16px;width:35%;margin:20px 0 14px"></span>'+'<span class="skel" style="height:44px;margin-bottom:10px"></span>'.repeat(4)+"</div>");function Xs(e){let t=document.createElement("dialog");return t.className="kz",t.innerHTML=`<form class="inl" method="dialog">${e}</form>`,t.onclose=()=>t.remove(),t.onclick=(i)=>{if(i.target===t)t.close()},document.body.appendChild(t),t.showModal(),t}var Mm=!1;try{Mm=localStorage.getItem("kz-res-disk")==="1"}catch{}var mi=(e,t)=>{let i=t-e;return i<3600000?Math.round(i/60000)+"m":i<86400000?Math.round(i/3600000)+"h":Math.round(i/86400000)+"d"};var Kr=(e)=>typeof e==="string"?[e]:e.kids.flatMap(Kr);var Jr=(e,t)=>`ws:${e}:${t}`,rh=(e)=>e.kind==="run"&&e.status==="done"&&e.accept!=="needs"&&!e.archived&&e.git==="pending";var oh=3000,Ms=new Map,vn=(e)=>e.key+"@"+(e.born??0),ih={conflict:0,failed:0,asking:0,working:1,done:2},Zs={conflict:"Conflict",failed:"Land failed",asking:"Asking",working:"Working",done:"Done"},Rm={conflict:"fail",failed:"fail",asking:"wait",working:"build",done:"done"};function jm(e,t,i=Ms){if(e.land)return e.land==="conflict"?"conflict":"failed";if(e.asking)return"asking";if(e.busy)return i.set(vn(e),t),"working";return t-(i.get(vn(e))??-1/0)<oh?"working":"done"}var lh=(e,t,i=Ms)=>Math.min(1/0,...e.filter((n)=>!n.asking&&!n.busy&&i.has(vn(n))).map((n)=>oh-(t-i.get(vn(n)))).filter((n)=>n>0)),ah=(e,t=Ms)=>{let i=new Set(e.map(vn));for(let n of t.keys())if(!i.has(n))t.delete(n)},hh=(e,t,i,n,s,r=Ms)=>e.filter((o)=>o.dir===t&&n({state:o.dir,ws:o.ws})===i).map((o)=>({a:o,st:jm(o,s,r)})).sort((o,l)=>ih[o.st]-ih[l.st]),nh=({a:e,st:t})=>(e.land?"":e.last)||`${Zs[t]} - ${e.name}`,sh=(e,t)=>!e?"":t-e<60000?"now":mi(e,t),Lm=(e,t)=>e+"\x00"+t;function ch(e,t,i){let n=Lm(t,i);if(e[n])delete e[n];else e[n]=!0;return e}var Em=["claude","codex","gemini"],Hr=(e)=>R`<svg aria-hidden="true"><use href="#i-${Em.includes(e.agent??"")?e.agent:"ai"}"/></svg>`,Fr=(e)=>R`<i class="si ${Rm[e]}"></i>`,_m=R`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;function fh(e,t,i,n,s){if(!e.length)return"";let r=R`data-dir="${n}" data-ws="${s}"`;if(e.length===1){let a=e[0];return R`<div class="wag"><button type="button" class="aone" data-term="${a.a.key}" ${r} title="${a.a.name}: open its terminal">${Fr(a.st)}${Hr(a.a)}<span class="atx">${Zs[a.st]} - ${a.a.name}</span><small>${sh(a.a.at,t)}</small></button></div>`}let o=R`<button type="button" class="wchev${i?" on":""}" data-wopen ${r} aria-expanded="${String(i)}" aria-label="${String(e.length)} agents: ${i?"hide":"show"} the list">${_m}</button>`;if(i)return R`<div class="wag"><span class="aht">${String(e.length)} agents</span>${o}</div><div class="alist">${e.map((a)=>R`<button type="button" class="arow" data-term="${a.a.key}" ${r} title="${nh(a)}">${Fr(a.st)}${Hr(a.a)}<span class="atx">${nh(a)}</span><small>${sh(a.a.at,t)}</small></button>`)}</div>`;let l=["conflict","failed","asking","working","done"].map((a)=>({st:a,rs:e.filter((h)=>h.st===a)})).filter((a)=>a.rs.length);return R`<div class="wag"><span class="chips">${l.map((a)=>R`<span class="chip">${Fr(a.st)}${a.rs.map((h)=>R`<button type="button" class="amark" data-term="${h.a.key}" ${r} title="${h.a.name} - ${Zs[a.st]}: open its terminal" aria-label="${h.a.name} - ${Zs[a.st]}: open its terminal">${Hr(h.a)}</button>`)}</span>`)}</span>${o}</div>`}function eo(e){return e.toLowerCase().trim().replace(/[^a-z0-9/._-]+/g,"-").replace(/\.{2,}/g,".").replace(/\/{2,}/g,"/").replace(/(^|\/)[-.]+/g,"$1").slice(0,60).replace(/[-./]+(\/|$)/g,"$1").replace(/\/$/,"").replace(/\.lock(\/|$)/g,"-lock$1")}var zm=(e)=>e.includes("\\")?"\\":"/";async function Ut(e,t){try{let i=await fetch(e,t?{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}:void 0),n=await i.json().catch(()=>({}));return{ok:i.ok,d:i.ok?n:{error:n.error||n.why||"that did not work"}}}catch{return{ok:!1,d:{error:"kaizen is offline"}}}}function Pn(e={}){let t=Xs(""),i=t.querySelector("form");t.setAttribute("aria-label","Add a project");let n=e.start==="ws",s=(u)=>i.elements.namedItem(u),r=(u,d,p,O)=>(u.disabled=d,u.textContent=d?p:O),o=n?"":R`<button type="button" class="btn ghost" data-a="back">Back to add options</button>`,l=(u)=>R`<small class="att err" role="alert"></small><div class="row">${o}<button type="button" class="btn ghost" data-a="x">Cancel</button><button class="btn pri" data-a="go">${u}</button></div>`,a=(u)=>i.querySelector(".err").textContent=u,h=(u,d)=>{a(d);try{localStorage.setItem("kz-proj",u)}catch{}setTimeout(()=>location.href="/",900)},c=async(u,d)=>{let p=await Ut("/pick-folder",{});if(p.d.path)u.value=d?p.d.path.replace(/[\\/]+$/,"")+zm(p.d.path)+d():p.d.path},f=(u)=>{let d=uh();if(t.classList.toggle("wsnew",u==="ws"),u==="menu")i.innerHTML=R`<b>Add a project</b><small class="att">Add a project to get started with kaizen.</small><button type="button" class="btn opt" data-go="folder"><b>Existing folder</b><small>A project, a Git repo, or any folder</small></button><small class="att">Other ways to add</small><button type="button" class="btn opt" data-go="clone"><b>Clone from URL</b><small>Clone a remote Git repository</small></button><button type="button" class="btn opt" data-go="create"><b>Create new project</b><small>Start from an empty folder</small></button>${d.length?R`<button type="button" class="btn opt" data-go="ws"><b>New workspace</b><small>A branch in its own folder, in a project you have</small></button>`:""}<div class="row"><button type="button" class="btn ghost" data-a="x">Cancel</button></div>`.toString(),i.querySelectorAll("[data-go]").forEach((O)=>O.onclick=()=>f(O.dataset.go)),i.onsubmit=(O)=>O.preventDefault();else if(u==="folder")i.innerHTML=R`<b>Existing folder</b><small class="att">Pick a folder, or type its path. A .kaizen folder is added to it.</small><div class="row"><input name="path" placeholder="/path/to/folder" aria-label="Folder" autocomplete="off" spellcheck="false" required><button type="button" class="btn ghost" data-a="pick">Pick…</button></div>${l("Add project")}`.toString(),s("path").focus(),i.onsubmit=async(O)=>{O.preventDefault();let g=i.querySelector("[data-a=go]");r(g,!0,"Adding...","Add project");let b=await Ut("/add-project",{path:s("path").value.trim()});r(g,!1,"","Add project"),b.ok?h(b.d.dir,b.d.already?"Project already added":"Project added"):a(b.d.error)},i.querySelector("[data-a=pick]").onclick=()=>c(s("path"));else if(u==="clone"){i.innerHTML=R`<b>Clone from URL</b><small class="att">Enter the Git URL (https or ssh) and choose where to clone it.</small><input name="url" placeholder="https://github.com/user/repo.git" aria-label="Git URL" autocomplete="off" spellcheck="false" required><div class="row"><input name="to" placeholder="Folder to clone into" aria-label="Clone into" autocomplete="off" spellcheck="false"><button type="button" class="btn ghost" data-a="pick">Pick…</button></div>${l("Clone")}`.toString(),s("url").focus();let O="",g="",b=async()=>{let y=s("url").value.trim();if(!y)return!1;let S=await Ut("/clone",{url:y,check:!0});if(!S.ok)return a(S.d.error),!1;if(a(""),O=S.d.name,!s("to").value.trim()||s("to").value===g)s("to").value=g=S.d.to;return!0};s("url").onchange=b,i.querySelector("[data-a=pick]").onclick=async()=>await b()?c(s("to"),()=>O):s("url").focus(),i.onsubmit=async(y)=>{if(y.preventDefault(),!await b())return;let S=i.querySelector("[data-a=go]");r(S,!0,"Cloning...","Clone");let x=await Ut("/clone",{url:s("url").value.trim(),to:s("to").value.trim()||void 0});r(S,!1,"","Clone"),x.ok?h(x.d.dir,"Cloned"):a(x.d.error)}}else if(u==="create"){i.innerHTML=R`<b>Create a new project</b><small class="att">Name it and kaizen will create the folder with a .kaizen inside.</small><input name="name" placeholder="my-project" aria-label="Name" autocomplete="off" spellcheck="false" required><div class="row"><input name="to" placeholder="Folder to create" aria-label="Create in" autocomplete="off" spellcheck="false"><button type="button" class="btn ghost" data-a="pick">Pick…</button></div><label class="att"><input type="checkbox" name="git" checked> Git repository</label>${l("Create project")}`.toString(),s("name").focus();let O="";s("name").oninput=async()=>{let g=s("name").value.trim();if(!g||/[\\/:*?"<>|]/.test(g)||s("to").value.trim()&&s("to").value!==O)return;let b=await Ut("/new-project",{name:g,check:!0});if(b.ok&&s("name").value.trim()===g)s("to").value=O=b.d.to},i.querySelector("[data-a=pick]").onclick=()=>c(s("to"),()=>s("name").value.trim()),i.onsubmit=async(g)=>{g.preventDefault();let b=i.querySelector("[data-a=go]");r(b,!0,"Creating...","Create project");let y=await Ut("/new-project",{name:s("name").value.trim(),to:s("to").value.trim()||void 0,git:s("git").checked});if(r(b,!1,"","Create project"),!y.ok)return a(y.d.error);h(y.d.dir,y.d.git===!1?"Project created, but git init failed":"Project created")}}else{let O=d.some((S)=>S.dir===e.dir)?e.dir:d[0]?.dir,g=/Mac/.test(navigator.platform)?"⌘":"Ctrl";i.innerHTML=R`<b>New workspace</b><label class="att">Project<select name="project" aria-label="Project">${d.map((S)=>R`<option value="${S.dir}"${S.dir===O?" selected":""}>${S.name}</option>`)}</select></label><div class="wsfrom"><span class="att" id="wsfl">Create from <i>[Optional]</i></span><label class="wsbase">from <select name="base" aria-label="Start from branch"></select></label></div><input name="name" placeholder="What is this workspace for?" aria-labelledby="wsfl" autocomplete="off" spellcheck="false"><details class="wsadv"><summary>Advanced</summary><label class="att">Branch name<input name="branch" placeholder="feature/my-branch" aria-label="Branch name" autocomplete="off" spellcheck="false"></label></details><small class="att err" role="alert"></small><div class="row">${o}<button type="button" class="btn ghost" data-a="x">Cancel</button><button class="btn pri" data-a="go">Create workspace</button><kbd class="wskey" aria-hidden="true">${g} ↵</kbd></div>`.toString(),s("name").focus();let b=i.elements.namedItem("base");s("name").oninput=()=>s("branch").placeholder=eo(s("name").value)||"feature/my-branch";let y=async()=>{let S=await Ut("/branches?dir="+encodeURIComponent(s("project").value)),{def:x="",branches:v=[]}=S.ok?S.d:{};b.innerHTML=v.map((X)=>R`<option${X===x?" selected":""}>${X}</option>`.toString()).join("")||'<option value="">current branch</option>'};i.elements.namedItem("project").onchange=y,y(),i.onkeydown=(S)=>{if(S.key==="Enter"&&(S.ctrlKey||S.metaKey))S.preventDefault(),i.requestSubmit()},i.onsubmit=async(S)=>{S.preventDefault();let x=s("project").value,v=i.querySelector("[data-a=go]");if(v.disabled)return;a("");let X=s("branch").value.trim()||eo(s("name").value)||"workspace-"+Math.random().toString(36).slice(2,6);r(v,!0,"Creating...","Create workspace");let T=await Ut("/worktree",{dir:x,branch:X,base:b.value||void 0});r(v,!1,"","Create workspace"),T.ok?(t.close(),location.href=Vt(x,T.d.path)):a(T.d.error)}}i.querySelector("[data-a=x]").onclick=()=>t.close();let p=i.querySelector("[data-a=back]");if(p)p.onclick=()=>f("menu")};f(e.start??"menu")}function dh(e,t){let i=t.toLowerCase().split(/\s+/).filter(Boolean);if(!i.length)return e;let n=t.trim().toLowerCase(),s=(r)=>{let o=r.title.toLowerCase();return o.startsWith(n)?0:o.includes(n)?1:2};return e.filter((r)=>{let o=(r.title+" "+(r.sub??"")+" "+r.hay).toLowerCase();return i.every((l)=>o.includes(l))}).sort((r,o)=>s(r)-s(o)||(o.at??0)-(r.at??0))}var js=(e,t)=>!dispatchEvent(new CustomEvent(e,{cancelable:!0,detail:t})),gi=(e,t)=>()=>{let i=document.querySelector(`.rail a[data-view="${e}"]`);i?i.click():location.href=t},ph=(e,t)=>{if(!js("kz-open-ws",{dir:e,ws:t}))location.href=Vt(e,t)},mh=()=>{try{return JSON.parse(localStorage.getItem("kz-runtabs")||"{}")}catch{return{}}},Ym=(e,t,i)=>{if(js("kz-open-tab",{dir:e,ws:t,id:i}))return;let n=mh(),s=n[Jr(e,t)],r=s?.screens?.find((o)=>Kr(o.tree).includes(i));if(r)try{s.on=r.id,localStorage.setItem("kz-runtabs",JSON.stringify(n))}catch{}location.href=Vt(e,t)},qm=["local","preview","note","history","shell"],Dm=(e)=>{try{return localStorage.getItem("kz-browse:"+e)?.replace(/^https?:\/\//,"").replace(/\/$/,"")}catch{}},Wm={ws:'<circle cx="6" cy="6" r="2"/><circle cx="6" cy="18" r="2"/><circle cx="18" cy="8" r="2"/><path d="M6 8v8M18 10c0 4-6 3-12 6"/>',run:'<path d="M5 4l14 8-14 8z"/>',idea:'<path d="M9 18h6M10 21h4M12 3a6 6 0 0 0-4 10.5c.7.7 1 1.5 1 2.5h6c0-1 .3-1.8 1-2.5A6 6 0 0 0 12 3z"/>',chat:'<path d="M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z"/>',term:'<path d="M4 17l6-5-6-5M12 19h8"/>',proj:'<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',page:'<rect x="4" y="4" width="16" height="16" rx="2"/><path d="M4 9h16"/>',act:'<path d="M13 3L5 14h6l-1 7 8-11h-6z"/>',tab:'<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 9h8V5"/>',plus:'<path d="M12 5v14M5 12h14"/>',search:'<circle cx="11" cy="11" r="7"/><path d="M20 20l-4-4"/>'},gh=(e)=>bt(`<svg viewBox="0 0 24 24" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${Wm[e]}</g></svg>`),bh=[];function Bm(){let{cards:e,projects:t=[],agents:i=[]}=kh(),n=Date.now(),s=new URLSearchParams(location.search),r=s.get("id")&&e.find((u)=>u.kind==="run"&&u.state===s.get("dir")&&u.id===s.get("id")),o=s.get("ws")??(r?Yi(r,t):null),l=[],a=mh(),h=new Map;for(let u of e){let d=u.state+"\x00"+Yi(u,t);h.set(d,Math.max(h.get(d)??0,u.moved??0))}for(let u of t){let d=Ve(u.dir,t);for(let p of u.workspaces??[]){let O=s.get("dir")===u.dir&&o===p.path,g=h.get(u.dir+"\x00"+p.path);l.push({group:O?"Current":"Workspaces",title:bi(p),sub:d,when:g?mi(g,n):void 0,hay:`${bi(p)} ${d} ${p.path} workspace`,at:O?1/0:g??0,ico:"ws",act:()=>ph(u.dir,p.path)});let b=Jr(u.dir,p.path),y=a[b];for(let S of y?.tabs??[]){if(!qm.includes(S.kind)||y.hidden?.includes(S.id))continue;let x=S.kind==="local"&&Dm(b)||S.title;l.push({group:"Tabs",title:x,sub:`${bi(p)} · ${d}`,hay:`${x} ${S.title} ${S.kind} ${S.note??""} ${bi(p)} ${d} tab`,ico:"tab",act:()=>Ym(u.dir,p.path,S.id)})}}l.push({group:"Projects",title:d,hay:`${d} ${u.dir} project`,ico:"proj",act:()=>{let p=u.workspaces?.find((O)=>O.main)??u.workspaces?.[0];p?ph(u.dir,p.path):gi("board","/?view=board")()}})}for(let u of e.filter((d)=>!d.archived)){let d=yi(u);l.push({group:u.kind==="run"?"Runs":"Tasks",title:no(u)||u.id,sub:Ve(u.state,t),when:u.moved?mi(u.moved,n):void 0,hay:`${no(u)} ${u.id??""} ${u.text??""} ${Ve(u.state,t)} ${d}`,at:u.moved??0,dot:d,ico:u.kind==="run"?"run":"idea",act:()=>{if(!js("kz-open-card",{dir:u.state,id:u.kind==="run"?u.id:void 0,text:u.text}))location.href=Sh(u)}})}for(let u of bh){let d=Date.parse(u.updated)||0;l.push({group:"Chats & terminals",title:u.title||"Chat",sub:u.project?Ve(u.project,t):void 0,when:d?mi(d,n):void 0,hay:`${u.title} chat ${u.project??""}`,at:d,dot:u.busy?"build":void 0,ico:"chat",act:()=>{try{sessionStorage.setItem("kz-chat",u.id)}catch{}gi("home","/")()}})}for(let u of i)l.push({group:"Chats & terminals",title:u.name||u.agent||"Terminal",sub:Ve(u.dir,t),hay:`${u.name} ${u.agent??""} ${u.run??""} ${u.last??""} ${Ve(u.dir,t)} terminal agent`,at:u.at??u.born??0,dot:u.asking?"wait":u.busy?"build":"done",ico:"term",act:()=>{if(!js("kz-open-term",{dir:u.dir,ws:u.ws,key:u.key}))location.href=Vt(u.dir,u.ws??"")}});let c=(u)=>()=>N(u)?.click(),f=[["Home","page",gi("home","/"),"chat"],["Icebox","page",gi("sources","/?view=icebox"),"requests sources gathered"],["Tasks","page",gi("tasks","/?view=tasks"),"backlog"],["Board","page",gi("board","/?view=board"),"kanban runs"],["Notes","page",()=>location.href="/notebook","notebook docs"],["Settings","page",gi("settings","/?view=settings"),"preferences config"],["New task","act",()=>N("newtop")?N("newtop").click():location.href="/?view=board","create add run"],["Add a project","act",()=>Pn({dir:null}),"clone folder create workspace"],["Toggle theme","act",c("themet"),"dark light"],["Collapse or expand menu","act",c("fold"),"sidebar rail"],["Keyboard shortcuts","act",c("kbd"),"keys help"],["Report an issue","act",()=>open("/issue","_blank","noopener"),"bug feedback"]];for(let[u,d,p,O]of f)l.push({group:"Actions",title:u,hay:`${u} ${O??""}`,ico:d,act:p});return l}var Im=["Current","Workspaces","Tabs","Chats & terminals","Runs","Tasks","Projects","Actions"],Um={Workspaces:5,Tabs:4,"Chats & terminals":5,Runs:5,Tasks:3,Projects:5},H=null,nt=[],st=0;function Rs(){let e=H.querySelector("input").value,t=Bm(),i=e.trim()?dh(t,e):t.slice().sort((o,l)=>(l.at??0)-(o.at??0));nt=[];let n=e.trim()?[...new Set(i.map((o)=>o.group))]:Im;for(let o of n){let l=i.filter((a)=>a.group===o);nt.push(...l.slice(0,e.trim()?8:Um[o]??l.length))}if(e.trim())nt.push({group:"Create",title:`New task "${e.trim()}"`,hay:"",ico:"plus",act:()=>Vm(e.trim())});st=Math.min(st,nt.length-1);let s=H.querySelector(".gs-list"),r="";s.innerHTML=String(R`${nt.map((o,l)=>{let a=o.group!==r?(r=o.group,R`<div class="gs-h" role="presentation">${o.group}</div>`):"";return R`${a}<div class="gs-i" role="option" id="gs-${l}" data-n="${l}" aria-selected="${String(l===st)}">${gh(o.ico)}${o.dot?R`<span class="si ${o.dot}"></span>`:""}<span class="gs-t">${o.title}</span>${o.sub?R`<span class="gs-s">${o.sub}</span>`:""}${o.when?R`<span class="gs-w">${o.when}</span>`:""}</div>`})}${nt.length===1&&e.trim()?R`<div class="gs-none">No results</div>`:""}`),io(st),H.querySelector(".gs-live").textContent=`${nt.length} result${nt.length===1?"":"s"} found`}function io(e){H.querySelector(`#gs-${st}`)?.setAttribute("aria-selected","false"),st=e;let t=H.querySelector(`#gs-${e}`);t?.setAttribute("aria-selected","true"),H.querySelector("input").setAttribute("aria-activedescendant","gs-"+e),t?.scrollIntoView({block:"nearest"})}function Vm(e){if(!N("newtop"))return void(location.href="/?view=board");N("newtop").click();let t=document.querySelector("dialog[open] textarea");if(t)t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function Oh(e){let t=nt[e];if(!t)return;H.close(),t.act()}function to(){if(H)return H.querySelector("input").focus();H=document.createElement("dialog"),H.className="gs",H.setAttribute("aria-label","Search"),H.innerHTML=String(R`<div class="gs-box"><div class="gs-q">${gh("search")}<input type="text" placeholder="Search" aria-label="Search" role="combobox" aria-expanded="true" aria-controls="gs-list" autocomplete="off" spellcheck="false"></div><div class="gs-list" id="gs-list" role="listbox"></div><span class="gs-live" role="status" aria-live="polite"></span></div>`),document.body.append(H);let e=H.querySelector("input");st=0,e.oninput=()=>(st=0,Rs()),e.onkeydown=(i)=>{let n={ArrowDown:1,ArrowUp:-1}[i.key]??(i.ctrlKey&&i.key==="n"?1:i.ctrlKey&&i.key==="p"?-1:0);if(n)i.preventDefault(),io((st+n+nt.length)%nt.length);else if(i.key==="Enter")i.preventDefault(),Oh(st)};let t=H.querySelector(".gs-list");t.onclick=(i)=>{let n=i.target.closest(".gs-i");if(n)Oh(+n.dataset.n)},t.onpointermove=(i)=>{let n=i.target.closest(".gs-i");if(n&&+n.dataset.n!==st)io(+n.dataset.n)},H.onclick=(i)=>i.target===H&&H.close(),H.onclose=()=>(H.remove(),H=null),H.showModal(),Rs(),fetch("/chats").then((i)=>i.json()).then((i)=>{if(bh=i.chats??[],H)Rs()}).catch(()=>{})}var Nm=`dialog.gs{border:0;padding:0;margin:14vh auto auto;background:none;width:min(560px,calc(100vw - 32px));color:var(--ink);overflow:visible}
|
|
3
3
|
dialog.gs::backdrop{background:rgb(0 0 0/.35)}
|
|
4
4
|
.gs-box{display:flex;flex-direction:column;max-height:min(480px,72vh);background:var(--bg);border:1px solid var(--line);border-radius:10px;box-shadow:0 16px 40px rgb(0 0 0/.25);overflow:hidden}
|
package/web/term.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* kaizen terminal
|
|
1
|
+
/* kaizen terminal 3133ba0e8f81ad1a -- generated by bun run build:web from web/term.ts; do not edit */
|
|
2
2
|
(()=>{var{defineProperty:Fo,getOwnPropertyDescriptor:sl}=Object,rl=(e,t)=>{for(var i in t)Fo(e,i,{get:t[i],enumerable:!0})},he=(e,t,i,s)=>{for(var r=s>1?void 0:s?sl(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&Fo(t,i,r),r},O=(e,t)=>(i,s)=>t(i,s,e),Pn="Terminal input",dr={get:()=>Pn,set:(e)=>Pn=e},On="Too much output to announce, navigate to rows manually to read",ur={get:()=>On,set:(e)=>On=e};function nl(e){return e.replace(/\r?\n/g,"\r")}function ol(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function al(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function hl(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Wo(r,t,i,s)}}function Wo(e,t,i,s){e=nl(e),e=ol(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function zo(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function In(e,t,i,s,r){zo(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Nt(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Ss(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var ll=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},cl=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,a,l=0,h=0;if(this.interim[0]){let u=!1,g=this.interim[0];g&=(g&224)===192?31:(g&240)===224?15:7;let p=0,b;for(;(b=this.interim[++p]&63)&&p<4;)g<<=6,g|=b;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,B=k-p;for(;h<B;){if(h>=i)return 0;if(b=e[h++],(b&192)!==128){h--,u=!0;break}else this.interim[p++]=b,g<<=6,g|=b&63}u||(k===2?g<128?h--:t[s++]=g:k===3?g<2048||g>=55296&&g<=57343||g===65279||(t[s++]=g):g<65536||g>1114111||(t[s++]=g)),this.interim.fill(0)}let d=i-4,c=h;for(;c<i;){for(;c<d&&!((r=e[c])&128)&&!((n=e[c+1])&128)&&!((o=e[c+2])&128)&&!((a=e[c+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=a,c+=4;if(r=e[c++],r<128)t[s++]=r;else if((r&224)===192){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(l=(r&31)<<6|n&63,l<128){c--;continue}t[s++]=l}else if((r&240)===224){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(l=(r&15)<<12|(n&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[s++]=l}else if((r&248)===240){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=e[c++],(a&192)!==128){c--;continue}if(l=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;t[s++]=l}}return s}},Ho="",Ft=" ",Oi=class e{constructor(){this.fg=0,this.bg=0,this.extended=new cs}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},cs=class e{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},et=class e extends Oi{constructor(){super(...arguments);this.content=0,this.fg=0,this.bg=0,this.extended=new cs,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Nt(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Nn="di$target",_r="di$dependencies",Ys=new Map;function dl(e){return e[_r]||[]}function Me(e){if(Ys.has(e))return Ys.get(e);let t=function(i,s,r){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");ul(t,i,r)};return t._id=e,Ys.set(e,t),t}function ul(e,t,i){t[Nn]===t?t[_r].push({id:e,index:i}):(t[_r]=[{id:e,index:i}],t[Nn]=t)}var Ne=Me("BufferService"),$o=Me("CoreMouseService"),Qt=Me("CoreService"),_l=Me("CharsetService"),Hr=Me("InstantiationService"),Uo=Me("LogService"),Fe=Me("OptionsService"),Ko=Me("OscLinkService"),fl=Me("UnicodeService"),Ii=Me("DecorationService"),fr=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new et,o=i.getTrimmedLength(),a=-1,l=-1,h=!1;for(let d=0;d<o;d++)if(!(l===-1&&!i.hasContent(d))){if(i.loadCell(d,n),n.hasExtendedAttrs()&&n.extended.urlId)if(l===-1){l=d,a=n.extended.urlId;continue}else h=n.extended.urlId!==a;else l!==-1&&(h=!0);if(h||l!==-1&&d===o-1){let c=this._oscLinkService.getLinkData(a)?.uri;if(c){let u={start:{x:l+1,y:e},end:{x:d+(!h&&d===o-1?1:0),y:e}},g=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(c);["http:","https:"].includes(p.protocol)||(g=!0)}catch{g=!0}g||s.push({text:c,range:u,activate:(p,b)=>r?r.activate(p,b,u):gl(p,b),hover:(p,b)=>r?.hover?.(p,b,u),leave:(p,b)=>r?.leave?.(p,b,u)})}h=!1,n.hasExtendedAttrs()&&n.extended.urlId?(l=d,a=n.extended.urlId):(l=-1,a=-1)}}t(s)}};fr=he([O(0,Ne),O(1,Fe),O(2,Ko)],fr);function gl(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
3
3
|
|
|
4
4
|
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var ws=Me("CharSizeService"),wt=Me("CoreBrowserService"),$r=Me("MouseService"),bt=Me("RenderService"),pl=Me("SelectionService"),qo=Me("CharacterJoinerService"),ni=Me("ThemeService"),Vo=Me("LinkProviderService"),vl=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Fn.isErrorNoTelemetry(e)?new Fn(e.message+`
|
package/web/video.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* kaizen video page
|
|
1
|
+
/* kaizen video page 3133ba0e8f81ad1a -- generated by bun run build:web from web/video.ts; do not edit */
|
|
2
2
|
(()=>{var ht=null,bt=(e)=>{ht=e};function dn(e,t,n){Oe++,ht?.(e,t,n)}var Oe=0,gt="",De=!1,we=!1;async function qe(){if(De){we=!0;return}De=!0;do{we=!1;let e=Oe;try{let t=await fetch("/state?all=1");if(!t.ok)continue;let n=await t.text(),a=n.replace(/"now":\d+\}$/,"");if(a===gt)continue;let{cards:s,projects:r,rail:l,agents:i}=JSON.parse(n);if(!we&&e===Oe)gt=a,dn(s,[...r,...l??[]],i)}catch{}}while(we);De=!1}var un={S:{project:null,projects:[],cards:[],now:Date.now(),all:!1,dir:null},all:new URLSearchParams(location.search).get("all")!=="0",dir:null,openKey:null,mode:null,modeKey:null,menuKey:null,flash:new Set,tab:"request",lastTab:"request",runDoc:null,clearMenu:!1,sevMenu:!1,wantTerm:null,wantPty:null,shells:[],setQ:"",setScope:"all",setPage:null,setBack:!1,pageGen:0,PL:[],shown:new Set((()=>{try{return JSON.parse(localStorage.getItem("kz-show"))||[]}catch(e){return[]}})())};var M=(e)=>document.getElementById(e),pn=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&","<":"<",">":">",'"':"""})[t]);class Fe{s;constructor(e){this.s=e}toString(){return this.s}}var K=(e)=>new Fe(String(e)),vt=(e)=>e instanceof Fe?e.s:Array.isArray(e)?e.map(vt).join(""):e==null||e===!1?"":pn(e),w=(e,...t)=>K(e.reduce((n,a,s)=>n+vt(t[s-1])+a));var os=K('<div aria-busy="true" aria-label="Loading"><span class="skel" style="height:16px;width:35%;margin:20px 0 14px"></span>'+'<span class="skel" style="height:44px;margin-bottom:10px"></span>'.repeat(4)+"</div>");function $e(e){let t=document.createElement("dialog");return t.className="kz",t.innerHTML=`<form class="inl" method="dialog">${e}</form>`,t.onclose=()=>t.remove(),t.onclick=(n)=>{if(n.target===t)t.close()},document.body.appendChild(t),t.showModal(),t}var mn=!1;try{mn=localStorage.getItem("kz-res-disk")==="1"}catch{}var te=(e,t)=>{let n=t-e;return n<3600000?Math.round(n/60000)+"m":n<86400000?Math.round(n/3600000)+"h":Math.round(n/86400000)+"d"};var We=(e)=>typeof e==="string"?[e]:e.kids.flatMap(We);var Ve=(e,t)=>`ws:${e}:${t}`,kt=(e)=>e.kind==="run"&&e.status==="done"&&e.accept!=="needs"&&!e.archived&&e.git==="pending";var xt=3000,xe=new Map,me=(e)=>e.key+"@"+(e.born??0),yt={conflict:0,failed:0,asking:0,working:1,done:2},ke={conflict:"Conflict",failed:"Land failed",asking:"Asking",working:"Working",done:"Done"},fn={conflict:"fail",failed:"fail",asking:"wait",working:"build",done:"done"};function gn(e,t,n=xe){if(e.land)return e.land==="conflict"?"conflict":"failed";if(e.asking)return"asking";if(e.busy)return n.set(me(e),t),"working";return t-(n.get(me(e))??-1/0)<xt?"working":"done"}var Et=(e,t,n=xe)=>Math.min(1/0,...e.filter((a)=>!a.asking&&!a.busy&&n.has(me(a))).map((a)=>xt-(t-n.get(me(a)))).filter((a)=>a>0)),Mt=(e,t=xe)=>{let n=new Set(e.map(me));for(let a of t.keys())if(!n.has(a))t.delete(a)},St=(e,t,n,a,s,r=xe)=>e.filter((l)=>l.dir===t&&a({state:l.dir,ws:l.ws})===n).map((l)=>({a:l,st:gn(l,s,r)})).sort((l,i)=>yt[l.st]-yt[i.st]),wt=({a:e,st:t})=>(e.land?"":e.last)||`${ke[t]} - ${e.name}`,$t=(e,t)=>!e?"":t-e<60000?"now":te(e,t),hn=(e,t)=>e+"\x00"+t;function Lt(e,t,n){let a=hn(t,n);if(e[a])delete e[a];else e[a]=!0;return e}var bn=["claude","codex","gemini"],Ke=(e)=>w`<svg aria-hidden="true"><use href="#i-${bn.includes(e.agent??"")?e.agent:"ai"}"/></svg>`,Ue=(e)=>w`<i class="si ${fn[e]}"></i>`,vn=w`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;function Tt(e,t,n,a,s){if(!e.length)return"";let r=w`data-dir="${a}" data-ws="${s}"`;if(e.length===1){let u=e[0];return w`<div class="wag"><button type="button" class="aone" data-term="${u.a.key}" ${r} title="${u.a.name}: open its terminal">${Ue(u.st)}${Ke(u.a)}<span class="atx">${ke[u.st]} - ${u.a.name}</span><small>${$t(u.a.at,t)}</small></button></div>`}let l=w`<button type="button" class="wchev${n?" on":""}" data-wopen ${r} aria-expanded="${String(n)}" aria-label="${String(e.length)} agents: ${n?"hide":"show"} the list">${vn}</button>`;if(n)return w`<div class="wag"><span class="aht">${String(e.length)} agents</span>${l}</div><div class="alist">${e.map((u)=>w`<button type="button" class="arow" data-term="${u.a.key}" ${r} title="${wt(u)}">${Ue(u.st)}${Ke(u.a)}<span class="atx">${wt(u)}</span><small>${$t(u.a.at,t)}</small></button>`)}</div>`;let i=["conflict","failed","asking","working","done"].map((u)=>({st:u,rs:e.filter((k)=>k.st===u)})).filter((u)=>u.rs.length);return w`<div class="wag"><span class="chips">${i.map((u)=>w`<span class="chip">${Ue(u.st)}${u.rs.map((k)=>w`<button type="button" class="amark" data-term="${k.a.key}" ${r} title="${k.a.name} - ${ke[u.st]}: open its terminal" aria-label="${k.a.name} - ${ke[u.st]}: open its terminal">${Ke(k.a)}</button>`)}</span>`)}</span>${l}</div>`}function Je(e){return e.toLowerCase().trim().replace(/[^a-z0-9/._-]+/g,"-").replace(/\.{2,}/g,".").replace(/\/{2,}/g,"/").replace(/(^|\/)[-.]+/g,"$1").slice(0,60).replace(/[-./]+(\/|$)/g,"$1").replace(/\/$/,"").replace(/\.lock(\/|$)/g,"-lock$1")}var yn=(e)=>e.includes("\\")?"\\":"/";async function Y(e,t){try{let n=await fetch(e,t?{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}:void 0),a=await n.json().catch(()=>({}));return{ok:n.ok,d:n.ok?a:{error:a.error||a.why||"that did not work"}}}catch{return{ok:!1,d:{error:"kaizen is offline"}}}}function fe(e={}){let t=$e(""),n=t.querySelector("form");t.setAttribute("aria-label","Add a project");let a=e.start==="ws",s=(o)=>n.elements.namedItem(o),r=(o,c,p,b)=>(o.disabled=c,o.textContent=c?p:b),l=a?"":w`<button type="button" class="btn ghost" data-a="back">Back to add options</button>`,i=(o)=>w`<small class="att err" role="alert"></small><div class="row">${l}<button type="button" class="btn ghost" data-a="x">Cancel</button><button class="btn pri" data-a="go">${o}</button></div>`,u=(o)=>n.querySelector(".err").textContent=o,k=(o,c)=>{u(c);try{localStorage.setItem("kz-proj",o)}catch{}setTimeout(()=>location.href="/",900)},L=async(o,c)=>{let p=await Y("/pick-folder",{});if(p.d.path)o.value=c?p.d.path.replace(/[\\/]+$/,"")+yn(p.d.path)+c():p.d.path},f=(o)=>{let c=jt();if(t.classList.toggle("wsnew",o==="ws"),o==="menu")n.innerHTML=w`<b>Add a project</b><small class="att">Add a project to get started with kaizen.</small><button type="button" class="btn opt" data-go="folder"><b>Existing folder</b><small>A project, a Git repo, or any folder</small></button><small class="att">Other ways to add</small><button type="button" class="btn opt" data-go="clone"><b>Clone from URL</b><small>Clone a remote Git repository</small></button><button type="button" class="btn opt" data-go="create"><b>Create new project</b><small>Start from an empty folder</small></button>${c.length?w`<button type="button" class="btn opt" data-go="ws"><b>New workspace</b><small>A branch in its own folder, in a project you have</small></button>`:""}<div class="row"><button type="button" class="btn ghost" data-a="x">Cancel</button></div>`.toString(),n.querySelectorAll("[data-go]").forEach((b)=>b.onclick=()=>f(b.dataset.go)),n.onsubmit=(b)=>b.preventDefault();else if(o==="folder")n.innerHTML=w`<b>Existing folder</b><small class="att">Pick a folder, or type its path. A .kaizen folder is added to it.</small><div class="row"><input name="path" placeholder="/path/to/folder" aria-label="Folder" autocomplete="off" spellcheck="false" required><button type="button" class="btn ghost" data-a="pick">Pick…</button></div>${i("Add project")}`.toString(),s("path").focus(),n.onsubmit=async(b)=>{b.preventDefault();let v=n.querySelector("[data-a=go]");r(v,!0,"Adding...","Add project");let y=await Y("/add-project",{path:s("path").value.trim()});r(v,!1,"","Add project"),y.ok?k(y.d.dir,y.d.already?"Project already added":"Project added"):u(y.d.error)},n.querySelector("[data-a=pick]").onclick=()=>L(s("path"));else if(o==="clone"){n.innerHTML=w`<b>Clone from URL</b><small class="att">Enter the Git URL (https or ssh) and choose where to clone it.</small><input name="url" placeholder="https://github.com/user/repo.git" aria-label="Git URL" autocomplete="off" spellcheck="false" required><div class="row"><input name="to" placeholder="Folder to clone into" aria-label="Clone into" autocomplete="off" spellcheck="false"><button type="button" class="btn ghost" data-a="pick">Pick…</button></div>${i("Clone")}`.toString(),s("url").focus();let b="",v="",y=async()=>{let C=s("url").value.trim();if(!C)return!1;let x=await Y("/clone",{url:C,check:!0});if(!x.ok)return u(x.d.error),!1;if(u(""),b=x.d.name,!s("to").value.trim()||s("to").value===v)s("to").value=v=x.d.to;return!0};s("url").onchange=y,n.querySelector("[data-a=pick]").onclick=async()=>await y()?L(s("to"),()=>b):s("url").focus(),n.onsubmit=async(C)=>{if(C.preventDefault(),!await y())return;let x=n.querySelector("[data-a=go]");r(x,!0,"Cloning...","Clone");let E=await Y("/clone",{url:s("url").value.trim(),to:s("to").value.trim()||void 0});r(x,!1,"","Clone"),E.ok?k(E.d.dir,"Cloned"):u(E.d.error)}}else if(o==="create"){n.innerHTML=w`<b>Create a new project</b><small class="att">Name it and kaizen will create the folder with a .kaizen inside.</small><input name="name" placeholder="my-project" aria-label="Name" autocomplete="off" spellcheck="false" required><div class="row"><input name="to" placeholder="Folder to create" aria-label="Create in" autocomplete="off" spellcheck="false"><button type="button" class="btn ghost" data-a="pick">Pick…</button></div><label class="att"><input type="checkbox" name="git" checked> Git repository</label>${i("Create project")}`.toString(),s("name").focus();let b="";s("name").oninput=async()=>{let v=s("name").value.trim();if(!v||/[\\/:*?"<>|]/.test(v)||s("to").value.trim()&&s("to").value!==b)return;let y=await Y("/new-project",{name:v,check:!0});if(y.ok&&s("name").value.trim()===v)s("to").value=b=y.d.to},n.querySelector("[data-a=pick]").onclick=()=>L(s("to"),()=>s("name").value.trim()),n.onsubmit=async(v)=>{v.preventDefault();let y=n.querySelector("[data-a=go]");r(y,!0,"Creating...","Create project");let C=await Y("/new-project",{name:s("name").value.trim(),to:s("to").value.trim()||void 0,git:s("git").checked});if(r(y,!1,"","Create project"),!C.ok)return u(C.d.error);k(C.d.dir,C.d.git===!1?"Project created, but git init failed":"Project created")}}else{let b=c.some((x)=>x.dir===e.dir)?e.dir:c[0]?.dir,v=/Mac/.test(navigator.platform)?"⌘":"Ctrl";n.innerHTML=w`<b>New workspace</b><label class="att">Project<select name="project" aria-label="Project">${c.map((x)=>w`<option value="${x.dir}"${x.dir===b?" selected":""}>${x.name}</option>`)}</select></label><div class="wsfrom"><span class="att" id="wsfl">Create from <i>[Optional]</i></span><label class="wsbase">from <select name="base" aria-label="Start from branch"></select></label></div><input name="name" placeholder="What is this workspace for?" aria-labelledby="wsfl" autocomplete="off" spellcheck="false"><details class="wsadv"><summary>Advanced</summary><label class="att">Branch name<input name="branch" placeholder="feature/my-branch" aria-label="Branch name" autocomplete="off" spellcheck="false"></label></details><small class="att err" role="alert"></small><div class="row">${l}<button type="button" class="btn ghost" data-a="x">Cancel</button><button class="btn pri" data-a="go">Create workspace</button><kbd class="wskey" aria-hidden="true">${v} ↵</kbd></div>`.toString(),s("name").focus();let y=n.elements.namedItem("base");s("name").oninput=()=>s("branch").placeholder=Je(s("name").value)||"feature/my-branch";let C=async()=>{let x=await Y("/branches?dir="+encodeURIComponent(s("project").value)),{def:E="",branches:U=[]}=x.ok?x.d:{};y.innerHTML=U.map((G)=>w`<option${G===E?" selected":""}>${G}</option>`.toString()).join("")||'<option value="">current branch</option>'};n.elements.namedItem("project").onchange=C,C(),n.onkeydown=(x)=>{if(x.key==="Enter"&&(x.ctrlKey||x.metaKey))x.preventDefault(),n.requestSubmit()},n.onsubmit=async(x)=>{x.preventDefault();let E=s("project").value,U=n.querySelector("[data-a=go]");if(U.disabled)return;u("");let G=s("branch").value.trim()||Je(s("name").value)||"workspace-"+Math.random().toString(36).slice(2,6);r(U,!0,"Creating...","Create workspace");let pe=await Y("/worktree",{dir:E,branch:G,base:y.value||void 0});r(U,!1,"","Create workspace"),pe.ok?(t.close(),location.href=X(E,pe.d.path)):u(pe.d.error)}}n.querySelector("[data-a=x]").onclick=()=>t.close();let p=n.querySelector("[data-a=back]");if(p)p.onclick=()=>f("menu")};f(e.start??"menu")}function Ct(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return e;let a=t.trim().toLowerCase(),s=(r)=>{let l=r.title.toLowerCase();return l.startsWith(a)?0:l.includes(a)?1:2};return e.filter((r)=>{let l=(r.title+" "+(r.sub??"")+" "+r.hay).toLowerCase();return n.every((i)=>l.includes(i))}).sort((r,l)=>s(r)-s(l)||(l.at??0)-(r.at??0))}var Me=(e,t)=>!dispatchEvent(new CustomEvent(e,{cancelable:!0,detail:t})),ne=(e,t)=>()=>{let n=document.querySelector(`.rail a[data-view="${e}"]`);n?n.click():location.href=t},Ht=(e,t)=>{if(!Me("kz-open-ws",{dir:e,ws:t}))location.href=X(e,t)},At=()=>{try{return JSON.parse(localStorage.getItem("kz-runtabs")||"{}")}catch{return{}}},wn=(e,t,n)=>{if(Me("kz-open-tab",{dir:e,ws:t,id:n}))return;let a=At(),s=a[Ve(e,t)],r=s?.screens?.find((l)=>We(l.tree).includes(n));if(r)try{s.on=r.id,localStorage.setItem("kz-runtabs",JSON.stringify(a))}catch{}location.href=X(e,t)},$n=["local","preview","note","history","shell"],kn=(e)=>{try{return localStorage.getItem("kz-browse:"+e)?.replace(/^https?:\/\//,"").replace(/\/$/,"")}catch{}},xn={ws:'<circle cx="6" cy="6" r="2"/><circle cx="6" cy="18" r="2"/><circle cx="18" cy="8" r="2"/><path d="M6 8v8M18 10c0 4-6 3-12 6"/>',run:'<path d="M5 4l14 8-14 8z"/>',idea:'<path d="M9 18h6M10 21h4M12 3a6 6 0 0 0-4 10.5c.7.7 1 1.5 1 2.5h6c0-1 .3-1.8 1-2.5A6 6 0 0 0 12 3z"/>',chat:'<path d="M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z"/>',term:'<path d="M4 17l6-5-6-5M12 19h8"/>',proj:'<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',page:'<rect x="4" y="4" width="16" height="16" rx="2"/><path d="M4 9h16"/>',act:'<path d="M13 3L5 14h6l-1 7 8-11h-6z"/>',tab:'<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 9h8V5"/>',plus:'<path d="M12 5v14M5 12h14"/>',search:'<circle cx="11" cy="11" r="7"/><path d="M20 20l-4-4"/>'},Rt=(e)=>K(`<svg viewBox="0 0 24 24" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${xn[e]}</g></svg>`),Bt=[];function En(){let{cards:e,projects:t=[],agents:n=[]}=Pt(),a=Date.now(),s=new URLSearchParams(location.search),r=s.get("id")&&e.find((o)=>o.kind==="run"&&o.state===s.get("dir")&&o.id===s.get("id")),l=s.get("ws")??(r?de(r,t):null),i=[],u=At(),k=new Map;for(let o of e){let c=o.state+"\x00"+de(o,t);k.set(c,Math.max(k.get(c)??0,o.moved??0))}for(let o of t){let c=z(o.dir,t);for(let p of o.workspaces??[]){let b=s.get("dir")===o.dir&&l===p.path,v=k.get(o.dir+"\x00"+p.path);i.push({group:b?"Current":"Workspaces",title:se(p),sub:c,when:v?te(v,a):void 0,hay:`${se(p)} ${c} ${p.path} workspace`,at:b?1/0:v??0,ico:"ws",act:()=>Ht(o.dir,p.path)});let y=Ve(o.dir,p.path),C=u[y];for(let x of C?.tabs??[]){if(!$n.includes(x.kind)||C.hidden?.includes(x.id))continue;let E=x.kind==="local"&&kn(y)||x.title;i.push({group:"Tabs",title:E,sub:`${se(p)} · ${c}`,hay:`${E} ${x.title} ${x.kind} ${x.note??""} ${se(p)} ${c} tab`,ico:"tab",act:()=>wn(o.dir,p.path,x.id)})}}i.push({group:"Projects",title:c,hay:`${c} ${o.dir} project`,ico:"proj",act:()=>{let p=o.workspaces?.find((b)=>b.main)??o.workspaces?.[0];p?Ht(o.dir,p.path):ne("board","/?view=board")()}})}for(let o of e.filter((c)=>!c.archived)){let c=ae(o);i.push({group:o.kind==="run"?"Runs":"Tasks",title:Ye(o)||o.id,sub:z(o.state,t),when:o.moved?te(o.moved,a):void 0,hay:`${Ye(o)} ${o.id??""} ${o.text??""} ${z(o.state,t)} ${c}`,at:o.moved??0,dot:c,ico:o.kind==="run"?"run":"idea",act:()=>{if(!Me("kz-open-card",{dir:o.state,id:o.kind==="run"?o.id:void 0,text:o.text}))location.href=Nt(o)}})}for(let o of Bt){let c=Date.parse(o.updated)||0;i.push({group:"Chats & terminals",title:o.title||"Chat",sub:o.project?z(o.project,t):void 0,when:c?te(c,a):void 0,hay:`${o.title} chat ${o.project??""}`,at:c,dot:o.busy?"build":void 0,ico:"chat",act:()=>{try{sessionStorage.setItem("kz-chat",o.id)}catch{}ne("home","/")()}})}for(let o of n)i.push({group:"Chats & terminals",title:o.name||o.agent||"Terminal",sub:z(o.dir,t),hay:`${o.name} ${o.agent??""} ${o.run??""} ${o.last??""} ${z(o.dir,t)} terminal agent`,at:o.at??o.born??0,dot:o.asking?"wait":o.busy?"build":"done",ico:"term",act:()=>{if(!Me("kz-open-term",{dir:o.dir,ws:o.ws,key:o.key}))location.href=X(o.dir,o.ws??"")}});let L=(o)=>()=>M(o)?.click(),f=[["Home","page",ne("home","/"),"chat"],["Icebox","page",ne("sources","/?view=icebox"),"requests sources gathered"],["Tasks","page",ne("tasks","/?view=tasks"),"backlog"],["Board","page",ne("board","/?view=board"),"kanban runs"],["Notes","page",()=>location.href="/notebook","notebook docs"],["Settings","page",ne("settings","/?view=settings"),"preferences config"],["New task","act",()=>M("newtop")?M("newtop").click():location.href="/?view=board","create add run"],["Add a project","act",()=>fe({dir:null}),"clone folder create workspace"],["Toggle theme","act",L("themet"),"dark light"],["Collapse or expand menu","act",L("fold"),"sidebar rail"],["Keyboard shortcuts","act",L("kbd"),"keys help"],["Report an issue","act",()=>open("/issue","_blank","noopener"),"bug feedback"]];for(let[o,c,p,b]of f)i.push({group:"Actions",title:o,hay:`${o} ${b??""}`,ico:c,act:p});return i}var Mn=["Current","Workspaces","Tabs","Chats & terminals","Runs","Tasks","Projects","Actions"],Sn={Workspaces:5,Tabs:4,"Chats & terminals":5,Runs:5,Tasks:3,Projects:5},S=null,D=[],O=0;function Ee(){let e=S.querySelector("input").value,t=En(),n=e.trim()?Ct(t,e):t.slice().sort((l,i)=>(i.at??0)-(l.at??0));D=[];let a=e.trim()?[...new Set(n.map((l)=>l.group))]:Mn;for(let l of a){let i=n.filter((u)=>u.group===l);D.push(...i.slice(0,e.trim()?8:Sn[l]??i.length))}if(e.trim())D.push({group:"Create",title:`New task "${e.trim()}"`,hay:"",ico:"plus",act:()=>Ln(e.trim())});O=Math.min(O,D.length-1);let s=S.querySelector(".gs-list"),r="";s.innerHTML=String(w`${D.map((l,i)=>{let u=l.group!==r?(r=l.group,w`<div class="gs-h" role="presentation">${l.group}</div>`):"";return w`${u}<div class="gs-i" role="option" id="gs-${i}" data-n="${i}" aria-selected="${String(i===O)}">${Rt(l.ico)}${l.dot?w`<span class="si ${l.dot}"></span>`:""}<span class="gs-t">${l.title}</span>${l.sub?w`<span class="gs-s">${l.sub}</span>`:""}${l.when?w`<span class="gs-w">${l.when}</span>`:""}</div>`})}${D.length===1&&e.trim()?w`<div class="gs-none">No results</div>`:""}`),Ge(O),S.querySelector(".gs-live").textContent=`${D.length} result${D.length===1?"":"s"} found`}function Ge(e){S.querySelector(`#gs-${O}`)?.setAttribute("aria-selected","false"),O=e;let t=S.querySelector(`#gs-${e}`);t?.setAttribute("aria-selected","true"),S.querySelector("input").setAttribute("aria-activedescendant","gs-"+e),t?.scrollIntoView({block:"nearest"})}function Ln(e){if(!M("newtop"))return void(location.href="/?view=board");M("newtop").click();let t=document.querySelector("dialog[open] textarea");if(t)t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function It(e){let t=D[e];if(!t)return;S.close(),t.act()}function _e(){if(S)return S.querySelector("input").focus();S=document.createElement("dialog"),S.className="gs",S.setAttribute("aria-label","Search"),S.innerHTML=String(w`<div class="gs-box"><div class="gs-q">${Rt("search")}<input type="text" placeholder="Search" aria-label="Search" role="combobox" aria-expanded="true" aria-controls="gs-list" autocomplete="off" spellcheck="false"></div><div class="gs-list" id="gs-list" role="listbox"></div><span class="gs-live" role="status" aria-live="polite"></span></div>`),document.body.append(S);let e=S.querySelector("input");O=0,e.oninput=()=>(O=0,Ee()),e.onkeydown=(n)=>{let a={ArrowDown:1,ArrowUp:-1}[n.key]??(n.ctrlKey&&n.key==="n"?1:n.ctrlKey&&n.key==="p"?-1:0);if(a)n.preventDefault(),Ge((O+a+D.length)%D.length);else if(n.key==="Enter")n.preventDefault(),It(O)};let t=S.querySelector(".gs-list");t.onclick=(n)=>{let a=n.target.closest(".gs-i");if(a)It(+a.dataset.n)},t.onpointermove=(n)=>{let a=n.target.closest(".gs-i");if(a&&+a.dataset.n!==O)Ge(+a.dataset.n)},S.onclick=(n)=>n.target===S&&S.close(),S.onclose=()=>(S.remove(),S=null),S.showModal(),Ee(),fetch("/chats").then((n)=>n.json()).then((n)=>{if(Bt=n.chats??[],S)Ee()}).catch(()=>{})}var Tn=`dialog.gs{border:0;padding:0;margin:14vh auto auto;background:none;width:min(560px,calc(100vw - 32px));color:var(--ink);overflow:visible}
|
|
3
3
|
dialog.gs::backdrop{background:rgb(0 0 0/.35)}
|
|
4
4
|
.gs-box{display:flex;flex-direction:column;max-height:min(480px,72vh);background:var(--bg);border:1px solid var(--line);border-radius:10px;box-shadow:0 16px 40px rgb(0 0 0/.25);overflow:hidden}
|