erosolar-cli 2.1.238 → 2.1.239
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 +9 -0
- package/dist/contracts/tools.schema.json +3 -1
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +5 -1
- package/dist/core/agent.js.map +1 -1
- package/dist/core/agentOrchestrator.d.ts +4 -0
- package/dist/core/agentOrchestrator.d.ts.map +1 -1
- package/dist/core/agentOrchestrator.js +58 -6
- package/dist/core/agentOrchestrator.js.map +1 -1
- package/dist/core/autoExecutionOrchestrator.d.ts +172 -0
- package/dist/core/autoExecutionOrchestrator.d.ts.map +1 -0
- package/dist/core/autoExecutionOrchestrator.js +591 -0
- package/dist/core/autoExecutionOrchestrator.js.map +1 -0
- package/dist/core/contextManager.d.ts.map +1 -1
- package/dist/core/contextManager.js.map +1 -1
- package/dist/core/dualAgentOrchestrator.d.ts +34 -0
- package/dist/core/dualAgentOrchestrator.d.ts.map +1 -0
- package/dist/core/dualAgentOrchestrator.js +94 -0
- package/dist/core/dualAgentOrchestrator.js.map +1 -0
- package/dist/core/errors/safetyValidator.d.ts +25 -12
- package/dist/core/errors/safetyValidator.d.ts.map +1 -1
- package/dist/core/errors/safetyValidator.js +165 -17
- package/dist/core/errors/safetyValidator.js.map +1 -1
- package/dist/core/governmentProcedures.d.ts +118 -0
- package/dist/core/governmentProcedures.d.ts.map +1 -0
- package/dist/core/governmentProcedures.js +912 -0
- package/dist/core/governmentProcedures.js.map +1 -0
- package/dist/core/infrastructureTemplates.d.ts +123 -0
- package/dist/core/infrastructureTemplates.d.ts.map +1 -0
- package/dist/core/infrastructureTemplates.js +1326 -0
- package/dist/core/infrastructureTemplates.js.map +1 -0
- package/dist/core/orchestration.d.ts +534 -0
- package/dist/core/orchestration.d.ts.map +1 -0
- package/dist/core/orchestration.js +2009 -0
- package/dist/core/orchestration.js.map +1 -0
- package/dist/core/persistentObjectiveStore.d.ts +292 -0
- package/dist/core/persistentObjectiveStore.d.ts.map +1 -0
- package/dist/core/persistentObjectiveStore.js +613 -0
- package/dist/core/persistentObjectiveStore.js.map +1 -0
- package/dist/core/preferences.js +1 -1
- package/dist/core/preferences.js.map +1 -1
- package/dist/core/reliabilityPrompt.d.ts.map +1 -1
- package/dist/core/reliabilityPrompt.js +3 -0
- package/dist/core/reliabilityPrompt.js.map +1 -1
- package/dist/core/securityDeliverableGenerator.d.ts +292 -0
- package/dist/core/securityDeliverableGenerator.d.ts.map +1 -0
- package/dist/core/securityDeliverableGenerator.js +1590 -0
- package/dist/core/securityDeliverableGenerator.js.map +1 -0
- package/dist/core/taskCompletionDetector.d.ts.map +1 -1
- package/dist/core/taskCompletionDetector.js +4 -1
- package/dist/core/taskCompletionDetector.js.map +1 -1
- package/dist/shell/autoExecutor.d.ts.map +1 -1
- package/dist/shell/autoExecutor.js +32 -3
- package/dist/shell/autoExecutor.js.map +1 -1
- package/dist/shell/interactiveShell.d.ts +9 -0
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +282 -190
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/tools/bashTools.d.ts +3 -5
- package/dist/tools/bashTools.d.ts.map +1 -1
- package/dist/tools/bashTools.js +259 -161
- package/dist/tools/bashTools.js.map +1 -1
- package/dist/tools/tao/index.d.ts +4 -4
- package/dist/tools/tao/index.d.ts.map +1 -1
- package/dist/tools/tao/index.js +15 -5
- package/dist/tools/tao/index.js.map +1 -1
- package/dist/tools/tao/rl.d.ts +164 -0
- package/dist/tools/tao/rl.d.ts.map +1 -0
- package/dist/tools/tao/rl.js +2998 -0
- package/dist/tools/tao/rl.js.map +1 -0
- package/dist/tools/taoTools.d.ts +2 -2
- package/dist/tools/taoTools.d.ts.map +1 -1
- package/dist/tools/taoTools.js +103 -20
- package/dist/tools/taoTools.js.map +1 -1
- package/dist/ui/PromptController.d.ts +3 -0
- package/dist/ui/PromptController.d.ts.map +1 -1
- package/dist/ui/PromptController.js +3 -0
- package/dist/ui/PromptController.js.map +1 -1
- package/dist/ui/UnifiedUIRenderer.d.ts +4 -0
- package/dist/ui/UnifiedUIRenderer.d.ts.map +1 -1
- package/dist/ui/UnifiedUIRenderer.js +37 -6
- package/dist/ui/UnifiedUIRenderer.js.map +1 -1
- package/dist/ui/display.d.ts +9 -1
- package/dist/ui/display.d.ts.map +1 -1
- package/dist/ui/display.js +66 -9
- package/dist/ui/display.js.map +1 -1
- package/dist/ui/shortcutsHelp.d.ts.map +1 -1
- package/dist/ui/shortcutsHelp.js +1 -0
- package/dist/ui/shortcutsHelp.js.map +1 -1
- package/package.json +3 -2
- package/dist/capabilities/askUserCapability.d.ts +0 -14
- package/dist/capabilities/askUserCapability.d.ts.map +0 -1
- package/dist/capabilities/askUserCapability.js +0 -134
- package/dist/capabilities/askUserCapability.js.map +0 -1
- package/dist/capabilities/codeGenerationCapability.d.ts +0 -13
- package/dist/capabilities/codeGenerationCapability.d.ts.map +0 -1
- package/dist/capabilities/codeGenerationCapability.js +0 -25
- package/dist/capabilities/codeGenerationCapability.js.map +0 -1
- package/dist/capabilities/performanceMonitoringCapability.d.ts +0 -108
- package/dist/capabilities/performanceMonitoringCapability.d.ts.map +0 -1
- package/dist/capabilities/performanceMonitoringCapability.js +0 -176
- package/dist/capabilities/performanceMonitoringCapability.js.map +0 -1
- package/dist/capabilities/todoCapability.d.ts +0 -19
- package/dist/capabilities/todoCapability.d.ts.map +0 -1
- package/dist/capabilities/todoCapability.js +0 -170
- package/dist/capabilities/todoCapability.js.map +0 -1
- package/dist/core/baseToolFactory.d.ts +0 -187
- package/dist/core/baseToolFactory.d.ts.map +0 -1
- package/dist/core/baseToolFactory.js +0 -352
- package/dist/core/baseToolFactory.js.map +0 -1
- package/dist/core/intelligentSummarizer.d.ts +0 -79
- package/dist/core/intelligentSummarizer.d.ts.map +0 -1
- package/dist/core/intelligentSummarizer.js +0 -273
- package/dist/core/intelligentSummarizer.js.map +0 -1
- package/dist/core/memorySystem.d.ts +0 -67
- package/dist/core/memorySystem.d.ts.map +0 -1
- package/dist/core/memorySystem.js +0 -334
- package/dist/core/memorySystem.js.map +0 -1
- package/dist/core/outputStyles.d.ts +0 -48
- package/dist/core/outputStyles.d.ts.map +0 -1
- package/dist/core/outputStyles.js +0 -270
- package/dist/core/outputStyles.js.map +0 -1
- package/dist/core/toolPatternAnalyzer.d.ts +0 -87
- package/dist/core/toolPatternAnalyzer.d.ts.map +0 -1
- package/dist/core/toolPatternAnalyzer.js +0 -272
- package/dist/core/toolPatternAnalyzer.js.map +0 -1
- package/dist/tools/backgroundBashTools.d.ts +0 -21
- package/dist/tools/backgroundBashTools.d.ts.map +0 -1
- package/dist/tools/backgroundBashTools.js +0 -215
- package/dist/tools/backgroundBashTools.js.map +0 -1
- package/dist/tools/code-quality-dashboard.d.ts +0 -57
- package/dist/tools/code-quality-dashboard.d.ts.map +0 -1
- package/dist/tools/code-quality-dashboard.js +0 -218
- package/dist/tools/code-quality-dashboard.js.map +0 -1
- package/dist/tools/tao/rlEngine.d.ts +0 -40
- package/dist/tools/tao/rlEngine.d.ts.map +0 -1
- package/dist/tools/tao/rlEngine.js +0 -237
- package/dist/tools/tao/rlEngine.js.map +0 -1
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base Tool Factory
|
|
3
|
-
*
|
|
4
|
-
* Provides utilities and patterns for creating tools with consistent:
|
|
5
|
-
* - Error handling
|
|
6
|
-
* - JSON schema generation
|
|
7
|
-
* - Result formatting
|
|
8
|
-
* - Progress reporting
|
|
9
|
-
* - Timeout handling
|
|
10
|
-
*
|
|
11
|
-
* Usage:
|
|
12
|
-
* ```typescript
|
|
13
|
-
* import { createTool, ToolBuilder, commonSchemas } from '../core/baseToolFactory.js';
|
|
14
|
-
*
|
|
15
|
-
* const myTool = createTool({
|
|
16
|
-
* name: 'MyTool',
|
|
17
|
-
* description: 'Does something useful',
|
|
18
|
-
* parameters: {
|
|
19
|
-
* input: { type: 'string', required: true, description: 'Input value' },
|
|
20
|
-
* },
|
|
21
|
-
* handler: async (args) => {
|
|
22
|
-
* // Implementation
|
|
23
|
-
* return { success: true, data: args.input };
|
|
24
|
-
* },
|
|
25
|
-
* });
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
import { reportToolProgress } from './toolRuntime.js';
|
|
29
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
30
|
-
// Common Schema Fragments
|
|
31
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
32
|
-
/**
|
|
33
|
-
* Common schema fragments for reuse across tools
|
|
34
|
-
*/
|
|
35
|
-
export const commonSchemas = {
|
|
36
|
-
/** File path parameter */
|
|
37
|
-
filePath: {
|
|
38
|
-
type: 'string',
|
|
39
|
-
description: 'Absolute path to the file',
|
|
40
|
-
},
|
|
41
|
-
/** Directory path parameter */
|
|
42
|
-
directoryPath: {
|
|
43
|
-
type: 'string',
|
|
44
|
-
description: 'Absolute path to the directory',
|
|
45
|
-
},
|
|
46
|
-
/** Timeout in milliseconds */
|
|
47
|
-
timeout: {
|
|
48
|
-
type: 'number',
|
|
49
|
-
description: 'Timeout in milliseconds',
|
|
50
|
-
default: 30000,
|
|
51
|
-
},
|
|
52
|
-
/** Boolean flag */
|
|
53
|
-
flag: (description, defaultValue = false) => ({
|
|
54
|
-
type: 'boolean',
|
|
55
|
-
description,
|
|
56
|
-
default: defaultValue,
|
|
57
|
-
}),
|
|
58
|
-
/** String with enum options */
|
|
59
|
-
enum: (description, values, defaultValue) => ({
|
|
60
|
-
type: 'string',
|
|
61
|
-
description,
|
|
62
|
-
enum: values,
|
|
63
|
-
...(defaultValue !== undefined && { default: defaultValue }),
|
|
64
|
-
}),
|
|
65
|
-
/** Array of strings */
|
|
66
|
-
stringArray: (description) => ({
|
|
67
|
-
type: 'array',
|
|
68
|
-
items: { type: 'string' },
|
|
69
|
-
description,
|
|
70
|
-
}),
|
|
71
|
-
/** Optional string */
|
|
72
|
-
optionalString: (description) => ({
|
|
73
|
-
type: 'string',
|
|
74
|
-
description,
|
|
75
|
-
}),
|
|
76
|
-
/** Required string */
|
|
77
|
-
requiredString: (description) => ({
|
|
78
|
-
type: 'string',
|
|
79
|
-
description,
|
|
80
|
-
}),
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Format a tool result to a consistent JSON string
|
|
84
|
-
*/
|
|
85
|
-
export function formatToolResult(result) {
|
|
86
|
-
return JSON.stringify(result, null, 2);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Create a successful tool result
|
|
90
|
-
*/
|
|
91
|
-
export function successResult(data, metadata) {
|
|
92
|
-
return formatToolResult({
|
|
93
|
-
success: true,
|
|
94
|
-
data,
|
|
95
|
-
...(metadata && { metadata }),
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Create a failed tool result
|
|
100
|
-
*/
|
|
101
|
-
export function errorResult(error, metadata) {
|
|
102
|
-
const message = error instanceof Error ? error.message : error;
|
|
103
|
-
return formatToolResult({
|
|
104
|
-
success: false,
|
|
105
|
-
error: message,
|
|
106
|
-
...(metadata && { metadata }),
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Create a result with warnings
|
|
111
|
-
*/
|
|
112
|
-
export function warningResult(data, warnings, metadata) {
|
|
113
|
-
return formatToolResult({
|
|
114
|
-
success: true,
|
|
115
|
-
data,
|
|
116
|
-
warnings,
|
|
117
|
-
...(metadata && { metadata }),
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Create a tool definition with simplified parameter handling
|
|
122
|
-
*/
|
|
123
|
-
export function createTool(options) {
|
|
124
|
-
const { name, description, parameters, handler, cacheable, formatResult } = options;
|
|
125
|
-
// Build JSON schema from simple parameter definitions
|
|
126
|
-
const jsonSchema = parameters
|
|
127
|
-
? buildJsonSchema(parameters)
|
|
128
|
-
: undefined;
|
|
129
|
-
return {
|
|
130
|
-
name,
|
|
131
|
-
description,
|
|
132
|
-
parameters: jsonSchema,
|
|
133
|
-
cacheable,
|
|
134
|
-
handler: async (args) => {
|
|
135
|
-
try {
|
|
136
|
-
const result = await handler(args);
|
|
137
|
-
// Use custom formatter if provided
|
|
138
|
-
if (formatResult) {
|
|
139
|
-
return formatResult(result);
|
|
140
|
-
}
|
|
141
|
-
// Default: JSON stringify
|
|
142
|
-
if (typeof result === 'string') {
|
|
143
|
-
return result;
|
|
144
|
-
}
|
|
145
|
-
return JSON.stringify(result, null, 2);
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
return errorResult(error instanceof Error ? error : String(error));
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Build a JSON schema from simplified parameter definitions
|
|
155
|
-
*/
|
|
156
|
-
function buildJsonSchema(parameters) {
|
|
157
|
-
const properties = {};
|
|
158
|
-
const required = [];
|
|
159
|
-
for (const [key, def] of Object.entries(parameters)) {
|
|
160
|
-
const prop = {
|
|
161
|
-
type: def.type,
|
|
162
|
-
description: def.description,
|
|
163
|
-
};
|
|
164
|
-
if (def.default !== undefined) {
|
|
165
|
-
prop['default'] = def.default;
|
|
166
|
-
}
|
|
167
|
-
if (def.enum) {
|
|
168
|
-
prop['enum'] = def.enum;
|
|
169
|
-
}
|
|
170
|
-
if (def.items) {
|
|
171
|
-
prop['items'] = def.items;
|
|
172
|
-
}
|
|
173
|
-
properties[key] = prop;
|
|
174
|
-
if (def.required) {
|
|
175
|
-
required.push(key);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return {
|
|
179
|
-
type: 'object',
|
|
180
|
-
properties,
|
|
181
|
-
...(required.length > 0 && { required }),
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
185
|
-
// Tool Builder (Fluent API)
|
|
186
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
187
|
-
/**
|
|
188
|
-
* Fluent builder for creating tools
|
|
189
|
-
*
|
|
190
|
-
* Usage:
|
|
191
|
-
* ```typescript
|
|
192
|
-
* const tool = new ToolBuilder('MyTool')
|
|
193
|
-
* .description('Does something useful')
|
|
194
|
-
* .param('input', 'string', 'The input value', true)
|
|
195
|
-
* .param('verbose', 'boolean', 'Enable verbose output', false, false)
|
|
196
|
-
* .handler(async (args) => {
|
|
197
|
-
* return { data: args.input };
|
|
198
|
-
* })
|
|
199
|
-
* .build();
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
export class ToolBuilder {
|
|
203
|
-
_name;
|
|
204
|
-
_description = '';
|
|
205
|
-
_parameters = {};
|
|
206
|
-
_handler;
|
|
207
|
-
_cacheable = false;
|
|
208
|
-
_formatResult;
|
|
209
|
-
constructor(name) {
|
|
210
|
-
this._name = name;
|
|
211
|
-
}
|
|
212
|
-
description(desc) {
|
|
213
|
-
this._description = desc;
|
|
214
|
-
return this;
|
|
215
|
-
}
|
|
216
|
-
param(name, type, description, required = false, defaultValue) {
|
|
217
|
-
this._parameters[name] = {
|
|
218
|
-
type,
|
|
219
|
-
description,
|
|
220
|
-
required,
|
|
221
|
-
...(defaultValue !== undefined && { default: defaultValue }),
|
|
222
|
-
};
|
|
223
|
-
return this;
|
|
224
|
-
}
|
|
225
|
-
enumParam(name, description, values, required = false, defaultValue) {
|
|
226
|
-
this._parameters[name] = {
|
|
227
|
-
type: 'string',
|
|
228
|
-
description,
|
|
229
|
-
required,
|
|
230
|
-
enum: values,
|
|
231
|
-
...(defaultValue !== undefined && { default: defaultValue }),
|
|
232
|
-
};
|
|
233
|
-
return this;
|
|
234
|
-
}
|
|
235
|
-
arrayParam(name, description, itemType = 'string', required = false) {
|
|
236
|
-
this._parameters[name] = {
|
|
237
|
-
type: 'array',
|
|
238
|
-
description,
|
|
239
|
-
required,
|
|
240
|
-
items: { type: itemType },
|
|
241
|
-
};
|
|
242
|
-
return this;
|
|
243
|
-
}
|
|
244
|
-
handler(fn) {
|
|
245
|
-
this._handler = fn;
|
|
246
|
-
return this;
|
|
247
|
-
}
|
|
248
|
-
cacheable(value = true) {
|
|
249
|
-
this._cacheable = value;
|
|
250
|
-
return this;
|
|
251
|
-
}
|
|
252
|
-
formatResult(fn) {
|
|
253
|
-
this._formatResult = fn;
|
|
254
|
-
return this;
|
|
255
|
-
}
|
|
256
|
-
build() {
|
|
257
|
-
if (!this._handler) {
|
|
258
|
-
throw new Error(`Tool ${this._name} requires a handler`);
|
|
259
|
-
}
|
|
260
|
-
return createTool({
|
|
261
|
-
name: this._name,
|
|
262
|
-
description: this._description,
|
|
263
|
-
parameters: Object.keys(this._parameters).length > 0 ? this._parameters : undefined,
|
|
264
|
-
handler: this._handler,
|
|
265
|
-
cacheable: this._cacheable,
|
|
266
|
-
formatResult: this._formatResult,
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
271
|
-
// Tool Suite Builder
|
|
272
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
273
|
-
/**
|
|
274
|
-
* Builder for creating tool suites
|
|
275
|
-
*/
|
|
276
|
-
export class ToolSuiteBuilder {
|
|
277
|
-
_id;
|
|
278
|
-
_description;
|
|
279
|
-
_tools = [];
|
|
280
|
-
constructor(id) {
|
|
281
|
-
this._id = id;
|
|
282
|
-
}
|
|
283
|
-
description(desc) {
|
|
284
|
-
this._description = desc;
|
|
285
|
-
return this;
|
|
286
|
-
}
|
|
287
|
-
addTool(tool) {
|
|
288
|
-
this._tools.push(tool);
|
|
289
|
-
return this;
|
|
290
|
-
}
|
|
291
|
-
addTools(tools) {
|
|
292
|
-
this._tools.push(...tools);
|
|
293
|
-
return this;
|
|
294
|
-
}
|
|
295
|
-
build() {
|
|
296
|
-
return {
|
|
297
|
-
id: this._id,
|
|
298
|
-
description: this._description,
|
|
299
|
-
tools: this._tools,
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
304
|
-
// Async Utilities for Tools
|
|
305
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
306
|
-
/**
|
|
307
|
-
* Execute with timeout
|
|
308
|
-
*/
|
|
309
|
-
export async function withTimeout(promise, timeoutMs, errorMessage = 'Operation timed out') {
|
|
310
|
-
let timeoutId;
|
|
311
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
312
|
-
timeoutId = setTimeout(() => reject(new Error(errorMessage)), timeoutMs);
|
|
313
|
-
});
|
|
314
|
-
try {
|
|
315
|
-
return await Promise.race([promise, timeoutPromise]);
|
|
316
|
-
}
|
|
317
|
-
finally {
|
|
318
|
-
clearTimeout(timeoutId);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Execute with progress reporting for long operations
|
|
323
|
-
*/
|
|
324
|
-
export async function withProgress(operation) {
|
|
325
|
-
const report = (current, total, message) => {
|
|
326
|
-
reportToolProgress({ current, total, message });
|
|
327
|
-
};
|
|
328
|
-
return operation(report);
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Retry an operation with exponential backoff
|
|
332
|
-
*/
|
|
333
|
-
export async function withRetry(operation, options = {}) {
|
|
334
|
-
const { maxRetries = 3, baseDelayMs = 1000, shouldRetry = () => true } = options;
|
|
335
|
-
let lastError;
|
|
336
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
337
|
-
try {
|
|
338
|
-
return await operation();
|
|
339
|
-
}
|
|
340
|
-
catch (error) {
|
|
341
|
-
lastError = error;
|
|
342
|
-
if (attempt === maxRetries || !shouldRetry(error)) {
|
|
343
|
-
throw error;
|
|
344
|
-
}
|
|
345
|
-
// Exponential backoff
|
|
346
|
-
const delayMs = baseDelayMs * Math.pow(2, attempt);
|
|
347
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
throw lastError;
|
|
351
|
-
}
|
|
352
|
-
//# sourceMappingURL=baseToolFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"baseToolFactory.js","sourceRoot":"","sources":["../../src/core/baseToolFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,kFAAkF;AAClF,0BAA0B;AAC1B,kFAAkF;AAElF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,0BAA0B;IAC1B,QAAQ,EAAE;QACR,IAAI,EAAE,QAAiB;QACvB,WAAW,EAAE,2BAA2B;KACzC;IAED,+BAA+B;IAC/B,aAAa,EAAE;QACb,IAAI,EAAE,QAAiB;QACvB,WAAW,EAAE,gCAAgC;KAC9C;IAED,8BAA8B;IAC9B,OAAO,EAAE;QACP,IAAI,EAAE,QAAiB;QACvB,WAAW,EAAE,yBAAyB;QACtC,OAAO,EAAE,KAAK;KACf;IAED,mBAAmB;IACnB,IAAI,EAAE,CAAC,WAAmB,EAAE,YAAY,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC;QACpD,IAAI,EAAE,SAAkB;QACxB,WAAW;QACX,OAAO,EAAE,YAAY;KACtB,CAAC;IAEF,+BAA+B;IAC/B,IAAI,EAAE,CAAC,WAAmB,EAAE,MAAgB,EAAE,YAAqB,EAAE,EAAE,CAAC,CAAC;QACvE,IAAI,EAAE,QAAiB;QACvB,WAAW;QACX,IAAI,EAAE,MAAM;QACZ,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;KAC7D,CAAC;IAEF,uBAAuB;IACvB,WAAW,EAAE,CAAC,WAAmB,EAAE,EAAE,CAAC,CAAC;QACrC,IAAI,EAAE,OAAgB;QACtB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE;QAClC,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KAAK,UAAU,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClD,MAAM,KAAK,CAAC;YACd,CAAC;YAED,sBAAsB;YACtB,MAAM,OAAO,GAAG,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACnD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,MAAM,SAAS,CAAC;AAClB,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Intelligent Tool Output Summarizer
|
|
3
|
-
*
|
|
4
|
-
* Critical for Claude Code operations: prevents context window overload while
|
|
5
|
-
* maintaining essential information. Based on analysis of real Claude Code behavior.
|
|
6
|
-
*/
|
|
7
|
-
export interface SummarizationContext {
|
|
8
|
-
toolName: string;
|
|
9
|
-
args: Record<string, unknown>;
|
|
10
|
-
output: string;
|
|
11
|
-
outputSize: number;
|
|
12
|
-
previousToolCalls: string[];
|
|
13
|
-
sessionDuration: number;
|
|
14
|
-
}
|
|
15
|
-
export interface SummarizedOutput {
|
|
16
|
-
summary: string;
|
|
17
|
-
wasSummarized: boolean;
|
|
18
|
-
originalSize: number;
|
|
19
|
-
summarySize: number;
|
|
20
|
-
compressionRatio: number;
|
|
21
|
-
retainedKeyInfo: string[];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Intelligent summarizer that understands tool semantics
|
|
25
|
-
* and extracts only what the AI needs to continue effectively
|
|
26
|
-
*/
|
|
27
|
-
export declare class IntelligentToolSummarizer {
|
|
28
|
-
private readonly ALWAYS_SUMMARIZE_THRESHOLD;
|
|
29
|
-
private readonly CONTEXT_AWARE_THRESHOLD;
|
|
30
|
-
/**
|
|
31
|
-
* Summarize tool output intelligently based on tool type and context
|
|
32
|
-
*/
|
|
33
|
-
summarize(context: SummarizationContext): SummarizedOutput;
|
|
34
|
-
/**
|
|
35
|
-
* Determine if output should be summarized based on size and context
|
|
36
|
-
*/
|
|
37
|
-
private shouldSummarize;
|
|
38
|
-
/**
|
|
39
|
-
* Apply tool-specific summarization strategies
|
|
40
|
-
*/
|
|
41
|
-
private summarizeByToolType;
|
|
42
|
-
/**
|
|
43
|
-
* Summarize file content - show structure and important sections
|
|
44
|
-
*/
|
|
45
|
-
private summarizeFileContent;
|
|
46
|
-
/**
|
|
47
|
-
* Extract code structure (imports, classes, functions)
|
|
48
|
-
*/
|
|
49
|
-
private extractCodeStructure;
|
|
50
|
-
/**
|
|
51
|
-
* Summarize search results - show count and samples
|
|
52
|
-
*/
|
|
53
|
-
private summarizeSearchResults;
|
|
54
|
-
/**
|
|
55
|
-
* Summarize path lists - show count and samples
|
|
56
|
-
*/
|
|
57
|
-
private summarizePathList;
|
|
58
|
-
/**
|
|
59
|
-
* Summarize test/build output - focus on failures
|
|
60
|
-
*/
|
|
61
|
-
private summarizeTestOutput;
|
|
62
|
-
/**
|
|
63
|
-
* Summarize bash command output - keep errors and key info
|
|
64
|
-
*/
|
|
65
|
-
private summarizeBashOutput;
|
|
66
|
-
/**
|
|
67
|
-
* Default summarization for unknown tool types
|
|
68
|
-
*/
|
|
69
|
-
private defaultSummarization;
|
|
70
|
-
/**
|
|
71
|
-
* Extract key information from output for tracking
|
|
72
|
-
*/
|
|
73
|
-
private extractKeyInfo;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Global singleton instance
|
|
77
|
-
*/
|
|
78
|
-
export declare const intelligentSummarizer: IntelligentToolSummarizer;
|
|
79
|
-
//# sourceMappingURL=intelligentSummarizer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intelligentSummarizer.d.ts","sourceRoot":"","sources":["../../src/core/intelligentSummarizer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EA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