/** * Shared agent profile management — loading, locking, and resolution. * Used by both host.ts and server.ts. */ import type { CanonEnvironmentId } from '@canonmsg/backend-contracts'; import type { AgentClientType } from './types.js'; import { type CanonRuntimeConnectionOptions } from './runtime-endpoints.js'; export interface AgentProfileInput { apiKey: string; agentId: string; agentName: string; registeredAt: string; environmentId: CanonEnvironmentId; baseUrl: string; streamUrl: string; rtdbUrl: string; firebaseApiKey: string; clientType?: AgentClientType; runtimeId?: string; } export interface AgentProfile extends AgentProfileInput { baseUrl: string; streamUrl: string; rtdbUrl: string; firebaseApiKey: string; } export interface ProfileLockHandle { profile: string; pid: number; token: string; release(): void; } export declare const CANON_DIR: string; export declare const AGENTS_PATH: string; export declare const LOCKS_DIR: string; export declare const PENDING_REGISTRATIONS_PATH: string; export declare function loadProfiles(): Record; export declare function saveProfiles(profiles: Record): void; export declare function upsertAgentProfile(name: string, profile: AgentProfileInput): Record; export declare function isProcessAlive(pid: number): boolean; export declare function isProfileLocked(profile: string): { locked: boolean; pid?: number; }; export declare function acquireLock(profile: string): ProfileLockHandle; export declare function releaseLock(profile: string, token?: string): void; export interface PendingRegistration { profile: string; clientType?: AgentClientType; localRegistrationId: string; environmentId: CanonEnvironmentId; baseUrl: string; streamUrl: string; rtdbUrl: string; firebaseApiKey: string; requestId?: string; pollToken?: string; createdAt: string; updatedAt: string; } export declare function loadPendingRegistrations(): Record; export declare function savePendingRegistrations(pending: Record): void; export declare function getOrCreatePendingRegistration(profile: string, clientType?: AgentClientType, connectionOptions?: CanonRuntimeConnectionOptions): PendingRegistration; export declare function updatePendingRegistration(profile: string, patch: Partial>): PendingRegistration; export declare function clearPendingRegistration(profile: string): void;