agents 0.18.0 → 0.19.0

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.
@@ -1803,7 +1803,7 @@ const SEMANTIC_CONTEXT_KEYS = /* @__PURE__ */ new Set([
1803
1803
  function runtimeContextAttributes(runtimeContextValue) {
1804
1804
  const attributes = {};
1805
1805
  const runtimeContext = recordValue(runtimeContextValue);
1806
- for (const [key, value] of Object.entries(runtimeContext ?? {})) if (!SEMANTIC_CONTEXT_KEYS.has(key) && isScalarAttributeValue(value)) attributes[`cloudflare.agents.runtime_context.${key}`] = value;
1806
+ for (const [key, value] of Object.entries(runtimeContext ?? {})) if (!SEMANTIC_CONTEXT_KEYS.has(key) && isScalarAttributeValue(value)) attributes[key.startsWith("cloudflare.agents.") ? key : `cloudflare.agents.runtime_context.${key}`] = value;
1807
1807
  return attributes;
1808
1808
  }
1809
1809
  function toolContextAttributes(toolName, toolContextValue) {
@@ -1820,6 +1820,7 @@ function isScalarAttributeValue(value) {
1820
1820
  }
1821
1821
  //#endregion
1822
1822
  //#region src/observability/ai/index.ts
1823
+ const agentsAISDKTelemetryBrand = Symbol.for("cloudflare.agents.ai-sdk-telemetry");
1823
1824
  /**
1824
1825
  * Wraps an AI SDK namespace with tracing.
1825
1826
  */
@@ -1834,10 +1835,12 @@ function wrapAISDK(ai, options = {}) {
1834
1835
  * per-call telemetry configuration.
1835
1836
  */
1836
1837
  function createAISDKTelemetry(options = {}) {
1837
- return createAISDKV7Telemetry({
1838
+ const telemetry = createAISDKV7Telemetry({
1838
1839
  options,
1839
1840
  tracer
1840
1841
  });
1842
+ Object.defineProperty(telemetry, agentsAISDKTelemetryBrand, { value: true });
1843
+ return telemetry;
1841
1844
  }
1842
1845
  //#endregion
1843
1846
  export { createAISDKTelemetry, wrapAISDK };