@forkpoint/agent-lighthouse-core 4.0.0 → 4.1.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/dist/index.d.mts +82 -4
- package/dist/index.d.ts +82 -4
- package/dist/index.js +156 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +152 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -385,6 +385,14 @@ interface ScanConditions {
|
|
|
385
385
|
gatedCount: number;
|
|
386
386
|
reasons: Record<string, number>;
|
|
387
387
|
};
|
|
388
|
+
/** The wall-clock budget the scan ran under, and whether it ran out. */
|
|
389
|
+
budget?: {
|
|
390
|
+
limitMs: number;
|
|
391
|
+
elapsedMs: number;
|
|
392
|
+
exhausted: boolean;
|
|
393
|
+
/** Audits reported `na` because the budget ran out before they started. */
|
|
394
|
+
skippedCount: number;
|
|
395
|
+
};
|
|
388
396
|
}
|
|
389
397
|
interface ReadinessVitals {
|
|
390
398
|
commerce: number;
|
|
@@ -675,9 +683,10 @@ interface AuditTrace {
|
|
|
675
683
|
* `ran` — the audit executed and returned.
|
|
676
684
|
* `skipped` — no scanned page matched its `applicablePageTypes`.
|
|
677
685
|
* `gated` — the scan never obtained evidence the audit needs.
|
|
686
|
+
* `budget` — the scan's wall-clock budget ran out before it started.
|
|
678
687
|
* `error` — it threw, or its result was rejected by the schema.
|
|
679
688
|
*/
|
|
680
|
-
outcome: "ran" | "skipped" | "gated" | "error";
|
|
689
|
+
outcome: "ran" | "skipped" | "gated" | "budget" | "error";
|
|
681
690
|
status: CheckStatus;
|
|
682
691
|
score: number;
|
|
683
692
|
weight: number;
|
|
@@ -755,12 +764,23 @@ declare function planAudits(ctx: CheckContext, config: ScanConfig, options?: Pla
|
|
|
755
764
|
runnable: RunnableAudit[];
|
|
756
765
|
skipped: CheckResult[];
|
|
757
766
|
};
|
|
767
|
+
/** A budget as a sentence names it: whole seconds, or milliseconds under one. */
|
|
768
|
+
declare function formatBudget(ms: number): string;
|
|
769
|
+
/** What an aborted budget signal says, for the stub that names it. */
|
|
770
|
+
declare function budgetReason(signal: AbortSignal): string;
|
|
758
771
|
/**
|
|
759
772
|
* Execute all audits registered in the config against the scan context.
|
|
760
773
|
* Returns check results grouped into categories with weighted scores.
|
|
761
774
|
* Pass a precomputed `plan` (from {@link planAudits}) to avoid recomputing it.
|
|
775
|
+
*
|
|
776
|
+
* `budget` is the scan's wall-clock budget. Once it is aborted, no further
|
|
777
|
+
* audit is constructed, and none that was still running is believed: both
|
|
778
|
+
* report `na` tagged {@link TAG_SKIPPED_SCAN_BUDGET}. The running one is
|
|
779
|
+
* withheld because a request the budget refused answers with an error, and
|
|
780
|
+
* an audit reads that error as a broken link or a missing artifact. That
|
|
781
|
+
* would be a claim about the clock, not about the site.
|
|
762
782
|
*/
|
|
763
|
-
declare function runAudits(ctx: CheckContext, config: ScanConfig, onEvent?: (event: AuditProgressEvent) => void, plan?: AuditPlan, onTrace?: AuditTraceHandler): Promise<AuditRunResult>;
|
|
783
|
+
declare function runAudits(ctx: CheckContext, config: ScanConfig, onEvent?: (event: AuditProgressEvent) => void, plan?: AuditPlan, onTrace?: AuditTraceHandler, budget?: AbortSignal): Promise<AuditRunResult>;
|
|
764
784
|
|
|
765
785
|
type PhaseId = "fetch-root" | "fetch-pages" | "analyze" | "audits" | "report";
|
|
766
786
|
type ScanEvent = {
|
|
@@ -845,7 +865,20 @@ interface ScanOptions {
|
|
|
845
865
|
pages?: PageOverride[] | null;
|
|
846
866
|
/** Explicitly declared page type for the target URL. */
|
|
847
867
|
pageType?: PageType;
|
|
868
|
+
/**
|
|
869
|
+
* The caller's cancellation. Aborting it makes `runScan` throw; the scan
|
|
870
|
+
* budget below never does.
|
|
871
|
+
*/
|
|
848
872
|
signal?: AbortSignal;
|
|
873
|
+
/**
|
|
874
|
+
* Wall-clock budget for the whole scan, in milliseconds. Defaults to
|
|
875
|
+
* {@link SCAN_TIMEOUT_MS}. When it runs out the scan finishes with what it
|
|
876
|
+
* has: requests in flight abort, no further request is sent, and every
|
|
877
|
+
* audit not yet started, or still running when it went, reports `na`
|
|
878
|
+
* tagged `skipped:scan-budget`. `conditions.budget` on the report records
|
|
879
|
+
* it. `0` disables the budget.
|
|
880
|
+
*/
|
|
881
|
+
timeoutMs?: number;
|
|
849
882
|
/**
|
|
850
883
|
* Restrict the scan to these category ids. Unknown ids simply match nothing —
|
|
851
884
|
* validate them at the entry point so the operator hears about a typo.
|
|
@@ -1287,7 +1320,14 @@ declare const DEFAULT_ORIGIN_CACHE_TTL_MS: number;
|
|
|
1287
1320
|
*/
|
|
1288
1321
|
declare const DEFAULT_ORIGIN_CACHE_MAX_ENTRIES = 256;
|
|
1289
1322
|
declare const REQUEST_TIMEOUT_MS = 10000;
|
|
1290
|
-
|
|
1323
|
+
/**
|
|
1324
|
+
* Wall-clock budget for one scan. When it runs out, requests in flight are
|
|
1325
|
+
* aborted, no further request is sent, and every audit not yet started is
|
|
1326
|
+
* reported `na` tagged `skipped:scan-budget`. 180 s clears the 95th
|
|
1327
|
+
* percentile of the curated corpus (109 s on 2026-09-02) with margin; the
|
|
1328
|
+
* scans it cuts ran 5 to 17 minutes.
|
|
1329
|
+
*/
|
|
1330
|
+
declare const SCAN_TIMEOUT_MS = 180000;
|
|
1291
1331
|
declare const MAX_RESPONSE_BODY_BYTES: number;
|
|
1292
1332
|
/** @deprecated Unused internally; retained for published API stability. Scheduled for removal in v4. */
|
|
1293
1333
|
declare const MAX_CONCURRENT_REQUESTS = 10;
|
|
@@ -1296,6 +1336,8 @@ declare const TAG_SKIPPED_PAGE_TYPE = "skipped:page-type";
|
|
|
1296
1336
|
declare const TAG_SCAN_ERROR = "scan-error";
|
|
1297
1337
|
/** An audit the scan could not feed: it needs evidence this scan never got. */
|
|
1298
1338
|
declare const TAG_SKIPPED_NO_EVIDENCE = "skipped:no-evidence";
|
|
1339
|
+
/** An audit the scan never started: its wall-clock budget ran out first. */
|
|
1340
|
+
declare const TAG_SKIPPED_SCAN_BUDGET = "skipped:scan-budget";
|
|
1299
1341
|
/** Display names for the 8 v2 categories. */
|
|
1300
1342
|
declare const CATEGORY_NAMES: Record<string, string>;
|
|
1301
1343
|
declare const READINESS_WEIGHTS: {
|
|
@@ -1335,6 +1377,12 @@ declare function calculateCategoryScore(checks: CheckResult[]): number;
|
|
|
1335
1377
|
*/
|
|
1336
1378
|
declare function buildCategoryResult(id: string, checks: CheckResult[], mass?: number): CategoryResult;
|
|
1337
1379
|
declare function calculateOverallScore(categories: CategoryResult[]): number;
|
|
1380
|
+
/**
|
|
1381
|
+
* How much of the registry's evidence mass the checks carrying `tag` hold.
|
|
1382
|
+
* The gate and the scan budget both stub audits as `na` under their own
|
|
1383
|
+
* tag, and each is judged against {@link GATED_MASS_UNSCORED_THRESHOLD}.
|
|
1384
|
+
*/
|
|
1385
|
+
declare function skippedMassShare(checks: CheckResult[], tag: string): number;
|
|
1338
1386
|
|
|
1339
1387
|
/**
|
|
1340
1388
|
* Read product fields straight from the scanned product page(s)' structured
|
|
@@ -1716,6 +1764,22 @@ declare const ScanConditionsSchema: z.ZodObject<{
|
|
|
1716
1764
|
informativeCount: number;
|
|
1717
1765
|
gatedCount: number;
|
|
1718
1766
|
}>;
|
|
1767
|
+
budget: z.ZodOptional<z.ZodObject<{
|
|
1768
|
+
limitMs: z.ZodNumber;
|
|
1769
|
+
elapsedMs: z.ZodNumber;
|
|
1770
|
+
exhausted: z.ZodBoolean;
|
|
1771
|
+
skippedCount: z.ZodNumber;
|
|
1772
|
+
}, "strip", z.ZodTypeAny, {
|
|
1773
|
+
limitMs: number;
|
|
1774
|
+
elapsedMs: number;
|
|
1775
|
+
exhausted: boolean;
|
|
1776
|
+
skippedCount: number;
|
|
1777
|
+
}, {
|
|
1778
|
+
limitMs: number;
|
|
1779
|
+
elapsedMs: number;
|
|
1780
|
+
exhausted: boolean;
|
|
1781
|
+
skippedCount: number;
|
|
1782
|
+
}>>;
|
|
1719
1783
|
}, "strip", z.ZodTypeAny, {
|
|
1720
1784
|
url: string;
|
|
1721
1785
|
origin: {
|
|
@@ -1741,6 +1805,12 @@ declare const ScanConditionsSchema: z.ZodObject<{
|
|
|
1741
1805
|
informativeCount: number;
|
|
1742
1806
|
gatedCount: number;
|
|
1743
1807
|
};
|
|
1808
|
+
budget?: {
|
|
1809
|
+
limitMs: number;
|
|
1810
|
+
elapsedMs: number;
|
|
1811
|
+
exhausted: boolean;
|
|
1812
|
+
skippedCount: number;
|
|
1813
|
+
} | undefined;
|
|
1744
1814
|
}, {
|
|
1745
1815
|
url: string;
|
|
1746
1816
|
origin: {
|
|
@@ -1766,6 +1836,12 @@ declare const ScanConditionsSchema: z.ZodObject<{
|
|
|
1766
1836
|
informativeCount: number;
|
|
1767
1837
|
gatedCount: number;
|
|
1768
1838
|
};
|
|
1839
|
+
budget?: {
|
|
1840
|
+
limitMs: number;
|
|
1841
|
+
elapsedMs: number;
|
|
1842
|
+
exhausted: boolean;
|
|
1843
|
+
skippedCount: number;
|
|
1844
|
+
} | undefined;
|
|
1769
1845
|
}>;
|
|
1770
1846
|
|
|
1771
1847
|
declare function normalizeUrl(input: string): string;
|
|
@@ -1801,6 +1877,8 @@ interface AgentLighthouseConfig {
|
|
|
1801
1877
|
outputDir?: string;
|
|
1802
1878
|
/** Maximum number of pages to discover & scan */
|
|
1803
1879
|
maxPages?: number;
|
|
1880
|
+
/** Scan budget in seconds; 0 disables it. The flag `--timeout` overrides it. */
|
|
1881
|
+
timeout?: number;
|
|
1804
1882
|
}
|
|
1805
1883
|
/** Helper function for type-safe configuration files */
|
|
1806
1884
|
declare function defineConfig(config: AgentLighthouseConfig): AgentLighthouseConfig;
|
|
@@ -1831,4 +1909,4 @@ type AcpLinkType = (typeof ACP_LINK_TYPES)[number];
|
|
|
1831
1909
|
*/
|
|
1832
1910
|
declare function resolvePolicyLinks(ctx: CheckContext): Map<AcpLinkType, string>;
|
|
1833
1911
|
|
|
1834
|
-
export { ACP_LINK_TYPES, AI_CRAWLER_UAS, AUDIT_ID_PATTERN, type AcpLinkType, type AgentLighthouseConfig, Audit, type AuditGuidance, AuditGuidanceSchema, type AuditMeta, AuditMetaSchema, type AuditPlan, type AuditProgressEvent, type AuditRegistration, type AuditResult, AuditResultSchema, type AuditRunResult, type AuditTier, AuditTierSchema, type AuditTrace, type AuditTraceHandler, BASELINE_UA, type BlockClass, CATEGORY_IDS, CATEGORY_MASS, CATEGORY_NAMES, type CategoryConfig, type CategoryResult, type CheckContext, type CheckFn, type CheckPriority, CheckPrioritySchema, type CheckRecommendation, type CheckResult, CheckResultSchema, type CheckStatus, CheckStatusSchema, type CssRule, DEFAULT_ORIGIN_CACHE_MAX_ENTRIES, DEFAULT_ORIGIN_CACHE_TTL_MS, DEFAULT_SCAN_LIMIT, type DeprecationNotice, DeprecationNoticeSchema, type EvidenceGrade, EvidenceGradeSchema, type EvidenceKey, EvidenceKeySchema, type ExpectedKind, type FetchClass, type FetchOptions, type FetchResult, type FetcherOptions, type FieldStatus, type FixEffort, FixEffortSchema, MAX_CONCURRENT_REQUESTS, MAX_PAGES_PER_SCAN, MAX_RESPONSE_BODY_BYTES, ORIGIN_EVIDENCE_VERSION, OriginCache, type OriginCacheOptions, type OriginEvidence, PAGE_TYPE_LABELS, PHASE_WEIGHTS, PRESETS, type PageContext, type PageCss, type PageJudgement, type PageOverride, type PageType, PageTypeSchema, type PhaseId, type PresetName, type PresetOptions, type ProductFieldVerification, ProgressTracker, READINESS_WEIGHTS, REQUEST_TIMEOUT_MS, type ReadinessVitals, type RobotsFile, type RobotsGroup, type RobotsRule, SCANNER_USER_AGENT, SCAN_TIMEOUT_MS, SCORE_TIER_LABELS, type ScanConditions, ScanConditionsSchema, type ScanConfig, type ScanEvent, type ScanEvidence, type ScanOptions, type ScanReport, type ScanValidity, type ScoreDisplayMode, ScoreDisplayModeSchema, type ScoreTier, type SitemapEntry, type SitemapTree, TAG_SCAN_ERROR, TAG_SKIPPED_NO_EVIDENCE, TAG_SKIPPED_PAGE_TYPE, type UaProbe, type WafProtection, allEvidenceMet, allJsonLdNodes, boundedDispatcher, buildCategoryResult, buildScanEvidence, calculateCategoryScore, calculateOverallScore, classifyFetch, classifyResponse, collectPageCss, collectSitemapEntries, computeOriginCacheKey, createFetcher, defaultConfig, defaultOriginCache, defineConfig, detectPageType, detectWafProtection, evidenceUrl, extractDomain, extractForms, extractHeadLinks, extractHeadings, extractImages, extractInternalLinks, extractJsonLd, extractMarkdownLinks, extractMetaTags, extractNavLinks, extractProductFieldVerification, extractScripts, extractStylesheetUrls, filterConfig, flattenJsonLd, formatTrace, getMainContentText, getPreset, getRenderedText, getScoreTier, getTierColor, getTierLabel, getWordCount, groupsForBot, hasNamedGroup, isBlanketBlocked, isInformative, isPathAllowed, isPrivateIp, isRealFile, isSafeUrl, isW3CDateTime, joinUrl, judgePages, loadConfigFile, logger, matchesUserAgent, normalizeNewlines, normalizeUrl, outcomeOf, pagesOfType, parseCssRules, parseHtml, parseRobots, parseRobotsFile, planAudits, probeUaParity, resolvePolicyLinks, runAudits, runScan, sampleEntries, shouldBypassOriginCache, stripBom, topLevelJsonLd, traceFromCheck, weightForGrade };
|
|
1912
|
+
export { ACP_LINK_TYPES, AI_CRAWLER_UAS, AUDIT_ID_PATTERN, type AcpLinkType, type AgentLighthouseConfig, Audit, type AuditGuidance, AuditGuidanceSchema, type AuditMeta, AuditMetaSchema, type AuditPlan, type AuditProgressEvent, type AuditRegistration, type AuditResult, AuditResultSchema, type AuditRunResult, type AuditTier, AuditTierSchema, type AuditTrace, type AuditTraceHandler, BASELINE_UA, type BlockClass, CATEGORY_IDS, CATEGORY_MASS, CATEGORY_NAMES, type CategoryConfig, type CategoryResult, type CheckContext, type CheckFn, type CheckPriority, CheckPrioritySchema, type CheckRecommendation, type CheckResult, CheckResultSchema, type CheckStatus, CheckStatusSchema, type CssRule, DEFAULT_ORIGIN_CACHE_MAX_ENTRIES, DEFAULT_ORIGIN_CACHE_TTL_MS, DEFAULT_SCAN_LIMIT, type DeprecationNotice, DeprecationNoticeSchema, type EvidenceGrade, EvidenceGradeSchema, type EvidenceKey, EvidenceKeySchema, type ExpectedKind, type FetchClass, type FetchOptions, type FetchResult, type FetcherOptions, type FieldStatus, type FixEffort, FixEffortSchema, MAX_CONCURRENT_REQUESTS, MAX_PAGES_PER_SCAN, MAX_RESPONSE_BODY_BYTES, ORIGIN_EVIDENCE_VERSION, OriginCache, type OriginCacheOptions, type OriginEvidence, PAGE_TYPE_LABELS, PHASE_WEIGHTS, PRESETS, type PageContext, type PageCss, type PageJudgement, type PageOverride, type PageType, PageTypeSchema, type PhaseId, type PresetName, type PresetOptions, type ProductFieldVerification, ProgressTracker, READINESS_WEIGHTS, REQUEST_TIMEOUT_MS, type ReadinessVitals, type RobotsFile, type RobotsGroup, type RobotsRule, SCANNER_USER_AGENT, SCAN_TIMEOUT_MS, SCORE_TIER_LABELS, type ScanConditions, ScanConditionsSchema, type ScanConfig, type ScanEvent, type ScanEvidence, type ScanOptions, type ScanReport, type ScanValidity, type ScoreDisplayMode, ScoreDisplayModeSchema, type ScoreTier, type SitemapEntry, type SitemapTree, TAG_SCAN_ERROR, TAG_SKIPPED_NO_EVIDENCE, TAG_SKIPPED_PAGE_TYPE, TAG_SKIPPED_SCAN_BUDGET, type UaProbe, type WafProtection, allEvidenceMet, allJsonLdNodes, boundedDispatcher, budgetReason, buildCategoryResult, buildScanEvidence, calculateCategoryScore, calculateOverallScore, classifyFetch, classifyResponse, collectPageCss, collectSitemapEntries, computeOriginCacheKey, createFetcher, defaultConfig, defaultOriginCache, defineConfig, detectPageType, detectWafProtection, evidenceUrl, extractDomain, extractForms, extractHeadLinks, extractHeadings, extractImages, extractInternalLinks, extractJsonLd, extractMarkdownLinks, extractMetaTags, extractNavLinks, extractProductFieldVerification, extractScripts, extractStylesheetUrls, filterConfig, flattenJsonLd, formatBudget, formatTrace, getMainContentText, getPreset, getRenderedText, getScoreTier, getTierColor, getTierLabel, getWordCount, groupsForBot, hasNamedGroup, isBlanketBlocked, isInformative, isPathAllowed, isPrivateIp, isRealFile, isSafeUrl, isW3CDateTime, joinUrl, judgePages, loadConfigFile, logger, matchesUserAgent, normalizeNewlines, normalizeUrl, outcomeOf, pagesOfType, parseCssRules, parseHtml, parseRobots, parseRobotsFile, planAudits, probeUaParity, resolvePolicyLinks, runAudits, runScan, sampleEntries, shouldBypassOriginCache, skippedMassShare, stripBom, topLevelJsonLd, traceFromCheck, weightForGrade };
|
package/dist/index.d.ts
CHANGED
|
@@ -385,6 +385,14 @@ interface ScanConditions {
|
|
|
385
385
|
gatedCount: number;
|
|
386
386
|
reasons: Record<string, number>;
|
|
387
387
|
};
|
|
388
|
+
/** The wall-clock budget the scan ran under, and whether it ran out. */
|
|
389
|
+
budget?: {
|
|
390
|
+
limitMs: number;
|
|
391
|
+
elapsedMs: number;
|
|
392
|
+
exhausted: boolean;
|
|
393
|
+
/** Audits reported `na` because the budget ran out before they started. */
|
|
394
|
+
skippedCount: number;
|
|
395
|
+
};
|
|
388
396
|
}
|
|
389
397
|
interface ReadinessVitals {
|
|
390
398
|
commerce: number;
|
|
@@ -675,9 +683,10 @@ interface AuditTrace {
|
|
|
675
683
|
* `ran` — the audit executed and returned.
|
|
676
684
|
* `skipped` — no scanned page matched its `applicablePageTypes`.
|
|
677
685
|
* `gated` — the scan never obtained evidence the audit needs.
|
|
686
|
+
* `budget` — the scan's wall-clock budget ran out before it started.
|
|
678
687
|
* `error` — it threw, or its result was rejected by the schema.
|
|
679
688
|
*/
|
|
680
|
-
outcome: "ran" | "skipped" | "gated" | "error";
|
|
689
|
+
outcome: "ran" | "skipped" | "gated" | "budget" | "error";
|
|
681
690
|
status: CheckStatus;
|
|
682
691
|
score: number;
|
|
683
692
|
weight: number;
|
|
@@ -755,12 +764,23 @@ declare function planAudits(ctx: CheckContext, config: ScanConfig, options?: Pla
|
|
|
755
764
|
runnable: RunnableAudit[];
|
|
756
765
|
skipped: CheckResult[];
|
|
757
766
|
};
|
|
767
|
+
/** A budget as a sentence names it: whole seconds, or milliseconds under one. */
|
|
768
|
+
declare function formatBudget(ms: number): string;
|
|
769
|
+
/** What an aborted budget signal says, for the stub that names it. */
|
|
770
|
+
declare function budgetReason(signal: AbortSignal): string;
|
|
758
771
|
/**
|
|
759
772
|
* Execute all audits registered in the config against the scan context.
|
|
760
773
|
* Returns check results grouped into categories with weighted scores.
|
|
761
774
|
* Pass a precomputed `plan` (from {@link planAudits}) to avoid recomputing it.
|
|
775
|
+
*
|
|
776
|
+
* `budget` is the scan's wall-clock budget. Once it is aborted, no further
|
|
777
|
+
* audit is constructed, and none that was still running is believed: both
|
|
778
|
+
* report `na` tagged {@link TAG_SKIPPED_SCAN_BUDGET}. The running one is
|
|
779
|
+
* withheld because a request the budget refused answers with an error, and
|
|
780
|
+
* an audit reads that error as a broken link or a missing artifact. That
|
|
781
|
+
* would be a claim about the clock, not about the site.
|
|
762
782
|
*/
|
|
763
|
-
declare function runAudits(ctx: CheckContext, config: ScanConfig, onEvent?: (event: AuditProgressEvent) => void, plan?: AuditPlan, onTrace?: AuditTraceHandler): Promise<AuditRunResult>;
|
|
783
|
+
declare function runAudits(ctx: CheckContext, config: ScanConfig, onEvent?: (event: AuditProgressEvent) => void, plan?: AuditPlan, onTrace?: AuditTraceHandler, budget?: AbortSignal): Promise<AuditRunResult>;
|
|
764
784
|
|
|
765
785
|
type PhaseId = "fetch-root" | "fetch-pages" | "analyze" | "audits" | "report";
|
|
766
786
|
type ScanEvent = {
|
|
@@ -845,7 +865,20 @@ interface ScanOptions {
|
|
|
845
865
|
pages?: PageOverride[] | null;
|
|
846
866
|
/** Explicitly declared page type for the target URL. */
|
|
847
867
|
pageType?: PageType;
|
|
868
|
+
/**
|
|
869
|
+
* The caller's cancellation. Aborting it makes `runScan` throw; the scan
|
|
870
|
+
* budget below never does.
|
|
871
|
+
*/
|
|
848
872
|
signal?: AbortSignal;
|
|
873
|
+
/**
|
|
874
|
+
* Wall-clock budget for the whole scan, in milliseconds. Defaults to
|
|
875
|
+
* {@link SCAN_TIMEOUT_MS}. When it runs out the scan finishes with what it
|
|
876
|
+
* has: requests in flight abort, no further request is sent, and every
|
|
877
|
+
* audit not yet started, or still running when it went, reports `na`
|
|
878
|
+
* tagged `skipped:scan-budget`. `conditions.budget` on the report records
|
|
879
|
+
* it. `0` disables the budget.
|
|
880
|
+
*/
|
|
881
|
+
timeoutMs?: number;
|
|
849
882
|
/**
|
|
850
883
|
* Restrict the scan to these category ids. Unknown ids simply match nothing —
|
|
851
884
|
* validate them at the entry point so the operator hears about a typo.
|
|
@@ -1287,7 +1320,14 @@ declare const DEFAULT_ORIGIN_CACHE_TTL_MS: number;
|
|
|
1287
1320
|
*/
|
|
1288
1321
|
declare const DEFAULT_ORIGIN_CACHE_MAX_ENTRIES = 256;
|
|
1289
1322
|
declare const REQUEST_TIMEOUT_MS = 10000;
|
|
1290
|
-
|
|
1323
|
+
/**
|
|
1324
|
+
* Wall-clock budget for one scan. When it runs out, requests in flight are
|
|
1325
|
+
* aborted, no further request is sent, and every audit not yet started is
|
|
1326
|
+
* reported `na` tagged `skipped:scan-budget`. 180 s clears the 95th
|
|
1327
|
+
* percentile of the curated corpus (109 s on 2026-09-02) with margin; the
|
|
1328
|
+
* scans it cuts ran 5 to 17 minutes.
|
|
1329
|
+
*/
|
|
1330
|
+
declare const SCAN_TIMEOUT_MS = 180000;
|
|
1291
1331
|
declare const MAX_RESPONSE_BODY_BYTES: number;
|
|
1292
1332
|
/** @deprecated Unused internally; retained for published API stability. Scheduled for removal in v4. */
|
|
1293
1333
|
declare const MAX_CONCURRENT_REQUESTS = 10;
|
|
@@ -1296,6 +1336,8 @@ declare const TAG_SKIPPED_PAGE_TYPE = "skipped:page-type";
|
|
|
1296
1336
|
declare const TAG_SCAN_ERROR = "scan-error";
|
|
1297
1337
|
/** An audit the scan could not feed: it needs evidence this scan never got. */
|
|
1298
1338
|
declare const TAG_SKIPPED_NO_EVIDENCE = "skipped:no-evidence";
|
|
1339
|
+
/** An audit the scan never started: its wall-clock budget ran out first. */
|
|
1340
|
+
declare const TAG_SKIPPED_SCAN_BUDGET = "skipped:scan-budget";
|
|
1299
1341
|
/** Display names for the 8 v2 categories. */
|
|
1300
1342
|
declare const CATEGORY_NAMES: Record<string, string>;
|
|
1301
1343
|
declare const READINESS_WEIGHTS: {
|
|
@@ -1335,6 +1377,12 @@ declare function calculateCategoryScore(checks: CheckResult[]): number;
|
|
|
1335
1377
|
*/
|
|
1336
1378
|
declare function buildCategoryResult(id: string, checks: CheckResult[], mass?: number): CategoryResult;
|
|
1337
1379
|
declare function calculateOverallScore(categories: CategoryResult[]): number;
|
|
1380
|
+
/**
|
|
1381
|
+
* How much of the registry's evidence mass the checks carrying `tag` hold.
|
|
1382
|
+
* The gate and the scan budget both stub audits as `na` under their own
|
|
1383
|
+
* tag, and each is judged against {@link GATED_MASS_UNSCORED_THRESHOLD}.
|
|
1384
|
+
*/
|
|
1385
|
+
declare function skippedMassShare(checks: CheckResult[], tag: string): number;
|
|
1338
1386
|
|
|
1339
1387
|
/**
|
|
1340
1388
|
* Read product fields straight from the scanned product page(s)' structured
|
|
@@ -1716,6 +1764,22 @@ declare const ScanConditionsSchema: z.ZodObject<{
|
|
|
1716
1764
|
informativeCount: number;
|
|
1717
1765
|
gatedCount: number;
|
|
1718
1766
|
}>;
|
|
1767
|
+
budget: z.ZodOptional<z.ZodObject<{
|
|
1768
|
+
limitMs: z.ZodNumber;
|
|
1769
|
+
elapsedMs: z.ZodNumber;
|
|
1770
|
+
exhausted: z.ZodBoolean;
|
|
1771
|
+
skippedCount: z.ZodNumber;
|
|
1772
|
+
}, "strip", z.ZodTypeAny, {
|
|
1773
|
+
limitMs: number;
|
|
1774
|
+
elapsedMs: number;
|
|
1775
|
+
exhausted: boolean;
|
|
1776
|
+
skippedCount: number;
|
|
1777
|
+
}, {
|
|
1778
|
+
limitMs: number;
|
|
1779
|
+
elapsedMs: number;
|
|
1780
|
+
exhausted: boolean;
|
|
1781
|
+
skippedCount: number;
|
|
1782
|
+
}>>;
|
|
1719
1783
|
}, "strip", z.ZodTypeAny, {
|
|
1720
1784
|
url: string;
|
|
1721
1785
|
origin: {
|
|
@@ -1741,6 +1805,12 @@ declare const ScanConditionsSchema: z.ZodObject<{
|
|
|
1741
1805
|
informativeCount: number;
|
|
1742
1806
|
gatedCount: number;
|
|
1743
1807
|
};
|
|
1808
|
+
budget?: {
|
|
1809
|
+
limitMs: number;
|
|
1810
|
+
elapsedMs: number;
|
|
1811
|
+
exhausted: boolean;
|
|
1812
|
+
skippedCount: number;
|
|
1813
|
+
} | undefined;
|
|
1744
1814
|
}, {
|
|
1745
1815
|
url: string;
|
|
1746
1816
|
origin: {
|
|
@@ -1766,6 +1836,12 @@ declare const ScanConditionsSchema: z.ZodObject<{
|
|
|
1766
1836
|
informativeCount: number;
|
|
1767
1837
|
gatedCount: number;
|
|
1768
1838
|
};
|
|
1839
|
+
budget?: {
|
|
1840
|
+
limitMs: number;
|
|
1841
|
+
elapsedMs: number;
|
|
1842
|
+
exhausted: boolean;
|
|
1843
|
+
skippedCount: number;
|
|
1844
|
+
} | undefined;
|
|
1769
1845
|
}>;
|
|
1770
1846
|
|
|
1771
1847
|
declare function normalizeUrl(input: string): string;
|
|
@@ -1801,6 +1877,8 @@ interface AgentLighthouseConfig {
|
|
|
1801
1877
|
outputDir?: string;
|
|
1802
1878
|
/** Maximum number of pages to discover & scan */
|
|
1803
1879
|
maxPages?: number;
|
|
1880
|
+
/** Scan budget in seconds; 0 disables it. The flag `--timeout` overrides it. */
|
|
1881
|
+
timeout?: number;
|
|
1804
1882
|
}
|
|
1805
1883
|
/** Helper function for type-safe configuration files */
|
|
1806
1884
|
declare function defineConfig(config: AgentLighthouseConfig): AgentLighthouseConfig;
|
|
@@ -1831,4 +1909,4 @@ type AcpLinkType = (typeof ACP_LINK_TYPES)[number];
|
|
|
1831
1909
|
*/
|
|
1832
1910
|
declare function resolvePolicyLinks(ctx: CheckContext): Map<AcpLinkType, string>;
|
|
1833
1911
|
|
|
1834
|
-
export { ACP_LINK_TYPES, AI_CRAWLER_UAS, AUDIT_ID_PATTERN, type AcpLinkType, type AgentLighthouseConfig, Audit, type AuditGuidance, AuditGuidanceSchema, type AuditMeta, AuditMetaSchema, type AuditPlan, type AuditProgressEvent, type AuditRegistration, type AuditResult, AuditResultSchema, type AuditRunResult, type AuditTier, AuditTierSchema, type AuditTrace, type AuditTraceHandler, BASELINE_UA, type BlockClass, CATEGORY_IDS, CATEGORY_MASS, CATEGORY_NAMES, type CategoryConfig, type CategoryResult, type CheckContext, type CheckFn, type CheckPriority, CheckPrioritySchema, type CheckRecommendation, type CheckResult, CheckResultSchema, type CheckStatus, CheckStatusSchema, type CssRule, DEFAULT_ORIGIN_CACHE_MAX_ENTRIES, DEFAULT_ORIGIN_CACHE_TTL_MS, DEFAULT_SCAN_LIMIT, type DeprecationNotice, DeprecationNoticeSchema, type EvidenceGrade, EvidenceGradeSchema, type EvidenceKey, EvidenceKeySchema, type ExpectedKind, type FetchClass, type FetchOptions, type FetchResult, type FetcherOptions, type FieldStatus, type FixEffort, FixEffortSchema, MAX_CONCURRENT_REQUESTS, MAX_PAGES_PER_SCAN, MAX_RESPONSE_BODY_BYTES, ORIGIN_EVIDENCE_VERSION, OriginCache, type OriginCacheOptions, type OriginEvidence, PAGE_TYPE_LABELS, PHASE_WEIGHTS, PRESETS, type PageContext, type PageCss, type PageJudgement, type PageOverride, type PageType, PageTypeSchema, type PhaseId, type PresetName, type PresetOptions, type ProductFieldVerification, ProgressTracker, READINESS_WEIGHTS, REQUEST_TIMEOUT_MS, type ReadinessVitals, type RobotsFile, type RobotsGroup, type RobotsRule, SCANNER_USER_AGENT, SCAN_TIMEOUT_MS, SCORE_TIER_LABELS, type ScanConditions, ScanConditionsSchema, type ScanConfig, type ScanEvent, type ScanEvidence, type ScanOptions, type ScanReport, type ScanValidity, type ScoreDisplayMode, ScoreDisplayModeSchema, type ScoreTier, type SitemapEntry, type SitemapTree, TAG_SCAN_ERROR, TAG_SKIPPED_NO_EVIDENCE, TAG_SKIPPED_PAGE_TYPE, type UaProbe, type WafProtection, allEvidenceMet, allJsonLdNodes, boundedDispatcher, buildCategoryResult, buildScanEvidence, calculateCategoryScore, calculateOverallScore, classifyFetch, classifyResponse, collectPageCss, collectSitemapEntries, computeOriginCacheKey, createFetcher, defaultConfig, defaultOriginCache, defineConfig, detectPageType, detectWafProtection, evidenceUrl, extractDomain, extractForms, extractHeadLinks, extractHeadings, extractImages, extractInternalLinks, extractJsonLd, extractMarkdownLinks, extractMetaTags, extractNavLinks, extractProductFieldVerification, extractScripts, extractStylesheetUrls, filterConfig, flattenJsonLd, formatTrace, getMainContentText, getPreset, getRenderedText, getScoreTier, getTierColor, getTierLabel, getWordCount, groupsForBot, hasNamedGroup, isBlanketBlocked, isInformative, isPathAllowed, isPrivateIp, isRealFile, isSafeUrl, isW3CDateTime, joinUrl, judgePages, loadConfigFile, logger, matchesUserAgent, normalizeNewlines, normalizeUrl, outcomeOf, pagesOfType, parseCssRules, parseHtml, parseRobots, parseRobotsFile, planAudits, probeUaParity, resolvePolicyLinks, runAudits, runScan, sampleEntries, shouldBypassOriginCache, stripBom, topLevelJsonLd, traceFromCheck, weightForGrade };
|
|
1912
|
+
export { ACP_LINK_TYPES, AI_CRAWLER_UAS, AUDIT_ID_PATTERN, type AcpLinkType, type AgentLighthouseConfig, Audit, type AuditGuidance, AuditGuidanceSchema, type AuditMeta, AuditMetaSchema, type AuditPlan, type AuditProgressEvent, type AuditRegistration, type AuditResult, AuditResultSchema, type AuditRunResult, type AuditTier, AuditTierSchema, type AuditTrace, type AuditTraceHandler, BASELINE_UA, type BlockClass, CATEGORY_IDS, CATEGORY_MASS, CATEGORY_NAMES, type CategoryConfig, type CategoryResult, type CheckContext, type CheckFn, type CheckPriority, CheckPrioritySchema, type CheckRecommendation, type CheckResult, CheckResultSchema, type CheckStatus, CheckStatusSchema, type CssRule, DEFAULT_ORIGIN_CACHE_MAX_ENTRIES, DEFAULT_ORIGIN_CACHE_TTL_MS, DEFAULT_SCAN_LIMIT, type DeprecationNotice, DeprecationNoticeSchema, type EvidenceGrade, EvidenceGradeSchema, type EvidenceKey, EvidenceKeySchema, type ExpectedKind, type FetchClass, type FetchOptions, type FetchResult, type FetcherOptions, type FieldStatus, type FixEffort, FixEffortSchema, MAX_CONCURRENT_REQUESTS, MAX_PAGES_PER_SCAN, MAX_RESPONSE_BODY_BYTES, ORIGIN_EVIDENCE_VERSION, OriginCache, type OriginCacheOptions, type OriginEvidence, PAGE_TYPE_LABELS, PHASE_WEIGHTS, PRESETS, type PageContext, type PageCss, type PageJudgement, type PageOverride, type PageType, PageTypeSchema, type PhaseId, type PresetName, type PresetOptions, type ProductFieldVerification, ProgressTracker, READINESS_WEIGHTS, REQUEST_TIMEOUT_MS, type ReadinessVitals, type RobotsFile, type RobotsGroup, type RobotsRule, SCANNER_USER_AGENT, SCAN_TIMEOUT_MS, SCORE_TIER_LABELS, type ScanConditions, ScanConditionsSchema, type ScanConfig, type ScanEvent, type ScanEvidence, type ScanOptions, type ScanReport, type ScanValidity, type ScoreDisplayMode, ScoreDisplayModeSchema, type ScoreTier, type SitemapEntry, type SitemapTree, TAG_SCAN_ERROR, TAG_SKIPPED_NO_EVIDENCE, TAG_SKIPPED_PAGE_TYPE, TAG_SKIPPED_SCAN_BUDGET, type UaProbe, type WafProtection, allEvidenceMet, allJsonLdNodes, boundedDispatcher, budgetReason, buildCategoryResult, buildScanEvidence, calculateCategoryScore, calculateOverallScore, classifyFetch, classifyResponse, collectPageCss, collectSitemapEntries, computeOriginCacheKey, createFetcher, defaultConfig, defaultOriginCache, defineConfig, detectPageType, detectWafProtection, evidenceUrl, extractDomain, extractForms, extractHeadLinks, extractHeadings, extractImages, extractInternalLinks, extractJsonLd, extractMarkdownLinks, extractMetaTags, extractNavLinks, extractProductFieldVerification, extractScripts, extractStylesheetUrls, filterConfig, flattenJsonLd, formatBudget, formatTrace, getMainContentText, getPreset, getRenderedText, getScoreTier, getTierColor, getTierLabel, getWordCount, groupsForBot, hasNamedGroup, isBlanketBlocked, isInformative, isPathAllowed, isPrivateIp, isRealFile, isSafeUrl, isW3CDateTime, joinUrl, judgePages, loadConfigFile, logger, matchesUserAgent, normalizeNewlines, normalizeUrl, outcomeOf, pagesOfType, parseCssRules, parseHtml, parseRobots, parseRobotsFile, planAudits, probeUaParity, resolvePolicyLinks, runAudits, runScan, sampleEntries, shouldBypassOriginCache, skippedMassShare, stripBom, topLevelJsonLd, traceFromCheck, weightForGrade };
|