@orquentra/codebuddy 2.15.0 → 2.15.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 (82) hide show
  1. package/ARCHITECTURE.md +12 -7
  2. package/README.md +2 -2
  3. package/dist/{chunk-YMXFSHXT.js → chunk-3L5IR6OW.js} +2 -2
  4. package/dist/{chunk-YMXFSHXT.js.map → chunk-3L5IR6OW.js.map} +1 -1
  5. package/dist/{chunk-JJQDVGF7.js → chunk-3TZNQJTH.js} +3 -3
  6. package/dist/{chunk-4BSO3HST.js → chunk-4LMBZWIF.js} +48 -13
  7. package/dist/chunk-4LMBZWIF.js.map +1 -0
  8. package/dist/{chunk-WHKXUXHE.js → chunk-4TKKLQLH.js} +5 -5
  9. package/dist/chunk-4TKKLQLH.js.map +1 -0
  10. package/dist/{chunk-KQCP3ZYH.js → chunk-5ZLNHYJH.js} +31 -15
  11. package/dist/chunk-5ZLNHYJH.js.map +1 -0
  12. package/dist/{chunk-U7KDM62P.js → chunk-6KSSJJZO.js} +17 -9
  13. package/dist/chunk-6KSSJJZO.js.map +1 -0
  14. package/dist/{chunk-6YI2D5F5.js → chunk-7IXPARDM.js} +3 -3
  15. package/dist/{chunk-UTPC66MV.js → chunk-FEFOZ2ZW.js} +23 -4
  16. package/dist/chunk-FEFOZ2ZW.js.map +1 -0
  17. package/dist/{chunk-ITXE27SZ.js → chunk-FGJ2KPPN.js} +104 -22
  18. package/dist/chunk-FGJ2KPPN.js.map +1 -0
  19. package/dist/{chunk-D5E7SGI5.js → chunk-KGDRGA2L.js} +14 -14
  20. package/dist/{chunk-D5E7SGI5.js.map → chunk-KGDRGA2L.js.map} +1 -1
  21. package/dist/{chunk-UR3DF74I.js → chunk-LZTYPJ5I.js} +36 -18
  22. package/dist/chunk-LZTYPJ5I.js.map +1 -0
  23. package/dist/{chunk-UATJCD2T.js → chunk-R5E2YGLE.js} +14 -8
  24. package/dist/chunk-R5E2YGLE.js.map +1 -0
  25. package/dist/chunk-R5JRKMEP.js +55 -0
  26. package/dist/chunk-R5JRKMEP.js.map +1 -0
  27. package/dist/{chunk-RZ266NHE.js → chunk-SPQU2422.js} +5 -5
  28. package/dist/{chunk-RZ266NHE.js.map → chunk-SPQU2422.js.map} +1 -1
  29. package/dist/{chunk-BTTQWSDS.js → chunk-SXVH74NE.js} +36 -6
  30. package/dist/chunk-SXVH74NE.js.map +1 -0
  31. package/dist/{chunk-KYRM3HPP.js → chunk-TIMS3PB7.js} +3 -3
  32. package/dist/{chunk-M75SN4D4.js → chunk-Y4QQML24.js} +3 -3
  33. package/dist/{chunk-M75SN4D4.js.map → chunk-Y4QQML24.js.map} +1 -1
  34. package/dist/cli/index.js +4 -4
  35. package/dist/{config-TXQJCCVI.js → config-32X53LWY.js} +4 -4
  36. package/dist/{expand-KWYGNCKZ.js → expand-VFYOWNZS.js} +5 -5
  37. package/dist/{file-vectors-MKXTSGGH.js → file-vectors-UBOKGYXX.js} +4 -3
  38. package/dist/{index-facts-4MTEHKMN.js → index-facts-ZTUANWBF.js} +7 -7
  39. package/dist/index-pass-S6NC25P5.js +15 -0
  40. package/dist/index.js +9 -8
  41. package/dist/{install-E3JWINTN.js → install-ZTE3H7QM.js} +8 -7
  42. package/dist/{lean-MLTAFS5L.js → lean-5N6BOONS.js} +5 -4
  43. package/dist/{local-75DJECVR.js → local-5EYLEBEP.js} +4 -2
  44. package/dist/{local-llm-MECVJTVU.js → local-llm-ESMVP5LE.js} +4 -4
  45. package/dist/{main-RLMKQZW4.js → main-B3HZCGVE.js} +61 -50
  46. package/dist/main-B3HZCGVE.js.map +1 -0
  47. package/dist/{memory-PFFVMTCH.js → memory-CI7HIGHN.js} +5 -5
  48. package/dist/{operations-STR7S5UO.js → operations-MW52HIQ3.js} +4 -4
  49. package/dist/{rerank-XXKWDI5Q.js → rerank-O4S5BC45.js} +5 -5
  50. package/dist/{runtime-SWFWGTQ4.js → runtime-SZAWIXEB.js} +6 -5
  51. package/dist/{summaries-QXWFFDUZ.js → summaries-GCHZGIIA.js} +11 -8
  52. package/dist/{zvec-F73IBWO5.js → zvec-V34P24WF.js} +11 -6
  53. package/package.json +1 -1
  54. package/dist/chunk-4BSO3HST.js.map +0 -1
  55. package/dist/chunk-BTTQWSDS.js.map +0 -1
  56. package/dist/chunk-ITXE27SZ.js.map +0 -1
  57. package/dist/chunk-KQCP3ZYH.js.map +0 -1
  58. package/dist/chunk-U7KDM62P.js.map +0 -1
  59. package/dist/chunk-UATJCD2T.js.map +0 -1
  60. package/dist/chunk-UR3DF74I.js.map +0 -1
  61. package/dist/chunk-UTPC66MV.js.map +0 -1
  62. package/dist/chunk-WHKXUXHE.js.map +0 -1
  63. package/dist/index-pass-TBDUEZCB.js +0 -14
  64. package/dist/main-RLMKQZW4.js.map +0 -1
  65. /package/dist/{chunk-JJQDVGF7.js.map → chunk-3TZNQJTH.js.map} +0 -0
  66. /package/dist/{chunk-6YI2D5F5.js.map → chunk-7IXPARDM.js.map} +0 -0
  67. /package/dist/{chunk-KYRM3HPP.js.map → chunk-TIMS3PB7.js.map} +0 -0
  68. /package/dist/{config-TXQJCCVI.js.map → config-32X53LWY.js.map} +0 -0
  69. /package/dist/{expand-KWYGNCKZ.js.map → expand-VFYOWNZS.js.map} +0 -0
  70. /package/dist/{file-vectors-MKXTSGGH.js.map → file-vectors-UBOKGYXX.js.map} +0 -0
  71. /package/dist/{index-facts-4MTEHKMN.js.map → index-facts-ZTUANWBF.js.map} +0 -0
  72. /package/dist/{index-pass-TBDUEZCB.js.map → index-pass-S6NC25P5.js.map} +0 -0
  73. /package/dist/{install-E3JWINTN.js.map → install-ZTE3H7QM.js.map} +0 -0
  74. /package/dist/{lean-MLTAFS5L.js.map → lean-5N6BOONS.js.map} +0 -0
  75. /package/dist/{local-75DJECVR.js.map → local-5EYLEBEP.js.map} +0 -0
  76. /package/dist/{local-llm-MECVJTVU.js.map → local-llm-ESMVP5LE.js.map} +0 -0
  77. /package/dist/{memory-PFFVMTCH.js.map → memory-CI7HIGHN.js.map} +0 -0
  78. /package/dist/{operations-STR7S5UO.js.map → operations-MW52HIQ3.js.map} +0 -0
  79. /package/dist/{rerank-XXKWDI5Q.js.map → rerank-O4S5BC45.js.map} +0 -0
  80. /package/dist/{runtime-SWFWGTQ4.js.map → runtime-SZAWIXEB.js.map} +0 -0
  81. /package/dist/{summaries-QXWFFDUZ.js.map → summaries-GCHZGIIA.js.map} +0 -0
  82. /package/dist/{zvec-F73IBWO5.js.map → zvec-V34P24WF.js.map} +0 -0
@@ -3,12 +3,15 @@ import {
3
3
  extractSymbolTable,
4
4
  supportsSymbols
5
5
  } from "./chunk-Y7D7PUBE.js";
6
+ import {
7
+ withCardLock
8
+ } from "./chunk-R5JRKMEP.js";
6
9
  import {
7
10
  isCredentialPath
8
11
  } from "./chunk-AL6VBTNA.js";
9
12
  import {
10
13
  readConfigFile
11
- } from "./chunk-M75SN4D4.js";
14
+ } from "./chunk-Y4QQML24.js";
12
15
  import {
13
16
  assertNoSymlinkBetween,
14
17
  writeAtomic
@@ -1268,7 +1271,7 @@ async function withLlmSummaries(repositoryRoot, manifest) {
1268
1271
  const entries = Object.values(manifest.entries);
1269
1272
  try {
1270
1273
  if ((await readConfigFile(repositoryRoot)).llm?.enabled === false) return entries;
1271
- const { loadLlmSummaries, cardWords } = await import("./summaries-QXWFFDUZ.js");
1274
+ const { loadLlmSummaries, cardWords } = await import("./summaries-GCHZGIIA.js");
1272
1275
  const summaries = await loadLlmSummaries(repositoryRoot, manifest);
1273
1276
  if (summaries.size === 0) return entries;
1274
1277
  return entries.map((entry) => {
@@ -1288,7 +1291,7 @@ async function withExpansion(repositoryRoot, task, ranked, manifest, mapSource,
1288
1291
  if (ranked.paths.length > 0 && ranked.confidence !== "low") return null;
1289
1292
  if (identifierTokens(task).some((token) => CODE_IDENTIFIER.test(token))) return null;
1290
1293
  const deadlineAt = options.expansionDeadlineAt ?? Date.now() + EXPANSION_MS.pack;
1291
- const { expandTask } = await import("./expand-KWYGNCKZ.js");
1294
+ const { expandTask } = await import("./expand-VFYOWNZS.js");
1292
1295
  const expansion = await expandTask(repositoryRoot, task, deadlineAt - Date.now());
1293
1296
  if (!expansion) return null;
1294
1297
  const expanded = await rankTaskFiles(
@@ -1303,7 +1306,7 @@ async function withExpansion(repositoryRoot, task, ranked, manifest, mapSource,
1303
1306
  return { ...ranked, explain: [...ranked.explain, `${note}; still no match`] };
1304
1307
  return { ...expanded, explain: [...ranked.explain, note, ...expanded.explain] };
1305
1308
  }
1306
- var AGREEMENT = { topK: 5, chunkFloor: 0.8, cardFloor: 0.75 };
1309
+ var AGREEMENT = { topK: 5, chunkFloor: 0.82, cardFloor: 0.82 };
1307
1310
  function agreementVotes(path, signals, config = AGREEMENT) {
1308
1311
  const names = [];
1309
1312
  let scored = 0;
@@ -1336,6 +1339,9 @@ async function rankTaskFiles(repositoryRoot, task, manifest, mapSource, options)
1336
1339
  (token) => CODE_IDENTIFIER.test(token) && !ABBREVIATION.test(token)
1337
1340
  );
1338
1341
  if (identifiers.length > 0) {
1342
+ const evidence2 = new Map(
1343
+ scoreTaskPaths(entries, task).filter((entry) => entry.score > 0).map((entry) => [entry.path, entry.score])
1344
+ );
1339
1345
  const exact = entries.filter(
1340
1346
  (entry) => (wantsTests || !TEST_PATH.test(entry.path)) && countsAsSource(entry.path, task) && !EXCEPTION_MODULE.test(entry.path)
1341
1347
  ).map((entry) => ({
@@ -1348,11 +1354,10 @@ async function rankTaskFiles(repositoryRoot, task, manifest, mapSource, options)
1348
1354
  )
1349
1355
  )
1350
1356
  ).size
1351
- })).filter((entry) => entry.named > 0).sort((left, right) => right.named - left.named || left.path.localeCompare(right.path)).map((entry) => entry.path);
1357
+ })).filter((entry) => entry.named > 0).sort(
1358
+ (left, right) => right.named - left.named || (evidence2.get(right.path) ?? 0) - (evidence2.get(left.path) ?? 0) || left.path.localeCompare(right.path)
1359
+ ).map((entry) => entry.path);
1352
1360
  if (exact.length > 0) {
1353
- const evidence2 = new Map(
1354
- scoreTaskPaths(entries, task).filter((entry) => entry.score > 0).map((entry) => [entry.path, entry.score])
1355
- );
1356
1361
  const expansion2 = expandAlongImports(exact, await mapSource, evidence2, task, {
1357
1362
  allowGraphOnly: true
1358
1363
  });
@@ -1388,7 +1393,7 @@ async function rankTaskFiles(repositoryRoot, task, manifest, mapSource, options)
1388
1393
  reason: "semantic retrieval off",
1389
1394
  stale: 0,
1390
1395
  changed: 0
1391
- } : await import("./zvec-F73IBWO5.js").then(
1396
+ } : await import("./zvec-V34P24WF.js").then(
1392
1397
  ({ zvecCandidates }) => zvecCandidates(
1393
1398
  repositoryRoot,
1394
1399
  task,
@@ -1498,7 +1503,7 @@ async function rankTaskFiles(repositoryRoot, task, manifest, mapSource, options)
1498
1503
  `abstention: ${weakKeyword} weak keyword candidate(s) below the evidence floor (score < ${EVIDENCE_FLOOR.keywordScore}) dropped`
1499
1504
  );
1500
1505
  }
1501
- const vectors = reranked || !chunks ? null : cards ? fuseRankings([chunks, cards].map((ranking) => ranking.map((match) => match.path))) : chunks.map((match) => match.path);
1506
+ const vectors = reranked || !chunks ? null : cards ? fuseChunksAndCards(chunks, cards) : chunks.map((match) => match.path);
1502
1507
  if (vectors && vectors.length > 0) {
1503
1508
  const doc = wantsDocs ? ranked.filter((path) => DOC_PATH.test(path)).slice(0, 1) : [];
1504
1509
  ranked = [...doc, ...vectors].slice(0, TASK_FILES);
@@ -1544,7 +1549,8 @@ function confidenceOf(paths, input) {
1544
1549
  if (!input.denseAvailable) return "medium";
1545
1550
  let best = 0;
1546
1551
  for (const path of paths) {
1547
- const dense = input.votes.get(path)?.votes ?? 0;
1552
+ const vote = input.votes.get(path);
1553
+ const dense = vote && vote.scored > 0 ? vote.votes : 0;
1548
1554
  const lexical = input.strongKeyword.includes(path) ? 2 : input.keyword.includes(path) ? 1 : 0;
1549
1555
  best = Math.max(best, dense + lexical);
1550
1556
  }
@@ -1592,7 +1598,7 @@ var MIN_RERANK_MS = 200;
1592
1598
  async function llmRerank(input) {
1593
1599
  let config;
1594
1600
  try {
1595
- config = await (await import("./config-TXQJCCVI.js")).resolveLlmConfig(input.repositoryRoot);
1601
+ config = await (await import("./config-32X53LWY.js")).resolveLlmConfig(input.repositoryRoot);
1596
1602
  } catch {
1597
1603
  return null;
1598
1604
  }
@@ -1617,7 +1623,7 @@ async function llmRerank(input) {
1617
1623
  input.deadlineAt === void 0 ? config.timeoutMs : input.deadlineAt - Date.now()
1618
1624
  );
1619
1625
  if (deadlineMs < MIN_RERANK_MS) return skipped("no time left in the hook budget");
1620
- const { rerankCandidates } = await import("./rerank-XXKWDI5Q.js");
1626
+ const { rerankCandidates } = await import("./rerank-O4S5BC45.js");
1621
1627
  const result = await rerankCandidates(
1622
1628
  input.repositoryRoot,
1623
1629
  config,
@@ -1750,6 +1756,15 @@ function rankEvidenceCandidates(lexical, admittedKeywords, vector, partial) {
1750
1756
  const established = fuseRankings([lexical, vector]).filter((path) => admitted.has(path));
1751
1757
  return [.../* @__PURE__ */ new Set([...established, ...partial])];
1752
1758
  }
1759
+ function fuseChunksAndCards(chunks, cards, k = 60) {
1760
+ const chunkRank = new Map(chunks.map((match, index) => [match.path, index + 1]));
1761
+ const cardRank = new Map(cards.map((match, index) => [match.path, index + 1]));
1762
+ const rrf = (rank) => rank === void 0 ? 0 : 1 / (k + rank);
1763
+ return [.../* @__PURE__ */ new Set([...chunkRank.keys(), ...cardRank.keys()])].map((path) => {
1764
+ const chunk2 = chunkRank.get(path);
1765
+ return { path, score: rrf(chunk2) + rrf(cardRank.get(path) ?? chunk2) };
1766
+ }).sort((left, right) => right.score - left.score || left.path.localeCompare(right.path)).map((entry) => entry.path);
1767
+ }
1753
1768
  function fuseRankings(lists, k = 60) {
1754
1769
  const scores = /* @__PURE__ */ new Map();
1755
1770
  for (const list of lists) {
@@ -1779,7 +1794,7 @@ async function hasMatchedPassageEvidence(repositoryRoot, path, hits, terms, symb
1779
1794
  );
1780
1795
  });
1781
1796
  }
1782
- var TEST_PATH = /(^|\/)(__tests__|__fixtures__|fixtures?|test|tests)\/|\.(test|spec)\.[a-z]+$|(^|\/)(test_[^/]*|[^/]*_test|conftest)\.py$/;
1797
+ var TEST_PATH = /(^|\/)(__tests__|__fixtures__|fixtures?|test|tests|test_apps?|testdata)\/|\.(test|spec)\.[a-z]+$|(^|\/)(test_[^/]*|[^/]*_test|conftest)\.py$/;
1783
1798
  var CHANGELOG_PATH = new RegExp(
1784
1799
  [
1785
1800
  "(?:CHANGES|CHANGELOG|HISTORY|NEWS|RELEASES?|RELEASE[-_]?NOTES)(?:[._-][^/]*)?",
@@ -2033,7 +2048,7 @@ async function refreshFileVectors(repositoryRoot, manifest, deadlineAt, embed =
2033
2048
  }
2034
2049
  async function currentCardTexts(repositoryRoot, manifest) {
2035
2050
  try {
2036
- const { cardText, loadLlmSummaries } = await import("./summaries-QXWFFDUZ.js");
2051
+ const { cardText, loadLlmSummaries } = await import("./summaries-GCHZGIIA.js");
2037
2052
  const texts = /* @__PURE__ */ new Map();
2038
2053
  for (const [path, card] of await loadLlmSummaries(repositoryRoot, manifest)) {
2039
2054
  if (card.symptoms) texts.set(path, `${path}
@@ -2050,8 +2065,11 @@ function textHash(text) {
2050
2065
  async function syncFileVectors(repositoryRoot, budgetMs) {
2051
2066
  const started = Date.now();
2052
2067
  try {
2053
- const { manifest } = await loadFreshIndex(repositoryRoot);
2054
- return await refreshFileVectors(repositoryRoot, manifest, started + budgetMs);
2068
+ const locked = await withCardLock(repositoryRoot, async () => {
2069
+ const { manifest } = await loadFreshIndex(repositoryRoot);
2070
+ return refreshFileVectors(repositoryRoot, manifest, started + budgetMs);
2071
+ });
2072
+ return locked.ok ? locked.value : { embedded: 0, files: 0, pending: 0, lockedBy: locked.holder };
2055
2073
  } catch {
2056
2074
  return null;
2057
2075
  }
@@ -2159,4 +2177,4 @@ export {
2159
2177
  namedSegments,
2160
2178
  loadProjectArchitectureMap
2161
2179
  };
2162
- //# sourceMappingURL=chunk-UR3DF74I.js.map
2180
+ //# sourceMappingURL=chunk-LZTYPJ5I.js.map