@memberjunction/ng-conversations 6.2.0-edge.2 → 6.2.0-edge.4
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 +4 -7
- package/dist/lib/components/collection/collection-view.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-view.component.js +1 -0
- package/dist/lib/components/collection/collection-view.component.js.map +1 -1
- package/dist/lib/components/composer/ai-composer.component.d.ts +14 -2
- package/dist/lib/components/composer/ai-composer.component.d.ts.map +1 -1
- package/dist/lib/components/composer/ai-composer.component.js +35 -4
- package/dist/lib/components/composer/ai-composer.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +632 -55
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +2748 -624
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/conversation/forks-popover.component.d.ts +37 -0
- package/dist/lib/components/conversation/forks-popover.component.d.ts.map +1 -0
- package/dist/lib/components/conversation/forks-popover.component.js +164 -0
- package/dist/lib/components/conversation/forks-popover.component.js.map +1 -0
- package/dist/lib/components/export/export-modal.component.d.ts +7 -2
- package/dist/lib/components/export/export-modal.component.d.ts.map +1 -1
- package/dist/lib/components/export/export-modal.component.js +16 -3
- package/dist/lib/components/export/export-modal.component.js.map +1 -1
- package/dist/lib/components/message/conversation-message-rating.component.d.ts.map +1 -1
- package/dist/lib/components/message/conversation-message-rating.component.js +11 -9
- package/dist/lib/components/message/conversation-message-rating.component.js.map +1 -1
- package/dist/lib/components/message/message-input.component.d.ts +121 -11
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input.component.js +307 -106
- package/dist/lib/components/message/message-input.component.js.map +1 -1
- package/dist/lib/components/message/message-item.component.d.ts +178 -5
- package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-item.component.js +919 -306
- package/dist/lib/components/message/message-item.component.js.map +1 -1
- package/dist/lib/components/message/message-list.component.d.ts +92 -21
- package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-list.component.js +337 -52
- package/dist/lib/components/message/message-list.component.js.map +1 -1
- package/dist/lib/components/realtime/avatar/realtime-avatar-channel.d.ts +34 -0
- package/dist/lib/components/realtime/avatar/realtime-avatar-channel.d.ts.map +1 -0
- package/dist/lib/components/realtime/avatar/realtime-avatar-channel.js +75 -0
- package/dist/lib/components/realtime/avatar/realtime-avatar-channel.js.map +1 -0
- package/dist/lib/components/realtime/avatar/realtime-avatar-surface.component.d.ts +80 -0
- package/dist/lib/components/realtime/avatar/realtime-avatar-surface.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/avatar/realtime-avatar-surface.component.js +202 -0
- package/dist/lib/components/realtime/avatar/realtime-avatar-surface.component.js.map +1 -0
- package/dist/lib/components/realtime/capture/realtime-camera-check-card.component.d.ts +45 -0
- package/dist/lib/components/realtime/capture/realtime-camera-check-card.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/capture/realtime-camera-check-card.component.js +123 -0
- package/dist/lib/components/realtime/capture/realtime-camera-check-card.component.js.map +1 -0
- package/dist/lib/components/realtime/capture/realtime-capture-channel.d.ts +90 -0
- package/dist/lib/components/realtime/capture/realtime-capture-channel.d.ts.map +1 -0
- package/dist/lib/components/realtime/capture/realtime-capture-channel.js +223 -0
- package/dist/lib/components/realtime/capture/realtime-capture-channel.js.map +1 -0
- package/dist/lib/components/realtime/capture/realtime-capture-model.d.ts +98 -0
- package/dist/lib/components/realtime/capture/realtime-capture-model.d.ts.map +1 -0
- package/dist/lib/components/realtime/capture/realtime-capture-model.js +161 -0
- package/dist/lib/components/realtime/capture/realtime-capture-model.js.map +1 -0
- package/dist/lib/components/realtime/capture/realtime-capture-surface.component.d.ts +48 -0
- package/dist/lib/components/realtime/capture/realtime-capture-surface.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/capture/realtime-capture-surface.component.js +205 -0
- package/dist/lib/components/realtime/capture/realtime-capture-surface.component.js.map +1 -0
- package/dist/lib/components/realtime/channels/client-context-channel.d.ts +19 -2
- package/dist/lib/components/realtime/channels/client-context-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.js +83 -9
- package/dist/lib/components/realtime/channels/client-context-channel.js.map +1 -1
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts +30 -9
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js +78 -14
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js.map +1 -1
- package/dist/lib/components/realtime/identity-verification/identity-verification-channel.d.ts +71 -0
- package/dist/lib/components/realtime/identity-verification/identity-verification-channel.d.ts.map +1 -0
- package/dist/lib/components/realtime/identity-verification/identity-verification-channel.js +259 -0
- package/dist/lib/components/realtime/identity-verification/identity-verification-channel.js.map +1 -0
- package/dist/lib/components/realtime/identity-verification/identity-verification-model.d.ts +129 -0
- package/dist/lib/components/realtime/identity-verification/identity-verification-model.d.ts.map +1 -0
- package/dist/lib/components/realtime/identity-verification/identity-verification-model.js +373 -0
- package/dist/lib/components/realtime/identity-verification/identity-verification-model.js.map +1 -0
- package/dist/lib/components/realtime/identity-verification/identity-verification-surface.component.d.ts +77 -0
- package/dist/lib/components/realtime/identity-verification/identity-verification-surface.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/identity-verification/identity-verification-surface.component.js +420 -0
- package/dist/lib/components/realtime/identity-verification/identity-verification-surface.component.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/component-contract.d.ts +83 -0
- package/dist/lib/components/realtime/interactive-component/component-contract.d.ts.map +1 -0
- package/dist/lib/components/realtime/interactive-component/component-contract.js +292 -0
- package/dist/lib/components/realtime/interactive-component/component-contract.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/component-data-state.d.ts +39 -0
- package/dist/lib/components/realtime/interactive-component/component-data-state.d.ts.map +1 -0
- package/dist/lib/components/realtime/interactive-component/component-data-state.js +152 -0
- package/dist/lib/components/realtime/interactive-component/component-data-state.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/component-instance-engine.d.ts +109 -0
- package/dist/lib/components/realtime/interactive-component/component-instance-engine.d.ts.map +1 -0
- package/dist/lib/components/realtime/interactive-component/component-instance-engine.js +146 -0
- package/dist/lib/components/realtime/interactive-component/component-instance-engine.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/component-spec-content.d.ts +19 -0
- package/dist/lib/components/realtime/interactive-component/component-spec-content.d.ts.map +1 -0
- package/dist/lib/components/realtime/interactive-component/component-spec-content.js +39 -0
- package/dist/lib/components/realtime/interactive-component/component-spec-content.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts +183 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts.map +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js +761 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-config.d.ts +25 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-config.d.ts.map +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-config.js +57 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-config.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-host.component.d.ts +40 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-host.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-host.component.js +97 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-host.component.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-types.d.ts +144 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-types.d.ts.map +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-types.js +57 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-types.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/react-component-handle.d.ts +36 -0
- package/dist/lib/components/realtime/interactive-component/react-component-handle.d.ts.map +1 -0
- package/dist/lib/components/realtime/interactive-component/react-component-handle.js +55 -0
- package/dist/lib/components/realtime/interactive-component/react-component-handle.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/realtime-interactive-component-surface.component.d.ts +55 -0
- package/dist/lib/components/realtime/interactive-component/realtime-interactive-component-surface.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/interactive-component/realtime-interactive-component-surface.component.js +210 -0
- package/dist/lib/components/realtime/interactive-component/realtime-interactive-component-surface.component.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/run-view-component-artifact-source.d.ts +32 -0
- package/dist/lib/components/realtime/interactive-component/run-view-component-artifact-source.d.ts.map +1 -0
- package/dist/lib/components/realtime/interactive-component/run-view-component-artifact-source.js +90 -0
- package/dist/lib/components/realtime/interactive-component/run-view-component-artifact-source.js.map +1 -0
- package/dist/lib/components/realtime/media/media-channel.d.ts +7 -0
- package/dist/lib/components/realtime/media/media-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/media/media-channel.js +28 -1
- package/dist/lib/components/realtime/media/media-channel.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts +8 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.js +89 -71
- package/dist/lib/components/realtime/realtime-agent-banner.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-orb.component.d.ts +21 -0
- package/dist/lib/components/realtime/realtime-agent-orb.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-agent-orb.component.js +49 -0
- package/dist/lib/components/realtime/realtime-agent-orb.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts +44 -11
- package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-picker.component.js +162 -50
- package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-audio-visuals.d.ts +8 -2
- package/dist/lib/components/realtime/realtime-audio-visuals.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-audio-visuals.js +14 -18
- package/dist/lib/components/realtime/realtime-audio-visuals.js.map +1 -1
- package/dist/lib/components/realtime/realtime-composer.component.d.ts +42 -2
- package/dist/lib/components/realtime/realtime-composer.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-composer.component.js +137 -102
- package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-perception-chip.component.d.ts +71 -0
- package/dist/lib/components/realtime/realtime-perception-chip.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-perception-chip.component.js +221 -0
- package/dist/lib/components/realtime/realtime-perception-chip.component.js.map +1 -0
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +264 -22
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.js +851 -135
- package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-placement-prefs.d.ts +14 -0
- package/dist/lib/components/realtime/realtime-surface-placement-prefs.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-surface-placement-prefs.js +14 -0
- package/dist/lib/components/realtime/realtime-surface-placement-prefs.js.map +1 -0
- package/dist/lib/components/realtime/realtime-surface-stage.model.d.ts +74 -0
- package/dist/lib/components/realtime/realtime-surface-stage.model.d.ts.map +1 -0
- package/dist/lib/components/realtime/realtime-surface-stage.model.js +171 -0
- package/dist/lib/components/realtime/realtime-surface-stage.model.js.map +1 -0
- package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts +71 -13
- package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.component.js +232 -73
- package/dist/lib/components/realtime/realtime-surface-tabs.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +5 -0
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js +8 -0
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -1
- package/dist/lib/components/realtime/realtime-ui-config.d.ts +12 -2
- package/dist/lib/components/realtime/realtime-ui-config.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-ui-config.js +5 -1
- package/dist/lib/components/realtime/realtime-ui-config.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +10 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +42 -2
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts +20 -3
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js +44 -10
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts +28 -44
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +76 -162
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -1
- package/dist/lib/components/search/search-panel.component.d.ts +2 -0
- package/dist/lib/components/search/search-panel.component.d.ts.map +1 -1
- package/dist/lib/components/search/search-panel.component.js +25 -12
- package/dist/lib/components/search/search-panel.component.js.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts +22 -31
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.js +50 -63
- package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
- package/dist/lib/conversations.module.d.ts +30 -29
- package/dist/lib/conversations.module.d.ts.map +1 -1
- package/dist/lib/conversations.module.js +27 -5
- package/dist/lib/conversations.module.js.map +1 -1
- package/dist/lib/events/chat-events.d.ts +25 -0
- package/dist/lib/events/chat-events.d.ts.map +1 -1
- package/dist/lib/events/chat-events.js +36 -0
- package/dist/lib/events/chat-events.js.map +1 -1
- package/dist/lib/models/agent-turn.model.d.ts +5 -0
- package/dist/lib/models/agent-turn.model.d.ts.map +1 -1
- package/dist/lib/models/agent-turn.model.js.map +1 -1
- package/dist/lib/services/agent-state.service.d.ts +34 -8
- package/dist/lib/services/agent-state.service.d.ts.map +1 -1
- package/dist/lib/services/agent-state.service.js +82 -29
- package/dist/lib/services/agent-state.service.js.map +1 -1
- package/dist/lib/services/artifact-state.service.d.ts +0 -9
- package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-state.service.js +1 -32
- package/dist/lib/services/artifact-state.service.js.map +1 -1
- package/dist/lib/services/browser-realtime-media-host.d.ts +12 -0
- package/dist/lib/services/browser-realtime-media-host.d.ts.map +1 -1
- package/dist/lib/services/browser-realtime-media-host.js +19 -0
- package/dist/lib/services/browser-realtime-media-host.js.map +1 -1
- package/dist/lib/services/browser-recording-unload-guard.d.ts +30 -0
- package/dist/lib/services/browser-recording-unload-guard.d.ts.map +1 -0
- package/dist/lib/services/browser-recording-unload-guard.js +43 -0
- package/dist/lib/services/browser-recording-unload-guard.js.map +1 -0
- package/dist/lib/services/conversation-agent.service.d.ts +35 -11
- package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-agent.service.js +65 -20
- package/dist/lib/services/conversation-agent.service.js.map +1 -1
- package/dist/lib/services/conversation-detail-window.store.d.ts +22 -4
- package/dist/lib/services/conversation-detail-window.store.d.ts.map +1 -1
- package/dist/lib/services/conversation-detail-window.store.js +50 -9
- package/dist/lib/services/conversation-detail-window.store.js.map +1 -1
- package/dist/lib/services/conversation-naming.d.ts +72 -22
- package/dist/lib/services/conversation-naming.d.ts.map +1 -1
- package/dist/lib/services/conversation-naming.js +84 -10
- package/dist/lib/services/conversation-naming.js.map +1 -1
- package/dist/lib/services/data-cache.service.d.ts +13 -5
- package/dist/lib/services/data-cache.service.d.ts.map +1 -1
- package/dist/lib/services/data-cache.service.js +39 -19
- package/dist/lib/services/data-cache.service.js.map +1 -1
- package/dist/lib/services/export.service.d.ts +26 -9
- package/dist/lib/services/export.service.d.ts.map +1 -1
- package/dist/lib/services/export.service.js +61 -18
- package/dist/lib/services/export.service.js.map +1 -1
- package/dist/lib/services/realtime-audio-recorder.d.ts +33 -5
- package/dist/lib/services/realtime-audio-recorder.d.ts.map +1 -1
- package/dist/lib/services/realtime-audio-recorder.js +71 -11
- package/dist/lib/services/realtime-audio-recorder.js.map +1 -1
- package/dist/lib/services/realtime-pairing.d.ts +10 -5
- package/dist/lib/services/realtime-pairing.d.ts.map +1 -1
- package/dist/lib/services/realtime-pairing.js +15 -6
- package/dist/lib/services/realtime-pairing.js.map +1 -1
- package/dist/lib/services/realtime-session.service.d.ts +3 -2
- package/dist/lib/services/realtime-session.service.d.ts.map +1 -1
- package/dist/lib/services/realtime-session.service.js +7 -2
- package/dist/lib/services/realtime-session.service.js.map +1 -1
- package/dist/lib/services/search.service.d.ts +7 -2
- package/dist/lib/services/search.service.d.ts.map +1 -1
- package/dist/lib/services/search.service.js +13 -4
- package/dist/lib/services/search.service.js.map +1 -1
- package/dist/lib/util/frame-zone.d.ts +10 -0
- package/dist/lib/util/frame-zone.d.ts.map +1 -0
- package/dist/lib/util/frame-zone.js +10 -0
- package/dist/lib/util/frame-zone.js.map +1 -0
- package/dist/lib/utils/conversation-branching.d.ts +4 -0
- package/dist/lib/utils/conversation-branching.d.ts.map +1 -0
- package/dist/lib/utils/conversation-branching.js +5 -0
- package/dist/lib/utils/conversation-branching.js.map +1 -0
- package/dist/lib/utils/conversation-forks.d.ts +315 -0
- package/dist/lib/utils/conversation-forks.d.ts.map +1 -0
- package/dist/lib/utils/conversation-forks.js +456 -0
- package/dist/lib/utils/conversation-forks.js.map +1 -0
- package/dist/public-api.d.ts +23 -1
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +30 -1
- package/dist/public-api.js.map +1 -1
- package/package.json +37 -32
- package/dist/lib/components/thread/thread-panel.component.d.ts +0 -126
- package/dist/lib/components/thread/thread-panel.component.d.ts.map +0 -1
- package/dist/lib/components/thread/thread-panel.component.js +0 -440
- package/dist/lib/components/thread/thread-panel.component.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-data-state.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/interactive-component/component-data-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAYH,wEAAwE;AACxE,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,oDAAoD;AACpD,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,kEAAkE;AAClE,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,yCAAyC;AACzC,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,mEAAmE;AACnE,MAAM,OAAO,GAAG,WAAW,CAAC;AAE5B,uDAAuD;AACvD,SAAS,QAAQ,CAAC,KAAc;IAC5B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc,EAAE,QAAgB,CAAC,EAAE,OAAwB,IAAI,OAAO,EAAE;IAClG,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,QAAQ,OAAO,KAAK,EAAE,CAAC;QACnB,KAAK,QAAQ;YAC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C,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,IAAI,OAAO,GAAG,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACxC,OAAO,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAC5B,OAAO,GAAG,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QACnD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,iCAAiC,MAAM,CAAC,QAAQ,iCAAiC,EAAE,CAAC;IACxH,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC","sourcesContent":["/**\n * @fileoverview Bounds a component's data state before it is described to the model.\n *\n * A component's `getCurrentDataState()` can hold thousands of rows. A perception note that carried them all\n * would flood the model's context and, when the component shows private data, leak far more than the model\n * needs to answer \"what is the user looking at\". This turns an arbitrary data state into a small JSON summary:\n * the per-table row count and columns always, and only the first `MaxRows` rows; long strings are clipped;\n * the whole thing is held under a character budget.\n *\n * The input is whatever the component returned, so it is treated as untrusted: it may be cyclic, hold functions,\n * dates or class instances. The output is always plain JSON.\n *\n * @module @memberjunction/ng-conversations\n */\n\nimport type { JSONObject, JSONValue } from '@memberjunction/ai';\n\n/** Limits applied to a data state. */\nexport interface DataStateLimits {\n /** The most rows kept per table. */\n MaxRows: number;\n /** The most characters of the serialized summary; beyond it rows are dropped until it fits. */\n MaxChars: number;\n}\n\n/** The deepest nesting kept; deeper values are replaced by a marker. */\nconst MAX_DEPTH = 5;\n/** The longest string kept before it is clipped. */\nconst MAX_STRING_CHARS = 200;\n/** The most keys kept per object or items per non-table array. */\nconst MAX_BREADTH = 30;\n/** The most columns listed per table. */\nconst MAX_COLUMNS = 40;\n\n/** Marker for a value the summary could not or would not carry. */\nconst OMITTED = '[omitted]';\n\n/** True for a non-null object that is not an array. */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\n/**\n * Converts one arbitrary value into JSON, bounded in depth, breadth and string length.\n * Functions and symbols become a marker, dates their ISO string, cycles a marker.\n */\nexport function ToBoundedJson(value: unknown, depth: number = 0, seen: WeakSet<object> = new WeakSet()): JSONValue {\n if (value === null || value === undefined) {\n return null;\n }\n switch (typeof value) {\n case 'string':\n return value.length > MAX_STRING_CHARS ? `${value.slice(0, MAX_STRING_CHARS)}… (${value.length} chars)` : value;\n case 'number':\n return Number.isFinite(value) ? value : null;\n case 'boolean':\n return value;\n case 'bigint':\n return value.toString();\n case 'function':\n case 'symbol':\n return OMITTED;\n default:\n break;\n }\n return objectToBoundedJson(value as object, depth, seen);\n}\n\n/** The object half of {@link ToBoundedJson}. */\nfunction objectToBoundedJson(value: object, depth: number, seen: WeakSet<object>): JSONValue {\n if (value instanceof Date) {\n return Number.isNaN(value.getTime()) ? null : value.toISOString();\n }\n if (seen.has(value)) {\n return '[circular]';\n }\n if (depth >= MAX_DEPTH) {\n return '[too deep]';\n }\n seen.add(value);\n try {\n if (Array.isArray(value)) {\n const items = value.slice(0, MAX_BREADTH).map((item) => ToBoundedJson(item, depth + 1, seen));\n return value.length > MAX_BREADTH ? [...items, `… ${value.length - MAX_BREADTH} more`] : items;\n }\n const out: JSONObject = {};\n for (const key of Object.keys(value).slice(0, MAX_BREADTH)) {\n // Component state is untrusted; never copy a key that would reach Object.prototype.\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n continue;\n }\n out[key] = ToBoundedJson((value as Record<string, unknown>)[key], depth + 1, seen);\n }\n return out;\n } finally {\n seen.delete(value);\n }\n}\n\n/** Summarizes one table-shaped entry (`{ name, columns, rows }`). */\nfunction summarizeTable(table: unknown, index: number, maxRows: number): JSONObject {\n if (!isRecord(table)) {\n return { name: `table ${index + 1}`, rowCount: 0 };\n }\n const rows = Array.isArray(table['rows']) ? (table['rows'] as unknown[]) : [];\n const columns = Array.isArray(table['columns']) ? (table['columns'] as unknown[]) : [];\n const columnNames = columns\n .map((column) => (typeof column === 'string' ? column : isRecord(column) && typeof column['name'] === 'string' ? column['name'] : null))\n .filter((name): name is string => name !== null)\n .slice(0, MAX_COLUMNS);\n const summary: JSONObject = {\n name: typeof table['name'] === 'string' ? table['name'] : `table ${index + 1}`,\n rowCount: rows.length,\n columns: columnNames,\n rows: rows.slice(0, maxRows).map((row) => ToBoundedJson(row, 1)),\n };\n if (rows.length > maxRows) {\n summary['rowsOmitted'] = rows.length - maxRows;\n }\n return summary;\n}\n\n/** Builds the summary with at most `maxRows` rows per table. */\nfunction buildSummary(state: Record<string, unknown>, maxRows: number): JSONObject {\n const summary: JSONObject = {};\n for (const key of ['title', 'activeTab', 'searchText', 'interpretation'] as const) {\n const value = state[key];\n if (typeof value === 'string' && value.length > 0) {\n summary[key] = ToBoundedJson(value);\n }\n }\n if (Array.isArray(state['drillPath']) && state['drillPath'].length > 0) {\n summary['drillPath'] = ToBoundedJson(state['drillPath']);\n }\n if (Array.isArray(state['tables'])) {\n summary['tables'] = (state['tables'] as unknown[]).slice(0, MAX_BREADTH).map((table, i) => summarizeTable(table, i, maxRows));\n }\n if (isRecord(state['custom']) && Object.keys(state['custom']).length > 0) {\n summary['custom'] = ToBoundedJson(state['custom']);\n }\n return summary;\n}\n\n/**\n * Summarizes a component's data state for the model.\n *\n * The result is plain JSON no larger than `limits.MaxChars`: when the first attempt is over budget the per-table\n * row cap is halved until it fits, down to zero rows (counts and columns only).\n *\n * @param state The value `getCurrentDataState()` returned (a `DataSnapshot` or anything else), or nothing.\n * @param limits The row and size caps.\n * @returns The summary, or `null` when the component has no data state.\n */\nexport function SummarizeDataState(state: object | null | undefined, limits: DataStateLimits): JSONObject | null {\n if (!isRecord(state)) {\n return null;\n }\n let rows = Math.max(0, Math.floor(limits.MaxRows));\n let summary = buildSummary(state, rows);\n while (rows > 0 && JSON.stringify(summary).length > limits.MaxChars) {\n rows = Math.floor(rows / 2);\n summary = buildSummary(state, rows);\n }\n if (JSON.stringify(summary).length > limits.MaxChars) {\n return { truncated: true, note: `The data state is larger than ${limits.MaxChars} characters; ask for specifics.` };\n }\n return summary;\n}\n"]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The Interactive Component channel's state of record: which components are open, which one the
|
|
3
|
+
* user is looking at, what version each shows, and the last thing each reported.
|
|
4
|
+
*
|
|
5
|
+
* Framework-free and synchronous. The channel mutates it; the Angular surface observes {@link ComponentInstanceEngine.Changed$}
|
|
6
|
+
* and renders it. Keeping it separate means the rules (the instance cap, "swapping a version keeps the instance")
|
|
7
|
+
* are tested without a browser and are the same whoever drives them.
|
|
8
|
+
*
|
|
9
|
+
* @module @memberjunction/ng-conversations
|
|
10
|
+
*/
|
|
11
|
+
import { Observable } from 'rxjs';
|
|
12
|
+
import type { JSONObject, JSONValue } from '@memberjunction/ai';
|
|
13
|
+
import { type ComponentContract } from './component-contract';
|
|
14
|
+
import type { IInteractiveComponentHandle, ResolvedComponentArtifact } from './interactive-component-types';
|
|
15
|
+
/** The last thing a component reported, kept so it can ride in the state the model perceives. */
|
|
16
|
+
export interface ComponentLastEvent {
|
|
17
|
+
/** The event type or state path. */
|
|
18
|
+
Type: string;
|
|
19
|
+
/** The (bounded) payload. */
|
|
20
|
+
Payload: JSONValue;
|
|
21
|
+
/** Monotonic per engine, so two identical events in a row still register as a change. */
|
|
22
|
+
Seq: number;
|
|
23
|
+
}
|
|
24
|
+
/** One open component. */
|
|
25
|
+
export interface ComponentInstanceRecord {
|
|
26
|
+
/** The instance id the agent addresses (`c1`, `c2`, ...). Stable for the life of the instance, across version swaps. */
|
|
27
|
+
readonly InstanceID: string;
|
|
28
|
+
/** The artifact version currently shown. */
|
|
29
|
+
Artifact: ResolvedComponentArtifact;
|
|
30
|
+
/** What the agent can do with it, derived from {@link Artifact}'s spec; re-derived on a version swap. */
|
|
31
|
+
Contract: ComponentContract;
|
|
32
|
+
/** The inputs it was opened with. */
|
|
33
|
+
Inputs: JSONObject;
|
|
34
|
+
/** The last event it reported, if any. */
|
|
35
|
+
LastEvent: ComponentLastEvent | null;
|
|
36
|
+
/** The live handle on the rendered component, once the surface has mounted it. */
|
|
37
|
+
Handle: IInteractiveComponentHandle | null;
|
|
38
|
+
}
|
|
39
|
+
/** What changed, for the surface to react to. */
|
|
40
|
+
export type ComponentInstanceChange = {
|
|
41
|
+
Kind: 'added';
|
|
42
|
+
InstanceID: string;
|
|
43
|
+
} | {
|
|
44
|
+
Kind: 'removed';
|
|
45
|
+
InstanceID: string;
|
|
46
|
+
} | {
|
|
47
|
+
Kind: 'version';
|
|
48
|
+
InstanceID: string;
|
|
49
|
+
} | {
|
|
50
|
+
Kind: 'active';
|
|
51
|
+
InstanceID: string | null;
|
|
52
|
+
} | {
|
|
53
|
+
Kind: 'event';
|
|
54
|
+
InstanceID: string;
|
|
55
|
+
};
|
|
56
|
+
/** Why an instance could not be added. */
|
|
57
|
+
export declare class InstanceLimitError extends Error {
|
|
58
|
+
readonly Limit: number;
|
|
59
|
+
/** @param Limit The configured cap. */
|
|
60
|
+
constructor(Limit: number);
|
|
61
|
+
}
|
|
62
|
+
/** The set of open components. */
|
|
63
|
+
export declare class ComponentInstanceEngine {
|
|
64
|
+
private maxInstances;
|
|
65
|
+
private readonly records;
|
|
66
|
+
private readonly changedSubject;
|
|
67
|
+
private activeId;
|
|
68
|
+
private instanceSeq;
|
|
69
|
+
private eventSeq;
|
|
70
|
+
/** @param maxInstances The most components that may be open at once. */
|
|
71
|
+
constructor(maxInstances: number);
|
|
72
|
+
/** Every change, as it happens. Completes at {@link Dispose}. */
|
|
73
|
+
readonly Changed$: Observable<ComponentInstanceChange>;
|
|
74
|
+
/** Updates the instance cap (the configuration is read after the engine is created). Open instances above a lowered cap stay open. */
|
|
75
|
+
SetMaxInstances(maxInstances: number): void;
|
|
76
|
+
/** The open components, in the order they were opened. */
|
|
77
|
+
get Instances(): readonly ComponentInstanceRecord[];
|
|
78
|
+
/** The id of the instance the user is looking at, or `null` when nothing is open. */
|
|
79
|
+
get ActiveID(): string | null;
|
|
80
|
+
/** The instance with this id, or `undefined`. */
|
|
81
|
+
Get(instanceId: string): ComponentInstanceRecord | undefined;
|
|
82
|
+
/** The instance showing a version of this artifact, or `undefined`. */
|
|
83
|
+
FindByArtifact(artifactId: string): ComponentInstanceRecord | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Opens a component and makes it the active one.
|
|
86
|
+
*
|
|
87
|
+
* @param artifact The loaded artifact version.
|
|
88
|
+
* @param inputs What the agent passed to seed it with.
|
|
89
|
+
* @throws {InstanceLimitError} When the cap is reached.
|
|
90
|
+
*/
|
|
91
|
+
Add(artifact: ResolvedComponentArtifact, inputs: JSONObject): ComponentInstanceRecord;
|
|
92
|
+
/** Closes an instance; the previous one in open order becomes active. Returns `false` when there is no such instance. */
|
|
93
|
+
Remove(instanceId: string): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Shows another version in an existing instance. The instance id, its inputs and its place in the open order are
|
|
96
|
+
* kept; only the artifact version (and what is derived from its spec) changes, and the old handle is dropped
|
|
97
|
+
* (the surface re-attaches one once the new version has initialized).
|
|
98
|
+
*/
|
|
99
|
+
SwapVersion(instanceId: string, artifact: ResolvedComponentArtifact): boolean;
|
|
100
|
+
/** Makes an instance the active one (or `null` for none). Returns `false` for an unknown id. */
|
|
101
|
+
SetActive(instanceId: string | null): boolean;
|
|
102
|
+
/** Attaches (or detaches, with `null`) the live handle on a rendered component. */
|
|
103
|
+
AttachHandle(instanceId: string, handle: IInteractiveComponentHandle | null): void;
|
|
104
|
+
/** Records what a component just reported. Returns `false` for an unknown instance. */
|
|
105
|
+
RecordEvent(instanceId: string, type: string, payload: JSONValue): boolean;
|
|
106
|
+
/** Closes every instance without emitting per-instance changes, and completes {@link Changed$}. */
|
|
107
|
+
Dispose(): void;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=component-instance-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-instance-engine.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/interactive-component/component-instance-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAW,MAAM,MAAM,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,KAAK,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE5G,iGAAiG;AACjG,MAAM,WAAW,kBAAkB;IAC/B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,OAAO,EAAE,SAAS,CAAC;IACnB,yFAAyF;IACzF,GAAG,EAAE,MAAM,CAAC;CACf;AAED,0BAA0B;AAC1B,MAAM,WAAW,uBAAuB;IACpC,wHAAwH;IACxH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,4CAA4C;IAC5C,QAAQ,EAAE,yBAAyB,CAAC;IACpC,yGAAyG;IACzG,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,qCAAqC;IACrC,MAAM,EAAE,UAAU,CAAC;IACnB,0CAA0C;IAC1C,SAAS,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACrC,kFAAkF;IAClF,MAAM,EAAE,2BAA2B,GAAG,IAAI,CAAC;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AM,GAAG,uBAAuB,GAAG,SAAS;IAI9E;;;;;;OAMG;IACI,GAAG,CAAC,QAAQ,EAAE,yBAAyB,EAAE,MAAM,EAAE,UAAU,GAAG,uBAAuB;IAkB5F,yHAAyH;IAClH,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAa1C;;;;OAIG;IACI,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,yBAAyB,GAAG,OAAO;IAapF,gGAAgG;IACzF,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAWpD,mFAAmF;IAC5E,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,2BAA2B,GAAG,IAAI,GAAG,IAAI;IAOzF,uFAAuF;IAChF,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO;IAUjF,mGAAmG;IAC5F,OAAO,IAAI,IAAI;CAKzB"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The Interactive Component channel's state of record: which components are open, which one the
|
|
3
|
+
* user is looking at, what version each shows, and the last thing each reported.
|
|
4
|
+
*
|
|
5
|
+
* Framework-free and synchronous. The channel mutates it; the Angular surface observes {@link ComponentInstanceEngine.Changed$}
|
|
6
|
+
* and renders it. Keeping it separate means the rules (the instance cap, "swapping a version keeps the instance")
|
|
7
|
+
* are tested without a browser and are the same whoever drives them.
|
|
8
|
+
*
|
|
9
|
+
* @module @memberjunction/ng-conversations
|
|
10
|
+
*/
|
|
11
|
+
import { Subject } from 'rxjs';
|
|
12
|
+
import { DeriveComponentContract } from './component-contract';
|
|
13
|
+
/** Why an instance could not be added. */
|
|
14
|
+
export class InstanceLimitError extends Error {
|
|
15
|
+
Limit;
|
|
16
|
+
/** @param Limit The configured cap. */
|
|
17
|
+
constructor(Limit) {
|
|
18
|
+
super(`At most ${Limit} component${Limit === 1 ? ' is' : 's are'} open at once. Close one first.`);
|
|
19
|
+
this.Limit = Limit;
|
|
20
|
+
this.name = 'InstanceLimitError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** The set of open components. */
|
|
24
|
+
export class ComponentInstanceEngine {
|
|
25
|
+
maxInstances;
|
|
26
|
+
records = new Map();
|
|
27
|
+
changedSubject = new Subject();
|
|
28
|
+
activeId = null;
|
|
29
|
+
instanceSeq = 0;
|
|
30
|
+
eventSeq = 0;
|
|
31
|
+
/** @param maxInstances The most components that may be open at once. */
|
|
32
|
+
constructor(maxInstances) {
|
|
33
|
+
this.maxInstances = maxInstances;
|
|
34
|
+
}
|
|
35
|
+
/** Every change, as it happens. Completes at {@link Dispose}. */
|
|
36
|
+
Changed$ = this.changedSubject.asObservable();
|
|
37
|
+
/** Updates the instance cap (the configuration is read after the engine is created). Open instances above a lowered cap stay open. */
|
|
38
|
+
SetMaxInstances(maxInstances) {
|
|
39
|
+
this.maxInstances = maxInstances;
|
|
40
|
+
}
|
|
41
|
+
/** The open components, in the order they were opened. */
|
|
42
|
+
get Instances() {
|
|
43
|
+
return [...this.records.values()];
|
|
44
|
+
}
|
|
45
|
+
/** The id of the instance the user is looking at, or `null` when nothing is open. */
|
|
46
|
+
get ActiveID() {
|
|
47
|
+
return this.activeId;
|
|
48
|
+
}
|
|
49
|
+
/** The instance with this id, or `undefined`. */
|
|
50
|
+
Get(instanceId) {
|
|
51
|
+
return this.records.get(instanceId);
|
|
52
|
+
}
|
|
53
|
+
/** The instance showing a version of this artifact, or `undefined`. */
|
|
54
|
+
FindByArtifact(artifactId) {
|
|
55
|
+
return this.Instances.find((r) => r.Artifact.ArtifactID.toLowerCase() === artifactId.toLowerCase());
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Opens a component and makes it the active one.
|
|
59
|
+
*
|
|
60
|
+
* @param artifact The loaded artifact version.
|
|
61
|
+
* @param inputs What the agent passed to seed it with.
|
|
62
|
+
* @throws {InstanceLimitError} When the cap is reached.
|
|
63
|
+
*/
|
|
64
|
+
Add(artifact, inputs) {
|
|
65
|
+
if (this.records.size >= this.maxInstances) {
|
|
66
|
+
throw new InstanceLimitError(this.maxInstances);
|
|
67
|
+
}
|
|
68
|
+
const record = {
|
|
69
|
+
InstanceID: `c${++this.instanceSeq}`,
|
|
70
|
+
Artifact: artifact,
|
|
71
|
+
Contract: DeriveComponentContract(artifact.Spec),
|
|
72
|
+
Inputs: inputs,
|
|
73
|
+
LastEvent: null,
|
|
74
|
+
Handle: null,
|
|
75
|
+
};
|
|
76
|
+
this.records.set(record.InstanceID, record);
|
|
77
|
+
this.changedSubject.next({ Kind: 'added', InstanceID: record.InstanceID });
|
|
78
|
+
this.SetActive(record.InstanceID);
|
|
79
|
+
return record;
|
|
80
|
+
}
|
|
81
|
+
/** Closes an instance; the previous one in open order becomes active. Returns `false` when there is no such instance. */
|
|
82
|
+
Remove(instanceId) {
|
|
83
|
+
if (!this.records.delete(instanceId)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
this.changedSubject.next({ Kind: 'removed', InstanceID: instanceId });
|
|
87
|
+
if (this.activeId === instanceId) {
|
|
88
|
+
const remaining = this.Instances;
|
|
89
|
+
this.activeId = null;
|
|
90
|
+
this.SetActive(remaining.length > 0 ? remaining[remaining.length - 1].InstanceID : null);
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Shows another version in an existing instance. The instance id, its inputs and its place in the open order are
|
|
96
|
+
* kept; only the artifact version (and what is derived from its spec) changes, and the old handle is dropped
|
|
97
|
+
* (the surface re-attaches one once the new version has initialized).
|
|
98
|
+
*/
|
|
99
|
+
SwapVersion(instanceId, artifact) {
|
|
100
|
+
const record = this.records.get(instanceId);
|
|
101
|
+
if (!record) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
record.Artifact = artifact;
|
|
105
|
+
record.Contract = DeriveComponentContract(artifact.Spec);
|
|
106
|
+
record.LastEvent = null;
|
|
107
|
+
record.Handle = null;
|
|
108
|
+
this.changedSubject.next({ Kind: 'version', InstanceID: instanceId });
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
/** Makes an instance the active one (or `null` for none). Returns `false` for an unknown id. */
|
|
112
|
+
SetActive(instanceId) {
|
|
113
|
+
if (instanceId !== null && !this.records.has(instanceId)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (this.activeId !== instanceId) {
|
|
117
|
+
this.activeId = instanceId;
|
|
118
|
+
this.changedSubject.next({ Kind: 'active', InstanceID: instanceId });
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
/** Attaches (or detaches, with `null`) the live handle on a rendered component. */
|
|
123
|
+
AttachHandle(instanceId, handle) {
|
|
124
|
+
const record = this.records.get(instanceId);
|
|
125
|
+
if (record) {
|
|
126
|
+
record.Handle = handle;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** Records what a component just reported. Returns `false` for an unknown instance. */
|
|
130
|
+
RecordEvent(instanceId, type, payload) {
|
|
131
|
+
const record = this.records.get(instanceId);
|
|
132
|
+
if (!record) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
record.LastEvent = { Type: type, Payload: payload, Seq: ++this.eventSeq };
|
|
136
|
+
this.changedSubject.next({ Kind: 'event', InstanceID: instanceId });
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
/** Closes every instance without emitting per-instance changes, and completes {@link Changed$}. */
|
|
140
|
+
Dispose() {
|
|
141
|
+
this.records.clear();
|
|
142
|
+
this.activeId = null;
|
|
143
|
+
this.changedSubject.complete();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=component-instance-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-instance-engine.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/interactive-component/component-instance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AC3B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,mFAAmF;IAC5E,YAAY,CAAC,UAAkB,EAAE,MAA0C;QAC9E,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,MAAM,EAAE,CAAC;YACT,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QAC3B,CAAC;IACL,CAAC;IAED,uFAAuF;IAChF,WAAW,CAAC,UAAkB,EAAE,IAAY,EAAE,OAAkB;QACnE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,MAAM,CAAC,SAAS,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC1E,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,mGAAmG;IAC5F,OAAO;QACV,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACJ","sourcesContent":["/**\n * @fileoverview The Interactive Component channel's state of record: which components are open, which one the\n * user is looking at, what version each shows, and the last thing each reported.\n *\n * Framework-free and synchronous. The channel mutates it; the Angular surface observes {@link ComponentInstanceEngine.Changed$}\n * and renders it. Keeping it separate means the rules (the instance cap, \"swapping a version keeps the instance\")\n * are tested without a browser and are the same whoever drives them.\n *\n * @module @memberjunction/ng-conversations\n */\n\nimport { Observable, Subject } from 'rxjs';\nimport type { JSONObject, JSONValue } from '@memberjunction/ai';\nimport { DeriveComponentContract, type ComponentContract } from './component-contract';\nimport type { IInteractiveComponentHandle, ResolvedComponentArtifact } from './interactive-component-types';\n\n/** The last thing a component reported, kept so it can ride in the state the model perceives. */\nexport interface ComponentLastEvent {\n /** The event type or state path. */\n Type: string;\n /** The (bounded) payload. */\n Payload: JSONValue;\n /** Monotonic per engine, so two identical events in a row still register as a change. */\n Seq: number;\n}\n\n/** One open component. */\nexport interface ComponentInstanceRecord {\n /** The instance id the agent addresses (`c1`, `c2`, ...). Stable for the life of the instance, across version swaps. */\n readonly InstanceID: string;\n /** The artifact version currently shown. */\n Artifact: ResolvedComponentArtifact;\n /** What the agent can do with it, derived from {@link Artifact}'s spec; re-derived on a version swap. */\n Contract: ComponentContract;\n /** The inputs it was opened with. */\n Inputs: JSONObject;\n /** The last event it reported, if any. */\n LastEvent: ComponentLastEvent | null;\n /** The live handle on the rendered component, once the surface has mounted it. */\n Handle: IInteractiveComponentHandle | null;\n}\n\n/** What changed, for the surface to react to. */\nexport type ComponentInstanceChange =\n | { Kind: 'added'; InstanceID: string }\n | { Kind: 'removed'; InstanceID: string }\n | { Kind: 'version'; InstanceID: string }\n | { Kind: 'active'; InstanceID: string | null }\n | { Kind: 'event'; InstanceID: string };\n\n/** Why an instance could not be added. */\nexport class InstanceLimitError extends Error {\n /** @param Limit The configured cap. */\n public constructor(public readonly Limit: number) {\n super(`At most ${Limit} component${Limit === 1 ? ' is' : 's are'} open at once. Close one first.`);\n this.name = 'InstanceLimitError';\n }\n}\n\n/** The set of open components. */\nexport class ComponentInstanceEngine {\n private readonly records = new Map<string, ComponentInstanceRecord>();\n private readonly changedSubject = new Subject<ComponentInstanceChange>();\n private activeId: string | null = null;\n private instanceSeq = 0;\n private eventSeq = 0;\n\n /** @param maxInstances The most components that may be open at once. */\n public constructor(private maxInstances: number) {}\n\n /** Every change, as it happens. Completes at {@link Dispose}. */\n public readonly Changed$: Observable<ComponentInstanceChange> = this.changedSubject.asObservable();\n\n /** Updates the instance cap (the configuration is read after the engine is created). Open instances above a lowered cap stay open. */\n public SetMaxInstances(maxInstances: number): void {\n this.maxInstances = maxInstances;\n }\n\n /** The open components, in the order they were opened. */\n public get Instances(): readonly ComponentInstanceRecord[] {\n return [...this.records.values()];\n }\n\n /** The id of the instance the user is looking at, or `null` when nothing is open. */\n public get ActiveID(): string | null {\n return this.activeId;\n }\n\n /** The instance with this id, or `undefined`. */\n public Get(instanceId: string): ComponentInstanceRecord | undefined {\n return this.records.get(instanceId);\n }\n\n /** The instance showing a version of this artifact, or `undefined`. */\n public FindByArtifact(artifactId: string): ComponentInstanceRecord | undefined {\n return this.Instances.find((r) => r.Artifact.ArtifactID.toLowerCase() === artifactId.toLowerCase());\n }\n\n /**\n * Opens a component and makes it the active one.\n *\n * @param artifact The loaded artifact version.\n * @param inputs What the agent passed to seed it with.\n * @throws {InstanceLimitError} When the cap is reached.\n */\n public Add(artifact: ResolvedComponentArtifact, inputs: JSONObject): ComponentInstanceRecord {\n if (this.records.size >= this.maxInstances) {\n throw new InstanceLimitError(this.maxInstances);\n }\n const record: ComponentInstanceRecord = {\n InstanceID: `c${++this.instanceSeq}`,\n Artifact: artifact,\n Contract: DeriveComponentContract(artifact.Spec),\n Inputs: inputs,\n LastEvent: null,\n Handle: null,\n };\n this.records.set(record.InstanceID, record);\n this.changedSubject.next({ Kind: 'added', InstanceID: record.InstanceID });\n this.SetActive(record.InstanceID);\n return record;\n }\n\n /** Closes an instance; the previous one in open order becomes active. Returns `false` when there is no such instance. */\n public Remove(instanceId: string): boolean {\n if (!this.records.delete(instanceId)) {\n return false;\n }\n this.changedSubject.next({ Kind: 'removed', InstanceID: instanceId });\n if (this.activeId === instanceId) {\n const remaining = this.Instances;\n this.activeId = null;\n this.SetActive(remaining.length > 0 ? remaining[remaining.length - 1].InstanceID : null);\n }\n return true;\n }\n\n /**\n * Shows another version in an existing instance. The instance id, its inputs and its place in the open order are\n * kept; only the artifact version (and what is derived from its spec) changes, and the old handle is dropped\n * (the surface re-attaches one once the new version has initialized).\n */\n public SwapVersion(instanceId: string, artifact: ResolvedComponentArtifact): boolean {\n const record = this.records.get(instanceId);\n if (!record) {\n return false;\n }\n record.Artifact = artifact;\n record.Contract = DeriveComponentContract(artifact.Spec);\n record.LastEvent = null;\n record.Handle = null;\n this.changedSubject.next({ Kind: 'version', InstanceID: instanceId });\n return true;\n }\n\n /** Makes an instance the active one (or `null` for none). Returns `false` for an unknown id. */\n public SetActive(instanceId: string | null): boolean {\n if (instanceId !== null && !this.records.has(instanceId)) {\n return false;\n }\n if (this.activeId !== instanceId) {\n this.activeId = instanceId;\n this.changedSubject.next({ Kind: 'active', InstanceID: instanceId });\n }\n return true;\n }\n\n /** Attaches (or detaches, with `null`) the live handle on a rendered component. */\n public AttachHandle(instanceId: string, handle: IInteractiveComponentHandle | null): void {\n const record = this.records.get(instanceId);\n if (record) {\n record.Handle = handle;\n }\n }\n\n /** Records what a component just reported. Returns `false` for an unknown instance. */\n public RecordEvent(instanceId: string, type: string, payload: JSONValue): boolean {\n const record = this.records.get(instanceId);\n if (!record) {\n return false;\n }\n record.LastEvent = { Type: type, Payload: payload, Seq: ++this.eventSeq };\n this.changedSubject.next({ Kind: 'event', InstanceID: instanceId });\n return true;\n }\n\n /** Closes every instance without emitting per-instance changes, and completes {@link Changed$}. */\n public Dispose(): void {\n this.records.clear();\n this.activeId = null;\n this.changedSubject.complete();\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Turns a component artifact version's `Content` into a renderable {@link ComponentSpec}.
|
|
3
|
+
*
|
|
4
|
+
* Kept apart from the database-backed source so the rules for "is this a component I can show" are plain
|
|
5
|
+
* functions that need no provider to test.
|
|
6
|
+
*
|
|
7
|
+
* @module @memberjunction/ng-conversations
|
|
8
|
+
*/
|
|
9
|
+
import type { ComponentSpec } from '@memberjunction/interactive-component-types';
|
|
10
|
+
/**
|
|
11
|
+
* Parses an artifact version's `Content` as a component specification.
|
|
12
|
+
*
|
|
13
|
+
* @param content The version's `Content` column (JSON text), or `null` when the content is stored as a file.
|
|
14
|
+
* @param label How to name the artifact in a failure message (so the model is told which one).
|
|
15
|
+
* @throws {ComponentArtifactError} `'unreadable'` when there is no usable content, `'not_a_component'` when the
|
|
16
|
+
* content is JSON that is not a component spec or has no executable code.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ParseComponentSpecContent(content: string | null | undefined, label: string): ComponentSpec;
|
|
19
|
+
//# sourceMappingURL=component-spec-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-spec-content.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/interactive-component/component-spec-content.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAQjF;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa,CAkB1G"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Turns a component artifact version's `Content` into a renderable {@link ComponentSpec}.
|
|
3
|
+
*
|
|
4
|
+
* Kept apart from the database-backed source so the rules for "is this a component I can show" are plain
|
|
5
|
+
* functions that need no provider to test.
|
|
6
|
+
*
|
|
7
|
+
* @module @memberjunction/ng-conversations
|
|
8
|
+
*/
|
|
9
|
+
import { SafeJSONParse } from '@memberjunction/global';
|
|
10
|
+
import { ComponentArtifactError } from './interactive-component-types';
|
|
11
|
+
/** True for a non-null, non-array object. */
|
|
12
|
+
function isRecord(value) {
|
|
13
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parses an artifact version's `Content` as a component specification.
|
|
17
|
+
*
|
|
18
|
+
* @param content The version's `Content` column (JSON text), or `null` when the content is stored as a file.
|
|
19
|
+
* @param label How to name the artifact in a failure message (so the model is told which one).
|
|
20
|
+
* @throws {ComponentArtifactError} `'unreadable'` when there is no usable content, `'not_a_component'` when the
|
|
21
|
+
* content is JSON that is not a component spec or has no executable code.
|
|
22
|
+
*/
|
|
23
|
+
export function ParseComponentSpecContent(content, label) {
|
|
24
|
+
if (typeof content !== 'string' || content.trim().length === 0) {
|
|
25
|
+
throw new ComponentArtifactError('unreadable', `${label} has no inline content to render (content stored as a file is not supported by the Interactive Component channel).`);
|
|
26
|
+
}
|
|
27
|
+
const parsed = SafeJSONParse(content);
|
|
28
|
+
if (!isRecord(parsed) || typeof parsed['name'] !== 'string') {
|
|
29
|
+
throw new ComponentArtifactError('not_a_component', `${label} is not an interactive component (its content is not a component specification).`);
|
|
30
|
+
}
|
|
31
|
+
const hasCode = typeof parsed['code'] === 'string' && parsed['code'].trim().length > 0;
|
|
32
|
+
const isRegistry = typeof parsed['namespace'] === 'string' && parsed['namespace'].length > 0;
|
|
33
|
+
if (!hasCode && !isRegistry) {
|
|
34
|
+
throw new ComponentArtifactError('not_a_component', `${label} is a component specification with no executable code yet, so it cannot be shown.`);
|
|
35
|
+
}
|
|
36
|
+
// The parsed value is the artifact's own ComponentSpec JSON; the fields above are the ones rendering needs.
|
|
37
|
+
return parsed;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=component-spec-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-spec-content.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/interactive-component/component-spec-content.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+B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entSpec}.\n *\n * Kept apart from the database-backed source so the rules for \"is this a component I can show\" are plain\n * functions that need no provider to test.\n *\n * @module @memberjunction/ng-conversations\n */\n\nimport { SafeJSONParse } from '@memberjunction/global';\nimport type { ComponentSpec } from '@memberjunction/interactive-component-types';\nimport { ComponentArtifactError } from './interactive-component-types';\n\n/** True for a non-null, non-array object. */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\n/**\n * Parses an artifact version's `Content` as a component specification.\n *\n * @param content The version's `Content` column (JSON text), or `null` when the content is stored as a file.\n * @param label How to name the artifact in a failure message (so the model is told which one).\n * @throws {ComponentArtifactError} `'unreadable'` when there is no usable content, `'not_a_component'` when the\n * content is JSON that is not a component spec or has no executable code.\n */\nexport function ParseComponentSpecContent(content: string | null | undefined, label: string): ComponentSpec {\n if (typeof content !== 'string' || content.trim().length === 0) {\n throw new ComponentArtifactError(\n 'unreadable',\n `${label} has no inline content to render (content stored as a file is not supported by the Interactive Component channel).`\n );\n }\n const parsed: unknown = SafeJSONParse(content);\n if (!isRecord(parsed) || typeof parsed['name'] !== 'string') {\n throw new ComponentArtifactError('not_a_component', `${label} is not an interactive component (its content is not a component specification).`);\n }\n const hasCode = typeof parsed['code'] === 'string' && parsed['code'].trim().length > 0;\n const isRegistry = typeof parsed['namespace'] === 'string' && parsed['namespace'].length > 0;\n if (!hasCode && !isRegistry) {\n throw new ComponentArtifactError('not_a_component', `${label} is a component specification with no executable code yet, so it cannot be shown.`);\n }\n // The parsed value is the artifact's own ComponentSpec JSON; the fields above are the ones rendering needs.\n return parsed as unknown as ComponentSpec;\n}\n"]}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { Type } from '@angular/core';
|
|
2
|
+
import type { JSONObject, RealtimeToolDefinition } from '@memberjunction/ai';
|
|
3
|
+
import { type RealtimeChannelActor, type RealtimeChannelDescriptor } from '@memberjunction/ai-core-plus';
|
|
4
|
+
import { BaseRealtimeChannelClient, type ChannelOnboardingDetails, type ParsedDelegationArtifact, type RealtimeChannelVerbResult } from '@memberjunction/realtime-runtime';
|
|
5
|
+
import { ComponentInstanceEngine } from './component-instance-engine';
|
|
6
|
+
import { RealtimeInteractiveComponentSurfaceComponent } from './realtime-interactive-component-surface.component';
|
|
7
|
+
import { type ComponentActivity, type IComponentArtifactSource, type InteractiveComponentConfig } from './interactive-component-types';
|
|
8
|
+
/**
|
|
9
|
+
* The INTERACTIVE COMPONENT channel: shows the user any interactive component artifact (a dashboard, a report, a
|
|
10
|
+
* form, a chart) next to the voice conversation, and lets the agent operate it.
|
|
11
|
+
*
|
|
12
|
+
* It is a MULTI-INSTANCE channel (several components may be open at once, each addressed by `target.instance`) and
|
|
13
|
+
* its contract is DERIVED from what it hosts: the actions an agent can take on an instance are that component's own
|
|
14
|
+
* `customMethods` and the standard methods its spec says it supports; its state is the component's data state;
|
|
15
|
+
* its events are the spec's `events`; the inputs for opening it are the spec's `properties`. A component nobody
|
|
16
|
+
* wrote channel code for is therefore operable from its spec alone. See `DeriveComponentContract`.
|
|
17
|
+
*
|
|
18
|
+
* Built-in: `open { artifactId | artifactVersionId, inputs? }` (the dispatcher's reserved action), `show_version`, `close`.
|
|
19
|
+
*
|
|
20
|
+
* ### What the model perceives
|
|
21
|
+
* Per instance: which artifact version is open, what the user last did in it (its events), and its data state,
|
|
22
|
+
* bounded to a handful of rows. All of it is gated by exposure policy (`min(channel, agent config, zero-data-retention,
|
|
23
|
+
* user)`). Pixels flow only if the host registered a frame capturer ({@link ChannelFrameCapture}).
|
|
24
|
+
* Agent-INVOKED verbs return what the component returns; exposure gates what is volunteered to the model, not what it
|
|
25
|
+
* asked for.
|
|
26
|
+
*
|
|
27
|
+
* ### Access
|
|
28
|
+
* Artifacts are loaded through the signed-in user's own session and read permission (see `RunViewComponentArtifactSource`).
|
|
29
|
+
* The agent cannot open anything the user cannot.
|
|
30
|
+
*
|
|
31
|
+
* ### Lifetime
|
|
32
|
+
* Open components are live-only: they are not persisted with the session and are not restored on resume.
|
|
33
|
+
*/
|
|
34
|
+
export declare class InteractiveComponentChannel extends BaseRealtimeChannelClient<RealtimeInteractiveComponentSurfaceComponent> {
|
|
35
|
+
/** The components that are open. */
|
|
36
|
+
readonly Engine: ComponentInstanceEngine;
|
|
37
|
+
/** The resolved configuration; the defaults until {@link Initialize} reads the cascade. */
|
|
38
|
+
Config: InteractiveComponentConfig;
|
|
39
|
+
/** How long a verb waits for a component to initialize; overridable so tests need not sleep. */
|
|
40
|
+
protected HandlePollIntervalMs: number;
|
|
41
|
+
/** How long after an action the data state is re-read; overridable for tests. */
|
|
42
|
+
protected DataSettleMs: number;
|
|
43
|
+
private artifactSource;
|
|
44
|
+
private surface;
|
|
45
|
+
private settleTimer;
|
|
46
|
+
get ChannelName(): string;
|
|
47
|
+
/**
|
|
48
|
+
* The id state notes carry. A multi-instance channel's snapshot describes ALL its instances (keyed by their own ids,
|
|
49
|
+
* `c1`, `c2`, ...), so the notes about the snapshot as a whole are addressed to `all` rather than to one of them.
|
|
50
|
+
*/
|
|
51
|
+
get InstanceId(): string;
|
|
52
|
+
get TabTitle(): string;
|
|
53
|
+
get TabIcon(): string;
|
|
54
|
+
/** The channel has no native tools: every verb is reached through the `ContextTool` proxy, because the verbs depend on what is open. */
|
|
55
|
+
GetToolDefinitions(): RealtimeToolDefinition[];
|
|
56
|
+
/**
|
|
57
|
+
* Replaces where artifacts are loaded from (a host with its own store, or a test). Without it the channel loads
|
|
58
|
+
* through the session's provider and the signed-in user's access.
|
|
59
|
+
*/
|
|
60
|
+
SetArtifactSource(source: IComponentArtifactSource | null): void;
|
|
61
|
+
/**
|
|
62
|
+
* The channel's self-description. The verbs and events are the built-ins plus those of every component that is
|
|
63
|
+
* open right now, so the contract grows as components are opened and the dispatcher validates against it.
|
|
64
|
+
*/
|
|
65
|
+
GetDescriptor(): RealtimeChannelDescriptor;
|
|
66
|
+
/** The built-in verbs plus each open component's, merged by name. */
|
|
67
|
+
private collectVerbs;
|
|
68
|
+
/** The built-in events plus each open component's declared ones. */
|
|
69
|
+
private collectEvents;
|
|
70
|
+
GetOnboardingDetails(): ChannelOnboardingDetails;
|
|
71
|
+
protected OnInitialize(): void;
|
|
72
|
+
/** Opts into pixels only when the host registered something that can rasterize a component. */
|
|
73
|
+
private enableVisualPerceptionIfAvailable;
|
|
74
|
+
/**
|
|
75
|
+
* A picture of the component the user is looking at, as base64 JPEG, or `null` when there is none to send: exposure is
|
|
76
|
+
* below `pixels`, the session has no inbound video track, nothing is on screen, or the host's rasterizer produced nothing
|
|
77
|
+
* (it reports why, once, itself). Never throws.
|
|
78
|
+
*
|
|
79
|
+
* The base channel's visual pump has already checked exposure and the track before it asks; they are checked again so a
|
|
80
|
+
* frame is never rasterized (the costly part) for a model that may not see it, whoever asks.
|
|
81
|
+
*/
|
|
82
|
+
protected CaptureActiveFrame(): Promise<string | null>;
|
|
83
|
+
GetSurfaceComponent(): Type<RealtimeInteractiveComponentSurfaceComponent>;
|
|
84
|
+
/** Hands the dynamically created surface the engine it renders and the hooks it reports through. */
|
|
85
|
+
BindSurface(instance: RealtimeInteractiveComponentSurfaceComponent): void;
|
|
86
|
+
UnbindSurface(): void;
|
|
87
|
+
Dispose(): void;
|
|
88
|
+
/**
|
|
89
|
+
* Open components are LIVE-ONLY: there is no state of record to persist, so nothing is saved with the session
|
|
90
|
+
* (`null`, which the host never writes) and {@link RestoreState} refuses what it is offered. A resumed session starts
|
|
91
|
+
* with no component open; the agent opens them again. What the model perceives right now is {@link GetState}.
|
|
92
|
+
*/
|
|
93
|
+
SerializeState(): string | null;
|
|
94
|
+
/** Live-only: a resumed session never restores open components (see {@link SerializeState}). Always `false`. */
|
|
95
|
+
RestoreState(_stateJson: string): boolean;
|
|
96
|
+
/** The open components, keyed by instance id (see the `components` noun). A pure read. */
|
|
97
|
+
GetState(): JSONObject;
|
|
98
|
+
/** One instance as the model perceives it. */
|
|
99
|
+
private describeForState;
|
|
100
|
+
/**
|
|
101
|
+
* Loads the artifact and opens it as a new instance (or, when that artifact is already open, brings the existing
|
|
102
|
+
* instance forward and moves it to the requested version). Refusals are structured results, never exceptions.
|
|
103
|
+
*/
|
|
104
|
+
protected OnOpen(inputs: JSONObject): Promise<RealtimeChannelVerbResult>;
|
|
105
|
+
/** Opens a new instance for a loaded artifact. */
|
|
106
|
+
private addInstance;
|
|
107
|
+
/** The inputs schema a freshly derived contract would have, so opening is validated before an instance exists. */
|
|
108
|
+
private inputsSchemaFor;
|
|
109
|
+
/** An artifact that is already open is not opened twice: focus it, and show the requested version. */
|
|
110
|
+
private reuseOpenInstance;
|
|
111
|
+
/** What the agent is told when it opens (or revisits) a component: how to operate it. */
|
|
112
|
+
private describeOpened;
|
|
113
|
+
/** Maps a failed artifact load to a result the model can act on. */
|
|
114
|
+
private mapLoadFailure;
|
|
115
|
+
/**
|
|
116
|
+
* Asks to be offered a delegated run's artifacts when the operator turned on auto-open, or when one of them is
|
|
117
|
+
* already open here (so a revised version replaces it). Whether an artifact is a component is only known once it
|
|
118
|
+
* is loaded, so with auto-open on the channel is mounted for any delegated artifact and ignores the ones that are not.
|
|
119
|
+
*/
|
|
120
|
+
AcceptsDelegationArtifacts(artifacts: readonly ParsedDelegationArtifact[], config: JSONObject): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Takes a delegated run's artifacts: an artifact that is already open moves to its newer version (or, when the
|
|
123
|
+
* configuration says not to swap, the agent is told one exists); with auto-open on, a component that is not open is opened.
|
|
124
|
+
*/
|
|
125
|
+
OnDelegationArtifacts(artifacts: readonly ParsedDelegationArtifact[]): Promise<void>;
|
|
126
|
+
/** Opens a delegated artifact; one that is not a component is ignored (expected), anything else is logged. */
|
|
127
|
+
private autoOpen;
|
|
128
|
+
/** Moves an open instance to the version a delegated run produced, when that version is newer. */
|
|
129
|
+
private takeNewerVersion;
|
|
130
|
+
/** Shows another version in an existing instance, keeping its id; tells observers, and the model when it did not ask. */
|
|
131
|
+
private swapVersion;
|
|
132
|
+
/**
|
|
133
|
+
* Runs one verb. The dispatcher has already checked the verb against the (merged) descriptor; the exact check against
|
|
134
|
+
* the addressed component's own schema happens here.
|
|
135
|
+
*/
|
|
136
|
+
ApplyVerb(verb: string, args: JSONObject, actor: RealtimeChannelActor, instanceId?: string): Promise<RealtimeChannelVerbResult>;
|
|
137
|
+
/**
|
|
138
|
+
* Refuses a verb whose result carries the component's data while exposure keeps that from the agent. The dispatcher
|
|
139
|
+
* checks the same thing against the (merged) descriptor; this is the exact per-instance check, and it keeps the
|
|
140
|
+
* channel safe when it is driven by something other than the dispatcher.
|
|
141
|
+
*/
|
|
142
|
+
private refuseForExposure;
|
|
143
|
+
/**
|
|
144
|
+
* Finds the instance a verb addresses: the one named, else the one the user is looking at when it supports the verb,
|
|
145
|
+
* else the only one that does. Anything else is a refusal that lists what would have worked.
|
|
146
|
+
*/
|
|
147
|
+
private resolveInstance;
|
|
148
|
+
/** `c1 (Revenue), c2 (Pipeline)`. */
|
|
149
|
+
private listOpen;
|
|
150
|
+
/** `show_version`: swap an instance to another version of ITS artifact. */
|
|
151
|
+
private showVersion;
|
|
152
|
+
/** `close`. */
|
|
153
|
+
private closeInstance;
|
|
154
|
+
/** Runs a verb derived from the component's spec. */
|
|
155
|
+
private invokeDerived;
|
|
156
|
+
/** Waits (bounded) for the surface to mount the component and report it ready. */
|
|
157
|
+
private waitForHandle;
|
|
158
|
+
/** Executes a derived verb against the live component and returns what to tell the model. */
|
|
159
|
+
private runBinding;
|
|
160
|
+
/** `scroll_to`: a selector, or an offset. */
|
|
161
|
+
private scrollTo;
|
|
162
|
+
/** What happens after a verb ran: the state may have changed, and the picture may have too. */
|
|
163
|
+
private afterAction;
|
|
164
|
+
/**
|
|
165
|
+
* Called by the surface when something happens inside a rendered component: an event it emits, a state change,
|
|
166
|
+
* or the end of its initialization. Becomes a change in the state the model perceives and a typed event for observers.
|
|
167
|
+
*/
|
|
168
|
+
OnComponentActivity(instanceId: string, activity: ComponentActivity): void;
|
|
169
|
+
/** The user closed a component's tab. */
|
|
170
|
+
private userClosed;
|
|
171
|
+
/**
|
|
172
|
+
* A component's data usually arrives AFTER the action that asked for it, so the state is described once more shortly
|
|
173
|
+
* afterward. One timer covers a burst.
|
|
174
|
+
*/
|
|
175
|
+
private scheduleSettle;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Tree-shaking prevention: the channel is resolved through the ClassFactory by the registry row's `ClientPluginClass`
|
|
179
|
+
* key, so this static call keeps its `@RegisterClass` side effect from being eliminated by the bundler. Called alongside
|
|
180
|
+
* `LoadRealtimeMediaChannel()`.
|
|
181
|
+
*/
|
|
182
|
+
export declare function LoadRealtimeInteractiveComponentChannel(): void;
|
|
183
|
+
//# sourceMappingURL=interactive-component-channel.d.ts.map
|
package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive-component-channel.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/interactive-component/interactive-component-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAEH,KAAK,oBAAoB,EAEzB,KAAK,yBAAyB,EAGjC,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACH,yBAAyB,EAGzB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EACjC,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAE,uBAAuB,EAAoD,MAAM,6BAA6B,CAAC;AAGxH,OAAO,EAAE,4CAA4C,EAAE,MAAM,oDAAoD,CAAC;AAElH,OAAO,EAMH,KAAK,iBAAiB,EAEtB,KAAK,wBAAwB,EAE7B,KAAK,0BAA0B,EAElC,MAAM,+BAA+B,CAAC;AA2CvC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAC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