@restranger/repi-model-fallback 0.0.0-stage → 0.0.1-3546f1c.dirty
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 +81 -2
- package/index.ts +2 -0
- package/package.json +44 -5
- package/src/config.ts +259 -0
- package/src/format.ts +10 -0
- package/src/index.ts +5 -0
- package/src/menu-ui.ts +762 -0
- package/src/plugin.ts +389 -0
- package/src/resolver.ts +37 -0
- package/src/types.ts +31 -0
package/README.md
CHANGED
|
@@ -1,3 +1,82 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @restranger/repi-model-fallback
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Automatic model fallback and retry for the primary Pi agent. When a model request fails (rate limit, quota exceeded, 403/5xx errors, network failure), this extension automatically switches the active session to the next configured fallback model and transparently resumes execution.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pi install npm:@restranger/repi-model-fallback
|
|
9
|
+
# or from this monorepo
|
|
10
|
+
pi --extension ./packages/model-fallback/index.ts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## How it works
|
|
14
|
+
|
|
15
|
+
1. Pi executes a turn. If the provider fails (e.g. 403 Forbidden, 429 Rate Limit, 500 Server Error), the turn ends with an error.
|
|
16
|
+
2. Before the session settles, `@restranger/repi-model-fallback` intercepts `agent_before_settle`:
|
|
17
|
+
- Selects the next viable candidate from your `fallbacks` list.
|
|
18
|
+
- Activates the fallback model via `pi.setModel(nextModel)`.
|
|
19
|
+
- Omits the failed assistant message via `context_edit` so the context is clean.
|
|
20
|
+
- Shows a notification in the UI (`Model "..." failed: ... Falling back to "..."`).
|
|
21
|
+
- Returns `{ continue: true }` to immediately prompt the new model.
|
|
22
|
+
3. The fallback model produces the final answer without requiring user intervention.
|
|
23
|
+
|
|
24
|
+
## Configuration
|
|
25
|
+
|
|
26
|
+
Configurations are loaded with project priority:
|
|
27
|
+
1. `$PI_CODING_AGENT_DIR/extensions/repi-model-fallback.json` (default `~/.pi/agent/extensions/repi-model-fallback.json`)
|
|
28
|
+
2. `<project>/.pi/extensions/repi-model-fallback.json` or `<project>/.repi/model-fallback.json` (wins over user config)
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"version": 1,
|
|
33
|
+
"enabled": true,
|
|
34
|
+
"fallbacks": [
|
|
35
|
+
"gemini-3.8-flash",
|
|
36
|
+
"anthropic/claude-3-5-sonnet",
|
|
37
|
+
"openai/gpt-4o"
|
|
38
|
+
],
|
|
39
|
+
"maxRetriesPerTurn": 3,
|
|
40
|
+
"notify": true
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Options
|
|
45
|
+
|
|
46
|
+
| Field | Description | Default |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `enabled` | Whether automatic model fallback is active. | `true` |
|
|
49
|
+
| `fallbacks` | Ordered list of models to try if the current model fails. Exact `provider/id` or fuzzy model name. | `[]` |
|
|
50
|
+
| `maxRetriesPerTurn` | Maximum number of consecutive fallback attempts per user prompt before stopping. | `3` |
|
|
51
|
+
| `notify` | Whether to show an informative UI notification on fallback. | `true` |
|
|
52
|
+
|
|
53
|
+
Accepted aliases for compatibility: `fallback_models`, `fallbackModels`, `max_retries_per_turn`.
|
|
54
|
+
|
|
55
|
+
## Slash command & TUI Menu
|
|
56
|
+
|
|
57
|
+
- `/fallback` — Open the interactive menu to view and manage fallbacks for all agents. It renders the
|
|
58
|
+
same way as Pi's own pickers (`/models`, `/llama`, `ctx.ui.select`): an inline frame in the editor
|
|
59
|
+
slot, a `→ ` cursor, muted descriptions and a key-hint line, with no full-screen overlay.
|
|
60
|
+
- Lists the primary agent (`Main Agent`) and all declared subagents (`Explore`, `Plan`, `general-purpose`, etc.).
|
|
61
|
+
- Shows the selected agent's primary model and fallback chain below the list.
|
|
62
|
+
- Press `a` or `Enter` to open the model picker, then type to fuzzy-search the registry.
|
|
63
|
+
- The picker works like `/scoped-models`: `Enter` toggles the highlighted model, `Ctrl+A` enables
|
|
64
|
+
every model in the filtered list, `Ctrl+X` clears it, `Ctrl+P` toggles the selected model's
|
|
65
|
+
provider and `Alt+↑/↓` reorders the fallback chain. Enabled models are listed first, in chain
|
|
66
|
+
order, with a `#n` rank; chain entries that are no longer available stay listed as
|
|
67
|
+
`[unavailable]` so they can be removed.
|
|
68
|
+
- Press `Ctrl+S` (or `s` on the agent list) to save. The fallback chain goes to the user config
|
|
69
|
+
(`<agentDir>/extensions/repi-model-fallback.json`, normally `~/.pi/agent/...`) so it follows
|
|
70
|
+
the user and works in an untrusted workspace; a trusted project that already owns a fallback
|
|
71
|
+
config is updated in place. Subagent overrides are applied in memory and persisted by
|
|
72
|
+
`@restranger/repi-subagents` when the workspace is trusted. Unsaved edits are marked `unsaved`
|
|
73
|
+
in the subtitle.
|
|
74
|
+
- Press `q` or `Esc` to close; in the picker `Esc` first clears the search, then returns.
|
|
75
|
+
- `/fallback status` — Print status overview in text mode.
|
|
76
|
+
- `/fallback list` — List configured fallbacks and all available models in the registry.
|
|
77
|
+
- `/fallback on` — Enable fallback for the current session.
|
|
78
|
+
- `/fallback off` — Temporarily disable fallback.
|
|
79
|
+
- `/fallback reload` — Reload configuration files from disk.
|
|
80
|
+
|
|
81
|
+
Typing `/fallback ` and pressing `Tab` completes these subcommands; nothing is offered after a
|
|
82
|
+
subcommand because the rest of the argument is not a fixed slot.
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@restranger/repi-model-fallback",
|
|
3
|
+
"version": "0.0.1-3546f1c.dirty",
|
|
4
|
+
"description": "Automatic model fallback and retry for pi-coding-agent",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.ts",
|
|
7
|
+
"types": "./index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./index.ts"
|
|
10
|
+
},
|
|
11
|
+
"files": ["index.ts", "src", "README.md", "!src/**/__tests__"],
|
|
12
|
+
"keywords": ["pi-package", "pi-coding-agent", "model-fallback", "retry", "tui"],
|
|
13
|
+
"author": "ReStranger <restranger@disroot.org>",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/ReStranger/repi-mono.git",
|
|
18
|
+
"directory": "packages/model-fallback"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/ReStranger/repi-mono/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/ReStranger/repi-mono#readme",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"pi": {
|
|
28
|
+
"extensions": ["./index.ts"]
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@restranger/repi-lib": "0.0.1-3546f1c.dirty",
|
|
32
|
+
"@restranger/repi-ui": "0.0.1-3546f1c.dirty"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@earendil-works/pi-coding-agent": ">=0.79.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependenciesMeta": {
|
|
38
|
+
"@earendil-works/pi-coding-agent": {
|
|
39
|
+
"optional": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@restranger/repi-test-utils": "0.0.1-3546f1c.dirty"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
3
|
+
import { type PluginConfigLayer, type PluginDiagnostic, resolveConfigLayers } from "@restranger/repi-lib";
|
|
4
|
+
import type { FallbackConfig, LoadedFallbackConfig, ModelFallbackConfigContext } from "./types.js";
|
|
5
|
+
|
|
6
|
+
const CONFIG_NAME = "model-fallback.json";
|
|
7
|
+
|
|
8
|
+
/** Layers are resolved by `@restranger/repi-lib` so every plugin applies the same trust rule. */
|
|
9
|
+
export function resolveConfigPaths(context: ModelFallbackConfigContext): PluginConfigLayer[] {
|
|
10
|
+
return resolveConfigLayers({
|
|
11
|
+
cwd: context.cwd,
|
|
12
|
+
...(context.homeDir !== undefined ? { homeDir: context.homeDir } : {}),
|
|
13
|
+
...(context.env !== undefined ? { env: context.env } : {}),
|
|
14
|
+
...(context.workspaceTrusted !== undefined ? { workspaceTrusted: context.workspaceTrusted } : {}),
|
|
15
|
+
filename: CONFIG_NAME,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function loadFallbackConfig(context: ModelFallbackConfigContext): LoadedFallbackConfig {
|
|
20
|
+
const diagnostics: PluginDiagnostic[] = [];
|
|
21
|
+
const configFiles: string[] = [];
|
|
22
|
+
let merged: FallbackConfig = {
|
|
23
|
+
enabled: true,
|
|
24
|
+
fallbacks: [],
|
|
25
|
+
maxRetriesPerTurn: 3,
|
|
26
|
+
notify: true,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
for (const layer of resolveConfigPaths(context)) {
|
|
30
|
+
if (!safeExists(layer.path)) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
configFiles.push(layer.path);
|
|
34
|
+
const parsed = readConfigFile(layer, diagnostics);
|
|
35
|
+
if (!parsed) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
merged = mergeLayer(merged, parsed);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
config: merged,
|
|
44
|
+
configFiles,
|
|
45
|
+
diagnostics,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function readConfigFile(
|
|
50
|
+
layer: PluginConfigLayer,
|
|
51
|
+
diagnostics: PluginDiagnostic[],
|
|
52
|
+
): Record<string, unknown> | undefined {
|
|
53
|
+
let raw: string;
|
|
54
|
+
try {
|
|
55
|
+
raw = readFileSync(layer.path, "utf8");
|
|
56
|
+
} catch (err) {
|
|
57
|
+
diagnostics.push({
|
|
58
|
+
level: "error",
|
|
59
|
+
path: layer.path,
|
|
60
|
+
message: `Cannot read ${layer.source} config: ${errorMessage(err)}`,
|
|
61
|
+
});
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
const parsed = JSON.parse(raw.replace(/^\uFEFF/, "")) as unknown;
|
|
67
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
68
|
+
diagnostics.push({
|
|
69
|
+
level: "error",
|
|
70
|
+
path: layer.path,
|
|
71
|
+
message: `Invalid ${layer.source} config: expected a JSON object.`,
|
|
72
|
+
});
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
return parsed as Record<string, unknown>;
|
|
76
|
+
} catch (err) {
|
|
77
|
+
diagnostics.push({
|
|
78
|
+
level: "error",
|
|
79
|
+
path: layer.path,
|
|
80
|
+
message: `JSON syntax error in ${layer.source} config: ${errorMessage(err)}`,
|
|
81
|
+
});
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function mergeLayer(base: FallbackConfig, patch: Record<string, unknown>): FallbackConfig {
|
|
87
|
+
let enabled = base.enabled;
|
|
88
|
+
if (typeof patch.enabled === "boolean") {
|
|
89
|
+
enabled = patch.enabled;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
let notify = base.notify;
|
|
93
|
+
if (typeof patch.notify === "boolean") {
|
|
94
|
+
notify = patch.notify;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
let maxRetriesPerTurn = base.maxRetriesPerTurn;
|
|
98
|
+
const maxRetriesRaw = patch.maxRetriesPerTurn ?? patch.max_retries_per_turn;
|
|
99
|
+
if (typeof maxRetriesRaw === "number" && Number.isInteger(maxRetriesRaw) && maxRetriesRaw >= 1) {
|
|
100
|
+
maxRetriesPerTurn = maxRetriesRaw;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let fallbacks = base.fallbacks;
|
|
104
|
+
const rawFallbacks = patch.fallbacks ?? patch.fallback_models ?? patch.fallbackModels;
|
|
105
|
+
if (Array.isArray(rawFallbacks)) {
|
|
106
|
+
const parsed = rawFallbacks
|
|
107
|
+
.filter((entry): entry is string => typeof entry === "string" && entry.trim().length > 0)
|
|
108
|
+
.map((entry) => entry.trim());
|
|
109
|
+
fallbacks = parsed;
|
|
110
|
+
} else if (typeof rawFallbacks === "string") {
|
|
111
|
+
const parsed = rawFallbacks
|
|
112
|
+
.split(",")
|
|
113
|
+
.map((entry) => entry.trim())
|
|
114
|
+
.filter(Boolean);
|
|
115
|
+
fallbacks = parsed;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
...base,
|
|
120
|
+
...(enabled !== undefined ? { enabled } : {}),
|
|
121
|
+
...(notify !== undefined ? { notify } : {}),
|
|
122
|
+
...(maxRetriesPerTurn !== undefined ? { maxRetriesPerTurn } : {}),
|
|
123
|
+
...(fallbacks ? { fallbacks } : {}),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function safeExists(path: string): boolean {
|
|
128
|
+
try {
|
|
129
|
+
return existsSync(path);
|
|
130
|
+
} catch {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function errorMessage(error: unknown): string {
|
|
136
|
+
return error instanceof Error ? error.message : String(error);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface SaveConfigOptions {
|
|
140
|
+
/** `false` keeps the save away from the project layer; the user config is written instead. */
|
|
141
|
+
readonly workspaceTrusted?: boolean;
|
|
142
|
+
/** Defaults to `os.homedir()`; injectable for tests. */
|
|
143
|
+
readonly homeDir?: string;
|
|
144
|
+
/** Defaults to `process.env`; `PI_CODING_AGENT_DIR` is honored. */
|
|
145
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function resolveProjectFallbackConfigPath(cwd: string): string {
|
|
149
|
+
const directJson = join(resolve(cwd), ".pi", "extensions", "repi-model-fallback.json");
|
|
150
|
+
const extDir = join(resolve(cwd), ".pi", "extensions", "repi-model-fallback");
|
|
151
|
+
const inFolderConfig = join(extDir, "config.json");
|
|
152
|
+
const namedInExt = join(extDir, CONFIG_NAME);
|
|
153
|
+
const legacy = join(resolve(cwd), ".repi", CONFIG_NAME);
|
|
154
|
+
if (existsSync(directJson)) return directJson;
|
|
155
|
+
if (existsSync(inFolderConfig)) return inFolderConfig;
|
|
156
|
+
if (existsSync(namedInExt)) return namedInExt;
|
|
157
|
+
if (existsSync(legacy)) return legacy;
|
|
158
|
+
return directJson;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The file a menu save should update.
|
|
163
|
+
*
|
|
164
|
+
* A user-wide fallback chain is the common case: unless a trusted project already owns a config
|
|
165
|
+
* file, the save goes to `<agentDir>/extensions/repi-model-fallback.json`. In an untrusted
|
|
166
|
+
* workspace the project layer is never a target, so saving works instead of throwing.
|
|
167
|
+
*/
|
|
168
|
+
function resolveSaveTarget(cwd: string, options: SaveConfigOptions): string {
|
|
169
|
+
const layers = resolveConfigPaths({
|
|
170
|
+
cwd,
|
|
171
|
+
...(options.homeDir !== undefined ? { homeDir: options.homeDir } : {}),
|
|
172
|
+
...(options.env !== undefined ? { env: options.env } : {}),
|
|
173
|
+
...(options.workspaceTrusted !== undefined ? { workspaceTrusted: options.workspaceTrusted } : {}),
|
|
174
|
+
});
|
|
175
|
+
const userPath = layers.find((layer) => layer.source === "user")?.path;
|
|
176
|
+
if (!userPath) {
|
|
177
|
+
throw new Error("Cannot resolve the user fallback config path.");
|
|
178
|
+
}
|
|
179
|
+
if (options.workspaceTrusted === false) {
|
|
180
|
+
return userPath;
|
|
181
|
+
}
|
|
182
|
+
const projectPath = layers.find((layer) => layer.source === "project")?.path;
|
|
183
|
+
// Only update a project file that already exists. A fresh save goes to the user config, so the
|
|
184
|
+
// setting follows the user instead of being trapped in one checkout (and works before trust).
|
|
185
|
+
if (projectPath && safeExists(projectPath)) {
|
|
186
|
+
return projectPath;
|
|
187
|
+
}
|
|
188
|
+
return userPath;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Persist the main model's fallback list.
|
|
193
|
+
*
|
|
194
|
+
* Writes the user config (`<agentDir>/extensions/repi-model-fallback.json`) unless a trusted
|
|
195
|
+
* project already has its own fallback config, in which case that file is updated so the save is
|
|
196
|
+
* not shadowed by the project layer. The write is atomic (temp file + rename) and never silently
|
|
197
|
+
* discards an unreadable existing file: a corrupt config must surface as an error, not as settings
|
|
198
|
+
* that vanish on the next save. `enabled` is preserved so saving from the menu does not undo
|
|
199
|
+
* `/fallback off`.
|
|
200
|
+
*/
|
|
201
|
+
export function saveMainFallbackConfig(
|
|
202
|
+
cwd: string,
|
|
203
|
+
fallbacks: readonly string[],
|
|
204
|
+
options: SaveConfigOptions = {},
|
|
205
|
+
): string {
|
|
206
|
+
const filePath = resolveSaveTarget(cwd, options);
|
|
207
|
+
const existing = readExistingObject(filePath);
|
|
208
|
+
const updated = {
|
|
209
|
+
...existing,
|
|
210
|
+
version: 1,
|
|
211
|
+
enabled: typeof existing.enabled === "boolean" ? existing.enabled : true,
|
|
212
|
+
fallbacks: [...fallbacks],
|
|
213
|
+
};
|
|
214
|
+
writeJsonAtomic(filePath, updated);
|
|
215
|
+
return filePath;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function readExistingObject(filePath: string): Record<string, unknown> {
|
|
219
|
+
let raw: string;
|
|
220
|
+
try {
|
|
221
|
+
raw = readFileSync(filePath, "utf8");
|
|
222
|
+
} catch (err) {
|
|
223
|
+
if ((err as NodeJS.ErrnoException).code === "ENOENT") {
|
|
224
|
+
return {};
|
|
225
|
+
}
|
|
226
|
+
throw new Error(`Cannot read ${filePath}: ${errorMessage(err)}`);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
let parsed: unknown;
|
|
230
|
+
try {
|
|
231
|
+
parsed = JSON.parse(raw.replace(/^\uFEFF/, ""));
|
|
232
|
+
} catch (err) {
|
|
233
|
+
throw new Error(`Cannot parse ${filePath}: ${errorMessage(err)}. Fix or delete the file, then save again.`);
|
|
234
|
+
}
|
|
235
|
+
if (!isRecord(parsed)) {
|
|
236
|
+
throw new Error(`Cannot use ${filePath}: expected a JSON object.`);
|
|
237
|
+
}
|
|
238
|
+
return parsed;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function writeJsonAtomic(filePath: string, value: unknown): void {
|
|
242
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
243
|
+
const temp = join(dirname(filePath), `.${basename(filePath)}.${process.pid}.${Date.now()}.tmp`);
|
|
244
|
+
try {
|
|
245
|
+
writeFileSync(temp, `${JSON.stringify(value, null, "\t")}\n`, { encoding: "utf8", mode: 0o600 });
|
|
246
|
+
renameSync(temp, filePath);
|
|
247
|
+
} catch (err) {
|
|
248
|
+
try {
|
|
249
|
+
rmSync(temp, { force: true });
|
|
250
|
+
} catch {
|
|
251
|
+
// Best effort: the temp file may never have been created.
|
|
252
|
+
}
|
|
253
|
+
throw err;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
258
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
259
|
+
}
|
package/src/format.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { alignRight, boldText, displayWidth, fitWidth, sanitize, truncate, wrapDisplay } from "@restranger/repi-lib";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Display primitives for the fallback menu, re-exported from `@restranger/repi-lib`.
|
|
5
|
+
*
|
|
6
|
+
* The menu used to carry its own width/truncation implementation, which disagreed with the
|
|
7
|
+
* subagent widget about emoji and CJK width (and with it about SGR carry-over across wraps).
|
|
8
|
+
* Keeping this module as a re-export preserves the menu's import surface.
|
|
9
|
+
*/
|
|
10
|
+
export { alignRight, boldText, displayWidth, fitWidth, sanitize, truncate, wrapDisplay };
|