@cnwenf/occ 2.1.331 → 2.1.332

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 (2) hide show
  1. package/dist/cli.js +210 -34
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- globalThis.MACRO={"VERSION":"2.1.331","BINARY_NAME":"occ","BUILD_TIME":"2026-09-12T07:54:49.967Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
2
+ globalThis.MACRO={"VERSION":"2.1.332","BINARY_NAME":"occ","BUILD_TIME":"2026-09-12T20:24:55.070Z","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;
@@ -260734,7 +260734,8 @@ var init_FileReadTool = __esm(() => {
260734
260734
  return {
260735
260735
  result: false,
260736
260736
  message: "File is in a directory that is denied by your permission settings.",
260737
- errorCode: 1
260737
+ errorCode: 1,
260738
+ deniedByPermissionRule: true
260738
260739
  };
260739
260740
  }
260740
260741
  const isUncPath = fullFilePath.startsWith("\\\\") || fullFilePath.startsWith("//");
@@ -374648,14 +374649,16 @@ var init_FileWriteTool = __esm(() => {
374648
374649
  return {
374649
374650
  result: false,
374650
374651
  message: "File is in a directory that is denied by your permission settings.",
374651
- errorCode: 1
374652
+ errorCode: 1,
374653
+ deniedByPermissionRule: true
374652
374654
  };
374653
374655
  }
374654
374656
  if (isCoveredByReadDenyRule(fullFilePath, toolPermissionContext)) {
374655
374657
  return {
374656
374658
  result: false,
374657
374659
  message: READ_DENY_WRITE_MESSAGE,
374658
- errorCode: 13
374660
+ errorCode: 13,
374661
+ deniedByPermissionRule: true
374659
374662
  };
374660
374663
  }
374661
374664
  if (fullFilePath.startsWith("\\\\") || fullFilePath.startsWith("//")) {
@@ -380709,6 +380712,19 @@ var init_sedValidation = __esm(() => {
380709
380712
  // src/tools/BashTool/pathValidation.ts
380710
380713
  import { homedir as homedir22 } from "os";
380711
380714
  import { isAbsolute as isAbsolute21, resolve as resolve30 } from "path";
380715
+ function filterTeeDevicePaths(paths2) {
380716
+ return paths2.filter((p4) => !TEE_DEVICE_PATHS.has(p4));
380717
+ }
380718
+ function canonicalizePathCommandName(cmd) {
380719
+ if (!cmd) {
380720
+ return cmd;
380721
+ }
380722
+ const base2 = cmd.replace(/^.*[\\/]/, "");
380723
+ if (CANONICAL_PATH_COMMAND_BASENAMES.has(base2)) {
380724
+ return base2;
380725
+ }
380726
+ return base2.toLowerCase().replace(/\.exe$/, "") === "tee" ? "tee" : cmd;
380727
+ }
380712
380728
  function checkDangerousRemovalPaths(command4, args, cwd2) {
380713
380729
  const extractor = PATH_EXTRACTORS[command4];
380714
380730
  const paths2 = extractor(args);
@@ -380900,7 +380916,8 @@ function validateSinglePathCommand(cmd, cwd2, toolPermissionContext, compoundCom
380900
380916
  message: "Empty command - no paths to validate"
380901
380917
  };
380902
380918
  }
380903
- const [baseCmd, ...args] = extractedArgs;
380919
+ const [rawBaseCmd, ...args] = extractedArgs;
380920
+ const baseCmd = canonicalizePathCommandName(rawBaseCmd);
380904
380921
  if (!baseCmd || !SUPPORTED_PATH_COMMANDS.includes(baseCmd)) {
380905
380922
  return {
380906
380923
  behavior: "passthrough",
@@ -380919,7 +380936,8 @@ function validateSinglePathCommandArgv(cmd, cwd2, toolPermissionContext, compoun
380919
380936
  message: "Empty command - no paths to validate"
380920
380937
  };
380921
380938
  }
380922
- const [baseCmd, ...args] = argv;
380939
+ const [rawBaseCmd, ...args] = argv;
380940
+ const baseCmd = canonicalizePathCommandName(rawBaseCmd);
380923
380941
  if (!baseCmd || !SUPPORTED_PATH_COMMANDS.includes(baseCmd)) {
380924
380942
  return {
380925
380943
  behavior: "passthrough",
@@ -381146,7 +381164,7 @@ function stripWrappersFromArgv(argv) {
381146
381164
  }
381147
381165
  }
381148
381166
  }
381149
- var PATH_EXTRACTORS, SUPPORTED_PATH_COMMANDS, ACTION_VERBS, COMMAND_OPERATION_TYPE, COMMAND_VALIDATOR, TIMEOUT_FLAG_VALUE_RE;
381167
+ var TEE_DEVICE_PATHS, CANONICAL_PATH_COMMAND_BASENAMES, PATH_EXTRACTORS, SUPPORTED_PATH_COMMANDS, ACTION_VERBS, COMMAND_OPERATION_TYPE, COMMAND_VALIDATOR, TIMEOUT_FLAG_VALUE_RE;
381150
381168
  var init_pathValidation2 = __esm(() => {
381151
381169
  init_commands4();
381152
381170
  init_shellQuote();
@@ -381156,6 +381174,13 @@ var init_pathValidation2 = __esm(() => {
381156
381174
  init_pathValidation();
381157
381175
  init_bashPermissions();
381158
381176
  init_sedValidation();
381177
+ TEE_DEVICE_PATHS = new Set([
381178
+ "/dev/null",
381179
+ "/dev/stdout",
381180
+ "/dev/stderr",
381181
+ "/dev/tty"
381182
+ ]);
381183
+ CANONICAL_PATH_COMMAND_BASENAMES = new Set(["rm", "rmdir", "tee"]);
381159
381184
  PATH_EXTRACTORS = {
381160
381185
  cd: (args) => args.length === 0 ? [homedir22()] : [args.join(" ")],
381161
381186
  ls: (args) => {
@@ -381238,6 +381263,7 @@ var init_pathValidation2 = __esm(() => {
381238
381263
  sha256sum: filterOutFlags,
381239
381264
  sha1sum: filterOutFlags,
381240
381265
  md5sum: filterOutFlags,
381266
+ tee: (args) => filterTeeDevicePaths(filterOutFlags(args)),
381241
381267
  tr: (args) => {
381242
381268
  const hasDelete = args.some((a5) => a5 === "-d" || a5 === "--delete" || a5.startsWith("-") && a5.includes("d"));
381243
381269
  const nonFlags = filterOutFlags(args);
@@ -381428,7 +381454,8 @@ var init_pathValidation2 = __esm(() => {
381428
381454
  jq: "process JSON from files in",
381429
381455
  sha256sum: "compute SHA-256 checksums for files in",
381430
381456
  sha1sum: "compute SHA-1 checksums for files in",
381431
- md5sum: "compute MD5 checksums for files in"
381457
+ md5sum: "compute MD5 checksums for files in",
381458
+ tee: "write to files in"
381432
381459
  };
381433
381460
  COMMAND_OPERATION_TYPE = {
381434
381461
  cd: "read",
@@ -381466,7 +381493,8 @@ var init_pathValidation2 = __esm(() => {
381466
381493
  jq: "read",
381467
381494
  sha256sum: "read",
381468
381495
  sha1sum: "read",
381469
- md5sum: "read"
381496
+ md5sum: "read",
381497
+ tee: "write"
381470
381498
  };
381471
381499
  COMMAND_VALIDATOR = {
381472
381500
  mv: (args) => !args.some((arg) => arg?.startsWith("-")),
@@ -381666,7 +381694,7 @@ function extractWritePathsFromSubcommand(subcommand) {
381666
381694
  const tokens = parseResult.tokens.filter((t4) => typeof t4 === "string");
381667
381695
  if (tokens.length === 0)
381668
381696
  return [];
381669
- const baseCmd = tokens[0];
381697
+ const baseCmd = canonicalizePathCommandName(tokens[0]?.replace(/[\\'"]/g, ""));
381670
381698
  if (!baseCmd)
381671
381699
  return [];
381672
381700
  if (!(baseCmd in COMMAND_OPERATION_TYPE)) {
@@ -451320,7 +451348,8 @@ var init_FileEditTool = __esm(() => {
451320
451348
  result: false,
451321
451349
  behavior: "ask",
451322
451350
  message: "File is in a directory that is denied by your permission settings.",
451323
- errorCode: 2
451351
+ errorCode: 2,
451352
+ deniedByPermissionRule: true
451324
451353
  };
451325
451354
  }
451326
451355
  if (isCoveredByReadDenyRule(fullFilePath, appState.toolPermissionContext)) {
@@ -451328,7 +451357,8 @@ var init_FileEditTool = __esm(() => {
451328
451357
  result: false,
451329
451358
  behavior: "ask",
451330
451359
  message: READ_DENY_EDIT_MESSAGE,
451331
- errorCode: 13
451360
+ errorCode: 13,
451361
+ deniedByPermissionRule: true
451332
451362
  };
451333
451363
  }
451334
451364
  if (fullFilePath.startsWith("\\\\") || fullFilePath.startsWith("//")) {
@@ -476321,7 +476351,8 @@ function deserializeMessagesWithInterruptDetection(serializedMessages) {
476321
476351
  const filteredToolUses = filterUnresolvedToolUses(migratedMessages);
476322
476352
  const filteredThinking = filterOrphanedThinkingOnlyMessages(filteredToolUses);
476323
476353
  const filteredMessages = filterWhitespaceOnlyAssistantMessages(filteredThinking);
476324
- const internalState = detectTurnInterruption(filteredMessages);
476354
+ const droppedUnresolvedToolUses = filteredToolUses.length !== migratedMessages.length;
476355
+ const internalState = applyResumeStalenessGates(detectTurnInterruption(filteredMessages), droppedUnresolvedToolUses ? migratedMessages : filteredMessages);
476325
476356
  let turnInterruptionState;
476326
476357
  if (internalState.kind === "interrupted_turn") {
476327
476358
  const [continuationMessage] = normalizeMessages([
@@ -476382,6 +476413,87 @@ function detectTurnInterruption(messages) {
476382
476413
  }
476383
476414
  return { kind: "none" };
476384
476415
  }
476416
+ function getResumeMaxAgeEnvMs() {
476417
+ const raw = process.env[RESUME_MAX_AGE_ENV];
476418
+ if (!raw)
476419
+ return;
476420
+ const n5 = Number(raw);
476421
+ if (n5 === 0)
476422
+ return 0;
476423
+ return Number.isFinite(n5) && n5 > 0 ? n5 : RESUME_INVALID_ENV_MAX_AGE_MS;
476424
+ }
476425
+ function getResumeMaxAge() {
476426
+ const fromEnv5 = getResumeMaxAgeEnvMs();
476427
+ if (fromEnv5)
476428
+ return { maxAgeMs: fromEnv5, source: "env" };
476429
+ return { maxAgeMs: RESUME_DEFAULT_MAX_AGE_MS, source: "default" };
476430
+ }
476431
+ function messageTimestampMs(m5) {
476432
+ return Date.parse(typeof m5.timestamp === "string" ? m5.timestamp : "");
476433
+ }
476434
+ function isResumeTailStaleByEnv(messages) {
476435
+ const maxAge = getResumeMaxAgeEnvMs();
476436
+ if (!maxAge)
476437
+ return false;
476438
+ for (let i6 = messages.length - 1;i6 >= 0; i6--) {
476439
+ const m5 = messages[i6];
476440
+ if (m5.type === "system" || m5.type === "progress")
476441
+ continue;
476442
+ const t4 = messageTimestampMs(m5);
476443
+ if (Number.isFinite(t4))
476444
+ return Date.now() - t4 >= maxAge;
476445
+ }
476446
+ return true;
476447
+ }
476448
+ function isResumeRowStale(m5, maxAgeMs) {
476449
+ const t4 = messageTimestampMs(m5);
476450
+ return !Number.isFinite(t4) || Math.abs(Date.now() - t4) >= maxAgeMs;
476451
+ }
476452
+ function newerResumeRow(a5, b5) {
476453
+ if (a5 === undefined || b5 === undefined)
476454
+ return a5 ?? b5;
476455
+ const ra = messageTimestampMs(a5);
476456
+ const rb = messageTimestampMs(b5);
476457
+ if (!Number.isFinite(ra))
476458
+ return a5;
476459
+ if (!Number.isFinite(rb))
476460
+ return b5;
476461
+ return rb > ra ? b5 : a5;
476462
+ }
476463
+ function findSkippedTailApiErrorRow(messages) {
476464
+ const lastRelevantIdx = messages.findLastIndex((m5) => m5.type !== "system" && m5.type !== "progress" && !(m5.type === "assistant" && m5.isApiErrorMessage));
476465
+ let newest;
476466
+ for (let i6 = lastRelevantIdx + 1;i6 < messages.length; i6++) {
476467
+ const m5 = messages[i6];
476468
+ if (m5.type === "assistant" && m5.isApiErrorMessage) {
476469
+ newest = newerResumeRow(newest, m5);
476470
+ }
476471
+ }
476472
+ return newest;
476473
+ }
476474
+ function applyResumeStalenessGates(state3, walkMessages) {
476475
+ if (state3.kind === "none")
476476
+ return state3;
476477
+ if (isResumeTailStaleByEnv(walkMessages)) {
476478
+ if (process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN) {
476479
+ logForDebugging(`[conversationRecovery] tengu_resume_stale_turn_suppressed (kind: ${state3.kind})`);
476480
+ }
476481
+ return { kind: "none" };
476482
+ }
476483
+ const apiErrorRow = findSkippedTailApiErrorRow(walkMessages);
476484
+ if (apiErrorRow !== undefined) {
476485
+ const bound = getResumeMaxAge();
476486
+ if (isResumeRowStale(apiErrorRow, bound.maxAgeMs)) {
476487
+ if (process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN) {
476488
+ const t4 = messageTimestampMs(apiErrorRow);
476489
+ const ageMin = Number.isFinite(t4) ? Math.floor((Date.now() - t4) / 60000) : undefined;
476490
+ logForDebugging(`[conversationRecovery] tengu_resume_stale_turn_suppressed (kind: ${state3.kind}, tail: api_error` + (ageMin !== undefined ? `, age_min: ${ageMin}` : "") + `, bound_source: ${bound.source}, bound_min: ${Math.floor(bound.maxAgeMs / 60000)})`);
476491
+ }
476492
+ return { kind: "none" };
476493
+ }
476494
+ }
476495
+ return state3;
476496
+ }
476385
476497
  function isTerminalToolResult(result, messages, resultIdx) {
476386
476498
  const content = result.message.content;
476387
476499
  if (!Array.isArray(content))
@@ -476559,7 +476671,7 @@ async function loadConversationForResume(source, sourceJsonlFile) {
476559
476671
  throw error52;
476560
476672
  }
476561
476673
  }
476562
- var BRIEF_TOOL_NAME4, LEGACY_BRIEF_TOOL_NAME2, SEND_USER_FILE_TOOL_NAME3, LOCAL_COMMAND_TAG_KINDS;
476674
+ var BRIEF_TOOL_NAME4, LEGACY_BRIEF_TOOL_NAME2, SEND_USER_FILE_TOOL_NAME3, RESUME_MAX_AGE_ENV = "CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS", RESUME_DEFAULT_MAX_AGE_MS = 21600000, RESUME_INVALID_ENV_MAX_AGE_MS = 3600000, LOCAL_COMMAND_TAG_KINDS;
476563
476675
  var init_conversationRecovery = __esm(() => {
476564
476676
  init_featureFlags();
476565
476677
  init_cwd2();
@@ -476570,6 +476682,7 @@ var init_conversationRecovery = __esm(() => {
476570
476682
  init_attachments2();
476571
476683
  init_fileHistory();
476572
476684
  init_log3();
476685
+ init_debug();
476573
476686
  init_messages3();
476574
476687
  init_plans();
476575
476688
  init_sessionStart();
@@ -561679,18 +561792,18 @@ function parseFolderPath(folderPath) {
561679
561792
  }
561680
561793
  return { platform: platform5, buildId };
561681
561794
  }
561682
- var import_debug178, debugCache;
561795
+ var import_debug179, debugCache;
561683
561796
  var init_Cache = __esm(() => {
561684
561797
  init_browser_data();
561685
561798
  init_detectPlatform();
561686
- import_debug178 = __toESM(require_src(), 1);
561687
- debugCache = import_debug178.default("puppeteer:browsers:cache");
561799
+ import_debug179 = __toESM(require_src(), 1);
561800
+ debugCache = import_debug179.default("puppeteer:browsers:cache");
561688
561801
  });
561689
561802
 
561690
561803
  // node_modules/.bun/@puppeteer+browsers@2.13.2/node_modules/@puppeteer/browsers/lib/esm/debug.js
561691
- var import_debug179;
561804
+ var import_debug180;
561692
561805
  var init_debug3 = __esm(() => {
561693
- import_debug179 = __toESM(require_src(), 1);
561806
+ import_debug180 = __toESM(require_src(), 1);
561694
561807
  });
561695
561808
 
561696
561809
  // node_modules/.bun/@puppeteer+browsers@2.13.2/node_modules/@puppeteer/browsers/lib/esm/launch.js
@@ -562009,7 +562122,7 @@ var init_launch = __esm(() => {
562009
562122
  init_Cache();
562010
562123
  init_debug3();
562011
562124
  init_detectPlatform();
562012
- debugLaunch = import_debug179.default("puppeteer:browsers:launcher");
562125
+ debugLaunch = import_debug180.default("puppeteer:browsers:launcher");
562013
562126
  CDP_WEBSOCKET_ENDPOINT_REGEX = /^DevTools listening on (ws:\/\/.*)$/;
562014
562127
  WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = /^WebDriver BiDi listening on (ws:\/\/.*)$/;
562015
562128
  processListeners = new Map;
@@ -567093,10 +567206,10 @@ async function installDMG(dmgPath, folderPath) {
567093
567206
  spawnSync4("hdiutil", ["detach", mountPath, "-quiet"]);
567094
567207
  }
567095
567208
  }
567096
- var import_debug181, debugFileUtil, internalConstantsForTesting;
567209
+ var import_debug182, debugFileUtil, internalConstantsForTesting;
567097
567210
  var init_fileUtil = __esm(() => {
567098
- import_debug181 = __toESM(require_src(), 1);
567099
- debugFileUtil = import_debug181.default("puppeteer:browsers:fileUtil");
567211
+ import_debug182 = __toESM(require_src(), 1);
567212
+ debugFileUtil = import_debug182.default("puppeteer:browsers:fileUtil");
567100
567213
  internalConstantsForTesting = {
567101
567214
  xz: "xz",
567102
567215
  bzip2: "bzip2"
@@ -567389,7 +567502,7 @@ var init_install = __esm(() => {
567389
567502
  init_fileUtil();
567390
567503
  init_httpUtil();
567391
567504
  import_progress = __toESM(require_node_progress(), 1);
567392
- debugInstall = import_debug179.default("puppeteer:browsers:install");
567505
+ debugInstall = import_debug180.default("puppeteer:browsers:install");
567393
567506
  times = new Map;
567394
567507
  });
567395
567508
 
@@ -573664,7 +573777,7 @@ import fs23 from "fs";
573664
573777
  import os16 from "os";
573665
573778
  import { dirname as dirname45 } from "path";
573666
573779
  import { PassThrough as PassThrough4 } from "stream";
573667
- var import_debug183, __runInitializers23 = function(thisArg, initializers, value) {
573780
+ var import_debug184, __runInitializers23 = function(thisArg, initializers, value) {
573668
573781
  var useValue = arguments.length > 2;
573669
573782
  for (var i6 = 0;i6 < initializers.length; i6++) {
573670
573783
  value = useValue ? initializers[i6].call(thisArg, value) : initializers[i6].call(thisArg);
@@ -573724,8 +573837,8 @@ var init_ScreenRecorder = __esm(() => {
573724
573837
  init_util6();
573725
573838
  init_decorators();
573726
573839
  init_disposable();
573727
- import_debug183 = __toESM(require_src(), 1);
573728
- debugFfmpeg = import_debug183.default("puppeteer:ffmpeg");
573840
+ import_debug184 = __toESM(require_src(), 1);
573841
+ debugFfmpeg = import_debug184.default("puppeteer:ffmpeg");
573729
573842
  ScreenRecorder = (() => {
573730
573843
  let _classSuper = PassThrough4;
573731
573844
  let _instanceExtraInitializers = [];
@@ -581396,12 +581509,13 @@ async function fetchAndCacheGatewayModels() {
581396
581509
  }
581397
581510
  const baseUrl = process.env.ANTHROPIC_BASE_URL.replace(/\/+$/, "");
581398
581511
  const url3 = `${baseUrl}/v1/models?limit=1000`;
581512
+ const timeoutMs = Number(process.env[DISCOVERY_TIMEOUT_ENV] ?? DEFAULT_DISCOVERY_TIMEOUT_MS);
581399
581513
  try {
581400
581514
  const response3 = await fetch(url3, {
581401
581515
  method: "GET",
581402
581516
  headers: buildHeaders5(),
581403
581517
  redirect: "error",
581404
- signal: AbortSignal.timeout(5000)
581518
+ signal: AbortSignal.timeout(timeoutMs)
581405
581519
  });
581406
581520
  if (!response3.ok) {
581407
581521
  logForDebugging(`[Bootstrap] Gateway /v1/models fetch failed: HTTP ${response3.status}`);
@@ -581425,7 +581539,7 @@ async function fetchAndCacheGatewayModels() {
581425
581539
  logForDebugging(`[Bootstrap] Gateway /v1/models fetch failed: ${error52 instanceof Error ? error52.message : "unknown"}`);
581426
581540
  }
581427
581541
  }
581428
- var GatewayModelSchema, GatewayModelsResponseSchema, GatewayCacheSchema;
581542
+ var GatewayModelSchema, GatewayModelsResponseSchema, GatewayCacheSchema, DEFAULT_DISCOVERY_TIMEOUT_MS = 3000, DISCOVERY_TIMEOUT_ENV = "CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS";
581429
581543
  var init_gatewayModelDiscovery = __esm(() => {
581430
581544
  init_v4();
581431
581545
  init_auth6();
@@ -586577,6 +586691,37 @@ var init_prefixStagger = __esm(() => {
586577
586691
  });
586578
586692
 
586579
586693
  // src/tools/WorkflowTool/primitives.ts
586694
+ import { availableParallelism } from "os";
586695
+ function parseConcurrencyEnv(raw) {
586696
+ if (raw === undefined) {
586697
+ return;
586698
+ }
586699
+ if (!/^[+-]?\d+$/.test(raw.trim())) {
586700
+ return;
586701
+ }
586702
+ const n5 = Number(raw.trim());
586703
+ if (!Number.isFinite(n5)) {
586704
+ return;
586705
+ }
586706
+ if (n5 < 1) {
586707
+ return;
586708
+ }
586709
+ if (n5 > 256) {
586710
+ return;
586711
+ }
586712
+ return n5;
586713
+ }
586714
+ function getDefaultWorkflowConcurrency() {
586715
+ return Math.min(16, Math.max(2, availableParallelism() - 2));
586716
+ }
586717
+ function resolveWorkflowConcurrency() {
586718
+ const fromEnv5 = parseConcurrencyEnv(process.env[WORKFLOW_CONCURRENCY_ENV]);
586719
+ const gate = fromEnv5 ?? getDefaultWorkflowConcurrency();
586720
+ if (fromEnv5 !== undefined) {
586721
+ logForDebugging(`workflow: concurrent agent gate = ${gate} (CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS)`);
586722
+ }
586723
+ return gate;
586724
+ }
586580
586725
  function workflowAgentTelemetryAttributes(runId, workflowName) {
586581
586726
  return {
586582
586727
  "workflow.run_id": runId,
@@ -586708,7 +586853,7 @@ function extractToolUseStats(messages) {
586708
586853
  return { toolUseCount, recentActivities: capped, lastActivity };
586709
586854
  }
586710
586855
  function createPrimitives(ctx) {
586711
- const concurrency = ctx.tokenBudget && ctx.tokenBudget > 0 ? Math.max(1, Math.floor(ctx.tokenBudget / 1e5)) : WORKFLOW_DEFAULT_CONCURRENCY;
586856
+ const concurrency = resolveWorkflowConcurrency();
586712
586857
  const agent = async (prompt, opts = {}) => {
586713
586858
  if (!prompt || typeof prompt !== "string") {
586714
586859
  throw new Error("agent() requires a non-empty string prompt");
@@ -587112,7 +587257,7 @@ function buildPrimitivesObject(ctx) {
587112
587257
  resolveWorkflow: p4.resolveWorkflow
587113
587258
  };
587114
587259
  }
587115
- var WORKFLOW_AGENT_LIFETIME_CAP = 1000, WORKFLOW_PARALLEL_MAX_ITEMS = 4096, WORKFLOW_DEFAULT_CONCURRENCY = 10;
587260
+ var WORKFLOW_AGENT_LIFETIME_CAP = 1000, WORKFLOW_PARALLEL_MAX_ITEMS = 4096, WORKFLOW_CONCURRENCY_ENV = "CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS";
587116
587261
  var init_primitives = __esm(() => {
587117
587262
  init_runAgent();
587118
587263
  init_generalPurposeAgent();
@@ -595775,6 +595920,11 @@ async function checkPermissionsAndCallTool(tool, toolUseID, input2, toolUseConte
595775
595920
  },
595776
595921
  ...mcpToolDetailsForAnalytics(tool.name, mcpServerType, mcpServerBaseUrl)
595777
595922
  });
595923
+ if (isValidCall.deniedByPermissionRule) {
595924
+ const observableInput = { ...parsedInput.data };
595925
+ tool.backfillObservableInput?.(observableInput);
595926
+ toolUseContext.onPermissionDenial?.(tool, toolUseID, observableInput);
595927
+ }
595778
595928
  return [
595779
595929
  {
595780
595930
  message: createUserMessage({
@@ -606982,6 +607132,8 @@ function runPostCompactCleanup(querySource) {
606982
607132
  if (isMainThreadCompact) {
606983
607133
  getUserContext.cache.clear?.();
606984
607134
  resetGetMemoryFilesCache("compact");
607135
+ getSystemContext.cache.clear?.();
607136
+ getGitStatus.cache.clear?.();
606985
607137
  }
606986
607138
  clearSystemPromptSections();
606987
607139
  clearClassifierApprovals();
@@ -645071,6 +645223,9 @@ var init_ScrollBox = __esm(() => {
645071
645223
  });
645072
645224
 
645073
645225
  // src/utils/sideQuestion.ts
645226
+ function containsFakeToolCalls(text2) {
645227
+ return BTW_FAKE_TOOLCALL_DETECTOR.test(text2);
645228
+ }
645074
645229
  function findBtwTriggerPositions(text2) {
645075
645230
  const positions = [];
645076
645231
  const matches = text2.matchAll(BTW_PATTERN);
@@ -645099,6 +645254,7 @@ IMPORTANT CONTEXT:
645099
645254
 
645100
645255
  CRITICAL CONSTRAINTS:
645101
645256
  - You have NO tools available - you cannot read files, run commands, search, or take any actions
645257
+ - Do NOT write tool calls or tool output as text (for example invoke or function_calls XML blocks) - nothing you write here is executed; if answering would need reading files, running commands, or searching, say that can't be checked from a side question and suggest asking in the main conversation
645102
645258
  - This is a one-off response - there will be no follow-up turns
645103
645259
  - You can ONLY provide information based on what you already know from the conversation context
645104
645260
  - NEVER say things like "Let me try...", "I'll now...", "Let me check...", or promise to take any action
@@ -645131,8 +645287,11 @@ function extractSideQuestionResponse(messages) {
645131
645287
  const text2 = extractTextContent(assistantBlocks, `
645132
645288
 
645133
645289
  `).trim();
645134
- if (text2)
645135
- return text2;
645290
+ if (text2) {
645291
+ return containsFakeToolCalls(text2) ? `${text2}
645292
+
645293
+ ${BTW_TOOLCALL_DISCLAIMER}` : text2;
645294
+ }
645136
645295
  const toolUse = assistantBlocks.find((b6) => b6.type === "tool_use");
645137
645296
  if (toolUse) {
645138
645297
  const toolName = "name" in toolUse ? toolUse.name : "a tool";
@@ -645145,12 +645304,13 @@ function extractSideQuestionResponse(messages) {
645145
645304
  }
645146
645305
  return null;
645147
645306
  }
645148
- var BTW_PATTERN;
645307
+ var BTW_PATTERN, BTW_TOOL_CALL_PREFIX = "antml:", BTW_FAKE_TOOLCALL_DETECTOR, BTW_TOOLCALL_DISCLAIMER = "_/btw can't run tools: any tool calls or tool output shown above were not executed and may not reflect your actual files or data. Ask in the main conversation to check._";
645149
645308
  var init_sideQuestion = __esm(() => {
645150
645309
  init_errorUtils();
645151
645310
  init_forkedAgent();
645152
645311
  init_messages3();
645153
645312
  BTW_PATTERN = /^\/btw\b/gi;
645313
+ BTW_FAKE_TOOLCALL_DETECTOR = new RegExp(`<(?:${BTW_TOOL_CALL_PREFIX})?(?:function_calls>|invoke name=)|</(?:${BTW_TOOL_CALL_PREFIX})?(?:function_calls|invoke)>`);
645154
645314
  });
645155
645315
 
645156
645316
  // src/commands/btw/btw.tsx
@@ -704179,6 +704339,7 @@ var init_cd2 = __esm(() => {
704179
704339
  var exports_focus = {};
704180
704340
  __export(exports_focus, {
704181
704341
  setFocusViewEnabled: () => setFocusViewEnabled,
704342
+ isFullscreenActive: () => isFullscreenActive2,
704182
704343
  isFocusViewEnabled: () => isFocusViewEnabled,
704183
704344
  call: () => call46
704184
704345
  });
@@ -796945,6 +797106,7 @@ var init_tipRegistry = __esm(() => {
796945
797106
  init_fileHistory();
796946
797107
  init_settings2();
796947
797108
  init_terminalSetup();
797109
+ init_focus2();
796948
797110
  init_DesktopUpsellStartup();
796949
797111
  init_color();
796950
797112
  init_OverageCreditUpsell();
@@ -797421,6 +797583,12 @@ ${blue2(`/plugin install vercel@${OFFICIAL_MARKETPLACE_NAME}`)}`;
797421
797583
  const config8 = getGlobalConfig();
797422
797584
  return config8.numStartups > 5;
797423
797585
  }
797586
+ },
797587
+ {
797588
+ id: "focus-view",
797589
+ content: async () => "Use /focus to see just your prompt, a one-line summary of the work, and the response",
797590
+ cooldownSessions: 15,
797591
+ isRelevant: async () => isFullscreenActive2() && getSettings_DEPRECATED().viewMode === undefined && !isFocusViewEnabled()
797424
797592
  }
797425
797593
  ];
797426
797594
  internalOnlyTips = process.env.USER_TYPE === "ant" ? [
@@ -819478,6 +819646,14 @@ class QueryEngine {
819478
819646
  updateFileHistoryState: processUserInputContext.updateFileHistoryState,
819479
819647
  updateAttributionState: processUserInputContext.updateAttributionState,
819480
819648
  setSDKStatus,
819649
+ onPermissionDenial: (tool, toolUseId, input2) => {
819650
+ this.permissionDenials.push({
819651
+ type: "permission_denial",
819652
+ tool_name: sdkCompatToolName(tool.name),
819653
+ tool_use_id: toolUseId,
819654
+ tool_input: input2
819655
+ });
819656
+ },
819481
819657
  taskRegistry: getHeadlessTaskRegistry()
819482
819658
  };
819483
819659
  headlessProfilerCheckpoint("before_skills_plugins");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnwenf/occ",
3
- "version": "2.1.331",
3
+ "version": "2.1.332",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {