@azure/ai-projects 2.6.0 → 2.7.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 +62 -1
- package/dist/browser/aiProjectClient.d.ts +1 -0
- package/dist/browser/aiProjectClient.d.ts.map +1 -1
- package/dist/browser/aiProjectClient.js +16 -1
- package/dist/browser/aiProjectClient.js.map +1 -1
- package/dist/browser/api/agents/index.d.ts +1 -1
- package/dist/browser/api/agents/index.d.ts.map +1 -1
- package/dist/browser/api/agents/index.js.map +1 -1
- package/dist/browser/api/agents/options.d.ts +91 -1
- 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/aiProjectContext.d.ts +3 -0
- package/dist/browser/api/aiProjectContext.d.ts.map +1 -1
- package/dist/browser/api/aiProjectContext.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 +9 -2
- package/dist/browser/api/beta/agents/operations.d.ts.map +1 -1
- package/dist/browser/api/beta/agents/operations.js +38 -1
- package/dist/browser/api/beta/agents/operations.js.map +1 -1
- package/dist/browser/api/beta/agents/options.d.ts +3 -0
- 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/voiceAgents/conversations/index.d.ts +3 -0
- package/dist/browser/api/beta/voiceAgents/conversations/index.d.ts.map +1 -0
- package/dist/browser/api/beta/voiceAgents/conversations/index.js +4 -0
- package/dist/browser/api/beta/voiceAgents/conversations/index.js.map +1 -0
- package/dist/browser/api/beta/voiceAgents/conversations/operations.d.ts +140 -0
- package/dist/browser/api/beta/voiceAgents/conversations/operations.d.ts.map +1 -0
- package/dist/browser/api/beta/voiceAgents/conversations/operations.js +635 -0
- package/dist/browser/api/beta/voiceAgents/conversations/operations.js.map +1 -0
- package/dist/browser/api/beta/voiceAgents/conversations/options.d.ts +133 -0
- package/dist/browser/api/beta/voiceAgents/conversations/options.d.ts.map +1 -0
- package/dist/browser/api/beta/voiceAgents/conversations/options.js +4 -0
- package/dist/browser/api/beta/voiceAgents/conversations/options.js.map +1 -0
- package/dist/browser/api/beta/voiceAgents/telephony/index.d.ts +3 -0
- package/dist/browser/api/beta/voiceAgents/telephony/index.d.ts.map +1 -0
- package/dist/browser/api/beta/voiceAgents/telephony/index.js +4 -0
- package/dist/browser/api/beta/voiceAgents/telephony/index.js.map +1 -0
- package/dist/browser/api/beta/voiceAgents/telephony/operations.d.ts +62 -0
- package/dist/browser/api/beta/voiceAgents/telephony/operations.d.ts.map +1 -0
- package/dist/browser/api/beta/voiceAgents/telephony/operations.js +559 -0
- package/dist/browser/api/beta/voiceAgents/telephony/operations.js.map +1 -0
- package/dist/browser/api/beta/voiceAgents/telephony/options.d.ts +133 -0
- package/dist/browser/api/beta/voiceAgents/telephony/options.d.ts.map +1 -0
- package/dist/browser/api/beta/voiceAgents/telephony/options.js +4 -0
- package/dist/browser/api/beta/voiceAgents/telephony/options.js.map +1 -0
- package/dist/browser/api/datasets/operations.d.ts.map +1 -1
- package/dist/browser/api/datasets/operations.js +1 -3
- package/dist/browser/api/datasets/operations.js.map +1 -1
- package/dist/browser/api/toolboxes/index.d.ts +2 -2
- package/dist/browser/api/toolboxes/index.d.ts.map +1 -1
- package/dist/browser/api/toolboxes/index.js +1 -1
- package/dist/browser/api/toolboxes/index.js.map +1 -1
- package/dist/browser/api/toolboxes/operations.d.ts +6 -2
- package/dist/browser/api/toolboxes/operations.d.ts.map +1 -1
- package/dist/browser/api/toolboxes/operations.js +33 -0
- package/dist/browser/api/toolboxes/operations.js.map +1 -1
- package/dist/browser/api/toolboxes/options.d.ts +3 -0
- package/dist/browser/api/toolboxes/options.d.ts.map +1 -1
- package/dist/browser/api/toolboxes/options.js.map +1 -1
- package/dist/browser/classic/beta/agents/index.d.ts +8 -3
- package/dist/browser/classic/beta/agents/index.d.ts.map +1 -1
- package/dist/browser/classic/beta/agents/index.js +3 -4
- package/dist/browser/classic/beta/agents/index.js.map +1 -1
- package/dist/browser/classic/beta/index.d.ts +6 -1
- package/dist/browser/classic/beta/index.d.ts.map +1 -1
- package/dist/browser/classic/beta/index.js +4 -1
- package/dist/browser/classic/beta/index.js.map +1 -1
- package/dist/browser/classic/beta/voiceAgents/conversations/index.d.ts +115 -0
- package/dist/browser/classic/beta/voiceAgents/conversations/index.d.ts.map +1 -0
- package/dist/browser/classic/beta/voiceAgents/conversations/index.js +25 -0
- package/dist/browser/classic/beta/voiceAgents/conversations/index.js.map +1 -0
- package/dist/browser/classic/beta/voiceAgents/index.d.ts +16 -0
- package/dist/browser/classic/beta/voiceAgents/index.d.ts.map +1 -0
- package/dist/browser/classic/beta/voiceAgents/index.js +16 -0
- package/dist/browser/classic/beta/voiceAgents/index.js.map +1 -0
- package/dist/browser/classic/beta/voiceAgents/telephony/index.d.ts +37 -0
- package/dist/browser/classic/beta/voiceAgents/telephony/index.d.ts.map +1 -0
- package/dist/browser/classic/beta/voiceAgents/telephony/index.js +25 -0
- package/dist/browser/classic/beta/voiceAgents/telephony/index.js.map +1 -0
- package/dist/browser/classic/index.d.ts +3 -0
- package/dist/browser/classic/index.d.ts.map +1 -1
- package/dist/browser/classic/index.js.map +1 -1
- package/dist/browser/classic/toolboxes/index.d.ts +4 -2
- package/dist/browser/classic/toolboxes/index.d.ts.map +1 -1
- package/dist/browser/classic/toolboxes/index.js +2 -1
- package/dist/browser/classic/toolboxes/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/deprecate.interface.d.ts +16 -4
- package/dist/browser/deprecate.interface.d.ts.map +1 -1
- package/dist/browser/deprecate.interface.js.map +1 -1
- package/dist/browser/index.d.ts +15 -4
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/models/index.d.ts +2 -1
- 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 +4198 -28
- package/dist/browser/models/models.d.ts.map +1 -1
- package/dist/browser/models/models.js +4881 -22
- package/dist/browser/models/models.js.map +1 -1
- package/dist/browser/package.json +1 -1
- package/dist/browser/realtime/asyncQueue.d.ts +29 -0
- package/dist/browser/realtime/asyncQueue.d.ts.map +1 -0
- package/dist/browser/realtime/asyncQueue.js +105 -0
- package/dist/browser/realtime/asyncQueue.js.map +1 -0
- package/dist/browser/realtime/errors.d.ts +34 -0
- package/dist/browser/realtime/errors.d.ts.map +1 -0
- package/dist/browser/realtime/errors.js +40 -0
- package/dist/browser/realtime/errors.js.map +1 -0
- package/dist/browser/realtime/events.d.ts +24 -0
- package/dist/browser/realtime/events.d.ts.map +1 -0
- package/dist/browser/realtime/events.js +4 -0
- package/dist/browser/realtime/events.js.map +1 -0
- package/dist/browser/realtime/protocol.d.ts +7 -0
- package/dist/browser/realtime/protocol.d.ts.map +1 -0
- package/dist/browser/realtime/protocol.js +262 -0
- package/dist/browser/realtime/protocol.js.map +1 -0
- package/dist/browser/realtime/voiceAgentRealtimeClient.d.ts +145 -0
- package/dist/browser/realtime/voiceAgentRealtimeClient.d.ts.map +1 -0
- package/dist/browser/realtime/voiceAgentRealtimeClient.js +376 -0
- package/dist/browser/realtime/voiceAgentRealtimeClient.js.map +1 -0
- package/dist/browser/realtime/webSocketTransportLike.d.ts +44 -0
- package/dist/browser/realtime/webSocketTransportLike.d.ts.map +1 -0
- package/dist/browser/realtime/webSocketTransportLike.js +4 -0
- package/dist/browser/realtime/webSocketTransportLike.js.map +1 -0
- package/dist/browser/webSocketTransport.d.ts +31 -0
- package/dist/browser/webSocketTransport.d.ts.map +1 -0
- package/dist/browser/webSocketTransport.js +218 -0
- package/dist/browser/webSocketTransport.js.map +1 -0
- package/dist/commonjs/aiProjectClient.d.ts +1 -0
- package/dist/commonjs/aiProjectClient.d.ts.map +1 -1
- package/dist/commonjs/aiProjectClient.js +16 -1
- package/dist/commonjs/aiProjectClient.js.map +2 -2
- package/dist/commonjs/api/agents/index.d.ts +1 -1
- package/dist/commonjs/api/agents/index.d.ts.map +1 -1
- package/dist/commonjs/api/agents/index.js.map +1 -1
- package/dist/commonjs/api/agents/options.d.ts +91 -1
- 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/aiProjectContext.d.ts +3 -0
- package/dist/commonjs/api/aiProjectContext.d.ts.map +1 -1
- package/dist/commonjs/api/aiProjectContext.js.map +2 -2
- 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 -0
- package/dist/commonjs/api/beta/agents/index.js.map +2 -2
- package/dist/commonjs/api/beta/agents/operations.d.ts +9 -2
- package/dist/commonjs/api/beta/agents/operations.d.ts.map +1 -1
- package/dist/commonjs/api/beta/agents/operations.js +43 -0
- package/dist/commonjs/api/beta/agents/operations.js.map +2 -2
- package/dist/commonjs/api/beta/agents/options.d.ts +3 -0
- 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/voiceAgents/conversations/index.d.ts +3 -0
- package/dist/commonjs/api/beta/voiceAgents/conversations/index.d.ts.map +1 -0
- package/dist/commonjs/api/beta/voiceAgents/conversations/index.js +54 -0
- package/dist/commonjs/api/beta/voiceAgents/conversations/index.js.map +7 -0
- package/dist/commonjs/api/beta/voiceAgents/conversations/operations.d.ts +140 -0
- package/dist/commonjs/api/beta/voiceAgents/conversations/operations.d.ts.map +1 -0
- package/dist/commonjs/api/beta/voiceAgents/conversations/operations.js +747 -0
- package/dist/commonjs/api/beta/voiceAgents/conversations/operations.js.map +7 -0
- package/dist/commonjs/api/beta/voiceAgents/conversations/options.d.ts +133 -0
- package/dist/commonjs/api/beta/voiceAgents/conversations/options.d.ts.map +1 -0
- package/dist/commonjs/api/beta/voiceAgents/conversations/options.js +16 -0
- package/dist/commonjs/api/beta/voiceAgents/conversations/options.js.map +7 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/index.d.ts +3 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/index.d.ts.map +1 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/index.js +54 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/index.js.map +7 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/operations.d.ts +62 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/operations.d.ts.map +1 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/operations.js +683 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/operations.js.map +7 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/options.d.ts +133 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/options.d.ts.map +1 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/options.js +16 -0
- package/dist/commonjs/api/beta/voiceAgents/telephony/options.js.map +7 -0
- package/dist/commonjs/api/datasets/operations.d.ts.map +1 -1
- package/dist/commonjs/api/datasets/operations.js +0 -6
- package/dist/commonjs/api/datasets/operations.js.map +2 -2
- package/dist/commonjs/api/toolboxes/index.d.ts +2 -2
- package/dist/commonjs/api/toolboxes/index.d.ts.map +1 -1
- package/dist/commonjs/api/toolboxes/index.js +2 -0
- package/dist/commonjs/api/toolboxes/index.js.map +2 -2
- package/dist/commonjs/api/toolboxes/operations.d.ts +6 -2
- package/dist/commonjs/api/toolboxes/operations.d.ts.map +1 -1
- package/dist/commonjs/api/toolboxes/operations.js +42 -0
- package/dist/commonjs/api/toolboxes/operations.js.map +2 -2
- package/dist/commonjs/api/toolboxes/options.d.ts +3 -0
- package/dist/commonjs/api/toolboxes/options.d.ts.map +1 -1
- package/dist/commonjs/api/toolboxes/options.js.map +1 -1
- package/dist/commonjs/classic/beta/agents/index.d.ts +8 -3
- package/dist/commonjs/classic/beta/agents/index.d.ts.map +1 -1
- package/dist/commonjs/classic/beta/agents/index.js +3 -4
- package/dist/commonjs/classic/beta/agents/index.js.map +2 -2
- package/dist/commonjs/classic/beta/index.d.ts +6 -1
- package/dist/commonjs/classic/beta/index.d.ts.map +1 -1
- package/dist/commonjs/classic/beta/index.js +5 -2
- package/dist/commonjs/classic/beta/index.js.map +2 -2
- package/dist/commonjs/classic/beta/voiceAgents/conversations/index.d.ts +115 -0
- package/dist/commonjs/classic/beta/voiceAgents/conversations/index.d.ts.map +1 -0
- package/dist/commonjs/classic/beta/voiceAgents/conversations/index.js +49 -0
- package/dist/commonjs/classic/beta/voiceAgents/conversations/index.js.map +7 -0
- package/dist/commonjs/classic/beta/voiceAgents/index.d.ts +16 -0
- package/dist/commonjs/classic/beta/voiceAgents/index.d.ts.map +1 -0
- package/dist/commonjs/classic/beta/voiceAgents/index.js +40 -0
- package/dist/commonjs/classic/beta/voiceAgents/index.js.map +7 -0
- package/dist/commonjs/classic/beta/voiceAgents/telephony/index.d.ts +37 -0
- package/dist/commonjs/classic/beta/voiceAgents/telephony/index.d.ts.map +1 -0
- package/dist/commonjs/classic/beta/voiceAgents/telephony/index.js +49 -0
- package/dist/commonjs/classic/beta/voiceAgents/telephony/index.js.map +7 -0
- package/dist/commonjs/classic/index.d.ts +3 -0
- package/dist/commonjs/classic/index.d.ts.map +1 -1
- package/dist/commonjs/classic/index.js.map +1 -1
- package/dist/commonjs/classic/toolboxes/index.d.ts +4 -2
- package/dist/commonjs/classic/toolboxes/index.d.ts.map +1 -1
- package/dist/commonjs/classic/toolboxes/index.js +1 -0
- package/dist/commonjs/classic/toolboxes/index.js.map +2 -2
- 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/deprecate.interface.d.ts +16 -4
- package/dist/commonjs/deprecate.interface.d.ts.map +1 -1
- package/dist/commonjs/deprecate.interface.js.map +1 -1
- package/dist/commonjs/index.d.ts +15 -4
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +14 -0
- package/dist/commonjs/index.js.map +2 -2
- package/dist/commonjs/models/index.d.ts +2 -1
- 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 +4198 -28
- package/dist/commonjs/models/models.d.ts.map +1 -1
- package/dist/commonjs/models/models.js +5809 -32
- package/dist/commonjs/models/models.js.map +2 -2
- package/dist/commonjs/package.json +1 -1
- package/dist/commonjs/realtime/asyncQueue.d.ts +29 -0
- package/dist/commonjs/realtime/asyncQueue.d.ts.map +1 -0
- package/dist/commonjs/realtime/asyncQueue.js +127 -0
- package/dist/commonjs/realtime/asyncQueue.js.map +7 -0
- package/dist/commonjs/realtime/errors.d.ts +34 -0
- package/dist/commonjs/realtime/errors.d.ts.map +1 -0
- package/dist/commonjs/realtime/errors.js +66 -0
- package/dist/commonjs/realtime/errors.js.map +7 -0
- package/dist/commonjs/realtime/events.d.ts +24 -0
- package/dist/commonjs/realtime/events.d.ts.map +1 -0
- package/dist/commonjs/realtime/events.js +16 -0
- package/dist/commonjs/realtime/events.js.map +7 -0
- package/dist/commonjs/realtime/protocol.d.ts +7 -0
- package/dist/commonjs/realtime/protocol.d.ts.map +1 -0
- package/dist/commonjs/realtime/protocol.js +297 -0
- package/dist/commonjs/realtime/protocol.js.map +7 -0
- package/dist/commonjs/realtime/voiceAgentRealtimeClient.d.ts +145 -0
- package/dist/commonjs/realtime/voiceAgentRealtimeClient.d.ts.map +1 -0
- package/dist/commonjs/realtime/voiceAgentRealtimeClient.js +443 -0
- package/dist/commonjs/realtime/voiceAgentRealtimeClient.js.map +7 -0
- package/dist/commonjs/realtime/webSocketTransportLike.d.ts +44 -0
- package/dist/commonjs/realtime/webSocketTransportLike.d.ts.map +1 -0
- package/dist/commonjs/realtime/webSocketTransportLike.js +16 -0
- package/dist/commonjs/realtime/webSocketTransportLike.js.map +7 -0
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/webSocketTransport.d.ts +15 -0
- package/dist/commonjs/webSocketTransport.d.ts.map +1 -0
- package/dist/commonjs/webSocketTransport.js +232 -0
- package/dist/commonjs/webSocketTransport.js.map +7 -0
- package/dist/esm/aiProjectClient.d.ts +1 -0
- package/dist/esm/aiProjectClient.d.ts.map +1 -1
- package/dist/esm/aiProjectClient.js +16 -1
- package/dist/esm/aiProjectClient.js.map +1 -1
- package/dist/esm/api/agents/index.d.ts +1 -1
- package/dist/esm/api/agents/index.d.ts.map +1 -1
- package/dist/esm/api/agents/index.js.map +1 -1
- package/dist/esm/api/agents/options.d.ts +91 -1
- 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/aiProjectContext.d.ts +3 -0
- package/dist/esm/api/aiProjectContext.d.ts.map +1 -1
- package/dist/esm/api/aiProjectContext.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 +9 -2
- package/dist/esm/api/beta/agents/operations.d.ts.map +1 -1
- package/dist/esm/api/beta/agents/operations.js +38 -1
- package/dist/esm/api/beta/agents/operations.js.map +1 -1
- package/dist/esm/api/beta/agents/options.d.ts +3 -0
- 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/voiceAgents/conversations/index.d.ts +3 -0
- package/dist/esm/api/beta/voiceAgents/conversations/index.d.ts.map +1 -0
- package/dist/esm/api/beta/voiceAgents/conversations/index.js +4 -0
- package/dist/esm/api/beta/voiceAgents/conversations/index.js.map +1 -0
- package/dist/esm/api/beta/voiceAgents/conversations/operations.d.ts +140 -0
- package/dist/esm/api/beta/voiceAgents/conversations/operations.d.ts.map +1 -0
- package/dist/esm/api/beta/voiceAgents/conversations/operations.js +635 -0
- package/dist/esm/api/beta/voiceAgents/conversations/operations.js.map +1 -0
- package/dist/esm/api/beta/voiceAgents/conversations/options.d.ts +133 -0
- package/dist/esm/api/beta/voiceAgents/conversations/options.d.ts.map +1 -0
- package/dist/esm/api/beta/voiceAgents/conversations/options.js +4 -0
- package/dist/esm/api/beta/voiceAgents/conversations/options.js.map +1 -0
- package/dist/esm/api/beta/voiceAgents/telephony/index.d.ts +3 -0
- package/dist/esm/api/beta/voiceAgents/telephony/index.d.ts.map +1 -0
- package/dist/esm/api/beta/voiceAgents/telephony/index.js +4 -0
- package/dist/esm/api/beta/voiceAgents/telephony/index.js.map +1 -0
- package/dist/esm/api/beta/voiceAgents/telephony/operations.d.ts +62 -0
- package/dist/esm/api/beta/voiceAgents/telephony/operations.d.ts.map +1 -0
- package/dist/esm/api/beta/voiceAgents/telephony/operations.js +559 -0
- package/dist/esm/api/beta/voiceAgents/telephony/operations.js.map +1 -0
- package/dist/esm/api/beta/voiceAgents/telephony/options.d.ts +133 -0
- package/dist/esm/api/beta/voiceAgents/telephony/options.d.ts.map +1 -0
- package/dist/esm/api/beta/voiceAgents/telephony/options.js +4 -0
- package/dist/esm/api/beta/voiceAgents/telephony/options.js.map +1 -0
- package/dist/esm/api/datasets/operations.d.ts.map +1 -1
- package/dist/esm/api/datasets/operations.js +1 -3
- package/dist/esm/api/datasets/operations.js.map +1 -1
- package/dist/esm/api/toolboxes/index.d.ts +2 -2
- package/dist/esm/api/toolboxes/index.d.ts.map +1 -1
- package/dist/esm/api/toolboxes/index.js +1 -1
- package/dist/esm/api/toolboxes/index.js.map +1 -1
- package/dist/esm/api/toolboxes/operations.d.ts +6 -2
- package/dist/esm/api/toolboxes/operations.d.ts.map +1 -1
- package/dist/esm/api/toolboxes/operations.js +33 -0
- package/dist/esm/api/toolboxes/operations.js.map +1 -1
- package/dist/esm/api/toolboxes/options.d.ts +3 -0
- package/dist/esm/api/toolboxes/options.d.ts.map +1 -1
- package/dist/esm/api/toolboxes/options.js.map +1 -1
- package/dist/esm/classic/beta/agents/index.d.ts +8 -3
- package/dist/esm/classic/beta/agents/index.d.ts.map +1 -1
- package/dist/esm/classic/beta/agents/index.js +3 -4
- package/dist/esm/classic/beta/agents/index.js.map +1 -1
- package/dist/esm/classic/beta/index.d.ts +6 -1
- package/dist/esm/classic/beta/index.d.ts.map +1 -1
- package/dist/esm/classic/beta/index.js +4 -1
- package/dist/esm/classic/beta/index.js.map +1 -1
- package/dist/esm/classic/beta/voiceAgents/conversations/index.d.ts +115 -0
- package/dist/esm/classic/beta/voiceAgents/conversations/index.d.ts.map +1 -0
- package/dist/esm/classic/beta/voiceAgents/conversations/index.js +25 -0
- package/dist/esm/classic/beta/voiceAgents/conversations/index.js.map +1 -0
- package/dist/esm/classic/beta/voiceAgents/index.d.ts +16 -0
- package/dist/esm/classic/beta/voiceAgents/index.d.ts.map +1 -0
- package/dist/esm/classic/beta/voiceAgents/index.js +16 -0
- package/dist/esm/classic/beta/voiceAgents/index.js.map +1 -0
- package/dist/esm/classic/beta/voiceAgents/telephony/index.d.ts +37 -0
- package/dist/esm/classic/beta/voiceAgents/telephony/index.d.ts.map +1 -0
- package/dist/esm/classic/beta/voiceAgents/telephony/index.js +25 -0
- package/dist/esm/classic/beta/voiceAgents/telephony/index.js.map +1 -0
- package/dist/esm/classic/index.d.ts +3 -0
- package/dist/esm/classic/index.d.ts.map +1 -1
- package/dist/esm/classic/index.js.map +1 -1
- package/dist/esm/classic/toolboxes/index.d.ts +4 -2
- package/dist/esm/classic/toolboxes/index.d.ts.map +1 -1
- package/dist/esm/classic/toolboxes/index.js +2 -1
- package/dist/esm/classic/toolboxes/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/deprecate.interface.d.ts +16 -4
- package/dist/esm/deprecate.interface.d.ts.map +1 -1
- package/dist/esm/deprecate.interface.js.map +1 -1
- package/dist/esm/index.d.ts +15 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models/index.d.ts +2 -1
- 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 +4198 -28
- package/dist/esm/models/models.d.ts.map +1 -1
- package/dist/esm/models/models.js +4881 -22
- package/dist/esm/models/models.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/esm/realtime/asyncQueue.d.ts +29 -0
- package/dist/esm/realtime/asyncQueue.d.ts.map +1 -0
- package/dist/esm/realtime/asyncQueue.js +105 -0
- package/dist/esm/realtime/asyncQueue.js.map +1 -0
- package/dist/esm/realtime/errors.d.ts +34 -0
- package/dist/esm/realtime/errors.d.ts.map +1 -0
- package/dist/esm/realtime/errors.js +40 -0
- package/dist/esm/realtime/errors.js.map +1 -0
- package/dist/esm/realtime/events.d.ts +24 -0
- package/dist/esm/realtime/events.d.ts.map +1 -0
- package/dist/esm/realtime/events.js +4 -0
- package/dist/esm/realtime/events.js.map +1 -0
- package/dist/esm/realtime/protocol.d.ts +7 -0
- package/dist/esm/realtime/protocol.d.ts.map +1 -0
- package/dist/esm/realtime/protocol.js +262 -0
- package/dist/esm/realtime/protocol.js.map +1 -0
- package/dist/esm/realtime/voiceAgentRealtimeClient.d.ts +145 -0
- package/dist/esm/realtime/voiceAgentRealtimeClient.d.ts.map +1 -0
- package/dist/esm/realtime/voiceAgentRealtimeClient.js +376 -0
- package/dist/esm/realtime/voiceAgentRealtimeClient.js.map +1 -0
- package/dist/esm/realtime/webSocketTransportLike.d.ts +44 -0
- package/dist/esm/realtime/webSocketTransportLike.d.ts.map +1 -0
- package/dist/esm/realtime/webSocketTransportLike.js +4 -0
- package/dist/esm/realtime/webSocketTransportLike.js.map +1 -0
- package/dist/esm/webSocketTransport.d.ts +15 -0
- package/dist/esm/webSocketTransport.d.ts.map +1 -0
- package/dist/esm/webSocketTransport.js +220 -0
- package/dist/esm/webSocketTransport.js.map +1 -0
- package/dist/react-native/aiProjectClient.d.ts +1 -0
- package/dist/react-native/aiProjectClient.d.ts.map +1 -1
- package/dist/react-native/aiProjectClient.js +16 -1
- package/dist/react-native/aiProjectClient.js.map +1 -1
- package/dist/react-native/api/agents/index.d.ts +1 -1
- package/dist/react-native/api/agents/index.d.ts.map +1 -1
- package/dist/react-native/api/agents/index.js.map +1 -1
- package/dist/react-native/api/agents/options.d.ts +91 -1
- 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/aiProjectContext.d.ts +3 -0
- package/dist/react-native/api/aiProjectContext.d.ts.map +1 -1
- package/dist/react-native/api/aiProjectContext.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 +9 -2
- package/dist/react-native/api/beta/agents/operations.d.ts.map +1 -1
- package/dist/react-native/api/beta/agents/operations.js +38 -1
- package/dist/react-native/api/beta/agents/operations.js.map +1 -1
- package/dist/react-native/api/beta/agents/options.d.ts +3 -0
- 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/voiceAgents/conversations/index.d.ts +3 -0
- package/dist/react-native/api/beta/voiceAgents/conversations/index.d.ts.map +1 -0
- package/dist/react-native/api/beta/voiceAgents/conversations/index.js +4 -0
- package/dist/react-native/api/beta/voiceAgents/conversations/index.js.map +1 -0
- package/dist/react-native/api/beta/voiceAgents/conversations/operations.d.ts +140 -0
- package/dist/react-native/api/beta/voiceAgents/conversations/operations.d.ts.map +1 -0
- package/dist/react-native/api/beta/voiceAgents/conversations/operations.js +635 -0
- package/dist/react-native/api/beta/voiceAgents/conversations/operations.js.map +1 -0
- package/dist/react-native/api/beta/voiceAgents/conversations/options.d.ts +133 -0
- package/dist/react-native/api/beta/voiceAgents/conversations/options.d.ts.map +1 -0
- package/dist/react-native/api/beta/voiceAgents/conversations/options.js +4 -0
- package/dist/react-native/api/beta/voiceAgents/conversations/options.js.map +1 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/index.d.ts +3 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/index.d.ts.map +1 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/index.js +4 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/index.js.map +1 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/operations.d.ts +62 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/operations.d.ts.map +1 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/operations.js +559 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/operations.js.map +1 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/options.d.ts +133 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/options.d.ts.map +1 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/options.js +4 -0
- package/dist/react-native/api/beta/voiceAgents/telephony/options.js.map +1 -0
- package/dist/react-native/api/datasets/operations.d.ts.map +1 -1
- package/dist/react-native/api/datasets/operations.js +1 -3
- package/dist/react-native/api/datasets/operations.js.map +1 -1
- package/dist/react-native/api/toolboxes/index.d.ts +2 -2
- package/dist/react-native/api/toolboxes/index.d.ts.map +1 -1
- package/dist/react-native/api/toolboxes/index.js +1 -1
- package/dist/react-native/api/toolboxes/index.js.map +1 -1
- package/dist/react-native/api/toolboxes/operations.d.ts +6 -2
- package/dist/react-native/api/toolboxes/operations.d.ts.map +1 -1
- package/dist/react-native/api/toolboxes/operations.js +33 -0
- package/dist/react-native/api/toolboxes/operations.js.map +1 -1
- package/dist/react-native/api/toolboxes/options.d.ts +3 -0
- package/dist/react-native/api/toolboxes/options.d.ts.map +1 -1
- package/dist/react-native/api/toolboxes/options.js.map +1 -1
- package/dist/react-native/classic/beta/agents/index.d.ts +8 -3
- package/dist/react-native/classic/beta/agents/index.d.ts.map +1 -1
- package/dist/react-native/classic/beta/agents/index.js +3 -4
- package/dist/react-native/classic/beta/agents/index.js.map +1 -1
- package/dist/react-native/classic/beta/index.d.ts +6 -1
- package/dist/react-native/classic/beta/index.d.ts.map +1 -1
- package/dist/react-native/classic/beta/index.js +4 -1
- package/dist/react-native/classic/beta/index.js.map +1 -1
- package/dist/react-native/classic/beta/voiceAgents/conversations/index.d.ts +115 -0
- package/dist/react-native/classic/beta/voiceAgents/conversations/index.d.ts.map +1 -0
- package/dist/react-native/classic/beta/voiceAgents/conversations/index.js +25 -0
- package/dist/react-native/classic/beta/voiceAgents/conversations/index.js.map +1 -0
- package/dist/react-native/classic/beta/voiceAgents/index.d.ts +16 -0
- package/dist/react-native/classic/beta/voiceAgents/index.d.ts.map +1 -0
- package/dist/react-native/classic/beta/voiceAgents/index.js +16 -0
- package/dist/react-native/classic/beta/voiceAgents/index.js.map +1 -0
- package/dist/react-native/classic/beta/voiceAgents/telephony/index.d.ts +37 -0
- package/dist/react-native/classic/beta/voiceAgents/telephony/index.d.ts.map +1 -0
- package/dist/react-native/classic/beta/voiceAgents/telephony/index.js +25 -0
- package/dist/react-native/classic/beta/voiceAgents/telephony/index.js.map +1 -0
- package/dist/react-native/classic/index.d.ts +3 -0
- 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/classic/toolboxes/index.d.ts +4 -2
- package/dist/react-native/classic/toolboxes/index.d.ts.map +1 -1
- package/dist/react-native/classic/toolboxes/index.js +2 -1
- package/dist/react-native/classic/toolboxes/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/deprecate.interface.d.ts +16 -4
- package/dist/react-native/deprecate.interface.d.ts.map +1 -1
- package/dist/react-native/deprecate.interface.js.map +1 -1
- package/dist/react-native/index.d.ts +15 -4
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +2 -0
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/models/index.d.ts +2 -1
- 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 +4198 -28
- package/dist/react-native/models/models.d.ts.map +1 -1
- package/dist/react-native/models/models.js +4881 -22
- package/dist/react-native/models/models.js.map +1 -1
- package/dist/react-native/package.json +1 -1
- package/dist/react-native/realtime/asyncQueue.d.ts +29 -0
- package/dist/react-native/realtime/asyncQueue.d.ts.map +1 -0
- package/dist/react-native/realtime/asyncQueue.js +105 -0
- package/dist/react-native/realtime/asyncQueue.js.map +1 -0
- package/dist/react-native/realtime/errors.d.ts +34 -0
- package/dist/react-native/realtime/errors.d.ts.map +1 -0
- package/dist/react-native/realtime/errors.js +40 -0
- package/dist/react-native/realtime/errors.js.map +1 -0
- package/dist/react-native/realtime/events.d.ts +24 -0
- package/dist/react-native/realtime/events.d.ts.map +1 -0
- package/dist/react-native/realtime/events.js +4 -0
- package/dist/react-native/realtime/events.js.map +1 -0
- package/dist/react-native/realtime/protocol.d.ts +7 -0
- package/dist/react-native/realtime/protocol.d.ts.map +1 -0
- package/dist/react-native/realtime/protocol.js +262 -0
- package/dist/react-native/realtime/protocol.js.map +1 -0
- package/dist/react-native/realtime/voiceAgentRealtimeClient.d.ts +145 -0
- package/dist/react-native/realtime/voiceAgentRealtimeClient.d.ts.map +1 -0
- package/dist/react-native/realtime/voiceAgentRealtimeClient.js +376 -0
- package/dist/react-native/realtime/voiceAgentRealtimeClient.js.map +1 -0
- package/dist/react-native/realtime/webSocketTransportLike.d.ts +44 -0
- package/dist/react-native/realtime/webSocketTransportLike.d.ts.map +1 -0
- package/dist/react-native/realtime/webSocketTransportLike.js +4 -0
- package/dist/react-native/realtime/webSocketTransportLike.js.map +1 -0
- package/dist/react-native/webSocketTransport-browser.d.mts +31 -0
- package/dist/react-native/webSocketTransport-browser.d.mts.map +1 -0
- package/dist/react-native/webSocketTransport-browser.mjs +218 -0
- package/dist/react-native/webSocketTransport-browser.mjs.map +1 -0
- package/dist/react-native/webSocketTransport.d.ts +2 -0
- package/dist/react-native/webSocketTransport.d.ts.map +1 -0
- package/dist/react-native/webSocketTransport.js +6 -0
- package/dist/react-native/webSocketTransport.js.map +1 -0
- package/package.json +8 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/realtime/protocol.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAYtD,MAAM,sBAAsB,GAExB;IACF,0BAA0B,EAAE,MAAM,CAAC,mDAAmD;IACtF,0BAA0B,EAAE,MAAM,CAAC,mDAAmD;IACtF,4BAA4B,EAAE,MAAM,CAAC,qDAAqD;IAC1F,4BAA4B,EAAE,MAAM,CAAC,qDAAqD;IAC1F,2BAA2B,EAAE,MAAM,CAAC,mDAAmD;IACvF,0BAA0B,EAAE,MAAM,CAAC,kDAAkD;IACrF,2BAA2B,EAAE,MAAM,CAAC,mDAAmD;IACvF,2BAA2B,EAAE,MAAM,CAAC,mDAAmD;IACvF,iBAAiB,EAAE,MAAM,CAAC,2CAA2C;IACrE,iBAAiB,EAAE,MAAM,CAAC,2CAA2C;IACrE,qBAAqB,EAAE,MAAM,CAAC,+CAA+C;IAC7E,gBAAgB,EAAE,MAAM,CAAC,4CAA4C;IACrE,wBAAwB,EAAE,MAAM,CAAC,mDAAmD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IACjF,CAAC;IACD,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC7B,OAAO,CAAC,gBAAgB,GAAG,0BAA0B,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAClF,CAAC;AACH,CAAC;AAED,SAAS,wBAAwB,CAC/B,aAAwD;IAExD,QAAQ,aAAa,CAAC,IAAI,EAAE,CAAC;QAC3B,KAAK,YAAY;YACf,OAAO,MAAM,CAAC,4CAA4C,CACxD,aAAwD,CACzD,CAAC;QACJ,KAAK,cAAc;YACjB,OAAO,MAAM,CAAC,8CAA8C,CAC1D,aAA0D,CAC3D,CAAC;QACJ,KAAK,oBAAoB;YACvB,OAAO,MAAM,CAAC,mDAAmD,CAC/D,aAA+D,CAChE,CAAC;QACJ,KAAK,uBAAuB;YAC1B,OAAO,MAAM,CAAC,qDAAqD,CACjE,aAAiE,CAClE,CAAC;QACJ,KAAK,iCAAiC;YACpC,OAAO,MAAM,CAAC,+DAA+D,CAC3E,aAA2E,CAC5E,CAAC;QACJ;YACE,OAAO,MAAM,CAAC,yCAAyC,CAAC,aAAa,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC;AAED,SAAS,0BAA0B,CACjC,eAA4D;IAE5D,OAAO,eAAe,CAAC,IAAI,KAAK,yBAAyB;QACvD,CAAC,CAAC,MAAM,CAAC,iDAAiD,CACtD,eAA+D,CAChE;QACH,CAAC,CAAC,MAAM,CAAC,8CAA8C,CACnD,eAA4D,CAC7D,CAAC;AACR,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { VoiceAgentClientEvent, VoiceAgentServerEvent } from \"../models/models.js\";\nimport * as models from \"../models/models.js\";\nimport { VoiceAgentProtocolError } from \"./errors.js\";\nimport type { VoiceAgentRealtimeEvent } from \"./events.js\";\n\ntype ClientEventSerializer<\n T extends VoiceAgentClientEvent[\"type\"] = VoiceAgentClientEvent[\"type\"],\n> = (event: Extract<VoiceAgentClientEvent, { type: T }>) => unknown;\ntype ServerEventDeserializer<\n T extends VoiceAgentServerEvent[\"type\"] = VoiceAgentServerEvent[\"type\"],\n> = (event: unknown) => Extract<VoiceAgentServerEvent, { type: T }>;\ntype RequiredEventFields<T extends VoiceAgentServerEvent[\"type\"] = VoiceAgentServerEvent[\"type\"]> =\n ReadonlyArray<keyof Extract<VoiceAgentServerEvent, { type: T }>>;\n\nconst clientEventSerializers: {\n readonly [K in VoiceAgentClientEvent[\"type\"]]?: ClientEventSerializer<K>;\n} = {\n \"conversation.item.create\": models.realtimeClientEventConversationItemCreateSerializer,\n \"conversation.item.delete\": models.realtimeClientEventConversationItemDeleteSerializer,\n \"conversation.item.retrieve\": models.realtimeClientEventConversationItemRetrieveSerializer,\n \"conversation.item.truncate\": models.realtimeClientEventConversationItemTruncateSerializer,\n \"input_audio_buffer.append\": models.realtimeClientEventInputAudioBufferAppendSerializer,\n \"input_audio_buffer.clear\": models.realtimeClientEventInputAudioBufferClearSerializer,\n \"input_audio_buffer.commit\": models.realtimeClientEventInputAudioBufferCommitSerializer,\n \"output_audio_buffer.clear\": models.realtimeClientEventOutputAudioBufferClearSerializer,\n \"response.cancel\": models.realtimeClientEventResponseCancelSerializer,\n \"response.create\": models.realtimeClientEventResponseCreateSerializer,\n \"rtc.call.sdp.create\": models.voiceAgentClientEventRtcCallSdpCreateSerializer,\n \"session.update\": models.voiceAgentClientEventSessionUpdateSerializer,\n \"session.avatar.connect\": models.voiceAgentClientEventSessionAvatarConnectSerializer,\n};\n\nconst serverEventDeserializers: {\n readonly [K in VoiceAgentServerEvent[\"type\"]]?: ServerEventDeserializer<K>;\n} = {\n \"conversation.item.added\": models.realtimeServerEventConversationItemAddedDeserializer,\n \"conversation.item.created\": models.realtimeServerEventConversationItemCreatedDeserializer,\n \"conversation.item.deleted\": models.realtimeServerEventConversationItemDeletedDeserializer,\n \"conversation.item.done\": models.realtimeServerEventConversationItemDoneDeserializer,\n \"conversation.item.input_audio_transcription.completed\":\n models.realtimeServerEventConversationItemInputAudioTranscriptionCompletedDeserializer,\n \"conversation.item.input_audio_transcription.delta\":\n models.realtimeServerEventConversationItemInputAudioTranscriptionDeltaDeserializer,\n \"conversation.item.input_audio_transcription.failed\":\n models.realtimeServerEventConversationItemInputAudioTranscriptionFailedDeserializer,\n \"conversation.item.input_audio_transcription.segment\":\n models.realtimeServerEventConversationItemInputAudioTranscriptionSegmentDeserializer,\n \"conversation.item.retrieved\": models.realtimeServerEventConversationItemRetrievedDeserializer,\n \"conversation.item.truncated\": models.realtimeServerEventConversationItemTruncatedDeserializer,\n \"input_audio_buffer.cleared\": models.realtimeServerEventInputAudioBufferClearedDeserializer,\n \"input_audio_buffer.committed\": models.realtimeServerEventInputAudioBufferCommittedDeserializer,\n \"input_audio_buffer.speech_started\":\n models.realtimeServerEventInputAudioBufferSpeechStartedDeserializer,\n \"input_audio_buffer.speech_stopped\":\n models.realtimeServerEventInputAudioBufferSpeechStoppedDeserializer,\n \"input_audio_buffer.timeout_triggered\":\n models.realtimeServerEventInputAudioBufferTimeoutTriggeredDeserializer,\n \"mcp_list_tools.completed\": models.realtimeServerEventMCPListToolsCompletedDeserializer,\n \"mcp_list_tools.failed\": models.realtimeServerEventMCPListToolsFailedDeserializer,\n \"mcp_list_tools.in_progress\": models.realtimeServerEventMCPListToolsInProgressDeserializer,\n \"output_audio_buffer.cleared\": models.realtimeServerEventOutputAudioBufferClearedDeserializer,\n \"rate_limits.updated\": models.realtimeServerEventRateLimitsUpdatedDeserializer,\n \"response.output_audio.delta\": models.realtimeServerEventResponseAudioDeltaDeserializer,\n \"response.output_audio.done\": models.realtimeServerEventResponseAudioDoneDeserializer,\n \"response.output_audio_transcript.delta\":\n models.realtimeServerEventResponseAudioTranscriptDeltaDeserializer,\n \"response.output_audio_transcript.done\":\n models.realtimeServerEventResponseAudioTranscriptDoneDeserializer,\n \"response.content_part.added\": models.realtimeServerEventResponseContentPartAddedDeserializer,\n \"response.content_part.done\": models.realtimeServerEventResponseContentPartDoneDeserializer,\n \"response.created\": models.realtimeServerEventResponseCreatedDeserializer,\n \"response.done\": models.realtimeServerEventResponseDoneDeserializer,\n \"response.function_call_arguments.delta\":\n models.realtimeServerEventResponseFunctionCallArgumentsDeltaDeserializer,\n \"response.function_call_arguments.done\":\n models.realtimeServerEventResponseFunctionCallArgumentsDoneDeserializer,\n \"response.mcp_call_arguments.delta\":\n models.realtimeServerEventResponseMCPCallArgumentsDeltaDeserializer,\n \"response.mcp_call_arguments.done\":\n models.realtimeServerEventResponseMCPCallArgumentsDoneDeserializer,\n \"response.mcp_call.completed\": models.realtimeServerEventResponseMCPCallCompletedDeserializer,\n \"response.mcp_call.failed\": models.realtimeServerEventResponseMCPCallFailedDeserializer,\n \"response.mcp_call.in_progress\": models.realtimeServerEventResponseMCPCallInProgressDeserializer,\n \"response.output_item.added\": models.realtimeServerEventResponseOutputItemAddedDeserializer,\n \"response.output_item.done\": models.realtimeServerEventResponseOutputItemDoneDeserializer,\n \"response.output_text.delta\": models.realtimeServerEventResponseTextDeltaDeserializer,\n \"response.output_text.done\": models.realtimeServerEventResponseTextDoneDeserializer,\n \"rtc.call.error\": models.voiceAgentServerEventRtcCallErrorDeserializer,\n \"rtc.call.sdp.created\": models.voiceAgentServerEventRtcCallSdpCreatedDeserializer,\n \"session.created\": models.realtimeServerEventSessionCreatedDeserializer,\n \"session.subagent.aborted\": models.voiceAgentServerEventSessionSubagentAbortedDeserializer,\n \"session.subagent.completed\": models.voiceAgentServerEventSessionSubagentCompletedDeserializer,\n \"session.subagent.started\": models.voiceAgentServerEventSessionSubagentStartedDeserializer,\n \"session.updated\": models.realtimeServerEventSessionUpdatedDeserializer,\n error: models.realtimeServerEventErrorDeserializer,\n warning: models.voiceAgentServerEventWarningDeserializer,\n \"session.avatar.connecting\": models.voiceAgentServerEventSessionAvatarConnectingDeserializer,\n \"session.avatar.switch_to_speaking\":\n models.voiceAgentServerEventSessionAvatarSwitchToSpeakingDeserializer,\n \"session.avatar.switch_to_idle\":\n models.voiceAgentServerEventSessionAvatarSwitchToIdleDeserializer,\n \"response.audio_timestamp.delta\":\n models.voiceAgentServerEventResponseAudioTimestampDeltaDeserializer,\n \"response.audio_timestamp.done\":\n models.voiceAgentServerEventResponseAudioTimestampDoneDeserializer,\n \"response.animation_blendshapes.delta\":\n models.voiceAgentServerEventResponseAnimationBlendshapesDeltaDeserializer,\n \"response.animation_blendshapes.done\":\n models.voiceAgentServerEventResponseAnimationBlendshapesDoneDeserializer,\n \"response.animation_viseme.delta\":\n models.voiceAgentServerEventResponseAnimationVisemeDeltaDeserializer,\n \"response.animation_viseme.done\":\n models.voiceAgentServerEventResponseAnimationVisemeDoneDeserializer,\n \"response.video.delta\": models.voiceAgentServerEventResponseVideoDeltaDeserializer,\n};\n\n/** @internal */\nexport function serializeVoiceAgentClientEvent(event: VoiceAgentClientEvent): string {\n const serializer = clientEventSerializers[event.type];\n if (!serializer) {\n throw new VoiceAgentProtocolError(`Unsupported client event type: ${event.type}`);\n }\n const serialized = serializer(event as never) as Record<string, unknown>;\n if (event.type === \"session.update\") {\n normalizeSessionUnions(event.session, serialized[\"session\"] as Record<string, unknown>);\n } else if (event.type === \"rtc.call.sdp.create\" && event.session) {\n normalizeSessionUnions(event.session, serialized[\"session\"] as Record<string, unknown>);\n } else if (event.type === \"response.create\" && event.response?.interim_response) {\n const response = serialized[\"response\"] as Record<string, unknown>;\n response[\"interim_response\"] = serializeInterimResponse(event.response.interim_response);\n } else if (event.type === \"conversation.item.create\") {\n restoreMessageItemFields(event.item, serialized[\"item\"] as Record<string, unknown>);\n }\n return JSON.stringify(serialized);\n}\n\n// The generated `RealtimeConversationItemUnion` does not enumerate a \"message\" item variant, so\n// `realtimeConversationItemUnionSerializer` falls back to `realtimeConversationItemSerializer`,\n// which only emits `{ type }` and silently drops `role`/`content`. Restore those fields from the\n// original (pre-serialization) item so the wire payload built by `sendText` is complete; see the\n// TypeSpec regeneration report for details on this generated-model gap.\nfunction restoreMessageItemFields(item: unknown, serializedItem: Record<string, unknown>): void {\n const source = item as { type?: string; role?: unknown; content?: unknown };\n if (source?.type === \"message\") {\n serializedItem[\"role\"] = source.role;\n serializedItem[\"content\"] = source.content;\n }\n}\n\n/** @internal */\nexport function deserializeVoiceAgentServerEvent(\n data: string | ArrayBuffer,\n): VoiceAgentRealtimeEvent {\n const text = typeof data === \"string\" ? data : new TextDecoder().decode(data);\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch (error) {\n throw new VoiceAgentProtocolError(\"The service returned invalid JSON.\", { cause: error });\n }\n\n if (!parsed || typeof parsed !== \"object\" || !(\"type\" in parsed)) {\n throw new VoiceAgentProtocolError(\n \"The service returned an event without a type discriminator.\",\n );\n }\n\n const eventType = (parsed as { type?: unknown }).type;\n if (typeof eventType !== \"string\") {\n throw new VoiceAgentProtocolError(\"The service returned an invalid event type discriminator.\");\n }\n\n const deserializer = Object.prototype.hasOwnProperty.call(serverEventDeserializers, eventType)\n ? (serverEventDeserializers as Record<string, ServerEventDeserializer | undefined>)[eventType]\n : undefined;\n if (!deserializer) {\n return {\n type: \"unknown\",\n eventType,\n rawEvent: parsed as Record<string, unknown>,\n };\n }\n const event = deserializer(parsed);\n validateRequiredServerEventFields(eventType, event);\n if (event.type === \"response.output_audio.delta\") {\n return { ...event, delta: new Uint8Array(event.delta) };\n }\n if (event.type === \"session.created\" || event.type === \"session.updated\") {\n normalizeSessionResponseUnions(event.session);\n }\n return event;\n}\n\n/**\n * Per-type-required fields for the events the SDK and its samples actually dereference (deltas,\n * ids, error details). Not an exhaustive schema for every event type — that belongs in the\n * generator — but combined with the universal `event_id` check below it catches the reported class\n * of bug: a minimal payload like `{\"type\":\"response.output_text.delta\"}` deserializing \"successfully\"\n * with every other required property left `undefined`.\n *\n * Typed so each field name is checked against the real event interface for its type: a typo, or a\n * field renamed/removed by a future regeneration, fails to compile here instead of silently\n * no-op'ing at runtime.\n */\nconst requiredServerEventFields: {\n readonly [K in VoiceAgentServerEvent[\"type\"]]?: RequiredEventFields<K>;\n} = {\n \"response.output_text.delta\": [\"delta\", \"item_id\", \"response_id\"],\n \"response.output_audio.delta\": [\"delta\", \"item_id\", \"response_id\"],\n \"response.output_audio_transcript.delta\": [\"delta\", \"item_id\", \"response_id\"],\n \"response.function_call_arguments.delta\": [\"delta\", \"call_id\"],\n \"response.function_call_arguments.done\": [\"arguments\", \"call_id\"],\n \"response.created\": [\"response\"],\n \"response.done\": [\"response\"],\n \"rtc.call.error\": [\"error\"],\n \"rtc.call.sdp.created\": [\"rtc_call_id\", \"sdp_answer\"],\n error: [\"error\"],\n \"session.created\": [\"session\"],\n \"session.subagent.aborted\": [\"consultation_id\", \"call_id\", \"subagent_name\", \"reason\"],\n \"session.subagent.completed\": [\"consultation_id\", \"call_id\", \"subagent_name\"],\n \"session.subagent.started\": [\"consultation_id\", \"call_id\", \"subagent_name\"],\n \"session.updated\": [\"session\"],\n};\n\nconst optionalEventIdServerEvents = new Set<VoiceAgentServerEvent[\"type\"]>([\"rtc.call.error\"]);\n\nfunction validateRequiredServerEventFields(eventType: string, event: unknown): void {\n const record = event as Record<string, unknown>;\n const eventId = record[\"event_id\"];\n if (\n !(optionalEventIdServerEvents as ReadonlySet<string>).has(eventType) &&\n (typeof eventId !== \"string\" || eventId.length === 0)\n ) {\n throw new VoiceAgentProtocolError(\n `The service returned a \"${eventType}\" event without a required \"event_id\" field.`,\n );\n }\n const fieldsForEventType = (\n requiredServerEventFields as Record<string, RequiredEventFields | undefined>\n )[eventType];\n for (const field of fieldsForEventType ?? []) {\n if (record[field] === undefined) {\n throw new VoiceAgentProtocolError(\n `The service returned a \"${eventType}\" event without the required \"${field}\" field.`,\n );\n }\n }\n}\n\nfunction normalizeSessionUnions(\n session: models.VoiceAgentSessionUpdateConfig,\n serialized: Record<string, unknown>,\n): void {\n const turnDetection = session.audio?.input?.turn_detection;\n if (turnDetection) {\n const audio = serialized[\"audio\"] as Record<string, unknown>;\n const input = audio[\"input\"] as Record<string, unknown>;\n input[\"turn_detection\"] = serializeTurnDetection(turnDetection);\n }\n if (session.interim_response) {\n serialized[\"interim_response\"] = serializeInterimResponse(session.interim_response);\n }\n}\n\n// The generated `VoiceAgentTurnDetectionConfig` fallback member's `type` field is typed as the\n// full `VoiceAgentTurnDetectionType` literal union (not narrowed to a single value), so TypeScript\n// cannot exclude it from any individual `case` branch below. The runtime `switch` on `.type` already\n// guarantees the narrower shape in each branch, so an explicit cast is used to reflect that.\nfunction serializeTurnDetection(turnDetection: models.VoiceAgentTurnDetectionConfigUnion): unknown {\n switch (turnDetection.type) {\n case \"server_vad\":\n return models.voiceAgentServerVadTurnDetectionSerializer(\n turnDetection as models.VoiceAgentServerVadTurnDetection,\n );\n case \"semantic_vad\":\n return models.voiceAgentSemanticVadTurnDetectionSerializer(\n turnDetection as models.VoiceAgentSemanticVadTurnDetection,\n );\n case \"azure_semantic_vad\":\n return models.voiceAgentAzureSemanticVadTurnDetectionSerializer(\n turnDetection as models.VoiceAgentAzureSemanticVadTurnDetection,\n );\n case \"azure_semantic_vad_en\":\n return models.voiceAgentAzureSemanticVadEnTurnDetectionSerializer(\n turnDetection as models.VoiceAgentAzureSemanticVadEnTurnDetection,\n );\n case \"azure_semantic_vad_multilingual\":\n return models.voiceAgentAzureSemanticVadMultilingualTurnDetectionSerializer(\n turnDetection as models.VoiceAgentAzureSemanticVadMultilingualTurnDetection,\n );\n default:\n return models.voiceAgentTurnDetectionConfigSerializer(turnDetection);\n }\n}\n\n// Same fallback-narrowing limitation as above: `VoiceAgentInterimResponseConfig.type` is `string`,\n// so the ternary's branches cannot be excluded from each other without an explicit cast.\nfunction serializeInterimResponse(\n interimResponse: models.VoiceAgentInterimResponseConfigUnion,\n): unknown {\n return interimResponse.type === \"static_interim_response\"\n ? models.voiceAgentStaticInterimResponseConfigSerializer(\n interimResponse as models.VoiceAgentStaticInterimResponseConfig,\n )\n : models.voiceAgentLlmInterimResponseConfigSerializer(\n interimResponse as models.VoiceAgentLlmInterimResponseConfig,\n );\n}\n\nfunction normalizeSessionResponseUnions(session: models.VoiceAgentSessionResponseConfig): void {\n const turnDetection = session.audio?.input?.turn_detection;\n if (turnDetection) {\n session.audio!.input!.turn_detection = deserializeTurnDetection(turnDetection);\n }\n if (session.interim_response) {\n session.interim_response = deserializeInterimResponse(session.interim_response);\n }\n}\n\nfunction deserializeTurnDetection(\n turnDetection: models.VoiceAgentTurnDetectionConfigUnion,\n): models.VoiceAgentTurnDetectionConfigUnion {\n switch (turnDetection.type) {\n case \"server_vad\":\n return models.voiceAgentServerVadTurnDetectionDeserializer(\n turnDetection as models.VoiceAgentServerVadTurnDetection,\n );\n case \"semantic_vad\":\n return models.voiceAgentSemanticVadTurnDetectionDeserializer(\n turnDetection as models.VoiceAgentSemanticVadTurnDetection,\n );\n case \"azure_semantic_vad\":\n return models.voiceAgentAzureSemanticVadTurnDetectionDeserializer(\n turnDetection as models.VoiceAgentAzureSemanticVadTurnDetection,\n );\n case \"azure_semantic_vad_en\":\n return models.voiceAgentAzureSemanticVadEnTurnDetectionDeserializer(\n turnDetection as models.VoiceAgentAzureSemanticVadEnTurnDetection,\n );\n case \"azure_semantic_vad_multilingual\":\n return models.voiceAgentAzureSemanticVadMultilingualTurnDetectionDeserializer(\n turnDetection as models.VoiceAgentAzureSemanticVadMultilingualTurnDetection,\n );\n default:\n return models.voiceAgentTurnDetectionConfigDeserializer(turnDetection);\n }\n}\n\nfunction deserializeInterimResponse(\n interimResponse: models.VoiceAgentInterimResponseConfigUnion,\n): models.VoiceAgentInterimResponseConfigUnion {\n return interimResponse.type === \"static_interim_response\"\n ? models.voiceAgentStaticInterimResponseConfigDeserializer(\n interimResponse as models.VoiceAgentStaticInterimResponseConfig,\n )\n : models.voiceAgentLlmInterimResponseConfigDeserializer(\n interimResponse as models.VoiceAgentLlmInterimResponseConfig,\n );\n}\n"]}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { AbortSignalLike } from "@azure/abort-controller";
|
|
2
|
+
import type { TokenCredential } from "@azure/core-auth";
|
|
3
|
+
import type { OperationOptions } from "@azure-rest/core-client";
|
|
4
|
+
import type { VoiceAgentClientEvent, VoiceAgentResponseCreateParams, VoiceAgentSessionUpdateConfig } from "../models/models.js";
|
|
5
|
+
import type { VoiceAgentRealtimeEvent } from "./events.js";
|
|
6
|
+
import type { VoiceAgentWebSocketFactory } from "./webSocketTransportLike.js";
|
|
7
|
+
/** Known values of {@link VoiceAgentConnectionState} reported by a voice-agent realtime connection. */
|
|
8
|
+
export declare const KnownVoiceAgentConnectionState: {
|
|
9
|
+
readonly Disconnected: "disconnected";
|
|
10
|
+
readonly Connecting: "connecting";
|
|
11
|
+
readonly Connected: "connected";
|
|
12
|
+
readonly Closing: "closing";
|
|
13
|
+
};
|
|
14
|
+
/** Connection states reported by a voice-agent realtime connection. */
|
|
15
|
+
export type VoiceAgentConnectionState = (typeof KnownVoiceAgentConnectionState)[keyof typeof KnownVoiceAgentConnectionState];
|
|
16
|
+
/** Called when a voice-agent connection changes state. */
|
|
17
|
+
export type VoiceAgentConnectionStateChangedHandler = (state: VoiceAgentConnectionState, previousState: VoiceAgentConnectionState) => void;
|
|
18
|
+
/** Options for the Voice Agents realtime client. */
|
|
19
|
+
export interface VoiceAgentRealtimeClientOptions {
|
|
20
|
+
/** Microsoft Entra scopes used to acquire a WebSocket access token. */
|
|
21
|
+
credentialScopes?: string | string[];
|
|
22
|
+
/** Default connection timeout in milliseconds. */
|
|
23
|
+
connectionTimeoutInMs?: number;
|
|
24
|
+
/** API version sent during the WebSocket upgrade. */
|
|
25
|
+
apiVersion?: string;
|
|
26
|
+
/** Prefix added to the SDK user-agent value in Node.js. */
|
|
27
|
+
userAgentPrefix?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Overrides the transport used to establish the realtime WebSocket connection. Defaults to the
|
|
30
|
+
* platform transport (`ws` in Node.js, the browser's native `WebSocket` in browsers/React Native).
|
|
31
|
+
* Provide a custom factory to customize connection establishment.
|
|
32
|
+
*/
|
|
33
|
+
webSocketFactory?: VoiceAgentWebSocketFactory;
|
|
34
|
+
}
|
|
35
|
+
/** Options for connecting the realtime client to a voice agent. */
|
|
36
|
+
export interface VoiceAgentRealtimeClientConnectOptions extends OperationOptions {
|
|
37
|
+
/** Identifier used to correlate the voice session. */
|
|
38
|
+
agentSessionId?: string;
|
|
39
|
+
/** Overrides whether the conversation created by this session is persisted. */
|
|
40
|
+
store?: boolean;
|
|
41
|
+
/** Selects a specific immutable agent version. */
|
|
42
|
+
agentVersionOverride?: string;
|
|
43
|
+
/** Values used to render the agent's structured prompt inputs. */
|
|
44
|
+
structuredInputs?: Record<string, unknown>;
|
|
45
|
+
/** Overrides the client connection timeout in milliseconds. */
|
|
46
|
+
connectionTimeoutInMs?: number;
|
|
47
|
+
/** Cancels the connection attempt. */
|
|
48
|
+
abortSignal?: AbortSignalLike;
|
|
49
|
+
/** Receives connection-state transitions. */
|
|
50
|
+
onConnectionStateChange?: VoiceAgentConnectionStateChangedHandler;
|
|
51
|
+
}
|
|
52
|
+
/** Result supplied when a voice-agent connection closes. */
|
|
53
|
+
export interface VoiceAgentCloseResult {
|
|
54
|
+
/** WebSocket close code. */
|
|
55
|
+
code: number;
|
|
56
|
+
/** WebSocket close reason. */
|
|
57
|
+
reason: string;
|
|
58
|
+
/** Whether the peer completed a normal WebSocket close handshake. */
|
|
59
|
+
wasClean: boolean;
|
|
60
|
+
/** Transport or protocol error associated with the close, if any. */
|
|
61
|
+
error?: Error;
|
|
62
|
+
}
|
|
63
|
+
/** Options shared by realtime send operations. */
|
|
64
|
+
export interface VoiceAgentSendOptions extends OperationOptions {
|
|
65
|
+
}
|
|
66
|
+
/** Options shared by operations that build a protocol event on the caller's behalf. */
|
|
67
|
+
export interface VoiceAgentEventOptions extends VoiceAgentSendOptions {
|
|
68
|
+
/** Client-generated event identifier. */
|
|
69
|
+
eventId?: string;
|
|
70
|
+
}
|
|
71
|
+
/** Options shared by operations that add a conversation item and, by default, request a response. */
|
|
72
|
+
export interface VoiceAgentSendItemOptions extends VoiceAgentEventOptions {
|
|
73
|
+
/** Whether to request a response after adding the item. Defaults to true. */
|
|
74
|
+
createResponse?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** Options for sending text input. */
|
|
77
|
+
export interface VoiceAgentSendTextOptions extends VoiceAgentSendItemOptions {
|
|
78
|
+
/** Item after which the new text item is inserted. */
|
|
79
|
+
previousItemId?: string;
|
|
80
|
+
}
|
|
81
|
+
/** Options for returning a function result. */
|
|
82
|
+
export interface VoiceAgentSendToolOutputOptions extends VoiceAgentSendItemOptions {
|
|
83
|
+
}
|
|
84
|
+
/** Options for updating the live session. */
|
|
85
|
+
export interface VoiceAgentSessionUpdateOptions extends VoiceAgentEventOptions {
|
|
86
|
+
}
|
|
87
|
+
/** Options for creating a response. */
|
|
88
|
+
export interface VoiceAgentResponseOptions extends VoiceAgentEventOptions {
|
|
89
|
+
/** Response-specific configuration. */
|
|
90
|
+
response?: VoiceAgentResponseCreateParams;
|
|
91
|
+
}
|
|
92
|
+
/** Options for cancelling a response. */
|
|
93
|
+
export interface VoiceAgentCancelResponseOptions extends VoiceAgentEventOptions {
|
|
94
|
+
/** Specific response to cancel. The active default-conversation response is used when omitted. */
|
|
95
|
+
responseId?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A connected, bidirectional voice-agent stream.
|
|
99
|
+
*
|
|
100
|
+
* Supports exactly one `for await` iteration over server events; a second attempt throws.
|
|
101
|
+
* Exiting the loop early (`break`, `return`, or an uncaught error in the loop body) closes
|
|
102
|
+
* the connection as a side effect.
|
|
103
|
+
* Unrecognized server event types are delivered as {@link VoiceAgentUnknownEvent} without
|
|
104
|
+
* interrupting the stream. Malformed events still fail the iteration with a protocol error.
|
|
105
|
+
*/
|
|
106
|
+
export interface VoiceAgentConnection extends AsyncIterable<VoiceAgentRealtimeEvent> {
|
|
107
|
+
/** Current connection state. */
|
|
108
|
+
readonly state: VoiceAgentConnectionState;
|
|
109
|
+
/** Resolves once the connection is closed. */
|
|
110
|
+
readonly closed: Promise<VoiceAgentCloseResult>;
|
|
111
|
+
/** Sends any generated client protocol event. */
|
|
112
|
+
sendEvent(event: VoiceAgentClientEvent, options?: VoiceAgentSendOptions): Promise<void>;
|
|
113
|
+
/** Updates supported live-session settings. */
|
|
114
|
+
configureSession(session: VoiceAgentSessionUpdateConfig, options?: VoiceAgentSessionUpdateOptions): Promise<void>;
|
|
115
|
+
/** Adds a user text item and, by default, requests a response. */
|
|
116
|
+
sendText(text: string, options?: VoiceAgentSendTextOptions): Promise<void>;
|
|
117
|
+
/** Appends base64-encoded audio bytes to the input buffer. */
|
|
118
|
+
sendAudio(audio: Uint8Array | ArrayBuffer, options?: VoiceAgentEventOptions): Promise<void>;
|
|
119
|
+
/** Commits buffered input audio. */
|
|
120
|
+
commitAudio(options?: VoiceAgentEventOptions): Promise<void>;
|
|
121
|
+
/** Clears buffered input audio. */
|
|
122
|
+
clearInputAudio(options?: VoiceAgentEventOptions): Promise<void>;
|
|
123
|
+
/** Clears pending output audio at the service. */
|
|
124
|
+
clearOutputAudio(options?: VoiceAgentEventOptions): Promise<void>;
|
|
125
|
+
/** Returns a client-executed function result to the agent. */
|
|
126
|
+
sendToolOutput(callId: string, output: string, options?: VoiceAgentSendToolOutputOptions): Promise<void>;
|
|
127
|
+
/** Requests a new response. */
|
|
128
|
+
requestResponse(options?: VoiceAgentResponseOptions): Promise<void>;
|
|
129
|
+
/** Cancels an in-progress response. */
|
|
130
|
+
cancelResponse(options?: VoiceAgentCancelResponseOptions): Promise<void>;
|
|
131
|
+
/** Gracefully closes the WebSocket connection. */
|
|
132
|
+
close(code?: number, reason?: string): Promise<void>;
|
|
133
|
+
/** Releases the connection. Equivalent to close(). */
|
|
134
|
+
dispose(): Promise<void>;
|
|
135
|
+
}
|
|
136
|
+
/** Client for establishing realtime sessions with managed Foundry voice agents. */
|
|
137
|
+
export declare class VoiceAgentRealtimeClient {
|
|
138
|
+
private readonly endpoint;
|
|
139
|
+
private readonly credential;
|
|
140
|
+
private readonly options;
|
|
141
|
+
constructor(endpoint: string, credential: TokenCredential, options?: VoiceAgentRealtimeClientOptions);
|
|
142
|
+
/** Establishes a WebSocket connection to a managed voice agent. */
|
|
143
|
+
connect(agentName: string, options?: VoiceAgentRealtimeClientConnectOptions): Promise<VoiceAgentConnection>;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=voiceAgentRealtimeClient.d.ts.map
|
|
@@ -0,0 +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,KAAK,EAEV,qBAAqB,EACrB,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,qBAAqB,CAAC;AAS7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EACV,0BAA0B,EAE3B,MAAM,6BAA6B,CAAC;AAKrC,uGAAuG;AACvG,eAAO,MAAM,8BAA8B;;;;;CAKjC,CAAC;AAEX,uEAAuE;AACvE,MAAM,MAAM,yBAAyB,GACnC,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,OAAO,8BAA8B,CAAC,CAAC;AAEvF,0DAA0D;AAC1D,MAAM,MAAM,uCAAuC,GAAG,CACpD,KAAK,EAAE,yBAAyB,EAChC,aAAa,EAAE,yBAAyB,KACrC,IAAI,CAAC;AAEV,oDAAoD;AACpD,MAAM,WAAW,+BAA+B;IAC9C,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACrC,kDAAkD;IAClD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qDAAqD;IACrD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EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,kDAAkD;IAClD,gBAAgB,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,8DAA8D;IAC9D,cAAc,CACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,+BAA+B,GACxC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,+BAA+B;IAC/B,eAAe,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,uCAAuC;IACvC,cAAc,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,kDAAkD;IAClD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,sDAAsD;IACtD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,mFAAmF;AACnF,qBAAa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;IAC7C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAGU;gBAGhC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,eAAe,EAC3B,OAAO,GAAE,+BAAoC;IAiB/C,mEAAmE;IACtD,OAAO,CAClB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,sCAA2C,GACnD,OAAO,CAAC,oBAAoB,CAAC;CAkBjC"}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { uint8ArrayToString } from "@azure/core-util";
|
|
4
|
+
import { SDK_VERSION } from "../constants.js";
|
|
5
|
+
import { logger } from "../logger.js";
|
|
6
|
+
import { AsyncQueue } from "./asyncQueue.js";
|
|
7
|
+
import { VoiceAgentAuthenticationError, VoiceAgentConnectionError, VoiceAgentProtocolError, } from "./errors.js";
|
|
8
|
+
import { deserializeVoiceAgentServerEvent, serializeVoiceAgentClientEvent } from "./protocol.js";
|
|
9
|
+
const defaultCredentialScope = "https://ai.azure.com/.default";
|
|
10
|
+
const voiceAgentsPreview = "VoiceAgents=V1Preview";
|
|
11
|
+
/** Known values of {@link VoiceAgentConnectionState} reported by a voice-agent realtime connection. */
|
|
12
|
+
export const KnownVoiceAgentConnectionState = {
|
|
13
|
+
Disconnected: "disconnected",
|
|
14
|
+
Connecting: "connecting",
|
|
15
|
+
Connected: "connected",
|
|
16
|
+
Closing: "closing",
|
|
17
|
+
};
|
|
18
|
+
/** Client for establishing realtime sessions with managed Foundry voice agents. */
|
|
19
|
+
export class VoiceAgentRealtimeClient {
|
|
20
|
+
endpoint;
|
|
21
|
+
credential;
|
|
22
|
+
options;
|
|
23
|
+
constructor(endpoint, credential, options = {}) {
|
|
24
|
+
// Endpoint validation (https-only) is deferred to connect() so that merely constructing an
|
|
25
|
+
// AIProjectClient (which eagerly creates this client) doesn't reject callers who intentionally
|
|
26
|
+
// use an insecure local endpoint for the REST surface and never touch realtime connections.
|
|
27
|
+
if (!endpoint.trim()) {
|
|
28
|
+
throw new TypeError("endpoint must not be empty.");
|
|
29
|
+
}
|
|
30
|
+
this.endpoint = endpoint;
|
|
31
|
+
this.credential = credential;
|
|
32
|
+
this.options = {
|
|
33
|
+
...options,
|
|
34
|
+
connectionTimeoutInMs: options.connectionTimeoutInMs ?? 30_000,
|
|
35
|
+
apiVersion: options.apiVersion ?? "v1",
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Establishes a WebSocket connection to a managed voice agent. */
|
|
39
|
+
async connect(agentName, options = {}) {
|
|
40
|
+
if (!agentName.trim()) {
|
|
41
|
+
throw new TypeError("agentName must not be empty.");
|
|
42
|
+
}
|
|
43
|
+
const factory = this.options.webSocketFactory ??
|
|
44
|
+
(await import("../webSocketTransport.js")).createDefaultVoiceAgentWebSocketFactory();
|
|
45
|
+
const connection = new VoiceAgentConnectionImpl(normalizeEndpoint(this.endpoint), agentName, this.credential, this.options, options, factory);
|
|
46
|
+
await connection.open();
|
|
47
|
+
return connection;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class VoiceAgentConnectionImpl {
|
|
51
|
+
endpoint;
|
|
52
|
+
agentName;
|
|
53
|
+
credential;
|
|
54
|
+
clientOptions;
|
|
55
|
+
connectOptions;
|
|
56
|
+
events;
|
|
57
|
+
transport;
|
|
58
|
+
closePromise;
|
|
59
|
+
resolveClose;
|
|
60
|
+
currentState = KnownVoiceAgentConnectionState.Disconnected;
|
|
61
|
+
iteratorStarted = false;
|
|
62
|
+
finished = false;
|
|
63
|
+
constructor(endpoint, agentName, credential, clientOptions, connectOptions, factory) {
|
|
64
|
+
this.endpoint = endpoint;
|
|
65
|
+
this.agentName = agentName;
|
|
66
|
+
this.credential = credential;
|
|
67
|
+
this.clientOptions = clientOptions;
|
|
68
|
+
this.connectOptions = connectOptions;
|
|
69
|
+
this.events = new AsyncQueue(10_000, {
|
|
70
|
+
onOverflow: (error) => this.handleEventQueueOverflow(error),
|
|
71
|
+
});
|
|
72
|
+
this.transport = factory.create();
|
|
73
|
+
this.closePromise = new Promise((resolve) => {
|
|
74
|
+
this.resolveClose = resolve;
|
|
75
|
+
});
|
|
76
|
+
this.transport.setHandlers({
|
|
77
|
+
onMessage: (data) => this.handleMessage(data),
|
|
78
|
+
onClose: (code, reason, wasClean) => this.handleClose(code, reason, wasClean),
|
|
79
|
+
onError: (error) => this.handleTransportError(error),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
get state() {
|
|
83
|
+
return this.currentState;
|
|
84
|
+
}
|
|
85
|
+
get closed() {
|
|
86
|
+
return this.closePromise;
|
|
87
|
+
}
|
|
88
|
+
async open() {
|
|
89
|
+
this.setState(KnownVoiceAgentConnectionState.Connecting);
|
|
90
|
+
let token;
|
|
91
|
+
try {
|
|
92
|
+
const accessToken = await this.credential.getToken(this.clientOptions.credentialScopes ?? defaultCredentialScope, { abortSignal: this.connectOptions.abortSignal });
|
|
93
|
+
if (!accessToken) {
|
|
94
|
+
throw new VoiceAgentAuthenticationError("The credential returned no access token.");
|
|
95
|
+
}
|
|
96
|
+
token = accessToken.token;
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (this.connectOptions.abortSignal?.aborted) {
|
|
100
|
+
const cancelledError = new VoiceAgentConnectionError("Voice-agent connection was cancelled.", "operationCancelled", { cause: error });
|
|
101
|
+
this.finish(1006, cancelledError.message, false, cancelledError);
|
|
102
|
+
throw cancelledError;
|
|
103
|
+
}
|
|
104
|
+
const authenticationError = error instanceof VoiceAgentAuthenticationError
|
|
105
|
+
? error
|
|
106
|
+
: new VoiceAgentAuthenticationError("Failed to acquire a Voice Agents access token.", {
|
|
107
|
+
cause: error,
|
|
108
|
+
});
|
|
109
|
+
this.finish(1006, authenticationError.message, false, authenticationError);
|
|
110
|
+
throw authenticationError;
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
await this.transport.connect({
|
|
114
|
+
url: buildWebSocketUrl(this.endpoint, this.agentName, this.clientOptions.apiVersion, this.connectOptions),
|
|
115
|
+
protocols: ["realtime"],
|
|
116
|
+
headers: buildHeaders(token, this.clientOptions, this.connectOptions),
|
|
117
|
+
connectionTimeoutInMs: this.connectOptions.connectionTimeoutInMs ?? this.clientOptions.connectionTimeoutInMs,
|
|
118
|
+
abortSignal: this.connectOptions.abortSignal,
|
|
119
|
+
});
|
|
120
|
+
this.setState(KnownVoiceAgentConnectionState.Connected);
|
|
121
|
+
logger.info("Connected to voice agent", { agentName: this.agentName });
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
const cancelled = this.connectOptions.abortSignal?.aborted === true;
|
|
125
|
+
const connectionError = new VoiceAgentConnectionError(cancelled
|
|
126
|
+
? "Voice-agent connection was cancelled."
|
|
127
|
+
: "Failed to connect to the voice agent.", cancelled ? "operationCancelled" : "connectionFailed", { cause: error });
|
|
128
|
+
this.finish(1006, connectionError.message, false, connectionError);
|
|
129
|
+
throw connectionError;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async sendEvent(event, options = {}) {
|
|
133
|
+
if (this.state !== KnownVoiceAgentConnectionState.Connected) {
|
|
134
|
+
throw new VoiceAgentConnectionError(`Cannot send while the connection is ${this.state}.`, "invalidState");
|
|
135
|
+
}
|
|
136
|
+
if (options.abortSignal?.aborted) {
|
|
137
|
+
throw new VoiceAgentConnectionError("Send operation was cancelled.", "operationCancelled");
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
await this.transport.send(serializeVoiceAgentClientEvent(event), options.abortSignal);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
if (error instanceof VoiceAgentProtocolError) {
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
throw new VoiceAgentConnectionError("Failed to send a voice-agent event.", "sendFailed", {
|
|
147
|
+
cause: error,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
configureSession(session, options = {}) {
|
|
152
|
+
return this.sendEvent({ type: "session.update", event_id: options.eventId, session }, options);
|
|
153
|
+
}
|
|
154
|
+
async sendText(text, options = {}) {
|
|
155
|
+
await this.sendEvent({
|
|
156
|
+
type: "conversation.item.create",
|
|
157
|
+
event_id: options.eventId,
|
|
158
|
+
previous_item_id: options.previousItemId,
|
|
159
|
+
// `RealtimeConversationItemUnion` no longer enumerates a "message" item in the generated
|
|
160
|
+
// models, but the wire protocol still accepts this shape; see the TypeSpec regeneration
|
|
161
|
+
// report for details.
|
|
162
|
+
item: {
|
|
163
|
+
type: "message",
|
|
164
|
+
role: "user",
|
|
165
|
+
content: [{ type: "input_text", text }],
|
|
166
|
+
},
|
|
167
|
+
}, options);
|
|
168
|
+
if (options.createResponse !== false) {
|
|
169
|
+
await this.requestResponse({ abortSignal: options.abortSignal });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
sendAudio(audio, options = {}) {
|
|
173
|
+
const bytes = audio instanceof Uint8Array ? audio : new Uint8Array(audio);
|
|
174
|
+
return this.sendEvent({
|
|
175
|
+
type: "input_audio_buffer.append",
|
|
176
|
+
event_id: options.eventId,
|
|
177
|
+
audio: uint8ArrayToString(bytes, "base64"),
|
|
178
|
+
}, options);
|
|
179
|
+
}
|
|
180
|
+
commitAudio(options = {}) {
|
|
181
|
+
return this.sendEvent({ type: "input_audio_buffer.commit", event_id: options.eventId }, options);
|
|
182
|
+
}
|
|
183
|
+
clearInputAudio(options = {}) {
|
|
184
|
+
return this.sendEvent({ type: "input_audio_buffer.clear", event_id: options.eventId }, options);
|
|
185
|
+
}
|
|
186
|
+
clearOutputAudio(options = {}) {
|
|
187
|
+
return this.sendEvent({ type: "output_audio_buffer.clear", event_id: options.eventId }, options);
|
|
188
|
+
}
|
|
189
|
+
async sendToolOutput(callId, output, options = {}) {
|
|
190
|
+
await this.sendEvent({
|
|
191
|
+
type: "conversation.item.create",
|
|
192
|
+
event_id: options.eventId,
|
|
193
|
+
item: { type: "function_call_output", call_id: callId, output },
|
|
194
|
+
}, options);
|
|
195
|
+
if (options.createResponse !== false) {
|
|
196
|
+
await this.requestResponse({ abortSignal: options.abortSignal });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
requestResponse(options = {}) {
|
|
200
|
+
return this.sendEvent({ type: "response.create", event_id: options.eventId, response: options.response }, options);
|
|
201
|
+
}
|
|
202
|
+
cancelResponse(options = {}) {
|
|
203
|
+
return this.sendEvent({ type: "response.cancel", event_id: options.eventId, response_id: options.responseId }, options);
|
|
204
|
+
}
|
|
205
|
+
async close(code = 1000, reason = "Client closed the voice-agent connection.") {
|
|
206
|
+
if (this.state === KnownVoiceAgentConnectionState.Disconnected ||
|
|
207
|
+
this.state === KnownVoiceAgentConnectionState.Closing) {
|
|
208
|
+
await this.closed;
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
this.setState(KnownVoiceAgentConnectionState.Closing);
|
|
212
|
+
try {
|
|
213
|
+
await this.transport.close(code, reason);
|
|
214
|
+
}
|
|
215
|
+
finally {
|
|
216
|
+
this.finish(code, reason, false);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
dispose() {
|
|
220
|
+
return this.close();
|
|
221
|
+
}
|
|
222
|
+
async *[Symbol.asyncIterator]() {
|
|
223
|
+
if (this.iteratorStarted) {
|
|
224
|
+
throw new VoiceAgentConnectionError("A voice-agent connection supports one active event iterator.", "invalidState");
|
|
225
|
+
}
|
|
226
|
+
this.iteratorStarted = true;
|
|
227
|
+
try {
|
|
228
|
+
while (true) {
|
|
229
|
+
const result = await this.events.next();
|
|
230
|
+
if (result.done) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
yield result.value;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
finally {
|
|
237
|
+
if (this.state === KnownVoiceAgentConnectionState.Connected) {
|
|
238
|
+
await this.close();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
handleMessage(data) {
|
|
243
|
+
try {
|
|
244
|
+
this.events.enqueue(deserializeVoiceAgentServerEvent(data));
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
const protocolError = error instanceof VoiceAgentProtocolError
|
|
248
|
+
? error
|
|
249
|
+
: new VoiceAgentProtocolError("Failed to process a voice-agent event.", { cause: error });
|
|
250
|
+
// finish() closes the transport itself, so no additional close is needed here.
|
|
251
|
+
this.finish(1002, protocolError.message, false, protocolError);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
handleEventQueueOverflow(cause) {
|
|
255
|
+
if (this.finished) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const error = new VoiceAgentConnectionError(cause.message, "connectionClosed", {
|
|
259
|
+
cause,
|
|
260
|
+
});
|
|
261
|
+
this.finish(1006, error.message, false, error);
|
|
262
|
+
}
|
|
263
|
+
handleClose(code, reason, wasClean) {
|
|
264
|
+
if (this.finished) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (wasClean || this.state === KnownVoiceAgentConnectionState.Closing) {
|
|
268
|
+
this.finish(code, reason, wasClean);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
const error = new VoiceAgentConnectionError(`Voice-agent connection closed unexpectedly (${code}${reason ? `: ${reason}` : ""}).`, "connectionClosed", { closeCode: code });
|
|
272
|
+
this.finish(code, reason, false, error);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
handleTransportError(cause) {
|
|
276
|
+
if (this.finished) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const error = new VoiceAgentConnectionError("Voice-agent WebSocket transport failed.", "connectionClosed", {
|
|
280
|
+
cause,
|
|
281
|
+
});
|
|
282
|
+
this.finish(1006, cause.message, false, error);
|
|
283
|
+
}
|
|
284
|
+
finish(code, reason, wasClean, error) {
|
|
285
|
+
if (this.finished) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
this.finished = true;
|
|
289
|
+
if (error) {
|
|
290
|
+
this.events.fail(error);
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
this.events.close();
|
|
294
|
+
}
|
|
295
|
+
this.setState(KnownVoiceAgentConnectionState.Disconnected);
|
|
296
|
+
this.resolveClose({ code, reason, wasClean, error });
|
|
297
|
+
logger.info("Voice-agent connection closed", { code, reason, wasClean });
|
|
298
|
+
// Ensure the socket never outlives the connection, even on paths that never closed it
|
|
299
|
+
// themselves. Not awaited: finish() is synchronous because its callers are.
|
|
300
|
+
void this.closeTransportQuietly(code, reason);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Closes the transport, logging rather than rejecting: this is best-effort cleanup running after
|
|
304
|
+
* the connection has already settled. A no-op if the transport is already closed.
|
|
305
|
+
*/
|
|
306
|
+
async closeTransportQuietly(code, reason) {
|
|
307
|
+
try {
|
|
308
|
+
await this.transport.close(code, reason);
|
|
309
|
+
}
|
|
310
|
+
catch (error) {
|
|
311
|
+
logger.warning("Failed to close the voice-agent transport", { error });
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
setState(state) {
|
|
315
|
+
if (state === this.currentState) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const previousState = this.currentState;
|
|
319
|
+
this.currentState = state;
|
|
320
|
+
try {
|
|
321
|
+
this.connectOptions.onConnectionStateChange?.(state, previousState);
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
// A throwing caller callback must never interrupt connection lifecycle/cleanup.
|
|
325
|
+
logger.warning("onConnectionStateChange callback threw an error", { error });
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function normalizeEndpoint(endpoint) {
|
|
330
|
+
const normalized = endpoint.trim();
|
|
331
|
+
if (!normalized) {
|
|
332
|
+
throw new TypeError("endpoint must not be empty.");
|
|
333
|
+
}
|
|
334
|
+
const url = new URL(normalized.includes("://") ? normalized : `https://${normalized}`);
|
|
335
|
+
if (url.protocol !== "https:") {
|
|
336
|
+
throw new TypeError("endpoint must use https; a plaintext endpoint would send the bearer token over an unencrypted connection.");
|
|
337
|
+
}
|
|
338
|
+
return url.toString().replace(/\/$/, "");
|
|
339
|
+
}
|
|
340
|
+
function buildWebSocketUrl(endpoint, agentName, apiVersion, options) {
|
|
341
|
+
const url = new URL(endpoint);
|
|
342
|
+
url.protocol = "wss:";
|
|
343
|
+
url.pathname = `${url.pathname.replace(/\/$/, "")}/agents/${encodeURIComponent(agentName)}/endpoint/protocols/voice`;
|
|
344
|
+
url.searchParams.set("api-version", apiVersion);
|
|
345
|
+
url.searchParams.set("x-ms-client-sdk", `azsdk-js-ai-projects/${SDK_VERSION}`);
|
|
346
|
+
if (options.agentSessionId) {
|
|
347
|
+
url.searchParams.set("agent_session_id", options.agentSessionId);
|
|
348
|
+
}
|
|
349
|
+
if (options.store !== undefined) {
|
|
350
|
+
url.searchParams.set("store", String(options.store));
|
|
351
|
+
}
|
|
352
|
+
if (options.agentVersionOverride) {
|
|
353
|
+
url.searchParams.set("x-agent-version-override", options.agentVersionOverride);
|
|
354
|
+
}
|
|
355
|
+
return url.toString();
|
|
356
|
+
}
|
|
357
|
+
function buildHeaders(token, clientOptions, connectOptions) {
|
|
358
|
+
const sdkUserAgent = `azsdk-js-ai-projects/${SDK_VERSION}`;
|
|
359
|
+
const headers = {
|
|
360
|
+
authorization: `Bearer ${token}`,
|
|
361
|
+
"foundry-features": voiceAgentsPreview,
|
|
362
|
+
"x-ms-client-request-id": createRequestId(),
|
|
363
|
+
"x-ms-client-sdk": sdkUserAgent,
|
|
364
|
+
"user-agent": clientOptions.userAgentPrefix
|
|
365
|
+
? `${clientOptions.userAgentPrefix} ${sdkUserAgent}`
|
|
366
|
+
: sdkUserAgent,
|
|
367
|
+
};
|
|
368
|
+
if (connectOptions.structuredInputs) {
|
|
369
|
+
headers["x-ms-voice-structured-inputs"] = JSON.stringify(connectOptions.structuredInputs);
|
|
370
|
+
}
|
|
371
|
+
return headers;
|
|
372
|
+
}
|
|
373
|
+
function createRequestId() {
|
|
374
|
+
return (globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
375
|
+
}
|
|
376
|
+
//# sourceMappingURL=voiceAgentRealtimeClient.js.map
|