{
  "formatVersion": 1,
  "kind": "mini-container.agent-generation-pack",
  "sdkContextVersion": 1,
  "purpose": "Give an AI Agent one stable contract for generating, repairing, validating, and packaging a mini app.",
  "context": {
    "formatVersion": 1,
    "purpose": "Generate a mini app module that can be validated, tested, and packaged by this SDK.",
    "generationContract": {
      "module": "ES module",
      "exportName": "default",
      "imports": [
        "defineMiniApp",
        "definePage"
      ],
      "requiredManifestFields": [
        "appId",
        "version",
        "name",
        "pages"
      ],
      "recommendedManifestFields": [
        "description",
        "generatedBy",
        "theme",
        "capabilitiesUsed",
        "apisUsed",
        "permissions",
        "tests"
      ],
      "projectLayout": {
        "recommended": "Use a source-first, WeChat-style SDK project layout for maintainable apps.",
        "sourceFiles": [
          "miniapp.json for build defaults such as app, entryOut, manifestOut, exportName, and out",
          "package.json with type=module when using ESM imports",
          "app.js as the source entry that calls defineMiniApp(...) and imports pages/tests",
          "pages/<route>.js for page definitions",
          "tests/*.test.js for executable manifest tests"
        ],
        "generatedFiles": [
          "build/dist/manifest.json",
          "build/dist/app-service.js",
          "build/dist/<app-id>-<version>.zip"
        ],
        "rule": "Do not hand-edit generated app-service.js or generated manifest.json. Regenerate them with the SDK archive builder after changing source files."
      },
      "pageModel": {
        "template": "Standard mini component markup with {{data}} interpolation and supported bind* handlers.",
        "data": "JSON-compatible initial page state.",
        "methods": "Use this only for the current page instance, such as this.data and this.setData. Official APIs and navigation use the injected ac namespace, such as ac.request and ac.navigateTo."
      }
    },
    "components": [
      {
        "name": "view",
        "htmlTag": "div",
        "className": "mini-view",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [
          "bindtap",
          "bindtouchstart",
          "bindtouchmove",
          "bindtouchend"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Generic layout container.",
        "example": "<view class=\"section\"><text>{{title}}</text></view>"
      },
      {
        "name": "text",
        "htmlTag": "span",
        "className": "mini-text",
        "void": false,
        "componentKind": "content",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Inline text content.",
        "example": "<text>{{label}}</text>"
      },
      {
        "name": "button",
        "htmlTag": "button",
        "className": "mini-button",
        "void": false,
        "componentKind": "action",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "type",
          "disabled",
          "form-type",
          "loading",
          "plain",
          "size"
        ],
        "events": [
          "bindtap",
          "bindsubmit"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "User action button.",
        "example": "<button bindtap=\"save\">Save</button>"
      },
      {
        "name": "input",
        "htmlTag": "input",
        "className": "mini-input",
        "void": true,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "name",
          "value",
          "type",
          "placeholder",
          "disabled",
          "maxlength",
          "password",
          "confirm-type",
          "confirm-hold",
          "cursor",
          "selection-start",
          "selection-end",
          "focus"
        ],
        "events": [
          "bindinput",
          "bindchange",
          "bindconfirm",
          "bindfocus",
          "bindblur"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Single-line text input.",
        "example": "<input name=\"title\" value=\"{{title}}\" bindinput=\"onInput\" />"
      },
      {
        "name": "textarea",
        "htmlTag": "textarea",
        "className": "mini-textarea",
        "void": false,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "name",
          "value",
          "placeholder",
          "disabled",
          "maxlength",
          "auto-height",
          "fixed",
          "show-confirm-bar",
          "cursor-spacing",
          "cursor",
          "selection-start",
          "selection-end",
          "focus"
        ],
        "events": [
          "bindinput",
          "bindchange",
          "bindconfirm",
          "bindfocus",
          "bindblur"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Multi-line text input.",
        "example": "<textarea name=\"notes\" bindinput=\"onInput\">{{notes}}</textarea>"
      },
      {
        "name": "code-editor",
        "htmlTag": "textarea",
        "className": "mini-code-editor",
        "void": false,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": "code-editor",
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "editor-id",
          "name",
          "value",
          "language",
          "placeholder",
          "disabled",
          "readonly",
          "maxlength",
          "line-numbers",
          "cursor",
          "selection-start",
          "selection-end",
          "focus",
          "wrap"
        ],
        "events": [
          "bindinput",
          "bindchange",
          "bindconfirm",
          "bindfocus",
          "bindblur",
          "bindscroll",
          "bindselectionchange",
          "bindkeydown"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Code editing surface for DSLs such as Mermaid, with normalized input and selection events.",
        "example": "<code-editor editor-id=\"diagramCode\" language=\"mermaid\" value=\"{{code}}\" bindinput=\"onCodeInput\" />"
      },
      {
        "name": "image",
        "htmlTag": "img",
        "className": "mini-image",
        "void": true,
        "componentKind": "media",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "src",
          "alt",
          "mode"
        ],
        "events": [
          "bindtap",
          "bindload",
          "binderror"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Image resource rendered by the container.",
        "example": "<image src=\"assets/icon.png\" mode=\"aspectFit\" />"
      },
      {
        "name": "scroll-view",
        "htmlTag": "div",
        "className": "mini-scroll-view",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "scroll-x",
          "scroll-y",
          "scroll-top",
          "scroll-left",
          "scroll-into-view",
          "upper-threshold",
          "lower-threshold",
          "enable-back-to-top",
          "show-scrollbar"
        ],
        "events": [
          "bindtap",
          "bindscroll",
          "bindscrolltoupper",
          "bindscrolltolower"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Scrollable content region.",
        "example": "<scroll-view scroll-y=\"true\"><view mini:for=\"{{items}}\">{{item}}</view></scroll-view>"
      },
      {
        "name": "form",
        "htmlTag": "form",
        "className": "mini-form",
        "void": false,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [
          "bindsubmit"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Collect child control values into event.detail.value.",
        "example": "<form bindsubmit=\"submit\"><input name=\"title\" /></form>"
      },
      {
        "name": "card",
        "htmlTag": "section",
        "className": "mini-card",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "list",
        "htmlTag": "div",
        "className": "mini-list",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "list-item",
        "htmlTag": "div",
        "className": "mini-list-item",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "tabs",
        "htmlTag": "div",
        "className": "mini-tabs",
        "void": false,
        "componentKind": "navigation",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "current"
        ],
        "events": [
          "bindchange"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "tab",
        "htmlTag": "button",
        "className": "mini-tab",
        "void": false,
        "componentKind": "navigation",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "value"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "modal",
        "htmlTag": "section",
        "className": "mini-modal",
        "void": false,
        "componentKind": "feedback",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "show",
          "title"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "toast",
        "htmlTag": "div",
        "className": "mini-toast",
        "void": false,
        "componentKind": "feedback",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "empty",
        "htmlTag": "section",
        "className": "mini-empty",
        "void": false,
        "componentKind": "feedback",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "loading",
        "htmlTag": "div",
        "className": "mini-loading",
        "void": false,
        "componentKind": "feedback",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "navbar",
        "htmlTag": "header",
        "className": "mini-navbar",
        "void": false,
        "componentKind": "navigation",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "title"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "safe-area",
        "htmlTag": "div",
        "className": "mini-safe-area",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "icon",
        "htmlTag": "span",
        "className": "mini-icon",
        "void": false,
        "componentKind": "content",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "type",
          "size",
          "color"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Small semantic icon marker.",
        "example": "<icon type=\"success\" size=\"20\" />"
      },
      {
        "name": "rich-text",
        "htmlTag": "div",
        "className": "mini-rich-text",
        "void": false,
        "componentKind": "content",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "nodes"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Render sanitized rich text from a string or node array.",
        "example": "<rich-text nodes=\"{{contentHtml}}\" />"
      },
      {
        "name": "diagram-view",
        "htmlTag": "section",
        "className": "mini-diagram-view",
        "void": false,
        "componentKind": "capability",
        "requiresPermission": [],
        "nativeCapability": "diagram",
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "diagram-id",
          "code",
          "svg",
          "scale",
          "x",
          "y",
          "background",
          "fit",
          "aria-label"
        ],
        "events": [
          "bindtap",
          "bindtouchstart",
          "bindtouchmove",
          "bindtouchend",
          "bindpointerdown",
          "bindpointermove",
          "bindpointerup",
          "bindwheel",
          "bindcontextmenu"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Safe SVG diagram preview surface for Mermaid or other diagram renderers; use ac.renderMermaid to convert code to svg.",
        "example": "<diagram-view diagram-id=\"preview\" svg=\"{{diagramSvg}}\" bindwheel=\"onZoom\" />"
      },
      {
        "name": "progress",
        "htmlTag": "progress",
        "className": "mini-progress",
        "void": false,
        "componentKind": "feedback",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "percent",
          "show-info",
          "stroke-width",
          "border-radius",
          "activeColor",
          "active-color",
          "color",
          "backgroundColor",
          "background-color",
          "active"
        ],
        "events": [],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Progress value clamped to 0..100.",
        "example": "<progress percent=\"{{donePercent}}\" />"
      },
      {
        "name": "checkbox",
        "htmlTag": "input",
        "className": "mini-checkbox",
        "void": true,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "name",
          "value",
          "checked",
          "disabled"
        ],
        "events": [
          "bindchange"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Boolean or group checkbox value.",
        "example": "<checkbox name=\"done\" value=\"yes\" checked=\"{{done}}\" bindchange=\"toggle\" />"
      },
      {
        "name": "checkbox-group",
        "htmlTag": "div",
        "className": "mini-checkbox-group",
        "void": false,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "name"
        ],
        "events": [
          "bindchange"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Group checkbox values into an array.",
        "example": "<checkbox-group name=\"tags\" bindchange=\"onTags\"><checkbox value=\"a\" /></checkbox-group>"
      },
      {
        "name": "radio",
        "htmlTag": "input",
        "className": "mini-radio",
        "void": true,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "name",
          "value",
          "checked",
          "disabled"
        ],
        "events": [
          "bindchange"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Single radio option.",
        "example": "<radio name=\"priority\" value=\"high\" bindchange=\"choose\" />"
      },
      {
        "name": "radio-group",
        "htmlTag": "div",
        "className": "mini-radio-group",
        "void": false,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "name"
        ],
        "events": [
          "bindchange"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Group radio values into a single value.",
        "example": "<radio-group name=\"priority\" bindchange=\"onPriority\"><radio value=\"high\" /></radio-group>"
      },
      {
        "name": "switch",
        "htmlTag": "input",
        "className": "mini-switch",
        "void": true,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "name",
          "checked",
          "disabled",
          "color"
        ],
        "events": [
          "bindchange"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Boolean switch control.",
        "example": "<switch name=\"enabled\" checked=\"{{enabled}}\" bindchange=\"onSwitch\" />"
      },
      {
        "name": "slider",
        "htmlTag": "input",
        "className": "mini-slider",
        "void": true,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "name",
          "value",
          "min",
          "max",
          "step",
          "disabled"
        ],
        "events": [
          "bindchange"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Range slider with numeric event.detail.value.",
        "example": "<slider name=\"volume\" value=\"{{volume}}\" min=\"0\" max=\"100\" bindchange=\"onSlider\" />"
      },
      {
        "name": "picker",
        "htmlTag": "select",
        "className": "mini-picker",
        "void": false,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "name",
          "range",
          "range-key",
          "value",
          "disabled",
          "mode",
          "start",
          "end",
          "fields"
        ],
        "events": [
          "bindchange"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Single-column selector backed by range data.",
        "example": "<picker name=\"city\" range=\"{{cities}}\" value=\"{{cityIndex}}\" bindchange=\"onCity\" />"
      },
      {
        "name": "picker-view",
        "htmlTag": "div",
        "className": "mini-picker-view",
        "void": false,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "value",
          "indicator-style",
          "indicator-class",
          "mask-style",
          "mask-class"
        ],
        "events": [
          "bindchange",
          "bindpickstart",
          "bindpickend"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "picker-view-column",
        "htmlTag": "div",
        "className": "mini-picker-view-column",
        "void": false,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "label",
        "htmlTag": "label",
        "className": "mini-label",
        "void": false,
        "componentKind": "form",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "for"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "Label associated to a form control with for.",
        "example": "<label for=\"agree\"><checkbox id=\"agree\" name=\"agree\" /> Agree</label>"
      },
      {
        "name": "navigator",
        "htmlTag": "a",
        "className": "mini-navigator",
        "void": false,
        "componentKind": "navigation",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "url",
          "open-type",
          "delta",
          "target"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [
          "url"
        ],
        "requiredApis": [
          "ac.openExternal"
        ],
        "purpose": "Route navigation through the container navigation contract.",
        "example": "<navigator url=\"pages/detail?id={{id}}\" open-type=\"navigate\">Open</navigator>"
      },
      {
        "name": "swiper",
        "htmlTag": "div",
        "className": "mini-swiper",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "current",
          "current-item-id",
          "autoplay",
          "interval",
          "duration",
          "circular",
          "indicator-dots",
          "indicator-color",
          "indicator-active-color",
          "vertical",
          "disable-touch"
        ],
        "events": [
          "bindchange"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "swiper-item",
        "htmlTag": "div",
        "className": "mini-swiper-item",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "item-id"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "page-container",
        "htmlTag": "section",
        "className": "mini-page-container",
        "void": false,
        "componentKind": "overlay",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "show",
          "duration",
          "position",
          "round",
          "overlay",
          "overlay-style",
          "custom-style",
          "z-index",
          "close-on-click-overlay"
        ],
        "events": [
          "bindtap",
          "bindbeforeenter",
          "bindenter",
          "bindafterenter",
          "bindbeforeleave",
          "bindleave",
          "bindafterleave"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "root-portal",
        "htmlTag": "section",
        "className": "mini-root-portal",
        "void": false,
        "componentKind": "overlay",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "cover-view",
        "htmlTag": "div",
        "className": "mini-cover-view",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*"
        ],
        "events": [
          "bindtap",
          "bindtouchstart",
          "bindtouchmove",
          "bindtouchend"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "cover-image",
        "htmlTag": "img",
        "className": "mini-cover-image",
        "void": true,
        "componentKind": "media",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "src",
          "alt"
        ],
        "events": [
          "bindtap",
          "bindload",
          "binderror"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "movable-area",
        "htmlTag": "div",
        "className": "mini-movable-area",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "scale-area"
        ],
        "events": [
          "bindtap"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "movable-view",
        "htmlTag": "div",
        "className": "mini-movable-view",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "x",
          "y",
          "direction",
          "disabled",
          "damping",
          "friction",
          "out-of-bounds"
        ],
        "events": [
          "bindtap",
          "bindchange",
          "bindtouchstart",
          "bindtouchmove",
          "bindtouchend"
        ],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "match-media",
        "htmlTag": "div",
        "className": "mini-match-media",
        "void": false,
        "componentKind": "layout",
        "requiresPermission": [],
        "nativeCapability": null,
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "min-width",
          "max-width",
          "width",
          "min-height",
          "max-height",
          "height",
          "orientation"
        ],
        "events": [],
        "requiredAttributes": [],
        "requiredApis": [],
        "purpose": "",
        "example": ""
      },
      {
        "name": "web-view",
        "htmlTag": "iframe",
        "className": "mini-web-view",
        "void": false,
        "componentKind": "capability",
        "requiresPermission": [
          "webview"
        ],
        "nativeCapability": "webview",
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "src",
          "title",
          "allow"
        ],
        "events": [
          "bindload",
          "binderror"
        ],
        "requiredAttributes": [
          "src"
        ],
        "requiredApis": [],
        "purpose": "Embeds an allowlisted HTTPS web page inside the mini app content area.",
        "example": "<web-view src=\"https://example.com\" />"
      },
      {
        "name": "canvas",
        "htmlTag": "canvas",
        "className": "mini-canvas",
        "void": false,
        "componentKind": "capability",
        "requiresPermission": [],
        "nativeCapability": "canvas",
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "canvas-id",
          "type",
          "width",
          "height"
        ],
        "events": [
          "bindtap",
          "bindtouchstart",
          "bindtouchmove",
          "bindtouchend"
        ],
        "requiredAttributes": [
          "canvas-id"
        ],
        "requiredApis": [
          "ac.drawCanvas"
        ],
        "purpose": "Drawable surface controlled through ac.drawCanvas and related host APIs.",
        "example": "<canvas canvas-id=\"chart\" width=\"300\" height=\"160\" />"
      },
      {
        "name": "video",
        "htmlTag": "video",
        "className": "mini-video",
        "void": false,
        "componentKind": "capability",
        "requiresPermission": [
          "media"
        ],
        "nativeCapability": "media",
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "id",
          "src",
          "controls",
          "autoplay",
          "loop",
          "muted",
          "poster"
        ],
        "events": [
          "bindplay",
          "bindpause",
          "bindended",
          "binderror",
          "bindload"
        ],
        "requiredAttributes": [
          "src"
        ],
        "requiredApis": [
          "ac.getMediaInfo"
        ],
        "purpose": "Video playback with ac.playMedia and related control APIs.",
        "example": "<video id=\"intro\" src=\"{{videoSrc}}\" controls bindplay=\"onPlay\" />"
      },
      {
        "name": "audio",
        "htmlTag": "audio",
        "className": "mini-audio",
        "void": false,
        "componentKind": "capability",
        "requiresPermission": [
          "media"
        ],
        "nativeCapability": "media",
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "id",
          "src",
          "controls",
          "autoplay",
          "loop",
          "muted"
        ],
        "events": [
          "bindplay",
          "bindpause",
          "bindended",
          "binderror",
          "bindload"
        ],
        "requiredAttributes": [
          "src"
        ],
        "requiredApis": [
          "ac.getMediaInfo"
        ],
        "purpose": "Audio playback with ac.playMedia and related control APIs.",
        "example": "<audio id=\"voice\" src=\"{{audioSrc}}\" controls />"
      },
      {
        "name": "camera",
        "htmlTag": "section",
        "className": "mini-camera",
        "void": false,
        "componentKind": "capability",
        "requiresPermission": [
          "camera"
        ],
        "nativeCapability": "camera",
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "device-position",
          "flash",
          "mode"
        ],
        "events": [
          "binderror",
          "bindload"
        ],
        "requiredAttributes": [],
        "requiredApis": [
          "ac.captureCamera"
        ],
        "purpose": "Camera preview placeholder backed by a host camera provider.",
        "example": "<camera device-position=\"back\" binderror=\"onCameraError\" />"
      },
      {
        "name": "map",
        "htmlTag": "section",
        "className": "mini-map",
        "void": false,
        "componentKind": "capability",
        "requiresPermission": [
          "location",
          "map"
        ],
        "nativeCapability": "map",
        "allowedAttributes": [
          "id",
          "class",
          "style",
          "hidden",
          "data-*",
          "latitude",
          "longitude",
          "scale",
          "markers",
          "polyline",
          "show-location"
        ],
        "events": [
          "bindregionchange",
          "bindmarkertap",
          "bindtap"
        ],
        "requiredAttributes": [
          "latitude",
          "longitude"
        ],
        "requiredApis": [
          "ac.getMapCenterLocation"
        ],
        "purpose": "Map placeholder backed by a host map provider.",
        "example": "<map latitude=\"{{lat}}\" longitude=\"{{lng}}\" scale=\"14\" bindregionchange=\"onRegion\" />"
      }
    ],
    "templateGrammar": {
      "interpolation": {
        "syntax": "{{path.to.value}}",
        "description": "Use double-brace interpolation for JSON-compatible page data and loop scope values.",
        "examples": [
          "{{title}}",
          "{{item.name}}",
          "{{index}}"
        ]
      },
      "directives": [
        {
          "name": "mini:if",
          "value": "{{booleanExpression}}",
          "description": "Conditionally render an element."
        },
        {
          "name": "mini:for",
          "value": "{{arrayPath}}",
          "description": "Repeat an element for every item in an array."
        },
        {
          "name": "mini:item",
          "value": "item",
          "description": "Optional loop item variable name for mini:for."
        },
        {
          "name": "mini:index",
          "value": "index",
          "description": "Optional loop index variable name for mini:for."
        }
      ],
      "events": [
        {
          "name": "bindtap",
          "domEvent": "click",
          "description": "Bind a tap/click event to a static page method name."
        },
        {
          "name": "bindinput",
          "domEvent": "input",
          "description": "Bind input changes to a static page method name with event.detail.value."
        },
        {
          "name": "bindchange",
          "domEvent": "change",
          "description": "Bind a change event to a static page method name."
        },
        {
          "name": "bindsubmit",
          "domEvent": "submit",
          "description": "Bind a submit event to a static page method name."
        },
        {
          "name": "bindconfirm",
          "domEvent": "keydown",
          "description": "Bind confirmation from input-like controls."
        },
        {
          "name": "bindscroll",
          "domEvent": "scroll",
          "description": "Bind scroll-view scroll events."
        },
        {
          "name": "bindselectionchange/bindkeydown",
          "domEvent": "select/keydown",
          "description": "Bind code-editor selection and keyboard events."
        },
        {
          "name": "bindwheel/bindcontextmenu/bindpointerdown/bindpointermove/bindpointerup",
          "domEvent": "pointer/wheel/contextmenu",
          "description": "Bind diagram and advanced pointer interactions for zoom, pan, and contextual tools."
        },
        {
          "name": "bindtouchstart/bindtouchmove/bindtouchend",
          "domEvent": "touch*",
          "description": "Bind touch lifecycle events for interactive surfaces such as canvas."
        },
        {
          "name": "bindplay/bindpause/bindended/binderror/bindload",
          "domEvent": "media/load/error",
          "description": "Bind media and load state events with normalized event.detail."
        },
        {
          "name": "bindregionchange/bindmarkertap",
          "domEvent": "map-provider",
          "description": "Bind map provider events when a host adapter implements map capability."
        }
      ],
      "dataAttributes": {
        "syntax": "data-name=\"{{value}}\"",
        "description": "Use data-* attributes to pass string dataset values into event.dataset."
      },
      "unsupportedPatterns": [
        {
          "pattern": "wx:*",
          "useInstead": "mini:if or mini:for"
        },
        {
          "pattern": "v-*",
          "useInstead": "mini:if or mini:for"
        },
        {
          "pattern": "@tap",
          "useInstead": "bindtap"
        },
        {
          "pattern": "onclick",
          "useInstead": "bindtap"
        },
        {
          "pattern": "bind:tap",
          "useInstead": "bindtap"
        },
        {
          "pattern": "bindtap=\"{{handler}}\"",
          "useInstead": "bindtap=\"handlerName\""
        }
      ]
    },
    "theme": {
      "default": {
        "color": "blue",
        "density": "comfortable",
        "radius": "md",
        "colorScheme": "auto"
      },
      "tokens": {
        "color": [
          "blue",
          "green",
          "orange",
          "neutral",
          "red"
        ],
        "density": [
          "compact",
          "comfortable"
        ],
        "radius": [
          "none",
          "sm",
          "md",
          "lg"
        ],
        "colorScheme": [
          "auto",
          "light",
          "dark"
        ]
      }
    },
    "apis": {
      "formatVersion": 1,
      "apis": {
        "ac.getStorage": {
          "name": "ac.getStorage",
          "description": "Read a value from host-scoped mini app storage.",
          "permission": null,
          "params": {
            "type": "object",
            "required": [
              "key"
            ],
            "properties": {
              "key": {
                "type": "string"
              }
            }
          },
          "returns": {
            "description": "Stored JSON-compatible value or null."
          },
          "errors": [],
          "examples": []
        },
        "ac.setStorage": {
          "name": "ac.setStorage",
          "description": "Write a JSON-compatible value to host-scoped mini app storage.",
          "permission": null,
          "params": {
            "type": "object",
            "required": [
              "key",
              "value"
            ],
            "properties": {
              "key": {
                "type": "string"
              },
              "value": {
                "description": "JSON-compatible value."
              }
            }
          },
          "returns": {
            "type": "boolean"
          },
          "errors": [],
          "examples": []
        },
        "ac.removeStorage": {
          "name": "ac.removeStorage",
          "description": "Remove a value from host-scoped mini app storage.",
          "permission": null,
          "params": {
            "type": "object",
            "required": [
              "key"
            ],
            "properties": {
              "key": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "boolean"
          },
          "errors": [],
          "examples": []
        },
        "ac.clearStorage": {
          "name": "ac.clearStorage",
          "description": "Clear host-scoped mini app storage.",
          "permission": null,
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "boolean"
          },
          "errors": [],
          "examples": []
        },
        "ac.getSystemInfo": {
          "name": "ac.getSystemInfo",
          "description": "Read basic host platform and user agent information.",
          "permission": null,
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object",
            "properties": {
              "platform": {
                "type": "string"
              },
              "userAgent": {
                "type": "string"
              }
            }
          },
          "errors": [],
          "examples": []
        },
        "ac.showToast": {
          "name": "ac.showToast",
          "description": "Show a short host toast message.",
          "permission": "ui",
          "params": {
            "type": "object",
            "required": [
              "title"
            ],
            "properties": {
              "title": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              }
            }
          },
          "errors": [],
          "examples": []
        },
        "ac.request": {
          "name": "ac.request",
          "description": "Send an HTTP request through the host network proxy.",
          "permission": "network",
          "params": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string"
              },
              "method": {
                "type": "string"
              },
              "data": {},
              "header": {
                "type": "object"
              },
              "timeout": {
                "type": "number"
              },
              "dataType": {
                "type": "string"
              },
              "responseType": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object",
            "properties": {
              "statusCode": {
                "type": "number"
              },
              "data": {},
              "header": {
                "type": "object"
              },
              "cookies": {
                "type": "array"
              }
            }
          },
          "errors": [],
          "examples": []
        },
        "ac.uploadFile": {
          "name": "ac.uploadFile",
          "description": "Upload a Blob or MiniKit virtual file through the host network proxy.",
          "permission": "network",
          "params": {
            "type": "object",
            "required": [
              "url",
              "name"
            ],
            "properties": {
              "url": {
                "type": "string"
              },
              "filePath": {
                "type": "string"
              },
              "file": {},
              "name": {
                "type": "string"
              },
              "formData": {
                "type": "object"
              },
              "header": {
                "type": "object"
              },
              "timeout": {
                "type": "number"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.downloadFile": {
          "name": "ac.downloadFile",
          "description": "Download a file through the host network proxy and store it as a temp:// file.",
          "permission": "network",
          "params": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string"
              },
              "header": {
                "type": "object"
              },
              "timeout": {
                "type": "number"
              }
            }
          },
          "returns": {
            "type": "object",
            "properties": {
              "statusCode": {
                "type": "number"
              },
              "tempFilePath": {
                "type": "string"
              },
              "header": {
                "type": "object"
              }
            }
          },
          "errors": [],
          "examples": []
        },
        "ac.hideToast": {
          "name": "ac.hideToast",
          "description": "Hide the current host toast.",
          "permission": "ui",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "boolean"
          },
          "errors": [],
          "examples": []
        },
        "ac.showLoading": {
          "name": "ac.showLoading",
          "description": "Show a host loading indicator.",
          "permission": "ui",
          "params": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "mask": {
                "type": "boolean"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.hideLoading": {
          "name": "ac.hideLoading",
          "description": "Hide the current host loading indicator.",
          "permission": "ui",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "boolean"
          },
          "errors": [],
          "examples": []
        },
        "ac.showModal": {
          "name": "ac.showModal",
          "description": "Show a host modal dialog.",
          "permission": "ui",
          "params": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "content": {
                "type": "string"
              },
              "showCancel": {
                "type": "boolean"
              },
              "cancelText": {
                "type": "string"
              },
              "confirmText": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.showActionSheet": {
          "name": "ac.showActionSheet",
          "description": "Show a host action sheet.",
          "permission": "ui",
          "params": {
            "type": "object",
            "required": [
              "itemList"
            ],
            "properties": {
              "itemList": {
                "type": "array"
              },
              "itemColor": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.setNavigationBarTitle": {
          "name": "ac.setNavigationBarTitle",
          "description": "Set the host navigation bar title.",
          "permission": "ui",
          "params": {
            "type": "object",
            "required": [
              "title"
            ],
            "properties": {
              "title": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "boolean"
          },
          "errors": [],
          "examples": []
        },
        "ac.setNavigationBarColor": {
          "name": "ac.setNavigationBarColor",
          "description": "Set the host navigation bar colors.",
          "permission": "ui",
          "params": {
            "type": "object",
            "properties": {
              "frontColor": {
                "type": "string"
              },
              "backgroundColor": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "boolean"
          },
          "errors": [],
          "examples": []
        },
        "ac.getSetting": {
          "name": "ac.getSetting",
          "description": "Read runtime authorization settings for declared permissions.",
          "permission": null,
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.authorize": {
          "name": "ac.authorize",
          "description": "Ask the host policy to authorize a declared permission.",
          "permission": null,
          "params": {
            "type": "object",
            "properties": {
              "permission": {
                "type": "string"
              },
              "scope": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.openSetting": {
          "name": "ac.openSetting",
          "description": "Open or read host permission settings.",
          "permission": null,
          "params": {
            "type": "object",
            "properties": {
              "permissions": {
                "type": "array"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.saveFile": {
          "name": "ac.saveFile",
          "description": "Persist a temp:// file, Blob, or dataUrl as a saved:// file.",
          "permission": "file",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.getFileInfo": {
          "name": "ac.getFileInfo",
          "description": "Read metadata and optional digest for a MiniKit virtual file.",
          "permission": "file",
          "params": {
            "type": "object",
            "required": [
              "filePath"
            ],
            "properties": {
              "filePath": {
                "type": "string"
              },
              "digestAlgorithm": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.getSavedFileList": {
          "name": "ac.getSavedFileList",
          "description": "List saved:// files in the MiniKit file registry.",
          "permission": "file",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.removeSavedFile": {
          "name": "ac.removeSavedFile",
          "description": "Remove a saved:// file.",
          "permission": "file",
          "params": {
            "type": "object",
            "required": [
              "filePath"
            ],
            "properties": {
              "filePath": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "boolean"
          },
          "errors": [],
          "examples": []
        },
        "ac.readFile": {
          "name": "ac.readFile",
          "description": "Read a temp:// or saved:// file.",
          "permission": "file",
          "params": {
            "type": "object",
            "required": [
              "filePath"
            ],
            "properties": {
              "filePath": {
                "type": "string"
              },
              "encoding": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.writeFile": {
          "name": "ac.writeFile",
          "description": "Write data into a saved:// file.",
          "permission": "file",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.openDocument": {
          "name": "ac.openDocument",
          "description": "Ask the host to open a MiniKit virtual file.",
          "permission": "file",
          "params": {
            "type": "object",
            "required": [
              "filePath"
            ],
            "properties": {
              "filePath": {
                "type": "string"
              },
              "fileType": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.getLocation": {
          "name": "ac.getLocation",
          "description": "Read the current device location.",
          "permission": "location",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.chooseLocation": {
          "name": "ac.chooseLocation",
          "description": "Ask the host to choose a location.",
          "permission": "location",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.startLocationUpdate": {
          "name": "ac.startLocationUpdate",
          "description": "Start host location updates.",
          "permission": "location",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.stopLocationUpdate": {
          "name": "ac.stopLocationUpdate",
          "description": "Stop host location updates.",
          "permission": "location",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.chooseMedia": {
          "name": "ac.chooseMedia",
          "description": "Ask the host to choose image/video media.",
          "permission": "media",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.previewImage": {
          "name": "ac.previewImage",
          "description": "Ask the host to preview one or more images.",
          "permission": "media",
          "params": {
            "type": "object",
            "required": [
              "urls"
            ],
            "properties": {
              "urls": {
                "type": "array"
              },
              "current": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.previewMedia": {
          "name": "ac.previewMedia",
          "description": "Ask the host to preview image/video media.",
          "permission": "media",
          "params": {
            "type": "object",
            "required": [
              "sources"
            ],
            "properties": {
              "sources": {
                "type": "array"
              },
              "current": {
                "type": "number"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.saveImageToPhotosAlbum": {
          "name": "ac.saveImageToPhotosAlbum",
          "description": "Save an image file to the host photo album.",
          "permission": "media",
          "params": {
            "type": "object",
            "required": [
              "filePath"
            ],
            "properties": {
              "filePath": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.saveVideoToPhotosAlbum": {
          "name": "ac.saveVideoToPhotosAlbum",
          "description": "Save a video file to the host photo album.",
          "permission": "media",
          "params": {
            "type": "object",
            "required": [
              "filePath"
            ],
            "properties": {
              "filePath": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.setClipboardData": {
          "name": "ac.setClipboardData",
          "description": "Write text to the host clipboard.",
          "permission": "clipboard",
          "params": {
            "type": "object",
            "required": [
              "data"
            ],
            "properties": {
              "data": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.getClipboardData": {
          "name": "ac.getClipboardData",
          "description": "Read text from the host clipboard.",
          "permission": "clipboard",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.setClipboardImage": {
          "name": "ac.setClipboardImage",
          "description": "Write an image dataUrl, Blob, or temp file to the host clipboard.",
          "permission": "clipboard",
          "params": {
            "type": "object",
            "properties": {
              "dataUrl": {
                "type": "string"
              },
              "filePath": {
                "type": "string"
              },
              "type": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.getDeviceInfo": {
          "name": "ac.getDeviceInfo",
          "description": "Read basic host device information.",
          "permission": null,
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.getWindowInfo": {
          "name": "ac.getWindowInfo",
          "description": "Read host viewport/window information.",
          "permission": null,
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.getNetworkType": {
          "name": "ac.getNetworkType",
          "description": "Read current host network type.",
          "permission": null,
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.onNetworkStatusChange": {
          "name": "ac.onNetworkStatusChange",
          "description": "Subscribe to host network status changes.",
          "permission": null,
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.offNetworkStatusChange": {
          "name": "ac.offNetworkStatusChange",
          "description": "Unsubscribe from host network status changes.",
          "permission": null,
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.shareAppMessage": {
          "name": "ac.shareAppMessage",
          "description": "Ask the host to share the current mini app.",
          "permission": "share",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.showShareMenu": {
          "name": "ac.showShareMenu",
          "description": "Show host share menu affordances.",
          "permission": "share",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.hideShareMenu": {
          "name": "ac.hideShareMenu",
          "description": "Hide host share menu affordances.",
          "permission": "share",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.scanCode": {
          "name": "ac.scanCode",
          "description": "Ask the host scanner to scan a QR/bar code.",
          "permission": "scan",
          "params": {
            "type": "object"
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.connectSocket": {
          "name": "ac.connectSocket",
          "description": "Open a host WebSocket connection.",
          "permission": "socket",
          "params": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string"
              },
              "header": {
                "type": "object"
              },
              "protocols": {
                "type": "array"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.requestStream": {
          "name": "ac.requestStream",
          "description": "Open a host streamed HTTP request.",
          "permission": "stream",
          "params": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string"
              },
              "method": {
                "type": "string"
              },
              "data": {},
              "header": {
                "type": "object"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.getUserProfile": {
          "name": "ac.getUserProfile",
          "description": "Read the signed-in AppsChat user's public profile from the host.",
          "permission": "profile",
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "nickname": {
                "type": "string"
              },
              "avatarUrl": {
                "type": "string"
              },
              "locale": {
                "type": "string"
              },
              "timezone": {
                "type": "string"
              }
            }
          },
          "errors": [],
          "examples": []
        },
        "ac.getAppContext": {
          "name": "ac.getAppContext",
          "description": "Read the AppsChat-scoped context for the current mini app installation.",
          "permission": "ac.getAppContext",
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.openChat": {
          "name": "ac.openChat",
          "description": "Open the AppsChat conversation for the current mini app installation.",
          "permission": "ac.openChat",
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.sendChat": {
          "name": "ac.sendChat",
          "description": "Queue a user message in the AppsChat conversation for the current mini app installation.",
          "permission": "ac.sendChat",
          "params": {
            "type": "object",
            "required": [
              "message"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "context": {
                "type": "object"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.openMiniApp": {
          "name": "ac.openMiniApp",
          "description": "Ask the AppsChat host to open the current MiniApp or a target MiniApp from a component card.",
          "permission": "ac.openMiniApp",
          "params": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "component": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.emitComponentEvent": {
          "name": "ac.emitComponentEvent",
          "description": "Emit an auditable event from a component card to the host.",
          "permission": "ac.emitComponentEvent",
          "params": {
            "type": "object",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "detail": {
                "type": "object"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.requestComponentResize": {
          "name": "ac.requestComponentResize",
          "description": "Request a bounded height update for the current component card.",
          "permission": "ac.requestComponentResize",
          "params": {
            "type": "object",
            "required": [
              "height"
            ],
            "properties": {
              "height": {
                "type": "number"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.readMemory": {
          "name": "ac.readMemory",
          "description": "Read memories scoped to the current AppsChat user, mini app, and installation.",
          "permission": "ac.readMemory",
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "array"
          },
          "errors": [],
          "examples": []
        },
        "ac.writeMemory": {
          "name": "ac.writeMemory",
          "description": "Write a memory scoped to the current AppsChat user, mini app, and installation.",
          "permission": "ac.writeMemory",
          "params": {
            "type": "object",
            "required": [
              "content"
            ],
            "properties": {
              "title": {
                "type": "string"
              },
              "content": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.getUserProfile": {
          "name": "ac.developer.getUserProfile",
          "description": "Read the current developer user's profile. Reserved for the official developer assistant MiniApp.",
          "permission": "developer",
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.getManagementToken": {
          "name": "ac.developer.getManagementToken",
          "description": "Read the current developer management token record without returning the secret token.",
          "permission": "developer",
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object",
            "properties": {
              "record": {
                "type": "object"
              }
            }
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.createManagementToken": {
          "name": "ac.developer.createManagementToken",
          "description": "Create a developer management token. The secret token is returned only in this creation response.",
          "permission": "developer",
          "params": {
            "type": "object",
            "properties": {
              "expiresAt": {
                "type": "string"
              },
              "expires_at": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object",
            "properties": {
              "token": {
                "type": "string"
              },
              "record": {
                "type": "object"
              },
              "managementUrl": {
                "type": "string"
              }
            }
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.createManagementLink": {
          "name": "ac.developer.createManagementLink",
          "description": "Create or refresh a developer management link for the current developer token record.",
          "permission": "developer",
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object",
            "properties": {
              "managementUrl": {
                "type": "string"
              }
            }
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.createMiniApp": {
          "name": "ac.developer.createMiniApp",
          "description": "Create a MiniApp owned by the current developer.",
          "permission": "developer",
          "params": {
            "type": "object",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "appId": {
                "type": "string"
              },
              "app_id": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "draft",
                  "published"
                ]
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.listMiniApps": {
          "name": "ac.developer.listMiniApps",
          "description": "List MiniApps owned by the current developer.",
          "permission": "developer",
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "array"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.getMiniApp": {
          "name": "ac.developer.getMiniApp",
          "description": "Read one MiniApp owned by the current developer, including versions when the host supports it.",
          "permission": "developer",
          "params": {
            "type": "object",
            "required": [
              "miniappId"
            ],
            "properties": {
              "miniappId": {
                "type": "string"
              },
              "miniapp_id": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.updateMiniApp": {
          "name": "ac.developer.updateMiniApp",
          "description": "Update base metadata for a MiniApp owned by the current developer.",
          "permission": "developer",
          "params": {
            "type": "object",
            "required": [
              "miniappId"
            ],
            "properties": {
              "miniappId": {
                "type": "string"
              },
              "miniapp_id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "display_name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "draft",
                  "published"
                ]
              },
              "avatar": {
                "type": "string"
              },
              "avatarUrl": {
                "type": "string"
              },
              "avatar_url": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.publishMiniAppVersion": {
          "name": "ac.developer.publishMiniAppVersion",
          "description": "Publish or import a MiniApp package version from an uploaded package file.",
          "permission": "developer",
          "params": {
            "type": "object",
            "required": [
              "storedFileId"
            ],
            "properties": {
              "storedFileId": {
                "type": "string"
              },
              "stored_file_id": {
                "type": "string"
              },
              "miniappId": {
                "type": "string"
              },
              "miniapp_id": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "publish": {
                "type": "boolean"
              },
              "force": {
                "type": "boolean"
              }
            }
          },
          "returns": {
            "type": "object",
            "properties": {
              "miniapp": {
                "type": "object"
              },
              "version": {
                "type": "object"
              },
              "created": {
                "type": "boolean"
              },
              "published": {
                "type": "boolean"
              }
            }
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.getMiniAppVersion": {
          "name": "ac.developer.getMiniAppVersion",
          "description": "Read one uploaded MiniApp package version owned by the current developer.",
          "permission": "developer",
          "params": {
            "type": "object",
            "required": [
              "miniappId",
              "versionId"
            ],
            "properties": {
              "miniappId": {
                "type": "string"
              },
              "miniapp_id": {
                "type": "string"
              },
              "versionId": {
                "type": "string"
              },
              "version_id": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.deleteMiniAppVersion": {
          "name": "ac.developer.deleteMiniAppVersion",
          "description": "Delete an uploaded MiniApp package version owned by the current developer when the host allows deletion.",
          "permission": "developer",
          "params": {
            "type": "object",
            "required": [
              "miniappId",
              "versionId"
            ],
            "properties": {
              "miniappId": {
                "type": "string"
              },
              "miniapp_id": {
                "type": "string"
              },
              "versionId": {
                "type": "string"
              },
              "version_id": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.listBuildRequests": {
          "name": "ac.developer.listBuildRequests",
          "description": "List MiniApp build requests owned by the current developer.",
          "permission": "developer",
          "params": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "array"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.createBuildRequest": {
          "name": "ac.developer.createBuildRequest",
          "description": "Create an AI MiniApp build request owned by the current developer.",
          "permission": "developer",
          "params": {
            "type": "object",
            "required": [
              "prompt"
            ],
            "properties": {
              "prompt": {
                "type": "string"
              },
              "sourceInstallationId": {
                "type": "string"
              },
              "source_installation_id": {
                "type": "string"
              },
              "template": {
                "type": "string"
              },
              "permissions": {
                "type": "array"
              },
              "targetAudience": {
                "type": "string"
              },
              "target_audience": {
                "type": "string"
              },
              "scenario": {
                "type": "string"
              },
              "manifestDraft": {
                "type": "object"
              },
              "manifest_draft": {
                "type": "object"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.getToken": {
          "name": "ac.developer.getToken",
          "description": "Alias of ac.developer.getManagementToken for existing developer assistants.",
          "permission": "developer",
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object",
            "properties": {
              "record": {
                "type": "object"
              }
            }
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.createToken": {
          "name": "ac.developer.createToken",
          "description": "Alias of ac.developer.createManagementToken for existing developer assistants.",
          "permission": "developer",
          "params": {
            "type": "object",
            "properties": {
              "expiresAt": {
                "type": "string"
              },
              "expires_at": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object",
            "properties": {
              "token": {
                "type": "string"
              },
              "record": {
                "type": "object"
              },
              "managementUrl": {
                "type": "string"
              }
            }
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.revokeToken": {
          "name": "ac.developer.revokeToken",
          "description": "Revoke the current developer management token.",
          "permission": "developer",
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.installMiniApp": {
          "name": "ac.developer.installMiniApp",
          "description": "Install or upgrade a MiniApp version for testing.",
          "permission": "developer",
          "params": {
            "type": "object",
            "required": [
              "miniappId"
            ],
            "properties": {
              "miniappId": {
                "type": "string"
              },
              "miniapp_id": {
                "type": "string"
              },
              "versionId": {
                "type": "string"
              },
              "version_id": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.developer.openMiniApp": {
          "name": "ac.developer.openMiniApp",
          "description": "Open an installed MiniApp or install then open a target MiniApp for testing.",
          "permission": "developer",
          "params": {
            "type": "object",
            "properties": {
              "installationId": {
                "type": "string"
              },
              "installation_id": {
                "type": "string"
              },
              "miniappId": {
                "type": "string"
              },
              "miniapp_id": {
                "type": "string"
              },
              "versionId": {
                "type": "string"
              },
              "version_id": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.navigateTo": {
          "name": "ac.navigateTo",
          "description": "Navigate to a mini app page and push it onto the page stack.",
          "permission": null,
          "params": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.redirectTo": {
          "name": "ac.redirectTo",
          "description": "Replace the current mini app page with another page.",
          "permission": null,
          "params": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.navigateBack": {
          "name": "ac.navigateBack",
          "description": "Close pages in the mini app page stack.",
          "permission": null,
          "params": {
            "type": "object",
            "properties": {
              "delta": {
                "type": "number"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.getCurrentPages": {
          "name": "ac.getCurrentPages",
          "description": "Read the current mini app page stack.",
          "permission": null,
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.pageScrollTo": {
          "name": "ac.pageScrollTo",
          "description": "Scroll the current mini app page by scrollTop or selector.",
          "permission": null,
          "params": {
            "type": "object",
            "properties": {
              "scrollTop": {
                "type": "number"
              },
              "selector": {
                "type": "string"
              },
              "duration": {
                "type": "number"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.startPullDownRefresh": {
          "name": "ac.startPullDownRefresh",
          "description": "Programmatically trigger pull-down refresh for the current page.",
          "permission": null,
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.stopPullDownRefresh": {
          "name": "ac.stopPullDownRefresh",
          "description": "Stop the current page pull-down refresh indicator.",
          "permission": null,
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.openExternal": {
          "name": "ac.openExternal",
          "description": "Ask the host to open an external URL outside the mini app router.",
          "permission": "navigation",
          "params": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "boolean"
          },
          "errors": [],
          "examples": []
        },
        "ac.drawCanvas": {
          "name": "ac.drawCanvas",
          "description": "Draw a command list onto a mini canvas by canvasId.",
          "permission": null,
          "params": {
            "type": "object",
            "required": [
              "canvasId",
              "commands"
            ],
            "properties": {
              "canvasId": {
                "type": "string"
              },
              "commands": {
                "type": "array"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.clearCanvas": {
          "name": "ac.clearCanvas",
          "description": "Clear a mini canvas.",
          "permission": null,
          "params": {
            "type": "object",
            "required": [
              "canvasId"
            ],
            "properties": {
              "canvasId": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.measureCanvasText": {
          "name": "ac.measureCanvasText",
          "description": "Measure text with the canvas 2D context.",
          "permission": null,
          "params": {
            "type": "object",
            "required": [
              "canvasId",
              "text"
            ],
            "properties": {
              "canvasId": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.canvasToTempFilePath": {
          "name": "ac.canvasToTempFilePath",
          "description": "Export a canvas to a temporary image URL or data URL.",
          "permission": null,
          "params": {
            "type": "object",
            "required": [
              "canvasId"
            ],
            "properties": {
              "canvasId": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.renderMermaid": {
          "name": "ac.renderMermaid",
          "description": "Render Mermaid diagram code to sanitized SVG for diagram-view.",
          "permission": null,
          "params": {
            "type": "object",
            "required": [
              "code"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "diagramId": {
                "type": "string"
              },
              "config": {
                "type": "object"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.captureNode": {
          "name": "ac.captureNode",
          "description": "Export a rendered mini component node, diagram, or canvas to a temporary image URL/data URL.",
          "permission": null,
          "params": {
            "type": "object",
            "properties": {
              "selector": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "diagramId": {
                "type": "string"
              },
              "canvasId": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "quality": {
                "type": "number"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.playMedia": {
          "name": "ac.playMedia",
          "description": "Play a video or audio element by id/mediaId.",
          "permission": "media",
          "params": {
            "type": "object",
            "required": [
              "mediaId"
            ],
            "properties": {
              "mediaId": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.pauseMedia": {
          "name": "ac.pauseMedia",
          "description": "Pause a video or audio element by id/mediaId.",
          "permission": "media",
          "params": {
            "type": "object",
            "required": [
              "mediaId"
            ],
            "properties": {
              "mediaId": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.seekMedia": {
          "name": "ac.seekMedia",
          "description": "Seek a video or audio element by id/mediaId.",
          "permission": "media",
          "params": {
            "type": "object",
            "required": [
              "mediaId",
              "position"
            ],
            "properties": {
              "mediaId": {
                "type": "string"
              },
              "position": {
                "type": "number"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.getMediaInfo": {
          "name": "ac.getMediaInfo",
          "description": "Read playback state for a video or audio element.",
          "permission": "media",
          "params": {
            "type": "object",
            "required": [
              "mediaId"
            ],
            "properties": {
              "mediaId": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.startCameraPreview": {
          "name": "ac.startCameraPreview",
          "description": "Start host camera preview for a camera component.",
          "permission": "camera",
          "params": {
            "type": "object",
            "properties": {
              "devicePosition": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.stopCameraPreview": {
          "name": "ac.stopCameraPreview",
          "description": "Stop host camera preview.",
          "permission": "camera",
          "params": {
            "type": "object",
            "properties": {}
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.captureCamera": {
          "name": "ac.captureCamera",
          "description": "Capture an image from the host camera provider.",
          "permission": "camera",
          "params": {
            "type": "object",
            "properties": {
              "devicePosition": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.getMapCenterLocation": {
          "name": "ac.getMapCenterLocation",
          "description": "Read the current center location from the host map provider.",
          "permission": "map",
          "params": {
            "type": "object",
            "properties": {
              "mapId": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.moveMapToLocation": {
          "name": "ac.moveMapToLocation",
          "description": "Move the map camera to a latitude/longitude.",
          "permission": "map",
          "params": {
            "type": "object",
            "properties": {
              "latitude": {
                "type": "number"
              },
              "longitude": {
                "type": "number"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.includeMapPoints": {
          "name": "ac.includeMapPoints",
          "description": "Adjust the map viewport to include points.",
          "permission": "map",
          "params": {
            "type": "object",
            "properties": {
              "points": {
                "type": "array"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        },
        "ac.openLocation": {
          "name": "ac.openLocation",
          "description": "Open a location in the host map provider.",
          "permission": "map",
          "params": {
            "type": "object",
            "properties": {
              "latitude": {
                "type": "number"
              },
              "longitude": {
                "type": "number"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "returns": {
            "type": "object"
          },
          "errors": [],
          "examples": []
        }
      }
    },
    "schemas": [
      {
        "formatVersion": 1,
        "id": "theme",
        "title": "Mini app theme tokens",
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "color": {
              "enum": [
                "blue",
                "green",
                "orange",
                "neutral",
                "red"
              ]
            },
            "density": {
              "enum": [
                "compact",
                "comfortable"
              ]
            },
            "radius": {
              "enum": [
                "none",
                "sm",
                "md",
                "lg"
              ]
            },
            "colorScheme": {
              "enum": [
                "auto",
                "light",
                "dark"
              ]
            }
          }
        }
      },
      {
        "formatVersion": 1,
        "id": "pageDefinition",
        "title": "definePage options",
        "schema": {
          "type": "object",
          "required": [
            "template"
          ],
          "additionalProperties": false,
          "properties": {
            "title": {
              "type": "string"
            },
            "template": {
              "type": "string",
              "description": "Markup using only standard mini components, data interpolation, and bind* event handlers."
            },
            "style": {
              "type": "string"
            },
            "data": {
              "anyOf": [
                {
                  "type": "object"
                },
                {
                  "type": "array"
                },
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Any JSON-compatible value: object, array, string, number, boolean, or null."
            },
            "methods": {
              "type": "object",
              "description": "Object whose keys are handler names and values are JavaScript functions in generated source.",
              "additionalProperties": {
                "tsType": "MiniPageMethod",
                "description": "Generate a JavaScript function, for example save(event) { this.setData({ saved: true }); }."
              }
            },
            "lifecycle": {
              "type": "object",
              "additionalProperties": {
                "tsType": "MiniPageMethod"
              },
              "description": "Optional lifecycle JavaScript functions keyed by lifecycle name."
            }
          }
        }
      },
      {
        "formatVersion": 1,
        "id": "manifestTestStep",
        "title": "Executable manifest test step",
        "actions": [
          "start",
          "tap",
          "input",
          "expectRoute",
          "expectData",
          "expectHtmlIncludes"
        ],
        "schema": {
          "oneOf": [
            {
              "type": "object",
              "title": "manifest.tests step: start",
              "description": "Start the mini app on a declared page route.",
              "additionalProperties": false,
              "required": [
                "action",
                "path"
              ],
              "properties": {
                "action": {
                  "const": "start"
                },
                "path": {
                  "type": "string",
                  "pattern": "^pages/"
                }
              }
            },
            {
              "type": "object",
              "title": "manifest.tests step: tap",
              "description": "Invoke a page method as a tap event.",
              "additionalProperties": false,
              "required": [
                "action",
                "handler"
              ],
              "properties": {
                "action": {
                  "const": "tap"
                },
                "handler": {
                  "type": "string"
                },
                "eventName": {
                  "type": "string"
                },
                "dataset": {
                  "anyOf": [
                    {
                      "type": "object"
                    },
                    {
                      "type": "array"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Any JSON-compatible value: object, array, string, number, boolean, or null."
                },
                "detail": {
                  "anyOf": [
                    {
                      "type": "object"
                    },
                    {
                      "type": "array"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Any JSON-compatible value: object, array, string, number, boolean, or null."
                }
              }
            },
            {
              "type": "object",
              "title": "manifest.tests step: input",
              "description": "Invoke a page method with an input value.",
              "additionalProperties": false,
              "required": [
                "action",
                "handler",
                "value"
              ],
              "properties": {
                "action": {
                  "const": "input"
                },
                "handler": {
                  "type": "string"
                },
                "value": {
                  "anyOf": [
                    {
                      "type": "object"
                    },
                    {
                      "type": "array"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Any JSON-compatible value: object, array, string, number, boolean, or null."
                },
                "dataset": {
                  "anyOf": [
                    {
                      "type": "object"
                    },
                    {
                      "type": "array"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Any JSON-compatible value: object, array, string, number, boolean, or null."
                },
                "detail": {
                  "anyOf": [
                    {
                      "type": "object"
                    },
                    {
                      "type": "array"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Any JSON-compatible value: object, array, string, number, boolean, or null."
                }
              }
            },
            {
              "type": "object",
              "title": "manifest.tests step: expectRoute",
              "description": "Assert the active route after previous steps.",
              "additionalProperties": false,
              "required": [
                "action",
                "route"
              ],
              "properties": {
                "action": {
                  "const": "expectRoute"
                },
                "route": {
                  "type": "string",
                  "pattern": "^pages/"
                }
              }
            },
            {
              "type": "object",
              "title": "manifest.tests step: expectData",
              "description": "Assert a page data path after previous steps.",
              "additionalProperties": false,
              "required": [
                "action",
                "path",
                "value"
              ],
              "properties": {
                "action": {
                  "const": "expectData"
                },
                "path": {
                  "type": "string"
                },
                "value": {
                  "anyOf": [
                    {
                      "type": "object"
                    },
                    {
                      "type": "array"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Any JSON-compatible value: object, array, string, number, boolean, or null."
                }
              }
            },
            {
              "type": "object",
              "title": "manifest.tests step: expectHtmlIncludes",
              "description": "Assert rendered HTML contains visible text.",
              "additionalProperties": false,
              "required": [
                "action",
                "text"
              ],
              "properties": {
                "action": {
                  "const": "expectHtmlIncludes"
                },
                "text": {
                  "type": "string"
                }
              }
            }
          ]
        }
      },
      {
        "formatVersion": 1,
        "id": "manifestTest",
        "title": "Executable manifest test",
        "schema": {
          "type": "object",
          "required": [
            "name",
            "steps"
          ],
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string"
            },
            "path": {
              "type": "string",
              "description": "Legacy smoke path. Prefer explicit steps with a start action."
            },
            "steps": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "agent.schema.manifestTestStep"
              }
            }
          }
        }
      },
      {
        "formatVersion": 1,
        "id": "miniAppManifest",
        "title": "defineMiniApp options",
        "schema": {
          "type": "object",
          "required": [
            "appId",
            "version",
            "name",
            "pages"
          ],
          "additionalProperties": true,
          "properties": {
            "appId": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.-]+$"
            },
            "version": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "description": {
              "type": "string"
            },
            "generatedBy": {
              "type": "string"
            },
            "theme": {
              "$ref": "agent.schema.theme"
            },
            "capabilitiesUsed": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "apisUsed": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "permissions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "tests": {
              "type": "array",
              "items": {
                "$ref": "agent.schema.manifestTest"
              }
            },
            "pages": {
              "type": "object",
              "minProperties": 1,
              "propertyNames": {
                "pattern": "^pages/"
              },
              "additionalProperties": {
                "$ref": "agent.schema.pageDefinition"
              }
            }
          }
        }
      }
    ],
    "templates": [
      {
        "id": "hello-world",
        "category": "starter",
        "name": "Hello World",
        "description": "Minimal single-page starter app for verifying Agent generation, rendering, and event handling.",
        "capabilitiesUsed": [],
        "apisUsed": [],
        "permissions": [
          "ui"
        ],
        "acceptance": [
          {
            "name": "hello world updates message",
            "steps": [
              {
                "action": "start",
                "path": "pages/home"
              },
              {
                "action": "expectHtmlIncludes",
                "text": "Hello, MiniKit"
              },
              {
                "action": "tap",
                "handler": "sayHello"
              },
              {
                "action": "expectData",
                "path": "message",
                "value": "Hello from an Agent-generated mini app."
              },
              {
                "action": "expectHtmlIncludes",
                "text": "Hello from an Agent-generated mini app."
              }
            ]
          }
        ]
      },
      {
        "id": "form-submit",
        "category": "data-entry",
        "name": "Form Submit",
        "description": "Single-page form with draft state, validation message, and optional host storage.",
        "capabilitiesUsed": [
          "storage"
        ],
        "apisUsed": [
          "ac.setStorage"
        ],
        "permissions": [
          "storage"
        ],
        "acceptance": [
          {
            "name": "form submits",
            "steps": [
              {
                "action": "start",
                "path": "pages/form"
              },
              {
                "action": "input",
                "handler": "updateName",
                "value": "Ada"
              },
              {
                "action": "input",
                "handler": "updateNote",
                "value": "Hello"
              },
              {
                "action": "tap",
                "handler": "submit"
              },
              {
                "action": "expectData",
                "path": "message",
                "value": "Submitted successfully."
              },
              {
                "action": "expectHtmlIncludes",
                "text": "Submitted successfully."
              }
            ]
          }
        ]
      },
      {
        "id": "list-detail",
        "category": "browse",
        "name": "List Detail",
        "description": "List page with detail navigation and route parameter handling.",
        "capabilitiesUsed": [],
        "apisUsed": [],
        "permissions": [],
        "acceptance": [
          {
            "name": "list opens detail",
            "steps": [
              {
                "action": "start",
                "path": "pages/list"
              },
              {
                "action": "tap",
                "handler": "openDetail",
                "dataset": {
                  "id": "alpha"
                }
              },
              {
                "action": "expectRoute",
                "route": "pages/detail"
              },
              {
                "action": "expectData",
                "path": "id",
                "value": "alpha"
              }
            ]
          }
        ]
      },
      {
        "id": "task-board",
        "category": "productivity",
        "name": "Task Board",
        "description": "Task list with add, complete, and empty-state interactions.",
        "capabilitiesUsed": [],
        "apisUsed": [],
        "permissions": [],
        "acceptance": [
          {
            "name": "task board adds task",
            "steps": [
              {
                "action": "start",
                "path": "pages/board"
              },
              {
                "action": "input",
                "handler": "updateDraft",
                "value": "Ship mini app"
              },
              {
                "action": "tap",
                "handler": "addTask"
              },
              {
                "action": "expectHtmlIncludes",
                "text": "Ship mini app"
              },
              {
                "action": "expectData",
                "path": "isEmpty",
                "value": false
              }
            ]
          }
        ]
      },
      {
        "id": "settings",
        "category": "configuration",
        "name": "Settings",
        "description": "Settings page with toggles represented as deterministic button controls.",
        "capabilitiesUsed": [
          "storage"
        ],
        "apisUsed": [
          "ac.setStorage"
        ],
        "permissions": [
          "storage"
        ],
        "acceptance": [
          {
            "name": "settings toggles notifications",
            "steps": [
              {
                "action": "start",
                "path": "pages/settings"
              },
              {
                "action": "tap",
                "handler": "toggleNotifications"
              },
              {
                "action": "expectData",
                "path": "notifications",
                "value": false
              },
              {
                "action": "expectData",
                "path": "notificationsLabel",
                "value": "off"
              }
            ]
          }
        ]
      }
    ],
    "tests": {
      "manifestField": "manifest.tests",
      "actions": [
        {
          "action": "start",
          "description": "Start the mini app at a route before interacting with it.",
          "required": [
            "path"
          ],
          "example": {
            "action": "start",
            "path": "pages/home"
          }
        },
        {
          "action": "tap",
          "description": "Dispatch a tap-like event to a page handler.",
          "required": [
            "handler"
          ],
          "example": {
            "action": "tap",
            "handler": "submit",
            "dataset": {
              "id": "item-1"
            }
          }
        },
        {
          "action": "input",
          "description": "Dispatch an input event with detail.value to a page handler.",
          "required": [
            "handler",
            "value"
          ],
          "example": {
            "action": "input",
            "handler": "updateName",
            "value": "Ada"
          }
        },
        {
          "action": "expectRoute",
          "description": "Assert the active route after navigation.",
          "required": [
            "route"
          ],
          "example": {
            "action": "expectRoute",
            "route": "pages/detail"
          }
        },
        {
          "action": "expectData",
          "description": "Assert a value in active page data by dotted path.",
          "required": [
            "path",
            "value"
          ],
          "example": {
            "action": "expectData",
            "path": "items.0.title",
            "value": "First item"
          }
        },
        {
          "action": "expectHtmlIncludes",
          "description": "Assert rendered HTML contains visible text or markup.",
          "required": [
            "text"
          ],
          "example": {
            "action": "expectHtmlIncludes",
            "text": "Saved"
          }
        }
      ],
      "legacyFormat": {
        "name": "smoke",
        "path": "pages/home"
      }
    },
    "diagnostics": {
      "repairs": [
        {
          "code": "API_NOT_AVAILABLE",
          "action": "remove_or_register_api",
          "target": "manifest.apisUsed",
          "example": "Remove the unavailable API or register it in the host API manifest."
        },
        {
          "code": "API_PERMISSION_MISSING",
          "action": "add_permission",
          "target": "manifest.permissions",
          "example": "Add the required permission to manifest.permissions."
        },
        {
          "code": "BUNDLE_INVALID",
          "action": "return_define_mini_app",
          "target": "module.default",
          "example": "export default defineMiniApp({ appId, version, pages });"
        },
        {
          "code": "COMPONENT_API_MISSING",
          "action": "declare_component_api",
          "target": "manifest.apisUsed",
          "example": "Add required APIs such as \"ac.drawCanvas\", \"ac.getMediaInfo\", \"ac.captureCamera\", or \"ac.getMapCenterLocation\"."
        },
        {
          "code": "COMPONENT_ATTR_INVALID",
          "action": "fix_component_attribute",
          "target": "page.template",
          "example": "Use numeric literals or {{data}} bindings for numeric component attributes."
        },
        {
          "code": "COMPONENT_ATTR_REQUIRED",
          "action": "add_component_attribute",
          "target": "page.template",
          "example": "Add required attributes such as canvas-id on <canvas> or latitude/longitude on <map>."
        },
        {
          "code": "COMPONENT_ATTR_UNSUPPORTED",
          "action": "replace_component_attribute",
          "target": "page.template",
          "example": "Use only attributes listed in context.components for that component."
        },
        {
          "code": "COMPONENT_EVENT_UNSUPPORTED",
          "action": "replace_component_event",
          "target": "page.template",
          "example": "Use supported events such as bindtap, bindchange, bindplay, bindregionchange, or bindmarkertap."
        },
        {
          "code": "COMPONENT_PERMISSION_MISSING",
          "action": "add_component_permission",
          "target": "manifest.permissions",
          "example": "Add permissions such as \"media\", \"camera\", \"location\", or \"map\" when using capability components."
        },
        {
          "code": "MANIFEST_APIS_USED_INVALID",
          "action": "set_array_field",
          "target": "manifest.apisUsed",
          "example": "apisUsed: [\"ac.getStorage\"]"
        },
        {
          "code": "MANIFEST_APP_ID_REQUIRED",
          "action": "set_manifest_field",
          "target": "manifest.appId",
          "example": "appId: \"agent.generated.app\""
        },
        {
          "code": "MANIFEST_CAPABILITIES_INVALID",
          "action": "set_array_field",
          "target": "manifest.capabilitiesUsed",
          "example": "capabilitiesUsed: [\"storage\"]"
        },
        {
          "code": "MANIFEST_MISSING",
          "action": "add_manifest",
          "target": "manifest",
          "example": "Use defineMiniApp({ appId, version, pages })."
        },
        {
          "code": "MANIFEST_PAGES_REQUIRED",
          "action": "declare_pages",
          "target": "manifest.pages",
          "example": "Add at least one page route, such as pages: { \"pages/home\": definePage({...}) }."
        },
        {
          "code": "MANIFEST_PERMISSIONS_INVALID",
          "action": "set_array_field",
          "target": "manifest.permissions",
          "example": "permissions: []"
        },
        {
          "code": "MANIFEST_TESTS_INVALID",
          "action": "set_array_field",
          "target": "manifest.tests",
          "example": "tests: [{ name: \"home renders\", path: \"pages/home\" }]"
        },
        {
          "code": "MANIFEST_THEME_INVALID",
          "action": "set_theme_token",
          "target": "manifest.theme",
          "example": "theme: { color: \"blue\", density: \"comfortable\", radius: \"md\", colorScheme: \"auto\" }"
        },
        {
          "code": "MANIFEST_VERSION_REQUIRED",
          "action": "set_manifest_field",
          "target": "manifest.version",
          "example": "version: \"0.1.0\""
        },
        {
          "code": "PAGES_INVALID",
          "action": "add_pages_object",
          "target": "pages",
          "example": "pages: { \"pages/home\": definePage({ template, data, methods }) }"
        },
        {
          "code": "PAGE_EVENT_HANDLER_MISSING",
          "action": "add_method",
          "target": "page.methods",
          "example": "Add methods: { handlerName(event) { ... } } to the page."
        },
        {
          "code": "PAGE_MISSING",
          "action": "add_page",
          "target": "pages",
          "example": "Add the missing route with definePage({ template: \"<view>...</view>\" })."
        },
        {
          "code": "PAGE_SCRIPT_EVALUATION_FAILED",
          "action": "move_work_to_lifecycle",
          "target": "page.script",
          "example": "Keep registration pure and move runtime work into onLoad/onShow or methods."
        },
        {
          "code": "PAGE_SCRIPT_REQUIRED",
          "action": "use_define_page",
          "target": "page.script",
          "example": "Use definePage({ data: {}, methods: {} }) instead of a raw page object."
        },
        {
          "code": "PAGE_TEMPLATE_DYNAMIC_EVENT_HANDLER",
          "action": "set_static_event_handler",
          "target": "page.template",
          "example": "Use bindtap=\"handlerName\" and branch inside handlerName instead of interpolating the handler name."
        },
        {
          "code": "PAGE_TEMPLATE_EVENT_HANDLER_REQUIRED",
          "action": "set_event_handler",
          "target": "page.template",
          "example": "Use bindtap=\"handlerName\" and add methods: { handlerName(event) { ... } }."
        },
        {
          "code": "PAGE_TEMPLATE_REQUIRED",
          "action": "add_template",
          "target": "page.template",
          "example": "template: \"<safe-area><card><text>{{title}}</text></card></safe-area>\""
        },
        {
          "code": "PAGE_TEMPLATE_SYNTAX_INVALID",
          "action": "fix_template_syntax",
          "target": "page.template",
          "example": "Balance tags and bindings, for example <safe-area><card><text>{{title}}</text></card></safe-area>."
        },
        {
          "code": "PAGE_TEMPLATE_UNSUPPORTED_DIRECTIVE",
          "action": "replace_template_directive",
          "target": "page.template",
          "example": "Use mini:if=\"{{visible}}\" or mini:for=\"{{items}}\" instead of wx:* or v-* directives."
        },
        {
          "code": "PAGE_TEMPLATE_UNSUPPORTED_EVENT_BINDING",
          "action": "replace_event_binding",
          "target": "page.template",
          "example": "Use bindtap=\"handlerName\" instead of @tap, onclick, bind:tap, or bind-tap."
        },
        {
          "code": "PAGE_UNKNOWN_COMPONENT",
          "action": "replace_component",
          "target": "page.template",
          "example": "Replace custom tags with standard components such as card, list, or view."
        },
        {
          "code": "SMOKE_EMPTY_RENDER",
          "action": "fix_first_render",
          "target": "first_page.template",
          "example": "Make sure the first page template renders visible standard components."
        },
        {
          "code": "TESTS_REQUIRED",
          "action": "add_manifest_tests",
          "target": "manifest.tests",
          "example": "Add tests: [{ name: \"main workflow\", steps: [{ action: \"start\", path: \"pages/home\" }, { action: \"expectHtmlIncludes\", text: \"Home\" }] }]."
        },
        {
          "code": "TEST_HANDLER_MISSING",
          "action": "add_test_handler",
          "target": "page.methods",
          "example": "Add the handler named in manifest.tests to one of the generated pages."
        },
        {
          "code": "TEST_INVALID",
          "action": "replace_test",
          "target": "manifest.tests",
          "example": "tests: [{ name: \"home renders\", path: \"pages/home\" }]"
        },
        {
          "code": "TEST_LEGACY_PATH_REQUIRED",
          "action": "set_test_path",
          "target": "manifest.tests[].path",
          "example": "path: \"pages/home\""
        },
        {
          "code": "TEST_NAME_INVALID",
          "action": "set_test_name",
          "target": "manifest.tests[].name",
          "example": "name: \"main workflow\""
        },
        {
          "code": "TEST_ROUTE_UNKNOWN",
          "action": "fix_test_route",
          "target": "manifest.tests",
          "example": "Use an existing manifest.pages route such as pages/home, or add the missing page."
        },
        {
          "code": "TEST_START_REQUIRED",
          "action": "add_start_step",
          "target": "manifest.tests[].steps",
          "example": "{ action: \"start\", path: \"pages/home\" }"
        },
        {
          "code": "TEST_STEPS_EMPTY",
          "action": "add_test_steps",
          "target": "manifest.tests[].steps",
          "example": "steps: [{ action: \"start\", path: \"pages/home\" }, { action: \"expectHtmlIncludes\", text: \"Home\" }]"
        },
        {
          "code": "TEST_STEPS_INVALID",
          "action": "set_test_steps",
          "target": "manifest.tests[].steps",
          "example": "steps: [{ action: \"start\", path: \"pages/home\" }]"
        },
        {
          "code": "TEST_STEP_FIELD_REQUIRED",
          "action": "add_test_step_field",
          "target": "manifest.tests[].steps[]",
          "example": "Add the field named in the validation message."
        },
        {
          "code": "TEST_STEP_INVALID",
          "action": "replace_test_step",
          "target": "manifest.tests[].steps[]",
          "example": "{ action: \"tap\", handler: \"submit\" }"
        },
        {
          "code": "TEST_UNKNOWN_ACTION",
          "action": "replace_test_action",
          "target": "manifest.tests[].steps[].action",
          "example": "Use start, tap, input, expectRoute, expectData, or expectHtmlIncludes."
        }
      ],
      "emittedBy": [
        "validate",
        "test",
        "report",
        "pack"
      ],
      "failureShape": {
        "ok": false,
        "issues": [
          {
            "code": "ISSUE_CODE",
            "path": "field.path",
            "message": "Human-readable message",
            "suggestion": "Repair guidance"
          }
        ],
        "diagnostics": {
          "ok": false,
          "repairs": [
            {
              "action": "repair_action",
              "target": "field.path",
              "example": "Concrete edit"
            }
          ]
        }
      }
    },
    "pipeline": {
      "inspectContext": "node scripts/miniapp.mjs context --json",
      "scaffoldTemplate": "node scripts/miniapp.mjs scaffold <templateId> <outputFile> --json",
      "validate": "node scripts/miniapp.mjs validate <module> --smoke --json",
      "snapshot": "node scripts/miniapp.mjs snapshot <module> --json",
      "test": "node scripts/miniapp.mjs test <module> --json",
      "report": "node scripts/miniapp.mjs report <module> --require-tests --json",
      "pack": "node scripts/miniapp.mjs pack <module> --out record.json --require-tests --json",
      "build": "node scripts/miniapp.mjs build <module> --out record.json --json"
    },
    "guardrails": [
      "Use only standard components for agent-generated apps.",
      "Prefer source-first projects for non-trivial apps: app.js imports pages/ and tests/, miniapp.json declares build outputs, and generated manifest.json/app-service.js belong under build/dist.",
      "Never hand-edit generated app-service.js or generated manifest.json for maintained apps; regenerate archive output from SDK source before publishing.",
      "Prefer basic layout/form/content components; generate canvas, diagram-view, media, camera, or map only when the user explicitly needs that capability.",
      "Treat canvas, diagram-view, media, camera, and map as capability-driven components: declare permissions and manifest.apisUsed, then call the matching ac.* API.",
      "For Mermaid editing, pair code-editor language=\"mermaid\" with diagram-view; call ac.renderMermaid to produce svg and ac.captureNode plus ac.setClipboardImage when export or copy-image workflows are requested.",
      "For network, file, permission, clipboard, location, share, scan, socket, and stream APIs, declare every ac.* call in manifest.apisUsed and every protected capability in manifest.permissions.",
      "Prefer script: ({ Page, ac }) => Page(...) and await ac.<method>(params); success, fail, and complete callbacks are supported only for API compatibility.",
      "Use ac.createSelectorQuery only when the user needs node measurements; do not use DOM APIs directly.",
      "Official AppsChat APIs are named ac.*. Keep the page instance this limited to state and this.setData; call host/runtime APIs through the captured ac namespace.",
      "Use ac.navigateTo, ac.redirectTo, and ac.navigateBack for route changes.",
      "Declare required permissions in manifest.permissions.",
      "Add executable manifest.tests for the main user workflow.",
      "Run miniapp report --require-tests before pack."
    ]
  },
  "artifactContract": {
    "module": {
      "format": "ES module",
      "exportName": "default",
      "exports": "MiniAppBundle returned by defineMiniApp",
      "allowedImports": [
        "defineMiniApp",
        "definePage"
      ],
      "manifestSchema": "agent.schema.miniAppManifest",
      "pageSchema": "agent.schema.pageDefinition"
    },
    "generatedFiles": [
      {
        "role": "source",
        "path": "<module>",
        "description": "Agent-generated mini app source module."
      },
      {
        "role": "packageRecord",
        "path": "record.json",
        "description": "Package metadata emitted only after quality gates pass."
      },
      {
        "role": "platformManifest",
        "path": "platforms.json",
        "description": "Optional multi-platform open metadata for Web, Android, iOS, and Flutter hosts."
      }
    ]
  },
  "promptInputs": [
    {
      "name": "intent",
      "required": true,
      "description": "User goal and primary workflow the mini app must satisfy."
    },
    {
      "name": "dataModel",
      "required": false,
      "description": "JSON-shaped state, lists, forms, or host data the app should render."
    },
    {
      "name": "hostApis",
      "required": false,
      "description": "Allowed host APIs from context.apis and matching permissions."
    },
    {
      "name": "acceptanceCriteria",
      "required": true,
      "description": "Executable manifest.tests steps that prove the main workflow."
    }
  ],
  "generationLoop": [
    {
      "step": "inspect",
      "command": "node scripts/miniapp.mjs agent-pack --json",
      "args": [
        "agent-pack",
        "--json"
      ],
      "output": "Read schemas, components, APIs, templates, diagnostics, and gate commands."
    },
    {
      "step": "create",
      "command": "node scripts/miniapp.mjs scaffold <templateId> <module> --json",
      "args": [
        "scaffold",
        "<templateId>",
        "<module>",
        "--json"
      ],
      "output": "Use a template when it fits, or generate a module that follows artifactContract.module."
    },
    {
      "step": "gate",
      "command": "node scripts/miniapp.mjs report <module> --require-tests --json",
      "args": [
        "report",
        "<module>",
        "--require-tests",
        "--json"
      ],
      "output": "Run validation, smoke render, manifest tests, and snapshot before packaging."
    },
    {
      "step": "repair",
      "command": "node scripts/miniapp.mjs report <module> --require-tests --json",
      "args": [
        "report",
        "<module>",
        "--require-tests",
        "--json"
      ],
      "output": "Apply diagnostics.repairs and repeat the report command until ok is true."
    },
    {
      "step": "package",
      "command": "node scripts/miniapp.mjs pack <module> --out record.json --require-tests --json",
      "args": [
        "pack",
        "<module>",
        "--out",
        "record.json",
        "--require-tests",
        "--json"
      ],
      "output": "Emit the package record consumed by native SDKs and the mini app container."
    }
  ],
  "qualityGates": [
    {
      "id": "schema",
      "command": "node scripts/miniapp.mjs validate <module> --smoke --json",
      "args": [
        "validate",
        "<module>",
        "--smoke",
        "--json"
      ],
      "passWhen": "ok is true and smoke.nonEmptyHtml is true"
    },
    {
      "id": "manifestTests",
      "command": "node scripts/miniapp.mjs report <module> --require-tests --json",
      "args": [
        "report",
        "<module>",
        "--require-tests",
        "--json"
      ],
      "passWhen": "tests.ok is true and tests.count is greater than 0"
    },
    {
      "id": "snapshot",
      "command": "node scripts/miniapp.mjs snapshot <module> --json",
      "args": [
        "snapshot",
        "<module>",
        "--json"
      ],
      "passWhen": "htmlBytes is greater than 0 and components match the intended UI"
    },
    {
      "id": "package",
      "command": "node scripts/miniapp.mjs pack <module> --out record.json --require-tests --json",
      "args": [
        "pack",
        "<module>",
        "--out",
        "record.json",
        "--require-tests",
        "--json"
      ],
      "passWhen": "ok is true and outputFile exists"
    }
  ],
  "repairPolicy": {
    "sourceOfTruth": "report.nextActions and report.diagnostics.repairs",
    "retryUntil": "report.ok is true",
    "stopWhen": [
      "The same issue code and path repeats after a repair attempt.",
      "The requested host API is absent from context.apis.",
      "The user intent requires unsupported native capability."
    ]
  },
  "hostIntegration": {
    "nativeOpenPayload": "Use the package record with packageRecordToOpenPayload(record, { path }) when opening from a host.",
    "platformManifest": "Run node scripts/miniapp.mjs platforms <module> --out platforms.json --record-out record.json --json to emit one package record plus Web, Android, iOS, and Flutter open metadata.",
    "mobileRuntimeSync": "Run npm run build:mobile-runtime && npm run build:archive-demo after changing container runtime files.",
    "mobileRuntimeCheck": "Run npm run check:mobile-runtime before shipping native SDK assets."
  }
}
