@memberjunction/ng-conversations 6.3.0-edge.0 → 6.3.0-edge.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -22
- package/dist/assets/edge-ai.worker.js +32515 -0
- package/dist/lib/components/artifact/artifact-share-modal.component.d.ts +39 -6
- package/dist/lib/components/artifact/artifact-share-modal.component.d.ts.map +1 -1
- package/dist/lib/components/artifact/artifact-share-modal.component.js +620 -74
- package/dist/lib/components/artifact/artifact-share-modal.component.js.map +1 -1
- package/dist/lib/components/collection/collection-tree.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-tree.component.js +19 -18
- package/dist/lib/components/collection/collection-tree.component.js.map +1 -1
- package/dist/lib/components/collection/collection-view.component.d.ts +6 -4
- package/dist/lib/components/collection/collection-view.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-view.component.js +35 -17
- package/dist/lib/components/collection/collection-view.component.js.map +1 -1
- package/dist/lib/components/collection/collections-full-view.component.d.ts +1 -0
- package/dist/lib/components/collection/collections-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collections-full-view.component.js +108 -106
- package/dist/lib/components/collection/collections-full-view.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +36 -10
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +101 -37
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts +14 -0
- package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.js +93 -42
- package/dist/lib/components/conversation/conversation-list.component.js.map +1 -1
- package/dist/lib/components/export/export-modal.component.d.ts +7 -2
- package/dist/lib/components/export/export-modal.component.d.ts.map +1 -1
- package/dist/lib/components/export/export-modal.component.js +13 -2
- package/dist/lib/components/export/export-modal.component.js.map +1 -1
- package/dist/lib/components/library/library-create-dialog.component.d.ts +136 -0
- package/dist/lib/components/library/library-create-dialog.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-create-dialog.component.js +1620 -0
- package/dist/lib/components/library/library-create-dialog.component.js.map +1 -0
- package/dist/lib/components/library/library-full-view.component.d.ts +10 -4
- package/dist/lib/components/library/library-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/library/library-full-view.component.js +216 -40
- package/dist/lib/components/library/library-full-view.component.js.map +1 -1
- package/dist/lib/components/library/library-remote-drive-pane.component.d.ts +97 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.js +1229 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.js.map +1 -0
- package/dist/lib/components/library/library-workspace.component.d.ts +265 -0
- package/dist/lib/components/library/library-workspace.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-workspace.component.js +4420 -0
- package/dist/lib/components/library/library-workspace.component.js.map +1 -0
- package/dist/lib/components/library/library.models.d.ts +162 -0
- package/dist/lib/components/library/library.models.d.ts.map +1 -0
- package/dist/lib/components/library/library.models.js +2 -0
- package/dist/lib/components/library/library.models.js.map +1 -0
- package/dist/lib/components/message/conversation-message-rating.component.d.ts +5 -0
- package/dist/lib/components/message/conversation-message-rating.component.d.ts.map +1 -1
- package/dist/lib/components/message/conversation-message-rating.component.js +72 -16
- package/dist/lib/components/message/conversation-message-rating.component.js.map +1 -1
- package/dist/lib/components/message/message-input.component.d.ts +26 -14
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input.component.js +91 -56
- package/dist/lib/components/message/message-input.component.js.map +1 -1
- package/dist/lib/components/message/message-item.component.d.ts +35 -1
- package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-item.component.js +583 -392
- package/dist/lib/components/message/message-item.component.js.map +1 -1
- package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-list.component.js +2 -0
- package/dist/lib/components/message/message-list.component.js.map +1 -1
- package/dist/lib/components/navigation/conversation-navigation.component.js +9 -9
- package/dist/lib/components/navigation/conversation-navigation.component.js.map +1 -1
- package/dist/lib/components/overlay/chat-overlay.component.d.ts +94 -6
- package/dist/lib/components/overlay/chat-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/overlay/chat-overlay.component.js +249 -59
- package/dist/lib/components/overlay/chat-overlay.component.js.map +1 -1
- package/dist/lib/components/project/project-form-modal.component.d.ts +6 -0
- package/dist/lib/components/project/project-form-modal.component.d.ts.map +1 -1
- package/dist/lib/components/project/project-form-modal.component.js +81 -61
- package/dist/lib/components/project/project-form-modal.component.js.map +1 -1
- package/dist/lib/components/project/project-selector.component.d.ts +5 -0
- package/dist/lib/components/project/project-selector.component.d.ts.map +1 -1
- package/dist/lib/components/project/project-selector.component.js +11 -4
- package/dist/lib/components/project/project-selector.component.js.map +1 -1
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.d.ts +55 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js +944 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.d.ts +66 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.js +253 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.d.ts +80 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.js +49 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.d.ts +54 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.js +386 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.js.map +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js +15 -2
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.js +2 -2
- package/dist/lib/components/realtime/realtime-agent-banner.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-picker.component.js +3 -3
- package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-composer.component.js +5 -3
- package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +81 -32
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.js +506 -185
- package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.js +89 -4
- package/dist/lib/components/realtime/realtime-session-thread.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.js +2 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts +4 -4
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.js +5 -5
- package/dist/lib/components/realtime/realtime-surface-tab-style.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +7 -9
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js +12 -13
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +27 -0
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +141 -2
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts +101 -3
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js +503 -55
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts +48 -5
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js +249 -53
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -1
- package/dist/lib/components/search/search-panel.component.d.ts +10 -0
- package/dist/lib/components/search/search-panel.component.d.ts.map +1 -1
- package/dist/lib/components/search/search-panel.component.js +25 -3
- package/dist/lib/components/search/search-panel.component.js.map +1 -1
- package/dist/lib/components/task/tasks-full-view.component.d.ts +31 -8
- package/dist/lib/components/task/tasks-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/task/tasks-full-view.component.js +692 -497
- package/dist/lib/components/task/tasks-full-view.component.js.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.js +15 -2
- package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
- package/dist/lib/conversations.module.d.ts +66 -61
- package/dist/lib/conversations.module.d.ts.map +1 -1
- package/dist/lib/conversations.module.js +60 -1
- package/dist/lib/conversations.module.js.map +1 -1
- package/dist/lib/models/agent-turn.model.d.ts +7 -1
- package/dist/lib/models/agent-turn.model.d.ts.map +1 -1
- package/dist/lib/models/agent-turn.model.js.map +1 -1
- package/dist/lib/services/agent-state.service.d.ts.map +1 -1
- package/dist/lib/services/agent-state.service.js +14 -3
- package/dist/lib/services/agent-state.service.js.map +1 -1
- package/dist/lib/services/artifact-permission.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-permission.service.js +14 -3
- package/dist/lib/services/artifact-permission.service.js.map +1 -1
- package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-state.service.js +43 -11
- package/dist/lib/services/artifact-state.service.js.map +1 -1
- package/dist/lib/services/conversation-agent.service.d.ts +8 -3
- package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-agent.service.js +9 -3
- package/dist/lib/services/conversation-agent.service.js.map +1 -1
- package/dist/lib/services/conversation-tasks-filter.d.ts +59 -2
- package/dist/lib/services/conversation-tasks-filter.d.ts.map +1 -1
- package/dist/lib/services/conversation-tasks-filter.js +222 -18
- package/dist/lib/services/conversation-tasks-filter.js.map +1 -1
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.d.ts +85 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.js +257 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.d.ts +85 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.js +10 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.d.ts +90 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.js +386 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.d.ts +13 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.js +201 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.js.map +1 -0
- package/dist/lib/services/export.service.d.ts +64 -0
- package/dist/lib/services/export.service.d.ts.map +1 -1
- package/dist/lib/services/export.service.js +185 -6
- package/dist/lib/services/export.service.js.map +1 -1
- package/dist/lib/services/library-creation.service.d.ts +304 -0
- package/dist/lib/services/library-creation.service.d.ts.map +1 -0
- package/dist/lib/services/library-creation.service.js +1244 -0
- package/dist/lib/services/library-creation.service.js.map +1 -0
- package/dist/lib/services/realtime-pairing.d.ts +3 -3
- package/dist/lib/services/realtime-pairing.js +4 -4
- package/dist/lib/services/realtime-pairing.js.map +1 -1
- package/dist/lib/services/realtime-session-review.service.d.ts +14 -0
- package/dist/lib/services/realtime-session-review.service.d.ts.map +1 -1
- package/dist/lib/services/realtime-session-review.service.js +46 -4
- package/dist/lib/services/realtime-session-review.service.js.map +1 -1
- package/dist/lib/services/search.service.d.ts +19 -2
- package/dist/lib/services/search.service.d.ts.map +1 -1
- package/dist/lib/services/search.service.js +99 -36
- package/dist/lib/services/search.service.js.map +1 -1
- package/dist/lib/utils/decision-routing.d.ts +5 -2
- package/dist/lib/utils/decision-routing.d.ts.map +1 -1
- package/dist/lib/utils/decision-routing.js +9 -4
- package/dist/lib/utils/decision-routing.js.map +1 -1
- package/dist/public-api.d.ts +13 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +15 -1
- package/dist/public-api.js.map +1 -1
- package/package.json +42 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whiteboard-channel.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/whiteboard/whiteboard-channel.ts"],"names":[],"mappings":";;;;;;AAGA,OAAO,EAAE,eAAe,EAAE,iCAAiC,EAAkC,MAAM,8BAA8B,CAAC;AAElI,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAA4B,MAAM,kCAAkC,CAAC;AAC7H,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EACL,wBAAwB,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,0BAA0B,EAC7G,yBAAyB,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,qBAAqB,EAC9G,sBAAsB,EAAE,4BAA4B,EAAoB,eAAe,EACvF,2BAA2B,EAG5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iCAAiC,EAAE,4BAA4B,EAAgC,MAAM,6BAA6B,CAAC;AAE5I;;;;;;;;GAQG;AACH,SAAS,aAAa,CAAC,MAAc;IACnC,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3C,OAAO,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAK,MAAgC,CAAC,OAAO,KAAK,IAAI,CAAC;IAC7G,CAAC;IAAC,MAAM,CAAC;QACP,yFAAyF;QACzF,qFAAqF;QACrF,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,GAAW,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,GAAG,GAAG;IACpF,IAAI,O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,oBAAoB,GAAG,IAAI,CAAC;YACjC,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAChC,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,0EAA0E;IAC7F,CAAC;IAED,gGAAgG;IACxF,cAAc;QACpB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnC,GAAG,CAAC,WAAW,EAAE,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF,CAAA;AAjkBY,yBAAyB;IADrC,aAAa,CAAC,yBAAyB,EAAE,2BAA2B,CAAC;GACzD,yBAAyB,CAikBrC;;AAED;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B;IAC3C,uEAAuE;AACzE,CAAC;AAED,wDAAwD;AACxD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,GAAW,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,GAAG,GAAG;IACpF,OAAO,wBAAwB,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import type { Type } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { RealtimeToolDefinition, type JSONObject } from '@memberjunction/ai';\nimport { CompareExposure, REALTIME_CHANNEL_CONTRACT_VERSION, type RealtimeChannelDescriptor } from '@memberjunction/ai-core-plus';\nimport { ChannelInboundVideoBridge, IChannelFrameProvider, type MediaPlacement } from '@memberjunction/ai-realtime-client';\nimport { BaseRealtimeChannelClient, BuildToolBackedVerbs, ChannelOnboardingDetails } from '@memberjunction/realtime-runtime';\nimport { IsPlainObject, RegisterClass } from '@memberjunction/global';\nimport {\n ApplyWhiteboardAgentTool, BuildWhiteboardExportSvg, IsWhiteboardWidgetToolAllowed, IsWhiteboardWidgetToolName,\n MinWhiteboardWidgetAccess, RealtimeWhiteboardHostComponent, WHITEBOARD_TOOL_DEFINITIONS, WHITEBOARD_TOOL_NAMES,\n WHITEBOARD_TOOL_PREFIX, WHITEBOARD_WIDGET_TOOL_NAMES, WhiteboardAuthor, WhiteboardState, WhiteboardToolResult,\n SameWhiteboardWidgetActions, WhiteboardWidgetAccess, WhiteboardWidgetActionInfo, WhiteboardWidgetActionsChangedEventArgs,\n WhiteboardWidgetInteractionEvent,\n WhiteboardWidgetSubmitEvent, WhiteboardWidgetToolName\n} from '@memberjunction/ng-whiteboard';\nimport { DEFAULT_WHITEBOARD_CHANNEL_CONFIG, ParseWhiteboardChannelConfig, type WhiteboardChannelConfig } from './whiteboard-channel-config';\n\n/**\n * Whether a whiteboard tool result reports success.\n *\n * `ApplyWhiteboardAgentTool` returns a JSON `WhiteboardToolResult` string — `{ success: true, … }`\n * or `{ success: false, error }` — for every tool and every failure path. Anything that does not\n * parse as an object with `success === true` is treated as NOT a successful mutation, which is the\n * safe direction: the cost of missing a confirmation frame is one stale picture until the next\n * change, while the cost of a false one is telling the model an edit landed when it did not.\n */\nfunction toolSucceeded(result: string): boolean {\n try {\n const parsed: unknown = JSON.parse(result);\n return parsed !== null && typeof parsed === 'object' && (parsed as { success?: unknown }).success === true;\n } catch {\n // A non-JSON result cannot be confirmed as a mutation — the host returned something this\n // channel does not understand, so it does not get a \"your change is on screen\" note.\n return false;\n }\n}\n\n/**\n * Asynchronously rasterizes an SVG string to a JPEG base64 string (without the `data:image/jpeg;base64,` prefix)\n * using an offscreen canvas. Returns null in non-DOM environments or when rendering fails.\n */\nexport async function RasterizeSvgToJpegBase64(svg: string, width = 1280, height = 720): Promise<string | null> {\n if (typeof document === 'undefined' || typeof Image === 'undefined') {\n return null;\n }\n return new Promise<string | null>((resolve) => {\n let url: string | null = null;\n let timer: ReturnType<typeof setTimeout> | null = null;\n\n const cleanup = () => {\n if (timer != null) {\n clearTimeout(timer);\n timer = null;\n }\n if (url) {\n URL.revokeObjectURL(url);\n url = null;\n }\n };\n\n try {\n const img = new Image();\n const svgBlob = new Blob([svg], { type: 'image/svg+xml;charset=utf-8' });\n url = URL.createObjectURL(svgBlob);\n\n // Capped wait: resolve null and revoke URL if the Image never fires onload or onerror (item 61)\n timer = setTimeout(() => {\n console.error('[RealtimeWhiteboardChannel] SVG rasterization timed out after 5000ms');\n cleanup();\n resolve(null);\n }, 5000);\n\n img.onload = () => {\n try {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n cleanup();\n resolve(null);\n return;\n }\n ctx.fillStyle = '#ffffff';\n ctx.fillRect(0, 0, width, height);\n ctx.drawImage(img, 0, 0, width, height);\n cleanup();\n const dataUrl = canvas.toDataURL('image/jpeg', 0.85);\n const comma = dataUrl.indexOf(',');\n resolve(comma >= 0 ? dataUrl.slice(comma + 1) : dataUrl);\n } catch (err) {\n console.error('[RealtimeWhiteboardChannel] Failed to rasterize SVG canvas to JPEG:', err);\n cleanup();\n resolve(null);\n }\n };\n img.onerror = (err) => {\n console.error('[RealtimeWhiteboardChannel] Failed to load SVG image for rasterization:', err);\n cleanup();\n resolve(null);\n };\n img.src = url;\n } catch (err) {\n console.error('[RealtimeWhiteboardChannel] Failed to initialize SVG rasterization:', err);\n cleanup();\n resolve(null);\n }\n });\n}\n\n/**\n * Per-widget throttle window for AMBIENT interaction context notes: at most one note per\n * widget per this many ms — within the window the LATEST summary wins (chatty widgets\n * collapse to one trailing-edge note instead of flooding the model's context).\n */\nexport const WHITEBOARD_INTERACTION_NOTE_THROTTLE_MS = 4000;\n\n/** Every widget tool's result carries the widget's contents (outline, state), so it requires `'state'` exposure. */\nconst WIDGET_TOOLS_RETURN_STATE: Readonly<Record<string, 'state'>> = Object.fromEntries(\n WHITEBOARD_WIDGET_TOOL_NAMES.map(name => [name, 'state' as const]));\n\n/**\n * Per-widget throttle window for \"widget offers actions\" perception notes (same leading +\n * trailing, latest-wins shape as the ambient interaction notes).\n */\nexport const WHITEBOARD_ACTIONS_NOTE_THROTTLE_MS = 4000;\n\n/**\n * Minimum spacing (ms) between the save requests a widget-state change triggers. The\n * session runtime debounces saves 3 s and RE-ARMS on every request, so a chatty widget\n * requesting on every keystroke would never save until teardown; spacing requests further\n * apart than the debounce guarantees each one lands.\n */\nexport const WHITEBOARD_WIDGET_STATE_SAVE_THROTTLE_MS = 5000;\n\n/** The JSON key the widget states ride under, beside the board's own fields, in the session save payload. */\nexport const WHITEBOARD_WIDGET_STATES_SAVE_KEY = 'widgetStates';\n\n/**\n * One widget command as {@link RealtimeWhiteboardChannel.OnBeforeWidgetCommand} sees it,\n * before it reaches the board.\n */\nexport interface WhiteboardChannelWidgetCommand {\n /** Which widget tool the agent called. */\n ToolName: WhiteboardWidgetToolName;\n /** The target widget's item ID, when the arguments name one. */\n ItemID: string | null;\n /** The parsed tool arguments, or null when they were not a JSON object (the board then answers `invalid_args`). */\n Args: Readonly<JSONObject> | null;\n /** The raw tool arguments as the model sent them. */\n ArgsJson: string;\n /** The effective widget access this call was checked against. */\n Access: WhiteboardWidgetAccess;\n}\n\n/** A widget-tool failure code (the `errorCode` of a {@link WhiteboardToolResult}). */\ntype WidgetToolErrorCode = NonNullable<WhiteboardToolResult['errorCode']>;\n\n/** A JSON tool result for a widget command the channel refused before it reached the board. */\nfunction widgetToolFailure(errorCode: WidgetToolErrorCode, error: string): string {\n const result: WhiteboardToolResult = { success: false, error, errorCode };\n return JSON.stringify(result);\n}\n\n/** Parses tool arguments into a JSON object, or null when they are not one. */\nfunction parseToolArgs(argsJson: string): JSONObject | null {\n try {\n const parsed: unknown = JSON.parse(argsJson);\n // JSON.parse output is JSON by construction, so narrowing a plain object to JSONObject is not a type lie.\n return IsPlainObject(parsed) ? (parsed as JSONObject) : null;\n } catch {\n return null;\n }\n}\n\n/** Whether a widget event came from the agent's own operate command (absent Author = the user). */\nfunction isAgentAuthored(event: { ItemID: string; Author?: WhiteboardAuthor }): boolean {\n return event.Author === 'agent';\n}\n\n/** Reads the `widgetStates` sibling key of a saved payload; anything malformed reads as none. */\nfunction readSavedWidgetStates(stateJson: string): Record<string, string> {\n const saved = parseToolArgs(stateJson);\n const raw = saved ? saved[WHITEBOARD_WIDGET_STATES_SAVE_KEY] : undefined;\n const out: Record<string, string> = {};\n if (IsPlainObject(raw)) {\n for (const [id, value] of Object.entries(raw as JSONObject)) {\n if (typeof value === 'string') {\n out[id] = value;\n }\n }\n }\n return out;\n}\n\n/** Per-key throttle bookkeeping. */\ninterface NoteThrottleEntry<T> {\n /** When this key's last note was sent (epoch ms). */\n LastSentAt: number;\n /** Trailing-edge timer for a deferred note, or null when the window is idle. */\n Timer: ReturnType<typeof setTimeout> | null;\n /** The latest value received within the open window (sent when the timer fires). */\n Pending: T | null;\n}\n\n/**\n * Per-key leading + trailing throttle for background notes: outside an open window a value\n * is sent immediately and opens a window; within the window the LATEST value is stashed and\n * a trailing-edge timer sends it when the window closes (one note per key per window).\n */\nclass KeyedNoteThrottle<T> {\n private entries = new Map<string, NoteThrottleEntry<T>>();\n\n constructor(private readonly windowMs: number, private readonly send: (value: T) => void) {}\n\n /** Offers one value for `key`; it is sent now or at the end of the key's open window. */\n public Push(key: string, value: T): void {\n const now = Date.now();\n const entry = this.entries.get(key);\n if (!entry || (entry.Timer === null && now - entry.LastSentAt >= this.windowMs)) {\n this.send(value);\n this.entries.set(key, { LastSentAt: now, Timer: null, Pending: null });\n return;\n }\n entry.Pending = value; // latest wins within the window\n if (entry.Timer === null) {\n const wait = Math.max(0, entry.LastSentAt + this.windowMs - now);\n entry.Timer = setTimeout(() => this.flush(entry), wait);\n }\n }\n\n /** Cancels every pending trailing note and resets all windows. */\n public Clear(): void {\n for (const entry of this.entries.values()) {\n if (entry.Timer !== null) {\n clearTimeout(entry.Timer);\n }\n }\n this.entries.clear();\n }\n\n private flush(entry: NoteThrottleEntry<T>): void {\n entry.Timer = null;\n const pending = entry.Pending;\n entry.Pending = null;\n if (pending !== null) {\n entry.LastSentAt = Date.now();\n this.send(pending);\n }\n }\n}\n\n/**\n * The LIVE WHITEBOARD as a pluggable interactive channel — the canonical\n * {@link BaseRealtimeChannelClient} implementation, resolved from the `MJ: AI Agent\n * Channels` registry row whose `ClientPluginClass` is `'RealtimeWhiteboardChannel'`.\n *\n * One instance per session (created via ClassFactory at session start). It owns the\n * board's {@link WhiteboardState} engine and contributes the channel's full contract:\n *\n * - **Action**: the `Whiteboard_*` client-executed tool set\n * ({@link WHITEBOARD_TOOL_DEFINITIONS}); {@link ApplyAgentTool} prefers the BOUND host\n * component (board mutation + violet pop-in / toast / presence-cursor garnish) and\n * falls back to the pure {@link ApplyWhiteboardAgentTool} engine call when no surface\n * is bound (e.g. the board has not been shown yet) — the channel keeps working, just\n * without the garnish.\n * - **Perception**: {@link BindSurface} subscribes the host's coalesced (750 ms)\n * `SceneDelta` stream and pipes each delta into the live model's context as a\n * `[whiteboard]` background note; the agent-undo toast click flows the same way.\n * - **Surface**: {@link RealtimeWhiteboardHostComponent}, created on the overlay's stage; the\n * host's \"Move to stage\" button rides `Context.SetFocusMode`, and the board hears where the\n * overlay placed it ({@link OnSurfacePlacementChange}) so the button offers the way back.\n * - **State of record**: every board mutation (user edits AND agent tool calls) requests\n * a save of {@link WhiteboardState.ToJSON} under channel name `'Whiteboard'` — the\n * host debounces and flushes at teardown.\n *\n * A PRIOR session's persisted board is restored through {@link RestoreState} (invoked by\n * the session host after Initialize, before any surface binding): the saved JSON is\n * rehydrated IN PLACE into the same {@link WhiteboardState} instance, so the save\n * subscription and any later surface binding keep pointing at one engine. Malformed or\n * incompatible payloads are tolerated — the board simply starts fresh.\n */\n@RegisterClass(BaseRealtimeChannelClient, 'RealtimeWhiteboardChannel')\nexport class RealtimeWhiteboardChannel extends BaseRealtimeChannelClient<RealtimeWhiteboardHostComponent> implements IChannelFrameProvider {\n /** The board's state of record — created fresh with the plugin (one per session). */\n public readonly State = new WhiteboardState();\n\n /** The live bound surface, when the channel tab's pane is instantiated. */\n private host: RealtimeWhiteboardHostComponent | null = null;\n /** Output subscriptions on the bound surface (SceneDelta / AgentUndo / FocusModeChange). */\n private surfaceSubs: Subscription[] = [];\n /** Board-mutation subscription driving the debounced state-of-record save. */\n private stateChangedSub: Subscription | null = null;\n /** Per-widget ambient-interaction note throttles (ItemID → window state). */\n private interactionThrottles = new KeyedNoteThrottle<WhiteboardWidgetInteractionEvent>(\n WHITEBOARD_INTERACTION_NOTE_THROTTLE_MS, (interaction) => this.sendInteractionNote(interaction));\n /** Per-widget \"offers actions\" note throttles (ItemID → window state). */\n private actionsNoteThrottles = new KeyedNoteThrottle<WhiteboardWidgetActionsChangedEventArgs>(\n WHITEBOARD_ACTIONS_NOTE_THROTTLE_MS, (actions) => this.sendActionsNote(actions));\n /** Per-widget action list of the last \"offers actions\" note SENT (ItemID → actions), for dedupe. */\n private lastActionsNoted = new Map<string, WhiteboardWidgetActionInfo[]>();\n /** The parsed `ChannelConfig` (defaults until {@link OnInitialize}). */\n private config: WhiteboardChannelConfig = { ...DEFAULT_WHITEBOARD_CHANNEL_CONFIG };\n /** Widget-state subscription driving the throttled save. */\n private widgetStateSub: Subscription | null = null;\n /** Trailing timer of the widget-state save throttle, or null when idle. */\n private widgetStateSaveTimer: ReturnType<typeof setTimeout> | null = null;\n /** When the widget-state path last requested a save (epoch ms). */\n private lastWidgetStateSaveAt = Number.NEGATIVE_INFINITY;\n /** True while {@link RestoreState} runs: saves are held so none carries a half-restored board. */\n private restoring = false;\n public get ChannelName(): string {\n return 'Whiteboard';\n }\n\n /**\n * Produces the latest visual scene as a base64-encoded frame for the video bridge.\n * Renders the whiteboard SVG into an offscreen canvas and returns base64 JPEG.\n */\n public async GetLatestFrame(): Promise<string | null> {\n if (!this.State) {\n return null;\n }\n try {\n const svg = BuildWhiteboardExportSvg(this.State);\n return await RasterizeSvgToJpegBase64(svg);\n } catch (err) {\n console.error('[RealtimeWhiteboardChannel] Failed to export whiteboard frame:', err);\n return null;\n }\n }\n\n /**\n * The shared frame bridge, which now lives on the base channel (`VisualVideoBridge`). This accessor\n * keeps the board's long-standing `videoBridge` handle — tests and tooling reach the bridge by that\n * name — pointing at the one the pump actually writes to.\n */\n private get videoBridge(): ChannelInboundVideoBridge | null {\n return this.VisualVideoBridge;\n }\n private set videoBridge(bridge: ChannelInboundVideoBridge | null) {\n this.VisualVideoBridge = bridge;\n }\n\n // The change-driven frame pump (leading edge, trailing settle, dedupe, negotiated cadence, one\n // confirmation frame after an agent edit) used to live here. It is now the base channel's\n // `EnableVisualPerception` pump, enabled from OnInitialize — this channel only says WHEN its picture\n // changed. The behavior is unchanged, including (deliberately) the shared bridge's fixed-rate poller:\n // see `StartBridgePoller` in OnInitialize.\n\n public get ToolNamePrefix(): string {\n return WHITEBOARD_TOOL_PREFIX;\n }\n\n public get TabTitle(): string {\n return 'Whiteboard';\n }\n\n public get TabIcon(): string {\n return 'fa-solid fa-chalkboard';\n }\n\n /** The board can be shared on its own: the call's Share menu offers it under \"This panel\" while it is on screen. */\n public override get SurfaceShareable(): boolean {\n return true;\n }\n\n /**\n * The board's tools. The widget tools are declared only as far as {@link MaxWidgetAccess}\n * allows (`'inspect-only'` declares Inspect only, `'off'` none). Read before the channel is\n * initialized, so it depends on the class alone, never on the session's config.\n */\n public GetToolDefinitions(): RealtimeToolDefinition[] {\n const max = this.MaxWidgetAccess;\n if (max === 'full') {\n return WHITEBOARD_TOOL_DEFINITIONS;\n }\n return WHITEBOARD_TOOL_DEFINITIONS.filter(tool => !IsWhiteboardWidgetToolName(tool.Name) || IsWhiteboardWidgetToolAllowed(max, tool.Name));\n }\n\n // ────────────────────────────────────────────── widget access policy (extension points)\n\n /**\n * The most widget access this channel class ever offers — which widget tools it DECLARES to the\n * model (tools are collected before the channel is initialized, so this cannot depend on the\n * session). Default `'full'`. A host app lowers it by subclassing the channel and registering the\n * subclass under `'RealtimeWhiteboardChannel'` (or via `HostChannels[].Create`).\n */\n protected get MaxWidgetAccess(): WhiteboardWidgetAccess {\n return 'full';\n }\n\n /**\n * The widget access in force for ONE call, evaluated per call (so it may change mid-session,\n * e.g. `'off'` while an assessment is open). Default: the lower of {@link MaxWidgetAccess} and\n * the session's `widgetAccess` config. A call it does not allow returns `access_denied`.\n */\n protected ResolveWidgetAccess(): WhiteboardWidgetAccess {\n return MinWhiteboardWidgetAccess(this.MaxWidgetAccess, this.config.WidgetAccess);\n }\n\n /**\n * Last-moment veto of one widget command that access already allows: return the refusal text the\n * model should see (the call returns `vetoed` with it) or `null` to let it through. Default allows all.\n */\n protected OnBeforeWidgetCommand(_command: WhiteboardChannelWidgetCommand): string | null {\n return null;\n }\n\n /** Whether widget runtime state rides in this session's saves (config `persistWidgetState`). */\n public get PersistWidgetState(): boolean {\n return this.config.PersistWidgetState;\n }\n\n public override GetSurfaceComponent(): Type<RealtimeWhiteboardHostComponent> {\n return RealtimeWhiteboardHostComponent;\n }\n\n /** First-run intro shown the first time the user opens the Whiteboard tab (once per user). */\n public override GetOnboardingDetails(): ChannelOnboardingDetails {\n return {\n Heading: 'Whiteboard',\n Description:\n 'A shared canvas the agent can sketch, write and annotate on live during the call — ' +\n 'whatever it draws appears here instantly, and anything you add is something it can see too.',\n Tips: [\n 'Watch the board fill in as you talk — the agent updates it in real time.',\n 'Add your own notes or shapes; the agent perceives your edits and can build on them.',\n 'Use Focus to give the board the whole screen, and save it to artifacts to keep it.'\n ],\n IconClass: 'fa-solid fa-chalkboard'\n };\n }\n\n /**\n * The board's self-description: what it holds, every `Whiteboard_*` tool as a verb (so a tool a\n * subclass adds shows up here too), and that the model can SEE it (frames), not just read its state.\n */\n public override GetDescriptor(): RealtimeChannelDescriptor {\n return {\n Key: this.ChannelName,\n Version: REALTIME_CHANNEL_CONTRACT_VERSION,\n DisplayName: this.TabTitle,\n OwningPackage: '@memberjunction/ng-conversations',\n Instructions:\n 'A shared canvas you and the user can both draw, write and annotate on live. Whatever you add ' +\n 'appears instantly, and you perceive what the user adds. Use it to sketch, diagram and explain ' +\n 'visually; do not narrate minor edits.',\n Nouns: [\n {\n Name: 'pages',\n Description: 'The board\\'s pages, in order; each holds the items (notes, shapes, connectors, text, widgets) drawn on it.',\n Schema: { type: 'array', items: { type: 'object' } }\n }\n ],\n // Each widget tool returns the widget's contents, so the runtime refuses it below 'state' exposure.\n Verbs: BuildToolBackedVerbs(this.GetToolDefinitions(), this.ToolNamePrefix, 'agent', WIDGET_TOOLS_RETURN_STATE),\n Events: [\n { Name: 'state_changed', Description: 'The board changed (by you or the user).' },\n { Name: 'frame_pushed', Description: 'A picture of the board was sent to you.' }\n ],\n DisplayPolicy: 'open-on-start',\n DefaultAvailability: 'all-sessions',\n MaxExposure: 'pixels'\n };\n }\n\n /**\n * Persist the board (host-debounced) on EVERY board mutation — user edits AND agent tools — and drive\n * the visual pump. The board feeds the model its own perception (coalesced scene deltas from the\n * bound surface), so state changes are recorded for events and frame tagging only (`Perceive: false`):\n * the structured note would duplicate the deltas.\n */\n protected override OnInitialize(): void {\n this.applyChannelConfig();\n this.stateChangedSub?.unsubscribe();\n this.EnableVisualPerception(this, {\n ConfirmationNote:\n '[whiteboard] visual confirmation of your action (background — do NOT narrate or announce your own change; continue naturally)',\n // Preserves what the board always did: it started the bridge's fixed-rate poller despite being\n // designed heartbeat-free. Flagged for the reviewer; remove to make the board purely change-driven.\n StartBridgePoller: true\n });\n this.stateChangedSub = this.State.Changed$.subscribe((change) => {\n if (!this.restoring) {\n this.Context?.RequestSave(this.BuildSavePayload());\n }\n this.RecordChange({ Author: change.Author, Perceive: false });\n // Only user edits (and scene replacements like undo) drive the settle-debounce pipeline.\n // Agent edits are confirmed with a single frame in ApplyAgentTool.\n if (change.Author === 'user' || change.Op === 'replace') {\n void this.NotifyVisualChange();\n }\n });\n // Widget state is runtime data (no Changed$): save it on its own, throttled cadence.\n this.widgetStateSub?.unsubscribe();\n this.widgetStateSub = this.State.WidgetStateChanged$.subscribe(() => this.scheduleWidgetStateSave());\n }\n\n /** Parses `ChannelConfig`; an invalid member falls back to its default with a console warning. */\n private applyChannelConfig(): void {\n const parsed = ParseWhiteboardChannelConfig(this.Context?.ChannelConfig);\n this.config = parsed.Config;\n for (const problem of parsed.Problems) {\n console.warn(`[RealtimeWhiteboardChannel] channel config: ${problem}`);\n }\n }\n\n /**\n * Tells the model, once the session is live, which widget tools this session's access leaves\n * unavailable (notes sent before the session is live are dropped, so not from OnInitialize).\n */\n public override OnSessionStarted(): void {\n super.OnSessionStarted();\n const limit = this.describeWidgetAccessLimit(this.ResolveWidgetAccess());\n if (limit) {\n this.Context?.SendContextNote(`[whiteboard] ${limit}`);\n }\n }\n\n /** One sentence naming the widget tools `access` leaves unavailable, or null at full access. */\n private describeWidgetAccessLimit(access: WhiteboardWidgetAccess): string | null {\n if (access === 'full') {\n return null;\n }\n const unavailable = WHITEBOARD_WIDGET_TOOL_NAMES.filter(name => !IsWhiteboardWidgetToolAllowed(access, name));\n const reason = access === 'off'\n ? 'widget tools are turned off for this session'\n : `widgets are inspect-only for this session — read them with ${WHITEBOARD_TOOL_NAMES.InspectWidget}, but do not try to change them`;\n return `${unavailable.join(', ')} ${unavailable.length === 1 ? 'is' : 'are'} unavailable: ${reason}.`;\n }\n\n /**\n * The session save payload: the board's own JSON plus, when `persistWidgetState` is on and any\n * widget holds state, a sibling `widgetStates` key. Old readers ignore the unknown key; LiveKit\n * sync and Save-to-artifact keep plain {@link WhiteboardState.ToJSON}.\n */\n protected BuildSavePayload(): string {\n const boardJson = this.State.ToJSON();\n if (!this.config.PersistWidgetState) {\n return boardJson;\n }\n const widgetStates = this.State.WidgetStatesToJSON();\n if (Object.keys(widgetStates).length === 0) {\n return boardJson;\n }\n const payload = parseToolArgs(boardJson) ?? {};\n payload[WHITEBOARD_WIDGET_STATES_SAVE_KEY] = widgetStates;\n return JSON.stringify(payload);\n }\n\n /**\n * Requests a save for a widget-state change at most once per\n * {@link WHITEBOARD_WIDGET_STATE_SAVE_THROTTLE_MS} (leading edge, then one trailing request with\n * the latest state). Nothing is requested when `persistWidgetState` is off.\n */\n private scheduleWidgetStateSave(): void {\n if (this.restoring || !this.config.PersistWidgetState || this.widgetStateSaveTimer !== null) {\n return;\n }\n const wait = this.lastWidgetStateSaveAt + WHITEBOARD_WIDGET_STATE_SAVE_THROTTLE_MS - Date.now();\n if (wait <= 0) {\n this.requestWidgetStateSave();\n return;\n }\n this.widgetStateSaveTimer = setTimeout(() => {\n this.widgetStateSaveTimer = null;\n this.requestWidgetStateSave();\n }, wait);\n }\n\n private requestWidgetStateSave(): void {\n this.lastWidgetStateSaveAt = Date.now();\n this.Context?.RequestSave(this.BuildSavePayload());\n }\n\n /**\n * Wires the dynamically-created board host: inputs (shared state engine + agent name)\n * are set BEFORE the component's first change detection, and the perception/garnish\n * outputs are subscribed back into the host context — the overlay never sees any of it.\n */\n public BindSurface(instance: RealtimeWhiteboardHostComponent): void {\n this.EnsureVideoBridge();\n this.releaseSurface();\n this.host = instance;\n instance.State = this.State;\n instance.AgentName = this.Context?.AgentName ?? 'Agent';\n instance.AgentWidgetAccess = this.ResolveWidgetAccess();\n this.surfaceSubs.push(\n // The board's coalesced scene delta — the perception feed the agent \"sees\".\n instance.SceneDelta.subscribe((deltaJson: string) => {\n // Background PERCEPTION, not conversation: the model sees every user edit without\n // being told, but must not narrate minor changes — only react when something is\n // significant (or when asked). The etiquette rides in the note itself so any\n // realtime model gets it regardless of system-prompt sync state.\n this.Context?.SendContextNote(\n '[whiteboard] board update (background context — do NOT comment on minor edits; ' +\n 'only mention it if the change is significant to the discussion): ' + deltaJson);\n }),\n // The user clicked Undo on the agent-action toast (the undo already applied locally).\n instance.AgentUndo.subscribe(() => {\n this.Context?.SendContextNote('[whiteboard] user undid your last change');\n }),\n // A sandboxed HTML widget submitted user input (MJWhiteboard.submit) — already\n // validated, size-capped and not canceled (the host's cancelable WidgetSubmitting\n // event ran first). Surface it to the agent so it can react to quiz answers /\n // micro-form input it asked for.\n instance.WidgetSubmitted.subscribe((submit: WhiteboardWidgetSubmitEvent) => {\n // The agent's own operate command submitted it: the tool result already carries\n // `submitted`, so no note and no spoken reaction (it would answer itself).\n if (isAgentAuthored(submit)) {\n return;\n }\n // Durable awareness first (the note persists in the model's context)…\n this.Context?.SendContextNote(\n `[whiteboard] the user submitted input in widget \"${submit.Title || submit.ItemID}\": ${submit.DataJson}`);\n // …then make the model REACT — a submission is explicit user input the user is\n // waiting on; without this trigger, SendContextNote alone produces dead silence\n // (\"I clicked Submit and nothing happened\").\n this.Context?.RequestSpokenResponse?.(\n `The user just submitted input in the whiteboard widget \"${submit.Title || submit.ItemID}\": ${submit.DataJson}. ` +\n `React to it now in your own voice — acknowledge their choice and continue naturally.`);\n }),\n // AMBIENT widget telemetry (the injected recorder, NOT widget-authored script):\n // clicks / changes / typing summarized by the board. Pure background perception —\n // throttled per widget so chatty widgets don't flood the model's context, and framed\n // with do-not-respond etiquette (explicit MJWhiteboard.submit input arrives above).\n instance.WidgetInteraction.subscribe((interaction: WhiteboardWidgetInteractionEvent) => {\n this.onWidgetInteraction(interaction);\n }),\n // A widget registered or changed its named actions — a throttled perception note.\n instance.WidgetActionsChanged.subscribe((actions: WhiteboardWidgetActionsChangedEventArgs) => {\n this.actionsNoteThrottles.Push(actions.ItemID, actions);\n }),\n // The board's Focus toggle — ask the shell to collapse/restore the main call column.\n instance.FocusModeChange.subscribe((focused: boolean) => {\n this.Context?.SetFocusMode(focused);\n }),\n // \"Save to artifacts\": snapshot the board as a first-class versioned artifact.\n instance.SaveToArtifactsRequested.subscribe(() => {\n void this.saveBoardAsArtifact();\n })\n );\n }\n\n public override UnbindSurface(): void {\n this.releaseSurface();\n }\n\n /**\n * Routes one ambient widget-interaction batch to the agent as a throttled background\n * context note: outside an open window the note goes out immediately and opens a\n * {@link WHITEBOARD_INTERACTION_NOTE_THROTTLE_MS} window; within the window the LATEST\n * event is stashed and a trailing-edge timer sends it when the window closes (one note\n * per widget per window, latest summary wins). The agent's own interactions (its operate\n * steps) are not echoed back to it.\n */\n private onWidgetInteraction(interaction: WhiteboardWidgetInteractionEvent): void {\n if (isAgentAuthored(interaction)) {\n return;\n }\n this.interactionThrottles.Push(interaction.ItemID, interaction);\n }\n\n /** The ambient-note framing: background etiquette rides in the note itself (like scene deltas). */\n private sendInteractionNote(interaction: WhiteboardWidgetInteractionEvent): void {\n this.Context?.SendContextNote(\n `[whiteboard] ambient activity in widget \"${interaction.Title || interaction.ItemID}\" ` +\n '(background — do NOT respond unless it is significant or you are asked; ' +\n `explicit submissions arrive separately): ${interaction.Summary}`);\n }\n\n /**\n * \"[whiteboard] widget … offers actions: …\" — sent only when the channel's exposure lets the\n * model see board contents (`'state'` or above) and this session may call widget actions,\n * and only when the list (names + descriptions) differs from the last note sent for that\n * widget: a remount, a `hello` answer or the agent's own inspect re-reports the same list.\n */\n private sendActionsNote(event: WhiteboardWidgetActionsChangedEventArgs): void {\n if (event.Actions.length === 0 || CompareExposure(this.Exposure, 'state') < 0) {\n return;\n }\n if (!IsWhiteboardWidgetToolAllowed(this.ResolveWidgetAccess(), WHITEBOARD_TOOL_NAMES.CallWidget)) {\n return;\n }\n const lastSent = this.lastActionsNoted.get(event.ItemID);\n if (lastSent && SameWhiteboardWidgetActions(lastSent, event.Actions)) {\n return;\n }\n this.lastActionsNoted.set(event.ItemID, event.Actions.map(action => ({ ...action })));\n const names = event.Actions.map(action => action.Name).join(', ');\n this.Context?.SendContextNote(`[whiteboard] widget \"${event.Title || event.ItemID}\" (${event.ItemID}) offers actions: ${names}`);\n }\n\n /** Cancels all pending ambient / actions note timers and resets the per-widget throttle windows. */\n private clearInteractionThrottles(): void {\n this.interactionThrottles.Clear();\n this.actionsNoteThrottles.Clear();\n }\n\n /**\n * Persists the current board as a `MJ: Artifacts` snapshot via the host context\n * (best-effort; the host logs failures). On success the agent is told via a context\n * note so it can reference the saved artifact naturally.\n */\n private async saveBoardAsArtifact(): Promise<void> {\n const ctx = this.Context;\n if (!ctx) {\n return;\n }\n const now = new Date();\n const name = `Whiteboard — ${now.toLocaleDateString()} ${now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`;\n const artifactId = await ctx.SaveAsArtifact(name, this.State.ToJSON());\n if (artifactId) {\n ctx.SendContextNote(`[whiteboard] the user saved the current board as the artifact \"${name}\"`);\n }\n }\n\n /**\n * Executes one `Whiteboard_*` tool call LOCALLY. Board tools prefer the live bound host\n * (board mutation + UI garnish) and fall back to the pure engine function when no surface\n * is bound, so the channel keeps working before the board is first shown. Widget tools\n * (inspect / operate / call) need the live board and resolve asynchronously; see\n * {@link applyWidgetTool}.\n *\n * Return contract: **board tools return a plain `string` synchronously** (bound or not);\n * **the three widget tools** ({@link IsWhiteboardWidgetToolName}) **return a\n * `Promise<string>`** (policy refusals may also come back as a plain string). The declared\n * type is therefore `string | Promise<string>`. An override that post-processes results\n * should route `IsWhiteboardWidgetToolName(toolName)` calls straight to `super` and, for the\n * rest, narrow the board result with `typeof result === 'string'`.\n */\n public ApplyAgentTool(toolName: string, argsJson: string): string | Promise<string> {\n if (IsWhiteboardWidgetToolName(toolName)) {\n return this.applyWidgetTool(toolName, argsJson);\n }\n let result: string;\n if (this.host) {\n result = this.host.ApplyAgentTool(toolName, argsJson);\n } else {\n result = ApplyWhiteboardAgentTool(this.State, toolName, argsJson);\n }\n // A SUCCESSFUL agent tool triggers exactly ONE immediate visual confirmation frame and a note\n // telling the model not to narrate its own change. A FAILED one must trigger neither: every\n // failure path returns `{ success: false, error }` (bad JSON args, unknown tool, per-tool\n // validation), and confirming it would tell the model its edit landed AND instruct it to stay\n // quiet about it — so the failure would vanish from the user's view while the model carried on.\n // It would also push a frame identical to the last one, since a failed tool changes nothing.\n if (toolSucceeded(result)) {\n void this.ConfirmVisualChange();\n }\n return result;\n }\n\n /**\n * One widget command: access policy (`access_denied`, with the reason), then the\n * {@link OnBeforeWidgetCommand} veto (`vetoed`), then the live board (`surface_unavailable`\n * when none is bound). No confirmation frame: a widget's picture is a placeholder in frames.\n */\n private applyWidgetTool(toolName: WhiteboardWidgetToolName, argsJson: string): string | Promise<string> {\n const access = this.ResolveWidgetAccess();\n if (!IsWhiteboardWidgetToolAllowed(access, toolName)) {\n return widgetToolFailure('access_denied', this.describeWidgetAccessLimit(access) ?? `${toolName} is not available.`);\n }\n const args = parseToolArgs(argsJson);\n const itemId = args && typeof args['itemId'] === 'string' ? args['itemId'] : null;\n const refusal = this.OnBeforeWidgetCommand({ ToolName: toolName, ItemID: itemId, Args: args, ArgsJson: argsJson, Access: access });\n if (refusal !== null) {\n return widgetToolFailure('vetoed', refusal);\n }\n const host = this.host;\n if (!host) {\n return widgetToolFailure('surface_unavailable',\n 'The whiteboard isn\\'t open, so its widgets can\\'t be reached; ask the user to open the Whiteboard panel, then try again.');\n }\n host.AgentWidgetAccess = access; // per-call policy may have changed since BindSurface\n return host.ApplyAgentToolAsync(toolName, argsJson).catch((error: Error) =>\n widgetToolFailure('surface_unavailable', `The whiteboard could not run ${toolName}: ${error?.message ?? String(error)}`));\n }\n\n /**\n * The board's serialized state of record — the board JSON only. It also backs the channel's\n * `GetState()` snapshot, so widget states (learner answers) stay out of it; they ride only in\n * the session save payload ({@link BuildSavePayload}).\n */\n public override SerializeState(): string | null {\n return this.State.ToJSON();\n }\n\n /**\n * Rehydrates a prior session's saved board into THIS session's state engine (in place —\n * the {@link State} instance and its subscriptions are preserved). Returns `true` on\n * success; malformed / incompatible JSON returns `false` and the board stays fresh\n * (never throws — {@link WhiteboardState.LoadFromJSON} is tolerant by contract).\n *\n * Saves: none are requested while the board and its widget states are being loaded (so no\n * save can pair the restored board with stale in-memory widget states); after a successful\n * restore, exactly one save is requested carrying both. A failed restore requests nothing.\n */\n public override RestoreState(stateJson: string): boolean {\n // A trailing widget-state save armed before the restore would fire after it as a second save.\n if (this.widgetStateSaveTimer !== null) {\n clearTimeout(this.widgetStateSaveTimer);\n this.widgetStateSaveTimer = null;\n }\n this.restoring = true;\n try {\n if (!this.State.LoadFromJSON(stateJson)) {\n return false;\n }\n // A legacy payload (no `widgetStates` key) simply restores no widget state. With\n // `persistWidgetState` off nothing is restored either: state lives in memory only.\n this.State.LoadWidgetStates(this.config.PersistWidgetState ? readSavedWidgetStates(stateJson) : {});\n }\n finally {\n this.restoring = false;\n }\n this.Context?.RequestSave(this.BuildSavePayload());\n return true;\n }\n\n /** Keeps the board's \"Move to stage\" / \"Back to tab\" button true to where the host placed it. */\n public override OnSurfacePlacementChange(placement: MediaPlacement): void {\n this.host?.SetOnStage(placement === 'stage');\n }\n\n /**\n * Exit focus mode THROUGH the bound host (its own Focus button state stays in sync; it\n * re-emits `FocusModeChange(false)` → `Context.SetFocusMode(false)`). When no surface is\n * bound the overlay's defensive flag clear covers it.\n */\n public override RequestFocusExit(): void {\n if (this.host?.FocusMode) {\n this.host.ToggleFocus();\n }\n }\n\n public override Dispose(): void {\n this.stateChangedSub?.unsubscribe();\n this.stateChangedSub = null;\n this.widgetStateSub?.unsubscribe();\n this.widgetStateSub = null;\n if (this.widgetStateSaveTimer !== null) {\n // Best effort: hand the latest widget state over before the context is released.\n clearTimeout(this.widgetStateSaveTimer);\n this.widgetStateSaveTimer = null;\n this.requestWidgetStateSave();\n }\n super.Dispose(); // releases the surface binding, the visual pump + bridge, and the context\n }\n\n /** Unsubscribes surface outputs, cancels pending ambient notes and drops the host reference. */\n private releaseSurface(): void {\n for (const sub of this.surfaceSubs) {\n sub.unsubscribe();\n }\n this.surfaceSubs = [];\n this.clearInteractionThrottles();\n this.host = null;\n }\n}\n\n/**\n * Tree-shaking prevention: the whiteboard channel is resolved dynamically through the\n * ClassFactory (by the registry row's `ClientPluginClass` key), so this static call is\n * what keeps its `@RegisterClass` side effect from being eliminated by the bundler.\n * Called by `RealtimeSessionService` alongside the realtime-client driver Load calls.\n */\nexport function LoadRealtimeWhiteboardChannel(): void {\n // intentional no-op — the import side effect performs the registration\n}\n\n/** @deprecated Use {@link RasterizeSvgToJpegBase64}. */\nexport async function rasterizeSvgToJpegBase64(svg: string, width = 1280, height = 720): Promise<string | null> {\n return RasterizeSvgToJpegBase64(svg, width, height);\n}\n"]}
|
|
1
|
+
{"version":3,"file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,EAAE,CAAC;YACnC,GAAG,CAAC,WAAW,EAAE,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF,CAAA;AAjkBY,yBAAyB;IADrC,aAAa,CAAC,yBAAyB,EAAE,2BAA2B,CAAC;GACzD,yBAAyB,CAikBrC;;AAED;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B;IAC3C,uEAAuE;AACzE,CAAC;AAED,wDAAwD;AACxD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,GAAW,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,GAAG,GAAG;IACpF,OAAO,wBAAwB,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import type { Type } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { RealtimeToolDefinition, type JSONObject, type JSONValue } from '@memberjunction/ai';\nimport { CompareExposure, REALTIME_CHANNEL_CONTRACT_VERSION, type RealtimeChannelDescriptor } from '@memberjunction/ai-core-plus';\nimport { ChannelInboundVideoBridge, IChannelFrameProvider, type MediaPlacement } from '@memberjunction/ai-realtime-client';\nimport { BaseRealtimeChannelClient, BuildToolBackedVerbs, ChannelOnboardingDetails } from '@memberjunction/realtime-runtime';\nimport { IsPlainObject, RegisterClass } from '@memberjunction/global';\nimport {\n ApplyWhiteboardAgentTool, BuildWhiteboardExportSvg, IsWhiteboardWidgetToolAllowed, IsWhiteboardWidgetToolName,\n MinWhiteboardWidgetAccess, RealtimeWhiteboardHostComponent, WHITEBOARD_TOOL_DEFINITIONS, WHITEBOARD_TOOL_NAMES,\n WHITEBOARD_TOOL_PREFIX, WHITEBOARD_WIDGET_TOOL_NAMES, WhiteboardAuthor, WhiteboardState, WhiteboardToolResult,\n SameWhiteboardWidgetActions, WhiteboardWidgetAccess, WhiteboardWidgetActionInfo, WhiteboardWidgetActionsChangedEventArgs,\n WhiteboardWidgetInteractionEvent,\n WhiteboardWidgetSubmitEvent, WhiteboardWidgetToolName\n} from '@memberjunction/ng-whiteboard';\nimport { DEFAULT_WHITEBOARD_CHANNEL_CONFIG, ParseWhiteboardChannelConfig, type WhiteboardChannelConfig } from './whiteboard-channel-config';\n\n/**\n * Whether a whiteboard tool result reports success.\n *\n * `ApplyWhiteboardAgentTool` returns a JSON `WhiteboardToolResult` string — `{ success: true, … }`\n * or `{ success: false, error }` — for every tool and every failure path. Anything that does not\n * parse as an object with `success === true` is treated as NOT a successful mutation, which is the\n * safe direction: the cost of missing a confirmation frame is one stale picture until the next\n * change, while the cost of a false one is telling the model an edit landed when it did not.\n */\nfunction toolSucceeded(result: string): boolean {\n try {\n const parsed = JSON.parse(result) as JSONValue;\n return IsPlainObject(parsed) && parsed['success'] === true;\n } catch {\n // A non-JSON result cannot be confirmed as a mutation — the host returned something this\n // channel does not understand, so it does not get a \"your change is on screen\" note.\n return false;\n }\n}\n\n/**\n * Asynchronously rasterizes an SVG string to a JPEG base64 string (without the `data:image/jpeg;base64,` prefix)\n * using an offscreen canvas. Returns null in non-DOM environments or when rendering fails.\n */\nexport async function RasterizeSvgToJpegBase64(svg: string, width = 1280, height = 720): Promise<string | null> {\n if (typeof document === 'undefined' || typeof Image === 'undefined') {\n return null;\n }\n return new Promise<string | null>((resolve) => {\n let url: string | null = null;\n let timer: ReturnType<typeof setTimeout> | null = null;\n\n const cleanup = () => {\n if (timer != null) {\n clearTimeout(timer);\n timer = null;\n }\n if (url) {\n URL.revokeObjectURL(url);\n url = null;\n }\n };\n\n try {\n const img = new Image();\n const svgBlob = new Blob([svg], { type: 'image/svg+xml;charset=utf-8' });\n url = URL.createObjectURL(svgBlob);\n\n // Capped wait: resolve null and revoke URL if the Image never fires onload or onerror (item 61)\n timer = setTimeout(() => {\n console.error('[RealtimeWhiteboardChannel] SVG rasterization timed out after 5000ms');\n cleanup();\n resolve(null);\n }, 5000);\n\n img.onload = () => {\n try {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n cleanup();\n resolve(null);\n return;\n }\n ctx.fillStyle = '#ffffff';\n ctx.fillRect(0, 0, width, height);\n ctx.drawImage(img, 0, 0, width, height);\n cleanup();\n const dataUrl = canvas.toDataURL('image/jpeg', 0.85);\n const comma = dataUrl.indexOf(',');\n resolve(comma >= 0 ? dataUrl.slice(comma + 1) : dataUrl);\n } catch (err) {\n console.error('[RealtimeWhiteboardChannel] Failed to rasterize SVG canvas to JPEG:', err);\n cleanup();\n resolve(null);\n }\n };\n img.onerror = (err) => {\n console.error('[RealtimeWhiteboardChannel] Failed to load SVG image for rasterization:', err);\n cleanup();\n resolve(null);\n };\n img.src = url;\n } catch (err) {\n console.error('[RealtimeWhiteboardChannel] Failed to initialize SVG rasterization:', err);\n cleanup();\n resolve(null);\n }\n });\n}\n\n/**\n * Per-widget throttle window for AMBIENT interaction context notes: at most one note per\n * widget per this many ms — within the window the LATEST summary wins (chatty widgets\n * collapse to one trailing-edge note instead of flooding the model's context).\n */\nexport const WHITEBOARD_INTERACTION_NOTE_THROTTLE_MS = 4000;\n\n/** Every widget tool's result carries the widget's contents (outline, state), so it requires `'state'` exposure. */\nconst WIDGET_TOOLS_RETURN_STATE: Readonly<Record<string, 'state'>> = Object.fromEntries(\n WHITEBOARD_WIDGET_TOOL_NAMES.map(name => [name, 'state' as const]));\n\n/**\n * Per-widget throttle window for \"widget offers actions\" perception notes (same leading +\n * trailing, latest-wins shape as the ambient interaction notes).\n */\nexport const WHITEBOARD_ACTIONS_NOTE_THROTTLE_MS = 4000;\n\n/**\n * Minimum spacing (ms) between the save requests a widget-state change triggers. The\n * session runtime debounces saves 3 s and RE-ARMS on every request, so a chatty widget\n * requesting on every keystroke would never save until teardown; spacing requests further\n * apart than the debounce guarantees each one lands.\n */\nexport const WHITEBOARD_WIDGET_STATE_SAVE_THROTTLE_MS = 5000;\n\n/** The JSON key the widget states ride under, beside the board's own fields, in the session save payload. */\nexport const WHITEBOARD_WIDGET_STATES_SAVE_KEY = 'widgetStates';\n\n/**\n * One widget command as {@link RealtimeWhiteboardChannel.OnBeforeWidgetCommand} sees it,\n * before it reaches the board.\n */\nexport interface WhiteboardChannelWidgetCommand {\n /** Which widget tool the agent called. */\n ToolName: WhiteboardWidgetToolName;\n /** The target widget's item ID, when the arguments name one. */\n ItemID: string | null;\n /** The parsed tool arguments, or null when they were not a JSON object (the board then answers `invalid_args`). */\n Args: Readonly<JSONObject> | null;\n /** The raw tool arguments as the model sent them. */\n ArgsJson: string;\n /** The effective widget access this call was checked against. */\n Access: WhiteboardWidgetAccess;\n}\n\n/** A widget-tool failure code (the `errorCode` of a {@link WhiteboardToolResult}). */\ntype WidgetToolErrorCode = NonNullable<WhiteboardToolResult['errorCode']>;\n\n/** A JSON tool result for a widget command the channel refused before it reached the board. */\nfunction widgetToolFailure(errorCode: WidgetToolErrorCode, error: string): string {\n const result: WhiteboardToolResult = { success: false, error, errorCode };\n return JSON.stringify(result);\n}\n\n/** Parses tool arguments into a JSON object, or null when they are not one. */\nfunction parseToolArgs(argsJson: string): JSONObject | null {\n try {\n const parsed = JSON.parse(argsJson) as JSONValue;\n // JSON.parse output is JSON by construction, so narrowing a plain object to JSONObject is not a type lie.\n return IsPlainObject(parsed) ? (parsed as JSONObject) : null;\n } catch {\n return null;\n }\n}\n\n/** Whether a widget event came from the agent's own operate command (absent Author = the user). */\nfunction isAgentAuthored(event: { ItemID: string; Author?: WhiteboardAuthor }): boolean {\n return event.Author === 'agent';\n}\n\n/** Reads the `widgetStates` sibling key of a saved payload; anything malformed reads as none. */\nfunction readSavedWidgetStates(stateJson: string): Record<string, string> {\n const saved = parseToolArgs(stateJson);\n const raw = saved ? saved[WHITEBOARD_WIDGET_STATES_SAVE_KEY] : undefined;\n const out: Record<string, string> = {};\n if (IsPlainObject(raw)) {\n for (const [id, value] of Object.entries(raw as JSONObject)) {\n if (typeof value === 'string') {\n out[id] = value;\n }\n }\n }\n return out;\n}\n\n/** Per-key throttle bookkeeping. */\ninterface NoteThrottleEntry<T> {\n /** When this key's last note was sent (epoch ms). */\n LastSentAt: number;\n /** Trailing-edge timer for a deferred note, or null when the window is idle. */\n Timer: ReturnType<typeof setTimeout> | null;\n /** The latest value received within the open window (sent when the timer fires). */\n Pending: T | null;\n}\n\n/**\n * Per-key leading + trailing throttle for background notes: outside an open window a value\n * is sent immediately and opens a window; within the window the LATEST value is stashed and\n * a trailing-edge timer sends it when the window closes (one note per key per window).\n */\nclass KeyedNoteThrottle<T> {\n private entries = new Map<string, NoteThrottleEntry<T>>();\n\n constructor(private readonly windowMs: number, private readonly send: (value: T) => void) {}\n\n /** Offers one value for `key`; it is sent now or at the end of the key's open window. */\n public Push(key: string, value: T): void {\n const now = Date.now();\n const entry = this.entries.get(key);\n if (!entry || (entry.Timer === null && now - entry.LastSentAt >= this.windowMs)) {\n this.send(value);\n this.entries.set(key, { LastSentAt: now, Timer: null, Pending: null });\n return;\n }\n entry.Pending = value; // latest wins within the window\n if (entry.Timer === null) {\n const wait = Math.max(0, entry.LastSentAt + this.windowMs - now);\n entry.Timer = setTimeout(() => this.flush(entry), wait);\n }\n }\n\n /** Cancels every pending trailing note and resets all windows. */\n public Clear(): void {\n for (const entry of this.entries.values()) {\n if (entry.Timer !== null) {\n clearTimeout(entry.Timer);\n }\n }\n this.entries.clear();\n }\n\n private flush(entry: NoteThrottleEntry<T>): void {\n entry.Timer = null;\n const pending = entry.Pending;\n entry.Pending = null;\n if (pending !== null) {\n entry.LastSentAt = Date.now();\n this.send(pending);\n }\n }\n}\n\n/**\n * The LIVE WHITEBOARD as a pluggable interactive channel — the canonical\n * {@link BaseRealtimeChannelClient} implementation, resolved from the `MJ: AI Agent\n * Channels` registry row whose `ClientPluginClass` is `'RealtimeWhiteboardChannel'`.\n *\n * One instance per session (created via ClassFactory at session start). It owns the\n * board's {@link WhiteboardState} engine and contributes the channel's full contract:\n *\n * - **Action**: the `Whiteboard_*` client-executed tool set\n * ({@link WHITEBOARD_TOOL_DEFINITIONS}); {@link ApplyAgentTool} prefers the BOUND host\n * component (board mutation + violet pop-in / toast / presence-cursor garnish) and\n * falls back to the pure {@link ApplyWhiteboardAgentTool} engine call when no surface\n * is bound (e.g. the board has not been shown yet) — the channel keeps working, just\n * without the garnish.\n * - **Perception**: {@link BindSurface} subscribes the host's coalesced (750 ms)\n * `SceneDelta` stream and pipes each delta into the live model's context as a\n * `[whiteboard]` background note; the agent-undo toast click flows the same way.\n * - **Surface**: {@link RealtimeWhiteboardHostComponent}, created on the overlay's stage; the\n * host's \"Move to stage\" button rides `Context.SetFocusMode`, and the board hears where the\n * overlay placed it ({@link OnSurfacePlacementChange}) so the button offers the way back.\n * - **State of record**: every board mutation (user edits AND agent tool calls) requests\n * a save of {@link WhiteboardState.ToJSON} under channel name `'Whiteboard'` — the\n * host debounces and flushes at teardown.\n *\n * A PRIOR session's persisted board is restored through {@link RestoreState} (invoked by\n * the session host after Initialize, before any surface binding): the saved JSON is\n * rehydrated IN PLACE into the same {@link WhiteboardState} instance, so the save\n * subscription and any later surface binding keep pointing at one engine. Malformed or\n * incompatible payloads are tolerated — the board simply starts fresh.\n */\n@RegisterClass(BaseRealtimeChannelClient, 'RealtimeWhiteboardChannel')\nexport class RealtimeWhiteboardChannel extends BaseRealtimeChannelClient<RealtimeWhiteboardHostComponent> implements IChannelFrameProvider {\n /** The board's state of record — created fresh with the plugin (one per session). */\n public readonly State = new WhiteboardState();\n\n /** The live bound surface, when the channel tab's pane is instantiated. */\n private host: RealtimeWhiteboardHostComponent | null = null;\n /** Output subscriptions on the bound surface (SceneDelta / AgentUndo / FocusModeChange). */\n private surfaceSubs: Subscription[] = [];\n /** Board-mutation subscription driving the debounced state-of-record save. */\n private stateChangedSub: Subscription | null = null;\n /** Per-widget ambient-interaction note throttles (ItemID → window state). */\n private interactionThrottles = new KeyedNoteThrottle<WhiteboardWidgetInteractionEvent>(\n WHITEBOARD_INTERACTION_NOTE_THROTTLE_MS, (interaction) => this.sendInteractionNote(interaction));\n /** Per-widget \"offers actions\" note throttles (ItemID → window state). */\n private actionsNoteThrottles = new KeyedNoteThrottle<WhiteboardWidgetActionsChangedEventArgs>(\n WHITEBOARD_ACTIONS_NOTE_THROTTLE_MS, (actions) => this.sendActionsNote(actions));\n /** Per-widget action list of the last \"offers actions\" note SENT (ItemID → actions), for dedupe. */\n private lastActionsNoted = new Map<string, WhiteboardWidgetActionInfo[]>();\n /** The parsed `ChannelConfig` (defaults until {@link OnInitialize}). */\n private config: WhiteboardChannelConfig = { ...DEFAULT_WHITEBOARD_CHANNEL_CONFIG };\n /** Widget-state subscription driving the throttled save. */\n private widgetStateSub: Subscription | null = null;\n /** Trailing timer of the widget-state save throttle, or null when idle. */\n private widgetStateSaveTimer: ReturnType<typeof setTimeout> | null = null;\n /** When the widget-state path last requested a save (epoch ms). */\n private lastWidgetStateSaveAt = Number.NEGATIVE_INFINITY;\n /** True while {@link RestoreState} runs: saves are held so none carries a half-restored board. */\n private restoring = false;\n public get ChannelName(): string {\n return 'Whiteboard';\n }\n\n /**\n * Produces the latest visual scene as a base64-encoded frame for the video bridge.\n * Renders the whiteboard SVG into an offscreen canvas and returns base64 JPEG.\n */\n public async GetLatestFrame(): Promise<string | null> {\n if (!this.State) {\n return null;\n }\n try {\n const svg = BuildWhiteboardExportSvg(this.State);\n return await RasterizeSvgToJpegBase64(svg);\n } catch (err) {\n console.error('[RealtimeWhiteboardChannel] Failed to export whiteboard frame:', err);\n return null;\n }\n }\n\n /**\n * The shared frame bridge, which now lives on the base channel (`VisualVideoBridge`). This accessor\n * keeps the board's long-standing `videoBridge` handle — tests and tooling reach the bridge by that\n * name — pointing at the one the pump actually writes to.\n */\n private get videoBridge(): ChannelInboundVideoBridge | null {\n return this.VisualVideoBridge;\n }\n private set videoBridge(bridge: ChannelInboundVideoBridge | null) {\n this.VisualVideoBridge = bridge;\n }\n\n // The change-driven frame pump (leading edge, trailing settle, dedupe, negotiated cadence, one\n // confirmation frame after an agent edit) used to live here. It is now the base channel's\n // `EnableVisualPerception` pump, enabled from OnInitialize — this channel only says WHEN its picture\n // changed. The behavior is unchanged, including (deliberately) the shared bridge's fixed-rate poller:\n // see `StartBridgePoller` in OnInitialize.\n\n public get ToolNamePrefix(): string {\n return WHITEBOARD_TOOL_PREFIX;\n }\n\n public get TabTitle(): string {\n return 'Whiteboard';\n }\n\n public get TabIcon(): string {\n return 'fa-solid fa-chalkboard';\n }\n\n /** The board can be shared on its own: the call's Share menu offers it under \"This panel\" while it is on screen. */\n public override get SurfaceShareable(): boolean {\n return true;\n }\n\n /**\n * The board's tools. The widget tools are declared only as far as {@link MaxWidgetAccess}\n * allows (`'inspect-only'` declares Inspect only, `'off'` none). Read before the channel is\n * initialized, so it depends on the class alone, never on the session's config.\n */\n public GetToolDefinitions(): RealtimeToolDefinition[] {\n const max = this.MaxWidgetAccess;\n if (max === 'full') {\n return WHITEBOARD_TOOL_DEFINITIONS;\n }\n return WHITEBOARD_TOOL_DEFINITIONS.filter(tool => !IsWhiteboardWidgetToolName(tool.Name) || IsWhiteboardWidgetToolAllowed(max, tool.Name));\n }\n\n // ────────────────────────────────────────────── widget access policy (extension points)\n\n /**\n * The most widget access this channel class ever offers — which widget tools it DECLARES to the\n * model (tools are collected before the channel is initialized, so this cannot depend on the\n * session). Default `'full'`. A host app lowers it by subclassing the channel and registering the\n * subclass under `'RealtimeWhiteboardChannel'` (or via `HostChannels[].Create`).\n */\n protected get MaxWidgetAccess(): WhiteboardWidgetAccess {\n return 'full';\n }\n\n /**\n * The widget access in force for ONE call, evaluated per call (so it may change mid-session,\n * e.g. `'off'` while an assessment is open). Default: the lower of {@link MaxWidgetAccess} and\n * the session's `widgetAccess` config. A call it does not allow returns `access_denied`.\n */\n protected ResolveWidgetAccess(): WhiteboardWidgetAccess {\n return MinWhiteboardWidgetAccess(this.MaxWidgetAccess, this.config.WidgetAccess);\n }\n\n /**\n * Last-moment veto of one widget command that access already allows: return the refusal text the\n * model should see (the call returns `vetoed` with it) or `null` to let it through. Default allows all.\n */\n protected OnBeforeWidgetCommand(_command: WhiteboardChannelWidgetCommand): string | null {\n return null;\n }\n\n /** Whether widget runtime state rides in this session's saves (config `persistWidgetState`). */\n public get PersistWidgetState(): boolean {\n return this.config.PersistWidgetState;\n }\n\n public override GetSurfaceComponent(): Type<RealtimeWhiteboardHostComponent> {\n return RealtimeWhiteboardHostComponent;\n }\n\n /** First-run intro shown the first time the user opens the Whiteboard tab (once per user). */\n public override GetOnboardingDetails(): ChannelOnboardingDetails {\n return {\n Heading: 'Whiteboard',\n Description:\n 'A shared canvas the agent can sketch, write and annotate on live during the call — ' +\n 'whatever it draws appears here instantly, and anything you add is something it can see too.',\n Tips: [\n 'Watch the board fill in as you talk — the agent updates it in real time.',\n 'Add your own notes or shapes; the agent perceives your edits and can build on them.',\n 'Use Focus to give the board the whole screen, and save it to artifacts to keep it.'\n ],\n IconClass: 'fa-solid fa-chalkboard'\n };\n }\n\n /**\n * The board's self-description: what it holds, every `Whiteboard_*` tool as a verb (so a tool a\n * subclass adds shows up here too), and that the model can SEE it (frames), not just read its state.\n */\n public override GetDescriptor(): RealtimeChannelDescriptor {\n return {\n Key: this.ChannelName,\n Version: REALTIME_CHANNEL_CONTRACT_VERSION,\n DisplayName: this.TabTitle,\n OwningPackage: '@memberjunction/ng-conversations',\n Instructions:\n 'A shared canvas you and the user can both draw, write and annotate on live. Whatever you add ' +\n 'appears instantly, and you perceive what the user adds. Use it to sketch, diagram and explain ' +\n 'visually; do not narrate minor edits.',\n Nouns: [\n {\n Name: 'pages',\n Description: 'The board\\'s pages, in order; each holds the items (notes, shapes, connectors, text, widgets) drawn on it.',\n Schema: { type: 'array', items: { type: 'object' } }\n }\n ],\n // Each widget tool returns the widget's contents, so the runtime refuses it below 'state' exposure.\n Verbs: BuildToolBackedVerbs(this.GetToolDefinitions(), this.ToolNamePrefix, 'agent', WIDGET_TOOLS_RETURN_STATE),\n Events: [\n { Name: 'state_changed', Description: 'The board changed (by you or the user).' },\n { Name: 'frame_pushed', Description: 'A picture of the board was sent to you.' }\n ],\n DisplayPolicy: 'open-on-start',\n DefaultAvailability: 'all-sessions',\n MaxExposure: 'pixels'\n };\n }\n\n /**\n * Persist the board (host-debounced) on EVERY board mutation — user edits AND agent tools — and drive\n * the visual pump. The board feeds the model its own perception (coalesced scene deltas from the\n * bound surface), so state changes are recorded for events and frame tagging only (`Perceive: false`):\n * the structured note would duplicate the deltas.\n */\n protected override OnInitialize(): void {\n this.applyChannelConfig();\n this.stateChangedSub?.unsubscribe();\n this.EnableVisualPerception(this, {\n ConfirmationNote:\n '[whiteboard] visual confirmation of your action (background — do NOT narrate or announce your own change; continue naturally)',\n // Preserves what the board always did: it started the bridge's fixed-rate poller despite being\n // designed heartbeat-free. Flagged for the reviewer; remove to make the board purely change-driven.\n StartBridgePoller: true\n });\n this.stateChangedSub = this.State.Changed$.subscribe((change) => {\n if (!this.restoring) {\n this.Context?.RequestSave(this.BuildSavePayload());\n }\n this.RecordChange({ Author: change.Author, Perceive: false });\n // Only user edits (and scene replacements like undo) drive the settle-debounce pipeline.\n // Agent edits are confirmed with a single frame in ApplyAgentTool.\n if (change.Author === 'user' || change.Op === 'replace') {\n void this.NotifyVisualChange();\n }\n });\n // Widget state is runtime data (no Changed$): save it on its own, throttled cadence.\n this.widgetStateSub?.unsubscribe();\n this.widgetStateSub = this.State.WidgetStateChanged$.subscribe(() => this.scheduleWidgetStateSave());\n }\n\n /** Parses `ChannelConfig`; an invalid member falls back to its default with a console warning. */\n private applyChannelConfig(): void {\n const parsed = ParseWhiteboardChannelConfig(this.Context?.ChannelConfig);\n this.config = parsed.Config;\n for (const problem of parsed.Problems) {\n console.warn(`[RealtimeWhiteboardChannel] channel config: ${problem}`);\n }\n }\n\n /**\n * Tells the model, once the session is live, which widget tools this session's access leaves\n * unavailable (notes sent before the session is live are dropped, so not from OnInitialize).\n */\n public override OnSessionStarted(): void {\n super.OnSessionStarted();\n const limit = this.describeWidgetAccessLimit(this.ResolveWidgetAccess());\n if (limit) {\n this.Context?.SendContextNote(`[whiteboard] ${limit}`);\n }\n }\n\n /** One sentence naming the widget tools `access` leaves unavailable, or null at full access. */\n private describeWidgetAccessLimit(access: WhiteboardWidgetAccess): string | null {\n if (access === 'full') {\n return null;\n }\n const unavailable = WHITEBOARD_WIDGET_TOOL_NAMES.filter(name => !IsWhiteboardWidgetToolAllowed(access, name));\n const reason = access === 'off'\n ? 'widget tools are turned off for this session'\n : `widgets are inspect-only for this session — read them with ${WHITEBOARD_TOOL_NAMES.InspectWidget}, but do not try to change them`;\n return `${unavailable.join(', ')} ${unavailable.length === 1 ? 'is' : 'are'} unavailable: ${reason}.`;\n }\n\n /**\n * The session save payload: the board's own JSON plus, when `persistWidgetState` is on and any\n * widget holds state, a sibling `widgetStates` key. Old readers ignore the unknown key; LiveKit\n * sync and Save-to-artifact keep plain {@link WhiteboardState.ToJSON}.\n */\n protected BuildSavePayload(): string {\n const boardJson = this.State.ToJSON();\n if (!this.config.PersistWidgetState) {\n return boardJson;\n }\n const widgetStates = this.State.WidgetStatesToJSON();\n if (Object.keys(widgetStates).length === 0) {\n return boardJson;\n }\n const payload = parseToolArgs(boardJson) ?? {};\n payload[WHITEBOARD_WIDGET_STATES_SAVE_KEY] = widgetStates;\n return JSON.stringify(payload);\n }\n\n /**\n * Requests a save for a widget-state change at most once per\n * {@link WHITEBOARD_WIDGET_STATE_SAVE_THROTTLE_MS} (leading edge, then one trailing request with\n * the latest state). Nothing is requested when `persistWidgetState` is off.\n */\n private scheduleWidgetStateSave(): void {\n if (this.restoring || !this.config.PersistWidgetState || this.widgetStateSaveTimer !== null) {\n return;\n }\n const wait = this.lastWidgetStateSaveAt + WHITEBOARD_WIDGET_STATE_SAVE_THROTTLE_MS - Date.now();\n if (wait <= 0) {\n this.requestWidgetStateSave();\n return;\n }\n this.widgetStateSaveTimer = setTimeout(() => {\n this.widgetStateSaveTimer = null;\n this.requestWidgetStateSave();\n }, wait);\n }\n\n private requestWidgetStateSave(): void {\n this.lastWidgetStateSaveAt = Date.now();\n this.Context?.RequestSave(this.BuildSavePayload());\n }\n\n /**\n * Wires the dynamically-created board host: inputs (shared state engine + agent name)\n * are set BEFORE the component's first change detection, and the perception/garnish\n * outputs are subscribed back into the host context — the overlay never sees any of it.\n */\n public BindSurface(instance: RealtimeWhiteboardHostComponent): void {\n this.EnsureVideoBridge();\n this.releaseSurface();\n this.host = instance;\n instance.State = this.State;\n instance.AgentName = this.Context?.AgentName ?? 'Agent';\n instance.AgentWidgetAccess = this.ResolveWidgetAccess();\n this.surfaceSubs.push(\n // The board's coalesced scene delta — the perception feed the agent \"sees\".\n instance.SceneDelta.subscribe((deltaJson: string) => {\n // Background PERCEPTION, not conversation: the model sees every user edit without\n // being told, but must not narrate minor changes — only react when something is\n // significant (or when asked). The etiquette rides in the note itself so any\n // realtime model gets it regardless of system-prompt sync state.\n this.Context?.SendContextNote(\n '[whiteboard] board update (background context — do NOT comment on minor edits; ' +\n 'only mention it if the change is significant to the discussion): ' + deltaJson);\n }),\n // The user clicked Undo on the agent-action toast (the undo already applied locally).\n instance.AgentUndo.subscribe(() => {\n this.Context?.SendContextNote('[whiteboard] user undid your last change');\n }),\n // A sandboxed HTML widget submitted user input (MJWhiteboard.submit) — already\n // validated, size-capped and not canceled (the host's cancelable WidgetSubmitting\n // event ran first). Surface it to the agent so it can react to quiz answers /\n // micro-form input it asked for.\n instance.WidgetSubmitted.subscribe((submit: WhiteboardWidgetSubmitEvent) => {\n // The agent's own operate command submitted it: the tool result already carries\n // `submitted`, so no note and no spoken reaction (it would answer itself).\n if (isAgentAuthored(submit)) {\n return;\n }\n // Durable awareness first (the note persists in the model's context)…\n this.Context?.SendContextNote(\n `[whiteboard] the user submitted input in widget \"${submit.Title || submit.ItemID}\": ${submit.DataJson}`);\n // …then make the model REACT — a submission is explicit user input the user is\n // waiting on; without this trigger, SendContextNote alone produces dead silence\n // (\"I clicked Submit and nothing happened\").\n this.Context?.RequestSpokenResponse?.(\n `The user just submitted input in the whiteboard widget \"${submit.Title || submit.ItemID}\": ${submit.DataJson}. ` +\n `React to it now in your own voice — acknowledge their choice and continue naturally.`);\n }),\n // AMBIENT widget telemetry (the injected recorder, NOT widget-authored script):\n // clicks / changes / typing summarized by the board. Pure background perception —\n // throttled per widget so chatty widgets don't flood the model's context, and framed\n // with do-not-respond etiquette (explicit MJWhiteboard.submit input arrives above).\n instance.WidgetInteraction.subscribe((interaction: WhiteboardWidgetInteractionEvent) => {\n this.onWidgetInteraction(interaction);\n }),\n // A widget registered or changed its named actions — a throttled perception note.\n instance.WidgetActionsChanged.subscribe((actions: WhiteboardWidgetActionsChangedEventArgs) => {\n this.actionsNoteThrottles.Push(actions.ItemID, actions);\n }),\n // The board's Focus toggle — ask the shell to collapse/restore the main call column.\n instance.FocusModeChange.subscribe((focused: boolean) => {\n this.Context?.SetFocusMode(focused);\n }),\n // \"Save to artifacts\": snapshot the board as a first-class versioned artifact.\n instance.SaveToArtifactsRequested.subscribe(() => {\n void this.saveBoardAsArtifact();\n })\n );\n }\n\n public override UnbindSurface(): void {\n this.releaseSurface();\n }\n\n /**\n * Routes one ambient widget-interaction batch to the agent as a throttled background\n * context note: outside an open window the note goes out immediately and opens a\n * {@link WHITEBOARD_INTERACTION_NOTE_THROTTLE_MS} window; within the window the LATEST\n * event is stashed and a trailing-edge timer sends it when the window closes (one note\n * per widget per window, latest summary wins). The agent's own interactions (its operate\n * steps) are not echoed back to it.\n */\n private onWidgetInteraction(interaction: WhiteboardWidgetInteractionEvent): void {\n if (isAgentAuthored(interaction)) {\n return;\n }\n this.interactionThrottles.Push(interaction.ItemID, interaction);\n }\n\n /** The ambient-note framing: background etiquette rides in the note itself (like scene deltas). */\n private sendInteractionNote(interaction: WhiteboardWidgetInteractionEvent): void {\n this.Context?.SendContextNote(\n `[whiteboard] ambient activity in widget \"${interaction.Title || interaction.ItemID}\" ` +\n '(background — do NOT respond unless it is significant or you are asked; ' +\n `explicit submissions arrive separately): ${interaction.Summary}`);\n }\n\n /**\n * \"[whiteboard] widget … offers actions: …\" — sent only when the channel's exposure lets the\n * model see board contents (`'state'` or above) and this session may call widget actions,\n * and only when the list (names + descriptions) differs from the last note sent for that\n * widget: a remount, a `hello` answer or the agent's own inspect re-reports the same list.\n */\n private sendActionsNote(event: WhiteboardWidgetActionsChangedEventArgs): void {\n if (event.Actions.length === 0 || CompareExposure(this.Exposure, 'state') < 0) {\n return;\n }\n if (!IsWhiteboardWidgetToolAllowed(this.ResolveWidgetAccess(), WHITEBOARD_TOOL_NAMES.CallWidget)) {\n return;\n }\n const lastSent = this.lastActionsNoted.get(event.ItemID);\n if (lastSent && SameWhiteboardWidgetActions(lastSent, event.Actions)) {\n return;\n }\n this.lastActionsNoted.set(event.ItemID, event.Actions.map(action => ({ ...action })));\n const names = event.Actions.map(action => action.Name).join(', ');\n this.Context?.SendContextNote(`[whiteboard] widget \"${event.Title || event.ItemID}\" (${event.ItemID}) offers actions: ${names}`);\n }\n\n /** Cancels all pending ambient / actions note timers and resets the per-widget throttle windows. */\n private clearInteractionThrottles(): void {\n this.interactionThrottles.Clear();\n this.actionsNoteThrottles.Clear();\n }\n\n /**\n * Persists the current board as a `MJ: Artifacts` snapshot via the host context\n * (best-effort; the host logs failures). On success the agent is told via a context\n * note so it can reference the saved artifact naturally.\n */\n private async saveBoardAsArtifact(): Promise<void> {\n const ctx = this.Context;\n if (!ctx) {\n return;\n }\n const now = new Date();\n const name = `Whiteboard — ${now.toLocaleDateString()} ${now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`;\n const artifactId = await ctx.SaveAsArtifact(name, this.State.ToJSON());\n if (artifactId) {\n ctx.SendContextNote(`[whiteboard] the user saved the current board as the artifact \"${name}\"`);\n }\n }\n\n /**\n * Executes one `Whiteboard_*` tool call LOCALLY. Board tools prefer the live bound host\n * (board mutation + UI garnish) and fall back to the pure engine function when no surface\n * is bound, so the channel keeps working before the board is first shown. Widget tools\n * (inspect / operate / call) need the live board and resolve asynchronously; see\n * {@link applyWidgetTool}.\n *\n * Return contract: **board tools return a plain `string` synchronously** (bound or not);\n * **the three widget tools** ({@link IsWhiteboardWidgetToolName}) **return a\n * `Promise<string>`** (policy refusals may also come back as a plain string). The declared\n * type is therefore `string | Promise<string>`. An override that post-processes results\n * should route `IsWhiteboardWidgetToolName(toolName)` calls straight to `super` and, for the\n * rest, narrow the board result with `typeof result === 'string'`.\n */\n public ApplyAgentTool(toolName: string, argsJson: string): string | Promise<string> {\n if (IsWhiteboardWidgetToolName(toolName)) {\n return this.applyWidgetTool(toolName, argsJson);\n }\n let result: string;\n if (this.host) {\n result = this.host.ApplyAgentTool(toolName, argsJson);\n } else {\n result = ApplyWhiteboardAgentTool(this.State, toolName, argsJson);\n }\n // A SUCCESSFUL agent tool triggers exactly ONE immediate visual confirmation frame and a note\n // telling the model not to narrate its own change. A FAILED one must trigger neither: every\n // failure path returns `{ success: false, error }` (bad JSON args, unknown tool, per-tool\n // validation), and confirming it would tell the model its edit landed AND instruct it to stay\n // quiet about it — so the failure would vanish from the user's view while the model carried on.\n // It would also push a frame identical to the last one, since a failed tool changes nothing.\n if (toolSucceeded(result)) {\n void this.ConfirmVisualChange();\n }\n return result;\n }\n\n /**\n * One widget command: access policy (`access_denied`, with the reason), then the\n * {@link OnBeforeWidgetCommand} veto (`vetoed`), then the live board (`surface_unavailable`\n * when none is bound). No confirmation frame: a widget's picture is a placeholder in frames.\n */\n private applyWidgetTool(toolName: WhiteboardWidgetToolName, argsJson: string): string | Promise<string> {\n const access = this.ResolveWidgetAccess();\n if (!IsWhiteboardWidgetToolAllowed(access, toolName)) {\n return widgetToolFailure('access_denied', this.describeWidgetAccessLimit(access) ?? `${toolName} is not available.`);\n }\n const args = parseToolArgs(argsJson);\n const itemId = args && typeof args['itemId'] === 'string' ? args['itemId'] : null;\n const refusal = this.OnBeforeWidgetCommand({ ToolName: toolName, ItemID: itemId, Args: args, ArgsJson: argsJson, Access: access });\n if (refusal !== null) {\n return widgetToolFailure('vetoed', refusal);\n }\n const host = this.host;\n if (!host) {\n return widgetToolFailure('surface_unavailable',\n 'The whiteboard isn\\'t open, so its widgets can\\'t be reached; ask the user to open the Whiteboard panel, then try again.');\n }\n host.AgentWidgetAccess = access; // per-call policy may have changed since BindSurface\n return host.ApplyAgentToolAsync(toolName, argsJson).catch((error: Error) =>\n widgetToolFailure('surface_unavailable', `The whiteboard could not run ${toolName}: ${error?.message ?? String(error)}`));\n }\n\n /**\n * The board's serialized state of record — the board JSON only. It also backs the channel's\n * `GetState()` snapshot, so widget states (learner answers) stay out of it; they ride only in\n * the session save payload ({@link BuildSavePayload}).\n */\n public override SerializeState(): string | null {\n return this.State.ToJSON();\n }\n\n /**\n * Rehydrates a prior session's saved board into THIS session's state engine (in place —\n * the {@link State} instance and its subscriptions are preserved). Returns `true` on\n * success; malformed / incompatible JSON returns `false` and the board stays fresh\n * (never throws — {@link WhiteboardState.LoadFromJSON} is tolerant by contract).\n *\n * Saves: none are requested while the board and its widget states are being loaded (so no\n * save can pair the restored board with stale in-memory widget states); after a successful\n * restore, exactly one save is requested carrying both. A failed restore requests nothing.\n */\n public override RestoreState(stateJson: string): boolean {\n // A trailing widget-state save armed before the restore would fire after it as a second save.\n if (this.widgetStateSaveTimer !== null) {\n clearTimeout(this.widgetStateSaveTimer);\n this.widgetStateSaveTimer = null;\n }\n this.restoring = true;\n try {\n if (!this.State.LoadFromJSON(stateJson)) {\n return false;\n }\n // A legacy payload (no `widgetStates` key) simply restores no widget state. With\n // `persistWidgetState` off nothing is restored either: state lives in memory only.\n this.State.LoadWidgetStates(this.config.PersistWidgetState ? readSavedWidgetStates(stateJson) : {});\n }\n finally {\n this.restoring = false;\n }\n this.Context?.RequestSave(this.BuildSavePayload());\n return true;\n }\n\n /** Keeps the board's \"Move to stage\" / \"Back to tab\" button true to where the host placed it. */\n public override OnSurfacePlacementChange(placement: MediaPlacement): void {\n this.host?.SetOnStage(placement === 'stage');\n }\n\n /**\n * Exit focus mode THROUGH the bound host (its own Focus button state stays in sync; it\n * re-emits `FocusModeChange(false)` → `Context.SetFocusMode(false)`). When no surface is\n * bound the overlay's defensive flag clear covers it.\n */\n public override RequestFocusExit(): void {\n if (this.host?.FocusMode) {\n this.host.ToggleFocus();\n }\n }\n\n public override Dispose(): void {\n this.stateChangedSub?.unsubscribe();\n this.stateChangedSub = null;\n this.widgetStateSub?.unsubscribe();\n this.widgetStateSub = null;\n if (this.widgetStateSaveTimer !== null) {\n // Best effort: hand the latest widget state over before the context is released.\n clearTimeout(this.widgetStateSaveTimer);\n this.widgetStateSaveTimer = null;\n this.requestWidgetStateSave();\n }\n super.Dispose(); // releases the surface binding, the visual pump + bridge, and the context\n }\n\n /** Unsubscribes surface outputs, cancels pending ambient notes and drops the host reference. */\n private releaseSurface(): void {\n for (const sub of this.surfaceSubs) {\n sub.unsubscribe();\n }\n this.surfaceSubs = [];\n this.clearInteractionThrottles();\n this.host = null;\n }\n}\n\n/**\n * Tree-shaking prevention: the whiteboard channel is resolved dynamically through the\n * ClassFactory (by the registry row's `ClientPluginClass` key), so this static call is\n * what keeps its `@RegisterClass` side effect from being eliminated by the bundler.\n * Called by `RealtimeSessionService` alongside the realtime-client driver Load calls.\n */\nexport function LoadRealtimeWhiteboardChannel(): void {\n // intentional no-op — the import side effect performs the registration\n}\n\n/** @deprecated Use {@link RasterizeSvgToJpegBase64}. */\nexport async function rasterizeSvgToJpegBase64(svg: string, width = 1280, height = 720): Promise<string | null> {\n return RasterizeSvgToJpegBase64(svg, width, height);\n}\n"]}
|
|
@@ -97,6 +97,16 @@ export declare class SearchPanelComponent implements OnInit, OnDestroy {
|
|
|
97
97
|
/** Message for the "no results" empty state, echoing the search term. */
|
|
98
98
|
get NoResultsMessage(): string;
|
|
99
99
|
private destroy$;
|
|
100
|
+
/** Wait after the last key press before a typed query runs a search. */
|
|
101
|
+
static readonly SearchDebounceMs = 250;
|
|
102
|
+
/** Typed queries, debounced into searches; see {@link OnSearchInput}. */
|
|
103
|
+
private typedQuery$;
|
|
104
|
+
/**
|
|
105
|
+
* The query the last search ran for, or '' after a clear. A debounced query equal to it is
|
|
106
|
+
* skipped (typing "ab" then back to "a" inside the wait), while a query searched again after
|
|
107
|
+
* a clear, a recent-search pick or a filter change still runs.
|
|
108
|
+
*/
|
|
109
|
+
private lastSearchedQuery;
|
|
100
110
|
/** True only while ngOnInit subscribes — see applyState(). */
|
|
101
111
|
private initializing;
|
|
102
112
|
constructor(searchService: SearchService, cdr: ChangeDetectorRef);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-panel.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/search/search-panel.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EACN,SAAS,EAET,YAAY,EAIZ,UAAU,EACV,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACL,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACV,MAAM,+BAA+B,CAAC;;AAEvC;;;;GAIG;AACH,qBAMa,oBAAqB,YAAW,MAAM,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"search-panel.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/search/search-panel.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EACN,SAAS,EAET,YAAY,EAIZ,UAAU,EACV,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACL,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACV,MAAM,+BAA+B,CAAC;;AAEvC;;;;GAIG;AACH,qBAMa,oBAAqB,YAAW,MAAM,EAAE,SAAS;IAiM1D,OAAO,CAAC,aAAa;IACrB,OAAO,C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EG;IACI,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiB1C,6CAA6C;IACtC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI1C;;OAEG;IACI,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;IAmBlD,6CAA6C;IACtC,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;IAIlD;;OAEG;IACI,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAarC,0FAA0F;IACnF,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAI1D,8CAA8C;IACvC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAI1D;;OAEG;IACI,iBAAiB,IAAI,IAAI;IAOhC,iDAAiD;IAC1C,iBAAiB,IAAI,IAAI;IAIhC;;OAEG;IACI,cAAc,IAAI,IAAI;IAQ7B,8CAA8C;IACvC,cAAc,IAAI,IAAI;yCAhlBlB,oBAAoB;2CAApB,oBAAoB;CAmlBhC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, Output, EventEmitter, Input, HostListener, ViewChild } from '@angular/core';
|
|
2
2
|
import { Subject } from 'rxjs';
|
|
3
|
-
import { takeUntil } from 'rxjs/operators';
|
|
3
|
+
import { debounceTime, takeUntil } from 'rxjs/operators';
|
|
4
4
|
import { HighlightSearchMatches } from '@memberjunction/global';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
import * as i1 from "../../services/search.service";
|
|
@@ -672,6 +672,16 @@ export class SearchPanelComponent {
|
|
|
672
672
|
return `No results found for "${this.SearchQuery}"`;
|
|
673
673
|
}
|
|
674
674
|
destroy$ = new Subject();
|
|
675
|
+
/** Wait after the last key press before a typed query runs a search. */
|
|
676
|
+
static SearchDebounceMs = 250;
|
|
677
|
+
/** Typed queries, debounced into searches; see {@link OnSearchInput}. */
|
|
678
|
+
typedQuery$ = new Subject();
|
|
679
|
+
/**
|
|
680
|
+
* The query the last search ran for, or '' after a clear. A debounced query equal to it is
|
|
681
|
+
* skipped (typing "ab" then back to "a" inside the wait), while a query searched again after
|
|
682
|
+
* a clear, a recent-search pick or a filter change still runs.
|
|
683
|
+
*/
|
|
684
|
+
lastSearchedQuery = '';
|
|
675
685
|
/** True only while ngOnInit subscribes — see applyState(). */
|
|
676
686
|
initializing = false;
|
|
677
687
|
constructor(searchService, cdr) {
|
|
@@ -703,6 +713,14 @@ export class SearchPanelComponent {
|
|
|
703
713
|
this.subscribeToSearchState();
|
|
704
714
|
this.initializing = false;
|
|
705
715
|
this.loadRecentSearches();
|
|
716
|
+
this.typedQuery$
|
|
717
|
+
.pipe(debounceTime(SearchPanelComponent.SearchDebounceMs), takeUntil(this.destroy$))
|
|
718
|
+
.subscribe(query => {
|
|
719
|
+
// Only the box's current text searches; an emptied box was cleared already.
|
|
720
|
+
if (query.trim() && query === this.SearchQuery && query !== this.lastSearchedQuery) {
|
|
721
|
+
this.performSearch();
|
|
722
|
+
}
|
|
723
|
+
});
|
|
706
724
|
}
|
|
707
725
|
ngOnDestroy() {
|
|
708
726
|
this.destroy$.next();
|
|
@@ -760,9 +778,11 @@ export class SearchPanelComponent {
|
|
|
760
778
|
*/
|
|
761
779
|
OnSearchInput() {
|
|
762
780
|
if (this.SearchQuery.trim()) {
|
|
763
|
-
|
|
781
|
+
// Debounced: a search per key press would run five sub-searches each time.
|
|
782
|
+
this.typedQuery$.next(this.SearchQuery);
|
|
764
783
|
}
|
|
765
784
|
else {
|
|
785
|
+
this.lastSearchedQuery = '';
|
|
766
786
|
this.searchService.clearResults();
|
|
767
787
|
}
|
|
768
788
|
}
|
|
@@ -774,6 +794,7 @@ export class SearchPanelComponent {
|
|
|
774
794
|
* Perform search
|
|
775
795
|
*/
|
|
776
796
|
async performSearch() {
|
|
797
|
+
this.lastSearchedQuery = this.SearchQuery;
|
|
777
798
|
await this.searchService.search(this.SearchQuery, this.EnvironmentId, this.CurrentUser);
|
|
778
799
|
}
|
|
779
800
|
/**
|
|
@@ -794,6 +815,7 @@ export class SearchPanelComponent {
|
|
|
794
815
|
*/
|
|
795
816
|
ClearSearch() {
|
|
796
817
|
this.SearchQuery = '';
|
|
818
|
+
this.lastSearchedQuery = '';
|
|
797
819
|
this.searchService.clearResults();
|
|
798
820
|
this.focusSearchInput();
|
|
799
821
|
}
|
|
@@ -860,7 +882,7 @@ export class SearchPanelComponent {
|
|
|
860
882
|
const seed = this.InitialQuery?.trim();
|
|
861
883
|
if (seed && seed !== this.SearchQuery) {
|
|
862
884
|
this.SearchQuery = seed;
|
|
863
|
-
this.
|
|
885
|
+
this.performSearch();
|
|
864
886
|
this.cdr.detectChanges();
|
|
865
887
|
}
|
|
866
888
|
this.SearchInput?.nativeElement.focus();
|