From 4bb53e19f9f5b4139b4f296212596213bdc1f28d Mon Sep 17 00:00:00 2001 From: Muhammed Mukhthar CM <56378562+mukhtharcm@users.noreply.github.com> Date: Tue, 6 Jan 2026 22:25:02 +0530 Subject: [PATCH] fix(build): import tool-display.json instead of fs.readFileSync (#312) --- CHANGELOG.md | 1 + src/agents/tool-display.ts | 14 ++------------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69ec9d9ca..93d226926 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Groups: `whatsapp.groups`, `telegram.groups`, and `imessage.groups` now act as allowlists when set. Add `"*"` to keep allow-all behavior. ### Fixes +- Build: import tool-display JSON as a module instead of runtime file reads. Thanks @mukhtharcm for PR #312. - Messages: stop defaulting ack reactions to 👀 when identity emoji is missing. - Auto-reply: require slash for control commands to avoid false triggers in normal text. - Auto-reply: treat steer during compaction as a follow-up, queued until compaction completes. diff --git a/src/agents/tool-display.ts b/src/agents/tool-display.ts index 1d531e8c5..9e9a5a9e0 100644 --- a/src/agents/tool-display.ts +++ b/src/agents/tool-display.ts @@ -1,6 +1,6 @@ -import fs from "node:fs"; import { redactToolDetail } from "../logging/redact.js"; import { shortenHomeInString } from "../utils.js"; +import TOOL_DISPLAY_JSON from "./tool-display.json" with { type: "json" }; type ToolDisplayActionSpec = { label?: string; @@ -30,17 +30,7 @@ export type ToolDisplay = { detail?: string; }; -const TOOL_DISPLAY_CONFIG: ToolDisplayConfig = (() => { - try { - const raw = fs.readFileSync( - new URL("./tool-display.json", import.meta.url), - "utf8", - ); - return JSON.parse(raw) as ToolDisplayConfig; - } catch { - return {}; - } -})(); +const TOOL_DISPLAY_CONFIG = TOOL_DISPLAY_JSON as ToolDisplayConfig; const FALLBACK = TOOL_DISPLAY_CONFIG.fallback ?? { emoji: "🧩" }; const TOOL_MAP = TOOL_DISPLAY_CONFIG.tools ?? {};