dsh-agy-link 0.4.92 → 0.4.93

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.4.93 (2026-10-29)
4
+
5
+ ### English
6
+
7
+ - **Fix(oneshot): don't split a UTF-8 character when truncating an inlined file.**
8
+ - `inlineFiles()` truncated a large text file with a raw byte slice (`buf.subarray(0, INLINE_MAX_BYTES)`), so if the 256 KiB boundary fell inside a multibyte character the prompt got a replacement char (`�`). Truncation now walks back to a UTF-8 code-point boundary (`truncateUtf8`). Adds a regression test that places a 3-byte char across the boundary.
9
+
10
+ ### 中文
11
+
12
+ - **修复(oneshot):截断内联大文件时不再把一个 UTF-8 字符切断。**
13
+ - `inlineFiles()` 之前用裸字节切片(`buf.subarray(0, INLINE_MAX_BYTES)`),若 256 KiB 边界落在多字节字符中间,prompt 里会出现替换符 `�`。现截断回退到 UTF-8 码点边界(`truncateUtf8`)。补充把一个 3 字节字符跨边界放置的回归测试。
14
+
15
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.4.92...v0.4.93
16
+
3
17
  ## 0.4.92 (2026-10-29)
4
18
 
5
19
  ### English
package/dist/index.js CHANGED
@@ -31843,6 +31843,22 @@ function detectContinuation(messages) {
31843
31843
  //#region src/host/oneshot.ts
31844
31844
  /** Per-file inline cap; larger files are truncated. */
31845
31845
  const INLINE_MAX_BYTES = 262144;
31846
+ /** Truncate a buffer to <= max bytes without splitting a UTF-8 code point. */
31847
+ function truncateUtf8(buf, max) {
31848
+ if (buf.length <= max) return buf;
31849
+ let end = max;
31850
+ let i = end - 1;
31851
+ let back = 0;
31852
+ while (i >= 0 && (buf[i] & 192) === 128 && back < 3) {
31853
+ i--;
31854
+ back++;
31855
+ }
31856
+ if (i >= 0) {
31857
+ const lead = buf[i];
31858
+ if (i + (lead >= 240 ? 4 : lead >= 224 ? 3 : lead >= 192 ? 2 : 1) > end) end = i;
31859
+ }
31860
+ return buf.subarray(0, end);
31861
+ }
31846
31862
  /** Text-detection: anything that is very likely not binary. */
31847
31863
  function looksTextual(head) {
31848
31864
  if (head === "") return true;
@@ -31871,7 +31887,7 @@ async function inlineFiles(prompt, paths, cwd) {
31871
31887
  if (!looksTextual(buf.subarray(0, Math.min(buf.length, 4096)).toString("utf8"))) note = "(skipped: binary file - reference it by path and let agy read it with its own tools)";
31872
31888
  else if (buf.byteLength > INLINE_MAX_BYTES) {
31873
31889
  note = "(truncated to the first 262144 bytes)";
31874
- body = buf.subarray(0, INLINE_MAX_BYTES).toString("utf8");
31890
+ body = truncateUtf8(buf, INLINE_MAX_BYTES).toString("utf8");
31875
31891
  } else body = buf.toString("utf8");
31876
31892
  } catch {
31877
31893
  note = "(skipped: unreadable - " + raw + ")";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.4.92",
3
+ "version": "0.4.93",
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",