@memberjunction/ng-conversations 6.3.0-edge.0 → 6.3.0-edge.2
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 +60 -22
- package/dist/assets/edge-ai.worker.js +35168 -0
- package/dist/lib/components/agent/agent-instance-editor-modal.component.d.ts +186 -0
- package/dist/lib/components/agent/agent-instance-editor-modal.component.d.ts.map +1 -0
- package/dist/lib/components/agent/agent-instance-editor-modal.component.js +2202 -0
- package/dist/lib/components/agent/agent-instance-editor-modal.component.js.map +1 -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 +773 -204
- package/dist/lib/components/artifact/artifact-share-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 +108 -106
- package/dist/lib/components/collection/collections-full-view.component.js.map +1 -1
- package/dist/lib/components/composer/ai-composer.component.d.ts +15 -1
- package/dist/lib/components/composer/ai-composer.component.d.ts.map +1 -1
- package/dist/lib/components/composer/ai-composer.component.js +43 -4
- package/dist/lib/components/composer/ai-composer.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts +20 -2
- package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-agent-picker.component.js +378 -62
- package/dist/lib/components/conversation/conversation-agent-picker.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +94 -18
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +732 -439
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts +19 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.js +184 -89
- package/dist/lib/components/conversation/conversation-list.component.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 +293 -0
- package/dist/lib/components/library/library-workspace.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-workspace.component.js +5121 -0
- package/dist/lib/components/library/library-workspace.component.js.map +1 -0
- package/dist/lib/components/library/library.models.d.ts +192 -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/agent-handoff-card.component.js +1 -1
- package/dist/lib/components/message/agent-handoff-card.component.js.map +1 -1
- 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 +33 -14
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input.component.js +142 -75
- package/dist/lib/components/message/message-input.component.js.map +1 -1
- package/dist/lib/components/message/message-item.component.d.ts +51 -4
- package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-item.component.js +640 -399
- package/dist/lib/components/message/message-item.component.js.map +1 -1
- package/dist/lib/components/message/message-list.component.d.ts +15 -1
- package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-list.component.js +75 -3
- 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 +974 -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/capture/realtime-capture-channel.d.ts +28 -1
- package/dist/lib/components/realtime/capture/realtime-capture-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/capture/realtime-capture-channel.js +53 -1
- package/dist/lib/components/realtime/capture/realtime-capture-channel.js.map +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.js +23 -7
- 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/media/media-channel.d.ts +32 -11
- package/dist/lib/components/realtime/media/media-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/media/media-channel.js +186 -23
- package/dist/lib/components/realtime/media/media-channel.js.map +1 -1
- package/dist/lib/components/realtime/media/realtime-media-surface.component.d.ts +9 -1
- package/dist/lib/components/realtime/media/realtime-media-surface.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/media/realtime-media-surface.component.js +33 -10
- package/dist/lib/components/realtime/media/realtime-media-surface.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.js +3 -3
- 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 +6 -4
- package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +82 -33
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.js +521 -191
- package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-state.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-state.js +1 -1
- package/dist/lib/components/realtime/realtime-session-state.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 +90 -5
- 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 +11 -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 +24 -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 +25 -15
- 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 +30 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +150 -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/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/share/share-modal.component.d.ts.map +1 -1
- package/dist/lib/components/share/share-modal.component.js +181 -127
- package/dist/lib/components/share/share-modal.component.js.map +1 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts +14 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts.map +1 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.js +50 -11
- package/dist/lib/components/sidebar/conversation-sidebar.component.js.map +1 -1
- package/dist/lib/components/sidebar/my-agents-section.component.d.ts +78 -0
- package/dist/lib/components/sidebar/my-agents-section.component.d.ts.map +1 -0
- package/dist/lib/components/sidebar/my-agents-section.component.js +450 -0
- package/dist/lib/components/sidebar/my-agents-section.component.js.map +1 -0
- 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 +701 -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/composer-plugins/base-conversation-mention.provider.d.ts +1 -0
- package/dist/lib/composer-plugins/base-conversation-mention.provider.d.ts.map +1 -1
- package/dist/lib/composer-plugins/base-conversation-mention.provider.js +13 -1
- package/dist/lib/composer-plugins/base-conversation-mention.provider.js.map +1 -1
- package/dist/lib/conversations.module.d.ts +78 -71
- package/dist/lib/conversations.module.d.ts.map +1 -1
- package/dist/lib/conversations.module.js +68 -1
- package/dist/lib/conversations.module.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 +31 -21
- package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-agent.service.js +84 -35
- 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-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.map +1 -1
- package/dist/lib/services/realtime-session.service.js +2 -1
- 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-handoff-map.js +1 -1
- package/dist/lib/utils/agent-handoff-map.js.map +1 -1
- package/dist/lib/utils/agent-turn-routing.js +1 -1
- package/dist/lib/utils/agent-turn-routing.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 +15 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +17 -1
- package/dist/public-api.js.map +1 -1
- package/package.json +42 -37
|
@@ -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
|
|
@@ -112,4 +112,23 @@ export function ParseActivitySplitPercent(raw) {
|
|
|
112
112
|
export function SerializeActivitySplitPercent(percent) {
|
|
113
113
|
return JSON.stringify({ percent: ClampActivitySplitPercent(percent) });
|
|
114
114
|
}
|
|
115
|
+
const CANONICAL_CHANNEL_ORDER = {
|
|
116
|
+
artifactworkspace: 0,
|
|
117
|
+
whiteboard: 1,
|
|
118
|
+
'remote browser': 2,
|
|
119
|
+
media: 3,
|
|
120
|
+
recording: 90,
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Deterministic display rank for left-cluster surface channel tabs so the strip keeps a
|
|
124
|
+
* consistent order (`Workspace`, `Whiteboard`, `Browser`, `Media`, then custom/other channels,
|
|
125
|
+
* then `Recording`) across live calls, session review, and multi-leg resume — regardless of
|
|
126
|
+
* which channel restores or mounts first.
|
|
127
|
+
*/
|
|
128
|
+
export function ChannelTabSortOrder(channelKey) {
|
|
129
|
+
const normalized = (channelKey ?? '').trim().toLowerCase();
|
|
130
|
+
return Object.prototype.hasOwnProperty.call(CANONICAL_CHANNEL_ORDER, normalized)
|
|
131
|
+
? CANONICAL_CHANNEL_ORDER[normalized]
|
|
132
|
+
: 50;
|
|
133
|
+
}
|
|
115
134
|
//# sourceMappingURL=realtime-surface-tab-style.js.map
|
|
@@ -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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AI,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAClD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,OAAO,GAAI,MAAgC,CAAC,OAAO,CAAC;QAC1D,IAAI,OAAO,OAAO,KAAK,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;AAED,MAAM,uBAAuB,GAAqC;IAChE,iBAAiB,EAAE,CAAC;IACpB,UAAU,EAAE,CAAC;IACb,gBAAgB,EAAE,CAAC;IACnB,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,EAAE;CACd,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAqC;IACvE,MAAM,UAAU,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3D,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC;QAC9E,CAAC,CAAC,uBAAuB,CAAC,UAAU,CAAC;QACrC,CAAC,CAAC,EAAE,CAAC;AACT,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\nconst CANONICAL_CHANNEL_ORDER: Readonly<Record<string, number>> = {\n artifactworkspace: 0,\n whiteboard: 1,\n 'remote browser': 2,\n media: 3,\n recording: 90,\n};\n\n/**\n * Deterministic display rank for left-cluster surface channel tabs so the strip keeps a\n * consistent order (`Workspace`, `Whiteboard`, `Browser`, `Media`, then custom/other channels,\n * then `Recording`) across live calls, session review, and multi-leg resume — regardless of\n * which channel restores or mounts first.\n */\nexport function ChannelTabSortOrder(channelKey: string | null | undefined): number {\n const normalized = (channelKey ?? '').trim().toLowerCase();\n return Object.prototype.hasOwnProperty.call(CANONICAL_CHANNEL_ORDER, normalized)\n ? CANONICAL_CHANNEL_ORDER[normalized]\n : 50;\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,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,IAAI,EAAE,sBAAsB,CAAC;IAC7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC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;
|
|
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,IAAI,CAAC,EAAE,sBAAsB,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC7C,uHAAuH;IACvH,GAAG,EAAE,MAAM,CAAC;IACZ,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,iGAAiG;IACjG,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC,6GAA6G;IAC7G,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC/B,sEAAs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AE,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Subject } from 'rxjs';
|
|
2
|
-
import { ChannelTabColor } from './realtime-surface-tab-style';
|
|
2
|
+
import { ChannelTabColor, ChannelTabSortOrder } from './realtime-surface-tab-style';
|
|
3
3
|
/**
|
|
4
4
|
* Framework-free state for the call overlay's tabbed surface panel: the ordered tab list
|
|
5
5
|
* (CHANNEL tabs first — the marquee surfaces, left cluster — with the session-activity tab
|
|
@@ -115,7 +115,18 @@ export class RealtimeSurfaceTabsModel {
|
|
|
115
115
|
this.channelTabs = next;
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
|
-
|
|
118
|
+
const rank = ChannelTabSortOrder(tab.Key);
|
|
119
|
+
const insertAt = this.channelTabs.findIndex(t => ChannelTabSortOrder(t.Key) > rank);
|
|
120
|
+
if (insertAt < 0) {
|
|
121
|
+
this.channelTabs = [...this.channelTabs, tab];
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.channelTabs = [
|
|
125
|
+
...this.channelTabs.slice(0, insertAt),
|
|
126
|
+
tab,
|
|
127
|
+
...this.channelTabs.slice(insertAt),
|
|
128
|
+
];
|
|
129
|
+
}
|
|
119
130
|
}
|
|
120
131
|
if (registration.Focus) {
|
|
121
132
|
this.ActiveKey = tab.Key;
|
|
@@ -179,23 +190,22 @@ export class RealtimeSurfaceTabsModel {
|
|
|
179
190
|
}
|
|
180
191
|
}
|
|
181
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Pure decision helper for the REVIEW→LIVE continuation edge: should the overlay REMOVE a
|
|
195
|
+
* review-registered (template-based, read-only) channel tab?
|
|
196
|
+
*/
|
|
197
|
+
export function ShouldRemoveReviewChannelTab(liveSessionActive, reviewTabRegistered, channelKey, liveChannels) {
|
|
198
|
+
if (!liveSessionActive || !reviewTabRegistered) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
const target = channelKey.trim().toLowerCase();
|
|
202
|
+
return !liveChannels.some(c => c.ChannelName?.trim().toLowerCase() === target);
|
|
203
|
+
}
|
|
182
204
|
/**
|
|
183
205
|
* Pure decision helper for the REVIEW→LIVE continuation edge: should the overlay REMOVE the
|
|
184
206
|
* 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
207
|
*/
|
|
195
208
|
export function ShouldRemoveReviewWhiteboardTab(liveSessionActive, reviewWhiteboardTabRegistered, liveChannels) {
|
|
196
|
-
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
199
|
-
return !liveChannels.some(c => c.ChannelName?.trim().toLowerCase() === 'whiteboard');
|
|
209
|
+
return ShouldRemoveReviewChannelTab(liveSessionActive, reviewWhiteboardTabRegistered, 'Whiteboard', liveChannels);
|
|
200
210
|
}
|
|
201
211
|
//# 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,OAA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AAK,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-tabs.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAsFpF;;;;;;;;;;;;;;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,YAAY,GAAG,KAAK,CAAC;IAE7B,wCAAwC;IACjC,SAAS,GAAW,wBAAwB,CAAC,cAAc,CAAC;IAEnE;;;;OAIG;IACI,QAAQ,GAAkB,IAAI,CAAC;IAEtC,iFAAiF;IACjE,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;IAE/C;;;OAGG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,YAAY;YACtB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,wBAAwB,CAAC,WAAW,CAAC;YAC7D,CAA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AE,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, ChannelTabSortOrder } 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 const rank = ChannelTabSortOrder(tab.Key);\n const insertAt = this.channelTabs.findIndex(t => ChannelTabSortOrder(t.Key) > rank);\n if (insertAt < 0) {\n this.channelTabs = [...this.channelTabs, tab];\n } else {\n this.channelTabs = [\n ...this.channelTabs.slice(0, insertAt),\n tab,\n ...this.channelTabs.slice(insertAt),\n ];\n }\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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Type } from '@angular/core';
|
|
2
|
-
import { RealtimeToolDefinition, RealtimeTrackDescriptor } from '@memberjunction/ai';
|
|
2
|
+
import { JSONObject, RealtimeToolDefinition, RealtimeTrackDescriptor } from '@memberjunction/ai';
|
|
3
3
|
import { IChannelFrameProvider } from '@memberjunction/ai-realtime-client';
|
|
4
4
|
import { type RealtimeChannelDescriptor } from '@memberjunction/ai-core-plus';
|
|
5
5
|
import { BaseRealtimeChannelClient, ChannelOnboardingDetails } from '@memberjunction/realtime-runtime';
|
|
@@ -48,6 +48,8 @@ export declare class RemoteBrowserChannel extends BaseRealtimeChannelClient<Remo
|
|
|
48
48
|
GetLatestFrame(): Promise<string | null>;
|
|
49
49
|
/** Subscription to the bound surface's `HumanInput` output, torn down on unbind/dispose. */
|
|
50
50
|
private humanInputSub;
|
|
51
|
+
/** Subscription to the bound surface's `ViewportResize` output, torn down on unbind/dispose. */
|
|
52
|
+
private viewportResizeSub;
|
|
51
53
|
/**
|
|
52
54
|
* Whether the server confirmed it is PUSHING screencast frames for this session (`ScreenStreaming`
|
|
53
55
|
* supported). When `true` the surface renders pushed frames on its canvas and skips its poll, and
|
|
@@ -66,6 +68,15 @@ export declare class RemoteBrowserChannel extends BaseRealtimeChannelClient<Remo
|
|
|
66
68
|
* as somebody else navigating — the first page of a session was nobody's takeover.
|
|
67
69
|
*/
|
|
68
70
|
private lastNotedUrl;
|
|
71
|
+
/** Sequential history of pages visited in this session (capped for compact persistence). */
|
|
72
|
+
private visitedHistory;
|
|
73
|
+
/** Latest bounded screenshot data URL captured for post-session review & resume. */
|
|
74
|
+
private lastScreenshotDataUrl;
|
|
75
|
+
/** Debounce timer for saving updated screenshots without hammering storage on 60fps streams. */
|
|
76
|
+
private saveTimer;
|
|
77
|
+
private static readonly MAX_HISTORY_ENTRIES;
|
|
78
|
+
private static readonly MAX_SAVED_SCREENSHOT_BYTES;
|
|
79
|
+
private static readonly SCREENSHOT_SAVE_DEBOUNCE_MS;
|
|
69
80
|
/**
|
|
70
81
|
* How many browser operations the AGENT itself has in flight right now (#3496).
|
|
71
82
|
*
|
|
@@ -222,6 +233,14 @@ export declare class RemoteBrowserChannel extends BaseRealtimeChannelClient<Remo
|
|
|
222
233
|
* @param input The flattened pointer/keyboard input the user performed on the live canvas.
|
|
223
234
|
*/
|
|
224
235
|
private relayHumanInput;
|
|
236
|
+
/**
|
|
237
|
+
* Relays the surface's measured usable viewport size (`{ Width, Height }`) to the server's
|
|
238
|
+
* {@link RESIZE_VIEWPORT_MUTATION}, which resizes the already-open Playwright page in place and pushes a
|
|
239
|
+
* fresh screencast frame without navigating or reloading. Best-effort and fire-and-forget.
|
|
240
|
+
*
|
|
241
|
+
* @param size The usable drawer viewport dimensions in CSS pixels.
|
|
242
|
+
*/
|
|
243
|
+
private relayViewportResize;
|
|
225
244
|
/**
|
|
226
245
|
* Reads the remote page's current selection for COPY-OUT — backs the surface's `FetchSelection`. Awaits
|
|
227
246
|
* the `GetRemoteBrowserSelection` query and returns its text. Best-effort by contract
|
|
@@ -240,6 +259,16 @@ export declare class RemoteBrowserChannel extends BaseRealtimeChannelClient<Remo
|
|
|
240
259
|
* carries the URL, and until now only the surface read it.
|
|
241
260
|
*/
|
|
242
261
|
private fetchSnapshot;
|
|
262
|
+
/** Returns a compact summary of the active remote browser URL and navigation history for surface notes and peek calls. */
|
|
263
|
+
GetState(): JSONObject;
|
|
264
|
+
/** Serializes the visited page history and latest bounded screenshot for review / resume. */
|
|
265
|
+
SerializeState(): string | null;
|
|
266
|
+
/** Restores saved URL history and screenshot metadata from a prior session leg. */
|
|
267
|
+
RestoreState(stateJson: string): boolean;
|
|
268
|
+
private recordScreenshotFrame;
|
|
269
|
+
private scheduleSaveState;
|
|
270
|
+
private clearSaveTimer;
|
|
271
|
+
private flushSaveState;
|
|
243
272
|
/**
|
|
244
273
|
* The ONE place the agent is told where the page is (#3496).
|
|
245
274
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-browser-channel.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/remote-browser/remote-browser-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,
|
|
1
|
+
{"version":3,"file":"remote-browser-channel.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/remote-browser/remote-browser-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,EAA+B,UAAU,EAAa,sBAAsB,EAAiB,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACxJ,OAAO,EAA6B,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AACtG,OAAO,EAAqC,KAAK,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACjH,OAAO,EAAE,yBAAyB,EAAwB,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC7H,OAAO,EAIL,6BAA6B,EAI9B,MAAM,oCAA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AI,CAEvD"}
|
|
@@ -5,12 +5,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var RemoteBrowserChannel_1;
|
|
8
|
-
import { RegisterClass } from '@memberjunction/global';
|
|
8
|
+
import { RegisterClass, SafeJSONParse } from '@memberjunction/global';
|
|
9
9
|
import { CHANNEL_INBOUND_VIDEO_TRACK } from '@memberjunction/ai';
|
|
10
10
|
import { ChannelInboundVideoBridge } from '@memberjunction/ai-realtime-client';
|
|
11
11
|
import { REALTIME_CHANNEL_CONTRACT_VERSION } from '@memberjunction/ai-core-plus';
|
|
12
12
|
import { BaseRealtimeChannelClient, BuildToolBackedVerbs } from '@memberjunction/realtime-runtime';
|
|
13
|
-
import { RemoteBrowserSurfaceComponent } from './remote-browser-surface.component';
|
|
13
|
+
import { IsSafeRasterImageDataUrl, RemoteBrowserSurfaceComponent, } from './remote-browser-surface.component';
|
|
14
|
+
import { IsAllowedExternalMediaUrl } from '../media/media-channel-state';
|
|
14
15
|
import { MapToolToAction, REMOTE_BROWSER_TOOL_DEFINITIONS, REMOTE_BROWSER_TOOL_NAMES, REMOTE_BROWSER_TOOL_PREFIX, RemoteBrowserToolArgError, } from './remote-browser-tools';
|
|
15
16
|
import { MediaSourceAudioSink, RemoteBrowserAudioPlayer } from './remote-browser-audio-player';
|
|
16
17
|
/**
|
|
@@ -130,6 +131,15 @@ const RELAY_HUMAN_INPUT_MUTATION = `
|
|
|
130
131
|
)
|
|
131
132
|
}
|
|
132
133
|
`;
|
|
134
|
+
/**
|
|
135
|
+
* VIEWPORT-RESIZE mutation — resizes the already-open remote browser page in place to match the usable
|
|
136
|
+
* drawer area below the toolbar, then pushes a fresh screencast frame without navigating or reloading.
|
|
137
|
+
*/
|
|
138
|
+
const RESIZE_VIEWPORT_MUTATION = `
|
|
139
|
+
mutation ResizeRemoteBrowserViewport($agentSessionID: String!, $width: Int!, $height: Int!) {
|
|
140
|
+
ResizeRemoteBrowserViewport(agentSessionID: $agentSessionID, width: $width, height: $height)
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
133
143
|
/**
|
|
134
144
|
* COPY-OUT query — reads the remote page's current text selection so the surface can write it to the LOCAL
|
|
135
145
|
* clipboard on a `copy` / Cmd+C (the mirror of the `'text'` paste-in path). Returns `''` when nothing is
|
|
@@ -224,6 +234,8 @@ let RemoteBrowserChannel = class RemoteBrowserChannel extends BaseRealtimeChanne
|
|
|
224
234
|
}
|
|
225
235
|
/** Subscription to the bound surface's `HumanInput` output, torn down on unbind/dispose. */
|
|
226
236
|
humanInputSub = null;
|
|
237
|
+
/** Subscription to the bound surface's `ViewportResize` output, torn down on unbind/dispose. */
|
|
238
|
+
viewportResizeSub = null;
|
|
227
239
|
/**
|
|
228
240
|
* Whether the server confirmed it is PUSHING screencast frames for this session (`ScreenStreaming`
|
|
229
241
|
* supported). When `true` the surface renders pushed frames on its canvas and skips its poll, and
|
|
@@ -242,6 +254,15 @@ let RemoteBrowserChannel = class RemoteBrowserChannel extends BaseRealtimeChanne
|
|
|
242
254
|
* as somebody else navigating — the first page of a session was nobody's takeover.
|
|
243
255
|
*/
|
|
244
256
|
lastNotedUrl = null;
|
|
257
|
+
/** Sequential history of pages visited in this session (capped for compact persistence). */
|
|
258
|
+
visitedHistory = [];
|
|
259
|
+
/** Latest bounded screenshot data URL captured for post-session review & resume. */
|
|
260
|
+
lastScreenshotDataUrl = null;
|
|
261
|
+
/** Debounce timer for saving updated screenshots without hammering storage on 60fps streams. */
|
|
262
|
+
saveTimer = null;
|
|
263
|
+
static MAX_HISTORY_ENTRIES = 50;
|
|
264
|
+
static MAX_SAVED_SCREENSHOT_BYTES = 1_500_000;
|
|
265
|
+
static SCREENSHOT_SAVE_DEBOUNCE_MS = 1500;
|
|
245
266
|
/**
|
|
246
267
|
* How many browser operations the AGENT itself has in flight right now (#3496).
|
|
247
268
|
*
|
|
@@ -380,12 +401,19 @@ let RemoteBrowserChannel = class RemoteBrowserChannel extends BaseRealtimeChanne
|
|
|
380
401
|
*/
|
|
381
402
|
BindSurface(instance) {
|
|
382
403
|
this.surface = instance;
|
|
404
|
+
if (this.lastNotedUrl && !instance.CurrentUrl) {
|
|
405
|
+
instance.CurrentUrl = this.lastNotedUrl;
|
|
406
|
+
}
|
|
407
|
+
if (this.lastScreenshotDataUrl && !instance.ScreenshotDataUrl) {
|
|
408
|
+
instance.ScreenshotDataUrl = this.lastScreenshotDataUrl;
|
|
409
|
+
}
|
|
383
410
|
instance.Fetch = () => this.fetchSnapshot();
|
|
384
411
|
// Copy-out: the surface reads the remote selection through this on a local `copy` and writes it locally.
|
|
385
412
|
instance.FetchSelection = () => this.fetchSelection();
|
|
386
413
|
instance.Interactive = true;
|
|
387
414
|
this.ensureVideoBridge();
|
|
388
415
|
this.humanInputSub = instance.HumanInput.subscribe((input) => this.relayHumanInput(input));
|
|
416
|
+
this.viewportResizeSub = instance.ViewportResize?.subscribe((size) => this.relayViewportResize(size)) ?? null;
|
|
389
417
|
this.audioMutedSub = instance.AudioMutedChange.subscribe((muted) => this.audioPlayer?.SetMuted(muted));
|
|
390
418
|
void this.startScreencast(instance);
|
|
391
419
|
void this.startAudioStream(instance);
|
|
@@ -397,8 +425,11 @@ let RemoteBrowserChannel = class RemoteBrowserChannel extends BaseRealtimeChanne
|
|
|
397
425
|
}
|
|
398
426
|
}
|
|
399
427
|
UnbindSurface() {
|
|
428
|
+
this.flushSaveState();
|
|
400
429
|
this.humanInputSub?.unsubscribe();
|
|
401
430
|
this.humanInputSub = null;
|
|
431
|
+
this.viewportResizeSub?.unsubscribe();
|
|
432
|
+
this.viewportResizeSub = null;
|
|
402
433
|
this.audioMutedSub?.unsubscribe();
|
|
403
434
|
this.audioMutedSub = null;
|
|
404
435
|
void this.stopScreencast();
|
|
@@ -406,12 +437,16 @@ let RemoteBrowserChannel = class RemoteBrowserChannel extends BaseRealtimeChanne
|
|
|
406
437
|
this.surface = null;
|
|
407
438
|
}
|
|
408
439
|
Dispose() {
|
|
440
|
+
this.flushSaveState();
|
|
441
|
+
this.clearSaveTimer();
|
|
409
442
|
this.clearScreencastTrailingTimer();
|
|
410
443
|
this.pendingScreencastFrame = null;
|
|
411
444
|
this.videoBridge?.Stop();
|
|
412
445
|
this.videoBridge = null;
|
|
413
446
|
this.humanInputSub?.unsubscribe();
|
|
414
447
|
this.humanInputSub = null;
|
|
448
|
+
this.viewportResizeSub?.unsubscribe();
|
|
449
|
+
this.viewportResizeSub = null;
|
|
415
450
|
this.audioMutedSub?.unsubscribe();
|
|
416
451
|
this.audioMutedSub = null;
|
|
417
452
|
void this.stopScreencast();
|
|
@@ -498,6 +533,7 @@ let RemoteBrowserChannel = class RemoteBrowserChannel extends BaseRealtimeChanne
|
|
|
498
533
|
return;
|
|
499
534
|
}
|
|
500
535
|
this.surface?.RenderFrame(dataBase64);
|
|
536
|
+
this.recordScreenshotFrame(`data:image/jpeg;base64,${dataBase64}`);
|
|
501
537
|
const now = Date.now();
|
|
502
538
|
const cadenceMs = this.getNegotiatedVideoCadenceMs();
|
|
503
539
|
const elapsed = now - this.lastScreencastPushTime;
|
|
@@ -625,6 +661,24 @@ let RemoteBrowserChannel = class RemoteBrowserChannel extends BaseRealtimeChanne
|
|
|
625
661
|
modifiers: input.modifiers && input.modifiers.length > 0 ? input.modifiers.join(',') : null,
|
|
626
662
|
});
|
|
627
663
|
}
|
|
664
|
+
/**
|
|
665
|
+
* Relays the surface's measured usable viewport size (`{ Width, Height }`) to the server's
|
|
666
|
+
* {@link RESIZE_VIEWPORT_MUTATION}, which resizes the already-open Playwright page in place and pushes a
|
|
667
|
+
* fresh screencast frame without navigating or reloading. Best-effort and fire-and-forget.
|
|
668
|
+
*
|
|
669
|
+
* @param size The usable drawer viewport dimensions in CSS pixels.
|
|
670
|
+
*/
|
|
671
|
+
relayViewportResize(size) {
|
|
672
|
+
const sessionId = this.Context?.AgentSessionID;
|
|
673
|
+
if (!sessionId || size.Width <= 0 || size.Height <= 0) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
void this.Context?.ExecuteServerAction(RESIZE_VIEWPORT_MUTATION, {
|
|
677
|
+
agentSessionID: sessionId,
|
|
678
|
+
width: Math.floor(size.Width),
|
|
679
|
+
height: Math.floor(size.Height),
|
|
680
|
+
});
|
|
681
|
+
}
|
|
628
682
|
/**
|
|
629
683
|
* Reads the remote page's current selection for COPY-OUT — backs the surface's `FetchSelection`. Awaits
|
|
630
684
|
* the `GetRemoteBrowserSelection` query and returns its text. Best-effort by contract
|
|
@@ -669,9 +723,92 @@ let RemoteBrowserChannel = class RemoteBrowserChannel extends BaseRealtimeChanne
|
|
|
669
723
|
}
|
|
670
724
|
const data = await this.Context?.ExecuteServerAction(REMOTE_BROWSER_SNAPSHOT_QUERY, { agentSessionID: sessionId });
|
|
671
725
|
const snapshot = data?.RemoteBrowserSnapshot ?? null;
|
|
726
|
+
if (snapshot?.ScreenshotBase64) {
|
|
727
|
+
this.recordScreenshotFrame(`data:image/png;base64,${snapshot.ScreenshotBase64}`);
|
|
728
|
+
}
|
|
672
729
|
this.notePageChange(snapshot?.CurrentUrl ?? null, 'observed');
|
|
673
730
|
return snapshot;
|
|
674
731
|
}
|
|
732
|
+
/** Returns a compact summary of the active remote browser URL and navigation history for surface notes and peek calls. */
|
|
733
|
+
GetState() {
|
|
734
|
+
return {
|
|
735
|
+
currentUrl: this.lastNotedUrl ?? null,
|
|
736
|
+
historyCount: this.visitedHistory.length,
|
|
737
|
+
recentUrls: this.visitedHistory.slice(-5).map((h) => h.Url),
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
/** Serializes the visited page history and latest bounded screenshot for review / resume. */
|
|
741
|
+
SerializeState() {
|
|
742
|
+
if (!this.lastNotedUrl && this.visitedHistory.length === 0 && !this.lastScreenshotDataUrl) {
|
|
743
|
+
return null;
|
|
744
|
+
}
|
|
745
|
+
const payload = {
|
|
746
|
+
V: 1,
|
|
747
|
+
CurrentUrl: this.lastNotedUrl,
|
|
748
|
+
History: this.visitedHistory,
|
|
749
|
+
...(this.lastScreenshotDataUrl ? { ScreenshotDataUrl: this.lastScreenshotDataUrl } : {}),
|
|
750
|
+
};
|
|
751
|
+
return JSON.stringify(payload);
|
|
752
|
+
}
|
|
753
|
+
/** Restores saved URL history and screenshot metadata from a prior session leg. */
|
|
754
|
+
RestoreState(stateJson) {
|
|
755
|
+
const parsed = SafeJSONParse(stateJson);
|
|
756
|
+
if (!parsed || typeof parsed !== 'object') {
|
|
757
|
+
return false;
|
|
758
|
+
}
|
|
759
|
+
const safeUrl = typeof parsed.CurrentUrl === 'string' && IsAllowedExternalMediaUrl(parsed.CurrentUrl)
|
|
760
|
+
? parsed.CurrentUrl.trim()
|
|
761
|
+
: null;
|
|
762
|
+
const history = Array.isArray(parsed.History)
|
|
763
|
+
? parsed.History
|
|
764
|
+
.filter((h) => h != null &&
|
|
765
|
+
typeof h === 'object' &&
|
|
766
|
+
typeof h.Url === 'string' &&
|
|
767
|
+
IsAllowedExternalMediaUrl(h.Url))
|
|
768
|
+
.slice(-RemoteBrowserChannel_1.MAX_HISTORY_ENTRIES)
|
|
769
|
+
: [];
|
|
770
|
+
const screenshot = typeof parsed.ScreenshotDataUrl === 'string' &&
|
|
771
|
+
IsSafeRasterImageDataUrl(parsed.ScreenshotDataUrl) &&
|
|
772
|
+
parsed.ScreenshotDataUrl.length <= RemoteBrowserChannel_1.MAX_SAVED_SCREENSHOT_BYTES
|
|
773
|
+
? parsed.ScreenshotDataUrl
|
|
774
|
+
: null;
|
|
775
|
+
if (!safeUrl && history.length === 0 && !screenshot) {
|
|
776
|
+
return false;
|
|
777
|
+
}
|
|
778
|
+
this.lastNotedUrl = safeUrl;
|
|
779
|
+
this.visitedHistory = history;
|
|
780
|
+
this.lastScreenshotDataUrl = screenshot;
|
|
781
|
+
return true;
|
|
782
|
+
}
|
|
783
|
+
recordScreenshotFrame(dataUrl) {
|
|
784
|
+
if (!IsSafeRasterImageDataUrl(dataUrl) || dataUrl.length > RemoteBrowserChannel_1.MAX_SAVED_SCREENSHOT_BYTES) {
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
this.lastScreenshotDataUrl = dataUrl;
|
|
788
|
+
this.scheduleSaveState();
|
|
789
|
+
}
|
|
790
|
+
scheduleSaveState() {
|
|
791
|
+
if (this.saveTimer !== null || !this.Context) {
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
this.saveTimer = setTimeout(() => {
|
|
795
|
+
this.saveTimer = null;
|
|
796
|
+
this.flushSaveState();
|
|
797
|
+
}, RemoteBrowserChannel_1.SCREENSHOT_SAVE_DEBOUNCE_MS);
|
|
798
|
+
}
|
|
799
|
+
clearSaveTimer() {
|
|
800
|
+
if (this.saveTimer !== null) {
|
|
801
|
+
clearTimeout(this.saveTimer);
|
|
802
|
+
this.saveTimer = null;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
flushSaveState() {
|
|
806
|
+
this.clearSaveTimer();
|
|
807
|
+
const serialized = this.SerializeState();
|
|
808
|
+
if (serialized) {
|
|
809
|
+
this.Context?.RequestSave(serialized);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
675
812
|
/**
|
|
676
813
|
* The ONE place the agent is told where the page is (#3496).
|
|
677
814
|
*
|
|
@@ -707,8 +844,19 @@ let RemoteBrowserChannel = class RemoteBrowserChannel extends BaseRealtimeChanne
|
|
|
707
844
|
}
|
|
708
845
|
const firstSighting = this.lastNotedUrl === null;
|
|
709
846
|
this.lastNotedUrl = next;
|
|
847
|
+
if (IsAllowedExternalMediaUrl(next)) {
|
|
848
|
+
const lastEntry = this.visitedHistory[this.visitedHistory.length - 1];
|
|
849
|
+
if (!lastEntry || lastEntry.Url !== next) {
|
|
850
|
+
this.visitedHistory = [
|
|
851
|
+
...this.visitedHistory.slice(-(RemoteBrowserChannel_1.MAX_HISTORY_ENTRIES - 1)),
|
|
852
|
+
{ Url: next, VisitedAt: new Date().toISOString() },
|
|
853
|
+
];
|
|
854
|
+
}
|
|
855
|
+
this.flushSaveState();
|
|
856
|
+
}
|
|
710
857
|
// A change seen WHILE the agent is driving is the agent's own, whichever feed spotted it first.
|
|
711
858
|
const byAgent = cause === 'agent' || this.agentDrivingDepth > 0;
|
|
859
|
+
this.RecordChange({ Author: byAgent ? 'agent' : 'user', Perceive: false });
|
|
712
860
|
this.Context?.SendContextNote(byAgent || firstSighting
|
|
713
861
|
? `[browser] current page: ${next}`
|
|
714
862
|
: `[browser] the page changed to: ${next} — you did not navigate here, so someone else is driving. `
|