attocode 0.1.0 → 0.1.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/CHANGELOG.md +64 -1
- package/README.md +138 -10
- package/dist/src/agent.d.ts +75 -1
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +700 -25
- package/dist/src/agent.js.map +1 -1
- package/dist/src/commands/agents-commands.d.ts +24 -0
- package/dist/src/commands/agents-commands.d.ts.map +1 -0
- package/dist/src/commands/agents-commands.js +284 -0
- package/dist/src/commands/agents-commands.js.map +1 -0
- package/dist/src/commands/handler.d.ts.map +1 -1
- package/dist/src/commands/handler.js +135 -19
- package/dist/src/commands/handler.js.map +1 -1
- package/dist/src/commands/init-commands.d.ts +35 -0
- package/dist/src/commands/init-commands.d.ts.map +1 -0
- package/dist/src/commands/init-commands.js +187 -0
- package/dist/src/commands/init-commands.js.map +1 -0
- package/dist/src/commands/skills-commands.d.ts +26 -0
- package/dist/src/commands/skills-commands.d.ts.map +1 -0
- package/dist/src/commands/skills-commands.js +309 -0
- package/dist/src/commands/skills-commands.js.map +1 -0
- package/dist/src/commands/types.d.ts +13 -2
- package/dist/src/commands/types.d.ts.map +1 -1
- package/dist/src/defaults.d.ts +29 -1
- package/dist/src/defaults.d.ts.map +1 -1
- package/dist/src/defaults.js +66 -0
- package/dist/src/defaults.js.map +1 -1
- package/dist/src/integrations/agent-registry.d.ts +68 -2
- package/dist/src/integrations/agent-registry.d.ts.map +1 -1
- package/dist/src/integrations/agent-registry.js +230 -23
- package/dist/src/integrations/agent-registry.js.map +1 -1
- package/dist/src/integrations/cancellation.d.ts +5 -0
- package/dist/src/integrations/cancellation.d.ts.map +1 -1
- package/dist/src/integrations/cancellation.js +7 -0
- package/dist/src/integrations/cancellation.js.map +1 -1
- package/dist/src/integrations/capabilities.d.ts +160 -0
- package/dist/src/integrations/capabilities.d.ts.map +1 -0
- package/dist/src/integrations/capabilities.js +426 -0
- package/dist/src/integrations/capabilities.js.map +1 -0
- package/dist/src/integrations/context-engineering.d.ts +6 -1
- package/dist/src/integrations/context-engineering.d.ts.map +1 -1
- package/dist/src/integrations/context-engineering.js +7 -0
- package/dist/src/integrations/context-engineering.js.map +1 -1
- package/dist/src/integrations/index.d.ts +12 -2
- package/dist/src/integrations/index.d.ts.map +1 -1
- package/dist/src/integrations/index.js +22 -2
- package/dist/src/integrations/index.js.map +1 -1
- package/dist/src/integrations/interactive-planning.d.ts +322 -0
- package/dist/src/integrations/interactive-planning.d.ts.map +1 -0
- package/dist/src/integrations/interactive-planning.js +655 -0
- package/dist/src/integrations/interactive-planning.js.map +1 -0
- package/dist/src/integrations/learning-store.d.ts +291 -0
- package/dist/src/integrations/learning-store.d.ts.map +1 -0
- package/dist/src/integrations/learning-store.js +640 -0
- package/dist/src/integrations/learning-store.js.map +1 -0
- package/dist/src/integrations/pending-plan.d.ts.map +1 -1
- package/dist/src/integrations/pending-plan.js +69 -10
- package/dist/src/integrations/pending-plan.js.map +1 -1
- package/dist/src/integrations/skill-executor.d.ts +113 -0
- package/dist/src/integrations/skill-executor.d.ts.map +1 -0
- package/dist/src/integrations/skill-executor.js +270 -0
- package/dist/src/integrations/skill-executor.js.map +1 -0
- package/dist/src/integrations/skills.d.ts +98 -7
- package/dist/src/integrations/skills.d.ts.map +1 -1
- package/dist/src/integrations/skills.js +210 -11
- package/dist/src/integrations/skills.js.map +1 -1
- package/dist/src/providers/circuit-breaker.d.ts +180 -0
- package/dist/src/providers/circuit-breaker.d.ts.map +1 -0
- package/dist/src/providers/circuit-breaker.js +349 -0
- package/dist/src/providers/circuit-breaker.js.map +1 -0
- package/dist/src/providers/fallback-chain.d.ts +194 -0
- package/dist/src/providers/fallback-chain.d.ts.map +1 -0
- package/dist/src/providers/fallback-chain.js +363 -0
- package/dist/src/providers/fallback-chain.js.map +1 -0
- package/dist/src/providers/llm-resilience.d.ts +126 -0
- package/dist/src/providers/llm-resilience.d.ts.map +1 -0
- package/dist/src/providers/llm-resilience.js +261 -0
- package/dist/src/providers/llm-resilience.js.map +1 -0
- package/dist/src/providers/resilient-provider.d.ts +124 -0
- package/dist/src/providers/resilient-provider.d.ts.map +1 -0
- package/dist/src/providers/resilient-provider.js +242 -0
- package/dist/src/providers/resilient-provider.js.map +1 -0
- package/dist/src/tricks/recursive-context.d.ts +296 -0
- package/dist/src/tricks/recursive-context.d.ts.map +1 -0
- package/dist/src/tricks/recursive-context.js +518 -0
- package/dist/src/tricks/recursive-context.js.map +1 -0
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +226 -29
- package/dist/src/tui/app.js.map +1 -1
- package/dist/src/tui/components/ApprovalDialog.d.ts.map +1 -1
- package/dist/src/tui/components/ApprovalDialog.js +1 -1
- package/dist/src/tui/components/ApprovalDialog.js.map +1 -1
- package/dist/src/tui/index.d.ts +1 -0
- package/dist/src/tui/index.d.ts.map +1 -1
- package/dist/src/tui/index.js +2 -0
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/transparency-aggregator.d.ts +100 -0
- package/dist/src/tui/transparency-aggregator.d.ts.map +1 -0
- package/dist/src/tui/transparency-aggregator.js +234 -0
- package/dist/src/tui/transparency-aggregator.js.map +1 -0
- package/dist/src/types.d.ts +155 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trick U: Recursive Language Model Context (RLM)
|
|
3
|
+
*
|
|
4
|
+
* Instead of cramming everything into context or summarizing, let the model
|
|
5
|
+
* "browse" the context as an external environment through recursive self-calls.
|
|
6
|
+
*
|
|
7
|
+
* Inspired by arXiv:2512.24601 - Recursive Language Models.
|
|
8
|
+
*
|
|
9
|
+
* Problem: Traditional approaches either:
|
|
10
|
+
* - Stuff everything in context → hits limits, loses attention
|
|
11
|
+
* - Summarize → loses critical details
|
|
12
|
+
*
|
|
13
|
+
* Solution: Let the model decide what parts of context to examine, then
|
|
14
|
+
* recursively call itself with focused snippets, synthesizing across calls.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const rlm = createRecursiveContext({
|
|
19
|
+
* maxDepth: 3,
|
|
20
|
+
* snippetTokens: 2000,
|
|
21
|
+
* synthesisTokens: 1000,
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Register context sources
|
|
25
|
+
* rlm.registerSource('files', {
|
|
26
|
+
* describe: () => 'Project source files',
|
|
27
|
+
* list: async () => ['src/main.ts', 'src/agent.ts', ...],
|
|
28
|
+
* fetch: async (key) => readFile(key),
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Process a query with recursive context access
|
|
32
|
+
* const result = await rlm.process(query, llmCall, {
|
|
33
|
+
* depth: 0,
|
|
34
|
+
* budget: 10000,
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
// =============================================================================
|
|
39
|
+
// PROMPTS
|
|
40
|
+
// =============================================================================
|
|
41
|
+
const NAVIGATOR_SYSTEM_PROMPT = `You are a context navigator. Your job is to explore available context sources to answer questions.
|
|
42
|
+
|
|
43
|
+
You can navigate using these commands (respond with ONLY the JSON):
|
|
44
|
+
|
|
45
|
+
1. List items in a source:
|
|
46
|
+
{"type": "list", "source": "<source_name>", "reason": "why"}
|
|
47
|
+
|
|
48
|
+
2. Fetch a specific item:
|
|
49
|
+
{"type": "fetch", "source": "<source_name>", "key": "<item_key>", "reason": "why"}
|
|
50
|
+
|
|
51
|
+
3. Search within a source:
|
|
52
|
+
{"type": "search", "source": "<source_name>", "key": "<search_query>", "reason": "why"}
|
|
53
|
+
|
|
54
|
+
4. Synthesize findings into an answer:
|
|
55
|
+
{"type": "synthesize", "reason": "ready because..."}
|
|
56
|
+
|
|
57
|
+
5. Mark as done (have enough info):
|
|
58
|
+
{"type": "done", "reason": "why done"}
|
|
59
|
+
|
|
60
|
+
Available sources:
|
|
61
|
+
{SOURCES}
|
|
62
|
+
|
|
63
|
+
Current context:
|
|
64
|
+
{CONTEXT}
|
|
65
|
+
|
|
66
|
+
Be strategic - only fetch what you need. Explain your reasoning briefly.`;
|
|
67
|
+
const SYNTHESIS_SYSTEM_PROMPT = `You are synthesizing information gathered from multiple sources.
|
|
68
|
+
|
|
69
|
+
Gathered information:
|
|
70
|
+
{GATHERED}
|
|
71
|
+
|
|
72
|
+
Provide a comprehensive answer based on the gathered information.
|
|
73
|
+
If information is incomplete, note what's missing.
|
|
74
|
+
Focus on accuracy over completeness.`;
|
|
75
|
+
// =============================================================================
|
|
76
|
+
// RECURSIVE CONTEXT MANAGER
|
|
77
|
+
// =============================================================================
|
|
78
|
+
/**
|
|
79
|
+
* Manages recursive context navigation.
|
|
80
|
+
*/
|
|
81
|
+
export class RecursiveContextManager {
|
|
82
|
+
config;
|
|
83
|
+
sources = new Map();
|
|
84
|
+
cache = new Map();
|
|
85
|
+
listeners = [];
|
|
86
|
+
constructor(config = {}) {
|
|
87
|
+
this.config = {
|
|
88
|
+
maxDepth: config.maxDepth ?? 3,
|
|
89
|
+
snippetTokens: config.snippetTokens ?? 2000,
|
|
90
|
+
synthesisTokens: config.synthesisTokens ?? 1000,
|
|
91
|
+
totalBudget: config.totalBudget ?? 50000,
|
|
92
|
+
cacheResults: config.cacheResults ?? true,
|
|
93
|
+
callTimeout: config.callTimeout ?? 30000,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Register a context source.
|
|
98
|
+
*/
|
|
99
|
+
registerSource(name, source) {
|
|
100
|
+
this.sources.set(name, source);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Unregister a context source.
|
|
104
|
+
*/
|
|
105
|
+
unregisterSource(name) {
|
|
106
|
+
this.sources.delete(name);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Get registered source names.
|
|
110
|
+
*/
|
|
111
|
+
getSourceNames() {
|
|
112
|
+
return Array.from(this.sources.keys());
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Process a query with recursive context navigation.
|
|
116
|
+
*/
|
|
117
|
+
async process(query, llmCall, options = {}) {
|
|
118
|
+
const { depth = 0, budget = this.config.totalBudget, navigationContext = '', cancelToken, } = options;
|
|
119
|
+
const startTime = Date.now();
|
|
120
|
+
const path = [];
|
|
121
|
+
const gathered = [];
|
|
122
|
+
const sourcesAccessed = new Set();
|
|
123
|
+
let totalTokens = 0;
|
|
124
|
+
let itemsFetched = 0;
|
|
125
|
+
let maxDepthReached = depth;
|
|
126
|
+
this.emit({ type: 'process.started', query, depth });
|
|
127
|
+
// Build source descriptions
|
|
128
|
+
const sourceDescriptions = this.buildSourceDescriptions();
|
|
129
|
+
// Main navigation loop
|
|
130
|
+
let iterations = 0;
|
|
131
|
+
const maxIterations = 10; // Prevent infinite loops
|
|
132
|
+
while (iterations < maxIterations) {
|
|
133
|
+
iterations++;
|
|
134
|
+
// Check cancellation
|
|
135
|
+
if (cancelToken?.isCancelled) {
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
// Check budget
|
|
139
|
+
if (totalTokens > budget * 0.9) {
|
|
140
|
+
this.emit({ type: 'budget.warning', remaining: budget - totalTokens, total: budget });
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
// Check depth
|
|
144
|
+
if (depth >= this.config.maxDepth) {
|
|
145
|
+
this.emit({ type: 'depth.warning', current: depth, max: this.config.maxDepth });
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
// Build context for navigation
|
|
149
|
+
const contextSummary = this.buildContextSummary(gathered, path);
|
|
150
|
+
const systemPrompt = NAVIGATOR_SYSTEM_PROMPT
|
|
151
|
+
.replace('{SOURCES}', sourceDescriptions)
|
|
152
|
+
.replace('{CONTEXT}', contextSummary || 'No context gathered yet.');
|
|
153
|
+
const userMessage = depth === 0
|
|
154
|
+
? `Question: ${query}\n\nWhat would you like to explore first?`
|
|
155
|
+
: `Continue exploring to answer: ${query}\n\n${navigationContext}`;
|
|
156
|
+
// Get navigation command from LLM
|
|
157
|
+
const navResponse = await llmCall(systemPrompt, userMessage, {
|
|
158
|
+
maxTokens: 200,
|
|
159
|
+
});
|
|
160
|
+
totalTokens += navResponse.tokens;
|
|
161
|
+
// Parse navigation command
|
|
162
|
+
const command = this.parseNavigationCommand(navResponse.content);
|
|
163
|
+
this.emit({ type: 'navigation.command', command, depth });
|
|
164
|
+
// Execute command
|
|
165
|
+
if (command.type === 'done' || command.type === 'synthesize') {
|
|
166
|
+
// Ready to synthesize
|
|
167
|
+
this.emit({ type: 'synthesis.started', depth, itemCount: gathered.length });
|
|
168
|
+
const answer = await this.synthesize(query, gathered, llmCall);
|
|
169
|
+
totalTokens += answer.tokens;
|
|
170
|
+
return {
|
|
171
|
+
answer: answer.content,
|
|
172
|
+
path,
|
|
173
|
+
stats: {
|
|
174
|
+
totalCalls: iterations + 1,
|
|
175
|
+
maxDepthReached,
|
|
176
|
+
totalTokens,
|
|
177
|
+
sourcesAccessed: Array.from(sourcesAccessed),
|
|
178
|
+
itemsFetched,
|
|
179
|
+
duration: Date.now() - startTime,
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
// Execute navigation command
|
|
184
|
+
const stepResult = await this.executeCommand(command, sourcesAccessed);
|
|
185
|
+
if (stepResult) {
|
|
186
|
+
path.push({
|
|
187
|
+
depth,
|
|
188
|
+
command,
|
|
189
|
+
result: this.truncate(stepResult, 500),
|
|
190
|
+
tokens: this.estimateTokens(stepResult),
|
|
191
|
+
});
|
|
192
|
+
gathered.push(this.formatGatheredItem(command, stepResult));
|
|
193
|
+
itemsFetched++;
|
|
194
|
+
maxDepthReached = Math.max(maxDepthReached, depth);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Reached iteration limit - synthesize what we have
|
|
198
|
+
this.emit({ type: 'synthesis.started', depth, itemCount: gathered.length });
|
|
199
|
+
const finalAnswer = await this.synthesize(query, gathered, llmCall);
|
|
200
|
+
totalTokens += finalAnswer.tokens;
|
|
201
|
+
const stats = {
|
|
202
|
+
totalCalls: iterations + 1,
|
|
203
|
+
maxDepthReached,
|
|
204
|
+
totalTokens,
|
|
205
|
+
sourcesAccessed: Array.from(sourcesAccessed),
|
|
206
|
+
itemsFetched,
|
|
207
|
+
duration: Date.now() - startTime,
|
|
208
|
+
};
|
|
209
|
+
this.emit({ type: 'process.completed', stats });
|
|
210
|
+
return {
|
|
211
|
+
answer: finalAnswer.content,
|
|
212
|
+
path,
|
|
213
|
+
stats,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Clear the results cache.
|
|
218
|
+
*/
|
|
219
|
+
clearCache() {
|
|
220
|
+
this.cache.clear();
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Subscribe to events.
|
|
224
|
+
*/
|
|
225
|
+
on(listener) {
|
|
226
|
+
this.listeners.push(listener);
|
|
227
|
+
return () => {
|
|
228
|
+
const idx = this.listeners.indexOf(listener);
|
|
229
|
+
if (idx >= 0)
|
|
230
|
+
this.listeners.splice(idx, 1);
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
// ===========================================================================
|
|
234
|
+
// PRIVATE METHODS
|
|
235
|
+
// ===========================================================================
|
|
236
|
+
buildSourceDescriptions() {
|
|
237
|
+
const lines = [];
|
|
238
|
+
for (const [name, source] of this.sources) {
|
|
239
|
+
lines.push(`- ${name}: ${source.describe()}`);
|
|
240
|
+
if (source.search) {
|
|
241
|
+
lines.push(` (supports search)`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return lines.join('\n');
|
|
245
|
+
}
|
|
246
|
+
buildContextSummary(gathered, path) {
|
|
247
|
+
if (gathered.length === 0) {
|
|
248
|
+
return '';
|
|
249
|
+
}
|
|
250
|
+
const summary = [
|
|
251
|
+
`Gathered ${gathered.length} items:`,
|
|
252
|
+
'',
|
|
253
|
+
...gathered.slice(-5).map((g, i) => `${i + 1}. ${this.truncate(g, 200)}`),
|
|
254
|
+
];
|
|
255
|
+
if (gathered.length > 5) {
|
|
256
|
+
summary.unshift(`(${gathered.length - 5} earlier items not shown)`);
|
|
257
|
+
}
|
|
258
|
+
return summary.join('\n');
|
|
259
|
+
}
|
|
260
|
+
parseNavigationCommand(content) {
|
|
261
|
+
try {
|
|
262
|
+
// Try to extract JSON from response
|
|
263
|
+
const jsonMatch = content.match(/\{[\s\S]*\}/);
|
|
264
|
+
if (jsonMatch) {
|
|
265
|
+
const parsed = JSON.parse(jsonMatch[0]);
|
|
266
|
+
return {
|
|
267
|
+
type: parsed.type || 'done',
|
|
268
|
+
source: parsed.source,
|
|
269
|
+
key: parsed.key,
|
|
270
|
+
reason: parsed.reason,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
// Parse failed
|
|
276
|
+
}
|
|
277
|
+
// Default to done if can't parse
|
|
278
|
+
return { type: 'done', reason: 'Could not parse navigation command' };
|
|
279
|
+
}
|
|
280
|
+
async executeCommand(command, sourcesAccessed) {
|
|
281
|
+
if (!command.source) {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
const source = this.sources.get(command.source);
|
|
285
|
+
if (!source) {
|
|
286
|
+
return `Source "${command.source}" not found`;
|
|
287
|
+
}
|
|
288
|
+
sourcesAccessed.add(command.source);
|
|
289
|
+
this.emit({ type: 'source.accessed', source: command.source, command: command.type });
|
|
290
|
+
try {
|
|
291
|
+
switch (command.type) {
|
|
292
|
+
case 'list': {
|
|
293
|
+
const items = await source.list(command.key);
|
|
294
|
+
return `Items in ${command.source}:\n${items.slice(0, 20).join('\n')}${items.length > 20 ? `\n...and ${items.length - 20} more` : ''}`;
|
|
295
|
+
}
|
|
296
|
+
case 'fetch': {
|
|
297
|
+
if (!command.key) {
|
|
298
|
+
return 'No key specified for fetch';
|
|
299
|
+
}
|
|
300
|
+
// Check cache
|
|
301
|
+
const cacheKey = `${command.source}:${command.key}`;
|
|
302
|
+
if (this.config.cacheResults && this.cache.has(cacheKey)) {
|
|
303
|
+
return this.cache.get(cacheKey);
|
|
304
|
+
}
|
|
305
|
+
const content = await source.fetch(command.key);
|
|
306
|
+
const truncated = this.truncate(content, this.config.snippetTokens * 4); // ~4 chars per token
|
|
307
|
+
if (this.config.cacheResults) {
|
|
308
|
+
this.cache.set(cacheKey, truncated);
|
|
309
|
+
}
|
|
310
|
+
return `Content of ${command.key}:\n${truncated}`;
|
|
311
|
+
}
|
|
312
|
+
case 'search': {
|
|
313
|
+
if (!source.search || !command.key) {
|
|
314
|
+
return 'Search not available for this source or no query specified';
|
|
315
|
+
}
|
|
316
|
+
const results = await source.search(command.key);
|
|
317
|
+
return `Search results for "${command.key}":\n${results.slice(0, 10).map(r => `- ${r.key}: ${r.snippet}`).join('\n')}`;
|
|
318
|
+
}
|
|
319
|
+
default:
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
325
|
+
return `Error accessing ${command.source}: ${err.message}`;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
async synthesize(query, gathered, llmCall) {
|
|
329
|
+
if (gathered.length === 0) {
|
|
330
|
+
return {
|
|
331
|
+
content: 'No information gathered to answer the question.',
|
|
332
|
+
tokens: 0,
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
const systemPrompt = SYNTHESIS_SYSTEM_PROMPT.replace('{GATHERED}', gathered.map((g, i) => `[${i + 1}] ${g}`).join('\n\n'));
|
|
336
|
+
const userMessage = `Based on the gathered information, answer: ${query}`;
|
|
337
|
+
return llmCall(systemPrompt, userMessage, {
|
|
338
|
+
maxTokens: this.config.synthesisTokens,
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
formatGatheredItem(command, result) {
|
|
342
|
+
const prefix = command.source ? `[${command.source}${command.key ? ':' + command.key : ''}]` : '';
|
|
343
|
+
return `${prefix} ${this.truncate(result, 500)}`;
|
|
344
|
+
}
|
|
345
|
+
truncate(text, maxChars) {
|
|
346
|
+
if (text.length <= maxChars) {
|
|
347
|
+
return text;
|
|
348
|
+
}
|
|
349
|
+
return text.slice(0, maxChars - 3) + '...';
|
|
350
|
+
}
|
|
351
|
+
estimateTokens(text) {
|
|
352
|
+
// Rough estimate: ~4 characters per token
|
|
353
|
+
return Math.ceil(text.length / 4);
|
|
354
|
+
}
|
|
355
|
+
emit(event) {
|
|
356
|
+
for (const listener of this.listeners) {
|
|
357
|
+
try {
|
|
358
|
+
listener(event);
|
|
359
|
+
}
|
|
360
|
+
catch {
|
|
361
|
+
// Ignore listener errors
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
// =============================================================================
|
|
367
|
+
// FACTORY FUNCTIONS
|
|
368
|
+
// =============================================================================
|
|
369
|
+
/**
|
|
370
|
+
* Create a recursive context manager.
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```typescript
|
|
374
|
+
* const rlm = createRecursiveContext({
|
|
375
|
+
* maxDepth: 3,
|
|
376
|
+
* snippetTokens: 2000,
|
|
377
|
+
* totalBudget: 50000,
|
|
378
|
+
* });
|
|
379
|
+
*
|
|
380
|
+
* // Register file system source
|
|
381
|
+
* rlm.registerSource('files', {
|
|
382
|
+
* describe: () => 'Project source files',
|
|
383
|
+
* list: async () => glob('src/*.ts'),
|
|
384
|
+
* fetch: async (path) => fs.readFile(path, 'utf-8'),
|
|
385
|
+
* search: async (query) => grep(query),
|
|
386
|
+
* });
|
|
387
|
+
*
|
|
388
|
+
* // Process a complex query
|
|
389
|
+
* const result = await rlm.process(
|
|
390
|
+
* 'How does authentication work in this codebase?',
|
|
391
|
+
* async (system, user, opts) => {
|
|
392
|
+
* const response = await provider.chat([
|
|
393
|
+
* { role: 'system', content: system },
|
|
394
|
+
* { role: 'user', content: user },
|
|
395
|
+
* ], opts);
|
|
396
|
+
* return { content: response.content, tokens: response.usage.totalTokens };
|
|
397
|
+
* }
|
|
398
|
+
* );
|
|
399
|
+
*
|
|
400
|
+
* console.log(result.answer);
|
|
401
|
+
* console.log(`Used ${result.stats.totalTokens} tokens across ${result.stats.totalCalls} calls`);
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
404
|
+
export function createRecursiveContext(config = {}) {
|
|
405
|
+
return new RecursiveContextManager(config);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Create a minimal recursive context manager for testing.
|
|
409
|
+
*/
|
|
410
|
+
export function createMinimalRecursiveContext() {
|
|
411
|
+
return new RecursiveContextManager({
|
|
412
|
+
maxDepth: 2,
|
|
413
|
+
snippetTokens: 1000,
|
|
414
|
+
synthesisTokens: 500,
|
|
415
|
+
totalBudget: 10000,
|
|
416
|
+
cacheResults: false,
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
// =============================================================================
|
|
420
|
+
// BUILT-IN SOURCES
|
|
421
|
+
// =============================================================================
|
|
422
|
+
/**
|
|
423
|
+
* Create a file system context source.
|
|
424
|
+
*/
|
|
425
|
+
export function createFileSystemSource(options) {
|
|
426
|
+
return {
|
|
427
|
+
describe: () => `Files in ${options.basePath}`,
|
|
428
|
+
list: async (filter) => {
|
|
429
|
+
const pattern = filter || '**/*';
|
|
430
|
+
return options.glob(pattern);
|
|
431
|
+
},
|
|
432
|
+
fetch: async (key) => {
|
|
433
|
+
return options.readFile(key);
|
|
434
|
+
},
|
|
435
|
+
search: options.grep
|
|
436
|
+
? async (query) => {
|
|
437
|
+
const results = await options.grep(query);
|
|
438
|
+
return results.map((r) => ({
|
|
439
|
+
key: `${r.file}:${r.line}`,
|
|
440
|
+
snippet: r.content,
|
|
441
|
+
score: 1,
|
|
442
|
+
}));
|
|
443
|
+
}
|
|
444
|
+
: undefined,
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Create a conversation history context source.
|
|
449
|
+
*/
|
|
450
|
+
export function createConversationSource(options) {
|
|
451
|
+
return {
|
|
452
|
+
describe: () => 'Previous conversation messages',
|
|
453
|
+
list: async () => {
|
|
454
|
+
const messages = options.getMessages();
|
|
455
|
+
return messages.map((m, i) => `msg-${i}: [${m.role}] ${m.content.slice(0, 50)}...`);
|
|
456
|
+
},
|
|
457
|
+
fetch: async (key) => {
|
|
458
|
+
const messages = options.getMessages();
|
|
459
|
+
const match = key.match(/msg-(\d+)/);
|
|
460
|
+
if (match) {
|
|
461
|
+
const idx = parseInt(match[1], 10);
|
|
462
|
+
if (messages[idx]) {
|
|
463
|
+
return `[${messages[idx].role}]: ${messages[idx].content}`;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return 'Message not found';
|
|
467
|
+
},
|
|
468
|
+
search: async (query) => {
|
|
469
|
+
const messages = options.getMessages();
|
|
470
|
+
const queryLower = query.toLowerCase();
|
|
471
|
+
return messages
|
|
472
|
+
.map((m, i) => ({
|
|
473
|
+
key: `msg-${i}`,
|
|
474
|
+
snippet: m.content.slice(0, 100),
|
|
475
|
+
score: m.content.toLowerCase().includes(queryLower) ? 1 : 0,
|
|
476
|
+
}))
|
|
477
|
+
.filter((r) => r.score > 0);
|
|
478
|
+
},
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
// =============================================================================
|
|
482
|
+
// UTILITIES
|
|
483
|
+
// =============================================================================
|
|
484
|
+
/**
|
|
485
|
+
* Format recursive result for display.
|
|
486
|
+
*/
|
|
487
|
+
export function formatRecursiveResult(result) {
|
|
488
|
+
const lines = [
|
|
489
|
+
'=== Recursive Context Result ===',
|
|
490
|
+
'',
|
|
491
|
+
'Answer:',
|
|
492
|
+
result.answer,
|
|
493
|
+
'',
|
|
494
|
+
'Navigation Path:',
|
|
495
|
+
...result.path.map((step) => ` [${step.depth}] ${step.command.type}${step.command.source ? `:${step.command.source}` : ''} - ${step.command.reason || 'no reason'}`),
|
|
496
|
+
'',
|
|
497
|
+
'Statistics:',
|
|
498
|
+
` Total LLM calls: ${result.stats.totalCalls}`,
|
|
499
|
+
` Max depth: ${result.stats.maxDepthReached}`,
|
|
500
|
+
` Total tokens: ${result.stats.totalTokens}`,
|
|
501
|
+
` Items fetched: ${result.stats.itemsFetched}`,
|
|
502
|
+
` Duration: ${result.stats.duration}ms`,
|
|
503
|
+
` Sources: ${result.stats.sourcesAccessed.join(', ')}`,
|
|
504
|
+
];
|
|
505
|
+
return lines.join('\n');
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Format statistics for display.
|
|
509
|
+
*/
|
|
510
|
+
export function formatRecursiveStats(stats) {
|
|
511
|
+
return [
|
|
512
|
+
`Calls: ${stats.totalCalls}`,
|
|
513
|
+
`Tokens: ${stats.totalTokens}`,
|
|
514
|
+
`Items: ${stats.itemsFetched}`,
|
|
515
|
+
`Time: ${stats.duration}ms`,
|
|
516
|
+
].join(' | ');
|
|
517
|
+
}
|
|
518
|
+
//# sourceMappingURL=recursive-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recursive-context.js","sourceRoot":"","sources":["../../../src/tricks/recursive-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AA6JH,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;yEAyByC,CAAC;AAE1E,MAAM,uBAAuB,GAAG;;;;;;;qCAOK,CAAC;AAEtC,gFAAgF;AAChF,4BAA4B;AAC5B,gFAAgF;AAEhF;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAC1B,MAAM,CAAmC;IACzC,OAAO,GAA+B,IAAI,GAAG,EAAE,CAAC;IAChD,KAAK,GAAwB,IAAI,GAAG,EAAE,CAAC;IACvC,SAAS,GAAoC,EAAE,CAAC;IAExD,YAAY,SAAiC,EAAE;QAC7C,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EAAE,MAAM,CAAC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,EAAE;KACxD,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAqB;IACxD,OAAO;QACL,UAAU,KAAK,CAAC,UAAU,EAAE;QAC5B,WAAW,KAAK,CAAC,WAAW,EAAE;QAC9B,UAAU,KAAK,CAAC,YAAY,EAAE;QAC9B,SAAS,KAAK,CAAC,QAAQ,IAAI;KAC5B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/tui/app.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAK/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/tui/app.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAK/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AA+CxD,yCAAyC;AACzC,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,eAAe,CAAC;IACvB,YAAY,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