mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 05:20:22 +00:00
refactor: dedupe extension lowercase helpers
This commit is contained in:
@@ -47,7 +47,7 @@ export function normalizeIMessageHandle(raw: string): string {
|
||||
return "";
|
||||
}
|
||||
const value = trimmed.slice(prefix.length).trim();
|
||||
return `${prefix.toLowerCase()}${value}`;
|
||||
return `${normalizeLowercaseStringOrEmpty(prefix)}${value}`;
|
||||
}
|
||||
if (trimmed.includes("@")) {
|
||||
return normalizeLowercaseStringOrEmpty(trimmed);
|
||||
|
||||
@@ -3,6 +3,7 @@ import { loadConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import { runCommandWithTimeout } from "openclaw/plugin-sdk/process-runtime";
|
||||
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
|
||||
import { detectBinary } from "openclaw/plugin-sdk/setup";
|
||||
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime";
|
||||
import { createIMessageRpcClient } from "./client.js";
|
||||
import { DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS } from "./constants.js";
|
||||
|
||||
@@ -35,7 +36,7 @@ async function probeRpcSupport(cliPath: string, timeoutMs: number): Promise<RpcS
|
||||
try {
|
||||
const result = await runCommandWithTimeout([cliPath, "rpc", "--help"], { timeoutMs });
|
||||
const combined = `${result.stdout}\n${result.stderr}`.trim();
|
||||
const normalized = combined.toLowerCase();
|
||||
const normalized = normalizeLowercaseStringOrEmpty(combined);
|
||||
if (normalized.includes("unknown command") && normalized.includes("rpc")) {
|
||||
const fatal = {
|
||||
supported: false,
|
||||
|
||||
@@ -21,7 +21,7 @@ function normalizeIMessageTestHandle(raw: string): string {
|
||||
}
|
||||
if (/^(chat_id:|chat_guid:|chat_identifier:)/i.test(trimmed)) {
|
||||
return trimmed.replace(/^(chat_id:|chat_guid:|chat_identifier:)/i, (match) =>
|
||||
match.toLowerCase(),
|
||||
normalizeLowercaseStringOrEmpty(match),
|
||||
);
|
||||
}
|
||||
if (trimmed.includes("@")) {
|
||||
|
||||
Reference in New Issue
Block a user