@magpie-community/opencode-zen-free-auth 0.1.11 → 0.1.13
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/package.json +1 -1
- package/tool-response.mjs +10 -0
package/package.json
CHANGED
package/tool-response.mjs
CHANGED
|
@@ -250,6 +250,8 @@ function appendFunction(target, fragment) {
|
|
|
250
250
|
if (!object(fragment)) throw new GuardError("Invalid upstream function delta");
|
|
251
251
|
for (const [key, value] of Object.entries(fragment)) {
|
|
252
252
|
if (key === "name" || key === "arguments") {
|
|
253
|
+
// Nullable stream fields carry no new bytes; keep prior fragments intact.
|
|
254
|
+
if (value == null) continue;
|
|
253
255
|
if (typeof value !== "string") throw new GuardError("Invalid upstream function delta");
|
|
254
256
|
target[key] = (target[key] ?? "") + value;
|
|
255
257
|
} else {
|
|
@@ -343,6 +345,14 @@ function chatBuffer(checkName) {
|
|
|
343
345
|
const index = position(fragment.index);
|
|
344
346
|
const previous = state.calls.get(index) ?? { index, function: {} };
|
|
345
347
|
const value = { ...previous, ...fragment, index, function: previous.function };
|
|
348
|
+
// 空 ID 片段不应抹掉已缓存的有效 ID,同时允许首次 ID 后续到达。
|
|
349
|
+
if (
|
|
350
|
+
typeof previous.id === "string" &&
|
|
351
|
+
previous.id.length > 0 &&
|
|
352
|
+
(fragment.id == null || fragment.id === "")
|
|
353
|
+
) {
|
|
354
|
+
value.id = previous.id;
|
|
355
|
+
}
|
|
346
356
|
if (fragment.function != null) appendFunction(value.function, fragment.function);
|
|
347
357
|
state.calls.set(index, value);
|
|
348
358
|
}
|