/** * Daemon Protocol Types * * Defines message types for IPC communication between CLI client and daemon server */ import type { PhotonClass } from '@portel/photon-core'; /** * Message from CLI client to daemon server */ export interface DaemonRequest { type: 'command' | 'ping' | 'shutdown' | 'reload' | 'prompt_response' | 'subscribe' | 'unsubscribe' | 'publish' | 'lock' | 'unlock' | 'assign_lock' | 'transfer_lock' | 'query_lock' | 'schedule' | 'unschedule' | 'list_jobs' | 'ps' | 'enable_schedule' | 'disable_schedule' | 'pause_schedule' | 'resume_schedule' | 'add_manual_schedule' | 'get_execution_history' | 'list_locks' | 'get_events_since' | 'clear_instances' | 'get_circuit_health' | 'status'; id: string; /** Photon name for routing to correct SessionManager (required for multi-photon daemon) */ photonName?: string; /** Path to photon file for reload command or initial photon setup */ photonPath?: string; sessionId?: string; clientType?: 'cli' | 'mcp' | 'code-mode' | 'beam'; /** Instance name hint for auto-recovery from session drift */ instanceName?: string; /** One-shot instance-scoped execution — runs on this instance without mutating the session */ targetInstance?: string; /** Working directory override (base dir for state/config/cache). Defaults to ~/.photon */ workingDir?: string; /** * Constructor env values captured by the caller for this photon. * Only includes env vars declared by primitive constructor parameters. */ constructorEnv?: Record; method?: string; args?: Record; /** Response to a prompt request */ promptValue?: string | boolean | null; /** Channel name for pub/sub operations */ channel?: string; /** Message payload for publish operations */ message?: unknown; /** Lock name for lock/unlock operations */ lockName?: string; /** Lock timeout in ms (default: 30000) */ lockTimeout?: number; /** Explicit lock holder (caller ID for identity-aware locks) */ lockHolder?: string; /** Target holder for lock transfer */ lockTransferTo?: string; /** Job ID for schedule operations */ jobId?: string; /** Cron expression for scheduled jobs */ cron?: string; /** Last event timestamp received by client (for delta sync on reconnect) */ lastEventId?: string; /** Max rows for history-style queries (get_execution_history). */ limit?: number; /** Lower time bound (unix ms) for history-style queries. */ sinceTs?: number; } /** * Response from daemon server to CLI client */ export interface DaemonResponse { type: 'result' | 'error' | 'pong' | 'prompt' | 'channel_message' | 'refresh_needed' | 'emit' | 'shutdown'; id: string; success?: boolean; data?: unknown; error?: string; /** Actionable hint for the caller when type === 'error' */ suggestion?: string; /** Prompt request details (when type === 'prompt') */ prompt?: { type: 'text' | 'password' | 'confirm' | 'select'; message: string; default?: string; options?: Array; }; /** Generator emit yield data (when type === 'emit') */ emitData?: Record; /** Channel name for channel_message type */ channel?: string; /** Message payload for channel_message type */ message?: unknown; /** Event timestamp for tracking (for delta sync support) */ eventId?: string; /** Tool execution duration in milliseconds */ durationMs?: number; /** Shutdown reason (when type === 'shutdown') */ reason?: string; } /** * Daemon status information */ export interface DaemonStatus { running: boolean; pid?: number; startTime?: number; lastActivity?: number; photonName: string; activeSessions?: number; } /** * Session information */ export interface PhotonSession { id: string; instance: PhotonClass; instanceName: string; createdAt: number; lastActivity: number; clientType?: string; } /** * Scheduled job information */ export interface ScheduledJob { id: string; method: string; args?: Record; cron: string; requiredConfig?: string[]; lastRun?: number; lastAttempt?: number; lastStatus?: 'success' | 'error'; lastError?: string; consecutiveFailures?: number; nextRun?: number; runCount: number; createdAt: number; createdBy?: string; } /** * Lock information */ export interface LockInfo { name: string; holder: string; acquiredAt: number; expiresAt: number; } /** * Runtime validation for DaemonRequest */ export declare function isValidDaemonRequest(obj: unknown): obj is DaemonRequest; /** * Runtime validation for DaemonResponse */ export declare function isValidDaemonResponse(obj: unknown): obj is DaemonResponse; //# sourceMappingURL=protocol.d.ts.map