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

推荐订阅源

Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog
Y
Y Combinator Blog
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
量子位
The Cloudflare Blog
T
The Blog of Author Tim Ferriss
博客园_首页
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
L
LangChain 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(ci): clean core unsafe assertions · openclaw/openclaw...
steipete · 2026-05-31 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -8,8 +8,10 @@ const packageRootCache = new Map<string, string | null>();

88

const argv1CandidateCache = new Map<string, string[]>();

99
1010

function parsePackageName(raw: string): string | null {

11-

const parsed = JSON.parse(raw) as { name?: unknown };

12-

return typeof parsed.name === "string" ? parsed.name : null;

11+

const parsed: unknown = JSON.parse(raw);

12+

return parsed && typeof parsed === "object" && "name" in parsed && typeof parsed.name === "string"

13+

? parsed.name

14+

: null;

1315

}

1416
1517

async function readPackageName(dir: string): Promise<string | null> {

Original file line numberDiff line numberDiff line change

@@ -7,8 +7,13 @@ export const OPENCLAW_DEV_SOURCE_ROOT_ENV = "OPENCLAW_DEV_SOURCE_ROOT";

77
88

function readPackageName(packageJsonPath: string): string | null {

99

try {

10-

const parsed = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")) as { name?: unknown };

11-

return typeof parsed.name === "string" ? parsed.name : null;

10+

const parsed: unknown = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));

11+

return parsed &&

12+

typeof parsed === "object" &&

13+

"name" in parsed &&

14+

typeof parsed.name === "string"

15+

? parsed.name

16+

: null;

1217

} catch {

1318

return null;

1419

}

Original file line numberDiff line numberDiff line change

@@ -41,6 +41,7 @@ export class PluginLruCache<T> {

4141

if (!this.#entries.has(cacheKey)) {

4242

return { hit: false };

4343

}

44+

// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Map.has proves the value exists while preserving caller-specific cache value type.

4445

const cached = this.#entries.get(cacheKey) as T;

4546

this.#entries.delete(cacheKey);

4647

this.#entries.set(cacheKey, cached);

@@ -88,6 +89,7 @@ export function resolveConfigScopedRuntimeCacheValue<T>(params: {

8889

params.cache.set(params.config, configCache);

8990

}

9091

if (configCache.has(params.key)) {

92+

// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Map.has proves the value exists while preserving caller-specific cache value type.

9193

return configCache.get(params.key) as T;

9294

}

9395

const loaded = params.load();

Original file line numberDiff line numberDiff line change

@@ -61,6 +61,13 @@ const pluginModuleLoaderStats = {

6161

sourceTransformTargets: new Map<string, number>(),

6262

};

6363
64+

function isJitiLoaderModule(value: unknown): value is { createJiti: PluginModuleLoaderFactory } {

65+

const canHaveProperties = (value && typeof value === "object") || typeof value === "function";

66+

return Boolean(

67+

canHaveProperties && "createJiti" in value && typeof value.createJiti === "function",

68+

);

69+

}

70+
6471

function recordSourceTransformTarget(target: string): void {

6572

const current = pluginModuleLoaderStats.sourceTransformTargets.get(target) ?? 0;

6673

pluginModuleLoaderStats.sourceTransformTargets.set(target, current + 1);

@@ -107,8 +114,8 @@ function loadCreateJitiLoaderFactory(): PluginModuleLoaderFactory {

107114

if (createJitiLoaderFactory) {

108115

return createJitiLoaderFactory;

109116

}

110-

const loaded = requireForJiti("jiti") as { createJiti?: PluginModuleLoaderFactory };

111-

if (typeof loaded.createJiti !== "function") {

117+

const loaded: unknown = requireForJiti("jiti");

118+

if (!isJitiLoaderModule(loaded)) {

112119

throw new Error("jiti module did not export createJiti");

113120

}

114121

createJitiLoaderFactory = loaded.createJiti;

Original file line numberDiff line numberDiff line change

@@ -32,13 +32,17 @@ export type ResolvedTranscriptsConfig = {

3232

autoStart: ResolvedTranscriptsAutoStartConfig[];

3333

};

3434
35+

function isRecord(value: unknown): value is Record<string, unknown> {

36+

return Boolean(value && typeof value === "object" && !Array.isArray(value));

37+

}

38+
3539

function resolveAutoStart(raw: unknown): ResolvedTranscriptsAutoStartConfig[] {

3640

if (!Array.isArray(raw)) {

3741

return [];

3842

}

3943

return raw

4044

.map((entry): ResolvedTranscriptsAutoStartConfig | undefined => {

41-

const config = entry && typeof entry === "object" ? (entry as Record<string, unknown>) : {};

45+

const config = isRecord(entry) ? entry : {};

4246

const providerId = readString(config.providerId);

4347

if (!providerId) {

4448

return undefined;

@@ -57,7 +61,7 @@ function resolveAutoStart(raw: unknown): ResolvedTranscriptsAutoStartConfig[] {

5761

}

5862
5963

export function resolveTranscriptsConfig(raw: unknown): ResolvedTranscriptsConfig {

60-

const config = raw && typeof raw === "object" ? (raw as Record<string, unknown>) : {};

64+

const config = isRecord(raw) ? raw : {};

6165

const maxUtterances =

6266

typeof config.maxUtterances === "number" && Number.isFinite(config.maxUtterances)

6367

? Math.max(1, Math.min(10_000, Math.floor(config.maxUtterances)))

Original file line numberDiff line numberDiff line change

@@ -32,6 +32,7 @@ export const clamp = clampNumber;

3232

// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- JSON parsing helper lets callers ascribe the expected payload type.

3333

export function safeParseJson<T>(raw: string): T | null {

3434

try {

35+

// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- JSON parsing helper lets callers ascribe the expected payload type.

3536

return JSON.parse(raw) as T;

3637

} catch {

3738

return null;

Original file line numberDiff line numberDiff line change

@@ -10,8 +10,6 @@ export type ResolvedReactionLevel = {

1010

agentReactionGuidance?: "minimal" | "extensive";

1111

};

1212
13-

const LEVELS = new Set<ReactionLevel>(["off", "ack", "minimal", "extensive"]);

14-
1513

function parseLevel(

1614

value: unknown,

1715

): { kind: "missing" } | { kind: "invalid" } | { kind: "ok"; value: ReactionLevel } {

@@ -25,8 +23,12 @@ function parseLevel(

2523

if (!trimmed) {

2624

return { kind: "missing" };

2725

}

28-

if (LEVELS.has(trimmed as ReactionLevel)) {

29-

return { kind: "ok", value: trimmed as ReactionLevel };

26+

switch (trimmed) {

27+

case "off":

28+

case "ack":

29+

case "minimal":

30+

case "extensive":

31+

return { kind: "ok", value: trimmed };

3032

}

3133

return { kind: "invalid" };

3234

}