@opengeni/config 2.0.0 → 2.1.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/dist/index.d.ts CHANGED
@@ -190,6 +190,7 @@ declare const SettingsSchema: z.ZodObject<{
190
190
  computer_observe: "computer_observe";
191
191
  computer_open: "computer_open";
192
192
  computer_targets: "computer_targets";
193
+ connected_machine_enroll_token: "connected_machine_enroll_token";
193
194
  connected_machine_remove: "connected_machine_remove";
194
195
  editable_artifact_apply: "editable_artifact_apply";
195
196
  editable_artifact_create: "editable_artifact_create";
@@ -359,6 +360,7 @@ declare const SettingsSchema: z.ZodObject<{
359
360
  computer_observe: "computer_observe";
360
361
  computer_open: "computer_open";
361
362
  computer_targets: "computer_targets";
363
+ connected_machine_enroll_token: "connected_machine_enroll_token";
362
364
  connected_machine_remove: "connected_machine_remove";
363
365
  editable_artifact_apply: "editable_artifact_apply";
364
366
  editable_artifact_create: "editable_artifact_create";
@@ -504,6 +506,7 @@ declare const SettingsSchema: z.ZodObject<{
504
506
  environmentsEncryptionKey: z.ZodOptional<z.ZodString>;
505
507
  integrationsEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
506
508
  integrationsStateSecret: z.ZodOptional<z.ZodString>;
509
+ integrationsOauthShortStateEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
507
510
  integrationsAllowPrivateNetworkTargets: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
508
511
  integrationsOauthClientsJson: z.ZodDefault<z.ZodString>;
509
512
  slackClientId: z.ZodOptional<z.ZodString>;
@@ -605,6 +608,7 @@ declare const SettingsSchema: z.ZodObject<{
605
608
  openrouterApiKey: z.ZodOptional<z.ZodString>;
606
609
  resolvedGatewayModelsJson: z.ZodOptional<z.ZodString>;
607
610
  resolvedOpenRouterModelsJson: z.ZodOptional<z.ZodString>;
611
+ resolvedCodexModelsJson: z.ZodOptional<z.ZodString>;
608
612
  modelProvidersJson: z.ZodDefault<z.ZodString>;
609
613
  codexSubscriptionEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
610
614
  supergrokSubscriptionEnabled: z.ZodDefault<z.ZodPreprocess<z.ZodBoolean>>;
@@ -1970,6 +1974,166 @@ export declare const ModelCatalogDocument: z.ZodObject<{
1970
1974
  publicDefaultHeaderNames: z.ZodOptional<z.ZodNever>;
1971
1975
  publicDefaultQueryNames: z.ZodOptional<z.ZodNever>;
1972
1976
  }, z.core.$strict>>>;
1977
+ codexModels: z.ZodOptional<z.ZodArray<z.ZodObject<{
1978
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
1979
+ label: z.ZodOptional<z.ZodString>;
1980
+ shortLabel: z.ZodOptional<z.ZodString>;
1981
+ contextWindowTokens: z.ZodOptional<z.ZodNumber>;
1982
+ effectiveContextWindowTokens: z.ZodOptional<z.ZodNumber>;
1983
+ autoCompactTokenLimit: z.ZodOptional<z.ZodNumber>;
1984
+ toolOutputTruncationTokens: z.ZodOptional<z.ZodNumber>;
1985
+ reasoningEffort: z.ZodOptional<z.ZodBoolean>;
1986
+ hostedWebSearch: z.ZodOptional<z.ZodBoolean>;
1987
+ credentialSource: z.ZodOptional<z.ZodNever>;
1988
+ billing: z.ZodOptional<z.ZodNever>;
1989
+ retired: z.ZodOptional<z.ZodBoolean>;
1990
+ id: z.ZodString;
1991
+ upstreamModelId: z.ZodString;
1992
+ capabilities: z.ZodObject<{
1993
+ reasoning: z.ZodObject<{
1994
+ upstream: z.ZodEnum<{
1995
+ supported: "supported";
1996
+ unknown: "unknown";
1997
+ unsupported: "unsupported";
1998
+ }>;
1999
+ runnable: z.ZodBoolean;
2000
+ efforts: z.ZodArray<z.ZodEnum<{
2001
+ high: "high";
2002
+ low: "low";
2003
+ max: "max";
2004
+ medium: "medium";
2005
+ minimal: "minimal";
2006
+ none: "none";
2007
+ xhigh: "xhigh";
2008
+ }>>;
2009
+ defaultEffort: z.ZodNullable<z.ZodEnum<{
2010
+ high: "high";
2011
+ low: "low";
2012
+ max: "max";
2013
+ medium: "medium";
2014
+ minimal: "minimal";
2015
+ none: "none";
2016
+ xhigh: "xhigh";
2017
+ }>>;
2018
+ required: z.ZodBoolean;
2019
+ }, z.core.$strip>;
2020
+ functionCalling: z.ZodObject<{
2021
+ upstream: z.ZodEnum<{
2022
+ supported: "supported";
2023
+ unknown: "unknown";
2024
+ unsupported: "unsupported";
2025
+ }>;
2026
+ runnable: z.ZodBoolean;
2027
+ }, z.core.$strip>;
2028
+ structuredOutput: z.ZodObject<{
2029
+ upstream: z.ZodEnum<{
2030
+ supported: "supported";
2031
+ unknown: "unknown";
2032
+ unsupported: "unsupported";
2033
+ }>;
2034
+ runnable: z.ZodBoolean;
2035
+ }, z.core.$strip>;
2036
+ hostedTools: z.ZodObject<{
2037
+ webSearch: z.ZodObject<{
2038
+ upstream: z.ZodEnum<{
2039
+ supported: "supported";
2040
+ unknown: "unknown";
2041
+ unsupported: "unsupported";
2042
+ }>;
2043
+ runnable: z.ZodBoolean;
2044
+ }, z.core.$strip>;
2045
+ xSearch: z.ZodObject<{
2046
+ upstream: z.ZodEnum<{
2047
+ supported: "supported";
2048
+ unknown: "unknown";
2049
+ unsupported: "unsupported";
2050
+ }>;
2051
+ runnable: z.ZodBoolean;
2052
+ }, z.core.$strip>;
2053
+ codeExecution: z.ZodObject<{
2054
+ upstream: z.ZodEnum<{
2055
+ supported: "supported";
2056
+ unknown: "unknown";
2057
+ unsupported: "unsupported";
2058
+ }>;
2059
+ runnable: z.ZodBoolean;
2060
+ }, z.core.$strip>;
2061
+ imageGeneration: z.ZodDefault<z.ZodObject<{
2062
+ upstream: z.ZodEnum<{
2063
+ supported: "supported";
2064
+ unknown: "unknown";
2065
+ unsupported: "unsupported";
2066
+ }>;
2067
+ runnable: z.ZodBoolean;
2068
+ }, z.core.$strip>>;
2069
+ }, z.core.$strip>;
2070
+ inputModalities: z.ZodArray<z.ZodEnum<{
2071
+ audio: "audio";
2072
+ image: "image";
2073
+ text: "text";
2074
+ }>>;
2075
+ inputFileMediaTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
2076
+ outputModalities: z.ZodArray<z.ZodEnum<{
2077
+ audio: "audio";
2078
+ image: "image";
2079
+ text: "text";
2080
+ }>>;
2081
+ transports: z.ZodObject<{
2082
+ sse: z.ZodObject<{
2083
+ upstream: z.ZodEnum<{
2084
+ supported: "supported";
2085
+ unknown: "unknown";
2086
+ unsupported: "unsupported";
2087
+ }>;
2088
+ runnable: z.ZodBoolean;
2089
+ }, z.core.$strip>;
2090
+ responsesWebSocket: z.ZodObject<{
2091
+ upstream: z.ZodEnum<{
2092
+ supported: "supported";
2093
+ unknown: "unknown";
2094
+ unsupported: "unsupported";
2095
+ }>;
2096
+ runnable: z.ZodBoolean;
2097
+ }, z.core.$strip>;
2098
+ realtimeAudio: z.ZodObject<{
2099
+ upstream: z.ZodEnum<{
2100
+ supported: "supported";
2101
+ unknown: "unknown";
2102
+ unsupported: "unsupported";
2103
+ }>;
2104
+ runnable: z.ZodBoolean;
2105
+ }, z.core.$strip>;
2106
+ }, z.core.$strip>;
2107
+ promptCaching: z.ZodOptional<z.ZodObject<{
2108
+ upstream: z.ZodEnum<{
2109
+ supported: "supported";
2110
+ unknown: "unknown";
2111
+ unsupported: "unsupported";
2112
+ }>;
2113
+ runnable: z.ZodBoolean;
2114
+ mode: z.ZodEnum<{
2115
+ automatic: "automatic";
2116
+ implicit: "implicit";
2117
+ none: "none";
2118
+ }>;
2119
+ }, z.core.$strip>>;
2120
+ latencyModes: z.ZodArray<z.ZodObject<{
2121
+ id: z.ZodEnum<{
2122
+ fast: "fast";
2123
+ priority: "priority";
2124
+ standard: "standard";
2125
+ }>;
2126
+ upstream: z.ZodEnum<{
2127
+ supported: "supported";
2128
+ unknown: "unknown";
2129
+ unsupported: "unsupported";
2130
+ }>;
2131
+ runnable: z.ZodBoolean;
2132
+ billingMultiplierBps: z.ZodOptional<z.ZodNumber>;
2133
+ }, z.core.$strip>>;
2134
+ }, z.core.$strip>;
2135
+ pricing: z.ZodOptional<z.ZodNever>;
2136
+ }, z.core.$strict>>>;
1973
2137
  gatewayModels: z.ZodDefault<z.ZodArray<z.ZodObject<{
1974
2138
  productId: z.ZodString;
1975
2139
  workspaceProductId: z.ZodString;
@@ -2500,6 +2664,14 @@ export declare function canonicalizeConfiguredModelId(settings: Settings, modelI
2500
2664
  * openai allow-list, then registry ids.
2501
2665
  */
2502
2666
  export declare function configuredAllowedModels(settings: Settings): string[];
2667
+ /** Retirement is selection metadata, never provider authority or executable identity. */
2668
+ export declare function isModelAvailableForNewSelection(settings: Settings, modelId: string): boolean;
2669
+ /** Called only with the durable policy installed for a claimed accepted attempt. */
2670
+ export declare function settingsForAcceptedSubscriptionTurn(settings: Settings, policy: TurnExecutionPolicyV1, expected: {
2671
+ modelId: string;
2672
+ reasoningEffort: Settings["openaiReasoningEffort"];
2673
+ latencyMode?: LatencyMode;
2674
+ }): Settings;
2503
2675
  /**
2504
2676
  * Resolve a model string to the provider that serves it and its configured
2505
2677
  * shape. Returns undefined when the id is not exposed (built-in allow-list nor
package/dist/index.js CHANGED
@@ -311,6 +311,7 @@ var SettingsSchema = z.object({
311
311
  environmentsEncryptionKey: z.string().optional(),
312
312
  integrationsEnabled: EnvBoolean.default(false),
313
313
  integrationsStateSecret: z.string().optional(),
314
+ integrationsOauthShortStateEnabled: EnvBoolean.default(false),
314
315
  integrationsAllowPrivateNetworkTargets: EnvBoolean.default(false),
315
316
  integrationsOauthClientsJson: z.string().default("{}"),
316
317
  slackClientId: z.string().optional(),
@@ -436,8 +437,8 @@ var SettingsSchema = z.object({
436
437
  openaiProvider: z.enum(["openai", "azure"]).default("openai"),
437
438
  openaiApiKey: z.string().optional(),
438
439
  openaiBaseUrl: z.string().optional(),
439
- openaiModel: z.string().default("gpt-5.6-sol"),
440
- openaiAllowedModels: z.string().default("gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-luna"),
440
+ openaiModel: z.string().default("gpt-6-astra"),
441
+ openaiAllowedModels: z.string().default("gpt-6-astra,gpt-6-sol,gpt-6-luna"),
441
442
  // OpenGeni-managed Vercel AI Gateway. When configured, the two reviewed
442
443
  // Gateway models below are added to the managed-credit catalog. Workspace
443
444
  // Gateway keys use the encrypted connection broker and never this secret.
@@ -514,6 +515,7 @@ var SettingsSchema = z.object({
514
515
  // binding so database mode cannot be bypassed with a second source.
515
516
  resolvedGatewayModelsJson: z.string().optional(),
516
517
  resolvedOpenRouterModelsJson: z.string().optional(),
518
+ resolvedCodexModelsJson: z.string().optional(),
517
519
  // Extra (non-built-in) model providers, declared by the host as a JSON
518
520
  // provider registry. Each entry carries its own base URL, API key, wire API
519
521
  // ("responses" | "chat") and the models it exposes. The models a client may
@@ -1255,6 +1257,9 @@ function personalGitHubOAuthCallbackUrl(publicBaseUrl) {
1255
1257
  const origin = canonicalPublicOrigin(publicBaseUrl);
1256
1258
  return origin ? `${origin}/v1/integrations/github-personal/oauth/callback` : null;
1257
1259
  }
1260
+ function usableDeploymentSecret(value) {
1261
+ return isUsableVoiceInputSecret(value) ? value : void 0;
1262
+ }
1258
1263
  function isUsableVoiceInputSecret(value) {
1259
1264
  if (value == null) return false;
1260
1265
  const trimmed = value.trim();
@@ -1728,14 +1733,30 @@ var DeploymentRegistryProviderSchema = RegistryProviderSchema.safeExtend({
1728
1733
  var DeploymentGatewayCatalogModelSchema = GatewayCatalogModel.safeExtend({
1729
1734
  pricing: z.never().optional()
1730
1735
  }).strict();
1736
+ var CodexCatalogModelSchema = RegistryModelSchema.safeExtend({
1737
+ retired: z.boolean().optional(),
1738
+ id: z.string().regex(/^codex\/[a-zA-Z0-9][a-zA-Z0-9._-]*$/),
1739
+ upstreamModelId: z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/),
1740
+ capabilities: ModelCapabilitiesV1Schema,
1741
+ pricing: z.never().optional()
1742
+ }).strict().superRefine((model, context) => {
1743
+ if (model.id !== `${CODEX_MODEL_ID_PREFIX}${model.upstreamModelId}`) {
1744
+ context.addIssue({
1745
+ code: "custom",
1746
+ path: ["id"],
1747
+ message: "Codex product id must match its upstream model slug"
1748
+ });
1749
+ }
1750
+ });
1731
1751
  var ModelCatalogDocument = z.object({
1732
1752
  schemaVersion: z.literal(1),
1733
1753
  /** Canonical deployment default. Omission preserves the V1 first-built-in
1734
1754
  * fallback for existing documents; operators should set this explicitly
1735
1755
  * when cutting over a registry or connected-subscription default. */
1736
1756
  defaultModel: z.string().min(1).optional(),
1737
- builtInModels: z.array(z.string().min(1)).min(1),
1757
+ builtInModels: z.array(z.string().min(1)),
1738
1758
  registryProviders: z.array(DeploymentRegistryProviderSchema).default([]),
1759
+ codexModels: z.array(CodexCatalogModelSchema).optional(),
1739
1760
  gatewayModels: z.array(DeploymentGatewayCatalogModelSchema).default([]),
1740
1761
  openrouterModels: z.array(OpenRouterCatalogModel).default([]),
1741
1762
  modelNotes: z.record(z.string().min(1), ModelNote).default({}),
@@ -1744,6 +1765,13 @@ var ModelCatalogDocument = z.object({
1744
1765
  apiKey: z.never().optional(),
1745
1766
  bands: z.never().optional()
1746
1767
  }).strict().superRefine((document, context) => {
1768
+ if (document.builtInModels.length === 0 && !document.defaultModel) {
1769
+ context.addIssue({
1770
+ code: "custom",
1771
+ path: ["defaultModel"],
1772
+ message: "catalogs without built-in models require an explicit default model"
1773
+ });
1774
+ }
1747
1775
  const productIds = /* @__PURE__ */ new Set();
1748
1776
  const providerIds = /* @__PURE__ */ new Set();
1749
1777
  const gatewayUpstreamIds = /* @__PURE__ */ new Set();
@@ -1765,6 +1793,14 @@ var ModelCatalogDocument = z.object({
1765
1793
  productIds.add(id);
1766
1794
  };
1767
1795
  document.builtInModels.forEach((id, index) => add(id, ["builtInModels", index]));
1796
+ document.codexModels?.forEach((model, index) => add(model.id, ["codexModels", index, "id"]));
1797
+ if (document.codexModels?.some((model) => model.retired && model.id === document.defaultModel)) {
1798
+ context.addIssue({
1799
+ code: "custom",
1800
+ path: ["defaultModel"],
1801
+ message: "a retired model cannot be the deployment default"
1802
+ });
1803
+ }
1768
1804
  document.registryProviders.forEach((provider, providerIndex) => {
1769
1805
  if (RESERVED_MODEL_PROVIDER_IDS.has(provider.id)) {
1770
1806
  context.addIssue({
@@ -1811,7 +1847,7 @@ var ModelCatalogDocument = z.object({
1811
1847
  message: "catalog default model must not contain newlines or the | field separator"
1812
1848
  });
1813
1849
  }
1814
- if (document.defaultModel && !productIds.has(document.defaultModel) && !document.defaultModel.startsWith(CODEX_MODEL_ID_PREFIX) && !document.defaultModel.startsWith(XAI_SUBSCRIPTION_MODEL_ID_PREFIX)) {
1850
+ if (document.defaultModel && !productIds.has(document.defaultModel) && !(document.codexModels === void 0 && document.defaultModel.startsWith(CODEX_MODEL_ID_PREFIX)) && !document.defaultModel.startsWith(XAI_SUBSCRIPTION_MODEL_ID_PREFIX)) {
1815
1851
  context.addIssue({
1816
1852
  code: "custom",
1817
1853
  path: ["defaultModel"],
@@ -1881,6 +1917,7 @@ function applyModelCatalogDocument(settings, rawDocument) {
1881
1917
  ),
1882
1918
  resolvedGatewayModelsJson: JSON.stringify(document.gatewayModels),
1883
1919
  resolvedOpenRouterModelsJson: JSON.stringify(document.openrouterModels),
1920
+ resolvedCodexModelsJson: document.codexModels === void 0 ? void 0 : JSON.stringify(document.codexModels),
1884
1921
  modelNotesJson: JSON.stringify(document.modelNotes)
1885
1922
  };
1886
1923
  return resolved;
@@ -2053,6 +2090,73 @@ function configuredOpenRouterOrganizationProductModelIds(settings) {
2053
2090
  return [];
2054
2091
  }
2055
2092
  var defaultModelPricing = {
2093
+ "gpt-6-astra": {
2094
+ default: {
2095
+ // OpenAI list price: $10 / $1 cached / $12.50 cache write / $50 output.
2096
+ inputMicrosPerMillionTokens: 1e7,
2097
+ cachedInputMicrosPerMillionTokens: 1e6,
2098
+ cacheWriteMicrosPerMillionTokens: 125e5,
2099
+ outputMicrosPerMillionTokens: 5e7,
2100
+ marginBps: 500
2101
+ },
2102
+ inputTokenTiers: [
2103
+ {
2104
+ // Prompts with more than 272K input tokens use 2x input and 1.5x output.
2105
+ minimumInputTokens: 272001,
2106
+ pricing: {
2107
+ inputMicrosPerMillionTokens: 2e7,
2108
+ cachedInputMicrosPerMillionTokens: 2e6,
2109
+ cacheWriteMicrosPerMillionTokens: 25e6,
2110
+ outputMicrosPerMillionTokens: 75e6,
2111
+ marginBps: 500
2112
+ }
2113
+ }
2114
+ ]
2115
+ },
2116
+ "gpt-6-sol": {
2117
+ default: {
2118
+ // OpenAI list price: $2 / $0.20 cached / $2.50 cache write / $10 output.
2119
+ inputMicrosPerMillionTokens: 2e6,
2120
+ cachedInputMicrosPerMillionTokens: 2e5,
2121
+ cacheWriteMicrosPerMillionTokens: 25e5,
2122
+ outputMicrosPerMillionTokens: 1e7,
2123
+ marginBps: 500
2124
+ },
2125
+ inputTokenTiers: [
2126
+ {
2127
+ minimumInputTokens: 272001,
2128
+ pricing: {
2129
+ inputMicrosPerMillionTokens: 4e6,
2130
+ cachedInputMicrosPerMillionTokens: 4e5,
2131
+ cacheWriteMicrosPerMillionTokens: 5e6,
2132
+ outputMicrosPerMillionTokens: 15e6,
2133
+ marginBps: 500
2134
+ }
2135
+ }
2136
+ ]
2137
+ },
2138
+ "gpt-6-luna": {
2139
+ default: {
2140
+ // OpenAI list price: $0.10 / $0.01 cached / $0.125 cache write / $0.50 output.
2141
+ inputMicrosPerMillionTokens: 1e5,
2142
+ cachedInputMicrosPerMillionTokens: 1e4,
2143
+ cacheWriteMicrosPerMillionTokens: 125e3,
2144
+ outputMicrosPerMillionTokens: 5e5,
2145
+ marginBps: 500
2146
+ },
2147
+ inputTokenTiers: [
2148
+ {
2149
+ minimumInputTokens: 272001,
2150
+ pricing: {
2151
+ inputMicrosPerMillionTokens: 2e5,
2152
+ cachedInputMicrosPerMillionTokens: 2e4,
2153
+ cacheWriteMicrosPerMillionTokens: 25e4,
2154
+ outputMicrosPerMillionTokens: 75e4,
2155
+ marginBps: 500
2156
+ }
2157
+ }
2158
+ ]
2159
+ },
2056
2160
  "gpt-5.6-sol": {
2057
2161
  default: {
2058
2162
  // Promotional OpenAI pricing, guaranteed through at least 2026-11-21.
@@ -2293,6 +2397,7 @@ function getSettings(source = process.env) {
2293
2397
  environmentsEncryptionKey: optional("OPENGENI_ENVIRONMENTS_ENCRYPTION_KEY"),
2294
2398
  integrationsEnabled: optional("OPENGENI_INTEGRATIONS_ENABLED"),
2295
2399
  integrationsStateSecret: optional("OPENGENI_INTEGRATIONS_STATE_SECRET"),
2400
+ integrationsOauthShortStateEnabled: optional("OPENGENI_INTEGRATIONS_OAUTH_SHORT_STATE_ENABLED"),
2296
2401
  integrationsAllowPrivateNetworkTargets: optional(
2297
2402
  "OPENGENI_INTEGRATIONS_ALLOW_PRIVATE_NETWORK_TARGETS"
2298
2403
  ),
@@ -3282,8 +3387,8 @@ function productLabelForModelId(modelId) {
3282
3387
  function productShortLabelForModelId(modelId) {
3283
3388
  const slug = modelId.startsWith(CODEX_MODEL_ID_PREFIX) ? modelId.slice(CODEX_MODEL_ID_PREFIX.length) : modelId;
3284
3389
  switch (slug) {
3285
- case "grok-4.6":
3286
- return "4.6";
3390
+ case "grok-4.7":
3391
+ return "4.7";
3287
3392
  case "gpt-5.6-sol":
3288
3393
  return "5.6 Sol";
3289
3394
  case "gpt-5.6-terra":
@@ -3292,6 +3397,10 @@ function productShortLabelForModelId(modelId) {
3292
3397
  return "5.6 Luna";
3293
3398
  case "gpt-6-astra":
3294
3399
  return "6 Astra";
3400
+ case "gpt-6-sol":
3401
+ return "6 Sol";
3402
+ case "gpt-6-luna":
3403
+ return "6 Luna";
3295
3404
  default:
3296
3405
  return null;
3297
3406
  }
@@ -3311,7 +3420,7 @@ function builtinContextLimitsForModel(settings, modelId) {
3311
3420
  return { contextWindowTokens: settings.contextWindowTokens };
3312
3421
  }
3313
3422
  function builtinLatencyModesForModel(modelId) {
3314
- if (isBuiltinGpt56ModelId(modelId) || modelId.startsWith("codex/gpt-5.6-") || modelId === "codex/gpt-6-astra") {
3423
+ if (isBuiltinGpt56ModelId(modelId) || modelId.startsWith("gpt-6-") || modelId.startsWith("codex/gpt-5.6-") || modelId.startsWith("codex/gpt-6-")) {
3315
3424
  return [
3316
3425
  { id: "standard", upstream: "supported", runnable: true },
3317
3426
  {
@@ -3326,10 +3435,10 @@ function builtinLatencyModesForModel(modelId) {
3326
3435
  }
3327
3436
  function builtinPromptCachingForModel(modelId) {
3328
3437
  const slug = modelId.startsWith(CODEX_MODEL_ID_PREFIX) ? modelId.slice(CODEX_MODEL_ID_PREFIX.length) : modelId;
3329
- return slug.startsWith("gpt-5.6-") ? { upstream: "supported", runnable: true, mode: "implicit" } : void 0;
3438
+ return slug.startsWith("gpt-5.6-") || slug.startsWith("gpt-6-") ? { upstream: "supported", runnable: true, mode: "implicit" } : void 0;
3330
3439
  }
3331
3440
  function builtinHostedImageGenerationForModel(settings, modelId) {
3332
- return settings.openaiProvider === "openai" && isDirectOpenAiApiBaseUrl(settings.openaiBaseUrl) && isBuiltinGpt56ModelId(modelId);
3441
+ return settings.openaiProvider === "openai" && isDirectOpenAiApiBaseUrl(settings.openaiBaseUrl) && (isBuiltinGpt56ModelId(modelId) || modelId.startsWith("gpt-6-"));
3333
3442
  }
3334
3443
  function isDirectOpenAiApiBaseUrl(baseUrl) {
3335
3444
  if (baseUrl === void 0) return true;
@@ -3523,10 +3632,10 @@ function configuredProviders(settings, source = process.env) {
3523
3632
  if (settings.openaiProvider === "azure") {
3524
3633
  const baseUrl = settings.azureOpenaiBaseUrl ?? settings.azureOpenaiEndpoint;
3525
3634
  builtin.baseUrl = baseUrl ? normalizeRegistryBaseUrl(baseUrl, builtin.id) : void 0;
3526
- builtin.apiKey = settings.azureOpenaiApiKey ?? settings.azureOpenaiAdToken;
3635
+ builtin.apiKey = usableDeploymentSecret(settings.azureOpenaiApiKey) ?? settings.azureOpenaiAdToken;
3527
3636
  } else {
3528
3637
  builtin.baseUrl = settings.openaiBaseUrl ? normalizeRegistryBaseUrl(settings.openaiBaseUrl, builtin.id) : void 0;
3529
- builtin.apiKey = settings.openaiApiKey;
3638
+ builtin.apiKey = usableDeploymentSecret(settings.openaiApiKey);
3530
3639
  }
3531
3640
  const registry = configuredRegistryProviders(settings).map(
3532
3641
  (provider) => ({
@@ -3553,6 +3662,8 @@ function withCodexCatalogProvider(settings) {
3553
3662
  if (providers.some((provider2) => provider2.id === CODEX_PROVIDER_ID)) {
3554
3663
  return settings;
3555
3664
  }
3665
+ const catalogModels = settings.resolvedCodexModelsJson === void 0 ? void 0 : z.array(CodexCatalogModelSchema).parse(JSON.parse(settings.resolvedCodexModelsJson)).filter((model) => !model.retired).map(({ retired: _retired, ...model }) => model);
3666
+ if (catalogModels?.length === 0) return settings;
3556
3667
  const provider = {
3557
3668
  kind: "codex-subscription",
3558
3669
  id: CODEX_PROVIDER_ID,
@@ -3560,12 +3671,12 @@ function withCodexCatalogProvider(settings) {
3560
3671
  api: "responses",
3561
3672
  wireProfile: "openai",
3562
3673
  baseUrl: CODEX_PROVIDER_BASE_URL,
3563
- models: CODEX_FALLBACK_MODEL_SLUGS.map((slug) => {
3674
+ models: catalogModels ?? CODEX_FALLBACK_MODEL_SLUGS.map((slug) => {
3564
3675
  const capabilities = {
3565
3676
  ...legacyModelCapabilities(settings, {
3566
3677
  reasoningEffort: true,
3567
3678
  hostedWebSearch: true,
3568
- vision: slug.startsWith("gpt-5.6-") || slug === "gpt-6-astra"
3679
+ vision: slug.startsWith("gpt-5.6-") || slug.startsWith("gpt-6-")
3569
3680
  }),
3570
3681
  ...builtinPromptCachingForModel(`${CODEX_MODEL_ID_PREFIX}${slug}`) ? {
3571
3682
  promptCaching: builtinPromptCachingForModel(`${CODEX_MODEL_ID_PREFIX}${slug}`)
@@ -3748,7 +3859,7 @@ function configuredModels(settings, source = process.env) {
3748
3859
  reasoningEffort: true,
3749
3860
  hostedWebSearch: settings.webSearchEnabled,
3750
3861
  hostedImageGeneration: builtinHostedImageGenerationForModel(settings, id),
3751
- vision: id.startsWith("gpt-5.6-")
3862
+ vision: id.startsWith("gpt-5.6-") || id.startsWith("gpt-6-")
3752
3863
  }),
3753
3864
  ...builtinPromptCachingForModel(id) ? { promptCaching: builtinPromptCachingForModel(id) } : {},
3754
3865
  latencyModes: builtinLatencyModesForModel(id)
@@ -3827,7 +3938,57 @@ function canonicalizeConfiguredModelId(settings, modelId) {
3827
3938
  return models.find((model) => model.aliases.includes(modelId))?.id ?? modelId;
3828
3939
  }
3829
3940
  function configuredAllowedModels(settings) {
3830
- return configuredModels(settings).map((model) => model.id);
3941
+ return configuredModels(settings).filter((model) => isModelAvailableForNewSelection(settings, model.id)).map((model) => model.id);
3942
+ }
3943
+ function isModelAvailableForNewSelection(settings, modelId) {
3944
+ if (!modelId.startsWith(CODEX_MODEL_ID_PREFIX) || settings.resolvedCodexModelsJson === void 0)
3945
+ return true;
3946
+ const models = z.array(CodexCatalogModelSchema).parse(JSON.parse(settings.resolvedCodexModelsJson));
3947
+ return models.some((model) => model.id === modelId && !model.retired);
3948
+ }
3949
+ function settingsForAcceptedSubscriptionTurn(settings, policy, expected) {
3950
+ const parsed = TurnExecutionPolicyV1.parse(policy);
3951
+ if (!parsed.productModelId.startsWith(CODEX_MODEL_ID_PREFIX)) return settings;
3952
+ if (!settings.codexSubscriptionEnabled) throw new Error("Codex subscription is disabled");
3953
+ const models = settings.resolvedCodexModelsJson === void 0 ? [] : z.array(CodexCatalogModelSchema).parse(JSON.parse(settings.resolvedCodexModelsJson));
3954
+ const retained = models.find((model2) => model2.id === parsed.productModelId && model2.retired);
3955
+ if (!retained) {
3956
+ assertTurnExecutionPolicyMatchesConfigV1(settings, parsed, expected);
3957
+ return settings;
3958
+ }
3959
+ const { retired: _retired, ...model } = retained;
3960
+ const withoutCodex = {
3961
+ ...settings,
3962
+ modelProvidersJson: JSON.stringify(
3963
+ parseModelProvidersJson(settings.modelProvidersJson).filter(
3964
+ (provider) => provider.id !== CODEX_PROVIDER_ID
3965
+ )
3966
+ )
3967
+ };
3968
+ const providerSettings = withCodexCatalogProvider({
3969
+ ...withoutCodex,
3970
+ resolvedCodexModelsJson: JSON.stringify([model])
3971
+ });
3972
+ const retainedProvider = parseModelProvidersJson(providerSettings.modelProvidersJson).find(
3973
+ (provider) => provider.id === CODEX_PROVIDER_ID
3974
+ );
3975
+ const providers = parseModelProvidersJson(settings.modelProvidersJson);
3976
+ const current = providers.find((provider) => provider.id === CODEX_PROVIDER_ID);
3977
+ const restored = {
3978
+ ...settings,
3979
+ modelProvidersJson: JSON.stringify([
3980
+ ...providers.filter((provider) => provider.id !== CODEX_PROVIDER_ID),
3981
+ {
3982
+ ...retainedProvider,
3983
+ models: [
3984
+ ...(current?.models ?? []).filter((candidate) => candidate.id !== model.id),
3985
+ model
3986
+ ]
3987
+ }
3988
+ ])
3989
+ };
3990
+ assertTurnExecutionPolicyMatchesConfigV1(restored, parsed, expected);
3991
+ return restored;
3831
3992
  }
3832
3993
  function resolveModelProvider(settings, modelId) {
3833
3994
  const canonicalModelId = canonicalizeConfiguredModelId(settings, modelId);
@@ -3880,6 +4041,9 @@ function resolveModelProviderForTurn(settings, modelId) {
3880
4041
  function resolveTurnExecutionPolicyV1(settings, input) {
3881
4042
  const catalogSettings = settingsForTurnExecutionPolicy(settings, input.modelId);
3882
4043
  const productModelId = canonicalizeConfiguredModelId(catalogSettings, input.modelId);
4044
+ if (!isModelAvailableForNewSelection(catalogSettings, productModelId)) {
4045
+ throw new Error("Turn execution policy model is retired from new selection");
4046
+ }
3883
4047
  const resolved = resolveModelProvider(catalogSettings, productModelId);
3884
4048
  if (!resolved) {
3885
4049
  throw new Error("Turn execution policy model is not present in the configured catalog");
@@ -5206,6 +5370,11 @@ function validateModelCatalogSettings(settings, source = process.env) {
5206
5370
  models.filter((model) => model.credentialSource.kind === "deployment").map((model) => model.id)
5207
5371
  );
5208
5372
  const noteProductIds = new Set(models.map((model) => model.id));
5373
+ if (settings.resolvedCodexModelsJson !== void 0) {
5374
+ for (const model of z.array(CodexCatalogModelSchema).parse(JSON.parse(settings.resolvedCodexModelsJson))) {
5375
+ noteProductIds.add(model.id);
5376
+ }
5377
+ }
5209
5378
  for (const model of configuredGatewayCatalogModels(settings)) {
5210
5379
  deploymentProductIds.add(model.productId);
5211
5380
  noteProductIds.add(model.productId);
@@ -5490,6 +5659,7 @@ export {
5490
5659
  hasGitCredentialRepositorySelection,
5491
5660
  hasGitHubRepositorySelection,
5492
5661
  isDirectOpenAiApiBaseUrl,
5662
+ isModelAvailableForNewSelection,
5493
5663
  isUsableVoiceInputSecret,
5494
5664
  modelCostClassForConfiguredModel,
5495
5665
  parseExposedPorts,
@@ -5533,6 +5703,7 @@ export {
5533
5703
  sandboxWarmRateMicrosPerSecond,
5534
5704
  selectModelPricing,
5535
5705
  serviceTierForLatencyMode,
5706
+ settingsForAcceptedSubscriptionTurn,
5536
5707
  settingsWithResolvedModelContext,
5537
5708
  stableSandboxEnvironmentForRun,
5538
5709
  startupRetryOptions,