audit-tools 0.32.19 → 0.32.22

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 (202) hide show
  1. package/dist/audit/clarification/blastRadius.d.ts +23 -0
  2. package/dist/audit/clarification/blastRadius.d.ts.map +1 -0
  3. package/dist/audit/clarification/blastRadius.js +65 -0
  4. package/dist/audit/clarification/blastRadius.js.map +1 -0
  5. package/dist/audit/clarification/dials.d.ts +28 -0
  6. package/dist/audit/clarification/dials.d.ts.map +1 -0
  7. package/dist/audit/clarification/dials.js +37 -0
  8. package/dist/audit/clarification/dials.js.map +1 -0
  9. package/dist/audit/clarification/partition.d.ts +25 -0
  10. package/dist/audit/clarification/partition.d.ts.map +1 -0
  11. package/dist/audit/clarification/partition.js +77 -0
  12. package/dist/audit/clarification/partition.js.map +1 -0
  13. package/dist/audit/clarification/riskGate.d.ts +24 -0
  14. package/dist/audit/clarification/riskGate.d.ts.map +1 -0
  15. package/dist/audit/clarification/riskGate.js +38 -0
  16. package/dist/audit/clarification/riskGate.js.map +1 -0
  17. package/dist/audit/clarification/voiQueue.d.ts +17 -0
  18. package/dist/audit/clarification/voiQueue.d.ts.map +1 -0
  19. package/dist/audit/clarification/voiQueue.js +37 -0
  20. package/dist/audit/clarification/voiQueue.js.map +1 -0
  21. package/dist/audit/cli/auditStep.d.ts +2 -0
  22. package/dist/audit/cli/auditStep.d.ts.map +1 -1
  23. package/dist/audit/cli/auditStep.js +9 -1
  24. package/dist/audit/cli/auditStep.js.map +1 -1
  25. package/dist/audit/cli/charterClarificationPrompt.d.ts +19 -0
  26. package/dist/audit/cli/charterClarificationPrompt.d.ts.map +1 -0
  27. package/dist/audit/cli/charterClarificationPrompt.js +60 -0
  28. package/dist/audit/cli/charterClarificationPrompt.js.map +1 -0
  29. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
  30. package/dist/audit/cli/nextStepCommand.js +74 -0
  31. package/dist/audit/cli/nextStepCommand.js.map +1 -1
  32. package/dist/audit/cli/nextStepHelpers.d.ts +62 -0
  33. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  34. package/dist/audit/cli/nextStepHelpers.js +129 -0
  35. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  36. package/dist/audit/cli/steps.d.ts +4 -4
  37. package/dist/audit/cli/steps.d.ts.map +1 -1
  38. package/dist/audit/cli/steps.js +2 -0
  39. package/dist/audit/cli/steps.js.map +1 -1
  40. package/dist/audit/io/artifacts.d.ts +6 -0
  41. package/dist/audit/io/artifacts.d.ts.map +1 -1
  42. package/dist/audit/io/artifacts.js +2 -0
  43. package/dist/audit/io/artifacts.js.map +1 -1
  44. package/dist/audit/orchestrator/advance.d.ts +23 -0
  45. package/dist/audit/orchestrator/advance.d.ts.map +1 -1
  46. package/dist/audit/orchestrator/advance.js +122 -4
  47. package/dist/audit/orchestrator/advance.js.map +1 -1
  48. package/dist/audit/orchestrator/advanceTypes.d.ts +22 -1
  49. package/dist/audit/orchestrator/advanceTypes.d.ts.map +1 -1
  50. package/dist/audit/orchestrator/charterClarificationExecutor.d.ts +28 -0
  51. package/dist/audit/orchestrator/charterClarificationExecutor.d.ts.map +1 -0
  52. package/dist/audit/orchestrator/charterClarificationExecutor.js +130 -0
  53. package/dist/audit/orchestrator/charterClarificationExecutor.js.map +1 -0
  54. package/dist/audit/orchestrator/dependencyMap.d.ts +2 -0
  55. package/dist/audit/orchestrator/dependencyMap.d.ts.map +1 -1
  56. package/dist/audit/orchestrator/dependencyMap.js +24 -0
  57. package/dist/audit/orchestrator/dependencyMap.js.map +1 -1
  58. package/dist/audit/orchestrator/designReviewPrompt.d.ts +17 -0
  59. package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
  60. package/dist/audit/orchestrator/designReviewPrompt.js +50 -0
  61. package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
  62. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  63. package/dist/audit/orchestrator/executorRunners.js +4 -0
  64. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  65. package/dist/audit/orchestrator/executors.d.ts.map +1 -1
  66. package/dist/audit/orchestrator/executors.js +20 -0
  67. package/dist/audit/orchestrator/executors.js.map +1 -1
  68. package/dist/audit/orchestrator/nextStep.d.ts +11 -1
  69. package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
  70. package/dist/audit/orchestrator/nextStep.js +6 -2
  71. package/dist/audit/orchestrator/nextStep.js.map +1 -1
  72. package/dist/audit/orchestrator/staleness.d.ts +27 -1
  73. package/dist/audit/orchestrator/staleness.d.ts.map +1 -1
  74. package/dist/audit/orchestrator/staleness.js +33 -16
  75. package/dist/audit/orchestrator/staleness.js.map +1 -1
  76. package/dist/audit/orchestrator/state.d.ts +12 -1
  77. package/dist/audit/orchestrator/state.d.ts.map +1 -1
  78. package/dist/audit/orchestrator/state.js +41 -2
  79. package/dist/audit/orchestrator/state.js.map +1 -1
  80. package/dist/audit/orchestrator/synthesisExecutors.d.ts.map +1 -1
  81. package/dist/audit/orchestrator/synthesisExecutors.js +1 -0
  82. package/dist/audit/orchestrator/synthesisExecutors.js.map +1 -1
  83. package/dist/audit/orchestrator/systemicChallengeExecutor.d.ts +25 -0
  84. package/dist/audit/orchestrator/systemicChallengeExecutor.d.ts.map +1 -0
  85. package/dist/audit/orchestrator/systemicChallengeExecutor.js +107 -0
  86. package/dist/audit/orchestrator/systemicChallengeExecutor.js.map +1 -0
  87. package/dist/audit/reporting/mergeFindings.d.ts +2 -1
  88. package/dist/audit/reporting/mergeFindings.d.ts.map +1 -1
  89. package/dist/audit/reporting/mergeFindings.js +6 -1
  90. package/dist/audit/reporting/mergeFindings.js.map +1 -1
  91. package/dist/audit/reporting/synthesis.d.ts +2 -0
  92. package/dist/audit/reporting/synthesis.d.ts.map +1 -1
  93. package/dist/audit/reporting/synthesis.js +1 -1
  94. package/dist/audit/reporting/synthesis.js.map +1 -1
  95. package/dist/audit/systemic/aggregateMetricsDigest.d.ts +11 -0
  96. package/dist/audit/systemic/aggregateMetricsDigest.d.ts.map +1 -0
  97. package/dist/audit/systemic/aggregateMetricsDigest.js +84 -0
  98. package/dist/audit/systemic/aggregateMetricsDigest.js.map +1 -0
  99. package/dist/audit/systemic/metricsDigestTypes.d.ts +35 -0
  100. package/dist/audit/systemic/metricsDigestTypes.d.ts.map +1 -0
  101. package/dist/audit/systemic/metricsDigestTypes.js +10 -0
  102. package/dist/audit/systemic/metricsDigestTypes.js.map +1 -0
  103. package/dist/audit/systemic/secondOrderAdversaryPrompt.d.ts +16 -0
  104. package/dist/audit/systemic/secondOrderAdversaryPrompt.d.ts.map +1 -0
  105. package/dist/audit/systemic/secondOrderAdversaryPrompt.js +85 -0
  106. package/dist/audit/systemic/secondOrderAdversaryPrompt.js.map +1 -0
  107. package/dist/audit/systemic/systemicChallengeLoop.d.ts +48 -0
  108. package/dist/audit/systemic/systemicChallengeLoop.d.ts.map +1 -0
  109. package/dist/audit/systemic/systemicChallengeLoop.js +107 -0
  110. package/dist/audit/systemic/systemicChallengeLoop.js.map +1 -0
  111. package/dist/audit/types/charterClarification.d.ts +52 -0
  112. package/dist/audit/types/charterClarification.d.ts.map +1 -0
  113. package/dist/audit/types/charterClarification.js +2 -0
  114. package/dist/audit/types/charterClarification.js.map +1 -0
  115. package/dist/audit/types/systemicChallenge.d.ts +69 -0
  116. package/dist/audit/types/systemicChallenge.d.ts.map +1 -0
  117. package/dist/audit/types/systemicChallenge.js +2 -0
  118. package/dist/audit/types/systemicChallenge.js.map +1 -0
  119. package/dist/remediate/phases/triage.d.ts.map +1 -1
  120. package/dist/remediate/phases/triage.js +16 -1
  121. package/dist/remediate/phases/triage.js.map +1 -1
  122. package/dist/remediate/steps/dispatch/acceptNode.d.ts +178 -0
  123. package/dist/remediate/steps/dispatch/acceptNode.d.ts.map +1 -0
  124. package/dist/remediate/steps/dispatch/acceptNode.js +351 -0
  125. package/dist/remediate/steps/dispatch/acceptNode.js.map +1 -0
  126. package/dist/remediate/steps/dispatch/common.d.ts +123 -0
  127. package/dist/remediate/steps/dispatch/common.d.ts.map +1 -0
  128. package/dist/remediate/steps/dispatch/common.js +236 -0
  129. package/dist/remediate/steps/dispatch/common.js.map +1 -0
  130. package/dist/remediate/steps/dispatch/dagNodeFields.d.ts +37 -0
  131. package/dist/remediate/steps/dispatch/dagNodeFields.d.ts.map +1 -0
  132. package/dist/remediate/steps/dispatch/dagNodeFields.js +19 -0
  133. package/dist/remediate/steps/dispatch/dagNodeFields.js.map +1 -0
  134. package/dist/remediate/steps/dispatch/implementPrompt.d.ts +70 -0
  135. package/dist/remediate/steps/dispatch/implementPrompt.d.ts.map +1 -0
  136. package/dist/remediate/steps/dispatch/implementPrompt.js +577 -0
  137. package/dist/remediate/steps/dispatch/implementPrompt.js.map +1 -0
  138. package/dist/remediate/steps/dispatch/marshal.d.ts +32 -0
  139. package/dist/remediate/steps/dispatch/marshal.d.ts.map +1 -0
  140. package/dist/remediate/steps/dispatch/marshal.js +935 -0
  141. package/dist/remediate/steps/dispatch/marshal.js.map +1 -0
  142. package/dist/remediate/steps/dispatch/verifyCommands.d.ts +97 -0
  143. package/dist/remediate/steps/dispatch/verifyCommands.d.ts.map +1 -0
  144. package/dist/remediate/steps/dispatch/verifyCommands.js +204 -0
  145. package/dist/remediate/steps/dispatch/verifyCommands.js.map +1 -0
  146. package/dist/remediate/steps/dispatch/waveScheduling.d.ts +90 -0
  147. package/dist/remediate/steps/dispatch/waveScheduling.d.ts.map +1 -0
  148. package/dist/remediate/steps/dispatch/waveScheduling.js +352 -0
  149. package/dist/remediate/steps/dispatch/waveScheduling.js.map +1 -0
  150. package/dist/remediate/steps/dispatch/worktreeLifecycle.d.ts +189 -0
  151. package/dist/remediate/steps/dispatch/worktreeLifecycle.d.ts.map +1 -0
  152. package/dist/remediate/steps/dispatch/worktreeLifecycle.js +643 -0
  153. package/dist/remediate/steps/dispatch/worktreeLifecycle.js.map +1 -0
  154. package/dist/remediate/steps/dispatch/writeScope.d.ts +151 -0
  155. package/dist/remediate/steps/dispatch/writeScope.d.ts.map +1 -0
  156. package/dist/remediate/steps/dispatch/writeScope.js +376 -0
  157. package/dist/remediate/steps/dispatch/writeScope.js.map +1 -0
  158. package/dist/remediate/steps/dispatch.d.ts +16 -863
  159. package/dist/remediate/steps/dispatch.d.ts.map +1 -1
  160. package/dist/remediate/steps/dispatch.js +18 -3613
  161. package/dist/remediate/steps/dispatch.js.map +1 -1
  162. package/dist/shared/decompose/charterClarification.d.ts +80 -0
  163. package/dist/shared/decompose/charterClarification.d.ts.map +1 -0
  164. package/dist/shared/decompose/charterClarification.js +105 -0
  165. package/dist/shared/decompose/charterClarification.js.map +1 -0
  166. package/dist/shared/decompose/systemicChallenge.d.ts +326 -0
  167. package/dist/shared/decompose/systemicChallenge.d.ts.map +1 -0
  168. package/dist/shared/decompose/systemicChallenge.js +30 -0
  169. package/dist/shared/decompose/systemicChallenge.js.map +1 -0
  170. package/dist/shared/index.d.ts +10 -5
  171. package/dist/shared/index.d.ts.map +1 -1
  172. package/dist/shared/index.js +6 -4
  173. package/dist/shared/index.js.map +1 -1
  174. package/dist/shared/opencodePermissions.d.ts +73 -0
  175. package/dist/shared/opencodePermissions.d.ts.map +1 -1
  176. package/dist/shared/opencodePermissions.js +172 -0
  177. package/dist/shared/opencodePermissions.js.map +1 -1
  178. package/dist/shared/tooling/exec.d.ts +10 -1
  179. package/dist/shared/tooling/exec.d.ts.map +1 -1
  180. package/dist/shared/tooling/exec.js +13 -1
  181. package/dist/shared/tooling/exec.js.map +1 -1
  182. package/dist/shared/types/charter.d.ts +89 -0
  183. package/dist/shared/types/charter.d.ts.map +1 -1
  184. package/dist/shared/types/charter.js +68 -0
  185. package/dist/shared/types/charter.js.map +1 -1
  186. package/dist/shared/types/intentCheckpoint.d.ts +15 -0
  187. package/dist/shared/types/intentCheckpoint.d.ts.map +1 -1
  188. package/dist/shared/types/intentCheckpoint.js +11 -0
  189. package/dist/shared/types/intentCheckpoint.js.map +1 -1
  190. package/dist/shared/validation/charterGate.d.ts +20 -1
  191. package/dist/shared/validation/charterGate.d.ts.map +1 -1
  192. package/dist/shared/validation/charterGate.js +23 -0
  193. package/dist/shared/validation/charterGate.js.map +1 -1
  194. package/docs/audit-pkg/contracts.md +1 -1
  195. package/docs/audit-pkg/development.md +8 -7
  196. package/docs/audit-pkg/product.md +7 -4
  197. package/docs/audit-pkg/release.md +4 -2
  198. package/opencode.json +36 -20
  199. package/package.json +1 -1
  200. package/scripts/postinstall.mjs +2 -1
  201. package/wrapper/audit-code-wrapper-opencode.mjs +38 -12
  202. package/wrapper/remediate-code-wrapper-opencode.mjs +38 -12
@@ -0,0 +1,352 @@
1
+ import { computeDispatchAdmission, createReservationLedger, tierRank } from "audit-tools/shared";
2
+ import { deriveCostRank, lookupConfirmedPosition } from "audit-tools/shared";
3
+ import { scheduleWave as computePoolWaveSchedule } from "audit-tools/shared";
4
+ import { buildQuotaSource, HostSessionQuotaSource, compareTier, buildSourcePools, buildHostModelPools, resolveHostProviderName, isDemotableInProcessProvider, } from "audit-tools/shared";
5
+ import { REMEDIATION_DISPATCH_QUOTA_CONTRACT_VERSION, } from "../types.js";
6
+ import { computeDispatchCapacity, resolveHostActiveSubagentLimit, readQuotaState, buildProviderModelKey, computeBackoffCooldownMs, computeBackoffFailureWeight, summarizeDispatchCapacityPools, } from "../../quota/index.js";
7
+ export { resolveHostActiveSubagentLimit };
8
+ export { detectHostActiveSubagentLimit as detectHostConcurrencyFromEnv, } from "../../quota/hostLimits.js";
9
+ const DEFAULT_WAVE_SIZE = 5;
10
+ export function normalizeSlotTokens(tokens, count) {
11
+ if (!tokens || tokens.length === 0)
12
+ return new Array(count).fill(0);
13
+ if (tokens.length > count)
14
+ return tokens.slice(0, count);
15
+ if (tokens.length < count)
16
+ return [...tokens, ...new Array(count - tokens.length).fill(0)];
17
+ return tokens;
18
+ }
19
+ export function resolveHostConcurrencyLimit(options) {
20
+ return resolveHostActiveSubagentLimit({
21
+ explicitLimit: options.hostMaxConcurrent,
22
+ sessionConfig: options.sessionConfig ?? {},
23
+ env: options.env,
24
+ });
25
+ }
26
+ function _capacityPoolSummary(poolId, slots, schedule) {
27
+ return {
28
+ pool_id: poolId,
29
+ slots,
30
+ model: schedule.model,
31
+ confidence: schedule.confidence,
32
+ source: schedule.source,
33
+ resolved_limits: schedule.resolved_limits,
34
+ host_concurrency_limit: schedule.host_concurrency_limit,
35
+ cooldown_until: schedule.cooldown_until,
36
+ estimated_wave_tokens: schedule.estimated_wave_tokens,
37
+ binding_cap: schedule.binding_cap ?? "none",
38
+ quota_source_snapshot: schedule.quota_source_snapshot ?? null,
39
+ };
40
+ }
41
+ /**
42
+ * Most-capable rank first, so the largest pending items land on the rank with
43
+ * the largest window. Ordering comes from the single shared tier-rank authority
44
+ * (`compareTier`, negated for descending) — no local {small,standard,deep} copy.
45
+ */
46
+ function sortRosterMostCapableFirst(roster) {
47
+ return [...roster].sort((a, b) => compareTier(b.rank, a.rank));
48
+ }
49
+ async function buildHostPoolPreamble(input) {
50
+ const sessionConfig = input.sessionConfig ?? {};
51
+ const providerName = input.providerName ??
52
+ sessionConfig.provider ??
53
+ "claude-code";
54
+ const hostModel = input.hostModel ??
55
+ sessionConfig.block_quota
56
+ ?.host_model ??
57
+ null;
58
+ // Quota-key identity: resolved model name, else the host's opaque id, else
59
+ // null → `provider/*`. Per-roster-rank `model_id` overrides per pool below.
60
+ const quotaModelKeySegment = hostModel ?? input.hostModelId ?? null;
61
+ const roster = input.hostModels?.length
62
+ ? sortRosterMostCapableFirst(input.hostModels)
63
+ : null;
64
+ const hostLimit = resolveHostConcurrencyLimit({
65
+ hostMaxConcurrent: input.hostMaxConcurrent,
66
+ sessionConfig,
67
+ env: input.env,
68
+ });
69
+ // The capability handshake: the host reported its dispatch model's real
70
+ // context/output window this session (the roster's most capable entry under
71
+ // the multi-rank handshake). Carried into the pool's discoveredLimits so the
72
+ // shared discovered_capability rung sizes the budget to the real window
73
+ // instead of the conservative 32k floor. RPM/TPM stay null and fill from the
74
+ // learned quota state.
75
+ const hostContextTokens = input.hostContextTokens ?? roster?.[0]?.context_tokens ?? null;
76
+ const hostOutputTokens = input.hostOutputTokens ?? roster?.[0]?.output_tokens ?? null;
77
+ const hostCapabilityLimits = hostContextTokens != null || hostOutputTokens != null
78
+ ? { context_tokens: hostContextTokens, output_tokens: hostOutputTokens }
79
+ : null;
80
+ let quotaEntries = {};
81
+ try {
82
+ const state = await readQuotaState();
83
+ quotaEntries = state.entries;
84
+ }
85
+ catch (err) {
86
+ process.stderr.write(`[waveScheduler] readQuotaState failed; degrading to no learned quota entry. ${err instanceof Error ? err.message : String(err)}\n`);
87
+ }
88
+ // The proactive quota snapshot (Claude OAuth source, then learned) so the
89
+ // scheduler can throttle/cooldown from live remaining quota — mirrors
90
+ // audit-code's buildDispatchPool. PREPEND the host-session source keyed on
91
+ // this host pool's own (provider, model) key — first-class PRE-WALL source
92
+ // (graduated remaining_pct → LOW/CRITICAL throttle before a 429), gating on the
93
+ // exact key so it never masks the proactive/learned sources.
94
+ const quotaSource = buildQuotaSource({
95
+ halfLifeHours: sessionConfig.quota
96
+ ?.empirical_half_life_hours,
97
+ hostSession: input.hostSession ??
98
+ new HostSessionQuotaSource({
99
+ providerModelKey: buildProviderModelKey(providerName, quotaModelKeySegment),
100
+ }),
101
+ });
102
+ // One capacity pool per reported roster rank (most capable first), each with
103
+ // its own discovered window and quota key; a single pool for the scalar/absent
104
+ // handshake. Built via the shared host-pool-from-roster core so the pool shape
105
+ // + account-keyed pool ids can't drift across the two consumers.
106
+ const primaryPools = await buildHostModelPools({
107
+ providerName,
108
+ hostModel,
109
+ hostConcurrencyLimit: hostLimit,
110
+ quotaSource,
111
+ quotaEntries,
112
+ roster,
113
+ resolve: (entry) => ({
114
+ poolKey: buildProviderModelKey(providerName, entry?.model_id ?? quotaModelKeySegment),
115
+ discoveredLimits: entry
116
+ ? { context_tokens: entry.context_tokens, output_tokens: entry.output_tokens }
117
+ : hostCapabilityLimits,
118
+ }),
119
+ });
120
+ return {
121
+ sessionConfig,
122
+ providerName,
123
+ hostModel,
124
+ quotaModelKeySegment,
125
+ roster,
126
+ hostLimit,
127
+ hostContextTokens,
128
+ hostOutputTokens,
129
+ hostCapabilityLimits,
130
+ quotaEntries,
131
+ quotaSource,
132
+ primaryPools,
133
+ };
134
+ }
135
+ export async function scheduleWave(input) {
136
+ const sessionConfig = input.sessionConfig ?? {};
137
+ const providerName = input.providerName ?? sessionConfig.provider ?? "claude-code";
138
+ const hostModel = input.hostModel ?? sessionConfig.block_quota?.host_model ?? null;
139
+ // Quota-key identity: resolved model name, else the host's opaque id, else
140
+ // null → `provider/*`. Per-roster-rank `model_id` overrides per pool below.
141
+ const quotaModelKeySegment = hostModel ?? input.hostModelId ?? null;
142
+ const roster = input.hostModels?.length
143
+ ? sortRosterMostCapableFirst(input.hostModels)
144
+ : null;
145
+ const hostLimit = resolveHostConcurrencyLimit({
146
+ hostMaxConcurrent: input.hostMaxConcurrent,
147
+ sessionConfig,
148
+ env: input.env,
149
+ });
150
+ // The capability handshake: the host reported its dispatch model's real
151
+ // context/output window this session (the roster's most capable entry under
152
+ // the multi-rank handshake). Carried into the pool's discoveredLimits so the
153
+ // shared discovered_capability rung sizes the budget to the real window
154
+ // instead of the conservative 32k floor. RPM/TPM stay null and fill from the
155
+ // learned quota state.
156
+ const hostContextTokens = input.hostContextTokens ?? roster?.[0]?.context_tokens ?? null;
157
+ const hostOutputTokens = input.hostOutputTokens ?? roster?.[0]?.output_tokens ?? null;
158
+ const quota = sessionConfig.quota;
159
+ if (!quota || quota.enabled === false) {
160
+ const cap = hostLimit?.active_subagents ?? DEFAULT_WAVE_SIZE;
161
+ const waveSize = Math.max(1, Math.min(cap, input.itemCount));
162
+ // Single-source the quota-off schedule math (wave-token formula + confidence +
163
+ // source) through the shared scheduler so the two orchestrators can't drift —
164
+ // remediate previously re-implemented it with a flat average + confidence:"low",
165
+ // disagreeing with shared's sumTopN + "high". The wave is already capped to
166
+ // `waveSize`, so shared (`requestedConcurrency: waveSize`, no quota) returns it
167
+ // verbatim. Only the roster-honoring window and the DEFAULT_WAVE_SIZE-aware
168
+ // binding_cap are remediate-specific and layered back on top.
169
+ const base = computePoolWaveSchedule({
170
+ providerName,
171
+ sessionConfig,
172
+ hostModel,
173
+ requestedConcurrency: waveSize,
174
+ estimatedSlotTokens: input.estimatedSlotTokens,
175
+ hostConcurrencyLimit: hostLimit,
176
+ });
177
+ const schedule = {
178
+ ...base,
179
+ resolved_limits: {
180
+ // Honor a host-reported window even with quota disabled; fall back to the
181
+ // shared scheduler's default only when nothing was discovered.
182
+ context_tokens: hostContextTokens ?? base.resolved_limits.context_tokens,
183
+ output_tokens: hostOutputTokens ?? base.resolved_limits.output_tokens,
184
+ requests_per_minute: null,
185
+ input_tokens_per_minute: null,
186
+ output_tokens_per_minute: null,
187
+ },
188
+ host_concurrency_limit: hostLimit,
189
+ // hostLimit-gated: a DEFAULT_WAVE_SIZE cap below itemCount is NOT a host
190
+ // concurrency bind (there is no host limit), so it stays "none".
191
+ binding_cap: hostLimit && waveSize < input.itemCount ? "host_concurrency" : "none",
192
+ };
193
+ return {
194
+ ...schedule,
195
+ capacity_pools: [_capacityPoolSummary(buildProviderModelKey(providerName, quotaModelKeySegment), waveSize, schedule)],
196
+ };
197
+ }
198
+ const preamble = await buildHostPoolPreamble({
199
+ sessionConfig: input.sessionConfig,
200
+ providerName: input.providerName,
201
+ hostModel: input.hostModel,
202
+ hostMaxConcurrent: input.hostMaxConcurrent,
203
+ hostContextTokens: input.hostContextTokens,
204
+ hostOutputTokens: input.hostOutputTokens,
205
+ hostModels: input.hostModels,
206
+ hostModelId: input.hostModelId,
207
+ env: input.env,
208
+ });
209
+ const capacity = computeDispatchCapacity({
210
+ pools: preamble.primaryPools,
211
+ sessionConfig,
212
+ pendingItemTokens: normalizeSlotTokens(input.estimatedSlotTokens, input.itemCount),
213
+ });
214
+ return {
215
+ ...capacity.primary.schedule,
216
+ capacity_pools: summarizeDispatchCapacityPools(capacity),
217
+ };
218
+ }
219
+ /**
220
+ * Build the confirmed `CapacityPool[]` for a dispatch — one pool per reported
221
+ * roster rank (each with its own discovered window + quota key), or a single
222
+ * conservative pool for the scalar/absent handshake. This is the same pool shape
223
+ * `scheduleWave` constructs internally; it is exposed so the rolling dispatch
224
+ * engine (which is fed `confirmedPools` directly) sizes concurrency from the
225
+ * identical quota inputs, never from a raw host flag. Reused by
226
+ * `driveRollingImplementDispatch`.
227
+ */
228
+ export async function buildConfirmedPools(input) {
229
+ // Defect-1: the ACTUAL configured backend (used to build the demoted source pool) vs
230
+ // the HOST-pool identity. When an attended host demotes a headless backend to a source
231
+ // (codex/opencode/openai-compatible), the host pool must key to the CONVERSATION HOST
232
+ // (claude-code), not the backend — otherwise the host fan-out is charged against the
233
+ // backend's meter AND collides with the demoted source pool ([[capability-is-per-auditor-not-per-audit]]).
234
+ const actualProviderName = resolveHostProviderName(input.sessionConfig);
235
+ const demoteHostIdentity = input.demotePrimaryInProcess === true && isDemotableInProcessProvider(actualProviderName);
236
+ const hostProviderName = demoteHostIdentity
237
+ ? "claude-code"
238
+ : actualProviderName;
239
+ // Resolve identity/limits and build the per-rank host-model pools via the
240
+ // SAME preamble `scheduleWave` uses — the two no longer keep parallel copies.
241
+ const { sessionConfig, quotaSource, quotaEntries, primaryPools } = await buildHostPoolPreamble({
242
+ sessionConfig: input.sessionConfig,
243
+ providerName: hostProviderName,
244
+ hostMaxConcurrent: input.hostMaxConcurrent,
245
+ hostContextTokens: input.hostContextTokens,
246
+ hostOutputTokens: input.hostOutputTokens,
247
+ hostModels: input.hostModels,
248
+ hostModelId: input.hostModelId,
249
+ env: input.env,
250
+ hostSession: input.hostSession,
251
+ });
252
+ // Every configured dispatchable backend source (any non-IDE source: NIM/vLLM API,
253
+ // a CLI pool, …) becomes a CapacityPool alongside the primary, so the scheduler's
254
+ // proactive cross-pool spill (INV-QD-14) and the A-8 coordinator can route work to
255
+ // them. Single-sourced in shared (`buildSourcePools`) so audit and remediate surface
256
+ // the IDENTICAL pool shapes — the spill topology can't drift. `primaryProviderName`
257
+ // is the ACTUAL configured backend (not the demoted host identity) so the demoted
258
+ // source is built for the real provider.
259
+ const sourcePools = await buildSourcePools({
260
+ sessionConfig,
261
+ primaryProviderName: actualProviderName,
262
+ quotaSource,
263
+ quotaEntries,
264
+ demotePrimaryInProcess: input.demotePrimaryInProcess,
265
+ });
266
+ primaryPools.push(...sourcePools);
267
+ return primaryPools;
268
+ }
269
+ /**
270
+ * Build the `AdmissionPool[]` the admission loop admits against from a schedule's
271
+ * per-pool capacity summaries — the remediate analog of audit's `finalizeDispatchQuota`
272
+ * pool mapping (both feed the single-sourced `computeDispatchAdmission`, so the two
273
+ * orchestrators can't drift). Budget = the pool's live remaining token budget
274
+ * (null ⇒ optimistic +Inf); declared cap = its host in-flight cap passed VERBATIM
275
+ * (null ⇒ none — the only place an explicit agent-count exists); cost/capability rank
276
+ * from its tier; capacity = its context window (a packet's input+output envelope must fit).
277
+ */
278
+ function admissionPoolsFromSchedule(schedule, confirmedCostPositions) {
279
+ return (schedule.capacity_pools ?? []).map((pool) => {
280
+ // costRank is a REAL cost axis (blended $/Mtok via the shared cost-first
281
+ // engine), decoupled from capabilityRank (still the tier ordinal). See
282
+ // spec/cost-first-routing.md. Rung 1 (operator-confirmed) via the model-keyed
283
+ // map; absent ⇒ price (rung 2) ⇒ tier (rung 3).
284
+ return {
285
+ poolId: pool.pool_id,
286
+ resourceKey: pool.pool_id,
287
+ budget: pool.remaining_token_budget ?? Number.POSITIVE_INFINITY,
288
+ declaredCap: pool.host_concurrency_limit?.active_subagents ?? null,
289
+ costRank: deriveCostRank({
290
+ model: pool.model,
291
+ tier: pool.rank,
292
+ confirmedPosition: lookupConfirmedPosition(confirmedCostPositions, pool.model),
293
+ }),
294
+ capabilityRank: tierRank(pool.rank),
295
+ capacityTokens: pool.resolved_limits.context_tokens,
296
+ };
297
+ });
298
+ }
299
+ export async function buildDispatchQuota(runId, phase, schedule, admissionPackets,
300
+ /**
301
+ * Whether to LEASE the granted set against the shared reservation ledger. The
302
+ * host-subagent path passes `true` (the host dispatches the grant across processes,
303
+ * so the tool reserves-before-dispatch and reconciles at accept-node). The
304
+ * in-process rolling engine passes `false`: it admits + leases per-packet itself, so
305
+ * a host-grant lease here would double-count the same work. Mirrors audit's
306
+ * `finalizeDispatchQuota` grantLeases parameterization.
307
+ */
308
+ grantLeases, quotaStateEntry,
309
+ /**
310
+ * Operator-confirmed cost ordering (rung 1 of costRank; spec/cost-first-routing.md),
311
+ * keyed by model id → 0-based confirmed position. Absent ⇒ price then tier.
312
+ */
313
+ confirmedCostPositions) {
314
+ let backoffState = null;
315
+ const count = quotaStateEntry?.consecutive_429_count ?? 0;
316
+ if (count > 0) {
317
+ backoffState = {
318
+ consecutive_429_count: count,
319
+ current_cooldown_ms: computeBackoffCooldownMs(count),
320
+ current_failure_weight: computeBackoffFailureWeight(count),
321
+ };
322
+ }
323
+ // Admission control: instead of a computed `max_concurrent_agents`, GRANT the
324
+ // affordable admitted set (cost-first-capable, ledger-leased). Per-packet reservation
325
+ // = input estimate + output envelope (declared output cap; the learned ratio refines
326
+ // it once a provider reports usage — dormant on the always-on claude-code host).
327
+ const admission = await computeDispatchAdmission({
328
+ packets: admissionPackets,
329
+ pools: admissionPoolsFromSchedule(schedule, confirmedCostPositions),
330
+ outputCap: schedule.resolved_limits.output_tokens,
331
+ grantLeases,
332
+ ledger: createReservationLedger(),
333
+ });
334
+ return {
335
+ contract_version: REMEDIATION_DISPATCH_QUOTA_CONTRACT_VERSION,
336
+ run_id: runId,
337
+ phase,
338
+ host_concurrency_limit: schedule.host_concurrency_limit,
339
+ admission,
340
+ estimated_wave_tokens: schedule.estimated_wave_tokens,
341
+ model: schedule.model,
342
+ confidence: schedule.confidence,
343
+ source: schedule.source,
344
+ resolved_limits: schedule.resolved_limits,
345
+ cooldown_until: schedule.cooldown_until,
346
+ binding_cap: schedule.binding_cap ?? "none",
347
+ capacity_pools: schedule.capacity_pools,
348
+ quota_source_snapshot: schedule.quota_source_snapshot ?? null,
349
+ backoff_state: backoffState,
350
+ };
351
+ }
352
+ //# sourceMappingURL=waveScheduling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waveScheduling.js","sourceRoot":"","sources":["../../../../src/remediate/steps/dispatch/waveScheduling.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,YAAY,IAAI,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,2CAA2C,GAG5C,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,EACvB,8BAA8B,EAC9B,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,CAAC;AAC1C,OAAO,EACL,6BAA6B,IAAI,4BAA4B,GAC9D,MAAM,2BAA2B,CAAC;AASnC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AA2B5B,MAAM,UAAU,mBAAmB,CAAC,MAA4B,EAAE,KAAa;IAC7E,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpE,IAAI,MAAM,CAAC,MAAM,GAAG,KAAK;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACzD,IAAI,MAAM,CAAC,MAAM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AQ,CAAC,cAAc;QACvC,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,MAAM;QAC3C,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,qBAAqB,EAAE,QAAQ,CAAC,qBAAqB,IAAI,IAAI;QAC7D,aAAa,EAAE,YAAY;KAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,189 @@
1
+ export interface WorktreeVerifyResult {
2
+ passed: boolean;
3
+ output: string;
4
+ }
5
+ /**
6
+ * Create an isolated git worktree on a fresh branch at HEAD. Throws on non-zero exit.
7
+ *
8
+ * Refuses when `root` is not ITSELF a git top-level: a bare `git worktree add`
9
+ * with `cwd: root` walks UP to the nearest enclosing repo and silently creates
10
+ * the worktree/branch in that ancestor (observed polluting the monorepo with
11
+ * leaked `remediate-*` branches during the rolling_engine flip). The resolved
12
+ * top-level must equal the target root, or we refuse rather than escape.
13
+ */
14
+ export declare function createWorktree(root: string, worktreePath: string, branchName: string): void;
15
+ /**
16
+ * Materialize into a fresh worktree any of the node's declared target paths that
17
+ * exist in the main tree but are absent from the worktree — i.e. git-untracked or
18
+ * gitignored files that `git worktree add HEAD` does not bring over. Without this
19
+ * a node whose scope names an untracked config file (the dogfood hit
20
+ * `opencode.json` and an uncommitted `.gemini/commands/*.toml`) cannot see its own
21
+ * target, so the edit silently no-ops. The "absent in worktree" test is the
22
+ * discriminator: a tracked path is already materialized from HEAD, so only the
23
+ * genuinely-missing untracked/ignored declarations are copied — a tracked-but-dirty
24
+ * file keeps its clean-from-HEAD worktree content and is never clobbered. Paths are
25
+ * repo-relative (the declared scope contract); absolute/escaping paths are skipped.
26
+ * Best-effort: a copy failure must not abort the dispatch (logged, not thrown).
27
+ */
28
+ export declare function seedUntrackedDeclaredPaths(root: string, worktreeRoot: string, declaredPaths: Iterable<string>): void;
29
+ /** Remove a git worktree. Best-effort: logs but does not throw on failure. */
30
+ export declare function removeWorktree(root: string, worktreePath: string): void;
31
+ /**
32
+ * Fully reset a node's isolated worktree + branch so a fresh `createWorktree -b`
33
+ * can run, even when a prior attempt left either behind. This is the idempotent
34
+ * cleanup the in-process driver needs across a `rate_limited` re-queue: the
35
+ * engine re-enters the dispatcher for the SAME block while its branch (and maybe
36
+ * a stale worktree admin entry) still exist, and `git worktree add -b <branch>`
37
+ * would otherwise fail with "branch already exists". Removing the worktree,
38
+ * pruning stale admin records, then force-deleting the branch makes every
39
+ * (re-)dispatch start clean from HEAD. All steps are best-effort (a missing
40
+ * worktree/branch is the expected first-attempt case, not an error). Any partial
41
+ * edits from a throttled prior attempt are intentionally discarded — the
42
+ * re-dispatch redoes the node from HEAD.
43
+ */
44
+ export declare function resetNodeWorktreeAndBranch(root: string, worktreePath: string, branchName: string): void;
45
+ /**
46
+ * Run each targeted command in the worktree directory. Returns pass/fail and
47
+ * combined output.
48
+ *
49
+ * `targeted_commands` are opaque host-authored command *strings* (e.g.
50
+ * `npm run build`, `grep -c '/packages/' .gitignore`, anything with pipes,
51
+ * quotes, or redirections), NOT pre-tokenized argv. They are run through the
52
+ * platform shell (`runShellCommand` → `spawnSync(..., { shell: true })`, the
53
+ * same path `close.ts` uses for `test_command`/`e2e_command`) so the shell — not
54
+ * a word-split + `spawnSync(shell:false)` — resolves the verb. That is what
55
+ * makes this OS-agnostic: on win32 `cmd.exe` natively execs `.cmd` shims (npm,
56
+ * npx, …) and resolves PATH commands; on darwin/linux `/bin/sh` does. The prior
57
+ * argv path ENOENT'd the *spawn itself* for any verb that wasn't a bare
58
+ * executable (e.g. `grep` on Windows), turning a correct fix into a phantom
59
+ * contract failure that burned the retry budget.
60
+ */
61
+ export declare function verifyNodeInWorktree(worktreePath: string, targetedCommands: string[]): WorktreeVerifyResult;
62
+ /** Merge the worktree branch into the current HEAD via cherry-pick. On failure, removes the worktree and returns the error. */
63
+ export declare function mergeWorktree(root: string, worktreePath: string, branchName: string): {
64
+ success: true;
65
+ } | {
66
+ success: false;
67
+ error: string;
68
+ };
69
+ /**
70
+ * Repo-relative tracked paths in the MAIN checkout that have uncommitted changes
71
+ * AND collide with a path the node's branch edits. A pre-existing dirty tracked
72
+ * file the cherry-pick would touch makes `git cherry-pick` abort with the opaque
73
+ * "Your local changes to the following files would be overwritten by merge" — a
74
+ * condition the node itself cannot fix and that identically re-fails every
75
+ * auto-retry (observed: a docs-only node routed to human triage over unrelated
76
+ * uncommitted WIP on the same file). Detected here so `acceptNodeWorktree` can
77
+ * surface the actionable cause (which file, commit-or-stash) instead of the raw
78
+ * git error. Best-effort: an unavailable diff / status probe returns `[]` (fall
79
+ * through to the normal cherry-pick, which reproduces the original behaviour).
80
+ */
81
+ export declare function dirtyMainTreeCollisions(root: string, branch: string): string[];
82
+ /**
83
+ * Rebase a node's worktree branch onto the main checkout's current HEAD (the
84
+ * remediation branch tip) so a sibling that merged AFTER this worktree was created
85
+ * is folded in before this node verifies and merges. Additive edits to a shared
86
+ * file merge automatically (git's per-commit 3-way); a true hunk conflict is a
87
+ * genuine seam that aborts cleanly so the node routes to triage instead of landing
88
+ * a broken merge. The branch is checked out in the worktree, so the rebase runs
89
+ * there. A no-op (branch already on HEAD — the common, no-sibling-merged case)
90
+ * succeeds. Leaves the branch on its pre-rebase commit on abort (so the failed
91
+ * node's work can still be quarantined).
92
+ */
93
+ export declare function rebaseBranchOntoHead(root: string, worktreePath: string, branch: string): {
94
+ ok: true;
95
+ } | {
96
+ ok: false;
97
+ error: string;
98
+ };
99
+ /** Worktree path for a remediation block. */
100
+ export declare function worktreePath(root: string, blockId: string, runId: string): string;
101
+ export declare function remediationBranchName(runId: string): string;
102
+ /**
103
+ * Lock path for the base-mutating accept critical section (INV-2/CE-001), keyed on
104
+ * the base repo root + run's remediation branch. DISTINCT from the per-run
105
+ * `rolling-session.lock` (`withFileLock` is non-reentrant — an exclusive `wx`
106
+ * create — so the base lock MUST be a different path than the session lock
107
+ * `advanceHostRolling` already holds, or the nested acquire would self-deadlock).
108
+ * Both rolling drivers (host-subagent + in-process) serialize the rebase →
109
+ * cherry-pick → cross-package check → reset sequence through this single lock.
110
+ */
111
+ export declare function baseBranchLockPath(root: string, runId: string): string;
112
+ /** Durable ref under which a failed-but-committed node's commit is preserved. */
113
+ export declare function quarantineRef(runId: string, blockId: string): string;
114
+ /**
115
+ * Preserve a failed-but-committed node's work so it can never be lost. A node that
116
+ * committed real edits to its worktree branch but then failed verify / the
117
+ * write-scope gate / the cherry-pick is about to have its worktree removed and (on
118
+ * the next re-dispatch) its branch force-deleted — orphaning the commit. The dogfood
119
+ * lost a verified fix exactly this way (the worktree was pruned before recovery).
120
+ * Point a durable ref at the branch tip: a ref under refs/remediation-quarantine/
121
+ * survives `git branch -D` and `git worktree prune`, so the work stays reachable for
122
+ * a manual `git cherry-pick`. Best-effort; returns the ref + commit, or null.
123
+ */
124
+ export declare function quarantineFailedNodeCommit(root: string, branch: string, runId: string, blockId: string): {
125
+ ref: string;
126
+ commit: string;
127
+ } | null;
128
+ /**
129
+ * Preserve a failed-but-UNCOMMITTED node's worktree edits before the worktree is
130
+ * removed. The verify / scope / merge-fail paths quarantine an already-committed
131
+ * branch tip; this is the missing twin for the commit-REFUSAL path: when
132
+ * `commitWorktree` fails loudly (e.g. a generated artifact landed under the write
133
+ * scope — the genuine CE-003 fail-loud), the worker's real source edits are still
134
+ * sitting uncommitted in the worktree and would be destroyed by `removeWorktree`.
135
+ * Stage everything and land a preservation commit on the node's ISOLATED branch
136
+ * (never cherry-picked into main — it exists only so a durable quarantine ref can
137
+ * point at the otherwise-lost work), then quarantine that commit. A guard that
138
+ * destroys good work is worse than the bug it guards. Best-effort; returns the
139
+ * quarantine ref + commit, or null when there was nothing to preserve / it failed.
140
+ */
141
+ export declare function quarantineUncommittedWorktreeEdits(root: string, worktreeRoot: string, branch: string, runId: string, blockId: string): {
142
+ ref: string;
143
+ commit: string;
144
+ } | null;
145
+ /** Clear a node's quarantine ref (e.g. once a later re-dispatch landed successfully). Best-effort. */
146
+ export declare function clearQuarantinedCommit(root: string, runId: string, blockId: string): void;
147
+ /** Quarantined failed-node commits still preserved for a run, for recovery surfacing in the report. */
148
+ export declare function listQuarantinedCommits(root: string, runId: string): Array<{
149
+ block: string;
150
+ ref: string;
151
+ commit: string;
152
+ }>;
153
+ /**
154
+ * Ensure the main checkout is on the dedicated remediation branch BEFORE any node
155
+ * commit is cherry-picked, so accepted work lands there and the user's base branch
156
+ * is NEVER modified — the run leaves a feature branch for review (it does not merge
157
+ * back). Idempotent across waves: creates the branch from the current HEAD (the base)
158
+ * the first time, checks it out on later waves. Best-effort on a non-git root (the
159
+ * worktree dispatch flow can't run there anyway): returns null without throwing so
160
+ * non-git callers/tests are unaffected. Returns the branch name on success.
161
+ */
162
+ /** Sidecar recording the base branch the run was launched from (B5). */
163
+ export declare function remediationBaseBranchPath(artifactsDir: string): string;
164
+ /**
165
+ * The base branch this run was launched from, recorded when the remediation
166
+ * branch was first created. `null` when unrecorded (e.g. a detached HEAD at
167
+ * launch, or a branch created by a prior run) — the opt-in merge-to-base
168
+ * closing action degrades to "merge manually" rather than guessing a target.
169
+ */
170
+ export declare function readRemediationBaseBranch(artifactsDir: string): string | null;
171
+ export declare function ensureRemediationBranchCheckedOut(root: string, runId: string, artifactsDir?: string): string | null;
172
+ export declare function commitWorktree(worktreeRoot: string, message: string, declaredWritePaths?: string[]): {
173
+ committed: boolean;
174
+ error?: string;
175
+ };
176
+ /**
177
+ * Make the main checkout's installed `node_modules` available to a worktree. A
178
+ * fresh `git worktree add` checks out only tracked files, and `node_modules` is
179
+ * gitignored, so per-node verify commands (`npm run check`, focused tests) would
180
+ * otherwise fail with missing dependencies. Best-effort junction/symlink to the
181
+ * main root's `node_modules`; on failure it logs and the verify step surfaces the
182
+ * missing-deps error rather than crashing the dispatch. NOTE: workspace package
183
+ * symlinks inside `node_modules/@audit-tools/*` point back into the MAIN checkout,
184
+ * so cross-package runtime resolution sees the main tree — the authoritative
185
+ * cross-package re-check is the central post-merge build/gate, not this fast
186
+ * per-node verify (which gates obvious breakage early).
187
+ */
188
+ export declare function ensureWorktreeNodeModules(mainRoot: string, worktreeRoot: string): void;
189
+ //# sourceMappingURL=worktreeLifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worktreeLifecycle.d.ts","sourceRoot":"","sources":["../../../../src/remediate/steps/dispatch/worktreeLifecycle.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAgC3F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,GAC9B,IAAI,CAoBN;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAgBvE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,IAAI,CAeN;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,MAAM,EAAE,GACzB,oBAAoB,CAoBtB;AAED,+HAA+H;AAC/H,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CA6BvD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,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