@xynogen/pix-models 0.1.0 → 0.1.2
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/README.md +31 -0
- package/package.json +1 -1
- package/src/extension.ts +2 -1
- package/src/once.ts +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# pix-models
|
|
2
|
+
|
|
3
|
+
Pi extension — enhanced `/models` picker with BenchLM ranks.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
Registers a `/models` slash command that replaces Pi's built-in `/model` selector with a richer TUI picker. Each row shows model name, provider, context window, cost per million tokens, and BenchLM rank/score when available. The list is sorted by BenchLM rank (best first), then alphabetically for unranked models. Fuzzy search filters the list as you type. Selecting a model switches the active model for the session. Model metadata is sourced from `~/.cache/pi/` via `pix-data`; BenchLM data is fetched and cached at startup. Requires `@xynogen/pix-data` as a dependency.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pi install npm:@xynogen/pix-models
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
> Also included in [`@xynogen/pix-core`](https://github.com/xynogen/pix-mono/tree/main/packages/pix-core):
|
|
16
|
+
>
|
|
17
|
+
> ```bash
|
|
18
|
+
> pi install npm:@xynogen/pix-core
|
|
19
|
+
> ```
|
|
20
|
+
|
|
21
|
+
## Full distro
|
|
22
|
+
|
|
23
|
+
To install the complete pix suite (all packages + Pi itself):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
curl -fsSL https://raw.githubusercontent.com/xynogen/pix-mono/main/scripts/install.sh | sh
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
MIT
|
package/package.json
CHANGED
package/src/extension.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import modelPickerExtension from "./models.ts";
|
|
3
|
+
import { once } from "./once.ts";
|
|
3
4
|
|
|
4
5
|
export default function (pi: ExtensionAPI): void {
|
|
5
|
-
modelPickerExtension(pi);
|
|
6
|
+
once("pix-models", () => modelPickerExtension(pi));
|
|
6
7
|
}
|
package/src/once.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idempotency guard for extension activation.
|
|
3
|
+
*
|
|
4
|
+
* pix-core (the meta-package) invokes this package's factory in addition to a
|
|
5
|
+
* possible direct install. Pi's loader uses jiti with `moduleCache: false`, so
|
|
6
|
+
* each load pass re-evaluates modules — a plain module-level flag would not be
|
|
7
|
+
* shared. The dedupe key therefore lives on `globalThis`, which persists for
|
|
8
|
+
* the lifetime of the process across all load passes.
|
|
9
|
+
*/
|
|
10
|
+
export function once(key: string, fn: () => void): void {
|
|
11
|
+
const g = globalThis as { __pixLoaded?: Set<string> };
|
|
12
|
+
const loaded = (g.__pixLoaded ??= new Set<string>());
|
|
13
|
+
if (loaded.has(key)) return;
|
|
14
|
+
loaded.add(key);
|
|
15
|
+
fn();
|
|
16
|
+
}
|