dsh-plugin-aipp 0.0.0-stage → 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 +19 -0
- package/README.md +50 -2
- package/cordis.patch.yml +16 -0
- package/glue/index.js +76 -0
- package/glue/package.json +8 -0
- package/icon.svg +13 -0
- package/install.ps1 +22 -0
- package/launcher.mjs +125 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +48 -4
- package/presets/aipp-dsh-inventoryagent.patch.yml +8 -0
- package/server/index.js +25 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
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
|
+
|
|
10
|
+
## 0.1.0 - 2026-11-30
|
|
11
|
+
- 2026-11-30
|
|
12
|
+
|
|
13
|
+
- 首版发布。
|
|
14
|
+
- MCP stdio 挂载 M10 Publisher 14 工具(发布组 5 + 数据知识组 9),stdio 由 `launcher.mjs` 拉起。
|
|
15
|
+
- launcher 探测顺序:环境变量 `M10_PUBLISHER_HOME` > 相对路径 > `m10-publisher.home` > 常见默认路径;找不到时输出中文引导并优雅退出。
|
|
16
|
+
- 发布组工具:app_publish / app_list / app_update / app_unpublish / list_categories(三写事务 + 审计留痕)。
|
|
17
|
+
- 数据知识组:ds_query(数据源只读 SQL)、guard_check、kb_search / kb_doc_read、memory_save / memory_recall 等。
|
|
18
|
+
- 附 glue 插件:`/m10` 命令 + `tools/pre-execute` 写操作确认守卫。
|
|
19
|
+
- 已知限制:本插件为 M10 Publisher 的伴侣包,需先安装 Publisher(根目录 `install.ps1`)才有可用工具;嵌入模型未就绪时知识库检索自动降级为关键词匹配;Publisher 当前为单用户本机口径(服务绑定 127.0.0.1)。
|
package/README.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-aipp — AI 工作发布台(DeepSeek Harness 插件)
|
|
2
|
+
|
|
3
|
+
本插件是 **M10 Publisher(AI 工作发布台)** 的 DSH 伴侣包:把 DSH 会话中生成的智能体、小程序、应用和数据大屏一键发布成卡片,提供发布画廊、分类管理、上架/下线/审计、数据源只读取数、本地文件夹知识库与统计大屏。
|
|
4
|
+
|
|
5
|
+
**本插件提供 14 个 MCP 工具,无独立界面,必须配合 M10 Publisher 使用**——MCP 工具实际由 Publisher 提供,未安装 Publisher 时插件可用性为零(launcher 会输出中文引导)。
|
|
6
|
+
|
|
7
|
+
## 主要特点
|
|
8
|
+
|
|
9
|
+
1. 数据保存在本机,不上传业务数据;数据源口令经 Windows DPAPI(本机当前用户)加密落库;
|
|
10
|
+
2. 零外部依赖,开箱即用;发布组 5 个 MCP 工具 + 数据知识组 9 个工具,`dependencies` 为空(纯 Node 内置模块);
|
|
11
|
+
3. 发布全生命周期闭环:DSH 会话一句话发布 → 卡片画廊(分类/类型/搜索)→ 发布管理(上架/下线/改分类/批量)→ 全程审计留痕;
|
|
12
|
+
4. 数据与知识双对接:SQL Server / MySQL / PostgreSQL 数据源只读取数、本地文件夹知识库全文检索;
|
|
13
|
+
5. 中英双语切换、Windows 风格多时区、暗色模式、Ctrl+K 命令面板。
|
|
14
|
+
|
|
15
|
+
## 前置安装(M10 Publisher,必做)
|
|
16
|
+
|
|
17
|
+
插件功能由 Publisher 提供,先在任意目录完成 Publisher 安装(不写死盘符):
|
|
18
|
+
|
|
19
|
+
```powershell
|
|
20
|
+
git clone https://github.com/baihui3311/dsh-aipp.git <安装目录>
|
|
21
|
+
cd <安装目录>
|
|
22
|
+
powershell -ExecutionPolicy Bypass -File install.ps1
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`install.ps1` 会在 `<安装目录>` 内创建 `.venv`、初始化 `data\m10agent.db`(SQLite + 种子数据)、生成 `.env`。
|
|
26
|
+
|
|
27
|
+
## 插件安装(DSH 宿主)
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
dsh plugin --profile <name> add <安装目录>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
(或按插件市场的安装入口直接安装;`cordis.patch.yml` 以 `node launcher.mjs` 拉起 MCP 服务器。)
|
|
34
|
+
|
|
35
|
+
## 验证
|
|
36
|
+
|
|
37
|
+
1. 启动 Publisher 后端:`cd <安装目录>\backend && .venv\Scripts\python.exe -m uvicorn app.main:app --host 127.0.0.1 --port 8000`,浏览器打开发布台 `http://127.0.0.1:8000/`;
|
|
38
|
+
2. 重启 DSH 宿主(或设置环境变量 `M10_PUBLISHER_HOME=<安装目录>` 后重启);
|
|
39
|
+
3. 新建 DSH 会话,说「列出可发布分类」——走 `list_categories` 工具返回分类表即安装成功。
|
|
40
|
+
|
|
41
|
+
## 技术栈
|
|
42
|
+
|
|
43
|
+
FastAPI + SQLAlchemy 2.0 + SQLite(WAL)· 无构建依赖的单文件 SPA(DSH token 设计体系)· MCP stdio(`launcher.mjs` 拉起)· Windows DPAPI。
|
|
44
|
+
|
|
45
|
+
## 免责声明
|
|
46
|
+
|
|
47
|
+
本项目为个人开发、个人维护,不是 DeepSeek 或其他公司的官方产品,与相关公司不存在隶属或授权关系。
|
|
48
|
+
|
|
49
|
+
> 0.1.1 起:知识库 4 处修复位于 Publisher 仓库(backend/),npm 包只含插件壳。
|
|
50
|
+
> 升级插件后请同步 git pull Publisher 最新代码,否则知识库工具仍然不可用。
|
|
2
51
|
|
|
3
|
-
This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# dsh-aipp patch 层:把本包作为插件载入宿主,由 server/index.js 的 apply()
|
|
2
|
+
# 通过 ctx.mcpManager.register('m10', ...) 自注册 MCP stdio 服务器。
|
|
3
|
+
#
|
|
4
|
+
# 前置:本插件是 M10 Publisher(AI 工作发布台)的伴侣包——MCP 工具实际由
|
|
5
|
+
# Publisher 提供,需先完成 Publisher 前置安装(见 README「前置安装」,
|
|
6
|
+
# 或环境变量 M10_PUBLISHER_HOME 指向 Publisher 安装目录)。
|
|
7
|
+
# 设计:服务器注册路径由 server/index.js 以 import.meta.url 自身定位
|
|
8
|
+
# (join(pkgRoot, 'launcher.mjs')),仓库内不含任何机器绝对路径;
|
|
9
|
+
# 找不到 Publisher 时 launcher 输出中文引导并优雅退出,不拖垮宿主。
|
|
10
|
+
# 红线:patch env 只放非敏感项;数据源口令永不出 M10 侧 DPAPI(项目红线)。
|
|
11
|
+
# 注意:本文件不得再直接 insert @deepseek-ai/dsh-mcp-client(会与
|
|
12
|
+
# apply() 里的 register('m10') 重名抛错);presets 内层亦不得重复声明。
|
|
13
|
+
|
|
14
|
+
- insert:
|
|
15
|
+
- id: aipp
|
|
16
|
+
name: 'dsh-plugin-aipp'
|
package/glue/index.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* m10-glue:M10 发布台 glue 插件(cordis 风格,对标 @deepseek-ai/dsh-command-compact)。
|
|
3
|
+
*
|
|
4
|
+
* G1 v2 能力:
|
|
5
|
+
* - /m10 [过滤词] 命令:列出发布台发布物
|
|
6
|
+
* - tools/pre-execute guard 前置钩子:写类操作(starwood_api Save / ds_query 非 SELECT)
|
|
7
|
+
* 经 M10 command_policy 判定(forbidden→deny / prompt→ask / allow→undefined 放行)
|
|
8
|
+
* - systemPrompt 注入发布话术段(≤2KB,随 server instructions 互补)
|
|
9
|
+
*
|
|
10
|
+
* 安装:dsh plugin --profile <name> add <Publisher 仓库>/glue(或随 dsh-aipp 包内 glue/ 一起交付)
|
|
11
|
+
* (bundle/cordis.patch.yml 中的 m10-glue 行在安装后生效)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const name = 'm10-glue'
|
|
15
|
+
export const inject = ['commands']
|
|
16
|
+
|
|
17
|
+
const BASE = 'http://127.0.0.1:8000/api/v1'
|
|
18
|
+
|
|
19
|
+
/** 写类工具/操作清单(guard 前置钩子拦截范围)。 */
|
|
20
|
+
const WRITE_TOOLS = new Set([
|
|
21
|
+
'mcp__m10__starwood_api',
|
|
22
|
+
'mcp__m10__app_publish',
|
|
23
|
+
'mcp__m10__app_update',
|
|
24
|
+
'mcp__m10__app_unpublish',
|
|
25
|
+
])
|
|
26
|
+
|
|
27
|
+
async function m10List(q) {
|
|
28
|
+
const url = `${BASE}/publish-entries${q ? `?q=${encodeURIComponent(q)}` : ''}`
|
|
29
|
+
const r = await fetch(url)
|
|
30
|
+
const j = await r.json()
|
|
31
|
+
if (j.code !== 0) throw new Error(j.message || `HTTP ${r.status}`)
|
|
32
|
+
const items = (j.data?.items || []).map((i) => {
|
|
33
|
+
const mark = i.status === 'published' ? '●' : '○'
|
|
34
|
+
return `${mark} ${i.title} [${i.kind}] ${i.category}${i.source ? ` · ${i.source}` : ''}`
|
|
35
|
+
})
|
|
36
|
+
return {
|
|
37
|
+
text: items.length
|
|
38
|
+
? `M10 发布物(${j.data.total}):\n${items.join('\n')}`
|
|
39
|
+
: '暂无发布物 —— 在 DSH 会话中用 app_publish 即可发布,或说「…发布到某分类」。',
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function apply(ctx) {
|
|
44
|
+
// —— /m10 命令注册 ——
|
|
45
|
+
ctx.effect(function* () {
|
|
46
|
+
yield ctx.commands.register({
|
|
47
|
+
definitionId: 'm10-glue:publish-list',
|
|
48
|
+
name: 'm10',
|
|
49
|
+
description: 'M10 发布物清单(/m10 [过滤词];也可说「…发布到某分类」走 app_publish)',
|
|
50
|
+
handler: async (invocation) => {
|
|
51
|
+
try {
|
|
52
|
+
const out = await m10List(invocation.rawInput.trim())
|
|
53
|
+
return { kind: 'success', text: out.text }
|
|
54
|
+
} catch (error) {
|
|
55
|
+
return {
|
|
56
|
+
kind: 'error',
|
|
57
|
+
text: `M10 发布台不可达(127.0.0.1:8000):${error instanceof Error ? error.message : String(error)}`,
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
}, 'm10-glue command lifecycle')
|
|
63
|
+
|
|
64
|
+
// —— guard 前置钩子(tools/pre-execute):写类操作经 M10 command_policy 判定 ——
|
|
65
|
+
// cordis waterfall 语义:监听器不调 next() 即否决整链(含内建 allow 兜底)。
|
|
66
|
+
// 因此非写工具与任何异常路径都必须 return next(),否则所有工具调用炸 gate.kind。
|
|
67
|
+
ctx.effect(function* () {
|
|
68
|
+
yield ctx.on('tools/pre-execute', async (exec, next) => {
|
|
69
|
+
const raw = exec?.name || ''
|
|
70
|
+
const bare = raw.replace(/^mcp__m10__/, '')
|
|
71
|
+
if (!WRITE_TOOLS.has(raw) && !WRITE_TOOLS.has(`mcp__m10__${bare}`)) return next()
|
|
72
|
+
// 写操作统一走 UI 确认(ask):策略细节由 agent 侧 guard_check MCP 工具自查
|
|
73
|
+
return { kind: 'ask', reason: `M10 guard:写操作(${bare})需要确认后执行` }
|
|
74
|
+
})
|
|
75
|
+
}, 'm10-glue guard hook lifecycle')
|
|
76
|
+
}
|
package/icon.svg
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#4C8BF5"/>
|
|
5
|
+
<stop offset="1" stop-color="#6BA3FF"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect x="2" y="2" width="60" height="60" rx="14" fill="url(#bg)"/>
|
|
9
|
+
<path d="M14 48 L26 22 L36 42 L44 26 L52 48 Z" fill="#ffffff" stroke="none"/>
|
|
10
|
+
<path d="M26 22 L36 42" stroke="#4C8BF5" stroke-width="1.6" fill="none"/>
|
|
11
|
+
<text x="40" y="16" font-family="Arial, sans-serif" font-size="11" font-weight="700" fill="#ffffff">AI</text>
|
|
12
|
+
<path d="M56 10 l1.6 3.4 3.4 1.6 -3.4 1.6 -1.6 3.4 -1.6 -3.4 -3.4 -1.6 3.4 -1.6 Z" fill="#ffffff"/>
|
|
13
|
+
</svg>
|
package/install.ps1
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# dsh-aipp:前置安装 M10 Publisher(AI 工作发布台)。
|
|
2
|
+
# 在本仓库根目录执行;安装到当前目录(不写死任何盘符)。
|
|
3
|
+
# 说明:本插件是 M10 Publisher 的 DSH 伴侣包——MCP 工具由 Publisher 提供,
|
|
4
|
+
# 需要先完成 Publisher 前置安装(.venv + data/m10agent.db)。
|
|
5
|
+
$ErrorActionPreference = "Stop"
|
|
6
|
+
$Root = $PSScriptRoot
|
|
7
|
+
|
|
8
|
+
Write-Host "[dsh-aipp] 前置安装 M10 Publisher 到:$Root"
|
|
9
|
+
& powershell -ExecutionPolicy Bypass -File (Join-Path $Root "scripts\local_install.ps1")
|
|
10
|
+
if ($LASTEXITCODE -ne 0) { throw "[dsh-aipp] M10 Publisher 前置安装失败(见上方日志)。" }
|
|
11
|
+
|
|
12
|
+
Write-Host ""
|
|
13
|
+
Write-Host "[dsh-aipp] Publisher 前置安装完成(.venv + data\m10agent.db 已就绪)。"
|
|
14
|
+
Write-Host "[dsh-aipp] 启动 Publisher 后端:"
|
|
15
|
+
Write-Host "[dsh-aipp] cd $Root\backend"
|
|
16
|
+
Write-Host "[dsh-aipp] .venv\Scripts\python.exe -m uvicorn app.main:app --host 127.0.0.1 --port 8000"
|
|
17
|
+
Write-Host "[dsh-aipp] 发布台界面:http://127.0.0.1:8000/"
|
|
18
|
+
Write-Host ""
|
|
19
|
+
Write-Host "[dsh-aipp] 让本插件可用(任选其一):"
|
|
20
|
+
Write-Host "[dsh-aipp] 1. 重启 DSH 宿主——launcher 按默认路径探测到本目录;"
|
|
21
|
+
Write-Host "[dsh-aipp] 2. 或设置环境变量 M10_PUBLISHER_HOME=$Root 后重启 DSH。"
|
|
22
|
+
Write-Host "[dsh-aipp] 验证:新建 DSH 会话,说「列出可发布分类」(走 list_categories 工具)。"
|
package/launcher.mjs
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* dsh-aipp MCP stdio launcher。
|
|
4
|
+
*
|
|
5
|
+
* 本插件是 M10 Publisher(AI 工作发布台)的 DSH 伴侣包:MCP 工具实际由
|
|
6
|
+
* M10 Publisher 的 MCP stdio 服务器(app.mcp_stdio,14 个工具)提供,
|
|
7
|
+
* 本 launcher 负责定位 Publisher 安装目录并拉起它(stdio 直通)。
|
|
8
|
+
*
|
|
9
|
+
* 探测顺序:
|
|
10
|
+
* 1. 环境变量 M10_PUBLISHER_HOME(最高优先)
|
|
11
|
+
* 2. launcher 相对位置(仓库根/backend,整仓 clone 用户)
|
|
12
|
+
* 3. m10-publisher.home 配置文件(与本 launcher 同目录)
|
|
13
|
+
* 4. 常见默认安装路径列表
|
|
14
|
+
*
|
|
15
|
+
* 找不到时向 stderr 输出中文引导并以非零码退出(不拖垮宿主)。
|
|
16
|
+
*/
|
|
17
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
18
|
+
import { spawn } from 'node:child_process';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
import { fileURLToPath } from 'node:url';
|
|
21
|
+
import os from 'node:os';
|
|
22
|
+
|
|
23
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
+
const TAG = '[dsh-aipp]';
|
|
25
|
+
|
|
26
|
+
function candidateList() {
|
|
27
|
+
const list = [];
|
|
28
|
+
const home = process.env.M10_PUBLISHER_HOME;
|
|
29
|
+
// 特殊值 off:显式禁用自动探测(用于验证引导退出路径,或已知环境不想自动挂载)
|
|
30
|
+
if (home && home.trim().toLowerCase() === 'off') return list;
|
|
31
|
+
if (home && home.trim()) list.push({ src: 'env M10_PUBLISHER_HOME', dir: home.trim() });
|
|
32
|
+
// 整仓 clone:launcher 在仓库根,Publisher home = 仓库根(含 .venv 与 backend/)
|
|
33
|
+
list.push({ src: '相对路径(仓库根)', dir: here });
|
|
34
|
+
const cfg = path.join(here, 'm10-publisher.home');
|
|
35
|
+
if (existsSync(cfg)) {
|
|
36
|
+
const v = readFileSync(cfg, 'utf8').trim();
|
|
37
|
+
if (v) list.push({ src: 'm10-publisher.home', dir: v });
|
|
38
|
+
}
|
|
39
|
+
// 常见默认安装路径(盘符动态拼装,避免源代码出现具体盘符)
|
|
40
|
+
const sep = path.sep;
|
|
41
|
+
for (const drive of ['C', 'D', 'E', 'F', 'G']) {
|
|
42
|
+
list.push({ src: '默认路径', dir: drive + ':' + sep + 'M10-Publisher' });
|
|
43
|
+
}
|
|
44
|
+
list.push({ src: '默认路径', dir: path.join(os.homedir(), 'M10-Publisher') });
|
|
45
|
+
return list;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function isPublisherHome(dir) {
|
|
49
|
+
if (!dir) return false;
|
|
50
|
+
const pyWin = path.join(dir, '.venv', 'Scripts', 'python.exe');
|
|
51
|
+
const pyPosix = path.join(dir, '.venv', 'bin', 'python');
|
|
52
|
+
const appEntry = path.join(dir, 'backend', 'app', 'main.py');
|
|
53
|
+
return existsSync(appEntry) && (existsSync(pyWin) || existsSync(pyPosix));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function pythonExe(home) {
|
|
57
|
+
const pyWin = path.join(home, '.venv', 'Scripts', 'python.exe');
|
|
58
|
+
if (existsSync(pyWin)) return pyWin;
|
|
59
|
+
return path.join(home, '.venv', 'bin', 'python');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const found = candidateList().find((c) => isPublisherHome(c.dir));
|
|
63
|
+
|
|
64
|
+
if (!found) {
|
|
65
|
+
console.error(TAG + ' 未找到 M10 Publisher 安装目录。');
|
|
66
|
+
console.error(TAG + ' 本插件是 M10 Publisher(AI 工作发布台)的 DSH 伴侣包:');
|
|
67
|
+
console.error(TAG + ' 14 个 MCP 工具实际由 M10 Publisher 提供,需要先安装 Publisher 后本插件才有可用功能。');
|
|
68
|
+
console.error(TAG + ' 处理方式(任选其一):');
|
|
69
|
+
console.error(TAG + ' 1. 按 https://github.com/baihui3311/dsh-aipp 的 README 完成前置安装');
|
|
70
|
+
console.error(TAG + ' (克隆仓库后运行根目录 install.ps1,会创建 .venv 与 data/m10agent.db);');
|
|
71
|
+
console.error(TAG + ' 2. 或设置环境变量 M10_PUBLISHER_HOME 指向 Publisher 安装目录');
|
|
72
|
+
console.error(TAG + ' (目录内需有 .venv 与 backend\\app\\main.py)。');
|
|
73
|
+
console.error(TAG + ' 本次探测过的位置:');
|
|
74
|
+
for (const c of candidateList()) console.error(TAG + ' - ' + c.src + ' => ' + c.dir);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const home = path.resolve(found.dir);
|
|
79
|
+
const pyExe = pythonExe(home);
|
|
80
|
+
const backendDir = path.join(home, 'backend');
|
|
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
|
+
|
|
103
|
+
console.error(TAG + ' M10 Publisher:' + home);
|
|
104
|
+
console.error(TAG + ' 拉起 MCP stdio 服务器(14 工具)…');
|
|
105
|
+
|
|
106
|
+
const child = spawn(pyExe, ['-X', 'utf8', '-m', 'app.mcp_stdio'], {
|
|
107
|
+
cwd: backendDir,
|
|
108
|
+
stdio: 'inherit',
|
|
109
|
+
env: {
|
|
110
|
+
...process.env,
|
|
111
|
+
APP_DB_KIND: 'sqlite',
|
|
112
|
+
APP_DB_PATH: path.join(home, 'data', 'm10agent.db'),
|
|
113
|
+
M10_EXPORTS_DIR: path.join(home, 'work', 'exports'),
|
|
114
|
+
M10_ALLOW_DEV_JWT_SECRET: process.env.M10_ALLOW_DEV_JWT_SECRET || '1',
|
|
115
|
+
PYTHONIOENCODING: 'utf-8',
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
child.on('error', (err) => {
|
|
120
|
+
console.error(TAG + ' MCP server 启动失败:' + (err && err.message ? err.message : String(err)));
|
|
121
|
+
process.exit(1);
|
|
122
|
+
});
|
|
123
|
+
child.on('exit', (code, signal) => {
|
|
124
|
+
process.exit(code ?? (signal ? 1 : 0));
|
|
125
|
+
});
|
package/locale/en.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "AI Work Publisher (dsh-aipp)",
|
|
4
|
+
"description": "Publish agents, mini-apps, apps and dashboards generated in DSH sessions as cards: publish gallery, category management, online/offline with audit trail, data-source read-only queries and local-folder knowledge base. Requires M10 Publisher installed first (this plugin provides 14 MCP tools, no standalone UI)."
|
|
5
|
+
}
|
|
6
|
+
}
|
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-aipp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "AI 工作发布台(M10 Publisher)DSH 伴侣包:把 DSH 会话生成的智能体/小程序/应用/数据大屏发布成卡片。提供 14 个 MCP 工具(发布 5 + 数据知识 9),无独立界面,配合 M10 Publisher 使用。",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.13.0",
|
|
9
|
+
"dsh": ">=0.2.0-rc.2"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/baihui3311/dsh-aipp.git"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"dsh-plugin",
|
|
17
|
+
"deepseek-harness",
|
|
18
|
+
"mcp",
|
|
19
|
+
"ai-publishing",
|
|
20
|
+
"publisher"
|
|
21
|
+
],
|
|
22
|
+
"author": "baihui3311",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": "./server/index.js",
|
|
26
|
+
"./locale/*.json": "./locale/*.json",
|
|
27
|
+
"./icon": "./icon.svg"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"launcher.mjs",
|
|
31
|
+
"server/",
|
|
32
|
+
"locale/",
|
|
33
|
+
"presets/",
|
|
34
|
+
"glue/",
|
|
35
|
+
"install.ps1",
|
|
36
|
+
"cordis.patch.yml",
|
|
37
|
+
"icon.svg",
|
|
38
|
+
"CHANGELOG.md",
|
|
39
|
+
"README.md"
|
|
40
|
+
],
|
|
41
|
+
"dependencies": {},
|
|
42
|
+
"dsh": {
|
|
43
|
+
"bundle": {
|
|
44
|
+
"patch": [
|
|
45
|
+
"./cordis.patch.yml",
|
|
46
|
+
"./presets/aipp-dsh-inventoryagent.patch.yml"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
package/server/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
|
|
21
|
+
export function describe() {
|
|
22
|
+
return { name, version, kind, launcher: './launcher.mjs', tools: 14 }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default { name, version, kind, apply, describe }
|