opencode-swarm 7.25.0 → 7.25.2

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.
@@ -123,3 +123,36 @@ export declare function runConfigDoctorWithFixes(directory: string, config: Plug
123
123
  updatedConfigPath: string | null;
124
124
  artifactPath: string | null;
125
125
  }>;
126
+ /**
127
+ * A stray .swarm directory found below the project root.
128
+ * These are typically created by bugs in prior versions (see Issue #922).
129
+ */
130
+ export interface StraySwarmFinding {
131
+ /** Relative path from project root (forward-slash normalized) */
132
+ path: string;
133
+ /** Absolute path on disk */
134
+ absolutePath: string;
135
+ /** Contents summary (up to 20 entries) */
136
+ contents: string[];
137
+ /** Total number of entries in the directory */
138
+ totalEntries: number;
139
+ }
140
+ /**
141
+ * Detect stray .swarm directories in project subdirectories.
142
+ * These are .swarm/ directories that exist below the project root,
143
+ * typically created by bugs in prior versions (see Issue #922).
144
+ *
145
+ * Skips: node_modules/, .git/, dist/, .cache/, .next/, coverage/
146
+ * and common tool/build output directories.
147
+ */
148
+ export declare function detectStraySwarmDirs(projectRoot: string): StraySwarmFinding[];
149
+ /**
150
+ * Remove a stray .swarm directory.
151
+ * NEVER removes the root .swarm/ directory.
152
+ *
153
+ * @returns `{ success, message }` indicating outcome
154
+ */
155
+ export declare function removeStraySwarmDir(projectRoot: string, strayPath: string): {
156
+ success: boolean;
157
+ message: string;
158
+ };
@@ -1,3 +1,4 @@
1
+ import { validateProjectRoot } from '../evidence/manager.js';
1
2
  export interface TestImpactResult {
2
3
  impactedTests: string[];
3
4
  unrelatedTests: string[];
@@ -18,6 +19,7 @@ declare function findTestFilesSync(cwd: string): string[];
18
19
  declare function extractImports(content: string): string[];
19
20
  declare function buildImpactMapInternal(cwd: string): Promise<Record<string, string[]>>;
20
21
  export declare const _internals: {
22
+ validateProjectRoot: typeof validateProjectRoot;
21
23
  normalizePath: typeof normalizePath;
22
24
  isCacheStale: typeof isCacheStale;
23
25
  resolveRelativeImport: typeof resolveRelativeImport;
@@ -1,3 +1,4 @@
1
+ import { validateProjectRoot } from '../evidence/manager.js';
1
2
  export type TestRunResult = 'pass' | 'fail' | 'skip';
2
3
  export interface TestRunRecord {
3
4
  timestamp: string;
@@ -13,3 +14,9 @@ export interface TestRunRecord {
13
14
  export declare function appendTestRun(record: TestRunRecord, workingDir?: string): void;
14
15
  export declare function getTestHistory(testFile: string, workingDir?: string): TestRunRecord[];
15
16
  export declare function getAllHistory(workingDir?: string): TestRunRecord[];
17
+ /**
18
+ * DI seam for testability. Contains functions that tests may override.
19
+ */
20
+ export declare const _internals: {
21
+ validateProjectRoot: typeof validateProjectRoot;
22
+ };
@@ -79,7 +79,7 @@ export declare function classifySastFindings(findings: SastScanFinding[], change
79
79
  /**
80
80
  * Run all 4 pre-check tools in parallel with concurrency limit
81
81
  * @param input - The pre-check batch input
82
- * @param workspaceDir - Optional workspace directory for traversal validation (defaults to directory param or process.cwd())
82
+ * @param workspaceDir - Optional workspace directory for traversal validation (injected project root from createSwarmTool, or input.directory)
83
83
  */
84
84
  export declare function runPreCheckBatch(input: PreCheckBatchInput, workspaceDir?: string, contextDir?: string): Promise<PreCheckBatchResult>;
85
85
  /**
@@ -19,7 +19,14 @@ export interface ResolveError {
19
19
  message: string;
20
20
  }
21
21
  /**
22
- * Resolve the effective working directory for a swarm tool.
22
+ * Resolves and validates a working directory against a fallback (injected project root).
23
+ *
24
+ * NOTE: This function intentionally does NOT use realpathSync for the resolved path
25
+ * to avoid Windows 8.3 short filename issues. Symlink-based subdirectory bypasses
26
+ * through this coarse filter are caught by the write-time validateProjectRoot guard
27
+ * in evidence/manager.ts, which DOES use realpathSync. These two functions form a
28
+ * defense-in-depth pair: resolveWorkingDirectory is the fast entry filter,
29
+ * validateProjectRoot is the authoritative canonical check at write time.
23
30
  *
24
31
  * Priority: explicit working_directory param > injected directory (from createSwarmTool).
25
32
  *
@@ -53,7 +53,7 @@ export interface ReviewerGateResult {
53
53
  * @param sessionID - Optional session ID to scope Lean Turbo bypass to the current tool-execution context
54
54
  * @returns ReviewerGateResult indicating whether the gate is blocked
55
55
  */
56
- export declare function checkReviewerGate(taskId: string, workingDirectory?: string, stageBParallelEnabled?: boolean, sessionID?: string): ReviewerGateResult;
56
+ export declare function checkReviewerGate(taskId: string, workingDirectory?: string, stageBParallelEnabled?: boolean, sessionID?: string, fallbackDir?: string): ReviewerGateResult;
57
57
  /**
58
58
  * Wrapper around checkReviewerGate that appends a diff-scope advisory warning.
59
59
  * Keeps checkReviewerGate synchronous for backward compatibility.
@@ -61,9 +61,10 @@ export declare function checkReviewerGate(taskId: string, workingDirectory?: str
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
64
+ * @param fallbackDir - Optional fallback directory for resolveWorkingDirectory when workingDirectory is absent
64
65
  * @returns ReviewerGateResult with optional scope warning appended to reason
65
66
  */
66
- export declare function checkReviewerGateWithScope(taskId: string, workingDirectory?: string, sessionID?: string): Promise<ReviewerGateResult>;
67
+ export declare function checkReviewerGateWithScope(taskId: string, workingDirectory?: string, sessionID?: string, fallbackDir?: string): Promise<ReviewerGateResult>;
67
68
  /**
68
69
  * Recovery mechanism: reconcile task state with delegation history.
69
70
  * When task-scoped reviewer/test_engineer delegations occurred but the state
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.25.0",
3
+ "version": "7.25.2",
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",