OfficeDev / teams-toolkit

Developer tools for building Teams apps
Other
466 stars 192 forks source link

Copilot Message Extension Plugin: `samplePrompts` property causes manifest validation to fail #11384

Open garrytrinder opened 7 months ago

garrytrinder commented 7 months ago

Describe the bug

In the guidance for building high quality bot based message extension it is recommended to add samplePrompts property to the app manifest. However, this results in the validateAppPackage manifest action throwing an error. The validateManifest action passes.

To Reproduce Steps to reproduce the behavior:

  1. Ensure app manifest is using 1.17
  2. Add samplePrompts array to composeExtensions.command entry

Expected behavior Manifest should be returned as valid.

Screenshots

image

Additional context

Using VS 2022 17.9.6

Logs

1 failed, 3 passed.
You can check and update your Teams app package at ./appPackage/build/appPackage.local.zip.
(×) Error: Property "samplePrompts" has not been defined and the schema does not allow additional properties.
File path: manifest.json, title: composeExtensions[0].commands[0].samplePrompts

App manifest

{
  "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json",
  "manifestVersion": "1.17",
  "version": "1.0.0",
  "id": "${{TEAMS_APP_ID}}",
  "developer": {
    "name": "Teams App, Inc.",
    "websiteUrl": "https://www.example.com",
    "privacyUrl": "https://www.example.com/termofuse",
    "termsOfUseUrl": "https://www.example.com/privacy"
  },
  "icons": {
    "color": "color-${{TEAMSFX_ENV}}.png",
    "outline": "outline.png"
  },
  "name": {
    "short": "${{APP_DISPLAY_NAME}}",
    "full": "${{APP_DISPLAY_NAME}}"
  },
  "description": {
    "short": "Product look up tool.",
    "full": "Get real-time product information and share them in a conversation. Search by product name or target audience. ${{APP_DISPLAY_NAME}} works with Microsoft 365 Chat. Find products at Contoso. Find Contoso products called mark8. Find Contoso products named mark8. Find Contoso products related to Mark8. Find Contoso products aimed at individuals. Find Contoso products aimed at businesses. Find Contoso products aimed at individuals with the name mark8. Find Contoso products aimed at businesses with the name mark8."
  },
  "accentColor": "#FFFFFF",
  "bots": [
    {
      "botId": "${{BOT_ID}}",
      "scopes": [ "personal", "team", "groupChat" ],
      "isNotificationOnly": false,
      "supportsFiles": false
    }
  ],
  "composeExtensions": [
    {
      "botId": "${{BOT_ID}}",
      "commands": [
        {
          "id": "Search",
          "type": "query",
          "title": "Products",
          "description": "Find products by name or by target audience",
          "initialRun": true,
          "fetchTask": false,
          "context": [
            "commandBox",
            "compose",
            "message"
          ],
          "parameters": [
            {
              "name": "ProductName",
              "title": "Product name",
              "description": "The name of the product as a keyword",
              "inputType": "text"
            },
            {
              "name": "TargetAudience",
              "title": "Target audience",
              "description": "Audience that the product is aimed at. Consumer products are sold to individuals. Enterprise products are sold to businesses",
              "inputType": "text"
            }
          ],
          "samplePrompts": [
            {
              "text": "Find products at Contoso"
            },
            {
              "text": "Find Contoso products aimed at individuals"
            },
            {
              "text": "Find Contoso products aimed at individuals with the name mark8"
            },
            {
              "text": "Find Contoso products aimed at businesses"
            },
            {
              "text": "Find Contoso products aimed at businesses with the name mark8"
            }
          ]
        },
        {
          "id": "SignOut",
          "type": "action",
          "title": "Sign out",
          "description": "Sign out",
          "initialRun": false,
          "fetchTask": true,
          "context": [
            "commandBox",
            "compose"
          ],
          "parameters": [
            {
              "name": "param",
              "title": "param",
              "description": ""
            }
          ]
        }
      ]
    }
  ],
  "webApplicationInfo": {
    "id": "${{BOT_ID}}",
    "resource": "api://${BOT_DOMAIN}/botid-${BOT_ID}"
  },
  "permissions": [
    "identity",
    "messageTeamMembers"
  ],
  "validDomains": [
    "token.botframework.com",
    "${{BOT_DOMAIN}}"
  ]
}
garrytrinder commented 7 months ago

I can use the Zip App Package feature as a workaround however every time I run Prepare Teams App Dependencies I get an error unless I remove the validation step.

yuqizhou77 commented 7 months ago

Thanks for reporting the issue. We are contacting with the upstream team.

PjPraveenkumar commented 7 months ago

hello @yuqizhou77 I'm also facing the same issue with teams toolkit when building the app package with Property "semanticDescription" and “Sample Prompt” in the manifest v1.17. image Could you please assist on resolving this issue with teams toolkit validate step?

yuqizhou77 commented 7 months ago

@PjPraveenkumar we are working with upstream team to fix this. For now, you could remove "teamsApp/validateAppPackage"action in teamsapp.local.yaml or teamsapp.yaml

pkbullock commented 6 months ago

I have found using the developer preview schema, in the short term allows this to work.: "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", "manifestVersion": "devPreview",

image