fix: repair rebased contract gate

This commit is contained in:
Peter Steinberger 2026-03-18 15:43:24 +00:00
parent f6928617b7
commit a0e7a2fcc1
4 changed files with 16 additions and 16 deletions

View File

@ -192,7 +192,14 @@ export const ModelCompatSchema = z
maxTokensField: z
.union([z.literal("max_completion_tokens"), z.literal("max_tokens")])
.optional(),
thinkingFormat: z.union([z.literal("openai"), z.literal("zai"), z.literal("qwen")]).optional(),
thinkingFormat: z
.union([
z.literal("openai"),
z.literal("zai"),
z.literal("qwen"),
z.literal("qwen-chat-template"),
])
.optional(),
requiresToolResultName: z.boolean().optional(),
requiresAssistantAfterToolResult: z.boolean().optional(),
requiresThinkingAsText: z.boolean().optional(),

View File

@ -12,11 +12,11 @@ import type {
import type { OpenClawPluginApi, ProviderPlugin } from "../types.js";
type LoginOpenAICodexOAuth =
(typeof import("openclaw/plugin-sdk/provider-auth"))["loginOpenAICodexOAuth"];
(typeof import("openclaw/plugin-sdk/provider-auth-login"))["loginOpenAICodexOAuth"];
type LoginQwenPortalOAuth =
(typeof import("../../../extensions/qwen-portal-auth/oauth.js"))["loginQwenPortalOAuth"];
type GithubCopilotLoginCommand =
(typeof import("openclaw/plugin-sdk/provider-auth"))["githubCopilotLoginCommand"];
(typeof import("openclaw/plugin-sdk/provider-auth-login"))["githubCopilotLoginCommand"];
type CreateVpsAwareHandlers =
(typeof import("../provider-oauth-flow.js"))["createVpsAwareOAuthHandlers"];
type EnsureAuthProfileStore =
@ -30,12 +30,10 @@ const githubCopilotLoginCommandMock = vi.hoisted(() => vi.fn<GithubCopilotLoginC
const ensureAuthProfileStoreMock = vi.hoisted(() => vi.fn<EnsureAuthProfileStore>());
const listProfilesForProviderMock = vi.hoisted(() => vi.fn<ListProfilesForProvider>());
vi.mock("openclaw/plugin-sdk/provider-auth", async (importOriginal) => {
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/provider-auth")>();
vi.mock("openclaw/plugin-sdk/provider-auth-login", async (importOriginal) => {
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/provider-auth-login")>();
return {
...actual,
ensureAuthProfileStore: ensureAuthProfileStoreMock,
listProfilesForProvider: listProfilesForProviderMock,
loginOpenAICodexOAuth: loginOpenAICodexOAuthMock,
githubCopilotLoginCommand: githubCopilotLoginCommandMock,
};

View File

@ -2,10 +2,10 @@ import { describe, expect, it } from "vitest";
import { resolveBundledWebSearchPluginIds } from "../bundled-web-search.js";
import { loadPluginManifestRegistry } from "../manifest-registry.js";
import {
capabilityContractLoadError,
imageGenerationProviderContractRegistry,
mediaUnderstandingProviderContractRegistry,
pluginRegistrationContractRegistry,
providerContractLoadError,
providerContractPluginIds,
providerContractRegistry,
speechProviderContractRegistry,
@ -87,7 +87,7 @@ function findRegistrationForPlugin(pluginId: string) {
describe("plugin contract registry", () => {
it("loads bundled non-provider capability registries without import-time failure", () => {
expect(capabilityContractLoadError).toBeUndefined();
expect(providerContractLoadError).toBeUndefined();
expect(pluginRegistrationContractRegistry.length).toBeGreaterThan(0);
});

View File

@ -1,7 +1,7 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { createProviderUsageFetch, makeResponse } from "../../test-utils/provider-usage-fetch.js";
import type { ProviderRuntimeModel } from "../types.js";
import { requireProviderContractProvider } from "./registry.js";
@ -44,12 +44,7 @@ function createModel(overrides: Partial<ProviderRuntimeModel> & Pick<ProviderRun
}
describe("provider runtime contract", () => {
beforeEach(async () => {
vi.resetModules();
({ requireProviderContractProvider: requireBundledProviderContractProvider } =
await import("./registry.js"));
openAIPlugin = (await import("../../../extensions/openai/index.js")).default;
qwenPortalPlugin = (await import("../../../extensions/qwen-portal-auth/index.js")).default;
beforeEach(() => {
getOAuthApiKeyMock.mockReset();
refreshQwenPortalCredentialsMock.mockReset();
}, CONTRACT_SETUP_TIMEOUT_MS);