opencode-swarm 7.135.4 → 7.136.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.
Files changed (49) hide show
  1. package/dist/cli/{config-doctor-fgmemknc.js → config-doctor-q0krbxwv.js} +2 -2
  2. package/dist/cli/{curation-policy-frs28q57.js → curation-policy-v6ywe8qd.js} +2 -2
  3. package/dist/cli/{curator-llm-factory-pr59p535.js → curator-llm-factory-mhwje8rf.js} +12 -12
  4. package/dist/cli/{curator-psq8m2j7.js → curator-tqedvpy1.js} +12 -12
  5. package/dist/cli/{guardrail-explain-ws45zchy.js → guardrail-explain-m0m74hvr.js} +13 -13
  6. package/dist/cli/{guardrail-log-gbzek1pz.js → guardrail-log-5g8x6qc6.js} +3 -3
  7. package/dist/cli/{hive-promoter-gdbg4nyd.js → hive-promoter-s804newd.js} +12 -12
  8. package/dist/cli/{index-vh39nxpx.js → index-1kjg590p.js} +1 -1
  9. package/dist/cli/{index-4g3nq4sh.js → index-2cv1j3rf.js} +1 -1
  10. package/dist/cli/{index-jsp8r6f9.js → index-2w4tsmva.js} +1 -1
  11. package/dist/cli/{index-66w4jjg6.js → index-81dkzncr.js} +35 -35
  12. package/dist/cli/{index-mysdsqtk.js → index-9bk16zkv.js} +1 -1
  13. package/dist/cli/{index-ajehqzvn.js → index-bbejqagj.js} +1 -1
  14. package/dist/cli/{index-g86vfxnk.js → index-bwfzq91q.js} +3 -3
  15. package/dist/cli/{index-ck9rx6j1.js → index-cfz5750k.js} +1 -1
  16. package/dist/cli/{index-xfeg0c0c.js → index-cxq1t7j1.js} +14 -14
  17. package/dist/cli/{index-tegdwx34.js → index-j08trvny.js} +5 -5
  18. package/dist/cli/{index-cg413zhk.js → index-m1hew17b.js} +7 -2
  19. package/dist/cli/{index-5s1q6xcw.js → index-n8j0cnp1.js} +4 -4
  20. package/dist/cli/{index-b34vbxmx.js → index-nw9cn84t.js} +1 -1
  21. package/dist/cli/{index-cgqekdja.js → index-qh9466j3.js} +2 -2
  22. package/dist/cli/{index-ys04j1np.js → index-w58bmwyq.js} +2 -2
  23. package/dist/cli/{index-fx7bn93y.js → index-wpqypdge.js} +2 -2
  24. package/dist/cli/index.js +12 -12
  25. package/dist/cli/{knowledge-escalator-0060q7we.js → knowledge-escalator-f1m2xp5x.js} +3 -3
  26. package/dist/cli/{knowledge-events-yh2qwa6k.js → knowledge-events-rksgem6f.js} +1 -1
  27. package/dist/cli/{knowledge-store-geqaez58.js → knowledge-store-t6d6fr8b.js} +1 -1
  28. package/dist/cli/{knowledge-validator-4zq4vm7t.js → knowledge-validator-5ggzb3j1.js} +4 -4
  29. package/dist/cli/{scan-cursor-nk2rybhq.js → scan-cursor-18fnwr58.js} +2 -2
  30. package/dist/cli/{schema-th3tx32c.js → schema-jw15d8bt.js} +1 -1
  31. package/dist/cli/{skill-generator-1947bbkn.js → skill-generator-3n5y902z.js} +5 -5
  32. package/dist/config/schema.d.ts +11 -1
  33. package/dist/hooks/pr-workflow-gate.d.ts +5 -5
  34. package/dist/hooks/pr-workflow-response-gate.d.ts +32 -1
  35. package/dist/hooks/repo-graph-builder.d.ts +17 -11
  36. package/dist/hooks/repo-graph-injection.d.ts +20 -9
  37. package/dist/hooks/semantic-diff-injection.d.ts +2 -2
  38. package/dist/index.js +142 -141
  39. package/dist/tools/repo-graph/builder.d.ts +55 -1
  40. package/dist/tools/repo-graph/cache.d.ts +12 -36
  41. package/dist/tools/repo-graph/freshness.d.ts +54 -0
  42. package/dist/tools/repo-graph/incremental.d.ts +17 -8
  43. package/dist/tools/repo-graph/query.d.ts +7 -1
  44. package/dist/tools/repo-graph/storage.d.ts +3 -1
  45. package/dist/tools/repo-graph/types.d.ts +31 -1
  46. package/dist/tools/repo-graph.d.ts +5 -3
  47. package/dist/tools/repo-map.d.ts +8 -0
  48. package/dist/utils/path-security.d.ts +22 -0
  49. package/package.json +1 -1
@@ -6,13 +6,13 @@ import {
6
6
  resolveSwarmKnowledgePath,
7
7
  transactKnowledge,
8
8
  wordBigrams
9
- } from "./index-5s1q6xcw.js";
9
+ } from "./index-n8j0cnp1.js";
10
10
  import {
11
11
  countEntryContradictionsInWindow,
12
12
  countEntryViolationsInWindow,
13
13
  readKnowledgeEvents,
14
14
  recordKnowledgeEvent
15
- } from "./index-mysdsqtk.js";
15
+ } from "./index-9bk16zkv.js";
16
16
  import {
17
17
  init_knowledge_types,
18
18
  isActiveStatus
@@ -190,11 +190,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
190
190
  alreadyInactive: true
191
191
  };
192
192
  }
193
- const { quarantineEntry } = await import("./knowledge-validator-4zq4vm7t.js");
193
+ const { quarantineEntry } = await import("./knowledge-validator-5ggzb3j1.js");
194
194
  let policyConfig;
195
195
  try {
196
- const { KnowledgeConfigSchema } = await import("./schema-th3tx32c.js");
197
- const { loadPluginConfigWithMeta } = await import("./index-ys04j1np.js");
196
+ const { KnowledgeConfigSchema } = await import("./schema-jw15d8bt.js");
197
+ const { loadPluginConfigWithMeta } = await import("./index-w58bmwyq.js");
198
198
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
199
199
  policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
200
200
  } catch {
@@ -21,7 +21,7 @@ var package_default;
21
21
  var init_package = __esm(() => {
22
22
  package_default = {
23
23
  name: "opencode-swarm",
24
- version: "7.135.4",
24
+ version: "7.136.0",
25
25
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
26
26
  main: "dist/index.js",
27
27
  types: "dist/index.d.ts",
@@ -777,6 +777,11 @@ var init_schema = __esm(() => {
777
777
  agent_profiles: exports_external.record(exports_external.string(), exports_external.string()).default({})
778
778
  });
779
779
  RepoGraphConfigSchema = exports_external.object({
780
+ enabled: exports_external.boolean().default(true),
781
+ init_refresh: exports_external.boolean().default(true),
782
+ refresh_cap: exports_external.number().int().min(0).max(500).default(50),
783
+ walk_budget_ms: exports_external.number().int().min(1000).max(60000).default(5000),
784
+ max_files: exports_external.number().int().min(100).max(1e5).default(1e4),
780
785
  exclude_dirs: exports_external.array(exports_external.string().trim().min(1)).default([])
781
786
  });
782
787
  FORBIDDEN_CHECKPOINT_CONFIG_KEYS = new Set([
@@ -1534,7 +1539,7 @@ var init_schema = __esm(() => {
1534
1539
  authority: AuthorityConfigSchema.optional(),
1535
1540
  plan_cursor: PlanCursorConfigSchema.optional(),
1536
1541
  context_map: ContextMapConfigSchema.optional(),
1537
- repo_graph: RepoGraphConfigSchema.optional(),
1542
+ repo_graph: RepoGraphConfigSchema.prefault({}),
1538
1543
  evidence: EvidenceConfigSchema.optional(),
1539
1544
  summaries: SummaryConfigSchema.optional(),
1540
1545
  review_passes: ReviewPassesConfigSchema.optional(),
@@ -702,7 +702,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
702
702
  const recovered = touched.filter((e) => e.confidence > CONFIDENCE_FLOOR + FLOOR_EPSILON && e.confidence_floor_demoted);
703
703
  if (atFloor.length === 0 && recovered.length === 0)
704
704
  return;
705
- const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-yh2qwa6k.js");
705
+ const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-rksgem6f.js");
706
706
  const rollups = await readKnowledgeCounterRollups(directory);
707
707
  const flagIds = new Set;
708
708
  for (const e of atFloor) {
@@ -769,11 +769,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
769
769
  });
770
770
  }
771
771
  if (action === "quarantine" && toQuarantine.length > 0) {
772
- const { quarantineEntry } = await import("./knowledge-validator-4zq4vm7t.js");
773
- const { KnowledgeConfigSchema } = await import("./schema-th3tx32c.js");
772
+ const { quarantineEntry } = await import("./knowledge-validator-5ggzb3j1.js");
773
+ const { KnowledgeConfigSchema } = await import("./schema-jw15d8bt.js");
774
774
  let config;
775
775
  try {
776
- const { loadPluginConfigWithMeta } = await import("./index-ys04j1np.js");
776
+ const { loadPluginConfigWithMeta } = await import("./index-w58bmwyq.js");
777
777
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
778
778
  config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
779
779
  } catch {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  init_schema,
4
4
  stripKnownSwarmPrefix
5
- } from "./index-cg413zhk.js";
5
+ } from "./index-m1hew17b.js";
6
6
  import {
7
7
  init_constants
8
8
  } from "./index-3jcyn8g6.js";
@@ -12,14 +12,14 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-66w4jjg6.js";
15
+ } from "./index-81dkzncr.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
19
19
  isInDeclaredScope,
20
20
  redactPath,
21
21
  redactShellCommand
22
- } from "./index-b34vbxmx.js";
22
+ } from "./index-nw9cn84t.js";
23
23
 
24
24
  // src/services/guardrail-explain-service.ts
25
25
  import path from "path";
@@ -7,7 +7,7 @@ import {
7
7
  loadPluginConfigWithMeta,
8
8
  loadPluginConfigWithMetaAsync,
9
9
  resolveWorktreeIsolationConfig
10
- } from "./index-ajehqzvn.js";
10
+ } from "./index-bbejqagj.js";
11
11
  import {
12
12
  ApprovalEvidenceSchema,
13
13
  BaseEvidenceSchema,
@@ -54,7 +54,7 @@ import {
54
54
  TurboConfigSchema,
55
55
  WorktreeIsolationConfigSchema,
56
56
  resolveAutoReviewConfig
57
- } from "./index-cg413zhk.js";
57
+ } from "./index-m1hew17b.js";
58
58
  import"./index-bk5tah7q.js";
59
59
  import {
60
60
  MigrationStatusSchema,
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  authorizeCuration
4
- } from "./index-jsp8r6f9.js";
4
+ } from "./index-2w4tsmva.js";
5
5
  import {
6
6
  findNearDuplicate,
7
7
  inferTags,
@@ -9,7 +9,7 @@ import {
9
9
  resolveSwarmKnowledgePath,
10
10
  resolveSwarmRejectedPath,
11
11
  transactKnowledge
12
- } from "./index-5s1q6xcw.js";
12
+ } from "./index-n8j0cnp1.js";
13
13
  import {
14
14
  resolveKnowledgeStoreDir
15
15
  } from "./index-dzyjb33e.js";
package/dist/cli/index.js CHANGED
@@ -6,36 +6,36 @@ import {
6
6
  getPluginConfigDir,
7
7
  getPluginLockFilePaths,
8
8
  resolveCommand
9
- } from "./index-66w4jjg6.js";
9
+ } from "./index-81dkzncr.js";
10
10
  import"./index-vm4xw9z3.js";
11
- import"./index-b34vbxmx.js";
12
- import"./index-ck9rx6j1.js";
11
+ import"./index-nw9cn84t.js";
12
+ import"./index-cfz5750k.js";
13
13
  import"./index-cggqh2dz.js";
14
14
  import"./index-4905hd2m.js";
15
15
  import"./index-134d35c1.js";
16
- import"./index-g86vfxnk.js";
17
- import"./index-tegdwx34.js";
18
- import"./index-vh39nxpx.js";
16
+ import"./index-bwfzq91q.js";
17
+ import"./index-j08trvny.js";
18
+ import"./index-1kjg590p.js";
19
19
  import"./index-6mjf4vr1.js";
20
20
  import"./index-c8s9a3zh.js";
21
21
  import"./index-9ss2m4rs.js";
22
22
  import"./index-y6a7gjtj.js";
23
23
  import"./index-mrtms113.js";
24
- import"./index-fx7bn93y.js";
25
- import"./index-jsp8r6f9.js";
24
+ import"./index-wpqypdge.js";
25
+ import"./index-2w4tsmva.js";
26
26
  import"./index-rtry5xyf.js";
27
- import"./index-5s1q6xcw.js";
28
- import"./index-mysdsqtk.js";
27
+ import"./index-n8j0cnp1.js";
28
+ import"./index-9bk16zkv.js";
29
29
  import"./index-ae75rja9.js";
30
30
  import"./index-dzyjb33e.js";
31
31
  import"./index-ey29aap6.js";
32
- import"./index-ajehqzvn.js";
32
+ import"./index-bbejqagj.js";
33
33
  import"./index-k5jrywpr.js";
34
34
  import"./index-n832052r.js";
35
35
  import {
36
36
  init_package,
37
37
  package_default
38
- } from "./index-cg413zhk.js";
38
+ } from "./index-m1hew17b.js";
39
39
  import"./index-bk5tah7q.js";
40
40
  import"./index-8fwhhayc.js";
41
41
  import"./index-q1exe2b3.js";
@@ -8,9 +8,9 @@ import {
8
8
  maybeEscalateOnViolation,
9
9
  maybeQuarantineOnContradiction,
10
10
  readRecentEscalations
11
- } from "./index-tegdwx34.js";
12
- import"./index-5s1q6xcw.js";
13
- import"./index-mysdsqtk.js";
11
+ } from "./index-j08trvny.js";
12
+ import"./index-n8j0cnp1.js";
13
+ import"./index-9bk16zkv.js";
14
14
  import"./index-ae75rja9.js";
15
15
  import"./index-dzyjb33e.js";
16
16
  import"./index-ey29aap6.js";
@@ -28,7 +28,7 @@ import {
28
28
  resolveKnowledgeCounterBaselinePath,
29
29
  resolveKnowledgeEventsPath,
30
30
  resolveLegacyApplicationLogPath
31
- } from "./index-mysdsqtk.js";
31
+ } from "./index-9bk16zkv.js";
32
32
  import"./index-ae75rja9.js";
33
33
  import"./index-dzyjb33e.js";
34
34
  import"./index-ey29aap6.js";
@@ -41,7 +41,7 @@ import {
41
41
  transactKnowledge,
42
42
  transactKnowledgeWithCas,
43
43
  wordBigrams
44
- } from "./index-5s1q6xcw.js";
44
+ } from "./index-n8j0cnp1.js";
45
45
  import {
46
46
  resolveHiveDataDir
47
47
  } from "./index-ae75rja9.js";
@@ -23,11 +23,11 @@ import {
23
23
  validateLesson,
24
24
  validateSkillCandidatePath,
25
25
  validateSkillPath
26
- } from "./index-fx7bn93y.js";
27
- import"./index-jsp8r6f9.js";
26
+ } from "./index-wpqypdge.js";
27
+ import"./index-2w4tsmva.js";
28
28
  import"./index-rtry5xyf.js";
29
- import"./index-5s1q6xcw.js";
30
- import"./index-mysdsqtk.js";
29
+ import"./index-n8j0cnp1.js";
30
+ import"./index-9bk16zkv.js";
31
31
  import"./index-ae75rja9.js";
32
32
  import"./index-dzyjb33e.js";
33
33
  import"./index-ey29aap6.js";
@@ -4,8 +4,8 @@ import {
4
4
  alreadyCuratedThisGeneration,
5
5
  claimNextScanBatch,
6
6
  getScanStatus
7
- } from "./index-vh39nxpx.js";
8
- import"./index-5s1q6xcw.js";
7
+ } from "./index-1kjg590p.js";
8
+ import"./index-n8j0cnp1.js";
9
9
  import"./index-ae75rja9.js";
10
10
  import"./index-dzyjb33e.js";
11
11
  import"./index-ey29aap6.js";
@@ -93,7 +93,7 @@ import {
93
93
  resolveGeneratedAgentRole,
94
94
  resolveGuardrailsConfig,
95
95
  stripKnownSwarmPrefix
96
- } from "./index-cg413zhk.js";
96
+ } from "./index-m1hew17b.js";
97
97
  import"./index-bk5tah7q.js";
98
98
  import"./index-3jcyn8g6.js";
99
99
  import"./index-bpmtbmy9.js";
@@ -33,12 +33,12 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-g86vfxnk.js";
37
- import"./index-fx7bn93y.js";
38
- import"./index-jsp8r6f9.js";
36
+ } from "./index-bwfzq91q.js";
37
+ import"./index-wpqypdge.js";
38
+ import"./index-2w4tsmva.js";
39
39
  import"./index-rtry5xyf.js";
40
- import"./index-5s1q6xcw.js";
41
- import"./index-mysdsqtk.js";
40
+ import"./index-n8j0cnp1.js";
41
+ import"./index-9bk16zkv.js";
42
42
  import"./index-ae75rja9.js";
43
43
  import"./index-dzyjb33e.js";
44
44
  import"./index-ey29aap6.js";
@@ -582,6 +582,11 @@ export declare const ContextMapConfigSchema: z.ZodObject<{
582
582
  }, z.core.$strip>;
583
583
  export type ContextMapConfig = z.infer<typeof ContextMapConfigSchema>;
584
584
  export declare const RepoGraphConfigSchema: z.ZodObject<{
585
+ enabled: z.ZodDefault<z.ZodBoolean>;
586
+ init_refresh: z.ZodDefault<z.ZodBoolean>;
587
+ refresh_cap: z.ZodDefault<z.ZodNumber>;
588
+ walk_budget_ms: z.ZodDefault<z.ZodNumber>;
589
+ max_files: z.ZodDefault<z.ZodNumber>;
585
590
  exclude_dirs: z.ZodDefault<z.ZodArray<z.ZodString>>;
586
591
  }, z.core.$strip>;
587
592
  export type RepoGraphConfig = z.infer<typeof RepoGraphConfigSchema>;
@@ -1928,7 +1933,12 @@ export declare const PluginConfigSchema: z.ZodObject<{
1928
1933
  invalidate_on_hash_change: z.ZodDefault<z.ZodBoolean>;
1929
1934
  agent_profiles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
1930
1935
  }, z.core.$strip>>;
1931
- repo_graph: z.ZodOptional<z.ZodObject<{
1936
+ repo_graph: z.ZodPrefault<z.ZodObject<{
1937
+ enabled: z.ZodDefault<z.ZodBoolean>;
1938
+ init_refresh: z.ZodDefault<z.ZodBoolean>;
1939
+ refresh_cap: z.ZodDefault<z.ZodNumber>;
1940
+ walk_budget_ms: z.ZodDefault<z.ZodNumber>;
1941
+ max_files: z.ZodDefault<z.ZodNumber>;
1932
1942
  exclude_dirs: z.ZodDefault<z.ZodArray<z.ZodString>>;
1933
1943
  }, z.core.$strip>>;
1934
1944
  evidence: z.ZodOptional<z.ZodObject<{
@@ -30,10 +30,10 @@ export type PrReviewDepthTier = 'S' | 'M' | 'L';
30
30
  * always dispatch more lanes than a tier's floor, never fewer.
31
31
  */
32
32
  export declare const PR_REVIEW_DEPTH_TIER_THRESHOLDS: {
33
- readonly smallMaxChangedLines: 50;
34
- readonly smallMaxChangedFiles: 3;
35
- readonly mediumMaxChangedLines: 500;
36
- readonly mediumMaxChangedFiles: 20;
33
+ readonly smallMaxChangedLines: 100;
34
+ readonly smallMaxChangedFiles: 5;
35
+ readonly mediumMaxChangedLines: 1500;
36
+ readonly mediumMaxChangedFiles: 50;
37
37
  };
38
38
  /**
39
39
  * Minimum initial base-wave lane counts per depth tier. Tier L preserves the
@@ -44,7 +44,7 @@ export declare const PR_REVIEW_BASE_LANE_FLOORS: Record<PrReviewDepthTier, numbe
44
44
  /**
45
45
  * Minimum lane counts for a FULL micro (risk-family) sweep per depth tier. These
46
46
  * mirror the base floors' tier *semantics* — not their numbers — scaled to the
47
- * eleven risk families: S does not bind (a tier-S PR of ≤50 lines/≤3 files may
47
+ * eleven risk families: S does not bind (a tier-S PR of ≤100 lines/≤5 files may
48
48
  * consolidate a full sweep into one lane, exactly as base tier S permits); M
49
49
  * requires at least half the families to get independent lanes (ceil(11/2) = 6,
50
50
  * the deliberate scale-up from base M's 3 = ceil(6/2)); L requires one lane per
@@ -1,5 +1,5 @@
1
1
  import { claimPrFeedbackMonitorEvents, readPrFeedbackMonitorQueue } from '../background/pr-feedback-event-queue.js';
2
- import { readPrWorkflowGateState } from './pr-workflow-gate.js';
2
+ import { type PrReviewDepthTier, readPrWorkflowGateState } from './pr-workflow-gate.js';
3
3
  export declare const _internals: {
4
4
  readPrWorkflowGateState: typeof readPrWorkflowGateState;
5
5
  claimPrFeedbackMonitorEvents: typeof claimPrFeedbackMonitorEvents;
@@ -54,6 +54,24 @@ export declare const DEFAULT_BANNER_COOLDOWN_MS = 20000;
54
54
  * suppresses one.
55
55
  */
56
56
  export declare const MAX_FALLBACK_BANNER_INJECTIONS_PER_SESSION = 20;
57
+ /**
58
+ * Per-tier default total-wake ceilings, derived proportionally from each
59
+ * depth tier's consolidation-floor workload (base lanes + micro lanes).
60
+ *
61
+ * DERIVATION:
62
+ * Tier workloads (base + micro): S = 1+1 = 2, M = 3+6 = 9, L = 6+11 = 17
63
+ * Headroom multiplier: 6 (chosen so that L >= 100 and scales uniformly)
64
+ * Ceilings: S = 2×6 = 12, M = 9×6 = 54, L = 17×6 = 102
65
+ *
66
+ * The tier-L ceiling (102) is comfortably above the observed ~40–55 healthy
67
+ * tier-L wake count, providing generous headroom for real reviews while still
68
+ * bounding pathological loops. Tier-S is tightest because small PRs have the
69
+ * least lane work; tier-M is proportionally in between.
70
+ *
71
+ * When `totalWakeCeiling` is provided to `createPrWorkflowResponseGate`,
72
+ * it overrides these defaults.
73
+ */
74
+ export declare const DEFAULT_TOTAL_WAKE_CEILINGS: Record<PrReviewDepthTier, number>;
57
75
  /**
58
76
  * Bounded FIFO map of tracked wake budgets. Invariant 8 (session/global
59
77
  * state): module-level state must have an explicit eviction strategy. Three
@@ -71,6 +89,13 @@ interface WakeBudget {
71
89
  lastWakeAt: number;
72
90
  lastSeenRevision?: number;
73
91
  suspended: boolean;
92
+ /** Total number of wake attempts across the session lifetime. Never reset by
93
+ * revision progress — only the consecutive counter resets on progress. */
94
+ totalWakes: number;
95
+ /** Discriminator for WHY the session was suspended: 'consecutive' means
96
+ * the consecutive-unproductive budget was exhausted; 'total' means the
97
+ * absolute per-session total-wake ceiling was reached. */
98
+ suspendedReason: 'consecutive' | 'total';
74
99
  }
75
100
  /**
76
101
  * Prevent an architect from masquerading a premature text output as a terminal
@@ -99,6 +124,12 @@ export declare function createPrWorkflowResponseGate(options: {
99
124
  maxConsecutiveUnproductiveWakes?: number;
100
125
  wakeCooldownMs?: number;
101
126
  bannerCooldownMs?: number;
127
+ /** Override the per-tier default total-wake ceilings. A single number
128
+ * applies uniformly to all tiers; a partial Record allows per-tier
129
+ * overrides with unspecified tiers falling back to the defaults.
130
+ * When omitted, the context-aware defaults (DEFAULT_TOTAL_WAKE_CEILINGS)
131
+ * apply. */
132
+ totalWakeCeiling?: number | Partial<Record<PrReviewDepthTier, number>>;
102
133
  }): {
103
134
  event: (input: {
104
135
  event: unknown;
@@ -15,7 +15,8 @@
15
15
  * exposes the init promise so `toolAfter` can serialize incremental
16
16
  * updates after the initial scan completes.
17
17
  */
18
- import { type RepoGraph } from '../tools/repo-graph';
18
+ import { type BuildWorkspaceGraphOptions, type RepoGraph } from '../tools/repo-graph';
19
+ import { type FreshnessOptions, type FreshnessProbe } from '../tools/repo-graph/freshness';
19
20
  import { safeRealpathSync } from '../tools/repo-graph/safe-realpath';
20
21
  export interface RepoGraphBuilderHook {
21
22
  init(): Promise<void>;
@@ -29,21 +30,28 @@ export interface RepoGraphBuilderHook {
29
30
  }): Promise<void>;
30
31
  }
31
32
  export interface RepoGraphDeps {
32
- buildWorkspaceGraph: (workspace: string, options?: {
33
- maxFileSizeBytes?: number;
34
- maxFiles?: number;
35
- walkBudgetMs?: number;
36
- followSymlinks?: boolean;
37
- excludeDirs?: readonly string[];
38
- }) => Promise<RepoGraph>;
33
+ buildWorkspaceGraph: (workspace: string, options?: BuildWorkspaceGraphOptions) => Promise<RepoGraph>;
39
34
  saveGraph: (workspace: string, graph: RepoGraph, options?: {
40
35
  createAtomic?: boolean;
41
36
  }) => Promise<void>;
42
37
  updateGraphForFiles: (workspace: string, files: string[], options?: {
43
38
  forceRebuild?: boolean;
39
+ buildOptions?: BuildWorkspaceGraphOptions;
44
40
  }) => Promise<RepoGraph>;
41
+ loadGraph: (workspace: string) => Promise<RepoGraph | null>;
42
+ probeFreshness: (workspace: string, options?: FreshnessOptions) => Promise<FreshnessProbe>;
43
+ writeFingerprint: (workspace: string, graph: RepoGraph, options?: FreshnessOptions) => Promise<boolean>;
44
+ isGraphWideInputPath: (filePath: string) => boolean;
45
45
  safeRealpathSync?: typeof safeRealpathSync;
46
46
  }
47
+ export interface RepoGraphBuilderOptions {
48
+ enabled?: boolean;
49
+ initRefresh?: boolean;
50
+ refreshCap?: number;
51
+ maxFiles?: number;
52
+ walkBudgetMs?: number;
53
+ excludeDirs?: readonly string[];
54
+ }
47
55
  /**
48
56
  * Rebase a realpath'd file onto the lexical workspace root so the incremental
49
57
  * update keys the same node the walk produced (issue #1985, defect A5). Exported
@@ -62,6 +70,4 @@ export interface RepoGraphDeps {
62
70
  * the realpath is preserved.
63
71
  */
64
72
  export declare function rebaseOntoWorkspace(realFilePath: string, realWorkspace: string, workspaceRoot: string): string;
65
- export declare function createRepoGraphBuilderHook(workspaceRoot: string, deps?: Partial<RepoGraphDeps>, options?: {
66
- excludeDirs?: readonly string[];
67
- }): RepoGraphBuilderHook;
73
+ export declare function createRepoGraphBuilderHook(workspaceRoot: string, deps?: Partial<RepoGraphDeps>, options?: RepoGraphBuilderOptions): RepoGraphBuilderHook;
@@ -11,18 +11,29 @@
11
11
  * the agent simply doesn't get the extra context. The graph is built
12
12
  * on-demand by the agent calling `repo_map` with action="build".
13
13
  *
14
- * Caching: the loaded graph is cached per-directory in module scope to
15
- * avoid re-reading the JSON on every system prompt construction. The
16
- * cache is bypassed if the file's mtime advances.
14
+ * Caching: the loaded graph is cached in a bounded per-directory LRU and
15
+ * invalidated when the graph artifact changes. Before returning it, the shared
16
+ * bounded workspace probe gates use of the graph. Uncertified graphs and
17
+ * complete drift above the configured refresh cap are suppressed;
18
+ * inconclusive probes remain usable as freshness-unknown, without mutation.
17
19
  */
18
- import { type RepoGraph } from '../tools/repo-graph';
20
+ import { type FreshnessOptions, probeFreshness, type RepoGraph } from '../tools/repo-graph';
21
+ export interface RepoGraphInjectionOptions extends FreshnessOptions {
22
+ enabled?: boolean;
23
+ refreshCap?: number;
24
+ }
25
+ export declare const _internals: {
26
+ probeFreshness: typeof probeFreshness;
27
+ cacheSize: () => number;
28
+ };
19
29
  /**
20
- * Load the repo graph for `directory`, using a per-directory cache that
21
- * invalidates on file mtime change. Returns null if no graph exists.
30
+ * Load the repo graph for `directory`, using a bounded per-directory cache that
31
+ * invalidates on file mtime/size change and a shared content-freshness gate.
32
+ * Returns null if no graph exists or its workspace alignment is unsafe.
22
33
  *
23
34
  * Exported only for tests; production callers use the buildXxxBlock helpers below.
24
35
  */
25
- export declare function getCachedGraph(directory: string): RepoGraph | null;
36
+ export declare function getCachedGraph(directory: string, options?: RepoGraphInjectionOptions): Promise<RepoGraph | null>;
26
37
  /** Test-only: clear the per-directory cache. */
27
38
  export declare function resetGraphInjectionCache(): void;
28
39
  /**
@@ -33,7 +44,7 @@ export declare function resetGraphInjectionCache(): void;
33
44
  * - No graph exists.
34
45
  * - The target isn't tracked in the graph (file too new, language unsupported).
35
46
  */
36
- export declare function buildCoderLocalizationBlock(directory: string, targetFile: string): string | null;
47
+ export declare function buildCoderLocalizationBlock(directory: string, targetFile: string, options?: RepoGraphInjectionOptions): Promise<string | null>;
37
48
  /**
38
49
  * Build a blast-radius block for a list of changed files. Used by the
39
50
  * reviewer agent to spot-check whether unseen consumers might break.
@@ -42,4 +53,4 @@ export declare function buildCoderLocalizationBlock(directory: string, targetFil
42
53
  * graph. The result is bounded to the top 8 dependents to stay within
43
54
  * the per-block context budget.
44
55
  */
45
- export declare function buildReviewerBlastRadiusBlock(directory: string, changedFiles: string[]): string | null;
56
+ export declare function buildReviewerBlastRadiusBlock(directory: string, changedFiles: string[], options?: RepoGraphInjectionOptions): Promise<string | null>;
@@ -13,7 +13,7 @@ import { computeASTDiff } from '../diff/ast-diff.js';
13
13
  import { classifyChanges } from '../diff/semantic-classifier.js';
14
14
  import { generateSummary, generateSummaryMarkdown } from '../diff/summary-generator.js';
15
15
  import { getImporters, normalizeGraphPath } from '../tools/repo-graph.js';
16
- import { getCachedGraph } from './repo-graph-injection.js';
16
+ import { getCachedGraph, type RepoGraphInjectionOptions } from './repo-graph-injection.js';
17
17
  export declare const _internals: {
18
18
  execFile: typeof child_process.execFile;
19
19
  realpathSync: typeof fs.realpathSync;
@@ -40,4 +40,4 @@ export declare const _internals: {
40
40
  *
41
41
  * Returns null if no changes are detected or on failure.
42
42
  */
43
- export declare function buildSemanticDiffBlock(directory: string, changedFiles: string[], maxFiles?: number): Promise<string | null>;
43
+ export declare function buildSemanticDiffBlock(directory: string, changedFiles: string[], maxFiles?: number, repoGraphOptions?: RepoGraphInjectionOptions): Promise<string | null>;