dsh-cmtoken-oauth 1.5.1 → 1.5.2

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.
Files changed (2) hide show
  1. package/lib/index.js +8 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -609,7 +609,7 @@ function registerVisionTool(ctx) {
609
609
  const tool = {
610
610
  name: VISION_TOOL_NAME,
611
611
  description:
612
- '通过 cmtoken 视觉模型读取图片。当对话中出现当前模型无法查看的图片时使用,典型形态是 [Image: <本地路径>] 行(粘贴/拖入的图片由插件自动落盘)或裸的本地绝对路径、http(s) URL:截图、照片、图表、扫描件等。返回结构化取证结果(summary、ocr_full_text、layout、semantics、uncertainty),请引用证据而不是猜测。需要已完成 cmtoken 一键认证。',
612
+ '通过 cmtoken 视觉模型读取图片,仅作为纯文本模型的视觉补足:当前模型原生支持识图(input 声明含 image 或可用 read_image)时不要调用本工具,直接看图即可。当对话中出现当前模型无法查看的图片时使用,典型形态是 [Image: <本地路径>] 行(粘贴/拖入的图片由插件自动落盘)或裸的本地绝对路径、http(s) URL:截图、照片、图表、扫描件等。返回结构化取证结果(summary、ocr_full_text、layout、semantics、uncertainty),请引用证据而不是猜测。需要已完成 cmtoken 一键认证。',
613
613
  parameters: {
614
614
  type: 'object',
615
615
  properties: {
@@ -825,13 +825,16 @@ function modelLabelToName(label) {
825
825
  return s.replace(/\s*\(视觉回退\)\s*$/i, '').trim();
826
826
  }
827
827
 
828
- /** 在已认证模型列表里查找(id 或显示名,忽略大小写;兜底子串匹配);找不到返回 undefined。 */
828
+ /** 在已认证模型列表里查找(id 或显示名)。只做「相等」匹配(忽略大小写与分隔符),
829
+ * 绝不做子串包含——否则其他 provider 的同名系模型(如 zai-coding-cn 的
830
+ * glm-5.3-flash 包含 cmtoken 组 "glm-5" 的字样)会被误判为 cmtoken 模型而遭到
831
+ * 拖图接管,违背「本插件只服务 cmtoken 提供方」的设计边界;找不到返回 undefined。 */
829
832
  function findConfiguredModel(ctx, name) {
830
833
  if (!name) return undefined;
831
834
  const models = ctx.settings?.get?.(settingsNamespace('llm-pi-ai'))?.providers?.cmtoken?.models ?? [];
832
- const lower = String(name).toLowerCase();
833
- return models.find((m) => String(m.id).toLowerCase() === lower || String(m.name ?? '').toLowerCase() === lower)
834
- ?? models.find((m) => lower.includes(String(m.id).toLowerCase()) || lower.includes(String(m.name ?? '').toLowerCase()));
835
+ const norm = (s) => String(s ?? '').toLowerCase().replace(/[-_\s.]+/g, '');
836
+ const target = norm(name);
837
+ return models.find((m) => norm(m.id) === target || norm(m.name) === target);
835
838
  }
836
839
 
837
840
  // ---------------- 视觉回退模型选择(~/.dsh/cmtoken-oauth.json) ----------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cmtoken-oauth",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "DeepSeek Harness 插件:在 DSH 设置页一键完成广东移动 MaaS(cmtoken)的 OAuth 2.0 Device Grant + PKCE 认证,自动发现模型并写入 llm-pi-ai provider 配置(视觉模型自动声明图片输入模态);粘贴识图让纯文本模型直接收图(Qwen3.8 / Qwen3.x / Kimi K2.x / MiniMax M3 自动识读),另有 cmtoken_read_image 工具与可选的 cmtoken-vision 包装路由;凭据安全保存并自动续期。零第三方运行时依赖。",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",