qazen-cli 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/visionNavigator.js +30 -2
- package/package.json +1 -1
|
@@ -104,6 +104,16 @@ export class VisionNavigator {
|
|
|
104
104
|
onEvent({ type: "error", message: `Redirected to ${currentHostname} — skipping` });
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
+
// Post-goto dedup: if redirect landed on an already-mapped URL, skip.
|
|
108
|
+
const normalizedFinal = this.normalizeUrl(currentUrl);
|
|
109
|
+
if (normalizedFinal !== normalizedUrl && this.visitedUrls.has(normalizedFinal)) {
|
|
110
|
+
onEvent({
|
|
111
|
+
type: "vision_analysis",
|
|
112
|
+
message: `Skipping ${currentUrl} — already mapped`,
|
|
113
|
+
});
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
this.visitedUrls.add(normalizedFinal);
|
|
107
117
|
const screenshot = await this.takeScreenshot(url);
|
|
108
118
|
const analysis = await this.analyzeScreenshot(screenshot, url, context, onEvent);
|
|
109
119
|
if (!analysis)
|
|
@@ -122,8 +132,26 @@ export class VisionNavigator {
|
|
|
122
132
|
message: `${analysis.pageDescription} — ${analysis.elements.length} elements found`,
|
|
123
133
|
});
|
|
124
134
|
const highPriority = analysis.elements
|
|
125
|
-
.filter((e) =>
|
|
126
|
-
(e.
|
|
135
|
+
.filter((e) => {
|
|
136
|
+
if (e.priority !== "high")
|
|
137
|
+
return false;
|
|
138
|
+
if (!["link", "tab", "menu"].includes(e.elementType))
|
|
139
|
+
return false;
|
|
140
|
+
// Skip if this action URL is already visited
|
|
141
|
+
if (e.action && e.action.startsWith("http")) {
|
|
142
|
+
const normalized = this.normalizeUrl(e.action);
|
|
143
|
+
if (this.visitedUrls.has(normalized))
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
// Skip if element description indicates it's the current page
|
|
147
|
+
const desc = e.description.toLowerCase();
|
|
148
|
+
if (desc.includes("currently active") ||
|
|
149
|
+
desc.includes("current page") ||
|
|
150
|
+
desc.includes("(active)")) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
return true;
|
|
154
|
+
})
|
|
127
155
|
.slice(0, 4);
|
|
128
156
|
for (const element of highPriority) {
|
|
129
157
|
try {
|