sequant 2.9.0 → 2.10.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 (188) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +14 -3
  4. package/dist/bin/cli.js +97 -17
  5. package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +1 -1
  6. package/dist/marketplace/external_plugins/sequant/.mcp.json +1 -1
  7. package/dist/marketplace/external_plugins/sequant/README.md +56 -2
  8. package/dist/marketplace/external_plugins/sequant/hooks/parallel-marker.sh +50 -0
  9. package/dist/marketplace/external_plugins/sequant/hooks/post-tool.sh +20 -7
  10. package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +75 -10
  11. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/trust-model.md +18 -0
  12. package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +215 -390
  13. package/dist/marketplace/external_plugins/sequant/skills/assess/references/predicted-collision-detection.md +1 -1
  14. package/dist/marketplace/external_plugins/sequant/skills/docs/SKILL.md +4 -4
  15. package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +26 -6
  16. package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +3 -1
  17. package/dist/marketplace/external_plugins/sequant/skills/loop/SKILL.md +38 -2
  18. package/dist/marketplace/external_plugins/sequant/skills/merger/SKILL.md +2 -2
  19. package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +337 -57
  20. package/dist/marketplace/external_plugins/sequant/skills/qa/references/anti-pattern-detection.md +6 -6
  21. package/dist/marketplace/external_plugins/sequant/skills/qa/references/call-site-review.md +2 -2
  22. package/dist/marketplace/external_plugins/sequant/skills/qa/references/code-review-checklist.md +2 -2
  23. package/dist/marketplace/external_plugins/sequant/skills/qa/references/fixtures/injection-issue-body.md +36 -0
  24. package/dist/marketplace/external_plugins/sequant/skills/qa/references/quality-gates.md +21 -7
  25. package/dist/marketplace/external_plugins/sequant/skills/qa/references/testing-requirements.md +1 -1
  26. package/dist/marketplace/external_plugins/sequant/skills/qa/scripts/quality-checks.sh +11 -11
  27. package/dist/marketplace/external_plugins/sequant/skills/release/SKILL.md +1 -1
  28. package/dist/marketplace/external_plugins/sequant/skills/setup/SKILL.md +5 -5
  29. package/dist/marketplace/external_plugins/sequant/skills/spec/SKILL.md +2 -0
  30. package/dist/marketplace/external_plugins/sequant/skills/test/SKILL.md +1 -1
  31. package/dist/src/commands/assess-render.d.ts +23 -0
  32. package/dist/src/commands/assess-render.js +60 -0
  33. package/dist/src/commands/doctor.js +8 -13
  34. package/dist/src/commands/init.js +13 -1
  35. package/dist/src/commands/locks.js +2 -0
  36. package/dist/src/commands/logs.js +14 -5
  37. package/dist/src/commands/merge.js +154 -2
  38. package/dist/src/commands/ready-tui-adapter.js +6 -1
  39. package/dist/src/commands/ready.d.ts +25 -3
  40. package/dist/src/commands/ready.js +39 -13
  41. package/dist/src/commands/resume.d.ts +113 -0
  42. package/dist/src/commands/resume.js +193 -0
  43. package/dist/src/commands/run-display.js +37 -4
  44. package/dist/src/commands/run-flags.d.ts +42 -1
  45. package/dist/src/commands/run-flags.js +53 -1
  46. package/dist/src/commands/run-progress.js +26 -1
  47. package/dist/src/commands/run.js +11 -10
  48. package/dist/src/commands/state.js +7 -0
  49. package/dist/src/commands/status.d.ts +9 -0
  50. package/dist/src/commands/status.js +24 -1
  51. package/dist/src/commands/sync.js +90 -19
  52. package/dist/src/commands/update.js +28 -5
  53. package/dist/src/lib/ac-parser.d.ts +14 -0
  54. package/dist/src/lib/ac-parser.js +99 -5
  55. package/dist/src/lib/assess/index.d.ts +10 -0
  56. package/dist/src/lib/assess/index.js +9 -0
  57. package/dist/src/lib/assess/renderer.d.ts +64 -0
  58. package/dist/src/lib/assess/renderer.js +481 -0
  59. package/dist/src/lib/assess/types.d.ts +224 -0
  60. package/dist/src/lib/assess/types.js +241 -0
  61. package/dist/src/lib/ci/outputs.d.ts +15 -2
  62. package/dist/src/lib/ci/outputs.js +17 -5
  63. package/dist/src/lib/cli-flags.d.ts +33 -0
  64. package/dist/src/lib/cli-flags.js +46 -0
  65. package/dist/src/lib/cli-ui/run-renderer-types.d.ts +21 -7
  66. package/dist/src/lib/cli-ui/run-renderer.d.ts +10 -0
  67. package/dist/src/lib/cli-ui/run-renderer.js +62 -0
  68. package/dist/src/lib/errors.d.ts +78 -6
  69. package/dist/src/lib/errors.js +133 -15
  70. package/dist/src/lib/locks/index.d.ts +3 -3
  71. package/dist/src/lib/locks/index.js +2 -2
  72. package/dist/src/lib/locks/lock-manager.d.ts +20 -2
  73. package/dist/src/lib/locks/lock-manager.js +47 -3
  74. package/dist/src/lib/locks/types.d.ts +34 -3
  75. package/dist/src/lib/locks/types.js +16 -0
  76. package/dist/src/lib/mcp-config.d.ts +45 -0
  77. package/dist/src/lib/mcp-config.js +77 -1
  78. package/dist/src/lib/merge-check/combined-branch-test.d.ts +21 -2
  79. package/dist/src/lib/merge-check/combined-branch-test.js +233 -110
  80. package/dist/src/lib/merge-check/command-result.d.ts +36 -0
  81. package/dist/src/lib/merge-check/command-result.js +56 -0
  82. package/dist/src/lib/merge-check/index.d.ts +4 -0
  83. package/dist/src/lib/merge-check/index.js +1 -1
  84. package/dist/src/lib/merge-check/report.js +5 -1
  85. package/dist/src/lib/merge-check/types.d.ts +9 -0
  86. package/dist/src/lib/merge-check/watch.d.ts +121 -0
  87. package/dist/src/lib/merge-check/watch.js +215 -0
  88. package/dist/src/lib/qa/infra-blocked-ci.d.ts +90 -0
  89. package/dist/src/lib/qa/infra-blocked-ci.js +80 -0
  90. package/dist/src/lib/settings.d.ts +14 -0
  91. package/dist/src/lib/settings.js +61 -8
  92. package/dist/src/lib/shutdown.d.ts +42 -2
  93. package/dist/src/lib/shutdown.js +75 -5
  94. package/dist/src/lib/skills-check.d.ts +26 -0
  95. package/dist/src/lib/skills-check.js +31 -0
  96. package/dist/src/lib/stacks.d.ts +110 -1
  97. package/dist/src/lib/stacks.js +244 -5
  98. package/dist/src/lib/templates.d.ts +74 -0
  99. package/dist/src/lib/templates.js +171 -16
  100. package/dist/src/lib/test-tautology-detector.d.ts +9 -2
  101. package/dist/src/lib/test-tautology-detector.js +153 -12
  102. package/dist/src/lib/version-check.d.ts +31 -0
  103. package/dist/src/lib/version-check.js +45 -2
  104. package/dist/src/lib/workflow/batch-executor.d.ts +125 -6
  105. package/dist/src/lib/workflow/batch-executor.js +477 -44
  106. package/dist/src/lib/workflow/chain-resume.d.ts +13 -11
  107. package/dist/src/lib/workflow/chain-resume.js +24 -20
  108. package/dist/src/lib/workflow/completed-status.d.ts +52 -0
  109. package/dist/src/lib/workflow/completed-status.js +57 -0
  110. package/dist/src/lib/workflow/config-resolver.d.ts +26 -0
  111. package/dist/src/lib/workflow/config-resolver.js +54 -2
  112. package/dist/src/lib/workflow/drivers/agent-driver.d.ts +7 -0
  113. package/dist/src/lib/workflow/drivers/aider.d.ts +2 -0
  114. package/dist/src/lib/workflow/drivers/aider.js +2 -0
  115. package/dist/src/lib/workflow/drivers/claude-code.d.ts +14 -0
  116. package/dist/src/lib/workflow/drivers/claude-code.js +20 -2
  117. package/dist/src/lib/workflow/git-diff-utils.d.ts +35 -3
  118. package/dist/src/lib/workflow/git-diff-utils.js +77 -4
  119. package/dist/src/lib/workflow/heartbeat.d.ts +38 -0
  120. package/dist/src/lib/workflow/heartbeat.js +90 -0
  121. package/dist/src/lib/workflow/log-writer.d.ts +44 -1
  122. package/dist/src/lib/workflow/log-writer.js +75 -6
  123. package/dist/src/lib/workflow/metrics-schema.d.ts +3 -3
  124. package/dist/src/lib/workflow/phase-executor.d.ts +203 -14
  125. package/dist/src/lib/workflow/phase-executor.js +457 -52
  126. package/dist/src/lib/workflow/phase-registry.js +2 -1
  127. package/dist/src/lib/workflow/platforms/github.d.ts +64 -0
  128. package/dist/src/lib/workflow/platforms/github.js +152 -0
  129. package/dist/src/lib/workflow/qa-cache.d.ts +6 -1
  130. package/dist/src/lib/workflow/qa-cache.js +22 -9
  131. package/dist/src/lib/workflow/ready-gate.d.ts +17 -4
  132. package/dist/src/lib/workflow/ready-gate.js +25 -9
  133. package/dist/src/lib/workflow/run-log-schema.d.ts +14 -0
  134. package/dist/src/lib/workflow/run-log-schema.js +47 -1
  135. package/dist/src/lib/workflow/run-orchestrator.d.ts +19 -0
  136. package/dist/src/lib/workflow/run-orchestrator.js +141 -20
  137. package/dist/src/lib/workflow/skills-preflight.d.ts +89 -0
  138. package/dist/src/lib/workflow/skills-preflight.js +112 -0
  139. package/dist/src/lib/workflow/state-cleanup.js +9 -2
  140. package/dist/src/lib/workflow/state-manager.d.ts +33 -0
  141. package/dist/src/lib/workflow/state-manager.js +83 -0
  142. package/dist/src/lib/workflow/state-schema.d.ts +26 -0
  143. package/dist/src/lib/workflow/state-schema.js +47 -0
  144. package/dist/src/lib/workflow/types.d.ts +126 -4
  145. package/dist/src/lib/workflow/types.js +1 -0
  146. package/dist/src/lib/workflow/worktree-manager.d.ts +28 -2
  147. package/dist/src/lib/workflow/worktree-manager.js +102 -23
  148. package/dist/src/mcp/tools/run.d.ts +9 -1
  149. package/dist/src/mcp/tools/run.js +20 -1
  150. package/dist/src/mcp/tools/status.js +6 -0
  151. package/dist/src/ui/tui/ElapsedTimer.d.ts +12 -3
  152. package/dist/src/ui/tui/ElapsedTimer.js +12 -10
  153. package/dist/src/ui/tui/IssueBox.js +10 -2
  154. package/dist/src/ui/tui/row-cap.js +2 -1
  155. package/dist/src/ui/tui/theme.d.ts +7 -0
  156. package/dist/src/ui/tui/theme.js +9 -0
  157. package/package.json +8 -7
  158. package/templates/hooks/parallel-marker.sh +50 -0
  159. package/templates/hooks/post-tool.sh +20 -7
  160. package/templates/hooks/pre-tool.sh +75 -10
  161. package/templates/scripts/cleanup-worktree.sh +182 -19
  162. package/templates/scripts/new-feature.sh +264 -16
  163. package/templates/skills/_shared/references/trust-model.md +18 -0
  164. package/templates/skills/assess/SKILL.md +215 -390
  165. package/templates/skills/assess/references/predicted-collision-detection.md +1 -1
  166. package/templates/skills/docs/SKILL.md +4 -4
  167. package/templates/skills/exec/SKILL.md +26 -6
  168. package/templates/skills/fullsolve/SKILL.md +3 -1
  169. package/templates/skills/loop/SKILL.md +38 -2
  170. package/templates/skills/merger/SKILL.md +2 -2
  171. package/templates/skills/qa/SKILL.md +337 -57
  172. package/templates/skills/qa/references/anti-pattern-detection.md +6 -6
  173. package/templates/skills/qa/references/call-site-review.md +2 -2
  174. package/templates/skills/qa/references/code-review-checklist.md +2 -2
  175. package/templates/skills/qa/references/fixtures/injection-issue-body.md +36 -0
  176. package/templates/skills/qa/references/quality-gates.md +21 -7
  177. package/templates/skills/qa/references/testing-requirements.md +1 -1
  178. package/templates/skills/qa/scripts/quality-checks.sh +11 -11
  179. package/templates/skills/release/SKILL.md +1 -1
  180. package/templates/skills/setup/SKILL.md +5 -5
  181. package/templates/skills/spec/SKILL.md +2 -0
  182. package/templates/skills/test/SKILL.md +1 -1
  183. package/dist/src/lib/phase-spinner.d.ts +0 -146
  184. package/dist/src/lib/phase-spinner.js +0 -255
  185. package/dist/src/lib/workflow/pr-operations.d.ts +0 -86
  186. package/dist/src/lib/workflow/pr-operations.js +0 -326
  187. package/dist/src/lib/workflow/run-summary.d.ts +0 -36
  188. package/dist/src/lib/workflow/run-summary.js +0 -142
@@ -11,7 +11,7 @@ import { ShutdownManager } from "../shutdown.js";
11
11
  import { Phase, ExecutionConfig, PhaseResult, QaVerdict, PhasePauseHandle } from "./types.js";
12
12
  import type { QaSummary } from "./run-log-schema.js";
13
13
  import type { AgentPhaseResult, ResumeHandle } from "./drivers/index.js";
14
- import { SequantError } from "../errors.js";
14
+ import { RateLimitError, SequantError } from "../errors.js";
15
15
  /**
16
16
  * Leading + trailing throttle. Fires the wrapped callback immediately on the
17
17
  * first call, drops subsequent calls that arrive inside `intervalMs` but
@@ -67,7 +67,150 @@ export declare const RATE_LIMIT_RETRY_BACKOFF_MS = 5000;
67
67
  * @internal Exported for testing only
68
68
  */
69
69
  export declare function isWindowExhaustedRateLimit(error: SequantError | undefined, now?: number): boolean;
70
+ /**
71
+ * Buffer added to a rate-limit reset before waking (#804 AC-5). `resetsAt` is a
72
+ * floor, not an exact moment: clock skew between this host and the API, plus
73
+ * server-side rounding, otherwise produce an immediate second rejection on
74
+ * wake. One minute is negligible against the five-hour/seven-day windows this
75
+ * exists for.
76
+ *
77
+ * @internal Exported for testing only
78
+ */
79
+ export declare const AUTO_WAIT_BUFFER_MS: number;
80
+ /**
81
+ * Hard cap on auto-waits per issue (#804 AC-6), independent of the minutes
82
+ * budget. A window that is still closed on wake must not produce an unbounded
83
+ * pause loop, so the count bounds the *number* of pauses while
84
+ * `autoWaitMinutes` bounds their *total duration*. Either bound being spent
85
+ * halts with today's labeled message.
86
+ *
87
+ * @internal Exported for testing only
88
+ */
89
+ export declare const AUTO_WAIT_MAX_WAITS = 2;
90
+ /**
91
+ * Granularity of the auto-wait sleep (#804 AC-7). The wait is performed as a
92
+ * series of ticks rather than one multi-hour `delayFn` call so that (a) the
93
+ * renderer/heartbeat can be refreshed with the remaining time, and (b) a
94
+ * Ctrl-C is observed promptly instead of at the wake time.
95
+ *
96
+ * @internal Exported for testing only
97
+ */
98
+ export declare const AUTO_WAIT_TICK_MS: number;
99
+ /**
100
+ * Mutable per-issue accounting for auto-wait (#804 AC-6).
101
+ *
102
+ * Deliberately per-ISSUE, not per-phase: `executePhaseWithRetry` runs once per
103
+ * phase, so a ledger created inside it would grant every phase its own full
104
+ * budget and bound. `runIssueWithLogging` creates one and threads it through
105
+ * all of an issue's phases.
106
+ */
107
+ export interface AutoWaitLedger {
108
+ /** Total wait budget in ms. `0` disables auto-wait entirely. */
109
+ budgetMs: number;
110
+ /** Number of waits already granted for this issue. */
111
+ waits: number;
112
+ /** Cumulative ms already spent waiting for this issue. */
113
+ spentMs: number;
114
+ }
115
+ /**
116
+ * Build a fresh ledger from a minutes budget. A missing, negative or
117
+ * non-finite budget yields a disabled ledger (`budgetMs: 0`) — the default,
118
+ * which preserves pre-#804 behavior exactly.
119
+ */
120
+ export declare function createAutoWaitLedger(budgetMinutes?: number): AutoWaitLedger;
121
+ /**
122
+ * A granted auto-wait: how long to sleep, when to wake, and the narrowed
123
+ * rate-limit error that justified it (carried so callers need no cast).
124
+ */
125
+ export interface AutoWaitDecision {
126
+ /** Ms to sleep. Always > 0. */
127
+ waitMs: number;
128
+ /** Epoch ms to wake at — `resetsAt` normalized to ms, plus the buffer. */
129
+ wakeAtMs: number;
130
+ /** The rate limit that triggered the wait. Never a `BillingError`. */
131
+ error: RateLimitError;
132
+ }
133
+ /**
134
+ * Decide whether to wait out an exhausted rate-limit window (#804 AC-3).
135
+ *
136
+ * Deliberately separate from {@link isWindowExhaustedRateLimit} and
137
+ * {@link RATE_LIMIT_WINDOW_SKIP_THRESHOLD_MS}, which answer *"is this transient
138
+ * or exhausted?"*. This answers a different question — *"am I willing to wait
139
+ * that long?"* — and fires ONLY once the former is already true. Keeping them
140
+ * apart is what leaves `autoWaitMinutes` the single user-facing dial for the
141
+ * wait-vs-halt outcome.
142
+ *
143
+ * Returns `null` (no wait — halt as before) when:
144
+ * - auto-wait is off, or the per-issue wait count is spent;
145
+ * - the failure is not a window-exhausted `RateLimitError`. A `BillingError`
146
+ * lands here: it is a sibling class, not a subclass, so the `instanceof`
147
+ * check inside `isWindowExhaustedRateLimit` excludes it. That is load-bearing
148
+ * — a `BillingError` may still carry `resetsAt` (an explicit
149
+ * `credits_required`, or a window that has already passed — see the #860
150
+ * narrowing in `isBillingFailure`), so gating on the timestamp's presence
151
+ * instead of the error type would wait out a credits failure that no amount
152
+ * of waiting can heal (AC-4). Since #860, a *live* recognized window
153
+ * (`five_hour`/`seven_day*` + future reset) classifies as `RateLimitError`
154
+ * upstream even when `out_of_credits` is present, which is what lets the
155
+ * real captured subscription payloads reach this decision at all;
156
+ * - the reset has already passed (nothing to wait for);
157
+ * - the required wait exceeds the budget REMAINING, not the total (AC-6).
158
+ *
159
+ * @internal Exported for testing only
160
+ */
161
+ export declare function shouldAutoWaitForReset(error: SequantError | undefined, ledger: AutoWaitLedger, now?: number): AutoWaitDecision | null;
162
+ /**
163
+ * Sleep until an auto-wait's wake time, in ticks (#804 AC-7).
164
+ *
165
+ * Chunking the sleep is what makes a multi-hour pause survivable:
166
+ * - `onTick` refreshes the live display so the wait is visible rather than a
167
+ * silent stall (the #574 complaint at 60x scale);
168
+ * - each tick races the injected `delayFn` against the abort signal, so Ctrl-C
169
+ * returns immediately instead of blocking until the wake.
170
+ *
171
+ * Reuses the caller's `delayFn` so the wait stays fully test-injectable.
172
+ *
173
+ * Returns the ms actually slept and whether the wait was aborted.
174
+ *
175
+ * @internal Exported for testing only
176
+ */
177
+ export declare function waitForWindowReset(waitMs: number, options: {
178
+ delayFn: (ms: number) => Promise<void>;
179
+ signal?: AbortSignal;
180
+ onTick?: (remainingMs: number) => void;
181
+ now?: () => number;
182
+ tickMs?: number;
183
+ }): Promise<{
184
+ sleptMs: number;
185
+ aborted: boolean;
186
+ }>;
187
+ /**
188
+ * Run one granted auto-wait end to end (#804): emit the live notices, sleep,
189
+ * update the ledger, and report whether Ctrl-C interrupted it.
190
+ *
191
+ * Shared by both arms of the retry ladder (the cold-start loop and the
192
+ * `skipColdStartRetry` single-attempt path) so the two cannot drift on
193
+ * bookkeeping or messaging.
194
+ *
195
+ * @internal Exported for testing only
196
+ */
197
+ export declare function performAutoWait(issueNumber: number, phase: Phase, config: ExecutionConfig, decision: AutoWaitDecision, ledger: AutoWaitLedger, delayFn: (ms: number) => Promise<void>, shutdownManager?: ShutdownManager, spinner?: PhasePauseHandle): Promise<{
198
+ aborted: boolean;
199
+ }>;
70
200
  export declare function parseQaVerdict(output: string): QaVerdict | null;
201
+ /**
202
+ * Distinguish a QA turn that produced *no verdict at all* from one whose output
203
+ * was present but unparseable (#853). Returns true when the output is empty /
204
+ * whitespace, or when its tail contains deferral language — the agent treating
205
+ * its one-shot phase as if a later turn were available.
206
+ *
207
+ * Both cases are hard failures either way; this only refines which message is
208
+ * emitted, so a false positive is harmless (it swaps one failing message for
209
+ * another). Kept deliberately conservative and literal to stay ReDoS-safe.
210
+ *
211
+ * @internal Exported for testing only.
212
+ */
213
+ export declare function endedWithoutVerdict(output: string | undefined): boolean;
71
214
  /**
72
215
  * Parse condensed QA summary from QA phase output (#434).
73
216
  *
@@ -109,22 +252,59 @@ export declare function formatDuration(seconds: number): string;
109
252
  */
110
253
  export declare function resolveBaseRef(cwd: string): string;
111
254
  /**
112
- * Check whether the exec phase produced any changes in the worktree.
113
- * Returns true if HEAD has commits unique to it relative to the resolved
114
- * base ref (see {@link resolveBaseRef}) OR uncommitted work is present.
255
+ * Three-way classification of what the exec phase left in the worktree (#879).
115
256
  *
116
- * Uses `git rev-list --count <base>..HEAD` (commits reachable from HEAD
117
- * but not the base) instead of `git diff <base>..HEAD`, because the
118
- * two-dot diff also fires in reverse when the base has advanced past HEAD
119
- * on stale branches that would falsely report "has commits" even when the
120
- * exec phase produced nothing, reintroducing the bug #534 is fixing.
257
+ * - `commits`: HEAD has commits unique to it relative to the base ref real,
258
+ * deliverable work that can rebase, push, and become a PR.
259
+ * - `uncommitted`: no such commits, but the tree is dirty. This is NOT a
260
+ * deliverable: uncommitted work cannot rebase, push, or become a PR (#879's
261
+ * defect a dirty tree used to be counted as exec success, producing a run
262
+ * that "passed" with no commits and no PR). `paths` names the dirty files.
263
+ * - `none`: no commits and a clean tree — exec produced literally nothing
264
+ * (#534's original empty-branch class).
265
+ * - `unknown`: a git command failed. Callers fail OPEN on this (treat as work)
266
+ * — a transient git error is better diagnosed as a real run than as a
267
+ * spurious phase failure on every exec.
268
+ */
269
+ export type ExecChangeState = {
270
+ kind: "commits";
271
+ } | {
272
+ kind: "uncommitted";
273
+ paths: string[];
274
+ } | {
275
+ kind: "none";
276
+ } | {
277
+ kind: "unknown";
278
+ };
279
+ /**
280
+ * Classify what the exec phase produced in the worktree (#879).
281
+ *
282
+ * Uses `git rev-list --count <base>..HEAD` (commits reachable from HEAD but not
283
+ * the base) instead of `git diff <base>..HEAD`, because the two-dot diff also
284
+ * fires in reverse when the base has advanced past HEAD — on stale branches
285
+ * that would falsely report "has commits" even when exec produced nothing,
286
+ * reintroducing the bug #534 is fixing.
121
287
  *
122
288
  * The base ref defaults to `origin/main` but is overridden to the worktree's
123
- * recorded base (see #537) so zero-diff execs are still detected on
124
- * custom-base worktrees (e.g. those created with `--base feature/epic`).
289
+ * recorded base (see #537) so zero-diff execs are still detected on custom-base
290
+ * worktrees (e.g. those created with `--base feature/epic`).
125
291
  *
126
- * Fails open (returns true) on git errors a missing origin ref is better
127
- * diagnosed as a real zero-diff run than as a false phase failure.
292
+ * Read-only: runs only `git rev-list` and `git status --porcelain`, so it never
293
+ * mutates the worktree an exec phase that fails on an `uncommitted` result
294
+ * leaves the dirty files exactly where the agent left them (#879 AC-3).
295
+ *
296
+ * @internal Exported for testing only.
297
+ */
298
+ export declare function classifyExecChanges(cwd: string): ExecChangeState;
299
+ /**
300
+ * Check whether the exec phase produced deliverable work in the worktree.
301
+ *
302
+ * Thin boolean wrapper over {@link classifyExecChanges}: only `commits` (real
303
+ * work) and `unknown` (git error — fail open) count as "has changes". Note the
304
+ * #879 behaviour change: an `uncommitted`-only tree now returns **false**, since
305
+ * uncommitted work is not a deliverable. Both callers (the exec guard in
306
+ * {@link mapAgentSuccessToPhaseResult} and the ready gate) want this stricter
307
+ * semantics.
128
308
  *
129
309
  * @internal Exported for testing only.
130
310
  */
@@ -195,7 +375,16 @@ export declare function executePhaseWithRetry(issueNumber: number, phase: Phase,
195
375
  /** @internal Injected for testing — defaults to module-level executePhase */
196
376
  executePhaseFn?: typeof executePhase,
197
377
  /** @internal Injected for testing — defaults to setTimeout-based delay */
198
- delayFn?: (ms: number) => Promise<void>): Promise<PhaseResult & {
378
+ delayFn?: (ms: number) => Promise<void>,
379
+ /**
380
+ * Per-issue auto-wait accounting (#804). Deliberately the LAST parameter:
381
+ * the #761/#799 regression tests call this function positionally with
382
+ * `executePhaseFn` at 8 and `delayFn` at 9, and AC-2 requires those tests to
383
+ * pass unmodified. Defaults to a fresh disabled-or-config-derived ledger, so
384
+ * a caller that does not thread one still gets correct (bounded) behavior —
385
+ * just scoped to this phase rather than the issue.
386
+ */
387
+ autoWaitLedger?: AutoWaitLedger): Promise<PhaseResult & {
199
388
  sessionId?: string;
200
389
  resumeHandle?: ResumeHandle;
201
390
  }>;