@mycompbox/compbox-cli 1.21.9 → 1.21.10

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 (85) hide show
  1. package/.tsbuildinfo +1 -1
  2. package/commands/list.js +1 -1
  3. package/commands/list.js.map +1 -1
  4. package/commands/machines.d.ts +4 -0
  5. package/commands/machines.d.ts.map +1 -1
  6. package/commands/machines.js +61 -2
  7. package/commands/machines.js.map +1 -1
  8. package/commands/run.d.ts +27 -1
  9. package/commands/run.d.ts.map +1 -1
  10. package/commands/run.js +157 -36
  11. package/commands/run.js.map +1 -1
  12. package/commands/update.d.ts +19 -0
  13. package/commands/update.d.ts.map +1 -1
  14. package/commands/update.js +124 -7
  15. package/commands/update.js.map +1 -1
  16. package/commands/workspace.d.ts.map +1 -1
  17. package/commands/workspace.js +13 -1
  18. package/commands/workspace.js.map +1 -1
  19. package/index.js +5113 -1701
  20. package/index.js.map +1 -1
  21. package/package.json +1 -1
  22. package/utils/agent-invoker.d.ts +214 -30
  23. package/utils/agent-invoker.d.ts.map +1 -1
  24. package/utils/agent-invoker.js +964 -370
  25. package/utils/agent-invoker.js.map +1 -1
  26. package/utils/brew.d.ts +10 -0
  27. package/utils/brew.d.ts.map +1 -1
  28. package/utils/brew.js +14 -0
  29. package/utils/brew.js.map +1 -1
  30. package/utils/cli-version.d.ts +3 -0
  31. package/utils/cli-version.d.ts.map +1 -0
  32. package/utils/cli-version.js +18 -0
  33. package/utils/cli-version.js.map +1 -0
  34. package/utils/cloud-preflight.d.ts +68 -0
  35. package/utils/cloud-preflight.d.ts.map +1 -0
  36. package/utils/cloud-preflight.js +287 -0
  37. package/utils/cloud-preflight.js.map +1 -0
  38. package/utils/config-store.d.ts +29 -0
  39. package/utils/config-store.d.ts.map +1 -1
  40. package/utils/config-store.js +30 -0
  41. package/utils/config-store.js.map +1 -1
  42. package/utils/install-cache.d.ts +105 -0
  43. package/utils/install-cache.d.ts.map +1 -0
  44. package/utils/install-cache.js +184 -0
  45. package/utils/install-cache.js.map +1 -0
  46. package/utils/mailbox-client.d.ts +113 -3
  47. package/utils/mailbox-client.d.ts.map +1 -1
  48. package/utils/mailbox-client.js +130 -6
  49. package/utils/mailbox-client.js.map +1 -1
  50. package/utils/merge-guard.d.ts +66 -0
  51. package/utils/merge-guard.d.ts.map +1 -0
  52. package/utils/merge-guard.js +271 -0
  53. package/utils/merge-guard.js.map +1 -0
  54. package/utils/merge-policy.d.ts +68 -0
  55. package/utils/merge-policy.d.ts.map +1 -0
  56. package/utils/merge-policy.js +129 -0
  57. package/utils/merge-policy.js.map +1 -0
  58. package/utils/progress-watcher.d.ts +53 -0
  59. package/utils/progress-watcher.d.ts.map +1 -0
  60. package/utils/progress-watcher.js +109 -0
  61. package/utils/progress-watcher.js.map +1 -0
  62. package/utils/project-checks.d.ts +72 -0
  63. package/utils/project-checks.d.ts.map +1 -0
  64. package/utils/project-checks.js +276 -0
  65. package/utils/project-checks.js.map +1 -0
  66. package/utils/run-timings.d.ts +59 -0
  67. package/utils/run-timings.d.ts.map +1 -0
  68. package/utils/run-timings.js +130 -0
  69. package/utils/run-timings.js.map +1 -0
  70. package/utils/run-workspace.d.ts +199 -2
  71. package/utils/run-workspace.d.ts.map +1 -1
  72. package/utils/run-workspace.js +896 -136
  73. package/utils/run-workspace.js.map +1 -1
  74. package/utils/self-update.d.ts +104 -0
  75. package/utils/self-update.d.ts.map +1 -0
  76. package/utils/self-update.js +391 -0
  77. package/utils/self-update.js.map +1 -0
  78. package/utils/usage-limit.d.ts +30 -0
  79. package/utils/usage-limit.d.ts.map +1 -0
  80. package/utils/usage-limit.js +186 -0
  81. package/utils/usage-limit.js.map +1 -0
  82. package/utils/wrap-up.d.ts +109 -0
  83. package/utils/wrap-up.d.ts.map +1 -0
  84. package/utils/wrap-up.js +260 -0
  85. package/utils/wrap-up.js.map +1 -0
@@ -0,0 +1,130 @@
1
+ function durationsOf(value) {
2
+ if (!value || typeof value !== "object" || Array.isArray(value))
3
+ return null;
4
+ const r = value;
5
+ const api = r.duration_api_ms;
6
+ const total = r.duration_ms;
7
+ if (typeof api !== "number" || typeof total !== "number")
8
+ return null;
9
+ if (!Number.isFinite(api) || !Number.isFinite(total) || api < 0 || total < 0)
10
+ return null;
11
+ return { apiMs: api, totalMs: total };
12
+ }
13
+ /**
14
+ * Reads `duration_api_ms` / `duration_ms` from a Claude run's JSON output
15
+ * (`--output-format json`, or the last `result` line of stream-json). Plain
16
+ * text output has no durations → null (the caller records "not measured").
17
+ */
18
+ export function parseClaudeDurations(stdout) {
19
+ const trimmed = stdout.trim();
20
+ if (!trimmed)
21
+ return null;
22
+ try {
23
+ const whole = durationsOf(JSON.parse(trimmed));
24
+ if (whole)
25
+ return whole;
26
+ }
27
+ catch {
28
+ // Not a single JSON document — try line by line.
29
+ }
30
+ const lines = trimmed.split("\n");
31
+ for (let i = lines.length - 1; i >= 0; i--) {
32
+ const line = lines[i]?.trim() ?? "";
33
+ if (!line.startsWith("{"))
34
+ continue;
35
+ try {
36
+ const found = durationsOf(JSON.parse(line));
37
+ if (found)
38
+ return found;
39
+ }
40
+ catch {
41
+ // Not JSON.
42
+ }
43
+ }
44
+ return null;
45
+ }
46
+ /**
47
+ * Sums model and tool time across every Claude run of a job (the first run and
48
+ * each continue/resume). If any run reported no durations, both are null —
49
+ * a partial sum would understate the real time.
50
+ */
51
+ export function aggregateRunDurations(runs) {
52
+ if (runs.length === 0 || runs.some((r) => r === null))
53
+ return { modelMs: null, toolMs: null };
54
+ let modelMs = 0;
55
+ let toolMs = 0;
56
+ for (const run of runs) {
57
+ modelMs += run.apiMs;
58
+ toolMs += Math.max(0, run.totalMs - run.apiMs);
59
+ }
60
+ return { modelMs, toolMs };
61
+ }
62
+ const CI_START = /\[compbox:ci-wait start(?:\s+ts=(\d+))?\]/;
63
+ const CI_END = /\[compbox:ci-wait end(?:\s+ts=(\d+))?\]([^\n]*)/;
64
+ /**
65
+ * Tracks `[compbox:ci-wait start]` / `[compbox:ci-wait end] ... elapsed=Ns`
66
+ * markers in a run's output (printed by the compbox-pullrequest skill's CI
67
+ * wait helper). Durations come from, in order: the end marker's `elapsed=`,
68
+ * the markers' `ts=<epoch seconds>`, or the time each line arrived.
69
+ */
70
+ export class CiWaitTracker {
71
+ partial = "";
72
+ openAtMs = null;
73
+ totalMs = 0;
74
+ waits = 0;
75
+ /** Feeds a stdout chunk that arrived at `nowMs` (epoch ms). */
76
+ feed(chunk, nowMs) {
77
+ const text = this.partial + chunk;
78
+ const lines = text.split("\n");
79
+ this.partial = lines.pop() ?? "";
80
+ for (const line of lines)
81
+ this.line(line, nowMs);
82
+ }
83
+ /** Processes a trailing line without a newline (call once the run ends). */
84
+ flush(nowMs) {
85
+ if (this.partial)
86
+ this.line(this.partial, nowMs);
87
+ this.partial = "";
88
+ }
89
+ line(line, nowMs) {
90
+ const start = CI_START.exec(line);
91
+ if (start) {
92
+ this.openAtMs = start[1] ? Number(start[1]) * 1000 : nowMs;
93
+ return;
94
+ }
95
+ const end = CI_END.exec(line);
96
+ if (!end)
97
+ return;
98
+ const elapsed = /elapsed=(\d+)s/.exec(end[2] ?? "");
99
+ let ms = null;
100
+ if (elapsed)
101
+ ms = Number(elapsed[1]) * 1000;
102
+ else if (this.openAtMs !== null)
103
+ ms = (end[1] ? Number(end[1]) * 1000 : nowMs) - this.openAtMs;
104
+ if (ms !== null && ms >= 0) {
105
+ this.totalMs += ms;
106
+ this.waits += 1;
107
+ }
108
+ this.openAtMs = null;
109
+ }
110
+ /** Total CI wait so far, or null when no wait was seen. */
111
+ get ms() {
112
+ return this.waits > 0 ? this.totalMs : null;
113
+ }
114
+ }
115
+ /** Builds the job result's `timings` block (ENG-352). */
116
+ export function buildJobTimings(input) {
117
+ const { modelMs, toolMs } = aggregateRunDurations(input.runs);
118
+ return {
119
+ installMs: input.install?.ms ?? null,
120
+ cacheHit: input.install?.cacheHit ?? null,
121
+ modelMs,
122
+ toolMs,
123
+ ciWaitMs: input.ciWaitMs,
124
+ // Waiting for the owner's reply happens between jobs; the server/web derive it.
125
+ userWaitMs: null,
126
+ totalMs: Math.max(0, input.endedAtMs - input.startedAtMs),
127
+ fastMode: input.fastMode,
128
+ };
129
+ }
130
+ //# sourceMappingURL=run-timings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-timings.js","sourceRoot":"","sources":["../../src/utils/run-timings.ts"],"names":[],"mappings":"AAcA,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7E,MAAM,CAAC,GAAG,KAAgC,CAAC;IAC3C,MAAM,GAAG,GAAG,CAAC,CAAC,eAAe,CAAC;IAC9B,MAAM,KAAK,GAAG,CAAC,CAAC,WAAW,CAAC;IAC5B,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACtE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1F,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9B,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,i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AAK,CAAC,WAAW,CAAC;QACzD,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC;AACJ,CAAC"}
@@ -24,6 +24,9 @@
24
24
  * Every git/gh/install call goes through an injectable runner so tests never
25
25
  * touch a real repository.
26
26
  */
27
+ import { type NeedsInputRequest } from "@mycompbox/shared";
28
+ import { type InstallOptions } from "./install-cache.js";
29
+ import type { WrapUpHook, WrapUpStatus } from "./wrap-up.js";
27
30
  /** Result of one external command. */
28
31
  export interface CommandResult {
29
32
  status: number;
@@ -53,6 +56,11 @@ export interface RunWorkspace {
53
56
  remote: string | null;
54
57
  /** True when the run continues an earlier unfinished run's branch instead of starting a new one. */
55
58
  continued?: boolean;
59
+ /** ENG-349: how long installing dependencies took, and whether the shared store was reused. */
60
+ install?: {
61
+ ms: number;
62
+ cacheHit: boolean;
63
+ };
56
64
  }
57
65
  export type PrepareResult = {
58
66
  ok: true;
@@ -62,6 +70,15 @@ export type PrepareResult = {
62
70
  ok: false;
63
71
  error: string;
64
72
  };
73
+ /** Where a paused run lives (ENG-339): the kept run copy and its branch. */
74
+ export interface ReopenInput {
75
+ /** The person's checkout the run copy was made from. */
76
+ projectDir: string;
77
+ /** The kept run copy's path, exactly as the paused run reported it. */
78
+ runDir: string;
79
+ /** The run's branch, when known (the paused job's result). */
80
+ branch?: string | null;
81
+ }
65
82
  export interface FinishInput {
66
83
  workspace: RunWorkspace;
67
84
  epicId: string;
@@ -76,7 +93,67 @@ export interface FinishInput {
76
93
  * locally, exactly as the agent left them, and nothing is pushed.
77
94
  */
78
95
  signal?: AbortSignal;
96
+ /**
97
+ * Wrap-up base merge (ENG-327): before pushing a completed run, merge the
98
+ * latest base branch into the run's branch. Simple conflicts go to
99
+ * `resolveConflicts`; anything it can't settle aborts the merge.
100
+ */
101
+ mergeBase?: {
102
+ resolveConflicts?: ConflictResolver;
103
+ };
104
+ /**
105
+ * Wrap-up (ENG-327): runs after the base merge for a completed run, before
106
+ * pushing. The pull request is then opened as a draft and the wrap-up's
107
+ * review marks it ready only when everything is green with no gaps.
108
+ */
109
+ wrapUp?: WrapUpHook;
110
+ /**
111
+ * ENG-337: the run stopped to ask its owner something. The branch is still
112
+ * committed and pushed, and the draft pull request's body starts with the
113
+ * question; the base merge and wrap-up are skipped. With `keepRunCopy` the
114
+ * worktree is NOT removed, so a reply can resume the same agent session there
115
+ * (the session is keyed by its folder).
116
+ */
117
+ waiting?: {
118
+ request: NeedsInputRequest;
119
+ keepRunCopy: boolean;
120
+ };
79
121
  }
122
+ /**
123
+ * ENG-337: the "Waiting for your reply" block at the top of a draft pull
124
+ * request. The request is untrusted agent output, so it goes in a code fence
125
+ * longer than any backtick run inside it: no markdown, links, HTML or
126
+ * @-mentions are rendered from it. Pure — exported for unit testing.
127
+ */
128
+ export declare function waitingPrBodyBlock(request: NeedsInputRequest): string;
129
+ /**
130
+ * One time-boxed agent turn that resolves merge conflicts in `files` only
131
+ * (ENG-327). Returns once the agent has finished or was stopped; the caller
132
+ * checks the result itself, so the return value is only advisory.
133
+ */
134
+ export type ConflictResolver = (input: {
135
+ dir: string;
136
+ files: string[];
137
+ baseBranch: string;
138
+ signal?: AbortSignal;
139
+ }) => Promise<{
140
+ ok: boolean;
141
+ reason?: string;
142
+ }>;
143
+ /** How the wrap-up base merge went (ENG-327). */
144
+ export type BaseMergeResult = {
145
+ outcome: "up_to_date";
146
+ } | {
147
+ outcome: "merged";
148
+ resolvedFiles: string[];
149
+ } | {
150
+ outcome: "conflict";
151
+ files: string[];
152
+ reason: string;
153
+ } | {
154
+ outcome: "skipped";
155
+ reason: string;
156
+ };
80
157
  export interface FinishResult {
81
158
  branch: string;
82
159
  /** Commits on the branch beyond its base. */
@@ -97,6 +174,18 @@ export interface FinishResult {
97
174
  notes: string[];
98
175
  /** The run was cancelled: nothing was pushed and the worktree was kept. */
99
176
  cancelled?: boolean;
177
+ /**
178
+ * The wrap-up base merge, when one was asked for. A `conflict` outcome
179
+ * means the wrap-up needs a decision: the merge was aborted and the branch
180
+ * was pushed without it.
181
+ */
182
+ baseMerge?: BaseMergeResult;
183
+ /** How the wrap-up went, when one ran. */
184
+ wrapUp?: {
185
+ status: WrapUpStatus;
186
+ ready: boolean;
187
+ reasons: string[];
188
+ };
100
189
  }
101
190
  /** Local-only files a run needs that git doesn't carry into a new worktree. */
102
191
  export declare function isLocalConfigFile(path: string): boolean;
@@ -108,8 +197,12 @@ export declare function slugForBranch(value: string): string;
108
197
  * `fatal:`/`error:` line, so the first line alone hid the reason.
109
198
  */
110
199
  export declare function gitReason(text: string): string;
111
- /** Picks the install command for the repo's lockfile, or null when there is none. */
112
- export declare function installCommand(dir: string, exists?: (path: string) => boolean): [string, string[]] | null;
200
+ /**
201
+ * Picks the install command for the repo's lockfile, or null when there is
202
+ * none. `opts.storeDir` points the package manager at a shared per-project
203
+ * store (ENG-349); `opts.offline` installs only from it. Pure.
204
+ */
205
+ export declare function installCommand(dir: string, exists?: (path: string) => boolean, opts?: InstallOptions): [string, string[]] | null;
113
206
  /**
114
207
  * GitHub "compare" link for a remote URL, so the person can open the pull
115
208
  * request in one click when `gh` isn't available. Null for non-GitHub remotes.
@@ -126,6 +219,7 @@ export type OpenPullRequest = (input: {
126
219
  draft: boolean;
127
220
  }) => Promise<{
128
221
  url: string;
222
+ number?: number;
129
223
  }>;
130
224
  export interface RunWorkspaceDeps {
131
225
  /** Tried first; `gh` on this computer is the fallback. */
@@ -137,6 +231,20 @@ export interface RunWorkspaceDeps {
137
231
  exists?: (path: string) => boolean;
138
232
  copyFile?: (from: string, to: string) => void;
139
233
  env?: NodeJS.ProcessEnv;
234
+ /** Shared package stores (defaults to `stores` next to the runs folder, i.e. `~/.compbox/stores`). */
235
+ storesRoot?: string;
236
+ /** How long an unused, clean run folder is kept before pruning (defaults to the config's runRetentionDays). */
237
+ retentionMs?: number;
238
+ /** Run folders that running or waiting jobs still use; never pruned. */
239
+ activeRunDirs?: () => string[] | Promise<string[]>;
240
+ /** A run folder's last-modified time in ms, or null when unknown. */
241
+ mtimeMs?: (path: string) => number | null;
242
+ /** Reads a lockfile; null when it can't be read. */
243
+ readFile?: (path: string) => Buffer | null;
244
+ /** Whether a process is alive (defaults to process.kill(pid, 0)). */
245
+ isPidAlive?: (pid: number) => boolean;
246
+ /** This process's pid, written into `.active` markers. */
247
+ pid?: number;
140
248
  }
141
249
  export declare class RunWorkspaceManager {
142
250
  private readonly run;
@@ -146,8 +254,26 @@ export declare class RunWorkspaceManager {
146
254
  private readonly copyFile;
147
255
  private readonly env;
148
256
  private readonly openPullRequest;
257
+ private readonly storesRoot;
258
+ private readonly retentionMs;
259
+ private readonly activeRunDirs;
260
+ private readonly mtimeMs;
261
+ private readonly readFile;
262
+ private readonly isPidAlive;
263
+ private readonly pid;
149
264
  constructor(deps?: RunWorkspaceDeps);
150
265
  private git;
266
+ /**
267
+ * Marks a run folder as in use (`<dir>.active`: pid + startedAt) and touches
268
+ * the folder, so a prune from another process never removes it. Called
269
+ * inside the repo lock. Best-effort.
270
+ */
271
+ private markActive;
272
+ private clearActive;
273
+ /** Whether a `.active` marker still protects this folder from pruning. */
274
+ private activeByMarker;
275
+ /** Removes `.active`/`.waiting` markers whose run folder is gone. Best-effort. */
276
+ private clearOrphanMarkers;
151
277
  /** Creates the branch + worktree for a run. Never touches the person's checkout. */
152
278
  /**
153
279
  * `opts.branch` makes this a fix run (ENG-296): work on that existing,
@@ -156,7 +282,24 @@ export declare class RunWorkspaceManager {
156
282
  */
157
283
  prepare(projectDir: string, epicId: string, opts?: {
158
284
  branch?: string;
285
+ activeRunDirs?: string[];
159
286
  }): Promise<PrepareResult>;
287
+ /**
288
+ * ENG-349: installs dependencies through a shared per-project store. When the
289
+ * store's marker matches this lockfile and package-manager version, installs
290
+ * offline from it (hard links for pnpm); if that fails, or there is no
291
+ * match, runs the full frozen install. The marker is read and written under
292
+ * the repo lock and only updated after a successful install.
293
+ */
294
+ private installDeps;
295
+ /**
296
+ * ENG-349: removes run folders under the runs folder that nothing uses any
297
+ * more. Runs inside the repo lock. A folder is removed only when it is older
298
+ * than the retention window, not used by a running job, not kept for a
299
+ * waiting job's reply, clean, and has no unpushed commits — and only with
300
+ * `git worktree remove` (never a plain delete). Returns how many went.
301
+ */
302
+ private pruneStaleRuns;
160
303
  /**
161
304
  * When neither the folder nor its remote has any commit, records one empty
162
305
  * commit on `main` (and pushes it) so runs can branch and open pull requests.
@@ -164,7 +307,40 @@ export declare class RunWorkspaceManager {
164
307
  * the folder is swept in: the person's files stay exactly as they were.
165
308
  */
166
309
  private startEmptyRepository;
310
+ /** The repository's remote: `origin`, else the first one, else null. */
311
+ private resolveRemote;
312
+ /** The branch pull requests target and the ref new branches start from. */
313
+ private resolveBase;
314
+ /**
315
+ * ENG-339: reopens the run copy a paused run kept (by its stored path, not
316
+ * by looking for an unfinished pushed branch: a copy with no commits sits
317
+ * on a branch that was never pushed). Verifies the folder is a worktree of
318
+ * this repository, inside CompBox's run folders, on the expected branch.
319
+ * When the folder was removed, re-creates it at the SAME path (Claude keys
320
+ * sessions by folder) from the local branch, or the pushed one. Runs the
321
+ * git steps inside the repo lock. Fails (so the caller runs fresh) rather
322
+ * than guessing.
323
+ */
324
+ reopen(input: ReopenInput): Promise<PrepareResult>;
325
+ /**
326
+ * ENG-346: installs the pre-push hook that refuses pushes to the default
327
+ * branch, in this run copy only (per-worktree core.hooksPath; see
328
+ * installPrePushGuard). Best-effort: a guard that can't be installed never
329
+ * stops a run (the agent's disallowed tools and gh shim still apply).
330
+ */
331
+ private guardPushes;
332
+ private reopenLocked;
333
+ /** A plain branch name: no leading '-', safe characters, and accepted by `git check-ref-format --branch`. */
334
+ private isValidBranchName;
167
335
  private createWorktree;
336
+ /**
337
+ * ENG-337: removes kept run folders (worktrees) that still have `branch`
338
+ * checked out, so a later run can check the branch out again. Runs inside
339
+ * the repo lock (from prepare). Only a folder that is clean, and whose branch
340
+ * has nothing unpushed, is removed; returns false (with a note) when a
341
+ * folder had to stay.
342
+ */
343
+ private releaseKeptWorktree;
168
344
  /** The newest pushed run branch for this epic that isn't merged into the base yet, if any. */
169
345
  private unfinishedBranch;
170
346
  /** A cancelled run's result: the branch and worktree are kept locally, untouched. */
@@ -172,6 +348,27 @@ export declare class RunWorkspaceManager {
172
348
  /** Commits, pushes and opens the pull request; then cleans up the worktree. */
173
349
  finish(input: FinishInput): Promise<FinishResult>;
174
350
  private finishLocked;
351
+ /**
352
+ * Puts a run's worktree back to its last commit after the wrap-up checks
353
+ * (ENG-327). Only check output can be there: the run's work was committed
354
+ * before the checks ran. Ignored files (node_modules, build caches) stay.
355
+ */
356
+ private discardCheckLeftovers;
357
+ /**
358
+ * Merges the latest base branch into the run's branch (ENG-327). Runs under
359
+ * the repo lock (from finish). Never rewrites history: a clean merge is a
360
+ * normal merge commit; conflicts go to one time-boxed agent turn limited to
361
+ * the conflicted files, and anything it doesn't settle — conflicts left,
362
+ * markers left, other files touched, or the commit failing — aborts the merge.
363
+ */
364
+ private mergeBaseLocked;
365
+ /** Paths git still marks as conflicted (unmerged). */
366
+ private conflictedFiles;
367
+ /**
368
+ * A fingerprint of everything outside `files`: the index entries, unstaged
369
+ * changes and untracked files. Any change means the conflict turn strayed.
370
+ */
371
+ private untouchableState;
175
372
  /** True when the worktree has uncommitted (or unreadable) state. */
176
373
  private isDirty;
177
374
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"run-workspace.d.ts","sourceRoot":"","sources":["../../src/utils/run-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAQH,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAErG,wEAAw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