@use-aistack/cli 0.16.9 → 0.16.11
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/cursor-worker.js +744 -323
- package/dist/cursor-worker.js.map +1 -1
- package/dist/index.js +1066 -528
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cursor-worker.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=
|
|
12
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
15
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
27
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
29
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
35
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
59
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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((
|
|
240
|
+
const residuePaths = [...new Set(cleanupErrors.flatMap((error) => error.details.residuePaths))].filter((path3) => !unverifiedResidueSet.has(path3)).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=
|
|
327
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
330
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
355
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
472
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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(
|
|
481
|
-
super(`Database is locked: ${
|
|
482
|
-
this.path =
|
|
480
|
+
constructor(path3) {
|
|
481
|
+
super(`Database is locked: ${path3}. Close Cursor or retry later.`);
|
|
482
|
+
this.path = path3;
|
|
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(
|
|
493
|
-
super(`Database not found: ${
|
|
494
|
-
this.path =
|
|
492
|
+
constructor(path3) {
|
|
493
|
+
super(`Database not found: ${path3}. Check dataPath configuration.`);
|
|
494
|
+
this.path = path3;
|
|
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(
|
|
547
|
-
super(`No workspace found for path: ${
|
|
548
|
-
this.path =
|
|
546
|
+
constructor(path3) {
|
|
547
|
+
super(`No workspace found for path: ${path3}. Please open the project in Cursor first.`);
|
|
548
|
+
this.path = path3;
|
|
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(
|
|
559
|
-
super(`Source and destination are the same: ${
|
|
560
|
-
this.path =
|
|
558
|
+
constructor(path3) {
|
|
559
|
+
super(`Source and destination are the same: ${path3}`);
|
|
560
|
+
this.path = path3;
|
|
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(
|
|
571
|
-
super(`No sessions found for workspace: ${
|
|
572
|
-
this.path =
|
|
570
|
+
constructor(path3) {
|
|
571
|
+
super(`No sessions found for workspace: ${path3}. Use 'cursor-history list --workspace "${path3}"' to verify.`);
|
|
572
|
+
this.path = path3;
|
|
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(
|
|
585
|
-
super(`Destination already has ${sessionCount} session(s): ${
|
|
586
|
-
this.path =
|
|
584
|
+
constructor(path3, sessionCount) {
|
|
585
|
+
super(`Destination already has ${sessionCount} session(s): ${path3}. Use --force to proceed (will add sessions alongside existing ones).`);
|
|
586
|
+
this.path = path3;
|
|
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(
|
|
622
|
-
super(`No Cursor data found at: ${
|
|
623
|
-
this.path =
|
|
621
|
+
constructor(path3) {
|
|
622
|
+
super(`No Cursor data found at: ${path3}. Verify Cursor is installed and has been used.`);
|
|
623
|
+
this.path = path3;
|
|
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(
|
|
634
|
-
super(`File already exists: ${
|
|
635
|
-
this.path =
|
|
633
|
+
constructor(path3) {
|
|
634
|
+
super(`File already exists: ${path3}. Use --force to overwrite.`);
|
|
635
|
+
this.path = path3;
|
|
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(
|
|
672
|
-
super(`Backup file not found: ${
|
|
673
|
-
this.path =
|
|
671
|
+
constructor(path3) {
|
|
672
|
+
super(`Backup file not found: ${path3}`);
|
|
673
|
+
this.path = path3;
|
|
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(
|
|
686
|
-
super(`Invalid backup file: ${
|
|
687
|
-
this.path =
|
|
685
|
+
constructor(path3, reason) {
|
|
686
|
+
super(`Invalid backup file: ${path3}. ${reason}`);
|
|
687
|
+
this.path = path3;
|
|
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(
|
|
699
|
-
super(`Target already has Cursor data: ${
|
|
700
|
-
this.path =
|
|
698
|
+
constructor(path3) {
|
|
699
|
+
super(`Target already has Cursor data: ${path3}. Use --force to overwrite.`);
|
|
700
|
+
this.path = path3;
|
|
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=
|
|
721
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/platform.js
|
|
722
722
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
723
|
-
import { homedir } from "node:os";
|
|
723
|
+
import { homedir as homedir2 } from "node:os";
|
|
724
724
|
import { basename, dirname, join } 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 = join(
|
|
760
|
+
const defaultStoreRoot = join(homedir2(), ".cursor");
|
|
761
761
|
if (storeRootEnv && !pathsEqual(storeRootEnv, defaultStoreRoot)) {
|
|
762
762
|
return "store";
|
|
763
763
|
}
|
|
@@ -767,11 +767,11 @@ function getDefaultCursorDataPath(platform) {
|
|
|
767
767
|
const p2 = platform ?? detectPlatform();
|
|
768
768
|
switch (p2) {
|
|
769
769
|
case "windows":
|
|
770
|
-
return join(process.env["APPDATA"] ?? join(
|
|
770
|
+
return join(process.env["APPDATA"] ?? join(homedir2(), "AppData", "Roaming"), "Cursor", "User", "workspaceStorage");
|
|
771
771
|
case "macos":
|
|
772
|
-
return join(
|
|
772
|
+
return join(homedir2(), "Library", "Application Support", "Cursor", "User", "workspaceStorage");
|
|
773
773
|
case "linux":
|
|
774
|
-
return join(
|
|
774
|
+
return join(homedir2(), ".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 join(dirname(getCursorDataPath(customDataPath)), "globalStorage");
|
|
789
789
|
}
|
|
790
|
-
function expandPath(
|
|
791
|
-
if (
|
|
792
|
-
return join(
|
|
790
|
+
function expandPath(path3) {
|
|
791
|
+
if (path3.startsWith("~")) {
|
|
792
|
+
return join(homedir2(), path3.slice(1));
|
|
793
793
|
}
|
|
794
|
-
return
|
|
794
|
+
return path3;
|
|
795
795
|
}
|
|
796
|
-
function contractPath(
|
|
797
|
-
const home =
|
|
798
|
-
if (
|
|
799
|
-
return "~" +
|
|
796
|
+
function contractPath(path3) {
|
|
797
|
+
const home = homedir2();
|
|
798
|
+
if (path3.startsWith(home)) {
|
|
799
|
+
return "~" + path3.slice(home.length);
|
|
800
800
|
}
|
|
801
|
-
return
|
|
801
|
+
return path3;
|
|
802
802
|
}
|
|
803
803
|
function normalizePath(filePath) {
|
|
804
804
|
let normalized = filePath;
|
|
805
805
|
if (normalized.startsWith("~")) {
|
|
806
|
-
normalized = join(
|
|
806
|
+
normalized = join(homedir2(), normalized.slice(1));
|
|
807
807
|
}
|
|
808
808
|
while (normalized.length > 1 && normalized.endsWith("/")) {
|
|
809
809
|
normalized = normalized.slice(0, -1);
|
|
@@ -813,7 +813,7 @@ function normalizePath(filePath) {
|
|
|
813
813
|
}
|
|
814
814
|
return normalized;
|
|
815
815
|
}
|
|
816
|
-
function pathsEqual(path1,
|
|
816
|
+
function pathsEqual(path1, path22) {
|
|
817
817
|
const normalize = (p2) => {
|
|
818
818
|
let normalized = normalizePath(p2).replace(/\\/g, "/");
|
|
819
819
|
if (/^\/[a-z]:\//i.test(normalized))
|
|
@@ -828,7 +828,7 @@ function pathsEqual(path1, path2) {
|
|
|
828
828
|
}
|
|
829
829
|
return normalized;
|
|
830
830
|
};
|
|
831
|
-
return normalize(path1) === normalize(
|
|
831
|
+
return normalize(path1) === normalize(path22);
|
|
832
832
|
}
|
|
833
833
|
function getStoreStackRoot(customDataPath) {
|
|
834
834
|
return resolveStoreRoot(customDataPath);
|
|
@@ -908,29 +908,29 @@ function resolveStoreRoot(customDataPath) {
|
|
|
908
908
|
const storeEnv = process.env["CURSOR_STORE_ROOT"];
|
|
909
909
|
if (storeEnv)
|
|
910
910
|
return findStoreRoot(storeEnv) ?? storeEnv;
|
|
911
|
-
return join(
|
|
911
|
+
return join(homedir2(), ".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=
|
|
915
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
921
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
926
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
933
|
-
import { createHash } from "node:crypto";
|
|
932
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/session-identity.js
|
|
933
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
934
934
|
function compareCodePoints2(left, right) {
|
|
935
935
|
const leftPoints = Array.from(left);
|
|
936
936
|
const rightPoints = Array.from(right);
|
|
@@ -999,7 +999,7 @@ function canonicalJsonV1(value) {
|
|
|
999
999
|
return canonicalize(value, /* @__PURE__ */ new Set(), false);
|
|
1000
1000
|
}
|
|
1001
1001
|
function sha256CanonicalJsonV1(value) {
|
|
1002
|
-
return
|
|
1002
|
+
return createHash2("sha256").update(canonicalJsonV1(value), "utf8").digest("hex");
|
|
1003
1003
|
}
|
|
1004
1004
|
function projectV016ComposerMessages(messages) {
|
|
1005
1005
|
return messages.map((message, sourceOrdinal) => {
|
|
@@ -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=
|
|
1180
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
1187
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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
|
}
|
|
@@ -1221,13 +1221,13 @@ function resolveSessionField(input2, field, extrema) {
|
|
|
1221
1221
|
return { value: copyTimestamp(metadata.value), source: metadata.source };
|
|
1222
1222
|
const directTimes = directMessageTimes(input2.directMessages);
|
|
1223
1223
|
if (directTimes.length > 0) {
|
|
1224
|
-
const selectedMs = directTimes.reduce((selected,
|
|
1225
|
-
const time =
|
|
1224
|
+
const selectedMs = directTimes.reduce((selected, timestamp2) => {
|
|
1225
|
+
const time = timestamp2.getTime();
|
|
1226
1226
|
return extrema === "earliest" ? Math.min(selected, time) : Math.max(selected, time);
|
|
1227
1227
|
}, directTimes[0].getTime());
|
|
1228
1228
|
return { value: new Date(selectedMs), source: "direct-message" };
|
|
1229
1229
|
}
|
|
1230
|
-
return { value: new Date(
|
|
1230
|
+
return { value: new Date(UNKNOWN_TIMESTAMP_EPOCH_MS2), source: "epoch-unknown" };
|
|
1231
1231
|
}
|
|
1232
1232
|
function resolveSessionTimestamps(input2) {
|
|
1233
1233
|
const created = resolveSessionField(input2, "createdAt", "earliest");
|
|
@@ -1242,7 +1242,7 @@ function resolveSessionTimestamps(input2) {
|
|
|
1242
1242
|
function getPublicMessageTimestamp(message) {
|
|
1243
1243
|
if (!isValidTimestamp(message.timestamp)) {
|
|
1244
1244
|
return {
|
|
1245
|
-
timestamp: new Date(
|
|
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(
|
|
1301
|
+
message.timestamp = new Date(UNKNOWN_TIMESTAMP_EPOCH_MS2);
|
|
1302
1302
|
message.timestampSource = "unknown";
|
|
1303
1303
|
}
|
|
1304
1304
|
}
|
|
1305
|
-
var
|
|
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=
|
|
1307
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/timestamps.js"() {
|
|
1308
1308
|
"use strict";
|
|
1309
|
-
|
|
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=
|
|
1318
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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(
|
|
1443
|
-
return
|
|
1442
|
+
function exactComparisonKey(path3) {
|
|
1443
|
+
return path3.caseInsensitive ? path3.path.toLowerCase() : path3.path;
|
|
1444
1444
|
}
|
|
1445
1445
|
function componentsEndWith(candidate, request) {
|
|
1446
1446
|
if (request.drive && candidate.drive !== request.drive)
|
|
@@ -1486,14 +1486,14 @@ function resolveWorkspaceScope(request, 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=
|
|
1489
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
1496
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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)
|
|
@@ -1875,7 +1875,7 @@ function parseMessage(raw) {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
const rawRole = raw.role ?? raw.type ?? "user";
|
|
1877
1877
|
const role = normalizeRole(rawRole);
|
|
1878
|
-
const
|
|
1878
|
+
const timestamp2 = raw.timestamp != null ? new Date(raw.timestamp) : raw.createdAt != null ? new Date(raw.createdAt) : void 0;
|
|
1879
1879
|
const message = {
|
|
1880
1880
|
id: raw.id ?? null,
|
|
1881
1881
|
role,
|
|
@@ -1883,8 +1883,8 @@ function parseMessage(raw) {
|
|
|
1883
1883
|
codeBlocks: extractCodeBlocks(content),
|
|
1884
1884
|
source: "composer"
|
|
1885
1885
|
};
|
|
1886
|
-
if (
|
|
1887
|
-
message.timestamp =
|
|
1886
|
+
if (timestamp2 !== void 0) {
|
|
1887
|
+
message.timestamp = timestamp2;
|
|
1888
1888
|
message.timestampSource = "composer-created-at";
|
|
1889
1889
|
}
|
|
1890
1890
|
return message;
|
|
@@ -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=
|
|
2253
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
2300
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
2338
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
2346
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
2407
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
2415
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
2427
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
2432
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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, input2) {
|
|
|
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=
|
|
2480
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
2519
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/observed.js
|
|
2520
2520
|
function requestIdentity(request) {
|
|
2521
2521
|
return request.ioResource ?? { resourceClass: "unclassified-resource" };
|
|
2522
2522
|
}
|
|
@@ -2599,7 +2599,7 @@ function observeDatabaseBackup(request) {
|
|
|
2599
2599
|
}
|
|
2600
2600
|
var ObservedStatement, ObservedDatabase;
|
|
2601
2601
|
var init_observed = __esm({
|
|
2602
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2602
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
2662
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
2668
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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(request);
|
|
2843
2843
|
}
|
|
2844
2844
|
/** Open a database in read-only mode. */
|
|
2845
|
-
async openDatabase(
|
|
2845
|
+
async openDatabase(path3, request = READ_SESSION_REQUEST) {
|
|
2846
2846
|
const driver = await this.ensureDriver(request);
|
|
2847
|
-
return openObservedDatabase(request.io, request, () => driver.open(
|
|
2847
|
+
return openObservedDatabase(request.io, request, () => driver.open(path3, { readonly: true }));
|
|
2848
2848
|
}
|
|
2849
2849
|
/** Open a database in read-write mode. */
|
|
2850
|
-
async openDatabaseReadWrite(
|
|
2850
|
+
async openDatabaseReadWrite(path3, request = MIGRATION_REQUEST) {
|
|
2851
2851
|
const driver = await this.ensureDriver(request);
|
|
2852
|
-
return openObservedDatabase(request.io, request, () => driver.open(
|
|
2852
|
+
return openObservedDatabase(request.io, request, () => driver.open(path3, { 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(
|
|
2860
|
+
openSync(path3, 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(
|
|
2864
|
+
return this.currentDriver.open(path3, options);
|
|
2865
2865
|
}
|
|
2866
2866
|
/** Create an online database snapshot with a provider satisfying the complete request. */
|
|
2867
2867
|
async backupDatabase(sourcePath, destPath, request = 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=
|
|
2885
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
2958
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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(
|
|
3011
|
+
open(path3, 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(
|
|
3016
|
-
debugLog(`Opened database with better-sqlite3: ${
|
|
3015
|
+
const db = new BetterSqlite3(path3, { readonly: options.readonly });
|
|
3016
|
+
debugLog(`Opened database with better-sqlite3: ${path3} (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=
|
|
3036
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
3131
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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(
|
|
3207
|
+
open(path3, 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(
|
|
3212
|
-
debugLog(`Opened database with node:sqlite: ${
|
|
3211
|
+
const db = new nodeSqliteModule.DatabaseSync(path3, { readOnly: options.readonly });
|
|
3212
|
+
debugLog(`Opened database with node:sqlite: ${path3} (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=
|
|
3236
|
-
async function openDatabase(
|
|
3237
|
-
return registry.openDatabase(
|
|
3235
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/index.js
|
|
3236
|
+
async function openDatabase(path3, request) {
|
|
3237
|
+
return registry.openDatabase(path3, request);
|
|
3238
3238
|
}
|
|
3239
|
-
async function openDatabaseReadWrite(
|
|
3240
|
-
return registry.openDatabaseReadWrite(
|
|
3239
|
+
async function openDatabaseReadWrite(path3, request) {
|
|
3240
|
+
return registry.openDatabaseReadWrite(path3, request);
|
|
3241
3241
|
}
|
|
3242
3242
|
function getActiveDriver() {
|
|
3243
3243
|
return registry.getActiveDriver();
|
|
@@ -3255,7 +3255,7 @@ async function backupDatabase(sourcePath, destPath, request) {
|
|
|
3255
3255
|
return registry.backupDatabase(sourcePath, destPath, request);
|
|
3256
3256
|
}
|
|
3257
3257
|
var init_database = __esm({
|
|
3258
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
3258
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
3269
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/private-temp.js
|
|
3270
3270
|
import { chmodSync, closeSync, constants, fchmodSync, fstatSync, fsyncSync, lstatSync, mkdtempSync, openSync, readFileSync as readFileSync2, readlinkSync, readdirSync as readdirSync2, realpathSync, rmdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3271
3271
|
import { tmpdir } from "node:os";
|
|
3272
3272
|
import { basename as basename2, isAbsolute, join as join2, relative, 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(
|
|
3378
|
-
const descriptor = openSync(
|
|
3377
|
+
function createExclusivePrivateFile(path3, contents) {
|
|
3378
|
+
const descriptor = openSync(path3, exclusiveFlags(), 384);
|
|
3379
3379
|
try {
|
|
3380
3380
|
if (IS_PERMISSION_AWARE_POSIX)
|
|
3381
3381
|
fchmodSync(descriptor, 384);
|
|
@@ -3387,10 +3387,10 @@ function createExclusivePrivateFile(path2, contents) {
|
|
|
3387
3387
|
closeSync(descriptor);
|
|
3388
3388
|
}
|
|
3389
3389
|
}
|
|
3390
|
-
function attemptRemoveEntryNoFollow(
|
|
3390
|
+
function attemptRemoveEntryNoFollow(path3) {
|
|
3391
3391
|
let stats;
|
|
3392
3392
|
try {
|
|
3393
|
-
stats = lstatSync(
|
|
3393
|
+
stats = lstatSync(path3);
|
|
3394
3394
|
} catch (error) {
|
|
3395
3395
|
if (!isMissing(error)) {
|
|
3396
3396
|
}
|
|
@@ -3398,13 +3398,13 @@ function attemptRemoveEntryNoFollow(path2) {
|
|
|
3398
3398
|
}
|
|
3399
3399
|
if (stats.isDirectory() && !stats.isSymbolicLink()) {
|
|
3400
3400
|
try {
|
|
3401
|
-
rmdirSync(
|
|
3401
|
+
rmdirSync(path3);
|
|
3402
3402
|
} catch {
|
|
3403
3403
|
}
|
|
3404
3404
|
return;
|
|
3405
3405
|
}
|
|
3406
3406
|
try {
|
|
3407
|
-
unlinkSync(
|
|
3407
|
+
unlinkSync(path3);
|
|
3408
3408
|
} catch {
|
|
3409
3409
|
}
|
|
3410
3410
|
}
|
|
@@ -3432,9 +3432,9 @@ function attemptRemoveWorkspaceNoFollow(directoryPath) {
|
|
|
3432
3432
|
} catch {
|
|
3433
3433
|
}
|
|
3434
3434
|
}
|
|
3435
|
-
function mayStillExist(
|
|
3435
|
+
function mayStillExist(path3) {
|
|
3436
3436
|
try {
|
|
3437
|
-
lstatSync(
|
|
3437
|
+
lstatSync(path3);
|
|
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=
|
|
3710
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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(
|
|
3735
|
-
this.path =
|
|
3734
|
+
constructor(path3, marker, markerPath, signal) {
|
|
3735
|
+
this.path = path3;
|
|
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(
|
|
3766
|
+
register(path3) {
|
|
3767
3767
|
this.assertOpen();
|
|
3768
|
-
const candidatePath = resolve(
|
|
3768
|
+
const candidatePath = resolve(path3);
|
|
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
|
|
3783
|
-
attemptRemoveEntryNoFollow(
|
|
3782
|
+
for (const path3 of tracked)
|
|
3783
|
+
attemptRemoveEntryNoFollow(path3);
|
|
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=
|
|
3799
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
3802
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
3808
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=
|
|
3908
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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,8 +4034,8 @@ var init_source_read_limits = __esm({
|
|
|
4034
4034
|
}
|
|
4035
4035
|
});
|
|
4036
4036
|
|
|
4037
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
4038
|
-
import { createHash as
|
|
4037
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/zip-stream.js
|
|
4038
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
4039
4039
|
import { open, unlink } from "node:fs/promises";
|
|
4040
4040
|
import { Readable, Transform, Writable } from "node:stream";
|
|
4041
4041
|
import { pipeline } from "node:stream/promises";
|
|
@@ -4550,7 +4550,7 @@ async function prepareZipFileInputs(inputs, options = {}) {
|
|
|
4550
4550
|
enforceIntegerLimit("zip-aggregate-bytes", aggregateBytes, limits);
|
|
4551
4551
|
enforceRatioLimit(before.size, before.size, limits);
|
|
4552
4552
|
const size = toSafeOffset(before.size, "Generated ZIP input size");
|
|
4553
|
-
const hash =
|
|
4553
|
+
const hash = createHash3("sha256");
|
|
4554
4554
|
let crc = 4294967295;
|
|
4555
4555
|
let observed = 0;
|
|
4556
4556
|
for await (const rawChunk of readHandleRange(handle, 0, size, options.signal)) {
|
|
@@ -4730,7 +4730,7 @@ async function writeBoundedZipArchive(destinationPath, inputs, options = {}) {
|
|
|
4730
4730
|
throw formatError("Prepared ZIP input changed before archive creation.");
|
|
4731
4731
|
}
|
|
4732
4732
|
let crc = 4294967295;
|
|
4733
|
-
const hash =
|
|
4733
|
+
const hash = createHash3("sha256");
|
|
4734
4734
|
let observed = 0;
|
|
4735
4735
|
for await (const rawChunk of readHandleRange(source, 0, entry.size, options.signal)) {
|
|
4736
4736
|
const chunk = Buffer.from(rawChunk);
|
|
@@ -4803,12 +4803,12 @@ async function writeBoundedZipArchive(destinationPath, inputs, options = {}) {
|
|
|
4803
4803
|
throw error;
|
|
4804
4804
|
}
|
|
4805
4805
|
}
|
|
4806
|
-
async function openBoundedZipArchive(
|
|
4807
|
-
return BoundedZipArchive.open(
|
|
4806
|
+
async function openBoundedZipArchive(path3, options) {
|
|
4807
|
+
return BoundedZipArchive.open(path3, 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=
|
|
4811
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/zip-stream.js"() {
|
|
4812
4812
|
"use strict";
|
|
4813
4813
|
init_errors();
|
|
4814
4814
|
init_source_read_limits();
|
|
@@ -4885,7 +4885,7 @@ var init_zip_stream = __esm({
|
|
|
4885
4885
|
signal;
|
|
4886
4886
|
bytes = 0;
|
|
4887
4887
|
crc = 4294967295;
|
|
4888
|
-
hash =
|
|
4888
|
+
hash = createHash3("sha256");
|
|
4889
4889
|
checksumValue;
|
|
4890
4890
|
constructor(entry, limits, onBytes, signal) {
|
|
4891
4891
|
super();
|
|
@@ -4950,8 +4950,8 @@ var init_zip_stream = __esm({
|
|
|
4950
4950
|
actualAggregateBytes = 0;
|
|
4951
4951
|
byName;
|
|
4952
4952
|
localEndBoundary;
|
|
4953
|
-
constructor(
|
|
4954
|
-
this.path =
|
|
4953
|
+
constructor(path3, entries, archiveSize, centralOffset, handle, limits, signal, io) {
|
|
4954
|
+
this.path = path3;
|
|
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(
|
|
4966
|
+
static async open(path3, 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 open(
|
|
4976
|
+
const handle = await open(path3, "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(
|
|
4992
|
+
return new _BoundedZipArchive(path3, 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=
|
|
5203
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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
|
}
|
|
@@ -5317,7 +5317,7 @@ function createComposerSqliteBudget(limits = SOURCE_READ_LIMITS_V1_DEFAULTS, out
|
|
|
5317
5317
|
}
|
|
5318
5318
|
function getBoundedComposerMetadataByKey(db, table, key2, budget, signal) {
|
|
5319
5319
|
throwIfAborted2(signal);
|
|
5320
|
-
const raw = db.prepare(`SELECT CAST(rowid AS TEXT) AS rowId, key,
|
|
5320
|
+
const raw = db.prepare(`SELECT CAST(rowid AS TEXT) AS rowId, key, octet_length(value) AS byteLength FROM ${table} WHERE key = ? COLLATE BINARY AND value IS NOT NULL`).get(key2);
|
|
5321
5321
|
if (!raw)
|
|
5322
5322
|
return void 0;
|
|
5323
5323
|
const metadata = normalizeMetadata(raw, key2);
|
|
@@ -5331,7 +5331,7 @@ function forEachBoundedComposerMetadata(db, table, keyPattern, budget, visit, si
|
|
|
5331
5331
|
let afterKey = null;
|
|
5332
5332
|
while (true) {
|
|
5333
5333
|
throwIfAborted2(signal);
|
|
5334
|
-
const rawPage = range ? db.prepare(`SELECT CAST(${table}.rowid AS TEXT) AS rowId, key,
|
|
5334
|
+
const rawPage = range ? db.prepare(`SELECT CAST(${table}.rowid AS TEXT) AS rowId, key, octet_length(value) 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, octet_length(value) 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);
|
|
5335
5335
|
if (rawPage.length === 0)
|
|
5336
5336
|
break;
|
|
5337
5337
|
const fallbackBase = typeof afterRowId === "number" && Number.isSafeInteger(afterRowId) ? afterRowId : -1;
|
|
@@ -5355,7 +5355,7 @@ function forEachBoundedComposerBubbleMetadata(db, keyPattern, budget, visit, sig
|
|
|
5355
5355
|
let afterKey = null;
|
|
5356
5356
|
while (true) {
|
|
5357
5357
|
throwIfAborted2(signal);
|
|
5358
|
-
const rawPage = range ? db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(
|
|
5358
|
+
const rawPage = range ? db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(octet_length(value), 0) AS byteLength, octet_length(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(octet_length(value), 0) AS byteLength, octet_length(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);
|
|
5359
5359
|
if (rawPage.length === 0)
|
|
5360
5360
|
break;
|
|
5361
5361
|
const fallbackBase = typeof afterRowId === "number" && Number.isSafeInteger(afterRowId) ? afterRowId : -1;
|
|
@@ -5377,7 +5377,7 @@ function forEachBoundedComposerBubbleMetadataByExactPrefix(db, keyPrefix, budget
|
|
|
5377
5377
|
let afterRowId = null;
|
|
5378
5378
|
while (true) {
|
|
5379
5379
|
throwIfAborted2(signal);
|
|
5380
|
-
const rawPage = db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(
|
|
5380
|
+
const rawPage = db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(octet_length(value), 0) AS byteLength, octet_length(value) IS NULL AS valueIsNull FROM cursorDiskKV WHERE ${exactBlobPrefixPredicate("cursorDiskKV.key")} AND cursorDiskKV.rowid > COALESCE(?, -1) ORDER BY cursorDiskKV.rowid ASC LIMIT ?`).all(keyPrefix, exactPrefixUpperBound(keyPrefix), keyPrefix, keyPrefix, afterRowId, pageRows);
|
|
5381
5381
|
if (rawPage.length === 0)
|
|
5382
5382
|
break;
|
|
5383
5383
|
const fallbackBase = typeof afterRowId === "number" && Number.isSafeInteger(afterRowId) ? afterRowId : -1;
|
|
@@ -5432,7 +5432,7 @@ function readAdmittedComposerBubbleValue(db, metadata, budget, signal) {
|
|
|
5432
5432
|
rawValue = internal.inlineValue;
|
|
5433
5433
|
returnedValueIsNull = rawValue === null;
|
|
5434
5434
|
} else {
|
|
5435
|
-
const row = db.prepare(`SELECT key, CAST(value AS BLOB) AS value, value IS NULL AS valueIsNull FROM cursorDiskKV WHERE cursorDiskKV.rowid = ? AND key = ? COLLATE BINARY`).get(metadata.rowId, metadata.key);
|
|
5435
|
+
const row = db.prepare(`SELECT key, CAST(value AS BLOB) AS value, octet_length(value) IS NULL AS valueIsNull FROM cursorDiskKV WHERE cursorDiskKV.rowid = ? AND key = ? COLLATE BINARY`).get(metadata.rowId, metadata.key);
|
|
5436
5436
|
if (!row || row.value === void 0) {
|
|
5437
5437
|
throw new Error("Composer SQLite payload changed after metadata admission.");
|
|
5438
5438
|
}
|
|
@@ -5473,7 +5473,7 @@ function readBoundedComposerValueByKey(db, table, key2, budget, signal) {
|
|
|
5473
5473
|
}
|
|
5474
5474
|
function readFirstBoundedComposerBubbleValueByExactPrefix(db, keyPrefix, budget, signal) {
|
|
5475
5475
|
throwIfAborted2(signal);
|
|
5476
|
-
const raw = db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(
|
|
5476
|
+
const raw = db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(octet_length(value), 0) AS byteLength, octet_length(value) IS NULL AS valueIsNull FROM cursorDiskKV WHERE ${exactBlobPrefixPredicate("cursorDiskKV.key")} ORDER BY cursorDiskKV.rowid ASC LIMIT 1`).get(keyPrefix, exactPrefixUpperBound(keyPrefix), keyPrefix, keyPrefix);
|
|
5477
5477
|
if (!raw)
|
|
5478
5478
|
return void 0;
|
|
5479
5479
|
const metadata = normalizeBubbleMetadata(raw, keyPrefix);
|
|
@@ -5487,13 +5487,13 @@ function forEachBoundedComposerBubbleValueByExactPrefix(db, keyPrefix, budget, v
|
|
|
5487
5487
|
forEachBoundedComposerBubbleMetadataByExactPrefix(db, keyPrefix, budget, (metadata) => visit(readAdmittedComposerBubbleValue(db, metadata, budget, signal)), signal);
|
|
5488
5488
|
}
|
|
5489
5489
|
var init_composer_sqlite = __esm({
|
|
5490
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5490
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/composer-sqlite.js"() {
|
|
5491
5491
|
"use strict";
|
|
5492
5492
|
init_source_read_limits();
|
|
5493
5493
|
}
|
|
5494
5494
|
});
|
|
5495
5495
|
|
|
5496
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5496
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup-publication.js
|
|
5497
5497
|
import { closeSync as closeSync2, constants as constants2, fchmodSync as fchmodSync2, fstatSync as fstatSync2, lstatSync as lstatSync2, openSync as openSync2 } from "node:fs";
|
|
5498
5498
|
function projectStat(stat2) {
|
|
5499
5499
|
return {
|
|
@@ -5569,20 +5569,20 @@ function enforcePublishedArchiveMode(outputPath, requestedMode, expectedIdentity
|
|
|
5569
5569
|
}
|
|
5570
5570
|
var DEFAULT_MODE_OPERATIONS;
|
|
5571
5571
|
var init_backup_publication = __esm({
|
|
5572
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5572
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup-publication.js"() {
|
|
5573
5573
|
"use strict";
|
|
5574
5574
|
init_errors();
|
|
5575
5575
|
DEFAULT_MODE_OPERATIONS = Object.freeze({
|
|
5576
|
-
openNoFollow: (
|
|
5576
|
+
openNoFollow: (path3) => openSync2(path3, constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0)),
|
|
5577
5577
|
statDescriptor: (descriptor) => projectStat(fstatSync2(descriptor, { bigint: true })),
|
|
5578
5578
|
chmodDescriptor: (descriptor, mode) => fchmodSync2(descriptor, mode),
|
|
5579
|
-
statPathNoFollow: (
|
|
5579
|
+
statPathNoFollow: (path3) => projectStat(lstatSync2(path3, { bigint: true })),
|
|
5580
5580
|
close: (descriptor) => closeSync2(descriptor)
|
|
5581
5581
|
});
|
|
5582
5582
|
}
|
|
5583
5583
|
});
|
|
5584
5584
|
|
|
5585
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5585
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup-archive-publication.js
|
|
5586
5586
|
import { linkSync, lstatSync as lstatSync3, renameSync, unlinkSync as unlinkSync2 } from "node:fs";
|
|
5587
5587
|
function errorCode(error) {
|
|
5588
5588
|
return error instanceof Error && "code" in error ? String(error.code) : void 0;
|
|
@@ -5590,9 +5590,9 @@ function errorCode(error) {
|
|
|
5590
5590
|
function hasIdentity2(stat2, expected) {
|
|
5591
5591
|
return stat2.isFile() && stat2.dev === expected.device && stat2.ino === expected.inode;
|
|
5592
5592
|
}
|
|
5593
|
-
function pathIdentityVerified(
|
|
5593
|
+
function pathIdentityVerified(path3, expected, operations) {
|
|
5594
5594
|
try {
|
|
5595
|
-
return hasIdentity2(operations.statPathNoFollow(
|
|
5595
|
+
return hasIdentity2(operations.statPathNoFollow(path3), expected);
|
|
5596
5596
|
} catch {
|
|
5597
5597
|
return false;
|
|
5598
5598
|
}
|
|
@@ -5636,20 +5636,20 @@ function publishBackupArchiveStage(stagePath, outputPath, force, identity, onCom
|
|
|
5636
5636
|
}
|
|
5637
5637
|
var CLEANUP_ATTEMPTS, DEFAULT_OPERATIONS;
|
|
5638
5638
|
var init_backup_archive_publication = __esm({
|
|
5639
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5639
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup-archive-publication.js"() {
|
|
5640
5640
|
"use strict";
|
|
5641
5641
|
init_errors();
|
|
5642
5642
|
CLEANUP_ATTEMPTS = 2;
|
|
5643
5643
|
DEFAULT_OPERATIONS = Object.freeze({
|
|
5644
5644
|
rename: (sourcePath, destinationPath) => renameSync(sourcePath, destinationPath),
|
|
5645
5645
|
link: (sourcePath, destinationPath) => linkSync(sourcePath, destinationPath),
|
|
5646
|
-
unlink: (
|
|
5647
|
-
statPathNoFollow: (
|
|
5646
|
+
unlink: (path3) => unlinkSync2(path3),
|
|
5647
|
+
statPathNoFollow: (path3) => lstatSync3(path3, { bigint: true })
|
|
5648
5648
|
});
|
|
5649
5649
|
}
|
|
5650
5650
|
});
|
|
5651
5651
|
|
|
5652
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5652
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/restore-publication.js
|
|
5653
5653
|
import { linkSync as linkSync2, lstatSync as lstatSync4, renameSync as renameSync2, unlinkSync as unlinkSync3 } from "node:fs";
|
|
5654
5654
|
function errorCode2(error) {
|
|
5655
5655
|
return error instanceof Error && "code" in error ? String(error.code) : void 0;
|
|
@@ -5657,8 +5657,8 @@ function errorCode2(error) {
|
|
|
5657
5657
|
function hasIdentity3(stat2, expected) {
|
|
5658
5658
|
return stat2.isFile() && stat2.dev === expected.device && stat2.ino === expected.inode;
|
|
5659
5659
|
}
|
|
5660
|
-
function cleanupError(
|
|
5661
|
-
const error = new TemporaryArtifactCleanupError(identityVerified ? [
|
|
5660
|
+
function cleanupError(path3, cause, identityVerified = true) {
|
|
5661
|
+
const error = new TemporaryArtifactCleanupError(identityVerified ? [path3] : [], identityVerified ? [] : [path3]);
|
|
5662
5662
|
Object.defineProperty(error, "cause", { configurable: true, value: cause });
|
|
5663
5663
|
return error;
|
|
5664
5664
|
}
|
|
@@ -5699,20 +5699,20 @@ function commitRestorePublication(publicationPath, destinationPath, replaceExist
|
|
|
5699
5699
|
}
|
|
5700
5700
|
var CLEANUP_ATTEMPTS2, DEFAULT_OPERATIONS2;
|
|
5701
5701
|
var init_restore_publication = __esm({
|
|
5702
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5702
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/restore-publication.js"() {
|
|
5703
5703
|
"use strict";
|
|
5704
5704
|
init_errors();
|
|
5705
5705
|
CLEANUP_ATTEMPTS2 = 2;
|
|
5706
5706
|
DEFAULT_OPERATIONS2 = Object.freeze({
|
|
5707
5707
|
rename: (sourcePath, destinationPath) => renameSync2(sourcePath, destinationPath),
|
|
5708
5708
|
link: (sourcePath, destinationPath) => linkSync2(sourcePath, destinationPath),
|
|
5709
|
-
unlink: (
|
|
5710
|
-
statPathNoFollow: (
|
|
5709
|
+
unlink: (path3) => unlinkSync3(path3),
|
|
5710
|
+
statPathNoFollow: (path3) => lstatSync4(path3, { bigint: true })
|
|
5711
5711
|
});
|
|
5712
5712
|
}
|
|
5713
5713
|
});
|
|
5714
5714
|
|
|
5715
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5715
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/session-id.js
|
|
5716
5716
|
function isNativeCursorUuid(sessionId) {
|
|
5717
5717
|
return NATIVE_CURSOR_UUID.test(sessionId);
|
|
5718
5718
|
}
|
|
@@ -5752,16 +5752,16 @@ function groupSessionIdSpellings(sessionIds) {
|
|
|
5752
5752
|
}
|
|
5753
5753
|
var NATIVE_CURSOR_UUID;
|
|
5754
5754
|
var init_session_id = __esm({
|
|
5755
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5755
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/session-id.js"() {
|
|
5756
5756
|
"use strict";
|
|
5757
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;
|
|
5758
5758
|
}
|
|
5759
5759
|
});
|
|
5760
5760
|
|
|
5761
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5762
|
-
import { createHash as
|
|
5761
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup.js
|
|
5762
|
+
import { createHash as createHash4, randomUUID } from "node:crypto";
|
|
5763
5763
|
import { chmodSync as chmodSync2, closeSync as closeSync3, constants as constants3, existsSync as existsSync2, copyFileSync, fchmodSync as fchmodSync3, fstatSync as fstatSync3, fsyncSync as fsyncSync2, lstatSync as lstatSync5, mkdirSync, openSync as openSync3, readFileSync as readFileSync3, readSync, readdirSync as readdirSync3, realpathSync as realpathSync2, statSync as statSync2, unlinkSync as unlinkSync4, writeSync } from "node:fs";
|
|
5764
|
-
import { homedir as
|
|
5764
|
+
import { homedir as homedir3 } from "node:os";
|
|
5765
5765
|
import { basename as basename3, dirname as dirname2, isAbsolute as isAbsolute2, join as join3, relative as relative2, resolve as resolve2, sep as sep2 } from "node:path";
|
|
5766
5766
|
function backupDatabaseReadRequest(sqliteDriver, io, dbPath, logicalSessionId) {
|
|
5767
5767
|
const global = dbPath === "globalStorage/state.vscdb";
|
|
@@ -5801,10 +5801,10 @@ function freezeSourceReadOptions(options = {}) {
|
|
|
5801
5801
|
});
|
|
5802
5802
|
}
|
|
5803
5803
|
function getDefaultBackupDir() {
|
|
5804
|
-
return join3(
|
|
5804
|
+
return join3(homedir3(), "cursor-history-backups");
|
|
5805
5805
|
}
|
|
5806
5806
|
function computeChecksum(buffer) {
|
|
5807
|
-
return `sha256:${
|
|
5807
|
+
return `sha256:${createHash4("sha256").update(buffer).digest("hex")}`;
|
|
5808
5808
|
}
|
|
5809
5809
|
function generateBackupFilename() {
|
|
5810
5810
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -6075,12 +6075,12 @@ function checkDiskSpace(outputPath, requiredBytes) {
|
|
|
6075
6075
|
};
|
|
6076
6076
|
}
|
|
6077
6077
|
}
|
|
6078
|
-
function syncParentDirectory(
|
|
6078
|
+
function syncParentDirectory(path3) {
|
|
6079
6079
|
if (process.platform === "win32")
|
|
6080
6080
|
return;
|
|
6081
6081
|
let descriptor;
|
|
6082
6082
|
try {
|
|
6083
|
-
descriptor = openSync3(dirname2(
|
|
6083
|
+
descriptor = openSync3(dirname2(path3), constants3.O_RDONLY);
|
|
6084
6084
|
fsyncSync2(descriptor);
|
|
6085
6085
|
} catch {
|
|
6086
6086
|
} finally {
|
|
@@ -6092,13 +6092,13 @@ function syncParentDirectory(path2) {
|
|
|
6092
6092
|
}
|
|
6093
6093
|
}
|
|
6094
6094
|
}
|
|
6095
|
-
function removePrivateArchiveStage(
|
|
6095
|
+
function removePrivateArchiveStage(path3, operationError) {
|
|
6096
6096
|
try {
|
|
6097
|
-
unlinkSync4(
|
|
6097
|
+
unlinkSync4(path3);
|
|
6098
6098
|
} catch (error) {
|
|
6099
6099
|
if (errorCode3(error) === "ENOENT")
|
|
6100
6100
|
return;
|
|
6101
|
-
const cleanupError2 = new TemporaryArtifactCleanupError([
|
|
6101
|
+
const cleanupError2 = new TemporaryArtifactCleanupError([path3]);
|
|
6102
6102
|
attachCleanupCause(cleanupError2, operationError ?? error);
|
|
6103
6103
|
throw cleanupError2;
|
|
6104
6104
|
}
|
|
@@ -6362,7 +6362,7 @@ function combineTemporaryCleanupErrors(first, second) {
|
|
|
6362
6362
|
const unverifiedResidueSet = new Set(unverifiedResiduePaths);
|
|
6363
6363
|
const residuePaths = [
|
|
6364
6364
|
.../* @__PURE__ */ new Set([...first.details.residuePaths, ...second.details.residuePaths])
|
|
6365
|
-
].filter((
|
|
6365
|
+
].filter((path3) => !unverifiedResidueSet.has(path3));
|
|
6366
6366
|
const combined = new TemporaryArtifactCleanupError(residuePaths, unverifiedResiduePaths);
|
|
6367
6367
|
Object.defineProperty(combined, "cause", { configurable: true, value: first });
|
|
6368
6368
|
return combined;
|
|
@@ -6470,18 +6470,18 @@ function validatedManifestFiles(manifest) {
|
|
|
6470
6470
|
if (type !== "global-db" && type !== "workspace-db" && type !== "workspace-json" && type !== "manifest") {
|
|
6471
6471
|
throw new ZipArchiveFormatError(`Backup manifest file ${index + 1} has an invalid type.`);
|
|
6472
6472
|
}
|
|
6473
|
-
const
|
|
6474
|
-
const expectedType = backupEntryTypeForCanonicalPath(
|
|
6473
|
+
const path3 = entry["path"];
|
|
6474
|
+
const expectedType = backupEntryTypeForCanonicalPath(path3);
|
|
6475
6475
|
if (expectedType === void 0 || type !== expectedType) {
|
|
6476
6476
|
throw new ZipArchiveFormatError(`Backup manifest file ${index + 1} has an unsupported path/type combination.`);
|
|
6477
6477
|
}
|
|
6478
|
-
const destinationKey =
|
|
6478
|
+
const destinationKey = path3.normalize("NFC").toLowerCase();
|
|
6479
6479
|
if (destinationKeys.has(destinationKey)) {
|
|
6480
|
-
throw new ZipArchiveFormatError(`Backup manifest contains a duplicate restore destination: ${
|
|
6480
|
+
throw new ZipArchiveFormatError(`Backup manifest contains a duplicate restore destination: ${path3}`);
|
|
6481
6481
|
}
|
|
6482
6482
|
destinationKeys.add(destinationKey);
|
|
6483
6483
|
return {
|
|
6484
|
-
path:
|
|
6484
|
+
path: path3,
|
|
6485
6485
|
size: Number(entry["size"]),
|
|
6486
6486
|
checksum: entry["checksum"].toLowerCase(),
|
|
6487
6487
|
type
|
|
@@ -6498,10 +6498,10 @@ function isCanonicalBackupPathSegment(value) {
|
|
|
6498
6498
|
}
|
|
6499
6499
|
return true;
|
|
6500
6500
|
}
|
|
6501
|
-
function backupEntryTypeForCanonicalPath(
|
|
6502
|
-
if (
|
|
6501
|
+
function backupEntryTypeForCanonicalPath(path3) {
|
|
6502
|
+
if (path3 === "globalStorage/state.vscdb")
|
|
6503
6503
|
return "global-db";
|
|
6504
|
-
const match = /^workspaceStorage\/([^/]+)\/(state\.vscdb|workspace\.json)$/u.exec(
|
|
6504
|
+
const match = /^workspaceStorage\/([^/]+)\/(state\.vscdb|workspace\.json)$/u.exec(path3);
|
|
6505
6505
|
if (!match || !isCanonicalBackupPathSegment(match[1]))
|
|
6506
6506
|
return void 0;
|
|
6507
6507
|
return match[2] === "state.vscdb" ? "workspace-db" : "workspace-json";
|
|
@@ -6520,8 +6520,8 @@ function validateComposerWorkspaceInventory(manifest, files) {
|
|
|
6520
6520
|
if (!Array.isArray(inventory["workspaces"])) {
|
|
6521
6521
|
throw new ZipArchiveFormatError("Backup manifest Composer workspace inventory workspaces must be an array.");
|
|
6522
6522
|
}
|
|
6523
|
-
const expectedWorkspaceIds = files.filter(({ type }) => type === "workspace-db").map(({ path:
|
|
6524
|
-
const containsGlobalDatabase = files.some(({ type, path:
|
|
6523
|
+
const expectedWorkspaceIds = files.filter(({ type }) => type === "workspace-db").map(({ path: path3 }) => /^workspaceStorage\/([^/]+)\/state\.vscdb$/u.exec(path3)?.[1]).filter((workspaceId) => workspaceId !== void 0).sort(compareCodePoints4);
|
|
6524
|
+
const containsGlobalDatabase = files.some(({ type, path: path3 }) => type === "global-db" && path3 === "globalStorage/state.vscdb");
|
|
6525
6525
|
if (inventory["workspaces"].length !== expectedWorkspaceIds.length) {
|
|
6526
6526
|
throw new ZipArchiveFormatError("Backup manifest Composer workspace inventory does not cover every workspace database.");
|
|
6527
6527
|
}
|
|
@@ -6677,7 +6677,7 @@ async function openBackupDatabase(backupPath, dbPath, options = {}) {
|
|
|
6677
6677
|
if (!entry || entry.isDirectory) {
|
|
6678
6678
|
throw new BackupEntryNotFoundError(dbPath);
|
|
6679
6679
|
}
|
|
6680
|
-
const manifestEntry = manifestFiles.find(({ path:
|
|
6680
|
+
const manifestEntry = manifestFiles.find(({ path: path3 }) => path3 === dbPath);
|
|
6681
6681
|
if (!manifestEntry) {
|
|
6682
6682
|
throw new ZipArchiveFormatError(`Backup database is not declared by the manifest: ${dbPath}`);
|
|
6683
6683
|
}
|
|
@@ -6732,7 +6732,7 @@ async function readBackupEntryBuffer(backupPath, entryPath, options = {}, maxByt
|
|
|
6732
6732
|
const manifest = await readManifestFromArchive(archive);
|
|
6733
6733
|
if (!manifest)
|
|
6734
6734
|
throw new ZipArchiveFormatError("Manifest file not found in backup.");
|
|
6735
|
-
const manifestEntry = validatedManifestFiles(manifest).find(({ path:
|
|
6735
|
+
const manifestEntry = validatedManifestFiles(manifest).find(({ path: path3 }) => path3 === entryPath);
|
|
6736
6736
|
const entry = archive.getEntry(entryPath);
|
|
6737
6737
|
if (!entry || entry.isDirectory) {
|
|
6738
6738
|
if (manifestEntry) {
|
|
@@ -6788,18 +6788,18 @@ async function validateBackup(backupPath, options = {}) {
|
|
|
6788
6788
|
};
|
|
6789
6789
|
}
|
|
6790
6790
|
}
|
|
6791
|
-
function lstatIfPresent(
|
|
6791
|
+
function lstatIfPresent(path3) {
|
|
6792
6792
|
try {
|
|
6793
|
-
return lstatSync5(
|
|
6793
|
+
return lstatSync5(path3);
|
|
6794
6794
|
} catch (error) {
|
|
6795
6795
|
if (errorCode3(error) === "ENOENT")
|
|
6796
6796
|
return void 0;
|
|
6797
6797
|
throw error;
|
|
6798
6798
|
}
|
|
6799
6799
|
}
|
|
6800
|
-
function assertNoLinkedRestorePath(trustedRoot,
|
|
6800
|
+
function assertNoLinkedRestorePath(trustedRoot, path3, leafKind) {
|
|
6801
6801
|
const absoluteRoot = resolve2(trustedRoot);
|
|
6802
|
-
const absolutePath = resolve2(
|
|
6802
|
+
const absolutePath = resolve2(path3);
|
|
6803
6803
|
const suffix = relative2(absoluteRoot, absolutePath);
|
|
6804
6804
|
if (suffix === ".." || suffix.startsWith(`..${sep2}`) || isAbsolute2(suffix)) {
|
|
6805
6805
|
throw new Error(`Restore destination escapes the Cursor data directory: ${absolutePath}`);
|
|
@@ -7132,7 +7132,7 @@ async function listBackups(directory, options = {}) {
|
|
|
7132
7132
|
return backups;
|
|
7133
7133
|
}
|
|
7134
7134
|
function getDefaultCursorDataPath2() {
|
|
7135
|
-
const home =
|
|
7135
|
+
const home = homedir3();
|
|
7136
7136
|
switch (process.platform) {
|
|
7137
7137
|
case "win32":
|
|
7138
7138
|
return join3(process.env["APPDATA"] ?? join3(home, "AppData", "Roaming"), "Cursor", "User", "workspaceStorage");
|
|
@@ -7144,7 +7144,7 @@ function getDefaultCursorDataPath2() {
|
|
|
7144
7144
|
}
|
|
7145
7145
|
var MANIFEST_VERSION, UTF8_BOM2, BACKUP_METADATA_MEMORY_LIMIT, BACKUP_DATABASE_READ_CAPABILITIES, BACKUP_CHAT_DATA_KEYS, BackupEntryNotFoundError, COMPOSER_GUID_RE, TempFileCleanupWrapper;
|
|
7146
7146
|
var init_backup = __esm({
|
|
7147
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7147
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup.js"() {
|
|
7148
7148
|
"use strict";
|
|
7149
7149
|
init_registry();
|
|
7150
7150
|
init_database();
|
|
@@ -7215,7 +7215,7 @@ var init_backup = __esm({
|
|
|
7215
7215
|
}
|
|
7216
7216
|
});
|
|
7217
7217
|
|
|
7218
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7218
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/session-catalog.js
|
|
7219
7219
|
function compareCodePoints5(left, right) {
|
|
7220
7220
|
const leftPoints = Array.from(left, (value) => value.codePointAt(0));
|
|
7221
7221
|
const rightPoints = Array.from(right, (value) => value.codePointAt(0));
|
|
@@ -7585,7 +7585,7 @@ function sessionAmbiguityErrorFromReplicaGroup(divergence) {
|
|
|
7585
7585
|
}
|
|
7586
7586
|
var SOURCE_ROLE_ORDER, REPRESENTATION_ORDER, FIDELITY_ORDER, CANONICAL_PATH_KIND_ORDER, INSTANCE_STATE_ORDER;
|
|
7587
7587
|
var init_session_catalog = __esm({
|
|
7588
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7588
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/session-catalog.js"() {
|
|
7589
7589
|
"use strict";
|
|
7590
7590
|
init_errors();
|
|
7591
7591
|
init_session_identity();
|
|
@@ -7615,7 +7615,7 @@ var init_session_catalog = __esm({
|
|
|
7615
7615
|
}
|
|
7616
7616
|
});
|
|
7617
7617
|
|
|
7618
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7618
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/paths.js
|
|
7619
7619
|
import { join as join4 } from "node:path";
|
|
7620
7620
|
function storeProjectDirectoryName(cwd) {
|
|
7621
7621
|
const normalized = cwd.replace(/\\/gu, "/");
|
|
@@ -7633,12 +7633,12 @@ function acpSessionsDir(storeRoot2) {
|
|
|
7633
7633
|
return join4(storeRoot2, "acp-sessions");
|
|
7634
7634
|
}
|
|
7635
7635
|
var init_paths = __esm({
|
|
7636
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7636
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/paths.js"() {
|
|
7637
7637
|
"use strict";
|
|
7638
7638
|
}
|
|
7639
7639
|
});
|
|
7640
7640
|
|
|
7641
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7641
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/content-evidence.js
|
|
7642
7642
|
function deepFreeze(value) {
|
|
7643
7643
|
if (!value || typeof value !== "object" || Object.isFrozen(value))
|
|
7644
7644
|
return value;
|
|
@@ -7707,7 +7707,7 @@ ${encoded}
|
|
|
7707
7707
|
}
|
|
7708
7708
|
var INLINE_ATTACHMENT_TYPES, INLINE_PAYLOAD_FIELDS, PROJECTED_ATTACHMENT_FENCE;
|
|
7709
7709
|
var init_content_evidence = __esm({
|
|
7710
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7710
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/content-evidence.js"() {
|
|
7711
7711
|
"use strict";
|
|
7712
7712
|
init_session_identity();
|
|
7713
7713
|
INLINE_ATTACHMENT_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -7724,7 +7724,7 @@ var init_content_evidence = __esm({
|
|
|
7724
7724
|
}
|
|
7725
7725
|
});
|
|
7726
7726
|
|
|
7727
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7727
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/store-db.js
|
|
7728
7728
|
import { chmodSync as chmodSync3, statSync as statSync3 } from "node:fs";
|
|
7729
7729
|
function databaseRequest(operation, required, forcedDriver, options, resourceClass = "store-database") {
|
|
7730
7730
|
return {
|
|
@@ -7761,11 +7761,11 @@ function attachErrorCause(error, cause) {
|
|
|
7761
7761
|
});
|
|
7762
7762
|
}
|
|
7763
7763
|
}
|
|
7764
|
-
async function parseStoreDb(
|
|
7764
|
+
async function parseStoreDb(path3, options = {}) {
|
|
7765
7765
|
const limits = options.limits ?? SOURCE_READ_LIMITS_V1_DEFAULTS;
|
|
7766
7766
|
const failureOutcome = options.failureOutcome ?? "fatal";
|
|
7767
7767
|
throwIfAborted4(options.signal);
|
|
7768
|
-
if (!pathExists(
|
|
7768
|
+
if (!pathExists(path3, options.signal, options.io, options.logicalSessionId))
|
|
7769
7769
|
return null;
|
|
7770
7770
|
const budget = new SqliteSourceReadBudget(limits, failureOutcome);
|
|
7771
7771
|
let workspace = null;
|
|
@@ -7777,7 +7777,7 @@ async function parseStoreDb(path2, options = {}) {
|
|
|
7777
7777
|
workspace = createPrivateTempWorkspace({ prefix: "ch-store-", signal: options.signal });
|
|
7778
7778
|
const tmpPath = workspace.createFile("store.db");
|
|
7779
7779
|
throwIfAborted4(options.signal);
|
|
7780
|
-
await backupDatabase(
|
|
7780
|
+
await backupDatabase(path3, tmpPath, databaseRequest("store-snapshot", STORE_SNAPSHOT_CAPABILITIES, options.sqliteDriver, options, "store-database"));
|
|
7781
7781
|
snapshotComplete = true;
|
|
7782
7782
|
throwIfAborted4(options.signal);
|
|
7783
7783
|
if (process.platform !== "win32")
|
|
@@ -7824,12 +7824,12 @@ async function parseStoreDb(path2, options = {}) {
|
|
|
7824
7824
|
operationError = error;
|
|
7825
7825
|
else {
|
|
7826
7826
|
options.onDiagnostic?.(error);
|
|
7827
|
-
debugLogStorage(`store.db defensive parse failed for ${
|
|
7827
|
+
debugLogStorage(`store.db defensive parse failed for ${path3}: ${error.code}`);
|
|
7828
7828
|
}
|
|
7829
7829
|
} else if (isSessionIntegrityError(error)) {
|
|
7830
7830
|
operationError = error;
|
|
7831
7831
|
} else if (error instanceof StoreSourceCorruptError || isSqliteSourceCorruptionError(error)) {
|
|
7832
|
-
debugLogStorage(`store.db source/schema parse failed for ${
|
|
7832
|
+
debugLogStorage(`store.db source/schema parse failed for ${path3}: ${String(error)}`);
|
|
7833
7833
|
} else {
|
|
7834
7834
|
operationError = error;
|
|
7835
7835
|
}
|
|
@@ -7854,7 +7854,7 @@ async function parseStoreDb(path2, options = {}) {
|
|
|
7854
7854
|
throw operationError;
|
|
7855
7855
|
return result;
|
|
7856
7856
|
}
|
|
7857
|
-
function pathExists(
|
|
7857
|
+
function pathExists(path3, signal, io, logicalSessionId) {
|
|
7858
7858
|
throwIfAborted4(signal);
|
|
7859
7859
|
try {
|
|
7860
7860
|
if (io) {
|
|
@@ -7867,7 +7867,7 @@ function pathExists(path2, signal, io, logicalSessionId) {
|
|
|
7867
7867
|
...logicalSessionId ? { logicalSessionId } : {}
|
|
7868
7868
|
});
|
|
7869
7869
|
}
|
|
7870
|
-
statSync3(
|
|
7870
|
+
statSync3(path3);
|
|
7871
7871
|
return true;
|
|
7872
7872
|
} catch (error) {
|
|
7873
7873
|
const code = error?.code;
|
|
@@ -8369,7 +8369,7 @@ function validDateFromMs(value) {
|
|
|
8369
8369
|
}
|
|
8370
8370
|
var STORE_SNAPSHOT_CAPABILITIES, STORE_READ_CAPABILITIES, StoreSourceCorruptError, BoundedBlobReader;
|
|
8371
8371
|
var init_store_db = __esm({
|
|
8372
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
8372
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/store-db.js"() {
|
|
8373
8373
|
"use strict";
|
|
8374
8374
|
init_database();
|
|
8375
8375
|
init_debug();
|
|
@@ -8441,7 +8441,7 @@ var init_store_db = __esm({
|
|
|
8441
8441
|
}
|
|
8442
8442
|
});
|
|
8443
8443
|
|
|
8444
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
8444
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/transcript.js
|
|
8445
8445
|
import { closeSync as closeSync4, openSync as openSync4, readSync as readSync2 } from "node:fs";
|
|
8446
8446
|
function parseTranscriptFile(filePath, limits = SOURCE_READ_LIMITS_V1_DEFAULTS, failureOutcome = "fatal", signal, io, logicalSessionId) {
|
|
8447
8447
|
throwIfAborted5(signal);
|
|
@@ -8799,7 +8799,7 @@ function extractContent(parts) {
|
|
|
8799
8799
|
}
|
|
8800
8800
|
var READ_CHUNK_BYTES;
|
|
8801
8801
|
var init_transcript = __esm({
|
|
8802
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
8802
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/transcript.js"() {
|
|
8803
8803
|
"use strict";
|
|
8804
8804
|
init_errors();
|
|
8805
8805
|
init_io_observer();
|
|
@@ -8809,7 +8809,7 @@ var init_transcript = __esm({
|
|
|
8809
8809
|
}
|
|
8810
8810
|
});
|
|
8811
8811
|
|
|
8812
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
8812
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/discover.js
|
|
8813
8813
|
import { readdirSync as readdirSync4, readFileSync as readFileSync4, statSync as statSync4 } from "node:fs";
|
|
8814
8814
|
import { join as join5 } from "node:path";
|
|
8815
8815
|
function compareCodePoints6(left, right) {
|
|
@@ -8835,15 +8835,15 @@ function compareStringArrays2(left, right) {
|
|
|
8835
8835
|
function getStorePhysicalOccurrences(session) {
|
|
8836
8836
|
return physicalOccurrences.get(session) ?? [];
|
|
8837
8837
|
}
|
|
8838
|
-
function occurrenceKey(representation,
|
|
8839
|
-
return `${representation}\0${
|
|
8838
|
+
function occurrenceKey(representation, path3) {
|
|
8839
|
+
return `${representation}\0${path3}`;
|
|
8840
8840
|
}
|
|
8841
|
-
function occurrence(logicalSessionId, representation,
|
|
8841
|
+
function occurrence(logicalSessionId, representation, path3, workspacePath) {
|
|
8842
8842
|
return {
|
|
8843
|
-
instanceKey: occurrenceKey(representation,
|
|
8843
|
+
instanceKey: occurrenceKey(representation, path3),
|
|
8844
8844
|
logicalSessionId,
|
|
8845
8845
|
representation,
|
|
8846
|
-
path:
|
|
8846
|
+
path: path3,
|
|
8847
8847
|
...workspacePath ? { workspacePath: normalizeWorkspacePath(workspacePath) } : {},
|
|
8848
8848
|
sourceOrder: 0
|
|
8849
8849
|
};
|
|
@@ -9191,7 +9191,7 @@ async function discoverStoreSessions(storeRoot2, options = {}) {
|
|
|
9191
9191
|
const evidence = evidenceFor(uuid);
|
|
9192
9192
|
evidence.transcriptInventoried = true;
|
|
9193
9193
|
const transcriptOccurrence = occurrence(uuid, "store-transcript", nested, transcriptWorkspacePath(sanitized, metadataCandidates.get(logicalSessionIdKey(uuid)) ?? []));
|
|
9194
|
-
if (!evidence.transcriptOccurrences.some(({ path:
|
|
9194
|
+
if (!evidence.transcriptOccurrences.some(({ path: path3 }) => path3 === nested)) {
|
|
9195
9195
|
evidence.transcriptOccurrences.push(transcriptOccurrence);
|
|
9196
9196
|
}
|
|
9197
9197
|
if (options.metadataOnly) {
|
|
@@ -9208,7 +9208,7 @@ async function discoverStoreSessions(storeRoot2, options = {}) {
|
|
|
9208
9208
|
evidence.transcriptInventoried = true;
|
|
9209
9209
|
const transcriptPath = join5(transcriptDir, entry.name);
|
|
9210
9210
|
const transcriptOccurrence = occurrence(uuid, "store-transcript", transcriptPath, transcriptWorkspacePath(sanitized, metadataCandidates.get(logicalSessionIdKey(uuid)) ?? []));
|
|
9211
|
-
if (!evidence.transcriptOccurrences.some(({ path:
|
|
9211
|
+
if (!evidence.transcriptOccurrences.some(({ path: path3 }) => path3 === transcriptPath)) {
|
|
9212
9212
|
evidence.transcriptOccurrences.push(transcriptOccurrence);
|
|
9213
9213
|
}
|
|
9214
9214
|
if (options.metadataOnly) {
|
|
@@ -9282,7 +9282,7 @@ async function discoverStoreSessions(storeRoot2, options = {}) {
|
|
|
9282
9282
|
const usableDbCandidates = dbCandidates.filter((candidate) => Boolean(candidate.parsed && candidate.parsed.messages.length > 0));
|
|
9283
9283
|
const selectedDbFidelity = usableDbCandidates.some(({ parsed }) => parsed.completeness === "complete") ? "complete" : "partial";
|
|
9284
9284
|
const selectedDbTier = usableDbCandidates.filter(({ parsed }) => parsed.completeness === selectedDbFidelity);
|
|
9285
|
-
let selectedDbCandidate = selectedDbTier[0] ?? dbCandidates.find(({ path:
|
|
9285
|
+
let selectedDbCandidate = selectedDbTier[0] ?? dbCandidates.find(({ path: path3 }) => path3 === ss.storeDbPath) ?? dbCandidates[0];
|
|
9286
9286
|
let dbReplicaInstances = [];
|
|
9287
9287
|
if (selectedDbTier.length > 1) {
|
|
9288
9288
|
const physical = physicalStoreCandidates(ss.id, "store-db", selectedDbFidelity, selectedDbTier.map((candidate) => ({
|
|
@@ -9496,12 +9496,12 @@ function recordInventory(evidence, logicalSessionId, metaRead, sessionDir, dbPat
|
|
|
9496
9496
|
if (metaRead.diagnostic)
|
|
9497
9497
|
evidence.metadataFailures.push(metaRead.diagnostic);
|
|
9498
9498
|
const metadataOccurrence = occurrence(logicalSessionId, "store-metadata", sessionDir, metaRead.meta?.cwd);
|
|
9499
|
-
if (!evidence.metadataOccurrences.some(({ path:
|
|
9499
|
+
if (!evidence.metadataOccurrences.some(({ path: path3 }) => path3 === sessionDir)) {
|
|
9500
9500
|
evidence.metadataOccurrences.push(metadataOccurrence);
|
|
9501
9501
|
}
|
|
9502
9502
|
if (dbInventoried) {
|
|
9503
9503
|
evidence.dbInventoried = true;
|
|
9504
|
-
if (!evidence.dbOccurrences.some(({ path:
|
|
9504
|
+
if (!evidence.dbOccurrences.some(({ path: path3 }) => path3 === dbPath)) {
|
|
9505
9505
|
evidence.dbOccurrences.push(occurrence(logicalSessionId, "store-db", dbPath, metaRead.meta?.cwd));
|
|
9506
9506
|
}
|
|
9507
9507
|
}
|
|
@@ -9747,12 +9747,12 @@ function listEntries(dir, signal, io) {
|
|
|
9747
9747
|
throw error;
|
|
9748
9748
|
}
|
|
9749
9749
|
}
|
|
9750
|
-
function readMeta(
|
|
9750
|
+
function readMeta(path3, signal, io, logicalSessionId, includeDisplayMetadata = true) {
|
|
9751
9751
|
throwIfAborted6(signal);
|
|
9752
9752
|
let raw;
|
|
9753
9753
|
try {
|
|
9754
9754
|
observeStoreFs(io, "read", "store-session-metadata", logicalSessionId, "store-db");
|
|
9755
|
-
raw = readFileSync4(
|
|
9755
|
+
raw = readFileSync4(path3);
|
|
9756
9756
|
} catch (error) {
|
|
9757
9757
|
if (isAbsentOrWrongType(error)) {
|
|
9758
9758
|
return { present: false, unsupportedExpectationMetadata: false };
|
|
@@ -9883,11 +9883,11 @@ function decodeJsonObjectKey(raw, start, end) {
|
|
|
9883
9883
|
function isJsonWhitespace(byte) {
|
|
9884
9884
|
return byte === 32 || byte === 9 || byte === 10 || byte === 13;
|
|
9885
9885
|
}
|
|
9886
|
-
function pathExists2(
|
|
9886
|
+
function pathExists2(path3, signal, io, resourceClass = "store-root-directory", logicalSessionId) {
|
|
9887
9887
|
throwIfAborted6(signal);
|
|
9888
9888
|
try {
|
|
9889
9889
|
observeStoreFs(io, "open", resourceClass, logicalSessionId);
|
|
9890
|
-
statSync4(
|
|
9890
|
+
statSync4(path3);
|
|
9891
9891
|
return true;
|
|
9892
9892
|
} catch (error) {
|
|
9893
9893
|
if (isAbsentOrWrongType(error))
|
|
@@ -9977,7 +9977,7 @@ function resolveStoreSessionTimestamps(session) {
|
|
|
9977
9977
|
}
|
|
9978
9978
|
var physicalOccurrences, TRANSCRIPT_STATE_RANK, RESOLUTION_REASON_ORDER;
|
|
9979
9979
|
var init_discover = __esm({
|
|
9980
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
9980
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/discover.js"() {
|
|
9981
9981
|
"use strict";
|
|
9982
9982
|
init_errors();
|
|
9983
9983
|
init_debug();
|
|
@@ -10013,7 +10013,7 @@ var init_discover = __esm({
|
|
|
10013
10013
|
}
|
|
10014
10014
|
});
|
|
10015
10015
|
|
|
10016
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
10016
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/merge.js
|
|
10017
10017
|
function normalizeText(text) {
|
|
10018
10018
|
return text.replace(/\s+/g, " ").trim();
|
|
10019
10019
|
}
|
|
@@ -10918,7 +10918,7 @@ function applyStoreMergeToSummary(existing, store, preferredSource) {
|
|
|
10918
10918
|
}
|
|
10919
10919
|
var EMPTY_PLACEHOLDER, CORRUPTED_PLACEHOLDER, SOURCE_ROLE_ORDER2, SOURCE_REPRESENTATION_ORDER, SOURCE_INSTANCE_STATE_ORDER, STORE_MESSAGE_ID_PATTERN, RESOLUTION_REASON_ORDER2;
|
|
10920
10920
|
var init_merge = __esm({
|
|
10921
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
10921
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/merge.js"() {
|
|
10922
10922
|
"use strict";
|
|
10923
10923
|
init_parser();
|
|
10924
10924
|
init_timestamps();
|
|
@@ -10954,8 +10954,8 @@ var init_merge = __esm({
|
|
|
10954
10954
|
}
|
|
10955
10955
|
});
|
|
10956
10956
|
|
|
10957
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
10958
|
-
import { createHash as
|
|
10957
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/storage.js
|
|
10958
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
10959
10959
|
import { existsSync as existsSync3, readdirSync as readdirSync5, readFileSync as readFileSync5 } from "node:fs";
|
|
10960
10960
|
import { join as join6 } from "node:path";
|
|
10961
10961
|
function sessionReadRequest(sqliteDriver, io, ioResource = {
|
|
@@ -11320,23 +11320,23 @@ function extractToolCalls(data) {
|
|
|
11320
11320
|
const params = parseToolParams2(toolData.params, toolData.rawArgs);
|
|
11321
11321
|
const status = getToolCallStatus(toolData);
|
|
11322
11322
|
const resultText = typeof toolData.result === "string" && toolData.result.trim().length > 0 ? toolData.result : void 0;
|
|
11323
|
-
const
|
|
11323
|
+
const toolCall2 = {
|
|
11324
11324
|
name,
|
|
11325
11325
|
status
|
|
11326
11326
|
};
|
|
11327
11327
|
if (params) {
|
|
11328
|
-
|
|
11328
|
+
toolCall2.params = params;
|
|
11329
11329
|
}
|
|
11330
11330
|
const files = extractToolFiles(params);
|
|
11331
11331
|
if (files) {
|
|
11332
|
-
|
|
11332
|
+
toolCall2.files = files;
|
|
11333
11333
|
}
|
|
11334
11334
|
if (status === "error" && resultText) {
|
|
11335
|
-
|
|
11335
|
+
toolCall2.error = extractToolError(resultText);
|
|
11336
11336
|
} else if (status === "completed" && resultText) {
|
|
11337
|
-
|
|
11337
|
+
toolCall2.result = resultText;
|
|
11338
11338
|
}
|
|
11339
|
-
return [
|
|
11339
|
+
return [toolCall2];
|
|
11340
11340
|
}
|
|
11341
11341
|
function mapBubbleToMessage(row) {
|
|
11342
11342
|
const corruptedMessage = () => ({
|
|
@@ -11515,7 +11515,7 @@ async function resolveBackupWorkspaceInventory(manifest, backupPath, readOptions
|
|
|
11515
11515
|
throw new ZipArchiveFormatError("No intact restorable files found in backup.");
|
|
11516
11516
|
}
|
|
11517
11517
|
const databases = backupWorkspaceDatabaseEntries(manifest);
|
|
11518
|
-
const containsGlobalDatabase = manifest.files.some(({ type, path:
|
|
11518
|
+
const containsGlobalDatabase = manifest.files.some(({ type, path: path3 }) => type === "global-db" && path3 === "globalStorage/state.vscdb");
|
|
11519
11519
|
const inventory = manifest.composerWorkspaceInventory;
|
|
11520
11520
|
if (inventory) {
|
|
11521
11521
|
const dbPathByWorkspaceId = new Map(databases.map(({ workspaceId, dbPath }) => [workspaceId, dbPath]));
|
|
@@ -12385,7 +12385,7 @@ function reportSessionAmbiguity(context, sessionId, occurrenceRefs) {
|
|
|
12385
12385
|
}
|
|
12386
12386
|
function storageDataSourceIdentity(customDataPath, backupPath) {
|
|
12387
12387
|
const source = backupPath ? `backup\0${backupPath}` : customDataPath ? `live\0${customDataPath}` : "live\0default";
|
|
12388
|
-
return `source:${
|
|
12388
|
+
return `source:${createHash5("sha256").update(source).digest("hex")}`;
|
|
12389
12389
|
}
|
|
12390
12390
|
function countDiscoveryDecodedSessions(context) {
|
|
12391
12391
|
return context.storeSessions?.filter((session) => session.messages.length > 0).length ?? 0;
|
|
@@ -12713,8 +12713,8 @@ function loadExactGlobalComposerSession(db, exactId, workspacePath, budget = cre
|
|
|
12713
12713
|
function composerWorkspaceMemberships(candidates) {
|
|
12714
12714
|
const counts = /* @__PURE__ */ new Map();
|
|
12715
12715
|
for (const candidate of candidates) {
|
|
12716
|
-
const
|
|
12717
|
-
counts.set(
|
|
12716
|
+
const path3 = normalizeWorkspacePath(candidate.workspace.path);
|
|
12717
|
+
counts.set(path3, (counts.get(path3) ?? 0) + 1);
|
|
12718
12718
|
}
|
|
12719
12719
|
return [...counts.entries()].sort(([left], [right]) => compareCodePoints8(left, right)).map(([workspacePath, contributingInstanceCount]) => ({
|
|
12720
12720
|
workspacePath,
|
|
@@ -13406,7 +13406,7 @@ async function listSessions(options, customDataPath, backupPath, context) {
|
|
|
13406
13406
|
composerWorkspaceInventory = await findComposerWorkspaceInventory(customDataPath, backupPath, context);
|
|
13407
13407
|
const storeWorkspacePaths = storeCatalogSessions.flatMap(verifiedStoreWorkspacePaths);
|
|
13408
13408
|
workspaceScopeResult = resolveWorkspaceScope(options.workspacePath, [
|
|
13409
|
-
...composerWorkspaceInventory.map(({ path:
|
|
13409
|
+
...composerWorkspaceInventory.map(({ path: path3 }) => path3),
|
|
13410
13410
|
...storeWorkspacePaths
|
|
13411
13411
|
]);
|
|
13412
13412
|
if (workspaceScopeResult.kind === "not-found") {
|
|
@@ -13672,7 +13672,7 @@ async function listSessions(options, customDataPath, backupPath, context) {
|
|
|
13672
13672
|
}
|
|
13673
13673
|
}
|
|
13674
13674
|
if (activeWorkspacePath) {
|
|
13675
|
-
const offScopeWorkspaces = composerWorkspaceInventory.filter(({ path:
|
|
13675
|
+
const offScopeWorkspaces = composerWorkspaceInventory.filter(({ path: path3 }) => !workspaceFilterMatches(path3, activeWorkspacePath));
|
|
13676
13676
|
for (const workspace of offScopeWorkspaces) {
|
|
13677
13677
|
if (backupPath) {
|
|
13678
13678
|
for (const id of getBackupComposerSessionIds(workspace) ?? []) {
|
|
@@ -14320,9 +14320,9 @@ async function listSessions(options, customDataPath, backupPath, context) {
|
|
|
14320
14320
|
return 1;
|
|
14321
14321
|
return compareCodePoints8(left.row.id, right.row.id);
|
|
14322
14322
|
});
|
|
14323
|
-
const indexedLogicalRows = logicalRows.map(({ row, timestamp }, index) => ({
|
|
14323
|
+
const indexedLogicalRows = logicalRows.map(({ row, timestamp: timestamp2 }, index) => ({
|
|
14324
14324
|
row: { ...row, index: index + 1 },
|
|
14325
|
-
timestamp
|
|
14325
|
+
timestamp: timestamp2
|
|
14326
14326
|
}));
|
|
14327
14327
|
allSessions.splice(0, allSessions.length, ...indexedLogicalRows.map(({ row }) => row).filter((row) => row.resolutionState !== "ambiguous"));
|
|
14328
14328
|
if (context) {
|
|
@@ -14965,11 +14965,11 @@ function formatToolCall(toolData, codeBlocks) {
|
|
|
14965
14965
|
} else if (toolName === "grep" || toolName === "search" || toolName === "codebase_search") {
|
|
14966
14966
|
lines.push(`[Tool: ${toolName === "grep" ? "Grep" : "Search"}]`);
|
|
14967
14967
|
const pattern = getParam(params, "pattern", "query", "searchQuery", "regex");
|
|
14968
|
-
const
|
|
14968
|
+
const path3 = getParam(params, "path", "directory", "targetDirectory");
|
|
14969
14969
|
if (pattern)
|
|
14970
14970
|
lines.push(`Pattern: ${pattern}`);
|
|
14971
|
-
if (
|
|
14972
|
-
lines.push(`Path: ${
|
|
14971
|
+
if (path3)
|
|
14972
|
+
lines.push(`Path: ${path3}`);
|
|
14973
14973
|
} else if (toolName === "run_terminal_command" || toolName === "run_terminal_cmd" || toolName === "execute_command") {
|
|
14974
14974
|
lines.push(`[Tool: Terminal Command]`);
|
|
14975
14975
|
const cmd = getParam(params, "command", "cmd");
|
|
@@ -15309,15 +15309,15 @@ function extractTimestamp(data) {
|
|
|
15309
15309
|
if (!timingInfo)
|
|
15310
15310
|
return null;
|
|
15311
15311
|
const rpc = timingInfo.clientRpcSendTime;
|
|
15312
|
-
if (typeof rpc === "number" && rpc >
|
|
15312
|
+
if (typeof rpc === "number" && rpc > MIN_VALID_UNIX_MS2) {
|
|
15313
15313
|
return new Date(rpc);
|
|
15314
15314
|
}
|
|
15315
15315
|
const settle = timingInfo.clientSettleTime;
|
|
15316
|
-
if (typeof settle === "number" && settle >
|
|
15316
|
+
if (typeof settle === "number" && settle > MIN_VALID_UNIX_MS2) {
|
|
15317
15317
|
return new Date(settle);
|
|
15318
15318
|
}
|
|
15319
15319
|
const end = timingInfo.clientEndTime;
|
|
15320
|
-
if (typeof end === "number" && end >
|
|
15320
|
+
if (typeof end === "number" && end > MIN_VALID_UNIX_MS2) {
|
|
15321
15321
|
return new Date(end);
|
|
15322
15322
|
}
|
|
15323
15323
|
return null;
|
|
@@ -15329,13 +15329,13 @@ function extractTimestampSource(data) {
|
|
|
15329
15329
|
if (!timingInfo)
|
|
15330
15330
|
return void 0;
|
|
15331
15331
|
const rpc = timingInfo.clientRpcSendTime;
|
|
15332
|
-
if (typeof rpc === "number" && rpc >
|
|
15332
|
+
if (typeof rpc === "number" && rpc > MIN_VALID_UNIX_MS2)
|
|
15333
15333
|
return "composer-timing";
|
|
15334
15334
|
const settle = timingInfo.clientSettleTime;
|
|
15335
|
-
if (typeof settle === "number" && settle >
|
|
15335
|
+
if (typeof settle === "number" && settle > MIN_VALID_UNIX_MS2)
|
|
15336
15336
|
return "composer-timing";
|
|
15337
15337
|
const end = timingInfo.clientEndTime;
|
|
15338
|
-
if (typeof end === "number" && end >
|
|
15338
|
+
if (typeof end === "number" && end > MIN_VALID_UNIX_MS2)
|
|
15339
15339
|
return "composer-timing";
|
|
15340
15340
|
return void 0;
|
|
15341
15341
|
}
|
|
@@ -15408,9 +15408,9 @@ function updateComposerData(db, composers, isNewFormat, originalRawData) {
|
|
|
15408
15408
|
const jsonValue = JSON.stringify(dataToWrite);
|
|
15409
15409
|
db.prepare("UPDATE ItemTable SET value = ? WHERE key = ?").run(jsonValue, "composer.composerData");
|
|
15410
15410
|
}
|
|
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,
|
|
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;
|
|
15412
15412
|
var init_storage = __esm({
|
|
15413
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
15413
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/storage.js"() {
|
|
15414
15414
|
"use strict";
|
|
15415
15415
|
init_database();
|
|
15416
15416
|
init_platform();
|
|
@@ -15462,21 +15462,21 @@ var init_storage = __esm({
|
|
|
15462
15462
|
"store-db-expectation-unknown",
|
|
15463
15463
|
"store-conversation-unavailable"
|
|
15464
15464
|
];
|
|
15465
|
-
|
|
15465
|
+
MIN_VALID_UNIX_MS2 = 1e12;
|
|
15466
15466
|
}
|
|
15467
15467
|
});
|
|
15468
15468
|
|
|
15469
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
15470
|
-
import { createHash as
|
|
15469
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/migrate.js
|
|
15470
|
+
import { createHash as createHash6, randomUUID as randomUUID2 } from "node:crypto";
|
|
15471
15471
|
import { existsSync as existsSync4, readdirSync as readdirSync6, statSync as statSync5 } from "node:fs";
|
|
15472
15472
|
import { join as join7 } from "node:path";
|
|
15473
15473
|
import { pathToFileURL } from "node:url";
|
|
15474
15474
|
function generateSessionId() {
|
|
15475
15475
|
return randomUUID2();
|
|
15476
15476
|
}
|
|
15477
|
-
function transformPath(
|
|
15477
|
+
function transformPath(path3, sourcePrefix, destPrefix) {
|
|
15478
15478
|
const normalizedSource = sourcePrefix.replace(/\/+$/, "");
|
|
15479
|
-
const normalizedPath =
|
|
15479
|
+
const normalizedPath = path3;
|
|
15480
15480
|
if (normalizedPath.startsWith(normalizedSource + "/") || normalizedPath === normalizedSource) {
|
|
15481
15481
|
return destPrefix + normalizedPath.slice(normalizedSource.length);
|
|
15482
15482
|
}
|
|
@@ -15592,8 +15592,8 @@ function isNestedPath(source, destination) {
|
|
|
15592
15592
|
const normalizedDest = normalizePath(destination).replace(/\/+$/, "");
|
|
15593
15593
|
return normalizedDest.startsWith(normalizedSource + "/");
|
|
15594
15594
|
}
|
|
15595
|
-
function toFileUri(
|
|
15596
|
-
const normalized = normalizePath(
|
|
15595
|
+
function toFileUri(path3) {
|
|
15596
|
+
const normalized = normalizePath(path3);
|
|
15597
15597
|
const windowsDrivePath = normalized.match(/^([A-Za-z]):[\\/](.*)$/);
|
|
15598
15598
|
if (windowsDrivePath) {
|
|
15599
15599
|
const drive = windowsDrivePath[1].toLowerCase();
|
|
@@ -15647,12 +15647,12 @@ function createMigrationReadGuard(limits, signal, sqliteDriver) {
|
|
|
15647
15647
|
sqliteDriver
|
|
15648
15648
|
};
|
|
15649
15649
|
}
|
|
15650
|
-
function physicalPathIdentity(label,
|
|
15651
|
-
const normalized = normalizedPathKey(
|
|
15652
|
-
if (!existsSync4(
|
|
15650
|
+
function physicalPathIdentity(label, path3) {
|
|
15651
|
+
const normalized = normalizedPathKey(path3);
|
|
15652
|
+
if (!existsSync4(path3))
|
|
15653
15653
|
return `${label}:${normalized}|missing`;
|
|
15654
15654
|
try {
|
|
15655
|
-
const stat2 = statSync5(
|
|
15655
|
+
const stat2 = statSync5(path3);
|
|
15656
15656
|
return `${label}:${normalized}|dev:${String(stat2.dev)}|ino:${String(stat2.ino)}`;
|
|
15657
15657
|
} catch {
|
|
15658
15658
|
return `${label}:${normalized}|unavailable`;
|
|
@@ -15726,7 +15726,7 @@ function canonicalizeForHash(value) {
|
|
|
15726
15726
|
return result;
|
|
15727
15727
|
}
|
|
15728
15728
|
function migrationFingerprint(value) {
|
|
15729
|
-
return
|
|
15729
|
+
return createHash6("sha256").update(JSON.stringify(canonicalizeForHash(value))).digest("hex");
|
|
15730
15730
|
}
|
|
15731
15731
|
function contextMigrationOptions(context) {
|
|
15732
15732
|
if (!context)
|
|
@@ -15801,13 +15801,13 @@ async function findMigrationWorkspaceByPath(requested, dataPath2, guard) {
|
|
|
15801
15801
|
const databasePath = join7(workspaceDirectory, "state.vscdb");
|
|
15802
15802
|
if (!existsSync4(databasePath))
|
|
15803
15803
|
continue;
|
|
15804
|
-
const
|
|
15805
|
-
if (!
|
|
15804
|
+
const path3 = readWorkspaceJson(workspaceDirectory);
|
|
15805
|
+
if (!path3 || !pathsEqual(path3, normalizedRequest))
|
|
15806
15806
|
continue;
|
|
15807
15807
|
return {
|
|
15808
15808
|
workspace: {
|
|
15809
15809
|
id: entry.name,
|
|
15810
|
-
path: normalizePath(
|
|
15810
|
+
path: normalizePath(path3),
|
|
15811
15811
|
dbPath: databasePath,
|
|
15812
15812
|
sessionCount: 0
|
|
15813
15813
|
},
|
|
@@ -15825,7 +15825,7 @@ function loadWorkspaceComposerAddressInventory(db, budget, signal) {
|
|
|
15825
15825
|
if (rootType !== "array" && rootType !== "object") {
|
|
15826
15826
|
throw new TypeError("Composer workspace catalog is not a JSON array or object.");
|
|
15827
15827
|
}
|
|
15828
|
-
const scanIds = (
|
|
15828
|
+
const scanIds = (path3, objectIds) => {
|
|
15829
15829
|
const scanBudget = new SqliteSourceReadBudget(budget.limits, budget.outcome);
|
|
15830
15830
|
const results = [];
|
|
15831
15831
|
const pageRows = scanBudget.limits.sqlitePageRows;
|
|
@@ -15836,7 +15836,7 @@ function loadWorkspaceComposerAddressInventory(db, budget, signal) {
|
|
|
15836
15836
|
throwIfMigrationAborted(signal);
|
|
15837
15837
|
const rows = db.prepare(`SELECT CAST(j.key AS INTEGER) AS itemIndex,
|
|
15838
15838
|
length(CAST(${valueExpression} AS BLOB)) AS byteLength
|
|
15839
|
-
FROM ItemTable AS i, json_each(i.value, '${
|
|
15839
|
+
FROM ItemTable AS i, json_each(i.value, '${path3}') AS j
|
|
15840
15840
|
WHERE i.rowid = ?
|
|
15841
15841
|
AND ${typePredicate}
|
|
15842
15842
|
AND CAST(j.key AS INTEGER) > ?
|
|
@@ -15855,7 +15855,7 @@ function loadWorkspaceComposerAddressInventory(db, budget, signal) {
|
|
|
15855
15855
|
for (const item of metadata) {
|
|
15856
15856
|
throwIfMigrationAborted(signal);
|
|
15857
15857
|
const projected = db.prepare(`SELECT ${valueExpression} AS sessionId
|
|
15858
|
-
FROM ItemTable AS i, json_each(i.value, '${
|
|
15858
|
+
FROM ItemTable AS i, json_each(i.value, '${path3}') AS j
|
|
15859
15859
|
WHERE i.rowid = ? AND CAST(j.key AS INTEGER) = ?`).get(source.rowId, item.itemIndex);
|
|
15860
15860
|
if (typeof projected?.sessionId !== "string") {
|
|
15861
15861
|
throw new Error("Composer ID projection changed after metadata admission.");
|
|
@@ -17550,7 +17550,7 @@ async function migrateWorkspace(options) {
|
|
|
17550
17550
|
};
|
|
17551
17551
|
}
|
|
17552
17552
|
var init_migrate = __esm({
|
|
17553
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
17553
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/migrate.js"() {
|
|
17554
17554
|
"use strict";
|
|
17555
17555
|
init_storage();
|
|
17556
17556
|
init_platform();
|
|
@@ -17564,7 +17564,7 @@ var init_migrate = __esm({
|
|
|
17564
17564
|
}
|
|
17565
17565
|
});
|
|
17566
17566
|
|
|
17567
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
17567
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/backup.js
|
|
17568
17568
|
async function createBackup2(config) {
|
|
17569
17569
|
return createBackup(config);
|
|
17570
17570
|
}
|
|
@@ -17581,13 +17581,13 @@ function getDefaultBackupDir2() {
|
|
|
17581
17581
|
return getDefaultBackupDir();
|
|
17582
17582
|
}
|
|
17583
17583
|
var init_backup2 = __esm({
|
|
17584
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
17584
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/backup.js"() {
|
|
17585
17585
|
"use strict";
|
|
17586
17586
|
init_backup();
|
|
17587
17587
|
}
|
|
17588
17588
|
});
|
|
17589
17589
|
|
|
17590
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
17590
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/index.js
|
|
17591
17591
|
var lib_exports = {};
|
|
17592
17592
|
__export(lib_exports, {
|
|
17593
17593
|
BackupError: () => BackupError,
|
|
@@ -17961,7 +17961,7 @@ function convertToLibrarySession(coreSession) {
|
|
|
17961
17961
|
timestamp: coreSession.createdAt.toISOString(),
|
|
17962
17962
|
messages: coreSession.messages.map((msg) => {
|
|
17963
17963
|
const hasMessageTimestamp = msg.timestamp instanceof Date && !Number.isNaN(msg.timestamp.getTime());
|
|
17964
|
-
const
|
|
17964
|
+
const timestamp2 = hasMessageTimestamp ? msg.timestamp : coreSession.createdAt;
|
|
17965
17965
|
const timestampSource = msg.timestampSource ?? (hasMessageTimestamp ? "unknown" : coreSession.createdAtSource === "epoch-unknown" ? "unknown" : "session-fallback");
|
|
17966
17966
|
const m = {
|
|
17967
17967
|
id: msg.id ?? void 0,
|
|
@@ -17971,7 +17971,7 @@ function convertToLibrarySession(coreSession) {
|
|
|
17971
17971
|
// messages are filled by the core storage layer; Store-only messages
|
|
17972
17972
|
// without a turn timestamp use the session creation time and expose
|
|
17973
17973
|
// that fallback as additive provenance.
|
|
17974
|
-
timestamp:
|
|
17974
|
+
timestamp: timestamp2.toISOString(),
|
|
17975
17975
|
// v0.16 created every optional Message member as an own property even
|
|
17976
17976
|
// when its value was undefined. Preserve that observable runtime shape
|
|
17977
17977
|
// while detaching defined arrays/objects from the core result.
|
|
@@ -18507,7 +18507,7 @@ function getActiveDriver2() {
|
|
|
18507
18507
|
}
|
|
18508
18508
|
var publicReadContexts;
|
|
18509
18509
|
var init_lib = __esm({
|
|
18510
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
18510
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/index.js"() {
|
|
18511
18511
|
"use strict";
|
|
18512
18512
|
init_types2();
|
|
18513
18513
|
init_errors3();
|
|
@@ -18662,8 +18662,8 @@ function traceError(operation, error, level = "error") {
|
|
|
18662
18662
|
|
|
18663
18663
|
// src/harness/cursor/local.ts
|
|
18664
18664
|
import { stat } from "node:fs/promises";
|
|
18665
|
-
import { homedir as
|
|
18666
|
-
import
|
|
18665
|
+
import { homedir as homedir4 } from "node:os";
|
|
18666
|
+
import path2 from "node:path";
|
|
18667
18667
|
|
|
18668
18668
|
// ../pricing/src/table.ts
|
|
18669
18669
|
var PROVIDER_SEPARATOR = ":";
|
|
@@ -18994,6 +18994,65 @@ function emptyScanStats() {
|
|
|
18994
18994
|
}
|
|
18995
18995
|
|
|
18996
18996
|
// src/harness/cursor/evidence.ts
|
|
18997
|
+
var TOOL_PARAM_KEYS = ["command", "cmd", "skill", "subagent_type"];
|
|
18998
|
+
function slimSession(session) {
|
|
18999
|
+
const messages = session.messages.map((message) => {
|
|
19000
|
+
const slim = {
|
|
19001
|
+
role: message.role,
|
|
19002
|
+
contentLength: message.content?.length ?? 0,
|
|
19003
|
+
timestamp: message.timestamp
|
|
19004
|
+
};
|
|
19005
|
+
if (message.id !== void 0) slim.id = message.id;
|
|
19006
|
+
if (message.identityOrigin !== void 0)
|
|
19007
|
+
slim.identityOrigin = message.identityOrigin;
|
|
19008
|
+
if (message.parentMessageId !== void 0)
|
|
19009
|
+
slim.parentMessageId = message.parentMessageId;
|
|
19010
|
+
if (message.isSidechain !== void 0)
|
|
19011
|
+
slim.isSidechain = message.isSidechain;
|
|
19012
|
+
if (message.timestampSource !== void 0)
|
|
19013
|
+
slim.timestampSource = message.timestampSource;
|
|
19014
|
+
if (message.model !== void 0) slim.model = message.model;
|
|
19015
|
+
if (message.metadata?.corrupted !== void 0)
|
|
19016
|
+
slim.metadata = { corrupted: message.metadata.corrupted };
|
|
19017
|
+
if (message.toolCalls)
|
|
19018
|
+
slim.toolCalls = message.toolCalls.map((call) => {
|
|
19019
|
+
const out2 = { name: call.name };
|
|
19020
|
+
if (call.id !== void 0) out2.id = call.id;
|
|
19021
|
+
if (call.identityOrigin !== void 0)
|
|
19022
|
+
out2.identityOrigin = call.identityOrigin;
|
|
19023
|
+
if (call.params)
|
|
19024
|
+
for (const key2 of TOOL_PARAM_KEYS) {
|
|
19025
|
+
const value = call.params[key2];
|
|
19026
|
+
if (typeof value !== "string") continue;
|
|
19027
|
+
out2.params ??= {};
|
|
19028
|
+
out2.params[key2] = value;
|
|
19029
|
+
}
|
|
19030
|
+
return out2;
|
|
19031
|
+
});
|
|
19032
|
+
return slim;
|
|
19033
|
+
});
|
|
19034
|
+
const out = {
|
|
19035
|
+
id: session.id,
|
|
19036
|
+
timestamp: session.timestamp,
|
|
19037
|
+
messages
|
|
19038
|
+
};
|
|
19039
|
+
if (session.createdAtSource !== void 0)
|
|
19040
|
+
out.createdAtSource = session.createdAtSource;
|
|
19041
|
+
if (session.lastUpdatedAtSource !== void 0)
|
|
19042
|
+
out.lastUpdatedAtSource = session.lastUpdatedAtSource;
|
|
19043
|
+
if (session.resolutionState !== void 0)
|
|
19044
|
+
out.resolutionState = session.resolutionState;
|
|
19045
|
+
if (session.canonicalWorkspacePath !== void 0)
|
|
19046
|
+
out.canonicalWorkspacePath = session.canonicalWorkspacePath;
|
|
19047
|
+
if (session.metadata) {
|
|
19048
|
+
out.metadata = {};
|
|
19049
|
+
if (session.metadata.cursorVersion !== void 0)
|
|
19050
|
+
out.metadata.cursorVersion = session.metadata.cursorVersion;
|
|
19051
|
+
if (session.metadata.lastModified !== void 0)
|
|
19052
|
+
out.metadata.lastModified = session.metadata.lastModified;
|
|
19053
|
+
}
|
|
19054
|
+
return out;
|
|
19055
|
+
}
|
|
18997
19056
|
function count(value) {
|
|
18998
19057
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
18999
19058
|
}
|
|
@@ -19047,14 +19106,298 @@ function tokenEvidence(value) {
|
|
|
19047
19106
|
return out;
|
|
19048
19107
|
}
|
|
19049
19108
|
|
|
19109
|
+
// src/harness/cursor/composer.ts
|
|
19110
|
+
var MIN_VALID_UNIX_MS = 1e12;
|
|
19111
|
+
var UNKNOWN_TIMESTAMP_EPOCH_MS = 0;
|
|
19112
|
+
var TOOL_PARAM_KEYS2 = ["command", "cmd", "skill", "subagent_type"];
|
|
19113
|
+
function storedDate(value) {
|
|
19114
|
+
if (typeof value !== "string" && typeof value !== "number") return null;
|
|
19115
|
+
const normalized = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value.trim()) : value;
|
|
19116
|
+
const ms = new Date(normalized).getTime();
|
|
19117
|
+
return Number.isFinite(ms) ? ms : null;
|
|
19118
|
+
}
|
|
19119
|
+
function bubbleTime(data) {
|
|
19120
|
+
if (data.createdAt) {
|
|
19121
|
+
const ms = new Date(data.createdAt).getTime();
|
|
19122
|
+
return { ms, source: "composer-created-at" };
|
|
19123
|
+
}
|
|
19124
|
+
const timing = asObj(data.timingInfo);
|
|
19125
|
+
if (!timing) return null;
|
|
19126
|
+
for (const field of [
|
|
19127
|
+
"clientRpcSendTime",
|
|
19128
|
+
"clientSettleTime",
|
|
19129
|
+
"clientEndTime"
|
|
19130
|
+
]) {
|
|
19131
|
+
const value = timing[field];
|
|
19132
|
+
if (typeof value === "number" && value > MIN_VALID_UNIX_MS)
|
|
19133
|
+
return { ms: value, source: "composer-timing" };
|
|
19134
|
+
}
|
|
19135
|
+
return null;
|
|
19136
|
+
}
|
|
19137
|
+
function contentLength(data) {
|
|
19138
|
+
let length = 0;
|
|
19139
|
+
for (const key2 of ["text", "content", "finalText", "message", "markdown"]) {
|
|
19140
|
+
const value = data[key2];
|
|
19141
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
19142
|
+
length = value.length;
|
|
19143
|
+
break;
|
|
19144
|
+
}
|
|
19145
|
+
}
|
|
19146
|
+
if (Array.isArray(data.codeBlocks))
|
|
19147
|
+
for (const block of data.codeBlocks) {
|
|
19148
|
+
const content = asObj(block)?.content;
|
|
19149
|
+
if (typeof content === "string") length += content.length;
|
|
19150
|
+
}
|
|
19151
|
+
return length;
|
|
19152
|
+
}
|
|
19153
|
+
function toolCall(data) {
|
|
19154
|
+
const tool = asObj(data.toolFormerData);
|
|
19155
|
+
const name = typeof tool?.name === "string" ? tool.name.trim() : "";
|
|
19156
|
+
if (!name) return void 0;
|
|
19157
|
+
const call = { name };
|
|
19158
|
+
const raw = tool?.params ?? tool?.rawArgs;
|
|
19159
|
+
if (typeof raw === "string" && raw.trim().length > 0) {
|
|
19160
|
+
let params;
|
|
19161
|
+
try {
|
|
19162
|
+
params = asObj(JSON.parse(raw)) ?? void 0;
|
|
19163
|
+
} catch {
|
|
19164
|
+
}
|
|
19165
|
+
if (params)
|
|
19166
|
+
for (const key2 of TOOL_PARAM_KEYS2) {
|
|
19167
|
+
const value = params[key2];
|
|
19168
|
+
if (typeof value !== "string") continue;
|
|
19169
|
+
call.params ??= {};
|
|
19170
|
+
call.params[key2] = value;
|
|
19171
|
+
}
|
|
19172
|
+
}
|
|
19173
|
+
return call;
|
|
19174
|
+
}
|
|
19175
|
+
var isValid = (ms) => typeof ms === "number" && Number.isFinite(ms);
|
|
19176
|
+
function resolveTimes(direct, sessionCreatedMs) {
|
|
19177
|
+
const out = direct.map(
|
|
19178
|
+
(d) => d && isValid(d.ms) && d.source ? { ms: d.ms, source: d.source } : void 0
|
|
19179
|
+
);
|
|
19180
|
+
let next;
|
|
19181
|
+
for (let i = out.length - 1; i >= 0; i--) {
|
|
19182
|
+
const d = out[i];
|
|
19183
|
+
if (d) {
|
|
19184
|
+
next = d.ms;
|
|
19185
|
+
continue;
|
|
19186
|
+
}
|
|
19187
|
+
if (next !== void 0) out[i] = { ms: next, source: "inferred-next" };
|
|
19188
|
+
}
|
|
19189
|
+
let previous;
|
|
19190
|
+
for (let i = 0; i < out.length; i++) {
|
|
19191
|
+
const d = out[i];
|
|
19192
|
+
if (d && d.source !== "inferred-next") {
|
|
19193
|
+
previous = d.ms;
|
|
19194
|
+
continue;
|
|
19195
|
+
}
|
|
19196
|
+
if (d) continue;
|
|
19197
|
+
if (previous !== void 0)
|
|
19198
|
+
out[i] = { ms: previous, source: "inferred-previous" };
|
|
19199
|
+
else if (sessionCreatedMs !== null)
|
|
19200
|
+
out[i] = { ms: sessionCreatedMs, source: "session-fallback" };
|
|
19201
|
+
else out[i] = { ms: UNKNOWN_TIMESTAMP_EPOCH_MS, source: "unknown" };
|
|
19202
|
+
}
|
|
19203
|
+
return out;
|
|
19204
|
+
}
|
|
19205
|
+
function readComposerSession(db, summary, signal) {
|
|
19206
|
+
const id = summary.id;
|
|
19207
|
+
const tokens = /* @__PURE__ */ new Map();
|
|
19208
|
+
const messages = [];
|
|
19209
|
+
const direct = [];
|
|
19210
|
+
for (const row of db.bubbles.iterate(`bubbleId:${id}:`, `bubbleId:${id};`)) {
|
|
19211
|
+
signal?.throwIfAborted();
|
|
19212
|
+
const key2 = String(row.key);
|
|
19213
|
+
const fallbackId = key2.slice(`bubbleId:${id}:`.length);
|
|
19214
|
+
let data = null;
|
|
19215
|
+
if (typeof row.value === "string") {
|
|
19216
|
+
try {
|
|
19217
|
+
data = asObj(JSON.parse(row.value));
|
|
19218
|
+
} catch {
|
|
19219
|
+
data = null;
|
|
19220
|
+
}
|
|
19221
|
+
}
|
|
19222
|
+
if (!data) {
|
|
19223
|
+
messages.push({
|
|
19224
|
+
id: fallbackId,
|
|
19225
|
+
identityOrigin: "composer-native",
|
|
19226
|
+
role: "assistant",
|
|
19227
|
+
contentLength: "[corrupted message]".length,
|
|
19228
|
+
timestamp: "",
|
|
19229
|
+
metadata: { corrupted: true }
|
|
19230
|
+
});
|
|
19231
|
+
direct.push(null);
|
|
19232
|
+
continue;
|
|
19233
|
+
}
|
|
19234
|
+
const bubbleId = asStr(data.bubbleId);
|
|
19235
|
+
const message = {
|
|
19236
|
+
id: bubbleId ?? fallbackId,
|
|
19237
|
+
identityOrigin: "composer-native",
|
|
19238
|
+
role: data.type === 2 ? "assistant" : "user",
|
|
19239
|
+
contentLength: contentLength(data),
|
|
19240
|
+
timestamp: ""
|
|
19241
|
+
};
|
|
19242
|
+
const model = asStr(asObj(data.modelInfo)?.modelName);
|
|
19243
|
+
if (model?.trim()) message.model = model;
|
|
19244
|
+
const call = toolCall(data);
|
|
19245
|
+
if (call) message.toolCalls = [call];
|
|
19246
|
+
messages.push(message);
|
|
19247
|
+
direct.push(bubbleTime(data));
|
|
19248
|
+
tokens.set(message.id, tokenEvidence(data));
|
|
19249
|
+
}
|
|
19250
|
+
if (messages.length === 0) return null;
|
|
19251
|
+
const stored = db.composer.get(`composerData:${id}`);
|
|
19252
|
+
const createdStored = storedDate(stored?.createdAt) ?? (summary.createdAtSource === "composer-metadata" ? storedDate(summary.timestamp) : null);
|
|
19253
|
+
const updatedStored = storedDate(stored?.lastUpdatedAt) ?? storedDate(stored?.updatedAt) ?? (summary.lastUpdatedAtSource === "composer-metadata" ? storedDate(summary.metadata?.lastModified) : null);
|
|
19254
|
+
let firstDirect = null;
|
|
19255
|
+
let lastDirect = null;
|
|
19256
|
+
for (const time of direct) {
|
|
19257
|
+
if (!time || !isValid(time.ms)) continue;
|
|
19258
|
+
firstDirect = firstDirect === null ? time.ms : Math.min(firstDirect, time.ms);
|
|
19259
|
+
lastDirect = lastDirect === null ? time.ms : Math.max(lastDirect, time.ms);
|
|
19260
|
+
}
|
|
19261
|
+
const created = createdStored !== null ? { ms: createdStored, source: "composer-metadata" } : firstDirect !== null ? { ms: firstDirect, source: "direct-message" } : { ms: UNKNOWN_TIMESTAMP_EPOCH_MS, source: "epoch-unknown" };
|
|
19262
|
+
const updated = updatedStored !== null ? { ms: updatedStored, source: "composer-metadata" } : lastDirect !== null ? { ms: lastDirect, source: "direct-message" } : { ms: UNKNOWN_TIMESTAMP_EPOCH_MS, source: "epoch-unknown" };
|
|
19263
|
+
const times = resolveTimes(
|
|
19264
|
+
direct,
|
|
19265
|
+
created.source === "epoch-unknown" ? null : created.ms
|
|
19266
|
+
);
|
|
19267
|
+
for (const [i, message] of messages.entries()) {
|
|
19268
|
+
message.timestamp = new Date(times[i].ms).toISOString();
|
|
19269
|
+
message.timestampSource = times[i].source;
|
|
19270
|
+
}
|
|
19271
|
+
const header = db.header.get(`composerData:${id}`);
|
|
19272
|
+
if (typeof header?.conversation === "string") {
|
|
19273
|
+
try {
|
|
19274
|
+
const conversation = JSON.parse(header.conversation);
|
|
19275
|
+
if (Array.isArray(conversation))
|
|
19276
|
+
for (const [index, raw] of conversation.entries()) {
|
|
19277
|
+
const obj = asObj(raw);
|
|
19278
|
+
const bubble = asStr(obj?.bubbleId) ?? asStr(obj?.id) ?? `msg:${index}`;
|
|
19279
|
+
if (!tokens.has(bubble)) tokens.set(bubble, tokenEvidence(raw));
|
|
19280
|
+
}
|
|
19281
|
+
} catch {
|
|
19282
|
+
}
|
|
19283
|
+
}
|
|
19284
|
+
const session = {
|
|
19285
|
+
id,
|
|
19286
|
+
timestamp: new Date(created.ms).toISOString(),
|
|
19287
|
+
createdAtSource: created.source,
|
|
19288
|
+
lastUpdatedAtSource: updated.source,
|
|
19289
|
+
resolutionState: "complete",
|
|
19290
|
+
messages,
|
|
19291
|
+
metadata: { lastModified: new Date(updated.ms).toISOString() }
|
|
19292
|
+
};
|
|
19293
|
+
if (summary.canonicalWorkspacePath !== void 0)
|
|
19294
|
+
session.canonicalWorkspacePath = summary.canonicalWorkspacePath;
|
|
19295
|
+
if (summary.metadata?.cursorVersion !== void 0)
|
|
19296
|
+
session.metadata = {
|
|
19297
|
+
...session.metadata,
|
|
19298
|
+
cursorVersion: summary.metadata.cursorVersion
|
|
19299
|
+
};
|
|
19300
|
+
return { session, tokens };
|
|
19301
|
+
}
|
|
19302
|
+
function hasComposerHalf(summary) {
|
|
19303
|
+
if (summary.resolutionState === "ambiguous") return false;
|
|
19304
|
+
const sources = summary.sources;
|
|
19305
|
+
return Array.isArray(sources) ? sources.includes("composer") : true;
|
|
19306
|
+
}
|
|
19307
|
+
|
|
19308
|
+
// src/harness/cursor/sessionCache.ts
|
|
19309
|
+
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
19310
|
+
import { homedir } from "node:os";
|
|
19311
|
+
import path from "node:path";
|
|
19312
|
+
import { gunzipSync, gzipSync } from "node:zlib";
|
|
19313
|
+
|
|
19314
|
+
// src/harness/cursor/account.ts
|
|
19315
|
+
import { createHash } from "node:crypto";
|
|
19316
|
+
var digest = (value) => createHash("sha256").update(value).digest("hex");
|
|
19317
|
+
|
|
19318
|
+
// src/harness/cursor/sessionCache.ts
|
|
19319
|
+
var SESSION_CACHE_FORMAT = 1;
|
|
19320
|
+
var defaultSessionCacheDir = () => path.join(homedir(), ".config", "aistack", "cursor");
|
|
19321
|
+
var sessionCacheFile = (dir, root, store) => path.join(dir, `${digest(`${root}\0${store}`)}.sessions.json.gz`);
|
|
19322
|
+
function sessionStamp(summary, newest) {
|
|
19323
|
+
if (newest === null) return null;
|
|
19324
|
+
const count2 = summary.messageCount;
|
|
19325
|
+
const sources = summary.sources;
|
|
19326
|
+
return JSON.stringify([
|
|
19327
|
+
newest,
|
|
19328
|
+
typeof count2 === "number" ? count2 : null,
|
|
19329
|
+
Array.isArray(sources) ? sources : null,
|
|
19330
|
+
summary.resolutionState ?? null
|
|
19331
|
+
]);
|
|
19332
|
+
}
|
|
19333
|
+
function cacheable(local) {
|
|
19334
|
+
return local.session.resolutionState === "complete" && !local.session.messages.some((m) => m.metadata?.corrupted);
|
|
19335
|
+
}
|
|
19336
|
+
function toEntry(stamp, local) {
|
|
19337
|
+
return {
|
|
19338
|
+
stamp,
|
|
19339
|
+
session: local.session,
|
|
19340
|
+
tokens: Object.fromEntries(local.tokens)
|
|
19341
|
+
};
|
|
19342
|
+
}
|
|
19343
|
+
function fromEntry(entry) {
|
|
19344
|
+
return {
|
|
19345
|
+
session: entry.session,
|
|
19346
|
+
tokens: new Map(Object.entries(entry.tokens))
|
|
19347
|
+
};
|
|
19348
|
+
}
|
|
19349
|
+
function validEntry(value) {
|
|
19350
|
+
const entry = asObj(value);
|
|
19351
|
+
const session = asObj(entry?.session);
|
|
19352
|
+
return !!entry && typeof entry.stamp === "string" && !!session && typeof session.id === "string" && typeof session.timestamp === "string" && Array.isArray(session.messages) && session.messages.every((m) => {
|
|
19353
|
+
const message = asObj(m);
|
|
19354
|
+
return !!message && (message.role === "user" || message.role === "assistant") && typeof message.contentLength === "number" && typeof message.timestamp === "string";
|
|
19355
|
+
}) && !!asObj(entry.tokens);
|
|
19356
|
+
}
|
|
19357
|
+
async function loadSessionCache(file) {
|
|
19358
|
+
const out = /* @__PURE__ */ new Map();
|
|
19359
|
+
let raw;
|
|
19360
|
+
try {
|
|
19361
|
+
raw = gunzipSync(await readFile(file)).toString("utf8");
|
|
19362
|
+
} catch (error) {
|
|
19363
|
+
if (error.code !== "ENOENT")
|
|
19364
|
+
traceError("cursor session cache read", error, "warn");
|
|
19365
|
+
return out;
|
|
19366
|
+
}
|
|
19367
|
+
try {
|
|
19368
|
+
const parsed = asObj(JSON.parse(raw));
|
|
19369
|
+
if (parsed?.format !== SESSION_CACHE_FORMAT) return out;
|
|
19370
|
+
const entries = asObj(parsed.sessions);
|
|
19371
|
+
if (!entries) return out;
|
|
19372
|
+
for (const [id, entry] of Object.entries(entries))
|
|
19373
|
+
if (validEntry(entry) && entry.session.id === id) out.set(id, entry);
|
|
19374
|
+
} catch (error) {
|
|
19375
|
+
traceError("cursor session cache read", error, "warn");
|
|
19376
|
+
out.clear();
|
|
19377
|
+
}
|
|
19378
|
+
return out;
|
|
19379
|
+
}
|
|
19380
|
+
async function saveSessionCache(file, cache) {
|
|
19381
|
+
await mkdir(path.dirname(file), { recursive: true, mode: 448 });
|
|
19382
|
+
const body = gzipSync(
|
|
19383
|
+
JSON.stringify({
|
|
19384
|
+
format: SESSION_CACHE_FORMAT,
|
|
19385
|
+
sessions: Object.fromEntries(cache)
|
|
19386
|
+
})
|
|
19387
|
+
);
|
|
19388
|
+
const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
19389
|
+
await writeFile(temporary, body, { mode: 384 });
|
|
19390
|
+
await rename(temporary, file);
|
|
19391
|
+
}
|
|
19392
|
+
|
|
19050
19393
|
// src/harness/cursor/local.ts
|
|
19051
|
-
function dataPath(env = process.env, home =
|
|
19052
|
-
if (env.CURSOR_DATA_PATH) return
|
|
19053
|
-
const base = platform === "darwin" ?
|
|
19054
|
-
return
|
|
19394
|
+
function dataPath(env = process.env, home = homedir4(), platform = process.platform) {
|
|
19395
|
+
if (env.CURSOR_DATA_PATH) return path2.resolve(env.CURSOR_DATA_PATH);
|
|
19396
|
+
const base = platform === "darwin" ? path2.join(home, "Library", "Application Support") : platform === "win32" ? env.APPDATA || path2.join(home, "AppData", "Roaming") : env.XDG_CONFIG_HOME || path2.join(home, ".config");
|
|
19397
|
+
return path2.join(base, "Cursor", "User", "workspaceStorage");
|
|
19055
19398
|
}
|
|
19056
|
-
var storeRoot = () => process.env.CURSOR_STORE_ROOT ||
|
|
19057
|
-
var globalDb = (root) =>
|
|
19399
|
+
var storeRoot = () => process.env.CURSOR_STORE_ROOT || path2.join(homedir4(), ".cursor");
|
|
19400
|
+
var globalDb = (root) => path2.join(path2.dirname(root), "globalStorage", "state.vscdb");
|
|
19058
19401
|
async function exists(file) {
|
|
19059
19402
|
try {
|
|
19060
19403
|
await stat(file);
|
|
@@ -19068,9 +19411,9 @@ async function hasLocalSource(root = dataPath()) {
|
|
|
19068
19411
|
[
|
|
19069
19412
|
root,
|
|
19070
19413
|
globalDb(root),
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19414
|
+
path2.join(storeRoot(), "projects"),
|
|
19415
|
+
path2.join(storeRoot(), "chats"),
|
|
19416
|
+
path2.join(storeRoot(), "acp-sessions")
|
|
19074
19417
|
].map(exists)
|
|
19075
19418
|
)).some(Boolean);
|
|
19076
19419
|
}
|
|
@@ -19098,6 +19441,16 @@ async function openEvidenceDb(root) {
|
|
|
19098
19441
|
header: db.prepare(
|
|
19099
19442
|
"SELECT json_extract(value, '$.conversation') AS conversation FROM cursorDiskKV WHERE key = ?"
|
|
19100
19443
|
),
|
|
19444
|
+
// One session's bubbles are one key range; insertion order is the
|
|
19445
|
+
// conversation order, as cursor-history reads them.
|
|
19446
|
+
bubbles: db.prepare(
|
|
19447
|
+
"SELECT key, value FROM cursorDiskKV WHERE key >= ? AND key < ? ORDER BY rowid"
|
|
19448
|
+
),
|
|
19449
|
+
composer: db.prepare(`SELECT
|
|
19450
|
+
json_extract(value, '$.createdAt') AS createdAt,
|
|
19451
|
+
json_extract(value, '$.lastUpdatedAt') AS lastUpdatedAt,
|
|
19452
|
+
json_extract(value, '$.updatedAt') AS updatedAt
|
|
19453
|
+
FROM cursorDiskKV WHERE key = ?`),
|
|
19101
19454
|
close: () => db.close()
|
|
19102
19455
|
};
|
|
19103
19456
|
} catch (error) {
|
|
@@ -19142,6 +19495,15 @@ async function sourceStamp(root) {
|
|
|
19142
19495
|
return values.join("/");
|
|
19143
19496
|
}
|
|
19144
19497
|
var readWindowSinceMs;
|
|
19498
|
+
var sessionCacheDir;
|
|
19499
|
+
function sessionCachePath(root) {
|
|
19500
|
+
if (sessionCacheDir === null) return null;
|
|
19501
|
+
return sessionCacheFile(
|
|
19502
|
+
sessionCacheDir ?? defaultSessionCacheDir(),
|
|
19503
|
+
root,
|
|
19504
|
+
storeRoot()
|
|
19505
|
+
);
|
|
19506
|
+
}
|
|
19145
19507
|
var STALL_MS = 12e4;
|
|
19146
19508
|
var SLOW_SESSION_MS = 2e3;
|
|
19147
19509
|
var READ_WINDOW_MARGIN_MS = 864e5;
|
|
@@ -19164,8 +19526,9 @@ function olderThanWindow(summary, sinceMs) {
|
|
|
19164
19526
|
const newest = summaryNewestMs(summary);
|
|
19165
19527
|
return newest !== null && newest < sinceMs - READ_WINDOW_MARGIN_MS;
|
|
19166
19528
|
}
|
|
19167
|
-
async function readLocalOnce(root, before, onProgress, sourceReadLimits, stallMs = STALL_MS, sinceMs = readWindowSinceMs) {
|
|
19529
|
+
async function readLocalOnce(root, before, onProgress, sourceReadLimits, stallMs = STALL_MS, sinceMs = readWindowSinceMs, cacheDir = sessionCacheDir) {
|
|
19168
19530
|
before ??= await sourceStamp(root);
|
|
19531
|
+
sessionCacheDir = cacheDir;
|
|
19169
19532
|
const stats = emptyScanStats();
|
|
19170
19533
|
const out = { sessions: [], complete: true, stats };
|
|
19171
19534
|
if (!await hasLocalSource(root)) {
|
|
@@ -19183,6 +19546,13 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits, stallMs
|
|
|
19183
19546
|
let encodingInvalid = 0;
|
|
19184
19547
|
let total;
|
|
19185
19548
|
let stage = "reader setup";
|
|
19549
|
+
const cacheFile = sessionCachePath(root);
|
|
19550
|
+
const cache = cacheFile ? await loadSessionCache(cacheFile) : /* @__PURE__ */ new Map();
|
|
19551
|
+
const listed = /* @__PURE__ */ new Set();
|
|
19552
|
+
let listingComplete = false;
|
|
19553
|
+
let fromCache = 0;
|
|
19554
|
+
let direct = 0;
|
|
19555
|
+
let viaLibrary = 0;
|
|
19186
19556
|
const stall = new AbortController();
|
|
19187
19557
|
const { signal } = stall;
|
|
19188
19558
|
let stallTimer;
|
|
@@ -19235,29 +19605,60 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits, stallMs
|
|
|
19235
19605
|
continue;
|
|
19236
19606
|
}
|
|
19237
19607
|
stats.filesFound++;
|
|
19608
|
+
listed.add(summary.id);
|
|
19238
19609
|
if (summary.resolutionState === "ambiguous") {
|
|
19239
19610
|
out.complete = false;
|
|
19240
19611
|
}
|
|
19241
19612
|
const position = `${stats.filesRead + stats.filesUnreadable + stats.filesSkippedByMtime + 1} of ${total}`;
|
|
19242
19613
|
const sessionStartedMs = Date.now();
|
|
19614
|
+
const stamp = sessionStamp(summary, summaryNewestMs(summary));
|
|
19615
|
+
const held = stamp === null ? void 0 : cache.get(summary.id);
|
|
19616
|
+
if (held && held.stamp === stamp) {
|
|
19617
|
+
out.sessions.push(fromEntry(held));
|
|
19618
|
+
stats.filesRead++;
|
|
19619
|
+
fromCache++;
|
|
19620
|
+
onProgress?.(stats.filesRead + stats.filesSkippedByMtime, total);
|
|
19621
|
+
progressed();
|
|
19622
|
+
continue;
|
|
19623
|
+
}
|
|
19243
19624
|
try {
|
|
19244
|
-
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
if (
|
|
19248
|
-
if (
|
|
19625
|
+
let local = null;
|
|
19626
|
+
if (hasComposerHalf(summary)) {
|
|
19627
|
+
stage = "composer read";
|
|
19628
|
+
if (evidence === void 0) evidence = await openEvidenceDb(root);
|
|
19629
|
+
if (evidence)
|
|
19630
|
+
local = readComposerSession(evidence, summary, signal);
|
|
19631
|
+
}
|
|
19632
|
+
if (local) {
|
|
19633
|
+
direct++;
|
|
19634
|
+
if (local.session.messages.some((m) => m.metadata?.corrupted)) {
|
|
19249
19635
|
corrupted++;
|
|
19250
|
-
|
|
19636
|
+
out.complete = false;
|
|
19637
|
+
}
|
|
19638
|
+
} else {
|
|
19639
|
+
stage = "session read";
|
|
19640
|
+
const session = await reader.getSession(summary.id, config);
|
|
19641
|
+
if (session.resolutionState !== "complete" || session.messages.some((m) => m.metadata?.corrupted)) {
|
|
19642
|
+
if (session.resolutionState !== "complete") unresolved++;
|
|
19643
|
+
if (session.messages.some((m) => m.metadata?.corrupted))
|
|
19644
|
+
corrupted++;
|
|
19645
|
+
out.complete = false;
|
|
19646
|
+
}
|
|
19647
|
+
stage = "token evidence";
|
|
19648
|
+
if (evidence === void 0) evidence = await openEvidenceDb(root);
|
|
19649
|
+
const tokens = readTokenEvidence(session, evidence);
|
|
19650
|
+
local = { session: slimSession(session), tokens };
|
|
19651
|
+
viaLibrary++;
|
|
19251
19652
|
}
|
|
19252
|
-
|
|
19253
|
-
if (
|
|
19254
|
-
|
|
19255
|
-
|
|
19653
|
+
out.sessions.push(local);
|
|
19654
|
+
if (stamp !== null && cacheable(local))
|
|
19655
|
+
cache.set(summary.id, toEntry(stamp, local));
|
|
19656
|
+
else cache.delete(summary.id);
|
|
19256
19657
|
stats.filesRead++;
|
|
19257
19658
|
const elapsedMs = Date.now() - sessionStartedMs;
|
|
19258
19659
|
if (elapsedMs >= SLOW_SESSION_MS)
|
|
19259
19660
|
trace(
|
|
19260
|
-
`cursor slow session \xB7 ${position} \xB7 ${elapsedMs} ms \xB7 ${session.messages.length} messages, ${tokens.size} bubbles with token evidence`,
|
|
19661
|
+
`cursor slow session \xB7 ${position} \xB7 ${elapsedMs} ms \xB7 ${local.session.messages.length} messages, ${local.tokens.size} bubbles with token evidence`,
|
|
19261
19662
|
"warn"
|
|
19262
19663
|
);
|
|
19263
19664
|
onProgress?.(stats.filesRead + stats.filesSkippedByMtime, total);
|
|
@@ -19274,7 +19675,10 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits, stallMs
|
|
|
19274
19675
|
progressed();
|
|
19275
19676
|
}
|
|
19276
19677
|
}
|
|
19277
|
-
if (!page.pagination.hasMore)
|
|
19678
|
+
if (!page.pagination.hasMore) {
|
|
19679
|
+
listingComplete = true;
|
|
19680
|
+
break;
|
|
19681
|
+
}
|
|
19278
19682
|
if (page.data.length === 0 || offset >= 1e5) {
|
|
19279
19683
|
trace(
|
|
19280
19684
|
"cursor listing incomplete \xB7 empty page or pagination limit",
|
|
@@ -19309,6 +19713,21 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits, stallMs
|
|
|
19309
19713
|
stats.filesUnreadable++;
|
|
19310
19714
|
} finally {
|
|
19311
19715
|
clearTimeout(stallTimer);
|
|
19716
|
+
if (cacheFile && !retrySmallPage) {
|
|
19717
|
+
if (listingComplete) {
|
|
19718
|
+
for (const id of [...cache.keys()])
|
|
19719
|
+
if (!listed.has(id)) cache.delete(id);
|
|
19720
|
+
}
|
|
19721
|
+
try {
|
|
19722
|
+
await saveSessionCache(cacheFile, cache);
|
|
19723
|
+
} catch (error) {
|
|
19724
|
+
traceError("cursor session cache save", error, "warn");
|
|
19725
|
+
}
|
|
19726
|
+
}
|
|
19727
|
+
if (fromCache || direct || viaLibrary)
|
|
19728
|
+
trace(
|
|
19729
|
+
`cursor \xB7 ${fromCache} sessions from cache, ${direct} read directly, ${viaLibrary} through cursor-history`
|
|
19730
|
+
);
|
|
19312
19731
|
try {
|
|
19313
19732
|
evidence?.close();
|
|
19314
19733
|
} catch (error) {
|
|
@@ -19332,7 +19751,8 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits, stallMs
|
|
|
19332
19751
|
onProgress,
|
|
19333
19752
|
{ ...sourceReadLimits, sqlitePageRows: 1 },
|
|
19334
19753
|
stallMs,
|
|
19335
|
-
sinceMs
|
|
19754
|
+
sinceMs,
|
|
19755
|
+
cacheDir
|
|
19336
19756
|
);
|
|
19337
19757
|
}
|
|
19338
19758
|
if (stats.filesSkippedByMtime)
|
|
@@ -19396,7 +19816,8 @@ readLocalOnce(
|
|
|
19396
19816
|
}),
|
|
19397
19817
|
void 0,
|
|
19398
19818
|
void 0,
|
|
19399
|
-
input.sinceMs
|
|
19819
|
+
input.sinceMs,
|
|
19820
|
+
input.sessionCacheDir
|
|
19400
19821
|
).then(
|
|
19401
19822
|
(read) => post({ kind: "result", read }),
|
|
19402
19823
|
(error) => {
|