@microsoft/agents-a365-tooling 0.1.0-preview.95 → 0.2.0-preview.1
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/dist/cjs/McpToolServerConfigurationService.d.ts +41 -7
- package/dist/cjs/McpToolServerConfigurationService.d.ts.map +1 -1
- package/dist/cjs/McpToolServerConfigurationService.js +82 -13
- package/dist/cjs/McpToolServerConfigurationService.js.map +1 -1
- package/dist/cjs/Utility.d.ts +31 -5
- package/dist/cjs/Utility.d.ts.map +1 -1
- package/dist/cjs/Utility.js +58 -18
- package/dist/cjs/Utility.js.map +1 -1
- package/dist/cjs/configuration/ToolingConfiguration.d.ts +24 -0
- package/dist/cjs/configuration/ToolingConfiguration.d.ts.map +1 -0
- package/dist/cjs/configuration/ToolingConfiguration.js +66 -0
- package/dist/cjs/configuration/ToolingConfiguration.js.map +1 -0
- package/dist/cjs/configuration/ToolingConfigurationOptions.d.ts +23 -0
- package/dist/cjs/configuration/ToolingConfigurationOptions.d.ts.map +1 -0
- package/dist/cjs/configuration/ToolingConfigurationOptions.js +5 -0
- package/dist/cjs/configuration/ToolingConfigurationOptions.js.map +1 -0
- package/dist/cjs/configuration/index.d.ts +9 -0
- package/dist/cjs/configuration/index.d.ts.map +1 -0
- package/dist/cjs/configuration/index.js +28 -0
- package/dist/cjs/configuration/index.js.map +1 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/McpToolServerConfigurationService.d.ts +41 -7
- package/dist/esm/McpToolServerConfigurationService.d.ts.map +1 -1
- package/dist/esm/McpToolServerConfigurationService.js +83 -14
- package/dist/esm/McpToolServerConfigurationService.js.map +1 -1
- package/dist/esm/Utility.d.ts +31 -5
- package/dist/esm/Utility.d.ts.map +1 -1
- package/dist/esm/Utility.js +58 -18
- package/dist/esm/Utility.js.map +1 -1
- package/dist/esm/configuration/ToolingConfiguration.d.ts +24 -0
- package/dist/esm/configuration/ToolingConfiguration.d.ts.map +1 -0
- package/dist/esm/configuration/ToolingConfiguration.js +62 -0
- package/dist/esm/configuration/ToolingConfiguration.js.map +1 -0
- package/dist/esm/configuration/ToolingConfigurationOptions.d.ts +23 -0
- package/dist/esm/configuration/ToolingConfigurationOptions.d.ts.map +1 -0
- package/dist/esm/configuration/ToolingConfigurationOptions.js +4 -0
- package/dist/esm/configuration/ToolingConfigurationOptions.js.map +1 -0
- package/dist/esm/configuration/index.d.ts +9 -0
- package/dist/esm/configuration/index.d.ts.map +1 -0
- package/dist/esm/configuration/index.js +11 -0
- package/dist/esm/configuration/index.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolingConfiguration.js","sourceRoot":"","sources":["../../../src/configuration/ToolingConfiguration.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,wEAAsE;AAGtE,0CAA0C;AAC1C,MAAM,0BAA0B,GAAG,sCAAsC,CAAC;AAC1E,MAAM,sCAAsC,GAAG,+CAA+C,CAAC;AAE/F;;;GAGG;AACH,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC;AAED;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,0CAAoB;IAC5D,wCAAwC;IACxC,IAAc,gBAAgB;QAC5B,OAAO,IAAI,CAAC,SAAwC,CAAC;IACvD,CAAC;IAED,YAAY,SAAuC;QACjD,KAAK,CAAC,SAAS,CAAC,CAAC;IACnB,CAAC;IAED,6EAA6E;IAE7E,IAAI,mBAAmB;QACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,EAAE,CAAC;QAC/D,IAAI,QAAQ;YAAE,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;QAE5C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,IAAI,EAAE,CAAC;QAC3D,IAAI,QAAQ;YAAE,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;QAE5C,OAAO,0BAA0B,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,IAAI,kBAAkB;QACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,EAAE,CAAC;QAC9D,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,QAAQ,CAAC;QAE5C,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,IAAI,8BAA8B;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,8BAA8B,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;QAClF,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAE9B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iCAAiC,EAAE,IAAI,EAAE,CAAC;QACvE,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAE9B,OAAO,sCAAsC,CAAC;IAChD,CAAC;CACF;AAhDD,oDAgDC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RuntimeConfigurationOptions } from '@microsoft/agents-a365-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* Tooling configuration options - extends runtime options.
|
|
4
|
+
* All overrides are functions called on each property access.
|
|
5
|
+
*
|
|
6
|
+
* Inherited from RuntimeConfigurationOptions:
|
|
7
|
+
* - clusterCategory
|
|
8
|
+
* - isNodeEnvDevelopment
|
|
9
|
+
*/
|
|
10
|
+
export type ToolingConfigurationOptions = RuntimeConfigurationOptions & {
|
|
11
|
+
mcpPlatformEndpoint?: () => string;
|
|
12
|
+
/**
|
|
13
|
+
* Override for using ToolingManifest.json vs gateway discovery.
|
|
14
|
+
* Falls back to inherited isNodeEnvDevelopment.
|
|
15
|
+
*/
|
|
16
|
+
useToolingManifest?: () => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Override for MCP platform authentication scope.
|
|
19
|
+
* Falls back to MCP_PLATFORM_AUTHENTICATION_SCOPE env var, then production default.
|
|
20
|
+
*/
|
|
21
|
+
mcpPlatformAuthenticationScope?: () => string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=ToolingConfigurationOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolingConfigurationOptions.d.ts","sourceRoot":"","sources":["../../../src/configuration/ToolingConfigurationOptions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAE7E;;;;;;;GAOG;AACH,MAAM,MAAM,2BAA2B,GAAG,2BAA2B,GAAG;IACtE,mBAAmB,CAAC,EAAE,MAAM,MAAM,CAAC;IACnC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC;IACnC;;;OAGG;IACH,8BAA8B,CAAC,EAAE,MAAM,MAAM,CAAC;CAC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolingConfigurationOptions.js","sourceRoot":"","sources":["../../../src/configuration/ToolingConfigurationOptions.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DefaultConfigurationProvider } from '@microsoft/agents-a365-runtime';
|
|
2
|
+
import { ToolingConfiguration } from './ToolingConfiguration';
|
|
3
|
+
export * from './ToolingConfigurationOptions';
|
|
4
|
+
export * from './ToolingConfiguration';
|
|
5
|
+
/**
|
|
6
|
+
* Shared default provider for ToolingConfiguration.
|
|
7
|
+
*/
|
|
8
|
+
export declare const defaultToolingConfigurationProvider: DefaultConfigurationProvider<ToolingConfiguration>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/configuration/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,mCAAmC,oDACoB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.defaultToolingConfigurationProvider = void 0;
|
|
20
|
+
const agents_a365_runtime_1 = require("@microsoft/agents-a365-runtime");
|
|
21
|
+
const ToolingConfiguration_1 = require("./ToolingConfiguration");
|
|
22
|
+
__exportStar(require("./ToolingConfigurationOptions"), exports);
|
|
23
|
+
__exportStar(require("./ToolingConfiguration"), exports);
|
|
24
|
+
/**
|
|
25
|
+
* Shared default provider for ToolingConfiguration.
|
|
26
|
+
*/
|
|
27
|
+
exports.defaultToolingConfigurationProvider = new agents_a365_runtime_1.DefaultConfigurationProvider(() => new ToolingConfiguration_1.ToolingConfiguration());
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/configuration/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;;AAElC,wEAA8E;AAC9E,iEAA8D;AAE9D,gEAA8C;AAC9C,yDAAuC;AAEvC;;GAEG;AACU,QAAA,mCAAmC,GAC9C,IAAI,kDAA4B,CAAC,GAAG,EAAE,CAAC,IAAI,2CAAoB,EAAE,CAAC,CAAC"}
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
2
4
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
5
|
if (k2 === undefined) k2 = k;
|
|
4
6
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -18,4 +20,5 @@ __exportStar(require("./Utility"), exports);
|
|
|
18
20
|
__exportStar(require("./McpToolServerConfigurationService"), exports);
|
|
19
21
|
__exportStar(require("./contracts"), exports);
|
|
20
22
|
__exportStar(require("./models"), exports);
|
|
23
|
+
__exportStar(require("./configuration"), exports);
|
|
21
24
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;AAElC,4CAA0B;AAC1B,sEAAoD;AACpD,8CAA4B;AAC5B,2CAAyB;AACzB,kDAAgC"}
|
|
@@ -1,34 +1,51 @@
|
|
|
1
|
-
import { TurnContext } from '@microsoft/agents-hosting';
|
|
2
|
-
import { OperationResult } from '@microsoft/agents-a365-runtime';
|
|
1
|
+
import { TurnContext, Authorization } from '@microsoft/agents-hosting';
|
|
2
|
+
import { OperationResult, IConfigurationProvider } from '@microsoft/agents-a365-runtime';
|
|
3
3
|
import { MCPServerConfig, McpClientTool, ToolOptions } from './contracts';
|
|
4
4
|
import { ChatHistoryMessage } from './models/index';
|
|
5
|
+
import { ToolingConfiguration } from './configuration';
|
|
5
6
|
/**
|
|
6
7
|
* Service responsible for discovering and normalizing MCP (Model Context Protocol)
|
|
7
8
|
* tool servers and producing configuration objects consumable by the Claude SDK.
|
|
8
9
|
*/
|
|
9
10
|
export declare class McpToolServerConfigurationService {
|
|
10
11
|
private readonly logger;
|
|
12
|
+
private readonly configProvider;
|
|
11
13
|
/**
|
|
12
14
|
* Construct a McpToolServerConfigurationService.
|
|
15
|
+
* @param configProvider Optional configuration provider. Defaults to defaultToolingConfigurationProvider if not specified.
|
|
13
16
|
*/
|
|
14
|
-
constructor();
|
|
17
|
+
constructor(configProvider?: IConfigurationProvider<ToolingConfiguration>);
|
|
15
18
|
/**
|
|
16
19
|
* Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway.
|
|
17
20
|
*
|
|
21
|
+
* @deprecated Use the overload with TurnContext and Authorization parameters instead to enable x-ms-agentid header support and automatic token generation.
|
|
18
22
|
* @param agenticAppId The agentic app id for which to discover servers.
|
|
19
|
-
* @param authToken
|
|
23
|
+
* @param authToken Bearer token used when querying the remote tooling gateway.
|
|
20
24
|
* @returns A promise resolving to an array of normalized MCP server configuration objects.
|
|
21
25
|
*/
|
|
22
26
|
listToolServers(agenticAppId: string, authToken: string): Promise<MCPServerConfig[]>;
|
|
23
27
|
/**
|
|
24
28
|
* Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway.
|
|
25
29
|
*
|
|
30
|
+
* @deprecated Use the overload with TurnContext and Authorization parameters instead to enable x-ms-agentid header support and automatic token generation.
|
|
26
31
|
* @param agenticAppId The agentic app id for which to discover servers.
|
|
27
|
-
* @param authToken
|
|
32
|
+
* @param authToken Bearer token used when querying the remote tooling gateway.
|
|
28
33
|
* @param options Optional tool options when calling the gateway.
|
|
29
34
|
* @returns A promise resolving to an array of normalized MCP server configuration objects.
|
|
30
35
|
*/
|
|
31
36
|
listToolServers(agenticAppId: string, authToken: string, options?: ToolOptions): Promise<MCPServerConfig[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Return MCP server definitions for the given agent. In development (NODE_ENV=Development) this reads the local ToolingManifest.json; otherwise it queries the remote tooling gateway.
|
|
39
|
+
* This overload automatically resolves the agenticAppId from the TurnContext and generates the auth token if not provided.
|
|
40
|
+
*
|
|
41
|
+
* @param turnContext The TurnContext of the current request.
|
|
42
|
+
* @param authorization Authorization object for token exchange.
|
|
43
|
+
* @param authHandlerName The name of the auth handler to use for token exchange.
|
|
44
|
+
* @param authToken Optional bearer token. If not provided, will be auto-generated via token exchange.
|
|
45
|
+
* @param options Optional tool options when calling the gateway.
|
|
46
|
+
* @returns A promise resolving to an array of normalized MCP server configuration objects.
|
|
47
|
+
*/
|
|
48
|
+
listToolServers(turnContext: TurnContext, authorization: Authorization, authHandlerName: string, authToken?: string, options?: ToolOptions): Promise<MCPServerConfig[]>;
|
|
32
49
|
/**
|
|
33
50
|
* Connect to the MCP server and return tools with names prefixed by the server name.
|
|
34
51
|
* Throws if the server URL is missing or the client fails to list tools.
|
|
@@ -69,6 +86,7 @@ export declare class McpToolServerConfigurationService {
|
|
|
69
86
|
*
|
|
70
87
|
* @param agenticAppId The agentic app id used by the tooling gateway to scope results.
|
|
71
88
|
* @param authToken Optional Bearer token to include in the Authorization header when calling the gateway.
|
|
89
|
+
* @param turnContext Optional TurnContext for extracting agent blueprint ID for request headers.
|
|
72
90
|
* @param options Optional tool options when calling the gateway.
|
|
73
91
|
* @throws Error when the gateway call fails or returns an unexpected payload.
|
|
74
92
|
*/
|
|
@@ -100,10 +118,26 @@ export declare class McpToolServerConfigurationService {
|
|
|
100
118
|
*/
|
|
101
119
|
private getMCPServerConfigsFromManifest;
|
|
102
120
|
/**
|
|
103
|
-
* Detect if the process is running in a development scenario based on
|
|
121
|
+
* Detect if the process is running in a development scenario based on configuration.
|
|
104
122
|
*
|
|
105
|
-
* @returns {boolean} True when running in a development environment.
|
|
123
|
+
* @returns {boolean} True when running in a development environment (NODE_ENV=Development).
|
|
106
124
|
*/
|
|
107
125
|
private isDevScenario;
|
|
126
|
+
/**
|
|
127
|
+
* Gets the base URL for MCP platform from configuration.
|
|
128
|
+
*/
|
|
129
|
+
private getMcpPlatformBaseUrl;
|
|
130
|
+
/**
|
|
131
|
+
* Construct the tooling gateway URL for a given agent identity.
|
|
132
|
+
*/
|
|
133
|
+
private getToolingGatewayUrl;
|
|
134
|
+
/**
|
|
135
|
+
* Build the full URL for accessing a specific MCP server.
|
|
136
|
+
*/
|
|
137
|
+
private buildMcpServerUrl;
|
|
138
|
+
/**
|
|
139
|
+
* Constructs the endpoint URL for sending chat history.
|
|
140
|
+
*/
|
|
141
|
+
private getChatHistoryEndpoint;
|
|
108
142
|
}
|
|
109
143
|
//# sourceMappingURL=McpToolServerConfigurationService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpToolServerConfigurationService.d.ts","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"McpToolServerConfigurationService.d.ts","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAkB,sBAAsB,EAA2D,MAAM,gCAAgC,CAAC;AAClK,OAAO,EAAE,eAAe,EAA0B,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAsB,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAuC,MAAM,iBAAiB,CAAC;AAK5F;;;GAGG;AACH,qBAAa,iCAAiC;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA+C;IAE9E;;;OAGG;gBACS,cAAc,CAAC,EAAE,sBAAsB,CAAC,oBAAoB,CAAC;IAIzE;;;;;;;OAOG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAE1F;;;;;;;;OAQG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAEjH;;;;;;;;;;OAUG;IACG,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IA8D7K;;;OAGG;IACG,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IA8B1G;;;;;;;;;;;;OAYG;IACG,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAEpH;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;IAyE3I;;;;;;;;;OASG;YACW,qCAAqC;IAsBnD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;YACW,+BAA+B;IAoC7C;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAIrB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAI7B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAIzB;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAG/B"}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import axios from 'axios';
|
|
6
|
-
import { OperationResult, OperationError } from '@microsoft/agents-a365-runtime';
|
|
6
|
+
import { OperationResult, OperationError, AgenticAuthenticationService, Utility as RuntimeUtility } from '@microsoft/agents-a365-runtime';
|
|
7
7
|
import { Utility } from './Utility';
|
|
8
|
+
import { defaultToolingConfigurationProvider } from './configuration';
|
|
8
9
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
9
10
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
10
11
|
/**
|
|
@@ -14,13 +15,57 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
|
14
15
|
export class McpToolServerConfigurationService {
|
|
15
16
|
/**
|
|
16
17
|
* Construct a McpToolServerConfigurationService.
|
|
18
|
+
* @param configProvider Optional configuration provider. Defaults to defaultToolingConfigurationProvider if not specified.
|
|
17
19
|
*/
|
|
18
|
-
constructor() {
|
|
20
|
+
constructor(configProvider) {
|
|
19
21
|
this.logger = console;
|
|
22
|
+
this.configProvider = configProvider ?? defaultToolingConfigurationProvider;
|
|
20
23
|
}
|
|
21
|
-
async listToolServers(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
async listToolServers(agenticAppIdOrTurnContext, authTokenOrAuthorization, optionsOrAuthHandlerName, authTokenOrOptions, options) {
|
|
25
|
+
// Detect which signature is being used based on the type of the first parameter
|
|
26
|
+
if (typeof agenticAppIdOrTurnContext === 'string') {
|
|
27
|
+
// LEGACY PATH: listToolServers(agenticAppId, authToken, options?)
|
|
28
|
+
const agenticAppId = agenticAppIdOrTurnContext;
|
|
29
|
+
// Runtime validation for legacy signature parameters
|
|
30
|
+
if (typeof authTokenOrAuthorization !== 'string') {
|
|
31
|
+
throw new Error('authToken must be a string when using the legacy listToolServers(agenticAppId, authToken) signature');
|
|
32
|
+
}
|
|
33
|
+
const authToken = authTokenOrAuthorization;
|
|
34
|
+
const toolOptions = optionsOrAuthHandlerName;
|
|
35
|
+
return await (this.isDevScenario()
|
|
36
|
+
? this.getMCPServerConfigsFromManifest()
|
|
37
|
+
: this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, undefined, toolOptions));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// NEW PATH: listToolServers(turnContext, authorization, authHandlerName, authToken?, options?)
|
|
41
|
+
const turnContext = agenticAppIdOrTurnContext;
|
|
42
|
+
// Runtime validation for new signature parameters
|
|
43
|
+
if (typeof authTokenOrAuthorization === 'string') {
|
|
44
|
+
throw new Error('authorization must be an Authorization object when using the new listToolServers(turnContext, authorization, authHandlerName) signature');
|
|
45
|
+
}
|
|
46
|
+
if (typeof optionsOrAuthHandlerName !== 'string') {
|
|
47
|
+
throw new Error('authHandlerName must be a string when using the new listToolServers(turnContext, authorization, authHandlerName) signature');
|
|
48
|
+
}
|
|
49
|
+
const authorization = authTokenOrAuthorization;
|
|
50
|
+
const authHandlerName = optionsOrAuthHandlerName;
|
|
51
|
+
let authToken = authTokenOrOptions;
|
|
52
|
+
const toolOptions = options;
|
|
53
|
+
// Auto-generate token if not provided
|
|
54
|
+
if (!authToken) {
|
|
55
|
+
const scopes = [this.configProvider.getConfiguration().mcpPlatformAuthenticationScope];
|
|
56
|
+
authToken = await AgenticAuthenticationService.GetAgenticUserToken(authorization, authHandlerName, turnContext, scopes);
|
|
57
|
+
if (!authToken) {
|
|
58
|
+
throw new Error('Failed to obtain authentication token from token exchange');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Note: Token validation (format/expiration) is performed inside getMCPServerConfigsFromToolingGateway()
|
|
62
|
+
// to avoid duplicate validation (it's also called by the legacy path)
|
|
63
|
+
// Resolve agenticAppId from TurnContext
|
|
64
|
+
const agenticAppId = RuntimeUtility.ResolveAgentIdentity(turnContext, authToken);
|
|
65
|
+
return await (this.isDevScenario()
|
|
66
|
+
? this.getMCPServerConfigsFromManifest()
|
|
67
|
+
: this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, turnContext, toolOptions));
|
|
68
|
+
}
|
|
24
69
|
}
|
|
25
70
|
/**
|
|
26
71
|
* Connect to the MCP server and return tools with names prefixed by the server name.
|
|
@@ -68,7 +113,7 @@ export class McpToolServerConfigurationService {
|
|
|
68
113
|
throw new Error('User message is required but not found in turn context');
|
|
69
114
|
}
|
|
70
115
|
// Get the endpoint URL
|
|
71
|
-
const endpoint =
|
|
116
|
+
const endpoint = this.getChatHistoryEndpoint();
|
|
72
117
|
this.logger.info(`Sending chat history to endpoint: ${endpoint}`);
|
|
73
118
|
// Create the request payload
|
|
74
119
|
const request = {
|
|
@@ -111,16 +156,17 @@ export class McpToolServerConfigurationService {
|
|
|
111
156
|
*
|
|
112
157
|
* @param agenticAppId The agentic app id used by the tooling gateway to scope results.
|
|
113
158
|
* @param authToken Optional Bearer token to include in the Authorization header when calling the gateway.
|
|
159
|
+
* @param turnContext Optional TurnContext for extracting agent blueprint ID for request headers.
|
|
114
160
|
* @param options Optional tool options when calling the gateway.
|
|
115
161
|
* @throws Error when the gateway call fails or returns an unexpected payload.
|
|
116
162
|
*/
|
|
117
|
-
async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, options) {
|
|
163
|
+
async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, turnContext, options) {
|
|
118
164
|
// Validate the authentication token
|
|
119
165
|
Utility.ValidateAuthToken(authToken);
|
|
120
|
-
const configEndpoint =
|
|
166
|
+
const configEndpoint = this.getToolingGatewayUrl(agenticAppId);
|
|
121
167
|
try {
|
|
122
168
|
const response = await axios.get(configEndpoint, {
|
|
123
|
-
headers: Utility.GetToolRequestHeaders(authToken,
|
|
169
|
+
headers: Utility.GetToolRequestHeaders(authToken, turnContext, options),
|
|
124
170
|
timeout: 10000 // 10 seconds timeout
|
|
125
171
|
});
|
|
126
172
|
return (response.data) || [];
|
|
@@ -177,7 +223,7 @@ export class McpToolServerConfigurationService {
|
|
|
177
223
|
}
|
|
178
224
|
return {
|
|
179
225
|
mcpServerName: serverName,
|
|
180
|
-
url: s.url ||
|
|
226
|
+
url: s.url || this.buildMcpServerUrl(serverName),
|
|
181
227
|
headers: s.headers
|
|
182
228
|
};
|
|
183
229
|
});
|
|
@@ -189,13 +235,36 @@ export class McpToolServerConfigurationService {
|
|
|
189
235
|
}
|
|
190
236
|
}
|
|
191
237
|
/**
|
|
192
|
-
* Detect if the process is running in a development scenario based on
|
|
238
|
+
* Detect if the process is running in a development scenario based on configuration.
|
|
193
239
|
*
|
|
194
|
-
* @returns {boolean} True when running in a development environment.
|
|
240
|
+
* @returns {boolean} True when running in a development environment (NODE_ENV=Development).
|
|
195
241
|
*/
|
|
196
242
|
isDevScenario() {
|
|
197
|
-
|
|
198
|
-
|
|
243
|
+
return this.configProvider.getConfiguration().useToolingManifest;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Gets the base URL for MCP platform from configuration.
|
|
247
|
+
*/
|
|
248
|
+
getMcpPlatformBaseUrl() {
|
|
249
|
+
return this.configProvider.getConfiguration().mcpPlatformEndpoint;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Construct the tooling gateway URL for a given agent identity.
|
|
253
|
+
*/
|
|
254
|
+
getToolingGatewayUrl(agenticAppId) {
|
|
255
|
+
return `${this.getMcpPlatformBaseUrl()}/agents/${agenticAppId}/mcpServers`;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Build the full URL for accessing a specific MCP server.
|
|
259
|
+
*/
|
|
260
|
+
buildMcpServerUrl(serverName) {
|
|
261
|
+
return `${this.getMcpPlatformBaseUrl()}/agents/servers/${serverName}/`;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Constructs the endpoint URL for sending chat history.
|
|
265
|
+
*/
|
|
266
|
+
getChatHistoryEndpoint() {
|
|
267
|
+
return `${this.getMcpPlatformBaseUrl()}/agents/real-time-threat-protection/chat-message`;
|
|
199
268
|
}
|
|
200
269
|
}
|
|
201
270
|
//# sourceMappingURL=McpToolServerConfigurationService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpToolServerConfigurationService.js","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"McpToolServerConfigurationService.js","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,cAAc,EAA0B,4BAA4B,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGlK,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAwB,mCAAmC,EAAE,MAAM,iBAAiB,CAAC;AAE5F,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE;;;GAGG;AACH,MAAM,OAAO,iCAAiC;IAI5C;;;OAGG;IACH,YAAY,cAA6D;QAPxD,WAAM,GAAG,OAAO,CAAC;QAQhC,IAAI,CAAC,cAAc,GAAG,cAAc,IAAI,mCAAmC,CAAC;IAC9E,CAAC;IAoCD,KAAK,CAAC,eAAe,CACnB,yBAA+C,EAC/C,wBAAgD,EAChD,wBAA+C,EAC/C,kBAAyC,EACzC,OAAqB;QAErB,gFAAgF;QAChF,IAAI,OAAO,yBAAyB,KAAK,QAAQ,EAAE,CAAC;YAClD,kEAAkE;YAClE,MAAM,YAAY,GAAG,yBAAyB,CAAC;YAE/C,qDAAqD;YACrD,IAAI,OAAO,wBAAwB,KAAK,QAAQ,EAAE,CAAC;gBACjD,MAAM,IAAI,KAAK,CAAC,qGAAqG,CAAC,CAAC;YACzH,CAAC;YACD,MAAM,SAAS,GAAG,wBAAwB,CAAC;YAC3C,MAAM,WAAW,GAAG,wBAAmD,CAAC;YAExE,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE;gBAChC,CAAC,CAA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EAAE,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC;oBAChD,OAAO,EAAE,CAAC,CAAC,OAAO;iBACnB,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,KAAK,GAAG,GAAY,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kDAAkD,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YACxG,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;;OAIG;IACK,aAAa;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC,kBAAkB,CAAC;IACnE,CAAC;IAED;;OAEG;IACK,qBAAqB;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC,mBAAmB,CAAC;IACpE,CAAC;IAED;;OAEG;IACK,oBAAoB,CAAC,YAAoB;QAC/C,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,WAAW,YAAY,aAAa,CAAC;IAC7E,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,UAAkB;QAC1C,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,mBAAmB,UAAU,GAAG,CAAC;IACzE,CAAC;IAED;;OAEG;IACK,sBAAsB;QAC5B,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,kDAAkD,CAAC;IAC3F,CAAC;CACF"}
|
package/dist/esm/Utility.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { TurnContext } from '@microsoft/agents-hosting';
|
|
2
|
+
import { IConfigurationProvider } from '@microsoft/agents-a365-runtime';
|
|
2
3
|
import { ToolOptions } from './contracts';
|
|
4
|
+
import { ToolingConfiguration } from './configuration';
|
|
3
5
|
export declare class Utility {
|
|
4
6
|
static readonly HEADER_CHANNEL_ID = "x-ms-channel-id";
|
|
5
7
|
static readonly HEADER_SUBCHANNEL_ID = "x-ms-subchannel-id";
|
|
6
8
|
static readonly HEADER_USER_AGENT = "User-Agent";
|
|
9
|
+
/** Header name for sending the agent identifier to MCP platform for logging/analytics. */
|
|
10
|
+
static readonly HEADER_AGENT_ID = "x-ms-agentid";
|
|
7
11
|
/**
|
|
8
12
|
* Compose standard headers for MCP tooling requests.
|
|
9
13
|
* Includes Authorization bearer token when provided, and optionally includes channel and subchannel identifiers for routing.
|
|
@@ -14,6 +18,18 @@ export declare class Utility {
|
|
|
14
18
|
* @returns A headers record suitable for HTTP requests.
|
|
15
19
|
*/
|
|
16
20
|
static GetToolRequestHeaders(authToken?: string, turnContext?: TurnContext, options?: ToolOptions): Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Resolves the best available agent identifier for the x-ms-agentid header.
|
|
23
|
+
* Priority: TurnContext.agenticAppBlueprintId > token claims (xms_par_app_azp > appid > azp) > application name
|
|
24
|
+
*
|
|
25
|
+
* Note: This differs from RuntimeUtility.ResolveAgentIdentity() which resolves the agenticAppId
|
|
26
|
+
* for URL construction. This method resolves the identifier specifically for the x-ms-agentid header.
|
|
27
|
+
*
|
|
28
|
+
* @param authToken The authentication token to extract claims from.
|
|
29
|
+
* @param turnContext Optional TurnContext to extract agent blueprint ID from.
|
|
30
|
+
* @returns Agent ID string or undefined if not available.
|
|
31
|
+
*/
|
|
32
|
+
private static resolveAgentIdForHeader;
|
|
17
33
|
/**
|
|
18
34
|
* Validates a JWT authentication token.
|
|
19
35
|
* Checks that the token is a valid JWT and is not expired.
|
|
@@ -39,15 +55,19 @@ export declare class Utility {
|
|
|
39
55
|
* // => "https://agent365.svc.cloud.microsoft/agents/{agenticAppId}/mcpServers"
|
|
40
56
|
*
|
|
41
57
|
* @param agenticAppId - The unique identifier for the agent identity.
|
|
58
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
42
59
|
* @returns A fully-qualified URL pointing at the tooling gateway for the agent.
|
|
60
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService.listToolServers() instead.
|
|
43
61
|
*/
|
|
44
|
-
static GetToolingGatewayForDigitalWorker(agenticAppId: string): string;
|
|
62
|
+
static GetToolingGatewayForDigitalWorker(agenticAppId: string, configProvider?: IConfigurationProvider<ToolingConfiguration>): string;
|
|
45
63
|
/**
|
|
46
64
|
* Get the base URL used to query MCP environments.
|
|
47
65
|
*
|
|
66
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
48
67
|
* @returns The base MCP environments URL.
|
|
68
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService instead.
|
|
49
69
|
*/
|
|
50
|
-
static GetMcpBaseUrl(): string;
|
|
70
|
+
static GetMcpBaseUrl(configProvider?: IConfigurationProvider<ToolingConfiguration>): string;
|
|
51
71
|
/**
|
|
52
72
|
* Build the full URL for accessing a specific MCP server.
|
|
53
73
|
*
|
|
@@ -56,25 +76,31 @@ export declare class Utility {
|
|
|
56
76
|
* // => "https://agent365.svc.cloud.microsoft/agents/servers/MyServer/"
|
|
57
77
|
*
|
|
58
78
|
* @param serverName - The MCP server resource name.
|
|
79
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
59
80
|
* @returns The fully-qualified MCP server URL including trailing slash.
|
|
81
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService instead.
|
|
60
82
|
*/
|
|
61
|
-
static BuildMcpServerUrl(serverName: string): string;
|
|
83
|
+
static BuildMcpServerUrl(serverName: string, configProvider?: IConfigurationProvider<ToolingConfiguration>): string;
|
|
62
84
|
/**
|
|
63
|
-
* Gets the base URL for MCP platform
|
|
85
|
+
* Gets the base URL for MCP platform from configuration.
|
|
64
86
|
*
|
|
87
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
65
88
|
* @returns The base URL for MCP platform.
|
|
89
|
+
* @deprecated This method is for internal use only. Use ToolingConfiguration.mcpPlatformEndpoint instead.
|
|
66
90
|
*/
|
|
67
91
|
private static getMcpPlatformBaseUrl;
|
|
68
92
|
/**
|
|
69
93
|
* Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
|
|
70
94
|
*
|
|
95
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
71
96
|
* @returns An absolute URL that tooling components can use to send or retrieve chat messages for
|
|
72
97
|
* real-time threat protection scenarios.
|
|
73
98
|
* @remarks
|
|
74
99
|
* Call this method when constructing HTTP requests that need to access the chat-message history
|
|
75
100
|
* for real-time threat protection. The returned URL already includes the MCP platform base address
|
|
76
101
|
* and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
|
|
102
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService.sendChatHistory() instead.
|
|
77
103
|
*/
|
|
78
|
-
static GetChatHistoryEndpoint(): string;
|
|
104
|
+
static GetChatHistoryEndpoint(configProvider?: IConfigurationProvider<ToolingConfiguration>): string;
|
|
79
105
|
}
|
|
80
106
|
//# sourceMappingURL=Utility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utility.d.ts","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"Utility.d.ts","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAA6B,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAEnG,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAuC,MAAM,iBAAiB,CAAC;AAE5F,qBAAa,OAAO;IAClB,gBAAuB,iBAAiB,qBAAqB;IAC7D,gBAAuB,oBAAoB,wBAAwB;IACnE,gBAAuB,iBAAiB,gBAAgB;IACxD,0FAA0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