@mux/ai 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5539,6 +5539,15 @@ async function getModerationScores(assetId, options = {}) {
5539
5539
  import { generateText as generateText6, Output as Output6 } from "ai";
5540
5540
  import dedent6 from "dedent";
5541
5541
  import { z as z7 } from "zod";
5542
+
5543
+ // src/lib/markdown-normalization.ts
5544
+ var ESCAPED_LINE_BREAK_REGEX = /\\r\\n|\\n|\\r/g;
5545
+ var MULTIPLE_BLANK_LINES_REGEX = /\n{3,}/g;
5546
+ function normalizeMarkdownDescription(description) {
5547
+ return description.replace(ESCAPED_LINE_BREAK_REGEX, "\n").replace(/([^\n]) {2,}([*-]) (?=\S)/g, "$1\n$2 ").replace(/([.!?:;]) ([*-]) (?=\S)/g, "$1\n$2 ").replace(MULTIPLE_BLANK_LINES_REGEX, "\n\n");
5548
+ }
5549
+
5550
+ // src/workflows/summarization.ts
5542
5551
  var DEFAULT_SUMMARY_KEYWORD_LIMIT = 10;
5543
5552
  var DEFAULT_TITLE_LENGTH = 10;
5544
5553
  var DEFAULT_DESCRIPTION_LENGTH = 50;
@@ -6065,7 +6074,8 @@ async function getSummaryAndTags(assetId, options) {
6065
6074
  }
6066
6075
  }
6067
6076
  const scrubbedTitle = safety.scrub(analysisResponse.result.title, "title");
6068
- const scrubbedDescription = safety.scrub(analysisResponse.result.description, "description");
6077
+ const normalizedDescription = normalizeMarkdownDescription(analysisResponse.result.description);
6078
+ const scrubbedDescription = safety.scrub(normalizedDescription, "description");
6069
6079
  const scrubbedKeywords = (analysisResponse.result.keywords ?? []).map((kw, i) => safety.scrubDetailed(kw, `keywords[${i}]`)).filter((result) => !result.leaked).map((result) => result.text);
6070
6080
  return {
6071
6081
  assetId,