@monotykamary/pi-better-openai 0.1.44 → 0.2.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 +2 -1
- package/index.ts +8 -6
- package/package.json +1 -1
- package/src/config.ts +17 -0
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Usage display, image generation, and live voice require pi's `openai-codex` OAut
|
|
|
26
26
|
2. Verify subscription usage with `/openai-usage`, or open `/openai-settings` and check **Diagnostics**.
|
|
27
27
|
3. The extension reads auth from pi's agent auth store, normally `~/.pi/agent/auth.json`. Do not copy, paste, or commit values from this file.
|
|
28
28
|
4. If `PI_CODING_AGENT_DIR` is set, the auth store, global extension config, and global generated-image directory use that agent directory instead of `~/.pi/agent`. A leading `~/` is expanded to your home directory.
|
|
29
|
-
5. When [pi-multiprovider](https://github.com/monotykamary/pi-multiprovider) 0.
|
|
29
|
+
5. When [pi-multiprovider](https://github.com/monotykamary/pi-multiprovider) 0.8.0+ pools several `openai-codex` accounts, the session's active account (chosen with `/switch-account`) is resolved first for usage display, image generation, web search, and live voice; the usage widget refreshes on every switch and whenever a resumed session restores the account, so it never keeps billing the account the session used before. Without that extension, credential resolution is unchanged.
|
|
30
30
|
|
|
31
31
|
## Features
|
|
32
32
|
|
|
@@ -77,6 +77,7 @@ Example config:
|
|
|
77
77
|
```json
|
|
78
78
|
{
|
|
79
79
|
"persistState": true,
|
|
80
|
+
"notifyOnModelSwitch": true,
|
|
80
81
|
"desiredActive": false,
|
|
81
82
|
"supportedModels": ["openai/gpt-5.5", "openai-codex/gpt-5.5"],
|
|
82
83
|
"usage": {
|
package/index.ts
CHANGED
|
@@ -1497,12 +1497,14 @@ export default function betterOpenAI(pi: ExtensionAPI): void {
|
|
|
1497
1497
|
fastController.applyDesiredState(ctx, cfg);
|
|
1498
1498
|
if (fastController.active !== wasActive) {
|
|
1499
1499
|
persist(cfg);
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1500
|
+
if (cfg.notifyOnModelSwitch) {
|
|
1501
|
+
ctx.ui.notify(
|
|
1502
|
+
fastController.active
|
|
1503
|
+
? fastController.stateText(ctx, cfg)
|
|
1504
|
+
: fastController.inactiveForModelMessage(ctx),
|
|
1505
|
+
fastController.active ? "info" : "warning",
|
|
1506
|
+
);
|
|
1507
|
+
}
|
|
1506
1508
|
}
|
|
1507
1509
|
updateFooter(ctx);
|
|
1508
1510
|
void usageController.refresh(ctx, event.model.id, { force: true });
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -102,6 +102,7 @@ export type PetConfig = {
|
|
|
102
102
|
|
|
103
103
|
export interface ConfigFile {
|
|
104
104
|
persistState?: boolean;
|
|
105
|
+
notifyOnModelSwitch?: boolean;
|
|
105
106
|
active?: boolean;
|
|
106
107
|
desiredActive?: boolean;
|
|
107
108
|
supportedModels?: string[];
|
|
@@ -125,6 +126,7 @@ export interface ResolvedConfig {
|
|
|
125
126
|
projectConfigExists: boolean;
|
|
126
127
|
globalConfigExists: boolean;
|
|
127
128
|
persistState: boolean;
|
|
129
|
+
notifyOnModelSwitch: boolean;
|
|
128
130
|
active: boolean;
|
|
129
131
|
desiredActive: boolean;
|
|
130
132
|
supportedModels: SupportedModel[];
|
|
@@ -191,6 +193,7 @@ export const DEFAULT_PET_CONFIG: Required<PetConfig> = {
|
|
|
191
193
|
|
|
192
194
|
export const DEFAULT_CONFIG: ConfigFile = {
|
|
193
195
|
persistState: true,
|
|
196
|
+
notifyOnModelSwitch: true,
|
|
194
197
|
active: false,
|
|
195
198
|
desiredActive: false,
|
|
196
199
|
supportedModels: [...DEFAULT_SUPPORTED_MODELS],
|
|
@@ -241,6 +244,17 @@ export const FAST_SETTING_DESCRIPTORS: readonly SettingsOptionDescriptor[] = [
|
|
|
241
244
|
description: "Remember fast-mode state across sessions.",
|
|
242
245
|
parse: booleanSetting,
|
|
243
246
|
},
|
|
247
|
+
{
|
|
248
|
+
id: "notifyOnModelSwitch",
|
|
249
|
+
section: "root",
|
|
250
|
+
key: "notifyOnModelSwitch",
|
|
251
|
+
label: "Notify on model switch",
|
|
252
|
+
currentValue: (cfg) => String(cfg.notifyOnModelSwitch),
|
|
253
|
+
values: ["true", "false"],
|
|
254
|
+
description:
|
|
255
|
+
"Show a notification when switching models turns fast mode on or off. Disable to keep automatic model switches quiet.",
|
|
256
|
+
parse: booleanSetting,
|
|
257
|
+
},
|
|
244
258
|
];
|
|
245
259
|
|
|
246
260
|
export const FOOTER_SETTING_DESCRIPTORS: readonly SettingsOptionDescriptor[] = [
|
|
@@ -628,6 +642,8 @@ export function readConfig(path: string): ConfigFile | undefined {
|
|
|
628
642
|
const parsed = readRawConfig(path);
|
|
629
643
|
const config: ConfigFile = {};
|
|
630
644
|
if (typeof parsed.persistState === "boolean") config.persistState = parsed.persistState;
|
|
645
|
+
if (typeof parsed.notifyOnModelSwitch === "boolean")
|
|
646
|
+
config.notifyOnModelSwitch = parsed.notifyOnModelSwitch;
|
|
631
647
|
if (typeof parsed.active === "boolean") config.active = parsed.active;
|
|
632
648
|
if (typeof parsed.desiredActive === "boolean") config.desiredActive = parsed.desiredActive;
|
|
633
649
|
const supportedModels = normalizeModelKeys(parsed.supportedModels);
|
|
@@ -801,6 +817,7 @@ export function resolveConfig(cwd: string): ResolvedConfig {
|
|
|
801
817
|
projectConfigExists,
|
|
802
818
|
globalConfigExists,
|
|
803
819
|
persistState: merged.persistState ?? true,
|
|
820
|
+
notifyOnModelSwitch: merged.notifyOnModelSwitch ?? true,
|
|
804
821
|
active: merged.active ?? desiredActive,
|
|
805
822
|
desiredActive,
|
|
806
823
|
supportedModels:
|