@chengxianglibra/dsh-data-analysis 0.1.2 → 0.2.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.
Files changed (222) hide show
  1. package/README.en.md +135 -0
  2. package/README.md +105 -98
  3. package/cordis.patch.yml +1 -1
  4. package/lib/bin/environment.js +8 -6
  5. package/lib/client/credentials/changes.js +74 -0
  6. package/lib/client/credentials/create-datasource.js +126 -22
  7. package/lib/client/credentials/credential-draft.js +42 -0
  8. package/lib/client/credentials/defaults.js +11 -0
  9. package/lib/client/credentials/descriptions.js +46 -0
  10. package/lib/client/credentials/install.js +209 -81
  11. package/lib/client/credentials/model.js +323 -51
  12. package/lib/client/credentials/report-publishing.js +96 -0
  13. package/lib/client/credentials/styles.js +13 -9
  14. package/lib/client/i18n/context.js +22 -0
  15. package/lib/client/i18n/copy.js +60 -0
  16. package/lib/client/i18n/credentials.js +475 -0
  17. package/lib/client/i18n/host.js +28 -0
  18. package/lib/client/i18n/navigation.js +41 -0
  19. package/lib/client/i18n/presentation.js +577 -0
  20. package/lib/client/i18n/python.js +36 -0
  21. package/lib/client/i18n/semantic.js +441 -0
  22. package/lib/client/i18n/settings.js +30 -0
  23. package/lib/client/input-context.js +21 -0
  24. package/lib/client/python-tool/card.js +35 -0
  25. package/lib/client/python-tool/execution-error.js +35 -0
  26. package/lib/client/python-tool/install.js +9 -0
  27. package/lib/client/python-tool/model.js +101 -0
  28. package/lib/client/right-tabs/install.js +535 -0
  29. package/lib/client/right-tabs/live-delivery.js +58 -0
  30. package/lib/client/right-tabs/navigation.js +47 -0
  31. package/lib/client/right-tabs/page.js +178 -0
  32. package/lib/client/right-tabs/styles.js +11 -0
  33. package/lib/client/rpc.js +5 -0
  34. package/lib/client/semantic-reference.js +10 -0
  35. package/lib/client/settings/card.js +90 -0
  36. package/lib/client/settings/install.js +10 -0
  37. package/lib/client/workspace-header-action.js +14 -1
  38. package/lib/client/workspace-shortcuts.js +26 -0
  39. package/lib/client.js +388 -242
  40. package/lib/compatibility.js +1 -1
  41. package/lib/datasource/authoring.js +43 -4
  42. package/lib/datasource/bridge-programs.js +23 -20
  43. package/lib/datasource/bridge.js +46 -3
  44. package/lib/datasource/changes-contract.js +41 -0
  45. package/lib/datasource/changes.js +49 -0
  46. package/lib/datasource/configure.js +39 -0
  47. package/lib/datasource/defaults.js +25 -0
  48. package/lib/datasource/index.js +2 -1
  49. package/lib/datasource/python-options.js +15 -0
  50. package/lib/datasource/python.js +119 -25
  51. package/lib/datasource/rpc.js +75 -13
  52. package/lib/datasource/service.js +286 -11
  53. package/lib/datasource/test.js +3 -2
  54. package/lib/disclosure/activation.js +19 -7
  55. package/lib/disclosure/execution-guidance.js +49 -0
  56. package/lib/disclosure/help.js +4 -1
  57. package/lib/environment/runtime.js +35 -34
  58. package/lib/environment/workspace.js +18 -1
  59. package/lib/lifecycle.js +33 -0
  60. package/lib/plugin-agents.js +154 -0
  61. package/lib/plugin.js +98 -172
  62. package/lib/presentation/asset.js +34 -0
  63. package/lib/presentation/assets/portable.js +14 -14
  64. package/lib/presentation/assets/static.js +344 -73
  65. package/lib/presentation/build/index.js +3 -2
  66. package/lib/presentation/commit.js +19 -12
  67. package/lib/presentation/contracts/asset-path.js +9 -0
  68. package/lib/presentation/contracts/catalog.js +62 -0
  69. package/lib/presentation/contracts/charts.js +0 -23
  70. package/lib/presentation/contracts/index.js +17 -5
  71. package/lib/presentation/contracts/types.js +1 -1
  72. package/lib/presentation/delivery.js +45 -30
  73. package/lib/presentation/export-html.js +214 -0
  74. package/lib/presentation/files.js +4 -5
  75. package/lib/presentation/projection/index.js +2 -1
  76. package/lib/presentation/projection/program.js +2 -9
  77. package/lib/presentation/projection/sql-code.js +13 -13
  78. package/lib/presentation/reports.js +114 -17
  79. package/lib/presentation/rpc.js +96 -58
  80. package/lib/presentation/tool.js +6 -10
  81. package/lib/report-publishing/adapters.js +111 -0
  82. package/lib/report-publishing/config.js +69 -0
  83. package/lib/report-publishing/service.js +180 -0
  84. package/lib/rpc.js +49 -0
  85. package/lib/semantic-browser/contracts.js +17 -0
  86. package/lib/semantic-browser/program.js +10 -0
  87. package/lib/semantic-browser/service.js +40 -6
  88. package/lib/semantic-reference/bridge.js +10 -1
  89. package/lib/semantic-reference/contracts.js +20 -6
  90. package/lib/semantic-reference/environment.js +56 -0
  91. package/lib/semantic-reference/labels.js +16 -0
  92. package/lib/semantic-reference/rpc.js +39 -18
  93. package/lib/semantic-reference/search.js +5 -4
  94. package/lib/semantic-reference/usage.js +12 -3
  95. package/lib/settings.js +21 -0
  96. package/lib/tool-lifecycle.js +22 -0
  97. package/lib/types/client/credentials/changes.d.ts +9 -0
  98. package/lib/types/client/credentials/create-datasource.d.ts +3 -1
  99. package/lib/types/client/credentials/credential-draft.d.ts +14 -0
  100. package/lib/types/client/credentials/defaults.d.ts +2 -0
  101. package/lib/types/client/credentials/descriptions.d.ts +1 -0
  102. package/lib/types/client/credentials/install.d.ts +19 -1
  103. package/lib/types/client/credentials/model.d.ts +31 -11
  104. package/lib/types/client/credentials/report-publishing.d.ts +5 -0
  105. package/lib/types/client/credentials/styles.d.ts +1 -1
  106. package/lib/types/client/i18n/context.d.ts +17 -0
  107. package/lib/types/client/i18n/copy.d.ts +821 -0
  108. package/lib/types/client/i18n/credentials.d.ts +475 -0
  109. package/lib/types/client/i18n/host.d.ts +17 -0
  110. package/lib/types/client/i18n/navigation.d.ts +41 -0
  111. package/lib/types/client/i18n/presentation.d.ts +577 -0
  112. package/lib/types/client/i18n/python.d.ts +19 -0
  113. package/lib/types/client/i18n/semantic.d.ts +441 -0
  114. package/lib/types/client/i18n/settings.d.ts +16 -0
  115. package/lib/types/client/input-context.d.ts +19 -0
  116. package/lib/types/client/presentation/ask-dsh.d.ts +4 -8
  117. package/lib/types/client/presentation/catalog-model.d.ts +24 -0
  118. package/lib/types/client/presentation/catalog.d.ts +20 -0
  119. package/lib/types/client/presentation/chart-tooltip.d.ts +2 -2
  120. package/lib/types/client/presentation/context-reference.d.ts +12 -0
  121. package/lib/types/client/presentation/copy-context.d.ts +2 -2
  122. package/lib/types/client/presentation/delivery-model.d.ts +27 -6
  123. package/lib/types/client/presentation/delivery.d.ts +8 -7
  124. package/lib/types/client/presentation/download.d.ts +2 -0
  125. package/lib/types/client/presentation/export-menu.d.ts +26 -0
  126. package/lib/types/client/presentation/export-view.d.ts +63 -0
  127. package/lib/types/client/presentation/host-entry.d.ts +8 -2
  128. package/lib/types/client/presentation/icons.d.ts +1 -1
  129. package/lib/types/client/presentation/model.d.ts +14 -15
  130. package/lib/types/client/presentation/reader.d.ts +15 -2
  131. package/lib/types/client/presentation/reference-source.d.ts +9 -0
  132. package/lib/types/client/presentation/source-code-model.d.ts +2 -1
  133. package/lib/types/client/presentation/source-code.d.ts +0 -5
  134. package/lib/types/client/presentation/source-dialog.d.ts +1 -2
  135. package/lib/types/client/presentation/sources.d.ts +5 -5
  136. package/lib/types/client/presentation/styles.d.ts +1 -1
  137. package/lib/types/client/presentation/table.d.ts +5 -1
  138. package/lib/types/client/python-tool/card.d.ts +2 -0
  139. package/lib/types/client/python-tool/execution-error.d.ts +3 -0
  140. package/lib/types/client/python-tool/install.d.ts +2 -0
  141. package/lib/types/client/python-tool/model.d.ts +20 -0
  142. package/lib/types/client/right-tabs/install.d.ts +18 -0
  143. package/lib/types/client/right-tabs/live-delivery.d.ts +8 -0
  144. package/lib/types/client/right-tabs/navigation.d.ts +17 -0
  145. package/lib/types/client/right-tabs/page.d.ts +36 -0
  146. package/lib/types/client/right-tabs/styles.d.ts +2 -0
  147. package/lib/types/client/rpc.d.ts +3 -0
  148. package/lib/types/client/semantic-reference.d.ts +4 -0
  149. package/lib/types/client/settings/card.d.ts +9 -0
  150. package/lib/types/client/settings/install.d.ts +2 -0
  151. package/lib/types/client/workspace-header-action.d.ts +1 -1
  152. package/lib/types/client/workspace-shortcuts.d.ts +15 -0
  153. package/lib/types/client.d.ts +5 -2
  154. package/lib/types/compatibility.d.ts +1 -1
  155. package/lib/types/datasource/authoring.d.ts +10 -0
  156. package/lib/types/datasource/bridge.d.ts +23 -2
  157. package/lib/types/datasource/changes-contract.d.ts +18 -0
  158. package/lib/types/datasource/changes.d.ts +15 -0
  159. package/lib/types/datasource/configure.d.ts +7 -0
  160. package/lib/types/datasource/defaults.d.ts +7 -0
  161. package/lib/types/datasource/index.d.ts +6 -1
  162. package/lib/types/datasource/python-options.d.ts +8 -0
  163. package/lib/types/datasource/python.d.ts +17 -2
  164. package/lib/types/datasource/rpc.d.ts +2 -1
  165. package/lib/types/datasource/service.d.ts +48 -5
  166. package/lib/types/datasource/test.d.ts +1 -1
  167. package/lib/types/disclosure/activation.d.ts +2 -1
  168. package/lib/types/disclosure/execution-guidance.d.ts +6 -0
  169. package/lib/types/disclosure/help.d.ts +1 -1
  170. package/lib/types/environment/types.d.ts +2 -1
  171. package/lib/types/environment/workspace.d.ts +1 -0
  172. package/lib/types/lifecycle.d.ts +8 -0
  173. package/lib/types/plugin-agents.d.ts +29 -0
  174. package/lib/types/plugin.d.ts +12 -28
  175. package/lib/types/presentation/asset.d.ts +6 -0
  176. package/lib/types/presentation/build/index.d.ts +7 -2
  177. package/lib/types/presentation/commit.d.ts +1 -1
  178. package/lib/types/presentation/contracts/asset-path.d.ts +2 -0
  179. package/lib/types/presentation/contracts/catalog.d.ts +27 -0
  180. package/lib/types/presentation/contracts/charts.d.ts +0 -2
  181. package/lib/types/presentation/contracts/types.d.ts +7 -4
  182. package/lib/types/presentation/delivery.d.ts +1 -1
  183. package/lib/types/presentation/export-html.d.ts +13 -0
  184. package/lib/types/presentation/reports.d.ts +6 -1
  185. package/lib/types/presentation/rpc.d.ts +3 -2
  186. package/lib/types/presentation/tool.d.ts +2 -2
  187. package/lib/types/report-publishing/adapters.d.ts +6 -0
  188. package/lib/types/report-publishing/config.d.ts +22 -0
  189. package/lib/types/report-publishing/service.d.ts +68 -0
  190. package/lib/types/rpc.d.ts +3 -0
  191. package/lib/types/semantic-browser/contracts.d.ts +7 -0
  192. package/lib/types/semantic-browser/service.d.ts +7 -1
  193. package/lib/types/semantic-reference/bridge.d.ts +1 -0
  194. package/lib/types/semantic-reference/contracts.d.ts +5 -2
  195. package/lib/types/semantic-reference/environment.d.ts +22 -0
  196. package/lib/types/semantic-reference/labels.d.ts +16 -0
  197. package/lib/types/semantic-reference/rpc.d.ts +1 -1
  198. package/lib/types/semantic-reference/search.d.ts +1 -1
  199. package/lib/types/settings.d.ts +14 -0
  200. package/lib/types/tool-lifecycle.d.ts +4 -0
  201. package/lib/types/workspace-identity.d.ts +6 -0
  202. package/lib/workspace-identity.js +9 -0
  203. package/package.json +93 -61
  204. package/python/presentation-kit/dist/dsh_data_analysis_presentation_kit-1.1.0-py3-none-any.whl +0 -0
  205. package/skills/dsh-data-analysis-files/SKILL.md +44 -0
  206. package/skills/dsh-data-analysis-files/references/delivery.md +15 -0
  207. package/skills/dsh-data-analysis-files/references/examples.md +93 -0
  208. package/skills/dsh-data-analysis-presentation/SKILL.md +15 -15
  209. package/skills/dsh-data-analysis-presentation/references/examples/artifact.draft.json +13 -4
  210. package/skills/dsh-data-analysis-presentation/references/examples/charts.draft.json +3 -2
  211. package/skills/dsh-data-analysis-presentation/references/examples/comparison.draft.json +3 -2
  212. package/skills/dsh-data-analysis-presentation/references/examples/computed-sources.draft.json +12 -5
  213. package/skills/dsh-data-analysis-presentation/references/examples/computed.draft.json +3 -2
  214. package/skills/dsh-data-analysis-presentation/references/examples/interaction.draft.json +3 -2
  215. package/skills/dsh-data-analysis-presentation/references/examples/source-only.draft.json +12 -4
  216. package/skills/dsh-data-analysis-presentation/references/examples.md +3 -1
  217. package/skills/dsh-data-analysis-presentation/references/export-html.md +7 -0
  218. package/skills/dsh-data-analysis-presentation/references/interaction.md +1 -1
  219. package/skills/dsh-data-analysis-presentation/references/narrative.md +1 -1
  220. package/skills/dsh-data-analysis-presentation/references/publishing.md +3 -0
  221. package/skills/dsh-data-analysis-presentation/references/schema.md +29 -2
  222. package/lib/types/client/presentation/install.d.ts +0 -15
package/README.en.md ADDED
@@ -0,0 +1,135 @@
1
+ # @chengxianglibra/dsh-data-analysis
2
+
3
+ [简体中文](README.md) | English
4
+
5
+ Analyze data with natural language in [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness).
6
+ Explore and reuse business metric definitions, then turn your findings into interactive charts, reports,
7
+ and dashboards that you can also read offline. Semantic analysis is powered by [Marivo](https://github.com/chengxianglibra/marivo).
8
+
9
+ This is an independently maintained community plugin. It is not an official DeepSeek product.
10
+
11
+ ## Capabilities and features
12
+
13
+ | What you want to do | What the plugin offers |
14
+ | --- | --- |
15
+ | Answer business questions | Analyze metric trends, compare periods or business segments, and explore reasons for changes using natural language |
16
+ | Analyze local files | Upload files or use files in your workspace to analyze data and create charts and reports |
17
+ | Connect to data | Configure data sources, manage credentials, and test connections; DuckDB, Trino, and ClickHouse are supported by default |
18
+ | Keep definitions consistent | Work with the assistant to define and reuse metrics and dimensions, and explore their relationships |
19
+ | Specify what to analyze | Search for and reference existing semantic objects with `@` in the chat input |
20
+ | Present findings | Create reports and dashboards with conclusions, metric cards, charts, tables, and source information |
21
+ | Explore further | Filter interactively, adjust the presentation, and reference report content in follow-up questions |
22
+ | Read and share | Save and browse previous versions, and download HTML for offline reading and sharing |
23
+
24
+ ## Installation
25
+
26
+ ### Prerequisites
27
+
28
+ - Node.js `^22.19.0 || >=24.0.0`: version 22.19.0 or later in the 22.x series, or version 24.0.0 and above. Version 23.x is not supported.
29
+ - DeepSeek Harness `>=0.1.5-rc.1`, installed and configured.
30
+ - `pnpm` available on the command line for Harness to install the plugin.
31
+ - Python 3.10+, available as `python3` (`python` on Windows), with `venv`/`ensurepip` support. Some Linux distributions require the additional `python3-venv` package.
32
+
33
+ You do not need to install Marivo beforehand. The analysis environment is prepared automatically on first launch.
34
+ An internet connection is required to download dependencies; wait for setup to finish.
35
+
36
+ ### Install and launch
37
+
38
+ Install the plugin into the Web Profile:
39
+
40
+ ```bash
41
+ dsh plugin --profile web add @chengxianglibra/dsh-data-analysis
42
+ ```
43
+
44
+ Start the Web Profile after installation. If it is already running, exit and restart it:
45
+
46
+ ```bash
47
+ dsh --profile web
48
+ ```
49
+
50
+ In the Web interface, select a Workspace, create a session, and send a message.
51
+ Data Sources (数据源), Semantic Layer (语义层), and Reports (报告) appear beside the session title and open in tabs on the right.
52
+ The examples below use the Web interface; Chinese labels are included to help you locate the controls.
53
+
54
+ ## How to use
55
+
56
+ ### 1. Prepare your data
57
+
58
+ **Local files**: Upload a file and ask a question, or specify a file already in your workspace.
59
+ No data source configuration or business definitions are required first.
60
+ CSV, JSON, Parquet, and Excel `.xlsx` files are supported. Reading `.xlsx` for the first time requires an internet connection to download an extension.
61
+ Convert older `.xls` files to `.xlsx`, CSV, or Parquet first.
62
+
63
+ **Databases**: Open Data Sources (数据源) beside the session title to view connections and their configuration status in the current workspace:
64
+
65
+ 1. Select Add Data Source (新增数据源), choose an engine, and enter a name and connection details.
66
+ 2. If authentication is required, enter the username, password, or token under Connection Credentials (连接凭证).
67
+ 3. Save and test the connection. Use the result to check the address, credentials, or access permissions.
68
+
69
+ Use Edit Configuration (编辑配置) to update an existing connection. Its name and engine stay fixed; test the connection again after saving.
70
+ Saved credential values are not displayed; leave them blank to keep using them. Submit passwords and tokens through the credential form, not in chat messages.
71
+
72
+ If a data source needs to be added or repaired during analysis, the assistant can open the configuration page.
73
+ Enter a new connection or choose Use Existing Data Source (使用已有数据源), then select Save and Test, Continue on Success (保存并测试,成功后继续).
74
+ The assistant resumes analysis after verifying the connection and access to the target data.
75
+
76
+ ### 2. Ask questions in natural language
77
+
78
+ Describe the data, time range, metric definitions, and results you want. For example:
79
+
80
+ > Using the order data, analyze revenue and order count for August 2026, compare them with July, break them down by channel, and explain the sources and metric definitions.
81
+
82
+ > Check query duration over the last seven days. Identify the slowest query types and provide a trend chart and a detailed table.
83
+
84
+ If you have not yet defined your business metrics, start by asking the assistant to help:
85
+
86
+ > First, find order-related tables in the current data source. Confirm the definitions of revenue and paid order count with me, then save them as reusable business definitions.
87
+
88
+ When you need a report, describe its contents:
89
+
90
+ > Turn this analysis into a report with conclusions, key metrics, trend charts, a channel comparison table, and source information. Provide a downloadable HTML file.
91
+
92
+ ### 3. Browse and reference business definitions
93
+
94
+ Open Semantic Layer (语义层) to find metrics, dimensions, and other objects by category or keyword,
95
+ and inspect their definitions and relationships. Open objects separately to compare them side by side.
96
+
97
+ Type `@` in the chat input to search for and select objects in the current workspace.
98
+ For a multiword search, use `@"monthly revenue"`. Ask questions about the selected objects to keep the analysis aligned with your business definitions.
99
+
100
+ ### 4. Read, edit, and ask follow-up questions about reports
101
+
102
+ When the current session delivers a new report, it opens automatically on the right.
103
+ Use the Reports (报告) catalog to find reports by title and read different reports or versions side by side.
104
+ The page notifies you when a new version is available, so you can choose when to switch.
105
+ You can also read workspace reports from the Reports sidebar entry without an active session.
106
+
107
+ - **Explore data**: Filter charts and tables, and adjust supported chart types and displayed fields. Interactions use data already saved in the report; ask in chat to fetch fresh data or recalculate results.
108
+ - **Check sources**: Inspect the source information attached to report content to review the basis of the analysis.
109
+ - **Edit the presentation**: On the latest version page, select Edit Report (编辑报告) to change titles, text, metric labels, and chart or table settings. Move or remove content, undo or redo changes, and save your edits.
110
+ - **Ask follow-up questions**: Choose Add to Question (加入提问) from a supported report content menu to insert a reference into the chat input, then add your question and send it.
111
+ - **Browse history**: After saving edits, use the history sidebar to view and download saved versions. Historical versions are read-only.
112
+
113
+ Page filters do not recalculate metric cards or change the saved report. To preserve the current filtered view, use Export Current View (导出当前视图).
114
+
115
+ ### 5. Download and share
116
+
117
+ The export menu at the top right of a report offers two options:
118
+
119
+ | Option | Use it to |
120
+ | --- | --- |
121
+ | Download Full Report (下载完整报告) | Download the complete HTML report for the version you are viewing and read it offline |
122
+ | Export Current View (导出当前视图) | Capture the current filters, charts, and table sorting in HTML, with the source version and export time, to share what you see |
123
+
124
+ You can also ask the assistant to export a report as an HTML file. Open downloaded files in a browser to read and interact with them offline, without connecting to the original data source.
125
+ If you are editing a report, save or cancel your edits before exporting.
126
+
127
+ ## Analysis timeout
128
+
129
+ Go to Settings → Plugins → Plugin Configuration → Data Analysis (设置 → 插件 → 插件配置 → 数据分析)
130
+ to adjust the default timeout for Python analysis. The default is 120 seconds, and changes apply to the next analysis call after saving.
131
+ The actual execution limit is still subject to Harness execution policies.
132
+
133
+ ## License
134
+
135
+ This project is licensed under the [MIT License](LICENSE).
package/README.md CHANGED
@@ -1,121 +1,128 @@
1
1
  # @chengxianglibra/dsh-data-analysis
2
2
 
3
- 由个人维护的 DeepSeek Harness 社区插件,并非 DeepSeek 官方发行或维护的软件包。
3
+ 简体中文 | [English](README.en.md)
4
4
 
5
- DeepSeek Harness 的 Marivo 集成插件。当前包提供:
5
+ 在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 中,用自然语言完成数据分析,
6
+ 浏览和复用业务指标定义,并将结果整理为可交互、可离线阅读的图表、报告和看板。
7
+ 语义分析能力由 [Marivo](https://github.com/chengxianglibra/marivo) 提供。
6
8
 
7
- - 精确 Marivo 0.5.4 共享 Runtime 与 zero-init per-Workspace binding;
8
- - `marivo_help` 实时公共 Help transport;
9
- - 会话标题旁的“语义层”对象浏览器:Workspace 分类搜索、只读详情与局部关系图;
10
- - `marivo_datasource_test` 的 DSH Credentials 收集与显式 connection test;
11
- - `marivo_python` 的本次执行准入与单次 resolver 凭证注入;
12
- - 会话标题旁的“数据源与凭证”管理、测试与缺失输入提交后的原调用续接;
13
- - `marivo_present({ draft_path })` 的一次文件提交、结果卡片、打开与离线 HTML 下载;
14
- - 唯一插件 Skill `dsh-data-analysis-presentation`,组织图表、表格、报告、看板与可读来源展示;
15
- - `dsh_data_analysis_presentation.write_dataset(frame, path)` 的 computed typed JSON writer;
16
- - 内部 Artifact/computed/source-only 数据投影,保存精确来源及 unavailable 状态。
9
+ 本项目是个人维护的社区插件,并非 DeepSeek 官方发行或维护的软件。
17
10
 
18
- 共享 reader、离线 builder、`marivo_present` 和展示 Skill 提供统一的展示交付;
19
- 两个 Marivo Runtime Skill `marivo-analysis`、`marivo-semantic` 继续从当前 Runtime 挂载。
20
- 旧 report-kit、report Skill、经典 JS 与 Evidence 卡协议不再分发。升级说明见
21
- [0.1.2 发布说明](../../docs/releases/0.1.2.md)。
11
+ ## 能力与特性
22
12
 
23
- ## Compatibility
13
+ | 你想做什么 | 插件提供的能力 |
14
+ | --- | --- |
15
+ | 回答业务问题 | 用自然语言分析指标趋势、比较不同时间或业务分组、探索变化原因 |
16
+ | 分析本地文件 | 上传文件或指定工作区中的文件,直接分析并生成图表、报告 |
17
+ | 连接数据 | 配置数据源、管理连接凭证并测试连接;默认支持 DuckDB、Trino、ClickHouse |
18
+ | 统一分析口径 | 与助手一起整理和复用指标、维度等业务定义,浏览对象及其关系 |
19
+ | 明确分析对象 | 在输入框通过 `@` 搜索并引用已有语义对象 |
20
+ | 展示分析结果 | 生成包含结论、指标卡、图表、表格和来源说明的报告或看板 |
21
+ | 继续探索 | 交互筛选、调整呈现,并引用报告内容继续提问 |
22
+ | 阅读与分享 | 保存和查看历史版本,下载 HTML 供离线阅读与分享 |
24
23
 
25
- 包内 `dshDataAnalysisCompatibility` 是唯一运行时兼容声明:
24
+ ## 安装
26
25
 
27
- - DSH distribution 与所有必需 peer 精确使用 `0.1.1-rc.2`;
28
- - Runtime 通过 pip 安装已发布的 Marivo 0.5.4;版本约束为 `marivo[duckdb,trino,clickhouse]==0.5.4`;
29
- - 项目自有 Runtime marker 为 `dsh-data-analysis-runtime/v3`;
30
- - 子进程策略为 `direct-argv-inherited-env-snapshot-overlay-v2`。
26
+ ### 环境准备
31
27
 
32
- 管理员解释器的 `marivo.__version__` 与 package identity 必须精确匹配;不使用 capability/version matrix。
28
+ - Node.js `^22.19.0 || >=24.0.0`:22.x 需至少 22.19.0,或使用 24.0.0 及以上版本;不支持 23.x。
29
+ - 已安装并配置好 DeepSeek Harness `>=0.1.5-rc.1`。
30
+ - 命令行中可使用 `pnpm`,供 Harness 安装插件。
31
+ - Python 3.10+,命令行可运行 `python3`(Windows 为 `python`),且支持 `venv`/`ensurepip`;部分 Linux 发行版需额外安装 `python3-venv`。
33
32
 
34
- ## Tool contracts
33
+ 无需预装 Marivo。首次启动会自动准备分析环境,需要联网下载依赖,请等待准备完成。
35
34
 
36
- ```text
37
- marivo_help({ targets: string[] })
38
- marivo_datasource_test({ name: string })
39
- marivo_python({ code: string, datasources: string[] })
40
- marivo_present({ draft_path: string, report_id?: string, expected_build_id?: string })
35
+ ### 安装并启动
36
+
37
+ 将插件安装到 Web Profile:
38
+
39
+ ```bash
40
+ dsh plugin --profile web add @chengxianglibra/dsh-data-analysis
41
41
  ```
42
42
 
43
- `marivo_datasource_test` 只拥有缺失 Credentials 的 DSH/Web 闭环和显式连接测试;
44
- `marivo_python` 在本次调用内等待全部数据源凭证就绪、核验身份并取得 fresh snapshot,再通过 DSH 前台
45
- 执行服务与 Marivo 公开 resolver 启动一次代码。配置齐全时不额外测试;普通 Shell 不获得凭证。
46
- 缺失输入时默认等待 Web 表单,提交测试成功后继续原调用;取消、轮换或 Workspace 变化终止旧准备,
47
- 已启动代码失败不重放。无 Web 场景配置 `credentialInteraction: 'none'`,subagent 同样不等待表单。
48
- 详见[凭证模块](../../docs/modules/datasource-credentials.md)。`md.inspect(...)`、
49
- Session recovery、Artifact revalidation、Quality、Evidence 读取、Session Graph 与 `to_pandas()` 都直接使用
50
- Marivo 公共 API,不增加 convenience Tool。
51
-
52
- ## 语义层对象浏览器
53
-
54
- 点击 DSH 会话标题旁的“语义层”,默认查看该会话所属 Workspace,也可在面板内显式切换 Workspace。
55
- 可按业务域和类型筛选,搜索名称、引用与业务定义,
56
- 复制对象引用、查看定义位置,并在对象关系中逐层浏览。桌面采用三栏布局,窄屏支持列表与详情切换。
57
-
58
- 页面不要求 live Agent,只读取 Marivo Catalog 元数据,不执行 `observe`、数据预览或连接测试。
59
- 打开和手动刷新重新加载;读取失败时明确标注上次成功内容。数据源连接配置、凭证值与原始源码不展示。
60
- 使用及验收边界见[模块说明](../../docs/modules/semantic-browser.md)。
61
-
62
- “数据源与凭证”位于同一会话标题旁,打开时同样使用该会话所属 Workspace,面板内保留 Workspace 选择。
63
- 两个入口随 Harness 的会话标题显示,无会话或空会话时不显示,侧栏底部不保留入口。
64
-
65
- ## 分析与展示
66
-
67
- 普通事实问答使用文字。图表、表格、报告、看板和可读来源展示加载 `dsh-data-analysis-presentation`,
68
- 按 Skill 编写 Workspace 相对 Draft,再调用 `marivo_present`。已有 Artifact 或 computed 数据无需先激活
69
- `marivo-analysis`;需要新分析或语义编写时,按需加载对应 Runtime Skill 与 live Help。
70
- Skill 只指导内容组织、声明来源和交付,不承担分析计算或来源有效性判断;布局由 reader 自适应。
71
- 完整流程见[展示 Skill](../../docs/modules/presentation-skill.md)。
72
-
73
- Python helper 的可选 `labels={列名: 展示名}` 设置中文表头、图例和 tooltip,字段绑定仍使用原列名。
74
- Python helper 只接受 pandas DataFrame,写入 `schemaVersion: 1` 的 typed JSON;int64/Decimal 保留精确字符串,
75
- null 保留缺失含义,datetime 必须带时区。它不保存来源或转换代码;来源在展示 Draft 中声明。
76
- 固定 projection 从同一 bound Workspace 恢复 persisted Artifact 和可选 Finding,不自动 observe、revalidate 或读取凭据。
77
- 直接 Artifact dataset 缺必要数据会失败,computed 和 source-only 可以保留 unavailable 来源。
78
-
79
- 共享 reader 展示 Markdown、metric、18 类 chart、table 和 source,保留精确值、单位、截断与 unavailable 来源。chart 支持 bar/line 变体与当前页面的字段、图形及过滤探索;统计量由分析阶段准备,探索不改写保存快照。
80
- `marivo_present` 读取 Workspace 相对 Draft 路径,生成不可变新 build 的 JSON/自包含 HTML。
81
- 默认创建新 Report;修改已有报告时成对传入 `report_id` 与本次修改所基于的 `expected_build_id`,以完整 Draft 更新同一 Report。
82
- 版本冲突时读取当前保存内容并合并需保留的编辑,不强行覆盖,也不回退新建。
83
- 原卡片通过 reportId 打开最近保存结果;阅读器可编辑标题、正文、指标标签、图表和表格配置,以及移动/删除 cell(允许删空),支持撤销/重做和保存/取消。
84
- 保存生成同报告的新 build,保留底层数据、来源和代码,不运行 Agent 或 Python。
85
- 全部 18 种 chart 与同 dataset 的表格和数据预览共享临时筛选;筛选不重算指标、不标记编辑修改、不进入保存、下载或打印。
86
- 文档、receipt 与 delivery 使用 schema v2,Draft 和 typed dataset 保持 v1;旧报告不读取、不迁移,旧文件保留。文本始终包含两份文件的位置、digest 和字节数,headless 也能取得交付物。
87
- 展开来源仅使用保存的快照;文件变化、缺失或 Workspace 归属变化会明确失败。
88
- 实现与验收见[展示数据投影](../../docs/modules/presentation-projection.md)、[展示 reader](../../docs/modules/presentation-reader.md)、
89
- [展示交付](../../docs/modules/presentation-delivery.md)。
90
-
91
- ## 验证
43
+ 安装后启动 Web Profile;如果已在运行,请先退出再重新启动:
92
44
 
93
45
  ```bash
94
- npm run check
95
- npm run build
96
- npm run verify:plugin-package
46
+ dsh --profile web
97
47
  ```
98
48
 
99
- 当前架构与验收边界见仓库根目录的[总体架构](../../docs/architecture.md)和
100
- [展示交付](../../docs/modules/presentation-delivery.md)。
49
+ 在 Web 界面选择分析使用的工作区(Workspace),新建会话并发送一条消息。
50
+ 会话标题旁会显示“数据源”“语义层”“报告”三个入口,相关页面在右侧标签页打开。以下以 Web 界面为例。
51
+
52
+ ## 如何使用
53
+
54
+ ### 1. 准备数据
55
+
56
+ **本地文件**:上传文件后直接提问,或指定工作区中已有文件,无需先配置数据源或建立业务定义。
57
+ 支持 CSV、JSON、Parquet 和 Excel `.xlsx`;首次读取 `.xlsx` 需要联网下载扩展。
58
+ 旧版 `.xls` 请先转换为 `.xlsx`、CSV 或 Parquet。
59
+
60
+ **数据库**:在会话标题旁打开“数据源”,查看当前工作区的连接与配置状态:
61
+
62
+ 1. 点击“新增数据源”,选择引擎,填写名称及连接信息。
63
+ 2. 如果需要身份认证,在“连接凭证”中填写用户名、密码或令牌。
64
+ 3. 保存并测试连接,根据结果检查地址、凭证或访问权限。
65
+
66
+ 已有数据源可通过“编辑配置”修改连接信息,名称和引擎保持不变;保存后重新测试。
67
+ 已保存的凭证值不会回显,留空可沿用。请通过凭证表单提交密码或令牌,不要粘贴到聊天消息中。
68
+
69
+ 分析过程中需要新增或修复数据源时,助手可打开配置页。你可以填写新连接,或选择“使用已有数据源”,
70
+ 点击“保存并测试,成功后继续”,连接与目标数据访问验证通过后,助手会继续分析。
71
+
72
+ ### 2. 用自然语言提出分析问题
73
+
74
+ 说明使用哪些数据、时间范围、指标口径和希望得到的结果。例如:
75
+
76
+ > 使用订单数据,分析 2026 年 8 月的销售额和订单量,与 7 月比较,按渠道拆分,并说明数据来源和口径。
77
+
78
+ > 检查最近七天的查询耗时,找出耗时最高的查询类型,给出趋势图和明细表。
79
+
80
+ 如果还没有整理业务定义,可以先让助手帮助梳理:
81
+
82
+ > 先查看当前数据源中有哪些订单相关表,和我确认销售额、支付订单数的统计口径,再保存为可复用的业务定义。
83
+
84
+ 需要报告时,直接说明希望的内容:
85
+
86
+ > 将这次分析整理为一份报告,包含结论、关键指标、趋势图、渠道对比表和来源说明,并提供可下载的 HTML。
87
+
88
+ ### 3. 浏览和引用业务定义
89
+
90
+ 点击“语义层”,按分类或关键词查找指标、维度等对象,查看业务定义和对象关系。
91
+ 支持独立打开对象,方便对照阅读。
92
+
93
+ 在聊天输入框输入 `@`,搜索并选择当前工作区的对象;多词搜索可输入 `@"monthly revenue"`。
94
+ 选中后即可围绕指定对象提问,让助手使用一致的业务口径开展分析。
95
+
96
+ ### 4. 阅读、调整和追问报告
97
+
98
+ 当前会话交付新报告后,会自动在右侧打开。通过“报告”目录可按标题查找报告,并排阅读不同报告和版本。
99
+ 发现新版本时,页面会提示更新,你可以选择何时切换。没有活动会话时,也可通过侧栏的“报告”入口阅读工作区中的报告。
100
+
101
+ - **探索数据**:筛选图表和表格,调整支持的图形及展示字段。交互使用报告中已保存的数据;获取新数据或重新计算时,在会话中提出要求。
102
+ - **查看来源**:查看报告内容附带的来源信息,核对分析依据。
103
+ - **调整呈现**:在最新版本页面点击“编辑报告”,编辑标题、正文、指标标签和图表/表格配置,移动或删除内容,支持撤销、重做和保存。
104
+ - **继续追问**:在支持的报告内容菜单中选择“加入提问”,将相关内容引用到输入框,补充问题后发送。
105
+ - **查看历史**:保存编辑后可在历史侧栏查看和下载已保存的版本,历史版本只读。
106
+
107
+ 页面筛选不会重新计算指标卡,也不会写入保存的报告。希望保留当前筛选结果时,使用“导出当前视图”。
108
+
109
+ ### 5. 下载与分享
110
+
111
+ 报告右上角的导出菜单提供两种方式:
101
112
 
102
- ## 语义对象引用
113
+ | 选项 | 适合的用途 |
114
+ | --- | --- |
115
+ | 下载完整报告 | 下载所查看版本的完整 HTML 报告,供离线阅读 |
116
+ | 导出当前视图 | 将当前筛选、图形和表格排序固定为 HTML,附带来源版本及导出时间,分享当前看到的内容 |
103
117
 
104
- 在 Web 输入框输入 `@` 选择当前 Workspace 的 Marivo 对象;多词检索使用 `@"monthly revenue"`。
105
- 选中后显示完整 `kind:path`,提交只携带精确 ref。最近七个自然日热度保存在 DSH profile;候选缓存为 30 秒。
106
- 对象有效性由执行时 Marivo Catalog 验证,删除对象不会被相似对象自动替换。
118
+ 也可以直接让助手将报告导出为 HTML 文件。下载的文件可用浏览器打开,离线阅读和交互,无需连接原始数据源。
119
+ 编辑模式下,请先保存或取消编辑再导出。
107
120
 
121
+ ## 分析超时设置
108
122
 
109
- ## 草稿静态预检
123
+ 在“设置 → 插件 → 插件配置 → 数据分析”中可调整 Python 分析的默认超时时间,默认为 120 秒,
124
+ 保存后对下一次分析调用生效。实际执行时限仍受 Harness 执行策略约束。
110
125
 
111
- 在 Workspace 根目录运行 `dsh-data-analysis-presentation-lint analysis/presentation.draft.json`,
112
- 或通过 `--project-root PATH` 显式指定 Workspace。CLI 复用 present 的草稿与 TypedDataset 校验及文件边界,
113
- 检查草稿结构和引用的 computed JSON;不启动 Runtime、不执行分析、不生成报告文件。
114
- 输出 JSON 的 `ok` 仅表示这些静态检查通过;`deferredChecks` 列出仍由 `marivo_present` 完成的
115
- Artifact 可用性与数据、codeRefs、投影后文档与渲染检查。退出码为 0(通过)、1(校验失败)、2(参数错误)。
116
- 草稿结构通过后逐份检查 computed 文件,每份保留首个错误,修正后可再次预检。
126
+ ## 许可证
117
127
 
118
- int64 单元格必须是精确整数字符串,例如 `"42"`;JSON number `42` 也不接受。
119
- 诊断保留 JSON pointer,并显示 `column query_count type=int64`、原因与修复建议。
120
- 超过 JS 安全整数范围的 number 可能已舍入,不能转成字符串来恢复精度;应从原始精确数据重写,
121
- 或使用绑定 Runtime 中的 `write_dataset`。预检通过不等于成功交付,仍需 present 的成功 receipt。
128
+ 本项目采用 [MIT License](LICENSE)。
package/cordis.patch.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  # Web-profile Marivo disclosure layer. One profile-owned plugin installation
2
- # serves every Agent and session Workspace in native, code, or both mode.
2
+ # serves every Agent and session Workspace in native, ptc, or both mode.
3
3
 
4
4
  - insert:
5
5
  - id: dsh-data-analysis
@@ -5,7 +5,7 @@ import { MarivoEnvironmentError } from "../environment/errors.js";
5
5
  import { ensureSharedMarivoRuntime, MarivoWorkspaceEnvironmentManager, } from "../environment/index.js";
6
6
  import { environmentPayload } from "../environment/summary.js";
7
7
  function usage() {
8
- return `Usage: dsh-data-analysis-env [--project-root PATH] [--python PATH] [--runtime-root PATH] [--uv PATH]
8
+ return `Usage: dsh-data-analysis-env [--project-root PATH] [--python PATH] [--runtime-root PATH] [--bootstrap-python PATH]
9
9
 
10
10
  Ensures the shared pinned Marivo and presentation-kit Runtime, initializes the minimal
11
11
  Workspace layout, and checks the exact interpreter, import identities, and doctor
@@ -23,7 +23,7 @@ function parseArguments(argv) {
23
23
  let projectRoot = process.env.DSH_DATA_ANALYSIS_PROJECT_ROOT ?? process.env.DSH_CWD ?? process.cwd();
24
24
  let pythonExecutable = process.env.DSH_DATA_ANALYSIS_PYTHON;
25
25
  let runtimeRoot = process.env.DSH_DATA_ANALYSIS_RUNTIME_ROOT;
26
- let uvExecutable = process.env.DSH_DATA_ANALYSIS_UV;
26
+ let bootstrapPythonExecutable = process.env.DSH_DATA_ANALYSIS_BOOTSTRAP_PYTHON;
27
27
  for (let index = 0; index < argv.length; index++) {
28
28
  const option = argv[index];
29
29
  if (option === '--help' || option === '-h')
@@ -43,8 +43,8 @@ function parseArguments(argv) {
43
43
  index++;
44
44
  continue;
45
45
  }
46
- if (option === '--uv') {
47
- uvExecutable = requireValue(argv, index, option);
46
+ if (option === '--bootstrap-python') {
47
+ bootstrapPythonExecutable = requireValue(argv, index, option);
48
48
  index++;
49
49
  continue;
50
50
  }
@@ -54,7 +54,7 @@ function parseArguments(argv) {
54
54
  projectRoot,
55
55
  ...(pythonExecutable === undefined ? {} : { pythonExecutable }),
56
56
  ...(runtimeRoot === undefined ? {} : { runtimeRoot }),
57
- ...(uvExecutable === undefined ? {} : { uvExecutable }),
57
+ ...(bootstrapPythonExecutable === undefined ? {} : { bootstrapPythonExecutable }),
58
58
  };
59
59
  }
60
60
  async function main(argv) {
@@ -74,7 +74,9 @@ async function main(argv) {
74
74
  const runtime = await ensureSharedMarivoRuntime({
75
75
  ...(args.pythonExecutable === undefined ? {} : { pythonExecutable: args.pythonExecutable }),
76
76
  ...(args.runtimeRoot === undefined ? {} : { runtimeRoot: args.runtimeRoot }),
77
- ...(args.uvExecutable === undefined ? {} : { uvExecutable: args.uvExecutable }),
77
+ ...(args.bootstrapPythonExecutable === undefined
78
+ ? {}
79
+ : { bootstrapPythonExecutable: args.bootstrapPythonExecutable }),
78
80
  });
79
81
  const manager = new MarivoWorkspaceEnvironmentManager(runtime);
80
82
  const environment = await manager.resolve(args.projectRoot);
@@ -0,0 +1,74 @@
1
+ import { credentialChangesRemote, } from "../../datasource/changes-contract.js";
2
+ /** Mount before opening a logical stream, using the existing Gateway WebSocket. */
3
+ export function credentialChanges(ctx) {
4
+ const mounted = ctx.remote.$mount(credentialChangesRemote);
5
+ // Initialization may be withdrawn before a Session starts consuming the mount.
6
+ void mounted.catch(() => { });
7
+ ctx.effect(() => async () => (await mounted)());
8
+ // Host and browser Context augmentations share this build; use the browser contract here.
9
+ const connection = ctx.connection;
10
+ return (sessionId) => {
11
+ let snapshot;
12
+ const stopConnection = connection.generation.subscribe(() => {
13
+ if (!connection.generation.getSnapshot())
14
+ snapshot?.abort();
15
+ });
16
+ const stream = ctx.remote.$stream({
17
+ name: 'dsh-data-analysis credential changes',
18
+ async *open(signal) {
19
+ const current = new AbortController();
20
+ snapshot = current;
21
+ try {
22
+ await mounted;
23
+ signal.throwIfAborted();
24
+ // A dynamically mounted namespace needs its own declared Cordis consumer.
25
+ let namespace;
26
+ const consumer = ctx.inject(['remote.dshDataAnalysisCredentials'], (scoped) => {
27
+ namespace = scoped.remote.dshDataAnalysisCredentials;
28
+ });
29
+ const stop = () => {
30
+ void consumer.dispose();
31
+ };
32
+ signal.addEventListener('abort', stop, { once: true });
33
+ if (signal.aborted)
34
+ stop();
35
+ try {
36
+ await consumer;
37
+ signal.throwIfAborted();
38
+ if (!namespace)
39
+ throw new Error('credential-notification-unavailable');
40
+ yield* namespace.changes(sessionId, signal);
41
+ }
42
+ finally {
43
+ // Abort snapshots before RemoteStream starts waiting for reconnection.
44
+ current.abort();
45
+ signal.removeEventListener('abort', stop);
46
+ await consumer.dispose();
47
+ }
48
+ }
49
+ finally {
50
+ current.abort();
51
+ }
52
+ },
53
+ carrierFailed: () => snapshot?.abort(),
54
+ ended: () => new Error('credential-notification-ended'),
55
+ });
56
+ const dispose = async () => {
57
+ stopConnection();
58
+ snapshot?.abort();
59
+ await stream.dispose();
60
+ };
61
+ return {
62
+ async *[Symbol.asyncIterator]() {
63
+ try {
64
+ for await (const item of stream)
65
+ yield { ...item, signal: AbortSignal.any([item.signal, snapshot.signal]) };
66
+ }
67
+ finally {
68
+ await dispose();
69
+ }
70
+ },
71
+ dispose,
72
+ };
73
+ };
74
+ }