@cnwenf/occ 2.1.296 → 2.1.297

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 +196 -58
  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.296","BINARY_NAME":"occ","BUILD_TIME":"2026-08-07T09:27:10.873Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
2
+ globalThis.MACRO={"VERSION":"2.1.297","BINARY_NAME":"occ","BUILD_TIME":"2026-08-07T19:33:55.492Z","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;
@@ -1940,18 +1940,8 @@ function createSignal() {
1940
1940
 
1941
1941
  // src/utils/taskRegistry.ts
1942
1942
  class TaskRegistryImpl {
1943
- totalAgentSpawns = 0;
1944
1943
  webSearchCalls = 0;
1945
1944
  runningSubagents = 0;
1946
- getTotalAgentSpawns() {
1947
- return this.totalAgentSpawns;
1948
- }
1949
- incrementTotalAgentSpawns() {
1950
- this.totalAgentSpawns += 1;
1951
- }
1952
- resetTotalAgentSpawns() {
1953
- this.totalAgentSpawns = 0;
1954
- }
1955
1945
  getWebSearchCalls() {
1956
1946
  return this.webSearchCalls;
1957
1947
  }
@@ -1981,11 +1971,6 @@ function getNoopTaskRegistry() {
1981
1971
  var noopRegistry;
1982
1972
  var init_taskRegistry = __esm(() => {
1983
1973
  noopRegistry = {
1984
- getTotalAgentSpawns() {
1985
- return 0;
1986
- },
1987
- incrementTotalAgentSpawns() {},
1988
- resetTotalAgentSpawns() {},
1989
1974
  getWebSearchCalls() {
1990
1975
  return 0;
1991
1976
  },
@@ -51874,6 +51859,51 @@ function extractLastJsonStringField(text, key) {
51874
51859
  }
51875
51860
  return lastValue;
51876
51861
  }
51862
+ function extractLastTypedLineField(text, type, field) {
51863
+ const typeMarker = `"type":"${type}"`;
51864
+ const fieldMarker = `"${field}":`;
51865
+ let end = text.length;
51866
+ while (end > 0) {
51867
+ const lineStart = text.lastIndexOf(`
51868
+ `, end - 1);
51869
+ const line = text.slice(lineStart + 1, end);
51870
+ end = lineStart;
51871
+ if (line.includes(typeMarker) && line.includes(fieldMarker)) {
51872
+ try {
51873
+ const parsed = JSON.parse(line);
51874
+ if (typeof parsed === "object" && parsed !== null && parsed.type === type) {
51875
+ const value = parsed[field];
51876
+ if (typeof value === "string")
51877
+ return value;
51878
+ }
51879
+ } catch {}
51880
+ }
51881
+ if (lineStart < 0)
51882
+ break;
51883
+ }
51884
+ return;
51885
+ }
51886
+ function extractFirstLineField(text, field) {
51887
+ const fieldMarker = `"${field}":`;
51888
+ let start = 0;
51889
+ while (start < text.length) {
51890
+ const lineEnd = text.indexOf(`
51891
+ `, start);
51892
+ const line = lineEnd < 0 ? text.slice(start) : text.slice(start, lineEnd);
51893
+ start = lineEnd < 0 ? text.length : lineEnd + 1;
51894
+ if (line.includes(fieldMarker)) {
51895
+ try {
51896
+ const parsed = JSON.parse(line);
51897
+ if (typeof parsed === "object" && parsed !== null) {
51898
+ const value = parsed[field];
51899
+ if (typeof value === "string")
51900
+ return value;
51901
+ }
51902
+ } catch {}
51903
+ }
51904
+ }
51905
+ return;
51906
+ }
51877
51907
  async function readHeadAndTail(filePath, fileSize, buf) {
51878
51908
  try {
51879
51909
  const fh = await fsOpen(filePath, "r");
@@ -51896,7 +51926,31 @@ async function readHeadAndTail(filePath, fileSize, buf) {
51896
51926
  return { head: "", tail: "" };
51897
51927
  }
51898
51928
  }
51899
- function simpleHash(str) {
51929
+ async function readSessionLite(filePath) {
51930
+ try {
51931
+ const fh = await fsOpen(filePath, "r");
51932
+ try {
51933
+ const stat2 = await fh.stat();
51934
+ const buf = Buffer.allocUnsafe(LITE_READ_BUF_SIZE);
51935
+ const headResult = await fh.read(buf, 0, LITE_READ_BUF_SIZE, 0);
51936
+ if (headResult.bytesRead === 0)
51937
+ return null;
51938
+ const head = buf.toString("utf8", 0, headResult.bytesRead);
51939
+ const tailOffset = Math.max(0, stat2.size - LITE_READ_BUF_SIZE);
51940
+ let tail = head;
51941
+ if (tailOffset > 0) {
51942
+ const tailResult = await fh.read(buf, 0, LITE_READ_BUF_SIZE, tailOffset);
51943
+ tail = buf.toString("utf8", 0, tailResult.bytesRead);
51944
+ }
51945
+ return { mtime: stat2.mtime.getTime(), size: stat2.size, head, tail };
51946
+ } finally {
51947
+ await fh.close();
51948
+ }
51949
+ } catch {
51950
+ return null;
51951
+ }
51952
+ }
51953
+ function pathHashSuffix(str) {
51900
51954
  return Math.abs(djb2Hash(str)).toString(36);
51901
51955
  }
51902
51956
  function sanitizePath2(name) {
@@ -51904,12 +51958,35 @@ function sanitizePath2(name) {
51904
51958
  if (sanitized.length <= MAX_SANITIZED_LENGTH2) {
51905
51959
  return sanitized;
51906
51960
  }
51907
- const hash3 = typeof Bun !== "undefined" ? Bun.hash(name).toString(36) : simpleHash(name);
51908
- return `${sanitized.slice(0, MAX_SANITIZED_LENGTH2)}-${hash3}`;
51961
+ return `${sanitized.slice(0, MAX_SANITIZED_LENGTH2)}-${pathHashSuffix(name)}`;
51909
51962
  }
51910
51963
  function getProjectsDir() {
51911
51964
  return join9(getClaudeConfigHomeDir(), "projects");
51912
51965
  }
51966
+ async function dirMatchesProjectPath(dir, projectPath, caseInsensitive = false) {
51967
+ const want = projectPath.replace(/[^a-zA-Z0-9]/g, "-");
51968
+ let dirents;
51969
+ try {
51970
+ dirents = await readdir2(dir, { withFileTypes: true });
51971
+ } catch {
51972
+ return false;
51973
+ }
51974
+ for (const entry of dirents) {
51975
+ if (!entry.isFile() || !entry.name.endsWith(".jsonl"))
51976
+ continue;
51977
+ const lite = await readSessionLite(join9(dir, entry.name));
51978
+ if (lite === null)
51979
+ continue;
51980
+ const recordedCwd = extractLastTypedLineField(lite.tail, "relocated", "relocatedCwd") ?? extractFirstLineField(lite.head, "cwd");
51981
+ if (recordedCwd === undefined)
51982
+ continue;
51983
+ const candidate = recordedCwd.replace(/[^a-zA-Z0-9]/g, "-");
51984
+ if (caseInsensitive ? candidate.toLowerCase() === want.toLowerCase() : candidate === want) {
51985
+ return true;
51986
+ }
51987
+ }
51988
+ return false;
51989
+ }
51913
51990
  function compactBoundaryMarker() {
51914
51991
  return _compactBoundaryMarker ??= Buffer.from('"compact_boundary"');
51915
51992
  }
@@ -96034,7 +96111,12 @@ var init_dist_es21 = __esm(() => {
96034
96111
  });
96035
96112
 
96036
96113
  // src/utils/model/bedrock.ts
96037
- function findFirstMatch(profiles, substring) {
96114
+ function findFirstMatch(profiles, substring, preferredPrefix) {
96115
+ if (preferredPrefix) {
96116
+ const preferred = profiles.find((p3) => p3.startsWith(`${preferredPrefix}.`) && p3.includes(substring));
96117
+ if (preferred)
96118
+ return preferred;
96119
+ }
96038
96120
  return profiles.find((p3) => p3.includes(substring)) ?? null;
96039
96121
  }
96040
96122
  async function createBedrockClient() {
@@ -96137,7 +96219,28 @@ function applyBedrockRegionPrefix(modelId, prefix) {
96137
96219
  }
96138
96220
  return modelId;
96139
96221
  }
96140
- var getBedrockInferenceProfiles, getInferenceProfileBackingModel, BEDROCK_REGION_PREFIXES;
96222
+ function deriveBedrockRegionPrefixFromRegion(region) {
96223
+ const r3 = region ?? "";
96224
+ if (r3.startsWith("us-gov-"))
96225
+ return "us-gov";
96226
+ if (r3.startsWith("us-"))
96227
+ return "us";
96228
+ if (r3.startsWith("eu-"))
96229
+ return "eu";
96230
+ if (r3.startsWith("ap-"))
96231
+ return "apac";
96232
+ return "global";
96233
+ }
96234
+ function getEffectiveBedrockRegionPrefix(region) {
96235
+ if (region?.startsWith("us-gov-"))
96236
+ return "us-gov";
96237
+ const envValue = process.env.ANTHROPIC_BEDROCK_REGION_PREFIX;
96238
+ if (envValue && BEDROCK_REGION_PREFIX_ENV_VALUES.includes(envValue)) {
96239
+ return envValue;
96240
+ }
96241
+ return deriveBedrockRegionPrefixFromRegion(region);
96242
+ }
96243
+ var getBedrockInferenceProfiles, getInferenceProfileBackingModel, BEDROCK_REGION_PREFIXES, BEDROCK_REGION_PREFIX_ENV_VALUES;
96141
96244
  var init_bedrock = __esm(() => {
96142
96245
  init_memoize();
96143
96246
  init_auth6();
@@ -96193,7 +96296,23 @@ var init_bedrock = __esm(() => {
96193
96296
  return null;
96194
96297
  }
96195
96298
  });
96196
- BEDROCK_REGION_PREFIXES = ["us", "eu", "apac", "global"];
96299
+ BEDROCK_REGION_PREFIXES = [
96300
+ "us",
96301
+ "eu",
96302
+ "apac",
96303
+ "jp",
96304
+ "au",
96305
+ "us-gov",
96306
+ "global"
96307
+ ];
96308
+ BEDROCK_REGION_PREFIX_ENV_VALUES = [
96309
+ "us",
96310
+ "eu",
96311
+ "apac",
96312
+ "jp",
96313
+ "au",
96314
+ "global"
96315
+ ];
96197
96316
  });
96198
96317
 
96199
96318
  // src/utils/model/configs.ts
@@ -96400,22 +96519,48 @@ function getBuiltinModelStrings(provider3) {
96400
96519
  }
96401
96520
  return out;
96402
96521
  }
96522
+ function applyRegionPrefixToModelStrings(ms, prefix) {
96523
+ const out = {};
96524
+ for (const key of MODEL_KEYS) {
96525
+ out[key] = applyBedrockRegionPrefix(ms[key], prefix);
96526
+ }
96527
+ return out;
96528
+ }
96403
96529
  async function getBedrockModelStrings() {
96404
- const fallback = getBuiltinModelStrings("bedrock");
96530
+ const region = getAWSRegion();
96531
+ const effectivePrefix = getEffectiveBedrockRegionPrefix(region);
96532
+ const derivedPrefix = deriveBedrockRegionPrefixFromRegion(region);
96533
+ const hardcoded = applyRegionPrefixToModelStrings(getBuiltinModelStrings("bedrock"), effectivePrefix);
96534
+ const warnIfPrefixDiverges = () => {
96535
+ if (effectivePrefix !== derivedPrefix) {
96536
+ logForDebugging(`ANTHROPIC_BEDROCK_REGION_PREFIX=${effectivePrefix} is being applied without an availability check (inference-profile discovery is unavailable). If requests 400, ensure ${effectivePrefix}.* cross-region inference profiles are enabled in this account, or unset the variable to fall back to ${derivedPrefix}.*.`, { level: "warn" });
96537
+ }
96538
+ };
96405
96539
  let profiles;
96406
96540
  try {
96407
96541
  profiles = await getBedrockInferenceProfiles();
96408
96542
  } catch (error49) {
96409
96543
  logError2(error49);
96410
- return fallback;
96544
+ logForDebugging(`Failed to list Bedrock inference profiles, falling back to hardcoded models: ${error49 instanceof Error ? error49.message : String(error49)}`, { level: "error" });
96545
+ warnIfPrefixDiverges();
96546
+ return hardcoded;
96411
96547
  }
96412
96548
  if (!profiles?.length) {
96413
- return fallback;
96549
+ warnIfPrefixDiverges();
96550
+ return hardcoded;
96414
96551
  }
96415
96552
  const out = {};
96553
+ const mismatched = [];
96416
96554
  for (const key of MODEL_KEYS) {
96417
96555
  const needle = ALL_MODEL_CONFIGS[key].firstParty;
96418
- out[key] = findFirstMatch(profiles, needle) || fallback[key];
96556
+ const value = findFirstMatch(profiles, needle, effectivePrefix) || hardcoded[key];
96557
+ out[key] = value;
96558
+ if (effectivePrefix !== derivedPrefix && !value.startsWith(`${effectivePrefix}.`)) {
96559
+ mismatched.push(needle);
96560
+ }
96561
+ }
96562
+ if (mismatched.length > 0) {
96563
+ logForDebugging(`ANTHROPIC_BEDROCK_REGION_PREFIX=${effectivePrefix}: ${mismatched.length} model(s) resolved to a different prefix (no ${effectivePrefix}.* profile in this account): ${mismatched.join(", ")}. This is a preference, not a residency guarantee.`, { level: "warn" });
96419
96564
  }
96420
96565
  return out;
96421
96566
  }
@@ -96465,7 +96610,10 @@ function getModelStrings2() {
96465
96610
  const ms = getModelStrings();
96466
96611
  if (ms === null) {
96467
96612
  initModelStrings();
96468
- return applyModelOverrides(getBuiltinModelStrings(getAPIProvider()));
96613
+ const provider3 = getAPIProvider();
96614
+ const base2 = getBuiltinModelStrings(provider3);
96615
+ const interim = provider3 === "bedrock" ? applyRegionPrefixToModelStrings(base2, getEffectiveBedrockRegionPrefix(getAWSRegion())) : base2;
96616
+ return applyModelOverrides(interim);
96469
96617
  }
96470
96618
  return applyModelOverrides(ms);
96471
96619
  }
@@ -96483,6 +96631,8 @@ async function ensureModelStringsInitialized() {
96483
96631
  var MODEL_KEYS, updateBedrockModelStrings;
96484
96632
  var init_modelStrings = __esm(() => {
96485
96633
  init_state();
96634
+ init_debug();
96635
+ init_envUtils();
96486
96636
  init_log3();
96487
96637
  init_settings2();
96488
96638
  init_bedrock();
@@ -361938,23 +362088,12 @@ function parsePositiveIntEnv(raw) {
361938
362088
  function getMaxWebSearchesPerSession() {
361939
362089
  return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION) ?? DEFAULT_MAX_WEB_SEARCHES_PER_SESSION;
361940
362090
  }
361941
- function getMaxSubagentsPerSession() {
361942
- return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION) ?? DEFAULT_MAX_SUBAGENTS_PER_SESSION;
361943
- }
361944
362091
  function getMaxConcurrentSubagents() {
361945
362092
  return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS) ?? DEFAULT_MAX_CONCURRENT_SUBAGENTS;
361946
362093
  }
361947
362094
  function getMaxSubagentSpawnDepth() {
361948
362095
  return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH) ?? DEFAULT_MAX_SUBAGENT_SPAWN_DEPTH;
361949
362096
  }
361950
- function assertSubagentCapAndIncrement(context4) {
361951
- const max2 = getMaxSubagentsPerSession();
361952
- const count3 = context4.taskRegistry?.getTotalAgentSpawns() ?? 0;
361953
- if (count3 >= max2) {
361954
- throw new Error(`Subagent spawn limit reached (${count3} of ${max2} agents spawned). Complete the remaining work directly with your tools instead of spawning more agents. If more agents are genuinely needed, ask the user to raise CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION.`);
361955
- }
361956
- context4.taskRegistry?.incrementTotalAgentSpawns();
361957
- }
361958
362097
  function claimConcurrentSubagentSlot(context4) {
361959
362098
  const max2 = getMaxConcurrentSubagents();
361960
362099
  const running = context4.taskRegistry?.getConcurrentSubagents() ?? 0;
@@ -361963,7 +362102,7 @@ function claimConcurrentSubagentSlot(context4) {
361963
362102
  }
361964
362103
  return context4.taskRegistry?.takeConcurrencySlot() ?? (() => {});
361965
362104
  }
361966
- var DEFAULT_MAX_WEB_SEARCHES_PER_SESSION = 200, DEFAULT_MAX_SUBAGENTS_PER_SESSION = 200, DEFAULT_MAX_CONCURRENT_SUBAGENTS = 20, DEFAULT_MAX_SUBAGENT_SPAWN_DEPTH = 3;
362105
+ var DEFAULT_MAX_WEB_SEARCHES_PER_SESSION = 200, DEFAULT_MAX_CONCURRENT_SUBAGENTS = 20, DEFAULT_MAX_SUBAGENT_SPAWN_DEPTH = 3;
361967
362106
 
361968
362107
  // src/utils/sdkEventQueue.ts
361969
362108
  import { randomUUID as randomUUID12 } from "crypto";
@@ -362129,7 +362268,6 @@ function startBackgroundSession({
362129
362268
  runWithAgentContext(agentContext, async () => {
362130
362269
  let releaseConcurrentSubagentSlot = null;
362131
362270
  try {
362132
- assertSubagentCapAndIncrement(queryParams.toolUseContext);
362133
362271
  releaseConcurrentSubagentSlot = claimConcurrentSubagentSlot(queryParams.toolUseContext);
362134
362272
  const bgMessages = [...messages];
362135
362273
  const recentActivities = [];
@@ -471364,7 +471502,6 @@ async function* runAgent({
471364
471502
  transcriptSubdir,
471365
471503
  onQueryProgress
471366
471504
  }) {
471367
- assertSubagentCapAndIncrement(toolUseContext);
471368
471505
  const appState = toolUseContext.getAppState();
471369
471506
  const permissionMode = appState.toolPermissionContext.mode;
471370
471507
  const rootSetAppState = toolUseContext.setAppStateForTasks ?? toolUseContext.setAppState;
@@ -477254,7 +477391,6 @@ async function handleSpawn(input, context6) {
477254
477391
  return handleSpawnSeparateWindow(input, context6);
477255
477392
  }
477256
477393
  async function spawnTeammate(config6, context6) {
477257
- assertSubagentCapAndIncrement(context6);
477258
477394
  return handleSpawn(config6, context6);
477259
477395
  }
477260
477396
  var import_react85;
@@ -559142,18 +559278,18 @@ function parseFolderPath(folderPath) {
559142
559278
  }
559143
559279
  return { platform: platform5, buildId };
559144
559280
  }
559145
- var import_debug174, debugCache;
559281
+ var import_debug175, debugCache;
559146
559282
  var init_Cache = __esm(() => {
559147
559283
  init_browser_data();
559148
559284
  init_detectPlatform();
559149
- import_debug174 = __toESM(require_src(), 1);
559150
- debugCache = import_debug174.default("puppeteer:browsers:cache");
559285
+ import_debug175 = __toESM(require_src(), 1);
559286
+ debugCache = import_debug175.default("puppeteer:browsers:cache");
559151
559287
  });
559152
559288
 
559153
559289
  // node_modules/.bun/@puppeteer+browsers@2.13.2/node_modules/@puppeteer/browsers/lib/esm/debug.js
559154
- var import_debug175;
559290
+ var import_debug176;
559155
559291
  var init_debug3 = __esm(() => {
559156
- import_debug175 = __toESM(require_src(), 1);
559292
+ import_debug176 = __toESM(require_src(), 1);
559157
559293
  });
559158
559294
 
559159
559295
  // node_modules/.bun/@puppeteer+browsers@2.13.2/node_modules/@puppeteer/browsers/lib/esm/launch.js
@@ -559472,7 +559608,7 @@ var init_launch = __esm(() => {
559472
559608
  init_Cache();
559473
559609
  init_debug3();
559474
559610
  init_detectPlatform();
559475
- debugLaunch = import_debug175.default("puppeteer:browsers:launcher");
559611
+ debugLaunch = import_debug176.default("puppeteer:browsers:launcher");
559476
559612
  CDP_WEBSOCKET_ENDPOINT_REGEX = /^DevTools listening on (ws:\/\/.*)$/;
559477
559613
  WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = /^WebDriver BiDi listening on (ws:\/\/.*)$/;
559478
559614
  processListeners = new Map;
@@ -564556,10 +564692,10 @@ async function installDMG(dmgPath, folderPath) {
564556
564692
  spawnSync4("hdiutil", ["detach", mountPath, "-quiet"]);
564557
564693
  }
564558
564694
  }
564559
- var import_debug177, debugFileUtil, internalConstantsForTesting;
564695
+ var import_debug178, debugFileUtil, internalConstantsForTesting;
564560
564696
  var init_fileUtil = __esm(() => {
564561
- import_debug177 = __toESM(require_src(), 1);
564562
- debugFileUtil = import_debug177.default("puppeteer:browsers:fileUtil");
564697
+ import_debug178 = __toESM(require_src(), 1);
564698
+ debugFileUtil = import_debug178.default("puppeteer:browsers:fileUtil");
564563
564699
  internalConstantsForTesting = {
564564
564700
  xz: "xz",
564565
564701
  bzip2: "bzip2"
@@ -564852,7 +564988,7 @@ var init_install = __esm(() => {
564852
564988
  init_fileUtil();
564853
564989
  init_httpUtil();
564854
564990
  import_progress = __toESM(require_node_progress(), 1);
564855
- debugInstall = import_debug175.default("puppeteer:browsers:install");
564991
+ debugInstall = import_debug176.default("puppeteer:browsers:install");
564856
564992
  times = new Map;
564857
564993
  });
564858
564994
 
@@ -571127,7 +571263,7 @@ import fs22 from "fs";
571127
571263
  import os16 from "os";
571128
571264
  import { dirname as dirname45 } from "path";
571129
571265
  import { PassThrough as PassThrough4 } from "stream";
571130
- var import_debug179, __runInitializers23 = function(thisArg, initializers, value) {
571266
+ var import_debug180, __runInitializers23 = function(thisArg, initializers, value) {
571131
571267
  var useValue = arguments.length > 2;
571132
571268
  for (var i6 = 0;i6 < initializers.length; i6++) {
571133
571269
  value = useValue ? initializers[i6].call(thisArg, value) : initializers[i6].call(thisArg);
@@ -571187,8 +571323,8 @@ var init_ScreenRecorder = __esm(() => {
571187
571323
  init_util6();
571188
571324
  init_decorators();
571189
571325
  init_disposable();
571190
- import_debug179 = __toESM(require_src(), 1);
571191
- debugFfmpeg = import_debug179.default("puppeteer:ffmpeg");
571326
+ import_debug180 = __toESM(require_src(), 1);
571327
+ debugFfmpeg = import_debug180.default("puppeteer:ffmpeg");
571192
571328
  ScreenRecorder = (() => {
571193
571329
  let _classSuper = PassThrough4;
571194
571330
  let _instanceExtraInitializers = [];
@@ -722502,8 +722638,9 @@ async function getLastSessionLogFromWorktrees(sessionId) {
722502
722638
  const dirName = caseInsensitive ? dirent.name.toLowerCase() : dirent.name;
722503
722639
  if (seenDirs.has(dirName))
722504
722640
  continue;
722505
- for (const { prefix } of indexed) {
722506
- if (dirName === prefix || dirName.startsWith(prefix + "-")) {
722641
+ for (const { path: wtPath, prefix } of indexed) {
722642
+ const isMatch = dirName === prefix || prefix.length > MAX_SANITIZED_LENGTH2 && dirName.startsWith(prefix.slice(0, MAX_SANITIZED_LENGTH2) + "-") && await dirMatchesProjectPath(join161(projectsDir, dirent.name), wtPath, caseInsensitive);
722643
+ if (isMatch) {
722507
722644
  seenDirs.add(dirName);
722508
722645
  const projectDir = join161(projectsDir, dirent.name);
722509
722646
  if (projectDir !== currentProjectDir) {
@@ -722627,7 +722764,8 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
722627
722764
  if (seenDirs.has(dirName))
722628
722765
  continue;
722629
722766
  for (const { path: wtPath, prefix } of indexed) {
722630
- if (dirName === prefix || dirName.startsWith(prefix + "-")) {
722767
+ const isMatch = dirName === prefix || prefix.length > MAX_SANITIZED_LENGTH2 && dirName.startsWith(prefix.slice(0, MAX_SANITIZED_LENGTH2) + "-") && await dirMatchesProjectPath(join161(projectsDir, dirent.name), wtPath, caseInsensitive);
722768
+ if (isMatch) {
722631
722769
  seenDirs.add(dirName);
722632
722770
  allLogs.push(...await getSessionFilesLite(join161(projectsDir, dirent.name), undefined, wtPath));
722633
722771
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnwenf/occ",
3
- "version": "2.1.296",
3
+ "version": "2.1.297",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {