pi-delegation-policy 0.3.0 → 0.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 +6 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/delegate-panel.ts +23 -14
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ It supports Pi `0.84.1`. Restart Pi or run `/reload` after installation. To inst
|
|
|
41
41
|
|
|
42
42
|
`Alt+G` opens the same editor when the shortcut is available. There is no separate off shortcut; use `/delegate off` or choose `off` in the editor. Changes apply to the next agent run. An agent already running keeps the system prompt it started with.
|
|
43
43
|
|
|
44
|
-
The interactive editor requires Pi's TUI mode; quick `/delegate` arguments remain available in other modes. The editor is one bounded, keyboard-first panel. It shows the effective value and the built-in, global, and session value for each setting. Model fields
|
|
44
|
+
The interactive editor requires Pi's TUI mode; quick `/delegate` arguments remain available in other modes. The editor is one bounded, keyboard-first panel. It shows the effective value and the built-in, global, and session value for each setting. Model fields use the same compact presentation as Pi's `/model` selector: model ID first with `[provider]` at the end, live fuzzy search over provider, model ID, and display name, and at most ten visible model rows before scrolling. **Use global default** remains available while searching, and UI Design also offers **Disable for this session**.
|
|
45
45
|
|
|
46
46
|
Edits stay in a draft until **Apply changes** is selected or `A` is pressed. **Save effective configuration as defaults** updates the global file without applying the session draft. **Reset draft to off** remains local until Apply. Escape returns from a field editor; closing a modified draft requires explicit discard confirmation.
|
|
47
47
|
|
package/package.json
CHANGED
package/src/delegate-panel.ts
CHANGED
|
@@ -470,22 +470,29 @@ export class DelegatePanel implements Component, Focusable {
|
|
|
470
470
|
),
|
|
471
471
|
);
|
|
472
472
|
const dividerRows = budget > pinnedLines.length + 3 ? 1 : 0;
|
|
473
|
-
const
|
|
474
|
-
const
|
|
473
|
+
const selectedChoice = choices[mode.selected];
|
|
474
|
+
const selectedName =
|
|
475
|
+
selectedChoice?.kind === "model" && selectedChoice.description
|
|
476
|
+
? [` Model Name: ${selectedChoice.description}`]
|
|
477
|
+
: [];
|
|
478
|
+
const detailRows = selectedName.length > 0 && budget > pinnedLines.length + 6 ? 2 : 0;
|
|
479
|
+
const availableListRows = Math.max(
|
|
480
|
+
0,
|
|
481
|
+
budget - 2 - pinnedLines.length - dividerRows - detailRows,
|
|
482
|
+
);
|
|
483
|
+
const listBudget = Math.min(11, availableListRows);
|
|
475
484
|
const modelBlocks = models.map((choice, index) => {
|
|
476
485
|
const combinedIndex = index + pinnedCount;
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
}
|
|
483
|
-
return lines;
|
|
486
|
+
const provider = choice.kind === "model" ? choice.reference.provider : "";
|
|
487
|
+
const label = provider
|
|
488
|
+
? `${choice.label} ${this.theme.fg("muted", `[${provider}]`)}`
|
|
489
|
+
: choice.label;
|
|
490
|
+
return [selectedLine(this.theme, label, width, mode.selected === combinedIndex)];
|
|
484
491
|
});
|
|
485
492
|
const modelSelected = Math.max(0, mode.selected - pinnedCount);
|
|
486
493
|
const modelLines =
|
|
487
494
|
listBudget > 0 && modelBlocks.length > 0
|
|
488
|
-
? this.renderBlockViewport(modelBlocks, modelSelected, width, listBudget)
|
|
495
|
+
? this.renderBlockViewport(modelBlocks, modelSelected, width, listBudget, 10)
|
|
489
496
|
: [];
|
|
490
497
|
if (models.length === 0 && modelLines.length < listBudget) {
|
|
491
498
|
modelLines.push(
|
|
@@ -505,6 +512,7 @@ export class DelegatePanel implements Component, Focusable {
|
|
|
505
512
|
...pinnedLines,
|
|
506
513
|
...(dividerRows ? [this.theme.fg("borderMuted", "─".repeat(width))] : []),
|
|
507
514
|
...modelLines,
|
|
515
|
+
...(detailRows ? ["", ...selectedName.map((line) => this.theme.fg("muted", line))] : []),
|
|
508
516
|
].slice(0, budget);
|
|
509
517
|
}
|
|
510
518
|
|
|
@@ -523,10 +531,11 @@ export class DelegatePanel implements Component, Focusable {
|
|
|
523
531
|
selected: number,
|
|
524
532
|
width: number,
|
|
525
533
|
budget: number,
|
|
534
|
+
maxVisibleBlocks = Number.POSITIVE_INFINITY,
|
|
526
535
|
): string[] {
|
|
527
536
|
const totalRows = blocks.reduce((sum, block) => sum + block.length, 0);
|
|
528
|
-
const reserveIndicator = totalRows > budget ? 1 : 0;
|
|
529
|
-
const contentBudget = Math.max(1, budget - reserveIndicator);
|
|
537
|
+
const reserveIndicator = totalRows > budget || blocks.length > maxVisibleBlocks ? 1 : 0;
|
|
538
|
+
const contentBudget = Math.max(1, Math.min(budget - reserveIndicator, maxVisibleBlocks));
|
|
530
539
|
const [start, end] = visibleBlockRange(blocks, selected, contentBudget);
|
|
531
540
|
const lines = blocks
|
|
532
541
|
.slice(start, end)
|
|
@@ -672,7 +681,7 @@ export class DelegatePanel implements Component, Focusable {
|
|
|
672
681
|
}
|
|
673
682
|
const filtered = query
|
|
674
683
|
? fuzzyFilter(this.candidates, query, (model) =>
|
|
675
|
-
`${model.provider}/${model.id} ${model.name ?? ""}`.trim(),
|
|
684
|
+
`${model.provider} ${model.provider}/${model.id} ${model.provider} ${model.id} ${model.name ?? ""}`.trim(),
|
|
676
685
|
)
|
|
677
686
|
: this.candidates;
|
|
678
687
|
return [
|
|
@@ -680,7 +689,7 @@ export class DelegatePanel implements Component, Focusable {
|
|
|
680
689
|
...filtered.map<ModelChoice>((model) => ({
|
|
681
690
|
kind: "model",
|
|
682
691
|
key: modelKey({ provider: model.provider, model: model.id }),
|
|
683
|
-
label:
|
|
692
|
+
label: model.id,
|
|
684
693
|
...(model.name && model.name !== model.id ? { description: model.name } : {}),
|
|
685
694
|
reference: { provider: model.provider, model: model.id },
|
|
686
695
|
})),
|