@microsoft/agents-a365-runtime package

AgenticAuthenticationService

用于处理代理用户身份验证的服务。

DefaultConfigurationProvider

返回基于环境的配置的默认提供程序。

多租户注意事项: 此提供程序在构造时创建单个配置实例,并在进程中的所有请求之间共享。 默认模块级提供程序(例如) defaultRuntimeConfigurationProvider是单一实例。

对于多租户方案,支持两种方法:

  1. 动态重写函数(建议): 在运行时传递从异步上下文(例如 OpenTelemetry 行李)读取的重写函数。 同一配置实例为每个请求返回不同的值。

    const config = new ToolingConfiguration({
      mcpPlatformEndpoint: () => {
        const tenantConfig = context.active().getValue(TENANT_KEY);
        return tenantConfig?.endpoint ?? 'https://default.endpoint';
      }
    });
    
  2. 每租户提供程序: 当不同的租户完全需要不同的替代函数时,为每个租户创建单独的提供程序实例。

OperationError

封装操作中的错误。

OperationResult

表示操作的结果。

PowerPlatformApiDiscovery
RuntimeConfiguration

Agent365 SDK 的基配置类。 其他包扩展此项以添加其自己的设置。

对每个属性访问调用重写函数,从而根据请求启用异步上下文(例如 OpenTelemetry 行李)的动态解析。

Utility

实用工具类为代理运行时作提供帮助程序方法。

接口

IConfigurationProvider

用于提供配置的通用接口。 每个包定义其自己的配置类型 T。

类型别名

RuntimeConfigurationOptions

运行时配置选项 - 所有可选函数。 在每个属性访问上调用函数,从而启用动态解析。 未设置的值回退到环境变量。

枚举

ClusterCategory

Power Platform API 发现的群集类别。 字符串枚举提供编译时类型安全性和运行时验证。

函数

getClusterCategory(IConfigurationProvider<RuntimeConfiguration>)

从环境变量中获取群集类别。

示例

// Before:
import { getClusterCategory } from '@microsoft/agents-a365-runtime';
const cluster = getClusterCategory();

// After:
import { defaultRuntimeConfigurationProvider } from '@microsoft/agents-a365-runtime';
const cluster = defaultRuntimeConfigurationProvider.getConfiguration().clusterCategory;
getMcpPlatformAuthenticationScope()

获取 MCP 平台身份验证范围。

示例

// Before:
import { getMcpPlatformAuthenticationScope } from '@microsoft/agents-a365-runtime';
const scope = getMcpPlatformAuthenticationScope();

// After:
import { defaultToolingConfigurationProvider } from '@microsoft/agents-a365-tooling';
const scope = defaultToolingConfigurationProvider.getConfiguration().mcpPlatformAuthenticationScope;
getObservabilityAuthenticationScope()

返回对可观测性服务进行身份验证的范围。

示例

// Before:
import { getObservabilityAuthenticationScope } from '@microsoft/agents-a365-runtime';
const scopes = getObservabilityAuthenticationScope();

// After:
import { defaultObservabilityConfigurationProvider } from '@microsoft/agents-a365-observability';
const scopes = [...defaultObservabilityConfigurationProvider.getConfiguration().observabilityAuthenticationScopes];
isDevelopmentEnvironment(IConfigurationProvider<RuntimeConfiguration>)

如果当前环境是开发环境,则返回 true。

示例

// Before:
import { isDevelopmentEnvironment } from '@microsoft/agents-a365-runtime';
if (isDevelopmentEnvironment()) { ... }

// After:
import { defaultRuntimeConfigurationProvider } from '@microsoft/agents-a365-runtime';
if (defaultRuntimeConfigurationProvider.getConfiguration().isDevelopmentEnvironment) { ... }

变量

DEVELOPMENT_ENVIRONMENT_NAME
PRODUCTION_ENVIRONMENT_NAME
PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE

生产 MCP 平台身份验证范围。

PROD_OBSERVABILITY_CLUSTER_CATEGORY

生产环境的默认群集类别。

PROD_OBSERVABILITY_SCOPE

生产可观测性身份验证范围。

defaultRuntimeConfigurationProvider

RuntimeConfiguration 的共享默认提供程序。 使用没有替代的环境变量 - 适用于单租户部署,或者在对多租户使用动态替代函数时使用。

函数详细信息

getClusterCategory(IConfigurationProvider<RuntimeConfiguration>)

警告

现已弃用此 API。

Use RuntimeConfiguration.clusterCategory instead.

从环境变量中获取群集类别。

示例

// Before:
import { getClusterCategory } from '@microsoft/agents-a365-runtime';
const cluster = getClusterCategory();

// After:
import { defaultRuntimeConfigurationProvider } from '@microsoft/agents-a365-runtime';
const cluster = defaultRuntimeConfigurationProvider.getConfiguration().clusterCategory;
function getClusterCategory(configProvider?: IConfigurationProvider<RuntimeConfiguration>): string

参数

configProvider

IConfigurationProvider<RuntimeConfiguration>

可选配置提供程序。 如果未指定,则默认为 defaultRuntimeConfigurationProvider。

返回

string

CLUSTER_CATEGORY env var 中的群集类别默认为“prod”。

getMcpPlatformAuthenticationScope()

警告

现已弃用此 API。

Use ToolingConfiguration.mcpPlatformAuthenticationScope instead.

获取 MCP 平台身份验证范围。

示例

// Before:
import { getMcpPlatformAuthenticationScope } from '@microsoft/agents-a365-runtime';
const scope = getMcpPlatformAuthenticationScope();

// After:
import { defaultToolingConfigurationProvider } from '@microsoft/agents-a365-tooling';
const scope = defaultToolingConfigurationProvider.getConfiguration().mcpPlatformAuthenticationScope;
function getMcpPlatformAuthenticationScope(): string

返回

string

MCP 平台身份验证范围。

getObservabilityAuthenticationScope()

警告

现已弃用此 API。

Use ObservabilityConfiguration.observabilityAuthenticationScopes instead.

返回对可观测性服务进行身份验证的范围。

示例

// Before:
import { getObservabilityAuthenticationScope } from '@microsoft/agents-a365-runtime';
const scopes = getObservabilityAuthenticationScope();

// After:
import { defaultObservabilityConfigurationProvider } from '@microsoft/agents-a365-observability';
const scopes = [...defaultObservabilityConfigurationProvider.getConfiguration().observabilityAuthenticationScopes];
function getObservabilityAuthenticationScope(): string[]

返回

string[]

当前环境的身份验证范围。

isDevelopmentEnvironment(IConfigurationProvider<RuntimeConfiguration>)

警告

现已弃用此 API。

Use RuntimeConfiguration.isDevelopmentEnvironment instead.

如果当前环境是开发环境,则返回 true。

示例

// Before:
import { isDevelopmentEnvironment } from '@microsoft/agents-a365-runtime';
if (isDevelopmentEnvironment()) { ... }

// After:
import { defaultRuntimeConfigurationProvider } from '@microsoft/agents-a365-runtime';
if (defaultRuntimeConfigurationProvider.getConfiguration().isDevelopmentEnvironment) { ... }
function isDevelopmentEnvironment(configProvider?: IConfigurationProvider<RuntimeConfiguration>): boolean

参数

configProvider

IConfigurationProvider<RuntimeConfiguration>

可选配置提供程序。 如果未指定,则默认为 defaultRuntimeConfigurationProvider。

返回

boolean

如果当前环境正在开发,则为 True;否则为 false。

变量详细信息

DEVELOPMENT_ENVIRONMENT_NAME

DEVELOPMENT_ENVIRONMENT_NAME: "Development"

类型

"Development"

PRODUCTION_ENVIRONMENT_NAME

PRODUCTION_ENVIRONMENT_NAME: "production"

类型

"production"

PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE

警告

现已弃用此 API。

This constant is exported for backward compatibility only. For new code, use ToolingConfiguration.mcpPlatformAuthenticationScope instead.

生产 MCP 平台身份验证范围。

PROD_MCP_PLATFORM_AUTHENTICATION_SCOPE: "ea9ffc3e-8a23-4a7d-836d-234d7c7565c1/.default"

类型

string

PROD_OBSERVABILITY_CLUSTER_CATEGORY

警告

现已弃用此 API。

This constant is exported for backward compatibility only. For new code, use RuntimeConfiguration.clusterCategory instead.

生产环境的默认群集类别。

PROD_OBSERVABILITY_CLUSTER_CATEGORY: "prod"

类型

"prod"

PROD_OBSERVABILITY_SCOPE

警告

现已弃用此 API。

This constant is exported for backward compatibility only. For new code, use ObservabilityConfiguration.observabilityAuthenticationScopes instead.

生产可观测性身份验证范围。

PROD_OBSERVABILITY_SCOPE: "api://9b975845-388f-4429-889e-eab1ef63949c/.default"

类型

string

defaultRuntimeConfigurationProvider

RuntimeConfiguration 的共享默认提供程序。 使用没有替代的环境变量 - 适用于单租户部署,或者在对多租户使用动态替代函数时使用。

defaultRuntimeConfigurationProvider: DefaultConfigurationProvider<RuntimeConfiguration>

类型