mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 10:40:20 +00:00
refactor(xai): move code_execution into plugin
This commit is contained in:
committed by
Peter Steinberger
parent
1617e0218f
commit
b7ab0ddb55
@@ -7164,94 +7164,6 @@ export const GENERATED_BASE_CONFIG_SCHEMA = {
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
code_execution: {
|
||||
type: "object",
|
||||
properties: {
|
||||
enabled: {
|
||||
type: "boolean",
|
||||
},
|
||||
apiKey: {
|
||||
anyOf: [
|
||||
{
|
||||
type: "string",
|
||||
},
|
||||
{
|
||||
oneOf: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
source: {
|
||||
type: "string",
|
||||
const: "env",
|
||||
},
|
||||
provider: {
|
||||
type: "string",
|
||||
pattern: "^[a-z][a-z0-9_-]{0,63}$",
|
||||
},
|
||||
id: {
|
||||
type: "string",
|
||||
pattern: "^[A-Z][A-Z0-9_]{0,127}$",
|
||||
},
|
||||
},
|
||||
required: ["source", "provider", "id"],
|
||||
additionalProperties: false,
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
source: {
|
||||
type: "string",
|
||||
const: "file",
|
||||
},
|
||||
provider: {
|
||||
type: "string",
|
||||
pattern: "^[a-z][a-z0-9_-]{0,63}$",
|
||||
},
|
||||
id: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
required: ["source", "provider", "id"],
|
||||
additionalProperties: false,
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
source: {
|
||||
type: "string",
|
||||
const: "exec",
|
||||
},
|
||||
provider: {
|
||||
type: "string",
|
||||
pattern: "^[a-z][a-z0-9_-]{0,63}$",
|
||||
},
|
||||
id: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
required: ["source", "provider", "id"],
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
model: {
|
||||
type: "string",
|
||||
},
|
||||
maxTurns: {
|
||||
type: "integer",
|
||||
minimum: -9007199254740991,
|
||||
maximum: 9007199254740991,
|
||||
},
|
||||
timeoutSeconds: {
|
||||
type: "integer",
|
||||
exclusiveMinimum: 0,
|
||||
maximum: 9007199254740991,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
exec: {
|
||||
type: "object",
|
||||
properties: {
|
||||
@@ -13063,32 +12975,6 @@ export const GENERATED_BASE_CONFIG_SCHEMA = {
|
||||
help: "Cache TTL in minutes for x_search results.",
|
||||
tags: ["performance", "storage", "tools"],
|
||||
},
|
||||
"tools.code_execution.enabled": {
|
||||
label: "Enable Code Execution Tool",
|
||||
help: "Enable the code_execution tool (requires XAI_API_KEY or tools.code_execution.apiKey).",
|
||||
tags: ["tools"],
|
||||
},
|
||||
"tools.code_execution.apiKey": {
|
||||
label: "xAI API Key",
|
||||
help: "xAI API key for remote code execution (fallback: XAI_API_KEY env var).",
|
||||
tags: ["security", "auth", "tools"],
|
||||
sensitive: true,
|
||||
},
|
||||
"tools.code_execution.model": {
|
||||
label: "Code Execution Model",
|
||||
help: 'Model to use for remote code execution (default: "grok-4-1-fast").',
|
||||
tags: ["models", "tools"],
|
||||
},
|
||||
"tools.code_execution.maxTurns": {
|
||||
label: "Code Execution Max Turns",
|
||||
help: "Optional max internal tool turns xAI may use per code_execution request. Omit to let xAI choose.",
|
||||
tags: ["performance", "tools"],
|
||||
},
|
||||
"tools.code_execution.timeoutSeconds": {
|
||||
label: "Code Execution Timeout (sec)",
|
||||
help: "Timeout in seconds for code_execution requests.",
|
||||
tags: ["performance", "tools"],
|
||||
},
|
||||
"gateway.controlUi.basePath": {
|
||||
label: "Control UI Base Path",
|
||||
help: "Optional URL prefix where the Control UI is served (e.g. /openclaw).",
|
||||
|
||||
@@ -724,15 +724,6 @@ export const FIELD_HELP: Record<string, string> = {
|
||||
"Optional max internal search/tool turns xAI may use per x_search request. Omit to let xAI choose.",
|
||||
"tools.web.x_search.timeoutSeconds": "Timeout in seconds for x_search requests.",
|
||||
"tools.web.x_search.cacheTtlMinutes": "Cache TTL in minutes for x_search results.",
|
||||
"tools.code_execution.enabled":
|
||||
"Enable the code_execution tool (requires XAI_API_KEY or tools.code_execution.apiKey).",
|
||||
"tools.code_execution.apiKey":
|
||||
"xAI API key for remote code execution (fallback: XAI_API_KEY env var).",
|
||||
"tools.code_execution.model":
|
||||
'Model to use for remote code execution (default: "grok-4-1-fast").',
|
||||
"tools.code_execution.maxTurns":
|
||||
"Optional max internal tool turns xAI may use per code_execution request. Omit to let xAI choose.",
|
||||
"tools.code_execution.timeoutSeconds": "Timeout in seconds for code_execution requests.",
|
||||
models:
|
||||
"Model catalog root for provider definitions, merge/replace behavior, and optional Bedrock discovery integration. Keep provider definitions explicit and validated before relying on production failover paths.",
|
||||
"models.mode":
|
||||
|
||||
@@ -254,11 +254,6 @@ export const FIELD_LABELS: Record<string, string> = {
|
||||
"tools.web.x_search.maxTurns": "X Search Max Turns",
|
||||
"tools.web.x_search.timeoutSeconds": "X Search Timeout (sec)",
|
||||
"tools.web.x_search.cacheTtlMinutes": "X Search Cache TTL (min)",
|
||||
"tools.code_execution.enabled": "Enable Code Execution Tool",
|
||||
"tools.code_execution.apiKey": "xAI API Key", // pragma: allowlist secret
|
||||
"tools.code_execution.model": "Code Execution Model",
|
||||
"tools.code_execution.maxTurns": "Code Execution Max Turns",
|
||||
"tools.code_execution.timeoutSeconds": "Code Execution Timeout (sec)",
|
||||
"gateway.controlUi.basePath": "Control UI Base Path",
|
||||
"gateway.controlUi.root": "Control UI Assets Root",
|
||||
"gateway.controlUi.allowedOrigins": "Control UI Allowed Origins",
|
||||
|
||||
@@ -476,19 +476,6 @@ type XSearchToolConfig = {
|
||||
cacheTtlMinutes?: number;
|
||||
};
|
||||
|
||||
type CodeExecutionToolConfig = {
|
||||
/** Enable remote xAI code execution (default: true when an xAI API key is available). */
|
||||
enabled?: boolean;
|
||||
/** API key for xAI (defaults to XAI_API_KEY env var). Supports SecretRef. */
|
||||
apiKey?: SecretInput;
|
||||
/** Model id to use for remote code execution. */
|
||||
model?: string;
|
||||
/** Optional max internal tool turns for xAI to use. */
|
||||
maxTurns?: number;
|
||||
/** Timeout in seconds for code execution requests. */
|
||||
timeoutSeconds?: number;
|
||||
};
|
||||
|
||||
export type ToolsConfig = {
|
||||
/** Base tool profile applied before allow/deny lists. */
|
||||
profile?: ToolProfileId;
|
||||
@@ -498,8 +485,6 @@ export type ToolsConfig = {
|
||||
deny?: string[];
|
||||
/** Optional tool policy overrides keyed by provider id or "provider/model". */
|
||||
byProvider?: Record<string, ToolPolicyConfig>;
|
||||
/** Remote xAI sandboxed code execution. */
|
||||
code_execution?: CodeExecutionToolConfig;
|
||||
web?: {
|
||||
search?: {
|
||||
/** Enable web search tool (default: true when API key is present). */
|
||||
|
||||
@@ -361,17 +361,6 @@ export const ToolsWebXSearchSchema = z
|
||||
.strict()
|
||||
.optional();
|
||||
|
||||
export const ToolCodeExecutionSchema = z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
apiKey: SecretInputSchema.optional().register(sensitive),
|
||||
model: z.string().optional(),
|
||||
maxTurns: z.number().int().optional(),
|
||||
timeoutSeconds: z.number().int().positive().optional(),
|
||||
})
|
||||
.strict()
|
||||
.optional();
|
||||
|
||||
export const ToolsWebSchema = z
|
||||
.object({
|
||||
search: ToolsWebSearchSchema,
|
||||
@@ -865,7 +854,6 @@ export const ToolsSchema = z
|
||||
})
|
||||
.strict()
|
||||
.optional(),
|
||||
code_execution: ToolCodeExecutionSchema,
|
||||
exec: ToolExecSchema,
|
||||
fs: ToolFsSchema,
|
||||
subagents: z
|
||||
|
||||
Reference in New Issue
Block a user