dsh-doc-routing-guard 0.0.0-stage → 0.1.2
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 +21 -0
- package/README.md +14 -2
- package/cordis.patch.yml +3 -0
- package/lib/index.js +20 -0
- package/package.json +33 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 local
|
|
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
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-doc-routing-guard
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 可选依赖:`dsh-tool-ocr`(ocr_read)、`dsh-doc-router`(doc_route/pdf_markdown)。不装也能用,提示词会退到内置 read/office/read_document。
|
|
4
|
+
|
|
5
|
+
全局文档路由提示(本地开发)。
|
|
6
|
+
|
|
7
|
+
## 功能
|
|
8
|
+
- 在系统提示词中注册 `doc-routing` 段:
|
|
9
|
+
- PDF/扫描件先 `ocr_read`;
|
|
10
|
+
- Office 用 office 技能;
|
|
11
|
+
- 知识库引用标注来源。
|
|
12
|
+
- 与市场插件 `dsh-doc-router` 共存(后者提供 `doc_route`/`pdf_markdown` 工具)。
|
|
13
|
+
|
|
14
|
+
## 说明
|
|
15
|
+
- 只注册提示词,不提供工具;无外网请求。
|
package/cordis.patch.yml
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const name = 'dsh-doc-routing-guard'
|
|
2
|
+
|
|
3
|
+
export const inject = ['systemPrompt']
|
|
4
|
+
|
|
5
|
+
const TEXT = `处理文档时按下面的默认路径,不要靠文件名猜内容:
|
|
6
|
+
- PDF:若 ocr_read 可用(装了 dsh-tool-ocr)优先用它;若 doc_route / pdf_markdown 可用(装了 dsh-doc-router)也可以;都没有时用 read_document 或 office-render,并明确说明限制,不要假装读到了内容。
|
|
7
|
+
- 图片/截图:需要文字时先 ocr_read(若可用);需要看版式、颜色、界面状态时才 read_image。
|
|
8
|
+
- docx / xlsx / pptx:优先 office 技能;否则 read_document(若存在);不要手工解压 XML。
|
|
9
|
+
- 上传文件或工作区文件:先确认类型,再选上面的路径;没有合适工具时明确说明限制,不要假装读到了内容。
|
|
10
|
+
- 引用 OCR 结果时提醒用户校对数字、邮箱、上下标(OCR 常在这些地方出错)。
|
|
11
|
+
- 使用 knowledge_search 检索后,回答里引用事实时在句末标注来源:(来源:<文档名> · chunk <chunkIndex>);没有检索到依据就直说,不要编。`
|
|
12
|
+
|
|
13
|
+
export function apply(ctx) {
|
|
14
|
+
ctx.effect(() => ctx.systemPrompt.section({
|
|
15
|
+
name: 'doc-routing',
|
|
16
|
+
order: 350,
|
|
17
|
+
text: TEXT
|
|
18
|
+
}), 'dsh-doc-router: document routing')
|
|
19
|
+
}
|
|
20
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-doc-routing-guard",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "全局文档路由提示:PDF/图片在 ocr_read 可用时优先,Office 用 office 技能,缺失工具时退到内置 read_document/office-render 并说明限制。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js",
|
|
9
|
+
"./package.json": "./package.json"
|
|
10
|
+
},
|
|
11
|
+
"dsh": {
|
|
12
|
+
"bundle": {
|
|
13
|
+
"patch": "./cordis.patch.yml"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"dsh",
|
|
19
|
+
"dsh-plugin",
|
|
20
|
+
"deepseek-harness",
|
|
21
|
+
"document",
|
|
22
|
+
"ocr",
|
|
23
|
+
"routing"
|
|
24
|
+
],
|
|
25
|
+
"author": "local",
|
|
26
|
+
"files": [
|
|
27
|
+
"lib",
|
|
28
|
+
"cordis.patch.yml",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
}
|
|
35
|
+
}
|