Skip to content

Commit 4ca87fa

Browse files
authored
fix: restore main build (openclaw#49478)
* Build: restore main build * Config: align model compat schema
1 parent 4c160d2 commit 4ca87fa

File tree

4 files changed

+43
-16
lines changed

4 files changed

+43
-16
lines changed

extensions/signal/src/accounts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
resolveAccountEntry,
55
type OpenClawConfig,
66
} from "openclaw/plugin-sdk/account-resolution";
7-
import type { SignalAccountConfig } from "../runtime-api.js";
7+
import type { SignalAccountConfig } from "../../../src/config/types.signal.js";
88

99
export type ResolvedSignalAccount = {
1010
accountId: string;

extensions/xai/web-search.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
wrapWebContent,
1515
writeCache,
1616
} from "openclaw/plugin-sdk/provider-web-search";
17+
import type { WebSearchProviderPlugin } from "../../src/plugins/types.js";
1718

1819
const XAI_WEB_SEARCH_ENDPOINT = "https://api.x.ai/v1/responses";
1920
const XAI_DEFAULT_WEB_SEARCH_MODEL = "grok-4-1-fast";
@@ -200,7 +201,7 @@ async function runXaiWebSearch(params: {
200201
return payload;
201202
}
202203

203-
export function createXaiWebSearchProvider() {
204+
export function createXaiWebSearchProvider(): WebSearchProviderPlugin {
204205
return {
205206
id: "grok",
206207
label: "Grok (xAI)",
@@ -210,8 +211,8 @@ export function createXaiWebSearchProvider() {
210211
signupUrl: "https://console.x.ai/",
211212
docsUrl: "https://docs.openclaw.ai/tools/web",
212213
autoDetectOrder: 30,
213-
credentialPath: "tools.web.search.grok.apiKey",
214-
inactiveSecretPaths: ["tools.web.search.grok.apiKey"],
214+
credentialPath: "plugins.entries.xai.config.webSearch.apiKey",
215+
inactiveSecretPaths: ["plugins.entries.xai.config.webSearch.apiKey"],
215216
getCredentialValue: (searchConfig?: Record<string, unknown>) =>
216217
getScopedCredentialValue(searchConfig, "grok"),
217218
setCredentialValue: (searchConfigTarget: Record<string, unknown>, value: unknown) =>

src/config/types.models.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { OpenAICompletionsCompat } from "@mariozechner/pi-ai";
12
import type { SecretInput } from "./types.secrets.js";
23

34
export const MODEL_APIS = [
@@ -13,21 +14,25 @@ export const MODEL_APIS = [
1314

1415
export type ModelApi = (typeof MODEL_APIS)[number];
1516

16-
export type ModelCompatConfig = {
17-
supportsStore?: boolean;
18-
supportsDeveloperRole?: boolean;
19-
supportsReasoningEffort?: boolean;
20-
supportsUsageInStreaming?: boolean;
17+
type SupportedOpenAICompatFields = Pick<
18+
OpenAICompletionsCompat,
19+
| "supportsStore"
20+
| "supportsDeveloperRole"
21+
| "supportsReasoningEffort"
22+
| "supportsUsageInStreaming"
23+
| "supportsStrictMode"
24+
| "maxTokensField"
25+
| "thinkingFormat"
26+
| "requiresToolResultName"
27+
| "requiresAssistantAfterToolResult"
28+
| "requiresThinkingAsText"
29+
>;
30+
31+
export type ModelCompatConfig = SupportedOpenAICompatFields & {
2132
supportsTools?: boolean;
22-
supportsStrictMode?: boolean;
2333
toolSchemaProfile?: "xai";
2434
nativeWebSearchTool?: boolean;
2535
toolCallArgumentsEncoding?: "html-entities";
26-
maxTokensField?: "max_completion_tokens" | "max_tokens";
27-
thinkingFormat?: "openai" | "zai" | "qwen";
28-
requiresToolResultName?: boolean;
29-
requiresAssistantAfterToolResult?: boolean;
30-
requiresThinkingAsText?: boolean;
3136
requiresMistralToolIds?: boolean;
3237
requiresOpenAiAnthropicToolPayload?: boolean;
3338
};

src/config/zod-schema.core.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
isValidExecSecretRefId,
77
isValidFileSecretRefId,
88
} from "../secrets/ref-contract.js";
9+
import type { ModelCompatConfig } from "./types.models.js";
910
import { MODEL_APIS } from "./types.models.js";
1011
import { createAllowDenyChannelRulesSchema } from "./zod-schema.allowdeny.js";
1112
import { sensitive } from "./zod-schema.sensitive.js";
@@ -191,16 +192,36 @@ export const ModelCompatSchema = z
191192
maxTokensField: z
192193
.union([z.literal("max_completion_tokens"), z.literal("max_tokens")])
193194
.optional(),
194-
thinkingFormat: z.union([z.literal("openai"), z.literal("zai"), z.literal("qwen")]).optional(),
195+
thinkingFormat: z
196+
.union([
197+
z.literal("openai"),
198+
z.literal("zai"),
199+
z.literal("qwen"),
200+
z.literal("qwen-chat-template"),
201+
])
202+
.optional(),
195203
requiresToolResultName: z.boolean().optional(),
196204
requiresAssistantAfterToolResult: z.boolean().optional(),
197205
requiresThinkingAsText: z.boolean().optional(),
206+
toolSchemaProfile: z.literal("xai").optional(),
207+
nativeWebSearchTool: z.boolean().optional(),
208+
toolCallArgumentsEncoding: z.literal("html-entities").optional(),
198209
requiresMistralToolIds: z.boolean().optional(),
199210
requiresOpenAiAnthropicToolPayload: z.boolean().optional(),
200211
})
201212
.strict()
202213
.optional();
203214

215+
type AssertAssignable<_T extends U, U> = true;
216+
type _ModelCompatSchemaAssignableToType = AssertAssignable<
217+
z.infer<typeof ModelCompatSchema>,
218+
ModelCompatConfig | undefined
219+
>;
220+
type _ModelCompatTypeAssignableToSchema = AssertAssignable<
221+
ModelCompatConfig | undefined,
222+
z.infer<typeof ModelCompatSchema>
223+
>;
224+
204225
export const ModelDefinitionSchema = z
205226
.object({
206227
id: z.string().min(1),

0 commit comments

Comments
 (0)