diff --git a/packages/fx-core/src/common/featureFlags.ts b/packages/fx-core/src/common/featureFlags.ts index 12b3e1f8ec..8d86494120 100644 --- a/packages/fx-core/src/common/featureFlags.ts +++ b/packages/fx-core/src/common/featureFlags.ts @@ -26,6 +26,7 @@ export class FeatureFlagName { static readonly NewProjectType = "TEAMSFX_NEW_PROJECT_TYPE"; static readonly ChatParticipant = "TEAMSFX_CHAT_PARTICIPANT"; static readonly ChatParticipantUIEntries = "TEAMSFX_CHAT_PARTICIPANT_ENTRIES"; + static readonly OfficeChatParticipant = "TEAMSFX_OFFICE_CHAT_PARTICIPANT"; static readonly SMEOAuth = "SME_OAUTH"; static readonly ShowDiagnostics = "TEAMSFX_SHOW_DIAGNOSTICS"; static readonly TelemetryTest = "TEAMSFX_TELEMETRY_TEST"; @@ -79,6 +80,10 @@ export class FeatureFlags { name: FeatureFlagName.ChatParticipantUIEntries, defaultValue: "false", }; + static readonly OfficeChatParticipant = { + name: FeatureFlagName.OfficeChatParticipant, + defaultValue: "false", + }; static readonly SMEOAuth = { name: FeatureFlagName.SMEOAuth, defaultValue: "false" }; static readonly ShowDiagnostics = { name: FeatureFlagName.ShowDiagnostics, diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index 48d2a161cf..b1425bc32c 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -1552,6 +1552,7 @@ "id": "ms-teams-vscode-extension.office", "name": "office", "description": "%teamstoolkit.chatParticipants.officeAddIn.description%", + "when": "fx-extension.isOfficeChatParticipantEnabled", "commands": [ { "name": "create", diff --git a/packages/vscode-extension/src/extension.ts b/packages/vscode-extension/src/extension.ts index c26ba0d193..d057102025 100644 --- a/packages/vscode-extension/src/extension.ts +++ b/packages/vscode-extension/src/extension.ts @@ -177,6 +177,7 @@ import { CHAT_CREATE_OFFICE_PROJECT_COMMAND_ID, officeChatParticipantId, } from "./officeChat/consts"; +import * as extensionPackage from "../package.json"; import { chatCreateOfficeProjectCommandHandler, handleOfficeFeedback, @@ -197,12 +198,16 @@ import { loadLocalizedStrings } from "./utils/localizeUtils"; import { checkProjectTypeAndSendTelemetry, isM365Project } from "./utils/projectChecker"; import { ReleaseNote } from "./utils/releaseNote"; import { ExtensionSurvey } from "./utils/survey"; -import { getSettingsVersion, projectVersionCheck } from "./utils/telemetryUtils"; +import { getPackageVersion, getSettingsVersion, projectVersionCheck } from "./utils/telemetryUtils"; import { createPluginWithManifest } from "./handlers/createPluginWithManifestHandler"; export async function activate(context: vscode.ExtensionContext) { - const value = IsChatParticipantEnabled && semver.gte(vscode.version, "1.90.0"); - featureFlagManager.setBooleanValue(FeatureFlags.ChatParticipant, value); + const value = + ((getPackageVersion(extensionPackage.version) === "beta" && + featureFlagManager.getBooleanValue(CoreFeatureFlags.OfficeChatParticipant)) || + getPackageVersion(extensionPackage.version) === "alpha") && + semver.gte(vscode.version, "1.90.0"); + featureFlagManager.setBooleanValue(CoreFeatureFlags.OfficeChatParticipant, value); context.subscriptions.push(new ExtTelemetry.Reporter(context)); @@ -220,10 +225,6 @@ export async function activate(context: vscode.ExtensionContext) { registerInternalCommands(context); - if (featureFlagManager.getBooleanValue(CoreFeatureFlags.ChatParticipant)) { - registerOfficeChatParticipant(context); - } - if (isTeamsFxProject) { activateTeamsFxRegistration(context); } @@ -248,6 +249,17 @@ export async function activate(context: vscode.ExtensionContext) { featureFlagManager.getBooleanValue(CoreFeatureFlags.ChatParticipantUIEntries) ); + // control whether to show office chat participant entry in chat + await vscode.commands.executeCommand( + "setContext", + "fx-extension.isOfficeChatParticipantEnabled", + featureFlagManager.getBooleanValue(CoreFeatureFlags.OfficeChatParticipant) + ); + + if (featureFlagManager.getBooleanValue(CoreFeatureFlags.OfficeChatParticipant)) { + registerOfficeChatParticipant(context); + } + // Flags for "Build Intelligent Apps" walkthrough. // DEVEOP_COPILOT_PLUGIN: boolean in vscode settings await vscode.commands.executeCommand(