seo 0.4.0 → 0.4.1
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/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/{dist-VKoRyTMH.js → dist-DjclF3Qk.js} +31 -31
- package/dist/{dist-VKoRyTMH.js.map → dist-DjclF3Qk.js.map} +1 -1
- package/dist/{dist-Cv-Z5qD5.js → dist-FO7n-64s.js} +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +93 -23
- package/dist/mcp.js.map +1 -1
- package/dist/{package-BfqlCbxN.js → package-CeYsRRpB.js} +2 -2
- package/dist/{package-BfqlCbxN.js.map → package-CeYsRRpB.js.map} +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __seoCreateRequire } from 'node:module'; const require = __seoCreateRequire(import.meta.url);
|
|
3
|
-
import{s as e}from"./dist-
|
|
3
|
+
import{s as e}from"./dist-DjclF3Qk.js";export{e as startMcpServer};
|
package/dist/index.d.ts
CHANGED
|
@@ -19080,12 +19080,13 @@ interface TrafficAnomaly {
|
|
|
19080
19080
|
/** The step-change heuristic and its thresholds, returned with the report. */
|
|
19081
19081
|
declare const STEP_CHANGE_RULES: {
|
|
19082
19082
|
readonly method: "best-split";
|
|
19083
|
-
readonly description: "Heuristic. The change date is the split of the daily series where the mean before and the mean after differ most, weighted by segment length. It counts as a step change only when it is sudden and sustained. Sudden: the median of up to localDays observed days after the date differs from the median of up to localDays days before it by at least minLocalShiftInStdDevs pooled within-segment standard deviations, so one unusual day is not a step and a slow trend is not a step. Sustained: the mean of every day from the date differs from the mean before it by a z-score of at least minZScore, stricter than the recent-window test because the date is chosen from the data. Otherwise the last recentDays are compared with the days before them.";
|
|
19083
|
+
readonly description: "Heuristic. The change date is the split of the daily series where the mean before and the mean after differ most, weighted by segment length. It counts as a step change only when it is sudden and sustained. Sudden: the median of up to localDays observed days after the date differs from the median of up to localDays days before it by at least minLocalShiftInStdDevs pooled within-segment standard deviations, so one unusual day is not a step and a slow trend is not a step. Sustained: the mean of every day from the date differs from the mean before it by a z-score of at least minZScore, stricter than the recent-window test because the date is chosen from the data. These tests use daily values capped at the capDays and 1 - capDays quantiles, so one spike day cannot hide a lasting step. Otherwise the last recentDays are compared with the days before them.";
|
|
19084
19084
|
readonly minDaysBefore: 7;
|
|
19085
19085
|
readonly minDaysAfter: 3;
|
|
19086
19086
|
readonly localDays: 7;
|
|
19087
19087
|
readonly minLocalShiftInStdDevs: 2;
|
|
19088
19088
|
readonly minZScore: 3;
|
|
19089
|
+
readonly capDays: 0.05;
|
|
19089
19090
|
};
|
|
19090
19091
|
type TrafficAnomalyDetection = typeof STEP_CHANGE_RULES & {
|
|
19091
19092
|
recentDays: number;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __seoCreateRequire } from 'node:module'; const require = __seoCreateRequire(import.meta.url);
|
|
2
|
-
import { n as load, t as version } from "./package-
|
|
2
|
+
import { n as load, t as version } from "./package-CeYsRRpB.js";
|
|
3
3
|
import { SEO_PROVIDER_API_VERSION } from "./provider-sdk.js";
|
|
4
4
|
import crypto, { createHash, randomUUID, sign } from "node:crypto";
|
|
5
5
|
import { z } from "zod";
|
|
@@ -8341,7 +8341,7 @@ const TOPIC_WORDS = /* @__PURE__ */ new Set([
|
|
|
8341
8341
|
"free",
|
|
8342
8342
|
"guide",
|
|
8343
8343
|
"how",
|
|
8344
|
-
"
|
|
8344
|
+
"example",
|
|
8345
8345
|
"install",
|
|
8346
8346
|
"integration",
|
|
8347
8347
|
"local",
|
|
@@ -20251,12 +20251,13 @@ async function listSearchUpdates(input = {}) {
|
|
|
20251
20251
|
/** The step-change heuristic and its thresholds, returned with the report. */
|
|
20252
20252
|
const STEP_CHANGE_RULES = {
|
|
20253
20253
|
method: "best-split",
|
|
20254
|
-
description: "Heuristic. The change date is the split of the daily series where the mean before and the mean after differ most, weighted by segment length. It counts as a step change only when it is sudden and sustained. Sudden: the median of up to localDays observed days after the date differs from the median of up to localDays days before it by at least minLocalShiftInStdDevs pooled within-segment standard deviations, so one unusual day is not a step and a slow trend is not a step. Sustained: the mean of every day from the date differs from the mean before it by a z-score of at least minZScore, stricter than the recent-window test because the date is chosen from the data. Otherwise the last recentDays are compared with the days before them.",
|
|
20254
|
+
description: "Heuristic. The change date is the split of the daily series where the mean before and the mean after differ most, weighted by segment length. It counts as a step change only when it is sudden and sustained. Sudden: the median of up to localDays observed days after the date differs from the median of up to localDays days before it by at least minLocalShiftInStdDevs pooled within-segment standard deviations, so one unusual day is not a step and a slow trend is not a step. Sustained: the mean of every day from the date differs from the mean before it by a z-score of at least minZScore, stricter than the recent-window test because the date is chosen from the data. These tests use daily values capped at the capDays and 1 - capDays quantiles, so one spike day cannot hide a lasting step. Otherwise the last recentDays are compared with the days before them.",
|
|
20255
20255
|
minDaysBefore: 7,
|
|
20256
20256
|
minDaysAfter: 3,
|
|
20257
20257
|
localDays: 7,
|
|
20258
20258
|
minLocalShiftInStdDevs: 2,
|
|
20259
|
-
minZScore: 3
|
|
20259
|
+
minZScore: 3,
|
|
20260
|
+
capDays: .05
|
|
20260
20261
|
};
|
|
20261
20262
|
/**
|
|
20262
20263
|
* The dates to check against Google updates (before padding): the change
|
|
@@ -20432,10 +20433,18 @@ function sumOfSquaredDeviations(values) {
|
|
|
20432
20433
|
const average = mean(values);
|
|
20433
20434
|
return values.reduce((sum, value) => sum + (value - average) ** 2, 0);
|
|
20434
20435
|
}
|
|
20435
|
-
function
|
|
20436
|
+
function capped(values) {
|
|
20437
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
20438
|
+
const last = sorted.length - 1;
|
|
20439
|
+
const low = sorted[Math.floor(last * STEP_CHANGE_RULES.capDays)] ?? 0;
|
|
20440
|
+
const high = sorted[Math.ceil(last * (1 - STEP_CHANGE_RULES.capDays))] ?? 0;
|
|
20441
|
+
return values.map((value) => Math.min(high, Math.max(low, value)));
|
|
20442
|
+
}
|
|
20443
|
+
function findStepChange(observed) {
|
|
20436
20444
|
const { minDaysBefore, minDaysAfter, localDays, minLocalShiftInStdDevs, minZScore } = STEP_CHANGE_RULES;
|
|
20437
|
-
const count =
|
|
20445
|
+
const count = observed.length;
|
|
20438
20446
|
if (count < minDaysBefore + minDaysAfter) return null;
|
|
20447
|
+
const values = capped(observed);
|
|
20439
20448
|
const sums = [0];
|
|
20440
20449
|
for (const value of values) sums.push((sums.at(-1) ?? 0) + value);
|
|
20441
20450
|
const total = sums[count] ?? 0;
|