nexus-agents 2.89.1 → 2.90.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 (104) hide show
  1. package/dist/{child-mcp-config-AT2L3EAS.js → child-mcp-config-WUHKXBWX.js} +2 -2
  2. package/dist/{chunk-JHU27PB2.js → chunk-2SMTCNXP.js} +2 -2
  3. package/dist/{chunk-O5F6QAIG.js → chunk-3FVSYMHK.js} +2 -2
  4. package/dist/{chunk-SRTQUTCB.js → chunk-3HTUYAKS.js} +2 -2
  5. package/dist/{chunk-LENO7TKE.js → chunk-3LKW4IEW.js} +3 -3
  6. package/dist/{chunk-DAWLXCLF.js → chunk-3NNVITJF.js} +5 -5
  7. package/dist/{chunk-W7YR5SGV.js → chunk-4GOT42ZA.js} +3 -3
  8. package/dist/{chunk-7QTWFRHH.js → chunk-4N54BTZU.js} +9 -9
  9. package/dist/{chunk-F5GVZBSH.js → chunk-52ACUN6T.js} +4 -4
  10. package/dist/{chunk-WF2YOYY7.js → chunk-57HMLBYN.js} +2 -2
  11. package/dist/{chunk-PS7WKRJN.js → chunk-6Q33PBXC.js} +2 -2
  12. package/dist/{chunk-SI7ZBCGU.js → chunk-7QXEK3O6.js} +56 -6
  13. package/dist/{chunk-SI7ZBCGU.js.map → chunk-7QXEK3O6.js.map} +1 -1
  14. package/dist/{chunk-LZECDSJY.js → chunk-AQTHLUCP.js} +2 -2
  15. package/dist/{chunk-KR6UR263.js → chunk-CGSVTROC.js} +2 -2
  16. package/dist/{chunk-3MYPFPYL.js → chunk-E6W4Z6GN.js} +3 -3
  17. package/dist/{chunk-QCZEC7H4.js → chunk-EAT4GTMT.js} +2 -2
  18. package/dist/{chunk-XV7V3B35.js → chunk-EFHZHCF2.js} +2 -2
  19. package/dist/{chunk-RAUA6B2M.js → chunk-EUR32RSL.js} +27 -27
  20. package/dist/{chunk-MXHJMSYQ.js → chunk-IBRZK662.js} +7 -7
  21. package/dist/{chunk-AKO5H63G.js → chunk-JYIKPBXW.js} +2 -2
  22. package/dist/{chunk-O5OJNB4C.js → chunk-L3S7HOAS.js} +42 -29
  23. package/dist/chunk-L3S7HOAS.js.map +1 -0
  24. package/dist/{chunk-WWY6V4NK.js → chunk-PRGNJRID.js} +2 -2
  25. package/dist/{chunk-EUMVRLJL.js → chunk-S6FXRXYE.js} +7 -7
  26. package/dist/{chunk-MHPOJAPZ.js → chunk-SFZESA5O.js} +2 -2
  27. package/dist/{chunk-GRTSPRIJ.js → chunk-TWAH7VM2.js} +3 -3
  28. package/dist/{chunk-MVGFF4OY.js → chunk-W5I6L4UT.js} +7 -3
  29. package/dist/{chunk-MVGFF4OY.js.map → chunk-W5I6L4UT.js.map} +1 -1
  30. package/dist/{chunk-MKKQ3CQJ.js → chunk-X5BQF6HM.js} +4 -4
  31. package/dist/{chunk-TSHCHZ7R.js → chunk-Y7E5ZWRQ.js} +2 -2
  32. package/dist/{chunk-UISGEXHO.js → chunk-YEQE7WLP.js} +2 -2
  33. package/dist/{cli-circuit-breaker-4EBP4C4R.js → cli-circuit-breaker-4SWB6DEB.js} +4 -4
  34. package/dist/cli.js +33 -33
  35. package/dist/{composite-router-INIE4UYA.js → composite-router-NLVKSTA2.js} +2 -2
  36. package/dist/{consensus-vote-5NIBODVH.js → consensus-vote-B6W7YQ6K.js} +12 -12
  37. package/dist/{context-retriever-OBGV7Y2U.js → context-retriever-C4CNVKR5.js} +6 -6
  38. package/dist/{doctor-deep-F24MXACR.js → doctor-deep-QSVGAHAO.js} +3 -3
  39. package/dist/{expert-bridge-6KWMO2HT.js → expert-bridge-VIWFPPGZ.js} +4 -4
  40. package/dist/{factory-4RSAV4FC.js → factory-NNSXCD25.js} +5 -5
  41. package/dist/{factory-TA7GM2O2.js → factory-T3SEZUGW.js} +5 -5
  42. package/dist/index.d.ts +19 -4
  43. package/dist/index.js +31 -32
  44. package/dist/index.js.map +1 -1
  45. package/dist/{init-opencode-VQFYKCIT.js → init-opencode-WEKHD7YE.js} +5 -5
  46. package/dist/{issue-triage-U3PSWSCY.js → issue-triage-J2MUXK6R.js} +4 -4
  47. package/dist/{registry-command-2D4RMNUX.js → registry-command-VNFULRTL.js} +2 -2
  48. package/dist/{repo-security-plan-WOUJAXSZ.js → repo-security-plan-5MFY7GGQ.js} +3 -3
  49. package/dist/{research-helpers-synthesize-IDK2V5JN.js → research-helpers-synthesize-CNZ4C3FN.js} +3 -3
  50. package/dist/{routing-memory-XBYTU4KZ.js → routing-memory-PYO46COZ.js} +2 -2
  51. package/dist/{session-memory-FSLRKYIC.js → session-memory-HGCDSZ5R.js} +3 -3
  52. package/dist/{setup-command-IRBQGUWR.js → setup-command-Z7TRZUDI.js} +11 -11
  53. package/dist/{setup-config-7MK6PRX6.js → setup-config-QPS4K5QU.js} +3 -3
  54. package/dist/{setup-custom-api-W6FWQVAF.js → setup-custom-api-SP2ZAVGC.js} +4 -4
  55. package/dist/{tool-memory-VJZ233FE.js → tool-memory-SDPIAV2S.js} +5 -5
  56. package/dist/{weather-report-YLD3VXUC.js → weather-report-RWAMQHBL.js} +2 -2
  57. package/package.json +1 -1
  58. package/dist/chunk-O5OJNB4C.js.map +0 -1
  59. /package/dist/{child-mcp-config-AT2L3EAS.js.map → child-mcp-config-WUHKXBWX.js.map} +0 -0
  60. /package/dist/{chunk-JHU27PB2.js.map → chunk-2SMTCNXP.js.map} +0 -0
  61. /package/dist/{chunk-O5F6QAIG.js.map → chunk-3FVSYMHK.js.map} +0 -0
  62. /package/dist/{chunk-SRTQUTCB.js.map → chunk-3HTUYAKS.js.map} +0 -0
  63. /package/dist/{chunk-LENO7TKE.js.map → chunk-3LKW4IEW.js.map} +0 -0
  64. /package/dist/{chunk-DAWLXCLF.js.map → chunk-3NNVITJF.js.map} +0 -0
  65. /package/dist/{chunk-W7YR5SGV.js.map → chunk-4GOT42ZA.js.map} +0 -0
  66. /package/dist/{chunk-7QTWFRHH.js.map → chunk-4N54BTZU.js.map} +0 -0
  67. /package/dist/{chunk-F5GVZBSH.js.map → chunk-52ACUN6T.js.map} +0 -0
  68. /package/dist/{chunk-WF2YOYY7.js.map → chunk-57HMLBYN.js.map} +0 -0
  69. /package/dist/{chunk-PS7WKRJN.js.map → chunk-6Q33PBXC.js.map} +0 -0
  70. /package/dist/{chunk-LZECDSJY.js.map → chunk-AQTHLUCP.js.map} +0 -0
  71. /package/dist/{chunk-KR6UR263.js.map → chunk-CGSVTROC.js.map} +0 -0
  72. /package/dist/{chunk-3MYPFPYL.js.map → chunk-E6W4Z6GN.js.map} +0 -0
  73. /package/dist/{chunk-QCZEC7H4.js.map → chunk-EAT4GTMT.js.map} +0 -0
  74. /package/dist/{chunk-XV7V3B35.js.map → chunk-EFHZHCF2.js.map} +0 -0
  75. /package/dist/{chunk-RAUA6B2M.js.map → chunk-EUR32RSL.js.map} +0 -0
  76. /package/dist/{chunk-MXHJMSYQ.js.map → chunk-IBRZK662.js.map} +0 -0
  77. /package/dist/{chunk-AKO5H63G.js.map → chunk-JYIKPBXW.js.map} +0 -0
  78. /package/dist/{chunk-WWY6V4NK.js.map → chunk-PRGNJRID.js.map} +0 -0
  79. /package/dist/{chunk-EUMVRLJL.js.map → chunk-S6FXRXYE.js.map} +0 -0
  80. /package/dist/{chunk-MHPOJAPZ.js.map → chunk-SFZESA5O.js.map} +0 -0
  81. /package/dist/{chunk-GRTSPRIJ.js.map → chunk-TWAH7VM2.js.map} +0 -0
  82. /package/dist/{chunk-MKKQ3CQJ.js.map → chunk-X5BQF6HM.js.map} +0 -0
  83. /package/dist/{chunk-TSHCHZ7R.js.map → chunk-Y7E5ZWRQ.js.map} +0 -0
  84. /package/dist/{chunk-UISGEXHO.js.map → chunk-YEQE7WLP.js.map} +0 -0
  85. /package/dist/{cli-circuit-breaker-4EBP4C4R.js.map → cli-circuit-breaker-4SWB6DEB.js.map} +0 -0
  86. /package/dist/{composite-router-INIE4UYA.js.map → composite-router-NLVKSTA2.js.map} +0 -0
  87. /package/dist/{consensus-vote-5NIBODVH.js.map → consensus-vote-B6W7YQ6K.js.map} +0 -0
  88. /package/dist/{context-retriever-OBGV7Y2U.js.map → context-retriever-C4CNVKR5.js.map} +0 -0
  89. /package/dist/{doctor-deep-F24MXACR.js.map → doctor-deep-QSVGAHAO.js.map} +0 -0
  90. /package/dist/{expert-bridge-6KWMO2HT.js.map → expert-bridge-VIWFPPGZ.js.map} +0 -0
  91. /package/dist/{factory-4RSAV4FC.js.map → factory-NNSXCD25.js.map} +0 -0
  92. /package/dist/{factory-TA7GM2O2.js.map → factory-T3SEZUGW.js.map} +0 -0
  93. /package/dist/{init-opencode-VQFYKCIT.js.map → init-opencode-WEKHD7YE.js.map} +0 -0
  94. /package/dist/{issue-triage-U3PSWSCY.js.map → issue-triage-J2MUXK6R.js.map} +0 -0
  95. /package/dist/{registry-command-2D4RMNUX.js.map → registry-command-VNFULRTL.js.map} +0 -0
  96. /package/dist/{repo-security-plan-WOUJAXSZ.js.map → repo-security-plan-5MFY7GGQ.js.map} +0 -0
  97. /package/dist/{research-helpers-synthesize-IDK2V5JN.js.map → research-helpers-synthesize-CNZ4C3FN.js.map} +0 -0
  98. /package/dist/{routing-memory-XBYTU4KZ.js.map → routing-memory-PYO46COZ.js.map} +0 -0
  99. /package/dist/{session-memory-FSLRKYIC.js.map → session-memory-HGCDSZ5R.js.map} +0 -0
  100. /package/dist/{setup-command-IRBQGUWR.js.map → setup-command-Z7TRZUDI.js.map} +0 -0
  101. /package/dist/{setup-config-7MK6PRX6.js.map → setup-config-QPS4K5QU.js.map} +0 -0
  102. /package/dist/{setup-custom-api-W6FWQVAF.js.map → setup-custom-api-SP2ZAVGC.js.map} +0 -0
  103. /package/dist/{tool-memory-VJZ233FE.js.map → tool-memory-SDPIAV2S.js.map} +0 -0
  104. /package/dist/{weather-report-YLD3VXUC.js.map → weather-report-RWAMQHBL.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createLogger
3
- } from "./chunk-MVGFF4OY.js";
3
+ } from "./chunk-W5I6L4UT.js";
4
4
  import "./chunk-CH7QIDHQ.js";
5
5
  import "./chunk-PR4QN5HX.js";
6
6
 
@@ -59,4 +59,4 @@ export {
59
59
  generateMcpConfig,
60
60
  getDefaultAllowedTools
61
61
  };
62
- //# sourceMappingURL=child-mcp-config-AT2L3EAS.js.map
62
+ //# sourceMappingURL=child-mcp-config-WUHKXBWX.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getErrorMessage
3
- } from "./chunk-MVGFF4OY.js";
3
+ } from "./chunk-W5I6L4UT.js";
4
4
 
5
5
  // src/cli/setup-config.ts
6
6
  import { copyFileSync, existsSync, mkdirSync, writeFileSync } from "fs";
@@ -77,4 +77,4 @@ function ensureBackup(outputPath) {
77
77
  export {
78
78
  runConfigInitSync
79
79
  };
80
- //# sourceMappingURL=chunk-JHU27PB2.js.map
80
+ //# sourceMappingURL=chunk-2SMTCNXP.js.map
@@ -10,7 +10,7 @@ import {
10
10
  getTokenEstimator,
11
11
  isRateLimitLikeError,
12
12
  ok
13
- } from "./chunk-MVGFF4OY.js";
13
+ } from "./chunk-W5I6L4UT.js";
14
14
 
15
15
  // src/adapters/base-adapter.ts
16
16
  var AdapterModelError = class extends ModelError {
@@ -707,4 +707,4 @@ export {
707
707
  DEFAULT_COLLECT_STREAM_MAX_CHUNKS,
708
708
  collectStream
709
709
  };
710
- //# sourceMappingURL=chunk-O5F6QAIG.js.map
710
+ //# sourceMappingURL=chunk-3FVSYMHK.js.map
@@ -5,7 +5,7 @@ import {
5
5
  MCP_TIMEOUTS,
6
6
  TEST_TIMEOUTS,
7
7
  WORKFLOW_TIMEOUTS
8
- } from "./chunk-MVGFF4OY.js";
8
+ } from "./chunk-W5I6L4UT.js";
9
9
 
10
10
  // src/config/defaults-env.ts
11
11
  function parseIntEnv(envKey, fallback) {
@@ -348,4 +348,4 @@ export {
348
348
  CUSTOM_API_DEFAULT_MODEL,
349
349
  DEFAULTS
350
350
  };
351
- //# sourceMappingURL=chunk-SRTQUTCB.js.map
351
+ //# sourceMappingURL=chunk-3HTUYAKS.js.map
@@ -2,14 +2,14 @@ import {
2
2
  CircuitBreakerRegistry,
3
3
  CircuitError,
4
4
  mapCliErrorToCategory
5
- } from "./chunk-AKO5H63G.js";
5
+ } from "./chunk-JYIKPBXW.js";
6
6
  import {
7
7
  createLogger,
8
8
  err,
9
9
  getFallbackChainForCategory,
10
10
  getTimeProvider,
11
11
  ok
12
- } from "./chunk-MVGFF4OY.js";
12
+ } from "./chunk-W5I6L4UT.js";
13
13
 
14
14
  // src/cli-adapters/cli-circuit-breaker.ts
15
15
  var CATEGORY_TO_FALLBACK = {
@@ -152,4 +152,4 @@ export {
152
152
  CliCircuitBreakerIntegration,
153
153
  createCliCircuitBreakerIntegration
154
154
  };
155
- //# sourceMappingURL=chunk-LENO7TKE.js.map
155
+ //# sourceMappingURL=chunk-3LKW4IEW.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runConfigInitSync
3
- } from "./chunk-JHU27PB2.js";
3
+ } from "./chunk-2SMTCNXP.js";
4
4
  import {
5
5
  VERSION,
6
6
  checkApiKeys,
@@ -8,10 +8,10 @@ import {
8
8
  checkSqlite,
9
9
  defaultConfig,
10
10
  initDataDirectories
11
- } from "./chunk-MXHJMSYQ.js";
11
+ } from "./chunk-IBRZK662.js";
12
12
  import {
13
13
  probeAllClis
14
- } from "./chunk-MKKQ3CQJ.js";
14
+ } from "./chunk-X5BQF6HM.js";
15
15
  import {
16
16
  BUILT_IN_EXPERTS
17
17
  } from "./chunk-ZM4O442V.js";
@@ -25,7 +25,7 @@ import {
25
25
  getErrorMessage,
26
26
  getTimeProvider,
27
27
  symbols
28
- } from "./chunk-MVGFF4OY.js";
28
+ } from "./chunk-W5I6L4UT.js";
29
29
  import {
30
30
  ensureGitignored,
31
31
  findRepoRoot
@@ -1987,4 +1987,4 @@ export {
1987
1987
  setupCommand,
1988
1988
  setupCommandAsync
1989
1989
  };
1990
- //# sourceMappingURL=chunk-DAWLXCLF.js.map
1990
+ //# sourceMappingURL=chunk-3NNVITJF.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  getToolMemory
3
- } from "./chunk-SI7ZBCGU.js";
3
+ } from "./chunk-7QXEK3O6.js";
4
4
  import {
5
5
  CLI_NAMES,
6
6
  StrategyDistiller,
7
7
  createLogger,
8
8
  getOutcomeStore,
9
9
  registerPersistentDistillerFactory
10
- } from "./chunk-MVGFF4OY.js";
10
+ } from "./chunk-W5I6L4UT.js";
11
11
  import {
12
12
  ensureLearningDir,
13
13
  getRulesFile
@@ -273,4 +273,4 @@ export {
273
273
  inferTaskCategory,
274
274
  summarizeContextForPrompt
275
275
  };
276
- //# sourceMappingURL=chunk-W7YR5SGV.js.map
276
+ //# sourceMappingURL=chunk-4GOT42ZA.js.map
@@ -4,21 +4,21 @@ import {
4
4
  createStream,
5
5
  requireApiKey,
6
6
  validateApiKeyPresence
7
- } from "./chunk-O5F6QAIG.js";
7
+ } from "./chunk-3FVSYMHK.js";
8
8
  import {
9
9
  CUSTOM_API_BASE_URL_ENV,
10
10
  PROVIDER_ENV_KEYS,
11
11
  validateCustomApiBaseUrl
12
- } from "./chunk-TSHCHZ7R.js";
12
+ } from "./chunk-Y7E5ZWRQ.js";
13
13
  import {
14
14
  getToolMemory
15
- } from "./chunk-SI7ZBCGU.js";
15
+ } from "./chunk-7QXEK3O6.js";
16
16
  import {
17
17
  getDefaultAvailableModelsCache
18
- } from "./chunk-PS7WKRJN.js";
18
+ } from "./chunk-6Q33PBXC.js";
19
19
  import {
20
20
  CUSTOM_API_DEFAULT_MODEL
21
- } from "./chunk-SRTQUTCB.js";
21
+ } from "./chunk-3HTUYAKS.js";
22
22
  import {
23
23
  createCliAdapter,
24
24
  createCliDetectionCache,
@@ -27,7 +27,7 @@ import {
27
27
  isCliAvailable,
28
28
  sanitizeOutput,
29
29
  withTimeout
30
- } from "./chunk-MKKQ3CQJ.js";
30
+ } from "./chunk-X5BQF6HM.js";
31
31
  import {
32
32
  AgentError,
33
33
  CACHE_TIMEOUTS,
@@ -70,7 +70,7 @@ import {
70
70
  resolveCliAlias,
71
71
  resolveVoteTimeout,
72
72
  toRateLimitError
73
- } from "./chunk-MVGFF4OY.js";
73
+ } from "./chunk-W5I6L4UT.js";
74
74
  import {
75
75
  ensureLearningDir,
76
76
  getNexusDataDir,
@@ -9091,7 +9091,7 @@ async function processVotesWithCascade(engineVotes, opts) {
9091
9091
  var CONTRARIAN_ESCALATION_THRESHOLD = 0.8;
9092
9092
  async function runContrarianCheck(proposal, log) {
9093
9093
  try {
9094
- const { executeExpert } = await import("./expert-bridge-6KWMO2HT.js");
9094
+ const { executeExpert } = await import("./expert-bridge-VIWFPPGZ.js");
9095
9095
  const prompt = [
9096
9096
  "You are a contrarian analyst. Your job is to find reasons this proposal should be REJECTED.",
9097
9097
  "Look for: YAGNI (not needed), MISALIGNED (wrong tech/architecture), SECURITY_RISK, SCOPE_CREEP.",
@@ -9603,4 +9603,4 @@ export {
9603
9603
  CONSENSUS_VOTE_OUTPUT_SCHEMA,
9604
9604
  registerConsensusVoteTool
9605
9605
  };
9606
- //# sourceMappingURL=chunk-7QTWFRHH.js.map
9606
+ //# sourceMappingURL=chunk-4N54BTZU.js.map
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  resolveToken
3
- } from "./chunk-QCZEC7H4.js";
3
+ } from "./chunk-EAT4GTMT.js";
4
4
  import {
5
5
  GitHubProvider,
6
6
  ScmError
7
- } from "./chunk-XV7V3B35.js";
7
+ } from "./chunk-EFHZHCF2.js";
8
8
  import {
9
9
  err,
10
10
  ok
11
- } from "./chunk-MVGFF4OY.js";
11
+ } from "./chunk-W5I6L4UT.js";
12
12
 
13
13
  // src/scm/factory.ts
14
14
  async function createScmProvider(config) {
@@ -41,4 +41,4 @@ export {
41
41
  createScmProvider,
42
42
  createGitHubProvider
43
43
  };
44
- //# sourceMappingURL=chunk-F5GVZBSH.js.map
44
+ //# sourceMappingURL=chunk-52ACUN6T.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createLogger,
6
6
  getTimeProvider
7
- } from "./chunk-MVGFF4OY.js";
7
+ } from "./chunk-W5I6L4UT.js";
8
8
 
9
9
  // src/mcp/tools/scanner-registry-fetcher.ts
10
10
  import { z } from "zod";
@@ -721,4 +721,4 @@ export {
721
721
  generateSecurityPlan,
722
722
  buildPlanFromAnalysis
723
723
  };
724
- //# sourceMappingURL=chunk-WF2YOYY7.js.map
724
+ //# sourceMappingURL=chunk-57HMLBYN.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createLogger
3
- } from "./chunk-MVGFF4OY.js";
3
+ } from "./chunk-W5I6L4UT.js";
4
4
 
5
5
  // src/config/available-models-cache.ts
6
6
  var logger = createLogger({ component: "available-models-cache" });
@@ -150,4 +150,4 @@ export {
150
150
  getDefaultAvailableModelsCache,
151
151
  setDefaultAvailableModelsCache
152
152
  };
153
- //# sourceMappingURL=chunk-PS7WKRJN.js.map
153
+ //# sourceMappingURL=chunk-6Q33PBXC.js.map
@@ -5,13 +5,13 @@ import {
5
5
  } from "./chunk-6T3EPABN.js";
6
6
  import {
7
7
  generateId
8
- } from "./chunk-WWY6V4NK.js";
8
+ } from "./chunk-PRGNJRID.js";
9
9
  import {
10
10
  getMemoryRegistry
11
11
  } from "./chunk-PQHVC4BD.js";
12
12
  import {
13
13
  SessionMemory
14
- } from "./chunk-UISGEXHO.js";
14
+ } from "./chunk-YEQE7WLP.js";
15
15
  import {
16
16
  ErrorCode,
17
17
  NexusError,
@@ -24,7 +24,7 @@ import {
24
24
  getTimeProvider,
25
25
  ok,
26
26
  setSharedMobiMemDbPathResolver
27
- } from "./chunk-MVGFF4OY.js";
27
+ } from "./chunk-W5I6L4UT.js";
28
28
  import {
29
29
  nexusDataPath
30
30
  } from "./chunk-CH7QIDHQ.js";
@@ -1229,6 +1229,37 @@ var MemoryMarkdownHelper = class {
1229
1229
  this.logger.warn("Failed to delete Markdown file", { key, filepath, error });
1230
1230
  }
1231
1231
  }
1232
+ /**
1233
+ * Delete orphaned Markdown files whose key no longer exists in the store
1234
+ * (#3112). Markdown is only cleaned on the explicit `delete()` path; the
1235
+ * `prune` / `expireAll` / auto-expire paths delete SQLite rows without it,
1236
+ * so the directory grows unbounded. Reconcile by forward-mapping every live
1237
+ * key to its filename and removing any `.md` file not in that set (the
1238
+ * forward map is lossy, but a collision only keeps a file a live key still
1239
+ * needs). Best-effort — never throws. Returns the number of files removed.
1240
+ */
1241
+ reconcile(liveKeys) {
1242
+ let removed = 0;
1243
+ try {
1244
+ if (!fs.existsSync(this.markdownDir)) return 0;
1245
+ const expected = new Set(liveKeys.map((k) => this.keyToFilename(k)));
1246
+ for (const file of fs.readdirSync(this.markdownDir)) {
1247
+ if (!file.endsWith(".md") || expected.has(file)) continue;
1248
+ try {
1249
+ fs.unlinkSync(path.join(this.markdownDir, file));
1250
+ removed++;
1251
+ } catch (error) {
1252
+ this.logger.warn("Failed to delete orphaned Markdown file", { file, error });
1253
+ }
1254
+ }
1255
+ if (removed > 0) {
1256
+ this.logger.debug("Reconciled Markdown dir", { removed, live: liveKeys.length });
1257
+ }
1258
+ } catch (error) {
1259
+ this.logger.warn("Markdown reconcile failed", { error });
1260
+ }
1261
+ return removed;
1262
+ }
1232
1263
  /**
1233
1264
  * Convert a memory key to a safe filename.
1234
1265
  */
@@ -1565,11 +1596,30 @@ var HybridMemoryBackend = class {
1565
1596
  }
1566
1597
  prune(olderThan) {
1567
1598
  this.ensureInitialized();
1568
- return Promise.resolve(pruneOldEntries(this.getDatabase(), olderThan, this.logger));
1599
+ const result = pruneOldEntries(this.getDatabase(), olderThan, this.logger);
1600
+ if (result.ok && result.value > 0) this.reconcileMarkdown();
1601
+ return Promise.resolve(result);
1569
1602
  }
1570
1603
  expireAll() {
1571
1604
  this.ensureInitialized();
1572
- return Promise.resolve(expireAllEntries(this.getDatabase(), this.logger));
1605
+ const result = expireAllEntries(this.getDatabase(), this.logger);
1606
+ if (result.ok && result.value > 0) this.reconcileMarkdown();
1607
+ return Promise.resolve(result);
1608
+ }
1609
+ /**
1610
+ * Remove Markdown sidecars whose key no longer exists in SQLite (#3112).
1611
+ * Covers every row-deletion path (prune / expire / auto-expire) uniformly,
1612
+ * not just the explicit `delete()`. Best-effort.
1613
+ */
1614
+ reconcileMarkdown() {
1615
+ try {
1616
+ const rows = this.getDatabase().prepare("SELECT key FROM memories").all();
1617
+ this.markdown.reconcile(rows.map((r) => r.key));
1618
+ } catch (error) {
1619
+ this.logger.warn("Markdown reconcile query failed", {
1620
+ error: error instanceof Error ? error.message : String(error)
1621
+ });
1622
+ }
1573
1623
  }
1574
1624
  delete(key) {
1575
1625
  try {
@@ -5562,4 +5612,4 @@ export {
5562
5612
  reinitializeMemoryBackends,
5563
5613
  ToolMemoryManager
5564
5614
  };
5565
- //# sourceMappingURL=chunk-SI7ZBCGU.js.map
5615
+ //# sourceMappingURL=chunk-7QXEK3O6.js.map