fix(coding-agent): use async operations in tools

This commit is contained in:
Mario Zechner
2026-05-23 09:48:51 +02:00
parent 9b62f1f87c
commit e9146a5ff7
17 changed files with 706 additions and 398 deletions

View File

@@ -1,8 +1,8 @@
import { readFile as fsReadFile, stat as fsStat } from "node:fs/promises";
import { createInterface } from "node:readline";
import type { AgentTool } from "@earendil-works/pi-agent-core";
import { Text } from "@earendil-works/pi-tui";
import { spawn } from "child_process";
import { readFileSync, statSync } from "fs";
import path from "path";
import { type Static, Type } from "typebox";
import { keyHint } from "../../modes/interactive/components/keybinding-hints.ts";
@@ -55,8 +55,8 @@ export interface GrepOperations {
}
const defaultGrepOperations: GrepOperations = {
isDirectory: (p) => statSync(p).isDirectory(),
readFile: (p) => readFileSync(p, "utf-8"),
isDirectory: async (p) => (await fsStat(p)).isDirectory(),
readFile: (p) => fsReadFile(p, "utf-8"),
};
export interface GrepToolOptions {