@ff-labs/pi-fff 0.10.1 → 0.10.2-nightly.1eb913e

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ff-labs/pi-fff",
3
3
  "public": true,
4
- "version": "0.10.1",
4
+ "version": "0.10.2-nightly.1eb913e",
5
5
  "description": "pi extension: FFF-powered fuzzy file and content search",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -40,8 +40,8 @@
40
40
  "typecheck": "tsc --noEmit"
41
41
  },
42
42
  "dependencies": {
43
- "@ff-labs/fff-bun": "*",
44
- "@ff-labs/fff-node": "*"
43
+ "@ff-labs/fff-bun": "0.10.2-nightly.1eb913e",
44
+ "@ff-labs/fff-node": "0.10.2-nightly.1eb913e"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@earendil-works/pi-coding-agent": "*",
@@ -14,8 +14,6 @@ interface AuxPicker {
14
14
  }
15
15
 
16
16
  export interface AuxOpts {
17
- frecencyDbPath?: string;
18
- historyDbPath?: string;
19
17
  enableFsRootScanning: boolean;
20
18
  }
21
19
 
@@ -69,10 +67,11 @@ export class AuxFinderPool {
69
67
  }
70
68
 
71
69
  const { FileFinder } = await loadSdk();
70
+ // LMDB env can only be opened once per process; the main finder already
71
+ // owns the frecency/history DBs. Aux finders are transient and run without
72
+ // persistent scoring — see issue #700.
72
73
  const result = FileFinder.create({
73
74
  basePath: maybeRoot,
74
- frecencyDbPath: this.opts.frecencyDbPath,
75
- historyDbPath: this.opts.historyDbPath,
76
75
  aiMode: true,
77
76
  enableHomeDirScanning: true,
78
77
  enableFsRootScanning: this.opts.enableFsRootScanning,
package/src/index.ts CHANGED
@@ -344,8 +344,6 @@ export default function fffExtension(pi: ExtensionAPI) {
344
344
  }
345
345
 
346
346
  let auxPool = new AuxFinderPool({
347
- frecencyDbPath,
348
- historyDbPath,
349
347
  enableFsRootScanning,
350
348
  });
351
349
 
@@ -724,7 +722,15 @@ export default function fffExtension(pi: ExtensionAPI) {
724
722
 
725
723
  // automatic fuzzy fallback allows to broad the queries and find different cases
726
724
  if (result.items.length === 0 && !params.cursor && mode !== "regex") {
727
- const fuzzy = picker.grep(pattern, {
725
+ // When the caller pinned a specific file (path has an extension), the
726
+ // fuzzy fallback broadens across the whole picker — the file may just
727
+ // be misnamed. For directory constraints (or no path), we keep the
728
+ // constrained query so the fallback does not leak matches from
729
+ // excluded / out-of-scope directories.
730
+ const lastSeg = params.path?.split(/[\\/]/).pop() ?? "";
731
+ const pathTargetsFile = /\.[a-zA-Z][a-zA-Z0-9]{0,9}$/.test(lastSeg);
732
+ const fuzzyQuery = pathTargetsFile ? pattern : query;
733
+ const fuzzy = picker.grep(fuzzyQuery, {
728
734
  mode: "fuzzy",
729
735
  smartCase,
730
736
  maxMatchesPerFile: Math.min(effectiveLimit, 50),