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

推荐订阅源

The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
The Cloudflare Blog
G
Google Developers Blog
博客园_首页
Martin Fowler
Martin Fowler
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
D
Docker
C
Check Point Blog
T
Tailwind CSS Blog
博客园 - 司徒正美
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
Microsoft Security Blog
Microsoft Security Blog
V
V2EX
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
酷 壳 – CoolShell
酷 壳 – CoolShell
IT之家
IT之家
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 【当耐特】
GbyAI
GbyAI

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
refactor(agents): reuse shared error normalization · open...
vincentkoc · 2026-06-23 · via Recent Commits to openclaw:main

File tree

  • src/agents/sessions/tools

Original file line numberDiff line numberDiff line change

@@ -8,6 +8,7 @@ import { existsSync } from "node:fs";

88

import { Container, Text, truncateToWidth } from "@earendil-works/pi-tui";

99

import { resolveTimerTimeoutMs } from "@openclaw/normalization-core/number-coercion";

1010

import { Type } from "typebox";

11+

import { toErrorObject } from "../../../infra/errors.js";

1112

import { keyHint } from "../../modes/interactive/components/keybinding-hints.js";

1213

import { truncateToVisualLines } from "../../modes/interactive/components/visual-truncate.js";

1314

import { theme } from "../../modes/interactive/theme/theme.js";

@@ -121,7 +122,7 @@ export function createLocalBashOperations(options?: { shellPath?: string }): Bas

121122

if (signal) {

122123

signal.removeEventListener("abort", onAbort);

123124

}

124-

reject(toLintErrorObject(err, "Non-Error rejection"));

125+

reject(toErrorObject(err, "Non-Error rejection"));

125126

});

126127

});

127128

},

@@ -473,17 +474,3 @@ export function createBashTool(

473474

): AgentTool<typeof bashSchema> {

474475

return wrapToolDefinition(createBashToolDefinition(cwd, options));

475476

}

476-
477-

function toLintErrorObject(value: unknown, fallbackMessage: string): Error {

478-

if (value instanceof Error) {

479-

return value;

480-

}

481-

if (typeof value === "string") {

482-

return new Error(value);

483-

}

484-

const error = new Error(fallbackMessage, { cause: value });

485-

if ((typeof value === "object" && value !== null) || typeof value === "function") {

486-

Object.assign(error, value);

487-

}

488-

return error;

489-

}

Original file line numberDiff line numberDiff line change

@@ -7,6 +7,7 @@ import { existsSync, readdirSync, statSync } from "node:fs";

77

import nodePath from "node:path";

88

import { Text } from "@earendil-works/pi-tui";

99

import { Type } from "typebox";

10+

import { toErrorObject } from "../../../infra/errors.js";

1011

import type { AgentTool } from "../../runtime/index.js";

1112

import type { ToolDefinition, ToolRenderResultOptions } from "../extensions/types.js";

1213

import { normalizePositiveLimit } from "./limits.js";

@@ -216,7 +217,7 @@ export function createLsToolDefinition(

216217

});

217218

} catch (e: unknown) {

218219

signal?.removeEventListener("abort", onAbort);

219-

reject(toLintErrorObject(e, "Non-Error rejection"));

220+

reject(toErrorObject(e, "Non-Error rejection"));

220221

}

221222

})();

222223

});

@@ -237,17 +238,3 @@ export function createLsToolDefinition(

237238

export function createLsTool(cwd: string, options?: LsToolOptions): AgentTool<typeof lsSchema> {

238239

return wrapToolDefinition(createLsToolDefinition(cwd, options));

239240

}

240-
241-

function toLintErrorObject(value: unknown, fallbackMessage: string): Error {

242-

if (value instanceof Error) {

243-

return value;

244-

}

245-

if (typeof value === "string") {

246-

return new Error(value);

247-

}

248-

const error = new Error(fallbackMessage, { cause: value });

249-

if ((typeof value === "object" && value !== null) || typeof value === "function") {

250-

Object.assign(error, value);

251-

}

252-

return error;

253-

}

Original file line numberDiff line numberDiff line change

@@ -8,6 +8,7 @@ import { access as fsAccess, readFile as fsReadFile } from "node:fs/promises";

88

import { basename, dirname, isAbsolute, relative, resolve as resolvePath, sep } from "node:path";

99

import { Text } from "@earendil-works/pi-tui";

1010

import { Type } from "typebox";

11+

import { toErrorObject } from "../../../infra/errors.js";

1112

import { decodeWindowsTextFileBuffer } from "../../../infra/windows-encoding.js";

1213

import type { ImageContent, Model, TextContent } from "../../../llm/types.js";

1314

import {

@@ -409,7 +410,7 @@ export function createReadToolDefinition(

409410

} catch (error: unknown) {

410411

signal?.removeEventListener("abort", onAbort);

411412

if (!aborted) {

412-

reject(toLintErrorObject(error, "Non-Error rejection"));

413+

reject(toErrorObject(error, "Non-Error rejection"));

413414

}

414415

}

415416

})();

@@ -451,17 +452,3 @@ export function createReadTool(

451452

): AgentTool<typeof readSchema> {

452453

return wrapToolDefinition(createReadToolDefinition(cwd, options));

453454

}

454-
455-

function toLintErrorObject(value: unknown, fallbackMessage: string): Error {

456-

if (value instanceof Error) {

457-

return value;

458-

}

459-

if (typeof value === "string") {

460-

return new Error(value);

461-

}

462-

const error = new Error(fallbackMessage, { cause: value });

463-

if ((typeof value === "object" && value !== null) || typeof value === "function") {

464-

Object.assign(error, value);

465-

}

466-

return error;

467-

}