@codemieai/code 0.0.23 â 0.0.24
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/README.md +17 -68
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +29 -10
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/metrics/MetricsOrchestrator.d.ts +12 -0
- package/dist/metrics/MetricsOrchestrator.d.ts.map +1 -1
- package/dist/metrics/MetricsOrchestrator.js +67 -12
- package/dist/metrics/MetricsOrchestrator.js.map +1 -1
- package/dist/metrics/config.d.ts.map +1 -1
- package/dist/metrics/config.js +8 -1
- package/dist/metrics/config.js.map +1 -1
- package/dist/metrics/core/DeltaWriter.d.ts.map +1 -1
- package/dist/metrics/core/DeltaWriter.js +11 -5
- package/dist/metrics/core/DeltaWriter.js.map +1 -1
- package/dist/metrics/session/SessionStore.d.ts.map +1 -1
- package/dist/metrics/session/SessionStore.js +7 -3
- package/dist/metrics/session/SessionStore.js.map +1 -1
- package/dist/utils/error-context.d.ts +90 -0
- package/dist/utils/error-context.d.ts.map +1 -0
- package/dist/utils/error-context.js +338 -0
- package/dist/utils/error-context.js.map +1 -0
- package/dist/utils/profile.d.ts +34 -0
- package/dist/utils/profile.d.ts.map +1 -1
- package/dist/utils/profile.js +86 -0
- package/dist/utils/profile.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import { existsSync } from 'fs';
|
|
|
9
9
|
import { dirname } from 'path';
|
|
10
10
|
import { getSessionPath, getMetricsPath, METRICS_PATHS } from '../config.js';
|
|
11
11
|
import { logger } from '../../utils/logger.js';
|
|
12
|
+
import { createErrorContext, formatErrorForLog } from '../../utils/error-context.js';
|
|
12
13
|
export class SessionStore {
|
|
13
14
|
/**
|
|
14
15
|
* Save session to disk
|
|
@@ -27,7 +28,8 @@ export class SessionStore {
|
|
|
27
28
|
logger.debug(`[SessionStore] Saved session: ${session.sessionId}`);
|
|
28
29
|
}
|
|
29
30
|
catch (error) {
|
|
30
|
-
|
|
31
|
+
const errorContext = createErrorContext(error, { sessionId: session.sessionId });
|
|
32
|
+
logger.error(`[SessionStore] Failed to save session: ${session.sessionId}`, formatErrorForLog(errorContext));
|
|
31
33
|
throw error;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
@@ -47,7 +49,8 @@ export class SessionStore {
|
|
|
47
49
|
return session;
|
|
48
50
|
}
|
|
49
51
|
catch (error) {
|
|
50
|
-
|
|
52
|
+
const errorContext = createErrorContext(error, { sessionId });
|
|
53
|
+
logger.error(`[SessionStore] Failed to load session: ${sessionId}`, formatErrorForLog(errorContext));
|
|
51
54
|
return null;
|
|
52
55
|
}
|
|
53
56
|
}
|
|
@@ -74,7 +77,8 @@ export class SessionStore {
|
|
|
74
77
|
return sessions;
|
|
75
78
|
}
|
|
76
79
|
catch (error) {
|
|
77
|
-
|
|
80
|
+
const errorContext = createErrorContext(error);
|
|
81
|
+
logger.error('[SessionStore] Failed to list sessions', formatErrorForLog(errorContext));
|
|
78
82
|
return [];
|
|
79
83
|
}
|
|
80
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionStore.js","sourceRoot":"","sources":["../../../src/metrics/session/SessionStore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SessionStore.js","sourceRoot":"","sources":["../../../src/metrics/session/SessionStore.ts"],"names":[],"mappings":"AAA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2
|
+
* Comprehensive error context for debugging
|
|
3
|
+
*/
|
|
4
|
+
export interface ErrorContext {
|
|
5
|
+
error: {
|
|
6
|
+
message: string;
|
|
7
|
+
name: string;
|
|
8
|
+
stack?: string;
|
|
9
|
+
code?: string;
|
|
10
|
+
};
|
|
11
|
+
system: {
|
|
12
|
+
platform: string;
|
|
13
|
+
platformVersion: string;
|
|
14
|
+
arch: string;
|
|
15
|
+
nodeVersion: string;
|
|
16
|
+
};
|
|
17
|
+
client: {
|
|
18
|
+
name: string;
|
|
19
|
+
version: string;
|
|
20
|
+
};
|
|
21
|
+
session?: {
|
|
22
|
+
sessionId?: string;
|
|
23
|
+
agent?: string;
|
|
24
|
+
provider?: string;
|
|
25
|
+
model?: string;
|
|
26
|
+
profile?: string;
|
|
27
|
+
};
|
|
28
|
+
timestamp: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create comprehensive error context for logging and debugging
|
|
32
|
+
*
|
|
33
|
+
* @param error - The error that occurred
|
|
34
|
+
* @param sessionContext - Optional session context (session ID, agent, provider, etc.)
|
|
35
|
+
* @returns Complete error context with system info, client version, and stack trace
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* try {
|
|
40
|
+
* await writeMetrics();
|
|
41
|
+
* } catch (error) {
|
|
42
|
+
* const context = createErrorContext(error, { sessionId, agent: 'claude' });
|
|
43
|
+
* logger.error('Metrics write failed', context);
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function createErrorContext(error: unknown, sessionContext?: ErrorContext['session']): ErrorContext;
|
|
48
|
+
/**
|
|
49
|
+
* Format error context as human-readable string for console display
|
|
50
|
+
*
|
|
51
|
+
* @param context - Error context to format
|
|
52
|
+
* @param options - Formatting options
|
|
53
|
+
* @returns Formatted error message
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const context = createErrorContext(error, { sessionId });
|
|
58
|
+
* console.error(formatErrorForUser(context, { showStack: false }));
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function formatErrorForUser(context: ErrorContext, options?: {
|
|
62
|
+
showStack?: boolean;
|
|
63
|
+
showSystem?: boolean;
|
|
64
|
+
}): string;
|
|
65
|
+
/**
|
|
66
|
+
* Format error context as JSON for logging to file
|
|
67
|
+
*
|
|
68
|
+
* @param context - Error context to format
|
|
69
|
+
* @returns JSON string with full error details
|
|
70
|
+
*/
|
|
71
|
+
export declare function formatErrorForLog(context: ErrorContext): string;
|
|
72
|
+
/**
|
|
73
|
+
* Create user-friendly explanation for common error types
|
|
74
|
+
*
|
|
75
|
+
* @param error - The error that occurred
|
|
76
|
+
* @returns Human-readable explanation and suggested actions
|
|
77
|
+
*/
|
|
78
|
+
export declare function getErrorExplanation(error: unknown): {
|
|
79
|
+
explanation: string;
|
|
80
|
+
suggestions: string[];
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Format error with explanation for user display
|
|
84
|
+
*
|
|
85
|
+
* @param error - The error that occurred
|
|
86
|
+
* @param sessionContext - Optional session context
|
|
87
|
+
* @returns Formatted error message with explanation
|
|
88
|
+
*/
|
|
89
|
+
export declare function formatErrorWithExplanation(error: unknown, sessionContext?: ErrorContext['session']): string;
|
|
90
|
+
//# sourceMappingURL=error-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-context.d.ts","sourceRoot":"","sources":["../../src/utils/error-context.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,WAAW,YAAY;IAE3B,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IAGF,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IAGF,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAGF,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAGF,SAAS,EAAE,MAAM,CAAC;CACnB;AA+FD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,cAAc,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,GACvC,YAAY,CAWd;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,YAAY,EACrB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GAC1D,MAAM,CAsDR;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAmFA;AA6BD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,EACd,cAAc,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,GACvC,MAAM,CAgCR"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { platform, release, arch } from 'os';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { dirname } from 'path';
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = dirname(__filename);
|
|
8
|
+
/**
|
|
9
|
+
* Get client version from package.json
|
|
10
|
+
*/
|
|
11
|
+
function getClientVersion() {
|
|
12
|
+
try {
|
|
13
|
+
// Try to read package.json from project root
|
|
14
|
+
const packageJsonPath = join(__dirname, '..', '..', 'package.json');
|
|
15
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
16
|
+
return packageJson.version || 'unknown';
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return 'unknown';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get detailed OS information
|
|
24
|
+
*/
|
|
25
|
+
function getSystemInfo() {
|
|
26
|
+
return {
|
|
27
|
+
platform: platform(),
|
|
28
|
+
platformVersion: release(),
|
|
29
|
+
arch: arch(),
|
|
30
|
+
nodeVersion: process.version
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extract error details from unknown error type
|
|
35
|
+
*/
|
|
36
|
+
function extractErrorDetails(error) {
|
|
37
|
+
if (error instanceof Error) {
|
|
38
|
+
return {
|
|
39
|
+
message: error.message,
|
|
40
|
+
name: error.name,
|
|
41
|
+
stack: error.stack,
|
|
42
|
+
code: error.code
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (typeof error === 'string') {
|
|
46
|
+
return {
|
|
47
|
+
message: error,
|
|
48
|
+
name: 'Error',
|
|
49
|
+
stack: new Error(error).stack
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Handle objects (extract meaningful info)
|
|
53
|
+
if (typeof error === 'object' && error !== null) {
|
|
54
|
+
const errorObj = error;
|
|
55
|
+
let message;
|
|
56
|
+
if (typeof errorObj.message === 'string' && errorObj.message.trim()) {
|
|
57
|
+
message = errorObj.message;
|
|
58
|
+
}
|
|
59
|
+
else if (typeof errorObj.error === 'string' && errorObj.error.trim()) {
|
|
60
|
+
message = errorObj.error;
|
|
61
|
+
}
|
|
62
|
+
else if (typeof errorObj.description === 'string' && errorObj.description.trim()) {
|
|
63
|
+
message = errorObj.description;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
try {
|
|
67
|
+
const stringified = JSON.stringify(error, null, 2);
|
|
68
|
+
if (stringified && stringified !== '{}' && stringified !== '[object Object]') {
|
|
69
|
+
message = stringified;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
message = `Error object: ${Object.keys(errorObj).join(', ')}`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
message = `Error object: ${Object.keys(errorObj).join(', ')}`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const name = (typeof errorObj.name === 'string' ? errorObj.name : null) || 'UnknownError';
|
|
80
|
+
const code = (typeof errorObj.code === 'string' ? errorObj.code : undefined);
|
|
81
|
+
const stack = (typeof errorObj.stack === 'string' ? errorObj.stack : undefined) || new Error(message).stack;
|
|
82
|
+
return {
|
|
83
|
+
message,
|
|
84
|
+
name,
|
|
85
|
+
stack,
|
|
86
|
+
code
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// Fallback for primitives
|
|
90
|
+
const message = String(error);
|
|
91
|
+
return {
|
|
92
|
+
message,
|
|
93
|
+
name: 'UnknownError',
|
|
94
|
+
stack: new Error(message).stack
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Create comprehensive error context for logging and debugging
|
|
99
|
+
*
|
|
100
|
+
* @param error - The error that occurred
|
|
101
|
+
* @param sessionContext - Optional session context (session ID, agent, provider, etc.)
|
|
102
|
+
* @returns Complete error context with system info, client version, and stack trace
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* try {
|
|
107
|
+
* await writeMetrics();
|
|
108
|
+
* } catch (error) {
|
|
109
|
+
* const context = createErrorContext(error, { sessionId, agent: 'claude' });
|
|
110
|
+
* logger.error('Metrics write failed', context);
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export function createErrorContext(error, sessionContext) {
|
|
115
|
+
return {
|
|
116
|
+
error: extractErrorDetails(error),
|
|
117
|
+
system: getSystemInfo(),
|
|
118
|
+
client: {
|
|
119
|
+
name: 'codemie-code',
|
|
120
|
+
version: getClientVersion()
|
|
121
|
+
},
|
|
122
|
+
session: sessionContext,
|
|
123
|
+
timestamp: new Date().toISOString()
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Format error context as human-readable string for console display
|
|
128
|
+
*
|
|
129
|
+
* @param context - Error context to format
|
|
130
|
+
* @param options - Formatting options
|
|
131
|
+
* @returns Formatted error message
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const context = createErrorContext(error, { sessionId });
|
|
136
|
+
* console.error(formatErrorForUser(context, { showStack: false }));
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export function formatErrorForUser(context, options = {}) {
|
|
140
|
+
const { showStack = false, showSystem = true } = options;
|
|
141
|
+
const lines = [];
|
|
142
|
+
// Error message (just the message, not the name) - wrapped at 100 chars
|
|
143
|
+
const wrappedError = wrapText(context.error.message, 97, ' '); // 97 to account for "â " prefix
|
|
144
|
+
lines.push(`â ${wrappedError[0].trim()}`);
|
|
145
|
+
for (let i = 1; i < wrappedError.length; i++) {
|
|
146
|
+
lines.push(wrappedError[i]);
|
|
147
|
+
}
|
|
148
|
+
// System info (for support/debugging)
|
|
149
|
+
if (showSystem) {
|
|
150
|
+
lines.push('');
|
|
151
|
+
lines.push('System Information:');
|
|
152
|
+
lines.push(` âĸ OS: ${context.system.platform} ${context.system.platformVersion} (${context.system.arch})`);
|
|
153
|
+
lines.push(` âĸ Node.js: ${context.system.nodeVersion}`);
|
|
154
|
+
lines.push(` âĸ CodeMie CLI: v${context.client.version}`);
|
|
155
|
+
}
|
|
156
|
+
// Session context (if available)
|
|
157
|
+
if (context.session) {
|
|
158
|
+
lines.push('');
|
|
159
|
+
lines.push('Session Information:');
|
|
160
|
+
if (context.session.sessionId) {
|
|
161
|
+
lines.push(` âĸ Session ID: ${context.session.sessionId}`);
|
|
162
|
+
}
|
|
163
|
+
if (context.session.agent) {
|
|
164
|
+
lines.push(` âĸ Agent: ${context.session.agent}`);
|
|
165
|
+
}
|
|
166
|
+
if (context.session.provider) {
|
|
167
|
+
lines.push(` âĸ Provider: ${context.session.provider}`);
|
|
168
|
+
}
|
|
169
|
+
if (context.session.model) {
|
|
170
|
+
lines.push(` âĸ Model: ${context.session.model}`);
|
|
171
|
+
}
|
|
172
|
+
if (context.session.profile) {
|
|
173
|
+
lines.push(` âĸ Profile: ${context.session.profile}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Stack trace (for debugging)
|
|
177
|
+
if (showStack && context.error.stack) {
|
|
178
|
+
lines.push('');
|
|
179
|
+
lines.push('Stack Trace:');
|
|
180
|
+
lines.push(context.error.stack);
|
|
181
|
+
}
|
|
182
|
+
// Timestamp
|
|
183
|
+
lines.push('');
|
|
184
|
+
lines.push(`Timestamp: ${context.timestamp}`);
|
|
185
|
+
return lines.join('\n');
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Format error context as JSON for logging to file
|
|
189
|
+
*
|
|
190
|
+
* @param context - Error context to format
|
|
191
|
+
* @returns JSON string with full error details
|
|
192
|
+
*/
|
|
193
|
+
export function formatErrorForLog(context) {
|
|
194
|
+
return JSON.stringify(context, null, 2);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Create user-friendly explanation for common error types
|
|
198
|
+
*
|
|
199
|
+
* @param error - The error that occurred
|
|
200
|
+
* @returns Human-readable explanation and suggested actions
|
|
201
|
+
*/
|
|
202
|
+
export function getErrorExplanation(error) {
|
|
203
|
+
const errorDetails = extractErrorDetails(error);
|
|
204
|
+
const message = errorDetails.message.toLowerCase();
|
|
205
|
+
const code = errorDetails.code?.toUpperCase();
|
|
206
|
+
// File system errors - metrics specific context
|
|
207
|
+
if (code === 'ENOENT') {
|
|
208
|
+
return {
|
|
209
|
+
explanation: 'Unable to access metrics storage directory. The agent will work, but you\'re missing important features: token usage tracking, cost monitoring, session history, and usage analytics. This limits your ability to optimize and monitor your AI usage.',
|
|
210
|
+
suggestions: [
|
|
211
|
+
'Without metrics: No token tracking, no usage insights, no session history',
|
|
212
|
+
'To enable these features: Check if ~/.codemie/metrics/ directory exists',
|
|
213
|
+
'Ensure you have proper file system permissions'
|
|
214
|
+
]
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
if (code === 'EACCES' || code === 'EPERM') {
|
|
218
|
+
return {
|
|
219
|
+
explanation: 'Cannot write to metrics directory due to permissions. The agent will work, but important features are disabled: token tracking (you won\'t know your costs), usage analytics (can\'t optimize), and session history (can\'t review past work). We recommend fixing this.',
|
|
220
|
+
suggestions: [
|
|
221
|
+
'You\'re missing: Token/cost tracking, usage insights, session history',
|
|
222
|
+
'To enable these features: Fix file permissions on ~/.codemie/ directory',
|
|
223
|
+
'Run: chmod -R u+w ~/.codemie/ to restore access'
|
|
224
|
+
]
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
if (code === 'ENOSPC') {
|
|
228
|
+
return {
|
|
229
|
+
explanation: 'Insufficient disk space for metrics storage. The agent will work, but critical features are unavailable: you cannot track token usage, monitor costs, view session history, or access usage insights until space is freed.',
|
|
230
|
+
suggestions: [
|
|
231
|
+
'You\'re missing: Token/cost tracking, usage insights, session history',
|
|
232
|
+
'Free up disk space to enable these important features',
|
|
233
|
+
'Clean up old log files: ~/.codemie/logs/ or other unnecessary files'
|
|
234
|
+
]
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
// Network errors
|
|
238
|
+
if (message.includes('timeout') || code === 'ETIMEDOUT') {
|
|
239
|
+
return {
|
|
240
|
+
explanation: 'Network timeout during metrics sync. The agent will work, but your usage data isn\'t being synced to the server. You\'ll lose visibility into token usage, costs, and session history across devices or for team analytics.',
|
|
241
|
+
suggestions: [
|
|
242
|
+
'You\'re missing: Cross-device sync, team analytics, historical usage data',
|
|
243
|
+
'Check your internet connection to restore sync',
|
|
244
|
+
'Local metrics will sync automatically when connection is restored'
|
|
245
|
+
]
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
if (message.includes('econnrefused') || code === 'ECONNREFUSED') {
|
|
249
|
+
return {
|
|
250
|
+
explanation: 'Cannot connect to analytics server. The agent will work, but you\'re losing important tracking: no token usage monitoring, no cost tracking, no session history. You won\'t be able to optimize your AI usage or track expenses.',
|
|
251
|
+
suggestions: [
|
|
252
|
+
'You\'re missing: Token/cost tracking, session history, usage optimization',
|
|
253
|
+
'Check if the analytics service is running and accessible',
|
|
254
|
+
'Verify your network and firewall settings allow connections'
|
|
255
|
+
]
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
// Metrics-specific errors
|
|
259
|
+
if (message.includes('metric') || message.includes('session')) {
|
|
260
|
+
return {
|
|
261
|
+
explanation: 'Unable to store usage analytics. The agent will work, but you cannot track tokens, monitor costs, view session history, or access usage insights. This is a significant disadvantage for managing AI usage and expenses.',
|
|
262
|
+
suggestions: [
|
|
263
|
+
'You\'re missing: Token/cost tracking, usage insights, session history',
|
|
264
|
+
'To enable these important features: Check ~/.codemie/metrics/ directory permissions',
|
|
265
|
+
'These features help you optimize usage and control costs'
|
|
266
|
+
]
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
// Generic error
|
|
270
|
+
return {
|
|
271
|
+
explanation: 'Metrics collection encountered an issue. The agent will work, but important features are unavailable: token tracking, cost monitoring, usage analytics, and session history. You won\'t be able to optimize your AI usage or track expenses.',
|
|
272
|
+
suggestions: [
|
|
273
|
+
'You\'re missing: Token/cost tracking, usage insights, session history',
|
|
274
|
+
'These features are important for monitoring and optimizing AI usage',
|
|
275
|
+
'See log details below for technical information to resolve this'
|
|
276
|
+
]
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Wrap text to a maximum line length
|
|
281
|
+
*/
|
|
282
|
+
function wrapText(text, maxLength, indent = '') {
|
|
283
|
+
const words = text.split(' ');
|
|
284
|
+
const lines = [];
|
|
285
|
+
let currentLine = indent;
|
|
286
|
+
for (const word of words) {
|
|
287
|
+
const testLine = currentLine + (currentLine === indent ? '' : ' ') + word;
|
|
288
|
+
if (testLine.length <= maxLength) {
|
|
289
|
+
currentLine = testLine;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
if (currentLine !== indent) {
|
|
293
|
+
lines.push(currentLine);
|
|
294
|
+
}
|
|
295
|
+
currentLine = indent + word;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (currentLine !== indent) {
|
|
299
|
+
lines.push(currentLine);
|
|
300
|
+
}
|
|
301
|
+
return lines;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Format error with explanation for user display
|
|
305
|
+
*
|
|
306
|
+
* @param error - The error that occurred
|
|
307
|
+
* @param sessionContext - Optional session context
|
|
308
|
+
* @returns Formatted error message with explanation
|
|
309
|
+
*/
|
|
310
|
+
export function formatErrorWithExplanation(error, sessionContext) {
|
|
311
|
+
const context = createErrorContext(error, sessionContext);
|
|
312
|
+
const { explanation, suggestions } = getErrorExplanation(error);
|
|
313
|
+
const lines = [];
|
|
314
|
+
// Explanation first (user-friendly) - wrapped at 100 chars
|
|
315
|
+
const wrappedExplanation = wrapText(explanation, 97, ' '); // 97 to account for "đĄ " prefix
|
|
316
|
+
lines.push(`đĄ ${wrappedExplanation[0].trim()}`);
|
|
317
|
+
for (let i = 1; i < wrappedExplanation.length; i++) {
|
|
318
|
+
lines.push(wrappedExplanation[i]);
|
|
319
|
+
}
|
|
320
|
+
lines.push('');
|
|
321
|
+
// Technical error details
|
|
322
|
+
lines.push(formatErrorForUser(context, { showStack: false, showSystem: true }));
|
|
323
|
+
// Suggestions
|
|
324
|
+
if (suggestions.length > 0) {
|
|
325
|
+
lines.push('');
|
|
326
|
+
lines.push('Suggested actions:');
|
|
327
|
+
suggestions.forEach(suggestion => {
|
|
328
|
+
// Wrap each suggestion at 100 chars, accounting for " âĸ " prefix
|
|
329
|
+
const wrappedSuggestion = wrapText(suggestion, 96, ' '); // 96 to account for " âĸ " prefix
|
|
330
|
+
lines.push(` âĸ ${wrappedSuggestion[0].trim()}`);
|
|
331
|
+
for (let i = 1; i < wrappedSuggestion.length; i++) {
|
|
332
|
+
lines.push(wrappedSuggestion[i]);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
return lines.join('\n');
|
|
337
|
+
}
|
|
338
|
+
//# sourceMappingURL=error-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-context.js","sourceRoot":"","sources":["../../src/utils/error-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAyCtC;;GAEG;AACH,SAAS,gBAAgB;IACvB,IAAI,CAAC;QACH,6CAA6C;QAC7C,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QACpE,MAAM,WAAW,GAAG,IAAI,CAAC,KAA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orContext } from './error-context.js';
|
|
1
2
|
/**
|
|
2
3
|
* Renders the CodeMie ASCII logo with configuration details
|
|
3
4
|
*/
|
|
@@ -9,4 +10,37 @@ export declare function renderProfileInfo(config: {
|
|
|
9
10
|
cliVersion?: string;
|
|
10
11
|
sessionId?: string;
|
|
11
12
|
}): string;
|
|
13
|
+
/**
|
|
14
|
+
* Display a non-blocking warning message after profile info
|
|
15
|
+
*
|
|
16
|
+
* @param title - Warning title (e.g., "Metrics Collection Failed")
|
|
17
|
+
* @param error - The error that occurred
|
|
18
|
+
* @param sessionContext - Optional session context for error details
|
|
19
|
+
* @param options - Display options
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* console.log(renderProfileInfo(config));
|
|
24
|
+
* displayWarningMessage('Metrics Collection Failed', error, { sessionId, agent: 'claude' });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function displayWarningMessage(title: string, error: unknown, sessionContext?: ErrorContext['session'], options?: {
|
|
28
|
+
showInProduction?: boolean;
|
|
29
|
+
severity?: 'warning' | 'error' | 'info';
|
|
30
|
+
}): void;
|
|
31
|
+
/**
|
|
32
|
+
* Display a simple info message after profile info
|
|
33
|
+
*
|
|
34
|
+
* @param message - Message to display
|
|
35
|
+
* @param details - Optional additional details
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* displayInfoMessage('Metrics collection is disabled for this provider', {
|
|
40
|
+
* provider: 'openai',
|
|
41
|
+
* reason: 'Not supported'
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function displayInfoMessage(message: string, details?: Record<string, string>): void;
|
|
12
46
|
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGnF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CA6BT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,EACd,cAAc,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,EACxC,OAAO,GAAE;IACP,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;CACpC,GACL,IAAI,CAuDN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,IAAI,CAcN"}
|
package/dist/utils/profile.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
+
import { formatErrorWithExplanation } from './error-context.js';
|
|
3
|
+
import { logger } from './logger.js';
|
|
2
4
|
/**
|
|
3
5
|
* Renders the CodeMie ASCII logo with configuration details
|
|
4
6
|
*/
|
|
@@ -29,4 +31,88 @@ export function renderProfileInfo(config) {
|
|
|
29
31
|
// Apply cyan color to entire output
|
|
30
32
|
return chalk.cyan(outputLines.join('\n'));
|
|
31
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Display a non-blocking warning message after profile info
|
|
36
|
+
*
|
|
37
|
+
* @param title - Warning title (e.g., "Metrics Collection Failed")
|
|
38
|
+
* @param error - The error that occurred
|
|
39
|
+
* @param sessionContext - Optional session context for error details
|
|
40
|
+
* @param options - Display options
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* console.log(renderProfileInfo(config));
|
|
45
|
+
* displayWarningMessage('Metrics Collection Failed', error, { sessionId, agent: 'claude' });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export function displayWarningMessage(title, error, sessionContext, options = {}) {
|
|
49
|
+
const { showInProduction = true, severity = 'warning' } = options;
|
|
50
|
+
// Skip display in production if specified
|
|
51
|
+
if (!showInProduction && process.env.NODE_ENV === 'production') {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
// Format the complete error message with explanation
|
|
55
|
+
const errorMessage = formatErrorWithExplanation(error, sessionContext);
|
|
56
|
+
// Get log file path
|
|
57
|
+
const logFilePath = logger.getLogFilePath();
|
|
58
|
+
// Box drawing characters
|
|
59
|
+
const lines = [];
|
|
60
|
+
lines.push(''); // Spacing
|
|
61
|
+
// Title with icon
|
|
62
|
+
const icon = severity === 'error' ? 'đ¨' : severity === 'info' ? 'âšī¸' : 'â ī¸';
|
|
63
|
+
const color = severity === 'error' ? chalk.red : severity === 'info' ? chalk.cyan : chalk.yellow;
|
|
64
|
+
lines.push(color.bold(`${icon} ${title}`));
|
|
65
|
+
lines.push(color('â'.repeat(60)));
|
|
66
|
+
// Error message (split by lines for proper formatting)
|
|
67
|
+
const messageLines = errorMessage.split('\n');
|
|
68
|
+
messageLines.forEach(line => {
|
|
69
|
+
lines.push(color(line));
|
|
70
|
+
});
|
|
71
|
+
lines.push(color('â'.repeat(60)));
|
|
72
|
+
// Log file information
|
|
73
|
+
if (logFilePath) {
|
|
74
|
+
lines.push('');
|
|
75
|
+
lines.push(color.bold('đ Check Logs for Details (run this command):'));
|
|
76
|
+
lines.push(color(` tail -100 ${logFilePath}`));
|
|
77
|
+
}
|
|
78
|
+
// Contact support
|
|
79
|
+
lines.push('');
|
|
80
|
+
lines.push(color.bold('đ§ Need Help?'));
|
|
81
|
+
lines.push(color(' Contact CodeMie team at: https://github.com/codemie-ai/codemie-code/issues'));
|
|
82
|
+
if (logFilePath) {
|
|
83
|
+
lines.push(color.dim(' Please include the log file above when reporting this issue.'));
|
|
84
|
+
}
|
|
85
|
+
lines.push('');
|
|
86
|
+
lines.push(color('â'.repeat(60)));
|
|
87
|
+
lines.push(color.dim('Note: This warning does not prevent the agent from starting.'));
|
|
88
|
+
lines.push(''); // Spacing
|
|
89
|
+
// Output to stderr so it doesn't interfere with agent output
|
|
90
|
+
console.error(lines.join('\n'));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Display a simple info message after profile info
|
|
94
|
+
*
|
|
95
|
+
* @param message - Message to display
|
|
96
|
+
* @param details - Optional additional details
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* displayInfoMessage('Metrics collection is disabled for this provider', {
|
|
101
|
+
* provider: 'openai',
|
|
102
|
+
* reason: 'Not supported'
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export function displayInfoMessage(message, details) {
|
|
107
|
+
const lines = [];
|
|
108
|
+
lines.push(''); // Spacing
|
|
109
|
+
lines.push(chalk.cyan('âšī¸ ' + message));
|
|
110
|
+
if (details) {
|
|
111
|
+
Object.entries(details).forEach(([key, value]) => {
|
|
112
|
+
lines.push(chalk.cyan.dim(` ${key}: ${value}`));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
lines.push(''); // Spacing
|
|
116
|
+
console.error(lines.join('\n'));
|
|
117
|
+
}
|
|
32
118
|
//# sourceMappingURL=profile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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