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
package/dist/main.js CHANGED
@@ -1503,9 +1503,14 @@ function agentAliases(agent) {
1503
1503
  return [
1504
1504
  "codex",
1505
1505
  "\uCF54\uB371\uC2A4",
1506
+ "astra",
1507
+ "sol",
1508
+ "luna",
1509
+ "terra",
1506
1510
  "gpt-6-luna",
1507
1511
  "gpt-6-sol",
1508
1512
  "gpt-5.6-luna",
1513
+ "gpt-6.1-terra",
1509
1514
  "gpt-5.6-terra",
1510
1515
  "gpt-5.6-sol",
1511
1516
  "gpt-6-astra"
@@ -1533,7 +1538,7 @@ function hasExplicitAgentSwitchRequest(prompt, agent) {
1533
1538
  if (!prompt?.trim())
1534
1539
  return false;
1535
1540
  const text = prompt.toLowerCase().replace(/\s+/g, " ").trim();
1536
- const target = `(?:${agentAliases(agent).map(escapeRegExp).join("|")})`;
1541
+ const target = `(?<![A-Za-z0-9_-])(?:${agentAliases(agent).map(escapeRegExp).join("|")})(?![A-Za-z0-9_-])`;
1537
1542
  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)";
1538
1543
  const switchSubject = "(?:agent|runtime|model|\uC5D0\uC774\uC804\uD2B8|\uB7F0\uD0C0\uC784|\uBAA8\uB378)";
1539
1544
  return [
@@ -6559,7 +6564,7 @@ var exports_version = {};
6559
6564
  __export(exports_version, {
6560
6565
  NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
6561
6566
  });
6562
- var NEGOTIUM_VERSION = "0.23.1";
6567
+ var NEGOTIUM_VERSION = "0.23.2";
6563
6568
 
6564
6569
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
6565
6570
  import { spawn as spawn2 } from "child_process";
@@ -6575,9 +6580,22 @@ import {
6575
6580
  unlinkSync as unlinkSync5,
6576
6581
  writeFileSync as writeFileSync4
6577
6582
  } from "fs";
6578
- import { createRequire as createRequire2 } from "module";
6579
6583
  import { tmpdir } from "os";
6580
6584
  import { dirname as dirname7, join as join9 } from "path";
6585
+ import { fileURLToPath as fileURLToPath2 } from "url";
6586
+ function findPackageJson(specifier, searchFromDir) {
6587
+ let dir = searchFromDir;
6588
+ for (;; ) {
6589
+ const candidate = join9(dir, "node_modules", specifier, "package.json");
6590
+ if (existsSync7(candidate))
6591
+ return candidate;
6592
+ const parent = dirname7(dir);
6593
+ if (parent === dir) {
6594
+ throw new Error(`Could not locate node_modules/${specifier} starting from ${searchFromDir}`);
6595
+ }
6596
+ dir = parent;
6597
+ }
6598
+ }
6581
6599
  function readPackageVersion(packageJsonPath) {
6582
6600
  const parsed = JSON.parse(readFileSync5(packageJsonPath, "utf8"));
6583
6601
  if (typeof parsed.version !== "string" || !parsed.version.trim()) {
@@ -6802,12 +6820,11 @@ function writeCodexCatalogWithNativeMultiAgentDisabled(authFilePath, sourcePath)
6802
6820
  writePrivateFileAtomic(outputPath, contents);
6803
6821
  return outputPath;
6804
6822
  }
6805
- var moduleRequire, codexSdkPackagePath, codexSdkRequire, bundledCodexPackagePath, BUNDLED_CODEX_VERSION, SAFE_BUNDLED_CODEX_VERSION, NEGOTIUM_MODEL_CACHE, NEGOTIUM_MODEL_CATALOG, CODEX_BOOTSTRAP_EXIT_WAIT_MS = 3000;
6823
+ var thisModuleDir, codexSdkPackagePath, bundledCodexPackagePath, BUNDLED_CODEX_VERSION, SAFE_BUNDLED_CODEX_VERSION, NEGOTIUM_MODEL_CACHE, NEGOTIUM_MODEL_CATALOG, CODEX_BOOTSTRAP_EXIT_WAIT_MS = 3000;
6806
6824
  var init_codex_native_multi_agent = __esm(() => {
6807
- moduleRequire = createRequire2(import.meta.url);
6808
- codexSdkPackagePath = moduleRequire.resolve("@openai/codex-sdk/package.json");
6809
- codexSdkRequire = createRequire2(codexSdkPackagePath);
6810
- bundledCodexPackagePath = codexSdkRequire.resolve("@openai/codex/package.json");
6825
+ thisModuleDir = dirname7(fileURLToPath2(import.meta.url));
6826
+ codexSdkPackagePath = findPackageJson("@openai/codex-sdk", thisModuleDir);
6827
+ bundledCodexPackagePath = findPackageJson("@openai/codex", dirname7(codexSdkPackagePath));
6811
6828
  BUNDLED_CODEX_VERSION = readPackageVersion(bundledCodexPackagePath);
6812
6829
  SAFE_BUNDLED_CODEX_VERSION = BUNDLED_CODEX_VERSION.replace(/[^a-zA-Z0-9._-]/g, "_");
6813
6830
  NEGOTIUM_MODEL_CACHE = `negotium-models-cache-${SAFE_BUNDLED_CODEX_VERSION}.json`;
@@ -6951,7 +6968,7 @@ var init_codex_registry = __esm(async () => {
6951
6968
  VALID_EFFORTS2 = new Set(CODEX_EFFORT_VALUES);
6952
6969
  codexRegistry = {
6953
6970
  kind: "codex",
6954
- defaultModel: "gpt-6-luna",
6971
+ defaultModel: "luna",
6955
6972
  expandModelAlias(s) {
6956
6973
  return s;
6957
6974
  },
@@ -8308,6 +8325,76 @@ var init_claude_provider = __esm(async () => {
8308
8325
  claudeProcessExitListeners = new WeakMap;
8309
8326
  });
8310
8327
 
8328
+ // ../../packages/core/src/agents/codex-tier-resolver.ts
8329
+ function codexTiersFromCache(cache) {
8330
+ const result = {};
8331
+ const priorities = {};
8332
+ if (!cache || typeof cache !== "object" || !("models" in cache))
8333
+ return result;
8334
+ const models = cache.models;
8335
+ if (!Array.isArray(models))
8336
+ return result;
8337
+ for (const model of models) {
8338
+ if (!model || typeof model !== "object")
8339
+ continue;
8340
+ const { slug, visibility, priority } = model;
8341
+ if (typeof slug !== "string" || visibility !== "list")
8342
+ continue;
8343
+ if (typeof priority !== "number" || !Number.isFinite(priority))
8344
+ continue;
8345
+ const suffix = slug.slice(slug.lastIndexOf("-") + 1);
8346
+ if (!Object.hasOwn(CODEX_TIER_FALLBACKS, suffix))
8347
+ continue;
8348
+ const tier = suffix;
8349
+ if (priorities[tier] === undefined || priority < priorities[tier]) {
8350
+ priorities[tier] = priority;
8351
+ result[tier] = slug;
8352
+ }
8353
+ }
8354
+ return result;
8355
+ }
8356
+ function resolveCodexTierModel(tier, cachePath = process.env.NEGOTIUM_CODEX_MODELS_CACHE_FILE ?? bundledCodexModelCachePath(hostedCodexAuthFilePath())) {
8357
+ try {
8358
+ const selected = codexTiersFromCache(readCompatibleCodexModelCache(cachePath).parsed)[tier];
8359
+ if (selected) {
8360
+ if (!pricedSlugs.has(selected) && !warnedUnpricedSlugs.has(selected)) {
8361
+ warnedUnpricedSlugs.add(selected);
8362
+ logger.warn({ tier, model: selected }, "Codex tier model has no token-stats price");
8363
+ }
8364
+ return selected;
8365
+ }
8366
+ } catch (error) {
8367
+ if (!warnedCachePaths.has(cachePath)) {
8368
+ warnedCachePaths.add(cachePath);
8369
+ logger.warn({ err: error, cachePath }, "Codex tier cache unavailable; using fallback ids");
8370
+ }
8371
+ }
8372
+ return CODEX_TIER_FALLBACKS[tier];
8373
+ }
8374
+ var CODEX_TIER_FALLBACKS, warnedCachePaths, warnedUnpricedSlugs, pricedSlugs;
8375
+ var init_codex_tier_resolver = __esm(async () => {
8376
+ init_codex_native_multi_agent();
8377
+ init_logger();
8378
+ await init_execution_host();
8379
+ CODEX_TIER_FALLBACKS = {
8380
+ astra: "gpt-6-astra",
8381
+ sol: "gpt-6-sol",
8382
+ luna: "gpt-6-luna",
8383
+ terra: "gpt-6.1-terra"
8384
+ };
8385
+ warnedCachePaths = new Set;
8386
+ warnedUnpricedSlugs = new Set;
8387
+ pricedSlugs = new Set([
8388
+ "gpt-6-astra",
8389
+ "gpt-6-sol",
8390
+ "gpt-6-luna",
8391
+ "gpt-6.1-terra",
8392
+ "gpt-5.6-sol",
8393
+ "gpt-5.6-luna",
8394
+ "gpt-5.6-terra"
8395
+ ]);
8396
+ });
8397
+
8311
8398
  // ../../packages/core/src/agents/codex-windows-wrapper.ts
8312
8399
  import { execFile } from "child_process";
8313
8400
  import { createHash as createHash4, randomUUID as randomUUID5 } from "crypto";
@@ -8471,7 +8558,7 @@ import { chmod, copyFile, mkdtemp, rm as rm2, writeFile as writeFile2 } from "fs
8471
8558
  import { createServer } from "net";
8472
8559
  import { tmpdir as tmpdir2 } from "os";
8473
8560
  import { dirname as dirname10, join as join15, resolve as resolve8 } from "path";
8474
- import { fileURLToPath as fileURLToPath2 } from "url";
8561
+ import { fileURLToPath as fileURLToPath3 } from "url";
8475
8562
  function evaluateCodexVaultPreToolUse(input, userId, operations) {
8476
8563
  if (operations.referencesSensitiveStorage(input.tool_input)) {
8477
8564
  return {
@@ -8499,7 +8586,7 @@ function shellQuote(value) {
8499
8586
  return `'${value.replaceAll("'", `'"'"'`)}'`;
8500
8587
  }
8501
8588
  function hookClientPath() {
8502
- const moduleDir = dirname10(fileURLToPath2(import.meta.url));
8589
+ const moduleDir = dirname10(fileURLToPath3(import.meta.url));
8503
8590
  const adjacent = resolve8(moduleDir, "codex-vault-hook.mjs");
8504
8591
  if (existsSync15(adjacent))
8505
8592
  return adjacent;
@@ -9568,6 +9655,7 @@ async function* codexProvider(opts) {
9568
9655
  ...codexEnvironment ? { env: codexEnvironment } : {},
9569
9656
  config: {
9570
9657
  agents: { enabled: false },
9658
+ tools: { update_plan: { enabled: false } },
9571
9659
  features: {
9572
9660
  hooks: true,
9573
9661
  goals: false,
@@ -9591,7 +9679,9 @@ async function* codexProvider(opts) {
9591
9679
  webSearchMode: "disabled",
9592
9680
  webSearchEnabled: false
9593
9681
  } : {},
9594
- ...opts.model ? { model: opts.model } : {},
9682
+ ...opts.model ? {
9683
+ model: Object.hasOwn(CODEX_TIER_FALLBACKS, opts.model) ? resolveCodexTierModel(opts.model) : opts.model
9684
+ } : {},
9595
9685
  ...opts.effort ? { modelReasoningEffort: mapEffort(opts.effort) } : {}
9596
9686
  };
9597
9687
  let currentSessionId = opts.sessionId;
@@ -9853,6 +9943,7 @@ var init_codex_provider = __esm(async () => {
9853
9943
  init_file_events();
9854
9944
  init_logger();
9855
9945
  await __promiseAll([
9946
+ init_codex_tier_resolver(),
9856
9947
  init_codex_vault_hook_bridge(),
9857
9948
  init_execution_host(),
9858
9949
  init_codex(),
@@ -12025,10 +12116,13 @@ __export(exports_model_catalog, {
12025
12116
  FALLBACK_ORDER: () => FALLBACK_ORDER,
12026
12117
  AGENT_DISPLAY_NAME: () => AGENT_DISPLAY_NAME
12027
12118
  });
12119
+ function canonicalModelCasing() {
12120
+ return Object.fromEntries(SELECTABLE_MODELS.map((candidate) => [candidate.model.toLowerCase(), candidate.model]));
12121
+ }
12028
12122
  function canonicalModelId(value) {
12029
12123
  const trimmed = value.trim();
12030
12124
  const lower = trimmed.toLowerCase();
12031
- return SELECTABLE_MODEL_ALIASES[lower] ?? CANONICAL_MODEL_CASING[lower] ?? trimmed;
12125
+ return SELECTABLE_MODEL_ALIASES[lower] ?? canonicalModelCasing()[lower] ?? trimmed;
12032
12126
  }
12033
12127
  function formatSelectableModel(candidate) {
12034
12128
  const tier = `${candidate.intelligenceTier[0].toUpperCase()}${candidate.intelligenceTier.slice(1)}`;
@@ -12073,7 +12167,7 @@ function resolveModelForAgent(agent, requested, registry) {
12073
12167
  return registry.validateModel(candidate) ? candidate : defaultModel;
12074
12168
  }
12075
12169
  function resolveWorkerDefaultModel(agent, registry) {
12076
- return agent === "codex" ? "gpt-5.6-terra" : registry.defaultModel;
12170
+ return agent === "codex" ? "terra" : registry.defaultModel;
12077
12171
  }
12078
12172
  function resolveWorkerModel(agent, requested, registry) {
12079
12173
  const workerDefault = resolveWorkerDefaultModel(agent, registry);
@@ -12090,7 +12184,7 @@ function resolveCompactionExecution(agent, registry) {
12090
12184
  const effort = registry.validateEffort("medium") ? "medium" : registry.defaultEffort;
12091
12185
  return { model, ...effort ? { effort } : {} };
12092
12186
  }
12093
- 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;
12187
+ 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;
12094
12188
  var init_model_catalog = __esm(() => {
12095
12189
  init_config();
12096
12190
  MODEL_OWNER = {
@@ -12098,9 +12192,14 @@ var init_model_catalog = __esm(() => {
12098
12192
  opus: "claude",
12099
12193
  haiku: "claude",
12100
12194
  fable: "claude",
12195
+ astra: "codex",
12196
+ sol: "codex",
12197
+ luna: "codex",
12198
+ terra: "codex",
12101
12199
  "gpt-6-astra": "codex",
12102
12200
  "gpt-6-sol": "codex",
12103
12201
  "gpt-6-luna": "codex",
12202
+ "gpt-6.1-terra": "codex",
12104
12203
  "gpt-5.6-luna": "codex",
12105
12204
  "gpt-5.6-terra": "codex",
12106
12205
  "gpt-5.6-sol": "codex",
@@ -12121,7 +12220,7 @@ var init_model_catalog = __esm(() => {
12121
12220
  };
12122
12221
  SELECTABLE_MODELS = [
12123
12222
  {
12124
- model: "gpt-6-astra",
12223
+ model: "astra",
12125
12224
  agent: "codex",
12126
12225
  description: "Newest OpenAI flagship; Codex's highest-capability route.",
12127
12226
  intelligenceTier: "fable",
@@ -12131,7 +12230,7 @@ var init_model_catalog = __esm(() => {
12131
12230
  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}`
12132
12231
  },
12133
12232
  {
12134
- model: "gpt-6-sol",
12233
+ model: "sol",
12135
12234
  agent: "codex",
12136
12235
  description: "GPT-6 generation Sol route (2026-09-22) for demanding coding and agentic work.",
12137
12236
  intelligenceTier: "opus",
@@ -12141,7 +12240,7 @@ var init_model_catalog = __esm(() => {
12141
12240
  estimatedUsage: `Released 2026-09-22; local message-count/quota-weight ranges not yet published. ${CODEX_COMMUNITY_WEEKLY}`
12142
12241
  },
12143
12242
  {
12144
- model: "gpt-6-luna",
12243
+ model: "luna",
12145
12244
  agent: "codex",
12146
12245
  description: "Default Codex route (GPT-6 Luna, 2026-09-22): fast, high-volume, lowest cost.",
12147
12246
  intelligenceTier: "sonnet",
@@ -12151,14 +12250,14 @@ var init_model_catalog = __esm(() => {
12151
12250
  estimatedUsage: `Released 2026-09-22; local message-count/quota-weight ranges not yet published. ${CODEX_COMMUNITY_WEEKLY}`
12152
12251
  },
12153
12252
  {
12154
- model: "gpt-5.6-terra",
12253
+ model: "terra",
12155
12254
  agent: "codex",
12156
- description: "High-capability Codex route for complex coding and reasoning.",
12255
+ description: "GPT-6.1 Terra route (2026-10-26) for complex coding, visual reasoning, and computer use.",
12157
12256
  intelligenceTier: "opus",
12158
- routingSummary: "complex coding and reasoning; 2.5x Codex quota cost",
12257
+ routingSummary: "capable coding and computer use at a lower cost than GPT-5.6 Terra",
12159
12258
  accessCost: CODEX_PRO_20X_COST,
12160
- marginalTokenCost: "Codex credits: $2.50/M uncached input, $0.25/M cached input, $15/M output",
12161
- 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}`
12259
+ marginalTokenCost: "Codex credits (OpenAI API rate): $1/M uncached input, $0.05/M cached input, $5/M output",
12260
+ estimatedUsage: `Released 2026-10-26; local message-count/quota-weight ranges not yet published. ${CODEX_COMMUNITY_WEEKLY}`
12162
12261
  },
12163
12262
  {
12164
12263
  model: "fable",
@@ -12252,8 +12351,13 @@ var init_model_catalog = __esm(() => {
12252
12351
  }
12253
12352
  ];
12254
12353
  SELECTABLE_MODEL_ALIASES = {
12255
- "gpt-5.6-sol": "gpt-6-sol",
12256
- "gpt-5.6-luna": "gpt-6-luna",
12354
+ "gpt-6-astra": "astra",
12355
+ "gpt-5.6-sol": "sol",
12356
+ "gpt-6-sol": "sol",
12357
+ "gpt-5.6-luna": "luna",
12358
+ "gpt-6-luna": "luna",
12359
+ "gpt-5.6-terra": "terra",
12360
+ "gpt-6.1-terra": "terra",
12257
12361
  kimi: "kimi-k3",
12258
12362
  "kimi-pro": "kimi-k3",
12259
12363
  "kimi-code": "kimi-k2.7-code",
@@ -12261,18 +12365,17 @@ var init_model_catalog = __esm(() => {
12261
12365
  "glm-pro": "glm-5.3",
12262
12366
  "glm-flash": "glm-5.3-flash"
12263
12367
  };
12264
- CANONICAL_MODEL_CASING = Object.fromEntries(SELECTABLE_MODELS.map((candidate) => [candidate.model.toLowerCase(), candidate.model]));
12265
12368
  FALLBACK_ORDER = {
12266
12369
  claude: [
12267
12370
  { agent: "maestro", model: "deepseek-pro" },
12268
- { agent: "codex", model: "gpt-6-luna" }
12371
+ { agent: "codex", model: "luna" }
12269
12372
  ],
12270
12373
  codex: [
12271
12374
  { agent: "maestro", model: "deepseek-pro" },
12272
12375
  { agent: "claude", model: "sonnet" }
12273
12376
  ],
12274
12377
  maestro: [
12275
- { agent: "codex", model: "gpt-6-luna" },
12378
+ { agent: "codex", model: "luna" },
12276
12379
  { agent: "claude", model: "sonnet" }
12277
12380
  ]
12278
12381
  };
@@ -16400,6 +16503,7 @@ var init_token_stats = __esm(async () => {
16400
16503
  "codex:gpt-6-astra": { input: 10, cacheWrite: 12.5, cacheRead: 1, output: 50 },
16401
16504
  "codex:gpt-6-sol": { input: 2, cacheRead: 0.2, output: 10 },
16402
16505
  "codex:gpt-6-luna": { input: 0.1, cacheRead: 0.01, output: 0.5 },
16506
+ "codex:gpt-6.1-terra": { input: 1, cacheRead: 0.05, output: 5 },
16403
16507
  "codex:gpt-5.6-sol": { input: 5, cacheRead: 0.5, output: 30 },
16404
16508
  "codex:gpt-5.6-terra": { input: 2.5, cacheRead: 0.25, output: 15 },
16405
16509
  "codex:gpt-5.6-luna": { input: 1, cacheRead: 0.1, output: 6 },
@@ -21603,12 +21707,13 @@ async function runTurnEventStream(topicId, topicTitle, queryId, events, control,
21603
21707
  const toolSummaryOptions = {
21604
21708
  cwd: control.injectParams?.cwd ?? workspaceCwdFor(topicId)
21605
21709
  };
21710
+ const pricedModel = agentType === "codex" && Object.hasOwn(CODEX_TIER_FALLBACKS, model) ? resolveCodexTierModel(model) : model;
21606
21711
  const recordEventUsage = (usage) => {
21607
21712
  recordUsage(userId, topicTitle, usage, {
21608
21713
  topicId,
21609
21714
  ...control.sessionId ? { providerSessionId: control.sessionId } : {},
21610
21715
  agent: agentType,
21611
- model
21716
+ model: pricedModel
21612
21717
  });
21613
21718
  };
21614
21719
  const broadcastContextProgress = (force = false) => {
@@ -22190,6 +22295,7 @@ var init_turn_event_stream = __esm(async () => {
22190
22295
  init_usage_alert();
22191
22296
  init_sensitive_path();
22192
22297
  await __promiseAll([
22298
+ init_codex_tier_resolver(),
22193
22299
  init_fork(),
22194
22300
  init_idle_archiver(),
22195
22301
  init_idle_compact(),
@@ -38114,7 +38220,7 @@ var init_scheduler = __esm(async () => {
38114
38220
 
38115
38221
  // ../../packages/module-cron/src/module.ts
38116
38222
  import { existsSync as existsSync36 } from "fs";
38117
- import { fileURLToPath as fileURLToPath3 } from "url";
38223
+ import { fileURLToPath as fileURLToPath4 } from "url";
38118
38224
  function envMs(name, fallback) {
38119
38225
  const parsed = Number.parseInt(process.env[name] ?? "", 10);
38120
38226
  return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
@@ -38243,8 +38349,8 @@ var init_module = __esm(async () => {
38243
38349
  init_scripts(),
38244
38350
  init_store()
38245
38351
  ]);
38246
- SOURCE_MCP_SERVER_FILE = fileURLToPath3(new URL("./mcp-server.ts", import.meta.url));
38247
- PACKAGED_MCP_SERVER_FILE = fileURLToPath3(new URL("./runtime/cron/mcp-server.ts", import.meta.url));
38352
+ SOURCE_MCP_SERVER_FILE = fileURLToPath4(new URL("./mcp-server.ts", import.meta.url));
38353
+ PACKAGED_MCP_SERVER_FILE = fileURLToPath4(new URL("./runtime/cron/mcp-server.ts", import.meta.url));
38248
38354
  });
38249
38355
 
38250
38356
  // ../../packages/module-cron/src/summarize.ts
@@ -44097,7 +44203,7 @@ function renderSideColumn(state, layout, bodyHeight, animationFrame) {
44097
44203
  function maxTopicsPanelScrollOffset(state, columns, rows) {
44098
44204
  const width = Math.max(1, columns);
44099
44205
  const height = Math.max(14, rows);
44100
- if (state.overlay)
44206
+ if (state.overlay && state.overlay !== "background-session")
44101
44207
  return 0;
44102
44208
  const layout = terminalBodyLayout(state, width);
44103
44209
  if (!layout.showTopicsPanel)
@@ -44110,7 +44216,7 @@ function maxTopicsPanelScrollOffset(state, columns, rows) {
44110
44216
  function maxTaskPanelScrollOffset(state, columns, rows) {
44111
44217
  const width = Math.max(1, columns);
44112
44218
  const height = Math.max(14, rows);
44113
- if (state.overlay)
44219
+ if (state.overlay && state.overlay !== "background-session")
44114
44220
  return 0;
44115
44221
  const layout = terminalBodyLayout(state, width);
44116
44222
  if (!layout.showTaskPanel)
@@ -48405,10 +48511,10 @@ class TerminalApp {
48405
48511
  this.#handleGraphMouse(event);
48406
48512
  continue;
48407
48513
  }
48408
- if (this.#handleSidePanelResizeDrag(event))
48514
+ if (this.#handleSidePanelScrollbarDrag(event))
48409
48515
  continue;
48410
48516
  this.#focusPaneUnderPress(event);
48411
- if (this.#handleSidePanelScrollbarDrag(event))
48517
+ if (this.#handleSidePanelResizeDrag(event))
48412
48518
  continue;
48413
48519
  if (this.#handlePickableRowMouse(event))
48414
48520
  continue;
@@ -48422,7 +48528,7 @@ class TerminalApp {
48422
48528
  this.#toggleTerminalPane();
48423
48529
  return;
48424
48530
  }
48425
- if (this.#state.terminalPaneFocused && this.#shell) {
48531
+ if (this.#state.terminalPaneFocused && this.#shell && this.#terminalPane) {
48426
48532
  this.#shell.write(chunk);
48427
48533
  return;
48428
48534
  }
@@ -48459,6 +48565,23 @@ class TerminalApp {
48459
48565
  this.#toggleDecisionGraph();
48460
48566
  return;
48461
48567
  }
48568
+ if (chunk === NEW_TOPIC_KEY && this.#sideColumnBounds !== null && !this.#state.creatingTopic) {
48569
+ if (editingVaultSecret)
48570
+ return;
48571
+ if (composerHoldsSecret(this.#state) || activeQuestion(this.#state))
48572
+ return;
48573
+ if (this.#input.text) {
48574
+ this.#state = {
48575
+ ...this.#state,
48576
+ notice: "Clear the message box first, then Ctrl-N to start a new topic",
48577
+ noticeLevel: "warn"
48578
+ };
48579
+ this.#queueRender();
48580
+ return;
48581
+ }
48582
+ this.#openNewTopicComposer();
48583
+ return;
48584
+ }
48462
48585
  if (chunk === "\x10") {
48463
48586
  if (editingVaultSecret)
48464
48587
  return;
@@ -48891,7 +49014,7 @@ class TerminalApp {
48891
49014
  notice: undefined,
48892
49015
  noticeLevel: undefined
48893
49016
  };
48894
- if (isKnownTerminalCommand(text3)) {
49017
+ if (isKnownTerminalCommand(text3) || isVaultCommandLine(text3)) {
48895
49018
  await this.#runCommand(text3);
48896
49019
  return;
48897
49020
  }
@@ -60232,4 +60355,4 @@ switch (command) {
60232
60355
  }
60233
60356
  }
60234
60357
 
60235
- //# debugId=3A2E1C01E70CD8A864756E2164756E21
60358
+ //# debugId=3FFA808EE892362C64756E2164756E21