opencode-swarm 7.86.0 → 7.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{capability-probe-jevmgwmf.js → capability-probe-wsjzcp48.js} +2 -2
- package/dist/cli/{config-doctor-zejarrr6.js → config-doctor-6h64pn8n.js} +4 -4
- package/dist/cli/{dispatch-k86d928w.js → dispatch-kb69qw40.js} +3 -3
- package/dist/cli/{evidence-summary-service-g2znnd33.js → evidence-summary-service-gg5m9z57.js} +4 -4
- package/dist/cli/{guardrail-explain-rtd1x26f.js → guardrail-explain-wb1cj312.js} +13 -13
- package/dist/cli/{guardrail-log-80116wmz.js → guardrail-log-eegabqcp.js} +5 -5
- package/dist/cli/{index-jwz50183.js → index-0m44n5qv.js} +14 -14
- package/dist/cli/{index-0sxvwjt0.js → index-1cb4wxnm.js} +2 -2
- package/dist/cli/{index-zfsbaaqh.js → index-5e4e2hvv.js} +1 -1
- package/dist/cli/{index-vq2321gg.js → index-5hvbw5xh.js} +2 -2
- package/dist/cli/{index-5cb86007.js → index-5vpe6vq9.js} +1 -1
- package/dist/cli/{index-red8fm8p.js → index-89xjr3h4.js} +1162 -214
- package/dist/cli/{index-f8r50m3h.js → index-adz3nk9b.js} +2 -2
- package/dist/cli/{index-7r2b453y.js → index-f13d3b69.js} +2 -2
- package/dist/cli/{index-ckntc5gf.js → index-gn8n22th.js} +2 -2
- package/dist/cli/{index-hw9b2xng.js → index-q9h0wb04.js} +36 -3
- package/dist/cli/{index-d9fbxaqd.js → index-s8bj492g.js} +1 -1
- package/dist/cli/{index-hz59hg4h.js → index-v4fcn4tr.js} +1 -1
- package/dist/cli/{index-eb85wtx9.js → index-vqyfscxd.js} +2 -2
- package/dist/cli/{index-5q66xc88.js → index-wv2yj8ka.js} +2598 -1406
- package/dist/cli/{index-yx44zd0p.js → index-zgwm4ryv.js} +9 -1
- package/dist/cli/index.js +12 -12
- package/dist/cli/{pending-delegations-rd40tv9s.js → pending-delegations-35fvcj7z.js} +3 -3
- package/dist/cli/{pr-subscriptions-y1nn36e5.js → pr-subscriptions-b18n1yd8.js} +4 -4
- package/dist/cli/{schema-8d32b2v6.js → schema-84146tvk.js} +3 -1
- package/dist/cli/{skill-generator-a5ehggyg.js → skill-generator-3pvpk4y2.js} +2 -2
- package/dist/commands/coupling.d.ts +36 -0
- package/dist/commands/epic.d.ts +52 -0
- package/dist/commands/registry.d.ts +18 -2
- package/dist/config/constants.d.ts +1 -0
- package/dist/config/schema.d.ts +145 -0
- package/dist/git/branch.d.ts +22 -1
- package/dist/hooks/delegation-gate/worktree-merge-status.d.ts +86 -0
- package/dist/index.js +8401 -5792
- package/dist/memory/schema.d.ts +3 -3
- package/dist/plan/manager.d.ts +10 -0
- package/dist/state.d.ts +16 -0
- package/dist/tools/epic-plan-waves.d.ts +79 -0
- package/dist/tools/epic-record-divergence.d.ts +73 -0
- package/dist/tools/epic-run-phase.d.ts +179 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/manifest.d.ts +3 -0
- package/dist/tools/tool-metadata.d.ts +12 -0
- package/dist/turbo/epic/activation.d.ts +193 -0
- package/dist/turbo/epic/calibration-engine.d.ts +88 -0
- package/dist/turbo/epic/calibration.d.ts +65 -0
- package/dist/turbo/epic/cochange-conflict.d.ts +79 -0
- package/dist/turbo/epic/cochange-source.d.ts +80 -0
- package/dist/turbo/epic/coupling-report.d.ts +85 -0
- package/dist/turbo/epic/divergence-recorder.d.ts +112 -0
- package/dist/turbo/epic/index.d.ts +24 -0
- package/dist/turbo/epic/promotion-evidence.d.ts +42 -0
- package/dist/turbo/epic/state.d.ts +85 -0
- package/dist/turbo/epic/task-commit.d.ts +110 -0
- package/dist/turbo/epic/upstream-commits.d.ts +82 -0
- package/dist/turbo/epic/wave-planner.d.ts +83 -0
- package/dist/turbo/lean/partition-common.d.ts +85 -0
- package/dist/turbo/lean/planner.d.ts +12 -20
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/logger.d.ts +19 -0
- package/package.json +1 -1
package/dist/memory/schema.d.ts
CHANGED
|
@@ -46,8 +46,8 @@ export declare const MemorySourceSchema: z.ZodObject<{
|
|
|
46
46
|
manual: "manual";
|
|
47
47
|
test: "test";
|
|
48
48
|
tool: "tool";
|
|
49
|
-
user: "user";
|
|
50
49
|
commit: "commit";
|
|
50
|
+
user: "user";
|
|
51
51
|
repo: "repo";
|
|
52
52
|
web: "web";
|
|
53
53
|
}>;
|
|
@@ -105,8 +105,8 @@ export declare const MemoryRecordSchema: z.ZodObject<{
|
|
|
105
105
|
manual: "manual";
|
|
106
106
|
test: "test";
|
|
107
107
|
tool: "tool";
|
|
108
|
-
user: "user";
|
|
109
108
|
commit: "commit";
|
|
109
|
+
user: "user";
|
|
110
110
|
repo: "repo";
|
|
111
111
|
web: "web";
|
|
112
112
|
}>;
|
|
@@ -183,8 +183,8 @@ export declare const MemoryProposalSchema: z.ZodObject<{
|
|
|
183
183
|
manual: "manual";
|
|
184
184
|
test: "test";
|
|
185
185
|
tool: "tool";
|
|
186
|
-
user: "user";
|
|
187
186
|
commit: "commit";
|
|
187
|
+
user: "user";
|
|
188
188
|
repo: "repo";
|
|
189
189
|
web: "web";
|
|
190
190
|
}>;
|
package/dist/plan/manager.d.ts
CHANGED
|
@@ -39,6 +39,11 @@ export interface AcknowledgedRemovals {
|
|
|
39
39
|
source: string;
|
|
40
40
|
}
|
|
41
41
|
import { type Plan, type RuntimePlan, type TaskStatus } from '../config/plan-schema';
|
|
42
|
+
import { isGitRepo } from '../git/branch';
|
|
43
|
+
import { getWorktreeMergeFailure } from '../hooks/delegation-gate/worktree-merge-status';
|
|
44
|
+
import { isEpicModeActiveForProject } from '../turbo/epic/state.js';
|
|
45
|
+
import { commitTaskCompletion } from '../turbo/epic/task-commit.js';
|
|
46
|
+
import { readTaskScopes } from '../turbo/lean/conflicts.js';
|
|
42
47
|
import { type LedgerEvent, type LedgerEventInput, takeSnapshotWithRetry } from './ledger';
|
|
43
48
|
/** Reset the startup ledger check flag. For testing only. */
|
|
44
49
|
export declare function resetStartupLedgerCheck(): void;
|
|
@@ -54,6 +59,11 @@ export declare const _internals: {
|
|
|
54
59
|
loadPlan: typeof loadPlan;
|
|
55
60
|
loadPlanJsonOnly: typeof loadPlanJsonOnly;
|
|
56
61
|
regeneratePlanMarkdown: typeof regeneratePlanMarkdown;
|
|
62
|
+
isGitRepo: typeof isGitRepo;
|
|
63
|
+
isEpicModeActiveForProject: typeof isEpicModeActiveForProject;
|
|
64
|
+
readTaskScopes: typeof readTaskScopes;
|
|
65
|
+
commitTaskCompletion: typeof commitTaskCompletion;
|
|
66
|
+
getWorktreeMergeFailure: typeof getWorktreeMergeFailure;
|
|
57
67
|
};
|
|
58
68
|
/** @internal Test seam for snapshot retry helper */
|
|
59
69
|
export declare const _snapshot_test_exports: {
|
package/dist/state.d.ts
CHANGED
|
@@ -188,6 +188,11 @@ export interface AgentSessionState {
|
|
|
188
188
|
* When set, overrides the plan's execution_profile.max_concurrent_tasks
|
|
189
189
|
* for delegation-gate guidance. Cleared on session reset. */
|
|
190
190
|
maxConcurrencyOverride?: number;
|
|
191
|
+
/** Whether Epic Mode (additive overlay above Lean Turbo) is active for
|
|
192
|
+
* this session. Durable mirror lives in `.swarm/epic-state.json`; this
|
|
193
|
+
* in-memory flag matches what `src/turbo/epic/state.ts` persists and is
|
|
194
|
+
* what `hasActiveEpicMode(sessionID)` reads on the hot path. */
|
|
195
|
+
epicModeActive?: boolean;
|
|
191
196
|
/** Session-scoped override for execution_profile.auto_proceed.
|
|
192
197
|
* When set, overrides the plan's auto_proceed for this session.
|
|
193
198
|
* true = auto-advance, false = do not auto-advance. Cleared on session reset. */
|
|
@@ -616,6 +621,16 @@ export declare function hasActiveFullAuto(sessionID?: string): boolean;
|
|
|
616
621
|
* or if any session has that combination when no sessionID provided.
|
|
617
622
|
*/
|
|
618
623
|
export declare function hasActiveLeanTurbo(sessionID?: string): boolean;
|
|
624
|
+
/**
|
|
625
|
+
* Check if Epic Mode is active for a specific session or ANY session.
|
|
626
|
+
* Mirrors `hasActiveLeanTurbo` but reads `session.epicModeActive`. The flag
|
|
627
|
+
* is set by `enableEpicMode` (and by `/swarm turbo epic on`) and cleared by
|
|
628
|
+
* `disableEpicMode` (and `/swarm turbo epic off`). The durable mirror is
|
|
629
|
+
* `.swarm/epic-state.json` — see `src/turbo/epic/state.ts`. Epic Mode does
|
|
630
|
+
* NOT require `turboStrategy === 'lean'`; it composes Lean Turbo internally
|
|
631
|
+
* inside `epic_run_phase`.
|
|
632
|
+
*/
|
|
633
|
+
export declare function hasActiveEpicMode(sessionID?: string): boolean;
|
|
619
634
|
/**
|
|
620
635
|
* Resolves the effective auto_proceed value for a session.
|
|
621
636
|
* Session override (autoProceedOverride) takes precedence over the plan default.
|
|
@@ -675,6 +690,7 @@ export declare const _internals: {
|
|
|
675
690
|
hasActiveFullAuto: typeof hasActiveFullAuto;
|
|
676
691
|
hasActiveTurboMode: typeof hasActiveTurboMode;
|
|
677
692
|
hasActiveLeanTurbo: typeof hasActiveLeanTurbo;
|
|
693
|
+
hasActiveEpicMode: typeof hasActiveEpicMode;
|
|
678
694
|
buildRehydrationCache: typeof buildRehydrationCache;
|
|
679
695
|
applyRehydrationCache: typeof applyRehydrationCache;
|
|
680
696
|
rehydrateSessionFromDisk: typeof rehydrateSessionFromDisk;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Epic Mode `epic_plan_waves` tool.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `planEpicWaves` from `src/turbo/epic/wave-planner`. Partitions a
|
|
5
|
+
* phase's pending tasks into ordered concurrent waves and returns them in a
|
|
6
|
+
* shape the architect can iterate over for wave-by-wave Task dispatch.
|
|
7
|
+
*
|
|
8
|
+
* This is Epic Mode's replacement for `lean_turbo_plan_lanes`. The lane
|
|
9
|
+
* planner stays in place for non-Epic Lean Turbo callers; Epic flows route
|
|
10
|
+
* through this tool because the wave abstraction expresses branching DAGs
|
|
11
|
+
* (sibling fanout from a shared prefix) correctly, where lanes collapse them.
|
|
12
|
+
*/
|
|
13
|
+
import type { ToolDefinition } from '@opencode-ai/plugin/tool';
|
|
14
|
+
import { loadPluginConfigWithMeta as loadPluginConfigWithMeta_import } from '../config';
|
|
15
|
+
import { buildIsUpstreamCommittedWithStatus as buildIsUpstreamCommittedWithStatus_import } from '../turbo/epic/upstream-commits';
|
|
16
|
+
import { type EpicWavePlan } from '../turbo/epic/wave-planner';
|
|
17
|
+
import { readTaskScopes as readTaskScopes_import } from '../turbo/lean/conflicts';
|
|
18
|
+
import type { PlanPhase } from '../turbo/lean/partition-common';
|
|
19
|
+
/** Arguments for the `epic_plan_waves` tool. */
|
|
20
|
+
export interface EpicPlanWavesArgs {
|
|
21
|
+
directory: string;
|
|
22
|
+
phase: number;
|
|
23
|
+
scopes?: Record<string, string[]>;
|
|
24
|
+
}
|
|
25
|
+
/** Result envelope. */
|
|
26
|
+
export interface EpicPlanWavesResult {
|
|
27
|
+
success: boolean;
|
|
28
|
+
/** Set on success — the full wave plan from `planEpicWaves`. */
|
|
29
|
+
plan?: EpicWavePlan;
|
|
30
|
+
/** Set on success — shortcut alias for `plan.waves`. */
|
|
31
|
+
waves?: EpicWavePlan['waves'];
|
|
32
|
+
/** Set on success — shortcut alias for `plan.serializedTasks`. */
|
|
33
|
+
serializedTasks?: EpicWavePlan['serializedTasks'];
|
|
34
|
+
/** Set on success — shortcut alias for `plan.degradedTasks`. */
|
|
35
|
+
degradedTasks?: EpicWavePlan['degradedTasks'];
|
|
36
|
+
/**
|
|
37
|
+
* Set when `reason === 'scopes-missing'` — the task ids that have no
|
|
38
|
+
* declared scope and no `files_touched` fallback. The architect must
|
|
39
|
+
* call `declare_scope` for each of these and re-invoke this tool.
|
|
40
|
+
*/
|
|
41
|
+
missingScopes?: string[];
|
|
42
|
+
/** Set on failure — categorical short code (machine-readable). */
|
|
43
|
+
reason?: 'no-plan' | 'no-phase' | 'phase-empty' | 'phase-already-complete' | 'scopes-missing' | 'git-failed' | 'planner-error';
|
|
44
|
+
/** Set on failure — long-form actionable error text. */
|
|
45
|
+
errors?: string[];
|
|
46
|
+
}
|
|
47
|
+
declare function readPlanJson(directory: string): {
|
|
48
|
+
phases: PlanPhase[];
|
|
49
|
+
} | null;
|
|
50
|
+
/**
|
|
51
|
+
* Execute the `epic_plan_waves` tool.
|
|
52
|
+
*
|
|
53
|
+
* Six possible outcomes:
|
|
54
|
+
* 1. `no-plan` — `.swarm/plan.json` missing / unparseable
|
|
55
|
+
* 2. `no-phase` — phase number not in `plan.json`
|
|
56
|
+
* 3. `phase-empty` — phase exists but has zero tasks
|
|
57
|
+
* 4. `phase-already-complete` — every task already completed
|
|
58
|
+
* 5. `scopes-missing` — one or more pending tasks have no declared scope
|
|
59
|
+
* (preflight; identical to `epic_decide_phase` so the architect can't
|
|
60
|
+
* bypass scope discipline by calling planner direct)
|
|
61
|
+
* 6. `git-failed` — git log scan failed (Rule 3 evidence unavailable;
|
|
62
|
+
* we fail closed rather than implicitly satisfying cross-batch deps)
|
|
63
|
+
* 7. success — `plan` and aliased fields populated
|
|
64
|
+
*/
|
|
65
|
+
export declare function executeEpicPlanWaves(args: EpicPlanWavesArgs): Promise<EpicPlanWavesResult>;
|
|
66
|
+
/**
|
|
67
|
+
* DI seam — same pattern as `lean-turbo-plan-lanes.ts` (AGENTS.md invariant 7).
|
|
68
|
+
* Tests substitute deterministic doubles via `_internals.*` rather than `mock.module`.
|
|
69
|
+
*/
|
|
70
|
+
export declare const _internals: {
|
|
71
|
+
readPlanJson: typeof readPlanJson;
|
|
72
|
+
readTaskScopes: typeof readTaskScopes_import;
|
|
73
|
+
isGitRepo: (cwd: string) => boolean;
|
|
74
|
+
buildIsUpstreamCommittedWithStatus: typeof buildIsUpstreamCommittedWithStatus_import;
|
|
75
|
+
loadPluginConfigWithMeta: typeof loadPluginConfigWithMeta_import;
|
|
76
|
+
};
|
|
77
|
+
/** Tool definition for `epic_plan_waves`. */
|
|
78
|
+
export declare const epic_plan_waves: ToolDefinition;
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Epic Mode divergence-record tool (Capability D — capture leg).
|
|
3
|
+
*
|
|
4
|
+
* After the architect marks a task `completed` via `update_task_status`, it
|
|
5
|
+
* calls this tool with `{ directory, taskId, sessionID }`. The tool:
|
|
6
|
+
*
|
|
7
|
+
* 1. Reads the task's DECLARED scope from `.swarm/scopes/scope-{taskId}.json`
|
|
8
|
+
* (the same on-disk record `readScopeFromDisk` consults).
|
|
9
|
+
* 2. Reads the ACTUAL files the coder modified from the session's
|
|
10
|
+
* `modifiedFilesThisCoderTask` — populated by the guardrails write hook
|
|
11
|
+
* and reset by Lean Turbo at task-boundaries, so it captures THIS
|
|
12
|
+
* task's writes only.
|
|
13
|
+
* 3. Appends one record to `.swarm/epic/divergence.jsonl` via
|
|
14
|
+
* `recordTaskDivergence`. The calibration engine reads that file on the
|
|
15
|
+
* next `epic_decide_phase` invocation (the architect-facing decide
|
|
16
|
+
* tool — `epic_run_phase` is the legacy unified path, retained as
|
|
17
|
+
* `executeEpicRunPhase` for composition users only).
|
|
18
|
+
*
|
|
19
|
+
* Best-effort by design — failure to record divergence is logged but never
|
|
20
|
+
* surfaces as a task-blocking error. Worst case: a single observation is
|
|
21
|
+
* missed and the calibration loop sees one fewer data point.
|
|
22
|
+
*
|
|
23
|
+
* Composition contract: this tool does NOT modify `update_task_status` or
|
|
24
|
+
* any maintainer file. The architect is instructed to call it via the
|
|
25
|
+
* `EPIC_MODE_BANNER` system-enhancer injection. If the architect forgets,
|
|
26
|
+
* the only effect is missing calibration signal — Epic Mode keeps working.
|
|
27
|
+
*/
|
|
28
|
+
import type { ToolDefinition } from '@opencode-ai/plugin/tool';
|
|
29
|
+
import { loadPlanJsonOnly as loadPlanJsonOnly_import } from '../plan/manager.js';
|
|
30
|
+
import { readScopeFromDisk as readScopeFromDisk_import } from '../scope/scope-persistence.js';
|
|
31
|
+
import { getAgentSession as getAgentSession_import, hasActiveEpicMode as hasActiveEpicMode_import } from '../state.js';
|
|
32
|
+
import { recordTaskDivergence as recordTaskDivergence_import } from '../turbo/epic/divergence-recorder.js';
|
|
33
|
+
export interface EpicRecordDivergenceArgs {
|
|
34
|
+
directory: string;
|
|
35
|
+
taskId: string;
|
|
36
|
+
sessionID: string;
|
|
37
|
+
}
|
|
38
|
+
export interface EpicRecordDivergenceResult {
|
|
39
|
+
success: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Either:
|
|
42
|
+
* - `'recorded'` — a record was appended to divergence.jsonl.
|
|
43
|
+
* - `'epic-mode-not-active'` — session has not toggled Epic Mode; no-op.
|
|
44
|
+
* - `'no-scope'` — no declared scope on disk for this task (could be a
|
|
45
|
+
* pure verification task that bypassed `declare_scope`). Skipped.
|
|
46
|
+
* - `'no-session'` — no agent session for `sessionID`; skipped.
|
|
47
|
+
* - `'persist-failed'` — write to JSONL failed (logged); skipped.
|
|
48
|
+
*/
|
|
49
|
+
reason: string;
|
|
50
|
+
/** When `reason === 'recorded'`, summarises the record without the full file lists. */
|
|
51
|
+
summary?: {
|
|
52
|
+
declaredCount: number;
|
|
53
|
+
actualCount: number;
|
|
54
|
+
undeclaredCount: number;
|
|
55
|
+
unusedCount: number;
|
|
56
|
+
divergenceRatio: number;
|
|
57
|
+
isClean: boolean;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Test-only DI seam (AGENTS.md invariant 7). Mutating this object is
|
|
62
|
+
* file-scoped and trivially restorable via afterEach, avoiding Bun's
|
|
63
|
+
* cross-file `mock.module` leak.
|
|
64
|
+
*/
|
|
65
|
+
export declare const _internals: {
|
|
66
|
+
hasActiveEpicMode: typeof hasActiveEpicMode_import;
|
|
67
|
+
getAgentSession: typeof getAgentSession_import;
|
|
68
|
+
readScopeFromDisk: typeof readScopeFromDisk_import;
|
|
69
|
+
loadPlanJsonOnly: typeof loadPlanJsonOnly_import;
|
|
70
|
+
recordTaskDivergence: typeof recordTaskDivergence_import;
|
|
71
|
+
};
|
|
72
|
+
export declare function executeEpicRecordDivergence(args: EpicRecordDivergenceArgs): Promise<EpicRecordDivergenceResult>;
|
|
73
|
+
export declare const epic_record_divergence: ToolDefinition;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Epic Mode run-phase tool (Capability C).
|
|
3
|
+
*
|
|
4
|
+
* The architect invokes this tool — instead of `lean_turbo_run_phase` —
|
|
5
|
+
* when Epic Mode is active. It:
|
|
6
|
+
*
|
|
7
|
+
* 1. Verifies Epic Mode is on for the session (else fails closed).
|
|
8
|
+
* 2. Loads the plan, resolves task scopes the same way the coupling
|
|
9
|
+
* report does, and queries the co-change signal.
|
|
10
|
+
* 3. Runs `decideEpicActivation` over the WHOLE PLAN (per-plan
|
|
11
|
+
* activation per Q1) to get a `promote | demote` verdict.
|
|
12
|
+
* 4. Appends one record to `.swarm/evidence/epic-promotions.jsonl`
|
|
13
|
+
* and updates `.swarm/epic-state.json` with the verdict.
|
|
14
|
+
* 5. If promoted: invokes `LeanTurboRunner` for the given phase by
|
|
15
|
+
* composition (zero edits to `src/turbo/lean/`).
|
|
16
|
+
* 6. If demoted: returns a structured "epic recommends serial"
|
|
17
|
+
* verdict so the caller can fall back to the standard serial
|
|
18
|
+
* flow.
|
|
19
|
+
*
|
|
20
|
+
* Composition contract: this tool is the only architect-facing entry
|
|
21
|
+
* point Capability C adds. It does not modify `lean_turbo_run_phase`,
|
|
22
|
+
* `LeanTurboRunner`, or any Lean Turbo file. Decision happens above
|
|
23
|
+
* Lean Turbo; execution dispatches into Lean Turbo via import only.
|
|
24
|
+
*/
|
|
25
|
+
import type { ToolDefinition } from '@opencode-ai/plugin/tool';
|
|
26
|
+
import { loadPluginConfigWithMeta as loadPluginConfigWithMeta_import } from '../config/index.js';
|
|
27
|
+
import { isGitRepo as isGitRepo_import } from '../git/branch.js';
|
|
28
|
+
import { loadPlanJsonOnly as loadPlanJsonOnly_import } from '../plan/manager.js';
|
|
29
|
+
import type { EpicActivationVerdict } from '../turbo/epic/activation.js';
|
|
30
|
+
import { decideEpicActivation as decideEpicActivation_import } from '../turbo/epic/activation.js';
|
|
31
|
+
import { loadCalibrationState as loadCalibrationState_import, saveCalibrationState as saveCalibrationState_import } from '../turbo/epic/calibration.js';
|
|
32
|
+
import { applyCalibration as applyCalibration_import, effectiveActivationThreshold as effectiveActivationThreshold_import, effectiveHotModules as effectiveHotModules_import } from '../turbo/epic/calibration-engine.js';
|
|
33
|
+
import { getCoChangeData as getCoChangeData_import } from '../turbo/epic/cochange-source.js';
|
|
34
|
+
import { readDivergenceHistory as readDivergenceHistory_import } from '../turbo/epic/divergence-recorder.js';
|
|
35
|
+
import { appendPromotionEvidence as appendPromotionEvidence_import } from '../turbo/epic/promotion-evidence.js';
|
|
36
|
+
import { isEpicModeActive as isEpicModeActive_import, recordEpicDecision as recordEpicDecision_import } from '../turbo/epic/state.js';
|
|
37
|
+
import { buildIsUpstreamCommitted as buildIsUpstreamCommitted_import, buildIsUpstreamCommittedWithStatus as buildIsUpstreamCommittedWithStatus_import } from '../turbo/epic/upstream-commits.js';
|
|
38
|
+
import { readTaskScopes as readTaskScopes_import } from '../turbo/lean/conflicts.js';
|
|
39
|
+
import type { LaneResult } from '../turbo/lean/runner.js';
|
|
40
|
+
import { LeanTurboRunner as LeanTurboRunner_import } from '../turbo/lean/runner.js';
|
|
41
|
+
export interface EpicRunPhaseArgs {
|
|
42
|
+
directory: string;
|
|
43
|
+
phase: number;
|
|
44
|
+
sessionID: string;
|
|
45
|
+
}
|
|
46
|
+
export interface EpicRunPhaseResult {
|
|
47
|
+
success: boolean;
|
|
48
|
+
/** The verdict for this run, persisted to evidence. */
|
|
49
|
+
verdict?: EpicActivationVerdict;
|
|
50
|
+
/** Set when the verdict was `promote` and Lean Turbo ran. */
|
|
51
|
+
lanes?: LaneResult[];
|
|
52
|
+
degradedTasks?: string[];
|
|
53
|
+
serializedTasks?: string[];
|
|
54
|
+
/**
|
|
55
|
+
* Either:
|
|
56
|
+
* - `'demoted'` — epic chose serial; the caller should fall back.
|
|
57
|
+
* - `'promoted'` — epic chose parallel and Lean Turbo ran.
|
|
58
|
+
* - `'epic-mode-not-active'` — the session has not toggled Epic Mode.
|
|
59
|
+
* - `'no-plan'` — `.swarm/plan.json` is missing.
|
|
60
|
+
* - `'no-phase'` — the requested phase number isn't present in the
|
|
61
|
+
* plan. Phase 12 (B11): without this, an unknown phase silently
|
|
62
|
+
* produced `currentPhaseTasks = []` and vacuously-passed the
|
|
63
|
+
* activation gate — promoting a phase that doesn't exist.
|
|
64
|
+
* - `'phase-already-complete'` — every task in the requested phase
|
|
65
|
+
* is already `status: 'completed'`. Phase 15 (B35): without this,
|
|
66
|
+
* re-running an already-completed phase silently produced a
|
|
67
|
+
* vacuous-pass `promote` verdict; the architect then called the
|
|
68
|
+
* wave planner and got an empty plan with no diagnostic.
|
|
69
|
+
* - `'phase-empty'` — the requested phase exists but its `tasks`
|
|
70
|
+
* array is empty (architect created a phase header but never
|
|
71
|
+
* populated it, or a council edit removed every task). Phase 17
|
|
72
|
+
* (E.1): the Phase 15 B35 guard only fired when at least one
|
|
73
|
+
* completed task existed; an empty `tasks: []` slipped through to
|
|
74
|
+
* the same vacuous-pass `promote` B35 was supposed to prevent.
|
|
75
|
+
* - `'lean-runner-error'` — Lean Turbo threw during promoted execution.
|
|
76
|
+
* - `'scopes-missing'` — one or more pending tasks in the phase have
|
|
77
|
+
* neither a declared scope file on disk nor `files_touched` in
|
|
78
|
+
* plan.json. Lean Turbo's lane planner needs scope data to compute
|
|
79
|
+
* parallel lanes; without it the dispatch returns empty lanes and
|
|
80
|
+
* the parallelization promise is silently broken. The architect
|
|
81
|
+
* must call `declare_scope` for each missing task and then
|
|
82
|
+
* re-invoke `epic_decide_phase`.
|
|
83
|
+
*/
|
|
84
|
+
reason: string;
|
|
85
|
+
/** Set when `reason === 'lean-runner-error'`. */
|
|
86
|
+
errors?: string[];
|
|
87
|
+
/** Set when `reason === 'scopes-missing'` — the task ids with no scope. */
|
|
88
|
+
missingScopes?: string[];
|
|
89
|
+
/** Set when `reason === 'scopes-missing'` — actionable message for the architect. */
|
|
90
|
+
message?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Test-only DI seam. Mutating this object is file-scoped and trivially
|
|
94
|
+
* restorable via afterEach, avoiding Bun's cross-file `mock.module`
|
|
95
|
+
* leak (AGENTS.md invariant 7).
|
|
96
|
+
*/
|
|
97
|
+
export declare const _internals: {
|
|
98
|
+
loadPluginConfigWithMeta: typeof loadPluginConfigWithMeta_import;
|
|
99
|
+
loadPlanJsonOnly: typeof loadPlanJsonOnly_import;
|
|
100
|
+
getCoChangeData: typeof getCoChangeData_import;
|
|
101
|
+
decideEpicActivation: typeof decideEpicActivation_import;
|
|
102
|
+
isGitRepo: typeof isGitRepo_import;
|
|
103
|
+
appendPromotionEvidence: typeof appendPromotionEvidence_import;
|
|
104
|
+
recordEpicDecision: typeof recordEpicDecision_import;
|
|
105
|
+
isEpicModeActive: typeof isEpicModeActive_import;
|
|
106
|
+
readTaskScopes: typeof readTaskScopes_import;
|
|
107
|
+
loadCalibrationState: typeof loadCalibrationState_import;
|
|
108
|
+
saveCalibrationState: typeof saveCalibrationState_import;
|
|
109
|
+
applyCalibration: typeof applyCalibration_import;
|
|
110
|
+
effectiveActivationThreshold: typeof effectiveActivationThreshold_import;
|
|
111
|
+
effectiveHotModules: typeof effectiveHotModules_import;
|
|
112
|
+
readDivergenceHistory: typeof readDivergenceHistory_import;
|
|
113
|
+
LeanTurboRunner: typeof LeanTurboRunner_import;
|
|
114
|
+
buildIsUpstreamCommitted: typeof buildIsUpstreamCommitted_import;
|
|
115
|
+
buildIsUpstreamCommittedWithStatus: typeof buildIsUpstreamCommittedWithStatus_import;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Decide-only path: runs stages 1-9 of the phase flow (preflight + calibration
|
|
119
|
+
* + co-change + decision + evidence write + session state mirror) and returns
|
|
120
|
+
* the verdict WITHOUT dispatching Lean Turbo.
|
|
121
|
+
*
|
|
122
|
+
* This is the shared helper between:
|
|
123
|
+
* - `epic_run_phase`: legacy unified tool (decide + dispatch in one call) —
|
|
124
|
+
* calls this then continues with dispatch when verdict is promote.
|
|
125
|
+
* - `epic_decide_phase`: transparent flow (decide only — architect then
|
|
126
|
+
* calls `epic_plan_waves` and dispatches each wave via Task for visibility).
|
|
127
|
+
*
|
|
128
|
+
* Returns the same EpicRunPhaseResult shape with:
|
|
129
|
+
* - reason: 'decided' → verdict is promote, caller may dispatch.
|
|
130
|
+
* - reason: 'demoted' → verdict is demote, caller falls back to serial.
|
|
131
|
+
*
|
|
132
|
+
* Error / non-decision reasons (all set success: false):
|
|
133
|
+
* - 'epic-mode-not-active' — the session has not toggled Epic Mode.
|
|
134
|
+
* - 'no-plan' — `.swarm/plan.json` is missing.
|
|
135
|
+
* - 'no-phase' (Phase 12 B11) — the requested phase number isn't in the plan.
|
|
136
|
+
* - 'phase-empty' (Phase 17 E.1) — phase exists but has zero tasks.
|
|
137
|
+
* - 'phase-already-complete' (Phase 15 B35) — every task already completed.
|
|
138
|
+
* - 'scopes-missing' — one or more pending tasks lack declared scope.
|
|
139
|
+
* - 'epic-state-unreadable' — `.swarm/epic-state.json` is corrupt.
|
|
140
|
+
*/
|
|
141
|
+
export declare function executeEpicDecidePhase(args: EpicRunPhaseArgs): Promise<EpicRunPhaseResult>;
|
|
142
|
+
/**
|
|
143
|
+
* Full unified path: decide + dispatch in one call (legacy behavior).
|
|
144
|
+
*
|
|
145
|
+
* For transparent CLI-visible dispatch, prefer `epic_decide_phase` + lane
|
|
146
|
+
* dispatch via the architect's Task tool — see EPIC_MODE_BANNER. This unified
|
|
147
|
+
* path remains for back-compat and for callers that don't need visibility
|
|
148
|
+
* into the parallel coder agents.
|
|
149
|
+
*/
|
|
150
|
+
export declare function executeEpicRunPhase(args: EpicRunPhaseArgs): Promise<EpicRunPhaseResult>;
|
|
151
|
+
/**
|
|
152
|
+
* NOTE: `epic_run_phase` is intentionally NOT exposed as a tool to the
|
|
153
|
+
* architect. The transparent decide-then-dispatch wave flow (`epic_decide_phase`
|
|
154
|
+
* → `epic_plan_waves` → Task dispatch per wave) is the ONLY supported flow,
|
|
155
|
+
* because it gives the user real-time visibility into each concurrent coder
|
|
156
|
+
* agent. The legacy unified-path function `executeEpicRunPhase` remains
|
|
157
|
+
* exported for tests and any composition users, but no ToolDefinition
|
|
158
|
+
* wraps it — so the architect cannot call it and accidentally fall back
|
|
159
|
+
* to the opaque path. This is a deliberate product decision: one flow,
|
|
160
|
+
* unambiguous, always-visible.
|
|
161
|
+
*/
|
|
162
|
+
/**
|
|
163
|
+
* Transparent decide-only tool. Returns the verdict (promote/demote/error)
|
|
164
|
+
* without dispatching coders. The architect should:
|
|
165
|
+
* 1. Call this after declaring scopes for all pending tasks.
|
|
166
|
+
* 2. Surface the verdict to the user.
|
|
167
|
+
* 3. If verdict is `promote`, call `epic_plan_waves` to get the wave plan,
|
|
168
|
+
* then for each wave dispatch one `Task` per `taskId` in that wave —
|
|
169
|
+
* ALL in one assistant message so the wave runs concurrently. Wait for
|
|
170
|
+
* the wave to complete, then advance. Each Task is a visible subagent
|
|
171
|
+
* the user can click into for live progress.
|
|
172
|
+
* 4. After each task completes (via `update_task_status`), call
|
|
173
|
+
* `epic_record_divergence` to feed the calibration loop.
|
|
174
|
+
*
|
|
175
|
+
* This is the CLI-visibility flow. The legacy `epic_run_phase` bundles
|
|
176
|
+
* decide + dispatch into one opaque tool call where the user can't see
|
|
177
|
+
* the concurrent coder agents.
|
|
178
|
+
*/
|
|
179
|
+
export declare const epic_decide_phase: ToolDefinition;
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -79,6 +79,9 @@ export type { ClassifiedFailure, FailureClassification, FailureCluster, } from '
|
|
|
79
79
|
export { classifyAndCluster, classifyFailure, clusterFailures, } from '../test-impact/failure-classifier.js';
|
|
80
80
|
export type { FlakyTestEntry } from '../test-impact/flaky-detector.js';
|
|
81
81
|
export { computeFlakyScore, detectFlakyTests, isTestQuarantined, } from '../test-impact/flaky-detector.js';
|
|
82
|
+
export { epic_plan_waves } from './epic-plan-waves';
|
|
83
|
+
export { epic_record_divergence } from './epic-record-divergence';
|
|
84
|
+
export { epic_decide_phase } from './epic-run-phase';
|
|
82
85
|
export { generate_mutants } from './generate-mutants';
|
|
83
86
|
export { lean_turbo_acquire_locks } from './lean-turbo-acquire-locks';
|
|
84
87
|
export { lean_turbo_plan_lanes } from './lean-turbo-plan-lanes';
|
package/dist/tools/manifest.d.ts
CHANGED
|
@@ -119,4 +119,7 @@ export declare const TOOL_MANIFEST: {
|
|
|
119
119
|
external_skill_reject: () => ToolDefinition;
|
|
120
120
|
external_skill_delete: () => ToolDefinition;
|
|
121
121
|
external_skill_revoke: () => ToolDefinition;
|
|
122
|
+
epic_decide_phase: () => ToolDefinition;
|
|
123
|
+
epic_plan_waves: () => ToolDefinition;
|
|
124
|
+
epic_record_divergence: () => ToolDefinition;
|
|
122
125
|
};
|
|
@@ -407,6 +407,18 @@ export declare const TOOL_METADATA: {
|
|
|
407
407
|
description: string;
|
|
408
408
|
agents: never[];
|
|
409
409
|
};
|
|
410
|
+
epic_decide_phase: {
|
|
411
|
+
description: string;
|
|
412
|
+
agents: "architect"[];
|
|
413
|
+
};
|
|
414
|
+
epic_plan_waves: {
|
|
415
|
+
description: string;
|
|
416
|
+
agents: "architect"[];
|
|
417
|
+
};
|
|
418
|
+
epic_record_divergence: {
|
|
419
|
+
description: string;
|
|
420
|
+
agents: "architect"[];
|
|
421
|
+
};
|
|
410
422
|
};
|
|
411
423
|
/** Union type of all valid tool names (the metadata keys). */
|
|
412
424
|
export type ToolName = keyof typeof TOOL_METADATA;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Epic Mode activation decision (Capability C).
|
|
3
|
+
*
|
|
4
|
+
* `decideEpicActivation(...)` is the pure heart of M3: given a plan, a
|
|
5
|
+
* co-change pair list, and the activation thresholds, it returns a
|
|
6
|
+
* structured `promote | demote` verdict with the rationale fields a
|
|
7
|
+
* caller can persist for audit. Pure function — no I/O.
|
|
8
|
+
*
|
|
9
|
+
* Three independent gates must all pass for promotion:
|
|
10
|
+
*
|
|
11
|
+
* 1. **p-threshold gate.** Compute the coupling coefficient `p` over
|
|
12
|
+
* the plan's task graph using Capability A's `epicPairConflict` (via
|
|
13
|
+
* Capability B's `computeCouplingReport`). Promote only when
|
|
14
|
+
* `p <= activation_threshold`.
|
|
15
|
+
*
|
|
16
|
+
* 2. **Hot-module gate.** No task in scope may touch a Lean Turbo
|
|
17
|
+
* "global" or "protected" path — these are the same lists Lean
|
|
18
|
+
* Turbo already maintains (reused by import; not duplicated).
|
|
19
|
+
* Touching a hot module forces serial regardless of `p`.
|
|
20
|
+
*
|
|
21
|
+
* 3. **Greenfield gate.** If the co-change history is sparse (fewer
|
|
22
|
+
* than `min_commits_for_signal` distinct commits across the
|
|
23
|
+
* analyzer output), the signal is too weak to trust per brief §4.2's
|
|
24
|
+
* greenfield rule. Force serial.
|
|
25
|
+
*
|
|
26
|
+
* Default-serial-promote-on-proof (brief §4.2): when any gate fails or
|
|
27
|
+
* the data is missing, the decision is `demote`. Promotion requires
|
|
28
|
+
* positive evidence on every gate.
|
|
29
|
+
*/
|
|
30
|
+
import type { CoChangeEntry } from '../../tools/co-change-analyzer.js';
|
|
31
|
+
import type { CouplingTask } from './coupling-report.js';
|
|
32
|
+
/** Thresholds the caller supplies (typically derived from EpicConfigSchema). */
|
|
33
|
+
export interface EpicActivationOptions {
|
|
34
|
+
/** Plan-wide p ceiling. Plans with p > activationThreshold are demoted. */
|
|
35
|
+
activationThreshold: number;
|
|
36
|
+
/** Greenfield floor on the analyzer's commit window. */
|
|
37
|
+
minCommitsForSignal: number;
|
|
38
|
+
/** NPMI floor for the co-change conflict signal — passed through to coupling. */
|
|
39
|
+
cochangeNpmiThreshold: number;
|
|
40
|
+
/** Minimum raw co-change count for the conflict signal. */
|
|
41
|
+
cochangeMinCoChanges: number;
|
|
42
|
+
/**
|
|
43
|
+
* Capability D (calibration) additions to the hot-module list. The static
|
|
44
|
+
* Lean Turbo predicates (`isGlobalFile` / `isProtectedPath`) always apply;
|
|
45
|
+
* these are normalised paths the calibration loop has promoted after
|
|
46
|
+
* observing divergent writes against the static set. Optional — falsy or
|
|
47
|
+
* empty means "no calibration overrides". Path matching is exact (post-
|
|
48
|
+
* `normalizePath`); callers compute that via `effectiveHotModules` in
|
|
49
|
+
* `./calibration-engine.ts`.
|
|
50
|
+
*/
|
|
51
|
+
extraHotModules?: readonly string[];
|
|
52
|
+
/**
|
|
53
|
+
* Greenfield-smart Rule 1: whether the project is under git version control.
|
|
54
|
+
* The greenfield gate exists because co-change signals require git history
|
|
55
|
+
* to compute. When the project is not a git repo, there is no signal type
|
|
56
|
+
* to evaluate — the gate's premise is absent, so it passes trivially
|
|
57
|
+
* rather than fail-closed. Callers (typically `epic_run_phase`) resolve
|
|
58
|
+
* this via `isGitRepo(directory)` from `src/git/branch.ts`.
|
|
59
|
+
*
|
|
60
|
+
* Backward-compat: omitted or `undefined` reverts to legacy behavior
|
|
61
|
+
* (apply the `commitsObserved >= minCommitsForSignal` floor
|
|
62
|
+
* unconditionally). Callers should pass an explicit boolean.
|
|
63
|
+
*/
|
|
64
|
+
isGitProject?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Phase 13 (B20): task IDs the architect declared in `depends:` that
|
|
67
|
+
* don't resolve to ANY task in the plan. Typically an LLM typo. The
|
|
68
|
+
* gate fails closed with a dedicated `phantom dep` blocking reason so
|
|
69
|
+
* the architect sees the actual bad ID instead of being misled into
|
|
70
|
+
* hunting a non-existent cross-phase upstream. Pass alongside
|
|
71
|
+
* `crossPhaseUpstreams` (the two lists are disjoint).
|
|
72
|
+
*/
|
|
73
|
+
phantomDeps?: readonly string[];
|
|
74
|
+
/**
|
|
75
|
+
* Phase 10 — predecessor-evidence gate redesign.
|
|
76
|
+
*
|
|
77
|
+
* Cross-phase upstream task IDs for the phase being decided: every
|
|
78
|
+
* task that lives in a strictly-prior phase AND is depended on by a
|
|
79
|
+
* task in the current phase. The gate verifies each one has a
|
|
80
|
+
* `swarm(task <id>):` marker in git log via `isUpstreamCommitted`.
|
|
81
|
+
*
|
|
82
|
+
* Empty array (the legacy default) ⇒ no cross-phase deps to check;
|
|
83
|
+
* predecessor evidence is vacuously satisfied. This is correct for
|
|
84
|
+
* Phase 1 (no prior phase), single-phase projects, and phases the
|
|
85
|
+
* architect explicitly declared as independent.
|
|
86
|
+
*
|
|
87
|
+
* Why this replaces the `commitsObserved >= minCommitsForSignal`
|
|
88
|
+
* floor: the floor was a statistical proxy for "do we have enough
|
|
89
|
+
* history to trust `p`?", but in small projects it permanently
|
|
90
|
+
* blocked parallelism (a 12-task project never reaches 20 commits).
|
|
91
|
+
* The structural check asks the actually-relevant question — "are
|
|
92
|
+
* the things this phase depends on actually in git?" — directly,
|
|
93
|
+
* regardless of project size. The architect's declared dep graph IS
|
|
94
|
+
* the parallelism specification (Lamport happens-before); Rule 2's
|
|
95
|
+
* commits ARE the synchronization point; this check ties them
|
|
96
|
+
* together.
|
|
97
|
+
*
|
|
98
|
+
* Callers (`epic_run_phase`) compute this from the plan's dep graph.
|
|
99
|
+
*/
|
|
100
|
+
crossPhaseUpstreams?: readonly string[];
|
|
101
|
+
/**
|
|
102
|
+
* Predicate for the predecessor-evidence check above. Returns true
|
|
103
|
+
* when the given taskId has a `swarm(task <id>):` marker in git
|
|
104
|
+
* history. Same predicate Rule 3 uses at the lane planner — share
|
|
105
|
+
* one source of truth.
|
|
106
|
+
*
|
|
107
|
+
* Omitted ⇒ the gate treats every cross-phase upstream as
|
|
108
|
+
* uncommitted (fail-closed). Pair `crossPhaseUpstreams` with this
|
|
109
|
+
* predicate, or pass neither.
|
|
110
|
+
*/
|
|
111
|
+
isUpstreamCommitted?: (taskId: string) => boolean;
|
|
112
|
+
}
|
|
113
|
+
/** Each gate's pass/fail outcome plus the evidence behind it. */
|
|
114
|
+
export interface EpicActivationRationale {
|
|
115
|
+
pCheck: {
|
|
116
|
+
passed: boolean;
|
|
117
|
+
p: number;
|
|
118
|
+
threshold: number;
|
|
119
|
+
};
|
|
120
|
+
hotModuleCheck: {
|
|
121
|
+
passed: boolean;
|
|
122
|
+
touchedHotModules: string[];
|
|
123
|
+
};
|
|
124
|
+
greenfieldCheck: {
|
|
125
|
+
passed: boolean;
|
|
126
|
+
commitsObserved: number;
|
|
127
|
+
minCommits: number;
|
|
128
|
+
/**
|
|
129
|
+
* `true` when the caller flagged the project as non-git
|
|
130
|
+
* (`options.isGitProject === false`). In that case the gate is
|
|
131
|
+
* bypassed (`passed: true`) because the co-change signal does not
|
|
132
|
+
* apply — not because the history floor was met. Surfaced for audit
|
|
133
|
+
* so reviewers can distinguish "bypassed" from "satisfied".
|
|
134
|
+
*/
|
|
135
|
+
bypassedNoGit?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Phase 10: cross-phase upstream task IDs the gate consulted.
|
|
138
|
+
* Empty when the current phase has no cross-phase deps (Phase 1,
|
|
139
|
+
* single-phase plans, declared-independent phases).
|
|
140
|
+
*
|
|
141
|
+
* Phase 13 (B19): optional because pre-Phase-10 records on disk
|
|
142
|
+
* (`.swarm/evidence/epic-promotions.jsonl`) lack this field.
|
|
143
|
+
* Renderers MUST default to `[]` when reading historical records.
|
|
144
|
+
*/
|
|
145
|
+
crossPhaseUpstreams?: string[];
|
|
146
|
+
/**
|
|
147
|
+
* Phase 10: cross-phase upstreams the predicate reported as NOT
|
|
148
|
+
* yet committed. Non-empty ⇒ the gate failed; the architect
|
|
149
|
+
* needs to wait for those tasks to commit before re-deciding.
|
|
150
|
+
*
|
|
151
|
+
* Phase 13 (B19): optional, same reason as above.
|
|
152
|
+
*/
|
|
153
|
+
missingUpstreams?: string[];
|
|
154
|
+
/**
|
|
155
|
+
* Phase 13 (B20): dep IDs the architect declared that don't
|
|
156
|
+
* resolve to any task in the plan. Usually an LLM typo; the gate
|
|
157
|
+
* fails CLOSED so the architect can see the bad ID and fix the
|
|
158
|
+
* declaration. Distinct from `missingUpstreams` because phantom
|
|
159
|
+
* IDs aren't tasks that need to be "committed" — they don't
|
|
160
|
+
* exist at all, and the remediation is "fix the dep ID", not
|
|
161
|
+
* "wait for the upstream to land".
|
|
162
|
+
*/
|
|
163
|
+
phantomDeps?: string[];
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/** The verdict `decideEpicActivation` returns. */
|
|
167
|
+
export interface EpicActivationVerdict {
|
|
168
|
+
decision: 'promote' | 'demote';
|
|
169
|
+
p: number;
|
|
170
|
+
rationale: EpicActivationRationale;
|
|
171
|
+
/** Plain-English reasons the verdict went the way it did — for logs and UI. */
|
|
172
|
+
blockingReasons: string[];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Decide whether the given tasks should be promoted to parallel execution
|
|
176
|
+
* via Lean Turbo's lane planner.
|
|
177
|
+
*
|
|
178
|
+
* Inputs are pre-resolved by the caller:
|
|
179
|
+
* - `tasks`: every task in scope (typically the whole plan), with the
|
|
180
|
+
* same `{ id, scope }` shape Capability B consumes. The caller
|
|
181
|
+
* handles `readTaskScopes` / `files_touched` resolution and any
|
|
182
|
+
* completed-task filtering.
|
|
183
|
+
* - `cochangePairs`: the analyzer's output (unfiltered) plus the
|
|
184
|
+
* `commitsObserved` count from `parseGitLog`. The greenfield gate
|
|
185
|
+
* consults the count directly so the function stays pure.
|
|
186
|
+
* - `options`: thresholds (typically read from
|
|
187
|
+
* `turbo.epic.mode.*` + `turbo.epic.cochange.*`).
|
|
188
|
+
*
|
|
189
|
+
* Output: structured verdict the caller persists to
|
|
190
|
+
* `.swarm/evidence/epic-promotions.jsonl` and surfaces via
|
|
191
|
+
* `/swarm epic status`.
|
|
192
|
+
*/
|
|
193
|
+
export declare function decideEpicActivation(tasks: CouplingTask[], cochangePairs: CoChangeEntry[], commitsObserved: number, options: EpicActivationOptions): EpicActivationVerdict;
|