negotium 0.23.1 → 0.23.3

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-w6xavjz2.js → chunk-6gt62j1j.js} +20 -8
  6. package/dist/chunk-6gt62j1j.js.map +12 -0
  7. package/dist/{chunk-z4r7tt2p.js → chunk-cez5m5hm.js} +1 -1
  8. package/dist/hosted-agent.js +97 -13
  9. package/dist/hosted-agent.js.map +8 -7
  10. package/dist/main.js +212 -48
  11. package/dist/main.js.map +15 -14
  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.3";
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
@@ -41921,6 +42027,7 @@ function createInitialState(userId) {
41921
42027
  topicUsage: {},
41922
42028
  messageHistory: {},
41923
42029
  activity: {},
42030
+ unread: {},
41924
42031
  input: "",
41925
42032
  inputCursor: { row: 0, col: 0 },
41926
42033
  suggestionIndex: 0,
@@ -42157,11 +42264,12 @@ function sortedTopicEntries(state, entries) {
42157
42264
  function topicPickerItems(state) {
42158
42265
  const visible = visibleTopicPickerIds(state);
42159
42266
  const indexedTopics = state.topics.map((topic, index) => ({ topic, index })).filter(({ topic }) => visible.has(topic.id));
42160
- const managerEntries = sortedTopicEntries(state, indexedTopics.filter(({ topic }) => topic.kind === "manager"));
42161
- const regularEntries = sortedTopicEntries(state, indexedTopics.filter(({ topic }) => topic.kind !== "manager"));
42162
42267
  return [
42163
- ...managerEntries.map(({ topic, index }) => ({ kind: "topic", id: topic.id, index })),
42164
- ...regularEntries.map(({ topic, index }) => ({ kind: "topic", id: topic.id, index })),
42268
+ ...managerFirstTopicEntries(state, indexedTopics).map(({ topic, index }) => ({
42269
+ kind: "topic",
42270
+ id: topic.id,
42271
+ index
42272
+ })),
42165
42273
  ...visibleBackgroundSessions(state).map((session) => ({
42166
42274
  kind: "background",
42167
42275
  id: session.id
@@ -42237,6 +42345,7 @@ function setTopics(state, topics, preferredTitle) {
42237
42345
  ...state,
42238
42346
  topics: orderedTopics,
42239
42347
  activity,
42348
+ unread: withoutUnread(state.unread, nextActive),
42240
42349
  activeTopicId: nextActive,
42241
42350
  scrollOffset: nextActive === state.activeTopicId ? state.scrollOffset : 0,
42242
42351
  askChoiceIndex: nextActive === state.activeTopicId ? state.askChoiceIndex : 0,
@@ -42244,11 +42353,32 @@ function setTopics(state, topics, preferredTitle) {
42244
42353
  topicPickerBackgroundId: state.topicPickerBackgroundId
42245
42354
  });
42246
42355
  }
42356
+ function withoutUnread(unread, topicId) {
42357
+ if (topicId === null || !unread[topicId])
42358
+ return unread;
42359
+ const next = { ...unread };
42360
+ delete next[topicId];
42361
+ return next;
42362
+ }
42363
+ function managerFirstTopicEntries(state, entries) {
42364
+ return [
42365
+ ...sortedTopicEntries(state, entries.filter(({ topic }) => topic.kind === "manager")),
42366
+ ...sortedTopicEntries(state, entries.filter(({ topic }) => topic.kind !== "manager"))
42367
+ ];
42368
+ }
42369
+ function adjacentTopicId(state, delta) {
42370
+ const order = managerFirstTopicEntries(state, state.topics.map((topic) => ({ topic }))).map(({ topic }) => topic.id);
42371
+ const current3 = order.indexOf(state.activeTopicId ?? "");
42372
+ if (current3 < 0 || order.length < 2)
42373
+ return null;
42374
+ return order[(current3 + delta + order.length) % order.length] ?? null;
42375
+ }
42247
42376
  function selectTopic(state, topicId) {
42248
42377
  if (!state.topics.some((topic) => topic.id === topicId))
42249
42378
  return state;
42250
42379
  return {
42251
42380
  ...state,
42381
+ unread: withoutUnread(state.unread, topicId),
42252
42382
  activeTopicId: topicId,
42253
42383
  scrollOffset: 0,
42254
42384
  askChoiceIndex: 0,
@@ -42336,6 +42466,11 @@ function removeMessage(state, topicId, messageId) {
42336
42466
  return state;
42337
42467
  return { ...state, messages: { ...state.messages, [topicId]: next } };
42338
42468
  }
42469
+ function flagUnreadReply(state, topicId, wasRunning) {
42470
+ if (!wasRunning || topicId === state.activeTopicId)
42471
+ return state;
42472
+ return { ...state, unread: { ...state.unread, [topicId]: true } };
42473
+ }
42339
42474
  function activityFor(state, topicId) {
42340
42475
  return state.activity[topicId] ?? { running: false, tools: [] };
42341
42476
  }
@@ -42504,11 +42639,11 @@ function applyAiStatus(state, topicId, raw, createdAt) {
42504
42639
  if (kind === "ai_done") {
42505
42640
  if (isStaleTerminalStatus(current3, status))
42506
42641
  return state;
42507
- return setActivity(state, topicId, {
42642
+ return flagUnreadReply(setActivity(state, topicId, {
42508
42643
  ...liveCurrent,
42509
42644
  running: false,
42510
42645
  status: "Done"
42511
- });
42646
+ }), topicId, current3.running);
42512
42647
  }
42513
42648
  if (kind === "ai_aborted") {
42514
42649
  if (isStaleTerminalStatus(current3, status))
@@ -42522,12 +42657,12 @@ function applyAiStatus(state, topicId, raw, createdAt) {
42522
42657
  if (kind === "ai_error") {
42523
42658
  if (isStaleTerminalStatus(current3, status))
42524
42659
  return state;
42525
- return setActivity(state, topicId, {
42660
+ return flagUnreadReply(setActivity(state, topicId, {
42526
42661
  ...liveCurrent,
42527
42662
  running: false,
42528
42663
  status: "Error",
42529
42664
  error: String(status.error ?? "Unknown error")
42530
- });
42665
+ }), topicId, current3.running);
42531
42666
  }
42532
42667
  if (kind === "tool_call") {
42533
42668
  if (isStaleTerminalStatus(current3, status))
@@ -43895,6 +44030,8 @@ function topicStatusIndicator(state, topic, animationFrame) {
43895
44030
  if (state.activity[topic.id]?.running) {
43896
44031
  return { icon: workingFrame(animationFrame), fg: theme.green };
43897
44032
  }
44033
+ if (state.unread[topic.id])
44034
+ return { icon: "\u25CF", fg: theme.blue };
43898
44035
  return { icon: "\u25CB", fg: theme.muted };
43899
44036
  }
43900
44037
  function topicPanelRowLines(state, topic, topicIndex, animationFrame) {
@@ -44097,7 +44234,7 @@ function renderSideColumn(state, layout, bodyHeight, animationFrame) {
44097
44234
  function maxTopicsPanelScrollOffset(state, columns, rows) {
44098
44235
  const width = Math.max(1, columns);
44099
44236
  const height = Math.max(14, rows);
44100
- if (state.overlay)
44237
+ if (state.overlay && state.overlay !== "background-session")
44101
44238
  return 0;
44102
44239
  const layout = terminalBodyLayout(state, width);
44103
44240
  if (!layout.showTopicsPanel)
@@ -44110,7 +44247,7 @@ function maxTopicsPanelScrollOffset(state, columns, rows) {
44110
44247
  function maxTaskPanelScrollOffset(state, columns, rows) {
44111
44248
  const width = Math.max(1, columns);
44112
44249
  const height = Math.max(14, rows);
44113
- if (state.overlay)
44250
+ if (state.overlay && state.overlay !== "background-session")
44114
44251
  return 0;
44115
44252
  const layout = terminalBodyLayout(state, width);
44116
44253
  if (!layout.showTaskPanel)
@@ -44133,6 +44270,7 @@ function helpLines() {
44133
44270
  line(" Ctrl-R sort topics panel (activity / name) \xB7 drag a \u2502 divider to resize"),
44134
44271
  line(" Ctrl-T open/close a shell on the right (closing ends it) \xB7 click it to type"),
44135
44272
  line(" Ctrl-O topics \xB7 Ctrl-G subagents \xB7 Ctrl-D decisions \xB7 Ctrl-X abort"),
44273
+ line(" Ctrl/Alt-\u2191 \u2193 step through topics \xB7 a blue \u25CF marks an unread reply"),
44136
44274
  line(" In topics: type to filter \xB7 Ctrl-N new \xB7 Ctrl-D delete"),
44137
44275
  line(" Esc/Ctrl-C stop active turn \xB7 Ctrl-C twice when idle to quit"),
44138
44276
  line(""),
@@ -45343,6 +45481,7 @@ var init_render = __esm(async () => {
45343
45481
  cyan: [87, 205, 220],
45344
45482
  tool: [196, 181, 253],
45345
45483
  green: [94, 211, 142],
45484
+ blue: [96, 165, 250],
45346
45485
  diffAddBg: [18, 43, 32],
45347
45486
  amber: [241, 190, 91],
45348
45487
  red: [245, 116, 128],
@@ -48405,10 +48544,10 @@ class TerminalApp {
48405
48544
  this.#handleGraphMouse(event);
48406
48545
  continue;
48407
48546
  }
48408
- if (this.#handleSidePanelResizeDrag(event))
48547
+ if (this.#handleSidePanelScrollbarDrag(event))
48409
48548
  continue;
48410
48549
  this.#focusPaneUnderPress(event);
48411
- if (this.#handleSidePanelScrollbarDrag(event))
48550
+ if (this.#handleSidePanelResizeDrag(event))
48412
48551
  continue;
48413
48552
  if (this.#handlePickableRowMouse(event))
48414
48553
  continue;
@@ -48422,7 +48561,7 @@ class TerminalApp {
48422
48561
  this.#toggleTerminalPane();
48423
48562
  return;
48424
48563
  }
48425
- if (this.#state.terminalPaneFocused && this.#shell) {
48564
+ if (this.#state.terminalPaneFocused && this.#shell && this.#terminalPane) {
48426
48565
  this.#shell.write(chunk);
48427
48566
  return;
48428
48567
  }
@@ -48459,6 +48598,29 @@ class TerminalApp {
48459
48598
  this.#toggleDecisionGraph();
48460
48599
  return;
48461
48600
  }
48601
+ if (chunk === NEW_TOPIC_KEY && this.#sideColumnBounds !== null && !this.#state.creatingTopic) {
48602
+ if (editingVaultSecret)
48603
+ return;
48604
+ if (composerHoldsSecret(this.#state) || activeQuestion(this.#state))
48605
+ return;
48606
+ if (this.#input.text) {
48607
+ this.#state = {
48608
+ ...this.#state,
48609
+ notice: "Clear the message box first, then Ctrl-N to start a new topic",
48610
+ noticeLevel: "warn"
48611
+ };
48612
+ this.#queueRender();
48613
+ return;
48614
+ }
48615
+ this.#openNewTopicComposer();
48616
+ return;
48617
+ }
48618
+ if (this.#state.overlay === null && (PREVIOUS_TOPIC_KEYS.has(chunk) || NEXT_TOPIC_KEYS.has(chunk))) {
48619
+ const topicId = adjacentTopicId(this.#state, PREVIOUS_TOPIC_KEYS.has(chunk) ? -1 : 1);
48620
+ if (topicId !== null)
48621
+ this.#activateTopic(topicId);
48622
+ return;
48623
+ }
48462
48624
  if (chunk === "\x10") {
48463
48625
  if (editingVaultSecret)
48464
48626
  return;
@@ -48891,7 +49053,7 @@ class TerminalApp {
48891
49053
  notice: undefined,
48892
49054
  noticeLevel: undefined
48893
49055
  };
48894
- if (isKnownTerminalCommand(text3)) {
49056
+ if (isKnownTerminalCommand(text3) || isVaultCommandLine(text3)) {
48895
49057
  await this.#runCommand(text3);
48896
49058
  return;
48897
49059
  }
@@ -50167,7 +50329,7 @@ class TerminalApp {
50167
50329
  await this.#client.stop();
50168
50330
  }
50169
50331
  }
50170
- var KITTY_KEYBOARD_PUSH = "\x1B[>1u", KITTY_KEYBOARD_POP = "\x1B[<u", CANVAS_RGB, ENTER_ALT_SCREEN, EXIT_ALT_SCREEN, ABORT_ENTER_ALT_SCREEN, NEW_TOPIC_KEY = "\x0E", DELETE_TOPIC_KEY = "\x04", TERMINAL_PANE_KEY = "\x14", FILTER_BACKSPACE_KEYS, CONFIRM_KEYS, CANCEL_KEYS, INPUT_CARRY_FLUSH_MS = 15;
50332
+ var KITTY_KEYBOARD_PUSH = "\x1B[>1u", KITTY_KEYBOARD_POP = "\x1B[<u", CANVAS_RGB, ENTER_ALT_SCREEN, EXIT_ALT_SCREEN, ABORT_ENTER_ALT_SCREEN, NEW_TOPIC_KEY = "\x0E", DELETE_TOPIC_KEY = "\x04", TERMINAL_PANE_KEY = "\x14", PREVIOUS_TOPIC_KEYS, NEXT_TOPIC_KEYS, FILTER_BACKSPACE_KEYS, CONFIRM_KEYS, CANCEL_KEYS, INPUT_CARRY_FLUSH_MS = 15;
50171
50333
  var init_app = __esm(async () => {
50172
50334
  init_color_depth();
50173
50335
  init_commands();
@@ -50191,6 +50353,8 @@ var init_app = __esm(async () => {
50191
50353
  ENTER_ALT_SCREEN = altScreenSequences().enter;
50192
50354
  EXIT_ALT_SCREEN = altScreenSequences().exit;
50193
50355
  ABORT_ENTER_ALT_SCREEN = altScreenSequences().abortEnter;
50356
+ PREVIOUS_TOPIC_KEYS = new Set(["\x1B[1;5A", "\x1B[1;3A", "\x1B\x1B[A"]);
50357
+ NEXT_TOPIC_KEYS = new Set(["\x1B[1;5B", "\x1B[1;3B", "\x1B\x1B[B"]);
50194
50358
  FILTER_BACKSPACE_KEYS = new Set(["\x7F", "\b"]);
50195
50359
  CONFIRM_KEYS = new Set(["y", "\u315B"]);
50196
50360
  CANCEL_KEYS = new Set(["n", "\u315C"]);
@@ -60232,4 +60396,4 @@ switch (command) {
60232
60396
  }
60233
60397
  }
60234
60398
 
60235
- //# debugId=3A2E1C01E70CD8A864756E2164756E21
60399
+ //# debugId=202F5FA265766A0464756E2164756E21