if (URL_PREFIX_RE.test(token)) { returntrue;
} if (
token.startsWith("/") ||
token.startsWith("~/") ||
token.startsWith("./") ||
token.startsWith("../")
) { returntrue;
} if (WINDOWS_DRIVE_RE.test(token) || token.startsWith("\\\\")) { returntrue;
} if (token.includes("/") || token.includes("\\")) { returntrue;
} if (token.includes("_") && FILE_LIKE_RE.test(token)) { returntrue;
}
// Preserve long credential-like tokens (hex/base62/etc.) to avoid introducing // visible spaces that users may copy back into secrets. if (candidate.length >= TOKENISH_MIN_LENGTH && /[a-z]/i.test(candidate) && /\d/.test(candidate)) { returntrue;
} returnfalse;
}
function collectSanitizedBlockStrings(params: {
content: unknown;
blockType: "text" | "thinking";
valueKey: "text" | "thinking";
}): string[] { if (!Array.isArray(params.content)) { return [];
} const parts: string[] = []; for (const block of params.content) { if (!block || typeof block !== "object") { continue;
} const rec = block as Record<string, unknown>; if (rec.type === params.blockType && typeof rec[params.valueKey] === "string") {
parts.push(sanitizeRenderableText(rec[params.valueKey] as string));
}
} return parts;
}
/** * Extract ONLY thinking blocks from message content. * Model-agnostic: returns empty string if no thinking blocks exist.
*/
export function extractThinkingFromMessage(message: unknown): string { const resolved = resolveMessageRecord(message); if (!resolved) { return"";
} const { content } = resolved; if (typeof content === "string") { return"";
} const parts = collectSanitizedBlockStrings({
content,
blockType: "thinking",
valueKey: "thinking",
}); return parts.join("\n").trim();
}
/** * Extract ONLY text content blocks from message (excludes thinking). * Model-agnostic: works for any model with text content blocks.
*/
export function extractContentFromMessage(message: unknown): string { const resolved = resolveMessageRecord(message); if (!resolved) { return"";
} const { record, content } = resolved;
if (record.role === "assistant") { if (typeof content === "string") { return sanitizeRenderableText(content).trim();
} if (Array.isArray(content)) { return extractAssistantRenderableContent(record);
}
}
if (typeof content === "string") { return sanitizeRenderableText(content).trim();
}
export function asString(value: unknown, fallback = ""): string { if (typeof value === "string") { return value;
} if (typeof value === "number" || typeof value === "boolean") { return String(value);
} return fallback;
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet am 2026-06-09)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.