fix(ai): corrected AI tool handling via JSON-schema validation flow

- Replaced fromTypeBox conversion with a JSON-schema validator flow in ai tool handling and execution paths.
- Added recursive schema validation and expanded TypeBox checks for refs, enums, uniqueItems, and constraint keywords.
- Sanitized Azure/CCA tool schemas by dropping unsupported fields and rewriting oneOf tool branches as anyOf.
- Tightened argument and model-config validation, preserving unknown tool fields and adding apiKey plus compatibility flags.
This commit is contained in:
can1357
2026-05-15 15:16:50 +02:00
parent 2867e1f4e3
commit 45fe4df39e
25 changed files with 1025 additions and 232 deletions
+12 -14
View File
@@ -20,20 +20,18 @@ const changelogCategoryLiteral = z.enum([
* are identical across phases — only the surrounding tool `description`
* differs to reflect the input the phase is summarizing.
*/
export const conventionalAnalysisParameters = z
.object({
type: z.enum(["feat", "fix", "refactor", "docs", "test", "chore", "style", "perf", "build", "ci", "revert"]),
scope: z.union([z.string(), z.null()]),
details: z.array(
z.object({
text: z.string(),
changelog_category: changelogCategoryLiteral.optional(),
user_visible: z.boolean().optional(),
}),
),
issue_refs: z.array(z.string()),
})
.strict();
export const conventionalAnalysisParameters = z.object({
type: z.enum(["feat", "fix", "refactor", "docs", "test", "chore", "style", "perf", "build", "ci", "revert"]),
scope: z.union([z.string(), z.null()]),
details: z.array(
z.object({
text: z.string(),
changelog_category: changelogCategoryLiteral.optional(),
user_visible: z.boolean().optional(),
}),
),
issue_refs: z.array(z.string()),
});
export interface ConventionalAnalysisTool {
name: "create_conventional_analysis";