opencode-swarm 7.107.1 → 7.107.3

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 (39) hide show
  1. package/dist/cli/{curator-np2ky29t.js → curator-1nr4qszq.js} +6 -6
  2. package/dist/cli/{curator-drift-6ad8mxxb.js → curator-drift-ed7p5mfy.js} +2 -2
  3. package/dist/cli/{curator-llm-factory-gdhtm1hh.js → curator-llm-factory-x9tk7e6m.js} +6 -6
  4. package/dist/cli/{evidence-summary-service-dh44gevz.js → evidence-summary-service-9r28ds8t.js} +3 -3
  5. package/dist/cli/{guardrail-explain-414smfg4.js → guardrail-explain-etdrhd4d.js} +7 -7
  6. package/dist/cli/{guardrail-log-fsc85hwa.js → guardrail-log-2rns4g6d.js} +2 -2
  7. package/dist/cli/{hive-promoter-y9r8d315.js → hive-promoter-j4e6rfa6.js} +6 -6
  8. package/dist/cli/{index-87d4wsv9.js → index-502f6np6.js} +8 -8
  9. package/dist/cli/{index-mpe0yk9s.js → index-57ymmh7h.js} +5 -3
  10. package/dist/cli/{index-357p0baj.js → index-91j1sqzm.js} +14 -2
  11. package/dist/cli/{index-gt514nt1.js → index-cyzzdbvw.js} +1058 -873
  12. package/dist/cli/{index-t4hbye3v.js → index-hkpw4wwa.js} +1 -1
  13. package/dist/cli/{index-jjp5qrjv.js → index-kzfkggjx.js} +97 -39
  14. package/dist/cli/{index-w8dzxnx4.js → index-m1xjr58n.js} +1 -1
  15. package/dist/cli/{index-fxtrk7y8.js → index-tgtmbf3r.js} +1 -1
  16. package/dist/cli/{index-7v734syt.js → index-w15984gg.js} +2 -2
  17. package/dist/cli/index.js +6 -6
  18. package/dist/cli/{pending-delegations-46xf2n2e.js → pending-delegations-ws51m1e1.js} +1 -1
  19. package/dist/cli/{pr-subscriptions-3c34rnm1.js → pr-subscriptions-0dpn4epk.js} +2 -2
  20. package/dist/commands/handoff.d.ts +2 -1
  21. package/dist/commands/registry.d.ts +4 -4
  22. package/dist/config/bundled-skills.d.ts +3 -5
  23. package/dist/hooks/guardrails/file-authority.d.ts +1 -1
  24. package/dist/hooks/knowledge-injector.d.ts +3 -0
  25. package/dist/hooks/knowledge-reader.d.ts +17 -0
  26. package/dist/hooks/semantic-diff-injection.d.ts +19 -0
  27. package/dist/index.js +340 -332
  28. package/dist/services/directive-predicate-runner.d.ts +1 -1
  29. package/dist/session/snapshot-writer.d.ts +4 -0
  30. package/dist/tools/external-skill-discover.d.ts +11 -0
  31. package/dist/tools/knowledge-remove.d.ts +11 -0
  32. package/dist/tools/pre-check-batch.d.ts +4 -0
  33. package/dist/turbo/lean/evidence.d.ts +22 -0
  34. package/dist/turbo/lean/integration.d.ts +6 -1
  35. package/dist/turbo/lean/reviewer.d.ts +6 -1
  36. package/dist/turbo/lean/runner.d.ts +10 -1
  37. package/dist/utils/untrusted-markdown.d.ts +1 -0
  38. package/dist/worktree/merge.d.ts +1 -0
  39. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  validateSwarmPath
4
- } from "./index-mpe0yk9s.js";
4
+ } from "./index-57ymmh7h.js";
5
5
  import {
6
6
  log
7
7
  } from "./index-zgwm4ryv.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  readEffectiveSpecSync
4
- } from "./index-357p0baj.js";
4
+ } from "./index-91j1sqzm.js";
5
5
  import {
6
6
  isValidTaskId,
7
7
  readTaskEvidence,
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  readSwarmFileAsync,
13
13
  validateSwarmPath
14
- } from "./index-mpe0yk9s.js";
14
+ } from "./index-57ymmh7h.js";
15
15
  import {
16
16
  readCachedParsedFile
17
17
  } from "./index-jtqkh8jf.js";
@@ -1740,6 +1740,49 @@ var CAS_BACKOFF_START_MS = 5;
1740
1740
  var CAS_BACKOFF_CAP_MS = 250;
1741
1741
  var CAS_BACKOFF_JITTER = 0.25;
1742
1742
  var CAS_MAX_RETRIES = 3;
1743
+ function derivePhaseStatusesInPlace(plan) {
1744
+ for (const phase of plan.phases) {
1745
+ const tasks = phase.tasks;
1746
+ if (tasks.length > 0 && tasks.every((t) => t.status === "completed")) {
1747
+ phase.status = "complete";
1748
+ } else if (tasks.some((t) => t.status === "in_progress")) {
1749
+ phase.status = "in_progress";
1750
+ } else if (tasks.some((t) => t.status === "blocked")) {
1751
+ phase.status = "blocked";
1752
+ } else {
1753
+ phase.status = "pending";
1754
+ }
1755
+ }
1756
+ }
1757
+ function overlayLedgerStatuses(validated, replayed, ledgerStatusTaskIds) {
1758
+ const projected = structuredClone(validated);
1759
+ const statusByTaskId = new Map;
1760
+ for (const phase of replayed.phases) {
1761
+ for (const task of phase.tasks) {
1762
+ if (ledgerStatusTaskIds.has(task.id)) {
1763
+ statusByTaskId.set(task.id, task.status);
1764
+ }
1765
+ }
1766
+ }
1767
+ for (const phase of projected.phases) {
1768
+ for (const task of phase.tasks) {
1769
+ const replayedStatus = statusByTaskId.get(task.id);
1770
+ if (replayedStatus)
1771
+ task.status = replayedStatus;
1772
+ }
1773
+ }
1774
+ derivePhaseStatusesInPlace(projected);
1775
+ return projected;
1776
+ }
1777
+ function collectLedgerStatusTaskIds(events) {
1778
+ const statusTaskIds = new Set;
1779
+ for (const event of events) {
1780
+ if (event.event_type === "task_status_changed" && typeof event.task_id === "string") {
1781
+ statusTaskIds.add(event.task_id);
1782
+ }
1783
+ }
1784
+ return statusTaskIds;
1785
+ }
1743
1786
  async function retryCasWithBackoff(directory, eventInput, options) {
1744
1787
  const maxRetries = options.maxRetries ?? CAS_MAX_RETRIES;
1745
1788
  let currentExpected = options.expectedHash;
@@ -2182,18 +2225,7 @@ async function savePlan(directory, plan, options) {
2182
2225
  }
2183
2226
  } catch {}
2184
2227
  }
2185
- for (const phase of validated.phases) {
2186
- const tasks = phase.tasks;
2187
- if (tasks.length > 0 && tasks.every((t) => t.status === "completed")) {
2188
- phase.status = "complete";
2189
- } else if (tasks.some((t) => t.status === "in_progress")) {
2190
- phase.status = "in_progress";
2191
- } else if (tasks.some((t) => t.status === "blocked")) {
2192
- phase.status = "blocked";
2193
- } else {
2194
- phase.status = "pending";
2195
- }
2196
- }
2228
+ derivePhaseStatusesInPlace(validated);
2197
2229
  const currentPlan = await _internals4.loadPlanJsonOnly(directory);
2198
2230
  const planId = derivePlanId(validated);
2199
2231
  const planHashForInit = computePlanHash(validated);
@@ -2399,11 +2431,21 @@ async function savePlan(directory, plan, options) {
2399
2431
  throw error2;
2400
2432
  }
2401
2433
  }
2434
+ const ledgerStatusTaskIds = collectLedgerStatusTaskIds(await readLedgerEvents(directory));
2435
+ const replayedBeforeProjection = await replayFromLedger(directory);
2436
+ const projectionCandidate = replayedBeforeProjection ? overlayLedgerStatuses(validated, replayedBeforeProjection, ledgerStatusTaskIds) : validated;
2437
+ if (replayedBeforeProjection && computePlanHash(replayedBeforeProjection) !== computePlanHash(projectionCandidate)) {
2438
+ await takeSnapshotEvent(directory, projectionCandidate, {
2439
+ planHashAfter: computePlanHash(projectionCandidate),
2440
+ source: "savePlan_structural_projection"
2441
+ });
2442
+ }
2443
+ const projectedPlan = await replayFromLedger(directory) ?? projectionCandidate;
2402
2444
  const SNAPSHOT_INTERVAL = 50;
2403
2445
  const latestSeq = await getLatestLedgerSeq(directory);
2404
2446
  if (latestSeq > 0 && latestSeq % SNAPSHOT_INTERVAL === 0) {
2405
- await takeSnapshotWithRetry(directory, validated, {
2406
- planHashAfter: hashAfter,
2447
+ await takeSnapshotWithRetry(directory, projectedPlan, {
2448
+ planHashAfter: computePlanHash(projectedPlan),
2407
2449
  source: "savePlan_manager"
2408
2450
  });
2409
2451
  }
@@ -2411,7 +2453,7 @@ async function savePlan(directory, plan, options) {
2411
2453
  const planPath = path5.join(swarmDir, "plan.json");
2412
2454
  const tempPath = path5.join(swarmDir, `plan.json.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
2413
2455
  try {
2414
- await bunWrite(tempPath, JSON.stringify(validated, null, 2));
2456
+ await bunWrite(tempPath, JSON.stringify(projectedPlan, null, 2));
2415
2457
  renameSync4(tempPath, planPath);
2416
2458
  } finally {
2417
2459
  try {
@@ -2423,15 +2465,15 @@ async function savePlan(directory, plan, options) {
2423
2465
  const inProgressMarker = JSON.stringify({
2424
2466
  source: "plan_manager",
2425
2467
  timestamp: new Date().toISOString(),
2426
- phases_count: validated.phases.length,
2427
- tasks_count: validated.phases.reduce((sum, p) => sum + p.tasks.length, 0),
2468
+ phases_count: projectedPlan.phases.length,
2469
+ tasks_count: projectedPlan.phases.reduce((sum, p) => sum + p.tasks.length, 0),
2428
2470
  in_progress: true
2429
2471
  });
2430
2472
  await bunWrite(markerPath, inProgressMarker);
2431
2473
  } catch {}
2432
2474
  try {
2433
- const contentHash = computePlanContentHash(validated);
2434
- const markdown = derivePlanMarkdown(validated);
2475
+ const contentHash = computePlanContentHash(projectedPlan);
2476
+ const markdown = derivePlanMarkdown(projectedPlan);
2435
2477
  const markdownWithHash = `<!-- PLAN_HASH: ${contentHash} -->
2436
2478
  ${markdown}`;
2437
2479
  const mdPath = path5.join(swarmDir, "plan.md");
@@ -2457,11 +2499,11 @@ ${markdown}`;
2457
2499
  }
2458
2500
  try {
2459
2501
  const markerPath = path5.join(swarmDir, ".plan-write-marker");
2460
- const tasksCount = validated.phases.reduce((sum, phase) => sum + phase.tasks.length, 0);
2502
+ const tasksCount = projectedPlan.phases.reduce((sum, phase) => sum + phase.tasks.length, 0);
2461
2503
  const marker = JSON.stringify({
2462
2504
  source: "plan_manager",
2463
2505
  timestamp: new Date().toISOString(),
2464
- phases_count: validated.phases.length,
2506
+ phases_count: projectedPlan.phases.length,
2465
2507
  tasks_count: tasksCount,
2466
2508
  in_progress: false
2467
2509
  });
@@ -2880,6 +2922,7 @@ import {
2880
2922
  statSync as statSync2
2881
2923
  } from "fs";
2882
2924
  import * as fs5 from "fs/promises";
2925
+ import * as os from "os";
2883
2926
  import * as path6 from "path";
2884
2927
 
2885
2928
  // src/config/evidence-schema.ts
@@ -3198,6 +3241,30 @@ var PROJECT_INDICATORS = [
3198
3241
  "build.gradle",
3199
3242
  "CMakeLists.txt"
3200
3243
  ];
3244
+ function isWeakConfigContainerRoot(directory) {
3245
+ try {
3246
+ const resolved = realpathSync(directory);
3247
+ return resolved === realpathSync(os.tmpdir()) || resolved === realpathSync(os.homedir());
3248
+ } catch {
3249
+ const resolved = path6.resolve(directory);
3250
+ return resolved === path6.resolve(os.tmpdir()) || resolved === path6.resolve(os.homedir());
3251
+ }
3252
+ }
3253
+ function hasAccessibleProjectIndicator(directory, options = {}) {
3254
+ const allowConfigOnly = options.allowConfigOnly ?? true;
3255
+ for (const indicator of PROJECT_INDICATORS) {
3256
+ if (!allowConfigOnly && indicator === ".opencode") {
3257
+ continue;
3258
+ }
3259
+ try {
3260
+ const indicatorStat = statSync2(path6.join(directory, indicator));
3261
+ if (indicatorStat.isFile() || indicatorStat.isDirectory()) {
3262
+ return true;
3263
+ }
3264
+ } catch {}
3265
+ }
3266
+ return false;
3267
+ }
3201
3268
  function validateProjectRoot(directory) {
3202
3269
  let resolved;
3203
3270
  try {
@@ -3215,25 +3282,16 @@ function validateProjectRoot(directory) {
3215
3282
  const parent = path6.dirname(current);
3216
3283
  if (parent === current)
3217
3284
  break;
3285
+ if (path6.dirname(parent) === parent) {
3286
+ current = parent;
3287
+ continue;
3288
+ }
3218
3289
  const parentSwarm = path6.join(parent, ".swarm");
3219
3290
  try {
3220
3291
  if (statSync2(parentSwarm).isDirectory()) {
3221
- let hasProjectIndicator = false;
3222
- for (const indicator of PROJECT_INDICATORS) {
3223
- try {
3224
- const indicatorStat = statSync2(path6.join(parent, indicator));
3225
- if (indicatorStat.isFile() || indicatorStat.isDirectory()) {
3226
- hasProjectIndicator = true;
3227
- break;
3228
- }
3229
- } catch (error2) {
3230
- if (error2 instanceof Error && "code" in error2 && error2.code === "ENOENT") {} else {
3231
- hasProjectIndicator = true;
3232
- break;
3233
- }
3234
- }
3235
- }
3236
- if (hasProjectIndicator) {
3292
+ if (hasAccessibleProjectIndicator(parent, {
3293
+ allowConfigOnly: !isWeakConfigContainerRoot(parent)
3294
+ })) {
3237
3295
  warn(`[evidence] Rejecting write to subdirectory "${resolved}" \u2014 parent "${parent}" already contains .swarm/`);
3238
3296
  throw new Error(`Cannot write evidence in "${resolved}" \u2014 parent directory "${parent}" already contains a .swarm/ folder. Evidence must be written to the project root.`);
3239
3297
  }
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  redactPath,
4
4
  redactShellCommand
5
- } from "./index-fxtrk7y8.js";
5
+ } from "./index-tgtmbf3r.js";
6
6
 
7
7
  // src/services/guardrail-log-service.ts
8
8
  import * as fs from "fs/promises";
@@ -2050,7 +2050,7 @@ function normalizePathWithCache(filePath, cwd) {
2050
2050
  return fallback;
2051
2051
  }
2052
2052
  }
2053
- function getGlobMatcher(pattern, caseInsensitive = process.platform === "win32" || process.platform === "darwin") {
2053
+ function getGlobMatcher(pattern, caseInsensitive = true) {
2054
2054
  const cacheKey = `${caseInsensitive ? "nocase" : "case"}\x00${pattern}`;
2055
2055
  const cached = globMatcherCache.get(cacheKey);
2056
2056
  if (cached !== undefined) {
@@ -12,14 +12,14 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-gt514nt1.js";
15
+ } from "./index-cyzzdbvw.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
19
19
  isInDeclaredScope,
20
20
  redactPath,
21
21
  redactShellCommand
22
- } from "./index-fxtrk7y8.js";
22
+ } from "./index-tgtmbf3r.js";
23
23
 
24
24
  // src/services/guardrail-explain-service.ts
25
25
  import path from "path";
package/dist/cli/index.js CHANGED
@@ -7,11 +7,11 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-gt514nt1.js";
10
+ } from "./index-cyzzdbvw.js";
11
11
  import"./index-esg1554h.js";
12
- import"./index-jjp5qrjv.js";
12
+ import"./index-kzfkggjx.js";
13
13
  import"./index-8w4d325g.js";
14
- import"./index-fxtrk7y8.js";
14
+ import"./index-tgtmbf3r.js";
15
15
  import"./index-09xpycan.js";
16
16
  import {
17
17
  DEFAULT_AGENT_CONFIGS
@@ -19,12 +19,12 @@ import {
19
19
  import"./index-9wstcavp.js";
20
20
  import"./index-f7nma02k.js";
21
21
  import"./index-c8s9a3zh.js";
22
- import"./index-357p0baj.js";
22
+ import"./index-91j1sqzm.js";
23
23
  import"./index-v4fcn4tr.js";
24
24
  import"./index-r8f89sm9.js";
25
25
  import"./index-9b7qp18e.js";
26
- import"./index-t4hbye3v.js";
27
- import"./index-mpe0yk9s.js";
26
+ import"./index-hkpw4wwa.js";
27
+ import"./index-57ymmh7h.js";
28
28
  import"./index-5e4e2hvv.js";
29
29
  import"./index-p0arc26j.js";
30
30
  import"./index-jtqkh8jf.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  validateSwarmPath
4
- } from "./index-mpe0yk9s.js";
4
+ } from "./index-57ymmh7h.js";
5
5
  import"./index-5e4e2hvv.js";
6
6
  import"./index-p0arc26j.js";
7
7
  import"./index-jtqkh8jf.js";
@@ -9,8 +9,8 @@ import {
9
9
  sweepStale,
10
10
  unsubscribe,
11
11
  updateSnapshot
12
- } from "./index-t4hbye3v.js";
13
- import"./index-mpe0yk9s.js";
12
+ } from "./index-hkpw4wwa.js";
13
+ import"./index-57ymmh7h.js";
14
14
  import"./index-5e4e2hvv.js";
15
15
  import"./index-p0arc26j.js";
16
16
  import"./index-jtqkh8jf.js";
@@ -1 +1,2 @@
1
- export declare function handleHandoffCommand(directory: string, _args: string[]): Promise<string>;
1
+ export declare function formatSessionScopedHandoffMarkdown(markdown: string, sessionID?: string): string;
2
+ export declare function handleHandoffCommand(directory: string, _args: string[], sessionID?: string): Promise<string>;
@@ -667,9 +667,9 @@ export declare const COMMAND_REGISTRY: {
667
667
  };
668
668
  readonly rollback: {
669
669
  readonly handler: (ctx: CommandContext) => Promise<string>;
670
- readonly description: "Restore swarm state to a checkpoint <phase>";
671
- readonly details: "Restores .swarm/ state by directly overwriting files from a checkpoint directory (checkpoints/phase-<N>). Writes rollback event to events.jsonl. Without phase argument, lists available checkpoints. Partial failures are reported but processing continues.";
672
- readonly args: "<phase-number>";
670
+ readonly description: "Restore swarm state or project files to a checkpoint";
671
+ readonly details: "Restores legacy .swarm/ phase checkpoints from checkpoints/phase-<N> when present. Otherwise restores named git checkpoints from .swarm/checkpoints.json by label or list number. Writes rollback event to events.jsonl. Without an argument, lists available checkpoints.";
672
+ readonly args: "<phase-number|label|list-number>";
673
673
  readonly category: "utility";
674
674
  readonly toolPolicy: "restricted";
675
675
  };
@@ -890,7 +890,7 @@ export declare const COMMAND_REGISTRY: {
890
890
  readonly checkpoint: {
891
891
  readonly handler: (ctx: CommandContext) => Promise<string>;
892
892
  readonly description: "Manage project checkpoints [save|restore|delete|list] <label>";
893
- readonly details: "save: creates named snapshot of current .swarm/ state. restore: soft-resets to checkpoint by overwriting current .swarm/ files. delete: removes named checkpoint. list: shows all checkpoints with timestamps. All subcommands require a label except list.";
893
+ readonly details: "save: creates named git checkpoint. restore: hard-resets tracked files to the checkpoint. delete: removes named checkpoint metadata. list: shows all checkpoints with timestamps. All subcommands require a label except list.";
894
894
  readonly args: "<save|restore|delete|list> <label>";
895
895
  readonly category: "utility";
896
896
  readonly clashesWithNativeCcCommand: "/checkpoint";
@@ -6,7 +6,6 @@ interface CopyState {
6
6
  interface BundledSkillFile {
7
7
  relativePath: string;
8
8
  }
9
- declare function getSyncCacheKey(projectDirectory: string, packageRoot: string): string;
10
9
  declare function collectBundledSkillFilesBoundedAsync(sourceDir: string, state: CopyState, relativeDir?: string): Promise<BundledSkillFile[]>;
11
10
  /**
12
11
  * Materialize missing built-in mode skills into the target project so architect
@@ -19,13 +18,12 @@ declare function collectBundledSkillFilesBoundedAsync(sourceDir: string, state:
19
18
  * load its SKILL.md without a manual `/swarm` command or session restart; the
20
19
  * command path calls it again as a backstop for pre-existing projects.
21
20
  *
22
- * This is intentionally missing-only and fail-open: custom project skills are
23
- * never overwritten, and any filesystem error leaves command execution fail-open.
21
+ * This is intentionally fail-open: bundled slugs are refreshed from the package
22
+ * source, and any filesystem error leaves command execution fail-open.
24
23
  */
25
24
  export declare function syncBundledProjectSkillsIfMissingAsync(projectDirectory: string, packageRoot: string, quiet?: boolean): Promise<void>;
26
25
  export declare const _test_exports: {
27
26
  collectBundledSkillFilesBoundedAsync: typeof collectBundledSkillFilesBoundedAsync;
28
- getSyncCacheKey: typeof getSyncCacheKey;
29
- resetBundledProjectSkillSyncCache: () => void;
27
+ resetBundledProjectSkillSyncCache: () => undefined;
30
28
  };
31
29
  export {};
@@ -63,7 +63,7 @@ export declare function normalizePathWithCache(filePath: string, cwd: string): s
63
63
  /**
64
64
  * Gets or creates a cached picomatch matcher for a glob pattern.
65
65
  * @param pattern Glob pattern to compile
66
- * @param caseInsensitive Whether to use case-insensitive matching (default: true on Windows/macOS)
66
+ * @param caseInsensitive Whether to use case-insensitive matching (default: true for cross-platform policy consistency)
67
67
  * @returns Matcher function that returns true if path matches the pattern
68
68
  */
69
69
  export declare function getGlobMatcher(pattern: string, caseInsensitive?: boolean): (path: string) => boolean;
@@ -6,6 +6,7 @@
6
6
  * to prevent re-learning loops.
7
7
  */
8
8
  import { recordKnowledgeShown } from './knowledge-application.js';
9
+ import { buildEscalationBriefing, readRecentEscalations } from './knowledge-escalator.js';
9
10
  import { recordKnowledgeEvent } from './knowledge-events.js';
10
11
  import type { RankedEntry } from './knowledge-reader.js';
11
12
  import type { DirectivePriority, KnowledgeConfig, MessageWithParts } from './knowledge-types.js';
@@ -94,4 +95,6 @@ export declare const _internals: {
94
95
  searchKnowledge: typeof searchKnowledge;
95
96
  recordKnowledgeEvent: typeof recordKnowledgeEvent;
96
97
  recordKnowledgeShown: typeof recordKnowledgeShown;
98
+ readRecentEscalations: typeof readRecentEscalations;
99
+ buildEscalationBriefing: typeof buildEscalationBriefing;
97
100
  };
@@ -2,7 +2,12 @@
2
2
  * Merges swarm + hive knowledge, deduplicates (hive wins), ranks by composite score,
3
3
  * and provides utility tracking.
4
4
  */
5
+ import { existsSync } from 'node:fs';
6
+ import { readFile } from 'node:fs/promises';
7
+ import { atomicWriteFile } from '../evidence/task-file.js';
8
+ import { warn } from '../utils/logger.js';
5
9
  import { recordKnowledgeEvent } from './knowledge-events.js';
10
+ import { jaccardBigram, normalize, readKnowledge, readRetractionRecords, resolveHiveKnowledgePath, resolveSwarmKnowledgePath, transactFile, wordBigrams } from './knowledge-store.js';
6
11
  import type { KnowledgeConfig, KnowledgeEntryBase, KnowledgeRetrievalContext } from './knowledge-types.js';
7
12
  export interface ProjectContext {
8
13
  projectName: string;
@@ -37,6 +42,18 @@ export declare const _internals: {
37
42
  updateRetrievalOutcome: typeof updateRetrievalOutcome;
38
43
  scoreDirectiveAgainstContext: typeof scoreDirectiveAgainstContext;
39
44
  transactShownFile: typeof transactShownFile;
45
+ existsSync: typeof existsSync;
46
+ readFile: typeof readFile;
47
+ atomicWriteFile: typeof atomicWriteFile;
48
+ transactFile: typeof transactFile;
49
+ warn: typeof warn;
50
+ readKnowledge: typeof readKnowledge;
51
+ readRetractionRecords: typeof readRetractionRecords;
52
+ resolveHiveKnowledgePath: typeof resolveHiveKnowledgePath;
53
+ resolveSwarmKnowledgePath: typeof resolveSwarmKnowledgePath;
54
+ jaccardBigram: typeof jaccardBigram;
55
+ normalize: typeof normalize;
56
+ wordBigrams: typeof wordBigrams;
40
57
  recordKnowledgeEvent: typeof recordKnowledgeEvent;
41
58
  };
42
59
  export {};
@@ -7,6 +7,25 @@
7
7
  * Failure mode: silent. If git is unavailable or AST diff fails,
8
8
  * returns null — the reviewer simply doesn't get the extra context.
9
9
  */
10
+ import * as child_process from 'node:child_process';
11
+ import * as fs from 'node:fs';
12
+ import { computeASTDiff } from '../diff/ast-diff.js';
13
+ import { classifyChanges } from '../diff/semantic-classifier.js';
14
+ import { generateSummary, generateSummaryMarkdown } from '../diff/summary-generator.js';
15
+ import { getImporters, normalizeGraphPath } from '../tools/repo-graph.js';
16
+ import { getCachedGraph } from './repo-graph-injection.js';
17
+ export declare const _internals: {
18
+ execFile: typeof child_process.execFile;
19
+ realpathSync: typeof fs.realpathSync;
20
+ readFile: typeof fs.promises.readFile;
21
+ computeASTDiff: typeof computeASTDiff;
22
+ classifyChanges: typeof classifyChanges;
23
+ generateSummary: typeof generateSummary;
24
+ generateSummaryMarkdown: typeof generateSummaryMarkdown;
25
+ getCachedGraph: typeof getCachedGraph;
26
+ getImporters: typeof getImporters;
27
+ normalizeGraphPath: typeof normalizeGraphPath;
28
+ };
10
29
  /**
11
30
  * Build a semantic diff summary block for the given changed files.
12
31
  *