@kya-os/checkpoint-shared 1.3.1 → 1.5.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/CHANGELOG.md +127 -2
- package/dist/beacon-types/index.d.mts +441 -432
- package/dist/beacon-types/index.d.mts.map +1 -0
- package/dist/beacon-types/index.d.ts +441 -432
- package/dist/beacon-types/index.d.ts.map +1 -0
- package/dist/beacon-types/index.js +198 -182
- package/dist/beacon-types/index.mjs +197 -179
- package/dist/beacon-types/index.mjs.map +1 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.mts +5 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.mts.map +1 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.ts +5 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.ts.map +1 -0
- package/dist/browser-posture-cookie.d.mts +2 -0
- package/dist/browser-posture-cookie.d.ts +2 -0
- package/dist/browser-posture-cookie.js +1 -0
- package/dist/browser-posture-cookie.mjs +2 -0
- package/dist/browser-posture-cookie.mjs.map +1 -0
- package/dist/browser-posture-report.d.mts +50 -82
- package/dist/browser-posture-report.d.mts.map +1 -0
- package/dist/browser-posture-report.d.ts +50 -82
- package/dist/browser-posture-report.d.ts.map +1 -0
- package/dist/browser-posture-report.js +1 -1
- package/dist/browser-posture-report.mjs +2 -1
- package/dist/browser-posture-report.mjs.map +1 -0
- package/dist/browser-posture.d.mts +80 -111
- package/dist/browser-posture.d.mts.map +1 -0
- package/dist/browser-posture.d.ts +80 -111
- package/dist/browser-posture.d.ts.map +1 -0
- package/dist/browser-posture.js +143 -4164
- package/dist/browser-posture.mjs +142 -4161
- package/dist/browser-posture.mjs.map +1 -0
- package/dist/browser.d.mts +323 -316
- package/dist/browser.d.mts.map +1 -0
- package/dist/browser.d.ts +323 -316
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +2 -1
- package/dist/browser.mjs.map +1 -0
- package/dist/canonical-signer/index.d.mts +38 -33
- package/dist/canonical-signer/index.d.mts.map +1 -0
- package/dist/canonical-signer/index.d.ts +38 -33
- package/dist/canonical-signer/index.d.ts.map +1 -0
- package/dist/canonical-signer/index.js +411 -181
- package/dist/canonical-signer/index.mjs +383 -175
- package/dist/canonical-signer/index.mjs.map +1 -0
- package/dist/clearance.d.mts +30 -0
- package/dist/clearance.d.mts.map +1 -0
- package/dist/clearance.d.ts +30 -0
- package/dist/clearance.d.ts.map +1 -0
- package/dist/clearance.js +120 -0
- package/dist/clearance.mjs +112 -0
- package/dist/clearance.mjs.map +1 -0
- package/dist/client-ip-1y2iXAYW.js +237 -0
- package/dist/client-ip-HOfe6ucV.mjs +215 -0
- package/dist/client-ip-HOfe6ucV.mjs.map +1 -0
- package/dist/deploy/index.d.mts +375 -810
- package/dist/deploy/index.d.mts.map +1 -0
- package/dist/deploy/index.d.ts +375 -810
- package/dist/deploy/index.d.ts.map +1 -0
- package/dist/deploy/index.js +505 -413
- package/dist/deploy/index.mjs +504 -410
- package/dist/deploy/index.mjs.map +1 -0
- package/dist/errors/index.d.mts +101 -101
- package/dist/errors/index.d.mts.map +1 -0
- package/dist/errors/index.d.ts +101 -101
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +341 -314
- package/dist/errors/index.mjs +340 -311
- package/dist/errors/index.mjs.map +1 -0
- package/dist/external-jr_S4iSS.d.mts +4187 -0
- package/dist/external-jr_S4iSS.d.mts.map +1 -0
- package/dist/external-jr_S4iSS.d.ts +4187 -0
- package/dist/external-jr_S4iSS.d.ts.map +1 -0
- package/dist/gateway/index.d.mts +154 -550
- package/dist/gateway/index.d.mts.map +1 -0
- package/dist/gateway/index.d.ts +154 -550
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/index.js +117 -81
- package/dist/gateway/index.mjs +116 -78
- package/dist/gateway/index.mjs.map +1 -0
- package/dist/gateway-client-ip.d.mts +59 -0
- package/dist/gateway-client-ip.d.mts.map +1 -0
- package/dist/gateway-client-ip.d.ts +59 -0
- package/dist/gateway-client-ip.d.ts.map +1 -0
- package/dist/gateway-client-ip.js +149 -0
- package/dist/gateway-client-ip.mjs +139 -0
- package/dist/gateway-client-ip.mjs.map +1 -0
- package/dist/index.d.mts +15523 -38968
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +15523 -38968
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14950 -16029
- package/dist/index.mjs +14846 -15955
- package/dist/index.mjs.map +1 -0
- package/dist/mcpi/agentshield-api/index.d.mts +45 -44
- package/dist/mcpi/agentshield-api/index.d.mts.map +1 -0
- package/dist/mcpi/agentshield-api/index.d.ts +45 -44
- package/dist/mcpi/agentshield-api/index.d.ts.map +1 -0
- package/dist/mcpi/agentshield-api/index.js +0 -2
- package/dist/mcpi/agentshield-api/index.mjs +1 -1
- package/dist/mcpi/approval-grant/index.d.mts +63 -61
- package/dist/mcpi/approval-grant/index.d.mts.map +1 -0
- package/dist/mcpi/approval-grant/index.d.ts +63 -61
- package/dist/mcpi/approval-grant/index.d.ts.map +1 -0
- package/dist/mcpi/approval-grant/index.js +220 -140
- package/dist/mcpi/approval-grant/index.mjs +219 -137
- package/dist/mcpi/approval-grant/index.mjs.map +1 -0
- package/dist/mcpi/dashboard-config/index.d.mts +2395 -13915
- package/dist/mcpi/dashboard-config/index.d.mts.map +1 -0
- package/dist/mcpi/dashboard-config/index.d.ts +2395 -13915
- package/dist/mcpi/dashboard-config/index.d.ts.map +1 -0
- package/dist/mcpi/dashboard-config/index.js +605 -458
- package/dist/mcpi/dashboard-config/index.mjs +604 -455
- package/dist/mcpi/dashboard-config/index.mjs.map +1 -0
- package/dist/mcpi/multibase-ed25519.d.mts +10 -8
- package/dist/mcpi/multibase-ed25519.d.mts.map +1 -0
- package/dist/mcpi/multibase-ed25519.d.ts +10 -8
- package/dist/mcpi/multibase-ed25519.d.ts.map +1 -0
- package/dist/mcpi/multibase-ed25519.js +182 -106
- package/dist/mcpi/multibase-ed25519.mjs +181 -103
- package/dist/mcpi/multibase-ed25519.mjs.map +1 -0
- package/dist/patterns-CkRVOdtV.js +243 -0
- package/dist/patterns-DzkGy_qk.mjs +173 -0
- package/dist/patterns-DzkGy_qk.mjs.map +1 -0
- package/dist/project-verification-key-C3L5rd8a.js +41 -0
- package/dist/project-verification-key-CgSVX9_m.mjs +37 -0
- package/dist/project-verification-key-CgSVX9_m.mjs.map +1 -0
- package/dist/rolldown-runtime-iY2fYEqi.mjs +19 -0
- package/dist/schemas-BmjNLAE7.js +5677 -0
- package/dist/schemas-DxY-dk9y.mjs +5511 -0
- package/dist/schemas-DxY-dk9y.mjs.map +1 -0
- package/dist/signals/index.d.mts +125 -115
- package/dist/signals/index.d.mts.map +1 -0
- package/dist/signals/index.d.ts +125 -115
- package/dist/signals/index.d.ts.map +1 -0
- package/dist/signals/index.js +1693 -1536
- package/dist/signals/index.mjs +1692 -1533
- package/dist/signals/index.mjs.map +1 -0
- package/dist/test-fixtures/index.d.mts +124 -119
- package/dist/test-fixtures/index.d.mts.map +1 -0
- package/dist/test-fixtures/index.d.ts +124 -119
- package/dist/test-fixtures/index.d.ts.map +1 -0
- package/dist/test-fixtures/index.js +460 -228
- package/dist/test-fixtures/index.mjs +459 -225
- package/dist/test-fixtures/index.mjs.map +1 -0
- package/dist/tool-protection/index.d.mts +368 -1067
- package/dist/tool-protection/index.d.mts.map +1 -0
- package/dist/tool-protection/index.d.ts +368 -1067
- package/dist/tool-protection/index.d.ts.map +1 -0
- package/dist/tool-protection/index.js +366 -285
- package/dist/tool-protection/index.mjs +365 -282
- package/dist/tool-protection/index.mjs.map +1 -0
- package/fixtures/bot-signal-resolution.json +142 -0
- package/fixtures/browser-posture-claims.json +421 -0
- package/fixtures/browser-posture-headers.json +46 -0
- package/fixtures/detection/reason-codes.json +10 -1
- package/fixtures/kya-http/challenge.delegation.fetcher-200.json +9 -3
- package/fixtures/kya-http/challenge.delegation.full.json +9 -3
- package/fixtures/kya-http/challenge.delegation.minimal.json +9 -3
- package/fixtures/kya-http/error-codes.json +7 -2
- package/package.json +21 -7
package/dist/browser.d.ts
CHANGED
|
@@ -1,353 +1,360 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/utils/client-ip.d.ts
|
|
2
|
+
export type ClientIpSource = 'explicit' | 'cf-connecting-ip' | 'x-vercel-forwarded-for' | 'x-forwarded-for' | 'x-real-ip' | 'framework' | 'socket' | 'none';
|
|
3
|
+
export interface ClientIpResolution {
|
|
4
|
+
ip: string | null;
|
|
5
|
+
source: ClientIpSource;
|
|
6
|
+
trusted: boolean;
|
|
6
7
|
}
|
|
7
|
-
type ClientIpTrustPolicy = {
|
|
8
|
-
|
|
8
|
+
export type ClientIpTrustPolicy = {
|
|
9
|
+
platform: 'vercel';
|
|
9
10
|
} | {
|
|
10
|
-
|
|
11
|
+
platform: 'cloudflare';
|
|
11
12
|
} | {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
platform: 'trusted-proxy';
|
|
14
|
+
trustedHops: number;
|
|
14
15
|
} | {
|
|
15
|
-
|
|
16
|
+
platform: 'direct';
|
|
16
17
|
};
|
|
17
|
-
type ClientIpHeaderValue = string | readonly string[] | undefined;
|
|
18
|
-
type ClientIpHeaders = Headers | Record<string, ClientIpHeaderValue>;
|
|
19
|
-
interface ResolveClientIpInput {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
export type ClientIpHeaderValue = string | readonly string[] | undefined;
|
|
19
|
+
export type ClientIpHeaders = Headers | Record<string, ClientIpHeaderValue>;
|
|
20
|
+
export interface ResolveClientIpInput {
|
|
21
|
+
headers: ClientIpHeaders;
|
|
22
|
+
directAddress?: string | null;
|
|
23
|
+
frameworkAddress?: string | null;
|
|
24
|
+
explicitAddress?: string | null;
|
|
25
|
+
explicitAddressTrusted?: boolean;
|
|
26
|
+
policy: ClientIpTrustPolicy;
|
|
26
27
|
}
|
|
27
|
-
declare function
|
|
28
|
-
declare function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
export declare function parseIpv6(value: string): number[] | null;
|
|
29
|
+
export declare function compressIpv6(groups: number[]): string;
|
|
30
|
+
export declare function normalizeClientIp(raw: string | null | undefined): string | null;
|
|
31
|
+
export declare function resolveClientIp(input: ResolveClientIpInput): ClientIpResolution;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/browser.d.ts
|
|
34
|
+
export interface BrowserDetectionResult {
|
|
35
|
+
category: AgentCategory;
|
|
36
|
+
confidence: ConfidenceLevel;
|
|
37
|
+
agent?: AgentInfo;
|
|
34
38
|
}
|
|
35
|
-
|
|
36
|
-
type
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
company?: string;
|
|
39
|
+
export type AgentCategory = 'human' | 'bot' | 'agent';
|
|
40
|
+
export type ConfidenceLevel = 'low' | 'medium' | 'high' | 'very_high';
|
|
41
|
+
export interface AgentInfo {
|
|
42
|
+
name: string;
|
|
43
|
+
version?: string;
|
|
44
|
+
url?: string;
|
|
45
|
+
company?: string;
|
|
43
46
|
}
|
|
44
|
-
type BeaconEventType = 'pageview' | 'pageunload' | 'heartbeat' | 'custom' | 'error' | 'performance';
|
|
45
|
-
interface BeaconEvent {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
export type BeaconEventType = 'pageview' | 'pageunload' | 'heartbeat' | 'custom' | 'error' | 'performance';
|
|
48
|
+
export interface BeaconEvent {
|
|
49
|
+
type: BeaconEventType;
|
|
50
|
+
data: BeaconCollectorData;
|
|
51
|
+
metadata: BeaconMetadata;
|
|
49
52
|
}
|
|
50
|
-
interface BeaconMetadata {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
export interface BeaconMetadata {
|
|
54
|
+
sessionId: string;
|
|
55
|
+
timestamp: number;
|
|
56
|
+
eventName?: string;
|
|
57
|
+
[key: string]: unknown;
|
|
55
58
|
}
|
|
56
|
-
interface BeaconCollectorData {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
export interface BeaconCollectorData {
|
|
60
|
+
userAgent?: string;
|
|
61
|
+
language?: string;
|
|
62
|
+
platform?: string;
|
|
63
|
+
screenResolution?: string;
|
|
64
|
+
viewport?: string;
|
|
65
|
+
cookiesEnabled?: boolean;
|
|
66
|
+
doNotTrack?: boolean;
|
|
67
|
+
timezone?: string;
|
|
68
|
+
referrer?: string;
|
|
69
|
+
url?: string;
|
|
70
|
+
title?: string;
|
|
71
|
+
vendor?: string;
|
|
72
|
+
pageLoadTime?: number;
|
|
73
|
+
domContentLoadedTime?: number;
|
|
74
|
+
firstPaintTime?: number;
|
|
75
|
+
firstContentfulPaintTime?: number;
|
|
76
|
+
connectionType?: string;
|
|
77
|
+
sessionId?: string;
|
|
78
|
+
timestamp?: number;
|
|
79
|
+
[key: string]: unknown;
|
|
77
80
|
}
|
|
78
|
-
interface BeaconBatch {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
export interface BeaconBatch {
|
|
82
|
+
projectId: string;
|
|
83
|
+
events: BeaconEvent[];
|
|
84
|
+
sessionId: string;
|
|
85
|
+
batchId: string;
|
|
86
|
+
timestamp: number;
|
|
87
|
+
anonymizeIp?: boolean;
|
|
88
|
+
nonce?: string;
|
|
89
|
+
nonceEcho?: boolean;
|
|
84
90
|
}
|
|
85
|
-
interface BatchEvent {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
export interface BatchEvent {
|
|
92
|
+
id: string;
|
|
93
|
+
event: BeaconEvent;
|
|
94
|
+
timestamp: number;
|
|
95
|
+
retryCount: number;
|
|
96
|
+
hash: string;
|
|
97
|
+
priority: 'low' | 'normal' | 'high' | 'critical';
|
|
92
98
|
}
|
|
93
|
-
interface BeaconIdentity {
|
|
94
|
-
|
|
99
|
+
export interface BeaconIdentity {
|
|
100
|
+
userId: string;
|
|
95
101
|
}
|
|
96
|
-
interface BeaconConfig {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
102
|
+
export interface BeaconConfig {
|
|
103
|
+
projectId: string;
|
|
104
|
+
environment?: 'development' | 'staging' | 'production' | string;
|
|
105
|
+
tags?: Record<string, string | number | boolean>;
|
|
106
|
+
identity?: BeaconIdentity;
|
|
107
|
+
endpoint?: string;
|
|
108
|
+
enabled?: boolean;
|
|
109
|
+
debug?: boolean;
|
|
110
|
+
logLevel?: 'error' | 'warn' | 'info' | 'debug';
|
|
111
|
+
respectDoNotTrack?: boolean;
|
|
112
|
+
anonymizeIp?: boolean;
|
|
113
|
+
sessionTimeout?: number;
|
|
114
|
+
sessionCookieName?: string;
|
|
115
|
+
batchSize?: number;
|
|
116
|
+
flushInterval?: number;
|
|
117
|
+
maxQueueSize?: number;
|
|
118
|
+
retryAttempts?: number;
|
|
119
|
+
retryDelay?: number;
|
|
120
|
+
useWorker?: boolean;
|
|
121
|
+
workerUrl?: string;
|
|
122
|
+
workerConfig?: WorkerConfig;
|
|
117
123
|
}
|
|
118
|
-
interface TransportConfig {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
export interface TransportConfig {
|
|
125
|
+
batchSize: number;
|
|
126
|
+
flushInterval: number;
|
|
127
|
+
maxRetries: number;
|
|
128
|
+
retryDelayBase: number;
|
|
129
|
+
offlineQueueSize: number;
|
|
130
|
+
useCompression: boolean;
|
|
131
|
+
compressionThreshold: number;
|
|
132
|
+
networkAdaptation: boolean;
|
|
133
|
+
dedupWindow: number;
|
|
128
134
|
}
|
|
129
|
-
interface WorkerConfig {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
135
|
+
export interface WorkerConfig {
|
|
136
|
+
enabled?: boolean;
|
|
137
|
+
url?: string;
|
|
138
|
+
heartbeatInterval?: number;
|
|
139
|
+
maxUnhealthyCount?: number;
|
|
140
|
+
maxRetries?: number;
|
|
141
|
+
retryDelay?: number;
|
|
142
|
+
restartDelay?: number;
|
|
143
|
+
messageTimeout?: number;
|
|
144
|
+
compressionThreshold?: number;
|
|
145
|
+
allowFallback?: boolean;
|
|
146
|
+
crossOriginIsolated?: boolean;
|
|
147
|
+
maxRestartAttempts?: number;
|
|
148
|
+
terminationTimeout?: number;
|
|
149
|
+
taskTimeout?: number;
|
|
150
|
+
fallbackDelay?: number;
|
|
151
|
+
enableFallback?: boolean;
|
|
146
152
|
}
|
|
147
|
-
interface TransportOptions {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
export interface TransportOptions {
|
|
154
|
+
immediate?: boolean;
|
|
155
|
+
priority?: 'low' | 'normal' | 'high' | 'critical';
|
|
156
|
+
retry?: boolean;
|
|
157
|
+
timeout?: number;
|
|
152
158
|
}
|
|
153
|
-
interface TransportResponse {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
export interface TransportResponse {
|
|
160
|
+
success: boolean;
|
|
161
|
+
timestamp: number;
|
|
162
|
+
batchId?: string;
|
|
163
|
+
error?: string;
|
|
158
164
|
}
|
|
159
|
-
type TransportState = 'idle' | 'sending' | 'offline' | 'paused' | 'error';
|
|
160
|
-
interface TransportMetrics {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
export type TransportState = 'idle' | 'sending' | 'offline' | 'paused' | 'error';
|
|
166
|
+
export interface TransportMetrics {
|
|
167
|
+
eventsSent: number;
|
|
168
|
+
eventsFailed: number;
|
|
169
|
+
eventsQueued: number;
|
|
170
|
+
batchesSent: number;
|
|
171
|
+
batchesFailed: number;
|
|
172
|
+
bytesTransferred: number;
|
|
173
|
+
compressionRatio?: number;
|
|
174
|
+
averageLatency?: number;
|
|
175
|
+
lastSuccessTimestamp?: number;
|
|
176
|
+
lastErrorTimestamp?: number;
|
|
171
177
|
}
|
|
172
|
-
type ConnectionType = 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
|
|
173
|
-
interface NetworkInfo {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
178
|
+
export type ConnectionType = 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
|
|
179
|
+
export interface NetworkInfo {
|
|
180
|
+
type?: string;
|
|
181
|
+
effectiveType?: string;
|
|
182
|
+
downlink?: number;
|
|
183
|
+
rtt?: number;
|
|
184
|
+
saveData?: boolean;
|
|
179
185
|
}
|
|
180
|
-
type MessagePriority = 'low' | 'normal' | 'high' | 'critical';
|
|
181
|
-
type WorkerErrorType = 'initialization' | 'runtime' | 'communication' | 'timeout' | 'memory' | 'unknown';
|
|
182
|
-
type WorkerAction = 'process' | 'init' | 'terminate' | 'pause' | 'resume' | 'status' | 'health';
|
|
183
|
-
type WorkerMessageType = 'request' | 'response' | 'error' | 'heartbeat' | 'status';
|
|
184
|
-
interface WorkerMessage {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
186
|
+
export type MessagePriority = 'low' | 'normal' | 'high' | 'critical';
|
|
187
|
+
export type WorkerErrorType = 'initialization' | 'runtime' | 'communication' | 'timeout' | 'memory' | 'unknown';
|
|
188
|
+
export type WorkerAction = 'process' | 'init' | 'terminate' | 'pause' | 'resume' | 'status' | 'health';
|
|
189
|
+
export type WorkerMessageType = 'request' | 'response' | 'error' | 'heartbeat' | 'status';
|
|
190
|
+
export interface WorkerMessage {
|
|
191
|
+
id: string;
|
|
192
|
+
type: 'request' | 'response' | 'error' | 'heartbeat' | 'status';
|
|
193
|
+
action?: string;
|
|
194
|
+
payload?: unknown;
|
|
195
|
+
timestamp: number;
|
|
196
|
+
compressed?: boolean;
|
|
197
|
+
priority?: MessagePriority;
|
|
198
|
+
correlationId?: string;
|
|
193
199
|
}
|
|
194
|
-
type WorkerState = 'idle' | 'initializing' | 'ready' | 'processing' | 'error' | 'terminating' | 'terminated';
|
|
195
|
-
type WorkerHealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';
|
|
196
|
-
interface WorkerMetrics {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
200
|
+
export type WorkerState = 'idle' | 'initializing' | 'ready' | 'processing' | 'error' | 'terminating' | 'terminated';
|
|
201
|
+
export type WorkerHealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';
|
|
202
|
+
export interface WorkerMetrics {
|
|
203
|
+
tasksProcessed: number;
|
|
204
|
+
tasksFailed: number;
|
|
205
|
+
averageProcessingTime: number;
|
|
206
|
+
memoryUsage?: number;
|
|
207
|
+
cpuUsage?: number;
|
|
208
|
+
healthStatus: WorkerHealthStatus;
|
|
209
|
+
lastHealthCheck: number;
|
|
210
|
+
restartCount: number;
|
|
211
|
+
errorRate: number;
|
|
206
212
|
}
|
|
207
|
-
interface WorkerError {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
+
export interface WorkerError {
|
|
214
|
+
type: string;
|
|
215
|
+
message: string;
|
|
216
|
+
stack?: string;
|
|
217
|
+
timestamp: number;
|
|
218
|
+
recoverable: boolean;
|
|
213
219
|
}
|
|
214
|
-
interface WorkerCapabilities {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
220
|
+
export interface WorkerCapabilities {
|
|
221
|
+
workerAPI: boolean;
|
|
222
|
+
sharedArrayBuffer: boolean;
|
|
223
|
+
transferableObjects: boolean;
|
|
224
|
+
offscreenCanvas: boolean;
|
|
225
|
+
webAssembly: boolean;
|
|
226
|
+
atomics: boolean;
|
|
227
|
+
bigInt: boolean;
|
|
228
|
+
csp: {
|
|
229
|
+
workerSrc: boolean;
|
|
230
|
+
scriptSrc: boolean;
|
|
231
|
+
blobUrls: boolean;
|
|
232
|
+
inlineWorkers: boolean;
|
|
233
|
+
};
|
|
234
|
+
performance: {
|
|
235
|
+
memory: boolean;
|
|
236
|
+
measureUserAgentSpecificMemory: boolean;
|
|
237
|
+
};
|
|
232
238
|
}
|
|
233
|
-
interface WorkerTask {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
export interface WorkerTask {
|
|
240
|
+
id: string;
|
|
241
|
+
type: string;
|
|
242
|
+
data: unknown;
|
|
243
|
+
priority: 'low' | 'normal' | 'high' | 'critical';
|
|
244
|
+
createdAt: number;
|
|
245
|
+
startedAt?: number;
|
|
246
|
+
completedAt?: number;
|
|
247
|
+
error?: WorkerError;
|
|
248
|
+
maxRetries?: number;
|
|
249
|
+
retries?: number;
|
|
250
|
+
timeout?: number;
|
|
245
251
|
}
|
|
246
|
-
interface FallbackOptions {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
+
export interface FallbackOptions {
|
|
253
|
+
useRequestIdleCallback: boolean;
|
|
254
|
+
idleTimeout: number;
|
|
255
|
+
chunkSize: number;
|
|
256
|
+
throttleMs: number;
|
|
257
|
+
maxExecutionTime: number;
|
|
252
258
|
}
|
|
253
|
-
interface ResourceUsage {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
259
|
+
export interface ResourceUsage {
|
|
260
|
+
memoryUsage: number;
|
|
261
|
+
cpuUsage: number;
|
|
262
|
+
taskCount: number;
|
|
263
|
+
activeWorkers: number;
|
|
264
|
+
pendingTasks: number;
|
|
265
|
+
completedTasks: number;
|
|
266
|
+
failedTasks: number;
|
|
267
|
+
averageTaskDuration: number;
|
|
268
|
+
memory?: number;
|
|
269
|
+
cpu?: number;
|
|
270
|
+
tasks?: number;
|
|
265
271
|
}
|
|
266
|
-
interface WorkerPoolConfig {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
export interface WorkerPoolConfig {
|
|
273
|
+
maxWorkers: number;
|
|
274
|
+
minWorkers: number;
|
|
275
|
+
workerIdleTimeout: number;
|
|
276
|
+
taskQueueSize: number;
|
|
277
|
+
resourceLimits: Record<string, unknown>;
|
|
278
|
+
autoScale?: boolean;
|
|
279
|
+
scaleUpThreshold?: number;
|
|
280
|
+
scaleDownThreshold?: number;
|
|
275
281
|
}
|
|
276
|
-
type BeaconWorkerMessageType = 'init' | 'collect' | 'flush' | 'config' | 'status' | 'error';
|
|
277
|
-
type ProtocolVersion = '1.0' | '1.1' | '2.0';
|
|
278
|
-
interface BeaconWorkerMessage {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
export type BeaconWorkerMessageType = 'init' | 'collect' | 'flush' | 'config' | 'status' | 'error';
|
|
283
|
+
export type ProtocolVersion = '1.0' | '1.1' | '2.0';
|
|
284
|
+
export interface BeaconWorkerMessage {
|
|
285
|
+
type: BeaconWorkerMessageType;
|
|
286
|
+
data?: unknown;
|
|
287
|
+
payload?: unknown;
|
|
288
|
+
messageId: string;
|
|
289
|
+
timestamp: number;
|
|
290
|
+
id?: string;
|
|
285
291
|
}
|
|
286
|
-
interface CircuitBreakerConfig {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
292
|
+
export interface CircuitBreakerConfig {
|
|
293
|
+
threshold: number;
|
|
294
|
+
timeout: number;
|
|
295
|
+
resetTimeout: number;
|
|
290
296
|
}
|
|
291
|
-
type CircuitBreakerState = 'closed' | 'open' | 'half-open';
|
|
292
|
-
interface RetryStrategy {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
297
|
+
export type CircuitBreakerState = 'closed' | 'open' | 'half-open';
|
|
298
|
+
export interface RetryStrategy {
|
|
299
|
+
maxAttempts: number;
|
|
300
|
+
baseDelay: number;
|
|
301
|
+
maxDelay: number;
|
|
302
|
+
factor: number;
|
|
303
|
+
jitter: boolean;
|
|
298
304
|
}
|
|
299
|
-
interface OfflineQueueEntry {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
305
|
+
export interface OfflineQueueEntry {
|
|
306
|
+
id: string;
|
|
307
|
+
events: BeaconEvent[];
|
|
308
|
+
timestamp: number;
|
|
309
|
+
expiresAt: number;
|
|
310
|
+
retryCount: number;
|
|
311
|
+
size: number;
|
|
306
312
|
}
|
|
307
|
-
declare function validateBeaconEvent(event: unknown): event is BeaconEvent;
|
|
308
|
-
declare function validateBeaconConfig(config: unknown): config is BeaconConfig;
|
|
309
|
-
declare function validateBeaconBatch(batch: unknown): batch is BeaconBatch;
|
|
310
|
-
declare function parseBeaconConfig(input: unknown): BeaconConfig;
|
|
311
|
-
declare const Guards: {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
313
|
+
export declare function validateBeaconEvent(event: unknown): event is BeaconEvent;
|
|
314
|
+
export declare function validateBeaconConfig(config: unknown): config is BeaconConfig;
|
|
315
|
+
export declare function validateBeaconBatch(batch: unknown): batch is BeaconBatch;
|
|
316
|
+
export declare function parseBeaconConfig(input: unknown): BeaconConfig;
|
|
317
|
+
export declare const Guards: {
|
|
318
|
+
isBeaconEvent: typeof validateBeaconEvent;
|
|
319
|
+
isBeaconConfig: typeof validateBeaconConfig;
|
|
320
|
+
isBeaconBatch: typeof validateBeaconBatch;
|
|
321
|
+
isWorkerMessage(msg: unknown): msg is WorkerMessage;
|
|
322
|
+
isWorkerError(err: unknown): err is WorkerError;
|
|
323
|
+
isWorkerCapabilities(cap: unknown): cap is WorkerCapabilities;
|
|
318
324
|
};
|
|
319
|
-
declare function parseWorkerConfig(input: unknown): WorkerConfig;
|
|
320
|
-
declare function parseWorkerMessage(input: unknown): WorkerMessage;
|
|
321
|
-
declare function parseWorkerError(input: unknown): WorkerError;
|
|
322
|
-
declare function parseWorkerCapabilities(input: unknown): WorkerCapabilities;
|
|
323
|
-
declare function parseWorkerTask(input: unknown): WorkerTask;
|
|
324
|
-
declare function parseFallbackOptions(input: unknown): FallbackOptions;
|
|
325
|
-
declare function parseRetryStrategy(input: unknown): RetryStrategy;
|
|
326
|
-
declare function parseCircuitBreakerConfig(input: unknown): CircuitBreakerConfig;
|
|
327
|
-
declare function parseOfflineQueueEntry(input: unknown): OfflineQueueEntry;
|
|
328
|
-
declare function parseResourceUsage(input: unknown): ResourceUsage;
|
|
329
|
-
declare function parseWorkerPoolConfig(input: unknown): WorkerPoolConfig;
|
|
330
|
-
declare function parseBeaconWorkerMessage(input: unknown): BeaconWorkerMessage;
|
|
331
|
-
declare const DEFAULT_CONFIG: {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
325
|
+
export declare function parseWorkerConfig(input: unknown): WorkerConfig;
|
|
326
|
+
export declare function parseWorkerMessage(input: unknown): WorkerMessage;
|
|
327
|
+
export declare function parseWorkerError(input: unknown): WorkerError;
|
|
328
|
+
export declare function parseWorkerCapabilities(input: unknown): WorkerCapabilities;
|
|
329
|
+
export declare function parseWorkerTask(input: unknown): WorkerTask;
|
|
330
|
+
export declare function parseFallbackOptions(input: unknown): FallbackOptions;
|
|
331
|
+
export declare function parseRetryStrategy(input: unknown): RetryStrategy;
|
|
332
|
+
export declare function parseCircuitBreakerConfig(input: unknown): CircuitBreakerConfig;
|
|
333
|
+
export declare function parseOfflineQueueEntry(input: unknown): OfflineQueueEntry;
|
|
334
|
+
export declare function parseResourceUsage(input: unknown): ResourceUsage;
|
|
335
|
+
export declare function parseWorkerPoolConfig(input: unknown): WorkerPoolConfig;
|
|
336
|
+
export declare function parseBeaconWorkerMessage(input: unknown): BeaconWorkerMessage;
|
|
337
|
+
export declare const DEFAULT_CONFIG: {
|
|
338
|
+
readonly batchSize: 10;
|
|
339
|
+
readonly flushInterval: 5000;
|
|
340
|
+
readonly sessionTimeout: 1800000;
|
|
341
|
+
readonly sessionCookieName: "_as_beacon_session";
|
|
342
|
+
readonly retryAttempts: 3;
|
|
343
|
+
readonly retryDelay: 2000;
|
|
338
344
|
};
|
|
339
|
-
declare const ERROR_TYPES: {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
345
|
+
export declare const ERROR_TYPES: {
|
|
346
|
+
readonly NETWORK: "network";
|
|
347
|
+
readonly VALIDATION: "validation";
|
|
348
|
+
readonly TIMEOUT: "timeout";
|
|
349
|
+
readonly UNKNOWN: "unknown";
|
|
344
350
|
};
|
|
345
|
-
declare const RULE_CACHE: {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
+
export declare const RULE_CACHE: {
|
|
352
|
+
readonly DEFAULT_DURATION: 3600000;
|
|
353
|
+
readonly MAX_DURATION: 86400000;
|
|
354
|
+
readonly MIN_DURATION: 60000;
|
|
355
|
+
readonly STORAGE_KEY: "agentshield_rules";
|
|
356
|
+
readonly TIMESTAMP_KEY: "agentshield_rules_timestamp";
|
|
351
357
|
};
|
|
352
|
-
|
|
353
|
-
export
|
|
358
|
+
//#endregion
|
|
359
|
+
export type { BrowserDetectionResult as DetectionResult };
|
|
360
|
+
//# sourceMappingURL=browser.d.ts.map
|