UNPKG

@vigilbase/cli

Version:

Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.

64 lines (63 loc) • 2.89 kB
import { type AgentToolExecuteResponse, type AgentToolsCatalogResponse } from '../types.js'; import { type CliConfig } from './config.js'; export declare class VigilbaseApiError extends Error { readonly status: number; readonly body: unknown; readonly retryAfterSec?: number; readonly code?: string; /** The server's sanitised explanation, set only for known vigilbase.com problem errors. */ readonly reason?: string; /** CLI-authored remediation, never server text (see one-error-hints.ts). */ readonly hint?: string; /** * The message is the CLI's own text, never the server's, so formatError prints it although the * error carries a body. Unmarked errors with a body print only a generic `Request failed`. */ readonly isCliAuthored: boolean; /** The One tool run a failed scan recorded. */ readonly toolRunId?: string; /** The `X-Request-Id` of a One v1 answer, for support. */ readonly requestId?: string; constructor(message: string, options: { status: number; body?: unknown; retryAfterSec?: number; code?: string; reason?: string; hint?: string; isCliAuthored?: boolean; toolRunId?: string; requestId?: string; }); } export declare function retryAfterSeconds(response: Response, body: unknown): number | undefined; /** The Tools API catalog path, relative to `toolsApiUrl` (`servers[0]` of the Tools document). */ export declare const PUBLIC_TOOLS_PATH: "/agent/tools"; /** * The public Tools API client: typed calls of the operations declared in * `@vigilbase/api-contract` (vendored in src/vendor/api-contract), on * https://api.vigilbase.com/tools/v1 by default. * Vigilbase One authenticated calls use a separate client + device-auth tokens. */ export declare class VigilbaseClient { private readonly config; constructor(config: CliConfig); private get baseUrl(); /** * `fetch` for callOperation through the CLI's transport (timeouts, no * redirects, network errors). `last` keeps the response for Retry-After. */ private transport; listTools(): Promise<AgentToolsCatalogResponse>; executeTool(toolName: string, target: string): Promise<AgentToolExecuteResponse>; fetchSkillMarkdown(skillUrl: string): Promise<string>; /** The Docs API base, or a CLI-authored error when `--base-url` names an origin that does not serve it. */ private get docsBaseUrl(); /** Docs search (docs.search.query): anonymous, no credential or developer key is sent. */ searchDocs(q: string, limit: number): Promise<{ results: Array<Record<string, unknown>>; }>; /** One docs page as Markdown (docs.pages.get): anonymous. */ getDocsPage(path: string): Promise<Record<string, unknown>>; badgeUrl(domain: string, style?: 'default' | 'compact' | 'mini'): string; }