@bluehawks/cli 1.0.3 → 1.0.4
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/.bluehawks/history.json +3 -12
- package/dist/config/constants.d.ts +1 -1
- package/dist/config/constants.js +1 -1
- package/dist/core/agents/orchestrator.d.ts.map +1 -1
- package/dist/core/agents/orchestrator.js +11 -1
- package/dist/core/agents/orchestrator.js.map +1 -1
- package/dist/core/api/client.d.ts +5 -1
- package/dist/core/api/client.d.ts.map +1 -1
- package/dist/core/api/client.js +10 -0
- package/dist/core/api/client.js.map +1 -1
- package/dist/core/api/types.d.ts +19 -0
- package/dist/core/api/types.d.ts.map +1 -1
- package/dist/core/api/types.js.map +1 -1
- package/dist/core/memory/index.d.ts +4 -0
- package/dist/core/memory/index.d.ts.map +1 -0
- package/dist/core/memory/index.js +4 -0
- package/dist/core/memory/index.js.map +1 -0
- package/dist/core/memory/manager.d.ts +29 -0
- package/dist/core/memory/manager.d.ts.map +1 -0
- package/dist/core/memory/manager.js +106 -0
- package/dist/core/memory/manager.js.map +1 -0
- package/dist/core/memory/storage.d.ts +15 -0
- package/dist/core/memory/storage.d.ts.map +1 -0
- package/dist/core/memory/storage.js +77 -0
- package/dist/core/memory/storage.js.map +1 -0
- package/dist/core/memory/types.d.ts +20 -0
- package/dist/core/memory/types.d.ts.map +1 -0
- package/dist/core/memory/types.js +2 -0
- package/dist/core/memory/types.js.map +1 -0
- package/dist/core/tools/definitions/index.d.ts +1 -0
- package/dist/core/tools/definitions/index.d.ts.map +1 -1
- package/dist/core/tools/definitions/index.js +3 -0
- package/dist/core/tools/definitions/index.js.map +1 -1
- package/dist/core/tools/definitions/memory.d.ts +2 -0
- package/dist/core/tools/definitions/memory.d.ts.map +1 -0
- package/dist/core/tools/definitions/memory.js +155 -0
- package/dist/core/tools/definitions/memory.js.map +1 -0
- package/package.json +3 -1
- package/src/config/constants.ts +1 -1
- package/src/core/agents/orchestrator.ts +13 -2
- package/src/core/api/client.ts +17 -0
- package/src/core/api/types.ts +23 -0
- package/src/core/memory/index.ts +3 -0
- package/src/core/memory/manager.ts +120 -0
- package/src/core/memory/storage.ts +90 -0
- package/src/core/memory/types.ts +22 -0
- package/src/core/tools/definitions/index.ts +3 -0
- package/src/core/tools/definitions/memory.ts +171 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { toolRegistry, type ToolHandler } from '../registry.js';
|
|
2
|
+
import { memoryManager } from '../../memory/index.js';
|
|
3
|
+
|
|
4
|
+
// Remember Tool
|
|
5
|
+
const rememberTool: ToolHandler = {
|
|
6
|
+
name: 'remember',
|
|
7
|
+
safeToAutoRun: true,
|
|
8
|
+
definition: {
|
|
9
|
+
type: 'function',
|
|
10
|
+
function: {
|
|
11
|
+
name: 'remember',
|
|
12
|
+
description:
|
|
13
|
+
'Store a piece of information, preference, or concept in long-term memory. Use this to remember user choices, project guidelines, or important facts.',
|
|
14
|
+
parameters: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
content: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'The information to remember.',
|
|
20
|
+
},
|
|
21
|
+
type: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
enum: ['preference', 'mistake', 'knowledge', 'task_context'],
|
|
24
|
+
description: 'The type of memory. Default is knowledge.',
|
|
25
|
+
},
|
|
26
|
+
tags: {
|
|
27
|
+
type: 'array',
|
|
28
|
+
items: { type: 'string' },
|
|
29
|
+
description: 'Tags to categorize this memory.',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
required: ['content'],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
async execute(args) {
|
|
37
|
+
const content = args.content as string;
|
|
38
|
+
const type = (args.type as any) || 'knowledge';
|
|
39
|
+
const tags = (args.tags as string[]) || [];
|
|
40
|
+
|
|
41
|
+
const memory = await memoryManager.remember(content, type, { tags });
|
|
42
|
+
return `Remembered: "${content}" (ID: ${memory.id})`;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Recall Tool
|
|
47
|
+
const recallTool: ToolHandler = {
|
|
48
|
+
name: 'recall',
|
|
49
|
+
safeToAutoRun: true,
|
|
50
|
+
definition: {
|
|
51
|
+
type: 'function',
|
|
52
|
+
function: {
|
|
53
|
+
name: 'recall',
|
|
54
|
+
description:
|
|
55
|
+
'Search long-term memory for relevant information. Use this to find past decisions, user preferences, or project guidelines.',
|
|
56
|
+
parameters: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
properties: {
|
|
59
|
+
query: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
description: 'The search query to find relevant memories.',
|
|
62
|
+
},
|
|
63
|
+
limit: {
|
|
64
|
+
type: 'number',
|
|
65
|
+
description: 'Maximum number of results to return. Default is 5.',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
required: ['query'],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
async execute(args) {
|
|
73
|
+
const query = args.query as string;
|
|
74
|
+
const limit = (args.limit as number) || 5;
|
|
75
|
+
|
|
76
|
+
const results = await memoryManager.search(query, limit);
|
|
77
|
+
if (results.length === 0) {
|
|
78
|
+
return 'No relevant memories found.';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return results
|
|
82
|
+
.map(
|
|
83
|
+
(m) =>
|
|
84
|
+
`[${m.type.toUpperCase()}] ${m.content} (Similarity: ${(m.similarity * 100).toFixed(1)}%)`
|
|
85
|
+
)
|
|
86
|
+
.join('\n');
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Forget Tool
|
|
91
|
+
const forgetTool: ToolHandler = {
|
|
92
|
+
name: 'forget',
|
|
93
|
+
safeToAutoRun: false, // Deletion is unsafe
|
|
94
|
+
definition: {
|
|
95
|
+
type: 'function',
|
|
96
|
+
function: {
|
|
97
|
+
name: 'forget',
|
|
98
|
+
description: 'Delete a memory by its ID.',
|
|
99
|
+
parameters: {
|
|
100
|
+
type: 'object',
|
|
101
|
+
properties: {
|
|
102
|
+
id: {
|
|
103
|
+
type: 'string',
|
|
104
|
+
description: 'The ID of the memory to delete.',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
required: ['id'],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
async execute(args) {
|
|
112
|
+
const id = args.id as string;
|
|
113
|
+
await memoryManager.forget(id);
|
|
114
|
+
return `Forgot memory with ID: ${id}`;
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// Learn Mistake Tool
|
|
119
|
+
const learnMistakeTool: ToolHandler = {
|
|
120
|
+
name: 'learn_mistake',
|
|
121
|
+
safeToAutoRun: true, // Learning is safe
|
|
122
|
+
definition: {
|
|
123
|
+
type: 'function',
|
|
124
|
+
function: {
|
|
125
|
+
name: 'learn_mistake',
|
|
126
|
+
description:
|
|
127
|
+
'Record a mistake and its solution to avoid repeating it in the future.',
|
|
128
|
+
parameters: {
|
|
129
|
+
type: 'object',
|
|
130
|
+
properties: {
|
|
131
|
+
error: {
|
|
132
|
+
type: 'string',
|
|
133
|
+
description: 'The error or mistake that occurred.',
|
|
134
|
+
},
|
|
135
|
+
fix: {
|
|
136
|
+
type: 'string',
|
|
137
|
+
description: 'The solution or lesson learned.',
|
|
138
|
+
},
|
|
139
|
+
context: {
|
|
140
|
+
type: 'string',
|
|
141
|
+
description: 'Optional context (e.g., file path, command).',
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
required: ['error', 'fix'],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
async execute(args) {
|
|
149
|
+
const error = args.error as string;
|
|
150
|
+
const fix = args.fix as string;
|
|
151
|
+
const context = args.context as string | undefined;
|
|
152
|
+
|
|
153
|
+
const content = `Mistake: ${error}\nSolution: ${fix}${context ? `\nContext: ${context}` : ''}`;
|
|
154
|
+
|
|
155
|
+
const memory = await memoryManager.remember(content, 'mistake', {
|
|
156
|
+
originalError: error,
|
|
157
|
+
fix,
|
|
158
|
+
context,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
return `Recorded mistake and solution (ID: ${memory.id}). I will remember this to avoid it in the future.`;
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Register all memory tools
|
|
166
|
+
export function registerMemoryTools(): void {
|
|
167
|
+
toolRegistry.register(rememberTool);
|
|
168
|
+
toolRegistry.register(recallTool);
|
|
169
|
+
toolRegistry.register(forgetTool);
|
|
170
|
+
toolRegistry.register(learnMistakeTool);
|
|
171
|
+
}
|