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,463 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentServiceTag = exports.DefaultAgentService = void 0;
|
|
4
|
+
exports.createAgentServiceLayer = createAgentServiceLayer;
|
|
5
|
+
exports.createAgent = createAgent;
|
|
6
|
+
exports.getAgentById = getAgentById;
|
|
7
|
+
exports.listAllAgents = listAllAgents;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const effect_1 = require("effect");
|
|
10
|
+
const short_uuid_1 = tslib_1.__importDefault(require("short-uuid"));
|
|
11
|
+
const service_1 = require("../../services/storage/service");
|
|
12
|
+
const errors_1 = require("../types/errors");
|
|
13
|
+
const index_1 = require("../types/index");
|
|
14
|
+
const error_handler_1 = require("../utils/error-handler");
|
|
15
|
+
class DefaultAgentService {
|
|
16
|
+
storage;
|
|
17
|
+
constructor(storage) {
|
|
18
|
+
this.storage = storage;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create a new agent with the specified configuration
|
|
22
|
+
*
|
|
23
|
+
* Validates the agent name and description, checks for duplicates, and creates
|
|
24
|
+
* a new agent with the provided configuration. The agent will be assigned a
|
|
25
|
+
* unique ID and timestamps for creation and updates.
|
|
26
|
+
*
|
|
27
|
+
* @param name - The unique name for the agent (must be alphanumeric with underscores/hyphens)
|
|
28
|
+
* @param description - A description of what the agent does (1-500 characters)
|
|
29
|
+
* @param config - Optional configuration including timeout, retry policy, and tasks
|
|
30
|
+
* @returns An Effect that resolves to the created Agent or fails with validation/configuration errors
|
|
31
|
+
*
|
|
32
|
+
* @throws {ValidationError} When name or description validation fails
|
|
33
|
+
* @throws {AgentAlreadyExistsError} When an agent with the same name already exists
|
|
34
|
+
* @throws {AgentConfigurationError} When the configuration is invalid
|
|
35
|
+
* @throws {StorageError} When the agent cannot be saved to storage
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const agent = yield* agentService.createAgent(
|
|
40
|
+
* "email-processor",
|
|
41
|
+
* "Processes incoming emails and categorizes them",
|
|
42
|
+
* { timeout: 30000, retryPolicy: { maxRetries: 3, delay: 1000, backoff: "exponential" } }
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
createAgent(name, description, config = {}) {
|
|
47
|
+
return effect_1.Effect.gen(function* () {
|
|
48
|
+
// Validate input parameters
|
|
49
|
+
yield* validateAgentName(name);
|
|
50
|
+
yield* validateAgentDescription(description);
|
|
51
|
+
const id = short_uuid_1.default.generate();
|
|
52
|
+
// Create default agent configuration
|
|
53
|
+
const defaultConfig = {
|
|
54
|
+
tasks: [],
|
|
55
|
+
timeout: 30000,
|
|
56
|
+
environment: {},
|
|
57
|
+
agentType: "default",
|
|
58
|
+
llmProvider: "openai",
|
|
59
|
+
llmModel: "gpt-4o",
|
|
60
|
+
};
|
|
61
|
+
// Merge with provided config
|
|
62
|
+
const agentConfig = {
|
|
63
|
+
...defaultConfig,
|
|
64
|
+
...config,
|
|
65
|
+
tasks: config.tasks || [],
|
|
66
|
+
environment: { ...defaultConfig.environment, ...config.environment },
|
|
67
|
+
};
|
|
68
|
+
// Validate the complete agent configuration
|
|
69
|
+
yield* this.validateAgentConfig(agentConfig);
|
|
70
|
+
// Check if agent with same name already exists
|
|
71
|
+
const existingAgents = yield* this.storage.listAgents();
|
|
72
|
+
const nameExists = existingAgents.some((agent) => agent.name === name);
|
|
73
|
+
if (nameExists) {
|
|
74
|
+
return yield* effect_1.Effect.fail(new errors_1.AgentAlreadyExistsError({
|
|
75
|
+
agentId: name,
|
|
76
|
+
suggestion: error_handler_1.CommonSuggestions.checkAgentExists(name),
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
// Create the agent
|
|
80
|
+
const now = new Date();
|
|
81
|
+
const agent = {
|
|
82
|
+
id,
|
|
83
|
+
name,
|
|
84
|
+
description,
|
|
85
|
+
config: agentConfig,
|
|
86
|
+
status: "idle",
|
|
87
|
+
createdAt: now,
|
|
88
|
+
updatedAt: now,
|
|
89
|
+
};
|
|
90
|
+
// Save the agent
|
|
91
|
+
yield* this.storage.saveAgent(agent);
|
|
92
|
+
return agent;
|
|
93
|
+
}.bind(this));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Retrieve an agent by its unique identifier
|
|
97
|
+
*
|
|
98
|
+
* @param id - The unique identifier of the agent to retrieve
|
|
99
|
+
* @returns An Effect that resolves to the Agent or fails if not found
|
|
100
|
+
*
|
|
101
|
+
* @throws {StorageError} When there's an error accessing storage
|
|
102
|
+
* @throws {StorageNotFoundError} When the agent with the given ID doesn't exist
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const agent = yield* agentService.getAgent("agent-123");
|
|
107
|
+
* console.log(`Found agent: ${agent.name}`);
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
getAgent(id) {
|
|
111
|
+
return this.storage.getAgent(id);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* List all available agents
|
|
115
|
+
*
|
|
116
|
+
* @returns An Effect that resolves to an array of all agents in storage
|
|
117
|
+
*
|
|
118
|
+
* @throws {StorageError} When there's an error accessing storage
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const agents = yield* agentService.listAgents();
|
|
123
|
+
* console.log(`Found ${agents.length} agents`);
|
|
124
|
+
* agents.forEach(agent => console.log(`- ${agent.name}: ${agent.description}`));
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
listAgents() {
|
|
128
|
+
return this.storage.listAgents();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Update an existing agent with new data
|
|
132
|
+
*
|
|
133
|
+
* Updates the specified agent with the provided changes. The agent's ID and
|
|
134
|
+
* creation timestamp cannot be changed. The updatedAt timestamp will be
|
|
135
|
+
* automatically set to the current time.
|
|
136
|
+
*
|
|
137
|
+
* @param id - The unique identifier of the agent to update
|
|
138
|
+
* @param updates - Partial agent data containing the fields to update
|
|
139
|
+
* @returns An Effect that resolves to the updated Agent or fails if not found
|
|
140
|
+
*
|
|
141
|
+
* @throws {StorageError} When there's an error accessing storage
|
|
142
|
+
* @throws {StorageNotFoundError} When the agent with the given ID doesn't exist
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* const updatedAgent = yield* agentService.updateAgent("agent-123", {
|
|
147
|
+
* description: "Updated description",
|
|
148
|
+
* config: { timeout: 60000 }
|
|
149
|
+
* });
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
updateAgent(id, updates) {
|
|
153
|
+
return effect_1.Effect.gen(function* () {
|
|
154
|
+
const existingAgent = yield* this.storage.getAgent(id);
|
|
155
|
+
const updatedAgent = {
|
|
156
|
+
...existingAgent,
|
|
157
|
+
...updates,
|
|
158
|
+
id: existingAgent.id, // Ensure ID cannot be changed
|
|
159
|
+
createdAt: existingAgent.createdAt, // Ensure createdAt cannot be changed
|
|
160
|
+
updatedAt: new Date(),
|
|
161
|
+
};
|
|
162
|
+
yield* this.storage.saveAgent(updatedAgent);
|
|
163
|
+
return updatedAgent;
|
|
164
|
+
}.bind(this));
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Delete an agent by its unique identifier
|
|
168
|
+
*
|
|
169
|
+
* @param id - The unique identifier of the agent to delete
|
|
170
|
+
* @returns An Effect that resolves when the agent is successfully deleted
|
|
171
|
+
*
|
|
172
|
+
* @throws {StorageError} When there's an error accessing storage
|
|
173
|
+
* @throws {StorageNotFoundError} When the agent with the given ID doesn't exist
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```typescript
|
|
177
|
+
* yield* agentService.deleteAgent("agent-123");
|
|
178
|
+
* console.log("Agent deleted successfully");
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
deleteAgent(id) {
|
|
182
|
+
return this.storage.deleteAgent(id);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Validate an agent configuration for correctness
|
|
186
|
+
*
|
|
187
|
+
* Performs comprehensive validation of the agent configuration including:
|
|
188
|
+
* - Task validation using schemas
|
|
189
|
+
* - Timeout range validation (1000ms - 3600000ms)
|
|
190
|
+
* - Retry policy validation (max retries 0-10, delay 100ms-60000ms)
|
|
191
|
+
*
|
|
192
|
+
* @param config - The agent configuration to validate
|
|
193
|
+
* @returns An Effect that resolves if validation passes or fails with configuration errors
|
|
194
|
+
*
|
|
195
|
+
* @throws {AgentConfigurationError} When any part of the configuration is invalid
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const config: AgentConfig = {
|
|
200
|
+
* tasks: [],
|
|
201
|
+
* timeout: 30000,
|
|
202
|
+
* retryPolicy: { maxRetries: 3, delay: 1000, backoff: "exponential" }
|
|
203
|
+
* };
|
|
204
|
+
*
|
|
205
|
+
* yield* agentService.validateAgentConfig(config);
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
validateAgentConfig(config) {
|
|
209
|
+
return effect_1.Effect.gen(function* () {
|
|
210
|
+
// Validate tasks
|
|
211
|
+
for (const task of config.tasks) {
|
|
212
|
+
yield* validateTask(task);
|
|
213
|
+
}
|
|
214
|
+
// Validate timeout
|
|
215
|
+
if (config.timeout && (config.timeout < 1000 || config.timeout > 3600000)) {
|
|
216
|
+
return yield* effect_1.Effect.fail(new errors_1.AgentConfigurationError({
|
|
217
|
+
agentId: "unknown",
|
|
218
|
+
field: "timeout",
|
|
219
|
+
message: "Timeout must be between 1000ms and 3600000ms (1 hour)",
|
|
220
|
+
suggestion: `Use a timeout between 1000ms and 3600000ms. Current value: ${config.timeout}ms`,
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
|
+
// Validate retry policy if provided
|
|
224
|
+
if (config.retryPolicy) {
|
|
225
|
+
if (config.retryPolicy.maxRetries < 0 || config.retryPolicy.maxRetries > 10) {
|
|
226
|
+
return yield* effect_1.Effect.fail(new errors_1.AgentConfigurationError({
|
|
227
|
+
agentId: "unknown",
|
|
228
|
+
field: "retryPolicy.maxRetries",
|
|
229
|
+
message: "Max retries must be between 0 and 10",
|
|
230
|
+
suggestion: `Use a value between 0 and 10. Current value: ${config.retryPolicy.maxRetries}`,
|
|
231
|
+
}));
|
|
232
|
+
}
|
|
233
|
+
if (config.retryPolicy.delay < 100 || config.retryPolicy.delay > 60000) {
|
|
234
|
+
return yield* effect_1.Effect.fail(new errors_1.AgentConfigurationError({
|
|
235
|
+
agentId: "unknown",
|
|
236
|
+
field: "retryPolicy.delay",
|
|
237
|
+
message: "Retry delay must be between 100ms and 60000ms",
|
|
238
|
+
suggestion: `Use a delay between 100ms and 60000ms. Current value: ${config.retryPolicy.delay}ms`,
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
exports.DefaultAgentService = DefaultAgentService;
|
|
246
|
+
/**
|
|
247
|
+
* Validation helper functions for agent data
|
|
248
|
+
*/
|
|
249
|
+
/**
|
|
250
|
+
* Validate an agent name for correctness
|
|
251
|
+
*
|
|
252
|
+
* Ensures the agent name meets the following criteria:
|
|
253
|
+
* - Not empty or whitespace-only
|
|
254
|
+
* - Maximum 100 characters
|
|
255
|
+
* - Only contains letters, numbers, underscores, and hyphens
|
|
256
|
+
*
|
|
257
|
+
* @param name - The agent name to validate
|
|
258
|
+
* @returns An Effect that resolves if validation passes or fails with validation errors
|
|
259
|
+
*
|
|
260
|
+
* @throws {ValidationError} When the name doesn't meet the requirements
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
*
|
|
264
|
+
* yield validateAgentName("my-agent-1"); // ✅ Valid
|
|
265
|
+
* yield validateAgentName("invalid@name"); // ❌ Throws ValidationError
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
function validateAgentName(name) {
|
|
269
|
+
if (!name || name.trim().length === 0) {
|
|
270
|
+
return effect_1.Effect.fail(new errors_1.ValidationError({
|
|
271
|
+
field: "name",
|
|
272
|
+
message: "Agent name cannot be empty",
|
|
273
|
+
value: name,
|
|
274
|
+
suggestion: "Provide a descriptive name for your agent, e.g., 'email-processor' or 'data-backup'",
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
if (name.length > 100) {
|
|
278
|
+
return effect_1.Effect.fail(new errors_1.ValidationError({
|
|
279
|
+
field: "name",
|
|
280
|
+
message: "Agent name cannot exceed 100 characters",
|
|
281
|
+
value: name,
|
|
282
|
+
suggestion: `Use a shorter name (${name.length}/100 characters). Consider using abbreviations or removing unnecessary words`,
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(name)) {
|
|
286
|
+
return effect_1.Effect.fail(new errors_1.ValidationError({
|
|
287
|
+
field: "name",
|
|
288
|
+
message: "Agent name can only contain letters, numbers, underscores, and hyphens",
|
|
289
|
+
value: name,
|
|
290
|
+
suggestion: "Use only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). Example: 'my-agent-1'",
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
return effect_1.Effect.void;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Validate an agent description for correctness
|
|
297
|
+
*
|
|
298
|
+
* Ensures the agent description meets the following criteria:
|
|
299
|
+
* - Not empty or whitespace-only
|
|
300
|
+
* - Maximum 500 characters
|
|
301
|
+
*
|
|
302
|
+
* @param description - The agent description to validate
|
|
303
|
+
* @returns An Effect that resolves if validation passes or fails with validation errors
|
|
304
|
+
*
|
|
305
|
+
* @throws {ValidationError} When the description doesn't meet the requirements
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* yield* validateAgentDescription("Processes emails and categorizes them"); // ✅ Valid
|
|
310
|
+
* yield* validateAgentDescription(""); // ❌ Throws ValidationError
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
function validateAgentDescription(description) {
|
|
314
|
+
if (!description || description.trim().length === 0) {
|
|
315
|
+
return effect_1.Effect.fail(new errors_1.ValidationError({
|
|
316
|
+
field: "description",
|
|
317
|
+
message: "Agent description cannot be empty",
|
|
318
|
+
value: description,
|
|
319
|
+
suggestion: "Provide a clear description of what this agent does, e.g., 'Processes incoming emails and categorizes them'",
|
|
320
|
+
}));
|
|
321
|
+
}
|
|
322
|
+
if (description.length > 500) {
|
|
323
|
+
return effect_1.Effect.fail(new errors_1.ValidationError({
|
|
324
|
+
field: "description",
|
|
325
|
+
message: "Agent description cannot exceed 500 characters",
|
|
326
|
+
value: description,
|
|
327
|
+
suggestion: `Use a shorter description (${description.length}/500 characters). Focus on the main purpose and key functionality`,
|
|
328
|
+
}));
|
|
329
|
+
}
|
|
330
|
+
return effect_1.Effect.void;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Validate a task configuration using its schema
|
|
334
|
+
*
|
|
335
|
+
* Uses the TaskSchema to validate the task structure and properties.
|
|
336
|
+
* This ensures the task meets all required fields and type constraints.
|
|
337
|
+
*
|
|
338
|
+
* @param task - The task to validate
|
|
339
|
+
* @returns An Effect that resolves if validation passes or fails with configuration errors
|
|
340
|
+
*
|
|
341
|
+
* @throws {AgentConfigurationError} When the task configuration is invalid
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```typescript
|
|
345
|
+
* const task: Task = {
|
|
346
|
+
* id: "task-1",
|
|
347
|
+
* name: "Process Email",
|
|
348
|
+
* type: "gmail",
|
|
349
|
+
* config: { gmailOperation: "listEmails" }
|
|
350
|
+
* };
|
|
351
|
+
* yield* validateTask(task);
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
function validateTask(task) {
|
|
355
|
+
return effect_1.Effect.gen(function* () {
|
|
356
|
+
// Validate task using schema
|
|
357
|
+
yield* effect_1.Effect.try({
|
|
358
|
+
try: () => effect_1.Schema.decodeUnknownSync(index_1.TaskSchema)(task),
|
|
359
|
+
catch: (error) => new errors_1.AgentConfigurationError({
|
|
360
|
+
agentId: "unknown",
|
|
361
|
+
field: `task.${task.id}`,
|
|
362
|
+
message: `Invalid task structure: ${String(error)}`,
|
|
363
|
+
}),
|
|
364
|
+
});
|
|
365
|
+
// Additional business logic validation
|
|
366
|
+
if (!task.name || task.name.trim().length === 0) {
|
|
367
|
+
return yield* effect_1.Effect.fail(new errors_1.AgentConfigurationError({
|
|
368
|
+
agentId: "unknown",
|
|
369
|
+
field: `task.${task.id}.name`,
|
|
370
|
+
message: "Task name cannot be empty",
|
|
371
|
+
}));
|
|
372
|
+
}
|
|
373
|
+
// Validate task type specific requirements
|
|
374
|
+
switch (task.type) {
|
|
375
|
+
case "command":
|
|
376
|
+
if (!task.config.command || task.config.command.trim().length === 0) {
|
|
377
|
+
return yield* effect_1.Effect.fail(new errors_1.AgentConfigurationError({
|
|
378
|
+
agentId: "unknown",
|
|
379
|
+
field: `task.${task.id}.config.command`,
|
|
380
|
+
message: "Command tasks must have a command specified",
|
|
381
|
+
}));
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
384
|
+
case "script":
|
|
385
|
+
if (!task.config.script || task.config.script.trim().length === 0) {
|
|
386
|
+
return yield* effect_1.Effect.fail(new errors_1.AgentConfigurationError({
|
|
387
|
+
agentId: "unknown",
|
|
388
|
+
field: `task.${task.id}.config.script`,
|
|
389
|
+
message: "Script tasks must have a script specified",
|
|
390
|
+
}));
|
|
391
|
+
}
|
|
392
|
+
break;
|
|
393
|
+
case "api":
|
|
394
|
+
if (!task.config.url || task.config.url.trim().length === 0) {
|
|
395
|
+
return yield* effect_1.Effect.fail(new errors_1.AgentConfigurationError({
|
|
396
|
+
agentId: "unknown",
|
|
397
|
+
field: `task.${task.id}.config.url`,
|
|
398
|
+
message: "API tasks must have a URL specified",
|
|
399
|
+
}));
|
|
400
|
+
}
|
|
401
|
+
break;
|
|
402
|
+
case "file":
|
|
403
|
+
if (!task.config.filePath || task.config.filePath.trim().length === 0) {
|
|
404
|
+
return yield* effect_1.Effect.fail(new errors_1.AgentConfigurationError({
|
|
405
|
+
agentId: "unknown",
|
|
406
|
+
field: `task.${task.id}.config.filePath`,
|
|
407
|
+
message: "File tasks must have a file path specified",
|
|
408
|
+
}));
|
|
409
|
+
}
|
|
410
|
+
break;
|
|
411
|
+
case "gmail":
|
|
412
|
+
if (!task.config.gmailOperation) {
|
|
413
|
+
return yield* effect_1.Effect.fail(new errors_1.AgentConfigurationError({
|
|
414
|
+
agentId: "unknown",
|
|
415
|
+
field: `task.${task.id}.config.gmailOperation`,
|
|
416
|
+
message: "Gmail tasks must have an operation specified",
|
|
417
|
+
}));
|
|
418
|
+
}
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
exports.AgentServiceTag = effect_1.Context.GenericTag("AgentService");
|
|
424
|
+
function createAgentServiceLayer() {
|
|
425
|
+
return effect_1.Layer.effect(exports.AgentServiceTag, effect_1.Effect.map(service_1.StorageServiceTag, (storage) => new DefaultAgentService(storage)));
|
|
426
|
+
}
|
|
427
|
+
// Helper functions for common agent operations
|
|
428
|
+
function createAgent(name, description, config) {
|
|
429
|
+
return effect_1.Effect.gen(function* () {
|
|
430
|
+
const agentService = yield* exports.AgentServiceTag;
|
|
431
|
+
return yield* agentService.createAgent(name, description, config);
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
function getAgentById(id) {
|
|
435
|
+
return effect_1.Effect.gen(function* () {
|
|
436
|
+
const agentService = yield* exports.AgentServiceTag;
|
|
437
|
+
return yield* agentService.getAgent(id);
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* List all available agents using the AgentService
|
|
442
|
+
*
|
|
443
|
+
* This is a convenience function that uses the AgentService from the Effect context
|
|
444
|
+
* to retrieve all agents.
|
|
445
|
+
*
|
|
446
|
+
* @returns An Effect that resolves to an array of all agents
|
|
447
|
+
*
|
|
448
|
+
* @throws {StorageError} When there's an error accessing storage
|
|
449
|
+
*
|
|
450
|
+
* @example
|
|
451
|
+
* ```typescript
|
|
452
|
+
* const agents = yield* listAllAgents();
|
|
453
|
+
* console.log(`Found ${agents.length} agents`);
|
|
454
|
+
* agents.forEach(agent => console.log(`- ${agent.name}`));
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
function listAllAgents() {
|
|
458
|
+
return effect_1.Effect.gen(function* () {
|
|
459
|
+
const agentService = yield* exports.AgentServiceTag;
|
|
460
|
+
return yield* agentService.listAgents();
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
//# sourceMappingURL=agent-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-service.js","sourceRoot":"","sources":["../../../src/core/agent/agent-service.ts"],"names":[],"mappings":";;;AA6gBA,0DAKC;AAGD,kCAaC;AAED,oCAOC;AAmBD,sCAKC;;AAnkBD,mCAAwD;AACxD,oEAAmC;AAEnC,4DAAmE;AACnE,4CAMyB;AACzB,0CAAqF;AACrF,0DAA2D;AA2B3D,MAAa,mBAAmB;IACD;IAA7B,YAA6B,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAAG,CAAC;IAExD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,WAAW,CACT,IAAY,EACZ,WAAmB,EACnB,SAA+B,EAAE;QAKjC,OAAO,eAAM,CAAC,GAAG,CACf,QAAQ,CAAC;YACP,4BAA4B;YAC5B,KAAK,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAC/B,KAAK,CAAC,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;YAE7C,MAAM,EAAE,GAAG,oBAAS,CAAC,QAAQ,EAAE,CAAC;YAEhC,qCAAqC;YACrC,MAAM,aAAa,GAAgB;gBACjC,KAAK,EAAE,EAAE;gBACT,OAAO,EAAE,KAAK;gBACd,WAAW,EAAE,EAAE;gBACf,SAAS,EAAE,SAAS;gBACpB,WAAW,EAAE,QAAQ;gBACrB,QAAQ,EAAE,QAAQ;aACnB,CAAC;YAEF,6BAA6B;YAC7B,MAAM,WAAW,GAAgB;gBAC/B,GAAG,aAAa;gBAChB,GAAG,MAAM;gBACT,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;gBACzB,WAAW,EAAE,EAAE,GAAG,aAAa,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,WAAW,EAAE;aACrE,CAAC;YAEF,4CAA4C;YAC5C,KAAK,CAA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AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,aAAa;IAC3B,OAAO,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACzB,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,uBAAe,CAAC;QAC5C,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { type GmailService } from "../../services/gmail";
|
|
3
|
+
import type { Task, TaskResult } from "../types/index";
|
|
4
|
+
/**
|
|
5
|
+
* Gmail agent service for executing Gmail tasks
|
|
6
|
+
*/
|
|
7
|
+
export declare class GmailTaskError extends Error {
|
|
8
|
+
readonly taskId: string;
|
|
9
|
+
readonly cause?: unknown | undefined;
|
|
10
|
+
readonly _tag = "GmailTaskError";
|
|
11
|
+
constructor(taskId: string, message: string, cause?: unknown | undefined);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Execute a Gmail task
|
|
15
|
+
*/
|
|
16
|
+
export declare function executeGmailTask(task: Task): Effect.Effect<TaskResult, GmailTaskError, GmailService>;
|
|
17
|
+
//# sourceMappingURL=gmail-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmail-agent.d.ts","sourceRoot":"","sources":["../../../src/core/agent/gmail-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;GAEG;AAEH,qBAAa,cAAe,SAAQ,KAAK;aAGrB,MAAM,EAAE,MAAM;aAEL,KAAK,CAAC,EAAE,OAAO;IAJ1C,QAAQ,CAAC,IAAI,oBAAoB;gBAEf,MAAM,EAAE,MAAM,EAC9B,OAAO,EAAE,MAAM,EACU,KAAK,CAAC,EAAE,OAAO,YAAA;CAK3C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,GACT,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CA+LzD"}
|