vod-devkit 0.1.11 → 0.2.0
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 +10 -0
- package/bin/vod-devkit +129 -13
- package/contract/tools.schema.json +2 -2
- package/package.json +9 -3
- package/vod_mcp/__init__.py +1 -1
- package/vod_mcp/__pycache__/__init__.cpython-314.pyc +0 -0
- package/vod_mcp/__pycache__/packs.cpython-314.pyc +0 -0
- package/vod_mcp/__pycache__/policy.cpython-314.pyc +0 -0
- package/vod_mcp/__pycache__/provenance.cpython-314.pyc +0 -0
- package/vod_mcp/__pycache__/server.cpython-314.pyc +0 -0
- package/vod_mcp/__pycache__/tools.cpython-314.pyc +0 -0
- package/vod_mcp/runtime.json +0 -1473
package/CHANGELOG.md
CHANGED
|
@@ -106,3 +106,13 @@
|
|
|
106
106
|
- a0bd37f feat: 身份界定定稿(归属/授权分离,外部分析对表:三处不采纳+签名回执记P2);内容边界≤2000落码(U32);方案一页纸;S14-S16/U32-U34,24 用例全绿
|
|
107
107
|
- 01e61cc ci: pre-push 本地机器门禁(平台 Actions 不可用期间的替代,实测隔离为账号级平台问题)
|
|
108
108
|
|
|
109
|
+
|
|
110
|
+
## v0.2.0(2026-11-05)
|
|
111
|
+
|
|
112
|
+
- cd37786 feat(D-drift-lock+宿主接入对表): devkit 对表三件落地——①技能拷贝件漂移锁:install 记 skillHashes 指纹→doctor 比对(篡改/缺失 FAIL 引导重装;拒绝 skills-as-MCP-data 架构迁移的依据=规模变量,漂移可检先落地)②opencode /vod-doctor 自检命令随装(devkit_info/auth_status/list_submitted+key 禁令)③scripts/smoke_hosts.py 三宿主连通冒烟(无宿主 SKIP 语义;真机三 PASS)。hooks 层拒绝理由修正为威胁面对照(devkit hook=封 shell 里 hcloud 绕行路 2665 行对抗;囤积链无破坏面无绕行路)。proposal S38-S40+design 九节对照表;75 用例绿
|
|
113
|
+
- 80117b4 docs+test(D-codex-plugin-1 收口): ①proposal 新增 S36(插件自包含+stale 缓存治理+校验设备锚点)/S37(设备锚点一致性协议级)场景用例 ②design 增第八节 Codex 原生插件接入(机制实测/约束三层分工表/自包含与缓存治理/宿主能力判定纪律)③新增 S37 协议级测试:桩引擎捕获 token/meta 请求头比对设备锚点+UA 一致性+纯 hex 断言;73 用例绿
|
|
114
|
+
- 4c65af6 feat(D-codex-plugin-1 增补): devkit 对表三件采纳——①install 前清 stale 插件缓存(~/.codex/plugins/{marketplaces,cache}/vod-local,缓存不自动失效)②插件自包含:.mcp.json 改 python3+./vod_mcp/server.py 相对路径+cwd(去 npm -g 前置),sync_plugin.py 同步 vod_mcp+烧录 build-info.json 进插件包(第四版本失位点实锤:契约 version 滞留 0.1.0,vod_devkit_info 假象——release.sh 同步点 3→4)③plugin.json 补 interface 元数据;安装器校验探针补设备锚点(token/meta 同 device+UA,S1 设备绑定);自包含契约锁测试新增;72 用例绿;真机闭环:重装→codex exec 报 version=0.1.12
|
|
115
|
+
- 3ea554b feat(D-codex-plugin-1 codex 原生插件接入终态): 实测推翻'codex 无 skill 机制'——0.166 有 codex plugin add/marketplace+.codex-plugin/plugin.json(skills+mcpServers)+skills 渐进式加载;AGENTS.md 方案作废(降级模拟),改原生插件:仓内 plugins/vod-devkit(SKILL.md 采集工作流全量+.mcp.json)+本地 marketplace 清单;bin 新增 serve 子命令(.mcp.json 可移植入口);install --target codex 切原生路径+清理旧 config.toml 段/AGENTS.md 块(同名双注册防);工具描述修 S1 口径冲突(用户自报产品不采信不覆盖)。proposal S35+decisions D-codex-plugin-1(含方法论教训:判定宿主能力必须翻全 --help 子命令树);真机闭环(marketplace→add→提单不反问→product_id 落库);72 用例绿
|
|
116
|
+
- 599478b feat(D-codex-agents-1): codex 技能层载体落地——codex 无 skill 机制,采集质量方法论(触发三条件/content🔒字段分级/推断≠编造禁例/预检三项/不追问/回执话术/职责边界)此前在 codex 上裸奔(工具描述只装硬约束)。install --target codex 随装幂等写入 ~/.codex/AGENTS.md 技能紧凑块(标记剥离幂等,用户自有内容保留)。工具描述同步修口径冲突:删除'用户明确要求其他产品可显式传参覆盖'(违背 S1 同源原则——用户自报产品一律不采信不覆盖,照部署产品提交正文原样)。tags 语义注释(problem_type:云声三分类入标题前缀,非 n01 六类)。新增 AGENTS.md 幂等/内容保留测试锁;72 用例绿
|
|
117
|
+
- acfcc4d fix(D-product-id-2 收口): submit_voices 描述补归因话术并前置——codex 等 MCP-only 宿主不加载 skill,模型唯一约束源是工具描述;原描述零归因话术导致用户提单时被反问'什么产品'(T7d 后已废除的旧职责话机复活)。话术前置防宿主描述截断;外部对表建议采纳:约束三层(工具描述/参数描述/非required 结构)+AGENTS.md 仅冗余;其 .codex-plugin/capability_directories 体系与本机 codex CLI v0.166 实测机制不符未采纳(待证据)。71 用例绿;codex 真机行为验证:提单不带 product 不再反问、直接安装绑定归因提交落库
|
|
118
|
+
|
package/bin/vod-devkit
CHANGED
|
@@ -82,6 +82,34 @@ def _server_env(args, packs: str) -> dict:
|
|
|
82
82
|
return env
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
def _skill_hashes() -> dict:
|
|
86
|
+
"""技能拷贝件指纹(D-drift-lock):安装时记录 sha256,verify/doctor 比对
|
|
87
|
+
——拷贝件与安装产物漂移可检(vendor 规则漂移实锤的针对性防线)。"""
|
|
88
|
+
import hashlib
|
|
89
|
+
out = {}
|
|
90
|
+
for entry in sorted((ROOT / "skills").iterdir()):
|
|
91
|
+
if entry.is_dir():
|
|
92
|
+
for f in sorted(entry.rglob("*")):
|
|
93
|
+
if f.is_file():
|
|
94
|
+
rel = f"{entry.name}/{f.relative_to(entry)}"
|
|
95
|
+
out[rel] = hashlib.sha256(f.read_bytes()).hexdigest()
|
|
96
|
+
return out
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _drifted_skills(manifest: dict) -> list:
|
|
100
|
+
"""比对 skillsDir 拷贝件与 manifest.skillHashes,返回漂移文件清单。"""
|
|
101
|
+
import hashlib
|
|
102
|
+
base = Path(manifest["skillsDir"])
|
|
103
|
+
drifted = []
|
|
104
|
+
for rel, sha in (manifest.get("skillHashes") or {}).items():
|
|
105
|
+
f = base / rel
|
|
106
|
+
if not f.exists():
|
|
107
|
+
drifted.append(f"{rel}(缺失)")
|
|
108
|
+
elif hashlib.sha256(f.read_bytes()).hexdigest() != sha:
|
|
109
|
+
drifted.append(f"{rel}(内容被改)")
|
|
110
|
+
return drifted
|
|
111
|
+
|
|
112
|
+
|
|
85
113
|
def _install_hermes(args, packs: str) -> Path:
|
|
86
114
|
"""Hermes:官方途径 hermes mcp add(config.yaml mcp_servers)。"""
|
|
87
115
|
conf = HERMES_MCP_DIR / "vod-devkit.json"
|
|
@@ -130,6 +158,20 @@ def _install_opencode(args, packs: str) -> Path:
|
|
|
130
158
|
}
|
|
131
159
|
conf.write_text(json.dumps(cfg, ensure_ascii=False, indent=2), encoding="utf-8")
|
|
132
160
|
print(f"已写入 OpenCode 配置:{conf}(重启 OpenCode 会话生效)")
|
|
161
|
+
cmd_dir = base / "command"
|
|
162
|
+
cmd_dir.mkdir(parents=True, exist_ok=True)
|
|
163
|
+
(cmd_dir / "vod-doctor.md").write_text(
|
|
164
|
+
"---\n"
|
|
165
|
+
"description: 自检 VOD DevKit 就绪状态(MCP 连通/版本/key/账本)。\n"
|
|
166
|
+
"---\n\n"
|
|
167
|
+
"使用 vod-devkit 工具做就绪自检,按序执行并汇总 OK/缺失:\n"
|
|
168
|
+
"1. 调用 vod_devkit_info:确认 version 与 commitSha 非空(版本/来源溯源)。\n"
|
|
169
|
+
"2. 调用 vod_auth_status:报告 key 配置态与引擎连通性;无 key 属正常(首次提交自动取匿名令牌)。\n"
|
|
170
|
+
"3. 调用 vod_list_submitted(limit 5):报告本机已提交反馈数(本地账本口径)。\n"
|
|
171
|
+
"4. 汇总:installed(OK)vs 缺失(需处理项)。不要打印任何 key/令牌明文。\n"
|
|
172
|
+
"若 MCP 工具不可用(刚装完未重启),提示用户重启 OpenCode 会话。\n",
|
|
173
|
+
encoding="utf-8")
|
|
174
|
+
print(f"已写入 OpenCode 自检命令:/vod-doctor({cmd_dir / 'vod-doctor.md'})")
|
|
133
175
|
return conf
|
|
134
176
|
|
|
135
177
|
|
|
@@ -153,20 +195,72 @@ def _strip_codex_vod_blocks(text: str) -> str:
|
|
|
153
195
|
return "\n".join(out).rstrip()
|
|
154
196
|
|
|
155
197
|
|
|
198
|
+
_AGENTS_MARKER_BEGIN = "<!-- vod-devkit:feedback-skill BEGIN -->"
|
|
199
|
+
_AGENTS_MARKER_END = "<!-- vod-devkit:feedback-skill END -->"
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def _strip_agents_vod_block(text: str) -> str:
|
|
203
|
+
"""幂等剥离 AGENTS.md 中带标记的 vod-devkit 技能块(历史方案清理)。"""
|
|
204
|
+
lines, skipping, out = text.splitlines(), False, []
|
|
205
|
+
for line in lines:
|
|
206
|
+
if line.strip() == _AGENTS_MARKER_BEGIN:
|
|
207
|
+
skipping = True
|
|
208
|
+
continue
|
|
209
|
+
if line.strip() == _AGENTS_MARKER_END:
|
|
210
|
+
skipping = False
|
|
211
|
+
continue
|
|
212
|
+
if not skipping:
|
|
213
|
+
out.append(line)
|
|
214
|
+
return "\n".join(out).rstrip()
|
|
215
|
+
|
|
216
|
+
|
|
156
217
|
def _install_codex(args, packs: str) -> Path:
|
|
157
|
-
"""Codex
|
|
218
|
+
"""Codex(D-codex-agents-1 终态):原生插件路径——
|
|
219
|
+
codex plugin marketplace add <仓>/plugins + plugin add vod-devkit@vod-local,
|
|
220
|
+
打包 skills(渐进式按需加载的采集工作流)+ .mcp.json(vod-devkit serve)。
|
|
221
|
+
历史遗留清理:旧 config.toml [mcp_servers.vod-devkit] 段与 AGENTS.md 技能块
|
|
222
|
+
一并移除(与原生插件同名会双注册;AGENTS.md 方案被原生 skill 取代)。
|
|
223
|
+
前置:codex CLI 与 vod-devkit 命令在 PATH(npm i -g vod-devkit ≥0.1.12)。"""
|
|
224
|
+
codex = shutil.which("codex")
|
|
225
|
+
if not codex:
|
|
226
|
+
print("[vod-devkit] 未找到 codex CLI,无法走原生插件安装", file=sys.stderr)
|
|
227
|
+
sys.exit(2)
|
|
158
228
|
conf = Path.home() / ".codex" / "config.toml"
|
|
159
|
-
conf.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
229
|
+
if conf.exists(): # 历史遗留:config.toml MCP 段与插件同名=双注册,移除
|
|
230
|
+
text = conf.read_text(encoding="utf-8")
|
|
231
|
+
cleaned = _strip_codex_vod_blocks(text)
|
|
232
|
+
if cleaned != text.rstrip():
|
|
233
|
+
conf.write_text(cleaned + "\n", encoding="utf-8")
|
|
234
|
+
print(f"已移除旧 config.toml MCP 段(原生插件取代):{conf}")
|
|
235
|
+
agents = Path.home() / ".codex" / "AGENTS.md"
|
|
236
|
+
if agents.exists(): # 历史遗留:AGENTS.md 技能块已被原生 skill 取代
|
|
237
|
+
text = agents.read_text(encoding="utf-8")
|
|
238
|
+
cleaned = _strip_agents_vod_block(text)
|
|
239
|
+
if cleaned != text.rstrip():
|
|
240
|
+
agents.write_text(cleaned + "\n", encoding="utf-8")
|
|
241
|
+
print(f"已移除旧 AGENTS.md 技能块(原生 skill 取代):{agents}")
|
|
242
|
+
mp_root = ROOT / "plugins"
|
|
243
|
+
|
|
244
|
+
def _run(cmd):
|
|
245
|
+
r = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
|
|
246
|
+
if r.returncode != 0:
|
|
247
|
+
raise RuntimeError(f"{' '.join(cmd)} → {r.stderr.strip() or r.stdout.strip()}")
|
|
248
|
+
return r.stdout
|
|
249
|
+
|
|
250
|
+
mp_name = "vod-local"
|
|
251
|
+
# devkit 卫生实践:stale cache 先清——codex 插件缓存不自动失效,不清则
|
|
252
|
+
# 重装/升级后旧版本残留(marketplace 指向与 cache 内容漂移)
|
|
253
|
+
for stale in (Path.home() / ".codex" / "plugins" / "marketplaces" / mp_name,
|
|
254
|
+
Path.home() / ".codex" / "plugins" / "cache" / mp_name):
|
|
255
|
+
if stale.exists():
|
|
256
|
+
shutil.rmtree(stale)
|
|
257
|
+
print(f"已清理 stale 插件缓存:{stale}")
|
|
258
|
+
ml = subprocess.run([codex, "plugin", "marketplace", "list"], capture_output=True, text=True, timeout=120).stdout
|
|
259
|
+
if mp_name not in ml:
|
|
260
|
+
_run([codex, "plugin", "marketplace", "add", str(mp_root)])
|
|
261
|
+
print(f"已注册本地 marketplace:{mp_root}")
|
|
262
|
+
_run([codex, "plugin", "add", f"vod-devkit@{mp_name}"])
|
|
263
|
+
print("已安装 codex 原生插件 vod-devkit(skills + MCP,重启 Codex 会话生效)")
|
|
170
264
|
return conf
|
|
171
265
|
|
|
172
266
|
|
|
@@ -192,14 +286,21 @@ def _validate_product_or_exit(product: str, base: str) -> bool:
|
|
|
192
286
|
未命中/目录不可达一律拒绝安装并给可执行引导(宁可不装不可装错)。"""
|
|
193
287
|
import urllib.request
|
|
194
288
|
import urllib.error
|
|
289
|
+
import uuid
|
|
195
290
|
api_prefix = "/rest/developer/manager/hdvodmngservice/v1"
|
|
196
291
|
key = os.environ.get("VOD_JAVA_API_KEY", "")
|
|
197
292
|
token = ""
|
|
293
|
+
# 全程一致的设备锚点(S1 设备绑定:token 与后续请求必须同 device/UA,
|
|
294
|
+
# 否则 meta 401 设备不匹配;每次装机一个新锚点,一次校验只耗一枚令牌)
|
|
295
|
+
device = uuid.uuid4().hex[:32]
|
|
296
|
+
ua = "vod-devkit-installer/1"
|
|
198
297
|
|
|
199
298
|
def _get(url: str):
|
|
200
299
|
auth = key or token
|
|
201
300
|
req = urllib.request.Request(url, headers={
|
|
202
301
|
"content-type": "application/json",
|
|
302
|
+
"X-Vod-Device-Id": device,
|
|
303
|
+
"User-Agent": ua,
|
|
203
304
|
**({"authorization": f"Bearer {auth}"} if auth else {}),
|
|
204
305
|
})
|
|
205
306
|
with urllib.request.urlopen(req, timeout=10) as resp:
|
|
@@ -209,7 +310,8 @@ def _validate_product_or_exit(product: str, base: str) -> bool:
|
|
|
209
310
|
if not key:
|
|
210
311
|
req = urllib.request.Request( # 零字段匿名令牌(方案 C 同链)
|
|
211
312
|
f"{base}{api_prefix}/external/token", data=b"{}",
|
|
212
|
-
headers={"content-type": "application/json"
|
|
313
|
+
headers={"content-type": "application/json", "X-Vod-Device-Id": device,
|
|
314
|
+
"User-Agent": ua}, method="POST")
|
|
213
315
|
with urllib.request.urlopen(req, timeout=10) as resp:
|
|
214
316
|
body = json.loads(resp.read().decode("utf-8", "replace") or "{}")
|
|
215
317
|
token = (body.get("data") or {}).get("token") or body.get("token") or ""
|
|
@@ -352,6 +454,7 @@ def cmd_install(args):
|
|
|
352
454
|
"packs": packs,
|
|
353
455
|
"mcpConfig": str(mcp_conf),
|
|
354
456
|
"skillsDir": str(HERMES_SKILLS_DIR),
|
|
457
|
+
"skillHashes": _skill_hashes(),
|
|
355
458
|
}
|
|
356
459
|
manifest_path().write_text(json.dumps(manifest, ensure_ascii=False, indent=2),
|
|
357
460
|
encoding="utf-8")
|
|
@@ -395,6 +498,10 @@ def cmd_doctor(_args):
|
|
|
395
498
|
problems.append("MCP 配置文件缺失")
|
|
396
499
|
if not Path(mf["skillsDir"]).exists():
|
|
397
500
|
problems.append("skills 目录缺失")
|
|
501
|
+
drifted = _drifted_skills(mf)
|
|
502
|
+
if drifted:
|
|
503
|
+
problems.append("技能拷贝件与安装产物漂移(D-drift-lock):"
|
|
504
|
+
+ "、".join(drifted) + "——重跑 install 恢复")
|
|
398
505
|
if problems:
|
|
399
506
|
for x in problems:
|
|
400
507
|
print("FAIL:", x)
|
|
@@ -499,6 +606,10 @@ def cmd_uninstall(_args):
|
|
|
499
606
|
if path.exists():
|
|
500
607
|
shutil.rmtree(path) if path.is_dir() else path.unlink()
|
|
501
608
|
print("removed:", path)
|
|
609
|
+
oc_cmd = Path.home() / ".config/opencode/command/vod-doctor.md"
|
|
610
|
+
if oc_cmd.exists():
|
|
611
|
+
oc_cmd.unlink()
|
|
612
|
+
print("removed:", oc_cmd)
|
|
502
613
|
p.unlink()
|
|
503
614
|
print("removed:", p)
|
|
504
615
|
else:
|
|
@@ -530,6 +641,11 @@ def main():
|
|
|
530
641
|
s = sub.add_parser(name)
|
|
531
642
|
s.set_defaults(fn=fn)
|
|
532
643
|
sub.add_parser("build-info").set_defaults(fn=lambda a: write_build_info(strict=False))
|
|
644
|
+
|
|
645
|
+
def _serve(_a):
|
|
646
|
+
"""codex 原生插件 .mcp.json 入口:exec MCP stdio server(可移植分发)。"""
|
|
647
|
+
os.execv(sys.executable, [sys.executable, str(ROOT / "vod_mcp" / "server.py")])
|
|
648
|
+
sub.add_parser("serve").set_defaults(fn=_serve)
|
|
533
649
|
args = ap.parse_args()
|
|
534
650
|
args.fn(args)
|
|
535
651
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"title": "vod-devkit MCP 工具契约(唯一事实源)",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"tools": {
|
|
6
6
|
"vod_submit_voices": {
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "提交用户反馈。product 归因由安装绑定自动完成(install --product 必配且经产品名录硬校验),调用时无需用户提供、禁止向用户询问\"提交到什么产品\";用户自报的目标产品一律不采信不覆盖(照部署产品提交,提到什么产品随正文原样传达)。批式提交对接囤积端点 POST /external/voices(不触发分析,voiceId 由引擎计算回执下发;引擎未部署 404 自动回落老链)。tags=采集层三分类(problem_type:值)。缺 key 时自动获取零字段匿名令牌。禁止向用户解释内部机制(声音来源/渠道字段/计数规则/配额/归因)。",
|
|
8
8
|
"input": {
|
|
9
9
|
"type": "object",
|
|
10
10
|
"properties": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vod-devkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "VOD 用户声音采集插件——MCP server + 技能 + 声明式护栏,把 agent 产品的用户反馈安全送进 VOD 平台",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,14 +10,20 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"npm/cli.js",
|
|
12
12
|
"bin/vod-devkit",
|
|
13
|
-
"vod_mcp/",
|
|
14
13
|
"skills/",
|
|
15
14
|
"contract/",
|
|
16
15
|
"safety/",
|
|
17
16
|
"QUICKSTART.md",
|
|
18
17
|
"README.md",
|
|
19
18
|
"CHANGELOG.md",
|
|
20
|
-
"LICENSE.txt"
|
|
19
|
+
"LICENSE.txt",
|
|
20
|
+
"vod_mcp/__init__.py",
|
|
21
|
+
"vod_mcp/server.py",
|
|
22
|
+
"vod_mcp/tools.py",
|
|
23
|
+
"vod_mcp/packs.py",
|
|
24
|
+
"vod_mcp/policy.py",
|
|
25
|
+
"vod_mcp/provenance.py",
|
|
26
|
+
"vod_mcp/runtime.example.json"
|
|
21
27
|
],
|
|
22
28
|
"keywords": [
|
|
23
29
|
"mcp",
|
package/vod_mcp/__init__.py
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|