opencode-swarm 6.75.0 → 6.77.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,2 +1,12 @@
1
1
  export { createNoopDispatcher, type NoopDispatcher, } from './noop-dispatcher.js';
2
+ export { createParallelDispatcher, type ParallelDispatcher, } from './parallel-dispatcher.js';
2
3
  export type { DispatchDecision, DispatcherConfig, RunSlot, TaskExecutionHandle, } from './types.js';
4
+ import { type NoopDispatcher } from './noop-dispatcher.js';
5
+ import { type ParallelDispatcher } from './parallel-dispatcher.js';
6
+ import type { DispatcherConfig } from './types.js';
7
+ /**
8
+ * Factory: returns the appropriate dispatcher based on config.
9
+ * When disabled or maxConcurrentTasks <= 1, returns the no-op dispatcher.
10
+ * When enabled and maxConcurrentTasks > 1, returns the parallel dispatcher.
11
+ */
12
+ export declare function createDispatcher(config: DispatcherConfig): NoopDispatcher | ParallelDispatcher;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Parallel dispatcher — enabled path for Stage B concurrent task execution.
3
+ *
4
+ * Uses p-limit for bounded concurrency. Returns 'dispatch' when a slot is
5
+ * available, 'defer' when at max capacity, 'reject' when disabled.
6
+ *
7
+ * PR 2: implements the enabled dispatcher alongside the existing NoopDispatcher.
8
+ * No production code imports this directly — it is wired in via createDispatcher().
9
+ */
10
+ import type { DispatchDecision, DispatcherConfig, TaskExecutionHandle } from './types.js';
11
+ export interface ParallelDispatcher {
12
+ readonly config: DispatcherConfig;
13
+ dispatch(taskId: string): DispatchDecision;
14
+ handles(): TaskExecutionHandle[];
15
+ releaseSlot(slotId: string): void;
16
+ shutdown(): void;
17
+ }
18
+ export declare function createParallelDispatcher(config: DispatcherConfig): ParallelDispatcher;
package/dist/state.d.ts CHANGED
@@ -103,6 +103,13 @@ export interface AgentSessionState {
103
103
  qaSkipTaskIds: string[];
104
104
  /** Per-task workflow state — taskId → current state */
105
105
  taskWorkflowStates: Map<string, TaskWorkflowState>;
106
+ /**
107
+ * PR 2 Stage B barrier: per-task set of completed Stage B agents.
108
+ * Order-independent — either 'reviewer' or 'test_engineer' may complete first.
109
+ * When both are present, the task may advance to tests_run regardless of order.
110
+ * Only populated when parallelization.stageB.parallel.enabled = true.
111
+ */
112
+ stageBCompletion?: Map<string, Set<'reviewer' | 'test_engineer'>>;
106
113
  /** v6.71+ Council mode: per-task council verdict, recorded by delegation-gate when convene_council resolves. */
107
114
  taskCouncilApproved?: Map<string, {
108
115
  verdict: 'APPROVE' | 'REJECT' | 'CONCERNS';
@@ -350,6 +357,25 @@ export declare function advanceTaskState(session: AgentSessionState, taskId: str
350
357
  * @returns Current task workflow state
351
358
  */
352
359
  export declare function getTaskState(session: AgentSessionState, taskId: string): TaskWorkflowState;
360
+ /**
361
+ * PR 2 Stage B barrier: record that a Stage B agent has completed for a task.
362
+ * Order-independent — either 'reviewer' or 'test_engineer' may complete first.
363
+ * Initializes the per-task set on first write.
364
+ *
365
+ * @param session - The agent session state
366
+ * @param taskId - The task identifier
367
+ * @param agent - Which Stage B agent completed ('reviewer' or 'test_engineer')
368
+ */
369
+ export declare function recordStageBCompletion(session: AgentSessionState, taskId: string, agent: 'reviewer' | 'test_engineer'): void;
370
+ /**
371
+ * PR 2 Stage B barrier: returns true iff both 'reviewer' and 'test_engineer' have
372
+ * been recorded for the given task in this session.
373
+ *
374
+ * @param session - The agent session state
375
+ * @param taskId - The task identifier
376
+ * @returns true when both Stage B agents have completed
377
+ */
378
+ export declare function hasBothStageBCompletions(session: AgentSessionState, taskId: string): boolean;
353
379
  /**
354
380
  * Returns true iff council is authoritative for the current plan.
355
381
  *
@@ -50,5 +50,37 @@ export interface TestErrorResult {
50
50
  }
51
51
  export type TestResult = TestSuccessResult | TestErrorResult;
52
52
  export declare function detectTestFramework(cwd: string): Promise<TestFramework>;
53
+ /**
54
+ * Returns true when `basename` matches a language-specific test file naming
55
+ * convention that is NOT captured by the compound-extension or dot-separated
56
+ * `.test.`/`.spec.` checks above.
57
+ *
58
+ * Covered patterns (all lower-cased for comparison):
59
+ * Go : <name>_test.go (per `go test` convention)
60
+ * Python: test_<name>.py (pytest discovery default)
61
+ * <name>_test.py (pytest alternative)
62
+ * Ruby : <name>_spec.rb (RSpec convention)
63
+ * Java : Test<Name>.java (JUnit 4/5 prefix)
64
+ * <Name>Test.java (JUnit 4/5 suffix)
65
+ * <Name>Tests.java (JUnit 4/5 plural suffix)
66
+ * <Name>IT.java (Maven Failsafe integration-test suffix)
67
+ * C# : <Name>Test.cs (xUnit/NUnit/MSTest suffix)
68
+ * <Name>Tests.cs (xUnit/NUnit/MSTest plural suffix)
69
+ * Rust : test files are recognized by test-directory placement
70
+ * (for example, tests/<anything>.rs via /tests/ path detection)
71
+ * Kotlin: <Name>Test.kt / <Name>Tests.kt / Test<Name>.kt
72
+ *
73
+ * Exported for unit tests; production code uses it only through
74
+ * getTestFilesFromConvention.
75
+ */
76
+ export declare function isLanguageSpecificTestFile(basename: string): boolean;
77
+ /**
78
+ * Map source files (or already-test files) to the test files that should be
79
+ * run for them. Handles any language whose test files follow a naming convention
80
+ * — TS/JS, Go, Python, Ruby, Java, C#, Kotlin, PowerShell.
81
+ *
82
+ * Exported for unit tests.
83
+ */
84
+ export declare function getTestFilesFromConvention(sourceFiles: string[], workingDir?: string): string[];
53
85
  export declare function runTests(framework: TestFramework, scope: 'all' | 'convention' | 'graph' | 'impact', files: string[], coverage: boolean, timeout_ms: number, cwd: string): Promise<TestResult>;
54
86
  export declare const test_runner: ReturnType<typeof tool>;
@@ -49,12 +49,14 @@ export interface ReviewerGateResult {
49
49
  * both reviewer delegation and test_engineer runs have been recorded.
50
50
  * @param taskId - The task ID to check gate state for
51
51
  * @param workingDirectory - Optional working directory for plan.json fallback
52
+ * @param stageBParallelEnabled - When true, also accept both-markers-present as passing (PR 2 barrier)
52
53
  * @returns ReviewerGateResult indicating whether the gate is blocked
53
54
  */
54
- export declare function checkReviewerGate(taskId: string, workingDirectory?: string): ReviewerGateResult;
55
+ export declare function checkReviewerGate(taskId: string, workingDirectory?: string, stageBParallelEnabled?: boolean): ReviewerGateResult;
55
56
  /**
56
57
  * Wrapper around checkReviewerGate that appends a diff-scope advisory warning.
57
58
  * Keeps checkReviewerGate synchronous for backward compatibility.
59
+ * Also resolves the PR 2 stageB.parallel.enabled flag from config.
58
60
  * @param taskId - The task ID to check gate state for
59
61
  * @param workingDirectory - Optional working directory for plan.json fallback
60
62
  * @returns ReviewerGateResult with optional scope warning appended to reason
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.75.0",
3
+ "version": "6.77.0",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",