refactor: unify tool reason requirements
This commit is contained in:
@@ -9,19 +9,23 @@ import { type SkillStore } from "../skills/store.js";
|
||||
const memoryInput = z.object({
|
||||
action: z.enum(["add", "list", "replace", "remove"]),
|
||||
scope: z.string().max(32),
|
||||
reason: z.string().max(2000).optional(),
|
||||
reason: z.string().trim().min(1).max(2000).optional(),
|
||||
content: z.string().max(20000).optional(),
|
||||
target_id: z.string().max(128).optional(),
|
||||
}).strict();
|
||||
}).strict().refine((input) => input.action === "list" || Boolean(input.reason), {
|
||||
path: ["reason"], message: "reason is required for writes, updates and removals",
|
||||
});
|
||||
const skillInput = z.object({
|
||||
action: z.enum(["list", "write_skill", "remove_skill", "append_pattern", "remove_pattern", "write_reference", "remove_reference", "write_script", "remove_script"]),
|
||||
skill_path: z.string().max(512),
|
||||
reason: z.string().max(2000).optional(),
|
||||
reason: z.string().trim().min(1).max(2000).optional(),
|
||||
content: z.string().max(200000).optional(),
|
||||
file_path: z.string().max(512).optional(),
|
||||
pattern: z.string().max(20000).optional(),
|
||||
target_id: z.string().max(128).optional(),
|
||||
}).strict();
|
||||
}).strict().refine((input) => input.action === "list" || Boolean(input.reason), {
|
||||
path: ["reason"], message: "reason is required for writes, updates and removals",
|
||||
});
|
||||
|
||||
export const registerLearningToolBridge = (app: Express, options: {
|
||||
internalToken: string;
|
||||
|
||||
Reference in New Issue
Block a user