@cnwenf/occ 2.1.278 → 2.1.279

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.215](https://img.shields.io/badge/Tracks-Claude%20Code%202.1.215-blueviolet.svg)](https://docs.anthropic.com/en/docs/claude-code)
8
+ [![Tracks: Claude Code 2.1.218](https://img.shields.io/badge/Tracks-Claude%20Code%202.1.218-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.215`). 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.218`). 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.215` | Reference implementation |
65
+ | **Capability parity** | Tracks CC `2.1.218` | 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.215`**.
160
+ - Tracks Claude Code **`2.1.218`**.
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.215`)。代码全开放、可审计、无暗门,数据由你掌控。
11
+ **Open C Code(OCC)** 是一个开源的编码智能体。能力与 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 对齐(当前跟踪 `2.1.218`)。代码全开放、可审计、无暗门,数据由你掌控。
12
12
 
13
13
  如果你担心闭源 CLI 可能植入后门、担心代码与凭据被上传到不可审计的服务,OCC 就是为你准备的:全部源码开放、无混淆,构建产物可由源码复现,API 凭据只发往你自己配置的端点。
14
14
 
@@ -21,7 +21,7 @@
21
21
 
22
22
  ## 现状
23
23
 
24
- - 跟踪 Claude Code **`2.1.215`**。
24
+ - 跟踪 Claude Code **`2.1.218`**。
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.278","BUILD_TIME":"2026-07-23T19:50:06.511Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
2
+ globalThis.MACRO={"VERSION":"2.1.279","BUILD_TIME":"2026-07-24T07:02:14.850Z","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;
@@ -386098,7 +386098,7 @@ function mcpServerPendingApprovalMessage(name3) {
386098
386098
  function mcpServerHealthStatusLabel(result) {
386099
386099
  switch (result.type) {
386100
386100
  case "connected":
386101
- return "\u2713 Connected";
386101
+ return "\u2714 Connected";
386102
386102
  case "needs-auth":
386103
386103
  return "! Needs authentication";
386104
386104
  case "needs-approval":
@@ -729822,7 +729822,7 @@ function getSessionSpecificGuidanceSection(enabledTools, skillToolCommands) {
729822
729822
  return ["# Session-specific guidance", ...prependBullets(items)].join(`
729823
729823
  `);
729824
729824
  }
729825
- async function getSystemPrompt(tools, model, additionalWorkingDirectories, mcpClients) {
729825
+ async function getSystemPrompt(tools, model, additionalWorkingDirectories, mcpClients, opts) {
729826
729826
  if (isEnvTruthy(process.env.CLAUDE_CODE_SIMPLE)) {
729827
729827
  return [
729828
729828
  `You are Claude Code, Anthropic's official CLI for Claude.
@@ -729885,7 +729885,7 @@ ${CYBER_RISK_INSTRUCTION}`,
729885
729885
  getSimpleSystemSection(model),
729886
729886
  outputStyleConfig === null || outputStyleConfig.keepCodingInstructions === true ? getSimpleDoingTasksSection() : null,
729887
729887
  getActionsSection(),
729888
- ...shouldUseGlobalCacheScope() ? [SYSTEM_PROMPT_DYNAMIC_BOUNDARY] : [],
729888
+ ...shouldUseGlobalCacheScope() || opts?.excludeDynamicSections ? [SYSTEM_PROMPT_DYNAMIC_BOUNDARY] : [],
729889
729889
  ...resolvedDynamicSections,
729890
729890
  `# Context management
729891
729891
  When the conversation grows long, some or all of the current context is summarized; the summary, along with any remaining unsummarized context, is provided in the next context window so work can continue \u2014 you don't need to wrap up early or hand off mid-task.`
@@ -813330,17 +813330,114 @@ var init_protocolHandler = __esm(() => {
813330
813330
  init_terminalLauncher();
813331
813331
  });
813332
813332
 
813333
+ // src/utils/plugins/fetchPluginZip.ts
813334
+ var exports_fetchPluginZip = {};
813335
+ __export(exports_fetchPluginZip, {
813336
+ validatePluginZipUrl: () => validatePluginZipUrl,
813337
+ fetchPluginZipFromUrl: () => fetchPluginZipFromUrl,
813338
+ MAX_PLUGIN_ZIP_BYTES: () => MAX_PLUGIN_ZIP_BYTES,
813339
+ DEFAULT_PLUGIN_ZIP_TIMEOUT_MS: () => DEFAULT_PLUGIN_ZIP_TIMEOUT_MS
813340
+ });
813341
+ import { randomUUID as randomUUID64 } from "crypto";
813342
+ import { mkdir as mkdir60, open as open17, rm as rm14 } from "fs/promises";
813343
+ import { tmpdir as tmpdir19 } from "os";
813344
+ import { join as join186 } from "path";
813345
+ function validatePluginZipUrl(raw) {
813346
+ let parsed;
813347
+ try {
813348
+ parsed = new URL(raw);
813349
+ } catch {
813350
+ throw new Error(`--plugin-url: invalid URL "${raw}". Expected an https:// URL to a plugin .zip.`);
813351
+ }
813352
+ if (parsed.protocol !== "https:") {
813353
+ throw new Error(`--plugin-url: only https:// URLs are accepted (got "${parsed.protocol}"). OCC fetches plugin zips over HTTPS only.`);
813354
+ }
813355
+ return parsed;
813356
+ }
813357
+ async function openForWrite(path43) {
813358
+ const handle2 = await open17(path43, "w");
813359
+ return {
813360
+ write: async (chunk) => {
813361
+ await handle2.writeFile(chunk);
813362
+ },
813363
+ close: async () => {
813364
+ await handle2.close();
813365
+ }
813366
+ };
813367
+ }
813368
+ async function fetchPluginZipFromUrl(rawUrl, options = {}) {
813369
+ const url3 = validatePluginZipUrl(rawUrl);
813370
+ const maxBytes = options.maxBytes ?? MAX_PLUGIN_ZIP_BYTES;
813371
+ const timeoutMs = options.timeoutMs ?? DEFAULT_PLUGIN_ZIP_TIMEOUT_MS;
813372
+ const doFetch = options.fetchImpl ?? fetch;
813373
+ const controller = new AbortController;
813374
+ const timer2 = setTimeout(() => controller.abort(), timeoutMs);
813375
+ let sessionTmp = null;
813376
+ try {
813377
+ const response3 = await doFetch(url3, {
813378
+ method: "GET",
813379
+ redirect: "error",
813380
+ signal: controller.signal
813381
+ });
813382
+ if (!response3.ok) {
813383
+ throw new Error(`--plugin-url: fetch "${rawUrl}" failed: HTTP ${response3.status}${response3.statusText ? ` ${response3.statusText}` : ""}`);
813384
+ }
813385
+ if (response3.body === null) {
813386
+ throw new Error(`--plugin-url: response from "${rawUrl}" has no body`);
813387
+ }
813388
+ sessionTmp = join186(tmpdir19(), `occ-plugin-url-${randomUUID64()}`);
813389
+ await mkdir60(sessionTmp, { recursive: true });
813390
+ const zipPath = join186(sessionTmp, "plugin.zip");
813391
+ const reader = response3.body.getReader();
813392
+ const writer = await openForWrite(zipPath);
813393
+ let received = 0;
813394
+ try {
813395
+ for (;; ) {
813396
+ const { done, value } = await reader.read();
813397
+ if (done) {
813398
+ break;
813399
+ }
813400
+ received += value.byteLength;
813401
+ if (received > maxBytes) {
813402
+ throw new Error(`--plugin-url: zip from "${rawUrl}" exceeds the ${maxBytes}-byte limit (received >= ${received} bytes).`);
813403
+ }
813404
+ await writer.write(value);
813405
+ }
813406
+ } finally {
813407
+ await writer.close();
813408
+ }
813409
+ if (received === 0) {
813410
+ throw new Error(`--plugin-url: response from "${rawUrl}" was empty`);
813411
+ }
813412
+ return { path: zipPath, url: rawUrl };
813413
+ } catch (error52) {
813414
+ if (sessionTmp !== null) {
813415
+ await rm14(sessionTmp, { recursive: true, force: true }).catch(() => {});
813416
+ }
813417
+ if (controller.signal.aborted) {
813418
+ throw new Error(`--plugin-url: fetch "${rawUrl}" timed out after ${timeoutMs}ms.`);
813419
+ }
813420
+ throw error52;
813421
+ } finally {
813422
+ clearTimeout(timer2);
813423
+ }
813424
+ }
813425
+ var MAX_PLUGIN_ZIP_BYTES, DEFAULT_PLUGIN_ZIP_TIMEOUT_MS = 45000;
813426
+ var init_fetchPluginZip = __esm(() => {
813427
+ MAX_PLUGIN_ZIP_BYTES = 100 * 1024 * 1024;
813428
+ });
813429
+
813333
813430
  // src/utils/computerUse/setup.ts
813334
813431
  var exports_setup = {};
813335
813432
  __export(exports_setup, {
813336
813433
  setupComputerUseMCP: () => setupComputerUseMCP
813337
813434
  });
813338
- import { join as join186 } from "path";
813435
+ import { join as join187 } from "path";
813339
813436
  import { fileURLToPath as fileURLToPath10 } from "url";
813340
813437
  function setupComputerUseMCP() {
813341
813438
  const allowedTools = buildComputerUseTools(CLI_CU_CAPABILITIES, getChicagoCoordinateMode()).map((t4) => buildMcpToolName(COMPUTER_USE_MCP_SERVER_NAME, t4.name));
813342
813439
  const args = isInBundledMode() ? ["--computer-use-mcp"] : [
813343
- join186(fileURLToPath10(import.meta.url), "..", "cli.js"),
813440
+ join187(fileURLToPath10(import.meta.url), "..", "cli.js"),
813344
813441
  "--computer-use-mcp"
813345
813442
  ];
813346
813443
  return {
@@ -813562,7 +813659,7 @@ var init_sessionMemory = __esm(() => {
813562
813659
  // src/utils/iTermBackup.ts
813563
813660
  import { copyFile as copyFile12, stat as stat54 } from "fs/promises";
813564
813661
  import { homedir as homedir52 } from "os";
813565
- import { join as join187 } from "path";
813662
+ import { join as join188 } from "path";
813566
813663
  function markITerm2SetupComplete() {
813567
813664
  saveGlobalConfig((current) => ({
813568
813665
  ...current,
@@ -813577,7 +813674,7 @@ function getIterm2RecoveryInfo() {
813577
813674
  };
813578
813675
  }
813579
813676
  function getITerm2PlistPath() {
813580
- return join187(homedir52(), "Library", "Preferences", "com.googlecode.iterm2.plist");
813677
+ return join188(homedir52(), "Library", "Preferences", "com.googlecode.iterm2.plist");
813581
813678
  }
813582
813679
  async function checkAndRestoreITerm2Backup() {
813583
813680
  const { inProgress, backupPath } = getIterm2RecoveryInfo();
@@ -814305,7 +814402,7 @@ var init_queryContext = __esm(() => {
814305
814402
  });
814306
814403
 
814307
814404
  // src/QueryEngine.ts
814308
- import { randomUUID as randomUUID64 } from "crypto";
814405
+ import { randomUUID as randomUUID65 } from "crypto";
814309
814406
  function monotonicNow() {
814310
814407
  if (typeof performance !== "undefined" && typeof performance.now === "function") {
814311
814408
  return performance.now();
@@ -814623,7 +814720,7 @@ class QueryEngine {
814623
814720
  modelUsage: getModelUsage(),
814624
814721
  permission_denials: this.permissionDenials,
814625
814722
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
814626
- uuid: randomUUID64()
814723
+ uuid: randomUUID65()
814627
814724
  };
814628
814725
  return;
814629
814726
  }
@@ -814747,7 +814844,7 @@ class QueryEngine {
814747
814844
  event,
814748
814845
  session_id: getSessionId(),
814749
814846
  parent_tool_use_id: null,
814750
- uuid: randomUUID64()
814847
+ uuid: randomUUID65()
814751
814848
  };
814752
814849
  }
814753
814850
  break;
@@ -814782,7 +814879,7 @@ class QueryEngine {
814782
814879
  modelUsage: getModelUsage(),
814783
814880
  permission_denials: this.permissionDenials,
814784
814881
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
814785
- uuid: randomUUID64(),
814882
+ uuid: randomUUID65(),
814786
814883
  errors: [
814787
814884
  `Reached maximum number of turns (${attachment.maxTurns})`
814788
814885
  ]
@@ -814890,7 +814987,7 @@ class QueryEngine {
814890
814987
  modelUsage: getModelUsage(),
814891
814988
  permission_denials: this.permissionDenials,
814892
814989
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
814893
- uuid: randomUUID64(),
814990
+ uuid: randomUUID65(),
814894
814991
  errors: [`Reached maximum budget ($${maxBudgetUsd})`]
814895
814992
  };
814896
814993
  return;
@@ -814919,7 +815016,7 @@ class QueryEngine {
814919
815016
  modelUsage: getModelUsage(),
814920
815017
  permission_denials: this.permissionDenials,
814921
815018
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
814922
- uuid: randomUUID64(),
815019
+ uuid: randomUUID65(),
814923
815020
  errors: [
814924
815021
  `Failed to provide valid structured output after ${maxRetries} attempts`
814925
815022
  ]
@@ -814951,7 +815048,7 @@ class QueryEngine {
814951
815048
  modelUsage: getModelUsage(),
814952
815049
  permission_denials: this.permissionDenials,
814953
815050
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
814954
- uuid: randomUUID64(),
815051
+ uuid: randomUUID65(),
814955
815052
  errors: (() => {
814956
815053
  const all4 = getInMemoryErrors();
814957
815054
  const start = errorLogWatermark ? all4.lastIndexOf(errorLogWatermark) + 1 : 0;
@@ -814988,7 +815085,7 @@ class QueryEngine {
814988
815085
  permission_denials: this.permissionDenials,
814989
815086
  structured_output: structuredOutputFromTool,
814990
815087
  fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
814991
- uuid: randomUUID64()
815088
+ uuid: randomUUID65()
814992
815089
  };
814993
815090
  }
814994
815091
  interrupt() {
@@ -815142,7 +815239,7 @@ var init_QueryEngine = __esm(() => {
815142
815239
  var FILE_COUNT_LIMIT = 1e4, OUTPUTS_SUBDIR = ".claude-code/outputs", DEFAULT_UPLOAD_CONCURRENCY = 5;
815143
815240
 
815144
815241
  // src/utils/filePersistence/filePersistence.ts
815145
- import { join as join188, relative as relative39 } from "path";
815242
+ import { join as join189, relative as relative39 } from "path";
815146
815243
  async function runFilePersistence(turnStartTime, signal) {
815147
815244
  const environmentKind = getEnvironmentKind();
815148
815245
  if (environmentKind !== "byoc") {
@@ -815161,7 +815258,7 @@ async function runFilePersistence(turnStartTime, signal) {
815161
815258
  oauthToken: sessionAccessToken,
815162
815259
  sessionId
815163
815260
  };
815164
- const outputsDir = join188(getCwd(), sessionId, OUTPUTS_SUBDIR);
815261
+ const outputsDir = join189(getCwd(), sessionId, OUTPUTS_SUBDIR);
815165
815262
  if (signal?.aborted) {
815166
815263
  logDebug("Persistence aborted before processing");
815167
815264
  return null;
@@ -815332,11 +815429,11 @@ var init_idleTimeout = __esm(() => {
815332
815429
  });
815333
815430
 
815334
815431
  // src/utils/sessionUrl.ts
815335
- import { randomUUID as randomUUID65 } from "crypto";
815432
+ import { randomUUID as randomUUID66 } from "crypto";
815336
815433
  function parseSessionIdentifier(resumeIdentifier) {
815337
815434
  if (resumeIdentifier.toLowerCase().endsWith(".jsonl")) {
815338
815435
  return {
815339
- sessionId: randomUUID65(),
815436
+ sessionId: randomUUID66(),
815340
815437
  ingressUrl: null,
815341
815438
  isUrl: false,
815342
815439
  jsonlFile: resumeIdentifier,
@@ -815355,7 +815452,7 @@ function parseSessionIdentifier(resumeIdentifier) {
815355
815452
  try {
815356
815453
  const url3 = new URL(resumeIdentifier);
815357
815454
  return {
815358
- sessionId: randomUUID65(),
815455
+ sessionId: randomUUID66(),
815359
815456
  ingressUrl: url3.href,
815360
815457
  isUrl: true,
815361
815458
  jsonlFile: null,
@@ -815370,7 +815467,7 @@ var init_sessionUrl = __esm(() => {
815370
815467
 
815371
815468
  // src/utils/plugins/zipCacheAdapters.ts
815372
815469
  import { readFile as readFile68 } from "fs/promises";
815373
- import { join as join189 } from "path";
815470
+ import { join as join190 } from "path";
815374
815471
  async function readZipCacheKnownMarketplaces() {
815375
815472
  try {
815376
815473
  const content = await readFile68(getZipCacheKnownMarketplacesPath(), "utf-8");
@@ -815395,13 +815492,13 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
815395
815492
  const content = await readMarketplaceJsonContent(installLocation);
815396
815493
  if (content !== null) {
815397
815494
  const relPath = getMarketplaceJsonRelativePath(marketplaceName);
815398
- await atomicWriteToZipCache(join189(zipCachePath, relPath), content);
815495
+ await atomicWriteToZipCache(join190(zipCachePath, relPath), content);
815399
815496
  }
815400
815497
  }
815401
815498
  async function readMarketplaceJsonContent(dir) {
815402
815499
  const candidates = [
815403
- join189(dir, ".claude-plugin", "marketplace.json"),
815404
- join189(dir, "marketplace.json"),
815500
+ join190(dir, ".claude-plugin", "marketplace.json"),
815501
+ join190(dir, "marketplace.json"),
815405
815502
  dir
815406
815503
  ];
815407
815504
  for (const candidate of candidates) {
@@ -815541,7 +815638,7 @@ __export(exports_print, {
815541
815638
  import { readFile as readFile69, stat as stat55 } from "fs/promises";
815542
815639
  import { dirname as dirname84 } from "path";
815543
815640
  import { cwd as cwd2 } from "process";
815544
- import { randomUUID as randomUUID66 } from "crypto";
815641
+ import { randomUUID as randomUUID67 } from "crypto";
815545
815642
  function trackReceivedMessageUuid(uuid5) {
815546
815643
  if (receivedMessageUuids.has(uuid5)) {
815547
815644
  return false;
@@ -815671,7 +815768,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
815671
815768
  hook_id: event.hookId,
815672
815769
  hook_name: event.hookName,
815673
815770
  hook_event: event.hookEvent,
815674
- uuid: randomUUID66(),
815771
+ uuid: randomUUID67(),
815675
815772
  session_id: getSessionId()
815676
815773
  };
815677
815774
  case "progress":
@@ -815684,7 +815781,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
815684
815781
  stdout: event.stdout,
815685
815782
  stderr: event.stderr,
815686
815783
  output: event.output,
815687
- uuid: randomUUID66(),
815784
+ uuid: randomUUID67(),
815688
815785
  session_id: getSessionId()
815689
815786
  };
815690
815787
  case "response":
@@ -815699,7 +815796,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
815699
815796
  stderr: event.stderr,
815700
815797
  exit_code: event.exitCode,
815701
815798
  outcome: event.outcome,
815702
- uuid: randomUUID66(),
815799
+ uuid: randomUUID67(),
815703
815800
  session_id: getSessionId()
815704
815801
  };
815705
815802
  }
@@ -815743,6 +815840,32 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
815743
815840
  saveAgentSetting(restoredAgent.agentType);
815744
815841
  }
815745
815842
  }
815843
+ if (options.excludeDynamicSections && !options.systemPrompt) {
815844
+ const { getSystemPrompt: getSystemPrompt2, SYSTEM_PROMPT_DYNAMIC_BOUNDARY: SYSTEM_PROMPT_DYNAMIC_BOUNDARY2 } = await Promise.resolve().then(() => (init_prompts4(), exports_prompts));
815845
+ const addDirs = options.addDir;
815846
+ const parts = await getSystemPrompt2(tools, options.userSpecifiedModel ?? getMainLoopModel(), addDirs, [], { excludeDynamicSections: true });
815847
+ const joined = parts.join(`
815848
+
815849
+ `);
815850
+ const boundaryIdx = joined.indexOf(SYSTEM_PROMPT_DYNAMIC_BOUNDARY2);
815851
+ if (boundaryIdx !== -1) {
815852
+ const staticPre = joined.slice(0, boundaryIdx).replace(/\s+$/, "");
815853
+ const after = joined.slice(boundaryIdx + SYSTEM_PROMPT_DYNAMIC_BOUNDARY2.length);
815854
+ const tailMarker = "# Context management";
815855
+ const tailIdx = after.indexOf(tailMarker);
815856
+ const dynamicPart = (tailIdx !== -1 ? after.slice(0, tailIdx) : after).trim();
815857
+ const tailPart = tailIdx !== -1 ? after.slice(tailIdx).trim() : "";
815858
+ const staticSystemPrompt = [staticPre, tailPart].filter(Boolean).join(`
815859
+
815860
+ `);
815861
+ if (staticSystemPrompt) {
815862
+ options.systemPrompt = staticSystemPrompt;
815863
+ }
815864
+ if (dynamicPart) {
815865
+ structuredIO.prependUserMessage(dynamicPart);
815866
+ }
815867
+ }
815868
+ }
815746
815869
  if (initialMessages.length === 0 && process.exitCode !== undefined) {
815747
815870
  return;
815748
815871
  }
@@ -815906,7 +816029,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
815906
816029
  subtype: "status",
815907
816030
  status: null,
815908
816031
  permissionMode: newMode,
815909
- uuid: randomUUID66(),
816032
+ uuid: randomUUID67(),
815910
816033
  session_id: getSessionId()
815911
816034
  });
815912
816035
  }
@@ -815927,7 +816050,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
815927
816050
  isAuthenticating: status2.isAuthenticating,
815928
816051
  output: status2.output,
815929
816052
  error: status2.error,
815930
- uuid: randomUUID66(),
816053
+ uuid: randomUUID67(),
815931
816054
  session_id: getSessionId()
815932
816055
  });
815933
816056
  });
@@ -815938,7 +816061,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
815938
816061
  output2.enqueue({
815939
816062
  type: "rate_limit_event",
815940
816063
  rate_limit_info: rateLimitInfo,
815941
- uuid: randomUUID66(),
816064
+ uuid: randomUUID67(),
815942
816065
  session_id: getSessionId()
815943
816066
  });
815944
816067
  }
@@ -815954,7 +816077,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
815954
816077
  enqueue({
815955
816078
  mode: "prompt",
815956
816079
  value: turnInterruptionState.message.message.content,
815957
- uuid: randomUUID66()
816080
+ uuid: randomUUID67()
815958
816081
  });
815959
816082
  }
815960
816083
  const modelOptions = getModelOptions();
@@ -816049,7 +816172,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
816049
816172
  subtype: "elicitation_complete",
816050
816173
  mcp_server_name: serverName,
816051
816174
  elicitation_id: elicitationId,
816052
- uuid: randomUUID66(),
816175
+ uuid: randomUUID67(),
816053
816176
  session_id: getSessionId()
816054
816177
  });
816055
816178
  });
@@ -816295,7 +816418,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
816295
816418
  enqueue({
816296
816419
  mode: "prompt",
816297
816420
  value: tickContent,
816298
- uuid: randomUUID66(),
816421
+ uuid: randomUUID67(),
816299
816422
  priority: "later",
816300
816423
  isMeta: true
816301
816424
  });
@@ -816419,7 +816542,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
816419
816542
  duration_ms: durationMsMatch ? parseInt(durationMsMatch[1], 10) : 0
816420
816543
  } : undefined,
816421
816544
  session_id: getSessionId(),
816422
- uuid: randomUUID66()
816545
+ uuid: randomUUID67()
816423
816546
  });
816424
816547
  }
816425
816548
  }
@@ -816494,7 +816617,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
816494
816617
  subtype: "status",
816495
816618
  status: status2,
816496
816619
  session_id: getSessionId(),
816497
- uuid: randomUUID66()
816620
+ uuid: randomUUID67()
816498
816621
  });
816499
816622
  }
816500
816623
  })) {
@@ -816531,7 +816654,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
816531
816654
  files: result.persistedFiles,
816532
816655
  failed: result.failedFiles,
816533
816656
  processed_at: new Date().toISOString(),
816534
- uuid: randomUUID66(),
816657
+ uuid: randomUUID67(),
816535
816658
  session_id: getSessionId()
816536
816659
  });
816537
816660
  });
@@ -816554,7 +816677,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
816554
816677
  const suggestionMsg = {
816555
816678
  type: "prompt_suggestion",
816556
816679
  suggestion: result.suggestion,
816557
- uuid: randomUUID66(),
816680
+ uuid: randomUUID67(),
816558
816681
  session_id: getSessionId()
816559
816682
  };
816560
816683
  const lastEmittedEntry = {
@@ -816644,7 +816767,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
816644
816767
  usage: EMPTY_USAGE,
816645
816768
  modelUsage: {},
816646
816769
  permission_denials: [],
816647
- uuid: randomUUID66(),
816770
+ uuid: randomUUID67(),
816648
816771
  errors: [
816649
816772
  errorMessage(error52),
816650
816773
  ...getInMemoryErrors().map((_4) => _4.error)
@@ -816733,7 +816856,7 @@ ${m5.text}
816733
816856
  enqueue({
816734
816857
  mode: "prompt",
816735
816858
  value: formatted,
816736
- uuid: randomUUID66()
816859
+ uuid: randomUUID67()
816737
816860
  });
816738
816861
  run();
816739
816862
  return;
@@ -816744,7 +816867,7 @@ ${m5.text}
816744
816867
  enqueue({
816745
816868
  mode: "prompt",
816746
816869
  value: SHUTDOWN_TEAM_PROMPT,
816747
- uuid: randomUUID66()
816870
+ uuid: randomUUID67()
816748
816871
  });
816749
816872
  run();
816750
816873
  return;
@@ -816768,7 +816891,7 @@ ${m5.text}
816768
816891
  enqueue({
816769
816892
  mode: "prompt",
816770
816893
  value: SHUTDOWN_TEAM_PROMPT,
816771
- uuid: randomUUID66()
816894
+ uuid: randomUUID67()
816772
816895
  });
816773
816896
  run();
816774
816897
  } else {
@@ -816802,7 +816925,7 @@ ${m5.text}
816802
816925
  enqueue({
816803
816926
  mode: "prompt",
816804
816927
  value: prompt,
816805
- uuid: randomUUID66(),
816928
+ uuid: randomUUID67(),
816806
816929
  priority: "later",
816807
816930
  isMeta: true,
816808
816931
  workload: WORKLOAD_CRON
@@ -817568,7 +817691,7 @@ ${m5.text}
817568
817691
  subtype: "bridge_state",
817569
817692
  state: state4,
817570
817693
  detail,
817571
- uuid: randomUUID66(),
817694
+ uuid: randomUUID67(),
817572
817695
  session_id: getSessionId()
817573
817696
  });
817574
817697
  },
@@ -817898,7 +818021,7 @@ async function handleInitializeRequest(request5, requestId, initialized5, output
817898
818021
  isAuthenticating: status2.isAuthenticating,
817899
818022
  output: status2.output,
817900
818023
  error: status2.error,
817901
- uuid: randomUUID66(),
818024
+ uuid: randomUUID67(),
817902
818025
  session_id: getSessionId()
817903
818026
  });
817904
818027
  }
@@ -818099,7 +818222,7 @@ function emitLoadError(message, outputFormat) {
818099
818222
  usage: EMPTY_USAGE,
818100
818223
  modelUsage: {},
818101
818224
  permission_denials: [],
818102
- uuid: randomUUID66(),
818225
+ uuid: randomUUID67(),
818103
818226
  errors: [message]
818104
818227
  };
818105
818228
  process.stdout.write(jsonStringify(errorResult) + `
@@ -819720,14 +819843,14 @@ __export(exports_claudeDesktop, {
819720
819843
  });
819721
819844
  import { readdir as readdir38, readFile as readFile70, stat as stat56 } from "fs/promises";
819722
819845
  import { homedir as homedir53 } from "os";
819723
- import { join as join190 } from "path";
819846
+ import { join as join191 } from "path";
819724
819847
  async function getClaudeDesktopConfigPath() {
819725
819848
  const platform7 = getPlatform();
819726
819849
  if (!SUPPORTED_PLATFORMS.includes(platform7)) {
819727
819850
  throw new Error(`Unsupported platform: ${platform7} - Claude Desktop integration only works on macOS and WSL.`);
819728
819851
  }
819729
819852
  if (platform7 === "macos") {
819730
- return join190(homedir53(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
819853
+ return join191(homedir53(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
819731
819854
  }
819732
819855
  const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
819733
819856
  if (windowsHome) {
@@ -819746,7 +819869,7 @@ async function getClaudeDesktopConfigPath() {
819746
819869
  if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
819747
819870
  continue;
819748
819871
  }
819749
- const potentialConfigPath = join190(usersDir, user.name, "AppData", "Roaming", "Claude", "claude_desktop_config.json");
819872
+ const potentialConfigPath = join191(usersDir, user.name, "AppData", "Roaming", "Claude", "claude_desktop_config.json");
819750
819873
  try {
819751
819874
  await stat56(potentialConfigPath);
819752
819875
  return potentialConfigPath;
@@ -819936,7 +820059,7 @@ async function mcpListHandler() {
819936
820059
  if (Object.keys(configs).length === 0) {
819937
820060
  console.log("No MCP servers configured. Use `claude mcp add` to add a server.");
819938
820061
  } else {
819939
- console.log(`Checking MCP server health...
820062
+ console.log(`Checking MCP server health\u2026
819940
820063
  `);
819941
820064
  const entries = Object.entries(configs);
819942
820065
  const results = await pMap(entries, async ([name3, server]) => ({
@@ -820729,12 +820852,12 @@ __export(exports_install, {
820729
820852
  install: () => install2
820730
820853
  });
820731
820854
  import { homedir as homedir54 } from "os";
820732
- import { join as join191 } from "path";
820855
+ import { join as join192 } from "path";
820733
820856
  function getInstallationPath2() {
820734
820857
  const isWindows3 = env4.platform === "win32";
820735
820858
  const homeDir = homedir54();
820736
820859
  if (isWindows3) {
820737
- const windowsPath = join191(homeDir, ".local", "bin", "claude.exe");
820860
+ const windowsPath = join192(homeDir, ".local", "bin", "claude.exe");
820738
820861
  return windowsPath.replace(/\//g, "\\");
820739
820862
  }
820740
820863
  return "~/.local/bin/claude";
@@ -821462,7 +821585,7 @@ var exports_projectPurge = {};
821462
821585
  __export(exports_projectPurge, {
821463
821586
  purgeProjectHandler: () => purgeProjectHandler
821464
821587
  });
821465
- import { join as join192 } from "path";
821588
+ import { join as join193 } from "path";
821466
821589
  function resolveAbsolutePath(input2) {
821467
821590
  if (!input2) {
821468
821591
  return getCwd();
@@ -821481,7 +821604,7 @@ async function discoverAllProjectPaths() {
821481
821604
  try {
821482
821605
  const entries = await fs27.readdir(projectsDir);
821483
821606
  for (const entry of entries) {
821484
- paths2.add(join192(projectsDir, entry.name));
821607
+ paths2.add(join193(projectsDir, entry.name));
821485
821608
  }
821486
821609
  } catch {}
821487
821610
  return [...paths2];
@@ -821491,7 +821614,7 @@ async function collectItemsForProject(projectPath) {
821491
821614
  const warnings = [];
821492
821615
  const fs27 = getFsImplementation();
821493
821616
  const projectsDir = getProjectsDir2();
821494
- const transcriptDir = join192(projectsDir, sanitizePath2(projectPath));
821617
+ const transcriptDir = join193(projectsDir, sanitizePath2(projectPath));
821495
821618
  try {
821496
821619
  const stat58 = await fs27.stat(transcriptDir);
821497
821620
  if (stat58.isDirectory()) {
@@ -822799,9 +822922,26 @@ async function run() {
822799
822922
  initSinks2();
822800
822923
  profileCheckpoint("preAction_after_sinks");
822801
822924
  const pluginDir = thisCommand.getOptionValue("pluginDir");
822925
+ const pluginUrl = thisCommand.getOptionValue("pluginUrl");
822926
+ const inlinePluginPaths = [];
822802
822927
  if (Array.isArray(pluginDir) && pluginDir.length > 0 && pluginDir.every((p4) => typeof p4 === "string")) {
822803
- setInlinePlugins(pluginDir);
822804
- clearPluginCache("preAction: --plugin-dir inline plugins");
822928
+ inlinePluginPaths.push(...pluginDir);
822929
+ }
822930
+ if (Array.isArray(pluginUrl) && pluginUrl.length > 0 && pluginUrl.every((p4) => typeof p4 === "string")) {
822931
+ const { fetchPluginZipFromUrl: fetchPluginZipFromUrl2 } = await Promise.resolve().then(() => (init_fetchPluginZip(), exports_fetchPluginZip));
822932
+ for (const url3 of pluginUrl) {
822933
+ try {
822934
+ const fetched = await fetchPluginZipFromUrl2(url3);
822935
+ inlinePluginPaths.push(fetched.path);
822936
+ } catch (error52) {
822937
+ const { exitWithError: exitWithError3 } = await Promise.resolve().then(() => (init_process(), exports_process));
822938
+ exitWithError3(error52 instanceof Error ? error52.message : String(error52));
822939
+ }
822940
+ }
822941
+ }
822942
+ if (inlinePluginPaths.length > 0) {
822943
+ setInlinePlugins(inlinePluginPaths);
822944
+ clearPluginCache("preAction: --plugin-dir/--plugin-url inline plugins");
822805
822945
  }
822806
822946
  runMigrations();
822807
822947
  profileCheckpoint("preAction_after_migrations");
@@ -822846,8 +822986,19 @@ async function run() {
822846
822986
  throw new InvalidArgumentError(`It must be one of: ${allowed.join(", ")}`);
822847
822987
  }
822848
822988
  return value;
822849
- })).option("--agent <agent>", `Agent for the current session. Overrides the 'agent' setting.`).option("--betas <betas...>", "Beta headers to include in API requests (API key users only)").option("--fallback-model <model>", "Enable automatic fallback to specified model when default model is overloaded (only works with --print)").addOption(new Option("--workload <tag>", "Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)").hideHelp()).option("--settings <file-or-json>", "Path to a settings JSON file or a JSON string to load additional settings from").option("--add-dir <directories...>", "Additional directories to allow tool access to").option("--ide", "Automatically connect to IDE on startup if exactly one valid IDE is available", () => true).option("--strict-mcp-config", "Only use MCP servers from --mcp-config, ignoring all other MCP configurations", () => true).option("--session-id <uuid>", "Use a specific session ID for the conversation (must be a valid UUID)").option("-n, --name <name>", "Set a display name for this session (shown in /resume and terminal title)").option("--agents <json>", `JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option("--setting-sources <sources>", "Comma-separated list of setting sources to load (user, project, local).").option("--plugin-dir <path>", "Load plugins from a directory for this session only (repeatable: --plugin-dir A --plugin-dir B)", (val, prev) => [...prev, val], []).option("--disable-slash-commands", "Disable all skills", () => true).option("--chrome", "Enable Claude in Chrome integration").option("--no-chrome", "Disable Claude in Chrome integration").option("--file <specs...>", "File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)").action(async (prompt, options) => {
822989
+ })).option("--agent <agent>", `Agent for the current session. Overrides the 'agent' setting.`).option("--betas <betas...>", "Beta headers to include in API requests (API key users only)").option("--fallback-model <model>", "Enable automatic fallback to specified model when default model is overloaded (only works with --print)").addOption(new Option("--workload <tag>", "Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)").hideHelp()).option("--settings <file-or-json>", "Path to a settings JSON file or a JSON string to load additional settings from").option("--add-dir <directories...>", "Additional directories to allow tool access to").option("--ide", "Automatically connect to IDE on startup if exactly one valid IDE is available", () => true).option("--strict-mcp-config", "Only use MCP servers from --mcp-config, ignoring all other MCP configurations", () => true).option("--session-id <uuid>", "Use a specific session ID for the conversation (must be a valid UUID)").option("-n, --name <name>", "Set a display name for this session (shown in /resume and terminal title)").option("--agents <json>", `JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option("--setting-sources <sources>", "Comma-separated list of setting sources to load (user, project, local).").addOption(new Option("--prompt-suggestions [value]", "Enable prompt suggestions. In print/SDK mode, emits a prompt_suggestion message after each turn with a predicted next user prompt").choices(["true", "false", "1", "0", "yes", "no", "on", "off"]).preset("true").argParser((raw) => {
822990
+ const allowed = ["true", "false", "1", "0", "yes", "no", "on", "off"];
822991
+ if (!allowed.includes(raw)) {
822992
+ throw new InvalidArgumentError("Allowed choices are true, false, 1, 0, yes, no, on, off.");
822993
+ }
822994
+ return !["false", "0", "no", "off"].includes(raw);
822995
+ })).addOption(new Option("--exclude-dynamic-system-prompt-sections", "Move per-machine sections (cwd, env info, memory paths, git status) from the system prompt into the first user message. Improves cross-user prompt-cache reuse. Only applies with the default system prompt (ignored with --system-prompt).").default(false)).option("--plugin-url <url>", "Fetch a plugin .zip from a URL for this session only (repeatable: --plugin-url A --plugin-url B)", (val, prev) => [...prev, val], []).option("--bg, --background", "Start the session as a background agent. OCC note: background sessions are managed via the `daemon` and `agents` subcommands (e.g. `occ daemon start`, `occ agents`, `occ attach <id>`) \u2014 see `occ daemon --help`. This flag is accepted for CLI compatibility but does not start a foreground REPL.").option("--plugin-dir <path>", "Load plugins from a directory for this session only (repeatable: --plugin-dir A --plugin-dir B)", (val, prev) => [...prev, val], []).option("--disable-slash-commands", "Disable all skills", () => true).option("--chrome", "Enable Claude in Chrome integration").option("--no-chrome", "Disable Claude in Chrome integration").option("--file <specs...>", "File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)").action(async (prompt, options) => {
822850
822996
  profileCheckpoint("action_handler_start");
822997
+ const bgFlag = options.bg || options.background;
822998
+ if (bgFlag) {
822999
+ console.error("Error: OCC manages background sessions via the `daemon` and `agents` subcommands, not the `--bg` flag.\n Start a background daemon: `occ daemon start`\n View background sessions: `occ agents`\n Resume a background session: `occ attach <id>`\n See `occ daemon --help` and `occ agents --help`.");
823000
+ process.exit(1);
823001
+ }
822851
823002
  if (options.bare) {
822852
823003
  process.env.CLAUDE_CODE_SIMPLE = "1";
822853
823004
  }
@@ -823013,6 +823164,10 @@ ${getTmuxInstallInstructions2()}
823013
823164
  print = true;
823014
823165
  }
823015
823166
  }
823167
+ if (options.promptSuggestions !== undefined && !(print && outputFormat === "stream-json")) {
823168
+ console.error("Error: --prompt-suggestions requires --print and --output-format=stream-json (prompt_suggestion messages are only surfaced in stream-json output).");
823169
+ process.exit(1);
823170
+ }
823016
823171
  const teleport = options.teleport ?? null;
823017
823172
  const remoteOption = options.remote;
823018
823173
  const remote = remoteOption === true ? "" : remoteOption ?? null;
@@ -824153,7 +824308,9 @@ ${inputPrompt}` : mergePrompt;
824153
824308
  agent: agentCli,
824154
824309
  workload: options.workload,
824155
824310
  setupTrigger: setupTrigger ?? undefined,
824156
- sessionStartHooksPromise
824311
+ sessionStartHooksPromise,
824312
+ promptSuggestions: options.promptSuggestions,
824313
+ excludeDynamicSections: options.excludeDynamicSystemPromptSections || undefined
824157
824314
  });
824158
824315
  return;
824159
824316
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnwenf/occ",
3
- "version": "2.1.278",
3
+ "version": "2.1.279",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {