feat(web): add configurable cron command execution settings (#1647)

- add tools.cron.allow_command config with a default value of true
- require command_confirm only when cron command execution is disabled
- expose cron command permission and timeout settings in the config UI
- add backend tests and update i18n strings
This commit is contained in:
wenjie
2026-03-17 09:44:32 +08:00
committed by GitHub
parent be4a33cc15
commit fcb69860c4
10 changed files with 174 additions and 21 deletions
@@ -4,6 +4,8 @@ export interface CoreConfigForm {
workspace: string
restrictToWorkspace: boolean
allowRemote: boolean
allowCommand: boolean
cronExecTimeoutMinutes: string
maxTokens: string
maxToolIterations: string
summarizeMessageThreshold: string
@@ -56,6 +58,8 @@ export const EMPTY_FORM: CoreConfigForm = {
workspace: "",
restrictToWorkspace: true,
allowRemote: true,
allowCommand: true,
cronExecTimeoutMinutes: "5",
maxTokens: "32768",
maxToolIterations: "50",
summarizeMessageThreshold: "20",
@@ -106,6 +110,7 @@ export function buildFormFromConfig(config: unknown): CoreConfigForm {
const heartbeat = asRecord(root.heartbeat)
const devices = asRecord(root.devices)
const tools = asRecord(root.tools)
const cron = asRecord(tools.cron)
const exec = asRecord(tools.exec)
return {
@@ -118,6 +123,14 @@ export function buildFormFromConfig(config: unknown): CoreConfigForm {
exec.allow_remote === undefined
? EMPTY_FORM.allowRemote
: asBool(exec.allow_remote),
allowCommand:
cron.allow_command === undefined
? EMPTY_FORM.allowCommand
: asBool(cron.allow_command),
cronExecTimeoutMinutes: asNumberString(
cron.exec_timeout_minutes,
EMPTY_FORM.cronExecTimeoutMinutes,
),
maxTokens: asNumberString(defaults.max_tokens, EMPTY_FORM.maxTokens),
maxToolIterations: asNumberString(
defaults.max_tool_iterations,