@benvargas/pi-openai-fast 1.0.5 → 1.1.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/README.md +12 -2
- package/extensions/index.ts +66 -8
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -39,7 +39,11 @@ pi -e npm:@benvargas/pi-openai-fast --fast
|
|
|
39
39
|
Config files follow the same project-over-global pattern as the other packages:
|
|
40
40
|
|
|
41
41
|
- Project: `<repo>/.pi/extensions/pi-openai-fast.json`
|
|
42
|
-
- Global:
|
|
42
|
+
- Global: `<agent dir>/extensions/pi-openai-fast.json`
|
|
43
|
+
|
|
44
|
+
The global path uses pi's agent directory — typically `~/.pi/agent`, but it follows `PI_CODING_AGENT_DIR` when that is set, matching where pi itself reads and writes config.
|
|
45
|
+
|
|
46
|
+
Releases before 1.1.0 always used `~/.pi/agent`, even with `PI_CODING_AGENT_DIR` set. If the agent directory differs from `~/.pi/agent` and has no config yet, an existing `~/.pi/agent/extensions/pi-openai-fast.json` is copied there once so previous settings carry over; a config already present in the agent directory is never overwritten.
|
|
43
47
|
|
|
44
48
|
If neither exists, the extension writes a default global config on first run.
|
|
45
49
|
|
|
@@ -51,15 +55,18 @@ Default config:
|
|
|
51
55
|
"active": false,
|
|
52
56
|
"supportedModels": [
|
|
53
57
|
"openai/gpt-5.4",
|
|
58
|
+
"openai/gpt-5.4-mini",
|
|
54
59
|
"openai/gpt-5.5",
|
|
55
60
|
"openai/gpt-5.6-sol",
|
|
56
61
|
"openai/gpt-5.6-terra",
|
|
57
62
|
"openai/gpt-5.6-luna",
|
|
63
|
+
"openai/gpt-6-astra",
|
|
58
64
|
"openai-codex/gpt-5.4",
|
|
59
65
|
"openai-codex/gpt-5.5",
|
|
60
66
|
"openai-codex/gpt-5.6-sol",
|
|
61
67
|
"openai-codex/gpt-5.6-terra",
|
|
62
|
-
"openai-codex/gpt-5.6-luna"
|
|
68
|
+
"openai-codex/gpt-5.6-luna",
|
|
69
|
+
"openai-codex/gpt-6-astra"
|
|
63
70
|
]
|
|
64
71
|
}
|
|
65
72
|
```
|
|
@@ -77,6 +84,9 @@ Project config overrides global config. `/fast on` and `/fast off` write to the
|
|
|
77
84
|
- When `persistState` is enabled, the last `/fast` setting also carries across brand-new pi sessions.
|
|
78
85
|
- Resumed sessions do not override the config-backed startup state.
|
|
79
86
|
- On configured models, fast mode maps to OpenAI `service_tier=priority`.
|
|
87
|
+
- `openai/gpt-5.4-mini` is in the defaults for the API-key provider only: OpenAI publishes Fast-mode pricing for it, but the ChatGPT (`openai-codex`) side offers no fast tier for gpt-5.4-mini. `gpt-5.4-nano`, `gpt-5.4-pro`, and `gpt-5.5-pro` have no published Fast-mode pricing and are left out.
|
|
88
|
+
- `gpt-6-astra` (pi 0.85.1) is in the defaults for both providers: OpenAI publishes Fast-mode pricing for it (2x Standard, no latency SLA, not available with EU data residency), and the Codex catalog advertises a `priority` ("Fast", 2x speed) service tier for it.
|
|
89
|
+
- If a default set from an older release is found in your config, it is upgraded to the current defaults automatically; customized `supportedModels` lists are left untouched.
|
|
80
90
|
|
|
81
91
|
## Uninstall
|
|
82
92
|
|
package/extensions/index.ts
CHANGED
|
@@ -6,35 +6,70 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Startup state comes from `pi-openai-fast.json`, not resumed session history.
|
|
8
8
|
* Config precedence is project `.pi/extensions/pi-openai-fast.json` over
|
|
9
|
-
* global
|
|
9
|
+
* global `<agent dir>/extensions/pi-openai-fast.json`, where the agent dir is
|
|
10
|
+
* pi's getAgentDir() (typically `~/.pi/agent`, honoring PI_CODING_AGENT_DIR).
|
|
11
|
+
* Releases before 0.84 always used `~/.pi/agent`; when the agent dir differs
|
|
12
|
+
* and holds no config yet, the legacy global file is copied there once.
|
|
10
13
|
*
|
|
11
14
|
* `supportedModels` controls which `provider/model-id` pairs receive the flag.
|
|
12
15
|
*/
|
|
13
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
16
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
14
17
|
import { homedir } from "node:os";
|
|
15
|
-
import { dirname, join } from "node:path";
|
|
16
|
-
import type
|
|
18
|
+
import { dirname, join, resolve } from "node:path";
|
|
19
|
+
import { type ExtensionAPI, type ExtensionContext, getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
17
20
|
|
|
18
21
|
const FAST_COMMAND = "fast";
|
|
19
22
|
const FAST_FLAG = "fast";
|
|
20
23
|
const FAST_CONFIG_BASENAME = "pi-openai-fast.json";
|
|
21
24
|
const FAST_COMMAND_ARGS = ["on", "off", "status"] as const;
|
|
22
25
|
const FAST_SERVICE_TIER = "priority";
|
|
26
|
+
// `openai/gpt-5.4-mini` has an official Fast-mode price and is API-key only: the
|
|
27
|
+
// ChatGPT (openai-codex) catalog exposes no priority tier for gpt-5.4-mini.
|
|
28
|
+
// `gpt-6-astra` (pi 0.85.1) has Fast-mode pricing on the API and a `priority`
|
|
29
|
+
// service tier in the Codex catalog, so both providers are listed.
|
|
23
30
|
const DEFAULT_SUPPORTED_MODEL_KEYS = [
|
|
24
31
|
"openai/gpt-5.4",
|
|
32
|
+
"openai/gpt-5.4-mini",
|
|
25
33
|
"openai/gpt-5.5",
|
|
26
34
|
"openai/gpt-5.6-sol",
|
|
27
35
|
"openai/gpt-5.6-terra",
|
|
28
36
|
"openai/gpt-5.6-luna",
|
|
37
|
+
"openai/gpt-6-astra",
|
|
29
38
|
"openai-codex/gpt-5.4",
|
|
30
39
|
"openai-codex/gpt-5.5",
|
|
31
40
|
"openai-codex/gpt-5.6-sol",
|
|
32
41
|
"openai-codex/gpt-5.6-terra",
|
|
33
42
|
"openai-codex/gpt-5.6-luna",
|
|
43
|
+
"openai-codex/gpt-6-astra",
|
|
34
44
|
] as const;
|
|
35
45
|
const LEGACY_DEFAULT_SUPPORTED_MODEL_KEY_SETS = [
|
|
36
46
|
["openai/gpt-5.4", "openai-codex/gpt-5.4"],
|
|
37
47
|
["openai/gpt-5.4", "openai/gpt-5.5", "openai-codex/gpt-5.4", "openai-codex/gpt-5.5"],
|
|
48
|
+
[
|
|
49
|
+
"openai/gpt-5.4",
|
|
50
|
+
"openai/gpt-5.5",
|
|
51
|
+
"openai/gpt-5.6-sol",
|
|
52
|
+
"openai/gpt-5.6-terra",
|
|
53
|
+
"openai/gpt-5.6-luna",
|
|
54
|
+
"openai-codex/gpt-5.4",
|
|
55
|
+
"openai-codex/gpt-5.5",
|
|
56
|
+
"openai-codex/gpt-5.6-sol",
|
|
57
|
+
"openai-codex/gpt-5.6-terra",
|
|
58
|
+
"openai-codex/gpt-5.6-luna",
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
"openai/gpt-5.4",
|
|
62
|
+
"openai/gpt-5.4-mini",
|
|
63
|
+
"openai/gpt-5.5",
|
|
64
|
+
"openai/gpt-5.6-sol",
|
|
65
|
+
"openai/gpt-5.6-terra",
|
|
66
|
+
"openai/gpt-5.6-luna",
|
|
67
|
+
"openai-codex/gpt-5.4",
|
|
68
|
+
"openai-codex/gpt-5.5",
|
|
69
|
+
"openai-codex/gpt-5.6-sol",
|
|
70
|
+
"openai-codex/gpt-5.6-terra",
|
|
71
|
+
"openai-codex/gpt-5.6-luna",
|
|
72
|
+
],
|
|
38
73
|
] as const;
|
|
39
74
|
|
|
40
75
|
interface FastModeState {
|
|
@@ -80,14 +115,19 @@ function getConfigCwd(ctx: ExtensionContext): string {
|
|
|
80
115
|
|
|
81
116
|
function getConfigPaths(
|
|
82
117
|
cwd: string,
|
|
83
|
-
homeDir
|
|
118
|
+
homeDir?: string,
|
|
84
119
|
): {
|
|
85
120
|
projectConfigPath: string;
|
|
86
121
|
globalConfigPath: string;
|
|
122
|
+
legacyGlobalConfigPath: string;
|
|
87
123
|
} {
|
|
124
|
+
const agentDir = homeDir === undefined ? getAgentDir() : join(homeDir, ".pi", "agent");
|
|
125
|
+
// Pre-0.84 releases always wrote the global config under ~/.pi/agent, ignoring PI_CODING_AGENT_DIR.
|
|
126
|
+
const legacyAgentDir = join(homeDir ?? homedir(), ".pi", "agent");
|
|
88
127
|
return {
|
|
89
128
|
projectConfigPath: join(cwd, ".pi", "extensions", FAST_CONFIG_BASENAME),
|
|
90
|
-
globalConfigPath: join(
|
|
129
|
+
globalConfigPath: join(agentDir, "extensions", FAST_CONFIG_BASENAME),
|
|
130
|
+
legacyGlobalConfigPath: join(legacyAgentDir, "extensions", FAST_CONFIG_BASENAME),
|
|
91
131
|
};
|
|
92
132
|
}
|
|
93
133
|
|
|
@@ -207,8 +247,25 @@ function ensureDefaultConfigFile(projectConfigPath: string, globalConfigPath: st
|
|
|
207
247
|
writeConfigFile(globalConfigPath, DEFAULT_CONFIG_FILE);
|
|
208
248
|
}
|
|
209
249
|
|
|
210
|
-
function
|
|
211
|
-
|
|
250
|
+
function migrateLegacyGlobalConfigFile(legacyGlobalConfigPath: string, globalConfigPath: string): void {
|
|
251
|
+
if (resolve(legacyGlobalConfigPath) === resolve(globalConfigPath)) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (existsSync(globalConfigPath) || !existsSync(legacyGlobalConfigPath)) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
try {
|
|
258
|
+
mkdirSync(dirname(globalConfigPath), { recursive: true });
|
|
259
|
+
copyFileSync(legacyGlobalConfigPath, globalConfigPath);
|
|
260
|
+
} catch (error) {
|
|
261
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
262
|
+
console.warn(`[pi-openai-fast] Failed to migrate ${legacyGlobalConfigPath} to ${globalConfigPath}: ${message}`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function resolveFastConfig(cwd: string, homeDir?: string): ResolvedFastConfig {
|
|
267
|
+
const { projectConfigPath, globalConfigPath, legacyGlobalConfigPath } = getConfigPaths(cwd, homeDir);
|
|
268
|
+
migrateLegacyGlobalConfigFile(legacyGlobalConfigPath, globalConfigPath);
|
|
212
269
|
ensureDefaultConfigFile(projectConfigPath, globalConfigPath);
|
|
213
270
|
|
|
214
271
|
const globalConfig = readConfigFile(globalConfigPath) ?? {};
|
|
@@ -415,6 +472,7 @@ export const _test = {
|
|
|
415
472
|
parseSupportedModelKey,
|
|
416
473
|
parseSupportedModels,
|
|
417
474
|
migrateSupportedModelKeys,
|
|
475
|
+
migrateLegacyGlobalConfigFile,
|
|
418
476
|
readConfigFile,
|
|
419
477
|
resolveFastConfig,
|
|
420
478
|
isFastSupportedModel,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@benvargas/pi-openai-fast",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "OpenAI fast mode toggle for pi - Enables priority service tier on supported GPT-5 models",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "OpenAI fast mode toggle for pi - Enables priority service tier on supported GPT-5 and GPT-6 models",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi",
|
|
7
7
|
"pi-package",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"gpt-5.4",
|
|
13
13
|
"gpt-5.5",
|
|
14
14
|
"gpt-5.6",
|
|
15
|
+
"gpt-6-astra",
|
|
15
16
|
"fast",
|
|
16
17
|
"priority",
|
|
17
18
|
"service-tier"
|