dsh-context-compression-improved 0.11.2 → 0.11.3

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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-context-compression-improved",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "main": "./lib/index.js",
5
5
  "description": "Auditable tool-result context-compression selector with code-skeleton gate for DeepSeek Harness",
6
6
  "engines": {
package/lib/client.js CHANGED
@@ -3857,6 +3857,17 @@ window.__ModuleLoader__.load({
3857
3857
  if (left.version !== 3 || right.version !== 3) return false;
3858
3858
  return left.version === right.version && left.unit === right.unit && left.prefixPolicy === right.prefixPolicy && left.fresh.enabled === right.fresh.enabled && left.fresh.trigger === right.fresh.trigger && left.fresh.target === right.fresh.target && left.aggregate.enabled === right.aggregate.enabled && left.aggregate.trigger === right.aggregate.trigger && left.aggregate.target === right.aggregate.target && left.history.enabled === right.history.enabled && left.history.trigger === right.history.trigger && left.history.keepRecentToolCalls === right.history.keepRecentToolCalls && left.history.keepRecentTokens === right.history.keepRecentTokens && left.history.minReclaim === right.history.minReclaim && left.tailTrim.enabled === right.tailTrim.enabled && left.tailTrim.trigger === right.tailTrim.trigger;
3859
3859
  }
3860
+ /**
3861
+ * Host locale APIs throw on duplicate writes: `addLanguage` when the global
3862
+ * catalog already has the id (`... is already registered`), and `register` when
3863
+ * the namespace already carries that locale (`... already has locale "..."`).
3864
+ * This plugin is mounted twice by name (bundle row + estimator-catalog row) and
3865
+ * re-runs apply on `_reload`, so both throws are expected benign skips — the
3866
+ * entry is already present and usable — and must never surface as warning noise.
3867
+ */
3868
+ function isBenignLocaleDuplicate(error) {
3869
+ return error instanceof Error && /already (?:registered|has locale)/.test(error.message);
3870
+ }
3860
3871
  function apply(ctx) {
3861
3872
  try {
3862
3873
  ctx.locale.register(NS, {
@@ -3864,7 +3875,7 @@ window.__ModuleLoader__.load({
3864
3875
  en
3865
3876
  });
3866
3877
  } catch (error) {
3867
- console.warn("[dsh-context-compression-improved] locale 默认包(zh/en) 已注册,跳过:", error);
3878
+ if (!isBenignLocaleDuplicate(error)) console.warn("[dsh-context-compression-improved] locale zh/en register failed:", error);
3868
3879
  }
3869
3880
  const languages = [
3870
3881
  {
@@ -3903,15 +3914,21 @@ window.__ModuleLoader__.load({
3903
3914
  dict: ru
3904
3915
  }
3905
3916
  ];
3906
- for (const language of languages) try {
3907
- ctx.locale.register(NS, language.id, language.dict);
3908
- ctx.locale.addLanguage({
3909
- id: language.id,
3910
- label: language.label,
3911
- fallback: "en"
3912
- });
3913
- } catch (error) {
3914
- console.warn(`[dsh-context-compression-improved] locale "${language.id}" registration failed:`, error);
3917
+ for (const language of languages) {
3918
+ try {
3919
+ ctx.locale.register(NS, language.id, language.dict);
3920
+ } catch (error) {
3921
+ if (!isBenignLocaleDuplicate(error)) console.warn(`[dsh-context-compression-improved] locale "${language.id}" dictionary registration failed:`, error);
3922
+ }
3923
+ try {
3924
+ ctx.locale.addLanguage({
3925
+ id: language.id,
3926
+ label: language.label,
3927
+ fallback: "en"
3928
+ });
3929
+ } catch (error) {
3930
+ if (!isBenignLocaleDuplicate(error)) console.warn(`[dsh-context-compression-improved] locale "${language.id}" language registration failed:`, error);
3931
+ }
3915
3932
  }
3916
3933
  const tNav = ctx.locale?.bind?.(NS) ?? ((key) => key);
3917
3934
  let configFormsHandle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-context-compression-improved",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "One-install context-compression selector bundle for DeepSeek Harness",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",