kaizen-agent 1.81.1 → 1.82.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/accounts.ts +1 -1
- package/cli/add-project.ts +4 -1
- package/cli/computer.ts +2 -2
- package/cli/conpty.ts +9 -4
- package/cli/keep-awake.ts +1 -1
- package/cli/pty.ts +68 -11
- package/cli/settings.ts +2 -2
- package/cli/setup.ts +2 -2
- package/cli/skills.ts +1 -1
- package/cli/state.ts +17 -6
- package/cli/task-service.ts +16 -2
- package/cli/tasks.ts +2 -1
- package/cli/web.ts +7 -1
- package/cli/worktree.ts +28 -2
- package/package.json +1 -1
- package/skills/media/kaizen-video/SKILL.md +2 -0
- package/skills/optional/lemo-opuscar/LICENSE +21 -0
- package/skills/optional/lemo-opuscar/SKILL.md +24 -0
- package/skills/optional/lemo-opuscar/scripts/setup.sh +145 -0
- package/skills/optional/lemo-opuscar/skill.json +1 -0
- package/web/board/settings-skills.ts +6 -1
- package/web/board/task-page.ts +27 -2
- package/web/board/task-results.ts +2 -0
- package/web/board/workspace.ts +49 -20
- package/web/board.html +3 -2
- package/web/board.js +147 -145
- package/web/notebook.js +146 -144
- package/web/notes.html +2 -2
- package/web/term.js +1 -1
- package/web/video.html +2 -2
- package/web/video.js +188 -186
package/cli/accounts.ts
CHANGED
|
@@ -99,7 +99,7 @@ export async function loginStatus(tool: Tool, dir?: string, env: NodeJS.ProcessE
|
|
|
99
99
|
// answer never waits on the pipes past the timeout.
|
|
100
100
|
const late = new Promise<Login>((done) => { timer = setTimeout(() => { try { p?.kill(); } catch { /* gone */ } done(fallback()); }, timeoutMs); });
|
|
101
101
|
const ask = (async (): Promise<Login> => {
|
|
102
|
-
p = Bun.spawn(tool === "claude" ? [bin, "auth", "status", "--json"] : [bin, "login", "status"], { env: e, stdin: "ignore", stdout: "pipe", stderr: "pipe" });
|
|
102
|
+
p = Bun.spawn(tool === "claude" ? [bin, "auth", "status", "--json"] : [bin, "login", "status"], { env: e, stdin: "ignore", stdout: "pipe", stderr: "pipe", windowsHide: true });
|
|
103
103
|
const [out, err] = await Promise.all([new Response(p.stdout as ReadableStream).text(), new Response(p.stderr as ReadableStream).text()]);
|
|
104
104
|
await p.exited;
|
|
105
105
|
return read(out, err);
|
package/cli/add-project.ts
CHANGED
|
@@ -61,8 +61,11 @@ export function destDir(raw: unknown, home: string, known: string[] = [], projec
|
|
|
61
61
|
if (winBad(basename(dir))) return { error: `${basename(dir)} cannot be a folder name on Windows` };
|
|
62
62
|
const under = (r: string) => !!r && (dir === canonPath(r) || dir.startsWith(canonPath(r) + sep));
|
|
63
63
|
if (!under(h) && !under(projects)) return { error: "choose a folder inside your home, or set Settings → Projects folder (board.projects_dir) to allow another place" };
|
|
64
|
+
const proj = projects ? canonPath(projects) : "";
|
|
64
65
|
for (let a = dirname(dir); ; a = dirname(a)) {
|
|
65
|
-
if (known.includes(a)
|
|
66
|
+
if (known.includes(a)) return { error: `that folder is inside the project ${a}` };
|
|
67
|
+
if (a === h || (proj && a === proj)) break;
|
|
68
|
+
if (existsSync(join(a, ".kaizen"))) return { error: `that folder is inside the project ${a}` };
|
|
66
69
|
if (dirname(a) === a) break;
|
|
67
70
|
}
|
|
68
71
|
return { dir };
|
package/cli/computer.ts
CHANGED
|
@@ -42,7 +42,7 @@ export async function computer(argv: string[], o: Opts): Promise<{ out: Record<s
|
|
|
42
42
|
const py = o.cmd ? null : Bun.which("python3");
|
|
43
43
|
if (!o.cmd && !py) return fail("no-python", "python3 not found");
|
|
44
44
|
// Argv only: the model's text reaches the helper as plain arguments, never a shell line.
|
|
45
|
-
const p = Bun.spawn([...(o.cmd ?? [py!, "-I", HELPER]), verb, ...args], { stdin: "ignore", stdout: "pipe", stderr: "ignore", timeout: TIMEOUT });
|
|
45
|
+
const p = Bun.spawn([...(o.cmd ?? [py!, "-I", HELPER]), verb, ...args], { stdin: "ignore", stdout: "pipe", stderr: "ignore", timeout: TIMEOUT, windowsHide: true });
|
|
46
46
|
const text = await new Response(p.stdout).text();
|
|
47
47
|
await p.exited;
|
|
48
48
|
if (p.signalCode) return fail("timeout", "helper timed out");
|
|
@@ -59,7 +59,7 @@ export function computerCheck(cmd?: string[]): { needs: { name: string; found: b
|
|
|
59
59
|
const note = (wayland ? "Wayland: keyboard shortcuts and screenshots are not available. Values, accessibility actions and typing into fields work where the app exposes them. " : "") + "Password managers are blocked by app name only: one in a browser or under another name is not.";
|
|
60
60
|
const py = Bun.which("python3");
|
|
61
61
|
if (!cmd && (process.platform !== "linux" || !py)) return { needs: [{ name: process.platform === "linux" ? "python3" : "Linux", found: false }], note };
|
|
62
|
-
const r = Bun.spawnSync([...(cmd ?? [py!, "-I", HELPER]), "check"], { stdout: "pipe", stderr: "ignore", timeout: 5000 });
|
|
62
|
+
const r = Bun.spawnSync([...(cmd ?? [py!, "-I", HELPER]), "check"], { stdout: "pipe", stderr: "ignore", timeout: 5000, windowsHide: true });
|
|
63
63
|
let c: any = {};
|
|
64
64
|
try { c = JSON.parse(r.stdout.toString()); } catch { /* an unreadable check counts as missing */ }
|
|
65
65
|
return { needs: [{ name: "AT-SPI bindings", found: c.atspi === true }, { name: "accessibility on", found: c.a11y === true }], note };
|
package/cli/conpty.ts
CHANGED
|
@@ -31,8 +31,9 @@ public static class KzPty {
|
|
|
31
31
|
IntPtr sz = IntPtr.Zero;
|
|
32
32
|
InitializeProcThreadAttributeList(IntPtr.Zero, 1, 0, ref sz);
|
|
33
33
|
var si = new STARTUPINFOEX(); si.si.cb = Marshal.SizeOf(typeof(STARTUPINFOEX));
|
|
34
|
-
// STARTF_USESTDHANDLES
|
|
35
|
-
si.si.fl =
|
|
34
|
+
// STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW (SW_HIDE = 0): otherwise the child takes this host's piped stdio or flashes a console window.
|
|
35
|
+
si.si.fl = 0x101;
|
|
36
|
+
si.si.sw = 0;
|
|
36
37
|
si.attrs = Marshal.AllocHGlobal(sz);
|
|
37
38
|
if (!InitializeProcThreadAttributeList(si.attrs, 1, 0, ref sz)
|
|
38
39
|
|| !UpdateProcThreadAttribute(si.attrs, 0, (IntPtr)0x20016, hpc, (IntPtr)IntPtr.Size, IntPtr.Zero, IntPtr.Zero)) return 1;
|
|
@@ -79,7 +80,8 @@ public static class KzPty {
|
|
|
79
80
|
|
|
80
81
|
// The PowerShell that hosts it: the child's command line, size and directory come in
|
|
81
82
|
// through the environment, so nothing the agent is given passes through a quoting layer.
|
|
82
|
-
const SCRIPT =
|
|
83
|
+
const SCRIPT = `$ProgressPreference = 'SilentlyContinue'
|
|
84
|
+
Add-Type -TypeDefinition @'
|
|
83
85
|
${HOST}
|
|
84
86
|
'@
|
|
85
87
|
Set-Location -LiteralPath $env:KZ_PTY_CWD
|
|
@@ -92,8 +94,11 @@ export const resizeSeq = (cols: number, rows: number) => `\x1b]kzr;${cols};${row
|
|
|
92
94
|
// The command line the pseudo console starts: PowerShell running cmd. It finds .cmd
|
|
93
95
|
// shims (npm installs claude as one), which CreateProcess alone does not, and takes
|
|
94
96
|
// the arguments as -EncodedCommand, as findTerminal does, so newlines survive.
|
|
97
|
+
// Windows PowerShell 5.1 strips unescaped `"` when building the Win32 command line for
|
|
98
|
+
// native executables, so embedded double quotes are escaped for non-.ps1 targets.
|
|
95
99
|
export function innerCommand(shell: string, cmd: string[]): string {
|
|
96
|
-
const
|
|
100
|
+
const ps1 = /\.ps1$/i.test(cmd[0] ?? "");
|
|
101
|
+
const q = (a: string, i: number) => `'${(i > 0 && !ps1 ? a.replace(/"/g, '\\"') : a).replace(/'/g, "''")}'`;
|
|
97
102
|
const enc = Buffer.from(`& ${cmd.map(q).join(" ")}`, "utf16le").toString("base64");
|
|
98
103
|
return `"${shell}" -NoProfile -ExecutionPolicy Bypass -EncodedCommand ${enc}`;
|
|
99
104
|
}
|
package/cli/keep-awake.ts
CHANGED
|
@@ -10,7 +10,7 @@ export function inhibitArgv(platform = process.platform as string, pid = process
|
|
|
10
10
|
|
|
11
11
|
export const wantAwake = (mode: string, agentsRunning: boolean) => mode === "on" || (mode === "auto" && agentsRunning);
|
|
12
12
|
|
|
13
|
-
export function awakeHolder(start: (argv: string[]) => { kill: () => void; exited?: Promise<unknown> } = (a) => Bun.spawn(a, { stdin: "ignore", stdout: "ignore", stderr: "ignore" }), argv = inhibitArgv()) {
|
|
13
|
+
export function awakeHolder(start: (argv: string[]) => { kill: () => void; exited?: Promise<unknown> } = (a) => Bun.spawn(a, { stdin: "ignore", stdout: "ignore", stderr: "ignore", windowsHide: true }), argv = inhibitArgv()) {
|
|
14
14
|
let held: { kill: () => void } | null = null;
|
|
15
15
|
const stop = () => { held?.kill(); held = null; };
|
|
16
16
|
return {
|
package/cli/pty.ts
CHANGED
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
// They live in this process: the board stopping ends them, as closing a terminal
|
|
4
4
|
// window ends the agent in it. Bun has no pseudo-terminal on Windows; there the
|
|
5
5
|
// agent runs under a ConPTY host (conpty.ts) spoken to over pipes.
|
|
6
|
-
import { writeFileSync } from "node:fs";
|
|
6
|
+
import { existsSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { homedir } from "node:os";
|
|
7
8
|
import { join } from "node:path";
|
|
8
9
|
import { conptyHost, innerCommand, resizeSeq } from "./conpty.ts";
|
|
9
10
|
|
|
10
11
|
const WIN = process.platform === "win32";
|
|
11
12
|
// Windows PowerShell, which every Windows has, both hosts the console and runs the agent in it.
|
|
12
13
|
const winPs = () => join(process.env.SystemRoot ?? "C:\\Windows", "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
14
|
+
const killWinTree = (pid: number) => {
|
|
15
|
+
try { Bun.spawnSync([join(process.env.SystemRoot ?? "C:\\Windows", "System32", "taskkill.exe"), "/T", "/F", "/PID", String(pid)], { stdin: "ignore", stdout: "ignore", stderr: "ignore", timeout: 3000, windowsHide: true }); } catch { /* already gone */ }
|
|
16
|
+
};
|
|
13
17
|
|
|
14
18
|
type Pty = { lastOut?: number; proc: Bun.Subprocess; out: string[]; size: number; listeners: Set<(d: string | null) => void>; exit: number | null; asking: boolean; busy: boolean; quiet?: Timer; total: number; since: number; onChange?: () => void; tmux?: string; last: string; lastAt: number; typedAt: number; born: number; draft?: boolean };
|
|
15
19
|
|
|
@@ -24,6 +28,18 @@ const ptys = new Map<string, Pty>();
|
|
|
24
28
|
// A board started from a colourless place (an agent's shell, CI) carries NO_COLOR; its terminals show colour anyway.
|
|
25
29
|
export const colorEnv = (env: Record<string, string | undefined> = process.env) => { const { NO_COLOR: _, ...rest } = env; return rest; };
|
|
26
30
|
|
|
31
|
+
// On Windows, background update checks spawned by CLI agents (like agy's background updater or Claude's)
|
|
32
|
+
// are console executables; if detached or spawned without CREATE_NO_WINDOW by the agent runtime, Windows 11
|
|
33
|
+
// delegates them to Windows Terminal, which briefly flashes an unwanted terminal window.
|
|
34
|
+
export const defaultChildEnv = (env: Record<string, string | undefined> = process.env) => ({
|
|
35
|
+
...colorEnv(env),
|
|
36
|
+
...(WIN ? {
|
|
37
|
+
AGY_CLI_DISABLE_AUTO_UPDATE: "1",
|
|
38
|
+
CLAUDE_CODE_DISABLE_AUTO_UPDATER: "1",
|
|
39
|
+
DISABLE_AUTO_UPDATER: "1",
|
|
40
|
+
} : {}),
|
|
41
|
+
});
|
|
42
|
+
|
|
27
43
|
// What the sidebar shows for an agent: the latest line the agent printed. Keystrokes are never kept,
|
|
28
44
|
// and nothing is read while a question is open or within ECHO_MS of a keystroke: a terminal echoes
|
|
29
45
|
// what is typed, so that line could be a password. Memory only.
|
|
@@ -126,7 +142,7 @@ export function startPty(key: string, cmd: string[], cwd: string, pidFile?: stri
|
|
|
126
142
|
const ps = winPs();
|
|
127
143
|
p.proc = Bun.spawn([ps, "-NoProfile", "-NonInteractive", "-EncodedCommand", conptyHost()], {
|
|
128
144
|
cwd,
|
|
129
|
-
env: { ...
|
|
145
|
+
env: { ...defaultChildEnv(), ...opts.env, KAIZEN_BOARD_PID: String(process.pid), KZ_PTY_CMD: innerCommand(ps, cmd), KZ_PTY_CWD: cwd, KZ_PTY_COLS: "120", KZ_PTY_ROWS: "32" },
|
|
130
146
|
stdin: "pipe", stdout: "pipe", stderr: "pipe", windowsHide: true,
|
|
131
147
|
});
|
|
132
148
|
const read = async (s: ReadableStream<Uint8Array>) => {
|
|
@@ -134,11 +150,25 @@ export function startPty(key: string, cmd: string[], cwd: string, pidFile?: stri
|
|
|
134
150
|
for await (const c of s) push(d.decode(c, { stream: true }));
|
|
135
151
|
};
|
|
136
152
|
read(p.proc.stdout as ReadableStream<Uint8Array>).catch(() => {});
|
|
137
|
-
// The host's own failures (Add-Type, CreateProcess) land on the screen, not nowhere
|
|
138
|
-
|
|
153
|
+
// The host's own failures (Add-Type, CreateProcess) land on the screen, not nowhere;
|
|
154
|
+
// strip PowerShell's `#< CLIXML ... </Objs>` progress records when stderr is piped.
|
|
155
|
+
(async (s: ReadableStream<Uint8Array>) => {
|
|
156
|
+
const d = new TextDecoder();
|
|
157
|
+
let xml = "";
|
|
158
|
+
for await (const c of s) {
|
|
159
|
+
const t = xml + d.decode(c, { stream: true });
|
|
160
|
+
if (t.startsWith("#< CLIXML") || xml) {
|
|
161
|
+
const end = t.lastIndexOf("</Objs>");
|
|
162
|
+
if (end < 0) { xml = t; continue; }
|
|
163
|
+
xml = "";
|
|
164
|
+
const rest = t.slice(end + 7).replace(/^[\r\n]+/, "");
|
|
165
|
+
if (rest) push(rest);
|
|
166
|
+
} else push(t);
|
|
167
|
+
}
|
|
168
|
+
})(p.proc.stderr as ReadableStream<Uint8Array>).catch(() => {});
|
|
139
169
|
} else p.proc = Bun.spawn(cmd, {
|
|
140
170
|
cwd,
|
|
141
|
-
env: { ...
|
|
171
|
+
env: { ...defaultChildEnv(), ...opts.env, TERM: "xterm-256color", COLORTERM: "truecolor", KAIZEN_BOARD_PID: String(process.pid) },
|
|
142
172
|
terminal: { cols: 120, rows: 32, data: (_t, d) => push(dec.decode(d, { stream: true })) },
|
|
143
173
|
});
|
|
144
174
|
if (opts.tmux && tmuxOk()) p.tmux = opts.tmux;
|
|
@@ -168,7 +198,8 @@ export function startPty(key: string, cmd: string[], cwd: string, pidFile?: stri
|
|
|
168
198
|
// What the agent started and left behind (a test run, a dev server) goes with it. The
|
|
169
199
|
// pty made it a session and group leader, so its group id is its PID; a tmux client's
|
|
170
200
|
// group holds only the client, never the tmux server the agent runs under.
|
|
171
|
-
if (
|
|
201
|
+
if (WIN) killWinTree(p.proc.pid);
|
|
202
|
+
else { try { process.kill(-p.proc.pid, "SIGTERM"); } catch { /* group already empty */ } }
|
|
172
203
|
// Dropped: pages showing it (the Terminal page) refresh, or its tile lingers until some other change.
|
|
173
204
|
setTimeout(() => { if (ptys.get(key) === p) { ptys.delete(key); onChange?.(); } }, KEEP_MS).unref();
|
|
174
205
|
onChange?.();
|
|
@@ -248,7 +279,7 @@ export function exitPty(key: string, grace = 5000): boolean {
|
|
|
248
279
|
send(p, "\x1b");
|
|
249
280
|
setTimeout(() => send(p, "/exit\r"), 100);
|
|
250
281
|
setTimeout(() => {
|
|
251
|
-
if (p.exit === null) { if (WIN) p.proc.kill(); else { try { process.kill(-p.proc.pid, "SIGKILL"); } catch { p.proc.kill(); } } }
|
|
282
|
+
if (p.exit === null) { if (WIN) { killWinTree(p.proc.pid); p.proc.kill(); } else { try { process.kill(-p.proc.pid, "SIGKILL"); } catch { p.proc.kill(); } } }
|
|
252
283
|
if (p.tmux) killTmux(p.tmux);
|
|
253
284
|
}, grace).unref();
|
|
254
285
|
return true;
|
|
@@ -260,7 +291,7 @@ export function killPty(key: string): boolean {
|
|
|
260
291
|
const p = ptys.get(key);
|
|
261
292
|
if (!p || p.exit !== null) return false;
|
|
262
293
|
if (p.tmux) killTmux(p.tmux);
|
|
263
|
-
if (WIN) p.proc.kill();
|
|
294
|
+
if (WIN) { killWinTree(p.proc.pid); p.proc.kill(); }
|
|
264
295
|
else { try { process.kill(-p.proc.pid, "SIGKILL"); } catch { p.proc.kill(); } }
|
|
265
296
|
return true;
|
|
266
297
|
}
|
|
@@ -306,7 +337,7 @@ export const scopeCmd = () => {
|
|
|
306
337
|
if (scoped) return scoped;
|
|
307
338
|
const run = process.platform === "linux" ? Bun.which("systemd-run") : null;
|
|
308
339
|
const cmd = run ? [run, "--user", "--scope", "--quiet", "--collect"] : [];
|
|
309
|
-
try { scoped = run && Bun.spawnSync([...cmd, "true"], { stdin: "ignore", stdout: "ignore", stderr: "ignore", timeout: 3000 }).exitCode === 0 ? cmd : []; } catch { scoped = []; }
|
|
340
|
+
try { scoped = run && Bun.spawnSync([...cmd, "true"], { stdin: "ignore", stdout: "ignore", stderr: "ignore", timeout: 3000, windowsHide: true }).exitCode === 0 ? cmd : []; } catch { scoped = []; }
|
|
310
341
|
return scoped;
|
|
311
342
|
};
|
|
312
343
|
// tmux draws on the alternate screen, which has no scrollback, so the card could not scroll
|
|
@@ -323,12 +354,12 @@ export const tmuxCmd = (name: string, cmd: string[]) => [...scopeCmd(), tmuxBin(
|
|
|
323
354
|
export const attachCmd = (name: string) => [tmuxBin()!, ...TMUX, "attach-session", "-t", name];
|
|
324
355
|
const tmux = (...a: string[]) => {
|
|
325
356
|
const bin = tmuxBin();
|
|
326
|
-
try { return !!bin && Bun.spawnSync([bin, ...TMUX, ...a], { stdin: "ignore", stdout: "ignore", stderr: "ignore", timeout: 3000 }).exitCode === 0; } catch { return false; }
|
|
357
|
+
try { return !!bin && Bun.spawnSync([bin, ...TMUX, ...a], { stdin: "ignore", stdout: "ignore", stderr: "ignore", timeout: 3000, windowsHide: true }).exitCode === 0; } catch { return false; }
|
|
327
358
|
};
|
|
328
359
|
export const tmuxAlive = (name: string) => tmux("has-session", "-t", `=${name}`);
|
|
329
360
|
export const panePid = (name: string): number | null => {
|
|
330
361
|
const bin = tmuxBin();
|
|
331
|
-
try { return bin ? Number(Bun.spawnSync([bin, ...TMUX, "display-message", "-p", "-t", `=${name}:`, "#{pane_pid}"], { stdin: "ignore", stderr: "ignore", timeout: 3000 }).stdout.toString().trim()) || null : null; } catch { return null; }
|
|
362
|
+
try { return bin ? Number(Bun.spawnSync([bin, ...TMUX, "display-message", "-p", "-t", `=${name}:`, "#{pane_pid}"], { stdin: "ignore", stderr: "ignore", timeout: 3000, windowsHide: true }).stdout.toString().trim()) || null : null; } catch { return null; }
|
|
332
363
|
};
|
|
333
364
|
export const killTmux = (name: string) => tmux("kill-session", "-t", `=${name}`);
|
|
334
365
|
|
|
@@ -373,7 +404,33 @@ export function loginEnv(shell = process.env.SHELL): Record<string, string> | nu
|
|
|
373
404
|
// entries are appended after the board's own. What the board was started with wins
|
|
374
405
|
// everywhere, so a variable or PATH set on the command line is never overridden.
|
|
375
406
|
// SIGKILL above: a shell stopped by job control ignores the timeout's SIGTERM.
|
|
407
|
+
const origWhich = Bun.which.bind(Bun);
|
|
376
408
|
export function adoptLoginEnv(env = loginEnv()) {
|
|
409
|
+
if (WIN && !env) {
|
|
410
|
+
const reg = join(process.env.SystemRoot ?? "C:\\Windows", "System32", "reg.exe");
|
|
411
|
+
const regPath = (key: string) => {
|
|
412
|
+
try {
|
|
413
|
+
const out = Bun.spawnSync([reg, "query", key, "/v", "Path"], { stdin: "ignore", stdout: "pipe", stderr: "ignore", timeout: 2000, windowsHide: true }).stdout.toString();
|
|
414
|
+
const m = /^\s*Path\s+REG_(?:EXPAND_)?SZ\s+(.+)$/im.exec(out);
|
|
415
|
+
return m ? m[1]!.trim().replace(/%([^%]+)%/g, (_, k) => process.env[k] ?? _) : "";
|
|
416
|
+
} catch { return ""; }
|
|
417
|
+
};
|
|
418
|
+
const pf = process.env["ProgramFiles"] ?? "C:\\Program Files", pfx86 = process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)", h = homedir();
|
|
419
|
+
const local = process.env.LOCALAPPDATA ?? join(h, "AppData", "Local"), roam = process.env.APPDATA ?? join(h, "AppData", "Roaming");
|
|
420
|
+
const extra = [
|
|
421
|
+
...regPath("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment").split(";"),
|
|
422
|
+
...regPath("HKCU\\Environment").split(";"),
|
|
423
|
+
join(local, "agy", "bin"), join(h, ".local", "bin"), join(roam, "npm"),
|
|
424
|
+
join(pf, "Git", "cmd"), join(pf, "Git", "bin"), join(pfx86, "Git", "cmd"), join(pfx86, "Git", "bin"),
|
|
425
|
+
join(local, "Programs", "Git", "cmd"), join(local, "Programs", "MinGit", "cmd"),
|
|
426
|
+
].map((d) => d.trim()).filter((d) => d && existsSync(d));
|
|
427
|
+
const cur = (process.env.PATH ?? process.env.Path ?? "").split(";").map((d) => d.trim()).filter(Boolean);
|
|
428
|
+
const seen = new Set(cur.map((d) => d.toLowerCase()));
|
|
429
|
+
for (const d of extra) if (!seen.has(d.toLowerCase())) { seen.add(d.toLowerCase()); cur.push(d); }
|
|
430
|
+
process.env.PATH = process.env.Path = cur.join(";");
|
|
431
|
+
Bun.which = ((bin: string, opts?: Parameters<typeof Bun.which>[1]) => origWhich(bin, { PATH: process.env.PATH ?? process.env.Path, ...opts })) as typeof Bun.which;
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
377
434
|
if (!env) return;
|
|
378
435
|
// The shell's own bookkeeping describes that shell, not this process.
|
|
379
436
|
for (const [k, v] of Object.entries(env)) if (process.env[k] === undefined && !["PWD", "OLDPWD", "SHLVL", "_"].includes(k)) process.env[k] = v;
|
package/cli/settings.ts
CHANGED
|
@@ -452,8 +452,8 @@ export async function settings(repoRoot: string, standalone = true) {
|
|
|
452
452
|
// project that has not written one of its own is edited globally, so one setting
|
|
453
453
|
// changed in ~/.kaizen/config.yml reaches every project.
|
|
454
454
|
function locate() {
|
|
455
|
-
|
|
456
|
-
for (
|
|
455
|
+
const h = homedir();
|
|
456
|
+
for (let dir = process.cwd(); dir !== h; ) {
|
|
457
457
|
const conf = join(dir, ".kaizen", "config.yml");
|
|
458
458
|
if (existsSync(conf)) return conf;
|
|
459
459
|
if (existsSync(join(dir, ".git"))) break;
|
package/cli/setup.ts
CHANGED
|
@@ -59,7 +59,7 @@ export async function setup(ui: Ui) {
|
|
|
59
59
|
const project = projectStep(process.cwd(), home);
|
|
60
60
|
const needsProject = !(project && "ready" in project);
|
|
61
61
|
const tailnetNow = () => {
|
|
62
|
-
try { return tailnetName(Bun.spawnSync(["tailscale", "status", "--json"]).stdout.toString()); } catch { return null; /* not installed */ }
|
|
62
|
+
try { return tailnetName(Bun.spawnSync(["tailscale", "status", "--json"], { windowsHide: true }).stdout.toString()); } catch { return null; /* not installed */ }
|
|
63
63
|
};
|
|
64
64
|
let tailnet = tailnetNow();
|
|
65
65
|
const total = 3 + (needsProject ? 1 : 0);
|
|
@@ -69,7 +69,7 @@ export async function setup(ui: Ui) {
|
|
|
69
69
|
out(`\n ${c.bold("kaizen setup")} ${c.dim("Press Enter to take the first choice. Nothing changes without an answer.")}`);
|
|
70
70
|
|
|
71
71
|
const initProject = (dir: string) => {
|
|
72
|
-
const r = Bun.spawnSync([process.execPath, INSTALL, "--yes", "--init-project"], { cwd: dir });
|
|
72
|
+
const r = Bun.spawnSync([process.execPath, INSTALL, "--yes", "--init-project"], { cwd: dir, windowsHide: true });
|
|
73
73
|
if (r.exitCode === 0 && existsSync(join(dir, ".kaizen"))) { remember(dir); out(` ${c.green("+")} ${dir} is ready`); }
|
|
74
74
|
else out(` ${c.dim(`Could not set up ${dir}. Run kaizen setup from inside it to try again.`)}`);
|
|
75
75
|
};
|
package/cli/skills.ts
CHANGED
|
@@ -114,7 +114,7 @@ export function setSkill(repo: string, home: string, id: string, on: boolean, co
|
|
|
114
114
|
for (const h of SKILL_HOMES) {
|
|
115
115
|
if (!existsSync(join(home, h.dir))) continue;
|
|
116
116
|
const dir = join(home, h.dir, "skills"), p = join(dir, id);
|
|
117
|
-
if (!on) { if (ours(p, skill.rel)) unlinkSync(p); continue; }
|
|
117
|
+
if (!on) { if (ours(p, skill.rel)) { try { unlinkSync(p); } catch { rmdirSync(p); } } continue; }
|
|
118
118
|
if (existsSync(p) || isLink(p)) continue;
|
|
119
119
|
mkdirSync(dir, { recursive: true });
|
|
120
120
|
symlinkSync(join(clone, "skills", skill.rel), p, process.platform === "win32" ? "junction" : undefined);
|
package/cli/state.ts
CHANGED
|
@@ -234,13 +234,14 @@ export function findTerminal(cwd: string, fullCmd: string[], pidFile?: string):
|
|
|
234
234
|
// own arguments on -- neither survives as a plain -Command string. Windows
|
|
235
235
|
// Terminal hosts the shell when installed; otherwise `start` gives it a window.
|
|
236
236
|
if (process.platform === "win32") {
|
|
237
|
-
const
|
|
237
|
+
const ps1 = /\.ps1$/i.test(fullCmd[0] ?? "");
|
|
238
|
+
const q = (a: string, i = 0) => `'${(i > 0 && !ps1 ? a.replace(/"/g, '\\"') : a).replace(/'/g, "''")}'`;
|
|
238
239
|
const shell = powershellExe();
|
|
239
240
|
// This PowerShell's PID: ending its tree closes the -NoExit tab or window.
|
|
240
241
|
// The pid file gone after the agent means closeSessions ended it: exit 0, which closes
|
|
241
242
|
// the tab (Windows Terminal keeps one open after a non-zero exit). An agent that ends
|
|
242
243
|
// by itself leaves the window open, -NoExit, so what it printed can still be read.
|
|
243
|
-
const ps = `${pidFile ? `$PID | Set-Content -LiteralPath ${q(pidFile)}; ` : ""}Set-Location ${q(cwd)}; & ${fullCmd.map(q).join(" ")}${pidFile ? `; if (-not (Test-Path -LiteralPath ${q(pidFile)})) { exit 0 }` : ""}`;
|
|
244
|
+
const ps = `${pidFile ? `$PID | Set-Content -LiteralPath ${q(pidFile)}; ` : ""}Set-Location ${q(cwd)}; & ${fullCmd.map((a, i) => q(a, i)).join(" ")}${pidFile ? `; if (-not (Test-Path -LiteralPath ${q(pidFile)})) { exit 0 }` : ""}`;
|
|
244
245
|
const enc = Buffer.from(ps, "utf16le").toString("base64");
|
|
245
246
|
// herdr (beta on Windows) first, as elsewhere: a new tab, and the run typed into
|
|
246
247
|
// its PowerShell. Typed text ends at a newline, so what is typed is one line, the
|
|
@@ -1870,12 +1871,19 @@ export function launchRun(it: Item, from: string, run?: string, pick: { agent?:
|
|
|
1870
1871
|
const vars = [...(pick.task ? [`KAIZEN_TASK_ID=${pick.task.id}`] : []), ...(run ? [`KAIZEN_RUN_ID=${run}`, ...stageEnv(projectDir, run)] : []), ...subagentEnv(projectDir, agent.cmd), ...accountEnv(acct)];
|
|
1871
1872
|
const identity = vars.length && process.platform !== "win32" ? ["env", ...vars] : [];
|
|
1872
1873
|
const started = [...identity, ...withEnv(s.fullCmd, agent.cmd, prefs)];
|
|
1874
|
+
const winEnv = process.platform === "win32" ? {
|
|
1875
|
+
AGY_CLI_DISABLE_AUTO_UPDATE: "1",
|
|
1876
|
+
CLAUDE_CODE_DISABLE_AUTO_UPDATER: "1",
|
|
1877
|
+
DISABLE_AUTO_UPDATER: "1",
|
|
1878
|
+
...(prefs.agents[agent.cmd]?.env ?? {}),
|
|
1879
|
+
...Object.fromEntries(vars.map((kv) => { const eq = kv.indexOf("="); return [kv.slice(0, eq), kv.slice(eq + 1)]; })),
|
|
1880
|
+
} : undefined;
|
|
1873
1881
|
const drop = () => { if (s.record) rmSync(s.record, { force: true }); };
|
|
1874
1882
|
|
|
1875
1883
|
if (pick.card && ptySupported) {
|
|
1876
1884
|
const key = s.key ?? `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
1877
1885
|
try {
|
|
1878
|
-
startPty(key, started, projectDir, s.pidFile, pick.onChange, { seed: pick.seed, tmux: keepAlive(projectDir) === "tmux" ? tmuxName(key) : undefined });
|
|
1886
|
+
startPty(key, started, projectDir, s.pidFile, pick.onChange, { seed: pick.seed, tmux: keepAlive(projectDir) === "tmux" ? tmuxName(key) : undefined, env: winEnv });
|
|
1879
1887
|
return { ok: true, agent, prompt, projectDir, cmd: s.fullCmd, pty: key };
|
|
1880
1888
|
} catch (err: any) {
|
|
1881
1889
|
drop();
|
|
@@ -1900,8 +1908,9 @@ export function launchRun(it: Item, from: string, run?: string, pick: { agent?:
|
|
|
1900
1908
|
stderr: "ignore",
|
|
1901
1909
|
detached: term.detached,
|
|
1902
1910
|
// A detached launch is the terminal window itself; anything else (herdr's
|
|
1903
|
-
// launcher
|
|
1904
|
-
|
|
1911
|
+
// launcher, or `cmd.exe /c start` which opens its own PowerShell window and exits)
|
|
1912
|
+
// is plumbing, and must not flash a console on Windows.
|
|
1913
|
+
windowsHide: !term.detached || (process.platform === "win32" && /cmd\.exe$/i.test(term.cmd[0] ?? "")),
|
|
1905
1914
|
});
|
|
1906
1915
|
if (term.detached) proc.unref();
|
|
1907
1916
|
return { ok: true, agent, prompt, projectDir, cmd: term.cmd };
|
|
@@ -1915,7 +1924,9 @@ export function launchRun(it: Item, from: string, run?: string, pick: { agent?:
|
|
|
1915
1924
|
export async function pidOnPort(port: number): Promise<number | null> {
|
|
1916
1925
|
try {
|
|
1917
1926
|
if (process.platform === "win32") {
|
|
1918
|
-
const
|
|
1927
|
+
const p = Bun.spawn([sysExe("netstat.exe"), "-ano", "-p", "tcp"], { stdin: "ignore", stdout: "pipe", stderr: "ignore", windowsHide: true });
|
|
1928
|
+
const out = await new Response(p.stdout).text();
|
|
1929
|
+
await p.exited;
|
|
1919
1930
|
const m = new RegExp(`127\\.0\\.0\\.1:${port}\\s+\\S+\\s+LISTENING\\s+(\\d+)`).exec(out);
|
|
1920
1931
|
return m ? Number(m[1]) : null;
|
|
1921
1932
|
}
|
package/cli/task-service.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { join, dirname } from 'node:path';
|
|
|
6
6
|
import * as T from './tasks.ts';
|
|
7
7
|
import * as R from './task-results.ts';
|
|
8
8
|
import { read as scalar } from './config-values.ts';
|
|
9
|
-
import { detectDefaultAgent, home, readInbox, readRuns, readText, saveAttachment, acceptance, gateOf } from './state.ts';
|
|
9
|
+
import { detectDefaultAgent, home, readInbox, writeInbox, replaceTask, abandonRun, setArchived, readRuns, readText, saveAttachment, acceptance, gateOf } from './state.ts';
|
|
10
10
|
|
|
11
11
|
type Hooks = { launch: (state:string, run:string, text:string, task:T.Task, pick?:any) => {ok:boolean; pty?:string; why?:string}; alive:(pty:string)=>boolean; stop:(pty:string)=>boolean };
|
|
12
12
|
const runtimeLaunches = new Set<string>();
|
|
@@ -24,7 +24,7 @@ export function taskView(state:string,task:T.Task) {
|
|
|
24
24
|
return {...task,activeRun:finished&&['ready','accepted'].includes(task.status)?null:task.activeRun,projectName:task.project?.split(/[\\/]/).pop()??'Choose a project',dir:state,updatedAt:task.updated,attention:{category:p.filter,reason:p.reason,action:p.action},statusLabel:p.label,decision:!task.project?{id:'project',kind:'project',text:'Choose a named project for your saved goal.'}:task.pendingDecision,messages:task.events,runs:task.runIds,currentResultId:task.currentResult,acceptedResultId:task.acceptedResult};
|
|
25
25
|
}
|
|
26
26
|
export function taskList(states:string[],hooks?:Hooks) {
|
|
27
|
-
const tasks=states.flatMap(state=>T.listTasks(state).map(t=>taskView(state,reconcile(state,t,hooks))));
|
|
27
|
+
const tasks=states.flatMap(state=>T.listTasks(state).filter(t=>!t.archived).map(t=>taskView(state,reconcile(state,t,hooks))));
|
|
28
28
|
// Legacy rows become durable only when opened. Stable keys include stamps/index,
|
|
29
29
|
// never a title-based merge; existing inbox and run files are left intact.
|
|
30
30
|
for(const state of states) {
|
|
@@ -118,6 +118,20 @@ export function taskAction(state:string,body:any,hooks:Hooks):{state:string;task
|
|
|
118
118
|
const mutation={revision:Number(body.revision),opId:operationId};
|
|
119
119
|
if(task.operations.includes(operationId))return {state,task};
|
|
120
120
|
if(op==='start'){task=T.mutateTask(state,task.id,mutation,t=>{if(t.status!=='draft')throw new T.TaskError('Task already started');});return {state,task:dispatchReady(state,task.id,hooks,true,body.pick&&typeof body.pick==='object'?body.pick:undefined)};}
|
|
121
|
+
if(op==='delete'||op==='archive'||op==='abandon'){
|
|
122
|
+
// Closing a task: Delete only before any run exists; Archive hides it; Abandon ends its run.
|
|
123
|
+
if(op==='delete'){
|
|
124
|
+
if(task.runIds.length||task.activeRun)throw new T.TaskError('A run already started. Archive or abandon it instead.');
|
|
125
|
+
replaceTask(state,task.goal,null);T.deleteTask(state,task.id);return {state,task};
|
|
126
|
+
}
|
|
127
|
+
if(op==='abandon'){
|
|
128
|
+
if(!task.activeRun)throw new T.TaskError('No run to abandon');
|
|
129
|
+
const key=task.launch?.pty;if(key&&hooks.alive(key))hooks.stop(key);
|
|
130
|
+
const bad=abandonRun(state,task.activeRun,String(body.why??'').trim()||'abandoned from the task page');if(bad)throw new T.TaskError(bad);
|
|
131
|
+
}else if(task.activeRun)setArchived(state,task.activeRun,true);
|
|
132
|
+
else{const lines=readInbox(state),at=lines.findIndex(l=>l.status==='open'&&l.text===task.goal);if(at>=0){lines[at]={...lines[at]!,status:'archived'};writeInbox(state,lines);}}
|
|
133
|
+
return {state,task:T.mutateTask(state,task.id,mutation,t=>{t.archived=true;})};
|
|
134
|
+
}
|
|
121
135
|
task=T.mutateTask(state,task.id,mutation,t=>{
|
|
122
136
|
if(op==='message'){
|
|
123
137
|
const text=String(body.text??'').trim();const status=body.intent==='question'||/^\s*(status\??|what(?:'s| is) (?:the )?(?:status|progress)\??|how (?:is|are) (?:it|things|the task) (?:going|doing)\??)\s*$/i.test(text);
|
package/cli/tasks.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type Task = {
|
|
|
15
15
|
runIds: string[]; activeRun: string | null; currentResult: string | null; acceptedResult: string | null;
|
|
16
16
|
pendingDecision: TaskDecision | null; inputs: TaskInput[]; events: TaskEvent[]; operations: string[];
|
|
17
17
|
files: { name: string; path: string }[]; launch: TaskLaunch | null; safe: boolean; queuePaused: boolean;
|
|
18
|
-
initialConfirmed: boolean; writePhase: boolean; error?: string; legacyKey?: string; alias?: { state: string; id: string };
|
|
18
|
+
initialConfirmed: boolean; writePhase: boolean; error?: string; legacyKey?: string; archived?: boolean; alias?: { state: string; id: string };
|
|
19
19
|
};
|
|
20
20
|
export type Mutation = { revision: number; opId: string };
|
|
21
21
|
export class TaskError extends Error { constructor(message: string, public status = 409) { super(message); } }
|
|
@@ -77,6 +77,7 @@ export function resolveTask(state: string, id: string): { state: string; task: T
|
|
|
77
77
|
export function listTasks(state: string): Task[] {
|
|
78
78
|
try { return readdirSync(join(state, "tasks")).filter(taskId).map((id) => readTask(state, id)).filter((t): t is Task => !!t && !t.alias).sort((a, b) => taskProjection(a).rank - taskProjection(b).rank || b.updated - a.updated); } catch { return []; }
|
|
79
79
|
}
|
|
80
|
+
export function deleteTask(state: string, id: string) { rmSync(taskDir(state, id), { recursive: true, force: true }); }
|
|
80
81
|
export type NewTask = { goal: string; title?: string; project?: string | null; files?: Task["files"] };
|
|
81
82
|
export function createTask(state: string, input: NewTask, opId?: string): Task {
|
|
82
83
|
if (!input.goal?.trim()) throw new TaskError("Describe what you want to make", 400);
|
package/cli/web.ts
CHANGED
|
@@ -1077,7 +1077,13 @@ export async function web(repoDir: string, opts: Opts = {}) {
|
|
|
1077
1077
|
const key = "sh-" + crypto.randomUUID().slice(0, 8);
|
|
1078
1078
|
const title = dev ? "dev server" : agent ? KNOWN_AGENTS.find((k) => k.cmd === agent)!.name + (bypass ? " · bypass" : "") : "shell";
|
|
1079
1079
|
// A dev server it starts lets a phone in: Vite refuses a host it does not know (the tailnet name).
|
|
1080
|
-
const pid = startPty(key, cmd, cwd, undefined, changed, {
|
|
1080
|
+
const pid = startPty(key, cmd, cwd, undefined, changed, {
|
|
1081
|
+
env: {
|
|
1082
|
+
KAIZEN_TERM: key,
|
|
1083
|
+
...(process.platform === "win32" ? { AGY_CLI_DISABLE_AUTO_UPDATE: "1", CLAUDE_CODE_DISABLE_AUTO_UPDATER: "1", DISABLE_AUTO_UPDATER: "1" } : {}),
|
|
1084
|
+
...(dev ? { __VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS: ".ts.net" } : {}),
|
|
1085
|
+
},
|
|
1086
|
+
});
|
|
1081
1087
|
// The run workspace that opened it (its card key), so each run keeps its own centre.
|
|
1082
1088
|
shells.set(key, { key, dir, title, agent, run: runKey, ws: cwd, pid });
|
|
1083
1089
|
shellCmd.set(key, cmd);
|
package/cli/worktree.ts
CHANGED
|
@@ -10,7 +10,33 @@ export type Out = { ok: boolean; out: string; why: string };
|
|
|
10
10
|
export type Run = (cmd: string[], cwd: string, ms?: number) => Out;
|
|
11
11
|
|
|
12
12
|
const SLUG = /^\d{4}-\d{2}-\d{2}-[a-z0-9][a-z0-9-]*$/;
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
if (process.platform === "win32") {
|
|
15
|
+
const progFiles = process.env["ProgramFiles"] ?? "C:\\Program Files";
|
|
16
|
+
const progFilesX86 = process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)";
|
|
17
|
+
const gitDirs = [
|
|
18
|
+
join(progFiles, "Git", "cmd"),
|
|
19
|
+
join(progFiles, "Git", "bin"),
|
|
20
|
+
join(progFiles, "Git", "usr", "bin"),
|
|
21
|
+
join(progFilesX86, "Git", "cmd"),
|
|
22
|
+
join(progFilesX86, "Git", "bin"),
|
|
23
|
+
join(progFilesX86, "Git", "usr", "bin"),
|
|
24
|
+
join(homedir(), "AppData", "Local", "Programs", "Git", "cmd"),
|
|
25
|
+
join(homedir(), "AppData", "Local", "Programs", "MinGit", "cmd"),
|
|
26
|
+
dirname(process.execPath),
|
|
27
|
+
].filter((p) => existsSync(p));
|
|
28
|
+
if (gitDirs.length > 0) {
|
|
29
|
+
const cur = process.env.PATH ?? process.env.Path ?? "";
|
|
30
|
+
const toAdd = gitDirs.filter((d) => !cur.toLowerCase().includes(d.toLowerCase())).join(";");
|
|
31
|
+
if (toAdd) {
|
|
32
|
+
const full = `${toAdd};${cur}`;
|
|
33
|
+
process.env.PATH = full;
|
|
34
|
+
process.env.Path = full;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const env = { ...process.env, GIT_TERMINAL_PROMPT: "0", GIT_EDITOR: "true" };
|
|
14
40
|
|
|
15
41
|
export const run: Run = (cmd, cwd, ms = 120_000) => {
|
|
16
42
|
try {
|
|
@@ -128,7 +154,7 @@ const readGit = (text: string, key: string) => {
|
|
|
128
154
|
// A command run through `sh -c`: a project's config.yml that git tracks came with a clone, so it may not set one.
|
|
129
155
|
const COMMAND_KEYS = new Set(["land_check", "rebuild_on_land"]);
|
|
130
156
|
const tracked = (project: string, f: string) => {
|
|
131
|
-
try { return Bun.spawnSync(["git", "-C", project, "ls-files", "--error-unmatch", f], { stdout: "ignore", stderr: "ignore", windowsHide: true }).exitCode === 0; } catch { return false; }
|
|
157
|
+
try { return Bun.spawnSync(["git", "-C", project, "ls-files", "--error-unmatch", f], { env, stdout: "ignore", stderr: "ignore", windowsHide: true }).exitCode === 0; } catch { return false; }
|
|
132
158
|
};
|
|
133
159
|
const gitSetting = (project: string, key: string, fallback: string) => {
|
|
134
160
|
for (const f of [join(project, ".kaizen", "config.yml"), join(homedir(), ".kaizen", "config.yml")]) {
|
package/package.json
CHANGED
|
@@ -84,6 +84,8 @@ the whole video and spot-checking the cut edges.
|
|
|
84
84
|
|
|
85
85
|
# From scratch
|
|
86
86
|
|
|
87
|
+
**A named art style** (oil painting, watercolor, ukiyo-e, satellite briefing, exploded teardown and the rest of the Lemo-Opuscar library)? That is the optional `lemo-opuscar` skill, off until the user turns it on in Settings → Skills: when it is on, use it for that film (it downloads its own style library from GitHub on first use). When it is off, say so in one line and offer the film presets below.
|
|
88
|
+
|
|
87
89
|
A film is data in `videos/<name>/`: `film.json` (storyboard, brand, `format` `"9x16"`, `"16x9"` or `"4x5"` (Instagram feed), `preset` (a film preset, or any footage preset such as `tiktok-explainer`: see *Crossing over* in `references/presets.md`), `style` (overrides of the preset's style.json), `hook` (for a footage preset), and `platforms`, which the Video page in `kaizen web` keeps), `lines.json` (narration with emotion tags), `words.json` (word timings, generated), `inputs/` (the user's material), voice files `vNN.mp3`. `S=<this skill>/scripts`, run from the project folder. Worked example: [`examples/sample-film/`](examples/sample-film/). Run `$S/check.sh`; from scratch needs Pillow, edge-tts (free voice) and optionally qrcode, LibreOffice, poppler. No WhisperX.
|
|
88
90
|
|
|
89
91
|
**Camera moves (`film-explainer-canvas`):** for an explainer that pans, zooms and follows things across one canvas,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LemoLab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lemo-opuscar
|
|
3
|
+
description: Direct and produce a short film made entirely in code, in one of the styles of the Lemo-Opuscar library (e.g. Impasto Oil Painting 油画厚涂, Watercolor Brush 水彩笔刷, Ukiyo-e 浮世绘, Satellite Briefing 卫星简报, Exploded Teardown 产品拆解). Use when the user asks for a video, film, short, promo, explainer or animation (视频、短片、动画、宣传片) in a named style, including explainers built from real material such as satellite imagery, laser scans, CAD files or archive scans (数据解说、科普、产品拆解), and new films cut from real archive footage and documents (剪辑与纪实, e.g. 用档案影像剪一支新闻片); when they want a film about their own topic and haven't chosen a style (help them choose); when they want to change a style into their own, make their own style from a blank page, or use a style they saved (改风格、从空白开始、我的风格); when they start the skill without saying what they want; or when they ask which film styles there are. Not for plain editing, trimming or converting the user's existing video files.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Lemo-Opuscar
|
|
7
|
+
|
|
8
|
+
The styles, guides and tools live in the Lemo-Opuscar library (github.com/lemomo-ai/lemo-opuscar). This skill fetches it and hands you over to it.
|
|
9
|
+
|
|
10
|
+
1. **Get the library.** Run `sh "<skill base directory>/scripts/setup.sh"`. It clones or updates the library (default `~/lemo-opuscar`; a clone the user is standing in is used as it is) and prints `LIB=<path>` on its last line.
|
|
11
|
+
2. **Install the core tools early.** Start `sh "<skill base directory>/scripts/setup.sh" deps` right away, in the background if you can: it takes a few minutes the first time. Add `deps voice` or `deps music` later, only if the film needs them (`$LIB/TECHNIQUE.md` §1). Report missing system tools (Node, ffmpeg, Python) in your one round of questions; don't install system software yourself. Packages a style needs (its `STYLE.md` lists them) you install yourself, into the project folder.
|
|
12
|
+
3. **Follow the library.** Read `$LIB/AGENTS.md` and do what it says, starting with **Start** (the user's own styles in `~/lemo-my-styles/`; when they started the skill without writing anything, the language question first, then the ways in): finding the style or making their own, the one round of questions, the treatment, production and delivery.
|
|
13
|
+
|
|
14
|
+
What changes in skill mode:
|
|
15
|
+
|
|
16
|
+
| | |
|
|
17
|
+
|---|---|
|
|
18
|
+
| Project folder | `<name>/` in the folder the user started from (lowercase letters, digits, hyphens; avoid `#` and `?` in the path). Wherever the guides say `films/<name>/`, read this folder |
|
|
19
|
+
| Running tools | from `$LIB`, with the project's absolute path: `cd "$LIB" && node core/render/still.mjs "<project>" 1.5 3` |
|
|
20
|
+
| Library files in pages | absolute URLs: `/core/lib.js`, `/node_modules/three/…` (the project is served at `/@film/`) |
|
|
21
|
+
| Library files in scripts and `build.sh` | `$LIB/…`, with `LIB=<path>` at the top of `build.sh`; never `../..` |
|
|
22
|
+
| Demo source | not downloaded. `sh "<skill base directory>/scripts/setup.sh" demo <slug>`, only after your `TREATMENT.md` is written, to read its techniques; it is not meant to be rendered. An Edit & Documentary style is the exception: fetch it before the treatment to use the material tools its `STYLE.md` names in `demo/tools/` (`$LIB/AGENTS.md`, "Treatment first") |
|
|
23
|
+
|
|
24
|
+
Deliver what `$LIB/DIRECTOR.md` §11 lists, in the project folder, and tell the user where it is.
|