@use-aistack/cli 0.20.0 → 0.20.2
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/README.md +6 -0
- package/dist/cursor-worker.js +16 -3
- package/dist/cursor-worker.js.map +1 -1
- package/dist/index.js +397 -326
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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((path16) => !unverifiedResidueSet.has(path16)).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,
|
|
@@ -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(path16) {
|
|
481
|
+
super(`Database is locked: ${path16}. Close Cursor or retry later.`);
|
|
482
|
+
this.path = path16;
|
|
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(path16) {
|
|
493
|
+
super(`Database not found: ${path16}. Check dataPath configuration.`);
|
|
494
|
+
this.path = path16;
|
|
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(path16) {
|
|
547
|
+
super(`No workspace found for path: ${path16}. Please open the project in Cursor first.`);
|
|
548
|
+
this.path = path16;
|
|
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(path16) {
|
|
559
|
+
super(`Source and destination are the same: ${path16}`);
|
|
560
|
+
this.path = path16;
|
|
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(path16) {
|
|
571
|
+
super(`No sessions found for workspace: ${path16}. Use 'cursor-history list --workspace "${path16}"' to verify.`);
|
|
572
|
+
this.path = path16;
|
|
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(path16, sessionCount) {
|
|
585
|
+
super(`Destination already has ${sessionCount} session(s): ${path16}. Use --force to proceed (will add sessions alongside existing ones).`);
|
|
586
|
+
this.path = path16;
|
|
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(path16) {
|
|
622
|
+
super(`No Cursor data found at: ${path16}. Verify Cursor is installed and has been used.`);
|
|
623
|
+
this.path = path16;
|
|
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(path16) {
|
|
634
|
+
super(`File already exists: ${path16}. Use --force to overwrite.`);
|
|
635
|
+
this.path = path16;
|
|
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(path16) {
|
|
672
|
+
super(`Backup file not found: ${path16}`);
|
|
673
|
+
this.path = path16;
|
|
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(path16, reason) {
|
|
686
|
+
super(`Invalid backup file: ${path16}. ${reason}`);
|
|
687
|
+
this.path = path16;
|
|
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(path16) {
|
|
699
|
+
super(`Target already has Cursor data: ${path16}. Use --force to overwrite.`);
|
|
700
|
+
this.path = path16;
|
|
701
701
|
if (Error.captureStackTrace) {
|
|
702
702
|
Error.captureStackTrace(this, _TargetExistsError);
|
|
703
703
|
}
|
|
@@ -787,18 +787,18 @@ function getCursorDataPath(customPath) {
|
|
|
787
787
|
function getGlobalStoragePath(customDataPath) {
|
|
788
788
|
return join6(dirname3(getCursorDataPath(customDataPath)), "globalStorage");
|
|
789
789
|
}
|
|
790
|
-
function expandPath(
|
|
791
|
-
if (
|
|
792
|
-
return join6(homedir9(),
|
|
790
|
+
function expandPath(path16) {
|
|
791
|
+
if (path16.startsWith("~")) {
|
|
792
|
+
return join6(homedir9(), path16.slice(1));
|
|
793
793
|
}
|
|
794
|
-
return
|
|
794
|
+
return path16;
|
|
795
795
|
}
|
|
796
|
-
function contractPath(
|
|
796
|
+
function contractPath(path16) {
|
|
797
797
|
const home = homedir9();
|
|
798
|
-
if (
|
|
799
|
-
return "~" +
|
|
798
|
+
if (path16.startsWith(home)) {
|
|
799
|
+
return "~" + path16.slice(home.length);
|
|
800
800
|
}
|
|
801
|
-
return
|
|
801
|
+
return path16;
|
|
802
802
|
}
|
|
803
803
|
function normalizePath(filePath) {
|
|
804
804
|
let normalized = filePath;
|
|
@@ -1439,8 +1439,8 @@ function normalizePublicWorkspacePath(value) {
|
|
|
1439
1439
|
return void 0;
|
|
1440
1440
|
}
|
|
1441
1441
|
}
|
|
1442
|
-
function exactComparisonKey(
|
|
1443
|
-
return
|
|
1442
|
+
function exactComparisonKey(path16) {
|
|
1443
|
+
return path16.caseInsensitive ? path16.path.toLowerCase() : path16.path;
|
|
1444
1444
|
}
|
|
1445
1445
|
function componentsEndWith(candidate, request2) {
|
|
1446
1446
|
if (request2.drive && candidate.drive !== request2.drive)
|
|
@@ -2842,14 +2842,14 @@ var init_registry = __esm({
|
|
|
2842
2842
|
return this.selectDatabaseDriver(request2);
|
|
2843
2843
|
}
|
|
2844
2844
|
/** Open a database in read-only mode. */
|
|
2845
|
-
async openDatabase(
|
|
2845
|
+
async openDatabase(path16, request2 = READ_SESSION_REQUEST) {
|
|
2846
2846
|
const driver = await this.ensureDriver(request2);
|
|
2847
|
-
return openObservedDatabase(request2.io, request2, () => driver.open(
|
|
2847
|
+
return openObservedDatabase(request2.io, request2, () => driver.open(path16, { readonly: true }));
|
|
2848
2848
|
}
|
|
2849
2849
|
/** Open a database in read-write mode. */
|
|
2850
|
-
async openDatabaseReadWrite(
|
|
2850
|
+
async openDatabaseReadWrite(path16, request2 = MIGRATION_REQUEST) {
|
|
2851
2851
|
const driver = await this.ensureDriver(request2);
|
|
2852
|
-
return openObservedDatabase(request2.io, request2, () => driver.open(
|
|
2852
|
+
return openObservedDatabase(request2.io, request2, () => driver.open(path16, { 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(path16, 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(path16, options);
|
|
2865
2865
|
}
|
|
2866
2866
|
/** Create an online database snapshot with a provider satisfying the complete request. */
|
|
2867
2867
|
async backupDatabase(sourcePath, destPath, request2 = BACKUP_REQUEST) {
|
|
@@ -3008,12 +3008,12 @@ var init_better_sqlite3 = __esm({
|
|
|
3008
3008
|
getCapabilityProfile() {
|
|
3009
3009
|
return loadBetterSqlite3Profile();
|
|
3010
3010
|
},
|
|
3011
|
-
open(
|
|
3011
|
+
open(path16, 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(path16, { readonly: options.readonly });
|
|
3016
|
+
debugLog(`Opened database with better-sqlite3: ${path16} (readonly: ${options.readonly})`);
|
|
3017
3017
|
return new BetterSqlite3Database(db);
|
|
3018
3018
|
},
|
|
3019
3019
|
async backup(sourcePath, destPath) {
|
|
@@ -3204,12 +3204,12 @@ var init_node_sqlite = __esm({
|
|
|
3204
3204
|
getCapabilityProfile() {
|
|
3205
3205
|
return loadNodeSqliteProfile();
|
|
3206
3206
|
},
|
|
3207
|
-
open(
|
|
3207
|
+
open(path16, 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(path16, { readOnly: options.readonly });
|
|
3212
|
+
debugLog(`Opened database with node:sqlite: ${path16} (readonly: ${options.readonly})`);
|
|
3213
3213
|
return new NodeSqliteDatabaseWrapper(db, options.readonly);
|
|
3214
3214
|
},
|
|
3215
3215
|
async backup(sourcePath, destPath) {
|
|
@@ -3233,11 +3233,11 @@ var init_node_sqlite = __esm({
|
|
|
3233
3233
|
});
|
|
3234
3234
|
|
|
3235
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(
|
|
3237
|
-
return registry.openDatabase(
|
|
3236
|
+
async function openDatabase(path16, request2) {
|
|
3237
|
+
return registry.openDatabase(path16, request2);
|
|
3238
3238
|
}
|
|
3239
|
-
async function openDatabaseReadWrite(
|
|
3240
|
-
return registry.openDatabaseReadWrite(
|
|
3239
|
+
async function openDatabaseReadWrite(path16, request2) {
|
|
3240
|
+
return registry.openDatabaseReadWrite(path16, request2);
|
|
3241
3241
|
}
|
|
3242
3242
|
function getActiveDriver() {
|
|
3243
3243
|
return registry.getActiveDriver();
|
|
@@ -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(path16, contents) {
|
|
3378
|
+
const descriptor = openSync(path16, exclusiveFlags(), 384);
|
|
3379
3379
|
try {
|
|
3380
3380
|
if (IS_PERMISSION_AWARE_POSIX)
|
|
3381
3381
|
fchmodSync(descriptor, 384);
|
|
@@ -3387,10 +3387,10 @@ function createExclusivePrivateFile(path15, contents) {
|
|
|
3387
3387
|
closeSync(descriptor);
|
|
3388
3388
|
}
|
|
3389
3389
|
}
|
|
3390
|
-
function attemptRemoveEntryNoFollow(
|
|
3390
|
+
function attemptRemoveEntryNoFollow(path16) {
|
|
3391
3391
|
let stats;
|
|
3392
3392
|
try {
|
|
3393
|
-
stats = lstatSync(
|
|
3393
|
+
stats = lstatSync(path16);
|
|
3394
3394
|
} catch (error) {
|
|
3395
3395
|
if (!isMissing(error)) {
|
|
3396
3396
|
}
|
|
@@ -3398,13 +3398,13 @@ function attemptRemoveEntryNoFollow(path15) {
|
|
|
3398
3398
|
}
|
|
3399
3399
|
if (stats.isDirectory() && !stats.isSymbolicLink()) {
|
|
3400
3400
|
try {
|
|
3401
|
-
rmdirSync(
|
|
3401
|
+
rmdirSync(path16);
|
|
3402
3402
|
} catch {
|
|
3403
3403
|
}
|
|
3404
3404
|
return;
|
|
3405
3405
|
}
|
|
3406
3406
|
try {
|
|
3407
|
-
unlinkSync(
|
|
3407
|
+
unlinkSync(path16);
|
|
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(path16) {
|
|
3436
3436
|
try {
|
|
3437
|
-
lstatSync(
|
|
3437
|
+
lstatSync(path16);
|
|
3438
3438
|
return true;
|
|
3439
3439
|
} catch (error) {
|
|
3440
3440
|
return !isMissing(error);
|
|
@@ -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(path16, marker, markerPath, signal) {
|
|
3735
|
+
this.path = path16;
|
|
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(path16) {
|
|
3767
3767
|
this.assertOpen();
|
|
3768
|
-
const candidatePath = resolve(
|
|
3768
|
+
const candidatePath = resolve(path16);
|
|
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 path16 of tracked)
|
|
3783
|
+
attemptRemoveEntryNoFollow(path16);
|
|
3784
3784
|
attemptRemoveWorkspaceNoFollow(this.path);
|
|
3785
3785
|
const residuePaths = tracked.filter(mayStillExist);
|
|
3786
3786
|
if (mayStillExist(this.path))
|
|
@@ -4803,8 +4803,8 @@ 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(path16, options) {
|
|
4807
|
+
return BoundedZipArchive.open(path16, 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({
|
|
@@ -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(path16, entries, archiveSize, centralOffset, handle, limits, signal, io) {
|
|
4954
|
+
this.path = path16;
|
|
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(path16, options = {}) {
|
|
4967
4967
|
const limits = resolveSourceReadLimits(options.sourceReadLimits);
|
|
4968
4968
|
throwIfAborted(options.signal);
|
|
4969
4969
|
if (options.io) {
|
|
@@ -4973,7 +4973,7 @@ var init_zip_stream = __esm({
|
|
|
4973
4973
|
resourceClass: "backup-central-directory"
|
|
4974
4974
|
});
|
|
4975
4975
|
}
|
|
4976
|
-
const handle = await open2(
|
|
4976
|
+
const handle = await open2(path16, "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(path16, entries, archiveSize, central.offset, handle, limits, options.signal, options.io);
|
|
4993
4993
|
} catch (error) {
|
|
4994
4994
|
await handle.close();
|
|
4995
4995
|
throw error;
|
|
@@ -5495,16 +5495,16 @@ var init_composer_sqlite = __esm({
|
|
|
5495
5495
|
|
|
5496
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
|
-
function projectStat(
|
|
5498
|
+
function projectStat(stat9) {
|
|
5499
5499
|
return {
|
|
5500
|
-
device: BigInt(
|
|
5501
|
-
inode: BigInt(
|
|
5502
|
-
mode: Number(
|
|
5503
|
-
regularFile:
|
|
5500
|
+
device: BigInt(stat9.dev),
|
|
5501
|
+
inode: BigInt(stat9.ino),
|
|
5502
|
+
mode: Number(stat9.mode) & 511,
|
|
5503
|
+
regularFile: stat9.isFile()
|
|
5504
5504
|
};
|
|
5505
5505
|
}
|
|
5506
|
-
function hasIdentity(
|
|
5507
|
-
return
|
|
5506
|
+
function hasIdentity(stat9, expected) {
|
|
5507
|
+
return stat9.device === expected.device && stat9.inode === expected.inode;
|
|
5508
5508
|
}
|
|
5509
5509
|
function identityError(message) {
|
|
5510
5510
|
const error = new Error(message);
|
|
@@ -5573,10 +5573,10 @@ var init_backup_publication = __esm({
|
|
|
5573
5573
|
"use strict";
|
|
5574
5574
|
init_errors();
|
|
5575
5575
|
DEFAULT_MODE_OPERATIONS = Object.freeze({
|
|
5576
|
-
openNoFollow: (
|
|
5576
|
+
openNoFollow: (path16) => openSync2(path16, 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: (path16) => projectStat(lstatSync2(path16, { bigint: true })),
|
|
5580
5580
|
close: (descriptor) => closeSync2(descriptor)
|
|
5581
5581
|
});
|
|
5582
5582
|
}
|
|
@@ -5587,12 +5587,12 @@ import { linkSync, lstatSync as lstatSync3, renameSync, unlinkSync as unlinkSync
|
|
|
5587
5587
|
function errorCode(error) {
|
|
5588
5588
|
return error instanceof Error && "code" in error ? String(error.code) : void 0;
|
|
5589
5589
|
}
|
|
5590
|
-
function hasIdentity2(
|
|
5591
|
-
return
|
|
5590
|
+
function hasIdentity2(stat9, expected) {
|
|
5591
|
+
return stat9.isFile() && stat9.dev === expected.device && stat9.ino === expected.inode;
|
|
5592
5592
|
}
|
|
5593
|
-
function pathIdentityVerified(
|
|
5593
|
+
function pathIdentityVerified(path16, expected, operations) {
|
|
5594
5594
|
try {
|
|
5595
|
-
return hasIdentity2(operations.statPathNoFollow(
|
|
5595
|
+
return hasIdentity2(operations.statPathNoFollow(path16), expected);
|
|
5596
5596
|
} catch {
|
|
5597
5597
|
return false;
|
|
5598
5598
|
}
|
|
@@ -5643,8 +5643,8 @@ var init_backup_archive_publication = __esm({
|
|
|
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: (path16) => unlinkSync2(path16),
|
|
5647
|
+
statPathNoFollow: (path16) => lstatSync3(path16, { bigint: true })
|
|
5648
5648
|
});
|
|
5649
5649
|
}
|
|
5650
5650
|
});
|
|
@@ -5654,11 +5654,11 @@ import { linkSync as linkSync2, lstatSync as lstatSync4, renameSync as renameSyn
|
|
|
5654
5654
|
function errorCode2(error) {
|
|
5655
5655
|
return error instanceof Error && "code" in error ? String(error.code) : void 0;
|
|
5656
5656
|
}
|
|
5657
|
-
function hasIdentity3(
|
|
5658
|
-
return
|
|
5657
|
+
function hasIdentity3(stat9, expected) {
|
|
5658
|
+
return stat9.isFile() && stat9.dev === expected.device && stat9.ino === expected.inode;
|
|
5659
5659
|
}
|
|
5660
|
-
function cleanupError(
|
|
5661
|
-
const error = new TemporaryArtifactCleanupError(identityVerified ? [
|
|
5660
|
+
function cleanupError(path16, cause, identityVerified = true) {
|
|
5661
|
+
const error = new TemporaryArtifactCleanupError(identityVerified ? [path16] : [], identityVerified ? [] : [path16]);
|
|
5662
5662
|
Object.defineProperty(error, "cause", { configurable: true, value: cause });
|
|
5663
5663
|
return error;
|
|
5664
5664
|
}
|
|
@@ -5706,8 +5706,8 @@ var init_restore_publication = __esm({
|
|
|
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: (path16) => unlinkSync3(path16),
|
|
5710
|
+
statPathNoFollow: (path16) => lstatSync4(path16, { bigint: true })
|
|
5711
5711
|
});
|
|
5712
5712
|
}
|
|
5713
5713
|
});
|
|
@@ -5821,11 +5821,11 @@ function scanDatabaseFiles(dataPath2) {
|
|
|
5821
5821
|
const userDir = dirname4(dataPath2);
|
|
5822
5822
|
const globalDbPath = join8(userDir, "globalStorage", "state.vscdb");
|
|
5823
5823
|
if (existsSync7(globalDbPath)) {
|
|
5824
|
-
const
|
|
5824
|
+
const stat9 = statSync3(globalDbPath);
|
|
5825
5825
|
files.push({
|
|
5826
5826
|
absolutePath: globalDbPath,
|
|
5827
5827
|
relativePath: "globalStorage/state.vscdb",
|
|
5828
|
-
size:
|
|
5828
|
+
size: stat9.size,
|
|
5829
5829
|
type: "global-db"
|
|
5830
5830
|
});
|
|
5831
5831
|
}
|
|
@@ -5838,22 +5838,22 @@ function scanDatabaseFiles(dataPath2) {
|
|
|
5838
5838
|
const workspaceDir = join8(workspaceStorageDir, entry.name);
|
|
5839
5839
|
const workspaceDbPath = join8(workspaceDir, "state.vscdb");
|
|
5840
5840
|
if (existsSync7(workspaceDbPath)) {
|
|
5841
|
-
const
|
|
5841
|
+
const stat9 = statSync3(workspaceDbPath);
|
|
5842
5842
|
files.push({
|
|
5843
5843
|
absolutePath: workspaceDbPath,
|
|
5844
5844
|
relativePath: `workspaceStorage/${entry.name}/state.vscdb`,
|
|
5845
|
-
size:
|
|
5845
|
+
size: stat9.size,
|
|
5846
5846
|
type: "workspace-db",
|
|
5847
5847
|
workspaceId: entry.name
|
|
5848
5848
|
});
|
|
5849
5849
|
}
|
|
5850
5850
|
const workspaceJsonPath = join8(workspaceDir, "workspace.json");
|
|
5851
5851
|
if (existsSync7(workspaceJsonPath)) {
|
|
5852
|
-
const
|
|
5852
|
+
const stat9 = statSync3(workspaceJsonPath);
|
|
5853
5853
|
files.push({
|
|
5854
5854
|
absolutePath: workspaceJsonPath,
|
|
5855
5855
|
relativePath: `workspaceStorage/${entry.name}/workspace.json`,
|
|
5856
|
-
size:
|
|
5856
|
+
size: stat9.size,
|
|
5857
5857
|
type: "workspace-json",
|
|
5858
5858
|
workspaceId: entry.name
|
|
5859
5859
|
});
|
|
@@ -6075,12 +6075,12 @@ function checkDiskSpace(outputPath, requiredBytes) {
|
|
|
6075
6075
|
};
|
|
6076
6076
|
}
|
|
6077
6077
|
}
|
|
6078
|
-
function syncParentDirectory(
|
|
6078
|
+
function syncParentDirectory(path16) {
|
|
6079
6079
|
if (process.platform === "win32")
|
|
6080
6080
|
return;
|
|
6081
6081
|
let descriptor;
|
|
6082
6082
|
try {
|
|
6083
|
-
descriptor = openSync3(dirname4(
|
|
6083
|
+
descriptor = openSync3(dirname4(path16), constants3.O_RDONLY);
|
|
6084
6084
|
fsyncSync2(descriptor);
|
|
6085
6085
|
} catch {
|
|
6086
6086
|
} finally {
|
|
@@ -6092,13 +6092,13 @@ function syncParentDirectory(path15) {
|
|
|
6092
6092
|
}
|
|
6093
6093
|
}
|
|
6094
6094
|
}
|
|
6095
|
-
function removePrivateArchiveStage(
|
|
6095
|
+
function removePrivateArchiveStage(path16, operationError) {
|
|
6096
6096
|
try {
|
|
6097
|
-
unlinkSync4(
|
|
6097
|
+
unlinkSync4(path16);
|
|
6098
6098
|
} catch (error) {
|
|
6099
6099
|
if (errorCode3(error) === "ENOENT")
|
|
6100
6100
|
return;
|
|
6101
|
-
const cleanupError2 = new TemporaryArtifactCleanupError([
|
|
6101
|
+
const cleanupError2 = new TemporaryArtifactCleanupError([path16]);
|
|
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((path16) => !unverifiedResidueSet.has(path16));
|
|
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 path16 = entry["path"];
|
|
6474
|
+
const expectedType = backupEntryTypeForCanonicalPath(path16);
|
|
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 = path16.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: ${path16}`);
|
|
6481
6481
|
}
|
|
6482
6482
|
destinationKeys.add(destinationKey);
|
|
6483
6483
|
return {
|
|
6484
|
-
path:
|
|
6484
|
+
path: path16,
|
|
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(path16) {
|
|
6502
|
+
if (path16 === "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(path16);
|
|
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: path16 }) => /^workspaceStorage\/([^/]+)\/state\.vscdb$/u.exec(path16)?.[1]).filter((workspaceId) => workspaceId !== void 0).sort(compareCodePoints4);
|
|
6524
|
+
const containsGlobalDatabase = files.some(({ type, path: path16 }) => type === "global-db" && path16 === "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: path16 }) => path16 === 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: path16 }) => path16 === 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(path16) {
|
|
6792
6792
|
try {
|
|
6793
|
-
return lstatSync5(
|
|
6793
|
+
return lstatSync5(path16);
|
|
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, path16, leafKind) {
|
|
6801
6801
|
const absoluteRoot = resolve2(trustedRoot);
|
|
6802
|
-
const absolutePath = resolve2(
|
|
6802
|
+
const absolutePath = resolve2(path16);
|
|
6803
6803
|
const suffix = relative3(absoluteRoot, absolutePath);
|
|
6804
6804
|
if (suffix === ".." || suffix.startsWith(`..${sep2}`) || isAbsolute2(suffix)) {
|
|
6805
6805
|
throw new Error(`Restore destination escapes the Cursor data directory: ${absolutePath}`);
|
|
@@ -7103,12 +7103,12 @@ async function listBackups(directory, options = {}) {
|
|
|
7103
7103
|
continue;
|
|
7104
7104
|
}
|
|
7105
7105
|
const filePath = join8(dir, entry.name);
|
|
7106
|
-
const
|
|
7106
|
+
const stat9 = statSync3(filePath);
|
|
7107
7107
|
const info = {
|
|
7108
7108
|
filePath,
|
|
7109
7109
|
filename: entry.name,
|
|
7110
|
-
fileSize:
|
|
7111
|
-
modifiedAt:
|
|
7110
|
+
fileSize: stat9.size,
|
|
7111
|
+
modifiedAt: stat9.mtime
|
|
7112
7112
|
};
|
|
7113
7113
|
try {
|
|
7114
7114
|
const manifest = await readBackupManifest(filePath, readOptions);
|
|
@@ -7761,11 +7761,11 @@ function attachErrorCause(error, cause) {
|
|
|
7761
7761
|
});
|
|
7762
7762
|
}
|
|
7763
7763
|
}
|
|
7764
|
-
async function parseStoreDb(
|
|
7764
|
+
async function parseStoreDb(path16, 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(path16, 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(path15, 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(path16, 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(path15, 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 ${path16}: ${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 ${path16}: ${String(error)}`);
|
|
7833
7833
|
} else {
|
|
7834
7834
|
operationError = error;
|
|
7835
7835
|
}
|
|
@@ -7854,7 +7854,7 @@ async function parseStoreDb(path15, options = {}) {
|
|
|
7854
7854
|
throw operationError;
|
|
7855
7855
|
return result;
|
|
7856
7856
|
}
|
|
7857
|
-
function pathExists(
|
|
7857
|
+
function pathExists(path16, signal, io, logicalSessionId) {
|
|
7858
7858
|
throwIfAborted4(signal);
|
|
7859
7859
|
try {
|
|
7860
7860
|
if (io) {
|
|
@@ -7867,7 +7867,7 @@ function pathExists(path15, signal, io, logicalSessionId) {
|
|
|
7867
7867
|
...logicalSessionId ? { logicalSessionId } : {}
|
|
7868
7868
|
});
|
|
7869
7869
|
}
|
|
7870
|
-
statSync4(
|
|
7870
|
+
statSync4(path16);
|
|
7871
7871
|
return true;
|
|
7872
7872
|
} catch (error) {
|
|
7873
7873
|
const code = error?.code;
|
|
@@ -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, path16) {
|
|
8839
|
+
return `${representation}\0${path16}`;
|
|
8840
8840
|
}
|
|
8841
|
-
function occurrence(logicalSessionId, representation,
|
|
8841
|
+
function occurrence(logicalSessionId, representation, path16, workspacePath) {
|
|
8842
8842
|
return {
|
|
8843
|
-
instanceKey: occurrenceKey(representation,
|
|
8843
|
+
instanceKey: occurrenceKey(representation, path16),
|
|
8844
8844
|
logicalSessionId,
|
|
8845
8845
|
representation,
|
|
8846
|
-
path:
|
|
8846
|
+
path: path16,
|
|
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: path16 }) => path16 === 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 = join10(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: path16 }) => path16 === 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: path16 }) => path16 === 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: path16 }) => path16 === 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: path16 }) => path16 === 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(path16, 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 = readFileSync10(
|
|
9755
|
+
raw = readFileSync10(path16);
|
|
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(path16, signal, io, resourceClass = "store-root-directory", logicalSessionId) {
|
|
9887
9887
|
throwIfAborted6(signal);
|
|
9888
9888
|
try {
|
|
9889
9889
|
observeStoreFs(io, "open", resourceClass, logicalSessionId);
|
|
9890
|
-
statSync5(
|
|
9890
|
+
statSync5(path16);
|
|
9891
9891
|
return true;
|
|
9892
9892
|
} catch (error) {
|
|
9893
9893
|
if (isAbsentOrWrongType(error))
|
|
@@ -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: path16 }) => type === "global-db" && path16 === "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]));
|
|
@@ -12713,8 +12713,8 @@ function loadExactGlobalComposerSession(db, exactId, workspacePath, budget = cre
|
|
|
12713
12713
|
function composerWorkspaceMemberships(candidates) {
|
|
12714
12714
|
const counts2 = /* @__PURE__ */ new Map();
|
|
12715
12715
|
for (const candidate of candidates) {
|
|
12716
|
-
const
|
|
12717
|
-
counts2.set(
|
|
12716
|
+
const path16 = normalizeWorkspacePath(candidate.workspace.path);
|
|
12717
|
+
counts2.set(path16, (counts2.get(path16) ?? 0) + 1);
|
|
12718
12718
|
}
|
|
12719
12719
|
return [...counts2.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: path16 }) => path16),
|
|
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: path16 }) => !workspaceFilterMatches(path16, activeWorkspacePath));
|
|
13676
13676
|
for (const workspace of offScopeWorkspaces) {
|
|
13677
13677
|
if (backupPath) {
|
|
13678
13678
|
for (const id of getBackupComposerSessionIds(workspace) ?? []) {
|
|
@@ -14965,11 +14965,11 @@ function formatToolCall(toolData, codeBlocks) {
|
|
|
14965
14965
|
} else if (toolName === "grep" || toolName === "search" || toolName === "codebase_search") {
|
|
14966
14966
|
lines2.push(`[Tool: ${toolName === "grep" ? "Grep" : "Search"}]`);
|
|
14967
14967
|
const pattern = getParam(params, "pattern", "query", "searchQuery", "regex");
|
|
14968
|
-
const
|
|
14968
|
+
const path16 = getParam(params, "path", "directory", "targetDirectory");
|
|
14969
14969
|
if (pattern)
|
|
14970
14970
|
lines2.push(`Pattern: ${pattern}`);
|
|
14971
|
-
if (
|
|
14972
|
-
lines2.push(`Path: ${
|
|
14971
|
+
if (path16)
|
|
14972
|
+
lines2.push(`Path: ${path16}`);
|
|
14973
14973
|
} else if (toolName === "run_terminal_command" || toolName === "run_terminal_cmd" || toolName === "execute_command") {
|
|
14974
14974
|
lines2.push(`[Tool: Terminal Command]`);
|
|
14975
14975
|
const cmd = getParam(params, "command", "cmd");
|
|
@@ -15474,9 +15474,9 @@ import { pathToFileURL } from "node:url";
|
|
|
15474
15474
|
function generateSessionId() {
|
|
15475
15475
|
return randomUUID2();
|
|
15476
15476
|
}
|
|
15477
|
-
function transformPath(
|
|
15477
|
+
function transformPath(path16, sourcePrefix, destPrefix) {
|
|
15478
15478
|
const normalizedSource = sourcePrefix.replace(/\/+$/, "");
|
|
15479
|
-
const normalizedPath =
|
|
15479
|
+
const normalizedPath = path16;
|
|
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(path16) {
|
|
15596
|
+
const normalized = normalizePath(path16);
|
|
15597
15597
|
const windowsDrivePath = normalized.match(/^([A-Za-z]):[\\/](.*)$/);
|
|
15598
15598
|
if (windowsDrivePath) {
|
|
15599
15599
|
const drive = windowsDrivePath[1].toLowerCase();
|
|
@@ -15647,13 +15647,13 @@ function createMigrationReadGuard(limits, signal, sqliteDriver) {
|
|
|
15647
15647
|
sqliteDriver
|
|
15648
15648
|
};
|
|
15649
15649
|
}
|
|
15650
|
-
function physicalPathIdentity(label,
|
|
15651
|
-
const normalized = normalizedPathKey(
|
|
15652
|
-
if (!existsSync9(
|
|
15650
|
+
function physicalPathIdentity(label, path16) {
|
|
15651
|
+
const normalized = normalizedPathKey(path16);
|
|
15652
|
+
if (!existsSync9(path16))
|
|
15653
15653
|
return `${label}:${normalized}|missing`;
|
|
15654
15654
|
try {
|
|
15655
|
-
const
|
|
15656
|
-
return `${label}:${normalized}|dev:${String(
|
|
15655
|
+
const stat9 = statSync6(path16);
|
|
15656
|
+
return `${label}:${normalized}|dev:${String(stat9.dev)}|ino:${String(stat9.ino)}`;
|
|
15657
15657
|
} catch {
|
|
15658
15658
|
return `${label}:${normalized}|unavailable`;
|
|
15659
15659
|
}
|
|
@@ -15801,13 +15801,13 @@ async function findMigrationWorkspaceByPath(requested, dataPath2, guard) {
|
|
|
15801
15801
|
const databasePath = join12(workspaceDirectory, "state.vscdb");
|
|
15802
15802
|
if (!existsSync9(databasePath))
|
|
15803
15803
|
continue;
|
|
15804
|
-
const
|
|
15805
|
-
if (!
|
|
15804
|
+
const path16 = readWorkspaceJson(workspaceDirectory);
|
|
15805
|
+
if (!path16 || !pathsEqual(path16, normalizedRequest))
|
|
15806
15806
|
continue;
|
|
15807
15807
|
return {
|
|
15808
15808
|
workspace: {
|
|
15809
15809
|
id: entry.name,
|
|
15810
|
-
path: normalizePath(
|
|
15810
|
+
path: normalizePath(path16),
|
|
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 = (path16, 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, '${path16}') 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, '${path16}') 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.");
|
|
@@ -18542,8 +18542,13 @@ var PROVIDER_VENDOR = {
|
|
|
18542
18542
|
xai: "xai"
|
|
18543
18543
|
};
|
|
18544
18544
|
var PRICING_ALIASES = {
|
|
18545
|
-
"grok-4.6-build": "grok-4.6"
|
|
18545
|
+
"grok-4.6-build": "grok-4.6",
|
|
18546
|
+
"grok-4.7-build": "grok-4.7"
|
|
18546
18547
|
};
|
|
18548
|
+
var MODEL_SETTINGS_SUFFIX = /(?:-thinking)?(?:-(?:low|medium|high|xhigh|max))?(?:-fast)?$/;
|
|
18549
|
+
function withoutModelSettings(slug) {
|
|
18550
|
+
return slug.replace(MODEL_SETTINGS_SUFFIX, "");
|
|
18551
|
+
}
|
|
18547
18552
|
var LOCAL_PROVIDERS = /* @__PURE__ */ new Set([
|
|
18548
18553
|
"ollama",
|
|
18549
18554
|
"lmstudio",
|
|
@@ -18640,8 +18645,16 @@ var Pricer = class {
|
|
|
18640
18645
|
}
|
|
18641
18646
|
lookupSlug(slug, provider) {
|
|
18642
18647
|
if (this.firstLayerWith(slug, provider)) return slug;
|
|
18643
|
-
const
|
|
18644
|
-
|
|
18648
|
+
const base = withoutModelSettings(slug);
|
|
18649
|
+
for (const candidate of [
|
|
18650
|
+
PRICING_ALIASES[slug],
|
|
18651
|
+
base,
|
|
18652
|
+
PRICING_ALIASES[base]
|
|
18653
|
+
]) {
|
|
18654
|
+
if (candidate && this.firstLayerWith(candidate, provider))
|
|
18655
|
+
return candidate;
|
|
18656
|
+
}
|
|
18657
|
+
return null;
|
|
18645
18658
|
}
|
|
18646
18659
|
/**
|
|
18647
18660
|
* Every period that applies to a pricing key, or an empty list when none
|
|
@@ -18906,13 +18919,13 @@ function apiEquivalentCost(modelKey, t, atMs) {
|
|
|
18906
18919
|
}
|
|
18907
18920
|
|
|
18908
18921
|
// src/version.ts
|
|
18909
|
-
var CLI_VERSION = true ? "0.20.
|
|
18922
|
+
var CLI_VERSION = true ? "0.20.2" : "0.0.0-dev";
|
|
18910
18923
|
|
|
18911
18924
|
// src/api.ts
|
|
18912
18925
|
var BASE_URL = process.env.AISTACK_URL || "https://aistack.to";
|
|
18913
18926
|
var STARTUP_READ_TIMEOUT_MS = 5e3;
|
|
18914
|
-
async function request(
|
|
18915
|
-
return fetch(`${BASE_URL}${
|
|
18927
|
+
async function request(path16, options = {}) {
|
|
18928
|
+
return fetch(`${BASE_URL}${path16}`, {
|
|
18916
18929
|
...options,
|
|
18917
18930
|
headers: {
|
|
18918
18931
|
"Content-Type": "application/json",
|
|
@@ -19343,9 +19356,9 @@ function canonicalizeRepoUrl(input) {
|
|
|
19343
19356
|
function repoNameFromCanonical(canonical) {
|
|
19344
19357
|
return parseRepo(canonical)?.repo ?? "";
|
|
19345
19358
|
}
|
|
19346
|
-
function normalizeUpstreamPath(
|
|
19347
|
-
if (!
|
|
19348
|
-
return
|
|
19359
|
+
function normalizeUpstreamPath(path16) {
|
|
19360
|
+
if (!path16) return "";
|
|
19361
|
+
return path16.split("/").filter(Boolean).join("/");
|
|
19349
19362
|
}
|
|
19350
19363
|
|
|
19351
19364
|
// src/git.ts
|
|
@@ -19391,16 +19404,16 @@ function buildRepoLinkResource(canonical) {
|
|
|
19391
19404
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
19392
19405
|
import { homedir as homedir2 } from "node:os";
|
|
19393
19406
|
import { join as join2 } from "node:path";
|
|
19394
|
-
function readJson(
|
|
19407
|
+
function readJson(path16) {
|
|
19395
19408
|
try {
|
|
19396
|
-
if (!existsSync2(
|
|
19397
|
-
return JSON.parse(readFileSync2(
|
|
19409
|
+
if (!existsSync2(path16)) return null;
|
|
19410
|
+
return JSON.parse(readFileSync2(path16, "utf-8"));
|
|
19398
19411
|
} catch {
|
|
19399
19412
|
return null;
|
|
19400
19413
|
}
|
|
19401
19414
|
}
|
|
19402
|
-
function hooksFrom(
|
|
19403
|
-
const hooks = readJson(
|
|
19415
|
+
function hooksFrom(path16, source, out, seen) {
|
|
19416
|
+
const hooks = readJson(path16)?.hooks;
|
|
19404
19417
|
if (!hooks || typeof hooks !== "object") return;
|
|
19405
19418
|
for (const [event, config] of Object.entries(hooks)) {
|
|
19406
19419
|
const stableKey = `hooks:${source}:${event}`;
|
|
@@ -19549,16 +19562,16 @@ function buildMcpResource(name, group, pkg) {
|
|
|
19549
19562
|
pkg
|
|
19550
19563
|
};
|
|
19551
19564
|
}
|
|
19552
|
-
function readText(
|
|
19565
|
+
function readText(path16) {
|
|
19553
19566
|
try {
|
|
19554
|
-
if (!existsSync3(
|
|
19555
|
-
return readFileSync3(
|
|
19567
|
+
if (!existsSync3(path16)) return null;
|
|
19568
|
+
return readFileSync3(path16, "utf-8");
|
|
19556
19569
|
} catch {
|
|
19557
19570
|
return null;
|
|
19558
19571
|
}
|
|
19559
19572
|
}
|
|
19560
|
-
function readParsed(
|
|
19561
|
-
const raw = readText(
|
|
19573
|
+
function readParsed(path16, parse2) {
|
|
19574
|
+
const raw = readText(path16);
|
|
19562
19575
|
if (raw === null) return null;
|
|
19563
19576
|
try {
|
|
19564
19577
|
return parse2(raw);
|
|
@@ -19566,14 +19579,14 @@ function readParsed(path15, parse2) {
|
|
|
19566
19579
|
return null;
|
|
19567
19580
|
}
|
|
19568
19581
|
}
|
|
19569
|
-
function readJson2(
|
|
19570
|
-
return readParsed(
|
|
19582
|
+
function readJson2(path16) {
|
|
19583
|
+
return readParsed(path16, JSON.parse);
|
|
19571
19584
|
}
|
|
19572
|
-
function readYaml(
|
|
19573
|
-
return readParsed(
|
|
19585
|
+
function readYaml(path16) {
|
|
19586
|
+
return readParsed(path16, parseYaml);
|
|
19574
19587
|
}
|
|
19575
|
-
function readToml(
|
|
19576
|
-
return readParsed(
|
|
19588
|
+
function readToml(path16) {
|
|
19589
|
+
return readParsed(path16, parseToml);
|
|
19577
19590
|
}
|
|
19578
19591
|
function continueListToMap(file) {
|
|
19579
19592
|
if (!file?.mcpServers?.length) return void 0;
|
|
@@ -19712,8 +19725,8 @@ function resolveSource(entry, mpRepoUrl) {
|
|
|
19712
19725
|
const src = entry.source;
|
|
19713
19726
|
if (typeof src === "string") {
|
|
19714
19727
|
if (!mpRepoUrl) return null;
|
|
19715
|
-
const
|
|
19716
|
-
return { url: mpRepoUrl, path:
|
|
19728
|
+
const path16 = src.replace(/^\.\//, "").replace(/\/+$/, "");
|
|
19729
|
+
return { url: mpRepoUrl, path: path16 || void 0 };
|
|
19717
19730
|
}
|
|
19718
19731
|
if (src && typeof src === "object" && src.url) {
|
|
19719
19732
|
return { url: src.url, path: src.path, sha: src.sha };
|
|
@@ -19750,10 +19763,10 @@ function resolvePluginLinks(installed, marketplaces, manifests) {
|
|
|
19750
19763
|
}
|
|
19751
19764
|
return out;
|
|
19752
19765
|
}
|
|
19753
|
-
function readJson3(
|
|
19766
|
+
function readJson3(path16) {
|
|
19754
19767
|
try {
|
|
19755
|
-
if (!existsSync4(
|
|
19756
|
-
return JSON.parse(readFileSync4(
|
|
19768
|
+
if (!existsSync4(path16)) return null;
|
|
19769
|
+
return JSON.parse(readFileSync4(path16, "utf-8"));
|
|
19757
19770
|
} catch {
|
|
19758
19771
|
return null;
|
|
19759
19772
|
}
|
|
@@ -19842,8 +19855,8 @@ function loadGitignore(cwd) {
|
|
|
19842
19855
|
}
|
|
19843
19856
|
function readFileSafe(filePath) {
|
|
19844
19857
|
try {
|
|
19845
|
-
const
|
|
19846
|
-
if (
|
|
19858
|
+
const stat9 = statSync(filePath);
|
|
19859
|
+
if (stat9.size > MAX_FILE_SIZE) return null;
|
|
19847
19860
|
return readFileSync5(filePath, "utf-8");
|
|
19848
19861
|
} catch {
|
|
19849
19862
|
return null;
|
|
@@ -23589,6 +23602,7 @@ function createHarnessWorkflowReducer(harness, localSources = createWorkflowLoca
|
|
|
23589
23602
|
function createAggregate2() {
|
|
23590
23603
|
const workflowLocal = createWorkflowLocalSources();
|
|
23591
23604
|
return Object.assign(createAggregate(), {
|
|
23605
|
+
recordUuids: /* @__PURE__ */ new Set(),
|
|
23592
23606
|
workflow: createHarnessWorkflowReducer("claude-code", workflowLocal),
|
|
23593
23607
|
workflowLocal,
|
|
23594
23608
|
workflowSeenCalls: /* @__PURE__ */ new Set(),
|
|
@@ -23625,6 +23639,11 @@ function projectWorkspaceDirectory(raw) {
|
|
|
23625
23639
|
function ingestRecord(agg, raw, ctx) {
|
|
23626
23640
|
const rec = asObj(raw);
|
|
23627
23641
|
if (!rec) return;
|
|
23642
|
+
const uuid = asStr(rec.uuid);
|
|
23643
|
+
if (uuid) {
|
|
23644
|
+
if (agg.recordUuids.has(uuid)) return;
|
|
23645
|
+
agg.recordUuids.add(uuid);
|
|
23646
|
+
}
|
|
23628
23647
|
agg.records++;
|
|
23629
23648
|
const projectDir = projectWorkspaceDirectory(rec) ?? ctx.projectDir;
|
|
23630
23649
|
agg.projectDirs.add(projectDir);
|
|
@@ -24079,36 +24098,87 @@ function ingestTypedSkill(agg, rec, text) {
|
|
|
24079
24098
|
bumpTypedSkill(agg, base ? cleanName(base) : "(unnamed)");
|
|
24080
24099
|
}
|
|
24081
24100
|
|
|
24082
|
-
// src/harness/claude/
|
|
24083
|
-
import { createReadStream } from "node:fs";
|
|
24101
|
+
// src/harness/claude/roots.ts
|
|
24084
24102
|
import { readdir as readdir2, realpath, stat as stat2 } from "node:fs/promises";
|
|
24085
24103
|
import { homedir as homedir6 } from "node:os";
|
|
24086
24104
|
import path2 from "node:path";
|
|
24087
|
-
|
|
24088
|
-
|
|
24089
|
-
const
|
|
24090
|
-
|
|
24091
|
-
|
|
24105
|
+
async function discoverClaudeRoots() {
|
|
24106
|
+
const home = homedir6();
|
|
24107
|
+
const configHome = process.env.XDG_CONFIG_HOME || path2.join(home, ".config");
|
|
24108
|
+
const dataHome = process.env.XDG_DATA_HOME || path2.join(home, ".local", "share");
|
|
24109
|
+
let complete = true;
|
|
24110
|
+
const failed = (error) => {
|
|
24111
|
+
const code = error?.code;
|
|
24112
|
+
if (code === "ENOENT" || code === "ENOTDIR") return;
|
|
24113
|
+
complete = false;
|
|
24114
|
+
traceError("claude profile discovery", error, "warn");
|
|
24115
|
+
};
|
|
24116
|
+
const children = async (dir, prefix = "") => {
|
|
24117
|
+
try {
|
|
24118
|
+
return (await readdir2(dir, { withFileTypes: true })).filter(
|
|
24119
|
+
(entry) => entry.name.startsWith(prefix) && (entry.isDirectory() || entry.isSymbolicLink())
|
|
24120
|
+
).map((entry) => path2.join(dir, entry.name)).sort();
|
|
24121
|
+
} catch (error) {
|
|
24122
|
+
failed(error);
|
|
24123
|
+
return [];
|
|
24124
|
+
}
|
|
24125
|
+
};
|
|
24126
|
+
const configured = (process.env.CLAUDE_CONFIG_DIR ?? "").split(",").map((s) => s.trim()).filter(Boolean).map(
|
|
24127
|
+
(dir) => path2.resolve(dir.startsWith("~/") ? path2.join(home, dir.slice(2)) : dir)
|
|
24128
|
+
);
|
|
24129
|
+
const profiles = /* @__PURE__ */ new Set([
|
|
24130
|
+
path2.join(home, ".claude"),
|
|
24131
|
+
path2.join(configHome, "claude"),
|
|
24132
|
+
...configured,
|
|
24133
|
+
...await children(home, ".claude"),
|
|
24134
|
+
...await children(configHome, "claude")
|
|
24135
|
+
]);
|
|
24136
|
+
for (const profile of [...profiles]) {
|
|
24137
|
+
for (const collection of ["profiles", "accounts"]) {
|
|
24138
|
+
for (const child of await children(path2.join(profile, collection)))
|
|
24139
|
+
profiles.add(child);
|
|
24140
|
+
}
|
|
24141
|
+
}
|
|
24142
|
+
for (const manager of [
|
|
24143
|
+
path2.join(home, ".claude-swap-backup"),
|
|
24144
|
+
path2.join(dataHome, "claude-swap")
|
|
24145
|
+
]) {
|
|
24146
|
+
for (const collection of [manager, path2.join(manager, "sessions")]) {
|
|
24147
|
+
for (const child of await children(collection)) profiles.add(child);
|
|
24148
|
+
}
|
|
24149
|
+
}
|
|
24150
|
+
const roots = /* @__PURE__ */ new Set();
|
|
24151
|
+
for (const profile of profiles) {
|
|
24152
|
+
const projects = path2.join(profile, "projects");
|
|
24153
|
+
try {
|
|
24154
|
+
if ((await stat2(projects)).isDirectory())
|
|
24155
|
+
roots.add(await realpath(projects));
|
|
24156
|
+
} catch (error) {
|
|
24157
|
+
failed(error);
|
|
24158
|
+
}
|
|
24092
24159
|
}
|
|
24093
|
-
|
|
24094
|
-
const xdg = process.env.XDG_CONFIG_HOME ?? path2.join(homedir6(), ".config");
|
|
24095
|
-
roots.push(path2.join(xdg, "claude", "projects"));
|
|
24096
|
-
return roots;
|
|
24160
|
+
return { roots: [...roots], complete };
|
|
24097
24161
|
}
|
|
24162
|
+
|
|
24163
|
+
// src/harness/claude/scan.ts
|
|
24164
|
+
import { createReadStream } from "node:fs";
|
|
24165
|
+
import { readdir as readdir3, realpath as realpath2, stat as stat3 } from "node:fs/promises";
|
|
24166
|
+
import path3 from "node:path";
|
|
24167
|
+
import readline from "node:readline";
|
|
24098
24168
|
function isTranscriptFile(basename5) {
|
|
24099
24169
|
return basename5.endsWith(".jsonl");
|
|
24100
24170
|
}
|
|
24101
24171
|
async function* walkJsonl(dir) {
|
|
24102
24172
|
let entries;
|
|
24103
24173
|
try {
|
|
24104
|
-
entries = await
|
|
24174
|
+
entries = await readdir3(dir, { withFileTypes: true });
|
|
24105
24175
|
} catch (error) {
|
|
24106
24176
|
if (error?.code !== "ENOENT")
|
|
24107
24177
|
traceError("claude transcript discovery", error, "warn");
|
|
24108
24178
|
return;
|
|
24109
24179
|
}
|
|
24110
24180
|
for (const e of entries) {
|
|
24111
|
-
const full =
|
|
24181
|
+
const full = path3.join(dir, e.name);
|
|
24112
24182
|
if (e.isDirectory()) yield* walkJsonl(full);
|
|
24113
24183
|
else if (e.isFile() && isTranscriptFile(e.name)) yield full;
|
|
24114
24184
|
}
|
|
@@ -24117,13 +24187,15 @@ async function scan(agg, opts = {}) {
|
|
|
24117
24187
|
const stats = emptyScanStats();
|
|
24118
24188
|
const visited = /* @__PURE__ */ new Set();
|
|
24119
24189
|
const projectWorkspaces = /* @__PURE__ */ new Map();
|
|
24120
|
-
|
|
24190
|
+
const discovery = opts.roots ? { roots: opts.roots, complete: true } : await discoverClaudeRoots();
|
|
24191
|
+
stats.sourceDiscoveryComplete = discovery.complete;
|
|
24192
|
+
for (const root of discovery.roots) {
|
|
24121
24193
|
if (!await exists(root)) continue;
|
|
24122
24194
|
for await (const file of walkJsonl(root)) {
|
|
24123
24195
|
stats.filesFound++;
|
|
24124
24196
|
let resolved;
|
|
24125
24197
|
try {
|
|
24126
|
-
resolved = await
|
|
24198
|
+
resolved = await realpath2(file);
|
|
24127
24199
|
} catch (error) {
|
|
24128
24200
|
if (error?.code !== "ENOENT")
|
|
24129
24201
|
traceError("claude transcript path resolution", error, "warn");
|
|
@@ -24136,7 +24208,7 @@ async function scan(agg, opts = {}) {
|
|
|
24136
24208
|
visited.add(resolved);
|
|
24137
24209
|
if (opts.sinceMs !== void 0) {
|
|
24138
24210
|
try {
|
|
24139
|
-
const st = await
|
|
24211
|
+
const st = await stat3(file);
|
|
24140
24212
|
if (st.mtimeMs < opts.sinceMs) {
|
|
24141
24213
|
stats.filesSkippedByMtime++;
|
|
24142
24214
|
continue;
|
|
@@ -24146,8 +24218,8 @@ async function scan(agg, opts = {}) {
|
|
|
24146
24218
|
traceError("claude transcript stat", error, "warn");
|
|
24147
24219
|
}
|
|
24148
24220
|
}
|
|
24149
|
-
const rel =
|
|
24150
|
-
const projectDir = rel.split(
|
|
24221
|
+
const rel = path3.relative(root, file);
|
|
24222
|
+
const projectDir = rel.split(path3.sep)[0] ?? "(root)";
|
|
24151
24223
|
agg.files++;
|
|
24152
24224
|
stats.filesRead++;
|
|
24153
24225
|
if (opts.onProgress && agg.files % 20 === 0) opts.onProgress(agg.files);
|
|
@@ -24170,7 +24242,7 @@ async function scan(agg, opts = {}) {
|
|
|
24170
24242
|
}
|
|
24171
24243
|
async function exists(p8) {
|
|
24172
24244
|
try {
|
|
24173
|
-
await
|
|
24245
|
+
await stat3(p8);
|
|
24174
24246
|
return true;
|
|
24175
24247
|
} catch (error) {
|
|
24176
24248
|
if (error?.code !== "ENOENT")
|
|
@@ -24219,11 +24291,9 @@ var claudeAdapter = {
|
|
|
24219
24291
|
name: CLAUDE_HARNESS_NAME,
|
|
24220
24292
|
builtinTools: BUILTIN_TOOLS,
|
|
24221
24293
|
async detect(opts) {
|
|
24222
|
-
|
|
24223
|
-
|
|
24224
|
-
|
|
24225
|
-
opts.sinceMs
|
|
24226
|
-
);
|
|
24294
|
+
const discovery = opts.roots ? { roots: opts.roots, complete: true } : await discoverClaudeRoots();
|
|
24295
|
+
if (!discovery.complete) return true;
|
|
24296
|
+
return hasRecentFile(discovery.roots, isTranscriptFile, opts.sinceMs);
|
|
24227
24297
|
},
|
|
24228
24298
|
async scan(opts) {
|
|
24229
24299
|
const aggregate = createAggregate2();
|
|
@@ -24234,6 +24304,7 @@ var claudeAdapter = {
|
|
|
24234
24304
|
return {
|
|
24235
24305
|
aggregate,
|
|
24236
24306
|
stats,
|
|
24307
|
+
scanComplete: stats.sourceDiscoveryComplete !== false,
|
|
24237
24308
|
workflow: aggregate.workflow.finish(),
|
|
24238
24309
|
workflowLocal: aggregate.workflowLocal
|
|
24239
24310
|
};
|
|
@@ -24570,17 +24641,17 @@ function noteConfiguredMcpServers(agg, serverNames) {
|
|
|
24570
24641
|
|
|
24571
24642
|
// src/harness/codex/scan.ts
|
|
24572
24643
|
import { readFileSync as readFileSync6 } from "node:fs";
|
|
24573
|
-
import { open, readdir as
|
|
24644
|
+
import { open, readdir as readdir4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
24574
24645
|
import { homedir as homedir7 } from "node:os";
|
|
24575
|
-
import
|
|
24646
|
+
import path4 from "node:path";
|
|
24576
24647
|
import { Readable } from "node:stream";
|
|
24577
24648
|
import * as zlib from "node:zlib";
|
|
24578
24649
|
import { parse as parseToml2 } from "smol-toml";
|
|
24579
24650
|
function codexHome() {
|
|
24580
|
-
return process.env.CODEX_HOME ||
|
|
24651
|
+
return process.env.CODEX_HOME || path4.join(homedir7(), ".codex");
|
|
24581
24652
|
}
|
|
24582
24653
|
function rolloutRoots() {
|
|
24583
|
-
return [
|
|
24654
|
+
return [path4.join(codexHome(), "sessions")];
|
|
24584
24655
|
}
|
|
24585
24656
|
var ROLLOUT_RE = /^rollout-.*\.jsonl(\.zst)?$/;
|
|
24586
24657
|
function isRolloutFile(basename5) {
|
|
@@ -24589,14 +24660,14 @@ function isRolloutFile(basename5) {
|
|
|
24589
24660
|
async function* walkRollouts(dir) {
|
|
24590
24661
|
let entries;
|
|
24591
24662
|
try {
|
|
24592
|
-
entries = await
|
|
24663
|
+
entries = await readdir4(dir, { withFileTypes: true });
|
|
24593
24664
|
} catch (error) {
|
|
24594
24665
|
if (error?.code !== "ENOENT")
|
|
24595
24666
|
traceError("codex rollout discovery", error, "warn");
|
|
24596
24667
|
return;
|
|
24597
24668
|
}
|
|
24598
24669
|
for (const e of entries) {
|
|
24599
|
-
const full =
|
|
24670
|
+
const full = path4.join(dir, e.name);
|
|
24600
24671
|
if (e.isDirectory()) yield* walkRollouts(full);
|
|
24601
24672
|
else if (e.isFile() && isRolloutFile(e.name)) yield full;
|
|
24602
24673
|
}
|
|
@@ -24621,7 +24692,7 @@ async function scanWindows(windows, opts = {}) {
|
|
|
24621
24692
|
for (const { stats } of targets) stats.filesFound++;
|
|
24622
24693
|
let resolved;
|
|
24623
24694
|
try {
|
|
24624
|
-
resolved = await
|
|
24695
|
+
resolved = await realpath3(file);
|
|
24625
24696
|
} catch (error) {
|
|
24626
24697
|
if (error?.code !== "ENOENT")
|
|
24627
24698
|
traceError("codex rollout path resolution", error, "warn");
|
|
@@ -24636,7 +24707,7 @@ async function scanWindows(windows, opts = {}) {
|
|
|
24636
24707
|
let mtimeMs;
|
|
24637
24708
|
if (targets.some((target) => target.sinceMs !== void 0)) {
|
|
24638
24709
|
try {
|
|
24639
|
-
mtimeMs = (await
|
|
24710
|
+
mtimeMs = (await stat4(file)).mtimeMs;
|
|
24640
24711
|
} catch (error) {
|
|
24641
24712
|
if (error?.code !== "ENOENT")
|
|
24642
24713
|
traceError("codex rollout stat", error, "warn");
|
|
@@ -24663,7 +24734,7 @@ async function scanWindows(windows, opts = {}) {
|
|
|
24663
24734
|
if (outcome.reason === "zstd-unsupported")
|
|
24664
24735
|
stats.filesZstdUnsupported++;
|
|
24665
24736
|
stats.unreadableFiles.push({
|
|
24666
|
-
path:
|
|
24737
|
+
path: path4.relative(root, file),
|
|
24667
24738
|
reason: outcome.reason
|
|
24668
24739
|
});
|
|
24669
24740
|
} else if (!outcome.genuine) {
|
|
@@ -24683,7 +24754,7 @@ async function scanWindows(windows, opts = {}) {
|
|
|
24683
24754
|
}
|
|
24684
24755
|
async function exists2(p8) {
|
|
24685
24756
|
try {
|
|
24686
|
-
await
|
|
24757
|
+
await stat4(p8);
|
|
24687
24758
|
return true;
|
|
24688
24759
|
} catch (error) {
|
|
24689
24760
|
if (error?.code !== "ENOENT")
|
|
@@ -24855,7 +24926,7 @@ async function classifyRollout(records) {
|
|
|
24855
24926
|
return { genuine: false, originator: originator ?? "(none)" };
|
|
24856
24927
|
}
|
|
24857
24928
|
function readConfiguredMcpServers(agg, configFile) {
|
|
24858
|
-
const file = configFile ??
|
|
24929
|
+
const file = configFile ?? path4.join(codexHome(), "config.toml");
|
|
24859
24930
|
let names = [];
|
|
24860
24931
|
try {
|
|
24861
24932
|
const parsed = parseToml2(readFileSync6(file, "utf8"));
|
|
@@ -24932,7 +25003,7 @@ var codexAdapter = {
|
|
|
24932
25003
|
// src/harness/cursor/cache.ts
|
|
24933
25004
|
import { mkdir as mkdir2, readFile as readFile2, rename as rename2, writeFile as writeFile2 } from "node:fs/promises";
|
|
24934
25005
|
import { homedir as homedir12 } from "node:os";
|
|
24935
|
-
import
|
|
25006
|
+
import path7 from "node:path";
|
|
24936
25007
|
|
|
24937
25008
|
// src/harness/cursor/account.ts
|
|
24938
25009
|
import { createHash as createHash6 } from "node:crypto";
|
|
@@ -25145,9 +25216,9 @@ function reconcile(local, api) {
|
|
|
25145
25216
|
|
|
25146
25217
|
// src/harness/cursor/local.ts
|
|
25147
25218
|
import { existsSync as existsSync10 } from "node:fs";
|
|
25148
|
-
import { stat as
|
|
25219
|
+
import { stat as stat5 } from "node:fs/promises";
|
|
25149
25220
|
import { homedir as homedir11 } from "node:os";
|
|
25150
|
-
import
|
|
25221
|
+
import path6 from "node:path";
|
|
25151
25222
|
import { Worker } from "node:worker_threads";
|
|
25152
25223
|
|
|
25153
25224
|
// src/harness/cursor/composer.ts
|
|
@@ -25352,11 +25423,11 @@ function hasComposerHalf(summary) {
|
|
|
25352
25423
|
// src/harness/cursor/sessionCache.ts
|
|
25353
25424
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
25354
25425
|
import { homedir as homedir8 } from "node:os";
|
|
25355
|
-
import
|
|
25426
|
+
import path5 from "node:path";
|
|
25356
25427
|
import { gunzipSync, gzipSync } from "node:zlib";
|
|
25357
25428
|
var SESSION_CACHE_FORMAT = 1;
|
|
25358
|
-
var defaultSessionCacheDir = () =>
|
|
25359
|
-
var sessionCacheFile = (dir, root, store) =>
|
|
25429
|
+
var defaultSessionCacheDir = () => path5.join(homedir8(), ".config", "aistack", "cursor");
|
|
25430
|
+
var sessionCacheFile = (dir, root, store) => path5.join(dir, `${digest(`${root}\0${store}`)}.sessions.json.gz`);
|
|
25360
25431
|
function sessionStamp(summary, newest) {
|
|
25361
25432
|
if (newest === null) return null;
|
|
25362
25433
|
const count2 = summary.messageCount;
|
|
@@ -25416,7 +25487,7 @@ async function loadSessionCache(file) {
|
|
|
25416
25487
|
return out;
|
|
25417
25488
|
}
|
|
25418
25489
|
async function saveSessionCache(file, cache) {
|
|
25419
|
-
await mkdir(
|
|
25490
|
+
await mkdir(path5.dirname(file), { recursive: true, mode: 448 });
|
|
25420
25491
|
const body = gzipSync(
|
|
25421
25492
|
JSON.stringify({
|
|
25422
25493
|
format: SESSION_CACHE_FORMAT,
|
|
@@ -25430,15 +25501,15 @@ async function saveSessionCache(file, cache) {
|
|
|
25430
25501
|
|
|
25431
25502
|
// src/harness/cursor/local.ts
|
|
25432
25503
|
function dataPath(env = process.env, home = homedir11(), platform4 = process.platform) {
|
|
25433
|
-
if (env.CURSOR_DATA_PATH) return
|
|
25434
|
-
const base = platform4 === "darwin" ?
|
|
25435
|
-
return
|
|
25504
|
+
if (env.CURSOR_DATA_PATH) return path6.resolve(env.CURSOR_DATA_PATH);
|
|
25505
|
+
const base = platform4 === "darwin" ? path6.join(home, "Library", "Application Support") : platform4 === "win32" ? env.APPDATA || path6.join(home, "AppData", "Roaming") : env.XDG_CONFIG_HOME || path6.join(home, ".config");
|
|
25506
|
+
return path6.join(base, "Cursor", "User", "workspaceStorage");
|
|
25436
25507
|
}
|
|
25437
|
-
var storeRoot = () => process.env.CURSOR_STORE_ROOT ||
|
|
25438
|
-
var globalDb = (root) =>
|
|
25508
|
+
var storeRoot = () => process.env.CURSOR_STORE_ROOT || path6.join(homedir11(), ".cursor");
|
|
25509
|
+
var globalDb = (root) => path6.join(path6.dirname(root), "globalStorage", "state.vscdb");
|
|
25439
25510
|
async function exists3(file) {
|
|
25440
25511
|
try {
|
|
25441
|
-
await
|
|
25512
|
+
await stat5(file);
|
|
25442
25513
|
return true;
|
|
25443
25514
|
} catch (error) {
|
|
25444
25515
|
return error.code !== "ENOENT";
|
|
@@ -25449,9 +25520,9 @@ async function hasLocalSource(root = dataPath()) {
|
|
|
25449
25520
|
[
|
|
25450
25521
|
root,
|
|
25451
25522
|
globalDb(root),
|
|
25452
|
-
|
|
25453
|
-
|
|
25454
|
-
|
|
25523
|
+
path6.join(storeRoot(), "projects"),
|
|
25524
|
+
path6.join(storeRoot(), "chats"),
|
|
25525
|
+
path6.join(storeRoot(), "acp-sessions")
|
|
25455
25526
|
].map(exists3)
|
|
25456
25527
|
)).some(Boolean);
|
|
25457
25528
|
}
|
|
@@ -25523,7 +25594,7 @@ async function sourceStamp(root) {
|
|
|
25523
25594
|
const values = await Promise.all(
|
|
25524
25595
|
[globalDb(root), `${globalDb(root)}-wal`].map(async (file) => {
|
|
25525
25596
|
try {
|
|
25526
|
-
const info = await
|
|
25597
|
+
const info = await stat5(file);
|
|
25527
25598
|
return `${info.size}:${info.mtimeMs}`;
|
|
25528
25599
|
} catch {
|
|
25529
25600
|
return "unavailable";
|
|
@@ -25912,7 +25983,7 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits, stallMs
|
|
|
25912
25983
|
}
|
|
25913
25984
|
async function globalDbSize(root) {
|
|
25914
25985
|
try {
|
|
25915
|
-
const info = await
|
|
25986
|
+
const info = await stat5(globalDb(root));
|
|
25916
25987
|
return `${(info.size / 1048576).toFixed(0)} MB`;
|
|
25917
25988
|
} catch {
|
|
25918
25989
|
return "absent";
|
|
@@ -26113,7 +26184,7 @@ var emptyCache = () => ({
|
|
|
26113
26184
|
local: [],
|
|
26114
26185
|
sessions: []
|
|
26115
26186
|
});
|
|
26116
|
-
var cacheFile = (root, store) =>
|
|
26187
|
+
var cacheFile = (root, store) => path7.join(
|
|
26117
26188
|
homedir12(),
|
|
26118
26189
|
".config",
|
|
26119
26190
|
"aistack",
|
|
@@ -26153,7 +26224,7 @@ async function loadCache(file) {
|
|
|
26153
26224
|
}
|
|
26154
26225
|
}
|
|
26155
26226
|
async function saveCache(file, value) {
|
|
26156
|
-
await mkdir2(
|
|
26227
|
+
await mkdir2(path7.dirname(file), { recursive: true, mode: 448 });
|
|
26157
26228
|
const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
26158
26229
|
await writeFile2(temporary, JSON.stringify(value), { mode: 384 });
|
|
26159
26230
|
await rename2(temporary, file);
|
|
@@ -26209,10 +26280,10 @@ function cachedEvents(cache, sessionIds) {
|
|
|
26209
26280
|
}
|
|
26210
26281
|
|
|
26211
26282
|
// src/harness/cursor/scan.ts
|
|
26212
|
-
import
|
|
26283
|
+
import path9 from "node:path";
|
|
26213
26284
|
|
|
26214
26285
|
// src/harness/cursor/workflow.ts
|
|
26215
|
-
import
|
|
26286
|
+
import path8 from "node:path";
|
|
26216
26287
|
var TOOLS = {
|
|
26217
26288
|
read_file: "Read",
|
|
26218
26289
|
read_file_v2: "Read",
|
|
@@ -26253,7 +26324,7 @@ function projectHistory(options) {
|
|
|
26253
26324
|
const scopes = /* @__PURE__ */ new Map();
|
|
26254
26325
|
const inWindow = (t) => t !== null && t >= sinceMs && t <= now;
|
|
26255
26326
|
for (const { session } of locals) {
|
|
26256
|
-
const projectWorkspace = session.canonicalWorkspacePath &&
|
|
26327
|
+
const projectWorkspace = session.canonicalWorkspacePath && path8.isAbsolute(session.canonicalWorkspacePath) ? session.canonicalWorkspacePath : void 0;
|
|
26257
26328
|
const times = messageTimes(session, api);
|
|
26258
26329
|
const scopeOf = (message) => {
|
|
26259
26330
|
const parent = message.parentMessageId && nativeOwners.get(message.parentMessageId);
|
|
@@ -26340,7 +26411,7 @@ function projectHistory(options) {
|
|
|
26340
26411
|
session: row.sidechain ? `${row.session}:sidechain` : row.session,
|
|
26341
26412
|
sidechain: row.sidechain
|
|
26342
26413
|
},
|
|
26343
|
-
...project &&
|
|
26414
|
+
...project && path8.isAbsolute(project) ? { projectWorkspace: project } : {},
|
|
26344
26415
|
type: "response",
|
|
26345
26416
|
tsMs: row.tsMs,
|
|
26346
26417
|
responseId: `${row.source}:${row.id ?? index}`,
|
|
@@ -26439,7 +26510,7 @@ async function scan3(options) {
|
|
|
26439
26510
|
aggregate.byModel.set(model, emptyUsage());
|
|
26440
26511
|
}
|
|
26441
26512
|
const project = session.canonicalWorkspacePath;
|
|
26442
|
-
if (project &&
|
|
26513
|
+
if (project && path9.isAbsolute(project)) aggregate.projectDirs.add(project);
|
|
26443
26514
|
if (session.metadata?.cursorVersion)
|
|
26444
26515
|
aggregate.ccVersions.add(session.metadata.cursorVersion);
|
|
26445
26516
|
let firstTime = null;
|
|
@@ -26496,7 +26567,7 @@ async function scan3(options) {
|
|
|
26496
26567
|
else aggregate.mainTokens += countsTotal(counts2);
|
|
26497
26568
|
noteSessionStart(aggregate, session, tsMs);
|
|
26498
26569
|
const project = sessions.get(session)?.session.canonicalWorkspacePath;
|
|
26499
|
-
if (project &&
|
|
26570
|
+
if (project && path9.isAbsolute(project))
|
|
26500
26571
|
noteProjectDay(aggregate, project, tsMs);
|
|
26501
26572
|
}
|
|
26502
26573
|
aggregate.files = local.stats.filesRead;
|
|
@@ -26781,17 +26852,17 @@ function ingestContribution(agg, row) {
|
|
|
26781
26852
|
|
|
26782
26853
|
// src/harness/grok/scan.ts
|
|
26783
26854
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
26784
|
-
import { readdir as
|
|
26855
|
+
import { readdir as readdir6, readFile as readFile4, stat as stat6 } from "node:fs/promises";
|
|
26785
26856
|
import { homedir as homedir14 } from "node:os";
|
|
26786
|
-
import
|
|
26857
|
+
import path11 from "node:path";
|
|
26787
26858
|
import readline2 from "node:readline";
|
|
26788
26859
|
import { parse as parseToml3 } from "smol-toml";
|
|
26789
26860
|
|
|
26790
26861
|
// src/harness/grok/context.ts
|
|
26791
26862
|
import { createHash as createHash7 } from "node:crypto";
|
|
26792
|
-
import { appendFile, mkdir as mkdir3, readdir as
|
|
26863
|
+
import { appendFile, mkdir as mkdir3, readdir as readdir5, readFile as readFile3, unlink as unlink2 } from "node:fs/promises";
|
|
26793
26864
|
import { homedir as homedir13 } from "node:os";
|
|
26794
|
-
import
|
|
26865
|
+
import path10 from "node:path";
|
|
26795
26866
|
var DAY_MS = 864e5;
|
|
26796
26867
|
var hash = (value) => createHash7("sha256").update(value).digest("hex");
|
|
26797
26868
|
function contextCall(value) {
|
|
@@ -26814,12 +26885,12 @@ function contextCall(value) {
|
|
|
26814
26885
|
};
|
|
26815
26886
|
}
|
|
26816
26887
|
function contextCacheDirectory(root) {
|
|
26817
|
-
return
|
|
26888
|
+
return path10.join(
|
|
26818
26889
|
homedir13(),
|
|
26819
26890
|
".config",
|
|
26820
26891
|
"aistack",
|
|
26821
26892
|
"grok-context",
|
|
26822
|
-
hash(
|
|
26893
|
+
hash(path10.resolve(root))
|
|
26823
26894
|
);
|
|
26824
26895
|
}
|
|
26825
26896
|
async function optionalRead(file) {
|
|
@@ -26835,21 +26906,21 @@ async function retainedContextCalls(root, sessions, cacheDir = contextCacheDirec
|
|
|
26835
26906
|
const calls = /* @__PURE__ */ new Map();
|
|
26836
26907
|
let files = [];
|
|
26837
26908
|
try {
|
|
26838
|
-
files = await
|
|
26909
|
+
files = await readdir5(cacheDir);
|
|
26839
26910
|
} catch (error) {
|
|
26840
26911
|
if (error.code !== "ENOENT") throw error;
|
|
26841
26912
|
}
|
|
26842
26913
|
for (const file of files) {
|
|
26843
26914
|
if (!/^\d{4}-\d{2}-\d{2}\.jsonl$/.test(file)) continue;
|
|
26844
26915
|
if (Date.parse(file.slice(0, 10)) + DAY_MS < cutoff) {
|
|
26845
|
-
await unlink2(
|
|
26916
|
+
await unlink2(path10.join(cacheDir, file)).catch(
|
|
26846
26917
|
(error) => {
|
|
26847
26918
|
if (error.code !== "ENOENT") throw error;
|
|
26848
26919
|
}
|
|
26849
26920
|
);
|
|
26850
26921
|
continue;
|
|
26851
26922
|
}
|
|
26852
|
-
const raw2 = await optionalRead(
|
|
26923
|
+
const raw2 = await optionalRead(path10.join(cacheDir, file));
|
|
26853
26924
|
if (raw2 && !raw2.endsWith("\n"))
|
|
26854
26925
|
throw Object.assign(new Error("Incomplete Grok context cache"), {
|
|
26855
26926
|
code: "GROK_INCOMPLETE_CONTEXT_CACHE"
|
|
@@ -26870,7 +26941,7 @@ async function retainedContextCalls(root, sessions, cacheDir = contextCacheDirec
|
|
|
26870
26941
|
}
|
|
26871
26942
|
}
|
|
26872
26943
|
const raw = await optionalRead(
|
|
26873
|
-
|
|
26944
|
+
path10.join(root, "..", "logs", "unified.jsonl")
|
|
26874
26945
|
);
|
|
26875
26946
|
const additions = /* @__PURE__ */ new Map();
|
|
26876
26947
|
for (const line of raw.slice(0, raw.lastIndexOf("\n") + 1).split("\n")) {
|
|
@@ -26893,7 +26964,7 @@ async function retainedContextCalls(root, sessions, cacheDir = contextCacheDirec
|
|
|
26893
26964
|
await mkdir3(cacheDir, { recursive: true, mode: 448 });
|
|
26894
26965
|
for (const [date, lines2] of additions) {
|
|
26895
26966
|
await appendFile(
|
|
26896
|
-
|
|
26967
|
+
path10.join(cacheDir, `${date}.jsonl`),
|
|
26897
26968
|
`${lines2.join("\n")}
|
|
26898
26969
|
`,
|
|
26899
26970
|
{ mode: 384 }
|
|
@@ -26906,8 +26977,8 @@ async function retainedContextCalls(root, sessions, cacheDir = contextCacheDirec
|
|
|
26906
26977
|
// src/harness/grok/scan.ts
|
|
26907
26978
|
function sessionRoots() {
|
|
26908
26979
|
return [
|
|
26909
|
-
|
|
26910
|
-
process.env.GROK_HOME ||
|
|
26980
|
+
path11.join(
|
|
26981
|
+
process.env.GROK_HOME || path11.join(homedir14(), ".grok"),
|
|
26911
26982
|
"sessions"
|
|
26912
26983
|
)
|
|
26913
26984
|
];
|
|
@@ -26919,7 +26990,7 @@ async function stableRead(file, jsonl) {
|
|
|
26919
26990
|
for (const delay of delays) {
|
|
26920
26991
|
if (delay) await pause(delay);
|
|
26921
26992
|
try {
|
|
26922
|
-
const before = await
|
|
26993
|
+
const before = await stat6(file);
|
|
26923
26994
|
if (!before.isFile()) return { complete: false };
|
|
26924
26995
|
if (jsonl) {
|
|
26925
26996
|
const lines2 = [];
|
|
@@ -26937,12 +27008,12 @@ async function stableRead(file, jsonl) {
|
|
|
26937
27008
|
lines2.push(null);
|
|
26938
27009
|
}
|
|
26939
27010
|
}
|
|
26940
|
-
const after = await
|
|
27011
|
+
const after = await stat6(file);
|
|
26941
27012
|
if (before.size === after.size && before.mtimeMs === after.mtimeMs)
|
|
26942
27013
|
return { lines: lines2, complete: true };
|
|
26943
27014
|
} else {
|
|
26944
27015
|
const raw = await readFile4(file, "utf8");
|
|
26945
|
-
const after = await
|
|
27016
|
+
const after = await stat6(file);
|
|
26946
27017
|
if (before.size === after.size && before.mtimeMs === after.mtimeMs)
|
|
26947
27018
|
return { json: JSON.parse(raw), complete: true };
|
|
26948
27019
|
}
|
|
@@ -26955,16 +27026,16 @@ async function stableRead(file, jsonl) {
|
|
|
26955
27026
|
}
|
|
26956
27027
|
async function directories(root) {
|
|
26957
27028
|
try {
|
|
26958
|
-
const workspaces = await
|
|
27029
|
+
const workspaces = await readdir6(root, { withFileTypes: true });
|
|
26959
27030
|
const out = [];
|
|
26960
27031
|
for (const workspace of workspaces) {
|
|
26961
27032
|
if (!workspace.isDirectory() || workspace.isSymbolicLink()) continue;
|
|
26962
|
-
const workspacePath =
|
|
26963
|
-
for (const session of await
|
|
27033
|
+
const workspacePath = path11.join(root, workspace.name);
|
|
27034
|
+
for (const session of await readdir6(workspacePath, {
|
|
26964
27035
|
withFileTypes: true
|
|
26965
27036
|
})) {
|
|
26966
27037
|
if (session.isDirectory() && !session.isSymbolicLink())
|
|
26967
|
-
out.push(
|
|
27038
|
+
out.push(path11.join(workspacePath, session.name));
|
|
26968
27039
|
}
|
|
26969
27040
|
}
|
|
26970
27041
|
return out.sort();
|
|
@@ -26978,7 +27049,7 @@ async function modelAliasesForRoot(root) {
|
|
|
26978
27049
|
if (process.env.GROK_MODELS_BASE_URL) return /* @__PURE__ */ new Map();
|
|
26979
27050
|
try {
|
|
26980
27051
|
const parsed = asObj(
|
|
26981
|
-
parseToml3(await readFile4(
|
|
27052
|
+
parseToml3(await readFile4(path11.join(root, "..", "config.toml"), "utf8"))
|
|
26982
27053
|
);
|
|
26983
27054
|
if (!parsed || asObj(parsed.endpoints)?.models_base_url) return /* @__PURE__ */ new Map();
|
|
26984
27055
|
const models = asObj(parsed.model);
|
|
@@ -27019,7 +27090,7 @@ async function scanWindows2(windows, opts = {}) {
|
|
|
27019
27090
|
for (const dir of dirs) {
|
|
27020
27091
|
let entries;
|
|
27021
27092
|
try {
|
|
27022
|
-
entries = await
|
|
27093
|
+
entries = await readdir6(dir, { withFileTypes: true });
|
|
27023
27094
|
} catch (error) {
|
|
27024
27095
|
traceError("grok session listing", error);
|
|
27025
27096
|
complete = false;
|
|
@@ -27028,10 +27099,10 @@ async function scanWindows2(windows, opts = {}) {
|
|
|
27028
27099
|
const files = new Map(
|
|
27029
27100
|
entries.filter(
|
|
27030
27101
|
(e) => e.isFile() && (isGrokEvidenceFile(e.name) || e.name === "summary.json")
|
|
27031
|
-
).map((e) => [e.name,
|
|
27102
|
+
).map((e) => [e.name, path11.join(dir, e.name)])
|
|
27032
27103
|
);
|
|
27033
27104
|
let projectDir = dir;
|
|
27034
|
-
let sessionFallback =
|
|
27105
|
+
let sessionFallback = path11.basename(dir);
|
|
27035
27106
|
let child = false;
|
|
27036
27107
|
let parentSession;
|
|
27037
27108
|
const summary = files.get("summary.json");
|
|
@@ -27432,14 +27503,14 @@ function ingestTypedSkill2(agg, row) {
|
|
|
27432
27503
|
|
|
27433
27504
|
// src/harness/opencode/scan.ts
|
|
27434
27505
|
import { readFileSync as readFileSync12 } from "node:fs";
|
|
27435
|
-
import { readdir as
|
|
27506
|
+
import { readdir as readdir7, stat as stat7 } from "node:fs/promises";
|
|
27436
27507
|
import { homedir as homedir15 } from "node:os";
|
|
27437
|
-
import
|
|
27508
|
+
import path12 from "node:path";
|
|
27438
27509
|
var OPENCODE_MIGRATION_CEILING = 20260622202450;
|
|
27439
27510
|
function opencodeDataDirs() {
|
|
27440
27511
|
const xdg = process.env.XDG_DATA_HOME;
|
|
27441
|
-
const base = xdg ||
|
|
27442
|
-
return [
|
|
27512
|
+
const base = xdg || path12.join(homedir15(), ".local", "share");
|
|
27513
|
+
return [path12.join(base, "opencode")];
|
|
27443
27514
|
}
|
|
27444
27515
|
function isStoreFile(basename5) {
|
|
27445
27516
|
return basename5 === "opencode.db" || /^opencode-[^/]+\.db$/.test(basename5);
|
|
@@ -27448,8 +27519,8 @@ async function dbFilesIn(root) {
|
|
|
27448
27519
|
const override = process.env.OPENCODE_DB;
|
|
27449
27520
|
if (override) return [override];
|
|
27450
27521
|
try {
|
|
27451
|
-
const entries = await
|
|
27452
|
-
return entries.filter((e) => e.isFile() && isStoreFile(e.name)).map((e) =>
|
|
27522
|
+
const entries = await readdir7(root, { withFileTypes: true });
|
|
27523
|
+
return entries.filter((e) => e.isFile() && isStoreFile(e.name)).map((e) => path12.join(root, e.name)).sort();
|
|
27453
27524
|
} catch (error) {
|
|
27454
27525
|
if (error?.code !== "ENOENT")
|
|
27455
27526
|
traceError("opencode database discovery", error, "warn");
|
|
@@ -27491,7 +27562,7 @@ async function scan5(agg, opts = {}) {
|
|
|
27491
27562
|
traceError("opencode database read", e);
|
|
27492
27563
|
stats.filesUnreadable++;
|
|
27493
27564
|
stats.unreadableFiles.push({
|
|
27494
|
-
path:
|
|
27565
|
+
path: path12.basename(file),
|
|
27495
27566
|
reason: errorClass2(e)
|
|
27496
27567
|
});
|
|
27497
27568
|
}
|
|
@@ -27678,8 +27749,8 @@ function pickTs(jsonTs, columnTs) {
|
|
|
27678
27749
|
}
|
|
27679
27750
|
function opencodeConfigFile() {
|
|
27680
27751
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
27681
|
-
const base = xdg ||
|
|
27682
|
-
return
|
|
27752
|
+
const base = xdg || path12.join(homedir15(), ".config");
|
|
27753
|
+
return path12.join(base, "opencode", "opencode.json");
|
|
27683
27754
|
}
|
|
27684
27755
|
function readConfiguredMcpServers2(agg, state, configFile) {
|
|
27685
27756
|
const file = configFile ?? opencodeConfigFile();
|
|
@@ -27758,7 +27829,7 @@ async function detectOpencode(opts) {
|
|
|
27758
27829
|
}
|
|
27759
27830
|
async function exists4(p8) {
|
|
27760
27831
|
try {
|
|
27761
|
-
await
|
|
27832
|
+
await stat7(p8);
|
|
27762
27833
|
return true;
|
|
27763
27834
|
} catch (error) {
|
|
27764
27835
|
if (error?.code !== "ENOENT")
|
|
@@ -27988,17 +28059,17 @@ function readCounts2(usageRaw) {
|
|
|
27988
28059
|
|
|
27989
28060
|
// src/harness/pi/scan.ts
|
|
27990
28061
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
27991
|
-
import { readdir as
|
|
28062
|
+
import { readdir as readdir8, realpath as realpath4, stat as stat8 } from "node:fs/promises";
|
|
27992
28063
|
import { homedir as homedir16 } from "node:os";
|
|
27993
|
-
import
|
|
28064
|
+
import path13 from "node:path";
|
|
27994
28065
|
import readline3 from "node:readline";
|
|
27995
28066
|
var MAX_SESSION_VERSION = 3;
|
|
27996
28067
|
function piAgentDir() {
|
|
27997
|
-
return process.env.PI_CODING_AGENT_DIR ||
|
|
28068
|
+
return process.env.PI_CODING_AGENT_DIR || path13.join(homedir16(), ".pi", "agent");
|
|
27998
28069
|
}
|
|
27999
28070
|
function sessionRoots2() {
|
|
28000
28071
|
const override = process.env.PI_CODING_AGENT_SESSION_DIR;
|
|
28001
|
-
return [override ||
|
|
28072
|
+
return [override || path13.join(piAgentDir(), "sessions")];
|
|
28002
28073
|
}
|
|
28003
28074
|
var SESSION_FILE_RE = /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.jsonl$/;
|
|
28004
28075
|
function isSessionFile(basename5) {
|
|
@@ -28007,14 +28078,14 @@ function isSessionFile(basename5) {
|
|
|
28007
28078
|
async function* walkSessions(dir) {
|
|
28008
28079
|
let entries;
|
|
28009
28080
|
try {
|
|
28010
|
-
entries = await
|
|
28081
|
+
entries = await readdir8(dir, { withFileTypes: true });
|
|
28011
28082
|
} catch (error) {
|
|
28012
28083
|
if (error?.code !== "ENOENT")
|
|
28013
28084
|
traceError("pi transcript discovery", error, "warn");
|
|
28014
28085
|
return;
|
|
28015
28086
|
}
|
|
28016
28087
|
for (const e of entries) {
|
|
28017
|
-
const full =
|
|
28088
|
+
const full = path13.join(dir, e.name);
|
|
28018
28089
|
if (e.isDirectory()) yield* walkSessions(full);
|
|
28019
28090
|
else if (e.isFile() && isSessionFile(e.name)) yield full;
|
|
28020
28091
|
}
|
|
@@ -28029,7 +28100,7 @@ async function scan6(agg, opts = {}) {
|
|
|
28029
28100
|
stats.filesFound++;
|
|
28030
28101
|
let resolved;
|
|
28031
28102
|
try {
|
|
28032
|
-
resolved = await
|
|
28103
|
+
resolved = await realpath4(file);
|
|
28033
28104
|
} catch (error) {
|
|
28034
28105
|
if (error?.code !== "ENOENT")
|
|
28035
28106
|
traceError("pi transcript path resolution", error, "warn");
|
|
@@ -28042,7 +28113,7 @@ async function scan6(agg, opts = {}) {
|
|
|
28042
28113
|
visited.add(resolved);
|
|
28043
28114
|
if (opts.sinceMs !== void 0) {
|
|
28044
28115
|
try {
|
|
28045
|
-
const st = await
|
|
28116
|
+
const st = await stat8(file);
|
|
28046
28117
|
if (st.mtimeMs < opts.sinceMs) {
|
|
28047
28118
|
stats.filesSkippedByMtime++;
|
|
28048
28119
|
continue;
|
|
@@ -28066,7 +28137,7 @@ async function scan6(agg, opts = {}) {
|
|
|
28066
28137
|
stats.filesUnreadable++;
|
|
28067
28138
|
stats.filesRead--;
|
|
28068
28139
|
stats.unreadableFiles.push({
|
|
28069
|
-
path:
|
|
28140
|
+
path: path13.relative(root, file),
|
|
28070
28141
|
reason: "version-too-new"
|
|
28071
28142
|
});
|
|
28072
28143
|
}
|
|
@@ -28075,7 +28146,7 @@ async function scan6(agg, opts = {}) {
|
|
|
28075
28146
|
stats.filesUnreadable++;
|
|
28076
28147
|
stats.filesRead--;
|
|
28077
28148
|
stats.unreadableFiles.push({
|
|
28078
|
-
path:
|
|
28149
|
+
path: path13.relative(root, file),
|
|
28079
28150
|
reason: "read-error"
|
|
28080
28151
|
});
|
|
28081
28152
|
}
|
|
@@ -28085,7 +28156,7 @@ async function scan6(agg, opts = {}) {
|
|
|
28085
28156
|
}
|
|
28086
28157
|
async function exists5(p8) {
|
|
28087
28158
|
try {
|
|
28088
|
-
await
|
|
28159
|
+
await stat8(p8);
|
|
28089
28160
|
return true;
|
|
28090
28161
|
} catch (error) {
|
|
28091
28162
|
if (error?.code !== "ENOENT")
|
|
@@ -29371,7 +29442,7 @@ function selectDaysToPublish(input) {
|
|
|
29371
29442
|
// src/workflow/git.ts
|
|
29372
29443
|
import { execFile, execFileSync as execFileSync2 } from "node:child_process";
|
|
29373
29444
|
import { existsSync as existsSync17 } from "node:fs";
|
|
29374
|
-
import
|
|
29445
|
+
import path14 from "node:path";
|
|
29375
29446
|
var TEST_FILE_RULE_VERSION = "test-files/v2";
|
|
29376
29447
|
var FILE_TYPE_RULE_VERSION = "file-types/v3";
|
|
29377
29448
|
var COMMIT_SET_RULE_VERSION = "commit-set/v1";
|
|
@@ -29788,9 +29859,9 @@ function reduceGitHistories(histories, options) {
|
|
|
29788
29859
|
if (included) seenCommits.add(hash2);
|
|
29789
29860
|
continue;
|
|
29790
29861
|
}
|
|
29791
|
-
const
|
|
29792
|
-
if (!
|
|
29793
|
-
let file =
|
|
29862
|
+
const stat9 = parseNumstat(field);
|
|
29863
|
+
if (!stat9) continue;
|
|
29864
|
+
let file = stat9.file;
|
|
29794
29865
|
if (file.length === 0) {
|
|
29795
29866
|
fieldIndex += 2;
|
|
29796
29867
|
file = fields[fieldIndex] ?? fields[fieldIndex - 1] ?? "";
|
|
@@ -29798,13 +29869,13 @@ function reduceGitHistories(histories, options) {
|
|
|
29798
29869
|
if (!current?.included) continue;
|
|
29799
29870
|
if (isUnauthoredPath(file)) continue;
|
|
29800
29871
|
current.authored = true;
|
|
29801
|
-
const fileChangedLines =
|
|
29802
|
-
current.additions +=
|
|
29803
|
-
current.removals +=
|
|
29872
|
+
const fileChangedLines = stat9.additions + stat9.removals;
|
|
29873
|
+
current.additions += stat9.additions;
|
|
29874
|
+
current.removals += stat9.removals;
|
|
29804
29875
|
current.changedLines += fileChangedLines;
|
|
29805
29876
|
if (isTestFile(file)) current.touchesTest = true;
|
|
29806
29877
|
if (fileChangedLines <= 0) continue;
|
|
29807
|
-
const extension =
|
|
29878
|
+
const extension = path14.extname(file).toLowerCase();
|
|
29808
29879
|
if (APPROVED_EXTENSIONS.has(extension)) {
|
|
29809
29880
|
current.extensionLines.set(
|
|
29810
29881
|
extension,
|
|
@@ -29911,8 +29982,8 @@ function buildWorkflowExtraction(harnessWorkflows, git, utcOffsetMinutes = machi
|
|
|
29911
29982
|
import { createHash as createHash9 } from "node:crypto";
|
|
29912
29983
|
import { existsSync as existsSync18, mkdirSync as mkdirSync8, readFileSync as readFileSync18, writeFileSync as writeFileSync8 } from "node:fs";
|
|
29913
29984
|
import { homedir as homedir22 } from "node:os";
|
|
29914
|
-
import
|
|
29915
|
-
var defaultFile =
|
|
29985
|
+
import path15 from "node:path";
|
|
29986
|
+
var defaultFile = path15.join(
|
|
29916
29987
|
homedir22(),
|
|
29917
29988
|
".config",
|
|
29918
29989
|
"aistack",
|
|
@@ -29936,7 +30007,7 @@ function loadGrokDateHints(scope, file = defaultFile) {
|
|
|
29936
30007
|
function saveGrokDateHints(scope, hints, file = defaultFile) {
|
|
29937
30008
|
const cache = read2(file);
|
|
29938
30009
|
cache[scope] = hints;
|
|
29939
|
-
mkdirSync8(
|
|
30010
|
+
mkdirSync8(path15.dirname(file), { recursive: true });
|
|
29940
30011
|
writeFileSync8(file, JSON.stringify(cache, null, 2));
|
|
29941
30012
|
}
|
|
29942
30013
|
function mapToHints(value, floor) {
|