Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

fix(core,cli,web): upgrade AgentHub to 0.4.5 for unrecognized stream output (#360)

Yaowei Zheng9292d19b2b1c
diff --git a/changelog/unreleased/2026-08-20-agenthub-0.4.5.md b/changelog/unreleased/2026-08-20-agenthub-0.4.5.md
new file mode 100644
index 00000000..cf1802c2
--- /dev/null
+++ b/changelog/unreleased/2026-08-20-agenthub-0.4.5.md
@@ -0,0 +1,19 @@
+# AgentHub 0.4.5: a stream survives output the client does not recognize
+
+- **Date:** 2026-08-20
+- **Type:** fix
+- **Scope:** `core`, `cli`, `web`
+- **PR:** [#360](https://github.com/Prism-Shadow/penguin-harness/pull/360)
+
+[中文版](2026-08-20-agenthub-0.4.5.zh.md)
+
+`@prismshadow/agenthub` moved from 0.4.4 to 0.4.5, which skips stream output a client does not recognize instead of failing the request (agenthub [#181](https://github.com/Prism-Shadow/agenthub/pull/181)).
+
+A gateway in front of a model API injects frames of its own during a long generation. 0.4.3 taught each protocol family the heartbeat spelling it had seen — `keepalive` on OpenAI Responses, `ping` on Anthropic Messages — so either spelling crossing into the other protocol still reached the unknown-event guard and threw. A relay that sent `{"type": "ping", "cost": "@"}` into a Responses stream ended the turn as `llm request failed after 5 retries: Unknown output: {"type":"ping","cost":"@"}`, because the engine classifies the throw as a retryable request failure and each retry met the next heartbeat.
+
+## Details
+
+- Every client that used to reject an unrecognized event now marks it `unused` instead — the Anthropic Messages and OpenAI Responses families, MiniMax M3 included — and the Gemini client skips an unrecognized content part, so no gateway frame can end a generation. Setting `AGENTHUB_DEBUG` to anything other than `0`, `false`, `no` or `off` restores the guards for debugging, with the same error text as before.
+- `AutoLLMClient` gained `listModels()`, a `defaultHeaders` option, and the `UnsupportedOperationError` class; the bump added no call to any of them. The model catalog and protocol-path hints are unaffected, and `protocol-path.ts`'s verification note now names the version it was re-checked against.
+- 0.4.5 also aligned the `openai-responses` and `minimax-m3` message transforms with the GPT client, which flushes buffered assistant text at the end of a message rather than before each top-level item. A replayed turn of `[text, tool_call]` now reaches those two servers as `[function_call, message]`, the order the GPT client has always sent.
+- `pnpm-workspace.yaml`'s `minimumReleaseAgeExclude` entry names 0.4.5 and drops 0.4.4, as that file's own note instructed.
diff --git a/changelog/unreleased/2026-08-20-agenthub-0.4.5.zh.md b/changelog/unreleased/2026-08-20-agenthub-0.4.5.zh.md
new file mode 100644
index 00000000..3c33190c
--- /dev/null
+++ b/changelog/unreleased/2026-08-20-agenthub-0.4.5.zh.md
@@ -0,0 +1,19 @@
+# AgentHub 0.4.5:client 认不出的输出不再中断整条流
+
+- **Date:** 2026-08-20
+- **Type:** fix
+- **Scope:** `core`, `cli`, `web`
+- **PR:** [#360](https://github.com/Prism-Shadow/penguin-harness/pull/360)
+
+[English](2026-08-20-agenthub-0.4.5.md)
+
+`@prismshadow/agenthub` 从 0.4.4 升到 0.4.5。新版本会跳过 client 认不出的流式输出,而不是让整个请求失败(agenthub [#181](https://github.com/Prism-Shadow/agenthub/pull/181))。
+
+架在模型 API 前面的网关会在长时间生成期间注入自己的帧。0.4.3 只让每个协议家族认识了它当时见过的那种心跳拼法——OpenAI Responses 的 `keepalive`、Anthropic Messages 的 `ping`——因此任一拼法串到另一种协议上,仍会落到未知事件守卫并抛错。中转站把 `{"type": "ping", "cost": "@"}` 发进 Responses 流时,这一轮会以 `llm request failed after 5 retries: Unknown output: {"type":"ping","cost":"@"}` 结束:引擎把该抛错判定为可重试的请求失败,而每次重试又撞上下一个心跳。
+
+## 细节
+
+- 此前会拒绝未知事件的 client 现在改为把它标记为 `unused`——Anthropic Messages 与 OpenAI Responses 两个家族,MiniMax M3 也在内——Gemini client 则跳过认不出的 content part,因此没有任何网关帧能终结一次生成。把 `AGENTHUB_DEBUG` 设为 `0`、`false`、`no`、`off` 以外的任意值即可恢复守卫用于调试,报错文本与此前一致。
+- `AutoLLMClient` 新增了 `listModels()`、`defaultHeaders` 选项与 `UnsupportedOperationError` 错误类;本次升级没有调用其中任何一个。模型目录与协议路径提示不受影响,`protocol-path.ts` 的校验注释已改为它重新核对过的版本号。
+- 0.4.5 还把 `openai-responses` 与 `minimax-m3` 的消息转换与 GPT client 对齐:缓冲的 assistant 文本改为在每条消息结束时才 flush,而不是在每个顶层项之前。因此重放 `[text, tool_call]` 这样一轮时,这两类服务端收到的顺序变为 `[function_call, message]`,也就是 GPT client 一直以来发送的顺序。
+- `pnpm-workspace.yaml` 中 `minimumReleaseAgeExclude` 的条目改为 0.4.5;按该文件自身注释的要求,移除了 0.4.4 的条目。
diff --git a/packages/cli/package.json b/packages/cli/package.json
index e291f7a9..a0cb6ff6 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -24,7 +24,7 @@
},
"dependencies": {
"@modelcontextprotocol/client": "^2.0.0",
- "@prismshadow/agenthub": "^0.4.4",
+ "@prismshadow/agenthub": "^0.4.5",
"@prismshadow/penguin-core": "workspace:*",
"@prismshadow/penguin-server": "workspace:*",
"@prismshadow/penguin-skills": "workspace:*",
diff --git a/packages/core/package.json b/packages/core/package.json
index 01cb5db1..62432156 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -49,7 +49,7 @@
},
"dependencies": {
"@modelcontextprotocol/client": "^2.0.0",
- "@prismshadow/agenthub": "^0.4.4",
+ "@prismshadow/agenthub": "^0.4.5",
"@prismshadow/penguin-skills": "workspace:*",
"arktype": "^2.2.3",
"smol-toml": "^1.3.0",
diff --git a/packages/core/test/llm.test.ts b/packages/core/test/llm.test.ts
index 6d06d934..e5d04c92 100644
--- a/packages/core/test/llm.test.ts
+++ b/packages/core/test/llm.test.ts
@@ -880,6 +880,46 @@ describe("translateEvents", () => {
const tu = messages.at(-1)!.payload as TokenUsagePayload;
expect(tu.request.total).toBe(524);
});
+
+ it("drops an unused event without splitting the segment it interrupts", () => {
+ // AgentHub marks any stream event a client does not recognize `unused` and attaches no
+ // content items to it, so a frame a gateway injects mid-generation (heartbeat, cost
+ // ticker) must pass through the translator without opening, closing or splitting the
+ // text segment around it, and without disturbing the usage snapshot.
+ const { messages, requestTokens } = translateEvents([
+ ev({ event_type: "start", content_items: [] }),
+ ev({ content_items: [{ type: "text", text: "Hel" }] }),
+ ev({ event_type: "unused", content_items: [] }),
+ ev({ content_items: [{ type: "text", text: "lo" }] }),
+ ev({
+ event_type: "stop",
+ content_items: [],
+ finish_reason: "stop",
+ usage_metadata: {
+ cached_tokens: 0,
+ prompt_tokens: 12,
+ thoughts_tokens: 0,
+ response_tokens: 4,
+ },
+ }),
+ ]);
+
+ const types = messages.map((m) => (m.payload as { type: string }).type);
+ // One start, one delta per text item, one stop — the unused event adds nothing.
+ expect(types).toEqual([
+ "partial_text",
+ "partial_text",
+ "partial_text",
+ "partial_text",
+ "text",
+ "token_usage",
+ ]);
+ const complete = messages.find((m) => (m.payload as { type: string }).type === "text")!
+ .payload as TextPayload;
+ expect(complete.text).toBe("Hello");
+ expect(complete.stop_reason).toBe("completed");
+ expect(requestTokens.total).toBe(16);
+ });
});
describe("EventTranslator.finishInterrupted (PRN-012 structural closure)", () => {
diff --git a/packages/skills/skills/agenthub-models/SKILL.md b/packages/skills/skills/agenthub-models/SKILL.md
index b4acce43..e742bac2 100644
--- a/packages/skills/skills/agenthub-models/SKILL.md
+++ b/packages/skills/skills/agenthub-models/SKILL.md
@@ -3,8 +3,8 @@ name: agenthub-models
description: Call model APIs through @prismshadow/agenthub — streaming text generation, image generation, speech synthesis, embeddings and the supported-model registry with one client.
short_description: Call model APIs with one AgentHub client.
short_description_zh: 用一个 AgentHub 客户端调用模型 API。
-version: 13
-updated: 2026-08-20T00:00:00Z
+version: 14
+updated: 2026-08-21T00:00:00Z
---
# AgentHub Model APIs
@@ -97,7 +97,7 @@ for (const m of listSupportedModels()) {
- Modalities are `"Text" | "Image" | "Video" | "Audio" | "Embed"`. Coverage includes the official vendor endpoints plus the OpenRouter and SiliconFlow gateways; `context_window` and `pricing` are omitted where the platform publishes no authoritative value (image and TTS models, for instance).
- `pricing` is per million tokens, keyed by the same usage buckets as `usage_metadata`: `prompt_tokens` (non-cached input), `thoughts_tokens` / `response_tokens` (both the output price) and optional `cached_tokens` (cache-hit price). Values are stored in USD; pass `listSupportedModels("CNY")` to convert at 7 CNY/USD.
-The registry is the curated current line-up, so prefer it when picking a model or estimating cost. It is not the routing table, and it lags in both directions: older ids in the table above (`gpt-5.4`, `claude-opus-4-7`, `gemini-3.1-pro-preview`, `gemini-3.1-flash-lite`) still route fine without appearing in it, and AgentHub 0.4.4 lists neither `claude-opus-5` nor `anthropic/claude-opus-5` although both route. For an id the registry omits, take the context window and price from the vendor's own page.
+The registry is the curated current line-up, so prefer it when picking a model or estimating cost. It is not the routing table, and it lags in both directions: older ids in the table above (`gpt-5.4`, `claude-opus-4-7`, `gemini-3.1-pro-preview`, `gemini-3.1-flash-lite`) still route fine without appearing in it, and a newly launched id can route before the registry carries it. For an id the registry omits, take the context window and price from the vendor's own page.
## Routing and credentials
diff --git a/packages/web/src/features/models/protocol-path.ts b/packages/web/src/features/models/protocol-path.ts
index cba33c09..ced1e5e8 100644
--- a/packages/web/src/features/models/protocol-path.ts
+++ b/packages/web/src/features/models/protocol-path.ts
@@ -1,7 +1,7 @@
/**
* Protocol-path suffix for the config dialog's base URL field: the path the AgentHub
* client appends to a custom base URL, shown inside the field so the user knows which
- * endpoint shape the URL must serve. Verified against the vendored agenthub 0.4.4
+ * endpoint shape the URL must serve. Verified against the vendored agenthub 0.4.5
* clients and the SDKs they construct:
* - Anthropic direct (claude-* clients, `@anthropic-ai/sdk`): POST {base}/v1/messages —
* the SDK's default base URL (https://api.anthropic.com) carries no /v1; the request
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c0bb4acc..5f580bc6 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -49,8 +49,8 @@ importers:
specifier: ^2.0.0
version: 2.0.0
'@prismshadow/agenthub':
- specifier: ^0.4.4
+ specifier: ^0.4.5
'@prismshadow/penguin-core':
specifier: workspace:*
version: link:../core
@@ -95,8 +95,8 @@ importers:
specifier: ^2.0.0
version: 2.0.0
'@prismshadow/agenthub':
- specifier: ^0.4.4
+ specifier: ^0.4.5
'@prismshadow/penguin-skills':
specifier: workspace:*
version: link:../skills
@@ -951,8 +951,8 @@ packages:
engines: {node: '>=18'}
hasBin: true
- '@prismshadow/[email protected]':
- resolution: {integrity: sha512-hKO5Zj5GxMabqClZph9xT/eZTi835Pv14/AcZpa0TeOtjixJwuy/YAUZKkXBsYCwFbcy31Uel+S81qifjVo5cA==}
+ '@prismshadow/[email protected]':
+ resolution: {integrity: sha512-JZSziKpji4Y+zY0fduy20gvxfkUIiZUuZuEcFFh4iu+239vVicRH4g3B99k87QsPp5Z59reakW183PsFFfXPrw==}
'@prismshadow/penguin-cli@file:packages/cli':
resolution: {directory: packages/cli, type: directory}
@@ -961,6 +961,7 @@ packages:
'@prismshadow/penguin-core@file:packages/core':
resolution: {directory: packages/core, type: directory}
+ engines: {node: '>=24'}
'@prismshadow/penguin-server@file:packages/server':
resolution: {directory: packages/server, type: directory}
@@ -968,6 +969,7 @@ packages:
'@prismshadow/penguin-skills@file:packages/skills':
resolution: {directory: packages/skills, type: directory}
+ engines: {node: '>=24'}
'@protobufjs/[email protected]':
resolution: {integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==}
@@ -4503,7 +4505,7 @@ snapshots:
dependencies:
playwright: 1.61.1
dependencies:
'@anthropic-ai/bedrock-sdk': 0.26.4([email protected])
'@anthropic-ai/sdk': 0.91.1([email protected])
@@ -4518,7 +4520,7 @@ snapshots:
- ws
- zod
dependencies:
'@anthropic-ai/bedrock-sdk': 0.26.4([email protected])
'@anthropic-ai/sdk': 0.91.1([email protected])
@@ -4536,7 +4538,7 @@ snapshots:
'@prismshadow/penguin-cli@file:packages/cli([email protected])':
dependencies:
'@modelcontextprotocol/client': 2.0.0
- '@prismshadow/agenthub': 0.4.4([email protected])([email protected])
+ '@prismshadow/agenthub': 0.4.5([email protected])([email protected])
'@prismshadow/penguin-core': file:packages/core([email protected])
'@prismshadow/penguin-server': file:packages/server([email protected])
'@prismshadow/penguin-skills': file:packages/skills
@@ -4555,7 +4557,7 @@ snapshots:
'@prismshadow/penguin-core@file:packages/core([email protected])':
dependencies:
'@modelcontextprotocol/client': 2.0.0
- '@prismshadow/agenthub': 0.4.4([email protected])([email protected])
+ '@prismshadow/agenthub': 0.4.5([email protected])([email protected])
'@prismshadow/penguin-skills': file:packages/skills
arktype: 2.2.3
smol-toml: 1.6.1
@@ -4571,7 +4573,7 @@ snapshots:
'@prismshadow/penguin-core@file:packages/core([email protected])([email protected])':
dependencies:
'@modelcontextprotocol/client': 2.0.0
- '@prismshadow/agenthub': 0.4.4([email protected])([email protected])
+ '@prismshadow/agenthub': 0.4.5([email protected])([email protected])
'@prismshadow/penguin-skills': file:packages/skills
arktype: 2.2.3
smol-toml: 1.6.1
@@ -4587,7 +4589,7 @@ snapshots:
'@prismshadow/penguin-core@file:packages/core([email protected])([email protected])([email protected])':
dependencies:
'@modelcontextprotocol/client': 2.0.0
- '@prismshadow/agenthub': 0.4.4([email protected])([email protected])([email protected])
+ '@prismshadow/agenthub': 0.4.5([email protected])([email protected])([email protected])
'@prismshadow/penguin-skills': file:packages/skills
arktype: 2.2.3
smol-toml: 1.6.1
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index c4207e83..dda9be05 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -31,8 +31,8 @@ allowBuilds:
# targets NSIS only, so the script is deliberately not run.
electron-winstaller: false
# pnpm 11 withholds freshly published versions by default (supply-chain gate), which
-# would resolve agenthub back to 0.4.3 and lose the max thinking level. This package is
-# first-party, so the exemption carries no third-party risk. Remove the entry at the next
-# agenthub bump — by then 0.4.4 is long past the age gate.
+# would resolve agenthub back to 0.4.4 and keep an unknown stream event fatal. This package
+# is first-party, so the exemption carries no third-party risk. Remove the entry at the next
+# agenthub bump — by then 0.4.5 is long past the age gate.
minimumReleaseAgeExclude:
- - "@prismshadow/[email protected]"
+ - "@prismshadow/[email protected]"