@quantiya/codevibe-core 2.0.6 → 2.0.7

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 (159) hide show
  1. package/README.md +7 -5
  2. package/dist/agy-cli-contract.d.ts +14 -0
  3. package/dist/appsync/appsync-client.d.ts +59 -31
  4. package/dist/appsync/event-throttle.d.ts +33 -0
  5. package/dist/appsync/index.d.ts +3 -2
  6. package/dist/appsync/queries.d.ts +4 -2
  7. package/dist/auth/auth-telemetry.d.ts +26 -0
  8. package/dist/auth/vendor-key-cli.d.ts +49 -0
  9. package/dist/companion-mode/index.d.ts +36 -22
  10. package/dist/companion-mode/persist-preference.d.ts +1 -5
  11. package/dist/companion-mode/resolve-agent.d.ts +5 -4
  12. package/dist/config/config.d.ts +0 -5
  13. package/dist/credential-broker/__tests__/upstream-result-helpers.d.ts +21 -0
  14. package/dist/credential-broker/broker.d.ts +196 -12
  15. package/dist/credential-broker/chatgpt-config.d.ts +40 -0
  16. package/dist/credential-broker/index.d.ts +4 -1
  17. package/dist/credential-broker/oauth-account-lock.d.ts +104 -0
  18. package/dist/credential-broker/oauth-refresh.d.ts +72 -0
  19. package/dist/credential-broker/types.d.ts +165 -17
  20. package/dist/credential-broker/upstream-client.d.ts +3 -2
  21. package/dist/credential-broker/vendor-key-store.d.ts +32 -1
  22. package/dist/crypto/__tests__/encrypt-for-emit.test.d.ts +1 -0
  23. package/dist/crypto/encrypt-for-emit.d.ts +39 -0
  24. package/dist/crypto/index.d.ts +2 -0
  25. package/dist/daemon/__tests__/process-guards.test.d.ts +1 -0
  26. package/dist/daemon/index.d.ts +2 -0
  27. package/dist/daemon/process-guards.d.ts +38 -0
  28. package/dist/index.d.ts +17 -2
  29. package/dist/index.js +308 -281
  30. package/dist/keychain/keychain-manager.d.ts +25 -4
  31. package/dist/local-executor/__tests__/reviewer-rationale-flag.test.d.ts +1 -0
  32. package/dist/local-executor/class-a-sign.d.ts +15 -0
  33. package/dist/local-executor/group-decision-outcome.d.ts +11 -0
  34. package/dist/local-executor/implementor-argv.d.ts +89 -7
  35. package/dist/local-executor/local-executor-impl.d.ts +18 -7
  36. package/dist/local-executor/merge-conflict-resolve.d.ts +19 -0
  37. package/dist/local-executor/revert-reconcile.d.ts +12 -0
  38. package/dist/local-executor/reviewer-rationale-flag.d.ts +10 -0
  39. package/dist/local-executor/types.d.ts +1 -0
  40. package/dist/local-model/manager.d.ts +1 -1
  41. package/dist/local-model/ollama.d.ts +40 -0
  42. package/dist/orchestration/__tests__/detect-agents.test.d.ts +1 -0
  43. package/dist/orchestration/detect-agents.d.ts +10 -30
  44. package/dist/orchestration/index.d.ts +1 -2
  45. package/dist/orchestration-shell/__tests__/a1a-planner-offers.test.d.ts +1 -0
  46. package/dist/orchestration-shell/__tests__/a6-cli-surface.test.d.ts +1 -0
  47. package/dist/orchestration-shell/__tests__/advisory-attachments-dir-race.test.d.ts +1 -0
  48. package/dist/orchestration-shell/__tests__/advisory-multi-mention-panel.test.d.ts +1 -0
  49. package/dist/orchestration-shell/__tests__/advisory-panel-attachments.test.d.ts +1 -0
  50. package/dist/orchestration-shell/__tests__/advisory-quota-stdout-result.test.d.ts +1 -0
  51. package/dist/orchestration-shell/__tests__/agent-turn-context-batch.test.d.ts +1 -0
  52. package/dist/orchestration-shell/__tests__/bounded-shutdown.test.d.ts +1 -0
  53. package/dist/orchestration-shell/__tests__/brainstorm-quorum-wiring.test.d.ts +1 -0
  54. package/dist/orchestration-shell/__tests__/brainstorm-quorum.test.d.ts +1 -0
  55. package/dist/orchestration-shell/__tests__/cli-team-session-key.test.d.ts +1 -0
  56. package/dist/orchestration-shell/__tests__/command-intent.test.d.ts +1 -0
  57. package/dist/orchestration-shell/__tests__/context-compaction.test.d.ts +1 -0
  58. package/dist/orchestration-shell/__tests__/context-items-hosted-sync.test.d.ts +1 -0
  59. package/dist/orchestration-shell/__tests__/context-items-wiring.test.d.ts +1 -0
  60. package/dist/orchestration-shell/__tests__/context-items.test.d.ts +1 -0
  61. package/dist/orchestration-shell/__tests__/cp8-full-team-events.test.d.ts +1 -0
  62. package/dist/orchestration-shell/__tests__/cp8-team-decomposed-zk.test.d.ts +1 -0
  63. package/dist/orchestration-shell/__tests__/explicit-tty-exit.test.d.ts +1 -0
  64. package/dist/orchestration-shell/__tests__/mention-suggest.test.d.ts +1 -0
  65. package/dist/orchestration-shell/__tests__/route-browse-summarize-recovery.test.d.ts +1 -0
  66. package/dist/orchestration-shell/attachments.d.ts +58 -2
  67. package/dist/orchestration-shell/bounded-shutdown.d.ts +16 -0
  68. package/dist/orchestration-shell/brainstorm-quorum.d.ts +118 -0
  69. package/dist/orchestration-shell/cli.d.ts +97 -70
  70. package/dist/orchestration-shell/cli.js +30990 -22426
  71. package/dist/orchestration-shell/command-intent.d.ts +56 -0
  72. package/dist/orchestration-shell/components/InputBar.d.ts +6 -0
  73. package/dist/orchestration-shell/components/OrchestrationApp.d.ts +2 -0
  74. package/dist/orchestration-shell/context-compaction.d.ts +264 -0
  75. package/dist/orchestration-shell/context-items-hosted-sync.d.ts +19 -0
  76. package/dist/orchestration-shell/context-items.d.ts +408 -0
  77. package/dist/orchestration-shell/context-store.d.ts +162 -0
  78. package/dist/orchestration-shell/emit-shell-event.d.ts +34 -13
  79. package/dist/orchestration-shell/explicit-tty-exit.d.ts +18 -0
  80. package/dist/orchestration-shell/gate-prompts.d.ts +3 -3
  81. package/dist/orchestration-shell/index.d.ts +306 -37
  82. package/dist/orchestration-shell/mention-suggest.d.ts +11 -0
  83. package/dist/orchestration-shell/mode-selection.d.ts +4 -22
  84. package/dist/orchestration-shell/quorum-loop.d.ts +336 -20
  85. package/dist/orchestration-shell/task-progress.d.ts +2 -0
  86. package/dist/orchestration-shell/team-decompose.d.ts +37 -19
  87. package/dist/orchestration-shell/types.d.ts +71 -4
  88. package/dist/planner/index.d.ts +1 -1
  89. package/dist/planner/local-advisory.d.ts +12 -0
  90. package/dist/planner/local-gemma.d.ts +27 -0
  91. package/dist/planner/types.d.ts +7 -0
  92. package/dist/reviewer/index.d.ts +0 -2
  93. package/dist/reviewer/provider.d.ts +9 -6
  94. package/dist/reviewer/providers/antigravity.d.ts +2 -3
  95. package/dist/reviewer/registry.d.ts +9 -4
  96. package/dist/reviewer/token-usage.d.ts +10 -0
  97. package/dist/session/__tests__/device-registration-lease.test.d.ts +1 -0
  98. package/dist/session/__tests__/pending-session-create.test.d.ts +1 -0
  99. package/dist/session/__tests__/session-rekey-fingerprint.test.d.ts +1 -0
  100. package/dist/session/__tests__/session-resume-key-reconciliation.test.d.ts +1 -0
  101. package/dist/session/__tests__/session-resume-pending-first.test.d.ts +1 -0
  102. package/dist/session/device-key-watcher.d.ts +1 -0
  103. package/dist/session/index.d.ts +4 -2
  104. package/dist/session/pending-session-create.d.ts +61 -0
  105. package/dist/session/register-device-key.d.ts +11 -1
  106. package/dist/session/session-rekey.d.ts +4 -5
  107. package/dist/session/session-resume.d.ts +21 -1
  108. package/dist/substrate/docker.d.ts +7 -0
  109. package/dist/substrate/sandbox-exec.d.ts +17 -3
  110. package/dist/substrate/types.d.ts +32 -3
  111. package/dist/substrate-launch/apikey-bootstrap.d.ts +24 -1
  112. package/dist/substrate-launch/engage-substrate.d.ts +17 -0
  113. package/dist/substrate-launch/sanitized-env.d.ts +5 -5
  114. package/dist/tool-activity/__tests__/consolidator.test.d.ts +1 -0
  115. package/dist/tool-activity/__tests__/digest.test.d.ts +1 -0
  116. package/dist/tool-activity/__tests__/flock-rollout-lock.test.d.ts +1 -0
  117. package/dist/tool-activity/__tests__/ledger.test.d.ts +1 -0
  118. package/dist/tool-activity/__tests__/outbox.test.d.ts +1 -0
  119. package/dist/tool-activity/__tests__/replay-cursor.test.d.ts +1 -0
  120. package/dist/tool-activity/__tests__/session-map.test.d.ts +1 -0
  121. package/dist/tool-activity/__tests__/socket-rollout-lock.test.d.ts +1 -0
  122. package/dist/tool-activity/atomic-file.d.ts +27 -0
  123. package/dist/tool-activity/consolidator.d.ts +253 -0
  124. package/dist/tool-activity/digest.d.ts +4 -0
  125. package/dist/tool-activity/flock-rollout-lock.d.ts +68 -0
  126. package/dist/tool-activity/index.d.ts +9 -0
  127. package/dist/tool-activity/ledger.d.ts +274 -0
  128. package/dist/tool-activity/outbox.d.ts +60 -0
  129. package/dist/tool-activity/replay-cursor.d.ts +156 -0
  130. package/dist/tool-activity/session-map.d.ts +133 -0
  131. package/dist/tool-activity/socket-rollout-lock.d.ts +57 -0
  132. package/dist/tool-activity/types.d.ts +368 -0
  133. package/dist/types/encryption.d.ts +4 -0
  134. package/dist/types/events.d.ts +24 -4
  135. package/dist/types/session.d.ts +32 -2
  136. package/package.json +5 -4
  137. package/dist/orchestration/orchestration-cli.d.ts +0 -12
  138. package/dist/orchestration/setup-bootstrap.d.ts +0 -146
  139. package/dist/orchestration/setup-failure-recourse.d.ts +0 -23
  140. package/dist/orchestration/setup-save.d.ts +0 -47
  141. package/dist/orchestration/setup-seat-picker.d.ts +0 -72
  142. package/dist/orchestration/setup-telemetry.d.ts +0 -54
  143. package/dist/orchestration/setup-test-agents.d.ts +0 -108
  144. package/dist/orchestration/setup-types.d.ts +0 -146
  145. package/dist/orchestration/setup-wizard.d.ts +0 -57
  146. package/dist/orchestration-shell/cohort-flag.d.ts +0 -16
  147. package/dist/reviewer/providers/gemini.d.ts +0 -109
  148. /package/dist/{companion-mode/__tests__/detect-parallel.test.d.ts → appsync/__tests__/appsync-client-context-items.test.d.ts} +0 -0
  149. /package/dist/{orchestration-shell/__tests__/cli-stub-session-adapter.test.d.ts → appsync/__tests__/heartbeat-active.test.d.ts} +0 -0
  150. /package/dist/{orchestration/__tests__/setup-bootstrap.test.d.ts → appsync/__tests__/orphan-sweep-null-heartbeat.test.d.ts} +0 -0
  151. /package/dist/{orchestration/__tests__/setup-failure-recourse.test.d.ts → auth/__tests__/vendor-key-cli.test.d.ts} +0 -0
  152. /package/dist/{orchestration/__tests__/setup-save.test.d.ts → companion-mode/__tests__/mode-selected-emit.test.d.ts} +0 -0
  153. /package/dist/{orchestration/__tests__/setup-seat-picker.test.d.ts → companion-mode/__tests__/private-launcher-detection.test.d.ts} +0 -0
  154. /package/dist/{orchestration/__tests__/setup-telemetry.test.d.ts → companion-mode/__tests__/private-launcher-path.test.d.ts} +0 -0
  155. /package/dist/{orchestration/__tests__/setup-test-agents.test.d.ts → credential-broker/__tests__/broker-c4.test.d.ts} +0 -0
  156. /package/dist/{orchestration/__tests__/setup-types.test.d.ts → credential-broker/__tests__/broker-streaming.test.d.ts} +0 -0
  157. /package/dist/{orchestration/__tests__/setup-wizard.test.d.ts → credential-broker/__tests__/chatgpt-config.test.d.ts} +0 -0
  158. /package/dist/{reviewer/providers/__tests__/gemini-live-smoke.test.d.ts → credential-broker/__tests__/oauth-account-lock.test.d.ts} +0 -0
  159. /package/dist/{reviewer/providers/__tests__/gemini.test.d.ts → credential-broker/__tests__/oauth-refresh.test.d.ts} +0 -0
@@ -1,20 +1,4 @@
1
1
  import { Mode, Tier } from './types';
2
- /**
3
- * Thrown when a Free-tier user explicitly requests `--mode orchestration`.
4
- * Per §2 + §16 LOCK #1: Orchestration Mode is Pro/Max-gated; Free-tier
5
- * users hit this error with the upgrade URL.
6
- */
7
- export declare class TierError extends Error {
8
- constructor(message: string);
9
- }
10
- /**
11
- * Parsed arguments the entrypoint hands to `pickMode`. Either flag is
12
- * optional; a value of `undefined` means "not specified".
13
- */
14
- export interface ParsedModeArgs {
15
- /** `--mode companion` | `--mode orchestration` | undefined */
16
- mode?: Mode;
17
- }
18
2
  /**
19
3
  * Test seam — lets the unit tests inject a deterministic prompt
20
4
  * callback instead of opening a real TTY.
@@ -28,15 +12,13 @@ export interface ModeSelectionDeps {
28
12
  * read or written here.
29
13
  *
30
14
  * Rules:
31
- * 1. Free-tier + `--mode orchestration` → `TierError` with upgrade URL.
32
- * 2. Explicit `--mode` flag → honor it.
33
- * 3. Free-tier (no flag) → 'companion'.
34
- * 4. Pro/Max (no flag) → always prompt the user (sticky preference is
15
+ * 1. Free-tier → 'companion'.
16
+ * 2. Pro/Max → always prompt the user (sticky preference is
35
17
  * never consulted; the answer is not persisted).
36
18
  */
37
- export declare function pickMode(args: ParsedModeArgs, tier: Tier, deps?: ModeSelectionDeps): Promise<Mode>;
19
+ export declare function pickMode(tier: Tier, deps?: ModeSelectionDeps): Promise<Mode>;
38
20
  /**
39
21
  * Default deps wiring — production callers can omit `deps` from
40
- * `pickMode()` and get this. Tests override via the optional 3rd arg.
22
+ * `pickMode()` and get this. Tests override via the optional 2nd arg.
41
23
  */
42
24
  export declare function defaultDeps(): ModeSelectionDeps;
@@ -3,6 +3,7 @@ import type { Session } from '../types';
3
3
  import type { LocalExecutor } from '../local-executor';
4
4
  import type { ImageAttachment } from './types';
5
5
  import { type ImplementorMode } from '../local-executor/implementor-argv';
6
+ import { type FallbackLadderDeps } from '../substrate-launch/fallback-ladder';
6
7
  import type { ConflictModelCaller } from '../local-executor/class2-resolver';
7
8
  import type { ConflictResolverContext } from '../local-executor/merge-conflict-resolve';
8
9
  import type { AgentKind } from '../local-executor/types';
@@ -16,7 +17,7 @@ import { ReviewerRegistry } from '../reviewer/registry';
16
17
  import { type ReviewerFailureReason } from '../reviewer/provider';
17
18
  import type { SubstrateHandle } from '../substrate/types';
18
19
  import type { VerdictClassifier } from '../reviewer/verdict-classifier';
19
- import type { AgentKind as ReviewerAgentKind, ReviewerRole } from '../reviewer/types';
20
+ import type { AgentKind as ReviewerAgentKind, ReviewerRole, VerdictKind } from '../reviewer/types';
20
21
  import type { OnProgress } from './task-progress';
21
22
  import { runShellCommand } from '../local-executor/verification-gates/shell-runner';
22
23
  import type { PostDecisionAction, Tier } from './types';
@@ -60,7 +61,7 @@ export declare function classifyImplementorRoundFailure(err: unknown): string;
60
61
  * Fixtures (L1):
61
62
  * - Codex (PINNED — CP-13 §0/§2-D1 live sample): `You've hit your usage limit
62
63
  * … try again at <date>` → match on `usage limit` (case-insensitive).
63
- * - Claude / Gemini: TBD — CP-13 has not captured real samples. Inventing
64
+ * - Claude: TBD — CP-13 has not captured real samples. Inventing
64
65
  * strings risks a FALSE-NEGATIVE classifier that misses a real quota error,
65
66
  * so they are left as additive one-liners to fill once real samples land.
66
67
  * An UNMATCHED quota error degrades FAIL-SAFE to the existing born-halt
@@ -135,6 +136,76 @@ export declare function selectFinalTier2Reviewer(detected: readonly AgentKind[],
135
136
  * and never falls through. Pure; NEVER throws.
136
137
  */
137
138
  export declare function selectFinalTier2Candidates(detected: readonly AgentKind[], resolverAgents: ReadonlySet<string>, override?: AgentKind | null): AgentKind[];
139
+ /**
140
+ * A1b — ONE reviewer verdict as captured desktop-side at `submitVerdict`,
141
+ * BEFORE the engine flattens the round's panel into free-text
142
+ * `ReviseSeatFinding.findings`. This is what lets round N's revise brief carry
143
+ * the STRUCTURED findings of rounds < N-1 (the "addressing 0 findings" /
144
+ * re-flagging-fixed-issues fix) without any wire change.
145
+ */
146
+ export interface RoundFindingRecord {
147
+ /** The gate round the verdict reviewed (0-based, from `roundByGateId`). */
148
+ round: number;
149
+ /** Numeric seat id as a string (matches `ReviseSeatFinding.seatId` shape). */
150
+ seatId: string;
151
+ role: ReviewerRole;
152
+ reviewerAgent: ReviewerAgentKind;
153
+ verdict: VerdictKind;
154
+ /** Capped to HISTORY_SUGGESTION_MAX_CHARS each at capture. */
155
+ suggestedChanges: string[];
156
+ /** Capped to HISTORY_REASONING_MAX_CHARS at capture. Stored for audit /
157
+ * bounded reuse; NOT rendered into the brief (the brief carries verdict +
158
+ * suggested changes only). */
159
+ reasoning: string;
160
+ }
161
+ /**
162
+ * A1b — ONE implementor rationale entry (Stage-2 R1 Codex LOW-4: the round is
163
+ * RECORDED with the text, so a round that produced no summary can never drift
164
+ * the labeling — consumers render the entry's ACTUAL round, never an inferred
165
+ * `nextRound - 1`).
166
+ */
167
+ export interface RationaleEntry {
168
+ /** The implementor round that produced this summary (0-based). */
169
+ round: number;
170
+ /** The summary text, char-capped at capture (RATIONALE_ENTRY_MAX_CHARS). */
171
+ text: string;
172
+ }
173
+ /**
174
+ * A1d / P2 resolver-intent (design §5 — the resolver's need-to-know projection:
175
+ * "conflicted paths + 3-way markers + both tracks' intent diffs + each track's
176
+ * brief + task intent"). ALL fields optional + already BOUNDED by the caller
177
+ * (`RESOLVER_INTENT_DIFF_MAX_BYTES` / `RESOLVER_TRACK_BRIEF_MAX_BYTES`);
178
+ * absent/empty ⇒ the brief is byte-identical to the pre-A1d shape (graceful
179
+ * degrade — mirrors the A1b rationale posture).
180
+ */
181
+ export interface ResolverIntentContext {
182
+ /** The INCOMING track's brief (the THEIRS side's task intent), bounded. */
183
+ incomingBrief?: string | null;
184
+ /** The incoming track's index (labeling only). */
185
+ incomingTrackIndex?: number;
186
+ /**
187
+ * Briefs of the group's OTHER registered tracks (the OURS side — the
188
+ * integration tip is the base plus the already-merged tracks), bounded,
189
+ * sorted by trackIndex.
190
+ */
191
+ integrationBriefs?: readonly {
192
+ trackIndex: number;
193
+ brief: string;
194
+ }[];
195
+ /** Bounded base→trackTip unified diff (THEIRS intent), or a placeholder line. */
196
+ incomingIntentDiff?: string | null;
197
+ /** Bounded base→integrationTip unified diff (OURS intent), or a placeholder line. */
198
+ integrationIntentDiff?: string | null;
199
+ }
200
+ /**
201
+ * CP-14 WB2 (D1, locked) — the brief delivered on the resolver agent's stdin. It
202
+ * enumerates the class-2 conflicted paths (which carry 3-way markers), instructs
203
+ * write-in-place + remove EVERY marker, and tells the agent that ONLY its edits to
204
+ * the listed files are kept (selective import — any other edit is discarded). The
205
+ * agent may read other files + run build/test to verify, but those artifacts do
206
+ * not import (they only help it converge).
207
+ */
208
+ declare function renderAgenticResolveBrief(conflictedPaths: readonly string[], implementorRationale?: string | null, intent?: ResolverIntentContext): string;
138
209
  /**
139
210
  * CP-7 §8 (Stage-1-resolved) — the narrow result the QuorumLoop consumes from
140
211
  * the reviewer substrate engager. Mirrors `SubstrateLaunch.EngageResult` /
@@ -210,6 +281,19 @@ export interface QuorumLoopDeps {
210
281
  getSessionKey: (sessionId: string) => Promise<string | null>;
211
282
  /** Working dir for spawned subprocesses (canonicalized). */
212
283
  workingDir: string;
284
+ /**
285
+ * A1d (Stage-2 R1 Codex MED) — test seams for the RESOLVER-SPECIFIC
286
+ * construction probe (`probeResolverDispatchConfinement`). `ladderDeps`
287
+ * stubs the §6 Q2 substrate ladder; `trustedContainer` stubs the
288
+ * trusted-container boundary check. ABSENT (production) → the real ladder +
289
+ * `isTrustedContainerBoundary`. The probe decides only whether the agentic
290
+ * closure is WIRED — the dispatch-time `requireConfined` engage remains the
291
+ * sole load-bearing confinement gate.
292
+ */
293
+ resolverProbeDeps?: {
294
+ ladderDeps?: FallbackLadderDeps;
295
+ trustedContainer?: () => boolean;
296
+ };
213
297
  /**
214
298
  * CP-14 Wave A — the team execution model. `worktree_merge` makes each team
215
299
  * track commit to a persistent branch (the merge-before-push spine) instead of
@@ -247,6 +331,25 @@ export interface QuorumLoopDeps {
247
331
  * independent of implementor sandboxing (which has its own engager).
248
332
  */
249
333
  engageReviewerSubstrate?: ReviewerSubstrateEngager;
334
+ /**
335
+ * A1e (P3 slice-wiring REMAP) — compose the bounded repository-context
336
+ * block for a task dispatch: the resolved `context_ref` structural slice
337
+ * (`mintContextRef` → `resolveContextRef` → `sliceSummary`) + the FRESH-ONLY
338
+ * `repo_state` overview (design §8.3 freshness — a stale record fires the
339
+ * background re-delegation and is NEVER projected). Wired by `cli.ts` to a
340
+ * tap holder; `runOrchestrationShell` installs the real composer
341
+ * (`composeDispatchContextBlock`) — the progressTap late-binding pattern.
342
+ * Appended to the ROUND-0 implementor STDIN payload ONLY (never
343
+ * `args.brief`, which becomes the execute-first `task_brief` → the
344
+ * reviewer prompts — the same self-visibility boundary as the A1b prior-
345
+ * rationale block). Returns `''` for "no block". ABSENT (legacy / companion
346
+ * / tests) → byte-identical stdin (no projection).
347
+ */
348
+ projectDispatchContext?: (input: {
349
+ taskId: string;
350
+ agent: AgentKind;
351
+ roundNumber: number;
352
+ }) => Promise<string>;
250
353
  /**
251
354
  * CP-1.f LOCK RP-6 — this orchestration host's detected coding agents
252
355
  * (UPPERCASE `CLAUDE` / `CODEX` / `GEMINI`), computed ONCE by `cli.ts` via
@@ -339,6 +442,7 @@ export interface QuorumLoopDeps {
339
442
  taskGroupId: string;
340
443
  trackIndex: number;
341
444
  state: 'Passed' | 'Failed';
445
+ resolvedBy: 'engine' | 'user';
342
446
  }) => void;
343
447
  /**
344
448
  * PHASE-589/469 W3.1 (C1) — the durable revert-manifest store. For a TEAM
@@ -501,6 +605,46 @@ export declare class QuorumLoop {
501
605
  * task's notes.
502
606
  */
503
607
  private readonly userNotesByTask;
608
+ /**
609
+ * A1b — STRUCTURED reviewer findings accumulated across ALL of a task's
610
+ * review rounds, captured at `submitVerdict` (the desktop-local hook where
611
+ * the full `ReviewerVerdict` passes through BEFORE the engine flattens the
612
+ * panel to free-text `ReviseSeatFinding.findings`). Round N's revise brief
613
+ * renders rounds < N-1 from here as the `## Findings history` section, so
614
+ * the implementor SEES what earlier rounds flagged (the "addressing 0
615
+ * findings" / re-flagging-fixed-issues fix) with NO wire change.
616
+ *
617
+ * Desktop-local capture is design-correct for GA: the locked shared-context
618
+ * design's single-write-authority means ONE desktop runs ALL of a task's
619
+ * seats, so every verdict for the task passes through THIS process's
620
+ * `submitVerdict` (multi-desktop seat fan-out is post-GA; a cross-desktop
621
+ * history store would be designed then). Lifecycle mirrors `userNotesByTask`
622
+ * exactly: cleared on promote / discard / round-0 restart replacement.
623
+ */
624
+ private readonly roundHistoryByTask;
625
+ /**
626
+ * A1b — the implementor's own per-round stdout rationale (the
627
+ * `extractAgentSummary` text), recorded as `{ round, text }` (LOW-4: labels
628
+ * come from the RECORDED round — a summary-less round can never drift them),
629
+ * bounded per entry, newest last. Three bounded consumers:
630
+ * 1. The NEXT revise round's implementor stdin (`## Your prior rationale`,
631
+ * ≤ PRIOR_RATIONALE_BRIEF_MAX_BYTES) — self-visibility only; it rides
632
+ * the stdin, NEVER the task_brief the reviewers see.
633
+ * 2. The agentic class-2 resolver brief (≤ RATIONALE_RESOLVER_MAX_BYTES,
634
+ * ungated — the resolver is intent-starved by design).
635
+ * 3. Reviewer packets, ONLY behind the DEFAULT-OFF
636
+ * OQ-REVIEWER-RATIONALE flag, as a labeled UNTRUSTED claim.
637
+ * Lifecycle mirrors `userNotesByTask` (promote / terminal discard / restart
638
+ * clear; PRESERVED across the non-terminal quota-fork/takeover discards).
639
+ */
640
+ private readonly rationaleByTask;
641
+ /**
642
+ * A1b — gate → the round number its implementor ran (set beside
643
+ * `taskByGateId` in `runImplementorRound`), so `submitVerdict` can stamp the
644
+ * verdict's `RoundFindingRecord.round`. Same append-only lifecycle as
645
+ * `taskByGateId` (per QuorumLoop life; bounded by the session's gate count).
646
+ */
647
+ private readonly roundByGateId;
504
648
  /** Seats with a reviewer subprocess currently running, keyed `gateId::seatId`. */
505
649
  private readonly runningSeats;
506
650
  /** Seats whose verdict has been submitted, keyed `gateId::seatId`. */
@@ -1116,13 +1260,26 @@ export declare class QuorumLoop {
1116
1260
  testSurfaces: string[];
1117
1261
  trackIndex: number;
1118
1262
  };
1263
+ /**
1264
+ * A1b — the implementor's OWN summary from the prior round, threaded by
1265
+ * `handleReviseFeedback` so the revise implementor does not re-derive its
1266
+ * own reasoning. Appended to the STDIN payload ONLY (self-visibility) —
1267
+ * NEVER to `args.brief`, which becomes the execute-first `task_brief`
1268
+ * rendered into the reviewer prompts (OQ-REVIEWER-RATIONALE: GA reviewers
1269
+ * see NO rationale; the flag-gated reviewer path is separate).
1270
+ */
1271
+ priorRationale?: {
1272
+ round: number;
1273
+ text: string;
1274
+ };
1119
1275
  }): Promise<void>;
1120
1276
  /**
1121
1277
  * Extract the agent's informational stdout summary (audit-only; reviewers
1122
1278
  * never see it — they review the captured diff). Best-effort: a failure to
1123
1279
  * read the summary is NON-fatal (the diff is the source of truth). For Codex
1124
- * the clean reply is the `--output-last-message` temp file; for Gemini it is
1125
- * the JSON envelope's `.response`; Claude `--print` is clean stdout.
1280
+ * the clean reply is the `--output-last-message` temp file; Claude
1281
+ * `--print --output-format json` is unwrapped to `.result`. (Gemini was SUNSET
1282
+ * in 2026-07 — its JSON-envelope unwrap branch was removed; it is never spawned.)
1126
1283
  */
1127
1284
  private extractAgentSummary;
1128
1285
  /**
@@ -1164,6 +1321,17 @@ export declare class QuorumLoop {
1164
1321
  * `gateId` is the track's CURRENT round-N reviewer_quorum gate; REQUIRED for a
1165
1322
  * revisable reason (the engine rejects a revisable marker without it). The
1166
1323
  * TERMINAL-reason callers omit it.
1324
+ *
1325
+ * @returns `autoRevised` — whether the engine's AUTHORITATIVE returned
1326
+ * `trackState` was non-`Failed` (W2 auto-revise: the track stays InFlight and
1327
+ * a `REVISE_FEEDBACK` for the SAME taskId follows). A1b (Stage-2 R2 Codex
1328
+ * MEDIUM-1): the revisable-reason callers key their `discardShadow`
1329
+ * `preserveReviseContext` on THIS, so an auto-revised track's revise round
1330
+ * still sees the accumulated notes/history/rationale, while a genuinely
1331
+ * terminal track (Failed return, thrown/absent marker → state unknown, no
1332
+ * taskGroupId) clears as before. A thrown marker whose write actually landed
1333
+ * server-side is the one lossy edge (the engine may revise while the desktop
1334
+ * cleared) — that degrades to the pre-A1b contextless brief, never worse.
1167
1335
  */
1168
1336
  private reportTeamTrackFailure;
1169
1337
  /**
@@ -1233,7 +1401,26 @@ export declare class QuorumLoop {
1233
1401
  * runImplementorRound) the behavior is exactly as before — discard whatever is
1234
1402
  * currently mapped for the task.
1235
1403
  */
1236
- discardShadow(taskId: string, expected?: WorkspaceShadow): Promise<void>;
1404
+ discardShadow(taskId: string, expected?: WorkspaceShadow, opts?: {
1405
+ /**
1406
+ * A1b (Stage-2 R1 Codex MEDIUM-1) — set by the NON-terminal discard
1407
+ * callers where the TASK continues on the SAME taskId after the shadow
1408
+ * is gone: the quota fork (`handleQuotaExhaustedFork` → continuation →
1409
+ * `resumeFromContinuation(input.taskId)`) and the four mid-round
1410
+ * `handoffClaimed` takeover suppressions (a `/continue request` /
1411
+ * foreign-accept claims the handoff, then the continuation resumes the
1412
+ * same task). On those paths the accumulated revise context — binding
1413
+ * user notes, structured findings history, implementor rationale — MUST
1414
+ * survive into the resumed rounds; wiping it here was exactly the
1415
+ * "resume starts amnesiac" defect. Terminal discards (user
1416
+ * reject/abort, policy rejection, born-halt, round failure,
1417
+ * all-agents-exhausted) omit this and clear as before. If the user
1418
+ * DECLINES the continuation offer, the preserved maps simply linger
1419
+ * until the task's eventual terminal (bounded: per-task caps), or
1420
+ * process end — an accepted, documented residual.
1421
+ */
1422
+ preserveReviseContext?: boolean;
1423
+ }): Promise<void>;
1237
1424
  private discardShadowLocked;
1238
1425
  /**
1239
1426
  * CP-1.f execute-first (#PR-1/#PR-3) — promote the task's shadow onto the real
@@ -1431,6 +1618,36 @@ export declare class QuorumLoop {
1431
1618
  caller: ConflictModelCaller;
1432
1619
  teardown: () => Promise<void>;
1433
1620
  } | null>;
1621
+ /**
1622
+ * A1d (Stage-2 R1 Codex MED) — the RESOLVER-SPECIFIC construction probe:
1623
+ * can the DISPATCH-time `requireConfined` engage establish a confining
1624
+ * substrate on this host? Wire-vs-legacy ONLY — the dispatch's own engage
1625
+ * (`spawnImplementor({ requireConfined: true })`) remains the sole
1626
+ * load-bearing gate; a probe mistake can never yield an unconfined spawn.
1627
+ *
1628
+ * - A real §6 Q2 ladder tier (`sandbox_exec` / `docker`) → ESTABLISHABLE.
1629
+ * A5 covers EVERY agent: the CP-7 broker substrate for the
1630
+ * provider-backed agents (CLAUDE/CODEX) AND the A1d write-confined
1631
+ * resolver row for the broker-less agents (GEMINI/ANTIGRAVITY). The
1632
+ * docker tier covers the provider-backed agents; a broker-less track's
1633
+ * slot on that tier fail-closes at dispatch to the clean
1634
+ * `dispatch_unconfined` human-gate (FD-2) — no worse than unwired for
1635
+ * that slot, and it does not block provider-backed slots in the group.
1636
+ * - No tier + trusted container → ESTABLISHABLE (the PRESERVED
1637
+ * D5-AMEND-1 posture: the closure wires and every slot fail-closes
1638
+ * cleanly at dispatch — dogfood-verified 2026-07-03, 101ms human-gate).
1639
+ * - No tier, no container → NOT establishable → the closure stays
1640
+ * unwired, keeping today's IMMEDIATE legacy human-gate instead of
1641
+ * converting it into a per-slot spawn-time fail-close.
1642
+ *
1643
+ * Deliberately DECOUPLED from `engageWaveBConfinement` and its
1644
+ * `CODEVIBE_SANDBOX_REVIEWERS` opt-in: that flag gates REVIEWER sandboxing
1645
+ * (per-seat, `makeConflictModelCaller`, Tier-2) exactly as before — riding
1646
+ * it here made the A1d resolver row unreachable on the default bare host.
1647
+ * The ladder select is side-effect-free (no launch, no broker); test seams
1648
+ * via `deps.resolverProbeDeps`.
1649
+ */
1650
+ private probeResolverDispatchConfinement;
1434
1651
  /**
1435
1652
  * CP-14 WB2 §2.1/§2.2/§2.3 — build the AGENTIC class-2 resolver, or `null` on
1436
1653
  * path C (no confinement). When wired, a slot's class-2 conflicts are resolved
@@ -1438,11 +1655,18 @@ export declare class QuorumLoop {
1438
1655
  * disposable repo, then fd-safe selective-importing ONLY the conflicted files.
1439
1656
  * SECURITY-CRITICAL — fail-closed on BOTH layers:
1440
1657
  *
1441
- * 1. CONSTRUCTION-time (mirrors `makeConflictModelCaller` returning null): probe
1442
- * `engageWaveBConfinement` ONCE against the loop workdir; path C → return
1443
- * `null` → `resolveAgentic` is NOT set on the context → a fresh class-2
1444
- * conflict takes the legacy `caller` path (which on path C is the
1445
- * CONFINEMENT-UNAVAILABLE caller → human-gate). Byte-identical to today.
1658
+ * 1. CONSTRUCTION-time — the RESOLVER-SPECIFIC probe (A1d, Stage-2 R1 Codex
1659
+ * MED): `probeResolverDispatchConfinement` wires the closure iff the
1660
+ * DISPATCH-time engage could establish a confining substrate on this
1661
+ * host (a real §6 Q2 ladder tier, or the preserved trusted-container
1662
+ * posture). Deliberately DECOUPLED from `engageWaveBConfinement`'s
1663
+ * `CODEVIBE_SANDBOX_REVIEWERS` opt-in — that flag gates REVIEWER
1664
+ * sandboxing (seat/`makeConflictModelCaller`/Tier-2, unchanged), and
1665
+ * riding it here made the A1d write-confined resolver row unreachable
1666
+ * on the default bare-host path. Unwired → return `null` →
1667
+ * `resolveAgentic` is NOT set on the context → a fresh class-2 conflict
1668
+ * takes the legacy `caller` path (which on path C is the
1669
+ * CONFINEMENT-UNAVAILABLE caller → human-gate).
1446
1670
  * 2. DISPATCH-time (Stage-2 Codex HIGH — confinement BOUND TO THE ACTUAL SPAWN):
1447
1671
  * `dispatchImplementor` spawns with `requireConfined: true`, so
1448
1672
  * `LocalExecutor.spawnImplementor` → `engageSubstrateForSpawn` THROWS
@@ -1717,20 +1941,44 @@ export declare class QuorumLoop {
1717
1941
  * literal NEVER appearing in this file. The branch is `NODE_ENV==='test'`-gated
1718
1942
  * so it is never evaluated in prod regardless.
1719
1943
  */
1944
+ /**
1945
+ * #585 §5.5 / L2 + GA [A2] — parse the force-quota test seam's VALUE grammar.
1946
+ * Returns `null` outside `NODE_ENV === 'test'` or when the fragment-assembled
1947
+ * force-quota env var is unset. The env-var KEY is assembled from fragments so
1948
+ * the force-quota literal NEVER appears verbatim in the published bundle (the
1949
+ * `verify-no-test-hooks` CI grep asserts its absence); the whole gate is ALSO
1950
+ * `NODE_ENV==='test'`-gated so it is never evaluated in prod.
1951
+ *
1952
+ * Value grammar (GA [A2] additive extension — same env var, no new hook, so
1953
+ * the hostile-grep list is unchanged):
1954
+ * - `<AGENT>` — classic mode: synthetic quota stderr + forced
1955
+ * EMPTY diff → drives the born-halt continuation
1956
+ * fork (the `continuation-handoff-quota` E2E).
1957
+ * - `<AGENT>:partial` — mid-task partial-diff mode: synthetic quota
1958
+ * stderr, but the captured diff is KEPT so the
1959
+ * loop's submit-partial-to-review degradation is
1960
+ * exercised instead of the fork (an implementor
1961
+ * quota-killed MID-TASK with partial work present).
1962
+ * Both segments are case-insensitive.
1963
+ */
1964
+ private forcedQuotaSpec;
1720
1965
  /**
1721
1966
  * #585 §5.5 / L2 — the SINGLE source of the force-quota test gate. Returns true
1722
1967
  * when (a) `NODE_ENV === 'test'` AND (b) the fragment-assembled force-quota env
1723
- * var names `agent`. The env-var KEY is assembled from fragments so the
1724
- * force-quota literal NEVER appears verbatim in the published bundle (the
1725
- * `verify-no-test-hooks` CI grep asserts its absence);
1726
- * the whole gate is ALSO `NODE_ENV==='test'`-gated so it is never evaluated in
1727
- * prod. Drives BOTH the synthetic quota stderr (`resolveQuotaClassificationText`)
1728
- * AND the forced empty-diff born-halt (`runImplementorRound` capture site) — the
1729
- * two halves that make the `continuation-handoff-quota` E2E reproducible (a real
1730
- * model will not deterministically exit with NO diff, which the quota fork
1731
- * requires).
1968
+ * var names `agent` (either value-grammar mode — see `forcedQuotaSpec`).
1969
+ * Drives BOTH the synthetic quota stderr (`resolveQuotaClassificationText`)
1970
+ * AND the capture-site diff handling (`runImplementorRound`): classic mode
1971
+ * forces the EMPTY-diff born-halt (a real model will not deterministically
1972
+ * exit with NO diff, which the quota fork requires); `:partial` mode keeps
1973
+ * the captured diff (GA [A2] — validates submit-partial-to-review).
1732
1974
  */
1733
1975
  private isForcedQuotaAgent;
1976
+ /**
1977
+ * GA [A2] — true when the force-quota seam is armed in `:partial` mode (see
1978
+ * `forcedQuotaSpec` grammar). Only meaningful alongside `isForcedQuotaAgent`;
1979
+ * prod-unreachable through the same `NODE_ENV==='test'` gate.
1980
+ */
1981
+ private isForcedQuotaPartialDiffMode;
1734
1982
  /**
1735
1983
  * Test seam — force the ROUND-0 implementor agent (overriding the session
1736
1984
  * default). `NODE_ENV==='test'`-gated; the env key is fragment-assembled so the
@@ -1864,6 +2112,61 @@ export declare class QuorumLoop {
1864
2112
  * user requirement.
1865
2113
  */
1866
2114
  private buildReviseBrief;
2115
+ /**
2116
+ * A1b — append one structured reviewer verdict to the task's findings
2117
+ * history (called from `submitVerdict`). Per-field caps bound each record
2118
+ * (reasoning ≤ HISTORY_REASONING_MAX_CHARS, each suggestion ≤
2119
+ * HISTORY_SUGGESTION_MAX_CHARS); a per-(task, round) SOFT byte cap degrades
2120
+ * later same-round records to verdict-only stubs (seat + verdict stay
2121
+ * visible; the byte-heavy narrative is dropped) so a pathological panel can
2122
+ * never balloon the in-memory history.
2123
+ */
2124
+ private recordRoundFinding;
2125
+ /**
2126
+ * A1b — record the implementor's own per-round summary as its rationale,
2127
+ * stamped with the round that produced it (LOW-4). Empty/whitespace
2128
+ * summaries are skipped (the entry's ABSENCE is what keeps labels honest —
2129
+ * a later consumer renders the newest entry's OWN round, never an inferred
2130
+ * one); each entry is char-capped and the per-task list keeps only the
2131
+ * newest RATIONALE_MAX_ENTRIES (defensive — a task's round count is already
2132
+ * bounded upstream).
2133
+ */
2134
+ private recordImplementorRationale;
2135
+ /**
2136
+ * A1b — the task's accumulated rationale as ONE bounded string (newest
2137
+ * entries win: oldest are dropped first, and the survivor text is hard
2138
+ * byte-capped). `null` when the task has no rationale (or no task resolved)
2139
+ * so callers can keep their no-rationale shape byte-identical.
2140
+ */
2141
+ private boundedRationale;
2142
+ /**
2143
+ * A1d / P2 resolver-intent (design §5/§8.1) — build the bounded INTENT
2144
+ * projection for one agentic slot resolve:
2145
+ *
2146
+ * - "each track's brief + task intent" → the INCOMING track's brief
2147
+ * (THEIRS) + the group's other registered tracks' briefs (OURS — the
2148
+ * integration tip is the base plus the already-merged tracks), from the
2149
+ * desktop-local `activeBriefByTask` registry (never on the wire), each
2150
+ * capped to `RESOLVER_TRACK_BRIEF_MAX_BYTES`.
2151
+ * - "both tracks' intent diffs" → bounded `base→theirs` / `base→ours`
2152
+ * hermetic diffs (≤ `RESOLVER_INTENT_DIFF_MAX_BYTES` per side). An
2153
+ * over-budget/unreadable side degrades to a placeholder line; a
2154
+ * binary/non-UTF-8-bearing diff (NUL / U+FFFD) likewise (mirrors the
2155
+ * Tier-2 bundle's placeholder discipline). `baseSha` absent (the
2156
+ * reconstruction-replay caller) → no diffs.
2157
+ *
2158
+ * GRACEFUL-DEGRADE, never gating: intent is an ADDITIVE projection — a
2159
+ * failure to compute any piece must not human-gate a resolve that succeeds
2160
+ * without it (the final-tip Tier-2 gate re-reviews fail-closed regardless).
2161
+ */
2162
+ private buildResolverIntentContext;
2163
+ /**
2164
+ * A1b — the newest recorded rationale entry for a task (or undefined),
2165
+ * shaped for `runImplementorRound`'s `priorRationale`. The label is the
2166
+ * entry's OWN recorded round (LOW-4) — never an inferred `nextRound - 1`,
2167
+ * which drifts when the immediately previous round produced no summary.
2168
+ */
2169
+ private latestPriorRationale;
1867
2170
  /** @internal — test introspection. */
1868
2171
  get _runningSeatsForTests(): ReadonlySet<string>;
1869
2172
  /** @internal — test introspection. */
@@ -1872,6 +2175,19 @@ export declare class QuorumLoop {
1872
2175
  _setActiveTaskForTests(taskId: string, brief?: string): void;
1873
2176
  /** @internal — read a task's accumulated binding user notes. */
1874
2177
  _userNotesForTests(taskId: string): readonly string[];
2178
+ /** @internal — A1b: read a task's accumulated structured findings history. */
2179
+ _roundHistoryForTests(taskId: string): readonly RoundFindingRecord[];
2180
+ /** @internal — A1b: read a task's accumulated implementor rationale entries. */
2181
+ _rationaleForTests(taskId: string): readonly RationaleEntry[];
2182
+ /** @internal — A1b: the bounded rationale slice a resolver/reviewer consumer gets. */
2183
+ _boundedRationaleForTests(taskId: string | undefined, maxBytes: number): string | null;
2184
+ /** @internal — A1d: the bounded resolver-intent projection for one slot resolve. */
2185
+ _buildResolverIntentContextForTests(args: {
2186
+ implementorTaskId: string;
2187
+ oursCommit: string;
2188
+ theirsCommit: string;
2189
+ baseSha?: string;
2190
+ }): Promise<ResolverIntentContext>;
1875
2191
  /** @internal — read the consumed REVISE_FEEDBACK dedup ids (Stage-2 r1 guard). */
1876
2192
  get _seenReviseFeedbackIdsForTests(): ReadonlySet<string>;
1877
2193
  /** @internal — read the live in-memory shadow handle for a task (or undefined). */
@@ -1897,4 +2213,4 @@ export declare class QuorumLoop {
1897
2213
  _replaceShadowForRound0UnlockedForTests(taskId: string): Promise<void>;
1898
2214
  _ensureShadowUnlockedForTests(taskId: string): Promise<WorkspaceShadow>;
1899
2215
  }
1900
- export { reviewerAgentToLeAgent };
2216
+ export { reviewerAgentToLeAgent, renderAgenticResolveBrief };
@@ -67,6 +67,8 @@ export type TaskProgressEvent = ({
67
67
  phase: 'planner_classifying';
68
68
  } | {
69
69
  phase: 'familiarizing';
70
+ } | {
71
+ phase: 'agent_advisory';
70
72
  } | {
71
73
  phase: 'progress_cleared';
72
74
  }) & {
@@ -42,7 +42,7 @@ export declare const WorkItemInputSchema: z.ZodDiscriminatedUnion<"decompose", [
42
42
  test_surfaces: string[];
43
43
  auto_modified_files: string[];
44
44
  }>;
45
- implementorAgent: z.ZodEffects<z.ZodEnum<["CLAUDE", "CODEX", "GEMINI", "ANTIGRAVITY"]>, "CLAUDE" | "GEMINI" | "CODEX" | "ANTIGRAVITY", unknown>;
45
+ implementorAgent: z.ZodEffects<z.ZodEnum<["CLAUDE", "CODEX", "ANTIGRAVITY"]>, "CLAUDE" | "CODEX" | "ANTIGRAVITY", unknown>;
46
46
  isSharedTestOwner: z.ZodBoolean;
47
47
  description: z.ZodString;
48
48
  }, "strip", z.ZodTypeAny, {
@@ -56,7 +56,7 @@ export declare const WorkItemInputSchema: z.ZodDiscriminatedUnion<"decompose", [
56
56
  test_surfaces: string[];
57
57
  auto_modified_files: string[];
58
58
  };
59
- implementorAgent: "CLAUDE" | "GEMINI" | "CODEX" | "ANTIGRAVITY";
59
+ implementorAgent: "CLAUDE" | "CODEX" | "ANTIGRAVITY";
60
60
  isSharedTestOwner: boolean;
61
61
  }, {
62
62
  description: string;
@@ -85,7 +85,7 @@ export declare const WorkItemInputSchema: z.ZodDiscriminatedUnion<"decompose", [
85
85
  test_surfaces: string[];
86
86
  auto_modified_files: string[];
87
87
  };
88
- implementorAgent: "CLAUDE" | "GEMINI" | "CODEX" | "ANTIGRAVITY";
88
+ implementorAgent: "CLAUDE" | "CODEX" | "ANTIGRAVITY";
89
89
  isSharedTestOwner: boolean;
90
90
  }[];
91
91
  }, {
@@ -127,27 +127,37 @@ export type DecomposerResult = {
127
127
  reason: string;
128
128
  };
129
129
  /**
130
- * Read the implementor's FINAL message text per-agent (§3.B / L9). Unlike
131
- * `extractAgentSummary` (which returns '' for Codex because the diff is the
132
- * single-impl contract), the DECOMPOSER needs the actual reply text — so for
133
- * Codex we read AND unlink the `--output-last-message` temp file. A Codex
134
- * decomposer would otherwise always parse-fail on its `--json` JSONL stdout.
130
+ * Read the implementor's FINAL message text per-agent (§3.B / L9). For Codex
131
+ * we read AND unlink the `--output-last-message` temp file (a Codex decomposer
132
+ * would otherwise always parse-fail on its `--json` JSONL stdout). Since A1b
133
+ * the file branch delegates to the SHARED `readImplementorLastMessage` helper
134
+ * (the same read `extractAgentSummary` uses), threading `workdir` so a
135
+ * SUBSTRATE-relocated capture file is found at `<workdir>/<basename>` — the
136
+ * decomposer runs through `LocalExecutor.spawnImplementor` with a synthetic
137
+ * taskId, so CP-7 DOES engage for it and the relocation applies. Unlike
138
+ * `extractAgentSummary`, the decomposer reads even on a NON-ZERO exit (a
139
+ * partial reply may still parse) — the exit-code gate stays a quorum-loop
140
+ * concern.
135
141
  * - Claude → `capture.kind === 'stdout'` → `handle.stdout()`.
136
- * - Codex → `capture.kind === 'file'` → read+unlink the temp file.
137
- * - Gemini → stdout, unwrap the `{ response }` JSON envelope.
142
+ * - Codex → `capture.kind === 'file'` → shared read+unlink helper.
138
143
  * NEVER throws — a capture error returns '' (→ the caller's parse-fail →
139
144
  * single-task fallback).
140
145
  */
141
146
  export declare function readImplementorFinalMessage(plan: ReturnType<typeof buildImplementorArgv>, handle: {
142
147
  stdout: () => string;
143
- }, agent: AgentKind, exitCode: number): Promise<string>;
148
+ }, agent: AgentKind, exitCode: number, workdir?: string): Promise<string>;
144
149
  /**
145
150
  * Build the decomposition prompt fed to the local decomposer on stdin (§3.B).
146
151
  * `brief` is the composed lossless implementation brief (§3.D step 0).
147
152
  * `availableAgents` is the DETECTED set (§3.C) — the strengths list is filtered
148
153
  * to it, and the decomposer is told to pick `implementorAgent` from it.
154
+ * `repoContext` (A1e slice-wiring REMAP) is the OPTIONAL bounded repository-
155
+ * context block (`composeDispatchContextBlock` — the resolved `context_ref`
156
+ * slice + the fresh-only `repo_state` overview), appended verbatim so the
157
+ * decomposer partitions with the SAME grounded repo picture the implementors
158
+ * get. Empty/absent → the prompt is byte-identical to pre-A1e.
149
159
  */
150
- export declare function buildDecomposerPrompt(brief: string, availableAgents: AgentKind[]): string;
160
+ export declare function buildDecomposerPrompt(brief: string, availableAgents: AgentKind[], repoContext?: string): string;
151
161
  /**
152
162
  * #590 — append a deterministic "allowed test files" line to a track's brief so
153
163
  * the implementor agent writes its own-module tests at the EXACT declared
@@ -184,13 +194,21 @@ export interface RunLocalDecomposerDeps {
184
194
  * the first detected agent; CP-7 engages because `role:'implementor'` + a
185
195
  * (synthetic) `taskId` are passed.
186
196
  */
187
- export declare function runLocalDecomposer(deps: RunLocalDecomposerDeps, brief: string, availableAgents: AgentKind[]): Promise<DecomposerResult>;
197
+ export declare function runLocalDecomposer(deps: RunLocalDecomposerDeps, brief: string, availableAgents: AgentKind[],
188
198
  /**
189
- * Validate + normalize each work item's `implementorAgent` against the DETECTED
190
- * agent set (§3.C — v1 is DETECTED-ONLY; NO capability-health filtering, NO
191
- * per-spawn auth-recheck). For each item: `.toUpperCase()`-normalize the
192
- * suggested agent; keep it if detected; else SUBSTITUTE the first detected
193
- * agent. If NO agent is detected → `null` (the caller falls back to single).
194
- * Returns NEW work items (does not mutate the inputs).
199
+ * A1e (slice-wiring REMAP) — the optional bounded repository-context block
200
+ * (`composeDispatchContextBlock`), appended to the decomposer prompt so the
201
+ * partitioning is grounded in the same projected repo picture the
202
+ * implementors get. Empty/absent → byte-identical prompt.
203
+ */
204
+ repoContext?: string): Promise<DecomposerResult>;
205
+ /**
206
+ * Validate + normalize each work item's `implementorAgent` against the active
207
+ * detected agent set (§3.C — v1 is DETECTED-ONLY; NO capability-health
208
+ * filtering, NO per-spawn auth-recheck). For each item:
209
+ * `.toUpperCase()`-normalize the suggested agent; keep it if active +
210
+ * detected; else SUBSTITUTE the first active detected agent. If NO active
211
+ * agent is detected → `null` (the caller falls back to single). Returns NEW
212
+ * work items (does not mutate the inputs).
195
213
  */
196
214
  export declare function validateAgentAvailability(workItems: DecomposerWorkItem[], detected: AgentKind[]): DecomposerWorkItem[] | null;