dsh-agy-link 0.6.28 → 0.6.30
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 +24 -0
- package/dist/cli-image.mjs +37 -7
- package/dist/index.js +41 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.30 (2026-11-16)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix(parser): bounded protobuf varint lengths — no more main-thread hangs (fixes #116, merges PR #117).** `readVarint()` accumulated with `val |= (byte & 0x7f) << shift`, which coerces to signed 32-bit: `2 ** 31` decoded as `-2147483648`, and six-byte lengths wrapped the shift modulo 32 (`2 ** 35 + 1` → `9`). Both length-delimited walkers only checked the upper bound, so a negative/oversized length moved the cursor backwards (observed `pos = -2064995381` on a 336-byte buffer) and the synchronous parse wedged DSH's web listener. Lengths now accumulate numerically with a safe-integer check, offsets are validated, and both outer and field-20 walkers reject any length that exceeds the remaining bytes. Four subprocess-bounded regressions cover nested overflow, six-byte wraparound, valid sibling thoughts after malformed nesting, and truncated input — the dangerous cases run in a killable child so the suite itself cannot hang. Thanks to @MorseWayne for the stack trace, synthetic reproduction and patch.
|
|
8
|
+
|
|
9
|
+
### 中文
|
|
10
|
+
|
|
11
|
+
- **修复(解析器):为 protobuf 长度 varint 加边界,避免主线程卡死(修复 #116,合并 PR #117)。** `readVarint()` 原先用 `val |= (byte & 0x7f) << shift` 累积,JS 位运算会截断成有符号 32 位:`2 ** 31` 被解成 `-2147483648`,六字节长度的 shift 还会按 32 回绕(`2 ** 35 + 1` → `9`)。两层 length-delimited walker 只检查长度上界,负长度会让游标大幅回退(现场 336 字节 buffer 上 `pos = -2064995381`),同步解析直接把 DSH web 监听器卡住。现在改为数值累积 + 安全整数校验、校验读取偏移,outer 与 field-20 两层均拒绝超过剩余字节数的长度。四条子进程有界回归覆盖多层嵌套溢出、六字节回绕、异常嵌套后仍能取到后续有效思考内容、截断输入;危险输入放在可被 kill 的子进程里,避免测试自身阻塞。感谢 @MorseWayne 提供堆栈、合成复现与补丁。
|
|
12
|
+
|
|
13
|
+
## 0.6.29 (2026-11-15)
|
|
14
|
+
|
|
15
|
+
### English
|
|
16
|
+
|
|
17
|
+
- **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.
|
|
18
|
+
- **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.
|
|
19
|
+
- 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.
|
|
20
|
+
|
|
21
|
+
### 中文
|
|
22
|
+
|
|
23
|
+
- **修复(模型):瞬时拒绝不再把模型的思考档位永久拉黑(修复 #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 阵容是静态镜像,不作为证据。
|
|
24
|
+
- **修复(模型):`effort-unsupported.json` 现在即时生效。** 宿主不再对文件做进程级缓存,`EffortPolicy` 在 seed 变化时重建(保留本进程学到的条目),运维清空误学条目后无需重启 DSH。
|
|
25
|
+
- 测试:真实已发现目录回归(矛盾拒绝不学习、档位行保留)、外部修改即时可见、文件重读。感谢 @AlaIchhe 提供时间线、transcript 证据与最小复现。
|
|
26
|
+
|
|
3
27
|
## 0.6.28 (2026-11-15)
|
|
4
28
|
|
|
5
29
|
### English
|
package/dist/cli-image.mjs
CHANGED
|
@@ -3010,12 +3010,14 @@ function isSafeConversationId(id) {
|
|
|
3010
3010
|
//#endregion
|
|
3011
3011
|
//#region src/runtime/agy/db/extract.ts
|
|
3012
3012
|
function readVarint(b, offset) {
|
|
3013
|
+
if (!Number.isInteger(offset) || offset < 0 || offset >= b.length) return null;
|
|
3013
3014
|
let val = 0;
|
|
3014
3015
|
let shift = 0;
|
|
3015
3016
|
let pos = offset;
|
|
3016
3017
|
while (pos < b.length) {
|
|
3017
3018
|
const byte = b[pos++];
|
|
3018
|
-
val
|
|
3019
|
+
val += (byte & 127) * 2 ** shift;
|
|
3020
|
+
if (!Number.isSafeInteger(val)) return null;
|
|
3019
3021
|
shift += 7;
|
|
3020
3022
|
if ((byte & 128) === 0) return {
|
|
3021
3023
|
val,
|
|
@@ -3090,7 +3092,7 @@ function walkProtobuf(buf, depth, onField20Thought) {
|
|
|
3090
3092
|
if (lenRes === null) break;
|
|
3091
3093
|
pos = lenRes.next;
|
|
3092
3094
|
const len = lenRes.val;
|
|
3093
|
-
if (
|
|
3095
|
+
if (len < 0 || len > buf.length - pos) break;
|
|
3094
3096
|
const slice = buf.subarray(pos, pos + len);
|
|
3095
3097
|
pos += len;
|
|
3096
3098
|
if (fieldNum === 20) {
|
|
@@ -3107,7 +3109,7 @@ function walkProtobuf(buf, depth, onField20Thought) {
|
|
|
3107
3109
|
if (l20Res === null) break;
|
|
3108
3110
|
p20 = l20Res.next;
|
|
3109
3111
|
const l20 = l20Res.val;
|
|
3110
|
-
if (
|
|
3112
|
+
if (l20 < 0 || l20 > slice.length - p20) break;
|
|
3111
3113
|
const s20 = slice.subarray(p20, p20 + l20);
|
|
3112
3114
|
p20 += l20;
|
|
3113
3115
|
if (f20 === 3) {
|
|
@@ -3773,6 +3775,9 @@ var EffortPolicy = class {
|
|
|
3773
3775
|
log;
|
|
3774
3776
|
onLearned;
|
|
3775
3777
|
cache = null;
|
|
3778
|
+
seedKey = "";
|
|
3779
|
+
/** Models learned in THIS process: survive an external edit of the seed. */
|
|
3780
|
+
learned = /* @__PURE__ */ new Set();
|
|
3776
3781
|
constructor(seed, log, onLearned) {
|
|
3777
3782
|
this.seed = seed;
|
|
3778
3783
|
this.log = log;
|
|
@@ -3794,15 +3799,19 @@ var EffortPolicy = class {
|
|
|
3794
3799
|
const set = this.models();
|
|
3795
3800
|
if (this.isUnsupported(model)) return;
|
|
3796
3801
|
set.add(model);
|
|
3802
|
+
this.learned.add(model);
|
|
3797
3803
|
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
3804
|
try {
|
|
3799
3805
|
this.onLearned?.(model);
|
|
3800
3806
|
} catch {}
|
|
3801
3807
|
}
|
|
3802
3808
|
models() {
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3809
|
+
const raw = this.seed() ?? [];
|
|
3810
|
+
const seeded = (Array.isArray(raw) ? raw : []).filter((m) => typeof m === "string" && m.trim() !== "");
|
|
3811
|
+
const key = seeded.join("\0");
|
|
3812
|
+
if (this.cache === null || key !== this.seedKey) {
|
|
3813
|
+
this.seedKey = key;
|
|
3814
|
+
this.cache = /* @__PURE__ */ new Set([...seeded, ...this.learned]);
|
|
3806
3815
|
}
|
|
3807
3816
|
return this.cache;
|
|
3808
3817
|
}
|
|
@@ -4257,6 +4266,26 @@ var ModelCatalog = class ModelCatalog {
|
|
|
4257
4266
|
hasAccountCatalog(accountId) {
|
|
4258
4267
|
return this.accountCatalogs.has(accountId);
|
|
4259
4268
|
}
|
|
4269
|
+
/**
|
|
4270
|
+
* Effort ids the LIVE DISCOVERED catalog advertises for one model (across the
|
|
4271
|
+
* base catalog and every per-account catalog). Fallback entries are excluded:
|
|
4272
|
+
* they are a static mirror, not proof about the installed agy build.
|
|
4273
|
+
*
|
|
4274
|
+
* Used to reject false "--effort is not supported" refusals: agy's print-mode
|
|
4275
|
+
* validation emits that text when its model-config fetch fails, even though
|
|
4276
|
+
* `agy models` lists the level (issue #115).
|
|
4277
|
+
*/
|
|
4278
|
+
advertisedEfforts(modelId) {
|
|
4279
|
+
const out = /* @__PURE__ */ new Set();
|
|
4280
|
+
for (const cat of [this.current, ...this.accountCatalogs.values()]) {
|
|
4281
|
+
if (cat.source !== "discovered") continue;
|
|
4282
|
+
for (const m of cat.models) {
|
|
4283
|
+
if (m.id !== modelId || !Array.isArray(m.efforts)) continue;
|
|
4284
|
+
for (const e of m.efforts) if (typeof e === "string" && e !== "") out.add(e);
|
|
4285
|
+
}
|
|
4286
|
+
}
|
|
4287
|
+
return [...out];
|
|
4288
|
+
}
|
|
4260
4289
|
/** Refresh if stale; never throws — failures keep the previous catalog. */
|
|
4261
4290
|
async refreshIfNeeded(accountId) {
|
|
4262
4291
|
if (this.refreshing) return this.refreshing;
|
|
@@ -4541,7 +4570,7 @@ async function* streamWithEffortRetry(deps, options) {
|
|
|
4541
4570
|
const rawMsg = String(failure?.message ?? "");
|
|
4542
4571
|
const refused = parseEffortUnsupported(rawMsg);
|
|
4543
4572
|
if (refused !== null) {
|
|
4544
|
-
deps.learnEffortUnsupported(refused);
|
|
4573
|
+
if (deps.catalogAdvertisesEffort?.(refused) !== true) deps.learnEffortUnsupported(refused);
|
|
4545
4574
|
continue;
|
|
4546
4575
|
}
|
|
4547
4576
|
const unrecog = parseModelNotRecognized(rawMsg);
|
|
@@ -34030,6 +34059,7 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
34030
34059
|
yield* streamWithEffortRetry({
|
|
34031
34060
|
streamAttempt: (opts, suppressEffort) => this.streamAttempt(opts, suppressEffort),
|
|
34032
34061
|
learnEffortUnsupported: (model) => this.learnEffortUnsupported(model),
|
|
34062
|
+
catalogAdvertisesEffort: (model) => this.deps.catalog.advertisedEfforts(model).length > 0,
|
|
34033
34063
|
onModelUnsupported: (unrecog) => {
|
|
34034
34064
|
const fam = modelFamilyOf(unrecog);
|
|
34035
34065
|
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;
|
|
@@ -4835,12 +4855,14 @@ function isSafeConversationId(id) {
|
|
|
4835
4855
|
//#endregion
|
|
4836
4856
|
//#region src/runtime/agy/db/extract.ts
|
|
4837
4857
|
function readVarint(b, offset) {
|
|
4858
|
+
if (!Number.isInteger(offset) || offset < 0 || offset >= b.length) return null;
|
|
4838
4859
|
let val = 0;
|
|
4839
4860
|
let shift = 0;
|
|
4840
4861
|
let pos = offset;
|
|
4841
4862
|
while (pos < b.length) {
|
|
4842
4863
|
const byte = b[pos++];
|
|
4843
|
-
val
|
|
4864
|
+
val += (byte & 127) * 2 ** shift;
|
|
4865
|
+
if (!Number.isSafeInteger(val)) return null;
|
|
4844
4866
|
shift += 7;
|
|
4845
4867
|
if ((byte & 128) === 0) return {
|
|
4846
4868
|
val,
|
|
@@ -4915,7 +4937,7 @@ function walkProtobuf(buf, depth, onField20Thought) {
|
|
|
4915
4937
|
if (lenRes === null) break;
|
|
4916
4938
|
pos = lenRes.next;
|
|
4917
4939
|
const len = lenRes.val;
|
|
4918
|
-
if (
|
|
4940
|
+
if (len < 0 || len > buf.length - pos) break;
|
|
4919
4941
|
const slice = buf.subarray(pos, pos + len);
|
|
4920
4942
|
pos += len;
|
|
4921
4943
|
if (fieldNum === 20) {
|
|
@@ -4932,7 +4954,7 @@ function walkProtobuf(buf, depth, onField20Thought) {
|
|
|
4932
4954
|
if (l20Res === null) break;
|
|
4933
4955
|
p20 = l20Res.next;
|
|
4934
4956
|
const l20 = l20Res.val;
|
|
4935
|
-
if (
|
|
4957
|
+
if (l20 < 0 || l20 > slice.length - p20) break;
|
|
4936
4958
|
const s20 = slice.subarray(p20, p20 + l20);
|
|
4937
4959
|
p20 += l20;
|
|
4938
4960
|
if (f20 === 3) {
|
|
@@ -5598,6 +5620,9 @@ var EffortPolicy = class {
|
|
|
5598
5620
|
log;
|
|
5599
5621
|
onLearned;
|
|
5600
5622
|
cache = null;
|
|
5623
|
+
seedKey = "";
|
|
5624
|
+
/** Models learned in THIS process: survive an external edit of the seed. */
|
|
5625
|
+
learned = /* @__PURE__ */ new Set();
|
|
5601
5626
|
constructor(seed, log, onLearned) {
|
|
5602
5627
|
this.seed = seed;
|
|
5603
5628
|
this.log = log;
|
|
@@ -5619,15 +5644,19 @@ var EffortPolicy = class {
|
|
|
5619
5644
|
const set = this.models();
|
|
5620
5645
|
if (this.isUnsupported(model)) return;
|
|
5621
5646
|
set.add(model);
|
|
5647
|
+
this.learned.add(model);
|
|
5622
5648
|
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
5649
|
try {
|
|
5624
5650
|
this.onLearned?.(model);
|
|
5625
5651
|
} catch {}
|
|
5626
5652
|
}
|
|
5627
5653
|
models() {
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5654
|
+
const raw = this.seed() ?? [];
|
|
5655
|
+
const seeded = (Array.isArray(raw) ? raw : []).filter((m) => typeof m === "string" && m.trim() !== "");
|
|
5656
|
+
const key = seeded.join("\0");
|
|
5657
|
+
if (this.cache === null || key !== this.seedKey) {
|
|
5658
|
+
this.seedKey = key;
|
|
5659
|
+
this.cache = /* @__PURE__ */ new Set([...seeded, ...this.learned]);
|
|
5631
5660
|
}
|
|
5632
5661
|
return this.cache;
|
|
5633
5662
|
}
|
|
@@ -5871,7 +5900,7 @@ async function* streamWithEffortRetry(deps, options) {
|
|
|
5871
5900
|
const rawMsg = String(failure?.message ?? "");
|
|
5872
5901
|
const refused = parseEffortUnsupported(rawMsg);
|
|
5873
5902
|
if (refused !== null) {
|
|
5874
|
-
deps.learnEffortUnsupported(refused);
|
|
5903
|
+
if (deps.catalogAdvertisesEffort?.(refused) !== true) deps.learnEffortUnsupported(refused);
|
|
5875
5904
|
continue;
|
|
5876
5905
|
}
|
|
5877
5906
|
const unrecog = parseModelNotRecognized(rawMsg);
|
|
@@ -34544,6 +34573,7 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
34544
34573
|
yield* streamWithEffortRetry({
|
|
34545
34574
|
streamAttempt: (opts, suppressEffort) => this.streamAttempt(opts, suppressEffort),
|
|
34546
34575
|
learnEffortUnsupported: (model) => this.learnEffortUnsupported(model),
|
|
34576
|
+
catalogAdvertisesEffort: (model) => this.deps.catalog.advertisedEfforts(model).length > 0,
|
|
34547
34577
|
onModelUnsupported: (unrecog) => {
|
|
34548
34578
|
const fam = modelFamilyOf(unrecog);
|
|
34549
34579
|
const pool = this.deps.pool;
|
|
@@ -39644,24 +39674,21 @@ function createHostServices(ctx, entryConfig = {}) {
|
|
|
39644
39674
|
telemetryFlags: true
|
|
39645
39675
|
});
|
|
39646
39676
|
const effortUnsupportedPath = () => join(stateDir(), "effort-unsupported.json");
|
|
39647
|
-
let effortUnsupportedCache = null;
|
|
39648
39677
|
const readEffortUnsupported = () => {
|
|
39649
|
-
if (effortUnsupportedCache !== null) return effortUnsupportedCache;
|
|
39650
39678
|
try {
|
|
39651
39679
|
const raw = existsSync(effortUnsupportedPath()) ? JSON.parse(readFileSync(effortUnsupportedPath(), "utf8")) : [];
|
|
39652
|
-
|
|
39680
|
+
return Array.isArray(raw) ? raw.filter((m) => typeof m === "string" && m.trim() !== "") : [];
|
|
39653
39681
|
} catch {
|
|
39654
|
-
|
|
39682
|
+
return [];
|
|
39655
39683
|
}
|
|
39656
|
-
return effortUnsupportedCache;
|
|
39657
39684
|
};
|
|
39658
39685
|
const rememberEffortUnsupported = (model) => {
|
|
39659
39686
|
const known = readEffortUnsupported();
|
|
39660
39687
|
if (known.some((m) => m.trim().toLowerCase() === model.trim().toLowerCase())) return;
|
|
39661
|
-
|
|
39688
|
+
const next = [...known, model];
|
|
39662
39689
|
try {
|
|
39663
39690
|
mkdirSync(stateDir(), { recursive: true });
|
|
39664
|
-
writeFileSync(effortUnsupportedPath(), JSON.stringify(
|
|
39691
|
+
writeFileSync(effortUnsupportedPath(), JSON.stringify(next, null, 2), "utf8");
|
|
39665
39692
|
} catch (e) {
|
|
39666
39693
|
log("failed to persist the effort-unsupported list: " + String(e));
|
|
39667
39694
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.30",
|
|
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",
|