perf(tui): skip plugin metadata + provider catalog on remote TUI star… · openclaw/openclaw@d91ef6b
RomneyDa
·
2026-05-21
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -219,7 +219,7 @@ function primeConfiguredContextWindows(): OpenClawConfig | undefined {
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | | -function ensureContextWindowCacheLoaded(): Promise<void> { |
| 222 | +export function ensureContextWindowCacheLoaded(): Promise<void> { |
223 | 223 | if (CONTEXT_WINDOW_RUNTIME_STATE.loadPromise) { |
224 | 224 | return CONTEXT_WINDOW_RUNTIME_STATE.loadPromise; |
225 | 225 | } |
@@ -287,12 +287,6 @@ export function lookupContextTokens(
|
287 | 287 | return lookupCachedContextTokens(modelId); |
288 | 288 | } |
289 | 289 | |
290 | | -if (shouldEagerWarmContextWindowCache()) { |
291 | | -// Keep startup warmth for the real CLI, but avoid import-time side effects |
292 | | -// when this module is pulled in through library/plugin-sdk surfaces. |
293 | | -void ensureContextWindowCacheLoaded(); |
294 | | -} |
295 | | - |
296 | 290 | function resolveProviderModelRef(params: { |
297 | 291 | provider?: string; |
298 | 292 | model?: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2387,15 +2387,17 @@ export function projectConfigOntoRuntimeSourceSnapshot(config: OpenClawConfig):
|
2387 | 2387 | return coerceConfig(applyMergePatch(projectedSource, runtimePatch)); |
2388 | 2388 | } |
2389 | 2389 | |
2390 | | -export function loadConfig(): OpenClawConfig { |
| 2390 | +export function loadConfig(options?: { skipPluginValidation?: boolean }): OpenClawConfig { |
2391 | 2391 | // First successful load becomes the process snapshot. Long-lived runtimes |
2392 | 2392 | // should swap this snapshot via explicit reload/watcher paths instead of |
2393 | 2393 | // reparsing openclaw.json on hot code paths. |
2394 | | -return loadPinnedRuntimeConfig(() => createConfigIO().loadConfig()); |
| 2394 | +return loadPinnedRuntimeConfig(() => |
| 2395 | +createConfigIO(options?.skipPluginValidation ? { pluginValidation: "skip" } : {}).loadConfig(), |
| 2396 | +); |
2395 | 2397 | } |
2396 | 2398 | |
2397 | | -export function getRuntimeConfig(): OpenClawConfig { |
2398 | | -return loadConfig(); |
| 2399 | +export function getRuntimeConfig(options?: { skipPluginValidation?: boolean }): OpenClawConfig { |
| 2400 | +return loadConfig(options); |
2399 | 2401 | } |
2400 | 2402 | |
2401 | 2403 | export async function readBestEffortConfig(): Promise<OpenClawConfig> { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { randomUUID } from "node:crypto"; |
2 | 2 | import { agentCommandFromIngress } from "../agents/agent-command.js"; |
3 | 3 | import { resolveSessionAgentId } from "../agents/agent-scope.js"; |
| 4 | +import { ensureContextWindowCacheLoaded } from "../agents/context.js"; |
4 | 5 | import { DEFAULT_PROVIDER } from "../agents/defaults.js"; |
5 | 6 | import { buildAllowedModelSet, resolveThinkingDefault } from "../agents/model-selection.js"; |
6 | 7 | import { createDefaultDeps } from "../cli/deps.js"; |
@@ -138,6 +139,7 @@ export class EmbeddedTuiBackend implements TuiBackend {
|
138 | 139 | return; |
139 | 140 | } |
140 | 141 | setEmbeddedMode(true); |
| 142 | +void ensureContextWindowCacheLoaded(); |
141 | 143 | // Suppress console output from logError/logInfo that would pollute the TUI. |
142 | 144 | // File logger (getLogger()) still captures everything via logger.ts:35. |
143 | 145 | this.previousRuntimeLog = defaultRuntime.log; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -443,7 +443,7 @@ export function resolveTuiCtrlCAction(params: {
|
443 | 443 | |
444 | 444 | export async function runTui(opts: RunTuiOptions): Promise<TuiResult> { |
445 | 445 | const isLocalMode = opts.local === true || opts.backend !== undefined; |
446 | | -const config = opts.config ?? getRuntimeConfig(); |
| 446 | +const config = opts.config ?? getRuntimeConfig({ skipPluginValidation: !isLocalMode }); |
447 | 447 | const initialSessionInput = (opts.session ?? "").trim(); |
448 | 448 | let sessionScope: SessionScope = (config.session?.scope ?? "per-sender") as SessionScope; |
449 | 449 | let sessionMainKey = normalizeMainKey(config.session?.mainKey); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。