API Reference
Types and Errors
Polling options, shared unions, and typed SDK errors.
Types and Errors
All public SDK types are exported from @zeroleaks/sdk.
Polling
interface WaitOptions<T> {
pollIntervalMs?: number;
timeoutMs?: number;
signal?: AbortSignal;
onPoll?: (value: T) => void | Promise<void>;
}Attack surfaces
type AttackSurface =
| "direct_chat"
| "indirect_content"
| "tool_calling"
| "mcp"
| "repo_ci"
| "rag_vector"
| "multi_turn";Errors
| Error | Meaning |
|---|---|
ZeroLeaksError | Base API, validation, authentication, or network error |
ZeroLeaksTimeoutError | Request, polling, or runtime relay timed out |
ZeroLeaksAbortError | The supplied abort signal was triggered |
ZeroLeaksScanError | A scan reached a non-success terminal state or the runtime target failed |
import { ZeroLeaksScanError } from "@zeroleaks/sdk";
try {
await zeroleaks.runtimeScans.run(target);
} catch (error) {
if (error instanceof ZeroLeaksScanError) {
console.error(error.scanId, error.details);
}
}