feat(core,web,cli): add file tools and per-tool call descriptions (#62)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei Zheng
2026-07-26 21:37:51 +08:00
committed by GitHub
parent 1e23452f48
commit abd5b13d52
43 changed files with 3449 additions and 181 deletions
+11
View File
@@ -187,6 +187,17 @@ export function optionalNumber(
return v;
}
export function optionalBoolean(
obj: Record<string, unknown>,
key: string,
label = key,
): boolean | undefined {
const v = obj[key];
if (v === undefined) return undefined;
if (typeof v !== "boolean") throw badRequest(`${label} must be a boolean.`);
return v;
}
/** Validate a yyyy-mm-dd query parameter (defaults to undefined). */
export function optionalDateParam(value: string | undefined, label: string): string | undefined {
if (value === undefined || value === "") return undefined;
@@ -35,7 +35,13 @@ import type {
VaultUpdateRequest,
} from "../api/types.js";
import { HttpError } from "../http/errors.js";
import { badRequest, optionalEnum, optionalNumber, optionalString } from "../http/validate.js";
import {
badRequest,
optionalBoolean,
optionalEnum,
optionalNumber,
optionalString,
} from "../http/validate.js";
import { maskApiKey } from "./project-config-service.js";
const THINKING_LEVELS: readonly ThinkingLevelName[] = ["none", "low", "medium", "high", "xhigh"];
@@ -328,6 +334,7 @@ function validateToolsBuiltin(value: unknown): ToolDefinitionConfig[] {
if (t.forModel !== undefined && t.forModel !== "vision" && t.forModel !== "text-only") {
throw badRequest(`toolsBuiltin[${i}].forModel must be one of vision / text-only.`);
}
optionalBoolean(t, "call_description", `toolsBuiltin[${i}].call_description`);
optionalNumber(t, "timeoutMs", {
integer: true,
positiveOrMinusOne: true,