mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 21:44:32 +00:00
refactor(agents): centralize tool display definitions
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import SHARED_TOOL_DISPLAY_JSON from "../../apps/shared/OpenClawKit/Sources/OpenClawKit/Resources/tool-display.json" with { type: "json" };
|
||||
import { redactToolDetail } from "../logging/redact.js";
|
||||
import { shortenHomeInString } from "../utils.js";
|
||||
import {
|
||||
@@ -9,7 +10,7 @@ import {
|
||||
resolveToolVerbAndDetail,
|
||||
type ToolDisplaySpec as ToolDisplaySpecBase,
|
||||
} from "./tool-display-common.js";
|
||||
import TOOL_DISPLAY_JSON from "./tool-display.json" with { type: "json" };
|
||||
import TOOL_DISPLAY_OVERRIDES_JSON from "./tool-display-overrides.json" with { type: "json" };
|
||||
|
||||
type ToolDisplaySpec = ToolDisplaySpecBase & {
|
||||
emoji?: string;
|
||||
@@ -30,9 +31,11 @@ export type ToolDisplay = {
|
||||
detail?: string;
|
||||
};
|
||||
|
||||
const TOOL_DISPLAY_CONFIG = TOOL_DISPLAY_JSON as ToolDisplayConfig;
|
||||
const FALLBACK = TOOL_DISPLAY_CONFIG.fallback ?? { emoji: "🧩" };
|
||||
const TOOL_MAP = TOOL_DISPLAY_CONFIG.tools ?? {};
|
||||
const SHARED_TOOL_DISPLAY_CONFIG = SHARED_TOOL_DISPLAY_JSON as ToolDisplayConfig;
|
||||
const TOOL_DISPLAY_OVERRIDES = TOOL_DISPLAY_OVERRIDES_JSON as ToolDisplayConfig;
|
||||
const FALLBACK = TOOL_DISPLAY_OVERRIDES.fallback ??
|
||||
SHARED_TOOL_DISPLAY_CONFIG.fallback ?? { emoji: "🧩" };
|
||||
const TOOL_MAP = Object.assign({}, SHARED_TOOL_DISPLAY_CONFIG.tools, TOOL_DISPLAY_OVERRIDES.tools);
|
||||
const DETAIL_LABEL_OVERRIDES: Record<string, string> = {
|
||||
agentId: "agent",
|
||||
sessionKey: "session",
|
||||
|
||||
Reference in New Issue
Block a user