@costrict/csc 4.1.12 → 4.2.0

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/dist/cli.js CHANGED
@@ -669,6 +669,12 @@ var init_protectedNamespace = () => {};
669
669
  // src/utils/envUtils.ts
670
670
  import { homedir } from "os";
671
671
  import { join } from "path";
672
+ function getLegacyConfigHomeDir() {
673
+ if (process.env.COSTRICT_CONFIG_DIR || process.env.CLAUDE_CONFIG_DIR) {
674
+ return;
675
+ }
676
+ return join(homedir(), LEGACY_CONFIG_DIR_NAME).normalize("NFC");
677
+ }
672
678
  function getTeamsDir() {
673
679
  return join(getCostrictConfigHomeDir(), "teams");
674
680
  }
@@ -82320,8 +82326,8 @@ var init_credentials = __esm(() => {
82320
82326
  import { createRequire } from "module";
82321
82327
  function getVersion() {
82322
82328
  try {
82323
- if (typeof MACRO !== "undefined" && "4.1.12")
82324
- return "4.1.12";
82329
+ if (typeof MACRO !== "undefined" && "4.2.0")
82330
+ return "4.2.0";
82325
82331
  } catch {}
82326
82332
  try {
82327
82333
  const require2 = createRequire(import.meta.url);
@@ -91529,6 +91535,16 @@ function sanitizePath2(name) {
91529
91535
  function getProjectsDir() {
91530
91536
  return join9(getClaudeConfigHomeDir(), "projects");
91531
91537
  }
91538
+ function getAllProjectsDirs() {
91539
+ const primary = getProjectsDir();
91540
+ const legacyHome = getLegacyConfigHomeDir();
91541
+ if (!legacyHome)
91542
+ return [primary];
91543
+ const legacy = join9(legacyHome, "projects");
91544
+ if (primary === legacy)
91545
+ return [primary];
91546
+ return [primary, legacy];
91547
+ }
91532
91548
  function getProjectDir2(projectDir) {
91533
91549
  return join9(getProjectsDir(), sanitizePath2(projectDir));
91534
91550
  }
@@ -91550,14 +91566,16 @@ async function findProjectDir(projectPath) {
91550
91566
  return;
91551
91567
  }
91552
91568
  const prefix = sanitized.slice(0, MAX_SANITIZED_LENGTH2);
91553
- const projectsDir = getProjectsDir();
91554
- try {
91555
- const dirents = await readdir2(projectsDir, { withFileTypes: true });
91556
- const match = dirents.find((d) => d.isDirectory() && d.name.startsWith(prefix + "-"));
91557
- return match ? join9(projectsDir, match.name) : undefined;
91558
- } catch {
91559
- return;
91569
+ const allDirs = getAllProjectsDirs();
91570
+ for (const projectsDir of allDirs) {
91571
+ try {
91572
+ const dirents = await readdir2(projectsDir, { withFileTypes: true });
91573
+ const match = dirents.find((d) => d.isDirectory() && d.name.startsWith(prefix + "-"));
91574
+ if (match)
91575
+ return join9(projectsDir, match.name);
91576
+ } catch {}
91560
91577
  }
91578
+ return;
91561
91579
  }
91562
91580
  }
91563
91581
  function compactBoundaryMarker() {
@@ -183770,7 +183788,7 @@ async function fetchCoStrictModels(baseUrl, accessToken) {
183770
183788
  headers: {
183771
183789
  Authorization: `Bearer ${accessToken}`,
183772
183790
  Accept: "application/json",
183773
- "User-Agent": `csc/${"4.1.12"}`
183791
+ "User-Agent": `csc/${"4.2.0"}`
183774
183792
  },
183775
183793
  signal: controller.signal
183776
183794
  });
@@ -187356,7 +187374,7 @@ var init_auth7 = __esm(() => {
187356
187374
 
187357
187375
  // src/utils/userAgent.ts
187358
187376
  function getClaudeCodeUserAgent() {
187359
- return `costrict/${"4.1.12"}`;
187377
+ return `costrict/${"4.2.0"}`;
187360
187378
  }
187361
187379
 
187362
187380
  // src/utils/workloadContext.ts
@@ -187378,7 +187396,7 @@ function getUserAgent() {
187378
187396
  const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
187379
187397
  const workload = getWorkload();
187380
187398
  const workloadSuffix = workload ? `, workload/${workload}` : "";
187381
- return `csc/${"4.1.12"}`;
187399
+ return `csc/${"4.2.0"}`;
187382
187400
  }
187383
187401
  function getMCPUserAgent() {
187384
187402
  const parts = [];
@@ -187392,7 +187410,7 @@ function getMCPUserAgent() {
187392
187410
  parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
187393
187411
  }
187394
187412
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
187395
- return `csc/${"4.1.12"}${suffix}`;
187413
+ return `csc/${"4.2.0"}${suffix}`;
187396
187414
  }
187397
187415
  function getWebFetchUserAgent() {
187398
187416
  return `Claude-User (${getClaudeCodeUserAgent()}; +https://support.anthropic.com/)`;
@@ -187512,7 +187530,7 @@ var init_user = __esm(() => {
187512
187530
  deviceId,
187513
187531
  sessionId: getSessionId(),
187514
187532
  email: getEmail(),
187515
- appVersion: "4.1.12",
187533
+ appVersion: "4.2.0",
187516
187534
  platform: getHostPlatformForAnalytics(),
187517
187535
  organizationUuid,
187518
187536
  accountUuid,
@@ -196789,7 +196807,7 @@ var init_metadata = __esm(() => {
196789
196807
  COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
196790
196808
  WHITESPACE_REGEX = /\s+/;
196791
196809
  getVersionBase = memoize_default(() => {
196792
- const match = "4.1.12".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
196810
+ const match = "4.2.0".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
196793
196811
  return match ? match[0] : undefined;
196794
196812
  });
196795
196813
  buildEnvContext = memoize_default(async () => {
@@ -196829,9 +196847,9 @@ var init_metadata = __esm(() => {
196829
196847
  isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
196830
196848
  isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
196831
196849
  isClaudeAiAuth: isClaudeAISubscriber(),
196832
- version: "4.1.12",
196850
+ version: "4.2.0",
196833
196851
  versionBase: getVersionBase(),
196834
- buildTime: "2026-06-08T13:08:39.119Z",
196852
+ buildTime: "2026-06-09T13:06:56.679Z",
196835
196853
  deploymentEnvironment: env4.detectDeploymentEnvironment(),
196836
196854
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
196837
196855
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -197502,7 +197520,7 @@ function initialize1PEventLogging() {
197502
197520
  const platform6 = getPlatform();
197503
197521
  const attributes = {
197504
197522
  [import_semantic_conventions4.ATTR_SERVICE_NAME]: "claude-code",
197505
- [import_semantic_conventions4.ATTR_SERVICE_VERSION]: "4.1.12"
197523
+ [import_semantic_conventions4.ATTR_SERVICE_VERSION]: "4.2.0"
197506
197524
  };
197507
197525
  if (platform6 === "wsl") {
197508
197526
  const wslVersion = getWslVersion();
@@ -197529,7 +197547,7 @@ function initialize1PEventLogging() {
197529
197547
  })
197530
197548
  ]
197531
197549
  });
197532
- firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.anthropic.claude_code.events", "4.1.12");
197550
+ firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.anthropic.claude_code.events", "4.2.0");
197533
197551
  }
197534
197552
  async function reinitialize1PEventLoggingIfConfigChanged() {
197535
197553
  if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
@@ -198276,6 +198294,18 @@ function getMemoryBaseDir() {
198276
198294
  }
198277
198295
  return getClaudeConfigHomeDir();
198278
198296
  }
198297
+ function getAllMemoryBaseDirs() {
198298
+ if (getCostrictEnv("REMOTE_MEMORY_DIR")) {
198299
+ return [getMemoryBaseDir()];
198300
+ }
198301
+ const primary = getMemoryBaseDir();
198302
+ const legacyHome = getLegacyConfigHomeDir();
198303
+ if (!legacyHome)
198304
+ return [primary];
198305
+ if (primary === legacyHome)
198306
+ return [primary];
198307
+ return [primary, legacyHome];
198308
+ }
198279
198309
  function validateMemoryPath(raw, expandTilde) {
198280
198310
  if (!raw) {
198281
198311
  return;
@@ -198308,6 +198338,13 @@ function hasAutoMemPathOverride() {
198308
198338
  function getAutoMemBase() {
198309
198339
  return findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot();
198310
198340
  }
198341
+ function getAllAutoMemPaths() {
198342
+ const override = getAutoMemPathOverride() ?? getAutoMemPathSetting();
198343
+ if (override)
198344
+ return [getAutoMemPath()];
198345
+ const primary = getAutoMemPath();
198346
+ return getAllMemoryBaseDirs().map((base2) => join26(base2, "projects", sanitizePath2(getAutoMemBase()), AUTO_MEM_DIRNAME) + sep4).filter((p2) => p2 === primary || p2 !== primary);
198347
+ }
198311
198348
  function getAutoMemEntrypoint() {
198312
198349
  return join26(getAutoMemPath(), AUTO_MEM_ENTRYPOINT_NAME);
198313
198350
  }
@@ -198967,14 +199004,24 @@ function getConfigBackupDir() {
198967
199004
  function findMostRecentBackup(file2) {
198968
199005
  const fs12 = getFsImplementation();
198969
199006
  const fileBase = basename4(file2);
198970
- const backupDir = getConfigBackupDir();
198971
- try {
198972
- const backups = fs12.readdirStringSync(backupDir).filter((f4) => f4.startsWith(`${fileBase}.backup.`)).sort();
198973
- const mostRecent = backups.at(-1);
198974
- if (mostRecent) {
198975
- return join27(backupDir, mostRecent);
199007
+ const primaryBackupDir = getConfigBackupDir();
199008
+ const backupDirs = [primaryBackupDir];
199009
+ const legacyHome = getLegacyConfigHomeDir();
199010
+ if (legacyHome) {
199011
+ const legacyBackupDir = join27(legacyHome, "backups");
199012
+ if (legacyBackupDir !== primaryBackupDir) {
199013
+ backupDirs.push(legacyBackupDir);
198976
199014
  }
198977
- } catch {}
199015
+ }
199016
+ for (const backupDir of backupDirs) {
199017
+ try {
199018
+ const backups = fs12.readdirStringSync(backupDir).filter((f4) => f4.startsWith(`${fileBase}.backup.`)).sort();
199019
+ const mostRecent = backups.at(-1);
199020
+ if (mostRecent) {
199021
+ return join27(backupDir, mostRecent);
199022
+ }
199023
+ } catch {}
199024
+ }
198978
199025
  const fileDir = dirname13(file2);
198979
199026
  try {
198980
199027
  const backups = fs12.readdirStringSync(fileDir).filter((f4) => f4.startsWith(`${fileBase}.backup.`)).sort();
@@ -199222,7 +199269,7 @@ function getMemoryPath(memoryType) {
199222
199269
  const cwd2 = getOriginalCwd();
199223
199270
  switch (memoryType) {
199224
199271
  case "User":
199225
- return join27(getClaudeConfigHomeDir(), "CLAUDE.md");
199272
+ return join27(getClaudeConfigHomeDir(), PRIMARY_INSTRUCTION_FILE);
199226
199273
  case "Local":
199227
199274
  return join27(cwd2, "CLAUDE.local.md");
199228
199275
  case "Project":
@@ -199258,6 +199305,7 @@ var init_config4 = __esm(() => {
199258
199305
  init_diagLogs();
199259
199306
  init_env();
199260
199307
  init_envUtils();
199308
+ init_branding();
199261
199309
  init_errors();
199262
199310
  init_file();
199263
199311
  init_fsOperations();
@@ -220643,6 +220691,20 @@ function getPluginsDirectory() {
220643
220691
  }
220644
220692
  return join36(getClaudeConfigHomeDir(), getPluginsDirectoryName());
220645
220693
  }
220694
+ function getAllPluginsDirs() {
220695
+ if (process.env.CLAUDE_CODE_PLUGIN_CACHE_DIR) {
220696
+ return [getPluginsDirectory()];
220697
+ }
220698
+ const dirName = getPluginsDirectoryName();
220699
+ const primary = join36(getClaudeConfigHomeDir(), dirName);
220700
+ const legacyHome = getLegacyConfigHomeDir();
220701
+ if (!legacyHome)
220702
+ return [primary];
220703
+ const legacy = join36(legacyHome, dirName);
220704
+ if (primary === legacy)
220705
+ return [primary];
220706
+ return [primary, legacy];
220707
+ }
220646
220708
  function getPluginSeedDirs() {
220647
220709
  const raw = process.env.CLAUDE_CODE_PLUGIN_SEED_DIR;
220648
220710
  if (!raw)
@@ -259189,6 +259251,11 @@ var init_costrictmd = __esm(() => {
259189
259251
  if (isSettingSourceEnabled("userSettings")) {
259190
259252
  const userClaudeMd = getMemoryPath("User");
259191
259253
  result.push(...await processMemoryFile(userClaudeMd, "User", processedPaths, true));
259254
+ const legacyConfigHome = getLegacyConfigHomeDir();
259255
+ if (legacyConfigHome) {
259256
+ const legacyUserClaudeMd = join48(legacyConfigHome, LEGACY_INSTRUCTION_FILE);
259257
+ result.push(...await processMemoryFile(legacyUserClaudeMd, "User", processedPaths, true));
259258
+ }
259192
259259
  const userClaudeRulesDir = getUserClaudeRulesDir();
259193
259260
  result.push(...await processMdRules({
259194
259261
  rulesDir: userClaudeRulesDir,
@@ -259197,6 +259264,16 @@ var init_costrictmd = __esm(() => {
259197
259264
  includeExternal: true,
259198
259265
  conditionalRule: false
259199
259266
  }));
259267
+ if (legacyConfigHome) {
259268
+ const legacyUserRulesDir = join48(legacyConfigHome, "rules");
259269
+ result.push(...await processMdRules({
259270
+ rulesDir: legacyUserRulesDir,
259271
+ type: "User",
259272
+ processedPaths,
259273
+ includeExternal: true,
259274
+ conditionalRule: false
259275
+ }));
259276
+ }
259200
259277
  }
259201
259278
  const dirs = [];
259202
259279
  const originalCwd = getOriginalCwd();
@@ -362878,7 +362955,7 @@ function getTelemetryAttributes() {
362878
362955
  attributes["session.id"] = sessionId;
362879
362956
  }
362880
362957
  if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
362881
- attributes["app.version"] = "4.1.12";
362958
+ attributes["app.version"] = "4.2.0";
362882
362959
  }
362883
362960
  const oauthAccount = getOauthAccountInfo();
362884
362961
  if (oauthAccount) {
@@ -395346,7 +395423,7 @@ function initLangfuse() {
395346
395423
  flushInterval: parseInt(process.env.LANGFUSE_FLUSH_INTERVAL ?? "10", 10),
395347
395424
  mask: maskFn,
395348
395425
  environment: process.env.LANGFUSE_TRACING_ENVIRONMENT ?? "development",
395349
- release: "4.1.12",
395426
+ release: "4.2.0",
395350
395427
  exportMode: process.env.LANGFUSE_EXPORT_MODE ?? "batched",
395351
395428
  timeout: parseInt(process.env.LANGFUSE_TIMEOUT ?? "5", 10)
395352
395429
  });
@@ -432287,7 +432364,7 @@ function initSentry() {
432287
432364
  }
432288
432365
  init3({
432289
432366
  dsn,
432290
- release: typeof MACRO !== "undefined" ? "4.1.12" : undefined,
432367
+ release: typeof MACRO !== "undefined" ? "4.2.0" : undefined,
432291
432368
  environment: typeof BUILD_ENV !== "undefined" ? BUILD_ENV : "production",
432292
432369
  maxBreadcrumbs: 20,
432293
432370
  sampleRate: 1,
@@ -459783,7 +459860,7 @@ async function initializeBetaTracing(resource) {
459783
459860
  });
459784
459861
  import_api_logs5.logs.setGlobalLoggerProvider(loggerProvider);
459785
459862
  setLoggerProvider(loggerProvider);
459786
- const eventLogger = import_api_logs5.logs.getLogger("com.anthropic.claude_code.events", "4.1.12");
459863
+ const eventLogger = import_api_logs5.logs.getLogger("com.anthropic.claude_code.events", "4.2.0");
459787
459864
  setEventLogger(eventLogger);
459788
459865
  process.on("beforeExit", async () => {
459789
459866
  await loggerProvider?.forceFlush();
@@ -459823,7 +459900,7 @@ async function initializeTelemetry() {
459823
459900
  const platform7 = getPlatform();
459824
459901
  const baseAttributes = {
459825
459902
  [import_semantic_conventions16.ATTR_SERVICE_NAME]: "claude-code",
459826
- [import_semantic_conventions16.ATTR_SERVICE_VERSION]: "4.1.12"
459903
+ [import_semantic_conventions16.ATTR_SERVICE_VERSION]: "4.2.0"
459827
459904
  };
459828
459905
  if (platform7 === "wsl") {
459829
459906
  const wslVersion = getWslVersion();
@@ -459868,7 +459945,7 @@ async function initializeTelemetry() {
459868
459945
  } catch {}
459869
459946
  };
459870
459947
  registerCleanup(shutdownTelemetry2);
459871
- return meterProvider2.getMeter("com.anthropic.claude_code", "4.1.12");
459948
+ return meterProvider2.getMeter("com.anthropic.claude_code", "4.2.0");
459872
459949
  }
459873
459950
  const meterProvider = new MeterProvider({
459874
459951
  resource,
@@ -459888,7 +459965,7 @@ async function initializeTelemetry() {
459888
459965
  });
459889
459966
  import_api_logs5.logs.setGlobalLoggerProvider(loggerProvider);
459890
459967
  setLoggerProvider(loggerProvider);
459891
- const eventLogger = import_api_logs5.logs.getLogger("com.anthropic.claude_code.events", "4.1.12");
459968
+ const eventLogger = import_api_logs5.logs.getLogger("com.anthropic.claude_code.events", "4.2.0");
459892
459969
  setEventLogger(eventLogger);
459893
459970
  logForDebugging("[3P telemetry] Event logger set successfully");
459894
459971
  process.on("beforeExit", async () => {
@@ -459950,7 +460027,7 @@ Current timeout: ${timeoutMs}ms
459950
460027
  }
459951
460028
  };
459952
460029
  registerCleanup(shutdownTelemetry);
459953
- return meterProvider.getMeter("com.anthropic.claude_code", "4.1.12");
460030
+ return meterProvider.getMeter("com.anthropic.claude_code", "4.2.0");
459954
460031
  }
459955
460032
  async function flushTelemetry() {
459956
460033
  const meterProvider = getMeterProvider();
@@ -461007,7 +461084,7 @@ async function installGlobalPackage(specificVersion) {
461007
461084
  logError3(new AutoUpdaterError("Another process is currently installing an update"));
461008
461085
  logEvent("tengu_auto_updater_lock_contention", {
461009
461086
  pid: process.pid,
461010
- currentVersion: "4.1.12"
461087
+ currentVersion: "4.2.0"
461011
461088
  });
461012
461089
  return { status: "in_progress" };
461013
461090
  }
@@ -461016,7 +461093,7 @@ async function installGlobalPackage(specificVersion) {
461016
461093
  if (!env4.isRunningWithBun() && env4.isNpmFromWindowsPath()) {
461017
461094
  logError3(new Error("Windows NPM detected in WSL environment"));
461018
461095
  logEvent("tengu_auto_updater_windows_npm_in_wsl", {
461019
- currentVersion: "4.1.12"
461096
+ currentVersion: "4.2.0"
461020
461097
  });
461021
461098
  return {
461022
461099
  status: "install_failed",
@@ -461562,7 +461639,7 @@ function detectLinuxGlobPatternWarnings() {
461562
461639
  }
461563
461640
  async function getDoctorDiagnostic() {
461564
461641
  const installationType = await getCurrentInstallationType();
461565
- const version5 = typeof MACRO !== "undefined" ? "4.1.12" : "unknown";
461642
+ const version5 = typeof MACRO !== "undefined" ? "4.2.0" : "unknown";
461566
461643
  const installationPath = await getInstallationPath();
461567
461644
  const invokedBinary = getInvokedBinary();
461568
461645
  const multipleInstallations = await detectMultipleInstallations();
@@ -465149,7 +465226,7 @@ var init_validate3 = __esm(() => {
465149
465226
  });
465150
465227
 
465151
465228
  // src/keybindings/loadUserBindings.ts
465152
- import { readFileSync as readFileSync21 } from "fs";
465229
+ import { existsSync as existsSync14, readFileSync as readFileSync21 } from "fs";
465153
465230
  import { readFile as readFile19, stat as stat17 } from "fs/promises";
465154
465231
  import { dirname as dirname31, join as join63 } from "path";
465155
465232
  function isKeybindingCustomizationEnabled() {
@@ -465184,7 +465261,22 @@ async function loadKeybindings() {
465184
465261
  if (!isKeybindingCustomizationEnabled()) {
465185
465262
  return { bindings: defaultBindings, warnings: [] };
465186
465263
  }
465187
- const userPath = getKeybindingsPath();
465264
+ const primaryPath = getKeybindingsPath();
465265
+ let userPath = primaryPath;
465266
+ try {
465267
+ await stat17(primaryPath);
465268
+ } catch {
465269
+ const legacyHome = getLegacyConfigHomeDir();
465270
+ if (legacyHome) {
465271
+ const legacyPath = join63(legacyHome, "keybindings.json");
465272
+ if (legacyPath !== primaryPath) {
465273
+ try {
465274
+ await stat17(legacyPath);
465275
+ userPath = legacyPath;
465276
+ } catch {}
465277
+ }
465278
+ }
465279
+ }
465188
465280
  try {
465189
465281
  const content = await readFile19(userPath, "utf-8");
465190
465282
  const parsed = jsonParse(content);
@@ -465270,7 +465362,17 @@ function loadKeybindingsSyncWithWarnings() {
465270
465362
  cachedWarnings = [];
465271
465363
  return { bindings: cachedBindings, warnings: cachedWarnings };
465272
465364
  }
465273
- const userPath = getKeybindingsPath();
465365
+ const primaryPath = getKeybindingsPath();
465366
+ let userPath = primaryPath;
465367
+ if (!existsSync14(primaryPath)) {
465368
+ const legacyHome = getLegacyConfigHomeDir();
465369
+ if (legacyHome) {
465370
+ const legacyPath = join63(legacyHome, "keybindings.json");
465371
+ if (legacyPath !== primaryPath && existsSync14(legacyPath)) {
465372
+ userPath = legacyPath;
465373
+ }
465374
+ }
465375
+ }
465274
465376
  try {
465275
465377
  const content = readFileSync21(userPath, "utf-8");
465276
465378
  const parsed = jsonParse(content);
@@ -499635,7 +499737,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
499635
499737
  const client8 = new Client3({
499636
499738
  name: "claude-code",
499637
499739
  title: "CoStrict",
499638
- version: "4.1.12",
499740
+ version: "4.2.0",
499639
499741
  description: "CoStrict agentic coding tool",
499640
499742
  websiteUrl: PRODUCT_URL
499641
499743
  }, {
@@ -500005,7 +500107,7 @@ var init_client16 = __esm(() => {
500005
500107
  const client8 = new Client3({
500006
500108
  name: "claude-code",
500007
500109
  title: "CoStrict",
500008
- version: "4.1.12",
500110
+ version: "4.2.0",
500009
500111
  description: "CoStrict agentic coding tool",
500010
500112
  websiteUrl: PRODUCT_URL
500011
500113
  }, {
@@ -501373,7 +501475,7 @@ function getInstallationEnv() {
501373
501475
  return;
501374
501476
  }
501375
501477
  function getClaudeCodeVersion() {
501376
- return "4.1.12";
501478
+ return "4.2.0";
501377
501479
  }
501378
501480
  async function getInstalledVSCodeExtensionVersion(command4) {
501379
501481
  const { stdout } = await execFileNoThrow2(command4, ["--list-extensions", "--show-versions"], {
@@ -502737,8 +502839,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
502737
502839
  const maxVersion = await getMaxVersion();
502738
502840
  if (maxVersion && gt(version6, maxVersion)) {
502739
502841
  logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version6} to ${maxVersion}`);
502740
- if (gte2("4.1.12", maxVersion)) {
502741
- logForDebugging(`Native installer: current version ${"4.1.12"} is already at or above maxVersion ${maxVersion}, skipping update`);
502842
+ if (gte2("4.2.0", maxVersion)) {
502843
+ logForDebugging(`Native installer: current version ${"4.2.0"} is already at or above maxVersion ${maxVersion}, skipping update`);
502742
502844
  logEvent("tengu_native_update_skipped_max_version", {
502743
502845
  latency_ms: Date.now() - startTime2,
502744
502846
  max_version: maxVersion,
@@ -502749,7 +502851,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
502749
502851
  version6 = maxVersion;
502750
502852
  }
502751
502853
  }
502752
- if (!forceReinstall && version6 === "4.1.12" && await versionIsAvailable(version6) && await isPossibleClaudeBinary(executablePath)) {
502854
+ if (!forceReinstall && version6 === "4.2.0" && await versionIsAvailable(version6) && await isPossibleClaudeBinary(executablePath)) {
502753
502855
  logForDebugging(`Found ${version6} at ${executablePath}, skipping install`);
502754
502856
  logEvent("tengu_native_update_complete", {
502755
502857
  latency_ms: Date.now() - startTime2,
@@ -538269,7 +538371,7 @@ async function applySnapshot(state3, targetSnapshot) {
538269
538371
  return filesChanged;
538270
538372
  }
538271
538373
  async function checkOriginFileChanged(originalFile, backupFileName, originalStatsHint) {
538272
- const backupPath = resolveBackupPath(backupFileName);
538374
+ const backupPath = await resolveBackupPathForRead(backupFileName);
538273
538375
  let originalStats = originalStatsHint ?? null;
538274
538376
  if (!originalStats) {
538275
538377
  try {
@@ -538318,7 +538420,7 @@ async function computeDiffStatsForFile(originalFile, backupFileName) {
538318
538420
  let insertions = 0;
538319
538421
  let deletions = 0;
538320
538422
  try {
538321
- const backupPath = backupFileName ? resolveBackupPath(backupFileName) : undefined;
538423
+ const backupPath = backupFileName ? await resolveBackupPathForRead(backupFileName) : undefined;
538322
538424
  const [originalContent, backupContent] = await Promise.all([
538323
538425
  readFileAsyncOrNull(originalFile),
538324
538426
  backupPath ? readFileAsyncOrNull(backupPath) : null
@@ -538357,6 +538459,25 @@ function resolveBackupPath(backupFileName, sessionId) {
538357
538459
  const configDir = getClaudeConfigHomeDir();
538358
538460
  return join93(configDir, "file-history", sessionId || getSessionId(), backupFileName);
538359
538461
  }
538462
+ async function resolveBackupPathForRead(backupFileName, sessionId) {
538463
+ const sid = sessionId || getSessionId();
538464
+ const primary = join93(getClaudeConfigHomeDir(), "file-history", sid, backupFileName);
538465
+ try {
538466
+ await stat22(primary);
538467
+ return primary;
538468
+ } catch {}
538469
+ const legacyHome = getLegacyConfigHomeDir();
538470
+ if (legacyHome) {
538471
+ const legacy = join93(legacyHome, "file-history", sid, backupFileName);
538472
+ if (legacy !== primary) {
538473
+ try {
538474
+ await stat22(legacy);
538475
+ return legacy;
538476
+ } catch {}
538477
+ }
538478
+ }
538479
+ return primary;
538480
+ }
538360
538481
  async function createBackup(filePath, version6) {
538361
538482
  if (filePath === null) {
538362
538483
  return { backupFileName: null, version: version6, backupTime: new Date };
@@ -538392,7 +538513,7 @@ async function createBackup(filePath, version6) {
538392
538513
  };
538393
538514
  }
538394
538515
  async function restoreBackup(filePath, backupFileName) {
538395
- const backupPath = resolveBackupPath(backupFileName);
538516
+ const backupPath = await resolveBackupPathForRead(backupFileName);
538396
538517
  let backupStats;
538397
538518
  try {
538398
538519
  backupStats = await stat22(backupPath);
@@ -538489,7 +538610,7 @@ async function copyFileHistoryForResume(log5) {
538489
538610
  await Promise.allSettled(fileHistorySnapshots.map(async (snapshot2) => {
538490
538611
  const backupEntries = Object.values(snapshot2.trackedFileBackups).filter((backup) => backup.backupFileName !== null);
538491
538612
  const results = await Promise.allSettled(backupEntries.map(async ({ backupFileName }) => {
538492
- const oldBackupPath = resolveBackupPath(backupFileName, previousSessionId);
538613
+ const oldBackupPath = await resolveBackupPathForRead(backupFileName, previousSessionId);
538493
538614
  const newBackupPath = join93(newBackupDir, backupFileName);
538494
538615
  try {
538495
538616
  await link2(oldBackupPath, newBackupPath);
@@ -538546,12 +538667,12 @@ async function notifyVscodeSnapshotFilesUpdated(oldState, newState) {
538546
538667
  }
538547
538668
  let oldContent = null;
538548
538669
  if (oldBackup?.backupFileName) {
538549
- const backupPath = resolveBackupPath(oldBackup.backupFileName);
538670
+ const backupPath = await resolveBackupPathForRead(oldBackup.backupFileName);
538550
538671
  oldContent = await readFileAsyncOrNull(backupPath);
538551
538672
  }
538552
538673
  let newContent = null;
538553
538674
  if (newBackup?.backupFileName) {
538554
- const backupPath = resolveBackupPath(newBackup.backupFileName);
538675
+ const backupPath = await resolveBackupPathForRead(newBackup.backupFileName);
538555
538676
  newContent = await readFileAsyncOrNull(backupPath);
538556
538677
  }
538557
538678
  if (oldContent !== newContent) {
@@ -539371,12 +539492,15 @@ function getPlanSlug(sessionId) {
539371
539492
  let slug = cache6.get(id);
539372
539493
  if (!slug) {
539373
539494
  const plansDir = getPlansDirectory();
539495
+ const legacyDir = getLegacyPlansDirectory();
539374
539496
  for (let i6 = 0;i6 < MAX_SLUG_RETRIES; i6++) {
539375
539497
  slug = generateWordSlug();
539376
539498
  const filePath = join94(plansDir, `${slug}.md`);
539377
- if (!getFsImplementation().existsSync(filePath)) {
539378
- break;
539379
- }
539499
+ if (getFsImplementation().existsSync(filePath))
539500
+ continue;
539501
+ if (legacyDir && getFsImplementation().existsSync(join94(legacyDir, `${slug}.md`)))
539502
+ continue;
539503
+ break;
539380
539504
  }
539381
539505
  setPlanSlugCacheEntry(id, slug);
539382
539506
  }
@@ -539395,10 +539519,32 @@ function getPlanFilePath(agentId) {
539395
539519
  }
539396
539520
  return join94(getPlansDirectory(), `${planSlug}-agent-${agentId}.md`);
539397
539521
  }
539522
+ function getLegacyPlansDirectory() {
539523
+ const legacyHome = getLegacyConfigHomeDir();
539524
+ if (!legacyHome)
539525
+ return;
539526
+ const legacyPlans = join94(legacyHome, "plans");
539527
+ if (legacyPlans === getPlansDirectory())
539528
+ return;
539529
+ return legacyPlans;
539530
+ }
539398
539531
  function getPlan(agentId) {
539399
539532
  const filePath = getPlanFilePath(agentId);
539400
539533
  try {
539401
539534
  return getFsImplementation().readFileSync(filePath, { encoding: "utf-8" });
539535
+ } catch (error97) {
539536
+ if (!isENOENT(error97)) {
539537
+ logError3(error97);
539538
+ return null;
539539
+ }
539540
+ }
539541
+ const legacyDir = getLegacyPlansDirectory();
539542
+ if (!legacyDir)
539543
+ return null;
539544
+ const planSlug = getPlanSlug(getSessionId());
539545
+ const legacyPath = agentId ? join94(legacyDir, `${planSlug}-agent-${agentId}.md`) : join94(legacyDir, `${planSlug}.md`);
539546
+ try {
539547
+ return getFsImplementation().readFileSync(legacyPath, { encoding: "utf-8" });
539402
539548
  } catch (error97) {
539403
539549
  if (isENOENT(error97))
539404
539550
  return null;
@@ -539600,6 +539746,16 @@ async function getSessionEnvDirPath() {
539600
539746
  await mkdir23(sessionEnvDir, { recursive: true });
539601
539747
  return sessionEnvDir;
539602
539748
  }
539749
+ function getAllSessionEnvDirPaths() {
539750
+ const primary = join95(getClaudeConfigHomeDir(), "session-env", getSessionId());
539751
+ const legacyHome = getLegacyConfigHomeDir();
539752
+ if (!legacyHome)
539753
+ return [primary];
539754
+ const legacy = join95(legacyHome, "session-env", getSessionId());
539755
+ if (primary === legacy)
539756
+ return [primary];
539757
+ return [primary, legacy];
539758
+ }
539603
539759
  async function getHookEnvFilePath(hookEvent, hookIndex) {
539604
539760
  const prefix = hookEvent.toLowerCase();
539605
539761
  return join95(await getSessionEnvDirPath(), `${prefix}-hook-${hookIndex}.sh`);
@@ -539644,31 +539800,33 @@ async function getSessionEnvironmentScript() {
539644
539800
  }
539645
539801
  }
539646
539802
  }
539647
- const sessionEnvDir = await getSessionEnvDirPath();
539648
- try {
539649
- const files2 = await readdir12(sessionEnvDir);
539650
- const hookFiles = files2.filter((f4) => HOOK_ENV_REGEX.test(f4)).sort(sortHookEnvFiles);
539651
- for (const file3 of hookFiles) {
539652
- const filePath = join95(sessionEnvDir, file3);
539653
- try {
539654
- const content = (await readFile26(filePath, "utf8")).trim();
539655
- if (content) {
539656
- scripts.push(content);
539657
- }
539658
- } catch (e4) {
539659
- const code = getErrnoCode(e4);
539660
- if (code !== "ENOENT") {
539661
- logForDebugging(`Failed to read hook file ${filePath}: ${errorMessage(e4)}`);
539803
+ const allSessionEnvDirs = getAllSessionEnvDirPaths();
539804
+ for (const sessionEnvDir of allSessionEnvDirs) {
539805
+ try {
539806
+ const files2 = await readdir12(sessionEnvDir);
539807
+ const hookFiles = files2.filter((f4) => HOOK_ENV_REGEX.test(f4)).sort(sortHookEnvFiles);
539808
+ for (const file3 of hookFiles) {
539809
+ const filePath = join95(sessionEnvDir, file3);
539810
+ try {
539811
+ const content = (await readFile26(filePath, "utf8")).trim();
539812
+ if (content) {
539813
+ scripts.push(content);
539814
+ }
539815
+ } catch (e4) {
539816
+ const code = getErrnoCode(e4);
539817
+ if (code !== "ENOENT") {
539818
+ logForDebugging(`Failed to read hook file ${filePath}: ${errorMessage(e4)}`);
539819
+ }
539662
539820
  }
539663
539821
  }
539664
- }
539665
- if (hookFiles.length > 0) {
539666
- logForDebugging(`Session environment loaded from ${hookFiles.length} hook file(s)`);
539667
- }
539668
- } catch (e4) {
539669
- const code = getErrnoCode(e4);
539670
- if (code !== "ENOENT") {
539671
- logForDebugging(`Failed to load session environment from hooks: ${errorMessage(e4)}`);
539822
+ if (hookFiles.length > 0) {
539823
+ logForDebugging(`Session environment loaded from ${hookFiles.length} hook file(s) in ${sessionEnvDir}`);
539824
+ }
539825
+ } catch (e4) {
539826
+ const code = getErrnoCode(e4);
539827
+ if (code !== "ENOENT") {
539828
+ logForDebugging(`Failed to load session environment from hooks in ${sessionEnvDir}: ${errorMessage(e4)}`);
539829
+ }
539672
539830
  }
539673
539831
  }
539674
539832
  if (scripts.length === 0) {
@@ -540896,41 +541054,53 @@ import { join as join98 } from "path";
540896
541054
  function getSessionsDir() {
540897
541055
  return join98(getClaudeConfigHomeDir(), "sessions");
540898
541056
  }
541057
+ function getAllSessionsDirs() {
541058
+ const primary = getSessionsDir();
541059
+ const legacyHome = getLegacyConfigHomeDir();
541060
+ if (!legacyHome)
541061
+ return [primary];
541062
+ const legacy = join98(legacyHome, "sessions");
541063
+ if (primary === legacy)
541064
+ return [primary];
541065
+ return [primary, legacy];
541066
+ }
540899
541067
  async function listAllLiveSessions() {
540900
- const dir = getSessionsDir();
540901
- let files2;
540902
- try {
540903
- files2 = await readdir13(dir);
540904
- } catch (e4) {
540905
- if (!isFsInaccessible(e4)) {
540906
- logForDebugging(`[udsClient] readdir failed: ${errorMessage(e4)}`);
540907
- }
540908
- return [];
540909
- }
541068
+ const dirs = getAllSessionsDirs();
540910
541069
  const results = [];
540911
- for (const file3 of files2) {
540912
- if (!/^\d+\.json$/.test(file3))
540913
- continue;
540914
- const pid = parseInt(file3.slice(0, -5), 10);
540915
- if (!isProcessRunning(pid)) {
541070
+ for (const dir of dirs) {
541071
+ let files2;
541072
+ try {
541073
+ files2 = await readdir13(dir);
541074
+ } catch (e4) {
541075
+ if (!isFsInaccessible(e4)) {
541076
+ logForDebugging(`[udsClient] readdir failed for ${dir}: ${errorMessage(e4)}`);
541077
+ }
540916
541078
  continue;
540917
541079
  }
540918
- try {
540919
- const raw = await readFile28(join98(dir, file3), "utf8");
540920
- const data = jsonParse(raw);
540921
- results.push({
540922
- pid,
540923
- sessionId: data.sessionId,
540924
- cwd: data.cwd,
540925
- startedAt: data.startedAt,
540926
- kind: data.kind,
540927
- name: data.name,
540928
- messagingSocketPath: data.messagingSocketPath,
540929
- entrypoint: data.entrypoint,
540930
- bridgeSessionId: data.bridgeSessionId,
540931
- alive: true
540932
- });
540933
- } catch {}
541080
+ for (const file3 of files2) {
541081
+ if (!/^\d+\.json$/.test(file3))
541082
+ continue;
541083
+ const pid = parseInt(file3.slice(0, -5), 10);
541084
+ if (!isProcessRunning(pid)) {
541085
+ continue;
541086
+ }
541087
+ try {
541088
+ const raw = await readFile28(join98(dir, file3), "utf8");
541089
+ const data = jsonParse(raw);
541090
+ results.push({
541091
+ pid,
541092
+ sessionId: data.sessionId,
541093
+ cwd: data.cwd,
541094
+ startedAt: data.startedAt,
541095
+ kind: data.kind,
541096
+ name: data.name,
541097
+ messagingSocketPath: data.messagingSocketPath,
541098
+ entrypoint: data.entrypoint,
541099
+ bridgeSessionId: data.bridgeSessionId,
541100
+ alive: true
541101
+ });
541102
+ } catch {}
541103
+ }
540934
541104
  }
540935
541105
  return results;
540936
541106
  }
@@ -557525,7 +557695,7 @@ function registerMCPSkillBuilders(b6) {
557525
557695
  var builders = null;
557526
557696
 
557527
557697
  // src/skills/loadSkillsDir.ts
557528
- import { existsSync as existsSync14 } from "fs";
557698
+ import { existsSync as existsSync15 } from "fs";
557529
557699
  import { realpath as realpath9 } from "fs/promises";
557530
557700
  import { homedir as homedir31 } from "os";
557531
557701
  import {
@@ -558024,7 +558194,7 @@ var init_loadSkillsDir = __esm(() => {
558024
558194
  const additionalSkillsNested2 = await Promise.all(additionalDirs.map((dir) => {
558025
558195
  const costrictSkillsDir = join104(dir, CONFIG_DIR_NAME, "skills");
558026
558196
  const legacySkillsDir = join104(dir, LEGACY_CONFIG_DIR_NAME, "skills");
558027
- const skillsDir = existsSync14(costrictSkillsDir) ? costrictSkillsDir : legacySkillsDir;
558197
+ const skillsDir = existsSync15(costrictSkillsDir) ? costrictSkillsDir : legacySkillsDir;
558028
558198
  return loadSkillsFromSkillsDir(skillsDir, "projectSettings");
558029
558199
  }));
558030
558200
  return additionalSkillsNested2.flat().map((s) => s.skill);
@@ -558045,7 +558215,7 @@ var init_loadSkillsDir = __esm(() => {
558045
558215
  projectSettingsEnabled ? Promise.all(additionalDirs.map((dir) => {
558046
558216
  const costrictSkillsDir = join104(dir, CONFIG_DIR_NAME, "skills");
558047
558217
  const legacySkillsDir = join104(dir, LEGACY_CONFIG_DIR_NAME, "skills");
558048
- const skillsDir = existsSync14(costrictSkillsDir) ? costrictSkillsDir : legacySkillsDir;
558218
+ const skillsDir = existsSync15(costrictSkillsDir) ? costrictSkillsDir : legacySkillsDir;
558049
558219
  return loadSkillsFromSkillsDir(skillsDir, "projectSettings");
558050
558220
  })) : Promise.resolve([]),
558051
558221
  skillsLocked ? Promise.resolve([]) : loadSkillsFromCommandsDir(cwd2)
@@ -580858,7 +581028,7 @@ To complete your request, I need to fetch content from the redirected URL. Pleas
580858
581028
 
580859
581029
  // src/utils/listSessionsImpl.ts
580860
581030
  import { readdir as readdir14, stat as stat27 } from "fs/promises";
580861
- import { basename as basename28, join as join109 } from "path";
581031
+ import { join as join109 } from "path";
580862
581032
  function parseSessionInfoFromLite(sessionId, lite, projectPath) {
580863
581033
  const { head, tail, mtime, size } = lite;
580864
581034
  const firstNewline = head.indexOf(`
@@ -580897,13 +581067,14 @@ function parseSessionInfoFromLite(sessionId, lite, projectPath) {
580897
581067
  createdAt
580898
581068
  };
580899
581069
  }
580900
- async function listCandidates(projectDir, doStat, projectPath) {
581070
+ async function listCandidates(projectDir, doStat, projectPath, source) {
580901
581071
  let names;
580902
581072
  try {
580903
581073
  names = await readdir14(projectDir);
580904
581074
  } catch {
580905
581075
  return [];
580906
581076
  }
581077
+ const src = source ?? "primary";
580907
581078
  const results = await Promise.all(names.map(async (name3) => {
580908
581079
  if (!name3.endsWith(".jsonl"))
580909
581080
  return null;
@@ -580912,10 +581083,16 @@ async function listCandidates(projectDir, doStat, projectPath) {
580912
581083
  return null;
580913
581084
  const filePath = join109(projectDir, name3);
580914
581085
  if (!doStat)
580915
- return { sessionId, filePath, mtime: 0, projectPath };
581086
+ return { sessionId, filePath, mtime: 0, projectPath, source: src };
580916
581087
  try {
580917
581088
  const s = await stat27(filePath);
580918
- return { sessionId, filePath, mtime: s.mtime.getTime(), projectPath };
581089
+ return {
581090
+ sessionId,
581091
+ filePath,
581092
+ mtime: s.mtime.getTime(),
581093
+ projectPath,
581094
+ source: src
581095
+ };
580919
581096
  } catch {
580920
581097
  return null;
580921
581098
  }
@@ -580934,8 +581111,12 @@ async function readCandidate(c7) {
580934
581111
  return info2;
580935
581112
  }
580936
581113
  function compareDesc(a5, b6) {
581114
+ if (a5.sessionId === b6.sessionId)
581115
+ return a5.source === "primary" ? -1 : 1;
580937
581116
  if (b6.mtime !== a5.mtime)
580938
581117
  return b6.mtime - a5.mtime;
581118
+ if (a5.source !== b6.source)
581119
+ return a5.source === "primary" ? -1 : 1;
580939
581120
  return b6.sessionId < a5.sessionId ? -1 : b6.sessionId > a5.sessionId ? 1 : 0;
580940
581121
  }
580941
581122
  async function applySortAndLimit(candidates, limit, offset) {
@@ -580968,11 +581149,21 @@ async function applySortAndLimit(candidates, limit, offset) {
580968
581149
  async function readAllAndSort(candidates) {
580969
581150
  const all4 = await Promise.all(candidates.map(readCandidate));
580970
581151
  const byId = new Map;
580971
- for (const s of all4) {
581152
+ const sourceById = new Map;
581153
+ for (let i6 = 0;i6 < all4.length; i6++) {
581154
+ const s = all4[i6];
580972
581155
  if (!s)
580973
581156
  continue;
581157
+ const source = candidates[i6]?.source ?? "primary";
580974
581158
  const existing = byId.get(s.sessionId);
580975
- if (!existing || s.lastModified > existing.lastModified) {
581159
+ const existingSource = sourceById.get(s.sessionId);
581160
+ if (!existing) {
581161
+ byId.set(s.sessionId, s);
581162
+ sourceById.set(s.sessionId, source);
581163
+ } else if (source === "primary" && existingSource === "legacy") {
581164
+ byId.set(s.sessionId, s);
581165
+ sourceById.set(s.sessionId, source);
581166
+ } else if (source === existingSource && s.lastModified > existing.lastModified) {
580976
581167
  byId.set(s.sessionId, s);
580977
581168
  }
580978
581169
  }
@@ -580996,9 +581187,9 @@ async function gatherProjectCandidates(dir, includeWorktrees, doStat) {
580996
581187
  const projectDir = await findProjectDir(canonicalDir);
580997
581188
  if (!projectDir)
580998
581189
  return [];
580999
- return listCandidates(projectDir, doStat, canonicalDir);
581190
+ return listCandidates(projectDir, doStat, canonicalDir, "primary");
581000
581191
  }
581001
- const projectsDir = getProjectsDir();
581192
+ const allProjectsDirs = getAllProjectsDirs();
581002
581193
  const caseInsensitive = process.platform === "win32";
581003
581194
  const indexed = worktreePaths.map((wt) => {
581004
581195
  const sanitized = sanitizePath2(wt);
@@ -581008,50 +581199,51 @@ async function gatherProjectCandidates(dir, includeWorktrees, doStat) {
581008
581199
  };
581009
581200
  });
581010
581201
  indexed.sort((a5, b6) => b6.prefix.length - a5.prefix.length);
581011
- let allDirents;
581012
- try {
581013
- allDirents = await readdir14(projectsDir, { withFileTypes: true });
581014
- } catch {
581015
- const projectDir = await findProjectDir(canonicalDir);
581016
- if (!projectDir)
581017
- return [];
581018
- return listCandidates(projectDir, doStat, canonicalDir);
581019
- }
581020
581202
  const all4 = [];
581021
- const seenDirs = new Set;
581022
581203
  const canonicalProjectDir = await findProjectDir(canonicalDir);
581023
581204
  if (canonicalProjectDir) {
581024
- const dirBase = basename28(canonicalProjectDir);
581025
- seenDirs.add(caseInsensitive ? dirBase.toLowerCase() : dirBase);
581026
- all4.push(...await listCandidates(canonicalProjectDir, doStat, canonicalDir));
581205
+ all4.push(...await listCandidates(canonicalProjectDir, doStat, canonicalDir, "primary"));
581027
581206
  }
581028
- for (const dirent of allDirents) {
581029
- if (!dirent.isDirectory())
581030
- continue;
581031
- const dirName = caseInsensitive ? dirent.name.toLowerCase() : dirent.name;
581032
- if (seenDirs.has(dirName))
581207
+ for (let pi = 0;pi < allProjectsDirs.length; pi++) {
581208
+ const projectsDir = allProjectsDirs[pi];
581209
+ const source = pi === 0 ? "primary" : "legacy";
581210
+ let allDirents;
581211
+ try {
581212
+ allDirents = await readdir14(projectsDir, { withFileTypes: true });
581213
+ } catch {
581033
581214
  continue;
581034
- for (const { path: wtPath, prefix } of indexed) {
581035
- const isMatch = dirName === prefix || prefix.length >= MAX_SANITIZED_LENGTH2 && dirName.startsWith(prefix + "-");
581036
- if (isMatch) {
581037
- seenDirs.add(dirName);
581038
- all4.push(...await listCandidates(join109(projectsDir, dirent.name), doStat, wtPath));
581039
- break;
581215
+ }
581216
+ for (const dirent of allDirents) {
581217
+ if (!dirent.isDirectory())
581218
+ continue;
581219
+ const dirName = caseInsensitive ? dirent.name.toLowerCase() : dirent.name;
581220
+ for (const { path: wtPath, prefix } of indexed) {
581221
+ const isMatch = dirName === prefix || prefix.length >= MAX_SANITIZED_LENGTH2 && dirName.startsWith(prefix + "-");
581222
+ if (isMatch) {
581223
+ all4.push(...await listCandidates(join109(projectsDir, dirent.name), doStat, wtPath, source));
581224
+ break;
581225
+ }
581040
581226
  }
581041
581227
  }
581042
581228
  }
581043
581229
  return all4;
581044
581230
  }
581045
581231
  async function gatherAllCandidates(doStat) {
581046
- const projectsDir = getProjectsDir();
581047
- let dirents;
581048
- try {
581049
- dirents = await readdir14(projectsDir, { withFileTypes: true });
581050
- } catch {
581051
- return [];
581232
+ const allProjectsDirs = getAllProjectsDirs();
581233
+ const all4 = [];
581234
+ for (let pi = 0;pi < allProjectsDirs.length; pi++) {
581235
+ const projectsDir = allProjectsDirs[pi];
581236
+ const source = pi === 0 ? "primary" : "legacy";
581237
+ let dirents;
581238
+ try {
581239
+ dirents = await readdir14(projectsDir, { withFileTypes: true });
581240
+ } catch {
581241
+ continue;
581242
+ }
581243
+ const perProject = await Promise.all(dirents.filter((d4) => d4.isDirectory()).map((d4) => listCandidates(join109(projectsDir, d4.name), doStat, undefined, source)));
581244
+ all4.push(...perProject.flat());
581052
581245
  }
581053
- const perProject = await Promise.all(dirents.filter((d4) => d4.isDirectory()).map((d4) => listCandidates(join109(projectsDir, d4.name), doStat)));
581054
- return perProject.flat();
581246
+ return all4;
581055
581247
  }
581056
581248
  async function listSessionsImpl(options) {
581057
581249
  const { dir, limit, offset, includeWorktrees } = options ?? {};
@@ -588399,7 +588591,7 @@ var init_localValidate = __esm(() => {
588399
588591
 
588400
588592
  // src/services/SessionMemory/multiStore.ts
588401
588593
  import {
588402
- existsSync as existsSync15,
588594
+ existsSync as existsSync16,
588403
588595
  mkdirSync as mkdirSync7,
588404
588596
  openSync as openSync4,
588405
588597
  readdirSync as readdirSync6,
@@ -588412,7 +588604,7 @@ import {
588412
588604
  writeFileSync as writeFileSync10
588413
588605
  } from "fs";
588414
588606
  import { homedir as homedir32 } from "os";
588415
- import { basename as basename29, join as join111 } from "path";
588607
+ import { basename as basename28, join as join111 } from "path";
588416
588608
  function getBaseDir() {
588417
588609
  const configDir = process.env["CLAUDE_CONFIG_DIR"] ?? join111(homedir32(), ".claude");
588418
588610
  if (_baseDirCache && _baseDirCache.configDir === configDir) {
@@ -588450,13 +588642,13 @@ function validateStoreName(store) {
588450
588642
  if (store.startsWith(".")) {
588451
588643
  throw new Error(`Invalid store name: "${store}" must not start with ".".`);
588452
588644
  }
588453
- if (basename29(store) !== store) {
588645
+ if (basename28(store) !== store) {
588454
588646
  throw new Error(`Invalid store name: "${store}" is path-like and would escape the base directory.`);
588455
588647
  }
588456
588648
  }
588457
588649
  function listStores() {
588458
588650
  const baseDir = getBaseDir();
588459
- if (!existsSync15(baseDir))
588651
+ if (!existsSync16(baseDir))
588460
588652
  return [];
588461
588653
  return readdirSync6(baseDir, { withFileTypes: true }).filter((d4) => d4.isDirectory() && !d4.name.endsWith(".archived")).map((d4) => d4.name).sort();
588462
588654
  }
@@ -588464,7 +588656,7 @@ function getEntryBounded(store, key6, maxBytes) {
588464
588656
  validateStoreName(store);
588465
588657
  validateKey(key6);
588466
588658
  const entryPath = getEntryPath(store, key6);
588467
- if (!existsSync15(entryPath))
588659
+ if (!existsSync16(entryPath))
588468
588660
  return null;
588469
588661
  const stat30 = statSync11(entryPath);
588470
588662
  const total = stat30.size;
@@ -588490,7 +588682,7 @@ function getEntryBounded(store, key6, maxBytes) {
588490
588682
  function listEntriesBounded(store, maxEntries) {
588491
588683
  validateStoreName(store);
588492
588684
  const storeDir = getStoreDir(store);
588493
- if (!existsSync15(storeDir))
588685
+ if (!existsSync16(storeDir))
588494
588686
  return { entries: [], truncated: false };
588495
588687
  const top = [];
588496
588688
  let totalMd = 0;
@@ -589027,7 +589219,7 @@ import {
589027
589219
  import {
589028
589220
  readFileSync as readFileSync26,
589029
589221
  writeFileSync as writeFileSync11,
589030
- existsSync as existsSync16,
589222
+ existsSync as existsSync17,
589031
589223
  mkdirSync as mkdirSync8,
589032
589224
  chmodSync as chmodSync4,
589033
589225
  renameSync as renameSync3,
@@ -589053,11 +589245,11 @@ async function getOrCreatePassphrase() {
589053
589245
  if (envVal)
589054
589246
  return envVal;
589055
589247
  const passphraseFile = getPassphraseFilePath();
589056
- if (existsSync16(passphraseFile)) {
589248
+ if (existsSync17(passphraseFile)) {
589057
589249
  return readFileSync26(passphraseFile, "utf8").trim();
589058
589250
  }
589059
589251
  const claudeDir = getClaudeDir();
589060
- if (!existsSync16(claudeDir)) {
589252
+ if (!existsSync17(claudeDir)) {
589061
589253
  mkdirSync8(claudeDir, { recursive: true });
589062
589254
  }
589063
589255
  const generated = randomBytes14(32).toString("hex");
@@ -589113,7 +589305,7 @@ function decrypt2(record4, key6, entryKey) {
589113
589305
  }
589114
589306
  async function readVaultFile() {
589115
589307
  const filePath = getVaultFilePath();
589116
- if (!existsSync16(filePath))
589308
+ if (!existsSync17(filePath))
589117
589309
  return {};
589118
589310
  let raw;
589119
589311
  try {
@@ -601598,13 +601790,13 @@ __export(exports_projectContext, {
601598
601790
  import { execFileSync as execFileSync5 } from "child_process";
601599
601791
  import { createHash as createHash25 } from "crypto";
601600
601792
  import {
601601
- existsSync as existsSync17,
601793
+ existsSync as existsSync18,
601602
601794
  mkdirSync as mkdirSync9,
601603
601795
  readFileSync as readFileSync27,
601604
601796
  realpathSync as realpathSync6,
601605
601797
  writeFileSync as writeFileSync12
601606
601798
  } from "fs";
601607
- import { basename as basename30, join as join116, resolve as resolve41 } from "path";
601799
+ import { basename as basename29, join as join116, resolve as resolve41 } from "path";
601608
601800
  function getSkillLearningRootDir() {
601609
601801
  return join116(getClaudeConfigHomeDir(), "skill-learning");
601610
601802
  }
@@ -601671,7 +601863,7 @@ function resolveContext(cwd2) {
601671
601863
  cwd: cwd2,
601672
601864
  projectRoot,
601673
601865
  identity: `claude-project-dir:${projectRoot}`,
601674
- projectName: basename30(projectRoot) || "project"
601866
+ projectName: basename29(projectRoot) || "project"
601675
601867
  });
601676
601868
  }
601677
601869
  const gitRemote = git(["remote", "get-url", "origin"], cwd2);
@@ -601697,7 +601889,7 @@ function resolveContext(cwd2) {
601697
601889
  cwd: cwd2,
601698
601890
  projectRoot,
601699
601891
  identity: `git-root:${projectRoot}`,
601700
- projectName: basename30(projectRoot) || "project"
601892
+ projectName: basename29(projectRoot) || "project"
601701
601893
  });
601702
601894
  }
601703
601895
  return buildContext({
@@ -601740,7 +601932,7 @@ function persistProjectContext(context25) {
601740
601932
  writeJson(getProjectContextPath(context25.projectId), record4);
601741
601933
  }
601742
601934
  function readProjectsRegistry(path27) {
601743
- if (!existsSync17(path27)) {
601935
+ if (!existsSync18(path27)) {
601744
601936
  return {
601745
601937
  version: REGISTRY_VERSION,
601746
601938
  updatedAt: new Date(0).toISOString(),
@@ -602793,8 +602985,8 @@ import {
602793
602985
  rm as rm7,
602794
602986
  writeFile as writeFile37
602795
602987
  } from "fs/promises";
602796
- import { existsSync as existsSync18 } from "fs";
602797
- import { basename as basename31, dirname as dirname53, join as join119 } from "path";
602988
+ import { existsSync as existsSync19 } from "fs";
602989
+ import { basename as basename30, dirname as dirname53, join as join119 } from "path";
602798
602990
  async function compareExistingArtifacts(kind, draft, rootsOrSkills) {
602799
602991
  const existing = rootsOrSkills.length > 0 && typeof rootsOrSkills[0] === "string" ? await loadExistingArtifacts(kind, rootsOrSkills) : rootsOrSkills;
602800
602992
  const draftTerms = terms(`${draft.name} ${draft.description} ${draft.content}`);
@@ -602811,7 +603003,7 @@ async function loadExistingArtifacts(kind, roots) {
602811
603003
  return loadExistingSkills(roots);
602812
603004
  const results = [];
602813
603005
  for (const root6 of roots) {
602814
- if (!existsSync18(root6))
603006
+ if (!existsSync19(root6))
602815
603007
  continue;
602816
603008
  await collectArtifactFiles(root6, results);
602817
603009
  }
@@ -602905,7 +603097,7 @@ async function applySkillLifecycleDecision(decision, options = {}) {
602905
603097
  async function loadExistingSkills(roots) {
602906
603098
  const skills = [];
602907
603099
  for (const root6 of roots) {
602908
- if (!existsSync18(root6))
603100
+ if (!existsSync19(root6))
602909
603101
  continue;
602910
603102
  await collectSkillFiles(root6, skills);
602911
603103
  }
@@ -602914,7 +603106,7 @@ async function loadExistingSkills(roots) {
602914
603106
  async function archiveSkill(skill, reason, replacement, options = {}) {
602915
603107
  const skillDir = dirname53(skill.path);
602916
603108
  const archiveRoot = options.archiveRoot ?? join119(dirname53(skillDir), ".archive");
602917
- const archivedPath = join119(archiveRoot, `${basename31(skillDir)}-${timestamp(options.now)}`);
603109
+ const archivedPath = join119(archiveRoot, `${basename30(skillDir)}-${timestamp(options.now)}`);
602918
603110
  await mkdir34(archiveRoot, { recursive: true });
602919
603111
  await rename7(skillDir, archivedPath);
602920
603112
  const manifestPath = await writeReplacementManifest(options.manifestRoot ?? archivedPath, {
@@ -602935,7 +603127,7 @@ async function deleteSkill(skill, reason, replacement, options = {}) {
602935
603127
  throw new Error("Hard delete requires allowHardDelete=true");
602936
603128
  }
602937
603129
  const skillDir = dirname53(skill.path);
602938
- const content = existsSync18(skill.path) ? await readFile41(skill.path, "utf8") : "";
603130
+ const content = existsSync19(skill.path) ? await readFile41(skill.path, "utf8") : "";
602939
603131
  const manifestRoot = options.manifestRoot ?? join119(dirname53(skillDir), ".tombstones");
602940
603132
  const manifestPath = await writeReplacementManifest(manifestRoot, {
602941
603133
  oldSkill: skill.name,
@@ -603006,7 +603198,7 @@ async function collectSkillFiles(root6, results) {
603006
603198
  if (entry.isFile() && entry.name === "SKILL.md") {
603007
603199
  const content = await readFile41(full, "utf8");
603008
603200
  results.push({
603009
- name: parseFrontmatter2(content, "name") ?? basename31(dirname53(full)),
603201
+ name: parseFrontmatter2(content, "name") ?? basename30(dirname53(full)),
603010
603202
  description: parseFrontmatter2(content, "description") ?? "",
603011
603203
  path: full,
603012
603204
  content
@@ -603070,7 +603262,7 @@ var init_skillLifecycle = __esm(() => {
603070
603262
 
603071
603263
  // src/services/skillLearning/commandGenerator.ts
603072
603264
  import { mkdir as mkdir35, writeFile as writeFile38 } from "fs/promises";
603073
- import { existsSync as existsSync19 } from "fs";
603265
+ import { existsSync as existsSync20 } from "fs";
603074
603266
  import { join as join120 } from "path";
603075
603267
  function generateCommandDraft(instincts, options) {
603076
603268
  if (instincts.length === 0) {
@@ -603101,7 +603293,7 @@ function generateCommandDraft(instincts, options) {
603101
603293
  async function writeLearnedCommand(draft) {
603102
603294
  await mkdir35(draft.outputPath, { recursive: true });
603103
603295
  const filePath = join120(draft.outputPath, `${draft.name}.md`);
603104
- if (existsSync19(filePath))
603296
+ if (existsSync20(filePath))
603105
603297
  return filePath;
603106
603298
  await writeFile38(filePath, draft.content, "utf8");
603107
603299
  clearCommandsCache();
@@ -603194,7 +603386,7 @@ var init_commandGenerator = __esm(() => {
603194
603386
 
603195
603387
  // src/services/skillLearning/agentGenerator.ts
603196
603388
  import { mkdir as mkdir36, writeFile as writeFile39 } from "fs/promises";
603197
- import { existsSync as existsSync20 } from "fs";
603389
+ import { existsSync as existsSync21 } from "fs";
603198
603390
  import { join as join121 } from "path";
603199
603391
  function generateAgentDraft(instincts, options) {
603200
603392
  if (instincts.length === 0) {
@@ -603225,7 +603417,7 @@ function generateAgentDraft(instincts, options) {
603225
603417
  async function writeLearnedAgent(draft) {
603226
603418
  await mkdir36(draft.outputPath, { recursive: true });
603227
603419
  const filePath = join121(draft.outputPath, `${draft.name}.md`);
603228
- if (existsSync20(filePath))
603420
+ if (existsSync21(filePath))
603229
603421
  return filePath;
603230
603422
  await writeFile39(filePath, draft.content, "utf8");
603231
603423
  clearCommandsCache();
@@ -603390,7 +603582,7 @@ var init_evolution = __esm(() => {
603390
603582
 
603391
603583
  // src/services/skillLearning/promotion.ts
603392
603584
  import { readdir as readdir18 } from "fs/promises";
603393
- import { existsSync as existsSync21 } from "fs";
603585
+ import { existsSync as existsSync22 } from "fs";
603394
603586
  import { join as join122 } from "path";
603395
603587
  function recordSessionPromoted(id) {
603396
603588
  sessionPromotedIds.add(id);
@@ -603466,7 +603658,7 @@ async function checkPromotion(options = {}) {
603466
603658
  async function loadAllProjectInstincts(rootDir) {
603467
603659
  const root6 = getSkillLearningRoot(rootDir ? { rootDir } : undefined);
603468
603660
  const projectsRoot = join122(root6, "projects");
603469
- if (!existsSync21(projectsRoot))
603661
+ if (!existsSync22(projectsRoot))
603470
603662
  return [];
603471
603663
  const entries = await readdir18(projectsRoot, { withFileTypes: true });
603472
603664
  const instincts = [];
@@ -603525,7 +603717,7 @@ __export(exports_runtimeObserver, {
603525
603717
  getRuntimeTurn: () => getRuntimeTurn,
603526
603718
  RUNTIME_SESSION_ID: () => RUNTIME_SESSION_ID
603527
603719
  });
603528
- import { existsSync as existsSync22 } from "fs";
603720
+ import { existsSync as existsSync23 } from "fs";
603529
603721
  import { join as join123 } from "path";
603530
603722
  function resetRuntimeLLMBookkeeping() {
603531
603723
  llmCallsThisSession = 0;
@@ -603632,7 +603824,7 @@ async function autoEvolveLearnedSkills(options) {
603632
603824
  if (outcome.action === "append-evidence")
603633
603825
  continue;
603634
603826
  const draft = outcome.draft;
603635
- if (existsSync22(join123(draft.outputPath, "SKILL.md")))
603827
+ if (existsSync23(join123(draft.outputPath, "SKILL.md")))
603636
603828
  continue;
603637
603829
  const existing = await compareExistingArtifacts("skill", draft, skillRoots);
603638
603830
  const decision = decideSkillLifecycle(draft, existing);
@@ -605859,11 +606051,11 @@ var init_memoryTypes = __esm(() => {
605859
606051
 
605860
606052
  // src/memdir/memoryScan.ts
605861
606053
  import { readdir as readdir19 } from "fs/promises";
605862
- import { basename as basename32, join as join124 } from "path";
606054
+ import { basename as basename31, join as join124 } from "path";
605863
606055
  async function scanMemoryFiles(memoryDir, signal) {
605864
606056
  try {
605865
606057
  const entries = await readdir19(memoryDir, { recursive: true });
605866
- const mdFiles = entries.filter((f4) => f4.endsWith(".md") && basename32(f4) !== "MEMORY.md");
606058
+ const mdFiles = entries.filter((f4) => f4.endsWith(".md") && basename31(f4) !== "MEMORY.md");
605867
606059
  const headerResults = await Promise.allSettled(mdFiles.map(async (relativePath) => {
605868
606060
  const filePath = join124(memoryDir, relativePath);
605869
606061
  const { content, mtimeMs } = await readFileInRange(filePath, 0, FRONTMATTER_MAX_LINES, undefined, signal);
@@ -605970,7 +606162,7 @@ __export(exports_extractMemories, {
605970
606162
  drainPendingExtraction: () => drainPendingExtraction,
605971
606163
  createAutoMemCanUseTool: () => createAutoMemCanUseTool
605972
606164
  });
605973
- import { basename as basename33 } from "path";
606165
+ import { basename as basename32 } from "path";
605974
606166
  function isModelVisibleMessage(message2) {
605975
606167
  return message2.type === "user" || message2.type === "assistant";
605976
606168
  }
@@ -606155,7 +606347,7 @@ function initExtractMemories() {
606155
606347
  } else {
606156
606348
  logForDebugging("[extractMemories] no memories saved this run");
606157
606349
  }
606158
- const memoryPaths = writtenPaths.filter((p2) => basename33(p2) !== ENTRYPOINT_NAME);
606350
+ const memoryPaths = writtenPaths.filter((p2) => basename32(p2) !== ENTRYPOINT_NAME);
606159
606351
  const teamCount = 0;
606160
606352
  logEvent("tengu_extract_memories_extraction", {
606161
606353
  input_tokens: result.totalUsage.input_tokens,
@@ -607155,7 +607347,7 @@ var init_queue = __esm(() => {
607155
607347
 
607156
607348
  // src/services/rawDump/spawn.ts
607157
607349
  import { spawn as spawn10 } from "child_process";
607158
- import { existsSync as existsSync23 } from "fs";
607350
+ import { existsSync as existsSync24 } from "fs";
607159
607351
  import path29 from "path";
607160
607352
  import { fileURLToPath as fileURLToPath8 } from "url";
607161
607353
  function resolveWorkerPath() {
@@ -607175,11 +607367,11 @@ function resolveWorkerPath() {
607175
607367
  }
607176
607368
  function resolveRuntime() {
607177
607369
  const execPath2 = process.execPath;
607178
- const basename34 = path29.basename(execPath2).toLowerCase();
607179
- if (basename34.startsWith("bun")) {
607370
+ const basename33 = path29.basename(execPath2).toLowerCase();
607371
+ if (basename33.startsWith("bun")) {
607180
607372
  return { entry: execPath2, isBun: true };
607181
607373
  }
607182
- if (basename34.startsWith("node")) {
607374
+ if (basename33.startsWith("node")) {
607183
607375
  return { entry: execPath2, isBun: false };
607184
607376
  }
607185
607377
  if (typeof Bun !== "undefined" && Bun.which) {
@@ -607195,7 +607387,7 @@ function resolveRuntime() {
607195
607387
  function spawnBatchWorker() {
607196
607388
  const workerPath = resolveWorkerPath();
607197
607389
  const runtime = resolveRuntime();
607198
- if (!existsSync23(workerPath) || !runtime) {
607390
+ if (!existsSync24(workerPath) || !runtime) {
607199
607391
  return false;
607200
607392
  }
607201
607393
  const args = runtime.isBun ? ["run", workerPath] : [workerPath];
@@ -607763,19 +607955,30 @@ var init_git2 = __esm(() => {
607763
607955
 
607764
607956
  // src/services/rawDump/history.ts
607765
607957
  import { promises as fs25 } from "fs";
607766
- import os15 from "os";
607767
607958
  import path32 from "path";
607959
+ async function resolveHistoryFilePath() {
607960
+ try {
607961
+ const s = await fs25.stat(HISTORY_FILE);
607962
+ return { path: HISTORY_FILE, mtimeMs: Number(s.mtimeMs), size: Number(s.size) };
607963
+ } catch {}
607964
+ if (LEGACY_HISTORY_FILE) {
607965
+ try {
607966
+ const s = await fs25.stat(LEGACY_HISTORY_FILE);
607967
+ return { path: LEGACY_HISTORY_FILE, mtimeMs: Number(s.mtimeMs), size: Number(s.size) };
607968
+ } catch {}
607969
+ }
607970
+ return null;
607971
+ }
607768
607972
  async function loadHistory() {
607769
607973
  const items = [];
607770
- let fileStat = null;
607771
- try {
607772
- fileStat = await fs25.stat(HISTORY_FILE);
607773
- } catch {
607974
+ const resolved = await resolveHistoryFilePath();
607975
+ if (!resolved) {
607774
607976
  cache6 = null;
607775
607977
  return [];
607776
607978
  }
607979
+ const { path: historyFile, mtimeMs, size } = resolved;
607777
607980
  try {
607778
- const content = await fs25.readFile(HISTORY_FILE, "utf-8");
607981
+ const content = await fs25.readFile(historyFile, "utf-8");
607779
607982
  const lines2 = content.split(`
607780
607983
  `);
607781
607984
  for (const line of lines2) {
@@ -607790,45 +607993,46 @@ async function loadHistory() {
607790
607993
  return cache6?.items ?? [];
607791
607994
  }
607792
607995
  cache6 = {
607793
- mtime: fileStat.mtimeMs,
607794
- size: fileStat.size,
607996
+ mtime: mtimeMs,
607997
+ size,
607795
607998
  items
607796
607999
  };
607797
608000
  return cache6.items;
607798
608001
  }
607799
608002
  async function autoLoadHistory() {
607800
- let fileStat = null;
607801
- try {
607802
- fileStat = await fs25.stat(HISTORY_FILE);
607803
- } catch {
608003
+ const resolved = await resolveHistoryFilePath();
608004
+ if (!resolved) {
607804
608005
  if (cache6) {
607805
608006
  return null;
607806
608007
  }
607807
608008
  return [];
607808
608009
  }
607809
- if (cache6 && cache6.mtime === fileStat.mtimeMs && cache6.size === fileStat.size) {
608010
+ if (cache6 && cache6.mtime === resolved.mtimeMs && cache6.size === resolved.size) {
607810
608011
  return cache6.items;
607811
608012
  }
607812
608013
  return await loadHistory();
607813
608014
  }
607814
608015
  async function getProjectDirs() {
607815
608016
  if (cache6) {
607816
- let fileStat = null;
607817
- try {
607818
- fileStat = await fs25.stat(HISTORY_FILE);
607819
- } catch {
608017
+ const resolved = await resolveHistoryFilePath();
608018
+ if (!resolved) {
607820
608019
  return [...new Set(cache6.items.map((item) => item.project))];
607821
608020
  }
607822
- if (fileStat.mtimeMs === cache6.mtime && fileStat.size === cache6.size) {
608021
+ if (resolved.mtimeMs === cache6.mtime && resolved.size === cache6.size) {
607823
608022
  return [...new Set(cache6.items.map((item) => item.project))];
607824
608023
  }
607825
608024
  }
607826
608025
  const items = await loadHistory();
607827
608026
  return [...new Set(items.map((item) => item.project))];
607828
608027
  }
607829
- var HISTORY_FILE, cache6 = null;
608028
+ var HISTORY_FILE, LEGACY_HISTORY_FILE, cache6 = null;
607830
608029
  var init_history = __esm(() => {
607831
- HISTORY_FILE = path32.join(os15.homedir(), ".claude", "history.jsonl");
608030
+ init_envUtils();
608031
+ HISTORY_FILE = path32.join(getClaudeConfigHomeDir(), "history.jsonl");
608032
+ LEGACY_HISTORY_FILE = (() => {
608033
+ const legacy = getLegacyConfigHomeDir();
608034
+ return legacy ? path32.join(legacy, "history.jsonl") : null;
608035
+ })();
607832
608036
  });
607833
608037
 
607834
608038
  // src/services/rawDump/parse.ts
@@ -608428,7 +608632,7 @@ var init_statistics = __esm(() => {
608428
608632
  // src/services/rawDump/worker.ts
608429
608633
  import { promises as fs27 } from "fs";
608430
608634
  import { createHash as createHash27 } from "crypto";
608431
- import os16 from "os";
608635
+ import os15 from "os";
608432
608636
  import path34 from "path";
608433
608637
  import { fileURLToPath as fileURLToPath9 } from "url";
608434
608638
  async function getCachedRepoInfo(directory) {
@@ -608811,7 +609015,7 @@ async function uploadSummary(payload, authData) {
608811
609015
  client_ide: "cli",
608812
609016
  client_version: authData.version,
608813
609017
  client_os: detectOs(),
608814
- client_os_version: os16.release(),
609018
+ client_os_version: os15.release(),
608815
609019
  caller: process.env.CSC_RAW_DUMP_CALLER || "chat"
608816
609020
  };
608817
609021
  await uploadReport(authData, "/raw-store/task-summary", body);
@@ -609137,7 +609341,7 @@ var init_worker = __esm(() => {
609137
609341
 
609138
609342
  // src/services/rawDump/timerWorker.ts
609139
609343
  import { promises as fs28 } from "fs";
609140
- import os17 from "os";
609344
+ import os16 from "os";
609141
609345
  import path35 from "path";
609142
609346
  async function acquireTimerLock() {
609143
609347
  try {
@@ -609212,7 +609416,7 @@ var init_timerWorker = __esm(() => {
609212
609416
  init_logger6();
609213
609417
  init_worker();
609214
609418
  log9 = createLogger("timer");
609215
- TIMER_LOCK_FILE = path35.join(os17.homedir(), ".claude", "raw-dump", "csc-timer.lock");
609419
+ TIMER_LOCK_FILE = path35.join(os16.homedir(), ".claude", "raw-dump", "csc-timer.lock");
609216
609420
  scriptPath2 = process.argv[1] || "";
609217
609421
  if (scriptPath2.endsWith("timerWorker.ts") || scriptPath2.endsWith("timerWorker.js")) {
609218
609422
  startTimerWorker();
@@ -609472,7 +609676,7 @@ __export(exports_skillGapStore, {
609472
609676
  promoteGapToDraft: () => promoteGapToDraft,
609473
609677
  findGapKeyByDraftPath: () => findGapKeyByDraftPath
609474
609678
  });
609475
- import { existsSync as existsSync24 } from "fs";
609679
+ import { existsSync as existsSync25 } from "fs";
609476
609680
  import { mkdir as mkdir37, readFile as readFile43, rename as rename8, writeFile as writeFile40 } from "fs/promises";
609477
609681
  import { createHash as createHash28 } from "crypto";
609478
609682
  import { dirname as dirname54, join as join126 } from "path";
@@ -609615,7 +609819,7 @@ async function writeSkillGapDraft(gap, project) {
609615
609819
  description: "Draft learned skill candidate. Promote after repeated evidence or explicit user correction."
609616
609820
  });
609617
609821
  const skillFile = join126(draft.outputPath, "SKILL.md");
609618
- if (!existsSync24(skillFile)) {
609822
+ if (!existsSync25(skillFile)) {
609619
609823
  await writeLearnedSkill({
609620
609824
  ...draft,
609621
609825
  content: draft.content + `
@@ -609636,7 +609840,7 @@ async function writeActiveSkillForGap(gap, project) {
609636
609840
  description: buildGapAction(gap.prompt)
609637
609841
  });
609638
609842
  const skillFile = join126(draft.outputPath, "SKILL.md");
609639
- if (!existsSync24(skillFile)) {
609843
+ if (!existsSync25(skillFile)) {
609640
609844
  await writeLearnedSkill(draft);
609641
609845
  }
609642
609846
  return { type: "active", name: draft.name, skillPath: skillFile };
@@ -610147,6 +610351,16 @@ import { join as join128 } from "path";
610147
610351
  function getSessionsDir2() {
610148
610352
  return join128(getClaudeConfigHomeDir(), "sessions");
610149
610353
  }
610354
+ function getAllSessionsDirs2() {
610355
+ const primary = getSessionsDir2();
610356
+ const legacyHome = getLegacyConfigHomeDir();
610357
+ if (!legacyHome)
610358
+ return [primary];
610359
+ const legacy = join128(legacyHome, "sessions");
610360
+ if (primary === legacy)
610361
+ return [primary];
610362
+ return [primary, legacy];
610363
+ }
610150
610364
  function envSessionKind() {
610151
610365
  if (true) {
610152
610366
  const k5 = process.env.CLAUDE_CODE_SESSION_KIND;
@@ -610215,18 +610429,21 @@ async function updateSessionActivity(patch) {
610215
610429
  await updatePidFile({ ...patch, updatedAt: Date.now() });
610216
610430
  }
610217
610431
  async function countConcurrentSessions() {
610218
- const dir = getSessionsDir2();
610219
- let files2;
610220
- try {
610221
- files2 = await readdir20(dir);
610222
- } catch (e4) {
610223
- if (!isFsInaccessible(e4)) {
610224
- logForDebugging(`[concurrentSessions] readdir failed: ${errorMessage(e4)}`);
610432
+ const dirs = getAllSessionsDirs2();
610433
+ let files2 = [];
610434
+ for (const dir of dirs) {
610435
+ try {
610436
+ const entries = await readdir20(dir);
610437
+ files2.push(...entries.map((f4) => `${dir}/${f4}`));
610438
+ } catch (e4) {
610439
+ if (!isFsInaccessible(e4)) {
610440
+ logForDebugging(`[concurrentSessions] readdir failed for ${dir}: ${errorMessage(e4)}`);
610441
+ }
610225
610442
  }
610226
- return 0;
610227
610443
  }
610228
610444
  let count3 = 0;
610229
- for (const file3 of files2) {
610445
+ for (const fullPath of files2) {
610446
+ const file3 = fullPath.split("/").pop();
610230
610447
  if (!/^\d+\.json$/.test(file3))
610231
610448
  continue;
610232
610449
  const pid = parseInt(file3.slice(0, -5), 10);
@@ -610237,7 +610454,7 @@ async function countConcurrentSessions() {
610237
610454
  if (isProcessRunning(pid)) {
610238
610455
  count3++;
610239
610456
  } else if (getPlatform() !== "wsl") {
610240
- unlink17(join128(dir, file3)).catch(() => {});
610457
+ unlink17(fullPath).catch(() => {});
610241
610458
  }
610242
610459
  }
610243
610460
  return count3;
@@ -618755,22 +618972,22 @@ var init_attachments2 = __esm(() => {
618755
618972
  });
618756
618973
 
618757
618974
  // src/utils/plugins/loadPluginCommands.ts
618758
- import { basename as basename35, dirname as dirname57, join as join133 } from "path";
618975
+ import { basename as basename34, dirname as dirname57, join as join133 } from "path";
618759
618976
  function isSkillFile2(filePath) {
618760
- return /^skill\.md$/i.test(basename35(filePath));
618977
+ return /^skill\.md$/i.test(basename34(filePath));
618761
618978
  }
618762
618979
  function getCommandNameFromFile(filePath, baseDir, pluginName) {
618763
618980
  const isSkill = isSkillFile2(filePath);
618764
618981
  if (isSkill) {
618765
618982
  const skillDirectory = dirname57(filePath);
618766
618983
  const parentOfSkillDir = dirname57(skillDirectory);
618767
- const commandBaseName = basename35(skillDirectory);
618984
+ const commandBaseName = basename34(skillDirectory);
618768
618985
  const relativePath = parentOfSkillDir.startsWith(baseDir) ? parentOfSkillDir.slice(baseDir.length).replace(/^\//, "") : "";
618769
618986
  const namespace = relativePath ? relativePath.split("/").join(":") : "";
618770
618987
  return namespace ? `${pluginName}:${namespace}:${commandBaseName}` : `${pluginName}:${commandBaseName}`;
618771
618988
  } else {
618772
618989
  const fileDirectory = dirname57(filePath);
618773
- const commandBaseName = basename35(filePath).replace(/\.md$/, "");
618990
+ const commandBaseName = basename34(filePath).replace(/\.md$/, "");
618774
618991
  const relativePath = fileDirectory.startsWith(baseDir) ? fileDirectory.slice(baseDir.length).replace(/^\//, "") : "";
618775
618992
  const namespace = relativePath ? relativePath.split("/").join(":") : "";
618776
618993
  return namespace ? `${pluginName}:${namespace}:${commandBaseName}` : `${pluginName}:${commandBaseName}`;
@@ -618807,7 +619024,7 @@ function transformPluginSkillFiles(files2) {
618807
619024
  if (skillFiles.length > 0) {
618808
619025
  const skillFile = skillFiles[0];
618809
619026
  if (skillFiles.length > 1) {
618810
- logForDebugging(`Multiple skill files found in ${dir}, using ${basename35(skillFile.filePath)}`);
619027
+ logForDebugging(`Multiple skill files found in ${dir}, using ${basename34(skillFile.filePath)}`);
618811
619028
  }
618812
619029
  result.push(skillFile);
618813
619030
  } else {
@@ -618954,7 +619171,7 @@ async function loadSkillsFromDirectory(skillsPath, pluginName, sourceName, plugi
618954
619171
  }
618955
619172
  try {
618956
619173
  const { frontmatter, content: markdownContent } = parseFrontmatter(directSkillContent, directSkillPath);
618957
- const skillName = `${pluginName}:${basename35(skillsPath)}`;
619174
+ const skillName = `${pluginName}:${basename34(skillsPath)}`;
618958
619175
  const file3 = {
618959
619176
  filePath: directSkillPath,
618960
619177
  baseDir: dirname57(directSkillPath),
@@ -619100,7 +619317,7 @@ var init_loadPluginCommands = __esm(() => {
619100
619317
  }
619101
619318
  }
619102
619319
  if (!commandName) {
619103
- commandName = `${plugin.name}:${basename35(commandPath).replace(/\.md$/, "")}`;
619320
+ commandName = `${plugin.name}:${basename34(commandPath).replace(/\.md$/, "")}`;
619104
619321
  }
619105
619322
  const finalFrontmatter = metadataOverride ? {
619106
619323
  ...frontmatter,
@@ -619244,7 +619461,7 @@ import {
619244
619461
  writeFile as writeFile43
619245
619462
  } from "fs/promises";
619246
619463
  import { tmpdir as tmpdir13 } from "os";
619247
- import { basename as basename36, dirname as dirname58, join as join134 } from "path";
619464
+ import { basename as basename35, dirname as dirname58, join as join134 } from "path";
619248
619465
  function isPluginZipCacheEnabled() {
619249
619466
  return isEnvTruthy(process.env.CLAUDE_CODE_PLUGIN_USE_ZIP_CACHE);
619250
619467
  }
@@ -619309,7 +619526,7 @@ async function cleanupSessionPluginCache() {
619309
619526
  async function atomicWriteToZipCache(targetPath, data) {
619310
619527
  const dir = dirname58(targetPath);
619311
619528
  await getFsImplementation().mkdir(dir);
619312
- const tmpName = `.${basename36(targetPath)}.tmp.${randomBytes17(4).toString("hex")}`;
619529
+ const tmpName = `.${basename35(targetPath)}.tmp.${randomBytes17(4).toString("hex")}`;
619313
619530
  const tmpPath = join134(dir, tmpName);
619314
619531
  try {
619315
619532
  if (typeof data === "string") {
@@ -620016,13 +620233,47 @@ var init_officialMarketplaceGcs = __esm(() => {
620016
620233
 
620017
620234
  // src/utils/plugins/marketplaceManager.ts
620018
620235
  import { writeFile as writeFile46 } from "fs/promises";
620019
- import { basename as basename37, dirname as dirname60, isAbsolute as isAbsolute28, join as join137, resolve as resolve44, sep as sep28 } from "path";
620236
+ import { basename as basename36, dirname as dirname60, isAbsolute as isAbsolute28, join as join137, resolve as resolve44, sep as sep28 } from "path";
620020
620237
  function getKnownMarketplacesFile() {
620021
620238
  return join137(getPluginsDirectory(), "known_marketplaces.json");
620022
620239
  }
620023
620240
  function getMarketplacesCacheDir() {
620024
620241
  return join137(getPluginsDirectory(), "marketplaces");
620025
620242
  }
620243
+ async function readKnownMarketplacesFromAllDirs() {
620244
+ const fs29 = getFsImplementation();
620245
+ const dirs = getAllPluginsDirs();
620246
+ let merged = {};
620247
+ let primaryFile = "";
620248
+ for (const dir of dirs) {
620249
+ const filePath = join137(dir, "known_marketplaces.json");
620250
+ try {
620251
+ const content = await fs29.readFile(filePath, { encoding: "utf-8" });
620252
+ const data = jsonParse(content);
620253
+ const parsed = KnownMarketplacesFileSchema().safeParse(data);
620254
+ if (parsed.success) {
620255
+ if (!primaryFile) {
620256
+ primaryFile = filePath;
620257
+ merged = parsed.data;
620258
+ } else {
620259
+ for (const [name3, entry] of Object.entries(parsed.data)) {
620260
+ if (!(name3 in merged)) {
620261
+ merged[name3] = entry;
620262
+ logForDebugging(`Found marketplace '${name3}' in legacy known_marketplaces.json`);
620263
+ }
620264
+ }
620265
+ }
620266
+ }
620267
+ } catch (e4) {
620268
+ if (!isENOENT(e4)) {
620269
+ logForDebugging(`Failed to read known_marketplaces.json from ${filePath}: ${errorMessage(e4)}`, { level: "warn" });
620270
+ }
620271
+ }
620272
+ }
620273
+ if (!primaryFile)
620274
+ return null;
620275
+ return { config: merged, sourceFile: primaryFile };
620276
+ }
620026
620277
  function clearMarketplacesCache() {
620027
620278
  getMarketplace.cache?.clear?.();
620028
620279
  }
@@ -620079,9 +620330,13 @@ async function loadKnownMarketplacesConfig() {
620079
620330
  });
620080
620331
  throw new ConfigParseError(errorMsg, configFile, data);
620081
620332
  }
620082
- return parsed.data;
620333
+ const merged = await mergeWithLegacyKnownMarketplaces(parsed.data);
620334
+ return merged;
620083
620335
  } catch (error97) {
620084
620336
  if (isENOENT(error97)) {
620337
+ const legacyResult = await readKnownMarketplacesFromAllDirs();
620338
+ if (legacyResult)
620339
+ return legacyResult.config;
620085
620340
  return {};
620086
620341
  }
620087
620342
  if (error97 instanceof ConfigParseError) {
@@ -620094,6 +620349,35 @@ async function loadKnownMarketplacesConfig() {
620094
620349
  throw new Error(errorMsg);
620095
620350
  }
620096
620351
  }
620352
+ async function mergeWithLegacyKnownMarketplaces(primary) {
620353
+ const dirs = getAllPluginsDirs();
620354
+ const legacyDirs = dirs.slice(1);
620355
+ if (legacyDirs.length === 0)
620356
+ return primary;
620357
+ const fs29 = getFsImplementation();
620358
+ const merged = { ...primary };
620359
+ for (const dir of legacyDirs) {
620360
+ const filePath = join137(dir, "known_marketplaces.json");
620361
+ try {
620362
+ const content = await fs29.readFile(filePath, { encoding: "utf-8" });
620363
+ const data = jsonParse(content);
620364
+ const parsed = KnownMarketplacesFileSchema().safeParse(data);
620365
+ if (parsed.success) {
620366
+ for (const [name3, entry] of Object.entries(parsed.data)) {
620367
+ if (!(name3 in merged)) {
620368
+ merged[name3] = entry;
620369
+ logForDebugging(`Found marketplace '${name3}' in legacy known_marketplaces.json (${filePath})`);
620370
+ }
620371
+ }
620372
+ }
620373
+ } catch (e4) {
620374
+ if (!isENOENT(e4)) {
620375
+ logForDebugging(`Failed to read legacy known_marketplaces.json from ${filePath}: ${errorMessage(e4)}`, { level: "warn" });
620376
+ }
620377
+ }
620378
+ }
620379
+ return merged;
620380
+ }
620097
620381
  async function loadKnownMarketplacesConfigSafe() {
620098
620382
  try {
620099
620383
  return await loadKnownMarketplacesConfig();
@@ -620597,7 +620881,7 @@ Technical details: ${error97.message}`);
620597
620881
  });
620598
620882
  }
620599
620883
  function getCachePathForSource(source) {
620600
- const tempName = source.source === "github" ? source.repo.replace("/", "-") : source.source === "npm" ? source.package.replace("@", "").replace("/", "-") : source.source === "file" ? basename37(source.path).replace(".json", "") : source.source === "directory" ? basename37(source.path) : "temp_" + Date.now();
620884
+ const tempName = source.source === "github" ? source.repo.replace("/", "-") : source.source === "npm" ? source.package.replace("@", "").replace("/", "-") : source.source === "file" ? basename36(source.path).replace(".json", "") : source.source === "directory" ? basename36(source.path) : "temp_" + Date.now();
620601
620885
  return tempName;
620602
620886
  }
620603
620887
  async function parseFileWithSchema(filePath, schema) {
@@ -620920,22 +621204,23 @@ async function readCachedMarketplace(installLocation) {
620920
621204
  }
620921
621205
  async function getMarketplaceCacheOnly(name3) {
620922
621206
  const fs29 = getFsImplementation();
620923
- const configFile = getKnownMarketplacesFile();
620924
- try {
620925
- const content = await fs29.readFile(configFile, { encoding: "utf-8" });
620926
- const config9 = jsonParse(content);
620927
- const entry = config9[name3];
620928
- if (!entry) {
620929
- return null;
620930
- }
620931
- return await readCachedMarketplace(entry.installLocation);
620932
- } catch (error97) {
620933
- if (isENOENT(error97)) {
620934
- return null;
621207
+ const dirs = getAllPluginsDirs();
621208
+ for (const dir of dirs) {
621209
+ const configFile = join137(dir, "known_marketplaces.json");
621210
+ try {
621211
+ const content = await fs29.readFile(configFile, { encoding: "utf-8" });
621212
+ const config9 = jsonParse(content);
621213
+ const entry = config9[name3];
621214
+ if (entry) {
621215
+ return await readCachedMarketplace(entry.installLocation);
621216
+ }
621217
+ } catch (error97) {
621218
+ if (!isENOENT(error97)) {
621219
+ logForDebugging(`Failed to read cached marketplace from ${configFile}: ${errorMessage(error97)}`, { level: "warn" });
621220
+ }
620935
621221
  }
620936
- logForDebugging(`Failed to read cached marketplace ${name3}: ${errorMessage(error97)}`, { level: "warn" });
620937
- return null;
620938
621222
  }
621223
+ return null;
620939
621224
  }
620940
621225
  async function getPluginByIdCacheOnly(pluginId) {
620941
621226
  const { name: pluginName, marketplace: marketplaceName } = parsePluginIdentifier(pluginId);
@@ -620943,29 +621228,35 @@ async function getPluginByIdCacheOnly(pluginId) {
620943
621228
  return null;
620944
621229
  }
620945
621230
  const fs29 = getFsImplementation();
620946
- const configFile = getKnownMarketplacesFile();
620947
- try {
620948
- const content = await fs29.readFile(configFile, { encoding: "utf-8" });
620949
- const config9 = jsonParse(content);
620950
- const marketplaceConfig = config9[marketplaceName];
620951
- if (!marketplaceConfig) {
620952
- return null;
620953
- }
620954
- const marketplace = await getMarketplaceCacheOnly(marketplaceName);
620955
- if (!marketplace) {
620956
- return null;
620957
- }
620958
- const plugin = marketplace.plugins.find((p2) => p2.name === pluginName);
620959
- if (!plugin) {
620960
- return null;
620961
- }
620962
- return {
620963
- entry: plugin,
620964
- marketplaceInstallLocation: marketplaceConfig.installLocation
620965
- };
620966
- } catch {
621231
+ const dirs = getAllPluginsDirs();
621232
+ let marketplaceConfig;
621233
+ for (const dir of dirs) {
621234
+ const configFile = join137(dir, "known_marketplaces.json");
621235
+ try {
621236
+ const content = await fs29.readFile(configFile, { encoding: "utf-8" });
621237
+ const config9 = jsonParse(content);
621238
+ const entry = config9[marketplaceName];
621239
+ if (entry) {
621240
+ marketplaceConfig = entry;
621241
+ break;
621242
+ }
621243
+ } catch {}
621244
+ }
621245
+ if (!marketplaceConfig) {
621246
+ return null;
621247
+ }
621248
+ const marketplace = await getMarketplaceCacheOnly(marketplaceName);
621249
+ if (!marketplace) {
621250
+ return null;
621251
+ }
621252
+ const plugin = marketplace.plugins.find((p2) => p2.name === pluginName);
621253
+ if (!plugin) {
620967
621254
  return null;
620968
621255
  }
621256
+ return {
621257
+ entry: plugin,
621258
+ marketplaceInstallLocation: marketplaceConfig.installLocation
621259
+ };
620969
621260
  }
620970
621261
  async function getPluginById(pluginId) {
620971
621262
  const cached8 = await getPluginByIdCacheOnly(pluginId);
@@ -621305,19 +621596,20 @@ function cleanupLegacyCache(v2Data) {
621305
621596
  }
621306
621597
  function readInstalledPluginsFileRaw() {
621307
621598
  const fs29 = getFsImplementation();
621308
- const filePath = getInstalledPluginsFilePath();
621309
- let fileContent;
621310
- try {
621311
- fileContent = fs29.readFileSync(filePath, { encoding: "utf-8" });
621312
- } catch (e4) {
621313
- if (isENOENT(e4)) {
621314
- return null;
621599
+ const dirs = getAllPluginsDirs();
621600
+ for (const dir of dirs) {
621601
+ const filePath = join138(dir, "installed_plugins.json");
621602
+ try {
621603
+ const fileContent = fs29.readFileSync(filePath, { encoding: "utf-8" });
621604
+ const data = jsonParse(fileContent);
621605
+ const version6 = typeof data?.version === "number" ? data.version : 1;
621606
+ return { version: version6, data };
621607
+ } catch (e4) {
621608
+ if (!isENOENT(e4))
621609
+ throw e4;
621315
621610
  }
621316
- throw e4;
621317
621611
  }
621318
- const data = jsonParse(fileContent);
621319
- const version6 = typeof data?.version === "number" ? data.version : 1;
621320
- return { version: version6, data };
621612
+ return null;
621321
621613
  }
621322
621614
  function migrateV1ToV2(v1Data) {
621323
621615
  const v2Plugins = {};
@@ -621340,14 +621632,13 @@ function loadInstalledPluginsV2() {
621340
621632
  if (installedPluginsCacheV2 !== null) {
621341
621633
  return installedPluginsCacheV2;
621342
621634
  }
621343
- const filePath = getInstalledPluginsFilePath();
621344
621635
  try {
621345
621636
  const rawData = readInstalledPluginsFileRaw();
621346
621637
  if (rawData) {
621347
621638
  if (rawData.version === 2) {
621348
621639
  const validated = InstalledPluginsFileSchemaV2().parse(rawData.data);
621349
621640
  installedPluginsCacheV2 = validated;
621350
- logForDebugging(`Loaded ${Object.keys(validated.plugins).length} installed plugins from ${filePath}`);
621641
+ logForDebugging(`Loaded ${Object.keys(validated.plugins).length} installed plugins (v2)`);
621351
621642
  return validated;
621352
621643
  }
621353
621644
  const v1Validated = InstalledPluginsFileSchemaV1().parse(rawData.data);
@@ -622037,7 +622328,7 @@ import {
622037
622328
  stat as stat37,
622038
622329
  symlink as symlink3
622039
622330
  } from "fs/promises";
622040
- import { basename as basename38, dirname as dirname63, join as join140, relative as relative24, resolve as resolve46, sep as sep30 } from "path";
622331
+ import { basename as basename37, dirname as dirname63, join as join140, relative as relative24, resolve as resolve46, sep as sep30 } from "path";
622041
622332
  function getPluginCachePath() {
622042
622333
  return join140(getPluginsDirectory(), "cache");
622043
622334
  }
@@ -623400,7 +623691,7 @@ async function loadSessionOnlyPlugins(sessionPluginPaths) {
623400
623691
  });
623401
623692
  continue;
623402
623693
  }
623403
- const dirName = basename38(resolvedPath);
623694
+ const dirName = basename37(resolvedPath);
623404
623695
  const { plugin, errors: pluginErrors } = await createPluginFromPath(resolvedPath, `${dirName}@inline`, true, dirName);
623405
623696
  plugin.source = `${plugin.name}@inline`;
623406
623697
  plugin.repository = `${plugin.name}@inline`;
@@ -623572,7 +623863,7 @@ var init_pluginLoader = __esm(() => {
623572
623863
  });
623573
623864
 
623574
623865
  // src/utils/plugins/loadPluginOutputStyles.ts
623575
- import { basename as basename39 } from "path";
623866
+ import { basename as basename38 } from "path";
623576
623867
  async function loadOutputStylesFromDirectory(outputStylesPath, pluginName, loadedPaths) {
623577
623868
  const styles5 = [];
623578
623869
  await walkPluginMarkdown(outputStylesPath, async (fullPath) => {
@@ -623590,7 +623881,7 @@ async function loadOutputStyleFromFile(filePath, pluginName, loadedPaths) {
623590
623881
  try {
623591
623882
  const content = await fs29.readFile(filePath, { encoding: "utf-8" });
623592
623883
  const { frontmatter, content: markdownContent } = parseFrontmatter(content, filePath);
623593
- const fileName = basename39(filePath, ".md");
623884
+ const fileName = basename38(filePath, ".md");
623594
623885
  const baseStyleName = frontmatter.name || fileName;
623595
623886
  const name3 = `${pluginName}:${baseStyleName}`;
623596
623887
  const description = coerceDescriptionToString(frontmatter.description, name3) ?? extractDescriptionFromMarkdown(markdownContent, `Output style from ${pluginName} plugin`);
@@ -623671,7 +623962,7 @@ var init_loadPluginOutputStyles = __esm(() => {
623671
623962
  });
623672
623963
 
623673
623964
  // src/outputStyles/loadOutputStylesDir.ts
623674
- import { basename as basename40 } from "path";
623965
+ import { basename as basename39 } from "path";
623675
623966
  var getOutputStyleDirStyles;
623676
623967
  var init_loadOutputStylesDir = __esm(() => {
623677
623968
  init_memoize();
@@ -623685,7 +623976,7 @@ var init_loadOutputStylesDir = __esm(() => {
623685
623976
  const markdownFiles = await loadMarkdownFilesForSubdir("output-styles", cwd2);
623686
623977
  const styles5 = markdownFiles.map(({ filePath, frontmatter, content, source }) => {
623687
623978
  try {
623688
- const fileName = basename40(filePath);
623979
+ const fileName = basename39(filePath);
623689
623980
  const styleName = fileName.replace(/\.md$/, "");
623690
623981
  const name3 = frontmatter["name"] || styleName;
623691
623982
  const description = coerceDescriptionToString(frontmatter["description"], styleName) ?? extractDescriptionFromMarkdown(content, `Custom ${styleName} output style`);
@@ -631971,6 +632262,16 @@ import { join as join145 } from "path";
631971
632262
  function getPasteStoreDir() {
631972
632263
  return join145(getClaudeConfigHomeDir(), PASTE_STORE_DIR);
631973
632264
  }
632265
+ function getPasteStoreDirs() {
632266
+ const primary = getPasteStoreDir();
632267
+ const legacyHome = getLegacyConfigHomeDir();
632268
+ if (!legacyHome)
632269
+ return [primary];
632270
+ const legacy = join145(legacyHome, PASTE_STORE_DIR);
632271
+ if (primary === legacy)
632272
+ return [primary];
632273
+ return [primary, legacy];
632274
+ }
631974
632275
  function hashPastedText(content) {
631975
632276
  return createHash31("sha256").update(content).digest("hex").slice(0, 16);
631976
632277
  }
@@ -631989,15 +632290,18 @@ async function storePastedText(hash4, content) {
631989
632290
  }
631990
632291
  }
631991
632292
  async function retrievePastedText(hash4) {
631992
- try {
631993
- const pastePath = getPastePath(hash4);
631994
- return await readFile55(pastePath, { encoding: "utf8" });
631995
- } catch (error97) {
631996
- if (!isENOENT(error97)) {
631997
- logForDebugging(`Failed to retrieve paste ${hash4}: ${error97}`);
632293
+ const dirs = getPasteStoreDirs();
632294
+ for (const dir of dirs) {
632295
+ try {
632296
+ const pastePath = join145(dir, `${hash4}.txt`);
632297
+ return await readFile55(pastePath, { encoding: "utf8" });
632298
+ } catch (error97) {
632299
+ if (!isENOENT(error97)) {
632300
+ logForDebugging(`Failed to retrieve paste ${hash4}: ${error97}`);
632301
+ }
631998
632302
  }
631999
- return null;
632000
632303
  }
632304
+ return null;
632001
632305
  }
632002
632306
  async function cleanupOldPastes(cutoffDate) {
632003
632307
  const pasteDir = getPasteStoreDir();
@@ -632074,8 +632378,8 @@ async function* makeLogEntryReader() {
632074
632378
  yield pendingEntries[i6];
632075
632379
  }
632076
632380
  const historyPath = join146(getClaudeConfigHomeDir(), "history.jsonl");
632077
- try {
632078
- for await (const line of readLinesReverse(historyPath)) {
632381
+ async function* readHistoryLines(filePath) {
632382
+ for await (const line of readLinesReverse(filePath)) {
632079
632383
  try {
632080
632384
  const entry = deserializeLogEntry(line);
632081
632385
  if (entry.sessionId === currentSession && skippedTimestamps.has(entry.timestamp)) {
@@ -632086,9 +632390,31 @@ async function* makeLogEntryReader() {
632086
632390
  logForDebugging(`Failed to parse history line: ${error97}`);
632087
632391
  }
632088
632392
  }
632393
+ }
632394
+ try {
632395
+ for await (const entry of readHistoryLines(historyPath)) {
632396
+ yield entry;
632397
+ }
632089
632398
  } catch (e4) {
632090
632399
  const code = getErrnoCode(e4);
632091
632400
  if (code === "ENOENT") {
632401
+ const legacyHome = getLegacyConfigHomeDir();
632402
+ if (legacyHome) {
632403
+ const legacyPath = join146(legacyHome, "history.jsonl");
632404
+ if (legacyPath !== historyPath) {
632405
+ try {
632406
+ for await (const entry of readHistoryLines(legacyPath)) {
632407
+ yield entry;
632408
+ }
632409
+ } catch (e22) {
632410
+ const code2 = getErrnoCode(e22);
632411
+ if (code2 === "ENOENT")
632412
+ return;
632413
+ throw e22;
632414
+ }
632415
+ return;
632416
+ }
632417
+ }
632092
632418
  return;
632093
632419
  }
632094
632420
  throw e4;
@@ -633870,7 +634196,7 @@ var init_renderPlaceholder = __esm(() => {
633870
634196
  });
633871
634197
 
633872
634198
  // src/hooks/usePasteHandler.ts
633873
- import { basename as basename41 } from "path";
634199
+ import { basename as basename40 } from "path";
633874
634200
  function usePasteHandler({
633875
634201
  onPaste,
633876
634202
  onInput,
@@ -633921,7 +634247,7 @@ function usePasteHandler({
633921
634247
  const validImages = results.filter((r4) => r4 !== null);
633922
634248
  if (validImages.length > 0) {
633923
634249
  for (const imageData of validImages) {
633924
- const filename = basename41(imageData.path);
634250
+ const filename = basename40(imageData.path);
633925
634251
  onImagePaste2(imageData.base64, imageData.mediaType, filename, imageData.dimensions, imageData.path);
633926
634252
  }
633927
634253
  const nonImageLines = lines2.filter((line) => !isImageFilePath(line));
@@ -634388,7 +634714,7 @@ var init_TextInput = __esm(() => {
634388
634714
  });
634389
634715
 
634390
634716
  // src/utils/suggestions/directoryCompletion.ts
634391
- import { basename as basename42, dirname as dirname66, join as join147, sep as sep31 } from "path";
634717
+ import { basename as basename41, dirname as dirname66, join as join147, sep as sep31 } from "path";
634392
634718
  function parsePartialPath(partialPath, basePath) {
634393
634719
  if (!partialPath) {
634394
634720
  const directory2 = basePath || getCwd();
@@ -634399,7 +634725,7 @@ function parsePartialPath(partialPath, basePath) {
634399
634725
  return { directory: resolved, prefix: "" };
634400
634726
  }
634401
634727
  const directory = dirname66(resolved);
634402
- const prefix = basename42(partialPath);
634728
+ const prefix = basename41(partialPath);
634403
634729
  return { directory, prefix };
634404
634730
  }
634405
634731
  async function scanDirectory(dirPath) {
@@ -635179,7 +635505,7 @@ function parseAutofixArgs(raw) {
635179
635505
  }
635180
635506
 
635181
635507
  // src/commands/autofix-pr/skillDetect.ts
635182
- import { existsSync as existsSync25 } from "fs";
635508
+ import { existsSync as existsSync26 } from "fs";
635183
635509
  import { join as join148 } from "path";
635184
635510
  function detectAutofixSkills(cwd2) {
635185
635511
  const candidates = [
@@ -635187,7 +635513,7 @@ function detectAutofixSkills(cwd2) {
635187
635513
  ".claude/skills/autofix.md",
635188
635514
  ".claude/skills/autofix-pr/SKILL.md"
635189
635515
  ];
635190
- return candidates.filter((rel) => existsSync25(join148(cwd2, rel)));
635516
+ return candidates.filter((rel) => existsSync26(join148(cwd2, rel)));
635191
635517
  }
635192
635518
  function formatSkillsHint(skills) {
635193
635519
  if (skills.length === 0)
@@ -635711,7 +636037,7 @@ var init_btw2 = __esm(() => {
635711
636037
 
635712
636038
  // src/commands/issue/index.ts
635713
636039
  import {
635714
- existsSync as existsSync26,
636040
+ existsSync as existsSync27,
635715
636041
  mkdirSync as mkdirSync10,
635716
636042
  readdirSync as readdirSync7,
635717
636043
  readFileSync as readFileSync30,
@@ -635773,7 +636099,7 @@ async function repoHasIssuesEnabled(owner, repo) {
635773
636099
  }
635774
636100
  function detectIssueTemplate(cwd2) {
635775
636101
  const templateDir = join149(cwd2, ".github", "ISSUE_TEMPLATE");
635776
- if (!existsSync26(templateDir))
636102
+ if (!existsSync27(templateDir))
635777
636103
  return null;
635778
636104
  try {
635779
636105
  const files2 = readdirSync7(templateDir).filter((f4) => f4.endsWith(".md") || f4.endsWith(".yml") || f4.endsWith(".yaml"));
@@ -635794,7 +636120,7 @@ function getTranscriptSummary(maxTurns = 5) {
635794
636120
  const sessionId = getSessionId();
635795
636121
  const projectDir = getSessionProjectDir();
635796
636122
  const logPath = projectDir ? join149(projectDir, `${sessionId}.jsonl`) : join149(getClaudeConfigHomeDir(), "projects", sanitizePath2(getOriginalCwd()), `${sessionId}.jsonl`);
635797
- if (!existsSync26(logPath))
636123
+ if (!existsSync27(logPath))
635798
636124
  return "(no session log found)";
635799
636125
  const lines2 = readFileSync30(logPath, "utf8").trim().split(`
635800
636126
  `).filter(Boolean);
@@ -636176,7 +636502,7 @@ function Feedback({
636176
636502
  platform: env4.platform,
636177
636503
  gitRepo: envInfo.isGit,
636178
636504
  terminal: env4.terminal,
636179
- version: "4.1.12",
636505
+ version: "4.2.0",
636180
636506
  transcript: normalizeMessagesForAPI(messages),
636181
636507
  errors: sanitizedErrors,
636182
636508
  lastApiRequest: getLastAPIRequest(),
@@ -636361,7 +636687,7 @@ function Feedback({
636361
636687
  ", ",
636362
636688
  env4.terminal,
636363
636689
  ", v",
636364
- "4.1.12"
636690
+ "4.2.0"
636365
636691
  ]
636366
636692
  })
636367
636693
  ]
@@ -636467,7 +636793,7 @@ ${sanitizedDescription}
636467
636793
  ` + `**Environment Info**
636468
636794
  ` + `- Platform: ${env4.platform}
636469
636795
  ` + `- Terminal: ${env4.terminal}
636470
- ` + `- Version: ${"4.1.12"}
636796
+ ` + `- Version: ${"4.2.0"}
636471
636797
  ` + `- Feedback ID: ${feedbackId}
636472
636798
  ` + `
636473
636799
  **Errors**
@@ -638668,7 +638994,7 @@ function buildPrimarySection() {
638668
638994
  children: "/rename to add a name"
638669
638995
  });
638670
638996
  return [
638671
- { label: "Version", value: "4.1.12" },
638997
+ { label: "Version", value: "4.2.0" },
638672
638998
  { label: "Session name", value: nameValue },
638673
638999
  { label: "Session ID", value: sessionId },
638674
639000
  { label: "cwd", value: getCwd() },
@@ -641472,7 +641798,7 @@ function Config({
641472
641798
  }
641473
641799
  })
641474
641800
  }) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime191.jsx(ChannelDowngradeDialog, {
641475
- currentVersion: "4.1.12",
641801
+ currentVersion: "4.2.0",
641476
641802
  onChoice: (choice) => {
641477
641803
  setShowSubmenu(null);
641478
641804
  setTabsHidden(false);
@@ -641484,7 +641810,7 @@ function Config({
641484
641810
  autoUpdatesChannel: "stable"
641485
641811
  };
641486
641812
  if (choice === "stay") {
641487
- newSettings.minimumVersion = "4.1.12";
641813
+ newSettings.minimumVersion = "4.2.0";
641488
641814
  }
641489
641815
  updateSettingsForSource("userSettings", newSettings);
641490
641816
  setSettingsData((prev) => ({
@@ -645921,31 +646247,42 @@ var init_versions5 = __esm(() => {
645921
646247
 
645922
646248
  // src/components/memory/MemoryFileSelector.tsx
645923
646249
  import { mkdir as mkdir46 } from "fs/promises";
645924
- import { join as join154 } from "path";
646250
+ import { basename as basename42, join as join154 } from "path";
645925
646251
  function MemoryFileSelector({ onSelect, onCancel }) {
645926
646252
  const existingMemoryFiles = import_react133.use(getMemoryFiles());
645927
- const userMemoryPath = join154(getClaudeConfigHomeDir(), "CLAUDE.md");
645928
- const projectMemoryPath = join154(getOriginalCwd(), "CLAUDE.md");
645929
- const hasUserMemory = existingMemoryFiles.some((f4) => f4.path === userMemoryPath);
645930
- const hasProjectMemory = existingMemoryFiles.some((f4) => f4.path === projectMemoryPath);
646253
+ const userMemoryPath = join154(getClaudeConfigHomeDir(), PRIMARY_INSTRUCTION_FILE);
646254
+ const legacyConfigHome = getLegacyConfigHomeDir();
646255
+ const legacyUserMemoryPath = legacyConfigHome ? join154(legacyConfigHome, LEGACY_INSTRUCTION_FILE) : null;
646256
+ const hasPrimaryUserMemory = existingMemoryFiles.some((f4) => f4.path === userMemoryPath);
646257
+ const hasLegacyUserMemory = existingMemoryFiles.some((f4) => legacyUserMemoryPath !== null && f4.path === legacyUserMemoryPath);
646258
+ const resolvedUserMemoryPath = hasPrimaryUserMemory ? userMemoryPath : hasLegacyUserMemory && legacyUserMemoryPath ? legacyUserMemoryPath : userMemoryPath;
646259
+ const projectMemoryPath = join154(getOriginalCwd(), PRIMARY_INSTRUCTION_FILE);
646260
+ const legacyProjectMemoryPath = join154(getOriginalCwd(), LEGACY_INSTRUCTION_FILE);
646261
+ const hasPrimaryProjectMemory = existingMemoryFiles.some((f4) => f4.path === projectMemoryPath);
646262
+ const hasLegacyProjectMemory = existingMemoryFiles.some((f4) => f4.path === legacyProjectMemoryPath);
646263
+ const resolvedProjectMemoryPath = hasPrimaryProjectMemory ? projectMemoryPath : hasLegacyProjectMemory ? legacyProjectMemoryPath : projectMemoryPath;
645931
646264
  const allMemoryFiles = [
645932
- ...existingMemoryFiles.filter((f4) => f4.type !== "AutoMem" && f4.type !== "TeamMem").map((f4) => ({ ...f4, exists: true })),
645933
- ...hasUserMemory ? [] : [
645934
- {
645935
- path: userMemoryPath,
645936
- type: "User",
645937
- content: "",
645938
- exists: false
645939
- }
645940
- ],
645941
- ...hasProjectMemory ? [] : [
645942
- {
645943
- path: projectMemoryPath,
645944
- type: "Project",
645945
- content: "",
645946
- exists: false
645947
- }
645948
- ]
646265
+ ...existingMemoryFiles.filter((f4) => {
646266
+ if (f4.type === "AutoMem" || f4.type === "TeamMem")
646267
+ return false;
646268
+ if (f4.type === "User" && (f4.path === userMemoryPath || legacyUserMemoryPath !== null && f4.path === legacyUserMemoryPath))
646269
+ return false;
646270
+ if (f4.type === "Project" && (f4.path === projectMemoryPath || f4.path === legacyProjectMemoryPath))
646271
+ return false;
646272
+ return true;
646273
+ }).map((f4) => ({ ...f4, exists: true })),
646274
+ {
646275
+ path: resolvedUserMemoryPath,
646276
+ type: "User",
646277
+ content: "",
646278
+ exists: hasPrimaryUserMemory || hasLegacyUserMemory
646279
+ },
646280
+ {
646281
+ path: resolvedProjectMemoryPath,
646282
+ type: "Project",
646283
+ content: "",
646284
+ exists: hasPrimaryProjectMemory || hasLegacyProjectMemory
646285
+ }
645949
646286
  ];
645950
646287
  const depths = new Map;
645951
646288
  const memoryOptions = allMemoryFiles.map((file3) => {
@@ -645955,9 +646292,9 @@ function MemoryFileSelector({ onSelect, onCancel }) {
645955
646292
  depths.set(file3.path, depth);
645956
646293
  const indent = depth > 0 ? " ".repeat(depth - 1) : "";
645957
646294
  let label;
645958
- if (file3.type === "User" && !file3.isNested && file3.path === userMemoryPath) {
646295
+ if (file3.type === "User" && !file3.isNested && file3.path === resolvedUserMemoryPath) {
645959
646296
  label = `User memory`;
645960
- } else if (file3.type === "Project" && !file3.isNested && file3.path === projectMemoryPath) {
646297
+ } else if (file3.type === "Project" && !file3.isNested && file3.path === resolvedProjectMemoryPath) {
645961
646298
  label = `Project memory`;
645962
646299
  } else if (depth > 0) {
645963
646300
  label = `${indent}L ${displayPath}${existsLabel}`;
@@ -645967,9 +646304,9 @@ function MemoryFileSelector({ onSelect, onCancel }) {
645967
646304
  let description;
645968
646305
  const isGit = projectIsInGitRepo(getOriginalCwd());
645969
646306
  if (file3.type === "User" && !file3.isNested) {
645970
- description = "Saved in ~/.costrict/AGENTS.md";
645971
- } else if (file3.type === "Project" && !file3.isNested && file3.path === projectMemoryPath) {
645972
- description = `${isGit ? "Checked in at" : "Saved in"} ./CLAUDE.md`;
646307
+ description = `Saved in ~/${basename42(resolvedUserMemoryPath)}`;
646308
+ } else if (file3.type === "Project" && !file3.isNested && file3.path === resolvedProjectMemoryPath) {
646309
+ description = `${isGit ? "Checked in at" : "Saved in"} ./${basename42(resolvedProjectMemoryPath)}`;
645973
646310
  } else if (file3.parent) {
645974
646311
  description = "@-imported";
645975
646312
  } else if (file3.isNested) {
@@ -646119,6 +646456,7 @@ var init_MemoryFileSelector = __esm(() => {
646119
646456
  init_AppState();
646120
646457
  init_agentMemory();
646121
646458
  init_browser2();
646459
+ init_branding();
646122
646460
  init_costrictmd();
646123
646461
  init_envUtils();
646124
646462
  init_file();
@@ -646922,7 +647260,7 @@ function HelpV2({ onClose, commands: commands7 }) {
646922
647260
  color: "professionalBlue",
646923
647261
  children: [
646924
647262
  /* @__PURE__ */ jsx_runtime218.jsx(Tabs, {
646925
- title: process.env.USER_TYPE === "sf" ? "/help" : `CoStrict v${"4.1.12"}`,
647263
+ title: process.env.USER_TYPE === "sf" ? "/help" : `CoStrict v${"4.2.0"}`,
646926
647264
  color: "professionalBlue",
646927
647265
  defaultTab: "general",
646928
647266
  children: tabs
@@ -725920,7 +726258,7 @@ var init_panel = __esm(() => {
725920
726258
  // src/commands/break-cache/index.ts
725921
726259
  import {
725922
726260
  appendFileSync as appendFileSync4,
725923
- existsSync as existsSync27,
726261
+ existsSync as existsSync28,
725924
726262
  mkdirSync as mkdirSync11,
725925
726263
  readFileSync as readFileSync31,
725926
726264
  unlinkSync as unlinkSync8,
@@ -725976,8 +726314,8 @@ async function callBreakCache(args) {
725976
726314
  const alwaysPath = getBreakCacheAlwaysPath();
725977
726315
  if (scope === "status") {
725978
726316
  const stats = readStats();
725979
- const onceActive = existsSync27(markerPath);
725980
- const alwaysActive = existsSync27(alwaysPath);
726317
+ const onceActive = existsSync28(markerPath);
726318
+ const alwaysActive = existsSync28(alwaysPath);
725981
726319
  return {
725982
726320
  type: "text",
725983
726321
  value: [
@@ -725995,11 +726333,11 @@ async function callBreakCache(args) {
725995
726333
  }
725996
726334
  if (scope === "off") {
725997
726335
  let cleared = false;
725998
- if (existsSync27(markerPath)) {
726336
+ if (existsSync28(markerPath)) {
725999
726337
  unlinkSync8(markerPath);
726000
726338
  cleared = true;
726001
726339
  }
726002
- if (existsSync27(alwaysPath)) {
726340
+ if (existsSync28(alwaysPath)) {
726003
726341
  unlinkSync8(alwaysPath);
726004
726342
  cleared = true;
726005
726343
  }
@@ -726010,7 +726348,7 @@ async function callBreakCache(args) {
726010
726348
  };
726011
726349
  }
726012
726350
  if (scope === "--clear") {
726013
- if (existsSync27(markerPath)) {
726351
+ if (existsSync28(markerPath)) {
726014
726352
  unlinkSync8(markerPath);
726015
726353
  return {
726016
726354
  type: "text",
@@ -738502,7 +738840,7 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
738502
738840
  return [];
738503
738841
  }
738504
738842
  }
738505
- async function checkForReleaseNotes(lastSeenVersion, currentVersion = "4.1.12") {
738843
+ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "4.2.0") {
738506
738844
  if (process.env.USER_TYPE === "sf") {
738507
738845
  const changelog = "";
738508
738846
  if (changelog) {
@@ -738529,7 +738867,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "4.1.12")
738529
738867
  releaseNotes
738530
738868
  };
738531
738869
  }
738532
- function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "4.1.12") {
738870
+ function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "4.2.0") {
738533
738871
  if (process.env.USER_TYPE === "sf") {
738534
738872
  const changelog = "";
738535
738873
  if (changelog) {
@@ -741286,7 +741624,7 @@ function isNotLoggedIn() {
741286
741624
  return true;
741287
741625
  }
741288
741626
  function getLogoDisplayData() {
741289
- const version6 = process.env.DEMO_VERSION ?? "4.1.12";
741627
+ const version6 = process.env.DEMO_VERSION ?? "4.2.0";
741290
741628
  const serverUrl = getDirectConnectServerUrl();
741291
741629
  const displayPath = process.env.DEMO_VERSION ? "/code/claude" : getDisplayPath(getCwd());
741292
741630
  const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
@@ -741809,7 +742147,7 @@ var cachedSystemTheme2;
741809
742147
  // src/components/matrix-tactical/MatrixWelcome.tsx
741810
742148
  import { basename as basename47 } from "path";
741811
742149
  function MatrixWelcome({
741812
- version: version6 = "4.1.12",
742150
+ version: version6 = "4.2.0",
741813
742151
  projectName,
741814
742152
  cwd: cwd2,
741815
742153
  modelDisplayName,
@@ -742442,13 +742780,13 @@ function LogoV2() {
742442
742780
  const { hasReleaseNotes } = checkForReleaseNotesSync(config10.lastReleaseNotesSeen);
742443
742781
  import_react166.useEffect(() => {
742444
742782
  const currentConfig = getGlobalConfig();
742445
- if (currentConfig.lastReleaseNotesSeen === "4.1.12") {
742783
+ if (currentConfig.lastReleaseNotesSeen === "4.2.0") {
742446
742784
  return;
742447
742785
  }
742448
742786
  saveGlobalConfig((current2) => {
742449
- if (current2.lastReleaseNotesSeen === "4.1.12")
742787
+ if (current2.lastReleaseNotesSeen === "4.2.0")
742450
742788
  return current2;
742451
- return { ...current2, lastReleaseNotesSeen: "4.1.12" };
742789
+ return { ...current2, lastReleaseNotesSeen: "4.2.0" };
742452
742790
  });
742453
742791
  if (showOnboarding) {
742454
742792
  incrementProjectOnboardingSeenCount();
@@ -751968,7 +752306,7 @@ var init_session4 = __esm(() => {
751968
752306
 
751969
752307
  // src/commands/share/index.ts
751970
752308
  import {
751971
- existsSync as existsSync28,
752309
+ existsSync as existsSync29,
751972
752310
  mkdtempSync as mkdtempSync2,
751973
752311
  readFileSync as readFileSync32,
751974
752312
  rmSync as rmSync6,
@@ -752161,7 +752499,7 @@ var init_share = __esm(() => {
752161
752499
  mask_secrets: String(opts.maskSecrets),
752162
752500
  summary_only: String(opts.summaryOnly)
752163
752501
  });
752164
- if (!existsSync28(logPath)) {
752502
+ if (!existsSync29(logPath)) {
752165
752503
  logEvent("tengu_share_failed", {
752166
752504
  reason: "log_not_found"
752167
752505
  });
@@ -764013,7 +764351,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
764013
764351
  smapsRollup,
764014
764352
  platform: process.platform,
764015
764353
  nodeVersion: process.version,
764016
- ccVersion: "4.1.12"
764354
+ ccVersion: "4.2.0"
764017
764355
  };
764018
764356
  }
764019
764357
  async function performHeapDump(trigger = "manual", dumpNumber = 0) {
@@ -764128,7 +764466,7 @@ var init_mock_limits = __esm(() => {
764128
764466
  var call53 = async () => {
764129
764467
  return {
764130
764468
  type: "text",
764131
- value: `${"4.1.12"} (built ${"2026-06-08T13:08:39.119Z"})`
764469
+ value: `${"4.2.0"} (built ${"2026-06-09T13:06:56.679Z"})`
764132
764470
  };
764133
764471
  }, version6, version_default;
764134
764472
  var init_version2 = __esm(() => {
@@ -765258,7 +765596,7 @@ var init_reset_limits = __esm(() => {
765258
765596
  });
765259
765597
 
765260
765598
  // src/commands/perf-issue/index.ts
765261
- import { existsSync as existsSync29, mkdirSync as mkdirSync12, readFileSync as readFileSync34, writeFileSync as writeFileSync19 } from "fs";
765599
+ import { existsSync as existsSync30, mkdirSync as mkdirSync12, readFileSync as readFileSync34, writeFileSync as writeFileSync19 } from "fs";
765262
765600
  import { join as join170 } from "path";
765263
765601
  import { homedir as homedir42 } from "os";
765264
765602
  function lookupCostRates(model) {
@@ -765580,7 +765918,7 @@ var init_perf_issue = __esm(() => {
765580
765918
  const ext = format6 === "json" ? "json" : format6 === "csv" ? "csv" : "md";
765581
765919
  const reportPath = join170(dir, `perf-${stamp}-${sessionId.slice(0, 8)}.${ext}`);
765582
765920
  const logPath = getTranscriptPath3();
765583
- const hasLog = existsSync29(logPath);
765921
+ const hasLog = existsSync30(logPath);
765584
765922
  let analyzed = null;
765585
765923
  if (hasLog) {
765586
765924
  try {
@@ -767422,28 +767760,40 @@ import { randomUUID as randomUUID45 } from "crypto";
767422
767760
  function getSessionsDir3() {
767423
767761
  return join174(getClaudeConfigHomeDir(), "sessions");
767424
767762
  }
767763
+ function getAllSessionsDirs3() {
767764
+ const primary = getSessionsDir3();
767765
+ const legacyHome = getLegacyConfigHomeDir();
767766
+ if (!legacyHome)
767767
+ return [primary];
767768
+ const legacy = join174(legacyHome, "sessions");
767769
+ if (primary === legacy)
767770
+ return [primary];
767771
+ return [primary, legacy];
767772
+ }
767425
767773
  async function listLiveSessions() {
767426
- const dir = getSessionsDir3();
767427
- let files3;
767428
- try {
767429
- files3 = await readdir32(dir);
767430
- } catch {
767431
- return [];
767432
- }
767774
+ const dirs = getAllSessionsDirs3();
767433
767775
  const sessions = [];
767434
- for (const file3 of files3) {
767435
- if (!/^\d+\.json$/.test(file3))
767436
- continue;
767437
- const pid = parseInt(file3.slice(0, -5), 10);
767438
- if (!isProcessRunning(pid)) {
767439
- unlink23(join174(dir, file3)).catch(() => {});
767776
+ for (const dir of dirs) {
767777
+ let files3;
767778
+ try {
767779
+ files3 = await readdir32(dir);
767780
+ } catch {
767440
767781
  continue;
767441
767782
  }
767442
- try {
767443
- const raw = await readFile67(join174(dir, file3), "utf-8");
767444
- const entry = jsonParse(raw);
767445
- sessions.push(entry);
767446
- } catch {}
767783
+ for (const file3 of files3) {
767784
+ if (!/^\d+\.json$/.test(file3))
767785
+ continue;
767786
+ const pid = parseInt(file3.slice(0, -5), 10);
767787
+ if (!isProcessRunning(pid)) {
767788
+ unlink23(join174(dir, file3)).catch(() => {});
767789
+ continue;
767790
+ }
767791
+ try {
767792
+ const raw = await readFile67(join174(dir, file3), "utf-8");
767793
+ const entry = jsonParse(raw);
767794
+ sessions.push(entry);
767795
+ } catch {}
767796
+ }
767447
767797
  }
767448
767798
  return sessions;
767449
767799
  }
@@ -770454,8 +770804,8 @@ var init_tag2 = __esm(() => {
770454
770804
  import { createRequire as createRequire4 } from "module";
770455
770805
  function getVersion2() {
770456
770806
  try {
770457
- if (typeof MACRO !== "undefined" && "4.1.12")
770458
- return "4.1.12";
770807
+ if (typeof MACRO !== "undefined" && "4.2.0")
770808
+ return "4.2.0";
770459
770809
  } catch {}
770460
770810
  try {
770461
770811
  const require3 = createRequire4(import.meta.url);
@@ -772757,6 +773107,16 @@ async function withStatsCacheLock(fn) {
772757
773107
  function getStatsCachePath() {
772758
773108
  return join182(getClaudeConfigHomeDir(), STATS_CACHE_FILENAME);
772759
773109
  }
773110
+ function getStatsCachePaths() {
773111
+ const primary = getStatsCachePath();
773112
+ const legacyHome = getLegacyConfigHomeDir();
773113
+ if (!legacyHome)
773114
+ return [primary];
773115
+ const legacy = join182(legacyHome, STATS_CACHE_FILENAME);
773116
+ if (primary === legacy)
773117
+ return [primary];
773118
+ return [primary, legacy];
773119
+ }
772760
773120
  function getEmptyCache() {
772761
773121
  return {
772762
773122
  version: STATS_CACHE_VERSION,
@@ -772797,37 +773157,43 @@ function migrateStatsCache(parsed) {
772797
773157
  }
772798
773158
  async function loadStatsCache() {
772799
773159
  const fs30 = getFsImplementation();
772800
- const cachePath = getStatsCachePath();
772801
- try {
772802
- const content = await fs30.readFile(cachePath, { encoding: "utf-8" });
772803
- const parsed = jsonParse(content);
772804
- if (parsed.version !== STATS_CACHE_VERSION) {
772805
- const migrated = migrateStatsCache(parsed);
772806
- if (!migrated) {
772807
- logForDebugging(`Stats cache version ${parsed.version} not migratable (expected ${STATS_CACHE_VERSION}), returning empty cache`);
773160
+ const cachePaths = getStatsCachePaths();
773161
+ for (const cachePath of cachePaths) {
773162
+ try {
773163
+ const content = await fs30.readFile(cachePath, { encoding: "utf-8" });
773164
+ const parsed = jsonParse(content);
773165
+ if (parsed.version !== STATS_CACHE_VERSION) {
773166
+ const migrated = migrateStatsCache(parsed);
773167
+ if (!migrated) {
773168
+ logForDebugging(`Stats cache version ${parsed.version} not migratable (expected ${STATS_CACHE_VERSION}), returning empty cache`);
773169
+ return getEmptyCache();
773170
+ }
773171
+ logForDebugging(`Migrated stats cache from v${parsed.version} to v${STATS_CACHE_VERSION}`);
773172
+ await saveStatsCache(migrated);
773173
+ if (!migrated.shotDistribution) {
773174
+ logForDebugging("Migrated stats cache missing shotDistribution, forcing recomputation");
773175
+ return getEmptyCache();
773176
+ }
773177
+ return migrated;
773178
+ }
773179
+ if (!Array.isArray(parsed.dailyActivity) || !Array.isArray(parsed.dailyModelTokens) || typeof parsed.totalSessions !== "number" || typeof parsed.totalMessages !== "number") {
773180
+ logForDebugging(`Stats cache has invalid structure in ${cachePath}, returning empty cache`);
772808
773181
  return getEmptyCache();
772809
773182
  }
772810
- logForDebugging(`Migrated stats cache from v${parsed.version} to v${STATS_CACHE_VERSION}`);
772811
- await saveStatsCache(migrated);
772812
- if (!migrated.shotDistribution) {
772813
- logForDebugging("Migrated stats cache missing shotDistribution, forcing recomputation");
773183
+ if (!parsed.shotDistribution) {
773184
+ logForDebugging("Stats cache missing shotDistribution, forcing recomputation");
772814
773185
  return getEmptyCache();
772815
773186
  }
772816
- return migrated;
772817
- }
772818
- if (!Array.isArray(parsed.dailyActivity) || !Array.isArray(parsed.dailyModelTokens) || typeof parsed.totalSessions !== "number" || typeof parsed.totalMessages !== "number") {
772819
- logForDebugging("Stats cache has invalid structure, returning empty cache");
772820
- return getEmptyCache();
772821
- }
772822
- if (!parsed.shotDistribution) {
772823
- logForDebugging("Stats cache missing shotDistribution, forcing recomputation");
773187
+ return parsed;
773188
+ } catch (error97) {
773189
+ if (cachePath !== cachePaths[cachePaths.length - 1]) {
773190
+ continue;
773191
+ }
773192
+ logForDebugging(`Failed to load stats cache: ${errorMessage(error97)}`);
772824
773193
  return getEmptyCache();
772825
773194
  }
772826
- return parsed;
772827
- } catch (error97) {
772828
- logForDebugging(`Failed to load stats cache: ${errorMessage(error97)}`);
772829
- return getEmptyCache();
772830
773195
  }
773196
+ return getEmptyCache();
772831
773197
  }
772832
773198
  async function saveStatsCache(cache10) {
772833
773199
  const fs30 = getFsImplementation();
@@ -773691,38 +774057,50 @@ async function processSessionFiles(sessionFiles, options = {}) {
773691
774057
  };
773692
774058
  }
773693
774059
  async function getAllSessionFiles() {
773694
- const projectsDir = getProjectsDir2();
774060
+ const allProjectsDirs = getAllProjectsDirs();
773695
774061
  const fs30 = getFsImplementation();
773696
- let allEntries;
773697
- try {
773698
- allEntries = await fs30.readdir(projectsDir);
773699
- } catch (e4) {
773700
- if (isENOENT(e4))
773701
- return [];
773702
- throw e4;
773703
- }
773704
- const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join184(projectsDir, dirent.name));
773705
- const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
774062
+ const seenKeys = new Set;
774063
+ const allFiles = [];
774064
+ for (const projectsDir of allProjectsDirs) {
774065
+ let allEntries;
773706
774066
  try {
773707
- const entries = await fs30.readdir(projectDir);
773708
- const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join184(projectDir, dirent.name));
773709
- const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
773710
- const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
773711
- const subagentsDir = join184(projectDir, sessionDir.name, "subagents");
773712
- try {
773713
- const subagentEntries = await fs30.readdir(subagentsDir);
773714
- return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join184(subagentsDir, dirent.name));
773715
- } catch {
773716
- return [];
773717
- }
773718
- }));
773719
- return [...mainFiles, ...subagentResults.flat()];
773720
- } catch (error97) {
773721
- logForDebugging(`Failed to read project directory ${projectDir}: ${errorMessage(error97)}`);
773722
- return [];
774067
+ allEntries = await fs30.readdir(projectsDir);
774068
+ } catch (e4) {
774069
+ if (isENOENT(e4))
774070
+ continue;
774071
+ throw e4;
773723
774072
  }
773724
- }));
773725
- return projectResults.flat();
774073
+ const projectNames = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
774074
+ const projectResults = await Promise.all(projectNames.map(async (projectName) => {
774075
+ const projectDir = join184(projectsDir, projectName);
774076
+ try {
774077
+ const entries = await fs30.readdir(projectDir);
774078
+ const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join184(projectDir, dirent.name));
774079
+ const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
774080
+ const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
774081
+ const subagentsDir = join184(projectDir, sessionDir.name, "subagents");
774082
+ try {
774083
+ const subagentEntries = await fs30.readdir(subagentsDir);
774084
+ return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join184(subagentsDir, dirent.name));
774085
+ } catch {
774086
+ return [];
774087
+ }
774088
+ }));
774089
+ return [...mainFiles, ...subagentResults.flat()];
774090
+ } catch (error97) {
774091
+ logForDebugging(`Failed to read project directory ${projectDir}: ${errorMessage(error97)}`);
774092
+ return [];
774093
+ }
774094
+ }));
774095
+ for (const file3 of projectResults.flat()) {
774096
+ const key6 = file3.replace(projectsDir + sep37, "");
774097
+ if (!seenKeys.has(key6)) {
774098
+ seenKeys.add(key6);
774099
+ allFiles.push(file3);
774100
+ }
774101
+ }
774102
+ }
774103
+ return allFiles;
773726
774104
  }
773727
774105
  function cacheToStats(cache10, todayStats) {
773728
774106
  const dailyActivityMap = new Map;
@@ -774119,6 +774497,7 @@ var init_stats = __esm(() => {
774119
774497
  init_json();
774120
774498
  init_messages5();
774121
774499
  init_sessionStorage();
774500
+ init_sessionStoragePortable();
774122
774501
  init_shellToolUtils();
774123
774502
  init_slowOperations();
774124
774503
  init_statsCache();
@@ -775210,7 +775589,7 @@ var init_oauth_refresh = __esm(() => {
775210
775589
  });
775211
775590
 
775212
775591
  // src/commands/debug-tool-call/index.ts
775213
- import { existsSync as existsSync30, readFileSync as readFileSync36 } from "fs";
775592
+ import { existsSync as existsSync31, readFileSync as readFileSync36 } from "fs";
775214
775593
  import { join as join185 } from "path";
775215
775594
  function getTranscriptPath4() {
775216
775595
  const sessionId = getSessionId();
@@ -775301,7 +775680,7 @@ var init_debug_tool_call = __esm(() => {
775301
775680
  const n4 = args.trim() ? parseInt(args.trim(), 10) : DEFAULT_N;
775302
775681
  const count3 = Number.isFinite(n4) && n4 > 0 ? n4 : DEFAULT_N;
775303
775682
  const logPath = getTranscriptPath4();
775304
- if (!existsSync30(logPath)) {
775683
+ if (!existsSync31(logPath)) {
775305
775684
  return {
775306
775685
  type: "text",
775307
775686
  value: [
@@ -780616,7 +780995,7 @@ function generateHtmlReport(data, insights) {
780616
780995
  </html>`;
780617
780996
  }
780618
780997
  function buildExportData(data, insights, facets, remoteStats) {
780619
- const version7 = typeof MACRO !== "undefined" ? "4.1.12" : "unknown";
780998
+ const version7 = typeof MACRO !== "undefined" ? "4.2.0" : "unknown";
780620
780999
  const remote_hosts_collected = remoteStats?.hosts.filter((h5) => h5.sessionCount > 0).map((h5) => h5.name);
780621
781000
  const facets_summary = {
780622
781001
  total: facets.size,
@@ -780660,27 +781039,33 @@ function buildExportData(data, insights, facets, remoteStats) {
780660
781039
  };
780661
781040
  }
780662
781041
  async function scanAllSessions() {
780663
- const projectsDir = getProjectsDir2();
780664
- let dirents;
780665
- try {
780666
- dirents = await readdir38(projectsDir, { withFileTypes: true });
780667
- } catch {
780668
- return [];
780669
- }
780670
- const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join189(projectsDir, dirent.name));
781042
+ const allProjectsDirs = getAllProjectsDirs();
781043
+ const seenIds = new Set;
780671
781044
  const allSessions = [];
780672
- for (let i6 = 0;i6 < projectDirs.length; i6++) {
780673
- const sessionFiles = await getSessionFilesWithMtime(projectDirs[i6]);
780674
- for (const [sessionId, fileInfo] of sessionFiles) {
780675
- allSessions.push({
780676
- sessionId,
780677
- path: fileInfo.path,
780678
- mtime: fileInfo.mtime,
780679
- size: fileInfo.size
780680
- });
781045
+ for (const projectsDir of allProjectsDirs) {
781046
+ let dirents;
781047
+ try {
781048
+ dirents = await readdir38(projectsDir, { withFileTypes: true });
781049
+ } catch {
781050
+ continue;
780681
781051
  }
780682
- if (i6 % 10 === 9) {
780683
- await new Promise((resolve54) => setImmediate(resolve54));
781052
+ const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join189(projectsDir, dirent.name));
781053
+ for (let i6 = 0;i6 < projectDirs.length; i6++) {
781054
+ const sessionFiles = await getSessionFilesWithMtime(projectDirs[i6]);
781055
+ for (const [sessionId, fileInfo] of sessionFiles) {
781056
+ if (seenIds.has(sessionId))
781057
+ continue;
781058
+ seenIds.add(sessionId);
781059
+ allSessions.push({
781060
+ sessionId,
781061
+ path: fileInfo.path,
781062
+ mtime: fileInfo.mtime,
781063
+ size: fileInfo.size
781064
+ });
781065
+ }
781066
+ if (i6 % 10 === 9) {
781067
+ await new Promise((resolve54) => setImmediate(resolve54));
781068
+ }
780684
781069
  }
780685
781070
  }
780686
781071
  allSessions.sort((a5, b6) => b6.mtime - a5.mtime);
@@ -780900,6 +781285,7 @@ var init_insights = __esm(() => {
780900
781285
  init_messages5();
780901
781286
  init_model();
780902
781287
  init_sessionStorage();
781288
+ init_sessionStoragePortable();
780903
781289
  init_slowOperations();
780904
781290
  init_stringUtils();
780905
781291
  init_systemPromptType();
@@ -784102,15 +784488,28 @@ async function loadAllProjectsMessageLogs(limit, options) {
784102
784488
  return result.logs;
784103
784489
  }
784104
784490
  async function loadAllProjectsMessageLogsFull(limit) {
784105
- const projectsDir = getProjectsDir2();
784106
- let dirents;
784107
- try {
784108
- dirents = await readdir39(projectsDir, { withFileTypes: true });
784109
- } catch {
784110
- return [];
784491
+ const allProjectsDirs = getAllProjectsDirs();
784492
+ const caseInsensitive = process.platform === "win32";
784493
+ const seenDirs = new Set;
784494
+ const uniqueProjectDirs = [];
784495
+ for (const projectsDir of allProjectsDirs) {
784496
+ let dirents;
784497
+ try {
784498
+ dirents = await readdir39(projectsDir, { withFileTypes: true });
784499
+ } catch {
784500
+ continue;
784501
+ }
784502
+ for (const dirent of dirents) {
784503
+ if (!dirent.isDirectory())
784504
+ continue;
784505
+ const key6 = caseInsensitive ? dirent.name.toLowerCase() : dirent.name;
784506
+ if (seenDirs.has(key6))
784507
+ continue;
784508
+ seenDirs.add(key6);
784509
+ uniqueProjectDirs.push(join190(projectsDir, dirent.name));
784510
+ }
784111
784511
  }
784112
- const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join190(projectsDir, dirent.name));
784113
- const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
784512
+ const logsPerProject = await Promise.all(uniqueProjectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
784114
784513
  const allLogs = logsPerProject.flat();
784115
784514
  const deduped = new Map;
784116
784515
  for (const log12 of allLogs) {
@@ -784127,17 +784526,26 @@ async function loadAllProjectsMessageLogsFull(limit) {
784127
784526
  return sorted;
784128
784527
  }
784129
784528
  async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount = INITIAL_ENRICH_COUNT) {
784130
- const projectsDir = getProjectsDir2();
784131
- let dirents;
784132
- try {
784133
- dirents = await readdir39(projectsDir, { withFileTypes: true });
784134
- } catch {
784135
- return { logs: [], allStatLogs: [], nextIndex: 0 };
784136
- }
784137
- const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join190(projectsDir, dirent.name));
784529
+ const allProjectsDirs = getAllProjectsDirs();
784530
+ const caseInsensitive = process.platform === "win32";
784531
+ const seenDirs = new Set;
784138
784532
  const rawLogs = [];
784139
- for (const projectDir of projectDirs) {
784140
- rawLogs.push(...await getSessionFilesLite(projectDir, limit));
784533
+ for (const projectsDir of allProjectsDirs) {
784534
+ let dirents;
784535
+ try {
784536
+ dirents = await readdir39(projectsDir, { withFileTypes: true });
784537
+ } catch {
784538
+ continue;
784539
+ }
784540
+ for (const dirent of dirents) {
784541
+ if (!dirent.isDirectory())
784542
+ continue;
784543
+ const key6 = caseInsensitive ? dirent.name.toLowerCase() : dirent.name;
784544
+ if (seenDirs.has(key6))
784545
+ continue;
784546
+ seenDirs.add(key6);
784547
+ rawLogs.push(...await getSessionFilesLite(join190(projectsDir, dirent.name), limit));
784548
+ }
784141
784549
  }
784142
784550
  const sorted = deduplicateLogsBySessionId(rawLogs);
784143
784551
  const { logs: logs3, nextIndex } = await enrichLogs(sorted, 0, initialEnrichCount);
@@ -784161,7 +784569,6 @@ async function loadSameRepoMessageLogsProgressive(worktreePaths, limit, initialE
784161
784569
  return { logs: logs3, allStatLogs, nextIndex };
784162
784570
  }
784163
784571
  async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
784164
- const projectsDir = getProjectsDir2();
784165
784572
  if (worktreePaths.length <= 1) {
784166
784573
  const cwd2 = getOriginalCwd();
784167
784574
  const projectDir = getProjectDir3(cwd2);
@@ -784176,30 +784583,37 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
784176
784583
  };
784177
784584
  });
784178
784585
  indexed.sort((a5, b6) => b6.prefix.length - a5.prefix.length);
784586
+ const allProjectsDirs = getAllProjectsDirs();
784179
784587
  const allLogs = [];
784180
784588
  const seenDirs = new Set;
784181
- let allDirents;
784182
- try {
784183
- allDirents = await readdir39(projectsDir, { withFileTypes: true });
784184
- } catch (e4) {
784185
- logForDebugging(`Failed to read projects dir ${projectsDir}, falling back to current project: ${e4}`);
784186
- const projectDir = getProjectDir3(getOriginalCwd());
784187
- return getSessionFilesLite(projectDir, limit, getOriginalCwd());
784188
- }
784189
- for (const dirent of allDirents) {
784190
- if (!dirent.isDirectory())
784191
- continue;
784192
- const dirName = caseInsensitive ? dirent.name.toLowerCase() : dirent.name;
784193
- if (seenDirs.has(dirName))
784589
+ let anyDirReadable = false;
784590
+ for (const projectsDir of allProjectsDirs) {
784591
+ let allDirents;
784592
+ try {
784593
+ allDirents = await readdir39(projectsDir, { withFileTypes: true });
784594
+ anyDirReadable = true;
784595
+ } catch {
784194
784596
  continue;
784195
- for (const { path: wtPath, prefix } of indexed) {
784196
- if (dirName === prefix || dirName.startsWith(prefix + "-")) {
784197
- seenDirs.add(dirName);
784198
- allLogs.push(...await getSessionFilesLite(join190(projectsDir, dirent.name), undefined, wtPath));
784199
- break;
784597
+ }
784598
+ for (const dirent of allDirents) {
784599
+ if (!dirent.isDirectory())
784600
+ continue;
784601
+ const dirName = caseInsensitive ? dirent.name.toLowerCase() : dirent.name;
784602
+ if (seenDirs.has(dirName))
784603
+ continue;
784604
+ for (const { path: wtPath, prefix } of indexed) {
784605
+ if (dirName === prefix || dirName.startsWith(prefix + "-")) {
784606
+ seenDirs.add(dirName);
784607
+ allLogs.push(...await getSessionFilesLite(join190(projectsDir, dirent.name), undefined, wtPath));
784608
+ break;
784609
+ }
784200
784610
  }
784201
784611
  }
784202
784612
  }
784613
+ if (!anyDirReadable) {
784614
+ const projectDir = getProjectDir3(getOriginalCwd());
784615
+ return getSessionFilesLite(projectDir, limit, getOriginalCwd());
784616
+ }
784203
784617
  return deduplicateLogsBySessionId(allLogs);
784204
784618
  }
784205
784619
  async function getAgentTranscript(agentId) {
@@ -784776,7 +785190,7 @@ var init_sessionStorage = __esm(() => {
784776
785190
  init_settings2();
784777
785191
  init_slowOperations();
784778
785192
  init_uuid();
784779
- VERSION9 = typeof MACRO !== "undefined" ? "4.1.12" : "unknown";
785193
+ VERSION9 = typeof MACRO !== "undefined" ? "4.2.0" : "unknown";
784780
785194
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
784781
785195
  SKIP_FIRST_PROMPT_PATTERN2 = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
784782
785196
  EPHEMERAL_PROGRESS_TYPES = new Set([
@@ -785036,7 +785450,13 @@ async function loadMemoryPrompt() {
785036
785450
  logMemoryDirCounts(autoDir, {
785037
785451
  memory_type: "auto"
785038
785452
  });
785039
- return buildMemoryLines("auto memory", autoDir, extraGuidelines, skipIndex).join(`
785453
+ const allPaths = getAllAutoMemPaths();
785454
+ const legacyPath = allPaths.length > 1 ? allPaths[1] : undefined;
785455
+ const baseLines = buildMemoryLines("auto memory", autoDir, extraGuidelines, skipIndex);
785456
+ if (legacyPath) {
785457
+ baseLines.push("", `## Legacy memory directory`, `If no memories are found in the primary directory above, also check: \`${legacyPath}\``, `This directory may contain memories from a previous Claude installation.`);
785458
+ }
785459
+ return baseLines.join(`
785040
785460
  `);
785041
785461
  }
785042
785462
  logEvent("tengu_memdir_disabled", {
@@ -786078,7 +786498,7 @@ var init_filesystem = __esm(() => {
786078
786498
  });
786079
786499
  getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
786080
786500
  const nonce = randomBytes24(16).toString("hex");
786081
- return join193(getCostrictTempDir(), "bundled-skills", "4.1.12", nonce);
786501
+ return join193(getCostrictTempDir(), "bundled-skills", "4.2.0", nonce);
786082
786502
  });
786083
786503
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
786084
786504
  });
@@ -792275,7 +792695,7 @@ function computeFingerprint(messageText, version7) {
792275
792695
  }
792276
792696
  function computeFingerprintFromMessages(messages) {
792277
792697
  const firstMessageText = extractFirstMessageText(messages);
792278
- return computeFingerprint(firstMessageText, "4.1.12");
792698
+ return computeFingerprint(firstMessageText, "4.2.0");
792279
792699
  }
792280
792700
  var FINGERPRINT_SALT = "59cf53e54c78";
792281
792701
  var init_fingerprint = () => {};
@@ -792685,7 +793105,7 @@ function getAnthropicEnvMetadata() {
792685
793105
  function getBuildAgeMinutes() {
792686
793106
  if (false)
792687
793107
  ;
792688
- const buildTime = new Date("2026-06-08T13:08:39.119Z").getTime();
793108
+ const buildTime = new Date("2026-06-09T13:06:56.679Z").getTime();
792689
793109
  if (isNaN(buildTime))
792690
793110
  return;
792691
793111
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -803198,7 +803618,7 @@ var init_provider4 = __esm(() => {
803198
803618
 
803199
803619
  // src/services/api/claude.ts
803200
803620
  import { randomUUID as randomUUID56 } from "crypto";
803201
- import { existsSync as existsSync31, unlinkSync as unlinkSync10 } from "fs";
803621
+ import { existsSync as existsSync32, unlinkSync as unlinkSync10 } from "fs";
803202
803622
  function getExtraBodyParams(betaHeaders) {
803203
803623
  const extraBodyStr = process.env.CLAUDE_CODE_EXTRA_BODY;
803204
803624
  let result = {};
@@ -803754,14 +804174,14 @@ To invoke any tool listed above, use ExecuteExtraTool with {"tool_name": "<name>
803754
804174
  {
803755
804175
  const onceMarker = getBreakCacheMarkerPath();
803756
804176
  const alwaysFlag = getBreakCacheAlwaysPath();
803757
- const shouldBreak = existsSync31(onceMarker) || existsSync31(alwaysFlag);
804177
+ const shouldBreak = existsSync32(onceMarker) || existsSync32(alwaysFlag);
803758
804178
  if (shouldBreak) {
803759
804179
  const nonce = randomUUID56();
803760
804180
  systemPrompt2 = asSystemPrompt([
803761
804181
  ...systemPrompt2,
803762
804182
  `<!-- cache-break nonce: ${nonce} -->`
803763
804183
  ]);
803764
- if (existsSync31(onceMarker)) {
804184
+ if (existsSync32(onceMarker)) {
803765
804185
  try {
803766
804186
  unlinkSync10(onceMarker);
803767
804187
  } catch {}
@@ -805181,7 +805601,7 @@ async function sideQuery(opts) {
805181
805601
  betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
805182
805602
  }
805183
805603
  const messageText = extractFirstUserMessageText(messages);
805184
- const fingerprint = computeFingerprint(messageText, "4.1.12");
805604
+ const fingerprint = computeFingerprint(messageText, "4.2.0");
805185
805605
  const attributionHeader = getAttributionHeader(fingerprint);
805186
805606
  const systemBlocks = [
805187
805607
  attributionHeader ? { type: "text", text: attributionHeader } : null,
@@ -808556,7 +808976,7 @@ function buildSystemInitMessage(inputs) {
808556
808976
  slash_commands: inputs.commands.filter((c7) => c7.userInvocable !== false).map((c7) => c7.name),
808557
808977
  apiKeySource: getAnthropicApiKeyWithSource().source,
808558
808978
  betas: getSdkBetas(),
808559
- claude_code_version: "4.1.12",
808979
+ claude_code_version: "4.2.0",
808560
808980
  output_style: outputStyle2,
808561
808981
  agents: inputs.agents.map((agent) => agent.agentType),
808562
808982
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
@@ -812125,7 +812545,7 @@ var init_api7 = () => {};
812125
812545
  // packages/weixin/src/accounts.ts
812126
812546
  import {
812127
812547
  chmodSync as chmodSync5,
812128
- existsSync as existsSync32,
812548
+ existsSync as existsSync33,
812129
812549
  mkdirSync as mkdirSync16,
812130
812550
  readFileSync as readFileSync39,
812131
812551
  unlinkSync as unlinkSync11,
@@ -812135,7 +812555,7 @@ import { homedir as homedir49 } from "os";
812135
812555
  import { join as join198 } from "path";
812136
812556
  function getStateDir() {
812137
812557
  const dir = process.env.WEIXIN_STATE_DIR || join198(homedir49(), ".claude", "channels", "weixin");
812138
- if (!existsSync32(dir)) {
812558
+ if (!existsSync33(dir)) {
812139
812559
  mkdirSync16(dir, { recursive: true });
812140
812560
  }
812141
812561
  return dir;
@@ -812145,7 +812565,7 @@ function accountPath() {
812145
812565
  }
812146
812566
  function loadAccount() {
812147
812567
  const path45 = accountPath();
812148
- if (!existsSync32(path45))
812568
+ if (!existsSync33(path45))
812149
812569
  return null;
812150
812570
  try {
812151
812571
  return JSON.parse(readFileSync39(path45, "utf-8"));
@@ -812160,7 +812580,7 @@ function saveAccount(data) {
812160
812580
  }
812161
812581
  function clearAccount() {
812162
812582
  const path45 = accountPath();
812163
- if (existsSync32(path45)) {
812583
+ if (existsSync33(path45)) {
812164
812584
  unlinkSync11(path45);
812165
812585
  }
812166
812586
  }
@@ -812261,7 +812681,7 @@ var init_login3 = __esm(() => {
812261
812681
  });
812262
812682
 
812263
812683
  // packages/weixin/src/pairing.ts
812264
- import { existsSync as existsSync33, readFileSync as readFileSync40, writeFileSync as writeFileSync23 } from "fs";
812684
+ import { existsSync as existsSync34, readFileSync as readFileSync40, writeFileSync as writeFileSync23 } from "fs";
812265
812685
  import { join as join199 } from "path";
812266
812686
  function configPath() {
812267
812687
  return join199(getStateDir(), "access.json");
@@ -812271,7 +812691,7 @@ function pendingPath() {
812271
812691
  }
812272
812692
  function loadPending() {
812273
812693
  const path45 = pendingPath();
812274
- if (!existsSync33(path45))
812694
+ if (!existsSync34(path45))
812275
812695
  return {};
812276
812696
  try {
812277
812697
  return JSON.parse(readFileSync40(path45, "utf-8"));
@@ -812284,7 +812704,7 @@ function savePending(data) {
812284
812704
  }
812285
812705
  function loadAccessConfig() {
812286
812706
  const path45 = configPath();
812287
- if (!existsSync33(path45)) {
812707
+ if (!existsSync34(path45)) {
812288
812708
  return { policy: "pairing", allowFrom: [] };
812289
812709
  }
812290
812710
  try {
@@ -812349,7 +812769,7 @@ import {
812349
812769
  createHash as createHash34,
812350
812770
  randomBytes as randomBytes27
812351
812771
  } from "crypto";
812352
- import { existsSync as existsSync34, mkdirSync as mkdirSync17, readFileSync as readFileSync41, writeFileSync as writeFileSync24 } from "fs";
812772
+ import { existsSync as existsSync35, mkdirSync as mkdirSync17, readFileSync as readFileSync41, writeFileSync as writeFileSync24 } from "fs";
812353
812773
  import { tmpdir as tmpdir19 } from "os";
812354
812774
  import { basename as basename55, extname as extname16, join as join200 } from "path";
812355
812775
  function encryptAesEcb(plaintext, key6) {
@@ -812438,7 +812858,7 @@ function guessMediaType(filePath) {
812438
812858
  }
812439
812859
  async function downloadRemoteToTemp(url4, destDir) {
812440
812860
  const dir = destDir || join200(tmpdir19(), "weixin-downloads");
812441
- if (!existsSync34(dir))
812861
+ if (!existsSync35(dir))
812442
812862
  mkdirSync17(dir, { recursive: true });
812443
812863
  const response3 = await fetch(url4);
812444
812864
  if (!response3.ok)
@@ -812637,7 +813057,7 @@ var init_permissions7 = __esm(() => {
812637
813057
  });
812638
813058
 
812639
813059
  // packages/weixin/src/monitor.ts
812640
- import { existsSync as existsSync35, mkdirSync as mkdirSync18, readFileSync as readFileSync42, writeFileSync as writeFileSync25 } from "fs";
813060
+ import { existsSync as existsSync36, mkdirSync as mkdirSync18, readFileSync as readFileSync42, writeFileSync as writeFileSync25 } from "fs";
812641
813061
  import { tmpdir as tmpdir20 } from "os";
812642
813062
  import { basename as basename56, join as join201 } from "path";
812643
813063
  function getContextToken(userId) {
@@ -812648,7 +813068,7 @@ function cursorPath() {
812648
813068
  }
812649
813069
  function loadCursor() {
812650
813070
  const path45 = cursorPath();
812651
- if (existsSync35(path45))
813071
+ if (existsSync36(path45))
812652
813072
  return readFileSync42(path45, "utf-8").trim();
812653
813073
  return "";
812654
813074
  }
@@ -812697,7 +813117,7 @@ async function downloadMedia(item, cdnBaseUrl) {
812697
813117
  cdnBaseUrl
812698
813118
  });
812699
813119
  const dir = join201(tmpdir20(), "weixin-media");
812700
- if (!existsSync35(dir))
813120
+ if (!existsSync36(dir))
812701
813121
  mkdirSync18(dir, { recursive: true });
812702
813122
  const rawFileName = item.file_item?.file_name || `${Date.now()}${ext}`;
812703
813123
  const fileName = basename56(rawFileName);
@@ -812868,7 +813288,7 @@ var init_monitor2 = __esm(() => {
812868
813288
  });
812869
813289
 
812870
813290
  // packages/weixin/src/server.ts
812871
- import { existsSync as existsSync36 } from "fs";
813291
+ import { existsSync as existsSync37 } from "fs";
812872
813292
  function formatPermissionRequestMessage(request3) {
812873
813293
  return [
812874
813294
  "CoStrict needs your approval.",
@@ -812961,7 +813381,7 @@ function createWeixinMcpServer(version7) {
812961
813381
  try {
812962
813382
  if (files3 && files3.length > 0) {
812963
813383
  for (const [index2, filePath] of files3.entries()) {
812964
- if (!existsSync36(filePath)) {
813384
+ if (!existsSync37(filePath)) {
812965
813385
  return {
812966
813386
  content: [
812967
813387
  { type: "text", text: `File not found: ${filePath}` }
@@ -813411,7 +813831,7 @@ function appendToLog(path45, message2) {
813411
813831
  cwd: getFsImplementation().cwd(),
813412
813832
  userType: process.env.USER_TYPE,
813413
813833
  sessionId: getSessionId(),
813414
- version: "4.1.12"
813834
+ version: "4.2.0"
813415
813835
  };
813416
813836
  getLogWriter(path45).write(messageWithTimestamp);
813417
813837
  }
@@ -813521,7 +813941,7 @@ import { execFile as execFile16, spawn as spawn14 } from "child_process";
813521
813941
  import { createHash as createHash35 } from "crypto";
813522
813942
  import { createWriteStream as createWriteStream4, promises as fsp2 } from "fs";
813523
813943
  import fs30 from "fs";
813524
- import os18 from "os";
813944
+ import os17 from "os";
813525
813945
  import path45 from "path";
813526
813946
  function getCloudBaseUrl() {
813527
813947
  const raw = getCoStrictBaseURL().replace(/\/$/, "");
@@ -813531,7 +813951,7 @@ function getCloudBaseUrl() {
813531
813951
  }
813532
813952
  function csCloudBin() {
813533
813953
  const ext = process.platform === "win32" ? ".exe" : "";
813534
- const binDir = path45.join(os18.homedir(), ".costrict", "bin");
813954
+ const binDir = path45.join(os17.homedir(), ".costrict", "bin");
813535
813955
  return path45.join(binDir, `cs-cloud${ext}`);
813536
813956
  }
813537
813957
  function getReleasePlatform() {
@@ -813637,7 +814057,7 @@ async function extractBinary(archive, outDir, url4) {
813637
814057
  }
813638
814058
  }
813639
814059
  async function downloadToTemp(url4, expectedSha256, totalSize) {
813640
- const tmp = path45.join(os18.tmpdir(), `cs-cloud-download-${Date.now()}`);
814060
+ const tmp = path45.join(os17.tmpdir(), `cs-cloud-download-${Date.now()}`);
813641
814061
  const res = await fetch(url4);
813642
814062
  if (!res.ok)
813643
814063
  throw new Error(`download failed: ${res.status}`);
@@ -833959,7 +834379,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
833959
834379
  project_dir: getOriginalCwd(),
833960
834380
  added_dirs: addedDirs
833961
834381
  },
833962
- version: "4.1.12",
834382
+ version: "4.2.0",
833963
834383
  output_style: {
833964
834384
  name: outputStyleName
833965
834385
  },
@@ -844582,9 +845002,9 @@ globstar while`, t, d4, e4, u6, m3), this.matchOne(t.slice(d4), e4.slice(u6), s)
844582
845002
  Wt.LRUCache = undefined;
844583
845003
  var er = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, as = new Set, ge2 = typeof process == "object" && process ? process : {}, ls = (n4, t, e4, s) => {
844584
845004
  typeof ge2.emitWarning == "function" ? ge2.emitWarning(n4, t, e4, s) : console.error(`[${e4}] ${t}: ${n4}`);
844585
- }, Lt = globalThis.AbortController, os19 = globalThis.AbortSignal;
845005
+ }, Lt = globalThis.AbortController, os18 = globalThis.AbortSignal;
844586
845006
  if (typeof Lt > "u") {
844587
- os19 = class {
845007
+ os18 = class {
844588
845008
  onabort;
844589
845009
  _onabort = [];
844590
845010
  reason;
@@ -844596,7 +845016,7 @@ globstar while`, t, d4, e4, u6, m3), this.matchOne(t.slice(d4), e4.slice(u6), s)
844596
845016
  constructor() {
844597
845017
  t();
844598
845018
  }
844599
- signal = new os19;
845019
+ signal = new os18;
844600
845020
  abort(e4) {
844601
845021
  if (!this.signal.aborted) {
844602
845022
  this.signal.reason = e4, this.signal.aborted = true;
@@ -847412,83 +847832,89 @@ async function tryRmdir(dirPath, fsImpl) {
847412
847832
  async function cleanupOldSessionFiles() {
847413
847833
  const cutoffDate = getCutoffDate();
847414
847834
  const result = { messages: 0, errors: 0 };
847415
- const projectsDir = getProjectsDir2();
847835
+ const allProjectsDirs = getAllProjectsDirs();
847416
847836
  const fsImpl = getFsImplementation();
847417
- let projectDirents;
847418
- try {
847419
- projectDirents = await fsImpl.readdir(projectsDir);
847420
- } catch {
847421
- return result;
847422
- }
847423
- for (const projectDirent of projectDirents) {
847424
- if (!projectDirent.isDirectory())
847425
- continue;
847426
- const projectDir = join206(projectsDir, projectDirent.name);
847427
- let entries;
847837
+ const seenProjectNames = new Set;
847838
+ for (const projectsDir of allProjectsDirs) {
847839
+ let projectDirents;
847428
847840
  try {
847429
- entries = await fsImpl.readdir(projectDir);
847841
+ projectDirents = await fsImpl.readdir(projectsDir);
847430
847842
  } catch {
847431
- result.errors++;
847432
847843
  continue;
847433
847844
  }
847434
- for (const entry of entries) {
847435
- if (entry.isFile()) {
847436
- if (!entry.name.endsWith(".jsonl") && !entry.name.endsWith(".cast")) {
847437
- continue;
847438
- }
847439
- try {
847440
- if (await unlinkIfOld(join206(projectDir, entry.name), cutoffDate, fsImpl)) {
847441
- result.messages++;
847845
+ for (const projectDirent of projectDirents) {
847846
+ if (!projectDirent.isDirectory())
847847
+ continue;
847848
+ if (seenProjectNames.has(projectDirent.name))
847849
+ continue;
847850
+ seenProjectNames.add(projectDirent.name);
847851
+ const projectDir = join206(projectsDir, projectDirent.name);
847852
+ let entries;
847853
+ try {
847854
+ entries = await fsImpl.readdir(projectDir);
847855
+ } catch {
847856
+ result.errors++;
847857
+ continue;
847858
+ }
847859
+ for (const entry of entries) {
847860
+ if (entry.isFile()) {
847861
+ if (!entry.name.endsWith(".jsonl") && !entry.name.endsWith(".cast")) {
847862
+ continue;
847442
847863
  }
847443
- } catch {
847444
- result.errors++;
847445
- }
847446
- } else if (entry.isDirectory()) {
847447
- const sessionDir = join206(projectDir, entry.name);
847448
- const toolResultsDir = join206(sessionDir, TOOL_RESULTS_SUBDIR);
847449
- let toolDirs;
847450
- try {
847451
- toolDirs = await fsImpl.readdir(toolResultsDir);
847452
- } catch {
847453
- await tryRmdir(sessionDir, fsImpl);
847454
- continue;
847455
- }
847456
- for (const toolEntry of toolDirs) {
847457
- if (toolEntry.isFile()) {
847458
- try {
847459
- if (await unlinkIfOld(join206(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
847460
- result.messages++;
847461
- }
847462
- } catch {
847463
- result.errors++;
847464
- }
847465
- } else if (toolEntry.isDirectory()) {
847466
- const toolDirPath = join206(toolResultsDir, toolEntry.name);
847467
- let toolFiles;
847468
- try {
847469
- toolFiles = await fsImpl.readdir(toolDirPath);
847470
- } catch {
847471
- continue;
847864
+ try {
847865
+ if (await unlinkIfOld(join206(projectDir, entry.name), cutoffDate, fsImpl)) {
847866
+ result.messages++;
847472
847867
  }
847473
- for (const tf of toolFiles) {
847474
- if (!tf.isFile())
847475
- continue;
847868
+ } catch {
847869
+ result.errors++;
847870
+ }
847871
+ } else if (entry.isDirectory()) {
847872
+ const sessionDir = join206(projectDir, entry.name);
847873
+ const toolResultsDir = join206(sessionDir, TOOL_RESULTS_SUBDIR);
847874
+ let toolDirs;
847875
+ try {
847876
+ toolDirs = await fsImpl.readdir(toolResultsDir);
847877
+ } catch {
847878
+ await tryRmdir(sessionDir, fsImpl);
847879
+ continue;
847880
+ }
847881
+ for (const toolEntry of toolDirs) {
847882
+ if (toolEntry.isFile()) {
847476
847883
  try {
847477
- if (await unlinkIfOld(join206(toolDirPath, tf.name), cutoffDate, fsImpl)) {
847884
+ if (await unlinkIfOld(join206(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
847478
847885
  result.messages++;
847479
847886
  }
847480
847887
  } catch {
847481
847888
  result.errors++;
847482
847889
  }
847890
+ } else if (toolEntry.isDirectory()) {
847891
+ const toolDirPath = join206(toolResultsDir, toolEntry.name);
847892
+ let toolFiles;
847893
+ try {
847894
+ toolFiles = await fsImpl.readdir(toolDirPath);
847895
+ } catch {
847896
+ continue;
847897
+ }
847898
+ for (const tf of toolFiles) {
847899
+ if (!tf.isFile())
847900
+ continue;
847901
+ try {
847902
+ if (await unlinkIfOld(join206(toolDirPath, tf.name), cutoffDate, fsImpl)) {
847903
+ result.messages++;
847904
+ }
847905
+ } catch {
847906
+ result.errors++;
847907
+ }
847908
+ }
847909
+ await tryRmdir(toolDirPath, fsImpl);
847483
847910
  }
847484
- await tryRmdir(toolDirPath, fsImpl);
847485
847911
  }
847912
+ await tryRmdir(toolResultsDir, fsImpl);
847913
+ await tryRmdir(sessionDir, fsImpl);
847486
847914
  }
847487
- await tryRmdir(toolResultsDir, fsImpl);
847488
- await tryRmdir(sessionDir, fsImpl);
847489
847915
  }
847916
+ await tryRmdir(projectDir, fsImpl);
847490
847917
  }
847491
- await tryRmdir(projectDir, fsImpl);
847492
847918
  }
847493
847919
  return result;
847494
847920
  }
@@ -847740,7 +848166,7 @@ var init_cleanup3 = __esm(() => {
847740
848166
  init_log3();
847741
848167
  init_nativeInstaller();
847742
848168
  init_pasteStore();
847743
- init_sessionStorage();
848169
+ init_sessionStoragePortable();
847744
848170
  init_allErrors();
847745
848171
  init_settings2();
847746
848172
  init_toolResultStorage();
@@ -847813,7 +848239,7 @@ __export(exports_registerProtocol, {
847813
848239
  MACOS_BUNDLE_ID: () => MACOS_BUNDLE_ID
847814
848240
  });
847815
848241
  import { promises as fs32 } from "fs";
847816
- import * as os19 from "os";
848242
+ import * as os18 from "os";
847817
848243
  import * as path47 from "path";
847818
848244
  function linuxDesktopPath() {
847819
848245
  return path47.join(getXDGDataHome(), "applications", DESKTOP_FILE_NAME);
@@ -848009,7 +848435,7 @@ var init_registerProtocol = __esm(() => {
848009
848435
  init_settings2();
848010
848436
  init_which();
848011
848437
  init_xdg();
848012
- MACOS_APP_DIR = path47.join(os19.homedir(), "Applications", MACOS_APP_NAME);
848438
+ MACOS_APP_DIR = path47.join(os18.homedir(), "Applications", MACOS_APP_NAME);
848013
848439
  MACOS_SYMLINK_PATH = path47.join(MACOS_APP_DIR, "Contents", "MacOS", "claude");
848014
848440
  WINDOWS_REG_KEY = `HKEY_CURRENT_USER\\Software\\Classes\\${DEEP_LINK_PROTOCOL}`;
848015
848441
  WINDOWS_COMMAND_KEY = `${WINDOWS_REG_KEY}\\shell\\open\\command`;
@@ -852219,7 +852645,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
852219
852645
  } catch {}
852220
852646
  const data = {
852221
852647
  trigger,
852222
- version: "4.1.12",
852648
+ version: "4.2.0",
852223
852649
  platform: process.platform,
852224
852650
  transcript,
852225
852651
  subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
@@ -853461,7 +853887,7 @@ function getReleaseType(current2, latest) {
853461
853887
  return "patch";
853462
853888
  }
853463
853889
  async function checkNewAutoUpdate(callbacks) {
853464
- const currentVersion = "4.1.12";
853890
+ const currentVersion = "4.2.0";
853465
853891
  logForDebugging(`[newAutoUpdater] checking, current: ${currentVersion}`);
853466
853892
  if (isNewAutoUpdaterDisabled()) {
853467
853893
  return { action: "skip", currentVersion, latestVersion: null };
@@ -864306,7 +864732,7 @@ function WelcomeV2() {
864306
864732
  dimColor: true,
864307
864733
  children: [
864308
864734
  "v",
864309
- "4.1.12",
864735
+ "4.2.0",
864310
864736
  " "
864311
864737
  ]
864312
864738
  })
@@ -864372,7 +864798,7 @@ function WelcomeV2() {
864372
864798
  dimColor: true,
864373
864799
  children: [
864374
864800
  "v",
864375
- "4.1.12",
864801
+ "4.2.0",
864376
864802
  " "
864377
864803
  ]
864378
864804
  })
@@ -864474,7 +864900,7 @@ function AppleTerminalWelcomeV2({ theme: theme2, welcomeMessage }) {
864474
864900
  dimColor: true,
864475
864901
  children: [
864476
864902
  "v",
864477
- "4.1.12",
864903
+ "4.2.0",
864478
864904
  " "
864479
864905
  ]
864480
864906
  })
@@ -864540,7 +864966,7 @@ function AppleTerminalWelcomeV2({ theme: theme2, welcomeMessage }) {
864540
864966
  dimColor: true,
864541
864967
  children: [
864542
864968
  "v",
864543
- "4.1.12",
864969
+ "4.2.0",
864544
864970
  " "
864545
864971
  ]
864546
864972
  })
@@ -865490,7 +865916,7 @@ function completeOnboarding() {
865490
865916
  saveGlobalConfig((current2) => ({
865491
865917
  ...current2,
865492
865918
  hasCompletedOnboarding: true,
865493
- lastOnboardingVersion: "4.1.12"
865919
+ lastOnboardingVersion: "4.2.0"
865494
865920
  }));
865495
865921
  }
865496
865922
  function showDialog(root6, renderer) {
@@ -866841,7 +867267,7 @@ function registerWeixinBuiltinPlugin() {
866841
867267
  registerBuiltinPlugin({
866842
867268
  name: "weixin",
866843
867269
  description: "WeChat channel integration. Enables inbound WeChat messages via channels and provides reply/send_typing MCP tools. Configure with `ccb weixin login` and enable for a session with `--channels plugin:weixin@builtin`.",
866844
- version: "4.1.12",
867270
+ version: "4.2.0",
866845
867271
  defaultEnabled: true,
866846
867272
  mcpServers: {
866847
867273
  weixin: {
@@ -878483,7 +878909,7 @@ var init_SSHProbe = __esm(() => {
878483
878909
  });
878484
878910
 
878485
878911
  // src/ssh/SSHDeploy.ts
878486
- import { existsSync as existsSync37 } from "fs";
878912
+ import { existsSync as existsSync38 } from "fs";
878487
878913
  import { resolve as resolve57 } from "path";
878488
878914
  async function runSshCommand(host, command11, timeoutMs = SSH_TIMEOUT_MS) {
878489
878915
  const proc = Bun.spawn(["ssh", "-o", "ConnectTimeout=10", host, command11], {
@@ -878505,10 +878931,10 @@ async function runSshCommand(host, command11, timeoutMs = SSH_TIMEOUT_MS) {
878505
878931
  function findLocalBinary() {
878506
878932
  const projectRoot = resolve57(import.meta.dir, "../..");
878507
878933
  const distPath = resolve57(projectRoot, "dist/cli.js");
878508
- if (existsSync37(distPath))
878934
+ if (existsSync38(distPath))
878509
878935
  return distPath;
878510
878936
  const devPath = resolve57(projectRoot, "src/entrypoints/cli.tsx");
878511
- if (existsSync37(devPath))
878937
+ if (existsSync38(devPath))
878512
878938
  return devPath;
878513
878939
  throw new Error("Cannot find local CLI binary to deploy. Run `bun run build` first.");
878514
878940
  }
@@ -879150,7 +879576,7 @@ async function startMCPServer(cwd3, debug5, verbose) {
879150
879576
  setCwd(cwd3);
879151
879577
  const server2 = new Server({
879152
879578
  name: "claude/tengu",
879153
- version: "4.1.12"
879579
+ version: "4.2.0"
879154
879580
  }, {
879155
879581
  capabilities: {
879156
879582
  tools: {}
@@ -881428,7 +881854,7 @@ function createHealthRoutes(sessionManager) {
881428
881854
  const uptime2 = process.uptime() * 1000;
881429
881855
  return c7.json({
881430
881856
  status: "ok",
881431
- version: "4.1.12",
881857
+ version: "4.2.0",
881432
881858
  uptime_ms: Math.round(uptime2),
881433
881859
  active_sessions: sessionManager.getActiveCount()
881434
881860
  });
@@ -881689,7 +882115,7 @@ function getMacroDefines() {
881689
882115
  commit = execSync3("git rev-parse --short HEAD", { encoding: "utf-8", cwd: __dirname }).trim();
881690
882116
  } catch {}
881691
882117
  return {
881692
- "MACRO.VERSION": JSON.stringify("4.1.12"),
882118
+ "MACRO.VERSION": JSON.stringify("4.2.0"),
881693
882119
  "MACRO.BUILD_TIME": JSON.stringify(new Date().toISOString()),
881694
882120
  "MACRO.COMMIT": JSON.stringify(commit),
881695
882121
  "MACRO.FEEDBACK_CHANNEL": JSON.stringify(""),
@@ -882698,7 +883124,7 @@ var init_question = __esm(() => {
882698
883124
 
882699
883125
  // src/server/transcriptReader.ts
882700
883126
  import { readFile as readFile85, readdir as readdir45, stat as stat57 } from "fs/promises";
882701
- import { existsSync as existsSync38 } from "fs";
883127
+ import { existsSync as existsSync39 } from "fs";
882702
883128
  import { join as join223 } from "path";
882703
883129
  function normalizeToolName(name3) {
882704
883130
  return TOOL_NAME_MAP[name3] ?? name3.toLowerCase();
@@ -882788,25 +883214,27 @@ async function resolveTranscriptPathUncached(sessionId2, cwd4) {
882788
883214
  if (cwd4) {
882789
883215
  const projectDir = getProjectDir2(cwd4);
882790
883216
  const direct = join223(projectDir, `${sessionId2}.jsonl`);
882791
- if (existsSync38(direct))
883217
+ if (existsSync39(direct))
882792
883218
  return direct;
882793
883219
  }
882794
883220
  const found = await findProjectDir(cwd4 ?? process.cwd());
882795
883221
  if (found) {
882796
883222
  const direct = join223(found, `${sessionId2}.jsonl`);
882797
- if (existsSync38(direct))
883223
+ if (existsSync39(direct))
882798
883224
  return direct;
882799
883225
  }
882800
- const projectsDir = getProjectsDir();
883226
+ const allProjectsDirs = getAllProjectsDirs();
882801
883227
  const target = `${sessionId2}.jsonl`;
882802
- try {
882803
- const dirs = await readdir45(projectsDir);
882804
- for (const dir of dirs) {
882805
- const candidate = join223(projectsDir, dir, target);
882806
- if (existsSync38(candidate))
882807
- return candidate;
882808
- }
882809
- } catch {}
883228
+ for (const projectsDir of allProjectsDirs) {
883229
+ try {
883230
+ const dirs = await readdir45(projectsDir);
883231
+ for (const dir of dirs) {
883232
+ const candidate = join223(projectsDir, dir, target);
883233
+ if (existsSync39(candidate))
883234
+ return candidate;
883235
+ }
883236
+ } catch {}
883237
+ }
882810
883238
  return null;
882811
883239
  }
882812
883240
  function parseEntry(line) {
@@ -882891,7 +883319,7 @@ async function findSubagentTranscriptPathUncached(agentId, cwd4) {
882891
883319
  const meta5 = await readAgentMeta(metaPath);
882892
883320
  if (meta5?.parent_session_id) {
882893
883321
  const direct = join223(projectDir, meta5.parent_session_id, "subagents", fileName);
882894
- if (existsSync38(direct)) {
883322
+ if (existsSync39(direct)) {
882895
883323
  const s = await stat57(direct);
882896
883324
  if (s.isFile() && s.size > 0)
882897
883325
  return direct;
@@ -882946,17 +883374,19 @@ async function findSubagentTranscriptPathUncached(agentId, cwd4) {
882946
883374
  return hit2;
882947
883375
  }
882948
883376
  }
882949
- const projectsDir = getProjectsDir();
882950
- let dirs;
882951
- try {
882952
- dirs = await readdir45(projectsDir);
882953
- } catch {
882954
- return null;
882955
- }
882956
- for (const dir of dirs) {
882957
- const hit = await searchProject(join223(projectsDir, dir));
882958
- if (hit)
882959
- return hit;
883377
+ const allProjectsDirs = getAllProjectsDirs();
883378
+ for (const projectsDir of allProjectsDirs) {
883379
+ let dirs;
883380
+ try {
883381
+ dirs = await readdir45(projectsDir);
883382
+ } catch {
883383
+ continue;
883384
+ }
883385
+ for (const dir of dirs) {
883386
+ const hit = await searchProject(join223(projectsDir, dir));
883387
+ if (hit)
883388
+ return hit;
883389
+ }
882960
883390
  }
882961
883391
  return null;
882962
883392
  }
@@ -882977,7 +883407,7 @@ async function readSessionMessages(opts) {
882977
883407
  const includeSystem = opts.includeSystem ?? false;
882978
883408
  const path49 = await resolveTranscriptPath(opts.sessionId, opts.cwd);
882979
883409
  let mainMessages = [];
882980
- if (path49 && existsSync38(path49)) {
883410
+ if (path49 && existsSync39(path49)) {
882981
883411
  const raw2 = await readFile85(path49, "utf-8");
882982
883412
  const lines2 = raw2.split(`
882983
883413
  `).filter(Boolean);
@@ -883090,7 +883520,7 @@ function extractPlainTextContent(content) {
883090
883520
  }
883091
883521
  async function readSessionTodos(opts) {
883092
883522
  const path49 = await resolveTranscriptPath(opts.sessionId, opts.cwd);
883093
- if (!path49 || !existsSync38(path49))
883523
+ if (!path49 || !existsSync39(path49))
883094
883524
  return [];
883095
883525
  const raw2 = await readFile85(path49, "utf-8");
883096
883526
  const lines2 = raw2.split(`
@@ -883226,7 +883656,7 @@ function parseTaskNotificationXml(xml) {
883226
883656
  }
883227
883657
  async function readSessionTasks(opts) {
883228
883658
  const path49 = await resolveTranscriptPath(opts.sessionId, opts.cwd);
883229
- if (!path49 || !existsSync38(path49))
883659
+ if (!path49 || !existsSync39(path49))
883230
883660
  return [];
883231
883661
  const raw2 = await readFile85(path49, "utf-8");
883232
883662
  const lines2 = raw2.split(`
@@ -883349,10 +883779,17 @@ function hasActiveStream(sessionID) {
883349
883779
  function consumeStreamedTurn(sessionID) {
883350
883780
  if (streamedSessions.has(sessionID)) {
883351
883781
  streamedSessions.delete(sessionID);
883782
+ completedStreamMessages.delete(sessionID);
883352
883783
  return true;
883353
883784
  }
883354
883785
  return false;
883355
883786
  }
883787
+ function getStreamMessageInfo(sessionID) {
883788
+ const active4 = states.get(sessionID);
883789
+ if (active4)
883790
+ return { messageID: active4.messageID, modelID: active4.modelID };
883791
+ return completedStreamMessages.get(sessionID);
883792
+ }
883356
883793
  function registerAgentSession(sessionID, toolUseID, agentSessionID) {
883357
883794
  let sessionMap = pendingAgentSessions.get(sessionID);
883358
883795
  if (!sessionMap) {
@@ -883668,6 +884105,10 @@ function processStreamEvent(sessionID, event) {
883668
884105
  sessionTools.clear();
883669
884106
  }
883670
884107
  }
884108
+ completedStreamMessages.set(sessionID, {
884109
+ messageID: state4.messageID,
884110
+ modelID: state4.modelID
884111
+ });
883671
884112
  resetStreamState(sessionID);
883672
884113
  streamedSessions.add(sessionID);
883673
884114
  break;
@@ -883723,11 +884164,12 @@ function normalizeToolName2(name3) {
883723
884164
  };
883724
884165
  return map5[name3] ?? name3.toLowerCase();
883725
884166
  }
883726
- var states, streamedSessions, completedTools, pendingAgentSessions, SUBTITLE_KEYS;
884167
+ var states, streamedSessions, completedTools, completedStreamMessages, pendingAgentSessions, SUBTITLE_KEYS;
883727
884168
  var init_streamStateTracker = __esm(() => {
883728
884169
  states = new Map;
883729
884170
  streamedSessions = new Set;
883730
884171
  completedTools = new Map;
884172
+ completedStreamMessages = new Map;
883731
884173
  pendingAgentSessions = new Map;
883732
884174
  SUBTITLE_KEYS = {
883733
884175
  read: ["file_path"],
@@ -883927,6 +884369,7 @@ function handleAssistantMessage(msg, ctx) {
883927
884369
  const isApiError = isApiErrorContent(rawContent2);
883928
884370
  const agentId = msg.agent_id || getActiveSubagentId(ctx);
883929
884371
  const emitSessionID = agentId && ctx.getActiveSubagents().has(agentId) ? agentId : ctx.sessionId;
884372
+ const streamInfo = getStreamMessageInfo(emitSessionID);
883930
884373
  const wasStreamed = hasActiveStream(emitSessionID) || consumeStreamedTurn(emitSessionID);
883931
884374
  if (msg.uuid) {
883932
884375
  ctx.pushBufferMessage({
@@ -883940,6 +884383,33 @@ function handleAssistantMessage(msg, ctx) {
883940
884383
  });
883941
884384
  }
883942
884385
  if (wasStreamed) {
884386
+ if (isApiError) {
884387
+ const apiError = buildErrorFromContent(rawContent2);
884388
+ ctx.emitOpencodeEvent("message.updated", {
884389
+ sessionID: emitSessionID,
884390
+ info: {
884391
+ id: streamInfo?.messageID ?? msg.uuid ?? randomUUID82(),
884392
+ role: "assistant",
884393
+ modelID: streamInfo?.modelID ?? msg.model ?? ctx.getModel() ?? "",
884394
+ providerID: msg.provider_id ?? ctx.getProviderId(),
884395
+ time: { completed: msg.timestamp ? new Date(msg.timestamp).getTime() : Date.now() },
884396
+ parentID: msg.parentUuid ?? null,
884397
+ error: apiError
884398
+ }
884399
+ });
884400
+ ctx.emitOpencodeEvent("session.error", {
884401
+ sessionID: emitSessionID,
884402
+ error: {
884403
+ subtype: "api_error",
884404
+ level: "error",
884405
+ message: apiError.data.message,
884406
+ statusCode: apiError.data.statusCode,
884407
+ isRetryable: apiError.data.isRetryable,
884408
+ name: apiError.name,
884409
+ data: apiError.data
884410
+ }
884411
+ });
884412
+ }
883943
884413
  if (Array.isArray(rawContent2)) {
883944
884414
  for (const block of rawContent2) {
883945
884415
  const b6 = block;
@@ -883997,6 +884467,21 @@ function handleAssistantMessage(msg, ctx) {
883997
884467
  ...isApiError ? { error: buildErrorFromContent(rawContent2) } : {}
883998
884468
  }
883999
884469
  });
884470
+ if (isApiError) {
884471
+ const apiError = buildErrorFromContent(rawContent2);
884472
+ ctx.emitOpencodeEvent("session.error", {
884473
+ sessionID: emitSessionID,
884474
+ error: {
884475
+ subtype: "api_error",
884476
+ level: "error",
884477
+ message: apiError.data.message,
884478
+ statusCode: apiError.data.statusCode,
884479
+ isRetryable: apiError.data.isRetryable,
884480
+ name: apiError.name,
884481
+ data: apiError.data
884482
+ }
884483
+ });
884484
+ }
884000
884485
  if (Array.isArray(rawContent2)) {
884001
884486
  for (const block of rawContent2) {
884002
884487
  const part = buildPartFromContentBlock(block, assistantMsgID, emitSessionID);
@@ -884209,6 +884694,7 @@ function handleResultMessage(msg, ctx) {
884209
884694
  ctx.emitOpencodeEvent("session.result", {
884210
884695
  sessionID: ctx.sessionId,
884211
884696
  subtype: msg.subtype ?? "success",
884697
+ isError: msg.is_error,
884212
884698
  costUsd: msg.cost_usd,
884213
884699
  usage: msg.usage,
884214
884700
  stopReason: msg.stop_reason
@@ -885292,7 +885778,7 @@ __export(exports_sessionHandle, {
885292
885778
  import { spawn as spawn17 } from "child_process";
885293
885779
  import { createInterface as createInterface4 } from "readline";
885294
885780
  import { readdir as readdir46, readFile as readFile86 } from "fs/promises";
885295
- import { existsSync as existsSync39 } from "fs";
885781
+ import { existsSync as existsSync40 } from "fs";
885296
885782
  import { join as join225 } from "path";
885297
885783
  var SessionHandle;
885298
885784
  var init_sessionHandle = __esm(() => {
@@ -885498,7 +885984,7 @@ var init_sessionHandle = __esm(() => {
885498
885984
  async buildSubagentIndex() {
885499
885985
  const projectDir = getProjectDir2(this.cwd);
885500
885986
  const sessionDir = join225(projectDir, this.sessionId, "subagents");
885501
- if (!existsSync39(sessionDir))
885987
+ if (!existsSync40(sessionDir))
885502
885988
  return;
885503
885989
  try {
885504
885990
  const entries = await readdir46(sessionDir);
@@ -886062,7 +886548,7 @@ __export(exports_sessionManager, {
886062
886548
  SessionManager: () => SessionManager
886063
886549
  });
886064
886550
  import { readFile as readFile87, writeFile as writeFile78, mkdir as mkdir70, rm as rm15 } from "fs/promises";
886065
- import { existsSync as existsSync40, statSync as statSync14 } from "fs";
886551
+ import { existsSync as existsSync41, statSync as statSync14 } from "fs";
886066
886552
  import { join as join226, resolve as resolve58, isAbsolute as isAbsolute31 } from "path";
886067
886553
 
886068
886554
  class SessionManager {
@@ -886096,7 +886582,7 @@ class SessionManager {
886096
886582
  }
886097
886583
  async loadIndex() {
886098
886584
  const path49 = this.getIndexPath();
886099
- if (!existsSync40(path49))
886585
+ if (!existsSync41(path49))
886100
886586
  return;
886101
886587
  try {
886102
886588
  const raw2 = await readFile87(path49, "utf-8");
@@ -886122,7 +886608,7 @@ class SessionManager {
886122
886608
  };
886123
886609
  }
886124
886610
  const dir = getClaudeConfigHomeDir();
886125
- if (!existsSync40(dir)) {
886611
+ if (!existsSync41(dir)) {
886126
886612
  await mkdir70(dir, { recursive: true });
886127
886613
  }
886128
886614
  try {
@@ -886229,7 +886715,7 @@ class SessionManager {
886229
886715
  if (!isAbsolute31(cwd4)) {
886230
886716
  cwd4 = resolve58(process.cwd(), cwd4);
886231
886717
  }
886232
- if (!existsSync40(cwd4) || !statSync14(cwd4).isDirectory()) {
886718
+ if (!existsSync41(cwd4) || !statSync14(cwd4).isDirectory()) {
886233
886719
  throw new Error(`Working directory does not exist: ${cwd4}`);
886234
886720
  }
886235
886721
  if (this._warmPool.length > 0 && !opts.resumeSessionId && !opts.silent && this._warmPool[0].systemPrompt === opts.systemPrompt) {
@@ -886399,14 +886885,14 @@ class SessionManager {
886399
886885
  const jsonlPath = join226(projectDir, sessionId2 + ".jsonl");
886400
886886
  const sessionDir = join226(projectDir, sessionId2);
886401
886887
  try {
886402
- if (existsSync40(jsonlPath)) {
886888
+ if (existsSync41(jsonlPath)) {
886403
886889
  await rm15(jsonlPath, { force: true });
886404
886890
  }
886405
886891
  } catch (err2) {
886406
886892
  logError3(err2);
886407
886893
  }
886408
886894
  try {
886409
- if (existsSync40(sessionDir)) {
886895
+ if (existsSync41(sessionDir)) {
886410
886896
  await rm15(sessionDir, { recursive: true, force: true });
886411
886897
  }
886412
886898
  } catch (err2) {
@@ -887220,7 +887706,7 @@ __export(exports_update, {
887220
887706
  });
887221
887707
  async function update() {
887222
887708
  logEvent("tengu_update_check", {});
887223
- writeToStdout(`Current version: ${"4.1.12"}
887709
+ writeToStdout(`Current version: ${"4.2.0"}
887224
887710
  `);
887225
887711
  const channel5 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
887226
887712
  writeToStdout(`Checking for updates to ${channel5} version...
@@ -887295,8 +887781,8 @@ async function update() {
887295
887781
  writeToStdout(`CoStrict is managed by Homebrew.
887296
887782
  `);
887297
887783
  const latest = await getLatestVersion(channel5);
887298
- if (latest && !gte2("4.1.12", latest)) {
887299
- writeToStdout(`Update available: ${"4.1.12"} \u2192 ${latest}
887784
+ if (latest && !gte2("4.2.0", latest)) {
887785
+ writeToStdout(`Update available: ${"4.2.0"} \u2192 ${latest}
887300
887786
  `);
887301
887787
  writeToStdout(`
887302
887788
  `);
@@ -887312,8 +887798,8 @@ async function update() {
887312
887798
  writeToStdout(`CoStrict is managed by winget.
887313
887799
  `);
887314
887800
  const latest = await getLatestVersion(channel5);
887315
- if (latest && !gte2("4.1.12", latest)) {
887316
- writeToStdout(`Update available: ${"4.1.12"} \u2192 ${latest}
887801
+ if (latest && !gte2("4.2.0", latest)) {
887802
+ writeToStdout(`Update available: ${"4.2.0"} \u2192 ${latest}
887317
887803
  `);
887318
887804
  writeToStdout(`
887319
887805
  `);
@@ -887329,8 +887815,8 @@ async function update() {
887329
887815
  writeToStdout(`CoStrict is managed by apk.
887330
887816
  `);
887331
887817
  const latest = await getLatestVersion(channel5);
887332
- if (latest && !gte2("4.1.12", latest)) {
887333
- writeToStdout(`Update available: ${"4.1.12"} \u2192 ${latest}
887818
+ if (latest && !gte2("4.2.0", latest)) {
887819
+ writeToStdout(`Update available: ${"4.2.0"} \u2192 ${latest}
887334
887820
  `);
887335
887821
  writeToStdout(`
887336
887822
  `);
@@ -887395,11 +887881,11 @@ async function update() {
887395
887881
  `);
887396
887882
  await gracefulShutdown(1);
887397
887883
  }
887398
- if (result2.latestVersion === "4.1.12") {
887399
- writeToStdout(source_default.green(`CoStrict is up to date (${"4.1.12"})`) + `
887884
+ if (result2.latestVersion === "4.2.0") {
887885
+ writeToStdout(source_default.green(`CoStrict is up to date (${"4.2.0"})`) + `
887400
887886
  `);
887401
887887
  } else {
887402
- writeToStdout(source_default.green(`Successfully updated from ${"4.1.12"} to version ${result2.latestVersion}`) + `
887888
+ writeToStdout(source_default.green(`Successfully updated from ${"4.2.0"} to version ${result2.latestVersion}`) + `
887403
887889
  `);
887404
887890
  regenerateCompletionCache();
887405
887891
  }
@@ -887459,12 +887945,12 @@ async function update() {
887459
887945
  `);
887460
887946
  await gracefulShutdown(1);
887461
887947
  }
887462
- if (latestVersion === "4.1.12") {
887463
- writeToStdout(source_default.green(`CoStrict is up to date (${"4.1.12"})`) + `
887948
+ if (latestVersion === "4.2.0") {
887949
+ writeToStdout(source_default.green(`CoStrict is up to date (${"4.2.0"})`) + `
887464
887950
  `);
887465
887951
  await gracefulShutdown(0);
887466
887952
  }
887467
- writeToStdout(`New version available: ${latestVersion} (current: ${"4.1.12"})
887953
+ writeToStdout(`New version available: ${latestVersion} (current: ${"4.2.0"})
887468
887954
  `);
887469
887955
  writeToStdout(`Installing update...
887470
887956
  `);
@@ -887509,7 +887995,7 @@ async function update() {
887509
887995
  logForDebugging(`update: Installation status: ${result.status}`);
887510
887996
  switch (result.status) {
887511
887997
  case "success":
887512
- writeToStdout(source_default.green(`Successfully updated from ${"4.1.12"} to version ${latestVersion}`) + `
887998
+ writeToStdout(source_default.green(`Successfully updated from ${"4.2.0"} to version ${latestVersion}`) + `
887513
887999
  `);
887514
888000
  regenerateCompletionCache();
887515
888001
  break;
@@ -889721,7 +890207,7 @@ ${assistantAddendum}` : assistantAddendum;
889721
890207
  }
889722
890208
  }
889723
890209
  logForDiagnosticsNoPII("info", "started", {
889724
- version: "4.1.12",
890210
+ version: "4.2.0",
889725
890211
  is_native_binary: isInBundledMode()
889726
890212
  });
889727
890213
  registerCleanup(async () => {
@@ -890200,7 +890686,7 @@ Session: ${directConnectConfig.sessionId}`, "info");
890200
890686
  sshSession = await createSSHSession2({
890201
890687
  host: _pendingSSH.host,
890202
890688
  cwd: _pendingSSH.cwd,
890203
- localVersion: "4.1.12",
890689
+ localVersion: "4.2.0",
890204
890690
  permissionMode: _pendingSSH.permissionMode,
890205
890691
  dangerouslySkipPermissions: _pendingSSH.dangerouslySkipPermissions,
890206
890692
  extraCliArgs: _pendingSSH.extraCliArgs,
@@ -890672,7 +891158,7 @@ Usage: csc --remote "your task description"`, () => gracefulShutdown(1));
890672
891158
  pendingHookMessages
890673
891159
  }, renderAndRun);
890674
891160
  }
890675
- }).version("4.1.12 (CoStrict)", "-v, --version", "Output the version number");
891161
+ }).version("4.2.0 (CoStrict)", "-v, --version", "Output the version number");
890676
891162
  program2.addOption(new Option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)").hideHelp());
890677
891163
  program2.addOption(new Option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.").hideHelp());
890678
891164
  if (canUserConfigureAdvisor()) {
@@ -891386,10 +891872,10 @@ if (process.env.CLAUDE_CODE_REMOTE === "true") {
891386
891872
  async function main2() {
891387
891873
  const args = process.argv.slice(2);
891388
891874
  if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
891389
- const d4 = new Date("2026-06-08T13:08:39.119Z");
891875
+ const d4 = new Date("2026-06-09T13:06:56.679Z");
891390
891876
  const p2 = (n4) => String(n4).padStart(2, "0");
891391
891877
  const buildTime = `${d4.getFullYear()}/${p2(d4.getMonth() + 1)}/${p2(d4.getDate())} ${p2(d4.getHours())}:${p2(d4.getMinutes())}:${p2(d4.getSeconds())}`;
891392
- console.log(`${"4.1.12"} (commit: ${"f8bae4ac"}, built: ${buildTime})`);
891878
+ console.log(`${"4.2.0"} (commit: ${"7a005509b"}, built: ${buildTime})`);
891393
891879
  return;
891394
891880
  }
891395
891881
  const { profileCheckpoint: profileCheckpoint2 } = await Promise.resolve().then(() => (init_startupProfiler(), exports_startupProfiler));
@@ -891429,7 +891915,7 @@ async function main2() {
891429
891915
  registerPermissionHandler(server2, handler) {
891430
891916
  server2.setNotificationHandler(ChannelPermissionRequestNotificationSchema2(), async (notification) => handler(notification.params));
891431
891917
  }
891432
- }, "4.1.12");
891918
+ }, "4.2.0");
891433
891919
  return;
891434
891920
  }
891435
891921
  if (args[0] === "--daemon-worker" || args[0]?.startsWith("--daemon-worker=")) {
@@ -891527,5 +892013,5 @@ async function main2() {
891527
892013
  }
891528
892014
  main2();
891529
892015
 
891530
- //# debugId=41AA902614062E5464756E2164756E21
892016
+ //# debugId=0333D287AA838AF764756E2164756E21
891531
892017
  //# sourceMappingURL=cli.js.map