opencode-swarm 7.114.6 → 7.114.8
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/.opencode/skills/engineering-conventions/SKILL.md +33 -0
- package/README.md +15 -14
- package/dist/agents/template.d.ts +40 -20
- package/dist/cli/{curator-llm-factory-jrnqg90s.js → curator-llm-factory-ez48eq02.js} +7 -7
- package/dist/cli/{curator-vk9ec2kf.js → curator-qj970412.js} +7 -7
- package/dist/cli/{evidence-summary-service-8g594znj.js → evidence-summary-service-fehwj116.js} +1 -1
- package/dist/cli/{guardrail-explain-vf89cv01.js → guardrail-explain-x2vaxp6s.js} +8 -8
- package/dist/cli/{hive-promoter-0b4ny2mp.js → hive-promoter-ysk5edzw.js} +7 -7
- package/dist/cli/{index-7stsmndb.js → index-6f6y2rbp.js} +3 -3
- package/dist/cli/{index-kjbfry6m.js → index-8f2270hc.js} +1 -1
- package/dist/cli/{index-5ac7rv03.js → index-cs5765s2.js} +86 -63
- package/dist/cli/{index-qrnhvhmg.js → index-n18yy0z1.js} +26 -2
- package/dist/cli/{index-91qesget.js → index-rk6qhyng.js} +2 -2
- package/dist/cli/{index-tmcr6svp.js → index-ry8nwsq6.js} +1 -1
- package/dist/cli/{index-vjvdvjd3.js → index-x12hvfpf.js} +3 -3
- package/dist/cli/{index-f6y341yk.js → index-yrrqs4b0.js} +82 -21
- package/dist/cli/{index-pzhkry3t.js → index-z718bgxe.js} +8 -8
- package/dist/cli/index.d.ts +34 -0
- package/dist/cli/index.js +105 -28
- package/dist/cli/{knowledge-escalator-qn7ew687.js → knowledge-escalator-5gwp1ar8.js} +3 -3
- package/dist/cli/{knowledge-events-k2xsz5bh.js → knowledge-events-m304swh6.js} +1 -1
- package/dist/cli/{knowledge-store-ksa1dr2z.js → knowledge-store-9babt8rd.js} +1 -1
- package/dist/cli/{knowledge-validator-2knz0d2t.js → knowledge-validator-t9sym59g.js} +4 -2
- package/dist/cli/{skill-generator-w6qd9mde.js → skill-generator-tav44xpm.js} +4 -4
- package/dist/config/skill-mirrors.d.ts +12 -0
- package/dist/hooks/adversarial-detector.d.ts +6 -0
- package/dist/hooks/delegation-gate.d.ts +19 -0
- package/dist/hooks/guardrails/index.d.ts +2 -2
- package/dist/hooks/knowledge-validator.d.ts +22 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +89 -85
- package/dist/plan/ledger.d.ts +83 -20
- package/dist/types/delegation.d.ts +24 -0
- package/package.json +1 -1
- package/dist/graph/graph-builder.d.ts +0 -39
- package/dist/graph/graph-query.d.ts +0 -42
- package/dist/graph/graph-store.d.ts +0 -27
- package/dist/graph/import-extractor.d.ts +0 -44
- package/dist/graph/index.d.ts +0 -16
- package/dist/graph/symbol-extractor.d.ts +0 -17
- package/dist/graph/types.d.ts +0 -84
- package/dist/sandbox/win32/restricted-token-executor.d.ts +0 -9
package/dist/plan/ledger.d.ts
CHANGED
|
@@ -253,20 +253,63 @@ interface ReplayOptions {
|
|
|
253
253
|
useSnapshot?: boolean;
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
|
-
*
|
|
257
|
-
* Loads plan.json as the base state and applies ledger events in sequence.
|
|
256
|
+
* Result of a status-aware ledger replay.
|
|
258
257
|
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
258
|
+
* Threads the integrity verdict OUT of replay so callers (notably `loadPlan`)
|
|
259
|
+
* can distinguish a full, clean reconstruction from a PREFIX-ONLY one produced
|
|
260
|
+
* after a poison line. Overwriting canonical plan.json with a prefix-only
|
|
261
|
+
* projection silently drops every durable event recorded after the corruption
|
|
262
|
+
* (the M1 silent-rollback defect); `truncated === true` is the signal that must
|
|
263
|
+
* gate any such overwrite.
|
|
264
|
+
*/
|
|
265
|
+
export interface ReplayStatusResult {
|
|
266
|
+
/** Reconstructed plan, or null when replay cannot proceed / plan was reset. */
|
|
267
|
+
plan: Plan | null;
|
|
268
|
+
/**
|
|
269
|
+
* True when a malformed ledger line stopped the read before the tail, so
|
|
270
|
+
* `plan` reflects only the events BEFORE the corruption. Never overwrite the
|
|
271
|
+
* canonical plan.json with `plan` when this is true.
|
|
272
|
+
*/
|
|
273
|
+
truncated: boolean;
|
|
274
|
+
/** Raw corrupted suffix (first bad line through EOF), or null when clean. */
|
|
275
|
+
badSuffix: string | null;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Replay ledger events to reconstruct plan state (status-discarding wrapper).
|
|
279
|
+
*
|
|
280
|
+
* Delegates to {@link replayFromLedgerWithStatus} and returns only the plan.
|
|
281
|
+
* Retained as the stable, widely-called/mocked entry point; callers that must
|
|
282
|
+
* react to ledger truncation (to avoid the M1 silent-rollback) should use
|
|
283
|
+
* {@link replayFromLedgerWithStatus} instead.
|
|
264
284
|
*
|
|
265
285
|
* @param directory - The working directory
|
|
266
286
|
* @param options - Optional replay options
|
|
267
287
|
* @returns Reconstructed Plan from ledger events, or null if plan.json doesn't exist or ledger is empty
|
|
268
288
|
*/
|
|
269
|
-
export declare function replayFromLedger(directory: string,
|
|
289
|
+
export declare function replayFromLedger(directory: string, options?: ReplayOptions): Promise<Plan | null>;
|
|
290
|
+
/**
|
|
291
|
+
* Replay ledger events to reconstruct plan state, threading the integrity
|
|
292
|
+
* verdict back to the caller.
|
|
293
|
+
*
|
|
294
|
+
* This is the folded successor to the former `replayWithIntegrity`: it performs
|
|
295
|
+
* integrity-checked reading (stop-at-first-bad via
|
|
296
|
+
* {@link readLedgerEventsWithIntegrity}), quarantines any corrupted suffix to a
|
|
297
|
+
* UNIQUE non-overwriting side file (never rewriting/truncating the canonical
|
|
298
|
+
* ledger), and reconstructs the plan from the clean prefix.
|
|
299
|
+
*
|
|
300
|
+
* IMPORTANT semantics preserved from `replayFromLedger` (do NOT regress):
|
|
301
|
+
* - The `plan_created` embedded-plan bootstrap branch (#444) is honored via
|
|
302
|
+
* {@link reconstructPlanFromEvents}.
|
|
303
|
+
* - `applyEventToPlan`'s "unhandled event type" throw is intentionally allowed
|
|
304
|
+
* to PROPAGATE to the caller (loadPlan's catch → critic-approved snapshot
|
|
305
|
+
* fallback). It is NOT swallowed into a null return here (that was
|
|
306
|
+
* `replayWithIntegrity`'s bug — it hid genuine replay failures).
|
|
307
|
+
*
|
|
308
|
+
* @param directory - The working directory
|
|
309
|
+
* @param _options - Optional replay options (reserved)
|
|
310
|
+
* @returns {@link ReplayStatusResult} with plan, truncated flag, and bad suffix
|
|
311
|
+
*/
|
|
312
|
+
export declare function replayFromLedgerWithStatus(directory: string, _options?: ReplayOptions): Promise<ReplayStatusResult>;
|
|
270
313
|
/**
|
|
271
314
|
* Apply a single ledger event to the plan state.
|
|
272
315
|
* Returns null if the event indicates a full reset (plan_reset).
|
|
@@ -296,22 +339,42 @@ export interface LedgerIntegrityResult {
|
|
|
296
339
|
*/
|
|
297
340
|
export declare function readLedgerEventsWithIntegrity(directory: string): Promise<LedgerIntegrityResult>;
|
|
298
341
|
/**
|
|
299
|
-
*
|
|
300
|
-
* Does NOT modify the ledger file itself.
|
|
301
|
-
*
|
|
302
|
-
* @param directory - The working directory
|
|
303
|
-
* @param badSuffix - The corrupted content to quarantine
|
|
342
|
+
* Result of a {@link quarantineLedgerSuffix} call.
|
|
304
343
|
*/
|
|
305
|
-
export
|
|
344
|
+
export interface QuarantineResult {
|
|
345
|
+
/** Absolute path the suffix was written to, or null if the write failed. */
|
|
346
|
+
path: string | null;
|
|
347
|
+
/**
|
|
348
|
+
* Count of individually-parseable JSON lines salvaged from the bad suffix.
|
|
349
|
+
* The suffix is discarded from the active replay, but these lines were still
|
|
350
|
+
* well-formed events sitting behind the poison line — surfacing the count
|
|
351
|
+
* makes the size of the sacrificed tail observable rather than silent.
|
|
352
|
+
*/
|
|
353
|
+
salvagedCount: number;
|
|
354
|
+
}
|
|
306
355
|
/**
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
356
|
+
* Quarantine a corrupted ledger suffix to a separate, UNIQUE side file.
|
|
357
|
+
*
|
|
358
|
+
* Does NOT modify, rewrite, or truncate the canonical ledger file — it only
|
|
359
|
+
* copies the bad suffix aside for forensic recovery.
|
|
360
|
+
*
|
|
361
|
+
* Uniqueness (M1 fix): the target filename embeds a timestamp AND a content
|
|
362
|
+
* hash of the suffix, so a SECOND corruption cannot clobber the file written by
|
|
363
|
+
* the FIRST. The previous fixed `plan-ledger.quarantine` path overwrote any
|
|
364
|
+
* prior quarantine, permanently losing the earlier corrupted tail.
|
|
365
|
+
*
|
|
366
|
+
* Salvage: before returning, each line of the suffix is probed with JSON.parse
|
|
367
|
+
* and the count of well-formed lines is reported. The suffix is still excluded
|
|
368
|
+
* from the active replay (it lives behind a poison line and cannot be trusted as
|
|
369
|
+
* a contiguous continuation), but the salvage count is logged and returned so
|
|
370
|
+
* the loss is visible.
|
|
310
371
|
*
|
|
311
372
|
* @param directory - The working directory
|
|
312
|
-
* @
|
|
373
|
+
* @param badSuffix - The corrupted content to quarantine
|
|
374
|
+
* @returns {@link QuarantineResult} with the written path (or null) and the
|
|
375
|
+
* number of parseable lines salvaged from the suffix
|
|
313
376
|
*/
|
|
314
|
-
export declare function
|
|
377
|
+
export declare function quarantineLedgerSuffix(directory: string, badSuffix: string): Promise<QuarantineResult>;
|
|
315
378
|
/**
|
|
316
379
|
* Metadata describing an approved snapshot recovered from the ledger.
|
|
317
380
|
*/
|
|
@@ -390,10 +453,10 @@ export declare const _internals: {
|
|
|
390
453
|
appendLedgerEventWithRetry: typeof appendLedgerEventWithRetry;
|
|
391
454
|
takeSnapshotEvent: typeof takeSnapshotEvent;
|
|
392
455
|
replayFromLedger: typeof replayFromLedger;
|
|
456
|
+
replayFromLedgerWithStatus: typeof replayFromLedgerWithStatus;
|
|
393
457
|
applyEventToPlan: typeof applyEventToPlan;
|
|
394
458
|
readLedgerEventsWithIntegrity: typeof readLedgerEventsWithIntegrity;
|
|
395
459
|
quarantineLedgerSuffix: typeof quarantineLedgerSuffix;
|
|
396
|
-
replayWithIntegrity: typeof replayWithIntegrity;
|
|
397
460
|
loadLastApprovedPlan: typeof loadLastApprovedPlan;
|
|
398
461
|
loadLastPlanCriticApprovedSnapshot: typeof loadLastPlanCriticApprovedSnapshot;
|
|
399
462
|
getLedgerPath: typeof getLedgerPath;
|
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
* Delegation Envelope Types
|
|
3
3
|
* Interface for passing delegated tasks between agents
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* M15: OPTIONAL structured spec criteria carried with a delegation so a
|
|
7
|
+
* delegated coder receives spec-level acceptance / functional-requirement /
|
|
8
|
+
* success-criteria detail as structured data — not only architect free-text.
|
|
9
|
+
*
|
|
10
|
+
* Every member is optional. A MISSING `specCriteria` (or any missing member)
|
|
11
|
+
* is fully valid and MUST NOT trigger delegation rejection or advisory noise.
|
|
12
|
+
* Only a POPULATED-but-malformed value (a non-string[] member) is flagged, and
|
|
13
|
+
* even then advisory-only — never fail-closed.
|
|
14
|
+
*/
|
|
15
|
+
export interface DelegationSpecCriteria {
|
|
16
|
+
/** Functional requirements the change must satisfy (e.g. "FR-006"). */
|
|
17
|
+
fr?: string[];
|
|
18
|
+
/** Success criteria / measurable outcomes (e.g. "SC-111"). */
|
|
19
|
+
sc?: string[];
|
|
20
|
+
/** Acceptance criteria the implementation must meet. */
|
|
21
|
+
acceptance?: string[];
|
|
22
|
+
}
|
|
5
23
|
export interface DelegationEnvelope {
|
|
6
24
|
taskId: string;
|
|
7
25
|
targetAgent: string;
|
|
@@ -12,6 +30,12 @@ export interface DelegationEnvelope {
|
|
|
12
30
|
technicalContext: string;
|
|
13
31
|
errorStrategy?: 'FAIL_FAST' | 'BEST_EFFORT';
|
|
14
32
|
platformNotes?: string;
|
|
33
|
+
/**
|
|
34
|
+
* M15: OPTIONAL structured acceptance/FR/SC criteria. See
|
|
35
|
+
* {@link DelegationSpecCriteria}. Optional by contract — a missing field is
|
|
36
|
+
* valid and never causes rejection or advisory output.
|
|
37
|
+
*/
|
|
38
|
+
specCriteria?: DelegationSpecCriteria;
|
|
15
39
|
}
|
|
16
40
|
/**
|
|
17
41
|
* Validation result types
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.114.
|
|
3
|
+
"version": "7.114.8",
|
|
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,39 +0,0 @@
|
|
|
1
|
-
import { type FileNode, type RepoGraph } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Build a full repository graph by walking the workspace, parsing source files
|
|
4
|
-
* for imports and exported symbols, and assembling them into a `RepoGraph`.
|
|
5
|
-
*
|
|
6
|
-
* Performance:
|
|
7
|
-
* - File scanning skips well-known build/dep directories (node_modules, dist, .git, etc.)
|
|
8
|
-
* - Per-file parsing runs with a concurrency limit to avoid overwhelming I/O.
|
|
9
|
-
* - Files larger than `MAX_FILE_SIZE_BYTES` are skipped (would also fail downstream extractors).
|
|
10
|
-
*
|
|
11
|
-
* Targets ~5s for a 50k LOC repo (~500 files) on commodity hardware.
|
|
12
|
-
*/
|
|
13
|
-
export interface BuildOptions {
|
|
14
|
-
/** Optional cap on file count to bound runtime on huge repos. */
|
|
15
|
-
maxFiles?: number;
|
|
16
|
-
/** Concurrency for per-file parsing. Defaults to 16. */
|
|
17
|
-
concurrency?: number;
|
|
18
|
-
/** Additional directory names to skip (merged with defaults). */
|
|
19
|
-
skipDirs?: string[];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Hard upper bound on file count if the caller does not supply one. Protects
|
|
23
|
-
* against unbounded memory growth on extremely large monorepos. Callers can
|
|
24
|
-
* pass an explicit `maxFiles` (including a larger one) to override.
|
|
25
|
-
*/
|
|
26
|
-
export declare const DEFAULT_MAX_FILES = 10000;
|
|
27
|
-
/**
|
|
28
|
-
* Walk the workspace and return absolute paths of all supported source files.
|
|
29
|
-
* Cross-platform: emits absolute paths using the host's path separator.
|
|
30
|
-
*/
|
|
31
|
-
export declare function findSourceFiles(workspaceRoot: string, skipDirs?: Set<string>): string[];
|
|
32
|
-
/**
|
|
33
|
-
* Build the repo graph from scratch.
|
|
34
|
-
*/
|
|
35
|
-
export declare function buildRepoGraph(workspaceRoot: string, options?: BuildOptions): Promise<RepoGraph>;
|
|
36
|
-
/**
|
|
37
|
-
* Process a single file into a FileNode. Returns null if the file cannot be processed.
|
|
38
|
-
*/
|
|
39
|
-
export declare function processFile(absoluteFilePath: string, workspaceRoot: string): Promise<FileNode | null>;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { BlastRadiusResult, FileNode, FileReference, LocalizationBlock, RepoGraph, SymbolReference } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Query API for the repo graph.
|
|
4
|
-
*
|
|
5
|
-
* All functions accept normalized RELATIVE forward-slash paths and return the
|
|
6
|
-
* same. Callers responsible for normalizing input paths (helper provided).
|
|
7
|
-
*/
|
|
8
|
-
export declare function normalizeGraphPath(p: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* Files that import the given file (direct dependents).
|
|
11
|
-
*/
|
|
12
|
-
export declare function getImporters(graph: RepoGraph, filePath: string): FileReference[];
|
|
13
|
-
/**
|
|
14
|
-
* Files this file imports (direct dependencies, resolved targets only).
|
|
15
|
-
*/
|
|
16
|
-
export declare function getDependencies(graph: RepoGraph, filePath: string): FileReference[];
|
|
17
|
-
/**
|
|
18
|
-
* Find all importers of a specific exported symbol from a file.
|
|
19
|
-
*/
|
|
20
|
-
export declare function getSymbolConsumers(graph: RepoGraph, filePath: string, symbolName: string): SymbolReference[];
|
|
21
|
-
/**
|
|
22
|
-
* Compute the transitive blast radius of changing one or more files.
|
|
23
|
-
*
|
|
24
|
-
* Performs a BFS over the reverse-edge index up to `maxDepth` levels.
|
|
25
|
-
*/
|
|
26
|
-
export declare function getBlastRadius(graph: RepoGraph, filePaths: string[], maxDepth?: number): BlastRadiusResult;
|
|
27
|
-
/**
|
|
28
|
-
* Top-N most-imported files (by in-degree) — useful for surfacing
|
|
29
|
-
* architectural pillars.
|
|
30
|
-
*/
|
|
31
|
-
export declare function getKeyFiles(graph: RepoGraph, topN?: number): FileNode[];
|
|
32
|
-
/**
|
|
33
|
-
* Build a compact localization block for a single file. This is the primary
|
|
34
|
-
* payload injected into the coder agent's pre-edit context.
|
|
35
|
-
*/
|
|
36
|
-
export declare function getLocalizationContext(graph: RepoGraph, filePath: string, options?: {
|
|
37
|
-
maxImporters?: number;
|
|
38
|
-
maxDeps?: number;
|
|
39
|
-
maxDepth?: number;
|
|
40
|
-
}): LocalizationBlock;
|
|
41
|
-
/** Reset the cached reverse index. Call this when a graph is mutated in place. */
|
|
42
|
-
export declare function resetQueryCache(): void;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type RepoGraph } from './types';
|
|
2
|
-
export declare function getGraphPath(workspaceRoot: string): string;
|
|
3
|
-
export declare function loadGraph(workspaceRoot: string): RepoGraph | null;
|
|
4
|
-
export declare function saveGraph(workspaceRoot: string, graph: RepoGraph): void;
|
|
5
|
-
/**
|
|
6
|
-
* Build the graph from scratch and persist it.
|
|
7
|
-
*/
|
|
8
|
-
export declare function buildAndSaveGraph(workspaceRoot: string): Promise<RepoGraph>;
|
|
9
|
-
/**
|
|
10
|
-
* Apply incremental updates for a list of changed (or potentially-changed) files.
|
|
11
|
-
*
|
|
12
|
-
* For each file:
|
|
13
|
-
* - If the file no longer exists, its node is removed.
|
|
14
|
-
* - Otherwise its node is re-parsed and replaced.
|
|
15
|
-
*
|
|
16
|
-
* Returns the updated graph (mutated in place AND returned for convenience).
|
|
17
|
-
* Caller must call `saveGraph` to persist if desired.
|
|
18
|
-
*/
|
|
19
|
-
export declare function updateGraphIncremental(workspaceRoot: string, changedRelativePaths: string[], graph: RepoGraph): Promise<RepoGraph>;
|
|
20
|
-
/**
|
|
21
|
-
* Determine if a stored graph is fresh enough to reuse.
|
|
22
|
-
*
|
|
23
|
-
* Default freshness window: 5 minutes. Files added/removed outside this
|
|
24
|
-
* window are not detected without an explicit incremental update — callers
|
|
25
|
-
* that care about up-to-the-second accuracy should rebuild.
|
|
26
|
-
*/
|
|
27
|
-
export declare function isGraphFresh(graph: RepoGraph | null, maxAgeMs?: number): boolean;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { ImportEdge } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Extract import edges from a source file.
|
|
4
|
-
*
|
|
5
|
-
* Uses regex-based parsing (the same proven approach as `src/tools/imports.ts`
|
|
6
|
-
* and `src/tools/co-change-analyzer.ts`). Tree-sitter is intentionally not used
|
|
7
|
-
* here because:
|
|
8
|
-
* 1. The existing regex patterns are battle-tested across the codebase.
|
|
9
|
-
* 2. Import statements have stable, simple syntax that regex handles reliably.
|
|
10
|
-
* 3. Avoiding the per-file Tree-sitter parse keeps full-graph builds fast
|
|
11
|
-
* enough to be interactive (target: <5s for 50k LOC).
|
|
12
|
-
*
|
|
13
|
-
* Supported languages:
|
|
14
|
-
* - TypeScript / JavaScript (.ts/.tsx/.js/.jsx/.mjs/.cjs) — ES modules + CJS require
|
|
15
|
-
* - Python (.py) — `import x` and `from x import y`
|
|
16
|
-
* - Go (.go) — `import "path"` and `import (...)` blocks
|
|
17
|
-
* - Rust (.rs) — `use path::module`
|
|
18
|
-
*
|
|
19
|
-
* Only RELATIVE imports are tracked as graph edges. External package imports
|
|
20
|
-
* (e.g. 'react', 'fmt', 'std::fs') are skipped — they are not part of the
|
|
21
|
-
* intra-repo dependency graph.
|
|
22
|
-
*/
|
|
23
|
-
export interface ExtractImportsOptions {
|
|
24
|
-
/** Absolute path to the source file (used for relative resolution). */
|
|
25
|
-
absoluteFilePath: string;
|
|
26
|
-
/** Absolute workspace root (used for relative path computation). */
|
|
27
|
-
workspaceRoot: string;
|
|
28
|
-
/** Optional pre-read content; if omitted the file is read from disk. */
|
|
29
|
-
content?: string;
|
|
30
|
-
}
|
|
31
|
-
/** Source file extensions we know how to scan. */
|
|
32
|
-
export declare const SOURCE_EXTENSIONS: readonly [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".py", ".pyw", ".go", ".rs"];
|
|
33
|
-
export declare function getLanguageFromExtension(ext: string): string | null;
|
|
34
|
-
/**
|
|
35
|
-
* Extract import edges for a single file. Returns an empty array when the
|
|
36
|
-
* language is unsupported or the file cannot be parsed.
|
|
37
|
-
*
|
|
38
|
-
* Resolution strategy for edge.target:
|
|
39
|
-
* - TS/JS: probe extensions (.ts, .tsx, .js, .jsx, .mjs, .cjs, /index.*).
|
|
40
|
-
* - Python: probe .py and /__init__.py for relative imports only.
|
|
41
|
-
* - Go/Rust: target left empty (intra-repo resolution requires module/crate
|
|
42
|
-
* metadata that is out of scope for Phase 1). The raw module is preserved.
|
|
43
|
-
*/
|
|
44
|
-
export declare function extractImports(opts: ExtractImportsOptions): ImportEdge[];
|
package/dist/graph/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Repo graph: structural codebase awareness for swarm agents.
|
|
3
|
-
*
|
|
4
|
-
* Public surface:
|
|
5
|
-
* - Types (RepoGraph, FileNode, ImportEdge, ExportedSymbol, ...)
|
|
6
|
-
* - Builders (buildRepoGraph, processFile, findSourceFiles)
|
|
7
|
-
* - Store (loadGraph, saveGraph, buildAndSaveGraph, updateGraphIncremental, isGraphFresh, getGraphPath)
|
|
8
|
-
* - Query (getImporters, getDependencies, getSymbolConsumers, getBlastRadius,
|
|
9
|
-
* getKeyFiles, getLocalizationContext, normalizeGraphPath, resetQueryCache)
|
|
10
|
-
*/
|
|
11
|
-
export { type BuildOptions, buildRepoGraph, findSourceFiles, processFile, } from './graph-builder';
|
|
12
|
-
export { getBlastRadius, getDependencies, getImporters, getKeyFiles, getLocalizationContext, getSymbolConsumers, normalizeGraphPath, resetQueryCache, } from './graph-query';
|
|
13
|
-
export { buildAndSaveGraph, getGraphPath, isGraphFresh, loadGraph, saveGraph, updateGraphIncremental, } from './graph-store';
|
|
14
|
-
export { extractImports, getLanguageFromExtension, SOURCE_EXTENSIONS, } from './import-extractor';
|
|
15
|
-
export { extractExportedSymbols } from './symbol-extractor';
|
|
16
|
-
export * from './types';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ExportedSymbol } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Extract exported symbols from a single file.
|
|
4
|
-
*
|
|
5
|
-
* Reuses the proven regex-based extractors from `src/tools/symbols.ts`
|
|
6
|
-
* (`extractTSSymbols` / `extractPythonSymbols`) and maps their internal
|
|
7
|
-
* SymbolInfo shape to our `ExportedSymbol` type.
|
|
8
|
-
*
|
|
9
|
-
* For Go and Rust, exported-symbol extraction is best-effort (out of scope
|
|
10
|
-
* for Phase 1) — empty arrays are returned. The graph still tracks file-level
|
|
11
|
-
* import edges for these languages.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @param relativeFilePath - file path relative to workspace root (forward-slash)
|
|
15
|
-
* @param workspaceRoot - absolute workspace root
|
|
16
|
-
*/
|
|
17
|
-
export declare function extractExportedSymbols(relativeFilePath: string, workspaceRoot: string): ExportedSymbol[];
|
package/dist/graph/types.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Repo graph data structures.
|
|
3
|
-
*
|
|
4
|
-
* The graph captures structural relationships between source files
|
|
5
|
-
* (imports/exports) so agents can reason about blast radius before editing.
|
|
6
|
-
*
|
|
7
|
-
* All paths are RELATIVE to the workspace root and FORWARD-SLASH normalized
|
|
8
|
-
* for cross-platform comparison.
|
|
9
|
-
*/
|
|
10
|
-
export type ImportType = 'named' | 'default' | 'namespace' | 'sideeffect' | 'require' | 'type';
|
|
11
|
-
export interface ImportEdge {
|
|
12
|
-
/** Importing file (relative, forward-slash). */
|
|
13
|
-
source: string;
|
|
14
|
-
/** Resolved imported file (relative, forward-slash). May be empty for unresolved imports. */
|
|
15
|
-
target: string;
|
|
16
|
-
/** Raw module specifier as written in the source (e.g. '../utils/path-security'). */
|
|
17
|
-
rawModule: string;
|
|
18
|
-
/** Named imports brought in (empty for sideeffect/namespace/default). */
|
|
19
|
-
importedSymbols: string[];
|
|
20
|
-
/** What kind of import statement this is. */
|
|
21
|
-
importType: ImportType;
|
|
22
|
-
/** 1-indexed line number where the import appears. */
|
|
23
|
-
line: number;
|
|
24
|
-
}
|
|
25
|
-
export type SymbolKind = 'function' | 'class' | 'interface' | 'type' | 'enum' | 'const' | 'variable' | 'method' | 'property';
|
|
26
|
-
export interface ExportedSymbol {
|
|
27
|
-
name: string;
|
|
28
|
-
kind: SymbolKind;
|
|
29
|
-
signature?: string;
|
|
30
|
-
line: number;
|
|
31
|
-
}
|
|
32
|
-
export interface FileNode {
|
|
33
|
-
/** Relative, forward-slash path. */
|
|
34
|
-
path: string;
|
|
35
|
-
/** Detected language id (e.g. 'typescript', 'python', 'go', 'rust'). */
|
|
36
|
-
language: string;
|
|
37
|
-
/** Symbols this file exports (or top-level definitions for languages without explicit exports). */
|
|
38
|
-
exports: ExportedSymbol[];
|
|
39
|
-
/** Outgoing import edges from this file. */
|
|
40
|
-
imports: ImportEdge[];
|
|
41
|
-
/** mtime of the source file (ms epoch) for incremental updates. */
|
|
42
|
-
mtimeMs: number;
|
|
43
|
-
}
|
|
44
|
-
export interface RepoGraph {
|
|
45
|
-
/** Schema version for migration. */
|
|
46
|
-
version: number;
|
|
47
|
-
/** ISO timestamp when this graph was built. */
|
|
48
|
-
buildTimestamp: string;
|
|
49
|
-
/** Workspace root used at build time (absolute, for diagnostics only). */
|
|
50
|
-
rootDir: string;
|
|
51
|
-
/** Files keyed by their relative forward-slash path. */
|
|
52
|
-
files: Record<string, FileNode>;
|
|
53
|
-
}
|
|
54
|
-
export interface FileReference {
|
|
55
|
-
file: string;
|
|
56
|
-
line?: number;
|
|
57
|
-
importType?: ImportType;
|
|
58
|
-
}
|
|
59
|
-
export interface SymbolReference {
|
|
60
|
-
file: string;
|
|
61
|
-
line: number;
|
|
62
|
-
importedAs: string;
|
|
63
|
-
}
|
|
64
|
-
export interface BlastRadiusResult {
|
|
65
|
-
target: string[];
|
|
66
|
-
directDependents: string[];
|
|
67
|
-
transitiveDependents: string[];
|
|
68
|
-
depthReached: number;
|
|
69
|
-
totalDependents: number;
|
|
70
|
-
riskLevel: 'low' | 'medium' | 'high' | 'critical';
|
|
71
|
-
}
|
|
72
|
-
export interface LocalizationBlock {
|
|
73
|
-
target: string;
|
|
74
|
-
importerCount: number;
|
|
75
|
-
importers: FileReference[];
|
|
76
|
-
dependencyCount: number;
|
|
77
|
-
dependencies: FileReference[];
|
|
78
|
-
exportedSymbolsUsedExternally: string[];
|
|
79
|
-
blastRadius: BlastRadiusResult;
|
|
80
|
-
/** Compact human/LLM-readable summary suitable for context injection. */
|
|
81
|
-
summary: string;
|
|
82
|
-
}
|
|
83
|
-
export declare const REPO_GRAPH_SCHEMA_VERSION = 1;
|
|
84
|
-
export declare const REPO_GRAPH_FILENAME = "repo-graph.json";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Backwards-compatibility re-export.
|
|
3
|
-
*
|
|
4
|
-
* The implementation has moved to restricted-environment-executor.ts to
|
|
5
|
-
* clarify that this is environment scrubbing, not real token restriction.
|
|
6
|
-
* The native sandbox runner (swarm-sandbox-runner.exe) provides true
|
|
7
|
-
* OS-level isolation via runner-client.ts.
|
|
8
|
-
*/
|
|
9
|
-
export { _internals, WindowsSandboxExecutor, } from './restricted-environment-executor';
|