@azure/ai-projects 2.7.1 → 2.9.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.
- package/README.md +101 -5
- package/dist/browser/aiProjectClient.d.ts +4 -0
- package/dist/browser/aiProjectClient.d.ts.map +1 -1
- package/dist/browser/aiProjectClient.js +6 -1
- package/dist/browser/aiProjectClient.js.map +1 -1
- package/dist/browser/api/agents/index.d.ts +2 -2
- package/dist/browser/api/agents/index.d.ts.map +1 -1
- package/dist/browser/api/agents/index.js +1 -1
- package/dist/browser/api/agents/index.js.map +1 -1
- package/dist/browser/api/agents/operations.d.ts +41 -4
- package/dist/browser/api/agents/operations.d.ts.map +1 -1
- package/dist/browser/api/agents/operations.js +322 -21
- package/dist/browser/api/agents/operations.js.map +1 -1
- package/dist/browser/api/agents/options.d.ts +163 -93
- package/dist/browser/api/agents/options.d.ts.map +1 -1
- package/dist/browser/api/agents/options.js.map +1 -1
- package/dist/browser/api/beta/agents/index.d.ts +2 -2
- package/dist/browser/api/beta/agents/index.d.ts.map +1 -1
- package/dist/browser/api/beta/agents/index.js +1 -1
- package/dist/browser/api/beta/agents/index.js.map +1 -1
- package/dist/browser/api/beta/agents/operations.d.ts +2 -24
- package/dist/browser/api/beta/agents/operations.d.ts.map +1 -1
- package/dist/browser/api/beta/agents/operations.js +3 -185
- package/dist/browser/api/beta/agents/operations.js.map +1 -1
- package/dist/browser/api/beta/agents/options.d.ts +0 -56
- package/dist/browser/api/beta/agents/options.d.ts.map +1 -1
- package/dist/browser/api/beta/agents/options.js.map +1 -1
- package/dist/browser/api/beta/evaluators/index.d.ts +2 -2
- package/dist/browser/api/beta/evaluators/index.d.ts.map +1 -1
- package/dist/browser/api/beta/evaluators/index.js +1 -1
- package/dist/browser/api/beta/evaluators/index.js.map +1 -1
- package/dist/browser/api/beta/evaluators/operations.d.ts +2 -59
- package/dist/browser/api/beta/evaluators/operations.d.ts.map +1 -1
- package/dist/browser/api/beta/evaluators/operations.js +1 -388
- package/dist/browser/api/beta/evaluators/operations.js.map +1 -1
- package/dist/browser/api/beta/evaluators/options.d.ts +0 -84
- package/dist/browser/api/beta/evaluators/options.d.ts.map +1 -1
- package/dist/browser/api/beta/evaluators/options.js.map +1 -1
- package/dist/browser/api/datasets/index.d.ts +2 -2
- package/dist/browser/api/datasets/index.d.ts.map +1 -1
- package/dist/browser/api/datasets/index.js +1 -1
- package/dist/browser/api/datasets/index.js.map +1 -1
- package/dist/browser/api/datasets/operations.d.ts +23 -2
- package/dist/browser/api/datasets/operations.d.ts.map +1 -1
- package/dist/browser/api/datasets/operations.js +193 -1
- package/dist/browser/api/datasets/operations.js.map +1 -1
- package/dist/browser/api/datasets/options.d.ts +52 -0
- package/dist/browser/api/datasets/options.d.ts.map +1 -1
- package/dist/browser/api/datasets/options.js.map +1 -1
- package/dist/browser/api/evaluators/index.d.ts +3 -0
- package/dist/browser/api/evaluators/index.d.ts.map +1 -0
- package/dist/browser/api/evaluators/index.js +4 -0
- package/dist/browser/api/evaluators/index.js.map +1 -0
- package/dist/browser/api/evaluators/operations.d.ts +62 -0
- package/dist/browser/api/evaluators/operations.d.ts.map +1 -0
- package/dist/browser/api/evaluators/operations.js +373 -0
- package/dist/browser/api/evaluators/operations.js.map +1 -0
- package/dist/browser/api/evaluators/options.d.ts +70 -0
- package/dist/browser/api/evaluators/options.d.ts.map +1 -0
- package/dist/browser/api/evaluators/options.js.map +1 -0
- package/dist/browser/classic/agents/index.d.ts +21 -2
- package/dist/browser/classic/agents/index.d.ts.map +1 -1
- package/dist/browser/classic/agents/index.js +10 -1
- package/dist/browser/classic/agents/index.js.map +1 -1
- package/dist/browser/classic/beta/agents/index.d.ts +4 -15
- package/dist/browser/classic/beta/agents/index.d.ts.map +1 -1
- package/dist/browser/classic/beta/agents/index.js +4 -11
- package/dist/browser/classic/beta/agents/index.js.map +1 -1
- package/dist/browser/classic/beta/evaluators/index.d.ts +3 -38
- package/dist/browser/classic/beta/evaluators/index.d.ts.map +1 -1
- package/dist/browser/classic/beta/evaluators/index.js +2 -18
- package/dist/browser/classic/beta/evaluators/index.js.map +1 -1
- package/dist/browser/classic/beta/index.d.ts +2 -4
- package/dist/browser/classic/beta/index.d.ts.map +1 -1
- package/dist/browser/classic/beta/index.js +3 -6
- package/dist/browser/classic/beta/index.js.map +1 -1
- package/dist/browser/classic/beta/voiceAgents/conversations/index.d.ts +2 -1
- package/dist/browser/classic/beta/voiceAgents/conversations/index.d.ts.map +1 -1
- package/dist/browser/classic/beta/voiceAgents/conversations/index.js +5 -4
- package/dist/browser/classic/beta/voiceAgents/conversations/index.js.map +1 -1
- package/dist/browser/classic/beta/voiceAgents/index.d.ts +3 -2
- package/dist/browser/classic/beta/voiceAgents/index.d.ts.map +1 -1
- package/dist/browser/classic/beta/voiceAgents/index.js +5 -5
- package/dist/browser/classic/beta/voiceAgents/index.js.map +1 -1
- package/dist/browser/classic/beta/voiceAgents/telephony/index.d.ts +2 -1
- package/dist/browser/classic/beta/voiceAgents/telephony/index.d.ts.map +1 -1
- package/dist/browser/classic/beta/voiceAgents/telephony/index.js +16 -11
- package/dist/browser/classic/beta/voiceAgents/telephony/index.js.map +1 -1
- package/dist/browser/classic/datasets/index.d.ts +13 -2
- package/dist/browser/classic/datasets/index.d.ts.map +1 -1
- package/dist/browser/classic/datasets/index.js +6 -1
- package/dist/browser/classic/datasets/index.js.map +1 -1
- package/dist/browser/classic/evaluators/index.d.ts +43 -0
- package/dist/browser/classic/evaluators/index.d.ts.map +1 -0
- package/dist/browser/classic/evaluators/index.js +19 -0
- package/dist/browser/classic/evaluators/index.js.map +1 -0
- package/dist/browser/classic/index.d.ts +1 -1
- package/dist/browser/classic/index.d.ts.map +1 -1
- package/dist/browser/classic/index.js.map +1 -1
- package/dist/browser/constants.d.ts +1 -1
- package/dist/browser/constants.js +1 -1
- package/dist/browser/constants.js.map +1 -1
- package/dist/browser/index.d.ts +10 -17
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +1 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/models/index.d.ts +1 -3
- package/dist/browser/models/index.d.ts.map +1 -1
- package/dist/browser/models/index.js.map +1 -1
- package/dist/browser/models/models.d.ts +1081 -536
- package/dist/browser/models/models.d.ts.map +1 -1
- package/dist/browser/models/models.js +1554 -655
- package/dist/browser/models/models.js.map +1 -1
- package/dist/browser/package.json +1 -1
- package/dist/browser/realtime/voiceAgentRealtimeClient.d.ts +27 -2
- package/dist/browser/realtime/voiceAgentRealtimeClient.d.ts.map +1 -1
- package/dist/browser/realtime/voiceAgentRealtimeClient.js +97 -17
- package/dist/browser/realtime/voiceAgentRealtimeClient.js.map +1 -1
- package/dist/browser/tracing/configuration.d.ts +3 -5
- package/dist/browser/tracing/configuration.d.ts.map +1 -1
- package/dist/browser/tracing/configuration.js +8 -6
- package/dist/browser/tracing/configuration.js.map +1 -1
- package/dist/browser/tracing/tracingClient.d.ts +1 -1
- package/dist/browser/tracing/tracingClient.d.ts.map +1 -1
- package/dist/browser/tracing/tracingClient.js +2 -2
- package/dist/browser/tracing/tracingClient.js.map +1 -1
- package/dist/browser/tracing/voiceAgentTracing.d.ts +63 -0
- package/dist/browser/tracing/voiceAgentTracing.d.ts.map +1 -0
- package/dist/browser/tracing/voiceAgentTracing.js +740 -0
- package/dist/browser/tracing/voiceAgentTracing.js.map +1 -0
- package/dist/browser/webSocketTransport.d.ts +1 -0
- package/dist/browser/webSocketTransport.d.ts.map +1 -1
- package/dist/browser/webSocketTransport.js +5 -13
- package/dist/browser/webSocketTransport.js.map +1 -1
- package/dist/commonjs/aiProjectClient.d.ts +4 -0
- package/dist/commonjs/aiProjectClient.d.ts.map +1 -1
- package/dist/commonjs/aiProjectClient.js +6 -1
- package/dist/commonjs/aiProjectClient.js.map +2 -2
- package/dist/commonjs/api/agents/index.d.ts +2 -2
- package/dist/commonjs/api/agents/index.d.ts.map +1 -1
- package/dist/commonjs/api/agents/index.js +18 -0
- package/dist/commonjs/api/agents/index.js.map +2 -2
- package/dist/commonjs/api/agents/operations.d.ts +41 -4
- package/dist/commonjs/api/agents/operations.d.ts.map +1 -1
- package/dist/commonjs/api/agents/operations.js +415 -19
- package/dist/commonjs/api/agents/operations.js.map +2 -2
- package/dist/commonjs/api/agents/options.d.ts +163 -93
- package/dist/commonjs/api/agents/options.d.ts.map +1 -1
- package/dist/commonjs/api/agents/options.js.map +1 -1
- package/dist/commonjs/api/beta/agents/index.d.ts +2 -2
- package/dist/commonjs/api/beta/agents/index.d.ts.map +1 -1
- package/dist/commonjs/api/beta/agents/index.js +2 -12
- package/dist/commonjs/api/beta/agents/index.js.map +2 -2
- package/dist/commonjs/api/beta/agents/operations.d.ts +2 -24
- package/dist/commonjs/api/beta/agents/operations.d.ts.map +1 -1
- package/dist/commonjs/api/beta/agents/operations.js +4 -239
- package/dist/commonjs/api/beta/agents/operations.js.map +2 -2
- package/dist/commonjs/api/beta/agents/options.d.ts +0 -56
- package/dist/commonjs/api/beta/agents/options.d.ts.map +1 -1
- package/dist/commonjs/api/beta/agents/options.js.map +1 -1
- package/dist/commonjs/api/beta/evaluators/index.d.ts +2 -2
- package/dist/commonjs/api/beta/evaluators/index.d.ts.map +1 -1
- package/dist/commonjs/api/beta/evaluators/index.js +2 -24
- package/dist/commonjs/api/beta/evaluators/index.js.map +2 -2
- package/dist/commonjs/api/beta/evaluators/operations.d.ts +2 -59
- package/dist/commonjs/api/beta/evaluators/operations.d.ts.map +1 -1
- package/dist/commonjs/api/beta/evaluators/operations.js +2 -497
- package/dist/commonjs/api/beta/evaluators/operations.js.map +2 -2
- package/dist/commonjs/api/beta/evaluators/options.d.ts +0 -84
- package/dist/commonjs/api/beta/evaluators/options.d.ts.map +1 -1
- package/dist/commonjs/api/beta/evaluators/options.js.map +1 -1
- package/dist/commonjs/api/datasets/index.d.ts +2 -2
- package/dist/commonjs/api/datasets/index.d.ts.map +1 -1
- package/dist/commonjs/api/datasets/index.js +10 -0
- package/dist/commonjs/api/datasets/index.js.map +2 -2
- package/dist/commonjs/api/datasets/operations.d.ts +23 -2
- package/dist/commonjs/api/datasets/operations.d.ts.map +1 -1
- package/dist/commonjs/api/datasets/operations.js +245 -0
- package/dist/commonjs/api/datasets/operations.js.map +2 -2
- package/dist/commonjs/api/datasets/options.d.ts +52 -0
- package/dist/commonjs/api/datasets/options.d.ts.map +1 -1
- package/dist/commonjs/api/datasets/options.js.map +1 -1
- package/dist/commonjs/api/evaluators/index.d.ts +3 -0
- package/dist/commonjs/api/evaluators/index.d.ts.map +1 -0
- package/dist/commonjs/api/{beta/datasets → evaluators}/index.js +17 -5
- package/dist/commonjs/api/evaluators/index.js.map +7 -0
- package/dist/commonjs/api/evaluators/operations.d.ts +62 -0
- package/dist/commonjs/api/evaluators/operations.d.ts.map +1 -0
- package/dist/commonjs/api/evaluators/operations.js +505 -0
- package/dist/commonjs/api/evaluators/operations.js.map +7 -0
- package/dist/commonjs/api/evaluators/options.d.ts +70 -0
- package/dist/commonjs/api/evaluators/options.d.ts.map +1 -0
- package/dist/commonjs/api/evaluators/options.js.map +7 -0
- package/dist/commonjs/classic/agents/index.d.ts +21 -2
- package/dist/commonjs/classic/agents/index.d.ts.map +1 -1
- package/dist/commonjs/classic/agents/index.js +9 -0
- package/dist/commonjs/classic/agents/index.js.map +2 -2
- package/dist/commonjs/classic/beta/agents/index.d.ts +4 -15
- package/dist/commonjs/classic/beta/agents/index.d.ts.map +1 -1
- package/dist/commonjs/classic/beta/agents/index.js +9 -10
- package/dist/commonjs/classic/beta/agents/index.js.map +2 -2
- package/dist/commonjs/classic/beta/evaluators/index.d.ts +3 -38
- package/dist/commonjs/classic/beta/evaluators/index.d.ts.map +1 -1
- package/dist/commonjs/classic/beta/evaluators/index.js +2 -18
- package/dist/commonjs/classic/beta/evaluators/index.js.map +2 -2
- package/dist/commonjs/classic/beta/index.d.ts +2 -4
- package/dist/commonjs/classic/beta/index.d.ts.map +1 -1
- package/dist/commonjs/classic/beta/index.js +9 -6
- package/dist/commonjs/classic/beta/index.js.map +2 -2
- package/dist/commonjs/classic/beta/voiceAgents/conversations/index.d.ts +2 -1
- package/dist/commonjs/classic/beta/voiceAgents/conversations/index.d.ts.map +1 -1
- package/dist/commonjs/classic/beta/voiceAgents/conversations/index.js +10 -4
- package/dist/commonjs/classic/beta/voiceAgents/conversations/index.js.map +2 -2
- package/dist/commonjs/classic/beta/voiceAgents/index.d.ts +3 -2
- package/dist/commonjs/classic/beta/voiceAgents/index.d.ts.map +1 -1
- package/dist/commonjs/classic/beta/voiceAgents/index.js +4 -4
- package/dist/commonjs/classic/beta/voiceAgents/index.js.map +2 -2
- package/dist/commonjs/classic/beta/voiceAgents/telephony/index.d.ts +2 -1
- package/dist/commonjs/classic/beta/voiceAgents/telephony/index.d.ts.map +1 -1
- package/dist/commonjs/classic/beta/voiceAgents/telephony/index.js +33 -11
- package/dist/commonjs/classic/beta/voiceAgents/telephony/index.js.map +2 -2
- package/dist/commonjs/classic/datasets/index.d.ts +13 -2
- package/dist/commonjs/classic/datasets/index.d.ts.map +1 -1
- package/dist/commonjs/classic/datasets/index.js +5 -0
- package/dist/commonjs/classic/datasets/index.js.map +2 -2
- package/dist/commonjs/classic/evaluators/index.d.ts +43 -0
- package/dist/commonjs/classic/evaluators/index.d.ts.map +1 -0
- package/dist/commonjs/classic/{beta/datasets → evaluators}/index.js +15 -14
- package/dist/commonjs/classic/evaluators/index.js.map +7 -0
- package/dist/commonjs/classic/index.d.ts +1 -1
- package/dist/commonjs/classic/index.d.ts.map +1 -1
- package/dist/commonjs/classic/index.js.map +1 -1
- package/dist/commonjs/constants.d.ts +1 -1
- package/dist/commonjs/constants.js +1 -1
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/commonjs/index.d.ts +10 -17
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -2
- package/dist/commonjs/index.js.map +3 -3
- package/dist/commonjs/models/index.d.ts +1 -3
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/models.d.ts +1081 -536
- package/dist/commonjs/models/models.d.ts.map +1 -1
- package/dist/commonjs/models/models.js +1803 -722
- package/dist/commonjs/models/models.js.map +2 -2
- package/dist/commonjs/package.json +1 -1
- package/dist/commonjs/realtime/voiceAgentRealtimeClient.d.ts +27 -2
- package/dist/commonjs/realtime/voiceAgentRealtimeClient.d.ts.map +1 -1
- package/dist/commonjs/realtime/voiceAgentRealtimeClient.js +98 -27
- package/dist/commonjs/realtime/voiceAgentRealtimeClient.js.map +2 -2
- package/dist/commonjs/tracing/configuration.d.ts +3 -5
- package/dist/commonjs/tracing/configuration.d.ts.map +1 -1
- package/dist/commonjs/tracing/configuration.js +5 -1
- package/dist/commonjs/tracing/configuration.js.map +2 -2
- package/dist/commonjs/tracing/tracingClient.d.ts +1 -1
- package/dist/commonjs/tracing/tracingClient.d.ts.map +1 -1
- package/dist/commonjs/tracing/tracingClient.js +2 -2
- package/dist/commonjs/tracing/tracingClient.js.map +2 -2
- package/dist/commonjs/tracing/voiceAgentTracing.d.ts +63 -0
- package/dist/commonjs/tracing/voiceAgentTracing.d.ts.map +1 -0
- package/dist/commonjs/tracing/voiceAgentTracing.js +705 -0
- package/dist/commonjs/tracing/voiceAgentTracing.js.map +7 -0
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/esm/aiProjectClient.d.ts +4 -0
- package/dist/esm/aiProjectClient.d.ts.map +1 -1
- package/dist/esm/aiProjectClient.js +6 -1
- package/dist/esm/aiProjectClient.js.map +1 -1
- package/dist/esm/api/agents/index.d.ts +2 -2
- package/dist/esm/api/agents/index.d.ts.map +1 -1
- package/dist/esm/api/agents/index.js +1 -1
- package/dist/esm/api/agents/index.js.map +1 -1
- package/dist/esm/api/agents/operations.d.ts +41 -4
- package/dist/esm/api/agents/operations.d.ts.map +1 -1
- package/dist/esm/api/agents/operations.js +322 -21
- package/dist/esm/api/agents/operations.js.map +1 -1
- package/dist/esm/api/agents/options.d.ts +163 -93
- package/dist/esm/api/agents/options.d.ts.map +1 -1
- package/dist/esm/api/agents/options.js.map +1 -1
- package/dist/esm/api/beta/agents/index.d.ts +2 -2
- package/dist/esm/api/beta/agents/index.d.ts.map +1 -1
- package/dist/esm/api/beta/agents/index.js +1 -1
- package/dist/esm/api/beta/agents/index.js.map +1 -1
- package/dist/esm/api/beta/agents/operations.d.ts +2 -24
- package/dist/esm/api/beta/agents/operations.d.ts.map +1 -1
- package/dist/esm/api/beta/agents/operations.js +3 -185
- package/dist/esm/api/beta/agents/operations.js.map +1 -1
- package/dist/esm/api/beta/agents/options.d.ts +0 -56
- package/dist/esm/api/beta/agents/options.d.ts.map +1 -1
- package/dist/esm/api/beta/agents/options.js.map +1 -1
- package/dist/esm/api/beta/evaluators/index.d.ts +2 -2
- package/dist/esm/api/beta/evaluators/index.d.ts.map +1 -1
- package/dist/esm/api/beta/evaluators/index.js +1 -1
- package/dist/esm/api/beta/evaluators/index.js.map +1 -1
- package/dist/esm/api/beta/evaluators/operations.d.ts +2 -59
- package/dist/esm/api/beta/evaluators/operations.d.ts.map +1 -1
- package/dist/esm/api/beta/evaluators/operations.js +1 -388
- package/dist/esm/api/beta/evaluators/operations.js.map +1 -1
- package/dist/esm/api/beta/evaluators/options.d.ts +0 -84
- package/dist/esm/api/beta/evaluators/options.d.ts.map +1 -1
- package/dist/esm/api/beta/evaluators/options.js.map +1 -1
- package/dist/esm/api/datasets/index.d.ts +2 -2
- package/dist/esm/api/datasets/index.d.ts.map +1 -1
- package/dist/esm/api/datasets/index.js +1 -1
- package/dist/esm/api/datasets/index.js.map +1 -1
- package/dist/esm/api/datasets/operations.d.ts +23 -2
- package/dist/esm/api/datasets/operations.d.ts.map +1 -1
- package/dist/esm/api/datasets/operations.js +193 -1
- package/dist/esm/api/datasets/operations.js.map +1 -1
- package/dist/esm/api/datasets/options.d.ts +52 -0
- package/dist/esm/api/datasets/options.d.ts.map +1 -1
- package/dist/esm/api/datasets/options.js.map +1 -1
- package/dist/esm/api/evaluators/index.d.ts +3 -0
- package/dist/esm/api/evaluators/index.d.ts.map +1 -0
- package/dist/esm/api/evaluators/index.js +4 -0
- package/dist/esm/api/evaluators/index.js.map +1 -0
- package/dist/esm/api/evaluators/operations.d.ts +62 -0
- package/dist/esm/api/evaluators/operations.d.ts.map +1 -0
- package/dist/esm/api/evaluators/operations.js +373 -0
- package/dist/esm/api/evaluators/operations.js.map +1 -0
- package/dist/esm/api/evaluators/options.d.ts +70 -0
- package/dist/esm/api/evaluators/options.d.ts.map +1 -0
- package/dist/esm/api/evaluators/options.js.map +1 -0
- package/dist/esm/classic/agents/index.d.ts +21 -2
- package/dist/esm/classic/agents/index.d.ts.map +1 -1
- package/dist/esm/classic/agents/index.js +10 -1
- package/dist/esm/classic/agents/index.js.map +1 -1
- package/dist/esm/classic/beta/agents/index.d.ts +4 -15
- package/dist/esm/classic/beta/agents/index.d.ts.map +1 -1
- package/dist/esm/classic/beta/agents/index.js +4 -11
- package/dist/esm/classic/beta/agents/index.js.map +1 -1
- package/dist/esm/classic/beta/evaluators/index.d.ts +3 -38
- package/dist/esm/classic/beta/evaluators/index.d.ts.map +1 -1
- package/dist/esm/classic/beta/evaluators/index.js +2 -18
- package/dist/esm/classic/beta/evaluators/index.js.map +1 -1
- package/dist/esm/classic/beta/index.d.ts +2 -4
- package/dist/esm/classic/beta/index.d.ts.map +1 -1
- package/dist/esm/classic/beta/index.js +3 -6
- package/dist/esm/classic/beta/index.js.map +1 -1
- package/dist/esm/classic/beta/voiceAgents/conversations/index.d.ts +2 -1
- package/dist/esm/classic/beta/voiceAgents/conversations/index.d.ts.map +1 -1
- package/dist/esm/classic/beta/voiceAgents/conversations/index.js +5 -4
- package/dist/esm/classic/beta/voiceAgents/conversations/index.js.map +1 -1
- package/dist/esm/classic/beta/voiceAgents/index.d.ts +3 -2
- package/dist/esm/classic/beta/voiceAgents/index.d.ts.map +1 -1
- package/dist/esm/classic/beta/voiceAgents/index.js +5 -5
- package/dist/esm/classic/beta/voiceAgents/index.js.map +1 -1
- package/dist/esm/classic/beta/voiceAgents/telephony/index.d.ts +2 -1
- package/dist/esm/classic/beta/voiceAgents/telephony/index.d.ts.map +1 -1
- package/dist/esm/classic/beta/voiceAgents/telephony/index.js +16 -11
- package/dist/esm/classic/beta/voiceAgents/telephony/index.js.map +1 -1
- package/dist/esm/classic/datasets/index.d.ts +13 -2
- package/dist/esm/classic/datasets/index.d.ts.map +1 -1
- package/dist/esm/classic/datasets/index.js +6 -1
- package/dist/esm/classic/datasets/index.js.map +1 -1
- package/dist/esm/classic/evaluators/index.d.ts +43 -0
- package/dist/esm/classic/evaluators/index.d.ts.map +1 -0
- package/dist/esm/classic/evaluators/index.js +19 -0
- package/dist/esm/classic/evaluators/index.js.map +1 -0
- package/dist/esm/classic/index.d.ts +1 -1
- package/dist/esm/classic/index.d.ts.map +1 -1
- package/dist/esm/classic/index.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/index.d.ts +10 -17
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models/index.d.ts +1 -3
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/models.d.ts +1081 -536
- package/dist/esm/models/models.d.ts.map +1 -1
- package/dist/esm/models/models.js +1554 -655
- package/dist/esm/models/models.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/esm/realtime/voiceAgentRealtimeClient.d.ts +27 -2
- package/dist/esm/realtime/voiceAgentRealtimeClient.d.ts.map +1 -1
- package/dist/esm/realtime/voiceAgentRealtimeClient.js +97 -17
- package/dist/esm/realtime/voiceAgentRealtimeClient.js.map +1 -1
- package/dist/esm/tracing/configuration.d.ts +3 -5
- package/dist/esm/tracing/configuration.d.ts.map +1 -1
- package/dist/esm/tracing/configuration.js +8 -6
- package/dist/esm/tracing/configuration.js.map +1 -1
- package/dist/esm/tracing/tracingClient.d.ts +1 -1
- package/dist/esm/tracing/tracingClient.d.ts.map +1 -1
- package/dist/esm/tracing/tracingClient.js +2 -2
- package/dist/esm/tracing/tracingClient.js.map +1 -1
- package/dist/esm/tracing/voiceAgentTracing.d.ts +63 -0
- package/dist/esm/tracing/voiceAgentTracing.d.ts.map +1 -0
- package/dist/esm/tracing/voiceAgentTracing.js +740 -0
- package/dist/esm/tracing/voiceAgentTracing.js.map +1 -0
- package/dist/react-native/aiProjectClient.d.ts +4 -0
- package/dist/react-native/aiProjectClient.d.ts.map +1 -1
- package/dist/react-native/aiProjectClient.js +6 -1
- package/dist/react-native/aiProjectClient.js.map +1 -1
- package/dist/react-native/api/agents/index.d.ts +2 -2
- package/dist/react-native/api/agents/index.d.ts.map +1 -1
- package/dist/react-native/api/agents/index.js +1 -1
- package/dist/react-native/api/agents/index.js.map +1 -1
- package/dist/react-native/api/agents/operations.d.ts +41 -4
- package/dist/react-native/api/agents/operations.d.ts.map +1 -1
- package/dist/react-native/api/agents/operations.js +322 -21
- package/dist/react-native/api/agents/operations.js.map +1 -1
- package/dist/react-native/api/agents/options.d.ts +163 -93
- package/dist/react-native/api/agents/options.d.ts.map +1 -1
- package/dist/react-native/api/agents/options.js.map +1 -1
- package/dist/react-native/api/beta/agents/index.d.ts +2 -2
- package/dist/react-native/api/beta/agents/index.d.ts.map +1 -1
- package/dist/react-native/api/beta/agents/index.js +1 -1
- package/dist/react-native/api/beta/agents/index.js.map +1 -1
- package/dist/react-native/api/beta/agents/operations.d.ts +2 -24
- package/dist/react-native/api/beta/agents/operations.d.ts.map +1 -1
- package/dist/react-native/api/beta/agents/operations.js +3 -185
- package/dist/react-native/api/beta/agents/operations.js.map +1 -1
- package/dist/react-native/api/beta/agents/options.d.ts +0 -56
- package/dist/react-native/api/beta/agents/options.d.ts.map +1 -1
- package/dist/react-native/api/beta/agents/options.js.map +1 -1
- package/dist/react-native/api/beta/evaluators/index.d.ts +2 -2
- package/dist/react-native/api/beta/evaluators/index.d.ts.map +1 -1
- package/dist/react-native/api/beta/evaluators/index.js +1 -1
- package/dist/react-native/api/beta/evaluators/index.js.map +1 -1
- package/dist/react-native/api/beta/evaluators/operations.d.ts +2 -59
- package/dist/react-native/api/beta/evaluators/operations.d.ts.map +1 -1
- package/dist/react-native/api/beta/evaluators/operations.js +1 -388
- package/dist/react-native/api/beta/evaluators/operations.js.map +1 -1
- package/dist/react-native/api/beta/evaluators/options.d.ts +0 -84
- package/dist/react-native/api/beta/evaluators/options.d.ts.map +1 -1
- package/dist/react-native/api/beta/evaluators/options.js.map +1 -1
- package/dist/react-native/api/datasets/index.d.ts +2 -2
- package/dist/react-native/api/datasets/index.d.ts.map +1 -1
- package/dist/react-native/api/datasets/index.js +1 -1
- package/dist/react-native/api/datasets/index.js.map +1 -1
- package/dist/react-native/api/datasets/operations.d.ts +23 -2
- package/dist/react-native/api/datasets/operations.d.ts.map +1 -1
- package/dist/react-native/api/datasets/operations.js +193 -1
- package/dist/react-native/api/datasets/operations.js.map +1 -1
- package/dist/react-native/api/datasets/options.d.ts +52 -0
- package/dist/react-native/api/datasets/options.d.ts.map +1 -1
- package/dist/react-native/api/datasets/options.js.map +1 -1
- package/dist/react-native/api/evaluators/index.d.ts +3 -0
- package/dist/react-native/api/evaluators/index.d.ts.map +1 -0
- package/dist/react-native/api/evaluators/index.js +4 -0
- package/dist/react-native/api/evaluators/index.js.map +1 -0
- package/dist/react-native/api/evaluators/operations.d.ts +62 -0
- package/dist/react-native/api/evaluators/operations.d.ts.map +1 -0
- package/dist/react-native/api/evaluators/operations.js +373 -0
- package/dist/react-native/api/evaluators/operations.js.map +1 -0
- package/dist/react-native/api/evaluators/options.d.ts +70 -0
- package/dist/react-native/api/evaluators/options.d.ts.map +1 -0
- package/dist/react-native/api/evaluators/options.js.map +1 -0
- package/dist/react-native/classic/agents/index.d.ts +21 -2
- package/dist/react-native/classic/agents/index.d.ts.map +1 -1
- package/dist/react-native/classic/agents/index.js +10 -1
- package/dist/react-native/classic/agents/index.js.map +1 -1
- package/dist/react-native/classic/beta/agents/index.d.ts +4 -15
- package/dist/react-native/classic/beta/agents/index.d.ts.map +1 -1
- package/dist/react-native/classic/beta/agents/index.js +4 -11
- package/dist/react-native/classic/beta/agents/index.js.map +1 -1
- package/dist/react-native/classic/beta/evaluators/index.d.ts +3 -38
- package/dist/react-native/classic/beta/evaluators/index.d.ts.map +1 -1
- package/dist/react-native/classic/beta/evaluators/index.js +2 -18
- package/dist/react-native/classic/beta/evaluators/index.js.map +1 -1
- package/dist/react-native/classic/beta/index.d.ts +2 -4
- package/dist/react-native/classic/beta/index.d.ts.map +1 -1
- package/dist/react-native/classic/beta/index.js +3 -6
- package/dist/react-native/classic/beta/index.js.map +1 -1
- package/dist/react-native/classic/beta/voiceAgents/conversations/index.d.ts +2 -1
- package/dist/react-native/classic/beta/voiceAgents/conversations/index.d.ts.map +1 -1
- package/dist/react-native/classic/beta/voiceAgents/conversations/index.js +5 -4
- package/dist/react-native/classic/beta/voiceAgents/conversations/index.js.map +1 -1
- package/dist/react-native/classic/beta/voiceAgents/index.d.ts +3 -2
- package/dist/react-native/classic/beta/voiceAgents/index.d.ts.map +1 -1
- package/dist/react-native/classic/beta/voiceAgents/index.js +5 -5
- package/dist/react-native/classic/beta/voiceAgents/index.js.map +1 -1
- package/dist/react-native/classic/beta/voiceAgents/telephony/index.d.ts +2 -1
- package/dist/react-native/classic/beta/voiceAgents/telephony/index.d.ts.map +1 -1
- package/dist/react-native/classic/beta/voiceAgents/telephony/index.js +16 -11
- package/dist/react-native/classic/beta/voiceAgents/telephony/index.js.map +1 -1
- package/dist/react-native/classic/datasets/index.d.ts +13 -2
- package/dist/react-native/classic/datasets/index.d.ts.map +1 -1
- package/dist/react-native/classic/datasets/index.js +6 -1
- package/dist/react-native/classic/datasets/index.js.map +1 -1
- package/dist/react-native/classic/evaluators/index.d.ts +43 -0
- package/dist/react-native/classic/evaluators/index.d.ts.map +1 -0
- package/dist/react-native/classic/evaluators/index.js +19 -0
- package/dist/react-native/classic/evaluators/index.js.map +1 -0
- package/dist/react-native/classic/index.d.ts +1 -1
- package/dist/react-native/classic/index.d.ts.map +1 -1
- package/dist/react-native/classic/index.js.map +1 -1
- package/dist/react-native/constants.d.ts +1 -1
- package/dist/react-native/constants.js +1 -1
- package/dist/react-native/constants.js.map +1 -1
- package/dist/react-native/index.d.ts +10 -17
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +1 -2
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/models/index.d.ts +1 -3
- package/dist/react-native/models/index.d.ts.map +1 -1
- package/dist/react-native/models/index.js.map +1 -1
- package/dist/react-native/models/models.d.ts +1081 -536
- package/dist/react-native/models/models.d.ts.map +1 -1
- package/dist/react-native/models/models.js +1554 -655
- package/dist/react-native/models/models.js.map +1 -1
- package/dist/react-native/package.json +1 -1
- package/dist/react-native/realtime/voiceAgentRealtimeClient.d.ts +27 -2
- package/dist/react-native/realtime/voiceAgentRealtimeClient.d.ts.map +1 -1
- package/dist/react-native/realtime/voiceAgentRealtimeClient.js +97 -17
- package/dist/react-native/realtime/voiceAgentRealtimeClient.js.map +1 -1
- package/dist/react-native/tracing/configuration.d.ts +3 -5
- package/dist/react-native/tracing/configuration.d.ts.map +1 -1
- package/dist/react-native/tracing/configuration.js +8 -6
- package/dist/react-native/tracing/configuration.js.map +1 -1
- package/dist/react-native/tracing/tracingClient.d.ts +1 -1
- package/dist/react-native/tracing/tracingClient.d.ts.map +1 -1
- package/dist/react-native/tracing/tracingClient.js +2 -2
- package/dist/react-native/tracing/tracingClient.js.map +1 -1
- package/dist/react-native/tracing/voiceAgentTracing.d.ts +63 -0
- package/dist/react-native/tracing/voiceAgentTracing.d.ts.map +1 -0
- package/dist/react-native/tracing/voiceAgentTracing.js +740 -0
- package/dist/react-native/tracing/voiceAgentTracing.js.map +1 -0
- package/dist/react-native/webSocketTransport-browser.d.mts +1 -0
- package/dist/react-native/webSocketTransport-browser.d.mts.map +1 -1
- package/dist/react-native/webSocketTransport-browser.mjs +5 -13
- package/dist/react-native/webSocketTransport-browser.mjs.map +1 -1
- package/package.json +9 -9
- package/dist/browser/api/beta/datasets/index.d.ts +0 -3
- package/dist/browser/api/beta/datasets/index.d.ts.map +0 -1
- package/dist/browser/api/beta/datasets/index.js +0 -4
- package/dist/browser/api/beta/datasets/index.js.map +0 -1
- package/dist/browser/api/beta/datasets/operations.d.ts +0 -27
- package/dist/browser/api/beta/datasets/operations.d.ts.map +0 -1
- package/dist/browser/api/beta/datasets/operations.js +0 -184
- package/dist/browser/api/beta/datasets/operations.js.map +0 -1
- package/dist/browser/api/beta/datasets/options.d.ts +0 -58
- package/dist/browser/api/beta/datasets/options.d.ts.map +0 -1
- package/dist/browser/api/beta/datasets/options.js.map +0 -1
- package/dist/browser/classic/beta/datasets/index.d.ts +0 -20
- package/dist/browser/classic/beta/datasets/index.d.ts.map +0 -1
- package/dist/browser/classic/beta/datasets/index.js +0 -18
- package/dist/browser/classic/beta/datasets/index.js.map +0 -1
- package/dist/commonjs/api/beta/datasets/index.d.ts +0 -3
- package/dist/commonjs/api/beta/datasets/index.d.ts.map +0 -1
- package/dist/commonjs/api/beta/datasets/index.js.map +0 -7
- package/dist/commonjs/api/beta/datasets/operations.d.ts +0 -27
- package/dist/commonjs/api/beta/datasets/operations.d.ts.map +0 -1
- package/dist/commonjs/api/beta/datasets/operations.js +0 -259
- package/dist/commonjs/api/beta/datasets/operations.js.map +0 -7
- package/dist/commonjs/api/beta/datasets/options.d.ts +0 -58
- package/dist/commonjs/api/beta/datasets/options.d.ts.map +0 -1
- package/dist/commonjs/api/beta/datasets/options.js.map +0 -7
- package/dist/commonjs/classic/beta/datasets/index.d.ts +0 -20
- package/dist/commonjs/classic/beta/datasets/index.d.ts.map +0 -1
- package/dist/commonjs/classic/beta/datasets/index.js.map +0 -7
- package/dist/esm/api/beta/datasets/index.d.ts +0 -3
- package/dist/esm/api/beta/datasets/index.d.ts.map +0 -1
- package/dist/esm/api/beta/datasets/index.js +0 -4
- package/dist/esm/api/beta/datasets/index.js.map +0 -1
- package/dist/esm/api/beta/datasets/operations.d.ts +0 -27
- package/dist/esm/api/beta/datasets/operations.d.ts.map +0 -1
- package/dist/esm/api/beta/datasets/operations.js +0 -184
- package/dist/esm/api/beta/datasets/operations.js.map +0 -1
- package/dist/esm/api/beta/datasets/options.d.ts +0 -58
- package/dist/esm/api/beta/datasets/options.d.ts.map +0 -1
- package/dist/esm/api/beta/datasets/options.js.map +0 -1
- package/dist/esm/classic/beta/datasets/index.d.ts +0 -20
- package/dist/esm/classic/beta/datasets/index.d.ts.map +0 -1
- package/dist/esm/classic/beta/datasets/index.js +0 -18
- package/dist/esm/classic/beta/datasets/index.js.map +0 -1
- package/dist/react-native/api/beta/datasets/index.d.ts +0 -3
- package/dist/react-native/api/beta/datasets/index.d.ts.map +0 -1
- package/dist/react-native/api/beta/datasets/index.js +0 -4
- package/dist/react-native/api/beta/datasets/index.js.map +0 -1
- package/dist/react-native/api/beta/datasets/operations.d.ts +0 -27
- package/dist/react-native/api/beta/datasets/operations.d.ts.map +0 -1
- package/dist/react-native/api/beta/datasets/operations.js +0 -184
- package/dist/react-native/api/beta/datasets/operations.js.map +0 -1
- package/dist/react-native/api/beta/datasets/options.d.ts +0 -58
- package/dist/react-native/api/beta/datasets/options.d.ts.map +0 -1
- package/dist/react-native/api/beta/datasets/options.js.map +0 -1
- package/dist/react-native/classic/beta/datasets/index.d.ts +0 -20
- package/dist/react-native/classic/beta/datasets/index.d.ts.map +0 -1
- package/dist/react-native/classic/beta/datasets/index.js +0 -18
- package/dist/react-native/classic/beta/datasets/index.js.map +0 -1
- /package/dist/browser/api/{beta/datasets → evaluators}/options.js +0 -0
- /package/dist/commonjs/api/{beta/datasets → evaluators}/options.js +0 -0
- /package/dist/esm/api/{beta/datasets → evaluators}/options.js +0 -0
- /package/dist/react-native/api/{beta/datasets → evaluators}/options.js +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AbortSignalLike } from "@azure/abort-controller";
|
|
2
2
|
import type { TokenCredential } from "@azure/core-auth";
|
|
3
3
|
import type { OperationOptions } from "@azure-rest/core-client";
|
|
4
|
-
import type { VoiceAgentClientEvent, VoiceAgentResponseCreateParams, VoiceAgentSessionUpdateConfig } from "../models/models.js";
|
|
4
|
+
import type { VoiceAgentClientEvent, VoiceAgentResponseCreateParams, VoiceAgentSessionUpdateConfig, VoiceAgentTransport } from "../models/models.js";
|
|
5
5
|
import type { VoiceAgentRealtimeEvent } from "./events.js";
|
|
6
6
|
import type { VoiceAgentWebSocketFactory } from "./webSocketTransportLike.js";
|
|
7
|
+
import type { ResolvedTracingConfig } from "../tracing/configuration.js";
|
|
7
8
|
/** Known values of {@link VoiceAgentConnectionState} reported by a voice-agent realtime connection. */
|
|
8
9
|
export declare const KnownVoiceAgentConnectionState: {
|
|
9
10
|
readonly Disconnected: "disconnected";
|
|
@@ -40,8 +41,30 @@ export interface VoiceAgentRealtimeClientConnectOptions extends OperationOptions
|
|
|
40
41
|
store?: boolean;
|
|
41
42
|
/** Selects a specific immutable agent version. */
|
|
42
43
|
agentVersionOverride?: string;
|
|
43
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Selects the transport used for the realtime connection. Defaults to `"websocket"`. Set to
|
|
46
|
+
* `"webrtc"` to negotiate a WebRTC peer connection instead; the caller is responsible for
|
|
47
|
+
* completing the SDP offer/answer exchange using the `rtc.call.sdp.create` and
|
|
48
|
+
* `rtc.call.sdp.created` events (see {@link VoiceAgentRealtimeEvent}).
|
|
49
|
+
*/
|
|
50
|
+
transport?: VoiceAgentTransport;
|
|
51
|
+
/**
|
|
52
|
+
* Values used to render the agent's structured prompt inputs.
|
|
53
|
+
* Serialized when `connect()` is called, before authentication.
|
|
54
|
+
*/
|
|
44
55
|
structuredInputs?: Record<string, unknown>;
|
|
56
|
+
/**
|
|
57
|
+
* Additional query parameters for this connection's WebSocket upgrade URL.
|
|
58
|
+
* Provide a plain object, including a null-prototype object.
|
|
59
|
+
* Values override matching endpoint query parameters; `undefined` removes a parameter.
|
|
60
|
+
* Values are URL-encoded automatically. Numbers must be finite.
|
|
61
|
+
* SDK-managed parameters, authentication parameters, and names starting with `h-` are
|
|
62
|
+
* reserved (case-insensitively) and cause a `TypeError`. Use the corresponding typed
|
|
63
|
+
* options for session, version, storage, transport, and structured prompt inputs instead.
|
|
64
|
+
* Both `structured_input` and `structured_inputs` are reserved.
|
|
65
|
+
* Do not include secrets: query parameters can appear in server or proxy logs.
|
|
66
|
+
*/
|
|
67
|
+
query?: Readonly<Record<string, string | number | boolean | undefined>>;
|
|
45
68
|
/** Overrides the client connection timeout in milliseconds. */
|
|
46
69
|
connectionTimeoutInMs?: number;
|
|
47
70
|
/** Cancels the connection attempt. */
|
|
@@ -142,4 +165,6 @@ export declare class VoiceAgentRealtimeClient {
|
|
|
142
165
|
/** Establishes a WebSocket connection to a managed voice agent. */
|
|
143
166
|
connect(agentName: string, options?: VoiceAgentRealtimeClientConnectOptions): Promise<VoiceAgentConnection>;
|
|
144
167
|
}
|
|
168
|
+
/** Creates the project's realtime client using its already-resolved tracing settings. @internal */
|
|
169
|
+
export declare function createVoiceAgentRealtimeClient(endpoint: string, credential: TokenCredential, options: VoiceAgentRealtimeClientOptions | undefined, tracingConfig: ResolvedTracingConfig | undefined): VoiceAgentRealtimeClient;
|
|
145
170
|
//# sourceMappingURL=voiceAgentRealtimeClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voiceAgentRealtimeClient.d.ts","sourceRoot":"","sources":["../../../src/realtime/voiceAgentRealtimeClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,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D,aAAa,EAAE,qBAAqB,GAAG,SAAS,GAC/C,wBAAwB,CAI1B"}
|
|
@@ -28,7 +28,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
28
28
|
var voiceAgentRealtimeClient_exports = {};
|
|
29
29
|
__export(voiceAgentRealtimeClient_exports, {
|
|
30
30
|
KnownVoiceAgentConnectionState: () => KnownVoiceAgentConnectionState,
|
|
31
|
-
VoiceAgentRealtimeClient: () => VoiceAgentRealtimeClient
|
|
31
|
+
VoiceAgentRealtimeClient: () => VoiceAgentRealtimeClient,
|
|
32
|
+
createVoiceAgentRealtimeClient: () => createVoiceAgentRealtimeClient
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(voiceAgentRealtimeClient_exports);
|
|
34
35
|
var import_core_util = require("@azure/core-util");
|
|
@@ -37,8 +38,27 @@ var import_logger = require("../logger.js");
|
|
|
37
38
|
var import_asyncQueue = require("./asyncQueue.js");
|
|
38
39
|
var import_errors = require("./errors.js");
|
|
39
40
|
var import_protocol = require("./protocol.js");
|
|
41
|
+
var import_voiceAgentTracing = require("../tracing/voiceAgentTracing.js");
|
|
42
|
+
const projectTracingConfigs = /* @__PURE__ */ new WeakMap();
|
|
40
43
|
const defaultCredentialScope = "https://ai.azure.com/.default";
|
|
41
44
|
const voiceAgentsPreview = "VoiceAgents=V1Preview";
|
|
45
|
+
const reservedQueryParameters = /* @__PURE__ */ new Set([
|
|
46
|
+
"api-version",
|
|
47
|
+
"agent_session_id",
|
|
48
|
+
"store",
|
|
49
|
+
"transport",
|
|
50
|
+
"x-agent-version-override",
|
|
51
|
+
"x-ms-client-sdk",
|
|
52
|
+
"authorization",
|
|
53
|
+
"api-key",
|
|
54
|
+
"foundry_features",
|
|
55
|
+
"foundry-features",
|
|
56
|
+
"client-request-id",
|
|
57
|
+
"x-ms-client-request-id",
|
|
58
|
+
"structured_input",
|
|
59
|
+
"structured_inputs",
|
|
60
|
+
"x-ms-voice-structured-inputs"
|
|
61
|
+
]);
|
|
42
62
|
const KnownVoiceAgentConnectionState = {
|
|
43
63
|
Disconnected: "disconnected",
|
|
44
64
|
Connecting: "connecting",
|
|
@@ -66,26 +86,49 @@ class VoiceAgentRealtimeClient {
|
|
|
66
86
|
if (!agentName.trim()) {
|
|
67
87
|
throw new TypeError("agentName must not be empty.");
|
|
68
88
|
}
|
|
69
|
-
const
|
|
70
|
-
const connection = new VoiceAgentConnectionImpl(
|
|
89
|
+
const url = buildWebSocketUrl(
|
|
71
90
|
normalizeEndpoint(this.endpoint),
|
|
72
91
|
agentName,
|
|
73
|
-
this.
|
|
74
|
-
|
|
75
|
-
options,
|
|
76
|
-
factory
|
|
92
|
+
this.options.apiVersion,
|
|
93
|
+
options
|
|
77
94
|
);
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
const serializedStructuredInputs = options.structuredInputs ? JSON.stringify(options.structuredInputs) : void 0;
|
|
96
|
+
const tracingConfig = projectTracingConfigs.get(this);
|
|
97
|
+
const tracing = tracingConfig?.enabled ? new import_voiceAgentTracing.VoiceAgentRealtimeTracing(this.endpoint, tracingConfig, options.transport) : void 0;
|
|
98
|
+
try {
|
|
99
|
+
const factory = this.options.webSocketFactory ?? (await import("../webSocketTransport.js")).createDefaultVoiceAgentWebSocketFactory();
|
|
100
|
+
const connection = new VoiceAgentConnectionImpl(
|
|
101
|
+
url,
|
|
102
|
+
agentName,
|
|
103
|
+
this.credential,
|
|
104
|
+
this.options,
|
|
105
|
+
options,
|
|
106
|
+
serializedStructuredInputs,
|
|
107
|
+
factory,
|
|
108
|
+
tracing
|
|
109
|
+
);
|
|
110
|
+
await connection.open();
|
|
111
|
+
return connection;
|
|
112
|
+
} catch (error) {
|
|
113
|
+
tracing?.close(void 0, false, error);
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
80
116
|
}
|
|
81
117
|
}
|
|
118
|
+
function createVoiceAgentRealtimeClient(endpoint, credential, options, tracingConfig) {
|
|
119
|
+
const client = new VoiceAgentRealtimeClient(endpoint, credential, options);
|
|
120
|
+
if (tracingConfig) projectTracingConfigs.set(client, tracingConfig);
|
|
121
|
+
return client;
|
|
122
|
+
}
|
|
82
123
|
class VoiceAgentConnectionImpl {
|
|
83
|
-
constructor(
|
|
84
|
-
this.
|
|
124
|
+
constructor(url, agentName, credential, clientOptions, connectOptions, serializedStructuredInputs, factory, tracing) {
|
|
125
|
+
this.url = url;
|
|
85
126
|
this.agentName = agentName;
|
|
86
127
|
this.credential = credential;
|
|
87
128
|
this.clientOptions = clientOptions;
|
|
88
129
|
this.connectOptions = connectOptions;
|
|
130
|
+
this.serializedStructuredInputs = serializedStructuredInputs;
|
|
131
|
+
this.tracing = tracing;
|
|
89
132
|
this.events = new import_asyncQueue.AsyncQueue(1e4, {
|
|
90
133
|
onOverflow: (error) => this.handleEventQueueOverflow(error)
|
|
91
134
|
});
|
|
@@ -99,11 +142,13 @@ class VoiceAgentConnectionImpl {
|
|
|
99
142
|
onError: (error) => this.handleTransportError(error)
|
|
100
143
|
});
|
|
101
144
|
}
|
|
102
|
-
|
|
145
|
+
url;
|
|
103
146
|
agentName;
|
|
104
147
|
credential;
|
|
105
148
|
clientOptions;
|
|
106
149
|
connectOptions;
|
|
150
|
+
serializedStructuredInputs;
|
|
151
|
+
tracing;
|
|
107
152
|
events;
|
|
108
153
|
transport;
|
|
109
154
|
closePromise;
|
|
@@ -147,17 +192,13 @@ class VoiceAgentConnectionImpl {
|
|
|
147
192
|
}
|
|
148
193
|
try {
|
|
149
194
|
await this.transport.connect({
|
|
150
|
-
url:
|
|
151
|
-
this.endpoint,
|
|
152
|
-
this.agentName,
|
|
153
|
-
this.clientOptions.apiVersion,
|
|
154
|
-
this.connectOptions
|
|
155
|
-
),
|
|
195
|
+
url: this.url,
|
|
156
196
|
protocols: ["realtime"],
|
|
157
|
-
headers: buildHeaders(token, this.clientOptions, this.
|
|
197
|
+
headers: buildHeaders(token, this.clientOptions, this.serializedStructuredInputs),
|
|
158
198
|
connectionTimeoutInMs: this.connectOptions.connectionTimeoutInMs ?? this.clientOptions.connectionTimeoutInMs,
|
|
159
199
|
abortSignal: this.connectOptions.abortSignal
|
|
160
200
|
});
|
|
201
|
+
this.tracing?.opened();
|
|
161
202
|
this.setState(KnownVoiceAgentConnectionState.Connected);
|
|
162
203
|
import_logger.logger.info("Connected to voice agent", { agentName: this.agentName });
|
|
163
204
|
} catch (error) {
|
|
@@ -181,9 +222,14 @@ class VoiceAgentConnectionImpl {
|
|
|
181
222
|
if (options.abortSignal?.aborted) {
|
|
182
223
|
throw new import_errors.VoiceAgentConnectionError("Send operation was cancelled.", "operationCancelled");
|
|
183
224
|
}
|
|
225
|
+
let reservation = void 0;
|
|
184
226
|
try {
|
|
185
|
-
|
|
227
|
+
const serialized = (0, import_protocol.serializeVoiceAgentClientEvent)(event);
|
|
228
|
+
reservation = this.tracing?.reserveSend(event);
|
|
229
|
+
await this.transport.send(serialized, options.abortSignal);
|
|
230
|
+
this.tracing?.sent(event, reservation);
|
|
186
231
|
} catch (error) {
|
|
232
|
+
this.tracing?.sendFailed(error, reservation);
|
|
187
233
|
if (error instanceof import_errors.VoiceAgentProtocolError) {
|
|
188
234
|
throw error;
|
|
189
235
|
}
|
|
@@ -306,7 +352,9 @@ class VoiceAgentConnectionImpl {
|
|
|
306
352
|
}
|
|
307
353
|
handleMessage(data) {
|
|
308
354
|
try {
|
|
309
|
-
|
|
355
|
+
const event = (0, import_protocol.deserializeVoiceAgentServerEvent)(data);
|
|
356
|
+
this.tracing?.received(event);
|
|
357
|
+
this.events.enqueue(event);
|
|
310
358
|
} catch (error) {
|
|
311
359
|
const protocolError = error instanceof import_errors.VoiceAgentProtocolError ? error : new import_errors.VoiceAgentProtocolError("Failed to process a voice-agent event.", { cause: error });
|
|
312
360
|
this.finish(1002, protocolError.message, false, protocolError);
|
|
@@ -354,6 +402,7 @@ class VoiceAgentConnectionImpl {
|
|
|
354
402
|
return;
|
|
355
403
|
}
|
|
356
404
|
this.finished = true;
|
|
405
|
+
this.tracing?.close(code, wasClean, error);
|
|
357
406
|
if (error) {
|
|
358
407
|
this.events.fail(error);
|
|
359
408
|
} else {
|
|
@@ -399,12 +448,30 @@ function normalizeEndpoint(endpoint) {
|
|
|
399
448
|
"endpoint must use https; a plaintext endpoint would send the bearer token over an unencrypted connection."
|
|
400
449
|
);
|
|
401
450
|
}
|
|
402
|
-
return url.toString()
|
|
451
|
+
return url.toString();
|
|
403
452
|
}
|
|
404
453
|
function buildWebSocketUrl(endpoint, agentName, apiVersion, options) {
|
|
405
454
|
const url = new URL(endpoint);
|
|
406
455
|
url.protocol = "wss:";
|
|
407
|
-
url.pathname = `${url.pathname.replace(
|
|
456
|
+
url.pathname = `${url.pathname.replace(/\/+$/, "")}/agents/${encodeURIComponent(agentName)}/endpoint/protocols/voice`;
|
|
457
|
+
if (options.query !== void 0 && (options.query === null || typeof options.query !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(options.query)))) {
|
|
458
|
+
throw new TypeError("query must be a record of query parameters.");
|
|
459
|
+
}
|
|
460
|
+
for (const [name, value] of Object.entries(options.query ?? {})) {
|
|
461
|
+
const normalizedName = name.toLowerCase();
|
|
462
|
+
if (reservedQueryParameters.has(normalizedName) || normalizedName.startsWith("h-")) {
|
|
463
|
+
throw new TypeError(`Query parameter "${name}" is reserved; use the SDK's typed options.`);
|
|
464
|
+
}
|
|
465
|
+
if (value === void 0) {
|
|
466
|
+
url.searchParams.delete(name);
|
|
467
|
+
} else if (typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value)) {
|
|
468
|
+
url.searchParams.set(name, String(value));
|
|
469
|
+
} else {
|
|
470
|
+
throw new TypeError(
|
|
471
|
+
`Query parameter "${name}" must be a string, boolean, finite number, or undefined.`
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
408
475
|
url.searchParams.set("api-version", apiVersion);
|
|
409
476
|
url.searchParams.set("x-ms-client-sdk", `azsdk-js-ai-projects/${import_constants.SDK_VERSION}`);
|
|
410
477
|
if (options.agentSessionId) {
|
|
@@ -416,9 +483,12 @@ function buildWebSocketUrl(endpoint, agentName, apiVersion, options) {
|
|
|
416
483
|
if (options.agentVersionOverride) {
|
|
417
484
|
url.searchParams.set("x-agent-version-override", options.agentVersionOverride);
|
|
418
485
|
}
|
|
486
|
+
if (options.transport) {
|
|
487
|
+
url.searchParams.set("transport", options.transport);
|
|
488
|
+
}
|
|
419
489
|
return url.toString();
|
|
420
490
|
}
|
|
421
|
-
function buildHeaders(token, clientOptions,
|
|
491
|
+
function buildHeaders(token, clientOptions, serializedStructuredInputs) {
|
|
422
492
|
const sdkUserAgent = `azsdk-js-ai-projects/${import_constants.SDK_VERSION}`;
|
|
423
493
|
const headers = {
|
|
424
494
|
authorization: `Bearer ${token}`,
|
|
@@ -427,8 +497,8 @@ function buildHeaders(token, clientOptions, connectOptions) {
|
|
|
427
497
|
"x-ms-client-sdk": sdkUserAgent,
|
|
428
498
|
"user-agent": clientOptions.userAgentPrefix ? `${clientOptions.userAgentPrefix} ${sdkUserAgent}` : sdkUserAgent
|
|
429
499
|
};
|
|
430
|
-
if (
|
|
431
|
-
headers["x-ms-voice-structured-inputs"] =
|
|
500
|
+
if (serializedStructuredInputs !== void 0) {
|
|
501
|
+
headers["x-ms-voice-structured-inputs"] = serializedStructuredInputs;
|
|
432
502
|
}
|
|
433
503
|
return headers;
|
|
434
504
|
}
|
|
@@ -438,6 +508,7 @@ function createRequestId() {
|
|
|
438
508
|
// Annotate the CommonJS export names for ESM import in node:
|
|
439
509
|
0 && (module.exports = {
|
|
440
510
|
KnownVoiceAgentConnectionState,
|
|
441
|
-
VoiceAgentRealtimeClient
|
|
511
|
+
VoiceAgentRealtimeClient,
|
|
512
|
+
createVoiceAgentRealtimeClient
|
|
442
513
|
});
|
|
443
514
|
//# sourceMappingURL=voiceAgentRealtimeClient.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/realtime/voiceAgentRealtimeClient.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport { uint8ArrayToString } from \"@azure/core-util\";\nimport { SDK_VERSION } from \"../constants.js\";\nimport type {\n RealtimeConversationItemUnion,\n VoiceAgentClientEvent,\n VoiceAgentResponseCreateParams,\n VoiceAgentSessionUpdateConfig,\n} from \"../models/models.js\";\nimport { logger } from \"../logger.js\";\nimport { AsyncQueue } from \"./asyncQueue.js\";\nimport {\n VoiceAgentAuthenticationError,\n VoiceAgentConnectionError,\n VoiceAgentProtocolError,\n} from \"./errors.js\";\nimport { deserializeVoiceAgentServerEvent, serializeVoiceAgentClientEvent } from \"./protocol.js\";\nimport type { VoiceAgentRealtimeEvent } from \"./events.js\";\nimport type {\n VoiceAgentWebSocketFactory,\n VoiceAgentWebSocketTransport,\n} from \"./webSocketTransportLike.js\";\n\nconst defaultCredentialScope = \"https://ai.azure.com/.default\";\nconst voiceAgentsPreview = \"VoiceAgents=V1Preview\";\n\n/** Known values of {@link VoiceAgentConnectionState} reported by a voice-agent realtime connection. */\nexport const KnownVoiceAgentConnectionState = {\n Disconnected: \"disconnected\",\n Connecting: \"connecting\",\n Connected: \"connected\",\n Closing: \"closing\",\n} as const;\n\n/** Connection states reported by a voice-agent realtime connection. */\nexport type VoiceAgentConnectionState =\n (typeof KnownVoiceAgentConnectionState)[keyof typeof KnownVoiceAgentConnectionState];\n\n/** Called when a voice-agent connection changes state. */\nexport type VoiceAgentConnectionStateChangedHandler = (\n state: VoiceAgentConnectionState,\n previousState: VoiceAgentConnectionState,\n) => void;\n\n/** Options for the Voice Agents realtime client. */\nexport interface VoiceAgentRealtimeClientOptions {\n /** Microsoft Entra scopes used to acquire a WebSocket access token. */\n credentialScopes?: string | string[];\n /** Default connection timeout in milliseconds. */\n connectionTimeoutInMs?: number;\n /** API version sent during the WebSocket upgrade. */\n apiVersion?: string;\n /** Prefix added to the SDK user-agent value in Node.js. */\n userAgentPrefix?: string;\n /**\n * Overrides the transport used to establish the realtime WebSocket connection. Defaults to the\n * platform transport (`ws` in Node.js, the browser's native `WebSocket` in browsers/React Native).\n * Provide a custom factory to customize connection establishment.\n */\n webSocketFactory?: VoiceAgentWebSocketFactory;\n}\n\n/** Options for connecting the realtime client to a voice agent. */\nexport interface VoiceAgentRealtimeClientConnectOptions extends OperationOptions {\n /** Identifier used to correlate the voice session. */\n agentSessionId?: string;\n /** Overrides whether the conversation created by this session is persisted. */\n store?: boolean;\n /** Selects a specific immutable agent version. */\n agentVersionOverride?: string;\n /** Values used to render the agent's structured prompt inputs. */\n structuredInputs?: Record<string, unknown>;\n /** Overrides the client connection timeout in milliseconds. */\n connectionTimeoutInMs?: number;\n /** Cancels the connection attempt. */\n abortSignal?: AbortSignalLike;\n /** Receives connection-state transitions. */\n onConnectionStateChange?: VoiceAgentConnectionStateChangedHandler;\n}\n\n/** Result supplied when a voice-agent connection closes. */\nexport interface VoiceAgentCloseResult {\n /** WebSocket close code. */\n code: number;\n /** WebSocket close reason. */\n reason: string;\n /** Whether the peer completed a normal WebSocket close handshake. */\n wasClean: boolean;\n /** Transport or protocol error associated with the close, if any. */\n error?: Error;\n}\n\n/** Options shared by realtime send operations. */\nexport interface VoiceAgentSendOptions extends OperationOptions {}\n\n/** Options shared by operations that build a protocol event on the caller's behalf. */\nexport interface VoiceAgentEventOptions extends VoiceAgentSendOptions {\n /** Client-generated event identifier. */\n eventId?: string;\n}\n\n/** Options shared by operations that add a conversation item and, by default, request a response. */\nexport interface VoiceAgentSendItemOptions extends VoiceAgentEventOptions {\n /** Whether to request a response after adding the item. Defaults to true. */\n createResponse?: boolean;\n}\n\n/** Options for sending text input. */\nexport interface VoiceAgentSendTextOptions extends VoiceAgentSendItemOptions {\n /** Item after which the new text item is inserted. */\n previousItemId?: string;\n}\n\n/** Options for returning a function result. */\nexport interface VoiceAgentSendToolOutputOptions extends VoiceAgentSendItemOptions {}\n\n/** Options for updating the live session. */\nexport interface VoiceAgentSessionUpdateOptions extends VoiceAgentEventOptions {}\n\n/** Options for creating a response. */\nexport interface VoiceAgentResponseOptions extends VoiceAgentEventOptions {\n /** Response-specific configuration. */\n response?: VoiceAgentResponseCreateParams;\n}\n\n/** Options for cancelling a response. */\nexport interface VoiceAgentCancelResponseOptions extends VoiceAgentEventOptions {\n /** Specific response to cancel. The active default-conversation response is used when omitted. */\n responseId?: string;\n}\n\n/**\n * A connected, bidirectional voice-agent stream.\n *\n * Supports exactly one `for await` iteration over server events; a second attempt throws.\n * Exiting the loop early (`break`, `return`, or an uncaught error in the loop body) closes\n * the connection as a side effect.\n * Unrecognized server event types are delivered as {@link VoiceAgentUnknownEvent} without\n * interrupting the stream. Malformed events still fail the iteration with a protocol error.\n */\nexport interface VoiceAgentConnection extends AsyncIterable<VoiceAgentRealtimeEvent> {\n /** Current connection state. */\n readonly state: VoiceAgentConnectionState;\n /** Resolves once the connection is closed. */\n readonly closed: Promise<VoiceAgentCloseResult>;\n /** Sends any generated client protocol event. */\n sendEvent(event: VoiceAgentClientEvent, options?: VoiceAgentSendOptions): Promise<void>;\n /** Updates supported live-session settings. */\n configureSession(\n session: VoiceAgentSessionUpdateConfig,\n options?: VoiceAgentSessionUpdateOptions,\n ): Promise<void>;\n /** Adds a user text item and, by default, requests a response. */\n sendText(text: string, options?: VoiceAgentSendTextOptions): Promise<void>;\n /** Appends base64-encoded audio bytes to the input buffer. */\n sendAudio(audio: Uint8Array | ArrayBuffer, options?: VoiceAgentEventOptions): Promise<void>;\n /** Commits buffered input audio. */\n commitAudio(options?: VoiceAgentEventOptions): Promise<void>;\n /** Clears buffered input audio. */\n clearInputAudio(options?: VoiceAgentEventOptions): Promise<void>;\n /** Clears pending output audio at the service. */\n clearOutputAudio(options?: VoiceAgentEventOptions): Promise<void>;\n /** Returns a client-executed function result to the agent. */\n sendToolOutput(\n callId: string,\n output: string,\n options?: VoiceAgentSendToolOutputOptions,\n ): Promise<void>;\n /** Requests a new response. */\n requestResponse(options?: VoiceAgentResponseOptions): Promise<void>;\n /** Cancels an in-progress response. */\n cancelResponse(options?: VoiceAgentCancelResponseOptions): Promise<void>;\n /** Gracefully closes the WebSocket connection. */\n close(code?: number, reason?: string): Promise<void>;\n /** Releases the connection. Equivalent to close(). */\n dispose(): Promise<void>;\n}\n\n/** Client for establishing realtime sessions with managed Foundry voice agents. */\nexport class VoiceAgentRealtimeClient {\n private readonly endpoint: string;\n private readonly credential: TokenCredential;\n private readonly options: Required<\n Pick<VoiceAgentRealtimeClientOptions, \"connectionTimeoutInMs\" | \"apiVersion\">\n > &\n VoiceAgentRealtimeClientOptions;\n\n public constructor(\n endpoint: string,\n credential: TokenCredential,\n options: VoiceAgentRealtimeClientOptions = {},\n ) {\n // Endpoint validation (https-only) is deferred to connect() so that merely constructing an\n // AIProjectClient (which eagerly creates this client) doesn't reject callers who intentionally\n // use an insecure local endpoint for the REST surface and never touch realtime connections.\n if (!endpoint.trim()) {\n throw new TypeError(\"endpoint must not be empty.\");\n }\n this.endpoint = endpoint;\n this.credential = credential;\n this.options = {\n ...options,\n connectionTimeoutInMs: options.connectionTimeoutInMs ?? 30_000,\n apiVersion: options.apiVersion ?? \"v1\",\n };\n }\n\n /** Establishes a WebSocket connection to a managed voice agent. */\n public async connect(\n agentName: string,\n options: VoiceAgentRealtimeClientConnectOptions = {},\n ): Promise<VoiceAgentConnection> {\n if (!agentName.trim()) {\n throw new TypeError(\"agentName must not be empty.\");\n }\n const factory =\n this.options.webSocketFactory ??\n (await import(\"#platform/webSocketTransport\")).createDefaultVoiceAgentWebSocketFactory();\n const connection = new VoiceAgentConnectionImpl(\n normalizeEndpoint(this.endpoint),\n agentName,\n this.credential,\n this.options,\n options,\n factory,\n );\n await connection.open();\n return connection;\n }\n}\n\nclass VoiceAgentConnectionImpl implements VoiceAgentConnection {\n private readonly events: AsyncQueue<VoiceAgentRealtimeEvent>;\n private readonly transport: VoiceAgentWebSocketTransport;\n private readonly closePromise: Promise<VoiceAgentCloseResult>;\n private resolveClose!: (result: VoiceAgentCloseResult) => void;\n private currentState: VoiceAgentConnectionState = KnownVoiceAgentConnectionState.Disconnected;\n private iteratorStarted = false;\n private finished = false;\n\n public constructor(\n private readonly endpoint: string,\n private readonly agentName: string,\n private readonly credential: TokenCredential,\n private readonly clientOptions: VoiceAgentRealtimeClientOptions & {\n connectionTimeoutInMs: number;\n apiVersion: string;\n },\n private readonly connectOptions: VoiceAgentRealtimeClientConnectOptions,\n factory: VoiceAgentWebSocketFactory,\n ) {\n this.events = new AsyncQueue<VoiceAgentRealtimeEvent>(10_000, {\n onOverflow: (error) => this.handleEventQueueOverflow(error),\n });\n this.transport = factory.create();\n this.closePromise = new Promise<VoiceAgentCloseResult>((resolve) => {\n this.resolveClose = resolve;\n });\n this.transport.setHandlers({\n onMessage: (data) => this.handleMessage(data),\n onClose: (code, reason, wasClean) => this.handleClose(code, reason, wasClean),\n onError: (error) => this.handleTransportError(error),\n });\n }\n\n public get state(): VoiceAgentConnectionState {\n return this.currentState;\n }\n\n public get closed(): Promise<VoiceAgentCloseResult> {\n return this.closePromise;\n }\n\n public async open(): Promise<void> {\n this.setState(KnownVoiceAgentConnectionState.Connecting);\n let token: string;\n try {\n const accessToken = await this.credential.getToken(\n this.clientOptions.credentialScopes ?? defaultCredentialScope,\n { abortSignal: this.connectOptions.abortSignal },\n );\n if (!accessToken) {\n throw new VoiceAgentAuthenticationError(\"The credential returned no access token.\");\n }\n token = accessToken.token;\n } catch (error) {\n if (this.connectOptions.abortSignal?.aborted) {\n const cancelledError = new VoiceAgentConnectionError(\n \"Voice-agent connection was cancelled.\",\n \"operationCancelled\",\n { cause: error },\n );\n this.finish(1006, cancelledError.message, false, cancelledError);\n throw cancelledError;\n }\n const authenticationError =\n error instanceof VoiceAgentAuthenticationError\n ? error\n : new VoiceAgentAuthenticationError(\"Failed to acquire a Voice Agents access token.\", {\n cause: error,\n });\n this.finish(1006, authenticationError.message, false, authenticationError);\n throw authenticationError;\n }\n\n try {\n await this.transport.connect({\n url: buildWebSocketUrl(\n this.endpoint,\n this.agentName,\n this.clientOptions.apiVersion,\n this.connectOptions,\n ),\n protocols: [\"realtime\"],\n headers: buildHeaders(token, this.clientOptions, this.connectOptions),\n connectionTimeoutInMs:\n this.connectOptions.connectionTimeoutInMs ?? this.clientOptions.connectionTimeoutInMs,\n abortSignal: this.connectOptions.abortSignal,\n });\n this.setState(KnownVoiceAgentConnectionState.Connected);\n logger.info(\"Connected to voice agent\", { agentName: this.agentName });\n } catch (error) {\n const cancelled = this.connectOptions.abortSignal?.aborted === true;\n const connectionError = new VoiceAgentConnectionError(\n cancelled\n ? \"Voice-agent connection was cancelled.\"\n : \"Failed to connect to the voice agent.\",\n cancelled ? \"operationCancelled\" : \"connectionFailed\",\n { cause: error },\n );\n this.finish(1006, connectionError.message, false, connectionError);\n throw connectionError;\n }\n }\n\n public async sendEvent(\n event: VoiceAgentClientEvent,\n options: VoiceAgentSendOptions = {},\n ): Promise<void> {\n if (this.state !== KnownVoiceAgentConnectionState.Connected) {\n throw new VoiceAgentConnectionError(\n `Cannot send while the connection is ${this.state}.`,\n \"invalidState\",\n );\n }\n if (options.abortSignal?.aborted) {\n throw new VoiceAgentConnectionError(\"Send operation was cancelled.\", \"operationCancelled\");\n }\n\n try {\n await this.transport.send(serializeVoiceAgentClientEvent(event), options.abortSignal);\n } catch (error) {\n if (error instanceof VoiceAgentProtocolError) {\n throw error;\n }\n throw new VoiceAgentConnectionError(\"Failed to send a voice-agent event.\", \"sendFailed\", {\n cause: error,\n });\n }\n }\n\n public configureSession(\n session: VoiceAgentSessionUpdateConfig,\n options: VoiceAgentSessionUpdateOptions = {},\n ): Promise<void> {\n return this.sendEvent({ type: \"session.update\", event_id: options.eventId, session }, options);\n }\n\n public async sendText(text: string, options: VoiceAgentSendTextOptions = {}): Promise<void> {\n await this.sendEvent(\n {\n type: \"conversation.item.create\",\n event_id: options.eventId,\n previous_item_id: options.previousItemId,\n // `RealtimeConversationItemUnion` no longer enumerates a \"message\" item in the generated\n // models, but the wire protocol still accepts this shape; see the TypeSpec regeneration\n // report for details.\n item: {\n type: \"message\",\n role: \"user\",\n content: [{ type: \"input_text\", text }],\n } as unknown as RealtimeConversationItemUnion,\n },\n options,\n );\n if (options.createResponse !== false) {\n await this.requestResponse({ abortSignal: options.abortSignal });\n }\n }\n\n public sendAudio(\n audio: Uint8Array | ArrayBuffer,\n options: VoiceAgentEventOptions = {},\n ): Promise<void> {\n const bytes = audio instanceof Uint8Array ? audio : new Uint8Array(audio);\n return this.sendEvent(\n {\n type: \"input_audio_buffer.append\",\n event_id: options.eventId,\n audio: uint8ArrayToString(bytes, \"base64\"),\n },\n options,\n );\n }\n\n public commitAudio(options: VoiceAgentEventOptions = {}): Promise<void> {\n return this.sendEvent(\n { type: \"input_audio_buffer.commit\", event_id: options.eventId },\n options,\n );\n }\n\n public clearInputAudio(options: VoiceAgentEventOptions = {}): Promise<void> {\n return this.sendEvent({ type: \"input_audio_buffer.clear\", event_id: options.eventId }, options);\n }\n\n public clearOutputAudio(options: VoiceAgentEventOptions = {}): Promise<void> {\n return this.sendEvent(\n { type: \"output_audio_buffer.clear\", event_id: options.eventId },\n options,\n );\n }\n\n public async sendToolOutput(\n callId: string,\n output: string,\n options: VoiceAgentSendToolOutputOptions = {},\n ): Promise<void> {\n await this.sendEvent(\n {\n type: \"conversation.item.create\",\n event_id: options.eventId,\n item: { type: \"function_call_output\", call_id: callId, output },\n },\n options,\n );\n if (options.createResponse !== false) {\n await this.requestResponse({ abortSignal: options.abortSignal });\n }\n }\n\n public requestResponse(options: VoiceAgentResponseOptions = {}): Promise<void> {\n return this.sendEvent(\n { type: \"response.create\", event_id: options.eventId, response: options.response },\n options,\n );\n }\n\n public cancelResponse(options: VoiceAgentCancelResponseOptions = {}): Promise<void> {\n return this.sendEvent(\n { type: \"response.cancel\", event_id: options.eventId, response_id: options.responseId },\n options,\n );\n }\n\n public async close(\n code = 1000,\n reason = \"Client closed the voice-agent connection.\",\n ): Promise<void> {\n if (\n this.state === KnownVoiceAgentConnectionState.Disconnected ||\n this.state === KnownVoiceAgentConnectionState.Closing\n ) {\n await this.closed;\n return;\n }\n this.setState(KnownVoiceAgentConnectionState.Closing);\n try {\n await this.transport.close(code, reason);\n } finally {\n this.finish(code, reason, false);\n }\n }\n\n public dispose(): Promise<void> {\n return this.close();\n }\n\n public async *[Symbol.asyncIterator](): AsyncIterator<VoiceAgentRealtimeEvent> {\n if (this.iteratorStarted) {\n throw new VoiceAgentConnectionError(\n \"A voice-agent connection supports one active event iterator.\",\n \"invalidState\",\n );\n }\n this.iteratorStarted = true;\n try {\n while (true) {\n const result = await this.events.next();\n if (result.done) {\n return;\n }\n yield result.value;\n }\n } finally {\n if (this.state === KnownVoiceAgentConnectionState.Connected) {\n await this.close();\n }\n }\n }\n\n private handleMessage(data: string | ArrayBuffer): void {\n try {\n this.events.enqueue(deserializeVoiceAgentServerEvent(data));\n } catch (error) {\n const protocolError =\n error instanceof VoiceAgentProtocolError\n ? error\n : new VoiceAgentProtocolError(\"Failed to process a voice-agent event.\", { cause: error });\n // finish() closes the transport itself, so no additional close is needed here.\n this.finish(1002, protocolError.message, false, protocolError);\n }\n }\n\n private handleEventQueueOverflow(cause: Error): void {\n if (this.finished) {\n return;\n }\n const error = new VoiceAgentConnectionError(cause.message, \"connectionClosed\", {\n cause,\n });\n this.finish(1006, error.message, false, error);\n }\n\n private handleClose(code: number, reason: string, wasClean: boolean): void {\n if (this.finished) {\n return;\n }\n if (wasClean || this.state === KnownVoiceAgentConnectionState.Closing) {\n this.finish(code, reason, wasClean);\n } else {\n const error = new VoiceAgentConnectionError(\n `Voice-agent connection closed unexpectedly (${code}${reason ? `: ${reason}` : \"\"}).`,\n \"connectionClosed\",\n { closeCode: code },\n );\n this.finish(code, reason, false, error);\n }\n }\n\n private handleTransportError(cause: Error): void {\n if (this.finished) {\n return;\n }\n const error = new VoiceAgentConnectionError(\n \"Voice-agent WebSocket transport failed.\",\n \"connectionClosed\",\n {\n cause,\n },\n );\n this.finish(1006, cause.message, false, error);\n }\n\n private finish(code: number, reason: string, wasClean: boolean, error?: Error): void {\n if (this.finished) {\n return;\n }\n this.finished = true;\n if (error) {\n this.events.fail(error);\n } else {\n this.events.close();\n }\n this.setState(KnownVoiceAgentConnectionState.Disconnected);\n this.resolveClose({ code, reason, wasClean, error });\n logger.info(\"Voice-agent connection closed\", { code, reason, wasClean });\n // Ensure the socket never outlives the connection, even on paths that never closed it\n // themselves. Not awaited: finish() is synchronous because its callers are.\n void this.closeTransportQuietly(code, reason);\n }\n\n /**\n * Closes the transport, logging rather than rejecting: this is best-effort cleanup running after\n * the connection has already settled. A no-op if the transport is already closed.\n */\n private async closeTransportQuietly(code: number, reason: string): Promise<void> {\n try {\n await this.transport.close(code, reason);\n } catch (error) {\n logger.warning(\"Failed to close the voice-agent transport\", { error });\n }\n }\n\n private setState(state: VoiceAgentConnectionState): void {\n if (state === this.currentState) {\n return;\n }\n const previousState = this.currentState;\n this.currentState = state;\n try {\n this.connectOptions.onConnectionStateChange?.(state, previousState);\n } catch (error) {\n // A throwing caller callback must never interrupt connection lifecycle/cleanup.\n logger.warning(\"onConnectionStateChange callback threw an error\", { error });\n }\n }\n}\n\nfunction normalizeEndpoint(endpoint: string): string {\n const normalized = endpoint.trim();\n if (!normalized) {\n throw new TypeError(\"endpoint must not be empty.\");\n }\n const url = new URL(normalized.includes(\"://\") ? normalized : `https://${normalized}`);\n if (url.protocol !== \"https:\") {\n throw new TypeError(\n \"endpoint must use https; a plaintext endpoint would send the bearer token over an unencrypted connection.\",\n );\n }\n return url.toString().replace(/\\/$/, \"\");\n}\n\nfunction buildWebSocketUrl(\n endpoint: string,\n agentName: string,\n apiVersion: string,\n options: VoiceAgentRealtimeClientConnectOptions,\n): string {\n const url = new URL(endpoint);\n url.protocol = \"wss:\";\n url.pathname = `${url.pathname.replace(/\\/$/, \"\")}/agents/${encodeURIComponent(agentName)}/endpoint/protocols/voice`;\n url.searchParams.set(\"api-version\", apiVersion);\n url.searchParams.set(\"x-ms-client-sdk\", `azsdk-js-ai-projects/${SDK_VERSION}`);\n if (options.agentSessionId) {\n url.searchParams.set(\"agent_session_id\", options.agentSessionId);\n }\n if (options.store !== undefined) {\n url.searchParams.set(\"store\", String(options.store));\n }\n if (options.agentVersionOverride) {\n url.searchParams.set(\"x-agent-version-override\", options.agentVersionOverride);\n }\n return url.toString();\n}\n\nfunction buildHeaders(\n token: string,\n clientOptions: VoiceAgentRealtimeClientOptions,\n connectOptions: VoiceAgentRealtimeClientConnectOptions,\n): Record<string, string> {\n const sdkUserAgent = `azsdk-js-ai-projects/${SDK_VERSION}`;\n const headers: Record<string, string> = {\n authorization: `Bearer ${token}`,\n \"foundry-features\": voiceAgentsPreview,\n \"x-ms-client-request-id\": createRequestId(),\n \"x-ms-client-sdk\": sdkUserAgent,\n \"user-agent\": clientOptions.userAgentPrefix\n ? `${clientOptions.userAgentPrefix} ${sdkUserAgent}`\n : sdkUserAgent,\n };\n if (connectOptions.structuredInputs) {\n headers[\"x-ms-voice-structured-inputs\"] = JSON.stringify(connectOptions.structuredInputs);\n }\n return headers;\n}\n\nfunction createRequestId(): string {\n return (\n globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`\n );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,uBAAmC;AACnC,uBAA4B;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport { uint8ArrayToString } from \"@azure/core-util\";\nimport { SDK_VERSION } from \"../constants.js\";\nimport type {\n RealtimeConversationItemUnion,\n VoiceAgentClientEvent,\n VoiceAgentResponseCreateParams,\n VoiceAgentSessionUpdateConfig,\n VoiceAgentTransport,\n} from \"../models/models.js\";\nimport { logger } from \"../logger.js\";\nimport { AsyncQueue } from \"./asyncQueue.js\";\nimport {\n VoiceAgentAuthenticationError,\n VoiceAgentConnectionError,\n VoiceAgentProtocolError,\n} from \"./errors.js\";\nimport { deserializeVoiceAgentServerEvent, serializeVoiceAgentClientEvent } from \"./protocol.js\";\nimport type { VoiceAgentRealtimeEvent } from \"./events.js\";\nimport type {\n VoiceAgentWebSocketFactory,\n VoiceAgentWebSocketTransport,\n} from \"./webSocketTransportLike.js\";\nimport type { ResolvedTracingConfig } from \"../tracing/configuration.js\";\nimport { VoiceAgentRealtimeTracing } from \"../tracing/voiceAgentTracing.js\";\n\n// Project-owned configuration stays private; the standalone constructor/options are unchanged.\nconst projectTracingConfigs = new WeakMap<VoiceAgentRealtimeClient, ResolvedTracingConfig>();\n\nconst defaultCredentialScope = \"https://ai.azure.com/.default\";\nconst voiceAgentsPreview = \"VoiceAgents=V1Preview\";\nconst reservedQueryParameters = new Set([\n \"api-version\",\n \"agent_session_id\",\n \"store\",\n \"transport\",\n \"x-agent-version-override\",\n \"x-ms-client-sdk\",\n \"authorization\",\n \"api-key\",\n \"foundry_features\",\n \"foundry-features\",\n \"client-request-id\",\n \"x-ms-client-request-id\",\n \"structured_input\",\n \"structured_inputs\",\n \"x-ms-voice-structured-inputs\",\n]);\n\n/** Known values of {@link VoiceAgentConnectionState} reported by a voice-agent realtime connection. */\nexport const KnownVoiceAgentConnectionState = {\n Disconnected: \"disconnected\",\n Connecting: \"connecting\",\n Connected: \"connected\",\n Closing: \"closing\",\n} as const;\n\n/** Connection states reported by a voice-agent realtime connection. */\nexport type VoiceAgentConnectionState =\n (typeof KnownVoiceAgentConnectionState)[keyof typeof KnownVoiceAgentConnectionState];\n\n/** Called when a voice-agent connection changes state. */\nexport type VoiceAgentConnectionStateChangedHandler = (\n state: VoiceAgentConnectionState,\n previousState: VoiceAgentConnectionState,\n) => void;\n\n/** Options for the Voice Agents realtime client. */\nexport interface VoiceAgentRealtimeClientOptions {\n /** Microsoft Entra scopes used to acquire a WebSocket access token. */\n credentialScopes?: string | string[];\n /** Default connection timeout in milliseconds. */\n connectionTimeoutInMs?: number;\n /** API version sent during the WebSocket upgrade. */\n apiVersion?: string;\n /** Prefix added to the SDK user-agent value in Node.js. */\n userAgentPrefix?: string;\n /**\n * Overrides the transport used to establish the realtime WebSocket connection. Defaults to the\n * platform transport (`ws` in Node.js, the browser's native `WebSocket` in browsers/React Native).\n * Provide a custom factory to customize connection establishment.\n */\n webSocketFactory?: VoiceAgentWebSocketFactory;\n}\n\n/** Options for connecting the realtime client to a voice agent. */\nexport interface VoiceAgentRealtimeClientConnectOptions extends OperationOptions {\n /** Identifier used to correlate the voice session. */\n agentSessionId?: string;\n /** Overrides whether the conversation created by this session is persisted. */\n store?: boolean;\n /** Selects a specific immutable agent version. */\n agentVersionOverride?: string;\n /**\n * Selects the transport used for the realtime connection. Defaults to `\"websocket\"`. Set to\n * `\"webrtc\"` to negotiate a WebRTC peer connection instead; the caller is responsible for\n * completing the SDP offer/answer exchange using the `rtc.call.sdp.create` and\n * `rtc.call.sdp.created` events (see {@link VoiceAgentRealtimeEvent}).\n */\n transport?: VoiceAgentTransport;\n /**\n * Values used to render the agent's structured prompt inputs.\n * Serialized when `connect()` is called, before authentication.\n */\n structuredInputs?: Record<string, unknown>;\n /**\n * Additional query parameters for this connection's WebSocket upgrade URL.\n * Provide a plain object, including a null-prototype object.\n * Values override matching endpoint query parameters; `undefined` removes a parameter.\n * Values are URL-encoded automatically. Numbers must be finite.\n * SDK-managed parameters, authentication parameters, and names starting with `h-` are\n * reserved (case-insensitively) and cause a `TypeError`. Use the corresponding typed\n * options for session, version, storage, transport, and structured prompt inputs instead.\n * Both `structured_input` and `structured_inputs` are reserved.\n * Do not include secrets: query parameters can appear in server or proxy logs.\n */\n query?: Readonly<Record<string, string | number | boolean | undefined>>;\n /** Overrides the client connection timeout in milliseconds. */\n connectionTimeoutInMs?: number;\n /** Cancels the connection attempt. */\n abortSignal?: AbortSignalLike;\n /** Receives connection-state transitions. */\n onConnectionStateChange?: VoiceAgentConnectionStateChangedHandler;\n}\n\n/** Result supplied when a voice-agent connection closes. */\nexport interface VoiceAgentCloseResult {\n /** WebSocket close code. */\n code: number;\n /** WebSocket close reason. */\n reason: string;\n /** Whether the peer completed a normal WebSocket close handshake. */\n wasClean: boolean;\n /** Transport or protocol error associated with the close, if any. */\n error?: Error;\n}\n\n/** Options shared by realtime send operations. */\nexport interface VoiceAgentSendOptions extends OperationOptions {}\n\n/** Options shared by operations that build a protocol event on the caller's behalf. */\nexport interface VoiceAgentEventOptions extends VoiceAgentSendOptions {\n /** Client-generated event identifier. */\n eventId?: string;\n}\n\n/** Options shared by operations that add a conversation item and, by default, request a response. */\nexport interface VoiceAgentSendItemOptions extends VoiceAgentEventOptions {\n /** Whether to request a response after adding the item. Defaults to true. */\n createResponse?: boolean;\n}\n\n/** Options for sending text input. */\nexport interface VoiceAgentSendTextOptions extends VoiceAgentSendItemOptions {\n /** Item after which the new text item is inserted. */\n previousItemId?: string;\n}\n\n/** Options for returning a function result. */\nexport interface VoiceAgentSendToolOutputOptions extends VoiceAgentSendItemOptions {}\n\n/** Options for updating the live session. */\nexport interface VoiceAgentSessionUpdateOptions extends VoiceAgentEventOptions {}\n\n/** Options for creating a response. */\nexport interface VoiceAgentResponseOptions extends VoiceAgentEventOptions {\n /** Response-specific configuration. */\n response?: VoiceAgentResponseCreateParams;\n}\n\n/** Options for cancelling a response. */\nexport interface VoiceAgentCancelResponseOptions extends VoiceAgentEventOptions {\n /** Specific response to cancel. The active default-conversation response is used when omitted. */\n responseId?: string;\n}\n\n/**\n * A connected, bidirectional voice-agent stream.\n *\n * Supports exactly one `for await` iteration over server events; a second attempt throws.\n * Exiting the loop early (`break`, `return`, or an uncaught error in the loop body) closes\n * the connection as a side effect.\n * Unrecognized server event types are delivered as {@link VoiceAgentUnknownEvent} without\n * interrupting the stream. Malformed events still fail the iteration with a protocol error.\n */\nexport interface VoiceAgentConnection extends AsyncIterable<VoiceAgentRealtimeEvent> {\n /** Current connection state. */\n readonly state: VoiceAgentConnectionState;\n /** Resolves once the connection is closed. */\n readonly closed: Promise<VoiceAgentCloseResult>;\n /** Sends any generated client protocol event. */\n sendEvent(event: VoiceAgentClientEvent, options?: VoiceAgentSendOptions): Promise<void>;\n /** Updates supported live-session settings. */\n configureSession(\n session: VoiceAgentSessionUpdateConfig,\n options?: VoiceAgentSessionUpdateOptions,\n ): Promise<void>;\n /** Adds a user text item and, by default, requests a response. */\n sendText(text: string, options?: VoiceAgentSendTextOptions): Promise<void>;\n /** Appends base64-encoded audio bytes to the input buffer. */\n sendAudio(audio: Uint8Array | ArrayBuffer, options?: VoiceAgentEventOptions): Promise<void>;\n /** Commits buffered input audio. */\n commitAudio(options?: VoiceAgentEventOptions): Promise<void>;\n /** Clears buffered input audio. */\n clearInputAudio(options?: VoiceAgentEventOptions): Promise<void>;\n /** Clears pending output audio at the service. */\n clearOutputAudio(options?: VoiceAgentEventOptions): Promise<void>;\n /** Returns a client-executed function result to the agent. */\n sendToolOutput(\n callId: string,\n output: string,\n options?: VoiceAgentSendToolOutputOptions,\n ): Promise<void>;\n /** Requests a new response. */\n requestResponse(options?: VoiceAgentResponseOptions): Promise<void>;\n /** Cancels an in-progress response. */\n cancelResponse(options?: VoiceAgentCancelResponseOptions): Promise<void>;\n /** Gracefully closes the WebSocket connection. */\n close(code?: number, reason?: string): Promise<void>;\n /** Releases the connection. Equivalent to close(). */\n dispose(): Promise<void>;\n}\n\n/** Client for establishing realtime sessions with managed Foundry voice agents. */\nexport class VoiceAgentRealtimeClient {\n private readonly endpoint: string;\n private readonly credential: TokenCredential;\n private readonly options: Required<\n Pick<VoiceAgentRealtimeClientOptions, \"connectionTimeoutInMs\" | \"apiVersion\">\n > &\n VoiceAgentRealtimeClientOptions;\n\n public constructor(\n endpoint: string,\n credential: TokenCredential,\n options: VoiceAgentRealtimeClientOptions = {},\n ) {\n // Endpoint validation (https-only) is deferred to connect() so that merely constructing an\n // AIProjectClient (which eagerly creates this client) doesn't reject callers who intentionally\n // use an insecure local endpoint for the REST surface and never touch realtime connections.\n if (!endpoint.trim()) {\n throw new TypeError(\"endpoint must not be empty.\");\n }\n this.endpoint = endpoint;\n this.credential = credential;\n this.options = {\n ...options,\n connectionTimeoutInMs: options.connectionTimeoutInMs ?? 30_000,\n apiVersion: options.apiVersion ?? \"v1\",\n };\n }\n\n /** Establishes a WebSocket connection to a managed voice agent. */\n public async connect(\n agentName: string,\n options: VoiceAgentRealtimeClientConnectOptions = {},\n ): Promise<VoiceAgentConnection> {\n if (!agentName.trim()) {\n throw new TypeError(\"agentName must not be empty.\");\n }\n const url = buildWebSocketUrl(\n normalizeEndpoint(this.endpoint),\n agentName,\n this.options.apiVersion,\n options,\n );\n const serializedStructuredInputs = options.structuredInputs\n ? JSON.stringify(options.structuredInputs)\n : undefined;\n const tracingConfig = projectTracingConfigs.get(this);\n const tracing = tracingConfig?.enabled\n ? new VoiceAgentRealtimeTracing(this.endpoint, tracingConfig, options.transport)\n : undefined;\n try {\n const factory =\n this.options.webSocketFactory ??\n (await import(\"#platform/webSocketTransport\")).createDefaultVoiceAgentWebSocketFactory();\n const connection = new VoiceAgentConnectionImpl(\n url,\n agentName,\n this.credential,\n this.options,\n options,\n serializedStructuredInputs,\n factory,\n tracing,\n );\n await connection.open();\n return connection;\n } catch (error) {\n tracing?.close(undefined, false, error);\n throw error;\n }\n }\n}\n\n/** Creates the project's realtime client using its already-resolved tracing settings. @internal */\nexport function createVoiceAgentRealtimeClient(\n endpoint: string,\n credential: TokenCredential,\n options: VoiceAgentRealtimeClientOptions | undefined,\n tracingConfig: ResolvedTracingConfig | undefined,\n): VoiceAgentRealtimeClient {\n const client = new VoiceAgentRealtimeClient(endpoint, credential, options);\n if (tracingConfig) projectTracingConfigs.set(client, tracingConfig);\n return client;\n}\n\nclass VoiceAgentConnectionImpl implements VoiceAgentConnection {\n private readonly events: AsyncQueue<VoiceAgentRealtimeEvent>;\n private readonly transport: VoiceAgentWebSocketTransport;\n private readonly closePromise: Promise<VoiceAgentCloseResult>;\n private resolveClose!: (result: VoiceAgentCloseResult) => void;\n private currentState: VoiceAgentConnectionState = KnownVoiceAgentConnectionState.Disconnected;\n private iteratorStarted = false;\n private finished = false;\n\n public constructor(\n private readonly url: string,\n private readonly agentName: string,\n private readonly credential: TokenCredential,\n private readonly clientOptions: VoiceAgentRealtimeClientOptions & {\n connectionTimeoutInMs: number;\n apiVersion: string;\n },\n private readonly connectOptions: VoiceAgentRealtimeClientConnectOptions,\n private readonly serializedStructuredInputs: string | undefined,\n factory: VoiceAgentWebSocketFactory,\n private readonly tracing?: VoiceAgentRealtimeTracing,\n ) {\n this.events = new AsyncQueue<VoiceAgentRealtimeEvent>(10_000, {\n onOverflow: (error) => this.handleEventQueueOverflow(error),\n });\n this.transport = factory.create();\n this.closePromise = new Promise<VoiceAgentCloseResult>((resolve) => {\n this.resolveClose = resolve;\n });\n this.transport.setHandlers({\n onMessage: (data) => this.handleMessage(data),\n onClose: (code, reason, wasClean) => this.handleClose(code, reason, wasClean),\n onError: (error) => this.handleTransportError(error),\n });\n }\n\n public get state(): VoiceAgentConnectionState {\n return this.currentState;\n }\n\n public get closed(): Promise<VoiceAgentCloseResult> {\n return this.closePromise;\n }\n\n public async open(): Promise<void> {\n this.setState(KnownVoiceAgentConnectionState.Connecting);\n let token: string;\n try {\n const accessToken = await this.credential.getToken(\n this.clientOptions.credentialScopes ?? defaultCredentialScope,\n { abortSignal: this.connectOptions.abortSignal },\n );\n if (!accessToken) {\n throw new VoiceAgentAuthenticationError(\"The credential returned no access token.\");\n }\n token = accessToken.token;\n } catch (error) {\n if (this.connectOptions.abortSignal?.aborted) {\n const cancelledError = new VoiceAgentConnectionError(\n \"Voice-agent connection was cancelled.\",\n \"operationCancelled\",\n { cause: error },\n );\n this.finish(1006, cancelledError.message, false, cancelledError);\n throw cancelledError;\n }\n const authenticationError =\n error instanceof VoiceAgentAuthenticationError\n ? error\n : new VoiceAgentAuthenticationError(\"Failed to acquire a Voice Agents access token.\", {\n cause: error,\n });\n this.finish(1006, authenticationError.message, false, authenticationError);\n throw authenticationError;\n }\n\n try {\n await this.transport.connect({\n url: this.url,\n protocols: [\"realtime\"],\n headers: buildHeaders(token, this.clientOptions, this.serializedStructuredInputs),\n connectionTimeoutInMs:\n this.connectOptions.connectionTimeoutInMs ?? this.clientOptions.connectionTimeoutInMs,\n abortSignal: this.connectOptions.abortSignal,\n });\n this.tracing?.opened();\n this.setState(KnownVoiceAgentConnectionState.Connected);\n logger.info(\"Connected to voice agent\", { agentName: this.agentName });\n } catch (error) {\n const cancelled = this.connectOptions.abortSignal?.aborted === true;\n const connectionError = new VoiceAgentConnectionError(\n cancelled\n ? \"Voice-agent connection was cancelled.\"\n : \"Failed to connect to the voice agent.\",\n cancelled ? \"operationCancelled\" : \"connectionFailed\",\n { cause: error },\n );\n this.finish(1006, connectionError.message, false, connectionError);\n throw connectionError;\n }\n }\n\n public async sendEvent(\n event: VoiceAgentClientEvent,\n options: VoiceAgentSendOptions = {},\n ): Promise<void> {\n if (this.state !== KnownVoiceAgentConnectionState.Connected) {\n throw new VoiceAgentConnectionError(\n `Cannot send while the connection is ${this.state}.`,\n \"invalidState\",\n );\n }\n if (options.abortSignal?.aborted) {\n throw new VoiceAgentConnectionError(\"Send operation was cancelled.\", \"operationCancelled\");\n }\n\n let reservation: ReturnType<VoiceAgentRealtimeTracing[\"reserveSend\"]> = undefined;\n try {\n const serialized = serializeVoiceAgentClientEvent(event);\n reservation = this.tracing?.reserveSend(event);\n await this.transport.send(serialized, options.abortSignal);\n this.tracing?.sent(event, reservation);\n } catch (error) {\n this.tracing?.sendFailed(error, reservation);\n if (error instanceof VoiceAgentProtocolError) {\n throw error;\n }\n throw new VoiceAgentConnectionError(\"Failed to send a voice-agent event.\", \"sendFailed\", {\n cause: error,\n });\n }\n }\n\n public configureSession(\n session: VoiceAgentSessionUpdateConfig,\n options: VoiceAgentSessionUpdateOptions = {},\n ): Promise<void> {\n return this.sendEvent({ type: \"session.update\", event_id: options.eventId, session }, options);\n }\n\n public async sendText(text: string, options: VoiceAgentSendTextOptions = {}): Promise<void> {\n await this.sendEvent(\n {\n type: \"conversation.item.create\",\n event_id: options.eventId,\n previous_item_id: options.previousItemId,\n // `RealtimeConversationItemUnion` no longer enumerates a \"message\" item in the generated\n // models, but the wire protocol still accepts this shape; see the TypeSpec regeneration\n // report for details.\n item: {\n type: \"message\",\n role: \"user\",\n content: [{ type: \"input_text\", text }],\n } as unknown as RealtimeConversationItemUnion,\n },\n options,\n );\n if (options.createResponse !== false) {\n await this.requestResponse({ abortSignal: options.abortSignal });\n }\n }\n\n public sendAudio(\n audio: Uint8Array | ArrayBuffer,\n options: VoiceAgentEventOptions = {},\n ): Promise<void> {\n const bytes = audio instanceof Uint8Array ? audio : new Uint8Array(audio);\n return this.sendEvent(\n {\n type: \"input_audio_buffer.append\",\n event_id: options.eventId,\n audio: uint8ArrayToString(bytes, \"base64\"),\n },\n options,\n );\n }\n\n public commitAudio(options: VoiceAgentEventOptions = {}): Promise<void> {\n return this.sendEvent(\n { type: \"input_audio_buffer.commit\", event_id: options.eventId },\n options,\n );\n }\n\n public clearInputAudio(options: VoiceAgentEventOptions = {}): Promise<void> {\n return this.sendEvent({ type: \"input_audio_buffer.clear\", event_id: options.eventId }, options);\n }\n\n public clearOutputAudio(options: VoiceAgentEventOptions = {}): Promise<void> {\n return this.sendEvent(\n { type: \"output_audio_buffer.clear\", event_id: options.eventId },\n options,\n );\n }\n\n public async sendToolOutput(\n callId: string,\n output: string,\n options: VoiceAgentSendToolOutputOptions = {},\n ): Promise<void> {\n await this.sendEvent(\n {\n type: \"conversation.item.create\",\n event_id: options.eventId,\n item: { type: \"function_call_output\", call_id: callId, output },\n },\n options,\n );\n if (options.createResponse !== false) {\n await this.requestResponse({ abortSignal: options.abortSignal });\n }\n }\n\n public requestResponse(options: VoiceAgentResponseOptions = {}): Promise<void> {\n return this.sendEvent(\n { type: \"response.create\", event_id: options.eventId, response: options.response },\n options,\n );\n }\n\n public cancelResponse(options: VoiceAgentCancelResponseOptions = {}): Promise<void> {\n return this.sendEvent(\n { type: \"response.cancel\", event_id: options.eventId, response_id: options.responseId },\n options,\n );\n }\n\n public async close(\n code = 1000,\n reason = \"Client closed the voice-agent connection.\",\n ): Promise<void> {\n if (\n this.state === KnownVoiceAgentConnectionState.Disconnected ||\n this.state === KnownVoiceAgentConnectionState.Closing\n ) {\n await this.closed;\n return;\n }\n this.setState(KnownVoiceAgentConnectionState.Closing);\n try {\n await this.transport.close(code, reason);\n } finally {\n this.finish(code, reason, false);\n }\n }\n\n public dispose(): Promise<void> {\n return this.close();\n }\n\n public async *[Symbol.asyncIterator](): AsyncIterator<VoiceAgentRealtimeEvent> {\n if (this.iteratorStarted) {\n throw new VoiceAgentConnectionError(\n \"A voice-agent connection supports one active event iterator.\",\n \"invalidState\",\n );\n }\n this.iteratorStarted = true;\n try {\n while (true) {\n const result = await this.events.next();\n if (result.done) {\n return;\n }\n yield result.value;\n }\n } finally {\n if (this.state === KnownVoiceAgentConnectionState.Connected) {\n await this.close();\n }\n }\n }\n\n private handleMessage(data: string | ArrayBuffer): void {\n try {\n const event = deserializeVoiceAgentServerEvent(data);\n this.tracing?.received(event);\n this.events.enqueue(event);\n } catch (error) {\n const protocolError =\n error instanceof VoiceAgentProtocolError\n ? error\n : new VoiceAgentProtocolError(\"Failed to process a voice-agent event.\", { cause: error });\n // finish() closes the transport itself, so no additional close is needed here.\n this.finish(1002, protocolError.message, false, protocolError);\n }\n }\n\n private handleEventQueueOverflow(cause: Error): void {\n if (this.finished) {\n return;\n }\n const error = new VoiceAgentConnectionError(cause.message, \"connectionClosed\", {\n cause,\n });\n this.finish(1006, error.message, false, error);\n }\n\n private handleClose(code: number, reason: string, wasClean: boolean): void {\n if (this.finished) {\n return;\n }\n if (wasClean || this.state === KnownVoiceAgentConnectionState.Closing) {\n this.finish(code, reason, wasClean);\n } else {\n const error = new VoiceAgentConnectionError(\n `Voice-agent connection closed unexpectedly (${code}${reason ? `: ${reason}` : \"\"}).`,\n \"connectionClosed\",\n { closeCode: code },\n );\n this.finish(code, reason, false, error);\n }\n }\n\n private handleTransportError(cause: Error): void {\n if (this.finished) {\n return;\n }\n const error = new VoiceAgentConnectionError(\n \"Voice-agent WebSocket transport failed.\",\n \"connectionClosed\",\n {\n cause,\n },\n );\n this.finish(1006, cause.message, false, error);\n }\n\n private finish(code: number, reason: string, wasClean: boolean, error?: Error): void {\n if (this.finished) {\n return;\n }\n this.finished = true;\n this.tracing?.close(code, wasClean, error);\n if (error) {\n this.events.fail(error);\n } else {\n this.events.close();\n }\n this.setState(KnownVoiceAgentConnectionState.Disconnected);\n this.resolveClose({ code, reason, wasClean, error });\n logger.info(\"Voice-agent connection closed\", { code, reason, wasClean });\n // Ensure the socket never outlives the connection, even on paths that never closed it\n // themselves. Not awaited: finish() is synchronous because its callers are.\n void this.closeTransportQuietly(code, reason);\n }\n\n /**\n * Closes the transport, logging rather than rejecting: this is best-effort cleanup running after\n * the connection has already settled. A no-op if the transport is already closed.\n */\n private async closeTransportQuietly(code: number, reason: string): Promise<void> {\n try {\n await this.transport.close(code, reason);\n } catch (error) {\n logger.warning(\"Failed to close the voice-agent transport\", { error });\n }\n }\n\n private setState(state: VoiceAgentConnectionState): void {\n if (state === this.currentState) {\n return;\n }\n const previousState = this.currentState;\n this.currentState = state;\n try {\n this.connectOptions.onConnectionStateChange?.(state, previousState);\n } catch (error) {\n // A throwing caller callback must never interrupt connection lifecycle/cleanup.\n logger.warning(\"onConnectionStateChange callback threw an error\", { error });\n }\n }\n}\n\nfunction normalizeEndpoint(endpoint: string): string {\n const normalized = endpoint.trim();\n if (!normalized) {\n throw new TypeError(\"endpoint must not be empty.\");\n }\n const url = new URL(normalized.includes(\"://\") ? normalized : `https://${normalized}`);\n if (url.protocol !== \"https:\") {\n throw new TypeError(\n \"endpoint must use https; a plaintext endpoint would send the bearer token over an unencrypted connection.\",\n );\n }\n return url.toString();\n}\n\nfunction buildWebSocketUrl(\n endpoint: string,\n agentName: string,\n apiVersion: string,\n options: VoiceAgentRealtimeClientConnectOptions,\n): string {\n const url = new URL(endpoint);\n url.protocol = \"wss:\";\n url.pathname = `${url.pathname.replace(/\\/+$/, \"\")}/agents/${encodeURIComponent(agentName)}/endpoint/protocols/voice`;\n if (\n options.query !== undefined &&\n (options.query === null ||\n typeof options.query !== \"object\" ||\n ![Object.prototype, null].includes(Object.getPrototypeOf(options.query)))\n ) {\n throw new TypeError(\"query must be a record of query parameters.\");\n }\n for (const [name, value] of Object.entries(options.query ?? {})) {\n const normalizedName = name.toLowerCase();\n if (reservedQueryParameters.has(normalizedName) || normalizedName.startsWith(\"h-\")) {\n throw new TypeError(`Query parameter \"${name}\" is reserved; use the SDK's typed options.`);\n }\n if (value === undefined) {\n url.searchParams.delete(name);\n } else if (\n typeof value === \"string\" ||\n typeof value === \"boolean\" ||\n (typeof value === \"number\" && Number.isFinite(value))\n ) {\n url.searchParams.set(name, String(value));\n } else {\n throw new TypeError(\n `Query parameter \"${name}\" must be a string, boolean, finite number, or undefined.`,\n );\n }\n }\n url.searchParams.set(\"api-version\", apiVersion);\n url.searchParams.set(\"x-ms-client-sdk\", `azsdk-js-ai-projects/${SDK_VERSION}`);\n if (options.agentSessionId) {\n url.searchParams.set(\"agent_session_id\", options.agentSessionId);\n }\n if (options.store !== undefined) {\n url.searchParams.set(\"store\", String(options.store));\n }\n if (options.agentVersionOverride) {\n url.searchParams.set(\"x-agent-version-override\", options.agentVersionOverride);\n }\n if (options.transport) {\n url.searchParams.set(\"transport\", options.transport);\n }\n return url.toString();\n}\n\nfunction buildHeaders(\n token: string,\n clientOptions: VoiceAgentRealtimeClientOptions,\n serializedStructuredInputs: string | undefined,\n): Record<string, string> {\n const sdkUserAgent = `azsdk-js-ai-projects/${SDK_VERSION}`;\n const headers: Record<string, string> = {\n authorization: `Bearer ${token}`,\n \"foundry-features\": voiceAgentsPreview,\n \"x-ms-client-request-id\": createRequestId(),\n \"x-ms-client-sdk\": sdkUserAgent,\n \"user-agent\": clientOptions.userAgentPrefix\n ? `${clientOptions.userAgentPrefix} ${sdkUserAgent}`\n : sdkUserAgent,\n };\n if (serializedStructuredInputs !== undefined) {\n headers[\"x-ms-voice-structured-inputs\"] = serializedStructuredInputs;\n }\n return headers;\n}\n\nfunction createRequestId(): string {\n return (\n globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,uBAAmC;AACnC,uBAA4B;AAQ5B,oBAAuB;AACvB,wBAA2B;AAC3B,oBAIO;AACP,sBAAiF;AAOjF,+BAA0C;AAG1C,MAAM,wBAAwB,oBAAI,QAAyD;AAE3F,MAAM,yBAAyB;AAC/B,MAAM,qBAAqB;AAC3B,MAAM,0BAA0B,oBAAI,IAAI;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,MAAM,iCAAiC;AAAA,EAC5C,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AACX;AAyKO,MAAM,yBAAyB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EAKV,YACL,UACA,YACA,UAA2C,CAAC,GAC5C;AAIA,QAAI,CAAC,SAAS,KAAK,GAAG;AACpB,YAAM,IAAI,UAAU,6BAA6B;AAAA,IACnD;AACA,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB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I,eAAe,UAAU;AAC9C,MAAI,aAAa,IAAI,mBAAmB,wBAAwB,4BAAW,EAAE;AAC7E,MAAI,QAAQ,gBAAgB;AAC1B,QAAI,aAAa,IAAI,oBAAoB,QAAQ,cAAc;AAAA,EACjE;AACA,MAAI,QAAQ,UAAU,QAAW;AAC/B,QAAI,aAAa,IAAI,SAAS,OAAO,QAAQ,KAAK,CAAC;AAAA,EACrD;AACA,MAAI,QAAQ,sBAAsB;AAChC,QAAI,aAAa,IAAI,4BAA4B,QAAQ,oBAAoB;AAAA,EAC/E;AACA,MAAI,QAAQ,WAAW;AACrB,QAAI,aAAa,IAAI,aAAa,QAAQ,SAAS;AAAA,EACrD;AACA,SAAO,IAAI,SAAS;AACtB;AAEA,SAAS,aACP,OACA,eACA,4BACwB;AACxB,QAAM,eAAe,wBAAwB,4BAAW;AACxD,QAAM,UAAkC;AAAA,IACtC,eAAe,UAAU,KAAK;AAAA,IAC9B,oBAAoB;AAAA,IACpB,0BAA0B,gBAAgB;AAAA,IAC1C,mBAAmB;AAAA,IACnB,cAAc,cAAc,kBACxB,GAAG,cAAc,eAAe,IAAI,YAAY,KAChD;AAAA,EACN;AACA,MAAI,+BAA+B,QAAW;AAC5C,YAAQ,8BAA8B,IAAI;AAAA,EAC5C;AACA,SAAO;AACT;AAEA,SAAS,kBAA0B;AACjC,SACE,WAAW,QAAQ,aAAa,KAAK,GAAG,KAAK,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AAE7F;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -44,14 +44,12 @@ export interface ResolvedTracingConfig {
|
|
|
44
44
|
traceContextPropagation: boolean;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* Resolves tracing options into a
|
|
47
|
+
* Resolves tracing options into a config object for the client instance.
|
|
48
48
|
* For each setting not explicitly provided, the corresponding environment variable
|
|
49
49
|
* is checked. If the env var is also not set, the default value is used.
|
|
50
50
|
*
|
|
51
|
-
* - `enabled`:
|
|
52
|
-
*
|
|
53
|
-
* Env var `AZURE_TRACING_GEN_AI_ENABLE` (accepts `"true"` or `"1"`) enables tracing
|
|
54
|
-
* when `tracingOptions` is not provided.
|
|
51
|
+
* - `enabled`: requires options and the experimental gate, resolved from
|
|
52
|
+
* `experimental` or `AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING`.
|
|
55
53
|
* - `contentRecording`: defaults to `false`. Env var: `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`
|
|
56
54
|
* - `traceContextPropagation`: defaults to `true`. Env var: `AZURE_TRACING_GEN_AI_ENABLE_TRACE_CONTEXT_PROPAGATION`
|
|
57
55
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/tracing/configuration.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,8DAA8D;IAC9D,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mDAAmD;IACnD,uBAAuB,EAAE,OAAO,CAAC;CAClC;AAED
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/tracing/configuration.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,8DAA8D;IAC9D,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mDAAmD;IACnD,uBAAuB,EAAE,OAAO,CAAC;CAClC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,qBAAqB,CA6DzF"}
|
|
@@ -69,7 +69,11 @@ function resolveTracingConfig(options) {
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
return {
|
|
72
|
+
return {
|
|
73
|
+
enabled,
|
|
74
|
+
contentRecording,
|
|
75
|
+
traceContextPropagation
|
|
76
|
+
};
|
|
73
77
|
}
|
|
74
78
|
// Annotate the CommonJS export names for ESM import in node:
|
|
75
79
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tracing/configuration.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\n\n/**\n * Options for configuring GenAI tracing on a specific AIProjectClient instance.\n *\n * Pass these under the `tracingOptions` key of AIProjectClientOptionalParams\n * to enable GenAI tracing when the client is instantiated. Each client instance\n * maintains its own independent tracing configuration.\n */\nexport interface GenAITracingOptions {\n /**\n * Acknowledge that GenAI tracing features are experimental and may change\n * or be removed in future releases without notice.\n * When set to `true`, tracing is enabled.\n * When omitted, the `AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING` environment variable\n * is checked (accepts `\"true\"` case-insensitive or `\"1\"`). Defaults to `false`.\n */\n experimental?: boolean;\n /**\n * Whether to capture message content in traces.\n * Content includes chat messages, function call names, arguments, and return values.\n * When set to `true` or `false`, that value is used directly.\n * When omitted, the `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` environment\n * variable is checked (accepts `\"true\"` case-insensitive or `\"1\"`). Defaults to `false`.\n */\n contentRecording?: boolean;\n /**\n * Whether to inject W3C trace context headers (`traceparent`, `tracestate`)\n * into outgoing OpenAI requests.\n * When set to `true` or `false`, that value is used directly.\n * When omitted, the `AZURE_TRACING_GEN_AI_ENABLE_TRACE_CONTEXT_PROPAGATION` environment\n * variable is checked (accepts `\"true\"` case-insensitive or `\"1\"`). Defaults to `true`.\n */\n traceContextPropagation?: boolean;\n}\n\n/**\n * Resolved tracing configuration for a specific client instance.\n * @internal\n */\nexport interface ResolvedTracingConfig {\n /** Whether tracing is enabled. */\n enabled: boolean;\n /** Whether to record content (messages, tool calls, etc.). */\n contentRecording: boolean;\n /** Whether to inject W3C trace context headers. */\n traceContextPropagation: boolean;\n}\n\n/**\n * Resolves tracing options into a
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAuB;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\n\n/**\n * Options for configuring GenAI tracing on a specific AIProjectClient instance.\n *\n * Pass these under the `tracingOptions` key of AIProjectClientOptionalParams\n * to enable GenAI tracing when the client is instantiated. Each client instance\n * maintains its own independent tracing configuration.\n */\nexport interface GenAITracingOptions {\n /**\n * Acknowledge that GenAI tracing features are experimental and may change\n * or be removed in future releases without notice.\n * When set to `true`, tracing is enabled.\n * When omitted, the `AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING` environment variable\n * is checked (accepts `\"true\"` case-insensitive or `\"1\"`). Defaults to `false`.\n */\n experimental?: boolean;\n /**\n * Whether to capture message content in traces.\n * Content includes chat messages, function call names, arguments, and return values.\n * When set to `true` or `false`, that value is used directly.\n * When omitted, the `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` environment\n * variable is checked (accepts `\"true\"` case-insensitive or `\"1\"`). Defaults to `false`.\n */\n contentRecording?: boolean;\n /**\n * Whether to inject W3C trace context headers (`traceparent`, `tracestate`)\n * into outgoing OpenAI requests.\n * When set to `true` or `false`, that value is used directly.\n * When omitted, the `AZURE_TRACING_GEN_AI_ENABLE_TRACE_CONTEXT_PROPAGATION` environment\n * variable is checked (accepts `\"true\"` case-insensitive or `\"1\"`). Defaults to `true`.\n */\n traceContextPropagation?: boolean;\n}\n\n/**\n * Resolved tracing configuration for a specific client instance.\n * @internal\n */\nexport interface ResolvedTracingConfig {\n /** Whether tracing is enabled. */\n enabled: boolean;\n /** Whether to record content (messages, tool calls, etc.). */\n contentRecording: boolean;\n /** Whether to inject W3C trace context headers. */\n traceContextPropagation: boolean;\n}\n\n/**\n * Resolves tracing options into a config object for the client instance.\n * For each setting not explicitly provided, the corresponding environment variable\n * is checked. If the env var is also not set, the default value is used.\n *\n * - `enabled`: requires options and the experimental gate, resolved from\n * `experimental` or `AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING`.\n * - `contentRecording`: defaults to `false`. Env var: `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`\n * - `traceContextPropagation`: defaults to `true`. Env var: `AZURE_TRACING_GEN_AI_ENABLE_TRACE_CONTEXT_PROPAGATION`\n * @internal\n */\nexport function resolveTracingConfig(options?: GenAITracingOptions): ResolvedTracingConfig {\n // Determine if tracing is enabled \u2014 requires experimental acknowledgment\n let experimental: boolean;\n if (options?.experimental !== undefined) {\n experimental = options.experimental;\n } else {\n try {\n const envVal = process.env.AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING;\n experimental = !!envVal && (envVal.toLowerCase() === \"true\" || envVal === \"1\");\n } catch (e) {\n logger.verbose(\n `Unable to read AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING env var, tracing disabled: ${e}`,\n );\n experimental = false;\n }\n }\n\n const enabled = options !== undefined && experimental;\n\n if (!enabled) {\n return { enabled: false, contentRecording: false, traceContextPropagation: true };\n }\n\n // Resolve contentRecording\n let contentRecording: boolean;\n if (options?.contentRecording !== undefined) {\n contentRecording = options.contentRecording;\n } else {\n try {\n const envVal = process.env.OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT;\n contentRecording = !!envVal && (envVal.toLowerCase() === \"true\" || envVal === \"1\");\n } catch (e) {\n logger.verbose(\n `Unable to read OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT env var: ${e}`,\n );\n contentRecording = false;\n }\n }\n\n // Resolve traceContextPropagation\n let traceContextPropagation = true;\n if (options?.traceContextPropagation !== undefined) {\n traceContextPropagation = options.traceContextPropagation;\n } else {\n try {\n const envVal = process.env.AZURE_TRACING_GEN_AI_ENABLE_TRACE_CONTEXT_PROPAGATION;\n if (envVal && (envVal.toLowerCase() === \"false\" || envVal === \"0\")) {\n traceContextPropagation = false;\n }\n } catch (e) {\n logger.verbose(\n `Unable to read AZURE_TRACING_GEN_AI_ENABLE_TRACE_CONTEXT_PROPAGATION env var: ${e}`,\n );\n }\n }\n\n return {\n enabled,\n contentRecording,\n traceContextPropagation,\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAuB;AA4DhB,SAAS,qBAAqB,SAAsD;AAEzF,MAAI;AACJ,MAAI,SAAS,iBAAiB,QAAW;AACvC,mBAAe,QAAQ;AAAA,EACzB,OAAO;AACL,QAAI;AACF,YAAM,SAAS,QAAQ,IAAI;AAC3B,qBAAe,CAAC,CAAC,WAAW,OAAO,YAAY,MAAM,UAAU,WAAW;AAAA,IAC5E,SAAS,GAAG;AACV,2BAAO;AAAA,QACL,qFAAqF,CAAC;AAAA,MACxF;AACA,qBAAe;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,UAAU,YAAY,UAAa;AAEzC,MAAI,CAAC,SAAS;AACZ,WAAO,EAAE,SAAS,OAAO,kBAAkB,OAAO,yBAAyB,KAAK;AAAA,EAClF;AAGA,MAAI;AACJ,MAAI,SAAS,qBAAqB,QAAW;AAC3C,uBAAmB,QAAQ;AAAA,EAC7B,OAAO;AACL,QAAI;AACF,YAAM,SAAS,QAAQ,IAAI;AAC3B,yBAAmB,CAAC,CAAC,WAAW,OAAO,YAAY,MAAM,UAAU,WAAW;AAAA,IAChF,SAAS,GAAG;AACV,2BAAO;AAAA,QACL,8EAA8E,CAAC;AAAA,MACjF;AACA,yBAAmB;AAAA,IACrB;AAAA,EACF;AAGA,MAAI,0BAA0B;AAC9B,MAAI,SAAS,4BAA4B,QAAW;AAClD,8BAA0B,QAAQ;AAAA,EACpC,OAAO;AACL,QAAI;AACF,YAAM,SAAS,QAAQ,IAAI;AAC3B,UAAI,WAAW,OAAO,YAAY,MAAM,WAAW,WAAW,MAAM;AAClE,kCAA0B;AAAA,MAC5B;AAAA,IACF,SAAS,GAAG;AACV,2BAAO;AAAA,QACL,iFAAiF,CAAC;AAAA,MACpF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,7 +8,7 @@ export interface StartSpanResult {
|
|
|
8
8
|
/**
|
|
9
9
|
* Starts a new client span using the global OTel TracerProvider.
|
|
10
10
|
*/
|
|
11
|
-
export declare function startSpan(name: string): StartSpanResult;
|
|
11
|
+
export declare function startSpan(name: string, parentContext?: Context): StartSpanResult;
|
|
12
12
|
/**
|
|
13
13
|
* Injects trace context headers (traceparent/tracestate) for the current active span.
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracingClient.d.ts","sourceRoot":"","sources":["../../../src/tracing/tracingClient.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGxD,YAAY,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,OAAO,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,SAAS,
|
|
1
|
+
{"version":3,"file":"tracingClient.d.ts","sourceRoot":"","sources":["../../../src/tracing/tracingClient.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGxD,YAAY,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,OAAO,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,aAAa,GAAE,OAA0B,GACxC,eAAe,CAMjB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAI7D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAEhE"}
|
|
@@ -26,9 +26,9 @@ module.exports = __toCommonJS(tracingClient_exports);
|
|
|
26
26
|
var import_api = require("@opentelemetry/api");
|
|
27
27
|
var import_constants = require("../constants.js");
|
|
28
28
|
var import_api2 = require("@opentelemetry/api");
|
|
29
|
-
function startSpan(name) {
|
|
29
|
+
function startSpan(name, parentContext = import_api.context.active()) {
|
|
30
30
|
const tracer = import_api.trace.getTracer(import_constants.PACKAGE_NAME, import_constants.SDK_VERSION);
|
|
31
|
-
const ctx =
|
|
31
|
+
const ctx = parentContext;
|
|
32
32
|
const span = tracer.startSpan(name, { kind: import_api.SpanKind.CLIENT }, ctx);
|
|
33
33
|
const spanCtx = import_api.trace.setSpan(ctx, span);
|
|
34
34
|
return { span, ctx: spanCtx };
|