@lmzhen/dsh-evolution-skill-history 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +20 -4
- package/lib/types/client/markdown.d.ts +33 -0
- package/package.json +7 -7
package/lib/client.js
CHANGED
|
@@ -318,16 +318,32 @@ window.__ModuleLoader__.load({
|
|
|
318
318
|
/** The module-table specifier; kept in one place so the seam is the only reader. */
|
|
319
319
|
const PLATFORM_UI_MODULE = "@deepseek-ai/dsh-client-ui-primitives";
|
|
320
320
|
/**
|
|
321
|
+
* The renderer a module row carries, when it carries one.
|
|
322
|
+
*
|
|
323
|
+
* A React component type is NOT always a function: the platform's own `MarkdownText` is
|
|
324
|
+
* `memo(function MarkdownText …)`, and `memo` returns an OBJECT. A `typeof === 'function'` test
|
|
325
|
+
* therefore rejected the real renderer and silently degraded every view to its source — exactly
|
|
326
|
+
* what 0.14.0 shipped (measured on the installed panel 2026-09-28: `[预览]` and the rendered diff
|
|
327
|
+
* both fell back). The accepted domain is React's element-type domain: a function, or a non-null
|
|
328
|
+
* object it can mount. `tests/markdown.client.spec.ts` pins all four cases.
|
|
329
|
+
* @param row - what the client module table handed over.
|
|
330
|
+
* @returns the component, or undefined when the row carries none.
|
|
331
|
+
*/
|
|
332
|
+
function rendererOf(row) {
|
|
333
|
+
const candidate = row.MarkdownText;
|
|
334
|
+
if (typeof candidate === "function") return candidate;
|
|
335
|
+
if (typeof candidate === "object" && candidate !== null) return candidate;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
321
338
|
* The platform component, when this deployment's module table carries one.
|
|
322
339
|
*
|
|
323
|
-
* A
|
|
324
|
-
*
|
|
340
|
+
* A row that IS reachable without a renderer is not a render: reporting one would move the failure
|
|
341
|
+
* into the render itself, where only the slot's error boundary would catch it.
|
|
325
342
|
* @returns the component, or undefined when it cannot be reached.
|
|
326
343
|
*/
|
|
327
344
|
function markdownText() {
|
|
328
345
|
try {
|
|
329
|
-
|
|
330
|
-
return typeof row.MarkdownText === "function" ? row.MarkdownText : void 0;
|
|
346
|
+
return rendererOf(require(PLATFORM_UI_MODULE));
|
|
331
347
|
} catch {
|
|
332
348
|
return;
|
|
333
349
|
}
|
|
@@ -5,6 +5,23 @@ export interface MarkdownWords {
|
|
|
5
5
|
/** The heading of the generated footnote section. */
|
|
6
6
|
readonly footnotes: string;
|
|
7
7
|
}
|
|
8
|
+
/** Copy-button labels forwarded to fenced code blocks. */
|
|
9
|
+
interface MarkdownCodeLabels {
|
|
10
|
+
copyLabel: string;
|
|
11
|
+
copiedLabel: string;
|
|
12
|
+
}
|
|
13
|
+
/** Localized Markdown chrome: every field the platform component requires. */
|
|
14
|
+
interface MarkdownLabels {
|
|
15
|
+
code: MarkdownCodeLabels;
|
|
16
|
+
footnotes: string;
|
|
17
|
+
}
|
|
18
|
+
/** What the renderer reads; the streaming and mention knobs are not used by this panel. */
|
|
19
|
+
interface MarkdownTextProps {
|
|
20
|
+
text: string;
|
|
21
|
+
labels: MarkdownLabels;
|
|
22
|
+
}
|
|
23
|
+
/** The component as the module table hands it over. */
|
|
24
|
+
type MarkdownTextComponent = (props: MarkdownTextProps) => unknown;
|
|
8
25
|
/** One render attempt: the element, or the news that this deployment has no renderer. */
|
|
9
26
|
export type MarkdownRender = {
|
|
10
27
|
readonly ok: true;
|
|
@@ -12,6 +29,21 @@ export type MarkdownRender = {
|
|
|
12
29
|
} | {
|
|
13
30
|
readonly ok: false;
|
|
14
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* The renderer a module row carries, when it carries one.
|
|
34
|
+
*
|
|
35
|
+
* A React component type is NOT always a function: the platform's own `MarkdownText` is
|
|
36
|
+
* `memo(function MarkdownText …)`, and `memo` returns an OBJECT. A `typeof === 'function'` test
|
|
37
|
+
* therefore rejected the real renderer and silently degraded every view to its source — exactly
|
|
38
|
+
* what 0.14.0 shipped (measured on the installed panel 2026-09-28: `[预览]` and the rendered diff
|
|
39
|
+
* both fell back). The accepted domain is React's element-type domain: a function, or a non-null
|
|
40
|
+
* object it can mount. `tests/markdown.client.spec.ts` pins all four cases.
|
|
41
|
+
* @param row - what the client module table handed over.
|
|
42
|
+
* @returns the component, or undefined when the row carries none.
|
|
43
|
+
*/
|
|
44
|
+
export declare function rendererOf(row: {
|
|
45
|
+
MarkdownText?: unknown;
|
|
46
|
+
}): MarkdownTextComponent | undefined;
|
|
15
47
|
/**
|
|
16
48
|
* Render one Markdown document to an element tree.
|
|
17
49
|
* @param text - the Markdown source (already bounded by the caller).
|
|
@@ -20,4 +52,5 @@ export type MarkdownRender = {
|
|
|
20
52
|
* then keeps its own source view: a missing renderer degrades the view, never the panel).
|
|
21
53
|
*/
|
|
22
54
|
export declare function renderMarkdown(text: string, words: MarkdownWords): MarkdownRender;
|
|
55
|
+
export {};
|
|
23
56
|
//# sourceMappingURL=markdown.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-skill-history",
|
|
3
3
|
"description": "Web surface for skill content history: loopback host routes plus the sidebar panel (community build)",
|
|
4
|
-
"version": "0.14.
|
|
4
|
+
"version": "0.14.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -30,23 +30,23 @@
|
|
|
30
30
|
],
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lmzhen/dsh-evolution-core": "^0.14.
|
|
33
|
+
"@lmzhen/dsh-evolution-core": "^0.14.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
37
37
|
"@deepseek-ai/dsh-host-webserver": "^0.1.5-rc.2",
|
|
38
38
|
"react": "^18.2.0",
|
|
39
|
-
"@lmzhen/dsh-evolution-curator": "^0.14.
|
|
39
|
+
"@lmzhen/dsh-evolution-curator": "^0.14.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
43
43
|
"@deepseek-ai/dsh-host-webserver": "^0.1.5-rc.2",
|
|
44
44
|
"@types/react": "~18.3.1",
|
|
45
45
|
"react": "^18.2.0",
|
|
46
|
-
"@lmzhen/dsh-evolution-core": "^0.14.
|
|
47
|
-
"@lmzhen/dsh-evolution-curator": "^0.14.
|
|
48
|
-
"@lmzhen/dsh-evolution-io": "^0.14.
|
|
49
|
-
"@lmzhen/dsh-evolution-io-node": "^0.14.
|
|
46
|
+
"@lmzhen/dsh-evolution-core": "^0.14.1",
|
|
47
|
+
"@lmzhen/dsh-evolution-curator": "^0.14.1",
|
|
48
|
+
"@lmzhen/dsh-evolution-io": "^0.14.1",
|
|
49
|
+
"@lmzhen/dsh-evolution-io-node": "^0.14.1"
|
|
50
50
|
},
|
|
51
51
|
"dsh": {
|
|
52
52
|
"client": {
|