codesesh 0.11.0 → 0.12.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.
@@ -909,11 +909,16 @@ var ClaudeCodeAgent = class extends FileSystemSessionSource {
909
909
  perf.end(scanMarker);
910
910
  return heads;
911
911
  }
912
- listSessionSources() {
912
+ listSessionSources(options) {
913
913
  if (!this.basePath) return [];
914
914
  const refs = [];
915
915
  for (const projectDir of this.listProjectDirs()) {
916
916
  for (const file of this.listJsonlFiles(projectDir)) {
917
+ try {
918
+ if (!matchesScanWindow(statSync2(file).mtimeMs, options)) continue;
919
+ } catch {
920
+ continue;
921
+ }
917
922
  const sessionId = basename2(file, ".jsonl");
918
923
  refs.push({
919
924
  sessionId,
@@ -2316,12 +2321,12 @@ var KimiAgent = class extends FileSystemSessionSource {
2316
2321
  perf.end(scanMarker);
2317
2322
  return heads;
2318
2323
  }
2319
- listSessionSources() {
2324
+ listSessionSources(options) {
2320
2325
  if (!this.basePath) return [];
2321
2326
  const refs = [];
2322
2327
  for (const dir of this.listSessionDirs()) {
2323
2328
  const meta = getParsedSession(this.parseSessionDirResult(dir));
2324
- if (!meta) continue;
2329
+ if (!meta || !matchesScanWindow(meta.createdAt, options)) continue;
2325
2330
  refs.push({
2326
2331
  sessionId: meta.id,
2327
2332
  sourcePath: meta.sourcePath,
@@ -2999,10 +3004,10 @@ var CodexAgent = class extends FileSystemSessionSource {
2999
3004
  perf.end(scanMarker);
3000
3005
  return heads;
3001
3006
  }
3002
- listSessionSources() {
3007
+ listSessionSources(options) {
3003
3008
  if (!this.basePath) return [];
3004
3009
  this.loadSessionIndex();
3005
- return this.listRolloutFiles().map((file) => ({
3010
+ return this.listRolloutFiles(options).map((file) => ({
3006
3011
  sessionId: extractSessionId(file),
3007
3012
  sourcePath: file,
3008
3013
  fingerprint: this.sourceFingerprint(file)
@@ -4606,9 +4611,9 @@ var PiAgent = class extends FileSystemSessionSource {
4606
4611
  perf.end(scanMarker);
4607
4612
  return heads;
4608
4613
  }
4609
- listSessionSources() {
4614
+ listSessionSources(options) {
4610
4615
  if (!this.basePath) return [];
4611
- return this.listSessionFiles().map((file) => ({
4616
+ return this.listSessionFiles(options).map((file) => ({
4612
4617
  sessionId: extractSessionIdFromFilename(file),
4613
4618
  sourcePath: file,
4614
4619
  fingerprint: this.sourceFingerprint(file)
@@ -5571,6 +5576,13 @@ function getFtsIntegrityCheckedPath() {
5571
5576
  function setFtsIntegrityCheckedPath(path2) {
5572
5577
  ftsIntegrityCheckedPath = path2;
5573
5578
  }
5579
+ var schemaEnsuredPath = null;
5580
+ function getSchemaEnsuredPath() {
5581
+ return schemaEnsuredPath;
5582
+ }
5583
+ function setSchemaEnsuredPath(path2) {
5584
+ schemaEnsuredPath = path2;
5585
+ }
5574
5586
  function getCacheDir2() {
5575
5587
  return join11(homedir4(), ".cache", "codesesh");
5576
5588
  }
@@ -6033,7 +6045,10 @@ function withCacheDb(fn) {
6033
6045
  const db = openDb(cachePath);
6034
6046
  if (!db) return null;
6035
6047
  try {
6036
- ensureSchema(db, cachePath);
6048
+ if (getSchemaEnsuredPath() !== cachePath) {
6049
+ ensureSchema(db, cachePath);
6050
+ setSchemaEnsuredPath(cachePath);
6051
+ }
6037
6052
  return fn(db);
6038
6053
  } catch {
6039
6054
  return null;
@@ -7875,16 +7890,41 @@ function isAgentCacheInitialized(agentName, indexVersion = CACHE_INITIALIZATION_
7875
7890
  }
7876
7891
  function markAgentCacheInitialized(agentName, indexVersion = CACHE_INITIALIZATION_VERSION) {
7877
7892
  withCacheDb((db) => {
7878
- const now = Date.now();
7879
7893
  db.prepare(
7880
7894
  `
7881
7895
  INSERT INTO cache_initialization(agent_name, initialized_at, index_version, last_sync_at)
7882
- VALUES (?, ?, ?, ?)
7896
+ VALUES (?, ?, ?, 0)
7883
7897
  ON CONFLICT(agent_name) DO UPDATE SET
7884
- index_version = excluded.index_version,
7885
- last_sync_at = excluded.last_sync_at
7898
+ index_version = excluded.index_version
7899
+ `
7900
+ ).run(agentName, Date.now(), indexVersion);
7901
+ });
7902
+ }
7903
+ function getAgentLastFullSyncAt(agentName) {
7904
+ if (!hasCacheStorage()) {
7905
+ return null;
7906
+ }
7907
+ return withCacheDbReadOnly((db) => {
7908
+ if (!tableExists(db, "cache_initialization")) return null;
7909
+ const row = db.prepare(
7910
+ `
7911
+ SELECT last_sync_at
7912
+ FROM cache_initialization
7913
+ WHERE agent_name = ?
7914
+ `
7915
+ ).get(agentName);
7916
+ return row?.last_sync_at || null;
7917
+ }) ?? null;
7918
+ }
7919
+ function markAgentFullSyncCompleted(agentName) {
7920
+ withCacheDb((db) => {
7921
+ db.prepare(
7922
+ `
7923
+ UPDATE cache_initialization
7924
+ SET last_sync_at = ?
7925
+ WHERE agent_name = ?
7886
7926
  `
7887
- ).run(agentName, now, indexVersion, now);
7927
+ ).run(Date.now(), agentName);
7888
7928
  });
7889
7929
  }
7890
7930
  function loadCachedSessionData(agentName, sessionId) {
@@ -8101,6 +8141,7 @@ function saveCachedSessionChanges(agentName, changes, removedSessionIds, meta =
8101
8141
  }
8102
8142
  function clearCache() {
8103
8143
  setFtsIntegrityCheckedPath(null);
8144
+ setSchemaEnsuredPath(null);
8104
8145
  if (!hasCacheStorage()) {
8105
8146
  deleteLegacyCacheFile();
8106
8147
  return;
@@ -8516,6 +8557,7 @@ async function scanAgentFull(agent, options, onProgress, timing = { total: 0 },
8516
8557
  if (options.writeCache !== false && options.from == null && options.to == null) {
8517
8558
  saveCachedSessions(agent.name, tagged.sessions, meta);
8518
8559
  markAgentCacheInitialized(agent.name);
8560
+ markAgentFullSyncCompleted(agent.name);
8519
8561
  }
8520
8562
  onProgress?.({ agent: agent.name, phase: "complete", newCount: tagged.sessions.length });
8521
8563
  const filtered2 = filterSessions(tagged.sessions, options);
@@ -9045,6 +9087,7 @@ export {
9045
9087
  skippedSession,
9046
9088
  filteredSession,
9047
9089
  getParsedSession,
9090
+ matchesScanWindow,
9048
9091
  BaseAgent,
9049
9092
  FileSystemSessionSource,
9050
9093
  DatabaseSessionSource,
@@ -9093,6 +9136,8 @@ export {
9093
9136
  extractFileActivityOccurrences,
9094
9137
  summarizeFileActivity,
9095
9138
  extractSessionFileActivity,
9139
+ setFtsIntegrityCheckedPath,
9140
+ getCachePath2,
9096
9141
  parseSearchQuery,
9097
9142
  syncSessionSearchIndex,
9098
9143
  syncSessionSearchIndexChanges,
@@ -9103,6 +9148,8 @@ export {
9103
9148
  loadCachedSessions,
9104
9149
  isAgentCacheInitialized,
9105
9150
  markAgentCacheInitialized,
9151
+ getAgentLastFullSyncAt,
9152
+ markAgentFullSyncCompleted,
9106
9153
  loadCachedSessionData,
9107
9154
  saveCachedSessions,
9108
9155
  saveCachedSessionChanges,
@@ -9115,6 +9162,7 @@ export {
9115
9162
  sortSessions,
9116
9163
  computeSessionDiff,
9117
9164
  filterSessions,
9165
+ ensureSessionTagsSync,
9118
9166
  scanSessions,
9119
9167
  scanSessionsAsync,
9120
9168
  BookmarkStorageUnavailableError,
@@ -9130,4 +9178,4 @@ export {
9130
9178
  startOfLocalDay,
9131
9179
  buildDashboard
9132
9180
  };
9133
- //# sourceMappingURL=chunk-BIXOP5QX.js.map
9181
+ //# sourceMappingURL=chunk-GCOAE7KI.js.map