import { ApolloClient } from '@apollo/client'; import { SecuritySummary } from './types'; /** * Caller-supplied opts: the svc-side proxy owns the agentApiKey, so the * browser only needs the agent id, the canonical profile, and an Apollo * client to talk GraphQL with. */ export interface SecurityAgentOpts { /** Agent id — required by the @rbac decorator on the svc proxy fields. */ agentId: string; /** Canonical profile name (e.g. "default"). */ profile: string; /** Apollo client (injected via `useApolloClient()` in hooks). */ apolloClient: ApolloClient; } export declare class SecurityAgentError extends Error { readonly code: string; readonly status: number; constructor(code: string, status: number, message: string); } /** Agent-side severity enum (lowercase) — see vibe-plugin-security types.ts. */ export type AgentSeverity = 'critical' | 'high' | 'medium' | 'low' | 'info'; /** Agent-side finding status enum (lowercase). */ export type AgentFindingStatus = 'open' | 'accepted' | 'fixed' | 'false_positive' | 'suppressed'; /** Agent-side scan status enum (lowercase). */ export type AgentScanStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'errored' | 'cancelled'; /** Agent-side scan conclusion enum (lowercase). */ export type AgentScanConclusion = 'pass' | 'warn' | 'fail' | 'skipped'; /** Agent-side policy level enum (lowercase). */ export type AgentPolicyLevel = 'advisory' | 'warn' | 'block'; /** Agent-side stage enum — dotted form (e.g. `pull_request.fast`). */ export type AgentStage = 'repo.onboard' | 'developer.local' | 'pull_request.fast' | 'pull_request.deep' | 'main.merge' | 'build' | 'package.publish' | 'deploy.preview' | 'deploy.alpha' | 'promote.prod' | 'runtime.continuous' | 'scheduled.rescan' | 'incident.response' | 'archive.offboard'; /** Per-stage provider directory returned by GET /providers. */ export interface SecurityProvidersByStage { stages: Record>; } /** One scan run as surfaced by GET /scan/:runId. Mirrors `ScanRunRecord`. */ export interface SecurityScanRun { runId: string; vibeId: string; workspaceId: string; repoUrl: string; commit: string; stage: AgentStage; providerName: string; status: AgentScanStatus; conclusion?: AgentScanConclusion; startedAt?: number; finishedAt?: number; durationMs?: number; summary: SecuritySummary; policyLevel: AgentPolicyLevel; errorReason?: string; pushed?: boolean; } /** One finding as surfaced by GET /findings. Mirrors `FindingRecord`. */ export interface SecurityFinding { fingerprint: string; vibeId: string; scanRunId: string; ruleId: string; title: string; description?: string; severity: AgentSeverity; category: string; status: AgentFindingStatus; cwe?: string[]; cve?: string; file?: string; line?: number; column?: number; packageName?: string; packageVersion?: string; fixedVersion?: string; remediation?: string; rawProviderRef?: string; redactedSample?: string; firstSeenAt: number; lastSeenAt: number; } export interface FindingsFilter { vibeId?: string; severity?: AgentSeverity; status?: AgentFindingStatus; limit?: number; } export interface FindingsPage { findings: SecurityFinding[]; total: number; } export interface StartScanInput { vibeId: string; workspaceId: string; repoUrl: string; repoLocalPath: string; commit: string; stage: AgentStage; providerName?: string; policyLevel?: AgentPolicyLevel; config?: Record; profile?: { kind: string; languages: string[]; runtimes: string[]; }; } export interface StartScanResult { runId: string; status: AgentScanStatus; } export declare const securityAgent: { /** GET /providers — per-stage provider directory. */ listProviders(o: SecurityAgentOpts): Promise; /** GET /findings — filtered finding list. */ listFindings(o: SecurityAgentOpts, filter?: FindingsFilter): Promise; /** GET /scan/:runId — single scan run by id. */ getScan(o: SecurityAgentOpts, runId: string): Promise; /** POST /scan — start a scan. */ startScan(o: SecurityAgentOpts, input: StartScanInput): Promise; /** POST /scan/:runId/cancel — cancel an in-flight scan. */ cancelScan(o: SecurityAgentOpts, runId: string): Promise<{ cancelled: boolean; }>; /** * Aggregate recent scan runs for a vibe by fanning out from the * findings list (the agent doesn't expose a list-runs endpoint). * * Strategy: list findings filtered by vibeId, take the distinct * `scanRunId`s (preserving last-seen order from the agent's * `ORDER BY last_seen_at DESC`), then resolve each id via * GET /scan/:runId. Unresolvable runs are dropped silently. */ listRecentScanRuns(o: SecurityAgentOpts, vibeId: string, limit?: number): Promise; };