openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
22 lines (21 loc) • 426 B
JavaScript
function parseSessionLabel(raw) {
if (typeof raw !== "string") return {
ok: false,
error: "invalid label: must be a string"
};
const trimmed = raw.trim();
if (!trimmed) return {
ok: false,
error: "invalid label: empty"
};
if (trimmed.length > 512) return {
ok: false,
error: `invalid label: too long (max 512)`
};
return {
ok: true,
label: trimmed
};
}
//#endregion
export { parseSessionLabel as t };