@microsoft/agents-a365-runtime package

類別

AgenticAuthenticationService

處理代理使用者身份驗證的服務。

DefaultConfigurationProvider

預設供應商會回傳基於環境的設定。

多租戶的考量: 此提供者在建構時建立單一配置實例,並在程序中所有請求間共享。 預設的模組層級提供者(例如 defaultRuntimeConfigurationProvider)是單例。

對於多租戶情境,支援兩種方法:

  1. 動態覆寫功能(建議): 在執行時,傳遞從非同步上下文讀取(例如 OpenTelemetry baggage)的覆寫函式。 同一個配置實例每次請求都會回傳不同的值。

    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 baggage)動態解析。

Utility

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>)

若當前環境是開發環境,則回傳為真。

範例

// 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.

若當前環境是開發環境,則回傳為真。

範例

// 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

如果目前環境是開發,則為真;否則為假。

變數詳細資料

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>

類型