/** * Worker-side proxies of the main-owned agent singletons, installed with * `installGlobal` at worker boot (see `./agents`). * * The APIs are synchronous wherever the main classes are, so those calls are * `callSync` round trips; async APIs use `call`, and results nobody reads * (`setActivity`, `recordReply`, `adopt`) are ordered notifications. Change * listeners share one main-side forwarding subscription per proxy, which is * dropped once the last local listener unsubscribes; events arrive * asynchronously after the main-side change. */ import type { IrcDeliveryReceipt, IrcMessage } from "@oh-my-pi/pi-tui/tools/irc"; import type { AgentAwaitsApi } from "../../registry/agent-awaits.js"; import type { AdoptOptions, AgentLifecycleApi, AgentReleaseOptions, PersistedSubagentReviverFactory } from "../../registry/agent-lifecycle.js"; import type { AgentHistorySummary, AgentRef, AgentRefExpectation, AgentRegistryApi, AgentStatus, RegisterInput, RegistryListener } from "../../registry/agent-registry.js"; import type { IrcBusApi, IrcWaitFilter } from "../../irc/bus.js"; import type { AgentSessionHandle } from "../../session/agent-session-handle.js"; import type { RemoteObject } from "../rpc.js"; import type { AgentLifecycleProtocol, AgentRegistryProtocol, IrcBusProtocol, UnansweredSend } from "./agents-protocol.js"; /** Worker proxy of main's agent awaits table. */ export declare class RemoteAgentAwaits implements AgentAwaitsApi { #private; constructor(remote: RemoteObject); hold(waiter: string, awaited: readonly string[], options: { interruptible: boolean; }): () => void; blocksOn(agent: string, target: string, sentAt: number): boolean; onChange(listener: () => void): () => void; } /** Worker proxy of main's {@link AgentRegistryApi}. */ export declare class RemoteAgentRegistry implements AgentRegistryApi { #private; readonly awaits: AgentAwaitsApi; constructor(remote: RemoteObject); register(input: RegisterInput): AgentRef; registerIfAvailable(input: RegisterInput, expected: AgentRef | null): AgentRef | undefined; reopen(id: string, expected: AgentRef): AgentRef | undefined; setHistory(id: string, history: AgentHistorySummary, expectedSessionFile?: string): boolean; setStatus(id: string, status: AgentStatus, expected?: AgentRefExpectation): boolean; markResultAccepted(id: string, expected?: AgentRefExpectation, responseAt?: number): boolean; staleAcceptedRuns(): AgentRef[]; setActivity(id: string, activity: string): void; attachSession(id: string, session: AgentSessionHandle, sessionFile?: string | null, expected?: AgentRefExpectation): boolean; detachSession(id: string, expected?: AgentRefExpectation): boolean; unregister(id: string, expected?: AgentRefExpectation): boolean; get(id: string): AgentRef | undefined; list(): AgentRef[]; listVisibleTo(id: string): AgentRef[]; isRunning(ref: AgentRef): boolean; /** Subscribes on the session's own thread view and reports each transition to main in order. */ syncSessionStatus(id: string, session: AgentSessionHandle): () => void; onChange(listener: RegistryListener): () => void; } /** Worker proxy of main's {@link AgentLifecycleApi}; the reviver factory and teardown are main-only. */ export declare class RemoteAgentLifecycle implements AgentLifecycleApi { #private; constructor(remote: RemoteObject); setPersistedSubagentReviverFactory(_factory: PersistedSubagentReviverFactory, _idleTtlMs: () => number): void; adopt(id: string, opts: AdoptOptions, expected?: AgentRefExpectation): void; has(id: string, expected?: AgentRefExpectation): boolean; reclaimDeadCorpse(id: string, expected: AgentRef): Promise; /** Identity across the link: only main's registry (this worker's proxy of it) is managed. */ manages(registry: AgentRegistryApi): boolean; isParking(id: string, expected?: AgentRefExpectation): boolean; park(id: string): Promise; ensureLive(id: string): Promise; release(id: string, expected?: AgentRefExpectation, options?: AgentReleaseOptions): Promise; dispose(_deadlineAt?: number): Promise; } /** Worker proxy of main's {@link IrcBusApi}. */ export declare class RemoteIrcBus implements IrcBusApi { #private; constructor(remote: RemoteObject); send(msg: Omit): Promise; sentSince(from: string, to: string, sinceTs: number): boolean; unansweredSends(from: string, sinceTs: number): UnansweredSend[]; wait(agentId: string, filter: IrcWaitFilter, timeoutMs: number, signal?: AbortSignal, options?: { drainPending?: boolean; }): Promise; take(agentId: string, from?: string): IrcMessage | undefined; unreadCount(agentId: string): number; recordReply(from: string, to: string): void; }