dsh-media-lens 0.3.3 → 0.3.4

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
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.4
4
+
5
+ - 修复多语言注册告警噪音:`addLanguage` 命中全局语言表"先到先得"、`register` 命中命名空间重复(`already registered` / `already has locale`)时改为良性跳过,不再刷"注册失败"红色告警;跨插件共用标准语码与本插件 `_reload` 均不再误报。
6
+
3
7
  ## 0.3.3
4
8
 
5
9
  - 终端面(dsh-tui / Desktop 命令面板同源):/media 只读设置节面(status)。
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-media-lens",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Media evidence lens + provider router for DeepSeek Harness (media_read_video / media_read_audio / media_read_image).",
6
6
  "engines": {
package/lib/client.js CHANGED
@@ -6,7 +6,7 @@ window.__ModuleLoader__.load({
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  let react = require("react");
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
- //#region src/config.ts
9
+ // src/config.ts
10
10
  const DEFAULT_CONFIG = {
11
11
  strictLocalOnly: false,
12
12
  cooldownMs: 6e5,
@@ -122,8 +122,7 @@ window.__ModuleLoader__.load({
122
122
  }
123
123
  };
124
124
  }
125
- //#endregion
126
- //#region src/client/MediaLensSettingsCard.tsx
125
+ // src/client/MediaLensSettingsCard.tsx
127
126
  /**
128
127
  * media-lens 客户端设置卡(全量可编辑表单)。
129
128
  * 数据面:宿主 configForms 权威 scope(0.1.7+/0.2.0/0.2.1 唯一活写路径)。
@@ -553,8 +552,7 @@ window.__ModuleLoader__.load({
553
552
  ]
554
553
  });
555
554
  }
556
- //#endregion
557
- //#region src/client/locales.ts
555
+ // src/client/locales.ts
558
556
  /**
559
557
  * media-lens 客户端 UI 字典(9 语:zh en ja ko fr de it ru es)。
560
558
  * zh 键集为真理源,其余 8 语用 Record<keyof typeof zh, string> 编译期对齐;
@@ -979,8 +977,7 @@ window.__ModuleLoader__.load({
979
977
  }
980
978
  }
981
979
  ];
982
- //#endregion
983
- //#region src/client/index.ts
980
+ // src/client/index.ts
984
981
  /**
985
982
  * media-lens 客户端半身入口。
986
983
  *
@@ -1003,6 +1000,16 @@ window.__ModuleLoader__.load({
1003
1000
  const FAMILY_TAB_ORDER = 65;
1004
1001
  const SECTION_ORDER = 24;
1005
1002
  const FAMILY_YIELD_MS = 1e3;
1003
+ /**
1004
+ * Host locale APIs throw on duplicate writes: `addLanguage` when the global
1005
+ * catalog already has the id (`... is already registered`), and `register` when
1006
+ * the namespace already carries that locale (`... already has locale "..."`).
1007
+ * Both mean the entry is already present and usable, so they are benign skips
1008
+ * (multi-mount or `_reload` re-running apply), not real failures — never warn.
1009
+ */
1010
+ function isBenignLocaleDuplicate(error) {
1011
+ return error instanceof Error && /already (?:registered|has locale)/.test(error.message);
1012
+ }
1006
1013
  function apply(ctx) {
1007
1014
  try {
1008
1015
  ctx.locale.register(NS, {
@@ -1010,17 +1017,23 @@ window.__ModuleLoader__.load({
1010
1017
  en
1011
1018
  });
1012
1019
  } catch (error) {
1013
- console.warn("[dsh-media-lens] locale zh/en 已注册,跳过:", error);
1020
+ if (!isBenignLocaleDuplicate(error)) console.warn("[dsh-media-lens] locale zh/en register failed:", error);
1014
1021
  }
1015
- for (const language of extraLanguages) try {
1016
- ctx.locale.register(NS, language.id, language.dict);
1017
- ctx.locale.addLanguage({
1018
- id: language.id,
1019
- label: language.label,
1020
- fallback: "en"
1021
- });
1022
- } catch (error) {
1023
- console.warn(`[dsh-media-lens] locale "${language.id}" 注册失败,跳过:`, error);
1022
+ for (const language of extraLanguages) {
1023
+ try {
1024
+ ctx.locale.register(NS, language.id, language.dict);
1025
+ } catch (error) {
1026
+ if (!isBenignLocaleDuplicate(error)) console.warn(`[dsh-media-lens] locale "${language.id}" dictionary registration failed:`, error);
1027
+ }
1028
+ try {
1029
+ ctx.locale.addLanguage({
1030
+ id: language.id,
1031
+ label: language.label,
1032
+ fallback: "en"
1033
+ });
1034
+ } catch (error) {
1035
+ if (!isBenignLocaleDuplicate(error)) console.warn(`[dsh-media-lens] locale "${language.id}" language registration failed:`, error);
1036
+ }
1024
1037
  }
1025
1038
  const tNav = ctx.locale.bind(NS);
1026
1039
  let configForms;
@@ -1191,7 +1204,6 @@ window.__ModuleLoader__.load({
1191
1204
  console.warn("[dsh-media-lens] plugins.bundle.config 注册失败(旧宿主无该槽,静默缺席):", error);
1192
1205
  }
1193
1206
  }
1194
- //#endregion
1195
1207
  exports.apply = apply;
1196
1208
  exports.inject = inject;
1197
1209
  return module.exports;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-media-lens",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Media evidence lens + provider router for DeepSeek Harness: media_read_video / media_read_audio / media_read_image turn local media into structured evidence (timeline / transcript / regions) via host-registered multimodal models first, configured OpenAI-compatible endpoints second, and local ffmpeg/CLI fallbacks last. Every fallback is recorded in meta.attempts — a fallback is never silent.",
5
5
  "type": "module",
6
6
  "license": "MIT",