@kya-os/checkpoint-nextjs 1.10.0 → 1.12.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 +261 -0
- package/README.md +217 -35
- package/dist/{adapt.mjs → adapt-BvqYgrAk.mjs} +15 -4
- package/dist/adapt-BvqYgrAk.mjs.map +1 -0
- package/dist/{adapt.js → adapt-DUEIfZnx.js} +34 -13
- 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 -204
- package/dist/api-client.d.ts +2 -204
- package/dist/api-client.js +19 -18
- package/dist/api-client.mjs +20 -16
- package/dist/api-client.mjs.map +1 -1
- package/dist/api-middleware-BtsYJU5u.d.mts +131 -0
- package/dist/api-middleware-BtsYJU5u.d.mts.map +1 -0
- package/dist/{api-middleware-CMDRoQik.mjs → api-middleware-DvmkJ_Li.mjs} +68 -38
- package/dist/api-middleware-DvmkJ_Li.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-CDSh3TSE.js → api-middleware-beNlXd5P.js} +75 -63
- package/dist/api-middleware.d.mts +2 -152
- package/dist/api-middleware.d.ts +2 -152
- package/dist/api-middleware.js +1 -5
- package/dist/api-middleware.mjs +2 -3
- 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-D7h2w_it.d.mts +89 -0
- package/dist/config-D7h2w_it.d.mts.map +1 -0
- package/dist/config-DkXvl4nH.d.ts +89 -0
- package/dist/config-DkXvl4nH.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 -10
- package/dist/index.d.ts +8 -10
- package/dist/index.js +20 -49
- package/dist/index.mjs +21 -8
- package/dist/index.mjs.map +1 -1
- package/dist/middleware-bundler.d.mts +1 -1
- package/dist/middleware-bundler.d.mts.map +1 -1
- package/dist/middleware-bundler.d.ts +1 -1
- package/dist/middleware-bundler.d.ts.map +1 -1
- package/dist/middleware-bundler.js +5 -5
- package/dist/middleware-bundler.mjs +5 -5
- package/dist/middleware-bundler.mjs.map +1 -1
- package/dist/middleware-core-B1GuspOY.js +169 -0
- package/dist/middleware-core-BmW2kH8J.d.ts +14 -0
- package/dist/middleware-core-BmW2kH8J.d.ts.map +1 -0
- package/dist/middleware-core-CnPUoD2v.d.mts +14 -0
- package/dist/middleware-core-CnPUoD2v.d.mts.map +1 -0
- package/dist/middleware-core-WZeMSRqx.mjs +159 -0
- package/dist/middleware-core-WZeMSRqx.mjs.map +1 -0
- package/dist/middleware-edge.d.mts +11 -3
- package/dist/middleware-edge.d.mts.map +1 -1
- package/dist/middleware-edge.d.ts +11 -3
- package/dist/middleware-edge.d.ts.map +1 -1
- package/dist/middleware-edge.js +68 -29
- package/dist/middleware-edge.mjs +68 -31
- package/dist/middleware-edge.mjs.map +1 -1
- package/dist/middleware-node-context-BvqrL2Ra.mjs +16 -0
- package/dist/middleware-node-context-BvqrL2Ra.mjs.map +1 -0
- package/dist/middleware-node-context-TRMTgp3y.js +20 -0
- package/dist/middleware-node.d.mts +12 -3
- package/dist/middleware-node.d.mts.map +1 -0
- package/dist/middleware-node.d.ts +12 -3
- package/dist/middleware-node.d.ts.map +1 -0
- package/dist/middleware-node.js +14 -6
- package/dist/middleware-node.mjs +14 -6
- package/dist/middleware-node.mjs.map +1 -1
- 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-Cw7Zj290.d.ts +5 -0
- package/dist/public-api-DgCw1uo6.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 +27 -62
- package/EDGE_RUNTIME_WASM_SETUP.md +0 -342
- package/bin/setup-edge-wasm.js +0 -513
- package/dist/adapt.d.mts +0 -11
- package/dist/adapt.d.mts.map +0 -1
- package/dist/adapt.d.ts +0 -11
- package/dist/adapt.d.ts.map +0 -1
- package/dist/adapt.mjs.map +0 -1
- package/dist/api-client.d.mts.map +0 -1
- package/dist/api-client.d.ts.map +0 -1
- package/dist/api-middleware-CMDRoQik.mjs.map +0 -1
- package/dist/api-middleware.d.mts.map +0 -1
- package/dist/api-middleware.d.ts.map +0 -1
- package/dist/composed-policy-BCaNiVHv.d.mts +0 -98
- package/dist/composed-policy-BCaNiVHv.d.mts.map +0 -1
- package/dist/composed-policy-zzJYNFTb.d.ts +0 -98
- package/dist/composed-policy-zzJYNFTb.d.ts.map +0 -1
- package/dist/composed-policy.d.mts +0 -2
- package/dist/composed-policy.d.ts +0 -2
- package/dist/composed-policy.js +0 -136
- package/dist/composed-policy.mjs +0 -132
- package/dist/composed-policy.mjs.map +0 -1
- package/dist/config-CbAg2mze.d.ts +0 -255
- package/dist/config-CbAg2mze.d.ts.map +0 -1
- package/dist/config-Doe0Tn53.d.mts +0 -255
- package/dist/config-Doe0Tn53.d.mts.map +0 -1
- package/dist/create-middleware.d.mts +0 -11
- package/dist/create-middleware.d.mts.map +0 -1
- package/dist/create-middleware.d.ts +0 -11
- package/dist/create-middleware.d.ts.map +0 -1
- package/dist/create-middleware.js +0 -39
- package/dist/create-middleware.mjs +0 -38
- package/dist/create-middleware.mjs.map +0 -1
- package/dist/edge/index.d.mts +0 -88
- package/dist/edge/index.d.mts.map +0 -1
- package/dist/edge/index.d.ts +0 -88
- package/dist/edge/index.d.ts.map +0 -1
- package/dist/edge/index.js +0 -362
- package/dist/edge/index.mjs +0 -362
- package/dist/edge/index.mjs.map +0 -1
- package/dist/edge-runtime-loader.d.mts +0 -49
- package/dist/edge-runtime-loader.d.mts.map +0 -1
- package/dist/edge-runtime-loader.d.ts +0 -49
- package/dist/edge-runtime-loader.d.ts.map +0 -1
- package/dist/edge-runtime-loader.js +0 -297
- package/dist/edge-runtime-loader.mjs +0 -292
- package/dist/edge-runtime-loader.mjs.map +0 -1
- package/dist/edge-wasm-middleware.d.mts +0 -43
- package/dist/edge-wasm-middleware.d.mts.map +0 -1
- package/dist/edge-wasm-middleware.d.ts +0 -43
- package/dist/edge-wasm-middleware.d.ts.map +0 -1
- package/dist/edge-wasm-middleware.js +0 -37
- package/dist/edge-wasm-middleware.mjs +0 -35
- package/dist/edge-wasm-middleware.mjs.map +0 -1
- package/dist/middleware-core-BYQP9FND.mjs +0 -165
- package/dist/middleware-core-BYQP9FND.mjs.map +0 -1
- package/dist/middleware-core-D6TijE6P.js +0 -175
- package/dist/middleware-node-CE4GevYs.d.ts +0 -20
- package/dist/middleware-node-CE4GevYs.d.ts.map +0 -1
- package/dist/middleware-node-DtyOuPta.d.mts +0 -20
- package/dist/middleware-node-DtyOuPta.d.mts.map +0 -1
- package/dist/middleware-node-context-BqPbf-fI.mjs +0 -34
- package/dist/middleware-node-context-BqPbf-fI.mjs.map +0 -1
- package/dist/middleware-node-context-rgnc7UNR.js +0 -38
- package/dist/middleware.d.mts +0 -25
- package/dist/middleware.d.mts.map +0 -1
- package/dist/middleware.d.ts +0 -25
- package/dist/middleware.d.ts.map +0 -1
- package/dist/middleware.js +0 -53
- package/dist/middleware.mjs +0 -51
- package/dist/middleware.mjs.map +0 -1
- package/dist/nodejs-wasm-loader.d.mts +0 -42
- package/dist/nodejs-wasm-loader.d.mts.map +0 -1
- package/dist/nodejs-wasm-loader.d.ts +0 -42
- package/dist/nodejs-wasm-loader.d.ts.map +0 -1
- package/dist/nodejs-wasm-loader.js +0 -70
- package/dist/nodejs-wasm-loader.mjs +0 -66
- package/dist/nodejs-wasm-loader.mjs.map +0 -1
- package/dist/policy.d.mts +0 -138
- package/dist/policy.d.mts.map +0 -1
- package/dist/policy.d.ts +0 -138
- package/dist/policy.d.ts.map +0 -1
- package/dist/policy.js +0 -236
- package/dist/policy.mjs +0 -205
- package/dist/policy.mjs.map +0 -1
- package/dist/session-tracker.d.mts +0 -50
- package/dist/session-tracker.d.mts.map +0 -1
- package/dist/session-tracker.d.ts +0 -50
- package/dist/session-tracker.d.ts.map +0 -1
- package/dist/session-tracker.js +0 -148
- package/dist/session-tracker.mjs +0 -147
- package/dist/session-tracker.mjs.map +0 -1
- package/dist/translate.d.mts +0 -48
- package/dist/translate.d.mts.map +0 -1
- package/dist/translate.d.ts +0 -48
- package/dist/translate.d.ts.map +0 -1
- package/dist/translate.js +0 -79
- package/dist/translate.mjs +0 -79
- package/dist/translate.mjs.map +0 -1
- package/dist/types-C0SkqLMM.d.mts +0 -102
- package/dist/types-C0SkqLMM.d.mts.map +0 -1
- package/dist/types-C7DNSCTO.d.ts +0 -102
- package/dist/types-C7DNSCTO.d.ts.map +0 -1
- package/dist/utils-Cj4XNhIY.mjs +0 -35
- package/dist/utils-Cj4XNhIY.mjs.map +0 -1
- package/dist/utils-DAisnYnI.js +0 -45
- package/dist/wasm-setup.d.mts +0 -47
- package/dist/wasm-setup.d.mts.map +0 -1
- package/dist/wasm-setup.d.ts +0 -47
- package/dist/wasm-setup.d.ts.map +0 -1
- package/dist/wasm-setup.js +0 -91
- package/dist/wasm-setup.mjs +0 -95
- package/dist/wasm-setup.mjs.map +0 -1
- 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,255 +0,0 @@
|
|
|
1
|
-
import { n as ComposedPolicyContext } from "./composed-policy-zzJYNFTb.js";
|
|
2
|
-
import { NextRequest } from "next/server";
|
|
3
|
-
import { ChallengeContextFailureEvent, ChallengeEnvelopeMode, ChallengeWireInput, ClientIpTrustPolicy } from "@kya-os/checkpoint-shared";
|
|
4
|
-
import { EnforcementMode, EngineConfig, VerifyResult } from "@kya-os/checkpoint-wasm-runtime/engine";
|
|
5
|
-
import { BrowserPostureConfig } from "@kya-os/checkpoint-shared/browser-posture";
|
|
6
|
-
import { DidResolverAdapter, PolicyEvaluatorAdapter, ReputationOracleAdapter, StatusListCacheAdapter } from "@kya-os/checkpoint-wasm-runtime/adapters";
|
|
7
|
-
//#region src/config.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* Configuration for `withCheckpoint`.
|
|
10
|
-
*
|
|
11
|
-
* The new minimal shape Phase D's middleware needs. Legacy
|
|
12
|
-
* `AgentShieldMiddlewareConfig` (from `./api-middleware`) remains
|
|
13
|
-
* exported during the deprecation window — see D.4 cutover.
|
|
14
|
-
*/
|
|
15
|
-
interface CheckpointConfig {
|
|
16
|
-
/**
|
|
17
|
-
* Selects the infrastructure allowed to vouch for client IP headers.
|
|
18
|
-
* Defaults to direct peer/framework resolution; set `platform: 'vercel'`
|
|
19
|
-
* for Vercel-hosted requests or `platform: 'trusted-proxy'` with an
|
|
20
|
-
* explicit hop count for a configured proxy chain.
|
|
21
|
-
*/
|
|
22
|
-
clientIpPolicy?: ClientIpTrustPolicy;
|
|
23
|
-
/**
|
|
24
|
-
* Tenant identifier — typically the customer's dashboard hostname
|
|
25
|
-
* (e.g. `acme.checkpoint.example`). The PolicyEvaluator uses this
|
|
26
|
-
* to look up tenant policy from the dashboard.
|
|
27
|
-
*/
|
|
28
|
-
tenantHost: string;
|
|
29
|
-
/** Exact org DID used to verify the consent credential's audience. */
|
|
30
|
-
resourceOrgDid?: string;
|
|
31
|
-
/** Explicit trusted delegation issuers; otherwise resolved from project policy. */
|
|
32
|
-
trustedDelegationRoots?: string[];
|
|
33
|
-
/**
|
|
34
|
-
* `'enforce'` (default) blocks; `'observe'` passes everything
|
|
35
|
-
* through with `X-Checkpoint-Would-Have-Been` headers. Per Phase 0.2.
|
|
36
|
-
*
|
|
37
|
-
* @default 'enforce'
|
|
38
|
-
*/
|
|
39
|
-
enforcementMode?: EnforcementMode;
|
|
40
|
-
/**
|
|
41
|
-
* Challenge-emission envelope mode (draft-kya-http-02 §8.1 fetcher-200).
|
|
42
|
-
* `negotiated` serves a body-readable HTTP 200 step-up response to
|
|
43
|
-
* cooperative agents (fetchers that drop 4xx/5xx bodies), keeping the spec
|
|
44
|
-
* 401/422 for everyone else. Defaults to `negotiated` (#3530). A cooperative-UX
|
|
45
|
-
* bridge, NOT an access control.
|
|
46
|
-
*
|
|
47
|
-
* @default 'negotiated'
|
|
48
|
-
*/
|
|
49
|
-
delegationChallengeMode?: ChallengeEnvelopeMode;
|
|
50
|
-
/**
|
|
51
|
-
* Resolve a policy `Challenge` into complete registered wire context.
|
|
52
|
-
* The callback performs any Authorization-Host registration asynchronously;
|
|
53
|
-
* the synchronous engine renderer never fabricates a sid, consent URI, or proof.
|
|
54
|
-
*/
|
|
55
|
-
resolveDelegationChallenge?: (context: {
|
|
56
|
-
result: VerifyResult;
|
|
57
|
-
request: NextRequest;
|
|
58
|
-
}) => ChallengeWireInput | undefined | Promise<ChallengeWireInput | undefined>;
|
|
59
|
-
/**
|
|
60
|
-
* Registration/resolution budget in milliseconds.
|
|
61
|
-
*
|
|
62
|
-
* @default 3000
|
|
63
|
-
*/
|
|
64
|
-
delegationChallengeTimeoutMs?: number;
|
|
65
|
-
/** Sanitized registration failure hook for metrics and operator warnings. */
|
|
66
|
-
onDelegationChallengeFailure?: (event: ChallengeContextFailureEvent) => void;
|
|
67
|
-
/**
|
|
68
|
-
* Argus reputation oracle base URL. Omit to use the trust-by-default
|
|
69
|
-
* baseline (reputation defaults to 1.0; orchestrator logs a one-shot
|
|
70
|
-
* warning at first request).
|
|
71
|
-
*/
|
|
72
|
-
argusUrl?: string;
|
|
73
|
-
/**
|
|
74
|
-
* Dashboard base URL for the PolicyEvaluator to fetch tenant policy
|
|
75
|
-
* from. Omit to use the open-by-default tenant policy.
|
|
76
|
-
*/
|
|
77
|
-
dashboardUrl?: string;
|
|
78
|
-
/**
|
|
79
|
-
* Returned to the PolicyEvaluator for anonymous requests (no agent
|
|
80
|
-
* DID). Trust-by-default. Engine scale is `0.0` to `1.0`.
|
|
81
|
-
*
|
|
82
|
-
* @default 1.0
|
|
83
|
-
*/
|
|
84
|
-
reputationBaseline?: number;
|
|
85
|
-
/**
|
|
86
|
-
* Pre-built adapter instances. Production deployments use the
|
|
87
|
-
* factory-built defaults from `@kya-os/checkpoint-wasm-runtime/adapters`;
|
|
88
|
-
* tests use stubs. The factory composes any provided overrides over
|
|
89
|
-
* defaults — partial overrides are supported.
|
|
90
|
-
*/
|
|
91
|
-
adapters?: Partial<{
|
|
92
|
-
didResolver: DidResolverAdapter;
|
|
93
|
-
statusListCache: StatusListCacheAdapter;
|
|
94
|
-
reputationOracle: ReputationOracleAdapter;
|
|
95
|
-
policyEvaluator: PolicyEvaluatorAdapter;
|
|
96
|
-
}>;
|
|
97
|
-
/**
|
|
98
|
-
* Optional callback for the post-verdict path — fires after every
|
|
99
|
-
* verification, regardless of permit/block, with the full
|
|
100
|
-
* `VerifyResult`. Use for logging, dashboards, telemetry. Errors
|
|
101
|
-
* thrown here are swallowed so user code can't break the middleware
|
|
102
|
-
* response.
|
|
103
|
-
*/
|
|
104
|
-
onResult?: (result: VerifyResult, req: NextRequest) => void | Promise<void>;
|
|
105
|
-
/**
|
|
106
|
-
* Accept legacy `KYA-Delegation`-header envelope form alongside the
|
|
107
|
-
* canonical `_meta.proof.jws` body form. Default `false`.
|
|
108
|
-
*
|
|
109
|
-
* **When to enable** — customers whose agents pre-date Envelope-1
|
|
110
|
-
* (#2537) and ship KYA-OS proofs as `{protected,payload,signature}`
|
|
111
|
-
* JSON in a `KYA-Delegation` HTTP header. Post-Envelope-1 agents
|
|
112
|
-
* ship compact JWS in the request body's `_meta.proof.jws` field;
|
|
113
|
-
* those don't need this flag.
|
|
114
|
-
*
|
|
115
|
-
* Forwarded to the orchestrator's `VerifyRequestOpts.legacyEnvelopeFallback`.
|
|
116
|
-
* Both transports (header + body) are honored when this is `true`;
|
|
117
|
-
* the orchestrator's detection order is body first, then header
|
|
118
|
-
* (`packages/checkpoint-wasm-runtime/src/engine/orchestrator/build-agent-request.ts`).
|
|
119
|
-
*
|
|
120
|
-
* SDK-Envelope-Plumbing-1 (#2594). Added in `@kya-os/checkpoint-nextjs@1.1.0`.
|
|
121
|
-
*
|
|
122
|
-
* @default false
|
|
123
|
-
*/
|
|
124
|
-
legacyEnvelopeFallback?: boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Read the request body when `content-type` is `application/json` so
|
|
127
|
-
* the orchestrator can extract a KYA-OS envelope from
|
|
128
|
-
* `_meta.proof.jws`. Default `true`.
|
|
129
|
-
*
|
|
130
|
-
* **When to disable** — streaming middlewares that can't tolerate
|
|
131
|
-
* the `req.clone()` memory overhead (one full-body copy is buffered
|
|
132
|
-
* during the read). For those, set `false` and route KYA-OS
|
|
133
|
-
* envelopes through the `KYA-Delegation` header transport instead
|
|
134
|
-
* (requires `legacyEnvelopeFallback: true`).
|
|
135
|
-
*
|
|
136
|
-
* The clone preserves `req.body` for downstream handlers — disabling
|
|
137
|
-
* is a performance optimization, not a correctness fix.
|
|
138
|
-
*
|
|
139
|
-
* SDK-Envelope-Plumbing-1 (#2594). Added in `@kya-os/checkpoint-nextjs@1.1.0`.
|
|
140
|
-
*
|
|
141
|
-
* @default true
|
|
142
|
-
*/
|
|
143
|
-
drainJsonBody?: boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Engine-default behaviour knobs forwarded to every composed
|
|
146
|
-
* `ContextSpec`. Defaults to `{ tier3Action: 'monitor' }` —
|
|
147
|
-
* customer-onboarding-safe (tenant policy decides; engine doesn't
|
|
148
|
-
* short-circuit known-agent UAs with an engine-default Block).
|
|
149
|
-
*
|
|
150
|
-
* Opt into `{ tier3Action: 'block' }` when the host wants the
|
|
151
|
-
* calibrated engine-default block for KnownAiAgent / AiCrawler /
|
|
152
|
-
* HeadlessBrowser classifications BEFORE the tenant policy seam.
|
|
153
|
-
*
|
|
154
|
-
* Added in `@kya-os/checkpoint-nextjs@1.2.0` (Engine-Tier3-Monitor-
|
|
155
|
-
* Default, #2653 + this PR's plumbing follow-up).
|
|
156
|
-
*
|
|
157
|
-
* @default { tier3Action: 'monitor' }
|
|
158
|
-
*/
|
|
159
|
-
engineConfig?: EngineConfig;
|
|
160
|
-
/**
|
|
161
|
-
* Project API key. Required for detections to land in the dashboard
|
|
162
|
-
* — the engine verifies in-process via WASM, but the resulting
|
|
163
|
-
* `VerifyResult` only reaches the dashboard's `detections` table
|
|
164
|
-
* when this reporter is configured. Without it the verdict path
|
|
165
|
-
* works locally but the onboarding "Verify connection" check fails
|
|
166
|
-
* forever because no rows are ever written.
|
|
167
|
-
*
|
|
168
|
-
* Resolve from `process.env.CHECKPOINT_API_KEY` in the host app.
|
|
169
|
-
*
|
|
170
|
-
* Added in `@kya-os/checkpoint-nextjs@1.4.0`
|
|
171
|
-
* (SDK-Detection-Reporter-1).
|
|
172
|
-
*/
|
|
173
|
-
apiKey?: string;
|
|
174
|
-
/**
|
|
175
|
-
* Dashboard base URL. Override for staging or self-hosted dashboards.
|
|
176
|
-
*
|
|
177
|
-
* @default 'https://kya.vouched.id'
|
|
178
|
-
*/
|
|
179
|
-
baseUrl?: string;
|
|
180
|
-
/**
|
|
181
|
-
* Surface reporter errors via `console.warn`. Defaults to `false`.
|
|
182
|
-
* The reporter is fire-and-forget; enable during development to
|
|
183
|
-
* confirm `apiKey` / `baseUrl` are routed correctly.
|
|
184
|
-
*
|
|
185
|
-
* Also wires the composed-policy shadow-divergence + fail-open
|
|
186
|
-
* telemetry to `console.warn`/`console.error` (otherwise silent).
|
|
187
|
-
*
|
|
188
|
-
* @default false
|
|
189
|
-
*/
|
|
190
|
-
debug?: boolean;
|
|
191
|
-
/**
|
|
192
|
-
* Project id whose composed (/policy-compose) policy this middleware
|
|
193
|
-
* enforces. When set, the project's policy is fetched from the dashboard
|
|
194
|
-
* (`<dashboardUrl ?? baseUrl ?? default>/api/internal/policies/${projectId}`)
|
|
195
|
-
* and — if it carries a deployed Cedar bundle with `engineEnforcementEnabled`
|
|
196
|
-
* on — the kya-os-engine decision is enforced IN-PROCESS, byte-for-byte the
|
|
197
|
-
* same as the DNS Gateway. Omit to run detection + the structured policy only
|
|
198
|
-
* (fully back-compatible; purely additive).
|
|
199
|
-
*
|
|
200
|
-
* SHADOW-FIRST: with a deployed bundle but `engineEnforcementEnabled` off, the
|
|
201
|
-
* engine decision is computed + logged on divergence but does NOT act.
|
|
202
|
-
*
|
|
203
|
-
* **Node vs Edge:** composed enforcement is default-on under the Node runtime
|
|
204
|
-
* (`./node`). Under the Edge runtime (`./edge`) it additionally requires
|
|
205
|
-
* `cedarWasmModule` to be wired (see below) — otherwise the seam stays inert.
|
|
206
|
-
*
|
|
207
|
-
* Added in `@kya-os/checkpoint-nextjs@1.5.0` (@Policy middleware-Cedar, #3076).
|
|
208
|
-
*/
|
|
209
|
-
projectId?: string;
|
|
210
|
-
/** Signed browser risk; configure explicit route scopes to enable consent step-up. */
|
|
211
|
-
browserPosture?: BrowserPostureConfig;
|
|
212
|
-
/**
|
|
213
|
-
* Policy-fetch cache TTL in seconds. Defaults to 300 (5 minutes). How long
|
|
214
|
-
* a fetched project policy is reused before the middleware refetches from
|
|
215
|
-
* the dashboard — i.e. the worst-case delay before a dashboard policy
|
|
216
|
-
* change takes effect on this host.
|
|
217
|
-
*
|
|
218
|
-
* `0` disables reuse entirely: every request fetches the policy (one
|
|
219
|
-
* origin round-trip per request). Use for demo/example sites where instant
|
|
220
|
-
* policy propagation matters more than latency; keep the default (or a
|
|
221
|
-
* small positive value like 5) for production and benchmark hosts.
|
|
222
|
-
*
|
|
223
|
-
* @default 300
|
|
224
|
-
*/
|
|
225
|
-
policyCacheTtlSeconds?: number;
|
|
226
|
-
/**
|
|
227
|
-
* Advanced / testing: inject a pre-built composed-policy context instead of
|
|
228
|
-
* letting `withCheckpoint` construct one from `projectId` + `baseUrl` +
|
|
229
|
-
* `apiKey`. Mirrors the `adapters` injection philosophy — production omits
|
|
230
|
-
* this. When set, it takes precedence over `projectId`.
|
|
231
|
-
*/
|
|
232
|
-
composedPolicyEnforcer?: ComposedPolicyContext;
|
|
233
|
-
/**
|
|
234
|
-
* EDGE runtime only. The cedar-web `WebAssembly.Module`, statically imported
|
|
235
|
-
* by the host so composed-policy Cedar can compile at the edge:
|
|
236
|
-
*
|
|
237
|
-
* ```ts
|
|
238
|
-
* import cedarWasmModule from
|
|
239
|
-
* '@kya-os/checkpoint-wasm-runtime/wasm/kya-os-engine-cedar-web/kya_os_engine_bg.wasm?module';
|
|
240
|
-
* export default withCheckpoint({ projectId, cedarWasmModule });
|
|
241
|
-
* ```
|
|
242
|
-
*
|
|
243
|
-
* The ~2 MB cedar binary is deliberately NOT bundled into the SDK — wiring it
|
|
244
|
-
* is the consumer's explicit opt-in for edge composed enforcement (requires
|
|
245
|
-
* `experiments.asyncWebAssembly` + a `.wasm` asset rule in `next.config`).
|
|
246
|
-
* Without it the Edge seam stays inert (behaves exactly as 1.4.0); the Node
|
|
247
|
-
* runtime ignores this field (it loads cedar via `createPolicyEvaluator`).
|
|
248
|
-
*
|
|
249
|
-
* Added in `@kya-os/checkpoint-nextjs@1.5.0` (@Policy middleware-Cedar, #3076).
|
|
250
|
-
*/
|
|
251
|
-
cedarWasmModule?: WebAssembly.Module;
|
|
252
|
-
}
|
|
253
|
-
//#endregion
|
|
254
|
-
export { CheckpointConfig as t };
|
|
255
|
-
//# sourceMappingURL=config-CbAg2mze.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-CbAg2mze.d.ts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;;;;;;UAuCiB;;;;;;;EAOf,iBAAiB;;;;;;EAMjB;;EAEA;;EAEA;;;;;;;EAQA,kBAAkB;;;;;;;;;;EAWlB,0BAA0B;;;;;;EAO1B,8BAA8B;IAC5B,QAAQ;IACR,SAAS;QACL,iCAAiC,QAAQ;;;;;;EAO/C;;EAGA,gCAAgC,OAAO;;;;;;EAOvC;;;;;EAMA;;;;;;;EAQA;;;;;;;EAQA,WAAW;IACT,aAAa;IACb,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;;;;;;;;;EAUnB,YAAY,QAAQ,cAAc,KAAK,uBAAuB;;;;;;;;;;;;;;;;;;;;EAqB9D;;;;;;;;;;;;;;;;;;;EAoBA;;;;;;;;;;;;;;;;EAiBA,eAAe;;;;;;;;;;;;;;EAef;;;;;;EAOA;;;;;;;;;;;EAYA;;;;;;;;;;;;;;;;;;;EAoBA;;EAEA,iBAAiB;;;;;;;;;;;;;;EAejB;;;;;;;EAQA,yBAAyB;;;;;;;;;;;;;;;;;;;EAoBzB,kBAAkB,YAAY"}
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import { n as ComposedPolicyContext } from "./composed-policy-BCaNiVHv.mjs";
|
|
2
|
-
import { BrowserPostureConfig } from "@kya-os/checkpoint-shared/browser-posture";
|
|
3
|
-
import { DidResolverAdapter, PolicyEvaluatorAdapter, ReputationOracleAdapter, StatusListCacheAdapter } from "@kya-os/checkpoint-wasm-runtime/adapters";
|
|
4
|
-
import { ChallengeContextFailureEvent, ChallengeEnvelopeMode, ChallengeWireInput, ClientIpTrustPolicy } from "@kya-os/checkpoint-shared";
|
|
5
|
-
import { NextRequest } from "next/server";
|
|
6
|
-
import { EnforcementMode, EngineConfig, VerifyResult } from "@kya-os/checkpoint-wasm-runtime/engine";
|
|
7
|
-
//#region src/config.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* Configuration for `withCheckpoint`.
|
|
10
|
-
*
|
|
11
|
-
* The new minimal shape Phase D's middleware needs. Legacy
|
|
12
|
-
* `AgentShieldMiddlewareConfig` (from `./api-middleware`) remains
|
|
13
|
-
* exported during the deprecation window — see D.4 cutover.
|
|
14
|
-
*/
|
|
15
|
-
interface CheckpointConfig {
|
|
16
|
-
/**
|
|
17
|
-
* Selects the infrastructure allowed to vouch for client IP headers.
|
|
18
|
-
* Defaults to direct peer/framework resolution; set `platform: 'vercel'`
|
|
19
|
-
* for Vercel-hosted requests or `platform: 'trusted-proxy'` with an
|
|
20
|
-
* explicit hop count for a configured proxy chain.
|
|
21
|
-
*/
|
|
22
|
-
clientIpPolicy?: ClientIpTrustPolicy;
|
|
23
|
-
/**
|
|
24
|
-
* Tenant identifier — typically the customer's dashboard hostname
|
|
25
|
-
* (e.g. `acme.checkpoint.example`). The PolicyEvaluator uses this
|
|
26
|
-
* to look up tenant policy from the dashboard.
|
|
27
|
-
*/
|
|
28
|
-
tenantHost: string;
|
|
29
|
-
/** Exact org DID used to verify the consent credential's audience. */
|
|
30
|
-
resourceOrgDid?: string;
|
|
31
|
-
/** Explicit trusted delegation issuers; otherwise resolved from project policy. */
|
|
32
|
-
trustedDelegationRoots?: string[];
|
|
33
|
-
/**
|
|
34
|
-
* `'enforce'` (default) blocks; `'observe'` passes everything
|
|
35
|
-
* through with `X-Checkpoint-Would-Have-Been` headers. Per Phase 0.2.
|
|
36
|
-
*
|
|
37
|
-
* @default 'enforce'
|
|
38
|
-
*/
|
|
39
|
-
enforcementMode?: EnforcementMode;
|
|
40
|
-
/**
|
|
41
|
-
* Challenge-emission envelope mode (draft-kya-http-02 §8.1 fetcher-200).
|
|
42
|
-
* `negotiated` serves a body-readable HTTP 200 step-up response to
|
|
43
|
-
* cooperative agents (fetchers that drop 4xx/5xx bodies), keeping the spec
|
|
44
|
-
* 401/422 for everyone else. Defaults to `negotiated` (#3530). A cooperative-UX
|
|
45
|
-
* bridge, NOT an access control.
|
|
46
|
-
*
|
|
47
|
-
* @default 'negotiated'
|
|
48
|
-
*/
|
|
49
|
-
delegationChallengeMode?: ChallengeEnvelopeMode;
|
|
50
|
-
/**
|
|
51
|
-
* Resolve a policy `Challenge` into complete registered wire context.
|
|
52
|
-
* The callback performs any Authorization-Host registration asynchronously;
|
|
53
|
-
* the synchronous engine renderer never fabricates a sid, consent URI, or proof.
|
|
54
|
-
*/
|
|
55
|
-
resolveDelegationChallenge?: (context: {
|
|
56
|
-
result: VerifyResult;
|
|
57
|
-
request: NextRequest;
|
|
58
|
-
}) => ChallengeWireInput | undefined | Promise<ChallengeWireInput | undefined>;
|
|
59
|
-
/**
|
|
60
|
-
* Registration/resolution budget in milliseconds.
|
|
61
|
-
*
|
|
62
|
-
* @default 3000
|
|
63
|
-
*/
|
|
64
|
-
delegationChallengeTimeoutMs?: number;
|
|
65
|
-
/** Sanitized registration failure hook for metrics and operator warnings. */
|
|
66
|
-
onDelegationChallengeFailure?: (event: ChallengeContextFailureEvent) => void;
|
|
67
|
-
/**
|
|
68
|
-
* Argus reputation oracle base URL. Omit to use the trust-by-default
|
|
69
|
-
* baseline (reputation defaults to 1.0; orchestrator logs a one-shot
|
|
70
|
-
* warning at first request).
|
|
71
|
-
*/
|
|
72
|
-
argusUrl?: string;
|
|
73
|
-
/**
|
|
74
|
-
* Dashboard base URL for the PolicyEvaluator to fetch tenant policy
|
|
75
|
-
* from. Omit to use the open-by-default tenant policy.
|
|
76
|
-
*/
|
|
77
|
-
dashboardUrl?: string;
|
|
78
|
-
/**
|
|
79
|
-
* Returned to the PolicyEvaluator for anonymous requests (no agent
|
|
80
|
-
* DID). Trust-by-default. Engine scale is `0.0` to `1.0`.
|
|
81
|
-
*
|
|
82
|
-
* @default 1.0
|
|
83
|
-
*/
|
|
84
|
-
reputationBaseline?: number;
|
|
85
|
-
/**
|
|
86
|
-
* Pre-built adapter instances. Production deployments use the
|
|
87
|
-
* factory-built defaults from `@kya-os/checkpoint-wasm-runtime/adapters`;
|
|
88
|
-
* tests use stubs. The factory composes any provided overrides over
|
|
89
|
-
* defaults — partial overrides are supported.
|
|
90
|
-
*/
|
|
91
|
-
adapters?: Partial<{
|
|
92
|
-
didResolver: DidResolverAdapter;
|
|
93
|
-
statusListCache: StatusListCacheAdapter;
|
|
94
|
-
reputationOracle: ReputationOracleAdapter;
|
|
95
|
-
policyEvaluator: PolicyEvaluatorAdapter;
|
|
96
|
-
}>;
|
|
97
|
-
/**
|
|
98
|
-
* Optional callback for the post-verdict path — fires after every
|
|
99
|
-
* verification, regardless of permit/block, with the full
|
|
100
|
-
* `VerifyResult`. Use for logging, dashboards, telemetry. Errors
|
|
101
|
-
* thrown here are swallowed so user code can't break the middleware
|
|
102
|
-
* response.
|
|
103
|
-
*/
|
|
104
|
-
onResult?: (result: VerifyResult, req: NextRequest) => void | Promise<void>;
|
|
105
|
-
/**
|
|
106
|
-
* Accept legacy `KYA-Delegation`-header envelope form alongside the
|
|
107
|
-
* canonical `_meta.proof.jws` body form. Default `false`.
|
|
108
|
-
*
|
|
109
|
-
* **When to enable** — customers whose agents pre-date Envelope-1
|
|
110
|
-
* (#2537) and ship KYA-OS proofs as `{protected,payload,signature}`
|
|
111
|
-
* JSON in a `KYA-Delegation` HTTP header. Post-Envelope-1 agents
|
|
112
|
-
* ship compact JWS in the request body's `_meta.proof.jws` field;
|
|
113
|
-
* those don't need this flag.
|
|
114
|
-
*
|
|
115
|
-
* Forwarded to the orchestrator's `VerifyRequestOpts.legacyEnvelopeFallback`.
|
|
116
|
-
* Both transports (header + body) are honored when this is `true`;
|
|
117
|
-
* the orchestrator's detection order is body first, then header
|
|
118
|
-
* (`packages/checkpoint-wasm-runtime/src/engine/orchestrator/build-agent-request.ts`).
|
|
119
|
-
*
|
|
120
|
-
* SDK-Envelope-Plumbing-1 (#2594). Added in `@kya-os/checkpoint-nextjs@1.1.0`.
|
|
121
|
-
*
|
|
122
|
-
* @default false
|
|
123
|
-
*/
|
|
124
|
-
legacyEnvelopeFallback?: boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Read the request body when `content-type` is `application/json` so
|
|
127
|
-
* the orchestrator can extract a KYA-OS envelope from
|
|
128
|
-
* `_meta.proof.jws`. Default `true`.
|
|
129
|
-
*
|
|
130
|
-
* **When to disable** — streaming middlewares that can't tolerate
|
|
131
|
-
* the `req.clone()` memory overhead (one full-body copy is buffered
|
|
132
|
-
* during the read). For those, set `false` and route KYA-OS
|
|
133
|
-
* envelopes through the `KYA-Delegation` header transport instead
|
|
134
|
-
* (requires `legacyEnvelopeFallback: true`).
|
|
135
|
-
*
|
|
136
|
-
* The clone preserves `req.body` for downstream handlers — disabling
|
|
137
|
-
* is a performance optimization, not a correctness fix.
|
|
138
|
-
*
|
|
139
|
-
* SDK-Envelope-Plumbing-1 (#2594). Added in `@kya-os/checkpoint-nextjs@1.1.0`.
|
|
140
|
-
*
|
|
141
|
-
* @default true
|
|
142
|
-
*/
|
|
143
|
-
drainJsonBody?: boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Engine-default behaviour knobs forwarded to every composed
|
|
146
|
-
* `ContextSpec`. Defaults to `{ tier3Action: 'monitor' }` —
|
|
147
|
-
* customer-onboarding-safe (tenant policy decides; engine doesn't
|
|
148
|
-
* short-circuit known-agent UAs with an engine-default Block).
|
|
149
|
-
*
|
|
150
|
-
* Opt into `{ tier3Action: 'block' }` when the host wants the
|
|
151
|
-
* calibrated engine-default block for KnownAiAgent / AiCrawler /
|
|
152
|
-
* HeadlessBrowser classifications BEFORE the tenant policy seam.
|
|
153
|
-
*
|
|
154
|
-
* Added in `@kya-os/checkpoint-nextjs@1.2.0` (Engine-Tier3-Monitor-
|
|
155
|
-
* Default, #2653 + this PR's plumbing follow-up).
|
|
156
|
-
*
|
|
157
|
-
* @default { tier3Action: 'monitor' }
|
|
158
|
-
*/
|
|
159
|
-
engineConfig?: EngineConfig;
|
|
160
|
-
/**
|
|
161
|
-
* Project API key. Required for detections to land in the dashboard
|
|
162
|
-
* — the engine verifies in-process via WASM, but the resulting
|
|
163
|
-
* `VerifyResult` only reaches the dashboard's `detections` table
|
|
164
|
-
* when this reporter is configured. Without it the verdict path
|
|
165
|
-
* works locally but the onboarding "Verify connection" check fails
|
|
166
|
-
* forever because no rows are ever written.
|
|
167
|
-
*
|
|
168
|
-
* Resolve from `process.env.CHECKPOINT_API_KEY` in the host app.
|
|
169
|
-
*
|
|
170
|
-
* Added in `@kya-os/checkpoint-nextjs@1.4.0`
|
|
171
|
-
* (SDK-Detection-Reporter-1).
|
|
172
|
-
*/
|
|
173
|
-
apiKey?: string;
|
|
174
|
-
/**
|
|
175
|
-
* Dashboard base URL. Override for staging or self-hosted dashboards.
|
|
176
|
-
*
|
|
177
|
-
* @default 'https://kya.vouched.id'
|
|
178
|
-
*/
|
|
179
|
-
baseUrl?: string;
|
|
180
|
-
/**
|
|
181
|
-
* Surface reporter errors via `console.warn`. Defaults to `false`.
|
|
182
|
-
* The reporter is fire-and-forget; enable during development to
|
|
183
|
-
* confirm `apiKey` / `baseUrl` are routed correctly.
|
|
184
|
-
*
|
|
185
|
-
* Also wires the composed-policy shadow-divergence + fail-open
|
|
186
|
-
* telemetry to `console.warn`/`console.error` (otherwise silent).
|
|
187
|
-
*
|
|
188
|
-
* @default false
|
|
189
|
-
*/
|
|
190
|
-
debug?: boolean;
|
|
191
|
-
/**
|
|
192
|
-
* Project id whose composed (/policy-compose) policy this middleware
|
|
193
|
-
* enforces. When set, the project's policy is fetched from the dashboard
|
|
194
|
-
* (`<dashboardUrl ?? baseUrl ?? default>/api/internal/policies/${projectId}`)
|
|
195
|
-
* and — if it carries a deployed Cedar bundle with `engineEnforcementEnabled`
|
|
196
|
-
* on — the kya-os-engine decision is enforced IN-PROCESS, byte-for-byte the
|
|
197
|
-
* same as the DNS Gateway. Omit to run detection + the structured policy only
|
|
198
|
-
* (fully back-compatible; purely additive).
|
|
199
|
-
*
|
|
200
|
-
* SHADOW-FIRST: with a deployed bundle but `engineEnforcementEnabled` off, the
|
|
201
|
-
* engine decision is computed + logged on divergence but does NOT act.
|
|
202
|
-
*
|
|
203
|
-
* **Node vs Edge:** composed enforcement is default-on under the Node runtime
|
|
204
|
-
* (`./node`). Under the Edge runtime (`./edge`) it additionally requires
|
|
205
|
-
* `cedarWasmModule` to be wired (see below) — otherwise the seam stays inert.
|
|
206
|
-
*
|
|
207
|
-
* Added in `@kya-os/checkpoint-nextjs@1.5.0` (@Policy middleware-Cedar, #3076).
|
|
208
|
-
*/
|
|
209
|
-
projectId?: string;
|
|
210
|
-
/** Signed browser risk; configure explicit route scopes to enable consent step-up. */
|
|
211
|
-
browserPosture?: BrowserPostureConfig;
|
|
212
|
-
/**
|
|
213
|
-
* Policy-fetch cache TTL in seconds. Defaults to 300 (5 minutes). How long
|
|
214
|
-
* a fetched project policy is reused before the middleware refetches from
|
|
215
|
-
* the dashboard — i.e. the worst-case delay before a dashboard policy
|
|
216
|
-
* change takes effect on this host.
|
|
217
|
-
*
|
|
218
|
-
* `0` disables reuse entirely: every request fetches the policy (one
|
|
219
|
-
* origin round-trip per request). Use for demo/example sites where instant
|
|
220
|
-
* policy propagation matters more than latency; keep the default (or a
|
|
221
|
-
* small positive value like 5) for production and benchmark hosts.
|
|
222
|
-
*
|
|
223
|
-
* @default 300
|
|
224
|
-
*/
|
|
225
|
-
policyCacheTtlSeconds?: number;
|
|
226
|
-
/**
|
|
227
|
-
* Advanced / testing: inject a pre-built composed-policy context instead of
|
|
228
|
-
* letting `withCheckpoint` construct one from `projectId` + `baseUrl` +
|
|
229
|
-
* `apiKey`. Mirrors the `adapters` injection philosophy — production omits
|
|
230
|
-
* this. When set, it takes precedence over `projectId`.
|
|
231
|
-
*/
|
|
232
|
-
composedPolicyEnforcer?: ComposedPolicyContext;
|
|
233
|
-
/**
|
|
234
|
-
* EDGE runtime only. The cedar-web `WebAssembly.Module`, statically imported
|
|
235
|
-
* by the host so composed-policy Cedar can compile at the edge:
|
|
236
|
-
*
|
|
237
|
-
* ```ts
|
|
238
|
-
* import cedarWasmModule from
|
|
239
|
-
* '@kya-os/checkpoint-wasm-runtime/wasm/kya-os-engine-cedar-web/kya_os_engine_bg.wasm?module';
|
|
240
|
-
* export default withCheckpoint({ projectId, cedarWasmModule });
|
|
241
|
-
* ```
|
|
242
|
-
*
|
|
243
|
-
* The ~2 MB cedar binary is deliberately NOT bundled into the SDK — wiring it
|
|
244
|
-
* is the consumer's explicit opt-in for edge composed enforcement (requires
|
|
245
|
-
* `experiments.asyncWebAssembly` + a `.wasm` asset rule in `next.config`).
|
|
246
|
-
* Without it the Edge seam stays inert (behaves exactly as 1.4.0); the Node
|
|
247
|
-
* runtime ignores this field (it loads cedar via `createPolicyEvaluator`).
|
|
248
|
-
*
|
|
249
|
-
* Added in `@kya-os/checkpoint-nextjs@1.5.0` (@Policy middleware-Cedar, #3076).
|
|
250
|
-
*/
|
|
251
|
-
cedarWasmModule?: WebAssembly.Module;
|
|
252
|
-
}
|
|
253
|
-
//#endregion
|
|
254
|
-
export { CheckpointConfig as t };
|
|
255
|
-
//# sourceMappingURL=config-Doe0Tn53.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-Doe0Tn53.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;;;;;;UAuCiB;;;;;;;EAOf,iBAAiB;;;;;;EAMjB;;EAEA;;EAEA;;;;;;;EAQA,kBAAkB;;;;;;;;;;EAWlB,0BAA0B;;;;;;EAO1B,8BAA8B;IAC5B,QAAQ;IACR,SAAS;QACL,iCAAiC,QAAQ;;;;;;EAO/C;;EAGA,gCAAgC,OAAO;;;;;;EAOvC;;;;;EAMA;;;;;;;EAQA;;;;;;;EAQA,WAAW;IACT,aAAa;IACb,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;;;;;;;;;EAUnB,YAAY,QAAQ,cAAc,KAAK,uBAAuB;;;;;;;;;;;;;;;;;;;;EAqB9D;;;;;;;;;;;;;;;;;;;EAoBA;;;;;;;;;;;;;;;;EAiBA,eAAe;;;;;;;;;;;;;;EAef;;;;;;EAOA;;;;;;;;;;;EAYA;;;;;;;;;;;;;;;;;;;EAoBA;;EAEA,iBAAiB;;;;;;;;;;;;;;EAejB;;;;;;;EAQA,yBAAyB;;;;;;;;;;;;;;;;;;;EAoBzB,kBAAkB,YAAY"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { r as NextJSMiddlewareConfig } from "./types-C0SkqLMM.mjs";
|
|
2
|
-
import { NextRequest, NextResponse } from "next/server";
|
|
3
|
-
//#region src/create-middleware.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Create an AgentShield middleware with automatic WASM initialization
|
|
6
|
-
* This version handles initialization internally to avoid top-level await
|
|
7
|
-
*/
|
|
8
|
-
export declare function createAgentShieldMiddleware(config: NextJSMiddlewareConfig): (request: NextRequest) => Promise<NextResponse>;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { createAgentShieldMiddleware as createMiddleware };
|
|
11
|
-
//# sourceMappingURL=create-middleware.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-middleware.d.mts","names":[],"sources":["../src/create-middleware.ts"],"mappings":";;;;;;;wBAwBgB,4BAA4B,QAAQ,0BACN,SAAS,gBAAc,QAAQ"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { r as NextJSMiddlewareConfig } from "./types-C7DNSCTO.js";
|
|
2
|
-
import { NextRequest, NextResponse } from "next/server";
|
|
3
|
-
//#region src/create-middleware.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Create an AgentShield middleware with automatic WASM initialization
|
|
6
|
-
* This version handles initialization internally to avoid top-level await
|
|
7
|
-
*/
|
|
8
|
-
export declare function createAgentShieldMiddleware(config: NextJSMiddlewareConfig): (request: NextRequest) => Promise<NextResponse>;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { createAgentShieldMiddleware as createMiddleware };
|
|
11
|
-
//# sourceMappingURL=create-middleware.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-middleware.d.ts","names":[],"sources":["../src/create-middleware.ts"],"mappings":";;;;;;;wBAwBgB,4BAA4B,QAAQ,0BACN,SAAS,gBAAc,QAAQ"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_middleware = require('./middleware.js');
|
|
3
|
-
let next_server = require("next/server");
|
|
4
|
-
|
|
5
|
-
//#region src/create-middleware.ts
|
|
6
|
-
/**
|
|
7
|
-
* Enhanced middleware creator for Edge Runtime.
|
|
8
|
-
*
|
|
9
|
-
* NOTE (post-Phase D): this wrapper delegates to
|
|
10
|
-
* `createAgentShieldMiddleware` from `./middleware`, which is itself a
|
|
11
|
-
* throw-stub pointing at `withCheckpoint`. See `middleware.ts`
|
|
12
|
-
* for the migration error message + canonical replacement recipe.
|
|
13
|
-
*/
|
|
14
|
-
let middlewareInstance = null;
|
|
15
|
-
let isInitializing = false;
|
|
16
|
-
let initPromise = null;
|
|
17
|
-
/**
|
|
18
|
-
* Create an AgentShield middleware with automatic WASM initialization
|
|
19
|
-
* This version handles initialization internally to avoid top-level await
|
|
20
|
-
*/
|
|
21
|
-
function createAgentShieldMiddleware(config) {
|
|
22
|
-
return async function agentShieldMiddleware(request) {
|
|
23
|
-
if (!middlewareInstance) {
|
|
24
|
-
if (!isInitializing) {
|
|
25
|
-
isInitializing = true;
|
|
26
|
-
initPromise = (async () => {
|
|
27
|
-
middlewareInstance = require_middleware.createAgentShieldMiddleware(config);
|
|
28
|
-
return middlewareInstance;
|
|
29
|
-
})();
|
|
30
|
-
}
|
|
31
|
-
if (initPromise) middlewareInstance = await initPromise;
|
|
32
|
-
}
|
|
33
|
-
return middlewareInstance ? middlewareInstance(request) : next_server.NextResponse.next();
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
exports.createAgentShieldMiddleware = createAgentShieldMiddleware;
|
|
39
|
-
exports.createMiddleware = createAgentShieldMiddleware;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createAgentShieldMiddleware as createAgentShieldMiddleware$1 } from "./middleware.mjs";
|
|
2
|
-
import { NextResponse } from "next/server";
|
|
3
|
-
|
|
4
|
-
//#region src/create-middleware.ts
|
|
5
|
-
/**
|
|
6
|
-
* Enhanced middleware creator for Edge Runtime.
|
|
7
|
-
*
|
|
8
|
-
* NOTE (post-Phase D): this wrapper delegates to
|
|
9
|
-
* `createAgentShieldMiddleware` from `./middleware`, which is itself a
|
|
10
|
-
* throw-stub pointing at `withCheckpoint`. See `middleware.ts`
|
|
11
|
-
* for the migration error message + canonical replacement recipe.
|
|
12
|
-
*/
|
|
13
|
-
let middlewareInstance = null;
|
|
14
|
-
let isInitializing = false;
|
|
15
|
-
let initPromise = null;
|
|
16
|
-
/**
|
|
17
|
-
* Create an AgentShield middleware with automatic WASM initialization
|
|
18
|
-
* This version handles initialization internally to avoid top-level await
|
|
19
|
-
*/
|
|
20
|
-
function createAgentShieldMiddleware(config) {
|
|
21
|
-
return async function agentShieldMiddleware(request) {
|
|
22
|
-
if (!middlewareInstance) {
|
|
23
|
-
if (!isInitializing) {
|
|
24
|
-
isInitializing = true;
|
|
25
|
-
initPromise = (async () => {
|
|
26
|
-
middlewareInstance = createAgentShieldMiddleware$1(config);
|
|
27
|
-
return middlewareInstance;
|
|
28
|
-
})();
|
|
29
|
-
}
|
|
30
|
-
if (initPromise) middlewareInstance = await initPromise;
|
|
31
|
-
}
|
|
32
|
-
return middlewareInstance ? middlewareInstance(request) : NextResponse.next();
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
//#endregion
|
|
37
|
-
export { createAgentShieldMiddleware, createAgentShieldMiddleware as createMiddleware };
|
|
38
|
-
//# sourceMappingURL=create-middleware.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-middleware.mjs","names":["createBaseMiddleware"],"sources":["../src/create-middleware.ts"],"sourcesContent":["/**\n * Enhanced middleware creator for Edge Runtime.\n *\n * NOTE (post-Phase D): this wrapper delegates to\n * `createAgentShieldMiddleware` from `./middleware`, which is itself a\n * throw-stub pointing at `withCheckpoint`. See `middleware.ts`\n * for the migration error message + canonical replacement recipe.\n */\n\nimport { NextResponse } from 'next/server';\nimport type { NextRequest } from 'next/server';\nimport { createAgentShieldMiddleware as createBaseMiddleware } from './middleware';\nimport type { NextJSMiddlewareConfig } from './types';\n\ntype MiddlewareFunction = (request: NextRequest) => Promise<NextResponse>;\n\nlet middlewareInstance: MiddlewareFunction | null = null;\nlet isInitializing = false;\nlet initPromise: Promise<MiddlewareFunction> | null = null;\n\n/**\n * Create an AgentShield middleware with automatic WASM initialization\n * This version handles initialization internally to avoid top-level await\n */\nexport function createAgentShieldMiddleware(config: NextJSMiddlewareConfig) {\n return async function agentShieldMiddleware(request: NextRequest): Promise<NextResponse> {\n // Initialize middleware on first request. The base factory is now\n // a Phase D throw-stub that surfaces a migration error pointing at\n // `withCheckpoint` — this wrapper is here only for the compile-time\n // export shape during the deprecation window.\n if (!middlewareInstance) {\n if (!isInitializing) {\n isInitializing = true;\n initPromise = (async () => {\n middlewareInstance = createBaseMiddleware(config);\n return middlewareInstance;\n })();\n }\n\n // Wait for initialization to complete\n if (initPromise) {\n middlewareInstance = await initPromise;\n }\n }\n\n // Run the middleware\n return middlewareInstance ? middlewareInstance(request) : NextResponse.next();\n };\n}\n\n/**\n * Export the original function as well for backward compatibility\n */\nexport { createAgentShieldMiddleware as createMiddleware };\n"],"mappings":";;;;;;;;;;;;AAgBA,IAAI,qBAAgD;AACpD,IAAI,iBAAiB;AACrB,IAAI,cAAkD;;;;;AAMtD,SAAgB,4BAA4B,QAAgC;CAC1E,OAAO,eAAe,sBAAsB,SAA6C;EAKvF,IAAI,CAAC,oBAAoB;GACvB,IAAI,CAAC,gBAAgB;IACnB,iBAAiB;IACjB,eAAe,YAAY;KACzB,qBAAqBA,8BAAqB,MAAM;KAChD,OAAO;IACT,EAAC,CAAE;GACL;GAGA,IAAI,aACF,qBAAqB,MAAM;EAE/B;EAGA,OAAO,qBAAqB,mBAAmB,OAAO,IAAI,aAAa,KAAK;CAC9E;AACF"}
|