negotium 0.23.1 → 0.23.2

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 (36) hide show
  1. package/dist/agent-helpers.js +136 -30
  2. package/dist/agent-helpers.js.map +12 -11
  3. package/dist/{chunk-pr8p6pap.js → chunk-6cnpkzkb.js} +7 -2
  4. package/dist/{chunk-pr8p6pap.js.map → chunk-6cnpkzkb.js.map} +3 -3
  5. package/dist/{chunk-z4r7tt2p.js → chunk-cez5m5hm.js} +1 -1
  6. package/dist/{chunk-w6xavjz2.js → chunk-s34sv3d2.js} +20 -8
  7. package/dist/chunk-s34sv3d2.js.map +12 -0
  8. package/dist/hosted-agent.js +97 -13
  9. package/dist/hosted-agent.js.map +8 -7
  10. package/dist/main.js +162 -39
  11. package/dist/main.js.map +14 -13
  12. package/dist/mcp-factories.js +136 -30
  13. package/dist/mcp-factories.js.map +12 -11
  14. package/dist/prompts.js +9 -10
  15. package/dist/prompts.js.map +3 -3
  16. package/dist/registry.js +5 -5
  17. package/dist/registry.js.map +3 -3
  18. package/dist/rollout.js +2 -2
  19. package/dist/runtime/src/agents/codex-native-multi-agent.ts +28 -6
  20. package/dist/runtime/src/agents/codex-provider.ts +14 -1
  21. package/dist/runtime/src/agents/codex-registry.ts +6 -7
  22. package/dist/runtime/src/agents/codex-tier-resolver.ts +74 -0
  23. package/dist/runtime/src/agents/explicit-agent-switch.ts +6 -1
  24. package/dist/runtime/src/agents/model-catalog.ts +34 -23
  25. package/dist/runtime/src/runtime/turn-event-stream.ts +13 -1
  26. package/dist/runtime/src/storage/token-stats.ts +2 -1
  27. package/dist/runtime/src/version.ts +1 -1
  28. package/dist/storage.js +2 -1
  29. package/dist/storage.js.map +3 -3
  30. package/dist/types/packages/core/src/agents/codex-native-multi-agent.d.ts +9 -0
  31. package/dist/types/packages/core/src/agents/codex-tier-resolver.d.ts +10 -0
  32. package/dist/types/packages/core/src/agents/model-catalog.d.ts +2 -2
  33. package/dist/types/packages/core/src/version.d.ts +1 -1
  34. package/package.json +2 -2
  35. package/dist/chunk-w6xavjz2.js.map +0 -12
  36. /package/dist/{chunk-z4r7tt2p.js.map → chunk-cez5m5hm.js.map} +0 -0
@@ -1579,9 +1579,14 @@ function agentAliases(agent) {
1579
1579
  return [
1580
1580
  "codex",
1581
1581
  "\uCF54\uB371\uC2A4",
1582
+ "astra",
1583
+ "sol",
1584
+ "luna",
1585
+ "terra",
1582
1586
  "gpt-6-luna",
1583
1587
  "gpt-6-sol",
1584
1588
  "gpt-5.6-luna",
1589
+ "gpt-6.1-terra",
1585
1590
  "gpt-5.6-terra",
1586
1591
  "gpt-5.6-sol",
1587
1592
  "gpt-6-astra"
@@ -1609,7 +1614,7 @@ function hasExplicitAgentSwitchRequest(prompt, agent) {
1609
1614
  if (!prompt?.trim())
1610
1615
  return false;
1611
1616
  const text = prompt.toLowerCase().replace(/\s+/g, " ").trim();
1612
- const target = `(?:${agentAliases(agent).map(escapeRegExp2).join("|")})`;
1617
+ const target = `(?<![A-Za-z0-9_-])(?:${agentAliases(agent).map(escapeRegExp2).join("|")})(?![A-Za-z0-9_-])`;
1613
1618
  const switchVerb = "(?:\uBC14\uAFD4|\uBC14\uAFD4\uC918|\uBCC0\uACBD|\uBCC0\uACBD\uD574|\uC804\uD658|\uC804\uD658\uD574|\uC124\uC815|\uC124\uC815\uD574|\uC368\uC918|\uC0AC\uC6A9|\uAC00|switch|change|set|use)";
1614
1619
  const switchSubject = "(?:agent|runtime|model|\uC5D0\uC774\uC804\uD2B8|\uB7F0\uD0C0\uC784|\uBAA8\uB378)";
1615
1620
  return [
@@ -5279,7 +5284,7 @@ var init_codex = __esm(async () => {
5279
5284
  });
5280
5285
 
5281
5286
  // ../../packages/core/src/version.ts
5282
- var NEGOTIUM_VERSION = "0.23.1";
5287
+ var NEGOTIUM_VERSION = "0.23.2";
5283
5288
 
5284
5289
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
5285
5290
  import { spawn as spawn2 } from "child_process";
@@ -5295,9 +5300,22 @@ import {
5295
5300
  unlinkSync as unlinkSync7,
5296
5301
  writeFileSync as writeFileSync5
5297
5302
  } from "fs";
5298
- import { createRequire as createRequire2 } from "module";
5299
5303
  import { tmpdir } from "os";
5300
5304
  import { dirname as dirname8, join as join8 } from "path";
5305
+ import { fileURLToPath as fileURLToPath2 } from "url";
5306
+ function findPackageJson(specifier, searchFromDir) {
5307
+ let dir = searchFromDir;
5308
+ for (;; ) {
5309
+ const candidate = join8(dir, "node_modules", specifier, "package.json");
5310
+ if (existsSync8(candidate))
5311
+ return candidate;
5312
+ const parent = dirname8(dir);
5313
+ if (parent === dir) {
5314
+ throw new Error(`Could not locate node_modules/${specifier} starting from ${searchFromDir}`);
5315
+ }
5316
+ dir = parent;
5317
+ }
5318
+ }
5301
5319
  function readPackageVersion(packageJsonPath) {
5302
5320
  const parsed = JSON.parse(readFileSync7(packageJsonPath, "utf8"));
5303
5321
  if (typeof parsed.version !== "string" || !parsed.version.trim()) {
@@ -5522,12 +5540,11 @@ function writeCodexCatalogWithNativeMultiAgentDisabled(authFilePath, sourcePath)
5522
5540
  writePrivateFileAtomic(outputPath, contents);
5523
5541
  return outputPath;
5524
5542
  }
5525
- var moduleRequire, codexSdkPackagePath, codexSdkRequire, bundledCodexPackagePath, BUNDLED_CODEX_VERSION, SAFE_BUNDLED_CODEX_VERSION, NEGOTIUM_MODEL_CACHE, NEGOTIUM_MODEL_CATALOG, CODEX_BOOTSTRAP_EXIT_WAIT_MS = 3000;
5543
+ var thisModuleDir, codexSdkPackagePath, bundledCodexPackagePath, BUNDLED_CODEX_VERSION, SAFE_BUNDLED_CODEX_VERSION, NEGOTIUM_MODEL_CACHE, NEGOTIUM_MODEL_CATALOG, CODEX_BOOTSTRAP_EXIT_WAIT_MS = 3000;
5526
5544
  var init_codex_native_multi_agent = __esm(() => {
5527
- moduleRequire = createRequire2(import.meta.url);
5528
- codexSdkPackagePath = moduleRequire.resolve("@openai/codex-sdk/package.json");
5529
- codexSdkRequire = createRequire2(codexSdkPackagePath);
5530
- bundledCodexPackagePath = codexSdkRequire.resolve("@openai/codex/package.json");
5545
+ thisModuleDir = dirname8(fileURLToPath2(import.meta.url));
5546
+ codexSdkPackagePath = findPackageJson("@openai/codex-sdk", thisModuleDir);
5547
+ bundledCodexPackagePath = findPackageJson("@openai/codex", dirname8(codexSdkPackagePath));
5531
5548
  BUNDLED_CODEX_VERSION = readPackageVersion(bundledCodexPackagePath);
5532
5549
  SAFE_BUNDLED_CODEX_VERSION = BUNDLED_CODEX_VERSION.replace(/[^a-zA-Z0-9._-]/g, "_");
5533
5550
  NEGOTIUM_MODEL_CACHE = `negotium-models-cache-${SAFE_BUNDLED_CODEX_VERSION}.json`;
@@ -5671,7 +5688,7 @@ var init_codex_registry = __esm(async () => {
5671
5688
  VALID_EFFORTS2 = new Set(CODEX_EFFORT_VALUES);
5672
5689
  codexRegistry = {
5673
5690
  kind: "codex",
5674
- defaultModel: "gpt-6-luna",
5691
+ defaultModel: "luna",
5675
5692
  expandModelAlias(s) {
5676
5693
  return s;
5677
5694
  },
@@ -5898,10 +5915,13 @@ __export(exports_model_catalog, {
5898
5915
  FALLBACK_ORDER: () => FALLBACK_ORDER,
5899
5916
  AGENT_DISPLAY_NAME: () => AGENT_DISPLAY_NAME
5900
5917
  });
5918
+ function canonicalModelCasing() {
5919
+ return Object.fromEntries(SELECTABLE_MODELS.map((candidate) => [candidate.model.toLowerCase(), candidate.model]));
5920
+ }
5901
5921
  function canonicalModelId(value2) {
5902
5922
  const trimmed = value2.trim();
5903
5923
  const lower = trimmed.toLowerCase();
5904
- return SELECTABLE_MODEL_ALIASES[lower] ?? CANONICAL_MODEL_CASING[lower] ?? trimmed;
5924
+ return SELECTABLE_MODEL_ALIASES[lower] ?? canonicalModelCasing()[lower] ?? trimmed;
5905
5925
  }
5906
5926
  function formatSelectableModel(candidate) {
5907
5927
  const tier = `${candidate.intelligenceTier[0].toUpperCase()}${candidate.intelligenceTier.slice(1)}`;
@@ -5946,7 +5966,7 @@ function resolveModelForAgent(agent, requested, registry) {
5946
5966
  return registry.validateModel(candidate) ? candidate : defaultModel;
5947
5967
  }
5948
5968
  function resolveWorkerDefaultModel(agent, registry) {
5949
- return agent === "codex" ? "gpt-5.6-terra" : registry.defaultModel;
5969
+ return agent === "codex" ? "terra" : registry.defaultModel;
5950
5970
  }
5951
5971
  function resolveWorkerModel(agent, requested, registry) {
5952
5972
  const workerDefault = resolveWorkerDefaultModel(agent, registry);
@@ -5963,7 +5983,7 @@ function resolveCompactionExecution(agent, registry) {
5963
5983
  const effort = registry.validateEffort("medium") ? "medium" : registry.defaultEffort;
5964
5984
  return { model, ...effort ? { effort } : {} };
5965
5985
  }
5966
- var MODEL_OWNER, MODEL_COST_RESEARCHED_AT = "2026-09-05", MODEL_COST_ROUTING_SUMMARY = "Cost basis (2026-09-05): Codex Pro 20x and Claude Max 20x are each $200/month; Maestro models are pay-per-token. DeepSeek Flash is cheapest. gpt-6-astra and Claude Fable 5.1 are the newest flagships, both priced at $10/M input / $50/M output.", CODEX_PRO_20X_COST = "ChatGPT Pro 20x subscription: $200/month", CODEX_COMMUNITY_WEEKLY = "Community plan-level observation: roughly 2\u20134B raw/cached tokens per week; fresh-input equivalent is much lower and unstable (low confidence)", CLAUDE_MAX_20X_COST = "Claude Max 20x subscription: $200/month", CLAUDE_COMMUNITY_SESSION = "Community observations vary from roughly 220\u2013250K locally displayed tokens per 5-hour session to billions of cache-heavy raw tokens per week; calibrated reports value a full weekly allowance around $680\u2013$1,900 at API rates. Recent heavy-model reports reach the weekly cap after about 4\u20135 full sessions (low confidence; not a token cap)", SELECTABLE_MODELS, SELECTABLE_MODEL_ALIASES, CANONICAL_MODEL_CASING, FALLBACK_ORDER, AGENT_DISPLAY_NAME;
5986
+ var MODEL_OWNER, MODEL_COST_RESEARCHED_AT = "2026-09-05", MODEL_COST_ROUTING_SUMMARY = "Cost basis (2026-09-05): Codex Pro 20x and Claude Max 20x are each $200/month; Maestro models are pay-per-token. DeepSeek Flash is cheapest. gpt-6-astra and Claude Fable 5.1 are the newest flagships, both priced at $10/M input / $50/M output.", CODEX_PRO_20X_COST = "ChatGPT Pro 20x subscription: $200/month", CODEX_COMMUNITY_WEEKLY = "Community plan-level observation: roughly 2\u20134B raw/cached tokens per week; fresh-input equivalent is much lower and unstable (low confidence)", CLAUDE_MAX_20X_COST = "Claude Max 20x subscription: $200/month", CLAUDE_COMMUNITY_SESSION = "Community observations vary from roughly 220\u2013250K locally displayed tokens per 5-hour session to billions of cache-heavy raw tokens per week; calibrated reports value a full weekly allowance around $680\u2013$1,900 at API rates. Recent heavy-model reports reach the weekly cap after about 4\u20135 full sessions (low confidence; not a token cap)", SELECTABLE_MODELS, SELECTABLE_MODEL_ALIASES, FALLBACK_ORDER, AGENT_DISPLAY_NAME;
5967
5987
  var init_model_catalog = __esm(() => {
5968
5988
  init_config();
5969
5989
  MODEL_OWNER = {
@@ -5971,9 +5991,14 @@ var init_model_catalog = __esm(() => {
5971
5991
  opus: "claude",
5972
5992
  haiku: "claude",
5973
5993
  fable: "claude",
5994
+ astra: "codex",
5995
+ sol: "codex",
5996
+ luna: "codex",
5997
+ terra: "codex",
5974
5998
  "gpt-6-astra": "codex",
5975
5999
  "gpt-6-sol": "codex",
5976
6000
  "gpt-6-luna": "codex",
6001
+ "gpt-6.1-terra": "codex",
5977
6002
  "gpt-5.6-luna": "codex",
5978
6003
  "gpt-5.6-terra": "codex",
5979
6004
  "gpt-5.6-sol": "codex",
@@ -5994,7 +6019,7 @@ var init_model_catalog = __esm(() => {
5994
6019
  };
5995
6020
  SELECTABLE_MODELS = [
5996
6021
  {
5997
- model: "gpt-6-astra",
6022
+ model: "astra",
5998
6023
  agent: "codex",
5999
6024
  description: "Newest OpenAI flagship; Codex's highest-capability route.",
6000
6025
  intelligenceTier: "fable",
@@ -6004,7 +6029,7 @@ var init_model_catalog = __esm(() => {
6004
6029
  estimatedUsage: `Released 2026-09-03; became Codex CLI's bundled default in v0.153.4 (2026-09-05). Local message-count/quota-weight ranges not yet published as of the last catalog check \u2014 expect a quota weight above gpt-6-sol given the higher per-token cost. ${CODEX_COMMUNITY_WEEKLY}`
6005
6030
  },
6006
6031
  {
6007
- model: "gpt-6-sol",
6032
+ model: "sol",
6008
6033
  agent: "codex",
6009
6034
  description: "GPT-6 generation Sol route (2026-09-22) for demanding coding and agentic work.",
6010
6035
  intelligenceTier: "opus",
@@ -6014,7 +6039,7 @@ var init_model_catalog = __esm(() => {
6014
6039
  estimatedUsage: `Released 2026-09-22; local message-count/quota-weight ranges not yet published. ${CODEX_COMMUNITY_WEEKLY}`
6015
6040
  },
6016
6041
  {
6017
- model: "gpt-6-luna",
6042
+ model: "luna",
6018
6043
  agent: "codex",
6019
6044
  description: "Default Codex route (GPT-6 Luna, 2026-09-22): fast, high-volume, lowest cost.",
6020
6045
  intelligenceTier: "sonnet",
@@ -6024,14 +6049,14 @@ var init_model_catalog = __esm(() => {
6024
6049
  estimatedUsage: `Released 2026-09-22; local message-count/quota-weight ranges not yet published. ${CODEX_COMMUNITY_WEEKLY}`
6025
6050
  },
6026
6051
  {
6027
- model: "gpt-5.6-terra",
6052
+ model: "terra",
6028
6053
  agent: "codex",
6029
- description: "High-capability Codex route for complex coding and reasoning.",
6054
+ description: "GPT-6.1 Terra route (2026-10-26) for complex coding, visual reasoning, and computer use.",
6030
6055
  intelligenceTier: "opus",
6031
- routingSummary: "complex coding and reasoning; 2.5x Codex quota cost",
6056
+ routingSummary: "capable coding and computer use at a lower cost than GPT-5.6 Terra",
6032
6057
  accessCost: CODEX_PRO_20X_COST,
6033
- marginalTokenCost: "Codex credits: $2.50/M uncached input, $0.25/M cached input, $15/M output",
6034
- estimatedUsage: `Official Pro 20x range: 400\u20132,200 local messages per 5 hours; quota weight 2.5x the retired GPT-5.6 Luna. ${CODEX_COMMUNITY_WEEKLY}`
6058
+ marginalTokenCost: "Codex credits (OpenAI API rate): $1/M uncached input, $0.05/M cached input, $5/M output",
6059
+ estimatedUsage: `Released 2026-10-26; local message-count/quota-weight ranges not yet published. ${CODEX_COMMUNITY_WEEKLY}`
6035
6060
  },
6036
6061
  {
6037
6062
  model: "fable",
@@ -6125,8 +6150,13 @@ var init_model_catalog = __esm(() => {
6125
6150
  }
6126
6151
  ];
6127
6152
  SELECTABLE_MODEL_ALIASES = {
6128
- "gpt-5.6-sol": "gpt-6-sol",
6129
- "gpt-5.6-luna": "gpt-6-luna",
6153
+ "gpt-6-astra": "astra",
6154
+ "gpt-5.6-sol": "sol",
6155
+ "gpt-6-sol": "sol",
6156
+ "gpt-5.6-luna": "luna",
6157
+ "gpt-6-luna": "luna",
6158
+ "gpt-5.6-terra": "terra",
6159
+ "gpt-6.1-terra": "terra",
6130
6160
  kimi: "kimi-k3",
6131
6161
  "kimi-pro": "kimi-k3",
6132
6162
  "kimi-code": "kimi-k2.7-code",
@@ -6134,18 +6164,17 @@ var init_model_catalog = __esm(() => {
6134
6164
  "glm-pro": "glm-5.3",
6135
6165
  "glm-flash": "glm-5.3-flash"
6136
6166
  };
6137
- CANONICAL_MODEL_CASING = Object.fromEntries(SELECTABLE_MODELS.map((candidate) => [candidate.model.toLowerCase(), candidate.model]));
6138
6167
  FALLBACK_ORDER = {
6139
6168
  claude: [
6140
6169
  { agent: "maestro", model: "deepseek-pro" },
6141
- { agent: "codex", model: "gpt-6-luna" }
6170
+ { agent: "codex", model: "luna" }
6142
6171
  ],
6143
6172
  codex: [
6144
6173
  { agent: "maestro", model: "deepseek-pro" },
6145
6174
  { agent: "claude", model: "sonnet" }
6146
6175
  ],
6147
6176
  maestro: [
6148
- { agent: "codex", model: "gpt-6-luna" },
6177
+ { agent: "codex", model: "luna" },
6149
6178
  { agent: "claude", model: "sonnet" }
6150
6179
  ]
6151
6180
  };
@@ -10364,6 +10393,76 @@ var init_claude_provider = __esm(async () => {
10364
10393
  claudeProcessExitListeners = new WeakMap;
10365
10394
  });
10366
10395
 
10396
+ // ../../packages/core/src/agents/codex-tier-resolver.ts
10397
+ function codexTiersFromCache(cache) {
10398
+ const result = {};
10399
+ const priorities = {};
10400
+ if (!cache || typeof cache !== "object" || !("models" in cache))
10401
+ return result;
10402
+ const models = cache.models;
10403
+ if (!Array.isArray(models))
10404
+ return result;
10405
+ for (const model of models) {
10406
+ if (!model || typeof model !== "object")
10407
+ continue;
10408
+ const { slug, visibility, priority } = model;
10409
+ if (typeof slug !== "string" || visibility !== "list")
10410
+ continue;
10411
+ if (typeof priority !== "number" || !Number.isFinite(priority))
10412
+ continue;
10413
+ const suffix = slug.slice(slug.lastIndexOf("-") + 1);
10414
+ if (!Object.hasOwn(CODEX_TIER_FALLBACKS, suffix))
10415
+ continue;
10416
+ const tier = suffix;
10417
+ if (priorities[tier] === undefined || priority < priorities[tier]) {
10418
+ priorities[tier] = priority;
10419
+ result[tier] = slug;
10420
+ }
10421
+ }
10422
+ return result;
10423
+ }
10424
+ function resolveCodexTierModel(tier, cachePath = process.env.NEGOTIUM_CODEX_MODELS_CACHE_FILE ?? bundledCodexModelCachePath(hostedCodexAuthFilePath())) {
10425
+ try {
10426
+ const selected = codexTiersFromCache(readCompatibleCodexModelCache(cachePath).parsed)[tier];
10427
+ if (selected) {
10428
+ if (!pricedSlugs.has(selected) && !warnedUnpricedSlugs.has(selected)) {
10429
+ warnedUnpricedSlugs.add(selected);
10430
+ logger.warn({ tier, model: selected }, "Codex tier model has no token-stats price");
10431
+ }
10432
+ return selected;
10433
+ }
10434
+ } catch (error) {
10435
+ if (!warnedCachePaths.has(cachePath)) {
10436
+ warnedCachePaths.add(cachePath);
10437
+ logger.warn({ err: error, cachePath }, "Codex tier cache unavailable; using fallback ids");
10438
+ }
10439
+ }
10440
+ return CODEX_TIER_FALLBACKS[tier];
10441
+ }
10442
+ var CODEX_TIER_FALLBACKS, warnedCachePaths, warnedUnpricedSlugs, pricedSlugs;
10443
+ var init_codex_tier_resolver = __esm(async () => {
10444
+ init_codex_native_multi_agent();
10445
+ init_logger();
10446
+ await init_execution_host();
10447
+ CODEX_TIER_FALLBACKS = {
10448
+ astra: "gpt-6-astra",
10449
+ sol: "gpt-6-sol",
10450
+ luna: "gpt-6-luna",
10451
+ terra: "gpt-6.1-terra"
10452
+ };
10453
+ warnedCachePaths = new Set;
10454
+ warnedUnpricedSlugs = new Set;
10455
+ pricedSlugs = new Set([
10456
+ "gpt-6-astra",
10457
+ "gpt-6-sol",
10458
+ "gpt-6-luna",
10459
+ "gpt-6.1-terra",
10460
+ "gpt-5.6-sol",
10461
+ "gpt-5.6-luna",
10462
+ "gpt-5.6-terra"
10463
+ ]);
10464
+ });
10465
+
10367
10466
  // ../../packages/core/src/agents/codex-tree-manager.ts
10368
10467
  function createCodexTreeManager(host, options = {}) {
10369
10468
  const sigkillDelayMs = options.sigkillDelayMs ?? 5000;
@@ -10728,7 +10827,7 @@ import { chmod, copyFile, mkdtemp, rm as rm2, writeFile as writeFile2 } from "fs
10728
10827
  import { createServer as createServer3 } from "net";
10729
10828
  import { tmpdir as tmpdir3 } from "os";
10730
10829
  import { dirname as dirname13, join as join19, resolve as resolve12 } from "path";
10731
- import { fileURLToPath as fileURLToPath2 } from "url";
10830
+ import { fileURLToPath as fileURLToPath3 } from "url";
10732
10831
  function evaluateCodexVaultPreToolUse(input, userId, operations) {
10733
10832
  if (operations.referencesSensitiveStorage(input.tool_input)) {
10734
10833
  return {
@@ -10756,7 +10855,7 @@ function shellQuote(value2) {
10756
10855
  return `'${value2.replaceAll("'", `'"'"'`)}'`;
10757
10856
  }
10758
10857
  function hookClientPath() {
10759
- const moduleDir = dirname13(fileURLToPath2(import.meta.url));
10858
+ const moduleDir = dirname13(fileURLToPath3(import.meta.url));
10760
10859
  const adjacent = resolve12(moduleDir, "codex-vault-hook.mjs");
10761
10860
  if (existsSync19(adjacent))
10762
10861
  return adjacent;
@@ -11825,6 +11924,7 @@ async function* codexProvider(opts) {
11825
11924
  ...codexEnvironment ? { env: codexEnvironment } : {},
11826
11925
  config: {
11827
11926
  agents: { enabled: false },
11927
+ tools: { update_plan: { enabled: false } },
11828
11928
  features: {
11829
11929
  hooks: true,
11830
11930
  goals: false,
@@ -11848,7 +11948,9 @@ async function* codexProvider(opts) {
11848
11948
  webSearchMode: "disabled",
11849
11949
  webSearchEnabled: false
11850
11950
  } : {},
11851
- ...opts.model ? { model: opts.model } : {},
11951
+ ...opts.model ? {
11952
+ model: Object.hasOwn(CODEX_TIER_FALLBACKS, opts.model) ? resolveCodexTierModel(opts.model) : opts.model
11953
+ } : {},
11852
11954
  ...opts.effort ? { modelReasoningEffort: mapEffort(opts.effort) } : {}
11853
11955
  };
11854
11956
  let currentSessionId = opts.sessionId;
@@ -12110,6 +12212,7 @@ var init_codex_provider = __esm(async () => {
12110
12212
  init_file_events();
12111
12213
  init_logger();
12112
12214
  await __promiseAll([
12215
+ init_codex_tier_resolver(),
12113
12216
  init_codex_vault_hook_bridge(),
12114
12217
  init_execution_host(),
12115
12218
  init_codex(),
@@ -14010,6 +14113,7 @@ var init_token_stats = __esm(async () => {
14010
14113
  "codex:gpt-6-astra": { input: 10, cacheWrite: 12.5, cacheRead: 1, output: 50 },
14011
14114
  "codex:gpt-6-sol": { input: 2, cacheRead: 0.2, output: 10 },
14012
14115
  "codex:gpt-6-luna": { input: 0.1, cacheRead: 0.01, output: 0.5 },
14116
+ "codex:gpt-6.1-terra": { input: 1, cacheRead: 0.05, output: 5 },
14013
14117
  "codex:gpt-5.6-sol": { input: 5, cacheRead: 0.5, output: 30 },
14014
14118
  "codex:gpt-5.6-terra": { input: 2.5, cacheRead: 0.25, output: 15 },
14015
14119
  "codex:gpt-5.6-luna": { input: 1, cacheRead: 0.1, output: 6 },
@@ -19326,12 +19430,13 @@ async function runTurnEventStream(topicId, topicTitle, queryId, events, control,
19326
19430
  const toolSummaryOptions = {
19327
19431
  cwd: control.injectParams?.cwd ?? workspaceCwdFor(topicId)
19328
19432
  };
19433
+ const pricedModel = agentType === "codex" && Object.hasOwn(CODEX_TIER_FALLBACKS, model) ? resolveCodexTierModel(model) : model;
19329
19434
  const recordEventUsage = (usage) => {
19330
19435
  recordUsage(userId, topicTitle, usage, {
19331
19436
  topicId,
19332
19437
  ...control.sessionId ? { providerSessionId: control.sessionId } : {},
19333
19438
  agent: agentType,
19334
- model
19439
+ model: pricedModel
19335
19440
  });
19336
19441
  };
19337
19442
  const broadcastContextProgress = (force = false) => {
@@ -19913,6 +20018,7 @@ var init_turn_event_stream = __esm(async () => {
19913
20018
  init_usage_alert();
19914
20019
  init_sensitive_path();
19915
20020
  await __promiseAll([
20021
+ init_codex_tier_resolver(),
19916
20022
  init_fork(),
19917
20023
  init_idle_archiver(),
19918
20024
  init_idle_compact(),
@@ -25792,4 +25898,4 @@ export {
25792
25898
  createAgentHealthMcpServer
25793
25899
  };
25794
25900
 
25795
- //# debugId=F00EB9FBBAF5C9CF64756E2164756E21
25901
+ //# debugId=18366C463A8C391664756E2164756E21