vod-devkit 0.5.4 → 0.5.5

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 (37) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/bin/vod-devkit +2 -4
  3. package/contract/tools.schema.json +1 -1
  4. package/integrations/atomcode/host.json +5 -3
  5. package/integrations/codeartsdoer/host.json +1 -2
  6. package/package.json +1 -1
  7. package/plugins/vod-devkit/.codex-plugin/plugin.json +1 -1
  8. package/plugins/vod-devkit/build-info.json +3 -3
  9. package/plugins/vod-devkit/skills/vod-feedback-collect/SKILL.md +13 -4
  10. package/plugins/vod-devkit/skills/vod-problem-classification-rules/SKILL.md +2 -1
  11. package/plugins/vod-devkit/skills/vod-scoring-rules/SKILL.md +2 -1
  12. package/plugins/vod-devkit/vod_mcp/__init__.py +1 -1
  13. package/plugins/vod-devkit/vod_mcp/attribution.py +8 -8
  14. package/plugins/vod-devkit/vod_mcp/host_adapters/codex.py +16 -3
  15. package/plugins/vod-devkit/vod_mcp/host_adapters/hermes.py +11 -5
  16. package/plugins/vod-devkit/vod_mcp/remote_app.py +25 -0
  17. package/plugins/vod-devkit/vod_mcp/skills_registry.py +6 -5
  18. package/plugins/vod-devkit/vod_mcp/tools.py +15 -17
  19. package/plugins/vod-devkit/vod_mcp/transport_remote.py +48 -0
  20. package/skills/vod-feedback-collect/SKILL.md +13 -4
  21. package/skills/vod-problem-classification-rules/SKILL.md +2 -1
  22. package/skills/vod-scoring-rules/SKILL.md +2 -1
  23. package/vod_mcp/__init__.py +1 -1
  24. package/vod_mcp/attribution.py +8 -8
  25. package/vod_mcp/host_adapters/__pycache__/__init__.cpython-39.pyc +0 -0
  26. package/vod_mcp/host_adapters/__pycache__/atomcode.cpython-39.pyc +0 -0
  27. package/vod_mcp/host_adapters/__pycache__/base.cpython-39.pyc +0 -0
  28. package/vod_mcp/host_adapters/__pycache__/codearts.cpython-39.pyc +0 -0
  29. package/vod_mcp/host_adapters/__pycache__/codex.cpython-314.pyc +0 -0
  30. package/vod_mcp/host_adapters/__pycache__/generic.cpython-39.pyc +0 -0
  31. package/vod_mcp/host_adapters/__pycache__/hermes.cpython-314.pyc +0 -0
  32. package/vod_mcp/host_adapters/codex.py +16 -3
  33. package/vod_mcp/host_adapters/hermes.py +11 -5
  34. package/vod_mcp/remote_app.py +25 -0
  35. package/vod_mcp/skills_registry.py +6 -5
  36. package/vod_mcp/tools.py +15 -17
  37. package/vod_mcp/transport_remote.py +48 -0
package/CHANGELOG.md CHANGED
@@ -322,3 +322,14 @@
322
322
  - c1677c2 feat(工程化): doctor 分层报告 + explain + detect + 宿主矩阵进 CI + 发版 workflow
323
323
  - f9b732c fix(发版): publish_verify 不再误判 propagation 窗口(v0.5.3 实锤)
324
324
 
325
+
326
+ ## v0.5.5(2026-11-13)
327
+
328
+ - f3fa14d fix(归因): 产品名录单一真源=引擎接口 + 清 host_default 残留(评审收口)
329
+ - ec56497 fix(远程面): 载荷自校验不再 import host_adapters + codex 适配改惰性解析
330
+ - a1e44c6 feat(远程面): 抄 devkit 两条守卫——构造期技能树自校验 + 每请求载荷校验
331
+ - b963d84 fix(dsh壳): vod_devkit_info 的 version 改用 PKG_VERSION(写死 0.1.0 实锤)
332
+ - 9feb789 docs(验证): 宿主会话级验证手册(统一网关跑 codex/atomcode 的实测命令)
333
+ - 6c2d9a1 fix(宿主): hermes 路径改为调用期解析 + 新增 host_matrix --audit 巡检
334
+ - 0e688e3 docs(验证): 记真机可达边界 + AtomCode 真机验证结论
335
+
package/bin/vod-devkit CHANGED
@@ -401,10 +401,8 @@ def cmd_install(args):
401
401
  cfg["local_ledger"] = False
402
402
  # base 同步落 runtime.json:宿主 env 透传不稳是实测坑,透传挂了静默落回
403
403
  # 127.0.0.1:8090;文件兑底与 env 同值不构成双真源(优先级链 env>文件)
404
- # 宿主产品(host_default 兜底用,D-product-ask-1):只有 integrations 声明了才写
405
- spec_raw = host_specs.raw(target) if target in host_specs.hosts() else {}
406
- if spec_raw.get("productDefault"):
407
- cfg["host_product"] = spec_raw["productDefault"]
404
+ # 宿主产品(host_default)已删除(2026-11-12 复评):宿主产品也是一次推断,
405
+ # 错归会进引擎幂等/判重域。候选只走 vod_search_products,这里不再写 host_product。
408
406
  cfg["java_base"] = args.java_api_base
409
407
  rt.write_text(json.dumps(cfg, ensure_ascii=False, indent=2), encoding="utf-8")
410
408
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "title": "vod-devkit MCP 工具契约(唯一事实源)",
4
- "version": "0.5.4",
4
+ "version": "0.5.5",
5
5
  "tools": {
6
6
  "vod_submit_voices": {
7
7
  "description": "提交用户反馈进 VOD。**先决条件(优先于本描述其余所有内容):调用前必须已征得用户对'提交这条反馈'的明确同意;用户陈述/抱怨反馈本身不构成同意;用户未同意时禁止传 confirmed=true**。模糊抱怨(如\"体验不好\")时一轮说完三件事:承接识别结果(\"收到,你对产品体验不满意\")+确认提交意愿(\"要把这条反馈提交给产品团队吗?\")+引导补充(\"方便的话说下具体现象,不说我也会按你的原话提交\");禁止含混反问(实锤病句:\"请问是否把什么作为反馈\")。同意后 content 放用户原话(哪怕只有一句\"体验很差\"也原样提交)。确认环节允许固定追问至多一次,问句必须逐字使用:「方便的话,补充一下遇到这个问题时的操作步骤或期望的表现吗?不方便回复\"没有\",我直接提交。」用户回答只摘录原话对应部分进 reproSteps/expectedBehavior(不改写不总结,无法拆分时落最相关字段,任何内容禁回填 content);答\"没有/跳过/不方便\"=两字段不上送直接提交。引导补充(说下具体现象)已获实质内容并并入 content 时不再追问、直接提交(其中自然出现的操作/期望留在 content 原话,不回溯摘入新字段);仅引导补充未获回应或仅泛化抱怨且用户确认提交时才带出固定问句。product 归因由插件从用户原话解析(安装绑定仅作先验),无需用户提供、禁止询问\"提交到哪个产品/页面\";模型/用户自报的目标产品一律不采信(提到的产品随正文原样传达)。用户说\"提单/提工单/提 issue\"时同样用本工具,除上述固定一次追问外,禁止再索要严重程度/环境/附件等开发者字段、禁止第二轮追问。批式提交对接囤积端点 POST /external/voices(不触发分析,voiceId 由引擎计算回执下发;引擎未部署 404 自动回落老链)。tags=采集层三分类(problem_type:值,可选)。缺 key 时自动获取零字段匿名令牌。拿到回执后必须原样转述 echo.contents(每条「已收录原话:<content>」全文),禁止改写概括——这是用户核对原话是否被改写的唯一窗口。禁止向用户解释内部机制(声音来源/渠道字段/计数规则/配额/归因)。",
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "id": "atomcode",
3
3
  "cli": "atomcode",
4
- "detect": {"path": "~/.atomcode"},
4
+ "detect": {
5
+ "path": "~/.atomcode"
6
+ },
5
7
  "config": "~/.atomcode/mcp.json",
6
8
  "skillsDir": "~/.atomcode/skills",
7
- "notes": "AtomCode 的配置根可由 ATOMCODE_HOME 覆盖(默认 ~/.atomcode),适配器每次调用期读取该 env,不缓存。mcp.json 形态 mcpServers.<name> = command/args/env。宿主另有 hooks.json 的 pre_tool_use 遥测 hook——属华为工具的埋点,我们刻意不装(不引入遥测)。路径来源:huaweicloud-devkit targets.ts atomcodeHome/atomcodeMcpConfigFile/atomcodeSkillsDir。本机未装该宿主,未真机验证。"
8
- }
9
+ "notes": "AtomCode 的配置根可由 ATOMCODE_HOME 覆盖(默认 ~/.atomcode),适配器每次调用期读取该 env,不缓存。真机验证(2026-11-12,本机 aarch64 Linux 装 atomcode 5.2.6):`atomcode mcp add <name> <cmd>... --global` 写的正是 ~/.atomcode/mcp.json 的 mcpServers.<name>;用它的写入器追加一条后我们的条目原样保留,说明 schema 兼容、可共存。host_matrix --host atomcode → PASS(8 工具,版本=构建版本)。宿主另有 hooks.json 的 pre_tool_use 遥测 hook 与 telemetry 开关——我们刻意不装/不开启。"
10
+ }
@@ -6,6 +6,5 @@
6
6
  },
7
7
  "config": "~/.codeartsdoer/codearts_cli.json",
8
8
  "skillsDir": "~/.codeartsdoer/skills",
9
- "notes": "CodeArts Agent 是 OpenCode 分支(SCENARIO=codeartsdoer、OPENCODE_CONFIG=codearts_cli.json):mcp 段与 opencode 同 schema(type=local、command=数组、enabled)。实测 2026-11-11:写入 codearts_cli.json 的 mcp.<name> 后 `codearts mcp list` 可见;mcp_settings.json 只对项目级 .codeartsdoer/mcp/ 生效,用户级读 ~/.config/opencode/mcp/,故不要写 ~/.codeartsdoer/mcp/。",
10
- "productDefault": "CodeArts"
9
+ "notes": "CodeArts Agent 是 OpenCode 分支(SCENARIO=codeartsdoer、OPENCODE_CONFIG=codearts_cli.json):mcp 段与 opencode 同 schema(type=local、command=数组、enabled)。实测 2026-11-11:写入 codearts_cli.json 的 mcp.<name> 后 `codearts mcp list` 可见;mcp_settings.json 只对项目级 .codeartsdoer/mcp/ 生效,用户级读 ~/.config/opencode/mcp/,故不要写 ~/.codeartsdoer/mcp/。"
11
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vod-devkit",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "VOD 用户声音采集插件——MCP server + 技能 + 声明式护栏,把 agent 产品的用户反馈安全送进 VOD 平台",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vod-devkit",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "VOD user-feedback collection: structured voice capture and submission to the VOD hoarding endpoint.",
5
5
  "keywords": [
6
6
  "feedback",
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.5.4",
3
- "commitSha": "c1677c20bf82c1594f6b31c8af8737bbc9ba02e0",
4
- "builtAt": "2026-11-12T20:56:50",
2
+ "version": "0.5.5",
3
+ "commitSha": "f3fa14da66a8f1b6ae81b413b01bb6426385dd8b",
4
+ "builtAt": "2026-11-13T01:46:16",
5
5
  "sourceRemote": "https://gitcode.com/xiaowu2119/vod-devkit.git"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: vod-feedback-collect
3
- description: '用户抱怨/体验差/太慢/报错/提单 → 采集原话进 VOD。识别到抱怨即承接并征得同意(禁止问哪个产品,禁止复现排查模式);content=原话逐字;一次抱怨一条;回执 echo 原样转述。详见正文流程与禁令。Triggers: "体验差","太难用","太慢","报错了","出bug了","有bug","反馈问题","反馈建议","提个单","报告问题","不生效","不好使","操作不方便","卡住了","崩溃了","report a problem","bug report","poor experience","feedback"'
3
+ description: '用户抱怨/体验差/太慢/报错/提单 → 采集原话进 VOD。识别到抱怨即承接并征得同意(缺产品先问一次是哪个、不猜也不提交;禁止复现排查模式);content=原话逐字;一次抱怨一条;回执 echo 原样转述。详见正文流程与禁令。Triggers: "体验差","太难用","太慢","报错了","出bug了","有bug","反馈问题","反馈建议","提个单","报告问题","不生效","不好使","操作不方便","卡住了","崩溃了","report a problem","bug report","poor experience","feedback"'
4
4
  tags: [vod, feedback, capture, consent]
5
5
  metadata:
6
6
  version: 1
@@ -180,8 +180,10 @@ metadata:
180
180
  ## 采集流程
181
181
 
182
182
  0. 产品归因(D-product-ask-1,2026-11-12 拍板:不许裸提交 UNKNOWN):
183
- 归因次序 = 用户明确回答 > 原话唯一高置信提及 > 会话记忆(30 分钟) >
184
- 安装先验 > 宿主产品(host_default,仅用户说不知道时,低置信)。
183
+ 归因次序 = 用户明确回答 > 原话唯一高置信提及 > 会话记忆(30 分钟) > 安装先验。
184
+ 四级都拿不到 → **不猜、不提交**,按下面的追问规则请用户补一句产品名
185
+ (2026-11-12 复评删除 host_default 兜底:宿主产品也是一次推断,错归会进
186
+ 引擎幂等/判重域,污染静默且难追溯)。
185
187
  - 原话里只有一个产品名、且不是对比/多产品语境 → 直接用,不再问
186
188
  - 原话有两个以上产品("CodeArts 比 MaaS 好"、"从 CodeArts 导出到 MaaS")
187
189
  → 视为**低置信**,必须问:"这条反馈是哪个产品的?可用候选:…"
@@ -217,7 +219,8 @@ metadata:
217
219
  "网页卡回复慢"被宿主改写成「网页打开,…」+「网页卡,…」两条入库建出
218
220
  两个 issue;引擎幂等按内容逐字比对,改写即绕过)。多条仅当用户明确
219
221
  分条给了多个不同反馈
220
- 4. 拿到回执 → 对用户说人话:"已收录,产品团队会看到这条反馈"——
222
+ 4. 拿到回执 → 对用户说人话:"已收录,产品团队会看到这条反馈";
223
+ (若对方是验证者且明确要编号,按第 0 条例外贴 voiceId)——
221
224
  **voiceId 不展示给终端用户**(编号噪音),仅供 agent 对账用;
222
225
  用户追问"提交了吗"时 agent 用 voiceId/taskId 核对后回答状态
223
226
  5. **无通道 fallback(D-pending-1,插件未安装/无 vod 工具时)**:
@@ -241,6 +244,12 @@ metadata:
241
244
  ## 纪律
242
245
 
243
246
  0. 回执纪律(F2,成功与失败路径同口径):给用户的话=人话
247
+
248
+ **验证/对账例外(2026-11-12 拍板)**:当对方是**验证者**(运维/研发/负责人在
249
+ 核对链路,明确说"把 voiceId 贴出来""我核对下入库")时,允许同样打印
250
+ `voiceId`、`productId`、`productSource`——那是他们的对账主键,不是给反馈提交者看的
251
+ 噪音。判据两条同时满足:①对方明确要求要编号;②对方在验证链路而不是在提交自己的
252
+ 抱怨。终端用户(提交反馈的人)问"提交了吗",仍只回答状态、不展示编号。
244
253
  (成功=已收录/产品团队会看到;失败=提交失败,反馈已暂存本机,
245
254
  稍后会自动重试)。**失败时禁止向用户复述内部诊断字段**——HTTP
246
255
  状态码、apiKeyFingerprint、tokenTier、堆栈等属于 agent 内部排障
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: vod-problem-classification-rules
3
- description: VOD 问题分类规则(引擎 v2.2 真实口径)— 六类定义、判定细节、LLM 分类流程。真源=workflow/src/n01_classify.py(VOD-Project 2bb3fc82 实测核对)。
3
+ description: VOD 问题分类规则(引擎 v2.2 真实口径)— 六类定义、判定细节、LLM 分类流程。
4
4
  tags: [vod, classification, rules]
5
5
  metadata:
6
6
  version: 2
@@ -13,6 +13,7 @@ metadata:
13
13
  > 体验优化/其他)已废弃,与引擎不符——它来自过期文档。
14
14
  > 采集定位:预分类仅作参考 hint(tags),引擎 LLM 按六类重判——
15
15
  > 预分类不是终局,别和用户言之凿凿。
16
+ > 对外复述纪律:可讲口径(六类边界/判定要点),不引用仓库路径、文件行号、提交号。
16
17
 
17
18
  ## 六类定义(引擎 DEFAULT_TYPE_DEFS 原文)
18
19
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: vod-scoring-rules
3
- description: VOD 评分规则(引擎 v2 真实公式)— 四项加法、上下限、优先级映射。真源=workflow/src/workflow_v2.py(VOD-Project 2bb3fc82 实测核对)。
3
+ description: VOD 评分规则(引擎 v2 真实公式)— 四项加法、上下限、优先级映射。
4
4
  tags: [vod, scoring, rules]
5
5
  metadata:
6
6
  version: 2
@@ -11,6 +11,7 @@ metadata:
11
11
  > 真源纪律:以 workflow_v2.py 评分函数为准,2026-11-03 逐行核对。
12
12
  > 旧版"五项维度含用户价值"口径作废——引擎是四项,且非重点问题
13
13
  > 上限不同(下方原文),旧文档没写。
14
+ > 对外复述纪律:可讲公式要点与上下限,不引用仓库路径、文件行号、提交号。
14
15
 
15
16
  ## 评分公式(引擎代码原文语义)
16
17
 
@@ -5,7 +5,7 @@
5
5
  2. 外部无 DB 直连路径(护栏 deny 兜底)
6
6
  3. 任务 ID 是唯一对账主键,写类工具返回一律携带
7
7
  """
8
- __version__ = "0.5.4"
8
+ __version__ = "0.5.5"
9
9
  # 默认上游:VOD 测试环境。外部用户本机无 VOD,回环默认值=装完即坏;
10
10
  # 生产地址定型后只改这一处(tools.py 与 bin/vod-devkit 共用本常量)。
11
11
  DEFAULT_JAVA_BASE = "https://vod-dev.topxtopx.com"
@@ -163,19 +163,19 @@ def build_alias_index(meta: dict) -> list:
163
163
 
164
164
  # ② 品牌俗称表:把无法从表名推导的口语词挂到目标产品上
165
165
  for target_name, colloquials in (BRAND_ALIASES or {}).items():
166
- slot = canon.get(str(target_name).lower())
167
- if slot is None:
166
+ brand_slot: dict | None = canon.get(str(target_name).lower())
167
+ if brand_slot is None:
168
168
  # 目标产品不在本次 catalog(引擎换库/改名):别名不落地,避免指向
169
169
  # 不存在的 id。宁可丢俗称,也不产生错归。
170
170
  continue
171
171
  for word in (colloquials or []):
172
172
  if word:
173
- slot["aliases"].add(str(word).strip())
173
+ brand_slot["aliases"].add(str(word).strip())
174
174
 
175
175
  # ③ 兼容:若引擎仍下发旧字段(回滚场景),继续采纳,避免双向改造期丢能力
176
176
  for key, aliases in (meta.get("nameAliases") or {}).items():
177
177
  aliases = [str(a) for a in (aliases or []) if a]
178
- target = canon.get(str(key).lower())
178
+ target: dict | None = canon.get(str(key).lower())
179
179
  if target is None:
180
180
  for a in aliases:
181
181
  if a.lower() in canon:
@@ -187,10 +187,10 @@ def build_alias_index(meta: dict) -> list:
187
187
  target["aliases"].add(a)
188
188
  target["aliases"].add(str(key))
189
189
  for key, target_name in (meta.get("aliases") or {}).items():
190
- slot = canon.get(str(target_name).lower())
191
- if slot is None: # 目录/展示名都没有该目标:按别名目标建槽,别丢别名
192
- slot = _slot(target_name, False)
193
- slot["aliases"].add(str(key))
190
+ alias_slot: dict | None = canon.get(str(target_name).lower())
191
+ if alias_slot is None: # 目录/展示名都没有该目标:按别名目标建槽,别丢别名
192
+ alias_slot = _slot(target_name, False)
193
+ alias_slot["aliases"].add(str(key))
194
194
 
195
195
  for slot in canon.values(): # 名字/别名任一命中 catalog → 拿 id
196
196
  for alias in list(slot["aliases"]) + [slot["label"]]:
@@ -16,11 +16,24 @@ _AGENTS_MARKER_BEGIN = "<!-- vod-devkit:feedback-skill BEGIN -->"
16
16
  # 且 1705 个历史会话带着它跑(实测)。清理逻辑必须认这个标记,否则残留继续生效。
17
17
  _LEGACY_ONE_LINER = "<!-- vod-submit-one-liner -->"
18
18
  _AGENTS_MARKER_END = "<!-- vod-devkit:feedback-skill END -->"
19
- _SPEC = host_specs.load("codex")
19
+ _SPEC: dict | None = None
20
+
21
+
22
+ def _spec() -> dict:
23
+ """调用期解析宿主配置(模块 import 期读 integrations/ 会在载荷副本里炸)。
24
+
25
+ 2026-11-12 实锤:载荷副本不含 integrations/,import 期 host_specs.load("codex")
26
+ 直接 KeyError → 远程面每个请求 500。宿主配置只在 install 期用得上,运行期
27
+ server 不需要它。
28
+ """
29
+ global _SPEC
30
+ if _SPEC is None:
31
+ _SPEC = host_specs.load("codex")
32
+ return _SPEC
20
33
 
21
34
 
22
35
  def skills_dir(args):
23
- d = _SPEC.get("skillsDir")
36
+ d = _spec().get("skillsDir")
24
37
  return Path(d) if d else None
25
38
 
26
39
 
@@ -98,7 +111,7 @@ def install(args, packs: str) -> Path:
98
111
  if not codex:
99
112
  print("[vod-devkit] 未找到 codex CLI,无法走原生插件安装", file=sys.stderr)
100
113
  sys.exit(2)
101
- spec = host_specs.load("codex")
114
+ spec = _spec()
102
115
  conf = Path(spec["configPath"])
103
116
  if conf.exists(): # 历史遗留:config.toml MCP 段与插件同名=双注册,移除
104
117
  text = conf.read_text(encoding="utf-8")
@@ -14,12 +14,18 @@ from vod_mcp.host_adapters.base import ROOT, server_env, server_entry
14
14
 
15
15
  HOST = "hermes"
16
16
  SUPPORTS_REMOTE = True
17
- _SPEC = host_specs.load("hermes")
18
- _MCP_DIR = Path(_SPEC["configPath"]).parent
17
+ def _spec() -> dict:
18
+ """调用期现读:host.json 的 ~ 必须在调用期按当前 HOME 解析。
19
+
20
+ 2026-11-12 实锤:模块 import 期求值 _MCP_DIR 后,测试里 monkeypatch HOME
21
+ 写不到隔离目录,直接把真实 ~/.hermes/mcp/vod-devkit.json 覆盖成了桩值
22
+ (command=/x/vod_mcp/server.py)——真机 doctor 当场读到坏条目。
23
+ """
24
+ return host_specs.load("hermes")
19
25
 
20
26
 
21
27
  def skills_dir(args):
22
- return Path(_SPEC["skillsDir"])
28
+ return Path(_spec()["skillsDir"])
23
29
 
24
30
 
25
31
  PLUGIN_NAME = "vod-feedback-router"
@@ -67,7 +73,7 @@ def enable_plugin(name: str = PLUGIN_NAME) -> str:
67
73
 
68
74
  def install(args, packs: str) -> Path:
69
75
  """Hermes:官方途径 hermes mcp add(config.yaml mcp_servers)。"""
70
- conf = _MCP_DIR / "vod-devkit.json"
76
+ conf = Path(_spec()["configPath"]).parent / "vod-devkit.json"
71
77
  conf.parent.mkdir(parents=True, exist_ok=True)
72
78
  conf.write_text(json.dumps({
73
79
  "name": "vod-devkit", "command": sys.executable,
@@ -112,7 +118,7 @@ def install_remote(args, url, token):
112
118
  print(f"[vod-devkit] hermes mcp add(remote)失败:{(r.stderr or r.stdout).strip()[-200:]}",
113
119
  file=sys.stderr)
114
120
  sys.exit(1)
115
- conf = _MCP_DIR / "vod-devkit.json"
121
+ conf = Path(_spec()["configPath"]).parent / "vod-devkit.json"
116
122
  conf.parent.mkdir(parents=True, exist_ok=True)
117
123
  conf.write_text(json.dumps({"name": "vod-devkit", "url": url,
118
124
  "headers": {"Authorization": "Bearer ${MCP_VOD_DEVKIT_API_KEY}"}},
@@ -58,7 +58,32 @@ class _RemoteServer(Server):
58
58
  return super().create_initialization_options(*args, **kwargs)
59
59
 
60
60
 
61
+ def verify_servable_skills() -> None:
62
+ """远程面构造期自校验(对齐 devkit 的 verifySkillTree)。
63
+
64
+ 动机:list_skills 是注册表驱动的——如果技能文件缺失/被删,工具仍会宣传一堆
65
+ retrieve_skill 取不到的名字,调用方只能反复失败。远程面是无鉴权的长驻服务,
66
+ 这种"宣传了但给不出"的状态必须在构造期就拒绝,而不是每个用户踩一次。
67
+ """
68
+ from vod_mcp import skills_registry as sr
69
+ if not sr.SKILLS_ROOT.is_dir():
70
+ raise RuntimeError(
71
+ f"远程面拒绝启动/构造:技能树不存在 {sr.SKILLS_ROOT}"
72
+ "——list_skills/retrieve_skill 会整体失效(重跑 install 重建载荷)")
73
+ dirs = sr._skill_dirs()
74
+ if not dirs:
75
+ raise RuntimeError(
76
+ f"远程面拒绝启动/构造:{sr.SKILLS_ROOT} 下没有任何目录型技能(缺 SKILL.md)"
77
+ "——远程面不许在没有规则文本的情况下对外服务")
78
+ broken = [d.name for d in dirs if not (d / "SKILL.md").is_file()]
79
+ if broken:
80
+ raise RuntimeError("远程面拒绝启动/构造:技能文件缺失 "
81
+ + "、".join(sorted(broken)) + "(重跑 install 重建载荷)")
82
+
83
+
61
84
  def build_server(remote: bool = True) -> Server:
85
+ if remote:
86
+ verify_servable_skills()
62
87
  version = tools.load_contract()["version"]
63
88
 
64
89
  async def on_list_tools(ctx, params):
@@ -6,11 +6,12 @@
6
6
  **server data**:任何 MCP 宿主(包括没有原生技能目录的宿主,如 dsh headless)
7
7
  都能按需取到与包内完全一致的规则全文,且改规则不必碰四份宿主拷贝。
8
8
 
9
- 分工(与 devkit 一致):
10
- - 元技能(vod-core / vod-feedback-collect)仍原生安装——它们的价值在
11
- 宿主侧自动激活(触发词命中),走工具调用会丢掉激活时机。
12
- - 领域规则技能由本模块披露,归属 knowledge pack:pack 被裁剪时拒绝并
13
- 给恢复指引,不静默返回空。
9
+ 分工(与 devkit 一致,2026-11-12 复评校准):
10
+ - 元技能(vod-core / vod-feedback-collect)由安装器随对应 pack 拷进宿主技能目录;
11
+ - 领域规则技能**双轨**:安装器无条件落地静态副本(采集侧偶尔要答"为什么归这类"),
12
+ 本模块另提供同文本的按需取全文——给没有技能目录的宿主(generic/headless)兜底,
13
+ 也保证改规则时不必依赖四份宿主拷贝同步。knowledge pack 控制的是**披露工具**
14
+ (vod_list_skills / vod_retrieve_skill),裁剪时拒绝并给指引,不是文件可见性。
14
15
  """
15
16
  import re
16
17
  from pathlib import Path
@@ -89,13 +89,17 @@ JAVA_KEY = os.environ.get("VOD_JAVA_API_KEY", "") or _RT.get("java_key", "") #
89
89
  _META_PATH = "/rest/developer/manager/hdvodmngservice/v1/external/meta"
90
90
  _META_TTL = 24 * 3600
91
91
  # 快照兜底(引擎 meta 端点未上线/不可达时用;stale 语义见 _load_meta)
92
- _META_SNAPSHOT = {"products": ["agentarts", "codearts", "dataarts", "maas", "obs",
93
- "officeclaw", "modelarts"]}
92
+ # **不预置任何产品名/短码**(2026-11-13 负责人纪律):支持的产品列表唯一真源=
93
+ # 引擎 meta 接口(productCatalog/products),插件自带的清单会随运营变更过期,
94
+ # 而过期清单最危险的用法正是静默归因。名录不可达 → products=[]、归因一律
95
+ # UNKNOWN→追问,只保留 stale 标记(引导文案据此提示"名录暂不可用")。
96
+ _META_SNAPSHOT: dict = {"products": []}
94
97
 
95
98
 
96
99
  def _load_meta(force: bool = False) -> dict:
97
100
  """可漂移值动态取:缓存 TTL 24h,引擎端点不可达时回退快照并标 stale。
98
- 真源=引擎 submit 校验常量。
101
+ 真源=引擎 meta 接口(productCatalog/products)——**本模块不维护任何产品
102
+ 清单**,离线时宁可不归因也不拿本地表猜。
99
103
 
100
104
  T7i:productCatalog=[{id,name}](t_vod_product 运营预置,meta 组装)——
101
105
  提交产品归因按平台主键 id 的解析真源;老引擎无该键=catalog 空。
@@ -241,15 +245,9 @@ def _memory_put(client_info, **fields) -> None:
241
245
  _SESSION_MEM[key] = cur
242
246
 
243
247
 
244
- def _host_product() -> str | None:
245
- """宿主产品(兜底用):安装期写入 runtime.host_product,env 可覆盖。"""
246
- return (os.environ.get("VOD_HOST_PRODUCT")
247
- or str(_RT.get("host_product") or "").strip()
248
- or str(_runtime_cfg().get("host_product") or "").strip() or None)
249
-
250
-
251
248
  def search_products(params: dict) -> dict:
252
- """产品候选检索(只读):给模型 3-5 个候选去问用户,而不是从 103 条里瞎猜。"""
249
+ """产品候选检索(只读):给模型 3-5 个候选去问用户,而不是从名录里瞎猜。
250
+ 名录=引擎 meta 接口的 productCatalog(长度随运营变更,插件不内置)。"""
253
251
  query = str(params.get("query") or "").strip()
254
252
  limit = int(params.get("limit") or 5)
255
253
  limit = max(1, min(limit, 20))
@@ -291,8 +289,10 @@ def _attribute_product(items: list, params: dict, client_info: dict | None = Non
291
289
  ② 原话唯一且高置信提及(多产品/歧义=低置信,转去问)
292
290
  ③ 会话记忆(30 分钟滑动,进程内;跨会话不继承)
293
291
  ④ 安装先验
294
- ⑤ host_default:仅当用户明确说"不知道/随便"(params.productNotSpecified)
295
- 都拿不到 → 返回 source=unknown + confidence=low,由调用方抛可执行错误要求追问。
292
+ 四级都拿不到(含用户明确说"不知道/随便"= params.productNotSpecified)→
293
+ 返回 source=unknown + confidence=low,由调用方抛可执行错误要求追问。
294
+ **不做 host_default 兜底**(2026-11-12 复评删除:宿主产品也是一次推断,
295
+ 错归的产品会进引擎幂等/判重域,污染静默且难追溯)。
296
296
  """
297
297
  text = "\n".join(content for _i, _v, content in items)
298
298
  meta = _load_meta()
@@ -344,11 +344,9 @@ def _attribute_product(items: list, params: dict, client_info: dict | None = Non
344
344
  result["confidence"] = "medium"
345
345
  return result
346
346
 
347
+ # 用户明确说"不知道/随便":同样是"不猜、不提交"——只影响回执原因字段
348
+ # (productNotSpecified=true),不做任何兜底推断。
347
349
  not_specified = bool(params.get("productNotSpecified")) or bool(mem.get("not_specified"))
348
- if not_specified:
349
- # 用户明确说不知道:**不做任何猜测**(不按宿主产品兜底——那也是一次推断,
350
- # 且产品会进引擎幂等域,错归代价比丢一条高)。交给调用方提示用户"缺产品不提交"。
351
- pass
352
350
  ev = list(result.get("evidence") or [])
353
351
  if not_specified:
354
352
  ev = [{"reason": "user-not-specified"}] + ev
@@ -21,6 +21,7 @@ devkit 的契约(mcp-server-remote.ts + test/remote-mcp-server.test.ts 实测
21
21
  """
22
22
  import asyncio
23
23
  import json
24
+ import os
24
25
  import sys
25
26
  import threading
26
27
  from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
@@ -30,6 +31,44 @@ DEFAULT_PORT = 9528
30
31
  MAX_BODY = 4 * 1024 * 1024
31
32
  LOOPBACK = ("127.0.0.1", "localhost", "::1")
32
33
 
34
+ # 载荷自校验缓存:远程面是长驻无鉴权服务,被改过的服务端载荷要当场拒绝服务,
35
+ # 不能等运维跑 doctor 才发现(devkit 的每请求 verifySkillTree 同思路)。
36
+ # TTL 缓存避免每个请求都做一遍 sha256 全集(40+ 文件)。
37
+ _PAYLOAD_GUARD = {"at": 0.0, "sig": None, "problems": []}
38
+ _PAYLOAD_GUARD_TTL = 30.0
39
+
40
+
41
+ def payload_problems(force: bool = False) -> list:
42
+ """远程面载荷完整性检查(载荷目录不存在/被改 → 非空列表)。
43
+
44
+ 只校验"载荷副本"形态:stdio/仓内直跑没有 payload.json,返回空(不误伤)。
45
+ """
46
+ import time as _t
47
+ from pathlib import Path
48
+ from vod_mcp import payload as _pl
49
+ _P = Path
50
+ # 显式 env 优先(安装期注入),否则按自身所在树推断——*不许* import
51
+ # host_adapters:它的 __init__ 会连带 import 各宿主适配模块,而载荷副本不含
52
+ # integrations/(2026-11-12 实锤:请求线程 KeyError → 每个请求 500)。
53
+ env_dir = (os.environ.get("VOD_PAYLOAD_DIR") or "").strip()
54
+ d = _P(env_dir) if env_dir else None
55
+ if d is None:
56
+ # 从载荷副本直接起来的服务(entry = <payload>/vod_mcp/server.py)没有
57
+ # install 期注入的 payload_dir —— 用自身所在树推断:载荷根里有 payload.json
58
+ # 就说明"我就是那份副本",必须自校验(否则被改的副本会一直对外服务)。
59
+ root = _P(__file__).resolve().parent.parent
60
+ d = root if (root / "payload.json").exists() else None
61
+ if d is None:
62
+ return []
63
+ meta = _P(d) / "payload.json"
64
+ sig = (str(meta), meta.stat().st_mtime if meta.exists() else 0.0)
65
+ now = _t.time()
66
+ if not force and _PAYLOAD_GUARD["sig"] == sig and now - _PAYLOAD_GUARD["at"] < _PAYLOAD_GUARD_TTL:
67
+ return list(_PAYLOAD_GUARD["problems"])
68
+ problems = _pl.verify(_P(d))
69
+ _PAYLOAD_GUARD.update({"at": now, "sig": sig, "problems": list(problems)})
70
+ return problems
71
+
33
72
 
34
73
  class RemoteRuntime:
35
74
  """持有 asyncio 事件循环 + SDK session manager 的生命周期。"""
@@ -250,6 +289,15 @@ class _Handler(BaseHTTPRequestHandler):
250
289
  if isinstance(message, dict) and "id" not in message:
251
290
  self._empty(202)
252
291
  return
292
+ # 服务端载荷自校验:被改/缺文件的载荷不许继续对外服务
293
+ problems = payload_problems()
294
+ if problems:
295
+ self._json(503, {"jsonrpc": "2.0", "id": message.get("id") if isinstance(message, dict) else None,
296
+ "error": {"code": -32603,
297
+ "message": "服务端载荷校验未通过(拒绝服务):"
298
+ + ";".join(problems[:5])}})
299
+ return
300
+
253
301
  raw_auth = (self.headers.get("Authorization") or "").strip()
254
302
  key = raw_auth[7:].strip() if raw_auth.lower().startswith("bearer ") else ""
255
303
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: vod-feedback-collect
3
- description: '用户抱怨/体验差/太慢/报错/提单 → 采集原话进 VOD。识别到抱怨即承接并征得同意(禁止问哪个产品,禁止复现排查模式);content=原话逐字;一次抱怨一条;回执 echo 原样转述。详见正文流程与禁令。Triggers: "体验差","太难用","太慢","报错了","出bug了","有bug","反馈问题","反馈建议","提个单","报告问题","不生效","不好使","操作不方便","卡住了","崩溃了","report a problem","bug report","poor experience","feedback"'
3
+ description: '用户抱怨/体验差/太慢/报错/提单 → 采集原话进 VOD。识别到抱怨即承接并征得同意(缺产品先问一次是哪个、不猜也不提交;禁止复现排查模式);content=原话逐字;一次抱怨一条;回执 echo 原样转述。详见正文流程与禁令。Triggers: "体验差","太难用","太慢","报错了","出bug了","有bug","反馈问题","反馈建议","提个单","报告问题","不生效","不好使","操作不方便","卡住了","崩溃了","report a problem","bug report","poor experience","feedback"'
4
4
  tags: [vod, feedback, capture, consent]
5
5
  metadata:
6
6
  version: 1
@@ -180,8 +180,10 @@ metadata:
180
180
  ## 采集流程
181
181
 
182
182
  0. 产品归因(D-product-ask-1,2026-11-12 拍板:不许裸提交 UNKNOWN):
183
- 归因次序 = 用户明确回答 > 原话唯一高置信提及 > 会话记忆(30 分钟) >
184
- 安装先验 > 宿主产品(host_default,仅用户说不知道时,低置信)。
183
+ 归因次序 = 用户明确回答 > 原话唯一高置信提及 > 会话记忆(30 分钟) > 安装先验。
184
+ 四级都拿不到 → **不猜、不提交**,按下面的追问规则请用户补一句产品名
185
+ (2026-11-12 复评删除 host_default 兜底:宿主产品也是一次推断,错归会进
186
+ 引擎幂等/判重域,污染静默且难追溯)。
185
187
  - 原话里只有一个产品名、且不是对比/多产品语境 → 直接用,不再问
186
188
  - 原话有两个以上产品("CodeArts 比 MaaS 好"、"从 CodeArts 导出到 MaaS")
187
189
  → 视为**低置信**,必须问:"这条反馈是哪个产品的?可用候选:…"
@@ -217,7 +219,8 @@ metadata:
217
219
  "网页卡回复慢"被宿主改写成「网页打开,…」+「网页卡,…」两条入库建出
218
220
  两个 issue;引擎幂等按内容逐字比对,改写即绕过)。多条仅当用户明确
219
221
  分条给了多个不同反馈
220
- 4. 拿到回执 → 对用户说人话:"已收录,产品团队会看到这条反馈"——
222
+ 4. 拿到回执 → 对用户说人话:"已收录,产品团队会看到这条反馈";
223
+ (若对方是验证者且明确要编号,按第 0 条例外贴 voiceId)——
221
224
  **voiceId 不展示给终端用户**(编号噪音),仅供 agent 对账用;
222
225
  用户追问"提交了吗"时 agent 用 voiceId/taskId 核对后回答状态
223
226
  5. **无通道 fallback(D-pending-1,插件未安装/无 vod 工具时)**:
@@ -241,6 +244,12 @@ metadata:
241
244
  ## 纪律
242
245
 
243
246
  0. 回执纪律(F2,成功与失败路径同口径):给用户的话=人话
247
+
248
+ **验证/对账例外(2026-11-12 拍板)**:当对方是**验证者**(运维/研发/负责人在
249
+ 核对链路,明确说"把 voiceId 贴出来""我核对下入库")时,允许同样打印
250
+ `voiceId`、`productId`、`productSource`——那是他们的对账主键,不是给反馈提交者看的
251
+ 噪音。判据两条同时满足:①对方明确要求要编号;②对方在验证链路而不是在提交自己的
252
+ 抱怨。终端用户(提交反馈的人)问"提交了吗",仍只回答状态、不展示编号。
244
253
  (成功=已收录/产品团队会看到;失败=提交失败,反馈已暂存本机,
245
254
  稍后会自动重试)。**失败时禁止向用户复述内部诊断字段**——HTTP
246
255
  状态码、apiKeyFingerprint、tokenTier、堆栈等属于 agent 内部排障
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: vod-problem-classification-rules
3
- description: VOD 问题分类规则(引擎 v2.2 真实口径)— 六类定义、判定细节、LLM 分类流程。真源=workflow/src/n01_classify.py(VOD-Project 2bb3fc82 实测核对)。
3
+ description: VOD 问题分类规则(引擎 v2.2 真实口径)— 六类定义、判定细节、LLM 分类流程。
4
4
  tags: [vod, classification, rules]
5
5
  metadata:
6
6
  version: 2
@@ -13,6 +13,7 @@ metadata:
13
13
  > 体验优化/其他)已废弃,与引擎不符——它来自过期文档。
14
14
  > 采集定位:预分类仅作参考 hint(tags),引擎 LLM 按六类重判——
15
15
  > 预分类不是终局,别和用户言之凿凿。
16
+ > 对外复述纪律:可讲口径(六类边界/判定要点),不引用仓库路径、文件行号、提交号。
16
17
 
17
18
  ## 六类定义(引擎 DEFAULT_TYPE_DEFS 原文)
18
19
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: vod-scoring-rules
3
- description: VOD 评分规则(引擎 v2 真实公式)— 四项加法、上下限、优先级映射。真源=workflow/src/workflow_v2.py(VOD-Project 2bb3fc82 实测核对)。
3
+ description: VOD 评分规则(引擎 v2 真实公式)— 四项加法、上下限、优先级映射。
4
4
  tags: [vod, scoring, rules]
5
5
  metadata:
6
6
  version: 2
@@ -11,6 +11,7 @@ metadata:
11
11
  > 真源纪律:以 workflow_v2.py 评分函数为准,2026-11-03 逐行核对。
12
12
  > 旧版"五项维度含用户价值"口径作废——引擎是四项,且非重点问题
13
13
  > 上限不同(下方原文),旧文档没写。
14
+ > 对外复述纪律:可讲公式要点与上下限,不引用仓库路径、文件行号、提交号。
14
15
 
15
16
  ## 评分公式(引擎代码原文语义)
16
17
 
@@ -5,7 +5,7 @@
5
5
  2. 外部无 DB 直连路径(护栏 deny 兜底)
6
6
  3. 任务 ID 是唯一对账主键,写类工具返回一律携带
7
7
  """
8
- __version__ = "0.5.4"
8
+ __version__ = "0.5.5"
9
9
  # 默认上游:VOD 测试环境。外部用户本机无 VOD,回环默认值=装完即坏;
10
10
  # 生产地址定型后只改这一处(tools.py 与 bin/vod-devkit 共用本常量)。
11
11
  DEFAULT_JAVA_BASE = "https://vod-dev.topxtopx.com"
@@ -163,19 +163,19 @@ def build_alias_index(meta: dict) -> list:
163
163
 
164
164
  # ② 品牌俗称表:把无法从表名推导的口语词挂到目标产品上
165
165
  for target_name, colloquials in (BRAND_ALIASES or {}).items():
166
- slot = canon.get(str(target_name).lower())
167
- if slot is None:
166
+ brand_slot: dict | None = canon.get(str(target_name).lower())
167
+ if brand_slot is None:
168
168
  # 目标产品不在本次 catalog(引擎换库/改名):别名不落地,避免指向
169
169
  # 不存在的 id。宁可丢俗称,也不产生错归。
170
170
  continue
171
171
  for word in (colloquials or []):
172
172
  if word:
173
- slot["aliases"].add(str(word).strip())
173
+ brand_slot["aliases"].add(str(word).strip())
174
174
 
175
175
  # ③ 兼容:若引擎仍下发旧字段(回滚场景),继续采纳,避免双向改造期丢能力
176
176
  for key, aliases in (meta.get("nameAliases") or {}).items():
177
177
  aliases = [str(a) for a in (aliases or []) if a]
178
- target = canon.get(str(key).lower())
178
+ target: dict | None = canon.get(str(key).lower())
179
179
  if target is None:
180
180
  for a in aliases:
181
181
  if a.lower() in canon:
@@ -187,10 +187,10 @@ def build_alias_index(meta: dict) -> list:
187
187
  target["aliases"].add(a)
188
188
  target["aliases"].add(str(key))
189
189
  for key, target_name in (meta.get("aliases") or {}).items():
190
- slot = canon.get(str(target_name).lower())
191
- if slot is None: # 目录/展示名都没有该目标:按别名目标建槽,别丢别名
192
- slot = _slot(target_name, False)
193
- slot["aliases"].add(str(key))
190
+ alias_slot: dict | None = canon.get(str(target_name).lower())
191
+ if alias_slot is None: # 目录/展示名都没有该目标:按别名目标建槽,别丢别名
192
+ alias_slot = _slot(target_name, False)
193
+ alias_slot["aliases"].add(str(key))
194
194
 
195
195
  for slot in canon.values(): # 名字/别名任一命中 catalog → 拿 id
196
196
  for alias in list(slot["aliases"]) + [slot["label"]]:
@@ -16,11 +16,24 @@ _AGENTS_MARKER_BEGIN = "<!-- vod-devkit:feedback-skill BEGIN -->"
16
16
  # 且 1705 个历史会话带着它跑(实测)。清理逻辑必须认这个标记,否则残留继续生效。
17
17
  _LEGACY_ONE_LINER = "<!-- vod-submit-one-liner -->"
18
18
  _AGENTS_MARKER_END = "<!-- vod-devkit:feedback-skill END -->"
19
- _SPEC = host_specs.load("codex")
19
+ _SPEC: dict | None = None
20
+
21
+
22
+ def _spec() -> dict:
23
+ """调用期解析宿主配置(模块 import 期读 integrations/ 会在载荷副本里炸)。
24
+
25
+ 2026-11-12 实锤:载荷副本不含 integrations/,import 期 host_specs.load("codex")
26
+ 直接 KeyError → 远程面每个请求 500。宿主配置只在 install 期用得上,运行期
27
+ server 不需要它。
28
+ """
29
+ global _SPEC
30
+ if _SPEC is None:
31
+ _SPEC = host_specs.load("codex")
32
+ return _SPEC
20
33
 
21
34
 
22
35
  def skills_dir(args):
23
- d = _SPEC.get("skillsDir")
36
+ d = _spec().get("skillsDir")
24
37
  return Path(d) if d else None
25
38
 
26
39
 
@@ -98,7 +111,7 @@ def install(args, packs: str) -> Path:
98
111
  if not codex:
99
112
  print("[vod-devkit] 未找到 codex CLI,无法走原生插件安装", file=sys.stderr)
100
113
  sys.exit(2)
101
- spec = host_specs.load("codex")
114
+ spec = _spec()
102
115
  conf = Path(spec["configPath"])
103
116
  if conf.exists(): # 历史遗留:config.toml MCP 段与插件同名=双注册,移除
104
117
  text = conf.read_text(encoding="utf-8")
@@ -14,12 +14,18 @@ from vod_mcp.host_adapters.base import ROOT, server_env, server_entry
14
14
 
15
15
  HOST = "hermes"
16
16
  SUPPORTS_REMOTE = True
17
- _SPEC = host_specs.load("hermes")
18
- _MCP_DIR = Path(_SPEC["configPath"]).parent
17
+ def _spec() -> dict:
18
+ """调用期现读:host.json 的 ~ 必须在调用期按当前 HOME 解析。
19
+
20
+ 2026-11-12 实锤:模块 import 期求值 _MCP_DIR 后,测试里 monkeypatch HOME
21
+ 写不到隔离目录,直接把真实 ~/.hermes/mcp/vod-devkit.json 覆盖成了桩值
22
+ (command=/x/vod_mcp/server.py)——真机 doctor 当场读到坏条目。
23
+ """
24
+ return host_specs.load("hermes")
19
25
 
20
26
 
21
27
  def skills_dir(args):
22
- return Path(_SPEC["skillsDir"])
28
+ return Path(_spec()["skillsDir"])
23
29
 
24
30
 
25
31
  PLUGIN_NAME = "vod-feedback-router"
@@ -67,7 +73,7 @@ def enable_plugin(name: str = PLUGIN_NAME) -> str:
67
73
 
68
74
  def install(args, packs: str) -> Path:
69
75
  """Hermes:官方途径 hermes mcp add(config.yaml mcp_servers)。"""
70
- conf = _MCP_DIR / "vod-devkit.json"
76
+ conf = Path(_spec()["configPath"]).parent / "vod-devkit.json"
71
77
  conf.parent.mkdir(parents=True, exist_ok=True)
72
78
  conf.write_text(json.dumps({
73
79
  "name": "vod-devkit", "command": sys.executable,
@@ -112,7 +118,7 @@ def install_remote(args, url, token):
112
118
  print(f"[vod-devkit] hermes mcp add(remote)失败:{(r.stderr or r.stdout).strip()[-200:]}",
113
119
  file=sys.stderr)
114
120
  sys.exit(1)
115
- conf = _MCP_DIR / "vod-devkit.json"
121
+ conf = Path(_spec()["configPath"]).parent / "vod-devkit.json"
116
122
  conf.parent.mkdir(parents=True, exist_ok=True)
117
123
  conf.write_text(json.dumps({"name": "vod-devkit", "url": url,
118
124
  "headers": {"Authorization": "Bearer ${MCP_VOD_DEVKIT_API_KEY}"}},
@@ -58,7 +58,32 @@ class _RemoteServer(Server):
58
58
  return super().create_initialization_options(*args, **kwargs)
59
59
 
60
60
 
61
+ def verify_servable_skills() -> None:
62
+ """远程面构造期自校验(对齐 devkit 的 verifySkillTree)。
63
+
64
+ 动机:list_skills 是注册表驱动的——如果技能文件缺失/被删,工具仍会宣传一堆
65
+ retrieve_skill 取不到的名字,调用方只能反复失败。远程面是无鉴权的长驻服务,
66
+ 这种"宣传了但给不出"的状态必须在构造期就拒绝,而不是每个用户踩一次。
67
+ """
68
+ from vod_mcp import skills_registry as sr
69
+ if not sr.SKILLS_ROOT.is_dir():
70
+ raise RuntimeError(
71
+ f"远程面拒绝启动/构造:技能树不存在 {sr.SKILLS_ROOT}"
72
+ "——list_skills/retrieve_skill 会整体失效(重跑 install 重建载荷)")
73
+ dirs = sr._skill_dirs()
74
+ if not dirs:
75
+ raise RuntimeError(
76
+ f"远程面拒绝启动/构造:{sr.SKILLS_ROOT} 下没有任何目录型技能(缺 SKILL.md)"
77
+ "——远程面不许在没有规则文本的情况下对外服务")
78
+ broken = [d.name for d in dirs if not (d / "SKILL.md").is_file()]
79
+ if broken:
80
+ raise RuntimeError("远程面拒绝启动/构造:技能文件缺失 "
81
+ + "、".join(sorted(broken)) + "(重跑 install 重建载荷)")
82
+
83
+
61
84
  def build_server(remote: bool = True) -> Server:
85
+ if remote:
86
+ verify_servable_skills()
62
87
  version = tools.load_contract()["version"]
63
88
 
64
89
  async def on_list_tools(ctx, params):
@@ -6,11 +6,12 @@
6
6
  **server data**:任何 MCP 宿主(包括没有原生技能目录的宿主,如 dsh headless)
7
7
  都能按需取到与包内完全一致的规则全文,且改规则不必碰四份宿主拷贝。
8
8
 
9
- 分工(与 devkit 一致):
10
- - 元技能(vod-core / vod-feedback-collect)仍原生安装——它们的价值在
11
- 宿主侧自动激活(触发词命中),走工具调用会丢掉激活时机。
12
- - 领域规则技能由本模块披露,归属 knowledge pack:pack 被裁剪时拒绝并
13
- 给恢复指引,不静默返回空。
9
+ 分工(与 devkit 一致,2026-11-12 复评校准):
10
+ - 元技能(vod-core / vod-feedback-collect)由安装器随对应 pack 拷进宿主技能目录;
11
+ - 领域规则技能**双轨**:安装器无条件落地静态副本(采集侧偶尔要答"为什么归这类"),
12
+ 本模块另提供同文本的按需取全文——给没有技能目录的宿主(generic/headless)兜底,
13
+ 也保证改规则时不必依赖四份宿主拷贝同步。knowledge pack 控制的是**披露工具**
14
+ (vod_list_skills / vod_retrieve_skill),裁剪时拒绝并给指引,不是文件可见性。
14
15
  """
15
16
  import re
16
17
  from pathlib import Path
package/vod_mcp/tools.py CHANGED
@@ -89,13 +89,17 @@ JAVA_KEY = os.environ.get("VOD_JAVA_API_KEY", "") or _RT.get("java_key", "") #
89
89
  _META_PATH = "/rest/developer/manager/hdvodmngservice/v1/external/meta"
90
90
  _META_TTL = 24 * 3600
91
91
  # 快照兜底(引擎 meta 端点未上线/不可达时用;stale 语义见 _load_meta)
92
- _META_SNAPSHOT = {"products": ["agentarts", "codearts", "dataarts", "maas", "obs",
93
- "officeclaw", "modelarts"]}
92
+ # **不预置任何产品名/短码**(2026-11-13 负责人纪律):支持的产品列表唯一真源=
93
+ # 引擎 meta 接口(productCatalog/products),插件自带的清单会随运营变更过期,
94
+ # 而过期清单最危险的用法正是静默归因。名录不可达 → products=[]、归因一律
95
+ # UNKNOWN→追问,只保留 stale 标记(引导文案据此提示"名录暂不可用")。
96
+ _META_SNAPSHOT: dict = {"products": []}
94
97
 
95
98
 
96
99
  def _load_meta(force: bool = False) -> dict:
97
100
  """可漂移值动态取:缓存 TTL 24h,引擎端点不可达时回退快照并标 stale。
98
- 真源=引擎 submit 校验常量。
101
+ 真源=引擎 meta 接口(productCatalog/products)——**本模块不维护任何产品
102
+ 清单**,离线时宁可不归因也不拿本地表猜。
99
103
 
100
104
  T7i:productCatalog=[{id,name}](t_vod_product 运营预置,meta 组装)——
101
105
  提交产品归因按平台主键 id 的解析真源;老引擎无该键=catalog 空。
@@ -241,15 +245,9 @@ def _memory_put(client_info, **fields) -> None:
241
245
  _SESSION_MEM[key] = cur
242
246
 
243
247
 
244
- def _host_product() -> str | None:
245
- """宿主产品(兜底用):安装期写入 runtime.host_product,env 可覆盖。"""
246
- return (os.environ.get("VOD_HOST_PRODUCT")
247
- or str(_RT.get("host_product") or "").strip()
248
- or str(_runtime_cfg().get("host_product") or "").strip() or None)
249
-
250
-
251
248
  def search_products(params: dict) -> dict:
252
- """产品候选检索(只读):给模型 3-5 个候选去问用户,而不是从 103 条里瞎猜。"""
249
+ """产品候选检索(只读):给模型 3-5 个候选去问用户,而不是从名录里瞎猜。
250
+ 名录=引擎 meta 接口的 productCatalog(长度随运营变更,插件不内置)。"""
253
251
  query = str(params.get("query") or "").strip()
254
252
  limit = int(params.get("limit") or 5)
255
253
  limit = max(1, min(limit, 20))
@@ -291,8 +289,10 @@ def _attribute_product(items: list, params: dict, client_info: dict | None = Non
291
289
  ② 原话唯一且高置信提及(多产品/歧义=低置信,转去问)
292
290
  ③ 会话记忆(30 分钟滑动,进程内;跨会话不继承)
293
291
  ④ 安装先验
294
- ⑤ host_default:仅当用户明确说"不知道/随便"(params.productNotSpecified)
295
- 都拿不到 → 返回 source=unknown + confidence=low,由调用方抛可执行错误要求追问。
292
+ 四级都拿不到(含用户明确说"不知道/随便"= params.productNotSpecified)→
293
+ 返回 source=unknown + confidence=low,由调用方抛可执行错误要求追问。
294
+ **不做 host_default 兜底**(2026-11-12 复评删除:宿主产品也是一次推断,
295
+ 错归的产品会进引擎幂等/判重域,污染静默且难追溯)。
296
296
  """
297
297
  text = "\n".join(content for _i, _v, content in items)
298
298
  meta = _load_meta()
@@ -344,11 +344,9 @@ def _attribute_product(items: list, params: dict, client_info: dict | None = Non
344
344
  result["confidence"] = "medium"
345
345
  return result
346
346
 
347
+ # 用户明确说"不知道/随便":同样是"不猜、不提交"——只影响回执原因字段
348
+ # (productNotSpecified=true),不做任何兜底推断。
347
349
  not_specified = bool(params.get("productNotSpecified")) or bool(mem.get("not_specified"))
348
- if not_specified:
349
- # 用户明确说不知道:**不做任何猜测**(不按宿主产品兜底——那也是一次推断,
350
- # 且产品会进引擎幂等域,错归代价比丢一条高)。交给调用方提示用户"缺产品不提交"。
351
- pass
352
350
  ev = list(result.get("evidence") or [])
353
351
  if not_specified:
354
352
  ev = [{"reason": "user-not-specified"}] + ev
@@ -21,6 +21,7 @@ devkit 的契约(mcp-server-remote.ts + test/remote-mcp-server.test.ts 实测
21
21
  """
22
22
  import asyncio
23
23
  import json
24
+ import os
24
25
  import sys
25
26
  import threading
26
27
  from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
@@ -30,6 +31,44 @@ DEFAULT_PORT = 9528
30
31
  MAX_BODY = 4 * 1024 * 1024
31
32
  LOOPBACK = ("127.0.0.1", "localhost", "::1")
32
33
 
34
+ # 载荷自校验缓存:远程面是长驻无鉴权服务,被改过的服务端载荷要当场拒绝服务,
35
+ # 不能等运维跑 doctor 才发现(devkit 的每请求 verifySkillTree 同思路)。
36
+ # TTL 缓存避免每个请求都做一遍 sha256 全集(40+ 文件)。
37
+ _PAYLOAD_GUARD = {"at": 0.0, "sig": None, "problems": []}
38
+ _PAYLOAD_GUARD_TTL = 30.0
39
+
40
+
41
+ def payload_problems(force: bool = False) -> list:
42
+ """远程面载荷完整性检查(载荷目录不存在/被改 → 非空列表)。
43
+
44
+ 只校验"载荷副本"形态:stdio/仓内直跑没有 payload.json,返回空(不误伤)。
45
+ """
46
+ import time as _t
47
+ from pathlib import Path
48
+ from vod_mcp import payload as _pl
49
+ _P = Path
50
+ # 显式 env 优先(安装期注入),否则按自身所在树推断——*不许* import
51
+ # host_adapters:它的 __init__ 会连带 import 各宿主适配模块,而载荷副本不含
52
+ # integrations/(2026-11-12 实锤:请求线程 KeyError → 每个请求 500)。
53
+ env_dir = (os.environ.get("VOD_PAYLOAD_DIR") or "").strip()
54
+ d = _P(env_dir) if env_dir else None
55
+ if d is None:
56
+ # 从载荷副本直接起来的服务(entry = <payload>/vod_mcp/server.py)没有
57
+ # install 期注入的 payload_dir —— 用自身所在树推断:载荷根里有 payload.json
58
+ # 就说明"我就是那份副本",必须自校验(否则被改的副本会一直对外服务)。
59
+ root = _P(__file__).resolve().parent.parent
60
+ d = root if (root / "payload.json").exists() else None
61
+ if d is None:
62
+ return []
63
+ meta = _P(d) / "payload.json"
64
+ sig = (str(meta), meta.stat().st_mtime if meta.exists() else 0.0)
65
+ now = _t.time()
66
+ if not force and _PAYLOAD_GUARD["sig"] == sig and now - _PAYLOAD_GUARD["at"] < _PAYLOAD_GUARD_TTL:
67
+ return list(_PAYLOAD_GUARD["problems"])
68
+ problems = _pl.verify(_P(d))
69
+ _PAYLOAD_GUARD.update({"at": now, "sig": sig, "problems": list(problems)})
70
+ return problems
71
+
33
72
 
34
73
  class RemoteRuntime:
35
74
  """持有 asyncio 事件循环 + SDK session manager 的生命周期。"""
@@ -250,6 +289,15 @@ class _Handler(BaseHTTPRequestHandler):
250
289
  if isinstance(message, dict) and "id" not in message:
251
290
  self._empty(202)
252
291
  return
292
+ # 服务端载荷自校验:被改/缺文件的载荷不许继续对外服务
293
+ problems = payload_problems()
294
+ if problems:
295
+ self._json(503, {"jsonrpc": "2.0", "id": message.get("id") if isinstance(message, dict) else None,
296
+ "error": {"code": -32603,
297
+ "message": "服务端载荷校验未通过(拒绝服务):"
298
+ + ";".join(problems[:5])}})
299
+ return
300
+
253
301
  raw_auth = (self.headers.get("Authorization") or "").strip()
254
302
  key = raw_auth[7:].strip() if raw_auth.lower().startswith("bearer ") else ""
255
303