@hyperwindmill/caretaker-cli 0.12.2 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/cli/web/scheduler/task_review.d.ts +6 -0
  2. package/dist/cli/web/scheduler/task_review.d.ts.map +1 -1
  3. package/dist/cli/web/scheduler/task_review.js +22 -5
  4. package/dist/cli/web/scheduler/task_roles.d.ts +6 -0
  5. package/dist/cli/web/scheduler/task_roles.d.ts.map +1 -1
  6. package/dist/cli/web/scheduler/task_roles.js +9 -0
  7. package/dist/cli/web/scheduler/task_strategy.d.ts.map +1 -1
  8. package/dist/cli/web/scheduler/task_strategy.js +114 -11
  9. package/dist/cli/web/server.d.ts.map +1 -1
  10. package/dist/cli/web/server.js +15 -1
  11. package/dist/harness/claude_code_runner.d.ts +5 -0
  12. package/dist/harness/claude_code_runner.d.ts.map +1 -1
  13. package/dist/harness/claude_code_runner.js +17 -0
  14. package/dist/harness/loop.d.ts +2 -0
  15. package/dist/harness/loop.d.ts.map +1 -1
  16. package/dist/harness/loop.js +1 -0
  17. package/dist/harness/tools/builtin/bash.d.ts.map +1 -1
  18. package/dist/harness/tools/builtin/bash.js +18 -9
  19. package/dist/harness/tools/builtin/task_tools.d.ts.map +1 -1
  20. package/dist/harness/tools/builtin/task_tools.js +13 -0
  21. package/dist/harness/tools/types.d.ts +4 -0
  22. package/dist/harness/tools/types.d.ts.map +1 -1
  23. package/dist/lib/docker.d.ts +43 -0
  24. package/dist/lib/docker.d.ts.map +1 -0
  25. package/dist/lib/docker.js +160 -0
  26. package/dist/lib/task_git.d.ts +9 -1
  27. package/dist/lib/task_git.d.ts.map +1 -1
  28. package/dist/lib/task_git.js +24 -1
  29. package/dist/store/db.d.ts +3 -0
  30. package/dist/store/db.d.ts.map +1 -1
  31. package/dist/webview/standalone.js +64 -7
  32. package/dist/webview/standalone.js.map +2 -2
  33. package/package.json +3 -3
@@ -1 +1 @@
1
- {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
1
+ /** Deterministic container name for a task — the caller's naming policy. */
2
+ export declare function containerName(projectId: number, taskId: number): string;
3
+ /** `docker run` argv. Mount is identical-path (`-v <root>:<root>`) so host and
4
+ * container agree on absolute paths. `--user` keeps written files owned by the
5
+ * host user (else root-owned files break the host WIP commit / review diff).
6
+ * ponytail: if an image lacks a matching /etc/passwd entry, set HOME=/tmp; tune when a real image needs it. */
7
+ export declare function containerRunArgs(name: string, image: string, mountRoot: string, workdir: string, uid?: number, gid?: number, extraMounts?: string[]): string[];
8
+ export declare function containerExecArgs(name: string, cwd: string, cmd: string): string[];
9
+ /** Idempotent: reuse a running container of this name; recreate a stopped/absent one. */
10
+ export declare function ensureContainer(name: string, image: string, mountRoot: string, workdir: string, extraMounts?: string[]): Promise<void>;
11
+ /** True if `git` is on PATH inside the container. In-container git is
12
+ * best-effort — a minimal image may not ship it; the harness commits
13
+ * host-side regardless, so a missing git only affects the agent's own git
14
+ * commands (we warn it via the prompt). */
15
+ export declare function containerHasGit(name: string): Promise<boolean>;
16
+ /** Run one command in the container. Never throws on a non-zero exit — returns
17
+ * the code + combined output, mirroring the bash tool's contract. */
18
+ export declare function execInContainer(name: string, cwd: string, cmd: string, timeoutMs: number, signal?: AbortSignal): Promise<{
19
+ exitCode: number;
20
+ output: string;
21
+ }>;
22
+ export declare function removeContainer(name: string): Promise<void>;
23
+ /** True if a container of this name is currently running. */
24
+ export declare function containerRunning(name: string): Promise<boolean>;
25
+ /** True when the dockerImage value is a Dockerfile path rather than a pullable
26
+ * image ref. Image refs never start with '.', '/', or '\', so a leading one of
27
+ * those unambiguously marks a path (relative `./Dockerfile`, absolute, Windows). */
28
+ export declare function isDockerfilePath(image: string): boolean;
29
+ /** Build an image from a Dockerfile into `tag`. `contextDir` is the build
30
+ * context. Throws with the build output on failure so the caller can surface
31
+ * why setup broke (same policy as a failed bootstrap). */
32
+ export declare function buildImage(dockerfilePath: string, contextDir: string, tag: string): Promise<void>;
33
+ export declare const DOCKER_BASH_HOOK_SCRIPT = "let raw = '';\nprocess.stdin.on('data', (c) => { raw += c; });\nprocess.stdin.on('end', () => {\n const [container, workdir] = process.argv.slice(2);\n let cmd = '';\n try { cmd = JSON.parse(raw)?.tool_input?.command ?? ''; } catch { cmd = ''; }\n const b64 = Buffer.from(cmd, 'utf8').toString('base64');\n const wrapped = `docker exec -w ${workdir} ${container} sh -lc \"echo ${b64} | base64 -d | sh\"`;\n process.stdout.write(JSON.stringify({\n hookSpecificOutput: { hookEventName: 'PreToolUse', updatedInput: { command: wrapped } },\n }));\n});\n";
34
+ export declare function dockerClaudeSettings(container: string, workdir: string, hookScriptPath: string): Record<string, unknown>;
35
+ /** Confine claude-code file tools to the working dir. Bash is allowed (the docker
36
+ * hook contains it); readers/writers are path-scoped to workdir; mcp__task stays
37
+ * open. NOTE: Claude Code's Read/Edit/Write rule syntax uses `//path` for an
38
+ * ABSOLUTE path and `/path` for project-relative. `workdir` is absolute (leads
39
+ * with `/`), so the rule must be `//<workdir>/**` — hence the extra leading `/`.
40
+ * With a single slash the rule is read as project-relative, matches nothing, and
41
+ * `--permission-mode manual` then denies every file-tool call (even in-workspace). */
42
+ export declare function dockerDevAllowlist(workdir: string): string[];
43
+ //# sourceMappingURL=docker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../src/lib/docker.ts"],"names":[],"mappings":"AASA,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED;;;gHAGgH;AAChH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,EACZ,WAAW,GAAE,MAAM,EAAO,GACzB,MAAM,EAAE,CAWV;AAED,wBAAgB,iBAAiB,CAAC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;;;;;;uFAMuF;AACvF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAY5D"}
@@ -0,0 +1,160 @@
1
+ // Task-agnostic Docker container primitives. The container NAME is always a
2
+ // parameter — this module knows nothing about tasks/projects, so a future
3
+ // agent-level isolation can reuse it with a different naming scheme + mount.
4
+ import { execFile } from 'node:child_process';
5
+ import { promisify } from 'node:util';
6
+ import { commandEnv } from '../harness/tools/builtin/shell-env.js';
7
+ const exec = promisify(execFile);
8
+ /** Deterministic container name for a task — the caller's naming policy. */
9
+ export function containerName(projectId, taskId) {
10
+ return `caretaker-task-${projectId}-${taskId}`;
11
+ }
12
+ /** `docker run` argv. Mount is identical-path (`-v <root>:<root>`) so host and
13
+ * container agree on absolute paths. `--user` keeps written files owned by the
14
+ * host user (else root-owned files break the host WIP commit / review diff).
15
+ * ponytail: if an image lacks a matching /etc/passwd entry, set HOME=/tmp; tune when a real image needs it. */
16
+ export function containerRunArgs(name, image, mountRoot, workdir, uid, gid, extraMounts = []) {
17
+ const args = ['run', '-d'];
18
+ if (typeof uid === 'number' && typeof gid === 'number') {
19
+ args.push('--user', `${uid}:${gid}`);
20
+ }
21
+ args.push('-v', `${mountRoot}:${mountRoot}`);
22
+ // Extra identical-path mounts (e.g. the git common dir, so a linked
23
+ // worktree's gitdir resolves and in-container git works).
24
+ for (const m of extraMounts)
25
+ args.push('-v', `${m}:${m}`);
26
+ args.push('-w', workdir, '--name', name, image, 'sleep', 'infinity');
27
+ return args;
28
+ }
29
+ export function containerExecArgs(name, cwd, cmd) {
30
+ return ['exec', '-w', cwd, name, 'sh', '-lc', cmd];
31
+ }
32
+ /** Returns 'running' | 'stopped' | 'absent' for a container name. */
33
+ async function containerState(name) {
34
+ try {
35
+ const { stdout } = await exec('docker', ['inspect', '-f', '{{.State.Running}}', name], {
36
+ env: commandEnv(),
37
+ });
38
+ return stdout.trim() === 'true' ? 'running' : 'stopped';
39
+ }
40
+ catch {
41
+ return 'absent';
42
+ }
43
+ }
44
+ /** Idempotent: reuse a running container of this name; recreate a stopped/absent one. */
45
+ export async function ensureContainer(name, image, mountRoot, workdir, extraMounts = []) {
46
+ const state = await containerState(name);
47
+ if (state === 'running')
48
+ return;
49
+ if (state === 'stopped')
50
+ await removeContainer(name);
51
+ const uid = process.getuid?.();
52
+ const gid = process.getgid?.();
53
+ await exec('docker', containerRunArgs(name, image, mountRoot, workdir, uid, gid, extraMounts), {
54
+ env: commandEnv(),
55
+ maxBuffer: 8 * 1024 * 1024,
56
+ });
57
+ }
58
+ /** True if `git` is on PATH inside the container. In-container git is
59
+ * best-effort — a minimal image may not ship it; the harness commits
60
+ * host-side regardless, so a missing git only affects the agent's own git
61
+ * commands (we warn it via the prompt). */
62
+ export async function containerHasGit(name) {
63
+ const { exitCode } = await execInContainer(name, '/', 'command -v git', 5000);
64
+ return exitCode === 0;
65
+ }
66
+ /** Run one command in the container. Never throws on a non-zero exit — returns
67
+ * the code + combined output, mirroring the bash tool's contract. */
68
+ export async function execInContainer(name, cwd, cmd, timeoutMs, signal) {
69
+ try {
70
+ const { stdout, stderr } = await exec('docker', containerExecArgs(name, cwd, cmd), {
71
+ env: commandEnv(),
72
+ timeout: timeoutMs,
73
+ maxBuffer: 32 * 1024 * 1024,
74
+ signal,
75
+ });
76
+ return { exitCode: 0, output: stdout + stderr };
77
+ }
78
+ catch (err) {
79
+ const e = err;
80
+ const code = typeof e.code === 'number' ? e.code : 1;
81
+ return { exitCode: code, output: (e.stdout ?? '') + (e.stderr ?? '') + (e.message ?? '') };
82
+ }
83
+ }
84
+ export async function removeContainer(name) {
85
+ await exec('docker', ['rm', '-f', name], { env: commandEnv() }).catch(() => { });
86
+ }
87
+ /** True if a container of this name is currently running. */
88
+ export async function containerRunning(name) {
89
+ return (await containerState(name)) === 'running';
90
+ }
91
+ /** True when the dockerImage value is a Dockerfile path rather than a pullable
92
+ * image ref. Image refs never start with '.', '/', or '\', so a leading one of
93
+ * those unambiguously marks a path (relative `./Dockerfile`, absolute, Windows). */
94
+ export function isDockerfilePath(image) {
95
+ return /^[./\\]/.test(image);
96
+ }
97
+ /** Build an image from a Dockerfile into `tag`. `contextDir` is the build
98
+ * context. Throws with the build output on failure so the caller can surface
99
+ * why setup broke (same policy as a failed bootstrap). */
100
+ export async function buildImage(dockerfilePath, contextDir, tag) {
101
+ try {
102
+ await exec('docker', ['build', '-f', dockerfilePath, '-t', tag, contextDir], {
103
+ env: commandEnv(),
104
+ maxBuffer: 64 * 1024 * 1024,
105
+ });
106
+ }
107
+ catch (err) {
108
+ const e = err;
109
+ const detail = (e.stderr || e.stdout || e.message || '').toString().trim();
110
+ throw new Error(`docker build failed for \`${dockerfilePath}\`:\n${detail}`);
111
+ }
112
+ }
113
+ // PreToolUse hook: rewrite every Bash command so it runs inside the container.
114
+ // Mechanical (not a prompt instruction) — the agent cannot forget. argv:
115
+ // [container, workdir]. base64 dodges nested-quote hell in the wrapped command.
116
+ export const DOCKER_BASH_HOOK_SCRIPT = `let raw = '';
117
+ process.stdin.on('data', (c) => { raw += c; });
118
+ process.stdin.on('end', () => {
119
+ const [container, workdir] = process.argv.slice(2);
120
+ let cmd = '';
121
+ try { cmd = JSON.parse(raw)?.tool_input?.command ?? ''; } catch { cmd = ''; }
122
+ const b64 = Buffer.from(cmd, 'utf8').toString('base64');
123
+ const wrapped = \`docker exec -w \${workdir} \${container} sh -lc "echo \${b64} | base64 -d | sh"\`;
124
+ process.stdout.write(JSON.stringify({
125
+ hookSpecificOutput: { hookEventName: 'PreToolUse', updatedInput: { command: wrapped } },
126
+ }));
127
+ });
128
+ `;
129
+ export function dockerClaudeSettings(container, workdir, hookScriptPath) {
130
+ return {
131
+ hooks: {
132
+ PreToolUse: [
133
+ {
134
+ matcher: 'Bash',
135
+ hooks: [{ type: 'command', command: `node ${hookScriptPath} ${container} ${workdir}` }],
136
+ },
137
+ ],
138
+ },
139
+ };
140
+ }
141
+ /** Confine claude-code file tools to the working dir. Bash is allowed (the docker
142
+ * hook contains it); readers/writers are path-scoped to workdir; mcp__task stays
143
+ * open. NOTE: Claude Code's Read/Edit/Write rule syntax uses `//path` for an
144
+ * ABSOLUTE path and `/path` for project-relative. `workdir` is absolute (leads
145
+ * with `/`), so the rule must be `//<workdir>/**` — hence the extra leading `/`.
146
+ * With a single slash the rule is read as project-relative, matches nothing, and
147
+ * `--permission-mode manual` then denies every file-tool call (even in-workspace). */
148
+ export function dockerDevAllowlist(workdir) {
149
+ const scope = `/${workdir}/**`; // workdir starts with '/', so this yields '//<abs>/**'
150
+ return [
151
+ `Read(${scope})`,
152
+ `Edit(${scope})`,
153
+ `Write(${scope})`,
154
+ `MultiEdit(${scope})`,
155
+ 'Glob',
156
+ 'Grep',
157
+ 'mcp__task',
158
+ 'Bash',
159
+ ];
160
+ }
@@ -1,4 +1,12 @@
1
1
  export declare function isGitRepo(dir: string): Promise<boolean>;
2
+ /**
3
+ * Absolute git common dir for a (linked) worktree — the main repo's shared
4
+ * `.git`, which holds the object store and `worktrees/<id>`. A worktree's own
5
+ * `.git` file points inside here, so mounting this path into a container (at
6
+ * an identical path) is what makes in-container git resolve. Returns null when
7
+ * it can't be determined (e.g. not a git dir).
8
+ */
9
+ export declare function gitCommonDir(worktreePath: string): Promise<string | null>;
2
10
  export declare function agentDirIn(worktreePath: string, projectWorkingDir: string): Promise<string>;
3
11
  export declare function ensureWorktree(projectWorkingDir: string, projectId: number, taskId: number, title: string): Promise<{
4
12
  branch: string;
@@ -12,7 +20,7 @@ export declare function ensureWorktree(projectWorkingDir: string, projectId: num
12
20
  * generous timeout so a hung install can't wedge the scheduler tick.
13
21
  * ponytail: 10-min per-command timeout; make it configurable if a real project needs longer.
14
22
  */
15
- export declare function runBootstrap(cwd: string, commands: string[]): Promise<void>;
23
+ export declare function runBootstrap(cwd: string, commands: string[], dockerContainer?: string): Promise<void>;
16
24
  export declare function commitWip(worktreePath: string, title: string): Promise<boolean>;
17
25
  export declare function finalizeDone(worktreePath: string): Promise<void>;
18
26
  export declare function discardWorktree(worktreePath: string, title: string): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"task_git.d.ts","sourceRoot":"","sources":["../../src/lib/task_git.ts"],"names":[],"mappings":"AAmBA,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAM7D;AAgBD,wBAAsB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKjG;AAED,wBAAsB,cAAc,CAClC,iBAAiB,EAAE,MAAM,EACzB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC,CAe5E;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBjF;AAcD,wBAAsB,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAcrF;AAED,wBAAsB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBtE;AAED,wBAAsB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGxF"}
1
+ {"version":3,"file":"task_git.d.ts","sourceRoot":"","sources":["../../src/lib/task_git.ts"],"names":[],"mappings":"AAoBA,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAM7D;AAgBD;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAM/E;AAED,wBAAsB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKjG;AAED,wBAAsB,cAAc,CAClC,iBAAiB,EAAE,MAAM,EACzB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC,CAe5E;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAAE,EAClB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAwBf;AAcD,wBAAsB,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAcrF;AAED,wBAAsB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBtE;AAED,wBAAsB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGxF"}
@@ -4,6 +4,7 @@ import { rm } from 'node:fs/promises';
4
4
  import { join, relative, dirname } from 'node:path';
5
5
  import { dataDir } from '../store/db.js';
6
6
  import { commandEnv } from '../harness/tools/builtin/shell-env.js';
7
+ import { execInContainer } from './docker.js';
7
8
  const exec = promisify(execFile);
8
9
  const execShell = promisify(execCb);
9
10
  async function git(cwd, args) {
@@ -32,6 +33,21 @@ function slug(title) {
32
33
  function worktreePathFor(projectId, taskId) {
33
34
  return join(dataDir(), 'worktrees', `${projectId}-${taskId}`);
34
35
  }
36
+ /**
37
+ * Absolute git common dir for a (linked) worktree — the main repo's shared
38
+ * `.git`, which holds the object store and `worktrees/<id>`. A worktree's own
39
+ * `.git` file points inside here, so mounting this path into a container (at
40
+ * an identical path) is what makes in-container git resolve. Returns null when
41
+ * it can't be determined (e.g. not a git dir).
42
+ */
43
+ export async function gitCommonDir(worktreePath) {
44
+ try {
45
+ return await git(worktreePath, ['rev-parse', '--path-format=absolute', '--git-common-dir']);
46
+ }
47
+ catch {
48
+ return null;
49
+ }
50
+ }
35
51
  export async function agentDirIn(worktreePath, projectWorkingDir) {
36
52
  // Preserve a sub-directory working dir when the project points below the repo root.
37
53
  const repoRoot = await git(projectWorkingDir, ['rev-parse', '--show-toplevel']);
@@ -60,11 +76,18 @@ export async function ensureWorktree(projectWorkingDir, projectId, taskId, title
60
76
  * generous timeout so a hung install can't wedge the scheduler tick.
61
77
  * ponytail: 10-min per-command timeout; make it configurable if a real project needs longer.
62
78
  */
63
- export async function runBootstrap(cwd, commands) {
79
+ export async function runBootstrap(cwd, commands, dockerContainer) {
64
80
  for (const command of commands) {
65
81
  const cmd = command.trim();
66
82
  if (!cmd)
67
83
  continue;
84
+ if (dockerContainer) {
85
+ const { exitCode, output } = await execInContainer(dockerContainer, cwd, cmd, 10 * 60 * 1000);
86
+ if (exitCode !== 0) {
87
+ throw new Error(`Bootstrap command failed: \`${cmd}\`\n${output.trim()}`);
88
+ }
89
+ continue;
90
+ }
68
91
  try {
69
92
  await execShell(cmd, {
70
93
  cwd,
@@ -40,6 +40,9 @@ export interface Task {
40
40
  sddEnabled?: boolean | null;
41
41
  /** Per-invocation wall-clock budget (seconds). Inherits from the project; unset = default. */
42
42
  maxRunSeconds?: number | null;
43
+ /** Name of the docker container isolating this task's runs (set when the
44
+ * project has a dockerImage). Parallel to branch/worktreePath. */
45
+ dockerContainer?: string | null;
43
46
  createdAt: string;
44
47
  updatedAt: string;
45
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/store/db.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB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AwB,CAC5C,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CAUf;AAID,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9D"}
@@ -16151,6 +16151,7 @@ ${text}</tr>
16151
16151
  const [sddEnabled, setSddEnabled] = (0, import_react7.useState)(null);
16152
16152
  const [bootstrapText, setBootstrapText] = (0, import_react7.useState)("");
16153
16153
  const [maxRunSecondsText, setMaxRunSecondsText] = (0, import_react7.useState)("");
16154
+ const [dockerImage, setDockerImage] = (0, import_react7.useState)("");
16154
16155
  const [errorMsg, setErrorMsg] = (0, import_react7.useState)(null);
16155
16156
  const projects = config.projects || [];
16156
16157
  const startEdit = (proj) => {
@@ -16167,6 +16168,7 @@ ${text}</tr>
16167
16168
  setSddEnabled(proj.sddEnabled !== void 0 ? proj.sddEnabled : null);
16168
16169
  setBootstrapText((proj.bootstrapCommands || []).join("\n"));
16169
16170
  setMaxRunSecondsText(proj.maxRunSeconds ? String(proj.maxRunSeconds) : "");
16171
+ setDockerImage(proj.dockerImage || "");
16170
16172
  setErrorMsg(null);
16171
16173
  };
16172
16174
  const startCreate = () => {
@@ -16183,6 +16185,7 @@ ${text}</tr>
16183
16185
  setSddEnabled(null);
16184
16186
  setBootstrapText("");
16185
16187
  setMaxRunSecondsText("");
16188
+ setDockerImage("");
16186
16189
  setErrorMsg(null);
16187
16190
  };
16188
16191
  const cancelForm = () => {
@@ -16209,6 +16212,7 @@ ${text}</tr>
16209
16212
  const bootstrapCommands = bootstrapText.split("\n").map((c) => c.trim()).filter(Boolean);
16210
16213
  const parsedMaxRun = parseInt(maxRunSecondsText.trim(), 10);
16211
16214
  const maxRunSeconds = Number.isFinite(parsedMaxRun) && parsedMaxRun > 0 ? parsedMaxRun : null;
16215
+ const trimmedDocker = dockerImage.trim();
16212
16216
  const updatedProjects = [...projects];
16213
16217
  if (isCreating) {
16214
16218
  const nextId = projects.length > 0 ? Math.max(...projects.map((p) => p.id)) + 1 : 1;
@@ -16225,7 +16229,8 @@ ${text}</tr>
16225
16229
  reviewEnabled,
16226
16230
  sddEnabled,
16227
16231
  bootstrapCommands,
16228
- maxRunSeconds
16232
+ maxRunSeconds,
16233
+ dockerImage: trimmedDocker || null
16229
16234
  };
16230
16235
  updatedProjects.push(newProj);
16231
16236
  } else if (editingProject) {
@@ -16243,7 +16248,8 @@ ${text}</tr>
16243
16248
  reviewEnabled,
16244
16249
  sddEnabled,
16245
16250
  bootstrapCommands,
16246
- maxRunSeconds
16251
+ maxRunSeconds,
16252
+ dockerImage: trimmedDocker || null
16247
16253
  };
16248
16254
  }
16249
16255
  }
@@ -16433,10 +16439,19 @@ ${text}</tr>
16433
16439
  style: { fontFamily: "var(--font-mono)", fontSize: "11px" }
16434
16440
  }
16435
16441
  ),
16436
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { style: { fontSize: "11px", opacity: 0.65, margin: "6px 0 0 0" }, children: [
16442
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { style: { fontSize: "11px", opacity: 0.65, margin: "6px 0 0 0", lineHeight: 1.5 }, children: [
16437
16443
  "Run once, in order, right after a task worktree is created (git projects only) \u2014 before the agent's first cycle, so it doesn't spend tokens on setup like ",
16438
16444
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: "pnpm install" }),
16439
- ". The run stops and the task is blocked if any command fails."
16445
+ ". The run stops and the task is blocked if any command fails.",
16446
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("br", {}),
16447
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { children: "Heads up on how tasks work:" }),
16448
+ " each task runs on its own git worktree/branch, and every cycle commits ",
16449
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("em", { children: "all" }),
16450
+ " changes in that tree. So anything your bootstrap or the agent writes to the workspace that isn't in ",
16451
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: ".gitignore" }),
16452
+ " gets committed to the branch \u2014 e.g. a package manager that drops a local store or cache in the repo (pnpm's",
16453
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: ".pnpm-store/" }),
16454
+ " under a bind-mounted Docker worktree is a common one). Make sure build/dependency artifacts are gitignored so they don't bloat the task branch."
16440
16455
  ] })
16441
16456
  ] }),
16442
16457
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "form-group", children: [
@@ -16453,6 +16468,42 @@ ${text}</tr>
16453
16468
  }
16454
16469
  ),
16455
16470
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: { fontSize: "11px", opacity: 0.65, margin: "6px 0 0 0" }, children: "Wall-clock budget for a single heartbeat cycle, enforced as an abort for every provider. Tasks inherit this and can override it. Leave empty for the default." })
16471
+ ] }),
16472
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "form-group", children: [
16473
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: "project-docker-image", children: "Docker image (optional)" }),
16474
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
16475
+ "input",
16476
+ {
16477
+ id: "project-docker-image",
16478
+ type: "text",
16479
+ value: dockerImage,
16480
+ onChange: (e) => setDockerImage(e.target.value),
16481
+ placeholder: "e.g. node:22 or ./Dockerfile"
16482
+ }
16483
+ ),
16484
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { style: { fontSize: "11px", opacity: 0.65, margin: "6px 0 0 0", lineHeight: 1.5 }, children: [
16485
+ "Run this project's autonomous task agents (dev, planning & review) inside this image. Empty = run on the host.",
16486
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("br", {}),
16487
+ "A value starting with ",
16488
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: "." }),
16489
+ ", ",
16490
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: "/" }),
16491
+ " or ",
16492
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: "\\" }),
16493
+ " is treated as a path to a ",
16494
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { children: "Dockerfile" }),
16495
+ " (built per-project); anything else is a pullable image ref (e.g. ",
16496
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: "node:22" }),
16497
+ ").",
16498
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("br", {}),
16499
+ "The container runs as your user, so put the package manager ",
16500
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("em", { children: "in the image" }),
16501
+ " (e.g. ",
16502
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: "corepack enable pnpm" }),
16503
+ ") \u2014 ",
16504
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: "npm i -g" }),
16505
+ " fails as non-root. Docker must be installed on the scheduler host."
16506
+ ] })
16456
16507
  ] })
16457
16508
  ] }),
16458
16509
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "form-actions", children: [
@@ -16470,9 +16521,15 @@ ${text}</tr>
16470
16521
  ] }),
16471
16522
  proj.description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "settings-card__subtitle", style: { fontSize: "11px", opacity: 0.8, marginBottom: "4px" }, children: proj.description }),
16472
16523
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "settings-card__subtitle", style: { fontFamily: "var(--font-mono)", fontSize: "10px" }, children: proj.workingDir }),
16473
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "settings-card__badge", style: { marginTop: "6px" }, children: [
16474
- "Agent: ",
16475
- assignedAgent
16524
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px", marginTop: "6px" }, children: [
16525
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "settings-card__badge", children: [
16526
+ "Agent: ",
16527
+ assignedAgent
16528
+ ] }),
16529
+ proj.dockerImage && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "settings-card__badge", children: [
16530
+ "Docker: ",
16531
+ proj.dockerImage
16532
+ ] })
16476
16533
  ] })
16477
16534
  ] }),
16478
16535
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "settings-card__actions", children: [