@microsoft/agents-a365-tooling 0.1.0-preview.64 → 0.1.0-preview.85.g8414f98e34
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 +43 -1
- package/dist/cjs/McpToolServerConfigurationService.d.ts.map +1 -1
- package/dist/cjs/McpToolServerConfigurationService.js +65 -13
- package/dist/cjs/McpToolServerConfigurationService.js.map +1 -1
- package/dist/cjs/Utility.d.ts +15 -9
- package/dist/cjs/Utility.d.ts.map +1 -1
- package/dist/cjs/Utility.js +20 -18
- package/dist/cjs/Utility.js.map +1 -1
- package/dist/cjs/contracts.d.ts +3 -0
- package/dist/cjs/contracts.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/models/ChatHistoryMessage.d.ts +22 -0
- package/dist/cjs/models/ChatHistoryMessage.d.ts.map +1 -0
- package/dist/cjs/models/ChatHistoryMessage.js +5 -0
- package/dist/cjs/models/ChatHistoryMessage.js.map +1 -0
- package/dist/cjs/models/ChatMessageRequest.d.ts +23 -0
- package/dist/cjs/models/ChatMessageRequest.d.ts.map +1 -0
- package/dist/cjs/models/ChatMessageRequest.js +5 -0
- package/dist/cjs/models/ChatMessageRequest.js.map +1 -0
- package/dist/cjs/models/index.d.ts +3 -0
- package/dist/cjs/models/index.d.ts.map +1 -0
- package/dist/cjs/models/index.js +21 -0
- package/dist/cjs/models/index.js.map +1 -0
- package/dist/esm/McpToolServerConfigurationService.d.ts +43 -1
- package/dist/esm/McpToolServerConfigurationService.d.ts.map +1 -1
- package/dist/esm/McpToolServerConfigurationService.js +65 -13
- package/dist/esm/McpToolServerConfigurationService.js.map +1 -1
- package/dist/esm/Utility.d.ts +15 -9
- package/dist/esm/Utility.d.ts.map +1 -1
- package/dist/esm/Utility.js +20 -18
- package/dist/esm/Utility.js.map +1 -1
- package/dist/esm/contracts.d.ts +3 -0
- package/dist/esm/contracts.d.ts.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models/ChatHistoryMessage.d.ts +22 -0
- package/dist/esm/models/ChatHistoryMessage.d.ts.map +1 -0
- package/dist/esm/models/ChatHistoryMessage.js +4 -0
- package/dist/esm/models/ChatHistoryMessage.js.map +1 -0
- package/dist/esm/models/ChatMessageRequest.d.ts +23 -0
- package/dist/esm/models/ChatMessageRequest.d.ts.map +1 -0
- package/dist/esm/models/ChatMessageRequest.js +4 -0
- package/dist/esm/models/ChatMessageRequest.js.map +1 -0
- package/dist/esm/models/index.d.ts +3 -0
- package/dist/esm/models/index.d.ts.map +1 -0
- package/dist/esm/models/index.js +5 -0
- package/dist/esm/models/index.js.map +1 -0
- package/package.json +5 -4
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TurnContext } from '@microsoft/agents-hosting';
|
|
2
|
+
import { OperationResult } from '@microsoft/agents-a365-runtime';
|
|
3
|
+
import { MCPServerConfig, McpClientTool, ToolOptions } from './contracts';
|
|
4
|
+
import { ChatHistoryMessage } from './models/index';
|
|
2
5
|
/**
|
|
3
6
|
* Service responsible for discovering and normalizing MCP (Model Context Protocol)
|
|
4
7
|
* tool servers and producing configuration objects consumable by the Claude SDK.
|
|
@@ -17,17 +20,56 @@ export declare class McpToolServerConfigurationService {
|
|
|
17
20
|
* @returns A promise resolving to an array of normalized MCP server configuration objects.
|
|
18
21
|
*/
|
|
19
22
|
listToolServers(agenticAppId: string, authToken: string): Promise<MCPServerConfig[]>;
|
|
23
|
+
/**
|
|
24
|
+
* 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
|
+
*
|
|
26
|
+
* @param agenticAppId The agentic app id for which to discover servers.
|
|
27
|
+
* @param authToken Optional bearer token used when querying the remote tooling gateway.
|
|
28
|
+
* @param options Optional tool options when calling the gateway.
|
|
29
|
+
* @returns A promise resolving to an array of normalized MCP server configuration objects.
|
|
30
|
+
*/
|
|
31
|
+
listToolServers(agenticAppId: string, authToken: string, options?: ToolOptions): Promise<MCPServerConfig[]>;
|
|
20
32
|
/**
|
|
21
33
|
* Connect to the MCP server and return tools with names prefixed by the server name.
|
|
22
34
|
* Throws if the server URL is missing or the client fails to list tools.
|
|
23
35
|
*/
|
|
24
36
|
getMcpClientTools(mcpServerName: string, mcpServerConfig: MCPServerConfig): Promise<McpClientTool[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Sends chat history to the MCP platform for real-time threat protection.
|
|
39
|
+
*
|
|
40
|
+
* @param turnContext The turn context containing conversation information.
|
|
41
|
+
* @param chatHistoryMessages The chat history messages to send.
|
|
42
|
+
* @returns A Promise that resolves to an OperationResult indicating success or failure.
|
|
43
|
+
* @throws Error if turnContext or chatHistoryMessages is null/undefined.
|
|
44
|
+
* @throws Error if required turn context properties (Conversation.Id, Activity.Id, or Activity.Text) are null.
|
|
45
|
+
* @remarks
|
|
46
|
+
* HTTP exceptions (network errors, timeouts) are caught and logged but not rethrown.
|
|
47
|
+
* Instead, the method returns an OperationResult indicating whether the operation succeeded or failed.
|
|
48
|
+
* Callers can choose to inspect the result for error handling or ignore it if error details are not needed.
|
|
49
|
+
*/
|
|
50
|
+
sendChatHistory(turnContext: TurnContext, chatHistoryMessages: ChatHistoryMessage[]): Promise<OperationResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Sends chat history to the MCP platform for real-time threat protection.
|
|
53
|
+
*
|
|
54
|
+
* @param turnContext The turn context containing conversation information.
|
|
55
|
+
* @param chatHistoryMessages The chat history messages to send.
|
|
56
|
+
* @param options Optional tool options for sending chat history.
|
|
57
|
+
* @returns A Promise that resolves to an OperationResult indicating success or failure.
|
|
58
|
+
* @throws Error if turnContext or chatHistoryMessages is null/undefined.
|
|
59
|
+
* @throws Error if required turn context properties (Conversation.Id, Activity.Id, or Activity.Text) are null.
|
|
60
|
+
* @remarks
|
|
61
|
+
* HTTP exceptions (network errors, timeouts) are caught and logged but not rethrown.
|
|
62
|
+
* Instead, the method returns an OperationResult indicating whether the operation succeeded or failed.
|
|
63
|
+
* Callers can choose to inspect the result for error handling or ignore it if error details are not needed.
|
|
64
|
+
*/
|
|
65
|
+
sendChatHistory(turnContext: TurnContext, chatHistoryMessages: ChatHistoryMessage[], options?: ToolOptions): Promise<OperationResult>;
|
|
25
66
|
/**
|
|
26
67
|
* Query the tooling gateway for MCP servers for the specified agent and normalize each entry's mcpServerUniqueName into a full URL using Utility.BuildMcpServerUrl.
|
|
27
68
|
* Throws an error if the gateway call fails.
|
|
28
69
|
*
|
|
29
70
|
* @param agenticAppId The agentic app id used by the tooling gateway to scope results.
|
|
30
71
|
* @param authToken Optional Bearer token to include in the Authorization header when calling the gateway.
|
|
72
|
+
* @param options Optional tool options when calling the gateway.
|
|
31
73
|
* @throws Error when the gateway call fails or returns an unexpected payload.
|
|
32
74
|
*/
|
|
33
75
|
private getMCPServerConfigsFromToolingGateway;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpToolServerConfigurationService.d.ts","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"McpToolServerConfigurationService.d.ts","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAkB,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAsB,MAAM,gBAAgB,CAAC;AAMxE;;;GAGG;AACH,qBAAa,iCAAiC;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAElC;;OAEG;;IAIH;;;;;;OAMG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAE1F;;;;;;;OAOG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAOjH;;;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;;;;;;;;OAQG;YACW,qCAAqC;IAsBnD;;;;;;;;;;;;;;;;;;;;OAoBG;YACW,+BAA+B;IA8B7C;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAItB"}
|
|
@@ -9,6 +9,7 @@ exports.McpToolServerConfigurationService = void 0;
|
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const axios_1 = __importDefault(require("axios"));
|
|
12
|
+
const agents_a365_runtime_1 = require("@microsoft/agents-a365-runtime");
|
|
12
13
|
const Utility_1 = require("./Utility");
|
|
13
14
|
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
14
15
|
const index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
|
|
@@ -23,15 +24,9 @@ class McpToolServerConfigurationService {
|
|
|
23
24
|
constructor() {
|
|
24
25
|
this.logger = console;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* @param agenticAppId The agentic app id for which to discover servers.
|
|
30
|
-
* @param authToken Optional bearer token used when querying the remote tooling gateway.
|
|
31
|
-
* @returns A promise resolving to an array of normalized MCP server configuration objects.
|
|
32
|
-
*/
|
|
33
|
-
async listToolServers(agenticAppId, authToken) {
|
|
34
|
-
return await (this.isDevScenario() ? this.getMCPServerConfigsFromManifest() : this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken));
|
|
27
|
+
async listToolServers(agenticAppId, authToken, options) {
|
|
28
|
+
return await (this.isDevScenario() ? this.getMCPServerConfigsFromManifest() :
|
|
29
|
+
this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, options));
|
|
35
30
|
}
|
|
36
31
|
/**
|
|
37
32
|
* Connect to the MCP server and return tools with names prefixed by the server name.
|
|
@@ -58,23 +53,80 @@ class McpToolServerConfigurationService {
|
|
|
58
53
|
await mcpClient.close();
|
|
59
54
|
return toolsObj.tools;
|
|
60
55
|
}
|
|
56
|
+
async sendChatHistory(turnContext, chatHistoryMessages, options) {
|
|
57
|
+
if (!turnContext) {
|
|
58
|
+
throw new Error('turnContext is required');
|
|
59
|
+
}
|
|
60
|
+
if (!chatHistoryMessages) {
|
|
61
|
+
throw new Error('chatHistoryMessages is required');
|
|
62
|
+
}
|
|
63
|
+
// Extract required information from turn context
|
|
64
|
+
const conversationId = turnContext.activity?.conversation?.id;
|
|
65
|
+
if (!conversationId) {
|
|
66
|
+
throw new Error('Conversation ID is required but not found in turn context');
|
|
67
|
+
}
|
|
68
|
+
const messageId = turnContext.activity?.id;
|
|
69
|
+
if (!messageId) {
|
|
70
|
+
throw new Error('Message ID is required but not found in turn context');
|
|
71
|
+
}
|
|
72
|
+
const userMessage = turnContext.activity?.text;
|
|
73
|
+
if (!userMessage) {
|
|
74
|
+
throw new Error('User message is required but not found in turn context');
|
|
75
|
+
}
|
|
76
|
+
// Get the endpoint URL
|
|
77
|
+
const endpoint = Utility_1.Utility.GetChatHistoryEndpoint();
|
|
78
|
+
this.logger.info(`Sending chat history to endpoint: ${endpoint}`);
|
|
79
|
+
// Create the request payload
|
|
80
|
+
const request = {
|
|
81
|
+
conversationId,
|
|
82
|
+
messageId,
|
|
83
|
+
userMessage,
|
|
84
|
+
chatHistory: chatHistoryMessages
|
|
85
|
+
};
|
|
86
|
+
try {
|
|
87
|
+
const headers = Utility_1.Utility.GetToolRequestHeaders(undefined, turnContext, options);
|
|
88
|
+
await axios_1.default.post(endpoint, request, {
|
|
89
|
+
headers: {
|
|
90
|
+
...headers,
|
|
91
|
+
'Content-Type': 'application/json'
|
|
92
|
+
},
|
|
93
|
+
timeout: 10000 // 10 seconds timeout
|
|
94
|
+
});
|
|
95
|
+
this.logger.info('Successfully sent chat history to MCP platform');
|
|
96
|
+
return agents_a365_runtime_1.OperationResult.success;
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
const error = err;
|
|
100
|
+
if (axios_1.default.isAxiosError(err)) {
|
|
101
|
+
if (err.code === 'ECONNABORTED' || err.code === 'ETIMEDOUT') {
|
|
102
|
+
this.logger.error(`Request timeout sending chat history to '${endpoint}': ${error.message}`);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
this.logger.error(`HTTP error sending chat history to '${endpoint}': ${error.message}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
this.logger.error(`Failed to send chat history to '${endpoint}': ${error.message}`);
|
|
110
|
+
}
|
|
111
|
+
return agents_a365_runtime_1.OperationResult.failed(new agents_a365_runtime_1.OperationError(error));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
61
114
|
/**
|
|
62
115
|
* Query the tooling gateway for MCP servers for the specified agent and normalize each entry's mcpServerUniqueName into a full URL using Utility.BuildMcpServerUrl.
|
|
63
116
|
* Throws an error if the gateway call fails.
|
|
64
117
|
*
|
|
65
118
|
* @param agenticAppId The agentic app id used by the tooling gateway to scope results.
|
|
66
119
|
* @param authToken Optional Bearer token to include in the Authorization header when calling the gateway.
|
|
120
|
+
* @param options Optional tool options when calling the gateway.
|
|
67
121
|
* @throws Error when the gateway call fails or returns an unexpected payload.
|
|
68
122
|
*/
|
|
69
|
-
async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken) {
|
|
123
|
+
async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, options) {
|
|
70
124
|
// Validate the authentication token
|
|
71
125
|
Utility_1.Utility.ValidateAuthToken(authToken);
|
|
72
126
|
const configEndpoint = Utility_1.Utility.GetToolingGatewayForDigitalWorker(agenticAppId);
|
|
73
127
|
try {
|
|
74
128
|
const response = await axios_1.default.get(configEndpoint, {
|
|
75
|
-
headers:
|
|
76
|
-
'Authorization': authToken ? `Bearer ${authToken}` : undefined,
|
|
77
|
-
},
|
|
129
|
+
headers: Utility_1.Utility.GetToolRequestHeaders(authToken, undefined, options),
|
|
78
130
|
timeout: 10000 // 10 seconds timeout
|
|
79
131
|
});
|
|
80
132
|
return (response.data) || [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpToolServerConfigurationService.js","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;AAElC,4CAAoB;AACpB,gDAAwB;AACxB,kDAA0B;AAE1B,uCAAoC;AAEpC,0FAAmG;AACnG,wEAAmE;AAEnE;;;GAGG;AACH,MAAa,iCAAiC;IAG5C;;OAEG;IACH;QALiB,WAAM,GAAG,OAAO,CAAC;IAMlC,CAAC;
|
|
1
|
+
{"version":3,"file":"McpToolServerConfigurationService.js","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;AAElC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UAAU,GAAG,YAAY,CAAC,UAAU,IAAI,EAAE,CAAC;YAEjD,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAkB,EAAE,EAAE;gBAC3C,OAAO;oBACL,aAAa,EAAE,CAAC,CAAC,aAAa;oBAC9B,GAAG,EAAE,iBAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,aAAa,CAAC;iBAChD,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,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;QAC/C,OAAO,WAAW,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC;IACrD,CAAC;CACF;AApQD,8EAoQC"}
|
package/dist/cjs/Utility.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { TurnContext } from '@microsoft/agents-hosting';
|
|
2
|
+
import { ToolOptions } from './contracts';
|
|
2
3
|
export declare class Utility {
|
|
3
4
|
static readonly HEADER_CHANNEL_ID = "x-ms-channel-id";
|
|
4
5
|
static readonly HEADER_SUBCHANNEL_ID = "x-ms-subchannel-id";
|
|
6
|
+
static readonly HEADER_USER_AGENT = "User-Agent";
|
|
5
7
|
/**
|
|
6
8
|
* Compose standard headers for MCP tooling requests.
|
|
7
9
|
* Includes Authorization bearer token when provided, and optionally includes channel and subchannel identifiers for routing.
|
|
8
10
|
*
|
|
9
11
|
* @param authToken Bearer token for Authorization header.
|
|
10
12
|
* @param turnContext Optional TurnContext object from which channel and subchannel IDs are extracted.
|
|
13
|
+
* @param options Optional ToolOptions object for additional request configuration.
|
|
11
14
|
* @returns A headers record suitable for HTTP requests.
|
|
12
15
|
*/
|
|
13
|
-
static GetToolRequestHeaders(authToken?: string, turnContext?: TurnContext): Record<string, string>;
|
|
16
|
+
static GetToolRequestHeaders(authToken?: string, turnContext?: TurnContext, options?: ToolOptions): Record<string, string>;
|
|
14
17
|
/**
|
|
15
18
|
* Validates a JWT authentication token.
|
|
16
19
|
* Checks that the token is a valid JWT and is not expired.
|
|
@@ -56,19 +59,22 @@ export declare class Utility {
|
|
|
56
59
|
* @returns The fully-qualified MCP server URL including trailing slash.
|
|
57
60
|
*/
|
|
58
61
|
static BuildMcpServerUrl(serverName: string): string;
|
|
59
|
-
/**
|
|
60
|
-
* Reads the current environment name from process.env.
|
|
61
|
-
* Checks ASPNETCORE_ENVIRONMENT, DOTNET_ENVIRONMENT, and NODE_ENV in that order.
|
|
62
|
-
* If none are set this returns the string 'Development'.
|
|
63
|
-
*
|
|
64
|
-
* @returns The current environment identifier as a string.
|
|
65
|
-
*/
|
|
66
|
-
private static getCurrentEnvironment;
|
|
67
62
|
/**
|
|
68
63
|
* Gets the base URL for MCP platform, defaults to production URL if not set.
|
|
69
64
|
*
|
|
70
65
|
* @returns The base URL for MCP platform.
|
|
71
66
|
*/
|
|
72
67
|
private static getMcpPlatformBaseUrl;
|
|
68
|
+
/**
|
|
69
|
+
* Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
|
|
70
|
+
*
|
|
71
|
+
* @returns An absolute URL that tooling components can use to send or retrieve chat messages for
|
|
72
|
+
* real-time threat protection scenarios.
|
|
73
|
+
* @remarks
|
|
74
|
+
* Call this method when constructing HTTP requests that need to access the chat-message history
|
|
75
|
+
* for real-time threat protection. The returned URL already includes the MCP platform base address
|
|
76
|
+
* and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
|
|
77
|
+
*/
|
|
78
|
+
static GetChatHistoryEndpoint(): string;
|
|
73
79
|
}
|
|
74
80
|
//# 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;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,qBAAa,OAAO;IAClB,gBAAuB,iBAAiB,qBAAqB;IAC7D,gBAAuB,oBAAoB,wBAAwB;IACnE,gBAAuB,iBAAiB,gBAAgB;IAExD;;;;;;;;OAQG;WACW,qBAAqB,CACjC,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,WAAW,EACzB,OAAO,CAAC,EAAE,WAAW,GACpB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAyBzB;;;;;;OAMG;WACW,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAIpE;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqChC;;;;;;;;;;OAUG;WACW,iCAAiC,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAK7E;;;;OAIG;WACW,aAAa,IAAI,MAAM;IAIrC;;;;;;;;;MASE;WACY,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAI,MAAM;IAK5D;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAQpC;;;;;;;;;OASG;WACW,sBAAsB,IAAI,MAAM;CAG/C"}
|
package/dist/cjs/Utility.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.Utility = void 0;
|
|
6
|
+
const agents_a365_runtime_1 = require("@microsoft/agents-a365-runtime");
|
|
6
7
|
// Constant for MCP Platform base URL in production
|
|
7
8
|
const MCP_PLATFORM_PROD_BASE_URL = 'https://agent365.svc.cloud.microsoft';
|
|
8
9
|
class Utility {
|
|
@@ -12,9 +13,10 @@ class Utility {
|
|
|
12
13
|
*
|
|
13
14
|
* @param authToken Bearer token for Authorization header.
|
|
14
15
|
* @param turnContext Optional TurnContext object from which channel and subchannel IDs are extracted.
|
|
16
|
+
* @param options Optional ToolOptions object for additional request configuration.
|
|
15
17
|
* @returns A headers record suitable for HTTP requests.
|
|
16
18
|
*/
|
|
17
|
-
static GetToolRequestHeaders(authToken, turnContext) {
|
|
19
|
+
static GetToolRequestHeaders(authToken, turnContext, options) {
|
|
18
20
|
const headers = {};
|
|
19
21
|
if (authToken) {
|
|
20
22
|
headers['Authorization'] = `Bearer ${authToken}`;
|
|
@@ -27,6 +29,9 @@ class Utility {
|
|
|
27
29
|
if (subChannelId) {
|
|
28
30
|
headers[Utility.HEADER_SUBCHANNEL_ID] = subChannelId;
|
|
29
31
|
}
|
|
32
|
+
if (options?.orchestratorName) {
|
|
33
|
+
headers[Utility.HEADER_USER_AGENT] = agents_a365_runtime_1.Utility.GetUserAgentHeader(options.orchestratorName);
|
|
34
|
+
}
|
|
30
35
|
return headers;
|
|
31
36
|
}
|
|
32
37
|
/**
|
|
@@ -99,10 +104,6 @@ class Utility {
|
|
|
99
104
|
* @returns The base MCP environments URL.
|
|
100
105
|
*/
|
|
101
106
|
static GetMcpBaseUrl() {
|
|
102
|
-
const environment = this.getCurrentEnvironment().toLowerCase();
|
|
103
|
-
if (environment === 'development') {
|
|
104
|
-
return process.env.MOCK_MCP_SERVER_URL || 'http://localhost:5309/mcp-mock/agents/servers';
|
|
105
|
-
}
|
|
106
107
|
return `${this.getMcpPlatformBaseUrl()}/agents/servers`;
|
|
107
108
|
}
|
|
108
109
|
/**
|
|
@@ -119,19 +120,6 @@ class Utility {
|
|
|
119
120
|
const baseUrl = this.GetMcpBaseUrl();
|
|
120
121
|
return `${baseUrl}/${serverName}`;
|
|
121
122
|
}
|
|
122
|
-
/**
|
|
123
|
-
* Reads the current environment name from process.env.
|
|
124
|
-
* Checks ASPNETCORE_ENVIRONMENT, DOTNET_ENVIRONMENT, and NODE_ENV in that order.
|
|
125
|
-
* If none are set this returns the string 'Development'.
|
|
126
|
-
*
|
|
127
|
-
* @returns The current environment identifier as a string.
|
|
128
|
-
*/
|
|
129
|
-
static getCurrentEnvironment() {
|
|
130
|
-
return process.env.ASPNETCORE_ENVIRONMENT ||
|
|
131
|
-
process.env.DOTNET_ENVIRONMENT ||
|
|
132
|
-
process.env.NODE_ENV ||
|
|
133
|
-
'Development';
|
|
134
|
-
}
|
|
135
123
|
/**
|
|
136
124
|
* Gets the base URL for MCP platform, defaults to production URL if not set.
|
|
137
125
|
*
|
|
@@ -143,8 +131,22 @@ class Utility {
|
|
|
143
131
|
}
|
|
144
132
|
return MCP_PLATFORM_PROD_BASE_URL;
|
|
145
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
|
|
136
|
+
*
|
|
137
|
+
* @returns An absolute URL that tooling components can use to send or retrieve chat messages for
|
|
138
|
+
* real-time threat protection scenarios.
|
|
139
|
+
* @remarks
|
|
140
|
+
* Call this method when constructing HTTP requests that need to access the chat-message history
|
|
141
|
+
* for real-time threat protection. The returned URL already includes the MCP platform base address
|
|
142
|
+
* and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
|
|
143
|
+
*/
|
|
144
|
+
static GetChatHistoryEndpoint() {
|
|
145
|
+
return `${this.getMcpPlatformBaseUrl()}/agents/real-time-threat-protection/chat-message`;
|
|
146
|
+
}
|
|
146
147
|
}
|
|
147
148
|
exports.Utility = Utility;
|
|
148
149
|
Utility.HEADER_CHANNEL_ID = 'x-ms-channel-id';
|
|
149
150
|
Utility.HEADER_SUBCHANNEL_ID = 'x-ms-subchannel-id';
|
|
151
|
+
Utility.HEADER_USER_AGENT = 'User-Agent';
|
|
150
152
|
//# sourceMappingURL=Utility.js.map
|
package/dist/cjs/Utility.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utility.js","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;
|
|
1
|
+
{"version":3,"file":"Utility.js","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,wEAA2E;AAI3E,mDAAmD;AACnD,MAAM,0BAA0B,GAAG,sCAAsC,CAAC;AAE1E,MAAa,OAAO;IAKlB;;;;;;;;OAQG;IACI,MAAM,CAAC,qBAAqB,CACjC,SAAkB,EAClB,WAAyB,EACzB,OAAqB;QAErB,MAAM,OAAO,GAA2B,EAAE,CAAC;QAE3C,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,SAAS,EAAE,CAAC;QACnD,CAAC;QAED,MAAM,SAAS,GAAG,WAAW,EAAE,QAAQ,EAAE,SAA+B,CAAC;QACzE,MAAM,YAAY,GAAG,WAAW,EAAE,QAAQ,EAAE,mBAAyC,CAAC;QAEtF,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC;QACjD,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,YAAY,CAAC;QACvD,CAAC;QAED,IAAI,OAAO,EAAE,gBAAgB,EAAE,CAAC;YAC9B,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,6BAAc,CAAC,kBAAkB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACnG,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,iBAAiB,CAAC,SAA6B;QAC3D,OAAO,OAAO,CAAC,iB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MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC"}
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/contracts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
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":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./Utility"), exports);
|
|
18
18
|
__exportStar(require("./McpToolServerConfigurationService"), exports);
|
|
19
19
|
__exportStar(require("./contracts"), exports);
|
|
20
|
+
__exportStar(require("./models"), exports);
|
|
20
21
|
//# 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":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,sEAAoD;AACpD,8CAA4B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,sEAAoD;AACpD,8CAA4B;AAC5B,2CAAyB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a single message in the chat history.
|
|
3
|
+
*/
|
|
4
|
+
export interface ChatHistoryMessage {
|
|
5
|
+
/**
|
|
6
|
+
* The unique identifier for the chat message.
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* The role of the message sender (e.g., "user", "assistant", "system").
|
|
11
|
+
*/
|
|
12
|
+
role: string;
|
|
13
|
+
/**
|
|
14
|
+
* The content of the chat message.
|
|
15
|
+
*/
|
|
16
|
+
content: string;
|
|
17
|
+
/**
|
|
18
|
+
* The timestamp of when the message was sent.
|
|
19
|
+
*/
|
|
20
|
+
timestamp: Date;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ChatHistoryMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatHistoryMessage.d.ts","sourceRoot":"","sources":["../../../src/models/ChatHistoryMessage.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatHistoryMessage.js","sourceRoot":"","sources":["../../../src/models/ChatHistoryMessage.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ChatHistoryMessage } from './ChatHistoryMessage';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the request payload for a real-time threat protection check on a chat message.
|
|
4
|
+
*/
|
|
5
|
+
export interface ChatMessageRequest {
|
|
6
|
+
/**
|
|
7
|
+
* The unique identifier for the conversation.
|
|
8
|
+
*/
|
|
9
|
+
conversationId: string;
|
|
10
|
+
/**
|
|
11
|
+
* The unique identifier for the message within the conversation.
|
|
12
|
+
*/
|
|
13
|
+
messageId: string;
|
|
14
|
+
/**
|
|
15
|
+
* The content of the user's message.
|
|
16
|
+
*/
|
|
17
|
+
userMessage: string;
|
|
18
|
+
/**
|
|
19
|
+
* The chat history messages.
|
|
20
|
+
*/
|
|
21
|
+
chatHistory: ChatHistoryMessage[];
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ChatMessageRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatMessageRequest.d.ts","sourceRoot":"","sources":["../../../src/models/ChatMessageRequest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,WAAW,EAAE,kBAAkB,EAAE,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatMessageRequest.js","sourceRoot":"","sources":["../../../src/models/ChatMessageRequest.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
__exportStar(require("./ChatHistoryMessage"), exports);
|
|
20
|
+
__exportStar(require("./ChatMessageRequest"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;AAElC,uDAAqC;AACrC,uDAAqC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TurnContext } from '@microsoft/agents-hosting';
|
|
2
|
+
import { OperationResult } from '@microsoft/agents-a365-runtime';
|
|
3
|
+
import { MCPServerConfig, McpClientTool, ToolOptions } from './contracts';
|
|
4
|
+
import { ChatHistoryMessage } from './models/index';
|
|
2
5
|
/**
|
|
3
6
|
* Service responsible for discovering and normalizing MCP (Model Context Protocol)
|
|
4
7
|
* tool servers and producing configuration objects consumable by the Claude SDK.
|
|
@@ -17,17 +20,56 @@ export declare class McpToolServerConfigurationService {
|
|
|
17
20
|
* @returns A promise resolving to an array of normalized MCP server configuration objects.
|
|
18
21
|
*/
|
|
19
22
|
listToolServers(agenticAppId: string, authToken: string): Promise<MCPServerConfig[]>;
|
|
23
|
+
/**
|
|
24
|
+
* 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
|
+
*
|
|
26
|
+
* @param agenticAppId The agentic app id for which to discover servers.
|
|
27
|
+
* @param authToken Optional bearer token used when querying the remote tooling gateway.
|
|
28
|
+
* @param options Optional tool options when calling the gateway.
|
|
29
|
+
* @returns A promise resolving to an array of normalized MCP server configuration objects.
|
|
30
|
+
*/
|
|
31
|
+
listToolServers(agenticAppId: string, authToken: string, options?: ToolOptions): Promise<MCPServerConfig[]>;
|
|
20
32
|
/**
|
|
21
33
|
* Connect to the MCP server and return tools with names prefixed by the server name.
|
|
22
34
|
* Throws if the server URL is missing or the client fails to list tools.
|
|
23
35
|
*/
|
|
24
36
|
getMcpClientTools(mcpServerName: string, mcpServerConfig: MCPServerConfig): Promise<McpClientTool[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Sends chat history to the MCP platform for real-time threat protection.
|
|
39
|
+
*
|
|
40
|
+
* @param turnContext The turn context containing conversation information.
|
|
41
|
+
* @param chatHistoryMessages The chat history messages to send.
|
|
42
|
+
* @returns A Promise that resolves to an OperationResult indicating success or failure.
|
|
43
|
+
* @throws Error if turnContext or chatHistoryMessages is null/undefined.
|
|
44
|
+
* @throws Error if required turn context properties (Conversation.Id, Activity.Id, or Activity.Text) are null.
|
|
45
|
+
* @remarks
|
|
46
|
+
* HTTP exceptions (network errors, timeouts) are caught and logged but not rethrown.
|
|
47
|
+
* Instead, the method returns an OperationResult indicating whether the operation succeeded or failed.
|
|
48
|
+
* Callers can choose to inspect the result for error handling or ignore it if error details are not needed.
|
|
49
|
+
*/
|
|
50
|
+
sendChatHistory(turnContext: TurnContext, chatHistoryMessages: ChatHistoryMessage[]): Promise<OperationResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Sends chat history to the MCP platform for real-time threat protection.
|
|
53
|
+
*
|
|
54
|
+
* @param turnContext The turn context containing conversation information.
|
|
55
|
+
* @param chatHistoryMessages The chat history messages to send.
|
|
56
|
+
* @param options Optional tool options for sending chat history.
|
|
57
|
+
* @returns A Promise that resolves to an OperationResult indicating success or failure.
|
|
58
|
+
* @throws Error if turnContext or chatHistoryMessages is null/undefined.
|
|
59
|
+
* @throws Error if required turn context properties (Conversation.Id, Activity.Id, or Activity.Text) are null.
|
|
60
|
+
* @remarks
|
|
61
|
+
* HTTP exceptions (network errors, timeouts) are caught and logged but not rethrown.
|
|
62
|
+
* Instead, the method returns an OperationResult indicating whether the operation succeeded or failed.
|
|
63
|
+
* Callers can choose to inspect the result for error handling or ignore it if error details are not needed.
|
|
64
|
+
*/
|
|
65
|
+
sendChatHistory(turnContext: TurnContext, chatHistoryMessages: ChatHistoryMessage[], options?: ToolOptions): Promise<OperationResult>;
|
|
25
66
|
/**
|
|
26
67
|
* Query the tooling gateway for MCP servers for the specified agent and normalize each entry's mcpServerUniqueName into a full URL using Utility.BuildMcpServerUrl.
|
|
27
68
|
* Throws an error if the gateway call fails.
|
|
28
69
|
*
|
|
29
70
|
* @param agenticAppId The agentic app id used by the tooling gateway to scope results.
|
|
30
71
|
* @param authToken Optional Bearer token to include in the Authorization header when calling the gateway.
|
|
72
|
+
* @param options Optional tool options when calling the gateway.
|
|
31
73
|
* @throws Error when the gateway call fails or returns an unexpected payload.
|
|
32
74
|
*/
|
|
33
75
|
private getMCPServerConfigsFromToolingGateway;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpToolServerConfigurationService.d.ts","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"McpToolServerConfigurationService.d.ts","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAkB,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAsB,MAAM,gBAAgB,CAAC;AAMxE;;;GAGG;AACH,qBAAa,iCAAiC;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAElC;;OAEG;;IAIH;;;;;;OAMG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAE1F;;;;;;;OAOG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAOjH;;;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;;;;;;;;OAQG;YACW,qCAAqC;IAsBnD;;;;;;;;;;;;;;;;;;;;OAoBG;YACW,+BAA+B;IA8B7C;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAItB"}
|
|
@@ -3,6 +3,7 @@
|
|
|
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
7
|
import { Utility } from './Utility';
|
|
7
8
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
8
9
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
@@ -17,15 +18,9 @@ export class McpToolServerConfigurationService {
|
|
|
17
18
|
constructor() {
|
|
18
19
|
this.logger = console;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* @param agenticAppId The agentic app id for which to discover servers.
|
|
24
|
-
* @param authToken Optional bearer token used when querying the remote tooling gateway.
|
|
25
|
-
* @returns A promise resolving to an array of normalized MCP server configuration objects.
|
|
26
|
-
*/
|
|
27
|
-
async listToolServers(agenticAppId, authToken) {
|
|
28
|
-
return await (this.isDevScenario() ? this.getMCPServerConfigsFromManifest() : this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken));
|
|
21
|
+
async listToolServers(agenticAppId, authToken, options) {
|
|
22
|
+
return await (this.isDevScenario() ? this.getMCPServerConfigsFromManifest() :
|
|
23
|
+
this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, options));
|
|
29
24
|
}
|
|
30
25
|
/**
|
|
31
26
|
* Connect to the MCP server and return tools with names prefixed by the server name.
|
|
@@ -52,23 +47,80 @@ export class McpToolServerConfigurationService {
|
|
|
52
47
|
await mcpClient.close();
|
|
53
48
|
return toolsObj.tools;
|
|
54
49
|
}
|
|
50
|
+
async sendChatHistory(turnContext, chatHistoryMessages, options) {
|
|
51
|
+
if (!turnContext) {
|
|
52
|
+
throw new Error('turnContext is required');
|
|
53
|
+
}
|
|
54
|
+
if (!chatHistoryMessages) {
|
|
55
|
+
throw new Error('chatHistoryMessages is required');
|
|
56
|
+
}
|
|
57
|
+
// Extract required information from turn context
|
|
58
|
+
const conversationId = turnContext.activity?.conversation?.id;
|
|
59
|
+
if (!conversationId) {
|
|
60
|
+
throw new Error('Conversation ID is required but not found in turn context');
|
|
61
|
+
}
|
|
62
|
+
const messageId = turnContext.activity?.id;
|
|
63
|
+
if (!messageId) {
|
|
64
|
+
throw new Error('Message ID is required but not found in turn context');
|
|
65
|
+
}
|
|
66
|
+
const userMessage = turnContext.activity?.text;
|
|
67
|
+
if (!userMessage) {
|
|
68
|
+
throw new Error('User message is required but not found in turn context');
|
|
69
|
+
}
|
|
70
|
+
// Get the endpoint URL
|
|
71
|
+
const endpoint = Utility.GetChatHistoryEndpoint();
|
|
72
|
+
this.logger.info(`Sending chat history to endpoint: ${endpoint}`);
|
|
73
|
+
// Create the request payload
|
|
74
|
+
const request = {
|
|
75
|
+
conversationId,
|
|
76
|
+
messageId,
|
|
77
|
+
userMessage,
|
|
78
|
+
chatHistory: chatHistoryMessages
|
|
79
|
+
};
|
|
80
|
+
try {
|
|
81
|
+
const headers = Utility.GetToolRequestHeaders(undefined, turnContext, options);
|
|
82
|
+
await axios.post(endpoint, request, {
|
|
83
|
+
headers: {
|
|
84
|
+
...headers,
|
|
85
|
+
'Content-Type': 'application/json'
|
|
86
|
+
},
|
|
87
|
+
timeout: 10000 // 10 seconds timeout
|
|
88
|
+
});
|
|
89
|
+
this.logger.info('Successfully sent chat history to MCP platform');
|
|
90
|
+
return OperationResult.success;
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
const error = err;
|
|
94
|
+
if (axios.isAxiosError(err)) {
|
|
95
|
+
if (err.code === 'ECONNABORTED' || err.code === 'ETIMEDOUT') {
|
|
96
|
+
this.logger.error(`Request timeout sending chat history to '${endpoint}': ${error.message}`);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.logger.error(`HTTP error sending chat history to '${endpoint}': ${error.message}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.logger.error(`Failed to send chat history to '${endpoint}': ${error.message}`);
|
|
104
|
+
}
|
|
105
|
+
return OperationResult.failed(new OperationError(error));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
55
108
|
/**
|
|
56
109
|
* Query the tooling gateway for MCP servers for the specified agent and normalize each entry's mcpServerUniqueName into a full URL using Utility.BuildMcpServerUrl.
|
|
57
110
|
* Throws an error if the gateway call fails.
|
|
58
111
|
*
|
|
59
112
|
* @param agenticAppId The agentic app id used by the tooling gateway to scope results.
|
|
60
113
|
* @param authToken Optional Bearer token to include in the Authorization header when calling the gateway.
|
|
114
|
+
* @param options Optional tool options when calling the gateway.
|
|
61
115
|
* @throws Error when the gateway call fails or returns an unexpected payload.
|
|
62
116
|
*/
|
|
63
|
-
async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken) {
|
|
117
|
+
async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, options) {
|
|
64
118
|
// Validate the authentication token
|
|
65
119
|
Utility.ValidateAuthToken(authToken);
|
|
66
120
|
const configEndpoint = Utility.GetToolingGatewayForDigitalWorker(agenticAppId);
|
|
67
121
|
try {
|
|
68
122
|
const response = await axios.get(configEndpoint, {
|
|
69
|
-
headers:
|
|
70
|
-
'Authorization': authToken ? `Bearer ${authToken}` : undefined,
|
|
71
|
-
},
|
|
123
|
+
headers: Utility.GetToolRequestHeaders(authToken, undefined, options),
|
|
72
124
|
timeout: 10000 // 10 seconds timeout
|
|
73
125
|
});
|
|
74
126
|
return (response.data) || [];
|
|
@@ -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,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE;;;GAGG;AACH,MAAM,OAAO,iCAAiC;IAG5C;;OAEG;IACH;QALiB,WAAM,GAAG,OAAO,CAAC;IAMlC,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,EAAE,MAAM,gCAAgC,CAAC;AAGjF,OAAO,EAAE,OAAO,EAAE,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AAC;YAC7C,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,IAAI,EAAE,CAAC;YAEjD,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAkB,EAAE,EAAE;gBAC3C,OAAO;oBACL,aAAa,EAAE,CAAC,CAAC,aAAa;oBAC9B,GAAG,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,aAAa,CAAC;iBAChD,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,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;QAC/C,OAAO,WAAW,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC;IACrD,CAAC;CACF"}
|
package/dist/esm/Utility.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { TurnContext } from '@microsoft/agents-hosting';
|
|
2
|
+
import { ToolOptions } from './contracts';
|
|
2
3
|
export declare class Utility {
|
|
3
4
|
static readonly HEADER_CHANNEL_ID = "x-ms-channel-id";
|
|
4
5
|
static readonly HEADER_SUBCHANNEL_ID = "x-ms-subchannel-id";
|
|
6
|
+
static readonly HEADER_USER_AGENT = "User-Agent";
|
|
5
7
|
/**
|
|
6
8
|
* Compose standard headers for MCP tooling requests.
|
|
7
9
|
* Includes Authorization bearer token when provided, and optionally includes channel and subchannel identifiers for routing.
|
|
8
10
|
*
|
|
9
11
|
* @param authToken Bearer token for Authorization header.
|
|
10
12
|
* @param turnContext Optional TurnContext object from which channel and subchannel IDs are extracted.
|
|
13
|
+
* @param options Optional ToolOptions object for additional request configuration.
|
|
11
14
|
* @returns A headers record suitable for HTTP requests.
|
|
12
15
|
*/
|
|
13
|
-
static GetToolRequestHeaders(authToken?: string, turnContext?: TurnContext): Record<string, string>;
|
|
16
|
+
static GetToolRequestHeaders(authToken?: string, turnContext?: TurnContext, options?: ToolOptions): Record<string, string>;
|
|
14
17
|
/**
|
|
15
18
|
* Validates a JWT authentication token.
|
|
16
19
|
* Checks that the token is a valid JWT and is not expired.
|
|
@@ -56,19 +59,22 @@ export declare class Utility {
|
|
|
56
59
|
* @returns The fully-qualified MCP server URL including trailing slash.
|
|
57
60
|
*/
|
|
58
61
|
static BuildMcpServerUrl(serverName: string): string;
|
|
59
|
-
/**
|
|
60
|
-
* Reads the current environment name from process.env.
|
|
61
|
-
* Checks ASPNETCORE_ENVIRONMENT, DOTNET_ENVIRONMENT, and NODE_ENV in that order.
|
|
62
|
-
* If none are set this returns the string 'Development'.
|
|
63
|
-
*
|
|
64
|
-
* @returns The current environment identifier as a string.
|
|
65
|
-
*/
|
|
66
|
-
private static getCurrentEnvironment;
|
|
67
62
|
/**
|
|
68
63
|
* Gets the base URL for MCP platform, defaults to production URL if not set.
|
|
69
64
|
*
|
|
70
65
|
* @returns The base URL for MCP platform.
|
|
71
66
|
*/
|
|
72
67
|
private static getMcpPlatformBaseUrl;
|
|
68
|
+
/**
|
|
69
|
+
* Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
|
|
70
|
+
*
|
|
71
|
+
* @returns An absolute URL that tooling components can use to send or retrieve chat messages for
|
|
72
|
+
* real-time threat protection scenarios.
|
|
73
|
+
* @remarks
|
|
74
|
+
* Call this method when constructing HTTP requests that need to access the chat-message history
|
|
75
|
+
* for real-time threat protection. The returned URL already includes the MCP platform base address
|
|
76
|
+
* and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
|
|
77
|
+
*/
|
|
78
|
+
static GetChatHistoryEndpoint(): string;
|
|
73
79
|
}
|
|
74
80
|
//# 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;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,qBAAa,OAAO;IAClB,gBAAuB,iBAAiB,qBAAqB;IAC7D,gBAAuB,oBAAoB,wBAAwB;IACnE,gBAAuB,iBAAiB,gBAAgB;IAExD;;;;;;;;OAQG;WACW,qBAAqB,CACjC,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,WAAW,EACzB,OAAO,CAAC,EAAE,WAAW,GACpB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAyBzB;;;;;;OAMG;WACW,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAIpE;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqChC;;;;;;;;;;OAUG;WACW,iCAAiC,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAK7E;;;;OAIG;WACW,aAAa,IAAI,MAAM;IAIrC;;;;;;;;;MASE;WACY,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAI,MAAM;IAK5D;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAQpC;;;;;;;;;OASG;WACW,sBAAsB,IAAI,MAAM;CAG/C"}
|
package/dist/esm/Utility.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
+
import { Utility as RuntimeUtility } from '@microsoft/agents-a365-runtime';
|
|
3
4
|
// Constant for MCP Platform base URL in production
|
|
4
5
|
const MCP_PLATFORM_PROD_BASE_URL = 'https://agent365.svc.cloud.microsoft';
|
|
5
6
|
export class Utility {
|
|
@@ -9,9 +10,10 @@ export class Utility {
|
|
|
9
10
|
*
|
|
10
11
|
* @param authToken Bearer token for Authorization header.
|
|
11
12
|
* @param turnContext Optional TurnContext object from which channel and subchannel IDs are extracted.
|
|
13
|
+
* @param options Optional ToolOptions object for additional request configuration.
|
|
12
14
|
* @returns A headers record suitable for HTTP requests.
|
|
13
15
|
*/
|
|
14
|
-
static GetToolRequestHeaders(authToken, turnContext) {
|
|
16
|
+
static GetToolRequestHeaders(authToken, turnContext, options) {
|
|
15
17
|
const headers = {};
|
|
16
18
|
if (authToken) {
|
|
17
19
|
headers['Authorization'] = `Bearer ${authToken}`;
|
|
@@ -24,6 +26,9 @@ export class Utility {
|
|
|
24
26
|
if (subChannelId) {
|
|
25
27
|
headers[Utility.HEADER_SUBCHANNEL_ID] = subChannelId;
|
|
26
28
|
}
|
|
29
|
+
if (options?.orchestratorName) {
|
|
30
|
+
headers[Utility.HEADER_USER_AGENT] = RuntimeUtility.GetUserAgentHeader(options.orchestratorName);
|
|
31
|
+
}
|
|
27
32
|
return headers;
|
|
28
33
|
}
|
|
29
34
|
/**
|
|
@@ -96,10 +101,6 @@ export class Utility {
|
|
|
96
101
|
* @returns The base MCP environments URL.
|
|
97
102
|
*/
|
|
98
103
|
static GetMcpBaseUrl() {
|
|
99
|
-
const environment = this.getCurrentEnvironment().toLowerCase();
|
|
100
|
-
if (environment === 'development') {
|
|
101
|
-
return process.env.MOCK_MCP_SERVER_URL || 'http://localhost:5309/mcp-mock/agents/servers';
|
|
102
|
-
}
|
|
103
104
|
return `${this.getMcpPlatformBaseUrl()}/agents/servers`;
|
|
104
105
|
}
|
|
105
106
|
/**
|
|
@@ -116,19 +117,6 @@ export class Utility {
|
|
|
116
117
|
const baseUrl = this.GetMcpBaseUrl();
|
|
117
118
|
return `${baseUrl}/${serverName}`;
|
|
118
119
|
}
|
|
119
|
-
/**
|
|
120
|
-
* Reads the current environment name from process.env.
|
|
121
|
-
* Checks ASPNETCORE_ENVIRONMENT, DOTNET_ENVIRONMENT, and NODE_ENV in that order.
|
|
122
|
-
* If none are set this returns the string 'Development'.
|
|
123
|
-
*
|
|
124
|
-
* @returns The current environment identifier as a string.
|
|
125
|
-
*/
|
|
126
|
-
static getCurrentEnvironment() {
|
|
127
|
-
return process.env.ASPNETCORE_ENVIRONMENT ||
|
|
128
|
-
process.env.DOTNET_ENVIRONMENT ||
|
|
129
|
-
process.env.NODE_ENV ||
|
|
130
|
-
'Development';
|
|
131
|
-
}
|
|
132
120
|
/**
|
|
133
121
|
* Gets the base URL for MCP platform, defaults to production URL if not set.
|
|
134
122
|
*
|
|
@@ -140,7 +128,21 @@ export class Utility {
|
|
|
140
128
|
}
|
|
141
129
|
return MCP_PLATFORM_PROD_BASE_URL;
|
|
142
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
|
|
133
|
+
*
|
|
134
|
+
* @returns An absolute URL that tooling components can use to send or retrieve chat messages for
|
|
135
|
+
* real-time threat protection scenarios.
|
|
136
|
+
* @remarks
|
|
137
|
+
* Call this method when constructing HTTP requests that need to access the chat-message history
|
|
138
|
+
* for real-time threat protection. The returned URL already includes the MCP platform base address
|
|
139
|
+
* and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
|
|
140
|
+
*/
|
|
141
|
+
static GetChatHistoryEndpoint() {
|
|
142
|
+
return `${this.getMcpPlatformBaseUrl()}/agents/real-time-threat-protection/chat-message`;
|
|
143
|
+
}
|
|
143
144
|
}
|
|
144
145
|
Utility.HEADER_CHANNEL_ID = 'x-ms-channel-id';
|
|
145
146
|
Utility.HEADER_SUBCHANNEL_ID = 'x-ms-subchannel-id';
|
|
147
|
+
Utility.HEADER_USER_AGENT = 'User-Agent';
|
|
146
148
|
//# sourceMappingURL=Utility.js.map
|
package/dist/esm/Utility.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utility.js","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"Utility.js","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAI3E,mDAAmD;AACnD,MAAM,0BAA0B,GAAG,sCAAsC,CAAC;AAE1E,MAAM,OAAO,OAAO;IAKlB;;;;;;;;OAQG;IACI,MAAM,CAAC,qBAAqB,CACjC,SAAkB,EAClB,WAAyB,EACzB,OAAqB;QAErB,MAAM,OAAO,GAA2B,EAAE,CAAC;QAE3C,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,SAAS,EAAE,CAAC;QACnD,CAAC;QAED,MAAM,SAAS,GAAG,WAAW,EAAE,QAAQ,EAAE,SAA+B,CAAC;QACzE,MAAM,YAAY,GAAG,WAAW,EAAE,QAAQ,EAAE,mBAAyC,CAAC;QAEtF,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC;QACjD,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,YAAY,CAAC;QACvD,CAAC;QAED,IAAI,OAAO,EAAE,gBAAgB,EAAE,CAAC;YAC9B,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,cAAc,CAAC,kBAAkB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACnG,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,iBAAiB,CAAC,SAA6B;QAC3D,OAAO,OAAO,CAAC,iBAAiB,CAAC,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AE,CAAC;gBACnC,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACI,MAAM,CAAC,iCAAiC,CAAC,YAAoB;QAClE,8EAA8E;QAC9E,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,WAAW,YAAY,aAAa,CAAC;IAC7E,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,aAAa;QACzB,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,iBAAiB,CAAC;IAC1D,CAAC;IAED;;;;;;;;;MASE;IACK,MAAM,CAAC,iBAAiB,CAAC,UAAkB;QAChD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACrC,OAAO,GAAG,OAAO,IAAI,UAAU,EAAE,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,qBAAqB;QAClC,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;YACtC,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;QAC3C,CAAC;QAED,OAAO,0BAA0B,CAAC;IACpC,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAC,sBAAsB;QAClC,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,kDAAkD,CAAC;IAC3F,CAAC;;AAlKsB,yBAAiB,GAAG,iBAAiB,CAAC;AACtC,4BAAoB,GAAG,oBAAoB,CAAC;AAC5C,yBAAiB,GAAG,YAAY,CAAC"}
|
package/dist/esm/contracts.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/contracts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC"}
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/contracts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a single message in the chat history.
|
|
3
|
+
*/
|
|
4
|
+
export interface ChatHistoryMessage {
|
|
5
|
+
/**
|
|
6
|
+
* The unique identifier for the chat message.
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* The role of the message sender (e.g., "user", "assistant", "system").
|
|
11
|
+
*/
|
|
12
|
+
role: string;
|
|
13
|
+
/**
|
|
14
|
+
* The content of the chat message.
|
|
15
|
+
*/
|
|
16
|
+
content: string;
|
|
17
|
+
/**
|
|
18
|
+
* The timestamp of when the message was sent.
|
|
19
|
+
*/
|
|
20
|
+
timestamp: Date;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ChatHistoryMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatHistoryMessage.d.ts","sourceRoot":"","sources":["../../../src/models/ChatHistoryMessage.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatHistoryMessage.js","sourceRoot":"","sources":["../../../src/models/ChatHistoryMessage.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ChatHistoryMessage } from './ChatHistoryMessage';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the request payload for a real-time threat protection check on a chat message.
|
|
4
|
+
*/
|
|
5
|
+
export interface ChatMessageRequest {
|
|
6
|
+
/**
|
|
7
|
+
* The unique identifier for the conversation.
|
|
8
|
+
*/
|
|
9
|
+
conversationId: string;
|
|
10
|
+
/**
|
|
11
|
+
* The unique identifier for the message within the conversation.
|
|
12
|
+
*/
|
|
13
|
+
messageId: string;
|
|
14
|
+
/**
|
|
15
|
+
* The content of the user's message.
|
|
16
|
+
*/
|
|
17
|
+
userMessage: string;
|
|
18
|
+
/**
|
|
19
|
+
* The chat history messages.
|
|
20
|
+
*/
|
|
21
|
+
chatHistory: ChatHistoryMessage[];
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ChatMessageRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatMessageRequest.d.ts","sourceRoot":"","sources":["../../../src/models/ChatMessageRequest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,WAAW,EAAE,kBAAkB,EAAE,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatMessageRequest.js","sourceRoot":"","sources":["../../../src/models/ChatMessageRequest.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/agents-a365-tooling",
|
|
3
|
-
"version": "0.1.0-preview.
|
|
3
|
+
"version": "0.1.0-preview.85.g8414f98e34",
|
|
4
4
|
"description": "Agent 365 Tooling SDK for AI agents built with TypeScript/Node.js",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
"directory": "packages/agents-a365-tooling"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@microsoft/agents-a365-runtime": "0.1.0-preview.
|
|
22
|
+
"@microsoft/agents-a365-runtime": "0.1.0-preview.85.g8414f98e34",
|
|
23
23
|
"@microsoft/agents-hosting": "^1.1.0-alpha.85",
|
|
24
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
25
|
-
"express": "^5.2.0"
|
|
24
|
+
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
25
|
+
"express": "^5.2.0",
|
|
26
|
+
"hono": "^4.11.4"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"@eslint/js": "^9.39.1",
|