@use-aistack/cli 0.16.8 → 0.16.10

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/index.js CHANGED
@@ -9,10 +9,10 @@ var __export = (target, all) => {
9
9
  __defProp(target, name, { get: all[name], enumerable: true });
10
10
  };
11
11
 
12
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/types.js
12
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/types.js
13
13
  var MESSAGE_TYPES;
14
14
  var init_types = __esm({
15
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/types.js"() {
15
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/types.js"() {
16
16
  "use strict";
17
17
  MESSAGE_TYPES = [
18
18
  "user",
@@ -24,15 +24,15 @@ var init_types = __esm({
24
24
  }
25
25
  });
26
26
 
27
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/types.js
27
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/types.js
28
28
  var init_types2 = __esm({
29
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/types.js"() {
29
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/types.js"() {
30
30
  "use strict";
31
31
  init_types();
32
32
  }
33
33
  });
34
34
 
35
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/errors.js
35
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/errors.js
36
36
  function compareCodePoints(left, right) {
37
37
  const leftPoints = Array.from(left, (value) => value.codePointAt(0));
38
38
  const rightPoints = Array.from(right, (value) => value.codePointAt(0));
@@ -56,7 +56,7 @@ function isSessionIntegrityError(error) {
56
56
  }
57
57
  var SessionIntegrityError, WorkspaceAmbiguityError, SessionAmbiguityError, SessionScopeMismatchError, BackupWorkspaceScopeMetadataError, UnsupportedSessionMigrationError, MigrationTargetChangedError, DATABASE_CAPABILITY_ORDER, DatabaseCapabilityError, NoCapableDriverError, BackupPublishedPermissionError, BackupPublishedCleanupError, TemporaryArtifactCleanupError, RestoreRollbackError, ReadContextError, ReadContextSourceMismatchError, ReadContextScopeMismatchError, ReadContextOptionsMismatchError, ReadContextDisposedError, SourceEncodingError, SourceLimitExceededError, SourceLimitConfigurationError;
58
58
  var init_errors = __esm({
59
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/errors.js"() {
59
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/errors.js"() {
60
60
  "use strict";
61
61
  SessionIntegrityError = class _SessionIntegrityError extends Error {
62
62
  code;
@@ -237,7 +237,7 @@ var init_errors = __esm({
237
237
  ...new Set(cleanupErrors.flatMap((error) => error.details.unverifiedResiduePaths))
238
238
  ].sort(compareCodePoints);
239
239
  const unverifiedResidueSet = new Set(unverifiedResiduePaths);
240
- const residuePaths = [...new Set(cleanupErrors.flatMap((error) => error.details.residuePaths))].filter((path14) => !unverifiedResidueSet.has(path14)).sort(compareCodePoints);
240
+ const residuePaths = [...new Set(cleanupErrors.flatMap((error) => error.details.residuePaths))].filter((path15) => !unverifiedResidueSet.has(path15)).sort(compareCodePoints);
241
241
  const cleanupRemedy = residuePaths.length > 0 || unverifiedResiduePaths.length > 0 ? " Remove only verified private temporary paths after confirming no operation is active; do not delete unverified paths blindly." : "";
242
242
  super("RESTORE_ROLLBACK_INCOMPLETE", "Restore failed after one or more files were published; automatic rollback was not attempted.", {
243
243
  publishedFileCount,
@@ -324,10 +324,10 @@ var init_errors = __esm({
324
324
  }
325
325
  });
326
326
 
327
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/errors.js
327
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/errors.js
328
328
  var NoDriverAvailableError, DriverNotAvailableError, ReadonlyDatabaseError;
329
329
  var init_errors2 = __esm({
330
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/errors.js"() {
330
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/errors.js"() {
331
331
  "use strict";
332
332
  init_errors();
333
333
  NoDriverAvailableError = class extends Error {
@@ -352,7 +352,7 @@ var init_errors2 = __esm({
352
352
  }
353
353
  });
354
354
 
355
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/errors.js
355
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/errors.js
356
356
  function isDatabaseLockedError(error) {
357
357
  return error instanceof DatabaseLockedError;
358
358
  }
@@ -469,7 +469,7 @@ function isSourceLimitConfigurationError(error) {
469
469
  }
470
470
  var DatabaseLockedError, DatabaseNotFoundError, InvalidConfigError, InvalidFilterError, SessionNotFoundError, WorkspaceNotFoundError, SameWorkspaceError, NoSessionsFoundError, DestinationHasSessionsError, NestedPathError, BackupError, NoDataError, FileExistsError, InsufficientSpaceError, RestoreError, BackupNotFoundError, InvalidBackupError, TargetExistsError, IntegrityError;
471
471
  var init_errors3 = __esm({
472
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/errors.js"() {
472
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/errors.js"() {
473
473
  "use strict";
474
474
  init_errors();
475
475
  init_errors2();
@@ -477,9 +477,9 @@ var init_errors3 = __esm({
477
477
  name = "DatabaseLockedError";
478
478
  /** Path to locked database file */
479
479
  path;
480
- constructor(path14) {
481
- super(`Database is locked: ${path14}. Close Cursor or retry later.`);
482
- this.path = path14;
480
+ constructor(path15) {
481
+ super(`Database is locked: ${path15}. Close Cursor or retry later.`);
482
+ this.path = path15;
483
483
  if (Error.captureStackTrace) {
484
484
  Error.captureStackTrace(this, _DatabaseLockedError);
485
485
  }
@@ -489,9 +489,9 @@ var init_errors3 = __esm({
489
489
  name = "DatabaseNotFoundError";
490
490
  /** Path that was not found */
491
491
  path;
492
- constructor(path14) {
493
- super(`Database not found: ${path14}. Check dataPath configuration.`);
494
- this.path = path14;
492
+ constructor(path15) {
493
+ super(`Database not found: ${path15}. Check dataPath configuration.`);
494
+ this.path = path15;
495
495
  if (Error.captureStackTrace) {
496
496
  Error.captureStackTrace(this, _DatabaseNotFoundError);
497
497
  }
@@ -543,9 +543,9 @@ var init_errors3 = __esm({
543
543
  name = "WorkspaceNotFoundError";
544
544
  /** The workspace path that was not found */
545
545
  path;
546
- constructor(path14) {
547
- super(`No workspace found for path: ${path14}. Please open the project in Cursor first.`);
548
- this.path = path14;
546
+ constructor(path15) {
547
+ super(`No workspace found for path: ${path15}. Please open the project in Cursor first.`);
548
+ this.path = path15;
549
549
  if (Error.captureStackTrace) {
550
550
  Error.captureStackTrace(this, _WorkspaceNotFoundError);
551
551
  }
@@ -555,9 +555,9 @@ var init_errors3 = __esm({
555
555
  name = "SameWorkspaceError";
556
556
  /** The path that was specified for both source and destination */
557
557
  path;
558
- constructor(path14) {
559
- super(`Source and destination are the same: ${path14}`);
560
- this.path = path14;
558
+ constructor(path15) {
559
+ super(`Source and destination are the same: ${path15}`);
560
+ this.path = path15;
561
561
  if (Error.captureStackTrace) {
562
562
  Error.captureStackTrace(this, _SameWorkspaceError);
563
563
  }
@@ -567,9 +567,9 @@ var init_errors3 = __esm({
567
567
  name = "NoSessionsFoundError";
568
568
  /** The source workspace path */
569
569
  path;
570
- constructor(path14) {
571
- super(`No sessions found for workspace: ${path14}. Use 'cursor-history list --workspace "${path14}"' to verify.`);
572
- this.path = path14;
570
+ constructor(path15) {
571
+ super(`No sessions found for workspace: ${path15}. Use 'cursor-history list --workspace "${path15}"' to verify.`);
572
+ this.path = path15;
573
573
  if (Error.captureStackTrace) {
574
574
  Error.captureStackTrace(this, _NoSessionsFoundError);
575
575
  }
@@ -581,9 +581,9 @@ var init_errors3 = __esm({
581
581
  path;
582
582
  /** Number of existing sessions at destination */
583
583
  sessionCount;
584
- constructor(path14, sessionCount) {
585
- super(`Destination already has ${sessionCount} session(s): ${path14}. Use --force to proceed (will add sessions alongside existing ones).`);
586
- this.path = path14;
584
+ constructor(path15, sessionCount) {
585
+ super(`Destination already has ${sessionCount} session(s): ${path15}. Use --force to proceed (will add sessions alongside existing ones).`);
586
+ this.path = path15;
587
587
  this.sessionCount = sessionCount;
588
588
  if (Error.captureStackTrace) {
589
589
  Error.captureStackTrace(this, _DestinationHasSessionsError);
@@ -618,9 +618,9 @@ var init_errors3 = __esm({
618
618
  name = "NoDataError";
619
619
  /** Path that was checked for data */
620
620
  path;
621
- constructor(path14) {
622
- super(`No Cursor data found at: ${path14}. Verify Cursor is installed and has been used.`);
623
- this.path = path14;
621
+ constructor(path15) {
622
+ super(`No Cursor data found at: ${path15}. Verify Cursor is installed and has been used.`);
623
+ this.path = path15;
624
624
  if (Error.captureStackTrace) {
625
625
  Error.captureStackTrace(this, _NoDataError);
626
626
  }
@@ -630,9 +630,9 @@ var init_errors3 = __esm({
630
630
  name = "FileExistsError";
631
631
  /** Path to existing file */
632
632
  path;
633
- constructor(path14) {
634
- super(`File already exists: ${path14}. Use --force to overwrite.`);
635
- this.path = path14;
633
+ constructor(path15) {
634
+ super(`File already exists: ${path15}. Use --force to overwrite.`);
635
+ this.path = path15;
636
636
  if (Error.captureStackTrace) {
637
637
  Error.captureStackTrace(this, _FileExistsError);
638
638
  }
@@ -668,9 +668,9 @@ var init_errors3 = __esm({
668
668
  name = "BackupNotFoundError";
669
669
  /** Path to backup file that was not found */
670
670
  path;
671
- constructor(path14) {
672
- super(`Backup file not found: ${path14}`);
673
- this.path = path14;
671
+ constructor(path15) {
672
+ super(`Backup file not found: ${path15}`);
673
+ this.path = path15;
674
674
  if (Error.captureStackTrace) {
675
675
  Error.captureStackTrace(this, _BackupNotFoundError);
676
676
  }
@@ -682,9 +682,9 @@ var init_errors3 = __esm({
682
682
  path;
683
683
  /** Reason for invalidity */
684
684
  reason;
685
- constructor(path14, reason) {
686
- super(`Invalid backup file: ${path14}. ${reason}`);
687
- this.path = path14;
685
+ constructor(path15, reason) {
686
+ super(`Invalid backup file: ${path15}. ${reason}`);
687
+ this.path = path15;
688
688
  this.reason = reason;
689
689
  if (Error.captureStackTrace) {
690
690
  Error.captureStackTrace(this, _InvalidBackupError);
@@ -695,9 +695,9 @@ var init_errors3 = __esm({
695
695
  name = "TargetExistsError";
696
696
  /** Path to existing target */
697
697
  path;
698
- constructor(path14) {
699
- super(`Target already has Cursor data: ${path14}. Use --force to overwrite.`);
700
- this.path = path14;
698
+ constructor(path15) {
699
+ super(`Target already has Cursor data: ${path15}. Use --force to overwrite.`);
700
+ this.path = path15;
701
701
  if (Error.captureStackTrace) {
702
702
  Error.captureStackTrace(this, _TargetExistsError);
703
703
  }
@@ -718,9 +718,9 @@ var init_errors3 = __esm({
718
718
  }
719
719
  });
720
720
 
721
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/platform.js
721
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/platform.js
722
722
  import { existsSync as existsSync6, readFileSync as readFileSync7, readdirSync as readdirSync3 } from "node:fs";
723
- import { homedir as homedir8 } from "node:os";
723
+ import { homedir as homedir9 } from "node:os";
724
724
  import { basename as basename2, dirname as dirname3, join as join6 } from "node:path";
725
725
  function detectPlatform() {
726
726
  switch (process.platform) {
@@ -757,7 +757,7 @@ function detectPreferredStackSource(customDataPath) {
757
757
  return findStoreRoot(explicit) ? "store" : "composer";
758
758
  }
759
759
  const storeRootEnv = process.env["CURSOR_STORE_ROOT"];
760
- const defaultStoreRoot = join6(homedir8(), ".cursor");
760
+ const defaultStoreRoot = join6(homedir9(), ".cursor");
761
761
  if (storeRootEnv && !pathsEqual(storeRootEnv, defaultStoreRoot)) {
762
762
  return "store";
763
763
  }
@@ -767,11 +767,11 @@ function getDefaultCursorDataPath(platform4) {
767
767
  const p8 = platform4 ?? detectPlatform();
768
768
  switch (p8) {
769
769
  case "windows":
770
- return join6(process.env["APPDATA"] ?? join6(homedir8(), "AppData", "Roaming"), "Cursor", "User", "workspaceStorage");
770
+ return join6(process.env["APPDATA"] ?? join6(homedir9(), "AppData", "Roaming"), "Cursor", "User", "workspaceStorage");
771
771
  case "macos":
772
- return join6(homedir8(), "Library", "Application Support", "Cursor", "User", "workspaceStorage");
772
+ return join6(homedir9(), "Library", "Application Support", "Cursor", "User", "workspaceStorage");
773
773
  case "linux":
774
- return join6(homedir8(), ".config", "Cursor", "User", "workspaceStorage");
774
+ return join6(homedir9(), ".config", "Cursor", "User", "workspaceStorage");
775
775
  }
776
776
  }
777
777
  function getCursorDataPath(customPath) {
@@ -787,23 +787,23 @@ function getCursorDataPath(customPath) {
787
787
  function getGlobalStoragePath(customDataPath) {
788
788
  return join6(dirname3(getCursorDataPath(customDataPath)), "globalStorage");
789
789
  }
790
- function expandPath(path14) {
791
- if (path14.startsWith("~")) {
792
- return join6(homedir8(), path14.slice(1));
790
+ function expandPath(path15) {
791
+ if (path15.startsWith("~")) {
792
+ return join6(homedir9(), path15.slice(1));
793
793
  }
794
- return path14;
794
+ return path15;
795
795
  }
796
- function contractPath(path14) {
797
- const home = homedir8();
798
- if (path14.startsWith(home)) {
799
- return "~" + path14.slice(home.length);
796
+ function contractPath(path15) {
797
+ const home = homedir9();
798
+ if (path15.startsWith(home)) {
799
+ return "~" + path15.slice(home.length);
800
800
  }
801
- return path14;
801
+ return path15;
802
802
  }
803
803
  function normalizePath(filePath) {
804
804
  let normalized = filePath;
805
805
  if (normalized.startsWith("~")) {
806
- normalized = join6(homedir8(), normalized.slice(1));
806
+ normalized = join6(homedir9(), normalized.slice(1));
807
807
  }
808
808
  while (normalized.length > 1 && normalized.endsWith("/")) {
809
809
  normalized = normalized.slice(0, -1);
@@ -908,28 +908,28 @@ function resolveStoreRoot(customDataPath) {
908
908
  const storeEnv = process.env["CURSOR_STORE_ROOT"];
909
909
  if (storeEnv)
910
910
  return findStoreRoot(storeEnv) ?? storeEnv;
911
- return join6(homedir8(), ".cursor");
911
+ return join6(homedir9(), ".cursor");
912
912
  }
913
913
  var cachedIsWsl, STORE_CHILDREN;
914
914
  var init_platform = __esm({
915
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/platform.js"() {
915
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/platform.js"() {
916
916
  "use strict";
917
917
  STORE_CHILDREN = ["chats", "projects", "acp-sessions"];
918
918
  }
919
919
  });
920
920
 
921
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/utils.js
921
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/utils.js
922
922
  function getDefaultDataPath() {
923
923
  return getCursorDataPath();
924
924
  }
925
925
  var init_utils = __esm({
926
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/utils.js"() {
926
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/utils.js"() {
927
927
  "use strict";
928
928
  init_platform();
929
929
  }
930
930
  });
931
931
 
932
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/session-identity.js
932
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-identity.js
933
933
  import { createHash } from "node:crypto";
934
934
  function compareCodePoints2(left, right) {
935
935
  const leftPoints = Array.from(left);
@@ -1177,14 +1177,14 @@ function allocateToolCallIdentities(stableMessageId, calls, projection = "store"
1177
1177
  }
1178
1178
  var MESSAGE_IDENTITY_VERSION, REPLICA_EQUIVALENCE_VERSION;
1179
1179
  var init_session_identity = __esm({
1180
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/session-identity.js"() {
1180
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-identity.js"() {
1181
1181
  "use strict";
1182
1182
  MESSAGE_IDENTITY_VERSION = 1;
1183
1183
  REPLICA_EQUIVALENCE_VERSION = 1;
1184
1184
  }
1185
1185
  });
1186
1186
 
1187
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/timestamps.js
1187
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/timestamps.js
1188
1188
  function isValidTimestamp(value) {
1189
1189
  return value instanceof Date && Number.isFinite(value.getTime());
1190
1190
  }
@@ -1227,7 +1227,7 @@ function resolveSessionField(input, field, extrema) {
1227
1227
  }, directTimes2[0].getTime());
1228
1228
  return { value: new Date(selectedMs), source: "direct-message" };
1229
1229
  }
1230
- return { value: new Date(UNKNOWN_TIMESTAMP_EPOCH_MS), source: "epoch-unknown" };
1230
+ return { value: new Date(UNKNOWN_TIMESTAMP_EPOCH_MS2), source: "epoch-unknown" };
1231
1231
  }
1232
1232
  function resolveSessionTimestamps(input) {
1233
1233
  const created = resolveSessionField(input, "createdAt", "earliest");
@@ -1242,7 +1242,7 @@ function resolveSessionTimestamps(input) {
1242
1242
  function getPublicMessageTimestamp(message) {
1243
1243
  if (!isValidTimestamp(message.timestamp)) {
1244
1244
  return {
1245
- timestamp: new Date(UNKNOWN_TIMESTAMP_EPOCH_MS),
1245
+ timestamp: new Date(UNKNOWN_TIMESTAMP_EPOCH_MS2),
1246
1246
  timestampSource: "unknown"
1247
1247
  };
1248
1248
  }
@@ -1298,15 +1298,15 @@ function resolveMessageTimestamps(messages, sessionAnchor) {
1298
1298
  message.timestampSource = "session-fallback";
1299
1299
  continue;
1300
1300
  }
1301
- message.timestamp = new Date(UNKNOWN_TIMESTAMP_EPOCH_MS);
1301
+ message.timestamp = new Date(UNKNOWN_TIMESTAMP_EPOCH_MS2);
1302
1302
  message.timestampSource = "unknown";
1303
1303
  }
1304
1304
  }
1305
- var UNKNOWN_TIMESTAMP_EPOCH_MS, DIRECT_MESSAGE_TIMESTAMP_SOURCES;
1305
+ var UNKNOWN_TIMESTAMP_EPOCH_MS2, DIRECT_MESSAGE_TIMESTAMP_SOURCES;
1306
1306
  var init_timestamps = __esm({
1307
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/timestamps.js"() {
1307
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/timestamps.js"() {
1308
1308
  "use strict";
1309
- UNKNOWN_TIMESTAMP_EPOCH_MS = 0;
1309
+ UNKNOWN_TIMESTAMP_EPOCH_MS2 = 0;
1310
1310
  DIRECT_MESSAGE_TIMESTAMP_SOURCES = /* @__PURE__ */ new Set([
1311
1311
  "composer-created-at",
1312
1312
  "composer-timing",
@@ -1315,7 +1315,7 @@ var init_timestamps = __esm({
1315
1315
  }
1316
1316
  });
1317
1317
 
1318
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/workspace-scope.js
1318
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/workspace-scope.js
1319
1319
  function compareCodePoints3(left, right) {
1320
1320
  const leftPoints = Array.from(left, (value) => value.codePointAt(0));
1321
1321
  const rightPoints = Array.from(right, (value) => value.codePointAt(0));
@@ -1439,8 +1439,8 @@ function normalizePublicWorkspacePath(value) {
1439
1439
  return void 0;
1440
1440
  }
1441
1441
  }
1442
- function exactComparisonKey(path14) {
1443
- return path14.caseInsensitive ? path14.path.toLowerCase() : path14.path;
1442
+ function exactComparisonKey(path15) {
1443
+ return path15.caseInsensitive ? path15.path.toLowerCase() : path15.path;
1444
1444
  }
1445
1445
  function componentsEndWith(candidate, request2) {
1446
1446
  if (request2.drive && candidate.drive !== request2.drive)
@@ -1486,14 +1486,14 @@ function resolveWorkspaceScope(request2, memberships) {
1486
1486
  return { kind: "not-found", normalizedRequest: normalizedRequest.path };
1487
1487
  }
1488
1488
  var init_workspace_scope = __esm({
1489
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/workspace-scope.js"() {
1489
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/workspace-scope.js"() {
1490
1490
  "use strict";
1491
1491
  init_errors();
1492
1492
  init_errors();
1493
1493
  }
1494
1494
  });
1495
1495
 
1496
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/parser.js
1496
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/parser.js
1497
1497
  function serializeToolCall(tc) {
1498
1498
  const obj = { name: tc.name, status: tc.status };
1499
1499
  if (tc.id !== void 0)
@@ -2250,7 +2250,7 @@ function exportToJson(session, workspacePath) {
2250
2250
  }
2251
2251
  var TOOL_DISPLAY_NAMES, TOOL_IDENTITY_PARAMS;
2252
2252
  var init_parser = __esm({
2253
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/parser.js"() {
2253
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/parser.js"() {
2254
2254
  "use strict";
2255
2255
  init_session_identity();
2256
2256
  init_timestamps();
@@ -2297,7 +2297,7 @@ var init_parser = __esm({
2297
2297
  }
2298
2298
  });
2299
2299
 
2300
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/cli/formatters/table.js
2300
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/cli/formatters/table.js
2301
2301
  import pc from "picocolors";
2302
2302
  function isToolCall(content) {
2303
2303
  return content.startsWith("[Tool:");
@@ -2335,7 +2335,7 @@ function validateMessageTypes(types) {
2335
2335
  return types.filter((t) => !MESSAGE_TYPES.includes(t));
2336
2336
  }
2337
2337
  var init_table = __esm({
2338
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/cli/formatters/table.js"() {
2338
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/cli/formatters/table.js"() {
2339
2339
  "use strict";
2340
2340
  init_types();
2341
2341
  init_parser();
@@ -2343,7 +2343,7 @@ var init_table = __esm({
2343
2343
  }
2344
2344
  });
2345
2345
 
2346
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/config.js
2346
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/config.js
2347
2347
  function validateConfig(config) {
2348
2348
  if (!config)
2349
2349
  return;
@@ -2404,7 +2404,7 @@ function mergeWithDefaults(config) {
2404
2404
  }
2405
2405
  var VALID_SQLITE_DRIVERS;
2406
2406
  var init_config = __esm({
2407
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/config.js"() {
2407
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/config.js"() {
2408
2408
  "use strict";
2409
2409
  init_errors3();
2410
2410
  init_platform();
@@ -2412,7 +2412,7 @@ var init_config = __esm({
2412
2412
  }
2413
2413
  });
2414
2414
 
2415
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/debug.js
2415
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/debug.js
2416
2416
  function debugLog(message) {
2417
2417
  if (process.env["DEBUG"] || process.env["CURSOR_HISTORY_DEBUG"]) {
2418
2418
  console.error(`[cursor-history:sqlite] ${message}`);
@@ -2424,12 +2424,12 @@ function debugLogStorage(message) {
2424
2424
  }
2425
2425
  }
2426
2426
  var init_debug = __esm({
2427
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/debug.js"() {
2427
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/debug.js"() {
2428
2428
  "use strict";
2429
2429
  }
2430
2430
  });
2431
2431
 
2432
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/io-observer.js
2432
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/io-observer.js
2433
2433
  function requireSafeIdentity(name, value) {
2434
2434
  if (typeof value !== "string" || value.length === 0 || /[\r\n\0]/.test(value)) {
2435
2435
  throw new TypeError(`${name} must be a non-empty single-line string.`);
@@ -2477,7 +2477,7 @@ function observeAdapterIo(context, input) {
2477
2477
  }
2478
2478
  var IO_RESOURCE_CLASSIFICATIONS, IoObserverError;
2479
2479
  var init_io_observer = __esm({
2480
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/io-observer.js"() {
2480
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/io-observer.js"() {
2481
2481
  "use strict";
2482
2482
  IO_RESOURCE_CLASSIFICATIONS = Object.freeze({
2483
2483
  "workspace-root-directory": "catalog-metadata",
@@ -2516,7 +2516,7 @@ var init_io_observer = __esm({
2516
2516
  }
2517
2517
  });
2518
2518
 
2519
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/observed.js
2519
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/observed.js
2520
2520
  function requestIdentity(request2) {
2521
2521
  return request2.ioResource ?? { resourceClass: "unclassified-resource" };
2522
2522
  }
@@ -2599,7 +2599,7 @@ function observeDatabaseBackup(request2) {
2599
2599
  }
2600
2600
  var ObservedStatement, ObservedDatabase;
2601
2601
  var init_observed = __esm({
2602
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/observed.js"() {
2602
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/observed.js"() {
2603
2603
  "use strict";
2604
2604
  init_io_observer();
2605
2605
  ObservedStatement = class {
@@ -2659,13 +2659,13 @@ var init_observed = __esm({
2659
2659
  }
2660
2660
  });
2661
2661
 
2662
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/registry.js
2662
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/registry.js
2663
2663
  function missingCapabilities(profile, required) {
2664
2664
  return [...required].filter((capability) => !profile.capabilities.has(capability));
2665
2665
  }
2666
2666
  var AUTO_DRIVER_ORDER, READ_SESSION_REQUEST, MIGRATION_REQUEST, BACKUP_REQUEST, DriverRegistry, registry;
2667
2667
  var init_registry = __esm({
2668
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/registry.js"() {
2668
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/registry.js"() {
2669
2669
  "use strict";
2670
2670
  init_errors2();
2671
2671
  init_debug();
@@ -2842,14 +2842,14 @@ var init_registry = __esm({
2842
2842
  return this.selectDatabaseDriver(request2);
2843
2843
  }
2844
2844
  /** Open a database in read-only mode. */
2845
- async openDatabase(path14, request2 = READ_SESSION_REQUEST) {
2845
+ async openDatabase(path15, request2 = READ_SESSION_REQUEST) {
2846
2846
  const driver = await this.ensureDriver(request2);
2847
- return openObservedDatabase(request2.io, request2, () => driver.open(path14, { readonly: true }));
2847
+ return openObservedDatabase(request2.io, request2, () => driver.open(path15, { readonly: true }));
2848
2848
  }
2849
2849
  /** Open a database in read-write mode. */
2850
- async openDatabaseReadWrite(path14, request2 = MIGRATION_REQUEST) {
2850
+ async openDatabaseReadWrite(path15, request2 = MIGRATION_REQUEST) {
2851
2851
  const driver = await this.ensureDriver(request2);
2852
- return openObservedDatabase(request2.io, request2, () => driver.open(path14, { readonly: false }));
2852
+ return openObservedDatabase(request2.io, request2, () => driver.open(path15, { readonly: false }));
2853
2853
  }
2854
2854
  /**
2855
2855
  * Synchronous database open (requires a completed capability-aware selection).
@@ -2857,11 +2857,11 @@ var init_registry = __esm({
2857
2857
  * This remains for backup parsing paths that perform synchronous reads after an awaited
2858
2858
  * selection or snapshot operation.
2859
2859
  */
2860
- openSync(path14, options) {
2860
+ openSync(path15, options) {
2861
2861
  if (!this.currentDriver) {
2862
2862
  throw new Error("No driver is currently active. Capability-aware selection must complete before using openSync().");
2863
2863
  }
2864
- return this.currentDriver.open(path14, options);
2864
+ return this.currentDriver.open(path15, options);
2865
2865
  }
2866
2866
  /** Create an online database snapshot with a provider satisfying the complete request. */
2867
2867
  async backupDatabase(sourcePath, destPath, request2 = BACKUP_REQUEST) {
@@ -2882,7 +2882,7 @@ var init_registry = __esm({
2882
2882
  }
2883
2883
  });
2884
2884
 
2885
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/drivers/better-sqlite3.js
2885
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/better-sqlite3.js
2886
2886
  function unavailableProfile(reason) {
2887
2887
  return {
2888
2888
  driver: "better-sqlite3",
@@ -2955,7 +2955,7 @@ async function loadBetterSqlite3Profile() {
2955
2955
  }
2956
2956
  var BetterSqlite3, betterSqlite3ProfilePromise, BetterSqlite3Statement, BetterSqlite3Database, betterSqlite3Driver;
2957
2957
  var init_better_sqlite3 = __esm({
2958
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/drivers/better-sqlite3.js"() {
2958
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/better-sqlite3.js"() {
2959
2959
  "use strict";
2960
2960
  init_debug();
2961
2961
  BetterSqlite3 = null;
@@ -3008,12 +3008,12 @@ var init_better_sqlite3 = __esm({
3008
3008
  getCapabilityProfile() {
3009
3009
  return loadBetterSqlite3Profile();
3010
3010
  },
3011
- open(path14, options) {
3011
+ open(path15, options) {
3012
3012
  if (!BetterSqlite3) {
3013
3013
  throw new Error("better-sqlite3 is not loaded. Call isAvailable() first.");
3014
3014
  }
3015
- const db = new BetterSqlite3(path14, { readonly: options.readonly });
3016
- debugLog(`Opened database with better-sqlite3: ${path14} (readonly: ${options.readonly})`);
3015
+ const db = new BetterSqlite3(path15, { readonly: options.readonly });
3016
+ debugLog(`Opened database with better-sqlite3: ${path15} (readonly: ${options.readonly})`);
3017
3017
  return new BetterSqlite3Database(db);
3018
3018
  },
3019
3019
  async backup(sourcePath, destPath) {
@@ -3033,7 +3033,7 @@ var init_better_sqlite3 = __esm({
3033
3033
  }
3034
3034
  });
3035
3035
 
3036
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/drivers/node-sqlite.js
3036
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/node-sqlite.js
3037
3037
  function unavailableProfile2(reason) {
3038
3038
  return {
3039
3039
  driver: "node:sqlite",
@@ -3128,7 +3128,7 @@ async function loadNodeSqliteProfile() {
3128
3128
  }
3129
3129
  var nodeSqliteModule, nodeSqliteProfilePromise, NodeSqliteStatementWrapper, NodeSqliteDatabaseWrapper, nodeSqliteDriver;
3130
3130
  var init_node_sqlite = __esm({
3131
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/drivers/node-sqlite.js"() {
3131
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/node-sqlite.js"() {
3132
3132
  "use strict";
3133
3133
  init_debug();
3134
3134
  init_errors2();
@@ -3204,12 +3204,12 @@ var init_node_sqlite = __esm({
3204
3204
  getCapabilityProfile() {
3205
3205
  return loadNodeSqliteProfile();
3206
3206
  },
3207
- open(path14, options) {
3207
+ open(path15, options) {
3208
3208
  if (!nodeSqliteModule) {
3209
3209
  throw new Error("node:sqlite is not loaded. Call isAvailable() first.");
3210
3210
  }
3211
- const db = new nodeSqliteModule.DatabaseSync(path14, { readOnly: options.readonly });
3212
- debugLog(`Opened database with node:sqlite: ${path14} (readonly: ${options.readonly})`);
3211
+ const db = new nodeSqliteModule.DatabaseSync(path15, { readOnly: options.readonly });
3212
+ debugLog(`Opened database with node:sqlite: ${path15} (readonly: ${options.readonly})`);
3213
3213
  return new NodeSqliteDatabaseWrapper(db, options.readonly);
3214
3214
  },
3215
3215
  async backup(sourcePath, destPath) {
@@ -3232,12 +3232,12 @@ var init_node_sqlite = __esm({
3232
3232
  }
3233
3233
  });
3234
3234
 
3235
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/index.js
3236
- async function openDatabase(path14, request2) {
3237
- return registry.openDatabase(path14, request2);
3235
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/index.js
3236
+ async function openDatabase(path15, request2) {
3237
+ return registry.openDatabase(path15, request2);
3238
3238
  }
3239
- async function openDatabaseReadWrite(path14, request2) {
3240
- return registry.openDatabaseReadWrite(path14, request2);
3239
+ async function openDatabaseReadWrite(path15, request2) {
3240
+ return registry.openDatabaseReadWrite(path15, request2);
3241
3241
  }
3242
3242
  function getActiveDriver() {
3243
3243
  return registry.getActiveDriver();
@@ -3255,7 +3255,7 @@ async function backupDatabase(sourcePath, destPath, request2) {
3255
3255
  return registry.backupDatabase(sourcePath, destPath, request2);
3256
3256
  }
3257
3257
  var init_database = __esm({
3258
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/database/index.js"() {
3258
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/index.js"() {
3259
3259
  "use strict";
3260
3260
  init_errors2();
3261
3261
  init_registry();
@@ -3266,7 +3266,7 @@ var init_database = __esm({
3266
3266
  }
3267
3267
  });
3268
3268
 
3269
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/private-temp.js
3269
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/private-temp.js
3270
3270
  import { chmodSync, closeSync, constants, fchmodSync, fstatSync, fsyncSync, lstatSync, mkdtempSync, openSync, readFileSync as readFileSync8, readlinkSync, readdirSync as readdirSync4, realpathSync, rmdirSync, statSync as statSync2, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
3271
3271
  import { tmpdir } from "node:os";
3272
3272
  import { basename as basename3, isAbsolute, join as join7, relative as relative2, resolve, sep } from "node:path";
@@ -3374,8 +3374,8 @@ function exclusiveFlags() {
3374
3374
  flags |= constants.O_NOFOLLOW;
3375
3375
  return flags;
3376
3376
  }
3377
- function createExclusivePrivateFile(path14, contents) {
3378
- const descriptor = openSync(path14, exclusiveFlags(), 384);
3377
+ function createExclusivePrivateFile(path15, contents) {
3378
+ const descriptor = openSync(path15, exclusiveFlags(), 384);
3379
3379
  try {
3380
3380
  if (IS_PERMISSION_AWARE_POSIX)
3381
3381
  fchmodSync(descriptor, 384);
@@ -3387,10 +3387,10 @@ function createExclusivePrivateFile(path14, contents) {
3387
3387
  closeSync(descriptor);
3388
3388
  }
3389
3389
  }
3390
- function attemptRemoveEntryNoFollow(path14) {
3390
+ function attemptRemoveEntryNoFollow(path15) {
3391
3391
  let stats;
3392
3392
  try {
3393
- stats = lstatSync(path14);
3393
+ stats = lstatSync(path15);
3394
3394
  } catch (error) {
3395
3395
  if (!isMissing(error)) {
3396
3396
  }
@@ -3398,13 +3398,13 @@ function attemptRemoveEntryNoFollow(path14) {
3398
3398
  }
3399
3399
  if (stats.isDirectory() && !stats.isSymbolicLink()) {
3400
3400
  try {
3401
- rmdirSync(path14);
3401
+ rmdirSync(path15);
3402
3402
  } catch {
3403
3403
  }
3404
3404
  return;
3405
3405
  }
3406
3406
  try {
3407
- unlinkSync(path14);
3407
+ unlinkSync(path15);
3408
3408
  } catch {
3409
3409
  }
3410
3410
  }
@@ -3432,9 +3432,9 @@ function attemptRemoveWorkspaceNoFollow(directoryPath) {
3432
3432
  } catch {
3433
3433
  }
3434
3434
  }
3435
- function mayStillExist(path14) {
3435
+ function mayStillExist(path15) {
3436
3436
  try {
3437
- lstatSync(path14);
3437
+ lstatSync(path15);
3438
3438
  return true;
3439
3439
  } catch (error) {
3440
3440
  return !isMissing(error);
@@ -3707,7 +3707,7 @@ function createPrivateTempWorkspace(options) {
3707
3707
  }
3708
3708
  var PRIVATE_TEMP_MARKER_FILENAME, PRIVATE_TEMP_MARKER_MAX_BYTES, CATCHABLE_SIGNALS, SIGNAL_NUMBERS, IS_PERMISSION_AWARE_POSIX, CURRENT_UID, FALLBACK_CURRENT_PROCESS_TOKEN, activeWorkspaces, installedSignalHandlers, handlingSignal, PrivateTempWorkspaceImpl;
3709
3709
  var init_private_temp = __esm({
3710
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/private-temp.js"() {
3710
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/private-temp.js"() {
3711
3711
  "use strict";
3712
3712
  init_errors();
3713
3713
  PRIVATE_TEMP_MARKER_FILENAME = ".cursor-history-private-temp-v1.json";
@@ -3731,8 +3731,8 @@ var init_private_temp = __esm({
3731
3731
  stateValue = "open";
3732
3732
  abortSignal;
3733
3733
  abortHandler;
3734
- constructor(path14, marker, markerPath, signal) {
3735
- this.path = path14;
3734
+ constructor(path15, marker, markerPath, signal) {
3735
+ this.path = path15;
3736
3736
  this.marker = marker;
3737
3737
  this.trackedPaths.add(markerPath);
3738
3738
  this.abortSignal = signal;
@@ -3763,9 +3763,9 @@ var init_private_temp = __esm({
3763
3763
  createExclusivePrivateFile(filePath);
3764
3764
  return filePath;
3765
3765
  }
3766
- register(path14) {
3766
+ register(path15) {
3767
3767
  this.assertOpen();
3768
- const candidatePath = resolve(path14);
3768
+ const candidatePath = resolve(path15);
3769
3769
  if (!isDirectChildPath(this.path, candidatePath)) {
3770
3770
  throw new TypeError("Tracked temporary artifacts must be direct children of their private workspace.");
3771
3771
  }
@@ -3779,8 +3779,8 @@ var init_private_temp = __esm({
3779
3779
  this.abortSignal.removeEventListener("abort", this.abortHandler);
3780
3780
  }
3781
3781
  const tracked = [...this.trackedPaths].sort((left, right) => right.length - left.length);
3782
- for (const path14 of tracked)
3783
- attemptRemoveEntryNoFollow(path14);
3782
+ for (const path15 of tracked)
3783
+ attemptRemoveEntryNoFollow(path15);
3784
3784
  attemptRemoveWorkspaceNoFollow(this.path);
3785
3785
  const residuePaths = tracked.filter(mayStillExist);
3786
3786
  if (mayStillExist(this.path))
@@ -3796,16 +3796,16 @@ var init_private_temp = __esm({
3796
3796
  }
3797
3797
  });
3798
3798
 
3799
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/package-version.generated.js
3799
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/package-version.generated.js
3800
3800
  var PACKAGE_VERSION;
3801
3801
  var init_package_version_generated = __esm({
3802
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/package-version.generated.js"() {
3802
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/package-version.generated.js"() {
3803
3803
  "use strict";
3804
3804
  PACKAGE_VERSION = "0.18.0";
3805
3805
  }
3806
3806
  });
3807
3807
 
3808
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/source-read-limits.js
3808
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/source-read-limits.js
3809
3809
  function assertRelationship(limits, left, right) {
3810
3810
  if (limits[left] > limits[right]) {
3811
3811
  throw new SourceLimitConfigurationError(left, limits[left], `${left} must be less than or equal to ${right}`);
@@ -3905,7 +3905,7 @@ function decodeDeterministicUtf8(value, sourceKind, outcome, allowLeadingBom = t
3905
3905
  }
3906
3906
  var RESOLVED_SOURCE_READ_LIMITS, SOURCE_READ_LIMITS_V1_DEFAULTS, SOURCE_READ_LIMIT_FIELDS, SOURCE_READ_LIMIT_FIELD_SET, UTF8_BOM, JsonlSourceReadBudget, SqliteSourceReadBudget;
3907
3907
  var init_source_read_limits = __esm({
3908
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/source-read-limits.js"() {
3908
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/source-read-limits.js"() {
3909
3909
  "use strict";
3910
3910
  init_errors();
3911
3911
  RESOLVED_SOURCE_READ_LIMITS = /* @__PURE__ */ new WeakSet();
@@ -4034,7 +4034,7 @@ var init_source_read_limits = __esm({
4034
4034
  }
4035
4035
  });
4036
4036
 
4037
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/zip-stream.js
4037
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/zip-stream.js
4038
4038
  import { createHash as createHash2 } from "node:crypto";
4039
4039
  import { open as open2, unlink } from "node:fs/promises";
4040
4040
  import { Readable as Readable2, Transform, Writable } from "node:stream";
@@ -4803,12 +4803,12 @@ async function writeBoundedZipArchive(destinationPath, inputs, options = {}) {
4803
4803
  throw error;
4804
4804
  }
4805
4805
  }
4806
- async function openBoundedZipArchive(path14, options) {
4807
- return BoundedZipArchive.open(path14, options);
4806
+ async function openBoundedZipArchive(path15, options) {
4807
+ return BoundedZipArchive.open(path15, options);
4808
4808
  }
4809
4809
  var EOCD_SIGNATURE, ZIP64_EOCD_SIGNATURE, ZIP64_LOCATOR_SIGNATURE, CENTRAL_FILE_SIGNATURE, LOCAL_FILE_SIGNATURE, ZIP64_EXTRA_FIELD_ID, MAX_EOCD_SEARCH_BYTES, UTF8_FLAG, ENCRYPTED_FLAG, STRONG_ENCRYPTION_FLAG, DATA_DESCRIPTOR_FLAG, STORE_METHOD, DEFLATE_METHOD, MANIFEST_MEMORY_LIMIT, STREAM_CHUNK_BYTES, ZIP_LIMIT_FIELDS, ZipArchiveFormatError, CRC32_TABLE, CompressedVerifier, OutputIntegrityVerifier, BoundedZipArchive;
4810
4810
  var init_zip_stream = __esm({
4811
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/zip-stream.js"() {
4811
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/zip-stream.js"() {
4812
4812
  "use strict";
4813
4813
  init_errors();
4814
4814
  init_source_read_limits();
@@ -4950,8 +4950,8 @@ var init_zip_stream = __esm({
4950
4950
  actualAggregateBytes = 0;
4951
4951
  byName;
4952
4952
  localEndBoundary;
4953
- constructor(path14, entries, archiveSize, centralOffset, handle, limits, signal, io) {
4954
- this.path = path14;
4953
+ constructor(path15, entries, archiveSize, centralOffset, handle, limits, signal, io) {
4954
+ this.path = path15;
4955
4955
  this.entries = entries;
4956
4956
  this.archiveSize = archiveSize;
4957
4957
  this.centralOffset = centralOffset;
@@ -4963,7 +4963,7 @@ var init_zip_stream = __esm({
4963
4963
  const offsets = entries.map((entry) => entry.localHeaderOffset).sort((a, b) => a - b);
4964
4964
  this.localEndBoundary = new Map(offsets.map((offset, index) => [offset, offsets[index + 1] ?? centralOffset]));
4965
4965
  }
4966
- static async open(path14, options = {}) {
4966
+ static async open(path15, options = {}) {
4967
4967
  const limits = resolveSourceReadLimits(options.sourceReadLimits);
4968
4968
  throwIfAborted(options.signal);
4969
4969
  if (options.io) {
@@ -4973,7 +4973,7 @@ var init_zip_stream = __esm({
4973
4973
  resourceClass: "backup-central-directory"
4974
4974
  });
4975
4975
  }
4976
- const handle = await open2(path14, "r");
4976
+ const handle = await open2(path15, "r");
4977
4977
  try {
4978
4978
  if (options.io) {
4979
4979
  observeAdapterIo(options.io, {
@@ -4989,7 +4989,7 @@ var init_zip_stream = __esm({
4989
4989
  const archiveSize = toSafeOffset(metadata.size, "ZIP archive size");
4990
4990
  const central = await locateCentralDirectory(handle, archiveSize, options.signal);
4991
4991
  const entries = await parseCentralDirectory(handle, archiveSize, central, limits, options.signal);
4992
- return new _BoundedZipArchive(path14, entries, archiveSize, central.offset, handle, limits, options.signal, options.io);
4992
+ return new _BoundedZipArchive(path15, entries, archiveSize, central.offset, handle, limits, options.signal, options.io);
4993
4993
  } catch (error) {
4994
4994
  await handle.close();
4995
4995
  throw error;
@@ -5200,7 +5200,7 @@ var init_zip_stream = __esm({
5200
5200
  }
5201
5201
  });
5202
5202
 
5203
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/composer-sqlite.js
5203
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/composer-sqlite.js
5204
5204
  function exactBlobPrefixPredicate(qualifiedKey) {
5205
5205
  return `${qualifiedKey} >= ? AND ${qualifiedKey} < ? AND ${qualifiedKey} IS NOT NULL AND substr(CAST(${qualifiedKey} AS BLOB), 1, length(CAST(? AS BLOB))) = CAST(? AS BLOB)`;
5206
5206
  }
@@ -5211,6 +5211,15 @@ function exactPrefixUpperBound(prefix) {
5211
5211
  const lastLength = last > 65535 ? 2 : 1;
5212
5212
  return prefix.slice(0, prefix.length - lastLength) + String.fromCodePoint(last + 1);
5213
5213
  }
5214
+ function literalPrefixRange(keyPattern) {
5215
+ const prefix = keyPattern.slice(0, -1);
5216
+ if (!keyPattern.endsWith("%") || prefix.length === 0 || /[%_\\]/.test(prefix))
5217
+ return null;
5218
+ return { lower: prefix, upper: exactPrefixUpperBound(prefix) };
5219
+ }
5220
+ function keyPagePredicate(qualifiedKey, afterKey) {
5221
+ return `${qualifiedKey} ${afterKey === null ? ">=" : ">"} ? AND ${qualifiedKey} < ?`;
5222
+ }
5214
5223
  function abortError3(signal) {
5215
5224
  if (signal.reason instanceof Error && signal.reason.name === "AbortError")
5216
5225
  return signal.reason;
@@ -5317,10 +5326,12 @@ function getBoundedComposerMetadataByKey(db, table, key2, budget, signal) {
5317
5326
  }
5318
5327
  function forEachBoundedComposerMetadata(db, table, keyPattern, budget, visit, signal) {
5319
5328
  const pageRows = budget.limits.sqlitePageRows;
5329
+ const range = literalPrefixRange(keyPattern);
5320
5330
  let afterRowId = null;
5331
+ let afterKey = null;
5321
5332
  while (true) {
5322
5333
  throwIfAborted2(signal);
5323
- const rawPage = db.prepare(`SELECT CAST(${table}.rowid AS TEXT) AS rowId, key, length(CAST(value AS BLOB)) AS byteLength FROM ${table} WHERE key LIKE ? ESCAPE '\\' AND value IS NOT NULL AND ${table}.rowid > COALESCE(?, -1) ORDER BY ${table}.rowid ASC LIMIT ?`).all(keyPattern, afterRowId, pageRows);
5334
+ const rawPage = range ? db.prepare(`SELECT CAST(${table}.rowid AS TEXT) AS rowId, key, length(CAST(value AS BLOB)) AS byteLength FROM ${table} WHERE ${keyPagePredicate(`${table}.key`, afterKey)} AND key LIKE ? ESCAPE '\\' AND value IS NOT NULL ORDER BY ${table}.key ASC LIMIT ?`).all(afterKey ?? range.lower, range.upper, keyPattern, pageRows) : db.prepare(`SELECT CAST(${table}.rowid AS TEXT) AS rowId, key, length(CAST(value AS BLOB)) AS byteLength FROM ${table} WHERE key LIKE ? ESCAPE '\\' AND value IS NOT NULL AND ${table}.rowid > COALESCE(?, -1) ORDER BY ${table}.rowid ASC LIMIT ?`).all(keyPattern, afterRowId, pageRows);
5324
5335
  if (rawPage.length === 0)
5325
5336
  break;
5326
5337
  const fallbackBase = typeof afterRowId === "number" && Number.isSafeInteger(afterRowId) ? afterRowId : -1;
@@ -5334,14 +5345,17 @@ function forEachBoundedComposerMetadata(db, table, keyPattern, budget, visit, si
5334
5345
  if (legacyInlinePage || rawPage.length < pageRows)
5335
5346
  break;
5336
5347
  afterRowId = page[page.length - 1].rowId;
5348
+ afterKey = page[page.length - 1].key;
5337
5349
  }
5338
5350
  }
5339
5351
  function forEachBoundedComposerBubbleMetadata(db, keyPattern, budget, visit, signal) {
5340
5352
  const pageRows = budget.limits.sqlitePageRows;
5353
+ const range = literalPrefixRange(keyPattern);
5341
5354
  let afterRowId = null;
5355
+ let afterKey = null;
5342
5356
  while (true) {
5343
5357
  throwIfAborted2(signal);
5344
- const rawPage = db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(length(CAST(value AS BLOB)), 0) AS byteLength, value IS NULL AS valueIsNull FROM cursorDiskKV WHERE key LIKE ? ESCAPE '\\' AND cursorDiskKV.rowid > COALESCE(?, -1) ORDER BY cursorDiskKV.rowid ASC LIMIT ?`).all(keyPattern, afterRowId, pageRows);
5358
+ const rawPage = range ? db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(length(CAST(value AS BLOB)), 0) AS byteLength, value IS NULL AS valueIsNull FROM cursorDiskKV WHERE ${keyPagePredicate("cursorDiskKV.key", afterKey)} AND key LIKE ? ESCAPE '\\' ORDER BY cursorDiskKV.key ASC LIMIT ?`).all(afterKey ?? range.lower, range.upper, keyPattern, pageRows) : db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(length(CAST(value AS BLOB)), 0) AS byteLength, value IS NULL AS valueIsNull FROM cursorDiskKV WHERE key LIKE ? ESCAPE '\\' AND cursorDiskKV.rowid > COALESCE(?, -1) ORDER BY cursorDiskKV.rowid ASC LIMIT ?`).all(keyPattern, afterRowId, pageRows);
5345
5359
  if (rawPage.length === 0)
5346
5360
  break;
5347
5361
  const fallbackBase = typeof afterRowId === "number" && Number.isSafeInteger(afterRowId) ? afterRowId : -1;
@@ -5355,6 +5369,7 @@ function forEachBoundedComposerBubbleMetadata(db, keyPattern, budget, visit, sig
5355
5369
  if (legacyInlinePage || rawPage.length < pageRows)
5356
5370
  break;
5357
5371
  afterRowId = page[page.length - 1].rowId;
5372
+ afterKey = page[page.length - 1].key;
5358
5373
  }
5359
5374
  }
5360
5375
  function forEachBoundedComposerBubbleMetadataByExactPrefix(db, keyPrefix, budget, visit, signal) {
@@ -5472,13 +5487,13 @@ function forEachBoundedComposerBubbleValueByExactPrefix(db, keyPrefix, budget, v
5472
5487
  forEachBoundedComposerBubbleMetadataByExactPrefix(db, keyPrefix, budget, (metadata) => visit(readAdmittedComposerBubbleValue(db, metadata, budget, signal)), signal);
5473
5488
  }
5474
5489
  var init_composer_sqlite = __esm({
5475
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/composer-sqlite.js"() {
5490
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/composer-sqlite.js"() {
5476
5491
  "use strict";
5477
5492
  init_source_read_limits();
5478
5493
  }
5479
5494
  });
5480
5495
 
5481
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/backup-publication.js
5496
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-publication.js
5482
5497
  import { closeSync as closeSync2, constants as constants2, fchmodSync as fchmodSync2, fstatSync as fstatSync2, lstatSync as lstatSync2, openSync as openSync2 } from "node:fs";
5483
5498
  function projectStat(stat8) {
5484
5499
  return {
@@ -5554,20 +5569,20 @@ function enforcePublishedArchiveMode(outputPath, requestedMode, expectedIdentity
5554
5569
  }
5555
5570
  var DEFAULT_MODE_OPERATIONS;
5556
5571
  var init_backup_publication = __esm({
5557
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/backup-publication.js"() {
5572
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-publication.js"() {
5558
5573
  "use strict";
5559
5574
  init_errors();
5560
5575
  DEFAULT_MODE_OPERATIONS = Object.freeze({
5561
- openNoFollow: (path14) => openSync2(path14, constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0)),
5576
+ openNoFollow: (path15) => openSync2(path15, constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0)),
5562
5577
  statDescriptor: (descriptor) => projectStat(fstatSync2(descriptor, { bigint: true })),
5563
5578
  chmodDescriptor: (descriptor, mode) => fchmodSync2(descriptor, mode),
5564
- statPathNoFollow: (path14) => projectStat(lstatSync2(path14, { bigint: true })),
5579
+ statPathNoFollow: (path15) => projectStat(lstatSync2(path15, { bigint: true })),
5565
5580
  close: (descriptor) => closeSync2(descriptor)
5566
5581
  });
5567
5582
  }
5568
5583
  });
5569
5584
 
5570
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/backup-archive-publication.js
5585
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-archive-publication.js
5571
5586
  import { linkSync, lstatSync as lstatSync3, renameSync, unlinkSync as unlinkSync2 } from "node:fs";
5572
5587
  function errorCode(error) {
5573
5588
  return error instanceof Error && "code" in error ? String(error.code) : void 0;
@@ -5575,9 +5590,9 @@ function errorCode(error) {
5575
5590
  function hasIdentity2(stat8, expected) {
5576
5591
  return stat8.isFile() && stat8.dev === expected.device && stat8.ino === expected.inode;
5577
5592
  }
5578
- function pathIdentityVerified(path14, expected, operations) {
5593
+ function pathIdentityVerified(path15, expected, operations) {
5579
5594
  try {
5580
- return hasIdentity2(operations.statPathNoFollow(path14), expected);
5595
+ return hasIdentity2(operations.statPathNoFollow(path15), expected);
5581
5596
  } catch {
5582
5597
  return false;
5583
5598
  }
@@ -5621,20 +5636,20 @@ function publishBackupArchiveStage(stagePath, outputPath, force, identity, onCom
5621
5636
  }
5622
5637
  var CLEANUP_ATTEMPTS, DEFAULT_OPERATIONS;
5623
5638
  var init_backup_archive_publication = __esm({
5624
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/backup-archive-publication.js"() {
5639
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-archive-publication.js"() {
5625
5640
  "use strict";
5626
5641
  init_errors();
5627
5642
  CLEANUP_ATTEMPTS = 2;
5628
5643
  DEFAULT_OPERATIONS = Object.freeze({
5629
5644
  rename: (sourcePath, destinationPath) => renameSync(sourcePath, destinationPath),
5630
5645
  link: (sourcePath, destinationPath) => linkSync(sourcePath, destinationPath),
5631
- unlink: (path14) => unlinkSync2(path14),
5632
- statPathNoFollow: (path14) => lstatSync3(path14, { bigint: true })
5646
+ unlink: (path15) => unlinkSync2(path15),
5647
+ statPathNoFollow: (path15) => lstatSync3(path15, { bigint: true })
5633
5648
  });
5634
5649
  }
5635
5650
  });
5636
5651
 
5637
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/restore-publication.js
5652
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/restore-publication.js
5638
5653
  import { linkSync as linkSync2, lstatSync as lstatSync4, renameSync as renameSync2, unlinkSync as unlinkSync3 } from "node:fs";
5639
5654
  function errorCode2(error) {
5640
5655
  return error instanceof Error && "code" in error ? String(error.code) : void 0;
@@ -5642,8 +5657,8 @@ function errorCode2(error) {
5642
5657
  function hasIdentity3(stat8, expected) {
5643
5658
  return stat8.isFile() && stat8.dev === expected.device && stat8.ino === expected.inode;
5644
5659
  }
5645
- function cleanupError(path14, cause, identityVerified = true) {
5646
- const error = new TemporaryArtifactCleanupError(identityVerified ? [path14] : [], identityVerified ? [] : [path14]);
5660
+ function cleanupError(path15, cause, identityVerified = true) {
5661
+ const error = new TemporaryArtifactCleanupError(identityVerified ? [path15] : [], identityVerified ? [] : [path15]);
5647
5662
  Object.defineProperty(error, "cause", { configurable: true, value: cause });
5648
5663
  return error;
5649
5664
  }
@@ -5684,20 +5699,20 @@ function commitRestorePublication(publicationPath, destinationPath, replaceExist
5684
5699
  }
5685
5700
  var CLEANUP_ATTEMPTS2, DEFAULT_OPERATIONS2;
5686
5701
  var init_restore_publication = __esm({
5687
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/restore-publication.js"() {
5702
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/restore-publication.js"() {
5688
5703
  "use strict";
5689
5704
  init_errors();
5690
5705
  CLEANUP_ATTEMPTS2 = 2;
5691
5706
  DEFAULT_OPERATIONS2 = Object.freeze({
5692
5707
  rename: (sourcePath, destinationPath) => renameSync2(sourcePath, destinationPath),
5693
5708
  link: (sourcePath, destinationPath) => linkSync2(sourcePath, destinationPath),
5694
- unlink: (path14) => unlinkSync3(path14),
5695
- statPathNoFollow: (path14) => lstatSync4(path14, { bigint: true })
5709
+ unlink: (path15) => unlinkSync3(path15),
5710
+ statPathNoFollow: (path15) => lstatSync4(path15, { bigint: true })
5696
5711
  });
5697
5712
  }
5698
5713
  });
5699
5714
 
5700
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/session-id.js
5715
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-id.js
5701
5716
  function isNativeCursorUuid(sessionId) {
5702
5717
  return NATIVE_CURSOR_UUID.test(sessionId);
5703
5718
  }
@@ -5737,16 +5752,16 @@ function groupSessionIdSpellings(sessionIds) {
5737
5752
  }
5738
5753
  var NATIVE_CURSOR_UUID;
5739
5754
  var init_session_id = __esm({
5740
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/session-id.js"() {
5755
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-id.js"() {
5741
5756
  "use strict";
5742
5757
  NATIVE_CURSOR_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
5743
5758
  }
5744
5759
  });
5745
5760
 
5746
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/backup.js
5761
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup.js
5747
5762
  import { createHash as createHash3, randomUUID } from "node:crypto";
5748
5763
  import { chmodSync as chmodSync2, closeSync as closeSync3, constants as constants3, existsSync as existsSync7, copyFileSync, fchmodSync as fchmodSync3, fstatSync as fstatSync3, fsyncSync as fsyncSync2, lstatSync as lstatSync5, mkdirSync as mkdirSync2, openSync as openSync3, readFileSync as readFileSync9, readSync, readdirSync as readdirSync5, realpathSync as realpathSync2, statSync as statSync3, unlinkSync as unlinkSync4, writeSync } from "node:fs";
5749
- import { homedir as homedir9 } from "node:os";
5764
+ import { homedir as homedir10 } from "node:os";
5750
5765
  import { basename as basename4, dirname as dirname4, isAbsolute as isAbsolute2, join as join8, relative as relative3, resolve as resolve2, sep as sep2 } from "node:path";
5751
5766
  function backupDatabaseReadRequest(sqliteDriver, io, dbPath, logicalSessionId) {
5752
5767
  const global = dbPath === "globalStorage/state.vscdb";
@@ -5786,7 +5801,7 @@ function freezeSourceReadOptions(options = {}) {
5786
5801
  });
5787
5802
  }
5788
5803
  function getDefaultBackupDir() {
5789
- return join8(homedir9(), "cursor-history-backups");
5804
+ return join8(homedir10(), "cursor-history-backups");
5790
5805
  }
5791
5806
  function computeChecksum(buffer) {
5792
5807
  return `sha256:${createHash3("sha256").update(buffer).digest("hex")}`;
@@ -6060,12 +6075,12 @@ function checkDiskSpace(outputPath, requiredBytes) {
6060
6075
  };
6061
6076
  }
6062
6077
  }
6063
- function syncParentDirectory(path14) {
6078
+ function syncParentDirectory(path15) {
6064
6079
  if (process.platform === "win32")
6065
6080
  return;
6066
6081
  let descriptor;
6067
6082
  try {
6068
- descriptor = openSync3(dirname4(path14), constants3.O_RDONLY);
6083
+ descriptor = openSync3(dirname4(path15), constants3.O_RDONLY);
6069
6084
  fsyncSync2(descriptor);
6070
6085
  } catch {
6071
6086
  } finally {
@@ -6077,13 +6092,13 @@ function syncParentDirectory(path14) {
6077
6092
  }
6078
6093
  }
6079
6094
  }
6080
- function removePrivateArchiveStage(path14, operationError) {
6095
+ function removePrivateArchiveStage(path15, operationError) {
6081
6096
  try {
6082
- unlinkSync4(path14);
6097
+ unlinkSync4(path15);
6083
6098
  } catch (error) {
6084
6099
  if (errorCode3(error) === "ENOENT")
6085
6100
  return;
6086
- const cleanupError2 = new TemporaryArtifactCleanupError([path14]);
6101
+ const cleanupError2 = new TemporaryArtifactCleanupError([path15]);
6087
6102
  attachCleanupCause(cleanupError2, operationError ?? error);
6088
6103
  throw cleanupError2;
6089
6104
  }
@@ -6347,7 +6362,7 @@ function combineTemporaryCleanupErrors(first, second) {
6347
6362
  const unverifiedResidueSet = new Set(unverifiedResiduePaths);
6348
6363
  const residuePaths = [
6349
6364
  .../* @__PURE__ */ new Set([...first.details.residuePaths, ...second.details.residuePaths])
6350
- ].filter((path14) => !unverifiedResidueSet.has(path14));
6365
+ ].filter((path15) => !unverifiedResidueSet.has(path15));
6351
6366
  const combined = new TemporaryArtifactCleanupError(residuePaths, unverifiedResiduePaths);
6352
6367
  Object.defineProperty(combined, "cause", { configurable: true, value: first });
6353
6368
  return combined;
@@ -6455,18 +6470,18 @@ function validatedManifestFiles(manifest) {
6455
6470
  if (type !== "global-db" && type !== "workspace-db" && type !== "workspace-json" && type !== "manifest") {
6456
6471
  throw new ZipArchiveFormatError(`Backup manifest file ${index + 1} has an invalid type.`);
6457
6472
  }
6458
- const path14 = entry["path"];
6459
- const expectedType = backupEntryTypeForCanonicalPath(path14);
6473
+ const path15 = entry["path"];
6474
+ const expectedType = backupEntryTypeForCanonicalPath(path15);
6460
6475
  if (expectedType === void 0 || type !== expectedType) {
6461
6476
  throw new ZipArchiveFormatError(`Backup manifest file ${index + 1} has an unsupported path/type combination.`);
6462
6477
  }
6463
- const destinationKey = path14.normalize("NFC").toLowerCase();
6478
+ const destinationKey = path15.normalize("NFC").toLowerCase();
6464
6479
  if (destinationKeys.has(destinationKey)) {
6465
- throw new ZipArchiveFormatError(`Backup manifest contains a duplicate restore destination: ${path14}`);
6480
+ throw new ZipArchiveFormatError(`Backup manifest contains a duplicate restore destination: ${path15}`);
6466
6481
  }
6467
6482
  destinationKeys.add(destinationKey);
6468
6483
  return {
6469
- path: path14,
6484
+ path: path15,
6470
6485
  size: Number(entry["size"]),
6471
6486
  checksum: entry["checksum"].toLowerCase(),
6472
6487
  type
@@ -6483,10 +6498,10 @@ function isCanonicalBackupPathSegment(value) {
6483
6498
  }
6484
6499
  return true;
6485
6500
  }
6486
- function backupEntryTypeForCanonicalPath(path14) {
6487
- if (path14 === "globalStorage/state.vscdb")
6501
+ function backupEntryTypeForCanonicalPath(path15) {
6502
+ if (path15 === "globalStorage/state.vscdb")
6488
6503
  return "global-db";
6489
- const match = /^workspaceStorage\/([^/]+)\/(state\.vscdb|workspace\.json)$/u.exec(path14);
6504
+ const match = /^workspaceStorage\/([^/]+)\/(state\.vscdb|workspace\.json)$/u.exec(path15);
6490
6505
  if (!match || !isCanonicalBackupPathSegment(match[1]))
6491
6506
  return void 0;
6492
6507
  return match[2] === "state.vscdb" ? "workspace-db" : "workspace-json";
@@ -6505,8 +6520,8 @@ function validateComposerWorkspaceInventory(manifest, files) {
6505
6520
  if (!Array.isArray(inventory["workspaces"])) {
6506
6521
  throw new ZipArchiveFormatError("Backup manifest Composer workspace inventory workspaces must be an array.");
6507
6522
  }
6508
- const expectedWorkspaceIds = files.filter(({ type }) => type === "workspace-db").map(({ path: path14 }) => /^workspaceStorage\/([^/]+)\/state\.vscdb$/u.exec(path14)?.[1]).filter((workspaceId) => workspaceId !== void 0).sort(compareCodePoints4);
6509
- const containsGlobalDatabase = files.some(({ type, path: path14 }) => type === "global-db" && path14 === "globalStorage/state.vscdb");
6523
+ const expectedWorkspaceIds = files.filter(({ type }) => type === "workspace-db").map(({ path: path15 }) => /^workspaceStorage\/([^/]+)\/state\.vscdb$/u.exec(path15)?.[1]).filter((workspaceId) => workspaceId !== void 0).sort(compareCodePoints4);
6524
+ const containsGlobalDatabase = files.some(({ type, path: path15 }) => type === "global-db" && path15 === "globalStorage/state.vscdb");
6510
6525
  if (inventory["workspaces"].length !== expectedWorkspaceIds.length) {
6511
6526
  throw new ZipArchiveFormatError("Backup manifest Composer workspace inventory does not cover every workspace database.");
6512
6527
  }
@@ -6662,7 +6677,7 @@ async function openBackupDatabase(backupPath, dbPath, options = {}) {
6662
6677
  if (!entry || entry.isDirectory) {
6663
6678
  throw new BackupEntryNotFoundError(dbPath);
6664
6679
  }
6665
- const manifestEntry = manifestFiles.find(({ path: path14 }) => path14 === dbPath);
6680
+ const manifestEntry = manifestFiles.find(({ path: path15 }) => path15 === dbPath);
6666
6681
  if (!manifestEntry) {
6667
6682
  throw new ZipArchiveFormatError(`Backup database is not declared by the manifest: ${dbPath}`);
6668
6683
  }
@@ -6717,7 +6732,7 @@ async function readBackupEntryBuffer(backupPath, entryPath, options = {}, maxByt
6717
6732
  const manifest = await readManifestFromArchive(archive);
6718
6733
  if (!manifest)
6719
6734
  throw new ZipArchiveFormatError("Manifest file not found in backup.");
6720
- const manifestEntry = validatedManifestFiles(manifest).find(({ path: path14 }) => path14 === entryPath);
6735
+ const manifestEntry = validatedManifestFiles(manifest).find(({ path: path15 }) => path15 === entryPath);
6721
6736
  const entry = archive.getEntry(entryPath);
6722
6737
  if (!entry || entry.isDirectory) {
6723
6738
  if (manifestEntry) {
@@ -6773,18 +6788,18 @@ async function validateBackup(backupPath, options = {}) {
6773
6788
  };
6774
6789
  }
6775
6790
  }
6776
- function lstatIfPresent(path14) {
6791
+ function lstatIfPresent(path15) {
6777
6792
  try {
6778
- return lstatSync5(path14);
6793
+ return lstatSync5(path15);
6779
6794
  } catch (error) {
6780
6795
  if (errorCode3(error) === "ENOENT")
6781
6796
  return void 0;
6782
6797
  throw error;
6783
6798
  }
6784
6799
  }
6785
- function assertNoLinkedRestorePath(trustedRoot, path14, leafKind) {
6800
+ function assertNoLinkedRestorePath(trustedRoot, path15, leafKind) {
6786
6801
  const absoluteRoot = resolve2(trustedRoot);
6787
- const absolutePath = resolve2(path14);
6802
+ const absolutePath = resolve2(path15);
6788
6803
  const suffix = relative3(absoluteRoot, absolutePath);
6789
6804
  if (suffix === ".." || suffix.startsWith(`..${sep2}`) || isAbsolute2(suffix)) {
6790
6805
  throw new Error(`Restore destination escapes the Cursor data directory: ${absolutePath}`);
@@ -7117,7 +7132,7 @@ async function listBackups(directory, options = {}) {
7117
7132
  return backups;
7118
7133
  }
7119
7134
  function getDefaultCursorDataPath2() {
7120
- const home = homedir9();
7135
+ const home = homedir10();
7121
7136
  switch (process.platform) {
7122
7137
  case "win32":
7123
7138
  return join8(process.env["APPDATA"] ?? join8(home, "AppData", "Roaming"), "Cursor", "User", "workspaceStorage");
@@ -7129,7 +7144,7 @@ function getDefaultCursorDataPath2() {
7129
7144
  }
7130
7145
  var MANIFEST_VERSION, UTF8_BOM2, BACKUP_METADATA_MEMORY_LIMIT, BACKUP_DATABASE_READ_CAPABILITIES, BACKUP_CHAT_DATA_KEYS, BackupEntryNotFoundError, COMPOSER_GUID_RE, TempFileCleanupWrapper;
7131
7146
  var init_backup = __esm({
7132
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/backup.js"() {
7147
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup.js"() {
7133
7148
  "use strict";
7134
7149
  init_registry();
7135
7150
  init_database();
@@ -7200,7 +7215,7 @@ var init_backup = __esm({
7200
7215
  }
7201
7216
  });
7202
7217
 
7203
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/session-catalog.js
7218
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-catalog.js
7204
7219
  function compareCodePoints5(left, right) {
7205
7220
  const leftPoints = Array.from(left, (value) => value.codePointAt(0));
7206
7221
  const rightPoints = Array.from(right, (value) => value.codePointAt(0));
@@ -7570,7 +7585,7 @@ function sessionAmbiguityErrorFromReplicaGroup(divergence) {
7570
7585
  }
7571
7586
  var SOURCE_ROLE_ORDER, REPRESENTATION_ORDER, FIDELITY_ORDER, CANONICAL_PATH_KIND_ORDER, INSTANCE_STATE_ORDER;
7572
7587
  var init_session_catalog = __esm({
7573
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/session-catalog.js"() {
7588
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-catalog.js"() {
7574
7589
  "use strict";
7575
7590
  init_errors();
7576
7591
  init_session_identity();
@@ -7600,7 +7615,7 @@ var init_session_catalog = __esm({
7600
7615
  }
7601
7616
  });
7602
7617
 
7603
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/paths.js
7618
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/paths.js
7604
7619
  import { join as join9 } from "node:path";
7605
7620
  function storeProjectDirectoryName(cwd) {
7606
7621
  const normalized = cwd.replace(/\\/gu, "/");
@@ -7618,12 +7633,12 @@ function acpSessionsDir(storeRoot2) {
7618
7633
  return join9(storeRoot2, "acp-sessions");
7619
7634
  }
7620
7635
  var init_paths = __esm({
7621
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/paths.js"() {
7636
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/paths.js"() {
7622
7637
  "use strict";
7623
7638
  }
7624
7639
  });
7625
7640
 
7626
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/content-evidence.js
7641
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/content-evidence.js
7627
7642
  function deepFreeze(value) {
7628
7643
  if (!value || typeof value !== "object" || Object.isFrozen(value))
7629
7644
  return value;
@@ -7692,7 +7707,7 @@ ${encoded}
7692
7707
  }
7693
7708
  var INLINE_ATTACHMENT_TYPES, INLINE_PAYLOAD_FIELDS, PROJECTED_ATTACHMENT_FENCE;
7694
7709
  var init_content_evidence = __esm({
7695
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/content-evidence.js"() {
7710
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/content-evidence.js"() {
7696
7711
  "use strict";
7697
7712
  init_session_identity();
7698
7713
  INLINE_ATTACHMENT_TYPES = /* @__PURE__ */ new Set([
@@ -7709,7 +7724,7 @@ var init_content_evidence = __esm({
7709
7724
  }
7710
7725
  });
7711
7726
 
7712
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/store-db.js
7727
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/store-db.js
7713
7728
  import { chmodSync as chmodSync3, statSync as statSync4 } from "node:fs";
7714
7729
  function databaseRequest(operation, required, forcedDriver, options, resourceClass = "store-database") {
7715
7730
  return {
@@ -7746,11 +7761,11 @@ function attachErrorCause(error, cause) {
7746
7761
  });
7747
7762
  }
7748
7763
  }
7749
- async function parseStoreDb(path14, options = {}) {
7764
+ async function parseStoreDb(path15, options = {}) {
7750
7765
  const limits = options.limits ?? SOURCE_READ_LIMITS_V1_DEFAULTS;
7751
7766
  const failureOutcome = options.failureOutcome ?? "fatal";
7752
7767
  throwIfAborted4(options.signal);
7753
- if (!pathExists(path14, options.signal, options.io, options.logicalSessionId))
7768
+ if (!pathExists(path15, options.signal, options.io, options.logicalSessionId))
7754
7769
  return null;
7755
7770
  const budget = new SqliteSourceReadBudget(limits, failureOutcome);
7756
7771
  let workspace = null;
@@ -7762,7 +7777,7 @@ async function parseStoreDb(path14, options = {}) {
7762
7777
  workspace = createPrivateTempWorkspace({ prefix: "ch-store-", signal: options.signal });
7763
7778
  const tmpPath = workspace.createFile("store.db");
7764
7779
  throwIfAborted4(options.signal);
7765
- await backupDatabase(path14, tmpPath, databaseRequest("store-snapshot", STORE_SNAPSHOT_CAPABILITIES, options.sqliteDriver, options, "store-database"));
7780
+ await backupDatabase(path15, tmpPath, databaseRequest("store-snapshot", STORE_SNAPSHOT_CAPABILITIES, options.sqliteDriver, options, "store-database"));
7766
7781
  snapshotComplete = true;
7767
7782
  throwIfAborted4(options.signal);
7768
7783
  if (process.platform !== "win32")
@@ -7809,12 +7824,12 @@ async function parseStoreDb(path14, options = {}) {
7809
7824
  operationError = error;
7810
7825
  else {
7811
7826
  options.onDiagnostic?.(error);
7812
- debugLogStorage(`store.db defensive parse failed for ${path14}: ${error.code}`);
7827
+ debugLogStorage(`store.db defensive parse failed for ${path15}: ${error.code}`);
7813
7828
  }
7814
7829
  } else if (isSessionIntegrityError(error)) {
7815
7830
  operationError = error;
7816
7831
  } else if (error instanceof StoreSourceCorruptError || isSqliteSourceCorruptionError(error)) {
7817
- debugLogStorage(`store.db source/schema parse failed for ${path14}: ${String(error)}`);
7832
+ debugLogStorage(`store.db source/schema parse failed for ${path15}: ${String(error)}`);
7818
7833
  } else {
7819
7834
  operationError = error;
7820
7835
  }
@@ -7839,7 +7854,7 @@ async function parseStoreDb(path14, options = {}) {
7839
7854
  throw operationError;
7840
7855
  return result;
7841
7856
  }
7842
- function pathExists(path14, signal, io, logicalSessionId) {
7857
+ function pathExists(path15, signal, io, logicalSessionId) {
7843
7858
  throwIfAborted4(signal);
7844
7859
  try {
7845
7860
  if (io) {
@@ -7852,7 +7867,7 @@ function pathExists(path14, signal, io, logicalSessionId) {
7852
7867
  ...logicalSessionId ? { logicalSessionId } : {}
7853
7868
  });
7854
7869
  }
7855
- statSync4(path14);
7870
+ statSync4(path15);
7856
7871
  return true;
7857
7872
  } catch (error) {
7858
7873
  const code = error?.code;
@@ -8354,7 +8369,7 @@ function validDateFromMs(value) {
8354
8369
  }
8355
8370
  var STORE_SNAPSHOT_CAPABILITIES, STORE_READ_CAPABILITIES, StoreSourceCorruptError, BoundedBlobReader;
8356
8371
  var init_store_db = __esm({
8357
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/store-db.js"() {
8372
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/store-db.js"() {
8358
8373
  "use strict";
8359
8374
  init_database();
8360
8375
  init_debug();
@@ -8426,7 +8441,7 @@ var init_store_db = __esm({
8426
8441
  }
8427
8442
  });
8428
8443
 
8429
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/transcript.js
8444
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/transcript.js
8430
8445
  import { closeSync as closeSync4, openSync as openSync4, readSync as readSync2 } from "node:fs";
8431
8446
  function parseTranscriptFile(filePath, limits = SOURCE_READ_LIMITS_V1_DEFAULTS, failureOutcome = "fatal", signal, io, logicalSessionId) {
8432
8447
  throwIfAborted5(signal);
@@ -8784,7 +8799,7 @@ function extractContent(parts) {
8784
8799
  }
8785
8800
  var READ_CHUNK_BYTES;
8786
8801
  var init_transcript = __esm({
8787
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/transcript.js"() {
8802
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/transcript.js"() {
8788
8803
  "use strict";
8789
8804
  init_errors();
8790
8805
  init_io_observer();
@@ -8794,7 +8809,7 @@ var init_transcript = __esm({
8794
8809
  }
8795
8810
  });
8796
8811
 
8797
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/discover.js
8812
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/discover.js
8798
8813
  import { readdirSync as readdirSync6, readFileSync as readFileSync10, statSync as statSync5 } from "node:fs";
8799
8814
  import { join as join10 } from "node:path";
8800
8815
  function compareCodePoints6(left, right) {
@@ -8820,15 +8835,15 @@ function compareStringArrays2(left, right) {
8820
8835
  function getStorePhysicalOccurrences(session) {
8821
8836
  return physicalOccurrences.get(session) ?? [];
8822
8837
  }
8823
- function occurrenceKey(representation, path14) {
8824
- return `${representation}\0${path14}`;
8838
+ function occurrenceKey(representation, path15) {
8839
+ return `${representation}\0${path15}`;
8825
8840
  }
8826
- function occurrence(logicalSessionId, representation, path14, workspacePath) {
8841
+ function occurrence(logicalSessionId, representation, path15, workspacePath) {
8827
8842
  return {
8828
- instanceKey: occurrenceKey(representation, path14),
8843
+ instanceKey: occurrenceKey(representation, path15),
8829
8844
  logicalSessionId,
8830
8845
  representation,
8831
- path: path14,
8846
+ path: path15,
8832
8847
  ...workspacePath ? { workspacePath: normalizeWorkspacePath(workspacePath) } : {},
8833
8848
  sourceOrder: 0
8834
8849
  };
@@ -9176,7 +9191,7 @@ async function discoverStoreSessions(storeRoot2, options = {}) {
9176
9191
  const evidence = evidenceFor(uuid);
9177
9192
  evidence.transcriptInventoried = true;
9178
9193
  const transcriptOccurrence = occurrence(uuid, "store-transcript", nested, transcriptWorkspacePath(sanitized, metadataCandidates.get(logicalSessionIdKey(uuid)) ?? []));
9179
- if (!evidence.transcriptOccurrences.some(({ path: path14 }) => path14 === nested)) {
9194
+ if (!evidence.transcriptOccurrences.some(({ path: path15 }) => path15 === nested)) {
9180
9195
  evidence.transcriptOccurrences.push(transcriptOccurrence);
9181
9196
  }
9182
9197
  if (options.metadataOnly) {
@@ -9193,7 +9208,7 @@ async function discoverStoreSessions(storeRoot2, options = {}) {
9193
9208
  evidence.transcriptInventoried = true;
9194
9209
  const transcriptPath = join10(transcriptDir, entry.name);
9195
9210
  const transcriptOccurrence = occurrence(uuid, "store-transcript", transcriptPath, transcriptWorkspacePath(sanitized, metadataCandidates.get(logicalSessionIdKey(uuid)) ?? []));
9196
- if (!evidence.transcriptOccurrences.some(({ path: path14 }) => path14 === transcriptPath)) {
9211
+ if (!evidence.transcriptOccurrences.some(({ path: path15 }) => path15 === transcriptPath)) {
9197
9212
  evidence.transcriptOccurrences.push(transcriptOccurrence);
9198
9213
  }
9199
9214
  if (options.metadataOnly) {
@@ -9267,7 +9282,7 @@ async function discoverStoreSessions(storeRoot2, options = {}) {
9267
9282
  const usableDbCandidates = dbCandidates.filter((candidate) => Boolean(candidate.parsed && candidate.parsed.messages.length > 0));
9268
9283
  const selectedDbFidelity = usableDbCandidates.some(({ parsed }) => parsed.completeness === "complete") ? "complete" : "partial";
9269
9284
  const selectedDbTier = usableDbCandidates.filter(({ parsed }) => parsed.completeness === selectedDbFidelity);
9270
- let selectedDbCandidate = selectedDbTier[0] ?? dbCandidates.find(({ path: path14 }) => path14 === ss.storeDbPath) ?? dbCandidates[0];
9285
+ let selectedDbCandidate = selectedDbTier[0] ?? dbCandidates.find(({ path: path15 }) => path15 === ss.storeDbPath) ?? dbCandidates[0];
9271
9286
  let dbReplicaInstances = [];
9272
9287
  if (selectedDbTier.length > 1) {
9273
9288
  const physical = physicalStoreCandidates(ss.id, "store-db", selectedDbFidelity, selectedDbTier.map((candidate) => ({
@@ -9481,12 +9496,12 @@ function recordInventory(evidence, logicalSessionId, metaRead, sessionDir, dbPat
9481
9496
  if (metaRead.diagnostic)
9482
9497
  evidence.metadataFailures.push(metaRead.diagnostic);
9483
9498
  const metadataOccurrence = occurrence(logicalSessionId, "store-metadata", sessionDir, metaRead.meta?.cwd);
9484
- if (!evidence.metadataOccurrences.some(({ path: path14 }) => path14 === sessionDir)) {
9499
+ if (!evidence.metadataOccurrences.some(({ path: path15 }) => path15 === sessionDir)) {
9485
9500
  evidence.metadataOccurrences.push(metadataOccurrence);
9486
9501
  }
9487
9502
  if (dbInventoried) {
9488
9503
  evidence.dbInventoried = true;
9489
- if (!evidence.dbOccurrences.some(({ path: path14 }) => path14 === dbPath)) {
9504
+ if (!evidence.dbOccurrences.some(({ path: path15 }) => path15 === dbPath)) {
9490
9505
  evidence.dbOccurrences.push(occurrence(logicalSessionId, "store-db", dbPath, metaRead.meta?.cwd));
9491
9506
  }
9492
9507
  }
@@ -9732,12 +9747,12 @@ function listEntries(dir, signal, io) {
9732
9747
  throw error;
9733
9748
  }
9734
9749
  }
9735
- function readMeta(path14, signal, io, logicalSessionId, includeDisplayMetadata = true) {
9750
+ function readMeta(path15, signal, io, logicalSessionId, includeDisplayMetadata = true) {
9736
9751
  throwIfAborted6(signal);
9737
9752
  let raw;
9738
9753
  try {
9739
9754
  observeStoreFs(io, "read", "store-session-metadata", logicalSessionId, "store-db");
9740
- raw = readFileSync10(path14);
9755
+ raw = readFileSync10(path15);
9741
9756
  } catch (error) {
9742
9757
  if (isAbsentOrWrongType(error)) {
9743
9758
  return { present: false, unsupportedExpectationMetadata: false };
@@ -9868,11 +9883,11 @@ function decodeJsonObjectKey(raw, start, end) {
9868
9883
  function isJsonWhitespace(byte) {
9869
9884
  return byte === 32 || byte === 9 || byte === 10 || byte === 13;
9870
9885
  }
9871
- function pathExists2(path14, signal, io, resourceClass = "store-root-directory", logicalSessionId) {
9886
+ function pathExists2(path15, signal, io, resourceClass = "store-root-directory", logicalSessionId) {
9872
9887
  throwIfAborted6(signal);
9873
9888
  try {
9874
9889
  observeStoreFs(io, "open", resourceClass, logicalSessionId);
9875
- statSync5(path14);
9890
+ statSync5(path15);
9876
9891
  return true;
9877
9892
  } catch (error) {
9878
9893
  if (isAbsentOrWrongType(error))
@@ -9962,7 +9977,7 @@ function resolveStoreSessionTimestamps(session) {
9962
9977
  }
9963
9978
  var physicalOccurrences, TRANSCRIPT_STATE_RANK, RESOLUTION_REASON_ORDER;
9964
9979
  var init_discover = __esm({
9965
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/discover.js"() {
9980
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/discover.js"() {
9966
9981
  "use strict";
9967
9982
  init_errors();
9968
9983
  init_debug();
@@ -9998,7 +10013,7 @@ var init_discover = __esm({
9998
10013
  }
9999
10014
  });
10000
10015
 
10001
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/merge.js
10016
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/merge.js
10002
10017
  function normalizeText(text) {
10003
10018
  return text.replace(/\s+/g, " ").trim();
10004
10019
  }
@@ -10903,7 +10918,7 @@ function applyStoreMergeToSummary(existing, store, preferredSource) {
10903
10918
  }
10904
10919
  var EMPTY_PLACEHOLDER, CORRUPTED_PLACEHOLDER, SOURCE_ROLE_ORDER2, SOURCE_REPRESENTATION_ORDER, SOURCE_INSTANCE_STATE_ORDER, STORE_MESSAGE_ID_PATTERN, RESOLUTION_REASON_ORDER2;
10905
10920
  var init_merge = __esm({
10906
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/store-stack/merge.js"() {
10921
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/merge.js"() {
10907
10922
  "use strict";
10908
10923
  init_parser();
10909
10924
  init_timestamps();
@@ -10939,7 +10954,7 @@ var init_merge = __esm({
10939
10954
  }
10940
10955
  });
10941
10956
 
10942
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/storage.js
10957
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/storage.js
10943
10958
  import { createHash as createHash4 } from "node:crypto";
10944
10959
  import { existsSync as existsSync8, readdirSync as readdirSync7, readFileSync as readFileSync11 } from "node:fs";
10945
10960
  import { join as join11 } from "node:path";
@@ -11305,23 +11320,23 @@ function extractToolCalls(data) {
11305
11320
  const params = parseToolParams2(toolData.params, toolData.rawArgs);
11306
11321
  const status = getToolCallStatus(toolData);
11307
11322
  const resultText = typeof toolData.result === "string" && toolData.result.trim().length > 0 ? toolData.result : void 0;
11308
- const toolCall = {
11323
+ const toolCall2 = {
11309
11324
  name,
11310
11325
  status
11311
11326
  };
11312
11327
  if (params) {
11313
- toolCall.params = params;
11328
+ toolCall2.params = params;
11314
11329
  }
11315
11330
  const files = extractToolFiles(params);
11316
11331
  if (files) {
11317
- toolCall.files = files;
11332
+ toolCall2.files = files;
11318
11333
  }
11319
11334
  if (status === "error" && resultText) {
11320
- toolCall.error = extractToolError(resultText);
11335
+ toolCall2.error = extractToolError(resultText);
11321
11336
  } else if (status === "completed" && resultText) {
11322
- toolCall.result = resultText;
11337
+ toolCall2.result = resultText;
11323
11338
  }
11324
- return [toolCall];
11339
+ return [toolCall2];
11325
11340
  }
11326
11341
  function mapBubbleToMessage(row) {
11327
11342
  const corruptedMessage = () => ({
@@ -11500,7 +11515,7 @@ async function resolveBackupWorkspaceInventory(manifest, backupPath, readOptions
11500
11515
  throw new ZipArchiveFormatError("No intact restorable files found in backup.");
11501
11516
  }
11502
11517
  const databases = backupWorkspaceDatabaseEntries(manifest);
11503
- const containsGlobalDatabase = manifest.files.some(({ type, path: path14 }) => type === "global-db" && path14 === "globalStorage/state.vscdb");
11518
+ const containsGlobalDatabase = manifest.files.some(({ type, path: path15 }) => type === "global-db" && path15 === "globalStorage/state.vscdb");
11504
11519
  const inventory = manifest.composerWorkspaceInventory;
11505
11520
  if (inventory) {
11506
11521
  const dbPathByWorkspaceId = new Map(databases.map(({ workspaceId, dbPath }) => [workspaceId, dbPath]));
@@ -12698,8 +12713,8 @@ function loadExactGlobalComposerSession(db, exactId, workspacePath, budget = cre
12698
12713
  function composerWorkspaceMemberships(candidates) {
12699
12714
  const counts2 = /* @__PURE__ */ new Map();
12700
12715
  for (const candidate of candidates) {
12701
- const path14 = normalizeWorkspacePath(candidate.workspace.path);
12702
- counts2.set(path14, (counts2.get(path14) ?? 0) + 1);
12716
+ const path15 = normalizeWorkspacePath(candidate.workspace.path);
12717
+ counts2.set(path15, (counts2.get(path15) ?? 0) + 1);
12703
12718
  }
12704
12719
  return [...counts2.entries()].sort(([left], [right]) => compareCodePoints8(left, right)).map(([workspacePath, contributingInstanceCount]) => ({
12705
12720
  workspacePath,
@@ -13391,7 +13406,7 @@ async function listSessions(options, customDataPath, backupPath, context) {
13391
13406
  composerWorkspaceInventory = await findComposerWorkspaceInventory(customDataPath, backupPath, context);
13392
13407
  const storeWorkspacePaths = storeCatalogSessions.flatMap(verifiedStoreWorkspacePaths);
13393
13408
  workspaceScopeResult = resolveWorkspaceScope(options.workspacePath, [
13394
- ...composerWorkspaceInventory.map(({ path: path14 }) => path14),
13409
+ ...composerWorkspaceInventory.map(({ path: path15 }) => path15),
13395
13410
  ...storeWorkspacePaths
13396
13411
  ]);
13397
13412
  if (workspaceScopeResult.kind === "not-found") {
@@ -13657,7 +13672,7 @@ async function listSessions(options, customDataPath, backupPath, context) {
13657
13672
  }
13658
13673
  }
13659
13674
  if (activeWorkspacePath) {
13660
- const offScopeWorkspaces = composerWorkspaceInventory.filter(({ path: path14 }) => !workspaceFilterMatches(path14, activeWorkspacePath));
13675
+ const offScopeWorkspaces = composerWorkspaceInventory.filter(({ path: path15 }) => !workspaceFilterMatches(path15, activeWorkspacePath));
13661
13676
  for (const workspace of offScopeWorkspaces) {
13662
13677
  if (backupPath) {
13663
13678
  for (const id of getBackupComposerSessionIds(workspace) ?? []) {
@@ -14950,11 +14965,11 @@ function formatToolCall(toolData, codeBlocks) {
14950
14965
  } else if (toolName === "grep" || toolName === "search" || toolName === "codebase_search") {
14951
14966
  lines2.push(`[Tool: ${toolName === "grep" ? "Grep" : "Search"}]`);
14952
14967
  const pattern = getParam(params, "pattern", "query", "searchQuery", "regex");
14953
- const path14 = getParam(params, "path", "directory", "targetDirectory");
14968
+ const path15 = getParam(params, "path", "directory", "targetDirectory");
14954
14969
  if (pattern)
14955
14970
  lines2.push(`Pattern: ${pattern}`);
14956
- if (path14)
14957
- lines2.push(`Path: ${path14}`);
14971
+ if (path15)
14972
+ lines2.push(`Path: ${path15}`);
14958
14973
  } else if (toolName === "run_terminal_command" || toolName === "run_terminal_cmd" || toolName === "execute_command") {
14959
14974
  lines2.push(`[Tool: Terminal Command]`);
14960
14975
  const cmd = getParam(params, "command", "cmd");
@@ -15294,15 +15309,15 @@ function extractTimestamp(data) {
15294
15309
  if (!timingInfo)
15295
15310
  return null;
15296
15311
  const rpc = timingInfo.clientRpcSendTime;
15297
- if (typeof rpc === "number" && rpc > MIN_VALID_UNIX_MS) {
15312
+ if (typeof rpc === "number" && rpc > MIN_VALID_UNIX_MS2) {
15298
15313
  return new Date(rpc);
15299
15314
  }
15300
15315
  const settle = timingInfo.clientSettleTime;
15301
- if (typeof settle === "number" && settle > MIN_VALID_UNIX_MS) {
15316
+ if (typeof settle === "number" && settle > MIN_VALID_UNIX_MS2) {
15302
15317
  return new Date(settle);
15303
15318
  }
15304
15319
  const end = timingInfo.clientEndTime;
15305
- if (typeof end === "number" && end > MIN_VALID_UNIX_MS) {
15320
+ if (typeof end === "number" && end > MIN_VALID_UNIX_MS2) {
15306
15321
  return new Date(end);
15307
15322
  }
15308
15323
  return null;
@@ -15314,13 +15329,13 @@ function extractTimestampSource(data) {
15314
15329
  if (!timingInfo)
15315
15330
  return void 0;
15316
15331
  const rpc = timingInfo.clientRpcSendTime;
15317
- if (typeof rpc === "number" && rpc > MIN_VALID_UNIX_MS)
15332
+ if (typeof rpc === "number" && rpc > MIN_VALID_UNIX_MS2)
15318
15333
  return "composer-timing";
15319
15334
  const settle = timingInfo.clientSettleTime;
15320
- if (typeof settle === "number" && settle > MIN_VALID_UNIX_MS)
15335
+ if (typeof settle === "number" && settle > MIN_VALID_UNIX_MS2)
15321
15336
  return "composer-timing";
15322
15337
  const end = timingInfo.clientEndTime;
15323
- if (typeof end === "number" && end > MIN_VALID_UNIX_MS)
15338
+ if (typeof end === "number" && end > MIN_VALID_UNIX_MS2)
15324
15339
  return "composer-timing";
15325
15340
  return void 0;
15326
15341
  }
@@ -15393,9 +15408,9 @@ function updateComposerData(db, composers, isNewFormat, originalRawData) {
15393
15408
  const jsonValue = JSON.stringify(dataToWrite);
15394
15409
  db.prepare("UPDATE ItemTable SET value = ? WHERE key = ?").run(jsonValue, "composer.composerData");
15395
15410
  }
15396
- var SESSION_READ_CAPABILITIES, MIGRATION_CAPABILITIES, OWNING_DATABASE_READ_FAILURES, CHAT_DATA_KEYS, PROMPTS_KEY, GENERATIONS_KEY, COMPOSER_GUID_RE2, BACKUP_COMPOSER_SESSION_IDS, BACKUP_GLOBAL_COUNTERPART_SESSION_IDS, BACKUP_LINKED_GLOBAL_SESSION_IDS, BACKUP_CONTAINS_GLOBAL_DATABASE, COUNTED_COMPOSER_SESSION_IDS, sessionReadContextPrivate, nextReadContextId, UNKNOWN_WORKSPACE_PATH, RESOLUTION_SOURCE_ROLE_ORDER, RESOLUTION_REASON_ORDER3, MIN_VALID_UNIX_MS;
15411
+ var SESSION_READ_CAPABILITIES, MIGRATION_CAPABILITIES, OWNING_DATABASE_READ_FAILURES, CHAT_DATA_KEYS, PROMPTS_KEY, GENERATIONS_KEY, COMPOSER_GUID_RE2, BACKUP_COMPOSER_SESSION_IDS, BACKUP_GLOBAL_COUNTERPART_SESSION_IDS, BACKUP_LINKED_GLOBAL_SESSION_IDS, BACKUP_CONTAINS_GLOBAL_DATABASE, COUNTED_COMPOSER_SESSION_IDS, sessionReadContextPrivate, nextReadContextId, UNKNOWN_WORKSPACE_PATH, RESOLUTION_SOURCE_ROLE_ORDER, RESOLUTION_REASON_ORDER3, MIN_VALID_UNIX_MS2;
15397
15412
  var init_storage = __esm({
15398
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/storage.js"() {
15413
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/storage.js"() {
15399
15414
  "use strict";
15400
15415
  init_database();
15401
15416
  init_platform();
@@ -15447,11 +15462,11 @@ var init_storage = __esm({
15447
15462
  "store-db-expectation-unknown",
15448
15463
  "store-conversation-unavailable"
15449
15464
  ];
15450
- MIN_VALID_UNIX_MS = 1e12;
15465
+ MIN_VALID_UNIX_MS2 = 1e12;
15451
15466
  }
15452
15467
  });
15453
15468
 
15454
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/migrate.js
15469
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/migrate.js
15455
15470
  import { createHash as createHash5, randomUUID as randomUUID2 } from "node:crypto";
15456
15471
  import { existsSync as existsSync9, readdirSync as readdirSync8, statSync as statSync6 } from "node:fs";
15457
15472
  import { join as join12 } from "node:path";
@@ -15459,9 +15474,9 @@ import { pathToFileURL } from "node:url";
15459
15474
  function generateSessionId() {
15460
15475
  return randomUUID2();
15461
15476
  }
15462
- function transformPath(path14, sourcePrefix, destPrefix) {
15477
+ function transformPath(path15, sourcePrefix, destPrefix) {
15463
15478
  const normalizedSource = sourcePrefix.replace(/\/+$/, "");
15464
- const normalizedPath = path14;
15479
+ const normalizedPath = path15;
15465
15480
  if (normalizedPath.startsWith(normalizedSource + "/") || normalizedPath === normalizedSource) {
15466
15481
  return destPrefix + normalizedPath.slice(normalizedSource.length);
15467
15482
  }
@@ -15577,8 +15592,8 @@ function isNestedPath(source, destination) {
15577
15592
  const normalizedDest = normalizePath(destination).replace(/\/+$/, "");
15578
15593
  return normalizedDest.startsWith(normalizedSource + "/");
15579
15594
  }
15580
- function toFileUri(path14) {
15581
- const normalized = normalizePath(path14);
15595
+ function toFileUri(path15) {
15596
+ const normalized = normalizePath(path15);
15582
15597
  const windowsDrivePath = normalized.match(/^([A-Za-z]):[\\/](.*)$/);
15583
15598
  if (windowsDrivePath) {
15584
15599
  const drive = windowsDrivePath[1].toLowerCase();
@@ -15632,12 +15647,12 @@ function createMigrationReadGuard(limits, signal, sqliteDriver) {
15632
15647
  sqliteDriver
15633
15648
  };
15634
15649
  }
15635
- function physicalPathIdentity(label, path14) {
15636
- const normalized = normalizedPathKey(path14);
15637
- if (!existsSync9(path14))
15650
+ function physicalPathIdentity(label, path15) {
15651
+ const normalized = normalizedPathKey(path15);
15652
+ if (!existsSync9(path15))
15638
15653
  return `${label}:${normalized}|missing`;
15639
15654
  try {
15640
- const stat8 = statSync6(path14);
15655
+ const stat8 = statSync6(path15);
15641
15656
  return `${label}:${normalized}|dev:${String(stat8.dev)}|ino:${String(stat8.ino)}`;
15642
15657
  } catch {
15643
15658
  return `${label}:${normalized}|unavailable`;
@@ -15786,13 +15801,13 @@ async function findMigrationWorkspaceByPath(requested, dataPath2, guard) {
15786
15801
  const databasePath = join12(workspaceDirectory, "state.vscdb");
15787
15802
  if (!existsSync9(databasePath))
15788
15803
  continue;
15789
- const path14 = readWorkspaceJson(workspaceDirectory);
15790
- if (!path14 || !pathsEqual(path14, normalizedRequest))
15804
+ const path15 = readWorkspaceJson(workspaceDirectory);
15805
+ if (!path15 || !pathsEqual(path15, normalizedRequest))
15791
15806
  continue;
15792
15807
  return {
15793
15808
  workspace: {
15794
15809
  id: entry.name,
15795
- path: normalizePath(path14),
15810
+ path: normalizePath(path15),
15796
15811
  dbPath: databasePath,
15797
15812
  sessionCount: 0
15798
15813
  },
@@ -15810,7 +15825,7 @@ function loadWorkspaceComposerAddressInventory(db, budget, signal) {
15810
15825
  if (rootType !== "array" && rootType !== "object") {
15811
15826
  throw new TypeError("Composer workspace catalog is not a JSON array or object.");
15812
15827
  }
15813
- const scanIds = (path14, objectIds) => {
15828
+ const scanIds = (path15, objectIds) => {
15814
15829
  const scanBudget = new SqliteSourceReadBudget(budget.limits, budget.outcome);
15815
15830
  const results = [];
15816
15831
  const pageRows = scanBudget.limits.sqlitePageRows;
@@ -15821,7 +15836,7 @@ function loadWorkspaceComposerAddressInventory(db, budget, signal) {
15821
15836
  throwIfMigrationAborted(signal);
15822
15837
  const rows = db.prepare(`SELECT CAST(j.key AS INTEGER) AS itemIndex,
15823
15838
  length(CAST(${valueExpression} AS BLOB)) AS byteLength
15824
- FROM ItemTable AS i, json_each(i.value, '${path14}') AS j
15839
+ FROM ItemTable AS i, json_each(i.value, '${path15}') AS j
15825
15840
  WHERE i.rowid = ?
15826
15841
  AND ${typePredicate}
15827
15842
  AND CAST(j.key AS INTEGER) > ?
@@ -15840,7 +15855,7 @@ function loadWorkspaceComposerAddressInventory(db, budget, signal) {
15840
15855
  for (const item of metadata) {
15841
15856
  throwIfMigrationAborted(signal);
15842
15857
  const projected = db.prepare(`SELECT ${valueExpression} AS sessionId
15843
- FROM ItemTable AS i, json_each(i.value, '${path14}') AS j
15858
+ FROM ItemTable AS i, json_each(i.value, '${path15}') AS j
15844
15859
  WHERE i.rowid = ? AND CAST(j.key AS INTEGER) = ?`).get(source.rowId, item.itemIndex);
15845
15860
  if (typeof projected?.sessionId !== "string") {
15846
15861
  throw new Error("Composer ID projection changed after metadata admission.");
@@ -17535,7 +17550,7 @@ async function migrateWorkspace(options) {
17535
17550
  };
17536
17551
  }
17537
17552
  var init_migrate = __esm({
17538
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/core/migrate.js"() {
17553
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/migrate.js"() {
17539
17554
  "use strict";
17540
17555
  init_storage();
17541
17556
  init_platform();
@@ -17549,7 +17564,7 @@ var init_migrate = __esm({
17549
17564
  }
17550
17565
  });
17551
17566
 
17552
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/backup.js
17567
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/backup.js
17553
17568
  async function createBackup2(config) {
17554
17569
  return createBackup(config);
17555
17570
  }
@@ -17566,13 +17581,13 @@ function getDefaultBackupDir2() {
17566
17581
  return getDefaultBackupDir();
17567
17582
  }
17568
17583
  var init_backup2 = __esm({
17569
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/backup.js"() {
17584
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/backup.js"() {
17570
17585
  "use strict";
17571
17586
  init_backup();
17572
17587
  }
17573
17588
  });
17574
17589
 
17575
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/index.js
17590
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/index.js
17576
17591
  var lib_exports = {};
17577
17592
  __export(lib_exports, {
17578
17593
  BackupError: () => BackupError,
@@ -18492,7 +18507,7 @@ function getActiveDriver2() {
18492
18507
  }
18493
18508
  var publicReadContexts;
18494
18509
  var init_lib = __esm({
18495
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=8c02b8ff8b7820637beb3f0d25856ca4f632932000105288ff64b66ffbbd8cf5/node_modules/cursor-history/dist/lib/index.js"() {
18510
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/index.js"() {
18496
18511
  "use strict";
18497
18512
  init_types2();
18498
18513
  init_errors3();
@@ -18891,13 +18906,13 @@ function apiEquivalentCost(modelKey, t, atMs) {
18891
18906
  }
18892
18907
 
18893
18908
  // src/version.ts
18894
- var CLI_VERSION = true ? "0.16.8" : "0.0.0-dev";
18909
+ var CLI_VERSION = true ? "0.16.10" : "0.0.0-dev";
18895
18910
 
18896
18911
  // src/api.ts
18897
18912
  var BASE_URL = process.env.AISTACK_URL || "https://aistack.to";
18898
18913
  var STARTUP_READ_TIMEOUT_MS = 5e3;
18899
- async function request(path14, options = {}) {
18900
- return fetch(`${BASE_URL}${path14}`, {
18914
+ async function request(path15, options = {}) {
18915
+ return fetch(`${BASE_URL}${path15}`, {
18901
18916
  ...options,
18902
18917
  headers: {
18903
18918
  "Content-Type": "application/json",
@@ -19328,9 +19343,9 @@ function canonicalizeRepoUrl(input) {
19328
19343
  function repoNameFromCanonical(canonical) {
19329
19344
  return parseRepo(canonical)?.repo ?? "";
19330
19345
  }
19331
- function normalizeUpstreamPath(path14) {
19332
- if (!path14) return "";
19333
- return path14.split("/").filter(Boolean).join("/");
19346
+ function normalizeUpstreamPath(path15) {
19347
+ if (!path15) return "";
19348
+ return path15.split("/").filter(Boolean).join("/");
19334
19349
  }
19335
19350
 
19336
19351
  // src/git.ts
@@ -19376,16 +19391,16 @@ function buildRepoLinkResource(canonical) {
19376
19391
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
19377
19392
  import { homedir as homedir2 } from "node:os";
19378
19393
  import { join as join2 } from "node:path";
19379
- function readJson(path14) {
19394
+ function readJson(path15) {
19380
19395
  try {
19381
- if (!existsSync2(path14)) return null;
19382
- return JSON.parse(readFileSync2(path14, "utf-8"));
19396
+ if (!existsSync2(path15)) return null;
19397
+ return JSON.parse(readFileSync2(path15, "utf-8"));
19383
19398
  } catch {
19384
19399
  return null;
19385
19400
  }
19386
19401
  }
19387
- function hooksFrom(path14, source, out, seen) {
19388
- const hooks = readJson(path14)?.hooks;
19402
+ function hooksFrom(path15, source, out, seen) {
19403
+ const hooks = readJson(path15)?.hooks;
19389
19404
  if (!hooks || typeof hooks !== "object") return;
19390
19405
  for (const [event, config] of Object.entries(hooks)) {
19391
19406
  const stableKey = `hooks:${source}:${event}`;
@@ -19534,16 +19549,16 @@ function buildMcpResource(name, group, pkg) {
19534
19549
  pkg
19535
19550
  };
19536
19551
  }
19537
- function readText(path14) {
19552
+ function readText(path15) {
19538
19553
  try {
19539
- if (!existsSync3(path14)) return null;
19540
- return readFileSync3(path14, "utf-8");
19554
+ if (!existsSync3(path15)) return null;
19555
+ return readFileSync3(path15, "utf-8");
19541
19556
  } catch {
19542
19557
  return null;
19543
19558
  }
19544
19559
  }
19545
- function readParsed(path14, parse2) {
19546
- const raw = readText(path14);
19560
+ function readParsed(path15, parse2) {
19561
+ const raw = readText(path15);
19547
19562
  if (raw === null) return null;
19548
19563
  try {
19549
19564
  return parse2(raw);
@@ -19551,14 +19566,14 @@ function readParsed(path14, parse2) {
19551
19566
  return null;
19552
19567
  }
19553
19568
  }
19554
- function readJson2(path14) {
19555
- return readParsed(path14, JSON.parse);
19569
+ function readJson2(path15) {
19570
+ return readParsed(path15, JSON.parse);
19556
19571
  }
19557
- function readYaml(path14) {
19558
- return readParsed(path14, parseYaml);
19572
+ function readYaml(path15) {
19573
+ return readParsed(path15, parseYaml);
19559
19574
  }
19560
- function readToml(path14) {
19561
- return readParsed(path14, parseToml);
19575
+ function readToml(path15) {
19576
+ return readParsed(path15, parseToml);
19562
19577
  }
19563
19578
  function continueListToMap(file) {
19564
19579
  if (!file?.mcpServers?.length) return void 0;
@@ -19697,8 +19712,8 @@ function resolveSource(entry, mpRepoUrl) {
19697
19712
  const src = entry.source;
19698
19713
  if (typeof src === "string") {
19699
19714
  if (!mpRepoUrl) return null;
19700
- const path14 = src.replace(/^\.\//, "").replace(/\/+$/, "");
19701
- return { url: mpRepoUrl, path: path14 || void 0 };
19715
+ const path15 = src.replace(/^\.\//, "").replace(/\/+$/, "");
19716
+ return { url: mpRepoUrl, path: path15 || void 0 };
19702
19717
  }
19703
19718
  if (src && typeof src === "object" && src.url) {
19704
19719
  return { url: src.url, path: src.path, sha: src.sha };
@@ -19735,10 +19750,10 @@ function resolvePluginLinks(installed, marketplaces, manifests) {
19735
19750
  }
19736
19751
  return out;
19737
19752
  }
19738
- function readJson3(path14) {
19753
+ function readJson3(path15) {
19739
19754
  try {
19740
- if (!existsSync4(path14)) return null;
19741
- return JSON.parse(readFileSync4(path14, "utf-8"));
19755
+ if (!existsSync4(path15)) return null;
19756
+ return JSON.parse(readFileSync4(path15, "utf-8"));
19742
19757
  } catch {
19743
19758
  return null;
19744
19759
  }
@@ -20372,7 +20387,7 @@ function diffResources(current, existing) {
20372
20387
  // src/commands/connect.ts
20373
20388
  import { spawnSync } from "node:child_process";
20374
20389
  import { cpSync, existsSync as existsSync11 } from "node:fs";
20375
- import { homedir as homedir16 } from "node:os";
20390
+ import { homedir as homedir17 } from "node:os";
20376
20391
  import { dirname as dirname5, join as join13 } from "node:path";
20377
20392
  import { fileURLToPath } from "node:url";
20378
20393
  import * as p3 from "@clack/prompts";
@@ -20406,6 +20421,12 @@ function enableTrace(write = stderrSink, startedAt = Date.now(), options = {}) {
20406
20421
  function traceStartedAt() {
20407
20422
  return startedAtMs;
20408
20423
  }
20424
+ function traceRenderOptions() {
20425
+ return { color: colored, ...columns !== void 0 ? { columns } : {} };
20426
+ }
20427
+ function traceLine(line) {
20428
+ sink?.(line);
20429
+ }
20409
20430
  function traceEnabled() {
20410
20431
  return sink !== null;
20411
20432
  }
@@ -24328,14 +24349,73 @@ var codexAdapter = {
24328
24349
  };
24329
24350
 
24330
24351
  // src/harness/cursor/cache.ts
24331
- import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
24332
- import { homedir as homedir11 } from "node:os";
24333
- import path5 from "node:path";
24352
+ import { mkdir as mkdir2, readFile as readFile2, rename as rename2, writeFile as writeFile2 } from "node:fs/promises";
24353
+ import { homedir as homedir12 } from "node:os";
24354
+ import path6 from "node:path";
24334
24355
 
24335
24356
  // src/harness/cursor/account.ts
24336
24357
  import { createHash as createHash6 } from "node:crypto";
24337
24358
 
24338
24359
  // src/harness/cursor/evidence.ts
24360
+ var TOOL_PARAM_KEYS = ["command", "cmd", "skill", "subagent_type"];
24361
+ function slimSession(session) {
24362
+ const messages = session.messages.map((message) => {
24363
+ const slim = {
24364
+ role: message.role,
24365
+ contentLength: message.content?.length ?? 0,
24366
+ timestamp: message.timestamp
24367
+ };
24368
+ if (message.id !== void 0) slim.id = message.id;
24369
+ if (message.identityOrigin !== void 0)
24370
+ slim.identityOrigin = message.identityOrigin;
24371
+ if (message.parentMessageId !== void 0)
24372
+ slim.parentMessageId = message.parentMessageId;
24373
+ if (message.isSidechain !== void 0)
24374
+ slim.isSidechain = message.isSidechain;
24375
+ if (message.timestampSource !== void 0)
24376
+ slim.timestampSource = message.timestampSource;
24377
+ if (message.model !== void 0) slim.model = message.model;
24378
+ if (message.metadata?.corrupted !== void 0)
24379
+ slim.metadata = { corrupted: message.metadata.corrupted };
24380
+ if (message.toolCalls)
24381
+ slim.toolCalls = message.toolCalls.map((call) => {
24382
+ const out2 = { name: call.name };
24383
+ if (call.id !== void 0) out2.id = call.id;
24384
+ if (call.identityOrigin !== void 0)
24385
+ out2.identityOrigin = call.identityOrigin;
24386
+ if (call.params)
24387
+ for (const key2 of TOOL_PARAM_KEYS) {
24388
+ const value = call.params[key2];
24389
+ if (typeof value !== "string") continue;
24390
+ out2.params ??= {};
24391
+ out2.params[key2] = value;
24392
+ }
24393
+ return out2;
24394
+ });
24395
+ return slim;
24396
+ });
24397
+ const out = {
24398
+ id: session.id,
24399
+ timestamp: session.timestamp,
24400
+ messages
24401
+ };
24402
+ if (session.createdAtSource !== void 0)
24403
+ out.createdAtSource = session.createdAtSource;
24404
+ if (session.lastUpdatedAtSource !== void 0)
24405
+ out.lastUpdatedAtSource = session.lastUpdatedAtSource;
24406
+ if (session.resolutionState !== void 0)
24407
+ out.resolutionState = session.resolutionState;
24408
+ if (session.canonicalWorkspacePath !== void 0)
24409
+ out.canonicalWorkspacePath = session.canonicalWorkspacePath;
24410
+ if (session.metadata) {
24411
+ out.metadata = {};
24412
+ if (session.metadata.cursorVersion !== void 0)
24413
+ out.metadata.cursorVersion = session.metadata.cursorVersion;
24414
+ if (session.metadata.lastModified !== void 0)
24415
+ out.metadata.lastModified = session.metadata.lastModified;
24416
+ }
24417
+ return out;
24418
+ }
24339
24419
  function timestamp(value) {
24340
24420
  const n = typeof value === "number" ? value : typeof value === "string" ? /^\d+$/.test(value) ? Number(value) : Date.parse(value) : NaN;
24341
24421
  return Number.isFinite(n) && n > 0 && n < 864e13 ? n : null;
@@ -24446,9 +24526,9 @@ function localContributions(local, api = []) {
24446
24526
  const input = own.input !== void 0 ? own : user;
24447
24527
  const buckets = {
24448
24528
  ...own,
24449
- input: input.input ?? (pending ? Math.ceil(pending.content.length / 4) : void 0),
24529
+ input: input.input ?? (pending ? Math.ceil(pending.contentLength / 4) : void 0),
24450
24530
  inputSource: input.inputSource ?? (pending ? "text" : void 0),
24451
- output: own.output ?? Math.ceil(message.content.length / 4),
24531
+ output: own.output ?? Math.ceil(message.contentLength / 4),
24452
24532
  outputSource: own.outputSource ?? "text"
24453
24533
  };
24454
24534
  pending = void 0;
@@ -24479,16 +24559,290 @@ function reconcile(local, api) {
24479
24559
  // src/harness/cursor/local.ts
24480
24560
  import { existsSync as existsSync10 } from "node:fs";
24481
24561
  import { stat as stat4 } from "node:fs/promises";
24482
- import { homedir as homedir10 } from "node:os";
24483
- import path4 from "node:path";
24562
+ import { homedir as homedir11 } from "node:os";
24563
+ import path5 from "node:path";
24484
24564
  import { Worker } from "node:worker_threads";
24485
- function dataPath(env = process.env, home = homedir10(), platform4 = process.platform) {
24486
- if (env.CURSOR_DATA_PATH) return path4.resolve(env.CURSOR_DATA_PATH);
24487
- const base = platform4 === "darwin" ? path4.join(home, "Library", "Application Support") : platform4 === "win32" ? env.APPDATA || path4.join(home, "AppData", "Roaming") : env.XDG_CONFIG_HOME || path4.join(home, ".config");
24488
- return path4.join(base, "Cursor", "User", "workspaceStorage");
24565
+
24566
+ // src/harness/cursor/composer.ts
24567
+ var MIN_VALID_UNIX_MS = 1e12;
24568
+ var UNKNOWN_TIMESTAMP_EPOCH_MS = 0;
24569
+ var TOOL_PARAM_KEYS2 = ["command", "cmd", "skill", "subagent_type"];
24570
+ function storedDate(value) {
24571
+ if (typeof value !== "string" && typeof value !== "number") return null;
24572
+ const normalized = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value.trim()) : value;
24573
+ const ms = new Date(normalized).getTime();
24574
+ return Number.isFinite(ms) ? ms : null;
24575
+ }
24576
+ function bubbleTime(data) {
24577
+ if (data.createdAt) {
24578
+ const ms = new Date(data.createdAt).getTime();
24579
+ return { ms, source: "composer-created-at" };
24580
+ }
24581
+ const timing = asObj(data.timingInfo);
24582
+ if (!timing) return null;
24583
+ for (const field of [
24584
+ "clientRpcSendTime",
24585
+ "clientSettleTime",
24586
+ "clientEndTime"
24587
+ ]) {
24588
+ const value = timing[field];
24589
+ if (typeof value === "number" && value > MIN_VALID_UNIX_MS)
24590
+ return { ms: value, source: "composer-timing" };
24591
+ }
24592
+ return null;
24593
+ }
24594
+ function contentLength(data) {
24595
+ let length = 0;
24596
+ for (const key2 of ["text", "content", "finalText", "message", "markdown"]) {
24597
+ const value = data[key2];
24598
+ if (typeof value === "string" && value.trim().length > 0) {
24599
+ length = value.length;
24600
+ break;
24601
+ }
24602
+ }
24603
+ if (Array.isArray(data.codeBlocks))
24604
+ for (const block of data.codeBlocks) {
24605
+ const content = asObj(block)?.content;
24606
+ if (typeof content === "string") length += content.length;
24607
+ }
24608
+ return length;
24609
+ }
24610
+ function toolCall(data) {
24611
+ const tool = asObj(data.toolFormerData);
24612
+ const name = typeof tool?.name === "string" ? tool.name.trim() : "";
24613
+ if (!name) return void 0;
24614
+ const call = { name };
24615
+ const raw = tool?.params ?? tool?.rawArgs;
24616
+ if (typeof raw === "string" && raw.trim().length > 0) {
24617
+ let params;
24618
+ try {
24619
+ params = asObj(JSON.parse(raw)) ?? void 0;
24620
+ } catch {
24621
+ }
24622
+ if (params)
24623
+ for (const key2 of TOOL_PARAM_KEYS2) {
24624
+ const value = params[key2];
24625
+ if (typeof value !== "string") continue;
24626
+ call.params ??= {};
24627
+ call.params[key2] = value;
24628
+ }
24629
+ }
24630
+ return call;
24631
+ }
24632
+ var isValid = (ms) => typeof ms === "number" && Number.isFinite(ms);
24633
+ function resolveTimes(direct, sessionCreatedMs) {
24634
+ const out = direct.map(
24635
+ (d) => d && isValid(d.ms) && d.source ? { ms: d.ms, source: d.source } : void 0
24636
+ );
24637
+ let next;
24638
+ for (let i = out.length - 1; i >= 0; i--) {
24639
+ const d = out[i];
24640
+ if (d) {
24641
+ next = d.ms;
24642
+ continue;
24643
+ }
24644
+ if (next !== void 0) out[i] = { ms: next, source: "inferred-next" };
24645
+ }
24646
+ let previous;
24647
+ for (let i = 0; i < out.length; i++) {
24648
+ const d = out[i];
24649
+ if (d && d.source !== "inferred-next") {
24650
+ previous = d.ms;
24651
+ continue;
24652
+ }
24653
+ if (d) continue;
24654
+ if (previous !== void 0)
24655
+ out[i] = { ms: previous, source: "inferred-previous" };
24656
+ else if (sessionCreatedMs !== null)
24657
+ out[i] = { ms: sessionCreatedMs, source: "session-fallback" };
24658
+ else out[i] = { ms: UNKNOWN_TIMESTAMP_EPOCH_MS, source: "unknown" };
24659
+ }
24660
+ return out;
24661
+ }
24662
+ function readComposerSession(db, summary, signal) {
24663
+ const id = summary.id;
24664
+ const tokens = /* @__PURE__ */ new Map();
24665
+ const messages = [];
24666
+ const direct = [];
24667
+ for (const row of db.bubbles.iterate(`bubbleId:${id}:`, `bubbleId:${id};`)) {
24668
+ signal?.throwIfAborted();
24669
+ const key2 = String(row.key);
24670
+ const fallbackId = key2.slice(`bubbleId:${id}:`.length);
24671
+ let data = null;
24672
+ if (typeof row.value === "string") {
24673
+ try {
24674
+ data = asObj(JSON.parse(row.value));
24675
+ } catch {
24676
+ data = null;
24677
+ }
24678
+ }
24679
+ if (!data) {
24680
+ messages.push({
24681
+ id: fallbackId,
24682
+ identityOrigin: "composer-native",
24683
+ role: "assistant",
24684
+ contentLength: "[corrupted message]".length,
24685
+ timestamp: "",
24686
+ metadata: { corrupted: true }
24687
+ });
24688
+ direct.push(null);
24689
+ continue;
24690
+ }
24691
+ const bubbleId = asStr(data.bubbleId);
24692
+ const message = {
24693
+ id: bubbleId ?? fallbackId,
24694
+ identityOrigin: "composer-native",
24695
+ role: data.type === 2 ? "assistant" : "user",
24696
+ contentLength: contentLength(data),
24697
+ timestamp: ""
24698
+ };
24699
+ const model = asStr(asObj(data.modelInfo)?.modelName);
24700
+ if (model?.trim()) message.model = model;
24701
+ const call = toolCall(data);
24702
+ if (call) message.toolCalls = [call];
24703
+ messages.push(message);
24704
+ direct.push(bubbleTime(data));
24705
+ tokens.set(message.id, tokenEvidence(data));
24706
+ }
24707
+ if (messages.length === 0) return null;
24708
+ const stored = db.composer.get(`composerData:${id}`);
24709
+ const createdStored = storedDate(stored?.createdAt) ?? (summary.createdAtSource === "composer-metadata" ? storedDate(summary.timestamp) : null);
24710
+ const updatedStored = storedDate(stored?.lastUpdatedAt) ?? storedDate(stored?.updatedAt) ?? (summary.lastUpdatedAtSource === "composer-metadata" ? storedDate(summary.metadata?.lastModified) : null);
24711
+ const directMs = direct.flatMap((d) => d && isValid(d.ms) ? [d.ms] : []);
24712
+ const created = createdStored !== null ? { ms: createdStored, source: "composer-metadata" } : directMs.length ? { ms: Math.min(...directMs), source: "direct-message" } : { ms: UNKNOWN_TIMESTAMP_EPOCH_MS, source: "epoch-unknown" };
24713
+ const updated = updatedStored !== null ? { ms: updatedStored, source: "composer-metadata" } : directMs.length ? { ms: Math.max(...directMs), source: "direct-message" } : { ms: UNKNOWN_TIMESTAMP_EPOCH_MS, source: "epoch-unknown" };
24714
+ const times = resolveTimes(
24715
+ direct,
24716
+ created.source === "epoch-unknown" ? null : created.ms
24717
+ );
24718
+ for (const [i, message] of messages.entries()) {
24719
+ message.timestamp = new Date(times[i].ms).toISOString();
24720
+ message.timestampSource = times[i].source;
24721
+ }
24722
+ const header = db.header.get(`composerData:${id}`);
24723
+ if (typeof header?.conversation === "string") {
24724
+ try {
24725
+ const conversation = JSON.parse(header.conversation);
24726
+ if (Array.isArray(conversation))
24727
+ for (const [index, raw] of conversation.entries()) {
24728
+ const obj = asObj(raw);
24729
+ const bubble = asStr(obj?.bubbleId) ?? asStr(obj?.id) ?? `msg:${index}`;
24730
+ if (!tokens.has(bubble)) tokens.set(bubble, tokenEvidence(raw));
24731
+ }
24732
+ } catch {
24733
+ }
24734
+ }
24735
+ const session = {
24736
+ id,
24737
+ timestamp: new Date(created.ms).toISOString(),
24738
+ createdAtSource: created.source,
24739
+ lastUpdatedAtSource: updated.source,
24740
+ resolutionState: "complete",
24741
+ messages,
24742
+ metadata: { lastModified: new Date(updated.ms).toISOString() }
24743
+ };
24744
+ if (summary.canonicalWorkspacePath !== void 0)
24745
+ session.canonicalWorkspacePath = summary.canonicalWorkspacePath;
24746
+ if (summary.metadata?.cursorVersion !== void 0)
24747
+ session.metadata = {
24748
+ ...session.metadata,
24749
+ cursorVersion: summary.metadata.cursorVersion
24750
+ };
24751
+ return { session, tokens };
24752
+ }
24753
+ function hasComposerHalf(summary) {
24754
+ if (summary.resolutionState === "ambiguous") return false;
24755
+ const sources = summary.sources;
24756
+ return Array.isArray(sources) ? sources.includes("composer") : true;
24757
+ }
24758
+
24759
+ // src/harness/cursor/sessionCache.ts
24760
+ import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
24761
+ import { homedir as homedir8 } from "node:os";
24762
+ import path4 from "node:path";
24763
+ import { gunzipSync, gzipSync } from "node:zlib";
24764
+ var SESSION_CACHE_FORMAT = 1;
24765
+ var defaultSessionCacheDir = () => path4.join(homedir8(), ".config", "aistack", "cursor");
24766
+ var sessionCacheFile = (dir, root, store) => path4.join(dir, `${digest(`${root}\0${store}`)}.sessions.json.gz`);
24767
+ function sessionStamp(summary, newest) {
24768
+ if (newest === null) return null;
24769
+ const count2 = summary.messageCount;
24770
+ const sources = summary.sources;
24771
+ return JSON.stringify([
24772
+ newest,
24773
+ typeof count2 === "number" ? count2 : null,
24774
+ Array.isArray(sources) ? sources : null,
24775
+ summary.resolutionState ?? null
24776
+ ]);
24777
+ }
24778
+ function cacheable(local) {
24779
+ return local.session.resolutionState === "complete" && !local.session.messages.some((m) => m.metadata?.corrupted);
24780
+ }
24781
+ function toEntry(stamp, local) {
24782
+ return {
24783
+ stamp,
24784
+ session: local.session,
24785
+ tokens: Object.fromEntries(local.tokens)
24786
+ };
24787
+ }
24788
+ function fromEntry(entry) {
24789
+ return {
24790
+ session: entry.session,
24791
+ tokens: new Map(Object.entries(entry.tokens))
24792
+ };
24793
+ }
24794
+ function validEntry(value) {
24795
+ const entry = asObj(value);
24796
+ const session = asObj(entry?.session);
24797
+ return !!entry && typeof entry.stamp === "string" && !!session && typeof session.id === "string" && typeof session.timestamp === "string" && Array.isArray(session.messages) && session.messages.every((m) => {
24798
+ const message = asObj(m);
24799
+ return !!message && (message.role === "user" || message.role === "assistant") && typeof message.contentLength === "number" && typeof message.timestamp === "string";
24800
+ }) && !!asObj(entry.tokens);
24801
+ }
24802
+ async function loadSessionCache(file) {
24803
+ const out = /* @__PURE__ */ new Map();
24804
+ let raw;
24805
+ try {
24806
+ raw = gunzipSync(await readFile(file)).toString("utf8");
24807
+ } catch (error) {
24808
+ if (error.code !== "ENOENT")
24809
+ traceError("cursor session cache read", error, "warn");
24810
+ return out;
24811
+ }
24812
+ try {
24813
+ const parsed = asObj(JSON.parse(raw));
24814
+ if (parsed?.format !== SESSION_CACHE_FORMAT) return out;
24815
+ const entries = asObj(parsed.sessions);
24816
+ if (!entries) return out;
24817
+ for (const [id, entry] of Object.entries(entries))
24818
+ if (validEntry(entry) && entry.session.id === id) out.set(id, entry);
24819
+ } catch (error) {
24820
+ traceError("cursor session cache read", error, "warn");
24821
+ out.clear();
24822
+ }
24823
+ return out;
24824
+ }
24825
+ async function saveSessionCache(file, cache) {
24826
+ await mkdir(path4.dirname(file), { recursive: true, mode: 448 });
24827
+ const body = gzipSync(
24828
+ JSON.stringify({
24829
+ format: SESSION_CACHE_FORMAT,
24830
+ sessions: Object.fromEntries(cache)
24831
+ })
24832
+ );
24833
+ const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
24834
+ await writeFile(temporary, body, { mode: 384 });
24835
+ await rename(temporary, file);
24489
24836
  }
24490
- var storeRoot = () => process.env.CURSOR_STORE_ROOT || path4.join(homedir10(), ".cursor");
24491
- var globalDb = (root) => path4.join(path4.dirname(root), "globalStorage", "state.vscdb");
24837
+
24838
+ // src/harness/cursor/local.ts
24839
+ function dataPath(env = process.env, home = homedir11(), platform4 = process.platform) {
24840
+ if (env.CURSOR_DATA_PATH) return path5.resolve(env.CURSOR_DATA_PATH);
24841
+ const base = platform4 === "darwin" ? path5.join(home, "Library", "Application Support") : platform4 === "win32" ? env.APPDATA || path5.join(home, "AppData", "Roaming") : env.XDG_CONFIG_HOME || path5.join(home, ".config");
24842
+ return path5.join(base, "Cursor", "User", "workspaceStorage");
24843
+ }
24844
+ var storeRoot = () => process.env.CURSOR_STORE_ROOT || path5.join(homedir11(), ".cursor");
24845
+ var globalDb = (root) => path5.join(path5.dirname(root), "globalStorage", "state.vscdb");
24492
24846
  async function exists3(file) {
24493
24847
  try {
24494
24848
  await stat4(file);
@@ -24502,18 +24856,15 @@ async function hasLocalSource(root = dataPath()) {
24502
24856
  [
24503
24857
  root,
24504
24858
  globalDb(root),
24505
- path4.join(storeRoot(), "projects"),
24506
- path4.join(storeRoot(), "chats"),
24507
- path4.join(storeRoot(), "acp-sessions")
24859
+ path5.join(storeRoot(), "projects"),
24860
+ path5.join(storeRoot(), "chats"),
24861
+ path5.join(storeRoot(), "acp-sessions")
24508
24862
  ].map(exists3)
24509
24863
  )).some(Boolean);
24510
24864
  }
24511
- async function readTokenEvidence(root, session) {
24512
- const out = /* @__PURE__ */ new Map();
24513
- if (!session.messages.some((m) => m.identityOrigin?.startsWith("composer")))
24514
- return out;
24865
+ async function openEvidenceDb(root) {
24515
24866
  const file = globalDb(root);
24516
- if (!await exists3(file)) return out;
24867
+ if (!await exists3(file)) return null;
24517
24868
  const { DatabaseSync } = await import("node:sqlite");
24518
24869
  const db = new DatabaseSync(file, { readOnly: true });
24519
24870
  try {
@@ -24521,35 +24872,59 @@ async function readTokenEvidence(root, session) {
24521
24872
  const table = db.prepare(
24522
24873
  "SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cursorDiskKV'"
24523
24874
  ).get();
24524
- if (!table) return out;
24525
- const query = db.prepare(`SELECT json_object(
24526
- 'tokenCount', json_extract(value, '$.tokenCount'),
24527
- 'usage', json_extract(value, '$.usage'),
24528
- 'contextWindowStatusAtCreation', json_extract(value, '$.contextWindowStatusAtCreation'),
24529
- 'promptDryRunInfo', json_extract(value, '$.promptDryRunInfo')) AS evidence
24530
- FROM cursorDiskKV WHERE key = ?`);
24531
- for (const message of session.messages) {
24532
- if (!message.id || message.identityOrigin !== "composer-native") continue;
24533
- const row = query.get(`bubbleId:${session.id}:${message.id}`);
24534
- if (typeof row?.evidence === "string")
24535
- out.set(message.id, tokenEvidence(JSON.parse(row.evidence)));
24536
- }
24537
- const header = db.prepare(
24538
- "SELECT json_extract(value, '$.conversation') AS conversation FROM cursorDiskKV WHERE key = ?"
24539
- ).get(`composerData:${session.id}`);
24540
- if (typeof header?.conversation === "string") {
24541
- const conversation = JSON.parse(header.conversation);
24542
- if (Array.isArray(conversation))
24543
- for (const [index, raw] of conversation.entries()) {
24544
- const obj = asObj(raw);
24545
- const id = asStr(obj?.bubbleId) ?? asStr(obj?.id) ?? `msg:${index}`;
24546
- if (!out.has(id)) out.set(id, tokenEvidence(raw));
24547
- }
24875
+ if (!table) {
24876
+ db.close();
24877
+ return null;
24548
24878
  }
24549
- return out;
24550
- } finally {
24879
+ return {
24880
+ bubble: db.prepare(`SELECT json_object(
24881
+ 'tokenCount', json_extract(value, '$.tokenCount'),
24882
+ 'usage', json_extract(value, '$.usage'),
24883
+ 'contextWindowStatusAtCreation', json_extract(value, '$.contextWindowStatusAtCreation'),
24884
+ 'promptDryRunInfo', json_extract(value, '$.promptDryRunInfo')) AS evidence
24885
+ FROM cursorDiskKV WHERE key = ?`),
24886
+ header: db.prepare(
24887
+ "SELECT json_extract(value, '$.conversation') AS conversation FROM cursorDiskKV WHERE key = ?"
24888
+ ),
24889
+ // One session's bubbles are one key range; insertion order is the
24890
+ // conversation order, as cursor-history reads them.
24891
+ bubbles: db.prepare(
24892
+ "SELECT key, value FROM cursorDiskKV WHERE key >= ? AND key < ? ORDER BY rowid"
24893
+ ),
24894
+ composer: db.prepare(`SELECT
24895
+ json_extract(value, '$.createdAt') AS createdAt,
24896
+ json_extract(value, '$.lastUpdatedAt') AS lastUpdatedAt,
24897
+ json_extract(value, '$.updatedAt') AS updatedAt
24898
+ FROM cursorDiskKV WHERE key = ?`),
24899
+ close: () => db.close()
24900
+ };
24901
+ } catch (error) {
24551
24902
  db.close();
24903
+ throw error;
24904
+ }
24905
+ }
24906
+ function readTokenEvidence(session, db) {
24907
+ const out = /* @__PURE__ */ new Map();
24908
+ if (!db) return out;
24909
+ if (!session.messages.some((m) => m.identityOrigin?.startsWith("composer")))
24910
+ return out;
24911
+ for (const message of session.messages) {
24912
+ if (!message.id || message.identityOrigin !== "composer-native") continue;
24913
+ const row = db.bubble.get(`bubbleId:${session.id}:${message.id}`);
24914
+ if (typeof row?.evidence === "string")
24915
+ out.set(message.id, tokenEvidence(JSON.parse(row.evidence)));
24552
24916
  }
24917
+ const header = db.header.get(`composerData:${session.id}`);
24918
+ if (typeof header?.conversation === "string") {
24919
+ const conversation = JSON.parse(header.conversation);
24920
+ if (Array.isArray(conversation))
24921
+ for (const [index, raw] of conversation.entries()) {
24922
+ const obj = asObj(raw);
24923
+ const id = asStr(obj?.bubbleId) ?? asStr(obj?.id) ?? `msg:${index}`;
24924
+ if (!out.has(id)) out.set(id, tokenEvidence(raw));
24925
+ }
24926
+ }
24927
+ return out;
24553
24928
  }
24554
24929
  async function sourceStamp(root) {
24555
24930
  const values = await Promise.all(
@@ -24565,19 +24940,36 @@ async function sourceStamp(root) {
24565
24940
  return values.join("/");
24566
24941
  }
24567
24942
  var localReads = /* @__PURE__ */ new Map();
24943
+ var readWindowSinceMs;
24944
+ function setCursorReadWindow(sinceMs) {
24945
+ readWindowSinceMs = sinceMs;
24946
+ }
24947
+ function covers(held, wanted) {
24948
+ return held === void 0 || wanted !== void 0 && held <= wanted;
24949
+ }
24950
+ var sessionCacheDir;
24951
+ function sessionCachePath(root) {
24952
+ if (sessionCacheDir === null) return null;
24953
+ return sessionCacheFile(
24954
+ sessionCacheDir ?? defaultSessionCacheDir(),
24955
+ root,
24956
+ storeRoot()
24957
+ );
24958
+ }
24568
24959
  async function readLocal(root = dataPath(), onProgress) {
24569
24960
  const held = localReads.get(root);
24570
- if (held) {
24961
+ if (held && covers(held.sinceMs, readWindowSinceMs)) {
24571
24962
  trace("cursor \xB7 reusing this run's history read");
24572
24963
  return held.read;
24573
24964
  }
24965
+ if (held) trace("cursor \xB7 widening this run's history read");
24574
24966
  if (!await hasLocalSource(root)) {
24575
24967
  trace("cursor \xB7 no local source");
24576
24968
  return { sessions: [], complete: true, stats: emptyScanStats() };
24577
24969
  }
24578
24970
  const stamp = await sourceStamp(root);
24579
24971
  const read3 = readLocalOffThread(root, stamp, onProgress);
24580
- localReads.set(root, { stamp, read: read3 });
24972
+ localReads.set(root, { stamp, sinceMs: readWindowSinceMs, read: read3 });
24581
24973
  return read3;
24582
24974
  }
24583
24975
  function workerFile() {
@@ -24590,6 +24982,16 @@ async function readLocalOffThread(root, before, onProgress) {
24590
24982
  if (!file) return readLocalOnce(root, before, onProgress);
24591
24983
  return new Promise((resolve3) => {
24592
24984
  const fallback = () => resolve3(readLocalOnce(root, before, onProgress));
24985
+ const outOfMemory = () => {
24986
+ trace(
24987
+ "cursor worker out of memory \xB7 Cursor history not read this sync",
24988
+ "warn"
24989
+ );
24990
+ const stats = emptyScanStats();
24991
+ stats.filesUnreadable++;
24992
+ stats.unreadableFiles.push({ path: "history", reason: "OUT_OF_MEMORY" });
24993
+ resolve3({ sessions: [], complete: false, stats });
24994
+ };
24593
24995
  let settled = false;
24594
24996
  const settle = (fn) => {
24595
24997
  if (settled) return;
@@ -24600,12 +25002,17 @@ async function readLocalOffThread(root, before, onProgress) {
24600
25002
  workerData: {
24601
25003
  root,
24602
25004
  before,
25005
+ sinceMs: readWindowSinceMs,
25006
+ sessionCacheDir,
24603
25007
  trace: traceEnabled(),
24604
- traceStartedAt: traceStartedAt()
25008
+ traceStartedAt: traceStartedAt(),
25009
+ traceColor: traceRenderOptions().color,
25010
+ traceColumns: traceRenderOptions().columns
24605
25011
  }
24606
25012
  });
24607
25013
  worker.on("message", (message) => {
24608
- if (message.kind === "progress")
25014
+ if (message.kind === "trace") traceLine(message.line);
25015
+ else if (message.kind === "progress")
24609
25016
  onProgress?.(message.files, message.total);
24610
25017
  else if (message.kind === "result") settle(() => resolve3(message.read));
24611
25018
  else
@@ -24618,7 +25025,8 @@ async function readLocalOffThread(root, before, onProgress) {
24618
25025
  "error",
24619
25026
  (error) => settle(() => {
24620
25027
  traceError("cursor worker", error);
24621
- fallback();
25028
+ if (traceErrorCode(error) === "ERR_WORKER_OUT_OF_MEMORY") outOfMemory();
25029
+ else fallback();
24622
25030
  })
24623
25031
  );
24624
25032
  worker.on("exit", (code) => {
@@ -24630,8 +25038,31 @@ async function readLocalOffThread(root, before, onProgress) {
24630
25038
  });
24631
25039
  });
24632
25040
  }
24633
- async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
25041
+ var STALL_MS = 12e4;
25042
+ var SLOW_SESSION_MS = 2e3;
25043
+ var READ_WINDOW_MARGIN_MS = 864e5;
25044
+ function summaryNewestMs(summary) {
25045
+ if (summary.resolutionState === "ambiguous") return null;
25046
+ let newest = null;
25047
+ for (const [iso, source] of [
25048
+ [summary.metadata?.lastModified, summary.lastUpdatedAtSource],
25049
+ [summary.timestamp, summary.createdAtSource]
25050
+ ]) {
25051
+ if (source === "epoch-unknown" || typeof iso !== "string") continue;
25052
+ const ms = Date.parse(iso);
25053
+ if (!Number.isFinite(ms) || ms <= 0) continue;
25054
+ newest = newest === null ? ms : Math.max(newest, ms);
25055
+ }
25056
+ return newest;
25057
+ }
25058
+ function olderThanWindow(summary, sinceMs) {
25059
+ if (sinceMs === void 0) return false;
25060
+ const newest = summaryNewestMs(summary);
25061
+ return newest !== null && newest < sinceMs - READ_WINDOW_MARGIN_MS;
25062
+ }
25063
+ async function readLocalOnce(root, before, onProgress, sourceReadLimits, stallMs = STALL_MS, sinceMs = readWindowSinceMs, cacheDir = sessionCacheDir) {
24634
25064
  before ??= await sourceStamp(root);
25065
+ sessionCacheDir = cacheDir;
24635
25066
  const stats = emptyScanStats();
24636
25067
  const out = { sessions: [], complete: true, stats };
24637
25068
  if (!await hasLocalSource(root)) {
@@ -24641,18 +25072,44 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
24641
25072
  trace(`cursor \xB7 global database ${await globalDbSize(root)}`);
24642
25073
  const readDone = traceTimer("cursor history read");
24643
25074
  let context;
25075
+ let evidence;
24644
25076
  let retrySmallPage = false;
24645
25077
  let unresolved = 0;
24646
25078
  let corrupted = 0;
24647
25079
  let ambiguous = 0;
25080
+ let encodingInvalid = 0;
25081
+ let total;
24648
25082
  let stage = "reader setup";
24649
- const signal = AbortSignal.timeout(12e4);
25083
+ const cacheFile2 = sessionCachePath(root);
25084
+ const cache = cacheFile2 ? await loadSessionCache(cacheFile2) : /* @__PURE__ */ new Map();
25085
+ const listed = /* @__PURE__ */ new Set();
25086
+ let listingComplete = false;
25087
+ let fromCache = 0;
25088
+ let direct = 0;
25089
+ let viaLibrary = 0;
25090
+ const stall = new AbortController();
25091
+ const { signal } = stall;
25092
+ let stallTimer;
25093
+ const progressed = () => {
25094
+ if (signal.aborted) return;
25095
+ clearTimeout(stallTimer);
25096
+ stallTimer = setTimeout(() => {
25097
+ const error = new Error(
25098
+ `cursor read stalled: no progress for ${Math.round(stallMs / 1e3)} s`
25099
+ );
25100
+ error.name = "AbortError";
25101
+ stall.abort(error);
25102
+ }, stallMs);
25103
+ stallTimer.unref?.();
25104
+ };
25105
+ progressed();
24650
25106
  try {
24651
25107
  const reader = await Promise.resolve().then(() => (init_lib(), lib_exports));
24652
25108
  const options = {
24653
25109
  dataPath: root,
24654
25110
  sqliteDriver: "node:sqlite",
24655
25111
  onDiagnostic: (diagnostic) => {
25112
+ if (signal.aborted) return;
24656
25113
  traceError("cursor source diagnostic", diagnostic, "warn");
24657
25114
  out.complete = false;
24658
25115
  },
@@ -24671,38 +25128,91 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
24671
25128
  offset,
24672
25129
  limit: 100
24673
25130
  });
25131
+ progressed();
24674
25132
  pageDone(`${page.data.length} of ${page.pagination.total} sessions`);
24675
- if (offset === 0) onProgress?.(0, page.pagination.total);
25133
+ total = page.pagination.total;
25134
+ if (offset === 0) onProgress?.(0, total);
24676
25135
  for (const summary of page.data) {
25136
+ if (olderThanWindow(summary, sinceMs)) {
25137
+ stats.filesSkippedByMtime++;
25138
+ onProgress?.(stats.filesRead + stats.filesSkippedByMtime, total);
25139
+ continue;
25140
+ }
24677
25141
  stats.filesFound++;
25142
+ listed.add(summary.id);
24678
25143
  if (summary.resolutionState === "ambiguous") {
24679
25144
  out.complete = false;
24680
25145
  }
25146
+ const position = `${stats.filesRead + stats.filesUnreadable + stats.filesSkippedByMtime + 1} of ${total}`;
25147
+ const sessionStartedMs = Date.now();
25148
+ const stamp = sessionStamp(summary, summaryNewestMs(summary));
25149
+ const held = stamp === null ? void 0 : cache.get(summary.id);
25150
+ if (held && held.stamp === stamp) {
25151
+ out.sessions.push(fromEntry(held));
25152
+ stats.filesRead++;
25153
+ fromCache++;
25154
+ onProgress?.(stats.filesRead + stats.filesSkippedByMtime, total);
25155
+ progressed();
25156
+ continue;
25157
+ }
24681
25158
  try {
24682
- stage = "session read";
24683
- const session = await reader.getSession(summary.id, config);
24684
- if (session.resolutionState !== "complete" || session.messages.some((m) => m.metadata?.corrupted)) {
24685
- if (session.resolutionState !== "complete") unresolved++;
24686
- if (session.messages.some((m) => m.metadata?.corrupted))
25159
+ let local = null;
25160
+ if (hasComposerHalf(summary)) {
25161
+ stage = "composer read";
25162
+ if (evidence === void 0) evidence = await openEvidenceDb(root);
25163
+ if (evidence)
25164
+ local = readComposerSession(evidence, summary, signal);
25165
+ }
25166
+ if (local) {
25167
+ direct++;
25168
+ if (local.session.messages.some((m) => m.metadata?.corrupted)) {
24687
25169
  corrupted++;
24688
- out.complete = false;
25170
+ out.complete = false;
25171
+ }
25172
+ } else {
25173
+ stage = "session read";
25174
+ const session = await reader.getSession(summary.id, config);
25175
+ if (session.resolutionState !== "complete" || session.messages.some((m) => m.metadata?.corrupted)) {
25176
+ if (session.resolutionState !== "complete") unresolved++;
25177
+ if (session.messages.some((m) => m.metadata?.corrupted))
25178
+ corrupted++;
25179
+ out.complete = false;
25180
+ }
25181
+ stage = "token evidence";
25182
+ if (evidence === void 0) evidence = await openEvidenceDb(root);
25183
+ const tokens = readTokenEvidence(session, evidence);
25184
+ local = { session: slimSession(session), tokens };
25185
+ viaLibrary++;
24689
25186
  }
24690
- stage = "token evidence";
24691
- const tokens = await readTokenEvidence(root, session);
24692
- out.sessions.push({ session, tokens });
25187
+ out.sessions.push(local);
25188
+ if (stamp !== null && cacheable(local))
25189
+ cache.set(summary.id, toEntry(stamp, local));
25190
+ else cache.delete(summary.id);
24693
25191
  stats.filesRead++;
24694
- onProgress?.(stats.filesRead, page.pagination.total);
25192
+ const elapsedMs = Date.now() - sessionStartedMs;
25193
+ if (elapsedMs >= SLOW_SESSION_MS)
25194
+ trace(
25195
+ `cursor slow session \xB7 ${position} \xB7 ${elapsedMs} ms \xB7 ${local.session.messages.length} messages, ${local.tokens.size} bubbles with token evidence`,
25196
+ "warn"
25197
+ );
25198
+ onProgress?.(stats.filesRead + stats.filesSkippedByMtime, total);
24695
25199
  } catch (error) {
24696
- if (isPageByteLimit(error)) throw error;
24697
- if (traceErrorCode(error) === "SESSION_AMBIGUOUS") ambiguous++;
25200
+ if (signal.aborted || isPageByteLimit(error)) throw error;
25201
+ const code = traceErrorCode(error);
25202
+ if (code === "SESSION_AMBIGUOUS") ambiguous++;
25203
+ else if (code === "SOURCE_ENCODING_INVALID") encodingInvalid++;
24698
25204
  else traceError(`cursor ${stage}`, error, "warn");
24699
25205
  out.complete = false;
24700
25206
  stats.filesUnreadable++;
24701
25207
  } finally {
24702
25208
  context.releaseSession(summary.id);
25209
+ progressed();
24703
25210
  }
24704
25211
  }
24705
- if (!page.pagination.hasMore) break;
25212
+ if (!page.pagination.hasMore) {
25213
+ listingComplete = true;
25214
+ break;
25215
+ }
24706
25216
  if (page.data.length === 0 || offset >= 1e5) {
24707
25217
  trace(
24708
25218
  "cursor listing incomplete \xB7 empty page or pagination limit",
@@ -24714,17 +25224,49 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
24714
25224
  offset += page.data.length;
24715
25225
  }
24716
25226
  } catch (error) {
24717
- traceError(`cursor ${stage}`, error);
24718
- if (signal.aborted)
24719
- traceError("cursor read deadline", signal.reason, "warn");
24720
- retrySmallPage = isPageByteLimit(error) && sourceReadLimits?.sqlitePageRows !== 1;
24721
- stats.unreadableFiles.push({
24722
- path: "history",
24723
- reason: traceErrorCode(error)
24724
- });
25227
+ if (signal.aborted) {
25228
+ const inFlight = stage === "session listing" ? 0 : 1;
25229
+ const skipped = Math.max(
25230
+ 0,
25231
+ (total ?? 0) - stats.filesRead - stats.filesUnreadable - stats.filesSkippedByMtime - inFlight
25232
+ );
25233
+ trace(
25234
+ `cursor read stalled \xB7 no progress for ${Math.round(stallMs / 1e3)} s during ${stage} \xB7 ${stats.filesRead} sessions kept, ${skipped} skipped`,
25235
+ "warn"
25236
+ );
25237
+ stats.unreadableFiles.push({ path: "history", reason: "STALLED" });
25238
+ } else {
25239
+ traceError(`cursor ${stage}`, error);
25240
+ retrySmallPage = isPageByteLimit(error) && sourceReadLimits?.sqlitePageRows !== 1;
25241
+ stats.unreadableFiles.push({
25242
+ path: "history",
25243
+ reason: traceErrorCode(error)
25244
+ });
25245
+ }
24725
25246
  out.complete = false;
24726
25247
  stats.filesUnreadable++;
24727
25248
  } finally {
25249
+ clearTimeout(stallTimer);
25250
+ if (cacheFile2 && !retrySmallPage) {
25251
+ if (listingComplete) {
25252
+ for (const id of [...cache.keys()])
25253
+ if (!listed.has(id)) cache.delete(id);
25254
+ }
25255
+ try {
25256
+ await saveSessionCache(cacheFile2, cache);
25257
+ } catch (error) {
25258
+ traceError("cursor session cache save", error, "warn");
25259
+ }
25260
+ }
25261
+ if (fromCache || direct || viaLibrary)
25262
+ trace(
25263
+ `cursor \xB7 ${fromCache} sessions from cache, ${direct} read directly, ${viaLibrary} through cursor-history`
25264
+ );
25265
+ try {
25266
+ evidence?.close();
25267
+ } catch (error) {
25268
+ traceError("cursor evidence database close", error, "warn");
25269
+ }
24728
25270
  try {
24729
25271
  await context?.dispose();
24730
25272
  } catch (error) {
@@ -24737,11 +25279,20 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
24737
25279
  "page byte limit reached; retrying with one SQLite row per page",
24738
25280
  "warn"
24739
25281
  );
24740
- return readLocalOnce(root, before, onProgress, {
24741
- ...sourceReadLimits,
24742
- sqlitePageRows: 1
24743
- });
25282
+ return readLocalOnce(
25283
+ root,
25284
+ before,
25285
+ onProgress,
25286
+ { ...sourceReadLimits, sqlitePageRows: 1 },
25287
+ stallMs,
25288
+ sinceMs,
25289
+ cacheDir
25290
+ );
24744
25291
  }
25292
+ if (stats.filesSkippedByMtime)
25293
+ trace(
25294
+ `cursor \xB7 ${stats.filesSkippedByMtime} sessions older than the window skipped`
25295
+ );
24745
25296
  if (before !== await sourceStamp(root)) {
24746
25297
  trace(
24747
25298
  "cursor history incomplete \xB7 database changed during the read",
@@ -24749,12 +25300,17 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
24749
25300
  );
24750
25301
  out.complete = false;
24751
25302
  }
24752
- if (unresolved || corrupted || ambiguous) {
25303
+ if (unresolved || corrupted || ambiguous || encodingInvalid) {
24753
25304
  trace(
24754
- `cursor partial history \xB7 ${unresolved} sessions unresolved, ${corrupted} with corrupted messages, ${ambiguous} skipped with conflicting copies${ambiguous ? " (SESSION_AMBIGUOUS)" : ""} \xB7 available dated usage retained`,
25305
+ `cursor partial history \xB7 ${unresolved} sessions unresolved, ${corrupted} with corrupted messages, ${ambiguous} skipped with conflicting copies${ambiguous ? " (SESSION_AMBIGUOUS)" : ""}, ${encodingInvalid} skipped with non-UTF-8 payloads${encodingInvalid ? " (SOURCE_ENCODING_INVALID)" : ""} \xB7 available dated usage retained`,
24755
25306
  "warn"
24756
25307
  );
24757
25308
  }
25309
+ if (encodingInvalid)
25310
+ stats.unreadableFiles.push({
25311
+ path: `${encodingInvalid} session${encodingInvalid === 1 ? "" : "s"} skipped`,
25312
+ reason: "non-UTF-8 payload"
25313
+ });
24758
25314
  readDone(
24759
25315
  `${stats.filesRead}/${stats.filesFound} sessions read, ${stats.filesUnreadable} unreadable${out.complete ? "" : ", incomplete"}`,
24760
25316
  out.complete ? "success" : "warn"
@@ -24960,8 +25516,8 @@ var emptyCache = () => ({
24960
25516
  local: [],
24961
25517
  sessions: []
24962
25518
  });
24963
- var cacheFile = (root, store) => path5.join(
24964
- homedir11(),
25519
+ var cacheFile = (root, store) => path6.join(
25520
+ homedir12(),
24965
25521
  ".config",
24966
25522
  "aistack",
24967
25523
  "cursor",
@@ -24976,7 +25532,7 @@ function validContribution(value) {
24976
25532
  }
24977
25533
  async function loadCache(file) {
24978
25534
  try {
24979
- const raw = asObj(JSON.parse(await readFile(file, "utf8")));
25535
+ const raw = asObj(JSON.parse(await readFile2(file, "utf8")));
24980
25536
  const windows = asObj(raw?.windows);
24981
25537
  if (raw?.version !== 1 || !(raw.account === null || typeof raw.account === "string") || !Array.isArray(raw.sessions) || !raw.sessions.every((id) => typeof id === "string") || !Array.isArray(raw.local) || !raw.local.every(validContribution) || !windows)
24982
25538
  throw Object.assign(new Error("Invalid cache"), {
@@ -25000,10 +25556,10 @@ async function loadCache(file) {
25000
25556
  }
25001
25557
  }
25002
25558
  async function saveCache(file, value) {
25003
- await mkdir(path5.dirname(file), { recursive: true, mode: 448 });
25559
+ await mkdir2(path6.dirname(file), { recursive: true, mode: 448 });
25004
25560
  const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
25005
- await writeFile(temporary, JSON.stringify(value), { mode: 384 });
25006
- await rename(temporary, file);
25561
+ await writeFile2(temporary, JSON.stringify(value), { mode: 384 });
25562
+ await rename2(temporary, file);
25007
25563
  }
25008
25564
  var REFRESH_MS = 3e5;
25009
25565
  var WINDOW_MS = 30 * 864e5;
@@ -25056,10 +25612,10 @@ function cachedEvents(cache, sessionIds) {
25056
25612
  }
25057
25613
 
25058
25614
  // src/harness/cursor/scan.ts
25059
- import path7 from "node:path";
25615
+ import path8 from "node:path";
25060
25616
 
25061
25617
  // src/harness/cursor/workflow.ts
25062
- import path6 from "node:path";
25618
+ import path7 from "node:path";
25063
25619
  var TOOLS = {
25064
25620
  read_file: "Read",
25065
25621
  read_file_v2: "Read",
@@ -25100,7 +25656,7 @@ function projectHistory(options) {
25100
25656
  const scopes = /* @__PURE__ */ new Map();
25101
25657
  const inWindow = (t) => t !== null && t >= sinceMs && t <= now;
25102
25658
  for (const { session } of locals) {
25103
- const projectWorkspace = session.canonicalWorkspacePath && path6.isAbsolute(session.canonicalWorkspacePath) ? session.canonicalWorkspacePath : void 0;
25659
+ const projectWorkspace = session.canonicalWorkspacePath && path7.isAbsolute(session.canonicalWorkspacePath) ? session.canonicalWorkspacePath : void 0;
25104
25660
  const times = messageTimes(session, api);
25105
25661
  const scopeOf = (message) => {
25106
25662
  const parent = message.parentMessageId && nativeOwners.get(message.parentMessageId);
@@ -25187,7 +25743,7 @@ function projectHistory(options) {
25187
25743
  session: row.sidechain ? `${row.session}:sidechain` : row.session,
25188
25744
  sidechain: row.sidechain
25189
25745
  },
25190
- ...project && path6.isAbsolute(project) ? { projectWorkspace: project } : {},
25746
+ ...project && path7.isAbsolute(project) ? { projectWorkspace: project } : {},
25191
25747
  type: "response",
25192
25748
  tsMs: row.tsMs,
25193
25749
  responseId: `${row.source}:${row.id ?? index}`,
@@ -25286,7 +25842,7 @@ async function scan3(options) {
25286
25842
  aggregate.byModel.set(model, emptyUsage());
25287
25843
  }
25288
25844
  const project = session.canonicalWorkspacePath;
25289
- if (project && path7.isAbsolute(project)) aggregate.projectDirs.add(project);
25845
+ if (project && path8.isAbsolute(project)) aggregate.projectDirs.add(project);
25290
25846
  if (session.metadata?.cursorVersion)
25291
25847
  aggregate.ccVersions.add(session.metadata.cursorVersion);
25292
25848
  const times = messageTimes(session, api).filter(
@@ -25341,7 +25897,7 @@ async function scan3(options) {
25341
25897
  else aggregate.mainTokens += countsTotal(counts2);
25342
25898
  noteSessionStart(aggregate, session, tsMs);
25343
25899
  const project = sessions.get(session)?.session.canonicalWorkspacePath;
25344
- if (project && path7.isAbsolute(project))
25900
+ if (project && path8.isAbsolute(project))
25345
25901
  noteProjectDay(aggregate, project, tsMs);
25346
25902
  }
25347
25903
  aggregate.files = local.stats.filesRead;
@@ -25626,17 +26182,17 @@ function ingestContribution(agg, row) {
25626
26182
 
25627
26183
  // src/harness/grok/scan.ts
25628
26184
  import { createReadStream as createReadStream2 } from "node:fs";
25629
- import { readdir as readdir5, readFile as readFile3, stat as stat5 } from "node:fs/promises";
25630
- import { homedir as homedir13 } from "node:os";
25631
- import path9 from "node:path";
26185
+ import { readdir as readdir5, readFile as readFile4, stat as stat5 } from "node:fs/promises";
26186
+ import { homedir as homedir14 } from "node:os";
26187
+ import path10 from "node:path";
25632
26188
  import readline2 from "node:readline";
25633
26189
  import { parse as parseToml3 } from "smol-toml";
25634
26190
 
25635
26191
  // src/harness/grok/context.ts
25636
26192
  import { createHash as createHash7 } from "node:crypto";
25637
- import { appendFile, mkdir as mkdir2, readdir as readdir4, readFile as readFile2, unlink as unlink2 } from "node:fs/promises";
25638
- import { homedir as homedir12 } from "node:os";
25639
- import path8 from "node:path";
26193
+ import { appendFile, mkdir as mkdir3, readdir as readdir4, readFile as readFile3, unlink as unlink2 } from "node:fs/promises";
26194
+ import { homedir as homedir13 } from "node:os";
26195
+ import path9 from "node:path";
25640
26196
  var DAY_MS = 864e5;
25641
26197
  var hash = (value) => createHash7("sha256").update(value).digest("hex");
25642
26198
  function contextCall(value) {
@@ -25659,17 +26215,17 @@ function contextCall(value) {
25659
26215
  };
25660
26216
  }
25661
26217
  function contextCacheDirectory(root) {
25662
- return path8.join(
25663
- homedir12(),
26218
+ return path9.join(
26219
+ homedir13(),
25664
26220
  ".config",
25665
26221
  "aistack",
25666
26222
  "grok-context",
25667
- hash(path8.resolve(root))
26223
+ hash(path9.resolve(root))
25668
26224
  );
25669
26225
  }
25670
26226
  async function optionalRead(file) {
25671
26227
  try {
25672
- return await readFile2(file, "utf8");
26228
+ return await readFile3(file, "utf8");
25673
26229
  } catch (error) {
25674
26230
  if (error.code === "ENOENT") return "";
25675
26231
  throw error;
@@ -25687,14 +26243,14 @@ async function retainedContextCalls(root, sessions, cacheDir = contextCacheDirec
25687
26243
  for (const file of files) {
25688
26244
  if (!/^\d{4}-\d{2}-\d{2}\.jsonl$/.test(file)) continue;
25689
26245
  if (Date.parse(file.slice(0, 10)) + DAY_MS < cutoff) {
25690
- await unlink2(path8.join(cacheDir, file)).catch(
26246
+ await unlink2(path9.join(cacheDir, file)).catch(
25691
26247
  (error) => {
25692
26248
  if (error.code !== "ENOENT") throw error;
25693
26249
  }
25694
26250
  );
25695
26251
  continue;
25696
26252
  }
25697
- const raw2 = await optionalRead(path8.join(cacheDir, file));
26253
+ const raw2 = await optionalRead(path9.join(cacheDir, file));
25698
26254
  if (raw2 && !raw2.endsWith("\n"))
25699
26255
  throw Object.assign(new Error("Incomplete Grok context cache"), {
25700
26256
  code: "GROK_INCOMPLETE_CONTEXT_CACHE"
@@ -25715,7 +26271,7 @@ async function retainedContextCalls(root, sessions, cacheDir = contextCacheDirec
25715
26271
  }
25716
26272
  }
25717
26273
  const raw = await optionalRead(
25718
- path8.join(root, "..", "logs", "unified.jsonl")
26274
+ path9.join(root, "..", "logs", "unified.jsonl")
25719
26275
  );
25720
26276
  const additions = /* @__PURE__ */ new Map();
25721
26277
  for (const line of raw.slice(0, raw.lastIndexOf("\n") + 1).split("\n")) {
@@ -25735,10 +26291,10 @@ async function retainedContextCalls(root, sessions, cacheDir = contextCacheDirec
25735
26291
  additions.set(date, lines2);
25736
26292
  }
25737
26293
  if (additions.size) {
25738
- await mkdir2(cacheDir, { recursive: true, mode: 448 });
26294
+ await mkdir3(cacheDir, { recursive: true, mode: 448 });
25739
26295
  for (const [date, lines2] of additions) {
25740
26296
  await appendFile(
25741
- path8.join(cacheDir, `${date}.jsonl`),
26297
+ path9.join(cacheDir, `${date}.jsonl`),
25742
26298
  `${lines2.join("\n")}
25743
26299
  `,
25744
26300
  { mode: 384 }
@@ -25751,8 +26307,8 @@ async function retainedContextCalls(root, sessions, cacheDir = contextCacheDirec
25751
26307
  // src/harness/grok/scan.ts
25752
26308
  function sessionRoots() {
25753
26309
  return [
25754
- path9.join(
25755
- process.env.GROK_HOME || path9.join(homedir13(), ".grok"),
26310
+ path10.join(
26311
+ process.env.GROK_HOME || path10.join(homedir14(), ".grok"),
25756
26312
  "sessions"
25757
26313
  )
25758
26314
  ];
@@ -25786,7 +26342,7 @@ async function stableRead(file, jsonl) {
25786
26342
  if (before.size === after.size && before.mtimeMs === after.mtimeMs)
25787
26343
  return { lines: lines2, complete: true };
25788
26344
  } else {
25789
- const raw = await readFile3(file, "utf8");
26345
+ const raw = await readFile4(file, "utf8");
25790
26346
  const after = await stat5(file);
25791
26347
  if (before.size === after.size && before.mtimeMs === after.mtimeMs)
25792
26348
  return { json: JSON.parse(raw), complete: true };
@@ -25804,12 +26360,12 @@ async function directories(root) {
25804
26360
  const out = [];
25805
26361
  for (const workspace of workspaces) {
25806
26362
  if (!workspace.isDirectory() || workspace.isSymbolicLink()) continue;
25807
- const workspacePath = path9.join(root, workspace.name);
26363
+ const workspacePath = path10.join(root, workspace.name);
25808
26364
  for (const session of await readdir5(workspacePath, {
25809
26365
  withFileTypes: true
25810
26366
  })) {
25811
26367
  if (session.isDirectory() && !session.isSymbolicLink())
25812
- out.push(path9.join(workspacePath, session.name));
26368
+ out.push(path10.join(workspacePath, session.name));
25813
26369
  }
25814
26370
  }
25815
26371
  return out.sort();
@@ -25823,7 +26379,7 @@ async function modelAliasesForRoot(root) {
25823
26379
  if (process.env.GROK_MODELS_BASE_URL) return /* @__PURE__ */ new Map();
25824
26380
  try {
25825
26381
  const parsed = asObj(
25826
- parseToml3(await readFile3(path9.join(root, "..", "config.toml"), "utf8"))
26382
+ parseToml3(await readFile4(path10.join(root, "..", "config.toml"), "utf8"))
25827
26383
  );
25828
26384
  if (!parsed || asObj(parsed.endpoints)?.models_base_url) return /* @__PURE__ */ new Map();
25829
26385
  const models = asObj(parsed.model);
@@ -25864,10 +26420,10 @@ async function scan4(agg, opts = {}) {
25864
26420
  const files = new Map(
25865
26421
  entries.filter(
25866
26422
  (e) => e.isFile() && (isGrokEvidenceFile(e.name) || e.name === "summary.json")
25867
- ).map((e) => [e.name, path9.join(dir, e.name)])
26423
+ ).map((e) => [e.name, path10.join(dir, e.name)])
25868
26424
  );
25869
26425
  let projectDir = dir;
25870
- let sessionFallback = path9.basename(dir);
26426
+ let sessionFallback = path10.basename(dir);
25871
26427
  let child = false;
25872
26428
  let parentSession;
25873
26429
  const summary = files.get("summary.json");
@@ -26231,13 +26787,13 @@ function noteConfiguredMcpServers2(agg, state, serverNames) {
26231
26787
  // src/harness/opencode/scan.ts
26232
26788
  import { readFileSync as readFileSync12 } from "node:fs";
26233
26789
  import { readdir as readdir6, stat as stat6 } from "node:fs/promises";
26234
- import { homedir as homedir14 } from "node:os";
26235
- import path10 from "node:path";
26790
+ import { homedir as homedir15 } from "node:os";
26791
+ import path11 from "node:path";
26236
26792
  var OPENCODE_MIGRATION_CEILING = 20260622202450;
26237
26793
  function opencodeDataDirs() {
26238
26794
  const xdg = process.env.XDG_DATA_HOME;
26239
- const base = xdg || path10.join(homedir14(), ".local", "share");
26240
- return [path10.join(base, "opencode")];
26795
+ const base = xdg || path11.join(homedir15(), ".local", "share");
26796
+ return [path11.join(base, "opencode")];
26241
26797
  }
26242
26798
  function isStoreFile(basename5) {
26243
26799
  return basename5 === "opencode.db" || /^opencode-[^/]+\.db$/.test(basename5);
@@ -26247,7 +26803,7 @@ async function dbFilesIn(root) {
26247
26803
  if (override) return [override];
26248
26804
  try {
26249
26805
  const entries = await readdir6(root, { withFileTypes: true });
26250
- return entries.filter((e) => e.isFile() && isStoreFile(e.name)).map((e) => path10.join(root, e.name)).sort();
26806
+ return entries.filter((e) => e.isFile() && isStoreFile(e.name)).map((e) => path11.join(root, e.name)).sort();
26251
26807
  } catch (error) {
26252
26808
  if (error?.code !== "ENOENT")
26253
26809
  traceError("opencode database discovery", error, "warn");
@@ -26289,7 +26845,7 @@ async function scan5(agg, opts = {}) {
26289
26845
  traceError("opencode database read", e);
26290
26846
  stats.filesUnreadable++;
26291
26847
  stats.unreadableFiles.push({
26292
- path: path10.basename(file),
26848
+ path: path11.basename(file),
26293
26849
  reason: errorClass2(e)
26294
26850
  });
26295
26851
  }
@@ -26461,8 +27017,8 @@ function pickTs(jsonTs, columnTs) {
26461
27017
  }
26462
27018
  function opencodeConfigFile() {
26463
27019
  const xdg = process.env.XDG_CONFIG_HOME;
26464
- const base = xdg || path10.join(homedir14(), ".config");
26465
- return path10.join(base, "opencode", "opencode.json");
27020
+ const base = xdg || path11.join(homedir15(), ".config");
27021
+ return path11.join(base, "opencode", "opencode.json");
26466
27022
  }
26467
27023
  function readConfiguredMcpServers2(agg, state, configFile) {
26468
27024
  const file = configFile ?? opencodeConfigFile();
@@ -26772,16 +27328,16 @@ function readCounts2(usageRaw) {
26772
27328
  // src/harness/pi/scan.ts
26773
27329
  import { createReadStream as createReadStream3 } from "node:fs";
26774
27330
  import { readdir as readdir7, realpath as realpath3, stat as stat7 } from "node:fs/promises";
26775
- import { homedir as homedir15 } from "node:os";
26776
- import path11 from "node:path";
27331
+ import { homedir as homedir16 } from "node:os";
27332
+ import path12 from "node:path";
26777
27333
  import readline3 from "node:readline";
26778
27334
  var MAX_SESSION_VERSION = 3;
26779
27335
  function piAgentDir() {
26780
- return process.env.PI_CODING_AGENT_DIR || path11.join(homedir15(), ".pi", "agent");
27336
+ return process.env.PI_CODING_AGENT_DIR || path12.join(homedir16(), ".pi", "agent");
26781
27337
  }
26782
27338
  function sessionRoots2() {
26783
27339
  const override = process.env.PI_CODING_AGENT_SESSION_DIR;
26784
- return [override || path11.join(piAgentDir(), "sessions")];
27340
+ return [override || path12.join(piAgentDir(), "sessions")];
26785
27341
  }
26786
27342
  var SESSION_FILE_RE = /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.jsonl$/;
26787
27343
  function isSessionFile(basename5) {
@@ -26797,7 +27353,7 @@ async function* walkSessions(dir) {
26797
27353
  return;
26798
27354
  }
26799
27355
  for (const e of entries) {
26800
- const full = path11.join(dir, e.name);
27356
+ const full = path12.join(dir, e.name);
26801
27357
  if (e.isDirectory()) yield* walkSessions(full);
26802
27358
  else if (e.isFile() && isSessionFile(e.name)) yield full;
26803
27359
  }
@@ -26849,7 +27405,7 @@ async function scan6(agg, opts = {}) {
26849
27405
  stats.filesUnreadable++;
26850
27406
  stats.filesRead--;
26851
27407
  stats.unreadableFiles.push({
26852
- path: path11.relative(root, file),
27408
+ path: path12.relative(root, file),
26853
27409
  reason: "version-too-new"
26854
27410
  });
26855
27411
  }
@@ -26858,7 +27414,7 @@ async function scan6(agg, opts = {}) {
26858
27414
  stats.filesUnreadable++;
26859
27415
  stats.filesRead--;
26860
27416
  stats.unreadableFiles.push({
26861
- path: path11.relative(root, file),
27417
+ path: path12.relative(root, file),
26862
27418
  reason: "read-error"
26863
27419
  });
26864
27420
  }
@@ -27003,7 +27559,7 @@ var MCP_ADD_ARGS = [
27003
27559
  "mcp"
27004
27560
  ];
27005
27561
  var MCP_REMOVE_ARGS = ["mcp", "remove", "--scope", "user", "aistack"];
27006
- var SKILL_DEST = join13(homedir16(), ".claude", "skills", "aistack-sync");
27562
+ var SKILL_DEST = join13(homedir17(), ".claude", "skills", "aistack-sync");
27007
27563
  function runClaude(args) {
27008
27564
  const r = spawnSync("claude", args, { encoding: "utf-8" });
27009
27565
  const notFound = r.error !== void 0 && r.error.code === "ENOENT";
@@ -27327,11 +27883,11 @@ import * as p7 from "@clack/prompts";
27327
27883
  // src/autosync/codexHook.ts
27328
27884
  import { createHash as createHash8 } from "node:crypto";
27329
27885
  import { existsSync as existsSync13, mkdirSync as mkdirSync4, readFileSync as readFileSync14, writeFileSync as writeFileSync4 } from "node:fs";
27330
- import { homedir as homedir17 } from "node:os";
27886
+ import { homedir as homedir18 } from "node:os";
27331
27887
  import { dirname as dirname7, join as join15 } from "node:path";
27332
27888
  import { parse } from "smol-toml";
27333
27889
  function codexHome2() {
27334
- return process.env.CODEX_HOME || join15(homedir17(), ".codex");
27890
+ return process.env.CODEX_HOME || join15(homedir18(), ".codex");
27335
27891
  }
27336
27892
  function codexHooksFile() {
27337
27893
  return join15(codexHome2(), "hooks.json");
@@ -27472,14 +28028,14 @@ import * as p6 from "@clack/prompts";
27472
28028
 
27473
28029
  // src/autosync/cursorHook.ts
27474
28030
  import { existsSync as existsSync15, mkdirSync as mkdirSync6, readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from "node:fs";
27475
- import { homedir as homedir19, platform as platform2 } from "node:os";
28031
+ import { homedir as homedir20, platform as platform2 } from "node:os";
27476
28032
  import { dirname as dirname9, join as join17 } from "node:path";
27477
28033
 
27478
28034
  // src/autosync/hook.ts
27479
28035
  import { existsSync as existsSync14, mkdirSync as mkdirSync5, readFileSync as readFileSync15, writeFileSync as writeFileSync5 } from "node:fs";
27480
- import { homedir as homedir18 } from "node:os";
28036
+ import { homedir as homedir19 } from "node:os";
27481
28037
  import { dirname as dirname8, join as join16 } from "node:path";
27482
- var CLAUDE_SETTINGS_FILE = join16(homedir18(), ".claude", "settings.json");
28038
+ var CLAUDE_SETTINGS_FILE = join16(homedir19(), ".claude", "settings.json");
27483
28039
  var AUTO_SYNC_HOOK_COMMAND = "npx -y @use-aistack/cli@latest sync --auto || npx -y --prefer-offline @use-aistack/cli sync --auto";
27484
28040
  function isOurs2(entry) {
27485
28041
  return typeof entry.command === "string" && entry.command.includes("@use-aistack/cli") && entry.command.includes("sync --auto");
@@ -27552,7 +28108,7 @@ function autoSyncHookInstalled(file = CLAUDE_SETTINGS_FILE) {
27552
28108
  }
27553
28109
 
27554
28110
  // src/autosync/cursorHook.ts
27555
- var CURSOR_HOOK_FILE = join17(homedir19(), ".cursor", "hooks.json");
28111
+ var CURSOR_HOOK_FILE = join17(homedir20(), ".cursor", "hooks.json");
27556
28112
  function cursorHookCommand(os = platform2()) {
27557
28113
  if (os === "win32") {
27558
28114
  const script = `Start-Process -WindowStyle Hidden -FilePath 'cmd.exe' -ArgumentList '/d /s /c "set AISTACK_HOOK_SOURCE=cursor&& (${AUTO_SYNC_HOOK_COMMAND}) <NUL >NUL 2>&1"'`;
@@ -27632,10 +28188,10 @@ import {
27632
28188
  unlinkSync as unlinkSync5,
27633
28189
  writeFileSync as writeFileSync7
27634
28190
  } from "node:fs";
27635
- import { homedir as homedir20, platform as platform3 } from "node:os";
28191
+ import { homedir as homedir21, platform as platform3 } from "node:os";
27636
28192
  import { dirname as dirname10, join as join18 } from "node:path";
27637
28193
  var GROK_HOOK_FILE = join18(
27638
- process.env.GROK_HOME || join18(homedir20(), ".grok"),
28194
+ process.env.GROK_HOME || join18(homedir21(), ".grok"),
27639
28195
  "hooks",
27640
28196
  "aistack.json"
27641
28197
  );
@@ -27993,7 +28549,7 @@ import {
27993
28549
  unlinkSync as unlinkSync6,
27994
28550
  writeFileSync as writeFileSync9
27995
28551
  } from "node:fs";
27996
- import { homedir as homedir22 } from "node:os";
28552
+ import { homedir as homedir23 } from "node:os";
27997
28553
  import { dirname as dirname11, join as join19 } from "node:path";
27998
28554
 
27999
28555
  // src/sync/stage.ts
@@ -28154,7 +28710,7 @@ function selectDaysToPublish(input) {
28154
28710
  // src/workflow/git.ts
28155
28711
  import { execFile, execFileSync as execFileSync2 } from "node:child_process";
28156
28712
  import { existsSync as existsSync17 } from "node:fs";
28157
- import path12 from "node:path";
28713
+ import path13 from "node:path";
28158
28714
  var TEST_FILE_RULE_VERSION = "test-files/v2";
28159
28715
  var FILE_TYPE_RULE_VERSION = "file-types/v3";
28160
28716
  var COMMIT_SET_RULE_VERSION = "commit-set/v1";
@@ -28587,7 +29143,7 @@ function reduceGitHistories(histories, options) {
28587
29143
  current.changedLines += fileChangedLines;
28588
29144
  if (isTestFile(file)) current.touchesTest = true;
28589
29145
  if (fileChangedLines <= 0) continue;
28590
- const extension = path12.extname(file).toLowerCase();
29146
+ const extension = path13.extname(file).toLowerCase();
28591
29147
  if (APPROVED_EXTENSIONS.has(extension)) {
28592
29148
  current.extensionLines.set(
28593
29149
  extension,
@@ -28693,10 +29249,10 @@ function buildWorkflowExtraction(harnessWorkflows, git, utcOffsetMinutes = machi
28693
29249
  // src/sync/grokDateCache.ts
28694
29250
  import { createHash as createHash9 } from "node:crypto";
28695
29251
  import { existsSync as existsSync18, mkdirSync as mkdirSync8, readFileSync as readFileSync18, writeFileSync as writeFileSync8 } from "node:fs";
28696
- import { homedir as homedir21 } from "node:os";
28697
- import path13 from "node:path";
28698
- var defaultFile = path13.join(
28699
- homedir21(),
29252
+ import { homedir as homedir22 } from "node:os";
29253
+ import path14 from "node:path";
29254
+ var defaultFile = path14.join(
29255
+ homedir22(),
28700
29256
  ".config",
28701
29257
  "aistack",
28702
29258
  "grok-session-dates.json"
@@ -28719,7 +29275,7 @@ function loadGrokDateHints(scope, file = defaultFile) {
28719
29275
  function saveGrokDateHints(scope, hints, file = defaultFile) {
28720
29276
  const cache = read2(file);
28721
29277
  cache[scope] = hints;
28722
- mkdirSync8(path13.dirname(file), { recursive: true });
29278
+ mkdirSync8(path14.dirname(file), { recursive: true });
28723
29279
  writeFileSync8(file, JSON.stringify(cache, null, 2));
28724
29280
  }
28725
29281
  function mapToHints(value, floor) {
@@ -29255,6 +29811,7 @@ async function stageSync(deps) {
29255
29811
  const usageScans = [];
29256
29812
  const sinceMs = windowStartMs(now, windowDays);
29257
29813
  const daysSinceMs = windowStartMs(now, retentionDays);
29814
+ setCursorReadWindow(daysSinceMs);
29258
29815
  const candidates = await adapters();
29259
29816
  for (const adapter of candidates)
29260
29817
  step(`harness:${adapter.name}`, harnessLabel2(adapter.name), "waiting");
@@ -29502,7 +30059,7 @@ function describeScan(stats) {
29502
30059
  }
29503
30060
 
29504
30061
  // src/autosync/run.ts
29505
- var SYNC_LOG_FILE = join19(homedir22(), ".config", "aistack", "sync.log");
30062
+ var SYNC_LOG_FILE = join19(homedir23(), ".config", "aistack", "sync.log");
29506
30063
  var SYNC_LOG_MAX_LINES = 200;
29507
30064
  var FIX_COMMAND = "npx @use-aistack/cli sync";
29508
30065
  var REVOKED_RESULT = "off - auto-sync is switched off for this stack";
@@ -29555,7 +30112,7 @@ async function runAutoSync(deps) {
29555
30112
  const state = settings.autoSyncState ?? {};
29556
30113
  const lastRunAt = state.lastRunAt ?? 0;
29557
30114
  if (now - lastRunAt < windowMs) return;
29558
- const reservationFile = deps.reservationFile ?? `${settingsFile ?? join19(homedir22(), ".config", "aistack", "settings.json")}.auto-sync-attempt`;
30115
+ const reservationFile = deps.reservationFile ?? `${settingsFile ?? join19(homedir23(), ".config", "aistack", "settings.json")}.auto-sync-attempt`;
29559
30116
  if (!reserveAttempt(reservationFile, now, windowMs)) return;
29560
30117
  saveSettings({ autoSyncState: { ...state, lastRunAt: now } }, settingsFile);
29561
30118
  const stage = deps.stageImpl ?? stageSync;