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:
Thomas authored and GitHub committed 2026-08-30 23:43:29 +02:00
1 parent 38f4b0e1f8
commit 5e23659d99
95 files changed
+6799 -1778

No files matched your search

@@ -17,6 +17,8 @@ interface AnalyzerJsxContext {
visitArrow(node: AstNode, depth: number, bindings: ReadonlySet<string>): void;
}
const componentsRequiringLiteralRequestId = new Set(["SubFetch", "ActionButton", "ToggleSwitch"]);
export function analyzeCustomJsxElement(
node: AstNode,
depth: number,
@@ -33,6 +35,17 @@ export function analyzeCustomJsxElement(
const resolvedName = name ? resolveCustomJsxComponentName(name) : null;
const descriptor = resolvedName ? customJsxComponentByName.get(resolvedName) : undefined;
const attributes = nodesOf(opening.attributes);
if (resolvedName && componentsRequiringLiteralRequestId.has(resolvedName)) {
const requestIdAttribute = attributes.find((attribute) => {
if (attribute.type !== "JSXAttribute") return false;
const attributeName = nodeOf(attribute.name);
return attributeName?.type === "JSXIdentifier" && attributeName.name === "requestId";
});
const requestIdValue = requestIdAttribute ? nodeOf(requestIdAttribute.value) : null;
if (requestIdValue?.type !== "Literal" || typeof requestIdValue.value !== "string" || !requestIdValue.value) {
context.add(requestIdAttribute ?? opening, `${resolvedName} must use a literal requestId`);
}
}
if (resolvedName === "TablerIcon") {
const attributeNames = new Set<string>();
for (const attribute of attributes) {
@@ -136,6 +149,10 @@ function analyzeAttributeValue(
const reason = getInvalidCustomJsxPropValueReason(componentName, attributeName, literalValue.value);
if (reason) context.add(attribute, `INVALID_PROP_VALUE: ${reason}`);
}
const expression = value?.type === "JSXExpressionContainer" ? nodeOf(value.expression) : null;
if (attributeName === "resetKey" && ["ArrayExpression", "ObjectExpression"].includes(expression?.type ?? "")) {
context.add(attribute, "INVALID_PROP_VALUE: resetKey must resolve to a finite number, string, boolean, or null");
}
if (
CUSTOM_JSX_URL_PROPS.has(attributeName) &&
value?.type === "Literal" &&
@@ -145,7 +162,6 @@ function analyzeAttributeValue(
context.add(attribute, `INVALID_PROP_VALUE: '${attributeName}' contains an unsafe URL`);
}
if (value?.type !== "JSXExpressionContainer") return;
const expression = nodeOf(value.expression);
if (expression && containsEscapingCallback(expression)) {
context.add(attribute, `BLOCKED_CAPABILITY: Callback prop '${attributeName}' is not allowed`);
} else if (expression && expression.type !== "JSXEmptyExpression") {