shadok-ai 0.9.2 → 0.9.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/index.html +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadok-ai",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "main": "dist/session.js",
5
5
  "scripts": {
6
6
  "test": "node --import tsx --test test/*.ts context/*/test/*.test.mjs",
package/public/index.html CHANGED
@@ -2015,6 +2015,20 @@
2015
2015
  window.dispatchEvent(new Event("shadok-bridge-ready"));
2016
2016
  </script>
2017
2017
  <script nonce="__CSP_NONCE__">
2018
+ // A link the AGENT wrote (rendered markdown) opens in a NEW tab. The cockpit
2019
+ // is a long-lived app driving live sessions; following a link in place would
2020
+ // tear the whole thing down. One DOMPurify hook stamps target/rel on every
2021
+ // <a href> it sanitises, so all agent content is covered in a single place
2022
+ // (set AFTER attribute sanitising, so the allowlist can't strip it back).
2023
+ // rel="noopener" stops the opened page reaching back via window.opener.
2024
+ if (window.DOMPurify) {
2025
+ DOMPurify.addHook("afterSanitizeAttributes", (node) => {
2026
+ if (node.tagName === "A" && node.getAttribute("href")) {
2027
+ node.setAttribute("target", "_blank");
2028
+ node.setAttribute("rel", "noopener noreferrer");
2029
+ }
2030
+ });
2031
+ }
2018
2032
  // ── Bouchons du pont ESM (invariant 10) ─────────────────────────────────
2019
2033
  // Le bloc module ci-dessus est DIFFÉRÉ : il s'exécute après le parsing,
2020
2034
  // alors que ce script-ci tourne PENDANT et câble déjà les boutons.