@cnwenf/occ 2.1.295 → 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 +283 -145
  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.295","BINARY_NAME":"occ","BUILD_TIME":"2026-08-06T19:26:49.035Z","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 = [];
@@ -684604,51 +684740,57 @@ var init_logoV2Utils = __esm(() => {
684604
684740
  });
684605
684741
 
684606
684742
  // src/components/LogoV2/OccMark.tsx
684743
+ function chevronBeamX(spec, y4) {
684744
+ const centerY = (spec.gridHeight - 1) / 2;
684745
+ return (spec.gridWidth - 2) * (1 - Math.abs(y4 - centerY) / centerY);
684746
+ }
684747
+ function isChevronDotLit(spec, x6, y4) {
684748
+ if (x6 < 0 || x6 >= spec.gridWidth || y4 < 0 || y4 >= spec.gridHeight) {
684749
+ return false;
684750
+ }
684751
+ return Math.abs(x6 - chevronBeamX(spec, y4)) <= spec.beamRadius;
684752
+ }
684607
684753
  function normalizeMark(lines2) {
684608
684754
  const width = Math.max(...lines2.map(stringWidth));
684609
684755
  return lines2.map((line) => line + " ".repeat(width - stringWidth(line)));
684610
684756
  }
684757
+ function generateSignalChevron(spec) {
684758
+ const columns = Math.ceil(spec.gridWidth / 2);
684759
+ const rows = Math.ceil(spec.gridHeight / 4);
684760
+ const lines2 = [];
684761
+ for (let row = 0;row < rows; row++) {
684762
+ let line = "";
684763
+ for (let column = 0;column < columns; column++) {
684764
+ let bits2 = 0;
684765
+ for (let dotRow = 0;dotRow < 4; dotRow++) {
684766
+ const y4 = row * 4 + dotRow;
684767
+ if (isChevronDotLit(spec, column * 2, y4)) {
684768
+ bits2 |= BRAILLE_LEFT_BITS[dotRow];
684769
+ }
684770
+ if (isChevronDotLit(spec, column * 2 + 1, y4)) {
684771
+ bits2 |= BRAILLE_RIGHT_BITS[dotRow];
684772
+ }
684773
+ }
684774
+ line += bits2 === 0 ? " " : String.fromCodePoint(BRAILLE_BASE_CODE + bits2);
684775
+ }
684776
+ lines2.push(line.trimEnd());
684777
+ }
684778
+ return normalizeMark(lines2);
684779
+ }
684611
684780
  function getOccMark(mode) {
684612
684781
  return OCC_MARKS[mode];
684613
684782
  }
684614
684783
  function getOccMarkWidth(art) {
684615
684784
  return Math.max(...art.map(stringWidth));
684616
684785
  }
684617
- function gradientThemeFamily(themeName) {
684786
+ function chevronThemeFamily(themeName) {
684618
684787
  return themeName.startsWith("light") ? "light" : "dark";
684619
684788
  }
684620
- function sampleGradient(stops, t4) {
684621
- if (stops.length === 0)
684622
- return [0, 0, 0];
684623
- if (stops.length === 1)
684624
- return stops[0];
684625
- const clamped = Math.min(Math.max(t4, 0), 1);
684626
- const scaled = clamped * (stops.length - 1);
684627
- const index2 = Math.min(Math.floor(scaled), stops.length - 2);
684628
- const local = scaled - index2;
684629
- const from2 = stops[index2];
684630
- const to = stops[index2 + 1];
684631
- return [
684632
- Math.round(from2[0] + (to[0] - from2[0]) * local),
684633
- Math.round(from2[1] + (to[1] - from2[1]) * local),
684634
- Math.round(from2[2] + (to[2] - from2[2]) * local)
684635
- ];
684636
- }
684637
- function markCellT(art, row, column) {
684638
- const width = getOccMarkWidth(art);
684639
- const horizontal = width > 1 ? column / (width - 1) : 0;
684640
- const vertical = art.length > 1 ? row / (art.length - 1) : 0;
684641
- return horizontal * 0.72 + vertical * 0.28;
684642
- }
684643
684789
  function rgbColor(rgb3) {
684644
684790
  return `rgb(${rgb3[0]},${rgb3[1]},${rgb3[2]})`;
684645
684791
  }
684646
- function highlightColor(rgb3, amount = 0.62) {
684647
- return [
684648
- Math.round(rgb3[0] + (255 - rgb3[0]) * amount),
684649
- Math.round(rgb3[1] + (255 - rgb3[1]) * amount),
684650
- Math.round(rgb3[2] + (255 - rgb3[2]) * amount)
684651
- ];
684792
+ function getMarkColorMode() {
684793
+ return source_default.level >= 2 ? "color" : "silhouette";
684652
684794
  }
684653
684795
  function isShimmerCell(art, row, column, progress) {
684654
684796
  if (progress === null)
@@ -684661,7 +684803,8 @@ function isShimmerCell(art, row, column, progress) {
684661
684803
  function MarkRow({
684662
684804
  art,
684663
684805
  row,
684664
- stops,
684806
+ colorMode,
684807
+ tone,
684665
684808
  progress
684666
684809
  }) {
684667
684810
  const line = art[row];
@@ -684683,10 +684826,16 @@ function MarkRow({
684683
684826
  continue;
684684
684827
  }
684685
684828
  flushSpaces(`${row}-sp-${column}`);
684686
- const base2 = sampleGradient(stops, markCellT(art, row, column));
684829
+ if (colorMode === "silhouette") {
684830
+ nodes.push(/* @__PURE__ */ jsx_runtime258.jsx(ThemedText, {
684831
+ bold: true,
684832
+ children: char
684833
+ }, `${row}-${column}`));
684834
+ continue;
684835
+ }
684687
684836
  const shimmering = isShimmerCell(art, row, column, progress);
684688
684837
  nodes.push(/* @__PURE__ */ jsx_runtime258.jsx(ThemedText, {
684689
- color: rgbColor(shimmering ? highlightColor(base2) : base2),
684838
+ color: rgbColor(shimmering ? tone.peak : tone.base),
684690
684839
  bold: true,
684691
684840
  children: char
684692
684841
  }, `${row}-${column}`));
@@ -684700,8 +684849,9 @@ function OccMark(props) {
684700
684849
  const mode = props.mode ?? "compact";
684701
684850
  const art = getOccMark(mode);
684702
684851
  const [themeName] = useTheme();
684703
- const stops = GRADIENT_STOPS[gradientThemeFamily(themeName)];
684704
- const animate = props.animate ?? !(getInitialSettings().prefersReducedMotion ?? false);
684852
+ const tone = CHEVRON_TONES[chevronThemeFamily(themeName)];
684853
+ const colorMode = getMarkColorMode();
684854
+ const animate = colorMode === "color" && (props.animate ?? !(getInitialSettings().prefersReducedMotion ?? false));
684705
684855
  const [done, setDone] = import_react146.useState(!animate);
684706
684856
  const startTimeRef = import_react146.useRef(null);
684707
684857
  const [ref, time3] = useAnimationFrame(done ? null : SHIMMER_FRAME_MS);
@@ -684723,57 +684873,42 @@ function OccMark(props) {
684723
684873
  children: art.map((_4, row) => /* @__PURE__ */ jsx_runtime258.jsx(MarkRow, {
684724
684874
  art,
684725
684875
  row,
684726
- stops,
684876
+ colorMode,
684877
+ tone,
684727
684878
  progress
684728
684879
  }, row))
684729
684880
  });
684730
684881
  }
684731
- var import_react146, jsx_runtime258, OCC_MARKS, GRADIENT_STOPS, SHIMMER_FRAME_MS = 84, SHIMMER_DURATION_MS = 1850, SHIMMER_BAND_WIDTH = 0.24;
684882
+ var import_react146, jsx_runtime258, CHEVRON_SPECS, BRAILLE_BASE_CODE = 10240, BRAILLE_LEFT_BITS, BRAILLE_RIGHT_BITS, OCC_MARKS, CHEVRON_TONES, SHIMMER_FRAME_MS = 84, SHIMMER_DURATION_MS = 1800, SHIMMER_BAND_WIDTH = 0.24;
684732
684883
  var init_OccMark = __esm(() => {
684884
+ init_source();
684733
684885
  init_ink2();
684734
684886
  init_stringWidth();
684735
684887
  init_settings2();
684736
684888
  init_ThemeProvider();
684737
684889
  import_react146 = __toESM(require_react(), 1);
684738
684890
  jsx_runtime258 = __toESM(require_jsx_runtime(), 1);
684891
+ CHEVRON_SPECS = {
684892
+ wide: { gridWidth: 30, gridHeight: 32, beamRadius: 2.1 },
684893
+ compact: { gridWidth: 26, gridHeight: 28, beamRadius: 1.1 },
684894
+ plain: { gridWidth: 20, gridHeight: 20, beamRadius: 3.1 }
684895
+ };
684896
+ BRAILLE_LEFT_BITS = [1, 2, 4, 64];
684897
+ BRAILLE_RIGHT_BITS = [8, 16, 32, 128];
684739
684898
  OCC_MARKS = {
684740
- wide: normalizeMark([
684741
- " \u2584\u2584",
684742
- " \u259F\u2588\u2588\u2599",
684743
- " \u259F\u2588\u2588\u2588\u2588\u259B",
684744
- " \u259F\u2588\u2588\u2588\u2588\u259B",
684745
- " \u259F\u2588\u2588\u2588\u2588\u259B",
684746
- " \u259F\u2588\u2588\u2588\u2588\u259B",
684747
- "\u259F\u2588\u2588\u2588\u2588\u259B"
684748
- ]),
684749
- compact: normalizeMark([
684750
- " \u2584\u2584",
684751
- " \u259F\u2588\u2588\u2599",
684752
- " \u259F\u2588\u2588\u2588\u2599",
684753
- " \u259F\u2588\u2588\u2588\u259B",
684754
- " \u259F\u2588\u2588\u2588\u259B",
684755
- " \u259F\u2588\u2588\u2588\u259B",
684756
- "\u259F\u2588\u2588\u2588\u259B"
684757
- ]),
684758
- plain: normalizeMark([
684759
- " \u2584\u2584",
684760
- " \u259F\u2588\u2588\u2599",
684761
- " \u259F\u2588\u2588\u259B",
684762
- " \u259F\u2588\u2588\u259B",
684763
- "\u259F\u2588\u2588\u259B"
684764
- ])
684899
+ wide: generateSignalChevron(CHEVRON_SPECS.wide),
684900
+ compact: generateSignalChevron(CHEVRON_SPECS.compact),
684901
+ plain: generateSignalChevron(CHEVRON_SPECS.plain)
684765
684902
  };
684766
- GRADIENT_STOPS = {
684767
- dark: [
684768
- [252, 211, 77],
684769
- [251, 146, 60],
684770
- [244, 63, 94]
684771
- ],
684772
- light: [
684773
- [180, 83, 9],
684774
- [194, 65, 12],
684775
- [159, 18, 57]
684776
- ]
684903
+ CHEVRON_TONES = {
684904
+ dark: {
684905
+ base: [90, 90, 90],
684906
+ peak: [225, 225, 225]
684907
+ },
684908
+ light: {
684909
+ base: [64, 64, 64],
684910
+ peak: [117, 117, 117]
684911
+ }
684777
684912
  };
684778
684913
  });
684779
684914
 
@@ -685668,7 +685803,8 @@ function CondensedLogo() {
685668
685803
  incrementOverageCreditUpsellSeenCount();
685669
685804
  }
685670
685805
  }, [showGuestPassesUpsell, showOverageCreditUpsell]);
685671
- const plain = isScreenReaderEnabled() || process.env.TERM?.toLowerCase() === "dumb";
685806
+ const plain = isScreenReaderEnabled();
685807
+ const dumbTerminal = process.env.TERM?.toLowerCase() === "dumb";
685672
685808
  const upsell = showGuestPassesUpsell ? /* @__PURE__ */ jsx_runtime264.jsx(GuestPassesUpsell, {}) : showOverageCreditUpsell ? /* @__PURE__ */ jsx_runtime264.jsx(OverageCreditUpsell, {
685673
685809
  maxWidth: Math.max(columns - 6, 20),
685674
685810
  twoLine: true
@@ -685683,7 +685819,7 @@ function CondensedLogo() {
685683
685819
  branch,
685684
685820
  agentName,
685685
685821
  tip,
685686
- reducedMotion: reducedMotion || plain,
685822
+ reducedMotion: reducedMotion || plain || dumbTerminal,
685687
685823
  plain,
685688
685824
  children: upsell
685689
685825
  })
@@ -690946,8 +691082,8 @@ function formatSnippet({
690946
691082
  before,
690947
691083
  match,
690948
691084
  after
690949
- }, highlightColor2) {
690950
- return source_default.dim(before) + highlightColor2(match) + source_default.dim(after);
691085
+ }, highlightColor) {
691086
+ return source_default.dim(before) + highlightColor(match) + source_default.dim(after);
690951
691087
  }
690952
691088
  function extractSnippet(text2, query2, contextChars) {
690953
691089
  const matchIndex = text2.toLowerCase().indexOf(query2.toLowerCase());
@@ -691036,7 +691172,7 @@ function LogSelector(t0) {
691036
691172
  } else {
691037
691173
  t5 = $4[4];
691038
691174
  }
691039
- const highlightColor2 = t5;
691175
+ const highlightColor = t5;
691040
691176
  const isAgenticSearchEnabled = false;
691041
691177
  const [currentBranch, setCurrentBranch] = import_react163.default.useState(null);
691042
691178
  const [branchFilterEnabled, setBranchFilterEnabled] = import_react163.default.useState(false);
@@ -691401,14 +691537,14 @@ function LogSelector(t0) {
691401
691537
  break bb2;
691402
691538
  }
691403
691539
  let t302;
691404
- if ($4[66] !== displayedLogs || $4[67] !== highlightColor2 || $4[68] !== maxLabelWidth || $4[69] !== showAllProjects || $4[70] !== snippets) {
691540
+ if ($4[66] !== displayedLogs || $4[67] !== highlightColor || $4[68] !== maxLabelWidth || $4[69] !== showAllProjects || $4[70] !== snippets) {
691405
691541
  const sessionGroups = groupLogsBySessionId(displayedLogs);
691406
691542
  t302 = Array.from(sessionGroups.entries()).map((t312) => {
691407
691543
  const [sessionId, groupLogs] = t312;
691408
691544
  const latestLog = groupLogs[0];
691409
691545
  const indexInFiltered = displayedLogs.indexOf(latestLog);
691410
691546
  const snippet_0 = snippets.get(latestLog);
691411
- const snippetStr = snippet_0 ? formatSnippet(snippet_0, highlightColor2) : null;
691547
+ const snippetStr = snippet_0 ? formatSnippet(snippet_0, highlightColor) : null;
691412
691548
  if (groupLogs.length === 1) {
691413
691549
  const metadata = buildLogMetadata(latestLog, {
691414
691550
  showProjectPath: showAllProjects
@@ -691429,7 +691565,7 @@ function LogSelector(t0) {
691429
691565
  const children3 = groupLogs.slice(1).map((log_8, index2) => {
691430
691566
  const childIndexInFiltered = displayedLogs.indexOf(log_8);
691431
691567
  const childSnippet = snippets.get(log_8);
691432
- const childSnippetStr = childSnippet ? formatSnippet(childSnippet, highlightColor2) : null;
691568
+ const childSnippetStr = childSnippet ? formatSnippet(childSnippet, highlightColor) : null;
691433
691569
  const childMetadata = buildLogMetadata(log_8, {
691434
691570
  isChild: true,
691435
691571
  showProjectPath: showAllProjects
@@ -691468,7 +691604,7 @@ function LogSelector(t0) {
691468
691604
  };
691469
691605
  });
691470
691606
  $4[66] = displayedLogs;
691471
- $4[67] = highlightColor2;
691607
+ $4[67] = highlightColor;
691472
691608
  $4[68] = maxLabelWidth;
691473
691609
  $4[69] = showAllProjects;
691474
691610
  $4[70] = snippets;
@@ -691493,9 +691629,9 @@ function LogSelector(t0) {
691493
691629
  break bb3;
691494
691630
  }
691495
691631
  let t312;
691496
- if ($4[73] !== displayedLogs || $4[74] !== highlightColor2 || $4[75] !== maxLabelWidth || $4[76] !== showAllProjects || $4[77] !== snippets) {
691632
+ if ($4[73] !== displayedLogs || $4[74] !== highlightColor || $4[75] !== maxLabelWidth || $4[76] !== showAllProjects || $4[77] !== snippets) {
691497
691633
  let t323;
691498
- if ($4[79] !== highlightColor2 || $4[80] !== maxLabelWidth || $4[81] !== showAllProjects || $4[82] !== snippets) {
691634
+ if ($4[79] !== highlightColor || $4[80] !== maxLabelWidth || $4[81] !== showAllProjects || $4[82] !== snippets) {
691499
691635
  t323 = (log_9, index_0) => {
691500
691636
  const rawSummary = getLogDisplayTitle(log_9);
691501
691637
  const summaryWithSidechain = rawSummary + (log_9.isSidechain ? " (sidechain)" : "");
@@ -691503,7 +691639,7 @@ function LogSelector(t0) {
691503
691639
  const baseDescription = formatLogMetadata(log_9);
691504
691640
  const projectSuffix = showAllProjects && log_9.projectPath ? ` \xB7 ${log_9.projectPath}` : "";
691505
691641
  const snippet_1 = snippets.get(log_9);
691506
- const snippetStr_0 = snippet_1 ? formatSnippet(snippet_1, highlightColor2) : null;
691642
+ const snippetStr_0 = snippet_1 ? formatSnippet(snippet_1, highlightColor) : null;
691507
691643
  return {
691508
691644
  label: summary,
691509
691645
  description: snippetStr_0 ? `${baseDescription}${projectSuffix}
@@ -691512,7 +691648,7 @@ function LogSelector(t0) {
691512
691648
  value: index_0.toString()
691513
691649
  };
691514
691650
  };
691515
- $4[79] = highlightColor2;
691651
+ $4[79] = highlightColor;
691516
691652
  $4[80] = maxLabelWidth;
691517
691653
  $4[81] = showAllProjects;
691518
691654
  $4[82] = snippets;
@@ -691522,7 +691658,7 @@ function LogSelector(t0) {
691522
691658
  }
691523
691659
  t312 = displayedLogs.map(t323);
691524
691660
  $4[73] = displayedLogs;
691525
- $4[74] = highlightColor2;
691661
+ $4[74] = highlightColor;
691526
691662
  $4[75] = maxLabelWidth;
691527
691663
  $4[76] = showAllProjects;
691528
691664
  $4[77] = snippets;
@@ -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.295",
3
+ "version": "2.1.297",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {