@bismawy/pi-vision-watcher 1.2.0 → 1.3.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/CHANGELOG.md +20 -1
- package/README.md +3 -0
- package/package.json +1 -1
- package/src/describer.ts +92 -12
- package/src/index.ts +605 -583
- package/src/vision-model-selector.ts +31 -29
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* describes images during vision handoff.
|
|
4
4
|
*
|
|
5
5
|
* Uses the same patterns as pi's built-in selectors and pi-hide-providers:
|
|
6
|
-
* - Lists connected (authenticated)
|
|
6
|
+
* - Lists connected (authenticated) vision-capable models as bare `provider/id` refs
|
|
7
7
|
* - A leading "None" row clears the configured vision model
|
|
8
8
|
* - Space selects the highlighted model as the primary describer (toggle)
|
|
9
9
|
* - Tab toggles the highlighted model in/out of the failover chain (max 3)
|
|
10
10
|
* - Ctrl+Shift+R clears the failover chain, Shift+Tab walks the thinking ladder,
|
|
11
11
|
* Alt+A / Ctrl+Alt+A toggles async paste handoff, Alt+↑↓ reorders rows
|
|
12
12
|
* - Enter or Ctrl+S saves, Esc / Ctrl+C cancels
|
|
13
|
-
* - The primary is
|
|
13
|
+
* - The primary is the checked row [x], chain members ⇆ (providers style)
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import {
|
|
@@ -255,13 +255,9 @@ export class VisionModelSelectorComponent implements Component {
|
|
|
255
255
|
),
|
|
256
256
|
);
|
|
257
257
|
lines.push("");
|
|
258
|
-
//
|
|
259
|
-
//
|
|
260
|
-
lines.push(
|
|
261
|
-
...this.searchInput
|
|
262
|
-
.render(Math.max(1, width - 2))
|
|
263
|
-
.map((line) => ` ${line}`),
|
|
264
|
-
);
|
|
258
|
+
// Flush with the wall: boxRow already supplies the one-space pad, so the
|
|
259
|
+
// field carries no prefix of its own — same column as the providers input.
|
|
260
|
+
lines.push(...this.searchInput.render(Math.max(1, width)));
|
|
265
261
|
lines.push("");
|
|
266
262
|
lines.push(...this.listContainer.render(width));
|
|
267
263
|
lines.push("");
|
|
@@ -457,7 +453,9 @@ export class VisionModelSelectorComponent implements Component {
|
|
|
457
453
|
"[Esc] Cancel",
|
|
458
454
|
].join(" ");
|
|
459
455
|
|
|
460
|
-
|
|
456
|
+
// No prefix: boxRow's own pad is the one space, exactly like the providers
|
|
457
|
+
// legend row (`│ 34/44 picked · … │`).
|
|
458
|
+
return `${this.theme.fg("accent", count)}${this.theme.fg("dim", ` · ${legend}`)}`;
|
|
461
459
|
}
|
|
462
460
|
|
|
463
461
|
/** Move `ref` one row up/down in the display list. The None row is pinned at
|
|
@@ -536,7 +534,7 @@ export class VisionModelSelectorComponent implements Component {
|
|
|
536
534
|
|
|
537
535
|
if (this.filteredItems.length === 0) {
|
|
538
536
|
this.listContainer.addChild(
|
|
539
|
-
new Text(this.theme.fg("muted", "
|
|
537
|
+
new Text(this.theme.fg("muted", "No matching models"), 0, 0),
|
|
540
538
|
);
|
|
541
539
|
}
|
|
542
540
|
|
|
@@ -549,6 +547,14 @@ export class VisionModelSelectorComponent implements Component {
|
|
|
549
547
|
);
|
|
550
548
|
const endIndex = Math.min(startIndex + this.maxVisible, this.filteredItems.length);
|
|
551
549
|
|
|
550
|
+
// Hidden rows are announced like the providers list, never silently cut: the
|
|
551
|
+
// ↑ count sits above the window, the ↓ count below it.
|
|
552
|
+
if (startIndex > 0) {
|
|
553
|
+
this.listContainer.addChild(
|
|
554
|
+
new Text(this.theme.fg("dim", `↑ ${startIndex} more`), 0, 0),
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
|
|
552
558
|
for (let i = startIndex; i < endIndex; i++) {
|
|
553
559
|
const item = this.filteredItems[i];
|
|
554
560
|
if (!item) continue;
|
|
@@ -560,20 +566,19 @@ export class VisionModelSelectorComponent implements Component {
|
|
|
560
566
|
if (item.none) {
|
|
561
567
|
label = this.theme.fg("warning", item.modelName);
|
|
562
568
|
} else {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
label = `${labelled}${providerBadge}${badge}`;
|
|
569
|
+
// Providers style: the bare `provider/id` ref, no badges — unselected
|
|
570
|
+
// rows sit in muted, the selected row takes the soft tier in bold.
|
|
571
|
+
label = isSelected
|
|
572
|
+
? softPainter(this.theme, "accent", "accent")(this.theme.bold(item.ref!))
|
|
573
|
+
: this.theme.fg("muted", item.ref!);
|
|
569
574
|
}
|
|
570
575
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
// Fallback marker — distinct from the primary's
|
|
576
|
+
// Providers-style checkbox: the picked state is chrome, `[x]` accent / `[ ]`
|
|
577
|
+
// dim — it replaces the old ✓ marker so the primary reads like a checked row.
|
|
578
|
+
const marked = item.none ? this.currentRef === null : item.ref === this.currentRef;
|
|
579
|
+
const mark = marked ? this.theme.fg("accent", "[x] ") : this.theme.fg("dim", "[ ] ");
|
|
580
|
+
|
|
581
|
+
// Fallback marker — distinct from the primary's check so a model can visibly
|
|
577
582
|
// be both the primary and a fallback (Sonnet as primary, Gemini as the
|
|
578
583
|
// chain behind it).
|
|
579
584
|
const fallbackMark =
|
|
@@ -581,15 +586,12 @@ export class VisionModelSelectorComponent implements Component {
|
|
|
581
586
|
? this.theme.fg("warning", " ⇆")
|
|
582
587
|
: "";
|
|
583
588
|
|
|
584
|
-
this.listContainer.addChild(new Text(`${prefix}${
|
|
589
|
+
this.listContainer.addChild(new Text(`${prefix}${mark}${label}${fallbackMark}`, 0, 0));
|
|
585
590
|
}
|
|
586
591
|
|
|
587
|
-
if (
|
|
592
|
+
if (endIndex < this.filteredItems.length) {
|
|
588
593
|
this.listContainer.addChild(
|
|
589
|
-
new Text(
|
|
590
|
-
this.theme.fg("muted", ` (${this.selectedIndex + 1}/${this.filteredItems.length})`),
|
|
591
|
-
0, 0,
|
|
592
|
-
),
|
|
594
|
+
new Text(this.theme.fg("dim", `↓ ${this.filteredItems.length - endIndex} more`), 0, 0),
|
|
593
595
|
);
|
|
594
596
|
}
|
|
595
597
|
|