@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.
- package/README.md +229 -161
- package/dist/core/execution/dagExecutor.d.ts +7 -1
- package/dist/core/execution/dagExecutor.d.ts.map +1 -1
- package/dist/core/execution/dagExecutor.js +8 -2
- package/dist/core/execution/dagExecutor.js.map +1 -1
- package/dist/core/execution/dags.d.ts +9 -1
- package/dist/core/execution/dags.d.ts.map +1 -1
- package/dist/core/execution/dags.js +19 -4
- package/dist/core/execution/dags.js.map +1 -1
- package/dist/core/execution/inference.d.ts +18 -14
- package/dist/core/execution/inference.d.ts.map +1 -1
- package/dist/core/execution/inference.js +2 -1
- package/dist/core/execution/inference.js.map +1 -1
- package/dist/core/providers/factory.d.ts +1 -0
- package/dist/core/providers/factory.d.ts.map +1 -1
- package/dist/core/providers/factory.js +5 -4
- package/dist/core/providers/factory.js.map +1 -1
- package/dist/core/providers/openrouter.d.ts +9 -2
- package/dist/core/providers/openrouter.d.ts.map +1 -1
- package/dist/core/providers/openrouter.js +62 -11
- package/dist/core/providers/openrouter.js.map +1 -1
- package/dist/core/tools/base.d.ts +14 -1
- package/dist/core/tools/base.d.ts.map +1 -1
- package/dist/core/tools/base.js.map +1 -1
- package/dist/core/tools/bash.js +1 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +1 -1
- package/dist/core/tools/edit.js +1 -1
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/executor.d.ts +4 -1
- package/dist/core/tools/executor.d.ts.map +1 -1
- package/dist/core/tools/executor.js +8 -2
- package/dist/core/tools/executor.js.map +1 -1
- package/dist/core/tools/fetchPage.d.ts.map +1 -1
- package/dist/core/tools/fetchPage.js +20 -4
- package/dist/core/tools/fetchPage.js.map +1 -1
- package/dist/core/tools/glob.js +1 -1
- package/dist/core/tools/glob.js.map +1 -1
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/llmExecute.d.ts +36 -28
- package/dist/core/tools/llmExecute.d.ts.map +1 -1
- package/dist/core/tools/llmExecute.js +12 -0
- package/dist/core/tools/llmExecute.js.map +1 -1
- package/dist/core/tools/readEmail.d.ts.map +1 -1
- package/dist/core/tools/readEmail.js +6 -9
- package/dist/core/tools/readEmail.js.map +1 -1
- package/dist/core/tools/readFile.js +1 -1
- package/dist/core/tools/readFile.js.map +1 -1
- package/dist/core/tools/sendEmail.d.ts +6 -6
- package/dist/core/tools/sendEmail.d.ts.map +1 -1
- package/dist/core/tools/sendEmail.js +12 -17
- package/dist/core/tools/sendEmail.js.map +1 -1
- package/dist/core/tools/writeFile.d.ts +2 -2
- package/dist/core/tools/writeFile.js +1 -1
- package/dist/core/tools/writeFile.js.map +1 -1
- package/dist/db/client.d.ts +1 -1
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +21 -86
- package/dist/db/client.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -33
- package/dist/index.js.map +1 -1
- package/dist/services/agentsSeedData.js +1 -1
- package/dist/services/agentsSeedData.js.map +1 -1
- package/dist/services/initDB.d.ts +6 -0
- package/dist/services/initDB.d.ts.map +1 -1
- package/dist/services/initDB.js +2 -2
- package/dist/services/initDB.js.map +1 -1
- package/dist/types/config.d.ts +35 -7
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +66 -7
- package/dist/types/config.js.map +1 -1
- package/dist/types/dag.d.ts +24 -24
- package/dist/types/dag.js +6 -6
- package/dist/types/dag.js.map +1 -1
- package/dist/util/logger.d.ts +1 -8
- package/dist/util/logger.d.ts.map +1 -1
- package/dist/util/logger.js +11 -60
- package/dist/util/logger.js.map +1 -1
- package/dist/util/sendEmailTool.d.ts +6 -6
- package/dist/util/sendEmailTool.d.ts.map +1 -1
- package/dist/util/sendEmailTool.js +8 -0
- package/dist/util/sendEmailTool.js.map +1 -1
- 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
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
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
|
|
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
|
-
|
|
38
|
+
### Environment Variables
|
|
35
39
|
|
|
36
|
-
Create a `.env` file
|
|
37
|
-
|
|
38
|
-
### OpenAI
|
|
40
|
+
Create a `.env` file with your provider's API key:
|
|
39
41
|
|
|
40
42
|
```bash
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
# OpenRouter (recommended — access to many models via one key)
|
|
44
|
+
OPENROUTER_API_KEY=sk-or-...
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
# OpenAI
|
|
47
|
+
OPENAI_API_KEY=sk-...
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
# Ollama (local, no key needed)
|
|
50
|
+
OLLAMA_BASE_URL=http://localhost:11434 # optional, this is the default
|
|
48
51
|
```
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
## Examples
|
|
51
54
|
|
|
52
|
-
|
|
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
|
-
|
|
57
|
+
### 1. Goal → Execute in One Call
|
|
57
58
|
|
|
58
|
-
|
|
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: '
|
|
65
|
-
|
|
66
|
-
modelName: '
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
###
|
|
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-
|
|
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
|
-
|
|
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
|
-
###
|
|
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: '
|
|
98
|
-
|
|
99
|
-
modelName: '
|
|
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
|
-
|
|
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
|
-
|
|
171
|
+
### 4. Handle Clarifications
|
|
107
172
|
|
|
108
|
-
|
|
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
|
-
|
|
115
|
-
|
|
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
|
-
|
|
120
|
-
|
|
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
|
-
|
|
123
|
-
|
|
186
|
+
const plan = await client.dags.createFromGoal({
|
|
187
|
+
goalText: 'Build the app',
|
|
188
|
+
agentName: 'DecomposerV8',
|
|
189
|
+
});
|
|
124
190
|
|
|
125
|
-
|
|
126
|
-
|
|
191
|
+
if (plan.status === 'clarification_required') {
|
|
192
|
+
console.log('Agent asks:', plan.clarificationQuery);
|
|
127
193
|
|
|
128
|
-
//
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
205
|
+
### 5. Custom Inference (No DAG)
|
|
135
206
|
|
|
136
|
-
|
|
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
|
-
|
|
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
|
-
|
|
149
|
-
|
|
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
|
-
//
|
|
152
|
-
await client.agents.
|
|
153
|
-
|
|
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
|
-
|
|
156
|
-
const agent = await client.agents.resolve(name);
|
|
224
|
+
await client.shutdown();
|
|
157
225
|
```
|
|
158
226
|
|
|
159
|
-
###
|
|
227
|
+
### Running the Bundled Examples
|
|
160
228
|
|
|
161
|
-
|
|
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
|
-
|
|
169
|
-
|
|
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
|
-
|
|
172
|
-
|
|
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
|
-
|
|
176
|
-
|
|
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
|
-
|
|
181
|
-
|
|
241
|
+
# List all tools
|
|
242
|
+
bun run examples/list-tools.ts --names
|
|
182
243
|
```
|
|
183
244
|
|
|
184
|
-
|
|
245
|
+
## Configuration Reference
|
|
185
246
|
|
|
186
247
|
```typescript
|
|
187
|
-
|
|
188
|
-
|
|
248
|
+
interface DesiAgentConfig {
|
|
249
|
+
llmProvider: 'openai' | 'openrouter' | 'ollama';
|
|
250
|
+
modelName: string;
|
|
189
251
|
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
|
|
252
|
+
// Provider keys
|
|
253
|
+
openaiApiKey?: string;
|
|
254
|
+
openrouterApiKey?: string;
|
|
255
|
+
ollamaBaseUrl?: string; // default: http://localhost:11434
|
|
193
256
|
|
|
194
|
-
//
|
|
195
|
-
|
|
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
|
-
//
|
|
198
|
-
|
|
199
|
-
console.log(event.type, event.data);
|
|
200
|
-
}
|
|
201
|
-
```
|
|
262
|
+
// Agent definitions
|
|
263
|
+
agentDefinitionsPath?: string; // default: ~/.desiAgent/agents
|
|
202
264
|
|
|
203
|
-
|
|
265
|
+
// Logging
|
|
266
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
204
267
|
|
|
205
|
-
|
|
268
|
+
// Lifecycle hooks
|
|
269
|
+
onExecutionStart?: (executionId: string) => void;
|
|
270
|
+
onExecutionEnd?: (executionId: string, result: Record<string, any>) => void;
|
|
206
271
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
272
|
+
// Feature flags
|
|
273
|
+
autoStartScheduler?: boolean; // default: true
|
|
274
|
+
enableToolValidation?: boolean; // default: true
|
|
275
|
+
}
|
|
276
|
+
```
|
|
211
277
|
|
|
212
|
-
|
|
213
|
-
desi agents # Same as: desi agents list
|
|
278
|
+
## Contributing
|
|
214
279
|
|
|
215
|
-
|
|
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
|
-
|
|
282
|
+
### Getting Started
|
|
220
283
|
|
|
221
|
-
|
|
284
|
+
1. **Fork & clone** the repository.
|
|
222
285
|
|
|
223
|
-
|
|
286
|
+
```bash
|
|
287
|
+
git clone https://github.com/<your-username>/desiAgent.git
|
|
288
|
+
cd desiAgent
|
|
289
|
+
```
|
|
224
290
|
|
|
225
|
-
|
|
226
|
-
# Run with Ollama
|
|
227
|
-
bun run examples/news-bulletin.ts
|
|
291
|
+
2. **Install dependencies** (requires Bun ≥ 1.3.5).
|
|
228
292
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
```
|
|
293
|
+
```bash
|
|
294
|
+
bun install
|
|
295
|
+
```
|
|
232
296
|
|
|
233
|
-
|
|
297
|
+
3. **Create a branch** for your change.
|
|
234
298
|
|
|
235
|
-
|
|
299
|
+
```bash
|
|
300
|
+
git checkout -b feat/my-awesome-feature
|
|
301
|
+
```
|
|
236
302
|
|
|
237
|
-
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
305
|
+
```bash
|
|
306
|
+
bun run type-check # TypeScript must compile cleanly
|
|
307
|
+
bun test # All tests must pass
|
|
308
|
+
```
|
|
244
309
|
|
|
245
|
-
|
|
310
|
+
### Code Guidelines
|
|
246
311
|
|
|
247
|
-
|
|
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
|
-
|
|
250
|
-
# Install dependencies
|
|
251
|
-
pnpm install
|
|
318
|
+
### Commit Messages
|
|
252
319
|
|
|
253
|
-
|
|
254
|
-
|
|
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
|
-
###
|
|
329
|
+
### Pull Request Process
|
|
258
330
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
|
|
264
|
-
pnpm type-check
|
|
336
|
+
### Reporting Issues
|
|
265
337
|
|
|
266
|
-
|
|
267
|
-
|
|
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
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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
|
|
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;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAQzD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,WAAW,CAAC;IAClC,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B,CAAC;IACF,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,CAAC;IACF,QAAQ,EAAE,KAAK,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC,CAAC;IACH,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,c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AC;CACvC;AAMD,qBAAa,WAAW;IACtB,OAAO,CAAC,EAAE,CAAY;IACtB,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,aAAa,CAAC,CAAS;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
|
|
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,
|