vibecodingmachine-core 2026.2.26-1739 → 2026.3.9-850
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/package.json +1 -1
- package/src/agents/AgentCheckDiscoveryService.js +180 -0
- package/src/agents/AgentCheckService.js +18 -261
- package/src/agents/AgentCheckStatisticsService.js +195 -0
- package/src/agents/EnvironmentConfigurationManager.js +31 -380
- package/src/agents/InstallationType.js +19 -6
- package/src/agents/SimpleAgentCheckService.js +472 -0
- package/src/agents/config-managers/ConfigUtils.js +72 -0
- package/src/agents/config-managers/DefaultConfig.js +58 -0
- package/src/agents/config-managers/EnvVarLoader.js +66 -0
- package/src/agents/config-managers/FileConfigLoader.js +124 -0
- package/src/agents/config-managers/TypeConverters.js +61 -0
- package/src/agents/config-managers/VariableMappings.js +92 -0
- package/src/agents/discovery/AgentDiscoveryService-refactored.js +272 -0
- package/src/agents/discovery/AgentDiscoveryService.js +29 -403
- package/src/agents/discovery/agent-validator.js +262 -0
- package/src/agents/discovery/discovery-results.js +176 -0
- package/src/agents/discovery/discovery-scanner.js +268 -0
- package/src/agents/discovery/discovery-utils.js +161 -0
- package/src/agents/discovery/executable-analyzer.js +290 -0
- package/src/agents/discovery/history-manager.js +310 -0
- package/src/agents/verification/ResultAnalyzer-refactored.js +341 -0
- package/src/agents/verification/ResultAnalyzer.js +30 -431
- package/src/agents/verification/analysis-utils.js +310 -0
- package/src/agents/verification/batch-analyzer.js +440 -0
- package/src/agents/verification/pattern-recognizer.js +369 -0
- package/src/agents/verification/report-generator.js +320 -0
- package/src/agents/verification/test-analyzer.js +290 -0
- package/src/agents/windows/InstallerFactory.js +4 -0
- package/src/agents/windows/VSCodeExtensionInstaller.js +404 -0
- package/src/analysis/analysis-engine.js +314 -0
- package/src/analysis/ast-analyzer.js +342 -0
- package/src/analysis/boundary-detector-refactored.js +378 -0
- package/src/analysis/boundary-detector.js +200 -603
- package/src/analysis/boundary-scanner.js +609 -0
- package/src/analysis/boundary-types.js +118 -0
- package/src/analysis/boundary-utils.js +293 -0
- package/src/analysis/deadline-priority-calculator.js +18 -0
- package/src/analysis/detection-methods.js +347 -0
- package/src/analysis/importance-priority-calculator.js +18 -0
- package/src/analysis/priority/factor-calculators.js +204 -0
- package/src/analysis/priority/factor-helpers.js +71 -0
- package/src/analysis/priority/priority-constants.js +73 -0
- package/src/analysis/priority/priority-factor-calculators.js +301 -0
- package/src/analysis/priority/reasons-generator.js +44 -0
- package/src/analysis/priority-calculator.js +15 -580
- package/src/analysis/strategy-generator.js +16 -66
- package/src/analysis/type-priority-calculator.js +18 -0
- package/src/analysis/urgency-priority-calculator.js +18 -0
- package/src/auto-mode/AutoModeBusinessLogic.js +2 -40
- package/src/commands/disable-requirement.js +60 -0
- package/src/commands/disable-spec.js +60 -0
- package/src/commands/enable-requirement.js +60 -0
- package/src/commands/enable-spec.js +60 -0
- package/src/commands/registry.js +1 -6
- package/src/commands/requirements.js +8 -2
- package/src/ide-integration/applescript-manager.cjs +9 -24
- package/src/ide-integration/cdp-handlers/chat-reader.js +44 -0
- package/src/ide-integration/cdp-handlers/connection-handler.js +88 -0
- package/src/ide-integration/cdp-handlers/continuation-handler.js +314 -0
- package/src/ide-integration/cdp-handlers/message-submitter.js +75 -0
- package/src/ide-integration/cdp-handlers/text-sender.js +138 -0
- package/src/ide-integration/cdp-manager.js +28 -573
- package/src/ide-integration/claude-code-cli-manager.cjs +48 -12
- package/src/ide-integration/ide-openers/claude-opener.js +171 -0
- package/src/ide-integration/ide-openers/cursor-opener.js +53 -0
- package/src/ide-integration/ide-openers/other-ides-opener.js +230 -0
- package/src/ide-integration/ide-openers/vscode-opener.js +147 -0
- package/src/ide-integration/macos-ide-manager.js +20 -582
- package/src/ide-integration/macos-quota-checker.js +164 -0
- package/src/ide-integration/macos-text-sender.js +19 -38
- package/src/ide-integration/provider-manager.cjs +52 -7
- package/src/index.cjs +6 -0
- package/src/index.js +10 -0
- package/src/llm/direct-llm-manager.cjs +501 -0
- package/src/localization/translations/en-part1.js +363 -0
- package/src/localization/translations/en-part2.js +320 -0
- package/src/localization/translations/en.js +4 -687
- package/src/localization/translations/es-part1.js +363 -0
- package/src/localization/translations/es-part2.js +320 -0
- package/src/localization/translations/es.js +4 -688
- package/src/models/file-analysis-collection.js +139 -0
- package/src/models/file-analysis-metrics.js +50 -0
- package/src/models/file-analysis.js +15 -262
- package/src/models/plan-manager.js +410 -0
- package/src/models/refactoring-models.js +380 -0
- package/src/models/refactoring-plan-refactored.js +81 -0
- package/src/models/refactoring-plan.js +2 -663
- package/src/monitoring/alert-system.js +4 -45
- package/src/monitoring/continuous-scan-notifications.js +37 -191
- package/src/monitoring/notification-handlers/base-handler.js +58 -0
- package/src/monitoring/notification-handlers/error-handler.js +36 -0
- package/src/monitoring/notification-handlers/index.js +21 -0
- package/src/monitoring/notification-handlers/new-violation-handler.js +91 -0
- package/src/monitoring/notification-handlers/progress-handler.js +48 -0
- package/src/monitoring/notification-handlers/resolved-violation-handler.js +54 -0
- package/src/monitoring/notification-handlers/threshold-handler.js +36 -0
- package/src/provider-registry.js +8 -0
- package/src/refactoring/boundary/boundary-detector-refactored.js +58 -0
- package/src/refactoring/boundary/boundary-detector.js +26 -596
- package/src/refactoring/boundary/detectors/boundary-analyzers.js +281 -0
- package/src/refactoring/boundary/detectors/boundary-core.js +167 -0
- package/src/refactoring/boundary/detectors/class-detector.js +247 -0
- package/src/refactoring/boundary/detectors/config-detector.js +270 -0
- package/src/refactoring/boundary/detectors/constant-detector.js +269 -0
- package/src/refactoring/boundary/detectors/function-detector.js +248 -0
- package/src/refactoring/boundary/detectors/module-detector.js +249 -0
- package/src/refactoring/boundary/detectors/object-detector.js +247 -0
- package/src/refactoring/boundary/detectors/type-detectors.js +338 -0
- package/src/refactoring/boundary/detectors/utility-detector.js +270 -0
- package/src/refactoring/circular-dependency-resolver-original.js +16 -76
- package/src/refactoring/code-mover-refactored.js +309 -0
- package/src/refactoring/code-mover.js +48 -355
- package/src/refactoring/execution-status.js +18 -0
- package/src/refactoring/execution-strategies.js +172 -0
- package/src/refactoring/file-splitter-core.js +568 -0
- package/src/refactoring/file-splitter-types.js +136 -0
- package/src/refactoring/file-splitter.js +2 -682
- package/src/refactoring/functionality-validator.js +11 -51
- package/src/refactoring/import-manager-refactored.js +385 -0
- package/src/refactoring/import-manager.js +112 -487
- package/src/refactoring/import-models.js +189 -0
- package/src/refactoring/import-parser.js +306 -0
- package/src/refactoring/move-executor.js +431 -0
- package/src/refactoring/move-utils.js +368 -0
- package/src/refactoring/operation-executor.js +76 -0
- package/src/refactoring/plan-creator.js +36 -0
- package/src/refactoring/plan-executor.js +143 -0
- package/src/refactoring/plan-validator.js +68 -0
- package/src/refactoring/refactoring-executor-result.js +70 -0
- package/src/refactoring/refactoring-executor.js +34 -569
- package/src/refactoring/refactoring-operation.js +94 -0
- package/src/refactoring/refactoring-plan.js +69 -0
- package/src/refactoring/refactoring-rollback.js +22 -527
- package/src/refactoring/rollback-handlers/RollbackExecutor.js +107 -0
- package/src/refactoring/rollback-handlers/RollbackManager.js +265 -0
- package/src/refactoring/rollback-handlers/RollbackOperation.js +105 -0
- package/src/refactoring/rollback-handlers/RollbackResult.js +109 -0
- package/src/refactoring/rollback-handlers/RollbackStatistics.js +77 -0
- package/src/refactoring/test-validator.js +32 -448
- package/src/refactoring/validation/baseline-runner.js +71 -0
- package/src/refactoring/validation/report-generator.js +136 -0
- package/src/refactoring/validation/result-comparator.js +92 -0
- package/src/refactoring/validation/test-suite.js +59 -0
- package/src/refactoring/validation/test-validation-result.js +83 -0
- package/src/refactoring/validation/validation-runner.js +95 -0
- package/src/refactoring/validation/validation-status.js +18 -0
- package/src/rui/commands/AgentCommandParser.js +60 -369
- package/src/rui/commands/AgentResponseFormatter.js +7 -47
- package/src/rui/commands/parsers/CommandMapper.js +148 -0
- package/src/rui/commands/parsers/CommandValidator.js +228 -0
- package/src/rui/commands/parsers/ComponentExtractor.js +100 -0
- package/src/rui/commands/parsers/TokenParser.js +69 -0
- package/src/rui/commands/parsers/tokenizer.js +153 -0
- package/src/utils/current-requirement-operations.js +50 -1
- package/src/utils/report-generator.js +18 -514
- package/src/utils/report-generators/analysis-generator.js +115 -0
- package/src/utils/report-generators/base-generator.js +141 -0
- package/src/utils/report-generators/compliance-generator.js +41 -0
- package/src/utils/report-generators/format-handlers.js +185 -0
- package/src/utils/report-generators/refactoring-generator.js +46 -0
- package/src/utils/report-generators/validation-generator.js +63 -0
- package/src/utils/requirement-enable-disable.js +265 -0
- package/src/utils/requirement-helpers/requirement-file-ops.js +69 -1
- package/src/utils/requirement-helpers/requirement-mover.js +88 -1
- package/src/utils/requirement-helpers.js +5 -2
- package/src/utils/smoke-test-cli.js +45 -8
- package/src/utils/specification-enable-disable.js +122 -0
- package/src/utils/specification-helpers.js +30 -4
- package/src/utils/specification-migration.js +5 -5
- package/src/utils/test-comparator.js +118 -0
- package/src/utils/test-config.js +54 -0
- package/src/utils/test-executor.js +133 -0
- package/src/utils/test-parser.js +215 -0
- package/src/utils/test-runner-baseline.js +63 -0
- package/src/utils/test-runner-core.js +98 -0
- package/src/utils/test-runner-report.js +39 -0
- package/src/utils/test-runner-validation.js +71 -0
- package/src/utils/test-runner.js +11 -535
- package/src/validation/comparison-analyzer.js +333 -0
- package/src/validation/compliance-reporter-new.js +282 -0
- package/src/validation/compliance-reporter-refactored.js +344 -0
- package/src/validation/compliance-reporter.js +278 -591
- package/src/validation/compliance-utils.js +278 -0
- package/src/validation/html-generator.js +446 -0
- package/src/validation/metrics/category-calculator.js +137 -0
- package/src/validation/metrics/metrics-helpers.js +155 -0
- package/src/validation/metrics/overview-calculator.js +85 -0
- package/src/validation/metrics/overview-metrics.js +41 -0
- package/src/validation/metrics/quality-calculator.js +166 -0
- package/src/validation/metrics/size-calculator.js +69 -0
- package/src/validation/metrics-calculator.js +27 -551
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
]);
|
|
11
|
-
}
|
|
12
|
-
|
|
1
|
+
import { ConnectionHandler } from './cdp-handlers/connection-handler.js';
|
|
2
|
+
import { TextSender } from './cdp-handlers/text-sender.js';
|
|
3
|
+
import { MessageSubmitter } from './cdp-handlers/message-submitter.js';
|
|
4
|
+
import { ChatReader } from './cdp-handlers/chat-reader.js';
|
|
5
|
+
import { ContinuationHandler } from './cdp-handlers/continuation-handler.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Main CDP Manager - coordinates all CDP operations
|
|
9
|
+
*/
|
|
13
10
|
export class CDPManager {
|
|
14
11
|
constructor() {
|
|
15
|
-
this.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
this.connectionHandler = new ConnectionHandler();
|
|
13
|
+
this.messageSubmitter = new MessageSubmitter();
|
|
14
|
+
this.textSender = new TextSender(this.connectionHandler, this.messageSubmitter);
|
|
15
|
+
this.chatReader = new ChatReader(this.connectionHandler);
|
|
16
|
+
this.continuationHandler = new ContinuationHandler(this.connectionHandler);
|
|
17
|
+
|
|
18
|
+
// Expose ports for backward compatibility
|
|
19
|
+
this.ports = this.connectionHandler.ports;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -26,61 +26,7 @@ export class CDPManager {
|
|
|
26
26
|
* @returns {Promise<Object>} CDP client and domains
|
|
27
27
|
*/
|
|
28
28
|
async connectToIDE(ide, port = null) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (!targetPort) {
|
|
32
|
-
throw new Error(`No CDP port configured for IDE: ${ide}`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
console.log(`🔍 Connecting to ${ide} on port ${targetPort}...`);
|
|
37
|
-
|
|
38
|
-
const targets = await timeout(5000, CDP.List({ port: targetPort }));
|
|
39
|
-
|
|
40
|
-
if (!targets || targets.length === 0) {
|
|
41
|
-
throw new Error(`Could not find ${ide}. Make sure ${ide} is running with --remote-debugging-port=${targetPort}`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Find the appropriate target
|
|
45
|
-
let target;
|
|
46
|
-
if (ide === 'vscode') {
|
|
47
|
-
target = targets.find(t => t.url && t.url.includes('workbench')) || targets[0];
|
|
48
|
-
} else {
|
|
49
|
-
target = targets[0];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (!target) {
|
|
53
|
-
throw new Error(`No suitable target found for ${ide}`);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
console.log(`Found ${targets.length} targets, using: ${target.title}`);
|
|
57
|
-
|
|
58
|
-
const client = await CDP({ port: targetPort, target });
|
|
59
|
-
const { Runtime, Input, Page, DOM } = client;
|
|
60
|
-
|
|
61
|
-
await Runtime.enable();
|
|
62
|
-
await DOM.enable();
|
|
63
|
-
|
|
64
|
-
if (Page && Page.bringToFront) {
|
|
65
|
-
try {
|
|
66
|
-
await Page.bringToFront();
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.log('Could not bring page to front:', error.message);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
client,
|
|
74
|
-
Runtime,
|
|
75
|
-
Input,
|
|
76
|
-
Page,
|
|
77
|
-
DOM,
|
|
78
|
-
target
|
|
79
|
-
};
|
|
80
|
-
} catch (error) {
|
|
81
|
-
console.error(`CDP connection error for ${ide}:`, error);
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
29
|
+
return this.connectionHandler.connectToIDE(ide, port);
|
|
84
30
|
}
|
|
85
31
|
|
|
86
32
|
/**
|
|
@@ -90,197 +36,7 @@ export class CDPManager {
|
|
|
90
36
|
* @returns {Promise<Object>} Result of the operation
|
|
91
37
|
*/
|
|
92
38
|
async sendText(text, ide) {
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
success: false,
|
|
96
|
-
error: `Invalid text type: ${typeof text}. Expected string.`
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const ideName = ide === 'windsurf' ? 'Windsurf' : ide === 'cursor' ? 'Cursor' : 'VS Code';
|
|
101
|
-
|
|
102
|
-
console.log(`🔍 sendText: Starting debug session`);
|
|
103
|
-
console.log(`📋 IDE: ${ideName} (${ide})`);
|
|
104
|
-
console.log(`💬 Text: "${text.substring(0, 100)}${text.length > 100 ? '...' : ''}"`);
|
|
105
|
-
|
|
106
|
-
try {
|
|
107
|
-
const { client, Runtime, Input } = await this.connectToIDE(ide);
|
|
108
|
-
|
|
109
|
-
// VS Code specific handling
|
|
110
|
-
if (ide === 'vscode') {
|
|
111
|
-
return await this.sendTextToVSCode(text, Runtime, Input);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// For other IDEs, use basic CDP approach
|
|
115
|
-
return await this.sendTextBasic(text, Runtime, Input);
|
|
116
|
-
|
|
117
|
-
} catch (error) {
|
|
118
|
-
console.error(`${ideName} CDP error:`, error);
|
|
119
|
-
return {
|
|
120
|
-
success: false,
|
|
121
|
-
error: `${ideName} CDP error: ${error.message}`
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Send text to VS Code using the working approach
|
|
128
|
-
* @param {string} text - The text to send
|
|
129
|
-
* @param {Object} Runtime - CDP Runtime domain
|
|
130
|
-
* @param {Object} Input - CDP Input domain
|
|
131
|
-
* @returns {Promise<Object>} Result of the operation
|
|
132
|
-
*/
|
|
133
|
-
async sendTextToVSCode(text, Runtime, Input) {
|
|
134
|
-
try {
|
|
135
|
-
try {
|
|
136
|
-
const isDarwin = process.platform === 'darwin';
|
|
137
|
-
const modifiers = (isDarwin ? 4 /* Meta */ | 2 /* Ctrl */ : 2 /* Ctrl */);
|
|
138
|
-
await Input.dispatchKeyEvent({ type: 'keyDown', key: 'I', text: 'I', modifiers });
|
|
139
|
-
await Input.dispatchKeyEvent({ type: 'keyUp', key: 'I', text: 'I', modifiers });
|
|
140
|
-
} catch (error) {
|
|
141
|
-
console.log('Could not activate chat view:', error.message);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const textToSend = String(text).slice(0, 4000);
|
|
145
|
-
|
|
146
|
-
// Use clipboard approach to avoid focus issues
|
|
147
|
-
console.log('Copying text to clipboard:', textToSend);
|
|
148
|
-
|
|
149
|
-
// Note: In VSCode extension context, we'll need to handle clipboard differently
|
|
150
|
-
// For now, we'll use character-by-character typing
|
|
151
|
-
|
|
152
|
-
// Type the text character by character
|
|
153
|
-
console.log('Starting character-by-character typing...');
|
|
154
|
-
for (let i = 0; i < textToSend.length; i++) {
|
|
155
|
-
const char = textToSend[i];
|
|
156
|
-
await Input.dispatchKeyEvent({ type: 'keyDown', key: char, text: char });
|
|
157
|
-
await Input.dispatchKeyEvent({ type: 'keyUp', key: char, text: char });
|
|
158
|
-
await new Promise(resolve => setTimeout(resolve, 20)); // Small delay between characters
|
|
159
|
-
}
|
|
160
|
-
console.log('Finished character-by-character typing');
|
|
161
|
-
|
|
162
|
-
// Submit the message
|
|
163
|
-
await this.submitMessage(Input, Runtime);
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
success: true,
|
|
167
|
-
method: 'cdp-character-typing',
|
|
168
|
-
message: `Message sent to VS Code: ${text}`,
|
|
169
|
-
note: 'Message sent via CDP with character-by-character typing'
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
} catch (error) {
|
|
173
|
-
console.error('VS Code CDP error:', error);
|
|
174
|
-
return { success: false, error: `VS Code CDP error: ${error.message}` };
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Send text using basic CDP approach
|
|
180
|
-
* @param {string} text - The text to send
|
|
181
|
-
* @param {Object} Runtime - CDP Runtime domain
|
|
182
|
-
* @param {Object} Input - CDP Input domain
|
|
183
|
-
* @returns {Promise<Object>} Result of the operation
|
|
184
|
-
*/
|
|
185
|
-
async sendTextBasic(text, Runtime, Input) {
|
|
186
|
-
try {
|
|
187
|
-
const textToSend = String(text).slice(0, 4000);
|
|
188
|
-
|
|
189
|
-
// Type the text character by character
|
|
190
|
-
console.log('Starting character-by-character typing...');
|
|
191
|
-
for (let i = 0; i < textToSend.length; i++) {
|
|
192
|
-
const char = textToSend[i];
|
|
193
|
-
await Input.dispatchKeyEvent({ type: 'keyDown', key: char, text: char });
|
|
194
|
-
await Input.dispatchKeyEvent({ type: 'keyUp', key: char, text: char });
|
|
195
|
-
await new Promise(resolve => setTimeout(resolve, 20));
|
|
196
|
-
}
|
|
197
|
-
console.log('Finished character-by-character typing');
|
|
198
|
-
|
|
199
|
-
// Submit the message
|
|
200
|
-
await this.submitMessage(Input, Runtime);
|
|
201
|
-
|
|
202
|
-
return {
|
|
203
|
-
success: true,
|
|
204
|
-
method: 'cdp-basic',
|
|
205
|
-
message: `Message sent: ${text}`,
|
|
206
|
-
note: 'Message sent via basic CDP approach'
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
} catch (error) {
|
|
210
|
-
console.error('Basic CDP error:', error);
|
|
211
|
-
return { success: false, error: `Basic CDP error: ${error.message}` };
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Submit a message using multiple methods
|
|
217
|
-
* @param {Object} Input - CDP Input domain
|
|
218
|
-
* @param {Object} Runtime - CDP Runtime domain
|
|
219
|
-
* @returns {Promise<void>}
|
|
220
|
-
*/
|
|
221
|
-
async submitMessage(Input, Runtime) {
|
|
222
|
-
// Wait a moment then try multiple ways to submit the message
|
|
223
|
-
setTimeout(async () => {
|
|
224
|
-
try {
|
|
225
|
-
console.log('Attempting to submit message...');
|
|
226
|
-
|
|
227
|
-
// Method 1: Press Enter
|
|
228
|
-
console.log('Method 1: Pressing Enter...');
|
|
229
|
-
await Input.dispatchKeyEvent({ type: 'keyDown', key: 'Enter' });
|
|
230
|
-
await Input.dispatchKeyEvent({ type: 'keyUp', key: 'Enter' });
|
|
231
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
232
|
-
|
|
233
|
-
// Method 2: Try clicking the send button
|
|
234
|
-
console.log('Method 2: Looking for send button...');
|
|
235
|
-
const clickSendButton = `(() => {
|
|
236
|
-
const sendButton = document.querySelector('[aria-label*="Send"]') ||
|
|
237
|
-
document.querySelector('[title*="Send"]') ||
|
|
238
|
-
document.querySelector('button[aria-label*="submit"]') ||
|
|
239
|
-
document.querySelector('button[title*="submit"]') ||
|
|
240
|
-
document.querySelector('[aria-label*="Send message"]') ||
|
|
241
|
-
document.querySelector('[title*="Send message"]') ||
|
|
242
|
-
document.querySelector('button[aria-label*="Send message"]') ||
|
|
243
|
-
document.querySelector('button[title*="Send message"]') ||
|
|
244
|
-
document.querySelector('button[aria-label*="Submit"]') ||
|
|
245
|
-
document.querySelector('button[title*="Submit"]') ||
|
|
246
|
-
document.querySelector('button[aria-label*="Send request"]') ||
|
|
247
|
-
document.querySelector('button[title*="Send request"]') ||
|
|
248
|
-
document.querySelector('button svg[data-icon*="send"]')?.closest('button') ||
|
|
249
|
-
document.querySelector('button svg[data-icon*="play"]')?.closest('button') ||
|
|
250
|
-
document.querySelector('button svg[data-icon*="arrow"]')?.closest('button') ||
|
|
251
|
-
document.querySelector('button.send-button') ||
|
|
252
|
-
document.querySelector('button.submit-button') ||
|
|
253
|
-
document.querySelector('button[class*="send"]') ||
|
|
254
|
-
document.querySelector('button[class*="submit"]');
|
|
255
|
-
|
|
256
|
-
if (sendButton) {
|
|
257
|
-
console.log('Found send button:', sendButton.getAttribute('aria-label') || sendButton.getAttribute('title') || sendButton.className);
|
|
258
|
-
sendButton.click();
|
|
259
|
-
return true;
|
|
260
|
-
} else {
|
|
261
|
-
console.log('No send button found');
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
})()`;
|
|
265
|
-
|
|
266
|
-
const { result: clickRes } = await Runtime.evaluate({ expression: clickSendButton, returnByValue: true });
|
|
267
|
-
const clickResult = clickRes && (clickRes.value ?? clickRes.unserializableValue) ? (clickRes.value ?? clickRes.unserializableValue) : false;
|
|
268
|
-
console.log('Send button click result:', clickResult);
|
|
269
|
-
|
|
270
|
-
// Method 3: Try Cmd+Enter as alternative
|
|
271
|
-
if (!clickResult) {
|
|
272
|
-
console.log('Method 3: Trying Cmd+Enter...');
|
|
273
|
-
const isDarwin = process.platform === 'darwin';
|
|
274
|
-
const enterMods = isDarwin ? 4 /* Meta */ : 2 /* Ctrl */;
|
|
275
|
-
await Input.dispatchKeyEvent({ type: 'keyDown', key: 'Enter', text: 'Enter', modifiers: enterMods });
|
|
276
|
-
await Input.dispatchKeyEvent({ type: 'keyUp', key: 'Enter', text: 'Enter', modifiers: enterMods });
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
console.log('All submission methods attempted');
|
|
280
|
-
} catch (error) {
|
|
281
|
-
console.log('Submission failed:', error.message);
|
|
282
|
-
}
|
|
283
|
-
}, 300);
|
|
39
|
+
return this.textSender.sendText(text, ide);
|
|
284
40
|
}
|
|
285
41
|
|
|
286
42
|
/**
|
|
@@ -289,34 +45,7 @@ export class CDPManager {
|
|
|
289
45
|
* @returns {Promise<string>} The chat text
|
|
290
46
|
*/
|
|
291
47
|
async readChatText(ide) {
|
|
292
|
-
|
|
293
|
-
const { Runtime } = await this.connectToIDE(ide);
|
|
294
|
-
|
|
295
|
-
const expression = `(() => {
|
|
296
|
-
try {
|
|
297
|
-
// Look for chat messages in various possible locations
|
|
298
|
-
const chatMessages = document.querySelectorAll('[class*="message"], [class*="chat"], [class*="conversation"]');
|
|
299
|
-
const messages = [];
|
|
300
|
-
|
|
301
|
-
chatMessages.forEach(msg => {
|
|
302
|
-
const text = msg.textContent || msg.innerText;
|
|
303
|
-
if (text && text.trim()) {
|
|
304
|
-
messages.push(text.trim());
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
return messages.join('\\n\\n');
|
|
309
|
-
} catch (error) {
|
|
310
|
-
return 'Error reading chat: ' + error.message;
|
|
311
|
-
}
|
|
312
|
-
})()`;
|
|
313
|
-
|
|
314
|
-
const { result } = await Runtime.evaluate({ expression, returnByValue: true });
|
|
315
|
-
return result.value || '[]';
|
|
316
|
-
} catch (error) {
|
|
317
|
-
console.error(`Error reading chat from ${ide}:`, error);
|
|
318
|
-
return `Error: ${error.message}`;
|
|
319
|
-
}
|
|
48
|
+
return this.chatReader.readChatText(ide);
|
|
320
49
|
}
|
|
321
50
|
|
|
322
51
|
/**
|
|
@@ -325,131 +54,7 @@ export class CDPManager {
|
|
|
325
54
|
* @returns {Promise<boolean>} True if continuation prompt detected
|
|
326
55
|
*/
|
|
327
56
|
async detectContinuationPrompt(client) {
|
|
328
|
-
|
|
329
|
-
const { DOM, Runtime } = client;
|
|
330
|
-
|
|
331
|
-
// Get document root
|
|
332
|
-
const { result: { root } } = await DOM.getDocument();
|
|
333
|
-
|
|
334
|
-
// Query for continuation buttons
|
|
335
|
-
const continuationSelectors = [
|
|
336
|
-
'button[title*="Continue"]',
|
|
337
|
-
'button[title*="Proceed"]',
|
|
338
|
-
'button[title*="Next"]',
|
|
339
|
-
'button[title*="Keep Going"]',
|
|
340
|
-
'button[title*="Resume"]',
|
|
341
|
-
'button[aria-label*="Continue"]',
|
|
342
|
-
'button[aria-label*="Proceed"]',
|
|
343
|
-
'button[aria-label*="Next"]',
|
|
344
|
-
'button[aria-label*="Keep Going"]',
|
|
345
|
-
'button[aria-label*="Resume"]',
|
|
346
|
-
'[class*="continue"] button',
|
|
347
|
-
'[class*="proceed"] button',
|
|
348
|
-
'[class*="next"] button',
|
|
349
|
-
'button:contains("Continue")',
|
|
350
|
-
'button:contains("Proceed")',
|
|
351
|
-
'button:contains("Next")',
|
|
352
|
-
'button:contains("Keep Going")',
|
|
353
|
-
'button:contains("Resume")',
|
|
354
|
-
'button:contains("Continue Generation")'
|
|
355
|
-
];
|
|
356
|
-
|
|
357
|
-
for (const selector of continuationSelectors) {
|
|
358
|
-
try {
|
|
359
|
-
const { result: { nodes } } = await DOM.querySelectorAll({
|
|
360
|
-
nodeId: root.nodeId,
|
|
361
|
-
selector: selector.replace(':contains(', '[text*="').replace(')', '"]')
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
if (nodes && nodes.length > 0) {
|
|
365
|
-
// Check if button text contains continuation keywords
|
|
366
|
-
for (const node of nodes) {
|
|
367
|
-
const { result: { value } } = await DOM.getAttributes({ nodeId: node.nodeId });
|
|
368
|
-
if (value) {
|
|
369
|
-
const attributes = value.split(' ').map(attr => attr.replace(/"/g, ''));
|
|
370
|
-
const textContent = attributes.find(attr =>
|
|
371
|
-
attr.toLowerCase().includes('continue') ||
|
|
372
|
-
attr.toLowerCase().includes('proceed') ||
|
|
373
|
-
attr.toLowerCase().includes('next') ||
|
|
374
|
-
attr.toLowerCase().includes('keep going') ||
|
|
375
|
-
attr.toLowerCase().includes('resume')
|
|
376
|
-
);
|
|
377
|
-
|
|
378
|
-
if (textContent) {
|
|
379
|
-
return true;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
} catch (e) {
|
|
385
|
-
// Continue with next selector if this one fails
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
return false;
|
|
390
|
-
} catch (error) {
|
|
391
|
-
console.error('Error detecting continuation prompt:', error);
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Click detected continuation button
|
|
398
|
-
* @param {Object} client - CDP client
|
|
399
|
-
* @returns {Promise<boolean>} True if button clicked successfully
|
|
400
|
-
*/
|
|
401
|
-
async clickContinuationButton(client) {
|
|
402
|
-
try {
|
|
403
|
-
const { DOM, Runtime } = client;
|
|
404
|
-
|
|
405
|
-
// Get document root
|
|
406
|
-
const { result: { root } } = await DOM.getDocument();
|
|
407
|
-
|
|
408
|
-
// Query for continuation buttons
|
|
409
|
-
const continuationSelectors = [
|
|
410
|
-
'button[title*="Continue"]',
|
|
411
|
-
'button[title*="Proceed"]',
|
|
412
|
-
'button[title*="Next"]',
|
|
413
|
-
'button[title*="Keep Going"]',
|
|
414
|
-
'button[title*="Resume"]',
|
|
415
|
-
'button[aria-label*="Continue"]',
|
|
416
|
-
'button[aria-label*="Proceed"]',
|
|
417
|
-
'button[aria-label*="Next"]',
|
|
418
|
-
'button[aria-label*="Keep Going"]',
|
|
419
|
-
'button[aria-label*="Resume"]',
|
|
420
|
-
'[class*="continue"] button',
|
|
421
|
-
'[class*="proceed"] button',
|
|
422
|
-
'[class*="next"] button'
|
|
423
|
-
];
|
|
424
|
-
|
|
425
|
-
for (const selector of continuationSelectors) {
|
|
426
|
-
try {
|
|
427
|
-
const { result: { nodes } } = await DOM.querySelectorAll({
|
|
428
|
-
nodeId: root.nodeId,
|
|
429
|
-
selector: selector
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
if (nodes && nodes.length > 0) {
|
|
433
|
-
// Click the first found button
|
|
434
|
-
const node = nodes[0];
|
|
435
|
-
await DOM.resolveNode({ nodeId: node.nodeId });
|
|
436
|
-
|
|
437
|
-
// Use Runtime to click the button
|
|
438
|
-
const clickExpression = `document.querySelector('${selector}').click()`;
|
|
439
|
-
await Runtime.evaluate({ expression: clickExpression });
|
|
440
|
-
|
|
441
|
-
return true;
|
|
442
|
-
}
|
|
443
|
-
} catch (e) {
|
|
444
|
-
// Continue with next selector if this one fails
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
return false;
|
|
449
|
-
} catch (error) {
|
|
450
|
-
console.error('Error clicking continuation button:', error);
|
|
451
|
-
return false;
|
|
452
|
-
}
|
|
57
|
+
return this.continuationHandler.detectContinuationPrompt(client);
|
|
453
58
|
}
|
|
454
59
|
|
|
455
60
|
/**
|
|
@@ -458,170 +63,20 @@ export class CDPManager {
|
|
|
458
63
|
* @returns {Promise<Object>} Result with continuation detected and button info
|
|
459
64
|
*/
|
|
460
65
|
async checkForContinuation(ide) {
|
|
461
|
-
|
|
462
|
-
const { Runtime } = await this.connectToIDE(ide);
|
|
463
|
-
|
|
464
|
-
const expression = `(() => {
|
|
465
|
-
try {
|
|
466
|
-
// Look for continuation buttons or prompts
|
|
467
|
-
const continuationSelectors = [
|
|
468
|
-
'button[title*="Continue"]',
|
|
469
|
-
'button[title*="Proceed"]',
|
|
470
|
-
'button:contains("Continue")',
|
|
471
|
-
'button:contains("Proceed")',
|
|
472
|
-
'button:contains("Next")',
|
|
473
|
-
'button:contains("Continue Generation")',
|
|
474
|
-
'button:contains("Keep Going")',
|
|
475
|
-
'[class*="continue"] button',
|
|
476
|
-
'[class*="proceed"] button',
|
|
477
|
-
'[class*="next"] button',
|
|
478
|
-
'button[aria-label*="Continue"]',
|
|
479
|
-
'button[aria-label*="Proceed"]'
|
|
480
|
-
];
|
|
481
|
-
|
|
482
|
-
// Look for continuation text prompts
|
|
483
|
-
const textSelectors = [
|
|
484
|
-
'[class*="message"]:contains("Continue")',
|
|
485
|
-
'[class*="message"]:contains("Proceed")',
|
|
486
|
-
'[class*="prompt"]:contains("Continue")',
|
|
487
|
-
'[class*="prompt"]:contains("Proceed")',
|
|
488
|
-
'[class*="dialog"]:contains("Continue")',
|
|
489
|
-
'[class*="dialog"]:contains("Proceed")'
|
|
490
|
-
];
|
|
491
|
-
|
|
492
|
-
const foundButtons = [];
|
|
493
|
-
const foundTexts = [];
|
|
494
|
-
|
|
495
|
-
// Check for buttons
|
|
496
|
-
continuationSelectors.forEach(selector => {
|
|
497
|
-
try {
|
|
498
|
-
const elements = document.querySelectorAll(selector);
|
|
499
|
-
elements.forEach(el => {
|
|
500
|
-
if (el && el.offsetParent !== null) { // Check if visible
|
|
501
|
-
foundButtons.push({
|
|
502
|
-
selector,
|
|
503
|
-
text: el.textContent || el.innerText || '',
|
|
504
|
-
title: el.title || '',
|
|
505
|
-
ariaLabel: el.getAttribute('aria-label') || ''
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
} catch (e) {
|
|
510
|
-
// Some selectors may not be supported, ignore
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
|
-
|
|
514
|
-
// Check for text prompts
|
|
515
|
-
textSelectors.forEach(selector => {
|
|
516
|
-
try {
|
|
517
|
-
const elements = document.querySelectorAll(selector);
|
|
518
|
-
elements.forEach(el => {
|
|
519
|
-
if (el && el.offsetParent !== null) { // Check if visible
|
|
520
|
-
const text = el.textContent || el.innerText || '';
|
|
521
|
-
if (text.toLowerCase().includes('continue') ||
|
|
522
|
-
text.toLowerCase().includes('proceed') ||
|
|
523
|
-
text.toLowerCase().includes('keep going')) {
|
|
524
|
-
foundTexts.push({
|
|
525
|
-
selector,
|
|
526
|
-
text: text.trim()
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
});
|
|
531
|
-
} catch (e) {
|
|
532
|
-
// Some selectors may not be supported, ignore
|
|
533
|
-
}
|
|
534
|
-
});
|
|
535
|
-
|
|
536
|
-
return {
|
|
537
|
-
continuationDetected: foundButtons.length > 0 || foundTexts.length > 0,
|
|
538
|
-
buttons: foundButtons,
|
|
539
|
-
texts: foundTexts,
|
|
540
|
-
totalFound: foundButtons.length + foundTexts.length
|
|
541
|
-
};
|
|
542
|
-
} catch (error) {
|
|
543
|
-
return {
|
|
544
|
-
continuationDetected: false,
|
|
545
|
-
error: error.message,
|
|
546
|
-
buttons: [],
|
|
547
|
-
texts: []
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
})()`;
|
|
551
|
-
|
|
552
|
-
const { result } = await Runtime.evaluate({ expression, returnByValue: true });
|
|
553
|
-
return result.value || { continuationDetected: false, buttons: [], texts: [] };
|
|
554
|
-
} catch (error) {
|
|
555
|
-
console.error(`Error checking for continuation in ${ide}:`, error);
|
|
556
|
-
return { continuationDetected: false, error: error.message, buttons: [], texts: [] };
|
|
557
|
-
}
|
|
66
|
+
return this.continuationHandler.checkForContinuation(ide);
|
|
558
67
|
}
|
|
559
68
|
|
|
560
69
|
/**
|
|
561
70
|
* Click a continuation button if found
|
|
562
|
-
* @param {string} ide - The IDE name
|
|
71
|
+
* @param {string} ide - The IDE name or CDP client
|
|
563
72
|
* @returns {Promise<Object>} Result of the operation
|
|
564
73
|
*/
|
|
565
74
|
async clickContinuationButton(ide) {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
// Look for continuation buttons
|
|
572
|
-
const continuationSelectors = [
|
|
573
|
-
'button[title*="Continue"]',
|
|
574
|
-
'button[title*="Proceed"]',
|
|
575
|
-
'button:contains("Continue")',
|
|
576
|
-
'button:contains("Proceed")',
|
|
577
|
-
'button:contains("Next")',
|
|
578
|
-
'button:contains("Continue Generation")',
|
|
579
|
-
'button:contains("Keep Going")',
|
|
580
|
-
'[class*="continue"] button',
|
|
581
|
-
'[class*="proceed"] button',
|
|
582
|
-
'[class*="next"] button',
|
|
583
|
-
'button[aria-label*="Continue"]',
|
|
584
|
-
'button[aria-label*="Proceed"]'
|
|
585
|
-
];
|
|
586
|
-
|
|
587
|
-
for (const selector of continuationSelectors) {
|
|
588
|
-
try {
|
|
589
|
-
const elements = document.querySelectorAll(selector);
|
|
590
|
-
for (const el of elements) {
|
|
591
|
-
if (el && el.offsetParent !== null) { // Check if visible
|
|
592
|
-
el.click();
|
|
593
|
-
return {
|
|
594
|
-
success: true,
|
|
595
|
-
clicked: true,
|
|
596
|
-
selector: selector,
|
|
597
|
-
text: el.textContent || el.innerText || ''
|
|
598
|
-
};
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
} catch (e) {
|
|
602
|
-
// Some selectors may not be supported, continue
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
return {
|
|
607
|
-
success: false,
|
|
608
|
-
clicked: false,
|
|
609
|
-
message: 'No continuation button found'
|
|
610
|
-
};
|
|
611
|
-
} catch (error) {
|
|
612
|
-
return {
|
|
613
|
-
success: false,
|
|
614
|
-
clicked: false,
|
|
615
|
-
error: error.message
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
})()`;
|
|
619
|
-
|
|
620
|
-
const { result } = await Runtime.evaluate({ expression, returnByValue: true });
|
|
621
|
-
return result.value || { success: false, clicked: false, message: 'No result' };
|
|
622
|
-
} catch (error) {
|
|
623
|
-
console.error(`Error clicking continuation button in ${ide}:`, error);
|
|
624
|
-
return { success: false, clicked: false, error: error.message };
|
|
75
|
+
// Handle both IDE string and client object for backward compatibility
|
|
76
|
+
if (typeof ide === 'string') {
|
|
77
|
+
return this.continuationHandler.clickContinuationButton(ide);
|
|
78
|
+
} else {
|
|
79
|
+
return this.continuationHandler.clickContinuationButtonDOM(ide);
|
|
625
80
|
}
|
|
626
81
|
}
|
|
627
82
|
}
|