import { type AgentMessageStorage } from "./broker/agent-messaging.js"; import type { AgentInfo, AgentSessionSearchInfo, AgentSessionSearchOptions, AgentSessionSummary, TaskAssignmentInfo, TaskAssignmentKind } from "./broker/types.js"; import type { ActivityLogEntry } from "./activity-log.js"; export interface PinetMeshOpsAgentRecord { emoji: string; name: string; id: string; pid?: number; stableId?: string | null; session?: AgentSessionSummary | null; status: "working" | "idle"; metadata: Record | null; lastHeartbeat: string; lastSeen?: string; disconnectedAt?: string | null; resumableUntil?: string | null; outboundCount?: number; pendingInboxCount?: number; parentAgentId?: string | null; rootAgentId?: string | null; treeDepth?: number; supervisionState?: string; subtreeRole?: string | null; laneId?: string | null; } export interface PinetMeshOpsRecordedAssignment { issueNumber: number; branch: string | null; } export interface PinetMeshOpsTransferableThread { threadId: string; source?: string; channel?: string; } export interface PinetMeshOpsBrokerDbPort extends AgentMessageStorage { getAllAgents: () => AgentInfo[]; searchAgentSessions: (options?: AgentSessionSearchOptions) => AgentSessionSearchInfo[]; getPendingInboxCount: (agentId: string) => number; getThread: (threadId: string) => PinetMeshOpsTransferableThread | null; transferThreadOwnership: (threadId: string, ownerAgent: string) => { reassignedInboxCount: number; updatedMessageCount: number; }; recordTaskAssignment: (agentId: string, issueNumber: number, branch: string | null, threadId: string, sourceMessageId: number, options?: { repoOwner?: string | null; repoName?: string | null; repoRoot?: string | null; taskKind?: TaskAssignmentKind; }) => TaskAssignmentInfo; scheduleWakeup: (agentId: string, message: string, fireAt: string) => { id: number; fireAt: string; } | Promise<{ id: number; fireAt: string; }>; } export interface PinetMeshOpsFollowerAgentRecord extends Omit { status?: PinetMeshOpsAgentRecord["status"] | null; } export interface PinetMeshOpsFollowerClientPort { sendAgentMessage: (target: string, body: string, metadata?: Record) => Promise; scheduleWakeup: (fireAt: string, message: string) => Promise<{ id: number; fireAt: string; }>; listAgents: (includeGhosts: boolean) => Promise; searchAgentSessions: (options: AgentSessionSearchOptions) => Promise; } export interface PinetMeshOpsDeps { getPinetEnabled: () => boolean; getBrokerRole: () => "broker" | "follower" | null; getActiveBrokerDb: () => PinetMeshOpsBrokerDbPort | null; getActiveBrokerSelfId: () => string | null; getAgentName: () => string; getFollowerClient: () => PinetMeshOpsFollowerClientPort | null; sendSubtreeAgentMessage?: (target: string, body: string, metadata?: Record) => Promise<{ messageId: number; target: string; threadId: string; } | null>; formatTrackedAgent: (agentId: string) => string; logActivity: (entry: ActivityLogEntry) => void; } export interface PinetMeshOps { sendPinetAgentMessage: (target: string, body: string, metadata?: Record) => Promise<{ messageId: number; target: string; transferredThreadId?: string; transferredThreadChannel?: string; }>; sendPinetBroadcastMessage: (channel: string, body: string) => { channel: string; messageIds: number[]; recipients: string[]; }; scheduleBrokerWakeup: (fireAt: string, message: string) => Promise<{ id: number; fireAt: string; }>; scheduleFollowerWakeup: (fireAt: string, message: string) => Promise<{ id: number; fireAt: string; }>; listBrokerAgents: () => PinetMeshOpsAgentRecord[]; listFollowerAgents: (includeGhosts: boolean) => Promise; searchPinetSessions: (options: AgentSessionSearchOptions) => Promise; } export declare function parseGitHubRemoteRepo(remoteUrl: string): { repoOwner: string; repoName: string; } | null; export declare function createPinetMeshOps(deps: PinetMeshOpsDeps): PinetMeshOps;