@openguardrails/moltguard
Version:
AI agent security plugin for OpenClaw: prompt injection detection, PII sanitization, and monitoring dashboard
63 lines • 2.99 kB
TypeScript
/**
* DashboardClient - SDK for communicating with OpenGuardrails Dashboard
*
* Handles:
* - Agent registration & heartbeat
* - Detection requests (routed through dashboard → core)
* - Usage & results queries
*
* Works with both local embedded dashboard and remote standalone dashboard.
*/
import type { DashboardClientConfig, DashboardDetectRequest, DashboardDetectResponse, AgentRegisterRequest, ToolCallObservationRequest, AgentPermission, DetectionResultRequest, AgenticHoursRequest } from "./types.js";
export declare class DashboardClient {
private config;
private debugFileLog;
constructor(config: DashboardClientConfig);
get agentId(): string;
private request;
/**
* Send messages for detection through the dashboard.
* Dashboard handles scanner config, policy evaluation, and routes to core.
*/
detect(req: DashboardDetectRequest): Promise<DashboardDetectResponse>;
/** Register this agent with the dashboard (upserts by name) */
registerAgent(req: AgentRegisterRequest): Promise<{
success: boolean;
data?: {
id: string;
};
}>;
/** Send heartbeat to indicate this agent is alive */
heartbeat(): Promise<void>;
/** Upload full agent profile (workspace files, skills, cron jobs, etc.) */
updateProfile(profile: Record<string, unknown>): Promise<void>;
/** Start periodic heartbeat */
startHeartbeat(intervalMs?: number): NodeJS.Timeout;
/** Report a tool call observation to the dashboard */
reportToolCall(data: ToolCallObservationRequest): Promise<void>;
/** Report a detection result to the dashboard */
reportDetection(data: DetectionResultRequest): Promise<void>;
/** Get observed permissions for an agent */
getPermissions(agentId?: string): Promise<AgentPermission[]>;
/** Report agentic hours data to the dashboard */
reportAgenticHours(data: AgenticHoursRequest): Promise<void>;
private hoursAccum;
private hoursFlushTimer;
/** Record a tool call duration for agentic hours */
recordToolCallDuration(durationMs: number, blocked?: boolean): void;
/** Record an LLM call duration for agentic hours */
recordLlmDuration(durationMs: number): void;
/** Record a session start */
recordSessionStart(): void;
/** Record a risk event */
recordRiskEvent(): void;
private ensureHoursFlush;
private flushAgenticHours;
/** Flush pending agentic hours and clean up timers */
stop(): Promise<void>;
/** Check if dashboard is reachable */
checkHealth(): Promise<boolean>;
}
export { DashboardClient as PlatformClient };
export { type DashboardClientConfig, type DashboardDetectRequest, type DashboardDetectResponse, type ToolCallObservationRequest, type AgentPermission, type DetectionResultRequest, type AgenticHoursRequest, type PlatformClientConfig, type PlatformDetectRequest, type PlatformDetectResponse, } from "./types.js";
//# sourceMappingURL=index.d.ts.map