mycontext-cli 4.2.10 → 4.2.12
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 +13 -4
- package/dist/README.md +13 -4
- package/dist/agents/implementations/ArchitectAgent.js.map +1 -1
- package/dist/agents/implementations/BuildStrategyAgent.js.map +1 -1
- package/dist/agents/implementations/CodeGenSubAgent.js.map +1 -1
- package/dist/agents/implementations/DemoRecorderAgent.d.ts +73 -0
- package/dist/agents/implementations/DemoRecorderAgent.d.ts.map +1 -0
- package/dist/agents/implementations/DemoRecorderAgent.js +485 -0
- package/dist/agents/implementations/DemoRecorderAgent.js.map +1 -0
- package/dist/agents/implementations/DesignPipelineAgent.d.ts +4 -0
- package/dist/agents/implementations/DesignPipelineAgent.d.ts.map +1 -1
- package/dist/agents/implementations/DesignPipelineAgent.js +82 -10
- package/dist/agents/implementations/DesignPipelineAgent.js.map +1 -1
- package/dist/agents/implementations/DocsSubAgent.js.map +1 -1
- package/dist/agents/implementations/FeaturePlannerAgent.d.ts +10 -0
- package/dist/agents/implementations/FeaturePlannerAgent.d.ts.map +1 -0
- package/dist/agents/implementations/FeaturePlannerAgent.js +35 -0
- package/dist/agents/implementations/FeaturePlannerAgent.js.map +1 -0
- package/dist/agents/implementations/QASubAgent.js.map +1 -1
- package/dist/agents/implementations/SecurityAgent.js.map +1 -1
- package/dist/agents/implementations/VOScriptExtractorAgent.d.ts +84 -0
- package/dist/agents/implementations/VOScriptExtractorAgent.d.ts.map +1 -0
- package/dist/agents/implementations/VOScriptExtractorAgent.js +414 -0
- package/dist/agents/implementations/VOScriptExtractorAgent.js.map +1 -0
- package/dist/agents/implementations/VisionNavigatorAgent.d.ts +52 -0
- package/dist/agents/implementations/VisionNavigatorAgent.d.ts.map +1 -0
- package/dist/agents/implementations/VisionNavigatorAgent.js +313 -0
- package/dist/agents/implementations/VisionNavigatorAgent.js.map +1 -0
- package/dist/agents/implementations/VisionTestCoordinator.d.ts +51 -0
- package/dist/agents/implementations/VisionTestCoordinator.d.ts.map +1 -0
- package/dist/agents/implementations/VisionTestCoordinator.js +348 -0
- package/dist/agents/implementations/VisionTestCoordinator.js.map +1 -0
- package/dist/agents/implementations/VisualValidatorAgent.d.ts +83 -0
- package/dist/agents/implementations/VisualValidatorAgent.d.ts.map +1 -0
- package/dist/agents/implementations/VisualValidatorAgent.js +472 -0
- package/dist/agents/implementations/VisualValidatorAgent.js.map +1 -0
- package/dist/agents/orchestrator/SubAgentOrchestrator.js.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/clients/ClaudeSDKClient.d.ts +4 -0
- package/dist/clients/ClaudeSDKClient.d.ts.map +1 -1
- package/dist/clients/ClaudeSDKClient.js +8 -0
- package/dist/clients/ClaudeSDKClient.js.map +1 -1
- package/dist/clients/MyContextAIClient.d.ts +4 -0
- package/dist/clients/MyContextAIClient.d.ts.map +1 -1
- package/dist/clients/MyContextAIClient.js +69 -0
- package/dist/clients/MyContextAIClient.js.map +1 -1
- package/dist/clients/ProviderChain.d.ts +1 -0
- package/dist/clients/ProviderChain.d.ts.map +1 -1
- package/dist/clients/ProviderChain.js +3 -0
- package/dist/clients/ProviderChain.js.map +1 -1
- package/dist/clients/XAIClient.d.ts +4 -0
- package/dist/clients/XAIClient.d.ts.map +1 -1
- package/dist/clients/XAIClient.js +8 -0
- package/dist/clients/XAIClient.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +110 -204
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/plan-feature.d.ts +3 -0
- package/dist/commands/plan-feature.d.ts.map +1 -0
- package/dist/commands/plan-feature.js +57 -0
- package/dist/commands/plan-feature.js.map +1 -0
- package/dist/commands/sanitize.d.ts.map +1 -1
- package/dist/commands/sanitize.js +95 -7
- package/dist/commands/sanitize.js.map +1 -1
- package/dist/commands/vision-test.d.ts +67 -0
- package/dist/commands/vision-test.d.ts.map +1 -0
- package/dist/commands/vision-test.js +347 -0
- package/dist/commands/vision-test.js.map +1 -0
- package/dist/core/ai/AICore.d.ts +13 -0
- package/dist/core/ai/AICore.d.ts.map +1 -1
- package/dist/core/ai/AICore.js +65 -0
- package/dist/core/ai/AICore.js.map +1 -1
- package/dist/doctor/DoctorEngine.d.ts.map +1 -1
- package/dist/doctor/DoctorEngine.js +4 -1
- package/dist/doctor/DoctorEngine.js.map +1 -1
- package/dist/doctor/rules/index.d.ts +2 -1
- package/dist/doctor/rules/index.d.ts.map +1 -1
- package/dist/doctor/rules/index.js +4 -1
- package/dist/doctor/rules/index.js.map +1 -1
- package/dist/doctor/rules/node-rules.d.ts.map +1 -1
- package/dist/doctor/rules/node-rules.js +41 -0
- package/dist/doctor/rules/node-rules.js.map +1 -1
- package/dist/doctor/rules/security-rules.d.ts +6 -0
- package/dist/doctor/rules/security-rules.d.ts.map +1 -0
- package/dist/doctor/rules/security-rules.js +66 -0
- package/dist/doctor/rules/security-rules.js.map +1 -0
- package/dist/doctor/types.d.ts +1 -1
- package/dist/doctor/types.d.ts.map +1 -1
- package/dist/interfaces/AIClient.d.ts +1 -0
- package/dist/interfaces/AIClient.d.ts.map +1 -1
- package/dist/interfaces/AIClient.js.map +1 -1
- package/dist/mcp/vision-test-runner.d.ts +57 -0
- package/dist/mcp/vision-test-runner.d.ts.map +1 -0
- package/dist/mcp/vision-test-runner.js +337 -0
- package/dist/mcp/vision-test-runner.js.map +1 -0
- package/dist/mcp/vision-testing-server.d.ts +38 -0
- package/dist/mcp/vision-testing-server.d.ts.map +1 -0
- package/dist/mcp/vision-testing-server.js +637 -0
- package/dist/mcp/vision-testing-server.js.map +1 -0
- package/dist/package.json +1 -1
- package/dist/services/gemini-vision.d.ts +3 -11
- package/dist/services/gemini-vision.d.ts.map +1 -1
- package/dist/services/gemini-vision.js +13 -132
- package/dist/services/gemini-vision.js.map +1 -1
- package/dist/services/llmClarifier.d.ts +9 -0
- package/dist/services/llmClarifier.d.ts.map +1 -0
- package/dist/services/llmClarifier.js +22 -0
- package/dist/services/llmClarifier.js.map +1 -0
- package/dist/services/vision-element-finder.d.ts +64 -0
- package/dist/services/vision-element-finder.d.ts.map +1 -0
- package/dist/services/vision-element-finder.js +446 -0
- package/dist/services/vision-element-finder.js.map +1 -0
- package/dist/types/flow-testing.d.ts +1 -1
- package/dist/types/flow-testing.d.ts.map +1 -1
- package/dist/types/vision-testing.d.ts +382 -0
- package/dist/types/vision-testing.d.ts.map +1 -0
- package/dist/types/vision-testing.js +9 -0
- package/dist/types/vision-testing.js.map +1 -0
- package/dist/utils/claudeAgentClient.d.ts +4 -0
- package/dist/utils/claudeAgentClient.d.ts.map +1 -1
- package/dist/utils/claudeAgentClient.js +8 -0
- package/dist/utils/claudeAgentClient.js.map +1 -1
- package/dist/utils/geminiClient.d.ts +41 -6
- package/dist/utils/geminiClient.d.ts.map +1 -1
- package/dist/utils/geminiClient.js +124 -18
- package/dist/utils/geminiClient.js.map +1 -1
- package/dist/utils/githubModelsClient.d.ts +19 -6
- package/dist/utils/githubModelsClient.d.ts.map +1 -1
- package/dist/utils/githubModelsClient.js +94 -7
- package/dist/utils/githubModelsClient.js.map +1 -1
- package/dist/utils/openRouterClient.d.ts +12 -3
- package/dist/utils/openRouterClient.d.ts.map +1 -1
- package/dist/utils/openRouterClient.js +91 -2
- package/dist/utils/openRouterClient.js.map +1 -1
- package/dist/utils/unifiedDesignContextLoader.d.ts.map +1 -1
- package/dist/utils/unifiedDesignContextLoader.js +15 -0
- package/dist/utils/unifiedDesignContextLoader.js.map +1 -1
- package/package.json +1 -1
|
@@ -35,23 +35,15 @@ export interface ScreenshotAnalysisResult {
|
|
|
35
35
|
fullAnalysis: string;
|
|
36
36
|
}
|
|
37
37
|
export declare class GeminiVisionService {
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
private model;
|
|
41
|
-
private shouldUseVertex;
|
|
42
|
-
constructor(apiKey?: string);
|
|
43
|
-
private readonly VISION_MODELS;
|
|
38
|
+
private aiCore;
|
|
39
|
+
constructor(apiKey?: string, projectPath?: string);
|
|
44
40
|
/**
|
|
45
|
-
* Analyze a screenshot and extract UI information
|
|
41
|
+
* Analyze a screenshot and extract UI information via AICore (with fallback)
|
|
46
42
|
*/
|
|
47
43
|
analyzeScreenshot(imagePath: string, retries?: number): Promise<ScreenshotAnalysisResult>;
|
|
48
44
|
/**
|
|
49
45
|
* Generate context.md file from screenshot analysis
|
|
50
46
|
*/
|
|
51
47
|
generateContextFromAnalysis(analysis: ScreenshotAnalysisResult, projectName: string): string;
|
|
52
|
-
/**
|
|
53
|
-
* Get MIME type from file extension
|
|
54
|
-
*/
|
|
55
|
-
private getMimeType;
|
|
56
48
|
}
|
|
57
49
|
//# sourceMappingURL=gemini-vision.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-vision.d.ts","sourceRoot":"","sources":["../../src/services/gemini-vision.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gemini-vision.d.ts","sourceRoot":"","sources":["../../src/services/gemini-vision.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,YAAY,EAAE;QACZ,MAAM,EAAE;YACN,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,UAAU,EAAE;YACV,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;SACzB,CAAC;QACF,OAAO,EAAE;YACP,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;SAClB,CAAC;KACH,CAAC;IACF,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;KAClC,CAAC;IACF,SAAS,EAAE;QACT,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,GAAE,MAAsB;IAehE;;OAEG;IACG,iBAAiB,CACrB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,MAAU,GAClB,OAAO,CAAC,wBAAwB,CAAC;IAyFpC;;OAEG;IACH,2BAA2B,CACzB,QAAQ,EAAE,wBAAwB,EAClC,WAAW,EAAE,MAAM,GAClB,MAAM;CAwDV"}
|
|
@@ -1,57 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.GeminiVisionService = void 0;
|
|
7
|
-
const
|
|
8
|
-
const vertexai_1 = require("@google-cloud/vertexai");
|
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
4
|
+
const AICore_1 = require("../core/ai/AICore");
|
|
11
5
|
class GeminiVisionService {
|
|
12
|
-
constructor(apiKey) {
|
|
13
|
-
this.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"gemini
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// Priority 1: Check for API Key (Google AI Studio / Dev path)
|
|
23
|
-
const key = apiKey || process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY;
|
|
24
|
-
if (key) {
|
|
25
|
-
console.log("🔑 Using Google AI (API Key) for analysis");
|
|
26
|
-
this.genAI = new generative_ai_1.GoogleGenerativeAI(key);
|
|
27
|
-
// Model will be set during analyzeScreenshot with fallback logic
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
// Priority 2: Vertex AI (requires proper GCP project with Vertex AI enabled)
|
|
31
|
-
if (process.env.GOOGLE_APPLICATION_CREDENTIALS) {
|
|
32
|
-
console.log("🚀 Using Vertex AI (Service Account) for analysis");
|
|
33
|
-
this.shouldUseVertex = true;
|
|
34
|
-
let projectId = process.env.GOOGLE_CLOUD_PROJECT || "gen-lang-client-0497677316";
|
|
35
|
-
try {
|
|
36
|
-
this.vertexAI = new vertexai_1.VertexAI({ project: projectId, location: 'us-central1' });
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
catch (e) {
|
|
40
|
-
console.warn("⚠️ Failed to initialize Vertex AI.", e);
|
|
41
|
-
this.shouldUseVertex = false;
|
|
6
|
+
constructor(apiKey, projectPath = process.cwd()) {
|
|
7
|
+
this.aiCore = AICore_1.AICore.getInstance({
|
|
8
|
+
fallbackEnabled: true,
|
|
9
|
+
workingDirectory: projectPath
|
|
10
|
+
});
|
|
11
|
+
// If apiKey is provided, we can set it on the Gemini client via AICore
|
|
12
|
+
if (apiKey) {
|
|
13
|
+
const geminiClient = this.aiCore.getClient("gemini");
|
|
14
|
+
if (geminiClient) {
|
|
15
|
+
geminiClient.setApiKey(apiKey);
|
|
42
16
|
}
|
|
43
17
|
}
|
|
44
|
-
throw new Error("Gemini API key not found. Please set GEMINI_API_KEY or GOOGLE_API_KEY environment variable.");
|
|
45
18
|
}
|
|
46
19
|
/**
|
|
47
|
-
* Analyze a screenshot and extract UI information
|
|
20
|
+
* Analyze a screenshot and extract UI information via AICore (with fallback)
|
|
48
21
|
*/
|
|
49
22
|
async analyzeScreenshot(imagePath, retries = 2) {
|
|
50
23
|
try {
|
|
51
|
-
// Read the image file
|
|
52
|
-
const imageData = await fs_1.default.promises.readFile(imagePath);
|
|
53
|
-
const base64Image = imageData.toString("base64");
|
|
54
|
-
const mimeType = this.getMimeType(imagePath);
|
|
55
24
|
const prompt = `You are an expert UI/UX analyst and frontend developer. Analyze this screenshot of a web/mobile application and provide a comprehensive breakdown.
|
|
56
25
|
|
|
57
26
|
**Extract and describe:**
|
|
@@ -122,66 +91,7 @@ class GeminiVisionService {
|
|
|
122
91
|
\`\`\`
|
|
123
92
|
|
|
124
93
|
Be as detailed and accurate as possible. If something is unclear or not visible, note that in the description.`;
|
|
125
|
-
|
|
126
|
-
let lastError = null;
|
|
127
|
-
// Try models in order until one works
|
|
128
|
-
for (const modelName of this.VISION_MODELS) {
|
|
129
|
-
try {
|
|
130
|
-
console.log(` Trying model: ${modelName}...`);
|
|
131
|
-
if (this.shouldUseVertex && this.vertexAI) {
|
|
132
|
-
// Vertex AI SDK Usage
|
|
133
|
-
const model = this.vertexAI.getGenerativeModel({ model: modelName });
|
|
134
|
-
const imagePart = {
|
|
135
|
-
inlineData: {
|
|
136
|
-
data: base64Image,
|
|
137
|
-
mimeType: mimeType
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
const textPart = { text: prompt };
|
|
141
|
-
result = await model.generateContent({
|
|
142
|
-
contents: [{ role: 'user', parts: [imagePart, textPart] }]
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
else if (this.genAI) {
|
|
146
|
-
// Google AI SDK Usage
|
|
147
|
-
const model = this.genAI.getGenerativeModel({ model: modelName });
|
|
148
|
-
result = await model.generateContent([
|
|
149
|
-
prompt,
|
|
150
|
-
{
|
|
151
|
-
inlineData: {
|
|
152
|
-
data: base64Image,
|
|
153
|
-
mimeType,
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
]);
|
|
157
|
-
}
|
|
158
|
-
// If we got here, the model worked!
|
|
159
|
-
console.log(` ✓ Using ${modelName}`);
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
catch (modelError) {
|
|
163
|
-
lastError = modelError;
|
|
164
|
-
// 404 means model not found, try next one
|
|
165
|
-
if (modelError?.status === 404 || modelError?.message?.includes('not found')) {
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
// Other errors (rate limit, etc.) should be thrown
|
|
169
|
-
throw modelError;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (!result) {
|
|
173
|
-
throw lastError || new Error("No models available");
|
|
174
|
-
}
|
|
175
|
-
const response = await result.response;
|
|
176
|
-
// Both SDKs have different response structures, so we handle both
|
|
177
|
-
let text = "";
|
|
178
|
-
if (typeof response.text === 'function') {
|
|
179
|
-
text = response.text();
|
|
180
|
-
}
|
|
181
|
-
else if (response.candidates && response.candidates.length > 0) {
|
|
182
|
-
// Fallback for raw Vertex response
|
|
183
|
-
text = response.candidates[0]?.content?.parts?.[0]?.text || "";
|
|
184
|
-
}
|
|
94
|
+
const text = await this.aiCore.generateVisionText(prompt, imagePath);
|
|
185
95
|
// Extract JSON from markdown code blocks if present
|
|
186
96
|
const jsonMatch = text.match(/```json\n([\s\S]*?)\n```/);
|
|
187
97
|
const jsonText = (jsonMatch ? jsonMatch[1] : text) || "{}"; // Ensure it's never undefined
|
|
@@ -189,22 +99,7 @@ Be as detailed and accurate as possible. If something is unclear or not visible,
|
|
|
189
99
|
return analysis;
|
|
190
100
|
}
|
|
191
101
|
catch (error) {
|
|
192
|
-
// Check if it's a rate limit error and retry
|
|
193
|
-
if ((error?.status === 429 || error?.code === 429) && retries > 0) {
|
|
194
|
-
const retryDelay = error?.errorDetails?.find((d) => d["@type"]?.includes("RetryInfo"))?.retryDelay;
|
|
195
|
-
const waitTime = retryDelay ? parseInt(retryDelay.replace("s", "")) * 1000 : 3000;
|
|
196
|
-
console.log(`Rate limited. Retrying in ${waitTime / 1000}s... (${retries} attempts left)`);
|
|
197
|
-
await new Promise(resolve => setTimeout(resolve, waitTime));
|
|
198
|
-
return this.analyzeScreenshot(imagePath, retries - 1);
|
|
199
|
-
}
|
|
200
102
|
console.error("Error analyzing screenshot:", error);
|
|
201
|
-
// Friendly error for Vertex AI API not enabled
|
|
202
|
-
if (this.shouldUseVertex && error?.message?.includes("Vertex AI API has not been used")) {
|
|
203
|
-
const activationUrl = error?.error?.details?.find((d) => d.activationUrl)?.activationUrl;
|
|
204
|
-
if (activationUrl) {
|
|
205
|
-
throw new Error(`Vertex AI API is not enabled for project. \n\n👉 Enable it here: ${activationUrl}\n\nThen try again.`);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
103
|
throw new Error(`Failed to analyze screenshot: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
209
104
|
}
|
|
210
105
|
}
|
|
@@ -263,20 +158,6 @@ ${analysis.techStack.suggested.map((tech) => `- ${tech}`).join("\n")}
|
|
|
263
158
|
`;
|
|
264
159
|
return context;
|
|
265
160
|
}
|
|
266
|
-
/**
|
|
267
|
-
* Get MIME type from file extension
|
|
268
|
-
*/
|
|
269
|
-
getMimeType(filePath) {
|
|
270
|
-
const ext = path_1.default.extname(filePath).toLowerCase();
|
|
271
|
-
const mimeTypes = {
|
|
272
|
-
".jpg": "image/jpeg",
|
|
273
|
-
".jpeg": "image/jpeg",
|
|
274
|
-
".png": "image/png",
|
|
275
|
-
".gif": "image/gif",
|
|
276
|
-
".webp": "image/webp",
|
|
277
|
-
};
|
|
278
|
-
return mimeTypes[ext] || "image/jpeg";
|
|
279
|
-
}
|
|
280
161
|
}
|
|
281
162
|
exports.GeminiVisionService = GeminiVisionService;
|
|
282
163
|
//# sourceMappingURL=gemini-vision.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-vision.js","sourceRoot":"","sources":["../../src/services/gemini-vision.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gemini-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CAAC,CAAC,CAAC,oBAAoB,QAAQ,CAAC,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;;;EAGnH,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;iBAEnD,QAAQ,CAAC,SAAS,CAAC,SAAS;;;;;;;;;CAS5C,CAAC;QAEE,OAAO,OAAO,CAAC;IACjB,CAAC;CAEF;AA/KD,kDA+KC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function clarifyFeatureRequestWithLLM(featureDescription: string, context: any): Promise<{
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
todos: string[];
|
|
5
|
+
userValue: string;
|
|
6
|
+
acceptanceCriteria: string[];
|
|
7
|
+
dependencies: never[];
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=llmClarifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmClarifier.d.ts","sourceRoot":"","sources":["../../src/services/llmClarifier.ts"],"names":[],"mappings":"AACA,wBAAsB,4BAA4B,CAAC,kBAAkB,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;;;;;;;GAgB1F"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clarifyFeatureRequestWithLLM = clarifyFeatureRequestWithLLM;
|
|
4
|
+
// clarifyFeatureRequestWithLLM: Use LLM to clarify/clean user feature request with context
|
|
5
|
+
async function clarifyFeatureRequestWithLLM(featureDescription, context) {
|
|
6
|
+
// In real implementation, call LLM API with system/context prompt
|
|
7
|
+
// For now, simulate clarification
|
|
8
|
+
return {
|
|
9
|
+
title: featureDescription.trim(),
|
|
10
|
+
description: featureDescription.trim(),
|
|
11
|
+
todos: [
|
|
12
|
+
`Design: ${featureDescription}`,
|
|
13
|
+
`Implement: ${featureDescription}`,
|
|
14
|
+
`Test: ${featureDescription}`,
|
|
15
|
+
`Document: ${featureDescription}`
|
|
16
|
+
],
|
|
17
|
+
userValue: "User benefit from this feature.",
|
|
18
|
+
acceptanceCriteria: ["Feature works as described."],
|
|
19
|
+
dependencies: []
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=llmClarifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmClarifier.js","sourceRoot":"","sources":["../../src/services/llmClarifier.ts"],"names":[],"mappings":";;AACA,oEAgBC;AAjBD,2FAA2F;AACpF,KAAK,UAAU,4BAA4B,CAAC,kBAA0B,EAAE,OAAY;IACzF,kEAAkE;IAClE,kCAAkC;IAClC,OAAO;QACL,KAAK,EAAE,kBAAkB,CAAC,IAAI,EAAE;QAChC,WAAW,EAAE,kBAAkB,CAAC,IAAI,EAAE;QACtC,KAAK,EAAE;YACL,WAAW,kBAAkB,EAAE;YAC/B,cAAc,kBAAkB,EAAE;YAClC,SAAS,kBAAkB,EAAE;YAC7B,aAAa,kBAAkB,EAAE;SAClC;QACD,SAAS,EAAE,iCAAiC;QAC5C,kBAAkB,EAAE,CAAC,6BAA6B,CAAC;QACnD,YAAY,EAAE,EAAE;KACjB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vision Element Finder Service
|
|
3
|
+
*
|
|
4
|
+
* Combines vision AI with DOM understanding to identify and interact with UI elements.
|
|
5
|
+
* This is the revolutionary approach: instead of brittle CSS selectors,
|
|
6
|
+
* we "see" the page and find elements like a human would.
|
|
7
|
+
*/
|
|
8
|
+
import { Page } from "playwright";
|
|
9
|
+
import { VisualElement, VisionAnalysisResult, VisionActionDecision } from "../types/vision-testing";
|
|
10
|
+
export declare class VisionElementFinder {
|
|
11
|
+
private aiCore;
|
|
12
|
+
private screenshotsDir;
|
|
13
|
+
private confidenceThreshold;
|
|
14
|
+
constructor(projectPath: string, confidenceThreshold?: number);
|
|
15
|
+
/**
|
|
16
|
+
* Analyze the current page using vision
|
|
17
|
+
*/
|
|
18
|
+
analyzePage(page: Page): Promise<VisionAnalysisResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Find an element by natural language description
|
|
21
|
+
*/
|
|
22
|
+
findElement(page: Page, description: string, fallbackSelector?: string): Promise<VisualElement | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Find all interactive elements on the page
|
|
25
|
+
*/
|
|
26
|
+
findAllInteractiveElements(page: Page): Promise<VisualElement[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Decide next action based on current page state
|
|
29
|
+
*/
|
|
30
|
+
decideNextAction(page: Page, mission: string, previousSteps: string[], primeObjective: string): Promise<VisionActionDecision>;
|
|
31
|
+
/**
|
|
32
|
+
* Click an element using visual coordinates
|
|
33
|
+
*/
|
|
34
|
+
clickElement(page: Page, element: VisualElement): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Fill an input element using visual coordinates or selector
|
|
37
|
+
*/
|
|
38
|
+
fillElement(page: Page, element: VisualElement, value: string): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Take screenshot of current page
|
|
41
|
+
*/
|
|
42
|
+
private takeScreenshot;
|
|
43
|
+
/**
|
|
44
|
+
* Get DOM context for hybrid approach
|
|
45
|
+
*/
|
|
46
|
+
private getDOMContext;
|
|
47
|
+
/**
|
|
48
|
+
* Build comprehensive analysis prompt
|
|
49
|
+
*/
|
|
50
|
+
private buildAnalysisPrompt;
|
|
51
|
+
/**
|
|
52
|
+
* Analyze screenshot with custom prompt using AICore fallback
|
|
53
|
+
*/
|
|
54
|
+
private analyzeScreenshotWithPrompt;
|
|
55
|
+
/**
|
|
56
|
+
* Ask vision AI with a custom prompt via AICore (with fallback)
|
|
57
|
+
*/
|
|
58
|
+
private askVisionAI;
|
|
59
|
+
/**
|
|
60
|
+
* Fallback: Find element by DOM selector
|
|
61
|
+
*/
|
|
62
|
+
private findByDOMSelector;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=vision-element-finder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vision-element-finder.d.ts","sourceRoot":"","sources":["../../src/services/vision-element-finder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAKjC,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,mBAAmB,CAAS;gBAGlC,WAAW,EAAE,MAAM,EACnB,mBAAmB,GAAE,MAAW;IAelC;;OAEG;IACG,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAiB5D;;OAEG;IACG,WAAW,CACf,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IA8EhC;;OAEG;IACG,0BAA0B,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAyCtE;;OAEG;IACG,gBAAgB,CACpB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EAAE,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,oBAAoB,CAAC;IAwDhC;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAsBxE;;OAEG;IACG,WAAW,CACf,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,aAAa,E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