@microsoft/agents-a365-runtime 0.1.0-preview.103

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.
Files changed (107) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +33 -0
  3. package/dist/cjs/agentic-authorization-service.d.ts +28 -0
  4. package/dist/cjs/agentic-authorization-service.d.ts.map +1 -0
  5. package/dist/cjs/agentic-authorization-service.js +18 -0
  6. package/dist/cjs/agentic-authorization-service.js.map +1 -0
  7. package/dist/cjs/configuration/DefaultConfigurationProvider.d.ts +39 -0
  8. package/dist/cjs/configuration/DefaultConfigurationProvider.d.ts.map +1 -0
  9. package/dist/cjs/configuration/DefaultConfigurationProvider.js +47 -0
  10. package/dist/cjs/configuration/DefaultConfigurationProvider.js.map +1 -0
  11. package/dist/cjs/configuration/IConfigurationProvider.d.ts +8 -0
  12. package/dist/cjs/configuration/IConfigurationProvider.d.ts.map +1 -0
  13. package/dist/cjs/configuration/IConfigurationProvider.js +5 -0
  14. package/dist/cjs/configuration/IConfigurationProvider.js.map +1 -0
  15. package/dist/cjs/configuration/RuntimeConfiguration.d.ts +35 -0
  16. package/dist/cjs/configuration/RuntimeConfiguration.d.ts.map +1 -0
  17. package/dist/cjs/configuration/RuntimeConfiguration.js +71 -0
  18. package/dist/cjs/configuration/RuntimeConfiguration.js.map +1 -0
  19. package/dist/cjs/configuration/RuntimeConfigurationOptions.d.ts +35 -0
  20. package/dist/cjs/configuration/RuntimeConfigurationOptions.d.ts.map +1 -0
  21. package/dist/cjs/configuration/RuntimeConfigurationOptions.js +5 -0
  22. package/dist/cjs/configuration/RuntimeConfigurationOptions.js.map +1 -0
  23. package/dist/cjs/configuration/index.d.ts +5 -0
  24. package/dist/cjs/configuration/index.d.ts.map +1 -0
  25. package/dist/cjs/configuration/index.js +23 -0
  26. package/dist/cjs/configuration/index.js.map +1 -0
  27. package/dist/cjs/environment-utils.d.ts +98 -0
  28. package/dist/cjs/environment-utils.d.ts.map +1 -0
  29. package/dist/cjs/environment-utils.js +121 -0
  30. package/dist/cjs/environment-utils.js.map +1 -0
  31. package/dist/cjs/index.d.ts +8 -0
  32. package/dist/cjs/index.d.ts.map +1 -0
  33. package/dist/cjs/index.js +26 -0
  34. package/dist/cjs/index.js.map +1 -0
  35. package/dist/cjs/operation-error.d.ts +24 -0
  36. package/dist/cjs/operation-error.d.ts.map +1 -0
  37. package/dist/cjs/operation-error.js +35 -0
  38. package/dist/cjs/operation-error.js.map +1 -0
  39. package/dist/cjs/operation-result.d.ts +41 -0
  40. package/dist/cjs/operation-result.d.ts.map +1 -0
  41. package/dist/cjs/operation-result.js +56 -0
  42. package/dist/cjs/operation-result.js.map +1 -0
  43. package/dist/cjs/power-platform-api-discovery.d.ts +30 -0
  44. package/dist/cjs/power-platform-api-discovery.d.ts.map +1 -0
  45. package/dist/cjs/power-platform-api-discovery.js +86 -0
  46. package/dist/cjs/power-platform-api-discovery.js.map +1 -0
  47. package/dist/cjs/utility.d.ts +73 -0
  48. package/dist/cjs/utility.d.ts.map +1 -0
  49. package/dist/cjs/utility.js +187 -0
  50. package/dist/cjs/utility.js.map +1 -0
  51. package/dist/cjs/version.d.ts +2 -0
  52. package/dist/cjs/version.d.ts.map +1 -0
  53. package/dist/cjs/version.js +5 -0
  54. package/dist/cjs/version.js.map +1 -0
  55. package/dist/esm/agentic-authorization-service.d.ts +28 -0
  56. package/dist/esm/agentic-authorization-service.d.ts.map +1 -0
  57. package/dist/esm/agentic-authorization-service.js +14 -0
  58. package/dist/esm/agentic-authorization-service.js.map +1 -0
  59. package/dist/esm/configuration/DefaultConfigurationProvider.d.ts +39 -0
  60. package/dist/esm/configuration/DefaultConfigurationProvider.d.ts.map +1 -0
  61. package/dist/esm/configuration/DefaultConfigurationProvider.js +43 -0
  62. package/dist/esm/configuration/DefaultConfigurationProvider.js.map +1 -0
  63. package/dist/esm/configuration/IConfigurationProvider.d.ts +8 -0
  64. package/dist/esm/configuration/IConfigurationProvider.d.ts.map +1 -0
  65. package/dist/esm/configuration/IConfigurationProvider.js +4 -0
  66. package/dist/esm/configuration/IConfigurationProvider.js.map +1 -0
  67. package/dist/esm/configuration/RuntimeConfiguration.d.ts +35 -0
  68. package/dist/esm/configuration/RuntimeConfiguration.d.ts.map +1 -0
  69. package/dist/esm/configuration/RuntimeConfiguration.js +67 -0
  70. package/dist/esm/configuration/RuntimeConfiguration.js.map +1 -0
  71. package/dist/esm/configuration/RuntimeConfigurationOptions.d.ts +35 -0
  72. package/dist/esm/configuration/RuntimeConfigurationOptions.d.ts.map +1 -0
  73. package/dist/esm/configuration/RuntimeConfigurationOptions.js +4 -0
  74. package/dist/esm/configuration/RuntimeConfigurationOptions.js.map +1 -0
  75. package/dist/esm/configuration/index.d.ts +5 -0
  76. package/dist/esm/configuration/index.d.ts.map +1 -0
  77. package/dist/esm/configuration/index.js +7 -0
  78. package/dist/esm/configuration/index.js.map +1 -0
  79. package/dist/esm/environment-utils.d.ts +98 -0
  80. package/dist/esm/environment-utils.d.ts.map +1 -0
  81. package/dist/esm/environment-utils.js +114 -0
  82. package/dist/esm/environment-utils.js.map +1 -0
  83. package/dist/esm/index.d.ts +8 -0
  84. package/dist/esm/index.d.ts.map +1 -0
  85. package/dist/esm/index.js +10 -0
  86. package/dist/esm/index.js.map +1 -0
  87. package/dist/esm/operation-error.d.ts +24 -0
  88. package/dist/esm/operation-error.d.ts.map +1 -0
  89. package/dist/esm/operation-error.js +31 -0
  90. package/dist/esm/operation-error.js.map +1 -0
  91. package/dist/esm/operation-result.d.ts +41 -0
  92. package/dist/esm/operation-result.d.ts.map +1 -0
  93. package/dist/esm/operation-result.js +52 -0
  94. package/dist/esm/operation-result.js.map +1 -0
  95. package/dist/esm/power-platform-api-discovery.d.ts +30 -0
  96. package/dist/esm/power-platform-api-discovery.d.ts.map +1 -0
  97. package/dist/esm/power-platform-api-discovery.js +82 -0
  98. package/dist/esm/power-platform-api-discovery.js.map +1 -0
  99. package/dist/esm/utility.d.ts +73 -0
  100. package/dist/esm/utility.d.ts.map +1 -0
  101. package/dist/esm/utility.js +147 -0
  102. package/dist/esm/utility.js.map +1 -0
  103. package/dist/esm/version.d.ts +2 -0
  104. package/dist/esm/version.d.ts.map +1 -0
  105. package/dist/esm/version.js +2 -0
  106. package/dist/esm/version.js.map +1 -0
  107. package/package.json +63 -0
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Microsoft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # @microsoft/agents-a365-runtime
2
+
3
+ [![npm](https://img.shields.io/npm/v/@microsoft/agents-a365-runtime?label=npm&logo=npm)](https://www.npmjs.com/package/@microsoft/agents-a365-runtime)
4
+ [![npm Downloads](https://img.shields.io/npm/dm/@microsoft/agents-a365-runtime?label=Downloads&logo=npm)](https://www.npmjs.com/package/@microsoft/agents-a365-runtime)
5
+
6
+ Core runtime utilities and services for applications built with the Microsoft Agent 365 SDK. This package provides authentication, authorization, and Power Platform API discovery capabilities for building enterprise-ready AI agents.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @microsoft/agents-a365-runtime
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ For detailed usage examples and implementation guidance, see the [Microsoft Agent 365 Developer Documentation](https://learn.microsoft.com/microsoft-agent-365/developer/?tabs=nodejs).
17
+
18
+ ## Support
19
+
20
+ For issues, questions, or feedback:
21
+
22
+ - File issues in the [GitHub Issues](https://github.com/microsoft/Agent365-nodejs/issues) section
23
+ - See the [main documentation](../../README.md) for more information
24
+
25
+ ## Trademarks
26
+
27
+ *Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.*
28
+
29
+ ## License
30
+
31
+ Copyright (c) Microsoft Corporation. All rights reserved.
32
+
33
+ Licensed under the MIT License - see the [LICENSE](../../LICENSE.md) file for details
@@ -0,0 +1,28 @@
1
+ import { TurnContext, Authorization } from '@microsoft/agents-hosting';
2
+ /**
3
+ * Service for handling agentic user authentication.
4
+ */
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
+ */
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>;
27
+ }
28
+ //# sourceMappingURL=agentic-authorization-service.d.ts.map
@@ -0,0 +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;;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"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.AgenticAuthenticationService = void 0;
6
+ const environment_utils_1 = require("./environment-utils");
7
+ /**
8
+ * Service for handling agentic user authentication.
9
+ */
10
+ class AgenticAuthenticationService {
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 || '';
15
+ }
16
+ }
17
+ exports.AgenticAuthenticationService = AgenticAuthenticationService;
18
+ //# sourceMappingURL=agentic-authorization-service.js.map
@@ -0,0 +1 @@
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,8 @@
1
+ /**
2
+ * Generic interface for providing configuration.
3
+ * Each package defines its own configuration type T.
4
+ */
5
+ export interface IConfigurationProvider<T> {
6
+ getConfiguration(): T;
7
+ }
8
+ //# sourceMappingURL=IConfigurationProvider.d.ts.map
@@ -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,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=IConfigurationProvider.js.map
@@ -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,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=RuntimeConfigurationOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuntimeConfigurationOptions.js","sourceRoot":"","sources":["../../../src/configuration/RuntimeConfigurationOptions.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC"}
@@ -0,0 +1,5 @@
1
+ export * from './IConfigurationProvider';
2
+ export * from './RuntimeConfigurationOptions';
3
+ export * from './RuntimeConfiguration';
4
+ export * from './DefaultConfigurationProvider';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -0,0 +1,98 @@
1
+ /**
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.
16
+ */
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
+ */
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
+ */
29
+ export declare const PROD_OBSERVABILITY_CLUSTER_CATEGORY = "prod";
30
+ export declare const PRODUCTION_ENVIRONMENT_NAME = "production";
31
+ export declare const DEVELOPMENT_ENVIRONMENT_NAME = "Development";
32
+ /**
33
+ * Returns the scope for authenticating to the observability service.
34
+ *
35
+ * @returns The authentication scopes for the current environment.
36
+ * @deprecated Use ObservabilityConfiguration.observabilityAuthenticationScopes instead.
37
+ *
38
+ * @example
39
+ * // Before:
40
+ * import { getObservabilityAuthenticationScope } from '@microsoft/agents-a365-runtime';
41
+ * const scopes = getObservabilityAuthenticationScope();
42
+ *
43
+ * // After:
44
+ * import { defaultObservabilityConfigurationProvider } from '@microsoft/agents-a365-observability';
45
+ * const scopes = [...defaultObservabilityConfigurationProvider.getConfiguration().observabilityAuthenticationScopes];
46
+ */
47
+ export declare function getObservabilityAuthenticationScope(): string[];
48
+ /**
49
+ * Gets the cluster category from environment variables.
50
+ *
51
+ * @param configProvider Optional configuration provider. Defaults to defaultRuntimeConfigurationProvider if not specified.
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;
63
+ */
64
+ export declare function getClusterCategory(configProvider?: IConfigurationProvider<RuntimeConfiguration>): string;
65
+ /**
66
+ * Returns true if the current environment is a development environment.
67
+ *
68
+ * @param configProvider Optional configuration provider. Defaults to defaultRuntimeConfigurationProvider if not specified.
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) { ... }
80
+ */
81
+ export declare function isDevelopmentEnvironment(configProvider?: IConfigurationProvider<RuntimeConfiguration>): boolean;
82
+ /**
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();
92
+ *
93
+ * // After:
94
+ * import { defaultToolingConfigurationProvider } from '@microsoft/agents-a365-tooling';
95
+ * const scope = defaultToolingConfigurationProvider.getConfiguration().mcpPlatformAuthenticationScope;
96
+ */
97
+ export declare function getMcpPlatformAuthenticationScope(): string;
98
+ //# sourceMappingURL=environment-utils.d.ts.map
@@ -0,0 +1 @@
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"}