@monotykamary/pi-better-openai 0.2.3 → 0.2.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/config.ts +39 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monotykamary/pi-better-openai",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
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",
package/src/config.ts CHANGED
@@ -45,6 +45,31 @@ export const DEFAULT_SUPPORTED_MODELS = [
45
45
  "openai-codex/gpt-5.5",
46
46
  ] as const;
47
47
 
48
+ // Earlier versions seeded config files with an explicit copy of the then-current
49
+ // default list. Treat those exact snapshots as unset so later additions to
50
+ // DEFAULT_SUPPORTED_MODELS (such as gpt-6-astra) reach existing installs.
51
+ const LEGACY_SEEDED_SUPPORTED_MODELS: readonly (readonly string[])[] = [
52
+ ["openai/gpt-5.4", "openai/gpt-5.5", "openai-codex/gpt-5.4", "openai-codex/gpt-5.5"],
53
+ [
54
+ "openai/gpt-5.4",
55
+ "openai/gpt-5.5",
56
+ "openai/gpt-5.6-sol",
57
+ "openai/gpt-5.6-terra",
58
+ "openai/gpt-5.6-luna",
59
+ "openai-codex/gpt-5.4",
60
+ "openai-codex/gpt-5.5",
61
+ ],
62
+ [
63
+ "openai/gpt-5.4",
64
+ "openai/gpt-5.5",
65
+ "openai-codex/gpt-5.6-sol",
66
+ "openai-codex/gpt-5.6-terra",
67
+ "openai-codex/gpt-5.6-luna",
68
+ "openai-codex/gpt-5.4",
69
+ "openai-codex/gpt-5.5",
70
+ ],
71
+ ];
72
+
48
73
  export type FooterMode = (typeof FOOTER_MODES)[number];
49
74
  export type ImageSaveMode = (typeof IMAGE_SAVE_MODES)[number];
50
75
  export type ImageOutputFormat = (typeof IMAGE_OUTPUT_FORMATS)[number];
@@ -194,11 +219,12 @@ export const DEFAULT_PET_CONFIG: Required<PetConfig> = {
194
219
  };
195
220
 
196
221
  export const DEFAULT_CONFIG: ConfigFile = {
222
+ // supportedModels is intentionally omitted so generated config files never pin
223
+ // the default list; resolution falls back to DEFAULT_SUPPORTED_MODELS live.
197
224
  persistState: true,
198
225
  notifyOnModelSwitch: true,
199
226
  active: false,
200
227
  desiredActive: false,
201
- supportedModels: [...DEFAULT_SUPPORTED_MODELS],
202
228
  usage: DEFAULT_USAGE_CONFIG,
203
229
  footer: DEFAULT_FOOTER_CONFIG,
204
230
  image: DEFAULT_IMAGE_CONFIG,
@@ -631,6 +657,14 @@ export function parseModels(value: unknown): SupportedModel[] | undefined {
631
657
  .filter((entry): entry is SupportedModel => entry !== undefined);
632
658
  }
633
659
 
660
+ function isLegacySeededSupportedModels(models: readonly SupportedModel[]): boolean {
661
+ return LEGACY_SEEDED_SUPPORTED_MODELS.some((snapshot) => {
662
+ if (snapshot.length !== models.length) return false;
663
+ const remaining = new Set(snapshot);
664
+ return models.every((model) => remaining.delete(`${model.provider}/${model.id}`));
665
+ });
666
+ }
667
+
634
668
  export function readRawConfig(path: string): Record<string, unknown> {
635
669
  if (!existsSync(path)) return {};
636
670
  try {
@@ -823,6 +857,7 @@ export function resolveConfig(cwd: string): ResolvedConfig {
823
857
  const merged = { ...DEFAULT_CONFIG, ...globalConfig, ...projectConfig };
824
858
  const selectedPath = projectConfigExists ? paths.project : paths.global;
825
859
  const desiredActive = merged.desiredActive ?? merged.active ?? false;
860
+ const configuredSupportedModels = parseModels(merged.supportedModels);
826
861
 
827
862
  return {
828
863
  configPath: selectedPath,
@@ -835,7 +870,9 @@ export function resolveConfig(cwd: string): ResolvedConfig {
835
870
  active: merged.active ?? desiredActive,
836
871
  desiredActive,
837
872
  supportedModels:
838
- parseModels(merged.supportedModels) ?? parseModels(DEFAULT_SUPPORTED_MODELS) ?? [],
873
+ configuredSupportedModels && !isLegacySeededSupportedModels(configuredSupportedModels)
874
+ ? configuredSupportedModels
875
+ : (parseModels(DEFAULT_SUPPORTED_MODELS) ?? []),
839
876
  usage: {
840
877
  ...DEFAULT_USAGE_CONFIG,
841
878
  ...globalConfig.usage,