@use-aistack/cli 0.16.7 → 0.16.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cursor-worker.js +272 -137
- package/dist/cursor-worker.js.map +1 -1
- package/dist/index.js +525 -219
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,10 +9,10 @@ var __export = (target, all) => {
|
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
12
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/types.js
|
|
13
13
|
var MESSAGE_TYPES;
|
|
14
14
|
var init_types = __esm({
|
|
15
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
15
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/types.js"() {
|
|
16
16
|
"use strict";
|
|
17
17
|
MESSAGE_TYPES = [
|
|
18
18
|
"user",
|
|
@@ -24,15 +24,15 @@ var init_types = __esm({
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
27
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/types.js
|
|
28
28
|
var init_types2 = __esm({
|
|
29
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
29
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/types.js"() {
|
|
30
30
|
"use strict";
|
|
31
31
|
init_types();
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
35
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/errors.js
|
|
36
36
|
function compareCodePoints(left, right) {
|
|
37
37
|
const leftPoints = Array.from(left, (value) => value.codePointAt(0));
|
|
38
38
|
const rightPoints = Array.from(right, (value) => value.codePointAt(0));
|
|
@@ -56,7 +56,7 @@ function isSessionIntegrityError(error) {
|
|
|
56
56
|
}
|
|
57
57
|
var SessionIntegrityError, WorkspaceAmbiguityError, SessionAmbiguityError, SessionScopeMismatchError, BackupWorkspaceScopeMetadataError, UnsupportedSessionMigrationError, MigrationTargetChangedError, DATABASE_CAPABILITY_ORDER, DatabaseCapabilityError, NoCapableDriverError, BackupPublishedPermissionError, BackupPublishedCleanupError, TemporaryArtifactCleanupError, RestoreRollbackError, ReadContextError, ReadContextSourceMismatchError, ReadContextScopeMismatchError, ReadContextOptionsMismatchError, ReadContextDisposedError, SourceEncodingError, SourceLimitExceededError, SourceLimitConfigurationError;
|
|
58
58
|
var init_errors = __esm({
|
|
59
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
59
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/errors.js"() {
|
|
60
60
|
"use strict";
|
|
61
61
|
SessionIntegrityError = class _SessionIntegrityError extends Error {
|
|
62
62
|
code;
|
|
@@ -324,10 +324,10 @@ var init_errors = __esm({
|
|
|
324
324
|
}
|
|
325
325
|
});
|
|
326
326
|
|
|
327
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
327
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/errors.js
|
|
328
328
|
var NoDriverAvailableError, DriverNotAvailableError, ReadonlyDatabaseError;
|
|
329
329
|
var init_errors2 = __esm({
|
|
330
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
330
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/errors.js"() {
|
|
331
331
|
"use strict";
|
|
332
332
|
init_errors();
|
|
333
333
|
NoDriverAvailableError = class extends Error {
|
|
@@ -352,7 +352,7 @@ var init_errors2 = __esm({
|
|
|
352
352
|
}
|
|
353
353
|
});
|
|
354
354
|
|
|
355
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
355
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/errors.js
|
|
356
356
|
function isDatabaseLockedError(error) {
|
|
357
357
|
return error instanceof DatabaseLockedError;
|
|
358
358
|
}
|
|
@@ -469,7 +469,7 @@ function isSourceLimitConfigurationError(error) {
|
|
|
469
469
|
}
|
|
470
470
|
var DatabaseLockedError, DatabaseNotFoundError, InvalidConfigError, InvalidFilterError, SessionNotFoundError, WorkspaceNotFoundError, SameWorkspaceError, NoSessionsFoundError, DestinationHasSessionsError, NestedPathError, BackupError, NoDataError, FileExistsError, InsufficientSpaceError, RestoreError, BackupNotFoundError, InvalidBackupError, TargetExistsError, IntegrityError;
|
|
471
471
|
var init_errors3 = __esm({
|
|
472
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
472
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/errors.js"() {
|
|
473
473
|
"use strict";
|
|
474
474
|
init_errors();
|
|
475
475
|
init_errors2();
|
|
@@ -718,7 +718,7 @@ var init_errors3 = __esm({
|
|
|
718
718
|
}
|
|
719
719
|
});
|
|
720
720
|
|
|
721
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
721
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/platform.js
|
|
722
722
|
import { existsSync as existsSync6, readFileSync as readFileSync7, readdirSync as readdirSync3 } from "node:fs";
|
|
723
723
|
import { homedir as homedir8 } from "node:os";
|
|
724
724
|
import { basename as basename2, dirname as dirname3, join as join6 } from "node:path";
|
|
@@ -912,24 +912,24 @@ function resolveStoreRoot(customDataPath) {
|
|
|
912
912
|
}
|
|
913
913
|
var cachedIsWsl, STORE_CHILDREN;
|
|
914
914
|
var init_platform = __esm({
|
|
915
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
915
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/platform.js"() {
|
|
916
916
|
"use strict";
|
|
917
917
|
STORE_CHILDREN = ["chats", "projects", "acp-sessions"];
|
|
918
918
|
}
|
|
919
919
|
});
|
|
920
920
|
|
|
921
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
921
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/utils.js
|
|
922
922
|
function getDefaultDataPath() {
|
|
923
923
|
return getCursorDataPath();
|
|
924
924
|
}
|
|
925
925
|
var init_utils = __esm({
|
|
926
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
926
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/utils.js"() {
|
|
927
927
|
"use strict";
|
|
928
928
|
init_platform();
|
|
929
929
|
}
|
|
930
930
|
});
|
|
931
931
|
|
|
932
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
932
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-identity.js
|
|
933
933
|
import { createHash } from "node:crypto";
|
|
934
934
|
function compareCodePoints2(left, right) {
|
|
935
935
|
const leftPoints = Array.from(left);
|
|
@@ -1177,14 +1177,14 @@ function allocateToolCallIdentities(stableMessageId, calls, projection = "store"
|
|
|
1177
1177
|
}
|
|
1178
1178
|
var MESSAGE_IDENTITY_VERSION, REPLICA_EQUIVALENCE_VERSION;
|
|
1179
1179
|
var init_session_identity = __esm({
|
|
1180
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
1180
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-identity.js"() {
|
|
1181
1181
|
"use strict";
|
|
1182
1182
|
MESSAGE_IDENTITY_VERSION = 1;
|
|
1183
1183
|
REPLICA_EQUIVALENCE_VERSION = 1;
|
|
1184
1184
|
}
|
|
1185
1185
|
});
|
|
1186
1186
|
|
|
1187
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
1187
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/timestamps.js
|
|
1188
1188
|
function isValidTimestamp(value) {
|
|
1189
1189
|
return value instanceof Date && Number.isFinite(value.getTime());
|
|
1190
1190
|
}
|
|
@@ -1304,7 +1304,7 @@ function resolveMessageTimestamps(messages, sessionAnchor) {
|
|
|
1304
1304
|
}
|
|
1305
1305
|
var UNKNOWN_TIMESTAMP_EPOCH_MS, DIRECT_MESSAGE_TIMESTAMP_SOURCES;
|
|
1306
1306
|
var init_timestamps = __esm({
|
|
1307
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
1307
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/timestamps.js"() {
|
|
1308
1308
|
"use strict";
|
|
1309
1309
|
UNKNOWN_TIMESTAMP_EPOCH_MS = 0;
|
|
1310
1310
|
DIRECT_MESSAGE_TIMESTAMP_SOURCES = /* @__PURE__ */ new Set([
|
|
@@ -1315,7 +1315,7 @@ var init_timestamps = __esm({
|
|
|
1315
1315
|
}
|
|
1316
1316
|
});
|
|
1317
1317
|
|
|
1318
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
1318
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/workspace-scope.js
|
|
1319
1319
|
function compareCodePoints3(left, right) {
|
|
1320
1320
|
const leftPoints = Array.from(left, (value) => value.codePointAt(0));
|
|
1321
1321
|
const rightPoints = Array.from(right, (value) => value.codePointAt(0));
|
|
@@ -1486,14 +1486,14 @@ function resolveWorkspaceScope(request2, memberships) {
|
|
|
1486
1486
|
return { kind: "not-found", normalizedRequest: normalizedRequest.path };
|
|
1487
1487
|
}
|
|
1488
1488
|
var init_workspace_scope = __esm({
|
|
1489
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
1489
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/workspace-scope.js"() {
|
|
1490
1490
|
"use strict";
|
|
1491
1491
|
init_errors();
|
|
1492
1492
|
init_errors();
|
|
1493
1493
|
}
|
|
1494
1494
|
});
|
|
1495
1495
|
|
|
1496
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
1496
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/parser.js
|
|
1497
1497
|
function serializeToolCall(tc) {
|
|
1498
1498
|
const obj = { name: tc.name, status: tc.status };
|
|
1499
1499
|
if (tc.id !== void 0)
|
|
@@ -2250,7 +2250,7 @@ function exportToJson(session, workspacePath) {
|
|
|
2250
2250
|
}
|
|
2251
2251
|
var TOOL_DISPLAY_NAMES, TOOL_IDENTITY_PARAMS;
|
|
2252
2252
|
var init_parser = __esm({
|
|
2253
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2253
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/parser.js"() {
|
|
2254
2254
|
"use strict";
|
|
2255
2255
|
init_session_identity();
|
|
2256
2256
|
init_timestamps();
|
|
@@ -2297,7 +2297,7 @@ var init_parser = __esm({
|
|
|
2297
2297
|
}
|
|
2298
2298
|
});
|
|
2299
2299
|
|
|
2300
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2300
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/cli/formatters/table.js
|
|
2301
2301
|
import pc from "picocolors";
|
|
2302
2302
|
function isToolCall(content) {
|
|
2303
2303
|
return content.startsWith("[Tool:");
|
|
@@ -2335,7 +2335,7 @@ function validateMessageTypes(types) {
|
|
|
2335
2335
|
return types.filter((t) => !MESSAGE_TYPES.includes(t));
|
|
2336
2336
|
}
|
|
2337
2337
|
var init_table = __esm({
|
|
2338
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2338
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/cli/formatters/table.js"() {
|
|
2339
2339
|
"use strict";
|
|
2340
2340
|
init_types();
|
|
2341
2341
|
init_parser();
|
|
@@ -2343,7 +2343,7 @@ var init_table = __esm({
|
|
|
2343
2343
|
}
|
|
2344
2344
|
});
|
|
2345
2345
|
|
|
2346
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2346
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/config.js
|
|
2347
2347
|
function validateConfig(config) {
|
|
2348
2348
|
if (!config)
|
|
2349
2349
|
return;
|
|
@@ -2404,7 +2404,7 @@ function mergeWithDefaults(config) {
|
|
|
2404
2404
|
}
|
|
2405
2405
|
var VALID_SQLITE_DRIVERS;
|
|
2406
2406
|
var init_config = __esm({
|
|
2407
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2407
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/config.js"() {
|
|
2408
2408
|
"use strict";
|
|
2409
2409
|
init_errors3();
|
|
2410
2410
|
init_platform();
|
|
@@ -2412,7 +2412,7 @@ var init_config = __esm({
|
|
|
2412
2412
|
}
|
|
2413
2413
|
});
|
|
2414
2414
|
|
|
2415
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2415
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/debug.js
|
|
2416
2416
|
function debugLog(message) {
|
|
2417
2417
|
if (process.env["DEBUG"] || process.env["CURSOR_HISTORY_DEBUG"]) {
|
|
2418
2418
|
console.error(`[cursor-history:sqlite] ${message}`);
|
|
@@ -2424,12 +2424,12 @@ function debugLogStorage(message) {
|
|
|
2424
2424
|
}
|
|
2425
2425
|
}
|
|
2426
2426
|
var init_debug = __esm({
|
|
2427
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2427
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/debug.js"() {
|
|
2428
2428
|
"use strict";
|
|
2429
2429
|
}
|
|
2430
2430
|
});
|
|
2431
2431
|
|
|
2432
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2432
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/io-observer.js
|
|
2433
2433
|
function requireSafeIdentity(name, value) {
|
|
2434
2434
|
if (typeof value !== "string" || value.length === 0 || /[\r\n\0]/.test(value)) {
|
|
2435
2435
|
throw new TypeError(`${name} must be a non-empty single-line string.`);
|
|
@@ -2477,7 +2477,7 @@ function observeAdapterIo(context, input) {
|
|
|
2477
2477
|
}
|
|
2478
2478
|
var IO_RESOURCE_CLASSIFICATIONS, IoObserverError;
|
|
2479
2479
|
var init_io_observer = __esm({
|
|
2480
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2480
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/io-observer.js"() {
|
|
2481
2481
|
"use strict";
|
|
2482
2482
|
IO_RESOURCE_CLASSIFICATIONS = Object.freeze({
|
|
2483
2483
|
"workspace-root-directory": "catalog-metadata",
|
|
@@ -2516,7 +2516,7 @@ var init_io_observer = __esm({
|
|
|
2516
2516
|
}
|
|
2517
2517
|
});
|
|
2518
2518
|
|
|
2519
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2519
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/observed.js
|
|
2520
2520
|
function requestIdentity(request2) {
|
|
2521
2521
|
return request2.ioResource ?? { resourceClass: "unclassified-resource" };
|
|
2522
2522
|
}
|
|
@@ -2586,11 +2586,11 @@ function isKeyValueStatement(sql) {
|
|
|
2586
2586
|
function emit(context, operation, identity, adapter = "sqlite") {
|
|
2587
2587
|
observeAdapterIo(context, { adapter, operation, ...identity });
|
|
2588
2588
|
}
|
|
2589
|
-
function openObservedDatabase(context, request2,
|
|
2589
|
+
function openObservedDatabase(context, request2, open4) {
|
|
2590
2590
|
if (!context)
|
|
2591
|
-
return
|
|
2591
|
+
return open4();
|
|
2592
2592
|
emit(context, "open", requestIdentity(request2));
|
|
2593
|
-
return new ObservedDatabase(
|
|
2593
|
+
return new ObservedDatabase(open4(), context, request2);
|
|
2594
2594
|
}
|
|
2595
2595
|
function observeDatabaseBackup(request2) {
|
|
2596
2596
|
if (!request2.io)
|
|
@@ -2599,7 +2599,7 @@ function observeDatabaseBackup(request2) {
|
|
|
2599
2599
|
}
|
|
2600
2600
|
var ObservedStatement, ObservedDatabase;
|
|
2601
2601
|
var init_observed = __esm({
|
|
2602
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2602
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/observed.js"() {
|
|
2603
2603
|
"use strict";
|
|
2604
2604
|
init_io_observer();
|
|
2605
2605
|
ObservedStatement = class {
|
|
@@ -2659,13 +2659,13 @@ var init_observed = __esm({
|
|
|
2659
2659
|
}
|
|
2660
2660
|
});
|
|
2661
2661
|
|
|
2662
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2662
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/registry.js
|
|
2663
2663
|
function missingCapabilities(profile, required) {
|
|
2664
2664
|
return [...required].filter((capability) => !profile.capabilities.has(capability));
|
|
2665
2665
|
}
|
|
2666
2666
|
var AUTO_DRIVER_ORDER, READ_SESSION_REQUEST, MIGRATION_REQUEST, BACKUP_REQUEST, DriverRegistry, registry;
|
|
2667
2667
|
var init_registry = __esm({
|
|
2668
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2668
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/registry.js"() {
|
|
2669
2669
|
"use strict";
|
|
2670
2670
|
init_errors2();
|
|
2671
2671
|
init_debug();
|
|
@@ -2882,7 +2882,7 @@ var init_registry = __esm({
|
|
|
2882
2882
|
}
|
|
2883
2883
|
});
|
|
2884
2884
|
|
|
2885
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2885
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/better-sqlite3.js
|
|
2886
2886
|
function unavailableProfile(reason) {
|
|
2887
2887
|
return {
|
|
2888
2888
|
driver: "better-sqlite3",
|
|
@@ -2955,7 +2955,7 @@ async function loadBetterSqlite3Profile() {
|
|
|
2955
2955
|
}
|
|
2956
2956
|
var BetterSqlite3, betterSqlite3ProfilePromise, BetterSqlite3Statement, BetterSqlite3Database, betterSqlite3Driver;
|
|
2957
2957
|
var init_better_sqlite3 = __esm({
|
|
2958
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
2958
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/better-sqlite3.js"() {
|
|
2959
2959
|
"use strict";
|
|
2960
2960
|
init_debug();
|
|
2961
2961
|
BetterSqlite3 = null;
|
|
@@ -3033,7 +3033,7 @@ var init_better_sqlite3 = __esm({
|
|
|
3033
3033
|
}
|
|
3034
3034
|
});
|
|
3035
3035
|
|
|
3036
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
3036
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/node-sqlite.js
|
|
3037
3037
|
function unavailableProfile2(reason) {
|
|
3038
3038
|
return {
|
|
3039
3039
|
driver: "node:sqlite",
|
|
@@ -3128,7 +3128,7 @@ async function loadNodeSqliteProfile() {
|
|
|
3128
3128
|
}
|
|
3129
3129
|
var nodeSqliteModule, nodeSqliteProfilePromise, NodeSqliteStatementWrapper, NodeSqliteDatabaseWrapper, nodeSqliteDriver;
|
|
3130
3130
|
var init_node_sqlite = __esm({
|
|
3131
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
3131
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/node-sqlite.js"() {
|
|
3132
3132
|
"use strict";
|
|
3133
3133
|
init_debug();
|
|
3134
3134
|
init_errors2();
|
|
@@ -3232,7 +3232,7 @@ var init_node_sqlite = __esm({
|
|
|
3232
3232
|
}
|
|
3233
3233
|
});
|
|
3234
3234
|
|
|
3235
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
3235
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/index.js
|
|
3236
3236
|
async function openDatabase(path14, request2) {
|
|
3237
3237
|
return registry.openDatabase(path14, request2);
|
|
3238
3238
|
}
|
|
@@ -3255,7 +3255,7 @@ async function backupDatabase(sourcePath, destPath, request2) {
|
|
|
3255
3255
|
return registry.backupDatabase(sourcePath, destPath, request2);
|
|
3256
3256
|
}
|
|
3257
3257
|
var init_database = __esm({
|
|
3258
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
3258
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/index.js"() {
|
|
3259
3259
|
"use strict";
|
|
3260
3260
|
init_errors2();
|
|
3261
3261
|
init_registry();
|
|
@@ -3266,7 +3266,7 @@ var init_database = __esm({
|
|
|
3266
3266
|
}
|
|
3267
3267
|
});
|
|
3268
3268
|
|
|
3269
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
3269
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/private-temp.js
|
|
3270
3270
|
import { chmodSync, closeSync, constants, fchmodSync, fstatSync, fsyncSync, lstatSync, mkdtempSync, openSync, readFileSync as readFileSync8, readlinkSync, readdirSync as readdirSync4, realpathSync, rmdirSync, statSync as statSync2, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
3271
3271
|
import { tmpdir } from "node:os";
|
|
3272
3272
|
import { basename as basename3, isAbsolute, join as join7, relative as relative2, resolve, sep } from "node:path";
|
|
@@ -3707,7 +3707,7 @@ function createPrivateTempWorkspace(options) {
|
|
|
3707
3707
|
}
|
|
3708
3708
|
var PRIVATE_TEMP_MARKER_FILENAME, PRIVATE_TEMP_MARKER_MAX_BYTES, CATCHABLE_SIGNALS, SIGNAL_NUMBERS, IS_PERMISSION_AWARE_POSIX, CURRENT_UID, FALLBACK_CURRENT_PROCESS_TOKEN, activeWorkspaces, installedSignalHandlers, handlingSignal, PrivateTempWorkspaceImpl;
|
|
3709
3709
|
var init_private_temp = __esm({
|
|
3710
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
3710
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/private-temp.js"() {
|
|
3711
3711
|
"use strict";
|
|
3712
3712
|
init_errors();
|
|
3713
3713
|
PRIVATE_TEMP_MARKER_FILENAME = ".cursor-history-private-temp-v1.json";
|
|
@@ -3796,16 +3796,16 @@ var init_private_temp = __esm({
|
|
|
3796
3796
|
}
|
|
3797
3797
|
});
|
|
3798
3798
|
|
|
3799
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
3799
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/package-version.generated.js
|
|
3800
3800
|
var PACKAGE_VERSION;
|
|
3801
3801
|
var init_package_version_generated = __esm({
|
|
3802
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
3802
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/package-version.generated.js"() {
|
|
3803
3803
|
"use strict";
|
|
3804
3804
|
PACKAGE_VERSION = "0.18.0";
|
|
3805
3805
|
}
|
|
3806
3806
|
});
|
|
3807
3807
|
|
|
3808
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
3808
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/source-read-limits.js
|
|
3809
3809
|
function assertRelationship(limits, left, right) {
|
|
3810
3810
|
if (limits[left] > limits[right]) {
|
|
3811
3811
|
throw new SourceLimitConfigurationError(left, limits[left], `${left} must be less than or equal to ${right}`);
|
|
@@ -3905,7 +3905,7 @@ function decodeDeterministicUtf8(value, sourceKind, outcome, allowLeadingBom = t
|
|
|
3905
3905
|
}
|
|
3906
3906
|
var RESOLVED_SOURCE_READ_LIMITS, SOURCE_READ_LIMITS_V1_DEFAULTS, SOURCE_READ_LIMIT_FIELDS, SOURCE_READ_LIMIT_FIELD_SET, UTF8_BOM, JsonlSourceReadBudget, SqliteSourceReadBudget;
|
|
3907
3907
|
var init_source_read_limits = __esm({
|
|
3908
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
3908
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/source-read-limits.js"() {
|
|
3909
3909
|
"use strict";
|
|
3910
3910
|
init_errors();
|
|
3911
3911
|
RESOLVED_SOURCE_READ_LIMITS = /* @__PURE__ */ new WeakSet();
|
|
@@ -4034,10 +4034,10 @@ var init_source_read_limits = __esm({
|
|
|
4034
4034
|
}
|
|
4035
4035
|
});
|
|
4036
4036
|
|
|
4037
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
4037
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/zip-stream.js
|
|
4038
4038
|
import { createHash as createHash2 } from "node:crypto";
|
|
4039
|
-
import { open, unlink } from "node:fs/promises";
|
|
4040
|
-
import { Readable, Transform, Writable } from "node:stream";
|
|
4039
|
+
import { open as open2, unlink } from "node:fs/promises";
|
|
4040
|
+
import { Readable as Readable2, Transform, Writable } from "node:stream";
|
|
4041
4041
|
import { pipeline } from "node:stream/promises";
|
|
4042
4042
|
import { createInflateRaw } from "node:zlib";
|
|
4043
4043
|
function zipEntryIoIdentity(name) {
|
|
@@ -4150,7 +4150,7 @@ function readHandleRange(handle, position, length, signal) {
|
|
|
4150
4150
|
yield buffer.subarray(0, bytesRead);
|
|
4151
4151
|
}
|
|
4152
4152
|
}
|
|
4153
|
-
return
|
|
4153
|
+
return Readable2.from(chunks(), { objectMode: false });
|
|
4154
4154
|
}
|
|
4155
4155
|
function writeToHandle(handle) {
|
|
4156
4156
|
let position = 0;
|
|
@@ -4540,7 +4540,7 @@ async function prepareZipFileInputs(inputs, options = {}) {
|
|
|
4540
4540
|
for (const input of inputs) {
|
|
4541
4541
|
throwIfAborted(options.signal);
|
|
4542
4542
|
const normalized = validateWriteName(input.name, portableNames);
|
|
4543
|
-
const handle = await
|
|
4543
|
+
const handle = await open2(input.sourcePath, "r");
|
|
4544
4544
|
try {
|
|
4545
4545
|
const before = await handle.stat({ bigint: true });
|
|
4546
4546
|
if (!before.isFile())
|
|
@@ -4701,7 +4701,7 @@ async function writeBoundedZipArchive(destinationPath, inputs, options = {}) {
|
|
|
4701
4701
|
const limits = resolveSourceReadLimits(options.sourceReadLimits);
|
|
4702
4702
|
throwIfAborted(options.signal);
|
|
4703
4703
|
const plan = planWriteEntries(inputs, limits);
|
|
4704
|
-
const destination = await
|
|
4704
|
+
const destination = await open2(destinationPath, "wx", 384);
|
|
4705
4705
|
try {
|
|
4706
4706
|
await destination.chmod(384);
|
|
4707
4707
|
let position = 0;
|
|
@@ -4723,7 +4723,7 @@ async function writeBoundedZipArchive(destinationPath, inputs, options = {}) {
|
|
|
4723
4723
|
}
|
|
4724
4724
|
if (!entry.sourcePath || !entry.checksum)
|
|
4725
4725
|
throw formatError("Prepared ZIP input is incomplete.");
|
|
4726
|
-
const source = await
|
|
4726
|
+
const source = await open2(entry.sourcePath, "r");
|
|
4727
4727
|
try {
|
|
4728
4728
|
const metadata = await source.stat({ bigint: true });
|
|
4729
4729
|
if (!metadata.isFile() || metadata.size !== BigInt(entry.size)) {
|
|
@@ -4808,7 +4808,7 @@ async function openBoundedZipArchive(path14, options) {
|
|
|
4808
4808
|
}
|
|
4809
4809
|
var EOCD_SIGNATURE, ZIP64_EOCD_SIGNATURE, ZIP64_LOCATOR_SIGNATURE, CENTRAL_FILE_SIGNATURE, LOCAL_FILE_SIGNATURE, ZIP64_EXTRA_FIELD_ID, MAX_EOCD_SEARCH_BYTES, UTF8_FLAG, ENCRYPTED_FLAG, STRONG_ENCRYPTION_FLAG, DATA_DESCRIPTOR_FLAG, STORE_METHOD, DEFLATE_METHOD, MANIFEST_MEMORY_LIMIT, STREAM_CHUNK_BYTES, ZIP_LIMIT_FIELDS, ZipArchiveFormatError, CRC32_TABLE, CompressedVerifier, OutputIntegrityVerifier, BoundedZipArchive;
|
|
4810
4810
|
var init_zip_stream = __esm({
|
|
4811
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
4811
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/zip-stream.js"() {
|
|
4812
4812
|
"use strict";
|
|
4813
4813
|
init_errors();
|
|
4814
4814
|
init_source_read_limits();
|
|
@@ -4973,7 +4973,7 @@ var init_zip_stream = __esm({
|
|
|
4973
4973
|
resourceClass: "backup-central-directory"
|
|
4974
4974
|
});
|
|
4975
4975
|
}
|
|
4976
|
-
const handle = await
|
|
4976
|
+
const handle = await open2(path14, "r");
|
|
4977
4977
|
try {
|
|
4978
4978
|
if (options.io) {
|
|
4979
4979
|
observeAdapterIo(options.io, {
|
|
@@ -5127,7 +5127,7 @@ var init_zip_stream = __esm({
|
|
|
5127
5127
|
const entry = this.getEntry(name);
|
|
5128
5128
|
if (!entry)
|
|
5129
5129
|
throw formatError(`ZIP entry was not found: ${name}`);
|
|
5130
|
-
const destination = await
|
|
5130
|
+
const destination = await open2(destinationPath, "r+");
|
|
5131
5131
|
try {
|
|
5132
5132
|
await destination.chmod(384);
|
|
5133
5133
|
await destination.truncate(0);
|
|
@@ -5144,7 +5144,7 @@ var init_zip_stream = __esm({
|
|
|
5144
5144
|
const entry = this.getEntry(name);
|
|
5145
5145
|
if (!entry)
|
|
5146
5146
|
throw formatError(`ZIP entry was not found: ${name}`);
|
|
5147
|
-
const destination = await
|
|
5147
|
+
const destination = await open2(destinationPath, "r+");
|
|
5148
5148
|
try {
|
|
5149
5149
|
await destination.chmod(384);
|
|
5150
5150
|
await destination.truncate(0);
|
|
@@ -5200,7 +5200,7 @@ var init_zip_stream = __esm({
|
|
|
5200
5200
|
}
|
|
5201
5201
|
});
|
|
5202
5202
|
|
|
5203
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5203
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/composer-sqlite.js
|
|
5204
5204
|
function exactBlobPrefixPredicate(qualifiedKey) {
|
|
5205
5205
|
return `${qualifiedKey} >= ? AND ${qualifiedKey} < ? AND ${qualifiedKey} IS NOT NULL AND substr(CAST(${qualifiedKey} AS BLOB), 1, length(CAST(? AS BLOB))) = CAST(? AS BLOB)`;
|
|
5206
5206
|
}
|
|
@@ -5211,6 +5211,15 @@ function exactPrefixUpperBound(prefix) {
|
|
|
5211
5211
|
const lastLength = last > 65535 ? 2 : 1;
|
|
5212
5212
|
return prefix.slice(0, prefix.length - lastLength) + String.fromCodePoint(last + 1);
|
|
5213
5213
|
}
|
|
5214
|
+
function literalPrefixRange(keyPattern) {
|
|
5215
|
+
const prefix = keyPattern.slice(0, -1);
|
|
5216
|
+
if (!keyPattern.endsWith("%") || prefix.length === 0 || /[%_\\]/.test(prefix))
|
|
5217
|
+
return null;
|
|
5218
|
+
return { lower: prefix, upper: exactPrefixUpperBound(prefix) };
|
|
5219
|
+
}
|
|
5220
|
+
function keyPagePredicate(qualifiedKey, afterKey) {
|
|
5221
|
+
return `${qualifiedKey} ${afterKey === null ? ">=" : ">"} ? AND ${qualifiedKey} < ?`;
|
|
5222
|
+
}
|
|
5214
5223
|
function abortError3(signal) {
|
|
5215
5224
|
if (signal.reason instanceof Error && signal.reason.name === "AbortError")
|
|
5216
5225
|
return signal.reason;
|
|
@@ -5317,10 +5326,12 @@ function getBoundedComposerMetadataByKey(db, table, key2, budget, signal) {
|
|
|
5317
5326
|
}
|
|
5318
5327
|
function forEachBoundedComposerMetadata(db, table, keyPattern, budget, visit, signal) {
|
|
5319
5328
|
const pageRows = budget.limits.sqlitePageRows;
|
|
5329
|
+
const range = literalPrefixRange(keyPattern);
|
|
5320
5330
|
let afterRowId = null;
|
|
5331
|
+
let afterKey = null;
|
|
5321
5332
|
while (true) {
|
|
5322
5333
|
throwIfAborted2(signal);
|
|
5323
|
-
const rawPage = db.prepare(`SELECT CAST(${table}.rowid AS TEXT) AS rowId, key, length(CAST(value AS BLOB)) AS byteLength FROM ${table} WHERE key LIKE ? ESCAPE '\\' AND value IS NOT NULL AND ${table}.rowid > COALESCE(?, -1) ORDER BY ${table}.rowid ASC LIMIT ?`).all(keyPattern, afterRowId, pageRows);
|
|
5334
|
+
const rawPage = range ? db.prepare(`SELECT CAST(${table}.rowid AS TEXT) AS rowId, key, length(CAST(value AS BLOB)) AS byteLength FROM ${table} WHERE ${keyPagePredicate(`${table}.key`, afterKey)} AND key LIKE ? ESCAPE '\\' AND value IS NOT NULL ORDER BY ${table}.key ASC LIMIT ?`).all(afterKey ?? range.lower, range.upper, keyPattern, pageRows) : db.prepare(`SELECT CAST(${table}.rowid AS TEXT) AS rowId, key, length(CAST(value AS BLOB)) AS byteLength FROM ${table} WHERE key LIKE ? ESCAPE '\\' AND value IS NOT NULL AND ${table}.rowid > COALESCE(?, -1) ORDER BY ${table}.rowid ASC LIMIT ?`).all(keyPattern, afterRowId, pageRows);
|
|
5324
5335
|
if (rawPage.length === 0)
|
|
5325
5336
|
break;
|
|
5326
5337
|
const fallbackBase = typeof afterRowId === "number" && Number.isSafeInteger(afterRowId) ? afterRowId : -1;
|
|
@@ -5334,14 +5345,17 @@ function forEachBoundedComposerMetadata(db, table, keyPattern, budget, visit, si
|
|
|
5334
5345
|
if (legacyInlinePage || rawPage.length < pageRows)
|
|
5335
5346
|
break;
|
|
5336
5347
|
afterRowId = page[page.length - 1].rowId;
|
|
5348
|
+
afterKey = page[page.length - 1].key;
|
|
5337
5349
|
}
|
|
5338
5350
|
}
|
|
5339
5351
|
function forEachBoundedComposerBubbleMetadata(db, keyPattern, budget, visit, signal) {
|
|
5340
5352
|
const pageRows = budget.limits.sqlitePageRows;
|
|
5353
|
+
const range = literalPrefixRange(keyPattern);
|
|
5341
5354
|
let afterRowId = null;
|
|
5355
|
+
let afterKey = null;
|
|
5342
5356
|
while (true) {
|
|
5343
5357
|
throwIfAborted2(signal);
|
|
5344
|
-
const rawPage = db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(length(CAST(value AS BLOB)), 0) AS byteLength, value IS NULL AS valueIsNull FROM cursorDiskKV WHERE key LIKE ? ESCAPE '\\' AND cursorDiskKV.rowid > COALESCE(?, -1) ORDER BY cursorDiskKV.rowid ASC LIMIT ?`).all(keyPattern, afterRowId, pageRows);
|
|
5358
|
+
const rawPage = range ? db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(length(CAST(value AS BLOB)), 0) AS byteLength, value IS NULL AS valueIsNull FROM cursorDiskKV WHERE ${keyPagePredicate("cursorDiskKV.key", afterKey)} AND key LIKE ? ESCAPE '\\' ORDER BY cursorDiskKV.key ASC LIMIT ?`).all(afterKey ?? range.lower, range.upper, keyPattern, pageRows) : db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(length(CAST(value AS BLOB)), 0) AS byteLength, value IS NULL AS valueIsNull FROM cursorDiskKV WHERE key LIKE ? ESCAPE '\\' AND cursorDiskKV.rowid > COALESCE(?, -1) ORDER BY cursorDiskKV.rowid ASC LIMIT ?`).all(keyPattern, afterRowId, pageRows);
|
|
5345
5359
|
if (rawPage.length === 0)
|
|
5346
5360
|
break;
|
|
5347
5361
|
const fallbackBase = typeof afterRowId === "number" && Number.isSafeInteger(afterRowId) ? afterRowId : -1;
|
|
@@ -5355,6 +5369,7 @@ function forEachBoundedComposerBubbleMetadata(db, keyPattern, budget, visit, sig
|
|
|
5355
5369
|
if (legacyInlinePage || rawPage.length < pageRows)
|
|
5356
5370
|
break;
|
|
5357
5371
|
afterRowId = page[page.length - 1].rowId;
|
|
5372
|
+
afterKey = page[page.length - 1].key;
|
|
5358
5373
|
}
|
|
5359
5374
|
}
|
|
5360
5375
|
function forEachBoundedComposerBubbleMetadataByExactPrefix(db, keyPrefix, budget, visit, signal) {
|
|
@@ -5472,13 +5487,13 @@ function forEachBoundedComposerBubbleValueByExactPrefix(db, keyPrefix, budget, v
|
|
|
5472
5487
|
forEachBoundedComposerBubbleMetadataByExactPrefix(db, keyPrefix, budget, (metadata) => visit(readAdmittedComposerBubbleValue(db, metadata, budget, signal)), signal);
|
|
5473
5488
|
}
|
|
5474
5489
|
var init_composer_sqlite = __esm({
|
|
5475
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5490
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/composer-sqlite.js"() {
|
|
5476
5491
|
"use strict";
|
|
5477
5492
|
init_source_read_limits();
|
|
5478
5493
|
}
|
|
5479
5494
|
});
|
|
5480
5495
|
|
|
5481
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5496
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-publication.js
|
|
5482
5497
|
import { closeSync as closeSync2, constants as constants2, fchmodSync as fchmodSync2, fstatSync as fstatSync2, lstatSync as lstatSync2, openSync as openSync2 } from "node:fs";
|
|
5483
5498
|
function projectStat(stat8) {
|
|
5484
5499
|
return {
|
|
@@ -5554,7 +5569,7 @@ function enforcePublishedArchiveMode(outputPath, requestedMode, expectedIdentity
|
|
|
5554
5569
|
}
|
|
5555
5570
|
var DEFAULT_MODE_OPERATIONS;
|
|
5556
5571
|
var init_backup_publication = __esm({
|
|
5557
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5572
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-publication.js"() {
|
|
5558
5573
|
"use strict";
|
|
5559
5574
|
init_errors();
|
|
5560
5575
|
DEFAULT_MODE_OPERATIONS = Object.freeze({
|
|
@@ -5567,7 +5582,7 @@ var init_backup_publication = __esm({
|
|
|
5567
5582
|
}
|
|
5568
5583
|
});
|
|
5569
5584
|
|
|
5570
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5585
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-archive-publication.js
|
|
5571
5586
|
import { linkSync, lstatSync as lstatSync3, renameSync, unlinkSync as unlinkSync2 } from "node:fs";
|
|
5572
5587
|
function errorCode(error) {
|
|
5573
5588
|
return error instanceof Error && "code" in error ? String(error.code) : void 0;
|
|
@@ -5621,7 +5636,7 @@ function publishBackupArchiveStage(stagePath, outputPath, force, identity, onCom
|
|
|
5621
5636
|
}
|
|
5622
5637
|
var CLEANUP_ATTEMPTS, DEFAULT_OPERATIONS;
|
|
5623
5638
|
var init_backup_archive_publication = __esm({
|
|
5624
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5639
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-archive-publication.js"() {
|
|
5625
5640
|
"use strict";
|
|
5626
5641
|
init_errors();
|
|
5627
5642
|
CLEANUP_ATTEMPTS = 2;
|
|
@@ -5634,7 +5649,7 @@ var init_backup_archive_publication = __esm({
|
|
|
5634
5649
|
}
|
|
5635
5650
|
});
|
|
5636
5651
|
|
|
5637
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5652
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/restore-publication.js
|
|
5638
5653
|
import { linkSync as linkSync2, lstatSync as lstatSync4, renameSync as renameSync2, unlinkSync as unlinkSync3 } from "node:fs";
|
|
5639
5654
|
function errorCode2(error) {
|
|
5640
5655
|
return error instanceof Error && "code" in error ? String(error.code) : void 0;
|
|
@@ -5684,7 +5699,7 @@ function commitRestorePublication(publicationPath, destinationPath, replaceExist
|
|
|
5684
5699
|
}
|
|
5685
5700
|
var CLEANUP_ATTEMPTS2, DEFAULT_OPERATIONS2;
|
|
5686
5701
|
var init_restore_publication = __esm({
|
|
5687
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5702
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/restore-publication.js"() {
|
|
5688
5703
|
"use strict";
|
|
5689
5704
|
init_errors();
|
|
5690
5705
|
CLEANUP_ATTEMPTS2 = 2;
|
|
@@ -5697,7 +5712,7 @@ var init_restore_publication = __esm({
|
|
|
5697
5712
|
}
|
|
5698
5713
|
});
|
|
5699
5714
|
|
|
5700
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5715
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-id.js
|
|
5701
5716
|
function isNativeCursorUuid(sessionId) {
|
|
5702
5717
|
return NATIVE_CURSOR_UUID.test(sessionId);
|
|
5703
5718
|
}
|
|
@@ -5737,13 +5752,13 @@ function groupSessionIdSpellings(sessionIds) {
|
|
|
5737
5752
|
}
|
|
5738
5753
|
var NATIVE_CURSOR_UUID;
|
|
5739
5754
|
var init_session_id = __esm({
|
|
5740
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5755
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-id.js"() {
|
|
5741
5756
|
"use strict";
|
|
5742
5757
|
NATIVE_CURSOR_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
|
|
5743
5758
|
}
|
|
5744
5759
|
});
|
|
5745
5760
|
|
|
5746
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
5761
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup.js
|
|
5747
5762
|
import { createHash as createHash3, randomUUID } from "node:crypto";
|
|
5748
5763
|
import { chmodSync as chmodSync2, closeSync as closeSync3, constants as constants3, existsSync as existsSync7, copyFileSync, fchmodSync as fchmodSync3, fstatSync as fstatSync3, fsyncSync as fsyncSync2, lstatSync as lstatSync5, mkdirSync as mkdirSync2, openSync as openSync3, readFileSync as readFileSync9, readSync, readdirSync as readdirSync5, realpathSync as realpathSync2, statSync as statSync3, unlinkSync as unlinkSync4, writeSync } from "node:fs";
|
|
5749
5764
|
import { homedir as homedir9 } from "node:os";
|
|
@@ -7129,7 +7144,7 @@ function getDefaultCursorDataPath2() {
|
|
|
7129
7144
|
}
|
|
7130
7145
|
var MANIFEST_VERSION, UTF8_BOM2, BACKUP_METADATA_MEMORY_LIMIT, BACKUP_DATABASE_READ_CAPABILITIES, BACKUP_CHAT_DATA_KEYS, BackupEntryNotFoundError, COMPOSER_GUID_RE, TempFileCleanupWrapper;
|
|
7131
7146
|
var init_backup = __esm({
|
|
7132
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7147
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup.js"() {
|
|
7133
7148
|
"use strict";
|
|
7134
7149
|
init_registry();
|
|
7135
7150
|
init_database();
|
|
@@ -7200,7 +7215,7 @@ var init_backup = __esm({
|
|
|
7200
7215
|
}
|
|
7201
7216
|
});
|
|
7202
7217
|
|
|
7203
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7218
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-catalog.js
|
|
7204
7219
|
function compareCodePoints5(left, right) {
|
|
7205
7220
|
const leftPoints = Array.from(left, (value) => value.codePointAt(0));
|
|
7206
7221
|
const rightPoints = Array.from(right, (value) => value.codePointAt(0));
|
|
@@ -7570,7 +7585,7 @@ function sessionAmbiguityErrorFromReplicaGroup(divergence) {
|
|
|
7570
7585
|
}
|
|
7571
7586
|
var SOURCE_ROLE_ORDER, REPRESENTATION_ORDER, FIDELITY_ORDER, CANONICAL_PATH_KIND_ORDER, INSTANCE_STATE_ORDER;
|
|
7572
7587
|
var init_session_catalog = __esm({
|
|
7573
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7588
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-catalog.js"() {
|
|
7574
7589
|
"use strict";
|
|
7575
7590
|
init_errors();
|
|
7576
7591
|
init_session_identity();
|
|
@@ -7600,7 +7615,7 @@ var init_session_catalog = __esm({
|
|
|
7600
7615
|
}
|
|
7601
7616
|
});
|
|
7602
7617
|
|
|
7603
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7618
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/paths.js
|
|
7604
7619
|
import { join as join9 } from "node:path";
|
|
7605
7620
|
function storeProjectDirectoryName(cwd) {
|
|
7606
7621
|
const normalized = cwd.replace(/\\/gu, "/");
|
|
@@ -7618,12 +7633,12 @@ function acpSessionsDir(storeRoot2) {
|
|
|
7618
7633
|
return join9(storeRoot2, "acp-sessions");
|
|
7619
7634
|
}
|
|
7620
7635
|
var init_paths = __esm({
|
|
7621
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7636
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/paths.js"() {
|
|
7622
7637
|
"use strict";
|
|
7623
7638
|
}
|
|
7624
7639
|
});
|
|
7625
7640
|
|
|
7626
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7641
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/content-evidence.js
|
|
7627
7642
|
function deepFreeze(value) {
|
|
7628
7643
|
if (!value || typeof value !== "object" || Object.isFrozen(value))
|
|
7629
7644
|
return value;
|
|
@@ -7692,7 +7707,7 @@ ${encoded}
|
|
|
7692
7707
|
}
|
|
7693
7708
|
var INLINE_ATTACHMENT_TYPES, INLINE_PAYLOAD_FIELDS, PROJECTED_ATTACHMENT_FENCE;
|
|
7694
7709
|
var init_content_evidence = __esm({
|
|
7695
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7710
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/content-evidence.js"() {
|
|
7696
7711
|
"use strict";
|
|
7697
7712
|
init_session_identity();
|
|
7698
7713
|
INLINE_ATTACHMENT_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -7709,7 +7724,7 @@ var init_content_evidence = __esm({
|
|
|
7709
7724
|
}
|
|
7710
7725
|
});
|
|
7711
7726
|
|
|
7712
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
7727
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/store-db.js
|
|
7713
7728
|
import { chmodSync as chmodSync3, statSync as statSync4 } from "node:fs";
|
|
7714
7729
|
function databaseRequest(operation, required, forcedDriver, options, resourceClass = "store-database") {
|
|
7715
7730
|
return {
|
|
@@ -8354,7 +8369,7 @@ function validDateFromMs(value) {
|
|
|
8354
8369
|
}
|
|
8355
8370
|
var STORE_SNAPSHOT_CAPABILITIES, STORE_READ_CAPABILITIES, StoreSourceCorruptError, BoundedBlobReader;
|
|
8356
8371
|
var init_store_db = __esm({
|
|
8357
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
8372
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/store-db.js"() {
|
|
8358
8373
|
"use strict";
|
|
8359
8374
|
init_database();
|
|
8360
8375
|
init_debug();
|
|
@@ -8426,7 +8441,7 @@ var init_store_db = __esm({
|
|
|
8426
8441
|
}
|
|
8427
8442
|
});
|
|
8428
8443
|
|
|
8429
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
8444
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/transcript.js
|
|
8430
8445
|
import { closeSync as closeSync4, openSync as openSync4, readSync as readSync2 } from "node:fs";
|
|
8431
8446
|
function parseTranscriptFile(filePath, limits = SOURCE_READ_LIMITS_V1_DEFAULTS, failureOutcome = "fatal", signal, io, logicalSessionId) {
|
|
8432
8447
|
throwIfAborted5(signal);
|
|
@@ -8784,7 +8799,7 @@ function extractContent(parts) {
|
|
|
8784
8799
|
}
|
|
8785
8800
|
var READ_CHUNK_BYTES;
|
|
8786
8801
|
var init_transcript = __esm({
|
|
8787
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
8802
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/transcript.js"() {
|
|
8788
8803
|
"use strict";
|
|
8789
8804
|
init_errors();
|
|
8790
8805
|
init_io_observer();
|
|
@@ -8794,7 +8809,7 @@ var init_transcript = __esm({
|
|
|
8794
8809
|
}
|
|
8795
8810
|
});
|
|
8796
8811
|
|
|
8797
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
8812
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/discover.js
|
|
8798
8813
|
import { readdirSync as readdirSync6, readFileSync as readFileSync10, statSync as statSync5 } from "node:fs";
|
|
8799
8814
|
import { join as join10 } from "node:path";
|
|
8800
8815
|
function compareCodePoints6(left, right) {
|
|
@@ -9962,7 +9977,7 @@ function resolveStoreSessionTimestamps(session) {
|
|
|
9962
9977
|
}
|
|
9963
9978
|
var physicalOccurrences, TRANSCRIPT_STATE_RANK, RESOLUTION_REASON_ORDER;
|
|
9964
9979
|
var init_discover = __esm({
|
|
9965
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
9980
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/discover.js"() {
|
|
9966
9981
|
"use strict";
|
|
9967
9982
|
init_errors();
|
|
9968
9983
|
init_debug();
|
|
@@ -9998,7 +10013,7 @@ var init_discover = __esm({
|
|
|
9998
10013
|
}
|
|
9999
10014
|
});
|
|
10000
10015
|
|
|
10001
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
10016
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/merge.js
|
|
10002
10017
|
function normalizeText(text) {
|
|
10003
10018
|
return text.replace(/\s+/g, " ").trim();
|
|
10004
10019
|
}
|
|
@@ -10903,7 +10918,7 @@ function applyStoreMergeToSummary(existing, store, preferredSource) {
|
|
|
10903
10918
|
}
|
|
10904
10919
|
var EMPTY_PLACEHOLDER, CORRUPTED_PLACEHOLDER, SOURCE_ROLE_ORDER2, SOURCE_REPRESENTATION_ORDER, SOURCE_INSTANCE_STATE_ORDER, STORE_MESSAGE_ID_PATTERN, RESOLUTION_REASON_ORDER2;
|
|
10905
10920
|
var init_merge = __esm({
|
|
10906
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
10921
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/merge.js"() {
|
|
10907
10922
|
"use strict";
|
|
10908
10923
|
init_parser();
|
|
10909
10924
|
init_timestamps();
|
|
@@ -10939,7 +10954,7 @@ var init_merge = __esm({
|
|
|
10939
10954
|
}
|
|
10940
10955
|
});
|
|
10941
10956
|
|
|
10942
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
10957
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/storage.js
|
|
10943
10958
|
import { createHash as createHash4 } from "node:crypto";
|
|
10944
10959
|
import { existsSync as existsSync8, readdirSync as readdirSync7, readFileSync as readFileSync11 } from "node:fs";
|
|
10945
10960
|
import { join as join11 } from "node:path";
|
|
@@ -15395,7 +15410,7 @@ function updateComposerData(db, composers, isNewFormat, originalRawData) {
|
|
|
15395
15410
|
}
|
|
15396
15411
|
var SESSION_READ_CAPABILITIES, MIGRATION_CAPABILITIES, OWNING_DATABASE_READ_FAILURES, CHAT_DATA_KEYS, PROMPTS_KEY, GENERATIONS_KEY, COMPOSER_GUID_RE2, BACKUP_COMPOSER_SESSION_IDS, BACKUP_GLOBAL_COUNTERPART_SESSION_IDS, BACKUP_LINKED_GLOBAL_SESSION_IDS, BACKUP_CONTAINS_GLOBAL_DATABASE, COUNTED_COMPOSER_SESSION_IDS, sessionReadContextPrivate, nextReadContextId, UNKNOWN_WORKSPACE_PATH, RESOLUTION_SOURCE_ROLE_ORDER, RESOLUTION_REASON_ORDER3, MIN_VALID_UNIX_MS;
|
|
15397
15412
|
var init_storage = __esm({
|
|
15398
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
15413
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/storage.js"() {
|
|
15399
15414
|
"use strict";
|
|
15400
15415
|
init_database();
|
|
15401
15416
|
init_platform();
|
|
@@ -15451,7 +15466,7 @@ var init_storage = __esm({
|
|
|
15451
15466
|
}
|
|
15452
15467
|
});
|
|
15453
15468
|
|
|
15454
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
15469
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/migrate.js
|
|
15455
15470
|
import { createHash as createHash5, randomUUID as randomUUID2 } from "node:crypto";
|
|
15456
15471
|
import { existsSync as existsSync9, readdirSync as readdirSync8, statSync as statSync6 } from "node:fs";
|
|
15457
15472
|
import { join as join12 } from "node:path";
|
|
@@ -17535,7 +17550,7 @@ async function migrateWorkspace(options) {
|
|
|
17535
17550
|
};
|
|
17536
17551
|
}
|
|
17537
17552
|
var init_migrate = __esm({
|
|
17538
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
17553
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/migrate.js"() {
|
|
17539
17554
|
"use strict";
|
|
17540
17555
|
init_storage();
|
|
17541
17556
|
init_platform();
|
|
@@ -17549,7 +17564,7 @@ var init_migrate = __esm({
|
|
|
17549
17564
|
}
|
|
17550
17565
|
});
|
|
17551
17566
|
|
|
17552
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
17567
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/backup.js
|
|
17553
17568
|
async function createBackup2(config) {
|
|
17554
17569
|
return createBackup(config);
|
|
17555
17570
|
}
|
|
@@ -17566,13 +17581,13 @@ function getDefaultBackupDir2() {
|
|
|
17566
17581
|
return getDefaultBackupDir();
|
|
17567
17582
|
}
|
|
17568
17583
|
var init_backup2 = __esm({
|
|
17569
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
17584
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/backup.js"() {
|
|
17570
17585
|
"use strict";
|
|
17571
17586
|
init_backup();
|
|
17572
17587
|
}
|
|
17573
17588
|
});
|
|
17574
17589
|
|
|
17575
|
-
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
17590
|
+
// ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/index.js
|
|
17576
17591
|
var lib_exports = {};
|
|
17577
17592
|
__export(lib_exports, {
|
|
17578
17593
|
BackupError: () => BackupError,
|
|
@@ -18492,7 +18507,7 @@ function getActiveDriver2() {
|
|
|
18492
18507
|
}
|
|
18493
18508
|
var publicReadContexts;
|
|
18494
18509
|
var init_lib = __esm({
|
|
18495
|
-
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=
|
|
18510
|
+
"../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/index.js"() {
|
|
18496
18511
|
"use strict";
|
|
18497
18512
|
init_types2();
|
|
18498
18513
|
init_errors3();
|
|
@@ -18891,7 +18906,7 @@ function apiEquivalentCost(modelKey, t, atMs) {
|
|
|
18891
18906
|
}
|
|
18892
18907
|
|
|
18893
18908
|
// src/version.ts
|
|
18894
|
-
var CLI_VERSION = true ? "0.16.
|
|
18909
|
+
var CLI_VERSION = true ? "0.16.9" : "0.0.0-dev";
|
|
18895
18910
|
|
|
18896
18911
|
// src/api.ts
|
|
18897
18912
|
var BASE_URL = process.env.AISTACK_URL || "https://aistack.to";
|
|
@@ -20406,6 +20421,12 @@ function enableTrace(write = stderrSink, startedAt = Date.now(), options = {}) {
|
|
|
20406
20421
|
function traceStartedAt() {
|
|
20407
20422
|
return startedAtMs;
|
|
20408
20423
|
}
|
|
20424
|
+
function traceRenderOptions() {
|
|
20425
|
+
return { color: colored, ...columns !== void 0 ? { columns } : {} };
|
|
20426
|
+
}
|
|
20427
|
+
function traceLine(line) {
|
|
20428
|
+
sink?.(line);
|
|
20429
|
+
}
|
|
20409
20430
|
function traceEnabled() {
|
|
20410
20431
|
return sink !== null;
|
|
20411
20432
|
}
|
|
@@ -24010,9 +24031,10 @@ function noteConfiguredMcpServers(agg, serverNames) {
|
|
|
24010
24031
|
|
|
24011
24032
|
// src/harness/codex/scan.ts
|
|
24012
24033
|
import { readFileSync as readFileSync6 } from "node:fs";
|
|
24013
|
-
import { readdir as readdir3, realpath as realpath2, stat as stat3 } from "node:fs/promises";
|
|
24034
|
+
import { open, readdir as readdir3, realpath as realpath2, stat as stat3 } from "node:fs/promises";
|
|
24014
24035
|
import { homedir as homedir7 } from "node:os";
|
|
24015
24036
|
import path3 from "node:path";
|
|
24037
|
+
import { Readable } from "node:stream";
|
|
24016
24038
|
import * as zlib from "node:zlib";
|
|
24017
24039
|
import { parse as parseToml2 } from "smol-toml";
|
|
24018
24040
|
function codexHome() {
|
|
@@ -24040,7 +24062,8 @@ async function* walkRollouts(dir) {
|
|
|
24040
24062
|
else if (e.isFile() && isRolloutFile(e.name)) yield full;
|
|
24041
24063
|
}
|
|
24042
24064
|
}
|
|
24043
|
-
var
|
|
24065
|
+
var createZstdDecompress2 = typeof zlib.createZstdDecompress === "function" ? zlib.createZstdDecompress : null;
|
|
24066
|
+
var MAX_LINE_BYTES = 64 * 1024 * 1024;
|
|
24044
24067
|
async function scan2(agg, opts = {}) {
|
|
24045
24068
|
const stats = emptyScanStats();
|
|
24046
24069
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -24077,7 +24100,7 @@ async function scan2(agg, opts = {}) {
|
|
|
24077
24100
|
agg.files++;
|
|
24078
24101
|
stats.filesRead++;
|
|
24079
24102
|
if (opts.onProgress && agg.files % 20 === 0) opts.onProgress(agg.files);
|
|
24080
|
-
const outcome = ingestWithRetry(agg, file, opts);
|
|
24103
|
+
const outcome = await ingestWithRetry(agg, file, opts);
|
|
24081
24104
|
if (!outcome.ok) {
|
|
24082
24105
|
stats.filesUnreadable++;
|
|
24083
24106
|
stats.filesRead--;
|
|
@@ -24113,14 +24136,14 @@ function errorClass(e) {
|
|
|
24113
24136
|
return e instanceof Error ? e.constructor.name : "unknown";
|
|
24114
24137
|
}
|
|
24115
24138
|
var readError = (reason) => Object.assign(new Error(reason), { code: reason });
|
|
24116
|
-
function ingestWithRetry(agg, file, opts) {
|
|
24139
|
+
async function ingestWithRetry(agg, file, opts) {
|
|
24117
24140
|
try {
|
|
24118
|
-
return ingestFile2(agg, file, opts);
|
|
24141
|
+
return await ingestFile2(agg, file, opts);
|
|
24119
24142
|
} catch (e) {
|
|
24120
24143
|
traceError("codex rollout read", e);
|
|
24121
24144
|
if (errorClass(e) === "ENOENT" && !file.endsWith(".zst")) {
|
|
24122
24145
|
try {
|
|
24123
|
-
return ingestFile2(agg, `${file}.zst`, opts);
|
|
24146
|
+
return await ingestFile2(agg, `${file}.zst`, opts);
|
|
24124
24147
|
} catch (e2) {
|
|
24125
24148
|
traceError("codex compressed rollout retry", e2);
|
|
24126
24149
|
return { ok: false, reason: errorClass(e2) };
|
|
@@ -24129,56 +24152,125 @@ function ingestWithRetry(agg, file, opts) {
|
|
|
24129
24152
|
return { ok: false, reason: errorClass(e) };
|
|
24130
24153
|
}
|
|
24131
24154
|
}
|
|
24132
|
-
function ingestFile2(agg, file, opts) {
|
|
24133
|
-
const
|
|
24134
|
-
|
|
24135
|
-
|
|
24136
|
-
|
|
24137
|
-
|
|
24138
|
-
|
|
24139
|
-
|
|
24140
|
-
|
|
24141
|
-
|
|
24142
|
-
|
|
24143
|
-
|
|
24155
|
+
async function ingestFile2(agg, file, opts) {
|
|
24156
|
+
const compressed = file.endsWith(".zst");
|
|
24157
|
+
if (compressed && !createZstdDecompress2) throw readError("zstd-unsupported");
|
|
24158
|
+
const handle = await open(file, "r");
|
|
24159
|
+
try {
|
|
24160
|
+
const { size } = await handle.stat();
|
|
24161
|
+
let nonEmptyLines = 0;
|
|
24162
|
+
let parseErrors = 0;
|
|
24163
|
+
async function* records(count2) {
|
|
24164
|
+
if (size === 0) return;
|
|
24165
|
+
async function* chunks() {
|
|
24166
|
+
for (let position = 0; position < size; ) {
|
|
24167
|
+
const buffer = Buffer.allocUnsafe(
|
|
24168
|
+
Math.min(opts.chunkBytes ?? 64 * 1024, size - position)
|
|
24169
|
+
);
|
|
24170
|
+
const { bytesRead } = await handle.read(
|
|
24171
|
+
buffer,
|
|
24172
|
+
0,
|
|
24173
|
+
buffer.length,
|
|
24174
|
+
position
|
|
24175
|
+
);
|
|
24176
|
+
if (bytesRead === 0) throw readError("rollout-truncated");
|
|
24177
|
+
position += bytesRead;
|
|
24178
|
+
yield buffer.subarray(0, bytesRead);
|
|
24179
|
+
}
|
|
24180
|
+
}
|
|
24181
|
+
const source = opts.readStreamImpl ? opts.readStreamImpl(file, {
|
|
24182
|
+
start: 0,
|
|
24183
|
+
end: size - 1,
|
|
24184
|
+
highWaterMark: opts.chunkBytes ?? 64 * 1024
|
|
24185
|
+
}) : Readable.from(chunks(), { objectMode: false });
|
|
24186
|
+
let sourceError;
|
|
24187
|
+
const decoder = compressed ? createZstdDecompress2?.() : void 0;
|
|
24188
|
+
source.on("error", (error) => {
|
|
24189
|
+
sourceError = error;
|
|
24190
|
+
decoder?.destroy(error);
|
|
24191
|
+
});
|
|
24192
|
+
const stream = decoder ? source.pipe(decoder) : source;
|
|
24193
|
+
try {
|
|
24194
|
+
for await (const line of boundedLines(
|
|
24195
|
+
stream,
|
|
24196
|
+
opts.maxLineBytes ?? MAX_LINE_BYTES
|
|
24197
|
+
)) {
|
|
24198
|
+
if (line === "") continue;
|
|
24199
|
+
if (count2) nonEmptyLines++;
|
|
24200
|
+
let record;
|
|
24201
|
+
try {
|
|
24202
|
+
if (line === null) throw readError("record-too-large");
|
|
24203
|
+
record = JSON.parse(line);
|
|
24204
|
+
} catch (error) {
|
|
24205
|
+
if (count2) {
|
|
24206
|
+
if (parseErrors === 0)
|
|
24207
|
+
traceError("codex rollout JSON (first failure)", error, "warn");
|
|
24208
|
+
parseErrors++;
|
|
24209
|
+
}
|
|
24210
|
+
continue;
|
|
24211
|
+
}
|
|
24212
|
+
yield record;
|
|
24213
|
+
}
|
|
24214
|
+
} catch (error) {
|
|
24215
|
+
if (decoder && !sourceError) {
|
|
24216
|
+
traceError("codex zstd decompression", error);
|
|
24217
|
+
throw readError("zstd-corrupt");
|
|
24218
|
+
}
|
|
24219
|
+
throw sourceError ?? error;
|
|
24220
|
+
} finally {
|
|
24221
|
+
source.destroy();
|
|
24222
|
+
decoder?.destroy();
|
|
24223
|
+
}
|
|
24224
|
+
}
|
|
24225
|
+
const verdict = await classifyRollout(records(true));
|
|
24226
|
+
if (!verdict.genuine) return { ok: true, ...verdict };
|
|
24227
|
+
agg.lines += nonEmptyLines;
|
|
24228
|
+
agg.parseErrors += parseErrors;
|
|
24229
|
+
const state = createFileState();
|
|
24230
|
+
for await (const rec of records(false))
|
|
24231
|
+
ingestLine(agg, rec, state, opts.sinceMs);
|
|
24232
|
+
return { ok: true, genuine: true };
|
|
24233
|
+
} finally {
|
|
24234
|
+
await handle.close();
|
|
24144
24235
|
}
|
|
24145
|
-
|
|
24146
|
-
|
|
24147
|
-
|
|
24148
|
-
|
|
24236
|
+
}
|
|
24237
|
+
async function* boundedLines(stream, limit) {
|
|
24238
|
+
let parts = [];
|
|
24239
|
+
let length = 0;
|
|
24240
|
+
let oversized = false;
|
|
24241
|
+
for await (const chunk of stream) {
|
|
24242
|
+
const bytes = chunk;
|
|
24243
|
+
let start = 0;
|
|
24244
|
+
while (start < bytes.length) {
|
|
24149
24245
|
const newline = bytes.indexOf(10, start);
|
|
24150
24246
|
const end = newline < 0 ? bytes.length : newline;
|
|
24151
|
-
const
|
|
24152
|
-
|
|
24153
|
-
|
|
24154
|
-
|
|
24155
|
-
|
|
24156
|
-
|
|
24157
|
-
|
|
24158
|
-
}
|
|
24159
|
-
|
|
24160
|
-
|
|
24161
|
-
|
|
24162
|
-
|
|
24247
|
+
const part = bytes.subarray(start, end);
|
|
24248
|
+
if (!oversized) {
|
|
24249
|
+
length += part.length;
|
|
24250
|
+
if (length > limit) {
|
|
24251
|
+
oversized = true;
|
|
24252
|
+
parts = [];
|
|
24253
|
+
} else parts.push(part);
|
|
24254
|
+
}
|
|
24255
|
+
if (newline >= 0) {
|
|
24256
|
+
yield oversized ? null : Buffer.concat(parts, length).toString("utf8");
|
|
24257
|
+
parts = [];
|
|
24258
|
+
length = 0;
|
|
24259
|
+
oversized = false;
|
|
24163
24260
|
}
|
|
24164
|
-
|
|
24261
|
+
start = end + 1;
|
|
24165
24262
|
}
|
|
24166
24263
|
}
|
|
24167
|
-
|
|
24168
|
-
|
|
24169
|
-
agg.lines += nonEmptyLines;
|
|
24170
|
-
agg.parseErrors += parseErrors;
|
|
24171
|
-
const state = createFileState();
|
|
24172
|
-
for (const rec of records()) ingestLine(agg, rec, state, opts.sinceMs);
|
|
24173
|
-
return { ok: true, genuine: true };
|
|
24264
|
+
if (oversized || length > 0)
|
|
24265
|
+
yield oversized ? null : Buffer.concat(parts, length).toString("utf8");
|
|
24174
24266
|
}
|
|
24175
|
-
function classifyRollout(records) {
|
|
24267
|
+
async function classifyRollout(records) {
|
|
24176
24268
|
let originator = null;
|
|
24177
24269
|
let sawTurnContext = false;
|
|
24178
24270
|
let sawTokenCount = false;
|
|
24179
24271
|
let genuine = true;
|
|
24180
24272
|
let count2 = 0;
|
|
24181
|
-
for (const raw of records) {
|
|
24273
|
+
for await (const raw of records) {
|
|
24182
24274
|
const rec = asObj(raw);
|
|
24183
24275
|
const type = rec ? asStr(rec.type) : null;
|
|
24184
24276
|
const payload = rec ? asObj(rec.payload) : null;
|
|
@@ -24437,12 +24529,9 @@ async function hasLocalSource(root = dataPath()) {
|
|
|
24437
24529
|
].map(exists3)
|
|
24438
24530
|
)).some(Boolean);
|
|
24439
24531
|
}
|
|
24440
|
-
async function
|
|
24441
|
-
const out = /* @__PURE__ */ new Map();
|
|
24442
|
-
if (!session.messages.some((m) => m.identityOrigin?.startsWith("composer")))
|
|
24443
|
-
return out;
|
|
24532
|
+
async function openEvidenceDb(root) {
|
|
24444
24533
|
const file = globalDb(root);
|
|
24445
|
-
if (!await exists3(file)) return
|
|
24534
|
+
if (!await exists3(file)) return null;
|
|
24446
24535
|
const { DatabaseSync } = await import("node:sqlite");
|
|
24447
24536
|
const db = new DatabaseSync(file, { readOnly: true });
|
|
24448
24537
|
try {
|
|
@@ -24450,35 +24539,49 @@ async function readTokenEvidence(root, session) {
|
|
|
24450
24539
|
const table = db.prepare(
|
|
24451
24540
|
"SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cursorDiskKV'"
|
|
24452
24541
|
).get();
|
|
24453
|
-
if (!table)
|
|
24454
|
-
|
|
24455
|
-
|
|
24456
|
-
'usage', json_extract(value, '$.usage'),
|
|
24457
|
-
'contextWindowStatusAtCreation', json_extract(value, '$.contextWindowStatusAtCreation'),
|
|
24458
|
-
'promptDryRunInfo', json_extract(value, '$.promptDryRunInfo')) AS evidence
|
|
24459
|
-
FROM cursorDiskKV WHERE key = ?`);
|
|
24460
|
-
for (const message of session.messages) {
|
|
24461
|
-
if (!message.id || message.identityOrigin !== "composer-native") continue;
|
|
24462
|
-
const row = query.get(`bubbleId:${session.id}:${message.id}`);
|
|
24463
|
-
if (typeof row?.evidence === "string")
|
|
24464
|
-
out.set(message.id, tokenEvidence(JSON.parse(row.evidence)));
|
|
24465
|
-
}
|
|
24466
|
-
const header = db.prepare(
|
|
24467
|
-
"SELECT json_extract(value, '$.conversation') AS conversation FROM cursorDiskKV WHERE key = ?"
|
|
24468
|
-
).get(`composerData:${session.id}`);
|
|
24469
|
-
if (typeof header?.conversation === "string") {
|
|
24470
|
-
const conversation = JSON.parse(header.conversation);
|
|
24471
|
-
if (Array.isArray(conversation))
|
|
24472
|
-
for (const [index, raw] of conversation.entries()) {
|
|
24473
|
-
const obj = asObj(raw);
|
|
24474
|
-
const id = asStr(obj?.bubbleId) ?? asStr(obj?.id) ?? `msg:${index}`;
|
|
24475
|
-
if (!out.has(id)) out.set(id, tokenEvidence(raw));
|
|
24476
|
-
}
|
|
24542
|
+
if (!table) {
|
|
24543
|
+
db.close();
|
|
24544
|
+
return null;
|
|
24477
24545
|
}
|
|
24478
|
-
return
|
|
24479
|
-
|
|
24546
|
+
return {
|
|
24547
|
+
bubble: db.prepare(`SELECT json_object(
|
|
24548
|
+
'tokenCount', json_extract(value, '$.tokenCount'),
|
|
24549
|
+
'usage', json_extract(value, '$.usage'),
|
|
24550
|
+
'contextWindowStatusAtCreation', json_extract(value, '$.contextWindowStatusAtCreation'),
|
|
24551
|
+
'promptDryRunInfo', json_extract(value, '$.promptDryRunInfo')) AS evidence
|
|
24552
|
+
FROM cursorDiskKV WHERE key = ?`),
|
|
24553
|
+
header: db.prepare(
|
|
24554
|
+
"SELECT json_extract(value, '$.conversation') AS conversation FROM cursorDiskKV WHERE key = ?"
|
|
24555
|
+
),
|
|
24556
|
+
close: () => db.close()
|
|
24557
|
+
};
|
|
24558
|
+
} catch (error) {
|
|
24480
24559
|
db.close();
|
|
24560
|
+
throw error;
|
|
24561
|
+
}
|
|
24562
|
+
}
|
|
24563
|
+
function readTokenEvidence(session, db) {
|
|
24564
|
+
const out = /* @__PURE__ */ new Map();
|
|
24565
|
+
if (!db) return out;
|
|
24566
|
+
if (!session.messages.some((m) => m.identityOrigin?.startsWith("composer")))
|
|
24567
|
+
return out;
|
|
24568
|
+
for (const message of session.messages) {
|
|
24569
|
+
if (!message.id || message.identityOrigin !== "composer-native") continue;
|
|
24570
|
+
const row = db.bubble.get(`bubbleId:${session.id}:${message.id}`);
|
|
24571
|
+
if (typeof row?.evidence === "string")
|
|
24572
|
+
out.set(message.id, tokenEvidence(JSON.parse(row.evidence)));
|
|
24481
24573
|
}
|
|
24574
|
+
const header = db.header.get(`composerData:${session.id}`);
|
|
24575
|
+
if (typeof header?.conversation === "string") {
|
|
24576
|
+
const conversation = JSON.parse(header.conversation);
|
|
24577
|
+
if (Array.isArray(conversation))
|
|
24578
|
+
for (const [index, raw] of conversation.entries()) {
|
|
24579
|
+
const obj = asObj(raw);
|
|
24580
|
+
const id = asStr(obj?.bubbleId) ?? asStr(obj?.id) ?? `msg:${index}`;
|
|
24581
|
+
if (!out.has(id)) out.set(id, tokenEvidence(raw));
|
|
24582
|
+
}
|
|
24583
|
+
}
|
|
24584
|
+
return out;
|
|
24482
24585
|
}
|
|
24483
24586
|
async function sourceStamp(root) {
|
|
24484
24587
|
const values = await Promise.all(
|
|
@@ -24494,19 +24597,27 @@ async function sourceStamp(root) {
|
|
|
24494
24597
|
return values.join("/");
|
|
24495
24598
|
}
|
|
24496
24599
|
var localReads = /* @__PURE__ */ new Map();
|
|
24600
|
+
var readWindowSinceMs;
|
|
24601
|
+
function setCursorReadWindow(sinceMs) {
|
|
24602
|
+
readWindowSinceMs = sinceMs;
|
|
24603
|
+
}
|
|
24604
|
+
function covers(held, wanted) {
|
|
24605
|
+
return held === void 0 || wanted !== void 0 && held <= wanted;
|
|
24606
|
+
}
|
|
24497
24607
|
async function readLocal(root = dataPath(), onProgress) {
|
|
24498
24608
|
const held = localReads.get(root);
|
|
24499
|
-
if (held) {
|
|
24609
|
+
if (held && covers(held.sinceMs, readWindowSinceMs)) {
|
|
24500
24610
|
trace("cursor \xB7 reusing this run's history read");
|
|
24501
24611
|
return held.read;
|
|
24502
24612
|
}
|
|
24613
|
+
if (held) trace("cursor \xB7 widening this run's history read");
|
|
24503
24614
|
if (!await hasLocalSource(root)) {
|
|
24504
24615
|
trace("cursor \xB7 no local source");
|
|
24505
24616
|
return { sessions: [], complete: true, stats: emptyScanStats() };
|
|
24506
24617
|
}
|
|
24507
24618
|
const stamp = await sourceStamp(root);
|
|
24508
24619
|
const read3 = readLocalOffThread(root, stamp, onProgress);
|
|
24509
|
-
localReads.set(root, { stamp, read: read3 });
|
|
24620
|
+
localReads.set(root, { stamp, sinceMs: readWindowSinceMs, read: read3 });
|
|
24510
24621
|
return read3;
|
|
24511
24622
|
}
|
|
24512
24623
|
function workerFile() {
|
|
@@ -24529,12 +24640,16 @@ async function readLocalOffThread(root, before, onProgress) {
|
|
|
24529
24640
|
workerData: {
|
|
24530
24641
|
root,
|
|
24531
24642
|
before,
|
|
24643
|
+
sinceMs: readWindowSinceMs,
|
|
24532
24644
|
trace: traceEnabled(),
|
|
24533
|
-
traceStartedAt: traceStartedAt()
|
|
24645
|
+
traceStartedAt: traceStartedAt(),
|
|
24646
|
+
traceColor: traceRenderOptions().color,
|
|
24647
|
+
traceColumns: traceRenderOptions().columns
|
|
24534
24648
|
}
|
|
24535
24649
|
});
|
|
24536
24650
|
worker.on("message", (message) => {
|
|
24537
|
-
if (message.kind === "
|
|
24651
|
+
if (message.kind === "trace") traceLine(message.line);
|
|
24652
|
+
else if (message.kind === "progress")
|
|
24538
24653
|
onProgress?.(message.files, message.total);
|
|
24539
24654
|
else if (message.kind === "result") settle(() => resolve3(message.read));
|
|
24540
24655
|
else
|
|
@@ -24559,7 +24674,29 @@ async function readLocalOffThread(root, before, onProgress) {
|
|
|
24559
24674
|
});
|
|
24560
24675
|
});
|
|
24561
24676
|
}
|
|
24562
|
-
|
|
24677
|
+
var STALL_MS = 12e4;
|
|
24678
|
+
var SLOW_SESSION_MS = 2e3;
|
|
24679
|
+
var READ_WINDOW_MARGIN_MS = 864e5;
|
|
24680
|
+
function summaryNewestMs(summary) {
|
|
24681
|
+
if (summary.resolutionState === "ambiguous") return null;
|
|
24682
|
+
let newest = null;
|
|
24683
|
+
for (const [iso, source] of [
|
|
24684
|
+
[summary.metadata?.lastModified, summary.lastUpdatedAtSource],
|
|
24685
|
+
[summary.timestamp, summary.createdAtSource]
|
|
24686
|
+
]) {
|
|
24687
|
+
if (source === "epoch-unknown" || typeof iso !== "string") continue;
|
|
24688
|
+
const ms = Date.parse(iso);
|
|
24689
|
+
if (!Number.isFinite(ms) || ms <= 0) continue;
|
|
24690
|
+
newest = newest === null ? ms : Math.max(newest, ms);
|
|
24691
|
+
}
|
|
24692
|
+
return newest;
|
|
24693
|
+
}
|
|
24694
|
+
function olderThanWindow(summary, sinceMs) {
|
|
24695
|
+
if (sinceMs === void 0) return false;
|
|
24696
|
+
const newest = summaryNewestMs(summary);
|
|
24697
|
+
return newest !== null && newest < sinceMs - READ_WINDOW_MARGIN_MS;
|
|
24698
|
+
}
|
|
24699
|
+
async function readLocalOnce(root, before, onProgress, sourceReadLimits, stallMs = STALL_MS, sinceMs = readWindowSinceMs) {
|
|
24563
24700
|
before ??= await sourceStamp(root);
|
|
24564
24701
|
const stats = emptyScanStats();
|
|
24565
24702
|
const out = { sessions: [], complete: true, stats };
|
|
@@ -24570,20 +24707,41 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
|
|
|
24570
24707
|
trace(`cursor \xB7 global database ${await globalDbSize(root)}`);
|
|
24571
24708
|
const readDone = traceTimer("cursor history read");
|
|
24572
24709
|
let context;
|
|
24710
|
+
let evidence;
|
|
24573
24711
|
let retrySmallPage = false;
|
|
24574
24712
|
let unresolved = 0;
|
|
24575
24713
|
let corrupted = 0;
|
|
24576
24714
|
let ambiguous = 0;
|
|
24715
|
+
let encodingInvalid = 0;
|
|
24716
|
+
let total;
|
|
24717
|
+
let stage = "reader setup";
|
|
24718
|
+
const stall = new AbortController();
|
|
24719
|
+
const { signal } = stall;
|
|
24720
|
+
let stallTimer;
|
|
24721
|
+
const progressed = () => {
|
|
24722
|
+
if (signal.aborted) return;
|
|
24723
|
+
clearTimeout(stallTimer);
|
|
24724
|
+
stallTimer = setTimeout(() => {
|
|
24725
|
+
const error = new Error(
|
|
24726
|
+
`cursor read stalled: no progress for ${Math.round(stallMs / 1e3)} s`
|
|
24727
|
+
);
|
|
24728
|
+
error.name = "AbortError";
|
|
24729
|
+
stall.abort(error);
|
|
24730
|
+
}, stallMs);
|
|
24731
|
+
stallTimer.unref?.();
|
|
24732
|
+
};
|
|
24733
|
+
progressed();
|
|
24577
24734
|
try {
|
|
24578
24735
|
const reader = await Promise.resolve().then(() => (init_lib(), lib_exports));
|
|
24579
24736
|
const options = {
|
|
24580
24737
|
dataPath: root,
|
|
24581
24738
|
sqliteDriver: "node:sqlite",
|
|
24582
24739
|
onDiagnostic: (diagnostic) => {
|
|
24740
|
+
if (signal.aborted) return;
|
|
24583
24741
|
traceError("cursor source diagnostic", diagnostic, "warn");
|
|
24584
24742
|
out.complete = false;
|
|
24585
24743
|
},
|
|
24586
|
-
signal
|
|
24744
|
+
signal
|
|
24587
24745
|
};
|
|
24588
24746
|
context = reader.createSessionReadContext({ ...options, sourceReadLimits });
|
|
24589
24747
|
const config = { ...options, readContext: context };
|
|
@@ -24592,19 +24750,30 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
|
|
|
24592
24750
|
const pageDone = traceTimer(
|
|
24593
24751
|
offset === 0 ? "cursor session listing" : "cursor session page"
|
|
24594
24752
|
);
|
|
24753
|
+
stage = "session listing";
|
|
24595
24754
|
const page = await reader.listSessionSummaries({
|
|
24596
24755
|
...config,
|
|
24597
24756
|
offset,
|
|
24598
24757
|
limit: 100
|
|
24599
24758
|
});
|
|
24759
|
+
progressed();
|
|
24600
24760
|
pageDone(`${page.data.length} of ${page.pagination.total} sessions`);
|
|
24601
|
-
|
|
24761
|
+
total = page.pagination.total;
|
|
24762
|
+
if (offset === 0) onProgress?.(0, total);
|
|
24602
24763
|
for (const summary of page.data) {
|
|
24764
|
+
if (olderThanWindow(summary, sinceMs)) {
|
|
24765
|
+
stats.filesSkippedByMtime++;
|
|
24766
|
+
onProgress?.(stats.filesRead + stats.filesSkippedByMtime, total);
|
|
24767
|
+
continue;
|
|
24768
|
+
}
|
|
24603
24769
|
stats.filesFound++;
|
|
24604
24770
|
if (summary.resolutionState === "ambiguous") {
|
|
24605
24771
|
out.complete = false;
|
|
24606
24772
|
}
|
|
24773
|
+
const position = `${stats.filesRead + stats.filesUnreadable + stats.filesSkippedByMtime + 1} of ${total}`;
|
|
24774
|
+
const sessionStartedMs = Date.now();
|
|
24607
24775
|
try {
|
|
24776
|
+
stage = "session read";
|
|
24608
24777
|
const session = await reader.getSession(summary.id, config);
|
|
24609
24778
|
if (session.resolutionState !== "complete" || session.messages.some((m) => m.metadata?.corrupted)) {
|
|
24610
24779
|
if (session.resolutionState !== "complete") unresolved++;
|
|
@@ -24612,18 +24781,29 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
|
|
|
24612
24781
|
corrupted++;
|
|
24613
24782
|
out.complete = false;
|
|
24614
24783
|
}
|
|
24615
|
-
|
|
24784
|
+
stage = "token evidence";
|
|
24785
|
+
if (evidence === void 0) evidence = await openEvidenceDb(root);
|
|
24786
|
+
const tokens = readTokenEvidence(session, evidence);
|
|
24616
24787
|
out.sessions.push({ session, tokens });
|
|
24617
24788
|
stats.filesRead++;
|
|
24618
|
-
|
|
24789
|
+
const elapsedMs = Date.now() - sessionStartedMs;
|
|
24790
|
+
if (elapsedMs >= SLOW_SESSION_MS)
|
|
24791
|
+
trace(
|
|
24792
|
+
`cursor slow session \xB7 ${position} \xB7 ${elapsedMs} ms \xB7 ${session.messages.length} messages, ${tokens.size} bubbles with token evidence`,
|
|
24793
|
+
"warn"
|
|
24794
|
+
);
|
|
24795
|
+
onProgress?.(stats.filesRead + stats.filesSkippedByMtime, total);
|
|
24619
24796
|
} catch (error) {
|
|
24620
|
-
if (isPageByteLimit(error)) throw error;
|
|
24621
|
-
|
|
24622
|
-
|
|
24797
|
+
if (signal.aborted || isPageByteLimit(error)) throw error;
|
|
24798
|
+
const code = traceErrorCode(error);
|
|
24799
|
+
if (code === "SESSION_AMBIGUOUS") ambiguous++;
|
|
24800
|
+
else if (code === "SOURCE_ENCODING_INVALID") encodingInvalid++;
|
|
24801
|
+
else traceError(`cursor ${stage}`, error, "warn");
|
|
24623
24802
|
out.complete = false;
|
|
24624
24803
|
stats.filesUnreadable++;
|
|
24625
24804
|
} finally {
|
|
24626
24805
|
context.releaseSession(summary.id);
|
|
24806
|
+
progressed();
|
|
24627
24807
|
}
|
|
24628
24808
|
}
|
|
24629
24809
|
if (!page.pagination.hasMore) break;
|
|
@@ -24638,15 +24818,34 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
|
|
|
24638
24818
|
offset += page.data.length;
|
|
24639
24819
|
}
|
|
24640
24820
|
} catch (error) {
|
|
24641
|
-
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
|
|
24821
|
+
if (signal.aborted) {
|
|
24822
|
+
const inFlight = stage === "session listing" ? 0 : 1;
|
|
24823
|
+
const skipped = Math.max(
|
|
24824
|
+
0,
|
|
24825
|
+
(total ?? 0) - stats.filesRead - stats.filesUnreadable - stats.filesSkippedByMtime - inFlight
|
|
24826
|
+
);
|
|
24827
|
+
trace(
|
|
24828
|
+
`cursor read stalled \xB7 no progress for ${Math.round(stallMs / 1e3)} s during ${stage} \xB7 ${stats.filesRead} sessions kept, ${skipped} skipped`,
|
|
24829
|
+
"warn"
|
|
24830
|
+
);
|
|
24831
|
+
stats.unreadableFiles.push({ path: "history", reason: "STALLED" });
|
|
24832
|
+
} else {
|
|
24833
|
+
traceError(`cursor ${stage}`, error);
|
|
24834
|
+
retrySmallPage = isPageByteLimit(error) && sourceReadLimits?.sqlitePageRows !== 1;
|
|
24835
|
+
stats.unreadableFiles.push({
|
|
24836
|
+
path: "history",
|
|
24837
|
+
reason: traceErrorCode(error)
|
|
24838
|
+
});
|
|
24839
|
+
}
|
|
24647
24840
|
out.complete = false;
|
|
24648
24841
|
stats.filesUnreadable++;
|
|
24649
24842
|
} finally {
|
|
24843
|
+
clearTimeout(stallTimer);
|
|
24844
|
+
try {
|
|
24845
|
+
evidence?.close();
|
|
24846
|
+
} catch (error) {
|
|
24847
|
+
traceError("cursor evidence database close", error, "warn");
|
|
24848
|
+
}
|
|
24650
24849
|
try {
|
|
24651
24850
|
await context?.dispose();
|
|
24652
24851
|
} catch (error) {
|
|
@@ -24659,11 +24858,19 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
|
|
|
24659
24858
|
"page byte limit reached; retrying with one SQLite row per page",
|
|
24660
24859
|
"warn"
|
|
24661
24860
|
);
|
|
24662
|
-
return readLocalOnce(
|
|
24663
|
-
|
|
24664
|
-
|
|
24665
|
-
|
|
24861
|
+
return readLocalOnce(
|
|
24862
|
+
root,
|
|
24863
|
+
before,
|
|
24864
|
+
onProgress,
|
|
24865
|
+
{ ...sourceReadLimits, sqlitePageRows: 1 },
|
|
24866
|
+
stallMs,
|
|
24867
|
+
sinceMs
|
|
24868
|
+
);
|
|
24666
24869
|
}
|
|
24870
|
+
if (stats.filesSkippedByMtime)
|
|
24871
|
+
trace(
|
|
24872
|
+
`cursor \xB7 ${stats.filesSkippedByMtime} sessions older than the window skipped`
|
|
24873
|
+
);
|
|
24667
24874
|
if (before !== await sourceStamp(root)) {
|
|
24668
24875
|
trace(
|
|
24669
24876
|
"cursor history incomplete \xB7 database changed during the read",
|
|
@@ -24671,12 +24878,17 @@ async function readLocalOnce(root, before, onProgress, sourceReadLimits) {
|
|
|
24671
24878
|
);
|
|
24672
24879
|
out.complete = false;
|
|
24673
24880
|
}
|
|
24674
|
-
if (unresolved || corrupted || ambiguous) {
|
|
24881
|
+
if (unresolved || corrupted || ambiguous || encodingInvalid) {
|
|
24675
24882
|
trace(
|
|
24676
|
-
`cursor partial history \xB7 ${unresolved} sessions unresolved, ${corrupted} with corrupted messages, ${ambiguous} skipped with conflicting copies${ambiguous ? " (SESSION_AMBIGUOUS)" : ""} \xB7 available dated usage retained`,
|
|
24883
|
+
`cursor partial history \xB7 ${unresolved} sessions unresolved, ${corrupted} with corrupted messages, ${ambiguous} skipped with conflicting copies${ambiguous ? " (SESSION_AMBIGUOUS)" : ""}, ${encodingInvalid} skipped with non-UTF-8 payloads${encodingInvalid ? " (SOURCE_ENCODING_INVALID)" : ""} \xB7 available dated usage retained`,
|
|
24677
24884
|
"warn"
|
|
24678
24885
|
);
|
|
24679
24886
|
}
|
|
24887
|
+
if (encodingInvalid)
|
|
24888
|
+
stats.unreadableFiles.push({
|
|
24889
|
+
path: `${encodingInvalid} session${encodingInvalid === 1 ? "" : "s"} skipped`,
|
|
24890
|
+
reason: "non-UTF-8 payload"
|
|
24891
|
+
});
|
|
24680
24892
|
readDone(
|
|
24681
24893
|
`${stats.filesRead}/${stats.filesFound} sessions read, ${stats.filesUnreadable} unreadable${out.complete ? "" : ", incomplete"}`,
|
|
24682
24894
|
out.complete ? "success" : "warn"
|
|
@@ -24764,6 +24976,23 @@ function apiContribution(value) {
|
|
|
24764
24976
|
};
|
|
24765
24977
|
}
|
|
24766
24978
|
async function fetchWindow(account, from, to, fetchImpl = fetch) {
|
|
24979
|
+
const budget = { requests: 0, signal: AbortSignal.timeout(3e5) };
|
|
24980
|
+
async function read3(start, end) {
|
|
24981
|
+
try {
|
|
24982
|
+
return await fetchPages(account, start, end, fetchImpl, budget);
|
|
24983
|
+
} catch (error) {
|
|
24984
|
+
if (traceErrorCode(error) !== "CURSOR_PAGE_LIMIT" || end - start <= 1)
|
|
24985
|
+
throw error;
|
|
24986
|
+
const middle = start + Math.floor((end - start) / 2);
|
|
24987
|
+
trace("cursor account usage \xB7 splitting capped date window");
|
|
24988
|
+
const left = await read3(start, middle);
|
|
24989
|
+
const right = await read3(middle, end);
|
|
24990
|
+
return [...left, ...right];
|
|
24991
|
+
}
|
|
24992
|
+
}
|
|
24993
|
+
return read3(from, to);
|
|
24994
|
+
}
|
|
24995
|
+
async function fetchPages(account, from, to, fetchImpl, budget) {
|
|
24767
24996
|
const out = [];
|
|
24768
24997
|
const pages = /* @__PURE__ */ new Set();
|
|
24769
24998
|
const eventIds = /* @__PURE__ */ new Set();
|
|
@@ -24771,12 +25000,17 @@ async function fetchWindow(account, from, to, fetchImpl = fetch) {
|
|
|
24771
25000
|
let retrieved = 0;
|
|
24772
25001
|
const pageSize = 100;
|
|
24773
25002
|
for (let page = 1; page <= 100; page++) {
|
|
25003
|
+
budget.signal.throwIfAborted();
|
|
25004
|
+
if (++budget.requests > 1e3)
|
|
25005
|
+
throw Object.assign(new Error("Cursor request budget"), {
|
|
25006
|
+
code: "CURSOR_REQUEST_LIMIT"
|
|
25007
|
+
});
|
|
24774
25008
|
const response = await fetchImpl(
|
|
24775
25009
|
"https://cursor.com/api/dashboard/get-filtered-usage-events",
|
|
24776
25010
|
{
|
|
24777
25011
|
method: "POST",
|
|
24778
25012
|
redirect: "error",
|
|
24779
|
-
signal: AbortSignal.timeout(15e3),
|
|
25013
|
+
signal: AbortSignal.any([budget.signal, AbortSignal.timeout(15e3)]),
|
|
24780
25014
|
headers: {
|
|
24781
25015
|
"Content-Type": "application/json",
|
|
24782
25016
|
Origin: "https://cursor.com",
|
|
@@ -24811,6 +25045,10 @@ async function fetchWindow(account, from, to, fetchImpl = fetch) {
|
|
|
24811
25045
|
code: "CURSOR_PAGE_COUNT_CHANGED"
|
|
24812
25046
|
});
|
|
24813
25047
|
total = reported;
|
|
25048
|
+
if (total > 100 * pageSize)
|
|
25049
|
+
throw Object.assign(new Error("Cursor page limit"), {
|
|
25050
|
+
code: "CURSOR_PAGE_LIMIT"
|
|
25051
|
+
});
|
|
24814
25052
|
}
|
|
24815
25053
|
if (events.length) {
|
|
24816
25054
|
const key2 = digest(JSON.stringify(events));
|
|
@@ -24901,26 +25139,36 @@ async function saveCache(file, value) {
|
|
|
24901
25139
|
await writeFile(temporary, JSON.stringify(value), { mode: 384 });
|
|
24902
25140
|
await rename(temporary, file);
|
|
24903
25141
|
}
|
|
25142
|
+
var REFRESH_MS = 3e5;
|
|
24904
25143
|
var WINDOW_MS = 30 * 864e5;
|
|
24905
25144
|
async function refreshAccount(input) {
|
|
24906
25145
|
const { cache, account, now, sessionIds } = input;
|
|
24907
|
-
if (!account) return cache;
|
|
25146
|
+
if (!account || !sessionIds.size) return cache;
|
|
25147
|
+
const state = input.state;
|
|
25148
|
+
if (state && state.account !== account.scope) {
|
|
25149
|
+
state.account = account.scope;
|
|
25150
|
+
state.windows = {};
|
|
25151
|
+
state.failedAt = void 0;
|
|
25152
|
+
}
|
|
24908
25153
|
const changed = cache.account !== account.scope;
|
|
24909
25154
|
const next = {
|
|
24910
25155
|
...cache,
|
|
24911
25156
|
account: account.scope,
|
|
24912
|
-
windows: changed ? {} :
|
|
25157
|
+
windows: { ...changed ? {} : cache.windows, ...state?.windows }
|
|
24913
25158
|
};
|
|
25159
|
+
if (state?.failedAt !== void 0 && now - state.failedAt < REFRESH_MS)
|
|
25160
|
+
return next;
|
|
24914
25161
|
for (let from = Math.floor(input.sinceMs / WINDOW_MS) * WINDOW_MS; from <= now; from += WINDOW_MS) {
|
|
24915
25162
|
const to = Math.min(from + WINDOW_MS, now + 1);
|
|
24916
25163
|
const key2 = String(from);
|
|
24917
25164
|
const previous = next.windows[key2];
|
|
24918
|
-
if (previous && now - previous.fetchedAt <
|
|
25165
|
+
if (previous && now - previous.fetchedAt < REFRESH_MS) continue;
|
|
24919
25166
|
try {
|
|
24920
25167
|
const events = (await fetchWindow(account, from, to, input.fetchImpl)).filter((e) => sessionIds.has(e.session));
|
|
24921
25168
|
if (previous?.events.length && events.length === 0 && to <= now) continue;
|
|
24922
25169
|
next.windows[key2] = { from, to, fetchedAt: now, events };
|
|
24923
25170
|
} catch (error) {
|
|
25171
|
+
if (state) state.failedAt = now;
|
|
24924
25172
|
traceError(
|
|
24925
25173
|
"cursor account usage refresh (using local and previously cached usage)",
|
|
24926
25174
|
error,
|
|
@@ -24929,6 +25177,7 @@ async function refreshAccount(input) {
|
|
|
24929
25177
|
break;
|
|
24930
25178
|
}
|
|
24931
25179
|
}
|
|
25180
|
+
if (state) state.windows = next.windows;
|
|
24932
25181
|
return next;
|
|
24933
25182
|
}
|
|
24934
25183
|
function cachedEvents(cache, sessionIds) {
|
|
@@ -25083,6 +25332,7 @@ function projectHistory(options) {
|
|
|
25083
25332
|
}
|
|
25084
25333
|
|
|
25085
25334
|
// src/harness/cursor/scan.ts
|
|
25335
|
+
var accountRefreshes = /* @__PURE__ */ new Map();
|
|
25086
25336
|
async function scan3(options) {
|
|
25087
25337
|
const root = options.root ?? dataPath();
|
|
25088
25338
|
const now = options.now ?? Date.now();
|
|
@@ -25104,14 +25354,21 @@ async function scan3(options) {
|
|
|
25104
25354
|
);
|
|
25105
25355
|
complete = false;
|
|
25106
25356
|
}
|
|
25107
|
-
const account = await (options.accountImpl ?? existingAccount)(root);
|
|
25357
|
+
const account = ids.size ? await (options.accountImpl ?? existingAccount)(root) : null;
|
|
25358
|
+
const refreshKey = JSON.stringify([root, storeRoot(), file]);
|
|
25359
|
+
let refreshState = accountRefreshes.get(refreshKey);
|
|
25360
|
+
if (!refreshState) {
|
|
25361
|
+
refreshState = {};
|
|
25362
|
+
accountRefreshes.set(refreshKey, refreshState);
|
|
25363
|
+
}
|
|
25108
25364
|
const cache = await refreshAccount({
|
|
25109
25365
|
cache: loaded.value,
|
|
25110
25366
|
account,
|
|
25111
25367
|
sinceMs: options.sinceMs,
|
|
25112
25368
|
now,
|
|
25113
25369
|
sessionIds: ids,
|
|
25114
|
-
fetchImpl: options.fetchImpl
|
|
25370
|
+
fetchImpl: options.fetchImpl,
|
|
25371
|
+
state: refreshState
|
|
25115
25372
|
});
|
|
25116
25373
|
const api = cachedEvents(cache, ids);
|
|
25117
25374
|
const native = /* @__PURE__ */ new Set();
|
|
@@ -26150,7 +26407,7 @@ function errorClass2(e) {
|
|
|
26150
26407
|
var readError2 = (reason) => Object.assign(new Error(reason), { code: reason });
|
|
26151
26408
|
async function scan5(agg, opts = {}) {
|
|
26152
26409
|
const stats = emptyScanStats();
|
|
26153
|
-
const
|
|
26410
|
+
const open4 = await loadSqlite();
|
|
26154
26411
|
const sinceMs = opts.sinceMs ?? 0;
|
|
26155
26412
|
const state = createDbFoldState();
|
|
26156
26413
|
readConfiguredMcpServers2(agg, state, opts.configFile);
|
|
@@ -26159,8 +26416,8 @@ async function scan5(agg, opts = {}) {
|
|
|
26159
26416
|
stats.filesFound++;
|
|
26160
26417
|
agg.files++;
|
|
26161
26418
|
try {
|
|
26162
|
-
if (
|
|
26163
|
-
readDb(agg, state,
|
|
26419
|
+
if (open4 === null) throw readError2("sqlite-unsupported");
|
|
26420
|
+
readDb(agg, state, open4, file, sinceMs);
|
|
26164
26421
|
stats.filesRead++;
|
|
26165
26422
|
} catch (e) {
|
|
26166
26423
|
traceError("opencode database read", e);
|
|
@@ -26188,8 +26445,8 @@ function checkMigrationCeiling(db) {
|
|
|
26188
26445
|
if (!Number.isFinite(prefix)) throw readError2("schema-unversioned");
|
|
26189
26446
|
if (prefix > OPENCODE_MIGRATION_CEILING) throw readError2("schema-too-new");
|
|
26190
26447
|
}
|
|
26191
|
-
function readDb(agg, state,
|
|
26192
|
-
const db =
|
|
26448
|
+
function readDb(agg, state, open4, file, sinceMs) {
|
|
26449
|
+
const db = open4(file);
|
|
26193
26450
|
try {
|
|
26194
26451
|
checkMigrationCeiling(db);
|
|
26195
26452
|
noteSessions(
|
|
@@ -26389,14 +26646,14 @@ function stripJsonc(text) {
|
|
|
26389
26646
|
return out.replace(/,(\s*[}\]])/g, "$1");
|
|
26390
26647
|
}
|
|
26391
26648
|
async function detectOpencode(opts) {
|
|
26392
|
-
const
|
|
26393
|
-
if (
|
|
26649
|
+
const open4 = await loadSqlite();
|
|
26650
|
+
if (open4 === null) return false;
|
|
26394
26651
|
for (const root of opts.roots ?? opencodeDataDirs()) {
|
|
26395
26652
|
for (const file of await dbFilesIn(root)) {
|
|
26396
26653
|
if (!await exists4(file)) continue;
|
|
26397
26654
|
let db = null;
|
|
26398
26655
|
try {
|
|
26399
|
-
db =
|
|
26656
|
+
db = open4(file);
|
|
26400
26657
|
checkMigrationCeiling(db);
|
|
26401
26658
|
const probe = (table) => db?.prepare(
|
|
26402
26659
|
`select 1 as hit from ${table} where time_created >= ? limit 1`
|
|
@@ -27112,7 +27369,7 @@ async function createCommand() {
|
|
|
27112
27369
|
// src/commands/login.ts
|
|
27113
27370
|
import { hostname } from "node:os";
|
|
27114
27371
|
import * as p5 from "@clack/prompts";
|
|
27115
|
-
import
|
|
27372
|
+
import open3 from "open";
|
|
27116
27373
|
function proposedMachineName(read3 = hostname) {
|
|
27117
27374
|
try {
|
|
27118
27375
|
const name = read3().trim().replace(/\.local$/i, "");
|
|
@@ -27154,7 +27411,7 @@ async function performLogin(options = {}) {
|
|
|
27154
27411
|
p5.log.info(`${dim("CODE")} ${limeBold(session.userCode)}`);
|
|
27155
27412
|
p5.log.info(`${dim("OPEN")} ${dim(session.authUrl)}`);
|
|
27156
27413
|
try {
|
|
27157
|
-
await
|
|
27414
|
+
await open3(session.authUrl);
|
|
27158
27415
|
} catch {
|
|
27159
27416
|
p5.log.warn(
|
|
27160
27417
|
"Could not open browser automatically. Please visit the URL above."
|
|
@@ -28257,7 +28514,20 @@ function extractGitWorkflow(options) {
|
|
|
28257
28514
|
let index = 0;
|
|
28258
28515
|
for (const cwd of roots.values()) {
|
|
28259
28516
|
const done = repositoryTimer(++index, roots.size);
|
|
28260
|
-
const
|
|
28517
|
+
const metadata = run(cwd, gitMetadataArgs());
|
|
28518
|
+
const parts = [];
|
|
28519
|
+
let history = metadata === null ? null : "";
|
|
28520
|
+
if (metadata !== null) {
|
|
28521
|
+
for (const args of gitDiffBatches(metadata, options)) {
|
|
28522
|
+
const part = run(cwd, args);
|
|
28523
|
+
if (part === null) {
|
|
28524
|
+
history = null;
|
|
28525
|
+
break;
|
|
28526
|
+
}
|
|
28527
|
+
parts.push(part);
|
|
28528
|
+
}
|
|
28529
|
+
if (history !== null) history = parts.join("");
|
|
28530
|
+
}
|
|
28261
28531
|
done(history);
|
|
28262
28532
|
if (history) histories.push(history);
|
|
28263
28533
|
}
|
|
@@ -28279,7 +28549,20 @@ async function extractGitWorkflowAsync(options) {
|
|
|
28279
28549
|
const worker = async () => {
|
|
28280
28550
|
for (let cwd = queue.shift(); cwd !== void 0; cwd = queue.shift()) {
|
|
28281
28551
|
const done = repositoryTimer(++index, total);
|
|
28282
|
-
const
|
|
28552
|
+
const metadata = await run(cwd, gitMetadataArgs());
|
|
28553
|
+
const parts = [];
|
|
28554
|
+
let history = metadata === null ? null : "";
|
|
28555
|
+
if (metadata !== null) {
|
|
28556
|
+
for (const args of gitDiffBatches(metadata, options)) {
|
|
28557
|
+
const part = await run(cwd, args);
|
|
28558
|
+
if (part === null) {
|
|
28559
|
+
history = null;
|
|
28560
|
+
break;
|
|
28561
|
+
}
|
|
28562
|
+
parts.push(part);
|
|
28563
|
+
}
|
|
28564
|
+
if (history !== null) history = parts.join("");
|
|
28565
|
+
}
|
|
28283
28566
|
done(history);
|
|
28284
28567
|
if (history) histories.push(history);
|
|
28285
28568
|
}
|
|
@@ -28319,17 +28602,39 @@ function countCommits(history) {
|
|
|
28319
28602
|
}
|
|
28320
28603
|
return count2;
|
|
28321
28604
|
}
|
|
28322
|
-
|
|
28323
|
-
|
|
28605
|
+
var GIT_FORMAT = `--format=%x00${COMMIT_MARKER}%x00%H%x00%aI%x00`;
|
|
28606
|
+
var GIT_DIFF_BATCH_SIZE = 128;
|
|
28607
|
+
function gitMetadataArgs() {
|
|
28608
|
+
return ["log", "--all", "--no-merges", GIT_FORMAT, "--no-patch", "-z"];
|
|
28609
|
+
}
|
|
28610
|
+
function* gitDiffBatches(metadata, options) {
|
|
28611
|
+
const fields = metadata.split("\0");
|
|
28612
|
+
let hashes = [];
|
|
28613
|
+
const args = (batch) => [
|
|
28324
28614
|
"-c",
|
|
28325
28615
|
`core.bigFileThreshold=${BIG_FILE_THRESHOLD}`,
|
|
28326
28616
|
"log",
|
|
28327
|
-
"--
|
|
28617
|
+
"--no-walk=unsorted",
|
|
28328
28618
|
"--no-merges",
|
|
28329
|
-
|
|
28619
|
+
GIT_FORMAT,
|
|
28330
28620
|
"--numstat",
|
|
28331
|
-
"-z"
|
|
28621
|
+
"-z",
|
|
28622
|
+
...batch,
|
|
28623
|
+
"--"
|
|
28332
28624
|
];
|
|
28625
|
+
for (let index = 0; index < fields.length; index++) {
|
|
28626
|
+
if (fields[index]?.replace(/^\n+/, "") !== COMMIT_MARKER) continue;
|
|
28627
|
+
const hash2 = fields[++index] ?? "";
|
|
28628
|
+
const authoredMs = Date.parse(fields[++index] ?? "");
|
|
28629
|
+
if (!/^[a-f0-9]+$/.test(hash2) || !Number.isFinite(authoredMs) || authoredMs < options.fromMs || authoredMs > options.toMs)
|
|
28630
|
+
continue;
|
|
28631
|
+
hashes.push(hash2);
|
|
28632
|
+
if (hashes.length === GIT_DIFF_BATCH_SIZE) {
|
|
28633
|
+
yield args(hashes);
|
|
28634
|
+
hashes = [];
|
|
28635
|
+
}
|
|
28636
|
+
}
|
|
28637
|
+
if (hashes.length) yield args(hashes);
|
|
28333
28638
|
}
|
|
28334
28639
|
function reduceGitHistories(histories, options) {
|
|
28335
28640
|
const days = /* @__PURE__ */ new Map();
|
|
@@ -29084,6 +29389,7 @@ async function stageSync(deps) {
|
|
|
29084
29389
|
const usageScans = [];
|
|
29085
29390
|
const sinceMs = windowStartMs(now, windowDays);
|
|
29086
29391
|
const daysSinceMs = windowStartMs(now, retentionDays);
|
|
29392
|
+
setCursorReadWindow(daysSinceMs);
|
|
29087
29393
|
const candidates = await adapters();
|
|
29088
29394
|
for (const adapter of candidates)
|
|
29089
29395
|
step(`harness:${adapter.name}`, harnessLabel2(adapter.name), "waiting");
|