@memberjunction/ng-conversations 6.2.2 → 6.3.0-edge.1
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 +49 -24
- package/dist/assets/edge-ai.worker.js +32515 -0
- package/dist/lib/components/artifact/artifact-share-modal.component.d.ts +39 -6
- package/dist/lib/components/artifact/artifact-share-modal.component.d.ts.map +1 -1
- package/dist/lib/components/artifact/artifact-share-modal.component.js +620 -74
- package/dist/lib/components/artifact/artifact-share-modal.component.js.map +1 -1
- package/dist/lib/components/collection/artifact-create-modal.component.js +4 -4
- package/dist/lib/components/collection/artifact-create-modal.component.js.map +1 -1
- package/dist/lib/components/collection/collection-form-modal.component.js +3 -3
- package/dist/lib/components/collection/collection-form-modal.component.js.map +1 -1
- package/dist/lib/components/collection/collection-tree.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-tree.component.js +19 -18
- package/dist/lib/components/collection/collection-tree.component.js.map +1 -1
- package/dist/lib/components/collection/collection-view.component.d.ts +6 -4
- package/dist/lib/components/collection/collection-view.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-view.component.js +35 -17
- package/dist/lib/components/collection/collection-view.component.js.map +1 -1
- package/dist/lib/components/collection/collections-full-view.component.d.ts +1 -0
- package/dist/lib/components/collection/collections-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collections-full-view.component.js +109 -107
- package/dist/lib/components/collection/collections-full-view.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +76 -11
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +236 -50
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts +49 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.js +151 -41
- package/dist/lib/components/conversation/conversation-list.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-remote-browser-controller.d.ts +11 -3
- package/dist/lib/components/conversation/conversation-remote-browser-controller.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-remote-browser-controller.js +40 -4
- package/dist/lib/components/conversation/conversation-remote-browser-controller.js.map +1 -1
- 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 +13 -2
- package/dist/lib/components/export/export-modal.component.js.map +1 -1
- package/dist/lib/components/library/library-create-dialog.component.d.ts +136 -0
- package/dist/lib/components/library/library-create-dialog.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-create-dialog.component.js +1620 -0
- package/dist/lib/components/library/library-create-dialog.component.js.map +1 -0
- package/dist/lib/components/library/library-full-view.component.d.ts +10 -4
- package/dist/lib/components/library/library-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/library/library-full-view.component.js +216 -40
- package/dist/lib/components/library/library-full-view.component.js.map +1 -1
- package/dist/lib/components/library/library-remote-drive-pane.component.d.ts +97 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.js +1229 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.js.map +1 -0
- package/dist/lib/components/library/library-workspace.component.d.ts +265 -0
- package/dist/lib/components/library/library-workspace.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-workspace.component.js +4420 -0
- package/dist/lib/components/library/library-workspace.component.js.map +1 -0
- package/dist/lib/components/library/library.models.d.ts +162 -0
- package/dist/lib/components/library/library.models.d.ts.map +1 -0
- package/dist/lib/components/library/library.models.js +2 -0
- package/dist/lib/components/library/library.models.js.map +1 -0
- package/dist/lib/components/message/conversation-message-rating.component.d.ts +5 -0
- package/dist/lib/components/message/conversation-message-rating.component.d.ts.map +1 -1
- package/dist/lib/components/message/conversation-message-rating.component.js +72 -16
- package/dist/lib/components/message/conversation-message-rating.component.js.map +1 -1
- package/dist/lib/components/message/message-input.component.d.ts +26 -14
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input.component.js +91 -56
- package/dist/lib/components/message/message-input.component.js.map +1 -1
- package/dist/lib/components/message/message-item.component.d.ts +35 -1
- package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-item.component.js +583 -392
- package/dist/lib/components/message/message-item.component.js.map +1 -1
- package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-list.component.js +2 -0
- package/dist/lib/components/message/message-list.component.js.map +1 -1
- package/dist/lib/components/navigation/conversation-navigation.component.js +9 -9
- package/dist/lib/components/navigation/conversation-navigation.component.js.map +1 -1
- package/dist/lib/components/overlay/chat-overlay.component.d.ts +94 -6
- package/dist/lib/components/overlay/chat-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/overlay/chat-overlay.component.js +249 -59
- package/dist/lib/components/overlay/chat-overlay.component.js.map +1 -1
- package/dist/lib/components/project/project-form-modal.component.d.ts +6 -0
- package/dist/lib/components/project/project-form-modal.component.d.ts.map +1 -1
- package/dist/lib/components/project/project-form-modal.component.js +81 -61
- package/dist/lib/components/project/project-form-modal.component.js.map +1 -1
- package/dist/lib/components/project/project-selector.component.d.ts +5 -0
- package/dist/lib/components/project/project-selector.component.d.ts.map +1 -1
- package/dist/lib/components/project/project-selector.component.js +11 -4
- package/dist/lib/components/project/project-selector.component.js.map +1 -1
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.d.ts +55 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js +944 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.d.ts +66 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.js +253 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.d.ts +80 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.js +49 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.d.ts +54 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.js +386 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.js.map +1 -0
- package/dist/lib/components/realtime/channels/client-context-channel.d.ts +20 -4
- package/dist/lib/components/realtime/channels/client-context-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.js +62 -8
- package/dist/lib/components/realtime/channels/client-context-channel.js.map +1 -1
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js +15 -2
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.js +2 -2
- package/dist/lib/components/realtime/realtime-agent-banner.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-picker.component.js +3 -3
- package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-composer.component.js +5 -3
- package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +81 -32
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.js +506 -185
- package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.js +89 -4
- package/dist/lib/components/realtime/realtime-session-thread.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.js +2 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts +4 -4
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.js +5 -5
- package/dist/lib/components/realtime/realtime-surface-tab-style.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +7 -9
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js +12 -13
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +27 -0
- 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 +141 -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 +101 -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 +503 -55
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-tools.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js +2 -2
- package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts +48 -5
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js +249 -53
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -1
- package/dist/lib/components/search/search-panel.component.d.ts +10 -0
- package/dist/lib/components/search/search-panel.component.d.ts.map +1 -1
- package/dist/lib/components/search/search-panel.component.js +25 -3
- package/dist/lib/components/search/search-panel.component.js.map +1 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts +28 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts.map +1 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.js +51 -6
- package/dist/lib/components/sidebar/conversation-sidebar.component.js.map +1 -1
- package/dist/lib/components/task/tasks-full-view.component.d.ts +31 -8
- package/dist/lib/components/task/tasks-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/task/tasks-full-view.component.js +692 -497
- package/dist/lib/components/task/tasks-full-view.component.js.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.js +15 -2
- package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
- package/dist/lib/conversations.module.d.ts +66 -61
- package/dist/lib/conversations.module.d.ts.map +1 -1
- package/dist/lib/conversations.module.js +60 -1
- package/dist/lib/conversations.module.js.map +1 -1
- package/dist/lib/events/chat-events.d.ts +45 -0
- package/dist/lib/events/chat-events.d.ts.map +1 -1
- package/dist/lib/events/chat-events.js +64 -0
- package/dist/lib/events/chat-events.js.map +1 -1
- package/dist/lib/models/agent-turn.model.d.ts +7 -1
- 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.map +1 -1
- package/dist/lib/services/agent-state.service.js +14 -3
- package/dist/lib/services/agent-state.service.js.map +1 -1
- package/dist/lib/services/artifact-permission.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-permission.service.js +14 -3
- package/dist/lib/services/artifact-permission.service.js.map +1 -1
- package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-state.service.js +43 -11
- package/dist/lib/services/artifact-state.service.js.map +1 -1
- package/dist/lib/services/conversation-agent.service.d.ts +8 -3
- package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-agent.service.js +9 -3
- package/dist/lib/services/conversation-agent.service.js.map +1 -1
- package/dist/lib/services/conversation-tasks-filter.d.ts +59 -2
- package/dist/lib/services/conversation-tasks-filter.d.ts.map +1 -1
- package/dist/lib/services/conversation-tasks-filter.js +222 -18
- package/dist/lib/services/conversation-tasks-filter.js.map +1 -1
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.d.ts +85 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.js +257 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.d.ts +85 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.js +10 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.d.ts +90 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.js +386 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.d.ts +13 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.js +201 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.js.map +1 -0
- package/dist/lib/services/export.service.d.ts +64 -0
- package/dist/lib/services/export.service.d.ts.map +1 -1
- package/dist/lib/services/export.service.js +185 -6
- package/dist/lib/services/export.service.js.map +1 -1
- package/dist/lib/services/library-creation.service.d.ts +304 -0
- package/dist/lib/services/library-creation.service.d.ts.map +1 -0
- package/dist/lib/services/library-creation.service.js +1244 -0
- package/dist/lib/services/library-creation.service.js.map +1 -0
- package/dist/lib/services/realtime-audio-recorder.d.ts +10 -8
- package/dist/lib/services/realtime-audio-recorder.d.ts.map +1 -1
- package/dist/lib/services/realtime-audio-recorder.js +28 -12
- package/dist/lib/services/realtime-audio-recorder.js.map +1 -1
- package/dist/lib/services/realtime-pairing.d.ts +3 -3
- package/dist/lib/services/realtime-pairing.js +4 -4
- package/dist/lib/services/realtime-pairing.js.map +1 -1
- package/dist/lib/services/realtime-session-review.service.d.ts +14 -0
- package/dist/lib/services/realtime-session-review.service.d.ts.map +1 -1
- package/dist/lib/services/realtime-session-review.service.js +46 -4
- package/dist/lib/services/realtime-session-review.service.js.map +1 -1
- package/dist/lib/services/realtime-session.service.d.ts +10 -3
- package/dist/lib/services/realtime-session.service.d.ts.map +1 -1
- package/dist/lib/services/realtime-session.service.js +8 -3
- package/dist/lib/services/realtime-session.service.js.map +1 -1
- package/dist/lib/services/search.service.d.ts +19 -2
- package/dist/lib/services/search.service.d.ts.map +1 -1
- package/dist/lib/services/search.service.js +99 -36
- package/dist/lib/services/search.service.js.map +1 -1
- package/dist/lib/utils/agent-artifact-summary.d.ts +1 -1
- package/dist/lib/utils/agent-artifact-summary.d.ts.map +1 -1
- package/dist/lib/utils/agent-artifact-summary.js +1 -1
- package/dist/lib/utils/agent-artifact-summary.js.map +1 -1
- package/dist/lib/utils/decision-routing.d.ts +5 -2
- package/dist/lib/utils/decision-routing.d.ts.map +1 -1
- package/dist/lib/utils/decision-routing.js +9 -4
- package/dist/lib/utils/decision-routing.js.map +1 -1
- package/dist/public-api.d.ts +13 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +15 -1
- package/dist/public-api.js.map +1 -1
- package/package.json +42 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-session-thread.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-session-thread.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACM,YAAY,EAAwC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAEnG,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;;
|
|
1
|
+
{"version":3,"file":"realtime-session-thread.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-session-thread.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACM,YAAY,EAAwC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAEnG,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;;AAkG5E;;;;;;;;;;GAUG;AACH,qBAOa,8BAA+B,YAAW,MAAM,EAAE,gBAAgB,EAAE,SAAS;IAC7D,OAAO,CAAC,YAAY,CAAC,CAA0B;IAE1E,8DAA8D;IACrD,SAAS,SAAU;IAE5B;;;;OAIG;IACM,QAAQ,SAAS;IAE1B,6DAA6D;IAClC,KAAK,EAAG,oBAAoB,CAAC;IAExD,oFAAoF;IAC3E,YAAY,UAAQ;IAE7B,mFAAmF;IAC1E,OAAO,UAAS;IAEzB,gGAAgG;IACvF,iBAAiB,UAAQ;IAElC,wFAAwF;IAC9E,gBAAgB,uBAA8B;IAExD,qGAAqG;IAC3F,qBAAqB,yCAAgD;IAE/E,uFAAuF;IAC7E,eAAe,uBAA8B;IAEvD,2FAA2F;IAC3F,OAAO,CAAC,aAAa,CAAK;IAC1B,uDAAuD;IACvD,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,UAAU,CAAC,CAAe;IAClC,OAAO,CAAC,GAAG,CAAiD;IAE5D,QAAQ,IAAI,IAAI;IAKhB,kBAAkB,IAAI,IAAI;IAO1B,WAAW,IAAI,IAAI;IAInB,+CAA+C;IACxC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,MAAM;IAQjE,kFAAkF;IAC3E,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO;IAOvD,yEAAyE;IAClE,aAAa,cAAqB;IAEzC;;;OAGG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAO3D,2EAA2E;IACpE,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIzC,gFAAgF;IACzE,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAYzD;;;OAGG;IACI,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM;IAgBlE,gFAAgF;IAChF,OAAO,CAAC,cAAc;yCAhIX,8BAA8B;2CAA9B,8BAA8B;CAuI1C"}
|
|
@@ -158,6 +158,89 @@ function RealtimeSessionThreadComponent_ForEmpty_3_Template(rf, ctx) { if (rf &
|
|
|
158
158
|
i0.ɵɵtext(1, "The live transcript and any delegated work will appear here.");
|
|
159
159
|
i0.ɵɵelementEnd();
|
|
160
160
|
} }
|
|
161
|
+
function isBlank(c) {
|
|
162
|
+
return c === ' ' || c === '\t';
|
|
163
|
+
}
|
|
164
|
+
/** Index just past the spaces and tabs starting at `from`. */
|
|
165
|
+
function skipBlanks(text, from) {
|
|
166
|
+
let i = from;
|
|
167
|
+
while (i < text.length && isBlank(text[i])) {
|
|
168
|
+
i++;
|
|
169
|
+
}
|
|
170
|
+
return i;
|
|
171
|
+
}
|
|
172
|
+
/** Index past an optional `—` and the whitespace after it (the `(?:—\s*)?` of a pattern). */
|
|
173
|
+
function skipEmDash(text, at) {
|
|
174
|
+
if (text[at] !== '—') {
|
|
175
|
+
return at;
|
|
176
|
+
}
|
|
177
|
+
let i = at + 1;
|
|
178
|
+
while (i < text.length && /\s/.test(text[i])) {
|
|
179
|
+
i++;
|
|
180
|
+
}
|
|
181
|
+
return i;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Replace each run of spaces or tabs that `tail` accepts, together with what `tail` matched after it,
|
|
185
|
+
* left to right. This is `.replace(/[ \t]+<tail>/g, …)` for a tail that cannot start with a space or
|
|
186
|
+
* tab, scanned once: the regex retries from every position inside a long run of spaces with no tail
|
|
187
|
+
* after it, which is quadratic (CodeQL js/polynomial-redos). A match can only start where a run
|
|
188
|
+
* starts, since starting later reaches the same run end.
|
|
189
|
+
*/
|
|
190
|
+
function replaceAfterBlankRuns(text, tail) {
|
|
191
|
+
let out = '';
|
|
192
|
+
let copied = 0;
|
|
193
|
+
let i = 0;
|
|
194
|
+
while (i < text.length) {
|
|
195
|
+
if (!isBlank(text[i])) {
|
|
196
|
+
i++;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
const runStart = i;
|
|
200
|
+
i = skipBlanks(text, i);
|
|
201
|
+
const match = tail(text, i);
|
|
202
|
+
if (match) {
|
|
203
|
+
out += text.slice(copied, runStart) + match.Replacement;
|
|
204
|
+
copied = match.End;
|
|
205
|
+
i = match.End;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return out + text.slice(copied);
|
|
209
|
+
}
|
|
210
|
+
/** `(?:—\s*)?(#{1,6}[ \t]+)` → a blank line, then the hashes and their spaces. */
|
|
211
|
+
function headingTail(text, at) {
|
|
212
|
+
const start = skipEmDash(text, at);
|
|
213
|
+
let hashEnd = start;
|
|
214
|
+
while (hashEnd < text.length && text[hashEnd] === '#') {
|
|
215
|
+
hashEnd++;
|
|
216
|
+
}
|
|
217
|
+
const hashes = hashEnd - start;
|
|
218
|
+
if (hashes < 1 || hashes > 6 || !isBlank(text[hashEnd] ?? '')) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
const end = skipBlanks(text, hashEnd);
|
|
222
|
+
return { Replacement: '\n\n' + text.slice(start, end), End: end };
|
|
223
|
+
}
|
|
224
|
+
/** `(?:—\s*)?(---|___|\*\*\*)[ \t]*` → the rule on its own paragraph. */
|
|
225
|
+
function ruleTail(text, at) {
|
|
226
|
+
const start = skipEmDash(text, at);
|
|
227
|
+
const rule = ['---', '___', '***'].find((r) => text.startsWith(r, start));
|
|
228
|
+
if (!rule) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
return { Replacement: `\n\n${rule}\n\n`, End: skipBlanks(text, start + rule.length) };
|
|
232
|
+
}
|
|
233
|
+
/** `-[ \t]+(?=[A-Za-z0-9\*])` → a new `- ` list line. */
|
|
234
|
+
function bulletTail(text, at) {
|
|
235
|
+
if (text[at] !== '-') {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
const end = skipBlanks(text, at + 1);
|
|
239
|
+
if (end === at + 1 || !/[A-Za-z0-9*]/.test(text[end] ?? '')) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
return { Replacement: '\n- ', End: end };
|
|
243
|
+
}
|
|
161
244
|
/**
|
|
162
245
|
* The unified, chronological live thread for the call overlay: caption bubbles
|
|
163
246
|
* interleaved with delegation cards exactly where they happened.
|
|
@@ -266,11 +349,13 @@ export class RealtimeSessionThreadComponent {
|
|
|
266
349
|
}
|
|
267
350
|
let cleaned = text;
|
|
268
351
|
// Restore newlines before markdown headings on same line: "Title ### Heading" -> "Title\n\n### Heading"
|
|
269
|
-
|
|
352
|
+
// Each step scans by index rather than with `/[ \t]+…/g`, which is quadratic on a long run of
|
|
353
|
+
// spaces (CodeQL js/polynomial-redos); see replaceAfterBlankRuns.
|
|
354
|
+
cleaned = replaceAfterBlankRuns(cleaned, headingTail);
|
|
270
355
|
// Restore newlines around horizontal rules on same line: "Text --- ##" -> "Text\n\n---\n\n##"
|
|
271
|
-
cleaned = cleaned
|
|
356
|
+
cleaned = replaceAfterBlankRuns(cleaned, ruleTail);
|
|
272
357
|
// Restore newlines before bullet items on same line: "around: - Item 1 - Item 2" -> "around:\n- Item 1\n- Item 2"
|
|
273
|
-
cleaned = cleaned
|
|
358
|
+
cleaned = replaceAfterBlankRuns(cleaned, bulletTail);
|
|
274
359
|
return cleaned;
|
|
275
360
|
}
|
|
276
361
|
/** Marks for check on every state change; auto-scrolls when the thread grew. */
|
|
@@ -323,5 +408,5 @@ export class RealtimeSessionThreadComponent {
|
|
|
323
408
|
}], CancelRequested: [{
|
|
324
409
|
type: Output
|
|
325
410
|
}] }); })();
|
|
326
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RealtimeSessionThreadComponent, { className: "RealtimeSessionThreadComponent", filePath: "src/lib/components/realtime/realtime-session-thread.component.ts", lineNumber:
|
|
411
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RealtimeSessionThreadComponent, { className: "RealtimeSessionThreadComponent", filePath: "src/lib/components/realtime/realtime-session-thread.component.ts", lineNumber: 126 }); })();
|
|
327
412
|
//# sourceMappingURL=realtime-session-thread.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-session-thread.component.js","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-session-thread.component.ts","../../../../src/lib/components/realtime/realtime-session-thread.component.html"],"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OAAO,CAAC,gCAAgC,EAAE,QAAQ,CAAC,CAAC;QACtE,8FAA8F;QAC9F,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,wCAAwC,EAAE,YAAY,CAAC,CAAC;QAClF,kHAAkH;QAClH,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,iCAAiC,EAAE,MAAM,CAAC,CAAC;QACrE,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,gFAAgF;IACxE,cAAc;QACpB,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YACjD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;QAC7C,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,CAAC;IAC3B,CAAC;wHApIU,8BAA8B;6DAA9B,8BAA8B;;;;;;YC7B3C,8BAAoB;YAClB,gLAyEC;YACD,+BAAyB;YAC3B,iBAAM;;YA3EJ,cAyEC;YAzED,8BAyEC;4BDjDS,YAAY,EAAE,+BAA+B,EAAE,cAAc;;iFAI5D,8BAA8B;cAP1C,SAAS;6BACI,IAAI,YACN,4BAA4B,WAC7B,CAAC,YAAY,EAAE,+BAA+B,EAAE,cAAc,CAAC;;kBAKvE,SAAS;mBAAC,cAAc;;kBAGxB,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;mBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;kBAGxB,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAGL,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kFAhCI,8BAA8B","sourcesContent":["import {\n Component, EventEmitter, Input, Output, ElementRef, ViewChild, AfterViewChecked, OnInit, OnDestroy,\n ChangeDetectorRef, inject\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MarkdownModule } from '@memberjunction/ng-markdown';\nimport { Subscription } from 'rxjs';\nimport { RealtimeSessionState, RealtimeThreadItem } from './realtime-session-state';\nimport { RealtimeDelegationCardComponent } from './realtime-delegation-card.component';\nimport { ParsedDelegationArtifact } from '@memberjunction/realtime-runtime';\n\n/**\n * The unified, chronological live thread for the call overlay: caption bubbles\n * interleaved with delegation cards exactly where they happened.\n *\n * PURELY PRESENTATIONAL over {@link RealtimeSessionState} — the overlay shell owns the\n * state object (which merges the service streams once) and passes it here AND to the\n * activity rail, so there is exactly one copy of the per-CallID merge logic.\n *\n * Also renders the EPHEMERAL narration \"live note\": indented, muted, italic text under\n * the ACTIVE working card (latest narration only — replaced, never accumulated).\n */\n@Component({\n standalone: true,\n selector: 'mj-realtime-session-thread',\n imports: [CommonModule, RealtimeDelegationCardComponent, MarkdownModule],\n templateUrl: './realtime-session-thread.component.html',\n styleUrl: './realtime-session-thread.component.css'\n})\nexport class RealtimeSessionThreadComponent implements OnInit, AfterViewChecked, OnDestroy {\n @ViewChild('scrollAnchor') private scrollAnchor?: ElementRef<HTMLElement>;\n\n /** Display name of the agent (caption avatar / meta line). */\n @Input() AgentName = 'Sage';\n\n /**\n * Display name of the signed-in user for their turns — consistent with the main\n * chat's sender names, and ready for multi-user sessions where \"You\" stops meaning\n * anything. Hosts bind the current user's name; the default keeps old hosts working.\n */\n @Input() UserName = 'You';\n\n /** Shared live-session state, owned by the overlay shell. */\n @Input({ required: true }) State!: RealtimeSessionState;\n\n /** Whether to render caption bubbles (toggled by the controls' captions button). */\n @Input() ShowCaptions = true;\n\n /** Whether developer affordances on delegation cards are revealed (gear-gated). */\n @Input() DevMode = false;\n\n /** Whether inline markdown links in caption bubbles open in a new browser tab. Default true. */\n @Input() OpenLinksInNewTab = true;\n\n /** Re-emitted from a delegation card's dev \"Open run\" link (the delegated run's ID). */\n @Output() OpenRunRequested = new EventEmitter<string>();\n\n /** Re-emitted from a delegation card's \"View\" artifact chip (focuses the artifact's surface tab). */\n @Output() OpenArtifactRequested = new EventEmitter<ParsedDelegationArtifact>();\n\n /** Re-emitted from a WORKING delegation card's ✕ cancel affordance (the call's ID). */\n @Output() CancelRequested = new EventEmitter<string>();\n\n /** Item count at the last change notification, to auto-scroll only when the list grows. */\n private lastItemCount = 0;\n /** Drives auto-scroll: set whenever the list grows. */\n private pendingScroll = false;\n\n private changedSub?: Subscription;\n private cdr = inject(ChangeDetectorRef, { optional: true });\n\n ngOnInit(): void {\n this.changedSub = this.State.Changed$.subscribe(() => this.onStateChanged());\n this.lastItemCount = this.State.Items.length;\n }\n\n ngAfterViewChecked(): void {\n if (this.pendingScroll) {\n this.pendingScroll = false;\n this.scrollAnchor?.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'end' });\n }\n }\n\n ngOnDestroy(): void {\n this.changedSub?.unsubscribe();\n }\n\n /** track fn for the @for over thread items. */\n public TrackItem(index: number, item: RealtimeThreadItem): string {\n switch (item.Kind) {\n case 'delegation': return `d:${item.Card.CallID}`;\n case 'divider': return `s:${index}`;\n default: return `c:${index}`;\n }\n }\n\n /** True when the live narration note should render under THIS delegation item. */\n public ShowsLiveNote(item: RealtimeThreadItem): boolean {\n return item.Kind === 'delegation'\n && !item.Card.Done\n && this.State.Narration !== null\n && item.Card.CallID === this.State.ActiveCallId;\n }\n\n /** Set of item indices whose long text has been expanded by the user. */\n public ExpandedItems = new Set<number>();\n\n /**\n * Returns true when the caption text is considered a \"long blob\" (>280 chars or >4 lines)\n * that warrants height clamping and an expand/collapse toggle.\n */\n public IsLongText(text: string | null | undefined): boolean {\n if (!text) {\n return false;\n }\n return text.length > 280 || text.split('\\n').length > 4;\n }\n\n /** Returns whether the caption item at the specified index is expanded. */\n public IsExpanded(index: number): boolean {\n return this.ExpandedItems.has(index);\n }\n\n /** Toggles expanded/collapsed state for the caption item at the given index. */\n public ToggleExpanded(index: number, event?: Event): void {\n if (event) {\n event.stopPropagation();\n }\n if (this.ExpandedItems.has(index)) {\n this.ExpandedItems.delete(index);\n } else {\n this.ExpandedItems.add(index);\n }\n this.cdr?.markForCheck();\n }\n\n /**\n * Prepares text for markdown rendering, restoring structure (headings, horizontal rules,\n * bullet items) if newlines were stripped by single-line input paste or speech-to-text.\n */\n public FormatMarkdownText(text: string | null | undefined): string {\n if (!text) {\n return '';\n }\n let cleaned = text;\n // Restore newlines before markdown headings on same line: \"Title ### Heading\" -> \"Title\\n\\n### Heading\"\n cleaned = cleaned.replace(/[ \\t]+(?:—\\s*)?(#{1,6}[ \\t]+)/g, '\\n\\n$1');\n // Restore newlines around horizontal rules on same line: \"Text --- ##\" -> \"Text\\n\\n---\\n\\n##\"\n cleaned = cleaned.replace(/[ \\t]+(?:—\\s*)?(---|___|\\*\\*\\*)[ \\t]*/g, '\\n\\n$1\\n\\n');\n // Restore newlines before bullet items on same line: \"around: - Item 1 - Item 2\" -> \"around:\\n- Item 1\\n- Item 2\"\n cleaned = cleaned.replace(/[ \\t]+-[ \\t]+(?=[A-Za-z0-9\\*])/g, '\\n- ');\n return cleaned;\n }\n\n /** Marks for check on every state change; auto-scrolls when the thread grew. */\n private onStateChanged(): void {\n if (this.State.Items.length > this.lastItemCount) {\n this.pendingScroll = true;\n }\n this.lastItemCount = this.State.Items.length;\n this.cdr?.markForCheck();\n }\n}\n","<div class=\"thread\">\n @for (item of State.Items; track TrackItem($index, item)) {\n @switch (item.Kind) {\n @case ('caption') {\n @if (ShowCaptions) {\n <div class=\"turn\" [class.turn--user]=\"item.Role === 'User'\" [class.turn--agent]=\"item.Role === 'Assistant'\">\n <div class=\"turn-avatar\">{{ (item.Role === 'User' ? UserName : AgentName).charAt(0).toUpperCase() }}</div>\n <div class=\"turn-body\">\n <div class=\"turn-meta\">\n @if (item.Role === 'User') {\n <span class=\"typed-tag\">{{ UserName }}</span>\n } @else {\n {{ AgentName }} <span class=\"muted\">· voice</span>\n }\n </div>\n <div class=\"bubble\" [class.bubble--clamped]=\"IsLongText(item.Text) && !IsExpanded($index)\" [class.bubble--expanded]=\"IsLongText(item.Text) && IsExpanded($index)\">\n <div class=\"bubble-content\" [class.bubble-content--clamped]=\"IsLongText(item.Text) && !IsExpanded($index)\" [class.bubble-content--expanded]=\"IsLongText(item.Text) && IsExpanded($index)\">\n <mj-markdown [data]=\"FormatMarkdownText(item.Text)\" [enableCollapsibleHeadings]=\"true\" [OpenLinksInNewTab]=\"OpenLinksInNewTab\"></mj-markdown>\n </div>\n @if (IsLongText(item.Text)) {\n <div class=\"bubble-actions\">\n <button\n type=\"button\"\n class=\"bubble-expand-btn\"\n (click)=\"ToggleExpanded($index, $event)\"\n [attr.aria-expanded]=\"IsExpanded($index)\">\n <span>{{ IsExpanded($index) ? 'Show less' : 'Show more' }}</span>\n <i class=\"fa-solid\" [class.fa-chevron-up]=\"IsExpanded($index)\" [class.fa-chevron-down]=\"!IsExpanded($index)\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n </div>\n </div>\n </div>\n }\n }\n @case ('divider') {\n <!-- Session-leg boundary: subtle rule marking a resume / chained leg -->\n <div class=\"thread-divider\" role=\"separator\">\n <span class=\"thread-divider__line\" aria-hidden=\"true\"></span>\n <span class=\"thread-divider__label\">\n <i [class]=\"item.Icon\" aria-hidden=\"true\"></i>\n {{ item.Label }}\n @if (item.At) {\n <span class=\"thread-divider__time\">· {{ item.At | date:'MMM d, h:mm a' }}</span>\n }\n </span>\n @if (item.CloseReason) {\n <span class=\"thread-divider__chip\" title=\"Why the previous session leg ended\">{{ item.CloseReason }}</span>\n }\n <span class=\"thread-divider__line\" aria-hidden=\"true\"></span>\n </div>\n }\n @case ('delegation') {\n <div class=\"delegation-block\">\n <mj-realtime-delegation-card\n [Card]=\"item.Card\"\n [DevMode]=\"DevMode\"\n (OpenRunRequested)=\"OpenRunRequested.emit($event)\"\n (OpenArtifactRequested)=\"OpenArtifactRequested.emit($event)\"\n (CancelRequested)=\"CancelRequested.emit($event)\">\n </mj-realtime-delegation-card>\n @if (ShowsLiveNote(item)) {\n <!-- Ephemeral narration: latest only, never persisted, fades with completion -->\n <div class=\"live-note\" role=\"status\" aria-live=\"polite\">\n <i class=\"fa-solid fa-comment-dots\" aria-hidden=\"true\"></i>\n {{ State.Narration }}\n </div>\n }\n </div>\n }\n }\n } @empty {\n <div class=\"thread-empty\">The live transcript and any delegated work will appear here.</div>\n }\n <div #scrollAnchor></div>\n</div>\n"]}
|
|
1
|
+
{"version":3,"file":"realtime-session-thread.component.js","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-session-thread.component.ts","../../../../src/lib/components/realtime/realtime-session-thread.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAc,SAAS,EAC7D,iBAAiB,EAAE,MAAM,EAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;;;;;;ICErE,gCAAwB;IAAA,YAAc;IAAA,iBAAO;;;IAArB,cAAc;IAAd,qCAAc;;;IAEtC,YAAgB;IAAA,gCAAoB;IAAA,4BAAO;IAAA,iBAAO;;;IAAlD,iDAAgB;;;;IASd,AADF,+BAA4B,iBAKkB;IAD1C,kRAAS,wCAA8B,KAAC;IAExC,4BAAM;IAAA,YAAoD;IAAA,iBAAO;IACjE,wBAAoI;IAExI,AADE,iBAAS,EACL;;;;IAJF,cAAyC;;IACnC,eAAoD;IAApD,8EAAoD;IACtC,cAA0C;IAAC,AAA3C,6DAA0C,kDAA8C;;;IArBtH,AADF,8BAA4G,aACjF;IAAA,YAA2E;IAAA,iBAAM;IAExG,AADF,8BAAuB,aACE;IAGnB,AAFF,6HAA4B,2FAEnB;IAGX,iBAAM;IAEJ,AADF,+BAAkK,cAC0B;IACxL,kCAA6I;IAC/I,iBAAM;IACN,8HAA6B;IAcnC,AADE,AADE,iBAAM,EACF,EACF;;;;;;IA5BsD,AAA1C,qDAAyC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AAO,EAAE,QAAQ,CAAC,CAAC;QACnD,kHAAkH;QAClH,OAAO,GAAG,qBAAqB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACrD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,gFAAgF;IACxE,cAAc;QACpB,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YACjD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;QAC7C,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,CAAC;IAC3B,CAAC;wHAtIU,8BAA8B;6DAA9B,8BAA8B;;;;;;YC7H3C,8BAAoB;YAClB,gLAyEC;YACD,+BAAyB;YAC3B,iBAAM;;YA3EJ,cAyEC;YAzED,8BAyEC;4BD+CS,YAAY,EAAE,+BAA+B,EAAE,cAAc;;iFAI5D,8BAA8B;cAP1C,SAAS;6BACI,IAAI,YACN,4BAA4B,WAC7B,CAAC,YAAY,EAAE,+BAA+B,EAAE,cAAc,CAAC;;kBAKvE,SAAS;mBAAC,cAAc;;kBAGxB,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;mBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;kBAGxB,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAGL,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kFAhCI,8BAA8B","sourcesContent":["import {\n Component, EventEmitter, Input, Output, ElementRef, ViewChild, AfterViewChecked, OnInit, OnDestroy,\n ChangeDetectorRef, inject\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MarkdownModule } from '@memberjunction/ng-markdown';\nimport { Subscription } from 'rxjs';\nimport { RealtimeSessionState, RealtimeThreadItem } from './realtime-session-state';\nimport { RealtimeDelegationCardComponent } from './realtime-delegation-card.component';\nimport { ParsedDelegationArtifact } from '@memberjunction/realtime-runtime';\n\nfunction isBlank(c: string): boolean {\n return c === ' ' || c === '\\t';\n}\n\n/** Index just past the spaces and tabs starting at `from`. */\nfunction skipBlanks(text: string, from: number): number {\n let i = from;\n while (i < text.length && isBlank(text[i])) {\n i++;\n }\n return i;\n}\n\n/** Index past an optional `—` and the whitespace after it (the `(?:—\\s*)?` of a pattern). */\nfunction skipEmDash(text: string, at: number): number {\n if (text[at] !== '—') {\n return at;\n }\n let i = at + 1;\n while (i < text.length && /\\s/.test(text[i])) {\n i++;\n }\n return i;\n}\n\n/** What a {@link replaceAfterBlankRuns} tail matched: the text to write and where the match ends. */\ninterface BlankRunTail {\n Replacement: string;\n End: number;\n}\n\n/**\n * Replace each run of spaces or tabs that `tail` accepts, together with what `tail` matched after it,\n * left to right. This is `.replace(/[ \\t]+<tail>/g, …)` for a tail that cannot start with a space or\n * tab, scanned once: the regex retries from every position inside a long run of spaces with no tail\n * after it, which is quadratic (CodeQL js/polynomial-redos). A match can only start where a run\n * starts, since starting later reaches the same run end.\n */\nfunction replaceAfterBlankRuns(text: string, tail: (text: string, at: number) => BlankRunTail | null): string {\n let out = '';\n let copied = 0;\n let i = 0;\n while (i < text.length) {\n if (!isBlank(text[i])) {\n i++;\n continue;\n }\n const runStart = i;\n i = skipBlanks(text, i);\n const match = tail(text, i);\n if (match) {\n out += text.slice(copied, runStart) + match.Replacement;\n copied = match.End;\n i = match.End;\n }\n }\n return out + text.slice(copied);\n}\n\n/** `(?:—\\s*)?(#{1,6}[ \\t]+)` → a blank line, then the hashes and their spaces. */\nfunction headingTail(text: string, at: number): BlankRunTail | null {\n const start = skipEmDash(text, at);\n let hashEnd = start;\n while (hashEnd < text.length && text[hashEnd] === '#') {\n hashEnd++;\n }\n const hashes = hashEnd - start;\n if (hashes < 1 || hashes > 6 || !isBlank(text[hashEnd] ?? '')) {\n return null;\n }\n const end = skipBlanks(text, hashEnd);\n return { Replacement: '\\n\\n' + text.slice(start, end), End: end };\n}\n\n/** `(?:—\\s*)?(---|___|\\*\\*\\*)[ \\t]*` → the rule on its own paragraph. */\nfunction ruleTail(text: string, at: number): BlankRunTail | null {\n const start = skipEmDash(text, at);\n const rule = ['---', '___', '***'].find((r) => text.startsWith(r, start));\n if (!rule) {\n return null;\n }\n return { Replacement: `\\n\\n${rule}\\n\\n`, End: skipBlanks(text, start + rule.length) };\n}\n\n/** `-[ \\t]+(?=[A-Za-z0-9\\*])` → a new `- ` list line. */\nfunction bulletTail(text: string, at: number): BlankRunTail | null {\n if (text[at] !== '-') {\n return null;\n }\n const end = skipBlanks(text, at + 1);\n if (end === at + 1 || !/[A-Za-z0-9*]/.test(text[end] ?? '')) {\n return null;\n }\n return { Replacement: '\\n- ', End: end };\n}\n\n/**\n * The unified, chronological live thread for the call overlay: caption bubbles\n * interleaved with delegation cards exactly where they happened.\n *\n * PURELY PRESENTATIONAL over {@link RealtimeSessionState} — the overlay shell owns the\n * state object (which merges the service streams once) and passes it here AND to the\n * activity rail, so there is exactly one copy of the per-CallID merge logic.\n *\n * Also renders the EPHEMERAL narration \"live note\": indented, muted, italic text under\n * the ACTIVE working card (latest narration only — replaced, never accumulated).\n */\n@Component({\n standalone: true,\n selector: 'mj-realtime-session-thread',\n imports: [CommonModule, RealtimeDelegationCardComponent, MarkdownModule],\n templateUrl: './realtime-session-thread.component.html',\n styleUrl: './realtime-session-thread.component.css'\n})\nexport class RealtimeSessionThreadComponent implements OnInit, AfterViewChecked, OnDestroy {\n @ViewChild('scrollAnchor') private scrollAnchor?: ElementRef<HTMLElement>;\n\n /** Display name of the agent (caption avatar / meta line). */\n @Input() AgentName = 'Sage';\n\n /**\n * Display name of the signed-in user for their turns — consistent with the main\n * chat's sender names, and ready for multi-user sessions where \"You\" stops meaning\n * anything. Hosts bind the current user's name; the default keeps old hosts working.\n */\n @Input() UserName = 'You';\n\n /** Shared live-session state, owned by the overlay shell. */\n @Input({ required: true }) State!: RealtimeSessionState;\n\n /** Whether to render caption bubbles (toggled by the controls' captions button). */\n @Input() ShowCaptions = true;\n\n /** Whether developer affordances on delegation cards are revealed (gear-gated). */\n @Input() DevMode = false;\n\n /** Whether inline markdown links in caption bubbles open in a new browser tab. Default true. */\n @Input() OpenLinksInNewTab = true;\n\n /** Re-emitted from a delegation card's dev \"Open run\" link (the delegated run's ID). */\n @Output() OpenRunRequested = new EventEmitter<string>();\n\n /** Re-emitted from a delegation card's \"View\" artifact chip (focuses the artifact's surface tab). */\n @Output() OpenArtifactRequested = new EventEmitter<ParsedDelegationArtifact>();\n\n /** Re-emitted from a WORKING delegation card's ✕ cancel affordance (the call's ID). */\n @Output() CancelRequested = new EventEmitter<string>();\n\n /** Item count at the last change notification, to auto-scroll only when the list grows. */\n private lastItemCount = 0;\n /** Drives auto-scroll: set whenever the list grows. */\n private pendingScroll = false;\n\n private changedSub?: Subscription;\n private cdr = inject(ChangeDetectorRef, { optional: true });\n\n ngOnInit(): void {\n this.changedSub = this.State.Changed$.subscribe(() => this.onStateChanged());\n this.lastItemCount = this.State.Items.length;\n }\n\n ngAfterViewChecked(): void {\n if (this.pendingScroll) {\n this.pendingScroll = false;\n this.scrollAnchor?.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'end' });\n }\n }\n\n ngOnDestroy(): void {\n this.changedSub?.unsubscribe();\n }\n\n /** track fn for the @for over thread items. */\n public TrackItem(index: number, item: RealtimeThreadItem): string {\n switch (item.Kind) {\n case 'delegation': return `d:${item.Card.CallID}`;\n case 'divider': return `s:${index}`;\n default: return `c:${index}`;\n }\n }\n\n /** True when the live narration note should render under THIS delegation item. */\n public ShowsLiveNote(item: RealtimeThreadItem): boolean {\n return item.Kind === 'delegation'\n && !item.Card.Done\n && this.State.Narration !== null\n && item.Card.CallID === this.State.ActiveCallId;\n }\n\n /** Set of item indices whose long text has been expanded by the user. */\n public ExpandedItems = new Set<number>();\n\n /**\n * Returns true when the caption text is considered a \"long blob\" (>280 chars or >4 lines)\n * that warrants height clamping and an expand/collapse toggle.\n */\n public IsLongText(text: string | null | undefined): boolean {\n if (!text) {\n return false;\n }\n return text.length > 280 || text.split('\\n').length > 4;\n }\n\n /** Returns whether the caption item at the specified index is expanded. */\n public IsExpanded(index: number): boolean {\n return this.ExpandedItems.has(index);\n }\n\n /** Toggles expanded/collapsed state for the caption item at the given index. */\n public ToggleExpanded(index: number, event?: Event): void {\n if (event) {\n event.stopPropagation();\n }\n if (this.ExpandedItems.has(index)) {\n this.ExpandedItems.delete(index);\n } else {\n this.ExpandedItems.add(index);\n }\n this.cdr?.markForCheck();\n }\n\n /**\n * Prepares text for markdown rendering, restoring structure (headings, horizontal rules,\n * bullet items) if newlines were stripped by single-line input paste or speech-to-text.\n */\n public FormatMarkdownText(text: string | null | undefined): string {\n if (!text) {\n return '';\n }\n let cleaned = text;\n // Restore newlines before markdown headings on same line: \"Title ### Heading\" -> \"Title\\n\\n### Heading\"\n // Each step scans by index rather than with `/[ \\t]+…/g`, which is quadratic on a long run of\n // spaces (CodeQL js/polynomial-redos); see replaceAfterBlankRuns.\n cleaned = replaceAfterBlankRuns(cleaned, headingTail);\n // Restore newlines around horizontal rules on same line: \"Text --- ##\" -> \"Text\\n\\n---\\n\\n##\"\n cleaned = replaceAfterBlankRuns(cleaned, ruleTail);\n // Restore newlines before bullet items on same line: \"around: - Item 1 - Item 2\" -> \"around:\\n- Item 1\\n- Item 2\"\n cleaned = replaceAfterBlankRuns(cleaned, bulletTail);\n return cleaned;\n }\n\n /** Marks for check on every state change; auto-scrolls when the thread grew. */\n private onStateChanged(): void {\n if (this.State.Items.length > this.lastItemCount) {\n this.pendingScroll = true;\n }\n this.lastItemCount = this.State.Items.length;\n this.cdr?.markForCheck();\n }\n}\n","<div class=\"thread\">\n @for (item of State.Items; track TrackItem($index, item)) {\n @switch (item.Kind) {\n @case ('caption') {\n @if (ShowCaptions) {\n <div class=\"turn\" [class.turn--user]=\"item.Role === 'User'\" [class.turn--agent]=\"item.Role === 'Assistant'\">\n <div class=\"turn-avatar\">{{ (item.Role === 'User' ? UserName : AgentName).charAt(0).toUpperCase() }}</div>\n <div class=\"turn-body\">\n <div class=\"turn-meta\">\n @if (item.Role === 'User') {\n <span class=\"typed-tag\">{{ UserName }}</span>\n } @else {\n {{ AgentName }} <span class=\"muted\">· voice</span>\n }\n </div>\n <div class=\"bubble\" [class.bubble--clamped]=\"IsLongText(item.Text) && !IsExpanded($index)\" [class.bubble--expanded]=\"IsLongText(item.Text) && IsExpanded($index)\">\n <div class=\"bubble-content\" [class.bubble-content--clamped]=\"IsLongText(item.Text) && !IsExpanded($index)\" [class.bubble-content--expanded]=\"IsLongText(item.Text) && IsExpanded($index)\">\n <mj-markdown [data]=\"FormatMarkdownText(item.Text)\" [enableCollapsibleHeadings]=\"true\" [OpenLinksInNewTab]=\"OpenLinksInNewTab\"></mj-markdown>\n </div>\n @if (IsLongText(item.Text)) {\n <div class=\"bubble-actions\">\n <button\n type=\"button\"\n class=\"bubble-expand-btn\"\n (click)=\"ToggleExpanded($index, $event)\"\n [attr.aria-expanded]=\"IsExpanded($index)\">\n <span>{{ IsExpanded($index) ? 'Show less' : 'Show more' }}</span>\n <i class=\"fa-solid\" [class.fa-chevron-up]=\"IsExpanded($index)\" [class.fa-chevron-down]=\"!IsExpanded($index)\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n </div>\n </div>\n </div>\n }\n }\n @case ('divider') {\n <!-- Session-leg boundary: subtle rule marking a resume / chained leg -->\n <div class=\"thread-divider\" role=\"separator\">\n <span class=\"thread-divider__line\" aria-hidden=\"true\"></span>\n <span class=\"thread-divider__label\">\n <i [class]=\"item.Icon\" aria-hidden=\"true\"></i>\n {{ item.Label }}\n @if (item.At) {\n <span class=\"thread-divider__time\">· {{ item.At | date:'MMM d, h:mm a' }}</span>\n }\n </span>\n @if (item.CloseReason) {\n <span class=\"thread-divider__chip\" title=\"Why the previous session leg ended\">{{ item.CloseReason }}</span>\n }\n <span class=\"thread-divider__line\" aria-hidden=\"true\"></span>\n </div>\n }\n @case ('delegation') {\n <div class=\"delegation-block\">\n <mj-realtime-delegation-card\n [Card]=\"item.Card\"\n [DevMode]=\"DevMode\"\n (OpenRunRequested)=\"OpenRunRequested.emit($event)\"\n (OpenArtifactRequested)=\"OpenArtifactRequested.emit($event)\"\n (CancelRequested)=\"CancelRequested.emit($event)\">\n </mj-realtime-delegation-card>\n @if (ShowsLiveNote(item)) {\n <!-- Ephemeral narration: latest only, never persisted, fades with completion -->\n <div class=\"live-note\" role=\"status\" aria-live=\"polite\">\n <i class=\"fa-solid fa-comment-dots\" aria-hidden=\"true\"></i>\n {{ State.Narration }}\n </div>\n }\n </div>\n }\n }\n } @empty {\n <div class=\"thread-empty\">The live transcript and any delegated work will appear here.</div>\n }\n <div #scrollAnchor></div>\n</div>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-surface-stage.model.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-stage.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoE,KAAK,kBAAkB,EAAqB,MAAM,0CAA0C,CAAC;AACxK,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAChG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAElF;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,yBAAyB;IACpC,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgD;IACxE,6DAA6D;IAC7D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;IAC1C,OAAO,CAAC,KAAK,CAA4B;IACzC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,UAAU,CAAuD;IACzE,iDAAiD;IACjD,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,iBAAiB,CAAkE;IAE3F,mHAAmH;IACnH,IAAW,QAAQ,IAAI,SAAS,iBAAiB,EAAE,CAElD;IAED,yGAAyG;IACzG,IAAW,UAAU,IAAI,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAEhE;IAED,iHAAiH;IACjH,IAAW,iBAAiB,IAAI,WAAW,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC,CAElF;IAED,4EAA4E;IAC5E,IAAW,KAAK,IAAI,SAAS,kBAAkB,EAAE,CAEhD;IAED,4DAA4D;IAC5D,IAAW,QAAQ,IAAI,MAAM,GAAG,IAAI,CAOnC;IAED,wEAAwE;IACjE,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,GAAG,IAAI;IAI/D,4GAA4G;IACrG,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,mBAAmB,EAAE;IAI9D;;;OAGG;IACI,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB;IAK1D,iHAAiH;IAC1G,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI;IAMxD,iHAAiH;IAC1G,QAAQ,CAAC,QAAQ,EAAE,SAAS,yBAAyB,EAAE,GAAG,IAAI;IAWrE,iHAAiH;IAC1G,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAK7C,+DAA+D;IACxD,SAAS,CAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,GAAG,IAAI;IAK5D;;;OAGG;IACI,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,GAAG,OAAO;IASjE,+EAA+E;IACxE,WAAW,IAAI,IAAI;IAK1B,OAAO,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"realtime-surface-stage.model.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-stage.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoE,KAAK,kBAAkB,EAAqB,MAAM,0CAA0C,CAAC;AACxK,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM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Y,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAK7C,+DAA+D;IACxD,SAAS,CAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,GAAG,IAAI;IAK5D;;;OAGG;IACI,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,GAAG,OAAO;IASjE,+EAA+E;IACxE,WAAW,IAAI,IAAI;IAK1B,OAAO,CAAC,MAAM;IAcd,mHAAmH;IACnH,OAAO,CAAC,uBAAuB;IAO/B,iHAAiH;IACjH,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,iBAAiB;CAc1B"}
|
|
@@ -116,7 +116,8 @@ export class RealtimeSurfaceStageModel {
|
|
|
116
116
|
update() {
|
|
117
117
|
this.resolvePlacements();
|
|
118
118
|
for (const [key, placement] of this.placements) {
|
|
119
|
-
|
|
119
|
+
const carriesAgentVideo = this.plugins.get(key)?.ShowsAgentVideo === true;
|
|
120
|
+
if (placement === 'stage' || placement === 'pip' || (placement === 'tab' && (key === this.activeTabKey || carriesAgentVideo))) {
|
|
120
121
|
this.seen.add(key);
|
|
121
122
|
}
|
|
122
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-surface-stage.model.js","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-stage.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,wBAAwB,EAA8C,MAAM,0CAA0C,CAAC;AAIxK;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,yBAAyB;IACpC,2EAA2E;IAC1D,OAAO,GAAG,IAAI,GAAG,EAAqC,CAAC;IACxE,6DAA6D;IAC5C,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KAAK,GAAyB,EAAE,CAAC;IACjC,YAAY,GAAkB,IAAI,CAAC;IACnC,UAAU,GAA6C,IAAI,GAAG,EAAE,CAAC;IACzE,iDAAiD;IACz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,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC;AAC3F,CAAC;AAED,SAAS,YAAY,CAAC,CAA+B,EAAE,CAA+B;IACpF,OAAO,CACL,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QACrB,CAAC,CAAC,KAAK,CACL,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CACb,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,OAAO,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CACzI,CACF,CAAC;AACJ,CAAC","sourcesContent":["import { PlacementOffStage, RecordPlacementMove, ResolveSurfacePlacements, type MediaPlacementMove, type MediaSurface } from '@memberjunction/ai-realtime-client/media';\nimport type { MediaStagePlacement, MediaStageSurface } from '@memberjunction/ng-realtime-media';\nimport type { BaseRealtimeChannelClient } from '@memberjunction/realtime-runtime';\n\n/**\n * Which channel surfaces the call overlay's stage (`mj-media-stage`) holds, and where each one shows.\n *\n * **Placement.** Every surface starts where its channel's registry row places it (`SurfacePlacement`: its tab, unless the\n * row says otherwise). The user moves it to the stage (it fills the call), into a picture-in-picture box, to its tab, or\n * out of sight, within the placements the row allows; the moves are kept in order, one per surface, and resolved by\n * `ResolveSurfacePlacements`, so the most recent move to the stage wins it, the surface it displaces returns to where its\n * channel places it, and picture-in-picture boxes stack newest first. The host saves {@link Moves} and loads them back\n * ({@link LoadMoves}), so a layout carries over to later sessions.\n *\n * **Creation.** A channel's surface is created the first time it is seen (its tab shows it, or it is on the stage or\n * in a picture-in-picture box) and kept until the channel leaves the session. Moving it, hiding the panel or switching tabs only changes where it\n * shows, so a whiteboard keeps its view and a stream keeps playing.\n *\n * Pure state with no Angular: the overlay reports the session's channels, the channel tab the panel is showing and\n * the user's moves, and binds {@link Surfaces} to the stage.\n */\nexport class RealtimeSurfaceStageModel {\n /** Channels with a surface, by key, in the order their tabs registered. */\n private readonly plugins = new Map<string, BaseRealtimeChannelClient>();\n /** Keys whose surface has been seen, so it stays created. */\n private readonly seen = new Set<string>();\n private moves: MediaPlacementMove[] = [];\n private activeTabKey: string | null = null;\n private placements: ReadonlyMap<string, MediaStagePlacement> = new Map();\n /** Picture-in-picture surfaces, newest first. */\n private pipOrder: readonly string[] = [];\n private surfaces: readonly MediaStageSurface[] = [];\n private allowedPlacements: ReadonlyMap<string, readonly MediaStagePlacement[]> = new Map();\n\n /** The stage's surfaces. The array is replaced only when a surface or a placement changes, so it binds cheaply. */\n public get Surfaces(): readonly MediaStageSurface[] {\n return this.surfaces;\n }\n\n /** Where each registered channel's surface is placed, by key. Replaced only when a placement changes. */\n public get Placements(): ReadonlyMap<string, MediaStagePlacement> {\n return this.placements;\n }\n\n /** Where the user may move each registered channel's surface, by key. Replaced only when the channels change. */\n public get AllowedPlacements(): ReadonlyMap<string, readonly MediaStagePlacement[]> {\n return this.allowedPlacements;\n }\n\n /** The user's moves, oldest first, one per surface: what the host saves. */\n public get Moves(): readonly MediaPlacementMove[] {\n return this.moves;\n }\n\n /** The channel whose surface is on the stage, or `null`. */\n public get StageKey(): string | null {\n for (const [key, placement] of this.placements) {\n if (placement === 'stage') {\n return key;\n }\n }\n return null;\n }\n\n /** The plugin behind a surface, or `null` once its channel has left. */\n public PluginFor(key: string): BaseRealtimeChannelClient | null {\n return this.plugins.get(key) ?? null;\n }\n\n /** Where the user may move a channel's surface; nowhere for a channel without a surface in this session. */\n public AllowedFor(key: string): readonly MediaStagePlacement[] {\n return this.allowedPlacements.get(key) ?? [];\n }\n\n /**\n * Where a channel's surface goes when it leaves the stage (the user leaves the focus layout, or the channel lets go of\n * it): where its channel places it, or the first of picture-in-picture, tab and hidden that it allows.\n */\n public OffStagePlacement(key: string): MediaStagePlacement {\n const plugin = this.plugins.get(key);\n return plugin ? PlacementOffStage(surfaceOf(plugin)) : 'tab';\n }\n\n /** A channel with a surface got its tab. Registering its key again follows the channel's new plugin instance. */\n public Register(plugin: BaseRealtimeChannelClient): void {\n this.plugins.set(plugin.ChannelName, plugin);\n this.updateAllowedPlacements();\n this.update();\n }\n\n /** The session's channels changed: a surface whose plugin is no longer among them is dropped. Moves are kept. */\n public KeepOnly(channels: readonly BaseRealtimeChannelClient[]): void {\n for (const [key, plugin] of [...this.plugins]) {\n if (!channels.includes(plugin)) {\n this.plugins.delete(key);\n this.seen.delete(key);\n }\n }\n this.updateAllowedPlacements();\n this.update();\n }\n\n /** The channel whose tab the panel is showing, or `null` when it shows none (another tab, collapsed, hidden). */\n public SetActiveTab(key: string | null): void {\n this.activeTabKey = key;\n this.update();\n }\n\n /** Starts from saved moves, such as the user's last layout. */\n public LoadMoves(moves: readonly MediaPlacementMove[]): void {\n this.moves = [...moves];\n this.update();\n }\n\n /**\n * Moves a channel's surface. Returns `false`, changing nothing, for a channel without a surface in this session, a\n * placement its channel does not allow, or the placement it already has.\n */\n public Move(key: string, placement: MediaStagePlacement): boolean {\n if (!this.AllowedFor(key).includes(placement) || this.placements.get(key) === placement) {\n return false;\n }\n this.moves = RecordPlacementMove(this.moves, { SurfaceKey: key, Placement: placement });\n this.update();\n return true;\n }\n\n /** Forgets every move: each surface returns to where its channel places it. */\n public ResetLayout(): void {\n this.moves = [];\n this.update();\n }\n\n private update(): void {\n this.resolvePlacements();\n for (const [key, placement] of this.placements) {\n if (placement === 'stage' || placement === 'pip' || (placement === 'tab' && key === this.activeTabKey)) {\n this.seen.add(key);\n }\n }\n const surfaces = [...this.plugins.keys()].filter((key) => this.seen.has(key)).map((key) => this.surfaceFor(key));\n if (!sameSurfaces(surfaces, this.surfaces)) {\n this.surfaces = surfaces;\n }\n }\n\n /** Rebuilds {@link AllowedPlacements} from the registered channels, keeping the map when nothing in it changed. */\n private updateAllowedPlacements(): void {\n const allowed = new Map([...this.plugins].map(([key, plugin]) => [key, plugin.SurfacePlacement.Allowed]));\n if (!sameAllowedPlacements(allowed, this.allowedPlacements)) {\n this.allowedPlacements = allowed;\n }\n }\n\n /** A stage surface for a channel: its placement, its name, and where it stacks when it is picture-in-picture. */\n private surfaceFor(key: string): MediaStageSurface {\n const placement = this.placements.get(key) ?? 'tab';\n const surface: MediaStageSurface = { Key: key, Placement: placement, Label: this.plugins.get(key)?.TabTitle };\n return placement === 'pip' ? { ...surface, PipIndex: this.pipOrder.indexOf(key) } : surface;\n }\n\n private resolvePlacements(): void {\n const resolved = ResolveSurfacePlacements([...this.plugins.values()].map(surfaceOf), this.moves);\n const placements = new Map<string, MediaStagePlacement>();\n if (resolved.Stage) {\n placements.set(resolved.Stage.Key, 'stage');\n }\n resolved.Pips.forEach((surface) => placements.set(surface.Key, 'pip'));\n resolved.Tabs.forEach((surface) => placements.set(surface.Key, 'tab'));\n resolved.Hidden.forEach((surface) => placements.set(surface.Key, 'hidden'));\n if (!samePlacements(placements, this.placements)) {\n this.placements = placements;\n }\n this.pipOrder = resolved.Pips.map((surface) => surface.Key);\n }\n}\n\n/** A channel's surface as the layout model sees it: where its channel places it unless moved, and where it may go. */\nfunction surfaceOf(plugin: BaseRealtimeChannelClient): MediaSurface {\n const { Default, Allowed } = plugin.SurfacePlacement;\n return { Key: plugin.ChannelName, Label: plugin.TabTitle, DefaultPlacement: Default, AllowedPlacements: Allowed };\n}\n\nfunction sameAllowedPlacements(\n a: ReadonlyMap<string, readonly MediaStagePlacement[]>,\n b: ReadonlyMap<string, readonly MediaStagePlacement[]>\n): boolean {\n return a.size === b.size && [...a].every(([key, allowed]) => b.get(key) === allowed);\n}\n\nfunction samePlacements(a: ReadonlyMap<string, MediaStagePlacement>, b: ReadonlyMap<string, MediaStagePlacement>): boolean {\n return a.size === b.size && [...a].every(([key, placement]) => b.get(key) === placement);\n}\n\nfunction sameSurfaces(a: readonly MediaStageSurface[], b: readonly MediaStageSurface[]): boolean {\n return (\n a.length === b.length &&\n a.every(\n (surface, i) =>\n surface.Key === b[i].Key && surface.Placement === b[i].Placement && surface.Label === b[i].Label && surface.PipIndex === b[i].PipIndex\n )\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"realtime-surface-stage.model.js","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-stage.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,wBAAwB,EAA8C,MAAM,0CAA0C,CAAC;AAIxK;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,yBAAyB;IACpC,2EAA2E;IAC1D,OAAO,GAAG,IAAI,GAAG,EAAqC,CAAC;IACxE,6DAA6D;IAC5C,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KAAK,GAAyB,EAAE,CAAC;IACjC,YAAY,GAAkB,IAAI,CAAC;IACnC,UAAU,GAA6C,IAAI,GAAG,EAAE,CAAC;IACzE,iDAAiD;IACzC,QAAQ,GAAsB,EAAE,CAAC;IACjC,QAAQ,GAAiC,EAAE,CAAC;IAC5C,iBAAiB,GAAwD,IAAI,GAAG,EAAE,CAAC;IAE3F,mHAAmH;IACnH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,yGAAyG;IACzG,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,iHAAiH;IACjH,IAAW,iBAAiB;QAC1B,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,4EAA4E;IAC5E,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,4DAA4D;IAC5D,IAAW,QAAQ;QACjB,KAAK,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAC/C,IAAI,S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AK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CACzI,CACF,CAAC;AACJ,CAAC","sourcesContent":["import { PlacementOffStage, RecordPlacementMove, ResolveSurfacePlacements, type MediaPlacementMove, type MediaSurface } from '@memberjunction/ai-realtime-client/media';\nimport type { MediaStagePlacement, MediaStageSurface } from '@memberjunction/ng-realtime-media';\nimport type { BaseRealtimeChannelClient } from '@memberjunction/realtime-runtime';\n\n/**\n * Which channel surfaces the call overlay's stage (`mj-media-stage`) holds, and where each one shows.\n *\n * **Placement.** Every surface starts where its channel's registry row places it (`SurfacePlacement`: its tab, unless the\n * row says otherwise). The user moves it to the stage (it fills the call), into a picture-in-picture box, to its tab, or\n * out of sight, within the placements the row allows; the moves are kept in order, one per surface, and resolved by\n * `ResolveSurfacePlacements`, so the most recent move to the stage wins it, the surface it displaces returns to where its\n * channel places it, and picture-in-picture boxes stack newest first. The host saves {@link Moves} and loads them back\n * ({@link LoadMoves}), so a layout carries over to later sessions.\n *\n * **Creation.** A channel's surface is created the first time it is seen (its tab shows it, or it is on the stage or\n * in a picture-in-picture box) and kept until the channel leaves the session. Moving it, hiding the panel or switching tabs only changes where it\n * shows, so a whiteboard keeps its view and a stream keeps playing.\n *\n * Pure state with no Angular: the overlay reports the session's channels, the channel tab the panel is showing and\n * the user's moves, and binds {@link Surfaces} to the stage.\n */\nexport class RealtimeSurfaceStageModel {\n /** Channels with a surface, by key, in the order their tabs registered. */\n private readonly plugins = new Map<string, BaseRealtimeChannelClient>();\n /** Keys whose surface has been seen, so it stays created. */\n private readonly seen = new Set<string>();\n private moves: MediaPlacementMove[] = [];\n private activeTabKey: string | null = null;\n private placements: ReadonlyMap<string, MediaStagePlacement> = new Map();\n /** Picture-in-picture surfaces, newest first. */\n private pipOrder: readonly string[] = [];\n private surfaces: readonly MediaStageSurface[] = [];\n private allowedPlacements: ReadonlyMap<string, readonly MediaStagePlacement[]> = new Map();\n\n /** The stage's surfaces. The array is replaced only when a surface or a placement changes, so it binds cheaply. */\n public get Surfaces(): readonly MediaStageSurface[] {\n return this.surfaces;\n }\n\n /** Where each registered channel's surface is placed, by key. Replaced only when a placement changes. */\n public get Placements(): ReadonlyMap<string, MediaStagePlacement> {\n return this.placements;\n }\n\n /** Where the user may move each registered channel's surface, by key. Replaced only when the channels change. */\n public get AllowedPlacements(): ReadonlyMap<string, readonly MediaStagePlacement[]> {\n return this.allowedPlacements;\n }\n\n /** The user's moves, oldest first, one per surface: what the host saves. */\n public get Moves(): readonly MediaPlacementMove[] {\n return this.moves;\n }\n\n /** The channel whose surface is on the stage, or `null`. */\n public get StageKey(): string | null {\n for (const [key, placement] of this.placements) {\n if (placement === 'stage') {\n return key;\n }\n }\n return null;\n }\n\n /** The plugin behind a surface, or `null` once its channel has left. */\n public PluginFor(key: string): BaseRealtimeChannelClient | null {\n return this.plugins.get(key) ?? null;\n }\n\n /** Where the user may move a channel's surface; nowhere for a channel without a surface in this session. */\n public AllowedFor(key: string): readonly MediaStagePlacement[] {\n return this.allowedPlacements.get(key) ?? [];\n }\n\n /**\n * Where a channel's surface goes when it leaves the stage (the user leaves the focus layout, or the channel lets go of\n * it): where its channel places it, or the first of picture-in-picture, tab and hidden that it allows.\n */\n public OffStagePlacement(key: string): MediaStagePlacement {\n const plugin = this.plugins.get(key);\n return plugin ? PlacementOffStage(surfaceOf(plugin)) : 'tab';\n }\n\n /** A channel with a surface got its tab. Registering its key again follows the channel's new plugin instance. */\n public Register(plugin: BaseRealtimeChannelClient): void {\n this.plugins.set(plugin.ChannelName, plugin);\n this.updateAllowedPlacements();\n this.update();\n }\n\n /** The session's channels changed: a surface whose plugin is no longer among them is dropped. Moves are kept. */\n public KeepOnly(channels: readonly BaseRealtimeChannelClient[]): void {\n for (const [key, plugin] of [...this.plugins]) {\n if (!channels.includes(plugin)) {\n this.plugins.delete(key);\n this.seen.delete(key);\n }\n }\n this.updateAllowedPlacements();\n this.update();\n }\n\n /** The channel whose tab the panel is showing, or `null` when it shows none (another tab, collapsed, hidden). */\n public SetActiveTab(key: string | null): void {\n this.activeTabKey = key;\n this.update();\n }\n\n /** Starts from saved moves, such as the user's last layout. */\n public LoadMoves(moves: readonly MediaPlacementMove[]): void {\n this.moves = [...moves];\n this.update();\n }\n\n /**\n * Moves a channel's surface. Returns `false`, changing nothing, for a channel without a surface in this session, a\n * placement its channel does not allow, or the placement it already has.\n */\n public Move(key: string, placement: MediaStagePlacement): boolean {\n if (!this.AllowedFor(key).includes(placement) || this.placements.get(key) === placement) {\n return false;\n }\n this.moves = RecordPlacementMove(this.moves, { SurfaceKey: key, Placement: placement });\n this.update();\n return true;\n }\n\n /** Forgets every move: each surface returns to where its channel places it. */\n public ResetLayout(): void {\n this.moves = [];\n this.update();\n }\n\n private update(): void {\n this.resolvePlacements();\n for (const [key, placement] of this.placements) {\n const carriesAgentVideo = this.plugins.get(key)?.ShowsAgentVideo === true;\n if (placement === 'stage' || placement === 'pip' || (placement === 'tab' && (key === this.activeTabKey || carriesAgentVideo))) {\n this.seen.add(key);\n }\n }\n const surfaces = [...this.plugins.keys()].filter((key) => this.seen.has(key)).map((key) => this.surfaceFor(key));\n if (!sameSurfaces(surfaces, this.surfaces)) {\n this.surfaces = surfaces;\n }\n }\n\n /** Rebuilds {@link AllowedPlacements} from the registered channels, keeping the map when nothing in it changed. */\n private updateAllowedPlacements(): void {\n const allowed = new Map([...this.plugins].map(([key, plugin]) => [key, plugin.SurfacePlacement.Allowed]));\n if (!sameAllowedPlacements(allowed, this.allowedPlacements)) {\n this.allowedPlacements = allowed;\n }\n }\n\n /** A stage surface for a channel: its placement, its name, and where it stacks when it is picture-in-picture. */\n private surfaceFor(key: string): MediaStageSurface {\n const placement = this.placements.get(key) ?? 'tab';\n const surface: MediaStageSurface = { Key: key, Placement: placement, Label: this.plugins.get(key)?.TabTitle };\n return placement === 'pip' ? { ...surface, PipIndex: this.pipOrder.indexOf(key) } : surface;\n }\n\n private resolvePlacements(): void {\n const resolved = ResolveSurfacePlacements([...this.plugins.values()].map(surfaceOf), this.moves);\n const placements = new Map<string, MediaStagePlacement>();\n if (resolved.Stage) {\n placements.set(resolved.Stage.Key, 'stage');\n }\n resolved.Pips.forEach((surface) => placements.set(surface.Key, 'pip'));\n resolved.Tabs.forEach((surface) => placements.set(surface.Key, 'tab'));\n resolved.Hidden.forEach((surface) => placements.set(surface.Key, 'hidden'));\n if (!samePlacements(placements, this.placements)) {\n this.placements = placements;\n }\n this.pipOrder = resolved.Pips.map((surface) => surface.Key);\n }\n}\n\n/** A channel's surface as the layout model sees it: where its channel places it unless moved, and where it may go. */\nfunction surfaceOf(plugin: BaseRealtimeChannelClient): MediaSurface {\n const { Default, Allowed } = plugin.SurfacePlacement;\n return { Key: plugin.ChannelName, Label: plugin.TabTitle, DefaultPlacement: Default, AllowedPlacements: Allowed };\n}\n\nfunction sameAllowedPlacements(\n a: ReadonlyMap<string, readonly MediaStagePlacement[]>,\n b: ReadonlyMap<string, readonly MediaStagePlacement[]>\n): boolean {\n return a.size === b.size && [...a].every(([key, allowed]) => b.get(key) === allowed);\n}\n\nfunction samePlacements(a: ReadonlyMap<string, MediaStagePlacement>, b: ReadonlyMap<string, MediaStagePlacement>): boolean {\n return a.size === b.size && [...a].every(([key, placement]) => b.get(key) === placement);\n}\n\nfunction sameSurfaces(a: readonly MediaStageSurface[], b: readonly MediaStageSurface[]): boolean {\n return (\n a.length === b.length &&\n a.every(\n (surface, i) =>\n surface.Key === b[i].Key && surface.Placement === b[i].Placement && surface.Label === b[i].Label && surface.PipIndex === b[i].PipIndex\n )\n );\n}\n"]}
|
|
@@ -20,11 +20,11 @@ export declare function IsWhiteboardChannel(channelName: string | null | undefin
|
|
|
20
20
|
* Whether a channel should get its surface tab registered UP FRONT (at the
|
|
21
21
|
* registry-resolved emission) rather than waiting for first use.
|
|
22
22
|
*
|
|
23
|
-
* True only
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* True only when the channel has ALREADY been used this session (`hasBeenUsed`).
|
|
24
|
+
* Every channel — including the whiteboard — stays tab-less until first activity or
|
|
25
|
+
* prior-state restore registers it, keeping the strip decluttered to surfaces actually in play.
|
|
26
26
|
*/
|
|
27
|
-
export declare function ShouldRegisterChannelTabUpFront(
|
|
27
|
+
export declare function ShouldRegisterChannelTabUpFront(_channelName: string, hasBeenUsed: boolean): boolean;
|
|
28
28
|
/**
|
|
29
29
|
* Whether the Activity tab should be shown yet. Gated on ≥1 underlying agent run having
|
|
30
30
|
* occurred this session (`agentRunCount`) — the Activity surface is for async delegation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-surface-tab-style.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-tab-style.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEnF;AAED;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,
|
|
1
|
+
{"version":3,"file":"realtime-surface-tab-style.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-tab-style.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEnF;AAED;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAEnG;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAE1F;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED,0FAA0F;AAC1F,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAUzD;AAID,2FAA2F;AAC3F,eAAO,MAAM,uBAAuB,iCAAiC,CAAC;AAEtE,uFAAuF;AACvF,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAEjD,2EAA2E;AAC3E,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,wEAAwE;AACxE,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKjE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAiBvF;AAED,4FAA4F;AAC5F,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErE"}
|
|
@@ -22,12 +22,12 @@ export function IsWhiteboardChannel(channelName) {
|
|
|
22
22
|
* Whether a channel should get its surface tab registered UP FRONT (at the
|
|
23
23
|
* registry-resolved emission) rather than waiting for first use.
|
|
24
24
|
*
|
|
25
|
-
* True only
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* True only when the channel has ALREADY been used this session (`hasBeenUsed`).
|
|
26
|
+
* Every channel — including the whiteboard — stays tab-less until first activity or
|
|
27
|
+
* prior-state restore registers it, keeping the strip decluttered to surfaces actually in play.
|
|
28
28
|
*/
|
|
29
|
-
export function ShouldRegisterChannelTabUpFront(
|
|
30
|
-
return
|
|
29
|
+
export function ShouldRegisterChannelTabUpFront(_channelName, hasBeenUsed) {
|
|
30
|
+
return hasBeenUsed;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Whether the Activity tab should be shown yet. Gated on ≥1 underlying agent run having
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-surface-tab-style.js","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-tab-style.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAsC;IACxE,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC;AACnE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,+BAA+B,CAAC,
|
|
1
|
+
{"version":3,"file":"realtime-surface-tab-style.js","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-tab-style.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAsC;IACxE,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC;AACnE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,+BAA+B,CAAC,YAAoB,EAAE,WAAoB;IACxF,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,aAAqB,EAAE,WAAoB;IAC/E,OAAO,WAAW,IAAI,aAAa,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB;IACjD,MAAM,GAAG,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;IACvC,OAAO,OAAO,GAAG,aAAa,CAAC;AACjC,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,aAAa,CAAC,WAAmB;IAC/C,MAAM,GAAG,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrD,IAAI,IAAI,GAAG,UAAU,CAAC,CAAC,mBAAmB;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE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,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;YAC7E,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,6BAA6B,CAAC,OAAe;IAC3D,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,yBAAyB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC","sourcesContent":["/**\n * Framework-free helpers for the call overlay's SURFACE-PANEL tab strip styling + gating\n * and the Activity tab's artifact split-pane width preference.\n *\n * Kept free of Angular imports so the per-channel color hash, the whiteboard predicate,\n * the channel-used gate, the show-activity gate, and the split-width parse/clamp rules\n * are unit-testable in isolation (plain-node vitest).\n */\n\n/**\n * Whether a channel name denotes the live WHITEBOARD channel (case-insensitive, trimmed).\n *\n * The whiteboard is the ONE channel whose surface tab appears immediately at session start\n * — a user can be the first to draw on it, whereas every other channel only earns its tab\n * once the agent actually USES it. Detection is by name (the registry `Name` / plugin\n * `ChannelName`) rather than a flag so a deployment can't accidentally opt a non-board\n * channel into the immediate-tab behavior.\n */\nexport function IsWhiteboardChannel(channelName: string | null | undefined): boolean {\n return (channelName ?? '').trim().toLowerCase() === 'whiteboard';\n}\n\n/**\n * Whether a channel should get its surface tab registered UP FRONT (at the\n * registry-resolved emission) rather than waiting for first use.\n *\n * True only when the channel has ALREADY been used this session (`hasBeenUsed`).\n * Every channel — including the whiteboard — stays tab-less until first activity or\n * prior-state restore registers it, keeping the strip decluttered to surfaces actually in play.\n */\nexport function ShouldRegisterChannelTabUpFront(_channelName: string, hasBeenUsed: boolean): boolean {\n return hasBeenUsed;\n}\n\n/**\n * Whether the Activity tab should be shown yet. Gated on ≥1 underlying agent run having\n * occurred this session (`agentRunCount`) — the Activity surface is for async delegation,\n * so it stays hidden until there's at least one delegated run to show. Review mode always\n * shows it (a past session's activity is always relevant), regardless of the live count.\n */\nexport function ShouldShowActivityTab(agentRunCount: number, isReviewing: boolean): boolean {\n return isReviewing || agentRunCount > 0;\n}\n\n/**\n * A stable, deterministic accent color for a channel tab derived from its `ChannelName`,\n * as an `hsl()` string. Categorical channel colors are explicitly allowed to use `hsl()`\n * per the design-token rules. A channel may override this by supplying its own `TabColor`.\n *\n * The hue is an FNV-1a-style hash of the (lowercased, trimmed) name spread across the wheel;\n * saturation/lightness are fixed so every channel reads as a confident, legible accent that\n * works on both light and dark surfaces. Deterministic: the same name always yields the same\n * hue, so a channel keeps its color across sessions and re-registrations.\n */\nexport function ChannelTabColor(channelName: string): string {\n const hue = ChannelTabHue(channelName);\n return `hsl(${hue}, 62%, 52%)`;\n}\n\n/** The deterministic hue (0–359) a channel name hashes to — split out for testability. */\nexport function ChannelTabHue(channelName: string): number {\n const key = (channelName ?? '').trim().toLowerCase();\n let hash = 0x811c9dc5; // FNV offset basis\n for (let i = 0; i < key.length; i++) {\n hash ^= key.charCodeAt(i);\n // FNV prime multiply, kept in 32-bit range via Math.imul.\n hash = Math.imul(hash, 0x01000193);\n }\n // >>> 0 normalizes to an unsigned 32-bit int before the modulo.\n return (hash >>> 0) % 360;\n}\n\n// ── Activity tab artifact split-pane width preference ──────────────────────────\n\n/** `MJ: User Settings` key for the Activity-tab artifact split width (versioned shape). */\nexport const ACTIVITY_SPLIT_PREF_KEY = 'mj.realtime.activitySplit.v1';\n\n/** Default right-pane (artifact viewer) width as a percentage of the Activity pane. */\nexport const ACTIVITY_SPLIT_DEFAULT_PERCENT = 45;\n\n/** Narrowest the artifact (right) pane may be dragged, as a percentage. */\nexport const ACTIVITY_SPLIT_MIN_PERCENT = 25;\n\n/** Widest the artifact (right) pane may be dragged, as a percentage. */\nexport const ACTIVITY_SPLIT_MAX_PERCENT = 75;\n\n/**\n * Clamps a candidate right-pane width percentage into\n * `[{@link ACTIVITY_SPLIT_MIN_PERCENT}, {@link ACTIVITY_SPLIT_MAX_PERCENT}]`. Non-finite\n * inputs resolve to the default so a garbage value can never break the layout.\n */\nexport function ClampActivitySplitPercent(percent: number): number {\n if (!Number.isFinite(percent)) {\n return ACTIVITY_SPLIT_DEFAULT_PERCENT;\n }\n return Math.min(Math.max(percent, ACTIVITY_SPLIT_MIN_PERCENT), ACTIVITY_SPLIT_MAX_PERCENT);\n}\n\n/**\n * Parses the raw persisted Activity-split preference into a clamped right-pane percentage,\n * or `null` when there is no usable preference (missing / blank / malformed JSON, non-object\n * payload, non-finite/non-positive width). Never throws — callers fall back to the default.\n */\nexport function ParseActivitySplitPercent(raw: string | null | undefined): number | null {\n if (!raw) {\n return null;\n }\n try {\n const parsed: unknown = JSON.parse(raw);\n if (parsed === null || typeof parsed !== 'object') {\n return null;\n }\n const percent = (parsed as { percent?: unknown }).percent;\n if (typeof percent !== 'number' || !Number.isFinite(percent) || percent <= 0) {\n return null;\n }\n return ClampActivitySplitPercent(percent);\n } catch {\n return null;\n }\n}\n\n/** Serializes the right-pane width percentage for persistence (`{ \"percent\": number }`). */\nexport function SerializeActivitySplitPercent(percent: number): string {\n return JSON.stringify({ percent: ClampActivitySplitPercent(percent) });\n}\n"]}
|
|
@@ -176,18 +176,16 @@ export declare class RealtimeSurfaceTabsModel {
|
|
|
176
176
|
/** Clears the transient flash highlight (called by the component after a beat). */
|
|
177
177
|
ClearFlash(): void;
|
|
178
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Pure decision helper for the REVIEW→LIVE continuation edge: should the overlay REMOVE a
|
|
181
|
+
* review-registered (template-based, read-only) channel tab?
|
|
182
|
+
*/
|
|
183
|
+
export declare function ShouldRemoveReviewChannelTab(liveSessionActive: boolean, reviewTabRegistered: boolean, channelKey: string, liveChannels: ReadonlyArray<{
|
|
184
|
+
ChannelName: string;
|
|
185
|
+
}>): boolean;
|
|
179
186
|
/**
|
|
180
187
|
* Pure decision helper for the REVIEW→LIVE continuation edge: should the overlay REMOVE the
|
|
181
188
|
* review-registered (template-based, read-only) Whiteboard tab?
|
|
182
|
-
*
|
|
183
|
-
* Yes only when ALL hold:
|
|
184
|
-
* - a live session is active (the channel set emission belongs to a real session start, not
|
|
185
|
-
* the initial/teardown `[]` replay);
|
|
186
|
-
* - review mode actually registered a whiteboard tab (otherwise there is nothing stale);
|
|
187
|
-
* - the live session's resolved channel set has NO Whiteboard channel — when it HAS one, the
|
|
188
|
-
* live plugin re-registers the same tab key and upgrades the pane in place instead.
|
|
189
|
-
*
|
|
190
|
-
* Kept framework-free (like the model) so the rule is unit-testable in isolation.
|
|
191
189
|
*/
|
|
192
190
|
export declare function ShouldRemoveReviewWhiteboardTab(liveSessionActive: boolean, reviewWhiteboardTabRegistered: boolean, liveChannels: ReadonlyArray<{
|
|
193
191
|
ChannelName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-surface-tabs.model.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-tabs.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAGlF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,SAAS,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,iFA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I,CAG3C;IAED;;;;;;OAMG;IACI,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAW9C;;;;;;;;;OASG;IACI,kBAAkB,CAAC,YAAY,EAAE,8BAA8B,GAAG,kBAAkB;IAwB3F,qFAAqF;IAC9E,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQ/B;;;;;OAKG;IACI,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQlC;;;;;;;;;;OAUG;IACI,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAiBtC,mFAAmF;IAC5E,UAAU,IAAI,IAAI;CAM1B;AAED
|
|
1
|
+
{"version":3,"file":"realtime-surface-tabs.model.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-tabs.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAGlF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,SAAS,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,IAAI,EAAE,sBAAsB,CAAC;IAC7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,IAA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F,qFAAqF;IAC9E,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQ/B;;;;;OAKG;IACI,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQlC;;;;;;;;;;OAUG;IACI,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAiBtC,mFAAmF;IAC5E,UAAU,IAAI,IAAI;CAM1B;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,iBAAiB,EAAE,OAAO,EAC1B,mBAAmB,EAAE,OAAO,EAC5B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,aAAa,CAAC;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,GACnD,OAAO,CAMT;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAC7C,iBAAiB,EAAE,OAAO,EAC1B,6BAA6B,EAAE,OAAO,EACtC,YAAY,EAAE,aAAa,CAAC;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,GACnD,OAAO,CAET"}
|
|
@@ -179,23 +179,22 @@ export class RealtimeSurfaceTabsModel {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Pure decision helper for the REVIEW→LIVE continuation edge: should the overlay REMOVE a
|
|
184
|
+
* review-registered (template-based, read-only) channel tab?
|
|
185
|
+
*/
|
|
186
|
+
export function ShouldRemoveReviewChannelTab(liveSessionActive, reviewTabRegistered, channelKey, liveChannels) {
|
|
187
|
+
if (!liveSessionActive || !reviewTabRegistered) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
const target = channelKey.trim().toLowerCase();
|
|
191
|
+
return !liveChannels.some(c => c.ChannelName?.trim().toLowerCase() === target);
|
|
192
|
+
}
|
|
182
193
|
/**
|
|
183
194
|
* Pure decision helper for the REVIEW→LIVE continuation edge: should the overlay REMOVE the
|
|
184
195
|
* review-registered (template-based, read-only) Whiteboard tab?
|
|
185
|
-
*
|
|
186
|
-
* Yes only when ALL hold:
|
|
187
|
-
* - a live session is active (the channel set emission belongs to a real session start, not
|
|
188
|
-
* the initial/teardown `[]` replay);
|
|
189
|
-
* - review mode actually registered a whiteboard tab (otherwise there is nothing stale);
|
|
190
|
-
* - the live session's resolved channel set has NO Whiteboard channel — when it HAS one, the
|
|
191
|
-
* live plugin re-registers the same tab key and upgrades the pane in place instead.
|
|
192
|
-
*
|
|
193
|
-
* Kept framework-free (like the model) so the rule is unit-testable in isolation.
|
|
194
196
|
*/
|
|
195
197
|
export function ShouldRemoveReviewWhiteboardTab(liveSessionActive, reviewWhiteboardTabRegistered, liveChannels) {
|
|
196
|
-
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
199
|
-
return !liveChannels.some(c => c.ChannelName?.trim().toLowerCase() === 'whiteboard');
|
|
198
|
+
return ShouldRemoveReviewChannelTab(liveSessionActive, reviewWhiteboardTabRegistered, 'Whiteboard', liveChannels);
|
|
200
199
|
}
|
|
201
200
|
//# sourceMappingURL=realtime-surface-tabs.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-surface-tabs.model.js","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-tabs.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAsF/D;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,wBAAwB;IACnC,8EAA8E;IACvE,MAAM,CAAU,cAAc,GAAG,UAAU,CAAC;IAEnD,wFAAwF;IAChF,MAAM,CAAU,WAAW,GAAuB;QACxD,GAAG,EAAE,wBAAwB,CAAC,cAAc;QAC5C,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,yBAAyB;QAC/B,IAAI,EAAE,UAAU;KACjB,CAAC;IAEF,wFAAwF;IAChF,WAAW,GAAyB,EAAE,CAAC;IAE/C,wFAAwF;IAChF,Y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C,cAAc;gBACzC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,wBAAwB,CAAC,cAAc,CAAC,CAAC;QAC5E,CAAC;QACD,IAAI,IAAI,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;YAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mFAAmF;IAC5E,UAAU;QACf,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC3B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;;AAGH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,+BAA+B,CAC7C,iBAA0B,EAC1B,6BAAsC,EACtC,YAAoD;IAEpD,IAAI,CAAC,iBAAiB,IAAI,CAAC,6BAA6B,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,CAAC;AACvF,CAAC","sourcesContent":["import { Subject } from 'rxjs';\nimport type { TemplateRef } from '@angular/core';\nimport type { BaseRealtimeChannelClient } from '@memberjunction/realtime-runtime';\nimport { ChannelTabColor } from './realtime-surface-tab-style';\n\n/**\n * The kind of a surface-panel tab:\n * - `activity` — the session-activity tab (pinned LAST, right-aligned). Hosts the activity\n * rail AND, since the artifact redesign, the inline artifact previews + the split-pane\n * artifact viewer. Shown only once ≥1 agent run has occurred (see\n * {@link RealtimeSurfaceTabsModel.SetShowActivityTab}).\n * - `channel` — an interactive-channel surface (e.g. the Whiteboard). Registered per\n * used channel via {@link RealtimeSurfaceTabsModel.RegisterChannelTab}; renders the\n * plugin's dynamically-created surface component (or a registered template for\n * legacy/template-based panes), with the \"coming online…\" placeholder until either\n * is supplied.\n *\n * NOTE: artifacts NO LONGER get their own tab. A delegated run's artifacts now render\n * INSIDE the Activity tab (inline previews + an `as-split` viewer pane) — see\n * `RealtimeActivityRailComponent`.\n */\nexport type RealtimeSurfaceTabKind = 'activity' | 'channel';\n\n/**\n * Per-kind payload carried on a {@link RealtimeSurfaceTab}.\n */\nexport interface RealtimeSurfaceTabData {\n /**\n * For `channel` tabs: the channel PLUGIN whose surface component the pane creates\n * dynamically (and binds back to the plugin) — the registry-driven path every real\n * channel uses. Takes precedence over {@link Content}.\n */\n Plugin?: BaseRealtimeChannelClient;\n /**\n * For `channel` tabs: a TEMPLATE-based pane body. Backward-compatible alternative to\n * {@link Plugin} for hosts that render a bespoke surface without a channel plugin.\n * When BOTH are absent the pane renders the built-in \"coming online…\" placeholder.\n */\n Content?: TemplateRef<unknown>;\n}\n\n/**\n * One tab on the call overlay's tabbed surface panel (the right panel): a channel surface\n * (left cluster) or the session-activity tab (right-aligned).\n */\nexport interface RealtimeSurfaceTab {\n /** Stable unique key (`activity`, or the channel's registered key). */\n Key: string;\n /** Tab strip label (channel name, or \"Activity\"). */\n Title: string;\n /** Font Awesome icon class for the tab strip (e.g. `fa-solid fa-chalkboard`). */\n Icon: string;\n /** What the tab renders. */\n Kind: RealtimeSurfaceTabKind;\n /**\n * Accent color for the tab's dot + active underline. Channel tabs carry a distinct color\n * (plugin-supplied or a deterministic hash of the name); the Activity tab uses its own\n * fixed accent in CSS, so its `Color` is left undefined.\n */\n Color?: string;\n /** Kind-specific payload. */\n Data?: RealtimeSurfaceTabData;\n}\n\n/**\n * Registration for an interactive-channel tab. The overlay shell registers one per\n * USED channel plugin (supplying {@link Plugin}); supplying {@link Plugin} or\n * {@link Content} later under the same `Key` upgrades a placeholder tab to the real surface.\n */\nexport interface RealtimeChannelTabRegistration {\n /** Stable channel key (the plugin's `ChannelName`, e.g. `Whiteboard`). Re-registering the same key updates the tab. */\n Key: string;\n /** Tab strip label (e.g. `Whiteboard`). */\n Title: string;\n /** Font Awesome icon class (e.g. `fa-solid fa-chalkboard`). */\n Icon: string;\n /**\n * Optional explicit accent color for the tab. When omitted, a deterministic color is\n * derived from {@link Key} so every channel tab still reads as a distinct surface.\n */\n Color?: string | null;\n /** The channel plugin whose surface the pane creates + binds. Preferred over {@link Content}. */\n Plugin?: BaseRealtimeChannelClient;\n /** A template-based pane body (legacy/bespoke panes). Omit both to show the \"coming online…\" placeholder. */\n Content?: TemplateRef<unknown>;\n /** Focus the tab immediately after registration (default `false`). */\n Focus?: boolean;\n}\n\n/**\n * Framework-free state for the call overlay's tabbed surface panel: the ordered tab list\n * (CHANNEL tabs first — the marquee surfaces, left cluster — with the session-activity tab\n * pinned LAST and right-aligned by the strip), the active tab, and the transient \"flash\"\n * highlight for a just-revealed channel tab.\n *\n * The Activity tab is GATED: it isn't listed until {@link SetShowActivityTab}(true) — i.e.\n * once ≥1 agent run has occurred (or in review mode). Channel tabs appear only as channels\n * come into play (the whiteboard up-front; every other channel on first use), so an\n * idle voice-first session shows an empty/near-empty strip rather than a row of unused tabs.\n *\n * Owned by `RealtimeSurfaceTabsComponent`; kept free of Angular runtime imports so the\n * add / focus / dedupe / flash logic is unit-testable in isolation. All collections are\n * REPLACED (never mutated) on change, and every change emits {@link Changed$}.\n */\nexport class RealtimeSurfaceTabsModel {\n /** The fixed key of the session-activity tab (pinned LAST, right-aligned). */\n public static readonly ActivityTabKey = 'activity';\n\n /** The activity tab definition, appended last whenever {@link showActivity} is true. */\n private static readonly activityTab: RealtimeSurfaceTab = {\n Key: RealtimeSurfaceTabsModel.ActivityTabKey,\n Title: 'Activity',\n Icon: 'fa-solid fa-wave-square',\n Kind: 'activity'\n };\n\n /** Channel tabs (left cluster), in registration order. Replaced immutably on change. */\n private channelTabs: RealtimeSurfaceTab[] = [];\n\n /** Whether the gated Activity tab is currently shown (≥1 agent run, or review mode). */\n private showActivity = false;\n\n /** Key of the currently focused tab. */\n public ActiveKey: string = RealtimeSurfaceTabsModel.ActivityTabKey;\n\n /**\n * Key of the tab currently \"flashing\" (the brief highlight a just-revealed channel tab\n * gets when the agent first acts on it). Cleared by the owning component after a beat via\n * {@link ClearFlash}.\n */\n public FlashKey: string | null = null;\n\n /** Emits after every model change so the owning component can mark for check. */\n public readonly Changed$ = new Subject<void>();\n\n /**\n * The ordered tabs: channel tabs (left), then the Activity tab LAST when shown. The strip\n * right-aligns the Activity tab via a flex spacer, so this order also matches reading order.\n */\n public get Tabs(): RealtimeSurfaceTab[] {\n return this.showActivity\n ? [...this.channelTabs, RealtimeSurfaceTabsModel.activityTab]\n : [...this.channelTabs];\n }\n\n /** Whether the Activity tab is currently part of the strip. */\n public get IsActivityShown(): boolean {\n return this.showActivity;\n }\n\n /**\n * The currently focused tab. Resolves to the active key when it still exists, else falls\n * back to the Activity tab (when shown), else the first channel tab, else the Activity tab\n * definition (so a consumer always has SOMETHING to render even on an empty strip).\n */\n public get ActiveTab(): RealtimeSurfaceTab {\n const tabs = this.Tabs;\n return tabs.find(t => t.Key === this.ActiveKey)\n ?? tabs.find(t => t.Key === RealtimeSurfaceTabsModel.ActivityTabKey)\n ?? tabs[0]\n ?? RealtimeSurfaceTabsModel.activityTab;\n }\n\n /**\n * The key of the channel whose tab is focused, or `null` when the focused tab is not a channel's (the Activity\n * tab, or an empty strip). This is what tells the session which surface the user is looking at.\n */\n public get ActiveChannelKey(): string | null {\n const tab = this.ActiveTab;\n return tab.Kind === 'channel' ? tab.Key : null;\n }\n\n /**\n * Shows or hides the gated Activity tab. Turning it ON when an empty strip was implicitly\n * focusing Activity keeps focus on Activity; turning it OFF while it was focused falls\n * focus back to the first channel tab (if any). No-op (no emission) when unchanged.\n *\n * @param show Whether ≥1 agent run has occurred (or review mode) — the gate.\n */\n public SetShowActivityTab(show: boolean): void {\n if (this.showActivity === show) {\n return;\n }\n this.showActivity = show;\n if (!show && this.ActiveKey === RealtimeSurfaceTabsModel.ActivityTabKey) {\n this.ActiveKey = this.channelTabs[0]?.Key ?? RealtimeSurfaceTabsModel.ActivityTabKey;\n }\n this.Changed$.next();\n }\n\n /**\n * Registers (or updates) an interactive-channel tab. Re-registering an existing key\n * replaces its title/icon/color/plugin/content in place (this is how a placeholder\n * upgrades to the real surface once the channel comes online). New channel tabs join the\n * left cluster in registration order. A registration without an explicit {@link\n * RealtimeChannelTabRegistration.Color} gets a deterministic color from its key.\n *\n * @param registration The channel tab registration.\n * @returns The (new or updated) tab.\n */\n public RegisterChannelTab(registration: RealtimeChannelTabRegistration): RealtimeSurfaceTab {\n const tab: RealtimeSurfaceTab = {\n Key: registration.Key,\n Title: registration.Title,\n Icon: registration.Icon,\n Kind: 'channel',\n Color: registration.Color ?? ChannelTabColor(registration.Key),\n Data: { Plugin: registration.Plugin, Content: registration.Content }\n };\n const idx = this.channelTabs.findIndex(t => t.Key === registration.Key);\n if (idx >= 0) {\n const next = [...this.channelTabs];\n next[idx] = tab;\n this.channelTabs = next;\n } else {\n this.channelTabs = [...this.channelTabs, tab];\n }\n if (registration.Focus) {\n this.ActiveKey = tab.Key;\n }\n this.Changed$.next();\n return tab;\n }\n\n /** Focuses the tab with `key` (no-op when it doesn't exist or is already active). */\n public Focus(key: string): void {\n if (!this.Tabs.some(t => t.Key === key) || this.ActiveKey === key) {\n return;\n }\n this.ActiveKey = key;\n this.Changed$.next();\n }\n\n /**\n * Marks the tab with `key` as the {@link FlashKey} (the brief \"just arrived\" highlight)\n * WITHOUT changing focus — used by the auto-reveal path when the agent first acts on a\n * channel, so the user's eye lands on the tab that just came alive. No-op for unknown\n * keys; the owning component clears it after a beat via {@link ClearFlash}.\n */\n public FlashTab(key: string): void {\n if (this.FlashKey === key || !this.Tabs.some(t => t.Key === key)) {\n return;\n }\n this.FlashKey = key;\n this.Changed$.next();\n }\n\n /**\n * Removes the channel tab with `key`. Rules:\n * - the Activity tab is IRREMOVABLE — removing it is a no-op;\n * - an unknown key is a no-op (returns `false`);\n * - when the removed tab was focused, focus falls back to the Activity tab (if shown),\n * else the first remaining channel tab;\n * - a pending flash on the removed tab is cleaned up so the highlight can't dangle.\n *\n * @param key The tab key to remove.\n * @returns `true` when a tab was removed.\n */\n public RemoveTab(key: string): boolean {\n if (key === RealtimeSurfaceTabsModel.ActivityTabKey || !this.channelTabs.some(t => t.Key === key)) {\n return false;\n }\n this.channelTabs = this.channelTabs.filter(t => t.Key !== key);\n if (this.ActiveKey === key) {\n this.ActiveKey = this.showActivity\n ? RealtimeSurfaceTabsModel.ActivityTabKey\n : (this.channelTabs[0]?.Key ?? RealtimeSurfaceTabsModel.ActivityTabKey);\n }\n if (this.FlashKey === key) {\n this.FlashKey = null;\n }\n this.Changed$.next();\n return true;\n }\n\n /** Clears the transient flash highlight (called by the component after a beat). */\n public ClearFlash(): void {\n if (this.FlashKey !== null) {\n this.FlashKey = null;\n this.Changed$.next();\n }\n }\n}\n\n/**\n * Pure decision helper for the REVIEW→LIVE continuation edge: should the overlay REMOVE the\n * review-registered (template-based, read-only) Whiteboard tab?\n *\n * Yes only when ALL hold:\n * - a live session is active (the channel set emission belongs to a real session start, not\n * the initial/teardown `[]` replay);\n * - review mode actually registered a whiteboard tab (otherwise there is nothing stale);\n * - the live session's resolved channel set has NO Whiteboard channel — when it HAS one, the\n * live plugin re-registers the same tab key and upgrades the pane in place instead.\n *\n * Kept framework-free (like the model) so the rule is unit-testable in isolation.\n */\nexport function ShouldRemoveReviewWhiteboardTab(\n liveSessionActive: boolean,\n reviewWhiteboardTabRegistered: boolean,\n liveChannels: ReadonlyArray<{ ChannelName: string }>\n): boolean {\n if (!liveSessionActive || !reviewWhiteboardTabRegistered) {\n return false;\n }\n return !liveChannels.some(c => c.ChannelName?.trim().toLowerCase() === 'whiteboard');\n}\n"]}
|
|
1
|
+
{"version":3,"file":"realtime-surface-tabs.model.js","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-surface-tab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,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC/C,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC;AACjF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAC7C,iBAA0B,EAC1B,6BAAsC,EACtC,YAAoD;IAEpD,OAAO,4BAA4B,CAAC,iBAAiB,EAAE,6BAA6B,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AACpH,CAAC","sourcesContent":["import { Subject } from 'rxjs';\nimport type { TemplateRef } from '@angular/core';\nimport type { BaseRealtimeChannelClient } from '@memberjunction/realtime-runtime';\nimport { ChannelTabColor } from './realtime-surface-tab-style';\n\n/**\n * The kind of a surface-panel tab:\n * - `activity` — the session-activity tab (pinned LAST, right-aligned). Hosts the activity\n * rail AND, since the artifact redesign, the inline artifact previews + the split-pane\n * artifact viewer. Shown only once ≥1 agent run has occurred (see\n * {@link RealtimeSurfaceTabsModel.SetShowActivityTab}).\n * - `channel` — an interactive-channel surface (e.g. the Whiteboard). Registered per\n * used channel via {@link RealtimeSurfaceTabsModel.RegisterChannelTab}; renders the\n * plugin's dynamically-created surface component (or a registered template for\n * legacy/template-based panes), with the \"coming online…\" placeholder until either\n * is supplied.\n *\n * NOTE: artifacts NO LONGER get their own tab. A delegated run's artifacts now render\n * INSIDE the Activity tab (inline previews + an `as-split` viewer pane) — see\n * `RealtimeActivityRailComponent`.\n */\nexport type RealtimeSurfaceTabKind = 'activity' | 'channel';\n\n/**\n * Per-kind payload carried on a {@link RealtimeSurfaceTab}.\n */\nexport interface RealtimeSurfaceTabData {\n /**\n * For `channel` tabs: the channel PLUGIN whose surface component the pane creates\n * dynamically (and binds back to the plugin) — the registry-driven path every real\n * channel uses. Takes precedence over {@link Content}.\n */\n Plugin?: BaseRealtimeChannelClient;\n /**\n * For `channel` tabs: a TEMPLATE-based pane body. Backward-compatible alternative to\n * {@link Plugin} for hosts that render a bespoke surface without a channel plugin.\n * When BOTH are absent the pane renders the built-in \"coming online…\" placeholder.\n */\n Content?: TemplateRef<unknown>;\n}\n\n/**\n * One tab on the call overlay's tabbed surface panel (the right panel): a channel surface\n * (left cluster) or the session-activity tab (right-aligned).\n */\nexport interface RealtimeSurfaceTab {\n /** Stable unique key (`activity`, or the channel's registered key). */\n Key: string;\n /** Tab strip label (channel name, or \"Activity\"). */\n Title: string;\n /** Font Awesome icon class for the tab strip (e.g. `fa-solid fa-chalkboard`). */\n Icon: string;\n /** What the tab renders. */\n Kind: RealtimeSurfaceTabKind;\n /**\n * Accent color for the tab's dot + active underline. Channel tabs carry a distinct color\n * (plugin-supplied or a deterministic hash of the name); the Activity tab uses its own\n * fixed accent in CSS, so its `Color` is left undefined.\n */\n Color?: string;\n /** Kind-specific payload. */\n Data?: RealtimeSurfaceTabData;\n}\n\n/**\n * Registration for an interactive-channel tab. The overlay shell registers one per\n * USED channel plugin (supplying {@link Plugin}); supplying {@link Plugin} or\n * {@link Content} later under the same `Key` upgrades a placeholder tab to the real surface.\n */\nexport interface RealtimeChannelTabRegistration {\n /** Stable channel key (the plugin's `ChannelName`, e.g. `Whiteboard`). Re-registering the same key updates the tab. */\n Key: string;\n /** Tab strip label (e.g. `Whiteboard`). */\n Title: string;\n /** Font Awesome icon class (e.g. `fa-solid fa-chalkboard`). */\n Icon: string;\n /**\n * Optional explicit accent color for the tab. When omitted, a deterministic color is\n * derived from {@link Key} so every channel tab still reads as a distinct surface.\n */\n Color?: string | null;\n /** The channel plugin whose surface the pane creates + binds. Preferred over {@link Content}. */\n Plugin?: BaseRealtimeChannelClient;\n /** A template-based pane body (legacy/bespoke panes). Omit both to show the \"coming online…\" placeholder. */\n Content?: TemplateRef<unknown>;\n /** Focus the tab immediately after registration (default `false`). */\n Focus?: boolean;\n}\n\n/**\n * Framework-free state for the call overlay's tabbed surface panel: the ordered tab list\n * (CHANNEL tabs first — the marquee surfaces, left cluster — with the session-activity tab\n * pinned LAST and right-aligned by the strip), the active tab, and the transient \"flash\"\n * highlight for a just-revealed channel tab.\n *\n * The Activity tab is GATED: it isn't listed until {@link SetShowActivityTab}(true) — i.e.\n * once ≥1 agent run has occurred (or in review mode). Channel tabs appear only as channels\n * come into play (the whiteboard up-front; every other channel on first use), so an\n * idle voice-first session shows an empty/near-empty strip rather than a row of unused tabs.\n *\n * Owned by `RealtimeSurfaceTabsComponent`; kept free of Angular runtime imports so the\n * add / focus / dedupe / flash logic is unit-testable in isolation. All collections are\n * REPLACED (never mutated) on change, and every change emits {@link Changed$}.\n */\nexport class RealtimeSurfaceTabsModel {\n /** The fixed key of the session-activity tab (pinned LAST, right-aligned). */\n public static readonly ActivityTabKey = 'activity';\n\n /** The activity tab definition, appended last whenever {@link showActivity} is true. */\n private static readonly activityTab: RealtimeSurfaceTab = {\n Key: RealtimeSurfaceTabsModel.ActivityTabKey,\n Title: 'Activity',\n Icon: 'fa-solid fa-wave-square',\n Kind: 'activity'\n };\n\n /** Channel tabs (left cluster), in registration order. Replaced immutably on change. */\n private channelTabs: RealtimeSurfaceTab[] = [];\n\n /** Whether the gated Activity tab is currently shown (≥1 agent run, or review mode). */\n private showActivity = false;\n\n /** Key of the currently focused tab. */\n public ActiveKey: string = RealtimeSurfaceTabsModel.ActivityTabKey;\n\n /**\n * Key of the tab currently \"flashing\" (the brief highlight a just-revealed channel tab\n * gets when the agent first acts on it). Cleared by the owning component after a beat via\n * {@link ClearFlash}.\n */\n public FlashKey: string | null = null;\n\n /** Emits after every model change so the owning component can mark for check. */\n public readonly Changed$ = new Subject<void>();\n\n /**\n * The ordered tabs: channel tabs (left), then the Activity tab LAST when shown. The strip\n * right-aligns the Activity tab via a flex spacer, so this order also matches reading order.\n */\n public get Tabs(): RealtimeSurfaceTab[] {\n return this.showActivity\n ? [...this.channelTabs, RealtimeSurfaceTabsModel.activityTab]\n : [...this.channelTabs];\n }\n\n /** Whether the Activity tab is currently part of the strip. */\n public get IsActivityShown(): boolean {\n return this.showActivity;\n }\n\n /**\n * The currently focused tab. Resolves to the active key when it still exists, else falls\n * back to the Activity tab (when shown), else the first channel tab, else the Activity tab\n * definition (so a consumer always has SOMETHING to render even on an empty strip).\n */\n public get ActiveTab(): RealtimeSurfaceTab {\n const tabs = this.Tabs;\n return tabs.find(t => t.Key === this.ActiveKey)\n ?? tabs.find(t => t.Key === RealtimeSurfaceTabsModel.ActivityTabKey)\n ?? tabs[0]\n ?? RealtimeSurfaceTabsModel.activityTab;\n }\n\n /**\n * The key of the channel whose tab is focused, or `null` when the focused tab is not a channel's (the Activity\n * tab, or an empty strip). This is what tells the session which surface the user is looking at.\n */\n public get ActiveChannelKey(): string | null {\n const tab = this.ActiveTab;\n return tab.Kind === 'channel' ? tab.Key : null;\n }\n\n /**\n * Shows or hides the gated Activity tab. Turning it ON when an empty strip was implicitly\n * focusing Activity keeps focus on Activity; turning it OFF while it was focused falls\n * focus back to the first channel tab (if any). No-op (no emission) when unchanged.\n *\n * @param show Whether ≥1 agent run has occurred (or review mode) — the gate.\n */\n public SetShowActivityTab(show: boolean): void {\n if (this.showActivity === show) {\n return;\n }\n this.showActivity = show;\n if (!show && this.ActiveKey === RealtimeSurfaceTabsModel.ActivityTabKey) {\n this.ActiveKey = this.channelTabs[0]?.Key ?? RealtimeSurfaceTabsModel.ActivityTabKey;\n }\n this.Changed$.next();\n }\n\n /**\n * Registers (or updates) an interactive-channel tab. Re-registering an existing key\n * replaces its title/icon/color/plugin/content in place (this is how a placeholder\n * upgrades to the real surface once the channel comes online). New channel tabs join the\n * left cluster in registration order. A registration without an explicit {@link\n * RealtimeChannelTabRegistration.Color} gets a deterministic color from its key.\n *\n * @param registration The channel tab registration.\n * @returns The (new or updated) tab.\n */\n public RegisterChannelTab(registration: RealtimeChannelTabRegistration): RealtimeSurfaceTab {\n const tab: RealtimeSurfaceTab = {\n Key: registration.Key,\n Title: registration.Title,\n Icon: registration.Icon,\n Kind: 'channel',\n Color: registration.Color ?? ChannelTabColor(registration.Key),\n Data: { Plugin: registration.Plugin, Content: registration.Content }\n };\n const idx = this.channelTabs.findIndex(t => t.Key === registration.Key);\n if (idx >= 0) {\n const next = [...this.channelTabs];\n next[idx] = tab;\n this.channelTabs = next;\n } else {\n this.channelTabs = [...this.channelTabs, tab];\n }\n if (registration.Focus) {\n this.ActiveKey = tab.Key;\n }\n this.Changed$.next();\n return tab;\n }\n\n /** Focuses the tab with `key` (no-op when it doesn't exist or is already active). */\n public Focus(key: string): void {\n if (!this.Tabs.some(t => t.Key === key) || this.ActiveKey === key) {\n return;\n }\n this.ActiveKey = key;\n this.Changed$.next();\n }\n\n /**\n * Marks the tab with `key` as the {@link FlashKey} (the brief \"just arrived\" highlight)\n * WITHOUT changing focus — used by the auto-reveal path when the agent first acts on a\n * channel, so the user's eye lands on the tab that just came alive. No-op for unknown\n * keys; the owning component clears it after a beat via {@link ClearFlash}.\n */\n public FlashTab(key: string): void {\n if (this.FlashKey === key || !this.Tabs.some(t => t.Key === key)) {\n return;\n }\n this.FlashKey = key;\n this.Changed$.next();\n }\n\n /**\n * Removes the channel tab with `key`. Rules:\n * - the Activity tab is IRREMOVABLE — removing it is a no-op;\n * - an unknown key is a no-op (returns `false`);\n * - when the removed tab was focused, focus falls back to the Activity tab (if shown),\n * else the first remaining channel tab;\n * - a pending flash on the removed tab is cleaned up so the highlight can't dangle.\n *\n * @param key The tab key to remove.\n * @returns `true` when a tab was removed.\n */\n public RemoveTab(key: string): boolean {\n if (key === RealtimeSurfaceTabsModel.ActivityTabKey || !this.channelTabs.some(t => t.Key === key)) {\n return false;\n }\n this.channelTabs = this.channelTabs.filter(t => t.Key !== key);\n if (this.ActiveKey === key) {\n this.ActiveKey = this.showActivity\n ? RealtimeSurfaceTabsModel.ActivityTabKey\n : (this.channelTabs[0]?.Key ?? RealtimeSurfaceTabsModel.ActivityTabKey);\n }\n if (this.FlashKey === key) {\n this.FlashKey = null;\n }\n this.Changed$.next();\n return true;\n }\n\n /** Clears the transient flash highlight (called by the component after a beat). */\n public ClearFlash(): void {\n if (this.FlashKey !== null) {\n this.FlashKey = null;\n this.Changed$.next();\n }\n }\n}\n\n/**\n * Pure decision helper for the REVIEW→LIVE continuation edge: should the overlay REMOVE a\n * review-registered (template-based, read-only) channel tab?\n */\nexport function ShouldRemoveReviewChannelTab(\n liveSessionActive: boolean,\n reviewTabRegistered: boolean,\n channelKey: string,\n liveChannels: ReadonlyArray<{ ChannelName: string }>\n): boolean {\n if (!liveSessionActive || !reviewTabRegistered) {\n return false;\n }\n const target = channelKey.trim().toLowerCase();\n return !liveChannels.some(c => c.ChannelName?.trim().toLowerCase() === target);\n}\n\n/**\n * Pure decision helper for the REVIEW→LIVE continuation edge: should the overlay REMOVE the\n * review-registered (template-based, read-only) Whiteboard tab?\n */\nexport function ShouldRemoveReviewWhiteboardTab(\n liveSessionActive: boolean,\n reviewWhiteboardTabRegistered: boolean,\n liveChannels: ReadonlyArray<{ ChannelName: string }>\n): boolean {\n return ShouldRemoveReviewChannelTab(liveSessionActive, reviewWhiteboardTabRegistered, 'Whiteboard', liveChannels);\n}\n"]}
|