@openguardrails/moltguard
Version:
AI agent security plugin for OpenClaw: prompt injection detection, PII sanitization, and monitoring dashboard
70 lines • 2.23 kB
TypeScript
/**
* ConfigSync - Periodically pulls team-level configuration from Core.
*
* Only active when the agent's account is on the "business" plan.
* Pulls policies and gateway config every 5 minutes from
* GET /api/v1/business/config and applies them locally.
*/
import type { CoreCredentials } from "./config.js";
import type { Logger } from "./types.js";
export type TeamPolicy = {
id: string;
name: string;
description: string | null;
scannerIds: string | null;
action: string;
sensitivityThreshold: number;
targetAgentIds: string | null;
targetOwners: string | null;
isEnabled: number;
};
export type TeamGatewayConfig = {
sanitizeEmail: number;
sanitizeApiKeys: number;
sanitizePii: number;
sanitizeSshKeys: number;
sanitizeEnvVars: number;
sanitizeConfidential: number;
customPatterns: string | null;
targetAgentIds: string | null;
targetOwners: string | null;
};
export type BusinessConfig = {
policies: TeamPolicy[];
gatewayConfig: TeamGatewayConfig | null;
};
/** Callback for when config changes */
export type OnConfigUpdate = (config: BusinessConfig) => void;
export type ConfigSyncOptions = {
coreUrl: string;
/** Callback invoked when remote config changes */
onUpdate?: OnConfigUpdate;
};
export declare class ConfigSync {
private enabled;
private options;
private log;
private credentials;
private pollInterval;
/** Last fetched config (for change detection) */
private lastConfigHash;
/** Last successfully fetched config */
private currentConfig;
constructor(options: ConfigSyncOptions, log: Logger);
/**
* Initialize config sync. Only enables if plan is "business".
*/
initialize(plan: string): Promise<void>;
/** Set Core credentials */
setCredentials(credentials: CoreCredentials | null): void;
/** Get current config (may be null if not yet fetched) */
getConfig(): BusinessConfig | null;
/** Whether sync is active */
isEnabled(): boolean;
/** Stop polling */
stop(): void;
private startPolling;
/** Pull config from Core */
pull(): Promise<BusinessConfig | null>;
}
//# sourceMappingURL=config-sync.d.ts.map