@operstack/audit 0.23.0 → 0.24.0
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/test-overall.mjs +3 -1
- package/src/visibility.mjs +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operstack/audit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "SEO, AEO and GEO audit generator: collect public signals from a site into audit.json, let an analyst or an agent fill the narrative, render the OperStack report as HTML and PDF.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/test-overall.mjs
CHANGED
|
@@ -33,7 +33,9 @@ is('пустой набор не даёт нуля', computeOverall([]).score, n
|
|
|
33
33
|
|
|
34
34
|
// ---- параметры измерения зафиксированы: их расхождение и есть расхождение чисел
|
|
35
35
|
is('бюджет времени один на всех', VISIBILITY_DEFAULTS.budgetMs, 8500);
|
|
36
|
-
|
|
36
|
+
// Девять плюс главная это десять. Число стоит на витрине словами «другие проверяют одну
|
|
37
|
+
// страницу, мы проверяем десять», поэтому оно обязано совпадать с тем, что движок правда читает.
|
|
38
|
+
is('глубина выборки одна на всех', VISIBILITY_DEFAULTS.samplePages, 9);
|
|
37
39
|
ok('параметры нельзя поменять на ходу', Object.isFrozen(VISIBILITY_DEFAULTS));
|
|
38
40
|
|
|
39
41
|
// ---- балл видимости сходится сам с собой
|
package/src/visibility.mjs
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AI visibility check: can ChatGPT, Perplexity, Copilot, Claude and Gemini read, understand
|
|
3
3
|
* and cite this site? Public signals only, one homepage fetch plus robots, llms.txt, the
|
|
4
|
-
* sitemap head and up to
|
|
4
|
+
* sitemap head and up to nine sampled pages, all in parallel, under a hard time budget so it
|
|
5
5
|
* runs inside a serverless function. Plain ESM so the same module runs in Node for tests.
|
|
6
6
|
*
|
|
7
|
+
* Почему девять, а не три. До 17.09.2026 проверка читала главную и три страницы, а на витрине мы
|
|
8
|
+
* собирались написать «другие проверяют одну страницу, мы проверяем десять». Это было бы неправдой:
|
|
9
|
+
* платный аудит читал десять, бесплатная проверка четыре. Замерено: десять страниц укладываются в
|
|
10
|
+
* 598 мс при бюджете 8500, потому что страницы берутся параллельно. Сайту с пятью страницами это не
|
|
11
|
+
* вредит: берётся столько, сколько есть, и отчёт называет настоящее число прочитанного.
|
|
12
|
+
*
|
|
7
13
|
* The measurement is language-neutral; only the words a person reads come from the MESSAGES
|
|
8
14
|
* table below, picked by the `lang` option ('en' by default, 'ru' on oper-stack.ru). Finding ids
|
|
9
15
|
* and area ids never change with the language, so task lists and reports can key on them.
|
|
10
16
|
*
|
|
11
17
|
* This file is also vendored by the Apify actor (OperStack/apify-ai-visibility/src). The two
|
|
12
18
|
* copies must stay byte for byte identical, and `npm test` in the actor fails if they drift.
|
|
13
|
-
* That is why `samplePages` lives here
|
|
19
|
+
* That is why `samplePages` lives here and every caller spreads VISIBILITY_DEFAULTS: a copy that has
|
|
14
20
|
* to differ is a copy nobody keeps in sync, and this one had drifted by 304 lines.
|
|
15
21
|
*/
|
|
16
22
|
|
|
@@ -346,7 +352,7 @@ async function readSitemap(origin, robotsText, timeoutFn = () => 3000) {
|
|
|
346
352
|
* в аудите и в акторе. Если где-то дать больше страниц или времени, число про один и тот же сайт
|
|
347
353
|
* разойдётся, и мы вернёмся к тому, ради чего всё это затевалось.
|
|
348
354
|
*/
|
|
349
|
-
export const VISIBILITY_DEFAULTS = Object.freeze({ budgetMs: 8500, samplePages:
|
|
355
|
+
export const VISIBILITY_DEFAULTS = Object.freeze({ budgetMs: 8500, samplePages: 9 });
|
|
350
356
|
|
|
351
357
|
/**
|
|
352
358
|
* Что писать владельцу сайта, который нас не пустил.
|
|
@@ -375,7 +381,7 @@ export function blockedNote({ status, challenged, blocked = true, robotsText = n
|
|
|
375
381
|
return { text: head + tail + T.howToCheckBots, botsBlocked: closed.length > 0 };
|
|
376
382
|
}
|
|
377
383
|
|
|
378
|
-
export async function checkVisibility(input, { budgetMs = 8500, lang = 'en', samplePages =
|
|
384
|
+
export async function checkVisibility(input, { budgetMs = 8500, lang = 'en', samplePages = 9 } = {}) {
|
|
379
385
|
const T = MESSAGES[lang] || MESSAGES.en;
|
|
380
386
|
const agentLabel = (a) => (lang === 'ru' ? a.labelRu : a.label);
|
|
381
387
|
const started = Date.now();
|