@alexnetrebskii/hive-agent 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +425 -0
- package/dist/agent.d.ts +24 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +277 -0
- package/dist/agent.js.map +1 -0
- package/dist/context.d.ts +52 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +124 -0
- package/dist/context.js.map +1 -0
- package/dist/executor.d.ts +29 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +349 -0
- package/dist/executor.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/prompt.d.ts +31 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +84 -0
- package/dist/prompt.js.map +1 -0
- package/dist/providers/index.d.ts +11 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +8 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/llm/base.d.ts +7 -0
- package/dist/providers/llm/base.d.ts.map +1 -0
- package/dist/providers/llm/base.js +7 -0
- package/dist/providers/llm/base.js.map +1 -0
- package/dist/providers/llm/claude.d.ts +31 -0
- package/dist/providers/llm/claude.d.ts.map +1 -0
- package/dist/providers/llm/claude.js +180 -0
- package/dist/providers/llm/claude.js.map +1 -0
- package/dist/providers/llm/openai.d.ts +25 -0
- package/dist/providers/llm/openai.d.ts.map +1 -0
- package/dist/providers/llm/openai.js +171 -0
- package/dist/providers/llm/openai.js.map +1 -0
- package/dist/providers/logger/base.d.ts +7 -0
- package/dist/providers/logger/base.d.ts.map +1 -0
- package/dist/providers/logger/base.js +7 -0
- package/dist/providers/logger/base.js.map +1 -0
- package/dist/providers/logger/console.d.ts +29 -0
- package/dist/providers/logger/console.d.ts.map +1 -0
- package/dist/providers/logger/console.js +71 -0
- package/dist/providers/logger/console.js.map +1 -0
- package/dist/providers/repository/base.d.ts +7 -0
- package/dist/providers/repository/base.d.ts.map +1 -0
- package/dist/providers/repository/base.js +7 -0
- package/dist/providers/repository/base.js.map +1 -0
- package/dist/providers/repository/memory.d.ts +21 -0
- package/dist/providers/repository/memory.d.ts.map +1 -0
- package/dist/providers/repository/memory.js +50 -0
- package/dist/providers/repository/memory.js.map +1 -0
- package/dist/review.d.ts +68 -0
- package/dist/review.d.ts.map +1 -0
- package/dist/review.js +263 -0
- package/dist/review.js.map +1 -0
- package/dist/todo.d.ts +73 -0
- package/dist/todo.d.ts.map +1 -0
- package/dist/todo.js +320 -0
- package/dist/todo.js.map +1 -0
- package/dist/types.d.ts +257 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +43 -0
package/dist/executor.js
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executor - Tool Execution Loop
|
|
3
|
+
*
|
|
4
|
+
* Core execution loop that runs tools and handles agent responses.
|
|
5
|
+
*/
|
|
6
|
+
const ASK_USER_TOOL_NAME = '__ask_user__';
|
|
7
|
+
/**
|
|
8
|
+
* Extract text from content blocks
|
|
9
|
+
*/
|
|
10
|
+
function extractText(content) {
|
|
11
|
+
return content
|
|
12
|
+
.filter((block) => block.type === 'text')
|
|
13
|
+
.map(block => block.text)
|
|
14
|
+
.join('\n');
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Extract thinking blocks
|
|
18
|
+
*/
|
|
19
|
+
function extractThinking(content) {
|
|
20
|
+
return content
|
|
21
|
+
.filter((block) => block.type === 'thinking')
|
|
22
|
+
.map(block => block.thinking);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Convert tools to schemas for LLM
|
|
26
|
+
*/
|
|
27
|
+
function toolsToSchemas(tools) {
|
|
28
|
+
return tools.map(tool => ({
|
|
29
|
+
name: tool.name,
|
|
30
|
+
description: tool.description,
|
|
31
|
+
input_schema: tool.parameters
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Execute a single tool
|
|
36
|
+
*/
|
|
37
|
+
async function executeTool(tool, params, context, logger) {
|
|
38
|
+
const startTime = Date.now();
|
|
39
|
+
// Progress: tool starting (with context for specific tools)
|
|
40
|
+
let progressMessage = `Running ${tool.name}...`;
|
|
41
|
+
if (tool.name === '__todo__') {
|
|
42
|
+
const action = params.action;
|
|
43
|
+
const items = params.items;
|
|
44
|
+
if (action === 'set' && items) {
|
|
45
|
+
progressMessage = `Creating ${items.length} tasks...`;
|
|
46
|
+
}
|
|
47
|
+
else if (action === 'complete') {
|
|
48
|
+
progressMessage = `Marking task complete...`;
|
|
49
|
+
}
|
|
50
|
+
else if (action === 'list') {
|
|
51
|
+
progressMessage = `Checking tasks...`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else if (tool.name === '__task__') {
|
|
55
|
+
const agent = params.agent;
|
|
56
|
+
progressMessage = `Delegating to ${agent}...`;
|
|
57
|
+
}
|
|
58
|
+
else if (tool.name === 'search_food') {
|
|
59
|
+
const query = params.query;
|
|
60
|
+
progressMessage = `Searching for "${query}"...`;
|
|
61
|
+
}
|
|
62
|
+
else if (tool.name === 'log_meal') {
|
|
63
|
+
const food = params.food;
|
|
64
|
+
progressMessage = `Logging ${food}...`;
|
|
65
|
+
}
|
|
66
|
+
logger?.onProgress?.({
|
|
67
|
+
type: 'tool_start',
|
|
68
|
+
message: progressMessage,
|
|
69
|
+
details: { toolName: tool.name }
|
|
70
|
+
});
|
|
71
|
+
logger?.onToolCall?.(tool.name, params);
|
|
72
|
+
try {
|
|
73
|
+
const result = await tool.execute(params, context);
|
|
74
|
+
const durationMs = Date.now() - startTime;
|
|
75
|
+
// Progress: tool completed (with result context)
|
|
76
|
+
let completionMessage = `${tool.name} completed`;
|
|
77
|
+
if (tool.name === '__todo__' && result.success && result.data) {
|
|
78
|
+
const data = result.data;
|
|
79
|
+
if (data.message) {
|
|
80
|
+
completionMessage = data.message;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else if (tool.name === 'search_food' && result.success && result.data) {
|
|
84
|
+
const data = result.data;
|
|
85
|
+
completionMessage = `Found ${data.count || 0} results`;
|
|
86
|
+
}
|
|
87
|
+
else if (tool.name === 'log_meal' && result.success && result.data) {
|
|
88
|
+
const data = result.data;
|
|
89
|
+
completionMessage = data.message || 'Meal logged';
|
|
90
|
+
}
|
|
91
|
+
logger?.onProgress?.({
|
|
92
|
+
type: 'tool_end',
|
|
93
|
+
message: completionMessage,
|
|
94
|
+
details: { toolName: tool.name, duration: durationMs, success: result.success }
|
|
95
|
+
});
|
|
96
|
+
logger?.onToolResult?.(tool.name, result, durationMs);
|
|
97
|
+
return { result, durationMs };
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
const durationMs = Date.now() - startTime;
|
|
101
|
+
const result = {
|
|
102
|
+
success: false,
|
|
103
|
+
error: error instanceof Error ? error.message : String(error)
|
|
104
|
+
};
|
|
105
|
+
// Progress: tool failed
|
|
106
|
+
logger?.onProgress?.({
|
|
107
|
+
type: 'tool_end',
|
|
108
|
+
message: `${tool.name} failed`,
|
|
109
|
+
details: { toolName: tool.name, duration: durationMs, success: false }
|
|
110
|
+
});
|
|
111
|
+
logger?.onToolResult?.(tool.name, result, durationMs);
|
|
112
|
+
return { result, durationMs };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Check if execution should be interrupted
|
|
117
|
+
*/
|
|
118
|
+
async function checkInterruption(signal, shouldContinue) {
|
|
119
|
+
// Check AbortSignal
|
|
120
|
+
if (signal?.aborted) {
|
|
121
|
+
return 'aborted';
|
|
122
|
+
}
|
|
123
|
+
// Check shouldContinue callback
|
|
124
|
+
if (shouldContinue) {
|
|
125
|
+
const continueExecution = await shouldContinue();
|
|
126
|
+
if (!continueExecution) {
|
|
127
|
+
return 'stopped';
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Clean up history after interruption
|
|
134
|
+
* If the last assistant message has tool_use blocks without corresponding tool_results,
|
|
135
|
+
* add cancelled tool_results to make the history valid for the next API call.
|
|
136
|
+
*/
|
|
137
|
+
function cleanupInterruptedHistory(messages) {
|
|
138
|
+
if (messages.length === 0)
|
|
139
|
+
return messages;
|
|
140
|
+
const lastMessage = messages[messages.length - 1];
|
|
141
|
+
// Check if last message is assistant with tool_use blocks
|
|
142
|
+
if (lastMessage.role === 'assistant' && Array.isArray(lastMessage.content)) {
|
|
143
|
+
const toolUseBlocks = lastMessage.content.filter((block) => block.type === 'tool_use');
|
|
144
|
+
if (toolUseBlocks.length > 0) {
|
|
145
|
+
// Check if there's already a user message with tool_results after this
|
|
146
|
+
// (there shouldn't be if we're interrupted, but check anyway)
|
|
147
|
+
const needsToolResults = true; // We're interrupted, so we need to add them
|
|
148
|
+
if (needsToolResults) {
|
|
149
|
+
// Add cancelled tool_results for all tool_use blocks
|
|
150
|
+
const cancelledResults = toolUseBlocks.map(toolUse => ({
|
|
151
|
+
type: 'tool_result',
|
|
152
|
+
tool_use_id: toolUse.id,
|
|
153
|
+
content: JSON.stringify({
|
|
154
|
+
success: false,
|
|
155
|
+
error: 'Operation cancelled by user'
|
|
156
|
+
}),
|
|
157
|
+
is_error: true
|
|
158
|
+
}));
|
|
159
|
+
return [
|
|
160
|
+
...messages,
|
|
161
|
+
{ role: 'user', content: cancelledResults }
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return messages;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Build interrupted result
|
|
170
|
+
*/
|
|
171
|
+
function buildInterruptedResult(reason, iteration, messages, toolCallLogs, thinkingBlocks, todoManager, usage) {
|
|
172
|
+
const todos = todoManager.getAll();
|
|
173
|
+
// Clean up history to ensure it's valid for continuation
|
|
174
|
+
const cleanedHistory = cleanupInterruptedHistory(messages);
|
|
175
|
+
return {
|
|
176
|
+
response: '',
|
|
177
|
+
history: cleanedHistory,
|
|
178
|
+
toolCalls: toolCallLogs,
|
|
179
|
+
thinking: thinkingBlocks.length > 0 ? thinkingBlocks : undefined,
|
|
180
|
+
todos: todos.length > 0 ? todos : undefined,
|
|
181
|
+
status: 'interrupted',
|
|
182
|
+
interrupted: {
|
|
183
|
+
reason,
|
|
184
|
+
iterationsCompleted: iteration
|
|
185
|
+
},
|
|
186
|
+
usage: {
|
|
187
|
+
totalInputTokens: usage.totalInputTokens,
|
|
188
|
+
totalOutputTokens: usage.totalOutputTokens,
|
|
189
|
+
cacheCreationInputTokens: usage.totalCacheCreationTokens > 0 ? usage.totalCacheCreationTokens : undefined,
|
|
190
|
+
cacheReadInputTokens: usage.totalCacheReadTokens > 0 ? usage.totalCacheReadTokens : undefined
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Main execution loop
|
|
196
|
+
*/
|
|
197
|
+
export async function executeLoop(config, initialMessages, toolContext) {
|
|
198
|
+
const { systemPrompt, tools, llm, logger, maxIterations, contextManager, todoManager, reviewManager, llmOptions, signal, shouldContinue } = config;
|
|
199
|
+
const messages = [...initialMessages];
|
|
200
|
+
const toolCallLogs = [];
|
|
201
|
+
const thinkingBlocks = [];
|
|
202
|
+
const toolSchemas = toolsToSchemas(tools);
|
|
203
|
+
let totalInputTokens = 0;
|
|
204
|
+
let totalOutputTokens = 0;
|
|
205
|
+
let totalCacheCreationTokens = 0;
|
|
206
|
+
let totalCacheReadTokens = 0;
|
|
207
|
+
for (let iteration = 0; iteration < maxIterations; iteration++) {
|
|
208
|
+
// Check for interruption at start of each iteration
|
|
209
|
+
const interruptReason = await checkInterruption(signal, shouldContinue);
|
|
210
|
+
if (interruptReason) {
|
|
211
|
+
logger?.onProgress?.({
|
|
212
|
+
type: 'status',
|
|
213
|
+
message: `Interrupted: ${interruptReason}`
|
|
214
|
+
});
|
|
215
|
+
return buildInterruptedResult(interruptReason, iteration, messages, toolCallLogs, thinkingBlocks, todoManager, { totalInputTokens, totalOutputTokens, totalCacheCreationTokens, totalCacheReadTokens });
|
|
216
|
+
}
|
|
217
|
+
logger?.onIteration?.(iteration, messages.length);
|
|
218
|
+
// Progress: thinking
|
|
219
|
+
logger?.onProgress?.({
|
|
220
|
+
type: 'thinking',
|
|
221
|
+
message: iteration === 0 ? 'Thinking...' : 'Processing...'
|
|
222
|
+
});
|
|
223
|
+
// Manage context (truncate if needed)
|
|
224
|
+
const managedMessages = contextManager.manageContext(messages);
|
|
225
|
+
// Call LLM
|
|
226
|
+
const response = await llm.chat(systemPrompt, managedMessages, toolSchemas, llmOptions);
|
|
227
|
+
// Track usage
|
|
228
|
+
if (response.usage) {
|
|
229
|
+
totalInputTokens += response.usage.inputTokens;
|
|
230
|
+
totalOutputTokens += response.usage.outputTokens;
|
|
231
|
+
}
|
|
232
|
+
if (response.cacheUsage) {
|
|
233
|
+
totalCacheCreationTokens += response.cacheUsage.cacheCreationInputTokens;
|
|
234
|
+
totalCacheReadTokens += response.cacheUsage.cacheReadInputTokens;
|
|
235
|
+
}
|
|
236
|
+
// Collect thinking blocks
|
|
237
|
+
thinkingBlocks.push(...extractThinking(response.content));
|
|
238
|
+
// Add assistant message to history
|
|
239
|
+
messages.push({ role: 'assistant', content: response.content });
|
|
240
|
+
// Check if done (no tool use)
|
|
241
|
+
if (response.stopReason !== 'tool_use') {
|
|
242
|
+
const todos = todoManager.getAll();
|
|
243
|
+
const incompleteTodos = todos.filter(t => t.status !== 'completed');
|
|
244
|
+
// If there are incomplete todos, force the agent to continue working
|
|
245
|
+
if (incompleteTodos.length > 0) {
|
|
246
|
+
logger?.onProgress?.({
|
|
247
|
+
type: 'status',
|
|
248
|
+
message: `${incompleteTodos.length} tasks remaining, continuing...`
|
|
249
|
+
});
|
|
250
|
+
// Add a reminder to continue working on todos
|
|
251
|
+
const reminderContent = `You have ${incompleteTodos.length} incomplete task(s) in your todo list:\n${incompleteTodos.map(t => `- ${t.status === 'in_progress' ? '[IN PROGRESS] ' : ''}${t.content}`).join('\n')}\n\nYou MUST continue working on these tasks. Use the __todo__ tool with action "complete" after finishing each task. Do not respond to the user until all tasks are completed.`;
|
|
252
|
+
messages.push({
|
|
253
|
+
role: 'user',
|
|
254
|
+
content: reminderContent
|
|
255
|
+
});
|
|
256
|
+
// Continue the loop instead of returning
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
const review = reviewManager?.getCurrentReview();
|
|
260
|
+
const result = {
|
|
261
|
+
response: extractText(response.content),
|
|
262
|
+
history: messages,
|
|
263
|
+
toolCalls: toolCallLogs,
|
|
264
|
+
thinking: thinkingBlocks.length > 0 ? thinkingBlocks : undefined,
|
|
265
|
+
todos: todos.length > 0 ? todos : undefined,
|
|
266
|
+
review,
|
|
267
|
+
status: 'complete',
|
|
268
|
+
usage: {
|
|
269
|
+
totalInputTokens,
|
|
270
|
+
totalOutputTokens,
|
|
271
|
+
cacheCreationInputTokens: totalCacheCreationTokens > 0 ? totalCacheCreationTokens : undefined,
|
|
272
|
+
cacheReadInputTokens: totalCacheReadTokens > 0 ? totalCacheReadTokens : undefined
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
logger?.onComplete?.(result);
|
|
276
|
+
return result;
|
|
277
|
+
}
|
|
278
|
+
// Execute tool calls
|
|
279
|
+
const toolUseBlocks = response.content.filter((block) => block.type === 'tool_use');
|
|
280
|
+
const toolResults = [];
|
|
281
|
+
for (const toolUse of toolUseBlocks) {
|
|
282
|
+
// Check for interruption between tool calls
|
|
283
|
+
const toolInterruptReason = await checkInterruption(signal, shouldContinue);
|
|
284
|
+
if (toolInterruptReason) {
|
|
285
|
+
logger?.onProgress?.({
|
|
286
|
+
type: 'status',
|
|
287
|
+
message: `Interrupted between tools: ${toolInterruptReason}`
|
|
288
|
+
});
|
|
289
|
+
return buildInterruptedResult(toolInterruptReason, iteration, messages, toolCallLogs, thinkingBlocks, todoManager, { totalInputTokens, totalOutputTokens, totalCacheCreationTokens, totalCacheReadTokens });
|
|
290
|
+
}
|
|
291
|
+
// Handle ask_user tool specially
|
|
292
|
+
if (toolUse.name === ASK_USER_TOOL_NAME) {
|
|
293
|
+
const pendingQuestion = {
|
|
294
|
+
question: toolUse.input.question,
|
|
295
|
+
options: toolUse.input.options
|
|
296
|
+
};
|
|
297
|
+
const todos = todoManager.getAll();
|
|
298
|
+
return {
|
|
299
|
+
response: '',
|
|
300
|
+
history: messages,
|
|
301
|
+
toolCalls: toolCallLogs,
|
|
302
|
+
thinking: thinkingBlocks.length > 0 ? thinkingBlocks : undefined,
|
|
303
|
+
todos: todos.length > 0 ? todos : undefined,
|
|
304
|
+
pendingQuestion,
|
|
305
|
+
status: 'needs_input',
|
|
306
|
+
usage: {
|
|
307
|
+
totalInputTokens,
|
|
308
|
+
totalOutputTokens,
|
|
309
|
+
cacheCreationInputTokens: totalCacheCreationTokens > 0 ? totalCacheCreationTokens : undefined,
|
|
310
|
+
cacheReadInputTokens: totalCacheReadTokens > 0 ? totalCacheReadTokens : undefined
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
// Find and execute the tool
|
|
315
|
+
const tool = tools.find(t => t.name === toolUse.name);
|
|
316
|
+
if (!tool) {
|
|
317
|
+
toolResults.push({
|
|
318
|
+
type: 'tool_result',
|
|
319
|
+
tool_use_id: toolUse.id,
|
|
320
|
+
content: JSON.stringify({ success: false, error: `Unknown tool: ${toolUse.name}` }),
|
|
321
|
+
is_error: true
|
|
322
|
+
});
|
|
323
|
+
continue;
|
|
324
|
+
}
|
|
325
|
+
const { result, durationMs } = await executeTool(tool, toolUse.input, toolContext, logger);
|
|
326
|
+
toolCallLogs.push({
|
|
327
|
+
name: toolUse.name,
|
|
328
|
+
input: toolUse.input,
|
|
329
|
+
output: result,
|
|
330
|
+
durationMs
|
|
331
|
+
});
|
|
332
|
+
toolResults.push({
|
|
333
|
+
type: 'tool_result',
|
|
334
|
+
tool_use_id: toolUse.id,
|
|
335
|
+
content: JSON.stringify(result),
|
|
336
|
+
is_error: !result.success
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
// Add tool results as user message
|
|
340
|
+
messages.push({ role: 'user', content: toolResults });
|
|
341
|
+
}
|
|
342
|
+
// Max iterations reached - return as interrupted instead of throwing
|
|
343
|
+
logger?.onProgress?.({
|
|
344
|
+
type: 'status',
|
|
345
|
+
message: `Max iterations (${maxIterations}) reached`
|
|
346
|
+
});
|
|
347
|
+
return buildInterruptedResult('max_iterations', maxIterations, messages, toolCallLogs, thinkingBlocks, todoManager, { totalInputTokens, totalOutputTokens, totalCacheCreationTokens, totalCacheReadTokens });
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsBH,MAAM,kBAAkB,GAAG,cAAc,CAAA;AAoBzC;;GAEG;AACH,SAAS,WAAW,CAAC,OAAuB;IAC1C,OAAO,OAAO;SACX,MAAM,CAAC,CAAC,KAAK,EAA2C,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;SACjF,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;SACxB,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,OAAuB;IAC9C,OAAO,OAAO;SACX,MAAM,CAAC,CAAC,KAAK,EAAmD,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;SAC7F,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;AACjC,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,GAAG,CAAC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E,CAAC,MAAM,CAAC,OAAO;aAC1B,CAAC,CAAA;QACJ,CAAC;QAED,mCAAmC;QACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;IACvD,CAAC;IAED,qEAAqE;IACrE,MAAM,EAAE,UAAU,EAAE,CAAC;QACnB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,mBAAmB,aAAa,WAAW;KACrD,CAAC,CAAA;IAEF,OAAO,sBAAsB,CAC3B,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,WAAW,EACX,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,CACxF,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hive Agent Framework
|
|
3
|
+
*
|
|
4
|
+
* Minimal TypeScript agent framework inspired by Claude Code architecture.
|
|
5
|
+
*/
|
|
6
|
+
export { Hive } from './agent.js';
|
|
7
|
+
export type { Message, MessageRole, ContentBlock, TextBlock, ThinkingBlock, ToolUseBlock, ToolResultBlock, Tool, ToolSchema, ToolResult, ToolContext, ToolCallLog, JSONSchema, HiveConfig, SubAgentConfig, RunOptions, AgentResult, AgentStatus, PendingQuestion, TodoItem, TodoStatus, TodoList, LLMProvider, LLMResponse, LLMOptions, StopReason, LogProvider, RepositoryProvider, ProgressUpdate, CacheConfig, CacheUsage, ReviewResult, ReviewIssue, ReviewSeverity, ReviewConfig, ContextStrategy, SystemPromptConfig, EnvironmentInfo } from './types.js';
|
|
8
|
+
export { ClaudeProvider, type ClaudeProviderConfig } from './providers/llm/claude.js';
|
|
9
|
+
export { OpenAIProvider, type OpenAIProviderConfig } from './providers/llm/openai.js';
|
|
10
|
+
export { ConsoleLogger, type ConsoleLoggerConfig, type LogLevel } from './providers/logger/console.js';
|
|
11
|
+
export { MemoryRepository } from './providers/repository/memory.js';
|
|
12
|
+
export { estimateTokens, estimateMessageTokens, estimateTotalTokens, truncateOldMessages, ContextManager } from './context.js';
|
|
13
|
+
export { buildSystemPrompt, buildEnvironmentSection, buildRemindersSection, getCurrentEnvironment, DEFAULT_SYSTEM_PROMPT } from './prompt.js';
|
|
14
|
+
export { TodoManager, formatTodoList } from './todo.js';
|
|
15
|
+
export { ReviewManager, formatReviewResult, buildReviewInstructions, DEFAULT_REVIEW_CATEGORIES } from './review.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGjC,YAAY,EAEV,OAAO,EACP,WAAW,EACX,YAAY,EACZ,SAAS,EACT,aAAa,EACb,YAAY,EACZ,eAAe,EAGf,IAAI,EACJ,UAAU,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EAGV,UAAU,EACV,cAAc,EACd,UAAU,EACV,WAAW,EACX,WAAW,EACX,eAAe,EAGf,QAAQ,EACR,UAAU,EACV,QAAQ,EAGR,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,cAAc,EAGd,WAAW,EACX,UAAU,EAGV,YAAY,EACZ,WAAW,EACX,cAAc,EACd,YAAY,EAGZ,eAAe,EACf,kBAAkB,EAClB,eAAe,EAChB,MAAM,YAAY,CAAA;AAGnB,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACd,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EACL,gBAAgB,EACjB,MAAM,kCAAkC,CAAA;AAGzC,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACf,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAGpB,OAAO,EACL,WAAW,EACX,cAAc,EACf,MAAM,WAAW,CAAA;AAGlB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,aAAa,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hive Agent Framework
|
|
3
|
+
*
|
|
4
|
+
* Minimal TypeScript agent framework inspired by Claude Code architecture.
|
|
5
|
+
*/
|
|
6
|
+
// Main agent class
|
|
7
|
+
export { Hive } from './agent.js';
|
|
8
|
+
// Providers
|
|
9
|
+
export { ClaudeProvider } from './providers/llm/claude.js';
|
|
10
|
+
export { OpenAIProvider } from './providers/llm/openai.js';
|
|
11
|
+
export { ConsoleLogger } from './providers/logger/console.js';
|
|
12
|
+
export { MemoryRepository } from './providers/repository/memory.js';
|
|
13
|
+
// Utilities
|
|
14
|
+
export { estimateTokens, estimateMessageTokens, estimateTotalTokens, truncateOldMessages, ContextManager } from './context.js';
|
|
15
|
+
export { buildSystemPrompt, buildEnvironmentSection, buildRemindersSection, getCurrentEnvironment, DEFAULT_SYSTEM_PROMPT } from './prompt.js';
|
|
16
|
+
// Todo utilities
|
|
17
|
+
export { TodoManager, formatTodoList } from './todo.js';
|
|
18
|
+
// Review utilities
|
|
19
|
+
export { ReviewManager, formatReviewResult, buildReviewInstructions, DEFAULT_REVIEW_CATEGORIES } from './review.js';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mBAAmB;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AA2DjC,YAAY;AACZ,OAAO,EACL,cAAc,EAEf,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,cAAc,EAEf,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,aAAa,EAGd,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EACL,gBAAgB,EACjB,MAAM,kCAAkC,CAAA;AAEzC,YAAY;AACZ,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACf,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB,iBAAiB;AACjB,OAAO,EACL,WAAW,EACX,cAAc,EACf,MAAM,WAAW,CAAA;AAElB,mBAAmB;AACnB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,aAAa,CAAA"}
|
package/dist/prompt.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System Prompt Builder
|
|
3
|
+
*
|
|
4
|
+
* Utilities for building dynamic system prompts with environment info and reminders.
|
|
5
|
+
*/
|
|
6
|
+
import type { SystemPromptConfig, EnvironmentInfo, SubAgentConfig } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Build environment section for system prompt
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildEnvironmentSection(env: EnvironmentInfo): string;
|
|
11
|
+
/**
|
|
12
|
+
* Build reminder section for system prompt
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildRemindersSection(reminders: string[]): string;
|
|
15
|
+
/**
|
|
16
|
+
* Build agent list section for __task__ tool description
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildAgentListSection(agents: SubAgentConfig[]): string;
|
|
19
|
+
/**
|
|
20
|
+
* Build complete system prompt from config
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildSystemPrompt(config: SystemPromptConfig): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get current environment info
|
|
25
|
+
*/
|
|
26
|
+
export declare function getCurrentEnvironment(): EnvironmentInfo;
|
|
27
|
+
/**
|
|
28
|
+
* Default system prompt template
|
|
29
|
+
*/
|
|
30
|
+
export declare const DEFAULT_SYSTEM_PROMPT = "You are a helpful AI assistant.\n\nYou have access to tools that allow you to perform various tasks. Use them when needed to help the user.\n\nWhen you need clarification from the user, use the __ask_user__ tool to ask a question.\n\nBe concise and helpful in your responses.";
|
|
31
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAErF;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAuBpE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAQjE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAOtE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAYpE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAMvD;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,wRAMQ,CAAA"}
|
package/dist/prompt.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System Prompt Builder
|
|
3
|
+
*
|
|
4
|
+
* Utilities for building dynamic system prompts with environment info and reminders.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Build environment section for system prompt
|
|
8
|
+
*/
|
|
9
|
+
export function buildEnvironmentSection(env) {
|
|
10
|
+
const lines = [];
|
|
11
|
+
if (env.workingDirectory) {
|
|
12
|
+
lines.push(`Working directory: ${env.workingDirectory}`);
|
|
13
|
+
}
|
|
14
|
+
if (env.platform) {
|
|
15
|
+
lines.push(`Platform: ${env.platform}`);
|
|
16
|
+
}
|
|
17
|
+
if (env.date) {
|
|
18
|
+
lines.push(`Today's date: ${env.date}`);
|
|
19
|
+
}
|
|
20
|
+
if (env.customVars) {
|
|
21
|
+
for (const [key, value] of Object.entries(env.customVars)) {
|
|
22
|
+
lines.push(`${key}: ${value}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (lines.length === 0) {
|
|
26
|
+
return '';
|
|
27
|
+
}
|
|
28
|
+
return `\n<env>\n${lines.join('\n')}\n</env>`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build reminder section for system prompt
|
|
32
|
+
*/
|
|
33
|
+
export function buildRemindersSection(reminders) {
|
|
34
|
+
if (reminders.length === 0) {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
return reminders
|
|
38
|
+
.map(reminder => `\n<system-reminder>\n${reminder}\n</system-reminder>`)
|
|
39
|
+
.join('');
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Build agent list section for __task__ tool description
|
|
43
|
+
*/
|
|
44
|
+
export function buildAgentListSection(agents) {
|
|
45
|
+
if (agents.length === 0) {
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
48
|
+
const lines = agents.map(agent => `- ${agent.name}: ${agent.description}`);
|
|
49
|
+
return `\nAvailable agents:\n${lines.join('\n')}`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build complete system prompt from config
|
|
53
|
+
*/
|
|
54
|
+
export function buildSystemPrompt(config) {
|
|
55
|
+
let prompt = config.basePrompt;
|
|
56
|
+
if (config.environment) {
|
|
57
|
+
prompt += buildEnvironmentSection(config.environment);
|
|
58
|
+
}
|
|
59
|
+
if (config.reminders && config.reminders.length > 0) {
|
|
60
|
+
prompt += buildRemindersSection(config.reminders);
|
|
61
|
+
}
|
|
62
|
+
return prompt;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get current environment info
|
|
66
|
+
*/
|
|
67
|
+
export function getCurrentEnvironment() {
|
|
68
|
+
return {
|
|
69
|
+
workingDirectory: process.cwd(),
|
|
70
|
+
platform: process.platform,
|
|
71
|
+
date: new Date().toISOString().split('T')[0]
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Default system prompt template
|
|
76
|
+
*/
|
|
77
|
+
export const DEFAULT_SYSTEM_PROMPT = `You are a helpful AI assistant.
|
|
78
|
+
|
|
79
|
+
You have access to tools that allow you to perform various tasks. Use them when needed to help the user.
|
|
80
|
+
|
|
81
|
+
When you need clarification from the user, use the __ask_user__ tool to ask a question.
|
|
82
|
+
|
|
83
|
+
Be concise and helpful in your responses.`;
|
|
84
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAoB;IAC1D,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,IAAI,GAAG,CAAC,gBAAgB,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,sBAAsB,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAA;IAC1D,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CAAC,aAAa,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAA;IACzC,CAAC;IACD,IAAI,GAAG,C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GAAG,MAAM,CAAC,UAAU,CAAA;IAE9B,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,MAAM,IAAI,uBAAuB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IACvD,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACnD,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,gBAAgB,EAAE,OAAO,CAAC,GAAG,EAAE;QAC/B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAC7C,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;0CAMK,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Exports
|
|
3
|
+
*/
|
|
4
|
+
export { LLMProvider, LLMResponse, LLMOptions } from './llm/base.js';
|
|
5
|
+
export { ClaudeProvider, ClaudeProviderConfig } from './llm/claude.js';
|
|
6
|
+
export { OpenAIProvider, OpenAIProviderConfig } from './llm/openai.js';
|
|
7
|
+
export { LogProvider } from './logger/base.js';
|
|
8
|
+
export { ConsoleLogger, ConsoleLoggerConfig, LogLevel } from './logger/console.js';
|
|
9
|
+
export { RepositoryProvider } from './repository/base.js';
|
|
10
|
+
export { MemoryRepository } from './repository/memory.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAGtE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAGlF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Exports
|
|
3
|
+
*/
|
|
4
|
+
export { ClaudeProvider } from './llm/claude.js';
|
|
5
|
+
export { OpenAIProvider } from './llm/openai.js';
|
|
6
|
+
export { ConsoleLogger } from './logger/console.js';
|
|
7
|
+
export { MemoryRepository } from './repository/memory.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,cAAc,EAAwB,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,cAAc,EAAwB,MAAM,iBAAiB,CAAA;AAItE,OAAO,EAAE,aAAa,EAAiC,MAAM,qBAAqB,CAAA;AAIlF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/providers/llm/base.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/providers/llm/base.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude LLM Provider
|
|
3
|
+
*
|
|
4
|
+
* Implementation of LLMProvider for Anthropic's Claude API.
|
|
5
|
+
*/
|
|
6
|
+
import type { LLMProvider, LLMResponse, LLMOptions, Message, ToolSchema } from '../../types.js';
|
|
7
|
+
export interface ClaudeProviderConfig {
|
|
8
|
+
apiKey?: string;
|
|
9
|
+
model?: string;
|
|
10
|
+
maxTokens?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class ClaudeProvider implements LLMProvider {
|
|
13
|
+
private client;
|
|
14
|
+
private model;
|
|
15
|
+
private maxTokens;
|
|
16
|
+
constructor(config?: ClaudeProviderConfig);
|
|
17
|
+
chat(systemPrompt: string, messages: Message[], tools: ToolSchema[], options?: LLMOptions): Promise<LLMResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Build system content with optional caching
|
|
20
|
+
*/
|
|
21
|
+
private buildSystemContent;
|
|
22
|
+
private convertMessages;
|
|
23
|
+
/**
|
|
24
|
+
* Find the last user message index (for cache breakpoint)
|
|
25
|
+
*/
|
|
26
|
+
private findLastUserMessageIndex;
|
|
27
|
+
private convertContentBlocks;
|
|
28
|
+
private convertTools;
|
|
29
|
+
private convertResponse;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/providers/llm/claude.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,OAAO,EACP,UAAU,EAIX,MAAM,gBAAgB,CAAA;AAEvB,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,SAAS,CAAQ;gBAEb,MAAM,GAAE,oBAAyB;IAQvC,IAAI,CACR,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,WAAW,CAAC;IA8BvB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,eAAe;IAkCvB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,oBAAoB;IA2B5B,OAAO,CAAC,YAAY;IAqBpB,OAAO,CAAC,eAAe;CA8CxB"}
|