opencode-swarm 6.86.14 → 7.0.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.
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Handles /swarm close command - performs full terminal session finalization:
3
+ * 0. Guarantee: mark all incomplete phases/tasks as closed
3
4
  * 1. Finalize: write retrospectives, produce terminal summary
4
5
  * 2. Archive: create timestamped bundle of swarm artifacts
5
6
  * 3. Clean: clear active-state files that confuse future swarms
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Handle /swarm issue command.
3
+ *
4
+ * Triggers the architect to enter MODE: ISSUE_INGEST — the swarm issue ingest workflow.
5
+ * Accepts issue URL in multiple formats and sanitizes inputs against injection.
6
+ *
7
+ * Flag parsing:
8
+ * --plan → appends plan=true to emitted signal
9
+ * --trace → appends trace=true to emitted signal (implies --plan)
10
+ * --no-repro → appends noRepro=true to emitted signal
11
+ * no args → returns usage string (no throw)
12
+ */
13
+ export declare function handleIssueCommand(_directory: string, args: string[]): string;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Handle /swarm pr-review command.
3
+ *
4
+ * Triggers the architect to enter MODE: PR_REVIEW — the swarm PR review workflow.
5
+ * Accepts PR URL in multiple formats and sanitizes inputs against injection.
6
+ *
7
+ * Flag parsing:
8
+ * --council → appends council=true to emitted signal
9
+ * no args → returns usage string (no throw)
10
+ */
11
+ export declare function handlePrReviewCommand(_directory: string, args: string[]): string;
@@ -166,11 +166,23 @@ export declare const COMMAND_REGISTRY: {
166
166
  readonly args: "<question> [--preset <name>] [--spec-review]";
167
167
  readonly details: "Triggers the architect to convene a configurable General Council: each member independently web-searches, answers, and engages in one structured deliberation round on disagreements; an optional moderator pass synthesizes the final answer. --preset <name> selects a member group from council.general.presets. --spec-review switches to single-pass advisory mode for spec review. Requires council.general.enabled: true and a search API key in opencode-swarm.json.";
168
168
  };
169
+ readonly 'pr-review': {
170
+ readonly handler: (ctx: CommandContext) => Promise<string>;
171
+ readonly description: "Launch deep PR review with multi-lane analysis [url] [--council]";
172
+ readonly args: "<pr-url|owner/repo#N|N> [--council]";
173
+ readonly details: "Launches a structured PR review: reconstructs PR intent via obligation extraction cascade, runs 6 parallel explorer lanes (correctness, security, dependencies, docs-intent-vs-actual, tests, performance-architecture), validates findings through independent reviewer confirmation, applies critic challenge to HIGH/CRITICAL findings, synthesizes structured report. --council variant fires adversarial multi-model review. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolves against origin remote).";
174
+ };
175
+ readonly issue: {
176
+ readonly handler: (ctx: CommandContext) => Promise<string>;
177
+ readonly description: "Ingest a GitHub issue into the swarm workflow [url] [--plan] [--trace] [--no-repro]";
178
+ readonly args: "<issue-url|owner/repo#N|N> [--plan] [--trace] [--no-repro]";
179
+ readonly details: "Triggers the architect to enter MODE: ISSUE_INGEST — ingests a GitHub issue, restructures it into a normalized intake note, localizes root cause through hypothesis-driven tracing, and outputs a resolution spec. --plan transitions to plan creation after spec generation. --trace runs the full fix-and-PR workflow (implies --plan). --no-repro skips the reproduction step. Supports full GitHub URL, owner/repo#N shorthand, or bare issue number (resolves against origin remote).";
180
+ };
169
181
  readonly 'qa-gates': {
170
182
  readonly handler: (ctx: CommandContext) => Promise<string>;
171
183
  readonly description: "View or modify QA gate profile for the current plan [enable|override <gate>...]";
172
184
  readonly args: "[show|enable|override] <gate>...";
173
- readonly details: "show: display spec-level, session-override, and effective QA gates for the current plan. enable: persist gate(s) into the locked-once profile (architect; rejected after critic approval lock). override: session-only ratchet-tighter enable. Valid gates: reviewer, test_engineer, council_mode, sme_enabled, critic_pre_plan, hallucination_guard, sast_enabled, mutation_test, council_general_review.";
185
+ readonly details: "show: display spec-level, session-override, and effective QA gates for the current plan. enable: persist gate(s) into the locked-once profile (architect; rejected after critic approval lock). override: session-only ratchet-tighter enable. Valid gates: reviewer, test_engineer, council_mode, sme_enabled, critic_pre_plan, hallucination_guard, sast_enabled, mutation_test, council_general_review, drift_check.";
174
186
  };
175
187
  readonly promote: {
176
188
  readonly handler: (ctx: CommandContext) => Promise<string>;
@@ -103,6 +103,10 @@ export declare const PhaseSchema: z.ZodObject<{
103
103
  evidence_path: z.ZodOptional<z.ZodString>;
104
104
  blocked_reason: z.ZodOptional<z.ZodString>;
105
105
  }, z.core.$strip>>>;
106
+ type: z.ZodOptional<z.ZodEnum<{
107
+ code: "code";
108
+ "non-code": "non-code";
109
+ }>>;
106
110
  required_agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
111
  }, z.core.$strip>;
108
112
  export type Phase = z.infer<typeof PhaseSchema>;
@@ -144,6 +148,10 @@ export declare const PlanSchema: z.ZodObject<{
144
148
  evidence_path: z.ZodOptional<z.ZodString>;
145
149
  blocked_reason: z.ZodOptional<z.ZodString>;
146
150
  }, z.core.$strip>>>;
151
+ type: z.ZodOptional<z.ZodEnum<{
152
+ code: "code";
153
+ "non-code": "non-code";
154
+ }>>;
147
155
  required_agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
148
156
  }, z.core.$strip>>;
149
157
  migration_status: z.ZodOptional<z.ZodEnum<{
@@ -583,6 +583,7 @@ export declare const CouncilConfigSchema: z.ZodObject<{
583
583
  requireAllMembers: z.ZodDefault<z.ZodBoolean>;
584
584
  minimumMembers: z.ZodDefault<z.ZodNumber>;
585
585
  escalateOnMaxRounds: z.ZodOptional<z.ZodString>;
586
+ phaseConcernsAllowComplete: z.ZodDefault<z.ZodBoolean>;
586
587
  general: z.ZodOptional<z.ZodObject<{
587
588
  enabled: z.ZodDefault<z.ZodBoolean>;
588
589
  searchProvider: z.ZodDefault<z.ZodEnum<{
@@ -625,6 +626,8 @@ export declare const ParallelizationConfigSchema: z.ZodObject<{
625
626
  enabled: z.ZodDefault<z.ZodBoolean>;
626
627
  maxConcurrentTasks: z.ZodDefault<z.ZodNumber>;
627
628
  evidenceLockTimeoutMs: z.ZodDefault<z.ZodNumber>;
629
+ max_coders: z.ZodDefault<z.ZodNumber>;
630
+ max_reviewers: z.ZodDefault<z.ZodNumber>;
628
631
  stageB: z.ZodDefault<z.ZodObject<{
629
632
  parallel: z.ZodDefault<z.ZodObject<{
630
633
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -1007,6 +1010,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
1007
1010
  requireAllMembers: z.ZodDefault<z.ZodBoolean>;
1008
1011
  minimumMembers: z.ZodDefault<z.ZodNumber>;
1009
1012
  escalateOnMaxRounds: z.ZodOptional<z.ZodString>;
1013
+ phaseConcernsAllowComplete: z.ZodDefault<z.ZodBoolean>;
1010
1014
  general: z.ZodOptional<z.ZodObject<{
1011
1015
  enabled: z.ZodDefault<z.ZodBoolean>;
1012
1016
  searchProvider: z.ZodDefault<z.ZodEnum<{
@@ -1048,6 +1052,8 @@ export declare const PluginConfigSchema: z.ZodObject<{
1048
1052
  enabled: z.ZodDefault<z.ZodBoolean>;
1049
1053
  maxConcurrentTasks: z.ZodDefault<z.ZodNumber>;
1050
1054
  evidenceLockTimeoutMs: z.ZodDefault<z.ZodNumber>;
1055
+ max_coders: z.ZodDefault<z.ZodNumber>;
1056
+ max_reviewers: z.ZodDefault<z.ZodNumber>;
1051
1057
  stageB: z.ZodDefault<z.ZodObject<{
1052
1058
  parallel: z.ZodDefault<z.ZodObject<{
1053
1059
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -8,5 +8,14 @@
8
8
  * No I/O — fully unit-testable with mock inputs. All file reads/writes happen in
9
9
  * sibling modules (criteria-store, council-evidence-writer).
10
10
  */
11
- import type { CouncilConfig, CouncilCriteria, CouncilMemberVerdict, CouncilSynthesis } from './types';
11
+ import type { CouncilConfig, CouncilCriteria, CouncilMemberVerdict, CouncilSynthesis, PhaseCouncilSynthesis } from './types';
12
12
  export declare function synthesizeCouncilVerdicts(taskId: string, swarmId: string, verdicts: CouncilMemberVerdict[], criteria: CouncilCriteria | null, roundNumber: number, config?: Partial<CouncilConfig>): CouncilSynthesis;
13
+ /**
14
+ * Synthesize phase-level council verdicts into a PhaseCouncilSynthesis.
15
+ * Reuses the same veto detection, conflict detection, and finding
16
+ * classification logic as per-task council, but scoped to a phase number.
17
+ *
18
+ * Evidence is written to .swarm/evidence/{phase}/phase-council.json relative
19
+ * to workingDir (or cwd).
20
+ */
21
+ export declare function synthesizePhaseCouncilAdvisory(phaseNumber: number, phaseSummary: string, verdicts: CouncilMemberVerdict[], roundNumber: number, config?: Partial<CouncilConfig>, workingDir?: string): PhaseCouncilSynthesis;
@@ -53,6 +53,40 @@ export interface CouncilSynthesis {
53
53
  /** true when called with an empty verdicts array — the APPROVE is vacuous */
54
54
  emptyVerdictsWarning?: boolean;
55
55
  }
56
+ /**
57
+ * Phase-level council synthesis result.
58
+ * Distinct from CouncilSynthesis — scoped to a phase number
59
+ * rather than a task ID, and targets .swarm/evidence/{phase}/phase-council.json
60
+ * for evidence-file attestation.
61
+ */
62
+ export interface PhaseCouncilSynthesis {
63
+ phaseNumber: number;
64
+ /** Always 'phase' — distinguishes from task-level council */
65
+ scope: 'phase';
66
+ /** ISO 8601 */
67
+ timestamp: string;
68
+ overallVerdict: CouncilVerdict;
69
+ vetoedBy: CouncilAgent[] | null;
70
+ memberVerdicts: CouncilMemberVerdict[];
71
+ unresolvedConflicts: string[];
72
+ /** Severity HIGH + MEDIUM from veto members */
73
+ requiredFixes: CouncilFinding[];
74
+ /** Severity LOW or from non-veto members */
75
+ advisoryFindings: CouncilFinding[];
76
+ /** Phase-level advisory notes for the architect */
77
+ advisoryNotes: string[];
78
+ /** Single markdown document for phase review */
79
+ unifiedFeedbackMd: string;
80
+ /** 1-indexed */
81
+ roundNumber: number;
82
+ allCriteriaMet: boolean;
83
+ /** Distinct council members that produced verdicts */
84
+ quorumSize: number;
85
+ /** Path where evidence was written, e.g. .swarm/evidence/1/phase-council.json */
86
+ evidencePath: string;
87
+ /** Summary of the phase being reviewed */
88
+ phaseSummary?: string;
89
+ }
56
90
  export interface CouncilCriteriaItem {
57
91
  id: string;
58
92
  description: string;
@@ -86,5 +120,7 @@ export interface CouncilConfig {
86
120
  * options: critic_oversight agent, HTTP webhook, or configurable handler.
87
121
  */
88
122
  escalateOnMaxRounds?: string;
123
+ /** Default true — CONCERNS verdict at phase-level council does NOT block completion (advisory). Set false to make CONCERNS block like REJECT. */
124
+ phaseConcernsAllowComplete: boolean;
89
125
  }
90
126
  export declare const COUNCIL_DEFAULTS: CouncilConfig;
@@ -7,7 +7,7 @@
7
7
  * Sessions can only ratchet gates tighter (enable more), never disable them.
8
8
  */
9
9
  /**
10
- * QA gate flags. All nine gates are tracked explicitly.
10
+ * QA gate flags. All ten gates are tracked explicitly.
11
11
  */
12
12
  export interface QaGates {
13
13
  reviewer: boolean;
@@ -19,6 +19,7 @@ export interface QaGates {
19
19
  sast_enabled: boolean;
20
20
  mutation_test: boolean;
21
21
  council_general_review: boolean;
22
+ drift_check: boolean;
22
23
  }
23
24
  /**
24
25
  * Default QA gate configuration for newly-created profiles.
@@ -96,6 +97,8 @@ export declare function computeProfileHash(profile: QaGateProfile): string;
96
97
  * - council_general_review — src/agents/architect.ts SPECIFY-COUNCIL-REVIEW
97
98
  * (fires when gate is true; runs convene_general_council on draft spec before
98
99
  * critic-gate to fold multi-model deliberation into the spec).
100
+ * - drift_check — src/tools/phase-complete.ts Gate 2 (blocks phase_complete when
101
+ * drift-verifier.json missing or rejected)
99
102
  *
100
103
  * Session overrides are intentionally ephemeral — they live only in
101
104
  * in-memory `AgentSessionState.qaGateSessionOverrides` and are NOT
@@ -48,3 +48,23 @@ export declare function getCurrentSha(cwd: string): string;
48
48
  * Check if there are uncommitted changes
49
49
  */
50
50
  export declare function hasUncommittedChanges(cwd: string): boolean;
51
+ export interface ResetToRemoteBranchResult {
52
+ success: boolean;
53
+ targetBranch: string;
54
+ localBranch: string;
55
+ message: string;
56
+ alreadyAligned: boolean;
57
+ prunedBranches: string[];
58
+ warnings: string[];
59
+ }
60
+ /**
61
+ * Reset local branch to align with its remote counterpart.
62
+ * Safely handles uncommitted changes, unpushed commits, and detached HEAD states.
63
+ *
64
+ * @param cwd - Working directory
65
+ * @param options - Options including pruneBranches flag
66
+ * @returns Result object with success status and details
67
+ */
68
+ export declare function resetToRemoteBranch(cwd: string, options?: {
69
+ pruneBranches?: boolean;
70
+ }): ResetToRemoteBranchResult;