@monotykamary/pi-better-openai 0.1.27 → 0.1.29
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/index.ts +27 -7
- package/package.json +3 -3
package/index.ts
CHANGED
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
* Adds `service_tier: "priority"` to OpenAI provider payloads while fast mode is
|
|
5
5
|
* enabled and the selected model is in the configured allow-list.
|
|
6
6
|
*/
|
|
7
|
+
import { type ExtensionAPI, type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
7
8
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
Container,
|
|
10
|
+
Key,
|
|
11
|
+
matchesKey,
|
|
12
|
+
SettingsList,
|
|
13
|
+
type SettingsListTheme,
|
|
14
|
+
} from "@earendil-works/pi-tui";
|
|
13
15
|
import { CONFIG_BASENAME, STATUS_KEY } from "./src/identity.ts";
|
|
14
16
|
import {
|
|
15
17
|
formatTokens,
|
|
@@ -77,6 +79,23 @@ import {
|
|
|
77
79
|
petSizeCellsForPlacement,
|
|
78
80
|
} from "./src/footer-layout.ts";
|
|
79
81
|
|
|
82
|
+
// pi-core's getSettingsListTheme pulls the host module graph into this
|
|
83
|
+
// extension's loader (~0.5s of startup). The settings picker is a command-time
|
|
84
|
+
// surface, so the theme loads when it first opens.
|
|
85
|
+
let loadedSettingsListTheme: SettingsListTheme | undefined;
|
|
86
|
+
const loadSettingsListTheme = async (): Promise<SettingsListTheme> => {
|
|
87
|
+
loadedSettingsListTheme ??= (
|
|
88
|
+
await import("@earendil-works/pi-coding-agent")
|
|
89
|
+
).getSettingsListTheme();
|
|
90
|
+
return loadedSettingsListTheme;
|
|
91
|
+
};
|
|
92
|
+
const requireSettingsListTheme = (): SettingsListTheme => {
|
|
93
|
+
if (!loadedSettingsListTheme) {
|
|
94
|
+
throw new Error("Settings list theme accessed before /openai-settings preload");
|
|
95
|
+
}
|
|
96
|
+
return loadedSettingsListTheme;
|
|
97
|
+
};
|
|
98
|
+
|
|
80
99
|
const COMMAND = "fast";
|
|
81
100
|
const OPENAI_STATUS_COMMAND = "openai-usage";
|
|
82
101
|
const OPENAI_SETTINGS_COMMAND = "openai-settings";
|
|
@@ -367,7 +386,7 @@ export default function betterOpenAI(pi: ExtensionAPI): void {
|
|
|
367
386
|
renderExtra?: (width: number) => string[];
|
|
368
387
|
},
|
|
369
388
|
) {
|
|
370
|
-
const theme =
|
|
389
|
+
const theme = requireSettingsListTheme();
|
|
371
390
|
let selectedIndex = 0;
|
|
372
391
|
let searchQuery = "";
|
|
373
392
|
let closed = false;
|
|
@@ -814,6 +833,7 @@ export default function betterOpenAI(pi: ExtensionAPI): void {
|
|
|
814
833
|
ctx.ui.notify("Better OpenAI settings require interactive TUI mode.", "warning");
|
|
815
834
|
return;
|
|
816
835
|
}
|
|
836
|
+
await loadSettingsListTheme();
|
|
817
837
|
try {
|
|
818
838
|
petController.settingsPets = await listCodexPets();
|
|
819
839
|
} catch {
|
|
@@ -839,7 +859,7 @@ export default function betterOpenAI(pi: ExtensionAPI): void {
|
|
|
839
859
|
const settingsList = new SettingsList(
|
|
840
860
|
buildSettingsSections(ctx, refresh(ctx)),
|
|
841
861
|
8,
|
|
842
|
-
|
|
862
|
+
requireSettingsListTheme(),
|
|
843
863
|
(id, newValue) => {
|
|
844
864
|
if (!id.startsWith("section.")) writeSetting(ctx, id, newValue);
|
|
845
865
|
settingsList.updateValue(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monotykamary/pi-better-openai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"description": "Improve OpenAI in pi with fast mode, usage stats, realtime voice, image generation, and footer polish.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fast",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"ws": "8.21.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@earendil-works/pi-coding-agent": "0.84.
|
|
54
|
-
"@earendil-works/pi-tui": "0.84.
|
|
53
|
+
"@earendil-works/pi-coding-agent": "0.84.3",
|
|
54
|
+
"@earendil-works/pi-tui": "0.84.3",
|
|
55
55
|
"@types/node": "~22.19.0",
|
|
56
56
|
"@types/proxy-from-env": "1.0.4",
|
|
57
57
|
"@types/ws": "8.18.1",
|