vod-devkit 0.1.10 → 0.1.11
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 +95 -0
- package/bin/vod-devkit +76 -2
- package/package.json +2 -2
- package/vod_mcp/__pycache__/__init__.cpython-314.pyc +0 -0
- package/vod_mcp/__pycache__/tools.cpython-314.pyc +0 -0
- package/vod_mcp/runtime.json +260 -260
- package/vod_mcp/tools.py +24 -5
package/vod_mcp/tools.py
CHANGED
|
@@ -53,22 +53,28 @@ _META_SNAPSHOT = {"products": ["agentarts", "codearts", "dataarts", "maas", "obs
|
|
|
53
53
|
|
|
54
54
|
def _load_meta(force: bool = False) -> dict:
|
|
55
55
|
"""可漂移值(product 白名单等)动态取:缓存 TTL 24h,
|
|
56
|
-
引擎端点不可达时回退快照并标 stale。真源=引擎 submit 校验常量。
|
|
56
|
+
引擎端点不可达时回退快照并标 stale。真源=引擎 submit 校验常量。
|
|
57
|
+
T7i:productCatalog=[{id,name}](t_vod_product 运营预置,meta 组装)——
|
|
58
|
+
提交产品归因按平台主键 id 的解析真源;老引擎无该键=catalog 空。"""
|
|
57
59
|
import time
|
|
58
60
|
cache = _RT.get("meta_cache") or {}
|
|
59
61
|
now = time.time()
|
|
60
62
|
if not force and cache.get("data") and now - cache.get("fetchedAt", 0) < _META_TTL:
|
|
61
63
|
return {"products": cache["data"].get("products", _META_SNAPSHOT["products"]),
|
|
64
|
+
"catalog": cache["data"].get("productCatalog") or [],
|
|
62
65
|
"stale": False, "source": "cache"}
|
|
63
66
|
try:
|
|
64
67
|
out = _http("GET", _META_PATH, None, base=JAVA_BASE, key=JAVA_KEY, timeout=10)
|
|
65
68
|
data = out.get("data") or {}
|
|
66
69
|
if isinstance(data.get("products"), list) and data["products"]:
|
|
67
70
|
_save_runtime({"meta_cache": {"fetchedAt": int(now), "data": data}})
|
|
68
|
-
return {"products": data["products"],
|
|
71
|
+
return {"products": data["products"],
|
|
72
|
+
"catalog": data.get("productCatalog") or [],
|
|
73
|
+
"stale": False, "source": "meta"}
|
|
69
74
|
except ToolError:
|
|
70
75
|
pass
|
|
71
|
-
return {"products": _META_SNAPSHOT["products"], "
|
|
76
|
+
return {"products": _META_SNAPSHOT["products"], "catalog": [],
|
|
77
|
+
"stale": True, "source": "snapshot"}
|
|
72
78
|
|
|
73
79
|
|
|
74
80
|
class ToolError(Exception):
|
|
@@ -150,11 +156,24 @@ def _resolve_product(params: dict) -> str | None:
|
|
|
150
156
|
①调用方显式传参 ②安装绑定(runtime.json product——安装器默认写入宿主名,
|
|
151
157
|
hermes/opencode/codex 装在哪就归哪)③都没有 → 返回 None(body 不带
|
|
152
158
|
product,引擎落 UNKNOWN 档人工归因解析,V19)——不再 -32013 本地拦截。
|
|
153
|
-
|
|
159
|
+
T7i(方案 A,2026-11-05 拍板):产品归因主键化——
|
|
160
|
+
①纯数字串=平台主键 id,原样透传(引擎 selectById 精确命中)
|
|
161
|
+
②名字→meta productCatalog 按名解析出平台 id 后提交(对账主键化,
|
|
162
|
+
归一化/改名漂移不进提交链路);_PRODUCT_MAP 先归一短码再查目录
|
|
163
|
+
③目录无此名/目录不可用→规范名原样上送(引擎 name 兼容通道,
|
|
164
|
+
命中同样补落 product_id)——不静默丢提交。"""
|
|
154
165
|
raw = str(params.get("product") or _RT.get("product") or "").strip()
|
|
155
166
|
if not raw:
|
|
156
167
|
return None
|
|
157
|
-
|
|
168
|
+
if raw.isdigit():
|
|
169
|
+
return raw
|
|
170
|
+
name = _PRODUCT_MAP.get(raw.lower(), raw)
|
|
171
|
+
for item in (_load_meta().get("catalog") or []):
|
|
172
|
+
if str(item.get("name") or "").lower() == name.lower():
|
|
173
|
+
return str(item.get("id"))
|
|
174
|
+
return name
|
|
175
|
+
|
|
176
|
+
|
|
158
177
|
_SUBMIT_HOARDING = "/rest/developer/manager/hdvodmngservice/v1/external/voices"
|
|
159
178
|
_EXISTING_SUBMIT = "/rest/developer/manager/hdvodmngservice/v1/external/voice/submit" # 过渡期 404 回落
|
|
160
179
|
_TOKEN_PATH = "/rest/developer/manager/hdvodmngservice/v1/external/token"
|