{
  "type": "widget-builder",
  "description": "Builds and renders a widget from a param-supplied or inline definition object.",
  "hasChildren": false,
  "propsSchema": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "properties": {
      "defaultValue": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        ],
        "description": "Widget definition to render. Use \"$param_name\" to read from a canvas param, or provide a literal { type, props } object."
      },
      "showEditor": {
        "default": true,
        "description": "Show a collapsible JSON editor panel for inspecting/editing the widget definition.",
        "type": "boolean"
      },
      "editorCollapsed": {
        "default": true,
        "description": "Whether the editor panel starts collapsed.",
        "type": "boolean"
      },
      "editorHeight": {
        "description": "Optional initial height in pixels. If omitted, height auto-fits JSON line count.",
        "type": "number"
      },
      "style": {
        "description": "Inline CSS styles as a plain CSS string (e.g., \"padding: 8px\")",
        "type": "string"
      },
      "aiBuilderMode": {
        "default": true,
        "description": "Whether the AI widget builder is active. When true, shows the AI panel. AI actions require authentication.",
        "type": "boolean"
      },
      "aiModel": {
        "default": "Claude Sonnet 4.6",
        "description": "AI model used by the widget builder. Defaults to Claude Sonnet.",
        "type": "string",
        "enum": [
          "Claude Opus 4.6",
          "Claude Sonnet 4.6",
          "Claude Haiku 4.5",
          "GLM 4.7",
          "GPT OSS 120B",
          "Kimi K2.5",
          "GPT-5.4",
          "GPT-5.5",
          "Gemini 3.5 Flash",
          "Gemini 3 Flash Preview",
          "Gemini 3 Pro Preview"
        ]
      },
      "aiPanel": {
        "default": "right",
        "description": "Position of the AI panel when aiBuilderMode is true. 'top'/'bottom' show a compact input bar above/below the widget. 'left'/'right' show a full chat panel as a side column.",
        "type": "string",
        "enum": [
          "top",
          "bottom",
          "left",
          "right"
        ]
      },
      "allowedWidgetTypes": {
        "default": "all",
        "description": "Comma-separated list of widget types that may be rendered (e.g. \"div,text,text-input\"). Use \"all\" to allow every type.",
        "type": "string"
      },
      "initialPrompt": {
        "description": "When set and aiBuilderMode is true, this prompt is automatically submitted to the AI on first load.",
        "type": "string"
      }
    },
    "required": [
      "defaultValue"
    ],
    "description": "Renders a widget definition received via a canvas param or inline. Use \"$param_name\" to render whatever a dropdown (or other sender) broadcasts. Set showEditor to enable a live JSON editor panel."
  }
}
