@ugm/desiagent 0.1.21
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 +251 -0
- package/dist/__tests__/test-utils.d.ts +24 -0
- package/dist/__tests__/test-utils.d.ts.map +1 -0
- package/dist/__tests__/test-utils.js +32 -0
- package/dist/__tests__/test-utils.js.map +1 -0
- package/dist/core/execution/agents.d.ts +60 -0
- package/dist/core/execution/agents.d.ts.map +1 -0
- package/dist/core/execution/agents.js +249 -0
- package/dist/core/execution/agents.js.map +1 -0
- package/dist/core/execution/artifacts.d.ts +27 -0
- package/dist/core/execution/artifacts.d.ts.map +1 -0
- package/dist/core/execution/artifacts.js +93 -0
- package/dist/core/execution/artifacts.js.map +1 -0
- package/dist/core/execution/costs.d.ts +160 -0
- package/dist/core/execution/costs.d.ts.map +1 -0
- package/dist/core/execution/costs.js +196 -0
- package/dist/core/execution/costs.js.map +1 -0
- package/dist/core/execution/dagExecutor.d.ts +112 -0
- package/dist/core/execution/dagExecutor.d.ts.map +1 -0
- package/dist/core/execution/dagExecutor.js +647 -0
- package/dist/core/execution/dagExecutor.js.map +1 -0
- package/dist/core/execution/dags.d.ts +167 -0
- package/dist/core/execution/dags.d.ts.map +1 -0
- package/dist/core/execution/dags.js +713 -0
- package/dist/core/execution/dags.js.map +1 -0
- package/dist/core/execution/executions.d.ts +158 -0
- package/dist/core/execution/executions.d.ts.map +1 -0
- package/dist/core/execution/executions.js +258 -0
- package/dist/core/execution/executions.js.map +1 -0
- package/dist/core/execution/goals.d.ts +62 -0
- package/dist/core/execution/goals.d.ts.map +1 -0
- package/dist/core/execution/goals.js +245 -0
- package/dist/core/execution/goals.js.map +1 -0
- package/dist/core/execution/runs.d.ts +65 -0
- package/dist/core/execution/runs.d.ts.map +1 -0
- package/dist/core/execution/runs.js +219 -0
- package/dist/core/execution/runs.js.map +1 -0
- package/dist/core/execution/tools.d.ts +24 -0
- package/dist/core/execution/tools.d.ts.map +1 -0
- package/dist/core/execution/tools.js +33 -0
- package/dist/core/execution/tools.js.map +1 -0
- package/dist/core/orchestration/index.d.ts +7 -0
- package/dist/core/orchestration/index.d.ts.map +1 -0
- package/dist/core/orchestration/index.js +7 -0
- package/dist/core/orchestration/index.js.map +1 -0
- package/dist/core/orchestration/orchestrator.d.ts +39 -0
- package/dist/core/orchestration/orchestrator.d.ts.map +1 -0
- package/dist/core/orchestration/orchestrator.js +141 -0
- package/dist/core/orchestration/orchestrator.js.map +1 -0
- package/dist/core/orchestration/planner.d.ts +63 -0
- package/dist/core/orchestration/planner.d.ts.map +1 -0
- package/dist/core/orchestration/planner.js +99 -0
- package/dist/core/orchestration/planner.js.map +1 -0
- package/dist/core/providers/factory.d.ts +25 -0
- package/dist/core/providers/factory.d.ts.map +1 -0
- package/dist/core/providers/factory.js +86 -0
- package/dist/core/providers/factory.js.map +1 -0
- package/dist/core/providers/index.d.ts +11 -0
- package/dist/core/providers/index.d.ts.map +1 -0
- package/dist/core/providers/index.js +10 -0
- package/dist/core/providers/index.js.map +1 -0
- package/dist/core/providers/ollama.d.ts +36 -0
- package/dist/core/providers/ollama.d.ts.map +1 -0
- package/dist/core/providers/ollama.js +123 -0
- package/dist/core/providers/ollama.js.map +1 -0
- package/dist/core/providers/openai.d.ts +33 -0
- package/dist/core/providers/openai.d.ts.map +1 -0
- package/dist/core/providers/openai.js +114 -0
- package/dist/core/providers/openai.js.map +1 -0
- package/dist/core/providers/openrouter.d.ts +38 -0
- package/dist/core/providers/openrouter.d.ts.map +1 -0
- package/dist/core/providers/openrouter.js +269 -0
- package/dist/core/providers/openrouter.js.map +1 -0
- package/dist/core/providers/types.d.ts +101 -0
- package/dist/core/providers/types.d.ts.map +1 -0
- package/dist/core/providers/types.js +7 -0
- package/dist/core/providers/types.js.map +1 -0
- package/dist/core/tools/base.d.ts +56 -0
- package/dist/core/tools/base.d.ts.map +1 -0
- package/dist/core/tools/base.js +60 -0
- package/dist/core/tools/base.js.map +1 -0
- package/dist/core/tools/bash.d.ts +50 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +179 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit.d.ts +39 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +67 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/executor.d.ts +33 -0
- package/dist/core/tools/executor.d.ts.map +1 -0
- package/dist/core/tools/executor.js +105 -0
- package/dist/core/tools/executor.js.map +1 -0
- package/dist/core/tools/fetchPage.d.ts +46 -0
- package/dist/core/tools/fetchPage.d.ts.map +1 -0
- package/dist/core/tools/fetchPage.js +87 -0
- package/dist/core/tools/fetchPage.js.map +1 -0
- package/dist/core/tools/fetchURLs.d.ts +39 -0
- package/dist/core/tools/fetchURLs.d.ts.map +1 -0
- package/dist/core/tools/fetchURLs.js +67 -0
- package/dist/core/tools/fetchURLs.js.map +1 -0
- package/dist/core/tools/glob.d.ts +36 -0
- package/dist/core/tools/glob.d.ts.map +1 -0
- package/dist/core/tools/glob.js +78 -0
- package/dist/core/tools/glob.js.map +1 -0
- package/dist/core/tools/grep.d.ts +51 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +152 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +22 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +22 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/llmExecute.d.ts +153 -0
- package/dist/core/tools/llmExecute.d.ts.map +1 -0
- package/dist/core/tools/llmExecute.js +105 -0
- package/dist/core/tools/llmExecute.js.map +1 -0
- package/dist/core/tools/readEmail.d.ts +68 -0
- package/dist/core/tools/readEmail.d.ts.map +1 -0
- package/dist/core/tools/readEmail.js +182 -0
- package/dist/core/tools/readEmail.js.map +1 -0
- package/dist/core/tools/readFile.d.ts +42 -0
- package/dist/core/tools/readFile.d.ts.map +1 -0
- package/dist/core/tools/readFile.js +79 -0
- package/dist/core/tools/readFile.js.map +1 -0
- package/dist/core/tools/registry.d.ts +53 -0
- package/dist/core/tools/registry.d.ts.map +1 -0
- package/dist/core/tools/registry.js +112 -0
- package/dist/core/tools/registry.js.map +1 -0
- package/dist/core/tools/sendEmail.d.ts +83 -0
- package/dist/core/tools/sendEmail.d.ts.map +1 -0
- package/dist/core/tools/sendEmail.js +132 -0
- package/dist/core/tools/sendEmail.js.map +1 -0
- package/dist/core/tools/sendWebhook.d.ts +48 -0
- package/dist/core/tools/sendWebhook.d.ts.map +1 -0
- package/dist/core/tools/sendWebhook.js +61 -0
- package/dist/core/tools/sendWebhook.js.map +1 -0
- package/dist/core/tools/webSearch.d.ts +34 -0
- package/dist/core/tools/webSearch.d.ts.map +1 -0
- package/dist/core/tools/webSearch.js +104 -0
- package/dist/core/tools/webSearch.js.map +1 -0
- package/dist/core/tools/writeFile.d.ts +49 -0
- package/dist/core/tools/writeFile.d.ts.map +1 -0
- package/dist/core/tools/writeFile.js +120 -0
- package/dist/core/tools/writeFile.js.map +1 -0
- package/dist/db/client.d.ts +22 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.js +178 -0
- package/dist/db/client.js.map +1 -0
- package/dist/db/schema.d.ts +1846 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +175 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/errors/index.d.ts +80 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +135 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +172 -0
- package/dist/index.js.map +1 -0
- package/dist/services/initDB.d.ts +17 -0
- package/dist/services/initDB.d.ts.map +1 -0
- package/dist/services/initDB.js +212 -0
- package/dist/services/initDB.js.map +1 -0
- package/dist/types/agent.d.ts +354 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +63 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/client.d.ts +309 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/client.js +2 -0
- package/dist/types/client.js.map +1 -0
- package/dist/types/config.d.ts +96 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +33 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/dag.d.ts +253 -0
- package/dist/types/dag.d.ts.map +1 -0
- package/dist/types/dag.js +46 -0
- package/dist/types/dag.js.map +1 -0
- package/dist/types/execution.d.ts +171 -0
- package/dist/types/execution.d.ts.map +1 -0
- package/dist/types/execution.js +41 -0
- package/dist/types/execution.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -0
- package/dist/util/cron-validator.d.ts +16 -0
- package/dist/util/cron-validator.d.ts.map +1 -0
- package/dist/util/cron-validator.js +31 -0
- package/dist/util/cron-validator.js.map +1 -0
- package/dist/util/dag-utils.d.ts +54 -0
- package/dist/util/dag-utils.d.ts.map +1 -0
- package/dist/util/dag-utils.js +167 -0
- package/dist/util/dag-utils.js.map +1 -0
- package/dist/util/logger.d.ts +21 -0
- package/dist/util/logger.d.ts.map +1 -0
- package/dist/util/logger.js +87 -0
- package/dist/util/logger.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BlB,CAAC;AAEF;;GA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tB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3F,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;;EAEvB,CAAC;AAEJ,eAAO,MAAM,sBAAsB;;;EASlC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;EAK9B,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { sqliteTable, sqliteView, text, integer, uniqueIndex } from 'drizzle-orm/sqlite-core';
|
|
2
|
+
import { relations } from 'drizzle-orm';
|
|
3
|
+
import { sql } from 'drizzle-orm';
|
|
4
|
+
/**
|
|
5
|
+
* Agents table - agent configurations
|
|
6
|
+
*/
|
|
7
|
+
export const agents = sqliteTable('agents', {
|
|
8
|
+
id: text('id').primaryKey(),
|
|
9
|
+
name: text('name').notNull(),
|
|
10
|
+
version: text('version').notNull(),
|
|
11
|
+
promptTemplate: text('prompt_template').notNull(),
|
|
12
|
+
provider: text('provider'),
|
|
13
|
+
model: text('model'),
|
|
14
|
+
active: integer('active', { mode: 'boolean' }).notNull().default(false),
|
|
15
|
+
metadata: text('metadata', { mode: 'json' }).$type(),
|
|
16
|
+
createdAt: integer('created_at', { mode: 'timestamp' })
|
|
17
|
+
.notNull()
|
|
18
|
+
.default(sql `(unixepoch())`),
|
|
19
|
+
updatedAt: integer('updated_at', { mode: 'timestamp' })
|
|
20
|
+
.notNull()
|
|
21
|
+
.default(sql `(unixepoch())`),
|
|
22
|
+
}, (table) => ({
|
|
23
|
+
uniqueNameVersion: uniqueIndex('idx_name_version').on(table.name, table.version),
|
|
24
|
+
uniqueActiveNameIdx: uniqueIndex('idx_active_agent')
|
|
25
|
+
.on(table.name)
|
|
26
|
+
.where(sql `${table.active} = 1`),
|
|
27
|
+
}));
|
|
28
|
+
/**
|
|
29
|
+
* DAGs table - directed acyclic graphs
|
|
30
|
+
*/
|
|
31
|
+
export const dags = sqliteTable('dags', {
|
|
32
|
+
id: text('id').primaryKey(),
|
|
33
|
+
status: text('status').notNull(),
|
|
34
|
+
result: text('result', { mode: 'json' }).$type(),
|
|
35
|
+
usage: text('usage', { mode: 'json' }).$type(),
|
|
36
|
+
generationStats: text('generation_stats', { mode: 'json' }).$type(),
|
|
37
|
+
attempts: integer('attempts').notNull().default(0),
|
|
38
|
+
params: text('params', { mode: 'json' }).$type(),
|
|
39
|
+
agentName: text('agent_name'),
|
|
40
|
+
dagTitle: text('dag_title'),
|
|
41
|
+
cronSchedule: text('cron_schedule'),
|
|
42
|
+
scheduleActive: integer('schedule_active', { mode: 'boolean' })
|
|
43
|
+
.notNull()
|
|
44
|
+
.default(sql `0`),
|
|
45
|
+
lastRunAt: integer('last_run_at', { mode: 'timestamp' }),
|
|
46
|
+
timezone: text('timezone').notNull().default('UTC'),
|
|
47
|
+
createdAt: integer('created_at', { mode: 'timestamp' })
|
|
48
|
+
.notNull()
|
|
49
|
+
.default(sql `(unixepoch())`),
|
|
50
|
+
updatedAt: integer('updated_at', { mode: 'timestamp' })
|
|
51
|
+
.notNull()
|
|
52
|
+
.default(sql `(unixepoch())`),
|
|
53
|
+
// Planning cost tracking (aggregate over ALL attempts + TitleMaster)
|
|
54
|
+
planningTotalUsage: text('planning_total_usage', { mode: 'json' }).$type(),
|
|
55
|
+
planningTotalCostUsd: text('planning_total_cost_usd'),
|
|
56
|
+
// Per-attempt details for debugging/audit (including failed attempts)
|
|
57
|
+
planningAttempts: text('planning_attempts', { mode: 'json' }).$type(),
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* DAG Executions table
|
|
61
|
+
*/
|
|
62
|
+
export const dagExecutions = sqliteTable('dag_executions', {
|
|
63
|
+
id: text('id').primaryKey(),
|
|
64
|
+
dagId: text('dag_id').references(() => dags.id, { onDelete: 'restrict' }),
|
|
65
|
+
originalRequest: text('original_request').notNull(),
|
|
66
|
+
primaryIntent: text('primary_intent').notNull(),
|
|
67
|
+
status: text('status', {
|
|
68
|
+
enum: ['pending', 'running', 'waiting', 'completed', 'failed', 'partial', 'suspended']
|
|
69
|
+
}).notNull().default('pending'),
|
|
70
|
+
startedAt: integer('started_at', { mode: 'timestamp' }),
|
|
71
|
+
completedAt: integer('completed_at', { mode: 'timestamp' }),
|
|
72
|
+
durationMs: integer('duration_ms'),
|
|
73
|
+
totalTasks: integer('total_tasks').notNull(),
|
|
74
|
+
completedTasks: integer('completed_tasks').notNull().default(0),
|
|
75
|
+
failedTasks: integer('failed_tasks').notNull().default(0),
|
|
76
|
+
waitingTasks: integer('waiting_tasks').notNull().default(0),
|
|
77
|
+
finalResult: text('final_result'),
|
|
78
|
+
synthesisResult: text('synthesis_result'),
|
|
79
|
+
// Suspension and retry tracking
|
|
80
|
+
suspendedReason: text('suspended_reason'),
|
|
81
|
+
suspendedAt: integer('suspended_at', { mode: 'timestamp' }),
|
|
82
|
+
retryCount: integer('retry_count').notNull().default(0),
|
|
83
|
+
lastRetryAt: integer('last_retry_at', { mode: 'timestamp' }),
|
|
84
|
+
// Execution cost tracking (aggregate of all sub-steps including synthesis)
|
|
85
|
+
totalUsage: text('total_usage', { mode: 'json' }).$type(),
|
|
86
|
+
totalCostUsd: text('total_cost_usd'),
|
|
87
|
+
createdAt: integer('created_at', { mode: 'timestamp' })
|
|
88
|
+
.notNull()
|
|
89
|
+
.default(sql `(unixepoch())`),
|
|
90
|
+
updatedAt: integer('updated_at', { mode: 'timestamp' })
|
|
91
|
+
.notNull()
|
|
92
|
+
.default(sql `(unixepoch())`),
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* DAG Sub-Steps table
|
|
96
|
+
*/
|
|
97
|
+
export const dagSubSteps = sqliteTable('sub_steps', {
|
|
98
|
+
id: text('id').primaryKey(),
|
|
99
|
+
executionId: text('execution_id')
|
|
100
|
+
.notNull()
|
|
101
|
+
.references(() => dagExecutions.id, { onDelete: 'cascade' }),
|
|
102
|
+
taskId: text('task_id').notNull(),
|
|
103
|
+
description: text('description').notNull(),
|
|
104
|
+
thought: text('thought').notNull(),
|
|
105
|
+
actionType: text('action_type', { enum: ['tool', 'inference'] }).notNull(),
|
|
106
|
+
toolOrPromptName: text('tool_or_prompt_name').notNull(),
|
|
107
|
+
toolOrPromptParams: text('tool_or_prompt_params', { mode: 'json' }).$type(),
|
|
108
|
+
dependencies: text('dependencies', { mode: 'json' }).notNull().$type(),
|
|
109
|
+
status: text('status', {
|
|
110
|
+
enum: ['pending', 'running', 'waiting', 'completed', 'failed']
|
|
111
|
+
}).notNull().default('pending'),
|
|
112
|
+
startedAt: integer('started_at', { mode: 'timestamp' }),
|
|
113
|
+
completedAt: integer('completed_at', { mode: 'timestamp' }),
|
|
114
|
+
durationMs: integer('duration_ms'),
|
|
115
|
+
result: text('result', { mode: 'json' }).$type(),
|
|
116
|
+
error: text('error'),
|
|
117
|
+
// Sub-step cost tracking
|
|
118
|
+
usage: text('usage', { mode: 'json' }).$type(),
|
|
119
|
+
costUsd: text('cost_usd'),
|
|
120
|
+
generationStats: text('generation_stats', { mode: 'json' }).$type(),
|
|
121
|
+
createdAt: integer('created_at', { mode: 'timestamp' })
|
|
122
|
+
.notNull()
|
|
123
|
+
.default(sql `(unixepoch())`),
|
|
124
|
+
updatedAt: integer('updated_at', { mode: 'timestamp' })
|
|
125
|
+
.notNull()
|
|
126
|
+
.default(sql `(unixepoch())`),
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* Executions view - joins dagExecutions with dags to get dagTitle
|
|
130
|
+
*/
|
|
131
|
+
export const executions = sqliteView('executions', {
|
|
132
|
+
dagTitle: text('dag_title'),
|
|
133
|
+
id: text('id'),
|
|
134
|
+
dagId: text('dag_id'),
|
|
135
|
+
originalRequest: text('original_request'),
|
|
136
|
+
primaryIntent: text('primary_intent'),
|
|
137
|
+
status: text('status'),
|
|
138
|
+
startedAt: integer('started_at', { mode: 'timestamp' }),
|
|
139
|
+
completedAt: integer('completed_at', { mode: 'timestamp' }),
|
|
140
|
+
durationMs: integer('duration_ms'),
|
|
141
|
+
totalTasks: integer('total_tasks'),
|
|
142
|
+
completedTasks: integer('completed_tasks'),
|
|
143
|
+
failedTasks: integer('failed_tasks'),
|
|
144
|
+
waitingTasks: integer('waiting_tasks'),
|
|
145
|
+
finalResult: text('final_result'),
|
|
146
|
+
synthesisResult: text('synthesis_result'),
|
|
147
|
+
suspendedReason: text('suspended_reason'),
|
|
148
|
+
suspendedAt: integer('suspended_at', { mode: 'timestamp' }),
|
|
149
|
+
retryCount: integer('retry_count'),
|
|
150
|
+
lastRetryAt: integer('last_retry_at', { mode: 'timestamp' }),
|
|
151
|
+
totalUsage: text('total_usage', { mode: 'json' }).$type(),
|
|
152
|
+
totalCostUsd: text('total_cost_usd'),
|
|
153
|
+
createdAt: integer('created_at', { mode: 'timestamp' }),
|
|
154
|
+
updatedAt: integer('updated_at', { mode: 'timestamp' }),
|
|
155
|
+
}).existing();
|
|
156
|
+
/**
|
|
157
|
+
* Relations
|
|
158
|
+
*/
|
|
159
|
+
export const dagsRelations = relations(dags, ({ many }) => ({
|
|
160
|
+
executions: many(dagExecutions),
|
|
161
|
+
}));
|
|
162
|
+
export const dagExecutionsRelations = relations(dagExecutions, ({ one, many }) => ({
|
|
163
|
+
dag: one(dags, {
|
|
164
|
+
fields: [dagExecutions.dagId],
|
|
165
|
+
references: [dags.id],
|
|
166
|
+
}),
|
|
167
|
+
subSteps: many(dagSubSteps),
|
|
168
|
+
}));
|
|
169
|
+
export const dagSubStepsRelations = relations(dagSubSteps, ({ one }) => ({
|
|
170
|
+
execution: one(dagExecutions, {
|
|
171
|
+
fields: [dagSubSteps.executionId],
|
|
172
|
+
references: [dagExecutions.id],
|
|
173
|
+
}),
|
|
174
|
+
}));
|
|
175
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,CAC/B,QAAQ,EACR;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;IAC5B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE;IAClC,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,EAAE;IACjD,QAAQ,EAAE,IAAI,CAAC,UAAU,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AAW,CAAC,WAAW,CAAC;QACjC,UAAU,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;KAC/B,CAAC;CACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* desiAgent Error Classes
|
|
3
|
+
*
|
|
4
|
+
* Custom error hierarchy for desiAgent library.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base error class for all desiAgent errors
|
|
8
|
+
*/
|
|
9
|
+
export declare class DesiAgentError extends Error {
|
|
10
|
+
code: string;
|
|
11
|
+
statusCode: number;
|
|
12
|
+
cause?: Error;
|
|
13
|
+
constructor(message: string, code?: string, statusCode?: number, cause?: Error);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Configuration error - invalid or missing configuration
|
|
17
|
+
*/
|
|
18
|
+
export declare class ConfigurationError extends DesiAgentError {
|
|
19
|
+
constructor(message: string, cause?: Error);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Not found error - resource not found in database
|
|
23
|
+
*/
|
|
24
|
+
export declare class NotFoundError extends DesiAgentError {
|
|
25
|
+
resourceType: string;
|
|
26
|
+
resourceId: string;
|
|
27
|
+
constructor(resourceType: string, resourceId: string);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validation error - invalid input
|
|
31
|
+
*/
|
|
32
|
+
export declare class ValidationError extends DesiAgentError {
|
|
33
|
+
field: string;
|
|
34
|
+
value: any;
|
|
35
|
+
constructor(message: string, field: string, value?: any);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Execution error - error during goal/DAG execution
|
|
39
|
+
*/
|
|
40
|
+
export declare class ExecutionError extends DesiAgentError {
|
|
41
|
+
executionId: string;
|
|
42
|
+
stepIndex?: number;
|
|
43
|
+
constructor(message: string, executionId: string, stepIndex?: number, cause?: Error);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Database error - error accessing or querying database
|
|
47
|
+
*/
|
|
48
|
+
export declare class DatabaseError extends DesiAgentError {
|
|
49
|
+
operation: string;
|
|
50
|
+
constructor(message: string, operation: string, cause?: Error);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* LLM provider error - error from LLM provider (OpenAI, Ollama, etc.)
|
|
54
|
+
*/
|
|
55
|
+
export declare class LLMProviderError extends DesiAgentError {
|
|
56
|
+
provider: string;
|
|
57
|
+
constructor(message: string, provider: string, cause?: Error);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Tool error - error executing a tool
|
|
61
|
+
*/
|
|
62
|
+
export declare class ToolError extends DesiAgentError {
|
|
63
|
+
toolName: string;
|
|
64
|
+
constructor(message: string, toolName: string, cause?: Error);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Timeout error - operation exceeded timeout
|
|
68
|
+
*/
|
|
69
|
+
export declare class TimeoutError extends DesiAgentError {
|
|
70
|
+
timeout: number;
|
|
71
|
+
constructor(message: string, timeout: number);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Initialization error - error during client initialization
|
|
75
|
+
*/
|
|
76
|
+
export declare class InitializationError extends DesiAgentError {
|
|
77
|
+
component: string;
|
|
78
|
+
constructor(message: string, component: string, cause?: Error);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;gBAEF,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAqB,EAAE,UAAU,GAAE,MAAY,EAAE,KAAK,CAAC,EAAE,KAAK;CAUlG;AAED;;GAEG;AACH,qB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BAEJ,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAM7C;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,SAAS,EAAE,MAAM,CAAC;gBAEN,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAM9D"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* desiAgent Error Classes
|
|
3
|
+
*
|
|
4
|
+
* Custom error hierarchy for desiAgent library.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base error class for all desiAgent errors
|
|
8
|
+
*/
|
|
9
|
+
export class DesiAgentError extends Error {
|
|
10
|
+
code;
|
|
11
|
+
statusCode;
|
|
12
|
+
cause;
|
|
13
|
+
constructor(message, code = 'DESI_ERROR', statusCode = 500, cause) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'DesiAgentError';
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.statusCode = statusCode;
|
|
18
|
+
this.cause = cause;
|
|
19
|
+
// Maintain proper prototype chain
|
|
20
|
+
Object.setPrototypeOf(this, DesiAgentError.prototype);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Configuration error - invalid or missing configuration
|
|
25
|
+
*/
|
|
26
|
+
export class ConfigurationError extends DesiAgentError {
|
|
27
|
+
constructor(message, cause) {
|
|
28
|
+
super(message, 'CONFIG_ERROR', 400, cause);
|
|
29
|
+
this.name = 'ConfigurationError';
|
|
30
|
+
Object.setPrototypeOf(this, ConfigurationError.prototype);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Not found error - resource not found in database
|
|
35
|
+
*/
|
|
36
|
+
export class NotFoundError extends DesiAgentError {
|
|
37
|
+
resourceType;
|
|
38
|
+
resourceId;
|
|
39
|
+
constructor(resourceType, resourceId) {
|
|
40
|
+
super(`${resourceType} not found: ${resourceId}`, 'NOT_FOUND', 404);
|
|
41
|
+
this.name = 'NotFoundError';
|
|
42
|
+
this.resourceType = resourceType;
|
|
43
|
+
this.resourceId = resourceId;
|
|
44
|
+
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Validation error - invalid input
|
|
49
|
+
*/
|
|
50
|
+
export class ValidationError extends DesiAgentError {
|
|
51
|
+
field;
|
|
52
|
+
value;
|
|
53
|
+
constructor(message, field, value) {
|
|
54
|
+
super(message, 'VALIDATION_ERROR', 400);
|
|
55
|
+
this.name = 'ValidationError';
|
|
56
|
+
this.field = field;
|
|
57
|
+
this.value = value;
|
|
58
|
+
Object.setPrototypeOf(this, ValidationError.prototype);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Execution error - error during goal/DAG execution
|
|
63
|
+
*/
|
|
64
|
+
export class ExecutionError extends DesiAgentError {
|
|
65
|
+
executionId;
|
|
66
|
+
stepIndex;
|
|
67
|
+
constructor(message, executionId, stepIndex, cause) {
|
|
68
|
+
super(message, 'EXECUTION_ERROR', 500, cause);
|
|
69
|
+
this.name = 'ExecutionError';
|
|
70
|
+
this.executionId = executionId;
|
|
71
|
+
this.stepIndex = stepIndex;
|
|
72
|
+
Object.setPrototypeOf(this, ExecutionError.prototype);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Database error - error accessing or querying database
|
|
77
|
+
*/
|
|
78
|
+
export class DatabaseError extends DesiAgentError {
|
|
79
|
+
operation;
|
|
80
|
+
constructor(message, operation, cause) {
|
|
81
|
+
super(message, 'DATABASE_ERROR', 500, cause);
|
|
82
|
+
this.name = 'DatabaseError';
|
|
83
|
+
this.operation = operation;
|
|
84
|
+
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* LLM provider error - error from LLM provider (OpenAI, Ollama, etc.)
|
|
89
|
+
*/
|
|
90
|
+
export class LLMProviderError extends DesiAgentError {
|
|
91
|
+
provider;
|
|
92
|
+
constructor(message, provider, cause) {
|
|
93
|
+
super(message, 'LLM_PROVIDER_ERROR', 502, cause);
|
|
94
|
+
this.name = 'LLMProviderError';
|
|
95
|
+
this.provider = provider;
|
|
96
|
+
Object.setPrototypeOf(this, LLMProviderError.prototype);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Tool error - error executing a tool
|
|
101
|
+
*/
|
|
102
|
+
export class ToolError extends DesiAgentError {
|
|
103
|
+
toolName;
|
|
104
|
+
constructor(message, toolName, cause) {
|
|
105
|
+
super(message, 'TOOL_ERROR', 500, cause);
|
|
106
|
+
this.name = 'ToolError';
|
|
107
|
+
this.toolName = toolName;
|
|
108
|
+
Object.setPrototypeOf(this, ToolError.prototype);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Timeout error - operation exceeded timeout
|
|
113
|
+
*/
|
|
114
|
+
export class TimeoutError extends DesiAgentError {
|
|
115
|
+
timeout;
|
|
116
|
+
constructor(message, timeout) {
|
|
117
|
+
super(message, 'TIMEOUT', 408);
|
|
118
|
+
this.name = 'TimeoutError';
|
|
119
|
+
this.timeout = timeout;
|
|
120
|
+
Object.setPrototypeOf(this, TimeoutError.prototype);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Initialization error - error during client initialization
|
|
125
|
+
*/
|
|
126
|
+
export class InitializationError extends DesiAgentError {
|
|
127
|
+
component;
|
|
128
|
+
constructor(message, component, cause) {
|
|
129
|
+
super(message, 'INIT_ERROR', 500, cause);
|
|
130
|
+
this.name = 'InitializationError';
|
|
131
|
+
this.component = component;
|
|
132
|
+
Object.setPrototypeOf(this, InitializationError.prototype);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -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,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* desiAgent - Library-first async agent system
|
|
3
|
+
*
|
|
4
|
+
* Main entry point for the desiAgent library.
|
|
5
|
+
* Exports the setupDesiAgent function and all public types.
|
|
6
|
+
*/
|
|
7
|
+
import type { DesiAgentConfig } from './types/config.js';
|
|
8
|
+
import type { DesiAgentClient } from './types/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Setup and initialize a desiAgent client
|
|
11
|
+
*
|
|
12
|
+
* @param config - Configuration object for desiAgent
|
|
13
|
+
* @returns Initialized DesiAgentClient
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { setupDesiAgent } from 'desiagent';
|
|
18
|
+
*
|
|
19
|
+
* const client = await setupDesiAgent({
|
|
20
|
+
* llmProvider: 'openai',
|
|
21
|
+
* openaiApiKey: process.env.OPENAI_API_KEY,
|
|
22
|
+
* modelName: 'gpt-4o',
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Use DAGs for task decomposition and execution
|
|
26
|
+
* const result = await client.dags.createFromGoal({
|
|
27
|
+
* goalText: 'Analyze this document',
|
|
28
|
+
* agentName: 'analyst',
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* await client.shutdown();
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function setupDesiAgent(config: DesiAgentConfig): Promise<DesiAgentClient>;
|
|
35
|
+
export type { DesiAgentConfig, ProcessedDesiAgentConfig } from './types/config.js';
|
|
36
|
+
export { DesiAgentConfigSchema } from './types/config.js';
|
|
37
|
+
export type { DesiAgentClient } from './types/index.js';
|
|
38
|
+
export { ExecutionStatus, ExecutionEventType, type DAG, type DAGNode, type DAGEdge, type DAGExecution, type DAGExecutionWithSteps, type DagExecutionListResult, type DAGExecutionStatus, type SubStep, type SubStepStatus, type ExecutionEvent, type DAGFilter, type Agent, type AgentConstraints, type Tool, type ToolParameter, type ToolCall, type ToolResult, type AgentDefinition, } from './types/index.js';
|
|
39
|
+
export { DecomposerJobSchema, SubTaskSchema, type DecomposerJob, type SubTask, } from './types/dag.js';
|
|
40
|
+
export type { CreateDAGFromGoalOptions, DAGPlanningResult, ClarificationRequiredResult, DAGCreatedResult, UnpersistedResult, ExecuteOptions, ExecuteDefinitionOptions, RunExperimentsInput, DagScheduler, DAGsServiceDeps, } from './core/execution/dags.js';
|
|
41
|
+
export type { UsageInfo, PlanningUsageTotal, PlanningAttempt, SubStepCost, SynthesisCost, ExecutionCostBreakdown, ExecutionSummary, DagCostBreakdown, CostSummaryEntry, CostSummaryResult, CostSummaryOptions, } from './core/execution/costs.js';
|
|
42
|
+
export { DAGsService } from './core/execution/dags.js';
|
|
43
|
+
export { ExecutionsService } from './core/execution/executions.js';
|
|
44
|
+
export { CostsService } from './core/execution/costs.js';
|
|
45
|
+
export { AgentsService } from './core/execution/agents.js';
|
|
46
|
+
export { ToolsService } from './core/execution/tools.js';
|
|
47
|
+
export { ArtifactsService } from './core/execution/artifacts.js';
|
|
48
|
+
export { validateCronExpression } from './util/cron-validator.js';
|
|
49
|
+
export { extractCodeBlock, extractJsonCodeBlock, renumberSubTasks, truncate, truncateForLog, parseDate, formatDateByGroup, } from './util/dag-utils.js';
|
|
50
|
+
export { DesiAgentError, ConfigurationError, NotFoundError, ValidationError, ExecutionError, DatabaseError, LLMProviderError, ToolError, TimeoutError, InitializationError, } from './errors/index.js';
|
|
51
|
+
export { initDB, type InitDBOptions, type InitDBResult } from './services/initDB.js';
|
|
52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AY,EACV,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,SAAS,EACT,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* desiAgent - Library-first async agent system
|
|
3
|
+
*
|
|
4
|
+
* Main entry point for the desiAgent library.
|
|
5
|
+
* Exports the setupDesiAgent function and all public types.
|
|
6
|
+
*/
|
|
7
|
+
import { DesiAgentConfigSchema } from './types/config.js';
|
|
8
|
+
import packageJson from '../package.json' with { type: 'json' };
|
|
9
|
+
import { ConfigurationError, InitializationError, } from './errors/index.js';
|
|
10
|
+
import { initializeLogger, getLogger } from './util/logger.js';
|
|
11
|
+
import { getDatabase, closeDatabase } from './db/client.js';
|
|
12
|
+
import { dirname, resolve } from 'path';
|
|
13
|
+
import { AgentsService } from './core/execution/agents.js';
|
|
14
|
+
import { DAGsService } from './core/execution/dags.js';
|
|
15
|
+
import { ExecutionsService } from './core/execution/executions.js';
|
|
16
|
+
import { ToolsService } from './core/execution/tools.js';
|
|
17
|
+
import { ArtifactsService } from './core/execution/artifacts.js';
|
|
18
|
+
import { CostsService } from './core/execution/costs.js';
|
|
19
|
+
import { createToolRegistry, ToolExecutor } from './core/tools/index.js';
|
|
20
|
+
import { createLLMProvider, validateLLMSetup } from './core/providers/factory.js';
|
|
21
|
+
/**
|
|
22
|
+
* DesiAgent client implementation
|
|
23
|
+
*/
|
|
24
|
+
class DesiAgentClientImpl {
|
|
25
|
+
agents;
|
|
26
|
+
dags;
|
|
27
|
+
executions;
|
|
28
|
+
tools;
|
|
29
|
+
artifacts;
|
|
30
|
+
costs;
|
|
31
|
+
version = packageJson.version;
|
|
32
|
+
logger = getLogger();
|
|
33
|
+
constructor(agents, dags, executions, tools, artifacts, costs) {
|
|
34
|
+
this.agents = agents;
|
|
35
|
+
this.dags = dags;
|
|
36
|
+
this.executions = executions;
|
|
37
|
+
this.tools = tools;
|
|
38
|
+
this.artifacts = artifacts;
|
|
39
|
+
this.costs = costs;
|
|
40
|
+
}
|
|
41
|
+
async executeTask(_agent, _task, _files) {
|
|
42
|
+
// TODO: Phase 2+ - Implement task execution with agent orchestration
|
|
43
|
+
throw new Error('Task execution not yet implemented');
|
|
44
|
+
}
|
|
45
|
+
async shutdown() {
|
|
46
|
+
this.logger.info('Shutting down desiAgent');
|
|
47
|
+
closeDatabase();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Setup and initialize a desiAgent client
|
|
52
|
+
*
|
|
53
|
+
* @param config - Configuration object for desiAgent
|
|
54
|
+
* @returns Initialized DesiAgentClient
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import { setupDesiAgent } from 'desiagent';
|
|
59
|
+
*
|
|
60
|
+
* const client = await setupDesiAgent({
|
|
61
|
+
* llmProvider: 'openai',
|
|
62
|
+
* openaiApiKey: process.env.OPENAI_API_KEY,
|
|
63
|
+
* modelName: 'gpt-4o',
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* // Use DAGs for task decomposition and execution
|
|
67
|
+
* const result = await client.dags.createFromGoal({
|
|
68
|
+
* goalText: 'Analyze this document',
|
|
69
|
+
* agentName: 'analyst',
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* await client.shutdown();
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export async function setupDesiAgent(config) {
|
|
76
|
+
try {
|
|
77
|
+
// Validate and process configuration
|
|
78
|
+
const validatedConfig = validateConfig(config);
|
|
79
|
+
// Initialize logger
|
|
80
|
+
initializeLogger(validatedConfig.logLevel);
|
|
81
|
+
const logger = getLogger();
|
|
82
|
+
logger.info(`desiAgent version ${packageJson.version}`);
|
|
83
|
+
logger.info({
|
|
84
|
+
provider: validatedConfig.llmProvider,
|
|
85
|
+
model: validatedConfig.modelName,
|
|
86
|
+
logLevel: validatedConfig.logLevel,
|
|
87
|
+
}, 'Initializing desiAgent');
|
|
88
|
+
// Initialize database
|
|
89
|
+
const db = getDatabase(validatedConfig.databasePath);
|
|
90
|
+
logger.info('Database initialized');
|
|
91
|
+
// Compute artifacts directory from config or database path
|
|
92
|
+
const artifactsDir = validatedConfig.artifactsDir
|
|
93
|
+
|| resolve(dirname(validatedConfig.databasePath), 'artifacts');
|
|
94
|
+
logger.debug({ artifactsDir }, 'Artifacts directory configured');
|
|
95
|
+
// Initialize services
|
|
96
|
+
const agentsService = new AgentsService(db);
|
|
97
|
+
const executionsService = new ExecutionsService(db);
|
|
98
|
+
// Initialize tool registry
|
|
99
|
+
const toolRegistry = createToolRegistry();
|
|
100
|
+
const toolsService = new ToolsService(toolRegistry);
|
|
101
|
+
const toolExecutor = new ToolExecutor(toolRegistry, artifactsDir);
|
|
102
|
+
// Initialize LLM provider
|
|
103
|
+
const llmProviderConfig = {
|
|
104
|
+
provider: validatedConfig.llmProvider,
|
|
105
|
+
apiKey: validatedConfig.llmProvider === 'openrouter'
|
|
106
|
+
? validatedConfig.openrouterApiKey
|
|
107
|
+
: validatedConfig.openaiApiKey,
|
|
108
|
+
baseUrl: validatedConfig.ollamaBaseUrl,
|
|
109
|
+
model: validatedConfig.modelName,
|
|
110
|
+
};
|
|
111
|
+
const llmProvider = createLLMProvider(llmProviderConfig);
|
|
112
|
+
await validateLLMSetup(llmProvider, validatedConfig.modelName);
|
|
113
|
+
// Initialize DAGs service (requires llmProvider, toolRegistry, agentsService)
|
|
114
|
+
const dagsService = new DAGsService({
|
|
115
|
+
db,
|
|
116
|
+
llmProvider,
|
|
117
|
+
toolRegistry,
|
|
118
|
+
agentsService,
|
|
119
|
+
artifactsDir,
|
|
120
|
+
});
|
|
121
|
+
// Initialize artifacts service
|
|
122
|
+
const artifactsService = new ArtifactsService(artifactsDir);
|
|
123
|
+
// Initialize costs service
|
|
124
|
+
const costsService = new CostsService(db);
|
|
125
|
+
// Create and return client
|
|
126
|
+
const client = new DesiAgentClientImpl(agentsService, dagsService, executionsService, toolsService, artifactsService, costsService);
|
|
127
|
+
logger.info('desiAgent initialized successfully', {
|
|
128
|
+
provider: llmProvider.name,
|
|
129
|
+
model: validatedConfig.modelName,
|
|
130
|
+
tools: toolRegistry.getAllDefinitions().length,
|
|
131
|
+
});
|
|
132
|
+
// Store internal services on client
|
|
133
|
+
client._toolExecutor = toolExecutor;
|
|
134
|
+
client._llmProvider = llmProvider;
|
|
135
|
+
return client;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
if (error instanceof ConfigurationError) {
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
throw new InitializationError(`Failed to initialize desiAgent: ${error instanceof Error ? error.message : String(error)}`, 'setupDesiAgent', error instanceof Error ? error : undefined);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Validate and process configuration
|
|
146
|
+
*/
|
|
147
|
+
function validateConfig(config) {
|
|
148
|
+
try {
|
|
149
|
+
return DesiAgentConfigSchema.parse(config);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
throw new ConfigurationError(`Invalid configuration: ${error instanceof Error ? error.message : String(error)}`, error instanceof Error ? error : undefined);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
export { DesiAgentConfigSchema } from './types/config.js';
|
|
156
|
+
export { ExecutionStatus, ExecutionEventType, } from './types/index.js';
|
|
157
|
+
// DAG-specific types
|
|
158
|
+
export { DecomposerJobSchema, SubTaskSchema, } from './types/dag.js';
|
|
159
|
+
// Service classes (for advanced use cases)
|
|
160
|
+
export { DAGsService } from './core/execution/dags.js';
|
|
161
|
+
export { ExecutionsService } from './core/execution/executions.js';
|
|
162
|
+
export { CostsService } from './core/execution/costs.js';
|
|
163
|
+
export { AgentsService } from './core/execution/agents.js';
|
|
164
|
+
export { ToolsService } from './core/execution/tools.js';
|
|
165
|
+
export { ArtifactsService } from './core/execution/artifacts.js';
|
|
166
|
+
// Utility exports
|
|
167
|
+
export { validateCronExpression } from './util/cron-validator.js';
|
|
168
|
+
export { extractCodeBlock, extractJsonCodeBlock, renumberSubTasks, truncate, truncateForLog, parseDate, formatDateByGroup, } from './util/dag-utils.js';
|
|
169
|
+
export { DesiAgentError, ConfigurationError, NotFoundError, ValidationError, ExecutionError, DatabaseError, LLMProviderError, ToolError, TimeoutError, InitializationError, } from './errors/index.js';
|
|
170
|
+
// Database initialization
|
|
171
|
+
export { initDB } from './services/initDB.js';
|
|
172
|
+
//# sourceMappingURL=index.js.map
|