dsh-plugin-aipp 0.1.0 → 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 CHANGED
@@ -1,6 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 - 2026-12-02
4
+
5
+ - 修复插件包层:MCP 服务器注册改为 server/index.js 官方自注册(ctx.mcpManager.register,路径由 import.meta.url 自身定位,零机器绝对路径);cordis.patch.yml 与 preset 不再直接/重复 insert dsh-mcp-client(重名会抛错、双进程)。
6
+ - 修复 Publisher KB 链路 4 处:kb_search 返回 dataclass 序列化(asdict);kb_ingest 先 commit 再解析(原恒 pending);kb.py 按 id 精确认领(原键名错恒不成立);kb_pipeline 无嵌入模型时按 KB_EMBEDDING_ENABLED=false 显式降级为无向量入库;kb_search 过滤零分候选。
7
+ - launcher.mjs:空库自检(data/m10agent.db 缺失或 0 表时 stderr 中文引导,不阻断宿主)。
8
+ - 兼容性:patch 与 preset 必须同时去 m10 声明(本次已同步);出参只增字段不删改。
9
+
3
10
  ## 0.1.0 - 2026-11-30
11
+ - 2026-11-30
4
12
 
5
13
  - 首版发布。
6
14
  - MCP stdio 挂载 M10 Publisher 14 工具(发布组 5 + 数据知识组 9),stdio 由 `launcher.mjs` 拉起。
package/README.md CHANGED
@@ -45,3 +45,7 @@ FastAPI + SQLAlchemy 2.0 + SQLite(WAL)· 无构建依赖的单文件 SPA(D
45
45
  ## 免责声明
46
46
 
47
47
  本项目为个人开发、个人维护,不是 DeepSeek 或其他公司的官方产品,与相关公司不存在隶属或授权关系。
48
+
49
+ > 0.1.1 起:知识库 4 处修复位于 Publisher 仓库(backend/),npm 包只含插件壳。
50
+ > 升级插件后请同步 git pull Publisher 最新代码,否则知识库工具仍然不可用。
51
+
package/cordis.patch.yml CHANGED
@@ -1,20 +1,16 @@
1
- # dsh-aipp patch 层:把 M10 Publisher 的 MCP stdio 服务器挂载进 DSH 宿主。
1
+ # dsh-aipp patch 层:把本包作为插件载入宿主,由 server/index.js 的 apply()
2
+ # 通过 ctx.mcpManager.register('m10', ...) 自注册 MCP stdio 服务器。
2
3
  #
3
4
  # 前置:本插件是 M10 Publisher(AI 工作发布台)的伴侣包——MCP 工具实际由
4
5
  # Publisher 提供,需先完成 Publisher 前置安装(见 README「前置安装」,
5
6
  # 或环境变量 M10_PUBLISHER_HOME 指向 Publisher 安装目录)。
6
- # 设计:command 用宿主 node 启动包内 launcher.mjs,由 launcher 按探测顺序
7
- # 定位 Publisher(环境变量 > 相对路径 > m10-publisher.home > 默认列表),
8
- # 仓库内不含任何机器绝对路径;找不到时输出中文引导并优雅退出。
7
+ # 设计:服务器注册路径由 server/index.js 以 import.meta.url 自身定位
8
+ # (join(pkgRoot, 'launcher.mjs')),仓库内不含任何机器绝对路径;
9
+ # 找不到 Publisher 时 launcher 输出中文引导并优雅退出,不拖垮宿主。
9
10
  # 红线:patch env 只放非敏感项;数据源口令永不出 M10 侧 DPAPI(项目红线)。
10
- # failOnStartupError 保持默认 false:找不到 Publisher 不拖垮宿主。
11
+ # 注意:本文件不得再直接 insert @deepseek-ai/dsh-mcp-client(会与
12
+ # apply() 里的 register('m10') 重名抛错);presets 内层亦不得重复声明。
11
13
 
12
14
  - insert:
13
- - id: aipp-mcp
14
- name: '@deepseek-ai/dsh-mcp-client'
15
- config:
16
- serverName: m10
17
- transport: stdio
18
- command: 'node'
19
- args: ['launcher.mjs']
20
- toolCallTimeoutMs: 300000
15
+ - id: aipp
16
+ name: 'dsh-plugin-aipp'
package/launcher.mjs CHANGED
@@ -79,6 +79,27 @@ const home = path.resolve(found.dir);
79
79
  const pyExe = pythonExe(home);
80
80
  const backendDir = path.join(home, 'backend');
81
81
 
82
+ // A4 空库自检:data/m10agent.db 缺失或 0 张表 → stderr 中文引导(不阻断宿主)
83
+ const dbFile = path.join(home, 'data', 'm10agent.db');
84
+ if (!existsSync(dbFile)) {
85
+ console.error(TAG + ' ⚠ Publisher 数据库尚未初始化(data/m10agent.db 不存在):');
86
+ console.error(TAG + ' 请先运行 ' + home + '\\scripts\\init_db.py(或重跑 install.ps1)。工具调用在初始化前将报错。');
87
+ } else {
88
+ const probe = spawn(pyExe, ['-c', "import sqlite3;print(len(sqlite3.connect(r'" + dbFile + "').execute('select name from sqlite_master').fetchall()))"], {
89
+ cwd: backendDir,
90
+ stdio: ['ignore', 'pipe', 'ignore'],
91
+ timeout: 5000,
92
+ });
93
+ probe.on('error', () => { /* probe failure is ignored */ });
94
+ probe.stdout.on('data', (chunk) => {
95
+ const tables = parseInt(String(chunk).trim(), 10);
96
+ if (!Number.isNaN(tables) && tables === 0) {
97
+ console.error(TAG + ' ⚠ Publisher 数据库尚未初始化(0 张表):');
98
+ console.error(TAG + ' 请先运行 scripts\\init_db.py。工具调用在初始化前将报错。');
99
+ }
100
+ });
101
+ }
102
+
82
103
  console.error(TAG + ' M10 Publisher:' + home);
83
104
  console.error(TAG + ' 拉起 MCP stdio 服务器(14 工具)…');
84
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-aipp",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "AI 工作发布台(M10 Publisher)DSH 伴侣包:把 DSH 会话生成的智能体/小程序/应用/数据大屏发布成卡片。提供 14 个 MCP 工具(发布 5 + 数据知识 9),无独立界面,配合 M10 Publisher 使用。",
5
5
  "private": false,
6
6
  "type": "module",
@@ -4,12 +4,5 @@
4
4
  config:
5
5
  id: aipp-dsh-inventoryagent
6
6
  order: 100
7
- plugins:
8
- - id: aipp-mcp
9
- name: '@deepseek-ai/dsh-mcp-client'
10
- config:
11
- serverName: m10
12
- transport: stdio
13
- command: 'node'
14
- args: ['launcher.mjs']
15
- toolCallTimeoutMs: 300000
7
+ # 注意:此 preset 不再内层声明 m10 MCP 服务器(全局唯一实例由
8
+ # server/index.js apply() 注册);preset 下的 agent 直接使用全局 m10 工具。
package/server/index.js CHANGED
@@ -1,17 +1,25 @@
1
- // server/index.js — dsh-aipp 包元数据入口。
2
- // 本插件为 MCP 挂载型:运行时入口是 launcher.mjs(由 cordis.patch.yml 以
3
- // `node launcher.mjs` 拉起),此文件仅提供编程侧元数据读取。
4
- export const name = "dsh-plugin-aipp";
5
- export const version = "0.1.0";
6
- export const kind = "mcp-stdio-mount";
1
+ import { dirname, join } from 'node:path'
2
+ import { fileURLToPath } from 'node:url'
3
+
4
+ const pkgRoot = dirname(dirname(fileURLToPath(import.meta.url)))
5
+
6
+ export const name = 'dsh-plugin-aipp'
7
+ export const version = '0.1.1'
8
+ export const kind = 'mcp-stdio-mount'
9
+ export const inject = ['mcpManager']
10
+
11
+ export function apply(ctx) {
12
+ ctx.mcpManager.register('m10', {
13
+ transport: 'stdio',
14
+ command: 'node',
15
+ args: [join(pkgRoot, 'launcher.mjs')],
16
+ cwd: pkgRoot,
17
+ toolCallTimeoutMs: 300000,
18
+ })
19
+ }
20
+
7
21
  export function describe() {
8
- return {
9
- name,
10
- version,
11
- kind,
12
- launcher: "./launcher.mjs",
13
- tools: 14,
14
- requires: "M10 Publisher (set M10_PUBLISHER_HOME or run install.ps1)",
15
- };
22
+ return { name, version, kind, launcher: './launcher.mjs', tools: 14 }
16
23
  }
17
- export default { name, version, kind, describe };
24
+
25
+ export default { name, version, kind, apply, describe }