Let the install set how many steps a run may take

The two limits were compiled in: a task run stopped at
AppData.HarnessMaxToolSteps (200) and a chat reply at
AppData.BotReplyMaxToolSteps (8), so an install that needed a longer task
had to rebuild.

Both are now `app_settings` rows (`harness_max_tool_steps` and
`bot_reply_max_tool_steps`), read at the two loop call sites through
grabHarnessMaxToolSteps and grabReplyMaxToolSteps, and edited by the super
admin on Settings > General beside the prompt appendix. Zero clears a
limit back to the code default, like the bot file quota.

readStepLimit keeps the saved number only when it is a whole number of at
least 1 and no more than AppData.BotStepLimitMax (1000), so a blank, a
zero or a typo falls back instead of stopping every run before its first
turn, and a huge number still ends in the wrap-up report.

runTextLoop keeps AppData.HarnessMaxToolSteps as its default, so it stays
free of database reads and its tests run as they did.
This commit is contained in:
2026-10-23 16:20:38 +01:00
parent 06586a6dc8
commit 024d847b9a
16 changed files with 420 additions and 5 deletions
+12
View File
@@ -1,4 +1,5 @@
import { z } from "zod";
import { AppData } from "@/src/data/app-data";
import { Harnesses, type HarnessKind } from "@/src/dict/harness-dict";
import {
HarnessProviderKinds,
@@ -96,6 +97,17 @@ export type SaveBotHarnessSettingsRequest = z.infer<
typeof SaveBotHarnessSettingsRequestSchema
>;
/**
* The General settings' run limits: model turns a task run and a chat reply
* may take. Zero puts the code's default back.
*/
export const SaveRunLimitsRequestSchema = z.object({
task_steps: z.coerce.number().int().min(0).max(AppData.BotStepLimitMax),
reply_steps: z.coerce.number().int().min(0).max(AppData.BotStepLimitMax),
});
export type SaveRunLimitsRequest = z.infer<typeof SaveRunLimitsRequestSchema>;
export const PreviewVoiceRequestSchema = z.object({
model_id: z.coerce.number().int().positive("Pick a speech model"),
voice: z.string().trim().max(200).optional(),