@xynogen/pix-models 0.1.23 → 0.1.26
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 +2 -2
- package/src/models.ts +25 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xynogen/pix-models",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"description": "Pi extension — enhanced /models picker with BenchLM ranks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@xynogen/pix-data": "^0.4.0",
|
|
42
42
|
"@xynogen/pix-pretty": "^1.7.9",
|
|
43
|
-
"@xynogen/pix-runtime": "^0.
|
|
43
|
+
"@xynogen/pix-runtime": "^0.4.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@earendil-works/pi-coding-agent": "*",
|
package/src/models.ts
CHANGED
|
@@ -102,8 +102,8 @@ export function normalizeModelText(s: string): string {
|
|
|
102
102
|
// ─── Thinking level control ──────────────────────────────────────────────────
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
|
-
* Canonical thinking levels, ascending.
|
|
106
|
-
*
|
|
105
|
+
* Canonical thinking levels, ascending. ←/→ in the picker steps through this list;
|
|
106
|
+
* pi.setThinkingLevel() clamps to what the active model actually supports,
|
|
107
107
|
* so visiting an unsupported rung is harmless (it lands on the nearest allowed).
|
|
108
108
|
*/
|
|
109
109
|
export const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"] as const;
|
|
@@ -277,7 +277,7 @@ async function showEnhancedPicker(pi: ExtensionAPI, ctx: ExtensionContext): Prom
|
|
|
277
277
|
// items built inside the custom() factory so we have theme access for colors
|
|
278
278
|
|
|
279
279
|
const result = await ctx.ui.custom<string | null>(
|
|
280
|
-
(tui, theme,
|
|
280
|
+
(tui, theme, _kb, done) => {
|
|
281
281
|
const accent = "accent";
|
|
282
282
|
|
|
283
283
|
// Find max rank width across all benchmarked rows for # padding
|
|
@@ -289,6 +289,9 @@ async function showEnhancedPicker(pi: ExtensionAPI, ctx: ExtensionContext): Prom
|
|
|
289
289
|
// Mute low-info parts (separators, padding, #, ☆) so the actual values pop.
|
|
290
290
|
const mute = (s: string) => theme.fg("muted", s);
|
|
291
291
|
const sep = mute(" · ");
|
|
292
|
+
const guide = (key: string, action: string) =>
|
|
293
|
+
theme.fg("text", key) + theme.fg("dim", ` ${action}`);
|
|
294
|
+
const guideSep = theme.fg("dim", " · ");
|
|
292
295
|
|
|
293
296
|
// Track rank per item value so fuzzy results can prioritize ranked models.
|
|
294
297
|
const rankByValue = new Map<string, number>();
|
|
@@ -417,7 +420,7 @@ async function showEnhancedPicker(pi: ExtensionAPI, ctx: ExtensionContext): Prom
|
|
|
417
420
|
internal.invalidate();
|
|
418
421
|
};
|
|
419
422
|
|
|
420
|
-
// Live thinking-level readout.
|
|
423
|
+
// Live thinking-level readout. ←/→ mutates the session immediately via
|
|
421
424
|
// pi.setThinkingLevel(); we mirror pi.getThinkingLevel() so the header
|
|
422
425
|
// reflects the clamped result (model may not support every rung).
|
|
423
426
|
//
|
|
@@ -435,7 +438,11 @@ async function showEnhancedPicker(pi: ExtensionAPI, ctx: ExtensionContext): Prom
|
|
|
435
438
|
? theme.getThinkingBorderColor(resolved)(label)
|
|
436
439
|
: theme.fg("dim", label);
|
|
437
440
|
return (
|
|
438
|
-
theme.fg("muted", "Thinking: ") +
|
|
441
|
+
theme.fg("muted", "Thinking: ") +
|
|
442
|
+
coloredLabel +
|
|
443
|
+
theme.fg("dim", " (") +
|
|
444
|
+
guide("←/→", "adjust") +
|
|
445
|
+
theme.fg("dim", ")")
|
|
439
446
|
);
|
|
440
447
|
};
|
|
441
448
|
|
|
@@ -451,8 +458,8 @@ async function showEnhancedPicker(pi: ExtensionAPI, ctx: ExtensionContext): Prom
|
|
|
451
458
|
theme.fg(accent, theme.bold(`${icon("picker.model")} Select model`)),
|
|
452
459
|
theme.fg("dim", "context · pricing · coding rank & score from modelgrep.com"),
|
|
453
460
|
thinkLine(),
|
|
454
|
-
theme.fg("muted", "Search:"),
|
|
455
461
|
...search.render(inner),
|
|
462
|
+
"",
|
|
456
463
|
],
|
|
457
464
|
body: list.render(inner),
|
|
458
465
|
selectedBodyRange: (() => {
|
|
@@ -463,10 +470,14 @@ async function showEnhancedPicker(pi: ExtensionAPI, ctx: ExtensionContext): Prom
|
|
|
463
470
|
});
|
|
464
471
|
})(),
|
|
465
472
|
footer: [
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
473
|
+
"",
|
|
474
|
+
guide("↑↓", "navigate") +
|
|
475
|
+
guideSep +
|
|
476
|
+
guide("←/→", "thinking") +
|
|
477
|
+
guideSep +
|
|
478
|
+
guide("enter", "select") +
|
|
479
|
+
guideSep +
|
|
480
|
+
guide("esc", "cancel"),
|
|
470
481
|
],
|
|
471
482
|
bodyOffset: pager.bodyOffset,
|
|
472
483
|
color: (s) => theme.fg(accent, s),
|
|
@@ -481,20 +492,15 @@ async function showEnhancedPicker(pi: ExtensionAPI, ctx: ExtensionContext): Prom
|
|
|
481
492
|
search.invalidate();
|
|
482
493
|
},
|
|
483
494
|
handleInput(data: string) {
|
|
484
|
-
if (pager.handleInput(data, kb, true)) {
|
|
485
|
-
tui.requestRender();
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
495
|
// Detect keys via pi-tui's own parser — the same recognition
|
|
489
496
|
// SelectList uses. Arrows arrive as named keys ("up"/"down"),
|
|
490
497
|
// not raw escape sequences, so string-equality checks fail.
|
|
491
498
|
const isNav = matchesKey(data, "up") || matchesKey(data, "down");
|
|
492
|
-
//
|
|
493
|
-
//
|
|
494
|
-
// to model capability, so unsupported rungs land on the nearest allowed.
|
|
499
|
+
// ←/→ tunes the ACTIVE session model's thinking level. setThinkingLevel
|
|
500
|
+
// clamps to model capability, so unsupported rungs land on the nearest allowed.
|
|
495
501
|
let dir: -1 | 1 | 0 = 0;
|
|
496
|
-
if (matchesKey(data, Key.
|
|
497
|
-
else if (matchesKey(data, Key.
|
|
502
|
+
if (matchesKey(data, Key.left)) dir = -1;
|
|
503
|
+
else if (matchesKey(data, Key.right)) dir = 1;
|
|
498
504
|
if (dir !== 0) {
|
|
499
505
|
const cur = pi.getThinkingLevel?.() || localLevel || "medium";
|
|
500
506
|
localLevel = stepEffectiveThinkingLevel(cur, dir, (candidate) => {
|