@drscrewdriver/dsh-better-display 0.3.3-fork.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 +259 -0
- package/DESIGN.md +72 -0
- package/LICENSE +24 -0
- package/README.en.md +55 -0
- package/README.md +55 -0
- package/THIRD_PARTY_NOTICES.md +65 -0
- package/compat/harness-rc2.json +99 -0
- package/cordis.patch.yml +5 -0
- package/cordis.yml +4 -0
- package/docs/official-rendering-bridge.md +65 -0
- package/dshx.yml +5 -0
- package/lib/client.js +49292 -0
- package/lib/client.js.map +1 -0
- package/lib/dsh-better-display.js +101 -0
- package/lib/types/client/Blocks.d.ts +49 -0
- package/lib/types/client/Blocks.d.ts.map +1 -0
- package/lib/types/client/Blocks.js +143 -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 +218 -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 +16 -0
- package/lib/types/client/ClosedProcessSummary.js.map +1 -0
- package/lib/types/client/DiffPanel.d.ts +13 -0
- package/lib/types/client/DiffPanel.d.ts.map +1 -0
- package/lib/types/client/DiffPanel.js +115 -0
- package/lib/types/client/DiffPanel.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/OfficialContent.d.ts +25 -0
- package/lib/types/client/OfficialContent.d.ts.map +1 -0
- package/lib/types/client/OfficialContent.js +53 -0
- package/lib/types/client/OfficialContent.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 +603 -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 +322 -0
- package/lib/types/client/ReasoningCard.js.map +1 -0
- package/lib/types/client/SettingsSection.d.ts +37 -0
- package/lib/types/client/SettingsSection.d.ts.map +1 -0
- package/lib/types/client/SettingsSection.js +63 -0
- package/lib/types/client/SettingsSection.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 +39 -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 +244 -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/WaitClock.d.ts +16 -0
- package/lib/types/client/WaitClock.d.ts.map +1 -0
- package/lib/types/client/WaitClock.js +29 -0
- package/lib/types/client/WaitClock.js.map +1 -0
- package/lib/types/client/WaitingClock.d.ts +15 -0
- package/lib/types/client/WaitingClock.d.ts.map +1 -0
- package/lib/types/client/WaitingClock.js +30 -0
- package/lib/types/client/WaitingClock.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 +9 -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 +40 -0
- package/lib/types/client/fold-choreography.d.ts.map +1 -0
- package/lib/types/client/fold-choreography.js +48 -0
- package/lib/types/client/fold-choreography.js.map +1 -0
- package/lib/types/client/fold-intensity.d.ts +11 -0
- package/lib/types/client/fold-intensity.d.ts.map +1 -0
- package/lib/types/client/fold-intensity.js +32 -0
- package/lib/types/client/fold-intensity.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 +195 -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 +190 -0
- package/lib/types/client/live-turn.js.map +1 -0
- package/lib/types/client/markdown/MarkdownText.d.ts +41 -0
- package/lib/types/client/markdown/MarkdownText.d.ts.map +1 -0
- package/lib/types/client/markdown/MarkdownText.js +178 -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 +121 -0
- package/lib/types/client/markdown/render.d.ts.map +1 -0
- package/lib/types/client/markdown/render.js +452 -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 +453 -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 +35 -0
- package/lib/types/client/native/ContextInjectionRow.d.ts.map +1 -0
- package/lib/types/client/native/ContextInjectionRow.js +42 -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/native/tool-update.d.ts +23 -0
- package/lib/types/client/native/tool-update.d.ts.map +1 -0
- package/lib/types/client/native/tool-update.js +22 -0
- package/lib/types/client/native/tool-update.js.map +1 -0
- package/lib/types/client/official-slots.d.ts +71 -0
- package/lib/types/client/official-slots.d.ts.map +1 -0
- package/lib/types/client/official-slots.js +183 -0
- package/lib/types/client/official-slots.js.map +1 -0
- package/lib/types/client/open-file.d.ts +29 -0
- package/lib/types/client/open-file.d.ts.map +1 -0
- package/lib/types/client/open-file.js +71 -0
- package/lib/types/client/open-file.js.map +1 -0
- package/lib/types/client/pending-submission.d.ts +28 -0
- package/lib/types/client/pending-submission.d.ts.map +1 -0
- package/lib/types/client/pending-submission.js +28 -0
- package/lib/types/client/pending-submission.js.map +1 -0
- package/lib/types/client/platform-media.d.ts +6 -0
- package/lib/types/client/platform-media.d.ts.map +1 -0
- package/lib/types/client/platform-media.js +18 -0
- package/lib/types/client/platform-media.js.map +1 -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 +38 -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 +10 -0
- package/lib/types/client/reasoning-follow.d.ts.map +1 -0
- package/lib/types/client/reasoning-follow.js +21 -0
- package/lib/types/client/reasoning-follow.js.map +1 -0
- package/lib/types/client/resource-address.d.ts +3 -0
- package/lib/types/client/resource-address.d.ts.map +1 -0
- package/lib/types/client/resource-address.js +33 -0
- package/lib/types/client/resource-address.js.map +1 -0
- package/lib/types/client/settings-copy.d.ts +7 -0
- package/lib/types/client/settings-copy.d.ts.map +1 -0
- package/lib/types/client/settings-copy.js +53 -0
- package/lib/types/client/settings-copy.js.map +1 -0
- package/lib/types/client/settings-slots.d.ts +23 -0
- package/lib/types/client/settings-slots.d.ts.map +1 -0
- package/lib/types/client/settings-slots.js +2 -0
- package/lib/types/client/settings-slots.js.map +1 -0
- package/lib/types/client/settings.d.ts +4 -0
- package/lib/types/client/settings.d.ts.map +1 -0
- package/lib/types/client/settings.js +60 -0
- package/lib/types/client/settings.js.map +1 -0
- package/lib/types/client/skill-status.d.ts +25 -0
- package/lib/types/client/skill-status.d.ts.map +1 -0
- package/lib/types/client/skill-status.js +44 -0
- package/lib/types/client/skill-status.js.map +1 -0
- package/lib/types/client/store.d.ts +35 -0
- package/lib/types/client/store.d.ts.map +1 -0
- package/lib/types/client/store.js +37 -0
- package/lib/types/client/store.js.map +1 -0
- package/lib/types/client/stream-buffer.d.ts +37 -0
- package/lib/types/client/stream-buffer.d.ts.map +1 -0
- package/lib/types/client/stream-buffer.js +150 -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 +84 -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 +98 -0
- package/lib/types/client/tool-activity.d.ts.map +1 -0
- package/lib/types/client/tool-activity.js +301 -0
- package/lib/types/client/tool-activity.js.map +1 -0
- package/lib/types/client/types.d.ts +91 -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 +49 -0
- package/lib/types/client/waiting-clock.d.ts.map +1 -0
- package/lib/types/client/waiting-clock.js +80 -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 +90 -0
- package/lib/types/client/word-motion.js.map +1 -0
- package/lib/types/client/word-timeline.d.ts +32 -0
- package/lib/types/client/word-timeline.d.ts.map +1 -0
- package/lib/types/client/word-timeline.js +119 -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 +93 -0
- package/lib/types/dsh-better-display.js.map +1 -0
- package/lib/types/skill-roots.d.ts +22 -0
- package/lib/types/skill-roots.d.ts.map +1 -0
- package/lib/types/skill-roots.js +126 -0
- package/lib/types/skill-roots.js.map +1 -0
- package/lib/types/skill-status.d.ts +36 -0
- package/lib/types/skill-status.d.ts.map +1 -0
- package/lib/types/skill-status.js +51 -0
- package/lib/types/skill-status.js.map +1 -0
- package/package.json +133 -0
- package/scripts/build-motion-fixture.mjs +26 -0
- package/scripts/check-harness-compat.mjs +71 -0
- package/scripts/link-harness-dependencies.mjs +54 -0
- package/scripts/verify-auto-fold.mjs +114 -0
- package/scripts/verify-official-bridge.mjs +121 -0
- package/scripts/verify-tool-shimmer.mjs +62 -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 +213 -0
- package/src/client/ChoreographedFlow.tsx +232 -0
- package/src/client/ClosedProcessSummary.tsx +23 -0
- package/src/client/DiffPanel.tsx +124 -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/OfficialContent.tsx +69 -0
- package/src/client/Reader.module.css +692 -0
- package/src/client/Reader.tsx +878 -0
- package/src/client/ReasoningCard.tsx +306 -0
- package/src/client/SettingsSection.module.css +184 -0
- package/src/client/SettingsSection.tsx +194 -0
- package/src/client/StickyLane.tsx +34 -0
- package/src/client/TimelineRail.module.css +170 -0
- package/src/client/TimelineRail.tsx +262 -0
- package/src/client/ToolActivity.tsx +274 -0
- package/src/client/TurnMetrics.module.css +139 -0
- package/src/client/TurnMetrics.tsx +160 -0
- package/src/client/WaitClock.tsx +33 -0
- package/src/client/WaitingStatus.tsx +13 -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 +55 -0
- package/src/client/fold-intensity.ts +36 -0
- package/src/client/index.tsx +222 -0
- package/src/client/live-turn.ts +198 -0
- package/src/client/markdown/MarkdownText.module.css +304 -0
- package/src/client/markdown/MarkdownText.tsx +195 -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 +647 -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 +410 -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 +66 -0
- package/src/client/native/ContextInjectionRow.tsx +106 -0
- package/src/client/native/ReferenceIcon.tsx +35 -0
- package/src/client/native/tool-call-model.ts +248 -0
- package/src/client/native/tool-update.ts +32 -0
- package/src/client/native/upstream.json +41 -0
- package/src/client/official-slots.tsx +211 -0
- package/src/client/open-file.ts +94 -0
- package/src/client/pending-submission.ts +49 -0
- package/src/client/platform-media.ts +17 -0
- package/src/client/primitive-labels.ts +54 -0
- package/src/client/projection.ts +118 -0
- package/src/client/reasoning-follow.ts +28 -0
- package/src/client/settings-copy.ts +80 -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 +75 -0
- package/src/client/stream-buffer.ts +136 -0
- package/src/client/streaming.tsx +70 -0
- package/src/client/style.d.ts +4 -0
- package/src/client/timeline.ts +77 -0
- package/src/client/tool-activity.ts +298 -0
- package/src/client/types.ts +89 -0
- package/src/client/waiting-clock.ts +83 -0
- package/src/client/word-motion.tsx +92 -0
- package/src/client/word-timeline.ts +113 -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-auto-fold.tsx +64 -0
- package/tests/browser-closed-gap.tsx +20 -0
- package/tests/browser-motion.tsx +65 -0
- package/tests/browser-official-bridge.tsx +152 -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/context-tool-update.test.ts +33 -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 +54 -0
- package/tests/fold-intensity.test.ts +94 -0
- package/tests/footer-precedence.test.ts +129 -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/official-slots.test.ts +112 -0
- package/tests/open-file.test.ts +114 -0
- package/tests/pending-submission.test.ts +45 -0
- package/tests/platform-media.test.ts +23 -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 +58 -0
- package/tests/stream-buffer.test.ts +102 -0
- package/tests/timeline.test.ts +59 -0
- package/tests/tool-diff.test.ts +57 -0
- package/tests/waiting-clock.test.ts +83 -0
- package/tests/word-timeline.test.ts +146 -0
- package/tsconfig.json +11 -0
- package/tsdown.config.ts +51 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"repository": "https://github.com/deepseek-ai/deepseek-harness",
|
|
3
|
+
"commit": "b150a551b8d465e31e418e1b2eaf5e79bbb7d28e",
|
|
4
|
+
"sha256BeforeAdaptation": {
|
|
5
|
+
"MarkdownText.tsx": "b0ce4cf0986cadf624436136186b16f108ed2365aec0350b195f02dae036017a",
|
|
6
|
+
"MarkdownText.module.css": "e226e878c45037b1cf537e4361f59e052ef979321593be3369bd31200d0342bc",
|
|
7
|
+
"render.tsx": "d4fefca41ab709526933e47144a01df14bd3d5619558cd6ed35b663d1640d779",
|
|
8
|
+
"parse.ts": "6be57559995c4e717d6d704207eb2fec86db9714c2a4bcc5b0c3f6648c8990f0",
|
|
9
|
+
"incremental.ts": "2975a332ac74b931a7cb489e2eea28469aa3d9596328d5a474d41379b6c7b640",
|
|
10
|
+
"cjkFriendlyStrong.ts": "bc4adf3183f7d0feea17e3a176e7c4b1db5bdddc29e7fc87261f627ff8a39b53",
|
|
11
|
+
"mathCompatibility.ts": "5f8cec86fd613fd2f67510e22b0a9d661f4173b3d49fb13fef71b25f4abb652b",
|
|
12
|
+
"katex.tsx": "8227e04d29333d2568021ed012143237b457852bce25d82cf394d72b941e74a5"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core pure functions for SEP-1865 / MCP Apps integration.
|
|
3
|
+
* Free of CSS module imports so it can be cleanly tested in Node test environments.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export function getHostTheme(): 'dark' | 'light' {
|
|
7
|
+
if (typeof document === 'undefined') return 'light';
|
|
8
|
+
if (document.body?.hasAttribute('data-ds-dark-theme')) return 'dark';
|
|
9
|
+
const colorScheme = document.documentElement?.style.colorScheme;
|
|
10
|
+
if (colorScheme === 'dark' || colorScheme === 'light') return colorScheme;
|
|
11
|
+
const dataTheme = document.documentElement?.getAttribute('data-theme') || document.body?.getAttribute('data-theme');
|
|
12
|
+
if (dataTheme === 'dark' || dataTheme === 'light') return dataTheme;
|
|
13
|
+
if (document.body?.classList.contains('dark') || document.documentElement?.classList.contains('dark')) return 'dark';
|
|
14
|
+
return typeof window !== 'undefined' && window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getCssTokens(theme: 'dark' | 'light'): Record<string, string> {
|
|
18
|
+
const isDark = theme === 'dark';
|
|
19
|
+
return {
|
|
20
|
+
'--background': isDark ? '#0f172a' : '#ffffff',
|
|
21
|
+
'--card': isDark ? '#1e293b' : '#f8fafc',
|
|
22
|
+
'--foreground': isDark ? '#f8fafc' : '#0f172a',
|
|
23
|
+
'--muted-foreground': isDark ? '#94a3b8' : '#64748b',
|
|
24
|
+
'--primary': '#2563eb',
|
|
25
|
+
'--primary-foreground': '#ffffff',
|
|
26
|
+
'--border': isDark ? '#334155' : '#e2e8f0',
|
|
27
|
+
'--hover': isDark ? 'rgba(148, 163, 184, 0.15)' : 'rgba(148, 163, 184, 0.12)',
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Extracts a title from the HTML document's <title> tag.
|
|
33
|
+
*/
|
|
34
|
+
export function extractHtmlTitle(html: string): string | undefined {
|
|
35
|
+
const match = /<title[^>]*>([^<]+)<\/title>/i.exec(html);
|
|
36
|
+
return match?.[1]?.trim();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Normalizes user/model generated HTML to ensure a valid HTML5 structure
|
|
41
|
+
* and embeds a dynamic theme listener so dark/light mode switches take effect immediately.
|
|
42
|
+
*/
|
|
43
|
+
export function ensureHtmlDocument(rawHtml: string, initialTheme: 'dark' | 'light' = 'light'): string {
|
|
44
|
+
const isDark = initialTheme === 'dark';
|
|
45
|
+
const trimmed = rawHtml.trim();
|
|
46
|
+
|
|
47
|
+
const themeScript = `<script>
|
|
48
|
+
(function() {
|
|
49
|
+
function applyTheme(theme) {
|
|
50
|
+
if (!theme) return;
|
|
51
|
+
document.documentElement.setAttribute('data-theme', theme);
|
|
52
|
+
document.documentElement.style.colorScheme = theme;
|
|
53
|
+
if (theme === 'dark') {
|
|
54
|
+
document.documentElement.classList.add('dark');
|
|
55
|
+
if (document.body) document.body.classList.add('dark');
|
|
56
|
+
} else {
|
|
57
|
+
document.documentElement.classList.remove('dark');
|
|
58
|
+
if (document.body) document.body.classList.remove('dark');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
applyTheme(${JSON.stringify(initialTheme)});
|
|
62
|
+
|
|
63
|
+
// Precise content-bottom measurement to avoid scrollHeight latching to iframe outer height
|
|
64
|
+
function reportHeight() {
|
|
65
|
+
var body = document.body;
|
|
66
|
+
if (!body) return;
|
|
67
|
+
var children = body.children;
|
|
68
|
+
var maxBottom = 0;
|
|
69
|
+
for (var i = 0; i < children.length; i++) {
|
|
70
|
+
var el = children[i];
|
|
71
|
+
if (el.tagName === 'SCRIPT' || el.tagName === 'STYLE' || el.tagName === 'LINK') continue;
|
|
72
|
+
var style = window.getComputedStyle(el);
|
|
73
|
+
if (style.display === 'none' || style.position === 'fixed') continue;
|
|
74
|
+
var marginBottom = parseFloat(style.marginBottom) || 0;
|
|
75
|
+
var bottom = el.offsetTop + el.offsetHeight + marginBottom;
|
|
76
|
+
if (bottom > maxBottom) maxBottom = bottom;
|
|
77
|
+
}
|
|
78
|
+
var bodyStyle = window.getComputedStyle(body);
|
|
79
|
+
var bodyPaddingBottom = parseFloat(bodyStyle.paddingBottom) || 0;
|
|
80
|
+
var h = maxBottom > 0 ? Math.ceil(maxBottom + bodyPaddingBottom) : body.scrollHeight;
|
|
81
|
+
if (h > 40) {
|
|
82
|
+
window.parent.postMessage({
|
|
83
|
+
jsonrpc: '2.0',
|
|
84
|
+
method: 'ui/resize',
|
|
85
|
+
params: { height: h }
|
|
86
|
+
}, '*');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
91
|
+
var ro = new ResizeObserver(function() {
|
|
92
|
+
reportHeight();
|
|
93
|
+
});
|
|
94
|
+
if (document.body) {
|
|
95
|
+
ro.observe(document.body);
|
|
96
|
+
} else {
|
|
97
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
98
|
+
if (document.body) ro.observe(document.body);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
window.addEventListener('load', reportHeight);
|
|
104
|
+
setTimeout(reportHeight, 50);
|
|
105
|
+
setTimeout(reportHeight, 250);
|
|
106
|
+
setTimeout(reportHeight, 600);
|
|
107
|
+
|
|
108
|
+
window.addEventListener('message', function(e) {
|
|
109
|
+
var msg = e.data;
|
|
110
|
+
if (!msg || typeof msg !== 'object') return;
|
|
111
|
+
var theme = (msg.params && msg.params.theme) || (msg.result && msg.result.hostContext && msg.result.hostContext.theme);
|
|
112
|
+
if (theme) applyTheme(theme);
|
|
113
|
+
});
|
|
114
|
+
})();
|
|
115
|
+
</script>`;
|
|
116
|
+
|
|
117
|
+
if (/^<!DOCTYPE/i.test(trimmed) || /<html[\s>]/i.test(trimmed)) {
|
|
118
|
+
if (/<head[\s>]/i.test(trimmed)) {
|
|
119
|
+
return trimmed.replace(/<head([^>]*)>/i, `<head$1>\n ${themeScript}`);
|
|
120
|
+
}
|
|
121
|
+
return trimmed;
|
|
122
|
+
}
|
|
123
|
+
return `<!DOCTYPE html>
|
|
124
|
+
<html lang="zh-CN" data-theme="${initialTheme}" class="${isDark ? 'dark' : ''}">
|
|
125
|
+
<head>
|
|
126
|
+
<meta charset="UTF-8">
|
|
127
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
128
|
+
${themeScript}
|
|
129
|
+
<style>
|
|
130
|
+
:root {
|
|
131
|
+
--background: #ffffff;
|
|
132
|
+
--card: #f8fafc;
|
|
133
|
+
--border: #e2e8f0;
|
|
134
|
+
--foreground: #0f172a;
|
|
135
|
+
--muted-foreground: #64748b;
|
|
136
|
+
--primary: #2563eb;
|
|
137
|
+
--primary-foreground: #ffffff;
|
|
138
|
+
}
|
|
139
|
+
:root[data-theme='dark'], html.dark {
|
|
140
|
+
--background: #0f172a;
|
|
141
|
+
--card: #1e293b;
|
|
142
|
+
--border: #334155;
|
|
143
|
+
--foreground: #f8fafc;
|
|
144
|
+
--muted-foreground: #94a3b8;
|
|
145
|
+
}
|
|
146
|
+
@media (prefers-color-scheme: dark) {
|
|
147
|
+
:root:not([data-theme='light']) {
|
|
148
|
+
--background: #0f172a;
|
|
149
|
+
--card: #1e293b;
|
|
150
|
+
--border: #334155;
|
|
151
|
+
--foreground: #f8fafc;
|
|
152
|
+
--muted-foreground: #94a3b8;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
156
|
+
body {
|
|
157
|
+
background: transparent;
|
|
158
|
+
color: var(--foreground);
|
|
159
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
160
|
+
padding: 12px;
|
|
161
|
+
}
|
|
162
|
+
</style>
|
|
163
|
+
</head>
|
|
164
|
+
<body class="${isDark ? 'dark' : ''}">
|
|
165
|
+
${trimmed}
|
|
166
|
+
</body>
|
|
167
|
+
</html>`;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Determines whether a markdown code block represents an MCP App.
|
|
172
|
+
*/
|
|
173
|
+
export function isMcpAppCodeBlock(lang: string | null | undefined, meta: string | null | undefined, value: string): boolean {
|
|
174
|
+
const l = (lang ?? '').toLowerCase().trim();
|
|
175
|
+
const m = (meta ?? '').toLowerCase().trim();
|
|
176
|
+
if (l === 'mcp-app' || l === 'mcpapp' || l === 'mcp-ui' || l === 'mcp' || l.startsWith('mcp-app:') || l === 'html:mcp-app' || l === 'html:mcp') {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
if (m.includes('mcp-app') || m.includes('mcpapp') || m.includes('sep-1865') || m.includes('mcp-ui')) {
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
if (l === 'html' && (value.includes('ui/submit') || value.includes('ui/initialize') || value.includes('SEP-1865') || value.includes('mcp-app'))) {
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Extracts a title from code block meta or HTML content.
|
|
190
|
+
*/
|
|
191
|
+
export function extractMcpAppTitle(meta: string | null | undefined, value: string): string | undefined {
|
|
192
|
+
if (meta) {
|
|
193
|
+
const titleMatch = /title=["']([^"']+)["']/i.exec(meta) || /title=([^\s]+)/i.exec(meta);
|
|
194
|
+
if (titleMatch?.[1]) return titleMatch[1];
|
|
195
|
+
}
|
|
196
|
+
const htmlTitle = extractHtmlTitle(value);
|
|
197
|
+
if (htmlTitle) return htmlTitle;
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Extracts an explicit height budget from code block meta (e.g. height=600 or height="500px").
|
|
203
|
+
*/
|
|
204
|
+
export function extractMcpAppHeight(meta: string | null | undefined): number | undefined {
|
|
205
|
+
if (!meta) return undefined;
|
|
206
|
+
const match = /height=["']?(\d+)(?:px)?["']?/i.exec(meta);
|
|
207
|
+
if (match?.[1]) {
|
|
208
|
+
const n = parseInt(match[1], 10);
|
|
209
|
+
if (Number.isFinite(n) && n >= 100 && n <= 3000) return n;
|
|
210
|
+
}
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Formats a user-submitted MCP App event into a concise, natural language conversational prompt.
|
|
216
|
+
* Avoids raw multiline JSON and excessive whitespace.
|
|
217
|
+
*/
|
|
218
|
+
export function formatReceiptPrompt(params: Record<string, unknown>, title?: string): string {
|
|
219
|
+
// If user selected a choice/variant (e.g. quiz or blind test)
|
|
220
|
+
if (typeof params.choice === 'string') {
|
|
221
|
+
const desc = typeof params.desc === 'string' ? `(${params.desc})` : '';
|
|
222
|
+
const componentName = title ? `「${title}」` : '组件';
|
|
223
|
+
return `我在${componentName}中选择了:${params.choice}${desc}。请根据我的选择继续。`;
|
|
224
|
+
}
|
|
225
|
+
if (typeof params.selectedVariant === 'string') {
|
|
226
|
+
const score = typeof params.score === 'number' ? `,得分:${params.score}` : '';
|
|
227
|
+
return `我在方案评测中选择了:${params.selectedVariant}${score}。请根据该方案继续分析。`;
|
|
228
|
+
}
|
|
229
|
+
if (typeof params.action === 'string') {
|
|
230
|
+
const payloadStr = params.payload ? (typeof params.payload === 'string' ? params.payload : JSON.stringify(params.payload)) : '';
|
|
231
|
+
return `[${title ?? '组件操作'}] 已完成 ${params.action}${payloadStr ? `: ${payloadStr}` : ''}`;
|
|
232
|
+
}
|
|
233
|
+
// Generic single field
|
|
234
|
+
const keys = Object.keys(params);
|
|
235
|
+
if (keys.length === 1 && typeof params[keys[0]] === 'string') {
|
|
236
|
+
return `[${title ?? '组件回执'}] ${keys[0]}: ${params[keys[0]]}`;
|
|
237
|
+
}
|
|
238
|
+
return `[${title ?? '组件回执'}] ${JSON.stringify(params)}`;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Finds the DSH composer textarea. The page can contain multiple (hidden)
|
|
243
|
+
* textareas, so prefer a visible, enabled one carrying the input-bar
|
|
244
|
+
* `data-phase` marker; fall back to the tallest visible, then any enabled.
|
|
245
|
+
*/
|
|
246
|
+
export function findComposerTextarea(doc?: Document): HTMLTextAreaElement | null {
|
|
247
|
+
const d = doc ?? (typeof document !== 'undefined' ? document : undefined);
|
|
248
|
+
if (!d) return null;
|
|
249
|
+
const areas = Array.from(d.querySelectorAll('textarea'));
|
|
250
|
+
if (areas.length === 0) return null;
|
|
251
|
+
const visible = areas.filter((el) => !el.disabled && (el as HTMLElement).offsetParent !== null);
|
|
252
|
+
const pool = visible.length > 0 ? visible : areas.filter((el) => !el.disabled);
|
|
253
|
+
const candidates = pool.length > 0 ? pool : areas;
|
|
254
|
+
const phased = candidates.find((el) => el.hasAttribute('data-phase'));
|
|
255
|
+
if (phased) return phased;
|
|
256
|
+
let best = candidates[0];
|
|
257
|
+
for (const el of candidates) {
|
|
258
|
+
if (((el as HTMLElement).offsetHeight || 0) > ((best as HTMLElement).offsetHeight || 0)) best = el;
|
|
259
|
+
}
|
|
260
|
+
return best;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* DOM fallback for composer fill: types into the Lexical contenteditable
|
|
265
|
+
* surface (`[data-composer-input]`) via execCommand insertText so the editor
|
|
266
|
+
* adopts the change as a genuine user edit. Returns true when accepted.
|
|
267
|
+
*/
|
|
268
|
+
export function fillComposerDom(text: string, doc?: Document): boolean {
|
|
269
|
+
const d = doc ?? (typeof document !== 'undefined' ? document : undefined);
|
|
270
|
+
if (!d) return false;
|
|
271
|
+
try {
|
|
272
|
+
const surfaces = Array.from(d.querySelectorAll('[data-composer-input]'));
|
|
273
|
+
const editable = surfaces.find(
|
|
274
|
+
(el) => el.getAttribute('contenteditable') === 'true'
|
|
275
|
+
) as HTMLElement | undefined;
|
|
276
|
+
const target = editable ?? (surfaces[0] as HTMLElement | undefined);
|
|
277
|
+
if (!target) return false;
|
|
278
|
+
target.focus();
|
|
279
|
+
if (typeof d.execCommand === 'function') {
|
|
280
|
+
try {
|
|
281
|
+
if (d.execCommand('insertText', false, text)) return true;
|
|
282
|
+
} catch {
|
|
283
|
+
// Fall through to the selection-based path below.
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
const selection = d.getSelection?.();
|
|
287
|
+
if (selection) {
|
|
288
|
+
selection.selectAllChildren(target);
|
|
289
|
+
if (typeof d.execCommand === 'function') {
|
|
290
|
+
try {
|
|
291
|
+
if (d.execCommand('insertText', false, text)) return true;
|
|
292
|
+
} catch {
|
|
293
|
+
// No further DOM path; the caller falls back to clipboard.
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
} catch {
|
|
298
|
+
// Non-browser environment or DOM denial.
|
|
299
|
+
}
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Updates a React-controlled textarea and properly notifies React's valueTracker
|
|
305
|
+
* so the backdrop and input state immediately reflect the text.
|
|
306
|
+
*/
|
|
307
|
+
export function setReactInputValue(textarea: HTMLTextAreaElement, value: string): void {
|
|
308
|
+
try {
|
|
309
|
+
const nativeSetter = Object.getOwnPropertyDescriptor(
|
|
310
|
+
window.HTMLTextAreaElement.prototype,
|
|
311
|
+
'value'
|
|
312
|
+
)?.set;
|
|
313
|
+
if (nativeSetter) {
|
|
314
|
+
nativeSetter.call(textarea, value);
|
|
315
|
+
} else {
|
|
316
|
+
textarea.value = value;
|
|
317
|
+
}
|
|
318
|
+
textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
319
|
+
textarea.focus();
|
|
320
|
+
} catch {
|
|
321
|
+
textarea.value = value;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Local clock and run-duration labels for reader message chrome. */
|
|
2
|
+
|
|
3
|
+
function pad2(n: number): string {
|
|
4
|
+
return String(n).padStart(2, '0')
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Elapsed wall time, matching official Chat `duration.minutes` / `duration.seconds`.
|
|
9
|
+
* @param ms - Elapsed milliseconds (negatives clamp to zero).
|
|
10
|
+
*/
|
|
11
|
+
export function formatRunDuration(ms: number): string {
|
|
12
|
+
const total = Math.max(0, Math.floor(ms / 1000))
|
|
13
|
+
const minutes = Math.floor(total / 60)
|
|
14
|
+
const seconds = total % 60
|
|
15
|
+
return minutes > 0 ? `${minutes}分${pad2(seconds)}秒` : `${seconds}秒`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Settled-turn duration pill, matching official `message.ranFor`.
|
|
20
|
+
* @param ms - Elapsed milliseconds.
|
|
21
|
+
*/
|
|
22
|
+
export function formatRanFor(ms: number): string {
|
|
23
|
+
return `用时 ${formatRunDuration(ms)}`
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Compact local timestamp. Same calendar day → `HH:mm`; earlier this year →
|
|
28
|
+
* `M月D日 HH:mm`; other years → `YYYY年M月D日 HH:mm`.
|
|
29
|
+
* @param time - Unix epoch ms from the source session event.
|
|
30
|
+
* @param now - Reference instant for the day/year cut.
|
|
31
|
+
*/
|
|
32
|
+
export function formatMessageClock(time: number, now: number = Date.now()): string {
|
|
33
|
+
const d = new Date(time)
|
|
34
|
+
const n = new Date(now)
|
|
35
|
+
const clock = `${pad2(d.getHours())}:${pad2(d.getMinutes())}`
|
|
36
|
+
if (
|
|
37
|
+
d.getFullYear() === n.getFullYear()
|
|
38
|
+
&& d.getMonth() === n.getMonth()
|
|
39
|
+
&& d.getDate() === n.getDate()
|
|
40
|
+
) {
|
|
41
|
+
return clock
|
|
42
|
+
}
|
|
43
|
+
if (d.getFullYear() === n.getFullYear()) {
|
|
44
|
+
return `${d.getMonth() + 1}月${d.getDate()}日 ${clock}`
|
|
45
|
+
}
|
|
46
|
+
return `${d.getFullYear()}年${d.getMonth() + 1}月${d.getDate()}日 ${clock}`
|
|
47
|
+
}
|