agent-swarm-kit 1.1.75 → 1.1.77
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.
- package/build/index.cjs +23 -11
- package/build/index.mjs +23 -11
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -13053,18 +13053,30 @@ class SwarmMetaService {
|
|
|
13053
13053
|
}
|
|
13054
13054
|
|
|
13055
13055
|
const sanitizeMarkdown = (input) => {
|
|
13056
|
+
if (typeof input !== 'string') {
|
|
13057
|
+
return input;
|
|
13058
|
+
}
|
|
13056
13059
|
return input
|
|
13057
|
-
//
|
|
13058
|
-
.replace(
|
|
13059
|
-
|
|
13060
|
-
.replace(
|
|
13061
|
-
// Remove
|
|
13062
|
-
.replace(
|
|
13063
|
-
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13060
|
+
// Escape special HTML characters to prevent XSS
|
|
13061
|
+
.replace(/&/g, '&')
|
|
13062
|
+
.replace(/</g, '<')
|
|
13063
|
+
.replace(/>/g, '>')
|
|
13064
|
+
// Remove Markdown italic (_text_) and bold (**text** or __text__)
|
|
13065
|
+
.replace(/(?:__|\*\*)(.*?)(?:__|\*\*)/g, '$1')
|
|
13066
|
+
.replace(/(?:_|\*)(.*?)(?:_|\*)/g, '$1')
|
|
13067
|
+
// Remove inline code blocks (`code` or ```code```)
|
|
13068
|
+
.replace(/`{1,3}(.*?)`{1,3}/g, '$1')
|
|
13069
|
+
// Remove links ([text](url))
|
|
13070
|
+
.replace(/\[([^\]]*)\]\([^\)]*\)/g, '$1')
|
|
13071
|
+
// Remove images ()
|
|
13072
|
+
.replace(/!\[([^\]]*)\]\([^\)]*\)/g, '$1')
|
|
13073
|
+
// Remove headers (# Header)
|
|
13074
|
+
.replace(/^(#+)\s*(.*)/gm, '$2')
|
|
13075
|
+
// Remove blockquotes (> text)
|
|
13076
|
+
.replace(/^>+\s*(.*)/gm, '$1')
|
|
13077
|
+
// Remove horizontal rules (---, ***, ___)
|
|
13078
|
+
.replace(/^-{3,}$|^[*]{3,}$|^_{3,}$/gm, '')
|
|
13079
|
+
// Remove HTML tags
|
|
13068
13080
|
.replace(/<\/?[^>]+(>|$)/g, '')
|
|
13069
13081
|
.trim();
|
|
13070
13082
|
};
|
package/build/index.mjs
CHANGED
|
@@ -13051,18 +13051,30 @@ class SwarmMetaService {
|
|
|
13051
13051
|
}
|
|
13052
13052
|
|
|
13053
13053
|
const sanitizeMarkdown = (input) => {
|
|
13054
|
+
if (typeof input !== 'string') {
|
|
13055
|
+
return input;
|
|
13056
|
+
}
|
|
13054
13057
|
return input
|
|
13055
|
-
//
|
|
13056
|
-
.replace(
|
|
13057
|
-
|
|
13058
|
-
.replace(
|
|
13059
|
-
// Remove
|
|
13060
|
-
.replace(
|
|
13061
|
-
|
|
13062
|
-
|
|
13063
|
-
|
|
13064
|
-
|
|
13065
|
-
|
|
13058
|
+
// Escape special HTML characters to prevent XSS
|
|
13059
|
+
.replace(/&/g, '&')
|
|
13060
|
+
.replace(/</g, '<')
|
|
13061
|
+
.replace(/>/g, '>')
|
|
13062
|
+
// Remove Markdown italic (_text_) and bold (**text** or __text__)
|
|
13063
|
+
.replace(/(?:__|\*\*)(.*?)(?:__|\*\*)/g, '$1')
|
|
13064
|
+
.replace(/(?:_|\*)(.*?)(?:_|\*)/g, '$1')
|
|
13065
|
+
// Remove inline code blocks (`code` or ```code```)
|
|
13066
|
+
.replace(/`{1,3}(.*?)`{1,3}/g, '$1')
|
|
13067
|
+
// Remove links ([text](url))
|
|
13068
|
+
.replace(/\[([^\]]*)\]\([^\)]*\)/g, '$1')
|
|
13069
|
+
// Remove images ()
|
|
13070
|
+
.replace(/!\[([^\]]*)\]\([^\)]*\)/g, '$1')
|
|
13071
|
+
// Remove headers (# Header)
|
|
13072
|
+
.replace(/^(#+)\s*(.*)/gm, '$2')
|
|
13073
|
+
// Remove blockquotes (> text)
|
|
13074
|
+
.replace(/^>+\s*(.*)/gm, '$1')
|
|
13075
|
+
// Remove horizontal rules (---, ***, ___)
|
|
13076
|
+
.replace(/^-{3,}$|^[*]{3,}$|^_{3,}$/gm, '')
|
|
13077
|
+
// Remove HTML tags
|
|
13066
13078
|
.replace(/<\/?[^>]+(>|$)/g, '')
|
|
13067
13079
|
.trim();
|
|
13068
13080
|
};
|