Q24: knowledge enters the run: search and record tools, relevant entries in prompts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 05:20:03 -04:00
1 parent 0fea8a9159
commit 95e607bea7
12 files changed
+236 -31

No files matched your search

+16
View File
@@ -14,3 +14,19 @@ export function optionalStringArray(value: unknown, field: string): string[] {
if (!Array.isArray(value)) throw new Error(`"${field}" must be an array.`);
return value.map((item, index) => requireString(item, `${field}[${index}]`));
}
/** Omitted means the default; anything supplied must be a whole number from 1 to max. */
export function optionalLimit(value: unknown, field: string, fallback: number, max: number): number {
if (value === undefined) return fallback;
if (typeof value !== "number" || !Number.isInteger(value) || value < 1 || value > max) {
throw new Error(`"${field}" must be a whole number from 1 to ${max}.`);
}
return value;
}
/** Omitted means the default; anything supplied must be one of the allowed values. */
export function optionalEnum(value: unknown, field: string, allowed: readonly string[], fallback: string): string {
if (value === undefined) return fallback;
if (typeof value !== "string" || !allowed.includes(value)) throw new Error(`"${field}" must be one of: ${allowed.join(", ")}.`);
return value;
}