@runtypelabs/persona 2.3.0 → 2.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/persona",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Themeable, pluggable streaming agent widget for websites, in plain JS with support for voice input and reasoning / tool output.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
package/src/ui.ts CHANGED
@@ -325,6 +325,16 @@ const buildPostprocessor = (
325
325
  // Resolve sanitizer: enabled by default, can be disabled or replaced
326
326
  const sanitize = resolveSanitizer(cfg?.sanitize);
327
327
 
328
+ // Warn developers when a custom postprocessor is used with the default sanitizer,
329
+ // since DOMPurify will strip any tags/attributes not in the allowlist.
330
+ if (cfg?.postprocessMessage && sanitize && cfg?.sanitize === undefined) {
331
+ console.warn(
332
+ "[Persona] A custom postprocessMessage is active with the default HTML sanitizer. " +
333
+ "Tags or attributes not in the built-in allowlist will be stripped. " +
334
+ "To keep custom HTML, set `sanitize: false` or provide a custom sanitize function."
335
+ );
336
+ }
337
+
328
338
  return (context) => {
329
339
  let nextText = context.text ?? "";
330
340
  const rawPayload = context.message.rawContent ?? null;
@@ -59,7 +59,7 @@ export const createDefaultSanitizer = (): SanitizeFunction => {
59
59
  const val = data.attrValue;
60
60
  if (val.toLowerCase().startsWith("data:") && !SAFE_DATA_URI.test(val)) {
61
61
  data.attrValue = "";
62
- data.forceKeepAttr = false;
62
+ data.keepAttr = false;
63
63
  }
64
64
  }
65
65
  });