mirror of
https://fastgit.cc/github.com/openclaw/openclaw
synced 2026-05-01 06:36:23 +08:00
perf(cron): keep skill filter runtime lazy
This commit is contained in:
@@ -5,7 +5,6 @@ export {
|
||||
resolveDefaultAgentId,
|
||||
type ResolvedAgentConfig,
|
||||
} from "../../agents/agent-scope-config.js";
|
||||
export { resolveAgentSkillsFilter } from "../../agents/agent-scope.js";
|
||||
export { resolveCronStyleNow } from "../../agents/current-time.js";
|
||||
export { DEFAULT_CONTEXT_TOKENS } from "../../agents/defaults.js";
|
||||
export { isCliProvider } from "../../agents/model-selection-cli.js";
|
||||
|
||||
@@ -97,7 +97,6 @@ vi.mock("./run.runtime.js", () => ({
|
||||
resolveAgentModelFallbacksOverride: resolveAgentModelFallbacksOverrideMock,
|
||||
resolveAgentWorkspaceDir: vi.fn().mockReturnValue("/tmp/workspace"),
|
||||
resolveDefaultAgentId: vi.fn().mockReturnValue("default"),
|
||||
resolveAgentSkillsFilter: resolveAgentSkillsFilterMock,
|
||||
resolveCronStyleNow: resolveCronStyleNowMock,
|
||||
DEFAULT_CONTEXT_TOKENS: 128000,
|
||||
isCliProvider: isCliProviderMock,
|
||||
@@ -140,6 +139,7 @@ vi.mock("./skills-snapshot.runtime.js", () => ({
|
||||
canExecRequestNode: vi.fn(() => false),
|
||||
getRemoteSkillEligibility: getRemoteSkillEligibilityMock,
|
||||
getSkillsSnapshotVersion: getSkillsSnapshotVersionMock,
|
||||
resolveAgentSkillsFilter: resolveAgentSkillsFilterMock,
|
||||
}));
|
||||
|
||||
vi.mock("./run-model-selection.runtime.js", () => ({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export { canExecRequestNode } from "../../agents/exec-defaults.js";
|
||||
export { resolveAgentSkillsFilter } from "../../agents/agent-scope.js";
|
||||
export { buildWorkspaceSkillSnapshot } from "../../agents/skills.js";
|
||||
export { getSkillsSnapshotVersion } from "../../agents/skills/refresh.js";
|
||||
export { getRemoteSkillEligibility } from "../../infra/skills-remote.js";
|
||||
|
||||
@@ -19,9 +19,6 @@ vi.mock("./skills-snapshot.runtime.js", () => ({
|
||||
canExecRequestNode: canExecRequestNodeMock,
|
||||
getRemoteSkillEligibility: getRemoteSkillEligibilityMock,
|
||||
getSkillsSnapshotVersion: getSkillsSnapshotVersionMock,
|
||||
}));
|
||||
|
||||
vi.mock("./run.runtime.js", () => ({
|
||||
resolveAgentSkillsFilter: resolveAgentSkillsFilterMock,
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { SkillSnapshot } from "../../agents/skills.js";
|
||||
import { matchesSkillFilter } from "../../agents/skills/filter.js";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import { resolveAgentSkillsFilter } from "./run.runtime.js";
|
||||
|
||||
let skillsSnapshotRuntimePromise:
|
||||
| Promise<typeof import("./skills-snapshot.runtime.js")>
|
||||
@@ -26,7 +25,7 @@ export async function resolveCronSkillsSnapshot(params: {
|
||||
|
||||
const runtime = await loadSkillsSnapshotRuntime();
|
||||
const snapshotVersion = runtime.getSkillsSnapshotVersion(params.workspaceDir);
|
||||
const skillFilter = resolveAgentSkillsFilter(params.config, params.agentId);
|
||||
const skillFilter = runtime.resolveAgentSkillsFilter(params.config, params.agentId);
|
||||
const existingSnapshot = params.existingSnapshot;
|
||||
const shouldRefresh =
|
||||
!existingSnapshot ||
|
||||
|
||||
Reference in New Issue
Block a user