@a9i5k4/dsh-literature 0.3.3 → 0.3.4

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.
Files changed (2) hide show
  1. package/lib/index.js +5 -2
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -757,7 +757,7 @@ var UA, FetchFailure;
757
757
  var init_net = __esm({
758
758
  "src/node/net.js"() {
759
759
  init_log();
760
- UA = "dsh-literature/0.3.3 (+https://github.com/deepseek-ai/deepseek-harness)";
760
+ UA = "dsh-literature/0.3.4 (+https://github.com/deepseek-ai/deepseek-harness)";
761
761
  FetchFailure = class extends Error {
762
762
  constructor(message, { code = "network", status = 0, retryable = true, cause } = {}) {
763
763
  super(message, { cause });
@@ -1672,12 +1672,15 @@ async function postJson(path, payload, options) {
1672
1672
  }
1673
1673
  return { status: res.status, body: text };
1674
1674
  }
1675
+ function asciiJson(value) {
1676
+ return JSON.stringify(value).replace(/[^\x00-\xFF]/g, (ch) => "\\u" + ch.charCodeAt(0).toString(16).padStart(4, "0"));
1677
+ }
1675
1678
  async function postBuffer(path, buffer, { metadata, contentType, timeoutMs }) {
1676
1679
  const headers = {
1677
1680
  "Content-Type": contentType,
1678
1681
  "Content-Length": String(buffer.length)
1679
1682
  };
1680
- if (metadata) headers["X-Metadata"] = JSON.stringify(metadata);
1683
+ if (metadata) headers["X-Metadata"] = asciiJson(metadata);
1681
1684
  const res = await request(path, { body: buffer, headers, timeoutMs });
1682
1685
  const text = await res.text().catch(() => "");
1683
1686
  if (res.status >= 400) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a9i5k4/dsh-literature",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "DSH Literature 文献侧窗:在 DeepSeek Harness 侧边栏识别 DOI/arXiv/标题、抓取元数据与全文、写入本地文献库或导出目录,并提供内置 PDF 阅读器(缩放/翻页/目录/搜索/高亮/笔记)。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",