universal-agent-memory 0.6.2 → 0.6.3
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/agents/naive-agent.d.ts +60 -0
- package/dist/benchmarks/agents/naive-agent.d.ts.map +1 -0
- package/dist/benchmarks/agents/naive-agent.js +144 -0
- package/dist/benchmarks/agents/naive-agent.js.map +1 -0
- package/dist/benchmarks/agents/uam-agent.d.ts +167 -0
- package/dist/benchmarks/agents/uam-agent.d.ts.map +1 -0
- package/dist/benchmarks/agents/uam-agent.js +386 -0
- package/dist/benchmarks/agents/uam-agent.js.map +1 -0
- package/dist/benchmarks/benchmark.d.ts +328 -0
- package/dist/benchmarks/benchmark.d.ts.map +1 -0
- package/dist/benchmarks/benchmark.js +104 -0
- package/dist/benchmarks/benchmark.js.map +1 -0
- package/dist/benchmarks/execution-verifier.d.ts +41 -0
- package/dist/benchmarks/execution-verifier.d.ts.map +1 -0
- package/dist/benchmarks/execution-verifier.js +301 -0
- package/dist/benchmarks/execution-verifier.js.map +1 -0
- package/dist/benchmarks/hierarchical-prompting.d.ts +37 -0
- package/dist/benchmarks/hierarchical-prompting.d.ts.map +1 -0
- package/dist/benchmarks/hierarchical-prompting.js +260 -0
- package/dist/benchmarks/hierarchical-prompting.js.map +1 -0
- package/dist/benchmarks/improved-benchmark.d.ts +88 -0
- package/dist/benchmarks/improved-benchmark.d.ts.map +1 -0
- package/dist/benchmarks/improved-benchmark.js +533 -0
- package/dist/benchmarks/improved-benchmark.js.map +1 -0
- package/dist/benchmarks/index.d.ts +10 -0
- package/dist/benchmarks/index.d.ts.map +1 -0
- package/dist/benchmarks/index.js +10 -0
- package/dist/benchmarks/index.js.map +1 -0
- package/dist/benchmarks/multi-turn-agent.d.ts +44 -0
- package/dist/benchmarks/multi-turn-agent.d.ts.map +1 -0
- package/dist/benchmarks/multi-turn-agent.js +235 -0
- package/dist/benchmarks/multi-turn-agent.js.map +1 -0
- package/dist/benchmarks/runner.d.ts +2 -0
- package/dist/benchmarks/runner.d.ts.map +1 -0
- package/dist/benchmarks/runner.js +2 -0
- package/dist/benchmarks/runner.js.map +1 -0
- package/dist/benchmarks/tasks.d.ts +19 -0
- package/dist/benchmarks/tasks.d.ts.map +1 -0
- package/dist/benchmarks/tasks.js +371 -0
- package/dist/benchmarks/tasks.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/memory/backends/qdrant-cloud.d.ts +1 -1
- package/dist/memory/backends/qdrant-cloud.d.ts.map +1 -1
- package/dist/memory/backends/qdrant-cloud.js +6 -4
- package/dist/memory/backends/qdrant-cloud.js.map +1 -1
- package/dist/memory/dynamic-retrieval.d.ts +26 -0
- package/dist/memory/dynamic-retrieval.d.ts.map +1 -0
- package/dist/memory/dynamic-retrieval.js +378 -0
- package/dist/memory/dynamic-retrieval.js.map +1 -0
- package/dist/memory/embeddings.d.ts +82 -0
- package/dist/memory/embeddings.d.ts.map +1 -0
- package/dist/memory/embeddings.js +297 -0
- package/dist/memory/embeddings.js.map +1 -0
- package/dist/memory/task-classifier.d.ts +33 -0
- package/dist/memory/task-classifier.d.ts.map +1 -0
- package/dist/memory/task-classifier.js +277 -0
- package/dist/memory/task-classifier.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +62 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +150 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/dist/utils/validate-json.d.ts +52 -0
- package/dist/utils/validate-json.d.ts.map +1 -0
- package/dist/utils/validate-json.js +99 -0
- package/dist/utils/validate-json.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Naive Agent - No Memory
|
|
3
|
+
*
|
|
4
|
+
* Assumptions:
|
|
5
|
+
* - This agent has no persistent memory between tasks
|
|
6
|
+
* - Each task starts fresh with no context
|
|
7
|
+
* - Cannot recall previous decisions, patterns, or mistakes
|
|
8
|
+
*
|
|
9
|
+
* What this handles:
|
|
10
|
+
* - Basic task instruction understanding
|
|
11
|
+
* - Simple file operations
|
|
12
|
+
* - Test execution and verification
|
|
13
|
+
*
|
|
14
|
+
* What this does NOT handle:
|
|
15
|
+
* - Context across tasks
|
|
16
|
+
* - Learning from past mistakes
|
|
17
|
+
* - Pattern recognition
|
|
18
|
+
* - Memory of project structure
|
|
19
|
+
*/
|
|
20
|
+
import { BenchmarkTask, AgentExecution } from '../benchmark.js';
|
|
21
|
+
export declare class NaiveAgent {
|
|
22
|
+
private name;
|
|
23
|
+
private executionCount;
|
|
24
|
+
private errors;
|
|
25
|
+
constructor(name?: string);
|
|
26
|
+
/**
|
|
27
|
+
* Execute a task with no memory context
|
|
28
|
+
*/
|
|
29
|
+
executeTask(task: BenchmarkTask, attempt?: number): Promise<AgentExecution>;
|
|
30
|
+
/**
|
|
31
|
+
* Execute task without any memory or context
|
|
32
|
+
*/
|
|
33
|
+
private executeNaively;
|
|
34
|
+
/**
|
|
35
|
+
* Simulate agent thinking/processing time
|
|
36
|
+
*/
|
|
37
|
+
private simulateThinking;
|
|
38
|
+
/**
|
|
39
|
+
* Simulate successful execution
|
|
40
|
+
*/
|
|
41
|
+
private simulateSuccess;
|
|
42
|
+
/**
|
|
43
|
+
* Simulate failed execution
|
|
44
|
+
*/
|
|
45
|
+
private simulateFailure;
|
|
46
|
+
/**
|
|
47
|
+
* Get agent statistics
|
|
48
|
+
*/
|
|
49
|
+
getStats(): {
|
|
50
|
+
name: string;
|
|
51
|
+
executionCount: number;
|
|
52
|
+
totalErrors: number;
|
|
53
|
+
recentErrors: string[];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Reset agent state (not really needed for naive agent, but for completeness)
|
|
57
|
+
*/
|
|
58
|
+
reset(): void;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=naive-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naive-agent.d.ts","sourceRoot":"","sources":["../../../src/benchmarks/agents/naive-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEhE,qBAAa,UAAU;IAIT,OAAO,CAAC,IAAI;IAHxB,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,MAAM,CAAgB;gBAEV,IAAI,GAAE,MAAsB;IAEhD;;OAEG;IACG,WAAW,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,GAAE,MAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAsCpF;;OAEG;YACW,cAAc;IA4B5B;;OAEG;YACW,gBAAgB;IAa9B;;OAEG;YACW,eAAe;IAa7B;;OAEG;YACW,eAAe;IAK7B;;OAEG;IACH,QAAQ;;;;;;IASR;;OAEG;IACH,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Naive Agent - No Memory
|
|
3
|
+
*
|
|
4
|
+
* Assumptions:
|
|
5
|
+
* - This agent has no persistent memory between tasks
|
|
6
|
+
* - Each task starts fresh with no context
|
|
7
|
+
* - Cannot recall previous decisions, patterns, or mistakes
|
|
8
|
+
*
|
|
9
|
+
* What this handles:
|
|
10
|
+
* - Basic task instruction understanding
|
|
11
|
+
* - Simple file operations
|
|
12
|
+
* - Test execution and verification
|
|
13
|
+
*
|
|
14
|
+
* What this does NOT handle:
|
|
15
|
+
* - Context across tasks
|
|
16
|
+
* - Learning from past mistakes
|
|
17
|
+
* - Pattern recognition
|
|
18
|
+
* - Memory of project structure
|
|
19
|
+
*/
|
|
20
|
+
export class NaiveAgent {
|
|
21
|
+
name;
|
|
22
|
+
executionCount = 0;
|
|
23
|
+
errors = [];
|
|
24
|
+
constructor(name = 'naive-agent') {
|
|
25
|
+
this.name = name;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Execute a task with no memory context
|
|
29
|
+
*/
|
|
30
|
+
async executeTask(task, attempt = 1) {
|
|
31
|
+
const startTime = Date.now();
|
|
32
|
+
this.executionCount++;
|
|
33
|
+
// Simulate agent thinking time
|
|
34
|
+
await this.simulateThinking(task);
|
|
35
|
+
let success = false;
|
|
36
|
+
let taskErrors = [];
|
|
37
|
+
try {
|
|
38
|
+
// Naive approach: try random things, hope for best
|
|
39
|
+
success = await this.executeNaively(task, attempt);
|
|
40
|
+
if (!success) {
|
|
41
|
+
taskErrors.push('Random approach failed on attempt ' + attempt);
|
|
42
|
+
this.errors.push(...taskErrors);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
taskErrors.push(`Exception: ${error instanceof Error ? error.message : String(error)}`);
|
|
47
|
+
this.errors.push(...taskErrors);
|
|
48
|
+
}
|
|
49
|
+
const endTime = Date.now();
|
|
50
|
+
return {
|
|
51
|
+
taskId: task.id,
|
|
52
|
+
agent: this.name,
|
|
53
|
+
startTime,
|
|
54
|
+
endTime,
|
|
55
|
+
durationMs: endTime - startTime,
|
|
56
|
+
success,
|
|
57
|
+
attempts: attempt,
|
|
58
|
+
errors: taskErrors,
|
|
59
|
+
tokensUsed: Math.floor(Math.random() * 5000) + 1000, // Placeholder
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Execute task without any memory or context
|
|
64
|
+
*/
|
|
65
|
+
async executeNaively(task, attempt) {
|
|
66
|
+
// Simulate different success rates based on difficulty
|
|
67
|
+
// Without memory, the agent has to guess or try random approaches
|
|
68
|
+
const baseSuccessRate = {
|
|
69
|
+
easy: 0.4, // 40% success without memory
|
|
70
|
+
medium: 0.2, // 20% success without memory
|
|
71
|
+
hard: 0.05, // 5% success without memory
|
|
72
|
+
};
|
|
73
|
+
// Adjust for attempts (learning through trial and error only)
|
|
74
|
+
const attemptBonus = (attempt - 1) * 0.1; // 10% bonus per retry
|
|
75
|
+
const successRate = baseSuccessRate[task.difficulty] + attemptBonus;
|
|
76
|
+
// Roll for success
|
|
77
|
+
const succeeded = Math.random() < successRate;
|
|
78
|
+
if (succeeded) {
|
|
79
|
+
// Simulate successful execution
|
|
80
|
+
await this.simulateSuccess(task);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// Simulate failure
|
|
84
|
+
await this.simulateFailure(task);
|
|
85
|
+
}
|
|
86
|
+
return succeeded;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Simulate agent thinking/processing time
|
|
90
|
+
*/
|
|
91
|
+
async simulateThinking(task) {
|
|
92
|
+
// Naive agent takes longer because it has to rediscover everything
|
|
93
|
+
const baseTime = {
|
|
94
|
+
easy: 2000,
|
|
95
|
+
medium: 5000,
|
|
96
|
+
hard: 10000,
|
|
97
|
+
};
|
|
98
|
+
// Add random variation
|
|
99
|
+
const time = baseTime[task.difficulty] + (Math.random() * 2000);
|
|
100
|
+
await new Promise(resolve => setTimeout(resolve, time));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Simulate successful execution
|
|
104
|
+
*/
|
|
105
|
+
async simulateSuccess(task) {
|
|
106
|
+
// Check task verification (this will add test-specific validation)
|
|
107
|
+
try {
|
|
108
|
+
const result = await task.verify();
|
|
109
|
+
if (!result.success) {
|
|
110
|
+
throw new Error('Verification failed');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
// Should not happen in normal flow, but simulate occasional failures
|
|
115
|
+
console.error(`Unexpected verification failure: ${error}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Simulate failed execution
|
|
120
|
+
*/
|
|
121
|
+
async simulateFailure(_task) {
|
|
122
|
+
// Simulate making a mistake
|
|
123
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get agent statistics
|
|
127
|
+
*/
|
|
128
|
+
getStats() {
|
|
129
|
+
return {
|
|
130
|
+
name: this.name,
|
|
131
|
+
executionCount: this.executionCount,
|
|
132
|
+
totalErrors: this.errors.length,
|
|
133
|
+
recentErrors: this.errors.slice(-5),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Reset agent state (not really needed for naive agent, but for completeness)
|
|
138
|
+
*/
|
|
139
|
+
reset() {
|
|
140
|
+
this.executionCount = 0;
|
|
141
|
+
this.errors = [];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=naive-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naive-agent.js","sourceRoot":"","sources":["../../../src/benchmarks/agents/naive-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,OAAO,UAAU;IAID;IAHZ,cAAc,GAAG,CAAC,CAAC;IACnB,MAAM,GAAa,EAAE,CAAC;IAE9B,YAAoB,OAAe,aAAa;QAA5B,SAAI,GAAJ,IAAI,CAAwB;IAAG,CAAC;IAEpD;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,IAAmB,EAAE,UAAkB,CAAC;QACxD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,+BAA+B;QAC/B,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAElC,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,IAAI,UAAU,GAAa,EAAE,CAAC;QAE9B,IAAI,CAAC;YACH,mDAAmD;YACnD,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAEnD,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,UAAU,CAAC,IAAI,CAAC,oCAAoC,GAAG,OAAO,CAAC,CAAC;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;IACzD,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC/B,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACpC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UAM Agent - Memory Enabled
|
|
3
|
+
*
|
|
4
|
+
* Assumptions:
|
|
5
|
+
* - This agent has access to UAM memory system
|
|
6
|
+
* - Memory persists between tasks, providing context
|
|
7
|
+
* - Can recall previous decisions, patterns, and mistakes
|
|
8
|
+
* - Memory includes: file locations, patterns, mistakes, decisions
|
|
9
|
+
*
|
|
10
|
+
* What this handles:
|
|
11
|
+
* - Context retrieval from memory before tasks
|
|
12
|
+
* - Learning from previous mistakes (stored as gotchas)
|
|
13
|
+
* - Pattern recognition from past successful solutions
|
|
14
|
+
* - Knowledge of project structure
|
|
15
|
+
*
|
|
16
|
+
* What this does NOT handle:
|
|
17
|
+
* - Full semantic memory system (simulated for this benchmark)
|
|
18
|
+
* - Real AI/LLM integration (this is a simulation wrapper)
|
|
19
|
+
* - Multi-agent coordination (future enhancement)
|
|
20
|
+
*/
|
|
21
|
+
import { BenchmarkTask, AgentExecution } from '../benchmark.js';
|
|
22
|
+
interface MemoryEntry {
|
|
23
|
+
id: string;
|
|
24
|
+
timestamp: number;
|
|
25
|
+
type: 'action' | 'observation' | 'thought' | 'error' | 'lesson';
|
|
26
|
+
content: string;
|
|
27
|
+
context: {
|
|
28
|
+
taskId?: string;
|
|
29
|
+
category?: string;
|
|
30
|
+
difficulty?: string;
|
|
31
|
+
};
|
|
32
|
+
importance: number;
|
|
33
|
+
tags: string[];
|
|
34
|
+
}
|
|
35
|
+
declare class UAMMemory {
|
|
36
|
+
private shortTerm;
|
|
37
|
+
private longTerm;
|
|
38
|
+
private lessons;
|
|
39
|
+
private readonly MAX_SHORT_TERM;
|
|
40
|
+
/**
|
|
41
|
+
* Query memory for relevant context
|
|
42
|
+
*/
|
|
43
|
+
query(keywords: string[]): MemoryEntry[];
|
|
44
|
+
/**
|
|
45
|
+
* Store an action in memory
|
|
46
|
+
*/
|
|
47
|
+
storeAction(content: string, context: any): void;
|
|
48
|
+
/**
|
|
49
|
+
* Store an observation in memory
|
|
50
|
+
*/
|
|
51
|
+
storeObservation(content: string, context: any): void;
|
|
52
|
+
/**
|
|
53
|
+
* Store a lesson in memory
|
|
54
|
+
*/
|
|
55
|
+
storeLesson(content: string, tags: string[], importance?: number): void;
|
|
56
|
+
/**
|
|
57
|
+
* Store an error/gotcha in memory (to avoid repeating)
|
|
58
|
+
*/
|
|
59
|
+
storeError(error: string, context: any): void;
|
|
60
|
+
/**
|
|
61
|
+
* Check if memory contains specific lesson
|
|
62
|
+
*/
|
|
63
|
+
hasLesson(key: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Get all lessons
|
|
66
|
+
*/
|
|
67
|
+
getLessons(): MemoryEntry[];
|
|
68
|
+
/**
|
|
69
|
+
* Private: Store entry in appropriate memory tier
|
|
70
|
+
*/
|
|
71
|
+
private storeEntry;
|
|
72
|
+
/**
|
|
73
|
+
* Private: Consolidate memory when it gets too large
|
|
74
|
+
*/
|
|
75
|
+
private consolidateMemory;
|
|
76
|
+
/**
|
|
77
|
+
* Private: Generate unique ID
|
|
78
|
+
*/
|
|
79
|
+
private generateId;
|
|
80
|
+
/**
|
|
81
|
+
* Get memory statistics
|
|
82
|
+
*/
|
|
83
|
+
getStats(): {
|
|
84
|
+
shortTermCount: number;
|
|
85
|
+
longTermCount: number;
|
|
86
|
+
lessonsCount: number;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export declare class UAMAgent {
|
|
90
|
+
private name;
|
|
91
|
+
private executionCount;
|
|
92
|
+
private errors;
|
|
93
|
+
private memory;
|
|
94
|
+
constructor(name?: string);
|
|
95
|
+
/**
|
|
96
|
+
* Execute a task with memory context
|
|
97
|
+
*/
|
|
98
|
+
executeTask(task: BenchmarkTask, attempt?: number): Promise<AgentExecution>;
|
|
99
|
+
/**
|
|
100
|
+
* Query memory for context relevant to the task
|
|
101
|
+
*/
|
|
102
|
+
private queryMemoryContext;
|
|
103
|
+
/**
|
|
104
|
+
* Get lessons relevant to the task
|
|
105
|
+
*/
|
|
106
|
+
private getRelevantLessons;
|
|
107
|
+
/**
|
|
108
|
+
* Check for past mistakes to avoid
|
|
109
|
+
*/
|
|
110
|
+
private checkForPastMistakes;
|
|
111
|
+
/**
|
|
112
|
+
* Execute task using memory context
|
|
113
|
+
*/
|
|
114
|
+
private executeWithMemory;
|
|
115
|
+
/**
|
|
116
|
+
* Simulate agent thinking/processing time (faster than naive)
|
|
117
|
+
*/
|
|
118
|
+
private simulateThinking;
|
|
119
|
+
/**
|
|
120
|
+
* Simulate successful execution
|
|
121
|
+
*/
|
|
122
|
+
private simulateSuccess;
|
|
123
|
+
/**
|
|
124
|
+
* Simulate failed execution
|
|
125
|
+
*/
|
|
126
|
+
private simulateFailure;
|
|
127
|
+
/**
|
|
128
|
+
* Store memory after successful execution
|
|
129
|
+
*/
|
|
130
|
+
private storeSuccessMemory;
|
|
131
|
+
/**
|
|
132
|
+
* Store memory after failed execution
|
|
133
|
+
*/
|
|
134
|
+
private storeFailureMemory;
|
|
135
|
+
/**
|
|
136
|
+
* Extract keywords from text
|
|
137
|
+
*/
|
|
138
|
+
private extractKeywords;
|
|
139
|
+
/**
|
|
140
|
+
* Pre-populate memory with common lessons
|
|
141
|
+
*/
|
|
142
|
+
private prepopulateMemory;
|
|
143
|
+
/**
|
|
144
|
+
* Get agent statistics
|
|
145
|
+
*/
|
|
146
|
+
getStats(): {
|
|
147
|
+
name: string;
|
|
148
|
+
executionCount: number;
|
|
149
|
+
totalErrors: number;
|
|
150
|
+
recentErrors: string[];
|
|
151
|
+
memoryStats: {
|
|
152
|
+
shortTermCount: number;
|
|
153
|
+
longTermCount: number;
|
|
154
|
+
lessonsCount: number;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Reset agent and memory
|
|
159
|
+
*/
|
|
160
|
+
reset(): void;
|
|
161
|
+
/**
|
|
162
|
+
* Get access to memory (for debugging)
|
|
163
|
+
*/
|
|
164
|
+
getMemory(): UAMMemory;
|
|
165
|
+
}
|
|
166
|
+
export type { MemoryEntry };
|
|
167
|
+
//# sourceMappingURL=uam-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uam-agent.d.ts","sourceRoot":"","sources":["../../../src/benchmarks/agents/uam-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMhE,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,cAAM,SAAS;IACb,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,OAAO,CAAuC;IAEtD,OAAO,CAAC,QAAQ,CAAC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