/** * Pi coding agent backend plugin. * 通过 `pi --mode json -p` 驱动 agent,JSON 事件流输出。 */ import { CliAgentBackend, type BaseCliSession, type ParsedOutput } from "../agent/cli-base.js"; import type { AgentSessionActivity, SessionConfig, ExecHooks } from "../agent/types.js"; interface PiSession extends BaseCliSession { sessionLogPath?: string; } export default class PiBackend extends CliAgentBackend { constructor(); command(): string; needsStableUserPrefix(): boolean; buildSession(config: SessionConfig): PiSession; buildInput(session: PiSession, message: string): { args: string[]; stdin?: string; }; protected isProbeError(err: any): boolean; protected getExecHooks(session: PiSession): ExecHooks; parseOutput(stdout: string, session: PiSession): ParsedOutput; protected loadSessionTranscript(session: PiSession): Promise<{ sources: { path: string; role: string; }[]; backend: string; agentSessionId: string; events: Iterable | AsyncIterable; }>; protected refreshActivity(sessionId: string, activity: AgentSessionActivity): void; protected probeSessionFileMtime(session: PiSession): number | null; private scanJsonl; private getJsonlPath; private readLastLines; } export declare function encodePiSessionDir(cwd: string): string; export {};