dsh-better-display 0.3.8 → 0.3.9
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/CHANGELOG.md +11 -0
- package/DESIGN.md +43 -3
- package/README.en.md +9 -1
- package/README.md +9 -1
- package/docs/dependency-update-policy.md +9 -0
- package/docs/extension-points.md +172 -0
- package/docs/official-rendering-bridge.md +48 -19
- package/docs/openapi.yaml +147 -0
- package/docs/runbooks/blank-reader.md +39 -0
- package/lib/client.js +1417 -490
- package/lib/client.js.map +1 -1
- package/lib/dsh-better-display.js +378 -144
- package/lib/types/client/AssistantNode.d.ts +20 -0
- package/lib/types/client/AssistantNode.d.ts.map +1 -0
- package/lib/types/client/AssistantNode.js +46 -0
- package/lib/types/client/AssistantNode.js.map +1 -0
- package/lib/types/client/Blocks.d.ts.map +1 -1
- package/lib/types/client/Blocks.js +33 -10
- package/lib/types/client/Blocks.js.map +1 -1
- package/lib/types/client/ChoreographedFlow.d.ts.map +1 -1
- package/lib/types/client/ChoreographedFlow.js +2 -0
- package/lib/types/client/ChoreographedFlow.js.map +1 -1
- package/lib/types/client/ClosedProcessSummary.d.ts.map +1 -1
- package/lib/types/client/ClosedProcessSummary.js +3 -1
- package/lib/types/client/ClosedProcessSummary.js.map +1 -1
- package/lib/types/client/McpAppFrame.d.ts.map +1 -1
- package/lib/types/client/McpAppFrame.js +5 -11
- package/lib/types/client/McpAppFrame.js.map +1 -1
- package/lib/types/client/OfficialContent.d.ts +17 -3
- package/lib/types/client/OfficialContent.d.ts.map +1 -1
- package/lib/types/client/OfficialContent.js +33 -7
- package/lib/types/client/OfficialContent.js.map +1 -1
- package/lib/types/client/Reader.d.ts.map +1 -1
- package/lib/types/client/Reader.js +43 -71
- package/lib/types/client/Reader.js.map +1 -1
- package/lib/types/client/SettingsSection.d.ts.map +1 -1
- package/lib/types/client/SettingsSection.js +0 -5
- package/lib/types/client/SettingsSection.js.map +1 -1
- package/lib/types/client/StickyLane.d.ts +12 -0
- package/lib/types/client/StickyLane.d.ts.map +1 -1
- package/lib/types/client/StickyLane.js +78 -2
- package/lib/types/client/StickyLane.js.map +1 -1
- package/lib/types/client/ToolActivity.js.map +1 -1
- package/lib/types/client/index.d.ts +3 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +6 -0
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/live-turn.d.ts +17 -5
- package/lib/types/client/live-turn.d.ts.map +1 -1
- package/lib/types/client/live-turn.js +106 -76
- package/lib/types/client/live-turn.js.map +1 -1
- package/lib/types/client/motion.d.ts +26 -2
- package/lib/types/client/motion.d.ts.map +1 -1
- package/lib/types/client/motion.js +136 -10
- package/lib/types/client/motion.js.map +1 -1
- package/lib/types/client/official-slots.d.ts +9 -0
- package/lib/types/client/official-slots.d.ts.map +1 -1
- package/lib/types/client/official-slots.js +22 -7
- package/lib/types/client/official-slots.js.map +1 -1
- package/lib/types/client/projection.d.ts +15 -2
- package/lib/types/client/projection.d.ts.map +1 -1
- package/lib/types/client/projection.js +16 -4
- package/lib/types/client/projection.js.map +1 -1
- package/lib/types/client/rewind-cut.d.ts +131 -0
- package/lib/types/client/rewind-cut.d.ts.map +1 -0
- package/lib/types/client/rewind-cut.js +321 -0
- package/lib/types/client/rewind-cut.js.map +1 -0
- package/lib/types/client/text-transform.d.ts +93 -0
- package/lib/types/client/text-transform.d.ts.map +1 -0
- package/lib/types/client/text-transform.js +183 -0
- package/lib/types/client/text-transform.js.map +1 -0
- package/lib/types/client/timeline.d.ts.map +1 -1
- package/lib/types/client/timeline.js.map +1 -1
- package/lib/types/client/tool-activity.d.ts +9 -2
- package/lib/types/client/tool-activity.d.ts.map +1 -1
- package/lib/types/client/tool-activity.js +42 -2
- package/lib/types/client/tool-activity.js.map +1 -1
- package/lib/types/client/turn-slots.d.ts +29 -0
- package/lib/types/client/turn-slots.d.ts.map +1 -0
- package/lib/types/client/turn-slots.js +62 -0
- package/lib/types/client/turn-slots.js.map +1 -0
- package/lib/types/client/types.d.ts +18 -0
- package/lib/types/client/types.d.ts.map +1 -1
- package/lib/types/dsh-better-display.d.ts +4 -1
- package/lib/types/dsh-better-display.d.ts.map +1 -1
- package/lib/types/dsh-better-display.js +56 -7
- package/lib/types/dsh-better-display.js.map +1 -1
- package/lib/types/flags.d.ts +7 -0
- package/lib/types/flags.d.ts.map +1 -0
- package/lib/types/flags.js +37 -0
- package/lib/types/flags.js.map +1 -0
- package/lib/types/log.d.ts +17 -0
- package/lib/types/log.d.ts.map +1 -0
- package/lib/types/log.js +122 -0
- package/lib/types/log.js.map +1 -0
- package/lib/types/metrics.d.ts +18 -0
- package/lib/types/metrics.d.ts.map +1 -0
- package/lib/types/metrics.js +35 -0
- package/lib/types/metrics.js.map +1 -0
- package/package.json +36 -5
- package/scripts/changelog.mjs +20 -0
- package/scripts/check-agents-md.mjs +67 -0
- package/scripts/check-bundle-size.mjs +38 -0
- package/scripts/check-dead-flags.mjs +55 -0
- package/scripts/check-todo-debt.mjs +69 -0
- package/scripts/security-audit-report.mjs +92 -0
- package/scripts/verify-commentary-visible.mjs +627 -0
- package/src/client/AssistantNode.tsx +72 -0
- package/src/client/Blocks.tsx +49 -10
- package/src/client/ChoreographedFlow.tsx +3 -1
- package/src/client/ClosedProcessSummary.tsx +3 -1
- package/src/client/McpAppFrame.tsx +5 -13
- package/src/client/OfficialContent.tsx +47 -9
- package/src/client/Reader.module.css +68 -18
- package/src/client/Reader.tsx +36 -76
- package/src/client/SettingsSection.tsx +1 -7
- package/src/client/StickyLane.tsx +81 -2
- package/src/client/ToolActivity.tsx +1 -1
- package/src/client/index.tsx +8 -1
- package/src/client/live-turn.ts +100 -69
- package/src/client/motion.tsx +135 -7
- package/src/client/official-slots.tsx +23 -7
- package/src/client/projection.ts +16 -4
- package/src/client/rewind-cut.ts +340 -0
- package/src/client/text-transform.ts +265 -0
- package/src/client/timeline.ts +0 -2
- package/src/client/tool-activity.ts +49 -2
- package/src/client/turn-slots.ts +80 -0
- package/src/client/types.ts +19 -0
- package/src/dsh-better-display.ts +58 -7
- package/src/flags.ts +40 -0
- package/src/log.ts +137 -0
- package/src/metrics.ts +50 -0
- package/tests/browser-commentary.tsx +191 -0
- package/tests/chat-flow-hook.test.ts +1 -1
- package/tests/cloud-gate.test.ts +1 -1
- package/tests/context-tool-update.test.ts +1 -1
- package/tests/conversation-scroll.test.ts +1 -1
- package/tests/deliverables.test.ts +1 -1
- package/tests/entry.test.ts +1 -1
- package/tests/fixtures/reader-lane-owners.tsx +46 -0
- package/tests/fixtures/reader-official-users.tsx +64 -0
- package/tests/fixtures/reader-theme-overlap.html +80 -0
- package/tests/fixtures/reader-user-bubble.tsx +222 -0
- package/tests/flags.test.ts +66 -0
- package/tests/fold-choreography.test.ts +32 -8
- package/tests/fold-intensity.test.ts +11 -6
- package/tests/footer-precedence.test.ts +1 -1
- package/tests/history-word-regression.test.ts +1 -1
- package/tests/live-turn.test.ts +125 -54
- package/tests/log.test.ts +99 -0
- package/tests/mcp-apps.test.ts +1 -1
- package/tests/message-chrome.test.ts +1 -1
- package/tests/metrics.test.ts +52 -0
- package/tests/official-slots.test.ts +41 -2
- package/tests/open-file.test.ts +1 -1
- package/tests/pending-submission.test.ts +12 -1
- package/tests/pinned-selection.test.ts +16 -0
- package/tests/platform-media.test.ts +1 -1
- package/tests/projection.test.ts +66 -3
- package/tests/reader-glass-css.test.ts +1 -1
- package/tests/reader-official-users.test.ts +11 -1
- package/tests/reader-sticky-surface.test.ts +377 -0
- package/tests/reader-theme-lanes.test.ts +54 -0
- package/tests/reader-theme-overlap.test.ts +151 -0
- package/tests/reader-user-bubble.test.ts +137 -0
- package/tests/reasoning-follow.test.ts +1 -1
- package/tests/retiring-content.test.ts +98 -6
- package/tests/reveal.test.ts +3 -3
- package/tests/rewind-cut.test.ts +1090 -0
- package/tests/settings-copy.test.ts +1 -1
- package/tests/skill-status.test.ts +1 -1
- package/tests/stock-install.test.ts +1 -1
- package/tests/stream-buffer.test.ts +1 -1
- package/tests/styles.test.ts +30 -3
- package/tests/terminal-input-preview.test.ts +1 -1
- package/tests/text-transform.test.ts +272 -0
- package/tests/timeline.test.ts +1 -1
- package/tests/tool-clock.test.ts +1 -1
- package/tests/tool-diff.test.ts +1 -1
- package/tests/waiting-clock.test.ts +1 -1
- package/tests/word-timeline.test.ts +1 -1
package/src/log.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import type { IncomingMessage } from 'node:http';
|
|
3
|
+
|
|
4
|
+
export const REDACTED = '[REDACTED]';
|
|
5
|
+
|
|
6
|
+
const REQUEST_ID_HEADER = 'x-request-id';
|
|
7
|
+
const REQUEST_ID_PATTERN = /^[A-Za-z0-9._:-]{1,200}$/;
|
|
8
|
+
|
|
9
|
+
const SECRET_KEYS = new Set([
|
|
10
|
+
'authorization',
|
|
11
|
+
'proxyauthorization',
|
|
12
|
+
'cookie',
|
|
13
|
+
'setcookie',
|
|
14
|
+
'token',
|
|
15
|
+
'accesstoken',
|
|
16
|
+
'refreshtoken',
|
|
17
|
+
'idtoken',
|
|
18
|
+
'apikey',
|
|
19
|
+
'apisecret',
|
|
20
|
+
'secret',
|
|
21
|
+
'clientsecret',
|
|
22
|
+
'password',
|
|
23
|
+
'passwd',
|
|
24
|
+
'credential',
|
|
25
|
+
'credentials',
|
|
26
|
+
'signature',
|
|
27
|
+
'sig',
|
|
28
|
+
'jwt',
|
|
29
|
+
'bearer',
|
|
30
|
+
'privatekey',
|
|
31
|
+
'xapikey',
|
|
32
|
+
'xauthtoken',
|
|
33
|
+
'xaccesstoken',
|
|
34
|
+
'auth',
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
export type LogFields = Record<string, unknown>;
|
|
38
|
+
|
|
39
|
+
export interface Logger {
|
|
40
|
+
info(msg: string, fields?: LogFields): void;
|
|
41
|
+
warn(msg: string, fields?: LogFields): void;
|
|
42
|
+
error(msg: string, fields?: LogFields): void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface LoggerOptions {
|
|
46
|
+
readonly write?: (line: string) => void;
|
|
47
|
+
readonly base?: LogFields;
|
|
48
|
+
readonly clock?: () => Date;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function normalizeKey(key: string): string {
|
|
52
|
+
return key.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function isSecretKey(key: string): boolean {
|
|
56
|
+
const normalized = normalizeKey(key);
|
|
57
|
+
if (SECRET_KEYS.has(normalized)) return true;
|
|
58
|
+
if (normalized === 'requestid' || normalized === 'xrequestid') return false;
|
|
59
|
+
return /(?:^|[^a-z])(?:token|secret|password|api[-_]?key)$/i.test(key);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function redactString(value: string): string {
|
|
63
|
+
const query = value.replace(/([?&#])([^&#=]+)=([^&#]*)/g, (match, sep: string, rawKey: string) => {
|
|
64
|
+
let key: string;
|
|
65
|
+
try {
|
|
66
|
+
key = decodeURIComponent(rawKey.replace(/\+/g, ' '));
|
|
67
|
+
} catch {
|
|
68
|
+
key = rawKey;
|
|
69
|
+
}
|
|
70
|
+
return isSecretKey(key) ? `${sep}${rawKey}=${REDACTED}` : match;
|
|
71
|
+
});
|
|
72
|
+
return query
|
|
73
|
+
.replace(/\b(Bearer|Basic)\s+\S+/gi, `$1 ${REDACTED}`)
|
|
74
|
+
.replace(
|
|
75
|
+
/\b((?:access[_-]?token|refresh[_-]?token|id[_-]?token|api[_-]?key|client[_-]?secret|password|passwd|authorization|token|secret))(\s*[:=]\s*)([^\s&]+)/gi,
|
|
76
|
+
`$1$2${REDACTED}`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function redact(value: unknown): unknown {
|
|
81
|
+
return redactValue(undefined, value, 0, new WeakSet());
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function redactValue(key: string | undefined, value: unknown, depth: number, seen: WeakSet<object>): unknown {
|
|
85
|
+
if (key !== undefined && isSecretKey(key)) return REDACTED;
|
|
86
|
+
if (depth > 8) return REDACTED;
|
|
87
|
+
if (typeof value === 'string') return redactString(value);
|
|
88
|
+
if (typeof value === 'number' || typeof value === 'boolean' || value === null || value === undefined) return value;
|
|
89
|
+
if (typeof value !== 'object') return REDACTED;
|
|
90
|
+
if (value instanceof Date) return value.toISOString();
|
|
91
|
+
if (value instanceof Error) {
|
|
92
|
+
return redactValue(undefined, { name: value.name, message: value.message }, depth + 1, seen);
|
|
93
|
+
}
|
|
94
|
+
if (seen.has(value)) return REDACTED;
|
|
95
|
+
seen.add(value);
|
|
96
|
+
if (Array.isArray(value)) {
|
|
97
|
+
return value.map(item => redactValue(undefined, item, depth + 1, seen));
|
|
98
|
+
}
|
|
99
|
+
const output: Record<string, unknown> = {};
|
|
100
|
+
for (const [childKey, childValue] of Object.entries(value)) {
|
|
101
|
+
output[childKey] = redactValue(childKey, childValue, depth + 1, seen);
|
|
102
|
+
}
|
|
103
|
+
return output;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function createLogger(options: LoggerOptions = {}): Logger {
|
|
107
|
+
const write = options.write ?? ((line: string) => {
|
|
108
|
+
console.log(line);
|
|
109
|
+
});
|
|
110
|
+
const clock = options.clock ?? (() => new Date());
|
|
111
|
+
const emit = (level: 'info' | 'warn' | 'error', msg: string, fields?: LogFields): void => {
|
|
112
|
+
const details = redact({ ...options.base, ...fields });
|
|
113
|
+
const record = {
|
|
114
|
+
...(details !== null && typeof details === 'object' ? details as LogFields : {}),
|
|
115
|
+
time: clock().toISOString(),
|
|
116
|
+
level,
|
|
117
|
+
msg: redactString(msg),
|
|
118
|
+
};
|
|
119
|
+
try {
|
|
120
|
+
write(JSON.stringify(record));
|
|
121
|
+
} catch {
|
|
122
|
+
write(JSON.stringify({ time: record.time, level, msg: record.msg, error: 'log record was not serializable' }));
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
info: (msg, fields) => emit('info', msg, fields),
|
|
127
|
+
warn: (msg, fields) => emit('warn', msg, fields),
|
|
128
|
+
error: (msg, fields) => emit('error', msg, fields),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function requestIdOf(req: IncomingMessage): string {
|
|
133
|
+
const raw = req.headers[REQUEST_ID_HEADER];
|
|
134
|
+
const value = Array.isArray(raw) ? raw[0] : raw;
|
|
135
|
+
if (typeof value === 'string' && REQUEST_ID_PATTERN.test(value)) return value;
|
|
136
|
+
return randomUUID();
|
|
137
|
+
}
|
package/src/metrics.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const ROUTE_REVEAL = '/better-display/reveal';
|
|
2
|
+
export const ROUTE_SKILL_STATUS = '/better-display/skill-status';
|
|
3
|
+
export const ROUTE_METRICS = '/better-display/metrics';
|
|
4
|
+
|
|
5
|
+
export const ROUTE_HITS = [ROUTE_REVEAL, ROUTE_SKILL_STATUS, ROUTE_METRICS] as const;
|
|
6
|
+
|
|
7
|
+
export interface RouteTiming {
|
|
8
|
+
count: number;
|
|
9
|
+
totalMs: number;
|
|
10
|
+
maxMs: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const hits = new Map<string, number>(ROUTE_HITS.map(route => [route, 0]));
|
|
14
|
+
const timings = new Map<string, RouteTiming>(ROUTE_HITS.map(route => [route, { count: 0, totalMs: 0, maxMs: 0 }]));
|
|
15
|
+
|
|
16
|
+
function snapshotHits(): Record<string, number> {
|
|
17
|
+
return Object.fromEntries(hits);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function snapshotTimings(): Record<string, RouteTiming> {
|
|
21
|
+
return Object.fromEntries([...timings].map(([route, timing]) => [route, { ...timing }]));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function recordRouteHit(route: string): number {
|
|
25
|
+
const next = (hits.get(route) ?? 0) + 1;
|
|
26
|
+
hits.set(route, next);
|
|
27
|
+
return next;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function recordRouteDuration(route: string, elapsedMs: number): RouteTiming {
|
|
31
|
+
const ms = Number.isFinite(elapsedMs) && elapsedMs > 0 ? Math.round(elapsedMs) : 0;
|
|
32
|
+
const current = timings.get(route) ?? { count: 0, totalMs: 0, maxMs: 0 };
|
|
33
|
+
const next = {
|
|
34
|
+
count: current.count + 1,
|
|
35
|
+
totalMs: current.totalMs + ms,
|
|
36
|
+
maxMs: Math.max(current.maxMs, ms),
|
|
37
|
+
};
|
|
38
|
+
timings.set(route, next);
|
|
39
|
+
return next;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function metricsPayload(): {
|
|
43
|
+
counters: { dsh_better_display_route_hits_total: Record<string, number> };
|
|
44
|
+
timingsMs: Record<string, RouteTiming>;
|
|
45
|
+
} {
|
|
46
|
+
return {
|
|
47
|
+
counters: { dsh_better_display_route_hits_total: snapshotHits() },
|
|
48
|
+
timingsMs: snapshotTimings(),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import React, { useSyncExternalStore } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import type { ChatSnapshot } from '@deepseek-ai/dsh-client-ui-chat/client';
|
|
4
|
+
import { Reader } from '../src/client/Reader.js';
|
|
5
|
+
import { createReaderStore } from '../src/client/store.js';
|
|
6
|
+
import type { ReaderProps } from '../src/client/types.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Real Reader + real root/session stores; only conversation data is synthetic.
|
|
10
|
+
*
|
|
11
|
+
* This fixture isolates the "process report narration" bug: an assistant step
|
|
12
|
+
* that carries a long non-reasoning text block (正文) between thinking steps used
|
|
13
|
+
* to be classified as process content and folded away. Contract under test:
|
|
14
|
+
* body text is always visible; folds may only hold reasoning / tool / other
|
|
15
|
+
* process records.
|
|
16
|
+
*
|
|
17
|
+
* Turn layout:
|
|
18
|
+
* 1 closed/completed : step0 = reasoning + 正文A + tool-call ; step1 = reasoning + 最终回答B
|
|
19
|
+
* 2 open : step0 = reasoning + 进行中汇报正文C ; step1 = reasoning (latest)
|
|
20
|
+
* 3 closed/error : step0 = reasoning + 失败轮正文D
|
|
21
|
+
* 4 closed/interrupted: step0 = reasoning + 中断轮正文E
|
|
22
|
+
*/
|
|
23
|
+
const BODY_A = '过程汇报正文A';
|
|
24
|
+
const REASON_A = '历史思考:先查简报素材';
|
|
25
|
+
const FINAL_B = '最终回答B';
|
|
26
|
+
const REASON_B = '第二次思考:整理结论';
|
|
27
|
+
const TOOL_SUMMARY = '读取 简报素材.txt';
|
|
28
|
+
const BODY_C = '进行中汇报正文C';
|
|
29
|
+
const REASON_C0 = '第一轮思考';
|
|
30
|
+
const REASON_C1 = '第二轮思考';
|
|
31
|
+
const BODY_D = '失败轮正文D';
|
|
32
|
+
const REASON_D = '报错前的思考';
|
|
33
|
+
const BODY_E = '中断轮正文E';
|
|
34
|
+
const REASON_E = '中断前的思考';
|
|
35
|
+
// Turn 5 exercises the segmented-report case: two adjacent narration paragraphs
|
|
36
|
+
// (with folded reasoning between them) plus a final answer, all with long text.
|
|
37
|
+
const BODY_F = '第一段汇报:已完成需求梳理,确认改造点集中在投影层与阅读渲染层。这一步整理的是已经核实的事实,不包括猜测。\n\n第二段汇报:接下来核对折叠链边界,并验证正文在收起状态下仍然可见,同时保持思维链与工具行可以展开。';
|
|
38
|
+
const REASON_F0 = '汇报前的思考';
|
|
39
|
+
const BODY_G = '补充汇报:折叠只保留思维链与工具调用,正文块保持原位。';
|
|
40
|
+
const REASON_G = '补充说明前的思考';
|
|
41
|
+
const REASON_H = '收尾思考';
|
|
42
|
+
const FINAL_H = '最终回答H';
|
|
43
|
+
const TOOL_CALL_ID = 'call-read-1';
|
|
44
|
+
const TOOL_ARGS = '{"path":"/fixture/工作区/简报素材.txt"}';
|
|
45
|
+
|
|
46
|
+
const store = createReaderStore();
|
|
47
|
+
const prefs = store.create();
|
|
48
|
+
const session = store.create('commentary-fixture');
|
|
49
|
+
|
|
50
|
+
type Turn = {
|
|
51
|
+
turn: number; status: 'open' | 'closed';
|
|
52
|
+
start: { seq: number; time: number };
|
|
53
|
+
end?: { time: number; data: { reason: { kind: string } } };
|
|
54
|
+
data: Map<string, any>;
|
|
55
|
+
steps: any[];
|
|
56
|
+
};
|
|
57
|
+
const nodes = new Map<string, any>();
|
|
58
|
+
const turns = new Map<number, Turn>();
|
|
59
|
+
|
|
60
|
+
function newTurn(turn: number, status: 'open' | 'closed', seq: number, reason?: string): Turn {
|
|
61
|
+
const value: Turn = {
|
|
62
|
+
turn, status, start: { seq, time: 1 },
|
|
63
|
+
end: status === 'closed' ? { time: 1001, data: { reason: { kind: reason ?? 'completed' } } } : undefined,
|
|
64
|
+
data: new Map<string, any>(),
|
|
65
|
+
steps: [],
|
|
66
|
+
};
|
|
67
|
+
turns.set(turn, value);
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function addStep(turnNumber: number, step: number, seq: number, status: string, blocks: any[]): any {
|
|
72
|
+
const turn = turns.get(turnNumber)!;
|
|
73
|
+
const data = { turn: turnNumber, step, status, time: 1, blocks };
|
|
74
|
+
const location = { step, start: { seq }, data: new Map([['assistant-step', data]]) };
|
|
75
|
+
turn.steps.push(location);
|
|
76
|
+
nodes.set(`turn-${turnNumber}-step-${step}`, {
|
|
77
|
+
key: `turn-${turnNumber}-step-${step}`, kind: 'assistant-step', visibility: 'visible',
|
|
78
|
+
anchorSeq: seq, location: { kind: 'step', turn, step: location }, data,
|
|
79
|
+
});
|
|
80
|
+
return location;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function addToolCallNode(turnNumber: number, key: string, seq: number, location: any, callId: string, argsRaw: string): void {
|
|
84
|
+
const turn = turns.get(turnNumber)!;
|
|
85
|
+
const root = {
|
|
86
|
+
kind: 'tool-result', seq, time: 1, callId,
|
|
87
|
+
call: { name: 'read', argsRaw }, callTime: 1,
|
|
88
|
+
content: [{ kind: 'text', text: '简报素材的摘录内容' }], isError: false, subCalls: [],
|
|
89
|
+
};
|
|
90
|
+
nodes.set(key, {
|
|
91
|
+
key, kind: 'tool-call', visibility: 'visible', anchorSeq: seq,
|
|
92
|
+
location: { kind: 'step', turn, step: location }, data: { root },
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// --- turn 1: completed; narration sits between reasoning and the final answer.
|
|
97
|
+
const turn1 = newTurn(1, 'closed', 100);
|
|
98
|
+
turn1.data.set('turn-tail', { closing: { step: 1 } });
|
|
99
|
+
const t1s0 = addStep(1, 0, 101, 'settled', [
|
|
100
|
+
{ kind: 'reasoning', text: REASON_A },
|
|
101
|
+
{ kind: 'text', text: BODY_A },
|
|
102
|
+
{ kind: 'tool-call', callId: TOOL_CALL_ID, name: 'read', argsRaw: TOOL_ARGS },
|
|
103
|
+
]);
|
|
104
|
+
addToolCallNode(1, 'turn-1-tool-call-1', 102, t1s0, TOOL_CALL_ID, TOOL_ARGS);
|
|
105
|
+
addStep(1, 1, 103, 'settled', [
|
|
106
|
+
{ kind: 'reasoning', text: REASON_B },
|
|
107
|
+
{ kind: 'text', text: FINAL_B },
|
|
108
|
+
]);
|
|
109
|
+
|
|
110
|
+
// --- turn 2: open; second reasoning arrives after a process report.
|
|
111
|
+
const turn2 = newTurn(2, 'open', 200);
|
|
112
|
+
addStep(2, 0, 201, 'settled', [
|
|
113
|
+
{ kind: 'reasoning', text: REASON_C0 },
|
|
114
|
+
{ kind: 'text', text: BODY_C },
|
|
115
|
+
]);
|
|
116
|
+
addStep(2, 1, 202, 'running', [
|
|
117
|
+
{ kind: 'reasoning', text: REASON_C1 },
|
|
118
|
+
]);
|
|
119
|
+
|
|
120
|
+
// --- turn 3: failed turn; nothing may fold.
|
|
121
|
+
newTurn(3, 'closed', 300, 'error');
|
|
122
|
+
addStep(3, 0, 301, 'settled', [
|
|
123
|
+
{ kind: 'reasoning', text: REASON_D },
|
|
124
|
+
{ kind: 'text', text: BODY_D },
|
|
125
|
+
]);
|
|
126
|
+
|
|
127
|
+
// --- turn 4: interrupted turn; nothing may fold.
|
|
128
|
+
newTurn(4, 'closed', 400, 'interrupted');
|
|
129
|
+
addStep(4, 0, 401, 'settled', [
|
|
130
|
+
{ kind: 'reasoning', text: REASON_E },
|
|
131
|
+
{ kind: 'text', text: BODY_E },
|
|
132
|
+
]);
|
|
133
|
+
|
|
134
|
+
// --- turn 5: completed turn whose report is split into two narration paragraphs
|
|
135
|
+
// with folded reasoning between them; the rail must bridge them after collapsing.
|
|
136
|
+
const turn5 = newTurn(5, 'closed', 500);
|
|
137
|
+
turn5.data.set('turn-tail', { closing: { step: 2 } });
|
|
138
|
+
addStep(5, 0, 501, 'settled', [
|
|
139
|
+
{ kind: 'reasoning', text: REASON_F0 },
|
|
140
|
+
{ kind: 'text', text: BODY_F },
|
|
141
|
+
]);
|
|
142
|
+
addStep(5, 1, 502, 'settled', [
|
|
143
|
+
{ kind: 'reasoning', text: REASON_G },
|
|
144
|
+
{ kind: 'text', text: BODY_G },
|
|
145
|
+
]);
|
|
146
|
+
addStep(5, 2, 503, 'settled', [
|
|
147
|
+
{ kind: 'reasoning', text: REASON_H },
|
|
148
|
+
{ kind: 'text', text: FINAL_H },
|
|
149
|
+
]);
|
|
150
|
+
|
|
151
|
+
const chat = {
|
|
152
|
+
order: [
|
|
153
|
+
'turn-1-step-0', 'turn-1-tool-call-1', 'turn-1-step-1',
|
|
154
|
+
'turn-2-step-0', 'turn-2-step-1',
|
|
155
|
+
'turn-3-step-0', 'turn-4-step-0',
|
|
156
|
+
'turn-5-step-0', 'turn-5-step-1', 'turn-5-step-2',
|
|
157
|
+
],
|
|
158
|
+
nodes,
|
|
159
|
+
timeline: { turns },
|
|
160
|
+
} as unknown as ChatSnapshot;
|
|
161
|
+
const sessionSnapshot = { running: true, openState: 'ready', pendingSubmissions: [], hasMore: false, loadingOlder: false };
|
|
162
|
+
const sessionsSnapshot = { byId: { 'commentary-fixture': { cwd: '/fixture' } } };
|
|
163
|
+
const pending = new Map();
|
|
164
|
+
const host = { home: '/fixture' };
|
|
165
|
+
const useReaderStore: ReaderProps['useStore'] = selector => selector(useSyncExternalStore(session.subscribe, session.getSnapshot));
|
|
166
|
+
const props = {
|
|
167
|
+
sessionId: 'commentary-fixture', useChat: selector => selector(chat),
|
|
168
|
+
useSession: selector => selector(sessionSnapshot), useSessions: selector => selector(sessionsSnapshot),
|
|
169
|
+
useSessionStatus: selector => selector(new Map([['commentary-fixture', { running: true, pendingInteraction: pending.get('commentary-fixture'), completionUnread: false }]])),
|
|
170
|
+
useStore: useReaderStore, actions: session.actions, openPrefs: prefs,
|
|
171
|
+
t: key => key, renderSlot: (_name: string, _owner: any, options: any) => options?.fallback ?? null,
|
|
172
|
+
renderSlotChain: (_name: string, _owner: any, options: any) => options?.fallback ?? null,
|
|
173
|
+
loadImage: async () => ({ data: new Uint8Array(), mediaType: 'image/png' }),
|
|
174
|
+
officialImageLoader: Object.assign(async () => null, { peek: () => null }),
|
|
175
|
+
officialFileMentions: () => undefined, officialPreviewFile: () => {},
|
|
176
|
+
officialHost: { getSnapshot: () => host, subscribe: () => () => {} },
|
|
177
|
+
fillComposer: () => true, openFile: () => {}, loadOlder: async () => {}, openView: () => {},
|
|
178
|
+
} as unknown as ReaderProps;
|
|
179
|
+
|
|
180
|
+
Object.assign(window, {
|
|
181
|
+
commentaryFixture: {
|
|
182
|
+
// Exercise the same root preference the Settings panel uses.
|
|
183
|
+
preference: (value: boolean) => prefs.actions.setAutoFold(value),
|
|
184
|
+
state: () => session.getSnapshot(),
|
|
185
|
+
text: { BODY_A, REASON_A, FINAL_B, REASON_B, TOOL_SUMMARY, BODY_C, REASON_C0, REASON_C1, BODY_D, REASON_D, BODY_E, REASON_E, BODY_F, REASON_F0, BODY_G, REASON_G, REASON_H, FINAL_H, TOOL_CALL_ID },
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
createRoot(document.getElementById('app')!).render(
|
|
190
|
+
<div data-conversation-scroll style={{ height: '100vh', overflow: 'auto' }}><Reader {...props} /></div>,
|
|
191
|
+
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from 'node:assert/strict';
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { dirname, resolve } from 'node:path';
|
|
4
|
-
import { test } from '
|
|
4
|
+
import { test } from 'vitest';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
|
|
7
7
|
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
package/tests/cloud-gate.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { test } from '
|
|
1
|
+
import { test } from 'vitest';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
3
|
import type { TurnLocation } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
4
4
|
import { basename, createProducedFileMentions, dirname, getTurnDeliverables, showDeliverablesRow } from '../src/client/deliverables.ts';
|
package/tests/entry.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from 'node:assert/strict';
|
|
2
|
-
import { test } from '
|
|
2
|
+
import { test } from 'vitest';
|
|
3
3
|
import { ReaderEntryPolicy, readerEntryRequested } from '../src/client/entry-policy.js';
|
|
4
4
|
|
|
5
5
|
test('fresh sessions default to reading, without requiring a special URL', () => {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { StickyLane, usePublishedHeight } from '../../src/client/StickyLane.js';
|
|
4
|
+
|
|
5
|
+
function Measured({ id, property, height }: { id: string; property: string; height: number }) {
|
|
6
|
+
const ref = usePublishedHeight(property);
|
|
7
|
+
return <div ref={ref} id={id} style={{ height }}>{id}</div>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function SummaryReader({ id, height, show }: { id: string; height: number; show: boolean }) {
|
|
11
|
+
return <div data-dsh-better-display={id} id={`root-${id}`}>
|
|
12
|
+
<section data-reader-turn="1" id={`turn-${id}`}>
|
|
13
|
+
{show && <Measured id={`row-${id}`} property="--reader-summary-height" height={height} />}
|
|
14
|
+
</section>
|
|
15
|
+
</div>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function App() {
|
|
19
|
+
const [height, setHeight] = useState(52);
|
|
20
|
+
const [show, setShow] = useState(true);
|
|
21
|
+
return <>
|
|
22
|
+
<button id="grow" type="button" onClick={() => setHeight(86)}>grow</button>
|
|
23
|
+
<button id="drop" type="button" onClick={() => setShow(false)}>drop</button>
|
|
24
|
+
<SummaryReader id="a" height={height} show={show} />
|
|
25
|
+
<SummaryReader id="b" height={52} show />
|
|
26
|
+
<div data-dsh-better-display="short" id="root-short">
|
|
27
|
+
<section data-reader-turn="1" id="turn-short">
|
|
28
|
+
<Measured id="row-short" property="--reader-status-height" height={38} />
|
|
29
|
+
</section>
|
|
30
|
+
</div>
|
|
31
|
+
<div data-dsh-better-display="toolbar" id="root-toolbar">
|
|
32
|
+
<StickyLane kind="toolbar" className="toolbarProbe">
|
|
33
|
+
<button id="toolbar-button" type="button" style={{ height: 12, padding: 0, border: 0 }}>开</button>
|
|
34
|
+
</StickyLane>
|
|
35
|
+
</div>
|
|
36
|
+
<div data-dsh-better-display="status" id="root-status">
|
|
37
|
+
<section data-reader-turn="1" id="turn-status">
|
|
38
|
+
<StickyLane kind="status" className="statusProbe">
|
|
39
|
+
<span style={{ display: 'block', height: 12 }}>用时</span>
|
|
40
|
+
</StickyLane>
|
|
41
|
+
</section>
|
|
42
|
+
</div>
|
|
43
|
+
</>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
createRoot(document.getElementById('app')!).render(<App />);
|
|
@@ -130,6 +130,70 @@ async function verify() {
|
|
|
130
130
|
assert.equal(count(html, 'user content'), 1);
|
|
131
131
|
assert.equal(count(html, 'steering content'), 1);
|
|
132
132
|
assert.equal(count(html, 'Official recall'), 0);
|
|
133
|
+
|
|
134
|
+
// A priority below the official assistant renderer is a replacement.
|
|
135
|
+
// Reader keeps the reasoning card and hands only the body blocks over.
|
|
136
|
+
const assistant = {
|
|
137
|
+
key: 'assistant-key', kind: 'assistant-step', anchorSeq: 4, visibility: 'visible',
|
|
138
|
+
location: { kind: 'turn', turn },
|
|
139
|
+
data: {
|
|
140
|
+
status: 'settled', turn: 1, step: 0, time: 3,
|
|
141
|
+
blocks: [
|
|
142
|
+
{ kind: 'reasoning', text: 'think privately' },
|
|
143
|
+
{ kind: 'text', text: '<div id="vcp-root">card face</div>' },
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
// Reader memoizes on the order array and the nodes map. A real host
|
|
148
|
+
// publishes new references; this fixture has to do the same.
|
|
149
|
+
chat.nodes = new Map(chat.nodes);
|
|
150
|
+
chat.nodes.set('assistant-key', assistant);
|
|
151
|
+
chat.order = [...chat.order, 'assistant-key'];
|
|
152
|
+
store.actions.setExpanded('turn:1:closed:completed', true);
|
|
153
|
+
html = render();
|
|
154
|
+
assert.equal(count(html, 'data-foreign-assistant'), 0);
|
|
155
|
+
assert.ok(html.includes('vcp-root'));
|
|
156
|
+
assert.ok(html.includes('think privately'));
|
|
157
|
+
const calls: Array<{ groupPart: unknown; kinds: string[]; text: string }> = [];
|
|
158
|
+
const Foreign = (props: { groupPart?: unknown; node?: { data?: { blocks?: Array<{ kind: string; text?: string }> } } }) => {
|
|
159
|
+
const blocks = props.node?.data?.blocks ?? [];
|
|
160
|
+
calls.push({
|
|
161
|
+
groupPart: props.groupPart,
|
|
162
|
+
kinds: blocks.map(block => block.kind),
|
|
163
|
+
text: blocks.map(block => block.text ?? '').join('\n'),
|
|
164
|
+
});
|
|
165
|
+
const body = blocks.filter(block => block.kind === 'text').map(block => block.text ?? '').join('\n');
|
|
166
|
+
return <div data-foreign-assistant>{body}</div>;
|
|
167
|
+
};
|
|
168
|
+
const removeOfficialAssistant = slots.register({ name: 'conversation.chat.node', key: 'assistant-step' }, () => <span>Official assistant</span>);
|
|
169
|
+
const removeForeign = slots.register({ name: 'conversation.chat.node', key: 'assistant-step', priority: -10 }, Foreign);
|
|
170
|
+
await new Promise(resolve => queueMicrotask(resolve));
|
|
171
|
+
assert.ok(slots.entriesOfSlot(OFFICIAL_SEATS.nodes).some((entry: { options: { key?: string; priority?: number } }) => entry.options.key === 'assistant-step' && entry.options.priority === -10));
|
|
172
|
+
html = render();
|
|
173
|
+
const answer = container.querySelector('[data-reader-body]');
|
|
174
|
+
assert.ok(answer);
|
|
175
|
+
assert.equal(answer!.querySelectorAll('[data-foreign-assistant]').length, 1);
|
|
176
|
+
assert.ok(answer!.textContent?.includes('<div id="vcp-root">card face</div>'));
|
|
177
|
+
assert.equal(answer!.querySelectorAll('pre').length, 0);
|
|
178
|
+
assert.equal(count(html, 'Official assistant'), 0);
|
|
179
|
+
assert.ok(calls.some(call => call.groupPart === 'response' && call.kinds.join(',') === 'text' && call.text.includes('vcp-root')));
|
|
180
|
+
assert.ok(calls.every(call => !call.kinds.includes('reasoning')));
|
|
181
|
+
const reasoning = container.querySelector('[data-reader-text-kind="reasoning"]');
|
|
182
|
+
assert.ok(reasoning);
|
|
183
|
+
assert.ok(reasoning!.textContent?.includes('think privately'));
|
|
184
|
+
assert.equal(reasoning!.querySelectorAll('[data-foreign-assistant]').length, 0);
|
|
185
|
+
removeForeign();
|
|
186
|
+
removeOfficialAssistant();
|
|
187
|
+
await new Promise(resolve => queueMicrotask(resolve));
|
|
188
|
+
html = render();
|
|
189
|
+
assert.equal(count(html, 'data-foreign-assistant'), 0);
|
|
190
|
+
assert.ok(html.includes('vcp-root'));
|
|
191
|
+
assert.ok(html.includes('think privately'));
|
|
192
|
+
chat.nodes = new Map(chat.nodes);
|
|
193
|
+
chat.nodes.delete('assistant-key');
|
|
194
|
+
chat.order = chat.order.filter((key: string) => key !== 'assistant-key');
|
|
195
|
+
store.actions.setExpanded('turn:1:closed:completed', false);
|
|
196
|
+
|
|
133
197
|
const module = Reflect.get(window, 'easyrewriteModule');
|
|
134
198
|
if (module) {
|
|
135
199
|
const plugin = module.factory((name: string) => {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Reader theme overlap</title>
|
|
6
|
+
<link rel="stylesheet" href="/Reader.module.css">
|
|
7
|
+
<link rel="stylesheet" href="/MarkdownText.module.css">
|
|
8
|
+
<style>
|
|
9
|
+
:root {
|
|
10
|
+
--dsh-content-font-size: 24px;
|
|
11
|
+
--dsh-content-font-delta: 10px;
|
|
12
|
+
--dsw-alias-bg-base: transparent;
|
|
13
|
+
--dsw-alias-bg-layer-1: #102040;
|
|
14
|
+
--dsw-alias-label-primary: #f5f7fa;
|
|
15
|
+
--dsw-alias-label-secondary: #c5cad3;
|
|
16
|
+
--dsw-alias-label-tertiary: #9aa3af;
|
|
17
|
+
--dsw-font-family: ui-sans-serif, sans-serif;
|
|
18
|
+
--dsw-font-markdown-h2: 700 29px/38px var(--dsw-font-family);
|
|
19
|
+
--dsw-font-markdown-base: 24px/34px var(--dsw-font-family);
|
|
20
|
+
}
|
|
21
|
+
body { margin: 0; background: #ff00aa; }
|
|
22
|
+
.scroll { height: 280px; overflow: auto; background: #ff00aa; }
|
|
23
|
+
.spacer { height: 900px; }
|
|
24
|
+
</style>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<div class="scroll" id="scroll">
|
|
28
|
+
<div class="root" data-dsh-better-display="fixture">
|
|
29
|
+
<div class="column" data-chat-flow="">
|
|
30
|
+
<div class="toolbar" data-reader-lane="toolbar"><button class="textButton">自动折叠开</button></div>
|
|
31
|
+
<section class="turn" data-reader-turn="1">
|
|
32
|
+
<div class="turnStickyRegion">
|
|
33
|
+
<div class="turnStickyLanes">
|
|
34
|
+
<div class="turnProcessSticky" data-reader-lane="status">
|
|
35
|
+
<button class="disclosureButton" type="button"><span class="statusText">用时 64 分 24 秒</span></button>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="closedProcessSummary" id="summary" data-reader-closed-summary>
|
|
38
|
+
<div class="summaryRow">
|
|
39
|
+
<button class="disclosureButton" type="button"><span class="foldSummary">思考×79 · 输出×15 · 工具×79 · 记录×3</span></button>
|
|
40
|
+
<span class="diffStatRoot"><button class="diffStatButton" type="button"><span class="diffAdded">+751</span><span class="diffRemoved">-63</span></button></span>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="answer">
|
|
45
|
+
<div class="markdown">
|
|
46
|
+
<h2 id="heading">核心对比 (2024/25 赛季, Deloitte 统一口径)</h2>
|
|
47
|
+
<p class="spacer">回答正文在标题下面继续,用来把标题滚进吸顶带。</p>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</section>
|
|
52
|
+
<section class="turn" data-reader-turn="2">
|
|
53
|
+
<div class="turnProcessSticky" id="flow-status" data-reader-lane="flow-status">
|
|
54
|
+
<button class="disclosureButton" type="button"><span class="statusText">用时 64 分 24 秒,字号放大后这一行变高</span></button>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="flowCell" id="flow-summary" data-flow-summary>
|
|
57
|
+
<button class="disclosureButton" type="button"><span class="foldSummary">思考×79 · 输出×15 · 工具×79 · 记录×3</span></button>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="spacer"></div>
|
|
60
|
+
</section>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<script>
|
|
65
|
+
const root = document.querySelector('[data-dsh-better-display]');
|
|
66
|
+
const turn = document.querySelector('[data-reader-turn="2"]');
|
|
67
|
+
const toolbar = document.querySelector('.toolbar');
|
|
68
|
+
const flowStatus = document.querySelector('#flow-status');
|
|
69
|
+
const flowSummary = document.querySelector('#flow-summary');
|
|
70
|
+
const publish = () => {
|
|
71
|
+
root.style.setProperty('--reader-toolbar-height', `${Math.ceil(toolbar.getBoundingClientRect().height)}px`);
|
|
72
|
+
turn.style.setProperty('--reader-status-height', `${Math.ceil(flowStatus.getBoundingClientRect().height)}px`);
|
|
73
|
+
turn.style.setProperty('--reader-summary-height', `${Math.ceil(flowSummary.getBoundingClientRect().height)}px`);
|
|
74
|
+
};
|
|
75
|
+
publish();
|
|
76
|
+
for (const el of [toolbar, flowStatus, flowSummary]) new ResizeObserver(publish).observe(el);
|
|
77
|
+
window.__themeOverlapReady = true;
|
|
78
|
+
</script>
|
|
79
|
+
</body>
|
|
80
|
+
</html>
|