export const codeSearchRipgrepDependencyDeclarations = [
    {
        dependencyId: "runtime.execEngine.search.ripgrep",
        kind: "runtime",
        required: true,
        description: "Runtime-provided ripgrep-style search exposed through BaseToolExecutorPort.search.ripgrep",
    },
    {
        dependencyId: "runtime.binary.rg",
        kind: "binary",
        required: true,
        description: "ripgrep-compatible search provider for fast code text search",
    },
    {
        dependencyId: "runtime.governancePlane.workspaceReadScope",
        kind: "permission",
        required: true,
        description: "Runtime workspaceRoot, allowedRoots, and scope decision carried in code.search_Ripgrep context",
    },
];
export function createHostExecutorCodeSearchRipgrepProvider(executor) {
    const ripgrep = executor?.search?.ripgrep;
    if (ripgrep === undefined) {
        return undefined;
    }
    return async (request) => {
        const result = await ripgrep({
            command: request.command,
            query: request.query,
            directoryPath: request.directoryPath,
            fileGlob: request.fileGlob,
            maxMatches: request.maxMatches,
            literal: request.literal,
            caseSensitive: request.caseSensitive,
            includeHidden: request.includeHidden,
            multiline: request.multiline,
            contextLines: request.contextLines,
            context: request.context,
        });
        if (!result.ok) {
            throw new Error(result.error.message);
        }
        return result.output;
    };
}
