import type { AgentHistoryEvent } from "./events.js"; import type { AgentHandle, AgentMemberConfig, AgentStatus, ContextUsage } from "./types.js"; export type DispatchState = "idle" | "promptSubmitted" | "running" | "aborting"; export interface PendingThinkingSwitch { thinkingLevel: string; } export interface PendingCredentialRefresh { profileId: string; providerSlug: string; changeType: "profileUpdated" | "profileDeleted"; } export interface SessionSources { compiled: { agentPrompt: string; appendSystemPrompt: string[]; }; } export interface AgentInstance { handle: AgentHandle; activeSourceRef: string | null; memberId: string; agentName: string; status: AgentStatus; dispatchState: DispatchState; promptInFlight: boolean; profilePromptDirty?: boolean; pendingThinkingSwitch?: PendingThinkingSwitch; pendingCredentialRefresh?: PendingCredentialRefresh; hadErrorInTurn: boolean; lastTurnError: string | null; pendingErrorNotice: string | null; compacting: boolean; turnActive: boolean; sessionSources: SessionSources; unsubscribe: () => void; eventBuffer: AgentHistoryEvent[]; appliedModel: string; appliedCredentialId?: string; pendingReload: string | null; } export declare function instanceKey(memberId: string): string; export declare function trackMemberOperation(memberId: string, operation: () => Promise): Promise; export declare function settleMemberOperations(memberId?: string): Promise; export declare const instances: Map; export declare const activeInstanceCount: () => number; export declare const cancelledCreations: Set; export declare const sessionPublishOwners: Map; export declare const pendingCreations: Map>; export declare const memberSwitchGates: Map>; export declare function pendingCreationsFor(memberId: string): Array>; export declare function updateDispatchState(instance: AgentInstance, next: DispatchState, trigger: string): void; export interface AgentStatusBroadcast { type: "agent:status"; roomId: string; agent: string; memberId: string; status: AgentStatus; } export type AgentStatusSink = (target: string, payload: AgentStatusBroadcast) => void; export declare function setStatusSink(sink: AgentStatusSink | undefined): void; export declare function memberIdentityMeta(_agentName: string, memberId: string): { memberId: string; }; export declare function transition(instance: AgentInstance, sourceRef: string | null, memberName: string, newStatus: AgentStatus, trigger: string): void; export declare const contextUsageCache: Map; import type { Database } from "../data/database.js"; export interface RuntimeStateEntry { contractFingerprint?: string; contractVersion?: number; driftNotified?: number; } export declare function getRuntimeStateEntry(memberId: string, db?: Database): RuntimeStateEntry; export declare function importRuntimeStateEntry(db: Database, memberId: string, entry: RuntimeStateEntry, updatedAt: number): void; export declare function updateRuntimeStateEntry(memberId: string, patch: RuntimeStateEntry): void; export declare function setContractFingerprint(memberId: string, fingerprint: string, contractVersion: number): void; export declare function clearRuntimeStateEntry(memberId: string): void; export declare function openRuntimeAdmission(): void; export declare function closeRuntimeAdmission(): void; export declare function runtimeIsStopping(): boolean; /** Archive intent closes member admission durably before quiescence starts. */ export declare function memberRuntimeAllowed(memberId: string): boolean; export declare function formatRuntimeErrorMessage(error: unknown): string; export declare function isMemberConfigured(member: AgentMemberConfig): boolean; export declare function memberUnconfiguredMessage(memberName: string): string; export declare function currentProfileRevision(): number; export declare function notifyMemberProfileChanged(member: { id: string; name: string; title?: string; }): void; //# sourceMappingURL=instance.d.ts.map