Skip to content

The design language that makes your AI harness better at design.

JavaScript

Sync generated provider output

github-actions[bot]6ba3f6a30830
diff --git a/.agent/skills/impeccable/scripts/impeccable b/.agent/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.agent/skills/impeccable/scripts/impeccable
+++ b/.agent/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.agent/skills/impeccable/scripts/live-browser-ignores.js b/.agent/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.agent/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.agent/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.agent/skills/impeccable/scripts/live-browser-session.js b/.agent/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.agent/skills/impeccable/scripts/live-browser-session.js
+++ b/.agent/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.agent/skills/impeccable/scripts/live-browser.js b/.agent/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.agent/skills/impeccable/scripts/live-browser.js
+++ b/.agent/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.agents/skills/impeccable/scripts/impeccable b/.agents/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.agents/skills/impeccable/scripts/impeccable
+++ b/.agents/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.agents/skills/impeccable/scripts/live-browser-ignores.js b/.agents/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.agents/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.agents/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.agents/skills/impeccable/scripts/live-browser-session.js b/.agents/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.agents/skills/impeccable/scripts/live-browser-session.js
+++ b/.agents/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.agents/skills/impeccable/scripts/live-browser.js b/.agents/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.agents/skills/impeccable/scripts/live-browser.js
+++ b/.agents/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.claude/skills/impeccable/scripts/impeccable b/.claude/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.claude/skills/impeccable/scripts/impeccable
+++ b/.claude/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.claude/skills/impeccable/scripts/live-browser-ignores.js b/.claude/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.claude/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.claude/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.claude/skills/impeccable/scripts/live-browser-session.js b/.claude/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.claude/skills/impeccable/scripts/live-browser-session.js
+++ b/.claude/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.claude/skills/impeccable/scripts/live-browser.js b/.claude/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.claude/skills/impeccable/scripts/live-browser.js
+++ b/.claude/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.cursor/skills/impeccable/scripts/impeccable b/.cursor/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.cursor/skills/impeccable/scripts/impeccable
+++ b/.cursor/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.cursor/skills/impeccable/scripts/live-browser-ignores.js b/.cursor/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.cursor/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.cursor/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.cursor/skills/impeccable/scripts/live-browser-session.js b/.cursor/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.cursor/skills/impeccable/scripts/live-browser-session.js
+++ b/.cursor/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.cursor/skills/impeccable/scripts/live-browser.js b/.cursor/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.cursor/skills/impeccable/scripts/live-browser.js
+++ b/.cursor/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.dsh/skills/impeccable/scripts/impeccable b/.dsh/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.dsh/skills/impeccable/scripts/impeccable
+++ b/.dsh/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.dsh/skills/impeccable/scripts/live-browser-ignores.js b/.dsh/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.dsh/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.dsh/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.dsh/skills/impeccable/scripts/live-browser-session.js b/.dsh/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.dsh/skills/impeccable/scripts/live-browser-session.js
+++ b/.dsh/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.dsh/skills/impeccable/scripts/live-browser.js b/.dsh/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.dsh/skills/impeccable/scripts/live-browser.js
+++ b/.dsh/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.gemini/skills/impeccable/scripts/impeccable b/.gemini/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.gemini/skills/impeccable/scripts/impeccable
+++ b/.gemini/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.gemini/skills/impeccable/scripts/live-browser-ignores.js b/.gemini/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.gemini/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.gemini/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.gemini/skills/impeccable/scripts/live-browser-session.js b/.gemini/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.gemini/skills/impeccable/scripts/live-browser-session.js
+++ b/.gemini/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.gemini/skills/impeccable/scripts/live-browser.js b/.gemini/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.gemini/skills/impeccable/scripts/live-browser.js
+++ b/.gemini/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.github/skills/impeccable/scripts/impeccable b/.github/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.github/skills/impeccable/scripts/impeccable
+++ b/.github/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.github/skills/impeccable/scripts/live-browser-ignores.js b/.github/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.github/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.github/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.github/skills/impeccable/scripts/live-browser-session.js b/.github/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.github/skills/impeccable/scripts/live-browser-session.js
+++ b/.github/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.github/skills/impeccable/scripts/live-browser.js b/.github/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.github/skills/impeccable/scripts/live-browser.js
+++ b/.github/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.grok/skills/impeccable/scripts/impeccable b/.grok/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.grok/skills/impeccable/scripts/impeccable
+++ b/.grok/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.grok/skills/impeccable/scripts/live-browser-ignores.js b/.grok/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.grok/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.grok/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.grok/skills/impeccable/scripts/live-browser-session.js b/.grok/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.grok/skills/impeccable/scripts/live-browser-session.js
+++ b/.grok/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.grok/skills/impeccable/scripts/live-browser.js b/.grok/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.grok/skills/impeccable/scripts/live-browser.js
+++ b/.grok/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.hermes/skills/impeccable/scripts/impeccable b/.hermes/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.hermes/skills/impeccable/scripts/impeccable
+++ b/.hermes/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.hermes/skills/impeccable/scripts/live-browser-ignores.js b/.hermes/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.hermes/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.hermes/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.hermes/skills/impeccable/scripts/live-browser-session.js b/.hermes/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.hermes/skills/impeccable/scripts/live-browser-session.js
+++ b/.hermes/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.hermes/skills/impeccable/scripts/live-browser.js b/.hermes/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.hermes/skills/impeccable/scripts/live-browser.js
+++ b/.hermes/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.kiro/skills/impeccable/scripts/impeccable b/.kiro/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.kiro/skills/impeccable/scripts/impeccable
+++ b/.kiro/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.kiro/skills/impeccable/scripts/live-browser-ignores.js b/.kiro/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.kiro/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.kiro/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.kiro/skills/impeccable/scripts/live-browser-session.js b/.kiro/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.kiro/skills/impeccable/scripts/live-browser-session.js
+++ b/.kiro/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.kiro/skills/impeccable/scripts/live-browser.js b/.kiro/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.kiro/skills/impeccable/scripts/live-browser.js
+++ b/.kiro/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.omp/skills/impeccable/scripts/impeccable b/.omp/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.omp/skills/impeccable/scripts/impeccable
+++ b/.omp/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.omp/skills/impeccable/scripts/live-browser-ignores.js b/.omp/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.omp/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.omp/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.omp/skills/impeccable/scripts/live-browser-session.js b/.omp/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.omp/skills/impeccable/scripts/live-browser-session.js
+++ b/.omp/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.omp/skills/impeccable/scripts/live-browser.js b/.omp/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.omp/skills/impeccable/scripts/live-browser.js
+++ b/.omp/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.opencode/skills/impeccable/scripts/impeccable b/.opencode/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.opencode/skills/impeccable/scripts/impeccable
+++ b/.opencode/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.opencode/skills/impeccable/scripts/live-browser-ignores.js b/.opencode/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.opencode/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.opencode/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.opencode/skills/impeccable/scripts/live-browser-session.js b/.opencode/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.opencode/skills/impeccable/scripts/live-browser-session.js
+++ b/.opencode/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.opencode/skills/impeccable/scripts/live-browser.js b/.opencode/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.opencode/skills/impeccable/scripts/live-browser.js
+++ b/.opencode/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.pi/skills/impeccable/scripts/impeccable b/.pi/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.pi/skills/impeccable/scripts/impeccable
+++ b/.pi/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.pi/skills/impeccable/scripts/live-browser-ignores.js b/.pi/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.pi/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.pi/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.pi/skills/impeccable/scripts/live-browser-session.js b/.pi/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.pi/skills/impeccable/scripts/live-browser-session.js
+++ b/.pi/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.pi/skills/impeccable/scripts/live-browser.js b/.pi/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.pi/skills/impeccable/scripts/live-browser.js
+++ b/.pi/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.qoder/skills/impeccable/scripts/impeccable b/.qoder/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.qoder/skills/impeccable/scripts/impeccable
+++ b/.qoder/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.qoder/skills/impeccable/scripts/live-browser-ignores.js b/.qoder/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.qoder/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.qoder/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.qoder/skills/impeccable/scripts/live-browser-session.js b/.qoder/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.qoder/skills/impeccable/scripts/live-browser-session.js
+++ b/.qoder/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.qoder/skills/impeccable/scripts/live-browser.js b/.qoder/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.qoder/skills/impeccable/scripts/live-browser.js
+++ b/.qoder/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.rovodev/skills/impeccable/scripts/impeccable b/.rovodev/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.rovodev/skills/impeccable/scripts/impeccable
+++ b/.rovodev/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.rovodev/skills/impeccable/scripts/live-browser-ignores.js b/.rovodev/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.rovodev/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.rovodev/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.rovodev/skills/impeccable/scripts/live-browser-session.js b/.rovodev/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.rovodev/skills/impeccable/scripts/live-browser-session.js
+++ b/.rovodev/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.rovodev/skills/impeccable/scripts/live-browser.js b/.rovodev/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.rovodev/skills/impeccable/scripts/live-browser.js
+++ b/.rovodev/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.trae-cn/skills/impeccable/scripts/impeccable b/.trae-cn/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.trae-cn/skills/impeccable/scripts/impeccable
+++ b/.trae-cn/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.trae-cn/skills/impeccable/scripts/live-browser-ignores.js b/.trae-cn/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.trae-cn/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.trae-cn/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.trae-cn/skills/impeccable/scripts/live-browser-session.js b/.trae-cn/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.trae-cn/skills/impeccable/scripts/live-browser-session.js
+++ b/.trae-cn/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.trae-cn/skills/impeccable/scripts/live-browser.js b/.trae-cn/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.trae-cn/skills/impeccable/scripts/live-browser.js
+++ b/.trae-cn/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.trae/skills/impeccable/scripts/impeccable b/.trae/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.trae/skills/impeccable/scripts/impeccable
+++ b/.trae/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.trae/skills/impeccable/scripts/live-browser-ignores.js b/.trae/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.trae/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.trae/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.trae/skills/impeccable/scripts/live-browser-session.js b/.trae/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.trae/skills/impeccable/scripts/live-browser-session.js
+++ b/.trae/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.trae/skills/impeccable/scripts/live-browser.js b/.trae/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.trae/skills/impeccable/scripts/live-browser.js
+++ b/.trae/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.veto/skills/impeccable/scripts/impeccable b/.veto/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.veto/skills/impeccable/scripts/impeccable
+++ b/.veto/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.veto/skills/impeccable/scripts/live-browser-ignores.js b/.veto/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.veto/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.veto/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.veto/skills/impeccable/scripts/live-browser-session.js b/.veto/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.veto/skills/impeccable/scripts/live-browser-session.js
+++ b/.veto/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.veto/skills/impeccable/scripts/live-browser.js b/.veto/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.veto/skills/impeccable/scripts/live-browser.js
+++ b/.veto/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/.vibe/skills/impeccable/scripts/impeccable b/.vibe/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/.vibe/skills/impeccable/scripts/impeccable
+++ b/.vibe/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/.vibe/skills/impeccable/scripts/live-browser-ignores.js b/.vibe/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/.vibe/skills/impeccable/scripts/live-browser-ignores.js
+++ b/.vibe/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/.vibe/skills/impeccable/scripts/live-browser-session.js b/.vibe/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/.vibe/skills/impeccable/scripts/live-browser-session.js
+++ b/.vibe/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/.vibe/skills/impeccable/scripts/live-browser.js b/.vibe/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/.vibe/skills/impeccable/scripts/live-browser.js
+++ b/.vibe/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/cursor-plugin/skills/impeccable/scripts/impeccable b/cursor-plugin/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/cursor-plugin/skills/impeccable/scripts/impeccable
+++ b/cursor-plugin/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/cursor-plugin/skills/impeccable/scripts/live-browser-ignores.js b/cursor-plugin/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/cursor-plugin/skills/impeccable/scripts/live-browser-ignores.js
+++ b/cursor-plugin/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/cursor-plugin/skills/impeccable/scripts/live-browser-session.js b/cursor-plugin/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/cursor-plugin/skills/impeccable/scripts/live-browser-session.js
+++ b/cursor-plugin/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/cursor-plugin/skills/impeccable/scripts/live-browser.js b/cursor-plugin/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/cursor-plugin/skills/impeccable/scripts/live-browser.js
+++ b/cursor-plugin/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}
diff --git a/plugin/skills/impeccable/scripts/impeccable b/plugin/skills/impeccable/scripts/impeccable
index 224028c79..8832f3d0f 100755
--- a/plugin/skills/impeccable/scripts/impeccable
+++ b/plugin/skills/impeccable/scripts/impeccable
@@ -18,7 +18,8 @@ set -eu
# then skips its own probes and refuses to download, so probing stays cheap
# and can never loop.
probe_ok() {
- case "$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null || true)" in
+ probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
+ case "$probe_out" in
impeccable-engine*) return 0 ;;
esac
return 1
diff --git a/plugin/skills/impeccable/scripts/live-browser-ignores.js b/plugin/skills/impeccable/scripts/live-browser-ignores.js
index 1c8514c7b..1a2912e57 100644
--- a/plugin/skills/impeccable/scripts/live-browser-ignores.js
+++ b/plugin/skills/impeccable/scripts/live-browser-ignores.js
@@ -63,9 +63,13 @@
const c = glob[i];
if (c === '*') {
if (glob[i + 1] === '*') {
- re += '.*';
i += 2;
- if (glob[i] === '/') i += 1;
+ if (glob[i] === '/') {
+ re += '(?:.*/)?';
+ i += 1;
+ } else {
+ re += '.*';
+ }
} else {
re += '[^/]*';
i += 1;
diff --git a/plugin/skills/impeccable/scripts/live-browser-session.js b/plugin/skills/impeccable/scripts/live-browser-session.js
index 388d2c2f9..687177072 100644
--- a/plugin/skills/impeccable/scripts/live-browser-session.js
+++ b/plugin/skills/impeccable/scripts/live-browser-session.js
@@ -42,7 +42,10 @@
function createLiveBrowserSessionState({ prefix, storage, idFactory }) {
if (!prefix) throw new Error('prefix required');
- const store = storage || root.localStorage;
+ let store = storage;
+ if (!store) {
+ try { store = root.localStorage; } catch { store = null; /* storage denied */ }
+ }
const makeId = idFactory || function () { return randomId8(); };
const sessionKey = prefix + '-session';
const handledKey = sessionKey + '-handled';
diff --git a/plugin/skills/impeccable/scripts/live-browser.js b/plugin/skills/impeccable/scripts/live-browser.js
index a63f1abe2..ac5ab80e3 100644
--- a/plugin/skills/impeccable/scripts/live-browser.js
+++ b/plugin/skills/impeccable/scripts/live-browser.js
@@ -13,13 +13,17 @@
'use strict';
if (typeof window === 'undefined') return;
+ // Take the helper token out of the global before anything else, including
+ // on the double-init return below: each served copy re-prepends it.
+ const TOKEN = window.__IMPECCABLE_TOKEN__;
+ try { delete window.__IMPECCABLE_TOKEN__; } catch { /* non-configurable */ }
+
// Guard against double-init. Bun's HTML loader may process the <script> tag
// and create a bundled copy alongside the external load, or HMR may re-execute.
- // Check BEFORE reading token/port to catch all cases.
+ // Check BEFORE reading port to catch all cases.
if (window.__IMPECCABLE_LIVE_INIT__) return;
window.__IMPECCABLE_LIVE_INIT__ = true;
- const TOKEN = window.__IMPECCABLE_TOKEN__;
const PORT = window.__IMPECCABLE_PORT__;
const APP_ROOT = window.__IMPECCABLE_APP_ROOT__ || null;
if (!TOKEN || !PORT) {
@@ -63,11 +67,13 @@
const MANUAL_APPLY_STATE_TTL_MS = 15 * 60 * 1000;
// No idFactory: the session helper's default works on plain-HTTP origins,
// where the secure-context-only randomUUID does not exist (issue #1055).
+ let liveStorage = null;
+ try { liveStorage = window.localStorage; } catch { /* storage denied */ }
let sessionState = null;
try {
sessionState = window.__IMPECCABLE_LIVE_SESSION__?.createLiveBrowserSessionState({
prefix: PREFIX,
- storage: localStorage,
+ storage: liveStorage,
});
} catch (err) {
console.error('[impeccable] Live mode could not create its session state.', err);
@@ -13469,7 +13475,9 @@ void main() {
// Code spans
s = s.replace(/`([^`]+)`/g, (_, code) => `<code>${code}</code>`);
// Links [text](url)
- s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>`);
+ s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, t, u) => (
+ isSafeHref(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : t
+ ));
// Bold
s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
// Italic (only single *…*, skip if inside bold already handled)
@@ -13477,6 +13485,14 @@ void main() {
return s;
}
+ function isSafeHref(url) {
+ // Browsers drop ASCII whitespace and C0 controls inside a scheme, so
+ // "java\tscript:" still runs; strip them before reading the scheme.
+ const probe = String(url).replace(/[\u0000-\u0020\u007f]/g, '');
+ const scheme = probe.match(/^([a-z][a-z0-9+.-]*):/i);
+ return !scheme || ['http', 'https', 'mailto'].includes(scheme[1].toLowerCase());
+ }
+
function highlightBold(text) {
return inlineMd(text);
}