mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 03:10:22 +00:00
fix: stabilize bundled plugin ci lanes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import crypto from "node:crypto";
|
||||
import { CHANNEL_IDS } from "../channels/registry.js";
|
||||
import { GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA } from "./bundled-channel-config-metadata.generated.js";
|
||||
import { GENERATED_BASE_CONFIG_SCHEMA } from "./schema.base.generated.js";
|
||||
import type { ConfigUiHint, ConfigUiHints } from "./schema.hints.js";
|
||||
import { applySensitiveHints } from "./schema.hints.js";
|
||||
@@ -439,11 +440,42 @@ function setMergedSchemaCache(key: string, value: ConfigSchemaResponse): void {
|
||||
mergedSchemaCache.set(key, value);
|
||||
}
|
||||
|
||||
function getBundledChannelSchemaMetadata(): ChannelUiMetadata[] {
|
||||
return GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA.map((entry) => {
|
||||
const metadata: ChannelUiMetadata = {
|
||||
id: entry.channelId,
|
||||
...(entry.label ? { label: entry.label } : {}),
|
||||
...(entry.description ? { description: entry.description } : {}),
|
||||
configSchema: entry.schema,
|
||||
};
|
||||
if ("uiHints" in entry) {
|
||||
metadata.configUiHints = entry.uiHints as ChannelUiMetadata["configUiHints"];
|
||||
}
|
||||
return metadata;
|
||||
});
|
||||
}
|
||||
|
||||
function buildBaseConfigSchema(): ConfigSchemaResponse {
|
||||
if (cachedBase) {
|
||||
return cachedBase;
|
||||
}
|
||||
const next = GENERATED_BASE_CONFIG_SCHEMA as unknown as ConfigSchemaResponse;
|
||||
const generated = GENERATED_BASE_CONFIG_SCHEMA as unknown as ConfigSchemaResponse;
|
||||
const bundledChannels = getBundledChannelSchemaMetadata();
|
||||
const mergedWithoutSensitiveHints = applyHeartbeatTargetHints(
|
||||
applyChannelHints(generated.uiHints, bundledChannels),
|
||||
bundledChannels,
|
||||
);
|
||||
const mergedHints = applyDerivedTags(
|
||||
applySensitiveHints(
|
||||
mergedWithoutSensitiveHints,
|
||||
collectExtensionHintKeys(mergedWithoutSensitiveHints, [], bundledChannels),
|
||||
),
|
||||
);
|
||||
const next = {
|
||||
...generated,
|
||||
schema: applyChannelSchemas(generated.schema, bundledChannels),
|
||||
uiHints: mergedHints,
|
||||
};
|
||||
cachedBase = next;
|
||||
return next;
|
||||
}
|
||||
|
||||
@@ -105,6 +105,7 @@ function packOpenClawToTempDir(packDir: string): string {
|
||||
cwd: REPO_ROOT,
|
||||
encoding: "utf8",
|
||||
env: { ...process.env, COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" },
|
||||
maxBuffer: 32 * 1024 * 1024,
|
||||
},
|
||||
);
|
||||
const parsed = JSON.parse(raw) as Array<{ filename?: string }>;
|
||||
@@ -197,7 +198,7 @@ describe("plugin-sdk package contract guardrails", () => {
|
||||
|
||||
execFileSync(
|
||||
resolvePackageManagerCommand("pnpm"),
|
||||
["add", "--offline", "--ignore-scripts", archivePath],
|
||||
["add", "--prefer-offline", "--ignore-scripts", archivePath],
|
||||
{
|
||||
cwd: consumerDir,
|
||||
encoding: "utf8",
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { AuthProfileStore } from "../../agents/auth-profiles/types.js";
|
||||
import type { ModelDefinitionConfig } from "../../config/types.models.js";
|
||||
import {
|
||||
loadBundledPluginPublicSurfaceSync,
|
||||
resolveRelativeBundledPluginPublicModuleId,
|
||||
} from "../../test-utils/bundled-plugin-public-surface.js";
|
||||
import { registerProviders, requireProvider } from "./testkit.js";
|
||||
|
||||
const resolveCopilotApiTokenMock = vi.hoisted(() => vi.fn());
|
||||
@@ -138,28 +134,16 @@ function runCatalog(params: {
|
||||
});
|
||||
}
|
||||
|
||||
function buildBundledPluginModuleId(pluginId: string, artifactBasename: string): string {
|
||||
return `../../../extensions/${pluginId}/${artifactBasename}`;
|
||||
}
|
||||
|
||||
describe("provider discovery contract", () => {
|
||||
beforeEach(async () => {
|
||||
const githubCopilotTokenModuleId = resolveRelativeBundledPluginPublicModuleId({
|
||||
fromModuleUrl: import.meta.url,
|
||||
pluginId: "github-copilot",
|
||||
artifactBasename: "token.js",
|
||||
});
|
||||
const ollamaApiModuleId = resolveRelativeBundledPluginPublicModuleId({
|
||||
fromModuleUrl: import.meta.url,
|
||||
pluginId: "ollama",
|
||||
artifactBasename: "api.js",
|
||||
});
|
||||
const vllmApiModuleId = resolveRelativeBundledPluginPublicModuleId({
|
||||
fromModuleUrl: import.meta.url,
|
||||
pluginId: "vllm",
|
||||
artifactBasename: "api.js",
|
||||
});
|
||||
const sglangApiModuleId = resolveRelativeBundledPluginPublicModuleId({
|
||||
fromModuleUrl: import.meta.url,
|
||||
pluginId: "sglang",
|
||||
artifactBasename: "api.js",
|
||||
});
|
||||
const githubCopilotTokenModuleId = buildBundledPluginModuleId("github-copilot", "token.js");
|
||||
const ollamaApiModuleId = buildBundledPluginModuleId("ollama", "api.js");
|
||||
const vllmApiModuleId = buildBundledPluginModuleId("vllm", "api.js");
|
||||
const sglangApiModuleId = buildBundledPluginModuleId("sglang", "api.js");
|
||||
vi.resetModules();
|
||||
vi.doMock("openclaw/plugin-sdk/agent-runtime", async () => {
|
||||
// Import the direct source module, not the mocked subpath, so bundled
|
||||
@@ -217,27 +201,27 @@ describe("provider discovery contract", () => {
|
||||
{ default: modelStudioPlugin },
|
||||
{ default: cloudflareAiGatewayPlugin },
|
||||
] = await Promise.all([
|
||||
loadBundledPluginPublicSurfaceSync<{
|
||||
import(buildBundledPluginModuleId("github-copilot", "index.js")) as Promise<{
|
||||
default: Parameters<typeof registerProviders>[0];
|
||||
}>({ pluginId: "github-copilot", artifactBasename: "index.js" }),
|
||||
loadBundledPluginPublicSurfaceSync<{
|
||||
}>,
|
||||
import(buildBundledPluginModuleId("ollama", "index.js")) as Promise<{
|
||||
default: Parameters<typeof registerProviders>[0];
|
||||
}>({ pluginId: "ollama", artifactBasename: "index.js" }),
|
||||
loadBundledPluginPublicSurfaceSync<{
|
||||
}>,
|
||||
import(buildBundledPluginModuleId("vllm", "index.js")) as Promise<{
|
||||
default: Parameters<typeof registerProviders>[0];
|
||||
}>({ pluginId: "vllm", artifactBasename: "index.js" }),
|
||||
loadBundledPluginPublicSurfaceSync<{
|
||||
}>,
|
||||
import(buildBundledPluginModuleId("sglang", "index.js")) as Promise<{
|
||||
default: Parameters<typeof registerProviders>[0];
|
||||
}>({ pluginId: "sglang", artifactBasename: "index.js" }),
|
||||
loadBundledPluginPublicSurfaceSync<{
|
||||
}>,
|
||||
import(buildBundledPluginModuleId("minimax", "index.js")) as Promise<{
|
||||
default: Parameters<typeof registerProviders>[0];
|
||||
}>({ pluginId: "minimax", artifactBasename: "index.js" }),
|
||||
loadBundledPluginPublicSurfaceSync<{
|
||||
}>,
|
||||
import(buildBundledPluginModuleId("modelstudio", "index.js")) as Promise<{
|
||||
default: Parameters<typeof registerProviders>[0];
|
||||
}>({ pluginId: "modelstudio", artifactBasename: "index.js" }),
|
||||
loadBundledPluginPublicSurfaceSync<{
|
||||
}>,
|
||||
import(buildBundledPluginModuleId("cloudflare-ai-gateway", "index.js")) as Promise<{
|
||||
default: Parameters<typeof registerProviders>[0];
|
||||
}>({ pluginId: "cloudflare-ai-gateway", artifactBasename: "index.js" }),
|
||||
}>,
|
||||
]);
|
||||
githubCopilotProvider = requireProvider(
|
||||
registerProviders(githubCopilotPlugin),
|
||||
|
||||
Reference in New Issue
Block a user