From 22a2639db2fe8942f7e88dd52f343d5ee99bf47b Mon Sep 17 00:00:00 2001 From: Kuojian Lu Date: Thu, 26 Sep 2024 17:17:38 +0800 Subject: [PATCH 01/32] fix: custom copilot ts templates (#12465) * fix: custom copilot ts templates * fix: upgrade @types/node as well --- .../custom-copilot-assistant-assistants-api/package.json.tpl | 2 +- templates/ts/custom-copilot-assistant-new/package.json.tpl | 2 +- templates/ts/custom-copilot-basic/package.json.tpl | 2 +- .../ts/custom-copilot-rag-azure-ai-search/package.json.tpl | 4 ++-- templates/ts/custom-copilot-rag-custom-api/package.json.tpl | 2 +- templates/ts/custom-copilot-rag-customize/package.json.tpl | 4 ++-- templates/ts/custom-copilot-rag-microsoft365/package.json.tpl | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/templates/ts/custom-copilot-assistant-assistants-api/package.json.tpl b/templates/ts/custom-copilot-assistant-assistants-api/package.json.tpl index 7e9278decc..0d289ccb78 100644 --- a/templates/ts/custom-copilot-assistant-assistants-api/package.json.tpl +++ b/templates/ts/custom-copilot-assistant-assistants-api/package.json.tpl @@ -36,7 +36,7 @@ "@types/node": "^18.0.0", "env-cmd": "^10.1.0", "ts-node": "^10.4.0", - "typescript": "^4.4.4", + "typescript": "^5.5.4", "nodemon": "^2.0.7", "shx": "^0.3.3" } diff --git a/templates/ts/custom-copilot-assistant-new/package.json.tpl b/templates/ts/custom-copilot-assistant-new/package.json.tpl index d581a2ee3c..4b8d19e4c5 100644 --- a/templates/ts/custom-copilot-assistant-new/package.json.tpl +++ b/templates/ts/custom-copilot-assistant-new/package.json.tpl @@ -35,7 +35,7 @@ "@types/node": "^18.0.0", "env-cmd": "^10.1.0", "ts-node": "^10.4.0", - "typescript": "^4.4.4", + "typescript": "^5.5.4", "nodemon": "^2.0.7", "shx": "^0.3.3" } diff --git a/templates/ts/custom-copilot-basic/package.json.tpl b/templates/ts/custom-copilot-basic/package.json.tpl index d581a2ee3c..4b8d19e4c5 100644 --- a/templates/ts/custom-copilot-basic/package.json.tpl +++ b/templates/ts/custom-copilot-basic/package.json.tpl @@ -35,7 +35,7 @@ "@types/node": "^18.0.0", "env-cmd": "^10.1.0", "ts-node": "^10.4.0", - "typescript": "^4.4.4", + "typescript": "^5.5.4", "nodemon": "^2.0.7", "shx": "^0.3.3" } diff --git a/templates/ts/custom-copilot-rag-azure-ai-search/package.json.tpl b/templates/ts/custom-copilot-rag-azure-ai-search/package.json.tpl index 575055b1bf..194ca8260c 100644 --- a/templates/ts/custom-copilot-rag-azure-ai-search/package.json.tpl +++ b/templates/ts/custom-copilot-rag-azure-ai-search/package.json.tpl @@ -35,10 +35,10 @@ }, "devDependencies": { "@types/restify": "^8.5.5", - "@types/node": "^14.0.0", + "@types/node": "^18.0.0", "env-cmd": "^10.1.0", "ts-node": "^10.4.0", - "typescript": "^4.4.4", + "typescript": "^5.5.4", "nodemon": "^2.0.7", "shx": "^0.3.3" } diff --git a/templates/ts/custom-copilot-rag-custom-api/package.json.tpl b/templates/ts/custom-copilot-rag-custom-api/package.json.tpl index 806d201894..9ced9bcd1e 100644 --- a/templates/ts/custom-copilot-rag-custom-api/package.json.tpl +++ b/templates/ts/custom-copilot-rag-custom-api/package.json.tpl @@ -39,7 +39,7 @@ "@types/node": "^18.0.0", "env-cmd": "^10.1.0", "ts-node": "^10.4.0", - "typescript": "^4.4.4", + "typescript": "^5.5.4", "nodemon": "^2.0.7", "shx": "^0.3.3" } diff --git a/templates/ts/custom-copilot-rag-customize/package.json.tpl b/templates/ts/custom-copilot-rag-customize/package.json.tpl index 2989836c72..b9e189c48c 100644 --- a/templates/ts/custom-copilot-rag-customize/package.json.tpl +++ b/templates/ts/custom-copilot-rag-customize/package.json.tpl @@ -33,10 +33,10 @@ }, "devDependencies": { "@types/restify": "^8.5.5", - "@types/node": "^14.0.0", + "@types/node": "^18.0.0", "env-cmd": "^10.1.0", "ts-node": "^10.4.0", - "typescript": "^4.4.4", + "typescript": "^5.5.4", "nodemon": "^2.0.7", "shx": "^0.3.3" } diff --git a/templates/ts/custom-copilot-rag-microsoft365/package.json.tpl b/templates/ts/custom-copilot-rag-microsoft365/package.json.tpl index 36cd8871b5..866918a85c 100644 --- a/templates/ts/custom-copilot-rag-microsoft365/package.json.tpl +++ b/templates/ts/custom-copilot-rag-microsoft365/package.json.tpl @@ -34,10 +34,10 @@ }, "devDependencies": { "@types/restify": "^8.5.5", - "@types/node": "^16.0.0", + "@types/node": "^18.0.0", "env-cmd": "^10.1.0", "ts-node": "^10.4.0", - "typescript": "^4.4.4", + "typescript": "^5.5.4", "nodemon": "^2.0.7", "shx": "^0.3.3" } From fab9a69d6033ef9f4f992595185602c7fca709be Mon Sep 17 00:00:00 2001 From: rentu Date: Thu, 26 Sep 2024 16:40:02 +0800 Subject: [PATCH 02/32] perf(spec-parser): update copilotExtensions to copilotAgents --- packages/spec-parser/src/manifestUpdater.ts | 33 +- .../spec-parser/test/manifestUpdater.test.ts | 386 ++++++++++++++++-- 2 files changed, 385 insertions(+), 34 deletions(-) diff --git a/packages/spec-parser/src/manifestUpdater.ts b/packages/spec-parser/src/manifestUpdater.ts index d49a8bdd9b..018884f9f4 100644 --- a/packages/spec-parser/src/manifestUpdater.ts +++ b/packages/spec-parser/src/manifestUpdater.ts @@ -40,16 +40,29 @@ export class ManifestUpdater { ): Promise<[TeamsAppManifest, PluginManifestSchema, WarningResult[]]> { const manifest: TeamsAppManifest = await fs.readJSON(manifestPath); const apiPluginRelativePath = ManifestUpdater.getRelativePath(manifestPath, apiPluginFilePath); - manifest.copilotExtensions = manifest.copilotExtensions || {}; - // Insert plugins in manifest.json if it is plugin for Copilot. - if (!options.isGptPlugin) { - manifest.copilotExtensions.plugins = [ - { - file: apiPluginRelativePath, - id: ConstantString.DefaultPluginId, - }, - ]; - ManifestUpdater.updateManifestDescription(manifest, spec); + + if (manifest.copilotExtensions) { + if (!options.isGptPlugin) { + manifest.copilotExtensions.plugins = [ + { + file: apiPluginRelativePath, + id: ConstantString.DefaultPluginId, + }, + ]; + ManifestUpdater.updateManifestDescription(manifest, spec); + } + } else { + (manifest as any).copilotAgents = (manifest as any).copilotAgents || {}; + + if (!options.isGptPlugin) { + (manifest as any).copilotAgents.plugins = [ + { + file: apiPluginRelativePath, + id: ConstantString.DefaultPluginId, + }, + ]; + ManifestUpdater.updateManifestDescription(manifest, spec); + } } const appName = this.removeEnvs(manifest.name.short); diff --git a/packages/spec-parser/test/manifestUpdater.test.ts b/packages/spec-parser/test/manifestUpdater.test.ts index f492575434..70f444f042 100644 --- a/packages/spec-parser/test/manifestUpdater.test.ts +++ b/packages/spec-parser/test/manifestUpdater.test.ts @@ -62,7 +62,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -190,7 +190,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -348,7 +348,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -489,7 +489,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -679,7 +679,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -929,7 +929,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -1102,7 +1102,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -1251,7 +1251,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -1390,7 +1390,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -1534,7 +1534,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -1666,7 +1666,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -1827,7 +1827,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -1983,7 +1983,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -2110,7 +2110,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -2245,7 +2245,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -2368,7 +2368,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "Original Full Description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -2552,7 +2552,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "Original Full Description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -2704,7 +2704,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "Original Full Description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -2860,7 +2860,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -3035,7 +3035,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -3171,7 +3171,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -3337,7 +3337,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name${{TestEnv}}", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -3469,7 +3469,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -3557,7 +3557,7 @@ describe("updateManifestWithAiPlugin", () => { const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, - copilotExtensions: { + copilotAgents: { plugins: [ { file: "ai-plugin.json", @@ -3830,6 +3830,172 @@ describe("updateManifestWithAiPlugin", () => { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "Original Short Description", full: "Original Full Description" }, }; + const expectedManifest = { + name: { short: "Original Name", full: "Original Full Name" }, + description: { short: "My API", full: "My API description" }, + copilotAgents: { + plugins: [ + { + file: "ai-plugin.json", + id: "plugin_1", + }, + ], + }, + }; + const originalPluginManifest = { + $schema: ConstantString.PluginManifestSchema, + schema_version: "v2.1", + name_for_human: "Original Name", + namespace: "originalname", + description_for_human: "My API description", + runtimes: [ + { + type: "OpenApi", + auth: { + type: "None", + }, + spec: { + url: relativePath, + }, + run_for_functions: ["createPet"], + }, + ], + }; + + const expectedPlugins: PluginManifestSchema = { + $schema: ConstantString.PluginManifestSchema, + schema_version: "v2.1", + name_for_human: "Original Name", + namespace: "originalname", + description_for_human: "My API description", + functions: [ + { + name: "createPet", + description: "Create a new pet in the store", + }, + ], + runtimes: [ + { + type: "OpenApi", + auth: { + type: "None", + }, + spec: { + url: "spec/outputSpec.yaml", + }, + run_for_functions: ["createPet"], + }, + ], + }; + sinon.stub(fs, "readJSON").callsFake(async (path) => { + if (path === manifestPath) { + return Promise.resolve(originalManifest); + } else if (path === existingPluginManifestPath) { + return Promise.resolve(originalPluginManifest); + } else { + return Promise.resolve({}); + } + }); + sinon + .stub(fs, "pathExists") + .withArgs(manifestPath) + .resolves(true) + .withArgs(pluginFilePath) + .resolves(false) + .withArgs(existingPluginManifestPath) + .resolves(true); + + const options: ParseOptions = { + allowMethods: ["get", "post"], + }; + const [manifest, apiPlugin, warnings] = await ManifestUpdater.updateManifestWithAiPlugin( + manifestPath, + outputSpecPath, + pluginFilePath, + spec, + options, + undefined, + { + manifestPath: existingPluginManifestPath, + specPath: specPath, + } + ); + + expect(manifest).to.deep.equal(expectedManifest); + expect(apiPlugin).to.deep.equal(expectedPlugins); + expect(warnings).to.deep.equal([]); + }); + + it("should update existing manifest and use old copilotExtensions property if it exist", async () => { + const spec: any = { + openapi: "3.0.2", + info: { + title: "My API", + description: "My API description", + }, + servers: [ + { + url: "/v3", + }, + ], + paths: { + "/pets": { + post: { + operationId: "createPet", + summary: "Create a pet", + description: "Create a new pet in the store", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + required: ["name"], + properties: { + name: { + type: "string", + description: "Name of the pet", + }, + age: { + type: "string", + description: "Date time of the pet", + format: "date-time", + }, + status: { + type: "string", + description: "Status of the pet", + enum: ["available", "pending", "sold"], + }, + arrayProp: { + type: "array", + items: { + type: "string", + description: "Prop of the pet", + format: "date-time", + default: "2021-01-01T00:00:00Z", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }; + const manifestPath = "/path/to/your/manifest.json"; + const outputSpecPath = "/path/to/your/spec/outputSpec.yaml"; + const pluginFilePath = "/path/to/your/ai-plugin.json"; + const existingPluginManifestPath = "/path/to/your/pluginManifest.json"; + const specPath = "/path/to/your/spec.yaml"; + const relativePath = ManifestUpdater.getRelativePath(existingPluginManifestPath, specPath); + const originalManifest = { + name: { short: "Original Name", full: "Original Full Name" }, + description: { short: "Original Short Description", full: "Original Full Description" }, + copilotExtensions: { + plugins: [{ file: "ai-plugin-old.json", id: "plugin_1" }], + }, + }; const expectedManifest = { name: { short: "Original Name", full: "Original Full Name" }, description: { short: "My API", full: "My API description" }, @@ -3925,6 +4091,178 @@ describe("updateManifestWithAiPlugin", () => { expect(apiPlugin).to.deep.equal(expectedPlugins); expect(warnings).to.deep.equal([]); }); + + it("should not change manifest if it is declarative copilot", async () => { + const spec: any = { + openapi: "3.0.2", + info: { + title: "My API", + description: "My API description", + }, + servers: [ + { + url: "/v3", + }, + ], + paths: { + "/pets": { + post: { + operationId: "createPet", + summary: "Create a pet", + description: "Create a new pet in the store", + requestBody: { + content: { + "application/json": { + schema: { + type: "object", + required: ["name"], + properties: { + name: { + type: "string", + description: "Name of the pet", + }, + age: { + type: "string", + description: "Date time of the pet", + format: "date-time", + }, + status: { + type: "string", + description: "Status of the pet", + enum: ["available", "pending", "sold"], + }, + arrayProp: { + type: "array", + items: { + type: "string", + description: "Prop of the pet", + format: "date-time", + default: "2021-01-01T00:00:00Z", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }; + const manifestPath = "/path/to/your/manifest.json"; + const outputSpecPath = "/path/to/your/spec/outputSpec.yaml"; + const pluginFilePath = "/path/to/your/ai-plugin.json"; + const existingPluginManifestPath = "/path/to/your/pluginManifest.json"; + const specPath = "/path/to/your/spec.yaml"; + const relativePath = ManifestUpdater.getRelativePath(existingPluginManifestPath, specPath); + const originalManifest = { + name: { short: "Original Name", full: "Original Full Name" }, + description: { short: "Original Short Description", full: "Original Full Description" }, + copilotExtensions: { + declarativeCopilots: [ + { + id: "repairDeclarativeCopilot", + file: "repairDeclarativeCopilot.json", + }, + ], + }, + }; + const expectedManifest = { + name: { short: "Original Name", full: "Original Full Name" }, + description: { short: "Original Short Description", full: "Original Full Description" }, + copilotExtensions: { + declarativeCopilots: [ + { + id: "repairDeclarativeCopilot", + file: "repairDeclarativeCopilot.json", + }, + ], + }, + }; + const originalPluginManifest = { + $schema: ConstantString.PluginManifestSchema, + schema_version: "v2.1", + name_for_human: "Original Name", + namespace: "originalname", + description_for_human: "My API description", + runtimes: [ + { + type: "OpenApi", + auth: { + type: "None", + }, + spec: { + url: relativePath, + }, + run_for_functions: ["createPet"], + }, + ], + }; + + const expectedPlugins: PluginManifestSchema = { + $schema: ConstantString.PluginManifestSchema, + schema_version: "v2.1", + name_for_human: "Original Name", + namespace: "originalname", + description_for_human: "My API description", + functions: [ + { + name: "createPet", + description: "Create a new pet in the store", + }, + ], + runtimes: [ + { + type: "OpenApi", + auth: { + type: "None", + }, + spec: { + url: "spec/outputSpec.yaml", + }, + run_for_functions: ["createPet"], + }, + ], + }; + sinon.stub(fs, "readJSON").callsFake(async (path) => { + if (path === manifestPath) { + return Promise.resolve(originalManifest); + } else if (path === existingPluginManifestPath) { + return Promise.resolve(originalPluginManifest); + } else { + return Promise.resolve({}); + } + }); + sinon + .stub(fs, "pathExists") + .withArgs(manifestPath) + .resolves(true) + .withArgs(pluginFilePath) + .resolves(false) + .withArgs(existingPluginManifestPath) + .resolves(true); + + const options: ParseOptions = { + allowMethods: ["get", "post"], + isGptPlugin: true, + }; + const [manifest, apiPlugin, warnings] = await ManifestUpdater.updateManifestWithAiPlugin( + manifestPath, + outputSpecPath, + pluginFilePath, + spec, + options, + undefined, + { + manifestPath: existingPluginManifestPath, + specPath: specPath, + } + ); + + expect(manifest).to.deep.equal(expectedManifest); + expect(apiPlugin).to.deep.equal(expectedPlugins); + expect(warnings).to.deep.equal([]); + }); }); describe("manifestUpdater", () => { From f5c09e2090bc63afd769836a6fc7d79be15edcfc Mon Sep 17 00:00:00 2001 From: Chenyi An Date: Thu, 26 Sep 2024 15:11:07 +0800 Subject: [PATCH 03/32] fix: copilot agents naming --- .../fx-core/src/common/projectTypeChecker.ts | 14 + .../driver/teamsApp/createAppPackage.ts | 34 ++- .../teamsApp/utils/CopilotGptManifestUtils.ts | 4 +- .../driver/teamsApp/utils/ManifestUtils.ts | 4 +- .../src/component/driver/teamsApp/validate.ts | 16 +- packages/fx-core/src/core/FxCore.ts | 4 +- .../tests/common/projectTypeChecker.test.ts | 14 + .../teamsApp/copilotGptManifest.test.ts | 59 ++++ .../driver/teamsApp/createAppPackage.test.ts | 252 ++++++++++++++++++ .../driver/teamsApp/manifestUtils.test.ts | 87 ++++++ .../driver/teamsApp/validate.test.ts | 103 +++++++ packages/fx-core/tests/core/FxCore.test.ts | 213 +++++++++++++++ .../templates/appPackage/de.json | 8 + packages/manifest/src/index.ts | 17 ++ packages/manifest/src/manifest.ts | 12 + .../src/utils/autoOpenHelper.ts | 7 +- .../test/utils/autoOpenHelper.test.ts | 118 +++++++- 17 files changed, 950 insertions(+), 16 deletions(-) create mode 100644 packages/fx-core/tests/plugins/resource/appstudio/resources-multi-env/templates/appPackage/de.json diff --git a/packages/fx-core/src/common/projectTypeChecker.ts b/packages/fx-core/src/common/projectTypeChecker.ts index 0a265a6fac..30f9703577 100644 --- a/packages/fx-core/src/common/projectTypeChecker.ts +++ b/packages/fx-core/src/common/projectTypeChecker.ts @@ -279,6 +279,20 @@ export function getCapabilities(manifest: any): string[] { ) { capabilities.push("copilotGpt"); } + if ( + manifest.copilotAgents?.plugins && + manifest.copilotAgents.plugins.length > 0 && + !capabilities.includes("plugin") + ) { + capabilities.push("plugin"); + } + if ( + manifest.copilotAgents?.declarativeAgents && + manifest.copilotAgents.declarativeAgents.length > 0 && + !capabilities.includes("copilotGpt") + ) { + capabilities.push("copilotGpt"); + } return capabilities; } export const projectTypeChecker = new ProjectTypeChecker(); diff --git a/packages/fx-core/src/component/driver/teamsApp/createAppPackage.ts b/packages/fx-core/src/component/driver/teamsApp/createAppPackage.ts index d84d143200..79ab167922 100644 --- a/packages/fx-core/src/component/driver/teamsApp/createAppPackage.ts +++ b/packages/fx-core/src/component/driver/teamsApp/createAppPackage.ts @@ -139,6 +139,19 @@ export class CreateAppPackageDriver implements StepDriver { } } } + if (manifest.localizationInfo && manifest.localizationInfo.defaultLanguageFile) { + const file = manifest.localizationInfo.defaultLanguageFile; + const fileName = `${appDirectory}/${file}`; + if (!(await fs.pathExists(fileName))) { + return err( + new FileNotFoundError( + actionName, + fileName, + "https://aka.ms/teamsfx-actions/teamsapp-zipAppPackage" + ) + ); + } + } const zip = new AdmZip(); zip.addFile(Constants.MANIFEST_FILE, Buffer.from(JSON.stringify(manifest, null, 4))); @@ -166,6 +179,16 @@ export class CreateAppPackageDriver implements StepDriver { zip.addLocalFile(fileName, dir === "." ? "" : dir); } } + if (manifest.localizationInfo && manifest.localizationInfo.defaultLanguageFile) { + const file = manifest.localizationInfo.defaultLanguageFile; + const fileName = path.resolve(appDirectory, file); + const relativePath = path.relative(appDirectory, fileName); + if (relativePath.startsWith("..")) { + return err(new InvalidFileOutsideOfTheDirectotryError(fileName)); + } + const dir = path.dirname(file); + zip.addLocalFile(fileName, dir === "." ? "" : dir); + } // API ME, API specification and Adaptive card templates if ( @@ -218,9 +241,11 @@ export class CreateAppPackageDriver implements StepDriver { } } - const plugins = manifest.copilotExtensions?.plugins; - // API plugin + const plugins = manifest.copilotExtensions + ? manifest.copilotExtensions.plugins + : manifest.copilotAgents?.plugins; if (plugins?.length && plugins[0].file) { + // API plugin const addFilesRes = await this.addPlugin( zip, plugins[0].file, @@ -233,8 +258,9 @@ export class CreateAppPackageDriver implements StepDriver { } } - const declarativeCopilots = manifest.copilotExtensions?.declarativeCopilots; - + const declarativeCopilots = manifest.copilotExtensions + ? manifest.copilotExtensions.declarativeCopilots + : manifest.copilotAgents?.declarativeAgents; // Copilot GPT if (declarativeCopilots?.length && declarativeCopilots[0].file) { const copilotGptManifestFile = path.resolve(appDirectory, declarativeCopilots[0].file); diff --git a/packages/fx-core/src/component/driver/teamsApp/utils/CopilotGptManifestUtils.ts b/packages/fx-core/src/component/driver/teamsApp/utils/CopilotGptManifestUtils.ts index 3f8a33622a..21e109f74c 100644 --- a/packages/fx-core/src/component/driver/teamsApp/utils/CopilotGptManifestUtils.ts +++ b/packages/fx-core/src/component/driver/teamsApp/utils/CopilotGptManifestUtils.ts @@ -152,7 +152,9 @@ export class CopilotGptManifestUtils { if (teamsManifestRes.isErr()) { return err(teamsManifestRes.error); } - const filePath = teamsManifestRes.value.copilotExtensions?.declarativeCopilots?.[0].file; + const filePath = teamsManifestRes.value.copilotExtensions + ? teamsManifestRes.value.copilotExtensions.declarativeCopilots?.[0].file + : teamsManifestRes.value.copilotAgents?.declarativeAgents?.[0].file; if (!filePath) { return err( AppStudioResultFactory.UserError( diff --git a/packages/fx-core/src/component/driver/teamsApp/utils/ManifestUtils.ts b/packages/fx-core/src/component/driver/teamsApp/utils/ManifestUtils.ts index f8c1bb3970..aa223e2968 100644 --- a/packages/fx-core/src/component/driver/teamsApp/utils/ManifestUtils.ts +++ b/packages/fx-core/src/component/driver/teamsApp/utils/ManifestUtils.ts @@ -315,7 +315,9 @@ export class ManifestUtils { manifest: TeamsAppManifest, manifestPath: string ): Promise> { - const pluginFile = manifest.copilotExtensions?.plugins?.[0]?.file; + const pluginFile = manifest.copilotExtensions + ? manifest.copilotExtensions.plugins?.[0]?.file + : manifest.copilotAgents?.plugins?.[0]?.file; if (pluginFile) { const plugin = path.resolve(path.dirname(manifestPath), pluginFile); const doesFileExist = await fs.pathExists(plugin); diff --git a/packages/fx-core/src/component/driver/teamsApp/validate.ts b/packages/fx-core/src/component/driver/teamsApp/validate.ts index b7f4fe2465..1d26c57f53 100644 --- a/packages/fx-core/src/component/driver/teamsApp/validate.ts +++ b/packages/fx-core/src/component/driver/teamsApp/validate.ts @@ -99,9 +99,11 @@ export class ValidateManifestDriver implements StepDriver { let declarativeCopilotValidationResult; let pluginValidationResult; let pluginPath = ""; - if (manifest.copilotExtensions) { + if (manifest.copilotExtensions || manifest.copilotAgents) { // plugin - const plugins = manifest.copilotExtensions.plugins; + const plugins = manifest.copilotExtensions + ? manifest.copilotExtensions.plugins + : manifest.copilotAgents!.plugins; if (plugins?.length && plugins[0].file) { pluginPath = path.join(path.dirname(manifestPath), plugins[0].file); @@ -122,15 +124,17 @@ export class ValidateManifestDriver implements StepDriver { } // Declarative Copilot - const declaraitveCopilots = manifest.copilotExtensions.declarativeCopilots; - if (declaraitveCopilots?.length && declaraitveCopilots[0].file) { + const declarativeCopilots = manifest.copilotExtensions + ? manifest.copilotExtensions.declarativeCopilots + : manifest.copilotAgents!.declarativeAgents; + if (declarativeCopilots?.length && declarativeCopilots[0].file) { const declarativeCopilotPath = path.join( path.dirname(manifestPath), - declaraitveCopilots[0].file + declarativeCopilots[0].file ); const declarativeCopilotValidationRes = await copilotGptManifestUtils.validateAgainstSchema( - declaraitveCopilots[0], + declarativeCopilots[0], declarativeCopilotPath, context ); diff --git a/packages/fx-core/src/core/FxCore.ts b/packages/fx-core/src/core/FxCore.ts index 78b3062433..a12dd458f6 100644 --- a/packages/fx-core/src/core/FxCore.ts +++ b/packages/fx-core/src/core/FxCore.ts @@ -1867,7 +1867,9 @@ export class FxCore { } const teamsManifest = manifestRes.value; - const declarativeGpt = teamsManifest.copilotExtensions?.declarativeCopilots?.[0]; + const declarativeGpt = teamsManifest.copilotExtensions + ? teamsManifest.copilotExtensions.declarativeCopilots?.[0] + : teamsManifest.copilotAgents?.declarativeAgents?.[0]; if (!declarativeGpt?.file) { return err( AppStudioResultFactory.UserError( diff --git a/packages/fx-core/tests/common/projectTypeChecker.test.ts b/packages/fx-core/tests/common/projectTypeChecker.test.ts index 1b79d57676..8e84d43df6 100644 --- a/packages/fx-core/tests/common/projectTypeChecker.test.ts +++ b/packages/fx-core/tests/common/projectTypeChecker.test.ts @@ -112,6 +112,10 @@ describe("ProjectTypeChecker", () => { plugins: [1], declarativeCopilots: [1], }, + copilotAgents: { + plugins: [1], + declarativeAgents: [1], + }, }; const capabilities = getCapabilities(manifest); assert.deepEqual(capabilities, [ @@ -124,6 +128,16 @@ describe("ProjectTypeChecker", () => { "copilotGpt", ]); }); + it("copilot agents", async () => { + const manifest = { + copilotAgents: { + plugins: [1], + declarativeAgents: [1], + }, + }; + const capabilities = getCapabilities(manifest); + assert.deepEqual(capabilities, ["plugin", "copilotGpt"]); + }); it("empty manifest", async () => { const manifest = { staticTabs: [], diff --git a/packages/fx-core/tests/component/driver/teamsApp/copilotGptManifest.test.ts b/packages/fx-core/tests/component/driver/teamsApp/copilotGptManifest.test.ts index c5008765d6..57734739b8 100644 --- a/packages/fx-core/tests/component/driver/teamsApp/copilotGptManifest.test.ts +++ b/packages/fx-core/tests/component/driver/teamsApp/copilotGptManifest.test.ts @@ -428,6 +428,65 @@ describe("copilotGptManifestUtils", () => { } }); + it("get manifest success - copilot agent", async () => { + sandbox.stub(manifestUtils, "_readAppManifest").resolves( + ok({ + copilotAgents: { + declarativeAgents: [ + { + file: "test", + id: "1", + }, + ], + }, + } as any) + ); + sandbox.stub(path, "dirname").returns("testFolder"); + sandbox.stub(path, "resolve").returns("testFolder/test"); + + const res = await copilotGptManifestUtils.getManifestPath("testPath"); + + chai.assert.isTrue(res.isOk()); + if (res.isOk()) { + chai.assert.equal(res.value, "testFolder/test"); + } + }); + + it("declarativeAgents error 1", async () => { + sandbox.stub(manifestUtils, "_readAppManifest").resolves( + ok({ + copilotAgents: {}, + } as any) + ); + const res = await copilotGptManifestUtils.getManifestPath("testPath"); + chai.assert.isTrue(res.isErr()); + if (res.isErr()) { + chai.assert.isTrue(res.error instanceof UserError); + } + }); + + it("declarativeAgents error 2", async () => { + sandbox.stub(manifestUtils, "_readAppManifest").resolves(ok({} as any)); + const res = await copilotGptManifestUtils.getManifestPath("testPath"); + chai.assert.isTrue(res.isErr()); + if (res.isErr()) { + chai.assert.isTrue(res.error instanceof UserError); + } + }); + + it("declarativeCopilots error 1", async () => { + sandbox.stub(manifestUtils, "_readAppManifest").resolves( + ok({ + copilotExtensions: {}, + } as any) + ); + const res = await copilotGptManifestUtils.getManifestPath("testPath"); + chai.assert.isTrue(res.isErr()); + if (res.isErr()) { + chai.assert.isTrue(res.error instanceof UserError); + } + }); + it("read Teams manifest error", async () => { sandbox .stub(manifestUtils, "_readAppManifest") diff --git a/packages/fx-core/tests/component/driver/teamsApp/createAppPackage.test.ts b/packages/fx-core/tests/component/driver/teamsApp/createAppPackage.test.ts index 652d0d8688..cb52f92db9 100644 --- a/packages/fx-core/tests/component/driver/teamsApp/createAppPackage.test.ts +++ b/packages/fx-core/tests/component/driver/teamsApp/createAppPackage.test.ts @@ -5,6 +5,7 @@ import "mocha"; import * as sinon from "sinon"; import chai from "chai"; import fs from "fs-extra"; +import * as path from "path"; import mockedEnv, { RestoreFn } from "mocked-env"; import { CreateAppPackageDriver } from "../../../../src/component/driver/teamsApp/createAppPackage"; import { CreateAppPackageArgs } from "../../../../src/component/driver/teamsApp/interfaces/CreateAppPackageArgs"; @@ -192,6 +193,38 @@ describe("teamsApp/createAppPackage", async () => { } }); + it("should throw error if file not exists case 6", async () => { + const args: CreateAppPackageArgs = { + manifestPath: + "./tests/plugins/resource/appstudio/resources-multi-env/templates/appPackage/v3.manifest.template.json", + outputZipPath: + "./tests/plugins/resource/appstudio/resources-multi-env/build/appPackage/appPackage.dev.zip", + outputJsonPath: + "./tests/plugins/resource/appstudio/resources-multi-env/build/appPackage/manifest.dev.json", + }; + sinon.stub(fs, "pathExists").callsFake((filePath) => { + if (filePath.includes("fake.json")) { + return false; + } else { + return true; + } + }); + + const manifest = new TeamsAppManifest(); + manifest.localizationInfo = { + additionalLanguages: [{ file: "aaa", languageTag: "zh" }], + defaultLanguageTag: "en", + defaultLanguageFile: "fake.json", + }; + sinon.stub(manifestUtils, "getManifestV3").resolves(ok(manifest)); + + const result = (await teamsAppDriver.execute(args, mockedDriverContext)).result; + chai.assert(result.isErr()); + if (result.isErr()) { + chai.assert.isTrue(result.error instanceof FileNotFoundError); + } + }); + describe("api plugin error case", async () => { it("should throw error if pluginFile not exists for API plugin", async () => { const args: CreateAppPackageArgs = { @@ -522,6 +555,7 @@ describe("teamsApp/createAppPackage", async () => { file: "resources/de.json", }, ], + defaultLanguageFile: "resources/de.json", }; sinon.stub(manifestUtils, "getManifestV3").resolves(ok(manifest)); @@ -893,6 +927,82 @@ describe("teamsApp/createAppPackage", async () => { } }); + it("version >= 1.9: happy path - API plugin", async () => { + const args: CreateAppPackageArgs = { + manifestPath: + "./tests/plugins/resource/appstudio/resources-multi-env/templates/appPackage/v3.manifest.template.json", + outputZipPath: + "./tests/plugins/resource/appstudio/resources-multi-env/build/appPackage/appPackage.dev.zip", + outputFolder: "./tests/plugins/resource/appstudio/resources-multi-env/build/appPackage", + }; + + const manifest = new TeamsAppManifest(); + manifest.copilotAgents = { + plugins: [ + { + file: "resources/ai-plugin.json", + id: "plugin1", + }, + ], + declarativeAgents: [ + { + file: "resources/de.json", + id: "dc1", + }, + ], + }; + manifest.icons = { + color: "resources/color.png", + outline: "resources/outline.png", + }; + sinon.stub(manifestUtils, "getManifestV3").resolves(ok(manifest)); + sinon.stub(fs, "chmod").callsFake(async () => {}); + const writeFileStub = sinon.stub(fs, "writeFile").callsFake(async () => {}); + + const result = (await teamsAppDriver.execute(args, mockedDriverContext)).result; + if (result.isErr()) { + console.log(result.error); + } + chai.assert.isTrue(result.isOk()); + const outputExist = await fs.pathExists(args.outputZipPath); + chai.assert.isTrue(outputExist); + chai.assert.isTrue(writeFileStub.calledThrice); + if (outputExist) { + const zip = new AdmZip(args.outputZipPath); + let aiPluginContent = ""; + let openapiContent = ""; + let declarativeAgentsContent = ""; + + const entries = zip.getEntries(); + entries.forEach((e) => { + const name = e.entryName; + if (name.endsWith("ai-plugin.json")) { + const data = e.getData(); + aiPluginContent = data.toString("utf8"); + } + + if (name.endsWith("openai.yml")) { + const data = e.getData(); + openapiContent = data.toString("utf8"); + } + + if (name.endsWith("de.json")) { + const data = e.getData(); + declarativeAgentsContent = data.toString("utf8"); + } + }); + + chai.assert( + openapiContent && + aiPluginContent && + openapiContent.search("APP_NAME_SUFFIX") < 0 && + aiPluginContent.search(openapiServerPlaceholder) < 0 && + declarativeAgentsContent + ); + await fs.remove(args.outputZipPath); + } + }); + it("invalid color file", async () => { const args: CreateAppPackageArgs = { manifestPath: @@ -1326,5 +1436,147 @@ describe("teamsApp/createAppPackage", async () => { ); } }); + + it("relative path error 1", async () => { + const args: CreateAppPackageArgs = { + manifestPath: + "./tests/plugins/resource/appstudio/resources-multi-env/templates/appPackage/v3.manifest.template.json", + outputZipPath: + "./tests/plugins/resource/appstudio/resources-multi-env/build/appPackage/appPackage.dev.zip", + outputFolder: "./tests/plugins/resource/appstudio/resources-multi-env/build/appPackage", + }; + + const manifest = new TeamsAppManifest(); + manifest.localizationInfo = { + defaultLanguageTag: "en", + additionalLanguages: [ + { + languageTag: "de", + file: "../migrate.manifest.json", + }, + ], + defaultLanguageFile: "resources/de.json", + }; + manifest.icons = { + color: "resources/color.png", + outline: "resources/outline.png", + }; + sinon.stub(manifestUtils, "getManifestV3").resolves(ok(manifest)); + sinon.stub(fs, "pathExists").resolves(true); + sinon.stub(fs, "chmod").callsFake(async () => {}); + const writeFileStub = sinon.stub(fs, "writeFile").callsFake(async () => {}); + + const result = (await teamsAppDriver.execute(args, mockedDriverContext)).result; + if (result.isErr()) { + chai.assert.isTrue(result.error instanceof InvalidFileOutsideOfTheDirectotryError); + } + }); + + it("relative path error 2", async () => { + const args: CreateAppPackageArgs = { + manifestPath: + "./tests/plugins/resource/appstudio/resources-multi-env/templates/appPackage/v3.manifest.template.json", + outputZipPath: + "./tests/plugins/resource/appstudio/resources-multi-env/build/appPackage/appPackage.dev.zip", + outputFolder: "./tests/plugins/resource/appstudio/resources-multi-env/build/appPackage", + }; + + const manifest = new TeamsAppManifest(); + manifest.localizationInfo = { + defaultLanguageTag: "en", + additionalLanguages: [ + { + languageTag: "de", + file: "resources/de.json", + }, + ], + defaultLanguageFile: "../migrate.manifest.json", + }; + manifest.icons = { + color: "resources/color.png", + outline: "resources/outline.png", + }; + sinon.stub(manifestUtils, "getManifestV3").resolves(ok(manifest)); + sinon.stub(fs, "pathExists").resolves(true); + sinon.stub(fs, "chmod").callsFake(async () => {}); + const writeFileStub = sinon.stub(fs, "writeFile").callsFake(async () => {}); + + const result = (await teamsAppDriver.execute(args, mockedDriverContext)).result; + if (result.isErr()) { + chai.assert.isTrue(result.error instanceof InvalidFileOutsideOfTheDirectotryError); + } + }); + + it("zip same level dir", async () => { + const args: CreateAppPackageArgs = { + manifestPath: + "./tests/plugins/resource/appstudio/resources-multi-env/templates/appPackage/v3.manifest.template.json", + outputZipPath: + "./tests/plugins/resource/appstudio/resources-multi-env/build/appPackage/appPackage.dev.zip", + outputFolder: "./tests/plugins/resource/appstudio/resources-multi-env/build/appPackage", + }; + + const manifest = new TeamsAppManifest(); + manifest.composeExtensions = [ + { + composeExtensionType: "apiBased", + apiSpecificationFile: "resources/openai.yml", + commands: [ + { + id: "GET /repairs", + apiResponseRenderingTemplateFile: "resources/repairs.json", + title: "fake", + }, + ], + botId: "", + }, + ]; + manifest.icons = { + color: "resources/color.png", + outline: "resources/outline.png", + }; + manifest.localizationInfo = { + defaultLanguageTag: "en", + additionalLanguages: [ + { + languageTag: "de", + file: "de.json", + }, + ], + defaultLanguageFile: "de.json", + }; + sinon.stub(manifestUtils, "getManifestV3").resolves(ok(manifest)); + + sinon.stub(fs, "chmod").callsFake(async () => {}); + const writeFileStub = sinon.stub(fs, "writeFile").callsFake(async () => {}); + + const result = (await teamsAppDriver.execute(args, mockedDriverContext)).result; + chai.assert(result.isOk()); + chai.assert(writeFileStub.calledOnce); + if (await fs.pathExists(args.outputZipPath)) { + const zip = new AdmZip(args.outputZipPath); + + let openapiContent = ""; + + const entries = zip.getEntries(); + for (const e of entries) { + const name = e.entryName; + + if (name.endsWith("openai.yml")) { + const data = e.getData(); + openapiContent = data.toString("utf8"); + break; + } + } + + chai.assert( + openapiContent != undefined && + openapiContent.length > 0 && + openapiContent.search(fakeUrl) >= 0 && + openapiContent.search(openapiServerPlaceholder) < 0 + ); + await fs.remove(args.outputZipPath); + } + }); }); }); diff --git a/packages/fx-core/tests/component/driver/teamsApp/manifestUtils.test.ts b/packages/fx-core/tests/component/driver/teamsApp/manifestUtils.test.ts index a20dbe66f6..f05da7055e 100644 --- a/packages/fx-core/tests/component/driver/teamsApp/manifestUtils.test.ts +++ b/packages/fx-core/tests/component/driver/teamsApp/manifestUtils.test.ts @@ -14,6 +14,7 @@ import { Platform, ManifestCapability, IBot, + UserError, } from "@microsoft/teamsfx-api"; import { getBotsTplBasedOnVersion, @@ -251,6 +252,92 @@ describe("ManifestUtils", () => { const result = await manifestUtils.addCapabilities(inputs, capabilities); assert.isTrue(result.isOk()); }); + it("getPluginFilePath success", async () => { + const mockManifest = { + copilotAgents: { + plugins: [ + { + id: "id-fake", + file: "fake", + }, + ], + }, + }; + sinon.stub(manifestUtils, "_readAppManifest").resolves(ok(mockManifest as any)); + sinon.stub(fs, "pathExists").resolves(true); + const res = await manifestUtils.getPluginFilePath(mockManifest as any, "fake"); + assert.isTrue(res.isOk()); + }); + it("getPluginFilePath error 1", async () => { + const mockManifest = {}; + sinon.stub(manifestUtils, "_readAppManifest").resolves(ok(mockManifest as any)); + const res = await manifestUtils.getPluginFilePath(mockManifest as any, "fake"); + assert.isTrue(res.isErr()); + if (res.isErr()) { + assert.isTrue(res.error instanceof UserError); + } + }); + it("getPluginFilePath error 2", async () => { + const mockManifest = { + copilotAgents: {}, + }; + sinon.stub(manifestUtils, "_readAppManifest").resolves(ok(mockManifest as any)); + const res = await manifestUtils.getPluginFilePath(mockManifest as any, "fake"); + assert.isTrue(res.isErr()); + if (res.isErr()) { + assert.isTrue(res.error instanceof UserError); + } + }); + it("getPluginFilePath error 3", async () => { + const mockManifest = { + copilotAgents: { + plugins: [], + }, + }; + sinon.stub(manifestUtils, "_readAppManifest").resolves(ok(mockManifest as any)); + const res = await manifestUtils.getPluginFilePath(mockManifest as any, "fake"); + assert.isTrue(res.isErr()); + if (res.isErr()) { + assert.isTrue(res.error instanceof UserError); + } + }); + it("getPluginFilePath error 4", async () => { + const mockManifest = { + copilotAgents: { + plugins: [undefined], + }, + }; + sinon.stub(manifestUtils, "_readAppManifest").resolves(ok(mockManifest as any)); + const res = await manifestUtils.getPluginFilePath(mockManifest as any, "fake"); + assert.isTrue(res.isErr()); + if (res.isErr()) { + assert.isTrue(res.error instanceof UserError); + } + }); + it("getPluginFilePath error 5", async () => { + const mockManifest = { + copilotExtensions: {}, + }; + sinon.stub(manifestUtils, "_readAppManifest").resolves(ok(mockManifest as any)); + const res = await manifestUtils.getPluginFilePath(mockManifest as any, "fake"); + assert.isTrue(res.isErr()); + if (res.isErr()) { + assert.isTrue(res.error instanceof UserError); + } + }); + it("getPluginFilePath error 6", async () => { + const mockManifest = { + copilotExtensions: { + plugins: [], + }, + }; + sinon.stub(manifestUtils, "_readAppManifest").resolves(ok(mockManifest as any)); + const res = await manifestUtils.getPluginFilePath(mockManifest as any, "fake"); + assert.isTrue(res.isErr()); + if (res.isErr()) { + assert.isTrue(res.error instanceof UserError); + } + }); }); function mockInputManifestFile(manifestUtils: ManifestUtils, manifestVersion: string) { diff --git a/packages/fx-core/tests/component/driver/teamsApp/validate.test.ts b/packages/fx-core/tests/component/driver/teamsApp/validate.test.ts index 34368e65ad..0bcfa6706a 100644 --- a/packages/fx-core/tests/component/driver/teamsApp/validate.test.ts +++ b/packages/fx-core/tests/component/driver/teamsApp/validate.test.ts @@ -281,6 +281,109 @@ describe("teamsApp/validateManifest", async () => { } }); + it("validate with errors returned - copilot agent", async () => { + const teamsManifest: TeamsAppManifest = new TeamsAppManifest(); + teamsManifest.copilotAgents = { + declarativeAgents: [ + { + id: "fakeId", + file: "fakeFile", + }, + ], + plugins: [ + { + id: "fakeId", + file: "fakeFile", + }, + ], + }; + + sinon.stub(manifestUtils, "getManifestV3").resolves(ok(teamsManifest)); + sinon.stub(ManifestUtil, "validateManifest").resolves([]); + sinon.stub(pluginManifestUtils, "validateAgainstSchema").resolves( + ok({ + id: "fakeId", + filePath: "fakeFile", + validationResult: ["error1"], + }) + ); + sinon.stub(pluginManifestUtils, "logValidationErrors").returns("errorMessage1"); + + sinon.stub(copilotGptManifestUtils, "validateAgainstSchema").resolves( + ok({ + id: "fakeId", + filePath: "fakeFile", + validationResult: ["error2"], + actionValidationResult: [ + { + id: "fakeId", + filePath: "fakeFile", + validationResult: ["error3"], + }, + ], + }) + ); + sinon.stub(copilotGptManifestUtils, "logValidationErrors").returns("errorMessage2"); + + const args: ValidateManifestArgs = { + manifestPath: + "./tests/plugins/resource/appstudio/resources-multi-env/templates/appPackage/v3.manifest.template.json", + showMessage: true, + }; + + mockedDriverContext.platform = Platform.VSCode; + mockedDriverContext.projectPath = "test"; + + const result = (await teamsAppDriver.execute(args, mockedDriverContext)).result; + chai.assert(result.isErr()); + if (result.isErr()) { + chai.assert.equal(result.error.name, AppStudioError.ValidationFailedError.name); + } + }); + + it("skip plugin validation", async () => { + const teamsManifest: TeamsAppManifest = new TeamsAppManifest(); + teamsManifest.copilotAgents = {}; + + sinon.stub(manifestUtils, "getManifestV3").resolves(ok(teamsManifest)); + sinon.stub(ManifestUtil, "validateManifest").resolves([]); + sinon.stub(pluginManifestUtils, "validateAgainstSchema").resolves( + ok({ + id: "fakeId", + filePath: "fakeFile", + validationResult: ["error1"], + }) + ); + sinon.stub(pluginManifestUtils, "logValidationErrors").returns("errorMessage1"); + + sinon.stub(copilotGptManifestUtils, "validateAgainstSchema").resolves( + ok({ + id: "fakeId", + filePath: "fakeFile", + validationResult: ["error2"], + actionValidationResult: [ + { + id: "fakeId", + filePath: "fakeFile", + validationResult: ["error3"], + }, + ], + }) + ); + sinon.stub(copilotGptManifestUtils, "logValidationErrors").returns("errorMessage2"); + + const args: ValidateManifestArgs = { + manifestPath: + "./tests/plugins/resource/appstudio/resources-multi-env/templates/appPackage/v3.manifest.template.json", + showMessage: true, + }; + + mockedDriverContext.platform = Platform.VSCode; + mockedDriverContext.projectPath = "test"; + + const result = (await teamsAppDriver.execute(args, mockedDriverContext)).result; + chai.assert(result.isOk()); + }); it("plugin manifest validation error", async () => { const teamsManifest: TeamsAppManifest = new TeamsAppManifest(); teamsManifest.copilotExtensions = { diff --git a/packages/fx-core/tests/core/FxCore.test.ts b/packages/fx-core/tests/core/FxCore.test.ts index 14703ba55b..403d2645a5 100644 --- a/packages/fx-core/tests/core/FxCore.test.ts +++ b/packages/fx-core/tests/core/FxCore.test.ts @@ -4850,6 +4850,219 @@ describe("addPlugin", async () => { } }); + it("from API spec: empty declarativeCopilots 1", async () => { + const appName = await mockV3Project(); + const inputs: Inputs = { + platform: Platform.VSCode, + [QuestionNames.Folder]: os.tmpdir(), + [QuestionNames.TeamsAppManifestFilePath]: "manifest.json", + [QuestionNames.ApiSpecLocation]: "test.yaml", + [QuestionNames.ApiOperation]: ["GET /user/{userId}"], + [QuestionNames.ApiPluginType]: ApiPluginStartOptions.apiSpec().id, + projectPath: path.join(os.tmpdir(), appName), + }; + const manifest = new TeamsAppManifest(); + manifest.copilotExtensions = {}; + sandbox.stub(validationUtils, "validateInputs").resolves(undefined); + sandbox.stub(manifestUtils, "_readAppManifest").resolves(ok(manifest)); + sandbox.stub(manifestUtils, "_writeAppManifest").resolves(ok(undefined)); + sandbox.stub(pluginGeneratorHelper, "generateScaffoldingSummary").resolves(""); + sandbox.stub(fs, "pathExists").callsFake(async (path: string) => { + if (path.endsWith("openapi_1.yaml")) { + return true; + } + if (path.endsWith("ai-plugin_1.json")) { + return true; + } + if (path.endsWith("openapi_2.yaml")) { + return false; + } + if (path.endsWith("ai-plugin_2.json")) { + return false; + } + return true; + }); + sandbox + .stub(copilotGptManifestUtils, "readCopilotGptManifestFile") + .resolves(ok({} as DeclarativeCopilotManifestSchema)); + sandbox.stub(copilotGptManifestUtils, "getManifestPath").resolves(ok("dcManifest.json")); + sandbox + .stub(copilotGptManifestUtils, "addAction") + .resolves(ok({} as DeclarativeCopilotManifestSchema)); + + const core = new FxCore(tools); + sandbox.stub(CopilotPluginHelper, "generateFromApiSpec").resolves(ok({ warnings: [] })); + + const showMessageStub = sandbox + .stub(tools.ui, "showMessage") + .callsFake((level, message, modal, items) => { + if (level == "info") { + return Promise.resolve( + ok(getLocalizedString("core.addPlugin.success.viewPluginManifest")) + ); + } else if (level === "warn") { + return Promise.resolve(ok("Add")); + } else { + throw new NotImplementedError("TEST", "showMessage"); + } + }); + + const openFileStub = sandbox.stub(tools.ui, "openFile").resolves(); + + const result = await core.addPlugin(inputs); + assert.isTrue(result.isErr()); + if (result.isErr()) { + assert.isTrue(result.error instanceof UserError); + } + }); + + it("from API spec: empty declarativeCopilots 2", async () => { + const appName = await mockV3Project(); + const inputs: Inputs = { + platform: Platform.VSCode, + [QuestionNames.Folder]: os.tmpdir(), + [QuestionNames.TeamsAppManifestFilePath]: "manifest.json", + [QuestionNames.ApiSpecLocation]: "test.yaml", + [QuestionNames.ApiOperation]: ["GET /user/{userId}"], + [QuestionNames.ApiPluginType]: ApiPluginStartOptions.apiSpec().id, + projectPath: path.join(os.tmpdir(), appName), + }; + const manifest = new TeamsAppManifest(); + manifest.copilotExtensions = { + declarativeCopilots: [], + }; + sandbox.stub(validationUtils, "validateInputs").resolves(undefined); + sandbox.stub(manifestUtils, "_readAppManifest").resolves(ok(manifest)); + sandbox.stub(manifestUtils, "_writeAppManifest").resolves(ok(undefined)); + sandbox.stub(pluginGeneratorHelper, "generateScaffoldingSummary").resolves(""); + sandbox.stub(fs, "pathExists").callsFake(async (path: string) => { + if (path.endsWith("openapi_1.yaml")) { + return true; + } + if (path.endsWith("ai-plugin_1.json")) { + return true; + } + if (path.endsWith("openapi_2.yaml")) { + return false; + } + if (path.endsWith("ai-plugin_2.json")) { + return false; + } + return true; + }); + sandbox + .stub(copilotGptManifestUtils, "readCopilotGptManifestFile") + .resolves(ok({} as DeclarativeCopilotManifestSchema)); + sandbox.stub(copilotGptManifestUtils, "getManifestPath").resolves(ok("dcManifest.json")); + sandbox + .stub(copilotGptManifestUtils, "addAction") + .resolves(ok({} as DeclarativeCopilotManifestSchema)); + + const core = new FxCore(tools); + sandbox.stub(CopilotPluginHelper, "generateFromApiSpec").resolves(ok({ warnings: [] })); + + const showMessageStub = sandbox + .stub(tools.ui, "showMessage") + .callsFake((level, message, modal, items) => { + if (level == "info") { + return Promise.resolve( + ok(getLocalizedString("core.addPlugin.success.viewPluginManifest")) + ); + } else if (level === "warn") { + return Promise.resolve(ok("Add")); + } else { + throw new NotImplementedError("TEST", "showMessage"); + } + }); + + const openFileStub = sandbox.stub(tools.ui, "openFile").resolves(); + + const result = await core.addPlugin(inputs); + assert.isTrue(result.isErr()); + if (result.isErr()) { + assert.isTrue(result.error instanceof UserError); + } + }); + + it("from API spec: add action success - copilot agent", async () => { + const appName = await mockV3Project(); + const inputs: Inputs = { + platform: Platform.VSCode, + [QuestionNames.Folder]: os.tmpdir(), + [QuestionNames.TeamsAppManifestFilePath]: "manifest.json", + [QuestionNames.ApiSpecLocation]: "test.yaml", + [QuestionNames.ApiOperation]: ["GET /user/{userId}"], + [QuestionNames.ApiPluginType]: ApiPluginStartOptions.apiSpec().id, + projectPath: path.join(os.tmpdir(), appName), + }; + const manifest = new TeamsAppManifest(); + manifest.copilotAgents = { + declarativeAgents: [ + { + file: "test1.json", + id: "action_1", + }, + ], + }; + sandbox.stub(validationUtils, "validateInputs").resolves(undefined); + sandbox.stub(manifestUtils, "_readAppManifest").resolves(ok(manifest)); + sandbox.stub(manifestUtils, "_writeAppManifest").resolves(ok(undefined)); + sandbox.stub(pluginGeneratorHelper, "generateScaffoldingSummary").resolves(""); + sandbox.stub(fs, "pathExists").callsFake(async (path: string) => { + if (path.endsWith("openapi_1.yaml")) { + return true; + } + if (path.endsWith("ai-plugin_1.json")) { + return true; + } + if (path.endsWith("openapi_2.yaml")) { + return false; + } + if (path.endsWith("ai-plugin_2.json")) { + return false; + } + return true; + }); + sandbox + .stub(copilotGptManifestUtils, "readCopilotGptManifestFile") + .resolves(ok({} as DeclarativeCopilotManifestSchema)); + sandbox.stub(copilotGptManifestUtils, "getManifestPath").resolves(ok("dcManifest.json")); + sandbox + .stub(copilotGptManifestUtils, "addAction") + .resolves(ok({} as DeclarativeCopilotManifestSchema)); + + const core = new FxCore(tools); + sandbox.stub(CopilotPluginHelper, "generateFromApiSpec").resolves(ok({ warnings: [] })); + + const showMessageStub = sandbox + .stub(tools.ui, "showMessage") + .callsFake((level, message, modal, items) => { + if (level == "info") { + return Promise.resolve( + ok(getLocalizedString("core.addPlugin.success.viewPluginManifest")) + ); + } else if (level === "warn") { + return Promise.resolve(ok("Add")); + } else { + throw new NotImplementedError("TEST", "showMessage"); + } + }); + + const openFileStub = sandbox.stub(tools.ui, "openFile").resolves(); + + const result = await core.addPlugin(inputs); + if (result.isErr()) { + console.log(result.error); + } + assert.isTrue(result.isOk()); + assert.isTrue(showMessageStub.calledTwice); + assert.isTrue(openFileStub.calledOnce); + + if (await fs.pathExists(inputs.projectPath!)) { + await fs.remove(inputs.projectPath!); + } + }); + it("from API spec: add action with warnings from CLI", async () => { const appName = await mockV3Project(); const inputs: Inputs = { diff --git a/packages/fx-core/tests/plugins/resource/appstudio/resources-multi-env/templates/appPackage/de.json b/packages/fx-core/tests/plugins/resource/appstudio/resources-multi-env/templates/appPackage/de.json new file mode 100644 index 0000000000..6df6948350 --- /dev/null +++ b/packages/fx-core/tests/plugins/resource/appstudio/resources-multi-env/templates/appPackage/de.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.12/MicrosoftTeams.Localization.schema.json", + "name.short": "Name App", + "name.full": "Name App", + "description.short": "Description Short Deutsch", + "description.full": "Description Long Deutsch", + "staticTabs[0].name": "Home" +} \ No newline at end of file diff --git a/packages/manifest/src/index.ts b/packages/manifest/src/index.ts index 253f768e21..466d23d581 100644 --- a/packages/manifest/src/index.ts +++ b/packages/manifest/src/index.ts @@ -195,6 +195,23 @@ export class ManifestUtil { if (copilotGpts && copilotGpts.length > 0) capabilities.push("copilotGpt"); } + if ((manifest as TeamsAppManifest).copilotAgents?.plugins) { + const apiPlugins = (manifest as TeamsAppManifest).copilotAgents?.plugins; + if ( + apiPlugins && + apiPlugins.length > 0 && + apiPlugins[0].file && + !capabilities.includes("plugin") + ) + capabilities.push("plugin"); + } + + if ((manifest as TeamsAppManifest).copilotAgents?.declarativeAgents) { + const copilotGpts = (manifest as TeamsAppManifest).copilotAgents?.declarativeAgents; + if (copilotGpts && copilotGpts.length > 0 && !capabilities.includes("copilotGpt")) + capabilities.push("copilotGpt"); + } + return properties; } diff --git a/packages/manifest/src/manifest.ts b/packages/manifest/src/manifest.ts index 5aa110207e..236bbcf54b 100644 --- a/packages/manifest/src/manifest.ts +++ b/packages/manifest/src/manifest.ts @@ -364,6 +364,7 @@ export interface ILocalizationInfo { * The language tag of the strings in this top level manifest file. */ defaultLanguageTag: string; + defaultLanguageFile?: string; additionalLanguages?: { languageTag: string; /** @@ -584,4 +585,15 @@ export class TeamsAppManifest implements AppManifest { */ declarativeCopilots?: IDeclarativeCopilot[]; }; + + copilotAgents?: { + /** + * Pointer to plugins. + */ + plugins?: IPlugin[]; + /** + * Pointer to declarative Copilot. + */ + declarativeAgents?: IDeclarativeCopilot[]; + }; } diff --git a/packages/vscode-extension/src/utils/autoOpenHelper.ts b/packages/vscode-extension/src/utils/autoOpenHelper.ts index 609d5af8d5..eae8110ee5 100644 --- a/packages/vscode-extension/src/utils/autoOpenHelper.ts +++ b/packages/vscode-extension/src/utils/autoOpenHelper.ts @@ -170,7 +170,12 @@ export async function ShowScaffoldingWarningSummary( createWarnings, teamsManifest, path.relative(workspacePath, apiSpecFilePathRes.value[0]), - path.join(AppPackageFolderName, teamsManifest.copilotExtensions!.plugins![0].file), + path.join( + AppPackageFolderName, + teamsManifest.copilotExtensions + ? teamsManifest.copilotExtensions.plugins![0].file + : teamsManifest.copilotAgents!.plugins![0].file + ), workspacePath ); } diff --git a/packages/vscode-extension/test/utils/autoOpenHelper.test.ts b/packages/vscode-extension/test/utils/autoOpenHelper.test.ts index 1e719fe17d..c70b98348d 100644 --- a/packages/vscode-extension/test/utils/autoOpenHelper.test.ts +++ b/packages/vscode-extension/test/utils/autoOpenHelper.test.ts @@ -6,10 +6,16 @@ import * as globalVariables from "../../src/globalVariables"; import * as globalState from "@microsoft/teamsfx-core/build/common/globalState"; import * as runIconHandlers from "../../src/debug/runIconHandler"; import * as appDefinitionUtils from "../../src/utils/appDefinitionUtils"; -import { ok } from "@microsoft/teamsfx-api"; +import { ok, TeamsAppManifest } from "@microsoft/teamsfx-api"; import { ExtTelemetry } from "../../src/telemetry/extTelemetry"; -import { showLocalDebugMessage } from "../../src/utils/autoOpenHelper"; +import { + showLocalDebugMessage, + ShowScaffoldingWarningSummary, +} from "../../src/utils/autoOpenHelper"; +import VscodeLogInstance from "../../src/commonlib/log"; import * as readmeHandlers from "../../src/handlers/readmeHandlers"; +import { manifestUtils, pluginManifestUtils } from "@microsoft/teamsfx-core"; +import * as apiSpec from "@microsoft/teamsfx-core/build/component/generator/apiSpec/helper"; describe("autoOpenHelper", () => { const sandbox = sinon.createSandbox(); @@ -428,4 +434,112 @@ describe("autoOpenHelper", () => { chai.assert.isTrue(showMessageStub.called); chai.assert.isTrue(openReadMeHandlerStub.called); }); + + it("ShowScaffoldingWarningSummary() - copilot agents", async () => { + const workspacePath = "/path/to/workspace"; + + const manifest: TeamsAppManifest = { + manifestVersion: "version", + id: "mock-app-id", + name: { short: "short-name" }, + description: { short: "", full: "" }, + version: "version", + icons: { outline: "outline.png", color: "color.png" }, + accentColor: "#ffffff", + developer: { + privacyUrl: "", + websiteUrl: "", + termsOfUseUrl: "", + name: "", + }, + staticTabs: [ + { + name: "name0", + entityId: "index0", + scopes: ["personal"], + contentUrl: "localhost/content", + websiteUrl: "localhost/website", + }, + ], + copilotAgents: { + plugins: [ + { + id: "plugin-id", + file: "copilot-plugin-file", + }, + ], + }, + }; + sandbox.stub(manifestUtils, "_readAppManifest").resolves(ok(manifest)); + sandbox + .stub(pluginManifestUtils, "getApiSpecFilePathFromTeamsManifest") + .resolves(ok(["/path/to/api/spec"])); + sandbox.stub(apiSpec, "generateScaffoldingSummary").resolves("fake summary"); + sandbox.stub(VscodeLogInstance, "info").callsFake((message: string) => { + if (message !== "fake summary") { + throw new Error(`Unexpected message: ${message}`); + } + }); + const fakeOutputChannel = { + show: sandbox.stub().resolves(), + }; + sandbox.stub(VscodeLogInstance, "outputChannel").value(fakeOutputChannel); + sandbox.stub(ExtTelemetry, "sendTelemetryEvent").resolves(); + // Call the function + await ShowScaffoldingWarningSummary(workspacePath, ""); + }); + + it("ShowScaffoldingWarningSummary() - copilot extensions", async () => { + const workspacePath = "/path/to/workspace"; + + const manifest: TeamsAppManifest = { + manifestVersion: "version", + id: "mock-app-id", + name: { short: "short-name" }, + description: { short: "", full: "" }, + version: "version", + icons: { outline: "outline.png", color: "color.png" }, + accentColor: "#ffffff", + developer: { + privacyUrl: "", + websiteUrl: "", + termsOfUseUrl: "", + name: "", + }, + staticTabs: [ + { + name: "name0", + entityId: "index0", + scopes: ["personal"], + contentUrl: "localhost/content", + websiteUrl: "localhost/website", + }, + ], + copilotExtensions: { + plugins: [ + { + id: "plugin-id", + file: "copilot-plugin-file", + }, + ], + }, + }; + sandbox.stub(manifestUtils, "_readAppManifest").resolves(ok(manifest)); + sandbox + .stub(pluginManifestUtils, "getApiSpecFilePathFromTeamsManifest") + .resolves(ok(["/path/to/api/spec"])); + sandbox.stub(apiSpec, "generateScaffoldingSummary").resolves("fake summary"); + sandbox.stub(VscodeLogInstance, "info").callsFake((message: string) => { + if (message !== "fake summary") { + throw new Error(`Unexpected message: ${message}`); + } + }); + const fakeOutputChannel = { + show: sandbox.stub().resolves(), + }; + sandbox.stub(VscodeLogInstance, "outputChannel").value(fakeOutputChannel); + sandbox.stub(ExtTelemetry, "sendTelemetryEvent").resolves(); + // Call the function + await ShowScaffoldingWarningSummary(workspacePath, ""); + }); }); From d542a91bc6829b8ce7a3c6b37a304c1f1b9af18c Mon Sep 17 00:00:00 2001 From: Hui Miao Date: Sun, 29 Sep 2024 15:33:13 +0800 Subject: [PATCH 04/32] refactor: upgrade the team manifest version to 1.19 --- .../appPackage/manifest.json.tpl | 8 ++++---- .../copilot-gpt-basic/appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 6 +++--- .../appPackage/manifest.json.tpl | 6 +++--- .../appPackage/manifest.json.tpl | 6 +++--- .../copilot-gpt-basic/appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 10 +++++----- 16 files changed, 60 insertions(+), 60 deletions(-) diff --git a/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl b/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl index 92c324f9fc..abe0594e2f 100644 --- a/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl +++ b/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "developer": { @@ -23,8 +23,8 @@ }, "accentColor": "#FFFFFF", {{#DeclarativeCopilot}} - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "declarativeAgent", "file": "declarativeAgent.json" diff --git a/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl b/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl index 7835f376fc..f862ec4746 100644 --- a/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl +++ b/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "developer": { @@ -27,8 +27,8 @@ "identity", "messageTeamMembers" ], - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "declarativeAgent", "file": "declarativeAgent.json" diff --git a/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl index 722a62d9a0..e68d04f8dd 100644 --- a/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "developer": { diff --git a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index 6046fbdbd4..4099b1b94c 100644 --- a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { "plugins": [ { "id": "plugin_1", diff --git a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index 5242ca1e09..76d5697ede 100644 --- a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { "plugins": [ { "id": "plugin_1", diff --git a/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl index 6046fbdbd4..4099b1b94c 100644 --- a/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { "plugins": [ { "id": "plugin_1", diff --git a/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl b/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl index b956742309..1dfdd79aae 100644 --- a/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl +++ b/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "packageName": "com.microsoft.teams.extension", @@ -28,8 +28,8 @@ "identity", "messageTeamMembers" ], - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "declarativeAgent", "file": "declarativeAgent.json" diff --git a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index 7e1d4e9520..9804f48492 100644 --- a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "packageName": "com.microsoft.teams.extension", "version": "1.0.0", @@ -23,8 +23,8 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index bbc0cdd9cc..99934725da 100644 --- a/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index 394b463b62..6989d56cb9 100644 --- a/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl index 69a740e679..fc5078a449 100644 --- a/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index 3336f56f44..e2171a0b77 100644 --- a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,8 +22,8 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index 5caba495da..8daaebbc61 100644 --- a/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index 394b463b62..6989d56cb9 100644 --- a/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl index 6e33224367..be0de76926 100644 --- a/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index 3336f56f44..24d6457f1b 100644 --- a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,8 +22,8 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" @@ -35,7 +35,7 @@ "file": "ai-plugin.json" } ] - }, + }, "permissions": [ "identity", "messageTeamMembers" From 1d932262c9be45f88bad130bd9ff4ee681be929c Mon Sep 17 00:00:00 2001 From: Chenyi An Date: Mon, 30 Sep 2024 15:22:29 +0800 Subject: [PATCH 05/32] fix: copilot spec parser --- packages/manifest/src/index.ts | 5 +++++ packages/spec-parser/src/manifestUpdater.ts | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/manifest/src/index.ts b/packages/manifest/src/index.ts index 466d23d581..346b391a4e 100644 --- a/packages/manifest/src/index.ts +++ b/packages/manifest/src/index.ts @@ -235,4 +235,9 @@ export class ManifestUtil { return telemetryProperties; } + + static async useCopilotExtensionsInSchema(manifest: TeamsAppManifest): Promise { + const schema = await this.fetchSchema(manifest); + return !!schema.value.definitions?.copilotExtensions; + } } diff --git a/packages/spec-parser/src/manifestUpdater.ts b/packages/spec-parser/src/manifestUpdater.ts index 018884f9f4..f971e6fe6a 100644 --- a/packages/spec-parser/src/manifestUpdater.ts +++ b/packages/spec-parser/src/manifestUpdater.ts @@ -24,6 +24,7 @@ import { PluginManifestSchema, FunctionObject, AuthObject, + ManifestUtil, } from "@microsoft/teams-manifest"; import { AdaptiveCardGenerator } from "./adaptiveCardGenerator"; import { wrapResponseSemantics } from "./adaptiveCardWrapper"; @@ -41,7 +42,9 @@ export class ManifestUpdater { const manifest: TeamsAppManifest = await fs.readJSON(manifestPath); const apiPluginRelativePath = ManifestUpdater.getRelativePath(manifestPath, apiPluginFilePath); - if (manifest.copilotExtensions) { + const useCopilotExtensionsInSchema = await ManifestUtil.useCopilotExtensionsInSchema(manifest); + if (useCopilotExtensionsInSchema) { + manifest.copilotExtensions = manifest.copilotExtensions || {}; if (!options.isGptPlugin) { manifest.copilotExtensions.plugins = [ { @@ -52,8 +55,7 @@ export class ManifestUpdater { ManifestUpdater.updateManifestDescription(manifest, spec); } } else { - (manifest as any).copilotAgents = (manifest as any).copilotAgents || {}; - + manifest.copilotAgents = manifest.copilotAgents || {}; if (!options.isGptPlugin) { (manifest as any).copilotAgents.plugins = [ { From c205b0ad79e9892a8dc952457684a03bbe1ebd89 Mon Sep 17 00:00:00 2001 From: Chenyi An Date: Mon, 30 Sep 2024 15:46:11 +0800 Subject: [PATCH 06/32] fix: update --- packages/spec-parser/src/manifestUpdater.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/spec-parser/src/manifestUpdater.ts b/packages/spec-parser/src/manifestUpdater.ts index f971e6fe6a..c695d74d42 100644 --- a/packages/spec-parser/src/manifestUpdater.ts +++ b/packages/spec-parser/src/manifestUpdater.ts @@ -43,7 +43,7 @@ export class ManifestUpdater { const apiPluginRelativePath = ManifestUpdater.getRelativePath(manifestPath, apiPluginFilePath); const useCopilotExtensionsInSchema = await ManifestUtil.useCopilotExtensionsInSchema(manifest); - if (useCopilotExtensionsInSchema) { + if (manifest.copilotExtensions || useCopilotExtensionsInSchema) { manifest.copilotExtensions = manifest.copilotExtensions || {}; if (!options.isGptPlugin) { manifest.copilotExtensions.plugins = [ From 59284dfd1e30c3efa52d51f3c8393323d8a67779 Mon Sep 17 00:00:00 2001 From: Chenyi An Date: Mon, 30 Sep 2024 16:25:47 +0800 Subject: [PATCH 07/32] fix: ut --- packages/manifest/test/index.test.ts | 50 +++++ .../spec-parser/test/manifestUpdater.test.ts | 174 +++++++++++++++++- 2 files changed, 222 insertions(+), 2 deletions(-) diff --git a/packages/manifest/test/index.test.ts b/packages/manifest/test/index.test.ts index c523301707..a6da5d08d6 100644 --- a/packages/manifest/test/index.test.ts +++ b/packages/manifest/test/index.test.ts @@ -99,6 +99,56 @@ describe("Manifest manipulation", async () => { chai.expect(result[0]).to.contain("/manifestVersion"); }); }); + describe("useCopilotExtensionsInSchema", async () => { + let fetchSchemaStub: sinon.SinonStub; + + beforeEach(() => { + fetchSchemaStub = sinon.stub(ManifestUtil, "fetchSchema"); + }); + + afterEach(() => { + sinon.restore(); + }); + + it("should return true when copilotExtensions exist in schema definitions", async () => { + const mockSchema = { + value: { + definitions: { + copilotExtensions: {}, + }, + }, + }; + + fetchSchemaStub.resolves(mockSchema); + + const result = await ManifestUtil.useCopilotExtensionsInSchema({} as any); + chai.assert.isTrue(result); + }); + + it("should return false when copilotExtensions do not exist in schema definitions", async () => { + const mockSchema = { + value: { + definitions: {}, + }, + }; + fetchSchemaStub.resolves(mockSchema); + + const result = await ManifestUtil.useCopilotExtensionsInSchema({} as any); + + chai.assert.isFalse(result); + }); + + it("should return false when schema definitions are undefined", async () => { + const mockSchema = { + value: {}, + }; + + fetchSchemaStub.resolves(mockSchema); + + const result = await ManifestUtil.useCopilotExtensionsInSchema({} as any); + chai.assert.isFalse(result); + }); + }); }); async function loadSchema(): Promise { diff --git a/packages/spec-parser/test/manifestUpdater.test.ts b/packages/spec-parser/test/manifestUpdater.test.ts index 70f444f042..d8c83a982f 100644 --- a/packages/spec-parser/test/manifestUpdater.test.ts +++ b/packages/spec-parser/test/manifestUpdater.test.ts @@ -12,8 +12,11 @@ import { AuthInfo, ErrorType, ParseOptions, ProjectType, WarningType } from "../ import { ConstantString } from "../src/constants"; import { Utils } from "../src/utils"; import { PluginManifestSchema } from "@microsoft/teams-manifest"; - +import { ManifestUtil } from "@microsoft/teams-manifest"; describe("updateManifestWithAiPlugin", () => { + beforeEach(() => { + sinon.stub(ManifestUtil, "useCopilotExtensionsInSchema").resolves(false); + }); afterEach(() => { sinon.restore(); }); @@ -122,7 +125,7 @@ describe("updateManifestWithAiPlugin", () => { expect(warnings).to.deep.equal([]); }); - it("should generate response semantics based on the response", async () => { + it("should generate response semantics based on the response - 1", async () => { const spec: any = { openapi: "3.0.2", info: { @@ -287,6 +290,173 @@ describe("updateManifestWithAiPlugin", () => { expect(warnings).to.deep.equal([]); }); + it("should generate response semantics based on the response - 2", async () => { + sinon.restore(); + sinon.stub(ManifestUtil, "useCopilotExtensionsInSchema").resolves(true); + const spec: any = { + openapi: "3.0.2", + info: { + title: "My API", + description: "My API description", + }, + servers: [ + { + url: "/v3", + }, + ], + paths: { + "/pets": { + get: { + operationId: "getPets", + summary: "Get all pets", + description: "Returns all pets from the system that the user has access to", + parameters: [ + { + name: "limit", + description: "Maximum number of pets to return", + required: true, + schema: { + type: "integer", + }, + }, + ], + responses: { + 200: { + content: { + "application/json": { + schema: { + type: "object", + properties: { + name: { + type: "string", + }, + description: { + type: "string", + }, + imageUrl: { + type: "string", + }, + id: { + type: "string", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }; + const manifestPath = "/path/to/your/manifest.json"; + const outputSpecPath = "/path/to/your/spec/outputSpec.yaml"; + const pluginFilePath = "/path/to/your/ai-plugin.json"; + + const originalManifest = { + name: { short: "Original Name", full: "Original Full Name" }, + description: { short: "Original Short Description", full: "Original Full Description" }, + }; + const expectedManifest = { + name: { short: "Original Name", full: "Original Full Name" }, + description: { short: "My API", full: "My API description" }, + copilotExtensions: { + plugins: [ + { + file: "ai-plugin.json", + id: "plugin_1", + }, + ], + }, + }; + + const expectedPlugins: PluginManifestSchema = { + $schema: ConstantString.PluginManifestSchema, + schema_version: "v2.1", + name_for_human: "Original Name", + namespace: "originalname", + description_for_human: "My API description", + functions: [ + { + name: "getPets", + description: "Returns all pets from the system that the user has access to", + capabilities: { + response_semantics: { + data_path: "$", + properties: { + subtitle: "$.description", + title: "$.name", + url: "$.imageUrl", + }, + static_template: { + $schema: "http://adaptivecards.io/schemas/adaptive-card.json", + body: [ + { + text: "name: ${if(name, name, 'N/A')}", + type: "TextBlock", + wrap: true, + }, + { + text: "description: ${if(description, description, 'N/A')}", + type: "TextBlock", + wrap: true, + }, + { + $when: "${imageUrl != null && imageUrl != ''}", + type: "Image", + url: "${imageUrl}", + }, + { + text: "id: ${if(id, id, 'N/A')}", + type: "TextBlock", + wrap: true, + }, + ], + type: "AdaptiveCard", + version: "1.5", + }, + }, + }, + }, + ], + runtimes: [ + { + type: "OpenApi", + auth: { + type: "None", + }, + spec: { + url: "spec/outputSpec.yaml", + }, + run_for_functions: ["getPets"], + }, + ], + }; + sinon.stub(fs, "readJSON").resolves(originalManifest); + sinon + .stub(fs, "pathExists") + .withArgs(manifestPath) + .resolves(true) + .withArgs(pluginFilePath) + .resolves(false); + + const options: ParseOptions = { + allowMethods: ["get", "post"], + allowResponseSemantics: true, + }; + const [manifest, apiPlugin, warnings] = await ManifestUpdater.updateManifestWithAiPlugin( + manifestPath, + outputSpecPath, + pluginFilePath, + spec, + options + ); + + expect(manifest).to.deep.equal(expectedManifest); + expect(apiPlugin).to.deep.equal(expectedPlugins); + expect(warnings).to.deep.equal([]); + }); + it("should not generate response semantics and return warnings if api response schema contains anyof", async () => { const spec: any = { openapi: "3.0.2", From cd563f213935d9114c5917aa1724583da904632d Mon Sep 17 00:00:00 2001 From: Chenyi An Date: Mon, 30 Sep 2024 16:38:25 +0800 Subject: [PATCH 08/32] fix: update --- packages/manifest/src/index.ts | 2 +- packages/manifest/test/index.test.ts | 22 +++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/packages/manifest/src/index.ts b/packages/manifest/src/index.ts index 346b391a4e..a522b4e6fa 100644 --- a/packages/manifest/src/index.ts +++ b/packages/manifest/src/index.ts @@ -238,6 +238,6 @@ export class ManifestUtil { static async useCopilotExtensionsInSchema(manifest: TeamsAppManifest): Promise { const schema = await this.fetchSchema(manifest); - return !!schema.value.definitions?.copilotExtensions; + return !!schema.properties.copilotExtensions; } } diff --git a/packages/manifest/test/index.test.ts b/packages/manifest/test/index.test.ts index a6da5d08d6..506e9ed04d 100644 --- a/packages/manifest/test/index.test.ts +++ b/packages/manifest/test/index.test.ts @@ -112,10 +112,8 @@ describe("Manifest manipulation", async () => { it("should return true when copilotExtensions exist in schema definitions", async () => { const mockSchema = { - value: { - definitions: { - copilotExtensions: {}, - }, + properties: { + copilotExtensions: {}, }, }; @@ -127,24 +125,10 @@ describe("Manifest manipulation", async () => { it("should return false when copilotExtensions do not exist in schema definitions", async () => { const mockSchema = { - value: { - definitions: {}, - }, + properties: {}, }; fetchSchemaStub.resolves(mockSchema); - const result = await ManifestUtil.useCopilotExtensionsInSchema({} as any); - - chai.assert.isFalse(result); - }); - - it("should return false when schema definitions are undefined", async () => { - const mockSchema = { - value: {}, - }; - - fetchSchemaStub.resolves(mockSchema); - const result = await ManifestUtil.useCopilotExtensionsInSchema({} as any); chai.assert.isFalse(result); }); From 034e228cf43632abe49b39aa7238b5a8528f5fae Mon Sep 17 00:00:00 2001 From: Hui Miao Date: Wed, 9 Oct 2024 14:27:56 +0800 Subject: [PATCH 09/32] refactor: use a temporary schema URL --- .../common/api-plugin-existing-api/appPackage/manifest.json.tpl | 2 +- templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl | 2 +- .../csharp/api-plugin-existing-api/appPackage/manifest.json.tpl | 2 +- .../api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl | 2 +- .../api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl | 2 +- .../csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl | 2 +- templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl | 2 +- .../appPackage/manifest.json.tpl | 2 +- .../api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl | 2 +- .../api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl | 2 +- .../js/api-plugin-from-scratch/appPackage/manifest.json.tpl | 2 +- .../appPackage/manifest.json.tpl | 2 +- .../api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl | 2 +- .../api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl | 2 +- .../ts/api-plugin-from-scratch/appPackage/manifest.json.tpl | 2 +- .../appPackage/manifest.json.tpl | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl b/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl index abe0594e2f..848a1e0b14 100644 --- a/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl +++ b/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", diff --git a/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl b/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl index f862ec4746..c15d6f3936 100644 --- a/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl +++ b/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", diff --git a/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl index e68d04f8dd..d703616092 100644 --- a/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", diff --git a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index 4099b1b94c..8d0fac5dc2 100644 --- a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", diff --git a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index 76d5697ede..5abe443d0e 100644 --- a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", diff --git a/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl index 4099b1b94c..8d0fac5dc2 100644 --- a/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", diff --git a/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl b/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl index 1dfdd79aae..eca889c290 100644 --- a/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl +++ b/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", diff --git a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index 9804f48492..f796b56302 100644 --- a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "packageName": "com.microsoft.teams.extension", diff --git a/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index 99934725da..e49a97266b 100644 --- a/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", diff --git a/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index 6989d56cb9..2d32a82bd6 100644 --- a/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", diff --git a/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl index fc5078a449..f8590059bf 100644 --- a/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", diff --git a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index e2171a0b77..61c63bddfb 100644 --- a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", diff --git a/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index 8daaebbc61..88c8873a4c 100644 --- a/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", diff --git a/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index 6989d56cb9..2d32a82bd6 100644 --- a/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", diff --git a/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl index be0de76926..84a378fdb6 100644 --- a/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", diff --git a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index 24d6457f1b..da8c9c4ec1 100644 --- a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", From 879feea3f02f0c11e9bfa82b612640d2a416c726 Mon Sep 17 00:00:00 2001 From: Hui Miao Date: Fri, 20 Sep 2024 12:21:27 +0800 Subject: [PATCH 10/32] refactor: update the schema url for copilot extensions --- packages/spec-parser/src/constants.ts | 2 +- .../appPackage/declarativeAgent.json.tpl | 2 +- .../copilot-gpt-basic/appPackage/declarativeAgent.json.tpl | 2 +- .../appPackage/ai-plugin.json.tpl | 2 +- .../appPackage/ai-plugin.dev.json.tpl | 2 +- .../appPackage/ai-plugin.local.json.tpl | 2 +- .../api-plugin-from-scratch/appPackage/ai-plugin.json.tpl | 2 +- .../copilot-gpt-basic/appPackage/declarativeAgent.json.tpl | 2 +- .../appPackage/ai-plugin.json.tpl | 2 +- .../appPackage/repairDeclarativeAgent.json.tpl | 2 +- .../appPackage/ai-plugin.json.tpl | 2 +- .../appPackage/repairDeclarativeAgent.json.tpl | 2 +- .../appPackage/ai-plugin.dev.json.tpl | 2 +- .../appPackage/ai-plugin.local.json.tpl | 2 +- .../appPackage/repairDeclarativeAgent.json.tpl | 2 +- .../js/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl | 2 +- .../appPackage/repairDeclarativeAgent.json.tpl | 2 +- .../appPackage/ai-plugin.json.tpl | 2 +- .../appPackage/repairDeclarativeAgent.json.tpl | 2 +- .../appPackage/ai-plugin.json.tpl | 2 +- .../appPackage/repairDeclarativeAgent.json.tpl | 2 +- .../appPackage/ai-plugin.dev.json.tpl | 2 +- .../appPackage/ai-plugin.local.json.tpl | 2 +- .../appPackage/repairDeclarativeAgent.json.tpl | 2 +- .../ts/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl | 2 +- .../appPackage/repairDeclarativeAgent.json.tpl | 2 +- .../appPackage/ai-plugin.json.tpl | 2 +- .../appPackage/repairDeclarativeAgent.json.tpl | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/packages/spec-parser/src/constants.ts b/packages/spec-parser/src/constants.ts index 0fe585681b..7d9ee5732a 100644 --- a/packages/spec-parser/src/constants.ts +++ b/packages/spec-parser/src/constants.ts @@ -127,5 +127,5 @@ export class ConstantString { static readonly FunctionDescriptionMaxLens = 100; static readonly DefaultPluginId = "plugin_1"; static readonly PluginManifestSchema = - "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json"; + "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json"; } diff --git a/templates/common/api-plugin-existing-api/appPackage/declarativeAgent.json.tpl b/templates/common/api-plugin-existing-api/appPackage/declarativeAgent.json.tpl index da74e33a22..68b78992a5 100644 --- a/templates/common/api-plugin-existing-api/appPackage/declarativeAgent.json.tpl +++ b/templates/common/api-plugin-existing-api/appPackage/declarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}", "description": "Declarative agent created with Teams Toolkit", diff --git a/templates/common/copilot-gpt-basic/appPackage/declarativeAgent.json.tpl b/templates/common/copilot-gpt-basic/appPackage/declarativeAgent.json.tpl index da74e33a22..68b78992a5 100644 --- a/templates/common/copilot-gpt-basic/appPackage/declarativeAgent.json.tpl +++ b/templates/common/copilot-gpt-basic/appPackage/declarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}", "description": "Declarative agent created with Teams Toolkit", diff --git a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl index f2412103cc..e00d86c5f7 100644 --- a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", "namespace": "repairs", diff --git a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl index e901d2c183..1e73ae0853 100644 --- a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "namespace": "repairs", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", diff --git a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl index 847e0ed4d0..ae9474d675 100644 --- a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "namespace": "repairs", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", diff --git a/templates/csharp/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl b/templates/csharp/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl index 22b59deaff..68c0e9d958 100644 --- a/templates/csharp/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl +++ b/templates/csharp/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", "namespace": "repairs", diff --git a/templates/csharp/copilot-gpt-basic/appPackage/declarativeAgent.json.tpl b/templates/csharp/copilot-gpt-basic/appPackage/declarativeAgent.json.tpl index d87aefa8e6..f0650bf6b3 100644 --- a/templates/csharp/copilot-gpt-basic/appPackage/declarativeAgent.json.tpl +++ b/templates/csharp/copilot-gpt-basic/appPackage/declarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}", "description": "Declarative agent created with Teams Toolkit", diff --git a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl index 0186738438..84c5aa2141 100644 --- a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl +++ b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", "namespace": "repairs", diff --git a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl index 0e8edb1159..247d66f66a 100644 --- a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl +++ b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}${{APP_NAME_SUFFIX}}", "description": "This GPT helps you with finding car repair records.", diff --git a/templates/js/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl b/templates/js/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl index d75b0d8a58..ba4c8392f7 100644 --- a/templates/js/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl +++ b/templates/js/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "namespace": "repairs", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", diff --git a/templates/js/api-plugin-from-scratch-bearer/appPackage/repairDeclarativeAgent.json.tpl b/templates/js/api-plugin-from-scratch-bearer/appPackage/repairDeclarativeAgent.json.tpl index e1f5cdd764..a52919b2cd 100644 --- a/templates/js/api-plugin-from-scratch-bearer/appPackage/repairDeclarativeAgent.json.tpl +++ b/templates/js/api-plugin-from-scratch-bearer/appPackage/repairDeclarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}${{APP_NAME_SUFFIX}}", "description": "This declarative agent helps you with finding car repair records.", diff --git a/templates/js/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl b/templates/js/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl index e901d2c183..1e73ae0853 100644 --- a/templates/js/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl +++ b/templates/js/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "namespace": "repairs", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", diff --git a/templates/js/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl b/templates/js/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl index 847e0ed4d0..ae9474d675 100644 --- a/templates/js/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl +++ b/templates/js/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "namespace": "repairs", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", diff --git a/templates/js/api-plugin-from-scratch-oauth/appPackage/repairDeclarativeAgent.json.tpl b/templates/js/api-plugin-from-scratch-oauth/appPackage/repairDeclarativeAgent.json.tpl index f3f609d459..7453556968 100644 --- a/templates/js/api-plugin-from-scratch-oauth/appPackage/repairDeclarativeAgent.json.tpl +++ b/templates/js/api-plugin-from-scratch-oauth/appPackage/repairDeclarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}${{APP_NAME_SUFFIX}}", "description": "This declarative agent helps you with finding car repair records.", diff --git a/templates/js/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl b/templates/js/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl index 22b59deaff..68c0e9d958 100644 --- a/templates/js/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl +++ b/templates/js/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", "namespace": "repairs", diff --git a/templates/js/api-plugin-from-scratch/appPackage/repairDeclarativeAgent.json.tpl b/templates/js/api-plugin-from-scratch/appPackage/repairDeclarativeAgent.json.tpl index e1f5cdd764..a52919b2cd 100644 --- a/templates/js/api-plugin-from-scratch/appPackage/repairDeclarativeAgent.json.tpl +++ b/templates/js/api-plugin-from-scratch/appPackage/repairDeclarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}${{APP_NAME_SUFFIX}}", "description": "This declarative agent helps you with finding car repair records.", diff --git a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl index 1df65408a9..26b4288f2a 100644 --- a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl +++ b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "namespace": "repairs", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", diff --git a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl index 0e8edb1159..247d66f66a 100644 --- a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl +++ b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}${{APP_NAME_SUFFIX}}", "description": "This GPT helps you with finding car repair records.", diff --git a/templates/ts/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl b/templates/ts/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl index d75b0d8a58..ba4c8392f7 100644 --- a/templates/ts/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl +++ b/templates/ts/api-plugin-from-scratch-bearer/appPackage/ai-plugin.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "namespace": "repairs", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", diff --git a/templates/ts/api-plugin-from-scratch-bearer/appPackage/repairDeclarativeAgent.json.tpl b/templates/ts/api-plugin-from-scratch-bearer/appPackage/repairDeclarativeAgent.json.tpl index e1f5cdd764..a52919b2cd 100644 --- a/templates/ts/api-plugin-from-scratch-bearer/appPackage/repairDeclarativeAgent.json.tpl +++ b/templates/ts/api-plugin-from-scratch-bearer/appPackage/repairDeclarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}${{APP_NAME_SUFFIX}}", "description": "This declarative agent helps you with finding car repair records.", diff --git a/templates/ts/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl b/templates/ts/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl index e901d2c183..1e73ae0853 100644 --- a/templates/ts/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl +++ b/templates/ts/api-plugin-from-scratch-oauth/appPackage/ai-plugin.dev.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "namespace": "repairs", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", diff --git a/templates/ts/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl b/templates/ts/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl index 847e0ed4d0..ae9474d675 100644 --- a/templates/ts/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl +++ b/templates/ts/api-plugin-from-scratch-oauth/appPackage/ai-plugin.local.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "namespace": "repairs", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", diff --git a/templates/ts/api-plugin-from-scratch-oauth/appPackage/repairDeclarativeAgent.json.tpl b/templates/ts/api-plugin-from-scratch-oauth/appPackage/repairDeclarativeAgent.json.tpl index f3f609d459..7453556968 100644 --- a/templates/ts/api-plugin-from-scratch-oauth/appPackage/repairDeclarativeAgent.json.tpl +++ b/templates/ts/api-plugin-from-scratch-oauth/appPackage/repairDeclarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}${{APP_NAME_SUFFIX}}", "description": "This declarative agent helps you with finding car repair records.", diff --git a/templates/ts/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl b/templates/ts/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl index 29f4dfeeca..8540c0dae1 100644 --- a/templates/ts/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl +++ b/templates/ts/api-plugin-from-scratch/appPackage/ai-plugin.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "namespace": "repairs", "name_for_human": "{{appName}}${{APP_NAME_SUFFIX}}", diff --git a/templates/ts/api-plugin-from-scratch/appPackage/repairDeclarativeAgent.json.tpl b/templates/ts/api-plugin-from-scratch/appPackage/repairDeclarativeAgent.json.tpl index e1f5cdd764..a52919b2cd 100644 --- a/templates/ts/api-plugin-from-scratch/appPackage/repairDeclarativeAgent.json.tpl +++ b/templates/ts/api-plugin-from-scratch/appPackage/repairDeclarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}${{APP_NAME_SUFFIX}}", "description": "This declarative agent helps you with finding car repair records.", diff --git a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl index 3cb906bc21..c26982b1b5 100644 --- a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl +++ b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/ai-plugin.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json", "schema_version": "v2.1", "namespace": "repairs", "name_for_human": "ttk-plugin-copilot${{APP_NAME_SUFFIX}}", diff --git a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl index 0e8edb1159..247d66f66a 100644 --- a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl +++ b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/repairDeclarativeAgent.json.tpl @@ -1,5 +1,5 @@ { - "$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", "version": "v1.0", "name": "{{appName}}${{APP_NAME_SUFFIX}}", "description": "This GPT helps you with finding car repair records.", From c1bd67ac5eae2d3095e1124b213a4e4509f3003c Mon Sep 17 00:00:00 2001 From: huajiezhang Date: Wed, 9 Oct 2024 15:35:32 +0800 Subject: [PATCH 11/32] fix: reset env when import outlook addin --- .../generator/officeAddin/generator.ts | 22 ++++++++++- .../generator/officeAddinGenerator.test.ts | 39 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/packages/fx-core/src/component/generator/officeAddin/generator.ts b/packages/fx-core/src/component/generator/officeAddin/generator.ts index 1d14ba92a7..28ad76e56b 100644 --- a/packages/fx-core/src/component/generator/officeAddin/generator.ts +++ b/packages/fx-core/src/component/generator/officeAddin/generator.ts @@ -18,7 +18,6 @@ import { ok, } from "@microsoft/teamsfx-api"; import * as childProcess from "child_process"; -import fse from "fs-extra"; import { toLower } from "lodash"; import { OfficeAddinManifest } from "office-addin-manifest"; import { convertProject } from "office-addin-project"; @@ -39,6 +38,7 @@ import { DefaultTemplateGenerator } from "../templates/templateGenerator"; import { TemplateInfo } from "../templates/templateInfo"; import { convertToLangKey } from "../utils"; import { HelperMethods } from "./helperMethods"; +import { envUtil } from "../../utils/envUtil"; const componentName = "office-addin"; const telemetryEvent = "generate"; @@ -259,4 +259,24 @@ export class OfficeAddinGeneratorNew extends DefaultTemplateGenerator { if (res.isErr()) return err(res.error); return Promise.resolve(ok([{ templateName: tplName, language: lang }])); } + + async post( + context: Context, + inputs: Inputs, + destinationPath: string, + actionContext?: ActionContext + ): Promise> { + const fromFolder = inputs[QuestionNames.OfficeAddinFolder]; + if (fromFolder) { + // reset all env files + const envRes = await envUtil.listEnv(destinationPath); + if (envRes.isOk()) { + const envs = envRes.value; + for (const env of envs) { + await envUtil.resetEnv(destinationPath, env, ["TEAMSFX_ENV", "APP_NAME_SUFFIX"]); + } + } + } + return ok({}); + } } diff --git a/packages/fx-core/tests/component/generator/officeAddinGenerator.test.ts b/packages/fx-core/tests/component/generator/officeAddinGenerator.test.ts index bfe714ae44..5353181fb1 100644 --- a/packages/fx-core/tests/component/generator/officeAddinGenerator.test.ts +++ b/packages/fx-core/tests/component/generator/officeAddinGenerator.test.ts @@ -45,6 +45,7 @@ import { QuestionNames, } from "../../../src/question"; import { MockTools } from "../../core/utils"; +import { envUtil } from "../../../src/component/utils/envUtil"; describe("OfficeAddinGenerator for Outlook Addin", function () { const testFolder = path.resolve("./tmp"); @@ -1033,6 +1034,44 @@ describe("OfficeAddinGeneratorNew", () => { chai.assert.isTrue(res.isErr()); }); }); + describe("post()", () => { + afterEach(() => { + sandbox.restore(); + }); + it(`happy`, async () => { + sandbox.stub(envUtil, "listEnv").resolves(ok(["dev", "dev2"])); + const reset = sandbox.stub(envUtil, "resetEnv").resolves(); + const inputs: Inputs = { + platform: Platform.CLI, + projectPath: "./", + }; + inputs[QuestionNames.OfficeAddinFolder] = "testfolder"; + const res = await generator.post(context, inputs, "./"); + chai.assert.isTrue(res.isOk()); + chai.assert.isTrue(reset.calledTwice); + }); + it(`not import`, async () => { + const reset = sandbox.stub(envUtil, "resetEnv").resolves(); + const inputs: Inputs = { + platform: Platform.CLI, + projectPath: "./", + }; + const res = await generator.post(context, inputs, "./"); + chai.assert.isTrue(res.isOk()); + chai.assert.isTrue(reset.notCalled); + }); + it(`list env error`, async () => { + sandbox.stub(envUtil, "listEnv").resolves(err(new UserCancelError())); + const reset = sandbox.stub(envUtil, "resetEnv").resolves(); + const inputs: Inputs = { + platform: Platform.CLI, + projectPath: "./", + }; + const res = await generator.post(context, inputs, "./"); + chai.assert.isTrue(res.isOk()); + chai.assert.isTrue(reset.notCalled); + }); + }); }); describe("doScaffolding()", () => { From a052c99848de0d60e1846b1bddbeb4862a0e2b58 Mon Sep 17 00:00:00 2001 From: Hui Miao Date: Wed, 16 Oct 2024 13:21:50 +0800 Subject: [PATCH 12/32] refactor: revert to using the DevPreview schema URL --- .../api-plugin-existing-api/appPackage/manifest.json.tpl | 8 ++++---- .../common/copilot-gpt-basic/appPackage/manifest.json.tpl | 8 ++++---- .../api-plugin-existing-api/appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 6 +++--- .../appPackage/manifest.json.tpl | 6 +++--- .../api-plugin-from-scratch/appPackage/manifest.json.tpl | 6 +++--- .../csharp/copilot-gpt-basic/appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../api-plugin-from-scratch/appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- .../api-plugin-from-scratch/appPackage/manifest.json.tpl | 8 ++++---- .../appPackage/manifest.json.tpl | 8 ++++---- 16 files changed, 59 insertions(+), 59 deletions(-) diff --git a/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl b/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl index 848a1e0b14..92c324f9fc 100644 --- a/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl +++ b/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "developer": { @@ -23,8 +23,8 @@ }, "accentColor": "#FFFFFF", {{#DeclarativeCopilot}} - "copilotAgents": { - "declarativeAgents": [ + "copilotExtensions": { + "declarativeCopilots": [ { "id": "declarativeAgent", "file": "declarativeAgent.json" diff --git a/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl b/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl index c15d6f3936..7835f376fc 100644 --- a/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl +++ b/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "developer": { @@ -27,8 +27,8 @@ "identity", "messageTeamMembers" ], - "copilotAgents": { - "declarativeAgents": [ + "copilotExtensions": { + "declarativeCopilots": [ { "id": "declarativeAgent", "file": "declarativeAgent.json" diff --git a/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl index d703616092..722a62d9a0 100644 --- a/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "developer": { diff --git a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index 8d0fac5dc2..6046fbdbd4 100644 --- a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { + "copilotExtensions": { "plugins": [ { "id": "plugin_1", diff --git a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index 5abe443d0e..5242ca1e09 100644 --- a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { + "copilotExtensions": { "plugins": [ { "id": "plugin_1", diff --git a/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl index 8d0fac5dc2..6046fbdbd4 100644 --- a/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { + "copilotExtensions": { "plugins": [ { "id": "plugin_1", diff --git a/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl b/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl index eca889c290..eb41c1b678 100644 --- a/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl +++ b/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "packageName": "com.microsoft.teams.extension", @@ -28,8 +28,8 @@ "identity", "messageTeamMembers" ], - "copilotAgents": { - "declarativeAgents": [ + "copilotExtensions": { + "declarativeCopilots": [ { "id": "declarativeAgent", "file": "declarativeAgent.json" diff --git a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index f796b56302..7e1d4e9520 100644 --- a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "packageName": "com.microsoft.teams.extension", "version": "1.0.0", @@ -23,8 +23,8 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { - "declarativeAgents": [ + "copilotExtensions": { + "declarativeCopilots": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index e49a97266b..82a8fac3a4 100644 --- a/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { + "copilotExtensions": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeAgents": [ + "declarativeCopilots": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index 2d32a82bd6..be2f42ca58 100644 --- a/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { + "copilotExtensions": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeAgents": [ + "declarativeCopilots": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl index f8590059bf..fb56f22c8b 100644 --- a/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { + "copilotExtensions": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeAgents": [ + "declarativeCopilots": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index 61c63bddfb..3336f56f44 100644 --- a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,8 +22,8 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { - "declarativeAgents": [ + "copilotExtensions": { + "declarativeCopilots": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index 88c8873a4c..c51af0425c 100644 --- a/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { + "copilotExtensions": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeAgents": [ + "declarativeCopilots": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index 2d32a82bd6..be2f42ca58 100644 --- a/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { + "copilotExtensions": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeAgents": [ + "declarativeCopilots": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl index 84a378fdb6..913d87c11d 100644 --- a/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { + "copilotExtensions": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeAgents": [ + "declarativeCopilots": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index da8c9c4ec1..de5b3597e4 100644 --- a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://aka.ms/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", - "manifestVersion": "1.19", + "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "manifestVersion": "devPreview", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { @@ -22,8 +22,8 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotAgents": { - "declarativeAgents": [ + "copilotExtensions": { + "declarativeCopilots": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" From 3c6c1d9691b31734addc3827d7c982aa65f4cecc Mon Sep 17 00:00:00 2001 From: Hui Miao Date: Wed, 16 Oct 2024 14:23:38 +0800 Subject: [PATCH 13/32] refactor: use the new naming --- .../api-plugin-existing-api/appPackage/manifest.json.tpl | 4 ++-- .../common/copilot-gpt-basic/appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 2 +- .../appPackage/manifest.json.tpl | 2 +- .../api-plugin-from-scratch/appPackage/manifest.json.tpl | 2 +- .../csharp/copilot-gpt-basic/appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../js/api-plugin-from-scratch/appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../ts/api-plugin-from-scratch/appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- 15 files changed, 27 insertions(+), 27 deletions(-) diff --git a/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl b/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl index 92c324f9fc..c8478ba803 100644 --- a/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl +++ b/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl @@ -23,8 +23,8 @@ }, "accentColor": "#FFFFFF", {{#DeclarativeCopilot}} - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "declarativeAgent", "file": "declarativeAgent.json" diff --git a/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl b/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl index 7835f376fc..7a3157b05c 100644 --- a/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl +++ b/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl @@ -27,8 +27,8 @@ "identity", "messageTeamMembers" ], - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "declarativeAgent", "file": "declarativeAgent.json" diff --git a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index 6046fbdbd4..ba3de44eca 100644 --- a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { "plugins": [ { "id": "plugin_1", diff --git a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index 5242ca1e09..47bd3a6fa1 100644 --- a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { "plugins": [ { "id": "plugin_1", diff --git a/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl index 6046fbdbd4..ba3de44eca 100644 --- a/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { "plugins": [ { "id": "plugin_1", diff --git a/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl b/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl index eb41c1b678..4256f2c864 100644 --- a/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl +++ b/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl @@ -28,8 +28,8 @@ "identity", "messageTeamMembers" ], - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "declarativeAgent", "file": "declarativeAgent.json" diff --git a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index 7e1d4e9520..89d9b6fb96 100644 --- a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -23,8 +23,8 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index 82a8fac3a4..060aa731d8 100644 --- a/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index be2f42ca58..f91316bb68 100644 --- a/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl index fb56f22c8b..80401dfd7b 100644 --- a/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index 3336f56f44..3eeba3e18d 100644 --- a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -22,8 +22,8 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index c51af0425c..3a769944b6 100644 --- a/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index be2f42ca58..f91316bb68 100644 --- a/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl index 913d87c11d..be8ec6ffdd 100644 --- a/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -22,7 +22,7 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { + "copilotAgents": { {{^DeclarativeCopilot}} "plugins": [ { @@ -32,7 +32,7 @@ ] {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} - "declarativeCopilots": [ + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" diff --git a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index de5b3597e4..4940341d87 100644 --- a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -22,8 +22,8 @@ "full": "The ultimate solution for hassle-free car maintenance management makes tracking and monitoring your car repair records a breeze." }, "accentColor": "#FFFFFF", - "copilotExtensions": { - "declarativeCopilots": [ + "copilotAgents": { + "declarativeAgents": [ { "id": "repairDeclarativeAgent", "file": "repairDeclarativeAgent.json" From 51384c8fe1f11cced94b496961a265fafe7b6fba Mon Sep 17 00:00:00 2001 From: Yuqi Zhou Date: Wed, 16 Oct 2024 15:05:37 +0800 Subject: [PATCH 14/32] fix: add previe w tag --- packages/fx-core/src/question/constants.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/fx-core/src/question/constants.ts b/packages/fx-core/src/question/constants.ts index 716203e47d..38c6379099 100644 --- a/packages/fx-core/src/question/constants.ts +++ b/packages/fx-core/src/question/constants.ts @@ -730,6 +730,7 @@ export class CapabilityOptions { detail: getLocalizedString( "core.createProjectQuestion.projectType.declarativeCopilot.detail" ), + description: getLocalizedString("core.createProjectQuestion.option.description.preview"), }; } From c8e0d2610df3c93d759c03ec7a4d1b9a5b7c103e Mon Sep 17 00:00:00 2001 From: Junjie Li Date: Thu, 12 Sep 2024 18:40:31 +0800 Subject: [PATCH 15/32] docs: Add changelog for SEP stable release --- packages/vscode-extension/CHANGELOG.md | 74 +++++++++++++++++++++++++ packages/vscode-extension/PRERELEASE.md | 2 + 2 files changed, 76 insertions(+) diff --git a/packages/vscode-extension/CHANGELOG.md b/packages/vscode-extension/CHANGELOG.md index eca466e791..c5ee808306 100644 --- a/packages/vscode-extension/CHANGELOG.md +++ b/packages/vscode-extension/CHANGELOG.md @@ -2,6 +2,80 @@ > Note: This changelog only includes the changes for the stable versions of Teams Toolkit. For the changelog of pre-released versions, please refer to the [Teams Toolkit Pre-release Changelog](https://github.com/OfficeDev/TeamsFx/blob/dev/packages/vscode-extension/PRERELEASE.md). +## 5.10.0 - Sep 17, 2024 + +This update represents a minor version increment of the Teams Toolkit, introducing new features and addressing user-reported bugs. These incremental enhancements were previously documented in the prerelease version and a series of blog posts: + +- [July Prerelease](https://devblogs.microsoft.com/microsoft365dev/teams-toolkit-for-visual-studio-code-update-july-2024/): You can now debug Teams apps directly in the desktop client, use managed identities for better security, and clean up development resources more easily. +- [August Prererelease](https://devblogs.microsoft.com/microsoft365dev/teams-toolkit-for-visual-studio-code-update-august-2024/): This update adds enhanced app validation, Python support for intelligent chatbots, and the ability to create custom copilots. It also introduces the Assistant API on Azure OpenAI Service for AI Agents. + +Below is a comprehensive list of new features, enhancements, and bug fixes implemented since the last stable release. + +### New Features + +- **External File Support for Declarative Copilot Instructions**: Developers now have the ability to use an external file to author instructions for their declarative copilots and reference it in the manifest file. This greatly improves the authoring experience for longer instructions compared to using JSON files. +![External File](https://github.com/user-attachments/assets/fa13711c-fe8c-4155-bd7f-9e0a8e0ed606) + +- **Plugin Integration for Declarative Copilot**: Teams Toolkit now allows developers to add a plugin as a skill to the declarative copilot. Developers can either add a new API plugin using an OpenAPI description document or reference an existing API plugin via its manifest file. +![Add Plugin](https://github.com/user-attachments/assets/009a63d0-8bc0-4449-8ba6-cef25779c140) + +- **Enhanced App Validation**: Developers can now evaluate their app packages using the same test cases Microsoft employs during app review. The Enhanced App Validation feature in Teams Toolkit identifies any errors or warnings within your app package and provides clear guidelines for resolution. For more details on Microsoft test cases, refer to the [Teams Store validation guidelines](https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/prepare/teams-store-validation-guidelines) and [Commercial marketplace certification policies](https://learn.microsoft.com/en-us/legal/marketplace/certification-policies). +![App Validation](https://github.com/user-attachments/assets/4c2b8c49-6a0a-4ea7-8796-a94464714463) + +- **Generate an Intelligent Chatbot with Python**: Following the release of support for building [Custom Engine Copilot](https://learn.microsoft.com/microsoft-365-copilot/extensibility/overview-custom-engine-copilot) during Build 2024, which included the ability to "chat with" your own API, Teams Toolkit now extends this capability to the Python programming language. +![App Generator](https://github.com/user-attachments/assets/21efa344-aea5-4d44-bb78-aa8e26dc68a1) + +- **Create Declarative Copilot**: Teams Toolkit now allows you to build a declarative copilot, enabling you to customize Microsoft 365 Copilot by declaring specific instructions, actions, and knowledge. Declarative copilots run on the same orchestrator, foundation models, and trusted AI services that power Microsoft Copilot. You can learn more about [declarative copilots here](https://learn.microsoft.com/microsoft-365-copilot/extensibility/overview-declarative-copilot). The toolkit supports the creation of both basic declarative copilots and those with an API plugin. +![Declarative Copilot](https://github.com/user-attachments/assets/37412cdd-c7e8-4e38-bd45-794997b050ec) + +- **Using Assistant API on Azure OpenAI Service**: The Teams Toolkit has updated the `AI Agent` (Python) app template to support the Assistant API on Azure OpenAI Service. You can now build your own AI Agents on Microsoft 365 using Python, with the option to use either Azure OpenAI Service or OpenAI directly. Support for TypeScript and JavaScript is forthcoming. + +- **Debug Apps in Teams Desktop Client**: The Teams desktop client now offers a faster and more reliable way to debug your Teams applications, with the same capabilities available in the Teams web client, such as breakpoints and hot reload. This feature is now available for Custom Engine Copilots, Bots, and Message Extensions apps. +![Debug in Desktop](https://github.com/OfficeDev/teams-toolkit/assets/11220663/dc85ee11-e847-40d7-bceb-b5dc3e83f040) + +- **Use Managed Identity for Bot and Message Extension when deploying to Azure**: The Teams Toolkit has transitioned from client ID and secret-based identity to user-assigned managed identity for Bot and Message Extension application templates, enhancing security. [Learn more](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/overview) about the benefits of using managed identities for Azure resources. +![MSI](https://github.com/OfficeDev/teams-toolkit/assets/11220663/b2ffddb2-8c04-4ee4-aaaa-ae7c666af6e1) + +- **Clean Up Resources Created After Development**: You can now safely clean up resources created after application development by deleting the application registration in the Teams Developer Portal and Bot Framework Portal, and removing uploaded custom apps in Microsoft 365 applications. This can be done via the `teamsapp uninstall` command, either by using the App ID in the Teams application manifest file or by specifying an environment if your project is managed by the Teams Toolkit. +![Uninstall](https://github.com/OfficeDev/teams-toolkit/assets/11220663/294447b7-d5f9-47cc-ab37-9235dbd5c111) + +- **Integrated CodeTour Instructions for Using Graph Connector Data Source**: The `Chat With Your Data - Microsoft 365` app template in Teams Toolkit now includes interactive CodeTour instructions. By default, the app uses content uploaded to SharePoint, but with these instructions, you can easily switch to a Graph connector data source if you have external content. Learn more about using the [Graph connector](https://learn.microsoft.com/microsoft-365-copilot/extensibility/overview-graph-connector). +![Code Tour](https://github.com/OfficeDev/teams-toolkit/assets/11220663/be2eb3d6-0468-4316-8e6f-e8025408045a) + +- **Build AI Agent With Assistant API and Python**: Previously we have included the AI Assistant Bot app template to help you get started with building a GPT-like chat bot with AI capabilities using `Teams AI Library`. Now we have added a new AI Agent app template to help you build an AI agent with Assistant API and Python. This template showcases how to build an intelligent chat bot in Teams capable of helping users accomplish a specific task using natural language right in the Teams conversations, such as solving a math problem. + +### Enhancemens + +- Teams Toolkit will continue to update scaffold app templates to ensure compliance with [Teams Store validation guidelines](https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/prepare/teams-store-validation-guidelines). The first round of updates focuses on bot templates, including: + - [PR#12063](https://github.com/OfficeDev/teams-toolkit/pull/12063): Updated `Basic Bot` and `Message Extension` + - [PR#12096](https://github.com/OfficeDev/teams-toolkit/pull/12096): Updated `Chat Command` + - [PR#12123](https://github.com/OfficeDev/teams-toolkit/pull/12123): Updated `Chat Notification Messages` + - [PR#12119](https://github.com/OfficeDev/teams-toolkit/pull/12119): Updated `Sequential Workflow in Chat` +- Teams Toolkit now prompts users to generate an API key before debugging API ME or API Plugin with API Key authentication templates. +- Secret values have been redacted from the Visual Studio Code output channel. +- Updated application templates to use the latest [manifest schema version v1.17](https://learn.microsoft.com/microsoftteams/platform/resources/schema/manifest-schema). +- Improved the readability of error messages generated by the Teams Toolkit. + +### Bug Fixes + +- Upgraded the axios dependency used in Teams Toolkit to version 1.7.6 to fix a vulnerability issue. [#12306](https://github.com/OfficeDev/teams-toolkit/pull/12306) +- Changed a string for better clarity when creating an `AI Agent` without Assistant API. [#12266](https://github.com/OfficeDev/teams-toolkit/pull/12266) +- Fixed vulnerability issues in TeamsFx SDK. [#11973](https://github.com/OfficeDev/teams-toolkit/pull/11937) +- Resolved compatibility issues with `groupchat` and `groupChat` in the Teams app manifest. [#12028](https://github.com/OfficeDev/teams-toolkit/pull/12028) +- Corrected an issue where the link redirection for the lifecycle `Provision` button was incorrect. [#12120](https://github.com/OfficeDev/teams-toolkit/pull/12120) +- Fixed initialization failures of `publicClientApplication` in TeamsFx SDK. [#12159](https://github.com/OfficeDev/teams-toolkit/pull/12159) +- Addressed issues when creating SharePoint Framework-based tab apps. [#12173](https://github.com/OfficeDev/teams-toolkit/pull/12173) +- Resolved an issue where users still saw a pop-up window when logging into a Microsoft 365 account in non-interactive mode. [#11978](https://github.com/OfficeDev/teams-toolkit/pull/11978) +- Fixed an issue where importing an SPFx project failed due to case-sensitive file systems on Ubuntu. [#11972](https://github.com/OfficeDev/teams-toolkit/pull/11972) +- Addressed an issue where debugging an Outlook Add-in might fail with the error `Package is invalid`. [#11963](https://github.com/OfficeDev/teams-toolkit/pull/11963) +- Corrected unclear error messages for commands that only work for projects created by the Teams Toolkit. [#11945](https://github.com/OfficeDev/teams-toolkit/pull/11945) +- Fixed a vulnerability issue with `ws` affected by a DoS when handling a request with many HTTP headers. [#650](https://github.com/OfficeDev/teams-toolkit/security/dependabot/650) [#11937](https://github.com/OfficeDev/teams-toolkit/pull/11937) +- Fixed an issue where sometimes you may not be able to scroll down in Teams Toolkit CLI. [#11762](https://github.com/OfficeDev/teams-toolkit/pull/11762) +- Fixed an issue where Teams Toolkit generated Adaptive Cards may contain empty property. [#11759](https://github.com/OfficeDev/teams-toolkit/pull/11759) +- Fixed an issue where you may need to press enter twice after selecting resource group during provision using Teams Toolkit CLI. [#11724](https://github.com/OfficeDev/teams-toolkit/pull/11724) +- Fixed an issue to enable shell option in Windows platform to avoid [command injection via args parameters](https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2#command-injection-via-args-parameter-of-child_processspawn-without-shell-option-enabled-on-windows-cve-2024-27980---high). [#11699](https://github.com/OfficeDev/teams-toolkit/pull/11699) +- Fixed an issue where provision summary logs are printed twice. [#11658](https://github.com/OfficeDev/teams-toolkit/pull/11658) + ## 5.8.1 - May 27, 2024 Hotfix version. diff --git a/packages/vscode-extension/PRERELEASE.md b/packages/vscode-extension/PRERELEASE.md index ab174a95cf..b0ac0ffd45 100644 --- a/packages/vscode-extension/PRERELEASE.md +++ b/packages/vscode-extension/PRERELEASE.md @@ -14,6 +14,7 @@ ### September 12, 2024 #### New Features + - **External File Support for Declarative Copilot Instructions**: Developers now have the ability to use an external file to author instructions for their declarative copilots and reference it in the manifest file. This greatly improves the authoring experience for longer instructions compared to using JSON files. ![External File](https://github.com/user-attachments/assets/fa13711c-fe8c-4155-bd7f-9e0a8e0ed606) @@ -28,6 +29,7 @@ ### August 14, 2024 #### New Features + - **Enhanced App Validation**: Developers can now evaluate their app packages using the same test cases Microsoft employs during app review. The Enhanced App Validation feature in Teams Toolkit identifies any errors or warnings within your app package and provides clear guidelines for resolution. For more details on Microsoft test cases, refer to the [Teams Store validation guidelines](https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/prepare/teams-store-validation-guidelines) and [Commercial marketplace certification policies](https://learn.microsoft.com/en-us/legal/marketplace/certification-policies). ![App Validation](https://github.com/user-attachments/assets/4c2b8c49-6a0a-4ea7-8796-a94464714463) From 854706f71a3c5f99c3a333b9a03a3d35bb37803a Mon Sep 17 00:00:00 2001 From: Long Hao Date: Wed, 16 Oct 2024 16:50:05 +0800 Subject: [PATCH 16/32] build: 5.10.0 ttk --- packages/vscode-extension/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index af5e3c18ad..43b544c118 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "ms-teams-vscode-extension", "displayName": "Teams Toolkit", "description": "Create, debug, and deploy Teams apps with Teams Toolkit", - "version": "5.8.1", + "version": "5.10.0-rc", "publisher": "TeamsDevApp", "author": "Microsoft Corporation", "private": true, From ca9ade589b262b1c522d0a46d8472a9613aa44b2 Mon Sep 17 00:00:00 2001 From: MSFT-yiz Date: Fri, 27 Sep 2024 08:20:16 +0000 Subject: [PATCH 17/32] build(release): publish detail - @microsoft/teamsapp-cli@3.0.3 - @microsoft/teamsfx-core@2.0.10 - @microsoft/teamsfx-server@2.0.9 - @microsoft/teamsfx-test@0.0.7 - ms-teams-vscode-extension@5.8.2 - templates@4.2.4 --- packages/cli/package.json | 2 +- packages/fx-core/package.json | 2 +- packages/fx-core/src/common/templates-config.json | 4 ++-- packages/server/package.json | 2 +- packages/tests/package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 06ce38df99..e9aef4e8f1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsapp-cli", - "version": "3.0.2", + "version": "3.0.3", "author": "Microsoft Corporation", "description": "", "license": "MIT", diff --git a/packages/fx-core/package.json b/packages/fx-core/package.json index 8368d40424..abb0fd3c5c 100644 --- a/packages/fx-core/package.json +++ b/packages/fx-core/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-core", - "version": "2.0.9", + "version": "2.0.10", "main": "build/index.js", "types": "build/index.d.ts", "license": "MIT", diff --git a/packages/fx-core/src/common/templates-config.json b/packages/fx-core/src/common/templates-config.json index 942ccb11b9..e83ef66177 100644 --- a/packages/fx-core/src/common/templates-config.json +++ b/packages/fx-core/src/common/templates-config.json @@ -1,6 +1,6 @@ { "version": "~4.2", - "localVersion": "4.2.3", + "localVersion": "4.2.4", "tagPrefix": "templates@", "tagListURL": "https://github.com/OfficeDev/TeamsFx/releases/download/template-tag-list/template-tags.txt", "templateDownloadBaseURL": "https://github.com/OfficeDev/TeamsFx/releases/download", @@ -8,4 +8,4 @@ "templateDownloadBasePath": "/OfficeDev/TeamsFx/releases/download", "templateExt": ".zip", "useLocalTemplate": true -} \ No newline at end of file +} diff --git a/packages/server/package.json b/packages/server/package.json index dcee502915..a6ea4f1dc5 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-server", - "version": "2.0.8", + "version": "2.0.9", "author": "Microsoft Corporation", "description": "", "license": "MIT", diff --git a/packages/tests/package.json b/packages/tests/package.json index 80130402d4..d584172d79 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-test", - "version": "0.0.6", + "version": "0.0.7", "description": "A UI Test Project of Teams Toolkit Extension", "private": true, "author": "Microsoft Corporation", From 7d30aad004eb00f9345901f665d2ce3ce59c3171 Mon Sep 17 00:00:00 2001 From: MSFT-yiz Date: Wed, 16 Oct 2024 09:54:54 +0000 Subject: [PATCH 18/32] build(release): publish detail - @microsoft/teamsfx-api@0.23.2-rc-hotfix.0 - @microsoft/teamsapp-cli@3.0.4-rc-hotfix.0 - @microsoft/teamsfx-core@2.0.11-rc-hotfix.0 - @microsoft/teams-manifest@0.1.6-rc-hotfix.0 - @microsoft/teamsfx-server@2.0.10-rc-hotfix.0 - @microsoft/m365-spec-parser@0.2.2-rc-hotfix.0 - @microsoft/teamsfx-test@0.0.8-rc-hotfix.0 - ms-teams-vscode-extension@5.10.0-rc-hotfix.0 - @microsoft/vscode-ui@1.0.4-rc-hotfix.0 - templates@4.3.0-rc-hotfix.0 --- packages/api/package.json | 2 +- packages/cli/package.json | 2 +- packages/fx-core/package.json | 2 +- packages/fx-core/src/common/templates-config.json | 6 +++--- packages/manifest/package.json | 2 +- packages/server/package.json | 2 +- packages/spec-parser/package.json | 2 +- packages/tests/package.json | 2 +- packages/vscode-extension/package.json | 2 +- packages/vscode-ui/package.json | 2 +- templates/package.json | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/api/package.json b/packages/api/package.json index 9cc7bc9037..be7651a8c4 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-api", - "version": "0.23.1", + "version": "0.23.2-rc-hotfix.0", "description": "teamsfx framework api", "main": "build/index.js", "types": "build/index.d.ts", diff --git a/packages/cli/package.json b/packages/cli/package.json index e9aef4e8f1..1d7ebc37ca 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsapp-cli", - "version": "3.0.3", + "version": "3.0.4-rc-hotfix.0", "author": "Microsoft Corporation", "description": "", "license": "MIT", diff --git a/packages/fx-core/package.json b/packages/fx-core/package.json index abb0fd3c5c..0ade1f7106 100644 --- a/packages/fx-core/package.json +++ b/packages/fx-core/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-core", - "version": "2.0.10", + "version": "2.0.11-rc-hotfix.0", "main": "build/index.js", "types": "build/index.d.ts", "license": "MIT", diff --git a/packages/fx-core/src/common/templates-config.json b/packages/fx-core/src/common/templates-config.json index e83ef66177..ed3af33cc4 100644 --- a/packages/fx-core/src/common/templates-config.json +++ b/packages/fx-core/src/common/templates-config.json @@ -1,6 +1,6 @@ { - "version": "~4.2", - "localVersion": "4.2.4", + "version": "0.0.0-rc", + "localVersion": "4.3.0-rc-hotfix.0", "tagPrefix": "templates@", "tagListURL": "https://github.com/OfficeDev/TeamsFx/releases/download/template-tag-list/template-tags.txt", "templateDownloadBaseURL": "https://github.com/OfficeDev/TeamsFx/releases/download", @@ -8,4 +8,4 @@ "templateDownloadBasePath": "/OfficeDev/TeamsFx/releases/download", "templateExt": ".zip", "useLocalTemplate": true -} +} \ No newline at end of file diff --git a/packages/manifest/package.json b/packages/manifest/package.json index 57046dfccc..890d3232a8 100644 --- a/packages/manifest/package.json +++ b/packages/manifest/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teams-manifest", - "version": "0.1.5", + "version": "0.1.6-rc-hotfix.0", "main": "build/index.js", "types": "build/index.d.ts", "license": "MIT", diff --git a/packages/server/package.json b/packages/server/package.json index a6ea4f1dc5..d2fb6577b2 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-server", - "version": "2.0.9", + "version": "2.0.10-rc-hotfix.0", "author": "Microsoft Corporation", "description": "", "license": "MIT", diff --git a/packages/spec-parser/package.json b/packages/spec-parser/package.json index f876f5d08e..d74424ad86 100644 --- a/packages/spec-parser/package.json +++ b/packages/spec-parser/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/m365-spec-parser", - "version": "0.2.1", + "version": "0.2.2-rc-hotfix.0", "description": "OpenAPI specification files Parser for M365 Apps", "main": "dist/index.node.cjs.js", "browser": "dist/index.esm2017.js", diff --git a/packages/tests/package.json b/packages/tests/package.json index d584172d79..a9c4e7a7cc 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-test", - "version": "0.0.7", + "version": "0.0.8-rc-hotfix.0", "description": "A UI Test Project of Teams Toolkit Extension", "private": true, "author": "Microsoft Corporation", diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index 43b544c118..1a8653cd7e 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "ms-teams-vscode-extension", "displayName": "Teams Toolkit", "description": "Create, debug, and deploy Teams apps with Teams Toolkit", - "version": "5.10.0-rc", + "version": "5.10.0-rc-hotfix.0", "publisher": "TeamsDevApp", "author": "Microsoft Corporation", "private": true, diff --git a/packages/vscode-ui/package.json b/packages/vscode-ui/package.json index ae520429f1..cbf4de0089 100644 --- a/packages/vscode-ui/package.json +++ b/packages/vscode-ui/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/vscode-ui", - "version": "1.0.3", + "version": "1.0.4-rc-hotfix.0", "main": "build/index.js", "types": "build/index.d.ts", "license": "MIT", diff --git a/templates/package.json b/templates/package.json index 1d459eb0d4..878a419e92 100644 --- a/templates/package.json +++ b/templates/package.json @@ -1,6 +1,6 @@ { "name": "templates", - "version": "4.3.0-alpha", + "version": "4.3.0-rc-hotfix.0", "private": "true", "license": "MIT", "scripts": { From 8ccd4ef85c73aeadb49bf300c851613c04c69179 Mon Sep 17 00:00:00 2001 From: Hui Miao Date: Thu, 17 Oct 2024 12:32:55 +0800 Subject: [PATCH 19/32] refactor: update the schema url in Teams manifest --- .../api-plugin-existing-api/appPackage/manifest.json.tpl | 4 ++-- .../common/copilot-gpt-basic/appPackage/manifest.json.tpl | 4 ++-- .../api-plugin-existing-api/appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../api-plugin-from-scratch/appPackage/manifest.json.tpl | 4 ++-- .../csharp/copilot-gpt-basic/appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../js/api-plugin-from-scratch/appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- .../ts/api-plugin-from-scratch/appPackage/manifest.json.tpl | 4 ++-- .../appPackage/manifest.json.tpl | 4 ++-- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl b/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl index c8478ba803..fca63b6662 100644 --- a/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl +++ b/templates/common/api-plugin-existing-api/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "developer": { diff --git a/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl b/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl index 7a3157b05c..1fad5a63e5 100644 --- a/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl +++ b/templates/common/copilot-gpt-basic/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "developer": { diff --git a/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl index 722a62d9a0..d64f220557 100644 --- a/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-existing-api/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "developer": { diff --git a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index ba3de44eca..e59aa0c444 100644 --- a/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { diff --git a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index 47bd3a6fa1..37c607733c 100644 --- a/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { diff --git a/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl index ba3de44eca..e59aa0c444 100644 --- a/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/csharp/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { diff --git a/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl b/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl index 4256f2c864..9cc57b2418 100644 --- a/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl +++ b/templates/csharp/copilot-gpt-basic/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "version": "1.0.0", "id": "${{TEAMS_APP_ID}}", "packageName": "com.microsoft.teams.extension", diff --git a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index 89d9b6fb96..9f3caa282c 100644 --- a/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/csharp/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "packageName": "com.microsoft.teams.extension", "version": "1.0.0", diff --git a/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index 060aa731d8..cbec97515a 100644 --- a/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { diff --git a/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index f91316bb68..92cd70722c 100644 --- a/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { diff --git a/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl index 80401dfd7b..a1ae69401d 100644 --- a/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { diff --git a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index 3eeba3e18d..5a39a2e7c4 100644 --- a/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/js/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { diff --git a/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl index 3a769944b6..895fc8e4dd 100644 --- a/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch-bearer/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { diff --git a/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl index f91316bb68..92cd70722c 100644 --- a/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch-oauth/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { diff --git a/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl b/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl index be8ec6ffdd..10b5f18cb8 100644 --- a/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { diff --git a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl index 4940341d87..76f84cec3b 100644 --- a/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl +++ b/templates/ts/copilot-gpt-from-scratch-plugin/appPackage/manifest.json.tpl @@ -1,6 +1,6 @@ { - "$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", - "manifestVersion": "devPreview", + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", "id": "${{TEAMS_APP_ID}}", "version": "1.0.0", "developer": { From 9b77db789b6647b2b417ff02dd12a4f86b5d8d8b Mon Sep 17 00:00:00 2001 From: Long Hao Date: Thu, 17 Oct 2024 14:07:47 +0800 Subject: [PATCH 20/32] Revert "fix: add previe w tag" This reverts commit 51384c8fe1f11cced94b496961a265fafe7b6fba. --- packages/fx-core/src/question/constants.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/fx-core/src/question/constants.ts b/packages/fx-core/src/question/constants.ts index 38c6379099..716203e47d 100644 --- a/packages/fx-core/src/question/constants.ts +++ b/packages/fx-core/src/question/constants.ts @@ -730,7 +730,6 @@ export class CapabilityOptions { detail: getLocalizedString( "core.createProjectQuestion.projectType.declarativeCopilot.detail" ), - description: getLocalizedString("core.createProjectQuestion.option.description.preview"), }; } From 3f65ccf035292bc4b93bd52edfd4492107c15664 Mon Sep 17 00:00:00 2001 From: Hui Miao Date: Thu, 17 Oct 2024 14:21:06 +0800 Subject: [PATCH 21/32] fix: update the README file in API Plugin templates --- templates/js/api-plugin-from-scratch-bearer/README.md.tpl | 2 +- templates/js/api-plugin-from-scratch-oauth/README.md.tpl | 2 +- templates/js/api-plugin-from-scratch/README.md.tpl | 2 +- templates/ts/api-plugin-from-scratch-bearer/README.md.tpl | 2 +- templates/ts/api-plugin-from-scratch-oauth/README.md.tpl | 2 +- templates/ts/api-plugin-from-scratch/README.md.tpl | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/js/api-plugin-from-scratch-bearer/README.md.tpl b/templates/js/api-plugin-from-scratch-bearer/README.md.tpl index 781686e61b..ac2a534b8d 100644 --- a/templates/js/api-plugin-from-scratch-bearer/README.md.tpl +++ b/templates/js/api-plugin-from-scratch-bearer/README.md.tpl @@ -40,7 +40,7 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. diff --git a/templates/js/api-plugin-from-scratch-oauth/README.md.tpl b/templates/js/api-plugin-from-scratch-oauth/README.md.tpl index ac83a1d3f2..be2c860131 100644 --- a/templates/js/api-plugin-from-scratch-oauth/README.md.tpl +++ b/templates/js/api-plugin-from-scratch-oauth/README.md.tpl @@ -40,7 +40,7 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. diff --git a/templates/js/api-plugin-from-scratch/README.md.tpl b/templates/js/api-plugin-from-scratch/README.md.tpl index 0a7ca9d291..6bf44bc8ad 100644 --- a/templates/js/api-plugin-from-scratch/README.md.tpl +++ b/templates/js/api-plugin-from-scratch/README.md.tpl @@ -41,7 +41,7 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. diff --git a/templates/ts/api-plugin-from-scratch-bearer/README.md.tpl b/templates/ts/api-plugin-from-scratch-bearer/README.md.tpl index 1235bdf4ce..296dc6bfed 100644 --- a/templates/ts/api-plugin-from-scratch-bearer/README.md.tpl +++ b/templates/ts/api-plugin-from-scratch-bearer/README.md.tpl @@ -40,7 +40,7 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. diff --git a/templates/ts/api-plugin-from-scratch-oauth/README.md.tpl b/templates/ts/api-plugin-from-scratch-oauth/README.md.tpl index 30d495faf7..3e3e09da08 100644 --- a/templates/ts/api-plugin-from-scratch-oauth/README.md.tpl +++ b/templates/ts/api-plugin-from-scratch-oauth/README.md.tpl @@ -40,7 +40,7 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. diff --git a/templates/ts/api-plugin-from-scratch/README.md.tpl b/templates/ts/api-plugin-from-scratch/README.md.tpl index a14274e1bc..58c0f545cf 100644 --- a/templates/ts/api-plugin-from-scratch/README.md.tpl +++ b/templates/ts/api-plugin-from-scratch/README.md.tpl @@ -40,7 +40,7 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. From dd45be38051ed21c6aee499c7507f2976a49d440 Mon Sep 17 00:00:00 2001 From: MSFT-yiz Date: Thu, 17 Oct 2024 06:41:03 +0000 Subject: [PATCH 22/32] build(release): publish detail - @microsoft/teamsapp-cli@3.0.4-rc-hotfix.1 - @microsoft/teamsfx-core@2.0.11-rc-hotfix.1 - @microsoft/teamsfx-server@2.0.10-rc-hotfix.1 - @microsoft/teamsfx-test@0.0.8-rc-hotfix.1 - ms-teams-vscode-extension@5.10.0-rc-hotfix.1 - templates@4.3.0-rc-hotfix.1 --- packages/cli/package.json | 2 +- packages/fx-core/package.json | 2 +- packages/fx-core/src/common/templates-config.json | 2 +- packages/server/package.json | 2 +- packages/tests/package.json | 2 +- packages/vscode-extension/package.json | 2 +- templates/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 1d7ebc37ca..6a81dea59d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsapp-cli", - "version": "3.0.4-rc-hotfix.0", + "version": "3.0.4-rc-hotfix.1", "author": "Microsoft Corporation", "description": "", "license": "MIT", diff --git a/packages/fx-core/package.json b/packages/fx-core/package.json index 0ade1f7106..3146b6fb63 100644 --- a/packages/fx-core/package.json +++ b/packages/fx-core/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-core", - "version": "2.0.11-rc-hotfix.0", + "version": "2.0.11-rc-hotfix.1", "main": "build/index.js", "types": "build/index.d.ts", "license": "MIT", diff --git a/packages/fx-core/src/common/templates-config.json b/packages/fx-core/src/common/templates-config.json index ed3af33cc4..557d1c546b 100644 --- a/packages/fx-core/src/common/templates-config.json +++ b/packages/fx-core/src/common/templates-config.json @@ -1,6 +1,6 @@ { "version": "0.0.0-rc", - "localVersion": "4.3.0-rc-hotfix.0", + "localVersion": "4.3.0-rc-hotfix.1", "tagPrefix": "templates@", "tagListURL": "https://github.com/OfficeDev/TeamsFx/releases/download/template-tag-list/template-tags.txt", "templateDownloadBaseURL": "https://github.com/OfficeDev/TeamsFx/releases/download", diff --git a/packages/server/package.json b/packages/server/package.json index d2fb6577b2..0d3f629493 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-server", - "version": "2.0.10-rc-hotfix.0", + "version": "2.0.10-rc-hotfix.1", "author": "Microsoft Corporation", "description": "", "license": "MIT", diff --git a/packages/tests/package.json b/packages/tests/package.json index a9c4e7a7cc..093ef494bd 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-test", - "version": "0.0.8-rc-hotfix.0", + "version": "0.0.8-rc-hotfix.1", "description": "A UI Test Project of Teams Toolkit Extension", "private": true, "author": "Microsoft Corporation", diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index 1a8653cd7e..db57d42084 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "ms-teams-vscode-extension", "displayName": "Teams Toolkit", "description": "Create, debug, and deploy Teams apps with Teams Toolkit", - "version": "5.10.0-rc-hotfix.0", + "version": "5.10.0-rc-hotfix.1", "publisher": "TeamsDevApp", "author": "Microsoft Corporation", "private": true, diff --git a/templates/package.json b/templates/package.json index 878a419e92..6de606f490 100644 --- a/templates/package.json +++ b/templates/package.json @@ -1,6 +1,6 @@ { "name": "templates", - "version": "4.3.0-rc-hotfix.0", + "version": "4.3.0-rc-hotfix.1", "private": "true", "license": "MIT", "scripts": { From 2b1154b0ac8be6f1b924fb4f4a36e1ea693b4236 Mon Sep 17 00:00:00 2001 From: Hui Miao Date: Thu, 17 Oct 2024 16:03:00 +0800 Subject: [PATCH 23/32] fix: the readme issue in DA templates --- templates/js/api-plugin-from-scratch-bearer/README.md.tpl | 3 ++- templates/js/api-plugin-from-scratch-oauth/README.md.tpl | 3 ++- templates/js/api-plugin-from-scratch/README.md.tpl | 3 ++- templates/ts/api-plugin-from-scratch-bearer/README.md.tpl | 3 ++- templates/ts/api-plugin-from-scratch-oauth/README.md.tpl | 3 ++- templates/ts/api-plugin-from-scratch/README.md.tpl | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/templates/js/api-plugin-from-scratch-bearer/README.md.tpl b/templates/js/api-plugin-from-scratch-bearer/README.md.tpl index ac2a534b8d..a9d024030e 100644 --- a/templates/js/api-plugin-from-scratch-bearer/README.md.tpl +++ b/templates/js/api-plugin-from-scratch-bearer/README.md.tpl @@ -40,13 +40,14 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. > Note: Please make sure to switch to New Teams when Teams web client has launched {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} +3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. 4. Select your declarative agent from the `Copilot` app. 5. Send a message to Copilot to find a repair record. {{/DeclarativeCopilot}} diff --git a/templates/js/api-plugin-from-scratch-oauth/README.md.tpl b/templates/js/api-plugin-from-scratch-oauth/README.md.tpl index be2c860131..b9318e12fd 100644 --- a/templates/js/api-plugin-from-scratch-oauth/README.md.tpl +++ b/templates/js/api-plugin-from-scratch-oauth/README.md.tpl @@ -40,13 +40,14 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. > Note: Please make sure to switch to New Teams when Teams web client has launched {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} +3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. 4. Select your declarative agent from the `Copilot` app. 5. Send a message to Copilot to find a repair record. {{/DeclarativeCopilot}} diff --git a/templates/js/api-plugin-from-scratch/README.md.tpl b/templates/js/api-plugin-from-scratch/README.md.tpl index 6bf44bc8ad..ee067af652 100644 --- a/templates/js/api-plugin-from-scratch/README.md.tpl +++ b/templates/js/api-plugin-from-scratch/README.md.tpl @@ -41,13 +41,14 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. > Note: Please make sure to switch to New Teams when Teams web client has launched {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} +3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. 4. Select your declarative agent from the `Copilot` app. 5. Send a message to Copilot to find a repair record. {{/DeclarativeCopilot}} diff --git a/templates/ts/api-plugin-from-scratch-bearer/README.md.tpl b/templates/ts/api-plugin-from-scratch-bearer/README.md.tpl index 296dc6bfed..8ae532c122 100644 --- a/templates/ts/api-plugin-from-scratch-bearer/README.md.tpl +++ b/templates/ts/api-plugin-from-scratch-bearer/README.md.tpl @@ -40,13 +40,14 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. > Note: Please make sure to switch to New Teams when Teams web client has launched {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} +3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. 4. Select your declarative agent from the `Copilot` app. 5. Send a message to Copilot to find a repair record. {{/DeclarativeCopilot}} diff --git a/templates/ts/api-plugin-from-scratch-oauth/README.md.tpl b/templates/ts/api-plugin-from-scratch-oauth/README.md.tpl index 3e3e09da08..3450714c6a 100644 --- a/templates/ts/api-plugin-from-scratch-oauth/README.md.tpl +++ b/templates/ts/api-plugin-from-scratch-oauth/README.md.tpl @@ -40,13 +40,14 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. > Note: Please make sure to switch to New Teams when Teams web client has launched {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} +3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. 4. Select your declarative agent from the `Copilot` app. 5. Send a message to Copilot to find a repair record. {{/DeclarativeCopilot}} diff --git a/templates/ts/api-plugin-from-scratch/README.md.tpl b/templates/ts/api-plugin-from-scratch/README.md.tpl index 58c0f545cf..d837b73138 100644 --- a/templates/ts/api-plugin-from-scratch/README.md.tpl +++ b/templates/ts/api-plugin-from-scratch/README.md.tpl @@ -40,13 +40,14 @@ You can extend declarative agents using plugins to retrieve data and execute tas 1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. 2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. -3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. {{^DeclarativeCopilot}} +3. Select `Debug in Teams (Edge)` or `Debug in Teams (Chrome)` from the launch configuration dropdown. 4. When Teams launches in the browser, open the `Copilot` app. 5. Select `Plugins`, and from the list of plugins, turn on the toggle for your plugin. Now, you can send a prompt to trigger your plugin. > Note: Please make sure to switch to New Teams when Teams web client has launched {{/DeclarativeCopilot}} {{#DeclarativeCopilot}} +3. Select `Debug in Copilot (Edge)` or `Debug in Copilot (Chrome)` from the launch configuration dropdown. 4. Select your declarative agent from the `Copilot` app. 5. Send a message to Copilot to find a repair record. {{/DeclarativeCopilot}} From 23a5f514a3112cb6ed34f4dc4120daabfad2be09 Mon Sep 17 00:00:00 2001 From: MSFT-yiz Date: Thu, 17 Oct 2024 08:40:54 +0000 Subject: [PATCH 24/32] build(release): publish detail - templates@4.3.0-rc-hotfix.2 --- packages/fx-core/src/common/templates-config.json | 2 +- templates/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/fx-core/src/common/templates-config.json b/packages/fx-core/src/common/templates-config.json index 557d1c546b..21da98211c 100644 --- a/packages/fx-core/src/common/templates-config.json +++ b/packages/fx-core/src/common/templates-config.json @@ -1,6 +1,6 @@ { "version": "0.0.0-rc", - "localVersion": "4.3.0-rc-hotfix.1", + "localVersion": "4.3.0-rc-hotfix.2", "tagPrefix": "templates@", "tagListURL": "https://github.com/OfficeDev/TeamsFx/releases/download/template-tag-list/template-tags.txt", "templateDownloadBaseURL": "https://github.com/OfficeDev/TeamsFx/releases/download", diff --git a/templates/package.json b/templates/package.json index 6de606f490..ddb34fb914 100644 --- a/templates/package.json +++ b/templates/package.json @@ -1,6 +1,6 @@ { "name": "templates", - "version": "4.3.0-rc-hotfix.1", + "version": "4.3.0-rc-hotfix.2", "private": "true", "license": "MIT", "scripts": { From c216906f19c9a09d26bd272b32f5480c3a5b23c2 Mon Sep 17 00:00:00 2001 From: Long Hao Date: Thu, 17 Oct 2024 17:04:19 +0800 Subject: [PATCH 25/32] build: 5.10.0 ttk --- packages/vscode-extension/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index db57d42084..ea91467ff1 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "ms-teams-vscode-extension", "displayName": "Teams Toolkit", "description": "Create, debug, and deploy Teams apps with Teams Toolkit", - "version": "5.10.0-rc-hotfix.1", + "version": "5.10.0-rc-hotfix.2", "publisher": "TeamsDevApp", "author": "Microsoft Corporation", "private": true, From 508eb8b02366d99d369e65d640af1e4ed81cb7f9 Mon Sep 17 00:00:00 2001 From: MSFT-yiz Date: Thu, 17 Oct 2024 09:11:37 +0000 Subject: [PATCH 26/32] build(release): publish detail - @microsoft/teamsapp-cli@3.0.4-rc-hotfix.2 - @microsoft/teamsfx-core@2.0.11-rc-hotfix.2 - @microsoft/teamsfx-server@2.0.10-rc-hotfix.2 - @microsoft/teamsfx-test@0.0.8-rc-hotfix.2 - ms-teams-vscode-extension@5.10.0-rc-hotfix.3 - templates@4.3.0-rc-hotfix.3 --- packages/cli/package.json | 2 +- packages/fx-core/package.json | 2 +- packages/fx-core/src/common/templates-config.json | 2 +- packages/server/package.json | 2 +- packages/tests/package.json | 2 +- packages/vscode-extension/package.json | 2 +- templates/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 6a81dea59d..38e809ca64 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsapp-cli", - "version": "3.0.4-rc-hotfix.1", + "version": "3.0.4-rc-hotfix.2", "author": "Microsoft Corporation", "description": "", "license": "MIT", diff --git a/packages/fx-core/package.json b/packages/fx-core/package.json index 3146b6fb63..4865b56e2f 100644 --- a/packages/fx-core/package.json +++ b/packages/fx-core/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-core", - "version": "2.0.11-rc-hotfix.1", + "version": "2.0.11-rc-hotfix.2", "main": "build/index.js", "types": "build/index.d.ts", "license": "MIT", diff --git a/packages/fx-core/src/common/templates-config.json b/packages/fx-core/src/common/templates-config.json index 21da98211c..08c38cde25 100644 --- a/packages/fx-core/src/common/templates-config.json +++ b/packages/fx-core/src/common/templates-config.json @@ -1,6 +1,6 @@ { "version": "0.0.0-rc", - "localVersion": "4.3.0-rc-hotfix.2", + "localVersion": "4.3.0-rc-hotfix.3", "tagPrefix": "templates@", "tagListURL": "https://github.com/OfficeDev/TeamsFx/releases/download/template-tag-list/template-tags.txt", "templateDownloadBaseURL": "https://github.com/OfficeDev/TeamsFx/releases/download", diff --git a/packages/server/package.json b/packages/server/package.json index 0d3f629493..33d066b6bd 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-server", - "version": "2.0.10-rc-hotfix.1", + "version": "2.0.10-rc-hotfix.2", "author": "Microsoft Corporation", "description": "", "license": "MIT", diff --git a/packages/tests/package.json b/packages/tests/package.json index 093ef494bd..558b761ba1 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-test", - "version": "0.0.8-rc-hotfix.1", + "version": "0.0.8-rc-hotfix.2", "description": "A UI Test Project of Teams Toolkit Extension", "private": true, "author": "Microsoft Corporation", diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index ea91467ff1..01f9946dfe 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "ms-teams-vscode-extension", "displayName": "Teams Toolkit", "description": "Create, debug, and deploy Teams apps with Teams Toolkit", - "version": "5.10.0-rc-hotfix.2", + "version": "5.10.0-rc-hotfix.3", "publisher": "TeamsDevApp", "author": "Microsoft Corporation", "private": true, diff --git a/templates/package.json b/templates/package.json index ddb34fb914..1a703b75f0 100644 --- a/templates/package.json +++ b/templates/package.json @@ -1,6 +1,6 @@ { "name": "templates", - "version": "4.3.0-rc-hotfix.2", + "version": "4.3.0-rc-hotfix.3", "private": "true", "license": "MIT", "scripts": { From 4606625adc575c5ad2535933b472cacbdc3ab5aa Mon Sep 17 00:00:00 2001 From: MSFT-yiz Date: Thu, 17 Oct 2024 09:31:59 +0000 Subject: [PATCH 27/32] build(release): publish detail - @microsoft/teamsfx-api@0.23.2 - @microsoft/teamsapp-cli@3.0.4 - @microsoft/teamsfx-core@2.0.11 - @microsoft/teams-manifest@0.1.6 - @microsoft/teamsfx-server@2.0.10 - @microsoft/m365-spec-parser@0.2.2 - @microsoft/teamsfx-test@0.0.8 - ms-teams-vscode-extension@5.10.0 - @microsoft/vscode-ui@1.0.4 - templates@4.3.0 --- packages/api/package.json | 2 +- packages/cli/package.json | 2 +- packages/fx-core/package.json | 2 +- packages/fx-core/src/common/templates-config.json | 4 ++-- packages/manifest/package.json | 2 +- packages/server/package.json | 2 +- packages/spec-parser/package.json | 2 +- packages/tests/package.json | 2 +- packages/vscode-extension/package.json | 2 +- packages/vscode-ui/package.json | 2 +- templates/package.json | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/api/package.json b/packages/api/package.json index be7651a8c4..5a36a2ced8 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-api", - "version": "0.23.2-rc-hotfix.0", + "version": "0.23.2", "description": "teamsfx framework api", "main": "build/index.js", "types": "build/index.d.ts", diff --git a/packages/cli/package.json b/packages/cli/package.json index 38e809ca64..050a941dc3 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsapp-cli", - "version": "3.0.4-rc-hotfix.2", + "version": "3.0.4", "author": "Microsoft Corporation", "description": "", "license": "MIT", diff --git a/packages/fx-core/package.json b/packages/fx-core/package.json index 4865b56e2f..3ac12bb287 100644 --- a/packages/fx-core/package.json +++ b/packages/fx-core/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-core", - "version": "2.0.11-rc-hotfix.2", + "version": "2.0.11", "main": "build/index.js", "types": "build/index.d.ts", "license": "MIT", diff --git a/packages/fx-core/src/common/templates-config.json b/packages/fx-core/src/common/templates-config.json index 08c38cde25..acaba8094a 100644 --- a/packages/fx-core/src/common/templates-config.json +++ b/packages/fx-core/src/common/templates-config.json @@ -1,6 +1,6 @@ { - "version": "0.0.0-rc", - "localVersion": "4.3.0-rc-hotfix.3", + "version": "~4.3", + "localVersion": "4.3.0", "tagPrefix": "templates@", "tagListURL": "https://github.com/OfficeDev/TeamsFx/releases/download/template-tag-list/template-tags.txt", "templateDownloadBaseURL": "https://github.com/OfficeDev/TeamsFx/releases/download", diff --git a/packages/manifest/package.json b/packages/manifest/package.json index 890d3232a8..f68a5fbb60 100644 --- a/packages/manifest/package.json +++ b/packages/manifest/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teams-manifest", - "version": "0.1.6-rc-hotfix.0", + "version": "0.1.6", "main": "build/index.js", "types": "build/index.d.ts", "license": "MIT", diff --git a/packages/server/package.json b/packages/server/package.json index 33d066b6bd..b1fea19bea 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-server", - "version": "2.0.10-rc-hotfix.2", + "version": "2.0.10", "author": "Microsoft Corporation", "description": "", "license": "MIT", diff --git a/packages/spec-parser/package.json b/packages/spec-parser/package.json index d74424ad86..a45e3b9e3d 100644 --- a/packages/spec-parser/package.json +++ b/packages/spec-parser/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/m365-spec-parser", - "version": "0.2.2-rc-hotfix.0", + "version": "0.2.2", "description": "OpenAPI specification files Parser for M365 Apps", "main": "dist/index.node.cjs.js", "browser": "dist/index.esm2017.js", diff --git a/packages/tests/package.json b/packages/tests/package.json index 558b761ba1..d4ff1bb80c 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/teamsfx-test", - "version": "0.0.8-rc-hotfix.2", + "version": "0.0.8", "description": "A UI Test Project of Teams Toolkit Extension", "private": true, "author": "Microsoft Corporation", diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index 01f9946dfe..7aa020018f 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "ms-teams-vscode-extension", "displayName": "Teams Toolkit", "description": "Create, debug, and deploy Teams apps with Teams Toolkit", - "version": "5.10.0-rc-hotfix.3", + "version": "5.10.0", "publisher": "TeamsDevApp", "author": "Microsoft Corporation", "private": true, diff --git a/packages/vscode-ui/package.json b/packages/vscode-ui/package.json index cbf4de0089..341775ef9b 100644 --- a/packages/vscode-ui/package.json +++ b/packages/vscode-ui/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/vscode-ui", - "version": "1.0.4-rc-hotfix.0", + "version": "1.0.4", "main": "build/index.js", "types": "build/index.d.ts", "license": "MIT", diff --git a/templates/package.json b/templates/package.json index 1a703b75f0..8a1ae044e3 100644 --- a/templates/package.json +++ b/templates/package.json @@ -1,6 +1,6 @@ { "name": "templates", - "version": "4.3.0-rc-hotfix.3", + "version": "4.3.0", "private": "true", "license": "MIT", "scripts": { From 74b105870d1f6efbc69caacc84d9ae23da8bb1c0 Mon Sep 17 00:00:00 2001 From: Long Hao Date: Thu, 17 Oct 2024 18:27:45 +0800 Subject: [PATCH 28/32] build: changelog for 5.10.0 --- packages/vscode-extension/CHANGELOG.md | 32 ++++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/packages/vscode-extension/CHANGELOG.md b/packages/vscode-extension/CHANGELOG.md index c5ee808306..73db0060d2 100644 --- a/packages/vscode-extension/CHANGELOG.md +++ b/packages/vscode-extension/CHANGELOG.md @@ -2,7 +2,7 @@ > Note: This changelog only includes the changes for the stable versions of Teams Toolkit. For the changelog of pre-released versions, please refer to the [Teams Toolkit Pre-release Changelog](https://github.com/OfficeDev/TeamsFx/blob/dev/packages/vscode-extension/PRERELEASE.md). -## 5.10.0 - Sep 17, 2024 +## 5.10.0 - Oct 17, 2024 This update represents a minor version increment of the Teams Toolkit, introducing new features and addressing user-reported bugs. These incremental enhancements were previously documented in the prerelease version and a series of blog posts: @@ -14,33 +14,33 @@ Below is a comprehensive list of new features, enhancements, and bug fixes imple ### New Features - **External File Support for Declarative Copilot Instructions**: Developers now have the ability to use an external file to author instructions for their declarative copilots and reference it in the manifest file. This greatly improves the authoring experience for longer instructions compared to using JSON files. -![External File](https://github.com/user-attachments/assets/fa13711c-fe8c-4155-bd7f-9e0a8e0ed606) + ![External File](https://github.com/user-attachments/assets/fa13711c-fe8c-4155-bd7f-9e0a8e0ed606) - **Plugin Integration for Declarative Copilot**: Teams Toolkit now allows developers to add a plugin as a skill to the declarative copilot. Developers can either add a new API plugin using an OpenAPI description document or reference an existing API plugin via its manifest file. -![Add Plugin](https://github.com/user-attachments/assets/009a63d0-8bc0-4449-8ba6-cef25779c140) + ![Add Plugin](https://github.com/user-attachments/assets/009a63d0-8bc0-4449-8ba6-cef25779c140) -- **Enhanced App Validation**: Developers can now evaluate their app packages using the same test cases Microsoft employs during app review. The Enhanced App Validation feature in Teams Toolkit identifies any errors or warnings within your app package and provides clear guidelines for resolution. For more details on Microsoft test cases, refer to the [Teams Store validation guidelines](https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/prepare/teams-store-validation-guidelines) and [Commercial marketplace certification policies](https://learn.microsoft.com/en-us/legal/marketplace/certification-policies). -![App Validation](https://github.com/user-attachments/assets/4c2b8c49-6a0a-4ea7-8796-a94464714463) +- **Enhanced App Validation**: Developers can now evaluate their app packages using the same test cases Microsoft employs during app review. The Enhanced App Validation feature in Teams Toolkit identifies any errors or warnings within your app package and provides clear guidelines for resolution. For more details on Microsoft test cases, refer to the [Teams Store validation guidelines](https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/prepare/teams-store-validation-guidelines) and [Commercial marketplace certification policies](https://learn.microsoft.com/en-us/legal/marketplace/certification-policies). + ![App Validation](https://github.com/user-attachments/assets/4c2b8c49-6a0a-4ea7-8796-a94464714463) - **Generate an Intelligent Chatbot with Python**: Following the release of support for building [Custom Engine Copilot](https://learn.microsoft.com/microsoft-365-copilot/extensibility/overview-custom-engine-copilot) during Build 2024, which included the ability to "chat with" your own API, Teams Toolkit now extends this capability to the Python programming language. -![App Generator](https://github.com/user-attachments/assets/21efa344-aea5-4d44-bb78-aa8e26dc68a1) + ![App Generator](https://github.com/user-attachments/assets/21efa344-aea5-4d44-bb78-aa8e26dc68a1) - **Create Declarative Copilot**: Teams Toolkit now allows you to build a declarative copilot, enabling you to customize Microsoft 365 Copilot by declaring specific instructions, actions, and knowledge. Declarative copilots run on the same orchestrator, foundation models, and trusted AI services that power Microsoft Copilot. You can learn more about [declarative copilots here](https://learn.microsoft.com/microsoft-365-copilot/extensibility/overview-declarative-copilot). The toolkit supports the creation of both basic declarative copilots and those with an API plugin. -![Declarative Copilot](https://github.com/user-attachments/assets/37412cdd-c7e8-4e38-bd45-794997b050ec) + ![Declarative Copilot](https://github.com/user-attachments/assets/37412cdd-c7e8-4e38-bd45-794997b050ec) - **Using Assistant API on Azure OpenAI Service**: The Teams Toolkit has updated the `AI Agent` (Python) app template to support the Assistant API on Azure OpenAI Service. You can now build your own AI Agents on Microsoft 365 using Python, with the option to use either Azure OpenAI Service or OpenAI directly. Support for TypeScript and JavaScript is forthcoming. - **Debug Apps in Teams Desktop Client**: The Teams desktop client now offers a faster and more reliable way to debug your Teams applications, with the same capabilities available in the Teams web client, such as breakpoints and hot reload. This feature is now available for Custom Engine Copilots, Bots, and Message Extensions apps. -![Debug in Desktop](https://github.com/OfficeDev/teams-toolkit/assets/11220663/dc85ee11-e847-40d7-bceb-b5dc3e83f040) + ![Debug in Desktop](https://github.com/OfficeDev/teams-toolkit/assets/11220663/dc85ee11-e847-40d7-bceb-b5dc3e83f040) - **Use Managed Identity for Bot and Message Extension when deploying to Azure**: The Teams Toolkit has transitioned from client ID and secret-based identity to user-assigned managed identity for Bot and Message Extension application templates, enhancing security. [Learn more](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/overview) about the benefits of using managed identities for Azure resources. -![MSI](https://github.com/OfficeDev/teams-toolkit/assets/11220663/b2ffddb2-8c04-4ee4-aaaa-ae7c666af6e1) + ![MSI](https://github.com/OfficeDev/teams-toolkit/assets/11220663/b2ffddb2-8c04-4ee4-aaaa-ae7c666af6e1) - **Clean Up Resources Created After Development**: You can now safely clean up resources created after application development by deleting the application registration in the Teams Developer Portal and Bot Framework Portal, and removing uploaded custom apps in Microsoft 365 applications. This can be done via the `teamsapp uninstall` command, either by using the App ID in the Teams application manifest file or by specifying an environment if your project is managed by the Teams Toolkit. -![Uninstall](https://github.com/OfficeDev/teams-toolkit/assets/11220663/294447b7-d5f9-47cc-ab37-9235dbd5c111) + ![Uninstall](https://github.com/OfficeDev/teams-toolkit/assets/11220663/294447b7-d5f9-47cc-ab37-9235dbd5c111) - **Integrated CodeTour Instructions for Using Graph Connector Data Source**: The `Chat With Your Data - Microsoft 365` app template in Teams Toolkit now includes interactive CodeTour instructions. By default, the app uses content uploaded to SharePoint, but with these instructions, you can easily switch to a Graph connector data source if you have external content. Learn more about using the [Graph connector](https://learn.microsoft.com/microsoft-365-copilot/extensibility/overview-graph-connector). -![Code Tour](https://github.com/OfficeDev/teams-toolkit/assets/11220663/be2eb3d6-0468-4316-8e6f-e8025408045a) + ![Code Tour](https://github.com/OfficeDev/teams-toolkit/assets/11220663/be2eb3d6-0468-4316-8e6f-e8025408045a) - **Build AI Agent With Assistant API and Python**: Previously we have included the AI Assistant Bot app template to help you get started with building a GPT-like chat bot with AI capabilities using `Teams AI Library`. Now we have added a new AI Agent app template to help you build an AI agent with Assistant API and Python. This template showcases how to build an intelligent chat bot in Teams capable of helping users accomplish a specific task using natural language right in the Teams conversations, such as solving a math problem. @@ -49,7 +49,7 @@ Below is a comprehensive list of new features, enhancements, and bug fixes imple - Teams Toolkit will continue to update scaffold app templates to ensure compliance with [Teams Store validation guidelines](https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/appsource/prepare/teams-store-validation-guidelines). The first round of updates focuses on bot templates, including: - [PR#12063](https://github.com/OfficeDev/teams-toolkit/pull/12063): Updated `Basic Bot` and `Message Extension` - [PR#12096](https://github.com/OfficeDev/teams-toolkit/pull/12096): Updated `Chat Command` - - [PR#12123](https://github.com/OfficeDev/teams-toolkit/pull/12123): Updated `Chat Notification Messages` + - [PR#12123](https://github.com/OfficeDev/teams-toolkit/pull/12123): Updated `Chat Notification Messages` - [PR#12119](https://github.com/OfficeDev/teams-toolkit/pull/12119): Updated `Sequential Workflow in Chat` - Teams Toolkit now prompts users to generate an API key before debugging API ME or API Plugin with API Key authentication templates. - Secret values have been redacted from the Visual Studio Code output channel. @@ -69,7 +69,7 @@ Below is a comprehensive list of new features, enhancements, and bug fixes imple - Fixed an issue where importing an SPFx project failed due to case-sensitive file systems on Ubuntu. [#11972](https://github.com/OfficeDev/teams-toolkit/pull/11972) - Addressed an issue where debugging an Outlook Add-in might fail with the error `Package is invalid`. [#11963](https://github.com/OfficeDev/teams-toolkit/pull/11963) - Corrected unclear error messages for commands that only work for projects created by the Teams Toolkit. [#11945](https://github.com/OfficeDev/teams-toolkit/pull/11945) -- Fixed a vulnerability issue with `ws` affected by a DoS when handling a request with many HTTP headers. [#650](https://github.com/OfficeDev/teams-toolkit/security/dependabot/650) [#11937](https://github.com/OfficeDev/teams-toolkit/pull/11937) +- Fixed a vulnerability issue with `ws` affected by a DoS when handling a request with many HTTP headers. [#11937](https://github.com/OfficeDev/teams-toolkit/pull/11937) - Fixed an issue where sometimes you may not be able to scroll down in Teams Toolkit CLI. [#11762](https://github.com/OfficeDev/teams-toolkit/pull/11762) - Fixed an issue where Teams Toolkit generated Adaptive Cards may contain empty property. [#11759](https://github.com/OfficeDev/teams-toolkit/pull/11759) - Fixed an issue where you may need to press enter twice after selecting resource group during provision using Teams Toolkit CLI. [#11724](https://github.com/OfficeDev/teams-toolkit/pull/11724) @@ -80,7 +80,7 @@ Below is a comprehensive list of new features, enhancements, and bug fixes imple Hotfix version. -- Resolved an issue that occurred when the Teams Toolkit extension was used with VS Code versions v1.87.2 or earlier. See issue [#11679](https://github.com/OfficeDev/teams-toolkit/issues/11679) for more details. +- Resolved an issue that occurred when the Teams Toolkit extension was used with VS Code versions v1.87.2 or earlier. See issue [#11679](https://github.com/OfficeDev/teams-toolkit/issues/11679) for more details. - Fixed the launch URL issue in the API-based message extension template with Microsoft Entra authentication. - Fixed an issue where a `Create` label is unexpectedly shown in the Create New App dialog. @@ -95,6 +95,7 @@ This update, marking a minor version increment of the Teams Toolkit, incorporate - **Create API based Message Extensions using auth-protected API**: Teams Toolkit now supports two forms of API authentication protection for your API-based Message Extension app: ![add-auth-api-me](https://github.com/OfficeDev/TeamsFx/assets/113089977/c5faea2f-676b-4a8c-82d6-f3b037e54f0e) + - API-Key: You can either add the API key of your existing API or, if you don't have one, Teams Toolkit will generate one to demonstrate authentication flow. - Microsoft Entra (Azure AD): Teams Toolkit facilitates the creation of Microsoft Entra IDs to authenticate your new API. @@ -105,13 +106,14 @@ This update, marking a minor version increment of the Teams Toolkit, incorporate ![access-data-custom-copilot](https://github.com/OfficeDev/TeamsFx/assets/113089977/d40cfc84-8cb8-4816-b587-668a2bcf9560) Four types of data sources are available: ![data-source-custom-copilot](https://github.com/OfficeDev/TeamsFx/assets/113089977/2d010366-96a0-4f8b-861d-28d5bb9e36b8) + - `Customize`: Load data from a custom data source, for example, the file system or vector Database. - `Azure AI Search`: Load data from Azure AI Search service and use it in conversation with users. - `Custom API`: Invoke the API defined in the OpenAPI description document to retrieve domain data from the API service. - `Microsoft 365`: Query Microsoft 365 data from the Microsoft Graph Search API as a data source in the conversation. - **Build Your Own Copilots in Teams with Teams AI Library**: Enhancements have been made to the user experience for developers to create their custom copilots, AI-powered intelligent chatbots for Teams, with the following improvements: -![Custom Copilots](https://github.com/OfficeDev/TeamsFx/assets/11220663/0387a2ce-ec39-4c72-aabc-1ec2b9e85d59) + ![Custom Copilots](https://github.com/OfficeDev/TeamsFx/assets/11220663/0387a2ce-ec39-4c72-aabc-1ec2b9e85d59) - Streamlined UX for scaffolding, including top-level entry points and easy configuration of LLM services and credentials during the scaffolding flow. - New application templates allowing developers to build an AI Agent from scratch. - Python language support for building a `Basic AI Chatbot` and `AI Agent`. From f62e1d6c99d9a2866f77e242c815f46c5b461d15 Mon Sep 17 00:00:00 2001 From: Long Hao Date: Thu, 17 Oct 2024 18:33:18 +0800 Subject: [PATCH 29/32] build: changelog for 5.10.0 --- packages/vscode-extension/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index 7aa020018f..e5eec9b13b 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "ms-teams-vscode-extension", "displayName": "Teams Toolkit", "description": "Create, debug, and deploy Teams apps with Teams Toolkit", - "version": "5.10.0", + "version": "5.10.0-rc.3", "publisher": "TeamsDevApp", "author": "Microsoft Corporation", "private": true, From 38b1093ea4ca95c35c5da1ff488ea3cf984c2ee7 Mon Sep 17 00:00:00 2001 From: Long Hao Date: Thu, 17 Oct 2024 18:39:22 +0800 Subject: [PATCH 30/32] build: changelog for 5.10.0 --- packages/vscode-extension/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vscode-extension/CHANGELOG.md b/packages/vscode-extension/CHANGELOG.md index 73db0060d2..e4962358d7 100644 --- a/packages/vscode-extension/CHANGELOG.md +++ b/packages/vscode-extension/CHANGELOG.md @@ -2,7 +2,7 @@ > Note: This changelog only includes the changes for the stable versions of Teams Toolkit. For the changelog of pre-released versions, please refer to the [Teams Toolkit Pre-release Changelog](https://github.com/OfficeDev/TeamsFx/blob/dev/packages/vscode-extension/PRERELEASE.md). -## 5.10.0 - Oct 17, 2024 +## 5.10.0 - Oct 16, 2024 This update represents a minor version increment of the Teams Toolkit, introducing new features and addressing user-reported bugs. These incremental enhancements were previously documented in the prerelease version and a series of blog posts: From c3e11c73bdf576e59e132b4dc89ce7eef4e4a8bf Mon Sep 17 00:00:00 2001 From: MSFT-yiz Date: Thu, 17 Oct 2024 10:47:57 +0000 Subject: [PATCH 31/32] build(release): publish detail - ms-teams-vscode-extension@5.10.0 --- packages/vscode-extension/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index e5eec9b13b..7aa020018f 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "ms-teams-vscode-extension", "displayName": "Teams Toolkit", "description": "Create, debug, and deploy Teams apps with Teams Toolkit", - "version": "5.10.0-rc.3", + "version": "5.10.0", "publisher": "TeamsDevApp", "author": "Microsoft Corporation", "private": true, From b3fa29b72de9090fdcbb27470b777f5b61293c4f Mon Sep 17 00:00:00 2001 From: Long Hao Date: Fri, 18 Oct 2024 10:44:34 +0800 Subject: [PATCH 32/32] build: merge main back to dev --- packages/sdk-react/src/useData.ts | 2 +- packages/sdk-react/src/useGraph.ts | 4 +-- packages/sdk-react/src/useTeams.ts | 4 +-- .../sdk-react/src/useTeamsUserCredential.ts | 2 +- packages/sdk-react/test/useData.test.ts | 8 ++--- packages/sdk-react/test/useGraph.test.ts | 36 +++++++++---------- .../test/useTeamsUserCredential.test.ts | 2 +- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/sdk-react/src/useData.ts b/packages/sdk-react/src/useData.ts index ac5ac37f22..661cbf85c5 100644 --- a/packages/sdk-react/src/useData.ts +++ b/packages/sdk-react/src/useData.ts @@ -54,7 +54,7 @@ const createReducer = */ export function useData( fetchDataAsync: () => Promise, - options?: { autoLoad: boolean } + options?: { autoLoad: boolean }, ): Data { const auto = options?.autoLoad ?? true; const [{ data, loading, error }, dispatch] = useReducer(createReducer(), { diff --git a/packages/sdk-react/src/useGraph.ts b/packages/sdk-react/src/useGraph.ts index 49cdf5310e..3b6362c7ef 100644 --- a/packages/sdk-react/src/useGraph.ts +++ b/packages/sdk-react/src/useGraph.ts @@ -29,9 +29,9 @@ export function useGraphWithCredential( fetchGraphDataAsync: ( graph: Client, credential: TeamsUserCredential, - scope: string[] + scope: string[], ) => Promise, - options?: GraphOptionWithCredential + options?: GraphOptionWithCredential, ): Data { let credential: TeamsUserCredential; if (!options?.credential) { diff --git a/packages/sdk-react/src/useTeams.ts b/packages/sdk-react/src/useTeams.ts index 26a64c0bc3..f0604016f0 100644 --- a/packages/sdk-react/src/useTeams.ts +++ b/packages/sdk-react/src/useTeams.ts @@ -41,7 +41,7 @@ export function useTeams(options?: { }, { setTheme: (theme: string | undefined) => void; - } + }, ] { const [loading, setLoading] = useState(undefined); const [inTeams, setInTeams] = useState(undefined); @@ -49,7 +49,7 @@ export function useTeams(options?: { const [theme, setTheme] = useState(teamsLightTheme); const [themeString, setThemeString] = useState("default"); const [initialTheme] = useState( - options && options.initialTheme ? options.initialTheme : getTheme() + options && options.initialTheme ? options.initialTheme : getTheme(), ); const [context, setContext] = useState(undefined); const themeChangeHandler = (theme: string | undefined) => { diff --git a/packages/sdk-react/src/useTeamsUserCredential.ts b/packages/sdk-react/src/useTeamsUserCredential.ts index d10edf894b..73b980d37b 100644 --- a/packages/sdk-react/src/useTeamsUserCredential.ts +++ b/packages/sdk-react/src/useTeamsUserCredential.ts @@ -53,7 +53,7 @@ export type TeamsContextWithCredential = { * @public */ export function useTeamsUserCredential( - authConfig: TeamsUserCredentialAuthConfig + authConfig: TeamsUserCredentialAuthConfig, ): TeamsContextWithCredential { const [result] = useTeams({}); const { data, error, loading } = useData(() => { diff --git a/packages/sdk-react/test/useData.test.ts b/packages/sdk-react/test/useData.test.ts index a7d602ee53..bd6ca59b32 100644 --- a/packages/sdk-react/test/useData.test.ts +++ b/packages/sdk-react/test/useData.test.ts @@ -13,7 +13,7 @@ describe("useData() hook tests", () => { const { result } = renderHook(() => useData(() => { return Promise.resolve("data"); - }) + }), ); expect(result.current.reload).toBeDefined(); expect(result.current.data).toBe(undefined); @@ -26,7 +26,7 @@ describe("useData() hook tests", () => { expect(result.current.error).toBe(undefined); expect(result.current.loading).toBe(false); }, - { interval: 1 } + { interval: 1 }, ); }); @@ -34,7 +34,7 @@ describe("useData() hook tests", () => { const { result } = renderHook(() => useData(() => { return Promise.reject("test error"); - }) + }), ); expect(result.current.reload).toBeDefined(); expect(result.current.data).toBe(undefined); @@ -47,7 +47,7 @@ describe("useData() hook tests", () => { expect(result.current.error).toBe("test error"); expect(result.current.loading).toBe(false); }, - { interval: 1 } + { interval: 1 }, ); }); }); diff --git a/packages/sdk-react/test/useGraph.test.ts b/packages/sdk-react/test/useGraph.test.ts index 84592c18e5..71d7e897bf 100644 --- a/packages/sdk-react/test/useGraph.test.ts +++ b/packages/sdk-react/test/useGraph.test.ts @@ -40,8 +40,8 @@ describe("useGraphWithCredential() hook tests", () => { (graph: Client, credential: teamsfxlib.TeamsUserCredential, scope: string[]) => { graphScope = scope; return Promise.resolve("graph data"); - } - ) + }, + ), ); expect(result.current.reload).toBeDefined(); @@ -55,7 +55,7 @@ describe("useGraphWithCredential() hook tests", () => { expect(result.current.loading).toBe(false); expect(graphScope && graphScope[0]).toBe("User.Read"); }, - { interval: 1 } + { interval: 1 }, ); }); @@ -90,8 +90,8 @@ describe("useGraphWithCredential() hook tests", () => { { scope: ["User.Read.All"], credential: teamsUserCredential, - } - ) + }, + ), ); expect(result.current.reload).toBeDefined(); @@ -105,7 +105,7 @@ describe("useGraphWithCredential() hook tests", () => { expect(result.current.loading).toBe(false); expect(graphScope && graphScope[0]).toBe("User.Read.All"); }, - { interval: 1 } + { interval: 1 }, ); }); @@ -138,8 +138,8 @@ describe("useGraphWithCredential() hook tests", () => { } else { return Promise.resolve("graph data"); } - } - ) + }, + ), ); expect(result.current.reload).toBeDefined(); expect(result.current.data).toBe(undefined); @@ -153,7 +153,7 @@ describe("useGraphWithCredential() hook tests", () => { expect(result.current.loading).toBe(false); expect(graphScope && graphScope[0]).toBe("User.Read"); }, - { interval: 1 } + { interval: 1 }, ); act(() => result.current.reload()); @@ -161,7 +161,7 @@ describe("useGraphWithCredential() hook tests", () => { () => { expect(result.current.data).toBe("graph data"); }, - { interval: 1 } + { interval: 1 }, ); }); @@ -189,8 +189,8 @@ describe("useGraphWithCredential() hook tests", () => { const error = new GraphError(); error.code = ErrorCode.UiRequiredError; return Promise.reject(error); - } - ) + }, + ), ); expect(result.current.reload).toBeDefined(); @@ -206,7 +206,7 @@ describe("useGraphWithCredential() hook tests", () => { expect(graphScope && graphScope[0]).toBe("User.Read"); }, - { interval: 1 } + { interval: 1 }, ); act(() => result.current.reload()); @@ -218,10 +218,10 @@ describe("useGraphWithCredential() hook tests", () => { "CancelledByUser" + '\nIf you see "AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application" ' + "in the popup window, you may be using unmatched version for TeamsFx SDK (version >= 0.5.0) and Teams Toolkit (version < 3.3.0) or " + - `cli (version < 0.11.0). Please refer to the help link for how to fix the issue: https://aka.ms/teamsfx-auth-code-flow` + `cli (version < 0.11.0). Please refer to the help link for how to fix the issue: https://aka.ms/teamsfx-auth-code-flow`, ); }, - { interval: 1 } + { interval: 1 }, ); }); @@ -248,8 +248,8 @@ describe("useGraphWithCredential() hook tests", () => { graphScope = scope; const error = new Error("unknown error"); return Promise.reject(error); - } - ) + }, + ), ); expect(result.current.reload).toBeDefined(); @@ -264,7 +264,7 @@ describe("useGraphWithCredential() hook tests", () => { expect(result.current.loading).toBe(false); expect(graphScope && graphScope[0]).toBe("User.Read"); }, - { interval: 1 } + { interval: 1 }, ); }); }); diff --git a/packages/sdk-react/test/useTeamsUserCredential.test.ts b/packages/sdk-react/test/useTeamsUserCredential.test.ts index 1d0c92efed..e65ef6b7c5 100644 --- a/packages/sdk-react/test/useTeamsUserCredential.test.ts +++ b/packages/sdk-react/test/useTeamsUserCredential.test.ts @@ -64,7 +64,7 @@ describe("useTeamsUserCredential() hook tests", () => { expect(result.current.inTeams).toBe(true); expect(result.current.themeString).toBe("default"); }, - { interval: 1 } + { interval: 1 }, ); });