mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor: eliminate final wrapper-shadowing hazards (#122157)
* refactor: disambiguate wrapper-shadowed exports * test: align renamed session and facade boundaries * test: cover renamed runtime mock exports * refactor: align remaining wrapper owner call sites * test: align overlap-rebased runtime mocks * refactor: preserve public SDK names after overlap rebase * chore: regenerate wrapper shadowing baselines * test: align cron model selection mocks
This commit is contained in:
committed by
GitHub
parent
7d99f9fd86
commit
e74be5d41d
@@ -1 +1 @@
|
||||
{"contentHash":"8f8189612c59f0a57b65ebd310af811f64953e4b45271c4c62902f3fcfbd8537","entrypoint":"agent-harness-runtime","importSpecifier":"openclaw/plugin-sdk/agent-harness-runtime"}
|
||||
{"contentHash":"c0e93e0c2140525841e84065e597ee7819420bda66d149d2f5df8e7810ccedf1","entrypoint":"agent-harness-runtime","importSpecifier":"openclaw/plugin-sdk/agent-harness-runtime"}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"contentHash":"b8a161ee64194146ccfadc417f27d39911eea97ee818538df86653d1a9f414cc","entrypoint":"agent-harness","importSpecifier":"openclaw/plugin-sdk/agent-harness"}
|
||||
{"contentHash":"c299b664efaf168d481e2c793cab8f017c72d9cbf73dbfb08d01417c9ec66a19","entrypoint":"agent-harness","importSpecifier":"openclaw/plugin-sdk/agent-harness"}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"contentHash":"77f828ec162318163cf147fc99143fcafaf35cfd2e2654559fd14bd778ae43d9","entrypoint":"channel-core","importSpecifier":"openclaw/plugin-sdk/channel-core"}
|
||||
{"contentHash":"1c9ffa868f6c5b56d2e2a8ceb067f7d2161760b44f3a2cfbc0f0ad6413c6fc08","entrypoint":"channel-core","importSpecifier":"openclaw/plugin-sdk/channel-core"}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contentHash":"1d756f82df06f6ce77d5b4b1e3abfad6046ff49fed7641b3da206b60feb91404","entrypoint":"channel-entry-contract","importSpecifier":"openclaw/plugin-sdk/channel-entry-contract"}
|
||||
{"contentHash":"a569ac63b0cc0ae29e23246a265e1a31bf56d6700d6e934ce917730b6cc5f969","entrypoint":"channel-entry-contract","importSpecifier":"openclaw/plugin-sdk/channel-entry-contract"}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contentHash":"fe0b763f911c6f67d25d63b6fd0defe104bef798008f830ae0f6dbd013a79ff6","entrypoint":"channel-message","importSpecifier":"openclaw/plugin-sdk/channel-message"}
|
||||
{"contentHash":"70fc7f09d590ed889662c78f320eb7d1d87627880084cbc5af1a5442576c1622","entrypoint":"channel-message","importSpecifier":"openclaw/plugin-sdk/channel-message"}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contentHash":"d8f4fbf15031d5731596db8f48d15d28c2522e6d563ab0bd7fa41f4908c53314","entrypoint":"channel-outbound","importSpecifier":"openclaw/plugin-sdk/channel-outbound"}
|
||||
{"contentHash":"9763e0d262d42c5c3d8a938fa7a0b34853c48355c84a6556af283523c35ce250","entrypoint":"channel-outbound","importSpecifier":"openclaw/plugin-sdk/channel-outbound"}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contentHash":"386c6006608513ffa9c458b1ab085c5b3ca3df953b8cd09cdc17846b8f616aa6","entrypoint":"channel-plugin-common","importSpecifier":"openclaw/plugin-sdk/channel-plugin-common"}
|
||||
{"contentHash":"1034e6d720b32c0db92a56e02ff10c2d6f790976afb7d5332d548f5eba16321c","entrypoint":"channel-plugin-common","importSpecifier":"openclaw/plugin-sdk/channel-plugin-common"}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"contentHash":"a501e9c9f95cda7027f83d52c7b4b95153531cc24540f0e6803435e75def6153","entrypoint":"core","importSpecifier":"openclaw/plugin-sdk/core"}
|
||||
{"contentHash":"ba196a3b1b0ad6f2a8ca074bce4f4dca36e67f48c8f8a3ee77bd2586a1a24b45","entrypoint":"core","importSpecifier":"openclaw/plugin-sdk/core"}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"contentHash":"ceca2545902bcea34a836763afef76c9b55bd0fa639cceb89b7122c0f7c6027a","entrypoint":"discord","importSpecifier":"openclaw/plugin-sdk/discord"}
|
||||
{"contentHash":"e93dde148be09b57b1a2f879fe5008768c41e15885b6ce6a898e0465f78fec68","entrypoint":"discord","importSpecifier":"openclaw/plugin-sdk/discord"}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contentHash":"a6537713e63d101897ef9ddfeaae438a50645e2672be5bdced887c4e8a651b96","entrypoint":"inbound-envelope","importSpecifier":"openclaw/plugin-sdk/inbound-envelope"}
|
||||
{"contentHash":"c6090ec8881419039edee8e497a6e59524ab6bef3014aa9336f8d43a0816ec35","entrypoint":"inbound-envelope","importSpecifier":"openclaw/plugin-sdk/inbound-envelope"}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contentHash":"3e853390cc6efef245c9c220512fca49d2f8812abf1968e302c48e48b223d633","entrypoint":"inbound-reply-dispatch","importSpecifier":"openclaw/plugin-sdk/inbound-reply-dispatch"}
|
||||
{"contentHash":"2ce7ba8b43211c18c309837f71105b66b915c7f7cd6a63d892071919d1a1e161","entrypoint":"inbound-reply-dispatch","importSpecifier":"openclaw/plugin-sdk/inbound-reply-dispatch"}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contentHash":"35904f50b6b6826386c774052cf3ab38a07a5ccabbd264237c1ce0bd5f1275c8","entrypoint":"meeting-runtime","importSpecifier":"openclaw/plugin-sdk/meeting-runtime"}
|
||||
{"contentHash":"bebd31387941500e192e07e3f38b20ad389c7641db7f2a08615915019067aeef","entrypoint":"meeting-runtime","importSpecifier":"openclaw/plugin-sdk/meeting-runtime"}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"contentHash":"3e7a63e4f1d24dd6a2af9b7c5fd47837781471f5d92cdc1ba15f079259617402","entrypoint":"plugin-entry","importSpecifier":"openclaw/plugin-sdk/plugin-entry"}
|
||||
{"contentHash":"eeb102db0465d7f4e0bc12a6aa6dc877faf429304e2670ff51a60f5d5d011124","entrypoint":"plugin-entry","importSpecifier":"openclaw/plugin-sdk/plugin-entry"}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"contentHash":"7f5d4e9c2f0593f433cb06c9acbca4c7a683e7d097d8f11304450076a7deb6e7","entrypoint":"plugin-runtime","importSpecifier":"openclaw/plugin-sdk/plugin-runtime"}
|
||||
{"contentHash":"a57d78253ac4d40bc7933506ff65699c4f34e544cc3b107fe6bc29d58e586ad5","entrypoint":"plugin-runtime","importSpecifier":"openclaw/plugin-sdk/plugin-runtime"}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contentHash":"43d1e66a594b093ebd63d48de2a17900eef743404ef10068735a2aa8f2900f9f","entrypoint":"provider-catalog-runtime","importSpecifier":"openclaw/plugin-sdk/provider-catalog-runtime"}
|
||||
{"contentHash":"42aa8fb549aac34c624ee63bc948f28cb8e732b256b72745617cca2e431e84be","entrypoint":"provider-catalog-runtime","importSpecifier":"openclaw/plugin-sdk/provider-catalog-runtime"}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"contentHash":"cb54b3d858974c81cc1bd07e0a72b543e7f0a47f3751bd0a287c2f97bbb2b9ac","entrypoint":"reply-runtime","importSpecifier":"openclaw/plugin-sdk/reply-runtime"}
|
||||
{"contentHash":"07a6384bfd57e2e318fc5195a74a52d81fc1deb05ec7e6ae770bdd819562975d","entrypoint":"reply-runtime","importSpecifier":"openclaw/plugin-sdk/reply-runtime"}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"contentHash":"cc7dd850ee1af91876e83827b5087c1374328f8eb7b9d559c5df7e34695663e2","entrypoint":"tool-plugin","importSpecifier":"openclaw/plugin-sdk/tool-plugin"}
|
||||
{"contentHash":"a4c9dd4fa12d108bb4b54b97201b582185e480de592441391f273c2c92521135","entrypoint":"tool-plugin","importSpecifier":"openclaw/plugin-sdk/tool-plugin"}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"contentHash":"6c157ca687f5bf384fcf526ca2465f85b27e3bedba0bde3c8ecf1e4060ddcd5d","entrypoint":"webhook-ingress","importSpecifier":"openclaw/plugin-sdk/webhook-ingress"}
|
||||
{"contentHash":"f66eb413f310af3189604144311e441609e97bf1b745e617ec434c074c772a65","entrypoint":"webhook-ingress","importSpecifier":"openclaw/plugin-sdk/webhook-ingress"}
|
||||
|
||||
@@ -21,6 +21,7 @@ const legacyReaderNames = new Set([
|
||||
"readSessionStoreReadOnly",
|
||||
"readSessionStoreSnapshot",
|
||||
"resolveSessionStoreEntry",
|
||||
"resolveSessionStoreEntryCore",
|
||||
]);
|
||||
const legacyWholeStoreAccessNames = new Set([
|
||||
...legacyReaderNames,
|
||||
|
||||
@@ -1,72 +1 @@
|
||||
[
|
||||
{
|
||||
"name": "loadPluginManifestRegistry",
|
||||
"wrapped": "src/plugins/manifest-registry.ts",
|
||||
"wrapper": "src/config/doc-baseline.runtime.ts"
|
||||
},
|
||||
{
|
||||
"name": "normalizeOutboundReplyPayload",
|
||||
"wrapped": "src/infra/outbound/reply-payload-normalize.ts",
|
||||
"wrapper": "src/plugin-sdk/reply-payload.ts"
|
||||
},
|
||||
{
|
||||
"name": "normalizePluginsConfigWithResolver",
|
||||
"wrapped": "src/plugins/config-normalization-shared.ts",
|
||||
"wrapper": "src/plugins/config-policy.ts"
|
||||
},
|
||||
{
|
||||
"name": "pruneStaleCommandPolls",
|
||||
"wrapped": "src/agents/command-poll-backoff.ts",
|
||||
"wrapper": "src/agents/command-poll-backoff.runtime.ts"
|
||||
},
|
||||
{
|
||||
"name": "readBooleanParam",
|
||||
"wrapped": "src/plugin-sdk/boolean-param.ts",
|
||||
"wrapper": "src/infra/outbound/message-action-params.ts"
|
||||
},
|
||||
{
|
||||
"name": "resolveAllowedModelRef",
|
||||
"wrapped": "src/agents/model-selection-resolve.ts",
|
||||
"wrapper": "src/agents/model-selection.ts"
|
||||
},
|
||||
{
|
||||
"name": "resolvePluginProviders",
|
||||
"wrapped": "src/plugins/providers.runtime.ts",
|
||||
"wrapper": "src/plugins/provider-auth-choice.runtime.ts"
|
||||
},
|
||||
{
|
||||
"name": "resolvePluginSetupProvider",
|
||||
"wrapped": "src/plugins/setup-registry.ts",
|
||||
"wrapper": "src/plugins/provider-auth-choice.runtime.ts"
|
||||
},
|
||||
{
|
||||
"name": "resolveProviderPluginChoice",
|
||||
"wrapped": "src/plugins/provider-wizard.ts",
|
||||
"wrapper": "src/plugins/provider-auth-choice.runtime.ts"
|
||||
},
|
||||
{
|
||||
"name": "resolveSessionKeyForRequest",
|
||||
"wrapped": "src/agents/command/session.ts",
|
||||
"wrapper": "src/commands/agent/session.runtime.ts"
|
||||
},
|
||||
{
|
||||
"name": "resolveSessionStoreEntry",
|
||||
"wrapped": "src/config/sessions/store-entry.ts",
|
||||
"wrapper": "src/plugin-sdk/session-store-runtime.ts"
|
||||
},
|
||||
{
|
||||
"name": "runProviderModelSelectedHook",
|
||||
"wrapped": "src/plugins/provider-wizard.ts",
|
||||
"wrapper": "src/plugins/provider-auth-choice.runtime.ts"
|
||||
},
|
||||
{
|
||||
"name": "runSecurityAudit",
|
||||
"wrapped": "src/security/audit.ts",
|
||||
"wrapper": "src/security/audit.runtime.ts"
|
||||
},
|
||||
{
|
||||
"name": "shouldSuppressBuiltInModel",
|
||||
"wrapped": "src/agents/model-suppression.ts",
|
||||
"wrapper": "src/agents/model-suppression.runtime.ts"
|
||||
}
|
||||
]
|
||||
[]
|
||||
|
||||
@@ -266,7 +266,7 @@ export default { id: "tool-result-middleware", register(api) {
|
||||
|
||||
expect(listAgentToolResultMiddlewares("codex")).toHaveLength(0);
|
||||
const manifestRegistry = await import("../plugins/manifest-registry.js");
|
||||
const manifestSpy = vi.spyOn(manifestRegistry, "loadPluginManifestRegistry");
|
||||
const manifestSpy = vi.spyOn(manifestRegistry, "loadPluginManifestRegistryCore");
|
||||
|
||||
// Startup activation stays false here; the runner must load the owner only
|
||||
// when Codex asks for the middleware runtime.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Runtime seam for command poll backoff cleanup.
|
||||
*/
|
||||
import { pruneStaleCommandPolls as pruneStaleCommandPollsImpl } from "./command-poll-backoff.js";
|
||||
import { pruneStaleCommandPollsCore as pruneStaleCommandPollsImpl } from "./command-poll-backoff.js";
|
||||
|
||||
type PruneStaleCommandPolls = typeof import("./command-poll-backoff.js").pruneStaleCommandPolls;
|
||||
type PruneStaleCommandPolls = typeof import("./command-poll-backoff.js").pruneStaleCommandPollsCore;
|
||||
|
||||
/** Prune stale command polls using the production backoff implementation. */
|
||||
export function pruneStaleCommandPolls(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { SessionState } from "../logging/diagnostic-session-state.js";
|
||||
import {
|
||||
pruneStaleCommandPolls,
|
||||
pruneStaleCommandPollsCore,
|
||||
recordCommandPoll,
|
||||
resetCommandPollCount,
|
||||
} from "./command-poll-backoff.js";
|
||||
@@ -110,7 +110,7 @@ describe("command-poll-backoff", () => {
|
||||
]),
|
||||
};
|
||||
|
||||
pruneStaleCommandPolls(state, 3600000);
|
||||
pruneStaleCommandPollsCore(state, 3600000);
|
||||
|
||||
expect(state.commandPollCounts?.has("cmd-old")).toBe(false);
|
||||
expect(state.commandPollCounts?.has("cmd-new")).toBe(true);
|
||||
@@ -123,7 +123,7 @@ describe("command-poll-backoff", () => {
|
||||
queueDepth: 0,
|
||||
};
|
||||
|
||||
pruneStaleCommandPolls(state);
|
||||
pruneStaleCommandPollsCore(state);
|
||||
expect(state.commandPollCounts).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -56,7 +56,7 @@ export function resetCommandPollCount(state: SessionState, commandId: string): v
|
||||
* Prune stale command poll records (older than 1 hour).
|
||||
* Call periodically to prevent memory bloat.
|
||||
*/
|
||||
export function pruneStaleCommandPolls(state: SessionState, maxAgeMs = 3600000): void {
|
||||
export function pruneStaleCommandPollsCore(state: SessionState, maxAgeMs = 3600000): void {
|
||||
if (!state.commandPollCounts) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ vi.mock("../agent-scope.js", () => ({
|
||||
resolveDefaultAgentId: () => "main",
|
||||
}));
|
||||
|
||||
const { resolveSessionKeyForRequest, resolveStoredSessionKeyForSessionId } =
|
||||
const { resolveSessionKeyForRequestCore, resolveStoredSessionKeyForSessionId } =
|
||||
await import("./session.js");
|
||||
|
||||
function mockSessionStores(storesByPath: Record<string, Record<string, SessionEntry>>): void {
|
||||
@@ -51,7 +51,7 @@ function expectResolvedRequestSession(params: {
|
||||
sessionStore: Record<string, SessionEntry>;
|
||||
storePath: string;
|
||||
}): void {
|
||||
const result = resolveSessionKeyForRequest({
|
||||
const result = resolveSessionKeyForRequestCore({
|
||||
cfg: {
|
||||
session: {
|
||||
store: "/stores/{agentId}.json",
|
||||
@@ -151,7 +151,7 @@ describe("resolveSessionKeyForRequest", () => {
|
||||
"/stores/other.json": otherStore,
|
||||
});
|
||||
|
||||
const result = resolveSessionKeyForRequest({
|
||||
const result = resolveSessionKeyForRequestCore({
|
||||
cfg: {
|
||||
session: {
|
||||
store: "/stores/{agentId}.json",
|
||||
|
||||
@@ -222,7 +222,7 @@ export function resolveStoredSessionKeyForSessionId(opts: {
|
||||
}
|
||||
|
||||
/** Resolves the session key/store targeted by one command request. */
|
||||
export function resolveSessionKeyForRequest(opts: {
|
||||
export function resolveSessionKeyForRequestCore(opts: {
|
||||
cfg: OpenClawConfig;
|
||||
to?: string;
|
||||
sessionId?: string;
|
||||
@@ -330,7 +330,7 @@ export function resolveSession(opts: {
|
||||
clone?: boolean;
|
||||
}): SessionResolution {
|
||||
const sessionCfg = opts.cfg.session;
|
||||
const { sessionKey, sessionStore, storePath } = resolveSessionKeyForRequest({
|
||||
const { sessionKey, sessionStore, storePath } = resolveSessionKeyForRequestCore({
|
||||
cfg: opts.cfg,
|
||||
to: opts.to,
|
||||
sessionId: opts.sessionId,
|
||||
|
||||
@@ -116,7 +116,7 @@ const installRunEmbeddedMocks = () => {
|
||||
await vi.importActual<typeof import("./command/session.js")>("./command/session.js");
|
||||
return {
|
||||
...actual,
|
||||
resolveSessionKeyForRequest: (opts: unknown) => resolveSessionKeyForRequestMock(opts),
|
||||
resolveSessionKeyForRequestCore: (opts: unknown) => resolveSessionKeyForRequestMock(opts),
|
||||
resolveStoredSessionKeyForSessionId: (opts: unknown) =>
|
||||
resolveStoredSessionKeyForSessionIdMock(opts),
|
||||
};
|
||||
|
||||
@@ -8,7 +8,10 @@ import type { ProviderRuntimeModel } from "../../plugins/provider-runtime-model.
|
||||
import { resolveCatalogOwnedModelCompat } from "../model-compat-catalog.js";
|
||||
import { modelKey, normalizeStaticProviderModelId } from "../model-ref-shared.js";
|
||||
import { findNormalizedProviderValue, normalizeProviderId } from "../model-selection.js";
|
||||
import { shouldSuppressBuiltInModel, shouldUnconditionallySuppress } from "../model-suppression.js";
|
||||
import {
|
||||
shouldSuppressBuiltInModelCore,
|
||||
shouldUnconditionallySuppress,
|
||||
} from "../model-suppression.js";
|
||||
import { attachModelProviderLocalService } from "../provider-local-service.js";
|
||||
import {
|
||||
attachModelProviderMetadataOwners,
|
||||
@@ -70,7 +73,7 @@ export function shouldSuppressConfiguredModel(params: {
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return shouldSuppressBuiltInModel({
|
||||
return shouldSuppressBuiltInModelCore({
|
||||
provider: params.provider,
|
||||
id: params.modelId,
|
||||
...(params.cfg ? { config: params.cfg } : {}),
|
||||
|
||||
@@ -45,7 +45,7 @@ vi.mock("./model.static-catalog.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../model-suppression.js", () => ({
|
||||
shouldSuppressBuiltInModel: ({
|
||||
shouldSuppressBuiltInModelCore: ({
|
||||
provider,
|
||||
id,
|
||||
baseUrl,
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
isBundledManifestOwner,
|
||||
} from "../../plugins/manifest-owner-policy.js";
|
||||
import {
|
||||
loadPluginManifestRegistry,
|
||||
loadPluginManifestRegistryCore,
|
||||
type PluginManifestRecord,
|
||||
} from "../../plugins/manifest-registry.js";
|
||||
import { staticModelIdMatches } from "./model.static-id.js";
|
||||
@@ -310,7 +310,7 @@ export function resolveManifestModelCatalogProviderAliasMetadata(params: {
|
||||
: undefined;
|
||||
const plugins =
|
||||
currentPlugins ??
|
||||
loadPluginManifestRegistry({
|
||||
loadPluginManifestRegistryCore({
|
||||
config: params.cfg,
|
||||
workspaceDir: params.workspaceDir,
|
||||
env,
|
||||
|
||||
@@ -7,7 +7,10 @@ import type { AuthProfileCredential } from "../auth-profiles/types.js";
|
||||
import { resolveAgentHarnessPolicy } from "../harness/policy.js";
|
||||
import { normalizeStaticProviderModelId } from "../model-ref-shared.js";
|
||||
import { normalizeProviderId } from "../model-selection.js";
|
||||
import { shouldSuppressBuiltInModel, shouldUnconditionallySuppress } from "../model-suppression.js";
|
||||
import {
|
||||
shouldSuppressBuiltInModelCore,
|
||||
shouldUnconditionallySuppress,
|
||||
} from "../model-suppression.js";
|
||||
import { listOpenAIAuthProfileProvidersForAgentRuntime } from "../openai-routing.js";
|
||||
import { buildConfiguredFallbackModel } from "./model.configured-fallback.js";
|
||||
import {
|
||||
@@ -142,7 +145,7 @@ export function resolveExplicitModelWithRegistry(params: {
|
||||
: undefined;
|
||||
const effectiveBaseUrl = configuredBaseUrl ?? discoveredBaseUrl;
|
||||
if (
|
||||
shouldSuppressBuiltInModel({
|
||||
shouldSuppressBuiltInModelCore({
|
||||
provider,
|
||||
id: modelId,
|
||||
...(cfg ? { config: cfg } : {}),
|
||||
@@ -186,7 +189,7 @@ export function resolveExplicitModelWithRegistry(params: {
|
||||
return undefined;
|
||||
}
|
||||
if (
|
||||
shouldSuppressBuiltInModel({
|
||||
shouldSuppressBuiltInModelCore({
|
||||
provider,
|
||||
id: modelId,
|
||||
...(cfg ? { config: cfg } : {}),
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { PluginMetadataSnapshot } from "../../plugins/plugin-metadata-snaps
|
||||
import { getModelProviderMetadataOwners } from "../provider-request-config.js";
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
loadPluginManifestRegistry: vi.fn(),
|
||||
loadPluginManifestRegistryCore: vi.fn(),
|
||||
normalizePluginDiscoveryResult: vi.fn(),
|
||||
resolveActivatableProviderOwnerPluginIds: vi.fn(),
|
||||
resolveBundledProviderCompatPluginIds: vi.fn(),
|
||||
@@ -25,7 +25,7 @@ vi.mock("../../plugins/manifest-owner-policy.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../../plugins/manifest-registry.js", () => ({
|
||||
loadPluginManifestRegistry: mocks.loadPluginManifestRegistry,
|
||||
loadPluginManifestRegistryCore: mocks.loadPluginManifestRegistryCore,
|
||||
}));
|
||||
|
||||
vi.mock("../../plugins/manifest.js", () => ({
|
||||
@@ -95,7 +95,7 @@ describe("prepared bundled provider static catalogs", () => {
|
||||
);
|
||||
mocks.resolveBundledProviderCompatPluginIds.mockReturnValue(["google"]);
|
||||
mocks.resolveOwningPluginIdsForProviderRef.mockReturnValue(["google"]);
|
||||
mocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
mocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
{
|
||||
id: "google",
|
||||
@@ -260,7 +260,7 @@ describe("prepared bundled provider static catalogs", () => {
|
||||
|
||||
it("discovers unconfigured providers when the full catalog is requested", async () => {
|
||||
mocks.resolveBundledProviderCompatPluginIds.mockReturnValue(["anthropic", "google"]);
|
||||
mocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
mocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
{
|
||||
id: "anthropic",
|
||||
|
||||
@@ -5,7 +5,7 @@ const manifestMocks = vi.hoisted(() => ({
|
||||
getCurrentPluginMetadataSnapshot: vi.fn(),
|
||||
listOpenClawPluginManifestMetadata: vi.fn(),
|
||||
loadPluginManifest: vi.fn(),
|
||||
loadPluginManifestRegistry: vi.fn(),
|
||||
loadPluginManifestRegistryCore: vi.fn(),
|
||||
}));
|
||||
const providerMocks = vi.hoisted(() => ({
|
||||
normalizePluginDiscoveryResult: vi.fn(),
|
||||
@@ -31,7 +31,7 @@ vi.mock("../../plugins/manifest.js", async (importOriginal) => ({
|
||||
|
||||
vi.mock("../../plugins/manifest-registry.js", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("../../plugins/manifest-registry.js")>()),
|
||||
loadPluginManifestRegistry: manifestMocks.loadPluginManifestRegistry,
|
||||
loadPluginManifestRegistryCore: manifestMocks.loadPluginManifestRegistryCore,
|
||||
}));
|
||||
|
||||
vi.mock("../../plugins/providers.js", async (importOriginal) => ({
|
||||
@@ -115,7 +115,7 @@ beforeEach(() => {
|
||||
mock.mockReset();
|
||||
}
|
||||
manifestMocks.listOpenClawPluginManifestMetadata.mockReturnValue([]);
|
||||
manifestMocks.loadPluginManifestRegistry.mockReturnValue({ plugins: [] });
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [] });
|
||||
providerMocks.resolveActivatableProviderOwnerPluginIds.mockImplementation(
|
||||
({ pluginIds }: { pluginIds: string[] }) => pluginIds,
|
||||
);
|
||||
@@ -340,6 +340,6 @@ describe("bundled static model catalog snapshot cache", () => {
|
||||
await expect(loadBundledProviderStaticCatalogContextModels({ cfg })).resolves.toEqual([
|
||||
expect.objectContaining({ provider: "google", contextWindow: 1_048_576 }),
|
||||
]);
|
||||
expect(manifestMocks.loadPluginManifestRegistry).not.toHaveBeenCalled();
|
||||
expect(manifestMocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@ const manifestMocks = vi.hoisted(() => ({
|
||||
getCurrentPluginMetadataSnapshot: vi.fn(),
|
||||
listOpenClawPluginManifestMetadata: vi.fn(),
|
||||
loadPluginManifest: vi.fn(),
|
||||
loadPluginManifestRegistry: vi.fn(),
|
||||
loadPluginManifestRegistryCore: vi.fn(),
|
||||
}));
|
||||
const providerMocks = vi.hoisted(() => ({
|
||||
normalizePluginDiscoveryResult: vi.fn(),
|
||||
@@ -31,7 +31,7 @@ vi.mock("../../plugins/manifest.js", async (importOriginal) => ({
|
||||
|
||||
vi.mock("../../plugins/manifest-registry.js", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("../../plugins/manifest-registry.js")>()),
|
||||
loadPluginManifestRegistry: manifestMocks.loadPluginManifestRegistry,
|
||||
loadPluginManifestRegistryCore: manifestMocks.loadPluginManifestRegistryCore,
|
||||
}));
|
||||
|
||||
vi.mock("../../plugins/providers.js", async (importOriginal) => ({
|
||||
@@ -124,7 +124,7 @@ function createMistralManifestPlugin(overrides?: {
|
||||
}
|
||||
|
||||
function setConflictingAzureAliasPlugins() {
|
||||
manifestMocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
{
|
||||
id: "openai",
|
||||
@@ -155,7 +155,7 @@ function setConflictingAzureAliasPlugins() {
|
||||
}
|
||||
|
||||
function setConditionalSuppressionAliasPlugin(params?: { unconditional?: boolean }) {
|
||||
manifestMocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
{
|
||||
id: "conditional-provider",
|
||||
@@ -195,7 +195,7 @@ beforeEach(() => {
|
||||
manifestMocks.getCurrentPluginMetadataSnapshot.mockReset();
|
||||
manifestMocks.listOpenClawPluginManifestMetadata.mockReset();
|
||||
manifestMocks.loadPluginManifest.mockReset();
|
||||
manifestMocks.loadPluginManifestRegistry.mockReset();
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReset();
|
||||
providerMocks.normalizePluginDiscoveryResult.mockReset();
|
||||
providerMocks.resolveActivatableProviderOwnerPluginIds.mockReset();
|
||||
providerMocks.resolveBundledProviderCompatPluginIds.mockReset();
|
||||
@@ -204,7 +204,7 @@ beforeEach(() => {
|
||||
providerMocks.runProviderStaticCatalog.mockReset();
|
||||
setManifestPlugins([]);
|
||||
manifestMocks.getCurrentPluginMetadataSnapshot.mockReturnValue(undefined);
|
||||
manifestMocks.loadPluginManifestRegistry.mockReturnValue({ plugins: [] });
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [] });
|
||||
providerMocks.resolveActivatableProviderOwnerPluginIds.mockImplementation(
|
||||
({ pluginIds }: { pluginIds: string[] }) => pluginIds,
|
||||
);
|
||||
@@ -217,7 +217,7 @@ beforeEach(() => {
|
||||
|
||||
describe("canonicalizeManifestModelCatalogProviderAlias", () => {
|
||||
it("canonicalizes unambiguous manifest-owned aliases", () => {
|
||||
manifestMocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
{
|
||||
id: "moonshot",
|
||||
@@ -261,7 +261,7 @@ describe("canonicalizeManifestModelCatalogProviderAlias", () => {
|
||||
expect(canonicalizeManifestModelCatalogProviderAlias({ provider: "moonshot-ai" })).toBe(
|
||||
"moonshot",
|
||||
);
|
||||
expect(manifestMocks.loadPluginManifestRegistry).not.toHaveBeenCalled();
|
||||
expect(manifestMocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled();
|
||||
expect(manifestMocks.getCurrentPluginMetadataSnapshot).toHaveBeenLastCalledWith({
|
||||
config: undefined,
|
||||
env: process.env,
|
||||
@@ -290,7 +290,7 @@ describe("canonicalizeManifestModelCatalogProviderAlias", () => {
|
||||
it("keeps custom environments on their own manifest registry context", () => {
|
||||
const env = { HOME: "/custom-home" };
|
||||
manifestMocks.getCurrentPluginMetadataSnapshot.mockReturnValue({ plugins: [] });
|
||||
manifestMocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
{
|
||||
id: "moonshot",
|
||||
@@ -310,7 +310,7 @@ describe("canonicalizeManifestModelCatalogProviderAlias", () => {
|
||||
"moonshot",
|
||||
);
|
||||
expect(manifestMocks.getCurrentPluginMetadataSnapshot).not.toHaveBeenCalled();
|
||||
expect(manifestMocks.loadPluginManifestRegistry).toHaveBeenCalledWith({
|
||||
expect(manifestMocks.loadPluginManifestRegistryCore).toHaveBeenCalledWith({
|
||||
config: undefined,
|
||||
env,
|
||||
workspaceDir: undefined,
|
||||
@@ -344,7 +344,7 @@ describe("canonicalizeManifestModelCatalogProviderAlias", () => {
|
||||
discovery: { openai: "runtime" },
|
||||
},
|
||||
};
|
||||
manifestMocks.loadPluginManifestRegistry.mockReturnValue({ plugins: [plugin] });
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [plugin] });
|
||||
|
||||
expectManifestAliasResolution(
|
||||
{
|
||||
@@ -473,7 +473,7 @@ describe("canonicalizeManifestModelCatalogProviderAlias", () => {
|
||||
});
|
||||
|
||||
it("accepts activated config-load-path alias owners", () => {
|
||||
manifestMocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
{
|
||||
id: "config-provider",
|
||||
@@ -661,7 +661,7 @@ describe("resolveBundledProviderStaticCatalogModel", () => {
|
||||
staticCatalog: { run: vi.fn() },
|
||||
};
|
||||
providerMocks.resolveBundledProviderCompatPluginIds.mockReturnValue(["google"]);
|
||||
manifestMocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
createManifestRecord("google", {
|
||||
providerDiscoverySource: "/fixtures/google/provider-discovery.ts",
|
||||
@@ -704,7 +704,7 @@ describe("resolveBundledProviderStaticCatalogModel", () => {
|
||||
|
||||
it("skips bundled providers without discovery entries during context warmup", async () => {
|
||||
providerMocks.resolveBundledProviderCompatPluginIds.mockReturnValue(["google", "openai"]);
|
||||
manifestMocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
{
|
||||
id: "google",
|
||||
@@ -726,7 +726,7 @@ describe("resolveBundledProviderStaticCatalogModel", () => {
|
||||
|
||||
it("keeps successful provider context rows when another static catalog fails", async () => {
|
||||
providerMocks.resolveBundledProviderCompatPluginIds.mockReturnValue(["google", "minimax"]);
|
||||
manifestMocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
createManifestRecord("google", {
|
||||
providerDiscoverySource: "/fixtures/google/provider-discovery.ts",
|
||||
|
||||
@@ -10,7 +10,7 @@ import { normalizePluginsConfig } from "../../plugins/config-state.js";
|
||||
import { getCurrentPluginMetadataSnapshot } from "../../plugins/current-plugin-metadata-snapshot.js";
|
||||
import { listOpenClawPluginManifestMetadata } from "../../plugins/manifest-metadata-scan.js";
|
||||
import { passesManifestOwnerBasePolicy } from "../../plugins/manifest-owner-policy.js";
|
||||
import { loadPluginManifestRegistry } from "../../plugins/manifest-registry.js";
|
||||
import { loadPluginManifestRegistryCore } from "../../plugins/manifest-registry.js";
|
||||
import { loadPluginManifest } from "../../plugins/manifest.js";
|
||||
import type { PluginMetadataSnapshot } from "../../plugins/plugin-metadata-snapshot.types.js";
|
||||
import {
|
||||
@@ -520,7 +520,7 @@ export async function loadBundledProviderStaticCatalogContextModels(
|
||||
const discoveryEntryPluginIds = new Set(
|
||||
(
|
||||
metadataSnapshot?.manifestRegistry?.plugins ??
|
||||
loadPluginManifestRegistry({
|
||||
loadPluginManifestRegistryCore({
|
||||
config: params.cfg,
|
||||
workspaceDir: params.workspaceDir,
|
||||
env,
|
||||
|
||||
@@ -97,7 +97,7 @@ vi.mock("../model-suppression.js", () => {
|
||||
}
|
||||
|
||||
return {
|
||||
shouldSuppressBuiltInModel: ({
|
||||
shouldSuppressBuiltInModelCore: ({
|
||||
provider,
|
||||
id,
|
||||
baseUrl,
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
import { resolvePreferredSessionKeyForSessionIdMatches } from "../../../sessions/session-id-resolution.js";
|
||||
import { resolveDefaultAgentId } from "../../agent-scope.js";
|
||||
import {
|
||||
resolveSessionKeyForRequest,
|
||||
resolveSessionKeyForRequestCore,
|
||||
resolveStoredSessionKeyForSessionId,
|
||||
} from "../../command/session.js";
|
||||
import {
|
||||
@@ -196,7 +196,7 @@ export function backfillSessionKey(params: {
|
||||
sessionId: params.sessionId,
|
||||
agentId: params.agentId,
|
||||
})
|
||||
: resolveSessionKeyForRequest({
|
||||
: resolveSessionKeyForRequestCore({
|
||||
cfg: params.config,
|
||||
sessionId: params.sessionId,
|
||||
clone: false,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { normalizeOptionalString } from "@openclaw/normalization-core/string-coe
|
||||
import {
|
||||
DEFAULT_HEARTBEAT_EVERY,
|
||||
HEARTBEAT_CRON_TASK_GUIDANCE,
|
||||
resolveHeartbeatPrompt as resolveHeartbeatPromptText,
|
||||
resolveHeartbeatPromptCore as resolveHeartbeatPromptText,
|
||||
} from "../auto-reply/heartbeat.js";
|
||||
import { parseDurationMs } from "../cli/parse-duration.js";
|
||||
import type { AgentDefaultsConfig } from "../config/types.agent-defaults.js";
|
||||
|
||||
@@ -39,7 +39,7 @@ const pluginMetadataMocks = vi.hoisted(() => {
|
||||
});
|
||||
|
||||
const setupRegistryMocks = vi.hoisted(() => ({
|
||||
resolvePluginSetupProvider: vi.fn(() => undefined),
|
||||
resolvePluginSetupProviderCore: vi.fn(() => undefined),
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({
|
||||
@@ -51,7 +51,7 @@ vi.mock("../plugins/plugin-metadata-snapshot.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/setup-registry.js", () => ({
|
||||
resolvePluginSetupProvider: setupRegistryMocks.resolvePluginSetupProvider,
|
||||
resolvePluginSetupProviderCore: setupRegistryMocks.resolvePluginSetupProviderCore,
|
||||
}));
|
||||
|
||||
describe("resolveEnvApiKey provider auth aliases", () => {
|
||||
@@ -62,8 +62,8 @@ describe("resolveEnvApiKey provider auth aliases", () => {
|
||||
);
|
||||
pluginMetadataMocks.loadPluginMetadataSnapshot.mockReset();
|
||||
pluginMetadataMocks.loadPluginMetadataSnapshot.mockReturnValue(pluginMetadataMocks.snapshot);
|
||||
setupRegistryMocks.resolvePluginSetupProvider.mockReset();
|
||||
setupRegistryMocks.resolvePluginSetupProvider.mockReturnValue(undefined);
|
||||
setupRegistryMocks.resolvePluginSetupProviderCore.mockReset();
|
||||
setupRegistryMocks.resolvePluginSetupProviderCore.mockReturnValue(undefined);
|
||||
});
|
||||
|
||||
it("reuses the current scoped metadata snapshot while resolving provider auth aliases", () => {
|
||||
@@ -100,7 +100,7 @@ describe("resolveEnvApiKey provider auth aliases", () => {
|
||||
// fallback must receive the same scope as metadata resolution.
|
||||
const config = {};
|
||||
const env = {} as NodeJS.ProcessEnv;
|
||||
setupRegistryMocks.resolvePluginSetupProvider.mockReturnValue({
|
||||
setupRegistryMocks.resolvePluginSetupProviderCore.mockReturnValue({
|
||||
resolveConfigApiKey: () => "setup-secret",
|
||||
} as never);
|
||||
|
||||
@@ -113,7 +113,7 @@ describe("resolveEnvApiKey provider auth aliases", () => {
|
||||
apiKey: "setup-secret",
|
||||
source: "env",
|
||||
});
|
||||
expect(setupRegistryMocks.resolvePluginSetupProvider).toHaveBeenCalledWith({
|
||||
expect(setupRegistryMocks.resolvePluginSetupProviderCore).toHaveBeenCalledWith({
|
||||
provider: "setup-cloud",
|
||||
config,
|
||||
workspaceDir: "/workspace",
|
||||
@@ -135,7 +135,7 @@ describe("resolveEnvApiKey provider auth aliases", () => {
|
||||
).toEqual({ mode: "api-key", source: "env: EXTERNAL_CLOUD_API_KEY" });
|
||||
expect(pluginMetadataMocks.getCurrentPluginMetadataSnapshot).not.toHaveBeenCalled();
|
||||
expect(pluginMetadataMocks.loadPluginMetadataSnapshot).not.toHaveBeenCalled();
|
||||
expect(setupRegistryMocks.resolvePluginSetupProvider).not.toHaveBeenCalled();
|
||||
expect(setupRegistryMocks.resolvePluginSetupProviderCore).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("retains setup-provider fallback as deferred planning evidence without loading it", () => {
|
||||
@@ -149,6 +149,6 @@ describe("resolveEnvApiKey provider auth aliases", () => {
|
||||
).toEqual({ kind: "setup-provider", mode: "api-key", source: "setup provider" });
|
||||
expect(pluginMetadataMocks.getCurrentPluginMetadataSnapshot).not.toHaveBeenCalled();
|
||||
expect(pluginMetadataMocks.loadPluginMetadataSnapshot).not.toHaveBeenCalled();
|
||||
expect(setupRegistryMocks.resolvePluginSetupProvider).not.toHaveBeenCalled();
|
||||
expect(setupRegistryMocks.resolvePluginSetupProviderCore).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { normalizeProviderIdForAuth } from "@openclaw/model-catalog-core/provider-id";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { getShellEnvAppliedKeys } from "../infra/shell-env.js";
|
||||
import { resolvePluginSetupProvider } from "../plugins/setup-registry.js";
|
||||
import { resolvePluginSetupProviderCore } from "../plugins/setup-registry.js";
|
||||
import { resolveLocalProviderAuthEvidence } from "../secrets/provider-auth-evidence.js";
|
||||
import type { ProviderAuthEvidence } from "../secrets/provider-env-vars.js";
|
||||
import { normalizeOptionalSecretInput } from "../utils/normalize-secret-input.js";
|
||||
@@ -193,7 +193,7 @@ export function resolveEnvApiKey(
|
||||
return null;
|
||||
}
|
||||
|
||||
const setupProvider = resolvePluginSetupProvider({
|
||||
const setupProvider = resolvePluginSetupProviderCore({
|
||||
provider: normalized,
|
||||
config: options.config,
|
||||
workspaceDir: options.workspaceDir,
|
||||
|
||||
@@ -71,7 +71,12 @@ function testModelDefinition(id: string): Model {
|
||||
vi.mock("../plugins/setup-registry.js", async () => {
|
||||
const { readFileSync } = await import("node:fs");
|
||||
return {
|
||||
resolvePluginSetupProvider: ({ provider }: { provider: string; env: NodeJS.ProcessEnv }) => {
|
||||
resolvePluginSetupProviderCore: ({
|
||||
provider,
|
||||
}: {
|
||||
provider: string;
|
||||
env: NodeJS.ProcessEnv;
|
||||
}) => {
|
||||
if (provider !== "anthropic-vertex") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ vi.mock("../plugins/providers.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/setup-registry.js", () => ({
|
||||
resolvePluginSetupProvider: () => undefined,
|
||||
resolvePluginSetupProviderCore: () => undefined,
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/provider-runtime.js", () => {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
// Verifies configured model ref resolution and OpenRouter compatibility aliases.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/types.js";
|
||||
import { resolveAllowedModelRef, resolveConfiguredModelRef } from "./model-selection-resolve.js";
|
||||
import {
|
||||
resolveAllowedModelRefCore,
|
||||
resolveConfiguredModelRef,
|
||||
} from "./model-selection-resolve.js";
|
||||
|
||||
describe("model-selection-resolve OpenRouter compat aliases", () => {
|
||||
it("keeps inherited policy aliases bound to default metadata for per-agent selection", () => {
|
||||
@@ -30,7 +33,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => {
|
||||
];
|
||||
|
||||
expect(
|
||||
resolveAllowedModelRef({
|
||||
resolveAllowedModelRefCore({
|
||||
cfg,
|
||||
catalog,
|
||||
raw: "approved",
|
||||
@@ -39,7 +42,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => {
|
||||
}),
|
||||
).toEqual({ error: "model not allowed: anthropic/claude-sonnet-4-6" });
|
||||
expect(
|
||||
resolveAllowedModelRef({
|
||||
resolveAllowedModelRefCore({
|
||||
cfg,
|
||||
catalog,
|
||||
raw: "openai/gpt-5.5",
|
||||
@@ -75,7 +78,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => {
|
||||
];
|
||||
|
||||
expect(
|
||||
resolveAllowedModelRef({
|
||||
resolveAllowedModelRefCore({
|
||||
cfg,
|
||||
catalog,
|
||||
raw: "approved",
|
||||
@@ -87,7 +90,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => {
|
||||
ref: { provider: "anthropic", model: "claude-sonnet-4-6" },
|
||||
});
|
||||
expect(
|
||||
resolveAllowedModelRef({
|
||||
resolveAllowedModelRefCore({
|
||||
cfg,
|
||||
catalog,
|
||||
raw: "openai/gpt-5.5",
|
||||
@@ -120,7 +123,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => {
|
||||
} as unknown as OpenClawConfig;
|
||||
|
||||
expect(
|
||||
resolveAllowedModelRef({
|
||||
resolveAllowedModelRefCore({
|
||||
cfg,
|
||||
catalog: [],
|
||||
raw: "litellm/cron",
|
||||
@@ -172,7 +175,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => {
|
||||
];
|
||||
|
||||
expect(
|
||||
resolveAllowedModelRef({
|
||||
resolveAllowedModelRefCore({
|
||||
cfg,
|
||||
catalog,
|
||||
raw: "openrouter:free",
|
||||
|
||||
@@ -64,7 +64,7 @@ export function getModelRefStatus(
|
||||
}
|
||||
|
||||
/** Resolves a raw model string into an allowed model ref or an explanatory error. */
|
||||
export function resolveAllowedModelRef(
|
||||
export function resolveAllowedModelRefCore(
|
||||
params: {
|
||||
cfg: OpenClawConfig;
|
||||
catalog: ModelCatalogEntry[];
|
||||
|
||||
@@ -6,7 +6,7 @@ import { createWarnLogCapture } from "../logging/test-helpers/warn-log-capture.j
|
||||
import { resolveAgentHarnessPolicy } from "./harness/policy.js";
|
||||
import {
|
||||
getModelRefStatus as getNarrowModelRefStatus,
|
||||
resolveAllowedModelRef as resolveNarrowAllowedModelRef,
|
||||
resolveAllowedModelRefCore as resolveNarrowAllowedModelRef,
|
||||
} from "./model-selection-resolve.js";
|
||||
import { isModelKeyAllowedBySet } from "./model-selection-shared.js";
|
||||
import {
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
} from "./model-ref-shared.js";
|
||||
import { findNormalizedProviderValue, parseModelRef } from "./model-selection-normalize.js";
|
||||
import {
|
||||
resolveAllowedModelRef as resolveAllowedModelRefInternal,
|
||||
resolveAllowedModelRefCore as resolveAllowedModelRefInternal,
|
||||
resolveConfiguredModelFallbacks,
|
||||
} from "./model-selection-resolve.js";
|
||||
import {
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
*/
|
||||
import {
|
||||
buildShouldSuppressBuiltInModelCore,
|
||||
shouldSuppressBuiltInModel as shouldSuppressBuiltInModelImpl,
|
||||
shouldSuppressBuiltInModelCore as shouldSuppressBuiltInModelImpl,
|
||||
} from "./model-suppression.js";
|
||||
|
||||
type ShouldSuppressBuiltInModel =
|
||||
typeof import("./model-suppression.js").shouldSuppressBuiltInModel;
|
||||
typeof import("./model-suppression.js").shouldSuppressBuiltInModelCore;
|
||||
type BuildShouldSuppressBuiltInModel =
|
||||
typeof import("./model-suppression.js").buildShouldSuppressBuiltInModelCore;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import { setCurrentPluginMetadataSnapshotState } from "../plugins/current-plugin
|
||||
import { clearPluginMetadataLifecycleCaches } from "../plugins/plugin-metadata-lifecycle.js";
|
||||
import {
|
||||
buildShouldSuppressBuiltInModelCore,
|
||||
shouldSuppressBuiltInModel,
|
||||
shouldSuppressBuiltInModelCore,
|
||||
} from "./model-suppression.js";
|
||||
|
||||
const originalBundledPluginsDir = process.env.OPENCLAW_BUNDLED_PLUGINS_DIR;
|
||||
@@ -44,7 +44,7 @@ describe("model suppression", () => {
|
||||
mocks.buildManifestBuiltInModelSuppressionResolver.mockReturnValueOnce(resolver);
|
||||
|
||||
expect(
|
||||
shouldSuppressBuiltInModel({
|
||||
shouldSuppressBuiltInModelCore({
|
||||
provider: "openai",
|
||||
id: "gpt-5.3-codex-spark",
|
||||
config,
|
||||
@@ -67,7 +67,7 @@ describe("model suppression", () => {
|
||||
mocks.buildManifestBuiltInModelSuppressionResolver.mockReturnValueOnce(resolver);
|
||||
|
||||
expect(
|
||||
shouldSuppressBuiltInModel({
|
||||
shouldSuppressBuiltInModelCore({
|
||||
provider: "openai",
|
||||
id: "gpt-5.3-codex-spark",
|
||||
config: {},
|
||||
@@ -82,8 +82,10 @@ describe("model suppression", () => {
|
||||
const config = {};
|
||||
mocks.buildManifestBuiltInModelSuppressionResolver.mockReturnValueOnce(resolver);
|
||||
|
||||
expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false);
|
||||
expect(shouldSuppressBuiltInModel({ provider: "anthropic", id: "claude-4", config })).toBe(
|
||||
expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe(
|
||||
false,
|
||||
);
|
||||
expect(shouldSuppressBuiltInModelCore({ provider: "anthropic", id: "claude-4", config })).toBe(
|
||||
false,
|
||||
);
|
||||
|
||||
@@ -100,10 +102,14 @@ describe("model suppression", () => {
|
||||
.mockReturnValueOnce(secondResolver);
|
||||
|
||||
setCurrentPluginMetadataSnapshotState({ id: "first" }, undefined);
|
||||
expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false);
|
||||
expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe(
|
||||
false,
|
||||
);
|
||||
|
||||
setCurrentPluginMetadataSnapshotState({ id: "second" }, undefined);
|
||||
expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false);
|
||||
expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe(
|
||||
false,
|
||||
);
|
||||
|
||||
expect(mocks.buildManifestBuiltInModelSuppressionResolver).toHaveBeenCalledTimes(2);
|
||||
expect(firstResolver).toHaveBeenCalledOnce();
|
||||
@@ -119,10 +125,14 @@ describe("model suppression", () => {
|
||||
.mockReturnValueOnce(secondResolver);
|
||||
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = "/tmp/openclaw-bundled-a";
|
||||
expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false);
|
||||
expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe(
|
||||
false,
|
||||
);
|
||||
|
||||
process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = "/tmp/openclaw-bundled-b";
|
||||
expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false);
|
||||
expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe(
|
||||
false,
|
||||
);
|
||||
|
||||
expect(mocks.buildManifestBuiltInModelSuppressionResolver).toHaveBeenCalledTimes(2);
|
||||
expect(firstResolver).toHaveBeenCalledOnce();
|
||||
@@ -137,10 +147,14 @@ describe("model suppression", () => {
|
||||
.mockReturnValueOnce(firstResolver)
|
||||
.mockReturnValueOnce(secondResolver);
|
||||
|
||||
expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false);
|
||||
expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe(
|
||||
false,
|
||||
);
|
||||
|
||||
config.plugins.load.paths = ["/tmp/openclaw-plugin-b"];
|
||||
expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false);
|
||||
expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe(
|
||||
false,
|
||||
);
|
||||
|
||||
expect(mocks.buildManifestBuiltInModelSuppressionResolver).toHaveBeenCalledTimes(2);
|
||||
expect(firstResolver).toHaveBeenCalledOnce();
|
||||
|
||||
@@ -133,7 +133,7 @@ export function shouldSuppressBuiltInModelFromManifest(params: {
|
||||
}
|
||||
|
||||
/** Return true when any built-in suppression rule applies to a model entry. */
|
||||
export function shouldSuppressBuiltInModel(params: {
|
||||
export function shouldSuppressBuiltInModelCore(params: {
|
||||
provider?: string | null;
|
||||
id?: string | null;
|
||||
baseUrl?: string | null;
|
||||
|
||||
@@ -56,7 +56,7 @@ beforeAll(async () => {
|
||||
|
||||
const manifestRegistryModule = await import("../plugins/manifest-registry.js");
|
||||
loadPluginManifestRegistrySpy = vi
|
||||
.spyOn(manifestRegistryModule, "loadPluginManifestRegistry")
|
||||
.spyOn(manifestRegistryModule, "loadPluginManifestRegistryCore")
|
||||
.mockReturnValue(manifestRegistry as never);
|
||||
const publicSurfaceLoader = await import("../plugins/public-surface-loader.js");
|
||||
loadBundledPluginPublicArtifactModuleSyncSpy = vi
|
||||
|
||||
@@ -5,7 +5,7 @@ import { applyProviderNativeStreamingUsageCompat } from "../plugin-sdk/provider-
|
||||
import { resolveMissingProviderApiKey } from "./models-config.providers.secret-helpers.js";
|
||||
|
||||
vi.mock("../plugins/setup-registry.js", () => ({
|
||||
resolvePluginSetupProvider: () => undefined,
|
||||
resolvePluginSetupProviderCore: () => undefined,
|
||||
}));
|
||||
|
||||
vi.mock("../infra/shell-env.js", () => ({
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from "./models-config.providers.secret-helpers.js";
|
||||
|
||||
vi.mock("../plugins/setup-registry.js", () => ({
|
||||
resolvePluginSetupProvider: () => undefined,
|
||||
resolvePluginSetupProviderCore: () => undefined,
|
||||
}));
|
||||
|
||||
vi.mock("../infra/shell-env.js", () => ({
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
import { enforceSourceManagedProviderSecrets } from "./models-config.providers.source-managed.js";
|
||||
|
||||
vi.mock("../plugins/manifest-registry.js", () => ({
|
||||
loadPluginManifestRegistry: () => ({ plugins: [] }),
|
||||
loadPluginManifestRegistryCore: () => ({ plugins: [] }),
|
||||
}));
|
||||
|
||||
vi.mock("./model-auth-env-vars.js", () => ({
|
||||
|
||||
@@ -53,7 +53,7 @@ import {
|
||||
requireApiKey,
|
||||
resolveUsableCustomProviderApiKey,
|
||||
} from "./model-auth.js";
|
||||
import { shouldSuppressBuiltInModel } from "./model-suppression.js";
|
||||
import { shouldSuppressBuiltInModelCore } from "./model-suppression.js";
|
||||
import { ensureOpenClawModelsJson } from "./models-config.js";
|
||||
import type { StreamFn } from "./runtime/index.js";
|
||||
import { appendPrioritizedDynamicLiveModels } from "./test-helpers/live-model-dynamic-candidates.js";
|
||||
@@ -1833,7 +1833,7 @@ describeLive("live models (profile keys)", () => {
|
||||
}> = [];
|
||||
|
||||
for (const model of models) {
|
||||
if (shouldSuppressBuiltInModel({ provider: model.provider, id: model.id })) {
|
||||
if (shouldSuppressBuiltInModelCore({ provider: model.provider, id: model.id })) {
|
||||
continue;
|
||||
}
|
||||
if (!targetMatcher.matchesProvider(model.provider)) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { expectDefined } from "@openclaw/normalization-core";
|
||||
import { Value } from "typebox/value";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { resolveSessionStoreEntry } from "../config/sessions/store-entry.js";
|
||||
import { resolveSessionStoreEntryCore } from "../config/sessions/store-entry.js";
|
||||
import { mergeSessionEntry, type SessionEntry } from "../config/sessions/types.js";
|
||||
import {
|
||||
clearInternalHooks,
|
||||
@@ -129,7 +129,7 @@ function createSessionsModuleMock() {
|
||||
const storePath =
|
||||
scope.storePath ?? resolveMockStorePath(undefined, { agentId: scope.agentId });
|
||||
const store = loadSessionStoreMock(storePath) as Record<string, SessionEntry>;
|
||||
const resolved = resolveSessionStoreEntry({ store, sessionKey: scope.sessionKey });
|
||||
const resolved = resolveSessionStoreEntryCore({ store, sessionKey: scope.sessionKey });
|
||||
const existing = resolved.existing ?? options?.fallbackEntry;
|
||||
if (!existing) {
|
||||
return null;
|
||||
@@ -160,7 +160,7 @@ function createSessionsModuleMock() {
|
||||
if (!candidateKey) {
|
||||
continue;
|
||||
}
|
||||
const resolved = resolveSessionStoreEntry({ store, sessionKey: candidateKey });
|
||||
const resolved = resolveSessionStoreEntryCore({ store, sessionKey: candidateKey });
|
||||
if (!resolved.existing) {
|
||||
continue;
|
||||
}
|
||||
@@ -346,7 +346,7 @@ vi.mock("../plugins/provider-thinking.js", () => ({
|
||||
// session_status surface only needs model selection semantics here, not real
|
||||
// bundled provider registration.
|
||||
vi.mock("../plugins/providers.runtime.js", () => ({
|
||||
resolvePluginProviders: () => [],
|
||||
resolvePluginProvidersCore: () => [],
|
||||
}));
|
||||
vi.mock("../agents/auth-profiles.js", createAuthProfilesModuleMock);
|
||||
vi.mock("../agents/model-auth.js", createModelAuthModuleMock);
|
||||
|
||||
@@ -19,7 +19,7 @@ const authLookupMocks = vi.hoisted(() => ({
|
||||
}));
|
||||
|
||||
const setupRegistryMocks = vi.hoisted(() => ({
|
||||
resolvePluginSetupProvider: vi.fn(() => ({
|
||||
resolvePluginSetupProviderCore: vi.fn(() => ({
|
||||
resolveConfigApiKey: () => "gcp-vertex-credentials",
|
||||
})),
|
||||
}));
|
||||
@@ -31,7 +31,7 @@ vi.mock("../model-auth-env-vars.js", async (importOriginal) => ({
|
||||
|
||||
vi.mock("../../plugins/setup-registry.js", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("../../plugins/setup-registry.js")>()),
|
||||
resolvePluginSetupProvider: setupRegistryMocks.resolvePluginSetupProvider,
|
||||
resolvePluginSetupProviderCore: setupRegistryMocks.resolvePluginSetupProviderCore,
|
||||
}));
|
||||
|
||||
describe("prepared setup-provider auth fallback", () => {
|
||||
@@ -61,7 +61,7 @@ describe("prepared setup-provider auth fallback", () => {
|
||||
authProfileStore: store,
|
||||
});
|
||||
|
||||
expect(setupRegistryMocks.resolvePluginSetupProvider).not.toHaveBeenCalled();
|
||||
expect(setupRegistryMocks.resolvePluginSetupProviderCore).not.toHaveBeenCalled();
|
||||
expect(prepared.attempts).toMatchObject([
|
||||
{ kind: "profile", profileId },
|
||||
{
|
||||
@@ -104,6 +104,6 @@ describe("prepared setup-provider auth fallback", () => {
|
||||
source: "gcloud adc",
|
||||
mode: "api-key",
|
||||
});
|
||||
expect(setupRegistryMocks.resolvePluginSetupProvider).toHaveBeenCalledOnce();
|
||||
expect(setupRegistryMocks.resolvePluginSetupProviderCore).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -106,7 +106,7 @@ export function isHeartbeatContentEffectivelyEmpty(content: string | undefined |
|
||||
}
|
||||
|
||||
/** Resolves configured heartbeat prompt text with the built-in default fallback. */
|
||||
export function resolveHeartbeatPrompt(raw?: string): string {
|
||||
export function resolveHeartbeatPromptCore(raw?: string): string {
|
||||
const trimmed = normalizeOptionalString(raw) ?? "";
|
||||
return trimmed || HEARTBEAT_PROMPT;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Shared session-store helpers for command handlers that mutate sessions.
|
||||
import { resolveSessionStoreEntry, type SessionEntry } from "../../config/sessions.js";
|
||||
import { resolveSessionStoreEntryCore, type SessionEntry } from "../../config/sessions.js";
|
||||
import { patchSessionEntryCore } from "../../config/sessions/session-accessor.js";
|
||||
import { sessionSnapshotChangesApplied } from "../../config/sessions/session-snapshot-merge.js";
|
||||
import { applyAbortCutoffToSessionEntry, type AbortCutoff } from "./abort-cutoff.js";
|
||||
@@ -25,7 +25,7 @@ export function resolveCommandSessionEntryForKey(
|
||||
if (!store || !sessionKey) {
|
||||
return {};
|
||||
}
|
||||
const resolved = resolveSessionStoreEntry({ store, sessionKey });
|
||||
const resolved = resolveSessionStoreEntryCore({ store, sessionKey });
|
||||
if (!resolved.existing) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -76,12 +76,12 @@ export function createInboundEnvelopeBuilder<TConfig, TEnvelope>(params: {
|
||||
cfg: TConfig;
|
||||
route: RouteLike;
|
||||
sessionStore?: string;
|
||||
resolveStorePath: (store: string | undefined, opts: { agentId: string }) => string;
|
||||
resolveSessionStorePathCore: (store: string | undefined, opts: { agentId: string }) => string;
|
||||
readSessionUpdatedAt: (params: { storePath: string; sessionKey: string }) => number | undefined;
|
||||
resolveEnvelopeFormatOptions: (cfg: TConfig) => TEnvelope;
|
||||
formatAgentEnvelope: (params: InboundEnvelopeFormatParams<TEnvelope>) => string;
|
||||
}) {
|
||||
const storePath = params.resolveStorePath(params.sessionStore, {
|
||||
const storePath = params.resolveSessionStorePathCore(params.sessionStore, {
|
||||
agentId: params.route.agentId,
|
||||
});
|
||||
const envelopeOptions = params.resolveEnvelopeFormatOptions(params.cfg);
|
||||
@@ -114,7 +114,7 @@ export function resolveInboundRouteEnvelopeBuilder<
|
||||
peer: TPeer;
|
||||
resolveAgentRoute: (params: InboundRouteResolveParams<TConfig, TPeer>) => TRoute;
|
||||
sessionStore?: string;
|
||||
resolveStorePath: (store: string | undefined, opts: { agentId: string }) => string;
|
||||
resolveSessionStorePathCore: (store: string | undefined, opts: { agentId: string }) => string;
|
||||
readSessionUpdatedAt: (params: { storePath: string; sessionKey: string }) => number | undefined;
|
||||
resolveEnvelopeFormatOptions: (cfg: TConfig) => TEnvelope;
|
||||
formatAgentEnvelope: (params: InboundEnvelopeFormatParams<TEnvelope>) => string;
|
||||
@@ -132,7 +132,7 @@ export function resolveInboundRouteEnvelopeBuilder<
|
||||
cfg: params.cfg,
|
||||
route,
|
||||
sessionStore: params.sessionStore,
|
||||
resolveStorePath: params.resolveStorePath,
|
||||
resolveSessionStorePathCore: params.resolveSessionStorePathCore,
|
||||
readSessionUpdatedAt: params.readSessionUpdatedAt,
|
||||
resolveEnvelopeFormatOptions: params.resolveEnvelopeFormatOptions,
|
||||
formatAgentEnvelope: params.formatAgentEnvelope,
|
||||
@@ -183,7 +183,7 @@ export function resolveInboundRouteEnvelopeBuilderWithRuntime<
|
||||
peer: params.peer,
|
||||
resolveAgentRoute: (routeParams) => params.runtime.routing.resolveAgentRoute(routeParams),
|
||||
sessionStore: params.sessionStore,
|
||||
resolveStorePath: params.runtime.session.resolveStorePath,
|
||||
resolveSessionStorePathCore: params.runtime.session.resolveStorePath,
|
||||
readSessionUpdatedAt: params.runtime.session.readSessionUpdatedAt,
|
||||
resolveEnvelopeFormatOptions: params.runtime.reply.resolveEnvelopeFormatOptions,
|
||||
formatAgentEnvelope: params.runtime.reply.formatAgentEnvelope,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { expectDefined } from "@openclaw/normalization-core";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { classifyBundledExtensionSourcePath } from "../../../../scripts/lib/extension-source-classifier.mts";
|
||||
import { GUARDED_EXTENSION_PUBLIC_SURFACE_BASENAMES } from "../../../plugin-sdk/test-helpers/public-artifacts.js";
|
||||
import { loadPluginManifestRegistry } from "../../../plugins/manifest-registry.js";
|
||||
import { loadPluginManifestRegistryCore } from "../../../plugins/manifest-registry.js";
|
||||
import { expectNoReaddirSyncDuring } from "../../../test-utils/fs-scan-assertions.js";
|
||||
import {
|
||||
listGitTrackedFiles,
|
||||
@@ -20,7 +20,7 @@ const REPO_ROOT = resolve(ROOT_DIR, "..");
|
||||
const ALLOWED_EXTENSION_PUBLIC_SURFACES = new Set(GUARDED_EXTENSION_PUBLIC_SURFACE_BASENAMES);
|
||||
ALLOWED_EXTENSION_PUBLIC_SURFACES.add("test-api.js");
|
||||
const BUNDLED_PLUGIN_ROOT_DIR = "extensions";
|
||||
const bundledPluginRecords = loadPluginManifestRegistry({
|
||||
const bundledPluginRecords = loadPluginManifestRegistryCore({
|
||||
config: {},
|
||||
}).plugins.filter((plugin) => plugin.origin === "bundled");
|
||||
const bundledPluginRoots = new Map(
|
||||
|
||||
@@ -418,7 +418,7 @@ vi.mock("../plugins/installed-plugin-index-store.js", async (importOriginal) =>
|
||||
});
|
||||
|
||||
vi.mock("../plugins/manifest-registry.js", () => ({
|
||||
loadPluginManifestRegistry: ((...args: unknown[]) =>
|
||||
loadPluginManifestRegistryCore: ((...args: unknown[]) =>
|
||||
invokeMock<unknown[], unknown>(loadPluginManifestRegistryMock, ...args)) as (
|
||||
...args: unknown[]
|
||||
) => unknown,
|
||||
|
||||
@@ -8,7 +8,7 @@ const mocks = await vi.hoisted(async () => {
|
||||
const runtime = createCliRuntimeMock(vi);
|
||||
return {
|
||||
loadConfig: vi.fn(),
|
||||
runSecurityAudit: vi.fn(),
|
||||
runSecurityAuditCore: vi.fn(),
|
||||
fixSecurityFootguns: vi.fn(),
|
||||
resolveCommandSecretRefsViaGateway: vi.fn(),
|
||||
getSecurityAuditCommandSecretTargetIds: vi.fn(
|
||||
@@ -20,7 +20,7 @@ const mocks = await vi.hoisted(async () => {
|
||||
|
||||
const {
|
||||
loadConfig,
|
||||
runSecurityAudit,
|
||||
runSecurityAuditCore,
|
||||
fixSecurityFootguns,
|
||||
resolveCommandSecretRefsViaGateway,
|
||||
getSecurityAuditCommandSecretTargetIds,
|
||||
@@ -37,7 +37,7 @@ vi.mock("../runtime.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../security/audit.js", () => ({
|
||||
runSecurityAudit: (opts: unknown) => mocks.runSecurityAudit(opts),
|
||||
runSecurityAuditCore: (opts: unknown) => mocks.runSecurityAuditCore(opts),
|
||||
}));
|
||||
|
||||
vi.mock("../security/fix.js", () => ({
|
||||
@@ -68,7 +68,7 @@ function primeDeepAuditConfig(sourceConfig = { gateway: { mode: "local" } }) {
|
||||
targetStatesByPath: {},
|
||||
hadUnresolvedTargets: false,
|
||||
});
|
||||
runSecurityAudit.mockResolvedValue({
|
||||
runSecurityAuditCore.mockResolvedValue({
|
||||
ts: 0,
|
||||
summary: { critical: 0, warn: 0, info: 0 },
|
||||
findings: [],
|
||||
@@ -82,7 +82,7 @@ function lastSecretResolverOptions(): Record<string, unknown> | undefined {
|
||||
}
|
||||
|
||||
function lastSecurityAuditOptions(): Record<string, unknown> | undefined {
|
||||
const calls = runSecurityAudit.mock.calls;
|
||||
const calls = runSecurityAuditCore.mock.calls;
|
||||
return calls[calls.length - 1]?.[0] as Record<string, unknown> | undefined;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ describe("security CLI", () => {
|
||||
beforeEach(() => {
|
||||
runtimeLogs.length = 0;
|
||||
loadConfig.mockReset();
|
||||
runSecurityAudit.mockReset();
|
||||
runSecurityAuditCore.mockReset();
|
||||
fixSecurityFootguns.mockReset();
|
||||
resolveCommandSecretRefsViaGateway.mockReset();
|
||||
getSecurityAuditCommandSecretTargetIds.mockClear();
|
||||
@@ -134,7 +134,7 @@ describe("security CLI", () => {
|
||||
targetStatesByPath: {},
|
||||
hadUnresolvedTargets: false,
|
||||
});
|
||||
runSecurityAudit.mockResolvedValue({
|
||||
runSecurityAuditCore.mockResolvedValue({
|
||||
ts: 0,
|
||||
summary: { critical: 0, warn: 1, info: 0 },
|
||||
findings: [
|
||||
@@ -224,7 +224,7 @@ describe("security CLI", () => {
|
||||
await expect(
|
||||
createProgram().parseAsync(["security", "audit", ...argv, "--json"], { from: "user" }),
|
||||
).rejects.toThrow(message);
|
||||
expect(runSecurityAudit).not.toHaveBeenCalled();
|
||||
expect(runSecurityAuditCore).not.toHaveBeenCalled();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import { isRich, theme } from "../../packages/terminal-core/src/theme.js";
|
||||
import { getRuntimeConfig } from "../config/config.js";
|
||||
import type { GatewayAuthMode } from "../config/types.gateway.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
import { runSecurityAudit } from "../security/audit.js";
|
||||
import { runSecurityAuditCore } from "../security/audit.js";
|
||||
import { fixSecurityFootguns } from "../security/fix.js";
|
||||
import { shortenHomeInString, shortenHomePath } from "../utils.js";
|
||||
import { formatCliCommand } from "./command-format.js";
|
||||
@@ -133,7 +133,7 @@ export function registerSecurityCli(program: Command) {
|
||||
targetIds: getSecurityAuditCommandSecretTargetIds(),
|
||||
mode: "read_only_status",
|
||||
});
|
||||
const report = await runSecurityAudit({
|
||||
const report = await runSecurityAuditCore({
|
||||
config: cfg,
|
||||
sourceConfig,
|
||||
deep: Boolean(opts.deep),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Full session-store resolution for gateway CLI requests that need local routing facts.
|
||||
import { resolveSessionKeyForRequest as resolveAgentSessionKeyForRequest } from "../../agents/command/session.js";
|
||||
import { resolveSessionKeyForRequestCore as resolveAgentSessionKeyForRequest } from "../../agents/command/session.js";
|
||||
|
||||
export function resolveSessionKeyForRequest(
|
||||
...args: Parameters<typeof resolveAgentSessionKeyForRequest>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Preferred provider tests cover auth-choice provider selection and runtime provider discovery.
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { resolvePluginProviders as resolvePluginProvidersFn } from "../plugins/providers.runtime.js";
|
||||
import type { resolvePluginProvidersCore as resolvePluginProvidersFn } from "../plugins/providers.runtime.js";
|
||||
|
||||
type ResolvePluginProvidersOptions = Parameters<typeof resolvePluginProvidersFn>[0];
|
||||
|
||||
const resolveManifestProviderAuthChoice = vi.hoisted(() => vi.fn());
|
||||
const resolveManifestDeprecatedProviderAuthChoice = vi.hoisted(() => vi.fn());
|
||||
const resolveManifestProviderAuthChoices = vi.hoisted(() => vi.fn(() => []));
|
||||
const resolveProviderPluginChoice = vi.hoisted(() => vi.fn());
|
||||
const resolvePluginProviders = vi.hoisted(() => vi.fn(() => []));
|
||||
const resolveProviderPluginChoiceCore = vi.hoisted(() => vi.fn());
|
||||
const resolvePluginProvidersCore = vi.hoisted(() => vi.fn(() => []));
|
||||
|
||||
vi.mock("../plugins/provider-auth-choices.js", () => ({
|
||||
resolveManifestProviderAuthChoice,
|
||||
@@ -17,11 +17,11 @@ vi.mock("../plugins/provider-auth-choices.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/provider-wizard.js", () => ({
|
||||
resolveProviderPluginChoice,
|
||||
resolveProviderPluginChoiceCore,
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/providers.runtime.js", () => ({
|
||||
resolvePluginProviders,
|
||||
resolvePluginProvidersCore,
|
||||
}));
|
||||
|
||||
import { resolvePreferredProviderForAuthChoice } from "../plugins/provider-auth-choice-preference.js";
|
||||
@@ -32,8 +32,8 @@ describe("resolvePreferredProviderForAuthChoice", () => {
|
||||
resolveManifestProviderAuthChoice.mockReturnValue(undefined);
|
||||
resolveManifestDeprecatedProviderAuthChoice.mockReturnValue(undefined);
|
||||
resolveManifestProviderAuthChoices.mockReturnValue([]);
|
||||
resolvePluginProviders.mockReturnValue([]);
|
||||
resolveProviderPluginChoice.mockReturnValue(null);
|
||||
resolvePluginProvidersCore.mockReturnValue([]);
|
||||
resolveProviderPluginChoiceCore.mockReturnValue(null);
|
||||
});
|
||||
|
||||
it("prefers manifest metadata when available", async () => {
|
||||
@@ -48,7 +48,7 @@ describe("resolvePreferredProviderForAuthChoice", () => {
|
||||
await expect(resolvePreferredProviderForAuthChoice({ choice: "openai-api-key" })).resolves.toBe(
|
||||
"openai",
|
||||
);
|
||||
expect(resolvePluginProviders).not.toHaveBeenCalled();
|
||||
expect(resolvePluginProvidersCore).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("normalizes legacy auth choices before plugin lookup", async () => {
|
||||
@@ -67,8 +67,8 @@ describe("resolvePreferredProviderForAuthChoice", () => {
|
||||
await expect(resolvePreferredProviderForAuthChoice({ choice: "claude-cli" })).resolves.toBe(
|
||||
"anthropic",
|
||||
);
|
||||
expect(resolveProviderPluginChoice).not.toHaveBeenCalled();
|
||||
expect(resolvePluginProviders).not.toHaveBeenCalled();
|
||||
expect(resolveProviderPluginChoiceCore).not.toHaveBeenCalled();
|
||||
expect(resolvePluginProvidersCore).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("passes explicit env through legacy auth normalization", async () => {
|
||||
@@ -103,18 +103,18 @@ describe("resolvePreferredProviderForAuthChoice", () => {
|
||||
await expect(resolvePreferredProviderForAuthChoice({ choice: "chutes" })).resolves.toBe(
|
||||
"chutes",
|
||||
);
|
||||
expect(resolvePluginProviders).not.toHaveBeenCalled();
|
||||
expect(resolvePluginProvidersCore).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("passes untrusted-workspace filtering through setup-provider fallback lookup", async () => {
|
||||
resolvePluginProviders.mockReturnValue([
|
||||
resolvePluginProvidersCore.mockReturnValue([
|
||||
{
|
||||
id: "demo-provider",
|
||||
label: "Demo Provider",
|
||||
auth: [{ id: "api-key", label: "API key", kind: "api_key" }],
|
||||
},
|
||||
] as never);
|
||||
resolveProviderPluginChoice.mockReturnValue({
|
||||
resolveProviderPluginChoiceCore.mockReturnValue({
|
||||
provider: { id: "demo-provider" },
|
||||
method: { id: "api-key" },
|
||||
});
|
||||
@@ -125,8 +125,8 @@ describe("resolvePreferredProviderForAuthChoice", () => {
|
||||
includeUntrustedWorkspacePlugins: false,
|
||||
}),
|
||||
).resolves.toBe("demo-provider");
|
||||
expect(resolvePluginProviders).toHaveBeenCalledOnce();
|
||||
const [pluginProviderOptions] = resolvePluginProviders.mock.calls[0] as unknown as [
|
||||
expect(resolvePluginProvidersCore).toHaveBeenCalledOnce();
|
||||
const [pluginProviderOptions] = resolvePluginProvidersCore.mock.calls[0] as unknown as [
|
||||
ResolvePluginProvidersOptions,
|
||||
];
|
||||
expect(pluginProviderOptions?.mode).toBe("setup");
|
||||
|
||||
@@ -57,9 +57,9 @@ vi.mock("../../channels/plugins/catalog.js", () => {
|
||||
};
|
||||
});
|
||||
|
||||
const loadPluginManifestRegistry = vi.fn();
|
||||
const loadPluginManifestRegistryCore = vi.fn();
|
||||
vi.mock("../../plugins/manifest-registry.js", () => ({
|
||||
loadPluginManifestRegistry: (...args: unknown[]) => loadPluginManifestRegistry(...args),
|
||||
loadPluginManifestRegistryCore: (...args: unknown[]) => loadPluginManifestRegistryCore(...args),
|
||||
}));
|
||||
|
||||
vi.mock("../../plugins/bundled-sources.js", () => ({
|
||||
@@ -165,7 +165,7 @@ function mockActivationOnlyPlugin(plugin: {
|
||||
id: string;
|
||||
origin?: "bundled" | "global" | "workspace";
|
||||
}) {
|
||||
loadPluginManifestRegistry.mockReturnValue({
|
||||
loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
createManifestRecord({
|
||||
id: plugin.id,
|
||||
@@ -231,7 +231,7 @@ beforeEach(() => {
|
||||
discoverOpenClawPlugins.mockReturnValue({ candidates: [], diagnostics: [] });
|
||||
getChannelPluginCatalogEntry.mockReturnValue(undefined);
|
||||
listChannelPluginCatalogEntries.mockReturnValue([]);
|
||||
loadPluginManifestRegistry.mockReturnValue({ plugins: [], diagnostics: [] });
|
||||
loadPluginManifestRegistryCore.mockReturnValue({ plugins: [], diagnostics: [] });
|
||||
setActivePluginRegistry(createEmptyPluginRegistry());
|
||||
});
|
||||
|
||||
@@ -850,7 +850,7 @@ describe("ensureChannelSetupPluginInstalled", () => {
|
||||
it("scopes snapshots by a unique discovered manifest match when catalog mapping is missing", () => {
|
||||
const runtime = makeRuntime();
|
||||
const cfg: OpenClawConfig = {};
|
||||
loadPluginManifestRegistry.mockReturnValue({
|
||||
loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [
|
||||
createManifestRecord({
|
||||
id: "custom-external-chat-plugin",
|
||||
@@ -894,7 +894,7 @@ describe("ensureChannelSetupPluginInstalled", () => {
|
||||
],
|
||||
diagnostics: [],
|
||||
});
|
||||
loadPluginManifestRegistry.mockImplementation((args: unknown) => {
|
||||
loadPluginManifestRegistryCore.mockImplementation((args: unknown) => {
|
||||
if (
|
||||
isRecord(args) &&
|
||||
args.config === cfg &&
|
||||
@@ -944,9 +944,9 @@ describe("ensureChannelSetupPluginInstalled", () => {
|
||||
workspaceDir: "/tmp/openclaw-workspace",
|
||||
});
|
||||
|
||||
expect(loadPluginManifestRegistry).toHaveBeenCalled();
|
||||
expect(loadPluginManifestRegistryCore).toHaveBeenCalled();
|
||||
expect(
|
||||
loadPluginManifestRegistry.mock.calls.every(
|
||||
loadPluginManifestRegistryCore.mock.calls.every(
|
||||
([params]) => !Object.hasOwn(params ?? {}, "cache"),
|
||||
),
|
||||
).toBe(true);
|
||||
|
||||
@@ -16,7 +16,7 @@ import type { PluginManifestRecord } from "../../plugins/manifest-registry.js";
|
||||
|
||||
const listChannelPluginCatalogEntries = vi.hoisted(() => vi.fn((_opts?: unknown): unknown[] => []));
|
||||
const listChatChannels = vi.hoisted(() => vi.fn((): unknown[] => []));
|
||||
const loadPluginManifestRegistry = vi.hoisted(() => vi.fn());
|
||||
const loadPluginManifestRegistryCore = vi.hoisted(() => vi.fn());
|
||||
const loadPluginRegistrySnapshot = vi.hoisted(() => vi.fn());
|
||||
const loadPluginRegistrySnapshotWithMetadata = vi.hoisted(() => vi.fn());
|
||||
const listPluginContributionIds = vi.hoisted(() => vi.fn((_params?: unknown): string[] => []));
|
||||
@@ -39,11 +39,11 @@ vi.mock("../../channels/registry.js", () => ({
|
||||
normalizeAnyChannelId: (channelId?: string) => channelId?.trim().toLowerCase() ?? null,
|
||||
}));
|
||||
vi.mock("../../plugins/manifest-registry.js", () => ({
|
||||
loadPluginManifestRegistry: (...a: unknown[]) => loadPluginManifestRegistry(...a),
|
||||
loadPluginManifestRegistryCore: (...a: unknown[]) => loadPluginManifestRegistryCore(...a),
|
||||
}));
|
||||
vi.mock("../../plugins/plugin-registry.js", () => ({
|
||||
loadPluginManifestRegistryForPluginRegistry: (...args: unknown[]) =>
|
||||
loadPluginManifestRegistry(...args),
|
||||
loadPluginManifestRegistryCore(...args),
|
||||
loadPluginRegistrySnapshot: (...args: unknown[]) => loadPluginRegistrySnapshot(...args),
|
||||
loadPluginRegistrySnapshotWithMetadata: (...args: unknown[]) =>
|
||||
loadPluginRegistrySnapshotWithMetadata(...args),
|
||||
@@ -65,7 +65,7 @@ import { resolveChannelSetupEntries } from "./discovery.js";
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
loadPluginManifestRegistry.mockReturnValue({ plugins: [], diagnostics: [] });
|
||||
loadPluginManifestRegistryCore.mockReturnValue({ plugins: [], diagnostics: [] });
|
||||
loadPluginRegistrySnapshot.mockReturnValue({
|
||||
version: 1,
|
||||
hostContractVersion: "test",
|
||||
@@ -222,7 +222,7 @@ describe("resolveChannelSetupEntries workspace shadow exclusion (GHSA-2qrv-rc5x-
|
||||
install: { npmSpec: "trusted-telegram-shadow" },
|
||||
};
|
||||
listChannelPluginCatalogEntries.mockReturnValue([workspaceEntry]);
|
||||
loadPluginManifestRegistry.mockReturnValue({
|
||||
loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [createManifestChannelPlugin("trusted-telegram-shadow", ["telegram"])],
|
||||
diagnostics: [],
|
||||
});
|
||||
@@ -273,7 +273,7 @@ describe("resolveChannelSetupEntries workspace shadow exclusion (GHSA-2qrv-rc5x-
|
||||
"trusted-telegram-shadow": ["channel configured"],
|
||||
},
|
||||
}));
|
||||
loadPluginManifestRegistry.mockReturnValue({
|
||||
loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [createManifestChannelPlugin("trusted-telegram-shadow", ["telegram"])],
|
||||
diagnostics: [],
|
||||
});
|
||||
@@ -318,7 +318,7 @@ describe("resolveChannelSetupEntries workspace shadow exclusion (GHSA-2qrv-rc5x-
|
||||
changes: [] as string[],
|
||||
autoEnabledReasons: {},
|
||||
}));
|
||||
loadPluginManifestRegistry.mockReturnValue({
|
||||
loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [createManifestChannelPlugin("my-cool-plugin", ["my-cool-plugin"])],
|
||||
diagnostics: [],
|
||||
});
|
||||
|
||||
@@ -144,8 +144,8 @@ const mocks = vi.hoisted(() => ({
|
||||
},
|
||||
),
|
||||
promptCustomApiConfig: vi.fn(),
|
||||
resolvePluginProviders: vi.fn(() => []),
|
||||
resolveProviderPluginChoice: vi.fn<() => unknown>(() => null),
|
||||
resolvePluginProvidersCore: vi.fn(() => []),
|
||||
resolveProviderPluginChoiceCore: vi.fn<() => unknown>(() => null),
|
||||
loadStaticManifestCatalogRowsForList: vi.fn<() => readonly NormalizedModelCatalogRow[]>(() => []),
|
||||
resolvePreferredProviderForAuthChoice: vi.fn<() => Promise<string | undefined>>(
|
||||
async () => undefined,
|
||||
@@ -195,11 +195,11 @@ vi.mock("./onboard-custom.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/providers.runtime.js", () => ({
|
||||
resolvePluginProviders: mocks.resolvePluginProviders,
|
||||
resolvePluginProvidersCore: mocks.resolvePluginProvidersCore,
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/provider-wizard.js", () => ({
|
||||
resolveProviderPluginChoice: mocks.resolveProviderPluginChoice,
|
||||
resolveProviderPluginChoiceCore: mocks.resolveProviderPluginChoiceCore,
|
||||
}));
|
||||
|
||||
vi.mock("./models/list.manifest-catalog.js", () => ({
|
||||
@@ -300,8 +300,8 @@ async function runPromptAuthConfigWithAllowlist(includeMinimaxProvider = false)
|
||||
mocks.promptModelAllowlist.mockResolvedValue({
|
||||
models: ["kilocode/kilo-auto/balanced"],
|
||||
});
|
||||
mocks.resolvePluginProviders.mockReturnValue([]);
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue(null);
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([]);
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue(null);
|
||||
|
||||
return promptAuthConfig({}, makeRuntime(), noopPrompter);
|
||||
}
|
||||
@@ -334,7 +334,7 @@ describe("promptAuthConfig", () => {
|
||||
mocks.promptAuthChoiceGrouped.mockResolvedValue("token");
|
||||
mocks.applyAuthChoice.mockResolvedValue({ config: {} });
|
||||
mocks.promptModelAllowlist.mockResolvedValue({ models: undefined });
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue({
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue({
|
||||
provider: {
|
||||
id: "anthropic",
|
||||
label: "Anthropic",
|
||||
@@ -380,7 +380,7 @@ describe("promptAuthConfig", () => {
|
||||
models: ["anthropic/claude-sonnet-4-6"],
|
||||
scopeKeys: ["anthropic/claude-opus-4-6", "anthropic/claude-sonnet-4-6"],
|
||||
});
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue({
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue({
|
||||
provider: {
|
||||
id: "anthropic",
|
||||
label: "Anthropic",
|
||||
@@ -433,7 +433,7 @@ describe("promptAuthConfig", () => {
|
||||
models: ["openai/gpt-5.5"],
|
||||
scopeKeys: ["openai/gpt-5.5", "openai/gpt-5.4-mini"],
|
||||
});
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue({
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue({
|
||||
provider: {
|
||||
id: "openai",
|
||||
label: "OpenAI",
|
||||
@@ -495,7 +495,7 @@ describe("promptAuthConfig", () => {
|
||||
models: ["openai/gpt-5.5", "openai/gpt-5.3-codex"],
|
||||
scopeKeys: ["openai/gpt-5.5", "openai/gpt-5.3-codex"],
|
||||
});
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue(null);
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue(null);
|
||||
|
||||
const result = await promptAuthConfig({}, makeRuntime(), noopPrompter);
|
||||
|
||||
@@ -534,7 +534,7 @@ describe("promptAuthConfig", () => {
|
||||
} as OpenClawConfig;
|
||||
mocks.applyAuthChoice.mockResolvedValue({ config: existingConfig });
|
||||
mocks.promptModelAllowlist.mockResolvedValue({ models: undefined });
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue(null);
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue(null);
|
||||
|
||||
await promptAuthConfig(existingConfig, makeRuntime(), noopPrompter);
|
||||
|
||||
@@ -578,7 +578,7 @@ describe("promptAuthConfig", () => {
|
||||
},
|
||||
]);
|
||||
mocks.promptModelAllowlist.mockResolvedValue({ models: undefined });
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue(null);
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue(null);
|
||||
|
||||
await promptAuthConfig(existingConfig, makeRuntime(), noopPrompter);
|
||||
|
||||
@@ -608,7 +608,7 @@ describe("promptAuthConfig", () => {
|
||||
},
|
||||
});
|
||||
mocks.promptModelAllowlist.mockResolvedValue({ models: undefined });
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue(null);
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue(null);
|
||||
|
||||
await promptAuthConfig({}, makeRuntime(), noopPrompter);
|
||||
|
||||
@@ -636,7 +636,7 @@ describe("promptAuthConfig", () => {
|
||||
},
|
||||
});
|
||||
mocks.promptModelAllowlist.mockResolvedValue({ models: undefined });
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue({
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue({
|
||||
provider: {
|
||||
id: "github-copilot",
|
||||
label: "GitHub Copilot",
|
||||
@@ -677,8 +677,8 @@ describe("promptAuthConfig", () => {
|
||||
},
|
||||
});
|
||||
mocks.promptModelAllowlist.mockResolvedValue({ models: undefined });
|
||||
mocks.resolvePluginProviders.mockReturnValue([]);
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue(null);
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([]);
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue(null);
|
||||
mocks.loadStaticManifestCatalogRowsForList.mockReturnValue([
|
||||
{
|
||||
provider: "github-copilot",
|
||||
@@ -709,7 +709,7 @@ describe("promptAuthConfig", () => {
|
||||
models: ["openai/gpt-5.5"],
|
||||
scopeKeys: ["openai/gpt-5.5", "openai/gpt-5.5-pro"],
|
||||
});
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue(null);
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue(null);
|
||||
|
||||
const result = await promptAuthConfig(
|
||||
{
|
||||
@@ -743,8 +743,8 @@ describe("promptAuthConfig", () => {
|
||||
mocks.resolvePreferredProviderForAuthChoice
|
||||
.mockResolvedValueOnce("wecom")
|
||||
.mockResolvedValueOnce("kilocode");
|
||||
mocks.resolvePluginProviders.mockReturnValue([]);
|
||||
mocks.resolveProviderPluginChoice.mockReturnValue(null);
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([]);
|
||||
mocks.resolveProviderPluginChoiceCore.mockReturnValue(null);
|
||||
|
||||
await promptAuthConfig({}, makeRuntime(), noopPrompter);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ const mocks = vi.hoisted(() => ({
|
||||
resolveOpenClawWrapperPath: vi.fn(),
|
||||
assertNoSystemLaunchDaemonOwnership: vi.fn(),
|
||||
execLaunchctl: vi.fn(),
|
||||
loadPluginManifestRegistry: vi.fn<
|
||||
loadPluginManifestRegistryCore: vi.fn<
|
||||
(...args: unknown[]) => { diagnostics: unknown[]; plugins: unknown[] }
|
||||
>(() => ({
|
||||
diagnostics: [],
|
||||
@@ -73,7 +73,7 @@ vi.mock("../daemon/launchd-system.js", async (importActual) => ({
|
||||
vi.mock("../plugins/manifest-registry.js", async (importActual) => {
|
||||
const actual = await importActual<typeof import("../plugins/manifest-registry.js")>();
|
||||
const hasPluginIntegrationProvider = (
|
||||
params?: Parameters<typeof actual.loadPluginManifestRegistry>[0],
|
||||
params?: Parameters<typeof actual.loadPluginManifestRegistryCore>[0],
|
||||
) =>
|
||||
Object.values(params?.config?.secrets?.providers ?? {}).some(
|
||||
(provider) =>
|
||||
@@ -83,12 +83,12 @@ vi.mock("../plugins/manifest-registry.js", async (importActual) => {
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
loadPluginManifestRegistry: (
|
||||
params?: Parameters<typeof actual.loadPluginManifestRegistry>[0],
|
||||
loadPluginManifestRegistryCore: (
|
||||
params?: Parameters<typeof actual.loadPluginManifestRegistryCore>[0],
|
||||
) =>
|
||||
hasPluginIntegrationProvider(params)
|
||||
? mocks.loadPluginManifestRegistry(params)
|
||||
: actual.loadPluginManifestRegistry(params),
|
||||
? mocks.loadPluginManifestRegistryCore(params)
|
||||
: actual.loadPluginManifestRegistryCore(params),
|
||||
};
|
||||
});
|
||||
|
||||
@@ -166,7 +166,7 @@ function mockNodeGatewayPlanFixture(
|
||||
});
|
||||
mocks.renderSystemNodeWarning.mockReturnValue(warning);
|
||||
mocks.buildServiceEnvironment.mockReturnValue(serviceEnvironment);
|
||||
mocks.loadPluginManifestRegistry.mockReturnValue({ diagnostics: [], plugins: [] });
|
||||
mocks.loadPluginManifestRegistryCore.mockReturnValue({ diagnostics: [], plugins: [] });
|
||||
mocks.loadPluginManifestRegistryForPluginRegistry.mockReturnValue({
|
||||
diagnostics: [],
|
||||
plugins: [],
|
||||
@@ -228,7 +228,7 @@ async function buildPluginConfigExecSecretRefPlan(home: string) {
|
||||
const pluginRoot = path.join(home, "acme-secrets");
|
||||
createSecurePluginRoot(pluginRoot);
|
||||
writeSecurePluginEntrypoint(path.join(pluginRoot, "secret-ref-resolver.js"));
|
||||
mocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
mocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
diagnostics: [],
|
||||
plugins: [
|
||||
{
|
||||
@@ -714,7 +714,7 @@ describe("buildGatewayInstallPlan", () => {
|
||||
const pluginRoot = path.join(isolatedHome, "acme-secrets");
|
||||
createSecurePluginRoot(pluginRoot);
|
||||
writeSecurePluginEntrypoint(path.join(pluginRoot, "secret-ref-resolver.js"));
|
||||
mocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
mocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
diagnostics: [],
|
||||
plugins: [
|
||||
{
|
||||
@@ -826,7 +826,7 @@ describe("buildGatewayInstallPlan", () => {
|
||||
const pluginRoot = path.join(isolatedHome, "acme-secrets");
|
||||
createSecurePluginRoot(pluginRoot);
|
||||
writeSecurePluginEntrypoint(path.join(pluginRoot, "secret-ref-resolver.js"));
|
||||
mocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
mocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
diagnostics: [],
|
||||
plugins: [
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
normalizeEnvVarKey,
|
||||
} from "../infra/host-env-security.js";
|
||||
import {
|
||||
loadPluginManifestRegistry,
|
||||
loadPluginManifestRegistryCore,
|
||||
type PluginManifestRegistry,
|
||||
} from "../plugins/manifest-registry.js";
|
||||
import {
|
||||
@@ -300,7 +300,7 @@ function collectExecSecretRefPassEnvServiceEnvVars(params: {
|
||||
}
|
||||
const execProvider = isPluginIntegrationSecretProviderConfig(provider)
|
||||
? (() => {
|
||||
manifestRegistry ??= loadPluginManifestRegistry({
|
||||
manifestRegistry ??= loadPluginManifestRegistryCore({
|
||||
config: params.config,
|
||||
env: params.env,
|
||||
});
|
||||
|
||||
@@ -40,8 +40,8 @@ export async function maybeRepairLegacyOAuthProfileIds(
|
||||
return cfg;
|
||||
}
|
||||
let nextCfg = cfg;
|
||||
const { resolvePluginProviders } = await loadProviderRuntime();
|
||||
const providers = resolvePluginProviders({
|
||||
const { resolvePluginProvidersCore } = await loadProviderRuntime();
|
||||
const providers = resolvePluginProvidersCore({
|
||||
config: cfg,
|
||||
env: process.env,
|
||||
mode: "setup",
|
||||
|
||||
@@ -17,7 +17,7 @@ const repairMocks = vi.hoisted(() => ({
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/providers.runtime.js", () => ({
|
||||
resolvePluginProviders: () => resolvePluginProvidersMock(),
|
||||
resolvePluginProvidersCore: () => resolvePluginProvidersMock(),
|
||||
}));
|
||||
|
||||
vi.mock("../agents/auth-profiles/repair.js", () => ({
|
||||
|
||||
@@ -50,7 +50,7 @@ vi.mock("../plugins/manifest-registry.js", () => {
|
||||
};
|
||||
};
|
||||
return {
|
||||
loadPluginManifestRegistry: () => ({
|
||||
loadPluginManifestRegistryCore: () => ({
|
||||
diagnostics: [],
|
||||
plugins: [
|
||||
plugin("brave", "brave"),
|
||||
|
||||
@@ -7,7 +7,7 @@ import { z } from "zod";
|
||||
import { note } from "../../packages/terminal-core/src/note.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import type { HealthFinding } from "../flows/health-checks.js";
|
||||
import { loadPluginManifestRegistry } from "../plugins/manifest-registry.js";
|
||||
import { loadPluginManifestRegistryCore } from "../plugins/manifest-registry.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { shortenHomePath } from "../utils.js";
|
||||
import { safeParseJsonWithSchema, safeParseWithSchema } from "../utils/zod-parse.js";
|
||||
@@ -128,7 +128,7 @@ export function collectLegacyPluginManifestContractMigrations(params?: {
|
||||
}
|
||||
}
|
||||
|
||||
for (const plugin of loadPluginManifestRegistry({
|
||||
for (const plugin of loadPluginManifestRegistryCore({
|
||||
...(params?.config ? { config: params.config } : {}),
|
||||
...(params?.env ? { env: params.env } : {}),
|
||||
...(params?.workspaceDir ? { workspaceDir: params.workspaceDir } : {}),
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
|
||||
const providerRuntimeMocks = vi.hoisted(() => ({
|
||||
useMockProviders: false,
|
||||
resolvePluginProviders: vi.fn((_params?: unknown): ProviderPlugin[] => []),
|
||||
resolvePluginProvidersCore: vi.fn((_params?: unknown): ProviderPlugin[] => []),
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/providers.runtime.js", async () => {
|
||||
@@ -23,12 +23,12 @@ vi.mock("../plugins/providers.runtime.js", async () => {
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
resolvePluginProviders: (
|
||||
params: Parameters<typeof actual.resolvePluginProviders>[0],
|
||||
resolvePluginProvidersCore: (
|
||||
params: Parameters<typeof actual.resolvePluginProvidersCore>[0],
|
||||
): ProviderPlugin[] =>
|
||||
providerRuntimeMocks.useMockProviders
|
||||
? providerRuntimeMocks.resolvePluginProviders(params)
|
||||
: actual.resolvePluginProviders(params),
|
||||
? providerRuntimeMocks.resolvePluginProvidersCore(params)
|
||||
: actual.resolvePluginProvidersCore(params),
|
||||
};
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ describe("doctor command", () => {
|
||||
({ healthCommand } = await import("./health.js"));
|
||||
vi.clearAllMocks();
|
||||
providerRuntimeMocks.useMockProviders = false;
|
||||
providerRuntimeMocks.resolvePluginProviders.mockReturnValue([]);
|
||||
providerRuntimeMocks.resolvePluginProvidersCore.mockReturnValue([]);
|
||||
});
|
||||
|
||||
it("runs legacy state migrations in yes mode without prompting", async () => {
|
||||
@@ -154,7 +154,7 @@ describe("doctor command", () => {
|
||||
},
|
||||
});
|
||||
providerRuntimeMocks.useMockProviders = true;
|
||||
providerRuntimeMocks.resolvePluginProviders.mockReturnValue([
|
||||
providerRuntimeMocks.resolvePluginProvidersCore.mockReturnValue([
|
||||
{
|
||||
id: "anthropic",
|
||||
label: "Anthropic",
|
||||
|
||||
@@ -47,10 +47,10 @@ function plugin(
|
||||
}
|
||||
|
||||
function mockManifestPlugins(plugins: unknown[]) {
|
||||
vi.spyOn(manifestRegistry, "loadPluginManifestRegistry").mockReturnValue({
|
||||
vi.spyOn(manifestRegistry, "loadPluginManifestRegistryCore").mockReturnValue({
|
||||
plugins,
|
||||
diagnostics: [],
|
||||
} as unknown as ReturnType<typeof manifestRegistry.loadPluginManifestRegistry>);
|
||||
} as unknown as ReturnType<typeof manifestRegistry.loadPluginManifestRegistryCore>);
|
||||
}
|
||||
|
||||
describe("channel plugin blockers", () => {
|
||||
@@ -60,10 +60,12 @@ describe("channel plugin blockers", () => {
|
||||
});
|
||||
|
||||
it("returns no blockers when config and package env have no channel surfaces", () => {
|
||||
const registrySpy = vi.spyOn(manifestRegistry, "loadPluginManifestRegistry").mockReturnValue({
|
||||
plugins: [],
|
||||
diagnostics: [],
|
||||
});
|
||||
const registrySpy = vi
|
||||
.spyOn(manifestRegistry, "loadPluginManifestRegistryCore")
|
||||
.mockReturnValue({
|
||||
plugins: [],
|
||||
diagnostics: [],
|
||||
});
|
||||
|
||||
const hits = scanConfiguredChannelPluginBlockers({
|
||||
channels: {
|
||||
@@ -114,10 +116,12 @@ describe("channel plugin blockers", () => {
|
||||
});
|
||||
|
||||
it("uses provided manifest records without loading the registry", () => {
|
||||
const registrySpy = vi.spyOn(manifestRegistry, "loadPluginManifestRegistry").mockReturnValue({
|
||||
plugins: [],
|
||||
diagnostics: [],
|
||||
});
|
||||
const registrySpy = vi
|
||||
.spyOn(manifestRegistry, "loadPluginManifestRegistryCore")
|
||||
.mockReturnValue({
|
||||
plugins: [],
|
||||
diagnostics: [],
|
||||
});
|
||||
|
||||
const hits = scanConfiguredChannelPluginBlockers(
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
inspectPluginStartupMetadata,
|
||||
} from "../../../plugins/bundled-plugin-startup-metadata.js";
|
||||
import { discoverConfiguredPluginLoadPaths } from "../../../plugins/discovery.js";
|
||||
import { loadPluginManifestRegistry } from "../../../plugins/manifest-registry.js";
|
||||
import { loadPluginManifestRegistryCore } from "../../../plugins/manifest-registry.js";
|
||||
import { configMayRequireStartupPluginConvergence } from "./startup-plugin-convergence-plan.js";
|
||||
|
||||
const STATEFUL_CONFIG_KEYS = new Set([
|
||||
@@ -138,7 +138,7 @@ function hasOnlyMigrationSafePluginEntries(
|
||||
}
|
||||
// Discovery alone cannot prove host compatibility or rule out a fallback
|
||||
// doctor owner; use the same candidate acceptance as normal plugin startup.
|
||||
const registry = loadPluginManifestRegistry({
|
||||
const registry = loadPluginManifestRegistryCore({
|
||||
config: config as OpenClawConfig,
|
||||
discovery,
|
||||
env,
|
||||
|
||||
@@ -41,7 +41,7 @@ describe("doctor stale plugin config helpers", () => {
|
||||
beforeEach(() => {
|
||||
installedPluginIndexMocks.loadInstalledPluginIndexInstallRecordsSync.mockReset();
|
||||
installedPluginIndexMocks.loadInstalledPluginIndexInstallRecordsSync.mockReturnValue({});
|
||||
vi.spyOn(manifestRegistry, "loadPluginManifestRegistry").mockReturnValue({
|
||||
vi.spyOn(manifestRegistry, "loadPluginManifestRegistryCore").mockReturnValue({
|
||||
plugins: [manifest("discord"), manifest("voice-call"), manifest("openai")],
|
||||
diagnostics: [],
|
||||
});
|
||||
@@ -473,7 +473,7 @@ describe("doctor stale plugin config helpers", () => {
|
||||
|
||||
expect(scanStalePluginConfig(cfg)).toStrictEqual([]);
|
||||
expect(maybeRepairStalePluginConfig(cfg)).toEqual({ config: cfg, changes: [] });
|
||||
expect(manifestRegistry.loadPluginManifestRegistry).not.toHaveBeenCalled();
|
||||
expect(manifestRegistry.loadPluginManifestRegistryCore).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses missing persisted install records as stale channel evidence", () => {
|
||||
@@ -500,7 +500,7 @@ describe("doctor stale plugin config helpers", () => {
|
||||
});
|
||||
|
||||
it("does not auto-repair stale refs while plugin discovery has errors", () => {
|
||||
vi.spyOn(manifestRegistry, "loadPluginManifestRegistry").mockReturnValue({
|
||||
vi.spyOn(manifestRegistry, "loadPluginManifestRegistryCore").mockReturnValue({
|
||||
plugins: [],
|
||||
diagnostics: [
|
||||
{ level: "error", message: "plugin path not found: /missing", source: "/missing" },
|
||||
|
||||
@@ -5,17 +5,17 @@ import {
|
||||
} from "../flows/provider-flow.runtime.js";
|
||||
import { runProviderPluginAuthMethod } from "../plugins/provider-auth-choice.js";
|
||||
import {
|
||||
resolveProviderPluginChoice,
|
||||
runProviderModelSelectedHook,
|
||||
resolveProviderPluginChoiceCore,
|
||||
runProviderModelSelectedHookCore,
|
||||
} from "../plugins/provider-wizard.js";
|
||||
import { resolvePluginProviders } from "../plugins/providers.runtime.js";
|
||||
import { resolvePluginProvidersCore } from "../plugins/providers.runtime.js";
|
||||
|
||||
/** Lazy runtime methods consumed by model picker command flows. */
|
||||
export const modelPickerRuntime = {
|
||||
resolveProviderModelPickerContributions: resolveProviderModelPickerFlowContributions,
|
||||
resolveProviderModelPickerEntries: resolveProviderModelPickerFlowEntries,
|
||||
resolveProviderPluginChoice,
|
||||
runProviderModelSelectedHook,
|
||||
resolvePluginProviders,
|
||||
resolveProviderPluginChoice: resolveProviderPluginChoiceCore,
|
||||
runProviderModelSelectedHook: runProviderModelSelectedHookCore,
|
||||
resolvePluginProviders: resolvePluginProvidersCore,
|
||||
runProviderPluginAuthMethod,
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@ const hasSyntheticLocalProviderAuthConfig = vi.fn().mockReturnValue(false);
|
||||
const loadModelCatalog = vi.fn<(_params?: unknown) => Promise<Array<Record<string, unknown>>>>(
|
||||
async () => [],
|
||||
);
|
||||
const shouldSuppressBuiltInModel = vi.fn().mockReturnValue(false);
|
||||
const shouldSuppressBuiltInModelCore = vi.fn().mockReturnValue(false);
|
||||
const shouldSuppressBuiltInModelFromManifest = vi.fn().mockReturnValue(false);
|
||||
const normalizeProviderResolvedModelWithPlugin = vi.hoisted(() =>
|
||||
vi.fn(({ context }) => {
|
||||
@@ -205,7 +205,7 @@ vi.mock("../plugins/synthetic-auth.runtime.js", () => ({
|
||||
|
||||
vi.mock("../agents/model-suppression.js", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("../agents/model-suppression.js")>()),
|
||||
shouldSuppressBuiltInModel,
|
||||
shouldSuppressBuiltInModelCore,
|
||||
shouldSuppressBuiltInModelFromManifest,
|
||||
}));
|
||||
|
||||
@@ -280,8 +280,8 @@ beforeEach(() => {
|
||||
listProfilesForProvider.mockReturnValue([]);
|
||||
loadModelCatalog.mockReset();
|
||||
loadModelCatalog.mockResolvedValue([]);
|
||||
shouldSuppressBuiltInModel.mockReset();
|
||||
shouldSuppressBuiltInModel.mockReturnValue(false);
|
||||
shouldSuppressBuiltInModelCore.mockReset();
|
||||
shouldSuppressBuiltInModelCore.mockReturnValue(false);
|
||||
normalizeProviderResolvedModelWithPlugin.mockClear();
|
||||
readConfigFileSnapshotForWrite.mockClear();
|
||||
readConfigFileSnapshotForWrite.mockResolvedValue({
|
||||
@@ -735,7 +735,7 @@ describe("models list/status", () => {
|
||||
const suppressSpark = ({ provider, id }: { provider?: string | null; id?: string | null }) =>
|
||||
id === "gpt-5.3-codex-spark" &&
|
||||
(provider === "openai" || provider === "azure-openai-responses" || provider === "openai");
|
||||
shouldSuppressBuiltInModel.mockImplementation(suppressSpark);
|
||||
shouldSuppressBuiltInModelCore.mockImplementation(suppressSpark);
|
||||
shouldSuppressBuiltInModelFromManifest.mockImplementation(suppressSpark);
|
||||
setDefaultModel("openai/gpt-5.5");
|
||||
modelRegistryState.models = [OPENAI_MODEL, OPENAI_SPARK_MODEL, AZURE_OPENAI_SPARK_MODEL];
|
||||
|
||||
@@ -53,7 +53,7 @@ const mocks = vi.hoisted(() => ({
|
||||
upsertAuthProfile: vi.fn(),
|
||||
upsertAuthProfileWithLock: vi.fn(),
|
||||
removeProviderAuthProfilesWithLock: vi.fn(),
|
||||
resolvePluginProviders: vi.fn(),
|
||||
resolvePluginProvidersCore: vi.fn(),
|
||||
createClackPrompter: vi.fn(),
|
||||
loadValidConfigOrThrow: vi.fn(),
|
||||
updateConfig: vi.fn(),
|
||||
@@ -66,7 +66,7 @@ const mocks = vi.hoisted(() => ({
|
||||
promoteAuthProfileInOrder: vi.fn(),
|
||||
clearAuthProfileCooldown: vi.fn(),
|
||||
callGateway: vi.fn(),
|
||||
resolvePluginSetupProvider: vi.fn(),
|
||||
resolvePluginSetupProviderCore: vi.fn(),
|
||||
resolvePluginSetupRegistry: vi.fn(),
|
||||
}));
|
||||
|
||||
@@ -138,11 +138,11 @@ vi.mock("../../agents/workspace.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../../plugins/providers.runtime.js", () => ({
|
||||
resolvePluginProviders: mocks.resolvePluginProviders,
|
||||
resolvePluginProvidersCore: mocks.resolvePluginProvidersCore,
|
||||
}));
|
||||
|
||||
vi.mock("../../plugins/setup-registry.js", () => ({
|
||||
resolvePluginSetupProvider: mocks.resolvePluginSetupProvider,
|
||||
resolvePluginSetupProviderCore: mocks.resolvePluginSetupProviderCore,
|
||||
resolvePluginSetupRegistry: mocks.resolvePluginSetupRegistry,
|
||||
}));
|
||||
|
||||
@@ -381,7 +381,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
mocks.resolveAgentWorkspaceDir.mockReturnValue("/tmp/openclaw/workspace");
|
||||
mocks.resolveDefaultAgentWorkspaceDir.mockReturnValue("/tmp/openclaw/workspace");
|
||||
mocks.isRemoteEnvironment.mockReturnValue(false);
|
||||
mocks.resolvePluginSetupProvider.mockReturnValue(undefined);
|
||||
mocks.resolvePluginSetupProviderCore.mockReturnValue(undefined);
|
||||
mocks.resolvePluginSetupRegistry.mockReturnValue({
|
||||
providers: [],
|
||||
cliBackends: [],
|
||||
@@ -417,7 +417,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
],
|
||||
defaultModel: "openai/gpt-5.5",
|
||||
});
|
||||
mocks.resolvePluginProviders.mockReturnValue([
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([
|
||||
createProvider({
|
||||
id: "openai",
|
||||
label: "OpenAI Codex",
|
||||
@@ -635,7 +635,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
? ["openai:user@example.com"]
|
||||
: [],
|
||||
);
|
||||
mocks.resolvePluginProviders.mockReturnValue([
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([
|
||||
createProvider({
|
||||
id: "openai",
|
||||
label: "OpenAI runtime",
|
||||
@@ -650,7 +650,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
],
|
||||
}),
|
||||
]);
|
||||
mocks.resolvePluginSetupProvider.mockReturnValue(
|
||||
mocks.resolvePluginSetupProviderCore.mockReturnValue(
|
||||
createProvider({
|
||||
id: "openai",
|
||||
label: "OpenAI",
|
||||
@@ -674,7 +674,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
|
||||
await modelsAuthLoginCommand({ provider: "openai" }, runtime);
|
||||
|
||||
expect(mocks.resolvePluginSetupProvider).toHaveBeenCalledWith({
|
||||
expect(mocks.resolvePluginSetupProviderCore).toHaveBeenCalledWith({
|
||||
provider: "openai",
|
||||
config: initialConfig,
|
||||
workspaceDir: "/tmp/openclaw/workspace",
|
||||
@@ -694,7 +694,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
const runtime = createRuntime();
|
||||
const runOauthAuth = vi.fn().mockResolvedValue({ profiles: [] });
|
||||
const runApiKeyAuth = vi.fn().mockResolvedValue({ profiles: [] });
|
||||
mocks.resolvePluginProviders.mockReturnValue([
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([
|
||||
createProvider({
|
||||
id: "openai",
|
||||
label: "OpenAI runtime",
|
||||
@@ -709,7 +709,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
],
|
||||
}),
|
||||
]);
|
||||
mocks.resolvePluginSetupProvider.mockReturnValue(
|
||||
mocks.resolvePluginSetupProviderCore.mockReturnValue(
|
||||
createProvider({
|
||||
id: "openai",
|
||||
label: "OpenAI",
|
||||
@@ -741,7 +741,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
const runtime = createRuntime();
|
||||
const runOauthAuth = vi.fn().mockResolvedValue({ profiles: [] });
|
||||
const runApiKeyAuth = vi.fn().mockResolvedValue({ profiles: [] });
|
||||
mocks.resolvePluginSetupProvider.mockReturnValue(
|
||||
mocks.resolvePluginSetupProviderCore.mockReturnValue(
|
||||
createProvider({
|
||||
id: "openai",
|
||||
label: "OpenAI",
|
||||
@@ -780,7 +780,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
note: vi.fn(async () => {}),
|
||||
select,
|
||||
});
|
||||
mocks.resolvePluginProviders.mockReturnValue([
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([
|
||||
createProvider({
|
||||
id: "anthropic",
|
||||
label: "Anthropic",
|
||||
@@ -928,7 +928,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
mocks.resolvePluginProviders.mockImplementation(
|
||||
mocks.resolvePluginProvidersCore.mockImplementation(
|
||||
(params: { activate?: boolean; providerRefs?: string[] } | undefined) =>
|
||||
params?.activate === true && params?.providerRefs?.[0] === "anthropic"
|
||||
? [
|
||||
@@ -954,7 +954,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
);
|
||||
|
||||
const providerResolutionCall = readMockCallArg(
|
||||
mocks.resolvePluginProviders,
|
||||
mocks.resolvePluginProvidersCore,
|
||||
) as ResolvePluginProvidersCall;
|
||||
expect(providerResolutionCall.config).toEqual({});
|
||||
expect(providerResolutionCall.workspaceDir).toBe("/tmp/openclaw/workspace");
|
||||
@@ -1055,7 +1055,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
};
|
||||
mocks.loadAuthProfileStoreForRuntime.mockReturnValue(fakeStore);
|
||||
mocks.listProfilesForProvider.mockReturnValue(["anthropic:claude-cli", "anthropic:legacy"]);
|
||||
mocks.resolvePluginProviders.mockReturnValue([
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([
|
||||
{
|
||||
id: "anthropic",
|
||||
label: "Anthropic",
|
||||
@@ -1186,7 +1186,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
},
|
||||
defaultModel: "openai/gpt-5.5",
|
||||
});
|
||||
mocks.resolvePluginProviders.mockReturnValue([
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([
|
||||
createProvider({
|
||||
id: "openai",
|
||||
label: "OpenAI",
|
||||
@@ -1222,7 +1222,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
],
|
||||
defaultModel: "google/gemini-3-pro-preview",
|
||||
});
|
||||
mocks.resolvePluginProviders.mockReturnValue([
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([
|
||||
createProvider({
|
||||
id: "google",
|
||||
label: "Google",
|
||||
@@ -1329,7 +1329,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
const runtime = createRuntime();
|
||||
const runOauthAuth = vi.fn().mockResolvedValue({ profiles: [] });
|
||||
const runApiKeyAuth = vi.fn().mockResolvedValue({ profiles: [] });
|
||||
mocks.resolvePluginSetupProvider.mockReturnValue(
|
||||
mocks.resolvePluginSetupProviderCore.mockReturnValue(
|
||||
createProvider({
|
||||
id: "openai",
|
||||
label: "OpenAI",
|
||||
@@ -1684,7 +1684,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
},
|
||||
],
|
||||
});
|
||||
mocks.resolvePluginProviders.mockReturnValue([
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([
|
||||
{
|
||||
id: "moonshot",
|
||||
label: "Moonshot",
|
||||
@@ -1728,7 +1728,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
},
|
||||
],
|
||||
});
|
||||
mocks.resolvePluginProviders.mockReturnValue([
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([
|
||||
{
|
||||
id: "moonshot",
|
||||
label: "Moonshot",
|
||||
@@ -1769,7 +1769,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
},
|
||||
],
|
||||
});
|
||||
mocks.resolvePluginProviders.mockReturnValue([
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([
|
||||
{
|
||||
id: "moonshot",
|
||||
label: "Moonshot",
|
||||
@@ -1799,7 +1799,7 @@ describe("modelsAuthLoginCommand", () => {
|
||||
it("keeps the requested agent store when interactive auth add falls back to paste-token", async () => {
|
||||
const runtime = createRuntime();
|
||||
useCoderAgentConfig();
|
||||
mocks.resolvePluginProviders.mockReturnValue([]);
|
||||
mocks.resolvePluginProvidersCore.mockReturnValue([]);
|
||||
mocks.clackSelect.mockResolvedValue("custom");
|
||||
mocks.clackText.mockResolvedValueOnce("openai").mockResolvedValueOnce("openai:manual");
|
||||
mocks.clackPassword.mockResolvedValue("openai-token");
|
||||
|
||||
@@ -51,9 +51,9 @@ import {
|
||||
} from "../../plugins/provider-auth-choice-helpers.js";
|
||||
import { applyAuthProfileConfig } from "../../plugins/provider-auth-helpers.js";
|
||||
import { createVpsAwareOAuthHandlers } from "../../plugins/provider-oauth-flow.js";
|
||||
import { resolvePluginProviders } from "../../plugins/providers.runtime.js";
|
||||
import { resolvePluginProvidersCore } from "../../plugins/providers.runtime.js";
|
||||
import {
|
||||
resolvePluginSetupProvider,
|
||||
resolvePluginSetupProviderCore,
|
||||
resolvePluginSetupRegistry,
|
||||
} from "../../plugins/setup-registry.js";
|
||||
import type {
|
||||
@@ -248,7 +248,7 @@ function preferSetupAuthProviders(params: {
|
||||
? normalizeManualAuthProvider(params.requestedProvider)
|
||||
: undefined;
|
||||
if (requestedProvider) {
|
||||
const setupProvider = resolvePluginSetupProvider({
|
||||
const setupProvider = resolvePluginSetupProviderCore({
|
||||
provider: requestedProvider,
|
||||
config: params.config,
|
||||
workspaceDir: params.workspaceDir,
|
||||
@@ -279,7 +279,7 @@ async function resolveModelsAuthContext(params?: {
|
||||
const providerRef = requestedProvider
|
||||
? normalizeManualAuthProvider(requestedProvider)
|
||||
: undefined;
|
||||
const providers = resolvePluginProviders({
|
||||
const providers = resolvePluginProvidersCore({
|
||||
config,
|
||||
workspaceDir,
|
||||
mode: "setup",
|
||||
|
||||
@@ -31,7 +31,7 @@ vi.mock("../../agents/prepared-model-catalog.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../../agents/model-suppression.js", () => ({
|
||||
shouldSuppressBuiltInModel: vi.fn(() => false),
|
||||
shouldSuppressBuiltInModelCore: vi.fn(() => false),
|
||||
shouldSuppressBuiltInModelFromManifest: mocks.shouldSuppressBuiltInModelFromManifest,
|
||||
}));
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ function installModelsListCommandForwardCompatMocks() {
|
||||
id === "gpt-5.3-codex-spark";
|
||||
|
||||
vi.doMock("../../agents/model-suppression.js", () => ({
|
||||
shouldSuppressBuiltInModel: suppressOpenAiSpark,
|
||||
shouldSuppressBuiltInModelCore: suppressOpenAiSpark,
|
||||
shouldSuppressBuiltInModelFromManifest: suppressOpenAiSpark,
|
||||
createManifestBuiltInModelSuppressor: vi.fn(
|
||||
() => (model: { provider?: string | null; id?: string | null }) => suppressOpenAiSpark(model),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { modelKey } from "../../agents/model-ref-shared.js";
|
||||
import { shouldSuppressBuiltInModel } from "../../agents/model-suppression.js";
|
||||
import { shouldSuppressBuiltInModelCore } from "../../agents/model-suppression.js";
|
||||
/** Registry-loading adapters for model-list row construction. */
|
||||
import { loadPreparedAgentModelRegistry as loadAgentModelRegistry } from "../../agents/prepared-model-registry.js";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
@@ -37,7 +37,7 @@ function findConfiguredRegistryModel(params: {
|
||||
return undefined;
|
||||
}
|
||||
if (
|
||||
shouldSuppressBuiltInModel({
|
||||
shouldSuppressBuiltInModelCore({
|
||||
provider: model.provider,
|
||||
id: model.id,
|
||||
baseUrl: model.baseUrl,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { modelKey } from "../../agents/model-ref-shared.js";
|
||||
import {
|
||||
shouldSuppressBuiltInModel,
|
||||
shouldSuppressBuiltInModelCore,
|
||||
shouldSuppressBuiltInModelFromManifest,
|
||||
} from "../../agents/model-suppression.js";
|
||||
/** Model registry access helpers for `openclaw models list`. */
|
||||
@@ -72,7 +72,7 @@ function loadAvailableModels(
|
||||
baseUrl: model.baseUrl,
|
||||
config: cfg,
|
||||
})
|
||||
: !shouldSuppressBuiltInModel({
|
||||
: !shouldSuppressBuiltInModelCore({
|
||||
provider: model.provider,
|
||||
id: model.id,
|
||||
baseUrl: model.baseUrl,
|
||||
@@ -108,7 +108,7 @@ export async function loadModelRegistry(
|
||||
});
|
||||
const models = registry.getAll().filter((model) =>
|
||||
runtimeSuppression
|
||||
? !shouldSuppressBuiltInModel({
|
||||
? !shouldSuppressBuiltInModelCore({
|
||||
provider: model.provider,
|
||||
id: model.id,
|
||||
baseUrl: model.baseUrl,
|
||||
|
||||
@@ -8,14 +8,14 @@ const mocks = vi.hoisted(() => ({
|
||||
loadScopedModelCatalogSnapshot: vi.fn(),
|
||||
normalizeProviderResolvedModelWithPlugin: vi.fn(() => undefined),
|
||||
resolveBundledProviderPolicySurface: vi.fn(() => null),
|
||||
shouldSuppressBuiltInModel: vi.fn(() => {
|
||||
shouldSuppressBuiltInModelCore: vi.fn(() => {
|
||||
throw new Error("runtime model suppression should be skipped");
|
||||
}),
|
||||
shouldSuppressBuiltInModelFromManifest: vi.fn(() => false),
|
||||
}));
|
||||
|
||||
vi.mock("../../agents/model-suppression.js", () => ({
|
||||
shouldSuppressBuiltInModel: mocks.shouldSuppressBuiltInModel,
|
||||
shouldSuppressBuiltInModelCore: mocks.shouldSuppressBuiltInModelCore,
|
||||
shouldSuppressBuiltInModelFromManifest: mocks.shouldSuppressBuiltInModelFromManifest,
|
||||
}));
|
||||
|
||||
@@ -565,7 +565,7 @@ describe("prepared provider catalog projection", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(mocks.shouldSuppressBuiltInModel).not.toHaveBeenCalled();
|
||||
expect(mocks.shouldSuppressBuiltInModelCore).not.toHaveBeenCalled();
|
||||
expect(mocks.shouldSuppressBuiltInModelFromManifest).toHaveBeenCalledWith({
|
||||
provider: "openai",
|
||||
id: "gpt-5.3-codex-spark",
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
} from "../../agents/model-ref-shared.js";
|
||||
import { modelCatalogLogicalKey } from "../../agents/model-selection-shared.js";
|
||||
import {
|
||||
shouldSuppressBuiltInModel,
|
||||
shouldSuppressBuiltInModelCore,
|
||||
shouldSuppressBuiltInModelFromManifest,
|
||||
} from "../../agents/model-suppression.js";
|
||||
import { openAIModelCatalogRoutePolicy } from "../../agents/openai-model-routes.js";
|
||||
@@ -235,7 +235,7 @@ function shouldSuppressListModel(params: {
|
||||
config: params.context.cfg,
|
||||
});
|
||||
}
|
||||
return shouldSuppressBuiltInModel({
|
||||
return shouldSuppressBuiltInModelCore({
|
||||
provider: params.model.provider,
|
||||
id: params.model.id,
|
||||
baseUrl: params.model.baseUrl,
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from "node:path";
|
||||
import { normalizeProviderId } from "@openclaw/model-catalog-core/provider-id";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import {
|
||||
loadPluginManifestRegistry,
|
||||
loadPluginManifestRegistryCore,
|
||||
type PluginManifestRecord,
|
||||
} from "../../plugins/manifest-registry.js";
|
||||
import { loadPluginManifest, type PluginManifestModelCatalog } from "../../plugins/manifest.js";
|
||||
@@ -20,7 +20,7 @@ const sourcePeerModelCatalogCache = new Map<string, PluginManifestModelCatalog |
|
||||
function listManifestPlugins(params: ProviderAliasSource): readonly PluginManifestRecord[] {
|
||||
return (
|
||||
params.metadataSnapshot?.manifestRegistry.plugins ??
|
||||
loadPluginManifestRegistry({
|
||||
loadPluginManifestRegistryCore({
|
||||
config: params.cfg,
|
||||
}).plugins
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@ const catalogMocks = vi.hoisted(() => ({
|
||||
}));
|
||||
|
||||
const manifestRegistryMocks = vi.hoisted(() => ({
|
||||
loadPluginManifestRegistry: vi.fn(() => ({ plugins: [], diagnostics: [] })),
|
||||
loadPluginManifestRegistryCore: vi.fn(() => ({ plugins: [], diagnostics: [] })),
|
||||
}));
|
||||
|
||||
function createPrompter(overrides: Partial<WizardPrompter>): WizardPrompter {
|
||||
@@ -515,7 +515,7 @@ vi.mock("../plugins/manifest-registry.js", async () => {
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
loadPluginManifestRegistry: manifestRegistryMocks.loadPluginManifestRegistry,
|
||||
loadPluginManifestRegistryCore: manifestRegistryMocks.loadPluginManifestRegistryCore,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -610,8 +610,8 @@ describe("setupChannels", () => {
|
||||
setMinimalOnboardingRegistryForTests();
|
||||
catalogMocks.listChannelPluginCatalogEntries.mockReset();
|
||||
catalogMocks.listChannelPluginCatalogEntries.mockReturnValue([]);
|
||||
manifestRegistryMocks.loadPluginManifestRegistry.mockReset();
|
||||
manifestRegistryMocks.loadPluginManifestRegistry.mockReturnValue({
|
||||
manifestRegistryMocks.loadPluginManifestRegistryCore.mockReset();
|
||||
manifestRegistryMocks.loadPluginManifestRegistryCore.mockReturnValue({
|
||||
plugins: [],
|
||||
diagnostics: [],
|
||||
});
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
* Kept behind a lazy boundary so ordinary local setup can infer core auth
|
||||
* choices without loading plugin provider discovery.
|
||||
*/
|
||||
import { resolveProviderPluginChoice } from "../../../plugins/provider-wizard.js";
|
||||
import { resolveProviderPluginChoiceCore } from "../../../plugins/provider-wizard.js";
|
||||
import { resolveOwningPluginIdsForProviderRef } from "../../../plugins/providers.js";
|
||||
import { resolvePluginProviders } from "../../../plugins/providers.runtime.js";
|
||||
import { resolvePluginProvidersCore } from "../../../plugins/providers.runtime.js";
|
||||
|
||||
/** Provider discovery surface used by non-interactive auth-choice handling. */
|
||||
export const authChoicePluginProvidersRuntime = {
|
||||
resolveOwningPluginIdsForProviderRef,
|
||||
resolveProviderPluginChoice,
|
||||
resolvePluginProviders,
|
||||
resolveProviderPluginChoice: resolveProviderPluginChoiceCore,
|
||||
resolvePluginProviders: resolvePluginProvidersCore,
|
||||
};
|
||||
|
||||
@@ -60,12 +60,12 @@ vi.mock("../../onboarding-plugin-install.js", () => ({
|
||||
|
||||
const resolveOwningPluginIdsForProvider = vi.hoisted(() => vi.fn(() => undefined));
|
||||
const resolveProviderPluginChoice = vi.hoisted(() => vi.fn());
|
||||
const resolvePluginProviders = vi.hoisted(() => vi.fn(() => []));
|
||||
const resolvePluginProvidersCore = vi.hoisted(() => vi.fn(() => []));
|
||||
vi.mock("./auth-choice.plugin-providers.runtime.js", () => ({
|
||||
authChoicePluginProvidersRuntime: {
|
||||
resolveOwningPluginIdsForProviderRef: resolveOwningPluginIdsForProvider,
|
||||
resolveProviderPluginChoice,
|
||||
resolvePluginProviders,
|
||||
resolvePluginProviders: resolvePluginProvidersCore,
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -78,7 +78,7 @@ beforeEach(() => {
|
||||
ensureOnboardingPluginInstalled.mockResolvedValue(undefined);
|
||||
resolveOwningPluginIdsForProvider.mockReturnValue(undefined as never);
|
||||
resolveProviderPluginChoice.mockReturnValue(undefined);
|
||||
resolvePluginProviders.mockReturnValue([] as never);
|
||||
resolvePluginProvidersCore.mockReturnValue([] as never);
|
||||
ensureCodexRuntimePluginForModelSelection.mockImplementation(async ({ cfg }) => ({
|
||||
cfg,
|
||||
required: false,
|
||||
@@ -161,7 +161,7 @@ async function applyProviderModelChoice(params: {
|
||||
},
|
||||
},
|
||||
}));
|
||||
resolvePluginProviders.mockReturnValue([provider] as never);
|
||||
resolvePluginProvidersCore.mockReturnValue([provider] as never);
|
||||
resolveProviderPluginChoice.mockReturnValue({
|
||||
provider,
|
||||
method: { runNonInteractive },
|
||||
@@ -253,7 +253,7 @@ describe("applyNonInteractivePluginProviderChoice", () => {
|
||||
const runtime = createRuntime();
|
||||
const runNonInteractive = vi.fn(async () => ({ plugins: { allow: ["vllm"] } }));
|
||||
resolveOwningPluginIdsForProvider.mockReturnValue(["vllm"] as never);
|
||||
resolvePluginProviders.mockReturnValue([{ id: "vllm", pluginId: "vllm" }] as never);
|
||||
resolvePluginProvidersCore.mockReturnValue([{ id: "vllm", pluginId: "vllm" }] as never);
|
||||
resolveProviderPluginChoice.mockReturnValue({
|
||||
provider: { id: "vllm", pluginId: "vllm", label: "vLLM" },
|
||||
method: { runNonInteractive },
|
||||
@@ -273,8 +273,8 @@ describe("applyNonInteractivePluginProviderChoice", () => {
|
||||
expect(resolveOwningPluginIdsForProvider).toHaveBeenCalledOnce();
|
||||
expect(resolvePreferredProviderForAuthChoice).not.toHaveBeenCalled();
|
||||
expect(mockArg(resolveOwningPluginIdsForProvider).provider).toBe("vllm");
|
||||
expect(resolvePluginProviders).toHaveBeenCalledOnce();
|
||||
const providersInput = mockArg(resolvePluginProviders);
|
||||
expect(resolvePluginProvidersCore).toHaveBeenCalledOnce();
|
||||
const providersInput = mockArg(resolvePluginProvidersCore);
|
||||
expect(providersInput.onlyPluginIds).toEqual(["vllm"]);
|
||||
expect(providersInput.includeUntrustedWorkspacePlugins).toBe(false);
|
||||
expect(resolveProviderPluginChoice).toHaveBeenCalledOnce();
|
||||
@@ -319,7 +319,7 @@ describe("applyNonInteractivePluginProviderChoice", () => {
|
||||
pluginId: "groq",
|
||||
status: "installed",
|
||||
});
|
||||
resolvePluginProviders.mockReturnValue([provider] as never);
|
||||
resolvePluginProvidersCore.mockReturnValue([provider] as never);
|
||||
resolveProviderPluginChoice.mockReturnValueOnce(undefined).mockReturnValue({
|
||||
provider,
|
||||
method: { runNonInteractive },
|
||||
@@ -357,7 +357,7 @@ describe("applyNonInteractivePluginProviderChoice", () => {
|
||||
promptInstall: false,
|
||||
}),
|
||||
);
|
||||
expect(resolvePluginProviders).toHaveBeenCalledTimes(2);
|
||||
expect(resolvePluginProvidersCore).toHaveBeenCalledTimes(2);
|
||||
expect(runNonInteractive).toHaveBeenCalledOnce();
|
||||
expect(result).toMatchObject({
|
||||
agents: {
|
||||
@@ -448,9 +448,9 @@ describe("applyNonInteractivePluginProviderChoice", () => {
|
||||
'Auth choice "workspace-provider-api-key" matched a provider plugin that is not trusted or enabled for setup.',
|
||||
);
|
||||
expect(runtime.exit).toHaveBeenCalledWith(1);
|
||||
expect(mockArg(resolvePluginProviders).includeUntrustedWorkspacePlugins).toBe(false);
|
||||
expect(mockArg(resolvePluginProvidersCore).includeUntrustedWorkspacePlugins).toBe(false);
|
||||
expect(resolveProviderPluginChoice).toHaveBeenCalledTimes(1);
|
||||
expect(resolvePluginProviders).toHaveBeenCalledTimes(1);
|
||||
expect(resolvePluginProvidersCore).toHaveBeenCalledTimes(1);
|
||||
expect(mockCall(resolveManifestProviderAuthChoice, 0)[0]).toBe("workspace-provider-api-key");
|
||||
const trustedManifestInput = mockArg(resolveManifestProviderAuthChoice, 0, 1);
|
||||
expect(trustedManifestInput.includeUntrustedWorkspacePlugins).toBe(false);
|
||||
@@ -465,7 +465,7 @@ describe("applyNonInteractivePluginProviderChoice", () => {
|
||||
const runtime = createRuntime();
|
||||
const runNonInteractive = vi.fn(async () => ({ plugins: { allow: ["demo-plugin"] } }));
|
||||
resolveOwningPluginIdsForProvider.mockReturnValue(["demo-plugin"] as never);
|
||||
resolvePluginProviders.mockReturnValue([
|
||||
resolvePluginProvidersCore.mockReturnValue([
|
||||
{ id: "demo-provider", pluginId: "demo-plugin" },
|
||||
] as never);
|
||||
resolveProviderPluginChoice.mockReturnValue({
|
||||
@@ -484,7 +484,7 @@ describe("applyNonInteractivePluginProviderChoice", () => {
|
||||
toApiKeyCredential: vi.fn(),
|
||||
});
|
||||
|
||||
const providersInput = mockArg(resolvePluginProviders);
|
||||
const providersInput = mockArg(resolvePluginProvidersCore);
|
||||
expectConfigDefaults(providersInput.config);
|
||||
expect(providersInput.onlyPluginIds).toEqual(["demo-plugin"]);
|
||||
expect(providersInput.includeUntrustedWorkspacePlugins).toBe(false);
|
||||
@@ -510,7 +510,7 @@ describe("applyNonInteractivePluginProviderChoice", () => {
|
||||
const preferenceInput = mockArg(resolvePreferredProviderForAuthChoice);
|
||||
expect(preferenceInput.choice).toBe("openai-api-key");
|
||||
expect(preferenceInput.includeUntrustedWorkspacePlugins).toBe(false);
|
||||
expect(mockArg(resolvePluginProviders).includeUntrustedWorkspacePlugins).toBe(false);
|
||||
expect(mockArg(resolvePluginProvidersCore).includeUntrustedWorkspacePlugins).toBe(false);
|
||||
});
|
||||
|
||||
it("ensures Codex after a non-interactive OpenAI provider choice sets the default model", async () => {
|
||||
@@ -528,7 +528,7 @@ describe("applyNonInteractivePluginProviderChoice", () => {
|
||||
required: true,
|
||||
installed: true,
|
||||
});
|
||||
resolvePluginProviders.mockReturnValue([{ id: "openai", pluginId: "openai" }] as never);
|
||||
resolvePluginProvidersCore.mockReturnValue([{ id: "openai", pluginId: "openai" }] as never);
|
||||
resolveProviderPluginChoice.mockReturnValue({
|
||||
provider: { id: "openai", pluginId: "openai", label: "OpenAI" },
|
||||
method: { runNonInteractive },
|
||||
@@ -579,7 +579,7 @@ describe("applyNonInteractivePluginProviderChoice", () => {
|
||||
required: true,
|
||||
installed: true,
|
||||
});
|
||||
resolvePluginProviders.mockReturnValue([
|
||||
resolvePluginProvidersCore.mockReturnValue([
|
||||
{ id: "github-copilot", pluginId: "github-copilot" },
|
||||
] as never);
|
||||
resolveProviderPluginChoice.mockReturnValue({
|
||||
@@ -617,7 +617,7 @@ describe("applyNonInteractivePluginProviderChoice", () => {
|
||||
required: false,
|
||||
installed: false,
|
||||
});
|
||||
resolvePluginProviders.mockReturnValue([{ id: "openai", pluginId: "openai" }] as never);
|
||||
resolvePluginProvidersCore.mockReturnValue([{ id: "openai", pluginId: "openai" }] as never);
|
||||
resolveProviderPluginChoice.mockReturnValue({
|
||||
provider: { id: "openai", pluginId: "openai", label: "OpenAI" },
|
||||
method: { runNonInteractive },
|
||||
|
||||
@@ -162,7 +162,7 @@ vi.mock("../plugins/manifest-registry.js", () => {
|
||||
});
|
||||
|
||||
return {
|
||||
loadPluginManifestRegistry: () => ({
|
||||
loadPluginManifestRegistryCore: () => ({
|
||||
plugins: [
|
||||
{
|
||||
id: "brave",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Collects runtime data needed to generate config documentation baselines.
|
||||
import { collectBundledChannelConfigsCore } from "../plugins/bundled-channel-config-metadata.js";
|
||||
import { loadPluginManifestRegistry as loadPluginManifestRegistryImpl } from "../plugins/manifest-registry.js";
|
||||
import { loadPluginManifestRegistryCore as loadPluginManifestRegistryImpl } from "../plugins/manifest-registry.js";
|
||||
import {
|
||||
collectChannelSchemaMetadataCore,
|
||||
collectPluginSchemaMetadataCore,
|
||||
|
||||
@@ -52,7 +52,7 @@ const mockMaintainConfigBackups = vi.hoisted(() =>
|
||||
);
|
||||
|
||||
vi.mock("../plugins/manifest-registry.js", () => ({
|
||||
loadPluginManifestRegistry: mockLoadPluginManifestRegistry,
|
||||
loadPluginManifestRegistryCore: mockLoadPluginManifestRegistry,
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/plugin-registry.js", async (importOriginal) => {
|
||||
|
||||
@@ -34,7 +34,7 @@ vi.mock("./config.js", () => {
|
||||
});
|
||||
|
||||
vi.mock("../plugins/manifest-registry.js", () => ({
|
||||
loadPluginManifestRegistry: (...args: unknown[]) => mockLoadPluginManifestRegistry(...args),
|
||||
loadPluginManifestRegistryCore: (...args: unknown[]) => mockLoadPluginManifestRegistry(...args),
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/plugin-registry.js", () => ({
|
||||
|
||||
@@ -17,7 +17,7 @@ export {
|
||||
resolveSessionEntryCandidateTarget,
|
||||
} from "./sessions/session-accessor.js";
|
||||
export * from "./sessions/session-key.js";
|
||||
export { resolveSessionStoreEntry } from "./sessions/store-entry.js";
|
||||
export { resolveSessionStoreEntryCore } from "./sessions/store-entry.js";
|
||||
export * from "./sessions/types.js";
|
||||
export * from "./sessions/transcript.js";
|
||||
export * from "./sessions/session-registry-maintenance.js";
|
||||
|
||||
@@ -56,7 +56,7 @@ import { canonicalSessionKeyMigrationRequiredError } from "./session-canonical-k
|
||||
import { resolveSessionStorePathForScope } from "./session-store-path.js";
|
||||
import {
|
||||
normalizeStoreSessionKey,
|
||||
resolveSessionStoreEntry as resolveSessionEntryFromStore,
|
||||
resolveSessionStoreEntryCore as resolveSessionEntryFromStore,
|
||||
} from "./store-entry.js";
|
||||
import { resolveAllAgentSessionStoreTargetsSync, type SessionStoreTarget } from "./targets.js";
|
||||
import type { SessionEntry } from "./types.js";
|
||||
|
||||
@@ -275,7 +275,7 @@ function resolveSessionEntryCandidates(params: {
|
||||
};
|
||||
}
|
||||
|
||||
export function resolveSessionStoreEntry(params: {
|
||||
export function resolveSessionStoreEntryCore(params: {
|
||||
store: Record<string, SessionEntry>;
|
||||
sessionKey: string;
|
||||
}): {
|
||||
|
||||
@@ -242,7 +242,7 @@ function createPluginManifestRecord(
|
||||
}
|
||||
|
||||
vi.mock("../plugins/manifest-registry.js", () => ({
|
||||
loadPluginManifestRegistry: () => mockLoadPluginManifestRegistry(),
|
||||
loadPluginManifestRegistryCore: () => mockLoadPluginManifestRegistry(),
|
||||
resolveManifestContractPluginIds: () => [],
|
||||
}));
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user