惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
月光博客
月光博客
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
IT之家
IT之家
美团技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Cloudflare Blog
博客园 - 司徒正美
爱范儿
爱范儿

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: keep copilot on boundary-aware stream path · opencla...
steipete · 2026-04-25 · via Recent Commits to openclaw:main

@@ -1,5 +1,4 @@

11

import type { StreamFn } from "@mariozechner/pi-agent-core";

2-

import { streamSimple } from "@mariozechner/pi-ai";

32

import type { ProviderWrapStreamFnContext } from "openclaw/plugin-sdk/plugin-entry";

43

import {

54

applyAnthropicEphemeralCacheControlMarkers,

@@ -23,8 +22,26 @@ function patchOnPayloadResult(result: unknown): unknown {

2322

return result;

2423

}

252426-

export function wrapCopilotAnthropicStream(baseStreamFn: StreamFn | undefined): StreamFn {

27-

const underlying = baseStreamFn ?? streamSimple;

25+

function buildCopilotRequestHeaders(

26+

context: Parameters<StreamFn>[1],

27+

headers: Record<string, string> | undefined,

28+

): Record<string, string> {

29+

return {

30+

...buildCopilotDynamicHeaders({

31+

messages: context.messages,

32+

hasImages: hasCopilotVisionInput(context.messages),

33+

}),

34+

...headers,

35+

};

36+

}

37+38+

export function wrapCopilotAnthropicStream(

39+

baseStreamFn: StreamFn | undefined,

40+

): StreamFn | undefined {

41+

if (!baseStreamFn) {

42+

return undefined;

43+

}

44+

const underlying = baseStreamFn;

2845

return (model, context, options) => {

2946

if (model.provider !== "github-copilot" || model.api !== "anthropic-messages") {

3047

return underlying(model, context, options);

@@ -36,21 +53,20 @@ export function wrapCopilotAnthropicStream(baseStreamFn: StreamFn | undefined):

3653

context,

3754

{

3855

...options,

39-

headers: {

40-

...buildCopilotDynamicHeaders({

41-

messages: context.messages,

42-

hasImages: hasCopilotVisionInput(context.messages),

43-

}),

44-

...options?.headers,

45-

},

56+

headers: buildCopilotRequestHeaders(context, options?.headers),

4657

},

4758

applyAnthropicEphemeralCacheControlMarkers,

4859

);

4960

};

5061

}

516252-

export function wrapCopilotOpenAIResponsesStream(baseStreamFn: StreamFn | undefined): StreamFn {

53-

const underlying = baseStreamFn ?? streamSimple;

63+

export function wrapCopilotOpenAIResponsesStream(

64+

baseStreamFn: StreamFn | undefined,

65+

): StreamFn | undefined {

66+

if (!baseStreamFn) {

67+

return undefined;

68+

}

69+

const underlying = baseStreamFn;

5470

return (model, context, options) => {

5571

if (model.provider !== "github-copilot" || model.api !== "openai-responses") {

5672

return underlying(model, context, options);

@@ -59,13 +75,7 @@ export function wrapCopilotOpenAIResponsesStream(baseStreamFn: StreamFn | undefi

5975

const originalOnPayload = options?.onPayload;

6076

const wrappedOptions: StreamOptions = {

6177

...options,

62-

headers: {

63-

...buildCopilotDynamicHeaders({

64-

messages: context.messages,

65-

hasImages: hasCopilotVisionInput(context.messages),

66-

}),

67-

...options?.headers,

68-

},

78+

headers: buildCopilotRequestHeaders(context, options?.headers),

6979

onPayload: (payload, payloadModel) => {

7080

rewriteCopilotResponsePayloadConnectionBoundIds(payload);

7181

return patchOnPayloadResult(originalOnPayload?.(payload, payloadModel));

@@ -75,6 +85,6 @@ export function wrapCopilotOpenAIResponsesStream(baseStreamFn: StreamFn | undefi

7585

};

7686

}

778778-

export function wrapCopilotProviderStream(ctx: ProviderWrapStreamFnContext): StreamFn {

88+

export function wrapCopilotProviderStream(ctx: ProviderWrapStreamFnContext): StreamFn | undefined {

7989

return wrapCopilotOpenAIResponsesStream(wrapCopilotAnthropicStream(ctx.streamFn));

8090

}