mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-10 13:31:38 +00:00
15 lines
446 B
TypeScript
15 lines
446 B
TypeScript
export function normalizeSessionTitle(raw: unknown): string | null {
|
|
if (typeof raw !== "string") return null;
|
|
const title = raw.trim();
|
|
return title ? title : null;
|
|
}
|
|
|
|
export function titleFromSessionInfoPayload(
|
|
payload: unknown,
|
|
): string | null | undefined {
|
|
if (!payload || typeof payload !== "object" || !("title" in payload)) {
|
|
return undefined;
|
|
}
|
|
|
|
return normalizeSessionTitle((payload as { title?: unknown }).title);
|
|
}
|