@cnwenf/occ 2.1.328 → 2.1.329

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/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![npm version](https://img.shields.io/npm/v/@cnwenf/occ.svg)](https://www.npmjs.com/package/@cnwenf/occ)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
7
7
  [![Runtime: Bun](https://img.shields.io/badge/Runtime-Bun-%23000000.svg)](https://bun.sh/)
8
- [![Tracks: Claude Code 2.1.223](https://img.shields.io/badge/Tracks-Claude%20Code%202.1.223-blueviolet.svg)](https://docs.anthropic.com/en/docs/claude-code)
8
+ [![Tracks: Claude Code 2.1.267](https://img.shields.io/badge/Tracks-Claude%20Code%202.1.267-blueviolet.svg)](https://docs.anthropic.com/en/docs/claude-code)
9
9
 
10
10
  [简体中文](./README.zh-CN.md) · **English**
11
11
 
@@ -13,7 +13,7 @@
13
13
 
14
14
  ## What is OCC
15
15
 
16
- **Open C Code (OCC)** is an open-source coding agent. Its capabilities are aligned with [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (currently tracking `2.1.223` — 2.1.218 fully aligned, 2.1.219 + 2.1.221 + 2.1.223 partial, 2.1.222 staged, per OCC-46 gap report). The code is fully open, auditable, backdoor-free, and your data stays under your control.
16
+ **Open C Code (OCC)** is an open-source coding agent. Its capabilities are aligned with [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (currently tracking `2.1.267` — 2.1.266 fully aligned; 2.1.267 partial: settings-side effort cap + E8/E9/E10/E12/E32/E33 landed, E8-runtime-realpath / E11 / E19 / E20 / E34 / prompt-cache-snapshot staged, per OCC-121 + OCC-82 gap reports). The code is fully open, auditable, backdoor-free, and your data stays under your control.
17
17
 
18
18
  If you worry that a closed-source CLI might hide backdoors, or that your code and credentials are uploaded to unauditable services, OCC is for you: all source is open and unobfuscated, the build is reproducible from source, and API credentials are sent only to endpoints you configure.
19
19
 
@@ -62,7 +62,7 @@ Requires a valid Anthropic API Key (or AWS Bedrock / Google Vertex / Azure Found
62
62
  | **Auditability** | Line-by-line reviewable | No |
63
63
  | **Telemetry** | Minimal (analytics stubbed) | Standard |
64
64
  | **Data sovereignty** | Credentials stay on your machine; requests only to endpoints you configure | Anthropic endpoints |
65
- | **Capability parity** | Tracks CC `2.1.223` (partial) | Reference implementation |
65
+ | **Capability parity** | Tracks CC `2.1.267` (partial) | Reference implementation |
66
66
  | **Providers** | Anthropic Direct, Bedrock, Vertex, Azure | Anthropic, Bedrock, Vertex |
67
67
  | **Cost** | Free & open-source (MIT) | Subscription |
68
68
  | **Build** | Reproducible from source | N/A |
@@ -157,7 +157,7 @@ For architecture, entry/bootstrap, tool system, UI layer, and module-status deta
157
157
 
158
158
  ## Status
159
159
 
160
- - Tracks Claude Code **`2.1.223` (partial)** (2.1.218 fully aligned; 2.1.219 + 2.1.221 + 2.1.223 partial, 2.1.222 staged — see `docs/upstream-version-gap-occ46.md`).
160
+ - Tracks Claude Code **`2.1.267` (partial)** (2.1.266 fully aligned; 2.1.267 partial: settings-side effort cap + E8/E9/E10/E12/E32/E33 landed, E8-runtime-realpath / E11 / E19 / E20 / E34 / prompt-cache-snapshot staged — see `docs/upstream-version-gap-occ121.md` and `docs/upstream-version-gap-occ82.md`).
161
161
  - Published to npm as [`@cnwenf/occ`](https://www.npmjs.com/package/@cnwenf/occ).
162
162
  - Many modules are intentionally stubbed or feature-flagged off — see "Disabled / stubbed" above.
163
163
 
package/README.zh-CN.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## 这是什么
10
10
 
11
- **Open C Code(OCC)** 是一个开源的编码智能体。能力与 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 对齐(当前跟踪 `2.1.223`:2.1.218 已完全对齐、2.1.219 / 2.1.221 / 2.1.223 部分对齐、2.1.222 待补齐)。代码全开放、可审计、无暗门,数据由你掌控。
11
+ **Open C Code(OCC)** 是一个开源的编码智能体。能力与 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 对齐(当前跟踪 `2.1.267`:2.1.266 已完全对齐、2.1.267 部分对齐——settings 侧 effort cap 与 E8/E9/E10/E12/E32/E33 已落地,E8-runtime-realpath / E11 / E19 / E20 / E34 / prompt-cache 快照子系统暂缓,详见 OCC-121 与 OCC-82 台账)。代码全开放、可审计、无暗门,数据由你掌控。
12
12
 
13
13
  如果你担心闭源 CLI 可能植入后门、担心代码与凭据被上传到不可审计的服务,OCC 就是为你准备的:全部源码开放、无混淆,构建产物可由源码复现,API 凭据只发往你自己配置的端点。
14
14
 
@@ -21,7 +21,7 @@
21
21
 
22
22
  ## 现状
23
23
 
24
- - 跟踪 Claude Code **`2.1.223`**(2.1.218 完全对齐、2.1.219 / 2.1.221 / 2.1.223 部分对齐、2.1.222 待补齐)。
24
+ - 跟踪 Claude Code **`2.1.267`**(2.1.266 已完全对齐、2.1.267 部分对齐——settings 侧 effort cap 与 E8/E9/E10/E12/E32/E33 已落地,E8-runtime-realpath / E11 / E19 / E20 / E34 / prompt-cache 快照子系统暂缓)。
25
25
  - 代码库有约 1300 个不阻塞的 `tsc` 类型错误(大量松散的 `unknown`/`never`/`{}` 类型),**不影响 Bun 运行时执行**。门槛是 Biome lint,不是 `tsc`。
26
26
  - 所有内部 feature flag(`feature(...)`)已被 polyfill 为 `false` —— 内部功能(COORDINATOR_MODE、KAIROS、PROACTIVE 等)全部关闭。
27
27
  - 已发布到 npm:[`@cnwenf/occ`](https://www.npmjs.com/package/@cnwenf/occ)。
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- globalThis.MACRO={"VERSION":"2.1.328","BINARY_NAME":"occ","BUILD_TIME":"2026-09-10T19:48:17.557Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
2
+ globalThis.MACRO={"VERSION":"2.1.329","BINARY_NAME":"occ","BUILD_TIME":"2026-09-11T03:55:52.872Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
3
3
  // @bun
4
4
  var __create = Object.create;
5
5
  var __getProtoOf = Object.getPrototypeOf;
@@ -59707,6 +59707,22 @@ var init_types2 = __esm(() => {
59707
59707
  prUrlTemplate: exports_external.string().optional().describe('URL template for the footer PR badge (e.g. "https://internal-review.example.com/pr/{number}"). Uses {number} as the PR number placeholder. Defaults to github.com.'),
59708
59708
  alwaysThinkingEnabled: exports_external.boolean().optional().describe("When false, thinking is disabled. When absent or true, thinking is " + "enabled automatically for supported models."),
59709
59709
  effortLevel: exports_external.enum(["low", "medium", "high", "xhigh"]).optional().catch(undefined).describe("Persisted effort level for supported models."),
59710
+ maxEffortLevel: exports_external.enum(["low", "medium", "high", "xhigh", "max"]).optional().catch(undefined).describe("Maximum effort level. Anything above it (an /effort or /model pick, --effort, CLAUDE_CODE_EFFORT_LEVEL, a model default) is clamped to it, on every provider including Bedrock, Vertex and Foundry. Combines with an organization's per-model effort cap by taking the lower of the two; across settings files the lowest value wins, and modelSettings.<model>.maxEffortLevel replaces it per model. Enforced client-side: an effort supplied through CLAUDE_CODE_EXTRA_BODY is not clamped."),
59711
+ modelSettings: exports_external.preprocess((value) => {
59712
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
59713
+ return value;
59714
+ }
59715
+ const stripped = {};
59716
+ for (const [key, entry] of Object.entries(value)) {
59717
+ if (!Object.hasOwn(Object.prototype, key)) {
59718
+ stripped[key] = entry;
59719
+ }
59720
+ }
59721
+ return stripped;
59722
+ }, exports_external.record(exports_external.string(), exports_external.object({
59723
+ effortLevel: exports_external.enum(["low", "medium", "high", "xhigh"]).optional().catch(undefined).describe("Persisted effort level for this model."),
59724
+ maxEffortLevel: exports_external.enum(["low", "medium", "high", "xhigh", "max"]).optional().catch(undefined).describe('Maximum effort level for this model. Within one settings file it replaces the top-level maxEffortLevel for the model ("max" exempts it); across settings files the lowest applicable value wins. Keyed like effortLevel: the canonical model name also matches its dated, [1m], Bedrock and Vertex spellings.')
59725
+ }).passthrough().optional().catch(undefined))).optional().catch(undefined).describe("Per-model settings keyed by canonical model name."),
59710
59726
  dynamicWorkflowSize: exports_external.enum(["small", "medium", "large"]).optional().catch(undefined).describe("Advisory guideline for how large Claude makes dynamic workflows (small/medium/large agent counts). Not an enforced cap."),
59711
59727
  advisorModel: exports_external.string().optional().describe("Advisor model for the server-side advisor tool."),
59712
59728
  fastMode: exports_external.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),
@@ -203938,6 +203954,122 @@ var init_thinking = __esm(() => {
203938
203954
  ];
203939
203955
  });
203940
203956
 
203957
+ // src/utils/effort/cap.ts
203958
+ function effortLevelIndex(level) {
203959
+ return EFFORT_LEVELS.indexOf(level);
203960
+ }
203961
+ function isKnownEffortLevel(value) {
203962
+ return typeof value === "string" && EFFORT_LEVELS.includes(value);
203963
+ }
203964
+ function getSettingsEffortCap(model) {
203965
+ const sources = getEnabledSettingSources().map((source) => getSettingsForSource(source));
203966
+ const canonicalTarget = sources.some((settings) => Object.values(settings?.modelSettings ?? {}).some((entry) => entry?.maxEffortLevel !== undefined)) ? getCanonicalName(model) : undefined;
203967
+ let lowest = null;
203968
+ for (const settings of sources) {
203969
+ if (!settings)
203970
+ continue;
203971
+ let perFile;
203972
+ if (canonicalTarget !== undefined) {
203973
+ for (const [key, entry] of Object.entries(settings.modelSettings ?? {})) {
203974
+ if (Object.hasOwn(Object.prototype, key))
203975
+ continue;
203976
+ const candidate = entry?.maxEffortLevel;
203977
+ if (candidate !== undefined && (perFile === undefined || effortLevelIndex(candidate) < effortLevelIndex(perFile)) && getCanonicalName(key) === canonicalTarget) {
203978
+ perFile = candidate;
203979
+ }
203980
+ }
203981
+ }
203982
+ perFile ??= settings.maxEffortLevel;
203983
+ if (perFile !== undefined && perFile !== "max" && (lowest === null || effortLevelIndex(perFile) < effortLevelIndex(lowest))) {
203984
+ lowest = perFile;
203985
+ }
203986
+ }
203987
+ return lowest;
203988
+ }
203989
+ function getEffectiveEffortCap(model) {
203990
+ const cap = getSettingsEffortCap(model);
203991
+ return cap === "max" ? null : cap;
203992
+ }
203993
+ function isEffortLevelAllowed(level, model) {
203994
+ const cap = getEffectiveEffortCap(model);
203995
+ return cap === null || effortLevelIndex(level) <= effortLevelIndex(cap);
203996
+ }
203997
+ function getAllowedEffortLevels(model) {
203998
+ return EFFORT_LEVELS.filter((level) => isEffortLevelAllowed(level, model));
203999
+ }
204000
+ function modelSupportsEffortLevel(model, level) {
204001
+ if (level === "xhigh")
204002
+ return modelSupportsXhighEffort(model);
204003
+ if (level === "max")
204004
+ return modelSupportsMaxEffort(model);
204005
+ return true;
204006
+ }
204007
+ function clampEffortToCap(value, model) {
204008
+ const cap = getEffectiveEffortCap(model);
204009
+ if (cap !== null && isKnownEffortLevel(value)) {
204010
+ return effortLevelIndex(value) > effortLevelIndex(cap) ? cap : value;
204011
+ }
204012
+ return value;
204013
+ }
204014
+ function applyEffortCapabilityDowngrade(value, model) {
204015
+ let result = value;
204016
+ if (result === "max" && !modelSupportsMaxEffort(model))
204017
+ result = "high";
204018
+ if (result === "xhigh" && !modelSupportsXhighEffort(model))
204019
+ result = "high";
204020
+ return result;
204021
+ }
204022
+ function clampEffortValue(value, model) {
204023
+ return applyEffortCapabilityDowngrade(clampEffortToCap(value, model), model);
204024
+ }
204025
+ function hasEffortLevelsAboveCap(model) {
204026
+ const cap = getEffectiveEffortCap(model);
204027
+ if (cap === null)
204028
+ return false;
204029
+ return EFFORT_LEVELS.some((level) => effortLevelIndex(level) > effortLevelIndex(cap) && modelSupportsEffortLevel(model, level));
204030
+ }
204031
+ function getEffortCapWarning(requested, model) {
204032
+ if (!isKnownEffortLevel(requested))
204033
+ return null;
204034
+ const cap = getEffectiveEffortCap(model);
204035
+ if (cap === null || effortLevelIndex(requested) <= effortLevelIndex(cap)) {
204036
+ return null;
204037
+ }
204038
+ const using = clampEffortValue(requested, model);
204039
+ return `Effort '${requested}' exceeds the cap for ${model} set by your settings or organization; using '${using}'.`;
204040
+ }
204041
+ function emitStartupEffortCapWarning(requestedEffort, model, outputFormat) {
204042
+ const warning = getEffortCapWarning(requestedEffort, model);
204043
+ if (warning === null)
204044
+ return;
204045
+ if (outputFormat !== "json" && outputFormat !== "stream-json" && process.env.CLAUDE_CODE_SESSION_KIND !== "bg") {
204046
+ console.warn(source_default.yellow(warning));
204047
+ return;
204048
+ }
204049
+ logForDebugging(`[effort] ${warning}`);
204050
+ }
204051
+ function isUltracodeAvailableForModel(model) {
204052
+ return model === undefined || modelSupportsXhighEffort(model) && isEffortLevelAllowed("xhigh", model);
204053
+ }
204054
+ function formatEffortValidOptions(model) {
204055
+ const levels = getAllowedEffortLevels(model);
204056
+ const ultracode = isUltracodeAvailableForModel(model) ? ", ultracode" : "";
204057
+ return `${levels.join(", ")}${ultracode}, auto`;
204058
+ }
204059
+ function buildEffortArgumentHint(open6, close, model) {
204060
+ const levels = getAllowedEffortLevels(model);
204061
+ const ultracode = isUltracodeAvailableForModel(model) ? "|ultracode" : "";
204062
+ return `${open6}${levels.join("|")}${ultracode}|auto${close}`;
204063
+ }
204064
+ var init_cap = __esm(() => {
204065
+ init_source();
204066
+ init_debug();
204067
+ init_model();
204068
+ init_constants2();
204069
+ init_settings2();
204070
+ init_effort();
204071
+ });
204072
+
203941
204073
  // src/utils/effort.ts
203942
204074
  function modelSupportsEffort(model) {
203943
204075
  const m5 = model.toLowerCase();
@@ -204026,24 +204158,30 @@ function getEffortEnvOverride() {
204026
204158
  }
204027
204159
  function resolveAppliedEffort(model, appStateEffortValue) {
204028
204160
  const envOverride = getEffortEnvOverride();
204029
- if (envOverride === null) {
204161
+ const hasSettingsCap = getSettingsEffortCap(model) !== null;
204162
+ if (envOverride === null && !hasSettingsCap) {
204030
204163
  return;
204031
204164
  }
204032
- const resolved = envOverride ?? appStateEffortValue ?? getDefaultEffortForModel(model);
204033
- if (resolved === "max" && !modelSupportsMaxEffort(model)) {
204034
- return "high";
204165
+ const modelDefault = getDefaultEffortForModel(model);
204166
+ let resolved = envOverride ?? (envOverride === null ? modelDefault : undefined) ?? appStateEffortValue ?? modelDefault;
204167
+ if (typeof resolved === "number" && hasSettingsCap) {
204168
+ resolved = "high";
204035
204169
  }
204036
- if (resolved === "xhigh" && !modelSupportsXhighEffort(model)) {
204037
- return "high";
204170
+ if (resolved === undefined) {
204171
+ return;
204038
204172
  }
204039
- return resolved;
204173
+ return clampEffortValue(resolved, model);
204040
204174
  }
204041
204175
  function resolveConfiguredEffort(model, appStateEffortValue) {
204042
204176
  const envOverride = getEffortEnvOverride();
204043
204177
  if (envOverride === null) {
204044
204178
  return;
204045
204179
  }
204046
- return envOverride ?? appStateEffortValue ?? getDefaultEffortForModel(model);
204180
+ const resolved = envOverride ?? appStateEffortValue ?? getDefaultEffortForModel(model);
204181
+ if (resolved === undefined) {
204182
+ return;
204183
+ }
204184
+ return clampEffortToCap(resolved, model);
204047
204185
  }
204048
204186
  function getDisplayedEffortLevel(model, appStateEffort) {
204049
204187
  const configured = resolveConfiguredEffort(model, appStateEffort) ?? "high";
@@ -204148,6 +204286,7 @@ var init_effort = __esm(() => {
204148
204286
  init_providers();
204149
204287
  init_modelSupportOverrides();
204150
204288
  init_envUtils();
204289
+ init_cap();
204151
204290
  EFFORT_LEVELS = [
204152
204291
  "low",
204153
204292
  "medium",
@@ -560902,18 +561041,18 @@ function parseFolderPath(folderPath) {
560902
561041
  }
560903
561042
  return { platform: platform5, buildId };
560904
561043
  }
560905
- var import_debug177, debugCache;
561044
+ var import_debug178, debugCache;
560906
561045
  var init_Cache = __esm(() => {
560907
561046
  init_browser_data();
560908
561047
  init_detectPlatform();
560909
- import_debug177 = __toESM(require_src(), 1);
560910
- debugCache = import_debug177.default("puppeteer:browsers:cache");
561048
+ import_debug178 = __toESM(require_src(), 1);
561049
+ debugCache = import_debug178.default("puppeteer:browsers:cache");
560911
561050
  });
560912
561051
 
560913
561052
  // node_modules/.bun/@puppeteer+browsers@2.13.2/node_modules/@puppeteer/browsers/lib/esm/debug.js
560914
- var import_debug178;
561053
+ var import_debug179;
560915
561054
  var init_debug3 = __esm(() => {
560916
- import_debug178 = __toESM(require_src(), 1);
561055
+ import_debug179 = __toESM(require_src(), 1);
560917
561056
  });
560918
561057
 
560919
561058
  // node_modules/.bun/@puppeteer+browsers@2.13.2/node_modules/@puppeteer/browsers/lib/esm/launch.js
@@ -561232,7 +561371,7 @@ var init_launch = __esm(() => {
561232
561371
  init_Cache();
561233
561372
  init_debug3();
561234
561373
  init_detectPlatform();
561235
- debugLaunch = import_debug178.default("puppeteer:browsers:launcher");
561374
+ debugLaunch = import_debug179.default("puppeteer:browsers:launcher");
561236
561375
  CDP_WEBSOCKET_ENDPOINT_REGEX = /^DevTools listening on (ws:\/\/.*)$/;
561237
561376
  WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = /^WebDriver BiDi listening on (ws:\/\/.*)$/;
561238
561377
  processListeners = new Map;
@@ -566316,10 +566455,10 @@ async function installDMG(dmgPath, folderPath) {
566316
566455
  spawnSync4("hdiutil", ["detach", mountPath, "-quiet"]);
566317
566456
  }
566318
566457
  }
566319
- var import_debug180, debugFileUtil, internalConstantsForTesting;
566458
+ var import_debug181, debugFileUtil, internalConstantsForTesting;
566320
566459
  var init_fileUtil = __esm(() => {
566321
- import_debug180 = __toESM(require_src(), 1);
566322
- debugFileUtil = import_debug180.default("puppeteer:browsers:fileUtil");
566460
+ import_debug181 = __toESM(require_src(), 1);
566461
+ debugFileUtil = import_debug181.default("puppeteer:browsers:fileUtil");
566323
566462
  internalConstantsForTesting = {
566324
566463
  xz: "xz",
566325
566464
  bzip2: "bzip2"
@@ -566612,7 +566751,7 @@ var init_install = __esm(() => {
566612
566751
  init_fileUtil();
566613
566752
  init_httpUtil();
566614
566753
  import_progress = __toESM(require_node_progress(), 1);
566615
- debugInstall = import_debug178.default("puppeteer:browsers:install");
566754
+ debugInstall = import_debug179.default("puppeteer:browsers:install");
566616
566755
  times = new Map;
566617
566756
  });
566618
566757
 
@@ -572887,7 +573026,7 @@ import fs23 from "fs";
572887
573026
  import os16 from "os";
572888
573027
  import { dirname as dirname45 } from "path";
572889
573028
  import { PassThrough as PassThrough4 } from "stream";
572890
- var import_debug182, __runInitializers23 = function(thisArg, initializers, value) {
573029
+ var import_debug183, __runInitializers23 = function(thisArg, initializers, value) {
572891
573030
  var useValue = arguments.length > 2;
572892
573031
  for (var i6 = 0;i6 < initializers.length; i6++) {
572893
573032
  value = useValue ? initializers[i6].call(thisArg, value) : initializers[i6].call(thisArg);
@@ -572947,8 +573086,8 @@ var init_ScreenRecorder = __esm(() => {
572947
573086
  init_util6();
572948
573087
  init_decorators();
572949
573088
  init_disposable();
572950
- import_debug182 = __toESM(require_src(), 1);
572951
- debugFfmpeg = import_debug182.default("puppeteer:ffmpeg");
573089
+ import_debug183 = __toESM(require_src(), 1);
573090
+ debugFfmpeg = import_debug183.default("puppeteer:ffmpeg");
572952
573091
  ScreenRecorder = (() => {
572953
573092
  let _classSuper = PassThrough4;
572954
573093
  let _instanceExtraInitializers = [];
@@ -632683,7 +632822,11 @@ function should1hCacheTTL(querySource, agentCacheTtlOverride) {
632683
632822
  return resolvePromptCacheTtl(querySource, { agentCacheTtlOverride }).ttl === "1h";
632684
632823
  }
632685
632824
  function configureEffortParams(effortValue, outputConfig, extraBodyParams, betas, model) {
632686
- if (!modelSupportsEffort(model) || "effort" in outputConfig) {
632825
+ if (!modelSupportsEffort(model)) {
632826
+ delete outputConfig.effort;
632827
+ return;
632828
+ }
632829
+ if ("effort" in outputConfig) {
632687
632830
  return;
632688
632831
  }
632689
632832
  if (effortValue === undefined) {
@@ -632691,12 +632834,6 @@ function configureEffortParams(effortValue, outputConfig, extraBodyParams, betas
632691
632834
  } else if (typeof effortValue === "string") {
632692
632835
  outputConfig.effort = effortValue;
632693
632836
  betas.push(EFFORT_BETA_HEADER);
632694
- } else if (process.env.USER_TYPE === "ant") {
632695
- const existingInternal = extraBodyParams.anthropic_internal || {};
632696
- extraBodyParams.anthropic_internal = {
632697
- ...existingInternal,
632698
- effort_override: effortValue
632699
- };
632700
632837
  }
632701
632838
  }
632702
632839
  function configureTaskBudgetParams(taskBudget, outputConfig, betas) {
@@ -637288,17 +637425,23 @@ function applySettingsChange(source2, setAppState) {
637288
637425
  const prevEffort = prev.settings.effortLevel;
637289
637426
  const newEffort = newSettings.effortLevel;
637290
637427
  const effortChanged = prevEffort !== newEffort;
637428
+ const effortSyncModel = getMainLoopModel();
637429
+ const effortSyncBlocked = !modelSupportsEffort(effortSyncModel) || getEffortEnvOverride() !== undefined;
637430
+ const clampedEffort = effortSyncBlocked || newEffort === undefined ? undefined : clampEffortToCap(newEffort, effortSyncModel);
637291
637431
  return {
637292
637432
  ...prev,
637293
637433
  settings: newSettings,
637294
637434
  toolPermissionContext: newContext,
637295
- ...effortChanged && newEffort !== undefined ? { effortValue: newEffort } : {}
637435
+ ...effortChanged && clampedEffort !== undefined ? { effortValue: clampedEffort } : {}
637296
637436
  };
637297
637437
  });
637298
637438
  }
637299
637439
  var init_applySettingsChange = __esm(() => {
637300
637440
  init_debug();
637441
+ init_effort();
637442
+ init_cap();
637301
637443
  init_hooksConfigSnapshot();
637444
+ init_model();
637302
637445
  init_permissionSetup();
637303
637446
  init_permissions2();
637304
637447
  init_permissionsLoader();
@@ -649457,7 +649600,7 @@ var init_EffortIndicator = __esm(() => {
649457
649600
 
649458
649601
  // src/components/ModelPicker.tsx
649459
649602
  function ModelPicker(t0) {
649460
- const $4 = import_compiler_runtime133.c(84);
649603
+ const $4 = import_compiler_runtime133.c(86);
649461
649604
  const {
649462
649605
  initial,
649463
649606
  sessionModel,
@@ -649583,6 +649726,9 @@ function ModelPicker(t0) {
649583
649726
  t8 = $4[22];
649584
649727
  }
649585
649728
  const focusedSupportsMax = t8;
649729
+ const focusedModelForCap = resolveOptionModel(focusedValue);
649730
+ const focusedCap = focusedModelForCap ? getEffectiveEffortCap(focusedModelForCap) : null;
649731
+ const focusedCapped = focusedModelForCap ? hasEffortLevelsAboveCap(focusedModelForCap) : false;
649586
649732
  let t9;
649587
649733
  if ($4[23] !== focusedValue) {
649588
649734
  t9 = getDefaultEffortLevelForOption(focusedValue);
@@ -649592,13 +649738,16 @@ function ModelPicker(t0) {
649592
649738
  t9 = $4[24];
649593
649739
  }
649594
649740
  const focusedDefaultEffort = t9;
649595
- const displayEffort = effort === "max" && !focusedSupportsMax || effort === "xhigh" && !focusedSupportsXhigh ? "high" : effort;
649741
+ const t8b = effort === "max" && !focusedSupportsMax || effort === "xhigh" && !focusedSupportsXhigh ? "high" : effort;
649742
+ const displayEffort = t8b !== undefined && focusedModelForCap ? clampEffortToCap(t8b, focusedModelForCap) : t8b;
649596
649743
  let t10;
649597
649744
  if ($4[25] !== effortValue || $4[26] !== hasToggledEffort) {
649598
649745
  t10 = (value) => {
649599
649746
  setFocusedValue(value);
649600
649747
  if (!hasToggledEffort && effortValue === undefined) {
649601
- setEffort(getDefaultEffortLevelForOption(value));
649748
+ const focusModel = resolveOptionModel(value);
649749
+ const defaultEffort = getDefaultEffortLevelForOption(value);
649750
+ setEffort(focusModel ? clampEffortToCap(defaultEffort, focusModel) : defaultEffort);
649602
649751
  }
649603
649752
  };
649604
649753
  $4[25] = effortValue;
@@ -649609,12 +649758,12 @@ function ModelPicker(t0) {
649609
649758
  }
649610
649759
  const handleFocus = t10;
649611
649760
  let t11;
649612
- if ($4[28] !== focusedDefaultEffort || $4[29] !== focusedSupportsEffort || $4[30] !== focusedSupportsMax || $4[83] !== focusedSupportsXhigh) {
649761
+ if ($4[28] !== focusedDefaultEffort || $4[29] !== focusedSupportsEffort || $4[30] !== focusedSupportsMax || $4[83] !== focusedSupportsXhigh || $4[84] !== focusedCap) {
649613
649762
  t11 = (direction) => {
649614
649763
  if (!focusedSupportsEffort) {
649615
649764
  return;
649616
649765
  }
649617
- setEffort((prev) => cycleEffortLevel(prev ?? focusedDefaultEffort, direction, focusedSupportsMax, focusedSupportsXhigh));
649766
+ setEffort((prev) => cycleEffortLevel(prev ?? focusedDefaultEffort, direction, focusedSupportsMax, focusedSupportsXhigh, focusedCap));
649618
649767
  setHasToggledEffort(true);
649619
649768
  };
649620
649769
  $4[28] = focusedDefaultEffort;
@@ -649622,6 +649771,7 @@ function ModelPicker(t0) {
649622
649771
  $4[30] = focusedSupportsMax;
649623
649772
  $4[31] = t11;
649624
649773
  $4[83] = focusedSupportsXhigh;
649774
+ $4[84] = focusedCap;
649625
649775
  } else {
649626
649776
  t11 = $4[31];
649627
649777
  }
@@ -649662,11 +649812,14 @@ function ModelPicker(t0) {
649662
649812
  let t14;
649663
649813
  if ($4[35] !== effort || $4[36] !== hasToggledEffort || $4[37] !== onSelect || $4[38] !== setAppState || $4[39] !== skipSettingsWrite) {
649664
649814
  t14 = function handleSelect2(value_0) {
649815
+ const selectedModel = resolveOptionModel(value_0);
649816
+ const clampedSelectEffort = selectedModel && effort !== undefined ? clampEffortToCap(effort, selectedModel) : effort;
649665
649817
  logEvent2("tengu_model_command_menu_effort", {
649666
- effort
649818
+ effort: clampedSelectEffort
649667
649819
  });
649668
649820
  if (!skipSettingsWrite) {
649669
- const effortLevel = resolvePickerEffortPersistence(effort, getDefaultEffortLevelForOption(value_0), getSettingsForSource("userSettings")?.effortLevel, hasToggledEffort);
649821
+ const persistModel = selectedModel ?? getDefaultMainLoopModel();
649822
+ const effortLevel = clampEffortToCap(resolvePickerEffortPersistence(effort, getDefaultEffortLevelForOption(value_0), getSettingsForSource("userSettings")?.effortLevel, hasToggledEffort), persistModel);
649670
649823
  const persistable = toPersistableEffort(effortLevel);
649671
649824
  if (persistable !== undefined) {
649672
649825
  updateSettingsForSource("userSettings", {
@@ -649678,8 +649831,7 @@ function ModelPicker(t0) {
649678
649831
  effortValue: effortLevel
649679
649832
  }));
649680
649833
  }
649681
- const selectedModel = resolveOptionModel(value_0);
649682
- const selectedEffort = hasToggledEffort && selectedModel && modelSupportsEffort(selectedModel) ? effort : undefined;
649834
+ const selectedEffort = hasToggledEffort && selectedModel && modelSupportsEffort(selectedModel) ? clampedSelectEffort : undefined;
649683
649835
  if (value_0 === NO_PREFERENCE) {
649684
649836
  onSelect(null, selectedEffort);
649685
649837
  return;
@@ -649812,42 +649964,49 @@ function ModelPicker(t0) {
649812
649964
  t23 = $4[61];
649813
649965
  }
649814
649966
  let t24;
649815
- if ($4[62] !== displayEffort || $4[63] !== focusedDefaultEffort || $4[64] !== focusedModelName || $4[65] !== focusedSupportsEffort) {
649816
- t24 = /* @__PURE__ */ jsx_runtime183.jsx(ThemedBox_default, {
649967
+ if ($4[62] !== displayEffort || $4[63] !== focusedDefaultEffort || $4[64] !== focusedModelName || $4[65] !== focusedSupportsEffort || $4[85] !== focusedCapped) {
649968
+ t24 = /* @__PURE__ */ jsx_runtime183.jsxs(ThemedBox_default, {
649817
649969
  marginBottom: 1,
649818
649970
  flexDirection: "column",
649819
- children: focusedSupportsEffort ? /* @__PURE__ */ jsx_runtime183.jsxs(ThemedText, {
649820
- dimColor: true,
649821
- children: [
649822
- /* @__PURE__ */ jsx_runtime183.jsx(EffortLevelIndicator, {
649823
- effort: displayEffort
649824
- }),
649825
- " ",
649826
- capitalize_default(displayEffort),
649827
- " effort",
649828
- displayEffort === focusedDefaultEffort ? " (default)" : "",
649829
- " ",
649830
- /* @__PURE__ */ jsx_runtime183.jsx(ThemedText, {
649831
- color: "subtle",
649832
- children: "\u2190 \u2192 to adjust"
649833
- })
649834
- ]
649835
- }) : /* @__PURE__ */ jsx_runtime183.jsxs(ThemedText, {
649836
- color: "subtle",
649837
- children: [
649838
- /* @__PURE__ */ jsx_runtime183.jsx(EffortLevelIndicator, {
649839
- effort: undefined
649840
- }),
649841
- " Effort not supported",
649842
- focusedModelName ? ` for ${focusedModelName}` : ""
649843
- ]
649844
- })
649971
+ children: [
649972
+ focusedSupportsEffort ? /* @__PURE__ */ jsx_runtime183.jsxs(ThemedText, {
649973
+ dimColor: true,
649974
+ children: [
649975
+ /* @__PURE__ */ jsx_runtime183.jsx(EffortLevelIndicator, {
649976
+ effort: displayEffort
649977
+ }),
649978
+ " ",
649979
+ capitalize_default(displayEffort),
649980
+ " effort",
649981
+ displayEffort === focusedDefaultEffort ? " (default)" : "",
649982
+ " ",
649983
+ /* @__PURE__ */ jsx_runtime183.jsx(ThemedText, {
649984
+ color: "subtle",
649985
+ children: "\u2190 \u2192 to adjust"
649986
+ })
649987
+ ]
649988
+ }) : /* @__PURE__ */ jsx_runtime183.jsxs(ThemedText, {
649989
+ color: "subtle",
649990
+ children: [
649991
+ /* @__PURE__ */ jsx_runtime183.jsx(EffortLevelIndicator, {
649992
+ effort: undefined
649993
+ }),
649994
+ " Effort not supported",
649995
+ focusedModelName ? ` for ${focusedModelName}` : ""
649996
+ ]
649997
+ }),
649998
+ focusedCapped ? /* @__PURE__ */ jsx_runtime183.jsx(ThemedText, {
649999
+ color: "subtle",
650000
+ children: "Higher effort levels are capped by your settings or organization."
650001
+ }) : null
650002
+ ]
649845
650003
  });
649846
650004
  $4[62] = displayEffort;
649847
650005
  $4[63] = focusedDefaultEffort;
649848
650006
  $4[64] = focusedModelName;
649849
650007
  $4[65] = focusedSupportsEffort;
649850
650008
  $4[66] = t24;
650009
+ $4[85] = focusedCapped;
649851
650010
  } else {
649852
650011
  t24 = $4[66];
649853
650012
  }
@@ -650031,8 +650190,9 @@ function EffortLevelIndicator(t0) {
650031
650190
  }
650032
650191
  return t4;
650033
650192
  }
650034
- function cycleEffortLevel(current, direction, includeMax, includeXhigh) {
650035
- const levels = ["low", "medium", "high", "xhigh", "max"].filter((level) => (level !== "max" || includeMax) && (level !== "xhigh" || includeXhigh));
650193
+ function cycleEffortLevel(current, direction, includeMax, includeXhigh, cap) {
650194
+ const capIndex = cap !== undefined && cap !== null ? EFFORT_LEVEL_ORDER.indexOf(cap) : EFFORT_LEVEL_ORDER.length - 1;
650195
+ const levels = EFFORT_LEVEL_ORDER.filter((level, index2) => index2 <= capIndex && (level !== "max" || includeMax) && (level !== "xhigh" || includeXhigh));
650036
650196
  const clamped = current === "max" && !includeMax || current === "xhigh" && !includeXhigh ? "high" : current;
650037
650197
  const idx = levels.indexOf(clamped);
650038
650198
  const currentIndex = idx !== -1 ? idx : levels.length - 1;
@@ -650047,7 +650207,7 @@ function getDefaultEffortLevelForOption(value) {
650047
650207
  const defaultValue = getDefaultEffortForModel(resolved);
650048
650208
  return defaultValue !== undefined ? convertEffortValueToLevel(defaultValue) : "high";
650049
650209
  }
650050
- var import_compiler_runtime133, import_react103, jsx_runtime183, NO_PREFERENCE = "__NO_PREFERENCE__";
650210
+ var import_compiler_runtime133, import_react103, jsx_runtime183, NO_PREFERENCE = "__NO_PREFERENCE__", EFFORT_LEVEL_ORDER;
650051
650211
  var init_ModelPicker = __esm(() => {
650052
650212
  init_capitalize();
650053
650213
  init_useExitOnCtrlCDWithKeybindings();
@@ -650057,6 +650217,7 @@ var init_ModelPicker = __esm(() => {
650057
650217
  init_useKeybinding();
650058
650218
  init_AppState();
650059
650219
  init_effort();
650220
+ init_cap();
650060
650221
  init_model();
650061
650222
  init_modelOptions();
650062
650223
  init_settings2();
@@ -650069,6 +650230,7 @@ var init_ModelPicker = __esm(() => {
650069
650230
  import_compiler_runtime133 = __toESM(require_compiler_runtime(), 1);
650070
650231
  import_react103 = __toESM(require_react(), 1);
650071
650232
  jsx_runtime183 = __toESM(require_jsx_runtime(), 1);
650233
+ EFFORT_LEVEL_ORDER = ["low", "medium", "high", "xhigh", "max"];
650072
650234
  });
650073
650235
 
650074
650236
  // src/components/ClaudeMdExternalIncludesDialog.tsx
@@ -716431,6 +716593,19 @@ __export(exports_effort, {
716431
716593
  call: () => call82
716432
716594
  });
716433
716595
  function setEffortValue(effortValue) {
716596
+ const model = getMainLoopModel();
716597
+ const clamped = typeof effortValue === "string" ? clampEffortToCap(effortValue, model) : effortValue;
716598
+ if (clamped !== effortValue) {
716599
+ logEvent2("tengu_effort_command", {
716600
+ effort: effortValue
716601
+ });
716602
+ return {
716603
+ message: `Effort '${effortValue}' exceeds the cap for ${model} set by your settings or organization; set to '${clamped}' instead (this session only): ${getEffortValueDescription(clamped)}`,
716604
+ effortUpdate: {
716605
+ value: clamped
716606
+ }
716607
+ };
716608
+ }
716434
716609
  const persistable = toPersistableEffort(effortValue);
716435
716610
  if (persistable !== undefined) {
716436
716611
  const result = updateSettingsForSource("userSettings", {
@@ -716481,9 +716656,10 @@ function showCurrentEffort(appStateEffort, model) {
716481
716656
  message: `Effort level: auto (currently ${level})`
716482
716657
  };
716483
716658
  }
716484
- const description = getEffortValueDescription(effectiveValue);
716659
+ const clamped = clampEffortToCap(effectiveValue, model);
716660
+ const description = getEffortValueDescription(clamped);
716485
716661
  return {
716486
- message: `Current effort level: ${effectiveValue} (${description})`
716662
+ message: `Current effort level: ${clamped} (${description})`
716487
716663
  };
716488
716664
  }
716489
716665
  function unsetEffortLevel() {
@@ -716515,7 +716691,17 @@ function unsetEffortLevel() {
716515
716691
  }
716516
716692
  };
716517
716693
  }
716518
- function enableUltracode() {
716694
+ function enableUltracode(model) {
716695
+ if (modelSupportsXhighEffort(model) && !isEffortLevelAllowed("xhigh", model)) {
716696
+ return {
716697
+ message: `Ultracode runs at xhigh effort, which is above the effort cap for ${model} set by your settings or organization. Valid options are: ${formatEffortValidOptions(model)}`
716698
+ };
716699
+ }
716700
+ if (!isUltracodeAvailableForModel(model)) {
716701
+ return {
716702
+ message: `Ultracode runs at xhigh effort, which ${model} doesn't support \u2014 switch to an xhigh-capable model (${XHIGH_CAPABLE_MODELS_HINT}). Valid options are: ${formatEffortValidOptions(model)}`
716703
+ };
716704
+ }
716519
716705
  enableUltracodeForSession();
716520
716706
  logEvent2("tengu_effort_command", {
716521
716707
  effort: "ultracode"
@@ -716537,11 +716723,11 @@ function executeEffort(args) {
716537
716723
  return unsetEffortLevel();
716538
716724
  }
716539
716725
  if (normalized === "ultracode") {
716540
- return enableUltracode();
716726
+ return enableUltracode(getMainLoopModel());
716541
716727
  }
716542
716728
  if (!isEffortLevel(normalized)) {
716543
716729
  return {
716544
- message: `Invalid argument: ${args}. Valid options are: low, medium, high, xhigh, max, ultracode, auto`
716730
+ message: `Invalid argument: ${args}. Valid options are: ${formatEffortValidOptions(getMainLoopModel())}`
716545
716731
  };
716546
716732
  }
716547
716733
  if (isUltracodeEnabled()) {
@@ -716604,14 +716790,17 @@ function ApplyEffortAndClose(t0) {
716604
716790
  async function call82(onDone, _context, args) {
716605
716791
  args = args?.trim() || "";
716606
716792
  if (COMMON_HELP_ARGS2.includes(args)) {
716607
- onDone(`Usage: /effort [low|medium|high|xhigh|max|ultracode|auto]
716608
- ` + `- low: Quick, straightforward implementation
716609
- ` + `- medium: Balanced approach with standard testing
716610
- ` + `- high: Comprehensive implementation with extensive testing
716611
- ` + `- xhigh: Extended reasoning with thorough analysis (Fable 5, Opus 4.7+, Sonnet 5)
716612
- ` + `- max: Maximum capability with deepest reasoning (Fable 5, Opus 4.6+, Sonnet 4.6+)
716613
- ` + `- ultracode: xhigh + dynamic workflow orchestration (this session only)
716614
- ` + "- auto: Use the default effort level for your model");
716793
+ const model = getMainLoopModel();
716794
+ const lines2 = [buildEffortArgumentHint("Usage: /effort [", "]", model)];
716795
+ for (const level of getAllowedEffortLevels(model)) {
716796
+ lines2.push(`- ${level}: ${SHORT_EFFORT_HELP[level]}`);
716797
+ }
716798
+ if (isUltracodeAvailableForModel(model)) {
716799
+ lines2.push("- ultracode: xhigh + dynamic workflow orchestration (this session only)");
716800
+ }
716801
+ lines2.push("- auto: Use the default effort level for your model");
716802
+ onDone(lines2.join(`
716803
+ `));
716615
716804
  return;
716616
716805
  }
716617
716806
  if (!args || args === "current" || args === "status") {
@@ -716625,29 +716814,42 @@ async function call82(onDone, _context, args) {
716625
716814
  onDone
716626
716815
  });
716627
716816
  }
716628
- var import_compiler_runtime248, React108, jsx_runtime350, COMMON_HELP_ARGS2;
716817
+ var import_compiler_runtime248, React108, jsx_runtime350, COMMON_HELP_ARGS2, XHIGH_CAPABLE_MODELS_HINT = "Fable 5, Opus 4.7+, Sonnet 5", SHORT_EFFORT_HELP;
716629
716818
  var init_effort2 = __esm(() => {
716630
716819
  init_useMainLoopModel();
716631
716820
  init_analytics();
716632
716821
  init_AppState();
716633
716822
  init_effort();
716823
+ init_cap();
716634
716824
  init_ultracode();
716825
+ init_model();
716635
716826
  init_settings2();
716636
716827
  import_compiler_runtime248 = __toESM(require_compiler_runtime(), 1);
716637
716828
  React108 = __toESM(require_react(), 1);
716638
716829
  jsx_runtime350 = __toESM(require_jsx_runtime(), 1);
716639
716830
  COMMON_HELP_ARGS2 = ["help", "-h", "--help"];
716831
+ SHORT_EFFORT_HELP = {
716832
+ low: "Quick, straightforward implementation",
716833
+ medium: "Balanced approach with standard testing",
716834
+ high: "Comprehensive implementation with extensive testing",
716835
+ xhigh: "Extended reasoning with thorough analysis (Fable 5, Opus 4.7+, Sonnet 5)",
716836
+ max: "Maximum capability with deepest reasoning (Fable 5, Opus 4.6+, Sonnet 4.6+)"
716837
+ };
716640
716838
  });
716641
716839
 
716642
716840
  // src/commands/effort/index.ts
716643
716841
  var effort_default;
716644
716842
  var init_effort3 = __esm(() => {
716843
+ init_cap();
716645
716844
  init_immediateCommand();
716845
+ init_model();
716646
716846
  effort_default = {
716647
716847
  type: "local-jsx",
716648
716848
  name: "effort",
716649
716849
  description: "Set effort level for model usage",
716650
- argumentHint: "[low|medium|high|xhigh|max|ultracode|auto]",
716850
+ get argumentHint() {
716851
+ return buildEffortArgumentHint("[", "]", getMainLoopModel());
716852
+ },
716651
716853
  get immediate() {
716652
716854
  return shouldInferenceConfigCommandBeImmediate();
716653
716855
  },
@@ -827596,6 +827798,7 @@ ${inputPrompt}` : mainThreadAgentDefinition.initialPrompt;
827596
827798
  effectiveMainLoopModel = ensureFableConsentSync(effectiveMainLoopModel);
827597
827799
  setInitialMainLoopModel(effectiveMainLoopModel);
827598
827800
  }
827801
+ emitStartupEffortCapWarning(parseEffortValue(options.effort) ?? getInitialEffortSetting(), parseUserSpecifiedModel(effectiveMainLoopModel ?? getDefaultMainLoopModel()), outputFormat);
827599
827802
  let advisorModel;
827600
827803
  if (isAdvisorEnabled()) {
827601
827804
  const advisorOption = canUserConfigureAdvisor() ? options.advisor : undefined;
@@ -829569,6 +829772,7 @@ var init_main7 = __esm(() => {
829569
829772
  init_autoCompactWindow();
829570
829773
  init_earlyInput();
829571
829774
  init_effort();
829775
+ init_cap();
829572
829776
  init_fastMode();
829573
829777
  init_managedEnv();
829574
829778
  init_messages3();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnwenf/occ",
3
- "version": "2.1.328",
3
+ "version": "2.1.329",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {