mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 15:47:28 +00:00
fix: avoid eager web provider config reads
This commit is contained in:
@@ -2,6 +2,7 @@ import { EnvHttpProxyAgent } from "undici";
|
|||||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import { createEmptyPluginRegistry } from "../../plugins/registry.js";
|
import { createEmptyPluginRegistry } from "../../plugins/registry.js";
|
||||||
import { setActivePluginRegistry } from "../../plugins/runtime.js";
|
import { setActivePluginRegistry } from "../../plugins/runtime.js";
|
||||||
|
import { clearSecretsRuntimeSnapshot } from "../../secrets/runtime.js";
|
||||||
import { withFetchPreconnect } from "../../test-utils/fetch-mock.js";
|
import { withFetchPreconnect } from "../../test-utils/fetch-mock.js";
|
||||||
import { __testing as webSearchTesting } from "./web-search.js";
|
import { __testing as webSearchTesting } from "./web-search.js";
|
||||||
import { createWebFetchTool, createWebSearchTool } from "./web-tools.js";
|
import { createWebFetchTool, createWebSearchTool } from "./web-tools.js";
|
||||||
@@ -152,8 +153,14 @@ function createProviderSuccessPayload(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
setActivePluginRegistry(createEmptyPluginRegistry());
|
||||||
|
clearSecretsRuntimeSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
setActivePluginRegistry(createEmptyPluginRegistry());
|
setActivePluginRegistry(createEmptyPluginRegistry());
|
||||||
|
clearSecretsRuntimeSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("web tools defaults", () => {
|
describe("web tools defaults", () => {
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ function buildWebFetchSnapshotCacheKey(params: {
|
|||||||
onlyPluginIds: [...new Set(params.onlyPluginIds ?? [])].toSorted((left, right) =>
|
onlyPluginIds: [...new Set(params.onlyPluginIds ?? [])].toSorted((left, right) =>
|
||||||
left.localeCompare(right),
|
left.localeCompare(right),
|
||||||
),
|
),
|
||||||
config: params.config ?? null,
|
|
||||||
env: buildPluginSnapshotCacheEnvKey(params.env),
|
env: buildPluginSnapshotCacheEnvKey(params.env),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ function buildWebSearchSnapshotCacheKey(params: {
|
|||||||
onlyPluginIds: [...new Set(params.onlyPluginIds ?? [])].toSorted((left, right) =>
|
onlyPluginIds: [...new Set(params.onlyPluginIds ?? [])].toSorted((left, right) =>
|
||||||
left.localeCompare(right),
|
left.localeCompare(right),
|
||||||
),
|
),
|
||||||
config: params.config ?? null,
|
|
||||||
env: buildPluginSnapshotCacheEnvKey(params.env),
|
env: buildPluginSnapshotCacheEnvKey(params.env),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user