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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
Cisco Talos Blog
Cisco Talos Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
D
Docker
S
SegmentFault 最新的问题
博客园 - 聂微东
美团技术团队
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
M
MIT News - Artificial intelligence
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
GbyAI
GbyAI
L
LangChain Blog
Vercel News
Vercel News
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
Stack Overflow Blog
Stack Overflow Blog
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
Engineering at Meta
Engineering at Meta
T
Threat Research - Cisco Blogs
T
Threatpost
Scott Helme
Scott Helme
T
Tailwind CSS Blog
Latest news
Latest news
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
The Register - Security
The Register - Security
罗磊的独立博客
P
Proofpoint News Feed
腾讯CDC
S
Schneier on Security
雷峰网
雷峰网
A
About on SuperTechFans
T
Tenable Blog
F
Full Disclosure
Cyberwarzone
Cyberwarzone
博客园_首页
有赞技术团队
有赞技术团队
K
Kaspersky official blog

Recent Commits to openclaw:main

test(gateway): avoid brittle shutdown timer assertion · openclaw/openclaw@b7232db fix(mcp): bound channel bridge pending approvals · openclaw/openclaw@c6b1fed feat(cli): add sessions tail progress view · openclaw/openclaw@c80ec43 docs(changelog): restore 2026.5.28 release credits · openclaw/openclaw@b6891d2 docs(changelog): require complete release credits · openclaw/openclaw@ec78a21 perf: fast path session store json parsing · openclaw/openclaw@be3af54 refactor(agents): bind subagent threads in core (#88416) · openclaw/openclaw@3fc0df9 fix: skip browser cleanup when browser is disabled · openclaw/openclaw@4ac90a5 perf: skip unnecessary setup auth fallback · openclaw/openclaw@39e9873 ci(release): allow direct publish recovery · openclaw/openclaw@50b7a2f ci(release): checkout approval helper · openclaw/openclaw@427df01 test(scripts): expose kitchen sink command RSS · openclaw/openclaw@b93ed3f refactor(msteams): persist conversation and poll stores in sqlite · openclaw/openclaw@a2b2c4a fix(agents): dedupe subagent browser session cleanup · openclaw/openclaw@a9a86f7 fix(build): avoid stale agent-core dts warnings (#87915) · openclaw/openclaw@371a8ab Move cron persistence to SQLite (#88285) · openclaw/openclaw@005da57 fix(ui): keep selected chat model visible after session switch · openclaw/openclaw@d11e82a fix(llm): repair invalid streaming unicode escapes ci: update Blacksmith Testbox actions refactor: move model catalog normalization into core package fix(codex): keep app-server continuation turns alive · openclaw/openclaw@961691d test(agents): wait for MCP method-not-found log · openclaw/openclaw@2780f54 fix(scripts): quiet minimal runtime asset copies · openclaw/openclaw@37058ad ci: skip codeql network shard for test-only changes · openclaw/openclaw@37c6e2d fix: remove redundant unknown union ci: keep harness changes on fast checks (#88429) · openclaw/openclaw@e24a9c5 chore: remove inert skill workshop package · openclaw/openclaw@d9c0d09 fix(auth): bound oauth mirror expiry · openclaw/openclaw@0c7ab41 fix(export-html): guard msg.content and result.content filter/iterati… · openclaw/openclaw@5811693 fix(agents): bound auth health expiry · openclaw/openclaw@445ff22 ci: stabilize changed checks · openclaw/openclaw@602364f fix(agents): bound discovery auth expiry · openclaw/openclaw@c73e8ee fix: harden skill workshop proposal results · openclaw/openclaw@7d19f89 fix: preserve trusted policy checks for skill workshop · openclaw/openclaw@908fc35 fix: refresh skill workshop generated surfaces · openclaw/openclaw@77c6bee refactor: move skill research capture logic · openclaw/openclaw@6eb6730 fix: serialize skill proposal lifecycle mutations · openclaw/openclaw@41044a2 fix: keep autonomous skill capture opt-in · openclaw/openclaw@43e4b9d fix: allow concise skill update descriptions · openclaw/openclaw@28290a4 fix: preserve auto-captured skill updates · openclaw/openclaw@0b49710 fix: scan skill proposal prompt content · openclaw/openclaw@131e662 fix: refresh skill workshop CI expectations · openclaw/openclaw@515d4ff chore: keep skill workshop package manifest inert · openclaw/openclaw@dcc329a fix: align skill proposal revise validation · openclaw/openclaw@7051bf1 fix: approve final skill workshop tool params · openclaw/openclaw@3cd368e fix: serialize skill proposal creation limits · openclaw/openclaw@d6d1cc2 fix: bound skill workshop descriptions · openclaw/openclaw@3a9e7df refactor: rename skill workshop agent tool · openclaw/openclaw@2383cfd fix: enforce skill workshop proposal bounds · openclaw/openclaw@e4905ce fix(plugin-sdk): bound oauth result expiry fix(agents): harden message dts and block timestamps fix(outbound): bound delivery recovery deadline fix(shared): bound epoch expiry helpers fix(media): bound provider operation deadlines · openclaw/openclaw@06e0fd3 fix(agents): bound run drain deadlines · openclaw/openclaw@51cceaf fix(github-copilot): bound device code expiry feat: improve MCP operability fix(models): bound pasted token expiry · openclaw/openclaw@9cb9851 fix(plugins): bound scheduled turn delays fix(skill-creator): sort .skill entries deterministically · openclaw/openclaw@878e433 fix(qqbot): bound reminder schedule time fix(memory): bound qmd embed backoff · openclaw/openclaw@caac973 fix(discord): bound timeout member expiry · openclaw/openclaw@6399b6a fix(qqbot): skip token cache on invalid clock · openclaw/openclaw@472606d fix(infra): bound device bootstrap expiry · openclaw/openclaw@1774965 fix(cron): bound relative at timestamps · openclaw/openclaw@e0248fc fix(crestodian): bound rescue approval expiry · openclaw/openclaw@6a753ad fix(agents): bound codex cli fallback expiry · openclaw/openclaw@53812bd fix(gateway): forward stop sequences across providers · openclaw/openclaw@fe3c3ac feat: expand workboard orchestration metadata (#88408) · openclaw/openclaw@5435b45 fix(discord): bound rest rate-limit deadlines · openclaw/openclaw@abc26b0 fix(agents): show exec target node in tool display · openclaw/openclaw@64533ba fix(telegram): bound transport cooldown expiry · openclaw/openclaw@7d4bf8f test(release): harden live release checks · openclaw/openclaw@bdb0fde fix(anthropic): bound setup token expiry · openclaw/openclaw@926a165 fix(bedrock): bound mantle runtime token expiry · openclaw/openclaw@70b6fdd fix(agents): bound sqlite cache expiry · openclaw/openclaw@9ad7f5b fix(agents): bound google prompt cache expiry · openclaw/openclaw@1ee751d fix(agents): bound auth profile block expiry · openclaw/openclaw@30e3ca0 fix(telegram): bound error cooldown expiry · openclaw/openclaw@1f6c1ea fix(discord): bound component registry expiry · openclaw/openclaw@8654353 fix(discord): carry reply typing feedback through queue · openclaw/openclaw@6f20f29 fix(discord): omit undefined component registry fields fix(gateway): bound node pending work expiry fix(gateway): explain ignored restart signal · openclaw/openclaw@bc77f7a fix(media): dedupe duplicate inbound media path urls fix(gateway): bound plugin node capability expiry fix(install): show npm install progress without gum · openclaw/openclaw@1c9851e fix(commitments): bound terminal failure cooldown expiry · openclaw/openclaw@a4f6240 test(tasks): cover task domain view mappers (#86755) · openclaw/openclaw@8d3fe21 fix(imessage): bound private api negative cache expiry refactor(matrix): move ephemeral state to plugin sqlite (#88387) fix(imessage): bound approval reaction poll expiry fix(agents): bound exec followup handoff expiry · openclaw/openclaw@cbad1b6 fix(sandbox): bound novnc observer token expiry · openclaw/openclaw@f4cd5e4 test(release): wait for live probe cleanup · openclaw/openclaw@0e7773d fix(agents): bound exec approval request expiry · openclaw/openclaw@d8e7734 fix(google): bound realtime browser session expiry · openclaw/openclaw@da7fb64 fix(msteams): bound delegated token expiry · openclaw/openclaw@3fffb34 fix(workboard): bound claim expiry checks · openclaw/openclaw@0dd67e2
refactor: extract web content core package (#88346) · openclaw/openclaw@a20b2dc
steipete · 2026-05-31 · via Recent Commits to openclaw:main

@@ -0,0 +1,136 @@

1+

//#region packages/web-content-core/src/provider-runtime-shared.ts

2+

const DEFAULT_SECRET_PROVIDER_ALIAS = "default";

3+

const ENV_SECRET_REF_ID_RE = /^[A-Z][A-Z0-9_]{0,127}$/;

4+

const LEGACY_SECRETREF_ENV_MARKER_PREFIX = "secretref-env:";

5+

const LEGACY_DOUBLE_UNDERSCORE_ENV_MARKER_PREFIX = "__env__:";

6+

const ENV_SECRET_TEMPLATE_RE = /^\$\{([A-Z][A-Z0-9_]{0,127})\}$/;

7+

const ENV_SECRET_SHORTHAND_RE = /^\$([A-Z][A-Z0-9_]{0,127})$/;

8+

function isRecord(value) {

9+

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

10+

}

11+

function normalizeSecretInputString(value) {

12+

if (typeof value !== "string") return;

13+

const trimmed = value.trim();

14+

return trimmed.length > 0 ? trimmed : void 0;

15+

}

16+

function normalizeSecretInput(value) {

17+

if (typeof value !== "string") return "";

18+

const collapsed = value.replace(/[\r\n\u2028\u2029]+/g, "");

19+

let latin1Only = "";

20+

for (const char of collapsed) {

21+

const codePoint = char.codePointAt(0);

22+

if (typeof codePoint === "number" && codePoint <= 255) latin1Only += char;

23+

}

24+

return latin1Only.trim();

25+

}

26+

function isSecretRef(value) {

27+

if (!isRecord(value)) return false;

28+

if (Object.keys(value).length !== 3) return false;

29+

return (value.source === "env" || value.source === "file" || value.source === "exec") && typeof value.provider === "string" && value.provider.trim().length > 0 && typeof value.id === "string" && value.id.trim().length > 0;

30+

}

31+

function coerceSecretRef(value) {

32+

if (isSecretRef(value)) return value;

33+

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

34+

const trimmed = value.trim();

35+

const legacyPrefix = trimmed.startsWith(LEGACY_SECRETREF_ENV_MARKER_PREFIX) ? LEGACY_SECRETREF_ENV_MARKER_PREFIX : trimmed.startsWith(LEGACY_DOUBLE_UNDERSCORE_ENV_MARKER_PREFIX) ? LEGACY_DOUBLE_UNDERSCORE_ENV_MARKER_PREFIX : void 0;

36+

if (legacyPrefix) {

37+

const id = trimmed.slice(legacyPrefix.length);

38+

return ENV_SECRET_REF_ID_RE.test(id) ? {

39+

source: "env",

40+

provider: DEFAULT_SECRET_PROVIDER_ALIAS,

41+

id

42+

} : null;

43+

}

44+

const match = ENV_SECRET_TEMPLATE_RE.exec(trimmed) ?? ENV_SECRET_SHORTHAND_RE.exec(trimmed);

45+

return match ? {

46+

source: "env",

47+

provider: DEFAULT_SECRET_PROVIDER_ALIAS,

48+

id: match[1]

49+

} : null;

50+

}

51+

if (isRecord(value) && (value.source === "env" || value.source === "file" || value.source === "exec") && typeof value.id === "string" && value.id.trim().length > 0 && value.provider === void 0) return {

52+

source: value.source,

53+

provider: DEFAULT_SECRET_PROVIDER_ALIAS,

54+

id: value.id

55+

};

56+

return null;

57+

}

58+

function resolveWebProviderConfig(cfg, kind) {

59+

const webConfig = cfg?.tools?.web;

60+

if (!webConfig || typeof webConfig !== "object") return;

61+

const toolConfig = webConfig[kind];

62+

if (!toolConfig || typeof toolConfig !== "object") return;

63+

return toolConfig;

64+

}

65+

function readWebProviderEnvValue(envVars, processEnv = process.env) {

66+

for (const envVar of envVars) {

67+

const value = normalizeSecretInput(processEnv[envVar]);

68+

if (value) return value;

69+

}

70+

}

71+

function providerRequiresCredential(provider) {

72+

return provider.requiresCredential !== false;

73+

}

74+

function hasWebProviderEntryCredential(params) {

75+

if (!providerRequiresCredential(params.provider)) return true;

76+

const rawValue = params.resolveRawValue({

77+

provider: params.provider,

78+

config: params.config,

79+

toolConfig: params.toolConfig

80+

});

81+

const configuredRef = coerceSecretRef(rawValue);

82+

if (configuredRef && configuredRef.source !== "env") return true;

83+

if (normalizeSecretInput(normalizeSecretInputString(rawValue))) return true;

84+

if (params.provider.authProviderId && params.resolveProviderAuthValue?.(params.provider.authProviderId)) return true;

85+

if (params.resolveEnvValue({

86+

provider: params.provider,

87+

configuredEnvVarId: configuredRef?.source === "env" ? configuredRef.id : void 0

88+

})) return true;

89+

const fallbackRawValue = params.resolveFallbackRawValue?.({

90+

provider: params.provider,

91+

config: params.config,

92+

toolConfig: params.toolConfig

93+

});

94+

const fallbackRef = coerceSecretRef(fallbackRawValue);

95+

if (fallbackRef && fallbackRef.source !== "env") return true;

96+

if (normalizeSecretInput(normalizeSecretInputString(fallbackRawValue))) return true;

97+

return Boolean(fallbackRef?.source === "env" ? params.resolveEnvValue({

98+

provider: params.provider,

99+

configuredEnvVarId: fallbackRef.id

100+

}) : void 0);

101+

}

102+

function resolveWebProviderDefinition(params) {

103+

if (!params.resolveEnabled({

104+

toolConfig: params.toolConfig,

105+

sandboxed: params.sandboxed

106+

})) return null;

107+

const providers = params.providers.filter(Boolean);

108+

if (providers.length === 0) return null;

109+

const autoProviderId = params.resolveAutoProviderId({

110+

config: params.config,

111+

toolConfig: params.toolConfig,

112+

providers

113+

});

114+

const providerId = params.providerId ?? params.runtimeMetadata?.selectedProvider ?? autoProviderId;

115+

if (!providerId) return null;

116+

const provider = providers.find((entry) => entry.id === providerId) ?? providers.find((entry) => entry.id === params.resolveFallbackProviderId?.({

117+

config: params.config,

118+

toolConfig: params.toolConfig,

119+

providers,

120+

providerId

121+

}));

122+

if (!provider) return null;

123+

const definition = params.createTool({

124+

provider,

125+

config: params.config,

126+

toolConfig: params.toolConfig,

127+

runtimeMetadata: params.runtimeMetadata

128+

});

129+

if (!definition) return null;

130+

return {

131+

provider,

132+

definition

133+

};

134+

}

135+

//#endregion

136+

export { hasWebProviderEntryCredential, providerRequiresCredential, readWebProviderEnvValue, resolveWebProviderConfig, resolveWebProviderDefinition };