vod-devkit 0.2.2 → 0.3.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 CHANGED
@@ -129,3 +129,73 @@
129
129
  - 2782f5e feat(D-golden-1 doctor/verify golden 基线): 用户可见输出快照比对(devkit doctor-golden 对表,差距清单①第一步)——易变段归一化(HOME/REPO/SHA12),口径漂移即红,有意变更 UPDATE_GOLDEN=1 重录并在失败 diff 人工过目;无 key 确定性基线(key 探针行含易变指纹不入基线);顺带修测试基建 bug:shutil.ignore_patterns 只匹配基名,'vod_mcp/runtime.json' 带斜杠模式永不命中致 clone 混入真源账本。proposal S42+design golden 节;76 用例绿
130
130
  - 28c1f80 feat(D-release-1 一键发版体系+包内容门): release.sh 重写对齐 devkit release-please 语义——bump 从提交历史推导+版本落点表驱动 EXTRA_FILES+整行正则替换+全落点硬断言(根治静默 no-op);新增 scripts/pack_verify.py 包内容门(pack --dry-run 必含/危险项断言)——首跑即实锤 0.1.12 曾含 runtime.json 凭据残留(已 deprecate,0.2.0 起文件级白名单结构性排除,npm 0.1.12 残留令牌仅对已销毁本地库有效);package.json files 改文件级白名单+npm 分发补 plugins/ 随包(0.2.0 漏项致 npx codex 路径必挂,0.2.1 修复);RELEASING.md 发版手册;proposal S41+decisions D-release-1;一键发版真机闭环 v0.2.0/v0.2.1(npx codex 原生插件安装复验通过)
131
131
 
132
+
133
+ ## v0.2.3(2026-11-06)
134
+
135
+ - b3a9a19 S52/S53 场景用例独立成条(极端选择兜底/纠正闭环,从S50补口拆出)+design话术分层同步至S49-S53+D-option引用;router冗余前缀判断合并(in text[:20]为startswith超集,语义不变,既有回归锁覆盖两分支)
136
+ - d30c76a S50 补两口(用户确认):只提追加句括号兜底不进并列选项+纠正闭环(不辩论/按纠正理解走/content仍原话逐字/禁新定性改写);S51 泛化落档 D-option-executability-1(话术选项可执行性纪律:写选项前逐项问代码路径在哪);7例回归锁(115绿)
137
+ - 54d08e3 S49-S51 追加反馈定性话术定稿:先定性再问+留纠正口子+禁空头承诺(无承载机制不得进话术选项);双副本同步锁+frontmatter完整性回归(plugins副本漏同步太慢/吞frontmatter实锤修复);proposal/design/test 三件套齐(113例绿)
138
+ - 5e926b1 skill(collect): 追加反馈定性话术——确认环节用户追加表达时先定性再问(定性是 agent 职责,用户只拍板范围),补模糊话术闭环
139
+ - a16f52d test+docs(router): M1 描述前置回归锁(57字符可见预算+长度上限+词表一致性三断言)——实锤补「太慢」缺失进四副本 description;design §五 多宿主对表与来源分级+M 用例承载表
140
+ - cd4f995 docs(router): 矩阵来源分级+官方文档校正——codex 预算参照改官方 8000 默认(5440=实测值)、钩子事件表官方依据;opencode 官方通道正名 prompt admission hook+description 1-1024 官方上限;dsh/hermes 行标注内部依据(可追溯性纪律)
141
+ - 087f005 docs(router): 矩阵修正——codex「无钩子面」事实错误更正(钩子面存在但输出截断+注入路径不一致方为不做理由,两行合一);hermes 预算表述精确化(57字符索引预算由描述前置吸收);opencode 补截断阈值依据
142
+ - 02f68f5 docs+test+refactor(router): 需求/设计文档正式化(docs/hermes-feedback-router/)+场景用例 H1-H4/R5-R8 承载映射+触发词表单一事实源重构(TRIGGER_WORDS 正则自动组装,补「很糟糕/太糟糕」变体——R5 长句用例暴露覆盖缺口实锤)+register 契约回归锁;修指令文案笔误
143
+ - 37af96f docs(router): 多宿主矩阵更新——opencode 钩子能力实锤结案(chat.message+合成消息双通路,前提高不成立);codex 注入路径不一致风险补记(#37463/#33945)
144
+ - e7d2bf3 docs(router): 多宿主对表——opencode/codex/dsh 激活现状/截断暴露/强制评估可行性矩阵
145
+ - 4a4e095 docs(router): hermes-router.md 补入版本库(上笔提交遗漏 add,untracked 实锤——多会话并行时提交前必须核对文件清单)
146
+ - 5ca9960 feat(docs+gate): S45-S48 场景用例+D-desc-budget-1 截断预算门禁+安装器块扫描重构——①proposal 三·八新增 S45-S48(dsh 安装硬校验拒/放/幂等落盘/修复指引、description 500 字窗口与 Codex 5440 预算存活、归因口径单源)+S11 刷新安装器通道+决策表两行;design 五节 dsh target/六节预算门禁承载;②tests/test_desc_budget.py 4 用例:B1 先决条件<500 字符(dsh 最严窗口)/B2 总长≤1500/双载体(contract+dsh lib 组合串提取)/漂移锁禁旧宽容口径回流;③重构 _find_dsh_block 单一实现供 upsert/uninstall 共用(防双处扫描规则漂移),uninstall 净化;101 pytest+7 node 绿,pyflakes 净
147
+ - e8a21f9 feat(hook): D-hook-1 强制评估路由插件 vod-feedback-router——pre_llm_call 确定性意图路由(业界 forced-eval ~84% 模式),H1-H4 回归锁+installer 集成+decisions 记档
148
+ - 50f754c feat(installer+dsh): D-dsh-install-1 安装期硬校验落 dsh 壳——install --target dsh(--profile 必填先校验后 add、产品 meta 硬校验复用、幂等 upsert profile cordis.patch.yml config 段、dsh 缺失 exit2、写失败 exit1 带修复指引、manifest dshProfile+uninstall 摘除);生效通道真机实证(profile patch config override,banner+桩提交链);dsh 壳 description 归因漂移修复(旧宽容口径句→部署配置权威);INSTALL/dsh README 口径更新;9 回归+golden 重录(仅 +dshProfile 键);93 pytest+7 node 绿
149
+ - 8bdc225 fix(collect-skill): description 触发词前置(Hermes 索引仅前57字符可见,「体验差」原在截断边缘——业界截断静默失败教训)+禁复现排查模式句
150
+ - 7261ec0 docs(dsh): 归因注释对齐 D-attrib-A(实现本就只读配置绑定,模型传参不采信——天然免疫宿主名错归)
151
+ - 53579b0 feat(attribution): D-attrib-A 归因只由安装绑定决定——运行期显式传参仅绑定一致才采信(宿主名自报忽略+ignoredRuntimeProduct 留痕+productSource 可观测),6 回归锁覆盖拍板五场景;推翻 2026-11-03 宽容口径
152
+ - 8f8dca9 fix(collect-skill): 一次抱怨=一条声音红线——禁拆分禁改写变体(实锤:一次抱怨被宿主改写成两条入库建两 issue,引擎逐字幂等被绕过)
153
+ - cd4cccc fix(roster): 多宿主落点并集合并+HOME 隔离剪枝(实锤:按最近安装覆盖互相冲掉落点;fake-home 吞真实 HOME 历史落点)
154
+ - d67ad1b chore(plugin): sync+重烧 build-info
155
+ - a14b857 feat(doctor+instructions+e2e): 名册对账逐宿主核对技能副本+codex 目录补拷;initialize instructions 主动披露采集纪律;free-choice 行为回归脚本(B 熔断违规计数)——huaweicloud-devkit 三防线借鉴落地
156
+ - b3d6030 feat(echo): 提交回执强制原话回显(方案 A 拍板落地)——echo{requiresUserEcho,instruction,contents}+契约 schema/description+2 回归锁;decisions.md 记 D-echo-A-1(A 默认/B 宿主级熔断触发条件)
157
+ - ede20d7 fix(installer): manifest 重复 product 死键删除+golden 键序重录(值不变,product 移至绑定位置)
158
+ - 28c8f5f fix(installer): opencode 目标补拷原生技能到 ~/.config/opencode/skills/(opencode 原生 skill 机制实测识别,此前仅工具描述单通道)
159
+ - 0f4b9d2 feat(contract): vod_submit_voices 描述前置模糊反馈固定话术(MCP-only 宿主唯一约束源,opencode 交互三件套补齐)
160
+ - 5b97527 chore(plugin): sync vod_mcp+skills 自包含包+重烧 build-info(8bfb9f6)
161
+ - 8bfb9f6 fix(submit): 囤积回执缺 voiceIds 不得兜底计成功+引擎 rejected 透出(codex 谎报成功实锤修复);采集技能模糊反馈固定话术(F3 观测定稿)
162
+ - bb312e3 test: golden status 重录版本号 0.2.1→0.2.2(v0.2.2 发版漏重录,pre-push 门禁被存量红挡)
163
+ - b111900 fix(D-consent-desc-1): 确认纪律前置进工具描述——opencode 把用户陈述反馈当同意直提单实锤(契约 description 立即调用话术与 confirm 纪律冲突,MCP-only 宿主不加载技能唯描述可依)+dsh 壳同步+回归锁
164
+
165
+
166
+ ## v0.3.0(2026-11-08)
167
+
168
+ - 370ee37 fix(gate): secret_scan 测试正例改常量承载+行内豁免——门禁拦自测样例的自指问题终解(正例即豁免机制的真实用法自证);新增 query token 模式用例
169
+ - 2600638 fix(gate): secret_scan 正例载体行内豁免——测试自身样例串被门禁拦推的 自指问题(gitleaks 同款 allow 标注机制首用即验证)
170
+ - 0bffc9b feat(gate): pre-push 第三检查=凭据泄漏+高危运行模式静态扫描(对标 huaweicloud-skills 市场采纳清单①)——零依赖 secret_scan.py(oauth2:token@host/query token/私钥块/AK-SK/Bearer 等模式+eval/exec/pickle/shell=True 高危面;行内 secret-scan:allow 豁免留痕;测试正例反例双锁抓出首版 URL token 模式顺序反写缺陷已修);vod-feedback-collect description 补显式 Triggers 词表(中英 19 词,市场惯例=显式词表比散文召回稳,采纳清单②;SKILL 双副本+五宿主装机副本 md5 对齐);pytest 147 绿+node 9 绿+scan OK
171
+ - 350b0a8 fix(skill): S73 拼接判定例——逐字=含语气词/标点,禁删'啊'补句号式改写(opencode 第二次实锤:S72 拼接生效但标点裁量漏网);轮次衔接换行/空格分隔不新增标点+可逐字符还原判据;SKILL 双副本+四宿主副本刷齐;proposal S73+design+decisions 同构序列第四次记档;pytest 141 绿
172
+ - ef1ebbd docs(decisions): S72 附带发现闭环——负责人确认输入原文即'流程合理',DB 记录准确,opencode 输入链路无缺陷,移交项不存在
173
+ - f4681bd fix(skill): S72 反截断红线——引导补充句整体=content 逐字上送禁摘片段(opencode 实锤:'操作不方便,流程合理'被截成'操作不方便',reasoning 日志取证);多轮分散表达按序拼接;SKILL 双副本+四宿主副本刷齐;proposal S72+design 承载+decisions 取证链;pytest 140 绿
174
+ - f3fde9e feat(followup): S71 问卷化追问 tripwire——话术载体结构词黑名单锁(自由生成四维追问清单实锤复盘:分叉示例+频率刻度+期望vs实际三红线全破);数字编号不锁(规则层/话术层分层);proposal S71 用例+design 承载+decisions 记档;pytest 139 绿
175
+ - d158bad chore(lint): test_followup 未使用变量清理(pre-push pyflakes 门禁)
176
+ - e223467 docs(followup): 二次微调落档 design 承载行+decisions 决策记录(跳过条件收窄依据/判定例先于行为验收/一句话口径三处诚实回退与 I22 对齐);pytest 138 绿
177
+ - 6f16aad docs(followup): 判定块二次微调(负责人确认)——跳过条件收窄去"操作/期望"回溯歧义(新字段来源唯一=固定追问原样回答,引导补充自然出现的操作/期望留在 content);"未回应/泛化抱怨"补可执行判定例;一句话口径改可测原文(payload 键+issue 段+来源注记三处诚实回退);契约跳过句补不回溯边界(939/1500);SKILL 判定块锁+边界锁双更新;四宿主副本刷齐;pytest 138 绿
178
+ - e7e8c48 docs(followup): S67-S70 追问触发判定块场景用例落档——proposal 判定块三层+四场景表(S67 已有实质回应不触发/S68 泛化+确认出现一次/S69 未回应+答没有键不存在/S70 防漂移锁);契约 description 补跳过句(831→903/1500);design S67-S70 承载行(dsh desc 无余量由宿主技能层承载的边界显式化);+契约跳过句回归锁;pytest 137 绿
179
+ - 716371e feat(followup): SKILL 追问触发判定块三层显式化(触发前置/跳过条件/触发条件,负责人确认)——引导补充已有实质回应并入 content 则不再触发固定追问(reproSteps/expectedBehavior 不上送=诚实回退);仅泛化抱怨或未回应且确认提交才原样带出至多一次;+SKILL 判定块文本回归锁(双副本逐字一致+四行为用例口径);四宿主装机副本已刷齐;pytest 136 绿
180
+ - adee656 refactor(followup): 透传逻辑单源化 _followup_fields(submit/draft 双路径共用,禁双边漂移)+拒答词集补全(没有了/不方便说)+design §三 S63→S64-S66 落地承载映射表(含重复节头修复)+helper 单元回归锁;pytest 135 绿+node 9 绿
181
+ - 4b43427 feat(followup): D-followup-impl-2 复现/预期追问补充插件侧落地(S64-S66,负责人确认开工,A1 确认环节合并一问/A2 MCP+dsh 壳)——契约 submit+draft 双工具 voices[] 增可选 reproSteps/expectedBehavior(maxLength 2000);固定问句逐字锁死+拒答词集技术兜底(_FOLLOWUP_DECLINES/DECLINES,模型不守话术键集合仍零漂移);仅 trim 非空含键+超 2000 引擎同口径截断+content 原话禁污染;draft 路径随 payload 暂存 commit 原样上送;SKILL 双副本+四宿主装机副本 md5 对账齐;引擎零改动旧路径不变;pytest 134 绿+node 9 绿
182
+ - 44218db feat(two-phase): 两段式提交插件本地极简形态(D-token-approval-2 解冻,负责人拍板方案 2)——vod_draft_voices(暂存+一次性令牌+contents 原话回显)+vod_commit_voices(令牌校验/单次消费/载荷 sha 防调包,内部复用 submit 既有链零新增语义);draft cap10 环形+TTL600s 惰性清除;账本 stage=draft/committed+draftId 关联(验收③绕过两段式可检测);SKILL 话术改两步流程(双副本 md5 同步);128 pytest+8 node 绿
183
+ - 31908e0 decisions: D-token-approval-2 token 化暂缓(负责人拍板 A)——触发条件=codex 真实消费需求;复杂度收益失衡裁剪(引擎写表面不值),恢复门禁口径不变(暂缓=codex 保持只读)
184
+ - fec386e docs+test:S63 复现步骤 AI 追问前置规范落档(业界对表 D-followup-design-1 四约束:可选增强/话术固定化/数据分层/诚实回退;当期不落话术——引擎无 supplement 承载 S51)+S63 tripwire 锁(采集话术禁追问承诺,立项随承载更新)
185
+ - 7a9eb08 decisions: D-followup-design-1 复现步骤 AI 追问前置规范(业界对表,负责人确认)——四条硬约束(可选增强/话术固定化/数据分层/诚实回退),当期不落话术(无承载 S51),立项前置
186
+ - 0ab66ce decisions: B 方案(bundle patch 接管)可行性修正落档——机制确定(bundles 清单管理),调研目标收敛为静态值确认+整行 config 完整性;A 自愈已落(e6a7d32)
187
+ - e6a7d32 feat(doctor): dsh patch 块自愈(A 止血,用户拍板)——doctor 检测 vod 块缺失/打平后按 manifest product/apiBase 重建嵌套块;manifest 补记 apiBase;status 输出归一化动态端口(golden 稳定性);+三态自愈回归锁(123 绿)
188
+ - 6afeb4e decisions: D-codex-circuit-breaker-1 补深审收口记录(P0-2/P0-3/P1-4/P1-5/P2 修复清单)
189
+ - 23a7bb1 fix(installer+packs): 深审四项收口——P0-2 packs 命名漂移(PRESETS full 对齐 ALL_PACKS+kb→knowledge 别名归一,安装口与运行口单源);P0-3 uninstall 破坏性路径(codex mcpConfig 改指插件 .mcp.json/None+config.toml 永不删+codex plugin remove best-effort+doctor None 守卫);P1-4 ack 解除后置到安装成功(失败安装不解熔断);P1-5 codex .mcp.json env 对齐本次 packs;P2 strip 精确表头+AGENTS END 缺失拒写盘;+5 回归锁(122 绿)
190
+ - 4309a41 docs:S60-S62 codex 熔断与恢复门禁场景用例落档(熔断触发/双层门禁安装+运行期/显式解除语义与审计)+design 承载映射(D-codex-circuit-breaker-1);118 绿
191
+ - 525826f feat(breaker): codex 熔断恢复门禁代码化(D-codex-circuit-breaker-1 收口)——①install 门禁:标记在+collect 拒装 exit2 ②--ack-suspension=显式解除(删标记+审计日志,语义与实现一致)③运行期门禁:serve enabled_packs 同查标记强制降级只读(堵 VOD_PACKS 绕过)④probe/packs 测试 HOME 隔离(真实标记不可被测试触碰);118 绿
192
+ - f30d0d8 decisions: D-codex-circuit-breaker-1 落档——熔断执行记录+token 化立项表述纠偏(最强摩擦+审计链,非人类确认硬保证)+恢复门禁(token 化上线前禁恢复采集)+验收标准改写
193
+ - 3a4a519 docs:S58(dsh patch 块 name 绑定+嵌套铁律,入口消失事故)/S59(回执话术=行为实况,S51 回执面应用)落档 proposal+design;116 pytest+8 node 绿
194
+ - 76a3c9d fix(UI): 回执话术=行为实况(S51,用户抓出)——删「审核后将以 issue 形式跟进」空头承诺(匿名直建无人工审核闸,issue 链接由 pollForReceipt 真实建成后补出);+回执实况回归锁(禁审核跟进句/REJECTED 须有引擎状态承载)
195
+ - 87cc0d0 fix(installer): dsh patch 块模板补 name 绑定行——重装幂等替换吞掉 name=client 半静默失激活(入口消失真机实锤:工具壳正常而按钮不在);+name 回归锁(116 绿)
196
+ - 43c57ee docs+test:S54-S57 场景用例落档(暂存恢复补提示/禁拉伸/legacy 清退/widget E_AUTH 兜底)+design 话术分层承载节;ux-sync 回归锁扩容(resize none/恢复话术要素/用户面 key 明文禁令),115 pytest+8 node 绿
197
+ - 856b1db legacy 共用 key 用户面清退(负责人拍板'不合理逻辑去掉'):INSTALL 删明文 legacy key 警告句(公开文档泄露 key 值+教唆反效果);nightly E2E 切匿名令牌主路径(legacy 属 GTD 兼容收尾不进健康检查)+清 scene 残留字段;测试归因绑定显式桩定(曾依赖仓内 runtime 偶发绑定假绿,D-attrib-A 无绑定分支新增回归锁);115 绿
198
+ - 592999e UI:弹窗输入框禁拉伸(resize none,用户反馈拉角顶破布局)——随后台重试补提示一版
199
+ - f90e130 UX 修复:后台重试成功不再静默——暂存反馈自动重试成功后落旗标,下次打开弹窗补提示(逐条原话回显,voice-id 不出用户面 F2;措辞「已自动重试成功」说清=完成用户此前点提交的指令非绕过确认;产品名不带——用户不感知归因拍板)
200
+ - a3cdd6d dsh 壳 UX 定稿同步(web widget 拍板漏同步各壳漂移实锤):提示语去括号后缀与受理引导句、撤 maxlength 计数器(硬帽保留)、撤「我的反馈」入口(账本写入保留);+ux-sync 回归锁(src+构建产物双级)
201
+
package/bin/vod-devkit CHANGED
@@ -7,6 +7,7 @@
7
7
  import argparse
8
8
  import json
9
9
  import os
10
+ import re
10
11
  import shutil
11
12
  import subprocess
12
13
  import sys
@@ -62,8 +63,12 @@ def manifest_path() -> Path:
62
63
  PRESETS = {
63
64
  # 对外默认:开发者=反馈采集者(workflow 不进对外默认集)
64
65
  "collect": "core,collect",
65
- # 内部:运营/可信第三方全量(含分析发起)
66
- "full": "core,workflow,kb,collect",
66
+ # 内部:运营/可信第三方全量。2026-11-06 修正(深审 P0-2):原值
67
+ # "core,workflow,kb,collect" 与运行期 ALL_PACKS=(core,collect,knowledge)
68
+ # 命名漂移——workflow 包已随"运营归 vod-system 前端"净删、kb 是
69
+ # knowledge 的旧称,按原值安装 workflow/kb 被静默丢弃(安装口说装了
70
+ # 运行口不认=挪到别处而非消除)
71
+ "full": "core,collect,knowledge",
67
72
  }
68
73
 
69
74
 
@@ -82,6 +87,44 @@ def _server_env(args, packs: str) -> dict:
82
87
  return env
83
88
 
84
89
 
90
+ def _skill_installs(manifest_path: Path, oc_skills, cx_skills) -> list:
91
+ """多宿主技能落点并集(名册对账):manifest 按「最近一次安装」覆盖会
92
+ 互相冲掉落点(实锤:codex 装完 opencode 落点消失),按 host+dir
93
+ 去重保留历史落点。"""
94
+ import json as _json
95
+ import os
96
+ home = str(Path.home()) + os.sep
97
+ prev = {}
98
+ if manifest_path.exists():
99
+ try:
100
+ for si in _json.loads(manifest_path.read_text(encoding="utf-8")).get("skillInstalls") or []:
101
+ d = si.get("dir") or ""
102
+ # 只保留「当前 HOME 之下且目录真实存在」的落点——隔离环境
103
+ # (fake-home 测试)不吞真实 HOME 的历史落点,卸载残留自动剪枝
104
+ if d.startswith(home) and Path(d).is_dir():
105
+ prev[(si["host"], d)] = si
106
+ except Exception:
107
+ pass
108
+ for h, d in (("hermes", HERMES_SKILLS_DIR),
109
+ ("opencode", oc_skills), ("codex", cx_skills)):
110
+ if d is not None:
111
+ prev[(h, str(d))] = {"host": h, "dir": str(d)}
112
+ return sorted(prev.values(), key=lambda x: (x["host"], x["dir"]))
113
+
114
+
115
+ def _dir_hashes(base: Path) -> dict:
116
+ """对既有目录树计算相对 sha256 指纹(roster 对账用)。"""
117
+ import hashlib
118
+ out = {}
119
+ for skill in sorted(Path(base).iterdir()):
120
+ if skill.is_dir():
121
+ for f in sorted(skill.rglob("*")):
122
+ if f.is_file():
123
+ out[f"{skill.name}/{f.relative_to(skill)}"] = (
124
+ hashlib.sha256(f.read_bytes()).hexdigest())
125
+ return out
126
+
127
+
85
128
  def _skill_hashes() -> dict:
86
129
  """技能拷贝件指纹(D-drift-lock):安装时记录 sha256,verify/doctor 比对
87
130
  ——拷贝件与安装产物漂移可检(vendor 规则漂移实锤的针对性防线)。"""
@@ -125,6 +168,17 @@ def _install_hermes(args, packs: str) -> Path:
125
168
  ["hermes", "mcp", "add", "vod-devkit", "--command", sys.executable,
126
169
  *["--env"] + env_args, "--args", _server_entry()],
127
170
  input="y\ny\n", capture_output=True, text=True)
171
+ # D-hook-1:强制评估路由插件(pre_llm_call 确定性意图路由,业界 forced-eval 模式)
172
+ import shutil as _sh
173
+ plug_src = ROOT / "hermes-plugin" / "vod-feedback-router"
174
+ plug_dst = Path.home() / ".hermes" / "plugins" / "vod-feedback-router"
175
+ if plug_src.is_dir():
176
+ if plug_dst.exists():
177
+ _sh.rmtree(plug_dst)
178
+ _sh.copytree(plug_src, plug_dst)
179
+ print("已安装 vod-feedback-router 路由插件(~/.hermes/plugins/);"
180
+ "需在 plugins.enabled 加入该名单后生效"
181
+ "(hermes config set plugins.enabled ...,重启会话生效)")
128
182
  if r.returncode == 0:
129
183
  print("已注册 Hermes MCP(hermes mcp list 可见;重启会话生效)")
130
184
  else:
@@ -185,7 +239,9 @@ def _strip_codex_vod_blocks(text: str) -> str:
185
239
  out, skipping = [], False
186
240
  for line in text.splitlines():
187
241
  s = line.strip()
188
- if s.startswith("[mcp_servers.vod-devkit"):
242
+ # P2(深审 2026-11-06):精确匹配表头——startswith("…vod-devkit")
243
+ # 会误删 [mcp_servers.vod-devkit2] 等无关表
244
+ if s == "[mcp_servers.vod-devkit]":
189
245
  skipping = True
190
246
  continue
191
247
  if skipping and s.startswith("["):
@@ -200,7 +256,11 @@ _AGENTS_MARKER_END = "<!-- vod-devkit:feedback-skill END -->"
200
256
 
201
257
 
202
258
  def _strip_agents_vod_block(text: str) -> str:
203
- """幂等剥离 AGENTS.md 中带标记的 vod-devkit 技能块(历史方案清理)。"""
259
+ """幂等剥离 AGENTS.md 中带标记的 vod-devkit 技能块(历史方案清理)。
260
+
261
+ P2(深审 2026-11-06):只有 BEGIN 没有 END 时不得静默吞掉文件剩余
262
+ 全部内容——抛错拒绝(调用方 exit 2 不落盘),宁可装不上不可删用户文件。
263
+ """
204
264
  lines, skipping, out = text.splitlines(), False, []
205
265
  for line in lines:
206
266
  if line.strip() == _AGENTS_MARKER_BEGIN:
@@ -211,6 +271,10 @@ def _strip_agents_vod_block(text: str) -> str:
211
271
  continue
212
272
  if not skipping:
213
273
  out.append(line)
274
+ if skipping:
275
+ raise RuntimeError(
276
+ "AGENTS.md 存在 vod-devkit BEGIN 标记但缺失 END 标记"
277
+ "(文件可能被手动截断)——拒绝自动清理,请手动检查该文件")
214
278
  return "\n".join(out).rstrip()
215
279
 
216
280
 
@@ -235,7 +299,11 @@ def _install_codex(args, packs: str) -> Path:
235
299
  agents = Path.home() / ".codex" / "AGENTS.md"
236
300
  if agents.exists(): # 历史遗留:AGENTS.md 技能块已被原生 skill 取代
237
301
  text = agents.read_text(encoding="utf-8")
238
- cleaned = _strip_agents_vod_block(text)
302
+ try:
303
+ cleaned = _strip_agents_vod_block(text)
304
+ except RuntimeError as e:
305
+ print(f"[vod-devkit] {e}", file=sys.stderr)
306
+ sys.exit(2)
239
307
  if cleaned != text.rstrip():
240
308
  agents.write_text(cleaned + "\n", encoding="utf-8")
241
309
  print(f"已移除旧 AGENTS.md 技能块(原生 skill 取代):{agents}")
@@ -261,11 +329,139 @@ def _install_codex(args, packs: str) -> Path:
261
329
  print(f"已注册本地 marketplace:{mp_root}")
262
330
  _run([codex, "plugin", "add", f"vod-devkit@{mp_name}"])
263
331
  print("已安装 codex 原生插件 vod-devkit(skills + MCP,重启 Codex 会话生效)")
264
- return conf
332
+ # P1-5(深审 2026-11-06):插件自带的 .mcp.json 硬编码 env.VOD_PACKS=
333
+ # core,collect——--packs 对 codex 半失效(运行期仍注册 collect 工具)。
334
+ # plugin add 后把缓存内 .mcp.json 的 packs 对齐本次安装值。
335
+ import glob as _glob
336
+ mcp_jsons = sorted(
337
+ _glob.glob(str(Path.home() / ".codex" / "plugins" / "cache"
338
+ / mp_name / "vod-devkit" / "*" / ".mcp.json")),
339
+ key=lambda p: Path(p).stat().st_mtime, reverse=True)
340
+ if mcp_jsons:
341
+ try:
342
+ mj = json.loads(Path(mcp_jsons[0]).read_text(encoding="utf-8"))
343
+ srv = mj.get("mcpServers", {}).get("vod-devkit")
344
+ if srv is not None:
345
+ srv.setdefault("env", {})["VOD_PACKS"] = packs
346
+ Path(mcp_jsons[0]).write_text(
347
+ json.dumps(mj, ensure_ascii=False, indent=2) + "\n",
348
+ encoding="utf-8")
349
+ print(f"已对齐插件 MCP packs:{mcp_jsons[0]}(VOD_PACKS={packs})")
350
+ except Exception as e:
351
+ print(f"[vod-devkit] warn: 插件 .mcp.json packs 对齐失败({e})——"
352
+ "运行期熔断门禁仍会兜底", file=sys.stderr)
353
+ return Path(mcp_jsons[0])
354
+ # 深审 P0-3:绝不再返回 ~/.codex/config.toml——它是用户整份 codex 配置,
355
+ # uninstall 对 mcpConfig 是删除语义,指向它=卸载删光用户配置(破坏性)
356
+ print("[vod-devkit] warn: 未定位到插件 .mcp.json(uninstall 将跳过 MCP 清理,"
357
+ "可手动删除插件缓存目录)", file=sys.stderr)
358
+ return None
359
+
360
+
361
+ def _install_dsh(args, packs: str) -> Path:
362
+ """dsh 工具壳(D-dsh-install-1,2026-11-06 用户拍板 A):三壳口径统一——
363
+ --product 安装期硬校验(cmd_install 已先行,到达此处必已过)+ 校验先于
364
+ add + 幂等写 profile cordis.patch.yml config override。
365
+ 生效通道真机实测(2026-11-06,dsh 0.2.1-rc.5):profile cordis.patch.yml
366
+ 的 id-targeted config override 是工具壳读取 product/apiBase/confirmWrites
367
+ 的唯一运行时通道(启动 banner + 桩引擎提交链实证)。dsh plugin add 会自建
368
+ profile,无需前置。"""
369
+ dsh = shutil.which("dsh")
370
+ profile = (getattr(args, "dsh_profile", "") or "").strip()
371
+ if not profile:
372
+ # argparse 进入安装前校验(cmd_install 已兜底,直调防御)
373
+ print("[vod-devkit] --profile 必填:dsh 按 profile 组织插件与配置"
374
+ "(--profile <name>)", file=sys.stderr)
375
+ sys.exit(2)
376
+ if not dsh:
377
+ print("[vod-devkit] 未找到 dsh CLI(PATH),拒绝安装(宁可不装不可装错)。"
378
+ "前置:npm i -g @deepseek-ai/dsh(需 pnpm)", file=sys.stderr)
379
+ sys.exit(2)
380
+ r = subprocess.run([dsh, "plugin", "--profile", profile,
381
+ "add", "dsh-vod-devkit"],
382
+ capture_output=True, text=True, timeout=300)
383
+ if r.returncode != 0:
384
+ print(f"[vod-devkit] dsh plugin add 失败:{(r.stderr or r.stdout).strip()[-300:]}",
385
+ file=sys.stderr)
386
+ sys.exit(1)
387
+ print(f"已安装 dsh 插件 dsh-vod-devkit(profile={profile},dsh plugin list 可见)")
388
+
389
+ patch = Path.home() / ".dsh" / "profiles" / profile / "cordis.patch.yml"
390
+ # name 行必须保留:cordis.patch.yml 的 insert 块靠 name 绑定 client 半
391
+ # (反馈按钮)——只写 id+config 会在重装幂等替换时把 name 吞掉,UI 静默
392
+ # 失激活(2026-11-06 真机实锤:重装后入口消失)
393
+ block = ("- id: vod-devkit\n"
394
+ " name: dsh-vod-devkit\n"
395
+ " config:\n"
396
+ f" product: {args.product}\n"
397
+ f" apiBase: {args.java_api_base}\n")
398
+ try:
399
+ written = _upsert_dsh_patch(patch, block)
400
+ except Exception as e:
401
+ # 回滚/修复指引:插件已装但配置未写 = 半成品,给明确的手动修复格式
402
+ print(f"[vod-devkit] 插件已装入 profile={profile},但配置写入失败"
403
+ f"({e.__class__.__name__})。请手动把下段并入 {patch}"
404
+ f"(顶层 YAML 数组元素,已有 - id: vod-devkit 段则原位替换):\n"
405
+ f"{block}", file=sys.stderr)
406
+ sys.exit(1)
407
+ if written:
408
+ print(f"已写入归因/引擎配置(幂等 upsert):{patch}")
409
+ else:
410
+ print(f"配置未变化(幂等跳过):{patch}")
411
+ return patch
412
+
413
+
414
+ def _find_dsh_block(lines):
415
+ """定位 cordis.patch.yml 中 `- id: vod-devkit` 顶层块的 (start, end);
416
+ 不存在返回 (None, None)。块边界=下一顶层元素行(`- ` 开头)或 EOF。
417
+ install 的幂等 upsert 与 uninstall 的摘除共用同一边界语义(单一实现,
418
+ 防两处扫描规则漂移——双载体漂移已在本仓 dsh/UI 壳实锤过)。"""
419
+ for i, ln in enumerate(lines):
420
+ if ln.strip().startswith("- id: vod-devkit"):
421
+ end = len(lines)
422
+ for j in range(i + 1, len(lines)):
423
+ if lines[j].startswith("- "): # 下一顶层元素:本块结束
424
+ end = j
425
+ break
426
+ return i, end
427
+ return None, None
428
+
429
+
430
+ def _upsert_dsh_patch(patch: Path, block: str) -> bool:
431
+ """幂等写 profile cordis.patch.yml:已存在 `- id: vod-devkit` 段则原位整块
432
+ 替换(不重复插入);无则追加。按行扫描块边界(下一行 `- ` 顶层元素或 EOF),
433
+ 不引 YAML 依赖(本仓零第三方依赖红线)。返回是否有写入。"""
434
+ lines = patch.read_text(encoding="utf-8").splitlines() if patch.exists() else []
435
+ start, end = _find_dsh_block(lines)
436
+ if start is None:
437
+ new = lines + ([""] if lines and lines[-1].strip() else []) + block.splitlines()
438
+ else:
439
+ new = lines[:start] + block.splitlines() + lines[end:]
440
+ new_text = "\n".join(new).rstrip("\n") + "\n"
441
+ old_text = patch.read_text(encoding="utf-8") if patch.exists() else ""
442
+ if new_text == old_text:
443
+ return False
444
+ patch.parent.mkdir(parents=True, exist_ok=True)
445
+ patch.write_text(new_text, encoding="utf-8")
446
+ return True
447
+
448
+
449
+ def _remove_dsh_patch_block(patch: Path) -> bool:
450
+ """从 cordis.patch.yml 摘除 vod-devkit 块(uninstall 用)。返回是否摘除。"""
451
+ if not patch.exists():
452
+ return False
453
+ lines = patch.read_text(encoding="utf-8").splitlines()
454
+ start, end = _find_dsh_block(lines)
455
+ if start is None:
456
+ return False
457
+ patch.write_text(
458
+ "\n".join(lines[:start] + lines[end:]).rstrip("\n") + "\n",
459
+ encoding="utf-8")
460
+ return True
265
461
 
266
462
 
267
463
  _INSTALLERS = {"hermes": _install_hermes, "opencode": _install_opencode,
268
- "codex": _install_codex}
464
+ "codex": _install_codex, "dsh": _install_dsh}
269
465
 
270
466
 
271
467
  def detect_targets() -> list:
@@ -277,6 +473,8 @@ def detect_targets() -> list:
277
473
  found.append("opencode")
278
474
  if (Path.home() / ".codex").exists():
279
475
  found.append("codex")
476
+ if shutil.which("dsh"):
477
+ found.append("dsh")
280
478
  return found
281
479
 
282
480
 
@@ -376,6 +574,24 @@ def cmd_install(args):
376
574
  print(f"不支持目标: {target}(可选 hermes|opencode|codex|auto)", file=sys.stderr)
377
575
  sys.exit(2)
378
576
  packs = args.packs or PRESETS.get(args.preset, "")
577
+ # 恢复门禁(D-codex-circuit-breaker-1,2026-11-06 负责人确认):
578
+ # 熔断标记存在(~/.codex/vod-collect-suspended.json)时,codex 装 collect
579
+ # 被拒——恢复采集的前置=token 化上线并过回归,不是改回 packs 一个动作;
580
+ # --ack-suspension=显式解除(P1-4 修正:解除动作后置到安装成功之后——
581
+ # 若产品校验/安装中途失败,熔断不得已被解除)。
582
+ pending_ack = False
583
+ if target == "codex" and "collect" in (packs or "").replace(" ", "").split(","):
584
+ marker = Path.home() / ".codex" / "vod-collect-suspended.json"
585
+ if marker.is_file() and getattr(args, "ack_suspension", False):
586
+ pending_ack = True # 解除后置:安装成功才落
587
+ elif marker.is_file():
588
+ print("[vod-devkit] 恢复门禁:codex 采集处于熔断状态"
589
+ "(未确认提交 ≥2 次,详见 docs/decisions.md"
590
+ " D-codex-circuit-breaker-1)。"
591
+ "恢复前置=token 化两段式上线并通过回归"
592
+ "(draft→commit 审计链/重复 commit 被拒/未确认可检测)。",
593
+ file=sys.stderr)
594
+ sys.exit(2)
379
595
  # 归因绑定(T7d 统一:安装必配,与 dsh UI 加载必配同口径):--product 必填——
380
596
  # 缺省宿主名在生态部署是错归陷阱(高校AI开发者平台 agent 底座=hermes,
381
597
  # 不填则反馈全归 hermes)。宿主名仍是合法值(自反馈场景显式传
@@ -389,6 +605,12 @@ def cmd_install(args):
389
605
  " GET /external/products",
390
606
  file=sys.stderr)
391
607
  sys.exit(2)
608
+ # D-dsh-install-1:--profile 必填在进入任何安装动作前校验(先校验后写入)
609
+ if target == "dsh" and not (args.dsh_profile or "").strip():
610
+ print("[vod-devkit] --profile 必填:dsh 按 profile 组织插件与配置。\n"
611
+ " 例:npx vod-devkit install --target dsh --profile web --product CodeArts",
612
+ file=sys.stderr)
613
+ sys.exit(2)
392
614
  bound_product = args.product
393
615
  # D-product-id-2(2026-11-05 用户拍板 B,推翻"宿主名是显式合法值"宽容口径):
394
616
  # 安装期产品硬校验——--product 必须命中 meta productCatalog(名字大小写不敏感
@@ -422,9 +644,36 @@ def cmd_install(args):
422
644
 
423
645
  mcp_conf = installer(args, packs)
424
646
 
647
+ # P1-4 修正:ack 解除后置——安装全部成功才落(解除先于安装=失败安装
648
+ # 也绕过了恢复门禁语义)
649
+ if pending_ack:
650
+ marker = Path.home() / ".codex" / "vod-collect-suspended.json"
651
+ if marker.is_file():
652
+ marker.unlink()
653
+ audit = Path.home() / ".codex" / "vod-collect-suspension-audit.log"
654
+ with audit.open("a", encoding="utf-8") as f:
655
+ f.write(f"{datetime.datetime.now().isoformat(timespec='seconds')}\t"
656
+ f"ack_suspension\tpacks={packs}\n")
657
+ print(f"[vod-devkit] 已显式解除 codex 采集熔断(安装成功),审计已记录:{audit}")
658
+
425
659
  # G1 修复:技能全量拷贝(目录型技能+平铺规则文档),按 packs 过滤
426
660
  HERMES_SKILLS_DIR.mkdir(parents=True, exist_ok=True)
661
+ # opencode 原生技能目录(2026-11-06 实测:opencode 自动发现
662
+ # ~/.config/opencode/skills/ 并经 skill 工具按需加载——此前安装器漏拷,
663
+ # opencode 只有工具描述一条约束通道,话术类约束全部失效)
664
+ oc_skills = None
665
+ cx_skills = None
666
+ if target == "opencode":
667
+ import platform as _pf
668
+ oc_base = Path.home() / (".config/opencode" if _pf.system() != "Windows"
669
+ else "AppData/Local/opencode")
670
+ oc_skills = oc_base / "skills"
671
+ oc_skills.mkdir(parents=True, exist_ok=True)
672
+ elif target == "codex":
673
+ cx_skills = Path.home() / ".codex" / "skills"
674
+ cx_skills.mkdir(parents=True, exist_ok=True)
427
675
  pack_set = set(p for p in packs.split(",") if p)
676
+ extra_skill_dirs = [d for d in (oc_skills, cx_skills) if d is not None]
428
677
  for entry in sorted((ROOT / "skills").iterdir()):
429
678
  if entry.is_dir(): # vod-core / vod-feedback-collect
430
679
  skill = entry.name
@@ -436,11 +685,15 @@ def cmd_install(args):
436
685
  if dst.exists():
437
686
  shutil.rmtree(dst)
438
687
  shutil.copytree(entry, dst)
688
+ for oc_dst in extra_skill_dirs:
689
+ dst2 = oc_dst / skill
690
+ if dst2.exists():
691
+ shutil.rmtree(dst2)
692
+ shutil.copytree(entry, dst2)
439
693
  # vendored 领域规则已由 vendor_rules.py 落成技能目录结构
440
694
 
441
695
  bi = json.loads((ROOT / "build-info.json").read_text(encoding="utf-8"))
442
696
  manifest = {
443
- "product": "vod-devkit",
444
697
  "version": bi["version"],
445
698
  "source": {"type": "git", "remote": bi["sourceRemote"],
446
699
  "ref": subprocess.run(["git", "rev-parse", "--abbrev-ref", "HEAD"],
@@ -452,8 +705,18 @@ def cmd_install(args):
452
705
  "distribution": getattr(args, "distribution", "devkit"),
453
706
  "product": bound_product,
454
707
  "packs": packs,
455
- "mcpConfig": str(mcp_conf),
708
+ "dshProfile": (getattr(args, "dsh_profile", "") or "").strip() or None,
709
+ # dsh 修复用(S60/A 止血):patch 块被 dsh 运行时序列化冲掉后,
710
+ # doctor 可凭 product/apiBase 重建(块内容=安装期静态部署值)
711
+ "apiBase": (getattr(args, "java_api_base", "") or "") or None,
712
+ "mcpConfig": (str(mcp_conf) if mcp_conf else None),
456
713
  "skillsDir": str(HERMES_SKILLS_DIR),
714
+ # 名册对账(huaweicloud-devkit doctor 模式借鉴,2026-11-06):
715
+ # 每个原生技能落点的独立指纹——漏装/漂移可被 doctor 逐落点抓出,
716
+ # 不再只盯 hermes 单目录(opencode 漏拷静默失效的针对性防线)。
717
+ # 多宿主并集合并:manifest 按「最近一次安装」覆盖会互相冲掉落点
718
+ # (实锤:codex 装完 opencode 落点消失),按 host+dir 去重保留历史
719
+ "skillInstalls": _skill_installs(manifest_path(), oc_skills, cx_skills),
457
720
  "skillHashes": _skill_hashes(),
458
721
  }
459
722
  manifest_path().write_text(json.dumps(manifest, ensure_ascii=False, indent=2),
@@ -481,7 +744,54 @@ def cmd_status(_args):
481
744
  if not p.exists():
482
745
  print("未安装(无 install-manifest)")
483
746
  sys.exit(1)
484
- print(p.read_text(encoding="utf-8"))
747
+ # golden 稳定性:apiBase 含安装期动态值(本地验证实例端口),归一化后输出
748
+ text = p.read_text(encoding="utf-8")
749
+ text = re.sub(r'"apiBase": "http://127\.0\.0\.1:\d+"',
750
+ '"apiBase": "http://127.0.0.1:<PORT>"', text)
751
+ print(text)
752
+
753
+
754
+ def _repair_dsh_patch_block(mf: dict) -> str | None:
755
+ """doctor 自愈(S58/A):profile cordis.patch.yml 的 vod-devkit 块缺失或
756
+ 打平(未缩进在 - insert: 之下)时,按 manifest 的 product/apiBase 重建
757
+ 正确嵌套块。返回修复的文件路径;块完好返回 None。
758
+
759
+ 嵌套铁律(真机实锤):id/name/config 必须缩进在 `- insert:` 之下——
760
+ dsh 的配置序列化只保留它能识别的块,手工游离块会被下次写盘冲掉。
761
+ """
762
+ prof = mf["dshProfile"]
763
+ patch = Path.home() / ".dsh" / "profiles" / prof / "cordis.patch.yml"
764
+ if not patch.exists():
765
+ return None
766
+ lines = patch.read_text(encoding="utf-8").splitlines()
767
+ vod_idx = next((i for i, ln in enumerate(lines)
768
+ if ln.strip().startswith("- id: vod-devkit")), None)
769
+ if vod_idx is not None and lines[vod_idx].startswith((" ", "\t")):
770
+ # 已嵌套且在 insert 组内(简化判定:缩进+前文存在 - insert: 行)→ 完好
771
+ has_insert = any(ln.strip() == "- insert:" for ln in lines[:vod_idx])
772
+ has_name = any("name: dsh-vod-devkit" in ln
773
+ for ln in lines[vod_idx:vod_idx + 3])
774
+ if has_insert and has_name:
775
+ return None
776
+ # 需要重建:先摘除旧块(块边界=下一个 `- ` 群组项,任何缩进),再追加正确嵌套组
777
+ if vod_idx is not None:
778
+ end = next((j for j in range(vod_idx + 1, len(lines))
779
+ if lines[j].strip().startswith("- ")), len(lines))
780
+ del lines[vod_idx:end]
781
+ if lines and lines[-1].strip():
782
+ lines.append("")
783
+ product = mf.get("product") or ""
784
+ api_base = mf.get("apiBase") or ""
785
+ lines += [
786
+ "- insert:",
787
+ " - id: vod-devkit",
788
+ " name: dsh-vod-devkit",
789
+ " config:",
790
+ f" product: {product}",
791
+ f" apiBase: {api_base}",
792
+ ]
793
+ patch.write_text("\n".join(lines).rstrip("\n") + "\n", encoding="utf-8")
794
+ return str(patch)
485
795
 
486
796
 
487
797
  def cmd_doctor(_args):
@@ -491,10 +801,18 @@ def cmd_doctor(_args):
491
801
  problems.append("无 install-manifest.json(未 install?)")
492
802
  else:
493
803
  mf = json.loads(p.read_text(encoding="utf-8"))
804
+ # dsh patch 块自愈(S58/A 止血,2026-11-06 真机实锤):dsh 运行时
805
+ # 序列化会冲掉 profile patch 里的 vod 块(配置树不含手工块)——
806
+ # doctor 检测缺失/打平后按 manifest 的 product/apiBase 重建嵌套块
807
+ if mf.get("target") == "dsh" and mf.get("dshProfile"):
808
+ patched = _repair_dsh_patch_block(mf)
809
+ if patched:
810
+ print(f"[doctor] 已重建 dsh patch 的 vod-devkit 块:{patched}"
811
+ "(重启 dsh 生效)")
494
812
  bi = json.loads((ROOT / "build-info.json").read_text(encoding="utf-8"))
495
813
  if mf["source"]["commitSha"] != bi.get("commitSha"):
496
814
  problems.append("install-manifest 与 build-info 的 commitSHA 不一致")
497
- if not Path(mf["mcpConfig"]).exists():
815
+ if mf.get("mcpConfig") and not Path(mf["mcpConfig"]).exists():
498
816
  problems.append("MCP 配置文件缺失")
499
817
  if not Path(mf["skillsDir"]).exists():
500
818
  problems.append("skills 目录缺失")
@@ -502,6 +820,21 @@ def cmd_doctor(_args):
502
820
  if drifted:
503
821
  problems.append("技能拷贝件与安装产物漂移(D-drift-lock):"
504
822
  + "、".join(drifted) + "——重跑 install 恢复")
823
+ # 名册对账(逐原生落点):漏装/漂移按宿主点名(借鉴 devkit doctor)
824
+ for si in mf.get("skillInstalls") or []:
825
+ d = Path(si["dir"])
826
+ if not d.exists():
827
+ problems.append(f"技能原生副本缺失({si['host']}):{d} 不存在"
828
+ "——重跑 install 恢复")
829
+ continue
830
+ import hashlib
831
+ expect = mf.get("skillHashes") or {}
832
+ for rel, sha in expect.items():
833
+ f = d / rel
834
+ if not f.exists():
835
+ problems.append(f"技能文件缺失({si['host']}):{rel}")
836
+ elif hashlib.sha256(f.read_bytes()).hexdigest() != sha:
837
+ problems.append(f"技能文件漂移({si['host']}):{rel}")
505
838
  if problems:
506
839
  for x in problems:
507
840
  print("FAIL:", x)
@@ -602,14 +935,42 @@ def cmd_uninstall(_args):
602
935
  if p.exists():
603
936
  mf = json.loads(p.read_text(encoding="utf-8"))
604
937
  for key in ("mcpConfig", "skillsDir"):
605
- path = Path(mf[key])
938
+ path_s = mf.get(key)
939
+ if not path_s:
940
+ continue # codex 等宿主 mcpConfig 可为 None(P0-3:无托管配置文件)
941
+ path = Path(path_s)
942
+ # 深审 P0-3(破坏性路径一票否决):config.toml 是用户整份 codex
943
+ # 配置,永不在 uninstall 删除——旧版 manifest 曾把它记成 mcpConfig
944
+ if path.name == "config.toml":
945
+ print(f"skip(用户配置文件,uninstall 永不删除):{path}")
946
+ continue
606
947
  if path.exists():
607
948
  shutil.rmtree(path) if path.is_dir() else path.unlink()
608
949
  print("removed:", path)
950
+ # codex 原生插件摘除(best-effort:CLI 命令名随版本可能变化,失败不阻塞)
951
+ if mf.get("target") == "codex":
952
+ codex = shutil.which("codex")
953
+ if codex:
954
+ r = subprocess.run([codex, "plugin", "remove",
955
+ "vod-devkit@vod-local"],
956
+ capture_output=True, text=True, timeout=120)
957
+ print("codex plugin remove:",
958
+ "OK" if r.returncode == 0
959
+ else (r.stderr or r.stdout).strip()[-120:])
609
960
  oc_cmd = Path.home() / ".config/opencode/command/vod-doctor.md"
610
961
  if oc_cmd.exists():
611
962
  oc_cmd.unlink()
612
963
  print("removed:", oc_cmd)
964
+ # dsh 壳(D-dsh-install-1):摘插件 + 从 profile patch 移除 config 段
965
+ dsh = shutil.which("dsh")
966
+ if dsh:
967
+ prof = (mf.get("dshProfile") or "").strip()
968
+ if prof:
969
+ subprocess.run([dsh, "plugin", "--profile", prof, "remove",
970
+ "dsh-vod-devkit"], capture_output=True, text=True)
971
+ patch = Path.home() / ".dsh" / "profiles" / prof / "cordis.patch.yml"
972
+ if _remove_dsh_patch_block(patch):
973
+ print("removed vod-devkit config block:", patch)
613
974
  p.unlink()
614
975
  print("removed:", p)
615
976
  else:
@@ -620,18 +981,23 @@ def main():
620
981
  ap = argparse.ArgumentParser(prog="vod-devkit")
621
982
  sub = ap.add_subparsers(dest="cmd", required=True)
622
983
  sp = sub.add_parser("install")
623
- sp.add_argument("--target", default="auto", help="hermes|opencode|codex|auto(默认探测)")
984
+ sp.add_argument("--target", default="auto",
985
+ help="hermes|opencode|codex|dsh|auto(默认探测)")
624
986
  sp.add_argument("--preset", default="collect", choices=list(PRESETS),
625
987
  help="collect=对外默认(采集者);full=内部全量")
626
988
  sp.add_argument("--api-base", default="http://127.0.0.1:8000")
627
989
  sp.add_argument("--java-api-base", default=None,
628
990
  help="VOD 平台地址(缺省=https://vod-dev.topxtopx.com,勿用回环默认)")
629
991
  sp.add_argument("--packs", default="", help="显式覆盖 preset(逗号分隔)")
992
+ sp.add_argument("--ack-suspension", action="store_true",
993
+ help="确认解除 codex 采集熔断(恢复门禁逃生口,D-codex-circuit-breaker-1)")
630
994
  sp.add_argument("--product", default="",
631
995
  help="归因绑定:本 agent 服务的产品(codearts/aishell 等;采集反馈默认归属)")
632
996
  sp.add_argument("--distribution", default="devkit", choices=["devkit", "preset"],
633
997
  help="devkit=开发/运维自装(默认);preset=产品随 agent 分发(禁 key 随包/"
634
998
  "禁自更新/客户机首启重生成状态)")
999
+ sp.add_argument("--profile", dest="dsh_profile", default="",
1000
+ help="dsh 专用:profile 名(--target dsh 时必填)")
635
1001
  sp.add_argument("--no-local-ledger", action="store_true",
636
1002
  help="关闭本地提交账本(企业数据驻留要求;vod_list_submitted 将不可用)")
637
1003
  sp.set_defaults(fn=cmd_install)