@d3ara1n/pi-editor-shell 0.6.0 → 0.7.0
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 +20 -1
- package/package.json +1 -1
- package/src/config.ts +17 -0
- package/src/index.ts +8 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Replaces pi's default editor and status bar with a unified rounded-corner shell
|
|
|
4
4
|
|
|
5
5
|
## What shows up where
|
|
6
6
|
|
|
7
|
-
- **Top border** — `
|
|
7
|
+
- **Top border** — ` model · thinking-level ` (left) + pinned extension statuses (right, via `pinnedStatus` config)
|
|
8
8
|
- **Bottom border** — ` ctx NN%/NNk|N.NM · ⚡ cacheRead (total) hitRate% ` (left) + ` ~/Projects (main +2 ~1) ` (right, shows git branch + dirty state when in a repo)
|
|
9
9
|
- **Below shell** — Auto-wrapping extension status line (all `setStatus` entries not pinned to the top)
|
|
10
10
|
- **Border color** follows pi's thinking-level / bash-mode indicator automatically.
|
|
@@ -38,6 +38,25 @@ In `~/.pi/agent/settings.json` under the `editorShell` key:
|
|
|
38
38
|
| `hitRate` | `` | fa-bullseye |
|
|
39
39
|
| `folder` | `` | fa-folder_open |
|
|
40
40
|
|
|
41
|
+
### Model display
|
|
42
|
+
|
|
43
|
+
How the model is labeled in the top-left border (`"name"` by default):
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"editorShell": {
|
|
48
|
+
"modelDisplay": "name"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
| Value | Example |
|
|
54
|
+
|-------|---------|
|
|
55
|
+
| `"name"` (default) | `Claude Opus 4.8 (Yanproxy)` |
|
|
56
|
+
| `"provider-id"` | `yanproxy/anthropic/claude-opus-4-8` |
|
|
57
|
+
|
|
58
|
+
`"name"` uses `model.name`; a model with no name falls back to its id, so the slot never goes blank.
|
|
59
|
+
|
|
41
60
|
## Commands
|
|
42
61
|
|
|
43
62
|
| Command | Description |
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -22,6 +22,9 @@ export interface EditorShellIcons {
|
|
|
22
22
|
folder: string;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/** How the model is shown in the top-left border slot. */
|
|
26
|
+
export type ModelDisplay = "name" | "provider-id";
|
|
27
|
+
|
|
25
28
|
export interface EditorShellConfig {
|
|
26
29
|
/**
|
|
27
30
|
* Status keys to pin to the shell's top-right corner.
|
|
@@ -34,6 +37,13 @@ export interface EditorShellConfig {
|
|
|
34
37
|
* for a Nerd Font glyph, or `"🤖"` for an emoji, etc.
|
|
35
38
|
*/
|
|
36
39
|
icons: Partial<EditorShellIcons>;
|
|
40
|
+
/**
|
|
41
|
+
* What to show as the model label in the top-left border.
|
|
42
|
+
* - `"name"` — `model.name` (friendlier; falls back to the id when a model
|
|
43
|
+
* has no name, so it never goes blank).
|
|
44
|
+
* - `"provider-id"` — `provider/id`.
|
|
45
|
+
*/
|
|
46
|
+
modelDisplay: ModelDisplay;
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
const ICON_KEYS: ReadonlyArray<keyof EditorShellIcons> = [
|
|
@@ -59,6 +69,7 @@ function filterIcons(obj: Record<string, unknown>): Partial<EditorShellIcons> {
|
|
|
59
69
|
export const DEFAULT_CONFIG: EditorShellConfig = {
|
|
60
70
|
pinnedStatus: [],
|
|
61
71
|
icons: {},
|
|
72
|
+
modelDisplay: "name",
|
|
62
73
|
};
|
|
63
74
|
|
|
64
75
|
function getAgentDir(): string {
|
|
@@ -91,6 +102,11 @@ export function loadEditorShellConfig(cwd?: string): EditorShellConfig {
|
|
|
91
102
|
|
|
92
103
|
const pinned = raw.pinnedStatus;
|
|
93
104
|
const iconsRaw = raw.icons;
|
|
105
|
+
const modelDisplayRaw = raw.modelDisplay;
|
|
106
|
+
const modelDisplay =
|
|
107
|
+
modelDisplayRaw === "name" || modelDisplayRaw === "provider-id"
|
|
108
|
+
? modelDisplayRaw
|
|
109
|
+
: DEFAULT_CONFIG.modelDisplay;
|
|
94
110
|
return {
|
|
95
111
|
pinnedStatus: Array.isArray(pinned)
|
|
96
112
|
? pinned.filter((k): k is string => typeof k === "string")
|
|
@@ -99,5 +115,6 @@ export function loadEditorShellConfig(cwd?: string): EditorShellConfig {
|
|
|
99
115
|
iconsRaw && typeof iconsRaw === "object"
|
|
100
116
|
? filterIcons(iconsRaw as Record<string, unknown>)
|
|
101
117
|
: {},
|
|
118
|
+
modelDisplay,
|
|
102
119
|
};
|
|
103
120
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { spawn } from "node:child_process";
|
|
|
4
4
|
import * as os from "node:os";
|
|
5
5
|
import * as path from "node:path";
|
|
6
6
|
import { CardEditor, type FrameProvider, type SpinnerPhase } from "./card-editor";
|
|
7
|
-
import { loadEditorShellConfig, type EditorShellConfig, type EditorShellIcons } from "./config";
|
|
7
|
+
import { DEFAULT_CONFIG, loadEditorShellConfig, type EditorShellConfig, type EditorShellIcons } from "./config";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* pi-editor-shell — Replaces pi's default editor and status bar with a
|
|
@@ -205,7 +205,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
205
205
|
// The factory may run again when pi rebuilds the editor (model switch,
|
|
206
206
|
// reload, …), so always drive whichever instance is current.
|
|
207
207
|
let editor: CardEditor | undefined;
|
|
208
|
-
let config: EditorShellConfig = {
|
|
208
|
+
let config: EditorShellConfig = { ...DEFAULT_CONFIG };
|
|
209
209
|
// Resolved icons for the current session: built-in defaults merged with
|
|
210
210
|
// the user's overrides. Re-computed at session_start.
|
|
211
211
|
let icons: EditorShellIcons = { ...DEFAULT_ICONS };
|
|
@@ -281,7 +281,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
281
281
|
return ` ${texts.map((s) => theme.fg("muted", s)).join(theme.fg("dim", " · "))} `;
|
|
282
282
|
};
|
|
283
283
|
|
|
284
|
-
const model = ctx.model
|
|
284
|
+
const model = ctx.model
|
|
285
|
+
? config.modelDisplay === "name"
|
|
286
|
+
? ctx.model.name
|
|
287
|
+
: `${ctx.model.provider}/${ctx.model.id}`
|
|
288
|
+
: "no model";
|
|
285
289
|
const thinking = pi.getThinkingLevel();
|
|
286
290
|
const thinkingColor = THINKING_TOKEN[thinking] ?? "muted";
|
|
287
291
|
|
|
@@ -378,6 +382,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
378
382
|
|
|
379
383
|
lines.push("[editor-shell config]");
|
|
380
384
|
lines.push(` pinnedStatus: [${config.pinnedStatus.join(", ")}]`);
|
|
385
|
+
lines.push(` modelDisplay: ${config.modelDisplay}`);
|
|
381
386
|
|
|
382
387
|
lines.push("");
|
|
383
388
|
lines.push("[extension statuses]");
|