dsh-better-display 0.1.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/CHANGELOG.md +51 -0
- package/DESIGN.md +72 -0
- package/LICENSE +24 -0
- package/README.en.md +41 -0
- package/README.md +41 -0
- package/THIRD_PARTY_NOTICES.md +65 -0
- package/cordis.patch.yml +5 -0
- package/cordis.yml +4 -0
- package/dshx.yml +5 -0
- package/lib/client.js +49923 -0
- package/lib/client.js.map +1 -0
- package/lib/dsh-better-display.js +256 -0
- package/lib/types/client/Blocks.d.ts +45 -0
- package/lib/types/client/Blocks.d.ts.map +1 -0
- package/lib/types/client/Blocks.js +136 -0
- package/lib/types/client/Blocks.js.map +1 -0
- package/lib/types/client/ChoreographedFlow.d.ts +22 -0
- package/lib/types/client/ChoreographedFlow.d.ts.map +1 -0
- package/lib/types/client/ChoreographedFlow.js +170 -0
- package/lib/types/client/ChoreographedFlow.js.map +1 -0
- package/lib/types/client/ClosedProcessSummary.d.ts +9 -0
- package/lib/types/client/ClosedProcessSummary.d.ts.map +1 -0
- package/lib/types/client/ClosedProcessSummary.js +15 -0
- package/lib/types/client/ClosedProcessSummary.js.map +1 -0
- package/lib/types/client/LiveFold.d.ts +10 -0
- package/lib/types/client/LiveFold.d.ts.map +1 -0
- package/lib/types/client/LiveFold.js +39 -0
- package/lib/types/client/LiveFold.js.map +1 -0
- package/lib/types/client/McpAppFrame.d.ts +32 -0
- package/lib/types/client/McpAppFrame.d.ts.map +1 -0
- package/lib/types/client/McpAppFrame.js +193 -0
- package/lib/types/client/McpAppFrame.js.map +1 -0
- package/lib/types/client/Reader.d.ts +3 -0
- package/lib/types/client/Reader.d.ts.map +1 -0
- package/lib/types/client/Reader.js +537 -0
- package/lib/types/client/Reader.js.map +1 -0
- package/lib/types/client/ReasoningCard.d.ts +11 -0
- package/lib/types/client/ReasoningCard.d.ts.map +1 -0
- package/lib/types/client/ReasoningCard.js +301 -0
- package/lib/types/client/ReasoningCard.js.map +1 -0
- package/lib/types/client/StickyLane.d.ts +8 -0
- package/lib/types/client/StickyLane.d.ts.map +1 -0
- package/lib/types/client/StickyLane.js +28 -0
- package/lib/types/client/StickyLane.js.map +1 -0
- package/lib/types/client/TimelineRail.d.ts +10 -0
- package/lib/types/client/TimelineRail.d.ts.map +1 -0
- package/lib/types/client/TimelineRail.js +168 -0
- package/lib/types/client/TimelineRail.js.map +1 -0
- package/lib/types/client/ToolActivity.d.ts +17 -0
- package/lib/types/client/ToolActivity.d.ts.map +1 -0
- package/lib/types/client/ToolActivity.js +192 -0
- package/lib/types/client/ToolActivity.js.map +1 -0
- package/lib/types/client/TurnMetrics.d.ts +11 -0
- package/lib/types/client/TurnMetrics.d.ts.map +1 -0
- package/lib/types/client/TurnMetrics.js +44 -0
- package/lib/types/client/TurnMetrics.js.map +1 -0
- package/lib/types/client/WaitingStatus.d.ts +6 -0
- package/lib/types/client/WaitingStatus.d.ts.map +1 -0
- package/lib/types/client/WaitingStatus.js +19 -0
- package/lib/types/client/WaitingStatus.js.map +1 -0
- package/lib/types/client/conversation-scroll.d.ts +19 -0
- package/lib/types/client/conversation-scroll.d.ts.map +1 -0
- package/lib/types/client/conversation-scroll.js +25 -0
- package/lib/types/client/conversation-scroll.js.map +1 -0
- package/lib/types/client/deliverables.d.ts +24 -0
- package/lib/types/client/deliverables.d.ts.map +1 -0
- package/lib/types/client/deliverables.js +104 -0
- package/lib/types/client/deliverables.js.map +1 -0
- package/lib/types/client/entry-policy.d.ts +10 -0
- package/lib/types/client/entry-policy.d.ts.map +1 -0
- package/lib/types/client/entry-policy.js +24 -0
- package/lib/types/client/entry-policy.js.map +1 -0
- package/lib/types/client/entry.d.ts +4 -0
- package/lib/types/client/entry.d.ts.map +1 -0
- package/lib/types/client/entry.js +34 -0
- package/lib/types/client/entry.js.map +1 -0
- package/lib/types/client/fold-choreography.d.ts +28 -0
- package/lib/types/client/fold-choreography.d.ts.map +1 -0
- package/lib/types/client/fold-choreography.js +31 -0
- package/lib/types/client/fold-choreography.js.map +1 -0
- package/lib/types/client/index.d.ts +7 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/index.js +153 -0
- package/lib/types/client/index.js.map +1 -0
- package/lib/types/client/live-turn.d.ts +58 -0
- package/lib/types/client/live-turn.d.ts.map +1 -0
- package/lib/types/client/live-turn.js +144 -0
- package/lib/types/client/live-turn.js.map +1 -0
- package/lib/types/client/markdown/MarkdownText.d.ts +39 -0
- package/lib/types/client/markdown/MarkdownText.d.ts.map +1 -0
- package/lib/types/client/markdown/MarkdownText.js +171 -0
- package/lib/types/client/markdown/MarkdownText.js.map +1 -0
- package/lib/types/client/markdown/cjkFriendlyStrong.d.ts +9 -0
- package/lib/types/client/markdown/cjkFriendlyStrong.d.ts.map +1 -0
- package/lib/types/client/markdown/cjkFriendlyStrong.js +73 -0
- package/lib/types/client/markdown/cjkFriendlyStrong.js.map +1 -0
- package/lib/types/client/markdown/incremental.d.ts +69 -0
- package/lib/types/client/markdown/incremental.d.ts.map +1 -0
- package/lib/types/client/markdown/incremental.js +108 -0
- package/lib/types/client/markdown/incremental.js.map +1 -0
- package/lib/types/client/markdown/katex.d.ts +27 -0
- package/lib/types/client/markdown/katex.d.ts.map +1 -0
- package/lib/types/client/markdown/katex.js +88 -0
- package/lib/types/client/markdown/katex.js.map +1 -0
- package/lib/types/client/markdown/mathCompatibility.d.ts +11 -0
- package/lib/types/client/markdown/mathCompatibility.d.ts.map +1 -0
- package/lib/types/client/markdown/mathCompatibility.js +293 -0
- package/lib/types/client/markdown/mathCompatibility.js.map +1 -0
- package/lib/types/client/markdown/parse.d.ts +25 -0
- package/lib/types/client/markdown/parse.d.ts.map +1 -0
- package/lib/types/client/markdown/parse.js +42 -0
- package/lib/types/client/markdown/parse.js.map +1 -0
- package/lib/types/client/markdown/render.d.ts +119 -0
- package/lib/types/client/markdown/render.d.ts.map +1 -0
- package/lib/types/client/markdown/render.js +435 -0
- package/lib/types/client/markdown/render.js.map +1 -0
- package/lib/types/client/mcp-app.d.ts +50 -0
- package/lib/types/client/mcp-app.d.ts.map +1 -0
- package/lib/types/client/mcp-app.js +328 -0
- package/lib/types/client/mcp-app.js.map +1 -0
- package/lib/types/client/message-chrome.d.ts +19 -0
- package/lib/types/client/message-chrome.d.ts.map +1 -0
- package/lib/types/client/message-chrome.js +42 -0
- package/lib/types/client/message-chrome.js.map +1 -0
- package/lib/types/client/motion.d.ts +38 -0
- package/lib/types/client/motion.d.ts.map +1 -0
- package/lib/types/client/motion.js +367 -0
- package/lib/types/client/motion.js.map +1 -0
- package/lib/types/client/native/ContextBody.d.ts +130 -0
- package/lib/types/client/native/ContextBody.d.ts.map +1 -0
- package/lib/types/client/native/ContextBody.js +398 -0
- package/lib/types/client/native/ContextBody.js.map +1 -0
- package/lib/types/client/native/ContextInjectionRow.d.ts +26 -0
- package/lib/types/client/native/ContextInjectionRow.d.ts.map +1 -0
- package/lib/types/client/native/ContextInjectionRow.js +27 -0
- package/lib/types/client/native/ContextInjectionRow.js.map +1 -0
- package/lib/types/client/native/ReferenceIcon.d.ts +16 -0
- package/lib/types/client/native/ReferenceIcon.d.ts.map +1 -0
- package/lib/types/client/native/ReferenceIcon.js +16 -0
- package/lib/types/client/native/ReferenceIcon.js.map +1 -0
- package/lib/types/client/native/tool-call-model.d.ts +58 -0
- package/lib/types/client/native/tool-call-model.d.ts.map +1 -0
- package/lib/types/client/native/tool-call-model.js +219 -0
- package/lib/types/client/native/tool-call-model.js.map +1 -0
- package/lib/types/client/open-file.d.ts +24 -0
- package/lib/types/client/primitive-labels.d.ts +10 -0
- package/lib/types/client/primitive-labels.d.ts.map +1 -0
- package/lib/types/client/primitive-labels.js +37 -0
- package/lib/types/client/primitive-labels.js.map +1 -0
- package/lib/types/client/projection.d.ts +41 -0
- package/lib/types/client/projection.d.ts.map +1 -0
- package/lib/types/client/projection.js +112 -0
- package/lib/types/client/projection.js.map +1 -0
- package/lib/types/client/reasoning-follow.d.ts +6 -0
- package/lib/types/client/reasoning-follow.d.ts.map +1 -0
- package/lib/types/client/reasoning-follow.js +12 -0
- package/lib/types/client/reasoning-follow.js.map +1 -0
- package/lib/types/client/settings-copy.d.ts +6 -0
- package/lib/types/client/settings-slots.d.ts +16 -0
- package/lib/types/client/store.d.ts +17 -0
- package/lib/types/client/store.d.ts.map +1 -0
- package/lib/types/client/store.js +13 -0
- package/lib/types/client/store.js.map +1 -0
- package/lib/types/client/stream-buffer.d.ts +29 -0
- package/lib/types/client/stream-buffer.d.ts.map +1 -0
- package/lib/types/client/stream-buffer.js +113 -0
- package/lib/types/client/stream-buffer.js.map +1 -0
- package/lib/types/client/streaming.d.ts +18 -0
- package/lib/types/client/streaming.d.ts.map +1 -0
- package/lib/types/client/streaming.js +77 -0
- package/lib/types/client/streaming.js.map +1 -0
- package/lib/types/client/timeline.d.ts +26 -0
- package/lib/types/client/timeline.d.ts.map +1 -0
- package/lib/types/client/timeline.js +48 -0
- package/lib/types/client/timeline.js.map +1 -0
- package/lib/types/client/tool-activity.d.ts +52 -0
- package/lib/types/client/tool-activity.d.ts.map +1 -0
- package/lib/types/client/tool-activity.js +178 -0
- package/lib/types/client/tool-activity.js.map +1 -0
- package/lib/types/client/types.d.ts +66 -0
- package/lib/types/client/types.d.ts.map +1 -0
- package/lib/types/client/types.js +2 -0
- package/lib/types/client/types.js.map +1 -0
- package/lib/types/client/waiting-clock.d.ts +17 -0
- package/lib/types/client/waiting-clock.d.ts.map +1 -0
- package/lib/types/client/waiting-clock.js +24 -0
- package/lib/types/client/waiting-clock.js.map +1 -0
- package/lib/types/client/word-motion.d.ts +16 -0
- package/lib/types/client/word-motion.d.ts.map +1 -0
- package/lib/types/client/word-motion.js +89 -0
- package/lib/types/client/word-motion.js.map +1 -0
- package/lib/types/client/word-timeline.d.ts +28 -0
- package/lib/types/client/word-timeline.d.ts.map +1 -0
- package/lib/types/client/word-timeline.js +100 -0
- package/lib/types/client/word-timeline.js.map +1 -0
- package/lib/types/dsh-better-display.d.ts +17 -0
- package/lib/types/dsh-better-display.d.ts.map +1 -0
- package/lib/types/dsh-better-display.js +53 -0
- package/lib/types/dsh-better-display.js.map +1 -0
- package/package.json +121 -0
- package/scripts/build-motion-fixture.mjs +26 -0
- package/scripts/link-harness-dependencies.mjs +51 -0
- package/skills/generative-mcpapps/SKILL.md +47 -0
- package/skills/generative-mcpapps/examples/interactive_quiz.html +153 -0
- package/skills/generative-mcpapps/references/html_boilerplate.md +122 -0
- package/skills/generative-mcpapps/references/sep1865_protocol.md +54 -0
- package/src/client/Blocks.tsx +205 -0
- package/src/client/ChoreographedFlow.tsx +182 -0
- package/src/client/ClosedProcessSummary.tsx +19 -0
- package/src/client/LiveFold.tsx +43 -0
- package/src/client/McpAppFrame.module.css +210 -0
- package/src/client/McpAppFrame.tsx +317 -0
- package/src/client/Reader.module.css +329 -0
- package/src/client/Reader.tsx +814 -0
- package/src/client/ReasoningCard.tsx +285 -0
- package/src/client/SettingsSection.module.css +147 -0
- package/src/client/SettingsSection.tsx +117 -0
- package/src/client/StickyLane.tsx +24 -0
- package/src/client/TimelineRail.module.css +170 -0
- package/src/client/TimelineRail.tsx +262 -0
- package/src/client/ToolActivity.tsx +214 -0
- package/src/client/TurnMetrics.module.css +139 -0
- package/src/client/TurnMetrics.tsx +160 -0
- package/src/client/WaitingStatus.tsx +22 -0
- package/src/client/conversation-scroll.ts +28 -0
- package/src/client/deliverables.ts +122 -0
- package/src/client/entry-policy.ts +20 -0
- package/src/client/entry.tsx +40 -0
- package/src/client/fold-choreography.ts +38 -0
- package/src/client/index.tsx +198 -0
- package/src/client/live-turn.ts +155 -0
- package/src/client/markdown/MarkdownText.module.css +304 -0
- package/src/client/markdown/MarkdownText.tsx +187 -0
- package/src/client/markdown/cjkFriendlyStrong.ts +84 -0
- package/src/client/markdown/incremental.ts +131 -0
- package/src/client/markdown/katex.tsx +91 -0
- package/src/client/markdown/mathCompatibility.ts +350 -0
- package/src/client/markdown/parse.ts +45 -0
- package/src/client/markdown/render.tsx +630 -0
- package/src/client/markdown/upstream.json +14 -0
- package/src/client/mcp-app.ts +323 -0
- package/src/client/message-chrome.ts +47 -0
- package/src/client/motion.tsx +338 -0
- package/src/client/native/ContextBody.module.css +161 -0
- package/src/client/native/ContextBody.tsx +591 -0
- package/src/client/native/ContextInjectionRow.module.css +62 -0
- package/src/client/native/ContextInjectionRow.tsx +72 -0
- package/src/client/native/ReferenceIcon.tsx +35 -0
- package/src/client/native/tool-call-model.ts +248 -0
- package/src/client/native/upstream.json +41 -0
- package/src/client/open-file.ts +94 -0
- package/src/client/pending-submission.ts +49 -0
- package/src/client/primitive-labels.ts +53 -0
- package/src/client/projection.ts +118 -0
- package/src/client/reasoning-follow.ts +12 -0
- package/src/client/settings-copy.ts +53 -0
- package/src/client/settings-slots.ts +20 -0
- package/src/client/settings.tsx +73 -0
- package/src/client/skill-status.ts +78 -0
- package/src/client/store.ts +30 -0
- package/src/client/stream-buffer.ts +100 -0
- package/src/client/streaming.tsx +62 -0
- package/src/client/style.d.ts +4 -0
- package/src/client/timeline.ts +77 -0
- package/src/client/tool-activity.ts +152 -0
- package/src/client/types.ts +66 -0
- package/src/client/waiting-clock.ts +25 -0
- package/src/client/word-motion.tsx +91 -0
- package/src/client/word-timeline.ts +96 -0
- package/src/dsh-better-display.ts +108 -0
- package/src/skill-roots.ts +138 -0
- package/src/skill-status.ts +81 -0
- package/tests/browser-closed-gap.tsx +20 -0
- package/tests/browser-motion.tsx +65 -0
- package/tests/browser-sticky-lanes.tsx +22 -0
- package/tests/browser-waiting-clock.tsx +14 -0
- package/tests/chat-flow-hook.test.ts +66 -0
- package/tests/cloud-gate.test.ts +34 -0
- package/tests/conversation-scroll.test.ts +47 -0
- package/tests/deliverables.test.ts +128 -0
- package/tests/entry.test.ts +42 -0
- package/tests/fixtures/maid-composer-hide.html +31 -0
- package/tests/fold-choreography.test.ts +38 -0
- package/tests/history-word-regression.test.ts +16 -0
- package/tests/live-turn.test.ts +218 -0
- package/tests/mcp-apps.test.ts +157 -0
- package/tests/message-chrome.test.ts +29 -0
- package/tests/open-file.test.ts +103 -0
- package/tests/pending-submission.test.ts +45 -0
- package/tests/projection.test.ts +184 -0
- package/tests/reasoning-follow.test.ts +34 -0
- package/tests/settings-copy.test.ts +63 -0
- package/tests/skill-status.test.ts +137 -0
- package/tests/stock-install.test.ts +50 -0
- package/tests/stream-buffer.test.ts +97 -0
- package/tests/timeline.test.ts +59 -0
- package/tests/waiting-clock.test.ts +24 -0
- package/tests/word-timeline.test.ts +136 -0
- package/tsconfig.json +11 -0
- package/tsdown.config.ts +49 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, memo, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { JsonBlock, MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
4
|
+
import { BlockBoundary, Blocks, contentBlocks, CopyAnswer, UserMessageActions } from './Blocks.js';
|
|
5
|
+
import { ReasoningCard } from './ReasoningCard.js';
|
|
6
|
+
import { ToolActivity, ToolMedia } from './ToolActivity.js';
|
|
7
|
+
import { preparingLabel, readerFlow } from './tool-activity.js';
|
|
8
|
+
import { Disclosure, ProcessFragment, RetiringContent, StatusText, useMotionAllowed, usePinnedSelection, useReadingScroll } from './motion.js';
|
|
9
|
+
import { StreamMotionContext } from './streaming.js';
|
|
10
|
+
import { assistantSegments, boundaryOf, forkAnchorSeq, groupNodes, hasProcessContent, hasVisibleBody, isEarlierNarration, processChoiceKey, processExpanded, terminalLabel } from './projection.js';
|
|
11
|
+
import { basename, createProducedFileMentions, dirname, getTurnDeliverables, showDeliverablesRow } from './deliverables.js';
|
|
12
|
+
import { WaitingStatus } from './WaitingStatus.js';
|
|
13
|
+
import { waitingAnchor } from './waiting-clock.js';
|
|
14
|
+
import { ContextInjectionRow } from './native/ContextInjectionRow.js';
|
|
15
|
+
import { TimelineRail } from './TimelineRail.js';
|
|
16
|
+
import { landTurn, scrollerOf } from './conversation-scroll.js';
|
|
17
|
+
import { mergeTimelineItems } from './timeline.js';
|
|
18
|
+
import { presentLiveTurn, segmentLiveTurn } from './live-turn.js';
|
|
19
|
+
import { ChoreographedFlow, useFlowChat } from './ChoreographedFlow.js';
|
|
20
|
+
import { ClosedProcessSummary } from './ClosedProcessSummary.js';
|
|
21
|
+
import { StickyLane } from './StickyLane.js';
|
|
22
|
+
import css from './Reader.module.css';
|
|
23
|
+
import { markdownLabels, truncatedJsonLabel } from './primitive-labels.js';
|
|
24
|
+
function isNode(node, kind) {
|
|
25
|
+
return node.kind === kind;
|
|
26
|
+
}
|
|
27
|
+
function cleanErrorMessage(raw) {
|
|
28
|
+
if (!raw)
|
|
29
|
+
return '模型服务暂时无响应或连接中断,请稍后重试。';
|
|
30
|
+
let str = raw.trim();
|
|
31
|
+
if (str.includes('"error"') || str.startsWith('{')) {
|
|
32
|
+
try {
|
|
33
|
+
const idx = str.indexOf('{');
|
|
34
|
+
const parsed = JSON.parse(str.slice(idx));
|
|
35
|
+
const msg = parsed?.error?.message || parsed?.message || parsed?.error;
|
|
36
|
+
if (typeof msg === 'string')
|
|
37
|
+
str = msg;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// keep
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return str;
|
|
44
|
+
}
|
|
45
|
+
const CompactionDivider = memo(function CompactionDivider({ data }) {
|
|
46
|
+
const [open, setOpen] = useState(false);
|
|
47
|
+
if (!data)
|
|
48
|
+
return null;
|
|
49
|
+
const hasSummary = typeof data.summary === 'string' && data.summary.trim().length > 0;
|
|
50
|
+
const items = data.shadowedItemCount;
|
|
51
|
+
const tokens = data.shadowedTokenCount;
|
|
52
|
+
let label = '已压缩历史上下文';
|
|
53
|
+
if (items && tokens) {
|
|
54
|
+
const kTokens = tokens >= 1000 ? `${(tokens / 1000).toFixed(1)}k` : String(tokens);
|
|
55
|
+
label = `已压缩 ${items} 条上下文 · 释放约 ${kTokens} tokens`;
|
|
56
|
+
}
|
|
57
|
+
else if (items) {
|
|
58
|
+
label = `已压缩 ${items} 条上下文`;
|
|
59
|
+
}
|
|
60
|
+
else if (tokens) {
|
|
61
|
+
const kTokens = tokens >= 1000 ? `${(tokens / 1000).toFixed(1)}k` : String(tokens);
|
|
62
|
+
label = `已压缩上下文 · 释放约 ${kTokens} tokens`;
|
|
63
|
+
}
|
|
64
|
+
return (_jsxs("div", { className: css.compactionRow, "data-reader-compaction": true, children: [_jsx("div", { className: css.compactionLine, children: hasSummary ? (_jsxs("button", { type: "button", className: `${css.compactionPill} ${css.compactionButton}`, onClick: () => setOpen(v => !v), "aria-expanded": open, title: open ? '收起历史记忆摘要' : '展开查看此节点提炼的记忆摘要', children: [_jsxs("svg", { className: css.compactionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("path", { d: "M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2z", strokeWidth: "1.2" }), _jsx("path", { d: "M8 5v3.2l2 1.8", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("span", { children: label }), _jsx("span", { className: css.compactionToggle, children: open ? '收起备忘' : '查看备忘' })] })) : (_jsxs("span", { className: css.compactionPill, children: [_jsxs("svg", { className: css.compactionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("path", { d: "M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2z", strokeWidth: "1.2" }), _jsx("path", { d: "M8 5v3.2l2 1.8", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("span", { children: label })] })) }), open && hasSummary && (_jsxs("div", { className: css.compactionSummaryBox, "data-reader-anchor": true, children: [_jsx("div", { className: css.compactionSummaryHeader, children: "\u524D\u671F\u5BF9\u8BDD\u8981\u70B9\u5907\u5FD8" }), _jsx(MarkdownText, { text: data.summary, labels: markdownLabels })] }))] }));
|
|
65
|
+
});
|
|
66
|
+
const ProcessNode = memo(function ProcessNode({ useChat, t, nodeKey, open, motion, onRead, returnFocusTo }) {
|
|
67
|
+
const node = useChat(snapshot => snapshot.nodes.get(nodeKey));
|
|
68
|
+
if (!node || node.visibility === 'hidden')
|
|
69
|
+
return null;
|
|
70
|
+
let content = null;
|
|
71
|
+
if (isNode(node, 'context'))
|
|
72
|
+
content = _jsx(ContextInjectionRow, { ...node.data, t: t });
|
|
73
|
+
else if (isNode(node, 'system-prompt'))
|
|
74
|
+
content = _jsxs("details", { className: css.detail, children: [_jsx("summary", { children: "\u7CFB\u7EDF\u63D0\u793A\u8BCD" }), _jsx("pre", { className: css.systemPrompt, children: node.data.text })] });
|
|
75
|
+
else if (isNode(node, 'model-retry'))
|
|
76
|
+
content = _jsx(JsonBlock, { label: "\u6A21\u578B\u91CD\u8BD5\u8BB0\u5F55", payload: node.data.attempts, truncatedLabel: truncatedJsonLabel });
|
|
77
|
+
else if (isNode(node, 'manual-compaction')) {
|
|
78
|
+
if (node.data.command.outcome?.kind === 'error') {
|
|
79
|
+
content = _jsxs("div", { className: css.error, role: "alert", children: [_jsxs("svg", { className: css.errorIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("circle", { cx: "8", cy: "8", r: "6.5", strokeWidth: "1.2" }), _jsx("path", { d: "M8 5v3.5M8 11.2h.01", strokeWidth: "1.5", strokeLinecap: "round" })] }), _jsxs("div", { className: css.errorCopy, children: [_jsx("div", { className: css.errorTitle, children: _jsx("strong", { children: "\u4E0A\u4E0B\u6587\u538B\u7F29\u672A\u6210\u529F" }) }), _jsx("p", { className: css.errorMessage, children: node.data.command.outcome.text })] })] });
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
content = node.data.compaction ? _jsx(CompactionDivider, { data: node.data.compaction }) : null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (isNode(node, 'compaction'))
|
|
86
|
+
content = _jsx(CompactionDivider, { data: node.data });
|
|
87
|
+
else if (isNode(node, 'command'))
|
|
88
|
+
content = _jsx(JsonBlock, { label: "\u547D\u4EE4\u8BB0\u5F55", payload: node.data, truncatedLabel: truncatedJsonLabel });
|
|
89
|
+
return content && _jsx(ProcessFragment, { open: open, motion: motion, onRead: onRead, returnFocusTo: returnFocusTo, nodeKey: nodeKey, framed: true, children: content });
|
|
90
|
+
});
|
|
91
|
+
const AssistantNode = memo(function AssistantNode({ useChat, nodeKey, boundary, processOpen = false, pinned = false, folded = false, partStart, motion, onRead, returnFocusTo, ...render }) {
|
|
92
|
+
const node = useChat(snapshot => snapshot.nodes.get(nodeKey));
|
|
93
|
+
if (!node || node.visibility === 'hidden' || !isNode(node, 'assistant-step'))
|
|
94
|
+
return null;
|
|
95
|
+
const data = node.data;
|
|
96
|
+
const parts = assistantSegments(data.blocks);
|
|
97
|
+
const earlier = isEarlierNarration(data, boundary);
|
|
98
|
+
const hasToolCalls = data.blocks.some(block => block.kind === 'tool-call');
|
|
99
|
+
const isProcessStep = earlier || folded || hasToolCalls || (boundary.latestStep > 0 && data.step < boundary.latestStep);
|
|
100
|
+
const body = data.blocks.filter(block => block.kind !== 'reasoning' && block.kind !== 'tool-call');
|
|
101
|
+
const visible = partStart === undefined ? parts : parts.filter(part => part.start === partStart);
|
|
102
|
+
return _jsx(_Fragment, { children: visible.map(part => {
|
|
103
|
+
const index = parts.findIndex(item => item.start === part.start);
|
|
104
|
+
const last = index === parts.length - 1;
|
|
105
|
+
return part.kind === 'reasoning'
|
|
106
|
+
? _jsx(ProcessFragment, { open: processOpen, motion: motion, onRead: onRead, returnFocusTo: returnFocusTo, nodeKey: nodeKey, framed: true, children: _jsx(ReasoningCard, { step: data.step, active: processOpen && boundary.status === 'open' && data.step === boundary.latestStep, motion: motion, selected: pinned, onRead: onRead, children: _jsx(Blocks, { ...render, blocks: part.blocks, streaming: data.status === 'running' && last && data.blocks.at(-1)?.kind === 'reasoning', holdFormatting: pinned, startedAt: data.time, interrupted: data.status === 'interrupted', liveText: true }) }) }, part.start)
|
|
107
|
+
: isProcessStep ? _jsx(ProcessFragment, { open: processOpen, motion: motion, onRead: onRead, returnFocusTo: returnFocusTo, nodeKey: nodeKey, children: _jsx("article", { className: css.processCommentary, children: _jsx(Blocks, { ...render, blocks: part.blocks, streaming: data.status === 'running', holdFormatting: pinned, startedAt: data.time, interrupted: data.status === 'interrupted', liveText: true }) }) }, part.start)
|
|
108
|
+
: hasVisibleBody(part.blocks) && _jsx(RetiringContent, { visible: pinned || processOpen || (!earlier && !folded), children: _jsxs("article", { className: css.answer, "data-reader-answer": true, "data-reader-anchor": true, "data-reader-key": nodeKey, "data-reader-source-start": part.start, "data-answer-status": data.status, "data-answer-phase": earlier || folded ? 'process' : 'body', children: [_jsx(Blocks, { ...render, blocks: part.blocks, streaming: data.status === 'running', holdFormatting: pinned, startedAt: data.time, interrupted: data.status === 'interrupted', liveText: true }), last && data.status === 'interrupted' && _jsx("span", { className: css.stopped, children: "\u5DF2\u505C\u6B62" }), last && !earlier && !folded && data.status !== 'running' && boundary.status === 'closed' && (_jsx(CopyAnswer, { blocks: body, onFork: (() => {
|
|
109
|
+
// The fork anchor must be the durable closing message seq (same as
|
|
110
|
+
// the official turn-tail branch). AssistantChatData carries no seq
|
|
111
|
+
// of its own; passing it would fork the whole session instead.
|
|
112
|
+
const anchor = forkAnchorSeq([data.finalNode, { seq: render.forkSeq }]);
|
|
113
|
+
return render.forkAt && anchor !== undefined ? () => render.forkAt(anchor) : undefined;
|
|
114
|
+
})(), metrics: render.metrics }))] }) }, part.start);
|
|
115
|
+
}) });
|
|
116
|
+
});
|
|
117
|
+
const MainNode = memo(function MainNode({ useChat, nodeKey, boundary, pinned, processOpen = false, ...render }) {
|
|
118
|
+
const node = useChat(snapshot => snapshot.nodes.get(nodeKey));
|
|
119
|
+
if (!node || node.visibility === 'hidden')
|
|
120
|
+
return null;
|
|
121
|
+
if (isNode(node, 'user') || isNode(node, 'steering')) {
|
|
122
|
+
const blocks = contentBlocks(node.data.content);
|
|
123
|
+
const imageBlocks = blocks.filter(b => b.kind === 'image');
|
|
124
|
+
const otherBlocks = blocks.filter(b => b.kind !== 'image');
|
|
125
|
+
const text = otherBlocks.filter((block) => block.kind === 'text').map(block => block.text).join('\n\n');
|
|
126
|
+
const time = node.data.time;
|
|
127
|
+
return _jsxs("div", { className: css.userCluster, "data-reader-anchor": true, "data-reader-key": nodeKey, children: [node.kind === 'steering' && _jsx("p", { className: css.meta, children: "\u8865\u5145\u6D88\u606F" }), imageBlocks.length > 0 && _jsx("div", { className: css.userImages, children: _jsx(Blocks, { ...render, blocks: imageBlocks, source: "user" }) }), otherBlocks.length > 0 && _jsx("div", { className: css.user, children: _jsx(Blocks, { ...render, blocks: otherBlocks, source: "user" }) }), _jsx(UserMessageActions, { text: text, time: time })] });
|
|
128
|
+
}
|
|
129
|
+
if (isNode(node, 'assistant-step'))
|
|
130
|
+
return null;
|
|
131
|
+
if (isNode(node, 'tool-call'))
|
|
132
|
+
return _jsx(ToolMedia, { ...render, block: node.data.root });
|
|
133
|
+
if (isNode(node, 'turn-error'))
|
|
134
|
+
return _jsxs("div", { className: css.error, role: "alert", "data-reader-anchor": true, children: [_jsxs("svg", { className: css.errorIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("circle", { cx: "8", cy: "8", r: "6.5", strokeWidth: "1.2" }), _jsx("path", { d: "M8 5v3.5M8 11.2h.01", strokeWidth: "1.5", strokeLinecap: "round" })] }), _jsxs("div", { className: css.errorCopy, children: [_jsxs("div", { className: css.errorTitle, children: [_jsx("strong", { children: "\u672C\u8F6E\u8FD0\u884C\u5931\u8D25" }), node.data.code && _jsx("code", { className: css.errorCode, children: node.data.code })] }), _jsx("p", { className: css.errorMessage, children: cleanErrorMessage(node.data.message) })] })] });
|
|
135
|
+
if (isNode(node, 'turn-max-tokens'))
|
|
136
|
+
return _jsx("div", { className: css.notice, children: "\u5DF2\u5230\u8FBE\u8F93\u51FA\u957F\u5EA6\u9650\u5236\uFF0C\u56DE\u7B54\u5C1A\u672A\u5B8C\u6574\u3002" });
|
|
137
|
+
if (isNode(node, 'model-retry'))
|
|
138
|
+
return node.data.current.retryState === 'scheduled'
|
|
139
|
+
? _jsx("div", { className: css.notice, role: "status", children: "\u6A21\u578B\u8BF7\u6C42\u672A\u6210\u529F\uFF0C\u6B63\u5728\u7B49\u5F85\u91CD\u8BD5\u3002\u8BE6\u60C5\u4FDD\u7559\u5728\u6267\u884C\u8FC7\u7A0B\u4E2D\u3002" }) : null;
|
|
140
|
+
if (isNode(node, 'command')) {
|
|
141
|
+
if (node.data.outcome?.kind === 'error')
|
|
142
|
+
return _jsxs("div", { className: css.error, role: "alert", children: [_jsxs("svg", { className: css.errorIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("circle", { cx: "8", cy: "8", r: "6.5", strokeWidth: "1.2" }), _jsx("path", { d: "M8 5v3.5M8 11.2h.01", strokeWidth: "1.5", strokeLinecap: "round" })] }), _jsxs("div", { className: css.errorCopy, children: [_jsx("div", { className: css.errorTitle, children: _jsx("strong", { children: "\u547D\u4EE4\u6267\u884C\u672A\u6210\u529F" }) }), _jsx("p", { className: css.errorMessage, children: node.data.outcome.text ?? node.data.name ?? '查看原对话中的命令记录' })] })] });
|
|
143
|
+
return node.data.outcome?.text ? _jsx(MarkdownText, { text: node.data.outcome.text, labels: markdownLabels }) : null;
|
|
144
|
+
}
|
|
145
|
+
if (isNode(node, 'manual-compaction') || isNode(node, 'compaction'))
|
|
146
|
+
return null;
|
|
147
|
+
if (node.kind === 'context' || node.kind === 'turn-tail' || node.kind === 'system-prompt' || node.kind === 'turn-process')
|
|
148
|
+
return null;
|
|
149
|
+
if (node.kind === 'command-input') {
|
|
150
|
+
const data = node.data;
|
|
151
|
+
return _jsxs("div", { className: css.user, "data-reader-anchor": true, "data-reader-key": nodeKey, children: [_jsx("p", { className: css.meta, children: "\u547D\u4EE4\u8F93\u5165" }), _jsx("p", { className: css.commandInput, children: data.text })] });
|
|
152
|
+
}
|
|
153
|
+
return _jsxs("div", { className: css.unknown, "data-reader-anchor": true, children: [_jsxs("p", { children: ["\u6B64\u8BB0\u5F55\u7C7B\u578B\u6682\u672A\u63A5\u5165\u9605\u8BFB\u9875\uFF1A", node.kind] }), _jsx(JsonBlock, { label: "\u67E5\u770B\u539F\u59CB\u8BB0\u5F55", payload: node.data, truncatedLabel: truncatedJsonLabel })] });
|
|
154
|
+
});
|
|
155
|
+
function GroupStatus({ group, sessionId, useChat, useSessionPendingInteraction, motion }) {
|
|
156
|
+
const pending = useSessionPendingInteraction(snapshot => snapshot.get(sessionId));
|
|
157
|
+
const text = useChat(snapshot => {
|
|
158
|
+
const turn = group.turn === null ? undefined : snapshot.timeline.turns.get(group.turn);
|
|
159
|
+
if (turn?.status === 'closed') {
|
|
160
|
+
if (turn.end?.data.reason.kind !== 'completed')
|
|
161
|
+
return '执行过程';
|
|
162
|
+
const elapsed = turn.start && turn.end ? Math.max(0, Math.round((turn.end.time - turn.start.time) / 1000)) : null;
|
|
163
|
+
return elapsed === null ? '执行过程' : elapsed < 60 ? `用时 ${elapsed} 秒` : `用时 ${Math.floor(elapsed / 60)} 分 ${elapsed % 60} 秒`;
|
|
164
|
+
}
|
|
165
|
+
if (turn?.status !== 'open')
|
|
166
|
+
return '执行过程';
|
|
167
|
+
if (pending !== undefined)
|
|
168
|
+
return '等待你的操作';
|
|
169
|
+
const current = turn.steps.at(-1)?.data.get('assistant-step');
|
|
170
|
+
const last = current?.blocks.at(-1);
|
|
171
|
+
if (current?.status === 'running' && last?.kind === 'tool-call')
|
|
172
|
+
return preparingLabel(last.name);
|
|
173
|
+
for (let index = group.keys.length - 1; index >= 0; index--) {
|
|
174
|
+
const node = snapshot.nodes.get(group.keys[index]);
|
|
175
|
+
if (!node)
|
|
176
|
+
continue;
|
|
177
|
+
if (isNode(node, 'tool-call') && !('kind' in node.data.root))
|
|
178
|
+
return '正在使用工具';
|
|
179
|
+
if (isNode(node, 'assistant-step') && node.data.status === 'running') {
|
|
180
|
+
const last = node.data.blocks.at(-1);
|
|
181
|
+
return last?.kind === 'reasoning' ? '正在思考' : last?.kind === 'text' ? '正在输出' : '正在准备回复';
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return '正在处理';
|
|
185
|
+
});
|
|
186
|
+
const busy = useChat(snapshot => group.turn !== null && snapshot.timeline.turns.get(group.turn)?.status === 'open' && pending === undefined);
|
|
187
|
+
return _jsx(StatusText, { text: text, motion: motion, shimmer: busy });
|
|
188
|
+
}
|
|
189
|
+
const DeliverableChip = memo(function DeliverableChip({ path, openFile, revealFile }) {
|
|
190
|
+
const [status, setStatus] = useState('idle');
|
|
191
|
+
const timer = useRef();
|
|
192
|
+
const flash = (next) => {
|
|
193
|
+
setStatus(next);
|
|
194
|
+
clearTimeout(timer.current);
|
|
195
|
+
timer.current = setTimeout(() => setStatus('idle'), 1600);
|
|
196
|
+
};
|
|
197
|
+
const onOpen = (event) => {
|
|
198
|
+
event.stopPropagation();
|
|
199
|
+
try {
|
|
200
|
+
openFile?.(path);
|
|
201
|
+
flash('opened');
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
// fallback
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const onReveal = (event) => {
|
|
208
|
+
event.stopPropagation();
|
|
209
|
+
try {
|
|
210
|
+
if (revealFile) {
|
|
211
|
+
revealFile(path);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
openFile?.(dirname(path));
|
|
215
|
+
}
|
|
216
|
+
flash('revealed');
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
// fallback
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const onCopy = (event) => {
|
|
223
|
+
event.stopPropagation();
|
|
224
|
+
try {
|
|
225
|
+
void navigator.clipboard?.writeText(path);
|
|
226
|
+
flash('copied');
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
// fallback
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
const name = basename(path);
|
|
233
|
+
const folder = dirname(path);
|
|
234
|
+
return (_jsxs("div", { className: css.deliverableChip, "data-status": status, title: path, children: [_jsxs("button", { type: "button", className: css.chipMain, onClick: onOpen, onDoubleClick: onOpen, "aria-label": `直接在编辑器中打开 ${path}`, children: [status === 'opened' ? (_jsx("svg", { className: css.statusIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M3.5 8.5l3 3 6-7", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) })) : (_jsxs("svg", { className: css.deliverableIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("path", { d: "M4 2.5h5l3 3V13.5H4V2.5z", strokeWidth: "1.2", strokeLinejoin: "round" }), _jsx("path", { d: "M9 2.5v3h3", strokeWidth: "1.2", strokeLinejoin: "round" })] })), _jsx("span", { className: css.deliverableName, children: status === 'opened' ? '已在外部打开' : name })] }), _jsxs("div", { className: css.chipActions, "aria-label": "\u6587\u4EF6\u64CD\u4F5C", children: [_jsx("button", { type: "button", className: css.chipActionBtn, title: `在访达中定位所在目录 (${folder})`, "aria-label": "\u5728\u8BBF\u8FBE\u4E2D\u663E\u793A\u6240\u5728\u76EE\u5F55", onClick: onReveal, children: status === 'revealed' ? (_jsx("svg", { className: css.actionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M3.5 8.5l3 3 6-7", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) })) : (_jsx("svg", { className: css.actionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M2 4.5h4l1.5 2H14v6.5H2V4.5z", strokeWidth: "1.2", strokeLinejoin: "round" }) })) }), _jsx("button", { type: "button", className: css.chipActionBtn, title: "\u590D\u5236\u76F8\u5BF9\u8DEF\u5F84", "aria-label": "\u590D\u5236\u76F8\u5BF9\u8DEF\u5F84", onClick: onCopy, children: status === 'copied' ? (_jsx("svg", { className: css.actionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M3.5 8.5l3 3 6-7", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) })) : (_jsxs("svg", { className: css.actionIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: [_jsx("rect", { x: "5.5", y: "5.5", width: "8", height: "8", rx: "1.5", strokeWidth: "1.2" }), _jsx("path", { d: "M4 10.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v1", strokeWidth: "1.2", strokeLinecap: "round" })] })) })] })] }));
|
|
235
|
+
});
|
|
236
|
+
function DeliverablesRow({ deliverables, openFile, revealFile }) {
|
|
237
|
+
const [folderStatus, setFolderStatus] = useState('idle');
|
|
238
|
+
const onOpenWorkspace = () => {
|
|
239
|
+
try {
|
|
240
|
+
openFile?.('.');
|
|
241
|
+
setFolderStatus('opened');
|
|
242
|
+
setTimeout(() => setFolderStatus('idle'), 1600);
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
// ignore
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
return (_jsxs("div", { className: css.deliverablesRoot, "data-reader-deliverables": true, children: [_jsx("span", { className: css.deliverablesLabel, children: "\u4EA7\u7269" }), _jsx("div", { className: css.deliverablesLane, children: _jsxs("div", { className: css.deliverablesRow, children: [deliverables.slice(0, 8).map(path => (_jsx(DeliverableChip, { path: path, openFile: openFile, revealFile: revealFile }, path))), deliverables.length > 8 && (_jsxs("span", { className: css.deliverablesMore, children: ["+ ", deliverables.length - 8, " \u4E2A\u6587\u4EF6"] })), deliverables.length > 1 && (_jsxs("button", { type: "button", className: css.deliverablesShowFolder, "data-status": folderStatus, onClick: onOpenWorkspace, title: "\u5728\u8BBF\u8FBE\u4E2D\u6253\u5F00\u6574\u4E2A\u5DE5\u4F5C\u533A\u76EE\u5F55", children: [folderStatus === 'opened' && (_jsx("svg", { className: css.statusIcon, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", children: _jsx("path", { d: "M3.5 8.5l3 3 6-7", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) })), _jsx("span", { children: folderStatus === 'opened' ? '已打开访达' : '在文件夹中显示' })] }))] }) })] }));
|
|
249
|
+
}
|
|
250
|
+
const TurnGroup = memo(function TurnGroup({ group, motion, autoFold, pinnedKeys, selectedProcessKeys, isAwaitingModel = false, ...props }) {
|
|
251
|
+
const snapshot = props.useChat(snapshot => snapshot);
|
|
252
|
+
const nodes = snapshot.nodes;
|
|
253
|
+
const turn = group.turn === null ? undefined : snapshot.timeline.turns.get(group.turn);
|
|
254
|
+
const interaction = props.useSessionPendingInteraction(snapshot => snapshot.get(props.sessionId));
|
|
255
|
+
const sessionRunning = props.useSession(snapshot => snapshot.running);
|
|
256
|
+
const boundary = useMemo(() => boundaryOf(turn), [turn]);
|
|
257
|
+
const choiceKey = processChoiceKey(group.key, boundary);
|
|
258
|
+
const expansionChoice = props.useStore(state => state.expanded[choiceKey]);
|
|
259
|
+
const flowId = useId();
|
|
260
|
+
const processButton = useRef(null);
|
|
261
|
+
const setExpanded = useCallback((value) => props.actions.setExpanded(choiceKey, value), [props.actions, choiceKey]);
|
|
262
|
+
const pinProcess = useCallback(() => setExpanded(true), [setExpanded]);
|
|
263
|
+
const firstKind = props.useChat(snapshot => snapshot.nodes.get(group.keys[0])?.kind);
|
|
264
|
+
const startsWithUser = firstKind === 'user';
|
|
265
|
+
const mainKeys = startsWithUser ? group.keys.slice(1) : group.keys;
|
|
266
|
+
const flow = useMemo(() => readerFlow({ ...group, keys: mainKeys }, turn, key => nodes.get(key)), [nodes, group, mainKeys, turn]);
|
|
267
|
+
const steps = useMemo(() => segmentLiveTurn(flow, key => nodes.get(key)), [flow, nodes]);
|
|
268
|
+
const liveItems = useMemo(() => presentLiveTurn(steps, boundary, autoFold), [steps, boundary, autoFold]);
|
|
269
|
+
const hasProcess = flow.some(item => item.kind === 'tool' || hasProcessContent(nodes.get(item.nodeKey), boundary));
|
|
270
|
+
// Only a real, still-active text selection delays folding. Merely clicking,
|
|
271
|
+
// focusing or scrolling the live card does not create a permanent override.
|
|
272
|
+
const holdingSelection = selectedProcessKeys.some(key => flow.some(item => item.key === key)
|
|
273
|
+
|| liveItems.some(item => item.kind === 'fold'
|
|
274
|
+
? item.key === key || item.steps.some(step => step.key === key || ('nodeKey' in step && step.nodeKey === key))
|
|
275
|
+
: item.key === key || ('nodeKey' in item.step && item.step.nodeKey === key)));
|
|
276
|
+
const expanded = holdingSelection || processExpanded(expansionChoice, boundary);
|
|
277
|
+
const [foldOpenByKey, setFoldOpenByKey] = useState({});
|
|
278
|
+
const deliverables = useMemo(() => getTurnDeliverables(turn, flow), [turn, flow]);
|
|
279
|
+
const fileMentions = useMemo(() => deliverables.length > 0 && props.openFile ? createProducedFileMentions(deliverables, props.openFile) : undefined, [deliverables, props.openFile]);
|
|
280
|
+
const tailData = useMemo(() => {
|
|
281
|
+
for (const key of group.keys) {
|
|
282
|
+
const n = nodes.get(key);
|
|
283
|
+
if (n && isNode(n, 'turn-tail'))
|
|
284
|
+
return n.data;
|
|
285
|
+
}
|
|
286
|
+
return undefined;
|
|
287
|
+
}, [group.keys, nodes]);
|
|
288
|
+
const runMs = turn?.start && turn?.end ? Math.max(0, turn.end.time - turn.start.time) : undefined;
|
|
289
|
+
const metrics = useMemo(() => ({
|
|
290
|
+
usage: tailData?.tokenUsage,
|
|
291
|
+
runMs,
|
|
292
|
+
tokensPerSecond: tailData?.tokensPerSecond,
|
|
293
|
+
ttftMs: tailData?.ttftMs,
|
|
294
|
+
endedAt: tailData?.closing?.time ?? turn?.end?.time,
|
|
295
|
+
}), [tailData, runMs, turn?.end?.time]);
|
|
296
|
+
const forkSeq = forkAnchorSeq([tailData?.closing?.finalNode]);
|
|
297
|
+
const presentation = useMemo(() => {
|
|
298
|
+
// ChatNodeStore exposes live keyed readers. Materialize this turn instead of
|
|
299
|
+
// retaining a live get() function and mistakenly calling it a frozen frame.
|
|
300
|
+
const captured = new Map(group.keys.flatMap(key => {
|
|
301
|
+
const node = nodes.get(key);
|
|
302
|
+
return node ? [[key, node]] : [];
|
|
303
|
+
}));
|
|
304
|
+
return { items: holdingSelection ? presentLiveTurn(steps, boundary, false) : liveItems,
|
|
305
|
+
snapshot: { ...snapshot, nodes: { ...nodes, get: (key) => captured.get(key), values: () => [...captured.values()] } } };
|
|
306
|
+
}, [snapshot, nodes, group, steps, boundary, liveItems, holdingSelection]);
|
|
307
|
+
const shared = {
|
|
308
|
+
useChat: useFlowChat,
|
|
309
|
+
renderSlotChain: props.renderSlotChain,
|
|
310
|
+
loadImage: props.loadImage,
|
|
311
|
+
fillComposer: props.fillComposer,
|
|
312
|
+
openFile: props.openFile,
|
|
313
|
+
revealFile: props.revealFile,
|
|
314
|
+
forkAt: props.forkAt,
|
|
315
|
+
forkSeq,
|
|
316
|
+
fileMentions,
|
|
317
|
+
metrics,
|
|
318
|
+
};
|
|
319
|
+
const terminal = terminalLabel(boundary.reason);
|
|
320
|
+
const hasTurnError = flow.some(item => item.kind === 'node' && nodes.get(item.nodeKey)?.kind === 'turn-error');
|
|
321
|
+
const showTerminalNotice = terminal && !hasTurnError && boundary.reason !== 'interrupted' && boundary.reason !== 'aborted';
|
|
322
|
+
const renderStep = (step, folded) => {
|
|
323
|
+
const processOpen = folded || expanded;
|
|
324
|
+
if (step.kind === 'reasoning' || step.kind === 'body')
|
|
325
|
+
return _jsx(BlockBoundary, { children: _jsx(AssistantNode, { ...shared, boundary: boundary, nodeKey: step.nodeKey, partStart: step.start, pinned: pinnedKeys.includes(step.nodeKey), processOpen: processOpen, folded: folded, motion: motion, onRead: pinProcess, returnFocusTo: processButton }) });
|
|
326
|
+
if (step.kind === 'tool')
|
|
327
|
+
return _jsx(BlockBoundary, { children: _jsxs(ProcessFragment, { open: processOpen, motion: motion, onRead: pinProcess, returnFocusTo: processButton, nodeKey: step.key, framed: true, children: [_jsx(ToolActivity, { ...shared, entry: step.entry, motion: motion, turnClosed: boundary.status === 'closed', onRead: pinProcess }), step.entry.block && _jsx(ToolMedia, { ...shared, block: step.entry.block })] }) });
|
|
328
|
+
if (step.kind === 'user')
|
|
329
|
+
return _jsx(BlockBoundary, { children: _jsx(MainNode, { ...shared, boundary: boundary, nodeKey: step.nodeKey }) });
|
|
330
|
+
return _jsxs(Fragment, { children: [_jsx(BlockBoundary, { children: _jsx(ProcessNode, { useChat: useFlowChat, t: props.t, nodeKey: step.nodeKey, open: processOpen, motion: motion, onRead: pinProcess, returnFocusTo: processButton }) }), _jsx(BlockBoundary, { children: _jsx(MainNode, { ...shared, boundary: boundary, nodeKey: step.nodeKey, pinned: pinnedKeys.includes(step.nodeKey), processOpen: processOpen }) })] });
|
|
331
|
+
};
|
|
332
|
+
return _jsxs("section", { className: css.turn, "data-reader-turn": group.turn ?? 'unresolved', "data-reader-turn-state": boundary.status, "data-reader-turn-result": boundary.reason ?? undefined, children: [startsWithUser && _jsx(BlockBoundary, { children: _jsx(MainNode, { ...shared, useChat: props.useChat, boundary: boundary, nodeKey: group.keys[0] }) }), hasProcess && !isAwaitingModel && _jsx(StickyLane, { kind: "status", className: css.turnProcessSticky, children: _jsx(Disclosure, { open: expanded, onChange: setExpanded, controls: flowId, buttonRef: processButton, label: _jsx(GroupStatus, { group: group, sessionId: props.sessionId, useChat: props.useChat, useSessionPendingInteraction: props.useSessionPendingInteraction, motion: motion }) }) }), boundary.status === 'closed' && hasProcess && _jsx(ClosedProcessSummary, { open: expanded, onChange: setExpanded, controls: flowId, steps: steps.filter(step => {
|
|
333
|
+
if (step.kind === 'user')
|
|
334
|
+
return false;
|
|
335
|
+
if (step.kind !== 'body')
|
|
336
|
+
return true;
|
|
337
|
+
const node = nodes.get(step.nodeKey);
|
|
338
|
+
return !!node && isNode(node, 'assistant-step') && (isEarlierNarration(node.data, boundary)
|
|
339
|
+
|| node.data.blocks.some(block => block.kind === 'tool-call')
|
|
340
|
+
|| (boundary.latestStep > 0 && node.data.step < boundary.latestStep));
|
|
341
|
+
}) }), _jsx(ChoreographedFlow, { id: flowId, frame: presentation, motion: motion, enabled: autoFold && boundary.status === 'open' && !holdingSelection, urgent: hasTurnError || interaction !== undefined || !sessionRunning, open: foldOpenByKey, processOpen: expanded, onOpenChange: (key, value) => { pinProcess(); setFoldOpenByKey(current => ({ ...current, [key]: value })); }, renderStep: renderStep }), !hasProcess && boundary.status === 'open' && !isAwaitingModel && _jsx("div", { className: css.disclosure, "data-reader-status-only": true, children: _jsx(GroupStatus, { group: group, sessionId: props.sessionId, useChat: props.useChat, useSessionPendingInteraction: props.useSessionPendingInteraction, motion: motion }) }), showDeliverablesRow(boundary.status, deliverables) && _jsx(DeliverablesRow, { deliverables: deliverables, openFile: props.openFile, revealFile: props.revealFile }), showTerminalNotice && _jsx("div", { className: css.notice, "data-reader-terminal": true, children: terminal })] });
|
|
342
|
+
});
|
|
343
|
+
export function Reader(props) {
|
|
344
|
+
const root = useRef(null);
|
|
345
|
+
const activatedAt = useRef(Date.now());
|
|
346
|
+
const order = props.useChat(snapshot => snapshot.order);
|
|
347
|
+
const nodes = props.useChat(snapshot => snapshot.nodes);
|
|
348
|
+
const timeline = props.useChat(snapshot => snapshot.timeline);
|
|
349
|
+
const running = props.useSession(snapshot => snapshot.running);
|
|
350
|
+
const pending = props.useSessionPendingInteraction(snapshot => snapshot.get(props.sessionId));
|
|
351
|
+
const openError = props.useSession(snapshot => snapshot.openError);
|
|
352
|
+
const loading = props.useSession(snapshot => snapshot.openState === 'loading');
|
|
353
|
+
const hasMore = props.useSession(snapshot => snapshot.hasMore);
|
|
354
|
+
const loadingOlder = props.useSession(snapshot => snapshot.loadingOlder);
|
|
355
|
+
const pendingSubmissions = props.useSession(snapshot => snapshot.pendingSubmissions);
|
|
356
|
+
const waitAnchor = waitingAnchor(order, key => nodes.get(key), pendingSubmissions);
|
|
357
|
+
const motionPreference = props.useStore(state => state.motion);
|
|
358
|
+
const motion = useMotionAllowed(motionPreference);
|
|
359
|
+
const autoFold = props.useStore(state => state.autoFold ?? true);
|
|
360
|
+
const streamMotion = useMemo(() => ({ enabled: motion, activatedAt: activatedAt.current }), [motion]);
|
|
361
|
+
const groups = useMemo(() => groupNodes(order, key => nodes.get(key)), [order, nodes, timeline]);
|
|
362
|
+
const isAwaitingModel = useMemo(() => {
|
|
363
|
+
// 状态机铁律:「深度求索中」与「正在处理/思考」永远互斥。
|
|
364
|
+
// 1. 仅空闲发送(!running)的本地回显窗口:用户按下回车第 0 毫秒立即反馈。
|
|
365
|
+
// 忙碌时的 queued/steering 回显不算等待——模型本来就在工作。
|
|
366
|
+
if (!running && pendingSubmissions && pendingSubmissions.length > 0)
|
|
367
|
+
return true;
|
|
368
|
+
const lastKey = order.at(-1);
|
|
369
|
+
const lastNode = lastKey ? nodes.get(lastKey) : undefined;
|
|
370
|
+
const lastIsUser = lastNode?.kind === 'user' || lastNode?.kind === 'steering';
|
|
371
|
+
// 2. 最后一个节点是用户发言(含补发消息):检查该用户节点**之后**是否已有模型产出。
|
|
372
|
+
// 之前用 slice(1) 是 Bug——补发消息在组中部,前面的旧输出会让等待永远不出现。
|
|
373
|
+
if (lastIsUser && lastKey) {
|
|
374
|
+
const lastGroup = groups.at(-1);
|
|
375
|
+
const turn = lastGroup?.turn === null || lastGroup?.turn === undefined ? undefined : timeline.turns.get(lastGroup.turn);
|
|
376
|
+
if (turn?.status === 'closed')
|
|
377
|
+
return false;
|
|
378
|
+
const keys = lastGroup?.keys ?? [];
|
|
379
|
+
const userIdx = keys.lastIndexOf(lastKey);
|
|
380
|
+
const hasOutputAfter = keys.slice(userIdx + 1).some(key => {
|
|
381
|
+
const node = nodes.get(key);
|
|
382
|
+
if (!node || node.visibility === 'hidden')
|
|
383
|
+
return false;
|
|
384
|
+
if (node.kind === 'assistant-step') {
|
|
385
|
+
const data = node.data;
|
|
386
|
+
return Array.isArray(data.blocks) && data.blocks.length > 0;
|
|
387
|
+
}
|
|
388
|
+
return node.kind === 'tool-call' || node.kind === 'tool-return' || node.kind === 'command-input';
|
|
389
|
+
});
|
|
390
|
+
return !hasOutputAfter;
|
|
391
|
+
}
|
|
392
|
+
// 3. assistant-step 已创建但一个 block 都没有:模型收到请求、内容未吐出的瞬间。
|
|
393
|
+
if (lastNode?.kind === 'assistant-step') {
|
|
394
|
+
const data = lastNode.data;
|
|
395
|
+
if (data.status === 'running' && (!data.blocks || data.blocks.length === 0)) {
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return false;
|
|
400
|
+
}, [running, pendingSubmissions, order, nodes, groups, timeline]);
|
|
401
|
+
const scroll = useReadingScroll(root, motion);
|
|
402
|
+
const pinnedKeys = usePinnedSelection(root);
|
|
403
|
+
const selectedProcessKeys = usePinnedSelection(root, '[data-reader-process]');
|
|
404
|
+
const [historyError, setHistoryError] = useState(false);
|
|
405
|
+
// 1. Navigation items from Chat snapshot
|
|
406
|
+
const turnNavigationItems = props.useChat(snapshot => snapshot.navigation?.items ? snapshot.navigation.items() : undefined);
|
|
407
|
+
// 2. Whole-log turn outline projection
|
|
408
|
+
const turnOutline = props.useProjection?.('turnOutline');
|
|
409
|
+
// 3. Track turns with deliverables
|
|
410
|
+
const turnsWithDeliverables = useMemo(() => {
|
|
411
|
+
const set = new Set();
|
|
412
|
+
for (const [turnNum, loc] of timeline.turns) {
|
|
413
|
+
const deliv = loc.data?.get('deliverables');
|
|
414
|
+
if (Array.isArray(deliv?.produced) && deliv.produced.length > 0) {
|
|
415
|
+
set.add(turnNum);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return set;
|
|
419
|
+
}, [timeline]);
|
|
420
|
+
// 4. Merged timeline items for the rail
|
|
421
|
+
const timelineItems = useMemo(() => mergeTimelineItems(turnNavigationItems, turnOutline, turnsWithDeliverables), [turnNavigationItems, turnOutline, turnsWithDeliverables]);
|
|
422
|
+
// 5. Active & busy turn tracking
|
|
423
|
+
const [activeTurn, setActiveTurn] = useState(null);
|
|
424
|
+
const [busyTurn, setBusyTurn] = useState(null);
|
|
425
|
+
// Scroll spy to update activeTurn
|
|
426
|
+
useEffect(() => {
|
|
427
|
+
const el = root.current;
|
|
428
|
+
if (!el)
|
|
429
|
+
return;
|
|
430
|
+
const scroller = el.closest('[data-conversation-scroll]') ?? el;
|
|
431
|
+
let ticking = false;
|
|
432
|
+
const updateActive = () => {
|
|
433
|
+
if (ticking)
|
|
434
|
+
return;
|
|
435
|
+
ticking = true;
|
|
436
|
+
requestAnimationFrame(() => {
|
|
437
|
+
ticking = false;
|
|
438
|
+
const line = (scroller instanceof HTMLElement ? scroller.clientHeight : window.innerHeight) * 0.35;
|
|
439
|
+
const turnRows = el.querySelectorAll('[data-reader-turn]:not([data-reader-turn="unresolved"])');
|
|
440
|
+
let current = null;
|
|
441
|
+
for (const row of turnRows) {
|
|
442
|
+
const rect = row.getBoundingClientRect();
|
|
443
|
+
if (rect.top <= line) {
|
|
444
|
+
const num = Number(row.dataset.readerTurn);
|
|
445
|
+
if (Number.isSafeInteger(num))
|
|
446
|
+
current = num;
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
break;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
if (current !== null) {
|
|
453
|
+
setActiveTurn(current);
|
|
454
|
+
}
|
|
455
|
+
else if (turnRows.length > 0) {
|
|
456
|
+
const first = Number(turnRows[0].dataset.readerTurn);
|
|
457
|
+
if (Number.isSafeInteger(first))
|
|
458
|
+
setActiveTurn(first);
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
scroller.addEventListener('scroll', updateActive, { passive: true });
|
|
463
|
+
updateActive();
|
|
464
|
+
return () => scroller.removeEventListener('scroll', updateActive);
|
|
465
|
+
}, [groups]);
|
|
466
|
+
// Navigation handler (supports loaded jump & unloaded loadThrough).
|
|
467
|
+
// Land on the conversation scroller only — scrollIntoView also moves
|
|
468
|
+
// ancestor boxes and can lift the sticky composer after a top→bottom jump.
|
|
469
|
+
const onNavigateTurn = useCallback(async (item) => {
|
|
470
|
+
const el = root.current;
|
|
471
|
+
if (!el)
|
|
472
|
+
return;
|
|
473
|
+
const port = scrollerOf(el);
|
|
474
|
+
const reveal = (turn) => {
|
|
475
|
+
const targetRow = el.querySelector(`[data-reader-turn="${turn}"]`);
|
|
476
|
+
if (!targetRow)
|
|
477
|
+
return;
|
|
478
|
+
const last = timelineItems.at(-1);
|
|
479
|
+
if (last !== undefined && last.turn === turn) {
|
|
480
|
+
scroll.jump();
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
scroll.release();
|
|
484
|
+
landTurn(targetRow, port);
|
|
485
|
+
}
|
|
486
|
+
setActiveTurn(turn);
|
|
487
|
+
};
|
|
488
|
+
if (item.anchor.kind === 'loaded') {
|
|
489
|
+
reveal(item.turn);
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
setBusyTurn(item.turn);
|
|
493
|
+
try {
|
|
494
|
+
if (props.loadThrough) {
|
|
495
|
+
await props.loadThrough(item.anchor.seq);
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
await props.loadOlder();
|
|
499
|
+
}
|
|
500
|
+
setTimeout(() => { reveal(item.turn); }, 50);
|
|
501
|
+
}
|
|
502
|
+
finally {
|
|
503
|
+
setBusyTurn(null);
|
|
504
|
+
}
|
|
505
|
+
}, [props.loadThrough, props.loadOlder, scroll.jump, scroll.release, timelineItems]);
|
|
506
|
+
const lastKey = order.at(-1);
|
|
507
|
+
const lastNode = lastKey ? nodes.get(lastKey) : undefined;
|
|
508
|
+
const lastSubmissionId = pendingSubmissions?.length ? pendingSubmissions[pendingSubmissions.length - 1].requestId : null;
|
|
509
|
+
const lastOrderKeyRef = useRef(lastKey);
|
|
510
|
+
const lastSubmissionRef = useRef(lastSubmissionId);
|
|
511
|
+
useLayoutEffect(() => {
|
|
512
|
+
const appendedUser = lastKey !== lastOrderKeyRef.current && (lastNode?.kind === 'user' || lastNode?.kind === 'steering');
|
|
513
|
+
const appendedSubmission = lastSubmissionId !== null && lastSubmissionId !== lastSubmissionRef.current;
|
|
514
|
+
lastOrderKeyRef.current = lastKey;
|
|
515
|
+
lastSubmissionRef.current = lastSubmissionId;
|
|
516
|
+
if (appendedUser || appendedSubmission) {
|
|
517
|
+
scroll.jump();
|
|
518
|
+
}
|
|
519
|
+
}, [lastKey, lastNode?.kind, lastSubmissionId, scroll]);
|
|
520
|
+
const visibleSubmissions = useMemo(() => {
|
|
521
|
+
if (!pendingSubmissions || pendingSubmissions.length === 0)
|
|
522
|
+
return [];
|
|
523
|
+
return pendingSubmissions.filter(sub => sub.placement !== 'queued');
|
|
524
|
+
}, [pendingSubmissions]);
|
|
525
|
+
// ChatView publishes data-chat-flow="" on its column. Skins treat a
|
|
526
|
+
// scrollport without that hook as inspect-only and hide [data-composer-seat].
|
|
527
|
+
return _jsx(StreamMotionContext.Provider, { value: streamMotion, children: _jsxs("div", { ref: root, className: css.root, "data-dsh-better-display": "0.1.1", "data-reader-wait-clock-version": "input-v1", "data-reader-wait-start": waitAnchor.time ?? undefined, "data-motion": motion ? 'on' : 'off', children: [_jsx(TimelineRail, { items: timelineItems, activeTurn: activeTurn, busyTurn: busyTurn, onNavigate: onNavigateTurn }), _jsxs("div", { className: css.column, "data-chat-flow": "", children: [_jsx(StickyLane, { kind: "toolbar", className: css.toolbar, children: _jsx("button", { type: "button", className: css.textButton, "aria-pressed": autoFold, onClick: () => props.actions.setAutoFold(!autoFold), title: "\u65B0\u601D\u8003\u4EA7\u751F\u65F6\uFF0C\u662F\u5426\u81EA\u52A8\u5C06\u6B64\u524D\u6B65\u9AA4\u6536\u62E2\u4E3A\u4E00\u884C\u6C47\u603B\u3002\u5173\u95ED\u540E\u5B8C\u6574\u4FDD\u7559\u539F\u59CB\u8FC7\u7A0B\u4E0E\u6D41\u5F0F\u8F93\u51FA\u3002", children: `自动折叠${autoFold ? '开' : '关'}` }) }), hasMore && _jsx("button", { type: "button", className: css.historyButton, disabled: loadingOlder, onClick: async () => {
|
|
528
|
+
setHistoryError(false);
|
|
529
|
+
try {
|
|
530
|
+
await props.loadOlder();
|
|
531
|
+
}
|
|
532
|
+
catch {
|
|
533
|
+
setHistoryError(true);
|
|
534
|
+
}
|
|
535
|
+
}, children: loadingOlder ? '正在加载更早记录' : '加载更早记录' }), historyError && _jsx("div", { className: css.notice, children: "\u5386\u53F2\u8BB0\u5F55\u52A0\u8F7D\u5931\u8D25\uFF0C\u53EF\u518D\u6B21\u5C1D\u8BD5\uFF1B\u73B0\u6709\u5185\u5BB9\u672A\u6539\u53D8\u3002" }), openError && _jsxs("div", { className: css.error, role: "alert", children: ["\u4F1A\u8BDD\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\uFF1A", openError.message] }), loading && groups.length === 0 && _jsx("p", { className: css.empty, role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u4F1A\u8BDD\u2026" }), groups.map(group => _jsx(TurnGroup, { ...props, group: group, motion: motion, autoFold: autoFold, pinnedKeys: pinnedKeys, selectedProcessKeys: selectedProcessKeys, isAwaitingModel: isAwaitingModel && group.key === groups.at(-1)?.key }, group.key)), visibleSubmissions.map(submission => (_jsxs("div", { className: css.userCluster, "data-reader-pending-submission": true, children: [submission.attachments.some(item => item.type === 'image') && (_jsx("div", { className: css.userImages, children: submission.attachments.map((item, idx) => item.type === 'image' ? (_jsx("figure", { className: css.imageFigure, children: _jsx("div", { className: css.imageFrame, style: { aspectRatio: `${item.value.width || 4} / ${item.value.height || 3}` }, children: _jsx("img", { src: item.value.previewUrl, alt: item.value.name ?? '发送的图片', className: css.pendingImage }) }) }, idx)) : null) })), submission.text ? (_jsx("div", { className: css.user, children: _jsx("div", { className: css.blocks, children: submission.text }) })) : null, _jsx(UserMessageActions, { text: submission.text, time: submission.time })] }, submission.requestId))), isAwaitingModel && _jsx(WaitingStatus, { anchor: waitAnchor, label: props.t ? props.t('chat.deepDiving') : '深度求索中...' }), pending !== undefined && _jsxs("div", { className: css.attention, role: "alert", "data-reader-attention": true, children: [_jsx("strong", { children: pending.kind === 'question' ? '需要你回答一个问题' : '需要你的确认' }), _jsx("span", { children: "\u8BF7\u5728\u4E0B\u65B9\u539F\u751F\u64CD\u4F5C\u533A\u5904\u7406\u3002\u6B64\u63D0\u793A\u4E0D\u4F1A\u6536\u8FDB\u6267\u884C\u8FC7\u7A0B\u3002" })] }), scroll.detached && _jsx("div", { className: css.jumpDock, children: _jsx("button", { type: "button", className: css.jump, "aria-label": "\u56DE\u5230\u5E95\u90E8", title: "\u56DE\u5230\u5E95\u90E8", onClick: scroll.jump, children: _jsx("svg", { viewBox: "0 0 14 14", width: "14", height: "14", "aria-hidden": "true", children: _jsx("path", { d: "M3 5.5 7 9.5 11 5.5", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }) }) }) })] })] }) });
|
|
536
|
+
}
|
|
537
|
+
//# sourceMappingURL=Reader.js.map
|