@kya-os/checkpoint-nextjs 1.9.0 → 1.11.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 +322 -0
- package/README.md +205 -31
- package/dist/adapt-BdQ9R7Iw.mjs +97 -0
- package/dist/adapt-BdQ9R7Iw.mjs.map +1 -0
- package/dist/adapt-CCSKGjVH.js +107 -0
- package/dist/api-client-JHOrRUA_.d.mts +222 -0
- package/dist/api-client-JHOrRUA_.d.mts.map +1 -0
- package/dist/api-client-JHOrRUA_.d.ts +222 -0
- package/dist/api-client-JHOrRUA_.d.ts.map +1 -0
- package/dist/api-client.d.mts +2 -213
- package/dist/api-client.d.ts +2 -213
- package/dist/api-client.js +221 -206
- package/dist/api-client.mjs +222 -202
- package/dist/api-client.mjs.map +1 -0
- package/dist/api-middleware-BWjokNis.d.mts +131 -0
- package/dist/api-middleware-BWjokNis.d.mts.map +1 -0
- package/dist/api-middleware-Bf3xmM9W.js +391 -0
- package/dist/api-middleware-C-ngFX_8.mjs +387 -0
- package/dist/api-middleware-C-ngFX_8.mjs.map +1 -0
- package/dist/api-middleware-DyLDqOYF.d.ts +131 -0
- package/dist/api-middleware-DyLDqOYF.d.ts.map +1 -0
- package/dist/api-middleware.d.mts +2 -166
- package/dist/api-middleware.d.ts +2 -166
- package/dist/api-middleware.js +3 -526
- package/dist/api-middleware.mjs +2 -521
- package/dist/cedar-wasm.d.mts +20 -0
- package/dist/cedar-wasm.d.mts.map +1 -0
- package/dist/cedar-wasm.d.ts +19 -0
- package/dist/cedar-wasm.d.ts.map +1 -0
- package/dist/cedar-wasm.js +24 -0
- package/dist/cedar-wasm.mjs +23 -0
- package/dist/cedar-wasm.mjs.map +1 -0
- package/dist/config-CPP1RV0f.d.mts +291 -0
- package/dist/config-CPP1RV0f.d.mts.map +1 -0
- package/dist/config-DVgOFxJs.d.ts +291 -0
- package/dist/config-DVgOFxJs.d.ts.map +1 -0
- package/dist/engine-wasm.d.mts +20 -0
- package/dist/engine-wasm.d.mts.map +1 -0
- package/dist/engine-wasm.d.ts +19 -0
- package/dist/engine-wasm.d.ts.map +1 -0
- package/dist/engine-wasm.js +24 -0
- package/dist/engine-wasm.mjs +23 -0
- package/dist/engine-wasm.mjs.map +1 -0
- package/dist/index-edge.d.mts +8 -0
- package/dist/index-edge.d.ts +8 -0
- package/dist/index-edge.js +14 -0
- package/dist/index-edge.mjs +7 -0
- package/dist/index.d.mts +8 -17
- package/dist/index.d.ts +8 -17
- package/dist/index.js +36 -1275
- package/dist/index.mjs +29 -1234
- package/dist/index.mjs.map +1 -0
- package/dist/middleware-bundler.d.mts +6 -12
- package/dist/middleware-bundler.d.mts.map +1 -0
- package/dist/middleware-bundler.d.ts +6 -12
- package/dist/middleware-bundler.d.ts.map +1 -0
- package/dist/middleware-bundler.js +12 -350
- package/dist/middleware-bundler.mjs +11 -347
- package/dist/middleware-bundler.mjs.map +1 -0
- package/dist/middleware-core-B0jf5_Hm.mjs +264 -0
- package/dist/middleware-core-B0jf5_Hm.mjs.map +1 -0
- package/dist/middleware-core-Bol44X9C.d.ts +17 -0
- package/dist/middleware-core-Bol44X9C.d.ts.map +1 -0
- package/dist/middleware-core-CMc-2QkU.js +274 -0
- package/dist/middleware-core-DycsbHUd.d.mts +17 -0
- package/dist/middleware-core-DycsbHUd.d.mts.map +1 -0
- package/dist/middleware-edge.d.mts +16 -14
- package/dist/middleware-edge.d.mts.map +1 -0
- package/dist/middleware-edge.d.ts +16 -14
- package/dist/middleware-edge.d.ts.map +1 -0
- package/dist/middleware-edge.js +94 -355
- package/dist/middleware-edge.mjs +90 -347
- package/dist/middleware-edge.mjs.map +1 -0
- package/dist/middleware-node-context-591KsiYg.js +39 -0
- package/dist/middleware-node-context-D_ZyUEcA.mjs +35 -0
- package/dist/middleware-node-context-D_ZyUEcA.mjs.map +1 -0
- package/dist/middleware-node.d.mts +10 -25
- package/dist/middleware-node.d.mts.map +1 -0
- package/dist/middleware-node.d.ts +10 -25
- package/dist/middleware-node.d.ts.map +1 -0
- package/dist/middleware-node.js +21 -351
- package/dist/middleware-node.mjs +19 -347
- package/dist/middleware-node.mjs.map +1 -0
- package/dist/posture-outcome-Ccujx_9V.d.mts +14 -0
- package/dist/posture-outcome-Ccujx_9V.d.mts.map +1 -0
- package/dist/posture-outcome-Ccujx_9V.d.ts +14 -0
- package/dist/posture-outcome-Ccujx_9V.d.ts.map +1 -0
- package/dist/posture-outcome-DQ4fdMfq.mjs +21 -0
- package/dist/posture-outcome-DQ4fdMfq.mjs.map +1 -0
- package/dist/posture-outcome-DddsJtL8.js +25 -0
- package/dist/public-api-CYsHrTQI.d.ts +5 -0
- package/dist/public-api-DkG7pRE0.d.mts +5 -0
- package/dist/rolldown-runtime-C24Yb2bl.js +33 -0
- package/dist/utils-Cnwg0VrY.mjs +88 -0
- package/dist/utils-Cnwg0VrY.mjs.map +1 -0
- package/dist/utils-dyFxqlFI.js +104 -0
- package/package.json +31 -66
- package/EDGE_RUNTIME_WASM_SETUP.md +0 -342
- package/bin/setup-edge-wasm.js +0 -513
- package/dist/adapt.d.mts +0 -39
- package/dist/adapt.d.ts +0 -39
- package/dist/adapt.js +0 -59
- package/dist/adapt.mjs +0 -57
- package/dist/composed-policy.d.mts +0 -115
- package/dist/composed-policy.d.ts +0 -115
- package/dist/composed-policy.js +0 -103
- package/dist/composed-policy.mjs +0 -97
- package/dist/config-CleTeeoW.d.mts +0 -233
- package/dist/config-XMOIkxFN.d.ts +0 -233
- package/dist/create-middleware.d.mts +0 -22
- package/dist/create-middleware.d.ts +0 -22
- package/dist/create-middleware.js +0 -34
- package/dist/create-middleware.mjs +0 -31
- package/dist/edge/index.d.mts +0 -112
- package/dist/edge/index.d.ts +0 -112
- package/dist/edge/index.js +0 -277
- package/dist/edge/index.mjs +0 -275
- package/dist/edge-runtime-loader.d.mts +0 -77
- package/dist/edge-runtime-loader.d.ts +0 -77
- package/dist/edge-runtime-loader.js +0 -242
- package/dist/edge-runtime-loader.mjs +0 -235
- package/dist/edge-wasm-middleware.d.mts +0 -62
- package/dist/edge-wasm-middleware.d.ts +0 -62
- package/dist/edge-wasm-middleware.js +0 -26
- package/dist/edge-wasm-middleware.mjs +0 -22
- package/dist/middleware.d.mts +0 -45
- package/dist/middleware.d.ts +0 -45
- package/dist/middleware.js +0 -19
- package/dist/middleware.mjs +0 -15
- package/dist/nodejs-wasm-loader.d.mts +0 -41
- package/dist/nodejs-wasm-loader.d.ts +0 -41
- package/dist/nodejs-wasm-loader.js +0 -36
- package/dist/nodejs-wasm-loader.mjs +0 -30
- package/dist/policy.d.mts +0 -162
- package/dist/policy.d.ts +0 -162
- package/dist/policy.js +0 -198
- package/dist/policy.mjs +0 -174
- package/dist/session-tracker.d.mts +0 -55
- package/dist/session-tracker.d.ts +0 -55
- package/dist/session-tracker.js +0 -172
- package/dist/session-tracker.mjs +0 -169
- package/dist/translate.d.mts +0 -63
- package/dist/translate.d.ts +0 -63
- package/dist/translate.js +0 -44
- package/dist/translate.mjs +0 -42
- package/dist/types-Chgi5TFC.d.mts +0 -105
- package/dist/types-Chgi5TFC.d.ts +0 -105
- package/dist/wasm-setup.d.mts +0 -46
- package/dist/wasm-setup.d.ts +0 -46
- package/dist/wasm-setup.js +0 -122
- package/dist/wasm-setup.mjs +0 -118
- package/wasm/agentshield_wasm.d.ts +0 -479
- package/wasm/agentshield_wasm.js +0 -1536
- package/wasm/agentshield_wasm_bg.wasm +0 -0
- package/wasm/package.json +0 -30
- package/wasm.d.ts +0 -21
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { resolveClientIp, KNOWN_AGENT_PATTERNS } from '@kya-os/checkpoint-shared';
|
|
2
|
-
|
|
3
|
-
// src/edge-runtime-loader.ts
|
|
4
|
-
function getClientIp(request, policy = { platform: "direct" }) {
|
|
5
|
-
const frameworkAddress = request.ip;
|
|
6
|
-
return resolveClientIp({ headers: request.headers, frameworkAddress, policy }).ip ?? void 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// src/edge-runtime-loader.ts
|
|
10
|
-
var SUSPICIOUS_HEADER_PREFIXES = ["x-openai-", "x-anthropic-", "x-ai-", "x-llm-", "x-gpt-"];
|
|
11
|
-
function escapeRegex(s) {
|
|
12
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
13
|
-
}
|
|
14
|
-
var REGEX_SYNTAX_PATTERN = /(?:\\.|[()[\]{}|^$]|\.\*|\.\+|\.\?)/;
|
|
15
|
-
var TOKEN_REGEX_CACHE = /* @__PURE__ */ new Map();
|
|
16
|
-
function tokenRegex(token) {
|
|
17
|
-
const cached = TOKEN_REGEX_CACHE.get(token);
|
|
18
|
-
if (cached) return cached;
|
|
19
|
-
const source = REGEX_SYNTAX_PATTERN.test(token) ? token : escapeRegex(token);
|
|
20
|
-
const regex = new RegExp(`(^|[^a-z0-9])${source}($|[^a-z0-9])`, "i");
|
|
21
|
-
TOKEN_REGEX_CACHE.set(token, regex);
|
|
22
|
-
return regex;
|
|
23
|
-
}
|
|
24
|
-
function readStringField(value) {
|
|
25
|
-
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
26
|
-
}
|
|
27
|
-
function readNumberField(value) {
|
|
28
|
-
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
29
|
-
}
|
|
30
|
-
function readBooleanField(value) {
|
|
31
|
-
return typeof value === "boolean" ? value : void 0;
|
|
32
|
-
}
|
|
33
|
-
function readStringArrayField(value) {
|
|
34
|
-
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
35
|
-
}
|
|
36
|
-
function normalizeEngineConfidence(value) {
|
|
37
|
-
if (value === void 0) return 0;
|
|
38
|
-
return Math.round(Math.max(0, Math.min(100, value)));
|
|
39
|
-
}
|
|
40
|
-
function matchKnownAgent(lowercasedUa) {
|
|
41
|
-
let best = null;
|
|
42
|
-
for (const entry of KNOWN_AGENT_PATTERNS) {
|
|
43
|
-
for (const pattern of entry.patterns) {
|
|
44
|
-
if (tokenRegex(pattern).test(lowercasedUa)) {
|
|
45
|
-
if (!best || entry.confidence > best.confidence) {
|
|
46
|
-
best = { name: entry.name, confidence: entry.confidence };
|
|
47
|
-
}
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return best;
|
|
53
|
-
}
|
|
54
|
-
var EdgeRuntimeCheckpoint = class {
|
|
55
|
-
wasmInstance = null;
|
|
56
|
-
wasmMemory = null;
|
|
57
|
-
config;
|
|
58
|
-
initialized = false;
|
|
59
|
-
constructor(config = {}) {
|
|
60
|
-
this.config = config;
|
|
61
|
-
}
|
|
62
|
-
async init(wasmModule) {
|
|
63
|
-
if (this.initialized) return;
|
|
64
|
-
const module = wasmModule || this.config.wasmModule;
|
|
65
|
-
if (module && this.config.enableWasm !== false) {
|
|
66
|
-
try {
|
|
67
|
-
this.wasmMemory = new WebAssembly.Memory({ initial: 17, maximum: 256 });
|
|
68
|
-
const imports = {
|
|
69
|
-
wbg: {
|
|
70
|
-
__wbindgen_throw: (ptr, len) => {
|
|
71
|
-
throw new Error(this.readString(ptr, len));
|
|
72
|
-
},
|
|
73
|
-
__wbg_log_: (ptr, len) => {
|
|
74
|
-
if (this.config.debug) {
|
|
75
|
-
console.log(this.readString(ptr, len));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
env: {
|
|
80
|
-
memory: this.wasmMemory
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
this.wasmInstance = await WebAssembly.instantiate(module, imports);
|
|
84
|
-
this.initialized = true;
|
|
85
|
-
if (this.config.debug) {
|
|
86
|
-
console.log("\u2705 Checkpoint WASM initialized in Edge Runtime");
|
|
87
|
-
}
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.warn("\u26A0\uFE0F WASM initialization failed, using pattern detection:", error);
|
|
90
|
-
this.initialized = true;
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
this.initialized = true;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
readString(ptr, len) {
|
|
97
|
-
if (!this.wasmInstance || !this.wasmMemory) {
|
|
98
|
-
throw new Error("WASM not initialized");
|
|
99
|
-
}
|
|
100
|
-
const memory = new Uint8Array(this.wasmMemory.buffer);
|
|
101
|
-
const bytes = memory.slice(ptr, ptr + len);
|
|
102
|
-
return new TextDecoder().decode(bytes);
|
|
103
|
-
}
|
|
104
|
-
writeString(str) {
|
|
105
|
-
if (!this.wasmInstance) {
|
|
106
|
-
throw new Error("WASM not initialized");
|
|
107
|
-
}
|
|
108
|
-
const exports$1 = this.wasmInstance.exports;
|
|
109
|
-
const encoded = new TextEncoder().encode(str);
|
|
110
|
-
const ptr = exports$1.__wbindgen_malloc(encoded.length);
|
|
111
|
-
const memory = new Uint8Array(exports$1.memory.buffer);
|
|
112
|
-
memory.set(encoded, ptr);
|
|
113
|
-
return [ptr, encoded.length];
|
|
114
|
-
}
|
|
115
|
-
async detect(request) {
|
|
116
|
-
if (!this.initialized) {
|
|
117
|
-
await this.init();
|
|
118
|
-
}
|
|
119
|
-
const metadata = {
|
|
120
|
-
userAgent: request.headers.get("user-agent") || "",
|
|
121
|
-
ipAddress: getClientIp(request, this.config.clientIpPolicy) || "",
|
|
122
|
-
headers: Object.fromEntries(request.headers.entries())
|
|
123
|
-
};
|
|
124
|
-
if (this.wasmInstance && this.config.enableWasm !== false) {
|
|
125
|
-
try {
|
|
126
|
-
const exports$1 = this.wasmInstance.exports;
|
|
127
|
-
const [ptr, len] = this.writeString(JSON.stringify(metadata));
|
|
128
|
-
const resultPtr = exports$1.detect_agent(ptr, len);
|
|
129
|
-
let resultStr = "";
|
|
130
|
-
let offset = 0;
|
|
131
|
-
const memory = new Uint8Array(exports$1.memory.buffer);
|
|
132
|
-
while (offset < 4096) {
|
|
133
|
-
const byte = memory[resultPtr + offset];
|
|
134
|
-
if (byte === 0 || byte === void 0) break;
|
|
135
|
-
offset++;
|
|
136
|
-
}
|
|
137
|
-
if (offset > 0) {
|
|
138
|
-
resultStr = this.readString(resultPtr, offset);
|
|
139
|
-
}
|
|
140
|
-
exports$1.__wbindgen_free(ptr, len);
|
|
141
|
-
if (offset > 0) {
|
|
142
|
-
exports$1.__wbindgen_free(resultPtr, offset);
|
|
143
|
-
}
|
|
144
|
-
const result = JSON.parse(resultStr);
|
|
145
|
-
const agent = readStringField(result.agent) ?? readStringField(result.agentName);
|
|
146
|
-
const confidence = normalizeEngineConfidence(readNumberField(result.confidence));
|
|
147
|
-
const detection = {
|
|
148
|
-
isAgent: readBooleanField(result.isAgent) ?? readBooleanField(result.is_agent) ?? false,
|
|
149
|
-
isAiCrawler: readBooleanField(result.isAiCrawler) ?? readBooleanField(result.is_ai_crawler),
|
|
150
|
-
confidence,
|
|
151
|
-
detectionClass: agent ? { type: "AiAgent", agentType: agent } : { type: confidence > 0 ? "IncompleteData" : "Human" },
|
|
152
|
-
detectedAgent: agent ? { type: "ai_agent", name: agent } : void 0,
|
|
153
|
-
agent,
|
|
154
|
-
agentType: agent,
|
|
155
|
-
reasons: readStringArrayField(result.reasons),
|
|
156
|
-
signals: [],
|
|
157
|
-
verificationMethod: "signature",
|
|
158
|
-
riskLevel: readStringField(result.riskLevel) ?? readStringField(result.risk_level),
|
|
159
|
-
timestamp: Date.now()
|
|
160
|
-
};
|
|
161
|
-
if (this.config.onAgentDetected && detection.isAgent) {
|
|
162
|
-
this.config.onAgentDetected(detection);
|
|
163
|
-
}
|
|
164
|
-
return detection;
|
|
165
|
-
} catch (error) {
|
|
166
|
-
if (this.config.debug) {
|
|
167
|
-
console.error("WASM detection failed:", error);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return this.patternDetection(metadata);
|
|
172
|
-
}
|
|
173
|
-
patternDetection(metadata) {
|
|
174
|
-
const lowercasedUa = metadata.userAgent.toLowerCase();
|
|
175
|
-
let headerBoost = 0;
|
|
176
|
-
for (const key of Object.keys(metadata.headers)) {
|
|
177
|
-
if (SUSPICIOUS_HEADER_PREFIXES.some((prefix) => key.toLowerCase().startsWith(prefix))) {
|
|
178
|
-
headerBoost = 0.1;
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
const match = matchKnownAgent(lowercasedUa);
|
|
183
|
-
if (match) {
|
|
184
|
-
const finalConfidence = Math.min(match.confidence + headerBoost, 1);
|
|
185
|
-
const confidence = Math.round(finalConfidence * 100);
|
|
186
|
-
const result = {
|
|
187
|
-
isAgent: true,
|
|
188
|
-
confidence,
|
|
189
|
-
detectionClass: { type: "AiAgent", agentType: match.name },
|
|
190
|
-
detectedAgent: { type: "ai_agent", name: match.name },
|
|
191
|
-
agent: match.name,
|
|
192
|
-
agentType: match.name,
|
|
193
|
-
reasons: [`known_pattern:${match.name.toLowerCase()}`],
|
|
194
|
-
signals: [],
|
|
195
|
-
verificationMethod: "pattern",
|
|
196
|
-
riskLevel: finalConfidence > 0.9 ? "high" : "medium",
|
|
197
|
-
timestamp: Date.now()
|
|
198
|
-
};
|
|
199
|
-
if (this.config.onAgentDetected) {
|
|
200
|
-
this.config.onAgentDetected(result);
|
|
201
|
-
}
|
|
202
|
-
return result;
|
|
203
|
-
}
|
|
204
|
-
return {
|
|
205
|
-
isAgent: false,
|
|
206
|
-
confidence: 0,
|
|
207
|
-
detectionClass: { type: "Human" },
|
|
208
|
-
reasons: ["No known agent indicators matched"],
|
|
209
|
-
signals: [],
|
|
210
|
-
verificationMethod: "pattern",
|
|
211
|
-
timestamp: Date.now()
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
isInitialized() {
|
|
215
|
-
return this.initialized;
|
|
216
|
-
}
|
|
217
|
-
getVerificationMethod() {
|
|
218
|
-
return this.wasmInstance ? "cryptographic" : "pattern";
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
function createEdgeCheckpoint(config) {
|
|
222
|
-
return new EdgeRuntimeCheckpoint(config);
|
|
223
|
-
}
|
|
224
|
-
var defaultInstance = null;
|
|
225
|
-
function getDefaultEdgeCheckpoint(config) {
|
|
226
|
-
if (!defaultInstance) {
|
|
227
|
-
defaultInstance = new EdgeRuntimeCheckpoint(config);
|
|
228
|
-
}
|
|
229
|
-
return defaultInstance;
|
|
230
|
-
}
|
|
231
|
-
var EdgeRuntimeAgentShield = EdgeRuntimeCheckpoint;
|
|
232
|
-
var createEdgeAgentShield = createEdgeCheckpoint;
|
|
233
|
-
var getDefaultAgentShield = getDefaultEdgeCheckpoint;
|
|
234
|
-
|
|
235
|
-
export { EdgeRuntimeAgentShield, EdgeRuntimeCheckpoint, createEdgeAgentShield, createEdgeCheckpoint, getDefaultAgentShield, getDefaultEdgeCheckpoint };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Phase-D.9a — legacy Edge Runtime WASM middleware wrapping
|
|
5
|
-
* the retired `agentshield-wasm` Rust crate. This file shipped hand-
|
|
6
|
-
* written wasm-bindgen glue code that loaded the legacy detector's
|
|
7
|
-
* WASM binary; PR #2599's SSOT consolidation + PDM-1 #2560's engine
|
|
8
|
-
* move + AgentDetector-Deletion-1 PR #2610's class-deprecation +
|
|
9
|
-
* AgentDetector-Deletion-2's class removal made it structural dead weight.
|
|
10
|
-
*
|
|
11
|
-
* Phase-D.9a converts the exports to throw-stubs (same precedent the
|
|
12
|
-
* `createWasmAgentShieldMiddleware` removal used). Phase-D.9b (follow-up)
|
|
13
|
-
* deletes the underlying `agentshield-wasm` Rust crate after migrating
|
|
14
|
-
* the production Cloudflare gateway worker.
|
|
15
|
-
*
|
|
16
|
-
* Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs/edge` —
|
|
17
|
-
* engine-backed, runs the full kya-os-engine orchestrator including
|
|
18
|
-
* KYA-OS envelope verification. See `packages/checkpoint-nextjs/README.md`
|
|
19
|
-
* for the canonical recipe.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/** @deprecated See file header. Type-only surface preservation. */
|
|
23
|
-
interface EdgeWasmDetectionResult {
|
|
24
|
-
isAgent: boolean;
|
|
25
|
-
isAiCrawler?: boolean;
|
|
26
|
-
confidence: number;
|
|
27
|
-
agent?: string;
|
|
28
|
-
verificationMethod: 'signature' | 'pattern' | 'wasm';
|
|
29
|
-
riskLevel: 'low' | 'medium' | 'high';
|
|
30
|
-
timestamp: string;
|
|
31
|
-
reasons?: string[];
|
|
32
|
-
}
|
|
33
|
-
/** @deprecated See file header. Type-only surface preservation. */
|
|
34
|
-
interface EdgeAgentShieldConfig {
|
|
35
|
-
onAgentDetected?: (result: EdgeWasmDetectionResult) => void | Promise<void>;
|
|
36
|
-
blockOnHighConfidence?: boolean;
|
|
37
|
-
confidenceThreshold?: number;
|
|
38
|
-
skipPaths?: string[];
|
|
39
|
-
blockedResponse?: {
|
|
40
|
-
status?: number;
|
|
41
|
-
message?: string;
|
|
42
|
-
headers?: Record<string, string>;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/** @internal — test-only reset for the one-shot warn latch. */
|
|
46
|
-
declare function __resetEdgeWasmWarningForTests(): void;
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated Removed in Phase-D.9a. Use `withCheckpoint` from
|
|
49
|
-
* `@kya-os/checkpoint-nextjs/edge` instead. Throws on invocation;
|
|
50
|
-
* surface exists only so static analysis sees the historical export.
|
|
51
|
-
*/
|
|
52
|
-
declare function initializeEdgeWasm(_wasmModule: WebAssembly.Module): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated Removed in Phase-D.9a. Use `withCheckpoint` from
|
|
55
|
-
* `@kya-os/checkpoint-nextjs/edge` instead. Throws on invocation;
|
|
56
|
-
* surface exists only so static analysis sees the historical export.
|
|
57
|
-
*/
|
|
58
|
-
declare function createEdgeWasmMiddleware(_config: EdgeAgentShieldConfig & {
|
|
59
|
-
wasmModule: WebAssembly.Module;
|
|
60
|
-
}): (request: NextRequest) => Promise<NextResponse>;
|
|
61
|
-
|
|
62
|
-
export { type EdgeAgentShieldConfig, type EdgeWasmDetectionResult, __resetEdgeWasmWarningForTests, createEdgeWasmMiddleware, initializeEdgeWasm };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Phase-D.9a — legacy Edge Runtime WASM middleware wrapping
|
|
5
|
-
* the retired `agentshield-wasm` Rust crate. This file shipped hand-
|
|
6
|
-
* written wasm-bindgen glue code that loaded the legacy detector's
|
|
7
|
-
* WASM binary; PR #2599's SSOT consolidation + PDM-1 #2560's engine
|
|
8
|
-
* move + AgentDetector-Deletion-1 PR #2610's class-deprecation +
|
|
9
|
-
* AgentDetector-Deletion-2's class removal made it structural dead weight.
|
|
10
|
-
*
|
|
11
|
-
* Phase-D.9a converts the exports to throw-stubs (same precedent the
|
|
12
|
-
* `createWasmAgentShieldMiddleware` removal used). Phase-D.9b (follow-up)
|
|
13
|
-
* deletes the underlying `agentshield-wasm` Rust crate after migrating
|
|
14
|
-
* the production Cloudflare gateway worker.
|
|
15
|
-
*
|
|
16
|
-
* Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs/edge` —
|
|
17
|
-
* engine-backed, runs the full kya-os-engine orchestrator including
|
|
18
|
-
* KYA-OS envelope verification. See `packages/checkpoint-nextjs/README.md`
|
|
19
|
-
* for the canonical recipe.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/** @deprecated See file header. Type-only surface preservation. */
|
|
23
|
-
interface EdgeWasmDetectionResult {
|
|
24
|
-
isAgent: boolean;
|
|
25
|
-
isAiCrawler?: boolean;
|
|
26
|
-
confidence: number;
|
|
27
|
-
agent?: string;
|
|
28
|
-
verificationMethod: 'signature' | 'pattern' | 'wasm';
|
|
29
|
-
riskLevel: 'low' | 'medium' | 'high';
|
|
30
|
-
timestamp: string;
|
|
31
|
-
reasons?: string[];
|
|
32
|
-
}
|
|
33
|
-
/** @deprecated See file header. Type-only surface preservation. */
|
|
34
|
-
interface EdgeAgentShieldConfig {
|
|
35
|
-
onAgentDetected?: (result: EdgeWasmDetectionResult) => void | Promise<void>;
|
|
36
|
-
blockOnHighConfidence?: boolean;
|
|
37
|
-
confidenceThreshold?: number;
|
|
38
|
-
skipPaths?: string[];
|
|
39
|
-
blockedResponse?: {
|
|
40
|
-
status?: number;
|
|
41
|
-
message?: string;
|
|
42
|
-
headers?: Record<string, string>;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/** @internal — test-only reset for the one-shot warn latch. */
|
|
46
|
-
declare function __resetEdgeWasmWarningForTests(): void;
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated Removed in Phase-D.9a. Use `withCheckpoint` from
|
|
49
|
-
* `@kya-os/checkpoint-nextjs/edge` instead. Throws on invocation;
|
|
50
|
-
* surface exists only so static analysis sees the historical export.
|
|
51
|
-
*/
|
|
52
|
-
declare function initializeEdgeWasm(_wasmModule: WebAssembly.Module): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated Removed in Phase-D.9a. Use `withCheckpoint` from
|
|
55
|
-
* `@kya-os/checkpoint-nextjs/edge` instead. Throws on invocation;
|
|
56
|
-
* surface exists only so static analysis sees the historical export.
|
|
57
|
-
*/
|
|
58
|
-
declare function createEdgeWasmMiddleware(_config: EdgeAgentShieldConfig & {
|
|
59
|
-
wasmModule: WebAssembly.Module;
|
|
60
|
-
}): (request: NextRequest) => Promise<NextResponse>;
|
|
61
|
-
|
|
62
|
-
export { type EdgeAgentShieldConfig, type EdgeWasmDetectionResult, __resetEdgeWasmWarningForTests, createEdgeWasmMiddleware, initializeEdgeWasm };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/edge-wasm-middleware.ts
|
|
4
|
-
var MIGRATION_ERROR = "`@kya-os/checkpoint-nextjs/edge-wasm-middleware` was deprecated in Phase-D.9a (legacy `agentshield-wasm` Rust crate retirement). Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs/edge` \u2014 engine-backed via the Rust `kya-os-engine` crate (PDM-1 #2560), runs the full orchestrator including KYA-OS envelope verification. See packages/checkpoint-nextjs/README.md for the canonical recipe.";
|
|
5
|
-
var _edgeWasmWarned = false;
|
|
6
|
-
function warnEdgeWasmDeprecated() {
|
|
7
|
-
if (_edgeWasmWarned) return;
|
|
8
|
-
_edgeWasmWarned = true;
|
|
9
|
-
if (typeof process !== "undefined" && process.env?.NODE_ENV === "production") return;
|
|
10
|
-
console.warn(`[Checkpoint] ${MIGRATION_ERROR}`);
|
|
11
|
-
}
|
|
12
|
-
function __resetEdgeWasmWarningForTests() {
|
|
13
|
-
_edgeWasmWarned = false;
|
|
14
|
-
}
|
|
15
|
-
async function initializeEdgeWasm(_wasmModule) {
|
|
16
|
-
warnEdgeWasmDeprecated();
|
|
17
|
-
throw new Error(MIGRATION_ERROR);
|
|
18
|
-
}
|
|
19
|
-
function createEdgeWasmMiddleware(_config) {
|
|
20
|
-
warnEdgeWasmDeprecated();
|
|
21
|
-
throw new Error(MIGRATION_ERROR);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
exports.__resetEdgeWasmWarningForTests = __resetEdgeWasmWarningForTests;
|
|
25
|
-
exports.createEdgeWasmMiddleware = createEdgeWasmMiddleware;
|
|
26
|
-
exports.initializeEdgeWasm = initializeEdgeWasm;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// src/edge-wasm-middleware.ts
|
|
2
|
-
var MIGRATION_ERROR = "`@kya-os/checkpoint-nextjs/edge-wasm-middleware` was deprecated in Phase-D.9a (legacy `agentshield-wasm` Rust crate retirement). Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs/edge` \u2014 engine-backed via the Rust `kya-os-engine` crate (PDM-1 #2560), runs the full orchestrator including KYA-OS envelope verification. See packages/checkpoint-nextjs/README.md for the canonical recipe.";
|
|
3
|
-
var _edgeWasmWarned = false;
|
|
4
|
-
function warnEdgeWasmDeprecated() {
|
|
5
|
-
if (_edgeWasmWarned) return;
|
|
6
|
-
_edgeWasmWarned = true;
|
|
7
|
-
if (typeof process !== "undefined" && process.env?.NODE_ENV === "production") return;
|
|
8
|
-
console.warn(`[Checkpoint] ${MIGRATION_ERROR}`);
|
|
9
|
-
}
|
|
10
|
-
function __resetEdgeWasmWarningForTests() {
|
|
11
|
-
_edgeWasmWarned = false;
|
|
12
|
-
}
|
|
13
|
-
async function initializeEdgeWasm(_wasmModule) {
|
|
14
|
-
warnEdgeWasmDeprecated();
|
|
15
|
-
throw new Error(MIGRATION_ERROR);
|
|
16
|
-
}
|
|
17
|
-
function createEdgeWasmMiddleware(_config) {
|
|
18
|
-
warnEdgeWasmDeprecated();
|
|
19
|
-
throw new Error(MIGRATION_ERROR);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { __resetEdgeWasmWarningForTests, createEdgeWasmMiddleware, initializeEdgeWasm };
|
package/dist/middleware.d.mts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
-
import { N as NextJSMiddlewareConfig } from './types-Chgi5TFC.mjs';
|
|
3
|
-
import '@kya-os/checkpoint-shared';
|
|
4
|
-
import '@kya-os/checkpoint';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Phase D — legacy TS-pattern-matching middleware path is
|
|
8
|
-
* gone. This file now exists only to preserve the historical export
|
|
9
|
-
* surface (`createAgentShieldMiddleware`, `agentShield`) at compile
|
|
10
|
-
* time. Calling either function throws a clear migration error.
|
|
11
|
-
*
|
|
12
|
-
* Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`
|
|
13
|
-
* (Node runtime) or `@kya-os/checkpoint-nextjs/edge` (Edge runtime).
|
|
14
|
-
* The new factory accepts a `CheckpointConfig` and routes every
|
|
15
|
-
* verification through the Rust `kya-os-engine` via WASM. See the
|
|
16
|
-
* package CHANGELOG for the recipe.
|
|
17
|
-
*
|
|
18
|
-
* Architect Q10 deletion ratification — the 600-line TS pattern
|
|
19
|
-
* matcher (`edge-detector-wrapper.ts`) was removed in Phase D's
|
|
20
|
-
* cutover. The new path is structurally simpler and decisive: one
|
|
21
|
-
* engine, one verdict, every runtime.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
26
|
-
* Throws on invocation; surface exists only so static analysis sees
|
|
27
|
-
* the historical export.
|
|
28
|
-
*/
|
|
29
|
-
declare function createAgentShieldMiddleware(_config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Alias of the deprecated `createAgentShieldMiddleware`.
|
|
32
|
-
* Migrate to `withCheckpoint`.
|
|
33
|
-
*/
|
|
34
|
-
declare function agentShield(config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
35
|
-
/**
|
|
36
|
-
* Pass-through export required by Next.js 16+ middleware file validation.
|
|
37
|
-
* Next.js requires any file named `middleware.ts` to export a function named
|
|
38
|
-
* `middleware` or a default function. This stub satisfies that constraint so
|
|
39
|
-
* consumers that still reference the `./middleware` subpath can build.
|
|
40
|
-
*
|
|
41
|
-
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
42
|
-
*/
|
|
43
|
-
declare function middleware(_request: NextRequest): NextResponse<unknown>;
|
|
44
|
-
|
|
45
|
-
export { agentShield, createAgentShieldMiddleware, middleware };
|
package/dist/middleware.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
-
import { N as NextJSMiddlewareConfig } from './types-Chgi5TFC.js';
|
|
3
|
-
import '@kya-os/checkpoint-shared';
|
|
4
|
-
import '@kya-os/checkpoint';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Phase D — legacy TS-pattern-matching middleware path is
|
|
8
|
-
* gone. This file now exists only to preserve the historical export
|
|
9
|
-
* surface (`createAgentShieldMiddleware`, `agentShield`) at compile
|
|
10
|
-
* time. Calling either function throws a clear migration error.
|
|
11
|
-
*
|
|
12
|
-
* Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`
|
|
13
|
-
* (Node runtime) or `@kya-os/checkpoint-nextjs/edge` (Edge runtime).
|
|
14
|
-
* The new factory accepts a `CheckpointConfig` and routes every
|
|
15
|
-
* verification through the Rust `kya-os-engine` via WASM. See the
|
|
16
|
-
* package CHANGELOG for the recipe.
|
|
17
|
-
*
|
|
18
|
-
* Architect Q10 deletion ratification — the 600-line TS pattern
|
|
19
|
-
* matcher (`edge-detector-wrapper.ts`) was removed in Phase D's
|
|
20
|
-
* cutover. The new path is structurally simpler and decisive: one
|
|
21
|
-
* engine, one verdict, every runtime.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
26
|
-
* Throws on invocation; surface exists only so static analysis sees
|
|
27
|
-
* the historical export.
|
|
28
|
-
*/
|
|
29
|
-
declare function createAgentShieldMiddleware(_config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Alias of the deprecated `createAgentShieldMiddleware`.
|
|
32
|
-
* Migrate to `withCheckpoint`.
|
|
33
|
-
*/
|
|
34
|
-
declare function agentShield(config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
35
|
-
/**
|
|
36
|
-
* Pass-through export required by Next.js 16+ middleware file validation.
|
|
37
|
-
* Next.js requires any file named `middleware.ts` to export a function named
|
|
38
|
-
* `middleware` or a default function. This stub satisfies that constraint so
|
|
39
|
-
* consumers that still reference the `./middleware` subpath can build.
|
|
40
|
-
*
|
|
41
|
-
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
42
|
-
*/
|
|
43
|
-
declare function middleware(_request: NextRequest): NextResponse<unknown>;
|
|
44
|
-
|
|
45
|
-
export { agentShield, createAgentShieldMiddleware, middleware };
|
package/dist/middleware.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var server = require('next/server');
|
|
4
|
-
|
|
5
|
-
// src/middleware.ts
|
|
6
|
-
var MIGRATION_ERROR = "@kya-os/checkpoint-nextjs's `createAgentShieldMiddleware` / `agentShield` were deleted in Phase D (engine consolidation). The 600-line TS pattern matcher that backed them is gone. Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs` (Node runtime) or `@kya-os/checkpoint-nextjs/edge` (Edge runtime). See packages/checkpoint-nextjs/CHANGELOG.md (1.0.0) for the recipe.";
|
|
7
|
-
function createAgentShieldMiddleware(_config = {}) {
|
|
8
|
-
throw new Error(MIGRATION_ERROR);
|
|
9
|
-
}
|
|
10
|
-
function agentShield(config = {}) {
|
|
11
|
-
return createAgentShieldMiddleware(config);
|
|
12
|
-
}
|
|
13
|
-
function middleware(_request) {
|
|
14
|
-
return server.NextResponse.next();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.agentShield = agentShield;
|
|
18
|
-
exports.createAgentShieldMiddleware = createAgentShieldMiddleware;
|
|
19
|
-
exports.middleware = middleware;
|
package/dist/middleware.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
// src/middleware.ts
|
|
4
|
-
var MIGRATION_ERROR = "@kya-os/checkpoint-nextjs's `createAgentShieldMiddleware` / `agentShield` were deleted in Phase D (engine consolidation). The 600-line TS pattern matcher that backed them is gone. Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs` (Node runtime) or `@kya-os/checkpoint-nextjs/edge` (Edge runtime). See packages/checkpoint-nextjs/CHANGELOG.md (1.0.0) for the recipe.";
|
|
5
|
-
function createAgentShieldMiddleware(_config = {}) {
|
|
6
|
-
throw new Error(MIGRATION_ERROR);
|
|
7
|
-
}
|
|
8
|
-
function agentShield(config = {}) {
|
|
9
|
-
return createAgentShieldMiddleware(config);
|
|
10
|
-
}
|
|
11
|
-
function middleware(_request) {
|
|
12
|
-
return NextResponse.next();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { agentShield, createAgentShieldMiddleware, middleware };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Phase-D.9a — legacy Node.js WASM loader for the retired
|
|
3
|
-
* `agentshield-wasm` Rust crate. This file used `fs.readFileSync` to
|
|
4
|
-
* locate + load the legacy detector's WASM binary into the legacy
|
|
5
|
-
* detection class. Both the WASM crate (Phase-D.9a/D.9b) and the
|
|
6
|
-
* detection class (removed in AgentDetector-Deletion-2) are retired.
|
|
7
|
-
*
|
|
8
|
-
* Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs` — it
|
|
9
|
-
* loads the canonical `kya-os-engine` WASM automatically via
|
|
10
|
-
* `@kya-os/checkpoint-wasm-runtime`'s loaders. No manual `fs.readFileSync`
|
|
11
|
-
* needed; the runtime handles bundler resolution across Next.js Node +
|
|
12
|
-
* Edge runtimes.
|
|
13
|
-
*/
|
|
14
|
-
/** @internal — test-only reset for the one-shot warn latch. */
|
|
15
|
-
declare function __resetNodejsWasmWarningForTests(): void;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated Removed in Phase-D.9a. Use `withCheckpoint` from
|
|
18
|
-
* `@kya-os/checkpoint-nextjs` — it auto-loads `kya-os-engine` WASM
|
|
19
|
-
* via `@kya-os/checkpoint-wasm-runtime`. Throws on invocation; surface
|
|
20
|
-
* exists only so static analysis sees the historical export.
|
|
21
|
-
*/
|
|
22
|
-
declare function loadWasmNodejs(): Promise<boolean>;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Removed in Phase-D.9a. The runtime guard is no longer
|
|
25
|
-
* needed; `@kya-os/checkpoint-wasm-runtime`'s loaders auto-detect
|
|
26
|
-
* runtime via the `"node"` / `"edge-runtime"` export conditions.
|
|
27
|
-
* Throws on invocation; surface exists only for export-compatibility.
|
|
28
|
-
*/
|
|
29
|
-
declare function isNodejsRuntime(): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Removed in Phase-D.9a. Migrate to `withCheckpoint`.
|
|
32
|
-
* Throws on invocation; surface exists only for export-compatibility.
|
|
33
|
-
*/
|
|
34
|
-
declare function getWasmModule(): WebAssembly.Module | null;
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated Removed in Phase-D.9a. Migrate to `withCheckpoint`.
|
|
37
|
-
* Throws on invocation; surface exists only for export-compatibility.
|
|
38
|
-
*/
|
|
39
|
-
declare function isWasmInitialized(): boolean;
|
|
40
|
-
|
|
41
|
-
export { __resetNodejsWasmWarningForTests, getWasmModule, isNodejsRuntime, isWasmInitialized, loadWasmNodejs };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Phase-D.9a — legacy Node.js WASM loader for the retired
|
|
3
|
-
* `agentshield-wasm` Rust crate. This file used `fs.readFileSync` to
|
|
4
|
-
* locate + load the legacy detector's WASM binary into the legacy
|
|
5
|
-
* detection class. Both the WASM crate (Phase-D.9a/D.9b) and the
|
|
6
|
-
* detection class (removed in AgentDetector-Deletion-2) are retired.
|
|
7
|
-
*
|
|
8
|
-
* Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs` — it
|
|
9
|
-
* loads the canonical `kya-os-engine` WASM automatically via
|
|
10
|
-
* `@kya-os/checkpoint-wasm-runtime`'s loaders. No manual `fs.readFileSync`
|
|
11
|
-
* needed; the runtime handles bundler resolution across Next.js Node +
|
|
12
|
-
* Edge runtimes.
|
|
13
|
-
*/
|
|
14
|
-
/** @internal — test-only reset for the one-shot warn latch. */
|
|
15
|
-
declare function __resetNodejsWasmWarningForTests(): void;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated Removed in Phase-D.9a. Use `withCheckpoint` from
|
|
18
|
-
* `@kya-os/checkpoint-nextjs` — it auto-loads `kya-os-engine` WASM
|
|
19
|
-
* via `@kya-os/checkpoint-wasm-runtime`. Throws on invocation; surface
|
|
20
|
-
* exists only so static analysis sees the historical export.
|
|
21
|
-
*/
|
|
22
|
-
declare function loadWasmNodejs(): Promise<boolean>;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Removed in Phase-D.9a. The runtime guard is no longer
|
|
25
|
-
* needed; `@kya-os/checkpoint-wasm-runtime`'s loaders auto-detect
|
|
26
|
-
* runtime via the `"node"` / `"edge-runtime"` export conditions.
|
|
27
|
-
* Throws on invocation; surface exists only for export-compatibility.
|
|
28
|
-
*/
|
|
29
|
-
declare function isNodejsRuntime(): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Removed in Phase-D.9a. Migrate to `withCheckpoint`.
|
|
32
|
-
* Throws on invocation; surface exists only for export-compatibility.
|
|
33
|
-
*/
|
|
34
|
-
declare function getWasmModule(): WebAssembly.Module | null;
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated Removed in Phase-D.9a. Migrate to `withCheckpoint`.
|
|
37
|
-
* Throws on invocation; surface exists only for export-compatibility.
|
|
38
|
-
*/
|
|
39
|
-
declare function isWasmInitialized(): boolean;
|
|
40
|
-
|
|
41
|
-
export { __resetNodejsWasmWarningForTests, getWasmModule, isNodejsRuntime, isWasmInitialized, loadWasmNodejs };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/nodejs-wasm-loader.ts
|
|
4
|
-
var MIGRATION_ERROR = "`@kya-os/checkpoint-nextjs`'s `loadWasmNodejs` / `isNodejsRuntime` / `getWasmModule` / `isWasmInitialized` were deprecated in Phase-D.9a (legacy `agentshield-wasm` Rust crate retirement). The legacy detection class they fed was removed in AgentDetector-Deletion-2. Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs` \u2014 engine-backed via the Rust `kya-os-engine` crate, with automatic WASM loading via `@kya-os/checkpoint-wasm-runtime`. See packages/checkpoint-nextjs/README.md for the canonical recipe.";
|
|
5
|
-
var _nodejsWasmWarned = false;
|
|
6
|
-
function warnNodejsWasmDeprecated() {
|
|
7
|
-
if (_nodejsWasmWarned) return;
|
|
8
|
-
_nodejsWasmWarned = true;
|
|
9
|
-
if (typeof process !== "undefined" && process.env?.NODE_ENV === "production") return;
|
|
10
|
-
console.warn(`[Checkpoint] ${MIGRATION_ERROR}`);
|
|
11
|
-
}
|
|
12
|
-
function __resetNodejsWasmWarningForTests() {
|
|
13
|
-
_nodejsWasmWarned = false;
|
|
14
|
-
}
|
|
15
|
-
async function loadWasmNodejs() {
|
|
16
|
-
warnNodejsWasmDeprecated();
|
|
17
|
-
throw new Error(MIGRATION_ERROR);
|
|
18
|
-
}
|
|
19
|
-
function isNodejsRuntime() {
|
|
20
|
-
warnNodejsWasmDeprecated();
|
|
21
|
-
throw new Error(MIGRATION_ERROR);
|
|
22
|
-
}
|
|
23
|
-
function getWasmModule() {
|
|
24
|
-
warnNodejsWasmDeprecated();
|
|
25
|
-
throw new Error(MIGRATION_ERROR);
|
|
26
|
-
}
|
|
27
|
-
function isWasmInitialized() {
|
|
28
|
-
warnNodejsWasmDeprecated();
|
|
29
|
-
throw new Error(MIGRATION_ERROR);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
exports.__resetNodejsWasmWarningForTests = __resetNodejsWasmWarningForTests;
|
|
33
|
-
exports.getWasmModule = getWasmModule;
|
|
34
|
-
exports.isNodejsRuntime = isNodejsRuntime;
|
|
35
|
-
exports.isWasmInitialized = isWasmInitialized;
|
|
36
|
-
exports.loadWasmNodejs = loadWasmNodejs;
|