erosolar-cli 2.1.171 → 2.1.172
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 +1 -1
- package/agents/erosolar-code.rules.json +2 -2
- package/agents/general.rules.json +3 -21
- package/dist/StringUtils.d.ts +8 -0
- package/dist/StringUtils.d.ts.map +1 -0
- package/dist/StringUtils.js +11 -0
- package/dist/StringUtils.js.map +1 -0
- package/dist/capabilities/statusCapability.js +2 -2
- package/dist/capabilities/statusCapability.js.map +1 -1
- package/dist/contracts/agent-schemas.json +5 -5
- package/dist/core/agent.d.ts +24 -83
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +248 -499
- package/dist/core/agent.js.map +1 -1
- package/dist/core/aiFlowSupervisor.d.ts +44 -0
- package/dist/core/aiFlowSupervisor.d.ts.map +1 -0
- package/dist/core/aiFlowSupervisor.js +299 -0
- package/dist/core/aiFlowSupervisor.js.map +1 -0
- package/dist/core/cliTestHarness.d.ts +200 -0
- package/dist/core/cliTestHarness.d.ts.map +1 -0
- package/dist/core/cliTestHarness.js +549 -0
- package/dist/core/cliTestHarness.js.map +1 -0
- package/dist/core/preferences.d.ts +0 -1
- package/dist/core/preferences.d.ts.map +1 -1
- package/dist/core/preferences.js +1 -8
- package/dist/core/preferences.js.map +1 -1
- package/dist/core/schemaValidator.js +3 -3
- package/dist/core/schemaValidator.js.map +1 -1
- package/dist/core/testUtils.d.ts +121 -0
- package/dist/core/testUtils.d.ts.map +1 -0
- package/dist/core/testUtils.js +235 -0
- package/dist/core/testUtils.js.map +1 -0
- package/dist/core/toolPreconditions.d.ts +11 -0
- package/dist/core/toolPreconditions.d.ts.map +1 -1
- package/dist/core/toolPreconditions.js +164 -33
- package/dist/core/toolPreconditions.js.map +1 -1
- package/dist/core/toolRuntime.d.ts.map +1 -1
- package/dist/core/toolRuntime.js +114 -9
- package/dist/core/toolRuntime.js.map +1 -1
- package/dist/core/toolValidation.d.ts +116 -0
- package/dist/core/toolValidation.d.ts.map +1 -0
- package/dist/core/toolValidation.js +282 -0
- package/dist/core/toolValidation.js.map +1 -0
- package/dist/core/updateChecker.d.ts +1 -61
- package/dist/core/updateChecker.d.ts.map +1 -1
- package/dist/core/updateChecker.js +3 -147
- package/dist/core/updateChecker.js.map +1 -1
- package/dist/headless/evalMode.d.ts.map +1 -1
- package/dist/headless/evalMode.js +0 -6
- package/dist/headless/evalMode.js.map +1 -1
- package/dist/headless/headlessApp.d.ts.map +1 -1
- package/dist/headless/headlessApp.js +39 -6
- package/dist/headless/headlessApp.js.map +1 -1
- package/dist/mcp/sseClient.d.ts +1 -4
- package/dist/mcp/sseClient.d.ts.map +1 -1
- package/dist/mcp/sseClient.js +2 -36
- package/dist/mcp/sseClient.js.map +1 -1
- package/dist/mcp/stdioClient.d.ts +1 -4
- package/dist/mcp/stdioClient.d.ts.map +1 -1
- package/dist/mcp/stdioClient.js +1 -41
- package/dist/mcp/stdioClient.js.map +1 -1
- package/dist/mcp/toolBridge.d.ts +0 -3
- package/dist/mcp/toolBridge.d.ts.map +1 -1
- package/dist/mcp/toolBridge.js +2 -2
- package/dist/mcp/toolBridge.js.map +1 -1
- package/dist/mcp/types.d.ts +0 -18
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -1
- package/dist/plugins/tools/nodeDefaults.js +2 -0
- package/dist/plugins/tools/nodeDefaults.js.map +1 -1
- package/dist/providers/openaiResponsesProvider.d.ts.map +1 -1
- package/dist/providers/openaiResponsesProvider.js +74 -79
- package/dist/providers/openaiResponsesProvider.js.map +1 -1
- package/dist/runtime/agentController.d.ts.map +1 -1
- package/dist/runtime/agentController.js +3 -6
- package/dist/runtime/agentController.js.map +1 -1
- package/dist/runtime/agentSession.d.ts +2 -0
- package/dist/runtime/agentSession.d.ts.map +1 -1
- package/dist/runtime/agentSession.js +2 -2
- package/dist/runtime/agentSession.js.map +1 -1
- package/dist/shell/interactiveShell.d.ts +18 -20
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +291 -329
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/shell/shellApp.d.ts.map +1 -1
- package/dist/shell/shellApp.js +8 -16
- package/dist/shell/shellApp.js.map +1 -1
- package/dist/shell/systemPrompt.d.ts.map +1 -1
- package/dist/shell/systemPrompt.js +15 -4
- package/dist/shell/systemPrompt.js.map +1 -1
- package/dist/subagents/taskRunner.js +1 -2
- package/dist/subagents/taskRunner.js.map +1 -1
- package/dist/tools/bashTools.d.ts.map +1 -1
- package/dist/tools/bashTools.js +8 -101
- package/dist/tools/bashTools.js.map +1 -1
- package/dist/tools/diffUtils.d.ts +2 -8
- package/dist/tools/diffUtils.d.ts.map +1 -1
- package/dist/tools/diffUtils.js +13 -72
- package/dist/tools/diffUtils.js.map +1 -1
- package/dist/tools/grepTools.d.ts.map +1 -1
- package/dist/tools/grepTools.js +2 -10
- package/dist/tools/grepTools.js.map +1 -1
- package/dist/tools/planningTools.d.ts +10 -0
- package/dist/tools/planningTools.d.ts.map +1 -1
- package/dist/tools/planningTools.js +16 -0
- package/dist/tools/planningTools.js.map +1 -1
- package/dist/tools/searchTools.d.ts.map +1 -1
- package/dist/tools/searchTools.js +2 -4
- package/dist/tools/searchTools.js.map +1 -1
- package/dist/ui/PromptController.d.ts +4 -4
- package/dist/ui/PromptController.d.ts.map +1 -1
- package/dist/ui/PromptController.js +7 -1
- package/dist/ui/PromptController.js.map +1 -1
- package/dist/ui/ShellUIAdapter.d.ts +28 -292
- package/dist/ui/ShellUIAdapter.d.ts.map +1 -1
- package/dist/ui/ShellUIAdapter.js +121 -1513
- package/dist/ui/ShellUIAdapter.js.map +1 -1
- package/dist/ui/UnifiedUIRenderer.d.ts +30 -136
- package/dist/ui/UnifiedUIRenderer.d.ts.map +1 -1
- package/dist/ui/UnifiedUIRenderer.js +370 -955
- package/dist/ui/UnifiedUIRenderer.js.map +1 -1
- package/dist/ui/animatedStatus.d.ts +6 -128
- package/dist/ui/animatedStatus.d.ts.map +1 -1
- package/dist/ui/animatedStatus.js +50 -383
- package/dist/ui/animatedStatus.js.map +1 -1
- package/dist/ui/display.d.ts +26 -182
- package/dist/ui/display.d.ts.map +1 -1
- package/dist/ui/display.js +97 -678
- package/dist/ui/display.js.map +1 -1
- package/dist/ui/layout.d.ts +1 -0
- package/dist/ui/layout.d.ts.map +1 -1
- package/dist/ui/layout.js +12 -0
- package/dist/ui/layout.js.map +1 -1
- package/dist/ui/orchestration/UIUpdateCoordinator.d.ts +7 -61
- package/dist/ui/orchestration/UIUpdateCoordinator.d.ts.map +1 -1
- package/dist/ui/orchestration/UIUpdateCoordinator.js +20 -232
- package/dist/ui/orchestration/UIUpdateCoordinator.js.map +1 -1
- package/dist/ui/planOverlay.d.ts +28 -0
- package/dist/ui/planOverlay.d.ts.map +1 -0
- package/dist/ui/planOverlay.js +156 -0
- package/dist/ui/planOverlay.js.map +1 -0
- 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/dist/ui/streamingFormatter.d.ts +30 -0
- package/dist/ui/streamingFormatter.d.ts.map +1 -0
- package/dist/ui/streamingFormatter.js +91 -0
- package/dist/ui/streamingFormatter.js.map +1 -0
- package/dist/ui/unified/index.d.ts +1 -30
- package/dist/ui/unified/index.d.ts.map +1 -1
- package/dist/ui/unified/index.js +2 -45
- package/dist/ui/unified/index.js.map +1 -1
- package/dist/utils/errorUtils.d.ts +16 -0
- package/dist/utils/errorUtils.d.ts.map +1 -0
- package/dist/utils/errorUtils.js +66 -0
- package/dist/utils/errorUtils.js.map +1 -0
- package/package.json +2 -1
- package/dist/codex/capabilities/codexCoreCapability.d.ts +0 -6
- package/dist/codex/capabilities/codexCoreCapability.d.ts.map +0 -1
- package/dist/codex/capabilities/codexCoreCapability.js +0 -516
- package/dist/codex/capabilities/codexCoreCapability.js.map +0 -1
- package/dist/codex/fs.d.ts +0 -4
- package/dist/codex/fs.d.ts.map +0 -1
- package/dist/codex/fs.js +0 -25
- package/dist/codex/fs.js.map +0 -1
- package/dist/codex/persistence/planStore.d.ts +0 -4
- package/dist/codex/persistence/planStore.d.ts.map +0 -1
- package/dist/codex/persistence/planStore.js +0 -59
- package/dist/codex/persistence/planStore.js.map +0 -1
- package/dist/codex/pluginAllowlist.d.ts +0 -4
- package/dist/codex/pluginAllowlist.d.ts.map +0 -1
- package/dist/codex/pluginAllowlist.js +0 -14
- package/dist/codex/pluginAllowlist.js.map +0 -1
- package/dist/codex/types.d.ts +0 -21
- package/dist/codex/types.d.ts.map +0 -1
- package/dist/codex/types.js +0 -62
- package/dist/codex/types.js.map +0 -1
- package/dist/core/reliabilityPrompt.d.ts +0 -9
- package/dist/core/reliabilityPrompt.d.ts.map +0 -1
- package/dist/core/reliabilityPrompt.js +0 -31
- package/dist/core/reliabilityPrompt.js.map +0 -1
- package/dist/ui/UnifiedUIController.d.ts +0 -81
- package/dist/ui/UnifiedUIController.d.ts.map +0 -1
- package/dist/ui/UnifiedUIController.js +0 -212
- package/dist/ui/UnifiedUIController.js.map +0 -1
- package/dist/ui/animation/AnimationScheduler.d.ts +0 -192
- package/dist/ui/animation/AnimationScheduler.d.ts.map +0 -1
- package/dist/ui/animation/AnimationScheduler.js +0 -432
- package/dist/ui/animation/AnimationScheduler.js.map +0 -1
- package/dist/ui/inPlaceUpdater.d.ts +0 -181
- package/dist/ui/inPlaceUpdater.d.ts.map +0 -1
- package/dist/ui/inPlaceUpdater.js +0 -515
- package/dist/ui/inPlaceUpdater.js.map +0 -1
- package/dist/ui/interrupts/InterruptManager.d.ts +0 -142
- package/dist/ui/interrupts/InterruptManager.d.ts.map +0 -1
- package/dist/ui/interrupts/InterruptManager.js +0 -439
- package/dist/ui/interrupts/InterruptManager.js.map +0 -1
- package/dist/ui/telemetry/ResponseTracker.d.ts +0 -22
- package/dist/ui/telemetry/ResponseTracker.d.ts.map +0 -1
- package/dist/ui/telemetry/ResponseTracker.js +0 -60
- package/dist/ui/telemetry/ResponseTracker.js.map +0 -1
- package/dist/ui/telemetry/UITelemetry.d.ts +0 -181
- package/dist/ui/telemetry/UITelemetry.d.ts.map +0 -1
- package/dist/ui/telemetry/UITelemetry.js +0 -446
- package/dist/ui/telemetry/UITelemetry.js.map +0 -1
- package/dist/ui/unified/layout.d.ts +0 -12
- package/dist/ui/unified/layout.d.ts.map +0 -1
- package/dist/ui/unified/layout.js +0 -96
- package/dist/ui/unified/layout.js.map +0 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comprehensive Tool Validation System
|
|
3
|
+
*
|
|
4
|
+
* Provides proactive validation for AI tool usage with:
|
|
5
|
+
* - Pre-flight validation before tool execution
|
|
6
|
+
* - Real-time AI flow guidance
|
|
7
|
+
* - Pattern-based anti-pattern detection
|
|
8
|
+
* - Recovery suggestions for common failures
|
|
9
|
+
*/
|
|
10
|
+
import type { ToolDefinition } from './toolRuntime.js';
|
|
11
|
+
/**
|
|
12
|
+
* Tool validation result
|
|
13
|
+
*/
|
|
14
|
+
export interface ToolValidationResult {
|
|
15
|
+
readonly valid: boolean;
|
|
16
|
+
readonly warnings: ToolValidationWarning[];
|
|
17
|
+
readonly suggestions: ToolValidationSuggestion[];
|
|
18
|
+
readonly criticalErrors: ToolValidationError[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Tool validation warning
|
|
22
|
+
*/
|
|
23
|
+
export interface ToolValidationWarning {
|
|
24
|
+
readonly code: string;
|
|
25
|
+
readonly message: string;
|
|
26
|
+
readonly severity: 'low' | 'medium' | 'high';
|
|
27
|
+
readonly suggestion?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Tool validation error
|
|
31
|
+
*/
|
|
32
|
+
export interface ToolValidationError {
|
|
33
|
+
readonly code: string;
|
|
34
|
+
readonly message: string;
|
|
35
|
+
readonly recovery?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Tool validation suggestion
|
|
39
|
+
*/
|
|
40
|
+
export interface ToolValidationSuggestion {
|
|
41
|
+
readonly code: string;
|
|
42
|
+
readonly message: string;
|
|
43
|
+
readonly action: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* AI flow guidance patterns
|
|
47
|
+
*/
|
|
48
|
+
export interface AIFlowPattern {
|
|
49
|
+
readonly pattern: string;
|
|
50
|
+
readonly description: string;
|
|
51
|
+
readonly guidance: string;
|
|
52
|
+
readonly examples: string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Tool usage context
|
|
56
|
+
*/
|
|
57
|
+
export interface ToolUsageContext {
|
|
58
|
+
readonly toolName: string;
|
|
59
|
+
readonly parameters: Record<string, unknown>;
|
|
60
|
+
readonly workspaceContext?: {
|
|
61
|
+
readonly currentFiles: string[];
|
|
62
|
+
readonly recentOperations: string[];
|
|
63
|
+
readonly workspacePath: string;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Comprehensive tool validator
|
|
68
|
+
*/
|
|
69
|
+
export declare class ToolValidator {
|
|
70
|
+
private readonly patterns;
|
|
71
|
+
/**
|
|
72
|
+
* Validate tool usage before execution
|
|
73
|
+
*/
|
|
74
|
+
validateToolUsage(tool: ToolDefinition, context: ToolUsageContext): ToolValidationResult;
|
|
75
|
+
/**
|
|
76
|
+
* Validate tool-specific patterns
|
|
77
|
+
*/
|
|
78
|
+
private validateToolSpecific;
|
|
79
|
+
/**
|
|
80
|
+
* Validate Edit tool usage
|
|
81
|
+
*/
|
|
82
|
+
private validateEditTool;
|
|
83
|
+
/**
|
|
84
|
+
* Validate search tools (Glob, Grep)
|
|
85
|
+
*/
|
|
86
|
+
private validateSearchTools;
|
|
87
|
+
/**
|
|
88
|
+
* Validate bash commands
|
|
89
|
+
*/
|
|
90
|
+
private validateBashCommands;
|
|
91
|
+
/**
|
|
92
|
+
* Validate AI flow patterns
|
|
93
|
+
*/
|
|
94
|
+
private validateAIFlowPatterns;
|
|
95
|
+
/**
|
|
96
|
+
* Validate performance optimizations
|
|
97
|
+
*/
|
|
98
|
+
private validatePerformance;
|
|
99
|
+
private containsPlaceholderPattern;
|
|
100
|
+
private isLongSingleLine;
|
|
101
|
+
private hasIndentationMismatch;
|
|
102
|
+
private detectIndentation;
|
|
103
|
+
private isOverlyBroadPattern;
|
|
104
|
+
private isBroadPattern;
|
|
105
|
+
private mapFlowSeverity;
|
|
106
|
+
/**
|
|
107
|
+
* Get AI flow guidance for a specific pattern
|
|
108
|
+
*/
|
|
109
|
+
getAIFlowGuidance(patternId: string): AIFlowPattern | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Get all AI flow patterns
|
|
112
|
+
*/
|
|
113
|
+
getAllAIFlowPatterns(): AIFlowPattern[];
|
|
114
|
+
}
|
|
115
|
+
export declare const globalToolValidator: ToolValidator;
|
|
116
|
+
//# sourceMappingURL=toolValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolValidation.d.ts","sourceRoot":"","sources":["../../src/core/toolValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAC3C,QAAQ,CAAC,WAAW,EAAE,wBAAwB,EAAE,CAAC;IACjD,QAAQ,CAAC,cAAc,EAAE,mBAAmB,EAAE,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,C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H,OAAO,CAAC,gBAAgB;IAuCxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA4B3B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA6B5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAsB9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,0BAA0B;IAWlC,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,eAAe;IAWvB;;OAEG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAI/D;;OAEG;IACH,oBAAoB,IAAI,aAAa,EAAE;CAGxC;AAGD,eAAO,MAAM,mBAAmB,eAAsB,CAAC"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comprehensive Tool Validation System
|
|
3
|
+
*
|
|
4
|
+
* Provides proactive validation for AI tool usage with:
|
|
5
|
+
* - Pre-flight validation before tool execution
|
|
6
|
+
* - Real-time AI flow guidance
|
|
7
|
+
* - Pattern-based anti-pattern detection
|
|
8
|
+
* - Recovery suggestions for common failures
|
|
9
|
+
*/
|
|
10
|
+
import { analyzeBashFlow } from './bashCommandGuidance.js';
|
|
11
|
+
/**
|
|
12
|
+
* Comprehensive tool validator
|
|
13
|
+
*/
|
|
14
|
+
export class ToolValidator {
|
|
15
|
+
patterns = [
|
|
16
|
+
{
|
|
17
|
+
pattern: 'edit_without_read',
|
|
18
|
+
description: 'Attempting Edit tool without first reading the file',
|
|
19
|
+
guidance: 'ALWAYS use Read tool before Edit tool to get exact text including whitespace and indentation',
|
|
20
|
+
examples: [
|
|
21
|
+
'Edit tool called without preceding Read tool',
|
|
22
|
+
'old_string contains guessed content instead of exact file content'
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
pattern: 'broad_search_pattern',
|
|
27
|
+
description: 'Using overly broad search patterns that may cause context overflow',
|
|
28
|
+
guidance: 'Use specific search patterns like "**/*.ts" or "src/**/*.js" instead of "*" or "."',
|
|
29
|
+
examples: [
|
|
30
|
+
'Glob(".") or Glob("*") without head_limit',
|
|
31
|
+
'Search patterns that could return thousands of files'
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
pattern: 'redundant_git_operations',
|
|
36
|
+
description: 'Running multiple git status calls or inefficient git command chains',
|
|
37
|
+
guidance: 'Use single combined commands: "git add -A && git commit -m msg && git push"',
|
|
38
|
+
examples: [
|
|
39
|
+
'git status → git add → git status → git commit → git push',
|
|
40
|
+
'Multiple git status calls in sequence'
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
pattern: 'incomplete_npm_publish',
|
|
45
|
+
description: 'npm publish detected without confirming release prerequisites',
|
|
46
|
+
guidance: 'Ensure auth, version bump, build/tests, publish, and git push follow the project release process; automation (npm_publish) is preferred but not required',
|
|
47
|
+
examples: [
|
|
48
|
+
'Running npm publish before bumping version',
|
|
49
|
+
'Publishing without build/test steps required by the project'
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
pattern: 'sequential_file_reads',
|
|
54
|
+
description: 'Reading files sequentially when parallel execution is possible',
|
|
55
|
+
guidance: 'Use parallel tool calls for independent file reads to improve performance',
|
|
56
|
+
examples: [
|
|
57
|
+
'Multiple Read calls in separate tool calls',
|
|
58
|
+
'Sequential file operations that could be parallelized'
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
pattern: 'validation_after_each_edit',
|
|
63
|
+
description: 'Running validation after each individual edit',
|
|
64
|
+
guidance: 'Complete ALL edits first, run ONE validation at the end only if needed',
|
|
65
|
+
examples: [
|
|
66
|
+
'Running type-check after each file edit',
|
|
67
|
+
'Running build/test after every small change'
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
/**
|
|
72
|
+
* Validate tool usage before execution
|
|
73
|
+
*/
|
|
74
|
+
validateToolUsage(tool, context) {
|
|
75
|
+
const warnings = [];
|
|
76
|
+
const suggestions = [];
|
|
77
|
+
const criticalErrors = [];
|
|
78
|
+
// Tool-specific validation
|
|
79
|
+
this.validateToolSpecific(tool, context, warnings, suggestions, criticalErrors);
|
|
80
|
+
// AI flow pattern validation
|
|
81
|
+
this.validateAIFlowPatterns(tool, context, warnings, suggestions);
|
|
82
|
+
// Performance optimization validation
|
|
83
|
+
this.validatePerformance(tool, context, warnings, suggestions);
|
|
84
|
+
return {
|
|
85
|
+
valid: criticalErrors.length === 0,
|
|
86
|
+
warnings,
|
|
87
|
+
suggestions,
|
|
88
|
+
criticalErrors
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Validate tool-specific patterns
|
|
93
|
+
*/
|
|
94
|
+
validateToolSpecific(tool, context, warnings, suggestions, criticalErrors) {
|
|
95
|
+
switch (tool.name) {
|
|
96
|
+
case 'Edit':
|
|
97
|
+
this.validateEditTool(tool, context, warnings, criticalErrors);
|
|
98
|
+
break;
|
|
99
|
+
case 'Glob':
|
|
100
|
+
case 'Grep':
|
|
101
|
+
this.validateSearchTools(tool, context, warnings, suggestions);
|
|
102
|
+
break;
|
|
103
|
+
case 'execute_bash':
|
|
104
|
+
this.validateBashCommands(tool, context, warnings, suggestions);
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Validate Edit tool usage
|
|
110
|
+
*/
|
|
111
|
+
validateEditTool(tool, context, warnings, criticalErrors) {
|
|
112
|
+
const params = tool.parameters;
|
|
113
|
+
// Check for placeholder patterns in old_string
|
|
114
|
+
if (params.old_string && this.containsPlaceholderPattern(params.old_string)) {
|
|
115
|
+
warnings.push({
|
|
116
|
+
code: 'EDIT_PLACEHOLDER_DETECTED',
|
|
117
|
+
message: 'Edit tool old_string contains placeholder patterns',
|
|
118
|
+
severity: 'high',
|
|
119
|
+
suggestion: 'Use Read tool first to get exact file content instead of guessing'
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
// Check for long single lines (likely guessed content)
|
|
123
|
+
if (params.old_string && this.isLongSingleLine(params.old_string)) {
|
|
124
|
+
warnings.push({
|
|
125
|
+
code: 'EDIT_LONG_SINGLE_LINE',
|
|
126
|
+
message: 'Edit tool old_string is a long single line (likely guessed content)',
|
|
127
|
+
severity: 'medium',
|
|
128
|
+
suggestion: 'Read the file first to get exact multi-line content'
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
// Check for indentation mismatches
|
|
132
|
+
if (params.old_string && params.new_string && this.hasIndentationMismatch(params.old_string, params.new_string)) {
|
|
133
|
+
warnings.push({
|
|
134
|
+
code: 'EDIT_INDENTATION_MISMATCH',
|
|
135
|
+
message: 'Edit tool old_string and new_string have indentation mismatches',
|
|
136
|
+
severity: 'high',
|
|
137
|
+
suggestion: 'Ensure exact whitespace matching between old and new strings'
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Validate search tools (Glob, Grep)
|
|
143
|
+
*/
|
|
144
|
+
validateSearchTools(tool, context, warnings, suggestions) {
|
|
145
|
+
const params = tool.parameters;
|
|
146
|
+
// Check for overly broad patterns
|
|
147
|
+
if (params.pattern && this.isOverlyBroadPattern(params.pattern)) {
|
|
148
|
+
warnings.push({
|
|
149
|
+
code: 'SEARCH_OVERLY_BROAD',
|
|
150
|
+
message: `Search pattern "${params.pattern}" is overly broad`,
|
|
151
|
+
severity: 'medium',
|
|
152
|
+
suggestion: 'Use specific patterns like "**/*.ts" or add head_limit parameter'
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
// Suggest head_limit for broad patterns
|
|
156
|
+
if (params.pattern && this.isBroadPattern(params.pattern) && !params.head_limit) {
|
|
157
|
+
suggestions.push({
|
|
158
|
+
code: 'SEARCH_SUGGEST_HEAD_LIMIT',
|
|
159
|
+
message: 'Broad search pattern detected without head_limit',
|
|
160
|
+
action: 'Add head_limit parameter to prevent context overflow'
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Validate bash commands
|
|
166
|
+
*/
|
|
167
|
+
validateBashCommands(tool, context, warnings, suggestions) {
|
|
168
|
+
const params = tool.parameters;
|
|
169
|
+
if (!params.command)
|
|
170
|
+
return;
|
|
171
|
+
const flowWarnings = analyzeBashFlow(params.command);
|
|
172
|
+
for (const flow of flowWarnings) {
|
|
173
|
+
warnings.push({
|
|
174
|
+
code: flow.code,
|
|
175
|
+
message: flow.message,
|
|
176
|
+
severity: this.mapFlowSeverity(flow.severity),
|
|
177
|
+
suggestion: flow.suggestion,
|
|
178
|
+
});
|
|
179
|
+
if (flow.suggestion) {
|
|
180
|
+
suggestions.push({
|
|
181
|
+
code: flow.code,
|
|
182
|
+
message: flow.message,
|
|
183
|
+
action: flow.suggestion,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Validate AI flow patterns
|
|
190
|
+
*/
|
|
191
|
+
validateAIFlowPatterns(tool, context, warnings, suggestions) {
|
|
192
|
+
// Check for sequential file reads
|
|
193
|
+
if (tool.name === 'read_file' && context.workspaceContext?.recentOperations) {
|
|
194
|
+
const recentReads = context.workspaceContext.recentOperations
|
|
195
|
+
.filter(op => op === 'read_file')
|
|
196
|
+
.length;
|
|
197
|
+
if (recentReads > 2) {
|
|
198
|
+
suggestions.push({
|
|
199
|
+
code: 'PARALLEL_READ_SUGGESTION',
|
|
200
|
+
message: 'Multiple sequential file reads detected',
|
|
201
|
+
action: 'Use parallel tool calls (e.g., read_files) for independent file reads to improve performance'
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Validate performance optimizations
|
|
208
|
+
*/
|
|
209
|
+
validatePerformance(tool, context, warnings, suggestions) {
|
|
210
|
+
// Add performance optimization suggestions
|
|
211
|
+
if (tool.name === 'execute_bash' && context.workspaceContext?.recentOperations) {
|
|
212
|
+
const recentValidations = context.workspaceContext.recentOperations
|
|
213
|
+
.filter(op => op.includes('validate') || op.includes('test') || op.includes('build'))
|
|
214
|
+
.length;
|
|
215
|
+
if (recentValidations > 1) {
|
|
216
|
+
warnings.push({
|
|
217
|
+
code: 'EXCESSIVE_VALIDATION',
|
|
218
|
+
message: 'Multiple validation operations detected',
|
|
219
|
+
severity: 'low',
|
|
220
|
+
suggestion: 'Complete ALL edits first, run ONE validation at the end only if needed'
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Helper methods
|
|
226
|
+
containsPlaceholderPattern(text) {
|
|
227
|
+
const patterns = [
|
|
228
|
+
/\.\.\./,
|
|
229
|
+
/\[.*\]/,
|
|
230
|
+
/\/\/.*\.\.\./,
|
|
231
|
+
/TODO/,
|
|
232
|
+
/FIXME/
|
|
233
|
+
];
|
|
234
|
+
return patterns.some(pattern => pattern.test(text));
|
|
235
|
+
}
|
|
236
|
+
isLongSingleLine(text) {
|
|
237
|
+
const lines = text.split('\n');
|
|
238
|
+
return lines.length === 1 && text.length > 100;
|
|
239
|
+
}
|
|
240
|
+
hasIndentationMismatch(oldString, newString) {
|
|
241
|
+
const oldIndent = this.detectIndentation(oldString);
|
|
242
|
+
const newIndent = this.detectIndentation(newString);
|
|
243
|
+
return oldIndent !== newIndent;
|
|
244
|
+
}
|
|
245
|
+
detectIndentation(text) {
|
|
246
|
+
const firstLine = text.split('\n')[0] || '';
|
|
247
|
+
const match = firstLine.match(/^(\s+)/);
|
|
248
|
+
return match?.[1] ?? '';
|
|
249
|
+
}
|
|
250
|
+
isOverlyBroadPattern(pattern) {
|
|
251
|
+
const broadPatterns = ['.', '*', '**'];
|
|
252
|
+
return broadPatterns.includes(pattern);
|
|
253
|
+
}
|
|
254
|
+
isBroadPattern(pattern) {
|
|
255
|
+
return pattern.includes('*') && !pattern.includes('.');
|
|
256
|
+
}
|
|
257
|
+
mapFlowSeverity(severity) {
|
|
258
|
+
switch (severity) {
|
|
259
|
+
case 'critical':
|
|
260
|
+
return 'high';
|
|
261
|
+
case 'info':
|
|
262
|
+
return 'low';
|
|
263
|
+
default:
|
|
264
|
+
return 'medium';
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Get AI flow guidance for a specific pattern
|
|
269
|
+
*/
|
|
270
|
+
getAIFlowGuidance(patternId) {
|
|
271
|
+
return this.patterns.find(p => p.pattern === patternId);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Get all AI flow patterns
|
|
275
|
+
*/
|
|
276
|
+
getAllAIFlowPatterns() {
|
|
277
|
+
return [...this.patterns];
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
// Global tool validator instance
|
|
281
|
+
export const globalToolValidator = new ToolValidator();
|
|
282
|
+
//# sourceMappingURL=toolValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolValidation.js","sourceRoot":"","sources":["../../src/core/toolValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AA+D3D;;GAEG;AACH,MAAM,OAAO,aAAa;IACP,QAAQ,GAAoB;QAC3C;YACE,OAAO,EAAE,mBAAmB;YAC5B,WAAW,EAAE,qDAAqD;YAClE,QAAQ,EAAE,8FAA8F;YACxG,QAAQ,EAAE;gBACR,8CAA8C;gBAC9C,mEAAmE;aACpE;SACF;QACD;YACE,OAAO,EAAE,sBAAsB;YAC/B,WAAW,EAAE,oEAAoE;YACjF,QAAQ,EAAE,oFAAoF;YAC9F,QAAQ,EAAE;gBACR,2CAA2C;gBAC3C,sDAAsD;aACvD;SACF;QACD;YACE,OA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
-
* This module provides a FULLY NON-INTERACTIVE update system that does not
|
|
5
|
-
* rely on stdin/raw mode, avoiding conflicts with the chat box input handling.
|
|
6
|
-
*
|
|
7
|
-
* Update behavior is controlled by user preferences:
|
|
8
|
-
* - autoUpdate: true -> Automatically update in background
|
|
9
|
-
* - autoUpdate: false -> Silently skip updates
|
|
10
|
-
* - autoUpdate: null -> Show notification banner with instructions
|
|
11
3
|
*/
|
|
12
4
|
export interface UpdateInfo {
|
|
13
5
|
current: string;
|
|
@@ -22,13 +14,6 @@ export interface AutoUpdateResult {
|
|
|
22
14
|
skippedReason?: string;
|
|
23
15
|
error?: string;
|
|
24
16
|
}
|
|
25
|
-
export interface AutoUpdateState {
|
|
26
|
-
lastCheck?: number;
|
|
27
|
-
lastSeenLatest?: string;
|
|
28
|
-
lastAttempt?: number;
|
|
29
|
-
lastAttemptedVersion?: string;
|
|
30
|
-
lastUpdatedVersion?: string;
|
|
31
|
-
}
|
|
32
17
|
type Logger = (message: string) => void;
|
|
33
18
|
/**
|
|
34
19
|
* Check for updates from npm registry.
|
|
@@ -43,53 +28,8 @@ export declare function maybeAutoUpdate(currentVersion: string, options?: {
|
|
|
43
28
|
logger?: Logger;
|
|
44
29
|
}): Promise<AutoUpdateResult | null>;
|
|
45
30
|
/**
|
|
46
|
-
* Format update notification message
|
|
31
|
+
* Format update notification message
|
|
47
32
|
*/
|
|
48
33
|
export declare function formatUpdateNotification(updateInfo: UpdateInfo, note?: string): string;
|
|
49
|
-
/**
|
|
50
|
-
* Format a simple update notification banner (non-interactive).
|
|
51
|
-
* Returns a string that can be displayed to the user.
|
|
52
|
-
*/
|
|
53
|
-
export declare function formatUpdateBanner(updateInfo: UpdateInfo, preference: 'auto' | 'skip' | 'ask'): string;
|
|
54
|
-
/**
|
|
55
|
-
* Get the user's update decision based on their saved preference.
|
|
56
|
-
* No interactive input required - purely preference-based.
|
|
57
|
-
*/
|
|
58
|
-
export declare function getUpdateDecision(autoUpdatePref: boolean | null): 'auto' | 'skip' | 'ask';
|
|
59
|
-
/**
|
|
60
|
-
* Check if we should show update notification (respects quiet period after recent attempts).
|
|
61
|
-
*/
|
|
62
|
-
export declare function shouldShowUpdateNotification(state: AutoUpdateState): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Read the auto-update state from disk.
|
|
65
|
-
*/
|
|
66
|
-
export declare function readAutoUpdateState(): AutoUpdateState;
|
|
67
|
-
export interface UpdatePromptResult {
|
|
68
|
-
choice: 'update' | 'skip';
|
|
69
|
-
rememberChoice: boolean;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* DEPRECATED: Interactive prompts conflict with chat box input handling.
|
|
73
|
-
* Use getUpdateDecision() for preference-based decisions instead.
|
|
74
|
-
*
|
|
75
|
-
* This function now returns skip without any interaction.
|
|
76
|
-
* The interactive prompt has been removed to avoid stdin conflicts.
|
|
77
|
-
*/
|
|
78
|
-
export declare function promptForUpdate(_updateInfo: UpdateInfo): Promise<UpdatePromptResult>;
|
|
79
|
-
/**
|
|
80
|
-
* Perform a background update without blocking the main process.
|
|
81
|
-
* Spawns the update command in a detached process.
|
|
82
|
-
*/
|
|
83
|
-
export declare function performBackgroundUpdate(updateInfo: UpdateInfo, logger?: (message: string) => void): Promise<{
|
|
84
|
-
started: boolean;
|
|
85
|
-
error?: string;
|
|
86
|
-
}>;
|
|
87
|
-
/**
|
|
88
|
-
* Perform the update with progress feedback (blocking).
|
|
89
|
-
*/
|
|
90
|
-
export declare function performUpdate(updateInfo: UpdateInfo, logger?: (message: string) => void): Promise<{
|
|
91
|
-
success: boolean;
|
|
92
|
-
error?: string;
|
|
93
|
-
}>;
|
|
94
34
|
export {};
|
|
95
35
|
//# sourceMappingURL=updateChecker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateChecker.d.ts","sourceRoot":"","sources":["../../src/core/updateChecker.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"updateChecker.d.ts","sourceRoot":"","sources":["../../src/core/updateChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAUD,KAAK,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAUxC;;GAEG;AACH,wBAAsB,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CA4BxF;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAChE,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA+GlC;AAqBD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAgCtF"}
|