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

推荐订阅源

V
V2EX
J
Java Code Geeks
月光博客
月光博客
博客园_首页
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
B
Blog RSS Feed
博客园 - 聂微东
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
Jina AI
Jina AI
S
SegmentFault 最新的问题
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
The Cloudflare Blog
量子位
Martin Fowler
Martin Fowler
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗

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(core): restore typecheck helpers · openclaw/openclaw@...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main

File tree

    • agents/embedded-agent-runner

Original file line numberDiff line numberDiff line change

@@ -533,11 +533,11 @@ describe("truncateOversizedToolResultsInMessages", () => {

533533

] as never;

534534

truncateOversizedToolResultsInMessages([source], 128_000, 12_000, 12_000, projectionState);

535535
536-

const providerMessage = {

536+

const providerMessage: ToolResultMessage = {

537537

...source,

538538

content: [

539-

{ type: "text", text: "Image reading is disabled." },

540-

{ type: "text", text: "x".repeat(15_000) },

539+

{ type: "text" as const, text: "Image reading is disabled." },

540+

{ type: "text" as const, text: "x".repeat(15_000) },

541541

],

542542

};

543543

const result = truncateOversizedToolResultsInMessages(

@@ -546,7 +546,7 @@ describe("truncateOversizedToolResultsInMessages", () => {

546546

12_000,

547547

12_000,

548548

projectionState,

549-

).messages[0];

549+

).messages[0] as ToolResultMessage | undefined;

550550
551551

expect(result?.content?.[0]).toEqual({

552552

type: "text",

Original file line numberDiff line numberDiff line change

@@ -393,7 +393,7 @@ export function truncateOversizedToolResultsInMessages(

393393

}

394394

}

395395

if (plan.replacements.length === 0) {

396-

const projectedMessages = branch.map((entry) => entry.message as AgentMessage);

396+

const projectedMessages = branch.map((entry) => entry.message);

397397

const hasProjectedChanges = projectedMessages.some(

398398

(message, index) => message !== messages[index],

399399

);

@@ -555,7 +555,7 @@ function mergeProjectedToolResultMessage(

555555

return block;

556556

}

557557

const projectedBlock = projectedText[textIndex++];

558-

return projectedBlock ? { ...block, text: projectedBlock.text } : block;

558+

return projectedBlock ? Object.assign({}, block, { text: projectedBlock.text }) : block;

559559

});

560560

return { ...message, content: mergedContent } as AgentMessage;

561561

}

@@ -588,7 +588,7 @@ function buildAggregateToolResultReplacements(params: {

588588

(

589589

item,

590590

): item is {

591-

entry: { id: string; type: string; message: AgentMessage };

591+

entry: { id: string; type: string; message: AgentMessage; aggregateEligible?: boolean };

592592

index: number;

593593

} =>

594594

item.entry.type === "message" &&

@@ -697,7 +697,7 @@ function clearToolResultText(message: AgentMessage): AgentMessage {

697697

...message,

698698

content: content.map((block) =>

699699

block && typeof block === "object" && (block as { type?: unknown }).type === "text"

700-

? { ...block, text: "" }

700+

? Object.assign({}, block, { text: "" })

701701

: block,

702702

),

703703

} as AgentMessage;

Original file line numberDiff line numberDiff line change

@@ -38,6 +38,25 @@ export function resolveModelFallbackOptions(

3838

};

3939

}

4040
41+

/** Resolves whether final-answer tags should be enforced for an embedded follow-up run. */

42+

export function resolveEnforceFinalTagWithResolver(

43+

run: FollowupRun["run"],

44+

provider: string,

45+

model: string,

46+

isReasoningTagProvider?: ReasoningTagProviderResolver,

47+

): boolean {

48+

return (

49+

(run.skipProviderRuntimeHints ? false : undefined) ??

50+

(run.enforceFinalTag ||

51+

isReasoningTagProvider?.(provider, {

52+

config: run.config,

53+

workspaceDir: run.workspaceDir,

54+

modelId: model,

55+

}) ||

56+

false)

57+

);

58+

}

59+
4160

/** Builds the shared embedded-agent run params from a queued follow-up run. */

4261

export function buildEmbeddedRunBaseParams(params: {

4362

run: FollowupRun["run"];

@@ -58,15 +77,12 @@ export function buildEmbeddedRunBaseParams(params: {

5877

modelOverrideSource: params.run.modelOverrideSource,

5978

hasAutoFallbackProvenance: params.run.hasAutoFallbackProvenance === true,

6079

});

61-

const enforceFinalTag =

62-

(params.run.skipProviderRuntimeHints ? false : undefined) ??

63-

(params.run.enforceFinalTag ||

64-

params.isReasoningTagProvider?.(params.provider, {

65-

config,

66-

workspaceDir: params.run.workspaceDir,

67-

modelId: params.model,

68-

}) ||

69-

false);

80+

const enforceFinalTag = resolveEnforceFinalTagWithResolver(

81+

params.run,

82+

params.provider,

83+

params.model,

84+

params.isReasoningTagProvider,

85+

);

7086

// Runtime policy keys may differ from session keys for direct-message scoped policy.

7187

return {

7288

sessionFile: params.run.sessionFile,