@memberjunction/ng-conversations 6.3.0-edge.1 → 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 +13 -0
- package/dist/assets/edge-ai.worker.js +3451 -798
- 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.map +1 -1
- package/dist/lib/components/artifact/artifact-share-modal.component.js +289 -266
- package/dist/lib/components/artifact/artifact-share-modal.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 +59 -9
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +645 -416
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts +5 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.js +100 -56
- package/dist/lib/components/conversation/conversation-list.component.js.map +1 -1
- package/dist/lib/components/library/library-workspace.component.d.ts +30 -2
- package/dist/lib/components/library/library-workspace.component.d.ts.map +1 -1
- package/dist/lib/components/library/library-workspace.component.js +1342 -641
- package/dist/lib/components/library/library-workspace.component.js.map +1 -1
- package/dist/lib/components/library/library.models.d.ts +33 -3
- package/dist/lib/components/library/library.models.d.ts.map +1 -1
- package/dist/lib/components/library/library.models.js.map +1 -1
- 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/message-input.component.d.ts +7 -0
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input.component.js +52 -20
- package/dist/lib/components/message/message-input.component.js.map +1 -1
- package/dist/lib/components/message/message-item.component.d.ts +17 -4
- package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-item.component.js +58 -8
- 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 +73 -3
- package/dist/lib/components/message/message-list.component.js.map +1 -1
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js +30 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js.map +1 -1
- 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/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 +2 -2
- 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 +2 -2
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.js +20 -11
- 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 +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts +7 -0
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.js +19 -0
- package/dist/lib/components/realtime/realtime-surface-tab-style.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js +13 -2
- 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 +3 -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 +9 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.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.map +1 -1
- package/dist/lib/components/task/tasks-full-view.component.js +9 -0
- package/dist/lib/components/task/tasks-full-view.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 -76
- package/dist/lib/conversations.module.d.ts.map +1 -1
- package/dist/lib/conversations.module.js +8 -0
- package/dist/lib/conversations.module.js.map +1 -1
- package/dist/lib/services/conversation-agent.service.d.ts +23 -18
- package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-agent.service.js +75 -32
- package/dist/lib/services/conversation-agent.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/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/public-api.d.ts +2 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +2 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +37 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-session-state.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-session-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAgB,MAAM,MAAM,CAAC;AACzD,OAAO,EACL,eAAe,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,wBAAwB,EAC7H,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAkB,MAAM,kCAAkC,CAAC;AAE5F;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;IACzC,kDAAkD;IAClD,mBAAmB,EAAE,UAAU,CAAC,0BAA0B,CAAC,CAAC;IAC5D,mCAAmC;IACnC,iBAAiB,EAAE,UAAU,CAAC,wBAAwB,CAAC,CAAC;IACxD,4CAA4C;IAC5C,oBAAoB,EAAE,UAAU,CAAC,2BAA2B,CAAC,CAAC;IAC9D,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,UAAU,CAAC,wBAAwB,CAAC,CAAC;CAC1D;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB;IACvC,sGAAsG;IACtG,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;IACvC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,+GAA+G;IAC/G,SAAS,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DA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E,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CASvE;AAED,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,oBAAoB;IAC/B,yFAAyF;IAClF,SAAS,
|
|
1
|
+
{"version":3,"file":"realtime-session-state.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-session-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAgB,MAAM,MAAM,CAAC;AACzD,OAAO,EACL,eAAe,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,wBAAwB,EAC7H,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAkB,MAAM,kCAAkC,CAAC;AAE5F;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;IACzC,kDAAkD;IAClD,mBAAmB,EAAE,UAAU,CAAC,0BAA0B,CAAC,CAAC;IAC5D,mCAAmC;IACnC,iBAAiB,EAAE,UAAU,CAAC,wBAAwB,CAAC,CAAC;IACxD,4CAA4C;IAC5C,oBAAoB,EAAE,UAAU,CAAC,2BAA2B,CAAC,CAAC;IAC9D,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,UAAU,CAAC,wBAAwB,CAAC,CAAC;CAC1D;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB;IACvC,sGAAsG;IACtG,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;IACvC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,+GAA+G;IAC/G,SAAS,EAAE,MAAM,CAAC;IAClB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,aAAa,EAAE,MAAM,CAA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;IAC/E,OAAO,CAAC,YAAY;IAIpB,iFAAiF;IACjF,OAAO,CAAC,eAAe;IAKvB,6EAA6E;IAC7E,OAAO,CAAC,WAAW;IAKnB,+CAA+C;IAC/C,OAAO,CAAC,KAAK;CAQd"}
|
|
@@ -46,7 +46,7 @@ export function FormatElapsed(ms) {
|
|
|
46
46
|
*/
|
|
47
47
|
export class RealtimeSessionState {
|
|
48
48
|
/** Display name used for new delegation cards (set by the overlay's AgentName input). */
|
|
49
|
-
AgentName = '
|
|
49
|
+
AgentName = 'Assistant';
|
|
50
50
|
/** The merged, chronological thread (captions + delegation cards), oldest first. */
|
|
51
51
|
Items = [];
|
|
52
52
|
/** All delegation cards of the session, NEWEST first — the activity rail's list. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-session-state.js","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-session-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAgB,MAAM,MAAM,CAAC;AAIzD,OAAO,EAA4B,cAAc,EAAE,MAAM,kCAAkC,CAAC;AA0G5F,yFAAyF;AACzF,kFAAkF;AAElF;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,OAAe;IAC7D,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,eAAe,CAAC,CAAC,OAAO,iBAAiB,CAAC;QAC/C,KAAK,kBAAkB,CAAC,CAAC,OAAO,qBAAqB,CAAC;QACtD,KAAK,kBAAkB,CAAC,CAAC,OAAO,iBAAiB,CAAC;QAClD,KAAK,oBAAoB,CAAC,CAAC,OAAO,4BAA4B,CAAC;QAC/D,KAAK,qBAAqB,CAAC,CAAC,OAAO,qBAAqB,CAAC;QACzD,OAAO,CAAC,CAAC,OAAO,OAAO,IAAI,SAAS,CAAC;IACvC,CAAC;AACH,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,aAAa,CAAC,EAAU;IACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG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,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;QACxE,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACtD,CAAC;IAED,6EAA6E;IACrE,WAAW,CAAC,MAAc;QAChC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QAClD,OAAO,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;IACnG,CAAC;IAED,+CAA+C;IACvC,KAAK;QACX,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import { Observable, Subject, Subscription } from 'rxjs';\nimport {\n RealtimeCaption, RealtimeDelegationProgress, RealtimeDelegationResult, RealtimeDelegationNarration, RealtimeThoughtNarration\n} from '@memberjunction/realtime-runtime';\nimport { ParsedDelegationArtifact, FormatToolName } from '@memberjunction/realtime-runtime';\n\n/**\n * The reactive session streams {@link RealtimeSessionState} merges — structurally\n * satisfied by `RealtimeSessionService`. Narrowed to an interface so the state (and its unit\n * tests) depend only on the streams, not on the full service / GraphQL import chain.\n */\nexport interface RealtimeSessionStreams {\n /** Growing user/assistant caption list. */\n Captions$: Observable<RealtimeCaption[]>;\n /** Progress updates from delegated agent runs. */\n DelegationProgress$: Observable<RealtimeDelegationProgress>;\n /** Terminal delegation results. */\n DelegationResult$: Observable<RealtimeDelegationResult>;\n /** Ephemeral spoken progress narrations. */\n DelegationNarration$: Observable<RealtimeDelegationNarration>;\n /** Model-authored thought / reasoning narrations. */\n ThoughtNarration$?: Observable<RealtimeThoughtNarration>;\n}\n\n/**\n * The view-model for one delegated tool/agent call in the live session. Built by\n * {@link RealtimeSessionState} from the `DelegationProgress$` / `DelegationResult$`\n * streams (correlated by `CallID`) and rendered both inline in the session thread\n * and as a compact card in the activity rail.\n *\n * Card objects are treated as IMMUTABLE — every progress/result event REPLACES the\n * card object (and the arrays containing it) so Angular bindings always see fresh\n * references and in-place updates reliably re-render.\n */\nexport interface RealtimeDelegationCardVM {\n /** What this card represents: a delegated agent run, a direct action, or model-authored narration. */\n Kind: 'agent' | 'action' | 'narration';\n /** The `invoke-target-agent` or direct-action call this card represents. */\n CallID: string;\n /** Display name of the delegated agent (e.g. \"Sage\") or formatted direct action title (e.g. \"Get Weather\"). */\n AgentName: string;\n /** The raw tool name when Kind === 'action' (e.g. \"File_Storage_List_Objects\"). */\n ToolName?: string;\n /** Latest human-readable progress message from the stream. */\n LatestMessage: string;\n /** The delegation phase (`prompt_execution` | `action_execution` | `direct_action` | …). */\n LatestStep: string;\n /** Optional completion percentage (0–100) when the server supplies it. */\n Percentage?: number;\n /** `true` once the delegation reached a terminal result. */\n Done: boolean;\n /** Whether the delegated work succeeded (meaningful once {@link Done} is true). */\n Success: boolean;\n /** Short run identifier (e.g. \"#a3f1\") if known; shown in expanded provenance detail. */\n RunRef?: string;\n /**\n * ID of the delegated agent run (`MJ: AI Agent Runs`) once the result reports it.\n * Powers the gear-gated \"Open run\" developer link on the card / rail entry.\n */\n RunID?: string;\n /** The real result text once the delegation completes. */\n Result?: string | null;\n /**\n * Artifacts the delegated run produced (set with the terminal result). Powers the\n * \"View\" affordance on done cards / rail entries and the surface panel's artifact tabs.\n */\n Artifacts?: ParsedDelegationArtifact[];\n /** Epoch ms when the first progress event for this call arrived. */\n StartedAt: number;\n /** Epoch ms when the terminal result arrived. */\n FinishedAt?: number;\n}\n\n/** A caption turn (user or assistant) in the unified thread. */\nexport interface RealtimeThreadCaptionItem {\n Kind: 'caption';\n Role: 'User' | 'Assistant';\n Text: string;\n}\n\n/** A delegation card in the unified thread (working → done chip). */\nexport interface RealtimeThreadDelegationItem {\n Kind: 'delegation';\n Card: RealtimeDelegationCardVM;\n}\n\n/**\n * A SESSION-BOUNDARY divider in the unified thread — a subtle, token-styled rule marking\n * where one session leg ends and another begins. Two producers:\n * - review→live continuation ({@link RealtimeSessionState.StartLiveContinuation}):\n * \"Resumed live session · <time>\" before the new live items;\n * - multi-leg session review (`BuildReviewThreadItems` over a `lastSessionId` chain):\n * \"Session leg · started <time>\" between legs, carrying the PREVIOUS leg's CloseReason\n * as a small chip so the reader sees why that leg ended.\n */\nexport interface RealtimeThreadDividerItem {\n Kind: 'divider';\n /** The divider's label (e.g. \"Resumed live session\", \"Session leg\"). */\n Label: string;\n /** Timestamp rendered after the label (\"· <time>\"), or null when unknown. */\n At: Date | null;\n /** Font Awesome icon class rendered before the label (e.g. `fa-solid fa-phone`). */\n Icon: string;\n /** Why the PRECEDING leg closed (review chains only) — rendered as a small chip. */\n CloseReason?: string | null;\n}\n\n/** One entry in the chronological thread: a caption bubble, a delegation card, or a leg divider. */\nexport type RealtimeThreadItem = RealtimeThreadCaptionItem | RealtimeThreadDelegationItem | RealtimeThreadDividerItem;\n\n// `FormatToolName` now lives in `@memberjunction/realtime-runtime`; import it from there\n// directly rather than through this module (MJ forbids cross-package re-exports).\n\n/**\n * Maps a raw delegation step id to a human-friendly phrase. Unknown steps fall back to\n * the raw progress message (per product direction) so the UI never shows snake_case ids.\n */\nexport function FriendlyStepLabel(step: string, message: string): string {\n switch (step) {\n case 'direct_action': return 'Looking that up';\n case 'prompt_execution': return 'Thinking it through';\n case 'action_execution': return 'Running actions';\n case 'subagent_execution': return 'Working with another agent';\n case 'decision_processing': return 'Deciding next steps';\n default: return message || 'Working';\n }\n}\n\n/** Formats an elapsed duration in ms as a compact human string (\"8s\", \"1m 04s\"). */\nexport function FormatElapsed(ms: number): string {\n const totalSec = Math.max(0, Math.round(ms / 1000));\n if (totalSec < 60) {\n return `${totalSec}s`;\n }\n const m = Math.floor(totalSec / 60);\n const s = totalSec % 60;\n return `${m}m ${s.toString().padStart(2, '0')}s`;\n}\n\n/**\n * SINGLE SOURCE of merged live-session state, owned by the overlay shell\n * (`RealtimeSessionOverlayComponent`) and passed via `@Input()` to BOTH the session\n * thread and the activity rail — so the per-CallID card bookkeeping and subscription\n * logic exists exactly once.\n *\n * Merges FOUR reactive streams from {@link RealtimeSessionService}:\n * - `Captions$` — growing user/assistant caption list → appended to {@link Items}.\n * - `DelegationProgress$` — first event per `CallID` inserts a working card at the thread\n * tail; later events REPLACE the card immutably (new object +\n * new arrays) so change detection always fires.\n * - `DelegationResult$` — flips the card to Done/Failed with the real result text.\n * - `DelegationNarration$` — the EPHEMERAL spoken progress note (latest only, never\n * accumulated), cleared when no delegation is running anymore.\n *\n * Consumers subscribe to {@link Changed$} and `markForCheck()`; all exposed collections\n * are replaced (never mutated) on change.\n */\nexport class RealtimeSessionState {\n /** Display name used for new delegation cards (set by the overlay's AgentName input). */\n public AgentName = 'Sage';\n\n /** The merged, chronological thread (captions + delegation cards), oldest first. */\n public Items: RealtimeThreadItem[] = [];\n\n /** All delegation cards of the session, NEWEST first — the activity rail's list. */\n public Cards: RealtimeDelegationCardVM[] = [];\n\n /** Latest ephemeral narration text, or null when none should be shown. */\n public Narration: string | null = null;\n\n /** CallID of the most recently started, still-running delegation (anchors the live note). */\n public ActiveCallId: string | null = null;\n\n /** Emits after every state change so views can mark themselves for check. */\n public readonly Changed$ = new Subject<void>();\n\n /** Number of captions already merged into {@link Items} (append-only bookkeeping). */\n private placedCaptionCount = 0;\n /** Live card lookup by CallID (insertion order = start order). */\n private cardsByCallId = new Map<string, RealtimeDelegationCardVM>();\n private subs: Subscription[] = [];\n\n /** True while at least one delegation is still running. */\n public get HasRunningDelegation(): boolean {\n return this.ActiveCallId !== null;\n }\n\n /** Subscribes to the session streams. Call once from the owning overlay shell. */\n public Attach(voice: RealtimeSessionStreams): void {\n if (this.subs.length > 0) {\n return; // already attached\n }\n this.subs.push(\n voice.Captions$.subscribe(c => this.onCaptions(c)),\n voice.DelegationProgress$.subscribe(p => this.onProgress(p)),\n voice.DelegationResult$.subscribe(r => this.onResult(r)),\n voice.DelegationNarration$.subscribe(n => this.onNarration(n))\n );\n if (voice.ThoughtNarration$) {\n this.subs.push(\n voice.ThoughtNarration$.subscribe(t => this.onThought(t))\n );\n }\n }\n\n /** Unsubscribes from all session streams. Call from the owning shell's ngOnDestroy. */\n public Detach(): void {\n for (const s of this.subs) {\n s.unsubscribe();\n }\n this.subs = [];\n }\n\n /**\n * SESSION REVIEW population path: replaces ALL merged state with a pre-built\n * HISTORICAL thread (caption turns + done delegation cards, oldest first — see\n * `BuildReviewThreadItems`). Resets the live-stream bookkeeping first, so a later\n * live session starts from a clean merge baseline; delegation cards are indexed by\n * CallID so the rail's {@link Cards} list and {@link ActiveCallId} derive normally.\n */\n public LoadHistoricalItems(items: RealtimeThreadItem[]): void {\n this.reset();\n this.Items = items.map(item => {\n if (item.Kind === 'delegation') {\n const card: RealtimeDelegationCardVM = item.Card.Kind\n ? item.Card\n : { ...item.Card, Kind: 'agent' };\n this.cardsByCallId.set(card.CallID, card);\n return { Kind: 'delegation', Card: card };\n }\n return item;\n });\n this.rebuildCards();\n this.recomputeActive();\n this.Changed$.next();\n }\n\n /** Clears all merged state and notifies subscribers (e.g. leaving session review). */\n public Clear(): void {\n this.reset();\n this.Changed$.next();\n }\n\n /**\n * REVIEW→LIVE continuation path: KEEPS the historical thread (and its delegation cards\n * in the rail) and appends a \"Resumed live session\" {@link RealtimeThreadDividerItem},\n * then resets only the LIVE-merge bookkeeping so the new session's captions and cards\n * append cleanly AFTER the divider:\n * - `placedCaptionCount` → 0 (the fresh session's caption stream starts empty, so the\n * start-of-session `[]` emission is a no-op rather than a reset);\n * - the ephemeral narration is dropped (nothing is running yet);\n * - historical cards stay indexed by CallID — new live CallIDs are unique, so live\n * cards insert alongside them and `ActiveCallId` recomputes normally.\n */\n public StartLiveContinuation(at: Date = new Date()): void {\n const divider: RealtimeThreadDividerItem = {\n Kind: 'divider',\n Label: 'Resumed live session',\n At: at,\n Icon: 'fa-solid fa-phone'\n };\n this.Items = [...this.Items, divider];\n this.Narration = null;\n this.placedCaptionCount = 0;\n this.recomputeActive();\n this.Changed$.next();\n }\n\n /** Appends any newly-arrived captions, keeping order relative to delegation cards, and updates streaming captions in place. */\n private onCaptions(captions: RealtimeCaption[]): void {\n if (captions.length < this.placedCaptionCount) {\n // Captions are cleared on a fresh session — reset all merge state.\n this.reset();\n this.Changed$.next();\n return;\n }\n\n // Find the indices in this.Items of the captions already placed in the current session.\n // They are the last `placedCaptionCount` caption items in this.Items.\n const liveCaptionIndices: number[] = [];\n for (let idx = this.Items.length - 1; idx >= 0 && liveCaptionIndices.length < this.placedCaptionCount; idx--) {\n if (this.Items[idx].Kind === 'caption') {\n liveCaptionIndices.unshift(idx);\n }\n }\n\n let nextItems = this.Items;\n let hasChanges = false;\n\n // 1. Update any already-placed captions in place if their text or role changed (e.g. streaming deltas or corrections)\n const updateCount = Math.min(this.placedCaptionCount, liveCaptionIndices.length);\n for (let i = 0; i < updateCount; i++) {\n const itemIdx = liveCaptionIndices[i];\n const current = nextItems[itemIdx] as RealtimeThreadCaptionItem;\n const incoming = captions[i];\n if (current.Role !== incoming.Role || current.Text !== incoming.Text) {\n if (nextItems === this.Items) {\n nextItems = [...this.Items];\n }\n nextItems[itemIdx] = { Kind: 'caption', Role: incoming.Role, Text: incoming.Text };\n hasChanges = true;\n }\n }\n\n // 2. Append newly-arrived captions\n if (captions.length > this.placedCaptionCount) {\n const appended: RealtimeThreadItem[] = [];\n for (let i = this.placedCaptionCount; i < captions.length; i++) {\n appended.push({ Kind: 'caption', Role: captions[i].Role, Text: captions[i].Text });\n }\n if (nextItems === this.Items) {\n nextItems = [...this.Items];\n }\n nextItems = [...nextItems, ...appended];\n this.placedCaptionCount = captions.length;\n hasChanges = true;\n }\n\n if (hasChanges) {\n this.Items = nextItems;\n this.Changed$.next();\n }\n }\n\n /** Inserts a new working card, or immutably replaces the existing one for this CallID. */\n private onProgress(progress: RealtimeDelegationProgress): void {\n const existing = this.cardsByCallId.get(progress.CallID);\n if (existing) {\n this.replaceCard({\n ...existing,\n ToolName: progress.ToolName ?? existing.ToolName,\n LatestStep: progress.Step,\n LatestMessage: progress.Message,\n Percentage: progress.Percentage\n });\n } else {\n this.insertCard(progress);\n }\n this.Changed$.next();\n }\n\n /** Creates a working card for a first-seen CallID and appends it to the thread tail. */\n private insertCard(progress: RealtimeDelegationProgress): void {\n const isAction = !!progress.ToolName && progress.ToolName !== 'invoke-target-agent';\n const card: RealtimeDelegationCardVM = {\n CallID: progress.CallID,\n Kind: isAction ? 'action' : 'agent',\n ToolName: progress.ToolName,\n AgentName: isAction ? FormatToolName(progress.ToolName!) : this.AgentName,\n LatestStep: progress.Step,\n LatestMessage: progress.Message,\n Percentage: progress.Percentage,\n Done: false,\n Success: false,\n RunRef: this.shortRunRef(progress.CallID),\n StartedAt: Date.now()\n };\n this.cardsByCallId.set(progress.CallID, card);\n this.Items = [...this.Items, { Kind: 'delegation', Card: card }];\n this.rebuildCards();\n this.recomputeActive();\n }\n\n /** Flips the card for a finished delegation to Done/Failed with its real result. */\n private onResult(result: RealtimeDelegationResult): void {\n const existing = this.cardsByCallId.get(result.CallID);\n if (!existing) {\n if (!result.ToolName) {\n return; // untracked result without tool name — ignore\n }\n // Create-or-update safety net: if a terminal result arrives without prior progress\n // (e.g. fast direct action or missed stream packet), construct and insert the done card\n // rather than dropping the result.\n const isAction = result.ToolName !== 'invoke-target-agent';\n const toolName = result.ToolName;\n const card: RealtimeDelegationCardVM = {\n CallID: result.CallID,\n Kind: isAction ? 'action' : 'agent',\n ToolName: toolName,\n AgentName: isAction ? FormatToolName(toolName) : this.AgentName,\n LatestStep: isAction ? 'direct_action' : 'decision_processing',\n LatestMessage: isAction ? `Executed ${FormatToolName(toolName)}` : 'Completed',\n Done: true,\n Success: result.Success,\n Result: result.Output,\n RunRef: this.shortRunRef(result.CallID),\n RunID: result.RunID,\n Artifacts: isAction ? undefined : result.Artifacts,\n StartedAt: Date.now(),\n FinishedAt: Date.now()\n };\n this.cardsByCallId.set(result.CallID, card);\n this.Items = [...this.Items, { Kind: 'delegation', Card: card }];\n this.rebuildCards();\n this.recomputeActive();\n if (!this.HasRunningDelegation) {\n this.Narration = null;\n }\n this.Changed$.next();\n return;\n }\n this.replaceCard({\n ...existing,\n ToolName: result.ToolName ?? existing.ToolName,\n Done: true,\n Success: result.Success,\n Result: result.Output,\n RunID: result.RunID ?? existing.RunID,\n Artifacts: existing.Kind === 'action' ? undefined : (result.Artifacts ?? existing.Artifacts),\n FinishedAt: Date.now()\n });\n if (!this.HasRunningDelegation) {\n // All delegations finished — the live narration note fades away.\n this.Narration = null;\n }\n this.Changed$.next();\n }\n\n /** Latest narration REPLACES the previous one (never accumulated). */\n private onNarration(narration: RealtimeDelegationNarration): void {\n this.Narration = narration.Text;\n this.Changed$.next();\n }\n\n /**\n * Creates or updates a narration delegation card representing model-authored thought / reasoning.\n * Cards are immutable; narration cards are excluded from anchoring the live narration note (Reviewer Items 21 & 22).\n */\n private onThought(thought: RealtimeThoughtNarration): void {\n const callId = thought.CallID ?? 'model-thought';\n const isDone = thought.IsFinal ?? true;\n const existing = this.cardsByCallId.get(callId);\n if (existing) {\n this.replaceCard({\n ...existing,\n LatestMessage: thought.Text,\n Done: isDone,\n Success: true,\n Result: isDone ? thought.Text : existing.Result,\n FinishedAt: isDone ? Date.now() : existing.FinishedAt,\n });\n } else {\n const card: RealtimeDelegationCardVM = {\n CallID: callId,\n Kind: 'narration',\n AgentName: this.AgentName,\n LatestStep: 'reasoning',\n LatestMessage: thought.Text,\n Done: isDone,\n Success: true,\n Result: isDone ? thought.Text : null,\n RunRef: this.shortRunRef(callId),\n StartedAt: Date.now(),\n FinishedAt: isDone ? Date.now() : undefined,\n };\n this.cardsByCallId.set(callId, card);\n this.Items = [...this.Items, { Kind: 'delegation', Card: card }];\n this.rebuildCards();\n this.recomputeActive();\n }\n this.Changed$.next();\n }\n\n /**\n * Immutable replacement of a card: new card object, new thread-item wrapper, new\n * Items array, rebuilt Cards array — so every binding sees a fresh reference.\n */\n private replaceCard(card: RealtimeDelegationCardVM): void {\n this.cardsByCallId.set(card.CallID, card);\n const idx = this.Items.findIndex(i => i.Kind === 'delegation' && i.Card.CallID === card.CallID);\n if (idx >= 0) {\n const next = [...this.Items];\n next[idx] = { Kind: 'delegation', Card: card };\n this.Items = next;\n }\n this.rebuildCards();\n this.recomputeActive();\n }\n\n /** Rebuilds the rail's newest-first card list from the (start-ordered) map. */\n private rebuildCards(): void {\n this.Cards = Array.from(this.cardsByCallId.values()).reverse();\n }\n\n /** Recomputes which still-running delegation anchors the live narration note. */\n private recomputeActive(): void {\n const running = this.Cards.find(c => !c.Done && c.Kind !== 'narration');\n this.ActiveCallId = running ? running.CallID : null;\n }\n\n /** Derives a short, stable run reference (e.g. \"#a3f1\") from the call id. */\n private shortRunRef(callId: string): string {\n const compact = callId.replace(/[^a-z0-9]/gi, '');\n return compact.length >= 4 ? `#${compact.slice(-4).toLowerCase()}` : `#${compact.toLowerCase()}`;\n }\n\n /** Clears all merged state (fresh session). */\n private reset(): void {\n this.Items = [];\n this.Cards = [];\n this.Narration = null;\n this.ActiveCallId = null;\n this.placedCaptionCount = 0;\n this.cardsByCallId.clear();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"realtime-session-state.js","sourceRoot":"","sources":["../../../../src/lib/components/realtime/realtime-session-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAgB,MAAM,MAAM,CAAC;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E,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import { Observable, Subject, Subscription } from 'rxjs';\nimport {\n RealtimeCaption, RealtimeDelegationProgress, RealtimeDelegationResult, RealtimeDelegationNarration, RealtimeThoughtNarration\n} from '@memberjunction/realtime-runtime';\nimport { ParsedDelegationArtifact, FormatToolName } from '@memberjunction/realtime-runtime';\n\n/**\n * The reactive session streams {@link RealtimeSessionState} merges — structurally\n * satisfied by `RealtimeSessionService`. Narrowed to an interface so the state (and its unit\n * tests) depend only on the streams, not on the full service / GraphQL import chain.\n */\nexport interface RealtimeSessionStreams {\n /** Growing user/assistant caption list. */\n Captions$: Observable<RealtimeCaption[]>;\n /** Progress updates from delegated agent runs. */\n DelegationProgress$: Observable<RealtimeDelegationProgress>;\n /** Terminal delegation results. */\n DelegationResult$: Observable<RealtimeDelegationResult>;\n /** Ephemeral spoken progress narrations. */\n DelegationNarration$: Observable<RealtimeDelegationNarration>;\n /** Model-authored thought / reasoning narrations. */\n ThoughtNarration$?: Observable<RealtimeThoughtNarration>;\n}\n\n/**\n * The view-model for one delegated tool/agent call in the live session. Built by\n * {@link RealtimeSessionState} from the `DelegationProgress$` / `DelegationResult$`\n * streams (correlated by `CallID`) and rendered both inline in the session thread\n * and as a compact card in the activity rail.\n *\n * Card objects are treated as IMMUTABLE — every progress/result event REPLACES the\n * card object (and the arrays containing it) so Angular bindings always see fresh\n * references and in-place updates reliably re-render.\n */\nexport interface RealtimeDelegationCardVM {\n /** What this card represents: a delegated agent run, a direct action, or model-authored narration. */\n Kind: 'agent' | 'action' | 'narration';\n /** The `invoke-target-agent` or direct-action call this card represents. */\n CallID: string;\n /** Display name of the delegated agent (e.g. \"Sage\") or formatted direct action title (e.g. \"Get Weather\"). */\n AgentName: string;\n /** The raw tool name when Kind === 'action' (e.g. \"File_Storage_List_Objects\"). */\n ToolName?: string;\n /** Latest human-readable progress message from the stream. */\n LatestMessage: string;\n /** The delegation phase (`prompt_execution` | `action_execution` | `direct_action` | …). */\n LatestStep: string;\n /** Optional completion percentage (0–100) when the server supplies it. */\n Percentage?: number;\n /** `true` once the delegation reached a terminal result. */\n Done: boolean;\n /** Whether the delegated work succeeded (meaningful once {@link Done} is true). */\n Success: boolean;\n /** Short run identifier (e.g. \"#a3f1\") if known; shown in expanded provenance detail. */\n RunRef?: string;\n /**\n * ID of the delegated agent run (`MJ: AI Agent Runs`) once the result reports it.\n * Powers the gear-gated \"Open run\" developer link on the card / rail entry.\n */\n RunID?: string;\n /** The real result text once the delegation completes. */\n Result?: string | null;\n /**\n * Artifacts the delegated run produced (set with the terminal result). Powers the\n * \"View\" affordance on done cards / rail entries and the surface panel's artifact tabs.\n */\n Artifacts?: ParsedDelegationArtifact[];\n /** Epoch ms when the first progress event for this call arrived. */\n StartedAt: number;\n /** Epoch ms when the terminal result arrived. */\n FinishedAt?: number;\n}\n\n/** A caption turn (user or assistant) in the unified thread. */\nexport interface RealtimeThreadCaptionItem {\n Kind: 'caption';\n Role: 'User' | 'Assistant';\n Text: string;\n}\n\n/** A delegation card in the unified thread (working → done chip). */\nexport interface RealtimeThreadDelegationItem {\n Kind: 'delegation';\n Card: RealtimeDelegationCardVM;\n}\n\n/**\n * A SESSION-BOUNDARY divider in the unified thread — a subtle, token-styled rule marking\n * where one session leg ends and another begins. Two producers:\n * - review→live continuation ({@link RealtimeSessionState.StartLiveContinuation}):\n * \"Resumed live session · <time>\" before the new live items;\n * - multi-leg session review (`BuildReviewThreadItems` over a `lastSessionId` chain):\n * \"Session leg · started <time>\" between legs, carrying the PREVIOUS leg's CloseReason\n * as a small chip so the reader sees why that leg ended.\n */\nexport interface RealtimeThreadDividerItem {\n Kind: 'divider';\n /** The divider's label (e.g. \"Resumed live session\", \"Session leg\"). */\n Label: string;\n /** Timestamp rendered after the label (\"· <time>\"), or null when unknown. */\n At: Date | null;\n /** Font Awesome icon class rendered before the label (e.g. `fa-solid fa-phone`). */\n Icon: string;\n /** Why the PRECEDING leg closed (review chains only) — rendered as a small chip. */\n CloseReason?: string | null;\n}\n\n/** One entry in the chronological thread: a caption bubble, a delegation card, or a leg divider. */\nexport type RealtimeThreadItem = RealtimeThreadCaptionItem | RealtimeThreadDelegationItem | RealtimeThreadDividerItem;\n\n// `FormatToolName` now lives in `@memberjunction/realtime-runtime`; import it from there\n// directly rather than through this module (MJ forbids cross-package re-exports).\n\n/**\n * Maps a raw delegation step id to a human-friendly phrase. Unknown steps fall back to\n * the raw progress message (per product direction) so the UI never shows snake_case ids.\n */\nexport function FriendlyStepLabel(step: string, message: string): string {\n switch (step) {\n case 'direct_action': return 'Looking that up';\n case 'prompt_execution': return 'Thinking it through';\n case 'action_execution': return 'Running actions';\n case 'subagent_execution': return 'Working with another agent';\n case 'decision_processing': return 'Deciding next steps';\n default: return message || 'Working';\n }\n}\n\n/** Formats an elapsed duration in ms as a compact human string (\"8s\", \"1m 04s\"). */\nexport function FormatElapsed(ms: number): string {\n const totalSec = Math.max(0, Math.round(ms / 1000));\n if (totalSec < 60) {\n return `${totalSec}s`;\n }\n const m = Math.floor(totalSec / 60);\n const s = totalSec % 60;\n return `${m}m ${s.toString().padStart(2, '0')}s`;\n}\n\n/**\n * SINGLE SOURCE of merged live-session state, owned by the overlay shell\n * (`RealtimeSessionOverlayComponent`) and passed via `@Input()` to BOTH the session\n * thread and the activity rail — so the per-CallID card bookkeeping and subscription\n * logic exists exactly once.\n *\n * Merges FOUR reactive streams from {@link RealtimeSessionService}:\n * - `Captions$` — growing user/assistant caption list → appended to {@link Items}.\n * - `DelegationProgress$` — first event per `CallID` inserts a working card at the thread\n * tail; later events REPLACE the card immutably (new object +\n * new arrays) so change detection always fires.\n * - `DelegationResult$` — flips the card to Done/Failed with the real result text.\n * - `DelegationNarration$` — the EPHEMERAL spoken progress note (latest only, never\n * accumulated), cleared when no delegation is running anymore.\n *\n * Consumers subscribe to {@link Changed$} and `markForCheck()`; all exposed collections\n * are replaced (never mutated) on change.\n */\nexport class RealtimeSessionState {\n /** Display name used for new delegation cards (set by the overlay's AgentName input). */\n public AgentName = 'Assistant';\n\n /** The merged, chronological thread (captions + delegation cards), oldest first. */\n public Items: RealtimeThreadItem[] = [];\n\n /** All delegation cards of the session, NEWEST first — the activity rail's list. */\n public Cards: RealtimeDelegationCardVM[] = [];\n\n /** Latest ephemeral narration text, or null when none should be shown. */\n public Narration: string | null = null;\n\n /** CallID of the most recently started, still-running delegation (anchors the live note). */\n public ActiveCallId: string | null = null;\n\n /** Emits after every state change so views can mark themselves for check. */\n public readonly Changed$ = new Subject<void>();\n\n /** Number of captions already merged into {@link Items} (append-only bookkeeping). */\n private placedCaptionCount = 0;\n /** Live card lookup by CallID (insertion order = start order). */\n private cardsByCallId = new Map<string, RealtimeDelegationCardVM>();\n private subs: Subscription[] = [];\n\n /** True while at least one delegation is still running. */\n public get HasRunningDelegation(): boolean {\n return this.ActiveCallId !== null;\n }\n\n /** Subscribes to the session streams. Call once from the owning overlay shell. */\n public Attach(voice: RealtimeSessionStreams): void {\n if (this.subs.length > 0) {\n return; // already attached\n }\n this.subs.push(\n voice.Captions$.subscribe(c => this.onCaptions(c)),\n voice.DelegationProgress$.subscribe(p => this.onProgress(p)),\n voice.DelegationResult$.subscribe(r => this.onResult(r)),\n voice.DelegationNarration$.subscribe(n => this.onNarration(n))\n );\n if (voice.ThoughtNarration$) {\n this.subs.push(\n voice.ThoughtNarration$.subscribe(t => this.onThought(t))\n );\n }\n }\n\n /** Unsubscribes from all session streams. Call from the owning shell's ngOnDestroy. */\n public Detach(): void {\n for (const s of this.subs) {\n s.unsubscribe();\n }\n this.subs = [];\n }\n\n /**\n * SESSION REVIEW population path: replaces ALL merged state with a pre-built\n * HISTORICAL thread (caption turns + done delegation cards, oldest first — see\n * `BuildReviewThreadItems`). Resets the live-stream bookkeeping first, so a later\n * live session starts from a clean merge baseline; delegation cards are indexed by\n * CallID so the rail's {@link Cards} list and {@link ActiveCallId} derive normally.\n */\n public LoadHistoricalItems(items: RealtimeThreadItem[]): void {\n this.reset();\n this.Items = items.map(item => {\n if (item.Kind === 'delegation') {\n const card: RealtimeDelegationCardVM = item.Card.Kind\n ? item.Card\n : { ...item.Card, Kind: 'agent' };\n this.cardsByCallId.set(card.CallID, card);\n return { Kind: 'delegation', Card: card };\n }\n return item;\n });\n this.rebuildCards();\n this.recomputeActive();\n this.Changed$.next();\n }\n\n /** Clears all merged state and notifies subscribers (e.g. leaving session review). */\n public Clear(): void {\n this.reset();\n this.Changed$.next();\n }\n\n /**\n * REVIEW→LIVE continuation path: KEEPS the historical thread (and its delegation cards\n * in the rail) and appends a \"Resumed live session\" {@link RealtimeThreadDividerItem},\n * then resets only the LIVE-merge bookkeeping so the new session's captions and cards\n * append cleanly AFTER the divider:\n * - `placedCaptionCount` → 0 (the fresh session's caption stream starts empty, so the\n * start-of-session `[]` emission is a no-op rather than a reset);\n * - the ephemeral narration is dropped (nothing is running yet);\n * - historical cards stay indexed by CallID — new live CallIDs are unique, so live\n * cards insert alongside them and `ActiveCallId` recomputes normally.\n */\n public StartLiveContinuation(at: Date = new Date()): void {\n const divider: RealtimeThreadDividerItem = {\n Kind: 'divider',\n Label: 'Resumed live session',\n At: at,\n Icon: 'fa-solid fa-phone'\n };\n this.Items = [...this.Items, divider];\n this.Narration = null;\n this.placedCaptionCount = 0;\n this.recomputeActive();\n this.Changed$.next();\n }\n\n /** Appends any newly-arrived captions, keeping order relative to delegation cards, and updates streaming captions in place. */\n private onCaptions(captions: RealtimeCaption[]): void {\n if (captions.length < this.placedCaptionCount) {\n // Captions are cleared on a fresh session — reset all merge state.\n this.reset();\n this.Changed$.next();\n return;\n }\n\n // Find the indices in this.Items of the captions already placed in the current session.\n // They are the last `placedCaptionCount` caption items in this.Items.\n const liveCaptionIndices: number[] = [];\n for (let idx = this.Items.length - 1; idx >= 0 && liveCaptionIndices.length < this.placedCaptionCount; idx--) {\n if (this.Items[idx].Kind === 'caption') {\n liveCaptionIndices.unshift(idx);\n }\n }\n\n let nextItems = this.Items;\n let hasChanges = false;\n\n // 1. Update any already-placed captions in place if their text or role changed (e.g. streaming deltas or corrections)\n const updateCount = Math.min(this.placedCaptionCount, liveCaptionIndices.length);\n for (let i = 0; i < updateCount; i++) {\n const itemIdx = liveCaptionIndices[i];\n const current = nextItems[itemIdx] as RealtimeThreadCaptionItem;\n const incoming = captions[i];\n if (current.Role !== incoming.Role || current.Text !== incoming.Text) {\n if (nextItems === this.Items) {\n nextItems = [...this.Items];\n }\n nextItems[itemIdx] = { Kind: 'caption', Role: incoming.Role, Text: incoming.Text };\n hasChanges = true;\n }\n }\n\n // 2. Append newly-arrived captions\n if (captions.length > this.placedCaptionCount) {\n const appended: RealtimeThreadItem[] = [];\n for (let i = this.placedCaptionCount; i < captions.length; i++) {\n appended.push({ Kind: 'caption', Role: captions[i].Role, Text: captions[i].Text });\n }\n if (nextItems === this.Items) {\n nextItems = [...this.Items];\n }\n nextItems = [...nextItems, ...appended];\n this.placedCaptionCount = captions.length;\n hasChanges = true;\n }\n\n if (hasChanges) {\n this.Items = nextItems;\n this.Changed$.next();\n }\n }\n\n /** Inserts a new working card, or immutably replaces the existing one for this CallID. */\n private onProgress(progress: RealtimeDelegationProgress): void {\n const existing = this.cardsByCallId.get(progress.CallID);\n if (existing) {\n this.replaceCard({\n ...existing,\n ToolName: progress.ToolName ?? existing.ToolName,\n LatestStep: progress.Step,\n LatestMessage: progress.Message,\n Percentage: progress.Percentage\n });\n } else {\n this.insertCard(progress);\n }\n this.Changed$.next();\n }\n\n /** Creates a working card for a first-seen CallID and appends it to the thread tail. */\n private insertCard(progress: RealtimeDelegationProgress): void {\n const isAction = !!progress.ToolName && progress.ToolName !== 'invoke-target-agent';\n const card: RealtimeDelegationCardVM = {\n CallID: progress.CallID,\n Kind: isAction ? 'action' : 'agent',\n ToolName: progress.ToolName,\n AgentName: isAction ? FormatToolName(progress.ToolName!) : this.AgentName,\n LatestStep: progress.Step,\n LatestMessage: progress.Message,\n Percentage: progress.Percentage,\n Done: false,\n Success: false,\n RunRef: this.shortRunRef(progress.CallID),\n StartedAt: Date.now()\n };\n this.cardsByCallId.set(progress.CallID, card);\n this.Items = [...this.Items, { Kind: 'delegation', Card: card }];\n this.rebuildCards();\n this.recomputeActive();\n }\n\n /** Flips the card for a finished delegation to Done/Failed with its real result. */\n private onResult(result: RealtimeDelegationResult): void {\n const existing = this.cardsByCallId.get(result.CallID);\n if (!existing) {\n if (!result.ToolName) {\n return; // untracked result without tool name — ignore\n }\n // Create-or-update safety net: if a terminal result arrives without prior progress\n // (e.g. fast direct action or missed stream packet), construct and insert the done card\n // rather than dropping the result.\n const isAction = result.ToolName !== 'invoke-target-agent';\n const toolName = result.ToolName;\n const card: RealtimeDelegationCardVM = {\n CallID: result.CallID,\n Kind: isAction ? 'action' : 'agent',\n ToolName: toolName,\n AgentName: isAction ? FormatToolName(toolName) : this.AgentName,\n LatestStep: isAction ? 'direct_action' : 'decision_processing',\n LatestMessage: isAction ? `Executed ${FormatToolName(toolName)}` : 'Completed',\n Done: true,\n Success: result.Success,\n Result: result.Output,\n RunRef: this.shortRunRef(result.CallID),\n RunID: result.RunID,\n Artifacts: isAction ? undefined : result.Artifacts,\n StartedAt: Date.now(),\n FinishedAt: Date.now()\n };\n this.cardsByCallId.set(result.CallID, card);\n this.Items = [...this.Items, { Kind: 'delegation', Card: card }];\n this.rebuildCards();\n this.recomputeActive();\n if (!this.HasRunningDelegation) {\n this.Narration = null;\n }\n this.Changed$.next();\n return;\n }\n this.replaceCard({\n ...existing,\n ToolName: result.ToolName ?? existing.ToolName,\n Done: true,\n Success: result.Success,\n Result: result.Output,\n RunID: result.RunID ?? existing.RunID,\n Artifacts: existing.Kind === 'action' ? undefined : (result.Artifacts ?? existing.Artifacts),\n FinishedAt: Date.now()\n });\n if (!this.HasRunningDelegation) {\n // All delegations finished — the live narration note fades away.\n this.Narration = null;\n }\n this.Changed$.next();\n }\n\n /** Latest narration REPLACES the previous one (never accumulated). */\n private onNarration(narration: RealtimeDelegationNarration): void {\n this.Narration = narration.Text;\n this.Changed$.next();\n }\n\n /**\n * Creates or updates a narration delegation card representing model-authored thought / reasoning.\n * Cards are immutable; narration cards are excluded from anchoring the live narration note (Reviewer Items 21 & 22).\n */\n private onThought(thought: RealtimeThoughtNarration): void {\n const callId = thought.CallID ?? 'model-thought';\n const isDone = thought.IsFinal ?? true;\n const existing = this.cardsByCallId.get(callId);\n if (existing) {\n this.replaceCard({\n ...existing,\n LatestMessage: thought.Text,\n Done: isDone,\n Success: true,\n Result: isDone ? thought.Text : existing.Result,\n FinishedAt: isDone ? Date.now() : existing.FinishedAt,\n });\n } else {\n const card: RealtimeDelegationCardVM = {\n CallID: callId,\n Kind: 'narration',\n AgentName: this.AgentName,\n LatestStep: 'reasoning',\n LatestMessage: thought.Text,\n Done: isDone,\n Success: true,\n Result: isDone ? thought.Text : null,\n RunRef: this.shortRunRef(callId),\n StartedAt: Date.now(),\n FinishedAt: isDone ? Date.now() : undefined,\n };\n this.cardsByCallId.set(callId, card);\n this.Items = [...this.Items, { Kind: 'delegation', Card: card }];\n this.rebuildCards();\n this.recomputeActive();\n }\n this.Changed$.next();\n }\n\n /**\n * Immutable replacement of a card: new card object, new thread-item wrapper, new\n * Items array, rebuilt Cards array — so every binding sees a fresh reference.\n */\n private replaceCard(card: RealtimeDelegationCardVM): void {\n this.cardsByCallId.set(card.CallID, card);\n const idx = this.Items.findIndex(i => i.Kind === 'delegation' && i.Card.CallID === card.CallID);\n if (idx >= 0) {\n const next = [...this.Items];\n next[idx] = { Kind: 'delegation', Card: card };\n this.Items = next;\n }\n this.rebuildCards();\n this.recomputeActive();\n }\n\n /** Rebuilds the rail's newest-first card list from the (start-ordered) map. */\n private rebuildCards(): void {\n this.Cards = Array.from(this.cardsByCallId.values()).reverse();\n }\n\n /** Recomputes which still-running delegation anchors the live narration note. */\n private recomputeActive(): void {\n const running = this.Cards.find(c => !c.Done && c.Kind !== 'narration');\n this.ActiveCallId = running ? running.CallID : null;\n }\n\n /** Derives a short, stable run reference (e.g. \"#a3f1\") from the call id. */\n private shortRunRef(callId: string): string {\n const compact = callId.replace(/[^a-z0-9]/gi, '');\n return compact.length >= 4 ? `#${compact.slice(-4).toLowerCase()}` : `#${compact.toLowerCase()}`;\n }\n\n /** Clears all merged state (fresh session). */\n private reset(): void {\n this.Items = [];\n this.Cards = [];\n this.Narration = null;\n this.ActiveCallId = null;\n this.placedCaptionCount = 0;\n this.cardsByCallId.clear();\n }\n}\n"]}
|
|
@@ -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;;AAkG5E;;;;;;;;;;GAUG;AACH,qBAOa,8BAA+B,YAAW,MAAM,EAAE,gBAAgB,EAAE,SAAS;IAC7D,OAAO,CAAC,YAAY,CAAC,CAA0B;IAE1E,8DAA8D;IACrD,SAAS,
|
|
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,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MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM;IAgBlE,gFAAgF;IAChF,OAAO,CAAC,cAAc;yCAhIX,8BAA8B;2CAA9B,8BAA8B;CAuI1C"}
|
|
@@ -255,7 +255,7 @@ function bulletTail(text, at) {
|
|
|
255
255
|
export class RealtimeSessionThreadComponent {
|
|
256
256
|
scrollAnchor;
|
|
257
257
|
/** Display name of the agent (caption avatar / meta line). */
|
|
258
|
-
AgentName = '
|
|
258
|
+
AgentName = 'Assistant';
|
|
259
259
|
/**
|
|
260
260
|
* Display name of the signed-in user for their turns — consistent with the main
|
|
261
261
|
* chat's sender names, and ready for multi-user sessions where "You" stops meaning
|
|
@@ -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"],"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;;;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, 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
|
+
{"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;IA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AAY,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 = 'Assistant';\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"]}
|
|
@@ -67,4 +67,11 @@ export declare function ClampActivitySplitPercent(percent: number): number;
|
|
|
67
67
|
export declare function ParseActivitySplitPercent(raw: string | null | undefined): number | null;
|
|
68
68
|
/** Serializes the right-pane width percentage for persistence (`{ "percent": number }`). */
|
|
69
69
|
export declare function SerializeActivitySplitPercent(percent: number): string;
|
|
70
|
+
/**
|
|
71
|
+
* Deterministic display rank for left-cluster surface channel tabs so the strip keeps a
|
|
72
|
+
* consistent order (`Workspace`, `Whiteboard`, `Browser`, `Media`, then custom/other channels,
|
|
73
|
+
* then `Recording`) across live calls, session review, and multi-leg resume — regardless of
|
|
74
|
+
* which channel restores or mounts first.
|
|
75
|
+
*/
|
|
76
|
+
export declare function ChannelTabSortOrder(channelKey: string | null | undefined): number;
|
|
70
77
|
//# sourceMappingURL=realtime-surface-tab-style.d.ts.map
|
|
@@ -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,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"}
|
|
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;AAUD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAKjF"}
|
|
@@ -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,CA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EAAwE;AACxE,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE7C;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAe;IACvD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,OAAO,8BAA8B,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,0BAA0B,CAAC,EAAE,0BAA0B,CAAC,CAAC;AAC7F,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAA8B;IACtE,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxC,IAAI,MAAM,KAAK,IAAI,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","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"]}
|
|
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,EAA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,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"]}
|
|
@@ -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,E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;;OAMG;IACI,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAW9C;;;;;;;;;OASG;IACI,kBAAkB,CAAC,YAAY,EAAE,8BAA8B,GAAG,kBAAkB;
|
|
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;IACt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BAA4B,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"}
|
|
@@ -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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-surface-tabs.model.js","sourceR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CAAC;IACD,MAAM,MAAM,GAAG,UAAU,CAAC,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"]}
|
|
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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AiB,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,UAAU,CAAC,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, 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';
|
|
@@ -259,6 +259,8 @@ export declare class RemoteBrowserChannel extends BaseRealtimeChannelClient<Remo
|
|
|
259
259
|
* carries the URL, and until now only the surface read it.
|
|
260
260
|
*/
|
|
261
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;
|
|
262
264
|
/** Serializes the visited page history and latest bounded screenshot for review / resume. */
|
|
263
265
|
SerializeState(): string | null;
|
|
264
266
|
/** Restores saved URL history and screenshot metadata from a prior session leg. */
|
|
@@ -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,oCAAoC,CAAC;AAU5C,OAAO,EAAwB,4BAA4B,EAA4B,MAAM,+BAA+B,CAAC;A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