@microsoft/agents-a365-tooling 0.1.0-preview.93 → 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
package/dist/esm/Utility.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { Utility as RuntimeUtility } from '@microsoft/agents-a365-runtime';
|
|
4
|
-
|
|
5
|
-
const MCP_PLATFORM_PROD_BASE_URL = 'https://agent365.svc.cloud.microsoft';
|
|
4
|
+
import { defaultToolingConfigurationProvider } from './configuration';
|
|
6
5
|
export class Utility {
|
|
7
6
|
/**
|
|
8
7
|
* Compose standard headers for MCP tooling requests.
|
|
@@ -17,6 +16,11 @@ export class Utility {
|
|
|
17
16
|
const headers = {};
|
|
18
17
|
if (authToken) {
|
|
19
18
|
headers['Authorization'] = `Bearer ${authToken}`;
|
|
19
|
+
// Add x-ms-agentid header with priority fallback (only when authToken present)
|
|
20
|
+
const agentId = this.resolveAgentIdForHeader(authToken, turnContext);
|
|
21
|
+
if (agentId) {
|
|
22
|
+
headers[Utility.HEADER_AGENT_ID] = agentId;
|
|
23
|
+
}
|
|
20
24
|
}
|
|
21
25
|
const channelId = turnContext?.activity?.channelId;
|
|
22
26
|
const subChannelId = turnContext?.activity?.channelIdSubChannel;
|
|
@@ -31,6 +35,33 @@ export class Utility {
|
|
|
31
35
|
}
|
|
32
36
|
return headers;
|
|
33
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the best available agent identifier for the x-ms-agentid header.
|
|
40
|
+
* Priority: TurnContext.agenticAppBlueprintId > token claims (xms_par_app_azp > appid > azp) > application name
|
|
41
|
+
*
|
|
42
|
+
* Note: This differs from RuntimeUtility.ResolveAgentIdentity() which resolves the agenticAppId
|
|
43
|
+
* for URL construction. This method resolves the identifier specifically for the x-ms-agentid header.
|
|
44
|
+
*
|
|
45
|
+
* @param authToken The authentication token to extract claims from.
|
|
46
|
+
* @param turnContext Optional TurnContext to extract agent blueprint ID from.
|
|
47
|
+
* @returns Agent ID string or undefined if not available.
|
|
48
|
+
*/
|
|
49
|
+
static resolveAgentIdForHeader(authToken, turnContext) {
|
|
50
|
+
// Priority 1: Agent Blueprint ID from TurnContext
|
|
51
|
+
// The 'from' property may include agenticAppBlueprintId when the request originates from an agentic app
|
|
52
|
+
const blueprintId = turnContext?.activity?.from?.agenticAppBlueprintId;
|
|
53
|
+
if (blueprintId) {
|
|
54
|
+
return blueprintId;
|
|
55
|
+
}
|
|
56
|
+
// Priority 2 & 3: Agent ID from token (xms_par_app_azp > appid > azp)
|
|
57
|
+
// Single decode, checks claims in priority order
|
|
58
|
+
const agentId = RuntimeUtility.getAgentIdFromToken(authToken);
|
|
59
|
+
if (agentId) {
|
|
60
|
+
return agentId;
|
|
61
|
+
}
|
|
62
|
+
// Priority 4: Application name from npm_package_name or package.json
|
|
63
|
+
return RuntimeUtility.getApplicationName();
|
|
64
|
+
}
|
|
34
65
|
/**
|
|
35
66
|
* Validates a JWT authentication token.
|
|
36
67
|
* Checks that the token is a valid JWT and is not expired.
|
|
@@ -89,19 +120,22 @@ export class Utility {
|
|
|
89
120
|
* // => "https://agent365.svc.cloud.microsoft/agents/{agenticAppId}/mcpServers"
|
|
90
121
|
*
|
|
91
122
|
* @param agenticAppId - The unique identifier for the agent identity.
|
|
123
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
92
124
|
* @returns A fully-qualified URL pointing at the tooling gateway for the agent.
|
|
125
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService.listToolServers() instead.
|
|
93
126
|
*/
|
|
94
|
-
static GetToolingGatewayForDigitalWorker(agenticAppId) {
|
|
95
|
-
|
|
96
|
-
return `${this.getMcpPlatformBaseUrl()}/agents/${agenticAppId}/mcpServers`;
|
|
127
|
+
static GetToolingGatewayForDigitalWorker(agenticAppId, configProvider) {
|
|
128
|
+
return `${this.getMcpPlatformBaseUrl(configProvider)}/agents/${agenticAppId}/mcpServers`;
|
|
97
129
|
}
|
|
98
130
|
/**
|
|
99
131
|
* Get the base URL used to query MCP environments.
|
|
100
132
|
*
|
|
133
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
101
134
|
* @returns The base MCP environments URL.
|
|
135
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService instead.
|
|
102
136
|
*/
|
|
103
|
-
static GetMcpBaseUrl() {
|
|
104
|
-
return `${this.getMcpPlatformBaseUrl()}/agents/servers`;
|
|
137
|
+
static GetMcpBaseUrl(configProvider) {
|
|
138
|
+
return `${this.getMcpPlatformBaseUrl(configProvider)}/agents/servers`;
|
|
105
139
|
}
|
|
106
140
|
/**
|
|
107
141
|
* Build the full URL for accessing a specific MCP server.
|
|
@@ -111,38 +145,44 @@ export class Utility {
|
|
|
111
145
|
* // => "https://agent365.svc.cloud.microsoft/agents/servers/MyServer/"
|
|
112
146
|
*
|
|
113
147
|
* @param serverName - The MCP server resource name.
|
|
148
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
114
149
|
* @returns The fully-qualified MCP server URL including trailing slash.
|
|
150
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService instead.
|
|
115
151
|
*/
|
|
116
|
-
static BuildMcpServerUrl(serverName) {
|
|
117
|
-
const baseUrl = this.GetMcpBaseUrl();
|
|
118
|
-
return `${baseUrl}/${serverName}
|
|
152
|
+
static BuildMcpServerUrl(serverName, configProvider) {
|
|
153
|
+
const baseUrl = this.GetMcpBaseUrl(configProvider);
|
|
154
|
+
return `${baseUrl}/${serverName}/`;
|
|
119
155
|
}
|
|
120
156
|
/**
|
|
121
|
-
* Gets the base URL for MCP platform
|
|
157
|
+
* Gets the base URL for MCP platform from configuration.
|
|
122
158
|
*
|
|
159
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
123
160
|
* @returns The base URL for MCP platform.
|
|
161
|
+
* @deprecated This method is for internal use only. Use ToolingConfiguration.mcpPlatformEndpoint instead.
|
|
124
162
|
*/
|
|
125
|
-
static getMcpPlatformBaseUrl() {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
return MCP_PLATFORM_PROD_BASE_URL;
|
|
163
|
+
static getMcpPlatformBaseUrl(configProvider) {
|
|
164
|
+
const provider = configProvider ?? defaultToolingConfigurationProvider;
|
|
165
|
+
return provider.getConfiguration().mcpPlatformEndpoint;
|
|
130
166
|
}
|
|
131
167
|
/**
|
|
132
168
|
* Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
|
|
133
169
|
*
|
|
170
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
134
171
|
* @returns An absolute URL that tooling components can use to send or retrieve chat messages for
|
|
135
172
|
* real-time threat protection scenarios.
|
|
136
173
|
* @remarks
|
|
137
174
|
* Call this method when constructing HTTP requests that need to access the chat-message history
|
|
138
175
|
* for real-time threat protection. The returned URL already includes the MCP platform base address
|
|
139
176
|
* and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
|
|
177
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService.sendChatHistory() instead.
|
|
140
178
|
*/
|
|
141
|
-
static GetChatHistoryEndpoint() {
|
|
142
|
-
return `${this.getMcpPlatformBaseUrl()}/agents/real-time-threat-protection/chat-message`;
|
|
179
|
+
static GetChatHistoryEndpoint(configProvider) {
|
|
180
|
+
return `${this.getMcpPlatformBaseUrl(configProvider)}/agents/real-time-threat-protection/chat-message`;
|
|
143
181
|
}
|
|
144
182
|
}
|
|
145
183
|
Utility.HEADER_CHANNEL_ID = 'x-ms-channel-id';
|
|
146
184
|
Utility.HEADER_SUBCHANNEL_ID = 'x-ms-subchannel-id';
|
|
147
185
|
Utility.HEADER_USER_AGENT = 'User-Agent';
|
|
186
|
+
/** Header name for sending the agent identifier to MCP platform for logging/analytics. */
|
|
187
|
+
Utility.HEADER_AGENT_ID = 'x-ms-agentid';
|
|
148
188
|
//# 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;AAIlC,OAAO,EAAE,OAAO,IAAI,cAAc,EAA0B,MAAM,gCAAgC,CAAC;AAGnG,OAAO,EAAwB,mCAAmC,EAAE,MAAM,iBAAiB,CAAC;AAE5F,MAAM,OAAO,OAAO;IAOlB;;;;;;;;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;YAEjD,+EAA+E;YAC/E,MAAM,OAAO,GAAG,IAAI,CAAC,uBAAuB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;YACrE,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|
+
import { ToolingConfigurationOptions } from './ToolingConfigurationOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for tooling package.
|
|
5
|
+
* Inherits runtime settings and adds tooling-specific settings.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ToolingConfiguration extends RuntimeConfiguration {
|
|
8
|
+
protected get toolingOverrides(): ToolingConfigurationOptions;
|
|
9
|
+
constructor(overrides?: ToolingConfigurationOptions);
|
|
10
|
+
get mcpPlatformEndpoint(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether to use the ToolingManifest.json file instead of gateway discovery.
|
|
13
|
+
* Returns true when NODE_ENV is set to 'development' (case-insensitive), or
|
|
14
|
+
* when explicitly overridden via configuration.
|
|
15
|
+
*/
|
|
16
|
+
get useToolingManifest(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the MCP platform authentication scope.
|
|
19
|
+
* Used by AgenticAuthenticationService for token exchange.
|
|
20
|
+
* Trims whitespace to prevent token exchange failures.
|
|
21
|
+
*/
|
|
22
|
+
get mcpPlatformAuthenticationScope(): string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ToolingConfiguration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolingConfiguration.d.ts","sourceRoot":"","sources":["../../../src/configuration/ToolingConfiguration.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAc5E;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,oBAAoB;IAE5D,SAAS,KAAK,gBAAgB,IAAI,2BAA2B,CAE5D;gBAEW,SAAS,CAAC,EAAE,2BAA2B;IAMnD,IAAI,mBAAmB,IAAI,MAAM,CAQhC;IAED;;;;OAIG;IACH,IAAI,kBAAkB,IAAI,OAAO,CAKhC;IAED;;;;OAIG;IACH,IAAI,8BAA8B,IAAI,MAAM,CAQ3C;CACF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { RuntimeConfiguration } from '@microsoft/agents-a365-runtime';
|
|
4
|
+
// Constants for tooling-specific settings
|
|
5
|
+
const MCP_PLATFORM_PROD_BASE_URL = 'https://agent365.svc.cloud.microsoft';
|
|
6
|
+
const PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE = 'ea9ffc3e-8a23-4a7d-836d-234d7c7565c1/.default';
|
|
7
|
+
/**
|
|
8
|
+
* Normalize URL by trimming whitespace and removing trailing slashes.
|
|
9
|
+
* Prevents double-slash issues in URL construction (e.g., "https://example.com//api").
|
|
10
|
+
*/
|
|
11
|
+
function normalizeUrl(url) {
|
|
12
|
+
return url.trim().replace(/\/+$/, '');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Configuration for tooling package.
|
|
16
|
+
* Inherits runtime settings and adds tooling-specific settings.
|
|
17
|
+
*/
|
|
18
|
+
export class ToolingConfiguration extends RuntimeConfiguration {
|
|
19
|
+
// Type-safe access to tooling overrides
|
|
20
|
+
get toolingOverrides() {
|
|
21
|
+
return this.overrides;
|
|
22
|
+
}
|
|
23
|
+
constructor(overrides) {
|
|
24
|
+
super(overrides);
|
|
25
|
+
}
|
|
26
|
+
// Inherited: clusterCategory, isDevelopmentEnvironment, isNodeEnvDevelopment
|
|
27
|
+
get mcpPlatformEndpoint() {
|
|
28
|
+
const override = this.toolingOverrides.mcpPlatformEndpoint?.();
|
|
29
|
+
if (override)
|
|
30
|
+
return normalizeUrl(override);
|
|
31
|
+
const envValue = process.env.MCP_PLATFORM_ENDPOINT?.trim();
|
|
32
|
+
if (envValue)
|
|
33
|
+
return normalizeUrl(envValue);
|
|
34
|
+
return MCP_PLATFORM_PROD_BASE_URL;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Whether to use the ToolingManifest.json file instead of gateway discovery.
|
|
38
|
+
* Returns true when NODE_ENV is set to 'development' (case-insensitive), or
|
|
39
|
+
* when explicitly overridden via configuration.
|
|
40
|
+
*/
|
|
41
|
+
get useToolingManifest() {
|
|
42
|
+
const override = this.toolingOverrides.useToolingManifest?.();
|
|
43
|
+
if (override !== undefined)
|
|
44
|
+
return override;
|
|
45
|
+
return this.isNodeEnvDevelopment;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Gets the MCP platform authentication scope.
|
|
49
|
+
* Used by AgenticAuthenticationService for token exchange.
|
|
50
|
+
* Trims whitespace to prevent token exchange failures.
|
|
51
|
+
*/
|
|
52
|
+
get mcpPlatformAuthenticationScope() {
|
|
53
|
+
const override = this.toolingOverrides.mcpPlatformAuthenticationScope?.()?.trim();
|
|
54
|
+
if (override)
|
|
55
|
+
return override;
|
|
56
|
+
const envValue = process.env.MCP_PLATFORM_AUTHENTICATION_SCOPE?.trim();
|
|
57
|
+
if (envValue)
|
|
58
|
+
return envValue;
|
|
59
|
+
return PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=ToolingConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolingConfiguration.js","sourceRoot":"","sources":["../../../src/configuration/ToolingConfiguration.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;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,MAAM,OAAO,oBAAqB,SAAQ,oBAAoB;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"}
|
|
@@ -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,11 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { DefaultConfigurationProvider } from '@microsoft/agents-a365-runtime';
|
|
4
|
+
import { ToolingConfiguration } from './ToolingConfiguration';
|
|
5
|
+
export * from './ToolingConfigurationOptions';
|
|
6
|
+
export * from './ToolingConfiguration';
|
|
7
|
+
/**
|
|
8
|
+
* Shared default provider for ToolingConfiguration.
|
|
9
|
+
*/
|
|
10
|
+
export const defaultToolingConfigurationProvider = new DefaultConfigurationProvider(() => new ToolingConfiguration());
|
|
11
|
+
//# 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,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,MAAM,CAAC,MAAM,mCAAmC,GAC9C,IAAI,4BAA4B,CAAC,GAAG,EAAE,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC"}
|
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":"
|
|
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/esm/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
1
3
|
export * from './Utility';
|
|
2
4
|
export * from './McpToolServerConfigurationService';
|
|
3
5
|
export * from './contracts';
|
|
4
6
|
export * from './models';
|
|
7
|
+
export * from './configuration';
|
|
5
8
|
//# sourceMappingURL=index.js.map
|
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;AAC5B,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/agents-a365-tooling",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-preview.1",
|
|
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,8 +19,8 @@
|
|
|
19
19
|
"directory": "packages/agents-a365-tooling"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@microsoft/agents-a365-runtime": "0.
|
|
23
|
-
"@microsoft/agents-hosting": "^1.1
|
|
22
|
+
"@microsoft/agents-a365-runtime": "0.2.0-preview.1",
|
|
23
|
+
"@microsoft/agents-hosting": "^1.3.1",
|
|
24
24
|
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
25
25
|
"express": "^5.2.0",
|
|
26
26
|
"hono": "^4.11.7"
|