universal-agent-memory 1.0.17 → 1.0.19
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/dist/benchmarks/benchmark.d.ts +6 -6
- package/dist/bin/cli.js +3 -0
- package/dist/bin/cli.js.map +1 -1
- package/dist/cli/model.d.ts +15 -0
- package/dist/cli/model.d.ts.map +1 -0
- package/dist/cli/model.js +270 -0
- package/dist/cli/model.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/models/executor.d.ts +130 -0
- package/dist/models/executor.d.ts.map +1 -0
- package/dist/models/executor.js +383 -0
- package/dist/models/executor.js.map +1 -0
- package/dist/models/index.d.ts +15 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +17 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/planner.d.ts +71 -0
- package/dist/models/planner.d.ts.map +1 -0
- package/dist/models/planner.js +344 -0
- package/dist/models/planner.js.map +1 -0
- package/dist/models/router.d.ts +75 -0
- package/dist/models/router.d.ts.map +1 -0
- package/dist/models/router.js +344 -0
- package/dist/models/router.js.map +1 -0
- package/dist/models/types.d.ts +370 -0
- package/dist/models/types.d.ts.map +1 -0
- package/dist/models/types.js +181 -0
- package/dist/models/types.js.map +1 -0
- package/dist/types/config.d.ts +598 -38
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +75 -0
- package/dist/types/config.js.map +1 -1
- package/dist/types/coordination.d.ts +7 -7
- package/package.json +1 -1
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Executor
|
|
3
|
+
*
|
|
4
|
+
* Tier 2 of the Multi-Model Architecture.
|
|
5
|
+
* Responsible for:
|
|
6
|
+
* - Executing subtasks following planner specifications
|
|
7
|
+
* - Managing retries and fallbacks
|
|
8
|
+
* - Tracking execution results and costs
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_OPTIONS = {
|
|
11
|
+
maxRetries: 2,
|
|
12
|
+
retryDelayMs: 1000,
|
|
13
|
+
stepTimeout: 120000,
|
|
14
|
+
enableFallback: true,
|
|
15
|
+
parallelExecution: true,
|
|
16
|
+
maxParallel: 3,
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Task Executor - executes plans created by the planner
|
|
20
|
+
*/
|
|
21
|
+
export class TaskExecutor {
|
|
22
|
+
router;
|
|
23
|
+
config;
|
|
24
|
+
client;
|
|
25
|
+
options;
|
|
26
|
+
results;
|
|
27
|
+
constructor(router, config, client, options = {}) {
|
|
28
|
+
this.router = router;
|
|
29
|
+
this.config = config;
|
|
30
|
+
this.client = client;
|
|
31
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
32
|
+
this.results = new Map();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Execute a complete plan
|
|
36
|
+
*/
|
|
37
|
+
async executePlan(plan, planner, onProgress) {
|
|
38
|
+
const allResults = [];
|
|
39
|
+
const outputs = new Map();
|
|
40
|
+
// Get execution order from planner
|
|
41
|
+
const executionOrder = planner.getExecutionOrder(plan);
|
|
42
|
+
for (const levelTasks of executionOrder) {
|
|
43
|
+
if (this.options.parallelExecution && levelTasks.length > 1) {
|
|
44
|
+
// Execute level in parallel
|
|
45
|
+
const levelResults = await this.executeParallel(plan, levelTasks, outputs, onProgress);
|
|
46
|
+
allResults.push(...levelResults);
|
|
47
|
+
// Update outputs
|
|
48
|
+
for (const result of levelResults) {
|
|
49
|
+
if (result.success) {
|
|
50
|
+
outputs.set(result.subtaskId, result.output);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// Execute sequentially
|
|
56
|
+
for (const taskId of levelTasks) {
|
|
57
|
+
const result = await this.executeSubtask(plan, taskId, outputs);
|
|
58
|
+
allResults.push(result);
|
|
59
|
+
onProgress?.(result);
|
|
60
|
+
if (result.success) {
|
|
61
|
+
outputs.set(taskId, result.output);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Store results
|
|
67
|
+
this.results.set(plan.id, allResults);
|
|
68
|
+
return allResults;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Execute multiple subtasks in parallel
|
|
72
|
+
*/
|
|
73
|
+
async executeParallel(plan, taskIds, inputs, onProgress) {
|
|
74
|
+
const maxParallel = this.options.maxParallel || 3;
|
|
75
|
+
const results = [];
|
|
76
|
+
// Process in batches
|
|
77
|
+
for (let i = 0; i < taskIds.length; i += maxParallel) {
|
|
78
|
+
const batch = taskIds.slice(i, i + maxParallel);
|
|
79
|
+
const batchResults = await Promise.all(batch.map(taskId => this.executeSubtask(plan, taskId, inputs)));
|
|
80
|
+
for (const result of batchResults) {
|
|
81
|
+
results.push(result);
|
|
82
|
+
onProgress?.(result);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return results;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Execute a single subtask with retry logic
|
|
89
|
+
*/
|
|
90
|
+
async executeSubtask(plan, subtaskId, inputs) {
|
|
91
|
+
const subtask = plan.subtasks.find(s => s.id === subtaskId);
|
|
92
|
+
if (!subtask) {
|
|
93
|
+
return this.createErrorResult(plan.id, subtaskId, 'Subtask not found');
|
|
94
|
+
}
|
|
95
|
+
const modelId = plan.modelAssignments.get(subtaskId);
|
|
96
|
+
const model = modelId ? this.router.getModel(modelId) : undefined;
|
|
97
|
+
if (!model) {
|
|
98
|
+
return this.createErrorResult(plan.id, subtaskId, 'No model assigned');
|
|
99
|
+
}
|
|
100
|
+
const context = {
|
|
101
|
+
planId: plan.id,
|
|
102
|
+
subtaskId,
|
|
103
|
+
inputs,
|
|
104
|
+
constraints: subtask.constraints,
|
|
105
|
+
previousAttempts: [],
|
|
106
|
+
};
|
|
107
|
+
let lastError;
|
|
108
|
+
let retryCount = 0;
|
|
109
|
+
// Try with primary model
|
|
110
|
+
for (let attempt = 0; attempt <= (this.options.maxRetries || 0); attempt++) {
|
|
111
|
+
try {
|
|
112
|
+
const result = await this.attemptExecution(model, subtask, context);
|
|
113
|
+
result.retryCount = retryCount;
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
lastError = error instanceof Error ? error.message : String(error);
|
|
118
|
+
retryCount++;
|
|
119
|
+
if (attempt < (this.options.maxRetries || 0)) {
|
|
120
|
+
await this.delay(this.options.retryDelayMs || 1000);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Try fallback if enabled
|
|
125
|
+
if (this.options.enableFallback) {
|
|
126
|
+
const fallbackModel = this.router.getModelForRole('fallback');
|
|
127
|
+
if (fallbackModel && fallbackModel.id !== model.id) {
|
|
128
|
+
try {
|
|
129
|
+
const result = await this.attemptExecution(fallbackModel, subtask, context);
|
|
130
|
+
result.retryCount = retryCount;
|
|
131
|
+
result.modelUsed = fallbackModel.id;
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
lastError = error instanceof Error ? error.message : String(error);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return this.createErrorResult(plan.id, subtaskId, lastError || 'Execution failed', retryCount);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Attempt to execute a subtask with a specific model
|
|
143
|
+
*/
|
|
144
|
+
async attemptExecution(model, subtask, context) {
|
|
145
|
+
const startTime = Date.now();
|
|
146
|
+
// Build prompt
|
|
147
|
+
const prompt = this.buildPrompt(subtask, context);
|
|
148
|
+
// Execute
|
|
149
|
+
const response = await this.client.complete(model, prompt, {
|
|
150
|
+
maxTokens: this.getMaxTokens(subtask),
|
|
151
|
+
timeout: this.options.stepTimeout,
|
|
152
|
+
});
|
|
153
|
+
const duration = Date.now() - startTime;
|
|
154
|
+
// Calculate cost
|
|
155
|
+
const cost = this.router.estimateCost(model, response.tokensUsed.input, response.tokensUsed.output);
|
|
156
|
+
return {
|
|
157
|
+
planId: context.planId,
|
|
158
|
+
subtaskId: context.subtaskId,
|
|
159
|
+
modelUsed: model.id,
|
|
160
|
+
success: true,
|
|
161
|
+
output: response.content,
|
|
162
|
+
tokensUsed: response.tokensUsed,
|
|
163
|
+
cost,
|
|
164
|
+
duration,
|
|
165
|
+
retryCount: 0,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Build the prompt for a subtask
|
|
170
|
+
*/
|
|
171
|
+
buildPrompt(subtask, context) {
|
|
172
|
+
const parts = [
|
|
173
|
+
`## Task: ${subtask.title}`,
|
|
174
|
+
'',
|
|
175
|
+
subtask.description,
|
|
176
|
+
'',
|
|
177
|
+
];
|
|
178
|
+
// Add inputs
|
|
179
|
+
if (context.inputs.size > 0) {
|
|
180
|
+
parts.push('## Available Context:');
|
|
181
|
+
for (const [key, value] of context.inputs) {
|
|
182
|
+
if (subtask.inputs.includes(key)) {
|
|
183
|
+
parts.push(`### ${key}:`);
|
|
184
|
+
parts.push('```');
|
|
185
|
+
parts.push(value.slice(0, 2000)); // Limit input size
|
|
186
|
+
parts.push('```');
|
|
187
|
+
parts.push('');
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Add constraints
|
|
192
|
+
if (context.constraints.length > 0) {
|
|
193
|
+
parts.push('## Constraints:');
|
|
194
|
+
for (const constraint of context.constraints) {
|
|
195
|
+
parts.push(`- ${constraint}`);
|
|
196
|
+
}
|
|
197
|
+
parts.push('');
|
|
198
|
+
}
|
|
199
|
+
// Add expected outputs
|
|
200
|
+
parts.push('## Expected Outputs:');
|
|
201
|
+
for (const output of subtask.outputs) {
|
|
202
|
+
parts.push(`- ${output}`);
|
|
203
|
+
}
|
|
204
|
+
parts.push('');
|
|
205
|
+
// Add instructions based on type
|
|
206
|
+
parts.push('## Instructions:');
|
|
207
|
+
switch (subtask.type) {
|
|
208
|
+
case 'coding':
|
|
209
|
+
parts.push('Provide working code that satisfies the requirements.');
|
|
210
|
+
parts.push('Include proper error handling and types.');
|
|
211
|
+
break;
|
|
212
|
+
case 'planning':
|
|
213
|
+
parts.push('Provide a detailed plan with clear steps.');
|
|
214
|
+
parts.push('Identify risks and dependencies.');
|
|
215
|
+
break;
|
|
216
|
+
case 'review':
|
|
217
|
+
parts.push('Review the provided code/content critically.');
|
|
218
|
+
parts.push('Identify issues, security concerns, and improvements.');
|
|
219
|
+
break;
|
|
220
|
+
case 'documentation':
|
|
221
|
+
parts.push('Write clear, comprehensive documentation.');
|
|
222
|
+
parts.push('Include examples and usage instructions.');
|
|
223
|
+
break;
|
|
224
|
+
default:
|
|
225
|
+
parts.push('Complete the task as specified.');
|
|
226
|
+
}
|
|
227
|
+
// Add retry context if applicable
|
|
228
|
+
if (context.previousAttempts.length > 0) {
|
|
229
|
+
parts.push('');
|
|
230
|
+
parts.push('## Previous Attempt Failed:');
|
|
231
|
+
const lastAttempt = context.previousAttempts[context.previousAttempts.length - 1];
|
|
232
|
+
if (lastAttempt.error) {
|
|
233
|
+
parts.push(`Error: ${lastAttempt.error}`);
|
|
234
|
+
}
|
|
235
|
+
parts.push('Please address the issue and try again.');
|
|
236
|
+
}
|
|
237
|
+
return parts.join('\n');
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get max tokens based on subtask complexity
|
|
241
|
+
*/
|
|
242
|
+
getMaxTokens(subtask) {
|
|
243
|
+
const baseTokens = {
|
|
244
|
+
low: 2000,
|
|
245
|
+
medium: 4000,
|
|
246
|
+
high: 8000,
|
|
247
|
+
critical: 12000,
|
|
248
|
+
};
|
|
249
|
+
return baseTokens[subtask.complexity] || 4000;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Create an error result
|
|
253
|
+
*/
|
|
254
|
+
createErrorResult(planId, subtaskId, error, retryCount = 0) {
|
|
255
|
+
return {
|
|
256
|
+
planId,
|
|
257
|
+
subtaskId,
|
|
258
|
+
modelUsed: 'none',
|
|
259
|
+
success: false,
|
|
260
|
+
output: '',
|
|
261
|
+
error,
|
|
262
|
+
tokensUsed: { input: 0, output: 0 },
|
|
263
|
+
cost: 0,
|
|
264
|
+
duration: 0,
|
|
265
|
+
retryCount,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Helper to delay
|
|
270
|
+
*/
|
|
271
|
+
delay(ms) {
|
|
272
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Get results for a plan
|
|
276
|
+
*/
|
|
277
|
+
getResults(planId) {
|
|
278
|
+
return this.results.get(planId);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Get total cost for a plan
|
|
282
|
+
*/
|
|
283
|
+
getTotalCost(planId) {
|
|
284
|
+
const results = this.results.get(planId);
|
|
285
|
+
if (!results)
|
|
286
|
+
return 0;
|
|
287
|
+
return results.reduce((sum, r) => sum + r.cost, 0);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Get success rate for a plan
|
|
291
|
+
*/
|
|
292
|
+
getSuccessRate(planId) {
|
|
293
|
+
const results = this.results.get(planId);
|
|
294
|
+
if (!results || results.length === 0)
|
|
295
|
+
return 0;
|
|
296
|
+
const successful = results.filter(r => r.success).length;
|
|
297
|
+
return (successful / results.length) * 100;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Generate execution summary
|
|
301
|
+
*/
|
|
302
|
+
generateSummary(planId) {
|
|
303
|
+
const results = this.results.get(planId);
|
|
304
|
+
if (!results)
|
|
305
|
+
return 'No results found for plan';
|
|
306
|
+
const successful = results.filter(r => r.success);
|
|
307
|
+
const failed = results.filter(r => !r.success);
|
|
308
|
+
const totalCost = this.getTotalCost(planId);
|
|
309
|
+
const totalDuration = results.reduce((sum, r) => sum + r.duration, 0);
|
|
310
|
+
const totalTokens = results.reduce((sum, r) => sum + r.tokensUsed.input + r.tokensUsed.output, 0);
|
|
311
|
+
const lines = [
|
|
312
|
+
`=== Execution Summary: ${planId.slice(0, 8)} ===`,
|
|
313
|
+
'',
|
|
314
|
+
`Total Subtasks: ${results.length}`,
|
|
315
|
+
`Successful: ${successful.length}`,
|
|
316
|
+
`Failed: ${failed.length}`,
|
|
317
|
+
`Success Rate: ${this.getSuccessRate(planId).toFixed(1)}%`,
|
|
318
|
+
'',
|
|
319
|
+
`Total Cost: $${totalCost.toFixed(4)}`,
|
|
320
|
+
`Total Duration: ${(totalDuration / 1000).toFixed(1)}s`,
|
|
321
|
+
`Total Tokens: ${totalTokens.toLocaleString()}`,
|
|
322
|
+
'',
|
|
323
|
+
];
|
|
324
|
+
if (failed.length > 0) {
|
|
325
|
+
lines.push('Failed Subtasks:');
|
|
326
|
+
for (const result of failed) {
|
|
327
|
+
lines.push(` - ${result.subtaskId}: ${result.error || 'Unknown error'}`);
|
|
328
|
+
}
|
|
329
|
+
lines.push('');
|
|
330
|
+
}
|
|
331
|
+
// Model usage breakdown
|
|
332
|
+
const modelUsage = new Map();
|
|
333
|
+
for (const result of results) {
|
|
334
|
+
const existing = modelUsage.get(result.modelUsed) || { count: 0, cost: 0, tokens: 0 };
|
|
335
|
+
existing.count++;
|
|
336
|
+
existing.cost += result.cost;
|
|
337
|
+
existing.tokens += result.tokensUsed.input + result.tokensUsed.output;
|
|
338
|
+
modelUsage.set(result.modelUsed, existing);
|
|
339
|
+
}
|
|
340
|
+
lines.push('Model Usage:');
|
|
341
|
+
for (const [model, usage] of modelUsage) {
|
|
342
|
+
lines.push(` ${model}: ${usage.count} tasks, $${usage.cost.toFixed(4)}, ${usage.tokens.toLocaleString()} tokens`);
|
|
343
|
+
}
|
|
344
|
+
return lines.join('\n');
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Create an executor instance
|
|
349
|
+
*/
|
|
350
|
+
export function createExecutor(router, config, client, options) {
|
|
351
|
+
return new TaskExecutor(router, config, client, options);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Mock client for testing
|
|
355
|
+
*/
|
|
356
|
+
export class MockModelClient {
|
|
357
|
+
responses;
|
|
358
|
+
latency;
|
|
359
|
+
constructor(responses, latency = 1000) {
|
|
360
|
+
this.responses = new Map(Object.entries(responses || {}));
|
|
361
|
+
this.latency = latency;
|
|
362
|
+
}
|
|
363
|
+
async complete(model, prompt) {
|
|
364
|
+
await new Promise(resolve => setTimeout(resolve, this.latency));
|
|
365
|
+
// Find matching response or generate default
|
|
366
|
+
let content = `Mock response from ${model.name}`;
|
|
367
|
+
for (const [key, value] of this.responses) {
|
|
368
|
+
if (prompt.toLowerCase().includes(key.toLowerCase())) {
|
|
369
|
+
content = value;
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return {
|
|
374
|
+
content,
|
|
375
|
+
tokensUsed: {
|
|
376
|
+
input: Math.ceil(prompt.length / 4),
|
|
377
|
+
output: Math.ceil(content.length / 4),
|
|
378
|
+
},
|
|
379
|
+
latencyMs: this.latency,
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/models/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsDH,MAAM,eAAe,GAAoB;IACvC,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,MAAM;IACnB,cAAc,EAAE,IAAI;IACpB,iBAAiB,EAAE,IAAI;IACvB,WAAW,EAAE,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,YAAY;IACf,MAAM,CAAc;IACnB,MAAM,CAAmB;IAC1B,MAAM,CAAc;IACpB,OAAO,CAAkB;IACzB,OAAO,CAAiC;IAEhD,YACE,MAAmB,EACnB,MAA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CAAC,EAAE,CAAC;gBACrD,OAAO,GAAG,KAAK,CAAC;gBAChB,MAAM;YACR,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO;YACP,UAAU,EAAE;gBACV,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;gBACnC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;aACtC;YACD,SAAS,EAAE,IAAI,CAAC,OAAO;SACxB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-Model Architecture
|
|
3
|
+
*
|
|
4
|
+
* Exports for the two-tier agentic architecture:
|
|
5
|
+
* - Router: Task classification and model selection
|
|
6
|
+
* - Planner: Task decomposition and execution planning
|
|
7
|
+
* - Executor: Subtask execution with retry/fallback
|
|
8
|
+
*/
|
|
9
|
+
export * from './types.js';
|
|
10
|
+
export { ModelRouter, createRouter, createCostOptimizedRouter, createPerformanceRouter, } from './router.js';
|
|
11
|
+
export { TaskPlanner, createPlanner, } from './planner.js';
|
|
12
|
+
export type { PlannerOptions } from './planner.js';
|
|
13
|
+
export { TaskExecutor, createExecutor, MockModelClient, } from './executor.js';
|
|
14
|
+
export type { ModelClient, ExecutionContext, ExecutorOptions, } from './executor.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,YAAY,CAAC;AAG3B,OAAO,EACL,WAAW,EACX,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,WAAW,EACX,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-Model Architecture
|
|
3
|
+
*
|
|
4
|
+
* Exports for the two-tier agentic architecture:
|
|
5
|
+
* - Router: Task classification and model selection
|
|
6
|
+
* - Planner: Task decomposition and execution planning
|
|
7
|
+
* - Executor: Subtask execution with retry/fallback
|
|
8
|
+
*/
|
|
9
|
+
// Types
|
|
10
|
+
export * from './types.js';
|
|
11
|
+
// Router
|
|
12
|
+
export { ModelRouter, createRouter, createCostOptimizedRouter, createPerformanceRouter, } from './router.js';
|
|
13
|
+
// Planner
|
|
14
|
+
export { TaskPlanner, createPlanner, } from './planner.js';
|
|
15
|
+
// Executor
|
|
16
|
+
export { TaskExecutor, createExecutor, MockModelClient, } from './executor.js';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,QAAQ;AACR,cAAc,YAAY,CAAC;AAE3B,SAAS;AACT,OAAO,EACL,WAAW,EACX,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAErB,UAAU;AACV,OAAO,EACL,WAAW,EACX,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,WAAW;AACX,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task Planner
|
|
3
|
+
*
|
|
4
|
+
* Tier 1 of the Multi-Model Architecture.
|
|
5
|
+
* Responsible for:
|
|
6
|
+
* - Task decomposition into subtasks
|
|
7
|
+
* - Dependency analysis
|
|
8
|
+
* - Model assignment for each subtask
|
|
9
|
+
* - Quality assurance routing
|
|
10
|
+
*/
|
|
11
|
+
import { ExecutionPlan, MultiModelConfig } from './types.js';
|
|
12
|
+
import { ModelRouter } from './router.js';
|
|
13
|
+
/**
|
|
14
|
+
* Planner configuration options
|
|
15
|
+
*/
|
|
16
|
+
export interface PlannerOptions {
|
|
17
|
+
maxSubtasks?: number;
|
|
18
|
+
maxDepth?: number;
|
|
19
|
+
enableParallelization?: boolean;
|
|
20
|
+
estimateTokenBudget?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Task Planner - decomposes tasks and creates execution plans
|
|
24
|
+
*/
|
|
25
|
+
export declare class TaskPlanner {
|
|
26
|
+
private router;
|
|
27
|
+
readonly config: MultiModelConfig;
|
|
28
|
+
private options;
|
|
29
|
+
constructor(router: ModelRouter, config: MultiModelConfig, options?: PlannerOptions);
|
|
30
|
+
/**
|
|
31
|
+
* Create an execution plan for a task
|
|
32
|
+
*/
|
|
33
|
+
createPlan(taskDescription: string): ExecutionPlan;
|
|
34
|
+
/**
|
|
35
|
+
* Decompose a complex task into subtasks
|
|
36
|
+
*/
|
|
37
|
+
private decomposeTask;
|
|
38
|
+
/**
|
|
39
|
+
* Create a single subtask for simple tasks
|
|
40
|
+
*/
|
|
41
|
+
private createSingleSubtask;
|
|
42
|
+
/**
|
|
43
|
+
* Analyze dependencies between subtasks
|
|
44
|
+
*/
|
|
45
|
+
private analyzeDependencies;
|
|
46
|
+
/**
|
|
47
|
+
* Assign models to subtasks based on routing
|
|
48
|
+
*/
|
|
49
|
+
private assignModels;
|
|
50
|
+
/**
|
|
51
|
+
* Estimate total cost for the plan
|
|
52
|
+
*/
|
|
53
|
+
private estimateTotalCost;
|
|
54
|
+
/**
|
|
55
|
+
* Estimate duration considering parallelization
|
|
56
|
+
*/
|
|
57
|
+
private estimateDuration;
|
|
58
|
+
/**
|
|
59
|
+
* Get execution order respecting dependencies
|
|
60
|
+
*/
|
|
61
|
+
getExecutionOrder(plan: ExecutionPlan): string[][];
|
|
62
|
+
/**
|
|
63
|
+
* Visualize the plan as text
|
|
64
|
+
*/
|
|
65
|
+
visualizePlan(plan: ExecutionPlan): string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Create a planner instance
|
|
69
|
+
*/
|
|
70
|
+
export declare function createPlanner(router: ModelRouter, config: MultiModelConfig, options?: PlannerOptions): TaskPlanner;
|
|
71
|
+
//# sourceMappingURL=planner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../src/models/planner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EACL,aAAa,EAGb,gBAAgB,EACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AASD;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAc;IAC5B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,OAAO,CAAC,OAAO,CAAiB;gBAG9B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,cAAmB;IAO9B;;OAEG;IACH,UAAU,CAAC,eAAe,EAAE,MAAM,GAAG,aAAa;IAiClD;;OAEG;IACH,OAAO,CAAC,aAAa;IAyFrB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAgB3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA4B3B;;OAEG;IACH,OAAO,CAAC,YAAY;IAepB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA4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