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.
This commit is contained in:
1 parent
2ac5313009
commit
f1f18bce98
8 files changed
+55
-35
No files matched your search
@@ -141,7 +141,7 @@ External packages installed for runtime use or distributed inside the prebuilt b
|
||||
|
||||
pnpm applies local patches to the following packages at install time, so shipped artifacts carry modified copies; each patch file is the complete record of the modification:
|
||||
|
||||
- `@earendil-works/pi-ai@0.87.1` — [`patches/@earendil-works__pi-ai@0.87.1.patch`](patches/@earendil-works__pi-ai@0.87.1.patch)
|
||||
- `@earendil-works/pi-ai@1.0.0` — [`patches/@earendil-works__pi-ai@1.0.0.patch`](patches/@earendil-works__pi-ai@1.0.0.patch)
|
||||
- `@electron/[email protected]` — [`patches/@[email protected]`](patches/@[email protected])
|
||||
- `@fortune-sheet/[email protected]` — [`patches/@[email protected]`](patches/@[email protected])
|
||||
- `@fortune-sheet/[email protected]` — [`patches/@[email protected]`](patches/@[email protected])
|
||||
|
||||
@@ -87,8 +87,8 @@
|
||||
en: b6bd570c0159ba08
|
||||
zh: 7d2d91eea6a8d830
|
||||
/deepseek-ai-dsh-llm-pi-ai/known-limitations-and-deferred-work:
|
||||
en: bb240ee5dd3f81c7
|
||||
zh: 884506a36f4aac62
|
||||
en: 24213b5d80e1b1ea
|
||||
zh: e7524db2a35f6659
|
||||
/deepseek-ai-dsh-llm-pi-ai/known-limitations-and-deferred-work/dev-note:
|
||||
en: 3678dd0f6642c2a5
|
||||
zh: 75cbdd064cc64282
|
||||
@@ -229,7 +229,7 @@ These limits define where the adapter stops and future work begins. They are cur
|
||||
- **Only a leading in-history `system` message becomes pi-ai's `systemPrompt`** — this adapter uses pi-ai's single `systemPrompt` input, so a later `system` message, or a leading one when `GenerateOptions.system` is also set, folds into a `user` message at its position; provider-specific placement of the prompt follows pi-ai rather than a harness-owned wire override. Images in system or assistant history, including the leading system message, fail with `UNSUPPORTED_CONTENT` on both conversion paths.
|
||||
- **Provider HTTP status is unavailable** — pi-ai error events do not expose a stable HTTP status across providers.
|
||||
- **Retry policy is provider-owned, not an SDK retry** — pi-ai SDK retries stay disabled so durable agent steps and `llm/retry` events own every visible attempt, and direct `ctx.llm.stream()` calls remain single-attempt.
|
||||
- **Streamed tool-call arguments are parsed once, when the call ends** — the installed pi-ai carries [`patches/@earendil-works__pi-ai@0.87.1.patch`](../../../patches/@earendil-works__pi-ai@0.87.1.patch), which removes the per-delta re-parse of the whole accumulated argument JSON in every stream adapter (upstream [earendil-works/pi#9265](https://github.com/earendil-works/pi/issues/9265)); unpatched, a multi-megabyte argument stream costs O(n²) CPU on the event loop and stalls every session in the process. Until `toolcall_end`, a pi-ai partial's tool-call `arguments` stays `{}`; this adapter reads only the delta strings and the finalized arguments. Re-apply or retire the patch on every pi-ai upgrade.
|
||||
- **Streamed tool-call arguments are parsed once, when the call ends** — the installed pi-ai carries [`patches/@earendil-works__pi-ai@1.0.0.patch`](../../../patches/@earendil-works__pi-ai@1.0.0.patch), which removes the per-delta re-parse of the whole accumulated argument JSON in every stream adapter (upstream [earendil-works/pi#9265](https://github.com/earendil-works/pi/issues/9265)); unpatched, a multi-megabyte argument stream costs O(n²) CPU on the event loop and stalls every session in the process. Until `toolcall_end`, a pi-ai partial's tool-call `arguments` stays `{}`; this adapter reads only the delta strings and the finalized arguments. Re-apply or retire the patch on every pi-ai upgrade.
|
||||
|
||||
<a id="dev-note"></a>
|
||||
### Dev Note
|
||||
|
||||
@@ -229,7 +229,7 @@ pi-ai 事件变成 harness 的推理、文本、工具调用、用量与 finish
|
||||
- **只有历史中首条 `system` 消息会成为 pi-ai 的 `systemPrompt`**——本适配器使用 pi-ai 的单一 `systemPrompt` 输入,因此后续的 `system` 消息,或在同时设置了 `GenerateOptions.system` 时的首条消息,会在原位置折叠为 `user` 消息;系统提示词的提供方专属放置遵循 pi-ai,而非 harness 自有的协议覆盖。system 或 assistant 历史中的图片(包括首条系统消息中的图片)在两条转换路径上都会以 `UNSUPPORTED_CONTENT` 失败。
|
||||
- **提供方 HTTP 状态不可用**——pi-ai 错误事件不跨提供方暴露稳定 HTTP 状态。
|
||||
- **重试策略由提供方自有,而非 SDK 重试**——pi-ai SDK 重试保持禁用,因此持久 agent(智能体)步骤与 `llm/retry` 事件拥有每个可见尝试,直接 `ctx.llm.stream()` 调用仍是单次尝试。
|
||||
- **流式工具调用参数只在调用结束时解析一次**——安装的 pi-ai 带有 [`patches/@earendil-works__pi-ai@0.87.1.patch`](../../../patches/@earendil-works__pi-ai@0.87.1.patch),它移除了每个流适配器中对整段累计参数 JSON 的逐 delta 重新解析(上游 [earendil-works/pi#9265](https://github.com/earendil-works/pi/issues/9265));未打补丁时,数 MB 的参数流会在事件循环上消耗 O(n²) CPU,并使进程内所有会话停滞。在 `toolcall_end` 之前,pi-ai partial 的工具调用 `arguments` 保持为 `{}`;本适配器只读取 delta 字符串与最终参数。每次升级 pi-ai 时都要重新应用或撤销该补丁。
|
||||
- **流式工具调用参数只在调用结束时解析一次**——安装的 pi-ai 带有 [`patches/@earendil-works__pi-ai@1.0.0.patch`](../../../patches/@earendil-works__pi-ai@1.0.0.patch),它移除了每个流适配器中对整段累计参数 JSON 的逐 delta 重新解析(上游 [earendil-works/pi#9265](https://github.com/earendil-works/pi/issues/9265));未打补丁时,数 MB 的参数流会在事件循环上消耗 O(n²) CPU,并使进程内所有会话停滞。在 `toolcall_end` 之前,pi-ai partial 的工具调用 `arguments` 保持为 `{}`;本适配器只读取 delta 字符串与最终参数。每次升级 pi-ai 时都要重新应用或撤销该补丁。
|
||||
|
||||
<a id="dev-note"></a>
|
||||
### 开发备注
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
"@deepseek-ai/dsh-brand": "workspace:*",
|
||||
"@deepseek-ai/dsh-util-values": "workspace:*",
|
||||
"@deepseek-ai/schemastery": "workspace:~",
|
||||
"@earendil-works/pi-ai": "^0.87.1"
|
||||
"@earendil-works/pi-ai": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
diff --git a/dist/api/anthropic-messages.js b/dist/api/anthropic-messages.js
|
||||
index e1538a5dfcf2225da9dc3ec622576564ee7c8530..abb8f990d680ee247708ca774a467fc5774e28b0 100644
|
||||
index 106f2b9617fa3b810261e067a3c965f209907af3..d841d316172c82d5b1aebcfb2bde3e84b807ae0a 100644
|
||||
--- a/dist/api/anthropic-messages.js
|
||||
+++ b/dist/api/anthropic-messages.js
|
||||
@@ -500,7 +500,6 @@ export const stream = (model, context, options) => {
|
||||
@@ -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;
|
||||
@@ -11,10 +11,10 @@ index e1538a5dfcf2225da9dc3ec622576564ee7c8530..abb8f990d680ee247708ca774a467fc5
|
||||
type: "toolcall_delta",
|
||||
contentIndex: index,
|
||||
diff --git a/dist/api/bedrock-converse-stream.js b/dist/api/bedrock-converse-stream.js
|
||||
index 6bc6312906ec3d75f31d190994d21c87f1d0767d..7ff68fb60c3c1d9e3e7d2d2df8d4619593a67335 100644
|
||||
index a7f6d9cbe66546d5d418450809e92cf7289ce4a3..6fc5438c9ace36d8cb0f6bf3d077ebfa8281dcf5 100644
|
||||
--- a/dist/api/bedrock-converse-stream.js
|
||||
+++ b/dist/api/bedrock-converse-stream.js
|
||||
@@ -453,7 +453,6 @@ function handleContentBlockDelta(event, blocks, output, stream) {
|
||||
@@ -460,7 +460,6 @@ function handleContentBlockDelta(event, blocks, output, stream) {
|
||||
}
|
||||
else if (delta?.toolUse && block?.type === "toolCall") {
|
||||
block.partialJson = (block.partialJson || "") + (delta.toolUse.input || "");
|
||||
@@ -23,10 +23,10 @@ index 6bc6312906ec3d75f31d190994d21c87f1d0767d..7ff68fb60c3c1d9e3e7d2d2df8d46195
|
||||
}
|
||||
else if (delta?.reasoningContent) {
|
||||
diff --git a/dist/api/mistral-conversations.js b/dist/api/mistral-conversations.js
|
||||
index 67f9341a6f7d855dce25054fd48cd9077e8e04a1..afdb5c2c873abb72ca8011b7e3f06a230dbe3e8a 100644
|
||||
index fbcc5e25ee6752a9c5461b41fa8544a090a17b3f..f540825c4f934f342200db72190599fe95f01d0c 100644
|
||||
--- a/dist/api/mistral-conversations.js
|
||||
+++ b/dist/api/mistral-conversations.js
|
||||
@@ -543,7 +543,6 @@ async function consumeChatStream(model, output, stream, mistralStream) {
|
||||
@@ -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;
|
||||
@@ -35,10 +35,10 @@ index 67f9341a6f7d855dce25054fd48cd9077e8e04a1..afdb5c2c873abb72ca8011b7e3f06a23
|
||||
type: "toolcall_delta",
|
||||
contentIndex: toolBlocksByKey.get(key),
|
||||
diff --git a/dist/api/openai-completions.js b/dist/api/openai-completions.js
|
||||
index 48464f2bf56b9369d5c202e4f02fc4f13d35b412..d829f5e8e56e788d96fa7a82c0e3cfaef3fc1f63 100644
|
||||
index eecd83c753e3b758b8e44628f560b862f8252839..201ad4da96e33bcac9446093c804794d6e64fc82 100644
|
||||
--- a/dist/api/openai-completions.js
|
||||
+++ b/dist/api/openai-completions.js
|
||||
@@ -453,7 +453,6 @@ export const stream = (model, context, options) => {
|
||||
@@ -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;
|
||||
@@ -47,10 +47,10 @@ index 48464f2bf56b9369d5c202e4f02fc4f13d35b412..d829f5e8e56e788d96fa7a82c0e3cfae
|
||||
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 43e463dbfd1e6cc437ebc680468036f47678de26..f4259772e289c326697ea7f2ece25954bfb5a520 100644
|
||||
index f413fe5f2a1abcac39c38bbd4a77b38c349a5918..108f599ae1d985d2f465e8cdf99ce0624acea6aa 100644
|
||||
--- a/dist/api/openai-responses-shared.js
|
||||
+++ b/dist/api/openai-responses-shared.js
|
||||
@@ -546,7 +546,6 @@ export async function processResponsesStream(openaiStream, output, stream, model
|
||||
@@ -548,7 +548,6 @@ export async function processResponsesStream(openaiStream, output, stream, model
|
||||
if (!slot || slot.block.partialJson === undefined)
|
||||
continue;
|
||||
slot.block.partialJson += event.delta;
|
||||
@@ -59,7 +59,7 @@ index 43e463dbfd1e6cc437ebc680468036f47678de26..f4259772e289c326697ea7f2ece25954
|
||||
}
|
||||
else if (event.type === "response.function_call_arguments.done") {
|
||||
diff --git a/dist/api/pi-messages.js b/dist/api/pi-messages.js
|
||||
index 5b9cb1680c47083a9a36eefa93124c67c750fd42..dc5a43ebd801fa6d4b7897c3739b588d4d571d3a 100644
|
||||
index 7da1c45de8a106a68411cf79bec75f553534a1c7..296d131b59b1cf75f2516c39e85bba72972b2c17 100644
|
||||
--- a/dist/api/pi-messages.js
|
||||
+++ b/dist/api/pi-messages.js
|
||||
@@ -155,8 +155,6 @@ function createEventConverter(model) {
|
||||
Generated
+35
-15
@@ -10,7 +10,7 @@ overrides:
|
||||
'@deepseek-ai/schemastery': link:vendor/schemastery
|
||||
|
||||
patchedDependencies:
|
||||
'@earendil-works/pi-ai@0.87.1': b9bcce474fb2ac44633dff0fa722816a5bff5451b4575d5874035ea14ba70a4f
|
||||
'@earendil-works/pi-ai@1.0.0': 3b2f85a92bded8a4fd06652620a93f24a7562f5e082a8dccec09ddd76e483e0e
|
||||
'@electron/[email protected]': 280e7b2816caf01423097d24e79107a66afeb563a348630ce9928ae8499a5861
|
||||
'@fortune-sheet/[email protected]': 8791a230763dbf853fd65d627c68c31de37209992851377855e16cf08ea70532
|
||||
'@fortune-sheet/[email protected]': 2932e52e79afcd4ced08cfa123b5eded786c85043da32f622f3e80af6fc96c37
|
||||
@@ -9945,8 +9945,8 @@ importers:
|
||||
specifier: link:../../../vendor/schemastery
|
||||
version: link:../../../vendor/schemastery
|
||||
'@earendil-works/pi-ai':
|
||||
specifier: ^0.87.1
|
||||
version: 0.87.1(patch_hash=b9bcce474fb2ac44633dff0fa722816a5bff5451b4575d5874035ea14ba70a4f)(@modelcontextprotocol/[email protected]([email protected]))([email protected])([email protected])([email protected])
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0(patch_hash=3b2f85a92bded8a4fd06652620a93f24a7562f5e082a8dccec09ddd76e483e0e)(@aws-sdk/[email protected])(@modelcontextprotocol/[email protected]([email protected]))(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
devDependencies:
|
||||
'@deepseek-ai/cordis':
|
||||
specifier: workspace:~
|
||||
@@ -15378,13 +15378,13 @@ packages:
|
||||
search-insights:
|
||||
optional: true
|
||||
|
||||
'@earendil-works/pi-ai@0.87.1':
|
||||
resolution: {integrity: sha512-X/3PfQBnnoeVdO9Cv8zHghUMglzlgNZYGNzoPnbRoGnHl3Rw3TlA2UKSUB7BRHUOxMryHXYa8dnjWZlbRheDZA==}
|
||||
'@earendil-works/pi-ai@1.0.0':
|
||||
resolution: {integrity: sha512-3/W1vdDaVtpeMd23ElvJC12HLA5yS/BGqqcXF+0SK082dN7cbgNcCwguTBRBC258Ke8SzSvUW1B75iAf8w8IxA==}
|
||||
engines: {node: '>=22.19.0'}
|
||||
hasBin: true
|
||||
|
||||
'@earendil-works/pi-telemetry@0.87.1':
|
||||
resolution: {integrity: sha512-MC6TRQH5lgMXpcN+Vku2WMI2T8BsiUPzMQHGo81uqFZD3/9O79WWJAysEDGuzduP6R4tvtgwMLwmqIxynM10JQ==}
|
||||
'@earendil-works/pi-telemetry@1.0.0':
|
||||
resolution: {integrity: sha512-WjNBj5TYIiPZFQEz2WlULcDwPLaKwIlmsKjVeYM+LJSbnSp38kWsHUJysIDGnu23IcLbKoPtywsvYfUJCeZePA==}
|
||||
engines: {node: '>=22.19.0'}
|
||||
|
||||
'@electron-internal/[email protected]':
|
||||
@@ -20692,12 +20692,25 @@ packages:
|
||||
resolution: {integrity: sha512-++Zlftm0kVLPmzC06t6epuWmcRMDbI4z5P3NNX979WA/k23+NtSOynEGzsVfZwguKw2mi5umVgnBlJQMwRz4Pg==}
|
||||
engines: {node: '>=20'}
|
||||
|
||||
openai@6.40.0:
|
||||
resolution: {integrity: sha512-MWtTjd/gQt4jpbji61NTgFWJLoY/PdRJ6wG9/ZDRMYNMlBKrCrSlkLI+KgHP1vR1qT6LKSAyAqIxno6lcK9JiA==}
|
||||
openai@7.19.0:
|
||||
resolution: {integrity: sha512-MX2s3u2L5racTO0CC/SWpCOasJQBCJrqLKXK+l82cAhdeF8mPMBEe/gxMm0ZFa2xpKpOFLRjxv5afYEZbBXmbQ==}
|
||||
engines: {node: '>=22.0.0'}
|
||||
peerDependencies:
|
||||
ws: ^8.18.0
|
||||
'@aws-sdk/credential-provider-node': '>=3.972.0 <4'
|
||||
'@smithy/hash-node': '>=4.3.0 <5'
|
||||
'@smithy/signature-v4': '>=5.4.0 <6'
|
||||
undici: '>=5 <9'
|
||||
ws: ^8.21.0
|
||||
zod: ^3.25 || ^4.0
|
||||
peerDependenciesMeta:
|
||||
'@aws-sdk/credential-provider-node':
|
||||
optional: true
|
||||
'@smithy/hash-node':
|
||||
optional: true
|
||||
'@smithy/signature-v4':
|
||||
optional: true
|
||||
undici:
|
||||
optional: true
|
||||
ws:
|
||||
optional: true
|
||||
zod:
|
||||
@@ -22900,28 +22913,32 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- '@algolia/client-search'
|
||||
|
||||
'@earendil-works/pi-ai@0.87.1(patch_hash=b9bcce474fb2ac44633dff0fa722816a5bff5451b4575d5874035ea14ba70a4f)(@modelcontextprotocol/[email protected]([email protected]))([email protected])([email protected])([email protected])':
|
||||
'@earendil-works/pi-ai@1.0.0(patch_hash=3b2f85a92bded8a4fd06652620a93f24a7562f5e082a8dccec09ddd76e483e0e)(@aws-sdk/[email protected])(@modelcontextprotocol/[email protected]([email protected]))(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':
|
||||
dependencies:
|
||||
'@anthropic-ai/sdk': 0.124.0([email protected])
|
||||
'@aws-sdk/client-bedrock-runtime': 3.1127.0
|
||||
'@earendil-works/pi-telemetry': 0.87.1
|
||||
'@earendil-works/pi-telemetry': 1.0.0
|
||||
'@google/genai': 2.21.0(@modelcontextprotocol/[email protected]([email protected]))
|
||||
'@smithy/node-http-handler': 4.12.1
|
||||
http-proxy-agent: 9.1.0([email protected])
|
||||
https-proxy-agent: 9.1.0([email protected])
|
||||
openai: 6.40.0([email protected])([email protected])
|
||||
openai: 7.19.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])
|
||||
partial-json: 0.1.7
|
||||
typebox: 1.3.27
|
||||
transitivePeerDependencies:
|
||||
- '@aws-sdk/credential-provider-node'
|
||||
- '@modelcontextprotocol/sdk'
|
||||
- '@smithy/hash-node'
|
||||
- '@smithy/signature-v4'
|
||||
- bufferutil
|
||||
- kerberos
|
||||
- supports-color
|
||||
- undici
|
||||
- utf-8-validate
|
||||
- ws
|
||||
- zod
|
||||
|
||||
'@earendil-works/pi-telemetry@0.87.1': {}
|
||||
'@earendil-works/pi-telemetry@1.0.0': {}
|
||||
|
||||
'@electron-internal/[email protected]': {}
|
||||
|
||||
@@ -28268,8 +28285,11 @@ snapshots:
|
||||
powershell-utils: 0.2.1
|
||||
wsl-utils: 1.0.0
|
||||
|
||||
openai@6.40.0([email protected])([email protected]):
|
||||
openai@7.19.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected]0.0)([email protected])([email protected]):
|
||||
optionalDependencies:
|
||||
'@aws-sdk/credential-provider-node': 3.972.84
|
||||
'@smithy/signature-v4': 5.7.4
|
||||
undici: 8.10.0
|
||||
ws: 8.21.0
|
||||
zod: 4.4.3
|
||||
|
||||
|
||||
+3
-3
@@ -64,8 +64,8 @@ minimumReleaseAgeExclude:
|
||||
- '@deepseek-ai/[email protected]'
|
||||
# Fresh pi-ai releases carry the model catalog updates that are the whole
|
||||
# point of bumping it; waiting out the release age would defeat that.
|
||||
- '@earendil-works/pi-ai@0.87.1'
|
||||
- '@earendil-works/pi-telemetry@0.87.1'
|
||||
- '@earendil-works/pi-ai@1.0.0'
|
||||
- '@earendil-works/pi-telemetry@1.0.0'
|
||||
- [email protected]
|
||||
- [email protected]
|
||||
- [email protected]
|
||||
@@ -98,7 +98,7 @@ minimumReleaseAgeExclude:
|
||||
- '@trycua/[email protected]'
|
||||
- '@trycua/[email protected]'
|
||||
patchedDependencies:
|
||||
'@earendil-works/pi-ai@0.87.1': patches/@earendil-works__pi-ai@0.87.1.patch
|
||||
'@earendil-works/pi-ai@1.0.0': patches/@earendil-works__pi-ai@1.0.0.patch
|
||||
'@electron/[email protected]': patches/@[email protected]
|
||||
'@fortune-sheet/[email protected]': patches/@[email protected]
|
||||
'@fortune-sheet/[email protected]': patches/@[email protected]
|
||||
|
||||
Reference in new issue
Block a user