import type { MachineEnvelope } from "../runtime/runtime.js"; import { type BatchCapableHost, type DispatchCall, type DispatchStats } from "./dispatch.js"; import type { ChainArgs, EditArgs, FindArgs, ReadArgs, SearchArgs } from "./types.js"; /** * Spawn/CLI transport. Hosts provide argv `run` only — never a typed twin. * Typed entry lives solely on {@link DispatchSurface} (dispatcher output). */ export type ConnectorHost = { run(args: readonly string[], context: { cwd: string; }, options?: { signal?: AbortSignal; }): Promise; }; /** * Trusted typed dispatch after coalescing. `call` is required; no argv peer * that can disagree with tool+args. */ export type DispatchSurface = { call(tool: string, args: Record, context: { cwd: string; }, options?: { signal?: AbortSignal; }): Promise; }; type SymbolArgs = Omit & { symbol: string; }; type ImportArgs = Omit & { module: string; }; export type AsgrepConnector = { search(input: SearchArgs, options?: { signal?: AbortSignal; }): Promise; find(input: FindArgs, options?: { signal?: AbortSignal; }): Promise; read(input: ReadArgs, options?: { signal?: AbortSignal; }): Promise; edit(input: EditArgs, options?: { signal?: AbortSignal; }): Promise; semantic(input: SearchArgs, options?: { signal?: AbortSignal; }): Promise; chain(input: ChainArgs, options?: { signal?: AbortSignal; }): Promise; defs(input: SymbolArgs, options?: { signal?: AbortSignal; }): Promise; callers(input: SymbolArgs, options?: { signal?: AbortSignal; }): Promise; imports(input: ImportArgs, options?: { signal?: AbortSignal; }): Promise; indexStatus(options?: { signal?: AbortSignal; }): Promise; indexRepo(input?: { force?: boolean; }, options?: { signal?: AbortSignal; }): Promise; /** Progressive discovery (like deferred tools) — list/filter available asgrep tools. */ catalogSearch(input: { query: string; }, options?: { signal?: AbortSignal; }): Promise; catalogDescribe(input: { name: string; }, options?: { signal?: AbortSignal; }): Promise; doctor(options?: { signal?: AbortSignal; }): Promise; }; export type ConnectorBundle = { asgrep: AsgrepConnector; stats: () => DispatchStats; /** Per-call dispatch trace for the current run (lane + ms + ok, capped). */ trace: () => DispatchCall[]; resetStats: () => void; }; /** * Host-side connector: typed methods the Code Mode program calls. * * Same-tick calls (Promise.all) are coalesced by CodemodeDispatcher so N * lookups share sticky serve / one warm batch process when available. */ export declare function createAsgrepConnector(host: BatchCapableHost, context: { cwd: string; }, options?: { signal?: AbortSignal; scope?: string; localReads?: boolean; }): ConnectorBundle; export {};