@claude-sessions/core 0.3.7 → 0.4.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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MessagePayload, a as Message, P as Project, T as TodoItem, F as FileChange, C as CompressSessionOptions, S as SummarizeSessionOptions, b as ConversationLine, c as MoveSessionResult, d as SearchResult, e as SummaryInfo, A as AgentInfo } from './types-Cz8chaYQ.js';
2
- export { l as CleanupPreview, k as ClearSessionsResult, s as CompressSessionResult, f as ContentItem, D as DeleteSessionResult, t as ProjectKnowledge, n as ProjectTreeData, R as RenameSessionResult, o as ResumeSessionOptions, p as ResumeSessionResult, r as SessionAnalysis, i as SessionFilesSummary, g as SessionMeta, h as SessionTodos, m as SessionTreeData, j as SplitSessionResult, u as SummarizeSessionResult, q as ToolUsageStats } from './types-Cz8chaYQ.js';
1
+ import { M as MessagePayload, a as Message, P as Project, S as SummaryInfo, T as TodoItem, b as MoveSessionResult, A as AgentInfo, c as SessionSortOptions, C as CompressSessionOptions, d as SummarizeSessionOptions, e as ConversationLine, f as SearchResult, F as FileChange, g as SessionsIndex, h as SessionIndexEntry } from './types-BdPaAnP8.js';
2
+ export { o as CleanupPreview, n as ClearSessionsResult, v as CompressSessionResult, i as ContentItem, D as DeleteSessionResult, w as ProjectKnowledge, q as ProjectTreeData, R as RenameSessionResult, r as ResumeSessionOptions, s as ResumeSessionResult, u as SessionAnalysis, l as SessionFilesSummary, j as SessionMeta, y as SessionSortField, z as SessionSortOrder, k as SessionTodos, p as SessionTreeData, m as SplitSessionResult, x as SummarizeSessionResult, t as ToolUsageStats } from './types-BdPaAnP8.js';
3
3
  import * as effect_Cause from 'effect/Cause';
4
4
  import { Effect } from 'effect';
5
5
 
@@ -76,6 +76,21 @@ declare const getDisplayTitle: (customTitle: string | undefined, currentSummary:
76
76
  * Only masks the specified homeDir, not other users' paths
77
77
  */
78
78
  declare const maskHomePath: (text: string, homeDir: string) => string;
79
+ /**
80
+ * Get session sort timestamp based on official Claude Code extension behavior
81
+ *
82
+ * CRITICAL ARCHITECTURE:
83
+ * - Summary records have `leafUuid` but NO timestamp in the summary record itself
84
+ * - `leafUuid` points to a message in ANOTHER session (cross-session reference)
85
+ * - The timestamp for sorting must come from the TARGET message's timestamp
86
+ * - Official extension uses leafUuid's target message timestamp for sorting/display
87
+ *
88
+ * Priority: summaries[0].timestamp (leafUuid-based) > createdAt
89
+ */
90
+ declare const getSessionSortTimestamp: (session: {
91
+ summaries?: SummaryInfo[];
92
+ createdAt?: string;
93
+ }) => string | undefined;
79
94
  /**
80
95
  * Sort projects with priority:
81
96
  * 1. Current project (if specified)
@@ -126,10 +141,16 @@ declare const deleteOrphanTodos: () => Effect.Effect<{
126
141
  }, effect_Cause.UnknownException, never>;
127
142
 
128
143
  declare const listProjects: Effect.Effect<Project[], effect_Cause.UnknownException, never>;
144
+
145
+ declare const updateSessionSummary: (projectName: string, sessionId: string, newSummary: string) => Effect.Effect<{
146
+ success: boolean;
147
+ }, effect_Cause.UnknownException, never>;
129
148
  declare const listSessions: (projectName: string) => Effect.Effect<{
130
149
  id: string;
131
150
  projectName: string;
132
151
  title: string;
152
+ customTitle: string | undefined;
153
+ currentSummary: string | undefined;
133
154
  messageCount: number;
134
155
  createdAt: string | undefined;
135
156
  updatedAt: string | undefined;
@@ -169,40 +190,6 @@ declare const renameSession: (projectName: string, sessionId: string, newTitle:
169
190
  success: true;
170
191
  error?: undefined;
171
192
  }, effect_Cause.UnknownException, never>;
172
- declare const getSessionFiles: (projectName: string, sessionId: string) => Effect.Effect<{
173
- sessionId: string;
174
- projectName: string;
175
- files: FileChange[];
176
- totalChanges: number;
177
- }, effect_Cause.UnknownException, never>;
178
- declare const analyzeSession: (projectName: string, sessionId: string) => Effect.Effect<{
179
- sessionId: string;
180
- projectName: string;
181
- durationMinutes: number;
182
- stats: {
183
- totalMessages: number;
184
- userMessages: number;
185
- assistantMessages: number;
186
- summaryCount: number;
187
- snapshotCount: number;
188
- };
189
- toolUsage: {
190
- name: string;
191
- count: number;
192
- errorCount: number;
193
- }[];
194
- filesChanged: string[];
195
- patterns: {
196
- type: string;
197
- description: string;
198
- count: number;
199
- }[];
200
- milestones: {
201
- timestamp?: string;
202
- description: string;
203
- messageUuid?: string;
204
- }[];
205
- }, effect_Cause.UnknownException, never>;
206
193
  declare const moveSession: (sourceProject: string, sessionId: string, targetProject: string) => Effect.Effect<MoveSessionResult, Error>;
207
194
  declare const splitSession: (projectName: string, sessionId: string, splitAtMessageUuid: string) => Effect.Effect<{
208
195
  success: false;
@@ -219,46 +206,7 @@ declare const splitSession: (projectName: string, sessionId: string, splitAtMess
219
206
  duplicatedSummary: boolean;
220
207
  error?: undefined;
221
208
  }, effect_Cause.UnknownException, never>;
222
- declare const previewCleanup: (projectName?: string) => Effect.Effect<{
223
- project: string;
224
- emptySessions: {
225
- id: string;
226
- projectName: string;
227
- title: string;
228
- messageCount: number;
229
- createdAt: string | undefined;
230
- updatedAt: string | undefined;
231
- }[];
232
- invalidSessions: {
233
- id: string;
234
- projectName: string;
235
- title: string;
236
- messageCount: number;
237
- createdAt: string | undefined;
238
- updatedAt: string | undefined;
239
- }[];
240
- emptyWithTodosCount: number;
241
- orphanAgentCount: number;
242
- orphanTodoCount: number;
243
- }[], effect_Cause.UnknownException, never>;
244
- declare const clearSessions: (options: {
245
- projectName?: string;
246
- clearEmpty?: boolean;
247
- clearInvalid?: boolean;
248
- skipWithTodos?: boolean;
249
- clearOrphanAgents?: boolean;
250
- clearOrphanTodos?: boolean;
251
- }) => Effect.Effect<{
252
- success: true;
253
- deletedCount: number;
254
- removedMessageCount: number;
255
- deletedOrphanAgentCount: number;
256
- deletedOrphanTodoCount: number;
257
- }, effect_Cause.UnknownException, never>;
258
- declare const searchSessions: (query: string, options?: {
259
- projectName?: string;
260
- searchContent?: boolean;
261
- }) => Effect.Effect<SearchResult[], effect_Cause.UnknownException, never>;
209
+
262
210
  declare const loadSessionTreeData: (projectName: string, sessionId: string) => Effect.Effect<{
263
211
  id: string;
264
212
  projectName: string;
@@ -268,6 +216,7 @@ declare const loadSessionTreeData: (projectName: string, sessionId: string) => E
268
216
  messageCount: number;
269
217
  createdAt: string;
270
218
  updatedAt: string;
219
+ fileMtime: number | undefined;
271
220
  summaries: SummaryInfo[];
272
221
  agents: AgentInfo[];
273
222
  todos: {
@@ -281,7 +230,7 @@ declare const loadSessionTreeData: (projectName: string, sessionId: string) => E
281
230
  };
282
231
  lastCompactBoundaryUuid: string | undefined;
283
232
  }, effect_Cause.UnknownException, never>;
284
- declare const loadProjectTreeData: (projectName: string) => Effect.Effect<{
233
+ declare const loadProjectTreeData: (projectName: string, sortOptions?: SessionSortOptions) => Effect.Effect<{
285
234
  name: string;
286
235
  displayName: string;
287
236
  path: string;
@@ -295,6 +244,7 @@ declare const loadProjectTreeData: (projectName: string) => Effect.Effect<{
295
244
  messageCount: number;
296
245
  createdAt: string;
297
246
  updatedAt: string;
247
+ fileMtime: number | undefined;
298
248
  summaries: SummaryInfo[];
299
249
  agents: AgentInfo[];
300
250
  todos: {
@@ -309,8 +259,34 @@ declare const loadProjectTreeData: (projectName: string) => Effect.Effect<{
309
259
  lastCompactBoundaryUuid: string | undefined;
310
260
  }[];
311
261
  } | null, effect_Cause.UnknownException, never>;
312
- declare const updateSessionSummary: (projectName: string, sessionId: string, newSummary: string) => Effect.Effect<{
313
- success: boolean;
262
+
263
+ declare const analyzeSession: (projectName: string, sessionId: string) => Effect.Effect<{
264
+ sessionId: string;
265
+ projectName: string;
266
+ durationMinutes: number;
267
+ stats: {
268
+ totalMessages: number;
269
+ userMessages: number;
270
+ assistantMessages: number;
271
+ summaryCount: number;
272
+ snapshotCount: number;
273
+ };
274
+ toolUsage: {
275
+ name: string;
276
+ count: number;
277
+ errorCount: number;
278
+ }[];
279
+ filesChanged: string[];
280
+ patterns: {
281
+ type: string;
282
+ description: string;
283
+ count: number;
284
+ }[];
285
+ milestones: {
286
+ timestamp?: string;
287
+ description: string;
288
+ messageUuid?: string;
289
+ }[];
314
290
  }, effect_Cause.UnknownException, never>;
315
291
  declare const compressSession: (projectName: string, sessionId: string, options?: CompressSessionOptions) => Effect.Effect<{
316
292
  success: true;
@@ -344,6 +320,78 @@ declare const summarizeSession: (projectName: string, sessionId: string, options
344
320
  formatted: string;
345
321
  }, effect_Cause.UnknownException, never>;
346
322
 
323
+ declare const previewCleanup: (projectName?: string) => Effect.Effect<{
324
+ project: string;
325
+ emptySessions: {
326
+ id: string;
327
+ projectName: string;
328
+ title: string;
329
+ customTitle: string | undefined;
330
+ currentSummary: string | undefined;
331
+ messageCount: number;
332
+ createdAt: string | undefined;
333
+ updatedAt: string | undefined;
334
+ }[];
335
+ invalidSessions: {
336
+ id: string;
337
+ projectName: string;
338
+ title: string;
339
+ customTitle: string | undefined;
340
+ currentSummary: string | undefined;
341
+ messageCount: number;
342
+ createdAt: string | undefined;
343
+ updatedAt: string | undefined;
344
+ }[];
345
+ emptyWithTodosCount: number;
346
+ orphanAgentCount: number;
347
+ orphanTodoCount: number;
348
+ }[], effect_Cause.UnknownException, never>;
349
+ declare const clearSessions: (options: {
350
+ projectName?: string;
351
+ clearEmpty?: boolean;
352
+ clearInvalid?: boolean;
353
+ skipWithTodos?: boolean;
354
+ clearOrphanAgents?: boolean;
355
+ clearOrphanTodos?: boolean;
356
+ }) => Effect.Effect<{
357
+ success: true;
358
+ deletedCount: number;
359
+ removedMessageCount: number;
360
+ deletedOrphanAgentCount: number;
361
+ deletedOrphanTodoCount: number;
362
+ }, effect_Cause.UnknownException, never>;
363
+
364
+ declare const searchSessions: (query: string, options?: {
365
+ projectName?: string;
366
+ searchContent?: boolean;
367
+ }) => Effect.Effect<SearchResult[], effect_Cause.UnknownException, never>;
368
+
369
+ declare const getSessionFiles: (projectName: string, sessionId: string) => Effect.Effect<{
370
+ sessionId: string;
371
+ projectName: string;
372
+ files: FileChange[];
373
+ totalChanges: number;
374
+ }, effect_Cause.UnknownException, never>;
375
+
376
+ /**
377
+ * Load sessions-index.json for a project
378
+ * Returns null if the file doesn't exist
379
+ */
380
+ declare const loadSessionsIndex: (projectName: string) => Effect.Effect<SessionsIndex | null, effect_Cause.UnknownException, never>;
381
+ /**
382
+ * Get display title from index entry
383
+ * Priority: customTitle > summary > firstPrompt (cleaned)
384
+ */
385
+ declare const getIndexEntryDisplayTitle: (entry: SessionIndexEntry) => string;
386
+ /**
387
+ * Sort index entries by modified time (newest first)
388
+ */
389
+ declare const sortIndexEntriesByModified: (entries: SessionIndexEntry[]) => SessionIndexEntry[];
390
+ /**
391
+ * Check if sessions-index.json exists for a project
392
+ */
393
+ declare const hasSessionsIndex: (projectName: string) => Effect.Effect<boolean, effect_Cause.UnknownException, never>;
394
+
347
395
  /**
348
396
  * Simple logger abstraction for Claude Sessions
349
397
  * Consumers can provide their own logger implementation
@@ -378,4 +426,4 @@ declare const getLogger: () => Logger;
378
426
  */
379
427
  declare const createLogger: (namespace: string) => Logger;
380
428
 
381
- export { AgentInfo, CompressSessionOptions, ConversationLine, FileChange, type Logger, Message, MessagePayload, MoveSessionResult, Project, SearchResult, SummarizeSessionOptions, SummaryInfo, TodoItem, analyzeSession, clearSessions, compressSession, createLogger, deleteLinkedTodos, deleteMessage, deleteOrphanAgents, deleteOrphanTodos, deleteSession, displayPathToFolderName, extractProjectKnowledge, extractTextContent, extractTitle, findLinkedAgents, findLinkedTodos, findOrphanAgents, findOrphanTodos, findProjectByWorkspacePath, folderNameToDisplayPath, folderNameToPath, getDisplayTitle, getLogger, getRealPathFromSession, getSessionFiles, getSessionsDir, getTodosDir, isContinuationSummary, isInvalidApiKeyMessage, listProjects, listSessions, loadAgentMessages, loadProjectTreeData, loadSessionTreeData, maskHomePath, moveSession, pathToFolderName, previewCleanup, readSession, renameSession, restoreMessage, searchSessions, sessionHasTodos, setLogger, sortProjects, splitSession, summarizeSession, updateSessionSummary };
429
+ export { AgentInfo, CompressSessionOptions, ConversationLine, FileChange, type Logger, Message, MessagePayload, MoveSessionResult, Project, SearchResult, SessionIndexEntry, SessionSortOptions, SessionsIndex, SummarizeSessionOptions, SummaryInfo, TodoItem, analyzeSession, clearSessions, compressSession, createLogger, deleteLinkedTodos, deleteMessage, deleteOrphanAgents, deleteOrphanTodos, deleteSession, displayPathToFolderName, extractProjectKnowledge, extractTextContent, extractTitle, findLinkedAgents, findLinkedTodos, findOrphanAgents, findOrphanTodos, findProjectByWorkspacePath, folderNameToDisplayPath, folderNameToPath, getDisplayTitle, getIndexEntryDisplayTitle, getLogger, getRealPathFromSession, getSessionFiles, getSessionSortTimestamp, getSessionsDir, getTodosDir, hasSessionsIndex, isContinuationSummary, isInvalidApiKeyMessage, listProjects, listSessions, loadAgentMessages, loadProjectTreeData, loadSessionTreeData, loadSessionsIndex, maskHomePath, moveSession, pathToFolderName, previewCleanup, readSession, renameSession, restoreMessage, searchSessions, sessionHasTodos, setLogger, sortIndexEntriesByModified, sortProjects, splitSession, summarizeSession, updateSessionSummary };