build(llm-pi-ai): upgrade @earendil-works/pi-ai to 1.0.2
pi-ai 1.0.1 and 1.0.2 bring model catalog updates and adapter fixes: Anthropic native tool changes define later tools inline, Bedrock binds replayed thinking blocks, OpenAI-compatible requests can pick sampling parameters by thinking level, and "model is at capacity" is retried. The runtime dependencies change only in @anthropic-ai/sdk (0.124.0 to 0.129.0) and @earendil-works/pi-telemetry (^1.0.2). 1.0.2 still re-parses the whole accumulated tool-argument JSON on every stream delta (earendil-works/pi#9265), so the patch is regenerated against the 1.0.2 sources: it removes the same six per-delta parses as the 1.0.0 patch, and only the bedrock-converse-stream.js hunk moves, by a line.
This commit is contained in:
1 parent
3d0e274859
commit
21fe89affe
8 files changed
+31
-31
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/[email protected].0` — [`patches/@[email protected].0.patch`](patches/@[email protected].0.patch)
|
||||
- `@earendil-works/[email protected].2` — [`patches/@[email protected].2.patch`](patches/@[email protected].2.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: 3ac77ae061cf0683
|
||||
zh: c25abff6da8c1a22
|
||||
en: 9c5095233a4194cc
|
||||
zh: 044fe1c59c62e317
|
||||
/deepseek-ai-dsh-llm-pi-ai/known-limitations-and-deferred-work/dev-note:
|
||||
en: 3678dd0f6642c2a5
|
||||
zh: 75cbdd064cc64282
|
||||
@@ -230,7 +230,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/@[email protected].0.patch`](../../../patches/@[email protected].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.
|
||||
- **Streamed tool-call arguments are parsed once, when the call ends** — the installed pi-ai carries [`patches/@[email protected].2.patch`](../../../patches/@[email protected].2.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
|
||||
|
||||
@@ -230,7 +230,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/@[email protected].0.patch`](../../../patches/@[email protected].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 时都要重新应用或撤销该补丁。
|
||||
- **流式工具调用参数只在调用结束时解析一次**——安装的 pi-ai 带有 [`patches/@[email protected].2.patch`](../../../patches/@[email protected].2.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": "^1.0.0"
|
||||
"@earendil-works/pi-ai": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/dist/api/anthropic-messages.js b/dist/api/anthropic-messages.js
|
||||
index 106f2b9617fa3b810261e067a3c965f209907af3..d841d316172c82d5b1aebcfb2bde3e84b807ae0a 100644
|
||||
index 38571b31e143e913c2bf59dad73382982e93664a..950e546197d8e84cb3edfca0012939f1db2488d8 100644
|
||||
--- a/dist/api/anthropic-messages.js
|
||||
+++ b/dist/api/anthropic-messages.js
|
||||
@@ -553,7 +553,6 @@ export const stream = (model, context, options) => {
|
||||
@@ -11,10 +11,10 @@ index 106f2b9617fa3b810261e067a3c965f209907af3..d841d316172c82d5b1aebcfb2bde3e84
|
||||
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
|
||||
index 428af807620993a4c90ceb1a1a120d553844be32..d81d290d8b8b97f8e2cdd97cff1ebaf019c5733e 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) {
|
||||
@@ -461,7 +461,6 @@ function handleContentBlockDelta(event, blocks, output, stream) {
|
||||
}
|
||||
else if (delta?.toolUse && block?.type === "toolCall") {
|
||||
block.partialJson = (block.partialJson || "") + (delta.toolUse.input || "");
|
||||
@@ -35,7 +35,7 @@ index fbcc5e25ee6752a9c5461b41fa8544a090a17b3f..f540825c4f934f342200db72190599fe
|
||||
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
|
||||
index a60f39352b776d71497e55b33b3334bacfbeb2f5..6c9b98e35606c52e4f0fb29d8fd0b5ba02d92e09 100644
|
||||
--- a/dist/api/openai-completions.js
|
||||
+++ b/dist/api/openai-completions.js
|
||||
@@ -438,7 +438,6 @@ export const stream = (model, context, options) => {
|
||||
Generated
+18
-18
@@ -10,7 +10,7 @@ overrides:
|
||||
'@deepseek-ai/schemastery': link:vendor/schemastery
|
||||
|
||||
patchedDependencies:
|
||||
'@earendil-works/[email protected].0': 3b2f85a92bded8a4fd06652620a93f24a7562f5e082a8dccec09ddd76e483e0e
|
||||
'@earendil-works/[email protected].2': 1cc211bc358d30cb58bd975f39c03e296f8a277c3de845514d12f9ae77ebab5f
|
||||
'@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: ^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])
|
||||
specifier: ^1.0.2
|
||||
version: 1.0.2(patch_hash=1cc211bc358d30cb58bd975f39c03e296f8a277c3de845514d12f9ae77ebab5f)(@aws-sdk/[email protected])(@modelcontextprotocol/[email protected]([email protected]))(@smithy/[email protected])([email protected])([email protected])([email protected])
|
||||
devDependencies:
|
||||
'@deepseek-ai/cordis':
|
||||
specifier: workspace:~
|
||||
@@ -15040,8 +15040,8 @@ packages:
|
||||
'@modelcontextprotocol/sdk': ^1.29.0
|
||||
zod: ^4.0.0
|
||||
|
||||
'@anthropic-ai/[email protected]4.0':
|
||||
resolution: {integrity: sha512-cN5O8i9UVxHeOQAzj/XjshWXG8KiibJDw9OGpH2Z/eR3n/RBxdoLxDJOcfqAJWvjaMDFfHTBADU04hWRJVkDyA==}
|
||||
'@anthropic-ai/[email protected]9.0':
|
||||
resolution: {integrity: sha512-MH7LB20kNpGLUpPTe2OG5XvL/KhX8HUO9XyBaFjgFk6TLS4Xjt0VPIuMKywe7POKKPslX+QxSlVok9e+8kG5Nw==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
zod: ^3.25.0 || ^4.0.0
|
||||
@@ -15378,13 +15378,13 @@ packages:
|
||||
search-insights:
|
||||
optional: true
|
||||
|
||||
'@earendil-works/[email protected].0':
|
||||
resolution: {integrity: sha512-3/W1vdDaVtpeMd23ElvJC12HLA5yS/BGqqcXF+0SK082dN7cbgNcCwguTBRBC258Ke8SzSvUW1B75iAf8w8IxA==}
|
||||
'@earendil-works/[email protected].2':
|
||||
resolution: {integrity: sha512-JP59xGlSAQ/HhQ6EHN5qmneBlWfDyu6FPPryAvAaSo8A38ubAsEpS9YisCM5Jbbns0srrDffLZonE0OXorHI5A==}
|
||||
engines: {node: '>=22.19.0'}
|
||||
hasBin: true
|
||||
|
||||
'@earendil-works/[email protected].0':
|
||||
resolution: {integrity: sha512-WjNBj5TYIiPZFQEz2WlULcDwPLaKwIlmsKjVeYM+LJSbnSp38kWsHUJysIDGnu23IcLbKoPtywsvYfUJCeZePA==}
|
||||
'@earendil-works/[email protected].2':
|
||||
resolution: {integrity: sha512-Ev5h9TE8nEXHCfRKhWj0qpUFhQgVqNteS95vsM2KNGRGm533vOO2ruDPaEwImBKPMBKXy4omz3D6V2cm41gLOQ==}
|
||||
engines: {node: '>=22.19.0'}
|
||||
|
||||
'@electron-internal/[email protected]':
|
||||
@@ -22448,7 +22448,7 @@ snapshots:
|
||||
'@anthropic-ai/claude-agent-sdk-win32-arm64': 0.3.263
|
||||
'@anthropic-ai/claude-agent-sdk-win32-x64': 0.3.263
|
||||
|
||||
'@anthropic-ai/[email protected]4.0([email protected])':
|
||||
'@anthropic-ai/[email protected]9.0([email protected])':
|
||||
dependencies:
|
||||
json-schema-to-ts: 3.1.1
|
||||
standardwebhooks: 1.1.1
|
||||
@@ -22913,15 +22913,15 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- '@algolia/client-search'
|
||||
|
||||
'@earendil-works/[email protected].0(patch_hash=3b2f85a92bded8a4fd06652620a93f24a7562f5e082a8dccec09ddd76e483e0e)(@aws-sdk/[email protected])(@modelcontextprotocol/[email protected]([email protected]))(@smithy/[email protected])([email protected])([email protected])([email protected])([email protected])':
|
||||
'@earendil-works/[email protected].2(patch_hash=1cc211bc358d30cb58bd975f39c03e296f8a277c3de845514d12f9ae77ebab5f)(@aws-sdk/[email protected])(@modelcontextprotocol/[email protected]([email protected]))(@smithy/[email protected])([email protected])([email protected])([email protected])':
|
||||
dependencies:
|
||||
'@anthropic-ai/sdk': 0.124.0([email protected])
|
||||
'@anthropic-ai/sdk': 0.129.0([email protected])
|
||||
'@aws-sdk/client-bedrock-runtime': 3.1127.0
|
||||
'@earendil-works/pi-telemetry': 1.0.0
|
||||
'@earendil-works/pi-telemetry': 1.0.2
|
||||
'@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])
|
||||
http-proxy-agent: 9.1.0
|
||||
https-proxy-agent: 9.1.0
|
||||
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
|
||||
@@ -22938,7 +22938,7 @@ snapshots:
|
||||
- ws
|
||||
- zod
|
||||
|
||||
'@earendil-works/[email protected].0': {}
|
||||
'@earendil-works/[email protected].2': {}
|
||||
|
||||
'@electron-internal/[email protected]': {}
|
||||
|
||||
@@ -27110,7 +27110,7 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
[email protected]([email protected]):
|
||||
[email protected]:
|
||||
dependencies:
|
||||
agent-base: 9.0.0
|
||||
debug: 4.4.3([email protected])
|
||||
@@ -27169,7 +27169,7 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
[email protected]([email protected]):
|
||||
[email protected]:
|
||||
dependencies:
|
||||
agent-base: 9.0.0
|
||||
debug: 4.4.3([email protected])
|
||||
|
||||
+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/[email protected].0'
|
||||
- '@earendil-works/[email protected].0'
|
||||
- '@earendil-works/[email protected].2'
|
||||
- '@earendil-works/[email protected].2'
|
||||
- [email protected]
|
||||
- [email protected]
|
||||
- [email protected]
|
||||
@@ -98,7 +98,7 @@ minimumReleaseAgeExclude:
|
||||
- '@trycua/[email protected]'
|
||||
- '@trycua/[email protected]'
|
||||
patchedDependencies:
|
||||
'@earendil-works/[email protected].0': patches/@[email protected].0.patch
|
||||
'@earendil-works/[email protected].2': patches/@[email protected].2.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