@microsoft/agents-a365-runtime 0.1.0-preview.95 → 0.2.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/cjs/agentic-authorization-service.d.ts +23 -0
  2. package/dist/cjs/agentic-authorization-service.d.ts.map +1 -1
  3. package/dist/cjs/agentic-authorization-service.js +7 -3
  4. package/dist/cjs/agentic-authorization-service.js.map +1 -1
  5. package/dist/cjs/configuration/DefaultConfigurationProvider.d.ts +39 -0
  6. package/dist/cjs/configuration/DefaultConfigurationProvider.d.ts.map +1 -0
  7. package/dist/cjs/configuration/DefaultConfigurationProvider.js +47 -0
  8. package/dist/cjs/configuration/DefaultConfigurationProvider.js.map +1 -0
  9. package/dist/cjs/configuration/IConfigurationProvider.d.ts +8 -0
  10. package/dist/cjs/configuration/IConfigurationProvider.d.ts.map +1 -0
  11. package/dist/cjs/configuration/IConfigurationProvider.js +5 -0
  12. package/dist/cjs/configuration/IConfigurationProvider.js.map +1 -0
  13. package/dist/cjs/configuration/RuntimeConfiguration.d.ts +35 -0
  14. package/dist/cjs/configuration/RuntimeConfiguration.d.ts.map +1 -0
  15. package/dist/cjs/configuration/RuntimeConfiguration.js +71 -0
  16. package/dist/cjs/configuration/RuntimeConfiguration.js.map +1 -0
  17. package/dist/cjs/configuration/RuntimeConfigurationOptions.d.ts +35 -0
  18. package/dist/cjs/configuration/RuntimeConfigurationOptions.d.ts.map +1 -0
  19. package/dist/cjs/configuration/RuntimeConfigurationOptions.js +5 -0
  20. package/dist/cjs/configuration/RuntimeConfigurationOptions.js.map +1 -0
  21. package/dist/cjs/configuration/index.d.ts +5 -0
  22. package/dist/cjs/configuration/index.d.ts.map +1 -0
  23. package/dist/cjs/configuration/index.js +23 -0
  24. package/dist/cjs/configuration/index.js.map +1 -0
  25. package/dist/cjs/environment-utils.d.ts +69 -11
  26. package/dist/cjs/environment-utils.d.ts.map +1 -1
  27. package/dist/cjs/environment-utils.js +79 -26
  28. package/dist/cjs/environment-utils.js.map +1 -1
  29. package/dist/cjs/index.d.ts +2 -1
  30. package/dist/cjs/index.d.ts.map +1 -1
  31. package/dist/cjs/index.js +4 -1
  32. package/dist/cjs/index.js.map +1 -1
  33. package/dist/cjs/power-platform-api-discovery.d.ts +18 -1
  34. package/dist/cjs/power-platform-api-discovery.d.ts.map +1 -1
  35. package/dist/cjs/power-platform-api-discovery.js +22 -3
  36. package/dist/cjs/power-platform-api-discovery.js.map +1 -1
  37. package/dist/cjs/utility.d.ts +48 -1
  38. package/dist/cjs/utility.d.ts.map +1 -1
  39. package/dist/cjs/utility.js +91 -1
  40. package/dist/cjs/utility.js.map +1 -1
  41. package/dist/cjs/version.d.ts +1 -1
  42. package/dist/cjs/version.d.ts.map +1 -1
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/cjs/version.js.map +1 -1
  45. package/dist/esm/agentic-authorization-service.d.ts +23 -0
  46. package/dist/esm/agentic-authorization-service.d.ts.map +1 -1
  47. package/dist/esm/agentic-authorization-service.js +8 -4
  48. package/dist/esm/agentic-authorization-service.js.map +1 -1
  49. package/dist/esm/configuration/DefaultConfigurationProvider.d.ts +39 -0
  50. package/dist/esm/configuration/DefaultConfigurationProvider.d.ts.map +1 -0
  51. package/dist/esm/configuration/DefaultConfigurationProvider.js +43 -0
  52. package/dist/esm/configuration/DefaultConfigurationProvider.js.map +1 -0
  53. package/dist/esm/configuration/IConfigurationProvider.d.ts +8 -0
  54. package/dist/esm/configuration/IConfigurationProvider.d.ts.map +1 -0
  55. package/dist/esm/configuration/IConfigurationProvider.js +4 -0
  56. package/dist/esm/configuration/IConfigurationProvider.js.map +1 -0
  57. package/dist/esm/configuration/RuntimeConfiguration.d.ts +35 -0
  58. package/dist/esm/configuration/RuntimeConfiguration.d.ts.map +1 -0
  59. package/dist/esm/configuration/RuntimeConfiguration.js +67 -0
  60. package/dist/esm/configuration/RuntimeConfiguration.js.map +1 -0
  61. package/dist/esm/configuration/RuntimeConfigurationOptions.d.ts +35 -0
  62. package/dist/esm/configuration/RuntimeConfigurationOptions.d.ts.map +1 -0
  63. package/dist/esm/configuration/RuntimeConfigurationOptions.js +4 -0
  64. package/dist/esm/configuration/RuntimeConfigurationOptions.js.map +1 -0
  65. package/dist/esm/configuration/index.d.ts +5 -0
  66. package/dist/esm/configuration/index.d.ts.map +1 -0
  67. package/dist/esm/configuration/index.js +7 -0
  68. package/dist/esm/configuration/index.js.map +1 -0
  69. package/dist/esm/environment-utils.d.ts +69 -11
  70. package/dist/esm/environment-utils.d.ts.map +1 -1
  71. package/dist/esm/environment-utils.js +79 -26
  72. package/dist/esm/environment-utils.js.map +1 -1
  73. package/dist/esm/index.d.ts +2 -1
  74. package/dist/esm/index.d.ts.map +1 -1
  75. package/dist/esm/index.js +4 -1
  76. package/dist/esm/index.js.map +1 -1
  77. package/dist/esm/power-platform-api-discovery.d.ts +18 -1
  78. package/dist/esm/power-platform-api-discovery.d.ts.map +1 -1
  79. package/dist/esm/power-platform-api-discovery.js +21 -2
  80. package/dist/esm/power-platform-api-discovery.js.map +1 -1
  81. package/dist/esm/utility.d.ts +48 -1
  82. package/dist/esm/utility.d.ts.map +1 -1
  83. package/dist/esm/utility.js +91 -1
  84. package/dist/esm/utility.js.map +1 -1
  85. package/dist/esm/version.d.ts +1 -1
  86. package/dist/esm/version.d.ts.map +1 -1
  87. package/dist/esm/version.js +1 -1
  88. package/dist/esm/version.js.map +1 -1
  89. package/package.json +2 -2
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
- // ------------------------------------------------------------------------------
3
- // Copyright (c) Microsoft Corporation. All rights reserved.
4
- // ------------------------------------------------------------------------------
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
5
4
  Object.defineProperty(exports, "__esModule", { value: true });
6
5
  exports.DEVELOPMENT_ENVIRONMENT_NAME = exports.PRODUCTION_ENVIRONMENT_NAME = exports.PROD_OBSERVABILITY_CLUSTER_CATEGORY = exports.PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE = exports.PROD_OBSERVABILITY_SCOPE = void 0;
7
6
  exports.getObservabilityAuthenticationScope = getObservabilityAuthenticationScope;
@@ -10,59 +9,113 @@ exports.isDevelopmentEnvironment = isDevelopmentEnvironment;
10
9
  exports.getMcpPlatformAuthenticationScope = getMcpPlatformAuthenticationScope;
11
10
  /**
12
11
  * Utility logic for environment-related operations.
12
+ *
13
+ * Note: These utility functions are maintained for backward compatibility.
14
+ * For new code, prefer using the configuration classes directly:
15
+ * - RuntimeConfiguration for clusterCategory, isDevelopmentEnvironment, isNodeEnvDevelopment
16
+ * - ToolingConfiguration for mcpPlatformAuthenticationScope
17
+ * - ObservabilityConfiguration for observabilityAuthenticationScopes
18
+ */
19
+ const configuration_1 = require("./configuration");
20
+ /**
21
+ * Production observability authentication scope.
22
+ * @deprecated This constant is exported for backward compatibility only.
23
+ * For new code, use `ObservabilityConfiguration.observabilityAuthenticationScopes` instead.
13
24
  */
14
25
  exports.PROD_OBSERVABILITY_SCOPE = 'https://api.powerplatform.com/.default';
26
+ /**
27
+ * Production MCP platform authentication scope.
28
+ * @deprecated This constant is exported for backward compatibility only.
29
+ * For new code, use `ToolingConfiguration.mcpPlatformAuthenticationScope` instead.
30
+ */
15
31
  exports.PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE = 'ea9ffc3e-8a23-4a7d-836d-234d7c7565c1/.default';
32
+ /**
33
+ * Default cluster category for production environments.
34
+ * @deprecated This constant is exported for backward compatibility only.
35
+ * For new code, use `RuntimeConfiguration.clusterCategory` instead.
36
+ */
16
37
  exports.PROD_OBSERVABILITY_CLUSTER_CATEGORY = 'prod';
17
38
  // Default environment names
18
39
  exports.PRODUCTION_ENVIRONMENT_NAME = 'production';
19
40
  exports.DEVELOPMENT_ENVIRONMENT_NAME = 'Development';
20
41
  /**
21
- * Returns the scope for authenticating to the observability service
42
+ * Returns the scope for authenticating to the observability service.
22
43
  *
23
- * The default is the production observability scope, but this can be overridden
24
- * for internal development and testing scenarios using the
25
- * `A365_OBSERVABILITY_SCOPES_OVERRIDE` environment variable.
44
+ * @returns The authentication scopes for the current environment.
45
+ * @deprecated Use ObservabilityConfiguration.observabilityAuthenticationScopes instead.
26
46
  *
27
- * When the override is set to a non-empty string, it is split on whitespace
28
- * into individual scopes.
47
+ * @example
48
+ * // Before:
49
+ * import { getObservabilityAuthenticationScope } from '@microsoft/agents-a365-runtime';
50
+ * const scopes = getObservabilityAuthenticationScope();
29
51
  *
30
- * @returns The authentication scopes for the current environment.
52
+ * // After:
53
+ * import { defaultObservabilityConfigurationProvider } from '@microsoft/agents-a365-observability';
54
+ * const scopes = [...defaultObservabilityConfigurationProvider.getConfiguration().observabilityAuthenticationScopes];
31
55
  */
32
56
  function getObservabilityAuthenticationScope() {
33
- const override = process.env.A365_OBSERVABILITY_SCOPES_OVERRIDE;
34
- if (override && override.trim().length > 0) {
35
- return override.trim().split(/\s+/);
36
- }
57
+ // Returns production default - use ObservabilityConfiguration for proper env var support
58
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- Intentional: deprecated function using deprecated constant
37
59
  return [exports.PROD_OBSERVABILITY_SCOPE];
38
60
  }
39
61
  /**
40
62
  * Gets the cluster category from environment variables.
41
63
  *
64
+ * @param configProvider Optional configuration provider. Defaults to defaultRuntimeConfigurationProvider if not specified.
42
65
  * @returns The cluster category from CLUSTER_CATEGORY env var, defaults to 'prod'.
66
+ * @deprecated Use RuntimeConfiguration.clusterCategory instead.
67
+ *
68
+ * @example
69
+ * // Before:
70
+ * import { getClusterCategory } from '@microsoft/agents-a365-runtime';
71
+ * const cluster = getClusterCategory();
72
+ *
73
+ * // After:
74
+ * import { defaultRuntimeConfigurationProvider } from '@microsoft/agents-a365-runtime';
75
+ * const cluster = defaultRuntimeConfigurationProvider.getConfiguration().clusterCategory;
43
76
  */
44
- function getClusterCategory() {
45
- const clusterCategory = process.env.CLUSTER_CATEGORY;
46
- if (!clusterCategory) {
47
- return 'prod';
48
- }
49
- return clusterCategory.toLowerCase();
77
+ function getClusterCategory(configProvider) {
78
+ const provider = configProvider ?? configuration_1.defaultRuntimeConfigurationProvider;
79
+ return provider.getConfiguration().clusterCategory;
50
80
  }
51
81
  /**
52
82
  * Returns true if the current environment is a development environment.
53
83
  *
84
+ * @param configProvider Optional configuration provider. Defaults to defaultRuntimeConfigurationProvider if not specified.
54
85
  * @returns True if the current environment is development, false otherwise.
86
+ * @deprecated Use RuntimeConfiguration.isDevelopmentEnvironment instead.
87
+ *
88
+ * @example
89
+ * // Before:
90
+ * import { isDevelopmentEnvironment } from '@microsoft/agents-a365-runtime';
91
+ * if (isDevelopmentEnvironment()) { ... }
92
+ *
93
+ * // After:
94
+ * import { defaultRuntimeConfigurationProvider } from '@microsoft/agents-a365-runtime';
95
+ * if (defaultRuntimeConfigurationProvider.getConfiguration().isDevelopmentEnvironment) { ... }
55
96
  */
56
- function isDevelopmentEnvironment() {
57
- const clusterCategory = getClusterCategory();
58
- return ['local', 'dev'].includes(clusterCategory);
97
+ function isDevelopmentEnvironment(configProvider) {
98
+ const provider = configProvider ?? configuration_1.defaultRuntimeConfigurationProvider;
99
+ return provider.getConfiguration().isDevelopmentEnvironment;
59
100
  }
60
101
  /**
61
- * Gets the MCP platform authentication scope from environment variables.
102
+ * Gets the MCP platform authentication scope.
103
+ *
104
+ * @returns The MCP platform authentication scope.
105
+ * @deprecated Use ToolingConfiguration.mcpPlatformAuthenticationScope instead.
106
+ *
107
+ * @example
108
+ * // Before:
109
+ * import { getMcpPlatformAuthenticationScope } from '@microsoft/agents-a365-runtime';
110
+ * const scope = getMcpPlatformAuthenticationScope();
62
111
  *
63
- * @returns The MCP platform authentication scope from MCP_PLATFORM_AUTHENTICATION_SCOPE env var, defaults to production scope.
112
+ * // After:
113
+ * import { defaultToolingConfigurationProvider } from '@microsoft/agents-a365-tooling';
114
+ * const scope = defaultToolingConfigurationProvider.getConfiguration().mcpPlatformAuthenticationScope;
64
115
  */
65
116
  function getMcpPlatformAuthenticationScope() {
66
- return process.env.MCP_PLATFORM_AUTHENTICATION_SCOPE || exports.PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE;
117
+ // Returns production default - use ToolingConfiguration for proper env var support
118
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- Intentional: deprecated function using deprecated constant
119
+ return exports.PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE;
67
120
  }
68
121
  //# sourceMappingURL=environment-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"environment-utils.js","sourceRoot":"","sources":["../../src/environment-utils.ts"],"names":[],"mappings":";AAAA,iFAAiF;AACjF,4DAA4D;AAC5D,iFAAiF;;;AA0BjF,kFAQC;AAOD,gDAQC;AAOD,4DAGC;AAOD,8EAEC;AAlED;;GAEG;AAEU,QAAA,wBAAwB,GAAG,wCAAwC,CAAC;AACpE,QAAA,sCAAsC,GAAG,+CAA+C,CAAC;AACzF,QAAA,mCAAmC,GAAG,MAAM,CAAC;AAE1D,4BAA4B;AACf,QAAA,2BAA2B,GAAG,YAAY,CAAC;AAC3C,QAAA,4BAA4B,GAAG,aAAa,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,SAAgB,mCAAmC;IACjD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC;IAEhE,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3C,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,CAAC,gCAAwB,CAAC,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB;IAChC,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAErD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC;AACv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AwB,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,iCAAiC;IAC/C,mFAAmF;IACnF,0HAA0H;IAC1H,OAAO,8CAAsC,CAAC;AAChD,CAAC"}
@@ -1,7 +1,8 @@
1
1
  export * from './power-platform-api-discovery';
2
- export * from './agentic-authorization-service';
3
2
  export * from './environment-utils';
4
3
  export * from './utility';
4
+ export * from './agentic-authorization-service';
5
5
  export * from './operation-error';
6
6
  export * from './operation-result';
7
+ export * from './configuration';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
2
4
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
5
  if (k2 === undefined) k2 = k;
4
6
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -15,9 +17,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
17
  };
16
18
  Object.defineProperty(exports, "__esModule", { value: true });
17
19
  __exportStar(require("./power-platform-api-discovery"), exports);
18
- __exportStar(require("./agentic-authorization-service"), exports);
19
20
  __exportStar(require("./environment-utils"), exports);
20
21
  __exportStar(require("./utility"), exports);
22
+ __exportStar(require("./agentic-authorization-service"), exports);
21
23
  __exportStar(require("./operation-error"), exports);
22
24
  __exportStar(require("./operation-result"), exports);
25
+ __exportStar(require("./configuration"), exports);
23
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,kEAAgD;AAChD,sDAAoC;AACpC,4CAA0B;AAC1B,oDAAkC;AAClC,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;AAElC,iEAA+C;AAC/C,sDAAoC;AACpC,4CAA0B;AAC1B,kEAAgD;AAChD,oDAAkC;AAClC,qDAAmC;AACnC,kDAAgC"}
@@ -1,4 +1,21 @@
1
- export type ClusterCategory = 'local' | 'dev' | 'test' | 'preprod' | 'firstrelease' | 'prod' | 'gov' | 'high' | 'dod' | 'mooncake' | 'ex' | 'rx';
1
+ /**
2
+ * Cluster categories for Power Platform API discovery.
3
+ * String enum provides both compile-time type safety and runtime validation.
4
+ */
5
+ export declare enum ClusterCategory {
6
+ local = "local",
7
+ dev = "dev",
8
+ test = "test",
9
+ preprod = "preprod",
10
+ firstrelease = "firstrelease",
11
+ prod = "prod",
12
+ gov = "gov",
13
+ high = "high",
14
+ dod = "dod",
15
+ mooncake = "mooncake",
16
+ ex = "ex",
17
+ rx = "rx"
18
+ }
2
19
  export declare class PowerPlatformApiDiscovery {
3
20
  readonly clusterCategory: ClusterCategory;
4
21
  constructor(clusterCategory: ClusterCategory);
@@ -1 +1 @@
1
- {"version":3,"file":"power-platform-api-discovery.d.ts","sourceRoot":"","sources":["../../src/power-platform-api-discovery.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,KAAK,GACL,MAAM,GACN,SAAS,GACT,cAAc,GACd,MAAM,GACN,KAAK,GACL,MAAM,GACN,KAAK,GACL,UAAU,GACV,IAAI,GACJ,IAAI,CAAC;AAET,qBAAa,yBAAyB;IACpC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;gBAE9B,eAAe,EAAE,eAAe;IAIrC,gBAAgB,IAAI,MAAM;IAI1B,oBAAoB,IAAI,MAAM;IAI9B,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI3C,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI/D,OAAO,CAAC,+BAA+B;IAkCvC,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,gCAAgC;CAuBzC"}
1
+ {"version":3,"file":"power-platform-api-discovery.d.ts","sourceRoot":"","sources":["../../src/power-platform-api-discovery.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,EAAE,OAAO;IACT,EAAE,OAAO;CACV;AAED,qBAAa,yBAAyB;IACpC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;gBAE9B,eAAe,EAAE,eAAe;IAIrC,gBAAgB,IAAI,MAAM;IAI1B,oBAAoB,IAAI,MAAM;IAI9B,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI3C,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI/D,OAAO,CAAC,+BAA+B;IAkCvC,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,gCAAgC;CAuBzC"}
@@ -1,6 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PowerPlatformApiDiscovery = void 0;
3
+ exports.PowerPlatformApiDiscovery = exports.ClusterCategory = void 0;
4
+ /**
5
+ * Cluster categories for Power Platform API discovery.
6
+ * String enum provides both compile-time type safety and runtime validation.
7
+ */
8
+ var ClusterCategory;
9
+ (function (ClusterCategory) {
10
+ ClusterCategory["local"] = "local";
11
+ ClusterCategory["dev"] = "dev";
12
+ ClusterCategory["test"] = "test";
13
+ ClusterCategory["preprod"] = "preprod";
14
+ ClusterCategory["firstrelease"] = "firstrelease";
15
+ ClusterCategory["prod"] = "prod";
16
+ ClusterCategory["gov"] = "gov";
17
+ ClusterCategory["high"] = "high";
18
+ ClusterCategory["dod"] = "dod";
19
+ ClusterCategory["mooncake"] = "mooncake";
20
+ ClusterCategory["ex"] = "ex";
21
+ ClusterCategory["rx"] = "rx";
22
+ })(ClusterCategory || (exports.ClusterCategory = ClusterCategory = {}));
4
23
  class PowerPlatformApiDiscovery {
5
24
  constructor(clusterCategory) {
6
25
  this.clusterCategory = clusterCategory;
@@ -34,8 +53,8 @@ class PowerPlatformApiDiscovery {
34
53
  }
35
54
  _getHexApiSuffixLength() {
36
55
  switch (this.clusterCategory) {
37
- case 'firstrelease':
38
- case 'prod':
56
+ case ClusterCategory.firstrelease:
57
+ case ClusterCategory.prod:
39
58
  return 2;
40
59
  default:
41
60
  return 1;
@@ -1 +1 @@
1
- {"version":3,"file":"power-platform-api-discovery.js","sourceRoot":"","sources":["../../src/power-platform-api-discovery.ts"],"names":[],"mappings":";;;AAcA,MAAa,yBAAyB;IAGpC,YAAY,eAAgC;QAC1C,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAEM,gBAAgB;QACrB,OAAO,WAAW,IAAI,CAAC,gCAAgC,EAAE,EAAE,CAAC;IAC9D,CAAC;IAEM,oBAAoB;QACzB,OAAO,IAAI,CAAC,gCAAgC,EAAE,CAAC;IACjD,CAAC;IAEM,iBAAiB,CAAC,QAAgB;QACvC,OAAO,IAAI,CAA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AAC;IAEO,gCAAgC;QACtC,MAAM,oBAAoB,GAA8C;YACtE,KAAK,EAAE,6BAA6B;YACpC,GAAG,EAAE,uBAAuB,EAAE,iBAAiB;YAC/C,IAAI,EAAE,uBAAuB,EAAE,iBAAiB;YAChD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB;YACnD,YAAY,EAAE,uBAAuB;YACrC,IAAI,EAAE,uBAAuB;YAC7B,GAAG,EAAE,oCAAoC;YACzC,IAAI,EAAE,qCAAqC;YAC3C,GAAG,EAAE,qBAAqB;YAC1B,QAAQ,EAAE,8CAA8C;YACxD,EAAE,EAAE,iCAAiC;YACrC,EAAE,EAAE,oCAAoC;SACzC,CAAC;QACF,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,kCAAkC,IAAI,CAAC,eAAe,EAAE,CACzD,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA1FD,8DA0FC"}
1
+ {"version":3,"file":"power-platform-api-discovery.js","sourceRoot":"","sources":["../../src/power-platform-api-discovery.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,8BAAW,CAAA;IACX,gCAAa,CAAA;IACb,sCAAmB,CAAA;IACnB,gDAA6B,CAAA;IAC7B,gCAAa,CAAA;IACb,8BAAW,CAAA;IACX,gCAAa,CAAA;IACb,8BAAW,CAAA;IACX,wCAAqB,CAAA;IACrB,4BAAS,CAAA;IACT,4BAAS,CAAA;AACX,CAAC,EAbW,eAAe,+BAAf,eAAe,QAa1B;AAED,MAAa,yBAAyB;IAGpC,YAAY,eAAgC;QAC1C,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAEM,gBAAgB;QACrB,OAAO,WAAW,IAAI,CAAC,gCAAgC,EAAE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Q,IAAI,CAAC,eAAe,EAAE,CAAC;YAC/B,KAAK,eAAe,CAAC,YAAY,CAAC;YAClC,KAAK,eAAe,CAAC,IAAI;gBACvB,OAAO,CAAC,CAAC;YACX;gBACE,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAEO,gCAAgC;QACtC,MAAM,oBAAoB,GAA8C;YACtE,KAAK,EAAE,6BAA6B;YACpC,GAAG,EAAE,uBAAuB,EAAE,iBAAiB;YAC/C,IAAI,EAAE,uBAAuB,EAAE,iBAAiB;YAChD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB;YACnD,YAAY,EAAE,uBAAuB;YACrC,IAAI,EAAE,uBAAuB;YAC7B,GAAG,EAAE,oCAAoC;YACzC,IAAI,EAAE,qCAAqC;YAC3C,GAAG,EAAE,qBAAqB;YAC1B,QAAQ,EAAE,8CAA8C;YACxD,EAAE,EAAE,iCAAiC;YACrC,EAAE,EAAE,oCAAoC;SACzC,CAAC;QACF,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,kCAAkC,IAAI,CAAC,eAAe,EAAE,CACzD,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA1FD,8DA0FC"}
@@ -3,12 +3,48 @@ import { TurnContext } from '@microsoft/agents-hosting';
3
3
  * Utility class providing helper methods for agent runtime operations.
4
4
  */
5
5
  export declare class Utility {
6
+ private static cachedPackageName;
6
7
  /**
8
+ * Reads the application name from package.json at module load time.
9
+ * This ensures file I/O happens during initialization, not during requests.
10
+ *
11
+ * Note: Uses process.cwd() which assumes the application is started from its root directory.
12
+ * This is a fallback mechanism - npm_package_name (checked first in getApplicationName) is
13
+ * the preferred source as it's reliably set by npm/pnpm when running package scripts.
14
+ */
15
+ private static initPackageName;
16
+ /**
17
+ * **WARNING: NO SIGNATURE VERIFICATION** - This method uses jwt.decode() which does NOT
18
+ * verify the token signature. The token claims can be spoofed by malicious actors.
19
+ * This method is ONLY suitable for logging, analytics, and diagnostics purposes.
20
+ * Do NOT use the returned value for authorization, access control, or security decisions.
21
+ *
7
22
  * Decodes the current token and retrieves the App ID (appid or azp claim).
23
+ *
24
+ * Note: Returns a default GUID ('00000000-0000-0000-0000-000000000000') for empty tokens
25
+ * for backward compatibility with callers that expect a valid-looking GUID.
26
+ * For agent identification where empty string is preferred, use {@link getAgentIdFromToken}.
27
+ *
8
28
  * @param token Token to Decode
9
- * @returns AppId
29
+ * @returns AppId, or default GUID for empty token, or empty string if decode fails
10
30
  */
11
31
  static GetAppIdFromToken(token: string): string;
32
+ /**
33
+ * **WARNING: NO SIGNATURE VERIFICATION** - This method uses jwt.decode() which does NOT
34
+ * verify the token signature. The token claims can be spoofed by malicious actors.
35
+ * This method is ONLY suitable for logging, analytics, and diagnostics purposes.
36
+ * Do NOT use the returned value for authorization, access control, or security decisions.
37
+ *
38
+ * Decodes the token and retrieves the best available agent identifier.
39
+ * Checks claims in priority order: xms_par_app_azp (agent blueprint ID) > appid > azp.
40
+ *
41
+ * Note: Returns empty string for empty/missing tokens (unlike {@link GetAppIdFromToken} which
42
+ * returns a default GUID). This allows callers to omit headers when no identifier is available.
43
+ *
44
+ * @param token JWT token to decode
45
+ * @returns Agent ID (GUID) or empty string if not found or token is empty
46
+ */
47
+ static getAgentIdFromToken(token: string): string;
12
48
  /**
13
49
  * Resolves the agent identity from the turn context or auth token.
14
50
  * @param context Turn Context of the turn.
@@ -22,5 +58,16 @@ export declare class Utility {
22
58
  * @returns Formatted User-Agent header string.
23
59
  */
24
60
  static GetUserAgentHeader(orchestrator?: string): string;
61
+ /**
62
+ * Gets the application name from npm_package_name environment variable or package.json.
63
+ * The package.json result is cached at module load time to avoid sync I/O during requests.
64
+ * @returns Application name or undefined if not available.
65
+ */
66
+ static getApplicationName(): string | undefined;
67
+ /**
68
+ * Resets the cached application name. Used for testing purposes.
69
+ * @internal
70
+ */
71
+ static resetApplicationNameCache(): void;
25
72
  }
26
73
  //# sourceMappingURL=utility.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../src/utility.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAMxD;;GAEG;AACH,qBAAa,OAAO;IAClB;;;;OAIG;WACW,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAoBtD;;;;;OAKG;WACW,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IASnF;;;;OAIG;WACW,kBAAkB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM;CAKhE"}
1
+ {"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../src/utility.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAQxD;;GAEG;AACH,qBAAa,OAAO;IAIlB,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA4C;IAE5E;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAW9B;;;;;;;;;;;;;;OAcG;WACW,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAoBtD;;;;;;;;;;;;;;OAcG;WACW,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAmBxD;;;;;OAKG;WACW,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IASnF;;;;OAIG;WACW,kBAAkB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM;IAM/D;;;;OAIG;WACW,kBAAkB,IAAI,MAAM,GAAG,SAAS;IAYtD;;;OAGG;WACW,yBAAyB,IAAI,IAAI;CAGhD"}
@@ -41,15 +41,47 @@ Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.Utility = void 0;
42
42
  const jwt = __importStar(require("jsonwebtoken"));
43
43
  const os_1 = __importDefault(require("os"));
44
+ const fs_1 = __importDefault(require("fs"));
45
+ const path_1 = __importDefault(require("path"));
44
46
  const version_1 = require("./version");
45
47
  /**
46
48
  * Utility class providing helper methods for agent runtime operations.
47
49
  */
48
50
  class Utility {
49
51
  /**
52
+ * Reads the application name from package.json at module load time.
53
+ * This ensures file I/O happens during initialization, not during requests.
54
+ *
55
+ * Note: Uses process.cwd() which assumes the application is started from its root directory.
56
+ * This is a fallback mechanism - npm_package_name (checked first in getApplicationName) is
57
+ * the preferred source as it's reliably set by npm/pnpm when running package scripts.
58
+ */
59
+ static initPackageName() {
60
+ try {
61
+ const packageJsonPath = path_1.default.resolve(process.cwd(), 'package.json');
62
+ const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'));
63
+ return packageJson.name || null;
64
+ }
65
+ catch {
66
+ // TODO: Add debug-level logging once a logger implementation is available
67
+ // to help troubleshoot package.json read failures in production environments
68
+ return null;
69
+ }
70
+ }
71
+ /**
72
+ * **WARNING: NO SIGNATURE VERIFICATION** - This method uses jwt.decode() which does NOT
73
+ * verify the token signature. The token claims can be spoofed by malicious actors.
74
+ * This method is ONLY suitable for logging, analytics, and diagnostics purposes.
75
+ * Do NOT use the returned value for authorization, access control, or security decisions.
76
+ *
50
77
  * Decodes the current token and retrieves the App ID (appid or azp claim).
78
+ *
79
+ * Note: Returns a default GUID ('00000000-0000-0000-0000-000000000000') for empty tokens
80
+ * for backward compatibility with callers that expect a valid-looking GUID.
81
+ * For agent identification where empty string is preferred, use {@link getAgentIdFromToken}.
82
+ *
51
83
  * @param token Token to Decode
52
- * @returns AppId
84
+ * @returns AppId, or default GUID for empty token, or empty string if decode fails
53
85
  */
54
86
  static GetAppIdFromToken(token) {
55
87
  if (!token || token.trim() === '') {
@@ -69,6 +101,38 @@ class Utility {
69
101
  return '';
70
102
  }
71
103
  }
104
+ /**
105
+ * **WARNING: NO SIGNATURE VERIFICATION** - This method uses jwt.decode() which does NOT
106
+ * verify the token signature. The token claims can be spoofed by malicious actors.
107
+ * This method is ONLY suitable for logging, analytics, and diagnostics purposes.
108
+ * Do NOT use the returned value for authorization, access control, or security decisions.
109
+ *
110
+ * Decodes the token and retrieves the best available agent identifier.
111
+ * Checks claims in priority order: xms_par_app_azp (agent blueprint ID) > appid > azp.
112
+ *
113
+ * Note: Returns empty string for empty/missing tokens (unlike {@link GetAppIdFromToken} which
114
+ * returns a default GUID). This allows callers to omit headers when no identifier is available.
115
+ *
116
+ * @param token JWT token to decode
117
+ * @returns Agent ID (GUID) or empty string if not found or token is empty
118
+ */
119
+ static getAgentIdFromToken(token) {
120
+ if (!token || token.trim() === '') {
121
+ return '';
122
+ }
123
+ try {
124
+ const decoded = jwt.decode(token);
125
+ if (!decoded) {
126
+ return '';
127
+ }
128
+ // Priority: xms_par_app_azp (agent blueprint ID) > appid > azp
129
+ return decoded['xms_par_app_azp'] || decoded['appid'] || decoded['azp'] || '';
130
+ }
131
+ catch (_error) {
132
+ // Silent error handling - return empty string on decode failure
133
+ return '';
134
+ }
135
+ }
72
136
  /**
73
137
  * Resolves the agent identity from the turn context or auth token.
74
138
  * @param context Turn Context of the turn.
@@ -92,6 +156,32 @@ class Utility {
92
156
  const orchestratorPart = orchestrator ? `; ${orchestrator}` : '';
93
157
  return `Agent365SDK/${version_1.LIB_VERSION} (${osType}; Node.js ${process.version}${orchestratorPart})`;
94
158
  }
159
+ /**
160
+ * Gets the application name from npm_package_name environment variable or package.json.
161
+ * The package.json result is cached at module load time to avoid sync I/O during requests.
162
+ * @returns Application name or undefined if not available.
163
+ */
164
+ static getApplicationName() {
165
+ // First try npm_package_name (set automatically by npm/pnpm when running scripts)
166
+ // eslint-disable-next-line no-restricted-properties -- npm_package_name is set by npm at runtime, not a configurable setting
167
+ if (process.env.npm_package_name) {
168
+ // eslint-disable-next-line no-restricted-properties -- npm_package_name is set by npm at runtime, not a configurable setting
169
+ return process.env.npm_package_name;
170
+ }
171
+ // Fall back to cached package.json name (read at module load time)
172
+ return this.cachedPackageName || undefined;
173
+ }
174
+ /**
175
+ * Resets the cached application name. Used for testing purposes.
176
+ * @internal
177
+ */
178
+ static resetApplicationNameCache() {
179
+ this.cachedPackageName = Utility.initPackageName();
180
+ }
95
181
  }
96
182
  exports.Utility = Utility;
183
+ // Cache for application name read from package.json
184
+ // null = checked but not found, string = found
185
+ // Eagerly initialized at module load time to avoid sync I/O during requests
186
+ Utility.cachedPackageName = Utility.initPackageName();
97
187
  //# sourceMappingURL=utility.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utility.js","sourceRoot":"","sources":["../../src/utility.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGlC,kDAAoC;AACpC,4CAAoB;AAEpB,uCAAwC;AAExC;;GAEG;AACH,MAAa,OAAO;IAClB;;;;OAIG;IACI,MAAM,CAAC,iBAAiB,CAAC,KAAa;QAC3C,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAClC,OAAO,sCAAsC,CAAC;QAChD,CAAC;QAED,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAmB,CAAC;YACpD,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,yDAAyD;YACzD,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;YACtD,OAAO,UAAU,IAAI,EAAE,CAAC;QAC1B,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YAChB,gEAAgE;YAChE,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,oBAAoB,CAAC,OAAoB,EAAE,SAAiB;QACxE,gDAAgD;QAChD,MAAM,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,OAAO,CAAC,QAAQ,CAAC,gBAAgB,EAAE;YACtD,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,EAAE,IAAI,EAAE;YAC/C,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAEtC,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,kBAAkB,CAAC,YAAqB;QACpD,MAAM,MAAM,GAAG,YAAE,CAAC,IAAI,EAAE,CAAC;QACzB,MAAM,gBAAgB,GAAG,YAAY,CAAC,CAAC,CAAC,KAAK,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjE,OAAO,eAAe,qBAAW,KAAK,MAAM,aAAa,OAAO,CAAC,OAAO,GAAG,gBAAgB,GAAG,CAAC;IACjG,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,kBAAkB;QAC9B,kFAAkF;QAClF,6HAA6H;QAC7H,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;YACjC,6HAA6H;YAC7H,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;QACtC,CAAC;QAED,mEAAmE;QACnE,OAAO,IAAI,CAAC,iBAAiB,IAAI,SAAS,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,yBAAyB;QACrC,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IACrD,CAAC;;AA/IH,0BAgJC;AA/IC,oDAAoD;AACpD,+CAA+C;AAC/C,4EAA4E;AAC7D,yBAAiB,GAAkB,OAAO,CAAC,eAAe,EAAE,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const LIB_VERSION = "0.1.0-preview.95";
1
+ export declare const LIB_VERSION = "0.2.0-preview.1";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,qBAAqB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,oBAAoB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LIB_VERSION = void 0;
4
- exports.LIB_VERSION = "0.1.0-preview.95";
4
+ exports.LIB_VERSION = "0.2.0-preview.1";
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,kBAAkB,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,iBAAiB,CAAC"}
@@ -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;WACnB,mBAAmB,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW;CAIxH"}
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"}
@@ -1,10 +1,14 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { getMcpPlatformAuthenticationScope } from './environment-utils';
3
+ import { PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE } from './environment-utils';
4
+ /**
5
+ * Service for handling agentic user authentication.
6
+ */
4
7
  export class AgenticAuthenticationService {
5
- static async GetAgenticUserToken(authorization, authHandlerName, turnContext) {
6
- const scope = getMcpPlatformAuthenticationScope();
7
- return (await authorization.exchangeToken(turnContext, authHandlerName, { scopes: [scope] })).token || '';
8
+ static async GetAgenticUserToken(authorization, authHandlerName, turnContext, scopes) {
9
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- Intentional: maintaining backward compatibility for deprecated 3-param overload
10
+ const effectiveScopes = scopes ?? [PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE];
11
+ return (await authorization.exchangeToken(turnContext, authHandlerName, { scopes: effectiveScopes })).token || '';
8
12
  }
9
13
  }
10
14
  //# sourceMappingURL=agentic-authorization-service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agentic-authorization-service.js","sourceRoot":"","sources":["../../src/agentic-authorization-service.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,OAAO,4BAA4B;IAChC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,aAA4B,EAAE,eAAuB,EAAE,WAAwB;QACrH,MAAM,KAAK,GAAG,iCAAiC,EAAE,CAAC;QAClD,OAAO,CAAC,MAAM,aAAa,CAAC,aAAa,CAAC,WAAW,EAAE,eAAe,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;IAC5G,CAAC;CACF"}
1
+ {"version":3,"file":"agentic-authorization-service.js","sourceRoot":"","sources":["../../src/agentic-authorization-service.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,sCAAsC,EAAE,MAAM,qBAAqB,CAAC;AAE7E;;GAEG;AACH,MAAM,OAAO,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,sCAAsC,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"}
@@ -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"}