vod-devkit 0.2.3 → 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 +37 -0
- package/bin/vod-devkit +167 -10
- package/contract/tools.schema.json +101 -3
- package/package.json +1 -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 +46 -3
- package/plugins/vod-devkit/vod_mcp/__init__.py +1 -1
- package/plugins/vod-devkit/vod_mcp/packs.py +23 -2
- package/plugins/vod-devkit/vod_mcp/tools.py +145 -2
- package/skills/vod-feedback-collect/SKILL.md +46 -3
- package/vod_mcp/__init__.py +1 -1
- package/vod_mcp/packs.py +23 -2
- package/vod_mcp/tools.py +145 -2
package/CHANGELOG.md
CHANGED
|
@@ -162,3 +162,40 @@
|
|
|
162
162
|
- bb312e3 test: golden status 重录版本号 0.2.1→0.2.2(v0.2.2 发版漏重录,pre-push 门禁被存量红挡)
|
|
163
163
|
- b111900 fix(D-consent-desc-1): 确认纪律前置进工具描述——opencode 把用户陈述反馈当同意直提单实锤(契约 description 立即调用话术与 confirm 纪律冲突,MCP-only 宿主不加载技能唯描述可依)+dsh 壳同步+回归锁
|
|
164
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
|
-
|
|
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
|
|
|
@@ -234,7 +239,9 @@ def _strip_codex_vod_blocks(text: str) -> str:
|
|
|
234
239
|
out, skipping = [], False
|
|
235
240
|
for line in text.splitlines():
|
|
236
241
|
s = line.strip()
|
|
237
|
-
|
|
242
|
+
# P2(深审 2026-11-06):精确匹配表头——startswith("…vod-devkit")
|
|
243
|
+
# 会误删 [mcp_servers.vod-devkit2] 等无关表
|
|
244
|
+
if s == "[mcp_servers.vod-devkit]":
|
|
238
245
|
skipping = True
|
|
239
246
|
continue
|
|
240
247
|
if skipping and s.startswith("["):
|
|
@@ -249,7 +256,11 @@ _AGENTS_MARKER_END = "<!-- vod-devkit:feedback-skill END -->"
|
|
|
249
256
|
|
|
250
257
|
|
|
251
258
|
def _strip_agents_vod_block(text: str) -> str:
|
|
252
|
-
"""幂等剥离 AGENTS.md 中带标记的 vod-devkit 技能块(历史方案清理)。
|
|
259
|
+
"""幂等剥离 AGENTS.md 中带标记的 vod-devkit 技能块(历史方案清理)。
|
|
260
|
+
|
|
261
|
+
P2(深审 2026-11-06):只有 BEGIN 没有 END 时不得静默吞掉文件剩余
|
|
262
|
+
全部内容——抛错拒绝(调用方 exit 2 不落盘),宁可装不上不可删用户文件。
|
|
263
|
+
"""
|
|
253
264
|
lines, skipping, out = text.splitlines(), False, []
|
|
254
265
|
for line in lines:
|
|
255
266
|
if line.strip() == _AGENTS_MARKER_BEGIN:
|
|
@@ -260,6 +271,10 @@ def _strip_agents_vod_block(text: str) -> str:
|
|
|
260
271
|
continue
|
|
261
272
|
if not skipping:
|
|
262
273
|
out.append(line)
|
|
274
|
+
if skipping:
|
|
275
|
+
raise RuntimeError(
|
|
276
|
+
"AGENTS.md 存在 vod-devkit BEGIN 标记但缺失 END 标记"
|
|
277
|
+
"(文件可能被手动截断)——拒绝自动清理,请手动检查该文件")
|
|
263
278
|
return "\n".join(out).rstrip()
|
|
264
279
|
|
|
265
280
|
|
|
@@ -284,7 +299,11 @@ def _install_codex(args, packs: str) -> Path:
|
|
|
284
299
|
agents = Path.home() / ".codex" / "AGENTS.md"
|
|
285
300
|
if agents.exists(): # 历史遗留:AGENTS.md 技能块已被原生 skill 取代
|
|
286
301
|
text = agents.read_text(encoding="utf-8")
|
|
287
|
-
|
|
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)
|
|
288
307
|
if cleaned != text.rstrip():
|
|
289
308
|
agents.write_text(cleaned + "\n", encoding="utf-8")
|
|
290
309
|
print(f"已移除旧 AGENTS.md 技能块(原生 skill 取代):{agents}")
|
|
@@ -310,7 +329,33 @@ def _install_codex(args, packs: str) -> Path:
|
|
|
310
329
|
print(f"已注册本地 marketplace:{mp_root}")
|
|
311
330
|
_run([codex, "plugin", "add", f"vod-devkit@{mp_name}"])
|
|
312
331
|
print("已安装 codex 原生插件 vod-devkit(skills + MCP,重启 Codex 会话生效)")
|
|
313
|
-
|
|
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
|
|
314
359
|
|
|
315
360
|
|
|
316
361
|
def _install_dsh(args, packs: str) -> Path:
|
|
@@ -342,7 +387,11 @@ def _install_dsh(args, packs: str) -> Path:
|
|
|
342
387
|
print(f"已安装 dsh 插件 dsh-vod-devkit(profile={profile},dsh plugin list 可见)")
|
|
343
388
|
|
|
344
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 真机实锤:重装后入口消失)
|
|
345
393
|
block = ("- id: vod-devkit\n"
|
|
394
|
+
" name: dsh-vod-devkit\n"
|
|
346
395
|
" config:\n"
|
|
347
396
|
f" product: {args.product}\n"
|
|
348
397
|
f" apiBase: {args.java_api_base}\n")
|
|
@@ -525,6 +574,24 @@ def cmd_install(args):
|
|
|
525
574
|
print(f"不支持目标: {target}(可选 hermes|opencode|codex|auto)", file=sys.stderr)
|
|
526
575
|
sys.exit(2)
|
|
527
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)
|
|
528
595
|
# 归因绑定(T7d 统一:安装必配,与 dsh UI 加载必配同口径):--product 必填——
|
|
529
596
|
# 缺省宿主名在生态部署是错归陷阱(高校AI开发者平台 agent 底座=hermes,
|
|
530
597
|
# 不填则反馈全归 hermes)。宿主名仍是合法值(自反馈场景显式传
|
|
@@ -577,6 +644,18 @@ def cmd_install(args):
|
|
|
577
644
|
|
|
578
645
|
mcp_conf = installer(args, packs)
|
|
579
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
|
+
|
|
580
659
|
# G1 修复:技能全量拷贝(目录型技能+平铺规则文档),按 packs 过滤
|
|
581
660
|
HERMES_SKILLS_DIR.mkdir(parents=True, exist_ok=True)
|
|
582
661
|
# opencode 原生技能目录(2026-11-06 实测:opencode 自动发现
|
|
@@ -627,7 +706,10 @@ def cmd_install(args):
|
|
|
627
706
|
"product": bound_product,
|
|
628
707
|
"packs": packs,
|
|
629
708
|
"dshProfile": (getattr(args, "dsh_profile", "") or "").strip() or None,
|
|
630
|
-
|
|
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),
|
|
631
713
|
"skillsDir": str(HERMES_SKILLS_DIR),
|
|
632
714
|
# 名册对账(huaweicloud-devkit doctor 模式借鉴,2026-11-06):
|
|
633
715
|
# 每个原生技能落点的独立指纹——漏装/漂移可被 doctor 逐落点抓出,
|
|
@@ -662,7 +744,54 @@ def cmd_status(_args):
|
|
|
662
744
|
if not p.exists():
|
|
663
745
|
print("未安装(无 install-manifest)")
|
|
664
746
|
sys.exit(1)
|
|
665
|
-
|
|
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)
|
|
666
795
|
|
|
667
796
|
|
|
668
797
|
def cmd_doctor(_args):
|
|
@@ -672,10 +801,18 @@ def cmd_doctor(_args):
|
|
|
672
801
|
problems.append("无 install-manifest.json(未 install?)")
|
|
673
802
|
else:
|
|
674
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 生效)")
|
|
675
812
|
bi = json.loads((ROOT / "build-info.json").read_text(encoding="utf-8"))
|
|
676
813
|
if mf["source"]["commitSha"] != bi.get("commitSha"):
|
|
677
814
|
problems.append("install-manifest 与 build-info 的 commitSHA 不一致")
|
|
678
|
-
if not Path(mf["mcpConfig"]).exists():
|
|
815
|
+
if mf.get("mcpConfig") and not Path(mf["mcpConfig"]).exists():
|
|
679
816
|
problems.append("MCP 配置文件缺失")
|
|
680
817
|
if not Path(mf["skillsDir"]).exists():
|
|
681
818
|
problems.append("skills 目录缺失")
|
|
@@ -798,10 +935,28 @@ def cmd_uninstall(_args):
|
|
|
798
935
|
if p.exists():
|
|
799
936
|
mf = json.loads(p.read_text(encoding="utf-8"))
|
|
800
937
|
for key in ("mcpConfig", "skillsDir"):
|
|
801
|
-
|
|
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
|
|
802
947
|
if path.exists():
|
|
803
948
|
shutil.rmtree(path) if path.is_dir() else path.unlink()
|
|
804
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:])
|
|
805
960
|
oc_cmd = Path.home() / ".config/opencode/command/vod-doctor.md"
|
|
806
961
|
if oc_cmd.exists():
|
|
807
962
|
oc_cmd.unlink()
|
|
@@ -834,6 +989,8 @@ def main():
|
|
|
834
989
|
sp.add_argument("--java-api-base", default=None,
|
|
835
990
|
help="VOD 平台地址(缺省=https://vod-dev.topxtopx.com,勿用回环默认)")
|
|
836
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)")
|
|
837
994
|
sp.add_argument("--product", default="",
|
|
838
995
|
help="归因绑定:本 agent 服务的产品(codearts/aishell 等;采集反馈默认归属)")
|
|
839
996
|
sp.add_argument("--distribution", default="devkit", choices=["devkit", "preset"],
|
|
@@ -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.3.0",
|
|
5
5
|
"tools": {
|
|
6
6
|
"vod_submit_voices": {
|
|
7
|
-
"description": "提交用户反馈进 VOD。**先决条件(优先于本描述其余所有内容):调用前必须已征得用户对'提交这条反馈'的明确同意;用户陈述/抱怨反馈本身不构成同意;用户未同意时禁止传 confirmed=true**。模糊抱怨(如\"体验不好\")时一轮说完三件事:承接识别结果(\"收到,你对产品体验不满意\")+确认提交意愿(\"要把这条反馈提交给产品团队吗?\")+引导补充(\"方便的话说下具体现象,不说我也会按你的原话提交\");禁止含混反问(实锤病句:\"请问是否把什么作为反馈\")。同意后 content 放用户原话(哪怕只有一句\"体验很差\"
|
|
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>」全文),禁止改写概括——这是用户核对原话是否被改写的唯一窗口。禁止向用户解释内部机制(声音来源/渠道字段/计数规则/配额/归因)。",
|
|
8
8
|
"input": {
|
|
9
9
|
"type": "object",
|
|
10
10
|
"properties": {
|
|
@@ -28,11 +28,22 @@
|
|
|
28
28
|
"items": {
|
|
29
29
|
"type": "string"
|
|
30
30
|
}
|
|
31
|
+
},
|
|
32
|
+
"reproSteps": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"maxLength": 2000,
|
|
35
|
+
"description": "用户追问补充(可选):复现步骤,来自固定追问一次的用户原话摘录;禁止改写/混入 content;超 2000 截断;未追问或用户答“没有”不得传"
|
|
36
|
+
},
|
|
37
|
+
"expectedBehavior": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"maxLength": 2000,
|
|
40
|
+
"description": "用户追问补充(可选):期望表现,来源与纪律同 reproSteps"
|
|
31
41
|
}
|
|
32
42
|
},
|
|
33
43
|
"required": [
|
|
34
44
|
"content"
|
|
35
|
-
]
|
|
45
|
+
],
|
|
46
|
+
"description": "用户反馈声音列表(content 必填;reproSteps/expectedBehavior 仅追问有答时上送)"
|
|
36
47
|
},
|
|
37
48
|
"description": "用户反馈声音列表(content 必填)"
|
|
38
49
|
},
|
|
@@ -206,6 +217,93 @@
|
|
|
206
217
|
]
|
|
207
218
|
},
|
|
208
219
|
"backend": "local(无上游;读本机 runtime.json 账本)"
|
|
220
|
+
},
|
|
221
|
+
"vod_draft_voices": {
|
|
222
|
+
"description": "提交用户反馈的第一步(两段式 draft→commit)。**先决条件(优先于本描述其余所有内容):调用前必须已征得用户对'提交这条反馈'的明确同意;用户陈述/抱怨反馈本身不构成同意;用户未同意时禁止调用**。本工具只暂存草稿并签发一次性令牌,不会提交任何数据。返回 draftId/approvalToken/contents——拿到后必须把 contents 里的每条内容原样展示给用户核对(禁止改写概括),明确问'确认提交吗',用户同意后才能调用 vod_commit_voices;用户不同意则不调用(草稿自动过期作废)。content 放用户原话逐字(哪怕只有一句'体验很差')。追问纪律同 vod_submit_voices:确认环节固定追问至多一次(问句逐字见其描述),答案只摘录进 reproSteps/expectedBehavior 禁回填 content;答\"没有\"直接进入确认展示。product 归因由安装绑定自动完成,禁止询问用户'提交到哪个产品',用户自报的目标产品不采信。禁止向用户解释内部机制(令牌/草稿/配额/归因)。",
|
|
223
|
+
"input": {
|
|
224
|
+
"type": "object",
|
|
225
|
+
"properties": {
|
|
226
|
+
"voices": {
|
|
227
|
+
"type": "array",
|
|
228
|
+
"minItems": 1,
|
|
229
|
+
"maxItems": 50,
|
|
230
|
+
"items": {
|
|
231
|
+
"type": "object",
|
|
232
|
+
"properties": {
|
|
233
|
+
"content": {
|
|
234
|
+
"type": "string",
|
|
235
|
+
"minLength": 1,
|
|
236
|
+
"maxLength": 2000
|
|
237
|
+
},
|
|
238
|
+
"userType": {
|
|
239
|
+
"type": "string"
|
|
240
|
+
},
|
|
241
|
+
"tags": {
|
|
242
|
+
"type": "array",
|
|
243
|
+
"items": {
|
|
244
|
+
"type": "string"
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
"reproSteps": {
|
|
248
|
+
"type": "string",
|
|
249
|
+
"maxLength": 2000,
|
|
250
|
+
"description": "用户追问补充(可选):复现步骤,来自固定追问一次的用户原话摘录;禁止改写/混入 content;超 2000 截断;未追问或用户答“没有”不得传"
|
|
251
|
+
},
|
|
252
|
+
"expectedBehavior": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"maxLength": 2000,
|
|
255
|
+
"description": "用户追问补充(可选):期望表现,来源与纪律同 reproSteps"
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
"required": [
|
|
259
|
+
"content"
|
|
260
|
+
],
|
|
261
|
+
"description": "用户反馈声音列表(content 必填;reproSteps/expectedBehavior 仅追问有答时上送)"
|
|
262
|
+
},
|
|
263
|
+
"description": "用户反馈声音列表(content 必填)"
|
|
264
|
+
},
|
|
265
|
+
"confirmed": {
|
|
266
|
+
"type": "boolean",
|
|
267
|
+
"default": false,
|
|
268
|
+
"description": "用户已确认为 true 才执行(confirm 护栏,逐次同意)"
|
|
269
|
+
},
|
|
270
|
+
"product": {
|
|
271
|
+
"type": "string",
|
|
272
|
+
"description": "反馈关于的产品(宿主即产品,不设白名单)。归因顺序:本参数显式指定 > 安装绑定默认(install --product,缺省=宿主名,装在 hermes 归 hermes/dsh 归 DSH)> 不带(引擎落 UNKNOWN 档人工归因)。宿主工具自报产品名原样上送,引擎宽松归一(折叠空白+别名收编)。"
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
"required": [
|
|
276
|
+
"voices"
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"vod_commit_voices": {
|
|
281
|
+
"description": "提交用户反馈的第二步(两段式 draft→commit),只能在 vod_draft_voices 之后调用。**先决条件:用户已看过草稿内容(draft 返回的 contents)并明确说'确认提交';用户未明确同意禁止调用**。参数 draftId/approvalToken/payloadSha256 全部取自 vod_draft_voices 的返回原样透传,禁止改动。提交成功后把回执 echo.contents 逐条向用户转述(每条以「已收录原话:」开头,content 全文,禁止改写概括增删字词)。令牌一次性:重复 commit 会被拒。禁止向用户解释内部机制。",
|
|
282
|
+
"input": {
|
|
283
|
+
"type": "object",
|
|
284
|
+
"properties": {
|
|
285
|
+
"draftId": {
|
|
286
|
+
"type": "string",
|
|
287
|
+
"minLength": 8,
|
|
288
|
+
"description": "vod_draft_voices 返回的 draftId 原样透传"
|
|
289
|
+
},
|
|
290
|
+
"approvalToken": {
|
|
291
|
+
"type": "string",
|
|
292
|
+
"minLength": 8,
|
|
293
|
+
"description": "vod_draft_voices 返回的 approvalToken 原样透传"
|
|
294
|
+
},
|
|
295
|
+
"payloadSha256": {
|
|
296
|
+
"type": "string",
|
|
297
|
+
"description": "vod_draft_voices 返回的 payloadSha256 原样透传"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"required": [
|
|
301
|
+
"draftId",
|
|
302
|
+
"approvalToken",
|
|
303
|
+
"payloadSha256"
|
|
304
|
+
],
|
|
305
|
+
"additionalProperties": false
|
|
306
|
+
}
|
|
209
307
|
}
|
|
210
308
|
},
|
|
211
309
|
"backends": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"commitSha": "
|
|
4
|
-
"builtAt": "2026-11-
|
|
2
|
+
"version": "0.3.0",
|
|
3
|
+
"commitSha": "370ee37cb4cd5bc2284cb0cd7874ec02644fb859",
|
|
4
|
+
"builtAt": "2026-11-08T20:32:08",
|
|
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 原样转述。详见正文流程与禁令。'
|
|
3
|
+
description: '用户抱怨/体验差/太慢/报错/提单 → 采集原话进 VOD。识别到抱怨即承接并征得同意(禁止问哪个产品,禁止复现排查模式);content=原话逐字;一次抱怨一条;回执 echo 原样转述。详见正文流程与禁令。Triggers: "体验差","太难用","太慢","报错了","出bug了","有bug","反馈问题","反馈建议","提个单","报告问题","不生效","不好使","操作不方便","卡住了","崩溃了","report a problem","bug report","poor experience","feedback"'
|
|
4
4
|
version: 1
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -82,6 +82,46 @@ version: 1
|
|
|
82
82
|
信号;定性由 agent 完成(降低用户决策成本),提交范围决策权
|
|
83
83
|
在用户。
|
|
84
84
|
|
|
85
|
+
**追问补充固定话术(D-followup-impl-2,2026-11-08 负责人确认)**:用户已
|
|
86
|
+
明确要提交(确认环节内)时,允许固定追问**至多一次、一次一问**,问句
|
|
87
|
+
必须逐字使用、禁止改写/拆分/追加第二轮:
|
|
88
|
+
「方便的话,补充一下遇到这个问题时的操作步骤或期望的表现吗?不方便回复"没有",我直接提交。」
|
|
89
|
+
纪律(四约束,违者=引导性提问制造"被暗示的复现步骤"):
|
|
90
|
+
1. 仅摘录用户回答中对应部分进 reproSteps(操作步骤)/ expectedBehavior
|
|
91
|
+
(期望表现)两个独立字段——不改写、不总结;无法拆分时按用户原话落
|
|
92
|
+
入最相关字段;**任何内容禁回填 content**(content 与旧流程逐字一致);
|
|
93
|
+
2. 答"没有/跳过/不方便"或未回答 = 两字段不上送,立即提交(诚实回退,
|
|
94
|
+
不注记不编造);
|
|
95
|
+
3. 除本次固定追问外,禁止再索要严重程度/环境/附件等开发者字段;
|
|
96
|
+
**触发判定块(2026-11-08 负责人确认并二次微调,禁自由裁量)**——固定
|
|
97
|
+
追问不是默认流程,按以下三层可执行判定走:
|
|
98
|
+
1. 触发前置:仅在用户明确说"提交/提吧"后、确认环节内,至多一次;
|
|
99
|
+
不得与引导补充连续两轮问。
|
|
100
|
+
2. 跳过条件:引导补充已获具体现象/场景/报错等非泛化反馈内容且并入
|
|
101
|
+
content → 不触发固定追问。引导补充中自然出现的操作/期望仍保留在
|
|
102
|
+
content 原话,**不回溯摘入新字段**;新字段仅承载固定追问的原样回答
|
|
103
|
+
(来源唯一,content 不被污染、不重复)。
|
|
104
|
+
3. 触发条件:引导补充未获回应,或只得到泛化抱怨,用户又确认提交 →
|
|
105
|
+
才原样带出固定问句至多一次。答了按摘录规则进两字段;答"没有/
|
|
106
|
+
不方便"立即提交、不追问。
|
|
107
|
+
判定例(可执行口径):"未回应"=用户未针对引导补充给出任何具体信息
|
|
108
|
+
(如仅回复"提交/嗯/没有");"泛化抱怨"=仅表达负面评价、无具体现象/
|
|
109
|
+
场景/报错(如"就是有问题/不好用/赶紧修")。
|
|
110
|
+
一句话口径:**跳过固定追问时,reproSteps/expectedBehavior 不上送,
|
|
111
|
+
payload 不含对应键,issue 不出现「(用户追问补充)」段、不作来源注记,
|
|
112
|
+
符合诚实回退。**
|
|
113
|
+
4. 引擎侧承载已就绪(t_vod_voice_inbox.repro_steps/expected_behavior,
|
|
114
|
+
issue 渲染带「用户追问补充」来源注记)——本话术非空头承诺(S51 自审过)。
|
|
115
|
+
|
|
116
|
+
**反截断红线(2026-11-08 opencode 实锤)**:用户在引导补充后给出的
|
|
117
|
+
补充句是**完整提交物**,content=该句逐字全量上送,禁止摘取其中片段
|
|
118
|
+
(实锤:用户说"操作不方便,流程合理",模型自行判断"最新具体抱怨是
|
|
119
|
+
操作不方便"只交了半句——"最新片段"不是裁量对象,整句才是原话)。
|
|
120
|
+
用户多轮分散表达时,把各轮原话按序拼接为 content,同样禁增删改写。
|
|
121
|
+
**拼接判定例(2026-11-08 opencode 第二次实锤后补)**:逐字=含语气词、
|
|
122
|
+
含原有标点,禁删语气词(实锤:原话"产品体验很差劲啊"被拼成"产品体验
|
|
123
|
+
很差劲。"——删"啊"补句号=改写)、禁补标点、禁规范措辞。轮次衔接用
|
|
124
|
+
换行或空格分隔,不新增标点;拼接结果必须能用逐字符比对还原回各轮原文。
|
|
85
125
|
**职责边界(先于一切)**:本技能只做一件事=采集-确认-提交-回执。
|
|
86
126
|
产品问答("AIShell 是什么")、产品对比、内部机制解释(归因/白名单/
|
|
87
127
|
配额)一律**不在职责内**:不读仓库文档作答、不展开、不主动科普——
|
|
@@ -111,8 +151,11 @@ version: 1
|
|
|
111
151
|
- content:用户反馈内容(尽量保留用户原话措辞,可轻度去噪)
|
|
112
152
|
- userType:可判断时填(企业/个人),不确定不填
|
|
113
153
|
- tags:明显的主题词(性能/功能/易用性),最多 3 个
|
|
114
|
-
3. 调用
|
|
115
|
-
|
|
154
|
+
3. 调用 vod_draft_voices 暂存草稿(必须用户已初步同意)→ 把返回的
|
|
155
|
+
contents 逐条**原样**展示给用户核对(禁止改写概括)→ 明确问
|
|
156
|
+
「确认提交吗」→ 用户明确同意后才调 vod_commit_voices(draftId/
|
|
157
|
+
approvalToken/payloadSha256 原样透传)。单发工具 vod_submit_voices
|
|
158
|
+
仅限无两段式工具的宿主使用。**一次一批**,攒多条一起交也行,但每批都要用户点头
|
|
116
159
|
**一次抱怨=一条声音(2026-11-06 实锤红线)**:用户一次表述只提交一条,
|
|
117
160
|
content=原话逐字——禁止拆成多条、禁止生成多个改写变体(实锤:一次
|
|
118
161
|
"网页卡回复慢"被宿主改写成「网页打开,…」+「网页卡,…」两条入库建出
|
|
@@ -3,23 +3,44 @@
|
|
|
3
3
|
core 常驻(vod_devkit_info + vod-core 技能);未启用的 pack 工具不注册。
|
|
4
4
|
"""
|
|
5
5
|
import os
|
|
6
|
+
import sys
|
|
6
7
|
|
|
7
8
|
ALL_PACKS = ("core", "collect", "knowledge")
|
|
8
9
|
|
|
9
10
|
PACK_TOOLS = {
|
|
10
11
|
"core": ["vod_devkit_info", "vod_auth_status"],
|
|
11
|
-
|
|
12
|
+
# 两段式(D-token-approval-2 极简形态)随 collect 下发;codex 话术走 draft→commit
|
|
13
|
+
"collect": ["vod_submit_voices", "vod_draft_voices", "vod_commit_voices", "vod_list_submitted"],
|
|
12
14
|
"knowledge": [], # 纯技能包:3 个领域规则技能,零工具零依赖
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
|
|
18
|
+
BREAKER_MARKERS = (
|
|
19
|
+
# 熔断标记(D-codex-circuit-breaker-1):install 门禁可被
|
|
20
|
+
# `VOD_PACKS=core,collect serve` 绕过——运行期同查标记强制降级
|
|
21
|
+
os.path.expanduser("~/.codex/vod-collect-suspended.json"),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
16
25
|
def enabled_packs() -> tuple:
|
|
17
26
|
raw = os.environ.get("VOD_PACKS", "").strip()
|
|
18
27
|
if not raw:
|
|
19
28
|
return ALL_PACKS
|
|
20
|
-
|
|
29
|
+
# kb=knowledge 旧称别名(历史文档/用户习惯;深审 P0-2 配套:安装口
|
|
30
|
+
# 旧值不因运行口改名而静默失效)
|
|
31
|
+
packs = tuple(p.strip() for p in raw.split(","))
|
|
32
|
+
packs = tuple("knowledge" if p == "kb" else p for p in packs)
|
|
33
|
+
packs = tuple(p for p in packs if p in ALL_PACKS)
|
|
21
34
|
if "core" not in packs:
|
|
22
35
|
packs = ("core",) + packs
|
|
36
|
+
if "collect" in packs and any(os.path.isfile(m) for m in BREAKER_MARKERS):
|
|
37
|
+
# 运行期熔断门禁:collect 强制摘除(非静默——stderr 告警)。
|
|
38
|
+
# 解除=删熔断标记(install --ack-suspension 即此语义)
|
|
39
|
+
packs = tuple(p for p in packs if p != "collect")
|
|
40
|
+
print("[vod-devkit] 采集熔断生效(codex 未确认提交 ≥2 次,"
|
|
41
|
+
"D-codex-circuit-breaker-1):collect 已强制摘除。"
|
|
42
|
+
"恢复前置=token 化上线并过回归;--ack-suspension 解除安装门禁,"
|
|
43
|
+
"运行期解除须删熔断标记", file=sys.stderr)
|
|
23
44
|
return packs
|
|
24
45
|
|
|
25
46
|
|
|
@@ -19,6 +19,25 @@ from pathlib import Path
|
|
|
19
19
|
from vod_mcp import provenance
|
|
20
20
|
from vod_mcp import DEFAULT_JAVA_BASE
|
|
21
21
|
|
|
22
|
+
# D-followup-impl-2:追问拒答语义词集(答"没有"类=两字段不上送)。
|
|
23
|
+
# 契约话术承诺了"不方便回复没有",客户端必须技术兜底——模型不守话术纪律时
|
|
24
|
+
# 键集合仍零漂移(test_followup_declined_or_blank_omitted 回归锁)。
|
|
25
|
+
_FOLLOWUP_DECLINES = frozenset({
|
|
26
|
+
"没有", "无", "没有。", "没了", "跳过", "不方便", "不用了", "不用",
|
|
27
|
+
"不补充", "算了", "没有了", "没有了。", "不方便说", "no", "none", "skip", "n/a",
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _followup_fields(voice: dict) -> dict:
|
|
32
|
+
"""D-followup-impl-2 单源提取(submit 主路径与 draft 暂存共用,禁双边漂移):
|
|
33
|
+
仅 trim 非空且非拒答词才含键;引擎同口径截 2000;内容永不回流 content。"""
|
|
34
|
+
out = {}
|
|
35
|
+
for _f in ("reproSteps", "expectedBehavior"):
|
|
36
|
+
_val = str(voice.get(_f) or "").strip()
|
|
37
|
+
if _val and _val.lower() not in _FOLLOWUP_DECLINES:
|
|
38
|
+
out[_f] = _val[:2000]
|
|
39
|
+
return out
|
|
40
|
+
|
|
22
41
|
_CONTRACT_PATH = Path(__file__).resolve().parent.parent / "contract" / "tools.schema.json"
|
|
23
42
|
|
|
24
43
|
|
|
@@ -232,7 +251,8 @@ def _explicit_key() -> bool:
|
|
|
232
251
|
return bool(JAVA_KEY) and str(_RT.get("token_tier") or "") != "anonymous"
|
|
233
252
|
|
|
234
253
|
|
|
235
|
-
def submit_voices(params: dict, client_info: dict | None = None
|
|
254
|
+
def submit_voices(params: dict, client_info: dict | None = None,
|
|
255
|
+
ledger_extra: dict | None = None) -> dict:
|
|
236
256
|
"""V16 切换:主路径=囤积端点 POST /external/voices(Bearer,批式,不触发分析);
|
|
237
257
|
引擎未部署(404)自动回落老链 /external/voice/submit(提交即分析,过渡语义,
|
|
238
258
|
部署后 404 分支自然失效)。
|
|
@@ -281,6 +301,9 @@ def submit_voices(params: dict, client_info: dict | None = None) -> dict:
|
|
|
281
301
|
"title": items[min(i, len(items) - 1)][2][:40],
|
|
282
302
|
"product": product, "at": _time.strftime("%Y-%m-%dT%H:%M:%S")}
|
|
283
303
|
for i, (vid, tid) in enumerate(zip(vids, tids))]
|
|
304
|
+
if ledger_extra:
|
|
305
|
+
for e in entries:
|
|
306
|
+
e.update(ledger_extra) # 两段式:stage=committed + draftId 关联(验收③)
|
|
284
307
|
_ledger_append(entries)
|
|
285
308
|
|
|
286
309
|
def _legacy_submit(i, v, content):
|
|
@@ -310,6 +333,9 @@ def submit_voices(params: dict, client_info: dict | None = None) -> dict:
|
|
|
310
333
|
ut = v.get("userType")
|
|
311
334
|
if ut:
|
|
312
335
|
hv["userType"] = ut
|
|
336
|
+
# D-followup-impl-2 追问补充透传:单源 _followup_fields(拒答词集兜底+
|
|
337
|
+
# 引擎同口径截 2000+禁回流 content;未追问/答"没有"=键集合零漂移)
|
|
338
|
+
hv.update(_followup_fields(v))
|
|
313
339
|
hoard_voices.append(hv)
|
|
314
340
|
body = {"voices": hoard_voices}
|
|
315
341
|
if product: # 无归因不带 product(引擎 UNKNOWN 档),不本地拦截
|
|
@@ -662,11 +688,128 @@ def devkit_info(params: dict, client_info: dict | None = None) -> dict:
|
|
|
662
688
|
|
|
663
689
|
|
|
664
690
|
# 工具名 → 处理器(是否接收 client_info)
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
# ---- 两段式提交(D-token-approval-2 极简形态:插件本地 draft→commit,引擎零改动)----
|
|
694
|
+
# 定性:最强摩擦+审计链,非人类确认硬保证(decisions 既有纠偏)。
|
|
695
|
+
# draft 暂存 runtime.json(cap 10 环形+TTL 600s),commit 单次消费后内部复用
|
|
696
|
+
# submit_voices 既有链——配额/幂等/归因/回显语义零新增。stage=draft/committed
|
|
697
|
+
# 入账本:绕过两段式的直接提交在账本层面可检测(验收③)。
|
|
698
|
+
|
|
699
|
+
_DRAFT_KEY = "drafts"
|
|
700
|
+
_DRAFT_CAP = 10
|
|
701
|
+
_DRAFT_TTL = 600 # 秒;过期 commit 拒收,草稿自动作废
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
def _drafts_purge(store: dict) -> dict:
|
|
705
|
+
"""过期草稿清除(读时惰性,无后台任务)。"""
|
|
706
|
+
import time as _time
|
|
707
|
+
now = _time.time()
|
|
708
|
+
return {k: v for k, v in store.items()
|
|
709
|
+
if v.get("expiresAt", 0) > now}
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
def draft_voices(params: dict, client_info: dict | None = None) -> dict:
|
|
713
|
+
"""两段式第一步:校验+暂存草稿+签发一次性令牌(不提交任何数据)。"""
|
|
714
|
+
import time as _time
|
|
715
|
+
product, ignored_runtime = _resolve_product(params)
|
|
716
|
+
voices_in = params.get("voices", [])
|
|
717
|
+
clean = []
|
|
718
|
+
for i, v in enumerate(voices_in):
|
|
719
|
+
content = str(v.get("content", "")).strip()
|
|
720
|
+
if not content:
|
|
721
|
+
raise ToolError(f"第 {i + 1} 条 content 为空", code=-32602)
|
|
722
|
+
if len(content) > 2000:
|
|
723
|
+
raise ToolError(f"第 {i + 1} 条 content 超 2000 字({len(content)})", code=-32602)
|
|
724
|
+
item = {"content": content}
|
|
725
|
+
if v.get("tags"):
|
|
726
|
+
item["tags"] = v["tags"]
|
|
727
|
+
if v.get("userType"):
|
|
728
|
+
item["userType"] = v["userType"]
|
|
729
|
+
# D-followup-impl-2:追问补充随 draft 暂存(commit 复用 payload 原样上送),
|
|
730
|
+
# 单源 _followup_fields 与主路径同口径
|
|
731
|
+
item.update(_followup_fields(v))
|
|
732
|
+
clean.append(item)
|
|
733
|
+
if not clean:
|
|
734
|
+
raise ToolError("voices 为必填且至少 1 条", code=-32602)
|
|
735
|
+
|
|
736
|
+
import secrets
|
|
737
|
+
draft_id = "draft_" + secrets.token_hex(8)
|
|
738
|
+
token = secrets.token_hex(16)
|
|
739
|
+
payload = {"voices": clean}
|
|
740
|
+
if product:
|
|
741
|
+
payload["product"] = product
|
|
742
|
+
# 载荷 sha(防 draft→commit 间改写:commit 校验插件侧重算值一致)
|
|
743
|
+
import hashlib
|
|
744
|
+
payload_sha = hashlib.sha256(
|
|
745
|
+
json.dumps(payload, sort_keys=True, ensure_ascii=False).encode()).hexdigest()
|
|
746
|
+
|
|
747
|
+
fresh = _runtime_cfg()
|
|
748
|
+
store = _drafts_purge(fresh.get(_DRAFT_KEY) or {})
|
|
749
|
+
store[draft_id] = {
|
|
750
|
+
"payload": payload, "payloadSha256": payload_sha, "tokenHash": _sha256(token),
|
|
751
|
+
"product": product, "createdAt": _time.strftime("%Y-%m-%dT%H:%M:%S"),
|
|
752
|
+
"expiresAt": _time.time() + _DRAFT_TTL,
|
|
753
|
+
}
|
|
754
|
+
while len(store) > _DRAFT_CAP: # 环形:最旧先淘汰
|
|
755
|
+
store.pop(next(iter(store)))
|
|
756
|
+
_save_runtime({_DRAFT_KEY: store})
|
|
757
|
+
|
|
758
|
+
if ignored_runtime: # D-attrib-A 可观测:模型试图改归因留痕
|
|
759
|
+
_warn(f"draft: runtime product 被忽略(绑定权威): {ignored_runtime}")
|
|
760
|
+
return {
|
|
761
|
+
"draftId": draft_id,
|
|
762
|
+
"approvalToken": token,
|
|
763
|
+
"payloadSha256": payload_sha,
|
|
764
|
+
"expiresInSeconds": _DRAFT_TTL,
|
|
765
|
+
"contents": [{"index": i, "content": it["content"]} for i, it in enumerate(clean)],
|
|
766
|
+
"instruction": ("把 contents 逐条原样展示给用户核对(禁止改写概括),明确问"
|
|
767
|
+
"「确认提交吗」。用户明确同意前禁止调用 vod_commit_voices;"
|
|
768
|
+
"不同意则停(草稿 10 分钟后自动作废)。"),
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
def commit_voices(params: dict, client_info: dict | None = None) -> dict:
|
|
773
|
+
"""两段式第二步:令牌校验→单次消费→复用 submit_voices 既有提交链。"""
|
|
774
|
+
draft_id = str(params.get("draftId", ""))
|
|
775
|
+
token = str(params.get("approvalToken", ""))
|
|
776
|
+
payload_sha = str(params.get("payloadSha256", ""))
|
|
777
|
+
if not draft_id or not token or not payload_sha:
|
|
778
|
+
raise ToolError("draftId/approvalToken/payloadSha256 为必填(取自 vod_draft_voices 返回原样透传)",
|
|
779
|
+
code=-32602)
|
|
780
|
+
|
|
781
|
+
fresh = _runtime_cfg()
|
|
782
|
+
store = _drafts_purge(fresh.get(_DRAFT_KEY) or {})
|
|
783
|
+
draft = store.get(draft_id)
|
|
784
|
+
if draft is None:
|
|
785
|
+
raise ToolError("草稿不存在或已过期(10 分钟 TTL),请重新 vod_draft_voices", code=-32011)
|
|
786
|
+
if draft["tokenHash"] != _sha256(token):
|
|
787
|
+
raise ToolError("审批令牌不匹配(draft 返回的 approvalToken 原样透传)", code=-32011)
|
|
788
|
+
if draft["payloadSha256"] != payload_sha:
|
|
789
|
+
raise ToolError("载荷校验不符(payloadSha256 与 draft 签发值不一致,禁止改写已确认内容)",
|
|
790
|
+
code=-32011)
|
|
791
|
+
# 单次消费:先摘除再提交——提交中途崩溃也不会二次提交(宁可丢一单重走流程)
|
|
792
|
+
store.pop(draft_id)
|
|
793
|
+
_save_runtime({_DRAFT_KEY: store})
|
|
794
|
+
|
|
795
|
+
out = submit_voices(dict(draft["payload"]), client_info,
|
|
796
|
+
ledger_extra={"stage": "committed", "draftId": draft_id})
|
|
797
|
+
out["twoPhase"] = True
|
|
798
|
+
out["draftId"] = draft_id
|
|
799
|
+
return out
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
def _sha256(s: str) -> str:
|
|
803
|
+
import hashlib
|
|
804
|
+
return hashlib.sha256(s.encode()).hexdigest()
|
|
805
|
+
|
|
665
806
|
_HANDLERS = {
|
|
666
807
|
"vod_submit_voices": submit_voices,
|
|
667
808
|
"vod_list_submitted": list_submitted,
|
|
668
809
|
"vod_devkit_info": devkit_info,
|
|
669
810
|
"vod_auth_status": auth_status,
|
|
811
|
+
"vod_draft_voices": draft_voices,
|
|
812
|
+
"vod_commit_voices": commit_voices,
|
|
670
813
|
}
|
|
671
814
|
|
|
672
815
|
|
|
@@ -674,5 +817,5 @@ def dispatch(name: str, params: dict, client_info: dict | None = None) -> dict:
|
|
|
674
817
|
handler = _HANDLERS.get(name)
|
|
675
818
|
if handler is None:
|
|
676
819
|
raise ToolError(f"未知工具: {name}", code=-32601)
|
|
677
|
-
needs_host = handler in (devkit_info, submit_voices, auth_status)
|
|
820
|
+
needs_host = handler in (devkit_info, submit_voices, auth_status, draft_voices, commit_voices)
|
|
678
821
|
return handler(params, client_info) if needs_host else handler(params)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: vod-feedback-collect
|
|
3
|
-
description: '用户抱怨/体验差/太慢/报错/提单 → 采集原话进 VOD。识别到抱怨即承接并征得同意(禁止问哪个产品,禁止复现排查模式);content=原话逐字;一次抱怨一条;回执 echo 原样转述。详见正文流程与禁令。'
|
|
3
|
+
description: '用户抱怨/体验差/太慢/报错/提单 → 采集原话进 VOD。识别到抱怨即承接并征得同意(禁止问哪个产品,禁止复现排查模式);content=原话逐字;一次抱怨一条;回执 echo 原样转述。详见正文流程与禁令。Triggers: "体验差","太难用","太慢","报错了","出bug了","有bug","反馈问题","反馈建议","提个单","报告问题","不生效","不好使","操作不方便","卡住了","崩溃了","report a problem","bug report","poor experience","feedback"'
|
|
4
4
|
version: 1
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -82,6 +82,46 @@ version: 1
|
|
|
82
82
|
信号;定性由 agent 完成(降低用户决策成本),提交范围决策权
|
|
83
83
|
在用户。
|
|
84
84
|
|
|
85
|
+
**追问补充固定话术(D-followup-impl-2,2026-11-08 负责人确认)**:用户已
|
|
86
|
+
明确要提交(确认环节内)时,允许固定追问**至多一次、一次一问**,问句
|
|
87
|
+
必须逐字使用、禁止改写/拆分/追加第二轮:
|
|
88
|
+
「方便的话,补充一下遇到这个问题时的操作步骤或期望的表现吗?不方便回复"没有",我直接提交。」
|
|
89
|
+
纪律(四约束,违者=引导性提问制造"被暗示的复现步骤"):
|
|
90
|
+
1. 仅摘录用户回答中对应部分进 reproSteps(操作步骤)/ expectedBehavior
|
|
91
|
+
(期望表现)两个独立字段——不改写、不总结;无法拆分时按用户原话落
|
|
92
|
+
入最相关字段;**任何内容禁回填 content**(content 与旧流程逐字一致);
|
|
93
|
+
2. 答"没有/跳过/不方便"或未回答 = 两字段不上送,立即提交(诚实回退,
|
|
94
|
+
不注记不编造);
|
|
95
|
+
3. 除本次固定追问外,禁止再索要严重程度/环境/附件等开发者字段;
|
|
96
|
+
**触发判定块(2026-11-08 负责人确认并二次微调,禁自由裁量)**——固定
|
|
97
|
+
追问不是默认流程,按以下三层可执行判定走:
|
|
98
|
+
1. 触发前置:仅在用户明确说"提交/提吧"后、确认环节内,至多一次;
|
|
99
|
+
不得与引导补充连续两轮问。
|
|
100
|
+
2. 跳过条件:引导补充已获具体现象/场景/报错等非泛化反馈内容且并入
|
|
101
|
+
content → 不触发固定追问。引导补充中自然出现的操作/期望仍保留在
|
|
102
|
+
content 原话,**不回溯摘入新字段**;新字段仅承载固定追问的原样回答
|
|
103
|
+
(来源唯一,content 不被污染、不重复)。
|
|
104
|
+
3. 触发条件:引导补充未获回应,或只得到泛化抱怨,用户又确认提交 →
|
|
105
|
+
才原样带出固定问句至多一次。答了按摘录规则进两字段;答"没有/
|
|
106
|
+
不方便"立即提交、不追问。
|
|
107
|
+
判定例(可执行口径):"未回应"=用户未针对引导补充给出任何具体信息
|
|
108
|
+
(如仅回复"提交/嗯/没有");"泛化抱怨"=仅表达负面评价、无具体现象/
|
|
109
|
+
场景/报错(如"就是有问题/不好用/赶紧修")。
|
|
110
|
+
一句话口径:**跳过固定追问时,reproSteps/expectedBehavior 不上送,
|
|
111
|
+
payload 不含对应键,issue 不出现「(用户追问补充)」段、不作来源注记,
|
|
112
|
+
符合诚实回退。**
|
|
113
|
+
4. 引擎侧承载已就绪(t_vod_voice_inbox.repro_steps/expected_behavior,
|
|
114
|
+
issue 渲染带「用户追问补充」来源注记)——本话术非空头承诺(S51 自审过)。
|
|
115
|
+
|
|
116
|
+
**反截断红线(2026-11-08 opencode 实锤)**:用户在引导补充后给出的
|
|
117
|
+
补充句是**完整提交物**,content=该句逐字全量上送,禁止摘取其中片段
|
|
118
|
+
(实锤:用户说"操作不方便,流程合理",模型自行判断"最新具体抱怨是
|
|
119
|
+
操作不方便"只交了半句——"最新片段"不是裁量对象,整句才是原话)。
|
|
120
|
+
用户多轮分散表达时,把各轮原话按序拼接为 content,同样禁增删改写。
|
|
121
|
+
**拼接判定例(2026-11-08 opencode 第二次实锤后补)**:逐字=含语气词、
|
|
122
|
+
含原有标点,禁删语气词(实锤:原话"产品体验很差劲啊"被拼成"产品体验
|
|
123
|
+
很差劲。"——删"啊"补句号=改写)、禁补标点、禁规范措辞。轮次衔接用
|
|
124
|
+
换行或空格分隔,不新增标点;拼接结果必须能用逐字符比对还原回各轮原文。
|
|
85
125
|
**职责边界(先于一切)**:本技能只做一件事=采集-确认-提交-回执。
|
|
86
126
|
产品问答("AIShell 是什么")、产品对比、内部机制解释(归因/白名单/
|
|
87
127
|
配额)一律**不在职责内**:不读仓库文档作答、不展开、不主动科普——
|
|
@@ -111,8 +151,11 @@ version: 1
|
|
|
111
151
|
- content:用户反馈内容(尽量保留用户原话措辞,可轻度去噪)
|
|
112
152
|
- userType:可判断时填(企业/个人),不确定不填
|
|
113
153
|
- tags:明显的主题词(性能/功能/易用性),最多 3 个
|
|
114
|
-
3. 调用
|
|
115
|
-
|
|
154
|
+
3. 调用 vod_draft_voices 暂存草稿(必须用户已初步同意)→ 把返回的
|
|
155
|
+
contents 逐条**原样**展示给用户核对(禁止改写概括)→ 明确问
|
|
156
|
+
「确认提交吗」→ 用户明确同意后才调 vod_commit_voices(draftId/
|
|
157
|
+
approvalToken/payloadSha256 原样透传)。单发工具 vod_submit_voices
|
|
158
|
+
仅限无两段式工具的宿主使用。**一次一批**,攒多条一起交也行,但每批都要用户点头
|
|
116
159
|
**一次抱怨=一条声音(2026-11-06 实锤红线)**:用户一次表述只提交一条,
|
|
117
160
|
content=原话逐字——禁止拆成多条、禁止生成多个改写变体(实锤:一次
|
|
118
161
|
"网页卡回复慢"被宿主改写成「网页打开,…」+「网页卡,…」两条入库建出
|
package/vod_mcp/__init__.py
CHANGED
package/vod_mcp/packs.py
CHANGED
|
@@ -3,23 +3,44 @@
|
|
|
3
3
|
core 常驻(vod_devkit_info + vod-core 技能);未启用的 pack 工具不注册。
|
|
4
4
|
"""
|
|
5
5
|
import os
|
|
6
|
+
import sys
|
|
6
7
|
|
|
7
8
|
ALL_PACKS = ("core", "collect", "knowledge")
|
|
8
9
|
|
|
9
10
|
PACK_TOOLS = {
|
|
10
11
|
"core": ["vod_devkit_info", "vod_auth_status"],
|
|
11
|
-
|
|
12
|
+
# 两段式(D-token-approval-2 极简形态)随 collect 下发;codex 话术走 draft→commit
|
|
13
|
+
"collect": ["vod_submit_voices", "vod_draft_voices", "vod_commit_voices", "vod_list_submitted"],
|
|
12
14
|
"knowledge": [], # 纯技能包:3 个领域规则技能,零工具零依赖
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
|
|
18
|
+
BREAKER_MARKERS = (
|
|
19
|
+
# 熔断标记(D-codex-circuit-breaker-1):install 门禁可被
|
|
20
|
+
# `VOD_PACKS=core,collect serve` 绕过——运行期同查标记强制降级
|
|
21
|
+
os.path.expanduser("~/.codex/vod-collect-suspended.json"),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
16
25
|
def enabled_packs() -> tuple:
|
|
17
26
|
raw = os.environ.get("VOD_PACKS", "").strip()
|
|
18
27
|
if not raw:
|
|
19
28
|
return ALL_PACKS
|
|
20
|
-
|
|
29
|
+
# kb=knowledge 旧称别名(历史文档/用户习惯;深审 P0-2 配套:安装口
|
|
30
|
+
# 旧值不因运行口改名而静默失效)
|
|
31
|
+
packs = tuple(p.strip() for p in raw.split(","))
|
|
32
|
+
packs = tuple("knowledge" if p == "kb" else p for p in packs)
|
|
33
|
+
packs = tuple(p for p in packs if p in ALL_PACKS)
|
|
21
34
|
if "core" not in packs:
|
|
22
35
|
packs = ("core",) + packs
|
|
36
|
+
if "collect" in packs and any(os.path.isfile(m) for m in BREAKER_MARKERS):
|
|
37
|
+
# 运行期熔断门禁:collect 强制摘除(非静默——stderr 告警)。
|
|
38
|
+
# 解除=删熔断标记(install --ack-suspension 即此语义)
|
|
39
|
+
packs = tuple(p for p in packs if p != "collect")
|
|
40
|
+
print("[vod-devkit] 采集熔断生效(codex 未确认提交 ≥2 次,"
|
|
41
|
+
"D-codex-circuit-breaker-1):collect 已强制摘除。"
|
|
42
|
+
"恢复前置=token 化上线并过回归;--ack-suspension 解除安装门禁,"
|
|
43
|
+
"运行期解除须删熔断标记", file=sys.stderr)
|
|
23
44
|
return packs
|
|
24
45
|
|
|
25
46
|
|
package/vod_mcp/tools.py
CHANGED
|
@@ -19,6 +19,25 @@ from pathlib import Path
|
|
|
19
19
|
from vod_mcp import provenance
|
|
20
20
|
from vod_mcp import DEFAULT_JAVA_BASE
|
|
21
21
|
|
|
22
|
+
# D-followup-impl-2:追问拒答语义词集(答"没有"类=两字段不上送)。
|
|
23
|
+
# 契约话术承诺了"不方便回复没有",客户端必须技术兜底——模型不守话术纪律时
|
|
24
|
+
# 键集合仍零漂移(test_followup_declined_or_blank_omitted 回归锁)。
|
|
25
|
+
_FOLLOWUP_DECLINES = frozenset({
|
|
26
|
+
"没有", "无", "没有。", "没了", "跳过", "不方便", "不用了", "不用",
|
|
27
|
+
"不补充", "算了", "没有了", "没有了。", "不方便说", "no", "none", "skip", "n/a",
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _followup_fields(voice: dict) -> dict:
|
|
32
|
+
"""D-followup-impl-2 单源提取(submit 主路径与 draft 暂存共用,禁双边漂移):
|
|
33
|
+
仅 trim 非空且非拒答词才含键;引擎同口径截 2000;内容永不回流 content。"""
|
|
34
|
+
out = {}
|
|
35
|
+
for _f in ("reproSteps", "expectedBehavior"):
|
|
36
|
+
_val = str(voice.get(_f) or "").strip()
|
|
37
|
+
if _val and _val.lower() not in _FOLLOWUP_DECLINES:
|
|
38
|
+
out[_f] = _val[:2000]
|
|
39
|
+
return out
|
|
40
|
+
|
|
22
41
|
_CONTRACT_PATH = Path(__file__).resolve().parent.parent / "contract" / "tools.schema.json"
|
|
23
42
|
|
|
24
43
|
|
|
@@ -232,7 +251,8 @@ def _explicit_key() -> bool:
|
|
|
232
251
|
return bool(JAVA_KEY) and str(_RT.get("token_tier") or "") != "anonymous"
|
|
233
252
|
|
|
234
253
|
|
|
235
|
-
def submit_voices(params: dict, client_info: dict | None = None
|
|
254
|
+
def submit_voices(params: dict, client_info: dict | None = None,
|
|
255
|
+
ledger_extra: dict | None = None) -> dict:
|
|
236
256
|
"""V16 切换:主路径=囤积端点 POST /external/voices(Bearer,批式,不触发分析);
|
|
237
257
|
引擎未部署(404)自动回落老链 /external/voice/submit(提交即分析,过渡语义,
|
|
238
258
|
部署后 404 分支自然失效)。
|
|
@@ -281,6 +301,9 @@ def submit_voices(params: dict, client_info: dict | None = None) -> dict:
|
|
|
281
301
|
"title": items[min(i, len(items) - 1)][2][:40],
|
|
282
302
|
"product": product, "at": _time.strftime("%Y-%m-%dT%H:%M:%S")}
|
|
283
303
|
for i, (vid, tid) in enumerate(zip(vids, tids))]
|
|
304
|
+
if ledger_extra:
|
|
305
|
+
for e in entries:
|
|
306
|
+
e.update(ledger_extra) # 两段式:stage=committed + draftId 关联(验收③)
|
|
284
307
|
_ledger_append(entries)
|
|
285
308
|
|
|
286
309
|
def _legacy_submit(i, v, content):
|
|
@@ -310,6 +333,9 @@ def submit_voices(params: dict, client_info: dict | None = None) -> dict:
|
|
|
310
333
|
ut = v.get("userType")
|
|
311
334
|
if ut:
|
|
312
335
|
hv["userType"] = ut
|
|
336
|
+
# D-followup-impl-2 追问补充透传:单源 _followup_fields(拒答词集兜底+
|
|
337
|
+
# 引擎同口径截 2000+禁回流 content;未追问/答"没有"=键集合零漂移)
|
|
338
|
+
hv.update(_followup_fields(v))
|
|
313
339
|
hoard_voices.append(hv)
|
|
314
340
|
body = {"voices": hoard_voices}
|
|
315
341
|
if product: # 无归因不带 product(引擎 UNKNOWN 档),不本地拦截
|
|
@@ -662,11 +688,128 @@ def devkit_info(params: dict, client_info: dict | None = None) -> dict:
|
|
|
662
688
|
|
|
663
689
|
|
|
664
690
|
# 工具名 → 处理器(是否接收 client_info)
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
# ---- 两段式提交(D-token-approval-2 极简形态:插件本地 draft→commit,引擎零改动)----
|
|
694
|
+
# 定性:最强摩擦+审计链,非人类确认硬保证(decisions 既有纠偏)。
|
|
695
|
+
# draft 暂存 runtime.json(cap 10 环形+TTL 600s),commit 单次消费后内部复用
|
|
696
|
+
# submit_voices 既有链——配额/幂等/归因/回显语义零新增。stage=draft/committed
|
|
697
|
+
# 入账本:绕过两段式的直接提交在账本层面可检测(验收③)。
|
|
698
|
+
|
|
699
|
+
_DRAFT_KEY = "drafts"
|
|
700
|
+
_DRAFT_CAP = 10
|
|
701
|
+
_DRAFT_TTL = 600 # 秒;过期 commit 拒收,草稿自动作废
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
def _drafts_purge(store: dict) -> dict:
|
|
705
|
+
"""过期草稿清除(读时惰性,无后台任务)。"""
|
|
706
|
+
import time as _time
|
|
707
|
+
now = _time.time()
|
|
708
|
+
return {k: v for k, v in store.items()
|
|
709
|
+
if v.get("expiresAt", 0) > now}
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
def draft_voices(params: dict, client_info: dict | None = None) -> dict:
|
|
713
|
+
"""两段式第一步:校验+暂存草稿+签发一次性令牌(不提交任何数据)。"""
|
|
714
|
+
import time as _time
|
|
715
|
+
product, ignored_runtime = _resolve_product(params)
|
|
716
|
+
voices_in = params.get("voices", [])
|
|
717
|
+
clean = []
|
|
718
|
+
for i, v in enumerate(voices_in):
|
|
719
|
+
content = str(v.get("content", "")).strip()
|
|
720
|
+
if not content:
|
|
721
|
+
raise ToolError(f"第 {i + 1} 条 content 为空", code=-32602)
|
|
722
|
+
if len(content) > 2000:
|
|
723
|
+
raise ToolError(f"第 {i + 1} 条 content 超 2000 字({len(content)})", code=-32602)
|
|
724
|
+
item = {"content": content}
|
|
725
|
+
if v.get("tags"):
|
|
726
|
+
item["tags"] = v["tags"]
|
|
727
|
+
if v.get("userType"):
|
|
728
|
+
item["userType"] = v["userType"]
|
|
729
|
+
# D-followup-impl-2:追问补充随 draft 暂存(commit 复用 payload 原样上送),
|
|
730
|
+
# 单源 _followup_fields 与主路径同口径
|
|
731
|
+
item.update(_followup_fields(v))
|
|
732
|
+
clean.append(item)
|
|
733
|
+
if not clean:
|
|
734
|
+
raise ToolError("voices 为必填且至少 1 条", code=-32602)
|
|
735
|
+
|
|
736
|
+
import secrets
|
|
737
|
+
draft_id = "draft_" + secrets.token_hex(8)
|
|
738
|
+
token = secrets.token_hex(16)
|
|
739
|
+
payload = {"voices": clean}
|
|
740
|
+
if product:
|
|
741
|
+
payload["product"] = product
|
|
742
|
+
# 载荷 sha(防 draft→commit 间改写:commit 校验插件侧重算值一致)
|
|
743
|
+
import hashlib
|
|
744
|
+
payload_sha = hashlib.sha256(
|
|
745
|
+
json.dumps(payload, sort_keys=True, ensure_ascii=False).encode()).hexdigest()
|
|
746
|
+
|
|
747
|
+
fresh = _runtime_cfg()
|
|
748
|
+
store = _drafts_purge(fresh.get(_DRAFT_KEY) or {})
|
|
749
|
+
store[draft_id] = {
|
|
750
|
+
"payload": payload, "payloadSha256": payload_sha, "tokenHash": _sha256(token),
|
|
751
|
+
"product": product, "createdAt": _time.strftime("%Y-%m-%dT%H:%M:%S"),
|
|
752
|
+
"expiresAt": _time.time() + _DRAFT_TTL,
|
|
753
|
+
}
|
|
754
|
+
while len(store) > _DRAFT_CAP: # 环形:最旧先淘汰
|
|
755
|
+
store.pop(next(iter(store)))
|
|
756
|
+
_save_runtime({_DRAFT_KEY: store})
|
|
757
|
+
|
|
758
|
+
if ignored_runtime: # D-attrib-A 可观测:模型试图改归因留痕
|
|
759
|
+
_warn(f"draft: runtime product 被忽略(绑定权威): {ignored_runtime}")
|
|
760
|
+
return {
|
|
761
|
+
"draftId": draft_id,
|
|
762
|
+
"approvalToken": token,
|
|
763
|
+
"payloadSha256": payload_sha,
|
|
764
|
+
"expiresInSeconds": _DRAFT_TTL,
|
|
765
|
+
"contents": [{"index": i, "content": it["content"]} for i, it in enumerate(clean)],
|
|
766
|
+
"instruction": ("把 contents 逐条原样展示给用户核对(禁止改写概括),明确问"
|
|
767
|
+
"「确认提交吗」。用户明确同意前禁止调用 vod_commit_voices;"
|
|
768
|
+
"不同意则停(草稿 10 分钟后自动作废)。"),
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
def commit_voices(params: dict, client_info: dict | None = None) -> dict:
|
|
773
|
+
"""两段式第二步:令牌校验→单次消费→复用 submit_voices 既有提交链。"""
|
|
774
|
+
draft_id = str(params.get("draftId", ""))
|
|
775
|
+
token = str(params.get("approvalToken", ""))
|
|
776
|
+
payload_sha = str(params.get("payloadSha256", ""))
|
|
777
|
+
if not draft_id or not token or not payload_sha:
|
|
778
|
+
raise ToolError("draftId/approvalToken/payloadSha256 为必填(取自 vod_draft_voices 返回原样透传)",
|
|
779
|
+
code=-32602)
|
|
780
|
+
|
|
781
|
+
fresh = _runtime_cfg()
|
|
782
|
+
store = _drafts_purge(fresh.get(_DRAFT_KEY) or {})
|
|
783
|
+
draft = store.get(draft_id)
|
|
784
|
+
if draft is None:
|
|
785
|
+
raise ToolError("草稿不存在或已过期(10 分钟 TTL),请重新 vod_draft_voices", code=-32011)
|
|
786
|
+
if draft["tokenHash"] != _sha256(token):
|
|
787
|
+
raise ToolError("审批令牌不匹配(draft 返回的 approvalToken 原样透传)", code=-32011)
|
|
788
|
+
if draft["payloadSha256"] != payload_sha:
|
|
789
|
+
raise ToolError("载荷校验不符(payloadSha256 与 draft 签发值不一致,禁止改写已确认内容)",
|
|
790
|
+
code=-32011)
|
|
791
|
+
# 单次消费:先摘除再提交——提交中途崩溃也不会二次提交(宁可丢一单重走流程)
|
|
792
|
+
store.pop(draft_id)
|
|
793
|
+
_save_runtime({_DRAFT_KEY: store})
|
|
794
|
+
|
|
795
|
+
out = submit_voices(dict(draft["payload"]), client_info,
|
|
796
|
+
ledger_extra={"stage": "committed", "draftId": draft_id})
|
|
797
|
+
out["twoPhase"] = True
|
|
798
|
+
out["draftId"] = draft_id
|
|
799
|
+
return out
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
def _sha256(s: str) -> str:
|
|
803
|
+
import hashlib
|
|
804
|
+
return hashlib.sha256(s.encode()).hexdigest()
|
|
805
|
+
|
|
665
806
|
_HANDLERS = {
|
|
666
807
|
"vod_submit_voices": submit_voices,
|
|
667
808
|
"vod_list_submitted": list_submitted,
|
|
668
809
|
"vod_devkit_info": devkit_info,
|
|
669
810
|
"vod_auth_status": auth_status,
|
|
811
|
+
"vod_draft_voices": draft_voices,
|
|
812
|
+
"vod_commit_voices": commit_voices,
|
|
670
813
|
}
|
|
671
814
|
|
|
672
815
|
|
|
@@ -674,5 +817,5 @@ def dispatch(name: str, params: dict, client_info: dict | None = None) -> dict:
|
|
|
674
817
|
handler = _HANDLERS.get(name)
|
|
675
818
|
if handler is None:
|
|
676
819
|
raise ToolError(f"未知工具: {name}", code=-32601)
|
|
677
|
-
needs_host = handler in (devkit_info, submit_voices, auth_status)
|
|
820
|
+
needs_host = handler in (devkit_info, submit_voices, auth_status, draft_voices, commit_voices)
|
|
678
821
|
return handler(params, client_info) if needs_host else handler(params)
|