import { logger as rootLogger } from '../logger.js';
import type { ToolDispatcher } from './tool-dispatcher.js';
import type { ToolDef } from './provider-base.js';
/** Per-turn caller identity. Matches the subset of `RunContext` the
 *  agim RPC handlers consume + the optional `agent` for A2A self-call
 *  detection. */
export interface ImhubDispatcherCtx {
    platform: string;
    channelId: string;
    threadId: string;
    userId: string;
    /** Calling agent name. A2A uses this to reject self-calls. */
    callerAgent: string;
    /** Optional pino-compatible logger for the RouteContext A2A needs. */
    logger?: typeof rootLogger;
    /** Optional A2A depth — defaults to 0 for native-originated calls. */
    callerDepth?: number;
    /** v1.2.139 — caller's PlanMode flag at dispatch time. When true the
     *  parent thread has `/plan on`, so any sub-agent we spawn MUST also
     *  run read-only. Resolved by native/index.ts via
     *  effectivePlanModeOn(planThreadKey) before building the dispatcher. */
    callerPlanMode?: boolean;
}
/** v1.2.139 — env-driven output cap. When a sub-agent's reply exceeds
 *  this, the dispatcher returns a short head + tail and stashes the full
 *  text into viewer-paste (when configured) so the model can still cite
 *  it. Default 8 KB: enough for typical CR reports / research summaries,
 *  small enough that 2-3 stacked sub-agents don't blow the parent's
 *  context budget. Set 0 to disable truncation. */
export declare function resolveSubAgentOutputCap(): number;
/** v1.2.139 — one-shot transient retry. Mirrors the streamWithFirstTokenRetry
 *  pattern: if the underlying provider/CLI tripped a 5xx / socket reset / quick
 *  timeout, retry exactly once. Permanent errors (4xx, schema fail, model
 *  refusals) keep the original behaviour (no retry). */
export declare function isTransientSubAgentError(msg: string): boolean;
/** v1.2.139 — apply the byte cap to a sub-agent reply, optionally
 *  spilling the full text into viewer-paste so the model can reference
 *  the spill URL. Returns the (possibly truncated) text the dispatcher
 *  should hand to the agent loop. */
export declare function applyOutputCap(raw: string, agentName: string, jobId: number | null): string;
/**
 * Tool roster the LLM sees. JSON Schemas are kept terse — they match
 * the RPC handlers' real expectations without copying claude-code's
 * MCP server's full prose docstrings, which can grow to multi-KB.
 */
export declare function getImhubTools(): ToolDef[];
/** Build a dispatcher closure over the per-turn IM context. */
export declare function buildImhubDispatcher(ctx: ImhubDispatcherCtx): ToolDispatcher;
//# sourceMappingURL=imhub-dispatcher.d.ts.map