opencode-swarm 7.75.0 → 7.76.1

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.
@@ -11,6 +11,7 @@
11
11
  * used by both the builder and the incremental updater.
12
12
  */
13
13
  import { extractPythonSymbols, extractTSSymbols } from '../symbols';
14
+ import { extractFileOntology } from './ontology';
14
15
  import { safeRealpathSync } from './safe-realpath';
15
16
  import type { BuildWorkspaceGraphOptions, GraphEdge, GraphNode, RepoGraph } from './types';
16
17
  /**
@@ -24,6 +25,7 @@ export declare const _internals: {
24
25
  extractTSSymbols: typeof extractTSSymbols;
25
26
  extractPythonSymbols: typeof extractPythonSymbols;
26
27
  parseFileImports: typeof parseFileImports;
28
+ extractFileOntology: typeof extractFileOntology;
27
29
  };
28
30
  /**
29
31
  * Add or update a node in the graph.
@@ -69,6 +71,8 @@ interface ParsedImport {
69
71
  specifier: string;
70
72
  /** The type of import */
71
73
  importType: 'default' | 'named' | 'namespace' | 'require' | 'sideeffect';
74
+ /** Named imported symbols when statically detectable */
75
+ importedSymbols: string[];
72
76
  }
73
77
  declare function parseFileImports(rawContent: string): ParsedImport[];
74
78
  /**
@@ -0,0 +1,10 @@
1
+ import type { FileOntology } from './types';
2
+ export interface ExtractFileOntologyInput {
3
+ moduleName: string;
4
+ filePath: string;
5
+ content: string;
6
+ language: string;
7
+ exports: string[];
8
+ imports: string[];
9
+ }
10
+ export declare function extractFileOntology(input: ExtractFileOntologyInput): FileOntology;
@@ -0,0 +1,21 @@
1
+ import type { BlastRadiusResult, FileOntology, FileReference, GraphNode, LocalizationBlock, PackageBoundarySummary, RepoGraph, SymbolReference } from './types';
2
+ export declare function getGraphNode(graph: RepoGraph, input: string): GraphNode | undefined;
3
+ export declare function resetQueryCache(): void;
4
+ export declare function isGraphFresh(graph: RepoGraph | null, maxAgeMs?: number): boolean;
5
+ export declare function getImporters(graph: RepoGraph, filePath: string): FileReference[];
6
+ export declare function getDependencies(graph: RepoGraph, filePath: string): FileReference[];
7
+ export declare function getSymbolConsumers(graph: RepoGraph, filePath: string, symbolName: string): SymbolReference[];
8
+ export declare function getBlastRadius(graph: RepoGraph, filePaths: string[], maxDepth?: number): BlastRadiusResult;
9
+ export declare function getKeyFiles(graph: RepoGraph, topN?: number): GraphNode[];
10
+ export declare function getFileOntology(graph: RepoGraph, filePath: string): FileOntology | null;
11
+ export declare function getLocalizationContext(graph: RepoGraph, filePath: string, options?: {
12
+ maxImporters?: number;
13
+ maxDeps?: number;
14
+ maxDepth?: number;
15
+ }): LocalizationBlock;
16
+ export declare function getPackageBoundaries(graph: RepoGraph, topN?: number): PackageBoundarySummary[];
17
+ export declare function buildOntologyPreflightPacket(graph: RepoGraph, filePaths?: string[], options?: {
18
+ maxFiles?: number;
19
+ maxFindings?: number;
20
+ maxBoundaries?: number;
21
+ }): Record<string, unknown>;
@@ -33,6 +33,13 @@ export declare function getGraphPath(workspace: string): string;
33
33
  * @throws Error if file exists but is invalid/corrupted
34
34
  */
35
35
  export declare function loadGraph(workspace: string): Promise<RepoGraph | null>;
36
+ /**
37
+ * Synchronous graph loader for prompt-injection hooks.
38
+ *
39
+ * Mirrors loadGraph validation but avoids async file I/O in system prompt
40
+ * construction. Returns null only when the graph file is absent.
41
+ */
42
+ export declare function loadGraphSync(workspace: string): RepoGraph | null;
36
43
  /**
37
44
  * Save the graph to .swarm/repo-graph.json atomically.
38
45
  * Uses temp file + rename pattern to prevent partial writes.
@@ -8,6 +8,61 @@
8
8
  */
9
9
  export declare const REPO_GRAPH_FILENAME = "repo-graph.json";
10
10
  export declare const GRAPH_SCHEMA_VERSION = "1.0.0";
11
+ export declare const FILE_ROLE_VALUES: readonly ["api_route", "middleware", "service_module", "data_module", "swarm_tool", "agent", "hook", "config", "schema", "test_file", "cli_command", "documentation", "source_module"];
12
+ export type FileRole = (typeof FILE_ROLE_VALUES)[number];
13
+ export declare const ROUTE_METHOD_VALUES: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD", "ALL"];
14
+ export type RouteMethod = (typeof ROUTE_METHOD_VALUES)[number];
15
+ export declare const ROUTE_SOURCE_VALUES: readonly ["file_path", "handler_export", "router_call"];
16
+ export type RouteSource = (typeof ROUTE_SOURCE_VALUES)[number];
17
+ export interface RouteFact {
18
+ method: RouteMethod;
19
+ path: string;
20
+ line?: number;
21
+ source: RouteSource;
22
+ }
23
+ export declare const DATA_OPERATION_VALUES: readonly ["read", "write", "delete", "transaction", "migration"];
24
+ export type DataOperation = (typeof DATA_OPERATION_VALUES)[number];
25
+ export declare const DATA_ACCESS_VALUES: readonly ["database", "orm", "sql", "filesystem", "network", "unknown"];
26
+ export type DataAccess = (typeof DATA_ACCESS_VALUES)[number];
27
+ export interface DataOperationFact {
28
+ operation: DataOperation;
29
+ access: DataAccess;
30
+ entity?: string;
31
+ line: number;
32
+ evidence: string;
33
+ }
34
+ export declare const SECURITY_KIND_VALUES: readonly ["authentication", "authorization", "input_validation", "csrf", "sanitization", "secret_handling"];
35
+ export type SecurityKind = (typeof SECURITY_KIND_VALUES)[number];
36
+ export declare const SECURITY_CONFIDENCE_VALUES: readonly ["low", "medium", "high"];
37
+ export type SecurityConfidence = (typeof SECURITY_CONFIDENCE_VALUES)[number];
38
+ export interface SecurityFact {
39
+ kind: SecurityKind;
40
+ line: number;
41
+ evidence: string;
42
+ confidence: SecurityConfidence;
43
+ }
44
+ export interface ConventionFact {
45
+ name: string;
46
+ line?: number;
47
+ evidence: string;
48
+ }
49
+ export declare const ONTOLOGY_FINDING_SEVERITY_VALUES: readonly ["info", "low", "medium", "high"];
50
+ export type OntologyFindingSeverity = (typeof ONTOLOGY_FINDING_SEVERITY_VALUES)[number];
51
+ export interface OntologyFinding {
52
+ code: string;
53
+ severity: OntologyFindingSeverity;
54
+ message: string;
55
+ line?: number;
56
+ }
57
+ export interface FileOntology {
58
+ roles: FileRole[];
59
+ packageBoundary: string;
60
+ routes: RouteFact[];
61
+ dataOperations: DataOperationFact[];
62
+ security: SecurityFact[];
63
+ conventions: ConventionFact[];
64
+ findings: OntologyFinding[];
65
+ }
11
66
  /**
12
67
  * A node in the dependency graph representing a source file.
13
68
  */
@@ -24,7 +79,11 @@ export interface GraphNode {
24
79
  language: string;
25
80
  /** Last modified timestamp */
26
81
  mtime: string;
82
+ /** Optional code ontology facts for agent context/preflight packets */
83
+ ontology?: FileOntology;
27
84
  }
85
+ export declare const IMPORT_TYPE_VALUES: readonly ["default", "named", "namespace", "require", "sideeffect"];
86
+ export type ImportType = (typeof IMPORT_TYPE_VALUES)[number];
28
87
  /**
29
88
  * An edge in the dependency graph representing a dependency relationship.
30
89
  */
@@ -36,7 +95,49 @@ export interface GraphEdge {
36
95
  /** Import specifier used */
37
96
  importSpecifier: string;
38
97
  /** Type of import */
39
- importType: 'default' | 'named' | 'namespace' | 'require' | 'sideeffect';
98
+ importType: ImportType;
99
+ /** Named symbols imported from the target, when statically detectable */
100
+ importedSymbols?: string[];
101
+ }
102
+ export interface FileReference {
103
+ file: string;
104
+ line?: number;
105
+ importType?: GraphEdge['importType'];
106
+ }
107
+ export interface SymbolReference {
108
+ file: string;
109
+ line?: number;
110
+ importedAs: string;
111
+ }
112
+ export interface BlastRadiusResult {
113
+ target: string[];
114
+ directDependents: string[];
115
+ transitiveDependents: string[];
116
+ depthReached: number;
117
+ totalDependents: number;
118
+ riskLevel: 'low' | 'medium' | 'high' | 'critical';
119
+ }
120
+ export interface LocalizationBlock {
121
+ target: string;
122
+ importerCount: number;
123
+ importers: FileReference[];
124
+ dependencyCount: number;
125
+ dependencies: FileReference[];
126
+ exportedSymbolsUsedExternally: string[];
127
+ blastRadius: BlastRadiusResult;
128
+ summary: string;
129
+ }
130
+ export interface PackageBoundarySummary {
131
+ name: string;
132
+ root: string;
133
+ fileCount: number;
134
+ roles: Partial<Record<FileRole, number>>;
135
+ dependsOn: string[];
136
+ dependedOnBy: string[];
137
+ routeCount: number;
138
+ dataOperationCount: number;
139
+ findingCount: number;
140
+ publicFiles: string[];
40
141
  }
41
142
  /**
42
143
  * The complete dependency graph for a workspace.
@@ -4,7 +4,7 @@
4
4
  * All public functions throw descriptive errors on invalid input so callers
5
5
  * can surface actionable messages rather than obscure downstream failures.
6
6
  */
7
- import type { GraphEdge, GraphNode } from './types';
7
+ import { type GraphEdge, type GraphNode } from './types';
8
8
  /**
9
9
  * Validate that a workspace directory is safe to use.
10
10
  * Accepts both absolute and relative paths.
@@ -18,7 +18,10 @@ export type { ScanResult } from './repo-graph/builder';
18
18
  export { addEdge, buildWorkspaceGraph, buildWorkspaceGraphAsync, resolveModuleSpecifier, upsertNode, } from './repo-graph/builder';
19
19
  export { clearCache, getCachedGraph, getCachedMtime, isDirty, markDirty, setCachedGraph, } from './repo-graph/cache';
20
20
  export { updateGraphForFiles } from './repo-graph/incremental';
21
- export { getGraphPath, loadGraph, loadOrCreateGraph, saveGraph, saveIfDirty, } from './repo-graph/storage';
22
- export type { BuildWorkspaceGraphOptions, GraphEdge, GraphNode, RepoGraph, } from './repo-graph/types';
21
+ export type { ExtractFileOntologyInput } from './repo-graph/ontology';
22
+ export { extractFileOntology } from './repo-graph/ontology';
23
+ export { buildOntologyPreflightPacket, getBlastRadius, getDependencies, getFileOntology, getGraphNode, getImporters, getKeyFiles, getLocalizationContext, getPackageBoundaries, getSymbolConsumers, isGraphFresh, resetQueryCache, } from './repo-graph/query';
24
+ export { getGraphPath, loadGraph, loadGraphSync, loadOrCreateGraph, saveGraph, saveIfDirty, } from './repo-graph/storage';
25
+ export type { BlastRadiusResult, BuildWorkspaceGraphOptions, ConventionFact, DataOperationFact, FileOntology, FileReference, FileRole, GraphEdge, GraphNode, LocalizationBlock, OntologyFinding, PackageBoundarySummary, RepoGraph, RouteFact, RouteMethod, SecurityFact, SymbolReference, } from './repo-graph/types';
23
26
  export { createEmptyGraph, GRAPH_SCHEMA_VERSION, normalizeGraphPath, REPO_GRAPH_FILENAME, updateGraphMetadata, } from './repo-graph/types';
24
27
  export { validateGraphEdge, validateGraphNode, validateWorkspace, } from './repo-graph/validation';
@@ -108,7 +108,7 @@ export declare const _internals: {
108
108
  compileCriticPackage: typeof compileCriticPackage;
109
109
  parseCriticVerdict: typeof parseCriticVerdict;
110
110
  writeCriticEvidence: typeof writeCriticEvidence;
111
- dispatchCriticAgent: (directory: string, pkg: CriticPackage, agentName: string, timeoutMs: number) => Promise<string>;
111
+ dispatchCriticAgent: (directory: string, pkg: CriticPackage, agentName: string, timeoutMs: number, parentSessionId?: string) => Promise<string>;
112
112
  resolveDefaultCriticAgent: typeof resolveDefaultCriticAgent;
113
113
  readReviewerEvidence: typeof readReviewerEvidence;
114
114
  listLaneEvidence: typeof listLaneEvidence;
@@ -97,7 +97,7 @@ export declare const _internals: {
97
97
  compileReviewPackage: typeof compileReviewPackage;
98
98
  parseReviewerVerdict: typeof parseReviewerVerdict;
99
99
  writeReviewerEvidence: typeof writeReviewerEvidence;
100
- dispatchReviewerAgent: (directory: string, pkg: ReviewPackage, agentName: string, timeoutMs: number) => Promise<string>;
100
+ dispatchReviewerAgent: (directory: string, pkg: ReviewPackage, agentName: string, timeoutMs: number, parentSessionId?: string) => Promise<string>;
101
101
  resolveDefaultReviewerAgent: typeof resolveDefaultReviewerAgent;
102
102
  listLaneEvidence: typeof listLaneEvidence;
103
103
  readPhaseEvidence: typeof readPhaseEvidence;
@@ -34,6 +34,10 @@ import { assertCleanWorkingTree, provisionWorktree, removeWorktree } from './wor
34
34
  */
35
35
  interface SessionClient {
36
36
  create(options: {
37
+ body?: {
38
+ parentID?: string;
39
+ title?: string;
40
+ };
37
41
  query: {
38
42
  directory: string;
39
43
  };
@@ -11,8 +11,8 @@
11
11
  */
12
12
  export declare function containsPathTraversal(str: string): boolean;
13
13
  /**
14
- * Check if a string contains control characters that could be used
15
- * for injection attacks. Matches null byte, tab, carriage return, and newline.
14
+ * Check if a string contains control or directional-format characters that
15
+ * could be used for injection attacks.
16
16
  */
17
17
  export declare function containsControlChars(str: string): boolean;
18
18
  /**
package/package.json CHANGED
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.75.0",
3
+ "version": "7.76.1",
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",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./package.json": "./package.json"
13
+ },
7
14
  "bin": {
8
15
  "opencode-swarm": "./dist/cli/index.js"
9
16
  },