dsh-agy-link 0.6.28 → 0.6.29

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.29 (2026-11-15)
4
+
5
+ ### English
6
+
7
+ - **Fix(models): a transient refusal can no longer blacklist a model's reasoning efforts (fixes #115).** When agy's model-config fetch fails (e.g. a `loadCodeAssist` TLS timeout), its print-mode validation emits a perfectly well-formed `--effort is not supported for model "X"` even though `agy models` lists that level. `streamWithEffortRetry()` learned ANY such refusal as a static capability: the model went into `effort-unsupported.json`, `resolveModel()` stopped advertising `reasoning`, and DSH then rejected later turns with `UNSUPPORTED_REASONING_EFFORT` while the live catalog still showed `xhigh`. A new `ModelCatalog.advertisedEfforts()` collects the efforts the **discovered** catalog (base + per-account) advertises; a refusal that contradicts it is still replayed without `--effort` (the #67 invariant) but is NOT persisted. Fallback entries are deliberately not evidence.
8
+ - **Fix(models): `effort-unsupported.json` is now live-reloaded.** The host no longer caches the file for the process lifetime, and `EffortPolicy` rebuilds when the seed changes (keeping refusals learned in the current process), so an operator clearing a false entry no longer needs to restart DSH.
9
+ - Tests: real discovered-catalog regression (refusal not learned, effort row preserved), external-edit visibility, and file re-read. Thanks to @AlaIchhe for the timeline, transcript evidence and the minimal reproduction.
10
+
11
+ ### 中文
12
+
13
+ - **修复(模型):瞬时拒绝不再把模型的思考档位永久拉黑(修复 #115)。** agy 在模型配置拉取失败(如 `loadCodeAssist` TLS 超时)时,print-mode 硬校验会输出**格式完全合法**的 `--effort is not supported for model "X"`,而 `agy models` 明明列着该档位。`streamWithEffortRetry()` 此前把任何这类拒绝当作静态能力学习:写入 `effort-unsupported.json`、`resolveModel()` 不再发布 `reasoning`,于是 DSH 后续轮次直接抛 `UNSUPPORTED_REASONING_EFFORT`,档位行永久消失,而实时目录仍显示 `xhigh`。新增 `ModelCatalog.advertisedEfforts()` 汇总**已发现**目录(base + 各账号)声明的档位;与目录矛盾的拒绝仍按 #67 重放一次(不带 `--effort`),但**不落盘、不收回能力声明**。fallback 阵容是静态镜像,不作为证据。
14
+ - **修复(模型):`effort-unsupported.json` 现在即时生效。** 宿主不再对文件做进程级缓存,`EffortPolicy` 在 seed 变化时重建(保留本进程学到的条目),运维清空误学条目后无需重启 DSH。
15
+ - 测试:真实已发现目录回归(矛盾拒绝不学习、档位行保留)、外部修改即时可见、文件重读。感谢 @AlaIchhe 提供时间线、transcript 证据与最小复现。
16
+
3
17
  ## 0.6.28 (2026-11-15)
4
18
 
5
19
  ### English
@@ -3773,6 +3773,9 @@ var EffortPolicy = class {
3773
3773
  log;
3774
3774
  onLearned;
3775
3775
  cache = null;
3776
+ seedKey = "";
3777
+ /** Models learned in THIS process: survive an external edit of the seed. */
3778
+ learned = /* @__PURE__ */ new Set();
3776
3779
  constructor(seed, log, onLearned) {
3777
3780
  this.seed = seed;
3778
3781
  this.log = log;
@@ -3794,15 +3797,19 @@ var EffortPolicy = class {
3794
3797
  const set = this.models();
3795
3798
  if (this.isUnsupported(model)) return;
3796
3799
  set.add(model);
3800
+ this.learned.add(model);
3797
3801
  this.log?.("agy refused --effort for model \"" + model + "\" — it is now run without an effort flag (effort support is advisory in the catalog; see issue #67)");
3798
3802
  try {
3799
3803
  this.onLearned?.(model);
3800
3804
  } catch {}
3801
3805
  }
3802
3806
  models() {
3803
- if (this.cache === null) {
3804
- const seeded = this.seed() ?? [];
3805
- this.cache = new Set((Array.isArray(seeded) ? seeded : []).filter((m) => typeof m === "string" && m.trim() !== ""));
3807
+ const raw = this.seed() ?? [];
3808
+ const seeded = (Array.isArray(raw) ? raw : []).filter((m) => typeof m === "string" && m.trim() !== "");
3809
+ const key = seeded.join("\0");
3810
+ if (this.cache === null || key !== this.seedKey) {
3811
+ this.seedKey = key;
3812
+ this.cache = /* @__PURE__ */ new Set([...seeded, ...this.learned]);
3806
3813
  }
3807
3814
  return this.cache;
3808
3815
  }
@@ -4257,6 +4264,26 @@ var ModelCatalog = class ModelCatalog {
4257
4264
  hasAccountCatalog(accountId) {
4258
4265
  return this.accountCatalogs.has(accountId);
4259
4266
  }
4267
+ /**
4268
+ * Effort ids the LIVE DISCOVERED catalog advertises for one model (across the
4269
+ * base catalog and every per-account catalog). Fallback entries are excluded:
4270
+ * they are a static mirror, not proof about the installed agy build.
4271
+ *
4272
+ * Used to reject false "--effort is not supported" refusals: agy's print-mode
4273
+ * validation emits that text when its model-config fetch fails, even though
4274
+ * `agy models` lists the level (issue #115).
4275
+ */
4276
+ advertisedEfforts(modelId) {
4277
+ const out = /* @__PURE__ */ new Set();
4278
+ for (const cat of [this.current, ...this.accountCatalogs.values()]) {
4279
+ if (cat.source !== "discovered") continue;
4280
+ for (const m of cat.models) {
4281
+ if (m.id !== modelId || !Array.isArray(m.efforts)) continue;
4282
+ for (const e of m.efforts) if (typeof e === "string" && e !== "") out.add(e);
4283
+ }
4284
+ }
4285
+ return [...out];
4286
+ }
4260
4287
  /** Refresh if stale; never throws — failures keep the previous catalog. */
4261
4288
  async refreshIfNeeded(accountId) {
4262
4289
  if (this.refreshing) return this.refreshing;
@@ -4541,7 +4568,7 @@ async function* streamWithEffortRetry(deps, options) {
4541
4568
  const rawMsg = String(failure?.message ?? "");
4542
4569
  const refused = parseEffortUnsupported(rawMsg);
4543
4570
  if (refused !== null) {
4544
- deps.learnEffortUnsupported(refused);
4571
+ if (deps.catalogAdvertisesEffort?.(refused) !== true) deps.learnEffortUnsupported(refused);
4545
4572
  continue;
4546
4573
  }
4547
4574
  const unrecog = parseModelNotRecognized(rawMsg);
@@ -34030,6 +34057,7 @@ var AgyAdapter = class extends LlmAdapter {
34030
34057
  yield* streamWithEffortRetry({
34031
34058
  streamAttempt: (opts, suppressEffort) => this.streamAttempt(opts, suppressEffort),
34032
34059
  learnEffortUnsupported: (model) => this.learnEffortUnsupported(model),
34060
+ catalogAdvertisesEffort: (model) => this.deps.catalog.advertisedEfforts(model).length > 0,
34033
34061
  onModelUnsupported: (unrecog) => {
34034
34062
  const fam = modelFamilyOf(unrecog);
34035
34063
  const pool = this.deps.pool;
package/dist/index.js CHANGED
@@ -971,6 +971,26 @@ var ModelCatalog = class ModelCatalog {
971
971
  hasAccountCatalog(accountId) {
972
972
  return this.accountCatalogs.has(accountId);
973
973
  }
974
+ /**
975
+ * Effort ids the LIVE DISCOVERED catalog advertises for one model (across the
976
+ * base catalog and every per-account catalog). Fallback entries are excluded:
977
+ * they are a static mirror, not proof about the installed agy build.
978
+ *
979
+ * Used to reject false "--effort is not supported" refusals: agy's print-mode
980
+ * validation emits that text when its model-config fetch fails, even though
981
+ * `agy models` lists the level (issue #115).
982
+ */
983
+ advertisedEfforts(modelId) {
984
+ const out = /* @__PURE__ */ new Set();
985
+ for (const cat of [this.current, ...this.accountCatalogs.values()]) {
986
+ if (cat.source !== "discovered") continue;
987
+ for (const m of cat.models) {
988
+ if (m.id !== modelId || !Array.isArray(m.efforts)) continue;
989
+ for (const e of m.efforts) if (typeof e === "string" && e !== "") out.add(e);
990
+ }
991
+ }
992
+ return [...out];
993
+ }
974
994
  /** Refresh if stale; never throws — failures keep the previous catalog. */
975
995
  async refreshIfNeeded(accountId) {
976
996
  if (this.refreshing) return this.refreshing;
@@ -5598,6 +5618,9 @@ var EffortPolicy = class {
5598
5618
  log;
5599
5619
  onLearned;
5600
5620
  cache = null;
5621
+ seedKey = "";
5622
+ /** Models learned in THIS process: survive an external edit of the seed. */
5623
+ learned = /* @__PURE__ */ new Set();
5601
5624
  constructor(seed, log, onLearned) {
5602
5625
  this.seed = seed;
5603
5626
  this.log = log;
@@ -5619,15 +5642,19 @@ var EffortPolicy = class {
5619
5642
  const set = this.models();
5620
5643
  if (this.isUnsupported(model)) return;
5621
5644
  set.add(model);
5645
+ this.learned.add(model);
5622
5646
  this.log?.("agy refused --effort for model \"" + model + "\" — it is now run without an effort flag (effort support is advisory in the catalog; see issue #67)");
5623
5647
  try {
5624
5648
  this.onLearned?.(model);
5625
5649
  } catch {}
5626
5650
  }
5627
5651
  models() {
5628
- if (this.cache === null) {
5629
- const seeded = this.seed() ?? [];
5630
- this.cache = new Set((Array.isArray(seeded) ? seeded : []).filter((m) => typeof m === "string" && m.trim() !== ""));
5652
+ const raw = this.seed() ?? [];
5653
+ const seeded = (Array.isArray(raw) ? raw : []).filter((m) => typeof m === "string" && m.trim() !== "");
5654
+ const key = seeded.join("\0");
5655
+ if (this.cache === null || key !== this.seedKey) {
5656
+ this.seedKey = key;
5657
+ this.cache = /* @__PURE__ */ new Set([...seeded, ...this.learned]);
5631
5658
  }
5632
5659
  return this.cache;
5633
5660
  }
@@ -5871,7 +5898,7 @@ async function* streamWithEffortRetry(deps, options) {
5871
5898
  const rawMsg = String(failure?.message ?? "");
5872
5899
  const refused = parseEffortUnsupported(rawMsg);
5873
5900
  if (refused !== null) {
5874
- deps.learnEffortUnsupported(refused);
5901
+ if (deps.catalogAdvertisesEffort?.(refused) !== true) deps.learnEffortUnsupported(refused);
5875
5902
  continue;
5876
5903
  }
5877
5904
  const unrecog = parseModelNotRecognized(rawMsg);
@@ -34544,6 +34571,7 @@ var AgyAdapter = class extends LlmAdapter {
34544
34571
  yield* streamWithEffortRetry({
34545
34572
  streamAttempt: (opts, suppressEffort) => this.streamAttempt(opts, suppressEffort),
34546
34573
  learnEffortUnsupported: (model) => this.learnEffortUnsupported(model),
34574
+ catalogAdvertisesEffort: (model) => this.deps.catalog.advertisedEfforts(model).length > 0,
34547
34575
  onModelUnsupported: (unrecog) => {
34548
34576
  const fam = modelFamilyOf(unrecog);
34549
34577
  const pool = this.deps.pool;
@@ -39644,24 +39672,21 @@ function createHostServices(ctx, entryConfig = {}) {
39644
39672
  telemetryFlags: true
39645
39673
  });
39646
39674
  const effortUnsupportedPath = () => join(stateDir(), "effort-unsupported.json");
39647
- let effortUnsupportedCache = null;
39648
39675
  const readEffortUnsupported = () => {
39649
- if (effortUnsupportedCache !== null) return effortUnsupportedCache;
39650
39676
  try {
39651
39677
  const raw = existsSync(effortUnsupportedPath()) ? JSON.parse(readFileSync(effortUnsupportedPath(), "utf8")) : [];
39652
- effortUnsupportedCache = Array.isArray(raw) ? raw.filter((m) => typeof m === "string" && m.trim() !== "") : [];
39678
+ return Array.isArray(raw) ? raw.filter((m) => typeof m === "string" && m.trim() !== "") : [];
39653
39679
  } catch {
39654
- effortUnsupportedCache = [];
39680
+ return [];
39655
39681
  }
39656
- return effortUnsupportedCache;
39657
39682
  };
39658
39683
  const rememberEffortUnsupported = (model) => {
39659
39684
  const known = readEffortUnsupported();
39660
39685
  if (known.some((m) => m.trim().toLowerCase() === model.trim().toLowerCase())) return;
39661
- effortUnsupportedCache = [...known, model];
39686
+ const next = [...known, model];
39662
39687
  try {
39663
39688
  mkdirSync(stateDir(), { recursive: true });
39664
- writeFileSync(effortUnsupportedPath(), JSON.stringify(effortUnsupportedCache, null, 2), "utf8");
39689
+ writeFileSync(effortUnsupportedPath(), JSON.stringify(next, null, 2), "utf8");
39665
39690
  } catch (e) {
39666
39691
  log("failed to persist the effort-unsupported list: " + String(e));
39667
39692
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.6.28",
3
+ "version": "0.6.29",
4
4
  "description": "Google Antigravity (agy CLI) models for DeepSeek Harness — stream Gemini/Claude/GPT-OSS subscriptions into DSH with thinking, tool activity, token usage and in-GUI Google OAuth login.",
5
5
  "type": "module",
6
6
  "license": "MIT",