Files
deepseek-harness/patches/@[email protected]
T
Tianyi Cui f1f18bce98 build(llm-pi-ai): upgrade @earendil-works/pi-ai to 1.0.0
Move the pi-ai provider adapter from 0.87.1 to 1.0.0 and re-create the
local tool-argument patch for the new dist files. pi-ai 1.0.0 still
re-parses the whole accumulated argument JSON on every stream delta in
the Anthropic, Bedrock, Mistral, OpenAI Completions, OpenAI Responses,
and pi-messages adapters (upstream earendil-works/pi#9265), so the patch
removes the same six per-delta parses; arguments are still parsed once at
toolcall_end.

The release-age exemption moves to the exact 1.0.0 pi-ai and
pi-telemetry versions, and the generated third-party notices and README
links name the new patch file.
2026-10-04 02:09:17 +08:00

74 lines
4.4 KiB
Diff

diff --git a/dist/api/anthropic-messages.js b/dist/api/anthropic-messages.js
index 106f2b9617fa3b810261e067a3c965f209907af3..d841d316172c82d5b1aebcfb2bde3e84b807ae0a 100644
--- a/dist/api/anthropic-messages.js
+++ b/dist/api/anthropic-messages.js
@@ -553,7 +553,6 @@ export const stream = (model, context, options) => {
const block = blocks[index];
if (block && block.type === "toolCall") {
block.partialJson += event.delta.partial_json;
- block.arguments = parseStreamingJson(block.partialJson);
stream.push({
type: "toolcall_delta",
contentIndex: index,
diff --git a/dist/api/bedrock-converse-stream.js b/dist/api/bedrock-converse-stream.js
index a7f6d9cbe66546d5d418450809e92cf7289ce4a3..6fc5438c9ace36d8cb0f6bf3d077ebfa8281dcf5 100644
--- a/dist/api/bedrock-converse-stream.js
+++ b/dist/api/bedrock-converse-stream.js
@@ -460,7 +460,6 @@ function handleContentBlockDelta(event, blocks, output, stream) {
}
else if (delta?.toolUse && block?.type === "toolCall") {
block.partialJson = (block.partialJson || "") + (delta.toolUse.input || "");
- block.arguments = parseStreamingJson(block.partialJson);
stream.push({ type: "toolcall_delta", contentIndex: index, delta: delta.toolUse.input || "", partial: output });
}
else if (delta?.reasoningContent) {
diff --git a/dist/api/mistral-conversations.js b/dist/api/mistral-conversations.js
index fbcc5e25ee6752a9c5461b41fa8544a090a17b3f..f540825c4f934f342200db72190599fe95f01d0c 100644
--- a/dist/api/mistral-conversations.js
+++ b/dist/api/mistral-conversations.js
@@ -554,7 +554,6 @@ async function consumeChatStream(model, output, stream, mistralStream, onProvide
? toolCall.function.arguments
: JSON.stringify(toolCall.function.arguments || {});
block.partialArgs = (block.partialArgs || "") + argsDelta;
- block.arguments = parseStreamingJson(block.partialArgs);
stream.push({
type: "toolcall_delta",
contentIndex: toolBlocksByKey.get(key),
diff --git a/dist/api/openai-completions.js b/dist/api/openai-completions.js
index eecd83c753e3b758b8e44628f560b862f8252839..201ad4da96e33bcac9446093c804794d6e64fc82 100644
--- a/dist/api/openai-completions.js
+++ b/dist/api/openai-completions.js
@@ -438,7 +438,6 @@ export const stream = (model, context, options) => {
if (toolCall.function?.arguments) {
delta = toolCall.function.arguments;
block.partialArgs = (block.partialArgs ?? "") + toolCall.function.arguments;
- block.arguments = parseStreamingJson(block.partialArgs);
}
else if (toolCall.custom?.input) {
const nextInput = getCustomToolCallInput(block) + toolCall.custom.input;
diff --git a/dist/api/openai-responses-shared.js b/dist/api/openai-responses-shared.js
index f413fe5f2a1abcac39c38bbd4a77b38c349a5918..108f599ae1d985d2f465e8cdf99ce0624acea6aa 100644
--- a/dist/api/openai-responses-shared.js
+++ b/dist/api/openai-responses-shared.js
@@ -548,7 +548,6 @@ export async function processResponsesStream(openaiStream, output, stream, model
if (!slot || slot.block.partialJson === undefined)
continue;
slot.block.partialJson += event.delta;
- slot.block.arguments = parseStreamingJson(slot.block.partialJson);
pushToolCallDelta(slot, event.delta);
}
else if (event.type === "response.function_call_arguments.done") {
diff --git a/dist/api/pi-messages.js b/dist/api/pi-messages.js
index 7da1c45de8a106a68411cf79bec75f553534a1c7..296d131b59b1cf75f2516c39e85bba72972b2c17 100644
--- a/dist/api/pi-messages.js
+++ b/dist/api/pi-messages.js
@@ -155,8 +155,6 @@ function createEventConverter(model) {
case "toolcall_delta": {
const json = `${toolJson.get(event.contentIndex) ?? ""}${event.delta}`;
toolJson.set(event.contentIndex, json);
- partial.content[event.contentIndex].arguments =
- parseStreamingJson(json);
break;
}
case "toolcall_end":