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.
54 lines
2.0 KiB
TypeScript
54 lines
2.0 KiB
TypeScript
import userAuth from "@/src/functions/backend/auth/user-auth";
|
|
import { AdminHomePath } from "@/src/dict/admin-sections-dict";
|
|
import grabUsers from "@/src/functions/backend/db/users/grab-users";
|
|
import sanitizeUserBio from "@/src/functions/backend/db/users/sanitize-user-bio";
|
|
import grabUserPasswordHash from "@/src/functions/backend/auth/grab-user-password-hash";
|
|
import type { PagePropsType } from "@/src/types";
|
|
import type { BunextPageServerFn } from "@moduletrace/bunext/types";
|
|
import grabRunLimitsOverview from "@/src/functions/backend/db/app-settings/grab-run-limits";
|
|
import grabStorageQuotaOverview from "@/src/functions/backend/db/app-settings/grab-storage-quota-overview";
|
|
import { grabSystemPromptAppendOverview } from "@/src/functions/backend/db/app-settings/grab-system-prompt-append";
|
|
import runningVersion from "@/src/utils/running-version";
|
|
|
|
type Params = Parameters<BunextPageServerFn<PagePropsType>>[0];
|
|
|
|
/**
|
|
* Shared server props for the `/admin/settings` sub-pages.
|
|
*/
|
|
export default async function grabSettingsServerProps({ req }: Params) {
|
|
const { user } = await userAuth({ req });
|
|
|
|
if (!user?.id) {
|
|
return {
|
|
redirect: {
|
|
destination: "/auth/login",
|
|
},
|
|
};
|
|
}
|
|
|
|
const user_res = await grabUsers({ user_id: user.id });
|
|
|
|
if (!user_res.singleRes) {
|
|
return {
|
|
redirect: {
|
|
destination: AdminHomePath,
|
|
},
|
|
};
|
|
}
|
|
|
|
const has_password = Boolean(
|
|
await grabUserPasswordHash({ user_id: user.id }),
|
|
);
|
|
|
|
return {
|
|
props: {
|
|
person: sanitizeUserBio({ user: user_res.singleRes }),
|
|
has_password,
|
|
storage_quota: await grabStorageQuotaOverview().catch(() => null),
|
|
system_prompt_append: await grabSystemPromptAppendOverview().catch(() => null),
|
|
run_limits: await grabRunLimitsOverview().catch(() => null),
|
|
running_version: runningVersion({ env: process.env }),
|
|
},
|
|
};
|
|
}
|