@restranger/repi-model-fallback 0.0.1-sha.2ba2721 → 0.0.1-sha.9fd9ba8
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 +18 -6
- package/src/config.ts +1 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restranger/repi-model-fallback",
|
|
3
|
-
"version": "0.0.1-sha.
|
|
3
|
+
"version": "0.0.1-sha.9fd9ba8",
|
|
4
4
|
"description": "Automatic model fallback and retry for pi-coding-agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -8,8 +8,18 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./src/index.ts"
|
|
10
10
|
},
|
|
11
|
-
"files": [
|
|
12
|
-
|
|
11
|
+
"files": [
|
|
12
|
+
"src",
|
|
13
|
+
"README.md",
|
|
14
|
+
"!src/**/__tests__"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"pi-package",
|
|
18
|
+
"pi-coding-agent",
|
|
19
|
+
"model-fallback",
|
|
20
|
+
"retry",
|
|
21
|
+
"tui"
|
|
22
|
+
],
|
|
13
23
|
"author": "ReStranger <restranger@disroot.org>",
|
|
14
24
|
"license": "MIT",
|
|
15
25
|
"repository": {
|
|
@@ -25,10 +35,12 @@
|
|
|
25
35
|
"access": "public"
|
|
26
36
|
},
|
|
27
37
|
"pi": {
|
|
28
|
-
"extensions": [
|
|
38
|
+
"extensions": [
|
|
39
|
+
"./src/index.ts"
|
|
40
|
+
]
|
|
29
41
|
},
|
|
30
42
|
"dependencies": {
|
|
31
|
-
"@restranger/repi-lib": "0.0.1-sha.
|
|
43
|
+
"@restranger/repi-lib": "0.0.1-sha.9fd9ba8"
|
|
32
44
|
},
|
|
33
45
|
"peerDependencies": {
|
|
34
46
|
"@earendil-works/pi-coding-agent": ">=0.79.0"
|
|
@@ -39,6 +51,6 @@
|
|
|
39
51
|
}
|
|
40
52
|
},
|
|
41
53
|
"devDependencies": {
|
|
42
|
-
"@restranger/repi-test-utils": "0.0.1-sha.
|
|
54
|
+
"@restranger/repi-test-utils": "0.0.1-sha.9fd9ba8"
|
|
43
55
|
}
|
|
44
56
|
}
|
package/src/config.ts
CHANGED
|
@@ -141,23 +141,9 @@ export interface SaveConfigOptions {
|
|
|
141
141
|
readonly workspaceTrusted?: boolean;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
export function resolveProjectFallbackConfigPath(cwd: string): string {
|
|
145
|
-
const directJson = join(resolve(cwd), ".pi", "extensions", "repi-model-fallback.json");
|
|
146
|
-
const extDir = join(resolve(cwd), ".pi", "extensions", "repi-model-fallback");
|
|
147
|
-
const inFolderConfig = join(extDir, "config.json");
|
|
148
|
-
const namedInExt = join(extDir, CONFIG_NAME);
|
|
149
|
-
const legacy = join(resolve(cwd), ".repi", CONFIG_NAME);
|
|
150
|
-
if (existsSync(directJson)) return directJson;
|
|
151
|
-
if (existsSync(inFolderConfig)) return inFolderConfig;
|
|
152
|
-
if (existsSync(namedInExt)) return namedInExt;
|
|
153
|
-
if (existsSync(legacy)) return legacy;
|
|
154
|
-
return directJson;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
144
|
/**
|
|
158
145
|
* Persist the main model's fallback list.
|
|
159
146
|
*
|
|
160
|
-
* Saves to `.pi/extensions/repi-model-fallback.json` (or existing `.pi/extensions/repi-model-fallback/config.json`).
|
|
161
147
|
* The write is atomic (temp file + rename) and never silently discards an unreadable existing
|
|
162
148
|
* file: a corrupt config must surface as an error, not as settings that vanish on the next save.
|
|
163
149
|
* `enabled` is preserved so saving from the menu does not undo `/fallback off`.
|
|
@@ -168,7 +154,7 @@ export function saveMainFallbackConfig(
|
|
|
168
154
|
options: SaveConfigOptions = {},
|
|
169
155
|
): string {
|
|
170
156
|
assertProjectWritable(options);
|
|
171
|
-
const filePath =
|
|
157
|
+
const filePath = join(resolve(cwd), ".repi", CONFIG_NAME);
|
|
172
158
|
const existing = readExistingObject(filePath);
|
|
173
159
|
const updated = {
|
|
174
160
|
...existing,
|