@claude-sessions/core 0.4.7-beta.2 → 0.4.8-beta.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 { P as Project, M as MessagePayload$1, a as Message, S as SummaryInfo, b as SessionTodos, c as MoveSessionResult, A as AgentInfo, d as SessionSortOptions, e as ProjectTreeData, C as CompressSessionOptions, f as SummarizeSessionOptions, g as ConversationLine, h as SearchResult, F as FileChange, i as SessionsIndex, j as SessionIndexEntry } from './types-BMQErZZE.js';
2
- export { p as CleanupPreview, o as ClearSessionsResult, v as CompressSessionResult, k as ContentItem, D as DeleteSessionResult, w as ProjectKnowledge, R as RenameSessionResult, r as ResumeSessionOptions, s as ResumeSessionResult, u as SessionAnalysis, m as SessionFilesSummary, l as SessionMeta, y as SessionSortField, z as SessionSortOrder, q as SessionTreeData, n as SplitSessionResult, x as SummarizeSessionResult, T as TodoItem, t as ToolUsageStats } from './types-BMQErZZE.js';
1
+ import { P as Project, M as MessagePayload$1, a as Message, T as TitleDisplayMode, S as SummaryInfo, b as SessionTodos, c as MoveSessionResult, A as AgentInfo, d as SessionSortOptions, e as ProjectTreeData, C as CompressSessionOptions, f as SummarizeSessionOptions, g as ConversationLine, h as SearchResult, F as FileChange, i as SessionsIndex, j as SessionIndexEntry } from './types-CsXAWb1Q.js';
2
+ export { q as CleanupPreview, p as ClearSessionsResult, w as CompressSessionResult, k as ContentItem, D as DeleteSessionResult, x as ProjectKnowledge, R as RenameSessionResult, s as ResumeSessionOptions, t as ResumeSessionResult, v as SessionAnalysis, n as SessionFilesSummary, l as SessionMeta, z as SessionSortField, B as SessionSortOrder, r as SessionTreeData, o as SplitSessionResult, y as SummarizeSessionResult, m as TodoItem, u as ToolUsageStats } from './types-CsXAWb1Q.js';
3
3
  import * as effect_Cause from 'effect/Cause';
4
4
  import { Effect } from 'effect';
5
5
 
@@ -94,12 +94,32 @@ declare const parseCommandMessage: (content?: string) => {
94
94
  declare const extractTitle: (input: MessagePayload$1 | string | undefined) => string;
95
95
  declare const isInvalidApiKeyMessage: (msg: Message) => boolean;
96
96
  declare const isContinuationSummary: (msg: Message) => boolean;
97
+ /**
98
+ * Options for getDisplayTitle when using the options-based signature
99
+ */
100
+ interface DisplayTitleOptions {
101
+ customTitle?: string;
102
+ currentSummary?: string;
103
+ title?: string;
104
+ createdAt?: string;
105
+ maxLength?: number;
106
+ fallback?: string;
107
+ /** 'message' = first user message (default), 'datetime' = relative date/time */
108
+ mode?: TitleDisplayMode;
109
+ /** Locale for date formatting (e.g. 'de-DE', 'en-GB'). Defaults to system locale. */
110
+ locale?: string;
111
+ }
97
112
  /**
98
113
  * Get display title with fallback logic
99
- * Priority: customTitle > currentSummary (truncated) > title > fallback
114
+ * Priority: customTitle > currentSummary (truncated) > title/datetime > fallback
100
115
  * Also handles slash command format in title
116
+ *
117
+ * Supports two call signatures:
118
+ * - Legacy: getDisplayTitle(customTitle, currentSummary, title, maxLength?, fallback?)
119
+ * - Options: getDisplayTitle(options)
101
120
  */
102
- declare const getDisplayTitle: (customTitle: string | undefined, currentSummary: string | undefined, title: string | undefined, maxLength?: number, fallback?: string) => string;
121
+ declare function getDisplayTitle(options: DisplayTitleOptions): string;
122
+ declare function getDisplayTitle(customTitle: string | undefined, currentSummary: string | undefined, title: string | undefined, maxLength?: number, fallback?: string): string;
103
123
  /**
104
124
  * Mask home directory path with ~
105
125
  * Only masks the specified homeDir, not other users' paths
@@ -139,7 +159,7 @@ declare const readJsonlFile: <T = Record<string, unknown>>(filePath: string, opt
139
159
  * @param timestamp - Unix timestamp (ms) or ISO date string
140
160
  * @returns Relative time string
141
161
  */
142
- declare const formatRelativeTime: (timestamp: number | string) => string;
162
+ declare const formatRelativeTime: (timestamp: number | string, locale?: string) => string;
143
163
  /**
144
164
  * Calculate total todo count from session todos
145
165
  * Includes both session-level and agent-level todos
@@ -670,4 +690,4 @@ declare const getLogger: () => Logger;
670
690
  */
671
691
  declare const createLogger: (namespace: string) => Logger;
672
692
 
673
- export { AgentInfo, type ChainError, CompressSessionOptions, ConversationLine, FileChange, type GenericMessage, type Logger, Message, MessagePayload$1 as MessagePayload, MoveSessionResult, type ProgressError, Project, ProjectTreeData, SearchResult, SessionIndexEntry, SessionSortOptions, SessionTodos, SessionsIndex, SummarizeSessionOptions, SummaryInfo, TREE_ICONS, type ToolUseResultError, type TreeItemType, type ValidationResult, analyzeSession, autoRepairChain, canMoveSession, clearSessions, compressSession, createLogger, deleteLinkedTodos, deleteMessage, deleteMessageWithChainRepair, deleteOrphanAgents, deleteOrphanTodos, deleteSession, expandHomePath, extractProjectKnowledge, extractTextContent, extractTitle, findLinkedAgents, findLinkedTodos, findOrphanAgents, findOrphanTodos, findProjectByWorkspacePath, folderNameToDisplayPath, folderNameToPath, formatRelativeTime, generateTreeNodeId, getCachePath, getDisplayTitle, getIndexEntryDisplayTitle, getLogger, getRealPathFromSession, getSessionFiles, getSessionSortTimestamp, getSessionTooltip, getSessionsDir, getTodoIcon, getTodosDir, getTotalTodoCount, hasSessionsIndex, isContinuationSummary, isInvalidApiKeyMessage, listProjects, listSessions, loadAgentMessages, loadProjectTreeData, loadSessionTreeData, loadSessionsIndex, maskHomePath, moveSession, parseCommandMessage, parseJsonlLines, parseTreeNodeId, pathToFolderName, previewCleanup, readJsonlFile, readSession, renameSession, repairChain, repairParentUuidChain, restoreMessage, searchSessions, sessionHasSubItems, sessionHasTodos, setLogger, sortIndexEntriesByModified, sortProjects, splitSession, summarizeSession, tryParseJsonLine, updateSessionSummary, validateChain, validateProgressMessages, validateToolUseResult };
693
+ export { AgentInfo, type ChainError, CompressSessionOptions, ConversationLine, type DisplayTitleOptions, FileChange, type GenericMessage, type Logger, Message, MessagePayload$1 as MessagePayload, MoveSessionResult, type ProgressError, Project, ProjectTreeData, SearchResult, SessionIndexEntry, SessionSortOptions, SessionTodos, SessionsIndex, SummarizeSessionOptions, SummaryInfo, TREE_ICONS, TitleDisplayMode, type ToolUseResultError, type TreeItemType, type ValidationResult, analyzeSession, autoRepairChain, canMoveSession, clearSessions, compressSession, createLogger, deleteLinkedTodos, deleteMessage, deleteMessageWithChainRepair, deleteOrphanAgents, deleteOrphanTodos, deleteSession, expandHomePath, extractProjectKnowledge, extractTextContent, extractTitle, findLinkedAgents, findLinkedTodos, findOrphanAgents, findOrphanTodos, findProjectByWorkspacePath, folderNameToDisplayPath, folderNameToPath, formatRelativeTime, generateTreeNodeId, getCachePath, getDisplayTitle, getIndexEntryDisplayTitle, getLogger, getRealPathFromSession, getSessionFiles, getSessionSortTimestamp, getSessionTooltip, getSessionsDir, getTodoIcon, getTodosDir, getTotalTodoCount, hasSessionsIndex, isContinuationSummary, isInvalidApiKeyMessage, listProjects, listSessions, loadAgentMessages, loadProjectTreeData, loadSessionTreeData, loadSessionsIndex, maskHomePath, moveSession, parseCommandMessage, parseJsonlLines, parseTreeNodeId, pathToFolderName, previewCleanup, readJsonlFile, readSession, renameSession, repairChain, repairParentUuidChain, restoreMessage, searchSessions, sessionHasSubItems, sessionHasTodos, setLogger, sortIndexEntriesByModified, sortProjects, splitSession, summarizeSession, tryParseJsonLine, updateSessionSummary, validateChain, validateProgressMessages, validateToolUseResult };
package/dist/index.js CHANGED
@@ -95,11 +95,31 @@ var isContinuationSummary = (msg) => {
95
95
  const text = extractTextContent(msg.message);
96
96
  return text.startsWith("This session is being continued from");
97
97
  };
98
- var getDisplayTitle = (customTitle, currentSummary, title, maxLength = 60, fallback = "Untitled") => {
98
+ function getDisplayTitle(customTitleOrOptions, currentSummary, title, maxLength = 60, fallback = "Untitled") {
99
+ let mode = "message";
100
+ let createdAt;
101
+ let customTitle;
102
+ let locale;
103
+ if (typeof customTitleOrOptions === "object" && customTitleOrOptions !== null) {
104
+ const opts = customTitleOrOptions;
105
+ customTitle = opts.customTitle;
106
+ currentSummary = opts.currentSummary;
107
+ title = opts.title;
108
+ createdAt = opts.createdAt;
109
+ maxLength = opts.maxLength ?? 60;
110
+ fallback = opts.fallback ?? "Untitled";
111
+ mode = opts.mode ?? "message";
112
+ locale = opts.locale;
113
+ } else {
114
+ customTitle = customTitleOrOptions;
115
+ }
99
116
  if (customTitle) return customTitle;
100
117
  if (currentSummary) {
101
118
  return currentSummary.length > maxLength ? currentSummary.slice(0, maxLength - 3) + "..." : currentSummary;
102
119
  }
120
+ if (mode === "datetime" && createdAt) {
121
+ return formatRelativeTime(createdAt, locale);
122
+ }
103
123
  if (title && title !== "Untitled") {
104
124
  const firstParagraph = title.includes("\n\n") ? title.split("\n\n")[0] : title;
105
125
  if (firstParagraph.includes("<command-name>")) {
@@ -109,7 +129,7 @@ var getDisplayTitle = (customTitle, currentSummary, title, maxLength = 60, fallb
109
129
  return firstParagraph;
110
130
  }
111
131
  return fallback;
112
- };
132
+ }
113
133
  var replaceMessageContent = (msg, text) => ({
114
134
  ...msg,
115
135
  message: {
@@ -179,7 +199,7 @@ var readJsonlFile = (filePath, options) => Effect.gen(function* () {
179
199
  const lines = content.trim().split("\n").filter(Boolean);
180
200
  return parseJsonlLines(lines, filePath, options);
181
201
  });
182
- var formatRelativeTime = (timestamp) => {
202
+ var formatRelativeTime = (timestamp, locale) => {
183
203
  const date = typeof timestamp === "string" ? new Date(timestamp) : new Date(timestamp);
184
204
  const now = /* @__PURE__ */ new Date();
185
205
  const diff = now.getTime() - date.getTime();
@@ -190,7 +210,7 @@ var formatRelativeTime = (timestamp) => {
190
210
  if (minutes < 60) return `${minutes}m ago`;
191
211
  if (hours < 24) return `${hours}h ago`;
192
212
  if (days < 7) return `${days}d ago`;
193
- return date.toLocaleDateString();
213
+ return date.toLocaleDateString(locale, { day: "numeric", month: "short", year: "numeric" });
194
214
  };
195
215
  var getTotalTodoCount = (todos) => {
196
216
  return todos.sessionTodos.length + todos.agentTodos.reduce((sum, a) => sum + a.todos.length, 0);