brainbank 0.1.1-beta.1 → 0.1.2-beta.1

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.
@@ -646,6 +646,11 @@ function _truncateIfNeeded() {
646
646
  __name(_truncateIfNeeded, "_truncateIfNeeded");
647
647
 
648
648
  // src/search/context-builder.ts
649
+ var _debug = !!process.env.BRAINBANK_DEBUG;
650
+ function dbg(msg) {
651
+ if (_debug) console.error(msg);
652
+ }
653
+ __name(dbg, "dbg");
649
654
  var ContextBuilder = class {
650
655
  constructor(_search, _registry, _pruner, _embedding, _configFields = {}, _expander) {
651
656
  this._search = _search;
@@ -696,11 +701,15 @@ var ContextBuilder = class {
696
701
  const resolvedFields = this._resolveFields(options);
697
702
  let expanderNote;
698
703
  if (resolvedFields.expander === true && this._expander && results.length > 0) {
704
+ dbg(`[expander] Running expansion on ${results.length} results...`);
699
705
  const expansion = await this._expand(task, results);
706
+ dbg(`[expander] Expansion returned ${expansion.results.length} new chunks${expansion.note ? `, note: "${expansion.note}"` : ""}`);
700
707
  if (expansion.results.length > 0) {
701
708
  results = [...results, ...expansion.results];
702
709
  }
703
710
  expanderNote = expansion.note;
711
+ } else if (resolvedFields.expander === true && !this._expander) {
712
+ dbg(`[expander] Field enabled but no expander instance! Check config.json "expander" key.`);
704
713
  }
705
714
  const parts = [`# Context for: "${task}"
706
715
  `];
@@ -782,12 +791,17 @@ ${expanderNote}
782
791
  let resolver;
783
792
  for (const mod of this._registry.all) {
784
793
  if (!isExpandablePlugin(mod)) continue;
785
- manifest.push(...mod.buildManifest(excludeFilePaths, excludeIds));
794
+ manifest.push(...mod.buildManifest(excludeFilePaths, excludeIds, excludeFilePaths));
786
795
  if (!resolver) {
787
796
  resolver = /* @__PURE__ */ __name((ids) => mod.resolveChunks(ids), "resolver");
788
797
  }
789
798
  }
790
- if (manifest.length === 0 || !resolver) return { results: [] };
799
+ if (manifest.length === 0 || !resolver) {
800
+ dbg(`[expander] No manifest items (no ExpandablePlugin or all chunks excluded)`);
801
+ return { results: [] };
802
+ }
803
+ const priorityCount = manifest.filter((m) => m.priority).length;
804
+ dbg(`[expander] Manifest: ${manifest.length} chunks (${priorityCount} priority, ${manifest.length - priorityCount} other), excluding ${excludeFilePaths.length} files`);
791
805
  try {
792
806
  const expandResult = await this._expander.expand(task, excludeIds, manifest);
793
807
  if (expandResult.ids.length === 0) return { results: [], note: expandResult.note };
@@ -3246,4 +3260,4 @@ export {
3246
3260
  resetFactoryCache,
3247
3261
  createBrain
3248
3262
  };
3249
- //# sourceMappingURL=chunk-63GBCDS5.js.map
3263
+ //# sourceMappingURL=chunk-5KJQ6V7M.js.map