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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user