@hyperwindmill/caretaker-cli 0.18.0 → 0.20.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.
@@ -14,4 +14,10 @@ export declare const runningTasks: Set<string>;
14
14
  export declare const runningTaskControllers: Map<number, AbortController>;
15
15
  /** Abort the in-flight run for a task, if one is registered. Returns whether it fired. */
16
16
  export declare function abortRunningTask(taskId: number): boolean;
17
+ /**
18
+ * Project ids with a repository sync (clone/pull) in flight — shared between
19
+ * the heartbeat's pre-worktree sync and POST /api/projects/:id/sync so the
20
+ * two can never race a clone. Derived state only; never persisted.
21
+ */
22
+ export declare const syncingProjects: Set<number>;
17
23
  //# sourceMappingURL=locks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../../../../src/cli/web/scheduler/locks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,aAAoB,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,8BAAqC,CAAC;AAEzE,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKxD"}
1
+ {"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../../../../src/cli/web/scheduler/locks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,aAAoB,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,8BAAqC,CAAC;AAEzE,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKxD;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,aAAoB,CAAC"}
@@ -20,3 +20,9 @@ export function abortRunningTask(taskId) {
20
20
  ctrl.abort();
21
21
  return true;
22
22
  }
23
+ /**
24
+ * Project ids with a repository sync (clone/pull) in flight — shared between
25
+ * the heartbeat's pre-worktree sync and POST /api/projects/:id/sync so the
26
+ * two can never race a clone. Derived state only; never persisted.
27
+ */
28
+ export const syncingProjects = new Set();
@@ -1 +1 @@
1
- {"version":3,"file":"task_strategy.d.ts","sourceRoot":"","sources":["../../../../src/cli/web/scheduler/task_strategy.ts"],"names":[],"mappings":"AAyHA,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAsanE"}
1
+ {"version":3,"file":"task_strategy.d.ts","sourceRoot":"","sources":["../../../../src/cli/web/scheduler/task_strategy.ts"],"names":[],"mappings":"AAyHA,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAidnE"}
@@ -2,8 +2,8 @@ import { randomUUID } from 'node:crypto';
2
2
  import * as harness from '../../../harness/index.js';
3
3
  import { loadAgents, loadConfig } from '../../../store/json.js';
4
4
  import { getTaskById, saveTask, addTaskMessage, updateTaskMessageContent, runQuery } from '../../../store/db.js';
5
- import { runningTasks, runningTaskControllers } from './locks.js';
6
- import { isGitRepo, ensureWorktree, agentDirIn, commitWip, finalizeDone, runBootstrap, gitCommonDir } from '../../../lib/task_git.js';
5
+ import { runningTasks, runningTaskControllers, syncingProjects } from './locks.js';
6
+ import { isGitRepo, ensureWorktree, agentDirIn, commitWip, finalizeDone, runBootstrap, gitCommonDir, syncProjectRepo, projectWorkingDir, pushBranch } from '../../../lib/task_git.js';
7
7
  import { runDoneReview, MAX_REVIEW_ROUNDS } from './task_review.js';
8
8
  import { claudeCodeTaskExtras } from '../../../harness/claude_code_runner.js';
9
9
  import { issueBridgeToken, revokeBridgeToken, getTaskBridgeUrl } from '../mcp_bridge.js';
@@ -132,7 +132,39 @@ export async function runTaskHeartbeatTick(now) {
132
132
  if (!provider) {
133
133
  throw new Error(`Provider "${agent.provider}" not found for agent "${agent.name}"`);
134
134
  }
135
- const baseWorkingDir = project.workingDir || agent.workingDir || process.cwd();
135
+ const baseWorkingDir = projectWorkingDir(project) || agent.workingDir || process.cwd();
136
+ // Remote-backed project: clone-or-pull the repository right before the
137
+ // first worktree is created. Failure blocks the task (bootstrap pattern).
138
+ if (!task.worktreePath && project.repositoryUrl?.trim()) {
139
+ if (syncingProjects.has(project.id)) {
140
+ console.log(`[task_heartbeat] Task #${task.id} repo sync already in flight; skipping tick.`);
141
+ return;
142
+ }
143
+ syncingProjects.add(project.id);
144
+ try {
145
+ for await (const p of syncProjectRepo(project)) {
146
+ console.log(`[task_heartbeat] Task #${task.id} repo sync: ${p.step} — ${p.message}`);
147
+ }
148
+ }
149
+ catch (syncErr) {
150
+ const reason = syncErr instanceof Error ? syncErr.message : String(syncErr);
151
+ task.status = 'blocked';
152
+ task.blockedReason = reason;
153
+ task.updatedAt = new Date().toISOString();
154
+ await saveTask(task);
155
+ await addTaskMessage({
156
+ taskId: task.id,
157
+ role: 'assistant',
158
+ messageType: 'block',
159
+ content: `Repository sync failed — task blocked.\n\n${reason}`,
160
+ });
161
+ console.error(`[task_heartbeat] Task #${task.id} repo sync failed, blocked:`, reason);
162
+ return;
163
+ }
164
+ finally {
165
+ syncingProjects.delete(project.id);
166
+ }
167
+ }
136
168
  let workingDir = baseWorkingDir;
137
169
  let mountRoot = baseWorkingDir;
138
170
  let worktreeJustCreated = false;
@@ -435,7 +467,20 @@ export async function runTaskHeartbeatTick(now) {
435
467
  if (await commitWip(gitTask.worktreePath, gitTask.title)) {
436
468
  console.log(`[task_heartbeat] Task #${task.id} committed WIP to ${gitTask.branch}`);
437
469
  }
470
+ const repoUrl = project.repositoryUrl?.trim();
471
+ if (repoUrl && gitTask.branch && gitTask.status !== 'done') {
472
+ // Per-cycle push is best-effort: the remote mirrors progress, but a
473
+ // flaky network must not fail the cycle. Finalize pushes are gated.
474
+ try {
475
+ await pushBranch(gitTask.worktreePath, gitTask.branch, { url: repoUrl, token: project.repositoryToken });
476
+ }
477
+ catch (pushErr) {
478
+ console.error(`[task_heartbeat] Task #${task.id} per-cycle push failed (best-effort):`, pushErr);
479
+ }
480
+ }
438
481
  if (gitTask.status === 'done') {
482
+ if (!(await pushOrBlock(gitTask, project)))
483
+ return;
439
484
  if (gitTask.dockerContainer) {
440
485
  await removeContainer(gitTask.dockerContainer);
441
486
  gitTask.dockerContainer = null;
@@ -478,6 +523,36 @@ export async function runTaskHeartbeatTick(now) {
478
523
  console.log(`[task_heartbeat] Lock released for task #${task.id}`);
479
524
  }
480
525
  }
526
+ /**
527
+ * Push the task branch before finalizing. Returns true when pushed (or no push
528
+ * applies). On failure: blocks the task with the reason and returns false —
529
+ * the caller must NOT finalize (worktree stays; the user fixes the remote or
530
+ * token and unblocks to retry).
531
+ */
532
+ async function pushOrBlock(task, project) {
533
+ const url = project?.repositoryUrl?.trim();
534
+ if (!url || !task.branch || !task.worktreePath)
535
+ return true;
536
+ try {
537
+ await pushBranch(task.worktreePath, task.branch, { url, token: project?.repositoryToken });
538
+ return true;
539
+ }
540
+ catch (err) {
541
+ const reason = err instanceof Error ? err.message : String(err);
542
+ task.status = 'blocked';
543
+ task.blockedReason = reason;
544
+ task.updatedAt = new Date().toISOString();
545
+ await saveTask(task);
546
+ await addTaskMessage({
547
+ taskId: task.id,
548
+ role: 'assistant',
549
+ messageType: 'block',
550
+ content: `Push to remote failed — task blocked. The worktree is kept; fix the remote or token and unblock to retry.\n\n${reason}`,
551
+ });
552
+ console.error(`[task_heartbeat] Task #${task.id} push failed, blocked:`, reason);
553
+ return false;
554
+ }
555
+ }
481
556
  async function runReviewCycle(opts) {
482
557
  const { task, project, agent, provider, tools, workingDir, signal, dockerContainer, dockerHasGit } = opts;
483
558
  const maxRunSeconds = resolveMaxRunSeconds(task, project, provider.type === 'claude-code');
@@ -489,6 +564,8 @@ async function runReviewCycle(opts) {
489
564
  const current = await getTaskById(task.id);
490
565
  if (!current || current.status !== 'reviewing')
491
566
  return;
567
+ if (!(await pushOrBlock(current, project)))
568
+ return;
492
569
  if (current.dockerContainer) {
493
570
  await removeContainer(current.dockerContainer);
494
571
  current.dockerContainer = null;
@@ -565,6 +642,8 @@ async function runReviewCycle(opts) {
565
642
  content: `Finished as done despite outstanding review findings after ${MAX_REVIEW_ROUNDS} rounds.`,
566
643
  });
567
644
  }
645
+ if (!(await pushOrBlock(current, project)))
646
+ return;
568
647
  if (current.dockerContainer) {
569
648
  await removeContainer(current.dockerContainer);
570
649
  current.dockerContainer = null;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/cli/web/server.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AAwClD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAgC,MAAM,gBAAgB,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAA0B,MAAM,mBAAmB,CAAC;AAgBjF,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9D,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACtF,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAED,qBAAa,oBAAoB;IAQ7B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAPvB,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,O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gFhB,KAAK,IAAI,IAAI;CAGd;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4lC3E"}
@@ -4,13 +4,15 @@ import fs from 'node:fs';
4
4
  import { watch, existsSync, mkdirSync } from 'node:fs';
5
5
  import { randomUUID } from 'node:crypto';
6
6
  import { Hono } from 'hono';
7
+ import { stream } from 'hono/streaming';
7
8
  import { serve } from '@hono/node-server';
8
9
  import { WebSocketServer, WebSocket } from 'ws';
9
10
  import * as harness from '../../harness/index.js';
10
11
  import { getDb, getTaskById, saveTask, createTask, addTaskMessage, deleteTask, runQuery, tryNormalizeChecklistStatus } from '../../store/db.js';
11
- import { discardWorktree } from '../../lib/task_git.js';
12
+ import { discardWorktree, syncProjectRepo, projectRepoStatus, managedRepoDir } from '../../lib/task_git.js';
12
13
  import { removeContainer } from '../../lib/docker.js';
13
- import { runningTasks, abortRunningTask } from './scheduler/locks.js';
14
+ import { validateRepositoryUrl } from '../../lib/repo_url.js';
15
+ import { runningTasks, abortRunningTask, syncingProjects } from './scheduler/locks.js';
14
16
  import { registerTaskBridge, setTaskBridgeUrl } from './mcp_bridge.js';
15
17
  import { loadAgents, loadConfig, dataDir, saveAgents, saveConfig, loadPlugins, loadMcpServers, } from '../../store/json.js';
16
18
  import { createSource, deleteSource, patchSource, refreshSource, } from '../../plugins/source_manager.js';
@@ -227,7 +229,12 @@ export async function startServer(port, host) {
227
229
  app.post('/api/projects', async (c) => {
228
230
  try {
229
231
  const body = await c.req.json();
230
- const { name, description, workingDir, agentId, plannerAgentId, reviewerAgentId, planningEnabled, reviewEnabled, sddEnabled, bootstrapCommands, maxRunSeconds, dockerImage } = body;
232
+ const { name, description, workingDir, agentId, plannerAgentId, reviewerAgentId, planningEnabled, reviewEnabled, sddEnabled, bootstrapCommands, maxRunSeconds, dockerImage, repositoryUrl, repositoryToken } = body;
233
+ const repoUrl = typeof repositoryUrl === 'string' ? repositoryUrl.trim() : '';
234
+ const repoUrlError = validateRepositoryUrl(repoUrl);
235
+ if (repoUrlError) {
236
+ return c.json({ error: repoUrlError }, 400);
237
+ }
231
238
  const config = await loadConfig();
232
239
  if (!config.projects) {
233
240
  config.projects = [];
@@ -250,6 +257,10 @@ export async function startServer(port, host) {
250
257
  : null,
251
258
  maxRunSeconds: typeof maxRunSeconds === 'number' && maxRunSeconds > 0 ? maxRunSeconds : null,
252
259
  dockerImage: typeof dockerImage === 'string' && dockerImage.trim() ? dockerImage.trim() : null,
260
+ repositoryUrl: repoUrl || null,
261
+ repositoryToken: repoUrl && typeof repositoryToken === 'string' && repositoryToken.trim()
262
+ ? repositoryToken.trim()
263
+ : null,
253
264
  };
254
265
  config.projects.push(project);
255
266
  await saveConfig(config);
@@ -263,10 +274,18 @@ export async function startServer(port, host) {
263
274
  try {
264
275
  const id = Number(c.req.param('id'));
265
276
  const config = await loadConfig();
277
+ const project = (config.projects || []).find((p) => p.id === id);
266
278
  if (config.projects) {
267
279
  config.projects = config.projects.filter((p) => p.id !== id);
268
280
  await saveConfig(config);
269
281
  }
282
+ // Ids are max+1, so deleting the highest one and creating a new project
283
+ // reuses the id — and with it ~/.caretaker/repos/<id>, which the new
284
+ // project would silently inherit (old code, old origin). Remove the
285
+ // managed clone; a user-chosen workingDir is never touched.
286
+ const managed = project ? managedRepoDir(project) : null;
287
+ if (managed)
288
+ await fs.promises.rm(managed, { recursive: true, force: true });
270
289
  // Delete task messages first, then tasks — avoids orphaned message rows.
271
290
  await runQuery(`DELETE FROM task_messages WHERE taskId IN (SELECT id FROM tasks WHERE projectId = ${id})`);
272
291
  await runQuery(`DELETE FROM tasks WHERE projectId = ${id}`);
@@ -276,6 +295,49 @@ export async function startServer(port, host) {
276
295
  return c.json({ error: String(err) }, 500);
277
296
  }
278
297
  });
298
+ // Clone-or-pull a remote-backed project's repository. Progress streams as
299
+ // ndjson (voice-backend pattern); failures travel in-band as an `error` line
300
+ // so URL/token problems are diagnosable from the UI.
301
+ app.post('/api/projects/:id/sync', async (c) => {
302
+ const id = Number(c.req.param('id'));
303
+ const config = await loadConfig();
304
+ const project = (config.projects || []).find((p) => p.id === id);
305
+ if (!project)
306
+ return c.json({ error: 'not found' }, 404);
307
+ if (!project.repositoryUrl?.trim())
308
+ return c.json({ error: 'project has no repository URL' }, 400);
309
+ if (syncingProjects.has(id))
310
+ return c.json({ error: 'sync already running' }, 409);
311
+ syncingProjects.add(id);
312
+ c.header('Content-Type', 'application/x-ndjson');
313
+ return stream(c, async (s) => {
314
+ try {
315
+ for await (const p of syncProjectRepo(project)) {
316
+ await s.writeln(JSON.stringify(p));
317
+ }
318
+ }
319
+ catch (err) {
320
+ const message = err instanceof Error ? err.message : String(err);
321
+ await s.writeln(JSON.stringify({ step: 'error', message }));
322
+ }
323
+ finally {
324
+ syncingProjects.delete(id);
325
+ }
326
+ });
327
+ });
328
+ // Derived repo state — disk + in-flight set at request time, nothing stored.
329
+ app.get('/api/projects/:id/repo-status', async (c) => {
330
+ const id = Number(c.req.param('id'));
331
+ const config = await loadConfig();
332
+ const project = (config.projects || []).find((p) => p.id === id);
333
+ if (!project)
334
+ return c.json({ error: 'not found' }, 404);
335
+ if (!project.repositoryUrl?.trim())
336
+ return c.json({ error: 'project has no repository URL' }, 400);
337
+ if (syncingProjects.has(id))
338
+ return c.json({ state: 'syncing' });
339
+ return c.json(await projectRepoStatus(project));
340
+ });
279
341
  // Tasks REST endpoints
280
342
  app.get('/api/projects/:id/tasks', async (c) => {
281
343
  const id = Number(c.req.param('id'));
@@ -400,11 +462,30 @@ export async function startServer(port, host) {
400
462
  return c.json({ ok: false, error: 'not found' }, 404);
401
463
  if (!task.worktreePath)
402
464
  return c.json({ ok: false, error: 'no worktree' }, 400);
465
+ // Same guard as delete: a manual discard racing a heartbeat cycle would rip
466
+ // the worktree out from under the running agent — and the critical section
467
+ // now includes a network push.
468
+ if (task.lockedAt || runningTasks.has(`task_db_${taskId}`)) {
469
+ return c.json({ ok: false, error: 'Task is currently running. Wait for it to finish or pause it first.' }, 409);
470
+ }
403
471
  if (task.dockerContainer) {
404
472
  await removeContainer(task.dockerContainer);
405
473
  task.dockerContainer = null;
474
+ task.updatedAt = new Date().toISOString();
475
+ await saveTask(task);
476
+ }
477
+ const config = await loadConfig();
478
+ const project = (config.projects || []).find((p) => p.id === task.projectId);
479
+ const repoUrl = project?.repositoryUrl?.trim();
480
+ try {
481
+ await discardWorktree(task.worktreePath, task.title, repoUrl && task.branch
482
+ ? { branch: task.branch, url: repoUrl, token: project?.repositoryToken }
483
+ : undefined);
484
+ }
485
+ catch (err) {
486
+ const message = err instanceof Error ? err.message : String(err);
487
+ return c.json({ ok: false, error: `Discard aborted — worktree kept. ${message}` }, 500);
406
488
  }
407
- await discardWorktree(task.worktreePath, task.title);
408
489
  task.worktreePath = null;
409
490
  task.updatedAt = new Date().toISOString();
410
491
  await saveTask(task);
@@ -467,11 +548,25 @@ export async function startServer(port, host) {
467
548
  }
468
549
  }
469
550
  if (task.worktreePath) {
551
+ const config = await loadConfig();
552
+ const project = (config.projects || []).find((p) => p.id === task.projectId);
553
+ const repoUrl = project?.repositoryUrl?.trim();
554
+ const push = repoUrl && task.branch
555
+ ? { branch: task.branch, url: repoUrl, token: project?.repositoryToken }
556
+ : undefined;
470
557
  try {
471
- await discardWorktree(task.worktreePath, task.title);
558
+ await discardWorktree(task.worktreePath, task.title, push);
472
559
  }
473
560
  catch {
474
- // Best-effort: proceed with deletion even if worktree cleanup fails.
561
+ // The user is deleting the task, so a failed push must not block it —
562
+ // but it must not leave the worktree on disk with no task row pointing
563
+ // at it either. Retry without the push; the branch survives locally.
564
+ try {
565
+ await discardWorktree(task.worktreePath, task.title);
566
+ }
567
+ catch {
568
+ // Best-effort: proceed with deletion even if cleanup fails.
569
+ }
475
570
  }
476
571
  }
477
572
  await deleteTask(taskId);
@@ -909,6 +1004,16 @@ export async function startServer(port, host) {
909
1004
  return;
910
1005
  case 'saveConfig':
911
1006
  try {
1007
+ // The settings form saves the whole config through here, so this
1008
+ // — not POST /api/projects — is the write path that actually
1009
+ // needs to enforce the repository-URL rules.
1010
+ for (const project of msg.config.projects || []) {
1011
+ const repoUrlError = validateRepositoryUrl(project.repositoryUrl || '');
1012
+ if (repoUrlError) {
1013
+ post({ type: 'error', message: `Project "${project.name}": ${repoUrlError}` });
1014
+ return;
1015
+ }
1016
+ }
912
1017
  await saveConfig(msg.config);
913
1018
  post({ type: 'voiceConfig', voice: voiceClientConfig(msg.config) });
914
1019
  void loadAgentsAndSend();
@@ -1 +1 @@
1
- {"version":3,"file":"task_tools.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/task_tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,aAAa,CAAC;AAcpD,eAAO,MAAM,gBAAgB,EAAE,IAmD9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,IAqCrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,IAoDjC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,IAmEnC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IAiC5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,IAgD9B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,IAoC3B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,IAoC3B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IAa7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IAgG5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IA+B5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IAwC7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,IAoC9B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IAwC7B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,IA4BrC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IAkC7B,CAAC;AAEF,eAAO,MAAM,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7 +1,7 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { getDb, getTaskById, saveTask, createTask, addTaskMessage, deleteTask, tryNormalizeChecklistStatus } from '../../../store/db.js';
3
3
  import { loadConfig, loadAgents } from '../../../store/json.js';
4
- import { discardWorktree } from '../../../lib/task_git.js';
4
+ import { discardWorktree, projectWorkingDir } from '../../../lib/task_git.js';
5
5
  import { removeContainer } from '../../../lib/docker.js';
6
6
  import { runningTasks } from '../../../cli/web/scheduler/locks.js';
7
7
  import { resolveReviewEnabled, resolvePlanningEnabled, activationStatus } from '../../../cli/web/scheduler/task_roles.js';
@@ -52,7 +52,7 @@ export const getTaskStateTool = {
52
52
  project: project
53
53
  ? {
54
54
  name: project.name,
55
- workingDir: project.workingDir,
55
+ workingDir: projectWorkingDir(project),
56
56
  }
57
57
  : null,
58
58
  recentMessages: messages.slice(-20),
@@ -358,7 +358,20 @@ export const projectListTool = {
358
358
  const config = await loadConfig();
359
359
  const projects = [...(config.projects || [])];
360
360
  projects.sort((a, b) => a.name.localeCompare(b.name));
361
- return { content: JSON.stringify(projects) };
361
+ // Curated projection, never the raw record: ProjectConfig carries secrets
362
+ // (repositoryToken) that must not reach an agent's context, its prompt, or
363
+ // the session logs — and workingDir must be the resolved effective dir,
364
+ // which is blank in storage for a managed clone.
365
+ return {
366
+ content: JSON.stringify(projects.map((p) => ({
367
+ id: p.id,
368
+ name: p.name,
369
+ description: p.description,
370
+ workingDir: projectWorkingDir(p),
371
+ agentId: p.agentId,
372
+ active: p.active,
373
+ }))),
374
+ };
362
375
  },
363
376
  };
364
377
  export const taskCreateTool = {
@@ -601,11 +614,26 @@ export const taskDiscardWorktreeTool = {
601
614
  return err(`Task ${taskId} not found`);
602
615
  if (!task.worktreePath)
603
616
  return err(`Task ${taskId} has no active worktree`);
617
+ // Same guard as task_delete: discarding mid-cycle would rip the worktree out
618
+ // from under the running agent, and the critical section now pushes.
619
+ if (task.lockedAt || runningTasks.has(`task_db_${taskId}`)) {
620
+ return err(`Task ${taskId} is currently running (locked). Wait for it to finish or pause it first.`);
621
+ }
604
622
  if (task.dockerContainer) {
605
623
  await removeContainer(task.dockerContainer);
606
624
  task.dockerContainer = null;
607
625
  }
608
- await discardWorktree(task.worktreePath, task.title);
626
+ const config = await loadConfig();
627
+ const project = (config.projects || []).find((p) => p.id === task.projectId);
628
+ const repoUrl = project?.repositoryUrl?.trim();
629
+ try {
630
+ await discardWorktree(task.worktreePath, task.title, repoUrl && task.branch
631
+ ? { branch: task.branch, url: repoUrl, token: project?.repositoryToken }
632
+ : undefined);
633
+ }
634
+ catch (e) {
635
+ return err(`Discard aborted — worktree kept: ${e instanceof Error ? e.message : String(e)}`);
636
+ }
609
637
  task.worktreePath = null;
610
638
  task.updatedAt = new Date().toISOString();
611
639
  await saveTask(task);
@@ -705,11 +733,25 @@ export const taskDeleteTool = {
705
733
  }
706
734
  }
707
735
  if (task.worktreePath) {
736
+ const config = await loadConfig();
737
+ const project = (config.projects || []).find((p) => p.id === task.projectId);
738
+ const repoUrl = project?.repositoryUrl?.trim();
739
+ const push = repoUrl && task.branch
740
+ ? { branch: task.branch, url: repoUrl, token: project?.repositoryToken }
741
+ : undefined;
708
742
  try {
709
- await discardWorktree(task.worktreePath, task.title);
743
+ await discardWorktree(task.worktreePath, task.title, push);
710
744
  }
711
745
  catch {
712
- // Best-effort: proceed with deletion even if worktree cleanup fails.
746
+ // A failed push must not strand the worktree on disk with no task row
747
+ // pointing at it: drop the push and clean up. The branch stays in the
748
+ // local clone either way.
749
+ try {
750
+ await discardWorktree(task.worktreePath, task.title);
751
+ }
752
+ catch {
753
+ // Best-effort: proceed with deletion even if worktree cleanup fails.
754
+ }
713
755
  }
714
756
  }
715
757
  await deleteTask(taskId);
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Authoritative validation for a project's `repositoryUrl`.
3
+ *
4
+ * The webview has its own copy of this rule for form feedback, but that one is
5
+ * UX only — every write path into `caretaker.json` must call THIS one, because
6
+ * the client can send any payload it likes over the settings websocket.
7
+ *
8
+ * Returns null when the value is acceptable (empty = unset), otherwise the
9
+ * message to show the user.
10
+ */
11
+ export declare function validateRepositoryUrl(url: string): string | null;
12
+ //# sourceMappingURL=repo_url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo_url.d.ts","sourceRoot":"","sources":["../../src/lib/repo_url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsBhE"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Authoritative validation for a project's `repositoryUrl`.
3
+ *
4
+ * The webview has its own copy of this rule for form feedback, but that one is
5
+ * UX only — every write path into `caretaker.json` must call THIS one, because
6
+ * the client can send any payload it likes over the settings websocket.
7
+ *
8
+ * Returns null when the value is acceptable (empty = unset), otherwise the
9
+ * message to show the user.
10
+ */
11
+ export function validateRepositoryUrl(url) {
12
+ const u = url.trim();
13
+ if (!u)
14
+ return null;
15
+ if (u.startsWith('git@') || u.startsWith('ssh://')) {
16
+ return 'SSH remotes are not supported — use an https:// URL with an access token.';
17
+ }
18
+ if (!u.startsWith('https://'))
19
+ return 'Repository URL must start with https://';
20
+ let parsed;
21
+ try {
22
+ parsed = new URL(u);
23
+ }
24
+ catch {
25
+ return 'Repository URL is not a valid URL.';
26
+ }
27
+ if (!parsed.hostname)
28
+ return 'Repository URL is not a valid URL.';
29
+ // An https prefix alone does NOT keep the secret out of argv and
30
+ // .git/config: `https://user:token@host/repo` puts it in both, which is
31
+ // exactly what the credential-helper design exists to prevent.
32
+ if (parsed.username || parsed.password) {
33
+ return 'Do not put credentials in the repository URL — they would be stored in .git/config and visible in the process list. Use the access token field instead.';
34
+ }
35
+ return null;
36
+ }
@@ -1,4 +1,52 @@
1
1
  export declare function isGitRepo(dir: string): Promise<boolean>;
2
+ export declare function gitAuthArgs(hasToken: boolean): string[];
3
+ export declare function gitAuthEnv(token?: string | null): Record<string, string>;
4
+ export declare function pushBranch(worktreePath: string, branch: string, repo: {
5
+ url: string;
6
+ token?: string | null;
7
+ }): Promise<void>;
8
+ export declare function projectWorkingDir(project: {
9
+ id: number;
10
+ workingDir?: string | null;
11
+ repositoryUrl?: string | null;
12
+ }): string;
13
+ /**
14
+ * The clone directory caretaker owns for this project, or null when the repo
15
+ * lives in a user-chosen `workingDir` (or the project isn't remote-backed).
16
+ * The delete path uses this: anything non-null is caretaker's to remove,
17
+ * anything null must never be touched.
18
+ */
19
+ export declare function managedRepoDir(project: {
20
+ id: number;
21
+ workingDir?: string | null;
22
+ repositoryUrl?: string | null;
23
+ }): string | null;
24
+ export type ProjectRepoStatus = {
25
+ state: 'absent' | 'cloned' | 'broken';
26
+ branch?: string;
27
+ commit?: string;
28
+ };
29
+ export declare function projectRepoStatus(project: {
30
+ id: number;
31
+ workingDir?: string | null;
32
+ repositoryUrl?: string | null;
33
+ }): Promise<ProjectRepoStatus>;
34
+ export type SyncProgress = {
35
+ step: 'clean' | 'clone' | 'pull' | 'done' | 'error';
36
+ message: string;
37
+ status?: ProjectRepoStatus;
38
+ };
39
+ /**
40
+ * Clone-or-pull a remote-backed project's repository. Progress is yielded for
41
+ * the ndjson endpoint; the heartbeat just drains it. Throws on failure —
42
+ * callers turn that into a blocked task / in-band error line.
43
+ */
44
+ export declare function syncProjectRepo(project: {
45
+ id: number;
46
+ workingDir?: string | null;
47
+ repositoryUrl?: string | null;
48
+ repositoryToken?: string | null;
49
+ }): AsyncGenerator<SyncProgress>;
2
50
  /**
3
51
  * Absolute git common dir for a (linked) worktree — the main repo's shared
4
52
  * `.git`, which holds the object store and `worktrees/<id>`. A worktree's own
@@ -23,5 +71,9 @@ export declare function ensureWorktree(projectWorkingDir: string, projectId: num
23
71
  export declare function runBootstrap(cwd: string, commands: string[], dockerContainer?: string): Promise<void>;
24
72
  export declare function commitWip(worktreePath: string, title: string): Promise<boolean>;
25
73
  export declare function finalizeDone(worktreePath: string): Promise<void>;
26
- export declare function discardWorktree(worktreePath: string, title: string): Promise<void>;
74
+ export declare function discardWorktree(worktreePath: string, title: string, push?: {
75
+ branch: string;
76
+ url: string;
77
+ token?: string | null;
78
+ }): Promise<void>;
27
79
  //# sourceMappingURL=task_git.d.ts.map
@@ -1 +1 @@
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,CA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