import type { ExtensionContext } from "@earendil-works/pi-coding-agent"; import { type FollowerRuntimeDiagnostic, type FollowerThreadState, type InboxMessage, type PinetControlCommand, type PinetRemoteControlRequestResult, type SlackBridgeSettings } from "./helpers.js"; import { type FollowerDeliveryState } from "./follower-delivery.js"; import { BrokerClient } from "./broker/client.js"; export type BrokerClientRef = { client: BrokerClient; pollInterval: ReturnType | null; }; type SharedFollowerThreadState = Pick; export interface FollowerRuntimeDeps { getSettings: () => SlackBridgeSettings; refreshSettings: () => void; getPinetEnabled: () => boolean; getAgentIdentity: () => { name: string; emoji: string; }; getAgentStableId: () => string; getAgentOwnerToken: () => string; setAgentOwnerToken: (ownerToken: string) => void; getDesiredAgentStatus: () => "working" | "idle"; getAgentAliases: () => Iterable; getThreads: () => Map; getLastDmChannel: () => string | null; setLastDmChannel: (channelId: string | null) => void; pushInboxMessages: (messages: InboxMessage[]) => void; getAgentMetadata: (role: "broker" | "worker") => Promise>; applyRegistrationIdentity: (registration: { name: string; emoji: string; metadata?: Record | null; }) => void; persistState: () => void; updateBadge: () => void; maybeDrainInboxIfIdle: (ctx: ExtensionContext) => boolean; requestRemoteControl: (command: PinetControlCommand, ctx: ExtensionContext) => PinetRemoteControlRequestResult; deferControlAck: (command: PinetControlCommand, inboxId: number) => void; runRemoteControl: (command: PinetControlCommand, ctx: ExtensionContext) => void; deliverFollowUpMessage: (text: string) => boolean; setExtStatus: (ctx: ExtensionContext, state: "ok" | "reconnecting" | "error" | "off") => void; getRuntimeDiagnostic: () => FollowerRuntimeDiagnostic | null; setRuntimeDiagnostic: (diagnostic: FollowerRuntimeDiagnostic | null) => void; handleTerminalReconnectFailure: (ctx: ExtensionContext, error: Error) => Promise | void; formatError: (error: unknown) => string; deliveryState: FollowerDeliveryState; } export interface FollowerRuntime { connect: (ctx: ExtensionContext) => Promise; disconnect: (ctx: ExtensionContext, options?: { releaseIdentity?: boolean; }) => Promise<{ unregisterError: string | null; }>; syncDesiredStatus: (desiredStatus: "working" | "idle", options?: { force?: boolean; }) => Promise; flushDeliveredAcks: () => Promise; getClientRef: () => BrokerClientRef | null; } export declare function createFollowerRuntime(deps: FollowerRuntimeDeps): FollowerRuntime; export {};