opencode-swarm 6.68.0 → 6.69.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.
Files changed (54) hide show
  1. package/dist/cli/index.js +844 -162
  2. package/dist/diff/__tests__/semantic-classifier.test.d.ts +1 -0
  3. package/dist/diff/__tests__/summary-generator.test.d.ts +1 -0
  4. package/dist/diff/semantic-classifier.d.ts +55 -0
  5. package/dist/diff/summary-generator.d.ts +33 -0
  6. package/dist/index.js +2858 -871
  7. package/dist/mutation/__tests__/engine.adversarial.test.d.ts +1 -0
  8. package/dist/mutation/__tests__/engine.test.d.ts +1 -0
  9. package/dist/mutation/__tests__/equivalence.adversarial.test.d.ts +1 -0
  10. package/dist/mutation/__tests__/equivalence.test.d.ts +1 -0
  11. package/dist/mutation/__tests__/gate.adversarial.test.d.ts +1 -0
  12. package/dist/mutation/__tests__/gate.test.d.ts +1 -0
  13. package/dist/mutation/engine.d.ts +47 -0
  14. package/dist/mutation/equivalence.d.ts +35 -0
  15. package/dist/mutation/gate.d.ts +28 -0
  16. package/dist/test-impact/__tests__/analyzer-import-fix.adversarial.test.d.ts +1 -0
  17. package/dist/test-impact/__tests__/analyzer-import-fix.test.d.ts +1 -0
  18. package/dist/test-impact/__tests__/analyzer.adversarial.test.d.ts +1 -0
  19. package/dist/test-impact/__tests__/analyzer.test.d.ts +1 -0
  20. package/dist/test-impact/__tests__/council-fixes.test.d.ts +1 -0
  21. package/dist/test-impact/__tests__/failure-classifier.adversarial.test.d.ts +1 -0
  22. package/dist/test-impact/__tests__/failure-classifier.test.d.ts +1 -0
  23. package/dist/test-impact/__tests__/flaky-detector.adversarial.test.d.ts +1 -0
  24. package/dist/test-impact/__tests__/flaky-detector.test.d.ts +1 -0
  25. package/dist/test-impact/__tests__/history-store.adversarial.test.d.ts +1 -0
  26. package/dist/test-impact/__tests__/history-store.test.d.ts +1 -0
  27. package/dist/test-impact/__tests__/test-impact.adversarial.test.d.ts +1 -0
  28. package/dist/test-impact/__tests__/test-impact.test.d.ts +1 -0
  29. package/dist/test-impact/analyzer.d.ts +9 -0
  30. package/dist/test-impact/failure-classifier.d.ts +26 -0
  31. package/dist/test-impact/flaky-detector.d.ts +14 -0
  32. package/dist/test-impact/history-store.d.ts +15 -0
  33. package/dist/tools/__tests__/barrel-exports.test.d.ts +1 -0
  34. package/dist/tools/__tests__/diff-ast-fallback.test.d.ts +1 -0
  35. package/dist/tools/__tests__/diff-markdown-summary.test.d.ts +1 -0
  36. package/dist/tools/__tests__/diff-semantic.test.d.ts +1 -0
  37. package/dist/tools/__tests__/diff-summary.adversarial.test.d.ts +1 -0
  38. package/dist/tools/__tests__/diff-summary.test.d.ts +1 -0
  39. package/dist/tools/__tests__/mutation-test.adversarial.test.d.ts +1 -0
  40. package/dist/tools/__tests__/mutation-test.sourcefiles.test.d.ts +1 -0
  41. package/dist/tools/__tests__/mutation-test.test.d.ts +1 -0
  42. package/dist/tools/__tests__/test-runner-history.test.d.ts +1 -0
  43. package/dist/tools/__tests__/test-runner-impact.adversarial.test.d.ts +1 -0
  44. package/dist/tools/__tests__/test-runner-impact.test.d.ts +1 -0
  45. package/dist/tools/__tests__/test-runner-source-files.test.d.ts +1 -0
  46. package/dist/tools/diff-summary.d.ts +12 -0
  47. package/dist/tools/diff.d.ts +3 -0
  48. package/dist/tools/index.d.ts +7 -0
  49. package/dist/tools/mutation-test.d.ts +2 -0
  50. package/dist/tools/mutation-test.security.test.d.ts +1 -0
  51. package/dist/tools/test-impact.d.ts +2 -0
  52. package/dist/tools/test-runner.d.ts +4 -4
  53. package/dist/tools/tool-names.d.ts +1 -1
  54. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,47 @@
1
+ export type MutationOutcome = 'killed' | 'survived' | 'timeout' | 'error' | 'equivalent' | 'skipped';
2
+ export interface MutationPatch {
3
+ id: string;
4
+ filePath: string;
5
+ functionName: string;
6
+ mutationType: string;
7
+ patch: string;
8
+ lineNumber?: number;
9
+ }
10
+ export interface MutationResult {
11
+ patchId: string;
12
+ filePath: string;
13
+ functionName: string;
14
+ mutationType: string;
15
+ outcome: MutationOutcome;
16
+ testOutput?: string;
17
+ durationMs: number;
18
+ error?: string;
19
+ }
20
+ export interface MutationReport {
21
+ totalMutants: number;
22
+ killed: number;
23
+ survived: number;
24
+ timeout: number;
25
+ equivalent: number;
26
+ skipped: number;
27
+ errors: number;
28
+ killRate: number;
29
+ adjustedKillRate: number;
30
+ perFunction: Map<string, {
31
+ killed: number;
32
+ survived: number;
33
+ total: number;
34
+ equivalent: number;
35
+ skipped: number;
36
+ killRate: number;
37
+ }>;
38
+ results: MutationResult[];
39
+ durationMs: number;
40
+ budgetMs: number;
41
+ budgetExceeded: boolean;
42
+ timestamp: string;
43
+ }
44
+ export declare const MAX_MUTATIONS_PER_FUNCTION = 10;
45
+ export declare function executeMutation(patch: MutationPatch, testCommand: string[], _testFiles: string[], workingDir: string): Promise<MutationResult>;
46
+ export declare function computeReport(results: MutationResult[], durationMs: number, budgetMs?: number): MutationReport;
47
+ export declare function executeMutationSuite(patches: MutationPatch[], testCommand: string[], testFiles: string[], workingDir: string, budgetMs?: number, onProgress?: (completed: number, total: number, result: MutationResult) => void, sourceFiles?: Map<string, string>): Promise<MutationReport>;
@@ -0,0 +1,35 @@
1
+ import type { MutationPatch } from './engine.js';
2
+ /** Result of equivalence check for a single mutant */
3
+ export interface EquivalenceResult {
4
+ patchId: string;
5
+ isEquivalent: boolean;
6
+ method: 'static' | 'llm_judge' | 'skipped';
7
+ confidence: number;
8
+ reason: string;
9
+ }
10
+ /** Callback signature for LLM judge — injected by caller */
11
+ export type LLMJudgeCallback = (original: string, mutated: string, context: string) => Promise<{
12
+ isEquivalent: boolean;
13
+ confidence: number;
14
+ reason: string;
15
+ }>;
16
+ /**
17
+ * Stage 1: Static equivalence filter.
18
+ * Strips comments (single-line // and multi-line /* *\/), console.log/debugger statements,
19
+ * trailing whitespace, and blank lines. Returns true if the stripped versions are identical.
20
+ */
21
+ export declare function isStaticallyEquivalent(originalCode: string, mutatedCode: string): boolean;
22
+ /**
23
+ * Check a single mutant for equivalence using two-stage approach.
24
+ * Stage 1: static analysis. Stage 2: LLM judge (if provided and Stage 1 didn't determine equivalence).
25
+ */
26
+ export declare function checkEquivalence(patch: MutationPatch, originalCode: string, mutatedCode: string, llmJudge?: LLMJudgeCallback): Promise<EquivalenceResult>;
27
+ /**
28
+ * Batch check multiple mutants for equivalence.
29
+ * Returns results for all patches.
30
+ */
31
+ export declare function batchCheckEquivalence(patches: Array<{
32
+ patch: MutationPatch;
33
+ originalCode: string;
34
+ mutatedCode: string;
35
+ }>, llmJudge?: LLMJudgeCallback): Promise<EquivalenceResult[]>;
@@ -0,0 +1,28 @@
1
+ import type { MutationReport, MutationResult } from './engine.js';
2
+ export type MutationGateVerdict = 'pass' | 'warn' | 'fail';
3
+ export interface MutationGateResult {
4
+ verdict: MutationGateVerdict;
5
+ killRate: number;
6
+ adjustedKillRate: number;
7
+ totalMutants: number;
8
+ killed: number;
9
+ survived: number;
10
+ threshold: number;
11
+ warnThreshold: number;
12
+ message: string;
13
+ /** Survived mutants that need test improvements */
14
+ survivedMutants: MutationResult[];
15
+ /** Prompt for targeted test improvement (non-empty when verdict is 'warn' or 'fail') */
16
+ testImprovementPrompt: string;
17
+ }
18
+ /** Default thresholds */
19
+ export declare const PASS_THRESHOLD = 0.8;
20
+ export declare const WARN_THRESHOLD = 0.6;
21
+ /**
22
+ * Evaluate a mutation report against quality gate thresholds.
23
+ * @param report - The mutation report to evaluate
24
+ * @param passThreshold - Kill rate at or above this passes (default: 0.80)
25
+ * @param warnThreshold - Kill rate at or above this warns (default: 0.60)
26
+ * @returns MutationGateResult with verdict and details
27
+ */
28
+ export declare function evaluateMutationGate(report: MutationReport, passThreshold?: number, warnThreshold?: number): MutationGateResult;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export interface TestImpactResult {
2
+ impactedTests: string[];
3
+ unrelatedTests: string[];
4
+ untestedFiles: string[];
5
+ impactMap: Record<string, string[]>;
6
+ }
7
+ export declare function buildImpactMap(cwd: string): Promise<Record<string, string[]>>;
8
+ export declare function loadImpactMap(cwd: string): Promise<Record<string, string[]>>;
9
+ export declare function analyzeImpact(changedFiles: string[], cwd: string): Promise<TestImpactResult>;
@@ -0,0 +1,26 @@
1
+ import type { TestRunRecord } from './history-store.js';
2
+ export type FailureClassification = 'new_regression' | 'pre_existing' | 'flaky' | 'unknown';
3
+ export interface ClassifiedFailure {
4
+ testFile: string;
5
+ testName: string;
6
+ classification: FailureClassification;
7
+ errorMessage?: string;
8
+ stackPrefix?: string;
9
+ durationMs: number;
10
+ confidence: number;
11
+ }
12
+ export interface FailureCluster {
13
+ clusterId: string;
14
+ rootCause: string;
15
+ stackPrefix?: string;
16
+ errorMessage?: string;
17
+ failures: ClassifiedFailure[];
18
+ classification: FailureClassification;
19
+ affectedTestFiles: string[];
20
+ }
21
+ export declare function classifyFailure(currentResult: TestRunRecord, history: TestRunRecord[]): ClassifiedFailure;
22
+ export declare function clusterFailures(failures: ClassifiedFailure[]): FailureCluster[];
23
+ export declare function classifyAndCluster(testResults: TestRunRecord[], history: TestRunRecord[]): {
24
+ classified: ClassifiedFailure[];
25
+ clusters: FailureCluster[];
26
+ };
@@ -0,0 +1,14 @@
1
+ import type { TestRunRecord } from './history-store.js';
2
+ export interface FlakyTestEntry {
3
+ testFile: string;
4
+ testName: string;
5
+ flakyScore: number;
6
+ totalRuns: number;
7
+ alternationCount: number;
8
+ isQuarantined: boolean;
9
+ recentResults: Array<'pass' | 'fail' | 'skip'>;
10
+ recommendation?: string;
11
+ }
12
+ export declare function computeFlakyScore(history: TestRunRecord[]): number;
13
+ export declare function detectFlakyTests(allHistory: TestRunRecord[]): FlakyTestEntry[];
14
+ export declare function isTestQuarantined(testFile: string, testName: string, allHistory: TestRunRecord[]): boolean;
@@ -0,0 +1,15 @@
1
+ export type TestRunResult = 'pass' | 'fail' | 'skip';
2
+ export interface TestRunRecord {
3
+ timestamp: string;
4
+ taskId: string;
5
+ testFile: string;
6
+ testName: string;
7
+ result: TestRunResult;
8
+ durationMs: number;
9
+ errorMessage?: string;
10
+ stackPrefix?: string;
11
+ changedFiles: string[];
12
+ }
13
+ export declare function appendTestRun(record: TestRunRecord, workingDir?: string): void;
14
+ export declare function getTestHistory(testFile: string, workingDir?: string): TestRunRecord[];
15
+ export declare function getAllHistory(workingDir?: string): TestRunRecord[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { type ChangeCategory, type RiskLevel } from '../diff/semantic-classifier.js';
2
+ import { createSwarmTool } from './create-tool';
3
+ export interface DiffSummaryArgs {
4
+ files: string[];
5
+ classification?: ChangeCategory;
6
+ riskLevel?: RiskLevel;
7
+ }
8
+ /**
9
+ * Standalone tool that wraps the semantic classifier + summary generator
10
+ * to produce a filtered SemanticDiffSummary.
11
+ */
12
+ export declare const diff_summary: ReturnType<typeof createSwarmTool>;
@@ -1,4 +1,5 @@
1
1
  import { type ASTDiffResult } from '../diff/ast-diff.js';
2
+ import { type SemanticDiffSummary } from '../diff/summary-generator.js';
2
3
  import { createSwarmTool } from './create-tool';
3
4
  export interface DiffResult {
4
5
  files: Array<{
@@ -10,6 +11,8 @@ export interface DiffResult {
10
11
  hasContractChanges: boolean;
11
12
  summary: string;
12
13
  astDiffs?: ASTDiffResult[];
14
+ semanticSummary?: SemanticDiffSummary;
15
+ markdownSummary?: string;
13
16
  }
14
17
  export interface DiffErrorResult {
15
18
  error: string;
@@ -10,6 +10,7 @@ export { curator_analyze } from './curator-analyze';
10
10
  export { declare_council_criteria } from './declare-council-criteria';
11
11
  export { declare_scope } from './declare-scope';
12
12
  export { type DiffErrorResult, type DiffResult, diff } from './diff';
13
+ export { diff_summary } from './diff-summary';
13
14
  export { doc_extract, doc_scan } from './doc-scan';
14
15
  export { detect_domains } from './domain-detector';
15
16
  export { evidence_check } from './evidence-check';
@@ -44,9 +45,15 @@ import { suggestPatch } from './suggest-patch';
44
45
  export { suggestPatch };
45
46
  export type { SuggestPatchArgs } from './suggest-patch';
46
47
  export declare const suggest_patch: typeof suggestPatch;
48
+ export type { ClassifiedFailure, FailureClassification, FailureCluster, } from '../test-impact/failure-classifier.js';
49
+ export { classifyAndCluster, classifyFailure, clusterFailures, } from '../test-impact/failure-classifier.js';
50
+ export type { FlakyTestEntry } from '../test-impact/flaky-detector.js';
51
+ export { computeFlakyScore, detectFlakyTests, isTestQuarantined, } from '../test-impact/flaky-detector.js';
47
52
  export { lint_spec } from './lint-spec';
53
+ export { mutation_test } from './mutation-test';
48
54
  export { symbols } from './symbols';
49
55
  export { type SyntaxCheckFileResult, type SyntaxCheckInput, type SyntaxCheckResult, syntax_check, syntaxCheck, } from './syntax-check';
56
+ export { test_impact } from './test-impact';
50
57
  export { test_runner } from './test-runner';
51
58
  export { todo_extract } from './todo-extract';
52
59
  export { executeUpdateTaskStatus, type UpdateTaskStatusArgs, type UpdateTaskStatusResult, update_task_status, } from './update-task-status';
@@ -0,0 +1,2 @@
1
+ import { createSwarmTool } from './create-tool';
2
+ export declare const mutation_test: ReturnType<typeof createSwarmTool>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { createSwarmTool } from './create-tool';
2
+ export declare const test_impact: ReturnType<typeof createSwarmTool>;
@@ -7,7 +7,7 @@ export declare const MAX_SAFE_TEST_FILES = 50;
7
7
  export declare const SUPPORTED_FRAMEWORKS: readonly ["bun", "vitest", "jest", "mocha", "pytest", "cargo", "pester", "go-test", "maven", "gradle", "dotnet-test", "ctest", "swift-test", "dart-test", "rspec", "minitest"];
8
8
  export type TestFramework = (typeof SUPPORTED_FRAMEWORKS)[number] | 'none';
9
9
  export interface TestRunnerArgs {
10
- scope?: 'all' | 'convention' | 'graph';
10
+ scope?: 'all' | 'convention' | 'graph' | 'impact';
11
11
  files?: string[];
12
12
  coverage?: boolean;
13
13
  timeout_ms?: number;
@@ -23,7 +23,7 @@ export interface TestTotals {
23
23
  export interface TestSuccessResult {
24
24
  success: true;
25
25
  framework: TestFramework;
26
- scope: 'all' | 'convention' | 'graph';
26
+ scope: 'all' | 'convention' | 'graph' | 'impact';
27
27
  command: string[];
28
28
  timeout_ms: number;
29
29
  duration_ms: number;
@@ -36,7 +36,7 @@ export interface TestSuccessResult {
36
36
  export interface TestErrorResult {
37
37
  success: false;
38
38
  framework: TestFramework;
39
- scope: 'all' | 'convention' | 'graph';
39
+ scope: 'all' | 'convention' | 'graph' | 'impact';
40
40
  command?: string[];
41
41
  timeout_ms?: number;
42
42
  duration_ms?: number;
@@ -50,5 +50,5 @@ export interface TestErrorResult {
50
50
  }
51
51
  export type TestResult = TestSuccessResult | TestErrorResult;
52
52
  export declare function detectTestFramework(cwd: string): Promise<TestFramework>;
53
- export declare function runTests(framework: TestFramework, scope: 'all' | 'convention' | 'graph', files: string[], coverage: boolean, timeout_ms: number, cwd: string): Promise<TestResult>;
53
+ export declare function runTests(framework: TestFramework, scope: 'all' | 'convention' | 'graph' | 'impact', files: string[], coverage: boolean, timeout_ms: number, cwd: string): Promise<TestResult>;
54
54
  export declare const test_runner: ReturnType<typeof tool>;
@@ -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' | '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' | 'convene_council' | 'declare_council_criteria' | 'sbom_generate' | 'checkpoint' | 'pkg_audit' | 'test_runner' | 'detect_domains' | 'gitingest' | 'retrieve_summary' | 'extract_code_blocks' | 'phase_complete' | 'save_plan' | 'update_task_status' | 'lint_spec' | 'write_retro' | 'write_drift_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';
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' | 'convene_council' | 'declare_council_criteria' | 'sbom_generate' | 'checkpoint' | 'pkg_audit' | 'test_runner' | 'test_impact' | 'mutation_test' | 'detect_domains' | 'gitingest' | 'retrieve_summary' | 'extract_code_blocks' | 'phase_complete' | 'save_plan' | 'update_task_status' | 'lint_spec' | 'write_retro' | 'write_drift_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';
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 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.68.0",
3
+ "version": "6.69.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",