export const gitManageIgnoreRulesDependencyDeclarations = [
    {
        dependencyId: "runtime.execEngine.filesystem.readText",
        kind: "filesystem",
        required: true,
        description: "Runtime-owned text reader used to inspect the target ignore file.",
    },
    {
        dependencyId: "runtime.execEngine.filesystem.writeText",
        kind: "filesystem",
        required: true,
        description: "Runtime-owned text writer used for add/remove/replace ignore rule mutations.",
    },
    {
        dependencyId: "runtime.governancePlane.toolInvocationGrant",
        kind: "permission",
        required: true,
        description: "dryRun:false requires an affirmative runtime guard before provider dispatch.",
    },
];
export function createHostExecutorGitManageIgnoreRulesProvider(executor) {
    const readText = executor?.filesystem?.readText;
    if (readText === undefined)
        return undefined;
    const writeText = executor?.filesystem?.writeText;
    return {
        async readText(request) {
            const result = await readText({ path: request.path, encoding: "utf8", maxBytes: request.maxBytes });
            if (!result.ok) {
                return { content: "", missing: result.error.code === "FILE_NOT_FOUND" };
            }
            return { content: result.output.content, truncated: result.output.truncated };
        },
        writeText: writeText === undefined
            ? undefined
            : async (request) => {
                const result = await writeText({ path: request.path, content: request.content, encoding: "utf8" });
                if (!result.ok) {
                    throw new Error(result.error.message);
                }
                return { bytesWritten: result.output.bytesWritten };
            },
    };
}
