claude-mem 3.2.0 → 3.2.2

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.
Files changed (50) hide show
  1. package/claude-mem +0 -0
  2. package/package.json +1 -2
  3. package/dist/bin/cli.d.ts +0 -2
  4. package/dist/bin/cli.js +0 -129
  5. package/dist/commands/compress.d.ts +0 -2
  6. package/dist/commands/compress.js +0 -27
  7. package/dist/commands/hooks.d.ts +0 -19
  8. package/dist/commands/hooks.js +0 -131
  9. package/dist/commands/install.d.ts +0 -2
  10. package/dist/commands/install.js +0 -649
  11. package/dist/commands/load-context.d.ts +0 -2
  12. package/dist/commands/load-context.js +0 -108
  13. package/dist/commands/logs.d.ts +0 -2
  14. package/dist/commands/logs.js +0 -76
  15. package/dist/commands/migrate-to-jsonl.d.ts +0 -5
  16. package/dist/commands/migrate-to-jsonl.js +0 -99
  17. package/dist/commands/status.d.ts +0 -1
  18. package/dist/commands/status.js +0 -136
  19. package/dist/commands/uninstall.d.ts +0 -2
  20. package/dist/commands/uninstall.js +0 -107
  21. package/dist/constants.d.ts +0 -271
  22. package/dist/constants.js +0 -199
  23. package/dist/core/compression/TranscriptCompressor.d.ts +0 -83
  24. package/dist/core/compression/TranscriptCompressor.js +0 -602
  25. package/dist/core/orchestration/PromptOrchestrator.d.ts +0 -165
  26. package/dist/core/orchestration/PromptOrchestrator.js +0 -182
  27. package/dist/lib/time-utils.d.ts +0 -5
  28. package/dist/lib/time-utils.js +0 -70
  29. package/dist/prompts/constants.d.ts +0 -126
  30. package/dist/prompts/constants.js +0 -161
  31. package/dist/prompts/index.d.ts +0 -10
  32. package/dist/prompts/index.js +0 -11
  33. package/dist/prompts/templates/analysis/AnalysisTemplates.d.ts +0 -13
  34. package/dist/prompts/templates/analysis/AnalysisTemplates.js +0 -94
  35. package/dist/prompts/templates/context/ContextTemplates.d.ts +0 -119
  36. package/dist/prompts/templates/context/ContextTemplates.js +0 -399
  37. package/dist/prompts/templates/hooks/HookTemplates.d.ts +0 -175
  38. package/dist/prompts/templates/hooks/HookTemplates.js +0 -394
  39. package/dist/prompts/templates/hooks/HookTemplates.test.d.ts +0 -7
  40. package/dist/prompts/templates/hooks/HookTemplates.test.js +0 -127
  41. package/dist/shared/config.d.ts +0 -4
  42. package/dist/shared/config.js +0 -41
  43. package/dist/shared/error-handler.d.ts +0 -22
  44. package/dist/shared/error-handler.js +0 -142
  45. package/dist/shared/logger.d.ts +0 -19
  46. package/dist/shared/logger.js +0 -51
  47. package/dist/shared/paths.d.ts +0 -28
  48. package/dist/shared/paths.js +0 -100
  49. package/dist/shared/types.d.ts +0 -141
  50. package/dist/shared/types.js +0 -78
@@ -1,399 +0,0 @@
1
- /**
2
- * Context Templates for Human-Readable Formatting
3
- *
4
- * Essential templates for user-facing messages in the memory system.
5
- * Focused on session start messages, error handling, and operation feedback.
6
- * Now uses Handlebars templating for proper separation of data and presentation.
7
- */
8
- import Handlebars from 'handlebars';
9
- import { formatRelativeTime, parseTimestamp } from '../../../lib/time-utils.js';
10
- // =============================================================================
11
- // MAIN SESSION START TEMPLATE - Edit this to change the output format
12
- // =============================================================================
13
- const SESSION_START_FULL_TEMPLATE = `🧠 What's new: {{dateTime}}
14
- ====================================================================
15
- {{#if overview}}{{overview}}{{/if}}
16
-
17
- 📚 Recent Context
18
- ====================================================================
19
- {{#if hasMemories}}
20
- {{#each sessionGroups}}
21
- 👀 in {{sessionId}}:
22
-
23
- {{#each memories}}
24
- {{number}}. {{summary}}
25
- — {{keywords}}
26
-
27
- {{/each}}
28
- ======================================================================
29
- {{/each}}
30
- {{else}}
31
- No relevant memories found - this appears to be your first session or a new project area.
32
-
33
- 💡 Getting Started:
34
- • Start working and memories will be automatically created
35
- • At the end of your session, ask to compress and store the conversation
36
- • Next time you return, relevant context will be loaded automatically
37
- {{/if}}`;
38
- // NEW: Layered template that shows overviews to user and hides granular memories in comments
39
- const SESSION_START_LAYERED_TEMPLATE = `🧠 What's new: {{dateTime}}
40
- ====================================================================
41
- {{#if hasOverviews}}
42
- {{#each overviews}}
43
- 📅 {{timeAgo}}:
44
- {{content}}
45
-
46
- {{/each}}
47
- {{else}}
48
- This appears to be your first session. Context will be automatically captured as you work.
49
-
50
- 💡 Getting Started:
51
- • Start working and memories will be automatically created
52
- • At the end of your session, ask to compress and store the conversation
53
- • Next time you return, relevant context will be loaded automatically
54
- {{/if}}
55
- ====================================================================
56
- {{#if hasMemories}}<!-- CONTEXT-DATA
57
- {{#each sessionGroups}}
58
- 👀 in {{sessionId}}:
59
-
60
- {{#each memories}}
61
- {{number}}. {{summary}}
62
- — {{keywords}}
63
-
64
- {{/each}}
65
- ======================================================================
66
- {{/each}}
67
- END-CONTEXT-DATA -->{{/if}}`;
68
- // Compile the template once for performance
69
- const compiledSessionTemplate = Handlebars.compile(SESSION_START_FULL_TEMPLATE, { noEscape: true });
70
- const compiledLayeredTemplate = Handlebars.compile(SESSION_START_LAYERED_TEMPLATE, { noEscape: true });
71
- // =============================================================================
72
- // SESSION START MESSAGES
73
- // =============================================================================
74
- /**
75
- * Creates a welcoming session start message explaining what memories were loaded
76
- */
77
- export function createSessionStartMessage(projectName, memoryCount, lastSessionTime) {
78
- const timeInfo = lastSessionTime ? ` (last worked: ${lastSessionTime})` : '';
79
- if (memoryCount === 0) {
80
- return `🧠 Loading memories from previous sessions for ${projectName}${timeInfo}
81
-
82
- No relevant memories found - this appears to be your first session or a new project area.
83
-
84
- 💡 Getting Started:
85
- • Start working and memories will be automatically created
86
- • At the end of your session, ask to compress and store the conversation
87
- • Next time you return, relevant context will be loaded automatically`;
88
- }
89
- const memoryText = memoryCount === 1 ? 'relevant memory' : 'relevant memories';
90
- return `🧠 Loading memories from previous sessions for ${projectName}${timeInfo}
91
-
92
- Found ${memoryCount} ${memoryText} to help continue your work.`;
93
- }
94
- // =============================================================================
95
- // OPERATION MESSAGES
96
- // =============================================================================
97
- /**
98
- * Creates a loading message during context retrieval
99
- */
100
- export function createLoadingMessage(operation) {
101
- const operations = {
102
- 'searching': '🔍 Searching previous memories...',
103
- 'loading': '📚 Loading relevant context...',
104
- 'formatting': '✨ Organizing memories for display...',
105
- 'compressing': '🗜️ Compressing session transcript...',
106
- 'archiving': '📦 Archiving conversation...'
107
- };
108
- return operations[operation] || `⏳ ${operation}...`;
109
- }
110
- /**
111
- * Creates a completion message after context operations
112
- */
113
- export function createCompletionMessage(operation, count, details) {
114
- const countInfo = count !== undefined ? ` (${count} items)` : '';
115
- const detailInfo = details ? `\n${details}` : '';
116
- return `✅ ${operation} completed successfully${countInfo}${detailInfo}`;
117
- }
118
- // =============================================================================
119
- // ERROR MESSAGES (USER-FRIENDLY)
120
- // =============================================================================
121
- /**
122
- * Creates user-friendly error messages with helpful suggestions
123
- */
124
- export function createUserFriendlyError(operation, error, suggestion) {
125
- const suggestionText = suggestion ? `\n\n💡 ${suggestion}` : '';
126
- return `❌ ${operation} encountered an issue: ${error}${suggestionText}`;
127
- }
128
- /**
129
- * Common error scenarios with built-in suggestions
130
- */
131
- export const ERROR_SCENARIOS = {
132
- NO_MEMORIES: (projectName) => ({
133
- message: `No previous memories found for ${projectName}`,
134
- suggestion: "This appears to be your first session. Memories will be created as you work."
135
- }),
136
- CONNECTION_FAILED: () => ({
137
- message: "Could not connect to memory system",
138
- suggestion: "Try restarting Claude Code or check if the MCP server is properly configured."
139
- }),
140
- SEARCH_FAILED: (query) => ({
141
- message: `Search for "${query}" didn't return any results`,
142
- suggestion: "Try using different keywords or check if memories exist for this project."
143
- }),
144
- LOAD_TIMEOUT: () => ({
145
- message: "Memory loading timed out",
146
- suggestion: "The operation is taking longer than expected. You can continue without loaded context."
147
- })
148
- };
149
- /**
150
- * Creates contextual error messages based on common scenarios
151
- */
152
- export function createContextualError(scenario, ...args) {
153
- const errorInfo = ERROR_SCENARIOS[scenario](...args);
154
- return createUserFriendlyError('Memory system', errorInfo.message, errorInfo.suggestion);
155
- }
156
- // =============================================================================
157
- // TIME AND DATE FORMATTING
158
- // =============================================================================
159
- /**
160
- * Formats timestamps into human-readable "time ago" format
161
- */
162
- export function formatTimeAgo(timestamp) {
163
- const date = typeof timestamp === 'string' ? new Date(timestamp) : timestamp;
164
- const now = new Date();
165
- const diff = now.getTime() - date.getTime();
166
- const minutes = Math.floor(diff / 60000);
167
- const hours = Math.floor(diff / 3600000);
168
- const days = Math.floor(diff / 86400000);
169
- if (minutes < 1)
170
- return 'just now';
171
- if (minutes < 60)
172
- return `${minutes} minute${minutes > 1 ? 's' : ''} ago`;
173
- if (hours < 24)
174
- return `${hours} hour${hours > 1 ? 's' : ''} ago`;
175
- if (days < 7)
176
- return `${days} day${days > 1 ? 's' : ''} ago`;
177
- return date.toLocaleDateString();
178
- }
179
- /**
180
- * Creates summary text for memory operations
181
- */
182
- export function createOperationSummary(operation, results) {
183
- const { count, duration, details } = results;
184
- const durationText = duration ? ` in ${duration}ms` : '';
185
- const detailsText = details ? ` - ${details}` : '';
186
- const templates = {
187
- compress: `Compressed ${count} conversation turns${durationText}${detailsText}`,
188
- load: `Loaded ${count} relevant memories${durationText}${detailsText}`,
189
- search: `Found ${count} matching memories${durationText}${detailsText}`,
190
- archive: `Archived ${count} conversation segments${durationText}${detailsText}`
191
- };
192
- return `📊 ${templates[operation]}`;
193
- }
194
- /**
195
- * Formats current date and time for session start
196
- */
197
- export function formatCurrentDateTime() {
198
- const now = new Date();
199
- const currentDateTime = now.toLocaleString('en-US', {
200
- weekday: 'long',
201
- year: 'numeric',
202
- month: 'long',
203
- day: 'numeric',
204
- hour: '2-digit',
205
- minute: '2-digit',
206
- timeZoneName: 'short'
207
- });
208
- return `Current Date / Time: ${currentDateTime}\n`;
209
- }
210
- /**
211
- * Extracts overview section from JSON objects
212
- * Looks for objects with type "overview" and matching project
213
- */
214
- export function extractOverview(recentObjects, projectName) {
215
- // Find overview objects
216
- const overviewObjects = recentObjects.filter(obj => obj.type === 'overview');
217
- if (overviewObjects.length === 0) {
218
- return null;
219
- }
220
- // If project is specified, find overview for that project
221
- if (projectName) {
222
- const sanitizedProject = projectName.replace(/-/g, '_');
223
- const projectOverview = overviewObjects.find(obj => obj.project === sanitizedProject || obj.project === projectName);
224
- if (projectOverview) {
225
- return projectOverview.content;
226
- }
227
- }
228
- // Return the most recent overview if no project match
229
- return overviewObjects[overviewObjects.length - 1]?.content || null;
230
- }
231
- /**
232
- * Extracts multiple overviews with timestamps
233
- * Returns up to 'count' most recent overviews
234
- */
235
- export function extractOverviews(recentObjects, count = 3, projectName) {
236
- // Find overview objects
237
- const overviewObjects = recentObjects.filter(obj => obj.type === 'overview');
238
- if (overviewObjects.length === 0) {
239
- return [];
240
- }
241
- // Filter by project if specified
242
- let filteredOverviews = overviewObjects;
243
- if (projectName) {
244
- const sanitizedProject = projectName.replace(/-/g, '_');
245
- filteredOverviews = overviewObjects.filter(obj => obj.project === sanitizedProject || obj.project === projectName);
246
- // Fall back to all overviews if no project match
247
- if (filteredOverviews.length === 0) {
248
- filteredOverviews = overviewObjects;
249
- }
250
- }
251
- // Take the last 'count' overviews
252
- const recentOverviews = filteredOverviews.slice(-count);
253
- // Process each overview with timestamp
254
- return recentOverviews.map(obj => {
255
- const entry = {
256
- content: obj.content || ''
257
- };
258
- // Try to parse timestamp
259
- const timestamp = parseTimestamp(obj);
260
- if (timestamp) {
261
- entry.timestamp = timestamp;
262
- entry.timeAgo = formatRelativeTime(timestamp);
263
- }
264
- else {
265
- // Fallback if no timestamp
266
- entry.timeAgo = 'Recently';
267
- }
268
- return entry;
269
- }); // Show oldest first
270
- }
271
- /**
272
- * Pure data processing function - converts JSON objects into structured memory entries
273
- * No formatting is done here, only data parsing and cleaning
274
- */
275
- export function processMemoryEntries(recentObjects) {
276
- if (recentObjects.length === 0) {
277
- return [];
278
- }
279
- // Filter only memory type objects and convert to MemoryEntry format
280
- return recentObjects
281
- .filter(obj => obj.type === 'memory')
282
- .map(obj => {
283
- const entry = {
284
- summary: obj.text || '',
285
- sessionId: obj.session_id || ''
286
- };
287
- // Add optional fields if present
288
- if (obj.keywords) {
289
- entry.keywords = obj.keywords;
290
- }
291
- if (obj.document_id && !obj.document_id.includes('Session:')) {
292
- entry.location = obj.document_id;
293
- }
294
- return entry;
295
- })
296
- .filter(entry => entry.summary.length > 0);
297
- }
298
- /**
299
- * Groups memories by session ID and adds numbering
300
- */
301
- function groupMemoriesBySession(memories) {
302
- const sessionMap = new Map();
303
- // Group memories by session ID
304
- memories.forEach(memory => {
305
- const sessionId = memory.sessionId;
306
- if (sessionId) {
307
- if (!sessionMap.has(sessionId)) {
308
- sessionMap.set(sessionId, []);
309
- }
310
- sessionMap.get(sessionId).push(memory);
311
- }
312
- });
313
- // Convert to session groups with numbering, reverse to show oldest sessions first
314
- return Array.from(sessionMap.entries()).map(([sessionId, sessionMemories]) => {
315
- const numberedMemories = sessionMemories.map((memory, index) => ({
316
- ...memory,
317
- number: index + 1
318
- }));
319
- return {
320
- sessionId,
321
- memories: numberedMemories
322
- };
323
- }).reverse();
324
- }
325
- /**
326
- * Renders the complete session start template with provided data using Handlebars
327
- * Data processing is separated from presentation - template controls the format
328
- */
329
- export function renderSessionStartTemplate(params) {
330
- const { projectName, memoryCount, lastSessionTime, recentObjects } = params;
331
- // Extract overview and process memory entries separately
332
- const overview = extractOverview(recentObjects, projectName);
333
- const memories = processMemoryEntries(recentObjects);
334
- // Group memories by session
335
- const sessionGroups = groupMemoriesBySession(memories);
336
- // Prepare template data - just pass data, let template control format
337
- const templateData = {
338
- dateTime: new Date().toLocaleString('en-US', {
339
- weekday: 'long',
340
- year: 'numeric',
341
- month: 'long',
342
- day: 'numeric',
343
- hour: '2-digit',
344
- minute: '2-digit',
345
- timeZoneName: 'short'
346
- }),
347
- projectName,
348
- lastSessionTime: lastSessionTime || 'recently',
349
- memoryCount,
350
- memoryText: memoryCount === 1 ? 'memory' : 'memories',
351
- hasMemories: memories.length > 0 || overview !== null,
352
- overview,
353
- sessionGroups
354
- };
355
- // Let Handlebars handle the rendering with proper loops and conditionals
356
- return compiledSessionTemplate(templateData);
357
- }
358
- /**
359
- * Outputs session start content to stdout:
360
- * - Shows clean overviews first for user visibility
361
- * - Followed by detailed memories for Claude's context
362
- */
363
- export function outputSessionStartContent(params) {
364
- const { projectName, memoryCount, lastSessionTime, recentObjects } = params;
365
- // Extract overviews for user display
366
- const overviews = extractOverviews(recentObjects, 3, projectName);
367
- // Process memory entries for Claude context
368
- const memories = processMemoryEntries(recentObjects);
369
- // Detailed memories for context (shown first)
370
- if (memories.length > 0) {
371
- const sessionGroups = groupMemoriesBySession(memories);
372
- console.log('📚 Recent Context');
373
- console.log('====================================================================');
374
- sessionGroups.forEach(group => {
375
- console.log(`👀 in ${group.sessionId}:`);
376
- console.log('');
377
- group.memories.forEach(memory => {
378
- console.log(`${memory.number}. ${memory.summary}`);
379
- console.log(` — ${memory.keywords}`);
380
- console.log('');
381
- });
382
- });
383
- console.log('======================================================================');
384
- }
385
- // User-visible overviews (shown at bottom)
386
- if (overviews.length > 0) {
387
- console.log('🧠 What\'s new:');
388
- console.log('====================================================================');
389
- overviews.forEach(overview => {
390
- console.log(`📅 ${overview.timeAgo}:`);
391
- console.log(overview.content);
392
- console.log('');
393
- });
394
- console.log('====================================================================');
395
- }
396
- else if (memories.length === 0) {
397
- console.log(`🧠 No recent context found for ${projectName}`);
398
- }
399
- }
@@ -1,175 +0,0 @@
1
- /**
2
- * Hook Templates for System Integration
3
- *
4
- * This module provides standardized templates for hook responses that integrate
5
- * with Claude Code's hook system. These templates ensure consistent formatting
6
- * and proper JSON structure for different hook events.
7
- *
8
- * Based on Claude Code Hook Documentation v2025
9
- */
10
- import { BaseHookResponse, PreCompactResponse, SessionStartResponse, PreToolUseResponse } from '../../../shared/types.js';
11
- /**
12
- * Context data for generating hook responses
13
- */
14
- export interface HookResponseContext {
15
- /** The hook event name */
16
- hookEventName: string;
17
- /** Session identifier */
18
- sessionId: string;
19
- /** Whether the operation was successful */
20
- success: boolean;
21
- /** Optional message for the response */
22
- message?: string;
23
- /** Additional data specific to the hook type */
24
- additionalData?: Record<string, unknown>;
25
- /** Duration of the operation in milliseconds */
26
- duration?: number;
27
- /** Number of items processed */
28
- itemCount?: number;
29
- }
30
- /**
31
- * Progress information for long-running operations
32
- */
33
- export interface OperationProgress {
34
- /** Current step number */
35
- current: number;
36
- /** Total number of steps */
37
- total: number;
38
- /** Description of current step */
39
- currentStep?: string;
40
- /** Estimated time remaining in milliseconds */
41
- estimatedRemaining?: number;
42
- }
43
- /**
44
- * Creates a successful pre-compact response that allows compression to proceed
45
- * PreCompact hooks do NOT support hookSpecificOutput according to documentation
46
- */
47
- export declare function createPreCompactSuccessResponse(): PreCompactResponse;
48
- /**
49
- * Creates a blocked pre-compact response that prevents compression
50
- */
51
- export declare function createPreCompactBlockedResponse(reason: string): PreCompactResponse;
52
- /**
53
- * Creates a pre-compact response with approval decision
54
- */
55
- export declare function createPreCompactApprovalResponse(decision: 'approve' | 'block', reason?: string): PreCompactResponse;
56
- /**
57
- * Creates a successful session start response with loaded context
58
- * SessionStart hooks DO support hookSpecificOutput
59
- */
60
- export declare function createSessionStartSuccessResponse(additionalContext?: string): SessionStartResponse;
61
- /**
62
- * Creates a session start response when no context is available
63
- */
64
- export declare function createSessionStartEmptyResponse(): SessionStartResponse;
65
- /**
66
- * Creates a session start response with error information
67
- */
68
- export declare function createSessionStartErrorResponse(error: string): SessionStartResponse;
69
- /**
70
- * Creates a rich session start response with memory summary
71
- */
72
- export declare function createSessionStartMemoryResponse(memoryData: {
73
- projectName: string;
74
- memoryCount: number;
75
- lastSessionTime?: string;
76
- recentComponents?: string[];
77
- recentDecisions?: string[];
78
- }): SessionStartResponse;
79
- /**
80
- * Creates a pre-tool use response that allows the tool to execute
81
- */
82
- export declare function createPreToolUseAllowResponse(reason?: string): PreToolUseResponse;
83
- /**
84
- * Creates a pre-tool use response that blocks the tool execution
85
- */
86
- export declare function createPreToolUseDenyResponse(reason: string): PreToolUseResponse;
87
- /**
88
- * Creates a pre-tool use response that asks for user confirmation
89
- */
90
- export declare function createPreToolUseAskResponse(reason: string): PreToolUseResponse;
91
- /**
92
- * Creates a basic success response for any hook type
93
- */
94
- export declare function createHookSuccessResponse(suppressOutput?: boolean): BaseHookResponse;
95
- /**
96
- * Creates a basic error response for any hook type
97
- */
98
- export declare function createHookErrorResponse(reason: string, suppressOutput?: boolean): BaseHookResponse;
99
- /**
100
- * Creates a response with system message (warning/info for user)
101
- */
102
- export declare function createHookSystemMessageResponse(message: string, continueProcessing?: boolean): BaseHookResponse & {
103
- systemMessage: string;
104
- };
105
- /**
106
- * Templates for different types of operation status messages
107
- */
108
- export declare const OPERATION_STATUS_TEMPLATES: {
109
- readonly COMPRESSION_STARTED: "Starting memory compression...";
110
- readonly COMPRESSION_ANALYZING: "Analyzing transcript content...";
111
- readonly COMPRESSION_EXTRACTING: "Extracting memories and connections...";
112
- readonly COMPRESSION_SAVING: "Saving compressed memories...";
113
- readonly COMPRESSION_COMPLETE: (count: number, duration?: number) => string;
114
- readonly CONTEXT_LOADING: "Loading previous session context...";
115
- readonly CONTEXT_SEARCHING: "Searching for relevant memories...";
116
- readonly CONTEXT_FORMATTING: "Organizing context for display...";
117
- readonly CONTEXT_LOADED: (count: number) => string;
118
- readonly CONTEXT_EMPTY: "No previous context found. Starting fresh session";
119
- readonly TOOL_CHECKING: (toolName: string) => string;
120
- readonly TOOL_ALLOWED: (toolName: string) => string;
121
- readonly TOOL_BLOCKED: (toolName: string, reason: string) => string;
122
- readonly OPERATION_STARTING: (operation: string) => string;
123
- readonly OPERATION_PROGRESS: (operation: string, current: number, total: number) => string;
124
- readonly OPERATION_COMPLETE: (operation: string) => string;
125
- readonly OPERATION_FAILED: (operation: string, error: string) => string;
126
- };
127
- /**
128
- * Creates a progress message for long-running operations
129
- */
130
- export declare function createProgressMessage(operation: string, progress: OperationProgress): string;
131
- /**
132
- * Standard error messages for different failure scenarios
133
- */
134
- export declare const ERROR_RESPONSE_TEMPLATES: {
135
- readonly FILE_NOT_FOUND: (path: string) => string;
136
- readonly FILE_READ_ERROR: (path: string, error: string) => string;
137
- readonly FILE_WRITE_ERROR: (path: string, error: string) => string;
138
- readonly CONNECTION_FAILED: (service: string) => string;
139
- readonly CONNECTION_TIMEOUT: (service: string) => string;
140
- readonly INVALID_PAYLOAD: (field: string) => string;
141
- readonly INVALID_FORMAT: (expected: string, received: string) => string;
142
- readonly OPERATION_TIMEOUT: (operation: string, timeout: number) => string;
143
- readonly OPERATION_CANCELLED: (operation: string) => string;
144
- readonly INSUFFICIENT_PERMISSIONS: (operation: string) => string;
145
- readonly MEMORY_SYSTEM_UNAVAILABLE: "Memory system is not available";
146
- readonly MEMORY_CORRUPTION: "Memory index appears to be corrupted";
147
- readonly MEMORY_SEARCH_FAILED: (query: string) => string;
148
- readonly COMPRESSION_FAILED: (stage: string) => string;
149
- readonly INVALID_TRANSCRIPT: "Transcript file is invalid or corrupted";
150
- readonly UNKNOWN_ERROR: (context: string) => string;
151
- readonly SYSTEM_ERROR: (error: string) => string;
152
- };
153
- /**
154
- * Creates a standardized error response with troubleshooting guidance
155
- */
156
- export declare function createDetailedErrorResponse(operation: string, error: string, troubleshootingSteps?: string[]): BaseHookResponse;
157
- /**
158
- * Validates that a hook response conforms to Claude Code expectations
159
- */
160
- export declare function validateHookResponse(response: any, hookType: string): {
161
- isValid: boolean;
162
- errors: string[];
163
- };
164
- /**
165
- * Creates a hook response based on context and automatically handles hook-specific formatting
166
- */
167
- export declare function createContextualHookResponse(context: HookResponseContext): BaseHookResponse;
168
- /**
169
- * Formats duration in milliseconds to human-readable format
170
- */
171
- export declare function formatDuration(milliseconds: number): string;
172
- /**
173
- * Creates a summary line for operation completion
174
- */
175
- export declare function createOperationSummary(operation: string, success: boolean, duration?: number, itemCount?: number, details?: string): string;