@memberjunction/ng-conversations 5.40.1 → 5.41.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 +57 -0
- package/dist/__tests__/channel-optional-surface.test.d.ts +2 -0
- package/dist/__tests__/channel-optional-surface.test.d.ts.map +1 -0
- package/dist/__tests__/channel-optional-surface.test.js +53 -0
- package/dist/__tests__/channel-optional-surface.test.js.map +1 -0
- package/dist/__tests__/chat-events.test.d.ts +14 -0
- package/dist/__tests__/chat-events.test.d.ts.map +1 -0
- package/dist/__tests__/chat-events.test.js +109 -0
- package/dist/__tests__/chat-events.test.js.map +1 -0
- package/dist/__tests__/conversation-naming.test.d.ts +2 -0
- package/dist/__tests__/conversation-naming.test.d.ts.map +1 -0
- package/dist/__tests__/conversation-naming.test.js +110 -0
- package/dist/__tests__/conversation-naming.test.js.map +1 -0
- package/dist/__tests__/delegation-result-parser.test.d.ts +2 -0
- package/dist/__tests__/delegation-result-parser.test.d.ts.map +1 -0
- package/dist/__tests__/delegation-result-parser.test.js +107 -0
- package/dist/__tests__/delegation-result-parser.test.js.map +1 -0
- package/dist/__tests__/event-wiring.test.d.ts +15 -0
- package/dist/__tests__/event-wiring.test.d.ts.map +1 -0
- package/dist/__tests__/event-wiring.test.js +100 -0
- package/dist/__tests__/event-wiring.test.js.map +1 -0
- package/dist/__tests__/narration-template.test.d.ts +2 -0
- package/dist/__tests__/narration-template.test.d.ts.map +1 -0
- package/dist/__tests__/narration-template.test.js +76 -0
- package/dist/__tests__/narration-template.test.js.map +1 -0
- package/dist/__tests__/realtime-agent-picker-models.test.d.ts +2 -0
- package/dist/__tests__/realtime-agent-picker-models.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-agent-picker-models.test.js +49 -0
- package/dist/__tests__/realtime-agent-picker-models.test.js.map +1 -0
- package/dist/__tests__/realtime-audio-visuals.test.d.ts +2 -0
- package/dist/__tests__/realtime-audio-visuals.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-audio-visuals.test.js +123 -0
- package/dist/__tests__/realtime-audio-visuals.test.js.map +1 -0
- package/dist/__tests__/realtime-delegation-card-cancel.test.d.ts +2 -0
- package/dist/__tests__/realtime-delegation-card-cancel.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-delegation-card-cancel.test.js +48 -0
- package/dist/__tests__/realtime-delegation-card-cancel.test.js.map +1 -0
- package/dist/__tests__/realtime-disclosure.test.d.ts +2 -0
- package/dist/__tests__/realtime-disclosure.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-disclosure.test.js +164 -0
- package/dist/__tests__/realtime-disclosure.test.js.map +1 -0
- package/dist/__tests__/realtime-pairing.test.d.ts +2 -0
- package/dist/__tests__/realtime-pairing.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-pairing.test.js +207 -0
- package/dist/__tests__/realtime-pairing.test.js.map +1 -0
- package/dist/__tests__/realtime-review-lifecycle.test.d.ts +2 -0
- package/dist/__tests__/realtime-review-lifecycle.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-review-lifecycle.test.js +154 -0
- package/dist/__tests__/realtime-review-lifecycle.test.js.map +1 -0
- package/dist/__tests__/realtime-session-cancel-usage.test.d.ts +2 -0
- package/dist/__tests__/realtime-session-cancel-usage.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-session-cancel-usage.test.js +230 -0
- package/dist/__tests__/realtime-session-cancel-usage.test.js.map +1 -0
- package/dist/__tests__/realtime-session-channels.test.d.ts +2 -0
- package/dist/__tests__/realtime-session-channels.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-session-channels.test.js +252 -0
- package/dist/__tests__/realtime-session-channels.test.js.map +1 -0
- package/dist/__tests__/realtime-session-client-tools.test.d.ts +2 -0
- package/dist/__tests__/realtime-session-client-tools.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-session-client-tools.test.js +103 -0
- package/dist/__tests__/realtime-session-client-tools.test.js.map +1 -0
- package/dist/__tests__/realtime-session-minimized.test.d.ts +2 -0
- package/dist/__tests__/realtime-session-minimized.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-session-minimized.test.js +32 -0
- package/dist/__tests__/realtime-session-minimized.test.js.map +1 -0
- package/dist/__tests__/realtime-session-mint.test.d.ts +2 -0
- package/dist/__tests__/realtime-session-mint.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-session-mint.test.js +69 -0
- package/dist/__tests__/realtime-session-mint.test.js.map +1 -0
- package/dist/__tests__/realtime-session-policy.test.d.ts +2 -0
- package/dist/__tests__/realtime-session-policy.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-session-policy.test.js +303 -0
- package/dist/__tests__/realtime-session-policy.test.js.map +1 -0
- package/dist/__tests__/realtime-session-review.service.test.d.ts +2 -0
- package/dist/__tests__/realtime-session-review.service.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-session-review.service.test.js +743 -0
- package/dist/__tests__/realtime-session-review.service.test.js.map +1 -0
- package/dist/__tests__/realtime-session-state.test.d.ts +2 -0
- package/dist/__tests__/realtime-session-state.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-session-state.test.js +83 -0
- package/dist/__tests__/realtime-session-state.test.js.map +1 -0
- package/dist/__tests__/realtime-session-timeline-card.test.d.ts +2 -0
- package/dist/__tests__/realtime-session-timeline-card.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-session-timeline-card.test.js +106 -0
- package/dist/__tests__/realtime-session-timeline-card.test.js.map +1 -0
- package/dist/__tests__/realtime-session-timeline.test.d.ts +2 -0
- package/dist/__tests__/realtime-session-timeline.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-session-timeline.test.js +142 -0
- package/dist/__tests__/realtime-session-timeline.test.js.map +1 -0
- package/dist/__tests__/realtime-sessions-adapter.test.d.ts +19 -0
- package/dist/__tests__/realtime-sessions-adapter.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-sessions-adapter.test.js +188 -0
- package/dist/__tests__/realtime-sessions-adapter.test.js.map +1 -0
- package/dist/__tests__/realtime-surface-panel-prefs.test.d.ts +2 -0
- package/dist/__tests__/realtime-surface-panel-prefs.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-surface-panel-prefs.test.js +100 -0
- package/dist/__tests__/realtime-surface-panel-prefs.test.js.map +1 -0
- package/dist/__tests__/realtime-surface-tabs-model.test.d.ts +2 -0
- package/dist/__tests__/realtime-surface-tabs-model.test.d.ts.map +1 -0
- package/dist/__tests__/realtime-surface-tabs-model.test.js +193 -0
- package/dist/__tests__/realtime-surface-tabs-model.test.js.map +1 -0
- package/dist/__tests__/remote-browser-audio-player.test.d.ts +2 -0
- package/dist/__tests__/remote-browser-audio-player.test.d.ts.map +1 -0
- package/dist/__tests__/remote-browser-audio-player.test.js +137 -0
- package/dist/__tests__/remote-browser-audio-player.test.js.map +1 -0
- package/dist/__tests__/remote-browser-channel.test.d.ts +2 -0
- package/dist/__tests__/remote-browser-channel.test.d.ts.map +1 -0
- package/dist/__tests__/remote-browser-channel.test.js +423 -0
- package/dist/__tests__/remote-browser-channel.test.js.map +1 -0
- package/dist/__tests__/slot-defaults.test.d.ts +24 -0
- package/dist/__tests__/slot-defaults.test.d.ts.map +1 -0
- package/dist/__tests__/slot-defaults.test.js +63 -0
- package/dist/__tests__/slot-defaults.test.js.map +1 -0
- package/dist/__tests__/user-authorization.test.d.ts +2 -0
- package/dist/__tests__/user-authorization.test.d.ts.map +1 -0
- package/dist/__tests__/user-authorization.test.js +97 -0
- package/dist/__tests__/user-authorization.test.js.map +1 -0
- package/dist/__tests__/voice-session-narration.test.d.ts +2 -0
- package/dist/__tests__/voice-session-narration.test.d.ts.map +1 -0
- package/dist/__tests__/voice-session-narration.test.js +609 -0
- package/dist/__tests__/voice-session-narration.test.js.map +1 -0
- package/dist/__tests__/whiteboard-artifact-viewer.test.d.ts +2 -0
- package/dist/__tests__/whiteboard-artifact-viewer.test.d.ts.map +1 -0
- package/dist/__tests__/whiteboard-artifact-viewer.test.js +101 -0
- package/dist/__tests__/whiteboard-artifact-viewer.test.js.map +1 -0
- package/dist/__tests__/whiteboard-channel.test.d.ts +2 -0
- package/dist/__tests__/whiteboard-channel.test.d.ts.map +1 -0
- package/dist/__tests__/whiteboard-channel.test.js +260 -0
- package/dist/__tests__/whiteboard-channel.test.js.map +1 -0
- package/dist/__tests__/whiteboard-restore-state.test.d.ts +2 -0
- package/dist/__tests__/whiteboard-restore-state.test.d.ts.map +1 -0
- package/dist/__tests__/whiteboard-restore-state.test.js +108 -0
- package/dist/__tests__/whiteboard-restore-state.test.js.map +1 -0
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +205 -3
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +911 -342
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/mention/mention-dropdown.component.js +35 -17
- package/dist/lib/components/mention/mention-dropdown.component.js.map +1 -1
- package/dist/lib/components/mention/mention-editor.component.d.ts +4 -0
- package/dist/lib/components/mention/mention-editor.component.d.ts.map +1 -1
- package/dist/lib/components/mention/mention-editor.component.js +43 -19
- package/dist/lib/components/mention/mention-editor.component.js.map +1 -1
- package/dist/lib/components/message/message-input-box.component.d.ts +17 -1
- package/dist/lib/components/message/message-input-box.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input-box.component.js +73 -15
- package/dist/lib/components/message/message-input-box.component.js.map +1 -1
- package/dist/lib/components/message/message-input.component.d.ts +142 -6
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input.component.js +328 -82
- package/dist/lib/components/message/message-input.component.js.map +1 -1
- package/dist/lib/components/message/message-item.component.d.ts +28 -3
- package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-item.component.js +180 -108
- package/dist/lib/components/message/message-item.component.js.map +1 -1
- package/dist/lib/components/message/message-list.component.d.ts +81 -2
- package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-list.component.js +252 -87
- package/dist/lib/components/message/message-list.component.js.map +1 -1
- package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts +282 -0
- package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts.map +1 -0
- package/dist/lib/components/realtime/channels/base-realtime-channel-client.js +158 -0
- package/dist/lib/components/realtime/channels/base-realtime-channel-client.js.map +1 -0
- package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.d.ts +25 -0
- package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.js +140 -0
- package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.js.map +1 -0
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts +35 -0
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js +58 -0
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts +63 -0
- package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-activity-rail.component.js +260 -0
- package/dist/lib/components/realtime/realtime-activity-rail.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts +117 -0
- package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-agent-banner.component.js +504 -0
- package/dist/lib/components/realtime/realtime-agent-banner.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts +168 -0
- package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-agent-picker.component.js +556 -0
- package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-audio-visuals.d.ts +97 -0
- package/dist/lib/components/realtime/realtime-audio-visuals.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-audio-visuals.js +139 -0
- package/dist/lib/components/realtime/realtime-audio-visuals.js.map +1 -0
- package/dist/lib/components/realtime/realtime-channel-strip.component.d.ts +29 -0
- package/dist/lib/components/realtime/realtime-channel-strip.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-channel-strip.component.js +69 -0
- package/dist/lib/components/realtime/realtime-channel-strip.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-composer.component.d.ts +65 -0
- package/dist/lib/components/realtime/realtime-composer.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-composer.component.js +256 -0
- package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts +71 -0
- package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-delegation-card.component.js +324 -0
- package/dist/lib/components/realtime/realtime-delegation-card.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-disclosure.d.ts +135 -0
- package/dist/lib/components/realtime/realtime-disclosure.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-disclosure.js +188 -0
- package/dist/lib/components/realtime/realtime-disclosure.js.map +1 -0
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +491 -0
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-session-overlay.component.js +1274 -0
- package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-session-state.d.ts +191 -0
- package/dist/lib/components/realtime/realtime-session-state.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-session-state.js +244 -0
- package/dist/lib/components/realtime/realtime-session-state.js.map +1 -0
- package/dist/lib/components/realtime/realtime-session-thread.component.d.ts +56 -0
- package/dist/lib/components/realtime/realtime-session-thread.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-session-thread.component.js +246 -0
- package/dist/lib/components/realtime/realtime-session-thread.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts +51 -0
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.js +193 -0
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-surface-panel-prefs.d.ts +77 -0
- package/dist/lib/components/realtime/realtime-surface-panel-prefs.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-surface-panel-prefs.js +114 -0
- package/dist/lib/components/realtime/realtime-surface-panel-prefs.js.map +1 -0
- package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts +173 -0
- package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-surface-tabs.component.js +496 -0
- package/dist/lib/components/realtime/realtime-surface-tabs.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +181 -0
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js +223 -0
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.d.ts +163 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.d.ts.map +1 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.js +309 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-audio-player.js.map +1 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +168 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +524 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts +346 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js +851 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js.map +1 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-tools.d.ts +86 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-tools.d.ts.map +1 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js +210 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js.map +1 -0
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts +48 -0
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js +180 -0
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js.map +1 -0
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts +119 -0
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -0
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +274 -0
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -0
- package/dist/lib/components/slots/mj-chat-agent-presence-default.component.d.ts +11 -0
- package/dist/lib/components/slots/mj-chat-agent-presence-default.component.d.ts.map +1 -0
- package/dist/lib/components/slots/mj-chat-agent-presence-default.component.js +98 -0
- package/dist/lib/components/slots/mj-chat-agent-presence-default.component.js.map +1 -0
- package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.d.ts +9 -0
- package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.d.ts.map +1 -0
- package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.js +35 -0
- package/dist/lib/components/slots/mj-chat-demonstration-surface-default.component.js.map +1 -0
- package/dist/lib/components/slots/mj-chat-empty-state-default.component.d.ts +28 -0
- package/dist/lib/components/slots/mj-chat-empty-state-default.component.d.ts.map +1 -0
- package/dist/lib/components/slots/mj-chat-empty-state-default.component.js +104 -0
- package/dist/lib/components/slots/mj-chat-empty-state-default.component.js.map +1 -0
- package/dist/lib/components/slots/mj-chat-header-default.component.d.ts +11 -0
- package/dist/lib/components/slots/mj-chat-header-default.component.d.ts.map +1 -0
- package/dist/lib/components/slots/mj-chat-header-default.component.js +103 -0
- package/dist/lib/components/slots/mj-chat-header-default.component.js.map +1 -0
- package/dist/lib/components/slots/mj-chat-message-bubble-default.component.d.ts +15 -0
- package/dist/lib/components/slots/mj-chat-message-bubble-default.component.d.ts.map +1 -0
- package/dist/lib/components/slots/mj-chat-message-bubble-default.component.js +73 -0
- package/dist/lib/components/slots/mj-chat-message-bubble-default.component.js.map +1 -0
- package/dist/lib/components/slots/mj-chat-message-extra-default.component.d.ts +9 -0
- package/dist/lib/components/slots/mj-chat-message-extra-default.component.d.ts.map +1 -0
- package/dist/lib/components/slots/mj-chat-message-extra-default.component.js +34 -0
- package/dist/lib/components/slots/mj-chat-message-extra-default.component.js.map +1 -0
- package/dist/lib/components/slots/slot-interfaces.d.ts +95 -0
- package/dist/lib/components/slots/slot-interfaces.d.ts.map +1 -0
- package/dist/lib/components/slots/slot-interfaces.js +18 -0
- package/dist/lib/components/slots/slot-interfaces.js.map +1 -0
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts +11 -0
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.js +28 -4
- package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
- package/dist/lib/conversations.module.d.ts +12 -1
- package/dist/lib/conversations.module.d.ts.map +1 -1
- package/dist/lib/conversations.module.js +93 -5
- package/dist/lib/conversations.module.js.map +1 -1
- package/dist/lib/directives/chat-slot.directive.d.ts +44 -0
- package/dist/lib/directives/chat-slot.directive.d.ts.map +1 -0
- package/dist/lib/directives/chat-slot.directive.js +54 -0
- package/dist/lib/directives/chat-slot.directive.js.map +1 -0
- package/dist/lib/events/chat-events.d.ts +137 -0
- package/dist/lib/events/chat-events.d.ts.map +1 -0
- package/dist/lib/events/chat-events.js +189 -0
- package/dist/lib/events/chat-events.js.map +1 -0
- package/dist/lib/models/conversation-state.model.d.ts +2 -1
- package/dist/lib/models/conversation-state.model.d.ts.map +1 -1
- package/dist/lib/models/conversation-state.model.js.map +1 -1
- package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-state.service.js +23 -6
- package/dist/lib/services/artifact-state.service.js.map +1 -1
- package/dist/lib/services/conversation-agent.service.d.ts +60 -74
- package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-agent.service.js +100 -313
- package/dist/lib/services/conversation-agent.service.js.map +1 -1
- package/dist/lib/services/conversation-bridge.service.d.ts +11 -70
- package/dist/lib/services/conversation-bridge.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-bridge.service.js +51 -85
- package/dist/lib/services/conversation-bridge.service.js.map +1 -1
- package/dist/lib/services/conversation-naming.d.ts +63 -0
- package/dist/lib/services/conversation-naming.d.ts.map +1 -0
- package/dist/lib/services/conversation-naming.js +58 -0
- package/dist/lib/services/conversation-naming.js.map +1 -0
- package/dist/lib/services/conversation-streaming.service.d.ts +24 -154
- package/dist/lib/services/conversation-streaming.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-streaming.service.js +39 -361
- package/dist/lib/services/conversation-streaming.service.js.map +1 -1
- package/dist/lib/services/conversations-runtime-bootstrap.service.d.ts +10 -0
- package/dist/lib/services/conversations-runtime-bootstrap.service.d.ts.map +1 -0
- package/dist/lib/services/conversations-runtime-bootstrap.service.js +104 -0
- package/dist/lib/services/conversations-runtime-bootstrap.service.js.map +1 -0
- package/dist/lib/services/delegation-result-parser.d.ts +45 -0
- package/dist/lib/services/delegation-result-parser.d.ts.map +1 -0
- package/dist/lib/services/delegation-result-parser.js +48 -0
- package/dist/lib/services/delegation-result-parser.js.map +1 -0
- package/dist/lib/services/mention-autocomplete.service.d.ts +19 -4
- package/dist/lib/services/mention-autocomplete.service.d.ts.map +1 -1
- package/dist/lib/services/mention-autocomplete.service.js +65 -4
- package/dist/lib/services/mention-autocomplete.service.js.map +1 -1
- package/dist/lib/services/mention-parser.service.d.ts +8 -53
- package/dist/lib/services/mention-parser.service.d.ts.map +1 -1
- package/dist/lib/services/mention-parser.service.js +32 -243
- package/dist/lib/services/mention-parser.service.js.map +1 -1
- package/dist/lib/services/narration-template.d.ts +42 -0
- package/dist/lib/services/narration-template.d.ts.map +1 -0
- package/dist/lib/services/narration-template.js +73 -0
- package/dist/lib/services/narration-template.js.map +1 -0
- package/dist/lib/services/realtime-pairing.d.ts +120 -0
- package/dist/lib/services/realtime-pairing.d.ts.map +1 -0
- package/dist/lib/services/realtime-pairing.js +150 -0
- package/dist/lib/services/realtime-pairing.js.map +1 -0
- package/dist/lib/services/realtime-session-review.service.d.ts +233 -0
- package/dist/lib/services/realtime-session-review.service.d.ts.map +1 -0
- package/dist/lib/services/realtime-session-review.service.js +417 -0
- package/dist/lib/services/realtime-session-review.service.js.map +1 -0
- package/dist/lib/services/realtime-session.service.d.ts +739 -0
- package/dist/lib/services/realtime-session.service.d.ts.map +1 -0
- package/dist/lib/services/realtime-session.service.js +1647 -0
- package/dist/lib/services/realtime-session.service.js.map +1 -0
- package/dist/lib/services/realtime-sessions-adapter.d.ts +54 -0
- package/dist/lib/services/realtime-sessions-adapter.d.ts.map +1 -0
- package/dist/lib/services/realtime-sessions-adapter.js +154 -0
- package/dist/lib/services/realtime-sessions-adapter.js.map +1 -0
- package/dist/lib/services/user-authorization.d.ts +67 -0
- package/dist/lib/services/user-authorization.d.ts.map +1 -0
- package/dist/lib/services/user-authorization.js +66 -0
- package/dist/lib/services/user-authorization.js.map +1 -0
- package/dist/lib/utils/realtime-session-timeline.d.ts +84 -0
- package/dist/lib/utils/realtime-session-timeline.d.ts.map +1 -0
- package/dist/lib/utils/realtime-session-timeline.js +94 -0
- package/dist/lib/utils/realtime-session-timeline.js.map +1 -0
- package/dist/public-api.d.ts +41 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +50 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +27 -24
- package/dist/__tests__/conversation-bridge.service.test.d.ts +0 -2
- package/dist/__tests__/conversation-bridge.service.test.d.ts.map +0 -1
- package/dist/__tests__/conversation-bridge.service.test.js +0 -98
- package/dist/__tests__/conversation-bridge.service.test.js.map +0 -1
- package/dist/__tests__/mention-parser.test.d.ts +0 -2
- package/dist/__tests__/mention-parser.test.d.ts.map +0 -1
- package/dist/__tests__/mention-parser.test.js +0 -154
- package/dist/__tests__/mention-parser.test.js.map +0 -1
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { IMetadataProvider } from '@memberjunction/core';
|
|
3
|
+
import { RealtimeToolDefinition } from '@memberjunction/ai';
|
|
4
|
+
import { RealtimeAudioActivity } from '@memberjunction/ai-realtime-client';
|
|
5
|
+
import { ParsedDelegationArtifact } from './delegation-result-parser';
|
|
6
|
+
import { BaseRealtimeChannelClient } from '../components/realtime/channels/base-realtime-channel-client';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
/**
|
|
9
|
+
* Connection / turn state for a real-time voice session, surfaced to the UI overlay.
|
|
10
|
+
* - `connecting` — negotiating the session + provider handshake
|
|
11
|
+
* - `listening` — connected, mic open, waiting for / hearing the user
|
|
12
|
+
* - `speaking` — the agent is producing audio
|
|
13
|
+
* - `thinking` — the agent delegated work (tool call) and is waiting on a result
|
|
14
|
+
* - `error` — a fatal error occurred; the session is no longer usable
|
|
15
|
+
* - `closed` — the session has been torn down
|
|
16
|
+
*/
|
|
17
|
+
export type VoiceConnectionState = 'connecting' | 'listening' | 'speaking' | 'thinking' | 'error' | 'closed';
|
|
18
|
+
/** A single caption line (one side of the conversation) shown in the live-captions list. */
|
|
19
|
+
export interface VoiceCaption {
|
|
20
|
+
Role: 'User' | 'Assistant';
|
|
21
|
+
Text: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A delegated-run progress update surfaced to the UI, emitted on {@link RealtimeSessionService.DelegationProgress$}.
|
|
25
|
+
* These originate server-side during an `invoke-target-agent` delegation (e.g. while Sage works) and let a
|
|
26
|
+
* future overlay render a "working" card while the realtime model narrates the same progress aloud.
|
|
27
|
+
*/
|
|
28
|
+
export interface VoiceDelegationProgress {
|
|
29
|
+
/** The `invoke-target-agent` call this progress belongs to. */
|
|
30
|
+
CallID: string;
|
|
31
|
+
/** The delegation phase: `prompt_execution` | `action_execution` | `subagent_execution` | `decision_processing`. */
|
|
32
|
+
Step: string;
|
|
33
|
+
/** Human-readable progress message. */
|
|
34
|
+
Message: string;
|
|
35
|
+
/** Optional completion percentage (0–100) when the server can estimate it. */
|
|
36
|
+
Percentage?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The terminal result of a delegated tool call, emitted on {@link RealtimeSessionService.DelegationResult$}
|
|
40
|
+
* when the delegation finishes so the overlay can flip the "working" card into a result card with real
|
|
41
|
+
* content + provenance.
|
|
42
|
+
*/
|
|
43
|
+
export interface VoiceDelegationResult {
|
|
44
|
+
/** The `invoke-target-agent` call this result belongs to. */
|
|
45
|
+
CallID: string;
|
|
46
|
+
/** Whether the delegated work succeeded. */
|
|
47
|
+
Success: boolean;
|
|
48
|
+
/** The result text — the agent's output, or an error message on failure. */
|
|
49
|
+
Output: string;
|
|
50
|
+
/**
|
|
51
|
+
* ID of the delegated agent run (`MJ: AI Agent Runs`) when the server reported one
|
|
52
|
+
* (`runId` in the tool ResultJson). Powers the overlay's gear-gated "Open run" dev link.
|
|
53
|
+
*/
|
|
54
|
+
RunID?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Artifacts the delegated run produced, when the server reported any (`artifacts` in the
|
|
57
|
+
* tool ResultJson). The overlay's tabbed surface panel auto-opens one artifact tab per
|
|
58
|
+
* entry and focuses the newest on arrival.
|
|
59
|
+
*/
|
|
60
|
+
Artifacts?: ParsedDelegationArtifact[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Handler for a CLIENT-EXECUTED UI tool (e.g. the live whiteboard's `Whiteboard_*` surface),
|
|
64
|
+
* registered via {@link RealtimeSessionService.RegisterClientToolHandler}. Receives the tool name +
|
|
65
|
+
* raw arguments JSON from the realtime model and returns the result JSON string fed back as the
|
|
66
|
+
* `tool_response`. May be sync or async; thrown errors are wrapped into a
|
|
67
|
+
* `{ success: false, error }` payload by the service so the model can narrate the failure.
|
|
68
|
+
*/
|
|
69
|
+
export type RealtimeClientToolHandler = (toolName: string, argsJson: string) => string | Promise<string>;
|
|
70
|
+
/**
|
|
71
|
+
* A channel's request to enter / leave the FOCUS layout, emitted on
|
|
72
|
+
* {@link RealtimeSessionService.ChannelFocus$} when a plugin calls its context's
|
|
73
|
+
* `SetFocusMode`. The overlay shell subscribes: it collapses/restores the main call column
|
|
74
|
+
* and remembers which channel holds focus (so the floating pill's "exit" can be routed
|
|
75
|
+
* back via {@link BaseRealtimeChannelClient.RequestFocusExit}).
|
|
76
|
+
*/
|
|
77
|
+
export interface RealtimeChannelFocusEvent {
|
|
78
|
+
/** The channel plugin requesting the layout change. */
|
|
79
|
+
Channel: BaseRealtimeChannelClient;
|
|
80
|
+
/** `true` to enter focus mode (surface owns the screen), `false` to leave it. */
|
|
81
|
+
Focused: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* One EPHEMERAL spoken narration of delegated-run progress, emitted on
|
|
85
|
+
* {@link RealtimeSessionService.DelegationNarration$}. These are the interim "here's what's
|
|
86
|
+
* happening" utterances the realtime model speaks while a delegation runs. By product
|
|
87
|
+
* decision they are NOT captions and NOT persisted as ConversationDetails — they exist
|
|
88
|
+
* only as a live note in the overlay, replaced by each newer narration.
|
|
89
|
+
*/
|
|
90
|
+
export interface VoiceDelegationNarration {
|
|
91
|
+
/** The narration transcript text. */
|
|
92
|
+
Text: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Drives a **client-direct** real-time voice session: the browser mints an ephemeral
|
|
96
|
+
* token from the MJ server, then connects DIRECTLY to the realtime provider. Audio
|
|
97
|
+
* frames never transit the MJ server (low latency); only tool calls and final
|
|
98
|
+
* transcripts are relayed back to MJ over GraphQL.
|
|
99
|
+
*
|
|
100
|
+
* This service is PROVIDER-AGNOSTIC policy/orchestration. All provider wire concerns
|
|
101
|
+
* (transport, event translation, the response state machine, narration-kind tagging,
|
|
102
|
+
* playback tracking) live in a {@link BaseRealtimeClient} driver resolved through the
|
|
103
|
+
* MJ ClassFactory by the server-reported `Provider` key (e.g. `'openai'` →
|
|
104
|
+
* `OpenAIRealtimeClient`). Future providers (Gemini Live, …) snap in by registering a
|
|
105
|
+
* new driver — this service does not change.
|
|
106
|
+
*
|
|
107
|
+
* The Realtime Co-Agent (server-side) fronts the conversation's current agent — the server
|
|
108
|
+
* bakes the companion instructions + tool set into `SessionConfigJson`, which the client
|
|
109
|
+
* driver applies verbatim.
|
|
110
|
+
*
|
|
111
|
+
* Lifecycle: {@link StartVoiceSession} → live duplex → {@link EndVoiceSession}.
|
|
112
|
+
*/
|
|
113
|
+
export declare class RealtimeSessionService {
|
|
114
|
+
private _connectionState$;
|
|
115
|
+
private _captions$;
|
|
116
|
+
private _active$;
|
|
117
|
+
private _delegationProgress$;
|
|
118
|
+
private _delegationResult$;
|
|
119
|
+
private _delegationNarration$;
|
|
120
|
+
private _agentName$;
|
|
121
|
+
private _modelName$;
|
|
122
|
+
private _minimized$;
|
|
123
|
+
private _activeChannels$;
|
|
124
|
+
private _channelFocus$;
|
|
125
|
+
private _sessionStarted$;
|
|
126
|
+
private _sessionEnded$;
|
|
127
|
+
private _channelActivity$;
|
|
128
|
+
/** Current connection / turn state. */
|
|
129
|
+
readonly ConnectionState$: Observable<VoiceConnectionState>;
|
|
130
|
+
/** Live captions for both sides of the conversation. */
|
|
131
|
+
readonly Captions$: Observable<VoiceCaption[]>;
|
|
132
|
+
/** True while a session is open (mic button active, overlay shown). */
|
|
133
|
+
readonly Active$: Observable<boolean>;
|
|
134
|
+
/**
|
|
135
|
+
* Progress updates from a delegated agent run (e.g. Sage) while the realtime model waits on it.
|
|
136
|
+
* The future overlay subscribes to render a "working" card; the model also narrates these aloud.
|
|
137
|
+
*/
|
|
138
|
+
readonly DelegationProgress$: Observable<VoiceDelegationProgress>;
|
|
139
|
+
/** Terminal result of a delegation, so the overlay can complete the working card with real content. */
|
|
140
|
+
readonly DelegationResult$: Observable<VoiceDelegationResult>;
|
|
141
|
+
/**
|
|
142
|
+
* EPHEMERAL spoken progress narrations (see {@link VoiceDelegationNarration}). These are
|
|
143
|
+
* deliberately kept OUT of {@link Captions$} and never relayed/persisted — the overlay
|
|
144
|
+
* renders them as a transient "live note" near the active working card.
|
|
145
|
+
*/
|
|
146
|
+
readonly DelegationNarration$: Observable<VoiceDelegationNarration>;
|
|
147
|
+
/** Display name of the agent the active session fronts (set at session start). */
|
|
148
|
+
readonly AgentName$: Observable<string>;
|
|
149
|
+
/**
|
|
150
|
+
* Display name of the realtime MODEL the active session runs on (server-reported at session
|
|
151
|
+
* start, e.g. "GPT Realtime 2"). `null` before a session starts / when the server didn't report
|
|
152
|
+
* one. The overlay banner shows it subtly next to the agent identity.
|
|
153
|
+
*/
|
|
154
|
+
readonly ModelName$: Observable<string | null>;
|
|
155
|
+
/**
|
|
156
|
+
* True while the active call overlay is MINIMIZED to the host's floating "on call" pill
|
|
157
|
+
* (e.g. after a dev link navigated away). The mic and session stay fully live — this is
|
|
158
|
+
* pure presentation state, reset to `false` at session start and teardown.
|
|
159
|
+
*/
|
|
160
|
+
readonly Minimized$: Observable<boolean>;
|
|
161
|
+
/**
|
|
162
|
+
* The session's ACTIVE interactive-channel plugins, resolved from the `MJ: AI Agent
|
|
163
|
+
* Channels` registry at session start (one instance per session, per channel). Emits
|
|
164
|
+
* `[]` before a session starts and after teardown. The overlay subscribes to register
|
|
165
|
+
* one surface tab per plugin — it never knows any concrete channel type.
|
|
166
|
+
*/
|
|
167
|
+
readonly ActiveChannels$: Observable<BaseRealtimeChannelClient[]>;
|
|
168
|
+
/**
|
|
169
|
+
* Channel requests to enter / leave the FOCUS layout (see
|
|
170
|
+
* {@link RealtimeChannelFocusEvent}). Fired when a plugin calls its host context's
|
|
171
|
+
* `SetFocusMode` — e.g. the whiteboard's "Focus board" toggle.
|
|
172
|
+
*/
|
|
173
|
+
readonly ChannelFocus$: Observable<RealtimeChannelFocusEvent>;
|
|
174
|
+
/**
|
|
175
|
+
* Fired EXACTLY ONCE per session after both `agentSessionId` is set AND the
|
|
176
|
+
* realtime client is connected. Carries the server-issued `sessionId` and the
|
|
177
|
+
* `ChannelName` of each plugin resolved at session mint. Consumed by
|
|
178
|
+
* `RealtimeSessionsAdapter` (in this package) to feed
|
|
179
|
+
* `@memberjunction/conversations-runtime`'s `SessionsObserver`.
|
|
180
|
+
*
|
|
181
|
+
* **Why this exists separately from `Active$`:** `Active$` flips `true` BEFORE
|
|
182
|
+
* `mintSession` resolves, so `agentSessionId` is still `null` at that moment.
|
|
183
|
+
* Subscribers correlating `(Active$, agentSessionId)` would race; this event
|
|
184
|
+
* removes the race.
|
|
185
|
+
*/
|
|
186
|
+
readonly SessionStarted$: Observable<{
|
|
187
|
+
sessionId: string;
|
|
188
|
+
channelNames: string[];
|
|
189
|
+
}>;
|
|
190
|
+
/**
|
|
191
|
+
* Fired EXACTLY ONCE per session as teardown begins, with the prior
|
|
192
|
+
* `agentSessionId` (so subscribers can correlate against `SessionStarted$`'s
|
|
193
|
+
* sessionId) and the client-distinguishable reason — `'explicit'` when the
|
|
194
|
+
* user called `EndVoiceSession`, `'error'` when teardown ran from a catch
|
|
195
|
+
* block. Server-side close paths (janitor, shutdown) do NOT propagate here —
|
|
196
|
+
* they happen out-of-process and have no client push channel today.
|
|
197
|
+
*/
|
|
198
|
+
readonly SessionEnded$: Observable<{
|
|
199
|
+
sessionId: string;
|
|
200
|
+
reason: 'explicit' | 'error';
|
|
201
|
+
}>;
|
|
202
|
+
/**
|
|
203
|
+
* Fires with the channel PLUGIN every time the agent ACTS on that channel (a tool call
|
|
204
|
+
* was routed to its local executor — e.g. the agent drew on the whiteboard). The overlay
|
|
205
|
+
* uses the FIRST emission per channel to auto-reveal + focus the channel's surface tab,
|
|
206
|
+
* so the user discovers the surface the moment the agent starts using it. Finer-grained
|
|
207
|
+
* than {@link SessionStarted$}/{@link SessionEnded$} (per tool call, not per session).
|
|
208
|
+
*/
|
|
209
|
+
readonly ChannelActivity$: Observable<BaseRealtimeChannelClient>;
|
|
210
|
+
/** Synchronous access to the session's active interactive-channel plugins. */
|
|
211
|
+
get ActiveChannels(): readonly BaseRealtimeChannelClient[];
|
|
212
|
+
/** Synchronous access to the display name of the agent the active session fronts. */
|
|
213
|
+
get CurrentAgentName(): string;
|
|
214
|
+
/**
|
|
215
|
+
* ID of the active server-side agent session (`MJ: AI Agent Sessions`), or `null` when no
|
|
216
|
+
* session is open / the session hasn't been minted yet. Powers the overlay's gear-gated
|
|
217
|
+
* "Open session" dev link.
|
|
218
|
+
*/
|
|
219
|
+
/** Conversation id the SERVER created for this session (null when the host supplied one). */
|
|
220
|
+
private createdConversationId;
|
|
221
|
+
/** The session's conversation id (supplied or server-created). */
|
|
222
|
+
private sessionConversationId;
|
|
223
|
+
/** First final user utterance of the live session (the naming seed). */
|
|
224
|
+
private firstUserTranscript;
|
|
225
|
+
/**
|
|
226
|
+
* When the active/last session CREATED its conversation (started without one), the new
|
|
227
|
+
* conversation's id — the host uses it to refresh the cached list, conditionally select
|
|
228
|
+
* it on close, and auto-name it. Null when the session joined an existing conversation.
|
|
229
|
+
*/
|
|
230
|
+
get SessionCreatedConversationId(): string | null;
|
|
231
|
+
/** The first final user utterance of the session (naming seed); null before the user speaks. */
|
|
232
|
+
get FirstUserTranscript(): string | null;
|
|
233
|
+
get CurrentAgentSessionId(): string | null;
|
|
234
|
+
/** Synchronous access to the minimized presentation state. */
|
|
235
|
+
get IsMinimized(): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Minimizes / restores the active call overlay (host renders the floating pill while
|
|
238
|
+
* minimized). Presentation-only — the live audio session is untouched.
|
|
239
|
+
*/
|
|
240
|
+
SetMinimized(minimized: boolean): void;
|
|
241
|
+
/** The provider-direct realtime client driving the live session (ClassFactory-resolved). */
|
|
242
|
+
private client;
|
|
243
|
+
/** The mic capture stream — acquired here (permission UX) and handed to the client. */
|
|
244
|
+
private localStream;
|
|
245
|
+
private agentSessionId;
|
|
246
|
+
/**
|
|
247
|
+
* The DB-driven narration instruction template (server-resolved at session start, containing a
|
|
248
|
+
* `{{ progressMessage }}` placeholder). `null` when the deployment hasn't synced the narration
|
|
249
|
+
* prompt — {@link buildNarrationInstructions} then falls back to the built-in wording.
|
|
250
|
+
*/
|
|
251
|
+
private narrationTemplate;
|
|
252
|
+
/** First spoken update fires no earlier than this long after delegated work starts. */
|
|
253
|
+
private static readonly FirstNarrationDelayMs;
|
|
254
|
+
/** Minimum gap between SUBSEQUENT spoken updates (the 7–10s band; floods aggregate). */
|
|
255
|
+
private static readonly NarrationIntervalMs;
|
|
256
|
+
/** Retry delay when the fire moment finds the model busy / audio still playing. */
|
|
257
|
+
private static readonly NarrationBusyRetryMs;
|
|
258
|
+
/** Max progress messages aggregated into one spoken digest. */
|
|
259
|
+
private static readonly MaxDigestMessages;
|
|
260
|
+
/** Max prior spoken narrations chained into the instructions (anti-repetition). */
|
|
261
|
+
private static readonly MaxPriorNarrations;
|
|
262
|
+
/**
|
|
263
|
+
* Aggregation buffer: distinct progress messages since the last spoken update (oldest
|
|
264
|
+
* first, capped at {@link RealtimeSessionService.MaxDigestMessages}). A flood of small
|
|
265
|
+
* updates becomes ONE digest; the buffer is discarded when the result lands first.
|
|
266
|
+
*/
|
|
267
|
+
private pendingNarrationMessages;
|
|
268
|
+
/**
|
|
269
|
+
* Tool calls currently executing on the server. Progress events ride PubSub and can
|
|
270
|
+
* lag the (fast) mutation result — any progress for a call NOT in this set is stale
|
|
271
|
+
* (already completed) and is dropped, so we never narrate "starting up" after the
|
|
272
|
+
* answer was already spoken.
|
|
273
|
+
*/
|
|
274
|
+
private inFlightCallIds;
|
|
275
|
+
/** Timer for the deferred narration; cancelled when the delegation result lands first. */
|
|
276
|
+
private narrationTimer;
|
|
277
|
+
/**
|
|
278
|
+
* Call ids the USER explicitly cancelled via {@link CancelDelegation} /
|
|
279
|
+
* {@link CancelInFlightDelegations}. Their cards were already flipped to the
|
|
280
|
+
* "Cancelled by user" failed result, so when the original tool mutation later resolves
|
|
281
|
+
* with the aborted run's outcome, {@link emitDelegationResult} skips the duplicate card
|
|
282
|
+
* emission (the model still receives the tool result). Cleared at teardown.
|
|
283
|
+
*/
|
|
284
|
+
private cancelledCallIds;
|
|
285
|
+
/** Debounce window for relaying accumulated usage deltas to the server. */
|
|
286
|
+
private static readonly UsageFlushDebounceMs;
|
|
287
|
+
/** Accumulated input-token delta since the last flush. */
|
|
288
|
+
private pendingUsageInput;
|
|
289
|
+
/** Accumulated output-token delta since the last flush. */
|
|
290
|
+
private pendingUsageOutput;
|
|
291
|
+
/** Pending debounced usage flush; also force-flushed at teardown. */
|
|
292
|
+
private usageFlushTimer;
|
|
293
|
+
/** Active push-status subscription that feeds delegation progress; cleared on teardown. */
|
|
294
|
+
private delegationProgressSub;
|
|
295
|
+
/** Timestamp (ms) of the last narration we triggered; 0 = never. */
|
|
296
|
+
private lastDelegationNarrationAt;
|
|
297
|
+
/** When the current delegation burst began (first in-flight call); anchors the 5s first update. */
|
|
298
|
+
private delegationBurstStartedAt;
|
|
299
|
+
/** Spoken updates so far in this burst (1-based numbering for the instructions). */
|
|
300
|
+
private narrationCount;
|
|
301
|
+
/** What the model actually SAID for prior updates this burst — chained in so it never repeats itself. */
|
|
302
|
+
private spokenNarrations;
|
|
303
|
+
/** Tail message of the last digest, so an identical trailing progress event isn't re-buffered. */
|
|
304
|
+
private lastNarratedTail;
|
|
305
|
+
/**
|
|
306
|
+
* Registry of CLIENT-EXECUTED UI tool handlers, keyed by tool-name prefix (e.g.
|
|
307
|
+
* `'Whiteboard_'`). Tool calls whose name matches a registered prefix run LOCALLY through the
|
|
308
|
+
* handler (never relayed to the server); everything else takes the standard server-relay path.
|
|
309
|
+
* Cleared at teardown.
|
|
310
|
+
*/
|
|
311
|
+
private clientToolHandlers;
|
|
312
|
+
/** Debounce window for persisting a channel's state of record after a change burst. */
|
|
313
|
+
private static readonly ChannelSaveDebounceMs;
|
|
314
|
+
/**
|
|
315
|
+
* Pending DEBOUNCED channel-state saves, keyed by channel name. Each entry keeps the
|
|
316
|
+
* LATEST serialized state plus the session id captured while the session was live —
|
|
317
|
+
* the teardown flush runs as the live id is being torn down, so the capture guarantees
|
|
318
|
+
* the final save still lands on the just-closed session.
|
|
319
|
+
*/
|
|
320
|
+
private pendingChannelSaves;
|
|
321
|
+
private _provider;
|
|
322
|
+
/**
|
|
323
|
+
* Metadata provider used for the GraphQL relay mutations. Falls back to the
|
|
324
|
+
* global default when unset (single-provider apps see no change).
|
|
325
|
+
*/
|
|
326
|
+
get Provider(): IMetadataProvider;
|
|
327
|
+
set Provider(value: IMetadataProvider | null);
|
|
328
|
+
/** True when a session is currently open. */
|
|
329
|
+
get IsActive(): boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Start a client-direct voice session fronting `targetAgentId`.
|
|
332
|
+
*
|
|
333
|
+
* @param targetAgentId The agent the Realtime Co-Agent voices on behalf of.
|
|
334
|
+
* @param conversationId Optional existing conversation to bind + seed context from.
|
|
335
|
+
* @param lastSessionId Optional prior session to chain to (resume / continuation).
|
|
336
|
+
* @param agentName Optional display name of the target agent — resolved by the caller
|
|
337
|
+
* (which knows the conversation's routing context) and surfaced on {@link AgentName$}
|
|
338
|
+
* so ANY host (composer trigger, chat-area overlay) can render it without re-resolving.
|
|
339
|
+
* @param preferredModelId Optional EXPLICIT realtime model choice (`MJ: AI Models.ID`). When
|
|
340
|
+
* set, the server uses exactly that model and FAILS with a clear reason if it can't (no
|
|
341
|
+
* silent fallback). Omit for the server's automatic (highest-PowerRank) selection.
|
|
342
|
+
* @param clientTools Optional EXTRA client-executed UI tool declarations to expose to the
|
|
343
|
+
* realtime model alongside the server's stable tool set and the interactive-channel
|
|
344
|
+
* tools (which are aggregated automatically from the registry-resolved plugins — see
|
|
345
|
+
* {@link ActiveChannels$}). The server only DECLARES these — execution stays in the
|
|
346
|
+
* browser via handlers registered with {@link RegisterClientToolHandler}. This is an
|
|
347
|
+
* extension point for hosts with bespoke (non-channel) UI tools; most callers omit it.
|
|
348
|
+
* @param coAgentId Optional EXPLICIT co-agent choice (`MJ: AI Agents.ID` of an Active,
|
|
349
|
+
* Realtime-type agent) — the highest-precedence step of the server's co-agent resolution
|
|
350
|
+
* chain. When set, the server uses exactly that co-agent and FAILS with a clear reason if
|
|
351
|
+
* it can't (no silent fallback). Omit to let server metadata drive the choice: the target
|
|
352
|
+
* agent's `DefaultCoAgentID`, then the type-level `AIAgentCoAgent` default row, then the global Realtime Co-Agent.
|
|
353
|
+
* @param configOverridesJson Optional JSON payload of SESSION CONFIG overrides (e.g.
|
|
354
|
+
* `{"realtime":{"modelPreference":"<modelId>"}}`), forwarded verbatim on the mint
|
|
355
|
+
* mutation. The server enforces the `Realtime: Advanced Session Controls`
|
|
356
|
+
* authorization on any overrides — hosts only populate this from authorization-gated
|
|
357
|
+
* pickers, and never synthesize overrides beyond what the user explicitly chose.
|
|
358
|
+
* Omit/`null` for the server's defaults (today's behavior).
|
|
359
|
+
*/
|
|
360
|
+
StartVoiceSession(targetAgentId: string, conversationId?: string | null, lastSessionId?: string | null, agentName?: string | null, preferredModelId?: string | null, clientTools?: RealtimeToolDefinition[] | null, coAgentId?: string | null, configOverridesJson?: string | null): Promise<void>;
|
|
361
|
+
/**
|
|
362
|
+
* End the active session: stop the mic, tear down the provider connection, and close
|
|
363
|
+
* the server-side agent session. Safe to call when no session is active.
|
|
364
|
+
*/
|
|
365
|
+
EndVoiceSession(): Promise<void>;
|
|
366
|
+
/**
|
|
367
|
+
* Inject a typed message into the live session as a user turn.
|
|
368
|
+
*
|
|
369
|
+
* Decomposed into two steps, each mirroring an existing voice path so the typed
|
|
370
|
+
* turn behaves identically to a spoken one:
|
|
371
|
+
* 1. {@link BaseRealtimeClient.SendText} injects the text as user input and triggers a
|
|
372
|
+
* reply through the SAME collision-safe path tool results use — so it queues behind
|
|
373
|
+
* any in-flight response (progress narration / prior turn) instead of colliding.
|
|
374
|
+
* 2. Relay the turn through the same caption + transcript paths user speech uses
|
|
375
|
+
* ({@link onUserTranscript}) so it shows in the live thread AND persists to MJ.
|
|
376
|
+
*
|
|
377
|
+
* No-op when no session is open / the control channel isn't ready, or when the text is empty.
|
|
378
|
+
*/
|
|
379
|
+
SendText(text: string): void;
|
|
380
|
+
/** Mute / unmute the local microphone track. Returns the new muted state. */
|
|
381
|
+
ToggleMute(): boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Registers a handler for CLIENT-EXECUTED UI tools whose names start with `toolNamePrefix`
|
|
384
|
+
* (e.g. `'Whiteboard_'` → all `Whiteboard_*` calls). Matching tool calls execute LOCALLY via
|
|
385
|
+
* the handler — they are never relayed to the server — and the handler's result JSON is sent
|
|
386
|
+
* back to the model as the `tool_response`. Re-registering the same prefix replaces the
|
|
387
|
+
* handler. The registry is cleared at session teardown.
|
|
388
|
+
*/
|
|
389
|
+
RegisterClientToolHandler(toolNamePrefix: string, handler: RealtimeClientToolHandler): void;
|
|
390
|
+
/** Removes the handler registered for `toolNamePrefix` (no-op when none is registered). */
|
|
391
|
+
UnregisterClientToolHandler(toolNamePrefix: string): void;
|
|
392
|
+
/**
|
|
393
|
+
* Feeds a background context note into the live model (no spoken reply is requested) — the
|
|
394
|
+
* perception channel interactive surfaces use (e.g. the whiteboard's coalesced scene deltas).
|
|
395
|
+
* No-op when no session is live.
|
|
396
|
+
*/
|
|
397
|
+
SendContextNote(text: string): void;
|
|
398
|
+
/**
|
|
399
|
+
* The active client's current audio activity (per-direction RMS levels + spectrum
|
|
400
|
+
* bins), or `null` when no session is live or the driver attached no audio meters.
|
|
401
|
+
* Sampled by the overlay's animation-frame loop to drive the audio-reactive orb/EQ —
|
|
402
|
+
* a cheap analyser read, never provider traffic.
|
|
403
|
+
*/
|
|
404
|
+
GetAudioActivity(): RealtimeAudioActivity | null;
|
|
405
|
+
/**
|
|
406
|
+
* Resolves, instantiates and initializes the session's interactive-channel plugins from
|
|
407
|
+
* the `MJ: AI Agent Channels` registry, publishes them on {@link ActiveChannels$}, and
|
|
408
|
+
* returns their aggregated client-executed tool declarations for the session mint.
|
|
409
|
+
* Tolerant by design: registry/resolution failures degrade to "no channels" — the voice
|
|
410
|
+
* session itself always proceeds.
|
|
411
|
+
*/
|
|
412
|
+
private startChannels;
|
|
413
|
+
/**
|
|
414
|
+
* Loads the ACTIVE channel definitions from the registry and resolves each row's
|
|
415
|
+
* `ClientPluginClass` through the MJ ClassFactory into a per-session plugin instance —
|
|
416
|
+
* the client-side mirror of how realtime-model drivers resolve from `BaseRealtimeModel`
|
|
417
|
+
* / `BaseRealtimeClient`. Rows whose plugin class isn't registered are skipped (logged),
|
|
418
|
+
* never fatal.
|
|
419
|
+
*/
|
|
420
|
+
private loadActiveChannels;
|
|
421
|
+
/**
|
|
422
|
+
* Reads the ACTIVE `MJ: AI Agent Channels` rows from {@link AIEngineBase}'s cached
|
|
423
|
+
* `AgentChannels` (provider-scoped engine instance, lazy `Config` — no RunView
|
|
424
|
+
* round-trip; the engine's BaseEntity-event reactivity keeps the registry fresh).
|
|
425
|
+
* Failures are logged and degrade to an empty list — channel availability must
|
|
426
|
+
* never block the voice session.
|
|
427
|
+
*/
|
|
428
|
+
private fetchChannelDefinitions;
|
|
429
|
+
/**
|
|
430
|
+
* Resolves one registry row's `ClientPluginClass` via the ClassFactory (registration
|
|
431
|
+
* checked first, exactly like the realtime-client drivers) and instantiates a fresh
|
|
432
|
+
* per-session plugin. Returns `null` (logged) when no plugin is registered for the key
|
|
433
|
+
* — e.g. its Load function was never called or the package isn't included client-side.
|
|
434
|
+
*/
|
|
435
|
+
private resolveChannelPlugin;
|
|
436
|
+
/**
|
|
437
|
+
* Wires one plugin into the session: hands it its host context and registers its
|
|
438
|
+
* prefix-routed local tool executor (so `<ToolNamePrefix>*` calls run in the browser
|
|
439
|
+
* through {@link BaseRealtimeChannelClient.ApplyAgentTool}, never the server relay).
|
|
440
|
+
*/
|
|
441
|
+
private initializeChannel;
|
|
442
|
+
/** Builds the host-services context one channel plugin sees (its only line to the session). */
|
|
443
|
+
private buildChannelContext;
|
|
444
|
+
/**
|
|
445
|
+
* Runs a channel-specific GraphQL operation through the live session's provider (the
|
|
446
|
+
* {@link RealtimeChannelContext.ExecuteServerAction} implementation). Best-effort: any
|
|
447
|
+
* transport/server error is logged and resolves to `null` so the calling channel can map
|
|
448
|
+
* the failure to a model-readable result string without `try/catch`.
|
|
449
|
+
*/
|
|
450
|
+
private executeChannelServerAction;
|
|
451
|
+
/**
|
|
452
|
+
* A channel asked the live model to SPEAK in reaction to channel input (e.g. a widget
|
|
453
|
+
* submission) — routed through the client's spoken-update channel. No-op when the
|
|
454
|
+
* session isn't live; empty instructions are dropped.
|
|
455
|
+
*/
|
|
456
|
+
private requestChannelSpokenResponse;
|
|
457
|
+
/**
|
|
458
|
+
* Applies the PRIOR session's saved channel states (resume continuity): parses the
|
|
459
|
+
* server-supplied map and offers each entry to the matching active plugin via
|
|
460
|
+
* {@link BaseRealtimeChannelClient.RestoreState}. Fully tolerant — malformed payloads,
|
|
461
|
+
* unknown channels, and plugin rejections are logged and skipped; the session start is
|
|
462
|
+
* never affected.
|
|
463
|
+
*/
|
|
464
|
+
private applyPriorChannelStates;
|
|
465
|
+
/**
|
|
466
|
+
* Persists a channel's state as a first-class versioned artifact (`MJ: Artifacts`) via the
|
|
467
|
+
* `SaveSessionChannelArtifact` mutation — the channel-context capability behind e.g. the
|
|
468
|
+
* whiteboard's "Save to artifacts". Best-effort: returns the created Artifact ID, or null
|
|
469
|
+
* on any failure (logged, never thrown). Uses the live session id, falling back to the
|
|
470
|
+
* teardown-captured one so "save my board" works right after the call ends.
|
|
471
|
+
*/
|
|
472
|
+
private saveChannelArtifact;
|
|
473
|
+
/** Most recent session id captured by the save pipeline (post-teardown saves). */
|
|
474
|
+
private lastKnownSessionIdForSaves;
|
|
475
|
+
/**
|
|
476
|
+
* Schedules the DEBOUNCED state-of-record save for a channel: each request replaces the
|
|
477
|
+
* pending payload (latest state wins) and re-arms the timer; the session id is captured
|
|
478
|
+
* while live so the teardown flush can persist onto the just-closed session.
|
|
479
|
+
*/
|
|
480
|
+
private scheduleChannelSave;
|
|
481
|
+
/** Fires one pending channel save (best-effort; {@link SaveChannelState} logs failures). */
|
|
482
|
+
private flushChannelSave;
|
|
483
|
+
/** Final teardown flush: persist every channel's unsaved state immediately. */
|
|
484
|
+
private flushAllChannelSaves;
|
|
485
|
+
/** Disposes all channel plugins (errors contained per plugin) and clears the live set. */
|
|
486
|
+
private disposeChannels;
|
|
487
|
+
/**
|
|
488
|
+
* Resolves the provider-direct realtime client for `provider` through the MJ
|
|
489
|
+
* ClassFactory — the client-side mirror of how server drivers are resolved from
|
|
490
|
+
* `BaseRealtimeModel`. Throws a clear error when no driver is registered for the
|
|
491
|
+
* provider (e.g. its Load function was never called).
|
|
492
|
+
*/
|
|
493
|
+
private createRealtimeClient;
|
|
494
|
+
/** Builds the client-direct session config the realtime client connects with. */
|
|
495
|
+
private buildClientConfig;
|
|
496
|
+
/**
|
|
497
|
+
* Parses the server-built session config JSON. On failure, logs and returns an empty
|
|
498
|
+
* object — the client treats an empty config as "nothing to apply", so the session
|
|
499
|
+
* still opens (mirroring the prior behavior of skipping the config update).
|
|
500
|
+
*/
|
|
501
|
+
private parseSessionConfig;
|
|
502
|
+
/** Subscribes this service's policy handlers to the realtime client's events. */
|
|
503
|
+
private wireClientHandlers;
|
|
504
|
+
/** Maps a client state event onto the UI connection state. */
|
|
505
|
+
private onClientStateChange;
|
|
506
|
+
/**
|
|
507
|
+
* Translates {@link RealtimeClientState} into {@link VoiceConnectionState}. `'connected'`
|
|
508
|
+
* is suppressed (the UI stays 'connecting' until the control channel opens → 'listening'),
|
|
509
|
+
* and `'closed'` never overwrites a terminal 'error' the service itself recorded.
|
|
510
|
+
*/
|
|
511
|
+
private mapClientState;
|
|
512
|
+
/** True when the live control channel is usable (open and not torn down / failed). */
|
|
513
|
+
private isSessionLive;
|
|
514
|
+
/**
|
|
515
|
+
* Applies transcript policy to client transcript events. Interim deltas are ignored
|
|
516
|
+
* (the client already drives the speaking state). Final NORMAL assistant turns become
|
|
517
|
+
* captions + persisted transcripts; final NARRATION turns are EPHEMERAL by product
|
|
518
|
+
* decision — emitted on {@link DelegationNarration$} only, never a caption, never
|
|
519
|
+
* relayed/persisted. User turns ride the caption + relay path.
|
|
520
|
+
*/
|
|
521
|
+
private onClientTranscript;
|
|
522
|
+
/**
|
|
523
|
+
* Replaces the LAST caption of `role` in place (correction semantics); falls back to a
|
|
524
|
+
* plain append when no such caption exists yet (e.g. the superseded turn predates this
|
|
525
|
+
* client's caption window).
|
|
526
|
+
*/
|
|
527
|
+
private replaceLastCaption;
|
|
528
|
+
/** Finalizes the user turn: push a caption + relay the final transcript. */
|
|
529
|
+
private onUserTranscript;
|
|
530
|
+
/**
|
|
531
|
+
* Routes a provider tool call: names matching a registered client-tool prefix execute
|
|
532
|
+
* LOCALLY (UI tools — see {@link RegisterClientToolHandler}); everything else executes on
|
|
533
|
+
* the MJ server. Either way the result feeds back to the model via
|
|
534
|
+
* {@link BaseRealtimeClient.SendToolResult} so it speaks the outcome.
|
|
535
|
+
*/
|
|
536
|
+
private handleToolCall;
|
|
537
|
+
/** Finds the registered client-tool handler whose prefix matches `toolName`, or `null`. */
|
|
538
|
+
private findClientToolHandler;
|
|
539
|
+
/**
|
|
540
|
+
* Executes one client-tool call through its handler, wrapping any thrown error into a
|
|
541
|
+
* `{ success: false, error }` JSON payload so the model can narrate the failure instead of
|
|
542
|
+
* the call going silent.
|
|
543
|
+
*/
|
|
544
|
+
private executeClientTool;
|
|
545
|
+
/**
|
|
546
|
+
* Emits a delegation result so the overlay's "working" card flips to a result card with real
|
|
547
|
+
* content. Parses the broker's `{success, output, runId}` | `{success:false, error}` shape via
|
|
548
|
+
* {@link ParseDelegationResultJson}; if it isn't JSON, surfaces the raw string. Only delegation
|
|
549
|
+
* cards (created from progress events) react — non-delegation tool results have no card and are
|
|
550
|
+
* harmlessly ignored downstream. The `runId` (the delegated `MJ: AI Agent Runs` record) rides
|
|
551
|
+
* along as {@link VoiceDelegationResult.RunID} for the overlay's dev links, and any `artifacts`
|
|
552
|
+
* ride along as {@link VoiceDelegationResult.Artifacts} for the surface panel's artifact tabs.
|
|
553
|
+
*/
|
|
554
|
+
private emitDelegationResult;
|
|
555
|
+
/**
|
|
556
|
+
* Cancels ONE in-flight delegated tool call — the overlay's per-card ✕ affordance.
|
|
557
|
+
*
|
|
558
|
+
* EXPLICIT USER INTENT ONLY (deliberate host policy): true barge-in never aborts
|
|
559
|
+
* delegations — the narration design expects the user to talk while delegated work runs.
|
|
560
|
+
* Calls the `CancelRealtimeSessionTool` mutation (ownership-gated server-side); when the
|
|
561
|
+
* server reports it aborted the run, the card is flipped immediately to a FAILED
|
|
562
|
+
* "Cancelled by user" result and the eventual late result from the aborted run is
|
|
563
|
+
* suppressed (see {@link emitDelegationResult}).
|
|
564
|
+
*
|
|
565
|
+
* @returns `true` when the server aborted the in-flight run; `false` when there was
|
|
566
|
+
* nothing to cancel (the work finished first — its real result is already racing in)
|
|
567
|
+
* or the mutation failed (logged, never thrown).
|
|
568
|
+
*/
|
|
569
|
+
CancelDelegation(callId: string): Promise<boolean>;
|
|
570
|
+
/**
|
|
571
|
+
* Cancels EVERY in-flight delegated tool call for the active session (callId-less form of
|
|
572
|
+
* the `CancelRealtimeSessionTool` mutation). Exposed for host policies that need a
|
|
573
|
+
* sweep-cancel (e.g. an explicit "stop everything" affordance) — NOT wired to barge-in,
|
|
574
|
+
* by the same deliberate policy as {@link CancelDelegation}.
|
|
575
|
+
*
|
|
576
|
+
* @returns The number of in-flight runs the server aborted (0 when nothing was tracked
|
|
577
|
+
* in flight client-side, nothing was in flight server-side, or the mutation failed).
|
|
578
|
+
*/
|
|
579
|
+
CancelInFlightDelegations(): Promise<number>;
|
|
580
|
+
/** Flips a cancelled call's card to the failed "Cancelled by user" result and suppresses the late real result. */
|
|
581
|
+
private surfaceUserCancellation;
|
|
582
|
+
/**
|
|
583
|
+
* Calls the `CancelRealtimeSessionTool` mutation and unwraps its structured
|
|
584
|
+
* `{ AbortedCount, Success, ErrorMessage }` result. Returns the aborted count —
|
|
585
|
+
* 0 on a structured failure or a thrown transport error (both logged, never thrown).
|
|
586
|
+
*/
|
|
587
|
+
private cancelSessionTool;
|
|
588
|
+
/** Calls the `StartRealtimeClientSession` mutation to obtain an ephemeral token + config. */
|
|
589
|
+
private mintSession;
|
|
590
|
+
/** Calls the `ExecuteRealtimeSessionTool` mutation; returns the ResultJson string. */
|
|
591
|
+
private executeSessionTool;
|
|
592
|
+
/**
|
|
593
|
+
* Persists an interactive channel's state of record (e.g. the whiteboard's serialized scene)
|
|
594
|
+
* onto the session's `MJ: AI Agent Session Channels` row via `SaveSessionChannelState`.
|
|
595
|
+
*
|
|
596
|
+
* @param channelName The channel definition name (e.g. `'Whiteboard'`).
|
|
597
|
+
* @param stateJson The serialized channel state.
|
|
598
|
+
* @param agentSessionId Optional EXPLICIT session id. The debounced channel-save pipeline
|
|
599
|
+
* captures the id while the session is live and passes it here, so the final teardown
|
|
600
|
+
* flush still lands on the just-closed session. Falls back to the active session's id;
|
|
601
|
+
* returns `false` when neither is available.
|
|
602
|
+
* @returns Whether the server persisted the state. Failures are logged, never thrown — channel
|
|
603
|
+
* persistence is best-effort and must not disturb the live call.
|
|
604
|
+
*/
|
|
605
|
+
SaveChannelState(channelName: string, stateJson: string, agentSessionId?: string | null): Promise<boolean>;
|
|
606
|
+
/**
|
|
607
|
+
* Relays a final transcript turn to MJ via `RelayRealtimeTranscript`.
|
|
608
|
+
* @param replacesPrevious CORRECTION semantics: the server updates the session's most
|
|
609
|
+
* recent persisted turn of this role IN PLACE instead of appending (e.g. ElevenLabs'
|
|
610
|
+
* post-barge-in `agent_response_correction`).
|
|
611
|
+
*/
|
|
612
|
+
private relayTranscript;
|
|
613
|
+
/**
|
|
614
|
+
* Relays a co-agent CHANNEL tool-call turn (browser_ / Whiteboard_ etc.) to the session's run for
|
|
615
|
+
* observability via `RelayRealtimeToolTurn` — so the co-agent's AIPromptRun shows what it DID, not
|
|
616
|
+
* just what it said. Run-only by design: deliberately NOT a `ConversationDetail` turn, so the chat
|
|
617
|
+
* thread stays speech-only. Best-effort — a failed relay never disturbs the live call.
|
|
618
|
+
*/
|
|
619
|
+
private relayToolTurn;
|
|
620
|
+
/**
|
|
621
|
+
* Accumulates one usage DELTA from the realtime client (per-response token counts —
|
|
622
|
+
* the `OnUsage` contract shape) and schedules the debounced relay. Negative / non-finite
|
|
623
|
+
* values are clamped to 0; an all-zero delta is dropped without arming the timer.
|
|
624
|
+
*/
|
|
625
|
+
private onUsageDelta;
|
|
626
|
+
/** Clamps a driver-reported token delta: undefined / negative / non-finite become 0. */
|
|
627
|
+
private clampUsageDelta;
|
|
628
|
+
/**
|
|
629
|
+
* Relays the accumulated usage deltas to the server via `RelayRealtimeUsage` (which
|
|
630
|
+
* accumulates them onto the co-agent `AIPromptRun`). Best-effort: a failed relay
|
|
631
|
+
* re-accumulates the captured deltas so the next debounce / teardown flush retries —
|
|
632
|
+
* usage telemetry must never disturb the live call.
|
|
633
|
+
*
|
|
634
|
+
* @param agentSessionId Optional EXPLICIT session id (the teardown flush runs while the
|
|
635
|
+
* live id is still set, but accepts it as a parameter for symmetry with channel saves).
|
|
636
|
+
*/
|
|
637
|
+
private flushPendingUsage;
|
|
638
|
+
/** Cancels the pending debounced usage flush and zeroes the accumulators (teardown tail). */
|
|
639
|
+
private resetUsageRelay;
|
|
640
|
+
/**
|
|
641
|
+
* Subscribes to the server's push-status topic (scoped by the GraphQL transport
|
|
642
|
+
* sessionId) to receive delegated-run progress for the active voice session.
|
|
643
|
+
* Each matching event is surfaced on {@link DelegationProgress$} and narrated.
|
|
644
|
+
*/
|
|
645
|
+
private subscribeDelegationProgress;
|
|
646
|
+
/**
|
|
647
|
+
* Parses one push-status message and routes it: a Remote Browser screencast frame goes to the active
|
|
648
|
+
* Remote Browser channel's canvas; a delegation-progress event is dispatched + narrated. Other shapes
|
|
649
|
+
* (normal agent-run streams) are ignored. Screencast frames are checked FIRST and short-circuit, so the
|
|
650
|
+
* delegation path is untouched.
|
|
651
|
+
*/
|
|
652
|
+
private onDelegationStatusMessage;
|
|
653
|
+
/**
|
|
654
|
+
* Parses a push-status message and returns it only when it's a Remote Browser screencast frame for the
|
|
655
|
+
* active session — otherwise `null` (ignored, so delegation progress falls through). Matched by
|
|
656
|
+
* `resolver` + `type`, then scoped to THIS session by `agentSessionID`.
|
|
657
|
+
*/
|
|
658
|
+
private parseScreencastFrame;
|
|
659
|
+
/**
|
|
660
|
+
* Forwards a screencast frame to the active Remote Browser channel plugin so it paints the frame on its
|
|
661
|
+
* surface canvas. The plugin is found among the session's active channels by its `ChannelName`; located
|
|
662
|
+
* via a structural guard so the service stays decoupled from the concrete channel class.
|
|
663
|
+
*/
|
|
664
|
+
private routeScreencastFrame;
|
|
665
|
+
/** Structural guard: true when the channel exposes an `OnScreencastFrame(dataBase64)` method. */
|
|
666
|
+
private hasOnScreencastFrame;
|
|
667
|
+
/**
|
|
668
|
+
* Parses a push-status message and returns it only when it's a Remote Browser audio chunk for the active
|
|
669
|
+
* session — otherwise `null` (ignored). Matched by `resolver` + `type`, then scoped to THIS session by
|
|
670
|
+
* `agentSessionID`.
|
|
671
|
+
*/
|
|
672
|
+
private parseAudioChunk;
|
|
673
|
+
/**
|
|
674
|
+
* Forwards an audio chunk to the active Remote Browser channel plugin so it plays the chunk through its
|
|
675
|
+
* client-side audio player. The plugin is found among the session's active channels by its `ChannelName`;
|
|
676
|
+
* located via a structural guard so the service stays decoupled from the concrete channel class.
|
|
677
|
+
*/
|
|
678
|
+
private routeAudioChunk;
|
|
679
|
+
/** Structural guard: true when the channel exposes an `OnAudioChunk(chunk)` method. */
|
|
680
|
+
private hasOnAudioChunk;
|
|
681
|
+
/**
|
|
682
|
+
* Parses a push-status message and returns it only when it's a delegation
|
|
683
|
+
* progress event for the active voice session — otherwise `null` (ignored).
|
|
684
|
+
*/
|
|
685
|
+
private parseProgress;
|
|
686
|
+
/** Emits the progress to the UI observable and feeds it to the realtime model. */
|
|
687
|
+
private dispatchProgress;
|
|
688
|
+
/**
|
|
689
|
+
* Injects the progress into the model's context as a background note every time,
|
|
690
|
+
* then (throttled) asks the model to briefly voice a reassuring update so the
|
|
691
|
+
* background work doesn't sit in silence — without chattering or interrupting.
|
|
692
|
+
*/
|
|
693
|
+
private narrateProgress;
|
|
694
|
+
/** Adds a progress message to the digest buffer (deduped, capped, oldest-first). */
|
|
695
|
+
private bufferNarrationMessage;
|
|
696
|
+
/**
|
|
697
|
+
* ms until the next spoken update is allowed. Two constraints, BOTH enforced:
|
|
698
|
+
* - first update of a burst: no earlier than ~5s after the burst started;
|
|
699
|
+
* - ~8s since the last spoken update, SESSION-global — so sequential tool calls
|
|
700
|
+
* that reset the burst can never narrate faster than the interval.
|
|
701
|
+
*/
|
|
702
|
+
private nextNarrationDelayMs;
|
|
703
|
+
/**
|
|
704
|
+
* Speaks the aggregated progress digest — unless the work already finished (buffer
|
|
705
|
+
* cancelled) or the model is busy / audio is still playing, in which case it retries
|
|
706
|
+
* shortly with the buffer intact (work is still running, so the update stays relevant).
|
|
707
|
+
*/
|
|
708
|
+
private fireDeferredNarration;
|
|
709
|
+
/** Cancels any deferred narration — the result is about to be spoken, so it's moot. */
|
|
710
|
+
private cancelPendingNarration;
|
|
711
|
+
/**
|
|
712
|
+
* Builds the one-off instructions for a short spoken update that conveys THIS specific
|
|
713
|
+
* progress message naturally — strictly first person, since the co-agent owns the work.
|
|
714
|
+
* The wording is DB-driven: the server-resolved `Realtime Co-Agent - Progress Narration`
|
|
715
|
+
* template (substituting `{{ progressMessage }}`) when present, otherwise the built-in
|
|
716
|
+
* fallback so deployments that haven't synced the prompt behave exactly as before.
|
|
717
|
+
* The client tags the resulting turn as narration, keeping it EPHEMERAL — surfaced on
|
|
718
|
+
* {@link DelegationNarration$} instead of becoming a caption / persisted ConversationDetail.
|
|
719
|
+
*/
|
|
720
|
+
private buildNarrationInstructions;
|
|
721
|
+
/** Tears down the delegation progress subscription and resets the narration throttle. */
|
|
722
|
+
private teardownDelegationProgress;
|
|
723
|
+
/**
|
|
724
|
+
* Tears down all client resources and (optionally) closes the server session.
|
|
725
|
+
* @param closeServerSession when true, calls `CloseAgentSession` on the server.
|
|
726
|
+
*/
|
|
727
|
+
private teardown;
|
|
728
|
+
/** Calls the `CloseAgentSession` mutation (provisioned in P4b). */
|
|
729
|
+
private closeServerSession;
|
|
730
|
+
/** Pushes a caption onto the live list (immutable update for change detection). */
|
|
731
|
+
private appendCaption;
|
|
732
|
+
/** Resets reactive + internal state at the start of a session. */
|
|
733
|
+
private resetState;
|
|
734
|
+
/** The GraphQL provider used for relay mutations. */
|
|
735
|
+
private gql;
|
|
736
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RealtimeSessionService, never>;
|
|
737
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RealtimeSessionService>;
|
|
738
|
+
}
|
|
739
|
+
//# sourceMappingURL=realtime-session.service.d.ts.map
|