import type { PluginInput } from '@opencode-ai/plugin'; import { type BackgroundJobStore } from '../../utils'; import type { SessionLifecycle } from '../session-lifecycle'; export { BACKGROUND_JOB_BOARD_METADATA_KEY } from './board-injection'; export declare function createTaskSessionManagerHook(_ctx: PluginInput, options: { strategy?: 'latest' | 'checkpoint-compatible'; maxSessionsPerAgent: number; readContextMinLines?: number; readContextMaxFiles?: number; backgroundJobBoard?: BackgroundJobStore; shouldManageSession: (sessionID: string) => boolean; /** Register a session as orchestrator when the transform hook detects * an orchestrator message but the session isn't in the agent map yet. */ registerSessionAsOrchestrator?: (sessionID: string) => void; /** Optional guard: when provided, idle events for a session that is * currently undergoing a foreground-fallback abort/re-prompt cycle * will NOT trigger idle reconciliation. prevents marking a still- * active child job as completed when the session was aborted for * model fallback rather than natural completion. */ isFallbackInProgress?: (sessionID: string) => boolean; coordinator?: SessionLifecycle; /** Test seam only; production always uses the reconciliation delay. */ idleReconcileDelayMs?: number; }): { observeChatMessage: (input: unknown, output: unknown) => void; 'tool.execute.before': (input: { tool: string; sessionID?: string; callID?: string; }, output: { args?: unknown; }) => Promise; 'tool.execute.after': (input: { tool: string; sessionID?: string; callID?: string; }, output: { output: unknown; metadata?: unknown; }) => Promise; 'experimental.chat.messages.transform': (_input: Record, output: { messages?: unknown; }) => Promise; injectBackgroundJobBoard: (input: Record, output: { messages?: unknown; }) => Promise; event: (input: { event: { type: string; properties?: { info?: { id?: string; parentID?: string; agent?: string; }; id?: string; requestID?: string; sessionID?: string; status?: { type?: string; }; error?: { name?: string; }; }; }; }) => Promise; };