@microsoft/agents-a365-runtime 0.1.0-preview.95 → 0.2.0-preview.3
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/agentic-authorization-service.d.ts +23 -0
- package/dist/cjs/agentic-authorization-service.d.ts.map +1 -1
- package/dist/cjs/agentic-authorization-service.js +7 -3
- package/dist/cjs/agentic-authorization-service.js.map +1 -1
- package/dist/cjs/configuration/DefaultConfigurationProvider.d.ts +39 -0
- package/dist/cjs/configuration/DefaultConfigurationProvider.d.ts.map +1 -0
- package/dist/cjs/configuration/DefaultConfigurationProvider.js +47 -0
- package/dist/cjs/configuration/DefaultConfigurationProvider.js.map +1 -0
- package/dist/cjs/configuration/IConfigurationProvider.d.ts +8 -0
- package/dist/cjs/configuration/IConfigurationProvider.d.ts.map +1 -0
- package/dist/cjs/configuration/IConfigurationProvider.js +5 -0
- package/dist/cjs/configuration/IConfigurationProvider.js.map +1 -0
- package/dist/cjs/configuration/RuntimeConfiguration.d.ts +35 -0
- package/dist/cjs/configuration/RuntimeConfiguration.d.ts.map +1 -0
- package/dist/cjs/configuration/RuntimeConfiguration.js +71 -0
- package/dist/cjs/configuration/RuntimeConfiguration.js.map +1 -0
- package/dist/cjs/configuration/RuntimeConfigurationOptions.d.ts +35 -0
- package/dist/cjs/configuration/RuntimeConfigurationOptions.d.ts.map +1 -0
- package/dist/cjs/configuration/RuntimeConfigurationOptions.js +5 -0
- package/dist/cjs/configuration/RuntimeConfigurationOptions.js.map +1 -0
- package/dist/cjs/configuration/index.d.ts +5 -0
- package/dist/cjs/configuration/index.d.ts.map +1 -0
- package/dist/cjs/configuration/index.js +23 -0
- package/dist/cjs/configuration/index.js.map +1 -0
- package/dist/cjs/environment-utils.d.ts +69 -11
- package/dist/cjs/environment-utils.d.ts.map +1 -1
- package/dist/cjs/environment-utils.js +79 -26
- package/dist/cjs/environment-utils.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/power-platform-api-discovery.d.ts +18 -1
- package/dist/cjs/power-platform-api-discovery.d.ts.map +1 -1
- package/dist/cjs/power-platform-api-discovery.js +22 -3
- package/dist/cjs/power-platform-api-discovery.js.map +1 -1
- package/dist/cjs/utility.d.ts +48 -1
- package/dist/cjs/utility.d.ts.map +1 -1
- package/dist/cjs/utility.js +91 -1
- package/dist/cjs/utility.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.d.ts.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/agentic-authorization-service.d.ts +23 -0
- package/dist/esm/agentic-authorization-service.d.ts.map +1 -1
- package/dist/esm/agentic-authorization-service.js +8 -4
- package/dist/esm/agentic-authorization-service.js.map +1 -1
- package/dist/esm/configuration/DefaultConfigurationProvider.d.ts +39 -0
- package/dist/esm/configuration/DefaultConfigurationProvider.d.ts.map +1 -0
- package/dist/esm/configuration/DefaultConfigurationProvider.js +43 -0
- package/dist/esm/configuration/DefaultConfigurationProvider.js.map +1 -0
- package/dist/esm/configuration/IConfigurationProvider.d.ts +8 -0
- package/dist/esm/configuration/IConfigurationProvider.d.ts.map +1 -0
- package/dist/esm/configuration/IConfigurationProvider.js +4 -0
- package/dist/esm/configuration/IConfigurationProvider.js.map +1 -0
- package/dist/esm/configuration/RuntimeConfiguration.d.ts +35 -0
- package/dist/esm/configuration/RuntimeConfiguration.d.ts.map +1 -0
- package/dist/esm/configuration/RuntimeConfiguration.js +67 -0
- package/dist/esm/configuration/RuntimeConfiguration.js.map +1 -0
- package/dist/esm/configuration/RuntimeConfigurationOptions.d.ts +35 -0
- package/dist/esm/configuration/RuntimeConfigurationOptions.d.ts.map +1 -0
- package/dist/esm/configuration/RuntimeConfigurationOptions.js +4 -0
- package/dist/esm/configuration/RuntimeConfigurationOptions.js.map +1 -0
- package/dist/esm/configuration/index.d.ts +5 -0
- package/dist/esm/configuration/index.d.ts.map +1 -0
- package/dist/esm/configuration/index.js +7 -0
- package/dist/esm/configuration/index.js.map +1 -0
- package/dist/esm/environment-utils.d.ts +69 -11
- package/dist/esm/environment-utils.d.ts.map +1 -1
- package/dist/esm/environment-utils.js +79 -26
- package/dist/esm/environment-utils.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/power-platform-api-discovery.d.ts +18 -1
- package/dist/esm/power-platform-api-discovery.d.ts.map +1 -1
- package/dist/esm/power-platform-api-discovery.js +21 -2
- package/dist/esm/power-platform-api-discovery.js.map +1 -1
- package/dist/esm/utility.d.ts +48 -1
- package/dist/esm/utility.d.ts.map +1 -1
- package/dist/esm/utility.js +91 -1
- package/dist/esm/utility.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.d.ts.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
import { TurnContext, Authorization } from '@microsoft/agents-hosting';
|
|
2
|
+
/**
|
|
3
|
+
* Service for handling agentic user authentication.
|
|
4
|
+
*/
|
|
2
5
|
export declare class AgenticAuthenticationService {
|
|
6
|
+
/**
|
|
7
|
+
* Gets an agentic user token for platform authentication.
|
|
8
|
+
* Uses the default MCP platform authentication scope.
|
|
9
|
+
*
|
|
10
|
+
* @param authorization The authorization handler.
|
|
11
|
+
* @param authHandlerName The name of the auth handler to use.
|
|
12
|
+
* @param turnContext The turn context for the current request.
|
|
13
|
+
* @returns The token string, or empty string if no token was returned.
|
|
14
|
+
* @deprecated Use the overload with explicit scopes parameter for better control over requested permissions.
|
|
15
|
+
*/
|
|
3
16
|
static GetAgenticUserToken(authorization: Authorization, authHandlerName: string, turnContext: TurnContext): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Gets an agentic user token for platform authentication.
|
|
19
|
+
*
|
|
20
|
+
* @param authorization The authorization handler.
|
|
21
|
+
* @param authHandlerName The name of the auth handler to use.
|
|
22
|
+
* @param turnContext The turn context for the current request.
|
|
23
|
+
* @param scopes The OAuth scopes to request. Should be obtained from the appropriate configuration (e.g., ToolingConfiguration.mcpPlatformAuthenticationScope).
|
|
24
|
+
* @returns The token string, or empty string if no token was returned.
|
|
25
|
+
*/
|
|
26
|
+
static GetAgenticUserToken(authorization: Authorization, authHandlerName: string, turnContext: TurnContext, scopes: string[]): Promise<string>;
|
|
4
27
|
}
|
|
5
28
|
//# sourceMappingURL=agentic-authorization-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentic-authorization-service.d.ts","sourceRoot":"","sources":["../../src/agentic-authorization-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAGvE,qBAAa,4BAA4B;
|
|
1
|
+
{"version":3,"file":"agentic-authorization-service.d.ts","sourceRoot":"","sources":["../../src/agentic-authorization-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAGvE;;GAEG;AACH,qBAAa,4BAA4B;IACvC;;;;;;;;;OASG;WACiB,mBAAmB,CACrC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,MAAM,CAAC;IAElB;;;;;;;;OAQG;WACiB,mBAAmB,CACrC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,MAAM,CAAC;CAYnB"}
|
|
@@ -4,10 +4,14 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.AgenticAuthenticationService = void 0;
|
|
6
6
|
const environment_utils_1 = require("./environment-utils");
|
|
7
|
+
/**
|
|
8
|
+
* Service for handling agentic user authentication.
|
|
9
|
+
*/
|
|
7
10
|
class AgenticAuthenticationService {
|
|
8
|
-
static async GetAgenticUserToken(authorization, authHandlerName, turnContext) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
static async GetAgenticUserToken(authorization, authHandlerName, turnContext, scopes) {
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Intentional: maintaining backward compatibility for deprecated 3-param overload
|
|
13
|
+
const effectiveScopes = scopes ?? [environment_utils_1.PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE];
|
|
14
|
+
return (await authorization.exchangeToken(turnContext, authHandlerName, { scopes: effectiveScopes })).token || '';
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
17
|
exports.AgenticAuthenticationService = AgenticAuthenticationService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentic-authorization-service.js","sourceRoot":"","sources":["../../src/agentic-authorization-service.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,
|
|
1
|
+
{"version":3,"file":"agentic-authorization-service.js","sourceRoot":"","sources":["../../src/agentic-authorization-service.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,2DAA6E;AAE7E;;GAEG;AACH,MAAa,4BAA4B;IAiChC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CACrC,aAA4B,EAC5B,eAAuB,EACvB,WAAwB,EACxB,MAAiB;QAEjB,+IAA+I;QAC/I,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,0DAAsC,CAAC,CAAC;QAC3E,OAAO,CAAC,MAAM,aAAa,CAAC,aAAa,CAAC,WAAW,EAAE,eAAe,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;IACpH,CAAC;CACF;AA3CD,oEA2CC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IConfigurationProvider } from './IConfigurationProvider';
|
|
2
|
+
import { RuntimeConfiguration } from './RuntimeConfiguration';
|
|
3
|
+
/**
|
|
4
|
+
* Default provider that returns environment-based configuration.
|
|
5
|
+
*
|
|
6
|
+
* **Multi-tenant considerations:**
|
|
7
|
+
* This provider creates a single configuration instance at construction time,
|
|
8
|
+
* shared across all requests in a process. The default module-level providers
|
|
9
|
+
* (e.g., `defaultRuntimeConfigurationProvider`) are singletons.
|
|
10
|
+
*
|
|
11
|
+
* For multi-tenant scenarios, two approaches are supported:
|
|
12
|
+
*
|
|
13
|
+
* 1. **Dynamic override functions (recommended):** Pass override functions that
|
|
14
|
+
* read from async context (e.g., OpenTelemetry baggage) at runtime. The same
|
|
15
|
+
* Configuration instance returns different values per request.
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const config = new ToolingConfiguration({
|
|
18
|
+
* mcpPlatformEndpoint: () => {
|
|
19
|
+
* const tenantConfig = context.active().getValue(TENANT_KEY);
|
|
20
|
+
* return tenantConfig?.endpoint ?? 'https://default.endpoint';
|
|
21
|
+
* }
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* 2. **Per-tenant providers:** Create separate provider instances for each tenant
|
|
26
|
+
* when different tenants need different override functions entirely.
|
|
27
|
+
*/
|
|
28
|
+
export declare class DefaultConfigurationProvider<T extends RuntimeConfiguration> implements IConfigurationProvider<T> {
|
|
29
|
+
private readonly _configuration;
|
|
30
|
+
constructor(factory: () => T);
|
|
31
|
+
getConfiguration(): T;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Shared default provider for RuntimeConfiguration.
|
|
35
|
+
* Uses environment variables with no overrides - suitable for single-tenant
|
|
36
|
+
* deployments or when using dynamic override functions for multi-tenancy.
|
|
37
|
+
*/
|
|
38
|
+
export declare const defaultRuntimeConfigurationProvider: DefaultConfigurationProvider<RuntimeConfiguration>;
|
|
39
|
+
//# sourceMappingURL=DefaultConfigurationProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultConfigurationProvider.d.ts","sourceRoot":"","sources":["../../../src/configuration/DefaultConfigurationProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,4BAA4B,CAAC,CAAC,SAAS,oBAAoB,CACtE,YAAW,sBAAsB,CAAC,CAAC,CAAC;IAEpC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAI;gBAEvB,OAAO,EAAE,MAAM,CAAC;IAI5B,gBAAgB,IAAI,CAAC;CAGtB;AAED;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,oDACoB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.defaultRuntimeConfigurationProvider = exports.DefaultConfigurationProvider = void 0;
|
|
6
|
+
const RuntimeConfiguration_1 = require("./RuntimeConfiguration");
|
|
7
|
+
/**
|
|
8
|
+
* Default provider that returns environment-based configuration.
|
|
9
|
+
*
|
|
10
|
+
* **Multi-tenant considerations:**
|
|
11
|
+
* This provider creates a single configuration instance at construction time,
|
|
12
|
+
* shared across all requests in a process. The default module-level providers
|
|
13
|
+
* (e.g., `defaultRuntimeConfigurationProvider`) are singletons.
|
|
14
|
+
*
|
|
15
|
+
* For multi-tenant scenarios, two approaches are supported:
|
|
16
|
+
*
|
|
17
|
+
* 1. **Dynamic override functions (recommended):** Pass override functions that
|
|
18
|
+
* read from async context (e.g., OpenTelemetry baggage) at runtime. The same
|
|
19
|
+
* Configuration instance returns different values per request.
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const config = new ToolingConfiguration({
|
|
22
|
+
* mcpPlatformEndpoint: () => {
|
|
23
|
+
* const tenantConfig = context.active().getValue(TENANT_KEY);
|
|
24
|
+
* return tenantConfig?.endpoint ?? 'https://default.endpoint';
|
|
25
|
+
* }
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* 2. **Per-tenant providers:** Create separate provider instances for each tenant
|
|
30
|
+
* when different tenants need different override functions entirely.
|
|
31
|
+
*/
|
|
32
|
+
class DefaultConfigurationProvider {
|
|
33
|
+
constructor(factory) {
|
|
34
|
+
this._configuration = factory();
|
|
35
|
+
}
|
|
36
|
+
getConfiguration() {
|
|
37
|
+
return this._configuration;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.DefaultConfigurationProvider = DefaultConfigurationProvider;
|
|
41
|
+
/**
|
|
42
|
+
* Shared default provider for RuntimeConfiguration.
|
|
43
|
+
* Uses environment variables with no overrides - suitable for single-tenant
|
|
44
|
+
* deployments or when using dynamic override functions for multi-tenancy.
|
|
45
|
+
*/
|
|
46
|
+
exports.defaultRuntimeConfigurationProvider = new DefaultConfigurationProvider(() => new RuntimeConfiguration_1.RuntimeConfiguration());
|
|
47
|
+
//# sourceMappingURL=DefaultConfigurationProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultConfigurationProvider.js","sourceRoot":"","sources":["../../../src/configuration/DefaultConfigurationProvider.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,iEAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,4BAA4B;IAKvC,YAAY,OAAgB;QAC1B,IAAI,CAAC,cAAc,GAAG,OAAO,EAAE,CAAC;IAClC,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AAZD,oEAYC;AAED;;;;GAIG;AACU,QAAA,mCAAmC,GAC9C,IAAI,4BAA4B,CAAC,GAAG,EAAE,CAAC,IAAI,2CAAoB,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IConfigurationProvider.d.ts","sourceRoot":"","sources":["../../../src/configuration/IConfigurationProvider.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,gBAAgB,IAAI,CAAC,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IConfigurationProvider.js","sourceRoot":"","sources":["../../../src/configuration/IConfigurationProvider.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ClusterCategory } from '../power-platform-api-discovery';
|
|
2
|
+
import { RuntimeConfigurationOptions } from './RuntimeConfigurationOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Base configuration class for Agent365 SDK.
|
|
5
|
+
* Other packages extend this to add their own settings.
|
|
6
|
+
*
|
|
7
|
+
* Override functions are called on each property access, enabling dynamic
|
|
8
|
+
* resolution from async context (e.g., OpenTelemetry baggage) per-request.
|
|
9
|
+
*/
|
|
10
|
+
export declare class RuntimeConfiguration {
|
|
11
|
+
protected readonly overrides: RuntimeConfigurationOptions;
|
|
12
|
+
/**
|
|
13
|
+
* Parse an environment variable as a boolean.
|
|
14
|
+
* Recognizes 'true', '1', 'yes', 'on' (case-insensitive) as true; all other values as false.
|
|
15
|
+
*/
|
|
16
|
+
static parseEnvBoolean(envValue: string | undefined): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Parse an environment variable as an integer, returning fallback if invalid or not set.
|
|
19
|
+
*/
|
|
20
|
+
static parseEnvInt(envValue: string | undefined, fallback: number): number;
|
|
21
|
+
constructor(overrides?: RuntimeConfigurationOptions);
|
|
22
|
+
get clusterCategory(): ClusterCategory;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the cluster is a development environment (local or dev).
|
|
25
|
+
* Based on clusterCategory.
|
|
26
|
+
*/
|
|
27
|
+
get isDevelopmentEnvironment(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether NODE_ENV indicates development mode.
|
|
30
|
+
* Returns true when NODE_ENV is 'development' (case-insensitive).
|
|
31
|
+
* This is the standard Node.js way of indicating development mode.
|
|
32
|
+
*/
|
|
33
|
+
get isNodeEnvDevelopment(): boolean;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=RuntimeConfiguration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuntimeConfiguration.d.ts","sourceRoot":"","sources":["../../../src/configuration/RuntimeConfiguration.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;;;;;GAMG;AACH,qBAAa,oBAAoB;IAC/B,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,2BAA2B,CAAC;IAE1D;;;OAGG;WACW,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO;IAKpE;;OAEG;WACW,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;gBAMrE,SAAS,CAAC,EAAE,2BAA2B;IAInD,IAAI,eAAe,IAAI,eAAe,CAarC;IAED;;;OAGG;IACH,IAAI,wBAAwB,IAAI,OAAO,CAEtC;IAED;;;;OAIG;IACH,IAAI,oBAAoB,IAAI,OAAO,CAMlC;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.RuntimeConfiguration = void 0;
|
|
6
|
+
const power_platform_api_discovery_1 = require("../power-platform-api-discovery");
|
|
7
|
+
/**
|
|
8
|
+
* Base configuration class for Agent365 SDK.
|
|
9
|
+
* Other packages extend this to add their own settings.
|
|
10
|
+
*
|
|
11
|
+
* Override functions are called on each property access, enabling dynamic
|
|
12
|
+
* resolution from async context (e.g., OpenTelemetry baggage) per-request.
|
|
13
|
+
*/
|
|
14
|
+
class RuntimeConfiguration {
|
|
15
|
+
/**
|
|
16
|
+
* Parse an environment variable as a boolean.
|
|
17
|
+
* Recognizes 'true', '1', 'yes', 'on' (case-insensitive) as true; all other values as false.
|
|
18
|
+
*/
|
|
19
|
+
static parseEnvBoolean(envValue) {
|
|
20
|
+
if (!envValue)
|
|
21
|
+
return false;
|
|
22
|
+
return ['true', '1', 'yes', 'on'].includes(envValue.toLowerCase());
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse an environment variable as an integer, returning fallback if invalid or not set.
|
|
26
|
+
*/
|
|
27
|
+
static parseEnvInt(envValue, fallback) {
|
|
28
|
+
if (!envValue)
|
|
29
|
+
return fallback;
|
|
30
|
+
const parsed = parseInt(envValue, 10);
|
|
31
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
32
|
+
}
|
|
33
|
+
constructor(overrides) {
|
|
34
|
+
this.overrides = overrides ?? {};
|
|
35
|
+
}
|
|
36
|
+
get clusterCategory() {
|
|
37
|
+
if (this.overrides.clusterCategory) {
|
|
38
|
+
return this.overrides.clusterCategory();
|
|
39
|
+
}
|
|
40
|
+
const envValue = process.env.CLUSTER_CATEGORY;
|
|
41
|
+
if (envValue) {
|
|
42
|
+
const normalized = envValue.toLowerCase();
|
|
43
|
+
if (Object.values(power_platform_api_discovery_1.ClusterCategory).includes(normalized)) {
|
|
44
|
+
return normalized;
|
|
45
|
+
}
|
|
46
|
+
// Invalid value - fall through to default
|
|
47
|
+
}
|
|
48
|
+
return power_platform_api_discovery_1.ClusterCategory.prod;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Whether the cluster is a development environment (local or dev).
|
|
52
|
+
* Based on clusterCategory.
|
|
53
|
+
*/
|
|
54
|
+
get isDevelopmentEnvironment() {
|
|
55
|
+
return [power_platform_api_discovery_1.ClusterCategory.local, power_platform_api_discovery_1.ClusterCategory.dev].includes(this.clusterCategory);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Whether NODE_ENV indicates development mode.
|
|
59
|
+
* Returns true when NODE_ENV is 'development' (case-insensitive).
|
|
60
|
+
* This is the standard Node.js way of indicating development mode.
|
|
61
|
+
*/
|
|
62
|
+
get isNodeEnvDevelopment() {
|
|
63
|
+
const override = this.overrides.isNodeEnvDevelopment?.();
|
|
64
|
+
if (override !== undefined)
|
|
65
|
+
return override;
|
|
66
|
+
const nodeEnv = process.env.NODE_ENV ?? '';
|
|
67
|
+
return nodeEnv.toLowerCase() === 'development';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.RuntimeConfiguration = RuntimeConfiguration;
|
|
71
|
+
//# sourceMappingURL=RuntimeConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuntimeConfiguration.js","sourceRoot":"","sources":["../../../src/configuration/RuntimeConfiguration.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,kFAAkE;AAGlE;;;;;;GAMG;AACH,MAAa,oBAAoB;IAG/B;;;OAGG;IACI,MAAM,CAAC,eAAe,CAAC,QAA4B;QACxD,IAAI,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5B,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,WAAW,CAAC,QAA4B,EAAE,QAAgB;QACtE,IAAI,CAAC,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAC/B,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IACrD,CAAC;IAED,YAAY,SAAuC;QACjD,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,eAAe;QACjB,IAAI,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;QAC1C,CAAC;QACD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;QAC9C,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;YAC1C,IAAI,MAAM,CAAC,MAAM,CAAC,8CAAe,CAAC,CAAC,QAAQ,CAAC,UAA6B,CAAC,EAAE,CAAC;gBAC3E,OAAO,UAA6B,CAAC;YACvC,CAAC;YACD,0CAA0C;QAC5C,CAAC;QACD,OAAO,8CAAe,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,IAAI,wBAAwB;QAC1B,OAAO,CAAC,8CAAe,CAAC,KAAK,EAAE,8CAAe,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACrF,CAAC;IAED;;;;OAIG;IACH,IAAI,oBAAoB;QACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,oBAAoB,EAAE,EAAE,CAAC;QACzD,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,QAAQ,CAAC;QAE5C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;QAC3C,OAAO,OAAO,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC;IACjD,CAAC;CACF;AA5DD,oDA4DC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ClusterCategory } from '../power-platform-api-discovery';
|
|
2
|
+
/**
|
|
3
|
+
* Runtime configuration options - all optional functions.
|
|
4
|
+
* Functions are called on each property access, enabling dynamic resolution.
|
|
5
|
+
* Unset values fall back to environment variables.
|
|
6
|
+
*/
|
|
7
|
+
export type RuntimeConfigurationOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Override function for cluster category.
|
|
10
|
+
* Called on each property access to enable dynamic per-request resolution.
|
|
11
|
+
* Falls back to CLUSTER_CATEGORY env var, then 'prod'.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Static override
|
|
15
|
+
* { clusterCategory: () => ClusterCategory.gov }
|
|
16
|
+
*
|
|
17
|
+
* // Dynamic per-tenant override using async context
|
|
18
|
+
* { clusterCategory: () => context.active().getValue(TENANT_CONFIG_KEY)?.cluster ?? ClusterCategory.prod }
|
|
19
|
+
*/
|
|
20
|
+
clusterCategory?: () => ClusterCategory;
|
|
21
|
+
/**
|
|
22
|
+
* Override for NODE_ENV-based development mode detection.
|
|
23
|
+
* Called on each property access to enable dynamic per-request resolution.
|
|
24
|
+
* Falls back to NODE_ENV === 'development' check.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Static override
|
|
28
|
+
* { isNodeEnvDevelopment: () => true }
|
|
29
|
+
*
|
|
30
|
+
* // Dynamic override based on request context
|
|
31
|
+
* { isNodeEnvDevelopment: () => context.active().getValue(DEBUG_KEY) === true }
|
|
32
|
+
*/
|
|
33
|
+
isNodeEnvDevelopment?: () => boolean;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=RuntimeConfigurationOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuntimeConfigurationOptions.d.ts","sourceRoot":"","sources":["../../../src/configuration/RuntimeConfigurationOptions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,EAAE,MAAM,eAAe,CAAC;IACxC;;;;;;;;;;;OAWG;IACH,oBAAoB,CAAC,EAAE,MAAM,OAAO,CAAC;CACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuntimeConfigurationOptions.js","sourceRoot":"","sources":["../../../src/configuration/RuntimeConfigurationOptions.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/configuration/index.ts"],"names":[],"mappings":"AAGA,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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("./IConfigurationProvider"), exports);
|
|
20
|
+
__exportStar(require("./RuntimeConfigurationOptions"), exports);
|
|
21
|
+
__exportStar(require("./RuntimeConfiguration"), exports);
|
|
22
|
+
__exportStar(require("./DefaultConfigurationProvider"), exports);
|
|
23
|
+
//# 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,2DAAyC;AACzC,gEAA8C;AAC9C,yDAAuC;AACvC,iEAA+C"}
|
|
@@ -1,40 +1,98 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Utility logic for environment-related operations.
|
|
3
|
+
*
|
|
4
|
+
* Note: These utility functions are maintained for backward compatibility.
|
|
5
|
+
* For new code, prefer using the configuration classes directly:
|
|
6
|
+
* - RuntimeConfiguration for clusterCategory, isDevelopmentEnvironment, isNodeEnvDevelopment
|
|
7
|
+
* - ToolingConfiguration for mcpPlatformAuthenticationScope
|
|
8
|
+
* - ObservabilityConfiguration for observabilityAuthenticationScopes
|
|
9
|
+
*/
|
|
10
|
+
import { RuntimeConfiguration } from './configuration';
|
|
11
|
+
import { IConfigurationProvider } from './configuration/IConfigurationProvider';
|
|
12
|
+
/**
|
|
13
|
+
* Production observability authentication scope.
|
|
14
|
+
* @deprecated This constant is exported for backward compatibility only.
|
|
15
|
+
* For new code, use `ObservabilityConfiguration.observabilityAuthenticationScopes` instead.
|
|
3
16
|
*/
|
|
4
17
|
export declare const PROD_OBSERVABILITY_SCOPE = "https://api.powerplatform.com/.default";
|
|
18
|
+
/**
|
|
19
|
+
* Production MCP platform authentication scope.
|
|
20
|
+
* @deprecated This constant is exported for backward compatibility only.
|
|
21
|
+
* For new code, use `ToolingConfiguration.mcpPlatformAuthenticationScope` instead.
|
|
22
|
+
*/
|
|
5
23
|
export declare const PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE = "ea9ffc3e-8a23-4a7d-836d-234d7c7565c1/.default";
|
|
24
|
+
/**
|
|
25
|
+
* Default cluster category for production environments.
|
|
26
|
+
* @deprecated This constant is exported for backward compatibility only.
|
|
27
|
+
* For new code, use `RuntimeConfiguration.clusterCategory` instead.
|
|
28
|
+
*/
|
|
6
29
|
export declare const PROD_OBSERVABILITY_CLUSTER_CATEGORY = "prod";
|
|
7
30
|
export declare const PRODUCTION_ENVIRONMENT_NAME = "production";
|
|
8
31
|
export declare const DEVELOPMENT_ENVIRONMENT_NAME = "Development";
|
|
9
32
|
/**
|
|
10
|
-
* Returns the scope for authenticating to the observability service
|
|
33
|
+
* Returns the scope for authenticating to the observability service.
|
|
11
34
|
*
|
|
12
|
-
* The
|
|
13
|
-
*
|
|
14
|
-
* `A365_OBSERVABILITY_SCOPES_OVERRIDE` environment variable.
|
|
35
|
+
* @returns The authentication scopes for the current environment.
|
|
36
|
+
* @deprecated Use ObservabilityConfiguration.observabilityAuthenticationScopes instead.
|
|
15
37
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Before:
|
|
40
|
+
* import { getObservabilityAuthenticationScope } from '@microsoft/agents-a365-runtime';
|
|
41
|
+
* const scopes = getObservabilityAuthenticationScope();
|
|
18
42
|
*
|
|
19
|
-
*
|
|
43
|
+
* // After:
|
|
44
|
+
* import { defaultObservabilityConfigurationProvider } from '@microsoft/agents-a365-observability';
|
|
45
|
+
* const scopes = [...defaultObservabilityConfigurationProvider.getConfiguration().observabilityAuthenticationScopes];
|
|
20
46
|
*/
|
|
21
47
|
export declare function getObservabilityAuthenticationScope(): string[];
|
|
22
48
|
/**
|
|
23
49
|
* Gets the cluster category from environment variables.
|
|
24
50
|
*
|
|
51
|
+
* @param configProvider Optional configuration provider. Defaults to defaultRuntimeConfigurationProvider if not specified.
|
|
25
52
|
* @returns The cluster category from CLUSTER_CATEGORY env var, defaults to 'prod'.
|
|
53
|
+
* @deprecated Use RuntimeConfiguration.clusterCategory instead.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // Before:
|
|
57
|
+
* import { getClusterCategory } from '@microsoft/agents-a365-runtime';
|
|
58
|
+
* const cluster = getClusterCategory();
|
|
59
|
+
*
|
|
60
|
+
* // After:
|
|
61
|
+
* import { defaultRuntimeConfigurationProvider } from '@microsoft/agents-a365-runtime';
|
|
62
|
+
* const cluster = defaultRuntimeConfigurationProvider.getConfiguration().clusterCategory;
|
|
26
63
|
*/
|
|
27
|
-
export declare function getClusterCategory(): string;
|
|
64
|
+
export declare function getClusterCategory(configProvider?: IConfigurationProvider<RuntimeConfiguration>): string;
|
|
28
65
|
/**
|
|
29
66
|
* Returns true if the current environment is a development environment.
|
|
30
67
|
*
|
|
68
|
+
* @param configProvider Optional configuration provider. Defaults to defaultRuntimeConfigurationProvider if not specified.
|
|
31
69
|
* @returns True if the current environment is development, false otherwise.
|
|
70
|
+
* @deprecated Use RuntimeConfiguration.isDevelopmentEnvironment instead.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* // Before:
|
|
74
|
+
* import { isDevelopmentEnvironment } from '@microsoft/agents-a365-runtime';
|
|
75
|
+
* if (isDevelopmentEnvironment()) { ... }
|
|
76
|
+
*
|
|
77
|
+
* // After:
|
|
78
|
+
* import { defaultRuntimeConfigurationProvider } from '@microsoft/agents-a365-runtime';
|
|
79
|
+
* if (defaultRuntimeConfigurationProvider.getConfiguration().isDevelopmentEnvironment) { ... }
|
|
32
80
|
*/
|
|
33
|
-
export declare function isDevelopmentEnvironment(): boolean;
|
|
81
|
+
export declare function isDevelopmentEnvironment(configProvider?: IConfigurationProvider<RuntimeConfiguration>): boolean;
|
|
34
82
|
/**
|
|
35
|
-
* Gets the MCP platform authentication scope
|
|
83
|
+
* Gets the MCP platform authentication scope.
|
|
84
|
+
*
|
|
85
|
+
* @returns The MCP platform authentication scope.
|
|
86
|
+
* @deprecated Use ToolingConfiguration.mcpPlatformAuthenticationScope instead.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* // Before:
|
|
90
|
+
* import { getMcpPlatformAuthenticationScope } from '@microsoft/agents-a365-runtime';
|
|
91
|
+
* const scope = getMcpPlatformAuthenticationScope();
|
|
36
92
|
*
|
|
37
|
-
*
|
|
93
|
+
* // After:
|
|
94
|
+
* import { defaultToolingConfigurationProvider } from '@microsoft/agents-a365-tooling';
|
|
95
|
+
* const scope = defaultToolingConfigurationProvider.getConfiguration().mcpPlatformAuthenticationScope;
|
|
38
96
|
*/
|
|
39
97
|
export declare function getMcpPlatformAuthenticationScope(): string;
|
|
40
98
|
//# sourceMappingURL=environment-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-utils.d.ts","sourceRoot":"","sources":["../../src/environment-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"environment-utils.d.ts","sourceRoot":"","sources":["../../src/environment-utils.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EAAE,oBAAoB,EAAuC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,2CAA2C,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,sCAAsC,kDAAkD,CAAC;AAEtG;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,SAAS,CAAC;AAG1D,eAAO,MAAM,2BAA2B,eAAe,CAAC;AACxD,eAAO,MAAM,4BAA4B,gBAAgB,CAAC;AAE1D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,EAAE,CAI9D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,cAAc,CAAC,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,GAC5D,MAAM,CAGR;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CACtC,cAAc,CAAC,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,GAC5D,OAAO,CAGT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iCAAiC,IAAI,MAAM,CAI1D"}
|