opencode-swarm 7.18.3 → 7.19.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.
@@ -56,18 +56,6 @@ export interface ConfigDoctorResult {
56
56
  /** The config that was analyzed */
57
57
  configSource: string;
58
58
  }
59
- /** Model availability snapshot from the active OpenCode provider registry. */
60
- export interface ModelAvailability {
61
- /** Fully-qualified model IDs in provider/model form. */
62
- availableModelIds: ReadonlySet<string>;
63
- /** Human-readable source for diagnostics. */
64
- source: string;
65
- /** Optional failure message when the registry could not be loaded. */
66
- error?: string;
67
- }
68
- export interface ConfigDoctorOptions {
69
- modelAvailability?: ModelAvailability;
70
- }
71
59
  /** Backup artifact for rollback */
72
60
  export interface ConfigBackup {
73
61
  /** When the backup was created */
@@ -102,11 +90,10 @@ export declare function writeBackupArtifact(directory: string, backup: ConfigBac
102
90
  * @returns the path to the restored config file, or null if restore failed
103
91
  */
104
92
  export declare function restoreFromBackup(backupPath: string, directory: string): string | null;
105
- export declare function collectConfiguredModelRefs(config: PluginConfig): Map<string, Set<string>>;
106
93
  /**
107
94
  * Run the config doctor on a loaded config
108
95
  */
109
- export declare function runConfigDoctor(config: PluginConfig, directory: string, options?: ConfigDoctorOptions): ConfigDoctorResult;
96
+ export declare function runConfigDoctor(config: PluginConfig, directory: string): ConfigDoctorResult;
110
97
  /**
111
98
  * Apply safe auto-fixes to config
112
99
  * Only applies low-risk, non-destructive fixes
@@ -129,7 +116,7 @@ export declare function shouldRunOnStartup(automationConfig: {
129
116
  /**
130
117
  * Full config doctor run with backup and fix application
131
118
  */
132
- export declare function runConfigDoctorWithFixes(directory: string, config: PluginConfig, autoFix?: boolean, options?: ConfigDoctorOptions): Promise<{
119
+ export declare function runConfigDoctorWithFixes(directory: string, config: PluginConfig, autoFix?: boolean): Promise<{
133
120
  result: ConfigDoctorResult;
134
121
  backupPath: string | null;
135
122
  appliedFixes: ConfigFix[];
@@ -1,4 +1,12 @@
1
1
  import type { Evidence } from '../config/evidence-schema';
2
+ import { listEvidenceTaskIds as _listEvidenceTaskIds, loadEvidence as _loadEvidence } from '../evidence/manager';
3
+ /**
4
+ * _internals — DI seam for testing async I/O without cross-module mocks.
5
+ */
6
+ export declare const _internals: {
7
+ loadEvidence: typeof _loadEvidence;
8
+ listEvidenceTaskIds: typeof _listEvidenceTaskIds;
9
+ };
2
10
  /**
3
11
  * Structured evidence entry for a task.
4
12
  */
@@ -1,3 +1,19 @@
1
+ import { readSwarmFileAsync } from '../hooks/utils';
2
+ import { derivePlanMarkdown, loadPlanJsonOnly } from '../plan/manager';
3
+ /**
4
+ * Test-only dependency-injection seam. Production code calls
5
+ * `_internals.loadPlanJsonOnly(...)`, `_internals.derivePlanMarkdown(...)`,
6
+ * and `_internals.readSwarmFileAsync(...)` so tests can replace the
7
+ * functions on this object without touching the real module — `mock.module`
8
+ * from `bun:test` leaks across files in Bun's shared test-runner process,
9
+ * which would corrupt unrelated suites. Mutating this local object is
10
+ * file-scoped and trivially restorable via `afterEach`.
11
+ */
12
+ export declare const _internals: {
13
+ loadPlanJsonOnly: typeof loadPlanJsonOnly;
14
+ derivePlanMarkdown: typeof derivePlanMarkdown;
15
+ readSwarmFileAsync: typeof readSwarmFileAsync;
16
+ };
1
17
  /**
2
18
  * Structured plan data for a specific phase or full plan.
3
19
  */
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * AgentRunContext — typed per-run state container.
3
3
  *
4
- * Holds the subset of swarmState used by run-scoped orchestration:
4
+ * Holds the subset of swarmState needed for future per-run isolation:
5
5
  * activeToolCalls, activeAgent, delegationChains, agentSessions,
6
6
  * environmentProfiles, and a shared reference to process-global toolAggregates.
7
7
  *
8
- * The default context preserves existing single-run behavior. Distinct contexts
9
- * remain available for dispatcher-slot isolation as the standard parallel path
10
- * grows beyond current task and Stage B gate coordination.
8
+ * PR 1 (dark foundation): the class exists and is instantiated for the default
9
+ * single-run path only. No runtime behavior is changed.
10
+ * PR 2 will wire distinct contexts to parallel dispatcher slots.
11
11
  *
12
12
  * Generic type parameters let state.ts bind concrete internal types without
13
13
  * creating a circular import.
package/dist/state.d.ts CHANGED
@@ -50,7 +50,6 @@ export type DelegationReason = 'normal_delegation' | 'review_rejected' | 'critic
50
50
  * Transitions must be forward-only: idle → coder_delegated → pre_check_passed → reviewer_run → tests_run → complete
51
51
  */
52
52
  export type TaskWorkflowState = 'idle' | 'coder_delegated' | 'pre_check_passed' | 'reviewer_run' | 'tests_run' | 'complete';
53
- export type StageBGate = 'reviewer' | 'test_engineer' | 'adversarial_test_engineer';
54
53
  /**
55
54
  * Represents per-session state for guardrail tracking.
56
55
  * Budget fields (toolCallCount, consecutiveErrors, etc.) have moved to InvocationWindow.
@@ -112,9 +111,7 @@ export interface AgentSessionState {
112
111
  * When both are present, the task may advance to tests_run regardless of order.
113
112
  * Always populated — Stage B is unconditionally parallel.
114
113
  */
115
- stageBCompletion?: Map<string, Set<StageBGate>>;
116
- /** Per-task required Stage B gates. Optional gates are added when dispatched. */
117
- requiredStageBGates?: Map<string, Set<StageBGate>>;
114
+ stageBCompletion?: Map<string, Set<'reviewer' | 'test_engineer'>>;
118
115
  /** v6.71+ Council mode: per-task council verdict, recorded by delegation-gate when submit_council_verdicts resolves. */
119
116
  taskCouncilApproved?: Map<string, {
120
117
  verdict: 'APPROVE' | 'REJECT' | 'CONCERNS';
@@ -451,11 +448,19 @@ export declare function advanceTaskStateAndPersist(session: AgentSessionState, t
451
448
  * @returns Current task workflow state
452
449
  */
453
450
  export declare function getTaskState(session: AgentSessionState, taskId: string): TaskWorkflowState;
454
- export declare function requireStageBGate(session: AgentSessionState, taskId: string, gate: StageBGate): void;
455
- export declare function recordStageBCompletion(session: AgentSessionState, taskId: string, agent: StageBGate): void;
456
451
  /**
457
- * PR 2 Stage B barrier: returns true iff every required Stage B gate has been
458
- * recorded for the given task in this session.
452
+ * PR 2 Stage B barrier: record that a Stage B agent has completed for a task.
453
+ * Order-independent either 'reviewer' or 'test_engineer' may complete first.
454
+ * Initializes the per-task set on first write.
455
+ *
456
+ * @param session - The agent session state
457
+ * @param taskId - The task identifier
458
+ * @param agent - Which Stage B agent completed ('reviewer' or 'test_engineer')
459
+ */
460
+ export declare function recordStageBCompletion(session: AgentSessionState, taskId: string, agent: 'reviewer' | 'test_engineer'): void;
461
+ /**
462
+ * PR 2 Stage B barrier: returns true iff both 'reviewer' and 'test_engineer' have
463
+ * been recorded for the given task in this session.
459
464
  *
460
465
  * @param session - The agent session state
461
466
  * @param taskId - The task identifier
@@ -50,6 +50,7 @@ export { skill_inspect } from './skill-inspect';
50
50
  export { skill_list } from './skill-list';
51
51
  export { spec_write } from './spec-write';
52
52
  export { submit_phase_council_verdicts } from './submit-phase-council-verdicts';
53
+ export { createSwarmCommandTool } from './swarm-command';
53
54
  import { suggestPatch } from './suggest-patch';
54
55
  export { suggestPatch };
55
56
  export type { SuggestPatchArgs } from './suggest-patch';
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from '../agents/index.js';
2
+ import { createSwarmTool } from './create-tool.js';
3
+ export declare function createSwarmCommandTool(agents: Record<string, AgentDefinition>): ReturnType<typeof createSwarmTool>;
@@ -3,7 +3,7 @@
3
3
  * Used for constants and agent setup references.
4
4
  */
5
5
  /** Union type of all valid tool names */
6
- export type ToolName = 'diff' | 'diff_summary' | 'syntax_check' | 'placeholder_scan' | 'imports' | 'lint' | 'secretscan' | 'sast_scan' | 'build_check' | 'pre_check_batch' | 'quality_budget' | 'symbols' | 'complexity_hotspots' | 'schema_drift' | 'todo_extract' | 'evidence_check' | 'check_gate_status' | 'completion_verify' | 'submit_council_verdicts' | 'submit_phase_council_verdicts' | 'declare_council_criteria' | 'sbom_generate' | 'checkpoint' | 'pkg_audit' | 'test_runner' | 'test_impact' | 'mutation_test' | 'generate_mutants' | 'detect_domains' | 'gitingest' | 'retrieve_summary' | 'extract_code_blocks' | 'phase_complete' | 'save_plan' | 'update_task_status' | 'lint_spec' | 'write_retro' | 'write_drift_evidence' | 'write_hallucination_evidence' | 'write_mutation_evidence' | 'declare_scope' | 'knowledge_query' | 'doc_scan' | 'doc_extract' | 'curator_analyze' | 'knowledge_add' | 'knowledge_recall' | 'knowledge_remove' | 'co_change_analyzer' | 'search' | 'batch_symbols' | 'suggest_patch' | 'req_coverage' | 'get_approved_plan' | 'repo_map' | 'get_qa_gate_profile' | 'set_qa_gates' | 'web_search' | 'convene_general_council' | 'write_final_council_evidence' | 'skill_generate' | 'skill_list' | 'skill_apply' | 'skill_inspect' | 'skill_improve' | 'spec_write' | 'knowledge_ack' | 'lean_turbo_plan_lanes' | 'lean_turbo_acquire_locks' | 'lean_turbo_runner_status' | 'lean_turbo_review' | 'lean_turbo_run_phase' | 'lean_turbo_status';
6
+ export type ToolName = 'diff' | 'diff_summary' | 'syntax_check' | 'placeholder_scan' | 'imports' | 'lint' | 'secretscan' | 'sast_scan' | 'build_check' | 'pre_check_batch' | 'quality_budget' | 'symbols' | 'complexity_hotspots' | 'schema_drift' | 'todo_extract' | 'evidence_check' | 'check_gate_status' | 'completion_verify' | 'submit_council_verdicts' | 'submit_phase_council_verdicts' | 'declare_council_criteria' | 'sbom_generate' | 'checkpoint' | 'pkg_audit' | 'test_runner' | 'test_impact' | 'mutation_test' | 'generate_mutants' | 'detect_domains' | 'gitingest' | 'retrieve_summary' | 'extract_code_blocks' | 'phase_complete' | 'save_plan' | 'update_task_status' | 'lint_spec' | 'write_retro' | 'write_drift_evidence' | 'write_hallucination_evidence' | 'write_mutation_evidence' | 'declare_scope' | 'knowledge_query' | 'doc_scan' | 'doc_extract' | 'curator_analyze' | 'knowledge_add' | 'knowledge_recall' | 'knowledge_remove' | 'co_change_analyzer' | 'search' | 'batch_symbols' | 'suggest_patch' | 'req_coverage' | 'get_approved_plan' | 'repo_map' | 'get_qa_gate_profile' | 'set_qa_gates' | 'web_search' | 'convene_general_council' | 'write_final_council_evidence' | 'skill_generate' | 'skill_list' | 'skill_apply' | 'skill_inspect' | 'skill_improve' | 'spec_write' | 'knowledge_ack' | 'swarm_command' | 'lean_turbo_plan_lanes' | 'lean_turbo_acquire_locks' | 'lean_turbo_runner_status' | 'lean_turbo_review' | 'lean_turbo_run_phase' | 'lean_turbo_status';
7
7
  /** Readonly array of all tool names */
8
8
  export declare const TOOL_NAMES: readonly ToolName[];
9
9
  /** Set for O(1) tool name validation */
@@ -57,7 +57,7 @@ export declare function checkReviewerGate(taskId: string, workingDirectory?: str
57
57
  /**
58
58
  * Wrapper around checkReviewerGate that appends a diff-scope advisory warning.
59
59
  * Keeps checkReviewerGate synchronous for backward compatibility.
60
- * Stage B parallel is resolved from standard parallelization config.
60
+ * Stage B parallel is hardcoded (not config-driven).
61
61
  * @param taskId - The task ID to check gate state for
62
62
  * @param workingDirectory - Optional working directory for plan.json fallback
63
63
  * @param sessionID - Optional session ID to scope Lean Turbo bypass to the current tool-execution context
@@ -7,12 +7,7 @@
7
7
  */
8
8
  import type { ToolDefinition } from '@opencode-ai/plugin/tool';
9
9
  import { z } from 'zod';
10
- import { loadPluginConfig } from '../config/loader';
11
- import { synthesizeFinalCouncilAdvisory } from '../council/council-service';
12
10
  import type { CouncilMemberVerdict } from '../council/types';
13
- import { validateSwarmPath } from '../hooks/utils';
14
- import { loadPlan } from '../plan/manager.js';
15
- import { derivePlanId } from '../plan/utils.js';
16
11
  export declare const ArgsSchema: z.ZodObject<{
17
12
  phase: z.ZodNumber;
18
13
  projectSummary: z.ZodString;
@@ -60,13 +55,6 @@ export interface WriteFinalCouncilEvidenceArgs {
60
55
  /** Collected verdicts from critic, reviewer, sme, test_engineer, explorer */
61
56
  verdicts: CouncilMemberVerdict[];
62
57
  }
63
- export declare const _internals: {
64
- loadPluginConfig: typeof loadPluginConfig;
65
- synthesizeFinalCouncilAdvisory: typeof synthesizeFinalCouncilAdvisory;
66
- loadPlan: typeof loadPlan;
67
- derivePlanId: typeof derivePlanId;
68
- validateSwarmPath: typeof validateSwarmPath;
69
- };
70
58
  /**
71
59
  * Execute the write_final_council_evidence tool.
72
60
  * Validates input, synthesizes project-scoped council evidence, and writes it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.18.3",
3
+ "version": "7.19.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",
@@ -1,11 +0,0 @@
1
- import type { PluginConfig } from '../config';
2
- export type StandardParallelizationRuntimeConfig = {
3
- stageBParallelEnabled: boolean;
4
- taskFanoutEnabled: boolean;
5
- maxConcurrentTasks: number;
6
- maxConcurrentCoders: number;
7
- maxConcurrentStageBGroups: number;
8
- evidenceLockTimeoutMs: number;
9
- source: 'current-default' | 'global-config' | 'locked-profile';
10
- };
11
- export declare function resolveStandardParallelizationConfig(config: PluginConfig | undefined, directory: string): StandardParallelizationRuntimeConfig;