mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 03:15:46 -06:00
refactor(auto-reply): normalize inbound text once (#113179)
* refactor(auto-reply): canonicalize inbound text once * chore(plugin-sdk): refresh API baseline * refactor(auto-reply): narrow finalized template context * test(auto-reply): keep runner fixtures structurally compatible * fix(auto-reply): guard optional post-command agent text * fix(auto-reply): finalize intercepted gateway context * fix(ci): register iOS release planner entries
This commit is contained in:
committed by
GitHub
parent
7915c44773
commit
0dd9dcda2f
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { isStringOption, readStringAlias, readTrimmedStringAlias } from "./string-readers.js";
|
||||
import { isStringOption, readTrimmedStringAlias } from "./string-readers.js";
|
||||
|
||||
describe("string readers", () => {
|
||||
it("checks caller-owned string options from arrays and sets", () => {
|
||||
@@ -12,7 +12,7 @@ describe("string readers", () => {
|
||||
expect(isStringOption(1, modes)).toBe(false);
|
||||
});
|
||||
|
||||
it("reads aliases with explicit raw and trimmed contracts", () => {
|
||||
it("reads trimmed aliases", () => {
|
||||
const record = {
|
||||
empty: "",
|
||||
spaced: " value ",
|
||||
@@ -20,8 +20,6 @@ describe("string readers", () => {
|
||||
invalid: 1,
|
||||
};
|
||||
|
||||
expect(readStringAlias(record, ["invalid", "empty", "fallback"])).toBe("");
|
||||
expect(readStringAlias(record, ["spaced"])).toBe(" value ");
|
||||
expect(readTrimmedStringAlias(record, ["invalid", "empty", "spaced", "fallback"])).toBe(
|
||||
"value",
|
||||
);
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
normalizeOptionalString,
|
||||
readStringValue,
|
||||
} from "@openclaw/normalization-core/string-coerce";
|
||||
import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";
|
||||
|
||||
type StringOptions<T extends string> = readonly T[] | ReadonlySet<T>;
|
||||
|
||||
@@ -17,19 +14,6 @@ export function isStringOption<T extends string>(
|
||||
);
|
||||
}
|
||||
|
||||
export function readStringAlias(
|
||||
record: Readonly<Record<string, unknown>>,
|
||||
keys: readonly string[],
|
||||
): string | undefined {
|
||||
for (const key of keys) {
|
||||
const value = readStringValue(record[key]);
|
||||
if (value !== undefined) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function readTrimmedStringAlias(
|
||||
record: Readonly<Record<string, unknown>>,
|
||||
keys: readonly string[],
|
||||
|
||||
Reference in New Issue
Block a user