fix(build): import tool-display.json instead of fs.readFileSync (#312)

This commit is contained in:
Muhammed Mukhthar CM
2026-01-06 22:25:02 +05:30
committed by GitHub
parent 967cef80bc
commit 4bb53e19f9
2 changed files with 3 additions and 12 deletions

View File

@@ -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.

View File

@@ -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 ?? {};