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

推荐订阅源

L
LangChain Blog
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
Vercel News
Vercel News
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
Last Week in AI
Last Week in AI
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
云风的 BLOG
云风的 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
chore(deadcode): share runner tool-call type guard · open...
vincentkoc · 2026-06-21 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -9,6 +9,7 @@ import type { AgentMessage } from "../../runtime/index.js";

99

import { stripToolResultDetails } from "../../session-transcript-repair.js";

1010

import { normalizeAssistantReplayContent } from "../replay-history.js";

1111

import { markTranscriptPromptText } from "../tool-result-context-guard.js";

12+

import { isRunnerToolCallBlockType } from "./attempt.tool-call-block-type.js";

1213

import type { RuntimeContextCustomMessage } from "./runtime-context-prompt.js";

1314
1415

type LlmBoundaryOptions = {

@@ -633,6 +634,6 @@ function isToolCallAssistantMessage(message: AgentMessage): boolean {

633634

return false;

634635

}

635636

const type = (block as { type?: unknown }).type;

636-

return type === "toolCall" || type === "toolUse" || type === "functionCall";

637+

return isRunnerToolCallBlockType(type);

637638

});

638639

}

Original file line numberDiff line numberDiff line change

@@ -10,12 +10,9 @@ import {

1010

createHtmlEntityToolCallArgumentDecodingWrapper,

1111

decodeHtmlEntitiesInObject,

1212

} from "../tool-call-argument-decoding.js";

13+

import { isRunnerToolCallBlockType } from "./attempt.tool-call-block-type.js";

1314

import { wrapStreamObjectEvents } from "./stream-wrapper.js";

1415
15-

function isToolCallBlockType(type: unknown): boolean {

16-

return type === "toolCall" || type === "toolUse" || type === "functionCall";

17-

}

18-
1916

const MAX_TOOLCALL_REPAIR_BUFFER_CHARS = 64_000;

2017

const MAX_TOOLCALL_REPAIR_LEADING_CHARS = 96;

2118

const MAX_TOOLCALL_REPAIR_TRAILING_CHARS = 3;

@@ -581,7 +578,7 @@ function readToolCallNameInMessage(message: unknown, contentIndex: number): stri

581578

return undefined;

582579

}

583580

const typedBlock = block as { type?: unknown; name?: unknown };

584-

if (!isToolCallBlockType(typedBlock.type) || typeof typedBlock.name !== "string") {

581+

if (!isRunnerToolCallBlockType(typedBlock.type) || typeof typedBlock.name !== "string") {

585582

return undefined;

586583

}

587584

return normalizeToolCallRepairToolName(typedBlock.name);

@@ -604,7 +601,7 @@ function repairToolCallArgumentsInMessage(

604601

return;

605602

}

606603

const typedBlock = block as { type?: unknown; arguments?: unknown };

607-

if (!isToolCallBlockType(typedBlock.type)) {

604+

if (!isRunnerToolCallBlockType(typedBlock.type)) {

608605

return;

609606

}

610607

typedBlock.arguments = repairedArgs;

@@ -623,7 +620,7 @@ function hasMeaningfulToolCallArgumentsInMessage(message: unknown, contentIndex:

623620

return false;

624621

}

625622

const typedBlock = block as { type?: unknown; arguments?: unknown };

626-

if (!isToolCallBlockType(typedBlock.type)) {

623+

if (!isRunnerToolCallBlockType(typedBlock.type)) {

627624

return false;

628625

}

629626

return (

@@ -647,7 +644,7 @@ function clearToolCallArgumentsInMessage(message: unknown, contentIndex: number)

647644

return;

648645

}

649646

const typedBlock = block as { type?: unknown; arguments?: unknown };

650-

if (!isToolCallBlockType(typedBlock.type)) {

647+

if (!isRunnerToolCallBlockType(typedBlock.type)) {

651648

return;

652649

}

653650

typedBlock.arguments = {};

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,3 @@

1+

export function isRunnerToolCallBlockType(type: unknown): boolean {

2+

return type === "toolCall" || type === "toolUse" || type === "functionCall";

3+

}

Original file line numberDiff line numberDiff line change

@@ -31,6 +31,7 @@ import {

3131

import { couldNormalizeToolNamePrefixToAllowedTool, normalizeToolName } from "../../tool-policy.js";

3232

import { shouldAllowProviderOwnedThinkingReplay } from "../../transcript-policy.js";

3333

import type { TranscriptPolicy } from "../../transcript-policy.js";

34+

import { isRunnerToolCallBlockType } from "./attempt.tool-call-block-type.js";

3435

import { wrapStreamObjectEvents } from "./stream-wrapper.js";

3536
3637

const BLANK_TOOL_CALL_NAME_DESCRIPTION = "blank tool name";

@@ -238,10 +239,6 @@ function normalizeToolCallNameForDispatch(

238239

return resolveStructuredAllowedToolName(trimmed, allowedToolNames) ?? trimmed;

239240

}

240241
241-

function isToolCallBlockType(type: unknown): boolean {

242-

return type === "toolCall" || type === "toolUse" || type === "functionCall";

243-

}

244-
245242

const REPLAY_TOOL_CALL_NAME_MAX_CHARS = 64;

246243
247244

type ReplayToolCallBlock = {

@@ -298,7 +295,7 @@ function isReplayToolCallBlock(block: unknown): block is ReplayToolCallBlock {

298295

if (!block || typeof block !== "object") {

299296

return false;

300297

}

301-

return isToolCallBlockType((block as { type?: unknown }).type);

298+

return isRunnerToolCallBlockType((block as { type?: unknown }).type);

302299

}

303300
304301

function replayToolCallHasInput(block: ReplayToolCallBlock): boolean {

@@ -533,7 +530,7 @@ function sanitizeAnthropicReplayToolResults(

533530

continue;

534531

}

535532

const typedBlock = block as { type?: unknown; id?: unknown };

536-

if (!isToolCallBlockType(typedBlock.type) || typeof typedBlock.id !== "string") {

533+

if (!isRunnerToolCallBlockType(typedBlock.type) || typeof typedBlock.id !== "string") {

537534

continue;

538535

}

539536

const trimmedId = typedBlock.id.trim();

@@ -625,7 +622,7 @@ function normalizeToolCallIdsInMessage(message: unknown): void {

625622

continue;

626623

}

627624

const typedBlock = block as { type?: unknown; id?: unknown };

628-

if (!isToolCallBlockType(typedBlock.type) || typeof typedBlock.id !== "string") {

625+

if (!isRunnerToolCallBlockType(typedBlock.type) || typeof typedBlock.id !== "string") {

629626

continue;

630627

}

631628

const trimmedId = typedBlock.id.trim();

@@ -642,7 +639,7 @@ function normalizeToolCallIdsInMessage(message: unknown): void {

642639

continue;

643640

}

644641

const typedBlock = block as { type?: unknown; id?: unknown };

645-

if (!isToolCallBlockType(typedBlock.type)) {

642+

if (!isRunnerToolCallBlockType(typedBlock.type)) {

646643

continue;

647644

}

648645

if (typeof typedBlock.id === "string") {

@@ -674,7 +671,7 @@ function trimWhitespaceFromToolCallNamesInMessage(

674671

): void {

675672

visitObjectContentBlocks(message, (block) => {

676673

const typedBlock = block as { type?: unknown; name?: unknown; id?: unknown };

677-

if (!isToolCallBlockType(typedBlock.type)) {

674+

if (!isRunnerToolCallBlockType(typedBlock.type)) {

678675

return;

679676

}

680677

const rawId = typeof typedBlock.id === "string" ? typedBlock.id : undefined;

@@ -721,7 +718,7 @@ function classifyToolCallMessage(

721718

continue;

722719

}

723720

const typedBlock = block as { type?: unknown; name?: unknown };

724-

if (!isToolCallBlockType(typedBlock.type)) {

721+

if (!isRunnerToolCallBlockType(typedBlock.type)) {

725722

continue;

726723

}

727724

sawToolCall = true;