import { type PinetReadOptions, type PinetReadResult } from "@pinet/pinet-core/pinet-read-formatting"; import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent"; import type { RalphSnoozeStatus } from "./ralph-loop.js"; import type { AgentSessionSearchInfo, AgentSessionSearchOptions, AgentSessionSummary, PortLeaseAcquireInput, PortLeaseInfo, PortLeaseListOptions, PortLeaseReleaseInput, PortLeaseRenewInput, PinetLaneInfo, PinetLaneListOptions, PinetLaneParticipantInfo, PinetLaneParticipantUpsertInput, PinetLaneUpsertInput } from "./broker/types.js"; export interface PinetToolsAgentRecord { 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 PinetSubtreeSpawnInput { task: string; repo: string; role?: string; laneId?: string; } export interface PinetSubtreeSpawnResult { status: "started"; launchId: string; sessionName: string; repoPath: string; role: string; laneId: string | null; agentId: string; agentName: string; messageId: number; threadId: string; monitorCommand: string; socketPath: string; dbPath: string; childLaunchEnv: Record; } export interface RegisterPinetToolsDeps { pinetEnabled: () => boolean; brokerRole: () => "broker" | "follower" | null; requireToolPolicy: (toolName: string, threadTs: string | undefined, action: string) => void; 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[]; }; signalAgentFree: (ctx: ExtensionContext | undefined, options: { requirePinet?: boolean; }) => Promise<{ queuedInboxCount: number; drainedQueuedInbox: boolean; }>; scheduleBrokerWakeup: (fireAt: string, message: string) => Promise<{ id: number; fireAt: string; }>; scheduleFollowerWakeup: (fireAt: string, message: string) => Promise<{ id: number; fireAt: string; }>; readPinetInbox: (options: PinetReadOptions) => Promise; listBrokerAgents: () => PinetToolsAgentRecord[]; listFollowerAgents: (includeGhosts: boolean) => Promise; searchPinetSessions: (options: AgentSessionSearchOptions) => Promise; listSubtreeAgents?: (includeGhosts: boolean) => PinetToolsAgentRecord[] | null; getSubtreeSelfAgentId?: () => string | null; spawnSubtreeWorker?: (input: PinetSubtreeSpawnInput) => Promise; listPinetLanes: (options: PinetLaneListOptions) => Promise; upsertPinetLane: (input: PinetLaneUpsertInput) => Promise; setPinetLaneParticipant: (input: PinetLaneParticipantUpsertInput) => Promise; acquirePortLease: (input: PortLeaseAcquireInput) => Promise; renewPortLease: (input: PortLeaseRenewInput) => Promise; releasePortLease: (input: PortLeaseReleaseInput) => Promise; getPortLease: (leaseId: string) => Promise; listPortLeases: (options: PortLeaseListOptions) => Promise; expirePortLeases: () => Promise; ralphSnoozeStatus?: () => RalphSnoozeStatus | null; snoozeRalphLoop?: (input: { durationMs: number; reason?: string | null; }) => RalphSnoozeStatus; clearRalphSnooze?: () => RalphSnoozeStatus; } type PinetDispatcherStatus = "succeeded" | "failed"; interface PinetRenderContentBlock { type: string; text?: string; } interface PinetRenderResultInput { content?: PinetRenderContentBlock[]; details?: unknown; expandedText?: string; displayText?: string; } export declare function formatPinetDispatcherResultForDisplay(result: PinetRenderResultInput, expanded: boolean): { status: PinetDispatcherStatus | "unknown"; text: string; }; export declare function registerPinetTools(pi: ExtensionAPI, deps: RegisterPinetToolsDeps): void; export {};