UNPKG

@kya-os/agentshield-nextjs

Version:

Next.js middleware for AgentShield AI agent detection

122 lines (117 loc) 4.21 kB
/* tslint:disable */ /* eslint-disable */ /** * Initialize the AgentShield WASM module */ export function init(): void; /** * Analyze a request and detect if it's from an agent */ export function detect_agent(metadata: JsRequestMetadata): JsDetectionResult; /** * Get the version of the AgentShield library */ export function version(): string; /** * JavaScript-compatible detection result */ export class JsDetectionResult { private constructor(); free(): void; /** * Whether the request was identified as coming from an agent */ is_agent: boolean; /** * Confidence score (0.0 to 1.0) */ confidence: number; /** * Get the detected agent name */ readonly agent: string | undefined; /** * Get the verification method as a string */ readonly verification_method: string; /** * Get the risk level as a string */ readonly risk_level: string; /** * Get the timestamp as a string */ readonly timestamp: string; } /** * JavaScript-compatible request metadata */ export class JsRequestMetadata { free(): void; /** * Constructor for JsRequestMetadata */ constructor(user_agent: string | null | undefined, ip_address: string | null | undefined, headers: string, timestamp: string); /** * Get the user agent */ readonly user_agent: string | undefined; /** * Get the IP address */ readonly ip_address: string | undefined; /** * Get the headers as JSON string */ readonly headers: string; /** * Get the timestamp */ readonly timestamp: string; } export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly __wbg_jsdetectionresult_free: (a: number, b: number) => void; readonly __wbg_get_jsdetectionresult_is_agent: (a: number) => number; readonly __wbg_set_jsdetectionresult_is_agent: (a: number, b: number) => void; readonly __wbg_get_jsdetectionresult_confidence: (a: number) => number; readonly __wbg_set_jsdetectionresult_confidence: (a: number, b: number) => void; readonly jsdetectionresult_agent: (a: number, b: number) => void; readonly jsdetectionresult_verification_method: (a: number, b: number) => void; readonly jsdetectionresult_risk_level: (a: number, b: number) => void; readonly jsdetectionresult_timestamp: (a: number, b: number) => void; readonly __wbg_jsrequestmetadata_free: (a: number, b: number) => void; readonly jsrequestmetadata_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number; readonly jsrequestmetadata_user_agent: (a: number, b: number) => void; readonly jsrequestmetadata_ip_address: (a: number, b: number) => void; readonly jsrequestmetadata_headers: (a: number, b: number) => void; readonly jsrequestmetadata_timestamp: (a: number, b: number) => void; readonly init: () => void; readonly detect_agent: (a: number, b: number) => void; readonly version: (a: number) => void; readonly __wbindgen_export_0: (a: number, b: number, c: number) => void; readonly __wbindgen_export_1: (a: number, b: number) => number; readonly __wbindgen_export_2: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_add_to_stack_pointer: (a: number) => number; readonly __wbindgen_start: () => void; } export type SyncInitInput = BufferSource | WebAssembly.Module; /** * Instantiates the given `module`, which can either be bytes or * a precompiled `WebAssembly.Module`. * * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. * * @returns {InitOutput} */ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; /** * If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated. * * @returns {Promise<InitOutput>} */ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;