@kya-os/checkpoint-nextjs 1.9.0 → 1.10.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 +77 -0
- package/dist/adapt.d.mts +6 -34
- package/dist/adapt.d.mts.map +1 -0
- package/dist/adapt.d.ts +6 -34
- package/dist/adapt.d.ts.map +1 -0
- package/dist/adapt.js +78 -51
- package/dist/adapt.mjs +77 -48
- package/dist/adapt.mjs.map +1 -0
- package/dist/api-client.d.mts +150 -159
- package/dist/api-client.d.mts.map +1 -0
- package/dist/api-client.d.ts +150 -159
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +218 -204
- package/dist/api-client.mjs +217 -201
- package/dist/api-client.mjs.map +1 -0
- package/dist/api-middleware-CDSh3TSE.js +379 -0
- package/dist/api-middleware-CMDRoQik.mjs +357 -0
- package/dist/api-middleware-CMDRoQik.mjs.map +1 -0
- package/dist/api-middleware.d.mts +117 -131
- package/dist/api-middleware.d.mts.map +1 -0
- package/dist/api-middleware.d.ts +117 -131
- package/dist/api-middleware.d.ts.map +1 -0
- package/dist/api-middleware.js +8 -527
- package/dist/api-middleware.mjs +3 -521
- package/dist/composed-policy-BCaNiVHv.d.mts +98 -0
- package/dist/composed-policy-BCaNiVHv.d.mts.map +1 -0
- package/dist/composed-policy-zzJYNFTb.d.ts +98 -0
- package/dist/composed-policy-zzJYNFTb.d.ts.map +1 -0
- package/dist/composed-policy.d.mts +2 -115
- package/dist/composed-policy.d.ts +2 -115
- package/dist/composed-policy.js +122 -89
- package/dist/composed-policy.mjs +121 -86
- package/dist/composed-policy.mjs.map +1 -0
- package/dist/config-CbAg2mze.d.ts +255 -0
- package/dist/config-CbAg2mze.d.ts.map +1 -0
- package/dist/config-Doe0Tn53.d.mts +255 -0
- package/dist/config-Doe0Tn53.d.mts.map +1 -0
- package/dist/create-middleware.d.mts +7 -18
- package/dist/create-middleware.d.mts.map +1 -0
- package/dist/create-middleware.d.ts +7 -18
- package/dist/create-middleware.d.ts.map +1 -0
- package/dist/create-middleware.js +36 -31
- package/dist/create-middleware.mjs +35 -28
- package/dist/create-middleware.mjs.map +1 -0
- package/dist/edge/index.d.mts +64 -88
- package/dist/edge/index.d.mts.map +1 -0
- package/dist/edge/index.d.ts +64 -88
- package/dist/edge/index.d.ts.map +1 -0
- package/dist/edge/index.js +349 -264
- package/dist/edge/index.mjs +348 -261
- package/dist/edge/index.mjs.map +1 -0
- package/dist/edge-runtime-loader.d.mts +37 -65
- package/dist/edge-runtime-loader.d.mts.map +1 -0
- package/dist/edge-runtime-loader.d.ts +37 -65
- package/dist/edge-runtime-loader.d.ts.map +1 -0
- package/dist/edge-runtime-loader.js +268 -213
- package/dist/edge-runtime-loader.mjs +267 -210
- package/dist/edge-runtime-loader.mjs.map +1 -0
- package/dist/edge-wasm-middleware.d.mts +27 -46
- package/dist/edge-wasm-middleware.d.mts.map +1 -0
- package/dist/edge-wasm-middleware.d.ts +27 -46
- package/dist/edge-wasm-middleware.d.ts.map +1 -0
- package/dist/edge-wasm-middleware.js +26 -15
- package/dist/edge-wasm-middleware.mjs +25 -12
- package/dist/edge-wasm-middleware.mjs.map +1 -0
- package/dist/index.d.mts +10 -17
- package/dist/index.d.ts +10 -17
- package/dist/index.js +55 -1265
- package/dist/index.mjs +16 -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-BYQP9FND.mjs +165 -0
- package/dist/middleware-core-BYQP9FND.mjs.map +1 -0
- package/dist/middleware-core-D6TijE6P.js +175 -0
- package/dist/middleware-edge.d.mts +8 -14
- package/dist/middleware-edge.d.mts.map +1 -0
- package/dist/middleware-edge.d.ts +8 -14
- package/dist/middleware-edge.d.ts.map +1 -0
- package/dist/middleware-edge.js +41 -355
- package/dist/middleware-edge.mjs +39 -347
- package/dist/middleware-edge.mjs.map +1 -0
- package/dist/middleware-node-CE4GevYs.d.ts +20 -0
- package/dist/middleware-node-CE4GevYs.d.ts.map +1 -0
- package/dist/middleware-node-DtyOuPta.d.mts +20 -0
- package/dist/middleware-node-DtyOuPta.d.mts.map +1 -0
- package/dist/middleware-node-context-BqPbf-fI.mjs +34 -0
- package/dist/middleware-node-context-BqPbf-fI.mjs.map +1 -0
- package/dist/middleware-node-context-rgnc7UNR.js +38 -0
- package/dist/middleware-node.d.mts +3 -27
- package/dist/middleware-node.d.ts +3 -27
- package/dist/middleware-node.js +13 -351
- package/dist/middleware-node.mjs +11 -347
- package/dist/middleware-node.mjs.map +1 -0
- package/dist/middleware.d.mts +8 -28
- package/dist/middleware.d.mts.map +1 -0
- package/dist/middleware.d.ts +8 -28
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +43 -9
- package/dist/middleware.mjs +42 -6
- package/dist/middleware.mjs.map +1 -0
- package/dist/nodejs-wasm-loader.d.mts +8 -7
- package/dist/nodejs-wasm-loader.d.mts.map +1 -0
- package/dist/nodejs-wasm-loader.d.ts +8 -7
- package/dist/nodejs-wasm-loader.d.ts.map +1 -0
- package/dist/nodejs-wasm-loader.js +53 -19
- package/dist/nodejs-wasm-loader.mjs +52 -16
- package/dist/nodejs-wasm-loader.mjs.map +1 -0
- package/dist/policy.d.mts +86 -110
- package/dist/policy.d.mts.map +1 -0
- package/dist/policy.d.ts +86 -110
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +203 -165
- package/dist/policy.mjs +183 -152
- package/dist/policy.mjs.map +1 -0
- package/dist/session-tracker.d.mts +42 -47
- package/dist/session-tracker.d.mts.map +1 -0
- package/dist/session-tracker.d.ts +42 -47
- package/dist/session-tracker.d.ts.map +1 -0
- package/dist/session-tracker.js +141 -165
- package/dist/session-tracker.mjs +140 -162
- package/dist/session-tracker.mjs.map +1 -0
- package/dist/translate.d.mts +17 -32
- package/dist/translate.d.mts.map +1 -0
- package/dist/translate.d.ts +17 -32
- package/dist/translate.d.ts.map +1 -0
- package/dist/translate.js +69 -34
- package/dist/translate.mjs +68 -31
- package/dist/translate.mjs.map +1 -0
- package/dist/types-C0SkqLMM.d.mts +102 -0
- package/dist/types-C0SkqLMM.d.mts.map +1 -0
- package/dist/types-C7DNSCTO.d.ts +102 -0
- package/dist/types-C7DNSCTO.d.ts.map +1 -0
- package/dist/utils-Cj4XNhIY.mjs +35 -0
- package/dist/utils-Cj4XNhIY.mjs.map +1 -0
- package/dist/utils-DAisnYnI.js +45 -0
- package/dist/wasm-setup.d.mts +6 -5
- package/dist/wasm-setup.d.mts.map +1 -0
- package/dist/wasm-setup.d.ts +6 -5
- package/dist/wasm-setup.d.ts.map +1 -0
- package/dist/wasm-setup.js +82 -113
- package/dist/wasm-setup.mjs +85 -108
- package/dist/wasm-setup.mjs.map +1 -0
- package/package.json +8 -8
- package/dist/config-CleTeeoW.d.mts +0 -233
- package/dist/config-XMOIkxFN.d.ts +0 -233
- package/dist/types-Chgi5TFC.d.mts +0 -105
- package/dist/types-Chgi5TFC.d.ts +0 -105
package/dist/middleware-node.mjs
CHANGED
|
@@ -1,352 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { makeSystemClock, makePolicyEvaluator, makeReputationOracle, makeStatusListCache, makeDidResolver } from '@kya-os/checkpoint-wasm-runtime/adapters';
|
|
5
|
-
import { makeDetectionReporter } from '@kya-os/checkpoint-wasm-runtime/reporter';
|
|
6
|
-
import { selectBodyReadable200, resolveChallengeContext, PolicyFetcher, requestCarriesDelegationProof, resolveClientIp, acceptsHtml, encodeVerdictCookie, classifyResponseShape, BLOCKED_PATH, VERDICT_COOKIE_NAME } from '@kya-os/checkpoint-shared';
|
|
7
|
-
import { NextResponse } from 'next/server';
|
|
1
|
+
import { n as makeNextMiddleware, t as VERSION } from "./middleware-core-BYQP9FND.mjs";
|
|
2
|
+
import { t as buildComposedContext } from "./middleware-node-context-BqPbf-fI.mjs";
|
|
3
|
+
import { renderDecisionAsResponse, verifyRequest } from "@kya-os/checkpoint-wasm-runtime/orchestrator";
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const clientAcceptsHtml = acceptsHtml(req.headers);
|
|
12
|
-
const verdictCookie = encodeVerdictCookie(rendered);
|
|
13
|
-
const shape = classifyResponseShape(rendered, clientAcceptsHtml);
|
|
14
|
-
switch (shape) {
|
|
15
|
-
case "pass-through": {
|
|
16
|
-
const res = NextResponse.next();
|
|
17
|
-
applyHeaders(res, rendered);
|
|
18
|
-
setVerdictCookie(res, verdictCookie);
|
|
19
|
-
return res;
|
|
20
|
-
}
|
|
21
|
-
case "redirect": {
|
|
22
|
-
const target = new URL(rendered.headers.Location);
|
|
23
|
-
const res = NextResponse.redirect(target);
|
|
24
|
-
applyHeaders(res, rendered);
|
|
25
|
-
setVerdictCookie(res, verdictCookie);
|
|
26
|
-
return res;
|
|
27
|
-
}
|
|
28
|
-
case "html-block": {
|
|
29
|
-
const blockedUrl = new URL(BLOCKED_PATH, req.url);
|
|
30
|
-
const res = NextResponse.rewrite(blockedUrl, { status: 200 });
|
|
31
|
-
applyHeaders(res, rendered);
|
|
32
|
-
setVerdictCookie(res, verdictCookie);
|
|
33
|
-
return res;
|
|
34
|
-
}
|
|
35
|
-
case "json-block": {
|
|
36
|
-
const body = rendered.body ?? {};
|
|
37
|
-
const res = NextResponse.json(body, { status: rendered.status });
|
|
38
|
-
applyHeaders(res, rendered);
|
|
39
|
-
setVerdictCookie(res, verdictCookie);
|
|
40
|
-
return res;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function setVerdictCookie(res, value) {
|
|
45
|
-
res.cookies.set({
|
|
46
|
-
name: VERDICT_COOKIE_NAME,
|
|
47
|
-
value,
|
|
48
|
-
path: "/",
|
|
49
|
-
sameSite: "lax",
|
|
50
|
-
httpOnly: false
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function applyHeaders(res, rendered) {
|
|
54
|
-
for (const [key, value] of Object.entries(rendered.headers)) {
|
|
55
|
-
res.headers.set(key, value);
|
|
56
|
-
}
|
|
57
|
-
for (const [key, value] of rendered.headerEntries ?? []) {
|
|
58
|
-
res.headers.append(key, value);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
var DEFAULT_DASHBOARD_URL = "https://kya.vouched.id";
|
|
62
|
-
var NOOP_LOGGER = {
|
|
63
|
-
shadowDivergence: () => {
|
|
64
|
-
},
|
|
65
|
-
evaluationError: () => {
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
function makeComposedPolicyContext(opts) {
|
|
69
|
-
const { projectId, fetcher } = opts;
|
|
70
|
-
const cache = makeComposedPolicyCache({ compile: opts.compile, cacheMax: opts.cacheMax });
|
|
71
|
-
const logger = opts.logger ?? NOOP_LOGGER;
|
|
72
|
-
return {
|
|
73
|
-
async apply(result, path) {
|
|
74
|
-
const structured = { decision: result.decision, acted: false };
|
|
75
|
-
if (isCredentialVerificationBlock(result.decision)) return structured;
|
|
76
|
-
const policy = await fetcher.getPolicy(projectId);
|
|
77
|
-
const outcome = await evaluateComposedPolicy({
|
|
78
|
-
cache,
|
|
79
|
-
projectId,
|
|
80
|
-
flags: {
|
|
81
|
-
policyLanguage: policy.policyLanguage,
|
|
82
|
-
policySourceText: policy.policySourceText,
|
|
83
|
-
engineEnforcementEnabled: policy.engineEnforcementEnabled,
|
|
84
|
-
enabled: policy.enabled
|
|
85
|
-
},
|
|
86
|
-
authorizeInput: verifyResultToAuthorizeInput(result, { tenantId: projectId, path }),
|
|
87
|
-
baselineDecisionKind: result.decision.kind
|
|
88
|
-
});
|
|
89
|
-
if ((outcome.status === "acting" || outcome.status === "shadow") && outcome.diverged) {
|
|
90
|
-
logger.shadowDivergence({
|
|
91
|
-
projectId,
|
|
92
|
-
path,
|
|
93
|
-
engineDecision: outcome.engineDecision.kind,
|
|
94
|
-
structuredDecision: result.decision.kind,
|
|
95
|
-
detectionClass: result.detectionDetail.detectionClass.type,
|
|
96
|
-
verificationMethod: result.detectionDetail.verificationMethod,
|
|
97
|
-
confidence: result.detectionDetail.confidence,
|
|
98
|
-
agentName: result.detectionDetail.detectedAgent?.name
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
if (outcome.status === "error") {
|
|
102
|
-
logger.evaluationError(projectId, outcome.error);
|
|
103
|
-
return structured;
|
|
104
|
-
}
|
|
105
|
-
if (outcome.status === "acting") {
|
|
106
|
-
return {
|
|
107
|
-
decision: outcome.engineDecision,
|
|
108
|
-
acted: true,
|
|
109
|
-
// Echo the SSOT revision pin with the decision it produced (#3246
|
|
110
|
-
// PR5). Conditional spread: absent upstream stays absent here.
|
|
111
|
-
...policy.policySourceHash ? { composedBlobHash: policy.policySourceHash } : {}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return structured;
|
|
115
|
-
},
|
|
116
|
-
async trustedDelegationRoots() {
|
|
117
|
-
const policy = await fetcher.getPolicy(projectId);
|
|
118
|
-
return policy.trustedDelegationRoots ?? [];
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
async function resolveTrustedDelegationRootsForRequest(resolver, headers) {
|
|
123
|
-
if (!resolver) return void 0;
|
|
124
|
-
if (!requestCarriesDelegationProof(headers)) return void 0;
|
|
125
|
-
const roots = await resolver();
|
|
126
|
-
return roots.length > 0 ? roots : void 0;
|
|
127
|
-
}
|
|
128
|
-
async function applyComposedPolicy(context, result, path) {
|
|
129
|
-
if (!context) return;
|
|
130
|
-
try {
|
|
131
|
-
const outcome = await context.apply(result, path);
|
|
132
|
-
if (outcome.acted) {
|
|
133
|
-
result.decision = outcome.decision;
|
|
134
|
-
if (outcome.composedBlobHash) {
|
|
135
|
-
result.composedBlobHash = outcome.composedBlobHash;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
} catch {
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
var consoleComposedPolicyLogger = {
|
|
142
|
-
shadowDivergence(info) {
|
|
143
|
-
console.warn("[checkpoint/composed-policy] shadow-divergence", info);
|
|
144
|
-
},
|
|
145
|
-
evaluationError(projectId, error) {
|
|
146
|
-
console.error(
|
|
147
|
-
`[checkpoint/composed-policy] evaluation failed for ${projectId}; using structured decision:`,
|
|
148
|
-
error
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
async function nextRequestToHttpLike(req, opts = {}) {
|
|
153
|
-
const url = new URL(req.url);
|
|
154
|
-
const body = await tryDrainJsonBody(req, opts);
|
|
155
|
-
return {
|
|
156
|
-
method: req.method,
|
|
157
|
-
// Path + query only — orchestrator's URL parsing expects no scheme/host.
|
|
158
|
-
url: url.pathname + url.search,
|
|
159
|
-
headers: headersToRecord(req.headers),
|
|
160
|
-
body,
|
|
161
|
-
remoteAddress: extractRemoteAddress(req, opts.clientIpPolicy ?? { platform: "direct" })
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
async function tryDrainJsonBody(req, opts) {
|
|
165
|
-
if (opts.drainJsonBody === false) return null;
|
|
166
|
-
const contentType = req.headers.get("content-type") ?? "";
|
|
167
|
-
if (!contentType.toLowerCase().includes("application/json")) return null;
|
|
168
|
-
try {
|
|
169
|
-
return await req.clone().text();
|
|
170
|
-
} catch {
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
function headersToRecord(headers) {
|
|
175
|
-
const out = {};
|
|
176
|
-
headers.forEach((value, key) => {
|
|
177
|
-
out[key.toLowerCase()] = value;
|
|
178
|
-
});
|
|
179
|
-
return out;
|
|
180
|
-
}
|
|
181
|
-
function extractRemoteAddress(req, policy) {
|
|
182
|
-
const maybeIp = req.ip;
|
|
183
|
-
return resolveClientIp({
|
|
184
|
-
headers: req.headers,
|
|
185
|
-
frameworkAddress: maybeIp,
|
|
186
|
-
policy
|
|
187
|
-
}).ip ?? void 0;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// src/middleware-core.ts
|
|
191
|
-
function makeNextMiddleware(verifyRequest2, renderDecisionAsResponse2, config, host) {
|
|
192
|
-
if (config.browserPosture) validateBrowserPostureConfig(config.browserPosture, config.projectId);
|
|
193
|
-
if (config.browserPosture?.protectedRoutes?.length && !config.resolveDelegationChallenge) {
|
|
194
|
-
throw new Error(
|
|
195
|
-
"browserPosture.protectedRoutes requires resolveDelegationChallenge (see createBrowserIntegrityChallengeResolver)"
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
const opts = buildVerifyOpts(config);
|
|
199
|
-
const reporter = buildReporter(config, host.runtime);
|
|
200
|
-
const composed = host.buildComposedContext(config);
|
|
201
|
-
const trustedRootsResolver = buildTrustedRootsResolver(config, composed);
|
|
202
|
-
const translateOpts = {
|
|
203
|
-
drainJsonBody: config.drainJsonBody,
|
|
204
|
-
clientIpPolicy: config.clientIpPolicy
|
|
205
|
-
};
|
|
206
|
-
return async function checkpointMiddleware(req, event) {
|
|
207
|
-
const httpLike = await nextRequestToHttpLike(req, translateOpts);
|
|
208
|
-
const trustedDelegationRoots = await resolveTrustedDelegationRootsForRequest(
|
|
209
|
-
trustedRootsResolver,
|
|
210
|
-
req.headers
|
|
211
|
-
);
|
|
212
|
-
const result = await verifyRequest2(
|
|
213
|
-
httpLike,
|
|
214
|
-
trustedDelegationRoots ? { ...opts, trustedDelegationRoots } : opts
|
|
215
|
-
);
|
|
216
|
-
await applyBrowserPosture(
|
|
217
|
-
result,
|
|
218
|
-
req.headers.get("cookie"),
|
|
219
|
-
config.browserPosture,
|
|
220
|
-
config.projectId
|
|
221
|
-
);
|
|
222
|
-
await applyComposedPolicy(composed, result, req.nextUrl.pathname);
|
|
223
|
-
applyBrowserIntegrityStepUp(result, config.browserPosture, req.nextUrl.pathname);
|
|
224
|
-
if (reporter) {
|
|
225
|
-
const reportPromise = reporter(
|
|
226
|
-
result,
|
|
227
|
-
extractReporterContext(req, config.clientIpPolicy ?? { platform: "direct" })
|
|
228
|
-
);
|
|
229
|
-
if (event) {
|
|
230
|
-
event.waitUntil(reportPromise);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
await dispatchOnResult(config, result, req);
|
|
234
|
-
const bodyReadable200 = selectBodyReadable200(
|
|
235
|
-
config.delegationChallengeMode ?? "negotiated",
|
|
236
|
-
req.headers,
|
|
237
|
-
result.detectionDetail.detectionClass,
|
|
238
|
-
result.detectionDetail.isAgent
|
|
239
|
-
);
|
|
240
|
-
const challengeContextRequested = result.enforcementMode === "enforce" && result.decision.kind === "Challenge" && config.resolveDelegationChallenge !== void 0;
|
|
241
|
-
const delegationChallenge = challengeContextRequested ? await resolveChallengeContext(
|
|
242
|
-
config.resolveDelegationChallenge,
|
|
243
|
-
{ result, request: req },
|
|
244
|
-
{
|
|
245
|
-
timeoutMs: config.delegationChallengeTimeoutMs,
|
|
246
|
-
onFailure: config.onDelegationChallengeFailure
|
|
247
|
-
}
|
|
248
|
-
) : void 0;
|
|
249
|
-
const rendered = renderDecisionAsResponse2(result, {
|
|
250
|
-
bodyReadable200,
|
|
251
|
-
delegationChallenge: validateBrowserIntegrityChallenge(result, delegationChallenge),
|
|
252
|
-
challengeContextRequested
|
|
253
|
-
});
|
|
254
|
-
return adaptToNextResponse(rendered, req);
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
var SDK_NAME = "@kya-os/checkpoint-nextjs";
|
|
258
|
-
var VERSION = "1.9.0";
|
|
259
|
-
function buildReporter(config, runtime = "node") {
|
|
260
|
-
if (!config.apiKey) return null;
|
|
261
|
-
return makeDetectionReporter({
|
|
262
|
-
apiKey: config.apiKey,
|
|
263
|
-
baseUrl: config.baseUrl,
|
|
264
|
-
debug: config.debug,
|
|
265
|
-
// Self-identify (incl. node-vs-edge) so the dashboard can version-gate
|
|
266
|
-
// enforcement. Next.js EDGE composed enforcement is opt-in (needs
|
|
267
|
-
// `cedarWasmModule`), so the dashboard shows it as opt-in, never "Enforcing".
|
|
268
|
-
sdk: { name: SDK_NAME, version: VERSION, runtime }
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
function buildTrustedRootsResolver(config, composed) {
|
|
272
|
-
if (config.trustedDelegationRoots) return () => Promise.resolve(config.trustedDelegationRoots);
|
|
273
|
-
if (composed?.trustedDelegationRoots) {
|
|
274
|
-
return () => composed.trustedDelegationRoots();
|
|
275
|
-
}
|
|
276
|
-
if (!config.projectId) return null;
|
|
277
|
-
const fetcher = new PolicyFetcher({
|
|
278
|
-
apiBaseUrl: config.dashboardUrl ?? config.baseUrl ?? DEFAULT_DASHBOARD_URL,
|
|
279
|
-
apiKey: config.apiKey,
|
|
280
|
-
cacheTtlSeconds: config.policyCacheTtlSeconds
|
|
281
|
-
});
|
|
282
|
-
const projectId = config.projectId;
|
|
283
|
-
return async () => (await fetcher.getPolicy(projectId)).trustedDelegationRoots ?? [];
|
|
284
|
-
}
|
|
285
|
-
function extractReporterContext(req, policy) {
|
|
286
|
-
const resolution = resolveClientIp({
|
|
287
|
-
headers: req.headers,
|
|
288
|
-
frameworkAddress: req.ip,
|
|
289
|
-
policy
|
|
290
|
-
});
|
|
291
|
-
return {
|
|
292
|
-
userAgent: req.headers.get("user-agent") ?? void 0,
|
|
293
|
-
ipAddress: resolution.ip ?? void 0,
|
|
294
|
-
path: req.nextUrl.pathname,
|
|
295
|
-
url: req.nextUrl.href,
|
|
296
|
-
method: req.method
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
function buildVerifyOpts(config) {
|
|
300
|
-
const overrides = config.adapters ?? {};
|
|
301
|
-
return {
|
|
302
|
-
didResolver: overrides.didResolver ?? makeDidResolver(),
|
|
303
|
-
statusListCache: overrides.statusListCache ?? makeStatusListCache(),
|
|
304
|
-
reputationOracle: overrides.reputationOracle ?? makeReputationOracle({ argusUrl: config.argusUrl }),
|
|
305
|
-
policyEvaluator: overrides.policyEvaluator ?? makePolicyEvaluator({ dashboardUrl: config.dashboardUrl }),
|
|
306
|
-
clock: makeSystemClock(),
|
|
307
|
-
tenantHost: config.tenantHost,
|
|
308
|
-
resourceOrgDid: config.resourceOrgDid,
|
|
309
|
-
trustedDelegationRoots: config.trustedDelegationRoots,
|
|
310
|
-
enforcementMode: config.enforcementMode ?? "enforce",
|
|
311
|
-
reputationBaseline: config.reputationBaseline,
|
|
312
|
-
argusUrl: config.argusUrl,
|
|
313
|
-
legacyEnvelopeFallback: config.legacyEnvelopeFallback ?? false,
|
|
314
|
-
engineConfig: config.engineConfig
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
async function dispatchOnResult(config, result, req) {
|
|
318
|
-
if (!config.onResult) return;
|
|
319
|
-
try {
|
|
320
|
-
await config.onResult(result, req);
|
|
321
|
-
} catch {
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
function buildComposedContext(config) {
|
|
325
|
-
if (config.composedPolicyEnforcer) return config.composedPolicyEnforcer;
|
|
326
|
-
if (!config.projectId) return null;
|
|
327
|
-
return makeComposedPolicyContext({
|
|
328
|
-
projectId: config.projectId,
|
|
329
|
-
fetcher: new PolicyFetcher({
|
|
330
|
-
apiBaseUrl: config.dashboardUrl ?? config.baseUrl ?? DEFAULT_DASHBOARD_URL,
|
|
331
|
-
apiKey: config.apiKey,
|
|
332
|
-
cacheTtlSeconds: config.policyCacheTtlSeconds
|
|
333
|
-
}),
|
|
334
|
-
// Load the Node policy compiler only on first use. This module is imported
|
|
335
|
-
// exclusively by the Node and bundler hosts, never by the Edge pipeline.
|
|
336
|
-
compile: async (_language, source) => {
|
|
337
|
-
const { createPolicyEvaluator } = await import('@kya-os/checkpoint-wasm-runtime/policy');
|
|
338
|
-
return createPolicyEvaluator(source);
|
|
339
|
-
},
|
|
340
|
-
logger: config.debug ? consoleComposedPolicyLogger : void 0
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// src/middleware-node.ts
|
|
5
|
+
//#region src/middleware-node.ts
|
|
6
|
+
/** Node host with native filesystem WASM loading. */
|
|
345
7
|
function withCheckpoint(config) {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
8
|
+
return makeNextMiddleware(verifyRequest, renderDecisionAsResponse, config, {
|
|
9
|
+
runtime: "node",
|
|
10
|
+
buildComposedContext
|
|
11
|
+
});
|
|
350
12
|
}
|
|
351
13
|
|
|
14
|
+
//#endregion
|
|
352
15
|
export { VERSION, withCheckpoint };
|
|
16
|
+
//# sourceMappingURL=middleware-node.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware-node.mjs","names":[],"sources":["../src/middleware-node.ts"],"sourcesContent":["import {\n verifyRequest,\n renderDecisionAsResponse,\n} from '@kya-os/checkpoint-wasm-runtime/orchestrator';\nimport { makeNextMiddleware } from './middleware-core';\nimport { buildComposedContext } from './middleware-node-context';\nimport type { CheckpointConfig } from './config';\nexport type { CheckpointConfig } from './config';\n\n/** Node host with native filesystem WASM loading. */\nexport function withCheckpoint(config: CheckpointConfig) {\n return makeNextMiddleware(verifyRequest, renderDecisionAsResponse, config, {\n runtime: 'node',\n buildComposedContext,\n });\n}\n\nexport { VERSION } from './middleware-core';\n"],"mappings":";;;;;;AAUA,SAAgB,eAAe,QAA0B;CACvD,OAAO,mBAAmB,eAAe,0BAA0B,QAAQ;EACzE,SAAS;EACT;CACF,CAAC;AACH"}
|
package/dist/middleware.d.mts
CHANGED
|
@@ -1,37 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
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
|
-
|
|
1
|
+
import { r as NextJSMiddlewareConfig } from "./types-C0SkqLMM.mjs";
|
|
2
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
3
|
+
//#region src/middleware.d.ts
|
|
24
4
|
/**
|
|
25
5
|
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
26
6
|
* Throws on invocation; surface exists only so static analysis sees
|
|
27
7
|
* the historical export.
|
|
28
8
|
*/
|
|
29
|
-
declare function createAgentShieldMiddleware(_config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
9
|
+
export declare function createAgentShieldMiddleware(_config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
30
10
|
/**
|
|
31
11
|
* @deprecated Alias of the deprecated `createAgentShieldMiddleware`.
|
|
32
12
|
* Migrate to `withCheckpoint`.
|
|
33
13
|
*/
|
|
34
|
-
declare function agentShield(config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
14
|
+
export declare function agentShield(config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
35
15
|
/**
|
|
36
16
|
* Pass-through export required by Next.js 16+ middleware file validation.
|
|
37
17
|
* Next.js requires any file named `middleware.ts` to export a function named
|
|
@@ -40,6 +20,6 @@ declare function agentShield(config?: Partial<NextJSMiddlewareConfig>): (request
|
|
|
40
20
|
*
|
|
41
21
|
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
42
22
|
*/
|
|
43
|
-
declare function middleware(_request: NextRequest): NextResponse<unknown>;
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
export declare function middleware(_request: NextRequest): NextResponse<unknown>;
|
|
24
|
+
//#endregion
|
|
25
|
+
//# sourceMappingURL=middleware.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.mts","names":[],"sources":["../src/middleware.ts"],"mappings":";;;;;;;;wBAoCgB,4BACd,UAAS,QAAQ,2BACf,SAAS,gBAAgB,QAAQ;;;;;wBAQrB,YACd,SAAQ,QAAQ,2BACd,SAAS,gBAAgB,QAAQ;;;;;;;;;wBAYrB,WAAW,UAAU,cAAW"}
|
package/dist/middleware.d.ts
CHANGED
|
@@ -1,37 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
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
|
-
|
|
1
|
+
import { r as NextJSMiddlewareConfig } from "./types-C7DNSCTO.js";
|
|
2
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
3
|
+
//#region src/middleware.d.ts
|
|
24
4
|
/**
|
|
25
5
|
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
26
6
|
* Throws on invocation; surface exists only so static analysis sees
|
|
27
7
|
* the historical export.
|
|
28
8
|
*/
|
|
29
|
-
declare function createAgentShieldMiddleware(_config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
9
|
+
export declare function createAgentShieldMiddleware(_config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
30
10
|
/**
|
|
31
11
|
* @deprecated Alias of the deprecated `createAgentShieldMiddleware`.
|
|
32
12
|
* Migrate to `withCheckpoint`.
|
|
33
13
|
*/
|
|
34
|
-
declare function agentShield(config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
14
|
+
export declare function agentShield(config?: Partial<NextJSMiddlewareConfig>): (request: NextRequest) => Promise<NextResponse>;
|
|
35
15
|
/**
|
|
36
16
|
* Pass-through export required by Next.js 16+ middleware file validation.
|
|
37
17
|
* Next.js requires any file named `middleware.ts` to export a function named
|
|
@@ -40,6 +20,6 @@ declare function agentShield(config?: Partial<NextJSMiddlewareConfig>): (request
|
|
|
40
20
|
*
|
|
41
21
|
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
42
22
|
*/
|
|
43
|
-
declare function middleware(_request: NextRequest): NextResponse<unknown>;
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
export declare function middleware(_request: NextRequest): NextResponse<unknown>;
|
|
24
|
+
//#endregion
|
|
25
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","names":[],"sources":["../src/middleware.ts"],"mappings":";;;;;;;;wBAoCgB,4BACd,UAAS,QAAQ,2BACf,SAAS,gBAAgB,QAAQ;;;;;wBAQrB,YACd,SAAQ,QAAQ,2BACd,SAAS,gBAAgB,QAAQ;;;;;;;;;wBAYrB,WAAW,UAAU,cAAW"}
|
package/dist/middleware.js
CHANGED
|
@@ -1,19 +1,53 @@
|
|
|
1
|
-
'
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let next_server = require("next/server");
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
//#region src/middleware.ts
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Phase D — legacy TS-pattern-matching middleware path is
|
|
7
|
+
* gone. This file now exists only to preserve the historical export
|
|
8
|
+
* surface (`createAgentShieldMiddleware`, `agentShield`) at compile
|
|
9
|
+
* time. Calling either function throws a clear migration error.
|
|
10
|
+
*
|
|
11
|
+
* Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`
|
|
12
|
+
* (Node runtime) or `@kya-os/checkpoint-nextjs/edge` (Edge runtime).
|
|
13
|
+
* The new factory accepts a `CheckpointConfig` and routes every
|
|
14
|
+
* verification through the Rust `kya-os-engine` via WASM. See the
|
|
15
|
+
* package CHANGELOG for the recipe.
|
|
16
|
+
*
|
|
17
|
+
* Architect Q10 deletion ratification — the 600-line TS pattern
|
|
18
|
+
* matcher (`edge-detector-wrapper.ts`) was removed in Phase D's
|
|
19
|
+
* cutover. The new path is structurally simpler and decisive: one
|
|
20
|
+
* engine, one verdict, every runtime.
|
|
21
|
+
*/
|
|
22
|
+
const 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.";
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
25
|
+
* Throws on invocation; surface exists only so static analysis sees
|
|
26
|
+
* the historical export.
|
|
27
|
+
*/
|
|
7
28
|
function createAgentShieldMiddleware(_config = {}) {
|
|
8
|
-
|
|
29
|
+
throw new Error(MIGRATION_ERROR);
|
|
9
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Alias of the deprecated `createAgentShieldMiddleware`.
|
|
33
|
+
* Migrate to `withCheckpoint`.
|
|
34
|
+
*/
|
|
10
35
|
function agentShield(config = {}) {
|
|
11
|
-
|
|
36
|
+
return createAgentShieldMiddleware(config);
|
|
12
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Pass-through export required by Next.js 16+ middleware file validation.
|
|
40
|
+
* Next.js requires any file named `middleware.ts` to export a function named
|
|
41
|
+
* `middleware` or a default function. This stub satisfies that constraint so
|
|
42
|
+
* consumers that still reference the `./middleware` subpath can build.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
45
|
+
*/
|
|
13
46
|
function middleware(_request) {
|
|
14
|
-
|
|
47
|
+
return next_server.NextResponse.next();
|
|
15
48
|
}
|
|
16
49
|
|
|
50
|
+
//#endregion
|
|
17
51
|
exports.agentShield = agentShield;
|
|
18
52
|
exports.createAgentShieldMiddleware = createAgentShieldMiddleware;
|
|
19
|
-
exports.middleware = middleware;
|
|
53
|
+
exports.middleware = middleware;
|
package/dist/middleware.mjs
CHANGED
|
@@ -1,15 +1,51 @@
|
|
|
1
|
-
import { NextResponse } from
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
//#region src/middleware.ts
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Phase D — legacy TS-pattern-matching middleware path is
|
|
6
|
+
* gone. This file now exists only to preserve the historical export
|
|
7
|
+
* surface (`createAgentShieldMiddleware`, `agentShield`) at compile
|
|
8
|
+
* time. Calling either function throws a clear migration error.
|
|
9
|
+
*
|
|
10
|
+
* Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`
|
|
11
|
+
* (Node runtime) or `@kya-os/checkpoint-nextjs/edge` (Edge runtime).
|
|
12
|
+
* The new factory accepts a `CheckpointConfig` and routes every
|
|
13
|
+
* verification through the Rust `kya-os-engine` via WASM. See the
|
|
14
|
+
* package CHANGELOG for the recipe.
|
|
15
|
+
*
|
|
16
|
+
* Architect Q10 deletion ratification — the 600-line TS pattern
|
|
17
|
+
* matcher (`edge-detector-wrapper.ts`) was removed in Phase D's
|
|
18
|
+
* cutover. The new path is structurally simpler and decisive: one
|
|
19
|
+
* engine, one verdict, every runtime.
|
|
20
|
+
*/
|
|
21
|
+
const 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.";
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
24
|
+
* Throws on invocation; surface exists only so static analysis sees
|
|
25
|
+
* the historical export.
|
|
26
|
+
*/
|
|
5
27
|
function createAgentShieldMiddleware(_config = {}) {
|
|
6
|
-
|
|
28
|
+
throw new Error(MIGRATION_ERROR);
|
|
7
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Alias of the deprecated `createAgentShieldMiddleware`.
|
|
32
|
+
* Migrate to `withCheckpoint`.
|
|
33
|
+
*/
|
|
8
34
|
function agentShield(config = {}) {
|
|
9
|
-
|
|
35
|
+
return createAgentShieldMiddleware(config);
|
|
10
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Pass-through export required by Next.js 16+ middleware file validation.
|
|
39
|
+
* Next.js requires any file named `middleware.ts` to export a function named
|
|
40
|
+
* `middleware` or a default function. This stub satisfies that constraint so
|
|
41
|
+
* consumers that still reference the `./middleware` subpath can build.
|
|
42
|
+
*
|
|
43
|
+
* @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.
|
|
44
|
+
*/
|
|
11
45
|
function middleware(_request) {
|
|
12
|
-
|
|
46
|
+
return NextResponse.next();
|
|
13
47
|
}
|
|
14
48
|
|
|
49
|
+
//#endregion
|
|
15
50
|
export { agentShield, createAgentShieldMiddleware, middleware };
|
|
51
|
+
//# sourceMappingURL=middleware.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.mjs","names":[],"sources":["../src/middleware.ts"],"sourcesContent":["/**\n * @deprecated Phase D — legacy TS-pattern-matching middleware path is\n * gone. This file now exists only to preserve the historical export\n * surface (`createAgentShieldMiddleware`, `agentShield`) at compile\n * time. Calling either function throws a clear migration error.\n *\n * Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`\n * (Node runtime) or `@kya-os/checkpoint-nextjs/edge` (Edge runtime).\n * The new factory accepts a `CheckpointConfig` and routes every\n * verification through the Rust `kya-os-engine` via WASM. See the\n * package CHANGELOG for the recipe.\n *\n * Architect Q10 deletion ratification — the 600-line TS pattern\n * matcher (`edge-detector-wrapper.ts`) was removed in Phase D's\n * cutover. The new path is structurally simpler and decisive: one\n * engine, one verdict, every runtime.\n */\n\nimport { NextResponse } from 'next/server';\nimport type { NextRequest } from 'next/server';\n\nimport type { NextJSMiddlewareConfig } from './types';\n\nconst MIGRATION_ERROR =\n \"@kya-os/checkpoint-nextjs's `createAgentShieldMiddleware` / `agentShield` \" +\n 'were deleted in Phase D (engine consolidation). The 600-line TS pattern ' +\n 'matcher that backed them is gone. Migrate to `withCheckpoint` from ' +\n '`@kya-os/checkpoint-nextjs` (Node runtime) or ' +\n '`@kya-os/checkpoint-nextjs/edge` (Edge runtime). ' +\n 'See packages/checkpoint-nextjs/CHANGELOG.md (1.0.0) for the recipe.';\n\n/**\n * @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.\n * Throws on invocation; surface exists only so static analysis sees\n * the historical export.\n */\nexport function createAgentShieldMiddleware(\n _config: Partial<NextJSMiddlewareConfig> = {}\n): (request: NextRequest) => Promise<NextResponse> {\n throw new Error(MIGRATION_ERROR);\n}\n\n/**\n * @deprecated Alias of the deprecated `createAgentShieldMiddleware`.\n * Migrate to `withCheckpoint`.\n */\nexport function agentShield(\n config: Partial<NextJSMiddlewareConfig> = {}\n): (request: NextRequest) => Promise<NextResponse> {\n return createAgentShieldMiddleware(config);\n}\n\n/**\n * Pass-through export required by Next.js 16+ middleware file validation.\n * Next.js requires any file named `middleware.ts` to export a function named\n * `middleware` or a default function. This stub satisfies that constraint so\n * consumers that still reference the `./middleware` subpath can build.\n *\n * @deprecated Migrate to `withCheckpoint` from `@kya-os/checkpoint-nextjs`.\n */\nexport function middleware(_request: NextRequest) {\n return NextResponse.next();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,kBACJ;;;;;;AAYF,SAAgB,4BACd,UAA2C,CAAC,GACK;CACjD,MAAM,IAAI,MAAM,eAAe;AACjC;;;;;AAMA,SAAgB,YACd,SAA0C,CAAC,GACM;CACjD,OAAO,4BAA4B,MAAM;AAC3C;;;;;;;;;AAUA,SAAgB,WAAW,UAAuB;CAChD,OAAO,aAAa,KAAK;AAC3B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/nodejs-wasm-loader.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* @deprecated Phase-D.9a — legacy Node.js WASM loader for the retired
|
|
3
4
|
* `agentshield-wasm` Rust crate. This file used `fs.readFileSync` to
|
|
@@ -12,30 +13,30 @@
|
|
|
12
13
|
* Edge runtimes.
|
|
13
14
|
*/
|
|
14
15
|
/** @internal — test-only reset for the one-shot warn latch. */
|
|
15
|
-
declare function __resetNodejsWasmWarningForTests(): void;
|
|
16
|
+
export declare function __resetNodejsWasmWarningForTests(): void;
|
|
16
17
|
/**
|
|
17
18
|
* @deprecated Removed in Phase-D.9a. Use `withCheckpoint` from
|
|
18
19
|
* `@kya-os/checkpoint-nextjs` — it auto-loads `kya-os-engine` WASM
|
|
19
20
|
* via `@kya-os/checkpoint-wasm-runtime`. Throws on invocation; surface
|
|
20
21
|
* exists only so static analysis sees the historical export.
|
|
21
22
|
*/
|
|
22
|
-
declare function loadWasmNodejs(): Promise<boolean>;
|
|
23
|
+
export declare function loadWasmNodejs(): Promise<boolean>;
|
|
23
24
|
/**
|
|
24
25
|
* @deprecated Removed in Phase-D.9a. The runtime guard is no longer
|
|
25
26
|
* needed; `@kya-os/checkpoint-wasm-runtime`'s loaders auto-detect
|
|
26
27
|
* runtime via the `"node"` / `"edge-runtime"` export conditions.
|
|
27
28
|
* Throws on invocation; surface exists only for export-compatibility.
|
|
28
29
|
*/
|
|
29
|
-
declare function isNodejsRuntime(): boolean;
|
|
30
|
+
export declare function isNodejsRuntime(): boolean;
|
|
30
31
|
/**
|
|
31
32
|
* @deprecated Removed in Phase-D.9a. Migrate to `withCheckpoint`.
|
|
32
33
|
* Throws on invocation; surface exists only for export-compatibility.
|
|
33
34
|
*/
|
|
34
|
-
declare function getWasmModule(): WebAssembly.Module | null;
|
|
35
|
+
export declare function getWasmModule(): WebAssembly.Module | null;
|
|
35
36
|
/**
|
|
36
37
|
* @deprecated Removed in Phase-D.9a. Migrate to `withCheckpoint`.
|
|
37
38
|
* Throws on invocation; surface exists only for export-compatibility.
|
|
38
39
|
*/
|
|
39
|
-
declare function isWasmInitialized(): boolean;
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
export declare function isWasmInitialized(): boolean;
|
|
41
|
+
//#endregion
|
|
42
|
+
//# sourceMappingURL=nodejs-wasm-loader.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodejs-wasm-loader.d.mts","names":[],"sources":["../src/nodejs-wasm-loader.ts"],"mappings":";;;;;;;;;;;;;;;wBAkCgB;;;;;;;wBAUM,kBAAkB;;;;;;;wBAWxB;;;;;wBASA,iBAAiB,YAAY;;;;;wBAS7B"}
|