tlnt
Version:
TLNT - HMS-Powered Multi-Agent Platform with Government Agency Analysis, Deep Research, and Enterprise-Ready Deployment. Self-optimizing multi-domain AI agent with continuous learning and enterprise-grade performance monitoring.
158 lines • 4.26 kB
TypeScript
import { EventEmitter } from 'events';
import { MessageBus, ControlCommand } from '../core/messageBus.js';
export declare enum AgentState {
RUNNING = "running",
PAUSED = "paused",
MUTED = "muted",
KILLED = "killed",
ESCALATED = "escalated",
ERROR = "error",
INITIALIZING = "initializing"
}
export interface AgentStatus {
agentId: string;
state: AgentState;
lastHeartbeat: Date;
currentTask?: string;
progress: number;
pausedSince?: Date;
mutedSince?: Date;
escalationReason?: string;
errorDetails?: {
message: string;
stack?: string;
timestamp: Date;
};
metadata: Record<string, unknown>;
}
export interface ControlMessage {
command: ControlCommand['command'];
agentId: string;
operatorId: string;
reason?: string;
timestamp: Date;
metadata?: Record<string, unknown>;
}
export interface EscalationRequest {
agentId: string;
reason: string;
severity: 'low' | 'medium' | 'high' | 'critical';
context: Record<string, unknown>;
requiredResponse: 'advisory' | 'approval' | 'intervention';
timeout: number;
escalatedAt: Date;
}
export interface AgentCapabilities {
canPause: boolean;
canMute: boolean;
canKill: boolean;
canEscalate: boolean;
requiresApproval: string[];
maxAutonomyLevel: number;
}
/**
* Control-aware agent mixin for HITL interactions
* Handles control commands and state management
*/
export declare class ControlAwareAgent extends EventEmitter {
protected agentStatus: AgentStatus;
protected messageBus: MessageBus;
protected capabilities: AgentCapabilities;
protected controlChannel: string;
protected heartbeatInterval?: NodeJS.Timeout;
protected pausedOperations: Array<() => Promise<void>>;
constructor(agentId: string, messageBus: MessageBus, capabilities?: Partial<AgentCapabilities>);
/**
* Initialize the agent and set up control channels
*/
initialize(): Promise<void>;
/**
* Shutdown the agent and cleanup resources
*/
shutdown(): Promise<void>;
/**
* Handle incoming control messages
*/
private handleControlMessage;
/**
* Handle pause command
*/
private handlePause;
/**
* Handle resume command
*/
private handleResume;
/**
* Handle mute command
*/
private handleMute;
/**
* Handle unmute command
*/
private handleUnmute;
/**
* Handle kill command
*/
private handleKill;
/**
* Handle escalate command
*/
private handleEscalate;
/**
* Check if agent can execute an action
*/
canExecuteAction(actionType: string): boolean;
/**
* Request approval for an action
*/
requestApproval(actionType: string, context: Record<string, unknown>, timeout?: number): Promise<boolean>;
/**
* Self-escalate when encountering issues
*/
selfEscalate(reason: string, severity?: EscalationRequest['severity'], requiredResponse?: EscalationRequest['requiredResponse']): Promise<void>;
/**
* Update agent progress
*/
updateProgress(progress: number, currentTask?: string): void;
/**
* Report agent status
*/
reportStatus(): Promise<AgentStatus>;
/**
* Get agent capabilities
*/
getCapabilities(): AgentCapabilities;
/**
* Get current status
*/
getStatus(): AgentStatus;
private updateState;
private setupControlListener;
private startHeartbeat;
private resumePausedOperations;
private sendEscalationNotification;
/**
* Add operation to pause queue (for resuming later)
*/
protected addPausedOperation(operation: () => Promise<void>): void;
/**
* Check if agent should pause execution
*/
protected shouldPause(): boolean;
/**
* Check if agent should stop execution
*/
protected shouldStop(): boolean;
/**
* Wait for resume if paused
*/
protected waitForResume(): Promise<void>;
/**
* Health check
*/
healthCheck(): Promise<{
status: 'healthy' | 'unhealthy';
details: Record<string, unknown>;
}>;
}
//# sourceMappingURL=controlAwareAgent.d.ts.map