mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-16 16:51:51 +00:00
* refactor(errors): consolidate shared formatting * fix(errors): preserve structured diagnostic details * fix(errors): preserve nested cause compatibility * chore(ci): ratchet reduced formatter files
16 lines
778 B
TypeScript
16 lines
778 B
TypeScript
// Gateway generic server utilities.
|
|
// Normalizes voice-wake triggers and formats unknown errors for logs/responses.
|
|
import { normalizeTrimmedStringList } from "@openclaw/normalization-core/string-normalization";
|
|
import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
|
|
import { defaultVoiceWakeTriggers } from "../infra/voicewake.js";
|
|
|
|
export { formatErrorMessage as formatError } from "../infra/errors.js";
|
|
|
|
/** Normalizes voice-wake trigger config with bounded count/length and defaults. */
|
|
export function normalizeVoiceWakeTriggers(input: unknown): string[] {
|
|
const cleaned = normalizeTrimmedStringList(input)
|
|
.slice(0, 32)
|
|
.map((value) => truncateUtf16Safe(value, 64));
|
|
return cleaned.length > 0 ? cleaned : defaultVoiceWakeTriggers();
|
|
}
|