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

推荐订阅源

H
Help Net Security
博客园_首页
酷 壳 – CoolShell
酷 壳 – CoolShell
G
Google Developers Blog
Jina AI
Jina AI
C
Check Point Blog
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
Last Week in AI
Last Week in AI
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
阮一峰的网络日志
阮一峰的网络日志
The Cloudflare Blog
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
WordPress大学
WordPress大学
博客园 - 聂微东
月光博客
月光博客
博客园 - 司徒正美
T
The Blog of Author Tim Ferriss
大猫的无限游戏
大猫的无限游戏
Microsoft Security Blog
Microsoft Security 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: preserve OpenAI Codex xhigh thinking policy · opencl...
steipete · 2026-05-01 · via Recent Commits to openclaw:main

@@ -1,21 +1,32 @@

1+

import fs from "node:fs";

2+

import path from "node:path";

13

import { normalizeProviderId } from "../agents/provider-id.js";

24

import type { ModelProviderConfig } from "../config/types.js";

35

import type { OpenClawConfig } from "../config/types.openclaw.js";

6+

import { resolveBundledPluginsDir } from "./bundled-dir.js";

47

import type {

58

ProviderApplyConfigDefaultsContext,

69

ProviderNormalizeConfigContext,

710

ProviderResolveConfigApiKeyContext,

811

} from "./provider-config-context.types.js";

12+

import type {

13+

ProviderDefaultThinkingPolicyContext,

14+

ProviderThinkingProfile,

15+

} from "./provider-thinking.types.js";

916

import { loadBundledPluginPublicArtifactModuleSync } from "./public-surface-loader.js";

10171118

const PROVIDER_POLICY_ARTIFACT_CANDIDATES = ["provider-policy-api.js"] as const;

19+

const providerPolicyPluginIdsByProviderId = new Map<string, string | null>();

12201321

export type BundledProviderPolicySurface = {

1422

normalizeConfig?: (ctx: ProviderNormalizeConfigContext) => ModelProviderConfig | null | undefined;

1523

applyConfigDefaults?: (

1624

ctx: ProviderApplyConfigDefaultsContext,

1725

) => OpenClawConfig | null | undefined;

1826

resolveConfigApiKey?: (ctx: ProviderResolveConfigApiKeyContext) => string | null | undefined;

27+

resolveThinkingProfile?: (

28+

ctx: ProviderDefaultThinkingPolicyContext,

29+

) => ProviderThinkingProfile | null | undefined;

1930

};

20312132

function hasProviderPolicyHook(

@@ -24,7 +35,8 @@ function hasProviderPolicyHook(

2435

return (

2536

typeof mod.normalizeConfig === "function" ||

2637

typeof mod.applyConfigDefaults === "function" ||

27-

typeof mod.resolveConfigApiKey === "function"

38+

typeof mod.resolveConfigApiKey === "function" ||

39+

typeof mod.resolveThinkingProfile === "function"

2840

);

2941

}

3042

@@ -54,12 +66,63 @@ function tryLoadBundledProviderPolicySurface(

5466

return null;

5567

}

566869+

function resolveBundledProviderPolicyPluginId(providerId: string): string | null {

70+

const normalizedProviderId = normalizeProviderId(providerId);

71+

if (!normalizedProviderId) {

72+

return null;

73+

}

74+

const bundledPluginsDir = resolveBundledPluginsDir();

75+

const cacheKey = `${bundledPluginsDir ?? "<none>"}::${normalizedProviderId}`;

76+

if (providerPolicyPluginIdsByProviderId.has(cacheKey)) {

77+

return providerPolicyPluginIdsByProviderId.get(cacheKey) ?? null;

78+

}

79+80+

if (!bundledPluginsDir || !fs.existsSync(bundledPluginsDir)) {

81+

providerPolicyPluginIdsByProviderId.set(cacheKey, null);

82+

return null;

83+

}

84+85+

for (const entry of fs

86+

.readdirSync(bundledPluginsDir, { withFileTypes: true })

87+

.filter((candidate) => candidate.isDirectory())

88+

.map((candidate) => candidate.name)

89+

.toSorted((left, right) => left.localeCompare(right))) {

90+

const manifestPath = path.join(bundledPluginsDir, entry, "openclaw.plugin.json");

91+

if (!fs.existsSync(manifestPath)) {

92+

continue;

93+

}

94+

let manifest: { providers?: unknown };

95+

try {

96+

manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8")) as { providers?: unknown };

97+

} catch {

98+

continue;

99+

}

100+

const providers = Array.isArray(manifest.providers) ? manifest.providers : [];

101+

const ownsProvider = providers.some(

102+

(candidate) =>

103+

typeof candidate === "string" && normalizeProviderId(candidate) === normalizedProviderId,

104+

);

105+

if (ownsProvider) {

106+

providerPolicyPluginIdsByProviderId.set(cacheKey, entry);

107+

return entry;

108+

}

109+

}

110+111+

providerPolicyPluginIdsByProviderId.set(cacheKey, null);

112+

return null;

113+

}

114+57115

export function resolveBundledProviderPolicySurface(

58116

providerId: string,

59117

): BundledProviderPolicySurface | null {

60118

const normalizedProviderId = normalizeProviderId(providerId);

61119

if (!normalizedProviderId) {

62120

return null;

63121

}

64-

return tryLoadBundledProviderPolicySurface(normalizedProviderId);

122+

return (

123+

tryLoadBundledProviderPolicySurface(normalizedProviderId) ??

124+

tryLoadBundledProviderPolicySurface(

125+

resolveBundledProviderPolicyPluginId(normalizedProviderId) ?? normalizedProviderId,

126+

)

127+

);

65128

}