@oh-my-pi/pi-catalog 18.2.9 → 18.2.11

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.
@@ -1,4 +1,5 @@
1
1
  import { CHARM_HYPER_API_BASE_URL, normalizeCharmHyperBaseUrl } from "../wire/charm-hyper";
2
+ import { CODEX_CLIENT_VERSION } from "../wire/codex";
2
3
  import { PERSONAL_GITHUB_COPILOT_BASE_URL } from "../wire/github-copilot";
3
4
  import {
4
5
  SINGULARITYAPI_DEV_API_BASE_URL,
@@ -68,6 +69,9 @@ export function resolveOllamaModelCacheProviderId(providerId: string, baseUrl?:
68
69
  /** Resolve the cache namespace used by a provider's model-manager options without constructing those options. */
69
70
  export function resolveModelCacheProviderId(providerId: string, options: ModelCacheProviderIdOptions = {}): string {
70
71
  switch (providerId) {
72
+ case "openai-codex":
73
+ // The backend filters the roster by client version.
74
+ return `${providerId}:${CODEX_CLIENT_VERSION}`;
71
75
  case "ollama":
72
76
  return resolveOllamaModelCacheProviderId(providerId, options.baseUrl);
73
77
  case "cursor":
@@ -61,6 +61,7 @@ import {
61
61
  siliconflowModelManagerOptions,
62
62
  singularityApiDevModelManagerOptions,
63
63
  singularityApiTechModelManagerOptions,
64
+ stepfunModelManagerOptions,
64
65
  syntheticModelManagerOptions,
65
66
  togetherModelManagerOptions,
66
67
  umansModelManagerOptions,
@@ -141,6 +142,7 @@ const MODEL_MANAGER_FACTORIES: Readonly<Partial<Record<KnownProvider, ModelManag
141
142
  "siliconflow-cn": config => siliconflowCnModelManagerOptions(config),
142
143
  "singularityapi-dev": config => singularityApiDevModelManagerOptions(config),
143
144
  "singularityapi-tech": config => singularityApiTechModelManagerOptions(config),
145
+ stepfun: config => stepfunModelManagerOptions(config),
144
146
  synthetic: config => syntheticModelManagerOptions(config),
145
147
  together: config => togetherModelManagerOptions(config),
146
148
  typesafe: config => typesafeModelManagerOptions(config),
@@ -4956,6 +4956,86 @@ export function yoloAutoModelManagerOptions(
4956
4956
  }
4957
4957
 
4958
4958
  // ---------------------------------------------------------------------------
4959
+ // 16.9 StepFun
4960
+ // ---------------------------------------------------------------------------
4961
+
4962
+ /**
4963
+ * StepFun discovery configuration: the API key plus optional base-URL and
4964
+ * fetch overrides. Consumed by {@link stepfunModelManagerOptions}, and exported
4965
+ * for extensions and tests that construct the manager directly.
4966
+ */
4967
+ export interface StepfunModelManagerConfig {
4968
+ apiKey?: string;
4969
+ baseUrl?: string;
4970
+ fetch?: FetchImpl;
4971
+ }
4972
+
4973
+ /** StepFun's `/v1/models` row shape beyond the generic OpenAI-compatible fields. */
4974
+ interface StepfunModelRecord extends OpenAICompatibleModelRecord {
4975
+ /** Reasoning tiers the endpoint advertises for the model, e.g. `["low","medium","high"]`. */
4976
+ reasoning_effort_support_list?: unknown;
4977
+ }
4978
+
4979
+ /**
4980
+ * Translate StepFun's per-model `reasoning_effort_support_list` into a ladder.
4981
+ * Every advertised value that names an OMP tier maps verbatim, in OMP's tier
4982
+ * order; a row advertising nothing (or only tiers this client does not know)
4983
+ * resolves to no thinking, so the wire path never sends a `reasoning_effort`
4984
+ * the endpoint rejects. Same shape as `mapOpenRouterThinking` for OpenRouter's
4985
+ * `reasoning.supported_efforts`.
4986
+ */
4987
+ function mapStepfunThinking(entry: StepfunModelRecord): ThinkingConfig | undefined {
4988
+ const advertised = Array.isArray(entry.reasoning_effort_support_list)
4989
+ ? entry.reasoning_effort_support_list.filter((value): value is string => typeof value === "string")
4990
+ : [];
4991
+ const efforts = THINKING_EFFORTS.filter(effort => advertised.includes(effort));
4992
+ return efforts.length === 0 ? undefined : { mode: "effort", efforts };
4993
+ }
4994
+
4995
+ /**
4996
+ * Whether a StepFun `/v1/models` id is a chat model omp can route. StepFun's
4997
+ * roster interleaves its audio and image SKUs with the chat models; the
4998
+ * exclusion policy itself lives in `runtime/behavior.kdl` (`exclude-models
4999
+ * provider="stepfun"`), not here.
5000
+ */
5001
+ export function isStepfunChatModelId(id: string): boolean {
5002
+ const normalized = id.trim().toLowerCase();
5003
+ if (!normalized) return false;
5004
+ return !isExcludedModel("stepfun", normalized);
5005
+ }
5006
+
5007
+ /**
5008
+ * StepFun model manager: plain OpenAI-compatible chat completions at
5009
+ * `api.stepfun.ai/v1`. A successful `/v1/models` snapshot is authoritative over
5010
+ * the bundled seed rows (`providers/stepfun.kdl`), so a model StepFun retires
5011
+ * leaves the picker instead of lingering as a dead seed row, while models added
5012
+ * later become selectable without an omp release.
5013
+ */
5014
+ export function stepfunModelManagerOptions(
5015
+ config?: StepfunModelManagerConfig,
5016
+ ): ModelManagerOptions<"openai-completions"> {
5017
+ return createOpenAICompatibleModelManagerOptions({
5018
+ api: "openai-completions",
5019
+ providerId: "stepfun",
5020
+ defaultBaseUrl: "https://api.stepfun.ai/v1",
5021
+ config,
5022
+ requireApiKey: true,
5023
+ filterModel: (_entry, model) => isStepfunChatModelId(model.id),
5024
+ mapModel: (entry, model, reference) => {
5025
+ const mapped = mapWithBundledReference(entry, model, reference);
5026
+ // A model StepFun ships later has no bundled reference, so it starts
5027
+ // from the generic defaults (`reasoning: false`, no thinking) and
5028
+ // `mergeDynamicModels` adds it verbatim — the endpoint's own tiers are
5029
+ // then the only thing that can give it a reasoning dial.
5030
+ if (reference) return mapped;
5031
+ const thinking = mapStepfunThinking(entry);
5032
+ return thinking === undefined ? mapped : { ...mapped, reasoning: true, thinking };
5033
+ },
5034
+ // Must live on the manager options, not only the KDL descriptor:
5035
+ // `createModelManager()` prunes the bundled slice from this flag.
5036
+ dynamicModelsAuthoritative: true,
5037
+ });
5038
+ }
4959
5039
 
4960
5040
  // ---------------------------------------------------------------------------
4961
5041
  // 17. Qwen Portal
@@ -5936,6 +6016,9 @@ export interface GithubCopilotModelManagerConfig {
5936
6016
  fetch?: FetchImpl;
5937
6017
  }
5938
6018
 
6019
+ // Copilot ids whose cached route predates the Responses pin: a cache written by
6020
+ // an older build still says openai-completions, which Copilot answers with 400
6021
+ // unsupported_api_for_model (#7096, #8807, #12901).
5939
6022
  const COPILOT_CACHE_INVALIDATED_MODEL_IDS = [
5940
6023
  "gpt-6-astra",
5941
6024
  "gpt-6-astra-1m",
@@ -5943,6 +6026,8 @@ const COPILOT_CACHE_INVALIDATED_MODEL_IDS = [
5943
6026
  "grok-4.5-1m",
5944
6027
  "grok-4.6",
5945
6028
  "grok-4.6-1m",
6029
+ "grok-4.7",
6030
+ "grok-4.7-1m",
5946
6031
  "mai-code-1-flash-picker",
5947
6032
  ];
5948
6033
 
@@ -6211,7 +6296,13 @@ export function githubCopilotModelManagerOptions(config?: GithubCopilotModelMana
6211
6296
  supportsReasoningEffort: false,
6212
6297
  },
6213
6298
  }
6214
- : {}),
6299
+ : // The bundled row for an id whose route later moved to
6300
+ // Responses/Messages still carries this chat-completions
6301
+ // block, and `supportsReasoningEffort: false` suppresses
6302
+ // the effort dial on a transport that supports it
6303
+ // (grok-4.7, #12901). Compat is transport-scoped: let the
6304
+ // rules resolve it for the route actually in use.
6305
+ { compat: undefined }),
6215
6306
  }
6216
6307
  : {
6217
6308
  ...defaults,
@@ -50,6 +50,7 @@ export function openaiCodexModelManagerOptions(
50
50
  const { resolveAccounts, clientVersion, fetch } = config;
51
51
  return {
52
52
  providerId: "openai-codex",
53
+ cacheProviderId: resolveModelCacheProviderId("openai-codex"),
53
54
  dynamicModelsAuthoritative: true,
54
55
  ...(resolveAccounts
55
56
  ? {
package/src/wire/codex.ts CHANGED
@@ -6,12 +6,13 @@ export const CODEX_BASE_URL = "https://chatgpt.com/backend-api";
6
6
 
7
7
  /**
8
8
  * Pinned OpenAI Codex client version (corresponds to @openai/codex package version).
9
+ * Updated from npm by `bun run check-spoofed-versions --update`.
9
10
  *
10
11
  * The backend version-gates model availability against this value on both
11
- * `/models?client_version=` and `/responses` (`gpt-6-astra` requires ≥ 0.153.0);
12
- * an older pin silently hides newer SKUs from discovery.
12
+ * `/models?client_version=` and `/responses`; 0.155.1 exposes GPT-6 Sol and Luna.
13
+ * An older pin silently hides newer SKUs from discovery.
13
14
  */
14
- export const CODEX_CLIENT_VERSION = "0.153.0";
15
+ export const CODEX_CLIENT_VERSION = "0.155.1";
15
16
 
16
17
  export const OPENAI_HEADERS = {
17
18
  BETA: "OpenAI-Beta",