@jopqior/pi-subagents-model-selector 1.0.0 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jopqior/pi-subagents-model-selector",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Pi extension that asks for model and thinking before every new pi-subagents run.",
5
5
  "type": "module",
6
6
  "imports": {
@@ -6,6 +6,7 @@
6
6
 
7
7
  import type { Api, Model } from "@earendil-works/pi-ai";
8
8
  import { modelsAreEqual } from "@earendil-works/pi-ai";
9
+ import { fuzzyFilter } from "@earendil-works/pi-tui";
9
10
  import type { SpawnSelection } from "@jopqior/pi-subagents";
10
11
  import { getModelSelectorSearchText } from "./model-search-text";
11
12
 
@@ -353,14 +354,9 @@ function filterModels(
353
354
  if (!query) {
354
355
  return models;
355
356
  }
356
- const tokens = query
357
- .trim()
358
- .split(/[\s/]+/)
359
- .filter((token) => token.length > 0);
360
- const filtered = models.filter((model) => {
361
- const text = modelHaystack(model, input).toLowerCase();
362
- return tokens.every((token) => text.includes(token.toLowerCase()));
363
- });
357
+ const filtered = fuzzyFilter([...models], query, (model) =>
358
+ modelHaystack(model, input),
359
+ );
364
360
  if (!isDefaultSearch(query)) {
365
361
  return filtered;
366
362
  }