dsh-agy-link 0.6.29 → 0.6.31
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 +20 -0
- package/dist/cli-image.mjs +5 -3
- package/dist/index.js +43 -28
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.31 (2026-11-16)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Refactor(host): extract the effort-unsupported persistence into its own store (5-day review).** `createEffortUnsupportedStore()` now owns the file path, the filter/dedupe rules, the picker notification and the live-reload invariant; the composition factory only wires it in. `src/host/services.ts` drops from 599 to 576 lines, giving the three modules that sat on the 600-line ceiling real headroom again. **No behaviour change** — the existing `HostServices` surface and `test/services.test.ts` contract are unchanged, and the new module has its own filesystem-level tests (filtering, invalid/missing file, live reload, dedupe, persistence failure). Architecture/budget gates stay at 215 modules, 0 cycles, 0 violations.
|
|
8
|
+
|
|
9
|
+
### 中文
|
|
10
|
+
|
|
11
|
+
- **重构(host):把 effort-unsupported 持久化拆成独立 store(5 天全面 review)。** `createEffortUnsupportedStore()` 统一持有文件路径、过滤/去重规则、picker 广播与即时重载不变式;组合工厂只负责装配。`src/host/services.ts` 从 599 行降到 576 行,让三处贴在 600 行上限的模块重新有了余量。**行为零变化**:`HostServices` 对外形状与 `test/services.test.ts` 契约保持不变,新模块自带文件系统级测试(过滤、缺失/非法文件、外部修改即时生效、去重、写盘失败)。架构/预算门禁仍为 215 模块、0 环、0 违规。
|
|
12
|
+
|
|
13
|
+
## 0.6.30 (2026-11-16)
|
|
14
|
+
|
|
15
|
+
### English
|
|
16
|
+
|
|
17
|
+
- **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.
|
|
18
|
+
|
|
19
|
+
### 中文
|
|
20
|
+
|
|
21
|
+
- **修复(解析器):为 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 提供堆栈、合成复现与补丁。
|
|
22
|
+
|
|
3
23
|
## 0.6.29 (2026-11-15)
|
|
4
24
|
|
|
5
25
|
### 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) {
|
package/dist/index.js
CHANGED
|
@@ -4855,12 +4855,14 @@ function isSafeConversationId(id) {
|
|
|
4855
4855
|
//#endregion
|
|
4856
4856
|
//#region src/runtime/agy/db/extract.ts
|
|
4857
4857
|
function readVarint(b, offset) {
|
|
4858
|
+
if (!Number.isInteger(offset) || offset < 0 || offset >= b.length) return null;
|
|
4858
4859
|
let val = 0;
|
|
4859
4860
|
let shift = 0;
|
|
4860
4861
|
let pos = offset;
|
|
4861
4862
|
while (pos < b.length) {
|
|
4862
4863
|
const byte = b[pos++];
|
|
4863
|
-
val
|
|
4864
|
+
val += (byte & 127) * 2 ** shift;
|
|
4865
|
+
if (!Number.isSafeInteger(val)) return null;
|
|
4864
4866
|
shift += 7;
|
|
4865
4867
|
if ((byte & 128) === 0) return {
|
|
4866
4868
|
val,
|
|
@@ -4935,7 +4937,7 @@ function walkProtobuf(buf, depth, onField20Thought) {
|
|
|
4935
4937
|
if (lenRes === null) break;
|
|
4936
4938
|
pos = lenRes.next;
|
|
4937
4939
|
const len = lenRes.val;
|
|
4938
|
-
if (
|
|
4940
|
+
if (len < 0 || len > buf.length - pos) break;
|
|
4939
4941
|
const slice = buf.subarray(pos, pos + len);
|
|
4940
4942
|
pos += len;
|
|
4941
4943
|
if (fieldNum === 20) {
|
|
@@ -4952,7 +4954,7 @@ function walkProtobuf(buf, depth, onField20Thought) {
|
|
|
4952
4954
|
if (l20Res === null) break;
|
|
4953
4955
|
p20 = l20Res.next;
|
|
4954
4956
|
const l20 = l20Res.val;
|
|
4955
|
-
if (
|
|
4957
|
+
if (l20 < 0 || l20 > slice.length - p20) break;
|
|
4956
4958
|
const s20 = slice.subarray(p20, p20 + l20);
|
|
4957
4959
|
p20 += l20;
|
|
4958
4960
|
if (f20 === 3) {
|
|
@@ -39114,6 +39116,35 @@ var QuotaService = class {
|
|
|
39114
39116
|
}
|
|
39115
39117
|
};
|
|
39116
39118
|
//#endregion
|
|
39119
|
+
//#region src/host/effort-unsupported-store.ts
|
|
39120
|
+
function createEffortUnsupportedStore(deps) {
|
|
39121
|
+
const path = () => join(deps.stateDir(), "effort-unsupported.json");
|
|
39122
|
+
const read = () => {
|
|
39123
|
+
try {
|
|
39124
|
+
const raw = existsSync(path()) ? JSON.parse(readFileSync(path(), "utf8")) : [];
|
|
39125
|
+
return Array.isArray(raw) ? raw.filter((m) => typeof m === "string" && m.trim() !== "") : [];
|
|
39126
|
+
} catch {
|
|
39127
|
+
return [];
|
|
39128
|
+
}
|
|
39129
|
+
};
|
|
39130
|
+
const remember = (model) => {
|
|
39131
|
+
const known = read();
|
|
39132
|
+
if (known.some((m) => m.trim().toLowerCase() === model.trim().toLowerCase())) return;
|
|
39133
|
+
const next = [...known, model];
|
|
39134
|
+
try {
|
|
39135
|
+
mkdirSync(deps.stateDir(), { recursive: true });
|
|
39136
|
+
writeFileSync(path(), JSON.stringify(next, null, 2), "utf8");
|
|
39137
|
+
} catch (e) {
|
|
39138
|
+
deps.log?.("failed to persist the effort-unsupported list: " + String(e));
|
|
39139
|
+
}
|
|
39140
|
+
deps.notifyPicker();
|
|
39141
|
+
};
|
|
39142
|
+
return {
|
|
39143
|
+
read,
|
|
39144
|
+
remember
|
|
39145
|
+
};
|
|
39146
|
+
}
|
|
39147
|
+
//#endregion
|
|
39117
39148
|
//#region src/features/warmup/policy.ts
|
|
39118
39149
|
/** Canonical model route resolution for upstream Google Cloud Code PA endpoints. */
|
|
39119
39150
|
function toCanonicalWarmupModel(model) {
|
|
@@ -39671,27 +39702,11 @@ function createHostServices(ctx, entryConfig = {}) {
|
|
|
39671
39702
|
cfg: getConfig(),
|
|
39672
39703
|
telemetryFlags: true
|
|
39673
39704
|
});
|
|
39674
|
-
const
|
|
39675
|
-
|
|
39676
|
-
|
|
39677
|
-
|
|
39678
|
-
|
|
39679
|
-
} catch {
|
|
39680
|
-
return [];
|
|
39681
|
-
}
|
|
39682
|
-
};
|
|
39683
|
-
const rememberEffortUnsupported = (model) => {
|
|
39684
|
-
const known = readEffortUnsupported();
|
|
39685
|
-
if (known.some((m) => m.trim().toLowerCase() === model.trim().toLowerCase())) return;
|
|
39686
|
-
const next = [...known, model];
|
|
39687
|
-
try {
|
|
39688
|
-
mkdirSync(stateDir(), { recursive: true });
|
|
39689
|
-
writeFileSync(effortUnsupportedPath(), JSON.stringify(next, null, 2), "utf8");
|
|
39690
|
-
} catch (e) {
|
|
39691
|
-
log("failed to persist the effort-unsupported list: " + String(e));
|
|
39692
|
-
}
|
|
39693
|
-
notifyPicker();
|
|
39694
|
-
};
|
|
39705
|
+
const effortStore = createEffortUnsupportedStore({
|
|
39706
|
+
stateDir,
|
|
39707
|
+
notifyPicker,
|
|
39708
|
+
log
|
|
39709
|
+
});
|
|
39695
39710
|
/** The DSH session's own workspace (agy runs there, per the translation spec). */
|
|
39696
39711
|
const sessionWorkspace = (sessionId) => {
|
|
39697
39712
|
return ctx.get("sessions")?.get(sessionId)?.header?.cwd;
|
|
@@ -39780,8 +39795,8 @@ function createHostServices(ctx, entryConfig = {}) {
|
|
|
39780
39795
|
log,
|
|
39781
39796
|
runs,
|
|
39782
39797
|
getMediaBaseUrl: () => webServerPort.current ? `http://127.0.0.1:${webServerPort.current}/plugins/agy-link/media` : null,
|
|
39783
|
-
effortUnsupported: () =>
|
|
39784
|
-
onEffortUnsupported: (model) =>
|
|
39798
|
+
effortUnsupported: () => effortStore.read(),
|
|
39799
|
+
onEffortUnsupported: (model) => effortStore.remember(model),
|
|
39785
39800
|
sessionCwd: (sessionId) => sessionWorkspace(sessionId),
|
|
39786
39801
|
sessionGoal: (sessionId) => {
|
|
39787
39802
|
try {
|
|
@@ -40023,8 +40038,8 @@ function createHostServices(ctx, entryConfig = {}) {
|
|
|
40023
40038
|
adapter,
|
|
40024
40039
|
translation,
|
|
40025
40040
|
setOverride,
|
|
40026
|
-
readEffortUnsupported,
|
|
40027
|
-
rememberEffortUnsupported,
|
|
40041
|
+
readEffortUnsupported: effortStore.read,
|
|
40042
|
+
rememberEffortUnsupported: effortStore.remember,
|
|
40028
40043
|
sessionsSvc,
|
|
40029
40044
|
sessionAuto,
|
|
40030
40045
|
get lastRun() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.31",
|
|
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",
|