anentrypoint-design 0.0.200 → 0.0.202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-shell.css +67 -2
- package/chat.css +159 -0
- package/dist/247420.css +226 -2
- package/dist/247420.js +13 -13
- package/package.json +1 -1
- package/src/components/agent-chat.js +110 -9
- package/src/components/chat.js +129 -24
- package/src/components/content.js +71 -9
- package/src/components/context-pane.js +14 -3
- package/src/components/files-modals.js +83 -24
- package/src/components/files.js +58 -10
- package/src/components/sessions.js +102 -19
- package/src/components.js +4 -4
- package/src/markdown-cache.js +15 -11
- package/src/markdown.js +15 -0
package/src/markdown-cache.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Ensures libraries are loaded once globally, reused for all subsequent renders.
|
|
3
3
|
// Tracks initialization status and render timings.
|
|
4
4
|
|
|
5
|
-
import { renderMarkdown, ensureReady as ensureMarkdownReady } from './markdown.js';
|
|
5
|
+
import { renderMarkdown, ensureReady as ensureMarkdownReady, isDegraded as isMarkdownDegraded } from './markdown.js';
|
|
6
6
|
import { highlightAllUnder, ensurePrism } from './highlight.js';
|
|
7
7
|
import { register } from './debug.js';
|
|
8
8
|
|
|
@@ -84,19 +84,23 @@ export async function renderMarkdownCached(text) {
|
|
|
84
84
|
return _renderCache.get(hash);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
// Ensure markdown is ready
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
// Ensure markdown is ready. NOT latched behind _markdownInitialized: a
|
|
88
|
+
// failed loader must be retried on a later render (markdown.js owns the
|
|
89
|
+
// retry backoff), otherwise an offline boot is sticky-degraded forever.
|
|
90
|
+
await ensureMarkdownReady();
|
|
91
|
+
_markdownInitialized = !isMarkdownDegraded();
|
|
92
92
|
|
|
93
93
|
const html = await renderMarkdown(text);
|
|
94
94
|
|
|
95
|
-
// Store in content cache (limit to 500 entries to prevent unbounded growth)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
_renderCache.
|
|
95
|
+
// Store in content cache (limit to 500 entries to prevent unbounded growth).
|
|
96
|
+
// Never cache degraded (escaped-fallback) output: when the loader recovers,
|
|
97
|
+
// the same content must re-render as real markdown, not replay the fallback.
|
|
98
|
+
if (!isMarkdownDegraded()) {
|
|
99
|
+
_renderCache.set(hash, html);
|
|
100
|
+
if (_renderCache.size > 500) {
|
|
101
|
+
const first = _renderCache.keys().next().value;
|
|
102
|
+
_renderCache.delete(first);
|
|
103
|
+
}
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
const renderMs = performance.now() - t0;
|
package/src/markdown.js
CHANGED
|
@@ -5,20 +5,35 @@
|
|
|
5
5
|
let _ready = null;
|
|
6
6
|
let _marked = null;
|
|
7
7
|
let _purify = null;
|
|
8
|
+
// A failed load is NOT cached forever: we drop _ready so a later render retries,
|
|
9
|
+
// guarded by a small backoff so an offline session doesn't hammer the CDN.
|
|
10
|
+
let _failedAt = 0;
|
|
11
|
+
const RETRY_BACKOFF_MS = 30000;
|
|
8
12
|
|
|
9
13
|
const MARKED_URL = 'https://cdn.jsdelivr.net/npm/marked@15/+esm';
|
|
10
14
|
const PURIFY_URL = 'https://cdn.jsdelivr.net/npm/dompurify@3/+esm';
|
|
11
15
|
|
|
16
|
+
// True while the markdown stack is unavailable (escaped-fallback rendering).
|
|
17
|
+
// Consumers (markdown-cache) use this to avoid caching degraded output.
|
|
18
|
+
export function isDegraded() {
|
|
19
|
+
return !_marked || !_purify;
|
|
20
|
+
}
|
|
21
|
+
|
|
12
22
|
export async function ensureReady() {
|
|
13
23
|
if (_ready) return _ready;
|
|
24
|
+
if (_failedAt && Date.now() - _failedAt < RETRY_BACKOFF_MS) return false;
|
|
14
25
|
_ready = (async () => {
|
|
15
26
|
try {
|
|
16
27
|
const [{ marked }, DOMPurifyMod] = await Promise.all([import(MARKED_URL), import(PURIFY_URL)]);
|
|
17
28
|
_marked = marked;
|
|
18
29
|
_purify = DOMPurifyMod.default || DOMPurifyMod;
|
|
30
|
+
_failedAt = 0;
|
|
19
31
|
return true;
|
|
20
32
|
} catch (err) {
|
|
21
33
|
console.warn('[247420] markdown loader failed:', err);
|
|
34
|
+
// Reset the cached promise so a later render retries (after backoff).
|
|
35
|
+
_ready = null;
|
|
36
|
+
_failedAt = Date.now();
|
|
22
37
|
return false;
|
|
23
38
|
}
|
|
24
39
|
})();
|