@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.
- package/lib/index.js +5 -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.
|
|
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"] =
|
|
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