@use-aistack/cli 0.16.10 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/types.js
12
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/types.js
13
13
  var MESSAGE_TYPES;
14
14
  var init_types = __esm({
15
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/types.js"() {
15
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/types.js"() {
16
16
  "use strict";
17
17
  MESSAGE_TYPES = [
18
18
  "user",
@@ -24,15 +24,15 @@ var init_types = __esm({
24
24
  }
25
25
  });
26
26
 
27
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/types.js
27
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/types.js
28
28
  var init_types2 = __esm({
29
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/types.js"() {
29
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/types.js"() {
30
30
  "use strict";
31
31
  init_types();
32
32
  }
33
33
  });
34
34
 
35
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/errors.js
35
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/errors.js
36
36
  function compareCodePoints(left, right) {
37
37
  const leftPoints = Array.from(left, (value) => value.codePointAt(0));
38
38
  const rightPoints = Array.from(right, (value) => value.codePointAt(0));
@@ -56,7 +56,7 @@ function isSessionIntegrityError(error) {
56
56
  }
57
57
  var SessionIntegrityError, WorkspaceAmbiguityError, SessionAmbiguityError, SessionScopeMismatchError, BackupWorkspaceScopeMetadataError, UnsupportedSessionMigrationError, MigrationTargetChangedError, DATABASE_CAPABILITY_ORDER, DatabaseCapabilityError, NoCapableDriverError, BackupPublishedPermissionError, BackupPublishedCleanupError, TemporaryArtifactCleanupError, RestoreRollbackError, ReadContextError, ReadContextSourceMismatchError, ReadContextScopeMismatchError, ReadContextOptionsMismatchError, ReadContextDisposedError, SourceEncodingError, SourceLimitExceededError, SourceLimitConfigurationError;
58
58
  var init_errors = __esm({
59
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/errors.js"() {
59
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/errors.js"() {
60
60
  "use strict";
61
61
  SessionIntegrityError = class _SessionIntegrityError extends Error {
62
62
  code;
@@ -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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/errors.js
327
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/errors.js
328
328
  var NoDriverAvailableError, DriverNotAvailableError, ReadonlyDatabaseError;
329
329
  var init_errors2 = __esm({
330
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/errors.js"() {
330
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/errors.js"() {
331
331
  "use strict";
332
332
  init_errors();
333
333
  NoDriverAvailableError = class extends Error {
@@ -352,7 +352,7 @@ var init_errors2 = __esm({
352
352
  }
353
353
  });
354
354
 
355
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/errors.js
355
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/errors.js
356
356
  function isDatabaseLockedError(error) {
357
357
  return error instanceof DatabaseLockedError;
358
358
  }
@@ -469,7 +469,7 @@ function isSourceLimitConfigurationError(error) {
469
469
  }
470
470
  var DatabaseLockedError, DatabaseNotFoundError, InvalidConfigError, InvalidFilterError, SessionNotFoundError, WorkspaceNotFoundError, SameWorkspaceError, NoSessionsFoundError, DestinationHasSessionsError, NestedPathError, BackupError, NoDataError, FileExistsError, InsufficientSpaceError, RestoreError, BackupNotFoundError, InvalidBackupError, TargetExistsError, IntegrityError;
471
471
  var init_errors3 = __esm({
472
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/errors.js"() {
472
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/errors.js"() {
473
473
  "use strict";
474
474
  init_errors();
475
475
  init_errors2();
@@ -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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/platform.js
721
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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 homedir9 } 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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/platform.js"() {
915
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/platform.js"() {
916
916
  "use strict";
917
917
  STORE_CHILDREN = ["chats", "projects", "acp-sessions"];
918
918
  }
919
919
  });
920
920
 
921
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/utils.js
921
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/utils.js
922
922
  function getDefaultDataPath() {
923
923
  return getCursorDataPath();
924
924
  }
925
925
  var init_utils = __esm({
926
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/utils.js"() {
926
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/utils.js"() {
927
927
  "use strict";
928
928
  init_platform();
929
929
  }
930
930
  });
931
931
 
932
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-identity.js
932
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-identity.js"() {
1180
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/session-identity.js"() {
1181
1181
  "use strict";
1182
1182
  MESSAGE_IDENTITY_VERSION = 1;
1183
1183
  REPLICA_EQUIVALENCE_VERSION = 1;
1184
1184
  }
1185
1185
  });
1186
1186
 
1187
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/timestamps.js
1187
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/timestamps.js
1188
1188
  function isValidTimestamp(value) {
1189
1189
  return value instanceof Date && Number.isFinite(value.getTime());
1190
1190
  }
@@ -1304,7 +1304,7 @@ function resolveMessageTimestamps(messages, sessionAnchor) {
1304
1304
  }
1305
1305
  var UNKNOWN_TIMESTAMP_EPOCH_MS2, DIRECT_MESSAGE_TIMESTAMP_SOURCES;
1306
1306
  var init_timestamps = __esm({
1307
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/timestamps.js"() {
1307
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/timestamps.js"() {
1308
1308
  "use strict";
1309
1309
  UNKNOWN_TIMESTAMP_EPOCH_MS2 = 0;
1310
1310
  DIRECT_MESSAGE_TIMESTAMP_SOURCES = /* @__PURE__ */ new Set([
@@ -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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/workspace-scope.js
1318
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/workspace-scope.js
1319
1319
  function compareCodePoints3(left, right) {
1320
1320
  const leftPoints = Array.from(left, (value) => value.codePointAt(0));
1321
1321
  const rightPoints = Array.from(right, (value) => value.codePointAt(0));
@@ -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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/workspace-scope.js"() {
1489
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/workspace-scope.js"() {
1490
1490
  "use strict";
1491
1491
  init_errors();
1492
1492
  init_errors();
1493
1493
  }
1494
1494
  });
1495
1495
 
1496
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/parser.js
1496
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/parser.js
1497
1497
  function serializeToolCall(tc) {
1498
1498
  const obj = { name: tc.name, status: tc.status };
1499
1499
  if (tc.id !== void 0)
@@ -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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/parser.js"() {
2253
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/parser.js"() {
2254
2254
  "use strict";
2255
2255
  init_session_identity();
2256
2256
  init_timestamps();
@@ -2297,7 +2297,7 @@ var init_parser = __esm({
2297
2297
  }
2298
2298
  });
2299
2299
 
2300
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/cli/formatters/table.js
2300
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/cli/formatters/table.js
2301
2301
  import pc from "picocolors";
2302
2302
  function isToolCall(content) {
2303
2303
  return content.startsWith("[Tool:");
@@ -2335,7 +2335,7 @@ function validateMessageTypes(types) {
2335
2335
  return types.filter((t) => !MESSAGE_TYPES.includes(t));
2336
2336
  }
2337
2337
  var init_table = __esm({
2338
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/cli/formatters/table.js"() {
2338
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/cli/formatters/table.js"() {
2339
2339
  "use strict";
2340
2340
  init_types();
2341
2341
  init_parser();
@@ -2343,7 +2343,7 @@ var init_table = __esm({
2343
2343
  }
2344
2344
  });
2345
2345
 
2346
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/config.js
2346
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/config.js
2347
2347
  function validateConfig(config) {
2348
2348
  if (!config)
2349
2349
  return;
@@ -2404,7 +2404,7 @@ function mergeWithDefaults(config) {
2404
2404
  }
2405
2405
  var VALID_SQLITE_DRIVERS;
2406
2406
  var init_config = __esm({
2407
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/config.js"() {
2407
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/config.js"() {
2408
2408
  "use strict";
2409
2409
  init_errors3();
2410
2410
  init_platform();
@@ -2412,7 +2412,7 @@ var init_config = __esm({
2412
2412
  }
2413
2413
  });
2414
2414
 
2415
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/debug.js
2415
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/debug.js
2416
2416
  function debugLog(message) {
2417
2417
  if (process.env["DEBUG"] || process.env["CURSOR_HISTORY_DEBUG"]) {
2418
2418
  console.error(`[cursor-history:sqlite] ${message}`);
@@ -2424,12 +2424,12 @@ function debugLogStorage(message) {
2424
2424
  }
2425
2425
  }
2426
2426
  var init_debug = __esm({
2427
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/debug.js"() {
2427
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/debug.js"() {
2428
2428
  "use strict";
2429
2429
  }
2430
2430
  });
2431
2431
 
2432
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/io-observer.js
2432
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/io-observer.js
2433
2433
  function requireSafeIdentity(name, value) {
2434
2434
  if (typeof value !== "string" || value.length === 0 || /[\r\n\0]/.test(value)) {
2435
2435
  throw new TypeError(`${name} must be a non-empty single-line string.`);
@@ -2477,7 +2477,7 @@ function observeAdapterIo(context, 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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/io-observer.js"() {
2480
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/io-observer.js"() {
2481
2481
  "use strict";
2482
2482
  IO_RESOURCE_CLASSIFICATIONS = Object.freeze({
2483
2483
  "workspace-root-directory": "catalog-metadata",
@@ -2516,7 +2516,7 @@ var init_io_observer = __esm({
2516
2516
  }
2517
2517
  });
2518
2518
 
2519
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/observed.js
2519
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/observed.js
2520
2520
  function requestIdentity(request2) {
2521
2521
  return request2.ioResource ?? { resourceClass: "unclassified-resource" };
2522
2522
  }
@@ -2599,7 +2599,7 @@ function observeDatabaseBackup(request2) {
2599
2599
  }
2600
2600
  var ObservedStatement, ObservedDatabase;
2601
2601
  var init_observed = __esm({
2602
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/observed.js"() {
2602
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/observed.js"() {
2603
2603
  "use strict";
2604
2604
  init_io_observer();
2605
2605
  ObservedStatement = class {
@@ -2659,13 +2659,13 @@ var init_observed = __esm({
2659
2659
  }
2660
2660
  });
2661
2661
 
2662
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/registry.js
2662
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/registry.js
2663
2663
  function missingCapabilities(profile, required) {
2664
2664
  return [...required].filter((capability) => !profile.capabilities.has(capability));
2665
2665
  }
2666
2666
  var AUTO_DRIVER_ORDER, READ_SESSION_REQUEST, MIGRATION_REQUEST, BACKUP_REQUEST, DriverRegistry, registry;
2667
2667
  var init_registry = __esm({
2668
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/registry.js"() {
2668
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/registry.js"() {
2669
2669
  "use strict";
2670
2670
  init_errors2();
2671
2671
  init_debug();
@@ -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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/better-sqlite3.js
2885
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/drivers/better-sqlite3.js
2886
2886
  function unavailableProfile(reason) {
2887
2887
  return {
2888
2888
  driver: "better-sqlite3",
@@ -2955,7 +2955,7 @@ async function loadBetterSqlite3Profile() {
2955
2955
  }
2956
2956
  var BetterSqlite3, betterSqlite3ProfilePromise, BetterSqlite3Statement, BetterSqlite3Database, betterSqlite3Driver;
2957
2957
  var init_better_sqlite3 = __esm({
2958
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/better-sqlite3.js"() {
2958
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/drivers/better-sqlite3.js"() {
2959
2959
  "use strict";
2960
2960
  init_debug();
2961
2961
  BetterSqlite3 = null;
@@ -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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/node-sqlite.js
3036
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/drivers/node-sqlite.js
3037
3037
  function unavailableProfile2(reason) {
3038
3038
  return {
3039
3039
  driver: "node:sqlite",
@@ -3128,7 +3128,7 @@ async function loadNodeSqliteProfile() {
3128
3128
  }
3129
3129
  var nodeSqliteModule, nodeSqliteProfilePromise, NodeSqliteStatementWrapper, NodeSqliteDatabaseWrapper, nodeSqliteDriver;
3130
3130
  var init_node_sqlite = __esm({
3131
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/drivers/node-sqlite.js"() {
3131
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/drivers/node-sqlite.js"() {
3132
3132
  "use strict";
3133
3133
  init_debug();
3134
3134
  init_errors2();
@@ -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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/index.js
3235
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/index.js
3236
3236
  async function openDatabase(path15, request2) {
3237
3237
  return registry.openDatabase(path15, 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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/database/index.js"() {
3258
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/database/index.js"() {
3259
3259
  "use strict";
3260
3260
  init_errors2();
3261
3261
  init_registry();
@@ -3266,7 +3266,7 @@ var init_database = __esm({
3266
3266
  }
3267
3267
  });
3268
3268
 
3269
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/private-temp.js
3269
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/private-temp.js
3270
3270
  import { chmodSync, closeSync, constants, fchmodSync, fstatSync, fsyncSync, lstatSync, mkdtempSync, openSync, readFileSync as 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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/private-temp.js"() {
3710
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/private-temp.js"() {
3711
3711
  "use strict";
3712
3712
  init_errors();
3713
3713
  PRIVATE_TEMP_MARKER_FILENAME = ".cursor-history-private-temp-v1.json";
@@ -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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/package-version.generated.js
3799
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/package-version.generated.js
3800
3800
  var PACKAGE_VERSION;
3801
3801
  var init_package_version_generated = __esm({
3802
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/package-version.generated.js"() {
3802
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/package-version.generated.js"() {
3803
3803
  "use strict";
3804
3804
  PACKAGE_VERSION = "0.18.0";
3805
3805
  }
3806
3806
  });
3807
3807
 
3808
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/source-read-limits.js
3808
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/source-read-limits.js
3809
3809
  function assertRelationship(limits, left, right) {
3810
3810
  if (limits[left] > limits[right]) {
3811
3811
  throw new SourceLimitConfigurationError(left, limits[left], `${left} must be less than or equal to ${right}`);
@@ -3905,7 +3905,7 @@ function decodeDeterministicUtf8(value, sourceKind, outcome, allowLeadingBom = t
3905
3905
  }
3906
3906
  var RESOLVED_SOURCE_READ_LIMITS, SOURCE_READ_LIMITS_V1_DEFAULTS, SOURCE_READ_LIMIT_FIELDS, SOURCE_READ_LIMIT_FIELD_SET, UTF8_BOM, JsonlSourceReadBudget, SqliteSourceReadBudget;
3907
3907
  var init_source_read_limits = __esm({
3908
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/source-read-limits.js"() {
3908
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/source-read-limits.js"() {
3909
3909
  "use strict";
3910
3910
  init_errors();
3911
3911
  RESOLVED_SOURCE_READ_LIMITS = /* @__PURE__ */ new WeakSet();
@@ -4034,7 +4034,7 @@ var init_source_read_limits = __esm({
4034
4034
  }
4035
4035
  });
4036
4036
 
4037
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/zip-stream.js
4037
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/zip-stream.js
4038
4038
  import { createHash as createHash2 } from "node:crypto";
4039
4039
  import { open as open2, unlink } from "node:fs/promises";
4040
4040
  import { Readable as Readable2, Transform, Writable } from "node:stream";
@@ -4808,7 +4808,7 @@ async function openBoundedZipArchive(path15, options) {
4808
4808
  }
4809
4809
  var EOCD_SIGNATURE, ZIP64_EOCD_SIGNATURE, ZIP64_LOCATOR_SIGNATURE, CENTRAL_FILE_SIGNATURE, LOCAL_FILE_SIGNATURE, ZIP64_EXTRA_FIELD_ID, MAX_EOCD_SEARCH_BYTES, UTF8_FLAG, ENCRYPTED_FLAG, STRONG_ENCRYPTION_FLAG, DATA_DESCRIPTOR_FLAG, STORE_METHOD, DEFLATE_METHOD, MANIFEST_MEMORY_LIMIT, STREAM_CHUNK_BYTES, ZIP_LIMIT_FIELDS, ZipArchiveFormatError, CRC32_TABLE, CompressedVerifier, OutputIntegrityVerifier, BoundedZipArchive;
4810
4810
  var init_zip_stream = __esm({
4811
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/zip-stream.js"() {
4811
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/zip-stream.js"() {
4812
4812
  "use strict";
4813
4813
  init_errors();
4814
4814
  init_source_read_limits();
@@ -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=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/composer-sqlite.js
5203
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/composer-sqlite.js
5204
5204
  function exactBlobPrefixPredicate(qualifiedKey) {
5205
5205
  return `${qualifiedKey} >= ? AND ${qualifiedKey} < ? AND ${qualifiedKey} IS NOT NULL AND substr(CAST(${qualifiedKey} AS BLOB), 1, length(CAST(? AS BLOB))) = CAST(? AS BLOB)`;
5206
5206
  }
@@ -5317,7 +5317,7 @@ function createComposerSqliteBudget(limits = SOURCE_READ_LIMITS_V1_DEFAULTS, out
5317
5317
  }
5318
5318
  function getBoundedComposerMetadataByKey(db, table, key2, budget, signal) {
5319
5319
  throwIfAborted2(signal);
5320
- const raw = db.prepare(`SELECT CAST(rowid AS TEXT) AS rowId, key, length(CAST(value AS BLOB)) AS byteLength FROM ${table} WHERE key = ? COLLATE BINARY AND value IS NOT NULL`).get(key2);
5320
+ const raw = db.prepare(`SELECT CAST(rowid AS TEXT) AS rowId, key, octet_length(value) AS byteLength FROM ${table} WHERE key = ? COLLATE BINARY AND value IS NOT NULL`).get(key2);
5321
5321
  if (!raw)
5322
5322
  return void 0;
5323
5323
  const metadata = normalizeMetadata(raw, key2);
@@ -5331,7 +5331,7 @@ function forEachBoundedComposerMetadata(db, table, keyPattern, budget, visit, si
5331
5331
  let afterKey = null;
5332
5332
  while (true) {
5333
5333
  throwIfAborted2(signal);
5334
- const rawPage = range ? db.prepare(`SELECT CAST(${table}.rowid AS TEXT) AS rowId, key, 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);
5334
+ const rawPage = range ? db.prepare(`SELECT CAST(${table}.rowid AS TEXT) AS rowId, key, octet_length(value) AS byteLength FROM ${table} WHERE ${keyPagePredicate(`${table}.key`, afterKey)} AND key LIKE ? ESCAPE '\\' AND value IS NOT NULL ORDER BY ${table}.key ASC LIMIT ?`).all(afterKey ?? range.lower, range.upper, keyPattern, pageRows) : db.prepare(`SELECT CAST(${table}.rowid AS TEXT) AS rowId, key, octet_length(value) AS byteLength FROM ${table} WHERE key LIKE ? ESCAPE '\\' AND value IS NOT NULL AND ${table}.rowid > COALESCE(?, -1) ORDER BY ${table}.rowid ASC LIMIT ?`).all(keyPattern, afterRowId, pageRows);
5335
5335
  if (rawPage.length === 0)
5336
5336
  break;
5337
5337
  const fallbackBase = typeof afterRowId === "number" && Number.isSafeInteger(afterRowId) ? afterRowId : -1;
@@ -5355,7 +5355,7 @@ function forEachBoundedComposerBubbleMetadata(db, keyPattern, budget, visit, sig
5355
5355
  let afterKey = null;
5356
5356
  while (true) {
5357
5357
  throwIfAborted2(signal);
5358
- const rawPage = range ? db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(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);
5358
+ const rawPage = range ? db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(octet_length(value), 0) AS byteLength, octet_length(value) IS NULL AS valueIsNull FROM cursorDiskKV WHERE ${keyPagePredicate("cursorDiskKV.key", afterKey)} AND key LIKE ? ESCAPE '\\' ORDER BY cursorDiskKV.key ASC LIMIT ?`).all(afterKey ?? range.lower, range.upper, keyPattern, pageRows) : db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(octet_length(value), 0) AS byteLength, octet_length(value) IS NULL AS valueIsNull FROM cursorDiskKV WHERE key LIKE ? ESCAPE '\\' AND cursorDiskKV.rowid > COALESCE(?, -1) ORDER BY cursorDiskKV.rowid ASC LIMIT ?`).all(keyPattern, afterRowId, pageRows);
5359
5359
  if (rawPage.length === 0)
5360
5360
  break;
5361
5361
  const fallbackBase = typeof afterRowId === "number" && Number.isSafeInteger(afterRowId) ? afterRowId : -1;
@@ -5377,7 +5377,7 @@ function forEachBoundedComposerBubbleMetadataByExactPrefix(db, keyPrefix, budget
5377
5377
  let afterRowId = null;
5378
5378
  while (true) {
5379
5379
  throwIfAborted2(signal);
5380
- const rawPage = db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(length(CAST(value AS BLOB)), 0) AS byteLength, value IS NULL AS valueIsNull FROM cursorDiskKV WHERE ${exactBlobPrefixPredicate("cursorDiskKV.key")} AND cursorDiskKV.rowid > COALESCE(?, -1) ORDER BY cursorDiskKV.rowid ASC LIMIT ?`).all(keyPrefix, exactPrefixUpperBound(keyPrefix), keyPrefix, keyPrefix, afterRowId, pageRows);
5380
+ const rawPage = db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(octet_length(value), 0) AS byteLength, octet_length(value) IS NULL AS valueIsNull FROM cursorDiskKV WHERE ${exactBlobPrefixPredicate("cursorDiskKV.key")} AND cursorDiskKV.rowid > COALESCE(?, -1) ORDER BY cursorDiskKV.rowid ASC LIMIT ?`).all(keyPrefix, exactPrefixUpperBound(keyPrefix), keyPrefix, keyPrefix, afterRowId, pageRows);
5381
5381
  if (rawPage.length === 0)
5382
5382
  break;
5383
5383
  const fallbackBase = typeof afterRowId === "number" && Number.isSafeInteger(afterRowId) ? afterRowId : -1;
@@ -5432,7 +5432,7 @@ function readAdmittedComposerBubbleValue(db, metadata, budget, signal) {
5432
5432
  rawValue = internal.inlineValue;
5433
5433
  returnedValueIsNull = rawValue === null;
5434
5434
  } else {
5435
- const row = db.prepare(`SELECT key, CAST(value AS BLOB) AS value, value IS NULL AS valueIsNull FROM cursorDiskKV WHERE cursorDiskKV.rowid = ? AND key = ? COLLATE BINARY`).get(metadata.rowId, metadata.key);
5435
+ const row = db.prepare(`SELECT key, CAST(value AS BLOB) AS value, octet_length(value) IS NULL AS valueIsNull FROM cursorDiskKV WHERE cursorDiskKV.rowid = ? AND key = ? COLLATE BINARY`).get(metadata.rowId, metadata.key);
5436
5436
  if (!row || row.value === void 0) {
5437
5437
  throw new Error("Composer SQLite payload changed after metadata admission.");
5438
5438
  }
@@ -5473,7 +5473,7 @@ function readBoundedComposerValueByKey(db, table, key2, budget, signal) {
5473
5473
  }
5474
5474
  function readFirstBoundedComposerBubbleValueByExactPrefix(db, keyPrefix, budget, signal) {
5475
5475
  throwIfAborted2(signal);
5476
- const raw = db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(length(CAST(value AS BLOB)), 0) AS byteLength, value IS NULL AS valueIsNull FROM cursorDiskKV WHERE ${exactBlobPrefixPredicate("cursorDiskKV.key")} ORDER BY cursorDiskKV.rowid ASC LIMIT 1`).get(keyPrefix, exactPrefixUpperBound(keyPrefix), keyPrefix, keyPrefix);
5476
+ const raw = db.prepare(`SELECT CAST(cursorDiskKV.rowid AS TEXT) AS rowId, key, COALESCE(octet_length(value), 0) AS byteLength, octet_length(value) IS NULL AS valueIsNull FROM cursorDiskKV WHERE ${exactBlobPrefixPredicate("cursorDiskKV.key")} ORDER BY cursorDiskKV.rowid ASC LIMIT 1`).get(keyPrefix, exactPrefixUpperBound(keyPrefix), keyPrefix, keyPrefix);
5477
5477
  if (!raw)
5478
5478
  return void 0;
5479
5479
  const metadata = normalizeBubbleMetadata(raw, keyPrefix);
@@ -5487,13 +5487,13 @@ function forEachBoundedComposerBubbleValueByExactPrefix(db, keyPrefix, budget, v
5487
5487
  forEachBoundedComposerBubbleMetadataByExactPrefix(db, keyPrefix, budget, (metadata) => visit(readAdmittedComposerBubbleValue(db, metadata, budget, signal)), signal);
5488
5488
  }
5489
5489
  var init_composer_sqlite = __esm({
5490
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/composer-sqlite.js"() {
5490
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/composer-sqlite.js"() {
5491
5491
  "use strict";
5492
5492
  init_source_read_limits();
5493
5493
  }
5494
5494
  });
5495
5495
 
5496
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-publication.js
5496
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup-publication.js
5497
5497
  import { closeSync as closeSync2, constants as constants2, fchmodSync as fchmodSync2, fstatSync as fstatSync2, lstatSync as lstatSync2, openSync as openSync2 } from "node:fs";
5498
5498
  function projectStat(stat8) {
5499
5499
  return {
@@ -5569,7 +5569,7 @@ function enforcePublishedArchiveMode(outputPath, requestedMode, expectedIdentity
5569
5569
  }
5570
5570
  var DEFAULT_MODE_OPERATIONS;
5571
5571
  var init_backup_publication = __esm({
5572
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-publication.js"() {
5572
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup-publication.js"() {
5573
5573
  "use strict";
5574
5574
  init_errors();
5575
5575
  DEFAULT_MODE_OPERATIONS = Object.freeze({
@@ -5582,7 +5582,7 @@ var init_backup_publication = __esm({
5582
5582
  }
5583
5583
  });
5584
5584
 
5585
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-archive-publication.js
5585
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup-archive-publication.js
5586
5586
  import { linkSync, lstatSync as lstatSync3, renameSync, unlinkSync as unlinkSync2 } from "node:fs";
5587
5587
  function errorCode(error) {
5588
5588
  return error instanceof Error && "code" in error ? String(error.code) : void 0;
@@ -5636,7 +5636,7 @@ function publishBackupArchiveStage(stagePath, outputPath, force, identity, onCom
5636
5636
  }
5637
5637
  var CLEANUP_ATTEMPTS, DEFAULT_OPERATIONS;
5638
5638
  var init_backup_archive_publication = __esm({
5639
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup-archive-publication.js"() {
5639
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup-archive-publication.js"() {
5640
5640
  "use strict";
5641
5641
  init_errors();
5642
5642
  CLEANUP_ATTEMPTS = 2;
@@ -5649,7 +5649,7 @@ var init_backup_archive_publication = __esm({
5649
5649
  }
5650
5650
  });
5651
5651
 
5652
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/restore-publication.js
5652
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/restore-publication.js
5653
5653
  import { linkSync as linkSync2, lstatSync as lstatSync4, renameSync as renameSync2, unlinkSync as unlinkSync3 } from "node:fs";
5654
5654
  function errorCode2(error) {
5655
5655
  return error instanceof Error && "code" in error ? String(error.code) : void 0;
@@ -5699,7 +5699,7 @@ function commitRestorePublication(publicationPath, destinationPath, replaceExist
5699
5699
  }
5700
5700
  var CLEANUP_ATTEMPTS2, DEFAULT_OPERATIONS2;
5701
5701
  var init_restore_publication = __esm({
5702
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/restore-publication.js"() {
5702
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/restore-publication.js"() {
5703
5703
  "use strict";
5704
5704
  init_errors();
5705
5705
  CLEANUP_ATTEMPTS2 = 2;
@@ -5712,7 +5712,7 @@ var init_restore_publication = __esm({
5712
5712
  }
5713
5713
  });
5714
5714
 
5715
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-id.js
5715
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/session-id.js
5716
5716
  function isNativeCursorUuid(sessionId) {
5717
5717
  return NATIVE_CURSOR_UUID.test(sessionId);
5718
5718
  }
@@ -5752,13 +5752,13 @@ function groupSessionIdSpellings(sessionIds) {
5752
5752
  }
5753
5753
  var NATIVE_CURSOR_UUID;
5754
5754
  var init_session_id = __esm({
5755
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-id.js"() {
5755
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/session-id.js"() {
5756
5756
  "use strict";
5757
5757
  NATIVE_CURSOR_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
5758
5758
  }
5759
5759
  });
5760
5760
 
5761
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup.js
5761
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup.js
5762
5762
  import { createHash as createHash3, randomUUID } from "node:crypto";
5763
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";
5764
5764
  import { homedir as homedir10 } from "node:os";
@@ -7144,7 +7144,7 @@ function getDefaultCursorDataPath2() {
7144
7144
  }
7145
7145
  var MANIFEST_VERSION, UTF8_BOM2, BACKUP_METADATA_MEMORY_LIMIT, BACKUP_DATABASE_READ_CAPABILITIES, BACKUP_CHAT_DATA_KEYS, BackupEntryNotFoundError, COMPOSER_GUID_RE, TempFileCleanupWrapper;
7146
7146
  var init_backup = __esm({
7147
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/backup.js"() {
7147
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/backup.js"() {
7148
7148
  "use strict";
7149
7149
  init_registry();
7150
7150
  init_database();
@@ -7215,7 +7215,7 @@ var init_backup = __esm({
7215
7215
  }
7216
7216
  });
7217
7217
 
7218
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-catalog.js
7218
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/session-catalog.js
7219
7219
  function compareCodePoints5(left, right) {
7220
7220
  const leftPoints = Array.from(left, (value) => value.codePointAt(0));
7221
7221
  const rightPoints = Array.from(right, (value) => value.codePointAt(0));
@@ -7585,7 +7585,7 @@ function sessionAmbiguityErrorFromReplicaGroup(divergence) {
7585
7585
  }
7586
7586
  var SOURCE_ROLE_ORDER, REPRESENTATION_ORDER, FIDELITY_ORDER, CANONICAL_PATH_KIND_ORDER, INSTANCE_STATE_ORDER;
7587
7587
  var init_session_catalog = __esm({
7588
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/session-catalog.js"() {
7588
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/session-catalog.js"() {
7589
7589
  "use strict";
7590
7590
  init_errors();
7591
7591
  init_session_identity();
@@ -7615,7 +7615,7 @@ var init_session_catalog = __esm({
7615
7615
  }
7616
7616
  });
7617
7617
 
7618
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/paths.js
7618
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/paths.js
7619
7619
  import { join as join9 } from "node:path";
7620
7620
  function storeProjectDirectoryName(cwd) {
7621
7621
  const normalized = cwd.replace(/\\/gu, "/");
@@ -7633,12 +7633,12 @@ function acpSessionsDir(storeRoot2) {
7633
7633
  return join9(storeRoot2, "acp-sessions");
7634
7634
  }
7635
7635
  var init_paths = __esm({
7636
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/paths.js"() {
7636
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/paths.js"() {
7637
7637
  "use strict";
7638
7638
  }
7639
7639
  });
7640
7640
 
7641
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/content-evidence.js
7641
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/content-evidence.js
7642
7642
  function deepFreeze(value) {
7643
7643
  if (!value || typeof value !== "object" || Object.isFrozen(value))
7644
7644
  return value;
@@ -7707,7 +7707,7 @@ ${encoded}
7707
7707
  }
7708
7708
  var INLINE_ATTACHMENT_TYPES, INLINE_PAYLOAD_FIELDS, PROJECTED_ATTACHMENT_FENCE;
7709
7709
  var init_content_evidence = __esm({
7710
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/content-evidence.js"() {
7710
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/content-evidence.js"() {
7711
7711
  "use strict";
7712
7712
  init_session_identity();
7713
7713
  INLINE_ATTACHMENT_TYPES = /* @__PURE__ */ new Set([
@@ -7724,7 +7724,7 @@ var init_content_evidence = __esm({
7724
7724
  }
7725
7725
  });
7726
7726
 
7727
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/store-db.js
7727
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/store-db.js
7728
7728
  import { chmodSync as chmodSync3, statSync as statSync4 } from "node:fs";
7729
7729
  function databaseRequest(operation, required, forcedDriver, options, resourceClass = "store-database") {
7730
7730
  return {
@@ -8369,7 +8369,7 @@ function validDateFromMs(value) {
8369
8369
  }
8370
8370
  var STORE_SNAPSHOT_CAPABILITIES, STORE_READ_CAPABILITIES, StoreSourceCorruptError, BoundedBlobReader;
8371
8371
  var init_store_db = __esm({
8372
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/store-db.js"() {
8372
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/store-db.js"() {
8373
8373
  "use strict";
8374
8374
  init_database();
8375
8375
  init_debug();
@@ -8441,7 +8441,7 @@ var init_store_db = __esm({
8441
8441
  }
8442
8442
  });
8443
8443
 
8444
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/transcript.js
8444
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/transcript.js
8445
8445
  import { closeSync as closeSync4, openSync as openSync4, readSync as readSync2 } from "node:fs";
8446
8446
  function parseTranscriptFile(filePath, limits = SOURCE_READ_LIMITS_V1_DEFAULTS, failureOutcome = "fatal", signal, io, logicalSessionId) {
8447
8447
  throwIfAborted5(signal);
@@ -8799,7 +8799,7 @@ function extractContent(parts) {
8799
8799
  }
8800
8800
  var READ_CHUNK_BYTES;
8801
8801
  var init_transcript = __esm({
8802
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/transcript.js"() {
8802
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/transcript.js"() {
8803
8803
  "use strict";
8804
8804
  init_errors();
8805
8805
  init_io_observer();
@@ -8809,7 +8809,7 @@ var init_transcript = __esm({
8809
8809
  }
8810
8810
  });
8811
8811
 
8812
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/discover.js
8812
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/discover.js
8813
8813
  import { readdirSync as readdirSync6, readFileSync as readFileSync10, statSync as statSync5 } from "node:fs";
8814
8814
  import { join as join10 } from "node:path";
8815
8815
  function compareCodePoints6(left, right) {
@@ -9977,7 +9977,7 @@ function resolveStoreSessionTimestamps(session) {
9977
9977
  }
9978
9978
  var physicalOccurrences, TRANSCRIPT_STATE_RANK, RESOLUTION_REASON_ORDER;
9979
9979
  var init_discover = __esm({
9980
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/discover.js"() {
9980
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/discover.js"() {
9981
9981
  "use strict";
9982
9982
  init_errors();
9983
9983
  init_debug();
@@ -10013,7 +10013,7 @@ var init_discover = __esm({
10013
10013
  }
10014
10014
  });
10015
10015
 
10016
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/merge.js
10016
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/merge.js
10017
10017
  function normalizeText(text) {
10018
10018
  return text.replace(/\s+/g, " ").trim();
10019
10019
  }
@@ -10918,7 +10918,7 @@ function applyStoreMergeToSummary(existing, store, preferredSource) {
10918
10918
  }
10919
10919
  var EMPTY_PLACEHOLDER, CORRUPTED_PLACEHOLDER, SOURCE_ROLE_ORDER2, SOURCE_REPRESENTATION_ORDER, SOURCE_INSTANCE_STATE_ORDER, STORE_MESSAGE_ID_PATTERN, RESOLUTION_REASON_ORDER2;
10920
10920
  var init_merge = __esm({
10921
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/store-stack/merge.js"() {
10921
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/store-stack/merge.js"() {
10922
10922
  "use strict";
10923
10923
  init_parser();
10924
10924
  init_timestamps();
@@ -10954,7 +10954,7 @@ var init_merge = __esm({
10954
10954
  }
10955
10955
  });
10956
10956
 
10957
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/storage.js
10957
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/storage.js
10958
10958
  import { createHash as createHash4 } from "node:crypto";
10959
10959
  import { existsSync as existsSync8, readdirSync as readdirSync7, readFileSync as readFileSync11 } from "node:fs";
10960
10960
  import { join as join11 } from "node:path";
@@ -15410,7 +15410,7 @@ function updateComposerData(db, composers, isNewFormat, originalRawData) {
15410
15410
  }
15411
15411
  var SESSION_READ_CAPABILITIES, MIGRATION_CAPABILITIES, OWNING_DATABASE_READ_FAILURES, CHAT_DATA_KEYS, PROMPTS_KEY, GENERATIONS_KEY, COMPOSER_GUID_RE2, BACKUP_COMPOSER_SESSION_IDS, BACKUP_GLOBAL_COUNTERPART_SESSION_IDS, BACKUP_LINKED_GLOBAL_SESSION_IDS, BACKUP_CONTAINS_GLOBAL_DATABASE, COUNTED_COMPOSER_SESSION_IDS, sessionReadContextPrivate, nextReadContextId, UNKNOWN_WORKSPACE_PATH, RESOLUTION_SOURCE_ROLE_ORDER, RESOLUTION_REASON_ORDER3, MIN_VALID_UNIX_MS2;
15412
15412
  var init_storage = __esm({
15413
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/storage.js"() {
15413
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/storage.js"() {
15414
15414
  "use strict";
15415
15415
  init_database();
15416
15416
  init_platform();
@@ -15466,7 +15466,7 @@ var init_storage = __esm({
15466
15466
  }
15467
15467
  });
15468
15468
 
15469
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/migrate.js
15469
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/migrate.js
15470
15470
  import { createHash as createHash5, randomUUID as randomUUID2 } from "node:crypto";
15471
15471
  import { existsSync as existsSync9, readdirSync as readdirSync8, statSync as statSync6 } from "node:fs";
15472
15472
  import { join as join12 } from "node:path";
@@ -17550,7 +17550,7 @@ async function migrateWorkspace(options) {
17550
17550
  };
17551
17551
  }
17552
17552
  var init_migrate = __esm({
17553
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/core/migrate.js"() {
17553
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/core/migrate.js"() {
17554
17554
  "use strict";
17555
17555
  init_storage();
17556
17556
  init_platform();
@@ -17564,7 +17564,7 @@ var init_migrate = __esm({
17564
17564
  }
17565
17565
  });
17566
17566
 
17567
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/backup.js
17567
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/backup.js
17568
17568
  async function createBackup2(config) {
17569
17569
  return createBackup(config);
17570
17570
  }
@@ -17581,13 +17581,13 @@ function getDefaultBackupDir2() {
17581
17581
  return getDefaultBackupDir();
17582
17582
  }
17583
17583
  var init_backup2 = __esm({
17584
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/backup.js"() {
17584
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/backup.js"() {
17585
17585
  "use strict";
17586
17586
  init_backup();
17587
17587
  }
17588
17588
  });
17589
17589
 
17590
- // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/index.js
17590
+ // ../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/index.js
17591
17591
  var lib_exports = {};
17592
17592
  __export(lib_exports, {
17593
17593
  BackupError: () => BackupError,
@@ -18507,7 +18507,7 @@ function getActiveDriver2() {
18507
18507
  }
18508
18508
  var publicReadContexts;
18509
18509
  var init_lib = __esm({
18510
- "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=3ee284d373d283bd4c4f5a74440096c9f1d6d5a4c9732d5d983ccdc6f10ff9f0/node_modules/cursor-history/dist/lib/index.js"() {
18510
+ "../../node_modules/.pnpm/cursor-history@0.18.0_patch_hash=dbff0ea0e399ea9504168452170a23ee2b432a6dc6a69a20b49bf95ef139fa74/node_modules/cursor-history/dist/lib/index.js"() {
18511
18511
  "use strict";
18512
18512
  init_types2();
18513
18513
  init_errors3();
@@ -18906,7 +18906,7 @@ function apiEquivalentCost(modelKey, t, atMs) {
18906
18906
  }
18907
18907
 
18908
18908
  // src/version.ts
18909
- var CLI_VERSION = true ? "0.16.10" : "0.0.0-dev";
18909
+ var CLI_VERSION = true ? "0.17.0" : "0.0.0-dev";
18910
18910
 
18911
18911
  // src/api.ts
18912
18912
  var BASE_URL = process.env.AISTACK_URL || "https://aistack.to";
@@ -21172,7 +21172,7 @@ async function hasRecentFile(roots, matches, sinceMs, opts = {}) {
21172
21172
  }
21173
21173
 
21174
21174
  // ../workflow-rules/src/daily.ts
21175
- var WORKFLOW_AGGREGATES_V3 = "workflow-aggregates/v3";
21175
+ var WORKFLOW_AGGREGATES_V4 = "workflow-aggregates/v4";
21176
21176
  var LOG_BUCKETS_V1 = "log-buckets/v1";
21177
21177
  var LOG_BUCKETS_V2 = "log-buckets/v2";
21178
21178
  var EMPTY_PHASE_TOTALS = Object.freeze({
@@ -21182,6 +21182,46 @@ var EMPTY_PHASE_TOTALS = Object.freeze({
21182
21182
  handoff: 0,
21183
21183
  unknown: 0
21184
21184
  });
21185
+ var CACHE_TTL_SEC = 300;
21186
+ var SHORT_SESSION_CALLS = 2;
21187
+ var TOOL_RESULT_NAMES = [
21188
+ "Agent",
21189
+ "Bash",
21190
+ "Edit",
21191
+ "Glob",
21192
+ "Grep",
21193
+ "MultiEdit",
21194
+ "NotebookEdit",
21195
+ "NotebookRead",
21196
+ "Read",
21197
+ "Skill",
21198
+ "ToolSearch",
21199
+ "WebFetch",
21200
+ "WebSearch",
21201
+ "Write",
21202
+ "apply_patch",
21203
+ "exec_command",
21204
+ "grep_command",
21205
+ "list_dir",
21206
+ "local_shell",
21207
+ "read_file",
21208
+ "shell",
21209
+ "tool_search",
21210
+ "unified_exec",
21211
+ "view_image",
21212
+ "web_search",
21213
+ "write_stdin",
21214
+ "mcp",
21215
+ "other"
21216
+ ];
21217
+ function toolResultName(tool) {
21218
+ if (!tool) return "other";
21219
+ if (tool.startsWith("mcp__")) return "mcp";
21220
+ if (tool === "Task") return "Agent";
21221
+ if (TOOL_RESULT_NAMES.includes(tool)) return tool;
21222
+ if (tool.includes("__")) return "mcp";
21223
+ return "other";
21224
+ }
21185
21225
  var EFFORT_LEVELS = [
21186
21226
  "low",
21187
21227
  "medium",
@@ -21320,6 +21360,54 @@ function foldContextDays(days) {
21320
21360
  ...window === void 0 ? {} : { window }
21321
21361
  };
21322
21362
  }
21363
+ function foldEfficiencyDays(days) {
21364
+ const versions = (values) => [...new Set(values)].sort().join(" \xB7 ");
21365
+ const sum = (pick) => days.reduce((total, day) => total + pick(day), 0);
21366
+ const blocks = days.flatMap((day) => day.blocks ? [day.blocks] : []);
21367
+ return {
21368
+ countBucketRuleVersion: versions(days.map((d) => d.countBucketRuleVersion)),
21369
+ sizeBucketRuleVersion: versions(days.map((d) => d.sizeBucketRuleVersion)),
21370
+ callGaps: foldCountBuckets(
21371
+ days.flatMap((d) => d.callGaps),
21372
+ "calls"
21373
+ ),
21374
+ callsAfterGap: sum((d) => d.callsAfterGap),
21375
+ cacheWriteAfterGap: sum((d) => d.cacheWriteAfterGap),
21376
+ inputAfterGap: sum((d) => d.inputAfterGap),
21377
+ orphanCacheWrites: sum((d) => d.orphanCacheWrites),
21378
+ orphanCacheWriteTokens: sum((d) => d.orphanCacheWriteTokens),
21379
+ sessionMaxContext: foldCountBuckets(
21380
+ days.flatMap((d) => d.sessionMaxContext),
21381
+ "sessions"
21382
+ ),
21383
+ sessionCalls: foldCountBuckets(
21384
+ days.flatMap((d) => d.sessionCalls),
21385
+ "sessions"
21386
+ ),
21387
+ shortSessions: sum((d) => d.shortSessions),
21388
+ shortSessionFirstCallTokens: sum((d) => d.shortSessionFirstCallTokens),
21389
+ sessionsCompacted: sum((d) => d.sessionsCompacted),
21390
+ toolResults: sumBy(
21391
+ days.flatMap((d) => d.toolResults),
21392
+ (row) => row.tool,
21393
+ (into, from) => {
21394
+ into.results += from.results;
21395
+ into.bytes += from.bytes;
21396
+ into.buckets = foldCountBuckets(
21397
+ [...into.buckets, ...from.buckets],
21398
+ "results"
21399
+ );
21400
+ },
21401
+ (row) => ({ ...row, buckets: [...row.buckets] })
21402
+ ).sort((a, b) => b.bytes - a.bytes || a.tool.localeCompare(b.tool)),
21403
+ ...blocks.length > 0 ? {
21404
+ blocks: {
21405
+ thinking: blocks.reduce((n, b) => n + b.thinking, 0),
21406
+ text: blocks.reduce((n, b) => n + b.text, 0)
21407
+ }
21408
+ } : {}
21409
+ };
21410
+ }
21323
21411
  function foldLengths(rows) {
21324
21412
  return sumBy(
21325
21413
  rows,
@@ -21458,6 +21546,11 @@ function foldHarnessDays(days) {
21458
21546
  }
21459
21547
  const contexts = days.flatMap((day) => day.context ? [day.context] : []);
21460
21548
  if (contexts.length > 0) out.context = foldContextDays(contexts);
21549
+ const efficiencies = days.flatMap(
21550
+ (day) => day.efficiency ? [day.efficiency] : []
21551
+ );
21552
+ if (efficiencies.length > 0)
21553
+ out.efficiency = foldEfficiencyDays(efficiencies);
21461
21554
  return out;
21462
21555
  }
21463
21556
  var MAX_CHANGED_LINES_PER_COMMIT = 4096;
@@ -21745,6 +21838,10 @@ var COMPONENT_RULES = [
21745
21838
  }
21746
21839
  ];
21747
21840
 
21841
+ // ../workflow-rules/src/efficiency.ts
21842
+ var BIG_RESULT_BUCKET = logBucketV2(32768);
21843
+ var HIGH_CONTEXT_BUCKET = logBucketV2(131072);
21844
+
21748
21845
  // ../workflow-rules/src/metricRules.ts
21749
21846
  var METRIC_RULES_V2 = "metric-rules/v2";
21750
21847
  var METRIC_RULES = [
@@ -22697,7 +22794,7 @@ function buildSyncBody(built, syncConfig, autoSync, trigger = "manual", measured
22697
22794
  }
22698
22795
 
22699
22796
  // src/workflow/reducer.ts
22700
- var WORKFLOW_AGGREGATE_VERSION = WORKFLOW_AGGREGATES_V3;
22797
+ var WORKFLOW_AGGREGATE_VERSION = WORKFLOW_AGGREGATES_V4;
22701
22798
  function createWorkflowLocalSources() {
22702
22799
  return { projectWorkspaces: /* @__PURE__ */ new Set(), activeProjectDays: /* @__PURE__ */ new Map() };
22703
22800
  }
@@ -22770,6 +22867,7 @@ function shellIncludes(arg, head) {
22770
22867
  }
22771
22868
  function sessionState() {
22772
22869
  return {
22870
+ compacted: false,
22773
22871
  events: [],
22774
22872
  responses: /* @__PURE__ */ new Map(),
22775
22873
  nextAnonymousResponse: 0,
@@ -22826,7 +22924,24 @@ function dayState() {
22826
22924
  compactions: 0,
22827
22925
  window: void 0
22828
22926
  },
22829
- hasContext: false
22927
+ hasContext: false,
22928
+ efficiency: {
22929
+ callGaps: /* @__PURE__ */ new Map(),
22930
+ callsAfterGap: 0,
22931
+ cacheWriteAfterGap: 0,
22932
+ inputAfterGap: 0,
22933
+ orphanCacheWrites: 0,
22934
+ orphanCacheWriteTokens: 0,
22935
+ sessionMaxContext: /* @__PURE__ */ new Map(),
22936
+ sessionCalls: /* @__PURE__ */ new Map(),
22937
+ shortSessions: 0,
22938
+ shortSessionFirstCallTokens: 0,
22939
+ sessionsCompacted: 0,
22940
+ toolResults: /* @__PURE__ */ new Map(),
22941
+ blocks: { thinking: 0, text: 0 },
22942
+ hasBlocks: false
22943
+ },
22944
+ hasEfficiency: false
22830
22945
  };
22831
22946
  }
22832
22947
  function createHarnessWorkflowReducer(harness, localSources = createWorkflowLocalSources()) {
@@ -22834,6 +22949,7 @@ function createHarnessWorkflowReducer(harness, localSources = createWorkflowLoca
22834
22949
  const eventCells = /* @__PURE__ */ new Map();
22835
22950
  const webSearchesByDate = /* @__PURE__ */ new Map();
22836
22951
  const compactionsByDate = /* @__PURE__ */ new Map();
22952
+ const toolResultsByDate = /* @__PURE__ */ new Map();
22837
22953
  const eventDates = /* @__PURE__ */ new Set();
22838
22954
  let finished;
22839
22955
  const getSession3 = (key2) => {
@@ -22895,6 +23011,21 @@ function createHarnessWorkflowReducer(harness, localSources = createWorkflowLoca
22895
23011
  observation.firstCall.instructionsTokens
22896
23012
  )
22897
23013
  }
23014
+ } : {},
23015
+ ...observation.inputTokens !== void 0 ? { inputTokens: finiteNonnegative(observation.inputTokens) } : {},
23016
+ ...observation.cacheReadTokens !== void 0 ? {
23017
+ cacheReadTokens: finiteNonnegative(observation.cacheReadTokens)
23018
+ } : {},
23019
+ ...observation.cacheWriteTokens !== void 0 ? {
23020
+ cacheWriteTokens: finiteNonnegative(
23021
+ observation.cacheWriteTokens
23022
+ )
23023
+ } : {},
23024
+ ...observation.blocks ? {
23025
+ blocks: {
23026
+ thinking: finiteNonnegative(observation.blocks.thinking),
23027
+ text: finiteNonnegative(observation.blocks.text)
23028
+ }
22898
23029
  } : {}
22899
23030
  };
22900
23031
  const existing = state.responses.get(responseId);
@@ -22905,7 +23036,22 @@ function createHarnessWorkflowReducer(harness, localSources = createWorkflowLoca
22905
23036
  } else if (observation.type === "turn") {
22906
23037
  const turnId = observation.turnId ?? `anonymous:${state.nextAnonymousTurn++}`;
22907
23038
  state.turns.set(turnId, observation.questionBack);
23039
+ } else if (observation.type === "toolResult") {
23040
+ const bytes = finiteNonnegative(observation.bytes);
23041
+ const byDate = toolResultsByDate.get(date) ?? /* @__PURE__ */ new Map();
23042
+ const name = toolResultName(observation.tool);
23043
+ const row = byDate.get(name) ?? {
23044
+ results: 0,
23045
+ bytes: 0,
23046
+ buckets: /* @__PURE__ */ new Map()
23047
+ };
23048
+ row.results++;
23049
+ row.bytes += bytes;
23050
+ bump2(row.buckets, logBucketV2(bytes));
23051
+ byDate.set(name, row);
23052
+ toolResultsByDate.set(date, byDate);
22908
23053
  } else {
23054
+ state.compacted = true;
22909
23055
  bump2(compactionsByDate, date);
22910
23056
  }
22911
23057
  },
@@ -23034,12 +23180,67 @@ function createHarnessWorkflowReducer(harness, localSources = createWorkflowLoca
23034
23180
  context.firstCallCount++;
23035
23181
  }
23036
23182
  }
23183
+ if (routing === "main") {
23184
+ const calls = responses.filter((response) => response.contextTokens !== void 0).sort((a, b) => a.tsMs - b.tsMs);
23185
+ for (const response of responses) {
23186
+ if (!response.blocks) continue;
23187
+ day.hasEfficiency = true;
23188
+ day.efficiency.hasBlocks = true;
23189
+ day.efficiency.blocks.thinking += response.blocks.thinking;
23190
+ day.efficiency.blocks.text += response.blocks.text;
23191
+ }
23192
+ if (calls.length > 0) {
23193
+ day.hasEfficiency = true;
23194
+ const eff = day.efficiency;
23195
+ let peak = 0;
23196
+ calls.forEach((call, i) => {
23197
+ const context = call.contextTokens ?? 0;
23198
+ peak = Math.max(peak, context);
23199
+ const previous = calls[i - 1];
23200
+ if (!previous) return;
23201
+ const gapSec = (call.tsMs - previous.tsMs) / 1e3;
23202
+ bump2(eff.callGaps, logBucket(gapSec));
23203
+ if (gapSec > CACHE_TTL_SEC) {
23204
+ eff.callsAfterGap++;
23205
+ eff.cacheWriteAfterGap += call.cacheWriteTokens ?? 0;
23206
+ eff.inputAfterGap += call.inputTokens ?? 0;
23207
+ }
23208
+ if ((call.cacheWriteTokens ?? 0) > 0 && (call.cacheReadTokens ?? 0) === 0) {
23209
+ eff.orphanCacheWrites++;
23210
+ eff.orphanCacheWriteTokens += call.cacheWriteTokens ?? 0;
23211
+ }
23212
+ });
23213
+ bump2(eff.sessionMaxContext, logBucketV2(peak));
23214
+ bump2(eff.sessionCalls, logBucket(calls.length));
23215
+ if (calls.length <= SHORT_SESSION_CALLS) {
23216
+ eff.shortSessions++;
23217
+ eff.shortSessionFirstCallTokens += calls[0]?.contextTokens ?? 0;
23218
+ }
23219
+ if (state.compacted) eff.sessionsCompacted++;
23220
+ }
23221
+ }
23037
23222
  }
23038
23223
  for (const [date, compactions] of compactionsByDate) {
23039
23224
  const day = dayOf(date);
23040
23225
  day.hasContext = true;
23041
23226
  day.context.compactions += compactions;
23042
23227
  }
23228
+ for (const [date, rows] of toolResultsByDate) {
23229
+ const day = dayOf(date);
23230
+ day.hasEfficiency = true;
23231
+ for (const [tool, row] of rows) {
23232
+ const held = day.efficiency.toolResults.get(tool) ?? {
23233
+ results: 0,
23234
+ bytes: 0,
23235
+ buckets: /* @__PURE__ */ new Map()
23236
+ };
23237
+ held.results += row.results;
23238
+ held.bytes += row.bytes;
23239
+ for (const [bucket, results] of row.buckets)
23240
+ bump2(held.buckets, bucket, results);
23241
+ day.efficiency.toolResults.set(tool, held);
23242
+ }
23243
+ }
23043
23244
  for (const date of eventDates) {
23044
23245
  const day = dayOf(date);
23045
23246
  for (const [key2, events] of eventCells.get(date) ?? []) {
@@ -23192,6 +23393,38 @@ function createHarnessWorkflowReducer(harness, localSources = createWorkflowLoca
23192
23393
  compactions: day.context.compactions,
23193
23394
  ...day.context.window ? { window: day.context.window.window } : {}
23194
23395
  }
23396
+ } : {},
23397
+ ...day.hasEfficiency ? {
23398
+ efficiency: {
23399
+ countBucketRuleVersion: LOG_BUCKETS_V1,
23400
+ sizeBucketRuleVersion: LOG_BUCKETS_V2,
23401
+ callGaps: asBuckets(day.efficiency.callGaps, "calls"),
23402
+ callsAfterGap: day.efficiency.callsAfterGap,
23403
+ cacheWriteAfterGap: day.efficiency.cacheWriteAfterGap,
23404
+ inputAfterGap: day.efficiency.inputAfterGap,
23405
+ orphanCacheWrites: day.efficiency.orphanCacheWrites,
23406
+ orphanCacheWriteTokens: day.efficiency.orphanCacheWriteTokens,
23407
+ sessionMaxContext: asBuckets(
23408
+ day.efficiency.sessionMaxContext,
23409
+ "sessions"
23410
+ ),
23411
+ sessionCalls: asBuckets(
23412
+ day.efficiency.sessionCalls,
23413
+ "sessions"
23414
+ ),
23415
+ shortSessions: day.efficiency.shortSessions,
23416
+ shortSessionFirstCallTokens: day.efficiency.shortSessionFirstCallTokens,
23417
+ sessionsCompacted: day.efficiency.sessionsCompacted,
23418
+ toolResults: [...day.efficiency.toolResults].map(([tool, row]) => ({
23419
+ tool,
23420
+ results: row.results,
23421
+ bytes: row.bytes,
23422
+ buckets: asBuckets(row.buckets, "results")
23423
+ })).sort(
23424
+ (a, b) => b.bytes - a.bytes || a.tool.localeCompare(b.tool)
23425
+ ),
23426
+ ...day.efficiency.hasBlocks ? { blocks: day.efficiency.blocks } : {}
23427
+ }
23195
23428
  } : {}
23196
23429
  }))
23197
23430
  };
@@ -23199,6 +23432,7 @@ function createHarnessWorkflowReducer(harness, localSources = createWorkflowLoca
23199
23432
  eventCells.clear();
23200
23433
  webSearchesByDate.clear();
23201
23434
  compactionsByDate.clear();
23435
+ toolResultsByDate.clear();
23202
23436
  eventDates.clear();
23203
23437
  return finished;
23204
23438
  }
@@ -23213,7 +23447,8 @@ function createAggregate2() {
23213
23447
  workflowLocal,
23214
23448
  workflowSeenCalls: /* @__PURE__ */ new Set(),
23215
23449
  workflowSeenTurns: /* @__PURE__ */ new Set(),
23216
- contextFirstCall: /* @__PURE__ */ new Map()
23450
+ contextFirstCall: /* @__PURE__ */ new Map(),
23451
+ workflowToolNames: /* @__PURE__ */ new Map()
23217
23452
  });
23218
23453
  }
23219
23454
  function workflowSessionKey(rec) {
@@ -23267,8 +23502,10 @@ function ingestRecord(agg, raw, ctx) {
23267
23502
  if (type === "assistant") {
23268
23503
  ingestClaudeWorkflow(agg, rec, ctx, tsMs);
23269
23504
  ingestAssistant(agg, rec, tsMs);
23270
- } else if (type === "user") ingestUser(agg, rec);
23271
- else if (type === "system") {
23505
+ } else if (type === "user") {
23506
+ ingestUser(agg, rec);
23507
+ ingestClaudeToolResults(agg, rec, ctx, tsMs);
23508
+ } else if (type === "system") {
23272
23509
  ingestClaudeTurnDuration(agg, rec, ctx, tsMs);
23273
23510
  ingestClaudeCompaction(agg, rec, ctx, tsMs);
23274
23511
  }
@@ -23318,6 +23555,13 @@ function ingestClaudeWorkflow(agg, rec, ctx, tsMs) {
23318
23555
  const messageId = asStr(msg.id);
23319
23556
  const newTurn = messageId ? !agg.workflowSeenTurns.has(messageId) : true;
23320
23557
  if (messageId) agg.workflowSeenTurns.add(messageId);
23558
+ const blocks = { thinking: 0, text: 0 };
23559
+ for (const rawBlock of asArr(msg.content)) {
23560
+ const block = asObj(rawBlock);
23561
+ const kind = block ? asStr(block.type) : null;
23562
+ if (kind === "thinking") blocks.thinking++;
23563
+ else if (kind === "text") blocks.text++;
23564
+ }
23321
23565
  let context = null;
23322
23566
  if (counts2 && isApiCall(rec)) {
23323
23567
  const held = agg.contextFirstCall.get(session);
@@ -23328,6 +23572,9 @@ function ingestClaudeWorkflow(agg, rec, ctx, tsMs) {
23328
23572
  } else if (held !== null && held === messageId) first = true;
23329
23573
  context = {
23330
23574
  contextTokens: contextOf(counts2),
23575
+ inputTokens: counts2.input,
23576
+ cacheReadTokens: counts2.cacheRead,
23577
+ cacheWriteTokens: counts2.cacheWrite5m + counts2.cacheWrite1h + counts2.cacheWriteUnsplit,
23331
23578
  ...first ? {
23332
23579
  firstCall: {
23333
23580
  harnessTokens: counts2.cacheRead,
@@ -23348,7 +23595,8 @@ function ingestClaudeWorkflow(agg, rec, ctx, tsMs) {
23348
23595
  ...counts2 ? { responseTokens: counts2.output } : {},
23349
23596
  ...counts2 ? { routingTokens: countsTotal(counts2) } : {},
23350
23597
  ...asStr(rec.effort) ?? asStr(msg.effort) ? { effort: asStr(rec.effort) ?? asStr(msg.effort) } : {},
23351
- ...context ?? {}
23598
+ ...context ?? {},
23599
+ ...blocks.thinking + blocks.text > 0 && isApiCall(rec) ? { blocks } : {}
23352
23600
  });
23353
23601
  const tools = [];
23354
23602
  for (const rawBlock of asArr(msg.content)) {
@@ -23357,11 +23605,12 @@ function ingestClaudeWorkflow(agg, rec, ctx, tsMs) {
23357
23605
  }
23358
23606
  for (const block of tools) {
23359
23607
  const id = asStr(block.id);
23608
+ const name = asName(block.name);
23609
+ if (id && name) agg.workflowToolNames.set(id, name);
23360
23610
  if (id) {
23361
23611
  if (agg.workflowSeenCalls.has(id)) continue;
23362
23612
  agg.workflowSeenCalls.add(id);
23363
23613
  }
23364
- const name = asName(block.name);
23365
23614
  if (!name) continue;
23366
23615
  const input = asObj(block.input) ?? {};
23367
23616
  let arg = "";
@@ -23593,6 +23842,31 @@ function ingestToolUse(agg, block) {
23593
23842
  bump(agg.toolCalls, name);
23594
23843
  }
23595
23844
  var SLASH_RE = /<command-name>\/?([^<\n\r]{1,64})<\/command-name>/g;
23845
+ function ingestClaudeToolResults(agg, rec, ctx, tsMs) {
23846
+ if (tsMs === null) return;
23847
+ const session = workflowSessionKey(rec);
23848
+ const msg = asObj(rec.message);
23849
+ if (!session || !msg) return;
23850
+ const sidechain = rec.isSidechain === true;
23851
+ const parentSession = sidechain ? asStr(rec.sessionId) : null;
23852
+ for (const rawBlock of asArr(msg.content)) {
23853
+ const block = asObj(rawBlock);
23854
+ if (!block || asStr(block.type) !== "tool_result") continue;
23855
+ const toolUseId = asStr(block.tool_use_id);
23856
+ const content = block.content;
23857
+ const bytes = typeof content === "string" ? Buffer.byteLength(content) : content === void 0 || content === null ? 0 : Buffer.byteLength(JSON.stringify(content));
23858
+ agg.workflow.ingest({
23859
+ type: "toolResult",
23860
+ session,
23861
+ projectWorkspace: projectWorkspaceDirectory(rec) ?? ctx.projectDir,
23862
+ tsMs,
23863
+ sidechain,
23864
+ ...parentSession ? { parentSession } : {},
23865
+ tool: toolUseId && agg.workflowToolNames.get(toolUseId) || "other",
23866
+ bytes
23867
+ });
23868
+ }
23869
+ }
23596
23870
  function ingestUser(agg, rec) {
23597
23871
  const msg = asObj(rec.message);
23598
23872
  if (!msg) return;
@@ -23794,7 +24068,8 @@ function createFileState() {
23794
24068
  counted: false,
23795
24069
  metaTsMs: null,
23796
24070
  forked: false,
23797
- sawResponse: false
24071
+ sawResponse: false,
24072
+ callNames: /* @__PURE__ */ new Map()
23798
24073
  };
23799
24074
  }
23800
24075
  function genuineDelta(payload, state, tsMs) {
@@ -23917,6 +24192,9 @@ function ingestEvent(agg, payload, state, tsMs, firstCall) {
23917
24192
  // the fresh part is the instructions: AGENTS.md, environment,
23918
24193
  // skills and the first prompt. Same method as Claude Code (#358).
23919
24194
  contextTokens: counts2.input + counts2.cacheRead,
24195
+ inputTokens: counts2.input,
24196
+ cacheReadTokens: counts2.cacheRead,
24197
+ cacheWriteTokens: 0,
23920
24198
  ...contextWindow > 0 ? { contextWindow } : {},
23921
24199
  ...firstCall && !state.forked ? {
23922
24200
  firstCall: {
@@ -23951,16 +24229,22 @@ function ingestCall(agg, name, callId) {
23951
24229
  }
23952
24230
  function ingestItem(agg, payload, state, tsMs) {
23953
24231
  const type = asStr(payload.type);
24232
+ if (type === "function_call_output" || type === "custom_tool_call_output") {
24233
+ ingestToolResult(agg, payload, state, tsMs);
24234
+ return;
24235
+ }
23954
24236
  if (type === "function_call" || type === "custom_tool_call") {
23955
24237
  const name = asName(payload.name);
23956
24238
  if (!name) return;
23957
24239
  const callId = asStr(payload.call_id) ?? asStr(payload.id);
24240
+ if (callId) state.callNames.set(callId, name);
23958
24241
  ingestCall(agg, name, callId);
23959
24242
  ingestWorkflowCall(agg, payload, name, callId, state, tsMs);
23960
24243
  return;
23961
24244
  }
23962
24245
  if (type === "local_shell_call") {
23963
24246
  const callId = asStr(payload.call_id) ?? asStr(payload.id);
24247
+ if (callId) state.callNames.set(callId, "local_shell");
23964
24248
  ingestCall(agg, "local_shell", callId);
23965
24249
  ingestWorkflowCall(agg, payload, "local_shell", callId, state, tsMs);
23966
24250
  } else if (type === "web_search_call") {
@@ -23986,6 +24270,20 @@ function ingestItem(agg, payload, state, tsMs) {
23986
24270
  );
23987
24271
  }
23988
24272
  }
24273
+ function ingestToolResult(agg, payload, state, tsMs) {
24274
+ if (tsMs === null || !state.sessionId) return;
24275
+ const callId = asStr(payload.call_id) ?? asStr(payload.id);
24276
+ const output = payload.output;
24277
+ const bytes = typeof output === "string" ? Buffer.byteLength(output) : output === void 0 || output === null ? 0 : Buffer.byteLength(JSON.stringify(output));
24278
+ agg.workflow.ingest({
24279
+ type: "toolResult",
24280
+ session: state.sessionId,
24281
+ projectWorkspace: state.cwd ?? void 0,
24282
+ tsMs,
24283
+ tool: callId && state.callNames.get(callId) || "other",
24284
+ bytes
24285
+ });
24286
+ }
23989
24287
  function ingestWorkflowCall(agg, payload, name, callId, state, tsMs) {
23990
24288
  if (tsMs === null || !state.sessionId) return;
23991
24289
  if (callId) {
@@ -24065,12 +24363,21 @@ async function* walkRollouts(dir) {
24065
24363
  var createZstdDecompress2 = typeof zlib.createZstdDecompress === "function" ? zlib.createZstdDecompress : null;
24066
24364
  var MAX_LINE_BYTES = 64 * 1024 * 1024;
24067
24365
  async function scan2(agg, opts = {}) {
24068
- const stats = emptyScanStats();
24366
+ return (await scanWindows(
24367
+ [{ aggregate: agg, sinceMs: opts.sinceMs, onProgress: opts.onProgress }],
24368
+ opts
24369
+ ))[0];
24370
+ }
24371
+ async function scanWindows(windows, opts = {}) {
24372
+ const targets = windows.map((window) => ({
24373
+ ...window,
24374
+ stats: emptyScanStats()
24375
+ }));
24069
24376
  const visited = /* @__PURE__ */ new Set();
24070
24377
  for (const root of opts.roots ?? rolloutRoots()) {
24071
24378
  if (!await exists2(root)) continue;
24072
24379
  for await (const file of walkRollouts(root)) {
24073
- stats.filesFound++;
24380
+ for (const { stats } of targets) stats.filesFound++;
24074
24381
  let resolved;
24075
24382
  try {
24076
24383
  resolved = await realpath2(file);
@@ -24079,46 +24386,59 @@ async function scan2(agg, opts = {}) {
24079
24386
  traceError("codex rollout path resolution", error, "warn");
24080
24387
  resolved = file;
24081
24388
  }
24082
- const dedupKey = resolved.endsWith(".zst") ? resolved.slice(0, -".zst".length) : resolved;
24389
+ const dedupKey = resolved.endsWith(".zst") ? resolved.slice(0, -4) : resolved;
24083
24390
  if (visited.has(dedupKey)) {
24084
- stats.filesSkippedAsDuplicate++;
24391
+ for (const { stats } of targets) stats.filesSkippedAsDuplicate++;
24085
24392
  continue;
24086
24393
  }
24087
24394
  visited.add(dedupKey);
24088
- if (opts.sinceMs !== void 0) {
24395
+ let mtimeMs;
24396
+ if (targets.some((target) => target.sinceMs !== void 0)) {
24089
24397
  try {
24090
- const st = await stat3(file);
24091
- if (st.mtimeMs < opts.sinceMs) {
24092
- stats.filesSkippedByMtime++;
24093
- continue;
24094
- }
24398
+ mtimeMs = (await stat3(file)).mtimeMs;
24095
24399
  } catch (error) {
24096
24400
  if (error?.code !== "ENOENT")
24097
24401
  traceError("codex rollout stat", error, "warn");
24098
24402
  }
24099
24403
  }
24100
- agg.files++;
24101
- stats.filesRead++;
24102
- if (opts.onProgress && agg.files % 20 === 0) opts.onProgress(agg.files);
24103
- const outcome = await ingestWithRetry(agg, file, opts);
24104
- if (!outcome.ok) {
24105
- stats.filesUnreadable++;
24106
- stats.filesRead--;
24107
- if (outcome.reason === "zstd-unsupported") stats.filesZstdUnsupported++;
24108
- stats.unreadableFiles.push({
24109
- path: path3.relative(root, file),
24110
- reason: outcome.reason
24111
- });
24112
- } else if (!outcome.genuine) {
24113
- stats.filesForeign++;
24114
- stats.filesRead--;
24115
- const seen = stats.foreignOriginators.get(outcome.originator) ?? 0;
24116
- stats.foreignOriginators.set(outcome.originator, seen + 1);
24404
+ const eligible = targets.filter((target) => {
24405
+ if (mtimeMs !== void 0 && target.sinceMs !== void 0 && mtimeMs < target.sinceMs) {
24406
+ target.stats.filesSkippedByMtime++;
24407
+ return false;
24408
+ }
24409
+ return true;
24410
+ });
24411
+ if (!eligible.length) continue;
24412
+ for (const { aggregate, stats, onProgress } of eligible) {
24413
+ aggregate.files++;
24414
+ stats.filesRead++;
24415
+ if (aggregate.files % 20 === 0) onProgress?.(aggregate.files);
24416
+ }
24417
+ const outcome = await ingestWithRetry(eligible, file, opts);
24418
+ for (const { stats } of eligible) {
24419
+ if (!outcome.ok) {
24420
+ stats.filesUnreadable++;
24421
+ stats.filesRead--;
24422
+ if (outcome.reason === "zstd-unsupported")
24423
+ stats.filesZstdUnsupported++;
24424
+ stats.unreadableFiles.push({
24425
+ path: path3.relative(root, file),
24426
+ reason: outcome.reason
24427
+ });
24428
+ } else if (!outcome.genuine) {
24429
+ stats.filesForeign++;
24430
+ stats.filesRead--;
24431
+ stats.foreignOriginators.set(
24432
+ outcome.originator,
24433
+ (stats.foreignOriginators.get(outcome.originator) ?? 0) + 1
24434
+ );
24435
+ }
24117
24436
  }
24118
24437
  }
24119
24438
  }
24120
- readConfiguredMcpServers(agg, opts.configFile);
24121
- return stats;
24439
+ for (const { aggregate } of targets)
24440
+ readConfiguredMcpServers(aggregate, opts.configFile);
24441
+ return targets.map((target) => target.stats);
24122
24442
  }
24123
24443
  async function exists2(p8) {
24124
24444
  try {
@@ -24136,14 +24456,14 @@ function errorClass(e) {
24136
24456
  return e instanceof Error ? e.constructor.name : "unknown";
24137
24457
  }
24138
24458
  var readError = (reason) => Object.assign(new Error(reason), { code: reason });
24139
- async function ingestWithRetry(agg, file, opts) {
24459
+ async function ingestWithRetry(windows, file, opts) {
24140
24460
  try {
24141
- return await ingestFile2(agg, file, opts);
24461
+ return await ingestFile2(windows, file, opts);
24142
24462
  } catch (e) {
24143
24463
  traceError("codex rollout read", e);
24144
24464
  if (errorClass(e) === "ENOENT" && !file.endsWith(".zst")) {
24145
24465
  try {
24146
- return await ingestFile2(agg, `${file}.zst`, opts);
24466
+ return await ingestFile2(windows, `${file}.zst`, opts);
24147
24467
  } catch (e2) {
24148
24468
  traceError("codex compressed rollout retry", e2);
24149
24469
  return { ok: false, reason: errorClass(e2) };
@@ -24152,7 +24472,7 @@ async function ingestWithRetry(agg, file, opts) {
24152
24472
  return { ok: false, reason: errorClass(e) };
24153
24473
  }
24154
24474
  }
24155
- async function ingestFile2(agg, file, opts) {
24475
+ async function ingestFile2(windows, file, opts) {
24156
24476
  const compressed = file.endsWith(".zst");
24157
24477
  if (compressed && !createZstdDecompress2) throw readError("zstd-unsupported");
24158
24478
  const handle = await open(file, "r");
@@ -24224,11 +24544,17 @@ async function ingestFile2(agg, file, opts) {
24224
24544
  }
24225
24545
  const verdict = await classifyRollout(records(true));
24226
24546
  if (!verdict.genuine) return { ok: true, ...verdict };
24227
- agg.lines += nonEmptyLines;
24228
- agg.parseErrors += parseErrors;
24229
- const state = createFileState();
24547
+ const targets = windows.map((window) => ({
24548
+ ...window,
24549
+ state: createFileState()
24550
+ }));
24551
+ for (const { aggregate } of targets) {
24552
+ aggregate.lines += nonEmptyLines;
24553
+ aggregate.parseErrors += parseErrors;
24554
+ }
24230
24555
  for await (const rec of records(false))
24231
- ingestLine(agg, rec, state, opts.sinceMs);
24556
+ for (const { aggregate, state, sinceMs } of targets)
24557
+ ingestLine(aggregate, rec, state, sinceMs);
24232
24558
  return { ok: true, genuine: true };
24233
24559
  } finally {
24234
24560
  await handle.close();
@@ -24345,6 +24671,20 @@ var codexAdapter = {
24345
24671
  workflow: aggregate.workflow.finish(),
24346
24672
  workflowLocal: aggregate.workflowLocal
24347
24673
  };
24674
+ },
24675
+ async scanWindows(options) {
24676
+ const windows = options.map((opts) => ({
24677
+ aggregate: createAggregate3(),
24678
+ sinceMs: opts.sinceMs,
24679
+ onProgress: opts.onProgress
24680
+ }));
24681
+ const stats = await scanWindows(windows);
24682
+ return windows.map(({ aggregate }, index) => ({
24683
+ aggregate,
24684
+ stats: stats[index],
24685
+ workflow: aggregate.workflow.finish(),
24686
+ workflowLocal: aggregate.workflowLocal
24687
+ }));
24348
24688
  }
24349
24689
  };
24350
24690
 
@@ -24486,14 +24826,20 @@ function messageTimes(session, api = []) {
24486
24826
  if (time !== null) anchors.push({ index, time });
24487
24827
  const start = session.createdAtSource !== "epoch-unknown" ? timestamp(session.timestamp) : null;
24488
24828
  const end = session.lastUpdatedAtSource !== "epoch-unknown" ? timestamp(session.metadata?.lastModified) : null;
24489
- const apiTimes = api.filter((e) => e.session === session.id).map((e) => e.tsMs);
24829
+ let firstApi = null;
24830
+ let lastApi = null;
24831
+ for (const event of api) {
24832
+ if (event.session !== session.id) continue;
24833
+ firstApi = firstApi === null ? event.tsMs : Math.min(firstApi, event.tsMs);
24834
+ lastApi = lastApi === null ? event.tsMs : Math.max(lastApi, event.tsMs);
24835
+ }
24490
24836
  if (!anchors.some((a) => a.index === 0)) {
24491
- const time = start ?? (apiTimes.length ? Math.min(...apiTimes) : null);
24837
+ const time = start ?? firstApi;
24492
24838
  if (time !== null) anchors.unshift({ index: -1, time });
24493
24839
  }
24494
24840
  const last = session.messages.length;
24495
24841
  if (last && !anchors.some((a) => a.index === last - 1)) {
24496
- const time = end ?? (apiTimes.length ? Math.max(...apiTimes) : null);
24842
+ const time = end ?? lastApi;
24497
24843
  if (time !== null) anchors.push({ index: last, time });
24498
24844
  }
24499
24845
  for (let i = 0; i < times.length; i++) {
@@ -24708,9 +25054,15 @@ function readComposerSession(db, summary, signal) {
24708
25054
  const stored = db.composer.get(`composerData:${id}`);
24709
25055
  const createdStored = storedDate(stored?.createdAt) ?? (summary.createdAtSource === "composer-metadata" ? storedDate(summary.timestamp) : null);
24710
25056
  const updatedStored = storedDate(stored?.lastUpdatedAt) ?? storedDate(stored?.updatedAt) ?? (summary.lastUpdatedAtSource === "composer-metadata" ? storedDate(summary.metadata?.lastModified) : null);
24711
- const directMs = direct.flatMap((d) => d && isValid(d.ms) ? [d.ms] : []);
24712
- const created = createdStored !== null ? { ms: createdStored, source: "composer-metadata" } : directMs.length ? { ms: Math.min(...directMs), source: "direct-message" } : { ms: UNKNOWN_TIMESTAMP_EPOCH_MS, source: "epoch-unknown" };
24713
- const updated = updatedStored !== null ? { ms: updatedStored, source: "composer-metadata" } : directMs.length ? { ms: Math.max(...directMs), source: "direct-message" } : { ms: UNKNOWN_TIMESTAMP_EPOCH_MS, source: "epoch-unknown" };
25057
+ let firstDirect = null;
25058
+ let lastDirect = null;
25059
+ for (const time of direct) {
25060
+ if (!time || !isValid(time.ms)) continue;
25061
+ firstDirect = firstDirect === null ? time.ms : Math.min(firstDirect, time.ms);
25062
+ lastDirect = lastDirect === null ? time.ms : Math.max(lastDirect, time.ms);
25063
+ }
25064
+ const created = createdStored !== null ? { ms: createdStored, source: "composer-metadata" } : firstDirect !== null ? { ms: firstDirect, source: "direct-message" } : { ms: UNKNOWN_TIMESTAMP_EPOCH_MS, source: "epoch-unknown" };
25065
+ const updated = updatedStored !== null ? { ms: updatedStored, source: "composer-metadata" } : lastDirect !== null ? { ms: lastDirect, source: "direct-message" } : { ms: UNKNOWN_TIMESTAMP_EPOCH_MS, source: "epoch-unknown" };
24714
25066
  const times = resolveTimes(
24715
25067
  direct,
24716
25068
  created.source === "epoch-unknown" ? null : created.ms
@@ -25420,10 +25772,11 @@ async function fetchPages(account, from, to, fetchImpl, budget) {
25420
25772
  const eventIds = /* @__PURE__ */ new Set();
25421
25773
  let total;
25422
25774
  let retrieved = 0;
25423
- const pageSize = 100;
25424
- for (let page = 1; page <= 100; page++) {
25775
+ const pageSize = 1e3;
25776
+ const maxPages = 10;
25777
+ for (let page = 1; page <= maxPages; page++) {
25425
25778
  budget.signal.throwIfAborted();
25426
- if (++budget.requests > 1e3)
25779
+ if (++budget.requests > 100)
25427
25780
  throw Object.assign(new Error("Cursor request budget"), {
25428
25781
  code: "CURSOR_REQUEST_LIMIT"
25429
25782
  });
@@ -25451,7 +25804,8 @@ async function fetchPages(account, from, to, fetchImpl, budget) {
25451
25804
  status: response.status
25452
25805
  });
25453
25806
  const payload = asObj(await response.json());
25454
- const events = payload?.usageEventsDisplay;
25807
+ const omitted = payload !== null && !Object.hasOwn(payload, "usageEventsDisplay") && Object.keys(payload).every((key2) => key2 === "totalUsageEventsCount");
25808
+ const events = omitted ? [] : payload?.usageEventsDisplay;
25455
25809
  if (!Array.isArray(events))
25456
25810
  throw Object.assign(new Error("Invalid Cursor page"), {
25457
25811
  code: "CURSOR_INVALID_PAGE_SHAPE"
@@ -25460,14 +25814,16 @@ async function fetchPages(account, from, to, fetchImpl, budget) {
25460
25814
  throw Object.assign(new Error("Cursor page exceeds requested size"), {
25461
25815
  code: "CURSOR_PAGE_TOO_LARGE"
25462
25816
  });
25463
- if (payload?.totalUsageEventsCount !== void 0) {
25464
- const reported = count(payload.totalUsageEventsCount);
25817
+ if (omitted || payload?.totalUsageEventsCount !== void 0) {
25818
+ const reported = count(
25819
+ omitted && !Object.hasOwn(payload, "totalUsageEventsCount") ? 0 : payload?.totalUsageEventsCount
25820
+ );
25465
25821
  if (reported === void 0 || !Number.isInteger(reported) || total !== void 0 && total !== reported)
25466
25822
  throw Object.assign(new Error("Cursor page count changed"), {
25467
25823
  code: "CURSOR_PAGE_COUNT_CHANGED"
25468
25824
  });
25469
25825
  total = reported;
25470
- if (total > 100 * pageSize)
25826
+ if (total > maxPages * pageSize)
25471
25827
  throw Object.assign(new Error("Cursor page limit"), {
25472
25828
  code: "CURSOR_PAGE_LIMIT"
25473
25829
  });
@@ -25845,12 +26201,14 @@ async function scan3(options) {
25845
26201
  if (project && path8.isAbsolute(project)) aggregate.projectDirs.add(project);
25846
26202
  if (session.metadata?.cursorVersion)
25847
26203
  aggregate.ccVersions.add(session.metadata.cursorVersion);
25848
- const times = messageTimes(session, api).filter(
25849
- (t) => t !== null && t >= options.sinceMs && t <= now
25850
- );
25851
- if (times.length) {
26204
+ let firstTime = null;
26205
+ for (const time of messageTimes(session, api)) {
26206
+ if (time === null || time < options.sinceMs || time > now) continue;
26207
+ firstTime = firstTime === null ? time : Math.min(firstTime, time);
26208
+ }
26209
+ if (firstTime !== null) {
25852
26210
  aggregate.sessions.add(session.id);
25853
- noteSessionStart(aggregate, session.id, Math.min(...times));
26211
+ noteSessionStart(aggregate, session.id, firstTime);
25854
26212
  }
25855
26213
  }
25856
26214
  const usage = reconcile(contributions, api);
@@ -26396,9 +26754,18 @@ async function modelAliasesForRoot(root) {
26396
26754
  }
26397
26755
  }
26398
26756
  async function scan4(agg, opts = {}) {
26757
+ return (await scanWindows2(
26758
+ [{ aggregate: agg, sinceMs: opts.sinceMs, onProgress: opts.onProgress }],
26759
+ opts
26760
+ ))[0];
26761
+ }
26762
+ async function scanWindows2(windows, opts = {}) {
26399
26763
  const stats = emptyScanStats();
26400
- const sessionDates = /* @__PURE__ */ new Map();
26401
- const candidates = /* @__PURE__ */ new Map();
26764
+ const targets = windows.map((window) => ({
26765
+ ...window,
26766
+ sessionDates: /* @__PURE__ */ new Map(),
26767
+ candidates: /* @__PURE__ */ new Map()
26768
+ }));
26402
26769
  let complete = true;
26403
26770
  for (const root of opts.roots ?? sessionRoots()) {
26404
26771
  const aliases = await modelAliasesForRoot(root);
@@ -26465,7 +26832,10 @@ async function scan4(agg, opts = {}) {
26465
26832
  rows = [];
26466
26833
  precedence = 0;
26467
26834
  }
26468
- const eventState = createGrokEventState(parentSession);
26835
+ const eventTargets = targets.map((target) => ({
26836
+ ...target,
26837
+ eventState: createGrokEventState(parentSession)
26838
+ }));
26469
26839
  const updates = files.get("updates.jsonl");
26470
26840
  if (updates) {
26471
26841
  const useTerminalUsage = rows.length === 0 && !child;
@@ -26479,10 +26849,11 @@ async function scan4(agg, opts = {}) {
26479
26849
  stats.filesRead++;
26480
26850
  for (const value of read3.lines ?? []) {
26481
26851
  if (value === null) {
26482
- agg.parseErrors++;
26852
+ for (const { aggregate } of targets) aggregate.parseErrors++;
26483
26853
  continue;
26484
26854
  }
26485
- ingestUpdate(agg, eventState, value, projectDir, opts.sinceMs);
26855
+ for (const { aggregate, eventState, sinceMs } of eventTargets)
26856
+ ingestUpdate(aggregate, eventState, value, projectDir, sinceMs);
26486
26857
  if (useTerminalUsage) {
26487
26858
  const row = terminalContribution(value, projectDir);
26488
26859
  if (row) rows.push(row);
@@ -26501,36 +26872,40 @@ async function scan4(agg, opts = {}) {
26501
26872
  }
26502
26873
  stats.filesRead++;
26503
26874
  for (const value of read3.lines ?? []) {
26504
- if (value === null) agg.parseErrors++;
26875
+ if (value === null)
26876
+ for (const { aggregate } of targets) aggregate.parseErrors++;
26505
26877
  else
26506
- ingestEvent2(
26507
- agg,
26508
- eventState,
26509
- value,
26510
- sessionFallback,
26511
- projectDir,
26512
- opts.sinceMs
26513
- );
26878
+ for (const { aggregate, eventState, sinceMs } of eventTargets)
26879
+ ingestEvent2(
26880
+ aggregate,
26881
+ eventState,
26882
+ value,
26883
+ sessionFallback,
26884
+ projectDir,
26885
+ sinceMs
26886
+ );
26514
26887
  }
26515
26888
  }
26516
- rows = rows.filter(
26517
- (row) => opts.sinceMs === void 0 || row.tsMs >= opts.sinceMs
26518
- );
26519
- rows = rows.map((row) => ({
26520
- ...row,
26521
- models: row.models.map(({ model, counts: counts2 }) => ({
26522
- model: aliases.get(model) ?? model,
26523
- counts: counts2
26524
- }))
26525
- }));
26526
- if (rows.length > 0) {
26527
- const sessionId = rows[0]?.sessionId;
26528
- const held = candidates.get(sessionId);
26529
- const total = (values) => values.flatMap((value) => value.models).reduce((sum, model) => sum + countsTotal(model.counts), 0);
26530
- if (!held || precedence > held.precedence || precedence === held.precedence && total(rows) > total(held.rows))
26531
- candidates.set(sessionId, { precedence, rows });
26889
+ for (const { sinceMs, candidates, onProgress } of targets) {
26890
+ let windowRows = rows.filter(
26891
+ (row) => sinceMs === void 0 || row.tsMs >= sinceMs
26892
+ );
26893
+ windowRows = windowRows.map((row) => ({
26894
+ ...row,
26895
+ models: row.models.map(({ model, counts: counts2 }) => ({
26896
+ model: aliases.get(model) ?? model,
26897
+ counts: counts2
26898
+ }))
26899
+ }));
26900
+ if (windowRows.length > 0) {
26901
+ const sessionId = windowRows[0]?.sessionId;
26902
+ const held = candidates.get(sessionId);
26903
+ const total = (values) => values.flatMap((value) => value.models).reduce((sum, model) => sum + countsTotal(model.counts), 0);
26904
+ if (!held || precedence > held.precedence || precedence === held.precedence && total(windowRows) > total(held.rows))
26905
+ candidates.set(sessionId, { precedence, rows: windowRows });
26906
+ }
26907
+ onProgress?.(stats.filesFound);
26532
26908
  }
26533
- opts.onProgress?.(stats.filesFound);
26534
26909
  }
26535
26910
  try {
26536
26911
  const calls = await retainedContextCalls(
@@ -26538,21 +26913,23 @@ async function scan4(agg, opts = {}) {
26538
26913
  new Set(contextSessions.keys()),
26539
26914
  opts.contextCacheDir
26540
26915
  );
26541
- for (const call of calls) {
26542
- if (opts.sinceMs !== void 0 && call.tsMs < opts.sinceMs) continue;
26543
- const source = contextSessions.get(call.session);
26544
- agg.workflow.ingest({
26545
- type: "response",
26546
- session: call.session,
26547
- projectWorkspace: source?.projectDir,
26548
- parentSession: source?.parentSession,
26549
- tsMs: call.tsMs,
26550
- responseId: `context:${call.id}`,
26551
- contextTokens: call.tokens
26552
- });
26553
- const dates = sessionDates.get(call.session) ?? /* @__PURE__ */ new Set();
26554
- dates.add(new Date(call.tsMs).toISOString().slice(0, 10));
26555
- sessionDates.set(call.session, dates);
26916
+ for (const { aggregate, sinceMs, sessionDates } of targets) {
26917
+ for (const call of calls) {
26918
+ if (sinceMs !== void 0 && call.tsMs < sinceMs) continue;
26919
+ const source = contextSessions.get(call.session);
26920
+ aggregate.workflow.ingest({
26921
+ type: "response",
26922
+ session: call.session,
26923
+ projectWorkspace: source?.projectDir,
26924
+ parentSession: source?.parentSession,
26925
+ tsMs: call.tsMs,
26926
+ responseId: `context:${call.id}`,
26927
+ contextTokens: call.tokens
26928
+ });
26929
+ const dates = sessionDates.get(call.session) ?? /* @__PURE__ */ new Set();
26930
+ dates.add(new Date(call.tsMs).toISOString().slice(0, 10));
26931
+ sessionDates.set(call.session, dates);
26932
+ }
26556
26933
  }
26557
26934
  } catch (error) {
26558
26935
  traceError("grok retained context", error);
@@ -26560,15 +26937,17 @@ async function scan4(agg, opts = {}) {
26560
26937
  stats.filesUnreadable++;
26561
26938
  }
26562
26939
  }
26563
- for (const { rows } of candidates.values()) {
26564
- for (const row of rows) {
26565
- ingestContribution(agg, row);
26566
- const dates = sessionDates.get(row.sessionId) ?? /* @__PURE__ */ new Set();
26567
- dates.add(new Date(row.tsMs).toISOString().slice(0, 10));
26568
- sessionDates.set(row.sessionId, dates);
26940
+ for (const { aggregate, candidates, sessionDates } of targets) {
26941
+ for (const { rows } of candidates.values()) {
26942
+ for (const row of rows) {
26943
+ ingestContribution(aggregate, row);
26944
+ const dates = sessionDates.get(row.sessionId) ?? /* @__PURE__ */ new Set();
26945
+ dates.add(new Date(row.tsMs).toISOString().slice(0, 10));
26946
+ sessionDates.set(row.sessionId, dates);
26947
+ }
26569
26948
  }
26570
26949
  }
26571
- return { stats, complete, sessionDates };
26950
+ return targets.map(({ sessionDates }) => ({ stats, complete, sessionDates }));
26572
26951
  }
26573
26952
 
26574
26953
  // src/harness/grok/adapter.ts
@@ -26599,6 +26978,22 @@ var grokAdapter = {
26599
26978
  scanComplete: result.complete,
26600
26979
  sessionDates: result.sessionDates
26601
26980
  };
26981
+ },
26982
+ async scanWindows(options) {
26983
+ const windows = options.map((opts) => ({
26984
+ aggregate: createAggregate4(),
26985
+ sinceMs: opts.sinceMs,
26986
+ onProgress: opts.onProgress
26987
+ }));
26988
+ const results = await scanWindows2(windows);
26989
+ return windows.map(({ aggregate }, index) => ({
26990
+ aggregate,
26991
+ stats: results[index].stats,
26992
+ workflow: aggregate.workflow.finish(),
26993
+ workflowLocal: aggregate.workflowLocal,
26994
+ scanComplete: results[index].complete,
26995
+ sessionDates: results[index].sessionDates
26996
+ }));
26602
26997
  }
26603
26998
  };
26604
26999
 
@@ -29232,7 +29627,7 @@ function buildWorkflowExtraction(harnessWorkflows, git, utcOffsetMinutes = machi
29232
29627
  ])
29233
29628
  ].sort();
29234
29629
  return {
29235
- aggregateVersion: WORKFLOW_AGGREGATES_V3,
29630
+ aggregateVersion: WORKFLOW_AGGREGATES_V4,
29236
29631
  utcOffsetMinutes,
29237
29632
  days: dates.map((date) => {
29238
29633
  const projects = projectDays.get(date)?.size;
@@ -29529,7 +29924,7 @@ var PHASE_ORDER = ["scout", "build", "verify", "handoff", "unknown"];
29529
29924
  function workflowBlock(workflowDays, utcOffsetMinutes, host) {
29530
29925
  const out = [];
29531
29926
  const folded = foldWorkflowDays(workflowDays, {
29532
- aggregateVersion: WORKFLOW_AGGREGATES_V3,
29927
+ aggregateVersion: WORKFLOW_AGGREGATES_V4,
29533
29928
  utcOffsetMinutes
29534
29929
  });
29535
29930
  const harnesses = folded?.harnesses ?? [];
@@ -29539,7 +29934,7 @@ function workflowBlock(workflowDays, utcOffsetMinutes, host) {
29539
29934
  ...new Set(withPlaybook.map((h) => h.phase?.ruleVersion ?? ""))
29540
29935
  ].filter(Boolean);
29541
29936
  out.push(
29542
- `workflow ${harnesses.length} harness${harnesses.length === 1 ? "" : "es"} \xB7 ${sessions} sessions \xB7 ${WORKFLOW_AGGREGATES_V3}`
29937
+ `workflow ${harnesses.length} harness${harnesses.length === 1 ? "" : "es"} \xB7 ${sessions} sessions \xB7 ${WORKFLOW_AGGREGATES_V4}`
29543
29938
  );
29544
29939
  const first = folded?.dates[0];
29545
29940
  const last = folded?.dates.at(-1);
@@ -29556,6 +29951,26 @@ function workflowBlock(workflowDays, utcOffsetMinutes, host) {
29556
29951
  ).join(" \xB7 ");
29557
29952
  out.push(` ${mix} \xB7 ${ruleVersions.join(", ")}`);
29558
29953
  }
29954
+ const efficiency = harnesses.flatMap(
29955
+ (h) => h.efficiency ? [h.efficiency] : []
29956
+ );
29957
+ if (efficiency.length > 0) {
29958
+ const calls = efficiency.reduce(
29959
+ (a, e) => a + e.callGaps.reduce((n, b) => n + b.calls, 0) + e.sessionCalls.reduce((n, b) => n + b.sessions, 0),
29960
+ 0
29961
+ );
29962
+ const afterGap = efficiency.reduce((a, e) => a + e.callsAfterGap, 0);
29963
+ const results = efficiency.reduce(
29964
+ (a, e) => a + e.toolResults.reduce((n, t) => n + t.results, 0),
29965
+ 0
29966
+ );
29967
+ const tools = [
29968
+ ...new Set(efficiency.flatMap((e) => e.toolResults.map((t) => t.tool)))
29969
+ ].sort();
29970
+ out.push(
29971
+ ` efficiency: ${calls} calls, ${afterGap} after a break \xB7 ${results} tool result sizes${tools.length ? ` (${tools.join(", ")})` : ""}`
29972
+ );
29973
+ }
29559
29974
  const git = folded?.git;
29560
29975
  out.push(
29561
29976
  `git ${git?.commits ?? 0} commits \xB7 ${fmtTokens((git?.additions ?? 0) + (git?.removals ?? 0))} lines changed`
@@ -29847,30 +30262,49 @@ async function stageSync(deps) {
29847
30262
  note: phase
29848
30263
  });
29849
30264
  };
29850
- if (active3) {
29851
- step(id, label, "running", "recent usage");
29852
- const scanDone2 = traceTimer(`scan ${adapter.name} (recent)`);
29853
- reading.recent = await adapter.scan({
29854
- sinceMs,
29855
- publishWorkflow: false,
29856
- onProgress: progress("recent usage")
30265
+ if (active3 && adapter.scanWindows) {
30266
+ step(id, label, "running", "recent usage and history");
30267
+ const scanDone = traceTimer(
30268
+ `scan ${adapter.name} (recent and historical)`
30269
+ );
30270
+ [reading.recent, reading.history] = await adapter.scanWindows([
30271
+ { sinceMs, publishWorkflow: false },
30272
+ {
30273
+ sinceMs: daysSinceMs,
30274
+ publishWorkflow: config.publishWorkflow,
30275
+ onProgress: progress("recent usage and history")
30276
+ }
30277
+ ]);
30278
+ scanDone(
30279
+ describeScan(reading.history.stats),
30280
+ reading.history.scanComplete === false || reading.history.stats.filesUnreadable > 0 ? "warn" : "success"
30281
+ );
30282
+ } else {
30283
+ if (active3) {
30284
+ step(id, label, "running", "recent usage");
30285
+ const scanDone2 = traceTimer(`scan ${adapter.name} (recent)`);
30286
+ reading.recent = await adapter.scan({
30287
+ sinceMs,
30288
+ publishWorkflow: false,
30289
+ onProgress: progress("recent usage")
30290
+ });
30291
+ scanDone2(
30292
+ describeScan(reading.recent.stats),
30293
+ reading.recent.stats.filesUnreadable ? "warn" : "success"
30294
+ );
30295
+ }
30296
+ step(id, label, "running", "history");
30297
+ const scanDone = traceTimer(`scan ${adapter.name} (historical)`);
30298
+ reading.history = await adapter.scan({
30299
+ sinceMs: daysSinceMs,
30300
+ publishWorkflow: config.publishWorkflow,
30301
+ onProgress: progress("history")
29857
30302
  });
29858
- scanDone2(
29859
- describeScan(reading.recent.stats),
29860
- reading.recent.stats.filesUnreadable ? "warn" : "success"
30303
+ scanDone(
30304
+ `${describeScan(reading.history.stats)}${reading.history.scanComplete === false ? ", incomplete" : ""}`,
30305
+ reading.history.scanComplete === false || reading.history.stats.filesUnreadable > 0 ? "warn" : "success"
29861
30306
  );
29862
30307
  }
29863
- step(id, label, "running", "history");
29864
- const scanDone = traceTimer(`scan ${adapter.name} (historical)`);
29865
- reading.history = await adapter.scan({
29866
- sinceMs: daysSinceMs,
29867
- publishWorkflow: config.publishWorkflow,
29868
- onProgress: progress("history")
29869
- });
29870
- scanDone(
29871
- `${describeScan(reading.history.stats)}${reading.history.scanComplete === false ? ", incomplete" : ""}`,
29872
- reading.history.scanComplete === false || reading.history.stats.filesUnreadable > 0 ? "warn" : "success"
29873
- );
29874
30308
  const files = Math.max(seen, reading.history.stats.filesRead);
29875
30309
  step(
29876
30310
  id,