opencode-swarm 7.49.0 → 7.50.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.
- package/README.md +1 -1
- package/dist/agents/critic.d.ts +2 -2
- package/dist/cli/index.js +5 -1
- package/dist/hooks/scope-guard.d.ts +24 -0
- package/dist/index.js +1302 -439
- package/dist/tools/apply-patch.d.ts +48 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/manifest.d.ts +1 -0
- package/dist/tools/repo-graph/builder.d.ts +22 -0
- package/dist/tools/tool-metadata.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* apply-patch — Native Swarm tool for applying unified diffs in-process.
|
|
3
|
+
* Parses standard unified diff format, validates paths against workspace
|
|
4
|
+
* boundaries, matches hunk context exactly, and writes atomically.
|
|
5
|
+
*
|
|
6
|
+
* FR-001 through FR-014, SR-002 through SR-005.
|
|
7
|
+
* Pure TypeScript, no shell/git/external binaries, standard node:fs sync I/O.
|
|
8
|
+
*/
|
|
9
|
+
import type { ToolDefinition } from '@opencode-ai/plugin/tool';
|
|
10
|
+
/** Per-file error detail in the structured output. */
|
|
11
|
+
export interface ApplyPatchFileError {
|
|
12
|
+
hunkIndex: number;
|
|
13
|
+
type: 'context-mismatch' | 'file-not-found' | 'file-unchanged' | 'create-not-allowed' | 'delete-not-allowed' | 'binary-rejected' | 'rename-rejected';
|
|
14
|
+
message: string;
|
|
15
|
+
expected?: string;
|
|
16
|
+
actual?: string;
|
|
17
|
+
line?: number;
|
|
18
|
+
}
|
|
19
|
+
/** Per-file result in the structured output. */
|
|
20
|
+
export interface ApplyPatchFileResult {
|
|
21
|
+
file: string;
|
|
22
|
+
status: 'applied' | 'no-changes' | 'created' | 'error';
|
|
23
|
+
hunks: number;
|
|
24
|
+
hunksApplied: number;
|
|
25
|
+
hunksFailed: number;
|
|
26
|
+
errors?: ApplyPatchFileError[];
|
|
27
|
+
}
|
|
28
|
+
/** Structured JSON result returned by the tool. */
|
|
29
|
+
export interface ApplyPatchResult {
|
|
30
|
+
success: boolean;
|
|
31
|
+
dryRun?: boolean;
|
|
32
|
+
files: ApplyPatchFileResult[];
|
|
33
|
+
summary: {
|
|
34
|
+
totalFiles: number;
|
|
35
|
+
applied: number;
|
|
36
|
+
failed: number;
|
|
37
|
+
totalHunks: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Arguments accepted by the apply_patch tool. */
|
|
41
|
+
export interface ApplyPatchArgs {
|
|
42
|
+
patch: string;
|
|
43
|
+
files: string[];
|
|
44
|
+
dryRun?: boolean;
|
|
45
|
+
allowCreates?: boolean;
|
|
46
|
+
allowDeletes?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export declare const applyPatch: ToolDefinition;
|
package/dist/tools/index.d.ts
CHANGED
package/dist/tools/manifest.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Also exports upsertNode, addEdge, and resolveModuleSpecifier which are
|
|
11
11
|
* used by both the builder and the incremental updater.
|
|
12
12
|
*/
|
|
13
|
+
import { extractPythonSymbols, extractTSSymbols } from '../symbols';
|
|
13
14
|
import { safeRealpathSync } from './safe-realpath';
|
|
14
15
|
import type { BuildWorkspaceGraphOptions, GraphEdge, GraphNode, RepoGraph } from './types';
|
|
15
16
|
/**
|
|
@@ -20,6 +21,9 @@ import type { BuildWorkspaceGraphOptions, GraphEdge, GraphNode, RepoGraph } from
|
|
|
20
21
|
*/
|
|
21
22
|
export declare const _internals: {
|
|
22
23
|
safeRealpathSync: typeof safeRealpathSync;
|
|
24
|
+
extractTSSymbols: typeof extractTSSymbols;
|
|
25
|
+
extractPythonSymbols: typeof extractPythonSymbols;
|
|
26
|
+
parseFileImports: typeof parseFileImports;
|
|
23
27
|
};
|
|
24
28
|
/**
|
|
25
29
|
* Add or update a node in the graph.
|
|
@@ -57,6 +61,23 @@ export declare function addEdge(graph: RepoGraph, edge: GraphEdge): void;
|
|
|
57
61
|
* @returns Resolved absolute path or null if unresolvable
|
|
58
62
|
*/
|
|
59
63
|
export declare function resolveModuleSpecifier(workspaceRoot: string, sourceFile: string, specifier: string): string | null;
|
|
64
|
+
/**
|
|
65
|
+
* A parsed import with its specifier and type.
|
|
66
|
+
*/
|
|
67
|
+
interface ParsedImport {
|
|
68
|
+
/** The module specifier (e.g., './foo', 'lodash') */
|
|
69
|
+
specifier: string;
|
|
70
|
+
/** The type of import */
|
|
71
|
+
importType: 'default' | 'named' | 'namespace' | 'require' | 'sideeffect';
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Parse imports from file content using the same rules as imports.ts.
|
|
75
|
+
* Handles ES module imports and CommonJS require() statements.
|
|
76
|
+
*
|
|
77
|
+
* @param content - File content to parse
|
|
78
|
+
* @returns Array of parsed imports with specifier and type
|
|
79
|
+
*/
|
|
80
|
+
declare function parseFileImports(content: string): ParsedImport[];
|
|
60
81
|
/**
|
|
61
82
|
* Result of scanning a single file for graph updates.
|
|
62
83
|
*/
|
|
@@ -100,3 +121,4 @@ export declare function buildWorkspaceGraph(workspaceRoot: string, options?: Bui
|
|
|
100
121
|
* bounded walk behavior, same deterministic file order.
|
|
101
122
|
*/
|
|
102
123
|
export declare function buildWorkspaceGraphAsync(workspaceRoot: string, options?: BuildWorkspaceGraphOptions): Promise<RepoGraph>;
|
|
124
|
+
export {};
|
|
@@ -355,6 +355,10 @@ export declare const TOOL_METADATA: {
|
|
|
355
355
|
description: string;
|
|
356
356
|
agents: "architect"[];
|
|
357
357
|
};
|
|
358
|
+
apply_patch: {
|
|
359
|
+
description: string;
|
|
360
|
+
agents: "coder"[];
|
|
361
|
+
};
|
|
358
362
|
};
|
|
359
363
|
/** Union type of all valid tool names (the metadata keys). */
|
|
360
364
|
export type ToolName = keyof typeof TOOL_METADATA;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.50.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",
|