vod-devkit 0.5.3 → 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.
- package/CHANGELOG.md +17 -0
- package/README.md +12 -0
- package/bin/vod-devkit +60 -10
- package/contract/tools.schema.json +1 -1
- package/integrations/atomcode/host.json +5 -3
- package/integrations/codeartsdoer/host.json +1 -2
- package/package.json +3 -1
- package/plugins/vod-devkit/.codex-plugin/plugin.json +1 -1
- package/plugins/vod-devkit/build-info.json +3 -3
- package/plugins/vod-devkit/skills/vod-feedback-collect/SKILL.md +13 -4
- package/plugins/vod-devkit/skills/vod-problem-classification-rules/SKILL.md +2 -1
- package/plugins/vod-devkit/skills/vod-scoring-rules/SKILL.md +2 -1
- package/plugins/vod-devkit/vod_mcp/__init__.py +1 -1
- package/plugins/vod-devkit/vod_mcp/attribution.py +8 -8
- package/plugins/vod-devkit/vod_mcp/detect_framework.py +160 -0
- package/plugins/vod-devkit/vod_mcp/diagnose.py +102 -0
- package/plugins/vod-devkit/vod_mcp/host_adapters/codex.py +27 -5
- package/plugins/vod-devkit/vod_mcp/host_adapters/hermes.py +11 -5
- package/plugins/vod-devkit/vod_mcp/remote_app.py +25 -0
- package/plugins/vod-devkit/vod_mcp/skills_registry.py +6 -5
- package/plugins/vod-devkit/vod_mcp/tools.py +15 -17
- package/plugins/vod-devkit/vod_mcp/transport_remote.py +48 -0
- package/skills/vod-feedback-collect/SKILL.md +13 -4
- package/skills/vod-problem-classification-rules/SKILL.md +2 -1
- package/skills/vod-scoring-rules/SKILL.md +2 -1
- package/vod_mcp/__init__.py +1 -1
- package/vod_mcp/attribution.py +8 -8
- package/vod_mcp/detect_framework.py +160 -0
- package/vod_mcp/diagnose.py +102 -0
- package/vod_mcp/host_adapters/__pycache__/__init__.cpython-39.pyc +0 -0
- package/vod_mcp/host_adapters/__pycache__/atomcode.cpython-39.pyc +0 -0
- package/vod_mcp/host_adapters/__pycache__/base.cpython-39.pyc +0 -0
- package/vod_mcp/host_adapters/__pycache__/codearts.cpython-39.pyc +0 -0
- package/vod_mcp/host_adapters/__pycache__/codex.cpython-314.pyc +0 -0
- package/vod_mcp/host_adapters/__pycache__/generic.cpython-39.pyc +0 -0
- package/vod_mcp/host_adapters/__pycache__/hermes.cpython-314.pyc +0 -0
- package/vod_mcp/host_adapters/codex.py +27 -5
- package/vod_mcp/host_adapters/hermes.py +11 -5
- package/vod_mcp/remote_app.py +25 -0
- package/vod_mcp/skills_registry.py +6 -5
- package/vod_mcp/tools.py +15 -17
- package/vod_mcp/transport_remote.py +48 -0
|
@@ -6,7 +6,7 @@ import sys
|
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
|
|
8
8
|
from vod_mcp import hosts as host_specs
|
|
9
|
-
from vod_mcp.host_adapters.base import ROOT
|
|
9
|
+
from vod_mcp.host_adapters.base import ROOT, server_env, server_entry
|
|
10
10
|
|
|
11
11
|
HOST = "codex"
|
|
12
12
|
SUPPORTS_REMOTE = True
|
|
@@ -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 =
|
|
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 =
|
|
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 =
|
|
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")
|
|
@@ -170,7 +183,16 @@ def install(args, packs: str) -> Path:
|
|
|
170
183
|
mj = json.loads(Path(mcp_jsons[0]).read_text(encoding="utf-8"))
|
|
171
184
|
srv = mj.get("mcpServers", {}).get("vod-devkit")
|
|
172
185
|
if srv is not None:
|
|
173
|
-
|
|
186
|
+
# 关键修正(2026-11-12 矩阵实锤):插件自带的 .mcp.json 写的是
|
|
187
|
+
# command="vod-devkit" + args=["serve"] —— 依赖 PATH 上那个全局包。
|
|
188
|
+
# 机器上装着旧版(实测 0.4.2)时,codex 会静默跑旧副本:配置、
|
|
189
|
+
# 技能都是新的,工具面却是旧的。改成绝对解释器 + 载荷副本,与其它
|
|
190
|
+
# 宿主同一条铁律(入口不依赖 PATH / npx 缓存)。
|
|
191
|
+
srv["command"] = sys.executable
|
|
192
|
+
srv["args"] = [server_entry()]
|
|
193
|
+
merged = dict(srv.get("env") or {})
|
|
194
|
+
merged.update(server_env(args, packs))
|
|
195
|
+
srv["env"] = merged
|
|
174
196
|
Path(mcp_jsons[0]).write_text(
|
|
175
197
|
json.dumps(mj, ensure_ascii=False, indent=2) + "\n",
|
|
176
198
|
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
|
-
|
|
18
|
-
|
|
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(
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
93
|
-
|
|
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
|
-
真源=引擎
|
|
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
|
|
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
|
-
|
|
295
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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 真实公式)—
|
|
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
|
|
package/vod_mcp/__init__.py
CHANGED
package/vod_mcp/attribution.py
CHANGED
|
@@ -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
|
-
|
|
167
|
-
if
|
|
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
|
-
|
|
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
|
-
|
|
191
|
-
if
|
|
192
|
-
|
|
193
|
-
|
|
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"]]:
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"""只读项目识别:语言构成 + 框架/构建工具线索。
|
|
2
|
+
|
|
3
|
+
对标 huaweicloud-devkit 的 detect-framework*(513 行):它做的推论比我们多
|
|
4
|
+
(框架 → 推荐能力),我们只需要"这是哪个语言/框架的项目"给采集端补上下文,
|
|
5
|
+
所以刻意只做**确定性证据**:
|
|
6
|
+
|
|
7
|
+
- 语言:按扩展名统计文件数(跳过 vendor 目录 / node_modules / .git / 大二进制),
|
|
8
|
+
取前 N 个;不做"猜测比例"。
|
|
9
|
+
- 框架/构建:只认标记文件与清单里的显式依赖(package.json 的 dependencies、
|
|
10
|
+
requirements.txt、pyproject.toml、pom.xml、go.mod、Cargo.toml、build.gradle),
|
|
11
|
+
不做字符串模糊匹配——误报比不报更糟(会把运维带偏)。
|
|
12
|
+
|
|
13
|
+
只读:本模块不写任何文件、不发网络请求。
|
|
14
|
+
"""
|
|
15
|
+
import json
|
|
16
|
+
import os
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
SKIP_DIRS = {".git", "node_modules", "vendor", "dist", "build", ".venv", "venv",
|
|
20
|
+
"__pycache__", ".mypy_cache", ".pytest_cache", "target", ".idea"}
|
|
21
|
+
MAX_FILES = 20000 # 扫描上限:大仓不做全量遍历(41s 索引卡死过 UI)
|
|
22
|
+
MAX_DEPTH = 12
|
|
23
|
+
|
|
24
|
+
LANG_EXT = {
|
|
25
|
+
".py": "Python", ".js": "JavaScript", ".mjs": "JavaScript", ".cjs": "JavaScript",
|
|
26
|
+
".ts": "TypeScript", ".tsx": "TypeScript", ".jsx": "JavaScript",
|
|
27
|
+
".java": "Java", ".kt": "Kotlin", ".go": "Go", ".rs": "Rust",
|
|
28
|
+
".rb": "Ruby", ".php": "PHP", ".cs": "C#", ".c": "C", ".cc": "C++",
|
|
29
|
+
".cpp": "C++", ".h": "C/C++ header", ".swift": "Swift", ".scala": "Scala",
|
|
30
|
+
".sh": "Shell", ".sql": "SQL", ".vue": "Vue", ".md": "Markdown",
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# 标记文件 → (种类, 名称)
|
|
34
|
+
MARKERS = {
|
|
35
|
+
"package.json": ("node", "npm/node"),
|
|
36
|
+
"pnpm-lock.yaml": ("node", "pnpm"),
|
|
37
|
+
"yarn.lock": ("node", "yarn"),
|
|
38
|
+
"requirements.txt": ("python", "pip"),
|
|
39
|
+
"pyproject.toml": ("python", "pyproject"),
|
|
40
|
+
"setup.py": ("python", "setuptools"),
|
|
41
|
+
"Pipfile": ("python", "pipenv"),
|
|
42
|
+
"pom.xml": ("java", "Maven"),
|
|
43
|
+
"build.gradle": ("java", "Gradle"),
|
|
44
|
+
"build.gradle.kts": ("java", "Gradle"),
|
|
45
|
+
"go.mod": ("go", "Go modules"),
|
|
46
|
+
"Cargo.toml": ("rust", "Cargo"),
|
|
47
|
+
"Gemfile": ("ruby", "Bundler"),
|
|
48
|
+
"composer.json": ("php", "Composer"),
|
|
49
|
+
"Dockerfile": ("infra", "Docker"),
|
|
50
|
+
"docker-compose.yml": ("infra", "Docker Compose"),
|
|
51
|
+
"Makefile": ("infra", "Make"),
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# 依赖名 → 框架名(只认清单里的显式依赖)
|
|
55
|
+
JS_FRAMEWORKS = {
|
|
56
|
+
"react": "React", "vue": "Vue", "next": "Next.js", "nuxt": "Nuxt",
|
|
57
|
+
"express": "Express", "fastify": "Fastify", "koa": "Koa", "@nestjs/core": "NestJS",
|
|
58
|
+
"vite": "Vite", "webpack": "Webpack", "electron": "Electron",
|
|
59
|
+
}
|
|
60
|
+
PY_FRAMEWORKS = {
|
|
61
|
+
"django": "Django", "flask": "Flask", "fastapi": "FastAPI",
|
|
62
|
+
"torch": "PyTorch", "tensorflow": "TensorFlow", "pytest": "pytest",
|
|
63
|
+
"sqlalchemy": "SQLAlchemy", "pydantic": "Pydantic",
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _iter_files(root: Path):
|
|
68
|
+
seen = 0
|
|
69
|
+
root_s = str(root)
|
|
70
|
+
for dirpath, dirnames, filenames in os.walk(root_s):
|
|
71
|
+
dirnames[:] = [d for d in dirnames if d not in SKIP_DIRS]
|
|
72
|
+
rel = os.path.relpath(dirpath, root_s)
|
|
73
|
+
depth = 0 if rel == "." else rel.count(os.sep) + 1
|
|
74
|
+
if depth > MAX_DEPTH:
|
|
75
|
+
dirnames[:] = []
|
|
76
|
+
continue
|
|
77
|
+
for name in filenames:
|
|
78
|
+
yield Path(dirpath) / name
|
|
79
|
+
seen += 1
|
|
80
|
+
if seen >= MAX_FILES:
|
|
81
|
+
return
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _read_json(path: Path) -> dict:
|
|
85
|
+
try:
|
|
86
|
+
return json.loads(path.read_text(encoding="utf-8", errors="replace"))
|
|
87
|
+
except Exception:
|
|
88
|
+
return {}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _js_frameworks(path: Path) -> list:
|
|
92
|
+
data = _read_json(path)
|
|
93
|
+
names = set()
|
|
94
|
+
for section in ("dependencies", "devDependencies", "peerDependencies"):
|
|
95
|
+
for dep in (data.get(section) or {}):
|
|
96
|
+
if dep in JS_FRAMEWORKS:
|
|
97
|
+
names.add(JS_FRAMEWORKS[dep])
|
|
98
|
+
return sorted(names)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _py_frameworks(root: Path) -> list:
|
|
102
|
+
names = set()
|
|
103
|
+
req = root / "requirements.txt"
|
|
104
|
+
if req.exists():
|
|
105
|
+
for line in req.read_text(encoding="utf-8", errors="replace").splitlines():
|
|
106
|
+
token = line.strip().split("==")[0].split(">=")[0].split("[")[0].lower()
|
|
107
|
+
if token in PY_FRAMEWORKS:
|
|
108
|
+
names.add(PY_FRAMEWORKS[token])
|
|
109
|
+
pyproj = root / "pyproject.toml"
|
|
110
|
+
if pyproj.exists():
|
|
111
|
+
text = pyproj.read_text(encoding="utf-8", errors="replace").lower()
|
|
112
|
+
for dep, label in PY_FRAMEWORKS.items():
|
|
113
|
+
if f'"{dep}"' in text or f"'{dep}'" in text:
|
|
114
|
+
names.add(label)
|
|
115
|
+
return sorted(names)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def detect(path=".") -> dict:
|
|
119
|
+
"""返回 {root, languages[{name,files,share}], markers, frameworks, truncated}。"""
|
|
120
|
+
root = Path(path).expanduser().resolve()
|
|
121
|
+
if not root.is_dir():
|
|
122
|
+
raise ValueError(f"{root} 不是目录")
|
|
123
|
+
counts = {}
|
|
124
|
+
truncated = False
|
|
125
|
+
scanned = 0
|
|
126
|
+
for f in _iter_files(root):
|
|
127
|
+
scanned += 1
|
|
128
|
+
ext = f.suffix.lower()
|
|
129
|
+
lang = LANG_EXT.get(ext)
|
|
130
|
+
if lang:
|
|
131
|
+
counts[lang] = counts.get(lang, 0) + 1
|
|
132
|
+
if scanned >= MAX_FILES:
|
|
133
|
+
truncated = True
|
|
134
|
+
break
|
|
135
|
+
total = sum(counts.values()) or 1
|
|
136
|
+
languages = [{"name": n, "files": c, "share": round(c / total, 3)}
|
|
137
|
+
for n, c in sorted(counts.items(), key=lambda x: (-x[1], x[0]))[:8]]
|
|
138
|
+
markers = []
|
|
139
|
+
for name, (kind, label) in MARKERS.items():
|
|
140
|
+
if (root / name).exists():
|
|
141
|
+
markers.append({"file": name, "kind": kind, "label": label})
|
|
142
|
+
frameworks = []
|
|
143
|
+
pkg = root / "package.json"
|
|
144
|
+
if pkg.exists():
|
|
145
|
+
frameworks += _js_frameworks(pkg)
|
|
146
|
+
frameworks += _py_frameworks(root)
|
|
147
|
+
return {"root": str(root), "scanned": scanned, "truncated": truncated,
|
|
148
|
+
"languages": languages,
|
|
149
|
+
"markers": sorted(markers, key=lambda m: m["file"]),
|
|
150
|
+
"frameworks": sorted(set(frameworks))}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def summary_line(info: dict) -> str:
|
|
154
|
+
top = "、".join(f"{l['name']} {int(l['share'] * 100)}%" for l in info["languages"][:3])
|
|
155
|
+
parts = [f"主语言 {top}"] if top else ["未识别到源码文件"]
|
|
156
|
+
if info["frameworks"]:
|
|
157
|
+
parts.append("框架 " + "、".join(info["frameworks"][:4]))
|
|
158
|
+
if info["markers"]:
|
|
159
|
+
parts.append("构建 " + "、".join(m["label"] for m in info["markers"][:3]))
|
|
160
|
+
return ";".join(parts)
|