import { ToolMessage } from "@langchain/core/messages"; import { z } from "zod/v4"; import { EventEmitter } from "node:events"; import type { SerializableLoggerConfig } from "../logger"; import type { WingmanConfig } from "../config"; export type BackgroundAgentIntegration = { targetBranch: string; conflictFiles?: string[]; changedFiles?: string[]; worktreePath: string; mergeAttempted: boolean; mergeSuccessful?: boolean; errorMessage?: string; pullRequestUrl?: string; }; export type BackgroundAgentStatus = { threadId: string; input: string; worktreeBranch: string; agentName: string; status: "running" | "completed" | "failed" | "integrating" | "integrated" | "conflict"; integration?: BackgroundAgentIntegration; }; export interface BackgroundAgentEventEmitter extends EventEmitter { on(event: "status", listener: (status: BackgroundAgentStatus) => void): this; on(event: "complete", listener: (data: { threadId: string; status: "completed" | "integrated" | "conflict"; }) => void): this; on(event: "error", listener: (data: { error: string; }) => void): this; emit(event: "status", status: BackgroundAgentStatus): boolean; emit(event: "complete", data: { threadId: string; status: "completed" | "integrated" | "conflict"; }): boolean; emit(event: "error", data: { error: string; }): boolean; } export declare const backgroundAgentSchema: z.ZodObject<{ input: z.ZodString; agentName: z.ZodString; autoIntegrate: z.ZodDefault; }, z.core.$strip>; interface SerializableWingmanConfig { name: string; prompt?: string; instructions?: string; modelConfig: { provider: string; model: string; temperature?: number; apiKey?: string; }; workingDirectory: string; mode: "interactive" | "vibe"; backgroundAgentConfig: { pushToRemote: boolean; createPullRequest: boolean; pullRequestTitle: string; pullRequestBody: string; }; toolAbilities?: { symbolRetriever?: any; fileDiagnostics?: any; blockedCommands?: string[]; }; tools?: string[]; loggerConfig: SerializableLoggerConfig; } interface BackgroundAgentWorkerData { config: SerializableWingmanConfig; input: string; agentName: string; threadId: string; mainBranch: string; autoIntegrate: boolean; repoPath: string; } declare class BackgroundAgentManager { private static instance; private activeWorkers; private completedAgents; private eventEmitter; private constructor(); static getInstance(): BackgroundAgentManager; getEventEmitter(): BackgroundAgentEventEmitter; getCompletedAgents(): Map; spawnBackgroundAgent(threadId: string, workerData: BackgroundAgentWorkerData): Promise; private getWorkerPath; private cleanup; terminateAgent(threadId: string): void; terminateAllAgents(): void; removeCompletedAgent(threadId: string): void; } /** * Spawns a background agent that can perform a task in the background using a worker thread */ export declare const createBackgroundAgentTool: (config: WingmanConfig, eventEmitter?: BackgroundAgentEventEmitter) => import("@langchain/core/tools").DynamicStructuredTool; }, z.core.$strip>, { input: string; agentName: string; autoIntegrate: boolean; }, { input: string; agentName: string; autoIntegrate?: boolean | undefined; }, ToolMessage>; export { BackgroundAgentManager };