dsh-pre-duediligence 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 QCC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,186 @@
1
+ # dsh-pre-duediligence
2
+
3
+ 面向 DeepSeek Harness 的 Session 级访前尽调智能体。业务人员在右侧工作台定义一次拜访,Agent 调用企查查五类 MCP,使用机会与风险双引擎完成经营状态识别、假设与反证、风险核验,最终交付可追溯的访前尽调报告。
4
+
5
+ ## 功能概览
6
+
7
+ 本版本参考 `dsh-data-cleaning-agent` 的独立智能体交互原则,以及 dsh-tender-workbench 的 Session-scoped Better Sidebar 工作台范式,并吸收产品 handoff v0.2 的访前推理规范。
8
+
9
+ ### 工作台
10
+
11
+ - 使用 dsh-better-sidebar 0.17.1,不再使用遮挡对话的自定义浮层
12
+ - 只在右侧栏菜单注册“访前尽调智能体”,不替换 DSH 首页标题,不向原生输入框和 Session 头部插入控件
13
+ - 用户点击右侧菜单、工作台真实可见后才挂载业务样式;关闭后立即卸载,不影响 DSH 原页面
14
+ - 四阶段业务导航:
15
+ 1. 定义拜访
16
+ 2. 机会研判
17
+ 3. 风险核验
18
+ 4. 尽调报告
19
+ - 执行完成或失败时切到“尽调报告”;用户已关闭工作台时不会强制重新打开
20
+ - 进度与工具记录只读取当前 Session 的真实事件,不维护跨 Session 的浏览器任务列表
21
+ - 完整报告保留在 DSH 原生会话中
22
+
23
+ ### 点选拼句器
24
+
25
+ - 前端不预选角色、档位或输出形态,默认逻辑只存在于 Skill
26
+ - 支持角色、拜访场合(首次 / 谈判前 / 复访)、重点关注、尽调深度和输出形态;签约/准入类核查归入「准入尽调」,定期复查归入「持续尽调」
27
+ - 拼句路由词与 Skill 逐字绑定,并有自动化契约测试
28
+ - 用户只在企业占位符处输入名称时,继续点选会保留企业名称
29
+ - 用户自由修改文本后进入保护模式,点选条件不会覆盖原文
30
+ - “按条件补充”只会另起一句追加要求
31
+ - 最终发送的是用户可见自然语言,不发送隐藏结构化参数
32
+
33
+ ### 访前业务内核
34
+
35
+ - 五类 MCP:qcc-company、qcc-risk、qcc-ipr、qcc-operation、qcc-executive
36
+ - 唯一法律实体硬门;多候选必须停下消歧
37
+ - 机会轨:八种经营状态 → 状态 × 角色假设 → 支持/反对/未知 → 反证
38
+ - 风险轨:全量扫描 → 零计数不下钻 → 非零维度明细 → 拜访影响
39
+ - 行为信号超过 24 个月只作历史沿革
40
+ - 公开数据阶段禁止“高置信度”
41
+ - 银行对公客户经理状态内容库
42
+ - 八段访前尽调报告:核心研判、产业定位、近期动态、业务假设、红线提示、现场必问、触达开场、覆盖说明;作战交付阶段可一键下载 demo 样式的 HTML 报告
43
+
44
+ ## 安装
45
+
46
+ 前置条件:Node.js 20 或更高版本、DeepSeek Harness `0.1.1-rc.2` 或更高版本、可用的 `pnpm`,以及已经配置好的模型。
47
+
48
+ ### 一键安装(推荐)
49
+
50
+ ~~~bash
51
+ bash <(curl -fsSL https://raw.githubusercontent.com/duhu2000/dsh-pre-duediligence/main/install.sh)
52
+ ~~~
53
+
54
+ 安装脚本会按顺序向 DSH Web profile 安装三个 Bundle:
55
+
56
+ 1. `dsh-better-sidebar@0.17.1`:提供 Session 级右侧工作台容器。
57
+ 2. `dsh-mcp-connector@0.2.32`:提供通用 MCP 连接器与市场,通过“企查查·企业工商”完成 OAuth,并动态挂载企业、风险、知产、经营、历史和董监高 MCP。
58
+ 3. `dsh-pre-duediligence@0.1.0`:提供访前工作台、点选拼句器和完整 Skill。
59
+
60
+ 安装完成后停止旧的 DSH Web 进程并重新运行:
61
+
62
+ ~~~bash
63
+ dsh web
64
+ ~~~
65
+
66
+ 首次使用时打开左侧“🧩 MCP连接器”,选择“企查查·企业工商”并完成 OAuth 授权。授权完成后会注册 `qcc-company`、`qcc-risk`、`qcc-ipr`、`qcc-operation`、`qcc-history` 和 `qcc-executive`,不需要分别安装这些 MCP Server。
67
+
68
+ ### 手动安装
69
+
70
+ ~~~bash
71
+ dsh plugin --profile web add dsh-better-sidebar@0.17.1 --allow-build=node-pty
72
+ dsh plugin --profile web add dsh-mcp-connector@0.2.32
73
+ dsh plugin --profile web add dsh-pre-duediligence@0.1.0 --allow-build=dsh-pre-duediligence
74
+ dsh web
75
+ ~~~
76
+
77
+ Better Sidebar 必须使用 `0.17.1`;工作台依赖它的 `targetedOpen` 与 `stateSubscription` 公共能力。安装命令显式允许 `dsh-pre-duediligence` 的构建脚本;Better Sidebar 使用的 `node-pty` 也需要允许构建。
78
+
79
+ 如果 pnpm 仍提示 `Ignored build scripts`,请按终端提示在 `~/.dsh/profiles/web/pnpm-workspace.yaml` 的 `allowBuilds` 中允许对应包,然后重新执行失败的安装命令。
80
+
81
+ ### 安装后检查
82
+
83
+ ~~~bash
84
+ dsh plugin --profile web list --depth 0
85
+ ~~~
86
+
87
+ 应能看到 `dsh-better-sidebar@0.17.1`、`dsh-mcp-connector@0.2.32` 和 `dsh-pre-duediligence@0.1.0`。重启 DSH 并连接“企查查·企业工商”后,进入任意工作空间和 Session,在右侧栏菜单点击“访前尽调智能体”打开工作台。点击前 DSH 首页、输入框、消息流和 Session 头部均保持原样。
88
+
89
+ ### 从旧访前尽调包迁移
90
+
91
+ 新旧包会注册同一项访前能力,请勿同时安装。若 Web profile 已有 `qcc-previsit-dsh`,先执行:
92
+
93
+ ~~~bash
94
+ dsh plugin --profile web remove qcc-previsit-dsh
95
+ ~~~
96
+
97
+ 然后安装 `dsh-pre-duediligence` 并完整重启 DSH。安装脚本检测到旧包时会停止并提示,不会自动删除用户现有插件。
98
+
99
+ ### 从旧企查查 OAuth 插件升级
100
+
101
+ 如果 Web profile 已安装 `qcc-dsh-mcp-oauth`,不要让它与 MCP 连接器同时管理同名企查查 Server:
102
+
103
+ 1. 先安装 `dsh-mcp-connector@0.2.32` 和 `dsh-pre-duediligence@0.1.0`,完全重启 DSH。
104
+ 2. 打开“🧩 MCP连接器”,按界面提示迁移旧企查查授权;也可以重新连接“企查查·企业工商”。
105
+ 3. 迁移完成后停止 DSH,执行 `dsh plugin --profile web remove qcc-dsh-mcp-oauth`。
106
+ 4. 再次启动 DSH,在“已安装”中确认企查查连接健康,然后执行一次真实企业查询。
107
+
108
+ 连接器只复制旧授权,不会自动删除旧插件或旧凭据;确认新连接可用后再移除旧插件。
109
+
110
+ ## 本地开发
111
+
112
+ ~~~bash
113
+ git clone https://github.com/duhu2000/dsh-pre-duediligence.git
114
+ cd dsh-pre-duediligence
115
+ pnpm install
116
+ pnpm check
117
+ ~~~
118
+
119
+ pnpm check 会执行 TypeScript 类型检查、Vitest 测试和 Host/Client 构建。
120
+
121
+ ## 人工验收
122
+
123
+ 1. 在 DSH 选择一个工作空间和 Session。
124
+ 2. 打开右侧栏菜单,但不要点击“访前尽调智能体”;确认首页标题、输入框、消息流和 Session 头部均保持 DSH 原样。
125
+ 3. 点击“访前尽调智能体”,确认只在右侧 Better Sidebar 中出现工作台;关闭后业务 UI 和样式不再存在。
126
+ 4. 打开“定义拜访”,确认所有条件初始都未选择。
127
+ 5. 选择“银行/信贷客户经理、首次拜访、风险与涉诉、股权与实控人、15分钟标准、一页纸简报”。
128
+ 6. 将占位符替换为完整注册名称“企查查科技股份有限公司”,再切换档位,确认企业名称不丢失。
129
+ 7. 输入一段自由文本后点选条件,确认原文不被覆盖;点击“按条件补充”后才另起一句追加。
130
+ 8. 点击“开始访前尽调”,确认消息直接作为用户可见文本发送到当前 Session。
131
+ 9. 确认工作台切到“机会研判”,并只展示当前 Session 真实发生的企业、经营和知识产权工具调用。
132
+ 10. 检查风险侧先出现企业风险扫描,零计数维度没有继续下钻。
133
+ 11. 任务完成后确认工作台自动切到“尽调报告”。
134
+ 12. 检查报告有八段(含独立的产业定位段),假设包含支持/反对/未知,必问包含答 A/B 分支,覆盖声明区分零记录和调用失败。
135
+
136
+ ## 自动化契约
137
+
138
+ src/skill-contract.test.ts 会检查拼句器中的档位、角色、关注维度和输出形态是否仍逐字存在于 Skill。修改任何 phrase 时必须同步更新 Skill,否则测试失败。
139
+
140
+ ## 项目结构
141
+
142
+ ~~~text
143
+ dsh-pre-duediligence/
144
+ ├── src/
145
+ │ ├── index.ts
146
+ │ ├── client.tsx
147
+ │ ├── workbench-v2.tsx
148
+ │ ├── workbench-style.ts
149
+ │ ├── better-sidebar.ts
150
+ │ ├── composer-model.ts
151
+ │ ├── workbench-state.ts
152
+ │ └── skill-contract.test.ts
153
+ ├── skills/qcc-previsit-onepager/
154
+ │ ├── SKILL.md
155
+ │ └── references/
156
+ │ ├── reasoning-framework.md
157
+ │ ├── bank-rm-content-bank.md
158
+ │ ├── tool-routing.md
159
+ │ ├── fact-contract.md
160
+ │ └── report-template.md
161
+ ├── scripts/build.mjs
162
+ ├── cordis.patch.yml
163
+ └── package.json
164
+ ~~~
165
+
166
+ ## 安全与边界
167
+
168
+ - 插件不保存企查查 Token。
169
+ - 插件只注册右侧 Better Sidebar 标签;未打开标签时不挂载业务 DOM 或 CSS,也不修改 DSH 原生文案。
170
+ - 企业事实只能来自本次企查查 MCP 返回。
171
+ - 条件仅生成用户可见文本,不在 Client 侧调用 MCP。
172
+ - 用户点击“开始访前尽调”后才发送。
173
+ - 工作台状态绑定当前 Session,不根据聊天文本猜测业务结论。
174
+ - Agent 不输出信用评分或替用户作授信、合作、投资决定。
175
+
176
+ ## 设计参考与许可
177
+
178
+ - dsh-tender-workbench:https://github.com/Sunhh3221/dsh-tender-workbench
179
+ - dsh-data-cleaning-agent:https://github.com/duhu2000/dsh-data-cleaning-agent
180
+ - 交互参考:`DeepSeek_Harness_数据清洗补全智能体_UI_Mockup_v2.html` 与 `DeepSeek_Harness_数据清洗补全智能体_业务流程与页面设计_v2.md`
181
+ - 产品输入:桌面 handoff 中的系统提示词 v0.2、拼句器配置 v1.2.1、推理规范、业务内核和银行角色内容库
182
+ - 第三方许可见 THIRD_PARTY_NOTICES.md
183
+
184
+ ## License
185
+
186
+ MIT
@@ -0,0 +1,23 @@
1
+ # Third-party notices
2
+
3
+ The Session-scoped Better Sidebar integration and workbench interaction patterns in this project were adapted from:
4
+
5
+ dsh-tender-workbench
6
+ Copyright (c) 2026 Sunhh3221
7
+ https://github.com/Sunhh3221/dsh-tender-workbench
8
+
9
+ The referenced project is distributed under the MIT License:
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy of the software and associated documentation files to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies, subject to inclusion of the copyright and permission notice.
12
+
13
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
14
+
15
+ The additive-agent interaction principles were also informed by:
16
+
17
+ dsh-data-cleaning-agent
18
+
19
+ Copyright (c) 2026 dsh-data-cleaning-agent plugin contributors
20
+
21
+ https://github.com/duhu2000/dsh-data-cleaning-agent
22
+
23
+ No source code from that project is bundled in this package.
@@ -0,0 +1,5 @@
1
+ # 企业访前一页纸插件(DSH Bundle patch)
2
+ # 安装 package 后,向 web profile 插入 Host 插件行;Client 入口由 package.json 的 dsh.client 声明加载。
3
+ - insert:
4
+ - id: dsh-pre-duediligence
5
+ name: dsh-pre-duediligence
package/install.sh ADDED
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ readonly PROFILE_NAME="${DSH_PROFILE:-web}"
6
+ readonly BETTER_SIDEBAR_SPEC="dsh-better-sidebar@0.17.1"
7
+ readonly MCP_CONNECTOR_SPEC="dsh-mcp-connector@0.2.32"
8
+ readonly PREVISIT_SPEC="${DSH_PRE_DUEDILIGENCE_SPEC:-dsh-pre-duediligence@0.1.0}"
9
+ readonly LEGACY_PREVISIT_NAME="qcc-previsit-dsh"
10
+ readonly LEGACY_QCC_OAUTH_NAME="qcc-dsh-mcp-oauth"
11
+
12
+ info() {
13
+ printf '\n[dsh-pre-duediligence] %s\n' "$1"
14
+ }
15
+
16
+ fail() {
17
+ printf '\n[dsh-pre-duediligence] 安装失败:%s\n' "$1" >&2
18
+ exit 1
19
+ }
20
+
21
+ command -v node >/dev/null 2>&1 || fail "未找到 Node.js,请先安装 Node.js 20 或更高版本。"
22
+ command -v pnpm >/dev/null 2>&1 || fail "未找到 pnpm。请先执行 corepack enable,或安装 pnpm。"
23
+ command -v dsh >/dev/null 2>&1 || fail "未找到 dsh。请先安装 DeepSeek Harness。"
24
+
25
+ readonly NODE_MAJOR="$(node -p "Number(process.versions.node.split('.')[0])")"
26
+ if (( NODE_MAJOR < 20 )); then
27
+ fail "当前 Node.js 主版本为 ${NODE_MAJOR},本插件要求 Node.js 20 或更高版本。"
28
+ fi
29
+
30
+ info "检测到 Node.js $(node --version),DSH $(dsh --version),目标 profile:${PROFILE_NAME}。"
31
+
32
+ readonly INSTALLED_PLUGINS="$(dsh plugin --profile "${PROFILE_NAME}" list --depth 0 2>/dev/null || true)"
33
+ if [[ "${INSTALLED_PLUGINS}" == *"${LEGACY_PREVISIT_NAME}@"* ]]; then
34
+ fail "检测到旧包 ${LEGACY_PREVISIT_NAME}。为避免重复注册智能体,请先执行:dsh plugin --profile ${PROFILE_NAME} remove ${LEGACY_PREVISIT_NAME}"
35
+ fi
36
+ if [[ "${INSTALLED_PLUGINS}" == *"${LEGACY_QCC_OAUTH_NAME}@"* ]]; then
37
+ readonly LEGACY_QCC_OAUTH_PRESENT=true
38
+ else
39
+ readonly LEGACY_QCC_OAUTH_PRESENT=false
40
+ fi
41
+
42
+ info "1/3 安装 Better Sidebar(工作台容器)"
43
+ dsh plugin --profile "${PROFILE_NAME}" add "${BETTER_SIDEBAR_SPEC}" --allow-build=node-pty
44
+
45
+ info "2/3 安装 MCP 连接器(通过市场连接企查查等 MCP)"
46
+ dsh plugin --profile "${PROFILE_NAME}" add "${MCP_CONNECTOR_SPEC}"
47
+
48
+ info "3/3 安装访前尽调工作台"
49
+ dsh plugin --profile "${PROFILE_NAME}" add "${PREVISIT_SPEC}" --allow-build=dsh-pre-duediligence
50
+
51
+ info "安装完成。请停止正在运行的 DSH Web,然后重新执行:dsh web"
52
+ if [[ "${LEGACY_QCC_OAUTH_PRESENT}" == true ]]; then
53
+ printf '%s\n' \
54
+ "检测到旧插件 ${LEGACY_QCC_OAUTH_NAME}。重启后先在“🧩 MCP连接器”中迁移旧企查查授权。" \
55
+ "迁移完成后停止 DSH,执行:dsh plugin --profile ${PROFILE_NAME} remove ${LEGACY_QCC_OAUTH_NAME}" \
56
+ "再次启动 DSH,并在“企查查·企业工商”中确认连接健康;不要让两个插件同时管理同名 MCP Server。"
57
+ else
58
+ printf '%s\n' \
59
+ "重启后打开左侧“🧩 MCP连接器”,选择“企查查·企业工商”并完成 OAuth 授权。" \
60
+ "该连接会提供企业、风险、知产、经营、历史和董监高 MCP。"
61
+ fi
62
+ printf '%s\n' "进入任意工作空间和 Session 后,在右侧栏菜单点击“访前尽调智能体”即可打开;未点击时不会改动原页面。"