@rankcli/agent-runtime 0.0.22 → 0.0.23
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/index.js
CHANGED
|
@@ -71,7 +71,6 @@ async function httpGet(url, config = {}) {
|
|
|
71
71
|
signal: controller.signal,
|
|
72
72
|
redirect: maxRedirects > 0 ? "follow" : "manual"
|
|
73
73
|
});
|
|
74
|
-
clearTimeout(timeoutId);
|
|
75
74
|
const contentType = response.headers.get("content-type") || "";
|
|
76
75
|
let data;
|
|
77
76
|
if (contentType.includes("application/json")) {
|
|
@@ -79,6 +78,7 @@ async function httpGet(url, config = {}) {
|
|
|
79
78
|
} else {
|
|
80
79
|
data = await response.text();
|
|
81
80
|
}
|
|
81
|
+
clearTimeout(timeoutId);
|
|
82
82
|
if (!validateStatus(response.status)) {
|
|
83
83
|
const error = new Error(`Request failed with status ${response.status}`);
|
|
84
84
|
error.response = {
|
|
@@ -170,7 +170,6 @@ async function httpPost(url, data, config = {}) {
|
|
|
170
170
|
body: data ? JSON.stringify(data) : void 0,
|
|
171
171
|
signal: controller.signal
|
|
172
172
|
});
|
|
173
|
-
clearTimeout(timeoutId);
|
|
174
173
|
const contentType = response.headers.get("content-type") || "";
|
|
175
174
|
let responseData;
|
|
176
175
|
if (contentType.includes("application/json")) {
|
|
@@ -178,6 +177,7 @@ async function httpPost(url, data, config = {}) {
|
|
|
178
177
|
} else {
|
|
179
178
|
responseData = await response.text();
|
|
180
179
|
}
|
|
180
|
+
clearTimeout(timeoutId);
|
|
181
181
|
if (!validateStatus(response.status)) {
|
|
182
182
|
const error = new Error(`Request failed with status ${response.status}`);
|
|
183
183
|
error.response = {
|
|
@@ -8443,7 +8443,7 @@ async function checkRobotsTxt(baseUrl) {
|
|
|
8443
8443
|
}
|
|
8444
8444
|
async function checkSitemap(baseUrl, robotsData) {
|
|
8445
8445
|
const issues = [];
|
|
8446
|
-
const sitemapUrls = robotsData.sitemapUrls.length > 0 ? robotsData.sitemapUrls : [
|
|
8446
|
+
const sitemapUrls = robotsData.sitemapUrls.length > 0 ? robotsData.sitemapUrls.slice(0, 3) : [
|
|
8447
8447
|
new URL("/sitemap.xml", baseUrl).href,
|
|
8448
8448
|
new URL("/sitemap_index.xml", baseUrl).href
|
|
8449
8449
|
];
|
|
@@ -17532,9 +17532,22 @@ async function runFullAudit(options) {
|
|
|
17532
17532
|
console.error(`
|
|
17533
17533
|
\u{1F50D} Running comprehensive SEO audit on ${url}...
|
|
17534
17534
|
`);
|
|
17535
|
+
const withTimeout = async (name, promise, timeoutMs) => {
|
|
17536
|
+
let timer;
|
|
17537
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
17538
|
+
timer = setTimeout(() => reject(new Error(`${name} timed out`)), timeoutMs);
|
|
17539
|
+
});
|
|
17540
|
+
try {
|
|
17541
|
+
return await Promise.race([promise, timeoutPromise]);
|
|
17542
|
+
} finally {
|
|
17543
|
+
clearTimeout(timer);
|
|
17544
|
+
}
|
|
17545
|
+
};
|
|
17535
17546
|
console.error("\u{1F4CB} Phase 1: Crawlability checks + page fetch (parallel)...");
|
|
17536
17547
|
const [crawlabilityResult, fetchResult] = await Promise.all([
|
|
17537
|
-
|
|
17548
|
+
// robots.txt, sitemaps and the redirect chain run one after another; a site that is slow
|
|
17549
|
+
// on each could hold the page for minutes, so the whole group gets 45s.
|
|
17550
|
+
withTimeout("Crawlability checks", runCrawlabilityChecks(url), 45e3).catch((err) => {
|
|
17538
17551
|
console.error("Crawlability check failed:", err);
|
|
17539
17552
|
return [];
|
|
17540
17553
|
}),
|
|
@@ -17685,17 +17698,6 @@ async function runFullAudit(options) {
|
|
|
17685
17698
|
}
|
|
17686
17699
|
}
|
|
17687
17700
|
console.error("\u{1F517} Phase 3: Running async checks (parallel)...");
|
|
17688
|
-
const withTimeout = async (name, promise, timeoutMs) => {
|
|
17689
|
-
let timer;
|
|
17690
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
17691
|
-
timer = setTimeout(() => reject(new Error(`${name} timed out`)), timeoutMs);
|
|
17692
|
-
});
|
|
17693
|
-
try {
|
|
17694
|
-
return await Promise.race([promise, timeoutPromise]);
|
|
17695
|
-
} finally {
|
|
17696
|
-
clearTimeout(timer);
|
|
17697
|
-
}
|
|
17698
|
-
};
|
|
17699
17701
|
const safeAsync = async (name, fn, timeoutMs = 1e4) => {
|
|
17700
17702
|
try {
|
|
17701
17703
|
const result = await withTimeout(name, fn(), timeoutMs);
|
package/dist/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
httpGet,
|
|
15
15
|
httpHead,
|
|
16
16
|
httpPost
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-NATXE6B3.mjs";
|
|
18
18
|
import {
|
|
19
19
|
AI_CRAWLERS_INFO,
|
|
20
20
|
analyzeCitationReadiness,
|
|
@@ -4924,7 +4924,7 @@ async function checkRobotsTxt(baseUrl) {
|
|
|
4924
4924
|
}
|
|
4925
4925
|
async function checkSitemap2(baseUrl, robotsData) {
|
|
4926
4926
|
const issues = [];
|
|
4927
|
-
const sitemapUrls = robotsData.sitemapUrls.length > 0 ? robotsData.sitemapUrls : [
|
|
4927
|
+
const sitemapUrls = robotsData.sitemapUrls.length > 0 ? robotsData.sitemapUrls.slice(0, 3) : [
|
|
4928
4928
|
new URL("/sitemap.xml", baseUrl).href,
|
|
4929
4929
|
new URL("/sitemap_index.xml", baseUrl).href
|
|
4930
4930
|
];
|
|
@@ -13989,9 +13989,22 @@ async function runFullAudit(options) {
|
|
|
13989
13989
|
console.error(`
|
|
13990
13990
|
\u{1F50D} Running comprehensive SEO audit on ${url}...
|
|
13991
13991
|
`);
|
|
13992
|
+
const withTimeout = async (name, promise, timeoutMs) => {
|
|
13993
|
+
let timer;
|
|
13994
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
13995
|
+
timer = setTimeout(() => reject(new Error(`${name} timed out`)), timeoutMs);
|
|
13996
|
+
});
|
|
13997
|
+
try {
|
|
13998
|
+
return await Promise.race([promise, timeoutPromise]);
|
|
13999
|
+
} finally {
|
|
14000
|
+
clearTimeout(timer);
|
|
14001
|
+
}
|
|
14002
|
+
};
|
|
13992
14003
|
console.error("\u{1F4CB} Phase 1: Crawlability checks + page fetch (parallel)...");
|
|
13993
14004
|
const [crawlabilityResult, fetchResult] = await Promise.all([
|
|
13994
|
-
|
|
14005
|
+
// robots.txt, sitemaps and the redirect chain run one after another; a site that is slow
|
|
14006
|
+
// on each could hold the page for minutes, so the whole group gets 45s.
|
|
14007
|
+
withTimeout("Crawlability checks", runCrawlabilityChecks(url), 45e3).catch((err) => {
|
|
13995
14008
|
console.error("Crawlability check failed:", err);
|
|
13996
14009
|
return [];
|
|
13997
14010
|
}),
|
|
@@ -14142,17 +14155,6 @@ async function runFullAudit(options) {
|
|
|
14142
14155
|
}
|
|
14143
14156
|
}
|
|
14144
14157
|
console.error("\u{1F517} Phase 3: Running async checks (parallel)...");
|
|
14145
|
-
const withTimeout = async (name, promise, timeoutMs) => {
|
|
14146
|
-
let timer;
|
|
14147
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
14148
|
-
timer = setTimeout(() => reject(new Error(`${name} timed out`)), timeoutMs);
|
|
14149
|
-
});
|
|
14150
|
-
try {
|
|
14151
|
-
return await Promise.race([promise, timeoutPromise]);
|
|
14152
|
-
} finally {
|
|
14153
|
-
clearTimeout(timer);
|
|
14154
|
-
}
|
|
14155
|
-
};
|
|
14156
14158
|
const safeAsync = async (name, fn, timeoutMs = 1e4) => {
|
|
14157
14159
|
try {
|
|
14158
14160
|
const result = await withTimeout(name, fn(), timeoutMs);
|
|
@@ -23037,7 +23039,7 @@ async function executeAgent(agent, options = {}) {
|
|
|
23037
23039
|
}
|
|
23038
23040
|
}
|
|
23039
23041
|
async function runDirectAnalysis(url) {
|
|
23040
|
-
const { analyzeUrl: analyzeUrl2 } = await import("./analyzer-
|
|
23042
|
+
const { analyzeUrl: analyzeUrl2 } = await import("./analyzer-MCBRQHB7.mjs");
|
|
23041
23043
|
const result = await analyzeUrl2({ url });
|
|
23042
23044
|
if (!result.success || !result.data) {
|
|
23043
23045
|
throw new Error(result.error || "Analysis failed");
|
package/package.json
CHANGED
|
@@ -41,7 +41,6 @@ async function httpGet(url, config = {}) {
|
|
|
41
41
|
signal: controller.signal,
|
|
42
42
|
redirect: maxRedirects > 0 ? "follow" : "manual"
|
|
43
43
|
});
|
|
44
|
-
clearTimeout(timeoutId);
|
|
45
44
|
const contentType = response.headers.get("content-type") || "";
|
|
46
45
|
let data;
|
|
47
46
|
if (contentType.includes("application/json")) {
|
|
@@ -49,6 +48,7 @@ async function httpGet(url, config = {}) {
|
|
|
49
48
|
} else {
|
|
50
49
|
data = await response.text();
|
|
51
50
|
}
|
|
51
|
+
clearTimeout(timeoutId);
|
|
52
52
|
if (!validateStatus(response.status)) {
|
|
53
53
|
const error = new Error(`Request failed with status ${response.status}`);
|
|
54
54
|
error.response = {
|
|
@@ -140,7 +140,6 @@ async function httpPost(url, data, config = {}) {
|
|
|
140
140
|
body: data ? JSON.stringify(data) : void 0,
|
|
141
141
|
signal: controller.signal
|
|
142
142
|
});
|
|
143
|
-
clearTimeout(timeoutId);
|
|
144
143
|
const contentType = response.headers.get("content-type") || "";
|
|
145
144
|
let responseData;
|
|
146
145
|
if (contentType.includes("application/json")) {
|
|
@@ -148,6 +147,7 @@ async function httpPost(url, data, config = {}) {
|
|
|
148
147
|
} else {
|
|
149
148
|
responseData = await response.text();
|
|
150
149
|
}
|
|
150
|
+
clearTimeout(timeoutId);
|
|
151
151
|
if (!validateStatus(response.status)) {
|
|
152
152
|
const error = new Error(`Request failed with status ${response.status}`);
|
|
153
153
|
error.response = {
|