erosolar-cli 1.7.13 → 1.7.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/responseVerifier.d.ts +79 -0
- package/dist/core/responseVerifier.d.ts.map +1 -0
- package/dist/core/responseVerifier.js +443 -0
- package/dist/core/responseVerifier.js.map +1 -0
- package/dist/shell/interactiveShell.d.ts +5 -0
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +45 -14
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/ui/ShellUIAdapter.d.ts +3 -0
- package/dist/ui/ShellUIAdapter.d.ts.map +1 -1
- package/dist/ui/ShellUIAdapter.js +4 -10
- package/dist/ui/ShellUIAdapter.js.map +1 -1
- package/dist/ui/display.d.ts +15 -0
- package/dist/ui/display.d.ts.map +1 -1
- package/dist/ui/display.js +57 -0
- package/dist/ui/display.js.map +1 -1
- package/dist/ui/persistentPrompt.d.ts +4 -0
- package/dist/ui/persistentPrompt.d.ts.map +1 -1
- package/dist/ui/persistentPrompt.js +10 -11
- package/dist/ui/persistentPrompt.js.map +1 -1
- package/package.json +1 -1
- package/dist/bin/core/agent.js +0 -362
- package/dist/bin/core/agentProfileManifest.js +0 -187
- package/dist/bin/core/agentProfiles.js +0 -34
- package/dist/bin/core/agentRulebook.js +0 -135
- package/dist/bin/core/agentSchemaLoader.js +0 -233
- package/dist/bin/core/contextManager.js +0 -412
- package/dist/bin/core/contextWindow.js +0 -122
- package/dist/bin/core/customCommands.js +0 -80
- package/dist/bin/core/errors/apiKeyErrors.js +0 -114
- package/dist/bin/core/errors/errorTypes.js +0 -340
- package/dist/bin/core/errors/safetyValidator.js +0 -304
- package/dist/bin/core/errors.js +0 -32
- package/dist/bin/core/modelDiscovery.js +0 -755
- package/dist/bin/core/preferences.js +0 -224
- package/dist/bin/core/schemaValidator.js +0 -92
- package/dist/bin/core/secretStore.js +0 -199
- package/dist/bin/core/sessionStore.js +0 -187
- package/dist/bin/core/toolRuntime.js +0 -290
- package/dist/bin/core/types.js +0 -1
- package/dist/bin/shell/bracketedPasteManager.js +0 -350
- package/dist/bin/shell/fileChangeTracker.js +0 -65
- package/dist/bin/shell/interactiveShell.js +0 -2908
- package/dist/bin/shell/liveStatus.js +0 -78
- package/dist/bin/shell/shellApp.js +0 -290
- package/dist/bin/shell/systemPrompt.js +0 -60
- package/dist/bin/shell/updateManager.js +0 -108
- package/dist/bin/ui/ShellUIAdapter.js +0 -459
- package/dist/bin/ui/UnifiedUIController.js +0 -183
- package/dist/bin/ui/animation/AnimationScheduler.js +0 -430
- package/dist/bin/ui/codeHighlighter.js +0 -854
- package/dist/bin/ui/designSystem.js +0 -121
- package/dist/bin/ui/display.js +0 -1222
- package/dist/bin/ui/interrupts/InterruptManager.js +0 -437
- package/dist/bin/ui/layout.js +0 -139
- package/dist/bin/ui/orchestration/StatusOrchestrator.js +0 -403
- package/dist/bin/ui/outputMode.js +0 -38
- package/dist/bin/ui/persistentPrompt.js +0 -183
- package/dist/bin/ui/richText.js +0 -338
- package/dist/bin/ui/shortcutsHelp.js +0 -87
- package/dist/bin/ui/telemetry/UITelemetry.js +0 -443
- package/dist/bin/ui/textHighlighter.js +0 -210
- package/dist/bin/ui/theme.js +0 -116
- package/dist/bin/ui/toolDisplay.js +0 -423
- package/dist/bin/ui/toolDisplayAdapter.js +0 -357
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool Display Adapter - Integrates Claude Code style display with ShellUIAdapter
|
|
3
|
-
*
|
|
4
|
-
* Provides high-level interface for displaying tool executions with
|
|
5
|
-
* Claude Code's clean formatting.
|
|
6
|
-
*/
|
|
7
|
-
import { formatToolCall, formatToolResult, formatDiff, formatDiffSummary, formatThinking, formatDuration, } from './toolDisplay.js';
|
|
8
|
-
import { theme } from './theme.js';
|
|
9
|
-
export class ToolDisplayAdapter {
|
|
10
|
-
constructor(display) {
|
|
11
|
-
this.activeTools = new Map();
|
|
12
|
-
this.display = display;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Show tool call starting
|
|
16
|
-
*/
|
|
17
|
-
showToolStart(call) {
|
|
18
|
-
this.activeTools.set(call.id, {
|
|
19
|
-
call,
|
|
20
|
-
startTime: Date.now(),
|
|
21
|
-
});
|
|
22
|
-
const display = {
|
|
23
|
-
name: call.name,
|
|
24
|
-
args: call.arguments ?? {},
|
|
25
|
-
timestamp: Date.now(),
|
|
26
|
-
};
|
|
27
|
-
const formatted = formatToolCall(display, { includePrefix: false });
|
|
28
|
-
// Claude Code style: show tool call with ⏺ prefix (handled by showAction)
|
|
29
|
-
this.display.showAction(formatted);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Show tool result
|
|
33
|
-
*/
|
|
34
|
-
showToolResult(callId, output, status = 'success') {
|
|
35
|
-
const active = this.activeTools.get(callId);
|
|
36
|
-
const duration = active ? Date.now() - active.startTime : undefined;
|
|
37
|
-
// Analyze output to create summary
|
|
38
|
-
const summary = this.createResultSummary(active?.call.name ?? 'tool', output, status);
|
|
39
|
-
const lines = output.split('\n');
|
|
40
|
-
const nonEmptyLines = lines.filter(l => l.trim());
|
|
41
|
-
const result = {
|
|
42
|
-
summary,
|
|
43
|
-
fullOutput: output,
|
|
44
|
-
linesShown: Math.min(nonEmptyLines.length, 3),
|
|
45
|
-
totalLines: nonEmptyLines.length,
|
|
46
|
-
status,
|
|
47
|
-
duration,
|
|
48
|
-
};
|
|
49
|
-
const formatted = formatToolResult(result, { includePrefix: false });
|
|
50
|
-
// Claude Code style: show result with ⎿ prefix (using showSubAction)
|
|
51
|
-
// Add duration if available
|
|
52
|
-
if (duration !== undefined && duration > 100) {
|
|
53
|
-
const durationStr = formatDuration(duration);
|
|
54
|
-
this.display.showSubAction(`${formatted} ${theme.ui.muted(`(${durationStr})`)}`, status === 'success' ? 'success' : 'error');
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
this.display.showSubAction(formatted, status === 'success' ? 'success' : 'error');
|
|
58
|
-
}
|
|
59
|
-
// Show preview of output if it's substantial
|
|
60
|
-
if (nonEmptyLines.length > 0 && this.shouldShowPreview(active?.call.name)) {
|
|
61
|
-
const preview = this.formatOutputPreview(output, active?.call.name, 4);
|
|
62
|
-
if (preview) {
|
|
63
|
-
// Show preview as continuation (more indented)
|
|
64
|
-
this.display.showSystemMessage(preview);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
this.activeTools.delete(callId);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Determine if we should show output preview for this tool
|
|
71
|
-
*/
|
|
72
|
-
shouldShowPreview(toolName) {
|
|
73
|
-
if (!toolName)
|
|
74
|
-
return false;
|
|
75
|
-
// Tools that should show previews
|
|
76
|
-
const showPreviewFor = new Set([
|
|
77
|
-
'Bash', 'bash', 'execute_bash',
|
|
78
|
-
'Grep', 'grep_search',
|
|
79
|
-
'Glob', 'list_files',
|
|
80
|
-
]);
|
|
81
|
-
return showPreviewFor.has(toolName);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Format output preview with proper indentation
|
|
85
|
-
* Handles JSON, structured data, and plain text intelligently
|
|
86
|
-
*/
|
|
87
|
-
formatOutputPreview(output, _toolName, maxLines) {
|
|
88
|
-
const lines = output.split('\n').filter(l => l.trim());
|
|
89
|
-
if (lines.length === 0)
|
|
90
|
-
return null;
|
|
91
|
-
// Try to detect and format JSON
|
|
92
|
-
const jsonFormatted = this.tryFormatJSON(output);
|
|
93
|
-
if (jsonFormatted) {
|
|
94
|
-
return jsonFormatted;
|
|
95
|
-
}
|
|
96
|
-
// Show fewer lines for long content
|
|
97
|
-
const previewLines = lines.slice(0, Math.min(maxLines, lines.length));
|
|
98
|
-
const remaining = lines.length - previewLines.length;
|
|
99
|
-
// Format with indentation (continuing from ⎿ symbol)
|
|
100
|
-
const formatted = previewLines.map(line => {
|
|
101
|
-
// Truncate very long lines
|
|
102
|
-
if (line.length > 100) {
|
|
103
|
-
return ` ${line.slice(0, 97)}...`;
|
|
104
|
-
}
|
|
105
|
-
return ` ${line}`;
|
|
106
|
-
});
|
|
107
|
-
// Add ellipsis if there are more lines
|
|
108
|
-
if (remaining > 0) {
|
|
109
|
-
formatted.push(` ${theme.ui.muted(`… +${remaining} line${remaining === 1 ? '' : 's'} ${theme.ui.muted('(ctrl+o to expand)')}`)}`.trim());
|
|
110
|
-
}
|
|
111
|
-
return formatted.join('\n');
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Try to parse and format output as JSON
|
|
115
|
-
*/
|
|
116
|
-
tryFormatJSON(output) {
|
|
117
|
-
const trimmed = output.trim();
|
|
118
|
-
if (!trimmed.startsWith('{') && !trimmed.startsWith('[')) {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
try {
|
|
122
|
-
const parsed = JSON.parse(trimmed);
|
|
123
|
-
const formatted = JSON.stringify(parsed, null, 2);
|
|
124
|
-
// Add basic syntax highlighting
|
|
125
|
-
const highlighted = formatted
|
|
126
|
-
.split('\n')
|
|
127
|
-
.slice(0, 10) // Limit to 10 lines for preview
|
|
128
|
-
.map(line => {
|
|
129
|
-
// Color keys
|
|
130
|
-
line = line.replace(/"([^"]+)":/g, (_, key) => `${theme.info(`"${key}"`)}: `);
|
|
131
|
-
// Color string values
|
|
132
|
-
line = line.replace(/: "([^"]*)"/g, (_, value) => `: ${theme.success(`"${value}"`)}`);
|
|
133
|
-
// Color numbers
|
|
134
|
-
line = line.replace(/: (\d+\.?\d*)/g, (_, num) => `: ${theme.warning(num)}`);
|
|
135
|
-
// Color booleans/null
|
|
136
|
-
line = line.replace(/: (true|false|null)/g, (_, bool) => `: ${theme.secondary(bool)}`);
|
|
137
|
-
return ` ${line}`;
|
|
138
|
-
})
|
|
139
|
-
.join('\n');
|
|
140
|
-
const totalLines = formatted.split('\n').length;
|
|
141
|
-
if (totalLines > 10) {
|
|
142
|
-
return `${highlighted}\n ${theme.ui.muted(`… +${totalLines - 10} lines (ctrl+o to expand)`)}`;
|
|
143
|
-
}
|
|
144
|
-
return highlighted;
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Show tool error
|
|
152
|
-
*/
|
|
153
|
-
showToolError(callId, error) {
|
|
154
|
-
this.showToolResult(callId, error, 'error');
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Show diff output (for Edit/Write tools)
|
|
158
|
-
*/
|
|
159
|
-
showDiff(file, additions, removals, diff) {
|
|
160
|
-
// Show summary first (Claude Code style)
|
|
161
|
-
const summary = formatDiffSummary(file, additions, removals);
|
|
162
|
-
this.display.showSubAction(summary);
|
|
163
|
-
// Show formatted diff
|
|
164
|
-
const formatted = formatDiff(diff);
|
|
165
|
-
this.display.showSystemMessage(formatted);
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Show thinking indicator
|
|
169
|
-
*/
|
|
170
|
-
showThinking(durationMs) {
|
|
171
|
-
const formatted = formatThinking(durationMs, false);
|
|
172
|
-
this.display.showAction(formatted);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Create a concise summary from tool output
|
|
176
|
-
* Parses output intelligently to extract meaningful information
|
|
177
|
-
*/
|
|
178
|
-
createResultSummary(toolName, output, status) {
|
|
179
|
-
if (status === 'error') {
|
|
180
|
-
return 'Error';
|
|
181
|
-
}
|
|
182
|
-
if (!toolName) {
|
|
183
|
-
return 'Completed';
|
|
184
|
-
}
|
|
185
|
-
const lines = output.split('\n');
|
|
186
|
-
const nonEmptyLines = lines.filter(l => l.trim());
|
|
187
|
-
// Tool-specific summaries
|
|
188
|
-
switch (toolName) {
|
|
189
|
-
case 'Read':
|
|
190
|
-
case 'read_file': {
|
|
191
|
-
const lineCount = nonEmptyLines.length;
|
|
192
|
-
return `Read ${lineCount} line${lineCount === 1 ? '' : 's'}`;
|
|
193
|
-
}
|
|
194
|
-
case 'Write':
|
|
195
|
-
case 'write_file':
|
|
196
|
-
return 'Wrote file';
|
|
197
|
-
case 'Edit':
|
|
198
|
-
case 'edit_file': {
|
|
199
|
-
// Try to extract addition/removal counts from output
|
|
200
|
-
const addMatch = output.match(/(\d+) addition/);
|
|
201
|
-
const remMatch = output.match(/(\d+) removal/);
|
|
202
|
-
if (addMatch || remMatch) {
|
|
203
|
-
const parts = ['Updated'];
|
|
204
|
-
if (addMatch)
|
|
205
|
-
parts.push(`${addMatch[1]} addition${addMatch[1] === '1' ? '' : 's'}`);
|
|
206
|
-
if (remMatch) {
|
|
207
|
-
if (addMatch)
|
|
208
|
-
parts.push('and');
|
|
209
|
-
parts.push(`${remMatch[1]} removal${remMatch[1] === '1' ? '' : 's'}`);
|
|
210
|
-
}
|
|
211
|
-
return parts.join(' ');
|
|
212
|
-
}
|
|
213
|
-
return 'Updated file';
|
|
214
|
-
}
|
|
215
|
-
case 'Glob':
|
|
216
|
-
case 'list_files': {
|
|
217
|
-
const fileCount = nonEmptyLines.length;
|
|
218
|
-
if (fileCount === 0) {
|
|
219
|
-
return 'No files found';
|
|
220
|
-
}
|
|
221
|
-
return `Found ${fileCount} file${fileCount === 1 ? '' : 's'}`;
|
|
222
|
-
}
|
|
223
|
-
case 'Grep':
|
|
224
|
-
case 'grep_search': {
|
|
225
|
-
// Check output mode from result
|
|
226
|
-
if (output.includes(':')) {
|
|
227
|
-
// Content mode - count lines
|
|
228
|
-
const matchCount = nonEmptyLines.length;
|
|
229
|
-
return `Found ${matchCount} line${matchCount === 1 ? '' : 's'}`;
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
// Files mode - count files
|
|
233
|
-
const fileCount = nonEmptyLines.length;
|
|
234
|
-
return `Found ${fileCount} file${fileCount === 1 ? '' : 's'}`;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
case 'Bash':
|
|
238
|
-
case 'bash':
|
|
239
|
-
case 'execute_bash': {
|
|
240
|
-
// Try to parse command output for meaningful summary
|
|
241
|
-
if (nonEmptyLines.length === 0) {
|
|
242
|
-
return 'Completed';
|
|
243
|
-
}
|
|
244
|
-
// Check for common command patterns
|
|
245
|
-
const firstLine = nonEmptyLines[0];
|
|
246
|
-
if (!firstLine) {
|
|
247
|
-
return 'Completed';
|
|
248
|
-
}
|
|
249
|
-
// Git commands
|
|
250
|
-
if (firstLine.includes('On branch')) {
|
|
251
|
-
return 'Git status';
|
|
252
|
-
}
|
|
253
|
-
if (firstLine.includes('commit') || firstLine.includes('Author:')) {
|
|
254
|
-
return 'Git log';
|
|
255
|
-
}
|
|
256
|
-
// Build/test commands
|
|
257
|
-
if (output.includes('error TS') || output.includes('error:')) {
|
|
258
|
-
const errorCount = (output.match(/error/gi) || []).length;
|
|
259
|
-
return `${errorCount} error${errorCount === 1 ? '' : 's'}`;
|
|
260
|
-
}
|
|
261
|
-
if (output.includes('passing') || output.includes('✓')) {
|
|
262
|
-
return 'Tests passed';
|
|
263
|
-
}
|
|
264
|
-
// Default to first line or "Completed"
|
|
265
|
-
if (firstLine.length <= 40) {
|
|
266
|
-
return firstLine;
|
|
267
|
-
}
|
|
268
|
-
return 'Completed';
|
|
269
|
-
}
|
|
270
|
-
case 'WebFetch':
|
|
271
|
-
case 'web_fetch':
|
|
272
|
-
return 'Content fetched';
|
|
273
|
-
case 'WebSearch':
|
|
274
|
-
case 'web_search': {
|
|
275
|
-
// Count search results
|
|
276
|
-
const resultMatch = output.match(/(\d+) results?/i);
|
|
277
|
-
if (resultMatch) {
|
|
278
|
-
return `Found ${resultMatch[1]} results`;
|
|
279
|
-
}
|
|
280
|
-
return 'Results retrieved';
|
|
281
|
-
}
|
|
282
|
-
case 'Task':
|
|
283
|
-
case 'SubAgent': {
|
|
284
|
-
// For task/subagent, try to extract completion message
|
|
285
|
-
const lastLine = nonEmptyLines[nonEmptyLines.length - 1];
|
|
286
|
-
if (lastLine && lastLine.length <= 50) {
|
|
287
|
-
return lastLine;
|
|
288
|
-
}
|
|
289
|
-
return 'Task completed';
|
|
290
|
-
}
|
|
291
|
-
default:
|
|
292
|
-
// Generic fallback - try to use first meaningful line
|
|
293
|
-
if (nonEmptyLines.length > 0) {
|
|
294
|
-
const firstLine = nonEmptyLines[0];
|
|
295
|
-
if (firstLine && firstLine.length <= 40) {
|
|
296
|
-
return firstLine;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return 'Completed';
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Parse diff output into structured format
|
|
304
|
-
*/
|
|
305
|
-
static parseDiffOutput(diffText) {
|
|
306
|
-
const lines = [];
|
|
307
|
-
let additions = 0;
|
|
308
|
-
let removals = 0;
|
|
309
|
-
const diffLines = diffText.split('\n');
|
|
310
|
-
let currentLineNum = 0;
|
|
311
|
-
for (const line of diffLines) {
|
|
312
|
-
// Check for line number prefix (e.g., " 42→" or " 42 ")
|
|
313
|
-
const lineNumMatch = line.match(/^\s*(\d+)[→\s]/);
|
|
314
|
-
if (lineNumMatch && lineNumMatch[1]) {
|
|
315
|
-
currentLineNum = parseInt(lineNumMatch[1], 10);
|
|
316
|
-
}
|
|
317
|
-
// Detect diff type
|
|
318
|
-
if (line.trim().startsWith('+') && !line.startsWith('+++')) {
|
|
319
|
-
additions++;
|
|
320
|
-
lines.push({
|
|
321
|
-
lineNumber: currentLineNum,
|
|
322
|
-
type: 'add',
|
|
323
|
-
content: line.replace(/^\s*\d+[→\s]\s*\+\s*/, ''),
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
else if (line.trim().startsWith('-') && !line.startsWith('---')) {
|
|
327
|
-
removals++;
|
|
328
|
-
lines.push({
|
|
329
|
-
lineNumber: currentLineNum,
|
|
330
|
-
type: 'remove',
|
|
331
|
-
content: line.replace(/^\s*\d+[→\s]\s*-\s*/, ''),
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
else if (line.trim().startsWith('@@')) {
|
|
335
|
-
lines.push({
|
|
336
|
-
type: 'info',
|
|
337
|
-
content: line,
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
else if (lineNumMatch) {
|
|
341
|
-
lines.push({
|
|
342
|
-
lineNumber: currentLineNum,
|
|
343
|
-
type: 'context',
|
|
344
|
-
content: line.replace(/^\s*\d+[→\s]\s*/, ''),
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return { additions, removals, lines };
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Enhanced display for tool executions
|
|
353
|
-
* Wraps Display with Claude Code style formatting
|
|
354
|
-
*/
|
|
355
|
-
export function createToolDisplayAdapter(display) {
|
|
356
|
-
return new ToolDisplayAdapter(display);
|
|
357
|
-
}
|