@microsoft/teamsfx-core 3.0.14 → 3.0.15-alpha.3dde8a4002.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/client/aadAppClient.d.ts.map +1 -1
- package/build/client/aadAppClient.js +6 -6
- package/build/client/aadAppClient.js.map +1 -1
- package/build/common/mcpToolFetcher.d.ts +31 -0
- package/build/common/mcpToolFetcher.d.ts.map +1 -0
- package/build/common/mcpToolFetcher.js +182 -0
- package/build/common/mcpToolFetcher.js.map +1 -0
- package/build/common/odrProvider.d.ts +43 -0
- package/build/common/odrProvider.d.ts.map +1 -0
- package/build/common/odrProvider.js +154 -0
- package/build/common/odrProvider.js.map +1 -0
- package/build/common/openApiParserOptions.d.ts +3 -0
- package/build/common/openApiParserOptions.d.ts.map +1 -0
- package/build/common/openApiParserOptions.js +61 -0
- package/build/common/openApiParserOptions.js.map +1 -0
- package/build/common/secretmasker/dict.d.ts.map +1 -1
- package/build/common/secretmasker/dict.js +5 -2
- package/build/common/secretmasker/dict.js.map +1 -1
- package/build/common/secretmasker/feature.js.map +1 -1
- package/build/common/templates-config.json +4 -4
- package/build/common/wrappedAxiosClient.d.ts +1 -1
- package/build/component/coordinator/index.d.ts.map +1 -1
- package/build/component/coordinator/index.js.map +1 -1
- package/build/component/deps-checker/internal/dotnetChecker.js.map +1 -1
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.d.ts +3 -0
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.js +38 -3
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.js.map +1 -1
- package/build/component/driver/script/scriptDriver.js +1 -1
- package/build/component/driver/script/scriptDriver.js.map +1 -1
- package/build/component/driver/teamsApp/create.d.ts.map +1 -1
- package/build/component/driver/teamsApp/create.js +3 -3
- package/build/component/driver/teamsApp/create.js.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.js.map +1 -1
- package/build/component/driver/teamsApp/utils/CopilotGptManifestUtils.js.map +1 -1
- package/build/component/generator/declarativeAgent/helper.js.map +1 -1
- package/build/component/generator/officeAddin/generator.d.ts +1 -0
- package/build/component/generator/officeAddin/generator.d.ts.map +1 -1
- package/build/component/generator/officeAddin/generator.js +109 -2
- package/build/component/generator/officeAddin/generator.js.map +1 -1
- package/build/component/generator/openApiSpec/helper.d.ts +2 -3
- package/build/component/generator/openApiSpec/helper.d.ts.map +1 -1
- package/build/component/generator/openApiSpec/helper.js +6 -56
- package/build/component/generator/openApiSpec/helper.js.map +1 -1
- package/build/component/generator/templateHelper.d.ts +10 -2
- package/build/component/generator/templateHelper.d.ts.map +1 -1
- package/build/component/generator/templateHelper.js +16 -3
- package/build/component/generator/templateHelper.js.map +1 -1
- package/build/component/generator/templates/templateNames.d.ts +2 -0
- package/build/component/generator/templates/templateNames.d.ts.map +1 -1
- package/build/component/generator/templates/templateNames.js +2 -0
- package/build/component/generator/templates/templateNames.js.map +1 -1
- package/build/component/generator/utils.d.ts.map +1 -1
- package/build/component/generator/utils.js +6 -0
- package/build/component/generator/utils.js.map +1 -1
- package/build/component/generator/v4TemplateBridge.d.ts +4 -1
- package/build/component/generator/v4TemplateBridge.d.ts.map +1 -1
- package/build/component/generator/v4TemplateBridge.js +11 -3
- package/build/component/generator/v4TemplateBridge.js.map +1 -1
- package/build/component/utils/envUtil.d.ts.map +1 -1
- package/build/component/utils/envUtil.js.map +1 -1
- package/build/component/utils/mcpAuthScaffolder.d.ts.map +1 -1
- package/build/component/utils/mcpAuthScaffolder.js.map +1 -1
- package/build/component/utils/mcpToolFetcher.d.ts +1 -72
- package/build/component/utils/mcpToolFetcher.d.ts.map +1 -1
- package/build/component/utils/mcpToolFetcher.js +1 -227
- package/build/component/utils/mcpToolFetcher.js.map +1 -1
- package/build/component/utils/odrProvider.d.ts +1 -55
- package/build/component/utils/odrProvider.d.ts.map +1 -1
- package/build/component/utils/odrProvider.js +1 -101
- package/build/component/utils/odrProvider.js.map +1 -1
- package/build/core/FxCore.d.ts.map +1 -1
- package/build/core/FxCore.declarativeAgent.d.ts.map +1 -1
- package/build/core/FxCore.declarativeAgent.js +41 -0
- package/build/core/FxCore.declarativeAgent.js.map +1 -1
- package/build/core/FxCore.js +3 -5
- package/build/core/FxCore.js.map +1 -1
- package/build/core/createFrontDoorAdapters.d.ts +1 -25
- package/build/core/createFrontDoorAdapters.d.ts.map +1 -1
- package/build/core/createFrontDoorAdapters.js +4 -155
- package/build/core/createFrontDoorAdapters.js.map +1 -1
- package/build/core/createProjectFrontDoor.d.ts +10 -12
- package/build/core/createProjectFrontDoor.d.ts.map +1 -1
- package/build/core/createProjectFrontDoor.js +141 -106
- package/build/core/createProjectFrontDoor.js.map +1 -1
- package/build/core/modifyProjectFrontDoor.d.ts +0 -1
- package/build/core/modifyProjectFrontDoor.d.ts.map +1 -1
- package/build/core/modifyProjectFrontDoor.js +0 -2
- package/build/core/modifyProjectFrontDoor.js.map +1 -1
- package/build/question/inputs/AddKnowledgeInputs.d.ts.map +1 -1
- package/build/question/inputs/CreateProjectInputs.d.ts +2 -0
- package/build/question/inputs/CreateProjectInputs.d.ts.map +1 -1
- package/build/question/options/CreateProjectOptions.d.ts.map +1 -1
- package/build/question/options/CreateProjectOptions.js +7 -0
- package/build/question/options/CreateProjectOptions.js.map +1 -1
- package/build/question/other.d.ts.map +1 -1
- package/build/question/other.js +2 -1
- package/build/question/other.js.map +1 -1
- package/build/question/questionNames.d.ts +2 -0
- package/build/question/questionNames.d.ts.map +1 -1
- package/build/question/questionNames.js +2 -0
- package/build/question/questionNames.js.map +1 -1
- package/build/question/scaffold/constructNode.d.ts +3 -1
- package/build/question/scaffold/constructNode.d.ts.map +1 -1
- package/build/question/scaffold/constructNode.js +50 -0
- package/build/question/scaffold/constructNode.js.map +1 -1
- package/build/question/scaffold/vsc/CapabilityOptions.d.ts +2 -0
- package/build/question/scaffold/vsc/CapabilityOptions.d.ts.map +1 -1
- package/build/question/scaffold/vsc/CapabilityOptions.js +16 -0
- package/build/question/scaffold/vsc/CapabilityOptions.js.map +1 -1
- package/build/question/scaffold/vsc/teamsProjectTypeNode.d.ts.map +1 -1
- package/build/question/scaffold/vsc/teamsProjectTypeNode.js +0 -7
- package/build/question/scaffold/vsc/teamsProjectTypeNode.js.map +1 -1
- package/build/v4/buildTarget/parseSelector.d.ts +6 -2
- package/build/v4/buildTarget/parseSelector.d.ts.map +1 -1
- package/build/v4/buildTarget/parseSelector.js +58 -45
- package/build/v4/buildTarget/parseSelector.js.map +1 -1
- package/build/v4/buildTarget/resolveBuildTarget.d.ts +21 -7
- package/build/v4/buildTarget/resolveBuildTarget.d.ts.map +1 -1
- package/build/v4/buildTarget/resolveBuildTarget.js +97 -52
- package/build/v4/buildTarget/resolveBuildTarget.js.map +1 -1
- package/build/v4/collectInputs/collectInputs.d.ts +50 -9
- package/build/v4/collectInputs/collectInputs.d.ts.map +1 -1
- package/build/v4/collectInputs/collectInputs.js +274 -91
- package/build/v4/collectInputs/collectInputs.js.map +1 -1
- package/build/v4/distribution/createQuestions.d.ts.map +1 -1
- package/build/v4/distribution/createQuestions.js +2 -29
- package/build/v4/distribution/createQuestions.js.map +1 -1
- package/build/v4/distribution/declarativePackage.d.ts.map +1 -1
- package/build/v4/distribution/declarativePackage.js +2 -30
- package/build/v4/distribution/declarativePackage.js.map +1 -1
- package/build/v4/distribution/questionFragments.d.ts +11 -0
- package/build/v4/distribution/questionFragments.d.ts.map +1 -0
- package/build/v4/distribution/questionFragments.js +130 -0
- package/build/v4/distribution/questionFragments.js.map +1 -0
- package/build/v4/engineVersion.d.ts +7 -0
- package/build/v4/engineVersion.d.ts.map +1 -0
- package/build/v4/engineVersion.js +12 -0
- package/build/v4/engineVersion.js.map +1 -0
- package/build/v4/expression/evaluateExpression.d.ts +13 -0
- package/build/v4/expression/evaluateExpression.d.ts.map +1 -1
- package/build/v4/expression/evaluateExpression.js +57 -0
- package/build/v4/expression/evaluateExpression.js.map +1 -1
- package/build/v4/index.d.ts +7 -0
- package/build/v4/index.d.ts.map +1 -1
- package/build/v4/index.js +7 -0
- package/build/v4/index.js.map +1 -1
- package/build/v4/inspection/scaffoldCatalog.d.ts +28 -0
- package/build/v4/inspection/scaffoldCatalog.d.ts.map +1 -0
- package/build/v4/inspection/scaffoldCatalog.js +66 -0
- package/build/v4/inspection/scaffoldCatalog.js.map +1 -0
- package/build/v4/inspection/scaffoldMetadataSource.d.ts +6 -0
- package/build/v4/inspection/scaffoldMetadataSource.d.ts.map +1 -0
- package/build/v4/inspection/scaffoldMetadataSource.js +78 -0
- package/build/v4/inspection/scaffoldMetadataSource.js.map +1 -0
- package/build/v4/mcp/mcpAuthAction.d.ts +23 -0
- package/build/v4/mcp/mcpAuthAction.d.ts.map +1 -0
- package/build/v4/mcp/mcpAuthAction.js +151 -0
- package/build/v4/mcp/mcpAuthAction.js.map +1 -0
- package/build/v4/mcp/mcpAuthScaffold.d.ts +28 -0
- package/build/v4/mcp/mcpAuthScaffold.d.ts.map +1 -0
- package/build/v4/mcp/mcpAuthScaffold.js +124 -0
- package/build/v4/mcp/mcpAuthScaffold.js.map +1 -0
- package/build/v4/model/dataModel.d.ts +1 -1
- package/build/v4/model/dataModel.d.ts.map +1 -1
- package/build/v4/pipeline/runScaffoldPipeline.d.ts +17 -4
- package/build/v4/pipeline/runScaffoldPipeline.d.ts.map +1 -1
- package/build/v4/pipeline/runScaffoldPipeline.js +60 -9
- package/build/v4/pipeline/runScaffoldPipeline.js.map +1 -1
- package/build/v4/providers/createOptionsProviders.d.ts +11 -0
- package/build/v4/providers/createOptionsProviders.d.ts.map +1 -0
- package/build/v4/providers/createOptionsProviders.js +268 -0
- package/build/v4/providers/createOptionsProviders.js.map +1 -0
- package/build/v4/renderContext/buildRenderContext.d.ts.map +1 -1
- package/build/v4/renderContext/buildRenderContext.js +1 -2
- package/build/v4/renderContext/buildRenderContext.js.map +1 -1
- package/build/v4/runtime/generalSensitivityLabel.d.ts +5 -0
- package/build/v4/runtime/generalSensitivityLabel.d.ts.map +1 -0
- package/build/v4/runtime/generalSensitivityLabel.js +36 -0
- package/build/v4/runtime/generalSensitivityLabel.js.map +1 -0
- package/build/v4/runtime/inMemoryRuntime.d.ts +2 -1
- package/build/v4/runtime/inMemoryRuntime.d.ts.map +1 -1
- package/build/v4/runtime/inMemoryRuntime.js +2 -2
- package/build/v4/runtime/inMemoryRuntime.js.map +1 -1
- package/build/v4/runtime/packageParse.d.ts.map +1 -1
- package/build/v4/runtime/packageParse.js +64 -8
- package/build/v4/runtime/packageParse.js.map +1 -1
- package/build/v4/runtime/realRuntime.d.ts +2 -1
- package/build/v4/runtime/realRuntime.d.ts.map +1 -1
- package/build/v4/runtime/realRuntime.js +2 -2
- package/build/v4/runtime/realRuntime.js.map +1 -1
- package/build/v4/runtime/renderMustache.d.ts.map +1 -1
- package/build/v4/runtime/renderMustache.js +13 -4
- package/build/v4/runtime/renderMustache.js.map +1 -1
- package/build/v4/runtime/runtimeRegistry.d.ts +8 -3
- package/build/v4/runtime/runtimeRegistry.d.ts.map +1 -1
- package/build/v4/runtime/runtimeRegistry.js +122 -17
- package/build/v4/runtime/runtimeRegistry.js.map +1 -1
- package/build/v4/runtime/scaffold.d.ts +1 -0
- package/build/v4/runtime/scaffold.d.ts.map +1 -1
- package/build/v4/runtime/scaffold.js +1 -20
- package/build/v4/runtime/scaffold.js.map +1 -1
- package/build/v4/runtime/steps/daAction.d.ts.map +1 -1
- package/build/v4/runtime/steps/daAction.js +3 -111
- package/build/v4/runtime/steps/daAction.js.map +1 -1
- package/build/v4/runtime/steps/daSensitivity.d.ts +14 -0
- package/build/v4/runtime/steps/daSensitivity.d.ts.map +1 -0
- package/build/v4/runtime/steps/daSensitivity.js +50 -0
- package/build/v4/runtime/steps/daSensitivity.js.map +1 -0
- package/build/v4/runtime/steps/mcpAuth.d.ts +5 -2
- package/build/v4/runtime/steps/mcpAuth.d.ts.map +1 -1
- package/build/v4/runtime/steps/mcpAuth.js +13 -63
- package/build/v4/runtime/steps/mcpAuth.js.map +1 -1
- package/build/v4/runtime/steps/mcpLocal.d.ts +0 -4
- package/build/v4/runtime/steps/mcpLocal.d.ts.map +1 -1
- package/build/v4/runtime/steps/mcpLocal.js +11 -31
- package/build/v4/runtime/steps/mcpLocal.js.map +1 -1
- package/build/v4/runtime/steps/mcpStatic.d.ts +1 -1
- package/build/v4/runtime/steps/mcpStatic.d.ts.map +1 -1
- package/build/v4/runtime/steps/mcpStatic.js +14 -32
- package/build/v4/runtime/steps/mcpStatic.js.map +1 -1
- package/build/v4/runtime/steps/metaOs.d.ts.map +1 -1
- package/build/v4/runtime/steps/metaOs.js +39 -51
- package/build/v4/runtime/steps/metaOs.js.map +1 -1
- package/build/v4/runtime/steps/officeAddin.d.ts.map +1 -1
- package/build/v4/runtime/steps/officeAddin.js +7 -12
- package/build/v4/runtime/steps/officeAddin.js.map +1 -1
- package/build/v4/runtime/steps/openApi.d.ts.map +1 -1
- package/build/v4/runtime/steps/openApi.js +47 -555
- package/build/v4/runtime/steps/openApi.js.map +1 -1
- package/build/v4/runtime/steps/openApiCustomApi.d.ts +5 -0
- package/build/v4/runtime/steps/openApiCustomApi.d.ts.map +1 -0
- package/build/v4/runtime/steps/openApiCustomApi.js +385 -0
- package/build/v4/runtime/steps/openApiCustomApi.js.map +1 -0
- package/build/v4/runtime/withTempDirectory.d.ts +10 -0
- package/build/v4/runtime/withTempDirectory.d.ts.map +1 -0
- package/build/v4/runtime/withTempDirectory.js +41 -0
- package/build/v4/runtime/withTempDirectory.js.map +1 -0
- package/build/v4/surface/createFloorTail.d.ts +12 -0
- package/build/v4/surface/createFloorTail.d.ts.map +1 -0
- package/build/v4/surface/createFloorTail.js +138 -0
- package/build/v4/surface/createFloorTail.js.map +1 -0
- package/build/v4/surface/createInputs.d.ts +25 -3
- package/build/v4/surface/createInputs.d.ts.map +1 -1
- package/build/v4/surface/createInputs.js +54 -431
- package/build/v4/surface/createInputs.js.map +1 -1
- package/build/v4/surface/createSelectorWalk.d.ts +8 -3
- package/build/v4/surface/createSelectorWalk.d.ts.map +1 -1
- package/build/v4/surface/createSelectorWalk.js +21 -11
- package/build/v4/surface/createSelectorWalk.js.map +1 -1
- package/build/v4/surface/localizePrompt.d.ts +11 -0
- package/build/v4/surface/localizePrompt.d.ts.map +1 -0
- package/build/v4/surface/localizePrompt.js +32 -0
- package/build/v4/surface/localizePrompt.js.map +1 -0
- package/build/v4/surface/modifySelectorWalk.d.ts.map +1 -1
- package/build/v4/surface/modifySelectorWalk.js +0 -3
- package/build/v4/surface/modifySelectorWalk.js.map +1 -1
- package/build/v4/surface/uiPromptUI.d.ts.map +1 -1
- package/build/v4/surface/uiPromptUI.js +36 -41
- package/build/v4/surface/uiPromptUI.js.map +1 -1
- package/build/v4/validation/capabilityCatalog.d.ts +8 -0
- package/build/v4/validation/capabilityCatalog.d.ts.map +1 -0
- package/build/v4/validation/capabilityCatalog.js +58 -0
- package/build/v4/validation/capabilityCatalog.js.map +1 -0
- package/build/v4/validation/templateArchiveValidation.d.ts +15 -0
- package/build/v4/validation/templateArchiveValidation.d.ts.map +1 -0
- package/build/v4/validation/templateArchiveValidation.js +297 -0
- package/build/v4/validation/templateArchiveValidation.js.map +1 -0
- package/build/v4/validation/validateTemplatePackage.d.ts +21 -2
- package/build/v4/validation/validateTemplatePackage.d.ts.map +1 -1
- package/build/v4/validation/validateTemplatePackage.js +155 -31
- package/build/v4/validation/validateTemplatePackage.js.map +1 -1
- package/build/v4/validators/createInputValidators.d.ts +7 -0
- package/build/v4/validators/createInputValidators.d.ts.map +1 -0
- package/build/v4/validators/createInputValidators.js +71 -0
- package/build/v4/validators/createInputValidators.js.map +1 -0
- package/package.json +24 -18
- package/resource/package.nls.cs.json +1 -0
- package/resource/package.nls.de.json +55 -54
- package/resource/package.nls.es.json +1 -0
- package/resource/package.nls.fr.json +1 -0
- package/resource/package.nls.it.json +1 -0
- package/resource/package.nls.ja.json +1 -0
- package/resource/package.nls.json +2 -0
- package/resource/package.nls.ko.json +1 -0
- package/resource/package.nls.pl.json +1 -0
- package/resource/package.nls.pt-BR.json +1 -0
- package/resource/package.nls.ru.json +1 -0
- package/resource/package.nls.tr.json +1 -0
- package/resource/package.nls.zh-Hans.json +1 -0
- package/resource/package.nls.zh-Hant.json +1 -0
- package/resource/templates/package.nls.cs.json +9 -2
- package/resource/templates/package.nls.de.json +9 -2
- package/resource/templates/package.nls.es.json +9 -2
- package/resource/templates/package.nls.fr.json +9 -2
- package/resource/templates/package.nls.it.json +9 -2
- package/resource/templates/package.nls.ja.json +9 -2
- package/resource/templates/package.nls.json +16 -3
- package/resource/templates/package.nls.ko.json +9 -2
- package/resource/templates/package.nls.pl.json +9 -2
- package/resource/templates/package.nls.pt-BR.json +9 -2
- package/resource/templates/package.nls.ru.json +9 -2
- package/resource/templates/package.nls.tr.json +9 -2
- package/resource/templates/package.nls.zh-Hans.json +9 -2
- package/resource/templates/package.nls.zh-Hant.json +9 -2
- package/resource/templates/package.nls.zh-cn.json +7 -1
- package/resource/templates/package.nls.zh-tw.json +7 -1
- package/templates/fallback/common.zip +0 -0
- package/templates/fallback/csharp.zip +0 -0
- package/templates/fallback/js.zip +0 -0
- package/templates/fallback/python.zip +0 -0
- package/templates/fallback/ts.zip +0 -0
- package/templates/metadata/allTemplates.json +16 -2
- package/templates/metadata.zip +0 -0
- package/templates/ui/wizardNode.json +24 -0
- package/templates/v4/create-selector.json +12 -5
- package/templates/v4/floor.json +1 -1
- package/templates/v4/modify-selector.json +1 -6
- package/templates/v4/templates-metadata.zip +0 -0
- package/templates/v4/templates.zip +0 -0
- package/templates/configs/local/typescript/.gitignore +0 -1
- package/templates/configs/playground/typescript/.gitignore +0 -4
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.daActionRegisterPluginManifest = exports.STEP_REGISTER_PLUGIN_MANIFEST = void 0;
|
|
6
|
-
const tslib_1 = require("tslib");
|
|
7
6
|
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
8
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
7
|
const neverthrow_1 = require("neverthrow");
|
|
10
8
|
/** Declarative Agent manifest mutation steps for modify flows. */
|
|
11
9
|
const SOURCE = "Scaffold";
|
|
@@ -18,88 +16,6 @@ function stringParam(params, key) {
|
|
|
18
16
|
const value = params[key];
|
|
19
17
|
return typeof value === "string" ? value : undefined;
|
|
20
18
|
}
|
|
21
|
-
function isRecord(value) {
|
|
22
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23
|
-
}
|
|
24
|
-
function isAction(value) {
|
|
25
|
-
return (isRecord(value) &&
|
|
26
|
-
typeof value.id === "string" &&
|
|
27
|
-
typeof value.file === "string" &&
|
|
28
|
-
Object.values(value).every((item) => typeof item === "string"));
|
|
29
|
-
}
|
|
30
|
-
function parseJsonObject(json, errorName, filePath) {
|
|
31
|
-
let parsed;
|
|
32
|
-
try {
|
|
33
|
-
parsed = JSON.parse(json.toString("utf8"));
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
return (0, neverthrow_1.err)(systemError(errorName, `'${filePath}' is not valid JSON.`));
|
|
37
|
-
}
|
|
38
|
-
if (!isRecord(parsed)) {
|
|
39
|
-
return (0, neverthrow_1.err)(systemError(errorName, `'${filePath}' must be a JSON object.`));
|
|
40
|
-
}
|
|
41
|
-
return (0, neverthrow_1.ok)(parsed);
|
|
42
|
-
}
|
|
43
|
-
function firstFileFromArray(value) {
|
|
44
|
-
if (!Array.isArray(value)) {
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
const first = value[0];
|
|
48
|
-
return isRecord(first) && typeof first.file === "string" ? first.file : undefined;
|
|
49
|
-
}
|
|
50
|
-
function nestedRecord(value, key) {
|
|
51
|
-
if (!isRecord(value)) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
const nested = value[key];
|
|
55
|
-
return isRecord(nested) ? nested : undefined;
|
|
56
|
-
}
|
|
57
|
-
function declarativeAgentFile(teamsManifest) {
|
|
58
|
-
const copilotExtensions = nestedRecord(teamsManifest, "copilotExtensions");
|
|
59
|
-
const legacy = firstFileFromArray(copilotExtensions?.declarativeCopilots);
|
|
60
|
-
if (legacy !== undefined) {
|
|
61
|
-
return legacy;
|
|
62
|
-
}
|
|
63
|
-
const copilotAgents = nestedRecord(teamsManifest, "copilotAgents");
|
|
64
|
-
const current = firstFileFromArray(copilotAgents?.declarativeAgents);
|
|
65
|
-
if (current !== undefined) {
|
|
66
|
-
return current;
|
|
67
|
-
}
|
|
68
|
-
return firstFileFromArray(teamsManifest.declarativeAgents);
|
|
69
|
-
}
|
|
70
|
-
function normalizeTargetPath(entryPath) {
|
|
71
|
-
return entryPath.replace(/\\/g, "/");
|
|
72
|
-
}
|
|
73
|
-
function resolveSiblingPath(baseFile, relativeFile) {
|
|
74
|
-
return normalizeTargetPath(path_1.default.posix.normalize(path_1.default.posix.join(path_1.default.posix.dirname(baseFile), relativeFile)));
|
|
75
|
-
}
|
|
76
|
-
function pluginFileRelativeToAgent(agentManifestPath, pluginManifestPath) {
|
|
77
|
-
return normalizeTargetPath(path_1.default.posix.relative(path_1.default.posix.dirname(agentManifestPath), pluginManifestPath));
|
|
78
|
-
}
|
|
79
|
-
function actionId(pluginManifestPath) {
|
|
80
|
-
const basename = path_1.default.posix.basename(pluginManifestPath, path_1.default.posix.extname(pluginManifestPath));
|
|
81
|
-
return basename.startsWith("ai-plugin-") ? basename.substring("ai-plugin-".length) : basename;
|
|
82
|
-
}
|
|
83
|
-
function upsertAction(manifest, action) {
|
|
84
|
-
const existing = manifest.actions;
|
|
85
|
-
const actions = Array.isArray(existing) ? existing.filter(isAction) : [];
|
|
86
|
-
const index = actions.findIndex((item) => item.file === action.file);
|
|
87
|
-
if (index === -1) {
|
|
88
|
-
actions.push(action);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
actions[index] = action;
|
|
92
|
-
}
|
|
93
|
-
manifest.actions = actions;
|
|
94
|
-
return actions;
|
|
95
|
-
}
|
|
96
|
-
function readRequired(ctx, filePath, errorName) {
|
|
97
|
-
const current = ctx.read(filePath);
|
|
98
|
-
if (current === undefined) {
|
|
99
|
-
return (0, neverthrow_1.err)(systemError(errorName, `Cannot read '${filePath}'.`));
|
|
100
|
-
}
|
|
101
|
-
return (0, neverthrow_1.ok)(current);
|
|
102
|
-
}
|
|
103
19
|
/** Registered step for adding a rendered API plugin manifest as a DA action. */
|
|
104
20
|
exports.daActionRegisterPluginManifest = {
|
|
105
21
|
validateParams(resolved) {
|
|
@@ -117,33 +33,9 @@ exports.daActionRegisterPluginManifest = {
|
|
|
117
33
|
if (teamsManifestPath === undefined || pluginManifestPath === undefined) {
|
|
118
34
|
return (0, neverthrow_1.err)(systemError("DaActionRegisterParams", "resolved parameters are not all strings"));
|
|
119
35
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
const teamsManifest = parseJsonObject(teamsManifestRaw.value, "DaActionTeamsManifestInvalid", teamsManifestPath);
|
|
125
|
-
if (teamsManifest.isErr()) {
|
|
126
|
-
return (0, neverthrow_1.err)(teamsManifest.error);
|
|
127
|
-
}
|
|
128
|
-
const agentFile = declarativeAgentFile(teamsManifest.value);
|
|
129
|
-
if (agentFile === undefined) {
|
|
130
|
-
return (0, neverthrow_1.err)(systemError("DaActionManifestFileMissing", `The Teams manifest '${teamsManifestPath}' does not reference a declarative agent manifest.`));
|
|
131
|
-
}
|
|
132
|
-
const agentManifestPath = resolveSiblingPath(teamsManifestPath, agentFile);
|
|
133
|
-
const agentManifestRaw = readRequired(ctx, agentManifestPath, "DaActionManifestMissing");
|
|
134
|
-
if (agentManifestRaw.isErr()) {
|
|
135
|
-
return (0, neverthrow_1.err)(agentManifestRaw.error);
|
|
136
|
-
}
|
|
137
|
-
const agentManifest = parseJsonObject(agentManifestRaw.value, "DaActionManifestInvalid", agentManifestPath);
|
|
138
|
-
if (agentManifest.isErr()) {
|
|
139
|
-
return (0, neverthrow_1.err)(agentManifest.error);
|
|
140
|
-
}
|
|
141
|
-
upsertAction(agentManifest.value, {
|
|
142
|
-
id: actionId(pluginManifestPath),
|
|
143
|
-
file: pluginFileRelativeToAgent(agentManifestPath, pluginManifestPath),
|
|
144
|
-
});
|
|
145
|
-
ctx.write(agentManifestPath, Buffer.from(JSON.stringify(agentManifest.value, null, 2) + "\n", "utf8"));
|
|
146
|
-
return (0, neverthrow_1.ok)(undefined);
|
|
36
|
+
return ctx
|
|
37
|
+
.manifestWrapper("declarativeAgent")
|
|
38
|
+
.registerDeclarativeAgentAction(teamsManifestPath, pluginManifestPath);
|
|
147
39
|
},
|
|
148
40
|
};
|
|
149
41
|
//# sourceMappingURL=daAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daAction.js","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/daAction.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"daAction.js","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/daAction.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,wDAA8D;AAC9D,2CAAyC;AAGzC,kEAAkE;AAElE,MAAM,MAAM,GAAG,UAAU,CAAC;AAE1B,6DAA6D;AAChD,QAAA,6BAA6B,GAAG,oCAAoC,CAAC;AAElF,SAAS,WAAW,CAAC,IAAY,EAAE,OAAe;IAChD,OAAO,IAAI,yBAAW,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,WAAW,CAAC,MAAkB,EAAE,GAAW;IAClD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED,gFAAgF;AACnE,QAAA,8BAA8B,GAAmB;IAC5D,cAAc,CAAC,QAAoB;QACjC,IAAI,WAAW,CAAC,QAAQ,EAAE,mBAAmB,CAAC,KAAK,SAAS,EAAE,CAAC;YAC7D,OAAO,8CAA8C,CAAC;QACxD,CAAC;QACD,IAAI,WAAW,CAAC,QAAQ,EAAE,oBAAoB,CAAC,KAAK,SAAS,EAAE,CAAC;YAC9D,OAAO,+CAA+C,CAAC;QACzD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,KAAK,CAAC,QAAoB,EAAE,GAAgB;QAC1C,MAAM,iBAAiB,GAAG,WAAW,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;QACrE,MAAM,kBAAkB,GAAG,WAAW,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;QACvE,IAAI,iBAAiB,KAAK,SAAS,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;YACxE,OAAO,IAAA,gBAAG,EAAC,WAAW,CAAC,wBAAwB,EAAE,yCAAyC,CAAC,CAAC,CAAC;QAC/F,CAAC;QAED,OAAO,GAAG;aACP,eAAe,CAAC,kBAAkB,CAAC;aACnC,8BAA8B,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;IAC3E,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RegisteredStep } from "../../pipeline/runScaffoldPipeline";
|
|
2
|
+
/** Engine step name `da/set-sensitivity-label`. */
|
|
3
|
+
export declare const STEP_SET_SENSITIVITY_LABEL = "da/set-sensitivity-label";
|
|
4
|
+
/** Best-effort service used by the sensitivity-label step. */
|
|
5
|
+
export interface GeneralSensitivityLabelService {
|
|
6
|
+
resolveId(): Promise<string | undefined>;
|
|
7
|
+
}
|
|
8
|
+
/** Offline/default service used when no authenticated M365 adapter is registered. */
|
|
9
|
+
export declare const NOOP_GENERAL_SENSITIVITY_LABEL_SERVICE: GeneralSensitivityLabelService;
|
|
10
|
+
/** Bind the General-label lookup dependency into its registered step. */
|
|
11
|
+
export declare function createDaSetSensitivityLabelStep(generalSensitivityLabel: GeneralSensitivityLabelService): RegisteredStep;
|
|
12
|
+
/** Default step binding for offline runtimes and compatibility consumers. */
|
|
13
|
+
export declare const daSetSensitivityLabel: RegisteredStep;
|
|
14
|
+
//# sourceMappingURL=daSensitivity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daSensitivity.d.ts","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/daSensitivity.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAA2B,MAAM,oCAAoC,CAAC;AAI7F,mDAAmD;AACnD,eAAO,MAAM,0BAA0B,6BAA6B,CAAC;AAWrE,8DAA8D;AAC9D,MAAM,WAAW,8BAA8B;IAC7C,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAED,qFAAqF;AACrF,eAAO,MAAM,sCAAsC,EAAE,8BAEpD,CAAC;AAEF,yEAAyE;AACzE,wBAAgB,+BAA+B,CAC7C,uBAAuB,EAAE,8BAA8B,GACtD,cAAc,CAgChB;AAED,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,gBAEjC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT license.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.daSetSensitivityLabel = exports.NOOP_GENERAL_SENSITIVITY_LABEL_SERVICE = exports.STEP_SET_SENSITIVITY_LABEL = void 0;
|
|
6
|
+
exports.createDaSetSensitivityLabelStep = createDaSetSensitivityLabelStep;
|
|
7
|
+
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
8
|
+
const neverthrow_1 = require("neverthrow");
|
|
9
|
+
const SOURCE = "Scaffold";
|
|
10
|
+
/** Engine step name `da/set-sensitivity-label`. */
|
|
11
|
+
exports.STEP_SET_SENSITIVITY_LABEL = "da/set-sensitivity-label";
|
|
12
|
+
function systemError(name, message) {
|
|
13
|
+
return new teamsfx_api_1.SystemError({ source: SOURCE, name, message });
|
|
14
|
+
}
|
|
15
|
+
function manifestPath(params) {
|
|
16
|
+
const value = params.manifestPath;
|
|
17
|
+
return typeof value === "string" && value.trim().length > 0 ? value : undefined;
|
|
18
|
+
}
|
|
19
|
+
/** Offline/default service used when no authenticated M365 adapter is registered. */
|
|
20
|
+
exports.NOOP_GENERAL_SENSITIVITY_LABEL_SERVICE = {
|
|
21
|
+
resolveId: () => Promise.resolve(undefined),
|
|
22
|
+
};
|
|
23
|
+
/** Bind the General-label lookup dependency into its registered step. */
|
|
24
|
+
function createDaSetSensitivityLabelStep(generalSensitivityLabel) {
|
|
25
|
+
return {
|
|
26
|
+
validateParams(resolved) {
|
|
27
|
+
return manifestPath(resolved) === undefined
|
|
28
|
+
? "missing non-empty string parameter 'manifestPath'"
|
|
29
|
+
: undefined;
|
|
30
|
+
},
|
|
31
|
+
async apply(resolved, ctx) {
|
|
32
|
+
const path = manifestPath(resolved);
|
|
33
|
+
if (path === undefined) {
|
|
34
|
+
return (0, neverthrow_1.err)(systemError("DaSensitivityLabelParams", "resolved manifestPath is not a non-empty string"));
|
|
35
|
+
}
|
|
36
|
+
const id = await generalSensitivityLabel.resolveId();
|
|
37
|
+
if (id === undefined) {
|
|
38
|
+
return (0, neverthrow_1.ok)(undefined);
|
|
39
|
+
}
|
|
40
|
+
const wrapper = ctx.manifestWrapper("declarativeAgent");
|
|
41
|
+
if (wrapper.setSensitivityLabel === undefined) {
|
|
42
|
+
return (0, neverthrow_1.err)(systemError("DaSensitivityLabelWrapperMissing", "the Declarative Agent manifest wrapper cannot set a sensitivity label"));
|
|
43
|
+
}
|
|
44
|
+
return wrapper.setSensitivityLabel(path, id);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** Default step binding for offline runtimes and compatibility consumers. */
|
|
49
|
+
exports.daSetSensitivityLabel = createDaSetSensitivityLabelStep(exports.NOOP_GENERAL_SENSITIVITY_LABEL_SERVICE);
|
|
50
|
+
//# sourceMappingURL=daSensitivity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daSensitivity.js","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/daSensitivity.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AA+BlC,0EAkCC;AA/DD,wDAA8D;AAC9D,2CAA6C;AAG7C,MAAM,MAAM,GAAG,UAAU,CAAC;AAE1B,mDAAmD;AACtC,QAAA,0BAA0B,GAAG,0BAA0B,CAAC;AAErE,SAAS,WAAW,CAAC,IAAY,EAAE,OAAe;IAChD,OAAO,IAAI,yBAAW,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,YAAY,CAAC,MAAkB;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAClF,CAAC;AAOD,qFAAqF;AACxE,QAAA,sCAAsC,GAAmC;IACpF,SAAS,EAAE,GAAuB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;CAChE,CAAC;AAEF,yEAAyE;AACzE,SAAgB,+BAA+B,CAC7C,uBAAuD;IAEvD,OAAO;QACL,cAAc,CAAC,QAAoB;YACjC,OAAO,YAAY,CAAC,QAAQ,CAAC,KAAK,SAAS;gBACzC,CAAC,CAAC,mDAAmD;gBACrD,CAAC,CAAC,SAAS,CAAC;QAChB,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,QAAoB,EAAE,GAAgB;YAChD,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;YACpC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,OAAO,IAAA,gBAAG,EACR,WAAW,CAAC,0BAA0B,EAAE,iDAAiD,CAAC,CAC3F,CAAC;YACJ,CAAC;YAED,MAAM,EAAE,GAAG,MAAM,uBAAuB,CAAC,SAAS,EAAE,CAAC;YACrD,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;gBACrB,OAAO,IAAA,eAAE,EAAC,SAAS,CAAC,CAAC;YACvB,CAAC;YAED,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;YACxD,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;gBAC9C,OAAO,IAAA,gBAAG,EACR,WAAW,CACT,kCAAkC,EAClC,uEAAuE,CACxE,CACF,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC/C,CAAC;KACF,CAAC;AACJ,CAAC;AAED,6EAA6E;AAChE,QAAA,qBAAqB,GAAG,+BAA+B,CAClE,8CAAsC,CACvC,CAAC"}
|
|
@@ -3,8 +3,11 @@ import { RegisteredStep } from "../../pipeline/runScaffoldPipeline";
|
|
|
3
3
|
export declare const STEP_INJECT_YML_ACTION = "mcp-auth/inject-yml-action";
|
|
4
4
|
/** Engine step name `mcp-auth/persist-credential-env`. */
|
|
5
5
|
export declare const STEP_PERSIST_CREDENTIAL_ENV = "mcp-auth/persist-credential-env";
|
|
6
|
-
/** Registered step for injecting the auth
|
|
6
|
+
/** Registered step for injecting the shared v4 MCP auth action into `m365agents.yml`. */
|
|
7
7
|
export declare const mcpAuthInjectYmlAction: RegisteredStep;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Registered step for writing the deterministic `MCP_DA_AUTH_ID_<NS>` registration placeholder into
|
|
10
|
+
* `env/.env.dev`.
|
|
11
|
+
*/
|
|
9
12
|
export declare const mcpAuthPersistCredentialEnv: RegisteredStep;
|
|
10
13
|
//# sourceMappingURL=mcpAuth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpAuth.d.ts","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/mcpAuth.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAA2B,MAAM,oCAAoC,CAAC;AAO7F,qDAAqD;AACrD,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AAEnE,0DAA0D;AAC1D,eAAO,MAAM,2BAA2B,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"mcpAuth.d.ts","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/mcpAuth.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAA2B,MAAM,oCAAoC,CAAC;AAO7F,qDAAqD;AACrD,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AAEnE,0DAA0D;AAC1D,eAAO,MAAM,2BAA2B,oCAAoC,CAAC;AAY7E,yFAAyF;AACzF,eAAO,MAAM,sBAAsB,EAAE,cAwBpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,cAiBzC,CAAC"}
|
|
@@ -5,15 +5,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.mcpAuthPersistCredentialEnv = exports.mcpAuthInjectYmlAction = exports.STEP_PERSIST_CREDENTIAL_ENV = exports.STEP_INJECT_YML_ACTION = void 0;
|
|
6
6
|
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
7
7
|
const neverthrow_1 = require("neverthrow");
|
|
8
|
-
const
|
|
8
|
+
const mcpAuthScaffold_1 = require("../../mcp/mcpAuthScaffold");
|
|
9
9
|
/** MCP auth post-render steps for the create flow. See create-mcp-server scenario spec. */
|
|
10
10
|
const SOURCE = "Scaffold";
|
|
11
11
|
/** Engine step name `mcp-auth/inject-yml-action`. */
|
|
12
12
|
exports.STEP_INJECT_YML_ACTION = "mcp-auth/inject-yml-action";
|
|
13
13
|
/** Engine step name `mcp-auth/persist-credential-env`. */
|
|
14
14
|
exports.STEP_PERSIST_CREDENTIAL_ENV = "mcp-auth/persist-credential-env";
|
|
15
|
-
/** The create flow scaffolds the `dev` environment; this is its credential file. */
|
|
16
|
-
const CREATE_ENV_FILE = "env/.env.dev";
|
|
17
15
|
function systemError(name, message) {
|
|
18
16
|
return new teamsfx_api_1.SystemError({ source: SOURCE, name, message });
|
|
19
17
|
}
|
|
@@ -22,33 +20,7 @@ function stringParam(params, key) {
|
|
|
22
20
|
const value = params[key];
|
|
23
21
|
return typeof value === "string" ? value : undefined;
|
|
24
22
|
}
|
|
25
|
-
/**
|
|
26
|
-
function registrationId(serverUrl) {
|
|
27
|
-
return "MCP_DA_AUTH_ID_" + (0, whitelist_1.deriveMcpServerName)(serverUrl).toUpperCase();
|
|
28
|
-
}
|
|
29
|
-
/** The registration action a given auth type uses. */
|
|
30
|
-
function authActionUses(authType) {
|
|
31
|
-
return authType === "entra-sso" ? "microsoftEntra/register" : "oauth/register";
|
|
32
|
-
}
|
|
33
|
-
/** Insert an action block as the first entry under the top-level `provision:` key. */
|
|
34
|
-
function injectUnderProvision(yml, block) {
|
|
35
|
-
const lines = yml.split("\n");
|
|
36
|
-
const index = lines.findIndex((line) => line.trim() === "provision:");
|
|
37
|
-
if (index === -1) {
|
|
38
|
-
return yml + "\nprovision:\n" + block + "\n";
|
|
39
|
-
}
|
|
40
|
-
lines.splice(index + 1, 0, block);
|
|
41
|
-
return lines.join("\n");
|
|
42
|
-
}
|
|
43
|
-
function containsRegistrationAction(yml, authType, serverUrl) {
|
|
44
|
-
return (yml.includes(`- uses: ${authActionUses(authType)}`) &&
|
|
45
|
-
yml.includes(`registrationId: ${registrationId(serverUrl)}`));
|
|
46
|
-
}
|
|
47
|
-
/** True if the dotenv content already declares `name=…` (idempotency guard). */
|
|
48
|
-
function containsEnvVar(envContent, name) {
|
|
49
|
-
return envContent.split("\n").some((line) => line.startsWith(name + "="));
|
|
50
|
-
}
|
|
51
|
-
/** Registered step for injecting the auth registration action into `m365agents.yml`. */
|
|
23
|
+
/** Registered step for injecting the shared v4 MCP auth action into `m365agents.yml`. */
|
|
52
24
|
exports.mcpAuthInjectYmlAction = {
|
|
53
25
|
validateParams(resolved) {
|
|
54
26
|
if (stringParam(resolved, "ymlPath") === undefined) {
|
|
@@ -65,31 +37,17 @@ exports.mcpAuthInjectYmlAction = {
|
|
|
65
37
|
apply(resolved, ctx) {
|
|
66
38
|
const ymlPath = stringParam(resolved, "ymlPath");
|
|
67
39
|
const authType = stringParam(resolved, "authType");
|
|
68
|
-
const
|
|
69
|
-
if (ymlPath === undefined || authType === undefined ||
|
|
70
|
-
return (0, neverthrow_1.err)(systemError("
|
|
71
|
-
}
|
|
72
|
-
const current = ctx.read(ymlPath);
|
|
73
|
-
if (current === undefined) {
|
|
74
|
-
return (0, neverthrow_1.err)(systemError("McpAuthYmlMissing", `Cannot inject the auth action: '${ymlPath}' was not produced by the render phase.`));
|
|
40
|
+
const mcpServerUrl = stringParam(resolved, "mcpServerUrl");
|
|
41
|
+
if (ymlPath === undefined || authType === undefined || mcpServerUrl === undefined) {
|
|
42
|
+
return Promise.resolve((0, neverthrow_1.err)(systemError("McpAuthInjectParams", "resolved parameters are not all strings")));
|
|
75
43
|
}
|
|
76
|
-
|
|
77
|
-
if (containsRegistrationAction(yml, authType, serverUrl)) {
|
|
78
|
-
return (0, neverthrow_1.ok)(undefined);
|
|
79
|
-
}
|
|
80
|
-
const block = [
|
|
81
|
-
` - uses: ${authActionUses(authType)}`,
|
|
82
|
-
` with:`,
|
|
83
|
-
` name: ${(0, whitelist_1.deriveMcpServerName)(serverUrl)}`,
|
|
84
|
-
` writeToEnvironmentFile:`,
|
|
85
|
-
` registrationId: ${registrationId(serverUrl)}`,
|
|
86
|
-
].join("\n");
|
|
87
|
-
const injected = injectUnderProvision(yml, block);
|
|
88
|
-
ctx.write(ymlPath, Buffer.from(injected, "utf8"));
|
|
89
|
-
return (0, neverthrow_1.ok)(undefined);
|
|
44
|
+
return (0, mcpAuthScaffold_1.injectMcpAuthAction)(ctx, { ymlPath, authType, mcpServerUrl });
|
|
90
45
|
},
|
|
91
46
|
};
|
|
92
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Registered step for writing the deterministic `MCP_DA_AUTH_ID_<NS>` registration placeholder into
|
|
49
|
+
* `env/.env.dev`.
|
|
50
|
+
*/
|
|
93
51
|
exports.mcpAuthPersistCredentialEnv = {
|
|
94
52
|
validateParams(resolved) {
|
|
95
53
|
if (stringParam(resolved, "authType") === undefined) {
|
|
@@ -101,19 +59,11 @@ exports.mcpAuthPersistCredentialEnv = {
|
|
|
101
59
|
return undefined;
|
|
102
60
|
},
|
|
103
61
|
apply(resolved, ctx) {
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
62
|
+
const mcpServerUrl = stringParam(resolved, "mcpServerUrl");
|
|
63
|
+
if (mcpServerUrl === undefined) {
|
|
106
64
|
return (0, neverthrow_1.err)(systemError("McpAuthPersistParams", "resolved parameters are not all strings"));
|
|
107
65
|
}
|
|
108
|
-
|
|
109
|
-
const current = ctx.read(CREATE_ENV_FILE);
|
|
110
|
-
const base = current ? current.toString("utf8") : "";
|
|
111
|
-
if (containsEnvVar(base, varName)) {
|
|
112
|
-
return (0, neverthrow_1.ok)(undefined);
|
|
113
|
-
}
|
|
114
|
-
const separator = base.length > 0 && !base.endsWith("\n") ? "\n" : "";
|
|
115
|
-
ctx.write(CREATE_ENV_FILE, Buffer.from(base + separator + varName + "=\n", "utf8"));
|
|
116
|
-
return (0, neverthrow_1.ok)(undefined);
|
|
66
|
+
return (0, mcpAuthScaffold_1.persistMcpAuthRegistrationEnv)(ctx, { mcpServerUrl });
|
|
117
67
|
},
|
|
118
68
|
};
|
|
119
69
|
//# sourceMappingURL=mcpAuth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpAuth.js","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/mcpAuth.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,wDAA8D;AAC9D,
|
|
1
|
+
{"version":3,"file":"mcpAuth.js","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/mcpAuth.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,wDAA8D;AAC9D,2CAAyC;AAEzC,+DAA+F;AAE/F,2FAA2F;AAE3F,MAAM,MAAM,GAAG,UAAU,CAAC;AAE1B,qDAAqD;AACxC,QAAA,sBAAsB,GAAG,4BAA4B,CAAC;AAEnE,0DAA0D;AAC7C,QAAA,2BAA2B,GAAG,iCAAiC,CAAC;AAE7E,SAAS,WAAW,CAAC,IAAY,EAAE,OAAe;IAChD,OAAO,IAAI,yBAAW,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,oFAAoF;AACpF,SAAS,WAAW,CAAC,MAAkB,EAAE,GAAW;IAClD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED,yFAAyF;AAC5E,QAAA,sBAAsB,GAAmB;IACpD,cAAc,CAAC,QAAoB;QACjC,IAAI,WAAW,CAAC,QAAQ,EAAE,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;YACnD,OAAO,oCAAoC,CAAC;QAC9C,CAAC;QACD,IAAI,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,SAAS,EAAE,CAAC;YACpD,OAAO,qCAAqC,CAAC;QAC/C,CAAC;QACD,IAAI,WAA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sBAAsB,EAAE,yCAAyC,CAAC,CAAC,CAAC;QAC7F,CAAC;QACD,OAAO,IAAA,+CAA6B,EAAC,GAAG,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { type ODRServer } from "../../../component/utils/odrProvider";
|
|
2
1
|
import { RegisteredStep } from "../../pipeline/runScaffoldPipeline";
|
|
3
|
-
export declare const mcpLocalDeps: {
|
|
4
|
-
listServers: () => Promise<ODRServer[]>;
|
|
5
|
-
};
|
|
6
2
|
/** Engine step name `mcp-local/materialize-servers`. */
|
|
7
3
|
export declare const STEP_MATERIALIZE_LOCAL_SERVERS = "mcp-local/materialize-servers";
|
|
8
4
|
/** Registered step for writing `.vscode/mcp.json` in the local branch. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpLocal.d.ts","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/mcpLocal.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"mcpLocal.d.ts","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/mcpLocal.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAA2B,MAAM,oCAAoC,CAAC;AAM7F,wDAAwD;AACxD,eAAO,MAAM,8BAA8B,kCAAkC,CAAC;AA6D9E,0EAA0E;AAC1E,eAAO,MAAM,0BAA0B,EAAE,cA+CxC,CAAC"}
|
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.mcpLocalMaterializeServers = exports.STEP_MATERIALIZE_LOCAL_SERVERS =
|
|
5
|
+
exports.mcpLocalMaterializeServers = exports.STEP_MATERIALIZE_LOCAL_SERVERS = void 0;
|
|
6
6
|
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
7
7
|
const neverthrow_1 = require("neverthrow");
|
|
8
|
-
const odrProvider_1 = require("../../../component/utils/odrProvider");
|
|
9
8
|
/** Materialize local MCP stdio servers. See create-mcp-server scenario spec. */
|
|
10
9
|
const SOURCE = "Scaffold";
|
|
11
|
-
exports.mcpLocalDeps = {
|
|
12
|
-
listServers: () => odrProvider_1.ODRProvider.listServers(),
|
|
13
|
-
};
|
|
14
10
|
/** Engine step name `mcp-local/materialize-servers`. */
|
|
15
11
|
exports.STEP_MATERIALIZE_LOCAL_SERVERS = "mcp-local/materialize-servers";
|
|
16
12
|
function systemError(name, message) {
|
|
@@ -21,13 +17,6 @@ function stringParam(params, key) {
|
|
|
21
17
|
const value = params[key];
|
|
22
18
|
return typeof value === "string" ? value : undefined;
|
|
23
19
|
}
|
|
24
|
-
function optionalStringParam(params, key) {
|
|
25
|
-
const value = stringParam(params, key);
|
|
26
|
-
if (value === undefined || /^\{\{[A-Za-z_][A-Za-z0-9_.]*\}\}$/.test(value)) {
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
20
|
/** Read a `with` value as the multiSelect `string[]`, or `undefined`. */
|
|
32
21
|
function stringArrayParam(params, key) {
|
|
33
22
|
const value = params[key];
|
|
@@ -42,13 +31,6 @@ function isRecord(value) {
|
|
|
42
31
|
function errorMessage(error) {
|
|
43
32
|
return error instanceof Error ? error.message : String(error);
|
|
44
33
|
}
|
|
45
|
-
function catalogFromServers(servers) {
|
|
46
|
-
const catalog = {};
|
|
47
|
-
for (const server of servers) {
|
|
48
|
-
catalog[server.name] = { command: server.command, args: server.args };
|
|
49
|
-
}
|
|
50
|
-
return catalog;
|
|
51
|
-
}
|
|
52
34
|
/** Build one stdio server from its catalog record. */
|
|
53
35
|
function toLocalServer(id, entry) {
|
|
54
36
|
if (!isRecord(entry)) {
|
|
@@ -74,26 +56,24 @@ exports.mcpLocalMaterializeServers = {
|
|
|
74
56
|
if (stringArrayParam(resolved, "selected") === undefined) {
|
|
75
57
|
return "missing string[] parameter 'selected'";
|
|
76
58
|
}
|
|
59
|
+
if (stringParam(resolved, "catalog") === undefined) {
|
|
60
|
+
return "missing string parameter 'catalog'";
|
|
61
|
+
}
|
|
77
62
|
return undefined;
|
|
78
63
|
},
|
|
79
|
-
|
|
64
|
+
apply(resolved, ctx) {
|
|
80
65
|
const target = stringParam(resolved, "target");
|
|
81
66
|
const selected = stringArrayParam(resolved, "selected");
|
|
82
|
-
const catalogRaw =
|
|
83
|
-
if (target === undefined || selected === undefined) {
|
|
67
|
+
const catalogRaw = stringParam(resolved, "catalog");
|
|
68
|
+
if (target === undefined || selected === undefined || catalogRaw === undefined) {
|
|
84
69
|
return (0, neverthrow_1.err)(systemError("McpLocalParams", "resolved parameters are not all of the expected type"));
|
|
85
70
|
}
|
|
86
71
|
let parsed;
|
|
87
|
-
|
|
88
|
-
parsed =
|
|
72
|
+
try {
|
|
73
|
+
parsed = JSON.parse(catalogRaw);
|
|
89
74
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
parsed = JSON.parse(catalogRaw);
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
return (0, neverthrow_1.err)(systemError("McpLocalCatalogParse", `local server catalog is not valid JSON: ${errorMessage(error)}`));
|
|
96
|
-
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
return (0, neverthrow_1.err)(systemError("McpLocalCatalogParse", `local server catalog is not valid JSON: ${errorMessage(error)}`));
|
|
97
77
|
}
|
|
98
78
|
if (!isRecord(parsed)) {
|
|
99
79
|
return (0, neverthrow_1.err)(systemError("McpLocalCatalogShape", "local server catalog is not a JSON object"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpLocal.js","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/mcpLocal.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,wDAA8D;AAC9D,2CAA6C;
|
|
1
|
+
{"version":3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AC,CAAC;YAC5C,IAAI,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;gBAClB,OAAO,IAAA,gBAAG,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC;YACD,OAAO,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;QAC5B,CAAC;QACD,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QACpF,OAAO,IAAA,eAAE,EAAC,SAAS,CAAC,CAAC;IACvB,CAAC;CACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MCPFetchResult } from "../../../
|
|
1
|
+
import { MCPFetchResult } from "../../../common/mcpToolFetcher";
|
|
2
2
|
import { RegisteredStep } from "../../pipeline/runScaffoldPipeline";
|
|
3
3
|
export declare const mcpStaticDeps: {
|
|
4
4
|
fetchTools: (serverUrl: string) => Promise<MCPFetchResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpStatic.d.ts","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/mcpStatic.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAiB,MAAM,
|
|
1
|
+
{"version":3,"file":"mcpStatic.d.ts","sourceRoot":"","sources":["../../../../src/v4/runtime/steps/mcpStatic.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAiB,MAAM,gCAAgC,CAAC;AAE/E,OAAO,EAAE,cAAc,EAA2B,MAAM,oCAAoC,CAAC;AAM7F,eAAO,MAAM,aAAa;4BACA,MAAM,KAAG,OAAO,CAAC,cAAc,CAAC;CACzD,CAAC;AAEF,uDAAuD;AACvD,eAAO,MAAM,iCAAiC,iCAAiC,CAAC;AA2IhF,0FAA0F;AAC1F,eAAO,MAAM,yBAAyB,EAAE,cAqFvC,CAAC"}
|
|
@@ -7,7 +7,7 @@ const tslib_1 = require("tslib");
|
|
|
7
7
|
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
8
8
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
9
9
|
const neverthrow_1 = require("neverthrow");
|
|
10
|
-
const mcpToolFetcher_1 = require("../../../
|
|
10
|
+
const mcpToolFetcher_1 = require("../../../common/mcpToolFetcher");
|
|
11
11
|
const mcpStaticTools_1 = require("../../mcp/mcpStaticTools");
|
|
12
12
|
/** Materialize static MCP tools and plugin runtime metadata. */
|
|
13
13
|
const SOURCE = "Scaffold";
|
|
@@ -55,9 +55,6 @@ function hasOptionalArrayParamValue(params, key) {
|
|
|
55
55
|
value === "" ||
|
|
56
56
|
(typeof value === "string" && isUnresolvedToken(value)));
|
|
57
57
|
}
|
|
58
|
-
function isRecord(value) {
|
|
59
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
60
|
-
}
|
|
61
58
|
function mcpToolsJsonFromFetchResult(serverUrl, result) {
|
|
62
59
|
if (result.requiresAuth) {
|
|
63
60
|
return (0, neverthrow_1.err)(new teamsfx_api_1.UserError({
|
|
@@ -110,22 +107,12 @@ async function resolveToolsJson(resolved, serverUrl) {
|
|
|
110
107
|
function errorMessage(error) {
|
|
111
108
|
return error instanceof Error ? error.message : String(error);
|
|
112
109
|
}
|
|
113
|
-
function
|
|
110
|
+
function readRequiredPlugin(ctx, pluginPath) {
|
|
114
111
|
const current = ctx.read(pluginPath);
|
|
115
112
|
if (current === undefined) {
|
|
116
113
|
return (0, neverthrow_1.err)(systemError("McpStaticPluginMissing", `Cannot materialize static MCP tools because '${pluginPath}' was not produced by the render phase.`));
|
|
117
114
|
}
|
|
118
|
-
|
|
119
|
-
try {
|
|
120
|
-
parsed = JSON.parse(current.toString("utf8"));
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
return (0, neverthrow_1.err)(systemError("McpStaticPluginParse", `Cannot parse '${pluginPath}' as JSON: ${errorMessage(error)}`));
|
|
124
|
-
}
|
|
125
|
-
if (!isRecord(parsed)) {
|
|
126
|
-
return (0, neverthrow_1.err)(systemError("McpStaticPluginShape", `'${pluginPath}' is not a JSON object`));
|
|
127
|
-
}
|
|
128
|
-
return (0, neverthrow_1.ok)(parsed);
|
|
115
|
+
return (0, neverthrow_1.ok)(current);
|
|
129
116
|
}
|
|
130
117
|
function fileName(filePath) {
|
|
131
118
|
const segments = filePath.split("/").filter((segment) => segment.length > 0);
|
|
@@ -172,27 +159,22 @@ exports.mcpStaticMaterializeTools = {
|
|
|
172
159
|
if (!selectedTools.ok) {
|
|
173
160
|
return (0, neverthrow_1.err)(systemError(selectedTools.code, selectedTools.message));
|
|
174
161
|
}
|
|
175
|
-
const plugin =
|
|
162
|
+
const plugin = readRequiredPlugin(ctx, pluginPath);
|
|
176
163
|
if (plugin.isErr()) {
|
|
177
164
|
return (0, neverthrow_1.err)(plugin.error);
|
|
178
165
|
}
|
|
179
|
-
|
|
166
|
+
let pluginManifest;
|
|
167
|
+
try {
|
|
168
|
+
pluginManifest = teamsfx_api_1.APIPluginManifestWrapper.fromJSON(plugin.value.toString("utf8"));
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
return (0, neverthrow_1.err)(systemError(error instanceof SyntaxError ? "McpStaticPluginParse" : "McpStaticPluginShape", `Cannot parse '${pluginPath}' as an API plugin manifest: ${errorMessage(error)}`));
|
|
172
|
+
}
|
|
173
|
+
pluginManifest.materializeRemoteMcpTools(selectedTools.tools.map((tool) => ({
|
|
180
174
|
name: tool.name,
|
|
181
175
|
description: tool.description,
|
|
182
|
-
}));
|
|
183
|
-
|
|
184
|
-
{
|
|
185
|
-
type: "RemoteMCPServer",
|
|
186
|
-
spec: {
|
|
187
|
-
url: mcpServerUrl,
|
|
188
|
-
mcp_tool_description: {
|
|
189
|
-
file: fileName(toolsPath),
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
run_for_functions: selectedTools.tools.map((tool) => tool.name),
|
|
193
|
-
},
|
|
194
|
-
];
|
|
195
|
-
ctx.write(pluginPath, Buffer.from(JSON.stringify(plugin.value, null, 4) + "\n", "utf8"));
|
|
176
|
+
})), mcpServerUrl, fileName(toolsPath));
|
|
177
|
+
ctx.write(pluginPath, Buffer.from(pluginManifest.toJSON(), "utf8"));
|
|
196
178
|
ctx.write(toolsPath, Buffer.from(JSON.stringify({ tools: selectedTools.tools.map((tool) => tool.raw) }, null, 4) + "\n", "utf8"));
|
|
197
179
|
return (0, neverthrow_1.ok)(undefined);
|
|
198
180
|
},
|