export const searchFetchDependencyDeclarations = [
    {
        dependencyId: "runtime.execEngine.network.fetch",
        kind: "runtime",
        required: true,
        description: "Runtime-provided HTTP fetch exposed through BaseToolExecutorPort.network.fetch",
    },
    {
        dependencyId: "runtime.governancePlane.networkFetchGuard",
        kind: "permission",
        required: true,
        description: "Runtime network/fetch governance, domain policy, and affirmative real-execution guard",
    },
    {
        dependencyId: "provider.web.fetch",
        kind: "service",
        required: false,
        description: "Provider-native or portable web fetch carried by runtime; baseTool never creates SDK clients",
    },
];
export function createHostExecutorSearchFetchProvider(executor) {
    const fetch = executor?.network?.fetch;
    if (fetch === undefined) {
        return undefined;
    }
    return async (request) => {
        const result = await fetch({
            url: request.url,
            method: request.method,
            expectedContentType: request.expectedContentType,
            maxBytes: request.maxBytes,
            timeoutMs: request.timeoutMs,
            context: request.context,
        });
        if (!result.ok) {
            throw new Error(result.error.message);
        }
        return result.output;
    };
}
