The longest runbook a skill may save and how much of it load_skill hands back are now set on Settings > General (skill_body_max_chars, skill_body_shown_chars), defaulting to AppData.SkillBodyMaxChars and SkillBodyShownChars. Saving, confirming and proposing a skill check the install's limit; a skill saved before it was lowered can still be toggled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
21 lines
651 B
TypeScript
21 lines
651 B
TypeScript
import { grabSkillBodyMaxChars } from "../app-settings/grab-skill-limits";
|
|
import AppError from "@/src/utils/app-error";
|
|
|
|
type Params = {
|
|
body: string;
|
|
};
|
|
|
|
/**
|
|
* Refuses a runbook longer than the install's limit (Settings > General).
|
|
* The request schemas only hold the ceiling, since the limit is a setting.
|
|
*/
|
|
export default async function assertSkillBodyFits({ body }: Params) {
|
|
const max = await grabSkillBodyMaxChars();
|
|
|
|
if (body.length > max) {
|
|
throw new AppError(
|
|
`Keep the runbook under ${max} characters (it has ${body.length}). A super admin can raise the limit on Settings > General.`,
|
|
);
|
|
}
|
|
}
|