jazz-ai 0.1.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/LICENSE +21 -0
- package/README.md +182 -0
- package/dist/cli/commands/auth.d.ts +18 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +128 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/chat-agent.d.ts +18 -0
- package/dist/cli/commands/chat-agent.d.ts.map +1 -0
- package/dist/cli/commands/chat-agent.js +421 -0
- package/dist/cli/commands/chat-agent.js.map +1 -0
- package/dist/cli/commands/edit-agent.d.ts +10 -0
- package/dist/cli/commands/edit-agent.d.ts.map +1 -0
- package/dist/cli/commands/edit-agent.js +310 -0
- package/dist/cli/commands/edit-agent.js.map +1 -0
- package/dist/cli/commands/task-agent.d.ts +126 -0
- package/dist/cli/commands/task-agent.d.ts.map +1 -0
- package/dist/cli/commands/task-agent.js +345 -0
- package/dist/cli/commands/task-agent.js.map +1 -0
- package/dist/core/agent/agent-prompt.d.ts +47 -0
- package/dist/core/agent/agent-prompt.d.ts.map +1 -0
- package/dist/core/agent/agent-prompt.js +146 -0
- package/dist/core/agent/agent-prompt.js.map +1 -0
- package/dist/core/agent/agent-runner.d.ts +63 -0
- package/dist/core/agent/agent-runner.d.ts.map +1 -0
- package/dist/core/agent/agent-runner.js +346 -0
- package/dist/core/agent/agent-runner.js.map +1 -0
- package/dist/core/agent/agent-service.d.ts +164 -0
- package/dist/core/agent/agent-service.d.ts.map +1 -0
- package/dist/core/agent/agent-service.js +463 -0
- package/dist/core/agent/agent-service.js.map +1 -0
- package/dist/core/agent/gmail-agent.d.ts +17 -0
- package/dist/core/agent/gmail-agent.d.ts.map +1 -0
- package/dist/core/agent/gmail-agent.js +191 -0
- package/dist/core/agent/gmail-agent.js.map +1 -0
- package/dist/core/agent/prompts/default/v1.d.ts +2 -0
- package/dist/core/agent/prompts/default/v1.d.ts.map +1 -0
- package/dist/core/agent/prompts/default/v1.js +202 -0
- package/dist/core/agent/prompts/default/v1.js.map +1 -0
- package/dist/core/agent/prompts/default/v2.d.ts +2 -0
- package/dist/core/agent/prompts/default/v2.d.ts.map +1 -0
- package/dist/core/agent/prompts/default/v2.js +72 -0
- package/dist/core/agent/prompts/default/v2.js.map +1 -0
- package/dist/core/agent/prompts/gmail/v1.d.ts +2 -0
- package/dist/core/agent/prompts/gmail/v1.d.ts.map +1 -0
- package/dist/core/agent/prompts/gmail/v1.js +206 -0
- package/dist/core/agent/prompts/gmail/v1.js.map +1 -0
- package/dist/core/agent/prompts/gmail/v2.d.ts +2 -0
- package/dist/core/agent/prompts/gmail/v2.d.ts.map +1 -0
- package/dist/core/agent/prompts/gmail/v2.js +59 -0
- package/dist/core/agent/prompts/gmail/v2.js.map +1 -0
- package/dist/core/agent/tools/base-tool.d.ts +161 -0
- package/dist/core/agent/tools/base-tool.d.ts.map +1 -0
- package/dist/core/agent/tools/base-tool.js +153 -0
- package/dist/core/agent/tools/base-tool.js.map +1 -0
- package/dist/core/agent/tools/fs-tools.d.ts +21 -0
- package/dist/core/agent/tools/fs-tools.d.ts.map +1 -0
- package/dist/core/agent/tools/fs-tools.js +1210 -0
- package/dist/core/agent/tools/fs-tools.js.map +1 -0
- package/dist/core/agent/tools/git-tools.d.ts +63 -0
- package/dist/core/agent/tools/git-tools.d.ts.map +1 -0
- package/dist/core/agent/tools/git-tools.js +600 -0
- package/dist/core/agent/tools/git-tools.js.map +1 -0
- package/dist/core/agent/tools/gmail-tools.d.ts +22 -0
- package/dist/core/agent/tools/gmail-tools.d.ts.map +1 -0
- package/dist/core/agent/tools/gmail-tools.js +779 -0
- package/dist/core/agent/tools/gmail-tools.js.map +1 -0
- package/dist/core/agent/tools/register-tools.d.ts +13 -0
- package/dist/core/agent/tools/register-tools.d.ts.map +1 -0
- package/dist/core/agent/tools/register-tools.js +169 -0
- package/dist/core/agent/tools/register-tools.js.map +1 -0
- package/dist/core/agent/tools/shell-tools.d.ts +19 -0
- package/dist/core/agent/tools/shell-tools.d.ts.map +1 -0
- package/dist/core/agent/tools/shell-tools.js +367 -0
- package/dist/core/agent/tools/shell-tools.js.map +1 -0
- package/dist/core/agent/tools/tool-registry.d.ts +62 -0
- package/dist/core/agent/tools/tool-registry.d.ts.map +1 -0
- package/dist/core/agent/tools/tool-registry.js +187 -0
- package/dist/core/agent/tools/tool-registry.js.map +1 -0
- package/dist/core/agent/tools/web-search-tools.d.ts +39 -0
- package/dist/core/agent/tools/web-search-tools.d.ts.map +1 -0
- package/dist/core/agent/tools/web-search-tools.js +220 -0
- package/dist/core/agent/tools/web-search-tools.js.map +1 -0
- package/dist/core/types/errors.d.ts +300 -0
- package/dist/core/types/errors.d.ts.map +1 -0
- package/dist/core/types/errors.js +115 -0
- package/dist/core/types/errors.js.map +1 -0
- package/dist/core/types/index.d.ts +208 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/index.js +30 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/core/utils/error-handler.d.ts +114 -0
- package/dist/core/utils/error-handler.d.ts.map +1 -0
- package/dist/core/utils/error-handler.js +551 -0
- package/dist/core/utils/error-handler.js.map +1 -0
- package/dist/core/utils/markdown-renderer.d.ts +52 -0
- package/dist/core/utils/markdown-renderer.d.ts.map +1 -0
- package/dist/core/utils/markdown-renderer.js +134 -0
- package/dist/core/utils/markdown-renderer.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +255 -0
- package/dist/main.js.map +1 -0
- package/dist/services/config.d.ts +29 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +204 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/gmail.d.ts +197 -0
- package/dist/services/gmail.d.ts.map +1 -0
- package/dist/services/gmail.js +592 -0
- package/dist/services/gmail.js.map +1 -0
- package/dist/services/llm/ai-sdk-service.d.ts +5 -0
- package/dist/services/llm/ai-sdk-service.d.ts.map +1 -0
- package/dist/services/llm/ai-sdk-service.js +326 -0
- package/dist/services/llm/ai-sdk-service.js.map +1 -0
- package/dist/services/llm/context-manager.d.ts +51 -0
- package/dist/services/llm/context-manager.d.ts.map +1 -0
- package/dist/services/llm/context-manager.js +269 -0
- package/dist/services/llm/context-manager.js.map +1 -0
- package/dist/services/llm/types.d.ts +114 -0
- package/dist/services/llm/types.d.ts.map +1 -0
- package/dist/services/llm/types.js +51 -0
- package/dist/services/llm/types.js.map +1 -0
- package/dist/services/logger.d.ts +28 -0
- package/dist/services/logger.d.ts.map +1 -0
- package/dist/services/logger.js +267 -0
- package/dist/services/logger.js.map +1 -0
- package/dist/services/shell.d.ts +37 -0
- package/dist/services/shell.d.ts.map +1 -0
- package/dist/services/shell.js +197 -0
- package/dist/services/shell.js.map +1 -0
- package/dist/services/storage/file.d.ts +37 -0
- package/dist/services/storage/file.d.ts.map +1 -0
- package/dist/services/storage/file.js +221 -0
- package/dist/services/storage/file.js.map +1 -0
- package/dist/services/storage/inMemory.d.ts +25 -0
- package/dist/services/storage/inMemory.d.ts.map +1 -0
- package/dist/services/storage/inMemory.js +106 -0
- package/dist/services/storage/inMemory.js.map +1 -0
- package/dist/services/storage/service.d.ts +26 -0
- package/dist/services/storage/service.d.ts.map +1 -0
- package/dist/services/storage/service.js +48 -0
- package/dist/services/storage/service.js.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommonSuggestions = void 0;
|
|
4
|
+
exports.formatError = formatError;
|
|
5
|
+
exports.handleError = handleError;
|
|
6
|
+
const effect_1 = require("effect");
|
|
7
|
+
/**
|
|
8
|
+
* Generate actionable suggestions for different error types
|
|
9
|
+
*
|
|
10
|
+
* @param error - The error to generate suggestions for
|
|
11
|
+
* @returns An ErrorDisplay object containing title, message, suggestion, recovery steps, and related commands
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
function generateSuggestions(error) {
|
|
15
|
+
switch (error._tag) {
|
|
16
|
+
case "AgentNotFoundError": {
|
|
17
|
+
return {
|
|
18
|
+
title: "Agent Not Found",
|
|
19
|
+
message: `No agent found with ID: ${error.agentId}`,
|
|
20
|
+
suggestion: error.suggestion || "Check if the agent ID is correct or if the agent was deleted",
|
|
21
|
+
recovery: [
|
|
22
|
+
"List all agents: `jazz agent list`",
|
|
23
|
+
"Check agent ID spelling and case sensitivity",
|
|
24
|
+
"Create a new agent: `jazz agent create`",
|
|
25
|
+
],
|
|
26
|
+
relatedCommands: ["jazz agent list", "jazz agent create"],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
case "AgentAlreadyExistsError": {
|
|
30
|
+
return {
|
|
31
|
+
title: "Agent Already Exists",
|
|
32
|
+
message: `An agent with name "${error.agentId}" already exists`,
|
|
33
|
+
suggestion: error.suggestion || "Choose a different name or delete the existing agent",
|
|
34
|
+
recovery: [
|
|
35
|
+
"Use a different agent name",
|
|
36
|
+
"Delete existing agent: `jazz agent delete <agent-id>`",
|
|
37
|
+
"Update existing agent: `jazz agent update <agent-id>`",
|
|
38
|
+
],
|
|
39
|
+
relatedCommands: ["jazz agent delete", "jazz agent list"],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
case "AgentConfigurationError": {
|
|
43
|
+
return {
|
|
44
|
+
title: "Agent Configuration Error",
|
|
45
|
+
message: `Invalid configuration for agent "${error.agentId}": ${error.message}`,
|
|
46
|
+
suggestion: error.suggestion || `Fix the configuration issue in field: ${error.field}`,
|
|
47
|
+
recovery: [
|
|
48
|
+
`Check the ${error.field} field in your agent configuration`,
|
|
49
|
+
"Validate your configuration: `jazz agent validate <agent-id>`",
|
|
50
|
+
"Use the interactive agent editor: `jazz agent edit <agent-id>`",
|
|
51
|
+
],
|
|
52
|
+
relatedCommands: ["jazz agent get", "jazz agent edit"],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
case "AgentExecutionError": {
|
|
56
|
+
return {
|
|
57
|
+
title: "Agent Execution Failed",
|
|
58
|
+
message: `Agent "${error.agentId}" failed to execute: ${error.reason}`,
|
|
59
|
+
suggestion: error.suggestion || "Check the agent configuration and dependencies",
|
|
60
|
+
recovery: [
|
|
61
|
+
"Check agent configuration: `jazz agent get <agent-id>`",
|
|
62
|
+
"Run with verbose logging: `jazz agent run <agent-id> --verbose`",
|
|
63
|
+
"Test individual tasks: `jazz task test <task-id>`",
|
|
64
|
+
],
|
|
65
|
+
relatedCommands: ["jazz agent get", "jazz agent run --verbose"],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
case "TaskNotFoundError": {
|
|
69
|
+
return {
|
|
70
|
+
title: "Task Not Found",
|
|
71
|
+
message: `Task with ID "${error.taskId}" not found`,
|
|
72
|
+
suggestion: error.suggestion || "Check if the task ID is correct",
|
|
73
|
+
recovery: [
|
|
74
|
+
"List all tasks: `jazz task list`",
|
|
75
|
+
"Check task ID spelling and case sensitivity",
|
|
76
|
+
"Create a new task: `jazz task create`",
|
|
77
|
+
],
|
|
78
|
+
relatedCommands: ["jazz task list", "jazz task create"],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
case "TaskExecutionError": {
|
|
82
|
+
return {
|
|
83
|
+
title: "Task Execution Failed",
|
|
84
|
+
message: `Task "${error.taskId}" failed: ${error.reason}`,
|
|
85
|
+
suggestion: error.suggestion || "Check the task configuration and dependencies",
|
|
86
|
+
recovery: [
|
|
87
|
+
"Check task configuration: `jazz task get <task-id>`",
|
|
88
|
+
"Run with debug mode: `jazz task run <task-id> --debug`",
|
|
89
|
+
"Check task dependencies: `jazz task deps <task-id>`",
|
|
90
|
+
],
|
|
91
|
+
relatedCommands: ["jazz task get", "jazz task run --debug"],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
case "TaskTimeoutError": {
|
|
95
|
+
return {
|
|
96
|
+
title: "Task Timeout",
|
|
97
|
+
message: `Task "${error.taskId}" timed out after ${error.timeout}ms`,
|
|
98
|
+
suggestion: error.suggestion || "Increase the timeout or optimize the task",
|
|
99
|
+
recovery: [
|
|
100
|
+
"Increase task timeout in configuration",
|
|
101
|
+
"Optimize task performance",
|
|
102
|
+
"Check for resource constraints",
|
|
103
|
+
"Run with longer timeout: `jazz task run <task-id> --timeout 60000`",
|
|
104
|
+
],
|
|
105
|
+
relatedCommands: ["jazz task run --timeout", "jazz agent config"],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
case "TaskDependencyError": {
|
|
109
|
+
return {
|
|
110
|
+
title: "Task Dependency Error",
|
|
111
|
+
message: `Task "${error.taskId}" has dependency issue with "${error.dependencyId}": ${error.reason}`,
|
|
112
|
+
suggestion: error.suggestion || "Resolve the dependency issue",
|
|
113
|
+
recovery: [
|
|
114
|
+
"Check dependency task status: `jazz task get <dependency-id>`",
|
|
115
|
+
"Run dependency task first: `jazz task run <dependency-id>`",
|
|
116
|
+
"Update task dependencies: `jazz task update <task-id>`",
|
|
117
|
+
],
|
|
118
|
+
relatedCommands: ["jazz task get", "jazz task run"],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
case "ConfigurationError": {
|
|
122
|
+
return {
|
|
123
|
+
title: "Configuration Error",
|
|
124
|
+
message: `Configuration error in field "${error.field}": ${error.message}`,
|
|
125
|
+
suggestion: error.suggestion || "Fix the configuration value",
|
|
126
|
+
recovery: [
|
|
127
|
+
"Check configuration file: `jazz config list`",
|
|
128
|
+
"Validate configuration: `jazz config validate`",
|
|
129
|
+
"Reset to defaults: `jazz config reset`",
|
|
130
|
+
],
|
|
131
|
+
relatedCommands: ["jazz config list", "jazz config validate"],
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
case "ConfigurationNotFoundError": {
|
|
135
|
+
return {
|
|
136
|
+
title: "Configuration File Not Found",
|
|
137
|
+
message: `Configuration file not found at: ${error.path}`,
|
|
138
|
+
suggestion: error.suggestion || "Create a configuration file or check the path",
|
|
139
|
+
recovery: [
|
|
140
|
+
"Create default config: `jazz config init`",
|
|
141
|
+
"Check file path and permissions",
|
|
142
|
+
"Use environment variables instead",
|
|
143
|
+
],
|
|
144
|
+
relatedCommands: ["jazz config init", "jazz config set"],
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
case "ConfigurationValidationError": {
|
|
148
|
+
return {
|
|
149
|
+
title: "Configuration Validation Error",
|
|
150
|
+
message: `Field "${error.field}" expected ${error.expected}, got ${String(error.actual)}`,
|
|
151
|
+
suggestion: error.suggestion || "Update the configuration value to match expected format",
|
|
152
|
+
recovery: [
|
|
153
|
+
"Check configuration documentation",
|
|
154
|
+
"Use correct data type for the field",
|
|
155
|
+
"Validate configuration: `jazz config validate`",
|
|
156
|
+
],
|
|
157
|
+
relatedCommands: ["jazz config validate", "jazz config set"],
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
case "StorageError": {
|
|
161
|
+
return {
|
|
162
|
+
title: "Storage Error",
|
|
163
|
+
message: `Storage operation "${error.operation}" failed on "${error.path}": ${error.reason}`,
|
|
164
|
+
suggestion: error.suggestion || "Check storage permissions and disk space",
|
|
165
|
+
recovery: [
|
|
166
|
+
"Check disk space and permissions",
|
|
167
|
+
"Verify storage path exists",
|
|
168
|
+
"Try different storage location",
|
|
169
|
+
],
|
|
170
|
+
relatedCommands: ["jazz config set storage.path"],
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
case "StorageNotFoundError": {
|
|
174
|
+
return {
|
|
175
|
+
title: "Storage Not Found",
|
|
176
|
+
message: `Storage location not found: ${error.path}`,
|
|
177
|
+
suggestion: error.suggestion || "Create the storage directory or check the path",
|
|
178
|
+
recovery: [
|
|
179
|
+
"Create storage directory: `mkdir -p ${error.path}`",
|
|
180
|
+
"Check storage configuration: `jazz config get storage`",
|
|
181
|
+
"Use different storage path",
|
|
182
|
+
],
|
|
183
|
+
relatedCommands: ["jazz config set storage.path"],
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
case "StoragePermissionError": {
|
|
187
|
+
return {
|
|
188
|
+
title: "Storage Permission Error",
|
|
189
|
+
message: `Permission denied for operation "${error.operation}" on "${error.path}"`,
|
|
190
|
+
suggestion: error.suggestion || "Fix file permissions or run with appropriate privileges",
|
|
191
|
+
recovery: [
|
|
192
|
+
"Check file permissions: `ls -la ${error.path}`",
|
|
193
|
+
"Fix permissions: `chmod 755 ${error.path}`",
|
|
194
|
+
"Run with appropriate user privileges",
|
|
195
|
+
],
|
|
196
|
+
relatedCommands: ["jazz config set storage.path"],
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
case "CLIError": {
|
|
200
|
+
return {
|
|
201
|
+
title: "CLI Error",
|
|
202
|
+
message: `Command "${error.command}" failed: ${error.message}`,
|
|
203
|
+
suggestion: error.suggestion || "Check command syntax and options",
|
|
204
|
+
recovery: [
|
|
205
|
+
"Check command help: `jazz <command> --help`",
|
|
206
|
+
"Verify command syntax",
|
|
207
|
+
"Check required options and arguments",
|
|
208
|
+
],
|
|
209
|
+
relatedCommands: ["jazz --help", `jazz ${error.command} --help`],
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
case "ValidationError": {
|
|
213
|
+
return {
|
|
214
|
+
title: "Validation Error",
|
|
215
|
+
message: `Field "${error.field}" validation failed: ${error.message}`,
|
|
216
|
+
suggestion: error.suggestion || "Provide a valid value for the field",
|
|
217
|
+
recovery: [
|
|
218
|
+
"Check field requirements and format",
|
|
219
|
+
"Use valid characters and length limits",
|
|
220
|
+
"Refer to documentation for field specifications",
|
|
221
|
+
],
|
|
222
|
+
relatedCommands: ["jazz --help"],
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
case "NetworkError": {
|
|
226
|
+
return {
|
|
227
|
+
title: "Network Error",
|
|
228
|
+
message: `Network request to "${error.url}" failed: ${error.reason}`,
|
|
229
|
+
suggestion: error.suggestion || "Check network connectivity and URL",
|
|
230
|
+
recovery: [
|
|
231
|
+
"Check internet connection",
|
|
232
|
+
"Verify URL is correct and accessible",
|
|
233
|
+
"Check firewall and proxy settings",
|
|
234
|
+
"Retry the operation",
|
|
235
|
+
],
|
|
236
|
+
relatedCommands: ["jazz config get network"],
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
case "APIError": {
|
|
240
|
+
return {
|
|
241
|
+
title: "API Error",
|
|
242
|
+
message: `API call to "${error.endpoint}" failed with status ${error.statusCode}: ${error.message}`,
|
|
243
|
+
suggestion: error.suggestion || "Check API credentials and endpoint status",
|
|
244
|
+
recovery: [
|
|
245
|
+
"Verify API credentials: `jazz config get api`",
|
|
246
|
+
"Check API service status",
|
|
247
|
+
"Review API rate limits",
|
|
248
|
+
"Update API configuration",
|
|
249
|
+
],
|
|
250
|
+
relatedCommands: ["jazz config get api", "jazz auth status"],
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
case "FileSystemError": {
|
|
254
|
+
return {
|
|
255
|
+
title: "File System Error",
|
|
256
|
+
message: `File operation "${error.operation}" failed on "${error.path}": ${error.reason}`,
|
|
257
|
+
suggestion: error.suggestion || "Check file path and permissions",
|
|
258
|
+
recovery: [
|
|
259
|
+
"Verify file path exists",
|
|
260
|
+
"Check file permissions",
|
|
261
|
+
"Ensure sufficient disk space",
|
|
262
|
+
],
|
|
263
|
+
relatedCommands: ["jazz config get storage"],
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
case "FileNotFoundError": {
|
|
267
|
+
return {
|
|
268
|
+
title: "File Not Found",
|
|
269
|
+
message: `File not found: ${error.path}`,
|
|
270
|
+
suggestion: error.suggestion || "Check if the file exists and path is correct",
|
|
271
|
+
recovery: [
|
|
272
|
+
"Verify file path: `ls -la ${error.path}`",
|
|
273
|
+
"Check file permissions",
|
|
274
|
+
"Create the file if needed",
|
|
275
|
+
],
|
|
276
|
+
relatedCommands: ["jazz config get storage"],
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
case "FilePermissionError": {
|
|
280
|
+
return {
|
|
281
|
+
title: "File Permission Error",
|
|
282
|
+
message: `Permission denied for operation "${error.operation}" on "${error.path}"`,
|
|
283
|
+
suggestion: error.suggestion || "Fix file permissions or run with appropriate privileges",
|
|
284
|
+
recovery: [
|
|
285
|
+
"Check file permissions: `ls -la ${error.path}`",
|
|
286
|
+
"Fix permissions: `chmod 644 ${error.path}`",
|
|
287
|
+
"Run with appropriate user privileges",
|
|
288
|
+
],
|
|
289
|
+
relatedCommands: ["jazz config get storage"],
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
case "TimeoutError": {
|
|
293
|
+
return {
|
|
294
|
+
title: "Operation Timeout",
|
|
295
|
+
message: `Operation "${error.operation}" timed out after ${error.timeout}ms`,
|
|
296
|
+
suggestion: error.suggestion || "Increase timeout or optimize the operation",
|
|
297
|
+
recovery: [
|
|
298
|
+
"Increase operation timeout",
|
|
299
|
+
"Check for resource constraints",
|
|
300
|
+
"Optimize operation performance",
|
|
301
|
+
"Retry the operation",
|
|
302
|
+
],
|
|
303
|
+
relatedCommands: ["jazz config get performance"],
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
case "ResourceExhaustedError": {
|
|
307
|
+
return {
|
|
308
|
+
title: "Resource Exhausted",
|
|
309
|
+
message: `Resource "${error.resource}" limit exceeded: ${error.current}/${error.limit}`,
|
|
310
|
+
suggestion: error.suggestion || "Free up resources or increase limits",
|
|
311
|
+
recovery: [
|
|
312
|
+
"Free up system resources",
|
|
313
|
+
"Increase resource limits in configuration",
|
|
314
|
+
"Optimize resource usage",
|
|
315
|
+
"Restart the application",
|
|
316
|
+
],
|
|
317
|
+
relatedCommands: ["jazz config get performance"],
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
case "InternalError": {
|
|
321
|
+
return {
|
|
322
|
+
title: "Internal Error",
|
|
323
|
+
message: `Internal error in ${error.component}: ${error.message}`,
|
|
324
|
+
suggestion: error.suggestion || "This is an internal error. Please report it.",
|
|
325
|
+
recovery: [
|
|
326
|
+
"Restart the application",
|
|
327
|
+
"Check application logs",
|
|
328
|
+
"Report the issue to support",
|
|
329
|
+
"Update to latest version",
|
|
330
|
+
],
|
|
331
|
+
relatedCommands: ["jazz logs", "jazz --version"],
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
case "LLMConfigurationError": {
|
|
335
|
+
return {
|
|
336
|
+
title: "LLM Configuration Error",
|
|
337
|
+
message: `LLM provider "${error.provider}" configuration error: ${error.message}`,
|
|
338
|
+
suggestion: error.suggestion || "Check your LLM provider configuration and API keys",
|
|
339
|
+
recovery: [
|
|
340
|
+
"Check API key configuration: `jazz config get llm.${error.provider}`",
|
|
341
|
+
"Set API key: `jazz config set llm.${error.provider}.api_key <your-key>`",
|
|
342
|
+
"Verify provider is supported",
|
|
343
|
+
"Check provider documentation",
|
|
344
|
+
],
|
|
345
|
+
relatedCommands: ["jazz config get llm", "jazz config set llm"],
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
case "LLMAuthenticationError": {
|
|
349
|
+
return {
|
|
350
|
+
title: "LLM Authentication Error",
|
|
351
|
+
message: `Authentication failed for LLM provider "${error.provider}": ${error.message}`,
|
|
352
|
+
suggestion: error.suggestion || "Check your API credentials and authentication",
|
|
353
|
+
recovery: [
|
|
354
|
+
"Verify API key is correct and active",
|
|
355
|
+
"Check API key permissions",
|
|
356
|
+
"Regenerate API key if needed",
|
|
357
|
+
"Check provider service status",
|
|
358
|
+
],
|
|
359
|
+
relatedCommands: ["jazz config get llm", "jazz auth status"],
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
case "GmailAuthenticationError": {
|
|
363
|
+
return {
|
|
364
|
+
title: "Gmail Authentication Error",
|
|
365
|
+
message: `Gmail authentication failed: ${error.message}`,
|
|
366
|
+
suggestion: error.suggestion || "Re-authenticate with Gmail",
|
|
367
|
+
recovery: [
|
|
368
|
+
"Re-authenticate: `jazz auth gmail login`",
|
|
369
|
+
"Check authentication status: `jazz auth gmail status`",
|
|
370
|
+
"Clear stored tokens: `jazz auth gmail logout`",
|
|
371
|
+
"Verify Google OAuth configuration",
|
|
372
|
+
],
|
|
373
|
+
relatedCommands: ["jazz auth gmail login", "jazz auth gmail status"],
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
case "GmailOperationError": {
|
|
377
|
+
return {
|
|
378
|
+
title: "Gmail Operation Error",
|
|
379
|
+
message: `Gmail operation "${error.operation}" failed: ${error.message}`,
|
|
380
|
+
suggestion: error.suggestion || "Check Gmail API permissions and operation parameters",
|
|
381
|
+
recovery: [
|
|
382
|
+
"Check Gmail API permissions",
|
|
383
|
+
"Verify operation parameters",
|
|
384
|
+
"Check Gmail service status",
|
|
385
|
+
"Retry the operation",
|
|
386
|
+
],
|
|
387
|
+
relatedCommands: ["jazz auth gmail status", "jazz agent run --verbose"],
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
case "GmailTaskError": {
|
|
391
|
+
return {
|
|
392
|
+
title: "Gmail Task Error",
|
|
393
|
+
message: `Gmail task "${error.taskId}" operation "${error.operation}" failed: ${error.message}`,
|
|
394
|
+
suggestion: error.suggestion || "Check task configuration and Gmail authentication",
|
|
395
|
+
recovery: [
|
|
396
|
+
"Check task configuration: `jazz agent get <agent-id>`",
|
|
397
|
+
"Verify Gmail authentication: `jazz auth gmail status`",
|
|
398
|
+
"Check Gmail API permissions",
|
|
399
|
+
"Review task parameters",
|
|
400
|
+
],
|
|
401
|
+
relatedCommands: ["jazz agent get", "jazz auth gmail status"],
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
default: {
|
|
405
|
+
return {
|
|
406
|
+
title: "Unknown Error",
|
|
407
|
+
message: "An unexpected error occurred",
|
|
408
|
+
suggestion: "Please report this error to the development team",
|
|
409
|
+
recovery: ["Check application logs", "Restart the application", "Report the issue"],
|
|
410
|
+
relatedCommands: ["jazz logs", "jazz --help"],
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Format error for display with actionable suggestions
|
|
417
|
+
*
|
|
418
|
+
* Takes a JazzError and formats it into a user-friendly string with:
|
|
419
|
+
* - Clear error title and message
|
|
420
|
+
* - Actionable suggestions
|
|
421
|
+
* - Step-by-step recovery instructions
|
|
422
|
+
* - Related CLI commands
|
|
423
|
+
*
|
|
424
|
+
* @param error - The error to format
|
|
425
|
+
* @returns A formatted string ready for console output
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* ```typescript
|
|
429
|
+
* const error = new AgentNotFoundError({ agentId: "test-agent" });
|
|
430
|
+
* const formatted = formatError(error);
|
|
431
|
+
* console.error(formatted);
|
|
432
|
+
* // Output: "❌ Agent Not Found\n No agent found with ID: test-agent\n..."
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
function formatError(error) {
|
|
436
|
+
const display = generateSuggestions(error);
|
|
437
|
+
let output = `❌ ${display.title}\n`;
|
|
438
|
+
output += ` ${display.message}\n`;
|
|
439
|
+
if (display.suggestion) {
|
|
440
|
+
output += `\n💡 Suggestion: ${display.suggestion}\n`;
|
|
441
|
+
}
|
|
442
|
+
if (display.recovery && display.recovery.length > 0) {
|
|
443
|
+
output += `\n🔧 Recovery Steps:\n`;
|
|
444
|
+
display.recovery.forEach((step, index) => {
|
|
445
|
+
output += ` ${index + 1}. ${step}\n`;
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
if (display.relatedCommands && display.relatedCommands.length > 0) {
|
|
449
|
+
output += `\n📚 Related Commands:\n`;
|
|
450
|
+
display.relatedCommands.forEach((cmd) => {
|
|
451
|
+
output += ` • ${cmd}\n`;
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
if (display.documentation) {
|
|
455
|
+
output += `\n📖 Documentation: ${display.documentation}\n`;
|
|
456
|
+
}
|
|
457
|
+
return output;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Enhanced error handler that provides actionable suggestions
|
|
461
|
+
*
|
|
462
|
+
* Handles both JazzError types (with structured suggestions) and generic Error objects.
|
|
463
|
+
* For JazzError types, it formats them with actionable suggestions, recovery steps, and related commands.
|
|
464
|
+
* For generic Error objects, it provides a basic error message with general guidance.
|
|
465
|
+
*
|
|
466
|
+
* @param error - The error to handle (JazzError or generic Error)
|
|
467
|
+
* @returns An Effect that logs the formatted error to the console
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```typescript
|
|
471
|
+
* // Handle a structured error
|
|
472
|
+
* const JazzError = new AgentNotFoundError({ agentId: "test" });
|
|
473
|
+
* yield* handleError(JazzError);
|
|
474
|
+
*
|
|
475
|
+
* // Handle a generic error
|
|
476
|
+
* const genericError = new Error("Something went wrong");
|
|
477
|
+
* yield* handleError(genericError);
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
function handleError(error) {
|
|
481
|
+
return effect_1.Effect.sync(() => {
|
|
482
|
+
// Check if it's a JazzError (has _tag property)
|
|
483
|
+
if ("_tag" in error && typeof error._tag === "string") {
|
|
484
|
+
const formattedError = formatError(error);
|
|
485
|
+
console.error(formattedError);
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
// Handle generic Error objects
|
|
489
|
+
const genericError = error;
|
|
490
|
+
console.error(`❌ Error\n ${genericError.message}\n\n💡 Suggestion: Check the error details and try again\n\n📚 Related Commands:\n • jazz --help\n • jazz logs`);
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Common error suggestions for frequently encountered error scenarios
|
|
496
|
+
*
|
|
497
|
+
* Provides reusable suggestion templates that can be used across different error types
|
|
498
|
+
* to maintain consistency in error messaging and reduce duplication.
|
|
499
|
+
*
|
|
500
|
+
* @example
|
|
501
|
+
* ```typescript
|
|
502
|
+
* const error = new AgentNotFoundError({
|
|
503
|
+
* agentId: "test",
|
|
504
|
+
* suggestion: CommonSuggestions.checkAgentExists("test")
|
|
505
|
+
* });
|
|
506
|
+
* ```
|
|
507
|
+
*/
|
|
508
|
+
exports.CommonSuggestions = {
|
|
509
|
+
/**
|
|
510
|
+
* Suggestion for when an agent is not found
|
|
511
|
+
* @param _agentId - The agent ID that was not found (unused but kept for consistency)
|
|
512
|
+
* @returns A suggestion string with commands to list or create agents
|
|
513
|
+
*/
|
|
514
|
+
checkAgentExists: (_agentId) => `Run 'jazz agent list' to see available agents or create a new one with 'jazz agent create'`,
|
|
515
|
+
/**
|
|
516
|
+
* Suggestion for configuration-related errors
|
|
517
|
+
* @param field - The configuration field that has an issue
|
|
518
|
+
* @returns A suggestion string with commands to check or update the configuration
|
|
519
|
+
*/
|
|
520
|
+
checkConfiguration: (field) => `Run 'jazz config get ${field}' to check current value or 'jazz config set ${field} <value>' to update`,
|
|
521
|
+
/**
|
|
522
|
+
* Suggestion for file permission errors
|
|
523
|
+
* @param path - The file path that has permission issues
|
|
524
|
+
* @returns A suggestion string with commands to check and fix permissions
|
|
525
|
+
*/
|
|
526
|
+
checkPermissions: (path) => `Check file permissions with 'ls -la ${path}' and fix with 'chmod 755 ${path}' if needed`,
|
|
527
|
+
/**
|
|
528
|
+
* Suggestion for network-related errors
|
|
529
|
+
* @returns A suggestion string for network connectivity issues
|
|
530
|
+
*/
|
|
531
|
+
checkNetwork: () => `Check your internet connection and try again. If using a proxy, configure it in your environment`,
|
|
532
|
+
/**
|
|
533
|
+
* Suggestion for authentication errors
|
|
534
|
+
* @param service - The service that requires authentication
|
|
535
|
+
* @returns A suggestion string with commands to authenticate or check status
|
|
536
|
+
*/
|
|
537
|
+
checkCredentials: (service) => `Run 'jazz auth ${service} login' to authenticate or check credentials with 'jazz auth ${service} status'`,
|
|
538
|
+
/**
|
|
539
|
+
* Suggestion for timeout errors
|
|
540
|
+
* @param currentTimeout - The current timeout value in milliseconds
|
|
541
|
+
* @returns A suggestion string recommending a higher timeout value
|
|
542
|
+
*/
|
|
543
|
+
increaseTimeout: (currentTimeout) => `Try increasing the timeout to ${currentTimeout * 2}ms or more in your configuration`,
|
|
544
|
+
/**
|
|
545
|
+
* Suggestion for task dependency errors
|
|
546
|
+
* @param taskId - The task ID that has dependency issues
|
|
547
|
+
* @returns A suggestion string with commands to check task dependencies
|
|
548
|
+
*/
|
|
549
|
+
checkDependencies: (taskId) => `Run 'jazz task deps ${taskId}' to check task dependencies and resolve any issues`,
|
|
550
|
+
};
|
|
551
|
+
//# sourceMappingURL=error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/core/utils/error-handler.ts"],"names":[],"mappings":";;;AA2dA,kCA6BC;AAuBD,kCAcC;AA7hBD,mCAAgC;AAgBhC;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,KAAgB;IAC3C,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,oBAAoB,CAAC,CAAC,CAAC;YAC1B,OAAO;gBACL,KAAK,EAAE,iBAAiB;gBACxB,OAAO,EAAE,2BAA2B,KAAK,CAAC,OAAO,EAAE;gBACnD,UAAU,EACR,KAAK,CAAC,UAAU,IAAI,8DAA8D;gBACpF,QAAQ,EAAE;oBACR,oCAAoC;oBACpC,8CAA8C;oBAC9C,yCAAyC;iBAC1C;gBACD,eAAe,EAAE,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;aAC1D,CAAC;QACJ,CAAC;QAED,KAAK,yBAAyB,CAAC,CAAC,CAAC;YAC/B,OAAO;gBACL,KAAK,EAAE,sBAAsB;gBAC7B,OAAO,EAAE,uBAAuB,KAAK,CAAC,OAAO,kBAAkB;gBAC/D,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,sDAAsD;gBACtF,QAAQ,EAAE;oBACR,4BAA4B;oBAC5B,uDAAuD;oBACvD,uDAAuD;iBACxD;gBACD,eAAe,EAAE,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;aAC1D,CAAC;QACJ,CAAC;QAED,KAAK,yBAAyB,CAAC,CAAC,CAAC;YAC/B,OAAO;gBACL,KAAK,EAAE,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
import { Effect } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Markdown renderer utility for terminal output
|
|
4
|
+
*/
|
|
5
|
+
export declare class MarkdownRenderer {
|
|
6
|
+
private static renderer;
|
|
7
|
+
/**
|
|
8
|
+
* Initialize the markdown renderer with terminal-friendly options
|
|
9
|
+
*/
|
|
10
|
+
static initialize(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Render markdown content to terminal-friendly text
|
|
13
|
+
*/
|
|
14
|
+
static render(markdown: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Render markdown content with error handling
|
|
17
|
+
*/
|
|
18
|
+
static renderSafe(markdown: string): Effect.Effect<string, never>;
|
|
19
|
+
/**
|
|
20
|
+
* Format agent response with proper styling
|
|
21
|
+
*/
|
|
22
|
+
static formatAgentResponse(agentName: string, content: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Format tool execution message with styling
|
|
25
|
+
*/
|
|
26
|
+
static formatToolExecution(agentName: string, toolNames: string[]): string;
|
|
27
|
+
/**
|
|
28
|
+
* Format thinking/processing message with styling
|
|
29
|
+
*/
|
|
30
|
+
static formatThinking(agentName: string, isFirstIteration?: boolean): string;
|
|
31
|
+
/**
|
|
32
|
+
* Format completion message with styling
|
|
33
|
+
*/
|
|
34
|
+
static formatCompletion(agentName: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Format warning message with styling
|
|
37
|
+
*/
|
|
38
|
+
static formatWarning(agentName: string, message: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Format error message with styling
|
|
41
|
+
*/
|
|
42
|
+
static formatError(message: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Format info message with styling
|
|
45
|
+
*/
|
|
46
|
+
static formatInfo(message: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Format success message with styling
|
|
49
|
+
*/
|
|
50
|
+
static formatSuccess(message: string): string;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=markdown-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-renderer.d.ts","sourceRoot":"","sources":["../../../src/core/utils/markdown-renderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQhC;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiC;IAExD;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,IAAI;IAwCzB;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAevC;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAIjE;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAMtE;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM;IAK1E;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,gBAAgB,GAAE,OAAe,GAAG,MAAM;IAKnF;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIlD;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAIhE;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI3C;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI1C;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAG9C"}
|