@ugm/desiagent 0.1.36 → 0.2.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.
Files changed (86) hide show
  1. package/README.md +229 -161
  2. package/dist/core/execution/dagExecutor.d.ts +7 -1
  3. package/dist/core/execution/dagExecutor.d.ts.map +1 -1
  4. package/dist/core/execution/dagExecutor.js +8 -2
  5. package/dist/core/execution/dagExecutor.js.map +1 -1
  6. package/dist/core/execution/dags.d.ts +9 -1
  7. package/dist/core/execution/dags.d.ts.map +1 -1
  8. package/dist/core/execution/dags.js +19 -4
  9. package/dist/core/execution/dags.js.map +1 -1
  10. package/dist/core/execution/inference.d.ts +18 -14
  11. package/dist/core/execution/inference.d.ts.map +1 -1
  12. package/dist/core/execution/inference.js +2 -1
  13. package/dist/core/execution/inference.js.map +1 -1
  14. package/dist/core/providers/factory.d.ts +1 -0
  15. package/dist/core/providers/factory.d.ts.map +1 -1
  16. package/dist/core/providers/factory.js +5 -4
  17. package/dist/core/providers/factory.js.map +1 -1
  18. package/dist/core/providers/openrouter.d.ts +9 -2
  19. package/dist/core/providers/openrouter.d.ts.map +1 -1
  20. package/dist/core/providers/openrouter.js +62 -11
  21. package/dist/core/providers/openrouter.js.map +1 -1
  22. package/dist/core/tools/base.d.ts +14 -1
  23. package/dist/core/tools/base.d.ts.map +1 -1
  24. package/dist/core/tools/base.js.map +1 -1
  25. package/dist/core/tools/bash.js +1 -1
  26. package/dist/core/tools/bash.js.map +1 -1
  27. package/dist/core/tools/edit.d.ts +1 -1
  28. package/dist/core/tools/edit.js +1 -1
  29. package/dist/core/tools/edit.js.map +1 -1
  30. package/dist/core/tools/executor.d.ts +4 -1
  31. package/dist/core/tools/executor.d.ts.map +1 -1
  32. package/dist/core/tools/executor.js +8 -2
  33. package/dist/core/tools/executor.js.map +1 -1
  34. package/dist/core/tools/fetchPage.d.ts.map +1 -1
  35. package/dist/core/tools/fetchPage.js +20 -4
  36. package/dist/core/tools/fetchPage.js.map +1 -1
  37. package/dist/core/tools/glob.js +1 -1
  38. package/dist/core/tools/glob.js.map +1 -1
  39. package/dist/core/tools/grep.js +1 -1
  40. package/dist/core/tools/grep.js.map +1 -1
  41. package/dist/core/tools/llmExecute.d.ts +36 -28
  42. package/dist/core/tools/llmExecute.d.ts.map +1 -1
  43. package/dist/core/tools/llmExecute.js +12 -0
  44. package/dist/core/tools/llmExecute.js.map +1 -1
  45. package/dist/core/tools/readEmail.d.ts.map +1 -1
  46. package/dist/core/tools/readEmail.js +6 -9
  47. package/dist/core/tools/readEmail.js.map +1 -1
  48. package/dist/core/tools/readFile.js +1 -1
  49. package/dist/core/tools/readFile.js.map +1 -1
  50. package/dist/core/tools/sendEmail.d.ts +6 -6
  51. package/dist/core/tools/sendEmail.d.ts.map +1 -1
  52. package/dist/core/tools/sendEmail.js +12 -17
  53. package/dist/core/tools/sendEmail.js.map +1 -1
  54. package/dist/core/tools/writeFile.d.ts +2 -2
  55. package/dist/core/tools/writeFile.js +1 -1
  56. package/dist/core/tools/writeFile.js.map +1 -1
  57. package/dist/db/client.d.ts +1 -1
  58. package/dist/db/client.d.ts.map +1 -1
  59. package/dist/db/client.js +21 -86
  60. package/dist/db/client.js.map +1 -1
  61. package/dist/index.d.ts +3 -3
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +46 -33
  64. package/dist/index.js.map +1 -1
  65. package/dist/services/agentsSeedData.js +1 -1
  66. package/dist/services/agentsSeedData.js.map +1 -1
  67. package/dist/services/initDB.d.ts +6 -0
  68. package/dist/services/initDB.d.ts.map +1 -1
  69. package/dist/services/initDB.js +2 -2
  70. package/dist/services/initDB.js.map +1 -1
  71. package/dist/types/config.d.ts +35 -7
  72. package/dist/types/config.d.ts.map +1 -1
  73. package/dist/types/config.js +66 -7
  74. package/dist/types/config.js.map +1 -1
  75. package/dist/types/dag.d.ts +24 -24
  76. package/dist/types/dag.js +6 -6
  77. package/dist/types/dag.js.map +1 -1
  78. package/dist/util/logger.d.ts +1 -8
  79. package/dist/util/logger.d.ts.map +1 -1
  80. package/dist/util/logger.js +11 -60
  81. package/dist/util/logger.js.map +1 -1
  82. package/dist/util/sendEmailTool.d.ts +6 -6
  83. package/dist/util/sendEmailTool.d.ts.map +1 -1
  84. package/dist/util/sendEmailTool.js +8 -0
  85. package/dist/util/sendEmailTool.js.map +1 -1
  86. package/package.json +1 -1
package/README.md CHANGED
@@ -1,278 +1,346 @@
1
1
  # desiAgent
2
2
 
3
- A library-first async agent system for building autonomous workflows with TypeScript.
3
+ A library-first async agent system for building autonomous workflows with TypeScript. Give it a goal in plain English and it decomposes it into a DAG of tasks, executes them with built-in tools, and streams results back — all in a few lines of code.
4
4
 
5
5
  ## Features
6
6
 
7
- - **Multiple LLM Providers**: OpenAI, OpenRouter, and Ollama support
8
- - **Autonomous Execution**: Let agents execute objectives autonomously
9
- - **DAG Workflows**: Decompose complex objectives into directed acyclic graphs
10
- - **Built-in Tools**: Web scraping, file operations, bash commands, and more
11
- - **Event Streaming**: Track execution progress in real-time
12
- - **SQLite Storage**: Persistent storage using bun:sqlite
7
+ - **Goal DAG Execution** — Describe what you want; desiAgent plans a directed acyclic graph (DAG) of sub-tasks and executes them autonomously.
8
+ - **Multiple LLM Providers** OpenAI, OpenRouter, and Ollama (local) out of the box.
9
+ - **Built-in Tools** Web scraping, file I/O, bash commands, email (SMTP/IMAP), PDF parsing, and more.
10
+ - **Event Streaming** `for await` over execution events to track progress in real-time.
11
+ - **Clarification Flow** If the goal is ambiguous the agent asks for clarification before proceeding.
12
+ - **In-Memory or Persistent Storage** Use `:memory:` for quick experiments or a SQLite file for production.
13
+ - **Cron Scheduling** — Schedule DAGs to run on a cron expression with timezone support.
14
+ - **Artifacts** — Tools can write output files (reports, code, images) that are automatically stored and retrievable.
15
+ - **Cost Tracking** — Token usage and USD cost are recorded per execution step.
16
+ - **Experiments API** — Compare models and temperatures on the same goal in one call.
13
17
 
14
18
  ## Installation
15
19
 
16
20
  ### Prerequisites
17
21
 
18
- - [Bun](https://bun.sh) 1.3.5 or higher
22
+ - [Bun](https://bun.sh) 1.3.5
19
23
 
20
24
  ### Install
21
25
 
22
26
  ```bash
23
- bun add desiagent
27
+ bun add @ugm/desiagent
24
28
  ```
25
29
 
26
- Or with npm/pnpm:
30
+ Or with npm / pnpm:
27
31
 
28
32
  ```bash
29
- npm install desiagent
33
+ npm install @ugm/desiagent
30
34
  # or
31
- pnpm add desiagent
35
+ pnpm add @ugm/desiagent
32
36
  ```
33
37
 
34
- ## Environment Variables
38
+ ### Environment Variables
35
39
 
36
- Create a `.env` file in your project root with the appropriate API keys for your chosen provider:
37
-
38
- ### OpenAI
40
+ Create a `.env` file with your provider's API key:
39
41
 
40
42
  ```bash
41
- OPENAI_API_KEY=sk-...
42
- ```
43
+ # OpenRouter (recommended — access to many models via one key)
44
+ OPENROUTER_API_KEY=sk-or-...
43
45
 
44
- ### OpenRouter
46
+ # OpenAI
47
+ OPENAI_API_KEY=sk-...
45
48
 
46
- ```bash
47
- OPENROUTER_API_KEY=sk-or-...
49
+ # Ollama (local, no key needed)
50
+ OLLAMA_BASE_URL=http://localhost:11434 # optional, this is the default
48
51
  ```
49
52
 
50
- ### Ollama (Local)
53
+ ## Examples
51
54
 
52
- ```bash
53
- OLLAMA_BASE_URL=http://localhost:11434 # Optional, this is the default
54
- ```
55
+ > All examples below use OpenRouter and an in-memory database (`:memory:`) so you can run them without any local SQLite file.
55
56
 
56
- ## Quick Start
57
+ ### 1. Goal → Execute in One Call
57
58
 
58
- ### Basic Example (OpenAI)
59
+ The fastest way to go from idea to result. `createAndExecuteFromGoal` plans the DAG **and** executes it in a single call.
59
60
 
60
61
  ```typescript
61
- import { setupDesiAgent } from 'desiagent';
62
+ import { setupDesiAgent } from '@ugm/desiagent';
62
63
 
63
64
  const client = await setupDesiAgent({
64
- llmProvider: 'openai',
65
- openaiApiKey: process.env.OPENAI_API_KEY,
66
- modelName: 'gpt-4o',
65
+ llmProvider: 'openrouter',
66
+ openrouterApiKey: process.env.OPENROUTER_API_KEY,
67
+ modelName: 'google/gemini-2.5-flash-lite-preview-09-2025',
68
+ databasePath: ':memory:',
69
+ skipGenerationStats: true,
67
70
  });
68
71
 
69
- // Create and execute a DAG
70
- const execution = await client.dags.createAndExecute('Summarize the latest tech news');
71
- console.log(`Execution: ${execution.id}, Status: ${execution.status}`);
72
+ const result = await client.dags.createAndExecuteFromGoal({
73
+ goalText: 'Research the top 5 trends in AI agents for 2025 and write a concise briefing document to ai-trends.md',
74
+ agentName: 'DecomposerV8',
75
+ temperature: 0.7,
76
+ });
77
+
78
+ if (result.status === 'clarification_required') {
79
+ console.log('Agent needs more info:', result.clarificationQuery);
80
+ } else {
81
+ console.log('Execution started:', result.executionId);
82
+
83
+ // Stream events until completion
84
+ for await (const event of client.executions.streamEvents(result.executionId)) {
85
+ console.log(event.type, event.data);
86
+ }
87
+
88
+ // Retrieve final result
89
+ const details = await client.executions.getWithSubSteps(result.executionId);
90
+ console.log('Final result:\n', details.finalResult);
91
+ }
72
92
 
73
93
  await client.shutdown();
74
94
  ```
75
95
 
76
- ### Using OpenRouter
96
+ ### 2. Plan First, Execute Later
97
+
98
+ Separate planning from execution so you can inspect or modify the DAG before running it.
77
99
 
78
100
  ```typescript
79
- import { setupDesiAgent } from 'desiagent';
101
+ import { setupDesiAgent } from '@ugm/desiagent';
80
102
 
81
103
  const client = await setupDesiAgent({
82
104
  llmProvider: 'openrouter',
83
105
  openrouterApiKey: process.env.OPENROUTER_API_KEY,
84
- modelName: 'google/gemini-2.5-flash-lite-preview-06-2025',
106
+ modelName: 'google/gemini-2.5-flash-lite-preview-09-2025',
107
+ databasePath: ':memory:',
108
+ skipGenerationStats: true,
109
+ });
110
+
111
+ // Step 1 — Plan
112
+ const plan = await client.dags.createFromGoal({
113
+ goalText: 'Create a tutorial on processing driftwood into handicrafts — cover cleaning, tools, finishes — and write it to driftwood.md',
114
+ agentName: 'DecomposerV8',
115
+ temperature: 0.7,
85
116
  });
86
117
 
87
- const execution = await client.dags.createAndExecute('Research best practices for API design');
118
+ if (plan.status !== 'success') {
119
+ console.log('Planning issue:', plan.status);
120
+ await client.shutdown();
121
+ process.exit(1);
122
+ }
123
+
124
+ console.log('DAG created:', plan.dagId);
125
+
126
+ // Step 2 — Execute
127
+ const execution = await client.dags.execute(plan.dagId);
128
+ console.log('Execution ID:', execution.id);
129
+
130
+ for await (const event of client.executions.streamEvents(execution.id)) {
131
+ console.log(event.type, event.data);
132
+ }
133
+
134
+ const details = await client.executions.getWithSubSteps(execution.id);
135
+ console.log('Final result:\n', details.finalResult);
136
+
88
137
  await client.shutdown();
89
138
  ```
90
139
 
91
- ### Using Ollama (Local LLM)
140
+ ### 3. List Agents and Tools
141
+
142
+ Explore what's available in the system.
92
143
 
93
144
  ```typescript
94
- import { setupDesiAgent } from 'desiagent';
145
+ import { setupDesiAgent } from '@ugm/desiagent';
95
146
 
96
147
  const client = await setupDesiAgent({
97
- llmProvider: 'ollama',
98
- ollamaBaseUrl: process.env.OLLAMA_BASE_URL || 'http://localhost:11434',
99
- modelName: 'llama3.2',
148
+ llmProvider: 'openrouter',
149
+ openrouterApiKey: process.env.OPENROUTER_API_KEY,
150
+ modelName: 'openai/gpt-4o',
151
+ databasePath: ':memory:',
152
+ skipGenerationStats: true,
153
+ logLevel: 'warn',
100
154
  });
101
155
 
102
- const execution = await client.dags.createAndExecute('Explain quantum computing in simple terms');
156
+ // List seeded agents
157
+ const agents = await client.agents.list();
158
+ for (const a of agents) {
159
+ console.log(`${a.name} (${a.provider}/${a.model}) — ${a.description}`);
160
+ }
161
+
162
+ // List available tools
163
+ const tools = await client.tools.list();
164
+ for (const t of tools) {
165
+ console.log(t.function.name);
166
+ }
167
+
103
168
  await client.shutdown();
104
169
  ```
105
170
 
106
- ## Configuration Options
171
+ ### 4. Handle Clarifications
107
172
 
108
- ```typescript
109
- interface DesiAgentConfig {
110
- // LLM Provider (required)
111
- llmProvider: 'openai' | 'openrouter' | 'ollama';
112
- modelName: string;
173
+ When the agent decides the goal is ambiguous, it returns a clarification query instead of creating a DAG.
113
174
 
114
- // Provider-specific API keys
115
- openaiApiKey?: string; // Required for 'openai' provider
116
- openrouterApiKey?: string; // Required for 'openrouter' provider
117
- ollamaBaseUrl?: string; // Optional for 'ollama', defaults to http://localhost:11434
175
+ ```typescript
176
+ import { setupDesiAgent } from '@ugm/desiagent';
118
177
 
119
- // Database (optional)
120
- databasePath?: string; // Default: ~/.desiAgent/data/agent.db
178
+ const client = await setupDesiAgent({
179
+ llmProvider: 'openrouter',
180
+ openrouterApiKey: process.env.OPENROUTER_API_KEY,
181
+ modelName: 'google/gemini-2.5-flash-lite-preview-09-2025',
182
+ databasePath: ':memory:',
183
+ skipGenerationStats: true,
184
+ });
121
185
 
122
- // Agent definitions (optional)
123
- agentDefinitionsPath?: string; // Default: ~/.desiAgent/agents
186
+ const plan = await client.dags.createFromGoal({
187
+ goalText: 'Build the app',
188
+ agentName: 'DecomposerV8',
189
+ });
124
190
 
125
- // Logging (optional)
126
- logLevel?: 'debug' | 'info' | 'warn' | 'error'; // Default: 'info'
191
+ if (plan.status === 'clarification_required') {
192
+ console.log('Agent asks:', plan.clarificationQuery);
127
193
 
128
- // Callbacks (optional)
129
- onExecutionStart?: (executionId: string) => void;
130
- onExecutionEnd?: (executionId: string, result: any) => void;
194
+ // Provide the answer and retry
195
+ const resumed = await client.dags.resumeFromClarification(
196
+ plan.dagId,
197
+ 'A Pomodoro timer web app using HTML, CSS, and vanilla JS',
198
+ );
199
+ console.log('Resumed status:', resumed.status);
131
200
  }
201
+
202
+ await client.shutdown();
132
203
  ```
133
204
 
134
- ## API Reference
205
+ ### 5. Custom Inference (No DAG)
135
206
 
136
- ### Agents
207
+ Use a named agent directly for a single LLM call — useful for summarisation, translation, or any one-shot task.
137
208
 
138
209
  ```typescript
139
- // Create a new agent
140
- const agent = await client.agents.create(name, version, prompt, params?);
141
-
142
- // List all agents
143
- const agents = await client.agents.list(filter?);
144
-
145
- // Get a specific agent
146
- const agent = await client.agents.get(id);
210
+ import { setupDesiAgent } from '@ugm/desiagent';
147
211
 
148
- // Update an agent
149
- await client.agents.update(id, updates);
212
+ const client = await setupDesiAgent({
213
+ llmProvider: 'openrouter',
214
+ openrouterApiKey: process.env.OPENROUTER_API_KEY,
215
+ modelName: 'openai/gpt-4o',
216
+ databasePath: ':memory:',
217
+ skipGenerationStats: true,
218
+ });
150
219
 
151
- // Activate/Delete an agent
152
- await client.agents.activate(id);
153
- await client.agents.delete(id);
220
+ // Resolve an agent by name and call it directly
221
+ const agent = await client.agents.resolve('Summarizer');
222
+ // ... or use the lower-level inference API in scripts/infer.ts
154
223
 
155
- // Resolve agent by name
156
- const agent = await client.agents.resolve(name);
224
+ await client.shutdown();
157
225
  ```
158
226
 
159
- ### DAGs (Directed Acyclic Graphs)
227
+ ### Running the Bundled Examples
160
228
 
161
- ```typescript
162
- // Create a DAG from an objective
163
- const dag = await client.dags.create(objective, params?);
164
-
165
- // Create and immediately execute
166
- const execution = await client.dags.createAndExecute(objective, params?);
229
+ The [`examples/`](./examples/) directory contains runnable scripts:
167
230
 
168
- // Execute an existing DAG
169
- const execution = await client.dags.execute(dagId, params?);
231
+ ```bash
232
+ # Execute a goal from a file
233
+ bun run examples/execute-goal.ts -f examples/goals/pomodoro-timer.txt
170
234
 
171
- // List DAGs
172
- const dags = await client.dags.list(filter?);
173
- const scheduled = await client.dags.listScheduled();
235
+ # In-memory database smoke test
236
+ bun run examples/init_6_memory_db.ts
174
237
 
175
- // Get/Update/Delete
176
- const dag = await client.dags.get(id);
177
- await client.dags.update(id, updates);
178
- await client.dags.delete(id);
238
+ # List all agents
239
+ bun run examples/list-agents.ts
179
240
 
180
- // Resume a paused execution
181
- await client.dags.resume(executionId);
241
+ # List all tools
242
+ bun run examples/list-tools.ts --names
182
243
  ```
183
244
 
184
- ### Executions
245
+ ## Configuration Reference
185
246
 
186
247
  ```typescript
187
- // List executions
188
- const executions = await client.executions.list(filter?);
248
+ interface DesiAgentConfig {
249
+ llmProvider: 'openai' | 'openrouter' | 'ollama';
250
+ modelName: string;
189
251
 
190
- // Get execution details
191
- const execution = await client.executions.get(id);
192
- const subSteps = await client.executions.getSubSteps(id);
252
+ // Provider keys
253
+ openaiApiKey?: string;
254
+ openrouterApiKey?: string;
255
+ ollamaBaseUrl?: string; // default: http://localhost:11434
193
256
 
194
- // Delete an execution
195
- await client.executions.delete(id);
257
+ // Storage
258
+ databasePath?: string; // default: ~/.desiAgent/data/agent.db
259
+ // use ':memory:' for ephemeral experiments
260
+ artifactsDir?: string; // default: sibling of database file
196
261
 
197
- // Stream execution events (AsyncIterable)
198
- for await (const event of client.executions.streamEvents(id)) {
199
- console.log(event.type, event.data);
200
- }
201
- ```
262
+ // Agent definitions
263
+ agentDefinitionsPath?: string; // default: ~/.desiAgent/agents
202
264
 
203
- ## CLI
265
+ // Logging
266
+ logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
204
267
 
205
- The `desi` CLI ships with the standalone `desiCLI` package. Command groups support default subcommands for convenience:
268
+ // Lifecycle hooks
269
+ onExecutionStart?: (executionId: string) => void;
270
+ onExecutionEnd?: (executionId: string, result: Record<string, any>) => void;
206
271
 
207
- ```bash
208
- # Artifacts
209
- desi artifacts # Same as: desi artifacts list
210
- desi artifacts report.json # Same as: desi artifacts get report.json
272
+ // Feature flags
273
+ autoStartScheduler?: boolean; // default: true
274
+ enableToolValidation?: boolean; // default: true
275
+ }
276
+ ```
211
277
 
212
- # Agents
213
- desi agents # Same as: desi agents list
278
+ ## Contributing
214
279
 
215
- # Results
216
- desi results exec_123 # Same as: desi results view exec_123
217
- ```
280
+ We welcome contributions of all kinds — bug fixes, new tools, documentation improvements, and feature ideas.
218
281
 
219
- ## Examples
282
+ ### Getting Started
220
283
 
221
- ### News Bulletin Generator
284
+ 1. **Fork & clone** the repository.
222
285
 
223
- See [`examples/news-bulletin.ts`](./examples/news-bulletin.ts) for a complete example that creates a news bulletin with multiple categories.
286
+ ```bash
287
+ git clone https://github.com/<your-username>/desiAgent.git
288
+ cd desiAgent
289
+ ```
224
290
 
225
- ```bash
226
- # Run with Ollama
227
- bun run examples/news-bulletin.ts
291
+ 2. **Install dependencies** (requires Bun ≥ 1.3.5).
228
292
 
229
- # Run with OpenRouter
230
- OPENROUTER_API_KEY=your-key bun run examples/news-bulletin-openrouter.ts
231
- ```
293
+ ```bash
294
+ bun install
295
+ ```
232
296
 
233
- ## Manual Abort Tests
297
+ 3. **Create a branch** for your change.
234
298
 
235
- Use these scripts to manually verify that abort signals cancel in-flight LLM calls.
299
+ ```bash
300
+ git checkout -b feat/my-awesome-feature
301
+ ```
236
302
 
237
- ```bash
238
- # OpenRouter abort test
239
- OPENROUTER_API_KEY=sk-or-... ABORT_AFTER_MS=2000 bun run test:abort:openrouter
303
+ 4. **Make your changes**, then verify:
240
304
 
241
- # Ollama abort test
242
- OLLAMA_BASE_URL=http://localhost:11434 OLLAMA_MODEL=mistral ABORT_AFTER_MS=2000 bun run test:abort:ollama
243
- ```
305
+ ```bash
306
+ bun run type-check # TypeScript must compile cleanly
307
+ bun test # All tests must pass
308
+ ```
244
309
 
245
- ## Development
310
+ ### Code Guidelines
246
311
 
247
- ### Setup
312
+ - **TypeScript only** — no plain JS files.
313
+ - **Follow existing patterns** — look at neighbouring files before writing new code. Match naming conventions, imports, and error handling style.
314
+ - **Keep PRs focused** — one logical change per pull request. Small, reviewable diffs are merged faster.
315
+ - **Write tests** — if you add a feature or fix a bug, add or update a test in the corresponding `*.test.ts` file. Run `bun test` to verify.
316
+ - **No secrets** — never commit API keys, tokens, or credentials. Use environment variables and `.env` files (already in `.gitignore`).
248
317
 
249
- ```bash
250
- # Install dependencies
251
- pnpm install
318
+ ### Commit Messages
252
319
 
253
- # Run in development mode
254
- bun run dev
320
+ Follow the [Conventional Commits](https://www.conventionalcommits.org/) format:
321
+
322
+ ```
323
+ feat: add PDF attachment support to inference
324
+ fix: handle empty goal text in DAG creation
325
+ docs: update README examples
326
+ chore: bump drizzle-orm to 0.46
255
327
  ```
256
328
 
257
- ### Commands
329
+ ### Pull Request Process
258
330
 
259
- ```bash
260
- # Build
261
- pnpm build
331
+ 1. Ensure your branch is up to date with `main`.
332
+ 2. Open a PR against `main` with a clear title and description of **what** and **why**.
333
+ 3. Link any related issues (e.g., `Closes #42`).
334
+ 4. A maintainer will review your PR. Address feedback promptly — we aim to merge within a few days.
262
335
 
263
- # Type check
264
- pnpm type-check
336
+ ### Reporting Issues
265
337
 
266
- # Run tests
267
- pnpm test
268
- pnpm test:watch
269
- pnpm test:coverage
338
+ - Use [GitHub Issues](https://github.com/ugmurthy/desiAgent/issues) to report bugs or request features.
339
+ - Include steps to reproduce, expected vs. actual behaviour, and your environment (OS, Bun version, provider used).
270
340
 
271
- # Database commands
272
- pnpm db:generate
273
- pnpm db:push
274
- pnpm db:studio
275
- ```
341
+ ### Code of Conduct
342
+
343
+ Be respectful and constructive. We follow the [Contributor Covenant](https://www.contributor-covenant.org/) code of conduct.
276
344
 
277
345
  ## License
278
346
 
@@ -45,7 +45,10 @@ export interface DAGExecutorConfig {
45
45
  db: DrizzleDB;
46
46
  llmProvider: LLMProvider;
47
47
  toolRegistry: ToolRegistry;
48
- artifactsDir?: string;
48
+ artifactsDir: string;
49
+ apiKey?: string;
50
+ ollamaBaseUrl?: string;
51
+ skipGenerationStats?: boolean;
49
52
  }
50
53
  /**
51
54
  * Execution configuration for performance tuning
@@ -85,6 +88,9 @@ export declare class DAGExecutor {
85
88
  private llmProvider;
86
89
  private toolRegistry;
87
90
  private artifactsDir;
91
+ private apiKey?;
92
+ private ollamaBaseUrl?;
93
+ private skipGenerationStats?;
88
94
  private logger;
89
95
  constructor(config: DAGExecutorConfig);
90
96
  private extractUrls;
@@ -1 +1 @@
1
- {"version":3,"file":"dagExecutor.d.ts","sourceRoot":"","sources":["../../../src/core/execution/dagExecutor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE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AAS;IAC/B,OAAO,CAAC,mBAAmB,CAAC,CAAU;IACtC,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,EAAE,iBAAiB;IAcrC,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,oBAAoB;IAkC5B,OAAO,CAAC,mBAAmB;IAe3B,OAAO,CAAC,qBAAqB;IA6B7B,OAAO,CAAC,mBAAmB;IA+B3B,OAAO,CAAC,uBAAuB;IAqB/B,OAAO,CAAC,gBAAgB;IA0BxB,OAAO,CAAC,yBAAyB;IA0BjC;;;OAGG;YACW,cAAc;IAsC5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAMpB,OAAO,CACX,GAAG,EAAE,aAAa,EAClB,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,MAAM,EACxB,MAAM,GAAE,eAAoB,GAC3B,OAAO,CAAC,MAAM,CAAC;YA2aJ,gBAAgB;IAuB9B,OAAO,CAAC,qBAAqB;YA6Bf,UAAU;YAmEV,QAAQ;IAKtB,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,aAAa;CAatB"}
@@ -19,12 +19,18 @@ export class DAGExecutor {
19
19
  llmProvider;
20
20
  toolRegistry;
21
21
  artifactsDir;
22
+ apiKey;
23
+ ollamaBaseUrl;
24
+ skipGenerationStats;
22
25
  logger = getLogger();
23
26
  constructor(config) {
24
27
  this.db = config.db;
25
28
  this.llmProvider = config.llmProvider;
26
29
  this.toolRegistry = config.toolRegistry;
27
- this.artifactsDir = config.artifactsDir || process.env.ARTIFACTS_DIR || './artifacts';
30
+ this.artifactsDir = config.artifactsDir;
31
+ this.apiKey = config.apiKey;
32
+ this.ollamaBaseUrl = config.ollamaBaseUrl;
33
+ this.skipGenerationStats = config.skipGenerationStats;
28
34
  this.logger.debug({
29
35
  provider: this.llmProvider.name,
30
36
  }, 'DAGExecutor created');
@@ -342,7 +348,7 @@ Respond with ONLY the expected output format. Build upon dependencies for cohere
342
348
  if (!agent) {
343
349
  throw new Error(`No agent found with name: ${agentName} (not in pre-fetch cache)`);
344
350
  }
345
- const llmExecuteTool = new LlmExecuteTool();
351
+ const llmExecuteTool = new LlmExecuteTool({ apiKey: this.apiKey, baseUrl: this.ollamaBaseUrl, skipGenerationStats: this.skipGenerationStats });
346
352
  const result = await llmExecuteTool.execute({
347
353
  provider: agent.provider,
348
354
  model: agent.model,