@memberjunction/ng-conversations 6.3.0-edge.0 → 6.3.0-edge.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -22
- package/dist/assets/edge-ai.worker.js +35168 -0
- package/dist/lib/components/agent/agent-instance-editor-modal.component.d.ts +186 -0
- package/dist/lib/components/agent/agent-instance-editor-modal.component.d.ts.map +1 -0
- package/dist/lib/components/agent/agent-instance-editor-modal.component.js +2202 -0
- package/dist/lib/components/agent/agent-instance-editor-modal.component.js.map +1 -0
- package/dist/lib/components/artifact/artifact-share-modal.component.d.ts +39 -6
- package/dist/lib/components/artifact/artifact-share-modal.component.d.ts.map +1 -1
- package/dist/lib/components/artifact/artifact-share-modal.component.js +773 -204
- package/dist/lib/components/artifact/artifact-share-modal.component.js.map +1 -1
- package/dist/lib/components/collection/collection-tree.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-tree.component.js +19 -18
- package/dist/lib/components/collection/collection-tree.component.js.map +1 -1
- package/dist/lib/components/collection/collection-view.component.d.ts +6 -4
- package/dist/lib/components/collection/collection-view.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collection-view.component.js +35 -17
- package/dist/lib/components/collection/collection-view.component.js.map +1 -1
- package/dist/lib/components/collection/collections-full-view.component.d.ts +1 -0
- package/dist/lib/components/collection/collections-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/collection/collections-full-view.component.js +108 -106
- package/dist/lib/components/collection/collections-full-view.component.js.map +1 -1
- package/dist/lib/components/composer/ai-composer.component.d.ts +15 -1
- package/dist/lib/components/composer/ai-composer.component.d.ts.map +1 -1
- package/dist/lib/components/composer/ai-composer.component.js +43 -4
- package/dist/lib/components/composer/ai-composer.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts +20 -2
- package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-agent-picker.component.js +378 -62
- package/dist/lib/components/conversation/conversation-agent-picker.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +94 -18
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +732 -439
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts +19 -1
- package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-list.component.js +184 -89
- package/dist/lib/components/conversation/conversation-list.component.js.map +1 -1
- package/dist/lib/components/export/export-modal.component.d.ts +7 -2
- package/dist/lib/components/export/export-modal.component.d.ts.map +1 -1
- package/dist/lib/components/export/export-modal.component.js +13 -2
- package/dist/lib/components/export/export-modal.component.js.map +1 -1
- package/dist/lib/components/library/library-create-dialog.component.d.ts +136 -0
- package/dist/lib/components/library/library-create-dialog.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-create-dialog.component.js +1620 -0
- package/dist/lib/components/library/library-create-dialog.component.js.map +1 -0
- package/dist/lib/components/library/library-full-view.component.d.ts +10 -4
- package/dist/lib/components/library/library-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/library/library-full-view.component.js +216 -40
- package/dist/lib/components/library/library-full-view.component.js.map +1 -1
- package/dist/lib/components/library/library-remote-drive-pane.component.d.ts +97 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.js +1229 -0
- package/dist/lib/components/library/library-remote-drive-pane.component.js.map +1 -0
- package/dist/lib/components/library/library-workspace.component.d.ts +293 -0
- package/dist/lib/components/library/library-workspace.component.d.ts.map +1 -0
- package/dist/lib/components/library/library-workspace.component.js +5121 -0
- package/dist/lib/components/library/library-workspace.component.js.map +1 -0
- package/dist/lib/components/library/library.models.d.ts +192 -0
- package/dist/lib/components/library/library.models.d.ts.map +1 -0
- package/dist/lib/components/library/library.models.js +2 -0
- package/dist/lib/components/library/library.models.js.map +1 -0
- package/dist/lib/components/message/agent-handoff-card.component.js +1 -1
- package/dist/lib/components/message/agent-handoff-card.component.js.map +1 -1
- package/dist/lib/components/message/conversation-message-rating.component.d.ts +5 -0
- package/dist/lib/components/message/conversation-message-rating.component.d.ts.map +1 -1
- package/dist/lib/components/message/conversation-message-rating.component.js +72 -16
- package/dist/lib/components/message/conversation-message-rating.component.js.map +1 -1
- package/dist/lib/components/message/message-input.component.d.ts +33 -14
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input.component.js +142 -75
- package/dist/lib/components/message/message-input.component.js.map +1 -1
- package/dist/lib/components/message/message-item.component.d.ts +51 -4
- package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-item.component.js +640 -399
- package/dist/lib/components/message/message-item.component.js.map +1 -1
- package/dist/lib/components/message/message-list.component.d.ts +15 -1
- package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-list.component.js +75 -3
- package/dist/lib/components/message/message-list.component.js.map +1 -1
- package/dist/lib/components/navigation/conversation-navigation.component.js +9 -9
- package/dist/lib/components/navigation/conversation-navigation.component.js.map +1 -1
- package/dist/lib/components/overlay/chat-overlay.component.d.ts +94 -6
- package/dist/lib/components/overlay/chat-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/overlay/chat-overlay.component.js +249 -59
- package/dist/lib/components/overlay/chat-overlay.component.js.map +1 -1
- package/dist/lib/components/project/project-form-modal.component.d.ts +6 -0
- package/dist/lib/components/project/project-form-modal.component.d.ts.map +1 -1
- package/dist/lib/components/project/project-form-modal.component.js +81 -61
- package/dist/lib/components/project/project-form-modal.component.js.map +1 -1
- package/dist/lib/components/project/project-selector.component.d.ts +5 -0
- package/dist/lib/components/project/project-selector.component.d.ts.map +1 -1
- package/dist/lib/components/project/project-selector.component.js +11 -4
- package/dist/lib/components/project/project-selector.component.js.map +1 -1
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.d.ts +55 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js +974 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-channel.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.d.ts +66 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.js +253 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-engine.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.d.ts +80 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.js +49 -0
- package/dist/lib/components/realtime/artifact-workspace/artifact-workspace-types.js.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.d.ts +54 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.d.ts.map +1 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.js +386 -0
- package/dist/lib/components/realtime/artifact-workspace/realtime-artifact-workspace-surface.component.js.map +1 -0
- package/dist/lib/components/realtime/capture/realtime-capture-channel.d.ts +28 -1
- package/dist/lib/components/realtime/capture/realtime-capture-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/capture/realtime-capture-channel.js +53 -1
- package/dist/lib/components/realtime/capture/realtime-capture-channel.js.map +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.js +23 -7
- package/dist/lib/components/realtime/channels/client-context-channel.js.map +1 -1
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts +1 -0
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js +15 -2
- package/dist/lib/components/realtime/interactive-component/interactive-component-channel.js.map +1 -1
- package/dist/lib/components/realtime/media/media-channel.d.ts +32 -11
- package/dist/lib/components/realtime/media/media-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/media/media-channel.js +186 -23
- package/dist/lib/components/realtime/media/media-channel.js.map +1 -1
- package/dist/lib/components/realtime/media/realtime-media-surface.component.d.ts +9 -1
- package/dist/lib/components/realtime/media/realtime-media-surface.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/media/realtime-media-surface.component.js +33 -10
- package/dist/lib/components/realtime/media/realtime-media-surface.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.js +3 -3
- package/dist/lib/components/realtime/realtime-agent-banner.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-picker.component.js +3 -3
- package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-composer.component.js +6 -4
- package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +82 -33
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.js +521 -191
- package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-state.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-state.js +1 -1
- package/dist/lib/components/realtime/realtime-session-state.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.js +90 -5
- package/dist/lib/components/realtime/realtime-session-thread.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.js +2 -1
- package/dist/lib/components/realtime/realtime-surface-stage.model.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts +11 -4
- package/dist/lib/components/realtime/realtime-surface-tab-style.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tab-style.js +24 -5
- package/dist/lib/components/realtime/realtime-surface-tab-style.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +7 -9
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js +25 -15
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +30 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +150 -2
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts +101 -3
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js +503 -55
- package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts +48 -5
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js +249 -53
- package/dist/lib/components/realtime/whiteboard/whiteboard-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -1
- package/dist/lib/components/search/search-panel.component.d.ts +10 -0
- package/dist/lib/components/search/search-panel.component.d.ts.map +1 -1
- package/dist/lib/components/search/search-panel.component.js +25 -3
- package/dist/lib/components/search/search-panel.component.js.map +1 -1
- package/dist/lib/components/share/share-modal.component.d.ts.map +1 -1
- package/dist/lib/components/share/share-modal.component.js +181 -127
- package/dist/lib/components/share/share-modal.component.js.map +1 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts +14 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts.map +1 -1
- package/dist/lib/components/sidebar/conversation-sidebar.component.js +50 -11
- package/dist/lib/components/sidebar/conversation-sidebar.component.js.map +1 -1
- package/dist/lib/components/sidebar/my-agents-section.component.d.ts +78 -0
- package/dist/lib/components/sidebar/my-agents-section.component.d.ts.map +1 -0
- package/dist/lib/components/sidebar/my-agents-section.component.js +450 -0
- package/dist/lib/components/sidebar/my-agents-section.component.js.map +1 -0
- package/dist/lib/components/task/tasks-full-view.component.d.ts +31 -8
- package/dist/lib/components/task/tasks-full-view.component.d.ts.map +1 -1
- package/dist/lib/components/task/tasks-full-view.component.js +701 -497
- package/dist/lib/components/task/tasks-full-view.component.js.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
- package/dist/lib/components/workspace/conversation-workspace.component.js +15 -2
- package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
- package/dist/lib/composer-plugins/base-conversation-mention.provider.d.ts +1 -0
- package/dist/lib/composer-plugins/base-conversation-mention.provider.d.ts.map +1 -1
- package/dist/lib/composer-plugins/base-conversation-mention.provider.js +13 -1
- package/dist/lib/composer-plugins/base-conversation-mention.provider.js.map +1 -1
- package/dist/lib/conversations.module.d.ts +78 -71
- package/dist/lib/conversations.module.d.ts.map +1 -1
- package/dist/lib/conversations.module.js +68 -1
- package/dist/lib/conversations.module.js.map +1 -1
- package/dist/lib/models/agent-turn.model.d.ts +7 -1
- package/dist/lib/models/agent-turn.model.d.ts.map +1 -1
- package/dist/lib/models/agent-turn.model.js.map +1 -1
- package/dist/lib/services/agent-state.service.d.ts.map +1 -1
- package/dist/lib/services/agent-state.service.js +14 -3
- package/dist/lib/services/agent-state.service.js.map +1 -1
- package/dist/lib/services/artifact-permission.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-permission.service.js +14 -3
- package/dist/lib/services/artifact-permission.service.js.map +1 -1
- package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-state.service.js +43 -11
- package/dist/lib/services/artifact-state.service.js.map +1 -1
- package/dist/lib/services/conversation-agent.service.d.ts +31 -21
- package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-agent.service.js +84 -35
- package/dist/lib/services/conversation-agent.service.js.map +1 -1
- package/dist/lib/services/conversation-tasks-filter.d.ts +59 -2
- package/dist/lib/services/conversation-tasks-filter.d.ts.map +1 -1
- package/dist/lib/services/conversation-tasks-filter.js +222 -18
- package/dist/lib/services/conversation-tasks-filter.js.map +1 -1
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.d.ts +85 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.js +257 -0
- package/dist/lib/services/edge-ai/edge-agent-pre-discovery.service.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.d.ts +85 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.js +10 -0
- package/dist/lib/services/edge-ai/edge-ai-protocol.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.d.ts +90 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.js +386 -0
- package/dist/lib/services/edge-ai/edge-ai-worker-host.js.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.d.ts +13 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.d.ts.map +1 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.js +201 -0
- package/dist/lib/services/edge-ai/edge-ai.worker.js.map +1 -0
- package/dist/lib/services/export.service.d.ts +64 -0
- package/dist/lib/services/export.service.d.ts.map +1 -1
- package/dist/lib/services/export.service.js +185 -6
- package/dist/lib/services/export.service.js.map +1 -1
- package/dist/lib/services/library-creation.service.d.ts +304 -0
- package/dist/lib/services/library-creation.service.d.ts.map +1 -0
- package/dist/lib/services/library-creation.service.js +1244 -0
- package/dist/lib/services/library-creation.service.js.map +1 -0
- package/dist/lib/services/realtime-pairing.d.ts +3 -3
- package/dist/lib/services/realtime-pairing.js +4 -4
- package/dist/lib/services/realtime-pairing.js.map +1 -1
- package/dist/lib/services/realtime-session-review.service.d.ts +14 -0
- package/dist/lib/services/realtime-session-review.service.d.ts.map +1 -1
- package/dist/lib/services/realtime-session-review.service.js +46 -4
- package/dist/lib/services/realtime-session-review.service.js.map +1 -1
- package/dist/lib/services/realtime-session.service.d.ts.map +1 -1
- package/dist/lib/services/realtime-session.service.js +2 -1
- package/dist/lib/services/realtime-session.service.js.map +1 -1
- package/dist/lib/services/search.service.d.ts +19 -2
- package/dist/lib/services/search.service.d.ts.map +1 -1
- package/dist/lib/services/search.service.js +99 -36
- package/dist/lib/services/search.service.js.map +1 -1
- package/dist/lib/utils/agent-handoff-map.js +1 -1
- package/dist/lib/utils/agent-handoff-map.js.map +1 -1
- package/dist/lib/utils/agent-turn-routing.js +1 -1
- package/dist/lib/utils/agent-turn-routing.js.map +1 -1
- package/dist/lib/utils/decision-routing.d.ts +5 -2
- package/dist/lib/utils/decision-routing.d.ts.map +1 -1
- package/dist/lib/utils/decision-routing.js +9 -4
- package/dist/lib/utils/decision-routing.js.map +1 -1
- package/dist/public-api.d.ts +15 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +17 -1
- package/dist/public-api.js.map +1 -1
- package/package.json +42 -37
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-ai.worker.js","sourceRoot":"","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IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YACzD,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SAC5D,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAED,IAAI,cAAc,GAAG,KAAK,CAAC;AAE3B;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACjC,IAAI,cAAc,EAAE,CAAC;QACjB,OAAO;IACX,CAAC;IACD,cAAc,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,SAAS,GAAG,CAAC,KAAsC,EAAE,EAAE;QACxD,KAAK,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC,CAAC;AACN,CAAC;AAED,IAAI,OAAO,iBAAiB,KAAK,WAAW,IAAI,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,YAAY,iBAAiB,EAAE,CAAC;IAC/G,qBAAqB,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["/// <reference lib=\"webworker\" />\n/**\n * @fileoverview Dedicated lazy Web Worker running quantized (`q8`) ONNX inference in WASM\n * (`Xenova/bge-small-en-v1.5` bi-encoder + `Xenova/ms-marco-MiniLM-L-6-v2` cross-encoder).\n *\n * Loaded ONLY on demand via `new Worker(new URL('./edge-ai.worker.js', import.meta.url), { type: 'module' })`\n * so zero `@huggingface/transformers` or ONNX WASM code enters Explorer's initial bundle.\n */\n\nimport {\n EDGE_PRE_DISCOVERY_BI_ENCODER_MODEL,\n EDGE_PRE_DISCOVERY_CROSS_ENCODER_MODEL,\n} from '@memberjunction/ai-core-plus';\nimport type {\n EdgeWorkerDevice,\n EdgeWorkerDType,\n EdgeWorkerReply,\n EdgeWorkerRequest,\n} from './edge-ai-protocol';\n\n// Non-exported internal shapes for 3rd-party @huggingface/transformers module API\n// (kept unexported to satisfy MJ naming-conventions standard).\ninterface TensorOutput {\n data: Float32Array;\n dims: number[];\n}\n\ntype FeatureExtractorFn = (\n texts: string[],\n options: { pooling: 'mean'; normalize: boolean }\n) => Promise<TensorOutput>;\n\ntype TokenizerFn = (\n queries: string[],\n options: { text_pair: string[]; padding: boolean; truncation: boolean }\n) => Record<string, unknown>;\n\ntype SequenceClassifierFn = (\n inputs: Record<string, unknown>\n) => Promise<{ logits: TensorOutput }>;\n\ninterface TransformersEnv {\n allowLocalModels: boolean;\n allowRemoteModels: boolean;\n localModelPath?: string;\n backends?: {\n onnx?: {\n wasm?: {\n wasmPaths?: string;\n };\n };\n };\n}\n\ninterface TransformersModule {\n env: TransformersEnv;\n pipeline: (\n task: 'feature-extraction',\n model: string,\n options: { device: EdgeWorkerDevice; dtype: EdgeWorkerDType }\n ) => Promise<FeatureExtractorFn>;\n AutoTokenizer: {\n from_pretrained: (model: string) => Promise<TokenizerFn>;\n };\n AutoModelForSequenceClassification: {\n from_pretrained: (\n model: string,\n options: { device: EdgeWorkerDevice; dtype: EdgeWorkerDType }\n ) => Promise<SequenceClassifierFn>;\n };\n}\n\nlet transformersPromise: Promise<TransformersModule> | null = null;\nlet biEncoderPromise: Promise<FeatureExtractorFn> | null = null;\nlet biEncoderKey = '';\nlet crossEncoderPromise: Promise<{ Tokenizer: TokenizerFn; Model: SequenceClassifierFn }> | null = null;\nlet crossEncoderKey = '';\n\nfunction loadTransformers(): Promise<TransformersModule> {\n if (!transformersPromise) {\n // Dynamic import, category 3 (genuine bundle-size deferral, Rule 8) + category 2 (optionalDependency):\n // '@huggingface/transformers' and ONNX WASM runtime load strictly inside this lazy Web Worker\n // so Explorer's initial and app-module bundles incur 0 B overhead.\n transformersPromise = (import('@huggingface/transformers') as unknown as Promise<TransformersModule>).catch(\n (err: unknown) => {\n transformersPromise = null;\n throw err;\n }\n );\n }\n return transformersPromise;\n}\n\nasync function ensureBiEncoder(\n modelId: string,\n device: EdgeWorkerDevice,\n dtype: EdgeWorkerDType\n): Promise<FeatureExtractorFn> {\n const key = `${modelId}|${device}|${dtype}`;\n if (!biEncoderPromise || biEncoderKey !== key) {\n biEncoderKey = key;\n biEncoderPromise = (async () => {\n const tf = await loadTransformers();\n return tf.pipeline('feature-extraction', modelId, { device, dtype });\n })().catch((err: unknown) => {\n if (biEncoderKey === key) {\n biEncoderPromise = null;\n biEncoderKey = '';\n }\n throw err;\n });\n }\n return biEncoderPromise;\n}\n\nasync function ensureCrossEncoder(\n modelId: string,\n device: EdgeWorkerDevice,\n dtype: EdgeWorkerDType\n): Promise<{ Tokenizer: TokenizerFn; Model: SequenceClassifierFn }> {\n const key = `${modelId}|${device}|${dtype}`;\n if (!crossEncoderPromise || crossEncoderKey !== key) {\n crossEncoderKey = key;\n crossEncoderPromise = (async () => {\n const tf = await loadTransformers();\n const [tok, mod] = await Promise.all([\n tf.AutoTokenizer.from_pretrained(modelId),\n tf.AutoModelForSequenceClassification.from_pretrained(modelId, { device, dtype }),\n ]);\n return { Tokenizer: tok, Model: mod };\n })().catch((err: unknown) => {\n if (crossEncoderKey === key) {\n crossEncoderPromise = null;\n crossEncoderKey = '';\n }\n throw err;\n });\n }\n return crossEncoderPromise;\n}\n\nfunction postReply(reply: EdgeWorkerReply, transfer: Transferable[] = []): void {\n self.postMessage(reply, transfer);\n}\n\nasync function handleMessage(msg: EdgeWorkerRequest): Promise<void> {\n const t0 = performance.now();\n try {\n switch (msg.Type) {\n case 'init': {\n const tf = await loadTransformers();\n tf.env.allowLocalModels = Boolean(msg.LocalModelPath);\n tf.env.allowRemoteModels = msg.AllowRemoteModels ?? true;\n if (msg.LocalModelPath) {\n tf.env.localModelPath = msg.LocalModelPath;\n }\n if (msg.WasmPaths && tf.env.backends?.onnx?.wasm) {\n tf.env.backends.onnx.wasm.wasmPaths = msg.WasmPaths;\n }\n const device: EdgeWorkerDevice = msg.Device ?? 'wasm';\n const dtype: EdgeWorkerDType = msg.DType ?? 'q8';\n const biModel = msg.BiEncoderModelId ?? EDGE_PRE_DISCOVERY_BI_ENCODER_MODEL;\n await ensureBiEncoder(biModel, device, dtype);\n let crossLoaded = false;\n if (msg.LoadCrossEncoder) {\n const crossModel = msg.CrossEncoderModelId ?? EDGE_PRE_DISCOVERY_CROSS_ENCODER_MODEL;\n await ensureCrossEncoder(crossModel, device, dtype);\n crossLoaded = true;\n }\n postReply({\n Type: 'ready',\n RequestId: msg.RequestId,\n BiEncoderModelId: biModel,\n CrossEncoderLoaded: crossLoaded,\n LoadMs: performance.now() - t0,\n });\n break;\n }\n case 'embed': {\n if (msg.Texts.length === 0) {\n postReply({\n Type: 'embedded',\n RequestId: msg.RequestId,\n Vectors: [],\n Dimensions: 0,\n DurationMs: 0,\n });\n return;\n }\n const ext = await ensureBiEncoder(\n msg.ModelId ?? EDGE_PRE_DISCOVERY_BI_ENCODER_MODEL,\n msg.Device ?? 'wasm',\n msg.DType ?? 'q8'\n );\n const out = await ext(msg.Texts, { pooling: 'mean', normalize: true });\n const dims = out.dims[1] ?? Math.floor(out.data.length / msg.Texts.length);\n const buffers: ArrayBuffer[] = [];\n for (let i = 0; i < msg.Texts.length; i++) {\n const slice = out.data.slice(i * dims, (i + 1) * dims);\n const copy = new Float32Array(slice.length);\n copy.set(slice);\n buffers.push(copy.buffer);\n }\n postReply(\n {\n Type: 'embedded',\n RequestId: msg.RequestId,\n Vectors: buffers,\n Dimensions: dims,\n DurationMs: performance.now() - t0,\n },\n buffers\n );\n break;\n }\n case 'rerank': {\n if (msg.Documents.length === 0) {\n postReply({\n Type: 'reranked',\n RequestId: msg.RequestId,\n Logits: [],\n DurationMs: 0,\n });\n return;\n }\n const { Tokenizer, Model } = await ensureCrossEncoder(\n msg.ModelId ?? EDGE_PRE_DISCOVERY_CROSS_ENCODER_MODEL,\n msg.Device ?? 'wasm',\n msg.DType ?? 'q8'\n );\n const queries = new Array<string>(msg.Documents.length).fill(msg.Query);\n const inputs = Tokenizer(queries, {\n text_pair: msg.Documents,\n padding: true,\n truncation: true,\n });\n const out = await Model(inputs);\n const numLabels = out.logits.dims[1] ?? 1;\n const logits: number[] = [];\n for (let i = 0; i < msg.Documents.length; i++) {\n const idx = numLabels === 1 ? i : i * numLabels + (numLabels - 1);\n logits.push(Number(out.logits.data[idx] ?? Number.NEGATIVE_INFINITY));\n }\n postReply({\n Type: 'reranked',\n RequestId: msg.RequestId,\n Logits: logits,\n DurationMs: performance.now() - t0,\n });\n break;\n }\n case 'dispose': {\n biEncoderPromise = null;\n biEncoderKey = '';\n crossEncoderPromise = null;\n crossEncoderKey = '';\n postReply({\n Type: 'disposed',\n RequestId: msg.RequestId,\n });\n break;\n }\n }\n } catch (err: unknown) {\n postReply({\n Type: 'error',\n RequestId: 'RequestId' in msg ? msg.RequestId : undefined,\n Message: err instanceof Error ? err.message : String(err),\n });\n }\n}\n\nlet isBootstrapped = false;\n\n/**\n * Attaches the Edge AI message handler inside a Web Worker global scope.\n * Exported so host apps (e.g., MJExplorer) with `sideEffects: false` retain the worker bundle cleanly.\n */\nexport function BootstrapEdgeAIWorker(): void {\n if (isBootstrapped) {\n return;\n }\n isBootstrapped = true;\n self.onmessage = (event: MessageEvent<EdgeWorkerRequest>) => {\n void handleMessage(event.data);\n };\n}\n\nif (typeof WorkerGlobalScope !== 'undefined' && typeof self !== 'undefined' && self instanceof WorkerGlobalScope) {\n BootstrapEdgeAIWorker();\n}\n"]}
|
|
@@ -81,7 +81,45 @@ export interface ExportOptions {
|
|
|
81
81
|
themeMode?: 'light' | 'dark';
|
|
82
82
|
/** Branding (tokens / logo / title) applied to the export — see {@link ExportBranding}. */
|
|
83
83
|
branding?: ExportBranding;
|
|
84
|
+
/**
|
|
85
|
+
* Write the artifacts each message produced under that message: name, type, version, a link
|
|
86
|
+
* when {@link artifactLink} is set, and the stored content as text. File-backed versions
|
|
87
|
+
* (PDF, spreadsheets, images) carry their MIME type instead of content. Default true.
|
|
88
|
+
*/
|
|
89
|
+
includeArtifacts?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Builds a link that opens an exported artifact in the app. This package has no router, so
|
|
92
|
+
* the host supplies it; without it (or when it returns null) the export carries IDs only.
|
|
93
|
+
* Only `http(s)` links are written.
|
|
94
|
+
*/
|
|
95
|
+
artifactLink?: (target: ExportArtifactLinkTarget) => string | null;
|
|
84
96
|
}
|
|
97
|
+
/** What {@link ExportOptions.artifactLink} receives for each exported artifact. */
|
|
98
|
+
export interface ExportArtifactLinkTarget {
|
|
99
|
+
ConversationID: string;
|
|
100
|
+
ArtifactID: string;
|
|
101
|
+
VersionID: string;
|
|
102
|
+
VersionNumber: number;
|
|
103
|
+
}
|
|
104
|
+
/** One artifact version a message produced, as an export writes it. */
|
|
105
|
+
export interface ExportArtifact {
|
|
106
|
+
ArtifactID: string;
|
|
107
|
+
VersionID: string;
|
|
108
|
+
Name: string;
|
|
109
|
+
/** The artifact type's name (e.g. "Component", "Report"). */
|
|
110
|
+
Type: string;
|
|
111
|
+
VersionNumber: number;
|
|
112
|
+
/** Stored text content; null for a file-backed version. */
|
|
113
|
+
Content: string | null;
|
|
114
|
+
MimeType: string | null;
|
|
115
|
+
/** True when the version's content lives in a file rather than as text. */
|
|
116
|
+
FileBacked: boolean;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Longest artifact content the Markdown, HTML and text formats write; longer content is cut
|
|
120
|
+
* with a marker line. JSON carries content as stored.
|
|
121
|
+
*/
|
|
122
|
+
export declare const EXPORT_ARTIFACT_CONTENT_LIMIT = 20000;
|
|
85
123
|
/**
|
|
86
124
|
* Tokens captured by the theme auto-snapshot — exactly the custom properties the
|
|
87
125
|
* HTML export's stylesheet consumes. Hosts wanting more control supply their own
|
|
@@ -97,6 +135,11 @@ export interface ExportConversationData {
|
|
|
97
135
|
* in Main.
|
|
98
136
|
*/
|
|
99
137
|
fork?: string | null;
|
|
138
|
+
/**
|
|
139
|
+
* The output artifacts of each message, keyed by lower-cased message ID, in creation order.
|
|
140
|
+
* Absent or empty when the messages produced none.
|
|
141
|
+
*/
|
|
142
|
+
artifacts?: Map<string, ExportArtifact[]>;
|
|
100
143
|
}
|
|
101
144
|
export declare class ExportService {
|
|
102
145
|
private _provider;
|
|
@@ -180,12 +223,33 @@ export declare class ExportService {
|
|
|
180
223
|
private inlineLogo;
|
|
181
224
|
/** Loads the conversation and the messages in the scope that no rerun replaced, in Sequence order. */
|
|
182
225
|
private loadConversationData;
|
|
226
|
+
/**
|
|
227
|
+
* The output artifacts of the exported messages, keyed by lower-cased message ID. Reads run as
|
|
228
|
+
* the current user, so row-level security decides what an export carries. A failed read
|
|
229
|
+
* exports the messages without artifacts.
|
|
230
|
+
*/
|
|
231
|
+
private loadOutputArtifacts;
|
|
232
|
+
/** The artifacts to write under one message: none when artifacts are off or it produced none. */
|
|
233
|
+
private artifactsFor;
|
|
234
|
+
/** The host's link for an artifact, when it builds one and the link is http(s). */
|
|
235
|
+
private artifactUrl;
|
|
236
|
+
/** "Type, version N" plus the MIME type of a file-backed version. */
|
|
237
|
+
private artifactSummary;
|
|
238
|
+
/**
|
|
239
|
+
* Text content for the Markdown, HTML and text formats, cut at
|
|
240
|
+
* {@link EXPORT_ARTIFACT_CONTENT_LIMIT} with a marker line. Null when there is none.
|
|
241
|
+
*/
|
|
242
|
+
private artifactText;
|
|
243
|
+
/** A Markdown code fence longer than any backtick run inside the content. */
|
|
244
|
+
private markdownFence;
|
|
183
245
|
/** The header name of the scope's fork: its display name; null in Main. */
|
|
184
246
|
private forkLabel;
|
|
185
247
|
private exportAsJSON;
|
|
186
248
|
private exportAsMarkdown;
|
|
187
249
|
private exportAsHTML;
|
|
188
250
|
private exportAsText;
|
|
251
|
+
/** True when any exported message carries an artifact (the HTML adds its rules only then). */
|
|
252
|
+
private hasArtifacts;
|
|
189
253
|
private downloadFile;
|
|
190
254
|
private formatDate;
|
|
191
255
|
private capitalizeRole;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/export.service.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"export.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/export.service.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EACjB,oBAAoB,EACpB,0BAA0B,EAI3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAW,QAAQ,EAAY,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;;AAGtF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEjE;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,MAAM,GAAG,IAAI,CAAC;CACpE;AAED,mFAAmF;AACnF,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAA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AAY;IA+FpB,OAAO,CAAC,YAAY;IAuDpB,8FAA8F;IAC9F,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,UAAU;IAMlB,kFAAkF;IAClF,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,YAAY;yCAnxBT,aAAa;6CAAb,aAAa;CAuxBzB"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
2
|
import { ConversationEngine } from '@memberjunction/core-entities';
|
|
3
3
|
import { RunView, Metadata } from '@memberjunction/core';
|
|
4
|
-
import { UUIDsEqual } from '@memberjunction/global';
|
|
4
|
+
import { EscapeSQLString, UUIDsEqual } from '@memberjunction/global';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* Longest artifact content the Markdown, HTML and text formats write; longer content is cut
|
|
8
|
+
* with a marker line. JSON carries content as stored.
|
|
9
|
+
*/
|
|
10
|
+
export const EXPORT_ARTIFACT_CONTENT_LIMIT = 20000;
|
|
6
11
|
/**
|
|
7
12
|
* Tokens captured by the theme auto-snapshot — exactly the custom properties the
|
|
8
13
|
* HTML export's stylesheet consumes. Hosts wanting more control supply their own
|
|
@@ -37,7 +42,7 @@ export class ExportService {
|
|
|
37
42
|
* @throws when the scope belongs to another conversation, or the conversation is not found.
|
|
38
43
|
*/
|
|
39
44
|
async ExportConversation(conversationId, scope, format, currentUser, options = {}) {
|
|
40
|
-
const conversation = await this.loadConversationData(conversationId, scope, currentUser);
|
|
45
|
+
const conversation = await this.loadConversationData(conversationId, scope, currentUser, options.includeArtifacts ?? true);
|
|
41
46
|
const { content, filename, mimeType } = await this.BuildExportContent(conversation, format, options);
|
|
42
47
|
this.downloadFile(content, filename, mimeType);
|
|
43
48
|
}
|
|
@@ -62,7 +67,9 @@ export class ExportService {
|
|
|
62
67
|
includeCSS: options.includeCSS ?? true,
|
|
63
68
|
includeTheme: options.includeTheme ?? false,
|
|
64
69
|
themeMode: options.themeMode ?? 'light',
|
|
65
|
-
|
|
70
|
+
includeArtifacts: options.includeArtifacts ?? true,
|
|
71
|
+
branding: options.branding,
|
|
72
|
+
artifactLink: options.artifactLink
|
|
66
73
|
};
|
|
67
74
|
const baseName = `conversation-${data.conversation.Name}-${this.getTimestamp()}`;
|
|
68
75
|
switch (format) {
|
|
@@ -260,7 +267,7 @@ export class ExportService {
|
|
|
260
267
|
}
|
|
261
268
|
}
|
|
262
269
|
/** Loads the conversation and the messages in the scope that no rerun replaced, in Sequence order. */
|
|
263
|
-
async loadConversationData(conversationId, scope, currentUser) {
|
|
270
|
+
async loadConversationData(conversationId, scope, currentUser, includeArtifacts) {
|
|
264
271
|
if (!UUIDsEqual(scope.ConversationID, conversationId)) {
|
|
265
272
|
throw new Error(`Conversation ${conversationId} cannot be exported with the scope of conversation ${scope.ConversationID}`);
|
|
266
273
|
}
|
|
@@ -286,9 +293,119 @@ export class ExportService {
|
|
|
286
293
|
return {
|
|
287
294
|
conversation: conversationResult.Results[0],
|
|
288
295
|
details,
|
|
289
|
-
fork: this.forkLabel(scope, details)
|
|
296
|
+
fork: this.forkLabel(scope, details),
|
|
297
|
+
artifacts: includeArtifacts ? await this.loadOutputArtifacts(details, currentUser) : undefined
|
|
290
298
|
};
|
|
291
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* The output artifacts of the exported messages, keyed by lower-cased message ID. Reads run as
|
|
302
|
+
* the current user, so row-level security decides what an export carries. A failed read
|
|
303
|
+
* exports the messages without artifacts.
|
|
304
|
+
*/
|
|
305
|
+
async loadOutputArtifacts(details, currentUser) {
|
|
306
|
+
const byDetail = new Map();
|
|
307
|
+
if (details.length === 0) {
|
|
308
|
+
return byDetail;
|
|
309
|
+
}
|
|
310
|
+
const rv = RunView.FromMetadataProvider(this.Provider);
|
|
311
|
+
const inList = (ids) => [...ids].map(id => `'${EscapeSQLString(id)}'`).join(',');
|
|
312
|
+
const links = await rv.RunView({
|
|
313
|
+
EntityName: 'MJ: Conversation Detail Artifacts',
|
|
314
|
+
ExtraFilter: `ConversationDetailID IN (${inList(details.map(d => d.ID))}) AND Direction='Output'`,
|
|
315
|
+
Fields: ['ConversationDetailID', 'ArtifactVersionID'],
|
|
316
|
+
OrderBy: '__mj_CreatedAt ASC',
|
|
317
|
+
ResultType: 'simple'
|
|
318
|
+
}, currentUser);
|
|
319
|
+
const linkRows = links.Success ? links.Results ?? [] : [];
|
|
320
|
+
if (!links.Success) {
|
|
321
|
+
console.error('Failed to load artifacts for the export:', links.ErrorMessage);
|
|
322
|
+
}
|
|
323
|
+
if (linkRows.length === 0) {
|
|
324
|
+
return byDetail;
|
|
325
|
+
}
|
|
326
|
+
const versionIds = new Set(linkRows.map(l => l.ArtifactVersionID));
|
|
327
|
+
const versions = await rv.RunView({
|
|
328
|
+
EntityName: 'MJ: Artifact Versions',
|
|
329
|
+
ExtraFilter: `ID IN (${inList(versionIds)})`,
|
|
330
|
+
Fields: ['ID', 'ArtifactID', 'VersionNumber', 'Name', 'Content', 'FileID', 'MimeType'],
|
|
331
|
+
ResultType: 'simple'
|
|
332
|
+
}, currentUser);
|
|
333
|
+
const versionRows = versions.Success ? versions.Results ?? [] : [];
|
|
334
|
+
if (versionRows.length === 0) {
|
|
335
|
+
return byDetail;
|
|
336
|
+
}
|
|
337
|
+
const artifacts = await rv.RunView({
|
|
338
|
+
EntityName: 'MJ: Artifacts',
|
|
339
|
+
ExtraFilter: `ID IN (${inList(new Set(versionRows.map(v => v.ArtifactID)))})`,
|
|
340
|
+
Fields: ['ID', 'Name', 'Type'],
|
|
341
|
+
ResultType: 'simple'
|
|
342
|
+
}, currentUser);
|
|
343
|
+
const artifactById = new Map((artifacts.Success ? artifacts.Results ?? [] : []).map(a => [a.ID.toLowerCase(), a]));
|
|
344
|
+
const versionById = new Map(versionRows.map(v => [v.ID.toLowerCase(), v]));
|
|
345
|
+
for (const link of linkRows) {
|
|
346
|
+
const version = versionById.get(link.ArtifactVersionID.toLowerCase());
|
|
347
|
+
// A version the user cannot read, or whose artifact they cannot read, is left out.
|
|
348
|
+
const artifact = version ? artifactById.get(version.ArtifactID.toLowerCase()) : undefined;
|
|
349
|
+
if (!version || !artifact) {
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
const key = link.ConversationDetailID.toLowerCase();
|
|
353
|
+
const list = byDetail.get(key) ?? [];
|
|
354
|
+
list.push({
|
|
355
|
+
ArtifactID: artifact.ID,
|
|
356
|
+
VersionID: version.ID,
|
|
357
|
+
Name: version.Name || artifact.Name || 'Untitled artifact',
|
|
358
|
+
Type: artifact.Type ?? 'Unknown type',
|
|
359
|
+
VersionNumber: version.VersionNumber,
|
|
360
|
+
Content: version.FileID ? null : version.Content,
|
|
361
|
+
MimeType: version.MimeType,
|
|
362
|
+
FileBacked: !!version.FileID
|
|
363
|
+
});
|
|
364
|
+
byDetail.set(key, list);
|
|
365
|
+
}
|
|
366
|
+
return byDetail;
|
|
367
|
+
}
|
|
368
|
+
/** The artifacts to write under one message: none when artifacts are off or it produced none. */
|
|
369
|
+
artifactsFor(data, detail, options) {
|
|
370
|
+
if (!options.includeArtifacts || !data.artifacts) {
|
|
371
|
+
return [];
|
|
372
|
+
}
|
|
373
|
+
return data.artifacts.get(detail.ID.toLowerCase()) ?? [];
|
|
374
|
+
}
|
|
375
|
+
/** The host's link for an artifact, when it builds one and the link is http(s). */
|
|
376
|
+
artifactUrl(data, artifact, options) {
|
|
377
|
+
const url = options.artifactLink?.({
|
|
378
|
+
ConversationID: data.conversation.ID,
|
|
379
|
+
ArtifactID: artifact.ArtifactID,
|
|
380
|
+
VersionID: artifact.VersionID,
|
|
381
|
+
VersionNumber: artifact.VersionNumber
|
|
382
|
+
})?.trim();
|
|
383
|
+
return url && /^https?:\/\//i.test(url) ? url : null;
|
|
384
|
+
}
|
|
385
|
+
/** "Type, version N" plus the MIME type of a file-backed version. */
|
|
386
|
+
artifactSummary(artifact) {
|
|
387
|
+
const mime = artifact.FileBacked && artifact.MimeType ? `, ${artifact.MimeType}` : '';
|
|
388
|
+
return `${artifact.Type}, version ${artifact.VersionNumber}${mime}`;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Text content for the Markdown, HTML and text formats, cut at
|
|
392
|
+
* {@link EXPORT_ARTIFACT_CONTENT_LIMIT} with a marker line. Null when there is none.
|
|
393
|
+
*/
|
|
394
|
+
artifactText(artifact) {
|
|
395
|
+
const content = artifact.Content;
|
|
396
|
+
if (artifact.FileBacked || content == null || content.length === 0) {
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
if (content.length <= EXPORT_ARTIFACT_CONTENT_LIMIT) {
|
|
400
|
+
return content;
|
|
401
|
+
}
|
|
402
|
+
return `${content.slice(0, EXPORT_ARTIFACT_CONTENT_LIMIT)}\n[truncated: ${EXPORT_ARTIFACT_CONTENT_LIMIT} of ${content.length} characters shown]`;
|
|
403
|
+
}
|
|
404
|
+
/** A Markdown code fence longer than any backtick run inside the content. */
|
|
405
|
+
markdownFence(content) {
|
|
406
|
+
const longest = Math.max(0, ...(content.match(/`+/g) ?? []).map(run => run.length));
|
|
407
|
+
return '`'.repeat(Math.max(3, longest + 1));
|
|
408
|
+
}
|
|
292
409
|
/** The header name of the scope's fork: its display name; null in Main. */
|
|
293
410
|
forkLabel(scope, details) {
|
|
294
411
|
if (scope.BranchID == null) {
|
|
@@ -338,6 +455,27 @@ export class ExportService {
|
|
|
338
455
|
message.sequence = index + 1;
|
|
339
456
|
message.timestamp = detail.__mj_CreatedAt;
|
|
340
457
|
}
|
|
458
|
+
const artifacts = this.artifactsFor(data, detail, options);
|
|
459
|
+
if (artifacts.length > 0) {
|
|
460
|
+
message.artifacts = artifacts.map(artifact => {
|
|
461
|
+
const entry = {
|
|
462
|
+
id: artifact.ArtifactID,
|
|
463
|
+
versionId: artifact.VersionID,
|
|
464
|
+
name: artifact.Name,
|
|
465
|
+
type: artifact.Type,
|
|
466
|
+
version: artifact.VersionNumber
|
|
467
|
+
};
|
|
468
|
+
if (artifact.FileBacked) {
|
|
469
|
+
entry.mimeType = artifact.MimeType;
|
|
470
|
+
}
|
|
471
|
+
const link = this.artifactUrl(data, artifact, options);
|
|
472
|
+
if (link) {
|
|
473
|
+
entry.link = link;
|
|
474
|
+
}
|
|
475
|
+
entry.content = artifact.Content;
|
|
476
|
+
return entry;
|
|
477
|
+
});
|
|
478
|
+
}
|
|
341
479
|
return message;
|
|
342
480
|
});
|
|
343
481
|
}
|
|
@@ -369,6 +507,18 @@ export class ExportService {
|
|
|
369
507
|
for (const detail of data.details) {
|
|
370
508
|
md += `## ${this.capitalizeRole(detail.Role || 'Unknown')}\n\n`;
|
|
371
509
|
md += `${detail.Message}\n\n`;
|
|
510
|
+
for (const artifact of this.artifactsFor(data, detail, options)) {
|
|
511
|
+
md += `**Artifact:** ${artifact.Name} (${this.artifactSummary(artifact)})\n\n`;
|
|
512
|
+
const link = this.artifactUrl(data, artifact, options);
|
|
513
|
+
if (link) {
|
|
514
|
+
md += `[Open in the app](${link})\n\n`;
|
|
515
|
+
}
|
|
516
|
+
const text = this.artifactText(artifact);
|
|
517
|
+
if (text) {
|
|
518
|
+
const fence = this.markdownFence(text);
|
|
519
|
+
md += `${fence}\n${text}\n${fence}\n\n`;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
372
522
|
if (options.includeMetadata) {
|
|
373
523
|
md += `*${this.formatDate(detail.__mj_CreatedAt)}*\n\n`;
|
|
374
524
|
}
|
|
@@ -396,7 +546,11 @@ export class ExportService {
|
|
|
396
546
|
.message.assistant { background: var(--mj-bg-surface-card, #f5f5f5); }
|
|
397
547
|
.role { font-weight: 600; color: var(--mj-brand-primary, #007bff); margin-bottom: 10px; }
|
|
398
548
|
.content { white-space: pre-wrap; }
|
|
399
|
-
.timestamp { color: var(--mj-text-disabled, #999); font-size: 12px; margin-top: 10px; }${
|
|
549
|
+
.timestamp { color: var(--mj-text-disabled, #999); font-size: 12px; margin-top: 10px; }${this.hasArtifacts(data, options) ? `
|
|
550
|
+
.artifact { margin-top: 12px; padding: 12px; border: 1px solid var(--mj-border-default, #ddd); border-radius: var(--mj-radius-md, 8px); background: var(--mj-bg-page, #fff); }
|
|
551
|
+
.artifact-name { font-weight: 600; }
|
|
552
|
+
.artifact-meta { color: var(--mj-text-secondary, #666); font-size: 12px; }
|
|
553
|
+
.artifact-content { white-space: pre-wrap; overflow-x: auto; font-size: 13px; margin: 8px 0 0; }` : ''}${theme.logoDataUri ? `
|
|
400
554
|
.brand-logo { display: block; max-height: 48px; margin-bottom: 12px; }` : ''}${trademark ? `
|
|
401
555
|
.brand-trademark { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--mj-border-default, #ddd); color: var(--mj-text-secondary, #666); font-size: 12px; text-align: center; }` : ''}
|
|
402
556
|
</style>${theme.rootBlock}` : '';
|
|
@@ -432,6 +586,16 @@ export class ExportService {
|
|
|
432
586
|
<div class="message ${roleClass}">
|
|
433
587
|
<div class="role">${this.capitalizeRole(detail.Role || 'Unknown')}</div>
|
|
434
588
|
<div class="content">${this.escapeHtml(detail.Message || '')}</div>`;
|
|
589
|
+
for (const artifact of this.artifactsFor(data, detail, options)) {
|
|
590
|
+
const link = this.artifactUrl(data, artifact, options);
|
|
591
|
+
const text = this.artifactText(artifact);
|
|
592
|
+
html += `
|
|
593
|
+
<div class="artifact">
|
|
594
|
+
<div class="artifact-name">${this.escapeHtml(artifact.Name)}</div>
|
|
595
|
+
<div class="artifact-meta">${this.escapeHtml(this.artifactSummary(artifact))}${link ? ` · <a href="${this.escapeAttr(link)}">Open in the app</a>` : ''}</div>${text ? `
|
|
596
|
+
<pre class="artifact-content">${this.escapeHtml(text)}</pre>` : ''}
|
|
597
|
+
</div>`;
|
|
598
|
+
}
|
|
435
599
|
if (options.includeMetadata) {
|
|
436
600
|
html += `
|
|
437
601
|
<div class="timestamp">${this.formatDate(detail.__mj_CreatedAt)}</div>`;
|
|
@@ -467,6 +631,17 @@ export class ExportService {
|
|
|
467
631
|
for (const detail of data.details) {
|
|
468
632
|
text += `[${this.capitalizeRole(detail.Role || 'Unknown')}]\n`;
|
|
469
633
|
text += `${detail.Message}\n`;
|
|
634
|
+
for (const artifact of this.artifactsFor(data, detail, options)) {
|
|
635
|
+
text += `\n[Artifact] ${artifact.Name} (${this.artifactSummary(artifact)})\n`;
|
|
636
|
+
const link = this.artifactUrl(data, artifact, options);
|
|
637
|
+
if (link) {
|
|
638
|
+
text += `Link: ${link}\n`;
|
|
639
|
+
}
|
|
640
|
+
const content = this.artifactText(artifact);
|
|
641
|
+
if (content) {
|
|
642
|
+
text += `${content}\n`;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
470
645
|
if (options.includeMetadata) {
|
|
471
646
|
text += `(${this.formatDate(detail.__mj_CreatedAt)})\n`;
|
|
472
647
|
}
|
|
@@ -479,6 +654,10 @@ export class ExportService {
|
|
|
479
654
|
}
|
|
480
655
|
return text;
|
|
481
656
|
}
|
|
657
|
+
/** True when any exported message carries an artifact (the HTML adds its rules only then). */
|
|
658
|
+
hasArtifacts(data, options) {
|
|
659
|
+
return options.includeMessages && data.details.some(d => this.artifactsFor(data, d, options).length > 0);
|
|
660
|
+
}
|
|
482
661
|
downloadFile(content, filename, mimeType) {
|
|
483
662
|
const blob = new Blob([content], { type: mimeType });
|
|
484
663
|
const url = URL.createObjectURL(blob);
|