feat(assistant): optimize MCP and custom widget authoring (#6743)
* feat(assistant): optimize MCP and custom widget authoring * fix(assistant): isolate server-safe JSX analyzer * refactor(assistant): generate MCP tool staging * fix(assistant): preserve widget placement follow-up * fix(ci): allow fast gate to finish * fix(custom-widgets): address review findings * fix(custom-widgets): split preview evidence module * style: format assistant custom widget files * fix(custom-widgets): sync formatted skill schema
This commit is contained in:
1 parent
38f4b0e1f8
commit
5e23659d99
95 files changed
+6799
-1778
No files matched your search
@@ -0,0 +1,22 @@
|
||||
const compactTemplateToolNames = new Set(["customWidget_validateTemplate", "customWidget_previewReviseTemplate"]);
|
||||
|
||||
const asRecord = (value: unknown): Record<string, unknown> | null =>
|
||||
typeof value === "object" && value !== null && !Array.isArray(value) ? (value as Record<string, unknown>) : null;
|
||||
|
||||
export const getAssistantToolInputSchema = (toolName: string, inputSchema: Record<string, unknown>) => {
|
||||
if (!compactTemplateToolNames.has(toolName)) return inputSchema;
|
||||
const properties = asRecord(inputSchema.properties);
|
||||
if (!properties?.templateLines) return inputSchema;
|
||||
|
||||
const omittedProperties = new Set(["template"]);
|
||||
if (toolName === "customWidget_previewReviseTemplate") omittedProperties.add("expectedRevision");
|
||||
|
||||
const required = Array.isArray(inputSchema.required)
|
||||
? inputSchema.required.filter((name): name is string => typeof name === "string" && !omittedProperties.has(name))
|
||||
: [];
|
||||
return {
|
||||
...inputSchema,
|
||||
properties: Object.fromEntries(Object.entries(properties).filter(([name]) => !omittedProperties.has(name))),
|
||||
required: [...new Set([...required, "templateLines"])],
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user