@aceshooting/lyra-ui 29.2.2 → 30.0.0
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/CHANGELOG.md +126 -106
- package/README.md +8 -7
- package/dist/ai/snapshot.js +1 -1
- package/dist/all.d.ts +1 -1
- package/dist/all.js +1 -1
- package/dist/autoloader.js +1 -1
- package/dist/cli/component-inventory.mjs +1 -1
- package/dist/cli/lyra-rename-ledger.mjs +1 -1
- package/dist/cli/migrate-wa.mjs +7 -3
- package/dist/cli/migration-analysis.mjs +1 -1
- package/dist/cli/migration-contract.json +1 -1
- package/dist/cli/migration-contract.mjs +1 -1
- package/dist/cli/migration-immutable-collections.mjs +6 -0
- package/dist/cli/migration-renames.mjs +1 -1
- package/dist/cli/migration-transforms.mjs +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.class.d.ts +1 -1
- package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.d.ts +1 -2
- package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.js +1 -1
- package/dist/components/agent-tools/agent-run/agent-run.class.d.ts +3 -4
- package/dist/components/agent-tools/agent-run/agent-run.class.js +1 -1
- package/dist/components/agent-tools/agent-trace/agent-trace.class.d.ts +1 -1
- package/dist/components/agent-tools/agent-trace/agent-trace.class.js +2 -2
- package/dist/components/agent-tools/background-runs/background-runs.class.d.ts +1 -2
- package/dist/components/agent-tools/background-runs/background-runs.class.js +1 -1
- package/dist/components/agent-tools/change-review/change-review.class.d.ts +1 -2
- package/dist/components/agent-tools/change-review/change-review.class.js +1 -1
- package/dist/components/agent-tools/eval-dataset/eval-dataset.class.d.ts +3 -2
- package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +1 -1
- package/dist/components/agent-tools/evaluation-run/evaluation-run.class.d.ts +7 -1
- package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +1 -1
- package/dist/components/agent-tools/prompt-studio/prompt-studio.class.d.ts +2 -2
- package/dist/components/agent-tools/prompt-studio/prompt-studio.class.js +3 -3
- package/dist/components/agent-tools/span-waterfall/span-waterfall.class.d.ts +1 -1
- package/dist/components/agent-tools/subagent-panel/subagent-panel.class.d.ts +1 -2
- package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +2 -2
- package/dist/components/agent-tools/task-list/task-list.class.d.ts +1 -1
- package/dist/components/agent-tools/test-results/test-results.class.d.ts +1 -1
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +3 -4
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +1 -5
- package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +3 -3
- package/dist/components/agent-tools/trace-tree/trace-tree.class.d.ts +1 -0
- package/dist/components/agent-tools/trace-tree/trace-tree.class.js +1 -1
- package/dist/components/charts/chart/chart.class.js +3 -3
- package/dist/components/charts/chart-3d/chart-3d-data.d.ts +50 -0
- package/dist/components/charts/chart-3d/chart-3d-data.js +1 -0
- package/dist/components/charts/chart-3d/chart-3d-engine.js +1 -0
- package/dist/components/charts/chart-3d/chart-3d.class.d.ts +96 -0
- package/dist/components/charts/chart-3d/chart-3d.class.js +47 -0
- package/dist/components/charts/chart-3d/chart-3d.d.ts +1 -0
- package/dist/components/charts/chart-3d/chart-3d.js +1 -0
- package/dist/components/charts/chart-3d/chart-3d.styles.js +1 -0
- package/dist/components/charts/index.d.ts +1 -1
- package/dist/components/charts/index.js +1 -1
- package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +3 -3
- package/dist/components/conversation/agent-workspace/agent-workspace.class.js +4 -5
- package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
- package/dist/components/conversation/code-block/shiki-oniguruma.d.ts +3 -0
- package/dist/components/conversation/code-block/shiki-oniguruma.js +1 -0
- package/dist/components/conversation/code-block/shiki-types.d.ts +3 -5
- package/dist/components/conversation/code-block/shiki-types.js +1 -1
- package/dist/components/conversation/generation-metrics/generation-metrics.class.js +1 -1
- package/dist/components/conversation/markdown/markdown-progressive.js +1 -1
- package/dist/components/conversation/message-actions/message-actions.class.js +1 -1
- package/dist/components/conversation/message-parts/message-parts.class.js +1 -1
- package/dist/components/conversation/model-select/model-select.class.js +1 -1
- package/dist/components/conversation/model-settings-panel/model-settings-panel.class.js +1 -1
- package/dist/components/conversation/prompt-input/prompt-input.class.js +3 -4
- package/dist/components/conversation/prompt-queue/prompt-queue.class.d.ts +1 -1
- package/dist/components/conversation/push-to-talk/push-to-talk.class.js +1 -1
- package/dist/components/conversation/selection-toolbar/selection-toolbar.class.js +1 -1
- package/dist/components/conversation/thread-list/thread-list.class.d.ts +2 -2
- package/dist/components/conversation/thread-list/thread-list.class.js +1 -1
- package/dist/components/conversation/widget-renderer/registry.js +1 -1
- package/dist/components/conversation/widget-renderer/resolve.js +1 -1
- package/dist/components/data/calendar/calendar.class.d.ts +3 -1
- package/dist/components/data/data-grid/data-grid.class.js +2 -2
- package/dist/components/data/flow-canvas/flow-canvas.class.js +2 -2
- package/dist/components/data/flow-canvas/flow-source.js +1 -1
- package/dist/components/data/flow-node/flow-node.class.d.ts +2 -3
- package/dist/components/data/flow-node/flow-node.class.js +2 -4
- package/dist/components/data/heatmap/heatmap.class.js +1 -1
- package/dist/components/data/sparkline/sparkline.class.d.ts +0 -1
- package/dist/components/data/sparkline/sparkline.class.js +1 -1
- package/dist/components/data/table/table.class.js +1 -1
- package/dist/components/forms/color-picker/color-core.js +1 -1
- package/dist/components/forms/date-picker/calendar-core.js +1 -1
- package/dist/components/forms/otp-input/otp-input.class.js +1 -1
- package/dist/components/forms/signature-pad/signature-pad.class.d.ts +4 -3
- package/dist/components/forms/signature-pad/signature-pad.class.js +1 -1
- package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +3 -2
- package/dist/components/forms/swatch-picker/swatch-picker.class.js +1 -1
- package/dist/components/layout/app-rail/app-rail-item.class.d.ts +0 -2
- package/dist/components/layout/app-rail/app-rail-item.class.js +1 -1
- package/dist/components/layout/app-rail/app-rail.class.d.ts +3 -3
- package/dist/components/layout/command-palette/command-palette.class.d.ts +1 -1
- package/dist/components/layout/details/accordion-item.class.d.ts +1 -2
- package/dist/components/layout/details/accordion-item.class.js +1 -1
- package/dist/components/layout/dock-panel/dock-panel.class.d.ts +4 -11
- package/dist/components/layout/dock-panel/dock-panel.class.js +1 -1
- package/dist/components/layout/drilldown-panel/drilldown-panel.class.js +1 -1
- package/dist/components/layout/menu/menu.class.js +1 -1
- package/dist/components/layout/menubar/menubar-item.class.d.ts +1 -1
- package/dist/components/layout/menubar/menubar.class.d.ts +1 -1
- package/dist/components/layout/multi-split/multi-split.class.d.ts +1 -1
- package/dist/components/layout/multi-split/multi-split.class.js +1 -1
- package/dist/components/layout/navigation-menu/navigation-menu.class.d.ts +2 -6
- package/dist/components/layout/navigation-menu/navigation-menu.class.js +1 -1
- package/dist/components/layout/tab-group/tab-group.class.js +1 -1
- package/dist/components/layout/virtual-list/virtual-list.class.d.ts +3 -2
- package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
- package/dist/components/layout/widget/widget.class.d.ts +5 -14
- package/dist/components/layout/widget/widget.class.js +2 -2
- package/dist/components/lr-chart-3d.js +1 -0
- package/dist/components/lr-model-viewer.js +1 -0
- package/dist/components/media/av-player/av-metadata.d.ts +1 -13
- package/dist/components/media/av-player/av-metadata.js +1 -1
- package/dist/components/media/av-player/av-player.class.js +1 -1
- package/dist/components/media/file-input/file-input.class.d.ts +10 -13
- package/dist/components/media/file-input/file-input.class.js +3 -3
- package/dist/components/media/file-input/file-input.styles.js +1 -1
- package/dist/components/media/image-viewer/image-viewer-panorama.d.ts +5 -0
- package/dist/components/media/image-viewer/image-viewer-panorama.js +8 -0
- package/dist/components/media/image-viewer/image-viewer-panorama.styles.js +1 -0
- package/dist/components/media/image-viewer/image-viewer.class.d.ts +29 -5
- package/dist/components/media/image-viewer/image-viewer.class.js +8 -5
- package/dist/components/media/image-viewer/image-viewer.styles.js +1 -1
- package/dist/components/media/map/map-anchor-controller.js +1 -0
- package/dist/components/media/map/map-anchor-options.d.ts +14 -0
- package/dist/components/media/map/map-anchor-options.js +1 -0
- package/dist/components/media/map/map-camera.d.ts +34 -0
- package/dist/components/media/map/map-camera.js +1 -0
- package/dist/components/media/map/map-construction-scheduler.d.ts +13 -0
- package/dist/components/media/map/map-construction-scheduler.js +1 -0
- package/dist/components/media/map/map-control-options.d.ts +39 -0
- package/dist/components/media/map/map-control-options.js +1 -0
- package/dist/components/media/map/map-controls-lifecycle.js +1 -0
- package/dist/components/media/map/map-cursor.js +1 -0
- package/dist/components/media/map/map-data-layer-model.d.ts +40 -0
- package/dist/components/media/map/map-data-layer-model.js +1 -0
- package/dist/components/media/map/map-drawing-controller.js +1 -0
- package/dist/components/media/map/map-drawing-gesture.js +1 -0
- package/dist/components/media/map/map-drawing-pan.js +1 -0
- package/dist/components/media/map/map-drawing-pointer.js +1 -0
- package/dist/components/media/map/map-drawing.d.ts +29 -0
- package/dist/components/media/map/map-drawing.js +1 -0
- package/dist/components/media/map/map-empty-style.d.ts +8 -0
- package/dist/components/media/map/map-empty-style.js +1 -0
- package/dist/components/media/map/map-engine-events.js +1 -0
- package/dist/components/media/map/map-export-attribution.js +1 -0
- package/dist/components/media/map/map-external-source-effects.js +1 -0
- package/dist/components/media/map/map-feature-loader-core.js +1 -0
- package/dist/components/media/map/map-feature-loader.js +1 -0
- package/dist/components/media/map/map-feature-state-router.d.ts +16 -0
- package/dist/components/media/map/map-feature-state-router.js +1 -0
- package/dist/components/media/map/map-feature-state-routes.js +1 -0
- package/dist/components/media/map/map-feature-state.d.ts +16 -0
- package/dist/components/media/map/map-feature-state.js +1 -0
- package/dist/components/media/map/map-hash-option.js +1 -0
- package/dist/components/media/map/map-hash-owner.js +1 -0
- package/dist/components/media/map/map-hash.js +1 -0
- package/dist/components/media/map/map-hit-test.d.ts +17 -0
- package/dist/components/media/map/map-hit-test.js +1 -0
- package/dist/components/media/map/map-image-admission.d.ts +7 -0
- package/dist/components/media/map/map-image-admission.js +1 -0
- package/dist/components/media/map/map-image-export-controller.js +1 -0
- package/dist/components/media/map/map-image-export-error.d.ts +3 -0
- package/dist/components/media/map/map-image-export-error.js +1 -0
- package/dist/components/media/map/map-image-export.d.ts +15 -0
- package/dist/components/media/map/map-image-export.js +5 -0
- package/dist/components/media/map/map-image-limits.d.ts +4 -0
- package/dist/components/media/map/map-image-limits.js +1 -0
- package/dist/components/media/map/map-image-metadata.js +3 -0
- package/dist/components/media/map/map-image-provider.d.ts +33 -0
- package/dist/components/media/map/map-image-provider.js +1 -0
- package/dist/components/media/map/map-images.d.ts +9 -0
- package/dist/components/media/map/map-images.js +1 -0
- package/dist/components/media/map/map-interaction-options.d.ts +26 -0
- package/dist/components/media/map/map-interaction-options.js +1 -0
- package/dist/components/media/map/map-layer-order.js +1 -0
- package/dist/components/media/map/map-loader.d.ts +35 -5
- package/dist/components/media/map/map-loader.js +1 -1
- package/dist/components/media/map/map-local-image-url.js +1 -0
- package/dist/components/media/map/map-local-image.js +1 -0
- package/dist/components/media/map/map-overlay-admission.d.ts +13 -0
- package/dist/components/media/map/map-overlay-admission.js +1 -0
- package/dist/components/media/map/map-owned-feature-input.js +1 -0
- package/dist/components/media/map/map-owned-features.js +1 -0
- package/dist/components/media/map/map-owned-resources.js +1 -0
- package/dist/components/media/map/map-paint-batch.js +1 -0
- package/dist/components/media/map/map-readers.js +1 -0
- package/dist/components/media/map/map-readiness.js +1 -0
- package/dist/components/media/map/map-resource-feature-loaders.js +1 -0
- package/dist/components/media/map/map-source-updates.js +1 -0
- package/dist/components/media/map/map-style-input.js +1 -0
- package/dist/components/media/map/map-style-lifecycle.js +1 -0
- package/dist/components/media/map/map-style-override-admission.d.ts +10 -0
- package/dist/components/media/map/map-style-override-admission.js +1 -0
- package/dist/components/media/map/map-style-overrides.js +1 -0
- package/dist/components/media/map/map-style-value.d.ts +3 -0
- package/dist/components/media/map/map-style-value.js +1 -0
- package/dist/components/media/map/map-vector-style.d.ts +10 -0
- package/dist/components/media/map/map-vector-style.js +1 -0
- package/dist/components/media/map/map.class.d.ts +558 -51
- package/dist/components/media/map/map.class.js +58 -11
- package/dist/components/media/map/map.styles.js +1 -1
- package/dist/components/media/qr-code/qr-code.class.d.ts +1 -3
- package/dist/components/media/qr-code/qr-code.class.js +1 -1
- package/dist/components/media/qr-code/qr-code.styles.js +1 -1
- package/dist/components/media/video/video.class.d.ts +25 -4
- package/dist/components/media/video/video.class.js +11 -3
- package/dist/components/media/video/video.styles.js +1 -1
- package/dist/components/media/video-playlist/video-playlist.class.d.ts +0 -1
- package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
- package/dist/components/overlays/chip/chip-group.class.d.ts +1 -1
- package/dist/components/overlays/chip/chip-group.class.js +1 -1
- package/dist/components/overlays/dialog/confirm.js +1 -1
- package/dist/components/overlays/overlay/popover.class.d.ts +1 -1
- package/dist/components/overlays/overlay/popover.class.js +2 -1
- package/dist/components/overlays/overlay/tooltip.class.js +1 -1
- package/dist/components/retrieval/chunk-inspector/chunk-inspector.class.d.ts +4 -7
- package/dist/components/retrieval/chunk-inspector/chunk-inspector.class.js +2 -2
- package/dist/components/retrieval/claim-evidence/claim-evidence.class.d.ts +2 -2
- package/dist/components/retrieval/community-card/community-card.class.d.ts +1 -4
- package/dist/components/retrieval/community-card/community-card.class.js +1 -1
- package/dist/components/retrieval/embedding-explorer/embedding-explorer-data.d.ts +12 -0
- package/dist/components/retrieval/embedding-explorer/embedding-explorer-data.js +1 -0
- package/dist/components/retrieval/embedding-explorer/embedding-explorer-engine.js +1 -0
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.d.ts +26 -7
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +35 -4
- package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +1 -1
- package/dist/components/retrieval/entity-dossier/entity-dossier.class.d.ts +3 -9
- package/dist/components/retrieval/graph/graph-builtin-3d-engine.js +1 -0
- package/dist/components/retrieval/graph/graph-engine-adapter.js +1 -0
- package/dist/components/retrieval/graph/graph-engine-columns.js +1 -0
- package/dist/components/retrieval/graph/graph-model.js +1 -1
- package/dist/components/retrieval/graph/graph-spatial-controller.js +13 -8
- package/dist/components/retrieval/graph/graph-webgl-engine.js +1 -0
- package/dist/components/retrieval/graph/graph.class.d.ts +18 -5
- package/dist/components/retrieval/graph/graph.class.js +4 -4
- package/dist/components/retrieval/graph/graph.styles.js +1 -1
- package/dist/components/retrieval/grounding-summary/grounding-summary.class.d.ts +1 -1
- package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +1 -1
- package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +2 -2
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +6 -3
- package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +3 -3
- package/dist/components/retrieval/memory-panel/memory-panel.class.d.ts +3 -10
- package/dist/components/retrieval/memory-panel/memory-panel.class.js +1 -1
- package/dist/components/retrieval/node-palette/node-palette.class.d.ts +1 -1
- package/dist/components/retrieval/path-strip/path-strip.class.d.ts +1 -4
- package/dist/components/retrieval/path-strip/path-strip.class.js +1 -1
- package/dist/components/retrieval/provenance-panel/provenance-panel.class.d.ts +2 -8
- package/dist/components/retrieval/rag-answer/rag-answer.class.d.ts +2 -2
- package/dist/components/retrieval/rag-answer/rag-answer.class.js +2 -3
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +1 -11
- package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +1 -1
- package/dist/components/retrieval/retrieval-results/retrieval-results.class.d.ts +8 -12
- package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +5 -6
- package/dist/components/retrieval/retrieval-search/retrieval-search.class.d.ts +1 -1
- package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.d.ts +4 -7
- package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.js +2 -3
- package/dist/components/retrieval/source-card/source-card.class.d.ts +6 -9
- package/dist/components/retrieval/source-card/source-card.class.js +1 -1
- package/dist/components/retrieval/source-picker/source-picker.class.d.ts +1 -4
- package/dist/components/retrieval/source-picker/source-picker.class.js +1 -1
- package/dist/components/utility/diff-view/diff-view.class.js +1 -1
- package/dist/components/utility/format/format-options.js +1 -1
- package/dist/components/utility/icon/icon.class.d.ts +0 -5
- package/dist/components/utility/icon/icon.class.js +2 -2
- package/dist/components/utility/icon/icon.styles.js +1 -1
- package/dist/components/utility/json-viewer/json-viewer.class.js +1 -1
- package/dist/components/utility/known-date/known-date.class.d.ts +0 -3
- package/dist/components/utility/known-date/known-date.class.js +1 -1
- package/dist/components/utility/mention-popover/mention-popover.class.d.ts +3 -2
- package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
- package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
- package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
- package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
- package/dist/components/viewers/document-preview/document-preview.class.js +1 -1
- package/dist/components/viewers/document-viewer/document-viewer-kinds.d.ts +1 -1
- package/dist/components/viewers/document-viewer/document-viewer-kinds.js +1 -1
- package/dist/components/viewers/document-viewer/document-viewer.class.js +1 -1
- package/dist/components/viewers/document-viewer/registry.d.ts +1 -69
- package/dist/components/viewers/document-viewer/registry.js +1 -1
- package/dist/components/viewers/docx-viewer/docx-viewer.class.js +1 -1
- package/dist/components/viewers/email-viewer/email-viewer.class.js +1 -1
- package/dist/components/viewers/html-viewer/html-viewer.class.js +1 -1
- package/dist/components/viewers/include/include.class.js +1 -1
- package/dist/components/viewers/index.d.ts +1 -1
- package/dist/components/viewers/index.js +1 -1
- package/dist/components/viewers/model-viewer/model-viewer-document.js +1 -0
- package/dist/components/viewers/model-viewer/model-viewer-loader.js +1 -0
- package/dist/components/viewers/model-viewer/model-viewer-register.d.ts +1 -0
- package/dist/components/viewers/model-viewer/model-viewer-register.js +1 -0
- package/dist/components/viewers/model-viewer/model-viewer-source.d.ts +1 -0
- package/dist/components/viewers/model-viewer/model-viewer-source.js +1 -0
- package/dist/components/viewers/model-viewer/model-viewer.class.d.ts +61 -0
- package/dist/components/viewers/model-viewer/model-viewer.class.js +9 -0
- package/dist/components/viewers/model-viewer/model-viewer.d.ts +1 -0
- package/dist/components/viewers/model-viewer/model-viewer.js +1 -0
- package/dist/components/viewers/model-viewer/model-viewer.styles.js +1 -0
- package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +2 -2
- package/dist/components/viewers/page-rail/page-rail.class.js +1 -1
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +1 -1
- package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +3 -3
- package/dist/components/viewers/svg-viewer/svg-viewer.class.js +1 -1
- package/dist/components/viewers/table-viewer-shared.js +1 -1
- package/dist/components/viewers/xml-viewer/xml-viewer.class.js +1 -1
- package/dist/custom-elements-jsx.d.ts +1 -1
- package/dist/events.d.ts +137 -92
- package/dist/framework-types.d.ts +2 -2
- package/dist/hydration.d.ts +1 -1
- package/dist/internal/ansi.d.ts +3 -1
- package/dist/internal/ansi.js +1 -1
- package/dist/internal/autoloader-manifest.js +1 -1
- package/dist/internal/autoloader-tags.d.ts +1 -1
- package/dist/internal/autoloader-tags.js +1 -1
- package/dist/internal/av-metadata.d.ts +13 -0
- package/dist/internal/av-metadata.js +1 -0
- package/dist/internal/collection-snapshot.js +1 -1
- package/dist/internal/component-loaders.generated.js +1 -1
- package/dist/internal/data-descriptors.d.ts +30 -0
- package/dist/internal/default-strings/agent-tools.generated.js +1 -1
- package/dist/internal/default-strings/charts.generated.js +1 -1
- package/dist/internal/default-strings/conversation.generated.js +1 -1
- package/dist/internal/default-strings/media.generated.js +1 -1
- package/dist/internal/default-strings/shared.generated.js +1 -1
- package/dist/internal/default-strings/viewers.generated.js +1 -1
- package/dist/internal/document-renderer-registry.d.ts +75 -0
- package/dist/internal/document-renderer-registry.js +1 -0
- package/dist/internal/drop-session-controller.js +1 -1
- package/dist/internal/engine-3d-loader.d.ts +47 -0
- package/dist/internal/engine-3d-loader.js +1 -0
- package/dist/internal/engine-3d.d.ts +57 -0
- package/dist/internal/engine-3d.js +1 -0
- package/dist/internal/hierarchy-source-controller.js +1 -1
- package/dist/internal/localization-runtime.js +1 -1
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +1 -1
- package/dist/internal/lyra-element.d.ts +2 -2
- package/dist/internal/lyra-element.js +1 -1
- package/dist/internal/model-viewer-contract.d.ts +5 -0
- package/dist/internal/model-viewer-contract.js +1 -0
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/positioner.js +1 -1
- package/dist/internal/rendered-state.js +1 -1
- package/dist/internal/root-registration-allowlist.js +1 -1
- package/dist/internal/scoped-definitions.generated.js +1 -1
- package/dist/internal/typed-columns.d.ts +39 -0
- package/dist/internal/typed-columns.js +1 -0
- package/dist/localization.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/dist/lyra.js +1 -1
- package/dist/ssr/all.d.ts +1 -1
- package/dist/ssr/all.js +1 -1
- package/dist/ssr.d.ts +4 -4
- package/dist/ssr.js +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/testing/lyra-tag-event-map.d.ts +2 -2
- package/dist/testing/lyra-tag-event-map.js +1 -1
- package/dist/theme/theme-bootstrap.js +1 -1
- package/dist/theme/theme.js +1 -1
- package/dist/vue.d.ts +1 -1
- package/llms/components/lr-accordion-item.md +2 -2
- package/llms/components/lr-agent-eval-dashboard.md +3 -3
- package/llms/components/lr-agent-run.md +3 -3
- package/llms/components/lr-agent-trace.md +1 -1
- package/llms/components/lr-agent-workspace.md +1 -1
- package/llms/components/lr-app-rail-item.md +1 -1
- package/llms/components/lr-app-rail.md +5 -6
- package/llms/components/lr-background-runs.md +4 -4
- package/llms/components/lr-calendar.md +1 -1
- package/llms/components/lr-change-review.md +5 -5
- package/llms/components/lr-chart-3d.md +164 -0
- package/llms/components/lr-chunk-inspector.md +4 -5
- package/llms/components/lr-citation-badge.md +1 -1
- package/llms/components/lr-code-block-core.md +2 -4
- package/llms/components/lr-command-palette.md +3 -3
- package/llms/components/lr-community-card.md +2 -2
- package/llms/components/lr-date-picker.md +1 -1
- package/llms/components/lr-details.md +2 -2
- package/llms/components/lr-diff-view.md +2 -2
- package/llms/components/lr-dock-panel.md +5 -10
- package/llms/components/lr-document-viewer.md +21 -14
- package/llms/components/lr-embedding-explorer.md +24 -4
- package/llms/components/lr-entity-dossier.md +3 -4
- package/llms/components/lr-eval-dataset.md +3 -3
- package/llms/components/lr-eval-run.md +7 -1
- package/llms/components/lr-file-input.md +10 -11
- package/llms/components/lr-flow-node.md +2 -3
- package/llms/components/lr-geojson-viewer.md +1 -1
- package/llms/components/lr-graph.md +21 -2
- package/llms/components/lr-grounding-summary.md +1 -1
- package/llms/components/lr-icon.md +1 -3
- package/llms/components/lr-image-viewer.md +29 -2
- package/llms/components/lr-ingestion-queue.md +1 -1
- package/llms/components/lr-knowledge-base-admin.md +2 -2
- package/llms/components/lr-knowledge-graph-explorer.md +7 -1
- package/llms/components/lr-known-date.md +3 -10
- package/llms/components/lr-lite-chart.md +1 -1
- package/llms/components/lr-map.md +861 -49
- package/llms/components/lr-markdown-core.md +1 -2
- package/llms/components/lr-memory-panel.md +4 -8
- package/llms/components/lr-model-viewer.md +170 -0
- package/llms/components/lr-navigation-menu.md +3 -4
- package/llms/components/lr-node-palette.md +1 -1
- package/llms/components/lr-path-strip.md +2 -3
- package/llms/components/lr-provenance-panel.md +3 -5
- package/llms/components/lr-qr-code.md +3 -4
- package/llms/components/lr-rag-answer.md +1 -1
- package/llms/components/lr-rag-eval-dashboard.md +2 -5
- package/llms/components/lr-retrieval-results.md +6 -7
- package/llms/components/lr-retrieval-trace.md +3 -4
- package/llms/components/lr-signature-pad.md +4 -3
- package/llms/components/lr-source-card.md +1 -1
- package/llms/components/lr-source-list.md +5 -5
- package/llms/components/lr-source-picker.md +2 -3
- package/llms/components/lr-span-waterfall.md +4 -3
- package/llms/components/lr-sparkline.md +3 -3
- package/llms/components/lr-subagent-panel.md +3 -3
- package/llms/components/lr-tool-call-chip.md +6 -6
- package/llms/components/lr-tool-timeline.md +1 -1
- package/llms/components/lr-video-playlist.md +3 -3
- package/llms/components/lr-video.md +29 -2
- package/llms/components/lr-virtual-list.md +3 -2
- package/llms/components/lr-widget.md +6 -13
- package/llms/index.md +98 -95
- package/llms/migration.md +27 -38
- package/llms/peers.md +7 -6
- package/llms/shared/ai-and-peers.md +1 -1
- package/llms/shared/events-and-types.md +8 -0
- package/llms/shared/imports-and-registration.md +2 -2
- package/llms/shared/v29-to-v30-migration.md +256 -0
- package/llms/shared.md +11 -3
- package/llms.txt +4 -4
- package/locales.json +1 -2328
- package/package.json +41 -13
- package/registrations.json +1 -1
- package/skills/lyra-ui/SKILL.md +4 -3
- /package/dist/{components/viewers/document-viewer → internal}/deferred-teardown.js +0 -0
- /package/dist/{components/viewers/document-viewer/registry-ownership.js → internal/document-renderer-registry-ownership.js} +0 -0
|
@@ -5,12 +5,10 @@ readonly relationships?:readonly Readonly<{path:readonly LyraPathElement[];}>[];
|
|
|
5
5
|
* section toggle plus the entity chips', community cards', path strips', and chunk inspector's
|
|
6
6
|
* events, all of which are `composed` and therefore reach a host listener on
|
|
7
7
|
* `<lr-provenance-panel>` itself. */
|
|
8
|
-
export interface LyraProvenancePanelEventMap extends Omit<LyraCommunityCardEventMap,'lr-entity-select'
|
|
8
|
+
export interface LyraProvenancePanelEventMap extends Omit<LyraCommunityCardEventMap,'lr-entity-select'>,Omit<LyraEntityChipEventMap,'lr-entity-select'>,Omit<LyraPathStripEventMap,'lr-entity-select'>,Omit<LyraChunkInspectorEventMap,'lr-toggle'>{
|
|
9
9
|
/** "The user picked this entity", surfaced unchanged from an embedded entity chip, community
|
|
10
10
|
* card or relationship path strip; only the path strip carries `occurrenceIndex`. */
|
|
11
|
-
'lr-entity-select':CustomEvent<{entityId:string;occurrenceIndex?:number;}>;
|
|
12
|
-
/** @deprecated Use `lr-entity-select`. */
|
|
13
|
-
'lr-entity-activate':CustomEvent<{entityId:string;occurrenceIndex?:number;}>;'lr-toggle':CustomEvent<{section:Section;expanded:boolean;itemId?:string;}>;}
|
|
11
|
+
'lr-entity-select':CustomEvent<{entityId:string;occurrenceIndex?:number;}>;'lr-toggle':CustomEvent<{section:Section;expanded:boolean;itemId?:string;}>;}
|
|
14
12
|
/**
|
|
15
13
|
* `<lr-provenance-panel>` — the grounding breakdown for one answer: a sectioned disclosure
|
|
16
14
|
* panel (Entities / Relationships / Communities / Text chunks) composing this family's own pieces.
|
|
@@ -27,8 +25,6 @@ export interface LyraProvenancePanelEventMap extends Omit<LyraCommunityCardEvent
|
|
|
27
25
|
* @event lr-entity-select - Surfaced unchanged from an embedded entity chip, community card or
|
|
28
26
|
* relationship path strip. `detail: { entityId, occurrenceIndex? }`; only the path strip sets
|
|
29
27
|
* `occurrenceIndex`.
|
|
30
|
-
* @event lr-entity-activate - Deprecated alias of `lr-entity-select`, dispatched right after it by
|
|
31
|
-
* an embedded community card or relationship path strip.
|
|
32
28
|
* @event lr-entity-open - Surfaced unchanged from an embedded entity chip (double-click, or Space
|
|
33
29
|
* while focused). `detail: { entityId }`.
|
|
34
30
|
* @event lr-drill - Surfaced unchanged from an embedded community card's title, drill button, or
|
|
@@ -37,8 +33,6 @@ export interface LyraProvenancePanelEventMap extends Omit<LyraCommunityCardEvent
|
|
|
37
33
|
* `detail: { relation, sourceNodeId?, targetNodeId?, occurrenceIndex }`.
|
|
38
34
|
* @event lr-chunk-open - Surfaced unchanged from an embedded chunk inspector.
|
|
39
35
|
* `detail: { chunkId, sourceId, anchor? }`.
|
|
40
|
-
* @event lr-chunk-toggle - Surfaced unchanged from an embedded chunk inspector.
|
|
41
|
-
* `detail: { chunkId, expanded }`.
|
|
42
36
|
* @csspart base - The root wrapper.
|
|
43
37
|
* @csspart section - One section's wrapper.
|
|
44
38
|
* @csspart header - A section's disclosure `<button>`.
|
|
@@ -16,8 +16,8 @@ action:CitationAction;}export interface LyraRagAnswerEventMap{'lr-citation-selec
|
|
|
16
16
|
* Both child citation signals (`lr-citation-activate` and `lr-citation-open`) are contained and
|
|
17
17
|
* translated to this component's single `lr-citation-select` event, with `section` identifying
|
|
18
18
|
* whether the answer citation row or grounding summary owned the badge and `action` which signal
|
|
19
|
-
* it was. The generated source cards' `lr-open` crosses this host;
|
|
20
|
-
* list's `lr-toggle
|
|
19
|
+
* it was. The generated source cards' `lr-open` crosses this host; the source cards' and the source
|
|
20
|
+
* list's `lr-toggle`, and the Markdown renderer's housekeeping events stay inside.
|
|
21
21
|
*
|
|
22
22
|
* @customElement lr-rag-answer
|
|
23
23
|
* @slot answer - Replaces the data-driven Markdown answer body.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{
|
|
1
|
+
import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity}from"../retrieval-identity.js";import{styles}from"./rag-answer.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{announceAfterFirstPaint}from"../retrieval-announcements.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import"../../overlays/empty/empty.class.js";import{LYRA_DEFAULT_ragAnswerCitations,LYRA_DEFAULT_ragAnswerEmpty,LYRA_DEFAULT_ragAnswerLabel,LYRA_DEFAULT_ragAnswerRetry,LYRA_DEFAULT_ragAnswerSources}from"../../../internal/default-strings/retrieval.generated.js";class LyraRagAnswer extends LyraElement{constructor(){super(...arguments),this.answer="",this.citations=[],this.sources=[],this.assessment=null,this.loading=!1,this.errorText="",this.announce=!1,this.withoutSources=!1,this.withoutClaims=!1,this.headingLevel="3",this.accessibleLabel=null,this.isMounting=!0,this.initialStateAnnounced=!1,this.connectionGeneration=0,this.onAnswerCitationActivate=this.answerCitationHandler("activate"),this.onAnswerCitationOpen=this.answerCitationHandler("open"),this.onGroundingCitationSelect=this.groundingCitationHandler("activate"),this.onGroundingCitationOpen=this.groundingCitationHandler("open"),this.stopGeneratedEvent=event=>{event.target.getRootNode()===this.renderRoot&&event.stopPropagation()}}static{this.defaultStrings={...super.defaultStrings,ragAnswerCitations:LYRA_DEFAULT_ragAnswerCitations,ragAnswerEmpty:LYRA_DEFAULT_ragAnswerEmpty,ragAnswerLabel:LYRA_DEFAULT_ragAnswerLabel,ragAnswerRetry:LYRA_DEFAULT_ragAnswerRetry,ragAnswerSources:LYRA_DEFAULT_ragAnswerSources}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["citations","sources","assessment"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-citation-select","lr-claim-select"])}connectedCallback(){super.connectedCallback(),this.errorAnnouncementSink??=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this});const generation=++this.connectionGeneration;announceAfterFirstPaint(this,()=>generation===this.connectionGeneration,()=>{!this.announce||this.initialStateAnnounced||(this.initialStateAnnounced=!0,this.announcePresentedState())});const MutationObserverCtor=this.ownerDocument.defaultView?.MutationObserver;MutationObserverCtor&&(this.slotObserver=new MutationObserverCtor(records=>{this.isConnected&&records.some(record=>record.type==="childList"?record.target===this:record.target.parentNode===this)&&this.requestUpdate()}),this.slotObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot"]}))}disconnectedCallback(){this.isMounting=!0,this.connectionGeneration+=1,this.slotObserver?.disconnect(),this.slotObserver=void 0,this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0,super.disconnectedCallback()}updated(changed){super.updated(changed);const wasMounting=this.isMounting;this.isMounting=!1,!wasMounting&&changed.has("errorText")&&this.errorText!==""&&this.isConnected&&(this.initialStateAnnounced=!0,this.errorAnnouncementSink?.announce(this.errorText))}announcePresentedState(){this.errorText!==""&&this.errorAnnouncementSink?.announce(this.errorText)}hasSlot(name){return Array.from(this.children).some(element=>element.getAttribute("slot")===name)}get normalizedCitations(){return this.citationsCache?.source!==this.citations&&(this.citationsCache={source:this.citations,value:firstByRetrievalIdentity(Array.isArray(this.citations)?this.citations:[],citation=>citation.id)}),this.citationsCache.value}get normalizedSources(){return firstByRetrievalIdentity(Array.isArray(this.sources)?this.sources:[],source=>source.id)}get normalizedAssessment(){const assessment=this.assessment;return this.assessmentCache?.source!==assessment&&(this.assessmentCache={source:assessment,value:!assessment||assessment.claims===void 0?assessment:{...assessment,claims:firstByRetrievalIdentity(Array.isArray(assessment.claims)?assessment.claims:[],claim=>claim.id)}}),this.assessmentCache.value}answerCitationHandler(action){return event=>{event.stopPropagation();const citation=this.normalizedCitations[event.detail.index-1];citation&&this.emit("lr-citation-select",{citation,section:"answer",action})}}groundingCitationHandler(action){return event=>{event.stopPropagation(),this.emit("lr-citation-select",{...event.detail,section:"grounding",action})}}stopOwnedEvent(event){event.stopPropagation()}presentationState(){return this.errorText?"error":this.loading?"loading":this.answer||this.hasSlot("answer")?"answer":"idle"}renderSource(source){return html`<lr-source-card
|
|
2
2
|
frame="plain"
|
|
3
3
|
size="s"
|
|
4
4
|
.sourceId=${source.id}
|
|
@@ -40,7 +40,7 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
|
|
|
40
40
|
${assessment?html`<lr-grounding-summary
|
|
41
41
|
part="grounding"
|
|
42
42
|
.assessment=${assessment}
|
|
43
|
-
.citations=${
|
|
43
|
+
.citations=${citations}
|
|
44
44
|
.withoutClaims=${this.withoutClaims}
|
|
45
45
|
.headingLevel=${this.headingLevel}
|
|
46
46
|
@lr-citation-select=${this.onGroundingCitationSelect}
|
|
@@ -73,7 +73,6 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
|
|
|
73
73
|
.label=${this.localize("ragAnswerSources")}
|
|
74
74
|
expanded
|
|
75
75
|
@lr-toggle=${this.stopGeneratedEvent}
|
|
76
|
-
@lr-expand=${this.stopGeneratedEvent}
|
|
77
76
|
>${this.renderSourceItems(sources)}</lr-source-list
|
|
78
77
|
>
|
|
79
78
|
</section>`:nothing}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js';import'../../charts/chart/lite-chart.class.js';import'../../data/stat/stat.class.js';import'../../overlays/empty/empty.class.js';export type LyraRagEvaluationMetricCategory='retrieval'|'generation'|'system'|(string&{});export type LyraRagEvaluationMetricFormat='number'|'percent';export interface LyraRagEvaluationMetric{id:string;label:string;category:LyraRagEvaluationMetricCategory;format?:LyraRagEvaluationMetricFormat;}export interface LyraRagEvaluationRun{id:string;label:string;metrics:Record<string,number>;slice?:string;timestamp?:string;metadata?:Record<string,unknown>;}export interface LyraRagEvalDashboardEventMap{'lr-metric-change-request':CustomEvent<{metricId:string;}>;
|
|
2
|
-
/** @deprecated Use `lr-metric-change-request`. */
|
|
3
|
-
'lr-metric-change':CustomEvent<{metricId:string;}>;'lr-slice-change-request':CustomEvent<{slice:string;}>;
|
|
4
|
-
/** @deprecated Use `lr-slice-change-request`. */
|
|
5
|
-
'lr-slice-change':CustomEvent<{slice:string;}>;'lr-run-activate':CustomEvent<{runId:string;run:LyraRagEvaluationRun;}>;
|
|
6
|
-
/** @deprecated Use `lr-run-activate`. */
|
|
7
|
-
'lr-run-change':CustomEvent<{run:LyraRagEvaluationRun;}>;}
|
|
1
|
+
import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js';import'../../charts/chart/lite-chart.class.js';import'../../data/stat/stat.class.js';import'../../overlays/empty/empty.class.js';export type LyraRagEvaluationMetricCategory='retrieval'|'generation'|'system'|(string&{});export type LyraRagEvaluationMetricFormat='number'|'percent';export interface LyraRagEvaluationMetric{id:string;label:string;category:LyraRagEvaluationMetricCategory;format?:LyraRagEvaluationMetricFormat;}export interface LyraRagEvaluationRun{id:string;label:string;metrics:Record<string,number>;slice?:string;timestamp?:string;metadata?:Record<string,unknown>;}export interface LyraRagEvalDashboardEventMap{'lr-metric-change-request':CustomEvent<{metricId:string;}>;'lr-slice-change-request':CustomEvent<{slice:string;}>;'lr-run-activate':CustomEvent<{runId:string;run:LyraRagEvaluationRun;}>;}
|
|
8
2
|
/**
|
|
9
3
|
* `<lr-rag-eval-dashboard>` — a controlled RAG quality overview with current metric cards,
|
|
10
4
|
* per-metric trends, evaluation slices, and run history. It displays host-computed metrics and
|
|
@@ -30,13 +24,9 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
|
|
|
30
24
|
* @customElement lr-rag-eval-dashboard
|
|
31
25
|
* @event lr-metric-change-request - A metric was activated; the host decides whether to change
|
|
32
26
|
* `metricId`. `detail: { metricId }`.
|
|
33
|
-
* @event lr-metric-change - Deprecated alias of `lr-metric-change-request`, dispatched right after it.
|
|
34
27
|
* @event lr-slice-change-request - An evaluation slice was activated; the host decides whether to
|
|
35
28
|
* change `slice`. `detail: { slice }`.
|
|
36
|
-
* @event lr-slice-change - Deprecated alias of `lr-slice-change-request`, dispatched right after it.
|
|
37
29
|
* @event lr-run-activate - An evaluation run was activated. `detail: { runId, run }`.
|
|
38
|
-
* @event lr-run-change - Deprecated alias of `lr-run-activate` (`detail: { run }`), dispatched right
|
|
39
|
-
* after it.
|
|
40
30
|
* @csspart input-limit - Original run admission-loss notice.
|
|
41
31
|
* @csspart slices-limit - Notice of available slices outside the bounded controls.
|
|
42
32
|
* @csspart base - The named dashboard region.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{property}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{isRovingTargetAvailable,resolveListMove}from"../../../internal/list-navigation.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity,isNonBlankIdentity,isRecord}from"../retrieval-identity.js";import{finiteRange}from"../../../internal/numbers.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import"../../charts/chart/lite-chart.class.js";import"../../data/stat/stat.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./rag-eval-dashboard.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{LYRA_DEFAULT_ragEvalDashboardAllSlices,LYRA_DEFAULT_ragEvalDashboardEmpty,LYRA_DEFAULT_ragEvalDashboardInputLimit,LYRA_DEFAULT_ragEvalDashboardLabel,LYRA_DEFAULT_ragEvalDashboardRuns,LYRA_DEFAULT_ragEvalDashboardSliceUnavailable,LYRA_DEFAULT_ragEvalDashboardSlices,LYRA_DEFAULT_ragEvalDashboardSlicesLimit}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_ragEvalDashboardRunsLimit}from"../../../internal/default-strings/shared.generated.js";const MAX_RENDERED_RUNS=500,MAX_SLICE_CONTROLS=500;class LyraRagEvalDashboard extends LyraElement{constructor(){super(...arguments),this.metrics=[],this.runs=[],this.metricId="",this.slice="",this.withoutChart=!1,this.headingLevel="2",this.chartHeight="220px",this.rovingRunId="",this.inputAnnouncements=new AnnouncementSinkController(this),this.lastInputNotice="",this.inputNoticeMounted=!1}static{this.defaultStrings={...super.defaultStrings,ragEvalDashboardAllSlices:LYRA_DEFAULT_ragEvalDashboardAllSlices,ragEvalDashboardEmpty:LYRA_DEFAULT_ragEvalDashboardEmpty,ragEvalDashboardInputLimit:LYRA_DEFAULT_ragEvalDashboardInputLimit,ragEvalDashboardLabel:LYRA_DEFAULT_ragEvalDashboardLabel,ragEvalDashboardRuns:LYRA_DEFAULT_ragEvalDashboardRuns,ragEvalDashboardRunsLimit:LYRA_DEFAULT_ragEvalDashboardRunsLimit,ragEvalDashboardSliceUnavailable:LYRA_DEFAULT_ragEvalDashboardSliceUnavailable,ragEvalDashboardSlices:LYRA_DEFAULT_ragEvalDashboardSlices,ragEvalDashboardSlicesLimit:LYRA_DEFAULT_ragEvalDashboardSlicesLimit}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["metrics","runs"])}static{this.appendOrderedCollectionProperties=Object.freeze(["runs"])}static{this.styles=[LyraElement.styles,styles]}get normalizedMetrics(){return this.metricsCache?.source!==this.metrics&&(this.metricsCache={source:this.metrics,value:firstByRetrievalIdentity(Array.isArray(this.metrics)?this.metrics:[],metric=>metric.id)}),this.metricsCache.value}get normalizedRuns(){return this.runsCache?.source!==this.runs&&(this.runsCache={source:this.runs,value:firstByRetrievalIdentity(Array.isArray(this.runs)?this.runs.filter(run=>isRecord(run)&&isNonBlankIdentity(run.id)&&typeof run.label=="string"&&isRecord(run.metrics)):[],run=>run.id)}),this.runsCache.value}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.inputNoticeMounted=!1}adoptedCallback(){super.adoptedCallback(),this.inputAnnouncements.adopted()}updated(changed){super.updated(changed);const derived=this.derivationCache,notice=[this.inputLimitMessage(),derived?this.slicesLimitMessage(derived.visibleSlices.length,derived.slices.length):""].filter(Boolean).join(" ");this.inputNoticeMounted&¬ice&¬ice!==this.lastInputNotice&&this.inputAnnouncements.announcePolite(notice),this.lastInputNotice=notice,this.inputNoticeMounted=!0}inputLimitMessage(){const loss=publicCollectionTruncation(this,"runs"),format=getNumberFormat(this.effectiveLocale);return loss?this.localize("ragEvalDashboardInputLimit",void 0,{count:format.format(loss.retained),total:format.format(loss.source)}):""}derived(runs,metrics){if(this.derivationCache?.runs===runs&&this.derivationCache.metrics===metrics&&this.derivationCache.slice===this.slice)return this.derivationCache;const slices=this.derivationCache?.runs===runs?this.derivationCache.slices:this.slices(runs),filtered=this.filteredRuns(runs),sliceAvailable=!this.slice||slices.includes(this.slice),visibleSlices=slices.slice(0,MAX_SLICE_CONTROLS-1);return this.slice&&sliceAvailable&&!visibleSlices.includes(this.slice)&&(visibleSlices[visibleSlices.length-1]=this.slice),this.derivationCache={runs,metrics,slice:this.slice,slices,visibleSlices,sliceAvailable,filtered,rendered:filtered.slice(-MAX_RENDERED_RUNS),latest:new Map(metrics.map(metric=>[metric.id,this.latestValue(metric,filtered)]))}}activeMetric(metrics){if(this.activeMetricCache?.metrics===metrics&&this.activeMetricCache.id===this.metricId)return this.activeMetricCache.value;const value=this.metricId?metrics.find(metric=>metric.id===this.metricId):metrics[0];return this.activeMetricCache={metrics,id:this.metricId,value},value}slices(runs){return[...new Set(runs.map(run=>run.slice).filter(slice=>!!slice))]}filteredRuns(runs){return this.slice?runs.filter(run=>run.slice===this.slice):runs}formatMetric(metric,raw){const value=Number.isFinite(raw)?raw:0;return metric.format==="percent"?getNumberFormat(this.effectiveLocale,{style:"percent",maximumFractionDigits:1}).format(finiteRange(value,0,0,1)):getNumberFormat(this.effectiveLocale,{maximumFractionDigits:3}).format(value)}latestValue(metric,runs){for(let index=runs.length-1;index>=0;index-=1){const value=runs[index].metrics[metric.id];if(Number.isFinite(value))return value}}requestMetric(metricId){this.emit("lr-metric-change-request",{metricId})
|
|
1
|
+
import{__decorate}from"tslib";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{property}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{isRovingTargetAvailable,resolveListMove}from"../../../internal/list-navigation.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity,isNonBlankIdentity,isRecord}from"../retrieval-identity.js";import{finiteRange}from"../../../internal/numbers.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import"../../charts/chart/lite-chart.class.js";import"../../data/stat/stat.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./rag-eval-dashboard.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{LYRA_DEFAULT_ragEvalDashboardAllSlices,LYRA_DEFAULT_ragEvalDashboardEmpty,LYRA_DEFAULT_ragEvalDashboardInputLimit,LYRA_DEFAULT_ragEvalDashboardLabel,LYRA_DEFAULT_ragEvalDashboardRuns,LYRA_DEFAULT_ragEvalDashboardSliceUnavailable,LYRA_DEFAULT_ragEvalDashboardSlices,LYRA_DEFAULT_ragEvalDashboardSlicesLimit}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_ragEvalDashboardRunsLimit}from"../../../internal/default-strings/shared.generated.js";const MAX_RENDERED_RUNS=500,MAX_SLICE_CONTROLS=500;class LyraRagEvalDashboard extends LyraElement{constructor(){super(...arguments),this.metrics=[],this.runs=[],this.metricId="",this.slice="",this.withoutChart=!1,this.headingLevel="2",this.chartHeight="220px",this.rovingRunId="",this.inputAnnouncements=new AnnouncementSinkController(this),this.lastInputNotice="",this.inputNoticeMounted=!1}static{this.defaultStrings={...super.defaultStrings,ragEvalDashboardAllSlices:LYRA_DEFAULT_ragEvalDashboardAllSlices,ragEvalDashboardEmpty:LYRA_DEFAULT_ragEvalDashboardEmpty,ragEvalDashboardInputLimit:LYRA_DEFAULT_ragEvalDashboardInputLimit,ragEvalDashboardLabel:LYRA_DEFAULT_ragEvalDashboardLabel,ragEvalDashboardRuns:LYRA_DEFAULT_ragEvalDashboardRuns,ragEvalDashboardRunsLimit:LYRA_DEFAULT_ragEvalDashboardRunsLimit,ragEvalDashboardSliceUnavailable:LYRA_DEFAULT_ragEvalDashboardSliceUnavailable,ragEvalDashboardSlices:LYRA_DEFAULT_ragEvalDashboardSlices,ragEvalDashboardSlicesLimit:LYRA_DEFAULT_ragEvalDashboardSlicesLimit}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["metrics","runs"])}static{this.appendOrderedCollectionProperties=Object.freeze(["runs"])}static{this.styles=[LyraElement.styles,styles]}get normalizedMetrics(){return this.metricsCache?.source!==this.metrics&&(this.metricsCache={source:this.metrics,value:firstByRetrievalIdentity(Array.isArray(this.metrics)?this.metrics:[],metric=>metric.id)}),this.metricsCache.value}get normalizedRuns(){return this.runsCache?.source!==this.runs&&(this.runsCache={source:this.runs,value:firstByRetrievalIdentity(Array.isArray(this.runs)?this.runs.filter(run=>isRecord(run)&&isNonBlankIdentity(run.id)&&typeof run.label=="string"&&isRecord(run.metrics)):[],run=>run.id)}),this.runsCache.value}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.inputNoticeMounted=!1}adoptedCallback(){super.adoptedCallback(),this.inputAnnouncements.adopted()}updated(changed){super.updated(changed);const derived=this.derivationCache,notice=[this.inputLimitMessage(),derived?this.slicesLimitMessage(derived.visibleSlices.length,derived.slices.length):""].filter(Boolean).join(" ");this.inputNoticeMounted&¬ice&¬ice!==this.lastInputNotice&&this.inputAnnouncements.announcePolite(notice),this.lastInputNotice=notice,this.inputNoticeMounted=!0}inputLimitMessage(){const loss=publicCollectionTruncation(this,"runs"),format=getNumberFormat(this.effectiveLocale);return loss?this.localize("ragEvalDashboardInputLimit",void 0,{count:format.format(loss.retained),total:format.format(loss.source)}):""}derived(runs,metrics){if(this.derivationCache?.runs===runs&&this.derivationCache.metrics===metrics&&this.derivationCache.slice===this.slice)return this.derivationCache;const slices=this.derivationCache?.runs===runs?this.derivationCache.slices:this.slices(runs),filtered=this.filteredRuns(runs),sliceAvailable=!this.slice||slices.includes(this.slice),visibleSlices=slices.slice(0,MAX_SLICE_CONTROLS-1);return this.slice&&sliceAvailable&&!visibleSlices.includes(this.slice)&&(visibleSlices[visibleSlices.length-1]=this.slice),this.derivationCache={runs,metrics,slice:this.slice,slices,visibleSlices,sliceAvailable,filtered,rendered:filtered.slice(-MAX_RENDERED_RUNS),latest:new Map(metrics.map(metric=>[metric.id,this.latestValue(metric,filtered)]))}}activeMetric(metrics){if(this.activeMetricCache?.metrics===metrics&&this.activeMetricCache.id===this.metricId)return this.activeMetricCache.value;const value=this.metricId?metrics.find(metric=>metric.id===this.metricId):metrics[0];return this.activeMetricCache={metrics,id:this.metricId,value},value}slices(runs){return[...new Set(runs.map(run=>run.slice).filter(slice=>!!slice))]}filteredRuns(runs){return this.slice?runs.filter(run=>run.slice===this.slice):runs}formatMetric(metric,raw){const value=Number.isFinite(raw)?raw:0;return metric.format==="percent"?getNumberFormat(this.effectiveLocale,{style:"percent",maximumFractionDigits:1}).format(finiteRange(value,0,0,1)):getNumberFormat(this.effectiveLocale,{maximumFractionDigits:3}).format(value)}latestValue(metric,runs){for(let index=runs.length-1;index>=0;index-=1){const value=runs[index].metrics[metric.id];if(Number.isFinite(value))return value}}requestMetric(metricId){this.emit("lr-metric-change-request",{metricId})}requestSlice(slice){this.emit("lr-slice-change-request",{slice})}activateRun(run){this.emit("lr-run-activate",{runId:run.id,run})}onRunKeyDown(event,index,count){const buttons=this.shadowRoot?.querySelectorAll('[part="run"]'),next=resolveListMove(event,{count,current:index,orientation:"vertical",isAvailable:candidate=>!!(buttons?.[candidate]&&isRovingTargetAvailable(buttons[candidate]))});next!==null&&(event.preventDefault(),buttons?.[next]?.focus())}slicesLimitMessage(count,total){return total>count?this.localize("ragEvalDashboardSlicesLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(count),total:getNumberFormat(this.effectiveLocale).format(total)}):""}renderSlices(slices,total=slices.length){if(!slices.length)return nothing;const allSlicesPart=this.slice?"slice":"slice slice-selected";return html`
|
|
2
2
|
<nav part="slices" aria-label=${this.localize("ragEvalDashboardSlices")}>
|
|
3
3
|
<button
|
|
4
4
|
part=${allSlicesPart}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type{LyraPageSource}from'../../../data-sources.js';import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{DocumentLocator,RetrievalChunk}from'../../../ai/types.js';import type{LyraScoreThresholds}from'../../../internal/score-tiers.js';export type{LyraScoreThresholds}from'../../../internal/score-tiers.js';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
/** A complete updated selection, both as bare ids and as one deterministic canonical
|
|
3
|
+
* `RetrievalChunk` record per id (`lr-selection-change` carries the same as `selectedChunkIds`).
|
|
4
|
+
* This contract is independent of the visible `without-dedupe` projection:
|
|
5
5
|
* duplicate rows never duplicate derived selection records. */
|
|
6
|
-
export interface RetrievalResultsSelectDetail{chunkIds:string[];chunks:RetrievalChunk[];}export interface LyraRetrievalResultsEventMap{'lr-selection-change':CustomEvent<LyraEventDetailSnapshot<{selectedChunkIds:string[];chunks:RetrievalChunk[];}>>;
|
|
7
|
-
/** @deprecated Use `lr-selection-change`. */
|
|
8
|
-
'lr-select':CustomEvent<LyraEventDetailSnapshot<RetrievalResultsSelectDetail>>;'lr-load-more':CustomEvent<null>;'lr-chunk-open':CustomEvent<LyraEventDetailSnapshot<{chunkId:string;sourceId:string;anchor?:DocumentLocator;}>>;}export type RetrievalResultsGrouping='source'|'custom'|'none';export type RetrievalResultsPresentation='compact'|'expanded';
|
|
6
|
+
export interface RetrievalResultsSelectDetail{chunkIds:string[];chunks:RetrievalChunk[];}export interface LyraRetrievalResultsEventMap{'lr-selection-change':CustomEvent<LyraEventDetailSnapshot<{selectedChunkIds:string[];chunks:RetrievalChunk[];}>>;'lr-load-more':CustomEvent<null>;'lr-chunk-open':CustomEvent<LyraEventDetailSnapshot<{chunkId:string;sourceId:string;anchor?:DocumentLocator;}>>;}export type RetrievalResultsGrouping='source'|'custom'|'none';export type RetrievalResultsPresentation='compact'|'expanded';
|
|
9
7
|
/** Query semantics apply to the complete provider collection before paging. */
|
|
10
8
|
export interface RetrievalResultsSourceQuery{readonly sort:'score'|'none';readonly withoutDedupe:boolean;readonly grouping:RetrievalResultsGrouping;readonly groupBy:LyraRetrievalResults['groupBy'];readonly groupLabel:LyraRetrievalResults['groupLabel'];readonly groupOrder:LyraRetrievalResults['groupOrder'];}export type RetrievalResultsSource=LyraPageSource<RetrievalChunk,RetrievalResultsSourceQuery>;
|
|
11
9
|
/**
|
|
@@ -80,13 +78,11 @@ export interface RetrievalResultsSourceQuery{readonly sort:'score'|'none';readon
|
|
|
80
78
|
* @event lr-selection-change - The selected-chunk set changed. `detail: { selectedChunkIds, chunks }` —
|
|
81
79
|
* `selectedChunkIds` is the complete updated selection (not just the toggled id), `chunks` the
|
|
82
80
|
* matching canonical `RetrievalChunk` records.
|
|
83
|
-
* @event lr-select - Deprecated alias of `lr-selection-change` (`detail: { chunkIds, chunks }`),
|
|
84
|
-
* dispatched right after it.
|
|
85
81
|
* @event lr-load-more - More results were requested — via the internal `<lr-virtual-list>`'s own
|
|
86
82
|
* scroll-near-bottom detection while virtualized, or the built-in `[part="load-more"]` button
|
|
87
83
|
* otherwise. Only ever fires while `has-more` is true and `loading` is false.
|
|
88
84
|
* @event lr-chunk-open - A row's title/open button was activated, forwarded verbatim from the
|
|
89
|
-
* per-row `<lr-chunk-inspector>`'s own `lr-chunk-open`; the inspector's `lr-
|
|
85
|
+
* per-row `<lr-chunk-inspector>`'s own `lr-chunk-open`; the inspector's `lr-toggle` and the
|
|
90
86
|
* virtual list's scroll events stay inside. `detail: { chunkId, sourceId, anchor? }` — the
|
|
91
87
|
* event a host routes into `<lr-document-viewer>`.
|
|
92
88
|
* @csspart base - The outer container and programmatic focus fallback when a controlled
|
|
@@ -147,7 +143,7 @@ export interface RetrievalResultsSourceQuery{readonly sort:'score'|'none';readon
|
|
|
147
143
|
export declare class LyraRetrievalResults extends LyraElement<LyraRetrievalResultsEventMap>{protected static collectionSupport:import("../../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly identityCollectionProperties:readonly string[];protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[];protected static readonly immutableEventDetails:readonly string[];
|
|
148
144
|
/** Canonical source records are frozen projections with opaque metadata. Legacy details are
|
|
149
145
|
* detached as one complete snapshot before entering this identity-preserving envelope. */
|
|
150
|
-
protected static readonly identityEventDetailCollectionItems:Readonly<{'lr-selection-change':readonly string[];
|
|
146
|
+
protected static readonly identityEventDetailCollectionItems:Readonly<{'lr-selection-change':readonly string[];}>;private _dataSource?;private sourceEpoch;private sourceVersion;private sourceLifecycle;private sourceSyncing;private sourceInputs?;private sourceQueryInputs?;private sourceResult?;private sourceRows;private sourceGroups;private sourceSelectionInputs?;private sourceSelectionEvent?;private sourceSelectionFailed;private sourceActiveInputs?;private sourceReveal?;private sourceAdapter?;private readonly sourceRowKeys;private sourceStateVersion;private readonly sourcePages;
|
|
151
147
|
/** Full-source provider; a present invalid source fails visibly instead of using chunks.
|
|
152
148
|
* Reassign the same provider or call requestUpdate() to refresh its revision/cache. */
|
|
153
149
|
get dataSource():RetrievalResultsSource|undefined;set dataSource(value:RetrievalResultsSource|undefined);
|
|
@@ -157,7 +153,7 @@ sourcePage:number;
|
|
|
157
153
|
sourcePageSize:number;
|
|
158
154
|
/** Current query total, or null before success/without a source. */
|
|
159
155
|
get sourceTotal():number|null;private get sourceMode();private get sourceBlocked();private get sourceSelectionBlocked();private projectSourceChunk;private validateSourcePage;private canonicalSourceAdapter;private syncSource;private syncSourceSelection;private acceptSourcePage;private syncSourceActive;private revealSourceActive;private currentSourceRow;private invalidateSourceLifecycle;adoptedCallback():void;
|
|
160
|
-
/** The raw (not deduplicated/sorted/grouped) result set. Host-owned. */
|
|
156
|
+
/** The raw (not deduplicated/sorted/grouped) result set. Host-owned. Assign a new array to update: mutating an array and assigning it again does not. */
|
|
161
157
|
chunks:readonly RetrievalChunk[];
|
|
162
158
|
/** Controlled selection, by chunk `id`. The component updates its own copy on toggle *then*
|
|
163
159
|
* emits `lr-selection-change`; reassign to control. An id with no matching chunk is harmless -- it simply
|
|
@@ -227,4 +223,4 @@ announce:boolean;
|
|
|
227
223
|
* says exactly what this region is. An explicit empty string clears the fallback. A non-empty
|
|
228
224
|
* host `aria-label` makes the host the sole overall owner; an explicitly empty host label stays
|
|
229
225
|
* empty on the region. */
|
|
230
|
-
label?:string;private expandedChunkIds;private pendingFocusTarget;private previousProcessedChunkIds;private focusRestoreGeneration;private isMounting;private initialStateAnnounced;private connectionGeneration;private errorAnnouncementSink?;private emptyAnnouncementSink?;private readonly retrievalChunkKey;private wasEmptyPresented;private processedChunksCache?;private processedGroupingLocaleSignature;private explicitRefresh;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;private canonicalSource?;private canonicalCache;private canonicalById;private canonicalOrder;private ordinalSource?;private ordinalById;private limitInitialized;private previouslyInputTruncated;private inputLimitText;private renderInputLimit;connectedCallback():void;disconnectedCallback():void;private deepActiveElement;private chunkAnchor;private renderedChunkIds;protected willUpdate(changed:PropertyValues<this>):void;private sourceStatusInitialized;private sourceStatus;protected updated(changed:PropertyValues<this>):void;private announcePresentedState;private restoreControlledFocus;private get effectiveVirtualizeAt();private canonicalChunks;private normalizedSelectedChunkIds;private get processedChunks();private computeProcessedChunks;private orderedGroupKeys;private bucketed;private stopOwnedEvent;private reportSelection;private toggleSelect;private
|
|
226
|
+
label?:string;private expandedChunkIds;private pendingFocusTarget;private previousProcessedChunkIds;private focusRestoreGeneration;private isMounting;private initialStateAnnounced;private connectionGeneration;private errorAnnouncementSink?;private emptyAnnouncementSink?;private readonly retrievalChunkKey;private wasEmptyPresented;private processedChunksCache?;private processedGroupingLocaleSignature;private explicitRefresh;requestUpdate(...args:Parameters<LyraElement['requestUpdate']>):void;private canonicalSource?;private canonicalCache;private canonicalById;private canonicalOrder;private ordinalSource?;private ordinalById;private limitInitialized;private previouslyInputTruncated;private inputLimitText;private renderInputLimit;connectedCallback():void;disconnectedCallback():void;private deepActiveElement;private chunkAnchor;private renderedChunkIds;protected willUpdate(changed:PropertyValues<this>):void;private sourceStatusInitialized;private sourceStatus;protected updated(changed:PropertyValues<this>):void;private announcePresentedState;private restoreControlledFocus;private get effectiveVirtualizeAt();private canonicalChunks;private normalizedSelectedChunkIds;private get processedChunks();private computeProcessedChunks;private orderedGroupKeys;private bucketed;private stopOwnedEvent;private reportSelection;private toggleSelect;private onChunkToggle;private readonly rowChunks;private rowChunksFor;private renderMetadata;private selectedMembership?;private isChunkSelected;private renderRow;private legacyLoadMoreHandler;private renderLoadMoreFooter;private renderSource;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-retrieval-results':LyraRetrievalResults;}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{SourcePageController}from"../../../internal/source-page-controller.js";import{readOwnDataValue}from"../../../internal/data-descriptors.js";import{collectionSupport,publicCollectionTruncation,writeNormalizedOwnedCollection,snapshotEventDetail}from"../../../internal/collection-snapshot.js";import{projectRetrievalChunk}from"./retrieval-results-model.js";import{tag}from"../../../internal/prefix.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{
|
|
1
|
+
import{__decorate}from"tslib";import{SourcePageController}from"../../../internal/source-page-controller.js";import{readOwnDataValue}from"../../../internal/data-descriptors.js";import{collectionSupport,publicCollectionTruncation,writeNormalizedOwnedCollection,snapshotEventDetail}from"../../../internal/collection-snapshot.js";import{projectRetrievalChunk}from"./retrieval-results-model.js";import{tag}from"../../../internal/prefix.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity,canonicalIdentityList}from"../retrieval-identity.js";import{finiteCount,finiteRange,finiteInteger}from"../../../internal/numbers.js";import{styles}from"./retrieval-results.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{renderRetrievalMetadata}from"../retrieval-metadata.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{announceAfterFirstPaint}from"../retrieval-announcements.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{LYRA_DEFAULT_chunkInspectorEmpty,LYRA_DEFAULT_chunkInspectorLabel,LYRA_DEFAULT_retrievalResultsInputLimit,LYRA_DEFAULT_retrievalResultsSelectRowOrdinal,LYRA_DEFAULT_untitledSource,LYRA_DEFAULT_valueTruncated}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_loadMore,LYRA_DEFAULT_loading,LYRA_DEFAULT_retry,LYRA_DEFAULT_sourceSelectionFailed,LYRA_DEFAULT_sourceSelectionLoading,LYRA_DEFAULT_tableLoadFailed,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";function toLyraChunk(chunk){return{id:chunk.id,text:chunk.text,score:chunk.score,sourceId:chunk.source.id,title:chunk.source.name,anchor:chunk.locator,page:chunk.locator?.kind==="page"?chunk.locator.page:void 0}}function safeScore(score){return finiteRange(score,0,0,1)}class LyraRetrievalResults extends LyraElement{constructor(){super(...arguments),this.sourceEpoch=0,this.sourceVersion=0,this.sourceLifecycle=0,this.sourceSyncing=!1,this.sourceRows=[],this.sourceGroups=[],this.sourceSelectionFailed=!1,this.sourceRowKeys=new WeakMap,this.sourceStateVersion=0,this.sourcePages=new SourcePageController(this,{normalizeRecord:(record,isCurrent)=>this.projectSourceChunk(record,isCurrent),validateMetadata:(result,query)=>this.validateSourcePage(result,query),onChange:()=>{this.sourceStateVersion++}}),this.sourcePage=0,this.sourcePageSize=100,this.chunks=[],this.selectedChunkIds=[],this.withoutSelection=!1,this.withoutDedupe=!1,this.sort="score",this.grouping="none",this.presentation="expanded",this.thresholds={high:.75,medium:.5},this.virtualizeAt=50,this.activeChunkId="",this.loading=!1,this.hasMore=!1,this.errorText="",this.announce=!1,this.expandedChunkIds=[],this.previousProcessedChunkIds=[],this.focusRestoreGeneration=0,this.isMounting=!0,this.initialStateAnnounced=!1,this.connectionGeneration=0,this.retrievalChunkKey=item=>this.sourceRowKeys.get(item)??item.id,this.wasEmptyPresented=!1,this.processedGroupingLocaleSignature="",this.explicitRefresh=!1,this.canonicalCache=[],this.canonicalById=new Map,this.canonicalOrder=new Map,this.ordinalById=new Map,this.limitInitialized=!1,this.previouslyInputTruncated=!1,this.sourceStatusInitialized=!1,this.sourceStatus="",this.stopOwnedEvent=event=>{event.stopPropagation()},this.onChunkToggle=event=>{event.stopPropagation();const{itemId:chunkId,expanded}=event.detail,rest=this.expandedChunkIds.filter(id=>id!==chunkId);this.expandedChunkIds=expanded?[...rest,chunkId]:rest},this.rowChunks=new WeakMap,this.renderRow=(item,index,total)=>{const chunk=item,selected=this.isChunkSelected(chunk.id),rowLabel=chunk.source.name||this.localize("untitledSource");return html`
|
|
2
2
|
${this.withoutSelection?nothing:html`<lr-checkbox
|
|
3
3
|
part="select"
|
|
4
4
|
data-chunk-id=${chunk.id}
|
|
@@ -27,12 +27,11 @@ import{__decorate}from"tslib";import{SourcePageController}from"../../../internal
|
|
|
27
27
|
.ordinalTotal=${total}
|
|
28
28
|
label=${rowLabel}
|
|
29
29
|
@lr-chunk-open=${e=>{e.stopPropagation(),this.currentSourceRow(chunk)&&this.emit("lr-chunk-open",e.detail)}}
|
|
30
|
-
@lr-
|
|
31
|
-
@lr-toggle=${this.stopRowToggle}
|
|
30
|
+
@lr-toggle=${event=>{event.stopPropagation(),this.currentSourceRow(chunk)&&this.onChunkToggle(event)}}
|
|
32
31
|
></lr-chunk-inspector>
|
|
33
32
|
${this.presentation==="expanded"?this.renderMetadata(chunk.metadata):nothing}
|
|
34
33
|
</div>
|
|
35
|
-
`}}static{this.defaultStrings={...super.defaultStrings,chunkInspectorEmpty:LYRA_DEFAULT_chunkInspectorEmpty,chunkInspectorLabel:LYRA_DEFAULT_chunkInspectorLabel,loadMore:LYRA_DEFAULT_loadMore,loading:LYRA_DEFAULT_loading,retrievalResultsInputLimit:LYRA_DEFAULT_retrievalResultsInputLimit,retrievalResultsSelectRowOrdinal:LYRA_DEFAULT_retrievalResultsSelectRowOrdinal,retry:LYRA_DEFAULT_retry,sourceSelectionFailed:LYRA_DEFAULT_sourceSelectionFailed,sourceSelectionLoading:LYRA_DEFAULT_sourceSelectionLoading,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,untitledSource:LYRA_DEFAULT_untitledSource,valueInvalid:LYRA_DEFAULT_valueInvalid,valueTruncated:LYRA_DEFAULT_valueTruncated}}static{this.collectionSupport=collectionSupport}static{this.identityCollectionProperties=Object.freeze(["chunks"])}static{this.ownedCollectionProperties=Object.freeze(["chunks","selectedChunkIds","groupOrder"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-selection-change","lr-select","lr-chunk-open"])}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-selection-change":Object.freeze(["chunks"]),"lr-select":Object.freeze(["chunks"])})}get dataSource(){return this._dataSource}set dataSource(value){const old=this._dataSource;this._dataSource=value,this.sourceEpoch++,this.requestUpdate("dataSource",old)}get sourceTotal(){return this.sourceMode?this.sourcePages.state.result?.total??null:null}get sourceMode(){return this.dataSource!==void 0}get sourceBlocked(){return this.sourceMode&&(!this.isConnected||!!this.errorText||this.sourcePages.state.pending||!this.sourcePages.state.result)}get sourceSelectionBlocked(){return this.sourceBlocked||this.sourceMode&&(this.sourcePages.state.selectionPending||this.sourceSelectionFailed)}projectSourceChunk(record,isCurrent){let units=0;const read=(input,key)=>{if(!isCurrent())throw new Error("Obsolete source chunk");const value2=readOwnDataValue(input,key);if(!isCurrent())throw new Error("Obsolete source chunk");return value2},fields=(input,keys)=>{if(!input||typeof input!="object"||Array.isArray(input))throw new TypeError("Invalid source chunk");const copy={};for(const key of keys){const value2=read(input,key);if(typeof value2=="string"&&(units+=value2.length,value2.length>65536||units>65536))throw new RangeError("Source chunk text too large");value2!==void 0&&(copy[key]=value2)}return copy},raw=fields(record.value,["id","text","score","metadata","rank","queryId","stage","traceId","scores"]);raw.source=fields(read(record.value,"source"),["id","name","mimeType","uri","version"]);const locator=read(record.value,"locator");if(locator!==void 0){const projected=fields(locator,["kind","page","quote","prefix","suffix","id","start","end","sheet","range","cfi"]);for(const key of["kind","quote","prefix","suffix","id","sheet","range","cfi"])if(projected[key]!==void 0&&typeof projected[key]!="string")throw new TypeError("Invalid source locator text");for(const key of["page","start","end"])if(projected[key]!==void 0&&(typeof projected[key]!="number"||!Number.isFinite(projected[key])))throw new TypeError("Invalid source locator number");const rect=read(locator,"rect");if(rect!==void 0){const coordinates=fields(rect,["x","y","width","height"]);for(const key of["x","y","width","height"])if(typeof coordinates[key]!="number"||!Number.isFinite(coordinates[key]))throw new TypeError("Invalid source locator rectangle");projected.rect=coordinates}const path=read(locator,"path");if(path!==void 0){if(!Array.isArray(path))throw new TypeError("Invalid source locator path");const length=read(path,"length");if(typeof length!="number"||!Number.isSafeInteger(length)||length<0||length>500)throw new RangeError("Source locator path too large");projected.path=Array.from({length},(_,index)=>{const value2=read(path,String(index));if(typeof value2!="string"&&typeof value2!="number")throw new TypeError("Invalid source locator path");if(typeof value2=="string"&&(units+=value2.length,units>65536))throw new RangeError("Source chunk text too large");return value2})}raw.locator=projected}const scores=raw.scores;scores&&typeof scores=="object"&&!Array.isArray(scores)&&(raw.scores=fields(scores,["dense","sparse","rerank","final"]));const value=projectRetrievalChunk(raw);if(!isCurrent())throw new Error("Obsolete source chunk");if(!value)throw new TypeError("Invalid source chunk");return this.sourceRowKeys.set(value,record.key),{key:record.key,order:record.order,value}}validateSourcePage(result,query){if(!query.withoutDedupe&&result.rows.some(record=>record.key!==record.value.id))throw new TypeError("Invalid canonical source identity");if(query.grouping==="none"){if(result.groups?.length)throw new TypeError("Unexpected source groups");return}if(!result.groups)throw new TypeError("Missing source groups");if(!result.rows.length)return;const size=this.sourcePages.state.pageSize,start=Math.min(this.sourcePages.state.page,Math.floor((result.total-1)/size))*size,end=start+result.rows.length;let covered=start,previousEnd=-1;for(const group of result.groups){if(group.startIndex<previousEnd||Math.max(start,group.startIndex)!==covered)throw new TypeError("Invalid source group coverage");previousEnd=group.startIndex+group.itemCount,covered=Math.min(end,previousEnd)}if(covered!==end)throw new TypeError("Incomplete source groups")}canonicalSourceAdapter(source){if(this.sourceAdapter?.original===source)return this.sourceAdapter.adapter;if(!source||typeof source.query!="function"||typeof source.lookup!="function"||typeof source.locate!="function")throw new TypeError("Invalid source");const adapter={revision:source.revision,query:request=>source.query(request),locate:(key,query,context)=>source.locate(key,query,context),lookup:async(keys,context)=>{const records=await source.lookup(keys,context);if(!Array.isArray(records)||records.length>500)throw new TypeError("Invalid canonical lookup");for(let index=0;index<records.length;index++){const record=readOwnDataValue(records,String(index)),key=readOwnDataValue(record,"key"),value=readOwnDataValue(record,"value");if(key!==readOwnDataValue(value,"id"))throw new TypeError("Invalid canonical lookup identity")}return records}};return this.sourceAdapter={original:source,adapter},adapter}syncSource(force=!1){if(!(!this.sourcePages||this.sourceSyncing)){this.sourceSyncing=!0;try{if(!this.sourceMode){this.sourceInputs&&(this.sourceVersion++,this.focusRestoreGeneration++,this.sourcePages.bind(void 0),this.processedChunksCache=void 0),this.sourceInputs=void 0,this.sourceQueryInputs=void 0,this.sourceResult=void 0,this.sourceRows=[],this.sourceGroups=[],this.sourceSelectionInputs=void 0,this.sourceSelectionEvent=void 0,this.sourceActiveInputs=void 0,this.sourceReveal=void 0;return}const source=this.dataSource,size=finiteInteger(this.sourcePageSize,100,1,500);let page=finiteInteger(this.sourcePage,0,0,Math.floor(Number.MAX_SAFE_INTEGER/size));const queryInputs=[this.sort,this.withoutDedupe,this.grouping,this.groupBy,this.groupLabel,this.groupOrder,size];this.hasUpdated&&this.sourceQueryInputs&&queryInputs.some((value,index)=>value!==this.sourceQueryInputs[index])&&(page=0,this.sourcePage=0),this.sourceQueryInputs=queryInputs;const inputs=[source,source.revision,this.sourceEpoch,this.effectiveLocale,...queryInputs,page];if(!force&&this.sourceInputs&&inputs.every((value,index)=>value===this.sourceInputs[index]))return;(!this.sourceInputs||inputs.slice(0,3).some((value,index)=>value!==this.sourceInputs[index]))&&(this.sourceSelectionInputs=void 0,this.sourceSelectionEvent=void 0),this.sourceInputs=inputs,this.sourceVersion++,this.focusRestoreGeneration++,this.sourceRows=[],this.sourceGroups=[],this.sourceResult=void 0,this.sourceReveal=void 0,this.expandedChunkIds=[],this.sourcePages.bind({source:this.canonicalSourceAdapter(source),revision:source.revision,epoch:this.sourceEpoch,locale:this.effectiveLocale});const query=Object.freeze({sort:this.sort,withoutDedupe:this.withoutDedupe,grouping:this.grouping,groupBy:this.groupBy,groupLabel:this.groupLabel,groupOrder:this.groupOrder});this.sourcePages.request(query,page,size)}catch{this.sourcePages.bind(void 0),this.sourceRows=[],this.sourceGroups=[],this.sourceResult=void 0}finally{this.sourceSyncing=!1}}}syncSourceSelection(){if(!this.sourceMode||!this.isConnected||!this.sourceAdapter||!this.sourceInputs)return;const ids=this.selectedChunkIds,source=this.dataSource,epoch=this.sourceEpoch,revision=source.revision,inputs=[source,revision,epoch,ids];if(this.sourceSelectionInputs&&inputs.every((value,index)=>value===this.sourceSelectionInputs[index]))return;this.sourceSelectionInputs=inputs,this.sourceSelectionFailed=!1;const owner=this.ownerDocument,lifecycle=this.sourceLifecycle,canonicalIds=canonicalIdentityList(ids);this.sourcePages.resolveSelection(canonicalIds).then(records=>{if(source.revision!==revision||lifecycle!==this.sourceLifecycle||!this.isConnected||this.ownerDocument!==owner||this.dataSource!==source||this.sourceEpoch!==epoch||this.selectedChunkIds!==ids)return;if(!records){this.sourceSelectionFailed=!0,this.sourceStateVersion++;return}const retained=new Set(records.map(record=>record.key)),accepted=canonicalIds.filter(id=>retained.has(id)),report=this.sourceSelectionEvent===ids;this.sourceSelectionEvent=void 0,accepted.length!==ids.length&&(this.selectedChunkIds=accepted);const committed=this.selectedChunkIds;if(report){const chunks=records.map(record=>record.value);this.emit("lr-selection-change",{selectedChunkIds:[...committed],chunks}),source.revision===revision&&lifecycle===this.sourceLifecycle&&this.isConnected&&this.ownerDocument===owner&&this.dataSource===source&&this.sourceEpoch===epoch&&this.selectedChunkIds===committed&&this.emit("lr-select",{chunkIds:[...committed],chunks})}this.sourceStateVersion++})}acceptSourcePage(){const result=this.sourcePages.state.result;if(!result||result===this.sourceResult)return;this.sourceResult=result,this.sourceRows=result.rows.map(record=>record.value);const start=this.sourcePages.state.page*this.sourcePages.state.pageSize;this.sourceGroups=(result.groups??[]).map(group=>({key:group.key,label:group.label,startIndex:Math.max(0,group.startIndex-start)})),this.sourcePage!==this.sourcePages.state.page&&(this.sourceSyncing=!0,this.sourcePage=this.sourcePages.state.page,this.sourceSyncing=!1,this.sourceInputs=this.sourceInputs?[...this.sourceInputs.slice(0,-1),this.sourcePages.state.page]:void 0);const reveal=this.sourceReveal;this.sourceReveal=void 0,reveal?.version===this.sourceVersion&&this.revealSourceActive(reveal.id,reveal.version)}syncSourceActive(){if(!this.activeChunkId){this.sourceActiveInputs=void 0;return}if(this.sourceBlocked)return;const source=this.dataSource,id=this.activeChunkId,inputs=[source,source.revision,this.sourceEpoch,this.effectiveLocale,...this.sourceQueryInputs??[],id];if(this.sourceActiveInputs&&inputs.every((value,index)=>value===this.sourceActiveInputs[index]))return;this.sourceActiveInputs=inputs;const version=this.sourceVersion,owner=this.ownerDocument;this.sourcePages.locate(id).then(index=>{if(index===null||!this.isConnected||this.ownerDocument!==owner||!this.sourceMode||this.dataSource!==source||this.sourceVersion!==version||this.activeChunkId!==id)return;const page=Math.floor(index/finiteInteger(this.sourcePageSize,100,1,500));if(page===this.sourcePage){this.revealSourceActive(id,version);return}this.sourcePage=page,this.sourceReveal={id,version:this.sourceVersion}})}revealSourceActive(id,version){const owner=this.ownerDocument;this.updateComplete.then(async()=>{const list=this.renderRoot.querySelector(tag("virtual-list"));if(!list||(await list.updateComplete,!this.isConnected||this.ownerDocument!==owner||!this.sourceMode||this.sourceBlocked||this.sourceVersion!==version||this.activeChunkId!==id||list!==this.renderRoot.querySelector(tag("virtual-list"))))return;const index=this.sourceRows.findIndex(chunk=>chunk.id===id);index>=0&&list.scrollToIndex(index,{align:"auto",behavior:"auto"})})}currentSourceRow(chunk){return!(this.sourceMode||this.sourceRowKeys.has(chunk))||this.sourceMode&&!this.sourceBlocked&&this.sourceRows.includes(chunk)}invalidateSourceLifecycle(){this.sourceLifecycle++,this.sourceVersion++,this.focusRestoreGeneration++,this.sourceSelectionInputs=void 0,this.sourceSelectionEvent=void 0,this.sourceActiveInputs=void 0,this.sourceReveal=void 0,this.sourceStatusInitialized=!1,this.sourceStatus=""}adoptedCallback(){this.invalidateSourceLifecycle(),this.sourcePages.adopted(),super.adoptedCallback()}requestUpdate(...args){args[0]===void 0&&(this.explicitRefresh=!0,this.sourceEpoch=(this.sourceEpoch??0)+1),args[0]==="selectedChunkIds"&&(this.sourceSelectionEvent=void 0),(args[0]===void 0||["dataSource","sourcePage","sourcePageSize","sort","withoutDedupe","grouping","groupBy","groupLabel","groupOrder"].includes(String(args[0])))&&this.syncSource(),super.requestUpdate(...args)}inputLimitText(){if(this.sourceMode)return"";const truncation=publicCollectionTruncation(this,"chunks"),number=getNumberFormat(this.effectiveLocale);return truncation?this.localize("retrievalResultsInputLimit",void 0,{count:number.format(truncation.retained),total:number.format(truncation.source)}):""}renderInputLimit(){const text=this.inputLimitText();return text?html`<p part="limit" role="note">${text}</p>`:nothing}connectedCallback(){super.connectedCallback(),this.errorAnnouncementSink??=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this}),this.emptyAnnouncementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this});const generation=++this.connectionGeneration;announceAfterFirstPaint(this,()=>generation===this.connectionGeneration,()=>{!this.announce||this.initialStateAnnounced||(this.initialStateAnnounced=!0,this.announcePresentedState())})}disconnectedCallback(){this.invalidateSourceLifecycle(),this.isMounting=!0,this.connectionGeneration+=1,this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0,this.emptyAnnouncementSink?.release(),this.emptyAnnouncementSink=void 0,this.wasEmptyPresented=!1,super.disconnectedCallback()}deepActiveElement(){return deepActiveElementIn(this.isConnected?this.shadowRoot:null)}chunkAnchor(start){let current=start;for(;current&¤t!==this;){if(current.hasAttribute("data-chunk-id"))return current;if(current.parentElement){current=current.parentElement;continue}const root=current.getRootNode();current=root.nodeType===11&&"host"in root?root.host:null}return null}renderedChunkIds(){const roots=[this.renderRoot],virtualList=this.renderRoot.querySelector(tag("virtual-list"));return virtualList?.shadowRoot&&roots.push(virtualList.shadowRoot),roots.flatMap(root=>[...root.querySelectorAll(`${tag("chunk-inspector")}[data-chunk-id]`)].map(element=>element.getAttribute("data-chunk-id")).filter(id=>id!==null))}willUpdate(changed){if(super.willUpdate(changed),this.syncSource(),this.sourceMode){this.acceptSourcePage(),this.syncSourceSelection(),this.syncSourceActive();return}const refresh=this.explicitRefresh;this.explicitRefresh=!1;const groupingLocaleSignature=this.grouping==="source"?`${this.effectiveLocale}\0${this.localize("untitledSource")}`:"";if((this.processedChunksCache===void 0||refresh||changed.has("chunks")||changed.has("withoutDedupe")||changed.has("sort")||changed.has("grouping")||changed.has("groupBy")||changed.has("groupLabel")||changed.has("groupOrder")||groupingLocaleSignature!==this.processedGroupingLocaleSignature)&&(this.processedGroupingLocaleSignature=groupingLocaleSignature,this.processedChunksCache=this.computeProcessedChunks()),changed.has("chunks")){const present=new Set(this.processedChunks.chunks.map(chunk=>chunk.id)),kept=this.expandedChunkIds.filter(id=>present.has(id));kept.length!==this.expandedChunkIds.length&&(this.expandedChunkIds=kept)}if(changed.has("chunks")||changed.has("selectedChunkIds")){const normalized=this.normalizedSelectedChunkIds();if(normalized.length!==this.selectedChunkIds.length||normalized.some((id,index)=>id!==this.selectedChunkIds[index])){const shouldAnnounce=this.hasUpdated&&changed.has("chunks");writeNormalizedOwnedCollection(this,"selectedChunkIds",()=>{this.selectedChunkIds=normalized}),shouldAnnounce&&this.reportSelection(normalized)}}if(!changed.has("chunks")&&!changed.has("withoutDedupe")&&!changed.has("sort")&&!changed.has("grouping")&&!changed.has("groupBy")&&!changed.has("groupLabel")&&!changed.has("groupOrder")&&!changed.has("presentation")&&!changed.has("withoutSelection")&&!changed.has("virtualizeAt")&&!changed.has("loading")&&!changed.has("errorText"))return;const focusedId=this.chunkAnchor(this.deepActiveElement())?.getAttribute("data-chunk-id");if(!focusedId)return;const previousIds=this.previousProcessedChunkIds.length?this.previousProcessedChunkIds:this.renderedChunkIds(),focusedIndex=Math.max(0,previousIds.indexOf(focusedId)),nextChunks=this.errorText?[]:this.processedChunks.chunks;if(nextChunks.length===0){this.pendingFocusTarget="base";return}const survivingIndex=nextChunks.findIndex(chunk=>chunk.id===focusedId),nextIndex=survivingIndex>=0?survivingIndex:Math.min(focusedIndex,nextChunks.length-1);this.pendingFocusTarget=nextChunks[nextIndex].id}updated(changed){if(super.updated(changed),this.sourceMode){const status=this.sourcePages.state.pending?this.localize("loading"):this.sourcePages.state.result?this.sourcePages.state.selectionPending?this.localize("sourceSelectionLoading"):this.sourceSelectionFailed?this.localize("sourceSelectionFailed"):"":this.localize("tableLoadFailed");this.sourceStatusInitialized&&status&&status!==this.sourceStatus&&this.emptyAnnouncementSink?.announce(status),this.sourceStatusInitialized=!0,this.sourceStatus=status;return}const inputTruncated=publicCollectionTruncation(this,"chunks")!==void 0;this.limitInitialized&&inputTruncated&&!this.previouslyInputTruncated&&this.emptyAnnouncementSink?.announce(this.inputLimitText()),this.limitInitialized=!0,this.previouslyInputTruncated=inputTruncated;const wasMounting=this.isMounting;this.isMounting=!1,!wasMounting&&changed.has("errorText")&&this.errorText!==""&&this.isConnected&&(this.initialStateAnnounced=!0,this.errorAnnouncementSink?.announce(this.errorText));const emptyPresented=!this.loading&&this.errorText===""&&this.processedChunks.chunks.length===0;!wasMounting&&!this.wasEmptyPresented&&emptyPresented&&this.isConnected&&(this.initialStateAnnounced=!0,this.emptyAnnouncementSink?.announce(this.localize("chunkInspectorEmpty"))),this.wasEmptyPresented=emptyPresented,this.previousProcessedChunkIds=this.errorText?[]:this.processedChunks.chunks.map(chunk=>chunk.id);const generation=++this.focusRestoreGeneration,target=this.pendingFocusTarget;target!==void 0&&(this.pendingFocusTarget=void 0,this.restoreControlledFocus(target,generation))}announcePresentedState(){if(!this.sourceMode){if(this.errorText!==""){this.errorAnnouncementSink?.announce(this.errorText);return}!this.loading&&this.processedChunks.chunks.length===0&&this.emptyAnnouncementSink?.announce(this.localize("chunkInspectorEmpty"))}}async restoreControlledFocus(target,generation){if(await this.updateComplete,generation!==this.focusRestoreGeneration||!this.isConnected)return;if(target==="base"){this.renderRoot.querySelector('[part="base"]')?.focus();return}const virtualList=this.renderRoot.querySelector(tag("virtual-list"));if(await virtualList?.updateComplete,generation!==this.focusRestoreGeneration||!this.isConnected)return;const roots=[this.renderRoot];virtualList?.shadowRoot&&roots.push(virtualList.shadowRoot);const candidates=roots.flatMap(root=>[...root.querySelectorAll("[data-chunk-id]")]),checkbox=candidates.find(element=>element.localName===tag("checkbox")&&element.getAttribute("data-chunk-id")===target);if(checkbox){checkbox.focus();return}const inspector=candidates.find(element=>element.localName===tag("chunk-inspector")&&element.getAttribute("data-chunk-id")===target);await inspector?.updateComplete,!(generation!==this.focusRestoreGeneration||!this.isConnected)&&inspector?.shadowRoot?.querySelector('[part="open-button"]')?.focus()}get effectiveVirtualizeAt(){return finiteCount(this.virtualizeAt,50)}canonicalChunks(){return this.canonicalSource!==this.chunks&&(this.canonicalSource=this.chunks,this.canonicalCache=firstByRetrievalIdentity(this.chunks.flatMap(value=>projectRetrievalChunk(value)??[]),chunk=>chunk.id),this.canonicalById=new Map(this.canonicalCache.map(chunk=>[chunk.id,chunk])),this.canonicalOrder=new Map(this.canonicalCache.map((chunk,index)=>[chunk.id,index]))),this.canonicalCache}normalizedSelectedChunkIds(){return this.canonicalSource!==this.chunks&&this.canonicalChunks(),canonicalIdentityList(this.selectedChunkIds).filter(id=>this.canonicalById.has(id))}get processedChunks(){return this.sourceMode?{chunks:this.sourceRows,groups:this.sourceGroups}:this.processedChunksCache??=this.computeProcessedChunks()}computeProcessedChunks(){const canonical=this.canonicalChunks(),sorted=this.sort==="score"?[...canonical].sort((a,b)=>safeScore(b.score)-safeScore(a.score)):canonical;if(this.grouping==="source")return this.bucketed(sorted,chunk=>chunk.source.id,(_id,groupChunks)=>groupChunks[0].source.name||this.localize("untitledSource"));if(this.grouping==="custom"&&this.groupBy){const groupBy=this.groupBy;return this.bucketed(sorted,groupBy,(id,groupChunks)=>this.groupLabel?.(id,groupChunks)??id)}return{chunks:sorted,groups:[]}}orderedGroupKeys(grouped){const firstSeen=[...grouped.keys()];if(this.grouping!=="custom"||!this.groupOrder)return firstSeen;if(typeof this.groupOrder=="function")return firstSeen.sort(this.groupOrder);const ordered=[...new Set(this.groupOrder)].filter(id=>grouped.has(id)),listed=new Set(ordered);return[...ordered,...firstSeen.filter(id=>!listed.has(id))]}bucketed(sorted,keyOf,labelOf){const grouped=new Map;for(const chunk of sorted){const key=keyOf(chunk),existing=grouped.get(key);existing?existing.push(chunk):grouped.set(key,[chunk])}const rows=[],groups=[];for(const key of this.orderedGroupKeys(grouped)){const groupChunks=grouped.get(key);!groupChunks||groupChunks.length===0||(groups.push({key,label:labelOf(key,groupChunks),startIndex:rows.length}),rows.push(...groupChunks))}return{chunks:rows,groups}}reportSelection(chunkIds){this.canonicalSource!==this.chunks&&this.canonicalChunks();const chunks=[...new Set(chunkIds)].flatMap(id=>this.canonicalById.get(id)??[]).sort((a,b)=>this.canonicalOrder.get(a.id)-this.canonicalOrder.get(b.id));this.emit("lr-selection-change",snapshotEventDetail({selectedChunkIds:chunkIds,chunks},this.ownerDocument.defaultView)),this.emit("lr-select",snapshotEventDetail({chunkIds,chunks},this.ownerDocument.defaultView))}toggleSelect(chunk){if(!this.currentSourceRow(chunk)||this.sourceSelectionBlocked)return;if(this.sourceMode){const next2=new Set(this.selectedChunkIds);next2.has(chunk.id)?next2.delete(chunk.id):next2.size<1e4&&next2.add(chunk.id),this.selectedChunkIds=[...next2],this.sourceSelectionEvent=this.selectedChunkIds;return}const next=new Set(this.normalizedSelectedChunkIds());next.has(chunk.id)?next.delete(chunk.id):next.add(chunk.id),this.selectedChunkIds=[...next],this.reportSelection(this.selectedChunkIds)}rowChunksFor(chunk){let row=this.rowChunks.get(chunk);return row||this.rowChunks.set(chunk,row=[toLyraChunk(chunk)]),row}renderMetadata(metadata){return renderRetrievalMetadata(metadata,this.effectiveLocale,this.localize("valueInvalid"),this.localize("valueTruncated"))}isChunkSelected(id){const source=this.selectedChunkIds;return source.length===0||this.processedChunks.chunks.length<=1?(this.selectedMembership=void 0,source.includes(id)):(this.selectedMembership?.source!==source&&(this.selectedMembership={source,ids:new Set(source)}),this.selectedMembership.ids.has(id))}legacyLoadMoreHandler(){const chunks=this.chunks,version=this.sourceVersion;return event=>{event.stopPropagation(),!(!this.isConnected||this.sourceMode||this.sourceVersion!==version||this.chunks!==chunks||!this.hasMore||this.loading||this.errorText||event.currentTarget?.getRootNode()!==this.renderRoot)&&this.emit("lr-load-more")}}renderLoadMoreFooter(){return this.hasMore?html`
|
|
34
|
+
`}}static{this.defaultStrings={...super.defaultStrings,chunkInspectorEmpty:LYRA_DEFAULT_chunkInspectorEmpty,chunkInspectorLabel:LYRA_DEFAULT_chunkInspectorLabel,loadMore:LYRA_DEFAULT_loadMore,loading:LYRA_DEFAULT_loading,retrievalResultsInputLimit:LYRA_DEFAULT_retrievalResultsInputLimit,retrievalResultsSelectRowOrdinal:LYRA_DEFAULT_retrievalResultsSelectRowOrdinal,retry:LYRA_DEFAULT_retry,sourceSelectionFailed:LYRA_DEFAULT_sourceSelectionFailed,sourceSelectionLoading:LYRA_DEFAULT_sourceSelectionLoading,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,untitledSource:LYRA_DEFAULT_untitledSource,valueInvalid:LYRA_DEFAULT_valueInvalid,valueTruncated:LYRA_DEFAULT_valueTruncated}}static{this.collectionSupport=collectionSupport}static{this.identityCollectionProperties=Object.freeze(["chunks"])}static{this.ownedCollectionProperties=Object.freeze(["chunks","selectedChunkIds","groupOrder"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-selection-change","lr-chunk-open"])}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-selection-change":Object.freeze(["chunks"])})}get dataSource(){return this._dataSource}set dataSource(value){const old=this._dataSource;this._dataSource=value,this.sourceEpoch++,this.requestUpdate("dataSource",old)}get sourceTotal(){return this.sourceMode?this.sourcePages.state.result?.total??null:null}get sourceMode(){return this.dataSource!==void 0}get sourceBlocked(){return this.sourceMode&&(!this.isConnected||!!this.errorText||this.sourcePages.state.pending||!this.sourcePages.state.result)}get sourceSelectionBlocked(){return this.sourceBlocked||this.sourceMode&&(this.sourcePages.state.selectionPending||this.sourceSelectionFailed)}projectSourceChunk(record,isCurrent){let units=0;const read=(input,key)=>{if(!isCurrent())throw new Error("Obsolete source chunk");const value2=readOwnDataValue(input,key);if(!isCurrent())throw new Error("Obsolete source chunk");return value2},fields=(input,keys)=>{if(!input||typeof input!="object"||Array.isArray(input))throw new TypeError("Invalid source chunk");const copy={};for(const key of keys){const value2=read(input,key);if(typeof value2=="string"&&(units+=value2.length,value2.length>65536||units>65536))throw new RangeError("Source chunk text too large");value2!==void 0&&(copy[key]=value2)}return copy},raw=fields(record.value,["id","text","score","metadata","rank","queryId","stage","traceId","scores"]);raw.source=fields(read(record.value,"source"),["id","name","mimeType","uri","version"]);const locator=read(record.value,"locator");if(locator!==void 0){const projected=fields(locator,["kind","page","quote","prefix","suffix","id","start","end","sheet","range","cfi"]);for(const key of["kind","quote","prefix","suffix","id","sheet","range","cfi"])if(projected[key]!==void 0&&typeof projected[key]!="string")throw new TypeError("Invalid source locator text");for(const key of["page","start","end"])if(projected[key]!==void 0&&(typeof projected[key]!="number"||!Number.isFinite(projected[key])))throw new TypeError("Invalid source locator number");const rect=read(locator,"rect");if(rect!==void 0){const coordinates=fields(rect,["x","y","width","height"]);for(const key of["x","y","width","height"])if(typeof coordinates[key]!="number"||!Number.isFinite(coordinates[key]))throw new TypeError("Invalid source locator rectangle");projected.rect=coordinates}const path=read(locator,"path");if(path!==void 0){if(!Array.isArray(path))throw new TypeError("Invalid source locator path");const length=read(path,"length");if(typeof length!="number"||!Number.isSafeInteger(length)||length<0||length>500)throw new RangeError("Source locator path too large");projected.path=Array.from({length},(_,index)=>{const value2=read(path,String(index));if(typeof value2!="string"&&typeof value2!="number")throw new TypeError("Invalid source locator path");if(typeof value2=="string"&&(units+=value2.length,units>65536))throw new RangeError("Source chunk text too large");return value2})}raw.locator=projected}const scores=raw.scores;scores&&typeof scores=="object"&&!Array.isArray(scores)&&(raw.scores=fields(scores,["dense","sparse","rerank","final"]));const value=projectRetrievalChunk(raw);if(!isCurrent())throw new Error("Obsolete source chunk");if(!value)throw new TypeError("Invalid source chunk");return this.sourceRowKeys.set(value,record.key),{key:record.key,order:record.order,value}}validateSourcePage(result,query){if(!query.withoutDedupe&&result.rows.some(record=>record.key!==record.value.id))throw new TypeError("Invalid canonical source identity");if(query.grouping==="none"){if(result.groups?.length)throw new TypeError("Unexpected source groups");return}if(!result.groups)throw new TypeError("Missing source groups");if(!result.rows.length)return;const size=this.sourcePages.state.pageSize,start=Math.min(this.sourcePages.state.page,Math.floor((result.total-1)/size))*size,end=start+result.rows.length;let covered=start,previousEnd=-1;for(const group of result.groups){if(group.startIndex<previousEnd||Math.max(start,group.startIndex)!==covered)throw new TypeError("Invalid source group coverage");previousEnd=group.startIndex+group.itemCount,covered=Math.min(end,previousEnd)}if(covered!==end)throw new TypeError("Incomplete source groups")}canonicalSourceAdapter(source){if(this.sourceAdapter?.original===source)return this.sourceAdapter.adapter;if(!source||typeof source.query!="function"||typeof source.lookup!="function"||typeof source.locate!="function")throw new TypeError("Invalid source");const adapter={revision:source.revision,query:request=>source.query(request),locate:(key,query,context)=>source.locate(key,query,context),lookup:async(keys,context)=>{const records=await source.lookup(keys,context);if(!Array.isArray(records)||records.length>500)throw new TypeError("Invalid canonical lookup");for(let index=0;index<records.length;index++){const record=readOwnDataValue(records,String(index)),key=readOwnDataValue(record,"key"),value=readOwnDataValue(record,"value");if(key!==readOwnDataValue(value,"id"))throw new TypeError("Invalid canonical lookup identity")}return records}};return this.sourceAdapter={original:source,adapter},adapter}syncSource(force=!1){if(!(!this.sourcePages||this.sourceSyncing)){this.sourceSyncing=!0;try{if(!this.sourceMode){this.sourceInputs&&(this.sourceVersion++,this.focusRestoreGeneration++,this.sourcePages.bind(void 0),this.processedChunksCache=void 0),this.sourceInputs=void 0,this.sourceQueryInputs=void 0,this.sourceResult=void 0,this.sourceRows=[],this.sourceGroups=[],this.sourceSelectionInputs=void 0,this.sourceSelectionEvent=void 0,this.sourceActiveInputs=void 0,this.sourceReveal=void 0;return}const source=this.dataSource,size=finiteInteger(this.sourcePageSize,100,1,500);let page=finiteInteger(this.sourcePage,0,0,Math.floor(Number.MAX_SAFE_INTEGER/size));const queryInputs=[this.sort,this.withoutDedupe,this.grouping,this.groupBy,this.groupLabel,this.groupOrder,size];this.hasUpdated&&this.sourceQueryInputs&&queryInputs.some((value,index)=>value!==this.sourceQueryInputs[index])&&(page=0,this.sourcePage=0),this.sourceQueryInputs=queryInputs;const inputs=[source,source.revision,this.sourceEpoch,this.effectiveLocale,...queryInputs,page];if(!force&&this.sourceInputs&&inputs.every((value,index)=>value===this.sourceInputs[index]))return;(!this.sourceInputs||inputs.slice(0,3).some((value,index)=>value!==this.sourceInputs[index]))&&(this.sourceSelectionInputs=void 0,this.sourceSelectionEvent=void 0),this.sourceInputs=inputs,this.sourceVersion++,this.focusRestoreGeneration++,this.sourceRows=[],this.sourceGroups=[],this.sourceResult=void 0,this.sourceReveal=void 0,this.expandedChunkIds=[],this.sourcePages.bind({source:this.canonicalSourceAdapter(source),revision:source.revision,epoch:this.sourceEpoch,locale:this.effectiveLocale});const query=Object.freeze({sort:this.sort,withoutDedupe:this.withoutDedupe,grouping:this.grouping,groupBy:this.groupBy,groupLabel:this.groupLabel,groupOrder:this.groupOrder});this.sourcePages.request(query,page,size)}catch{this.sourcePages.bind(void 0),this.sourceRows=[],this.sourceGroups=[],this.sourceResult=void 0}finally{this.sourceSyncing=!1}}}syncSourceSelection(){if(!this.sourceMode||!this.isConnected||!this.sourceAdapter||!this.sourceInputs)return;const ids=this.selectedChunkIds,source=this.dataSource,epoch=this.sourceEpoch,revision=source.revision,inputs=[source,revision,epoch,ids];if(this.sourceSelectionInputs&&inputs.every((value,index)=>value===this.sourceSelectionInputs[index]))return;this.sourceSelectionInputs=inputs,this.sourceSelectionFailed=!1;const owner=this.ownerDocument,lifecycle=this.sourceLifecycle,canonicalIds=canonicalIdentityList(ids);this.sourcePages.resolveSelection(canonicalIds).then(records=>{if(source.revision!==revision||lifecycle!==this.sourceLifecycle||!this.isConnected||this.ownerDocument!==owner||this.dataSource!==source||this.sourceEpoch!==epoch||this.selectedChunkIds!==ids)return;if(!records){this.sourceSelectionFailed=!0,this.sourceStateVersion++;return}const retained=new Set(records.map(record=>record.key)),accepted=canonicalIds.filter(id=>retained.has(id)),report=this.sourceSelectionEvent===ids;this.sourceSelectionEvent=void 0,accepted.length!==ids.length&&(this.selectedChunkIds=accepted);const committed=this.selectedChunkIds;if(report){const chunks=records.map(record=>record.value);this.emit("lr-selection-change",{selectedChunkIds:[...committed],chunks})}this.sourceStateVersion++})}acceptSourcePage(){const result=this.sourcePages.state.result;if(!result||result===this.sourceResult)return;this.sourceResult=result,this.sourceRows=result.rows.map(record=>record.value);const start=this.sourcePages.state.page*this.sourcePages.state.pageSize;this.sourceGroups=(result.groups??[]).map(group=>({key:group.key,label:group.label,startIndex:Math.max(0,group.startIndex-start)})),this.sourcePage!==this.sourcePages.state.page&&(this.sourceSyncing=!0,this.sourcePage=this.sourcePages.state.page,this.sourceSyncing=!1,this.sourceInputs=this.sourceInputs?[...this.sourceInputs.slice(0,-1),this.sourcePages.state.page]:void 0);const reveal=this.sourceReveal;this.sourceReveal=void 0,reveal?.version===this.sourceVersion&&this.revealSourceActive(reveal.id,reveal.version)}syncSourceActive(){if(!this.activeChunkId){this.sourceActiveInputs=void 0;return}if(this.sourceBlocked)return;const source=this.dataSource,id=this.activeChunkId,inputs=[source,source.revision,this.sourceEpoch,this.effectiveLocale,...this.sourceQueryInputs??[],id];if(this.sourceActiveInputs&&inputs.every((value,index)=>value===this.sourceActiveInputs[index]))return;this.sourceActiveInputs=inputs;const version=this.sourceVersion,owner=this.ownerDocument;this.sourcePages.locate(id).then(index=>{if(index===null||!this.isConnected||this.ownerDocument!==owner||!this.sourceMode||this.dataSource!==source||this.sourceVersion!==version||this.activeChunkId!==id)return;const page=Math.floor(index/finiteInteger(this.sourcePageSize,100,1,500));if(page===this.sourcePage){this.revealSourceActive(id,version);return}this.sourcePage=page,this.sourceReveal={id,version:this.sourceVersion}})}revealSourceActive(id,version){const owner=this.ownerDocument;this.updateComplete.then(async()=>{const list=this.renderRoot.querySelector(tag("virtual-list"));if(!list||(await list.updateComplete,!this.isConnected||this.ownerDocument!==owner||!this.sourceMode||this.sourceBlocked||this.sourceVersion!==version||this.activeChunkId!==id||list!==this.renderRoot.querySelector(tag("virtual-list"))))return;const index=this.sourceRows.findIndex(chunk=>chunk.id===id);index>=0&&list.scrollToIndex(index,{align:"auto",behavior:"auto"})})}currentSourceRow(chunk){return!(this.sourceMode||this.sourceRowKeys.has(chunk))||this.sourceMode&&!this.sourceBlocked&&this.sourceRows.includes(chunk)}invalidateSourceLifecycle(){this.sourceLifecycle++,this.sourceVersion++,this.focusRestoreGeneration++,this.sourceSelectionInputs=void 0,this.sourceSelectionEvent=void 0,this.sourceActiveInputs=void 0,this.sourceReveal=void 0,this.sourceStatusInitialized=!1,this.sourceStatus=""}adoptedCallback(){this.invalidateSourceLifecycle(),this.sourcePages.adopted(),super.adoptedCallback()}requestUpdate(...args){args[0]===void 0&&(this.explicitRefresh=!0,this.sourceEpoch=(this.sourceEpoch??0)+1),args[0]==="selectedChunkIds"&&(this.sourceSelectionEvent=void 0),(args[0]===void 0||["dataSource","sourcePage","sourcePageSize","sort","withoutDedupe","grouping","groupBy","groupLabel","groupOrder"].includes(String(args[0])))&&this.syncSource(),super.requestUpdate(...args)}inputLimitText(){if(this.sourceMode)return"";const truncation=publicCollectionTruncation(this,"chunks"),number=getNumberFormat(this.effectiveLocale);return truncation?this.localize("retrievalResultsInputLimit",void 0,{count:number.format(truncation.retained),total:number.format(truncation.source)}):""}renderInputLimit(){const text=this.inputLimitText();return text?html`<p part="limit" role="note">${text}</p>`:nothing}connectedCallback(){super.connectedCallback(),this.errorAnnouncementSink??=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this}),this.emptyAnnouncementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this});const generation=++this.connectionGeneration;announceAfterFirstPaint(this,()=>generation===this.connectionGeneration,()=>{!this.announce||this.initialStateAnnounced||(this.initialStateAnnounced=!0,this.announcePresentedState())})}disconnectedCallback(){this.invalidateSourceLifecycle(),this.isMounting=!0,this.connectionGeneration+=1,this.errorAnnouncementSink?.release(),this.errorAnnouncementSink=void 0,this.emptyAnnouncementSink?.release(),this.emptyAnnouncementSink=void 0,this.wasEmptyPresented=!1,super.disconnectedCallback()}deepActiveElement(){return deepActiveElementIn(this.isConnected?this.shadowRoot:null)}chunkAnchor(start){let current=start;for(;current&¤t!==this;){if(current.hasAttribute("data-chunk-id"))return current;if(current.parentElement){current=current.parentElement;continue}const root=current.getRootNode();current=root.nodeType===11&&"host"in root?root.host:null}return null}renderedChunkIds(){const roots=[this.renderRoot],virtualList=this.renderRoot.querySelector(tag("virtual-list"));return virtualList?.shadowRoot&&roots.push(virtualList.shadowRoot),roots.flatMap(root=>[...root.querySelectorAll(`${tag("chunk-inspector")}[data-chunk-id]`)].map(element=>element.getAttribute("data-chunk-id")).filter(id=>id!==null))}willUpdate(changed){if(super.willUpdate(changed),this.syncSource(),this.sourceMode){this.acceptSourcePage(),this.syncSourceSelection(),this.syncSourceActive();return}const refresh=this.explicitRefresh;this.explicitRefresh=!1;const groupingLocaleSignature=this.grouping==="source"?`${this.effectiveLocale}\0${this.localize("untitledSource")}`:"";if((this.processedChunksCache===void 0||refresh||changed.has("chunks")||changed.has("withoutDedupe")||changed.has("sort")||changed.has("grouping")||changed.has("groupBy")||changed.has("groupLabel")||changed.has("groupOrder")||groupingLocaleSignature!==this.processedGroupingLocaleSignature)&&(this.processedGroupingLocaleSignature=groupingLocaleSignature,this.processedChunksCache=this.computeProcessedChunks()),changed.has("chunks")){const present=new Set(this.processedChunks.chunks.map(chunk=>chunk.id)),kept=this.expandedChunkIds.filter(id=>present.has(id));kept.length!==this.expandedChunkIds.length&&(this.expandedChunkIds=kept)}if(changed.has("chunks")||changed.has("selectedChunkIds")){const normalized=this.normalizedSelectedChunkIds();if(normalized.length!==this.selectedChunkIds.length||normalized.some((id,index)=>id!==this.selectedChunkIds[index])){const shouldAnnounce=this.hasUpdated&&changed.has("chunks");writeNormalizedOwnedCollection(this,"selectedChunkIds",()=>{this.selectedChunkIds=normalized}),shouldAnnounce&&this.reportSelection(normalized)}}if(!changed.has("chunks")&&!changed.has("withoutDedupe")&&!changed.has("sort")&&!changed.has("grouping")&&!changed.has("groupBy")&&!changed.has("groupLabel")&&!changed.has("groupOrder")&&!changed.has("presentation")&&!changed.has("withoutSelection")&&!changed.has("virtualizeAt")&&!changed.has("loading")&&!changed.has("errorText"))return;const focusedId=this.chunkAnchor(this.deepActiveElement())?.getAttribute("data-chunk-id");if(!focusedId)return;const previousIds=this.previousProcessedChunkIds.length?this.previousProcessedChunkIds:this.renderedChunkIds(),focusedIndex=Math.max(0,previousIds.indexOf(focusedId)),nextChunks=this.errorText?[]:this.processedChunks.chunks;if(nextChunks.length===0){this.pendingFocusTarget="base";return}const survivingIndex=nextChunks.findIndex(chunk=>chunk.id===focusedId),nextIndex=survivingIndex>=0?survivingIndex:Math.min(focusedIndex,nextChunks.length-1);this.pendingFocusTarget=nextChunks[nextIndex].id}updated(changed){if(super.updated(changed),this.sourceMode){const status=this.sourcePages.state.pending?this.localize("loading"):this.sourcePages.state.result?this.sourcePages.state.selectionPending?this.localize("sourceSelectionLoading"):this.sourceSelectionFailed?this.localize("sourceSelectionFailed"):"":this.localize("tableLoadFailed");this.sourceStatusInitialized&&status&&status!==this.sourceStatus&&this.emptyAnnouncementSink?.announce(status),this.sourceStatusInitialized=!0,this.sourceStatus=status;return}const inputTruncated=publicCollectionTruncation(this,"chunks")!==void 0;this.limitInitialized&&inputTruncated&&!this.previouslyInputTruncated&&this.emptyAnnouncementSink?.announce(this.inputLimitText()),this.limitInitialized=!0,this.previouslyInputTruncated=inputTruncated;const wasMounting=this.isMounting;this.isMounting=!1,!wasMounting&&changed.has("errorText")&&this.errorText!==""&&this.isConnected&&(this.initialStateAnnounced=!0,this.errorAnnouncementSink?.announce(this.errorText));const emptyPresented=!this.loading&&this.errorText===""&&this.processedChunks.chunks.length===0;!wasMounting&&!this.wasEmptyPresented&&emptyPresented&&this.isConnected&&(this.initialStateAnnounced=!0,this.emptyAnnouncementSink?.announce(this.localize("chunkInspectorEmpty"))),this.wasEmptyPresented=emptyPresented,this.previousProcessedChunkIds=this.errorText?[]:this.processedChunks.chunks.map(chunk=>chunk.id);const generation=++this.focusRestoreGeneration,target=this.pendingFocusTarget;target!==void 0&&(this.pendingFocusTarget=void 0,this.restoreControlledFocus(target,generation))}announcePresentedState(){if(!this.sourceMode){if(this.errorText!==""){this.errorAnnouncementSink?.announce(this.errorText);return}!this.loading&&this.processedChunks.chunks.length===0&&this.emptyAnnouncementSink?.announce(this.localize("chunkInspectorEmpty"))}}async restoreControlledFocus(target,generation){if(await this.updateComplete,generation!==this.focusRestoreGeneration||!this.isConnected)return;if(target==="base"){this.renderRoot.querySelector('[part="base"]')?.focus();return}const virtualList=this.renderRoot.querySelector(tag("virtual-list"));if(await virtualList?.updateComplete,generation!==this.focusRestoreGeneration||!this.isConnected)return;const roots=[this.renderRoot];virtualList?.shadowRoot&&roots.push(virtualList.shadowRoot);const candidates=roots.flatMap(root=>[...root.querySelectorAll("[data-chunk-id]")]),checkbox=candidates.find(element=>element.localName===tag("checkbox")&&element.getAttribute("data-chunk-id")===target);if(checkbox){checkbox.focus();return}const inspector=candidates.find(element=>element.localName===tag("chunk-inspector")&&element.getAttribute("data-chunk-id")===target);await inspector?.updateComplete,!(generation!==this.focusRestoreGeneration||!this.isConnected)&&inspector?.shadowRoot?.querySelector('[part="open-button"]')?.focus()}get effectiveVirtualizeAt(){return finiteCount(this.virtualizeAt,50)}canonicalChunks(){return this.canonicalSource!==this.chunks&&(this.canonicalSource=this.chunks,this.canonicalCache=firstByRetrievalIdentity(this.chunks.flatMap(value=>projectRetrievalChunk(value)??[]),chunk=>chunk.id),this.canonicalById=new Map(this.canonicalCache.map(chunk=>[chunk.id,chunk])),this.canonicalOrder=new Map(this.canonicalCache.map((chunk,index)=>[chunk.id,index]))),this.canonicalCache}normalizedSelectedChunkIds(){return this.canonicalSource!==this.chunks&&this.canonicalChunks(),canonicalIdentityList(this.selectedChunkIds).filter(id=>this.canonicalById.has(id))}get processedChunks(){return this.sourceMode?{chunks:this.sourceRows,groups:this.sourceGroups}:this.processedChunksCache??=this.computeProcessedChunks()}computeProcessedChunks(){const canonical=this.canonicalChunks(),sorted=this.sort==="score"?[...canonical].sort((a,b)=>safeScore(b.score)-safeScore(a.score)):canonical;if(this.grouping==="source")return this.bucketed(sorted,chunk=>chunk.source.id,(_id,groupChunks)=>groupChunks[0].source.name||this.localize("untitledSource"));if(this.grouping==="custom"&&this.groupBy){const groupBy=this.groupBy;return this.bucketed(sorted,groupBy,(id,groupChunks)=>this.groupLabel?.(id,groupChunks)??id)}return{chunks:sorted,groups:[]}}orderedGroupKeys(grouped){const firstSeen=[...grouped.keys()];if(this.grouping!=="custom"||!this.groupOrder)return firstSeen;if(typeof this.groupOrder=="function")return firstSeen.sort(this.groupOrder);const ordered=[...new Set(this.groupOrder)].filter(id=>grouped.has(id)),listed=new Set(ordered);return[...ordered,...firstSeen.filter(id=>!listed.has(id))]}bucketed(sorted,keyOf,labelOf){const grouped=new Map;for(const chunk of sorted){const key=keyOf(chunk),existing=grouped.get(key);existing?existing.push(chunk):grouped.set(key,[chunk])}const rows=[],groups=[];for(const key of this.orderedGroupKeys(grouped)){const groupChunks=grouped.get(key);!groupChunks||groupChunks.length===0||(groups.push({key,label:labelOf(key,groupChunks),startIndex:rows.length}),rows.push(...groupChunks))}return{chunks:rows,groups}}reportSelection(chunkIds){this.canonicalSource!==this.chunks&&this.canonicalChunks();const chunks=[...new Set(chunkIds)].flatMap(id=>this.canonicalById.get(id)??[]).sort((a,b)=>this.canonicalOrder.get(a.id)-this.canonicalOrder.get(b.id));this.emit("lr-selection-change",snapshotEventDetail({selectedChunkIds:chunkIds,chunks},this.ownerDocument.defaultView))}toggleSelect(chunk){if(!this.currentSourceRow(chunk)||this.sourceSelectionBlocked)return;if(this.sourceMode){const next2=new Set(this.selectedChunkIds);next2.has(chunk.id)?next2.delete(chunk.id):next2.size<1e4&&next2.add(chunk.id),this.selectedChunkIds=[...next2],this.sourceSelectionEvent=this.selectedChunkIds;return}const next=new Set(this.normalizedSelectedChunkIds());next.has(chunk.id)?next.delete(chunk.id):next.add(chunk.id),this.selectedChunkIds=[...next],this.reportSelection(this.selectedChunkIds)}rowChunksFor(chunk){let row=this.rowChunks.get(chunk);return row||this.rowChunks.set(chunk,row=[toLyraChunk(chunk)]),row}renderMetadata(metadata){return renderRetrievalMetadata(metadata,this.effectiveLocale,this.localize("valueInvalid"),this.localize("valueTruncated"))}isChunkSelected(id){const source=this.selectedChunkIds;return source.length===0||this.processedChunks.chunks.length<=1?(this.selectedMembership=void 0,source.includes(id)):(this.selectedMembership?.source!==source&&(this.selectedMembership={source,ids:new Set(source)}),this.selectedMembership.ids.has(id))}legacyLoadMoreHandler(){const chunks=this.chunks,version=this.sourceVersion;return event=>{event.stopPropagation(),!(!this.isConnected||this.sourceMode||this.sourceVersion!==version||this.chunks!==chunks||!this.hasMore||this.loading||this.errorText||event.currentTarget?.getRootNode()!==this.renderRoot)&&this.emit("lr-load-more")}}renderLoadMoreFooter(){return this.hasMore?html`
|
|
36
35
|
<div part="load-more-row">
|
|
37
36
|
${this.loading?html`<lr-spinner part="spinner"></lr-spinner>`:html`<button
|
|
38
37
|
type="button"
|
|
@@ -46,7 +45,7 @@ import{__decorate}from"tslib";import{SourcePageController}from"../../../internal
|
|
|
46
45
|
aria-label=${retrievalSemanticLabel(this,this.label??this.localize("chunkInspectorLabel"))??nothing}>
|
|
47
46
|
${this.errorText?html`<div part="error">${this.errorText}</div>`:state2.pending?html`<p part="source-status">${this.localize("loading")}</p>`:state2.result?rows.length?html`<lr-virtual-list
|
|
48
47
|
exportparts="row:row, group:group-header, select:select, row-body:row-body, row-body-selected:row-body-selected, metadata:metadata, metadata-entry:metadata-entry, metadata-term:metadata-term, metadata-value:metadata-value, chunk:chunk, chunk-current:chunk-current, chunk-score:chunk-score, chunk-score-current:chunk-score-current, chunk-score-bar:chunk-score-bar, chunk-score-fill:chunk-score-fill, chunk-score-fill-success:chunk-score-fill-success, chunk-score-fill-warning:chunk-score-fill-warning, chunk-score-fill-danger:chunk-score-fill-danger, chunk-open-button:chunk-open-button, chunk-title:chunk-title, chunk-text:chunk-text, chunk-text-clamped:chunk-text-clamped, chunk-toggle:chunk-toggle"
|
|
49
|
-
.items=${
|
|
48
|
+
.items=${rows} .groups=${this.sourceGroups}
|
|
50
49
|
.keyFunction=${this.retrievalChunkKey}
|
|
51
50
|
.renderItem=${(item,index)=>this.renderRow(item,state2.page*state2.pageSize+index,state2.result.total)}
|
|
52
51
|
@lr-load-more=${this.stopOwnedEvent} @lr-virtual-scroll=${this.stopOwnedEvent} @lr-visible-range-change=${this.stopOwnedEvent}
|
|
@@ -81,7 +80,7 @@ import{__decorate}from"tslib";import{SourcePageController}from"../../../internal
|
|
|
81
80
|
${this.renderInputLimit()}
|
|
82
81
|
${useVirtualList?html`<lr-virtual-list
|
|
83
82
|
exportparts="row:row, group:group-header, select:select, row-body:row-body, row-body-selected:row-body-selected, metadata:metadata, metadata-entry:metadata-entry, metadata-term:metadata-term, metadata-value:metadata-value, chunk:chunk, chunk-current:chunk-current, chunk-score:chunk-score, chunk-score-current:chunk-score-current, chunk-score-bar:chunk-score-bar, chunk-score-fill:chunk-score-fill, chunk-score-fill-success:chunk-score-fill-success, chunk-score-fill-warning:chunk-score-fill-warning, chunk-score-fill-danger:chunk-score-fill-danger, chunk-open-button:chunk-open-button, chunk-title:chunk-title, chunk-text:chunk-text, chunk-text-clamped:chunk-text-clamped, chunk-toggle:chunk-toggle"
|
|
84
|
-
.items=${
|
|
83
|
+
.items=${processed.chunks}
|
|
85
84
|
.renderItem=${renderVirtualRow}
|
|
86
85
|
.keyFunction=${this.retrievalChunkKey}
|
|
87
86
|
.groups=${processed.groups}
|
|
@@ -3,7 +3,7 @@ import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';impo
|
|
|
3
3
|
* redefining the union -- see `src/ai/types.ts`'s own header for why. */
|
|
4
4
|
export type LyraRetrievalMode=RetrievalQuery['mode'];
|
|
5
5
|
/** `detail` for `lr-filters-change` -- the complete, already-updated `filters`/`scope` state
|
|
6
|
-
* after a chip removal, mirroring `<lr-source-picker>`'s `lr-
|
|
6
|
+
* after a chip removal, mirroring `<lr-source-picker>`'s `lr-selection-change` "full next state"
|
|
7
7
|
* convention rather than a single-item delta. */
|
|
8
8
|
export interface RetrievalFiltersChangeDetail{filters:Record<string,unknown>;scope:string[];}export interface LyraRetrievalSearchEventMap{'lr-input':CustomEvent<{value:string;}>;'lr-mode-change':CustomEvent<{mode:LyraRetrievalMode;}>;'lr-search':CustomEvent<LyraEventDetailSnapshot<RetrievalQuery>>;'lr-cancel':CustomEvent<CancelEventDetail>;'lr-filters-change':CustomEvent<LyraEventDetailSnapshot<RetrievalFiltersChangeDetail>>;}
|
|
9
9
|
/**
|
|
@@ -34,9 +34,7 @@ endMs?:number;
|
|
|
34
34
|
/** Same vocabulary as `LyraSpan.status`. */
|
|
35
35
|
status:LyraSpan['status'];
|
|
36
36
|
/** Secondary text under the stage name, e.g. "12 chunks, top score 0.87". */
|
|
37
|
-
detail?:string;evidence?:RetrievalStageEvidence;}export interface LyraRetrievalTraceEventMap{'lr-stage-select':CustomEvent<{stageId:string;}>;
|
|
38
|
-
/** @deprecated Use `lr-toggle` and read `itemId`; this alias remains during its deprecation window. */
|
|
39
|
-
'lr-stage-toggle':CustomEvent<{stageId:string;expanded:boolean;}>;'lr-toggle':CustomEvent<{expanded:boolean;itemId:string;stageId?:string;}>;'lr-stage-chunk-action':CustomEvent<LyraEventDetailSnapshot<LyraRetrievalTraceChunkActionDetail>>;}
|
|
37
|
+
detail?:string;evidence?:RetrievalStageEvidence;}export interface LyraRetrievalTraceEventMap{'lr-stage-select':CustomEvent<{stageId:string;}>;'lr-toggle':CustomEvent<{expanded:boolean;itemId:string;stageId?:string;}>;'lr-stage-chunk-action':CustomEvent<LyraEventDetailSnapshot<LyraRetrievalTraceChunkActionDetail>>;}
|
|
40
38
|
/** Stage-correlated replacement for nested chunk-inspector events. */
|
|
41
39
|
export type LyraRetrievalTraceChunkActionDetail={stageId:string;action:'open';chunkId:string;sourceId:string;anchor?:NonNullable<LyraChunk['anchor']>;}|{stageId:string;action:'expand';chunkId:string;expanded:boolean;};
|
|
42
40
|
/**
|
|
@@ -51,10 +49,9 @@ export type LyraRetrievalTraceChunkActionDetail={stageId:string;action:'open';ch
|
|
|
51
49
|
*
|
|
52
50
|
* @customElement lr-retrieval-trace
|
|
53
51
|
* @event lr-stage-select - A stage's bar was activated in the timeline (click, Enter, Space). `detail: { stageId }`.
|
|
54
|
-
* @event lr-
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* (`{ expanded, itemId, stageId }`).
|
|
52
|
+
* @event lr-toggle - A stage's evidence panel was expanded or collapsed (via its own toggle, or
|
|
53
|
+
* implicitly by selecting that stage in the timeline for the first time) (`{ expanded, itemId }`),
|
|
54
|
+
* or a nested chunk changed (`{ expanded, itemId, stageId }`).
|
|
58
55
|
* @event lr-stage-chunk-action - A chunk inside a stage was opened or expanded. The discriminated
|
|
59
56
|
* detail always includes `stageId` and `action`, so consumers never infer ownership from DOM ancestry.
|
|
60
57
|
* @csspart base - The root wrapper.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{LyraElement}from"../../../internal/lyra-element.js";import{devWarnOnce}from"../../../internal/dev-warning.js";import{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import"../../agent-tools/span-waterfall/span-waterfall.class.js";import"../chunk-inspector/chunk-inspector.class.js";import"../../overlays/empty/empty.class.js";import{firstByRetrievalIdentity,isValidRetrievalChunk}from"../retrieval-identity.js";import{hasRetrievalMetadata,renderRetrievalMetadata}from"../retrieval-metadata.js";import{styles}from"./retrieval-trace.styles.js";import{LYRA_DEFAULT_retrievalStageEmbed,LYRA_DEFAULT_retrievalStageFilter,LYRA_DEFAULT_retrievalStageKindUnknown,LYRA_DEFAULT_retrievalStageQueryRewrite,LYRA_DEFAULT_retrievalStageRerank,LYRA_DEFAULT_retrievalStageRetrieve,LYRA_DEFAULT_retrievalTraceEmpty,LYRA_DEFAULT_retrievalTraceEvidenceToggle,LYRA_DEFAULT_valueTruncated}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_durationSeconds,LYRA_DEFAULT_expand,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_tokensIn,LYRA_DEFAULT_tokensOut,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";const STAGE_SPAN_KIND={"query-rewrite":"llm",embed:"embedding",retrieve:"retriever",rerank:"tool",filter:"tool"},STAGE_LABEL={"query-rewrite":{key:"retrievalStageQueryRewrite"},embed:{key:"retrievalStageEmbed"},retrieve:{key:"retrievalStageRetrieve"},rerank:{key:"retrievalStageRerank"},filter:{key:"retrievalStageFilter"}};function validChunks(evidence){return Array.isArray(evidence?.chunks)?evidence.chunks.filter(isValidRetrievalChunk):[]}function toLyraChunk(chunk){return{id:chunk.id,text:chunk.text,score:chunk.score,sourceId:chunk.source.id,title:chunk.source.name,...chunk.locator?{anchor:chunk.locator}:{},...chunk.locator?.kind==="page"?{page:chunk.locator.page}:{}}}class LyraRetrievalTrace extends LyraElement{constructor(){super(...arguments),this.stages=[],this.activeStageId=null,this.size="m",this.frame="card",this.expandedStageIds=new Set,this.evidenceDomIdPrefix=nextId("retrieval-trace-evidence"),this.stageChunkRows=new WeakMap,this.onStageSelect=e=>{e.stopPropagation();const{spanId:stageId}=e.detail;this.emit("lr-stage-select",{stageId});const stage=this.normalizedStages.find(s=>s.id===stageId);if(stage&&this.hasEvidence(stage.evidence)&&!this.expandedStageIds.has(stageId)){const next=new Set(this.expandedStageIds);next.add(stageId),this.expandedStageIds=next,this.emit("lr-
|
|
1
|
+
import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{LyraElement}from"../../../internal/lyra-element.js";import{devWarnOnce}from"../../../internal/dev-warning.js";import{nextId}from"../../../internal/a11y.js";import{chevronIcon}from"../../../internal/icons.js";import"../../agent-tools/span-waterfall/span-waterfall.class.js";import"../chunk-inspector/chunk-inspector.class.js";import"../../overlays/empty/empty.class.js";import{firstByRetrievalIdentity,isValidRetrievalChunk}from"../retrieval-identity.js";import{hasRetrievalMetadata,renderRetrievalMetadata}from"../retrieval-metadata.js";import{styles}from"./retrieval-trace.styles.js";import{LYRA_DEFAULT_retrievalStageEmbed,LYRA_DEFAULT_retrievalStageFilter,LYRA_DEFAULT_retrievalStageKindUnknown,LYRA_DEFAULT_retrievalStageQueryRewrite,LYRA_DEFAULT_retrievalStageRerank,LYRA_DEFAULT_retrievalStageRetrieve,LYRA_DEFAULT_retrievalTraceEmpty,LYRA_DEFAULT_retrievalTraceEvidenceToggle,LYRA_DEFAULT_valueTruncated}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_durationSeconds,LYRA_DEFAULT_expand,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_tokensIn,LYRA_DEFAULT_tokensOut,LYRA_DEFAULT_valueInvalid}from"../../../internal/default-strings/shared.generated.js";const STAGE_SPAN_KIND={"query-rewrite":"llm",embed:"embedding",retrieve:"retriever",rerank:"tool",filter:"tool"},STAGE_LABEL={"query-rewrite":{key:"retrievalStageQueryRewrite"},embed:{key:"retrievalStageEmbed"},retrieve:{key:"retrievalStageRetrieve"},rerank:{key:"retrievalStageRerank"},filter:{key:"retrievalStageFilter"}};function validChunks(evidence){return Array.isArray(evidence?.chunks)?evidence.chunks.filter(isValidRetrievalChunk):[]}function toLyraChunk(chunk){return{id:chunk.id,text:chunk.text,score:chunk.score,sourceId:chunk.source.id,title:chunk.source.name,...chunk.locator?{anchor:chunk.locator}:{},...chunk.locator?.kind==="page"?{page:chunk.locator.page}:{}}}class LyraRetrievalTrace extends LyraElement{constructor(){super(...arguments),this.stages=[],this.activeStageId=null,this.size="m",this.frame="card",this.expandedStageIds=new Set,this.evidenceDomIdPrefix=nextId("retrieval-trace-evidence"),this.stageChunkRows=new WeakMap,this.onStageSelect=e=>{e.stopPropagation();const{spanId:stageId}=e.detail;this.emit("lr-stage-select",{stageId});const stage=this.normalizedStages.find(s=>s.id===stageId);if(stage&&this.hasEvidence(stage.evidence)&&!this.expandedStageIds.has(stageId)){const next=new Set(this.expandedStageIds);next.add(stageId),this.expandedStageIds=next,this.emit("lr-toggle",{itemId:stageId,expanded:!0})}}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,durationSeconds:LYRA_DEFAULT_durationSeconds,expand:LYRA_DEFAULT_expand,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,retrievalStageEmbed:LYRA_DEFAULT_retrievalStageEmbed,retrievalStageFilter:LYRA_DEFAULT_retrievalStageFilter,retrievalStageKindUnknown:LYRA_DEFAULT_retrievalStageKindUnknown,retrievalStageQueryRewrite:LYRA_DEFAULT_retrievalStageQueryRewrite,retrievalStageRerank:LYRA_DEFAULT_retrievalStageRerank,retrievalStageRetrieve:LYRA_DEFAULT_retrievalStageRetrieve,retrievalTraceEmpty:LYRA_DEFAULT_retrievalTraceEmpty,retrievalTraceEvidenceToggle:LYRA_DEFAULT_retrievalTraceEvidenceToggle,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,tokensIn:LYRA_DEFAULT_tokensIn,tokensOut:LYRA_DEFAULT_tokensOut,valueInvalid:LYRA_DEFAULT_valueInvalid,valueTruncated:LYRA_DEFAULT_valueTruncated}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["stages"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-stage-chunk-action"])}get normalizedStages(){return this.normalizedStagesCache?.source!==this.stages&&(this.normalizedStagesCache={source:this.stages,value:firstByRetrievalIdentity(Array.isArray(this.stages)?this.stages:[],stage=>stage.id)}),this.normalizedStagesCache.value}stageChunks(evidence){let rows=this.stageChunkRows.get(evidence);return rows||this.stageChunkRows.set(evidence,rows=validChunks(evidence).map(toLyraChunk)),rows}hasEvidence(evidence){return typeof evidence=="object"&&evidence!==null&&(!!evidence.text||this.stageChunks(evidence).length>0||hasRetrievalMetadata(evidence.metadata))}stageLabel(stage){if(typeof stage.label=="string"&&stage.label)return stage.label;const entry=typeof stage.kind=="string"&&Object.hasOwn(STAGE_LABEL,stage.kind)?STAGE_LABEL[stage.kind]:void 0;return entry||devWarnOnce("lr-retrieval-trace:unknown-kind",`<lr-retrieval-trace>: unknown stage kind ${JSON.stringify(typeof stage.kind=="string"?stage.kind.slice(0,80):typeof stage.kind)}; rendering a localized unknown label.`),entry?this.localize(entry.key):this.localize("retrievalStageKindUnknown")}toSpans(stages,names){return stages.map((stage,index)=>({id:stage.id,name:names[index],kind:typeof stage.kind=="string"&&Object.hasOwn(STAGE_SPAN_KIND,stage.kind)?STAGE_SPAN_KIND[stage.kind]:"tool",startMs:stage.startMs,endMs:stage.endMs,status:stage.status,detail:stage.detail}))}toggleEvidence(stageId){const expanded=!this.expandedStageIds.has(stageId),next=new Set(this.expandedStageIds);expanded?next.add(stageId):next.delete(stageId),this.expandedStageIds=next,this.emit("lr-toggle",{itemId:stageId,expanded})}willUpdate(changed){if(super.willUpdate(changed),changed.has("stages")){const ids=new Set(this.normalizedStages.map(s=>s.id));let pruned=null;for(const id of this.expandedStageIds)ids.has(id)||(pruned??=new Set(this.expandedStageIds),pruned.delete(id));pruned&&(this.expandedStageIds=pruned)}}renderEvidenceBody(stage){const evidence=stage.evidence,chunks=this.stageChunks(evidence);return html`
|
|
2
2
|
${evidence.text?html`<p part="evidence-text">${evidence.text}</p>`:nothing}
|
|
3
3
|
${chunks.length>0?html`<lr-chunk-inspector
|
|
4
4
|
part="chunk-inspector"
|
|
5
5
|
size="s"
|
|
6
6
|
.chunks=${chunks}
|
|
7
|
-
@lr-toggle=${event=>{event.stopPropagation(),this.emit("lr-toggle",{...event.detail,stageId:stage.id})}}
|
|
7
|
+
@lr-toggle=${event=>{event.stopPropagation(),this.emit("lr-toggle",{...event.detail,stageId:stage.id}),this.emit("lr-stage-chunk-action",{stageId:stage.id,action:"expand",chunkId:event.detail.itemId,expanded:event.detail.expanded})}}
|
|
8
8
|
@lr-chunk-open=${event=>{event.stopPropagation(),this.emit("lr-stage-chunk-action",{stageId:stage.id,action:"open",...event.detail})}}
|
|
9
|
-
@lr-chunk-toggle=${event=>{event.stopPropagation(),this.emit("lr-stage-chunk-action",{stageId:stage.id,action:"expand",...event.detail})}}
|
|
10
9
|
></lr-chunk-inspector>`:nothing}
|
|
11
10
|
${renderRetrievalMetadata(evidence.metadata,this.effectiveLocale,this.localize("valueInvalid"),this.localize("valueTruncated"),!0)}
|
|
12
11
|
`}renderEvidenceRow(stage,occurrenceIndex){if(!this.hasEvidence(stage.evidence))return nothing;const expanded=this.expandedStageIds.has(stage.id),bodyId=`${this.evidenceDomIdPrefix}-${occurrenceIndex}`,label=this.stageLabel(stage);return html`
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraFrame,LyraSize}from'../../../internal/variants.js';export interface SourceCardExpandDetail{sourceId:string;expanded:boolean;}export interface SourceCardOpenDetail{sourceId:string;href?:string;}export interface LyraSourceCardEventMap{
|
|
2
|
-
/** @deprecated Use `lr-toggle` and read `itemId`; this alias remains during its deprecation window. */
|
|
3
|
-
'lr-expand':CustomEvent<SourceCardExpandDetail>;'lr-toggle':CustomEvent<{expanded:boolean;itemId:string;}>;'lr-open':CustomEvent<SourceCardOpenDetail>;}declare class LyraSourceCardBase extends LyraElement<LyraSourceCardEventMap>{}
|
|
1
|
+
import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraFrame,LyraSize}from'../../../internal/variants.js';export interface SourceCardExpandDetail{sourceId:string;expanded:boolean;}export interface SourceCardOpenDetail{sourceId:string;href?:string;}export interface LyraSourceCardEventMap{'lr-toggle':CustomEvent<{expanded:boolean;itemId:string;}>;'lr-open':CustomEvent<SourceCardOpenDetail>;}declare class LyraSourceCardBase extends LyraElement<LyraSourceCardEventMap>{}
|
|
4
2
|
/**
|
|
5
3
|
* `<lr-source-card>` — one citation/source entry, meant to be a direct
|
|
6
4
|
* light-DOM child of `<lr-source-list>` (though it renders and functions
|
|
@@ -25,12 +23,11 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
|
|
|
25
23
|
* more"/"Show less" toggle. When left empty, no toggle renders at all — a
|
|
26
24
|
* card with no `full` content simply has no expand affordance. Removing all
|
|
27
25
|
* `full`-slotted content while expanded automatically collapses it back, and
|
|
28
|
-
* announces that collapse through `lr-
|
|
29
|
-
* @event lr-
|
|
26
|
+
* announces that collapse through `lr-toggle` like any other state change.
|
|
27
|
+
* @event lr-toggle - The card's expanded state changed — either the per-card
|
|
30
28
|
* "Show more"/"Show less" toggle was activated, or all `full`-slotted content
|
|
31
29
|
* was removed while expanded, collapsing the card automatically.
|
|
32
|
-
* `detail: {
|
|
33
|
-
* @event lr-toggle - The same change with `detail: { expanded, itemId }`.
|
|
30
|
+
* `detail: { expanded, itemId }`.
|
|
34
31
|
* @event lr-open - The title was activated. `detail: { sourceId, href }` —
|
|
35
32
|
* `href` may be `undefined`. This component never navigates on its own
|
|
36
33
|
* (staying a controlled component, the same convention
|
|
@@ -97,9 +94,9 @@ href?:string;
|
|
|
97
94
|
*/
|
|
98
95
|
size:LyraSize;
|
|
99
96
|
/** Turns off this card's OWN controls: the `title` button and the "Show more"/"Show less"
|
|
100
|
-
* `toggle` both render `disabled`, so neither one can emit `lr-open` or `lr-
|
|
97
|
+
* `toggle` both render `disabled`, so neither one can emit `lr-open` or `lr-toggle` and neither
|
|
101
98
|
* remains in the tab order, and the card paints at `--lr-opacity-disabled` with a
|
|
102
|
-
* `not-allowed` cursor on both. The one `lr-
|
|
99
|
+
* `not-allowed` cursor on both. The one `lr-toggle` a disabled card can still emit is the
|
|
103
100
|
* automatic collapse when the `full` slot empties while expanded -- that reports a state change
|
|
104
101
|
* the card genuinely made, exactly as it does when enabled, and swallowing it would desync a
|
|
105
102
|
* host tracking expansion off the event stream.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{styles}from"./source-card.styles.js";import{LYRA_DEFAULT_showMore,LYRA_DEFAULT_sourcePageSuffix,LYRA_DEFAULT_untitledSource}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_showLess}from"../../../internal/default-strings/shared.generated.js";class LyraSourceCardBase extends LyraElement{}class LyraSourceCard extends LyraSourceCardBase{constructor(){super(...arguments),this.sourceId="",this.heading="",this.size="m",this.disabled=!1,this.triggerPressed=null,this.triggerCurrent=null,this.frame="card",this.hasFullSlot=!1,this.hasExcerptSlot=!1,this.fullExpanded=!1,this.fullId=nextId("source-card-full"),this.onFullSlotChange=()=>{const count=Array.from(this.children).filter(el=>el.getAttribute("slot")==="full").length;this.hasFullSlot=count>0,count===0&&this.fullExpanded&&(this.fullExpanded=!1,this.emit("lr-
|
|
1
|
+
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{nextId}from"../../../internal/a11y.js";import{styles}from"./source-card.styles.js";import{LYRA_DEFAULT_showMore,LYRA_DEFAULT_sourcePageSuffix,LYRA_DEFAULT_untitledSource}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_showLess}from"../../../internal/default-strings/shared.generated.js";class LyraSourceCardBase extends LyraElement{}class LyraSourceCard extends LyraSourceCardBase{constructor(){super(...arguments),this.sourceId="",this.heading="",this.size="m",this.disabled=!1,this.triggerPressed=null,this.triggerCurrent=null,this.frame="card",this.hasFullSlot=!1,this.hasExcerptSlot=!1,this.fullExpanded=!1,this.fullId=nextId("source-card-full"),this.onFullSlotChange=()=>{const count=Array.from(this.children).filter(el=>el.getAttribute("slot")==="full").length;this.hasFullSlot=count>0,count===0&&this.fullExpanded&&(this.fullExpanded=!1,this.emit("lr-toggle",{itemId:this.sourceId,expanded:!1}))},this.onExcerptSlotChange=()=>{this.hasExcerptSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="excerpt")},this.onTitleClick=()=>{this.emit("lr-open",{sourceId:this.sourceId,href:this.href})},this.toggleFull=()=>{this.fullExpanded=!this.fullExpanded,this.emit("lr-toggle",{itemId:this.sourceId,expanded:this.fullExpanded})}}static{this.defaultStrings={...super.defaultStrings,showLess:LYRA_DEFAULT_showLess,showMore:LYRA_DEFAULT_showMore,sourcePageSuffix:LYRA_DEFAULT_sourcePageSuffix,untitledSource:LYRA_DEFAULT_untitledSource}}static{this.styles=[LyraElement.styles,styles]}willUpdate(changed){super.willUpdate(changed),this.hasUpdated||(this.hasFullSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="full"),this.hasExcerptSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="excerpt"))}firstUpdated(changed){super.firstUpdated(changed);const fullCount=Array.from(this.children).filter(el=>el.getAttribute("slot")==="full").length;this.hasFullSlot=fullCount>0,fullCount===0&&(this.fullExpanded=!1),this.hasExcerptSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="excerpt")}get titleText(){const base=this.heading||this.localize("untitledSource");return this.page==null||this.page===""?base:this.localize("sourcePageSuffix",void 0,{base,page:this.page})}render(){const pressed=["true","false","mixed"].includes(this.triggerPressed??"")?this.triggerPressed:nothing,current=["page","step","location","date","time","true","false"].includes(this.triggerCurrent??"")?this.triggerCurrent:nothing;return html`
|
|
2
2
|
<div part="base" ?data-disabled=${this.disabled}>
|
|
3
3
|
<button
|
|
4
4
|
part="title"
|
|
@@ -4,9 +4,7 @@ mimeType?:string;
|
|
|
4
4
|
/** Filename fallback for icon detection. */
|
|
5
5
|
name?:string;
|
|
6
6
|
/** Presence makes this a group/folder row. */
|
|
7
|
-
children?:readonly LyraSourceEntry[];}export interface LyraSourcePickerEventMap{'lr-selection-change':CustomEvent<LyraEventDetailSnapshot<{selectedSourceIds:string[];}>>;
|
|
8
|
-
/** @deprecated Use `lr-selection-change`. */
|
|
9
|
-
'lr-sources-change':CustomEvent<LyraEventDetailSnapshot<{selectedSourceIds:string[];}>>;}
|
|
7
|
+
children?:readonly LyraSourceEntry[];}export interface LyraSourcePickerEventMap{'lr-selection-change':CustomEvent<LyraEventDetailSnapshot<{selectedSourceIds:string[];}>>;}
|
|
10
8
|
/**
|
|
11
9
|
* `<lr-source-picker>` — a checkbox tree/list scoping which sources ground the next answer:
|
|
12
10
|
* tri-state folders, select-all, type icons, search. **Not `FormAssociated`, deliberately**: this
|
|
@@ -21,7 +19,6 @@ children?:readonly LyraSourceEntry[];}export interface LyraSourcePickerEventMap{
|
|
|
21
19
|
* fired after every toggle including select-all. Also fires when a `sources` reassignment prunes
|
|
22
20
|
* a previously-selected id that is no longer a valid leaf. Not fired when a consumer sets
|
|
23
21
|
* `selectedSourceIds` directly; that assignment is normalized silently.
|
|
24
|
-
* @event lr-sources-change - Deprecated alias of `lr-selection-change`, dispatched right after it.
|
|
25
22
|
* @csspart base - The root wrapper.
|
|
26
23
|
* @csspart search - The built-in filter `lr-input`, omitted while `withoutSearch` is set.
|
|
27
24
|
* @csspart select-all - The header select-all row, omitted while `withoutSelectAll` is set.
|