@hivetechs/hive-ai
Version:
Real-time streaming AI consensus platform with HTTP+SSE MCP integration for Claude Code, VS Code, Cursor, and Windsurf - powered by OpenRouter's unified API
269 lines • 7.14 kB
TypeScript
/**
* Configuration Management System
* Infrastructure as Code (IAC) support for Hive AI
*
* Enables terminal developers to manage Hive AI configuration through:
* - YAML/JSON configuration files
* - Environment variable substitution
* - Validation and drift detection
* - Import/export capabilities
* - Multi-environment support
*/
export interface HiveConfig {
metadata: {
name: string;
description: string;
version: string;
environment?: string;
maintainer?: string;
created?: string;
};
license: {
key: string;
validation_endpoint?: string;
};
providers: {
openrouter: {
api_key: string;
endpoint?: string;
rate_limit?: {
requests_per_minute: number;
tokens_per_minute: number;
};
timeout?: {
connection: number;
read: number;
};
};
};
pipelines: Array<{
name: string;
description?: string;
enabled: boolean;
stages: {
generator: string;
refiner: string;
validator: string;
curator?: string;
};
settings?: {
max_tokens?: number;
temperature?: number;
timeout?: number;
};
}>;
intelligence?: {
mode: 'auto' | 'manual';
cost_optimization?: {
enabled: boolean;
budget_limit: number;
cost_alerts?: boolean;
};
template_maintenance?: {
auto_update: boolean;
health_checks: boolean;
check_interval?: string;
};
};
backup?: {
locations: Array<{
name: string;
path: string;
type: 'local' | 'cloud_sync' | 's3' | 'network';
enabled: boolean;
priority: number;
credentials?: Record<string, string>;
}>;
schedule?: {
daily?: {
enabled: boolean;
time?: string;
retention?: number;
};
weekly?: {
enabled: boolean;
day?: string;
time?: string;
retention?: number;
};
monthly?: {
enabled: boolean;
date?: number;
time?: string;
retention?: number;
};
emergency?: {
retention?: number;
};
};
verification?: {
integrity_check?: boolean;
test_restore?: boolean;
};
};
security?: {
key_rotation?: {
enabled: boolean;
interval?: string;
};
audit?: {
enabled: boolean;
log_path?: string;
retention?: string;
};
ip_allowlist?: {
enabled: boolean;
addresses?: string[];
};
};
monitoring?: {
health_checks?: {
enabled: boolean;
interval?: string;
endpoints?: string[];
};
performance?: {
enabled: boolean;
metrics?: string[];
};
alerts?: {
enabled: boolean;
channels?: Array<{
type: string;
address?: string;
webhook?: string;
api_key?: string;
}>;
thresholds?: {
error_rate?: number;
response_time?: number;
daily_cost?: number;
};
};
};
mcp?: {
transport: {
type: 'http+sse' | 'stdio';
port?: number;
auto_port_detection?: boolean;
port_range?: {
min: number;
max: number;
};
};
server?: {
timeout?: number;
max_sessions?: number;
session_ttl?: number;
streaming?: {
enabled: boolean;
buffer_size?: number;
flush_interval?: number;
};
};
ides?: {
auto_detection?: boolean;
supported_ides?: Array<'claude-code' | 'vscode' | 'cursor' | 'windsurf'>;
configurations?: Array<{
ide: string;
config_path?: string;
enabled: boolean;
last_updated?: string;
}>;
};
security?: {
cors_origins?: string[];
rate_limiting?: {
enabled: boolean;
requests_per_minute?: number;
};
session_security?: {
secure_ids: boolean;
ip_validation?: boolean;
};
};
health?: {
endpoint_enabled: boolean;
detailed_metrics?: boolean;
check_interval?: number;
};
};
development?: {
debug?: boolean;
mock_providers?: boolean;
settings?: {
log_level?: string;
verbose_output?: boolean;
};
};
overrides?: Record<string, Partial<HiveConfig>>;
}
export interface ConfigValidationResult {
valid: boolean;
errors: string[];
warnings: string[];
}
export interface ConfigDiff {
added: string[];
removed: string[];
changed: Array<{
path: string;
old_value: any;
new_value: any;
}>;
}
export declare class ConfigurationManager {
private configDir;
private currentEnvironment;
constructor(environment?: string);
/**
* Ensure configuration directory exists
*/
private ensureConfigDir;
/**
* Parse configuration file with environment variable substitution
*/
parseConfig(configPath: string): Promise<HiveConfig>;
/**
* Substitute environment variables in configuration content
*/
private substituteEnvironmentVariables;
/**
* Merge two configuration objects
*/
private mergeConfigs;
/**
* Validate configuration file
*/
validateConfig(config: HiveConfig): Promise<ConfigValidationResult>;
/**
* Check for required environment variables
*/
private checkRequiredEnvironmentVariables;
/**
* Export current configuration
*/
exportConfig(outputPath?: string): Promise<string>;
/**
* Apply configuration to system
*/
applyConfig(config: HiveConfig): Promise<void>;
/**
* Compare configuration with current system state
*/
diffConfig(config: HiveConfig): Promise<ConfigDiff>;
/**
* Get current system configuration
*/
private getCurrentConfig;
/**
* Compute differences between two configurations
*/
private computeDiff;
/**
* Generate configuration template
*/
generateTemplate(templateType?: string): string;
}
export declare const configManager: ConfigurationManager;
//# sourceMappingURL=config-management.d.ts.map