@aceshooting/lyra-ui 29.2.1 → 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.
Files changed (440) hide show
  1. package/CHANGELOG.md +126 -95
  2. package/README.md +8 -7
  3. package/dist/ai/snapshot.js +1 -1
  4. package/dist/all.d.ts +1 -1
  5. package/dist/all.js +1 -1
  6. package/dist/autoloader.js +1 -1
  7. package/dist/cli/component-inventory.mjs +1 -1
  8. package/dist/cli/lyra-rename-ledger.mjs +1 -1
  9. package/dist/cli/migrate-wa.mjs +7 -3
  10. package/dist/cli/migration-analysis.mjs +1 -1
  11. package/dist/cli/migration-contract.json +1 -1
  12. package/dist/cli/migration-contract.mjs +1 -1
  13. package/dist/cli/migration-immutable-collections.mjs +6 -0
  14. package/dist/cli/migration-renames.mjs +1 -1
  15. package/dist/cli/migration-transforms.mjs +1 -1
  16. package/dist/components/agent-tools/activity-feed/activity-feed.class.d.ts +1 -1
  17. package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.d.ts +1 -2
  18. package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.js +1 -1
  19. package/dist/components/agent-tools/agent-run/agent-run.class.d.ts +3 -4
  20. package/dist/components/agent-tools/agent-run/agent-run.class.js +1 -1
  21. package/dist/components/agent-tools/agent-trace/agent-trace.class.d.ts +1 -1
  22. package/dist/components/agent-tools/agent-trace/agent-trace.class.js +2 -2
  23. package/dist/components/agent-tools/background-runs/background-runs.class.d.ts +1 -2
  24. package/dist/components/agent-tools/background-runs/background-runs.class.js +1 -1
  25. package/dist/components/agent-tools/change-review/change-review.class.d.ts +1 -2
  26. package/dist/components/agent-tools/change-review/change-review.class.js +1 -1
  27. package/dist/components/agent-tools/eval-dataset/eval-dataset.class.d.ts +3 -2
  28. package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +1 -1
  29. package/dist/components/agent-tools/evaluation-run/evaluation-run.class.d.ts +7 -1
  30. package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +1 -1
  31. package/dist/components/agent-tools/prompt-studio/prompt-studio.class.d.ts +2 -2
  32. package/dist/components/agent-tools/prompt-studio/prompt-studio.class.js +3 -3
  33. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.d.ts +1 -1
  34. package/dist/components/agent-tools/subagent-panel/subagent-panel.class.d.ts +1 -2
  35. package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +2 -2
  36. package/dist/components/agent-tools/task-list/task-list.class.d.ts +1 -1
  37. package/dist/components/agent-tools/test-results/test-results.class.d.ts +1 -1
  38. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +3 -4
  39. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +1 -5
  40. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +3 -3
  41. package/dist/components/agent-tools/trace-tree/trace-tree.class.d.ts +1 -0
  42. package/dist/components/agent-tools/trace-tree/trace-tree.class.js +1 -1
  43. package/dist/components/charts/chart/chart.class.js +4 -4
  44. package/dist/components/charts/chart-3d/chart-3d-data.d.ts +50 -0
  45. package/dist/components/charts/chart-3d/chart-3d-data.js +1 -0
  46. package/dist/components/charts/chart-3d/chart-3d-engine.js +1 -0
  47. package/dist/components/charts/chart-3d/chart-3d.class.d.ts +96 -0
  48. package/dist/components/charts/chart-3d/chart-3d.class.js +47 -0
  49. package/dist/components/charts/chart-3d/chart-3d.d.ts +1 -0
  50. package/dist/components/charts/chart-3d/chart-3d.js +1 -0
  51. package/dist/components/charts/chart-3d/chart-3d.styles.js +1 -0
  52. package/dist/components/charts/index.d.ts +1 -1
  53. package/dist/components/charts/index.js +1 -1
  54. package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +3 -3
  55. package/dist/components/conversation/agent-workspace/agent-workspace.class.js +4 -5
  56. package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
  57. package/dist/components/conversation/code-block/shiki-oniguruma.d.ts +3 -0
  58. package/dist/components/conversation/code-block/shiki-oniguruma.js +1 -0
  59. package/dist/components/conversation/code-block/shiki-types.d.ts +3 -5
  60. package/dist/components/conversation/code-block/shiki-types.js +1 -1
  61. package/dist/components/conversation/generation-metrics/generation-metrics.class.js +1 -1
  62. package/dist/components/conversation/markdown/markdown-progressive.js +1 -1
  63. package/dist/components/conversation/message-actions/message-actions.class.js +1 -1
  64. package/dist/components/conversation/message-parts/message-parts.class.js +1 -1
  65. package/dist/components/conversation/model-select/model-select.class.js +1 -1
  66. package/dist/components/conversation/model-settings-panel/model-settings-panel.class.js +1 -1
  67. package/dist/components/conversation/prompt-input/prompt-input.class.js +3 -4
  68. package/dist/components/conversation/prompt-queue/prompt-queue.class.d.ts +1 -1
  69. package/dist/components/conversation/push-to-talk/push-to-talk.class.js +1 -1
  70. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.js +1 -1
  71. package/dist/components/conversation/thread-list/thread-list.class.d.ts +2 -2
  72. package/dist/components/conversation/thread-list/thread-list.class.js +1 -1
  73. package/dist/components/conversation/widget-renderer/registry.js +1 -1
  74. package/dist/components/conversation/widget-renderer/resolve.js +1 -1
  75. package/dist/components/data/calendar/calendar.class.d.ts +3 -1
  76. package/dist/components/data/data-grid/data-grid.class.js +2 -2
  77. package/dist/components/data/flow-canvas/flow-canvas.class.js +2 -2
  78. package/dist/components/data/flow-canvas/flow-source.js +1 -1
  79. package/dist/components/data/flow-node/flow-node.class.d.ts +2 -3
  80. package/dist/components/data/flow-node/flow-node.class.js +2 -4
  81. package/dist/components/data/heatmap/heatmap.class.js +1 -1
  82. package/dist/components/data/sparkline/sparkline.class.d.ts +0 -1
  83. package/dist/components/data/sparkline/sparkline.class.js +1 -1
  84. package/dist/components/data/table/table.class.js +1 -1
  85. package/dist/components/forms/color-picker/color-core.js +1 -1
  86. package/dist/components/forms/date-picker/calendar-core.js +1 -1
  87. package/dist/components/forms/otp-input/otp-input.class.js +1 -1
  88. package/dist/components/forms/signature-pad/signature-pad.class.d.ts +4 -3
  89. package/dist/components/forms/signature-pad/signature-pad.class.js +1 -1
  90. package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +3 -2
  91. package/dist/components/forms/swatch-picker/swatch-picker.class.js +1 -1
  92. package/dist/components/layout/app-rail/app-rail-item.class.d.ts +0 -2
  93. package/dist/components/layout/app-rail/app-rail-item.class.js +1 -1
  94. package/dist/components/layout/app-rail/app-rail.class.d.ts +3 -3
  95. package/dist/components/layout/command-palette/command-palette.class.d.ts +1 -1
  96. package/dist/components/layout/details/accordion-item.class.d.ts +1 -2
  97. package/dist/components/layout/details/accordion-item.class.js +1 -1
  98. package/dist/components/layout/dock-panel/dock-panel.class.d.ts +4 -11
  99. package/dist/components/layout/dock-panel/dock-panel.class.js +1 -1
  100. package/dist/components/layout/drilldown-panel/drilldown-panel.class.js +1 -1
  101. package/dist/components/layout/menu/menu.class.js +1 -1
  102. package/dist/components/layout/menubar/menubar-item.class.d.ts +1 -1
  103. package/dist/components/layout/menubar/menubar.class.d.ts +1 -1
  104. package/dist/components/layout/multi-split/multi-split.class.d.ts +1 -1
  105. package/dist/components/layout/multi-split/multi-split.class.js +1 -1
  106. package/dist/components/layout/navigation-menu/navigation-menu.class.d.ts +2 -6
  107. package/dist/components/layout/navigation-menu/navigation-menu.class.js +1 -1
  108. package/dist/components/layout/tab-group/tab-group.class.js +1 -1
  109. package/dist/components/layout/virtual-list/virtual-list.class.d.ts +3 -2
  110. package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
  111. package/dist/components/layout/widget/widget.class.d.ts +5 -14
  112. package/dist/components/layout/widget/widget.class.js +2 -2
  113. package/dist/components/lr-chart-3d.js +1 -0
  114. package/dist/components/lr-model-viewer.js +1 -0
  115. package/dist/components/media/av-player/av-metadata.d.ts +1 -13
  116. package/dist/components/media/av-player/av-metadata.js +1 -1
  117. package/dist/components/media/av-player/av-player.class.js +1 -1
  118. package/dist/components/media/file-input/file-input.class.d.ts +10 -13
  119. package/dist/components/media/file-input/file-input.class.js +3 -3
  120. package/dist/components/media/file-input/file-input.styles.js +1 -1
  121. package/dist/components/media/image-viewer/image-viewer-panorama.d.ts +5 -0
  122. package/dist/components/media/image-viewer/image-viewer-panorama.js +8 -0
  123. package/dist/components/media/image-viewer/image-viewer-panorama.styles.js +1 -0
  124. package/dist/components/media/image-viewer/image-viewer.class.d.ts +29 -5
  125. package/dist/components/media/image-viewer/image-viewer.class.js +8 -5
  126. package/dist/components/media/image-viewer/image-viewer.styles.js +1 -1
  127. package/dist/components/media/map/map-anchor-controller.js +1 -0
  128. package/dist/components/media/map/map-anchor-options.d.ts +14 -0
  129. package/dist/components/media/map/map-anchor-options.js +1 -0
  130. package/dist/components/media/map/map-camera.d.ts +34 -0
  131. package/dist/components/media/map/map-camera.js +1 -0
  132. package/dist/components/media/map/map-construction-scheduler.d.ts +13 -0
  133. package/dist/components/media/map/map-construction-scheduler.js +1 -0
  134. package/dist/components/media/map/map-control-options.d.ts +39 -0
  135. package/dist/components/media/map/map-control-options.js +1 -0
  136. package/dist/components/media/map/map-controls-lifecycle.js +1 -0
  137. package/dist/components/media/map/map-cursor.js +1 -0
  138. package/dist/components/media/map/map-data-layer-model.d.ts +40 -0
  139. package/dist/components/media/map/map-data-layer-model.js +1 -0
  140. package/dist/components/media/map/map-drawing-controller.js +1 -0
  141. package/dist/components/media/map/map-drawing-gesture.js +1 -0
  142. package/dist/components/media/map/map-drawing-pan.js +1 -0
  143. package/dist/components/media/map/map-drawing-pointer.js +1 -0
  144. package/dist/components/media/map/map-drawing.d.ts +29 -0
  145. package/dist/components/media/map/map-drawing.js +1 -0
  146. package/dist/components/media/map/map-empty-style.d.ts +8 -0
  147. package/dist/components/media/map/map-empty-style.js +1 -0
  148. package/dist/components/media/map/map-engine-events.js +1 -0
  149. package/dist/components/media/map/map-export-attribution.js +1 -0
  150. package/dist/components/media/map/map-external-source-effects.js +1 -0
  151. package/dist/components/media/map/map-feature-loader-core.js +1 -0
  152. package/dist/components/media/map/map-feature-loader.js +1 -0
  153. package/dist/components/media/map/map-feature-state-router.d.ts +16 -0
  154. package/dist/components/media/map/map-feature-state-router.js +1 -0
  155. package/dist/components/media/map/map-feature-state-routes.js +1 -0
  156. package/dist/components/media/map/map-feature-state.d.ts +16 -0
  157. package/dist/components/media/map/map-feature-state.js +1 -0
  158. package/dist/components/media/map/map-hash-option.js +1 -0
  159. package/dist/components/media/map/map-hash-owner.js +1 -0
  160. package/dist/components/media/map/map-hash.js +1 -0
  161. package/dist/components/media/map/map-hit-test.d.ts +17 -0
  162. package/dist/components/media/map/map-hit-test.js +1 -0
  163. package/dist/components/media/map/map-image-admission.d.ts +7 -0
  164. package/dist/components/media/map/map-image-admission.js +1 -0
  165. package/dist/components/media/map/map-image-export-controller.js +1 -0
  166. package/dist/components/media/map/map-image-export-error.d.ts +3 -0
  167. package/dist/components/media/map/map-image-export-error.js +1 -0
  168. package/dist/components/media/map/map-image-export.d.ts +15 -0
  169. package/dist/components/media/map/map-image-export.js +5 -0
  170. package/dist/components/media/map/map-image-limits.d.ts +4 -0
  171. package/dist/components/media/map/map-image-limits.js +1 -0
  172. package/dist/components/media/map/map-image-metadata.js +3 -0
  173. package/dist/components/media/map/map-image-provider.d.ts +33 -0
  174. package/dist/components/media/map/map-image-provider.js +1 -0
  175. package/dist/components/media/map/map-images.d.ts +9 -0
  176. package/dist/components/media/map/map-images.js +1 -0
  177. package/dist/components/media/map/map-interaction-options.d.ts +26 -0
  178. package/dist/components/media/map/map-interaction-options.js +1 -0
  179. package/dist/components/media/map/map-layer-order.js +1 -0
  180. package/dist/components/media/map/map-loader.d.ts +35 -5
  181. package/dist/components/media/map/map-loader.js +1 -1
  182. package/dist/components/media/map/map-local-image-url.js +1 -0
  183. package/dist/components/media/map/map-local-image.js +1 -0
  184. package/dist/components/media/map/map-overlay-admission.d.ts +13 -0
  185. package/dist/components/media/map/map-overlay-admission.js +1 -0
  186. package/dist/components/media/map/map-owned-feature-input.js +1 -0
  187. package/dist/components/media/map/map-owned-features.js +1 -0
  188. package/dist/components/media/map/map-owned-resources.js +1 -0
  189. package/dist/components/media/map/map-paint-batch.js +1 -0
  190. package/dist/components/media/map/map-readers.js +1 -0
  191. package/dist/components/media/map/map-readiness.js +1 -0
  192. package/dist/components/media/map/map-resource-feature-loaders.js +1 -0
  193. package/dist/components/media/map/map-source-updates.js +1 -0
  194. package/dist/components/media/map/map-style-input.js +1 -0
  195. package/dist/components/media/map/map-style-lifecycle.js +1 -0
  196. package/dist/components/media/map/map-style-override-admission.d.ts +10 -0
  197. package/dist/components/media/map/map-style-override-admission.js +1 -0
  198. package/dist/components/media/map/map-style-overrides.js +1 -0
  199. package/dist/components/media/map/map-style-value.d.ts +3 -0
  200. package/dist/components/media/map/map-style-value.js +1 -0
  201. package/dist/components/media/map/map-vector-style.d.ts +10 -0
  202. package/dist/components/media/map/map-vector-style.js +1 -0
  203. package/dist/components/media/map/map.class.d.ts +558 -51
  204. package/dist/components/media/map/map.class.js +58 -11
  205. package/dist/components/media/map/map.styles.js +1 -1
  206. package/dist/components/media/qr-code/qr-code.class.d.ts +1 -3
  207. package/dist/components/media/qr-code/qr-code.class.js +1 -1
  208. package/dist/components/media/qr-code/qr-code.styles.js +1 -1
  209. package/dist/components/media/video/video.class.d.ts +25 -4
  210. package/dist/components/media/video/video.class.js +11 -3
  211. package/dist/components/media/video/video.styles.js +1 -1
  212. package/dist/components/media/video-playlist/video-playlist.class.d.ts +0 -1
  213. package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
  214. package/dist/components/overlays/chip/chip-group.class.d.ts +1 -1
  215. package/dist/components/overlays/chip/chip-group.class.js +1 -1
  216. package/dist/components/overlays/dialog/confirm.js +1 -1
  217. package/dist/components/overlays/overlay/popover.class.d.ts +1 -1
  218. package/dist/components/overlays/overlay/popover.class.js +2 -1
  219. package/dist/components/overlays/overlay/tooltip.class.js +1 -1
  220. package/dist/components/retrieval/chunk-inspector/chunk-inspector.class.d.ts +4 -7
  221. package/dist/components/retrieval/chunk-inspector/chunk-inspector.class.js +2 -2
  222. package/dist/components/retrieval/claim-evidence/claim-evidence.class.d.ts +2 -2
  223. package/dist/components/retrieval/community-card/community-card.class.d.ts +1 -4
  224. package/dist/components/retrieval/community-card/community-card.class.js +1 -1
  225. package/dist/components/retrieval/embedding-explorer/embedding-explorer-data.d.ts +12 -0
  226. package/dist/components/retrieval/embedding-explorer/embedding-explorer-data.js +1 -0
  227. package/dist/components/retrieval/embedding-explorer/embedding-explorer-engine.js +1 -0
  228. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.d.ts +26 -7
  229. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +35 -4
  230. package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +1 -1
  231. package/dist/components/retrieval/entity-dossier/entity-dossier.class.d.ts +3 -9
  232. package/dist/components/retrieval/graph/graph-builtin-3d-engine.js +1 -0
  233. package/dist/components/retrieval/graph/graph-engine-adapter.js +1 -0
  234. package/dist/components/retrieval/graph/graph-engine-columns.js +1 -0
  235. package/dist/components/retrieval/graph/graph-model.js +1 -1
  236. package/dist/components/retrieval/graph/graph-spatial-controller.js +13 -8
  237. package/dist/components/retrieval/graph/graph-webgl-engine.js +1 -0
  238. package/dist/components/retrieval/graph/graph.class.d.ts +18 -5
  239. package/dist/components/retrieval/graph/graph.class.js +4 -4
  240. package/dist/components/retrieval/graph/graph.styles.js +1 -1
  241. package/dist/components/retrieval/grounding-summary/grounding-summary.class.d.ts +1 -1
  242. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +1 -1
  243. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +2 -2
  244. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +6 -3
  245. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +3 -3
  246. package/dist/components/retrieval/memory-panel/memory-panel.class.d.ts +3 -10
  247. package/dist/components/retrieval/memory-panel/memory-panel.class.js +1 -1
  248. package/dist/components/retrieval/node-palette/node-palette.class.d.ts +1 -1
  249. package/dist/components/retrieval/path-strip/path-strip.class.d.ts +1 -4
  250. package/dist/components/retrieval/path-strip/path-strip.class.js +1 -1
  251. package/dist/components/retrieval/provenance-panel/provenance-panel.class.d.ts +2 -8
  252. package/dist/components/retrieval/rag-answer/rag-answer.class.d.ts +2 -2
  253. package/dist/components/retrieval/rag-answer/rag-answer.class.js +2 -3
  254. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +1 -11
  255. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +1 -1
  256. package/dist/components/retrieval/retrieval-results/retrieval-results.class.d.ts +8 -12
  257. package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +5 -6
  258. package/dist/components/retrieval/retrieval-search/retrieval-search.class.d.ts +1 -1
  259. package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.d.ts +4 -7
  260. package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.js +2 -3
  261. package/dist/components/retrieval/source-card/source-card.class.d.ts +6 -9
  262. package/dist/components/retrieval/source-card/source-card.class.js +1 -1
  263. package/dist/components/retrieval/source-picker/source-picker.class.d.ts +1 -4
  264. package/dist/components/retrieval/source-picker/source-picker.class.js +1 -1
  265. package/dist/components/utility/diff-view/diff-view.class.js +1 -1
  266. package/dist/components/utility/format/format-options.js +1 -1
  267. package/dist/components/utility/icon/icon.class.d.ts +0 -5
  268. package/dist/components/utility/icon/icon.class.js +2 -2
  269. package/dist/components/utility/icon/icon.styles.js +1 -1
  270. package/dist/components/utility/json-viewer/json-viewer.class.js +1 -1
  271. package/dist/components/utility/known-date/known-date.class.d.ts +0 -3
  272. package/dist/components/utility/known-date/known-date.class.js +1 -1
  273. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +3 -2
  274. package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
  275. package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
  276. package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
  277. package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
  278. package/dist/components/viewers/document-preview/document-preview.class.js +1 -1
  279. package/dist/components/viewers/document-viewer/document-viewer-kinds.d.ts +1 -1
  280. package/dist/components/viewers/document-viewer/document-viewer-kinds.js +1 -1
  281. package/dist/components/viewers/document-viewer/document-viewer.class.js +1 -1
  282. package/dist/components/viewers/document-viewer/registry.d.ts +1 -69
  283. package/dist/components/viewers/document-viewer/registry.js +1 -1
  284. package/dist/components/viewers/docx-viewer/docx-viewer.class.js +1 -1
  285. package/dist/components/viewers/email-viewer/email-viewer.class.js +1 -1
  286. package/dist/components/viewers/html-viewer/html-viewer.class.js +1 -1
  287. package/dist/components/viewers/include/include.class.js +1 -1
  288. package/dist/components/viewers/index.d.ts +1 -1
  289. package/dist/components/viewers/index.js +1 -1
  290. package/dist/components/viewers/model-viewer/model-viewer-document.js +1 -0
  291. package/dist/components/viewers/model-viewer/model-viewer-loader.js +1 -0
  292. package/dist/components/viewers/model-viewer/model-viewer-register.d.ts +1 -0
  293. package/dist/components/viewers/model-viewer/model-viewer-register.js +1 -0
  294. package/dist/components/viewers/model-viewer/model-viewer-source.d.ts +1 -0
  295. package/dist/components/viewers/model-viewer/model-viewer-source.js +1 -0
  296. package/dist/components/viewers/model-viewer/model-viewer.class.d.ts +61 -0
  297. package/dist/components/viewers/model-viewer/model-viewer.class.js +9 -0
  298. package/dist/components/viewers/model-viewer/model-viewer.d.ts +1 -0
  299. package/dist/components/viewers/model-viewer/model-viewer.js +1 -0
  300. package/dist/components/viewers/model-viewer/model-viewer.styles.js +1 -0
  301. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +2 -2
  302. package/dist/components/viewers/page-rail/page-rail.class.js +1 -1
  303. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +1 -1
  304. package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +3 -3
  305. package/dist/components/viewers/svg-viewer/svg-viewer.class.js +1 -1
  306. package/dist/components/viewers/table-viewer-shared.js +1 -1
  307. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +1 -1
  308. package/dist/custom-elements-jsx.d.ts +1 -1
  309. package/dist/events.d.ts +137 -92
  310. package/dist/framework-types.d.ts +2 -2
  311. package/dist/hydration.d.ts +1 -1
  312. package/dist/internal/ansi.d.ts +3 -1
  313. package/dist/internal/ansi.js +1 -1
  314. package/dist/internal/autoloader-manifest.js +1 -1
  315. package/dist/internal/autoloader-tags.d.ts +1 -1
  316. package/dist/internal/autoloader-tags.js +1 -1
  317. package/dist/internal/av-metadata.d.ts +13 -0
  318. package/dist/internal/av-metadata.js +1 -0
  319. package/dist/internal/collection-snapshot.js +1 -1
  320. package/dist/internal/component-loaders.generated.js +1 -1
  321. package/dist/internal/data-descriptors.d.ts +30 -0
  322. package/dist/internal/default-strings/agent-tools.generated.js +1 -1
  323. package/dist/internal/default-strings/charts.generated.js +1 -1
  324. package/dist/internal/default-strings/conversation.generated.js +1 -1
  325. package/dist/internal/default-strings/media.generated.js +1 -1
  326. package/dist/internal/default-strings/shared.generated.js +1 -1
  327. package/dist/internal/default-strings/viewers.generated.js +1 -1
  328. package/dist/internal/document-renderer-registry.d.ts +75 -0
  329. package/dist/internal/document-renderer-registry.js +1 -0
  330. package/dist/internal/drop-session-controller.js +1 -1
  331. package/dist/internal/engine-3d-loader.d.ts +47 -0
  332. package/dist/internal/engine-3d-loader.js +1 -0
  333. package/dist/internal/engine-3d.d.ts +57 -0
  334. package/dist/internal/engine-3d.js +1 -0
  335. package/dist/internal/hierarchy-source-controller.js +1 -1
  336. package/dist/internal/localization-runtime.js +1 -1
  337. package/dist/internal/localization-types.d.ts +1 -1
  338. package/dist/internal/localization.js +1 -1
  339. package/dist/internal/lyra-element.d.ts +2 -2
  340. package/dist/internal/lyra-element.js +1 -1
  341. package/dist/internal/model-viewer-contract.d.ts +5 -0
  342. package/dist/internal/model-viewer-contract.js +1 -0
  343. package/dist/internal/package-metadata.js +1 -1
  344. package/dist/internal/positioner.js +1 -1
  345. package/dist/internal/rendered-state.js +1 -1
  346. package/dist/internal/root-registration-allowlist.js +1 -1
  347. package/dist/internal/scoped-definitions.generated.js +1 -1
  348. package/dist/internal/typed-columns.d.ts +39 -0
  349. package/dist/internal/typed-columns.js +1 -0
  350. package/dist/localization.js +1 -1
  351. package/dist/lyra.d.ts +1 -1
  352. package/dist/lyra.js +1 -1
  353. package/dist/ssr/all.d.ts +1 -1
  354. package/dist/ssr/all.js +1 -1
  355. package/dist/ssr.d.ts +4 -4
  356. package/dist/ssr.js +1 -1
  357. package/dist/svelte.d.ts +1 -1
  358. package/dist/testing/lyra-tag-event-map.d.ts +2 -2
  359. package/dist/testing/lyra-tag-event-map.js +1 -1
  360. package/dist/theme/theme-bootstrap.js +1 -1
  361. package/dist/theme/theme.js +1 -1
  362. package/dist/vue.d.ts +1 -1
  363. package/llms/components/lr-accordion-item.md +2 -2
  364. package/llms/components/lr-agent-eval-dashboard.md +3 -3
  365. package/llms/components/lr-agent-run.md +3 -3
  366. package/llms/components/lr-agent-trace.md +1 -1
  367. package/llms/components/lr-agent-workspace.md +1 -1
  368. package/llms/components/lr-app-rail-item.md +1 -1
  369. package/llms/components/lr-app-rail.md +5 -6
  370. package/llms/components/lr-background-runs.md +4 -4
  371. package/llms/components/lr-calendar.md +1 -1
  372. package/llms/components/lr-change-review.md +5 -5
  373. package/llms/components/lr-chart-3d.md +164 -0
  374. package/llms/components/lr-chunk-inspector.md +4 -5
  375. package/llms/components/lr-citation-badge.md +1 -1
  376. package/llms/components/lr-code-block-core.md +2 -4
  377. package/llms/components/lr-command-palette.md +3 -3
  378. package/llms/components/lr-community-card.md +2 -2
  379. package/llms/components/lr-date-picker.md +1 -1
  380. package/llms/components/lr-details.md +2 -2
  381. package/llms/components/lr-diff-view.md +2 -2
  382. package/llms/components/lr-dock-panel.md +5 -10
  383. package/llms/components/lr-document-viewer.md +21 -14
  384. package/llms/components/lr-embedding-explorer.md +24 -4
  385. package/llms/components/lr-entity-dossier.md +3 -4
  386. package/llms/components/lr-eval-dataset.md +3 -3
  387. package/llms/components/lr-eval-run.md +7 -1
  388. package/llms/components/lr-file-input.md +10 -11
  389. package/llms/components/lr-flow-node.md +2 -3
  390. package/llms/components/lr-geojson-viewer.md +1 -1
  391. package/llms/components/lr-graph.md +21 -2
  392. package/llms/components/lr-grounding-summary.md +1 -1
  393. package/llms/components/lr-icon.md +1 -3
  394. package/llms/components/lr-image-viewer.md +29 -2
  395. package/llms/components/lr-ingestion-queue.md +1 -1
  396. package/llms/components/lr-knowledge-base-admin.md +2 -2
  397. package/llms/components/lr-knowledge-graph-explorer.md +7 -1
  398. package/llms/components/lr-known-date.md +3 -10
  399. package/llms/components/lr-lite-chart.md +1 -1
  400. package/llms/components/lr-map.md +861 -49
  401. package/llms/components/lr-markdown-core.md +1 -2
  402. package/llms/components/lr-memory-panel.md +4 -8
  403. package/llms/components/lr-model-viewer.md +170 -0
  404. package/llms/components/lr-navigation-menu.md +3 -4
  405. package/llms/components/lr-node-palette.md +1 -1
  406. package/llms/components/lr-path-strip.md +2 -3
  407. package/llms/components/lr-provenance-panel.md +3 -5
  408. package/llms/components/lr-qr-code.md +3 -4
  409. package/llms/components/lr-rag-answer.md +1 -1
  410. package/llms/components/lr-rag-eval-dashboard.md +2 -5
  411. package/llms/components/lr-retrieval-results.md +6 -7
  412. package/llms/components/lr-retrieval-trace.md +3 -4
  413. package/llms/components/lr-signature-pad.md +4 -3
  414. package/llms/components/lr-source-card.md +1 -1
  415. package/llms/components/lr-source-list.md +5 -5
  416. package/llms/components/lr-source-picker.md +2 -3
  417. package/llms/components/lr-span-waterfall.md +4 -3
  418. package/llms/components/lr-sparkline.md +3 -3
  419. package/llms/components/lr-subagent-panel.md +3 -3
  420. package/llms/components/lr-tool-call-chip.md +6 -6
  421. package/llms/components/lr-tool-timeline.md +1 -1
  422. package/llms/components/lr-video-playlist.md +3 -3
  423. package/llms/components/lr-video.md +29 -2
  424. package/llms/components/lr-virtual-list.md +3 -2
  425. package/llms/components/lr-widget.md +6 -13
  426. package/llms/index.md +98 -95
  427. package/llms/migration.md +27 -38
  428. package/llms/peers.md +7 -6
  429. package/llms/shared/ai-and-peers.md +1 -1
  430. package/llms/shared/events-and-types.md +8 -0
  431. package/llms/shared/imports-and-registration.md +2 -2
  432. package/llms/shared/v29-to-v30-migration.md +256 -0
  433. package/llms/shared.md +11 -3
  434. package/llms.txt +4 -4
  435. package/locales.json +1 -2328
  436. package/package.json +42 -14
  437. package/registrations.json +1 -1
  438. package/skills/lyra-ui/SKILL.md +4 -3
  439. /package/dist/{components/viewers/document-viewer → internal}/deferred-teardown.js +0 -0
  440. /package/dist/{components/viewers/document-viewer/registry-ownership.js → internal/document-renderer-registry-ownership.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{AUTO_CLASSIFICATIONS,invariant}from"./migration-contract.mjs";import{assessImperativeDefaults,camelCase,commentRanges,ecosystemForTag,finalizeEdits,htmlTemplateStyleRanges,insideRanges,insideTemplateExpression,isDynamicAttribute,kebabCase,lineStarts,localMigrationKey,namedRule,normalizedAttributeName,originLabel,pairedMarkupTokens,parseTagAttributes,quotedRangeContaining,reportEntry,scanAllOpeningTags,scanApiTagReferences,scanDirectElementChildren,scanImports,scanLocalMigrationHazards,scanMarkupTags,serializeLocalDefault}from"./migration-analysis.mjs";import{migrateRenameText}from"./migration-renames.mjs";const REDUCED_MOTION_REVIEW_TAGS=new Set(["wa-animation","sl-animation","wa-animated-image","sl-animated-image"]),ICON_VOCABULARY_REVIEW_TAGS=new Set(["wa-icon","sl-icon","sl-icon-button"]);function reducedMotionReviewMessage(upstreamTag){return`${upstreamTag} does not freeze or snap its animation under prefers-reduced-motion: reduce. The migrated Lyra target respects prefers-reduced-motion by default and does exactly that automatically. Review whether the migrated element should keep animating for users who asked for less motion, or set ignore-reduced-motion to preserve upstream playback under that preference.`}function iconVocabularyReviewMessage(upstreamTag){return`${upstreamTag}'s icon-name vocabulary is not bundled with Lyra. The default library includes only add, check, close, search, menu, chevron-left, chevron-right, chevron-down, calendar, command, and trash; any other migrated name renders no glyph. Register the required vocabulary with registerIconLibrary('default', { resolver }) or replace each name explicitly.`}function warningCode(mapping){return mapping?mapping.classification==="warning-required"?"WARNING_REQUIRED":mapping.classification==="conceptual-only"?"CONCEPTUAL_MAPPING":"UNSUPPORTED_MAPPING":"UNKNOWN_UPSTREAM_TAG"}function scanAliasedRewriteReviews(text,contract,ignoredRanges){const reviews=new Map,addUse=(mapping,tagStart,alias,offset,upstreamMember,target,message)=>{const record=reviews.get(mapping.upstreamTag)??{mapping,aliases:[],uses:[]};reviews.has(mapping.upstreamTag)||reviews.set(mapping.upstreamTag,record),record.aliases.some(entry=>entry.tagStart===tagStart)||record.aliases.push({tagStart,alias});const key=`${offset}:${upstreamMember}:${target}`;record.uses.some(entry=>entry.key===key)||record.uses.push({key,offset,alias,upstreamMember,target,message})};for(const mapping of contract.mappings.values()){if(!AUTO_CLASSIFICATIONS.has(mapping.classification))continue;const escapedTag=mapping.upstreamTag.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),declaration=new RegExp(`\\b(?:const|let|var)\\s+(?<alias>[$A-Z_a-z][$\\w]*)\\s*=\\s*(?:document\\.)?querySelector(?:<[^>\\n]+>)?\\(\\s*(['"])${escapedTag}\\2\\s*\\)`,"g");for(const match of text.matchAll(declaration)){if(insideRanges(match.index,ignoredRanges))continue;const alias=match.groups.alias,tagStart=match.index+match[0].lastIndexOf(mapping.upstreamTag),afterDeclaration=match.index+match[0].length,owner=`(?<![$\\w])${alias.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*(?:\\?\\.|!\\s*\\.|\\.)\\s*`;for(const[section,suffix]of[["methods","(?=\\s*\\()"],["properties","(?=\\s*(?:=|\\.|\\?|;|$))"]])for(const rule of mapping.rewrites[section]){const member=rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),regex=new RegExp(`${owner}(?<member>${member})${suffix}`,"g");regex.lastIndex=afterDeclaration;for(let use=regex.exec(text);use;use=regex.exec(text)){const offset=use.index+use[0].lastIndexOf(use.groups.member);insideRanges(offset,ignoredRanges)||addUse(mapping,tagStart,alias,offset,rule.from,rule.to,`Aliased ${section} member ${alias}.${rule.from} must be migrated with its selector.`)}}for(const rule of mapping.rewrites.events){const member=rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),regex=new RegExp(`${owner}(?:add|remove)EventListener\\(\\s*(['"])(?<member>${member})\\1`,"g");regex.lastIndex=afterDeclaration;for(let use=regex.exec(text);use;use=regex.exec(text)){const offset=use.index+use[0].lastIndexOf(use.groups.member);insideRanges(offset,ignoredRanges)||addUse(mapping,tagStart,alias,offset,rule.from,rule.to,`Aliased event ${alias}.${rule.from} must be migrated with its selector.`)}}for(const rule of mapping.rewrites.attributes){const member=rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),regex=new RegExp(`${owner}(?:get|set|has|toggle|remove)Attribute\\(\\s*(['"])(?<member>${member})\\1`,"g");regex.lastIndex=afterDeclaration;for(let use=regex.exec(text);use;use=regex.exec(text)){const offset=use.index+use[0].lastIndexOf(use.groups.member);insideRanges(offset,ignoredRanges)||addUse(mapping,tagStart,alias,offset,rule.from,rule.to,`Aliased attribute ${alias}.${rule.from} must be migrated with its selector.`)}}}}return reviews}function scanDynamicDefaultReviews(text,markupTokens,contract){const reviews=new Map;for(const token of markupTokens){if(token.closing)continue;const mapping=contract.mappings.get(token.tag);if(!AUTO_CLASSIFICATIONS.has(mapping?.classification))continue;const attributes=parseTagAttributes(text,token);for(const rule of mapping.rewrites.defaults){if(rule.action!=="replace-value")continue;const variants=new Set([rule.member,kebabCase(rule.member),camelCase(rule.member)]),attribute=attributes.find(entry=>variants.has(entry.rawName.replace(/^[.?:]/,"")));if(!attribute||attribute.valueKind==="boolean"||!isDynamicAttribute(attribute))continue;const record=reviews.get(mapping.upstreamTag)??{mapping,uses:[]};reviews.has(mapping.upstreamTag)||reviews.set(mapping.upstreamTag,record),record.uses.push({offset:attribute.valueStart,upstreamMember:rule.member,target:String(rule.to),message:`The ${rule.member} value is dynamic; migrate ${String(rule.from)} to ${String(rule.to)} at its source before changing this component mapping.`})}}return reviews}const RANDOM_CONTENT_BEHAVIOR_MESSAGES=Object.freeze({"host-layout":"Web Awesome uses display: contents while Lyra uses a block host with a shadow base; review inline placement and host-authored layout CSS.","multi-item-layout":"Lyra owns the simultaneous-item flex/wrap/gap context inside its shadow base instead of leaving it on the host.","unique-retry-bound":"Web Awesome promises non-repeating unique selection while Lyra uses a bounded retry and can eventually repeat.","forwarded-slot-candidates":"Lyra flattens a direct forwarding slot into projected candidates while Web Awesome treats only its direct element child as the candidate.","autoplay-semantics":"Lyra stops autoplay for reduced motion, keeps timer ticks silent, does not pause on hover, and exposes a localized paused control/state/event absent upstream."});function scanConditionalBehaviorReviews(text,markupTokens,ignoredRanges,contract){const reviews=new Map,pairs=pairedMarkupTokens(markupTokens);for(const opening of markupTokens){if(opening.closing||opening.tag!=="wa-random-content")continue;const mapping=contract.mappings.get(opening.tag);if(!AUTO_CLASSIFICATIONS.has(mapping?.classification)||!mapping.parity.behaviorReviewFlags.length)continue;const attributes=parseTagAttributes(text,opening),attribute=name=>attributes.find(candidate=>normalizedAttributeName(candidate)===name),closing=pairs.get(opening.start),children=closing?scanDirectElementChildren(text,opening.end+1,closing.start,ignoredRanges):{directTags:[],dynamicDirectContent:!opening.selfClosing},flags=[];(children.directTags.length>0||children.dynamicDirectContent)&&flags.push("host-layout");const items=attribute("items"),dynamicItems=items?isDynamicAttribute(items):!1,itemCount=!items||items.value===null?1:Number(items.value);(dynamicItems||Number.isFinite(itemCount)&&itemCount>1)&&flags.push("multi-item-layout");const mode=attribute("mode"),dynamicMode=mode?isDynamicAttribute(mode):!1,effectiveItems=Number.isFinite(itemCount)?Math.max(1,Math.trunc(itemCount)):1;(!mode||dynamicMode||mode.value==="unique")&&(dynamicMode||children.dynamicDirectContent||children.directTags.length>effectiveItems)&&flags.push("unique-retry-bound"),(children.directTags.includes("slot")||children.dynamicDirectContent)&&flags.push("forwarded-slot-candidates"),attribute("autoplay")&&flags.push("autoplay-semantics");const uniqueFlags=flags.filter((flag,index)=>mapping.parity.behaviorReviewFlags.includes(flag)&&flags.indexOf(flag)===index);uniqueFlags.length&&reviews.set(opening.start,{flags:uniqueFlags,message:`Review ${mapping.upstreamTag} before relying on the migrated behavior: `+uniqueFlags.map(flag=>`${flag}: ${RANDOM_CONTENT_BEHAVIOR_MESSAGES[flag]}`).join(" ")})}return reviews}function memberAction(section){return`rewrite-${{attributes:"attribute",properties:"property",events:"event",slots:"slot",parts:"part",cssProperties:"css-property",methods:"method"}[section]}`}function targetImport(component){return typeof component.registrationRoute=="string"?`@aceshooting/lyra-ui/${component.registrationRoute.slice(2)}`:`@aceshooting/lyra-ui/${component.registrationModule.replace(/^src\//,"").replace(/\.ts$/,".js")}`}function registrationClosure(contract,upstreamTags){const targets=new Map;for(const upstreamTag of upstreamTags??[]){const mapping=contract.mappings.get(upstreamTag);!mapping||!AUTO_CLASSIFICATIONS.has(mapping.classification)||!mapping.target||targets.set(mapping.targetTag,mapping.target)}const rootIncluded=[...targets.values()].some(component=>component.rootIncluded!==!1),granular=[...targets.values()].filter(component=>component.rootIncluded===!1).map(targetImport).sort();return[...rootIncluded?["@aceshooting/lyra-ui/all.js"]:[],...granular]}function deepImportTag(specifier,ecosystem){const match=specifier.match(/\/components\/([a-z0-9-]+)\/(?:\1(?:\.component)?|index)\.(?:js|mjs)$/);return match?`${ecosystem==="webawesome"?"wa":"sl"}-${match[1]}`:null}function packageProvidesMapping(imported,mapping){return!!(mapping&&(!mapping.source?.tier||imported.tiers.has(mapping.source.tier)))}function mappingMessage(mapping){return mapping?mapping.rationale||`The ${mapping.classification} mapping requires manual review.`:"No pinned inventory mapping exists for this upstream tag."}function localAttributeName(rawName){return rawName.replace(/^(?:v-bind:|bind:|[.?:])/,"").toLowerCase()}function migrateLocalText(original,contract,options){const file=options.file??"<memory>",origin=options.origin,profiles=contract.localMigrations.get(origin);invariant(profiles,`unknown local migration origin ${String(origin)}`);const starts=lineStarts(original),ignoredRanges=commentRanges(original),openingTokens=scanAllOpeningTags(original,ignoredRanges).filter(token=>profiles.has(token.tag)),hazards=scanLocalMigrationHazards(original,profiles,ignoredRanges,openingTokens),blocked=new Set([...options.blockedLocalMigrations??[],...hazards.blocked]),edits=[],changes=[],warnings=[],entry=(offset,tag,action,target,message,warningCode2=null,upstreamMember=null)=>reportEntry({textStarts:starts,file,offset,origin,upstreamTag:tag,upstreamMember,action,target,warningCode:warningCode2,message});for(const use of hazards.uses)warnings.push(entry(use.offset,use.tag,"manual-review",use.tag,use.message,use.warningCode));for(const token of openingTokens){const profile=profiles.get(token.tag),key=localMigrationKey(origin,token.tag);if(blocked.has(key)){warnings.push(entry(token.nameStart,token.tag,"manual-review",token.tag,`${token.tag} remains unchanged because the scanned target set contains an aliased or dynamic value requiring review.`,"MAPPING_REVIEW_BLOCKED"));continue}const attributes=parseTagAttributes(original,token),present=new Set(attributes.map(attribute=>localAttributeName(attribute.rawName))),insertions=[];for(const rule of profile.defaults)present.has(rule.member.toLowerCase())||(insertions.push(serializeLocalDefault(rule)),changes.push(entry(token.end,token.tag,"insert-default",`${rule.member}=${String(rule.value)}`,`Insert ${rule.member} to preserve the Lyra ${originLabel(origin)} default.`,null,rule.member)));if(insertions.length>0){const insertionOffset=original[token.end-1]==="/"?token.end-1:token.end;edits.push({start:insertionOffset,end:insertionOffset,replacement:` ${insertions.join(" ")}`})}}return changes.sort((left,right)=>left.line-right.line||left.column-right.column||left.action.localeCompare(right.action)),warnings.sort((left,right)=>left.line-right.line||left.column-right.column||left.warningCode.localeCompare(right.warningCode)),{content:finalizeEdits(original,edits),changes,warnings,usage:{webawesome:{automatic:0,manual:0},shoelace:{automatic:0,manual:0}},blockedMappings:new Set,blockedEcosystems:new Set,bareImportEcosystems:new Set,blockedLocalMigrations:blocked}}function scanUnrewrittenUpstreamReferences(text){const found=[],seen=new Set,push=(offset,upstreamTag,member,code,target,message)=>{const key=`${offset}:${code}`;seen.has(key)||(seen.add(key),found.push({offset,upstreamTag,member,code,target,message}))},TAG=/(?<![\w-])(?<tag>(?:wa|sl)-[a-z][a-z0-9-]*)(?![\w-])/g;for(const block of text.matchAll(/\bcss`/g)){const bodyStart=block.index+block[0].length,bodyEnd=text.indexOf("`",bodyStart);if(bodyEnd===-1)continue;const body=text.slice(bodyStart,bodyEnd);for(const match of body.matchAll(TAG)){const tag=match.groups.tag;push(bodyStart+match.index,tag,"css-template","CSS_IN_JS_SELECTOR_REVIEW",tag,`\`${tag}\` appears in a css\`\` template and was NOT rewritten. A rule keyed on a tag that no longer exists matches nothing, silently. Rename the selector by hand.`)}}for(const match of text.matchAll(/::slotted\(\s*([^)]*)\)/g))for(const inner of match[1].matchAll(TAG)){const tag=inner.groups.tag;push(match.index+match[0].indexOf(inner.groups.tag),tag,"::slotted","SLOTTED_SELECTOR_REVIEW",tag,`\`::slotted(${tag})\` was NOT rewritten and will match nothing after the migration. Rename it by hand.`)}const CALL=/\bthis(?:\s*\??\.\s*(?:shadowRoot|renderRoot))?\s*\??\.\s*(?:querySelector|querySelectorAll|closest|matches)\s*(?:<[^>\n]+>)?\(\s*(['"`])(?<selector>[^'"`]*)\1/g;for(const match of text.matchAll(CALL)){const selectorOffset=match.index+match[0].lastIndexOf(match.groups.selector);for(const inner of match.groups.selector.matchAll(TAG)){const tag=inner.groups.tag;push(selectorOffset+inner.index,tag,"selector-string","SELECTOR_STRING_REVIEW",tag,`\`${tag}\` appears in a DOM selector string that was NOT rewritten. The query will return null after the migration rather than throwing. Rename it by hand.`)}}const declaredHere=new Set([...text.matchAll(/(--(?:wa|sl)-[a-z0-9-]+)\s*:/g)].map(match=>match[1]));for(const match of text.matchAll(/--(?<ecosystem>wa|sl)-[a-z0-9-]+/g)){const token=match[0];declaredHere.has(token)||push(match.index,`${match.groups.ecosystem}-tokens`,"custom-property","UPSTREAM_TOKEN_REVIEW",token,`\`${token}\` is an upstream design token with no automatic Lyra equivalent, and was left as-is. A var() naming a token that no longer exists falls back to its second argument, or to nothing -- silently. Map it by hand against llms/tokens.md; note the spacing scales are offset by one step, so renaming by name alone tightens every gap.`)}return found}function migrateText(original,contract,options={}){if(options.origin&&contract.renameProfiles?.has(options.origin))return migrateRenameText(original,contract,options);if(options.origin)return migrateLocalText(original,contract,options);const file=options.file??"<memory>",rewriteBarePackages=options.rewriteBarePackages??new Set,rootRegistrationMappings=options.rootRegistrationMappings??new Map,starts=lineStarts(original),ignoredRanges=commentRanges(original),htmlStyleRanges=htmlTemplateStyleRanges(original),markupTokens=scanMarkupTags(original,ignoredRanges),allOpeningTokens=scanAllOpeningTags(original,ignoredRanges),apiReferences=scanApiTagReferences(original,ignoredRanges,options.domFactoryBindings),aliasReviews=scanAliasedRewriteReviews(original,contract,ignoredRanges),dynamicDefaultReviews=scanDynamicDefaultReviews(original,markupTokens,contract),conditionalBehaviorReviews=scanConditionalBehaviorReviews(original,markupTokens,ignoredRanges,contract),imports=scanImports(original,ignoredRanges,contract),bareImportPackages=new Set(imports.filter(imported=>imported.sideEffect&&!imported.subpath).map(imported=>imported.packageName)),blockedMappings=new Set([...options.blockedMappings??[],...aliasReviews.keys(),...dynamicDefaultReviews.keys()]),imperativeDefaultReviews=apiReferences.flatMap(reference=>{if(reference.kind!=="construction")return[];const mapping=contract.mappings.get(reference.tag),defaults=mapping?.rewrites.defaults.filter(rule=>rule.action==="insert-if-absent")??[];if(!mapping||!AUTO_CLASSIFICATIONS.has(mapping.classification)||defaults.length===0)return[];const assessment=assessImperativeDefaults(original,reference,defaults);return assessment.safe?[]:(blockedMappings.add(mapping.upstreamTag),[{reference,mapping,defaults,missing:assessment.missing}])}),registrationBlockedMappings=new Set(options.registrationBlockedMappings??[]),blockedEcosystems=new Set(options.blockedEcosystems??[]);for(const imported of imports){if(imported.sideEffect)continue;const upstreamTag=imported.subpath?deepImportTag(imported.specifier,imported.ecosystem):null,mapping=upstreamTag?contract.mappings.get(upstreamTag):null;mapping&&AUTO_CLASSIFICATIONS.has(mapping.classification)?blockedMappings.add(mapping.upstreamTag):imported.subpath||blockedEcosystems.add(imported.ecosystem)}const edits=[],changes=[],warnings=[],usage={webawesome:{automatic:0,manual:0},shoelace:{automatic:0,manual:0}},automaticMappings=new Set,deepRegistrationMappings=new Set,reportedOptionalPeers=new Set,reportOrigin=(upstreamTag,origin)=>origin??(upstreamTag?.startsWith("wa-")?"webawesome":upstreamTag?.startsWith("sl-")?"shoelace":null),change=(offset,upstreamTag,upstreamMember,action,target,message,origin=null)=>{changes.push(reportEntry({textStarts:starts,file,offset,origin:reportOrigin(upstreamTag,origin),upstreamTag,upstreamMember,action,target,message}))},warn=(offset,upstreamTag,upstreamMember,code,target,message,origin=null,behaviorReviewFlags=null)=>{warnings.push(reportEntry({textStarts:starts,file,offset,origin:reportOrigin(upstreamTag,origin),upstreamTag,upstreamMember,action:"manual-review",target,warningCode:code,behaviorReviewFlags,message}))},noteRuntimeRequirements=(mapping,offset)=>{for(const peer of mapping.target?.optionalPeers??[]){const key=`${mapping.targetTag}:${peer}`;reportedOptionalPeers.has(key)||(reportedOptionalPeers.add(key),warn(offset,mapping.upstreamTag,"runtime","OPTIONAL_PEER_REQUIRED",peer,`${mapping.targetTag} requires the optional peer package ${peer}; install a compatible version before relying on the migrated component.`))}},noteAutomatic=(mapping,offset)=>{automaticMappings.add(mapping.upstreamTag),noteRuntimeRequirements(mapping,offset)},addEdit=(start,end,replacement,details)=>{edits.push({start,end,replacement}),change(start,details.upstreamTag,details.upstreamMember,details.action,details.target,details.message,details.origin)},isBlocked=mapping=>!!mapping&&(blockedMappings.has(mapping.upstreamTag)||registrationBlockedMappings.has(mapping.upstreamTag)||blockedEcosystems.has(mapping.upstream)),isBlockedAutomatic=mapping=>AUTO_CLASSIFICATIONS.has(mapping?.classification)&&isBlocked(mapping),isAutomatic=mapping=>AUTO_CLASSIFICATIONS.has(mapping?.classification)&&!isBlocked(mapping),blockedMessage=mapping=>registrationBlockedMappings.has(mapping.upstreamTag)?`${mapping.upstreamTag} remains unchanged because the scanned target set does not prove registration for ${mapping.targetTag}. Include ${targetImport(mapping.target)} in the scan or migrate the file that owns its supported root registration import.`:`${mapping.upstreamTag} remains unchanged because the scanned target set contains a use that requires manual member, default, or import review.`,blockedWarningCode=mapping=>registrationBlockedMappings.has(mapping.upstreamTag)?"REGISTRATION_CLOSURE_REQUIRED":"MAPPING_REVIEW_BLOCKED";for(const{mapping,uses}of aliasReviews.values())for(const use of uses)warn(use.offset,mapping.upstreamTag,use.upstreamMember,"ALIASED_MEMBER_REVIEW",use.target,use.message);for(const{mapping,uses}of dynamicDefaultReviews.values())for(const use of uses)warn(use.offset,mapping.upstreamTag,use.upstreamMember,"DYNAMIC_VALUE_REVIEW",use.target,use.message);for(const{reference,mapping,defaults,missing}of imperativeDefaultReviews)warn(reference.start,mapping.upstreamTag,null,"IMPERATIVE_DEFAULT_REVIEW",mapping.targetTag,`${mapping.upstreamTag} is constructed imperatively and requires explicit migrated defaults (${defaults.map(rule=>`${rule.member}=${String(rule.value)}`).join(", ")}); review the created element before renaming this mapping. No unconditional immediate assignment was proven for ${missing.map(rule=>rule.member).join(", ")}.`);const openingTokens=[],manualOpeningTags=new Set;for(const token of markupTokens){const mapping=contract.mappings.get(token.tag),ecosystem=ecosystemForTag(token.tag);if(!isAutomatic(mapping)){if(mapping&&noteRuntimeRequirements(mapping,token.nameStart),token.closing&&manualOpeningTags.has(token.tag))continue;token.closing||manualOpeningTags.add(token.tag),usage[ecosystem].manual+=1,warn(token.nameStart,token.tag,null,isBlockedAutomatic(mapping)?blockedWarningCode(mapping):warningCode(mapping),mapping?.targetTag??null,isBlockedAutomatic(mapping)?blockedMessage(mapping):mappingMessage(mapping),null,mapping?.parity?.behaviorReviewFlags);continue}usage[ecosystem].automatic+=1,noteAutomatic(mapping,token.nameStart),addEdit(token.nameStart,token.nameEnd,mapping.targetTag,{upstreamTag:token.tag,upstreamMember:null,action:"rewrite-tag",target:mapping.targetTag,message:`Rename ${token.tag} to ${mapping.targetTag}.`});const behaviorReview=conditionalBehaviorReviews.get(token.start);behaviorReview&&warn(token.nameStart,mapping.upstreamTag,null,"BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,behaviorReview.message,null,behaviorReview.flags),!token.closing&&REDUCED_MOTION_REVIEW_TAGS.has(token.tag)&&warn(token.nameStart,mapping.upstreamTag,null,"BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,reducedMotionReviewMessage(mapping.upstreamTag),null,["reduced-motion-default"]),!token.closing&&ICON_VOCABULARY_REVIEW_TAGS.has(token.tag)&&warn(token.nameStart,mapping.upstreamTag,null,"BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,iconVocabularyReviewMessage(mapping.upstreamTag),null,["icon-name-vocabulary"]),token.closing||openingTokens.push({token,mapping,attributes:parseTagAttributes(original,token)})}for(const reference of apiReferences){const mapping=contract.mappings.get(reference.tag),ecosystem=ecosystemForTag(reference.tag);if(!isAutomatic(mapping)){mapping&&noteRuntimeRequirements(mapping,reference.start),usage[ecosystem].manual+=1,warn(reference.start,reference.tag,null,isBlockedAutomatic(mapping)?blockedWarningCode(mapping):warningCode(mapping),mapping?.targetTag??null,isBlockedAutomatic(mapping)?blockedMessage(mapping):mappingMessage(mapping),null,mapping?.parity?.behaviorReviewFlags);continue}usage[ecosystem].automatic+=1,noteAutomatic(mapping,reference.start),addEdit(reference.start,reference.end,mapping.targetTag,{upstreamTag:reference.tag,upstreamMember:null,action:"rewrite-tag",target:mapping.targetTag,message:`Rename ${reference.tag} to ${mapping.targetTag}.`}),REDUCED_MOTION_REVIEW_TAGS.has(reference.tag)&&warn(reference.start,mapping.upstreamTag,null,"BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,reducedMotionReviewMessage(mapping.upstreamTag),null,["reduced-motion-default"]),ICON_VOCABULARY_REVIEW_TAGS.has(reference.tag)&&warn(reference.start,mapping.upstreamTag,null,"BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,iconVocabularyReviewMessage(mapping.upstreamTag),null,["icon-name-vocabulary"])}for(const{token,mapping,attributes}of openingTokens){for(const attribute of attributes){const rule=namedRule(attribute.rawName,mapping);rule&&addEdit(attribute.nameStart,attribute.nameEnd,rule.replacement,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:memberAction(rule.section),target:rule.to,message:`Rewrite ${rule.section} member ${rule.from} to ${rule.to}.`})}const insertions=[];for(const rule of mapping.rewrites.defaults){const variants=new Set([rule.member,kebabCase(rule.member),camelCase(rule.member)]),attribute=attributes.find(entry=>variants.has(entry.rawName.replace(/^[.?:]/,"")));if(rule.action==="insert-if-absent"){if(attribute)continue;insertions.push(`${kebabCase(rule.member)}="${String(rule.value).replaceAll("&","&amp;").replaceAll('"',"&quot;")}"`),change(token.end,mapping.upstreamTag,rule.member,"insert-default",`${rule.member}=${String(rule.value)}`,`Insert ${rule.member} to preserve the upstream default.`);continue}!attribute||attribute.valueKind==="boolean"||(isDynamicAttribute(attribute)?(usage[mapping.upstream].manual+=1,warn(attribute.valueStart,mapping.upstreamTag,rule.member,"DYNAMIC_VALUE_REVIEW",String(rule.to),`The ${rule.member} value is dynamic; replace ${String(rule.from)} with ${String(rule.to)} at its source.`)):attribute.value===String(rule.from)&&addEdit(attribute.valueStart,attribute.valueEnd,String(rule.to),{upstreamTag:mapping.upstreamTag,upstreamMember:rule.member,action:"replace-default",target:String(rule.to),message:`Replace ${rule.member} value ${String(rule.from)} with ${String(rule.to)}.`}))}if(insertions.length){const insertionOffset=original[token.end-1]==="/"?token.end-1:token.end;edits.push({start:insertionOffset,end:insertionOffset,replacement:` ${insertions.join(" ")}`})}}const stack=[],pairs=[];for(const token of markupTokens)if(!token.closing&&!token.selfClosing)stack.push(token);else if(token.closing)for(let index=stack.length-1;index>=0;index-=1){if(stack[index].tag!==token.tag)continue;const[opening]=stack.splice(index,1);pairs.push({opening,closing:token});break}for(const{opening,closing}of pairs){const mapping=contract.mappings.get(opening.tag);if(!(!isAutomatic(mapping)||!mapping.rewrites.slots.length)){for(const descendant of allOpeningTokens)if(!(descendant.start<=opening.end||descendant.end>=closing.start))for(const attribute of parseTagAttributes(original,descendant))if(attribute.rawName==="slot"&&attribute.valueKind==="literal"){const rule=mapping.rewrites.slots.find(entry=>entry.from===attribute.value);rule&&addEdit(attribute.valueStart,attribute.valueEnd,rule.to,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:"rewrite-slot",target:rule.to,message:`Rewrite slot ${rule.from} to ${rule.to}.`})}else{const prefix=attribute.rawName.startsWith("v-slot:")?"v-slot:":attribute.rawName.startsWith("#")?"#":null;if(!prefix)continue;const name=attribute.rawName.slice(prefix.length),rule=mapping.rewrites.slots.find(entry=>entry.from===name);rule&&addEdit(attribute.nameStart,attribute.nameEnd,`${prefix}${rule.to}`,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:"rewrite-slot",target:rule.to,message:`Rewrite slot ${rule.from} to ${rule.to}.`})}}}const cssRule=/(?<selector>[^{}]+)\{(?<body>[^{}]*)\}/g;for(const match of original.matchAll(cssRule)){if(insideRanges(match.index,ignoredRanges))continue;const selectorStart=match.index,bodyStart=match.index+match[0].indexOf(match.groups.body);for(const mapping of contract.mappings.values()){const tagPattern=new RegExp(`(?<![a-z0-9-])${mapping.upstreamTag}(?![a-z0-9-])`,"g"),selectorMatches=[...match.groups.selector.matchAll(tagPattern)].filter(tagMatch=>{const offset=selectorStart+tagMatch.index;if(insideRanges(offset,ignoredRanges))return!1;const quoted=quotedRangeContaining(original,offset);return quoted?insideRanges(offset,htmlStyleRanges)&&!insideTemplateExpression(original,quoted[0],offset):!0});if(selectorMatches.length){if(!isAutomatic(mapping)){usage[mapping.upstream].manual+=selectorMatches.length;for(const tagMatch of selectorMatches){const offset=selectorStart+tagMatch.index;noteRuntimeRequirements(mapping,offset),warn(offset,mapping.upstreamTag,null,isBlockedAutomatic(mapping)?blockedWarningCode(mapping):warningCode(mapping),mapping.targetTag,isBlockedAutomatic(mapping)?blockedMessage(mapping):mappingMessage(mapping),null,mapping?.parity?.behaviorReviewFlags)}continue}for(const tagMatch of selectorMatches){const offset=selectorStart+tagMatch.index;if(noteAutomatic(mapping,offset),mapping.upstreamTag==="wa-random-content"){const flags=["host-layout","multi-item-layout"];warn(offset,mapping.upstreamTag,"selector","BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,"Review this selector after migration: Web Awesome lays candidates out through the host, while Lyra uses a block host and owns simultaneous-item flex layout inside its shadow base.",null,flags)}addEdit(offset,offset+mapping.upstreamTag.length,mapping.targetTag,{upstreamTag:mapping.upstreamTag,upstreamMember:null,action:"rewrite-tag",target:mapping.targetTag,message:`Rename ${mapping.upstreamTag} selector to ${mapping.targetTag}.`})}for(const rule of mapping.rewrites.parts){const pattern=new RegExp(`(?<=::part\\()${rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?=\\))`,"g");for(const partMatch of match.groups.selector.matchAll(pattern)){const offset=selectorStart+partMatch.index;insideRanges(offset,ignoredRanges)||addEdit(offset,offset+rule.from.length,rule.to,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:"rewrite-part",target:rule.to,message:`Rewrite CSS part ${rule.from} to ${rule.to}.`})}}for(const rule of mapping.rewrites.cssProperties){const pattern=new RegExp(`${rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![a-z0-9-])`,"g");for(const propertyMatch of match.groups.body.matchAll(pattern)){const offset=bodyStart+propertyMatch.index;insideRanges(offset,ignoredRanges)||addEdit(offset,offset+rule.from.length,rule.to,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:"rewrite-css-property",target:rule.to,message:`Rewrite CSS custom property ${rule.from} to ${rule.to}.`})}}}}}for(const mapping of contract.mappings.values()){if(!isAutomatic(mapping))continue;const owner=`(?:document\\.)?querySelector(?:<[^>\\n]+>)?\\(\\s*(['"])${mapping.upstreamTag.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\1\\s*\\)`;for(const[section,suffix]of[["methods","(?=\\s*\\()"],["properties","(?=\\s*(?:=|\\.|\\?|;|$))"]])for(const rule of mapping.rewrites[section]){const escaped=rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),regex=new RegExp(`${owner}\\s*(?:\\?\\.|!\\s*\\.|\\.)\\s*(?<member>${escaped})${suffix}`,"g");for(const memberMatch of original.matchAll(regex)){if(insideRanges(memberMatch.index,ignoredRanges))continue;const relative=memberMatch[0].lastIndexOf(memberMatch.groups.member),offset=memberMatch.index+relative;addEdit(offset,offset+rule.from.length,rule.to,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:memberAction(section),target:rule.to,message:`Rewrite ${section} member ${rule.from} to ${rule.to}.`})}}for(const rule of mapping.rewrites.events){const escaped=rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),regex=new RegExp(`${owner}\\s*(?:\\?\\.|!\\s*\\.|\\.)\\s*(?:add|remove)EventListener\\(\\s*(['"])(?<member>${escaped})\\2`,"g");for(const eventMatch of original.matchAll(regex)){if(insideRanges(eventMatch.index,ignoredRanges))continue;const relative=eventMatch[0].lastIndexOf(eventMatch.groups.member),offset=eventMatch.index+relative;addEdit(offset,offset+rule.from.length,rule.to,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:"rewrite-event",target:rule.to,message:`Rewrite event ${rule.from} to ${rule.to}.`})}}}for(const imported of imports){const{ecosystem}=imported;if(!imported.sideEffect){usage[ecosystem].manual+=1,warn(imported.start,imported.subpath?deepImportTag(imported.specifier,ecosystem):null,"module","IMPORT_BINDING_REVIEW_REQUIRED",null,`The ${imported.kind} import has runtime/type bindings whose exported names cannot be inferred safely.`,ecosystem);continue}if(!imported.subpath){const canRewrite=rewriteBarePackages.has(ecosystem)||rewriteBarePackages.has(imported.packageName),registeredMappings=rootRegistrationMappings.get(imported.packageName)??rootRegistrationMappings.get(ecosystem)??new Set,closure=registrationClosure(contract,registeredMappings);if(canRewrite&&closure.length>0){addEdit(imported.start,imported.end,closure[0],{upstreamTag:null,origin:ecosystem,upstreamMember:"module",action:"rewrite-import",target:closure[0],message:`Rewrite ${imported.packageName} root registration import to its proven Lyra registration closure.`});const lineEnding=original.includes(`\r
1
+ import{AUTO_CLASSIFICATIONS,invariant}from"./migration-contract.mjs";import{assessImperativeDefaults,camelCase,commentRanges,ecosystemForTag,finalizeEdits,htmlTemplateStyleRanges,insideRanges,insideTemplateExpression,isDynamicAttribute,kebabCase,lineStarts,localMigrationKey,namedRule,normalizedAttributeName,originLabel,pairedMarkupTokens,parseTagAttributes,quotedRangeContaining,reportEntry,scanAllOpeningTags,scanApiTagReferences,scanDirectElementChildren,scanImports,scanLocalMigrationHazards,scanMarkupTags,serializeLocalDefault}from"./migration-analysis.mjs";import{migrateRenameText}from"./migration-renames.mjs";const REDUCED_MOTION_REVIEW_TAGS=new Set(["wa-animation","sl-animation","wa-animated-image","sl-animated-image"]),ICON_VOCABULARY_REVIEW_TAGS=new Set(["wa-icon","sl-icon","sl-icon-button"]);function reducedMotionReviewMessage(upstreamTag){return`${upstreamTag} does not freeze or snap its animation under prefers-reduced-motion: reduce. The migrated Lyra target respects prefers-reduced-motion by default and does exactly that automatically. Review whether the migrated element should keep animating for users who asked for less motion, or set ignore-reduced-motion to preserve upstream playback under that preference.`}function iconVocabularyReviewMessage(upstreamTag){return`${upstreamTag}'s icon-name vocabulary is not bundled with Lyra. The default library includes only add, check, close, search, menu, chevron-left, chevron-right, chevron-down, calendar, command, and trash; any other migrated name renders no glyph. Register the required vocabulary with registerIconLibrary('default', { resolver }) or replace each name explicitly.`}function warningCode(mapping){return mapping?mapping.classification==="warning-required"?"WARNING_REQUIRED":mapping.classification==="conceptual-only"?"CONCEPTUAL_MAPPING":"UNSUPPORTED_MAPPING":"UNKNOWN_UPSTREAM_TAG"}function scanAliasedRewriteReviews(text,contract,ignoredRanges){const reviews=new Map,addUse=(mapping,tagStart,alias,offset,upstreamMember,target,message)=>{const record=reviews.get(mapping.upstreamTag)??{mapping,aliases:[],uses:[]};reviews.has(mapping.upstreamTag)||reviews.set(mapping.upstreamTag,record),record.aliases.some(entry=>entry.tagStart===tagStart)||record.aliases.push({tagStart,alias});const key=`${offset}:${upstreamMember}:${target}`;record.uses.some(entry=>entry.key===key)||record.uses.push({key,offset,alias,upstreamMember,target,message})};for(const mapping of contract.mappings.values()){if(!AUTO_CLASSIFICATIONS.has(mapping.classification))continue;const escapedTag=mapping.upstreamTag.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),declaration=new RegExp(`\\b(?:const|let|var)\\s+(?<alias>[$A-Z_a-z][$\\w]*)\\s*=\\s*(?:document\\.)?querySelector(?:<[^>\\n]+>)?\\(\\s*(['"])${escapedTag}\\2\\s*\\)`,"g");for(const match of text.matchAll(declaration)){if(insideRanges(match.index,ignoredRanges))continue;const alias=match.groups.alias,tagStart=match.index+match[0].lastIndexOf(mapping.upstreamTag),afterDeclaration=match.index+match[0].length,owner=`(?<![$\\w])${alias.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*(?:\\?\\.|!\\s*\\.|\\.)\\s*`;for(const[section,suffix]of[["methods","(?=\\s*\\()"],["properties","(?=\\s*(?:=|\\.|\\?|;|$))"]])for(const rule of mapping.rewrites[section]){const member=rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),regex=new RegExp(`${owner}(?<member>${member})${suffix}`,"g");regex.lastIndex=afterDeclaration;for(let use=regex.exec(text);use;use=regex.exec(text)){const offset=use.index+use[0].lastIndexOf(use.groups.member);insideRanges(offset,ignoredRanges)||addUse(mapping,tagStart,alias,offset,rule.from,rule.to,`Aliased ${section} member ${alias}.${rule.from} must be migrated with its selector.`)}}for(const rule of mapping.rewrites.events){const member=rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),regex=new RegExp(`${owner}(?:add|remove)EventListener\\(\\s*(['"])(?<member>${member})\\1`,"g");regex.lastIndex=afterDeclaration;for(let use=regex.exec(text);use;use=regex.exec(text)){const offset=use.index+use[0].lastIndexOf(use.groups.member);insideRanges(offset,ignoredRanges)||addUse(mapping,tagStart,alias,offset,rule.from,rule.to,`Aliased event ${alias}.${rule.from} must be migrated with its selector.`)}}for(const rule of mapping.rewrites.attributes){const member=rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),regex=new RegExp(`${owner}(?:get|set|has|toggle|remove)Attribute\\(\\s*(['"])(?<member>${member})\\1`,"g");regex.lastIndex=afterDeclaration;for(let use=regex.exec(text);use;use=regex.exec(text)){const offset=use.index+use[0].lastIndexOf(use.groups.member);insideRanges(offset,ignoredRanges)||addUse(mapping,tagStart,alias,offset,rule.from,rule.to,`Aliased attribute ${alias}.${rule.from} must be migrated with its selector.`)}}}}return reviews}function scanDynamicDefaultReviews(text,markupTokens,contract){const reviews=new Map;for(const token of markupTokens){if(token.closing)continue;const mapping=contract.mappings.get(token.tag);if(!AUTO_CLASSIFICATIONS.has(mapping?.classification))continue;const attributes=parseTagAttributes(text,token);for(const rule of mapping.rewrites.defaults){if(rule.action!=="replace-value")continue;const variants=new Set([rule.member,kebabCase(rule.member),camelCase(rule.member)]),attribute=attributes.find(entry=>variants.has(entry.rawName.replace(/^[.?:]/,"")));if(!attribute||attribute.valueKind==="boolean"||!isDynamicAttribute(attribute))continue;const record=reviews.get(mapping.upstreamTag)??{mapping,uses:[]};reviews.has(mapping.upstreamTag)||reviews.set(mapping.upstreamTag,record),record.uses.push({offset:attribute.valueStart,upstreamMember:rule.member,target:String(rule.to),message:`The ${rule.member} value is dynamic; migrate ${String(rule.from)} to ${String(rule.to)} at its source before changing this component mapping.`})}}return reviews}const RANDOM_CONTENT_BEHAVIOR_MESSAGES=Object.freeze({"host-layout":"Web Awesome uses display: contents while Lyra uses a block host with a shadow base; review inline placement and host-authored layout CSS.","multi-item-layout":"Lyra owns the simultaneous-item flex/wrap/gap context inside its shadow base instead of leaving it on the host.","unique-retry-bound":"Web Awesome promises non-repeating unique selection while Lyra uses a bounded retry and can eventually repeat.","forwarded-slot-candidates":"Lyra flattens a direct forwarding slot into projected candidates while Web Awesome treats only its direct element child as the candidate.","autoplay-semantics":"Lyra stops autoplay for reduced motion, keeps timer ticks silent, does not pause on hover, and exposes a localized paused control/state/event absent upstream."});function scanConditionalBehaviorReviews(text,markupTokens,ignoredRanges,contract){const reviews=new Map,pairs=pairedMarkupTokens(markupTokens);for(const opening of markupTokens){if(opening.closing||opening.tag!=="wa-random-content")continue;const mapping=contract.mappings.get(opening.tag);if(!AUTO_CLASSIFICATIONS.has(mapping?.classification)||!mapping.parity.behaviorReviewFlags.length)continue;const attributes=parseTagAttributes(text,opening),attribute=name=>attributes.find(candidate=>normalizedAttributeName(candidate)===name),closing=pairs.get(opening.start),children=closing?scanDirectElementChildren(text,opening.end+1,closing.start,ignoredRanges):{directTags:[],dynamicDirectContent:!opening.selfClosing},flags=[];(children.directTags.length>0||children.dynamicDirectContent)&&flags.push("host-layout");const items=attribute("items"),dynamicItems=items?isDynamicAttribute(items):!1,itemCount=!items||items.value===null?1:Number(items.value);(dynamicItems||Number.isFinite(itemCount)&&itemCount>1)&&flags.push("multi-item-layout");const mode=attribute("mode"),dynamicMode=mode?isDynamicAttribute(mode):!1,effectiveItems=Number.isFinite(itemCount)?Math.max(1,Math.trunc(itemCount)):1;(!mode||dynamicMode||mode.value==="unique")&&(dynamicMode||children.dynamicDirectContent||children.directTags.length>effectiveItems)&&flags.push("unique-retry-bound"),(children.directTags.includes("slot")||children.dynamicDirectContent)&&flags.push("forwarded-slot-candidates"),attribute("autoplay")&&flags.push("autoplay-semantics");const uniqueFlags=flags.filter((flag,index)=>mapping.parity.behaviorReviewFlags.includes(flag)&&flags.indexOf(flag)===index);uniqueFlags.length&&reviews.set(opening.start,{flags:uniqueFlags,message:`Review ${mapping.upstreamTag} before relying on the migrated behavior: `+uniqueFlags.map(flag=>`${flag}: ${RANDOM_CONTENT_BEHAVIOR_MESSAGES[flag]}`).join(" ")})}return reviews}function memberAction(section){return`rewrite-${{attributes:"attribute",properties:"property",events:"event",slots:"slot",parts:"part",cssProperties:"css-property",methods:"method"}[section]}`}function targetImport(component){return typeof component.registrationRoute=="string"?`@aceshooting/lyra-ui/${component.registrationRoute.slice(2)}`:`@aceshooting/lyra-ui/${component.registrationModule.replace(/^src\//,"").replace(/\.ts$/,".js")}`}function registrationClosure(contract,upstreamTags){const targets=new Map;for(const upstreamTag of upstreamTags??[]){const mapping=contract.mappings.get(upstreamTag);!mapping||!AUTO_CLASSIFICATIONS.has(mapping.classification)||!mapping.target||targets.set(mapping.targetTag,mapping.target)}const rootIncluded=[...targets.values()].some(component=>component.rootIncluded!==!1),granular=[...targets.values()].filter(component=>component.rootIncluded===!1).map(targetImport).sort();return[...rootIncluded?["@aceshooting/lyra-ui/all.js"]:[],...granular]}function deepImportTag(specifier,ecosystem){const match=specifier.match(/\/components\/([a-z0-9-]+)\/(?:\1(?:\.component)?|index)\.(?:js|mjs)$/);return match?`${ecosystem==="webawesome"?"wa":"sl"}-${match[1]}`:null}function packageProvidesMapping(imported,mapping){return!!(mapping&&(!mapping.source?.tier||imported.tiers.has(mapping.source.tier)))}function mappingMessage(mapping){return mapping?mapping.rationale||`The ${mapping.classification} mapping requires manual review.`:"No pinned inventory mapping exists for this upstream tag."}function localAttributeName(rawName){return rawName.replace(/^(?:v-bind:|bind:|[.?:])/,"").toLowerCase()}function migrateLocalText(original,contract,options){const file=options.file??"<memory>",origin=options.origin,profiles=contract.localMigrations.get(origin);invariant(profiles,`unknown local migration origin ${String(origin)}`);const starts=lineStarts(original),ignoredRanges=commentRanges(original),openingTokens=scanAllOpeningTags(original,ignoredRanges).filter(token=>profiles.has(token.tag)),hazards=scanLocalMigrationHazards(original,profiles,ignoredRanges,openingTokens),blocked=new Set([...options.blockedLocalMigrations??[],...hazards.blocked]),edits=[],changes=[],warnings=[],entry=(offset,tag,action,target,message,warningCode2=null,upstreamMember=null)=>reportEntry({textStarts:starts,file,offset,origin,upstreamTag:tag,upstreamMember,action,target,warningCode:warningCode2,message});for(const use of hazards.uses)warnings.push(entry(use.offset,use.tag,"manual-review",use.tag,use.message,use.warningCode));for(const token of openingTokens){const profile=profiles.get(token.tag),key=localMigrationKey(origin,token.tag);if(blocked.has(key)){warnings.push(entry(token.nameStart,token.tag,"manual-review",token.tag,`${token.tag} remains unchanged because the scanned target set contains an aliased or dynamic value requiring review.`,"MAPPING_REVIEW_BLOCKED"));continue}const attributes=parseTagAttributes(original,token),present=new Set(attributes.map(attribute=>localAttributeName(attribute.rawName))),insertions=[];for(const rule of profile.defaults)present.has(rule.member.toLowerCase())||(insertions.push(serializeLocalDefault(rule)),changes.push(entry(token.end,token.tag,"insert-default",`${rule.member}=${String(rule.value)}`,`Insert ${rule.member} to preserve the Lyra ${originLabel(origin)} default.`,null,rule.member)));if(insertions.length>0){const insertionOffset=original[token.end-1]==="/"?token.end-1:token.end;edits.push({start:insertionOffset,end:insertionOffset,replacement:` ${insertions.join(" ")}`})}}return changes.sort((left,right)=>left.line-right.line||left.column-right.column||left.action.localeCompare(right.action)),warnings.sort((left,right)=>left.line-right.line||left.column-right.column||left.warningCode.localeCompare(right.warningCode)),{content:finalizeEdits(original,edits),changes,warnings,usage:{webawesome:{automatic:0,manual:0},shoelace:{automatic:0,manual:0}},blockedMappings:new Set,blockedEcosystems:new Set,bareImportEcosystems:new Set,blockedLocalMigrations:blocked}}function scanUnrewrittenUpstreamReferences(text){const found=[],seen=new Set,push=(offset,upstreamTag,member,code,target,message)=>{const key=`${offset}:${code}`;seen.has(key)||(seen.add(key),found.push({offset,upstreamTag,member,code,target,message}))},TAG=/(?<![\w-])(?<tag>(?:wa|sl)-[a-z][a-z0-9-]*)(?![\w-])/g;for(const block of text.matchAll(/\bcss`/g)){const bodyStart=block.index+block[0].length,bodyEnd=text.indexOf("`",bodyStart);if(bodyEnd===-1)continue;const body=text.slice(bodyStart,bodyEnd);for(const match of body.matchAll(TAG)){const tag=match.groups.tag;push(bodyStart+match.index,tag,"css-template","CSS_IN_JS_SELECTOR_REVIEW",tag,`\`${tag}\` appears in a css\`\` template and was NOT rewritten. A rule keyed on a tag that no longer exists matches nothing, silently. Rename the selector by hand.`)}}for(const match of text.matchAll(/::slotted\(\s*([^)]*)\)/g))for(const inner of match[1].matchAll(TAG)){const tag=inner.groups.tag;push(match.index+match[0].indexOf(inner.groups.tag),tag,"::slotted","SLOTTED_SELECTOR_REVIEW",tag,`\`::slotted(${tag})\` was NOT rewritten and will match nothing after the migration. Rename it by hand.`)}const CALL=/\bthis(?:\s*\??\.\s*(?:shadowRoot|renderRoot))?\s*\??\.\s*(?:querySelector|querySelectorAll|closest|matches)\s*(?:<[^>\n]+>)?\(\s*(['"`])(?<selector>[^'"`]*)\1/g;for(const match of text.matchAll(CALL)){const selectorOffset=match.index+match[0].lastIndexOf(match.groups.selector);for(const inner of match.groups.selector.matchAll(TAG)){const tag=inner.groups.tag;push(selectorOffset+inner.index,tag,"selector-string","SELECTOR_STRING_REVIEW",tag,`\`${tag}\` appears in a DOM selector string that was NOT rewritten. The query will return null after the migration rather than throwing. Rename it by hand.`)}}const declaredHere=new Set([...text.matchAll(/(--(?:wa|sl)-[a-z0-9-]+)\s*:/g)].map(match=>match[1]));for(const match of text.matchAll(/--(?<ecosystem>wa|sl)-[a-z0-9-]+/g)){const token=match[0];declaredHere.has(token)||push(match.index,`${match.groups.ecosystem}-tokens`,"custom-property","UPSTREAM_TOKEN_REVIEW",token,`\`${token}\` is an upstream design token with no automatic Lyra equivalent, and was left as-is. A var() naming a token that no longer exists falls back to its second argument, or to nothing -- silently. Map it by hand against llms/tokens.md; note the spacing scales are offset by one step, so renaming by name alone tightens every gap.`)}return found}function migrateText(original,contract,options={}){if(options.origin&&contract.renameProfiles?.has(options.origin))return migrateRenameText(original,contract,options);if(options.origin)return migrateLocalText(original,contract,options);const file=options.file??"<memory>",rewriteBarePackages=options.rewriteBarePackages??new Set,rootRegistrationMappings=options.rootRegistrationMappings??new Map,starts=lineStarts(original),ignoredRanges=commentRanges(original),htmlStyleRanges=htmlTemplateStyleRanges(original),markupTokens=scanMarkupTags(original,ignoredRanges),allOpeningTokens=scanAllOpeningTags(original,ignoredRanges),apiReferences=scanApiTagReferences(original,ignoredRanges,options.domFactoryBindings),aliasReviews=scanAliasedRewriteReviews(original,contract,ignoredRanges),dynamicDefaultReviews=scanDynamicDefaultReviews(original,markupTokens,contract),conditionalBehaviorReviews=scanConditionalBehaviorReviews(original,markupTokens,ignoredRanges,contract),imports=scanImports(original,ignoredRanges,contract),bareImportPackages=new Set(imports.filter(imported=>imported.sideEffect&&!imported.subpath).map(imported=>imported.packageName)),blockedMappings=new Set([...options.blockedMappings??[],...aliasReviews.keys(),...dynamicDefaultReviews.keys()]),imperativeDefaultReviews=apiReferences.flatMap(reference=>{if(reference.kind!=="construction")return[];const mapping=contract.mappings.get(reference.tag),defaults=mapping?.rewrites.defaults.filter(rule=>rule.action==="insert-if-absent")??[];if(!mapping||!AUTO_CLASSIFICATIONS.has(mapping.classification)||defaults.length===0)return[];const assessment=assessImperativeDefaults(original,reference,defaults);return assessment.safe?[]:(blockedMappings.add(mapping.upstreamTag),[{reference,mapping,defaults,missing:assessment.missing}])}),registrationBlockedMappings=new Set(options.registrationBlockedMappings??[]),blockedEcosystems=new Set(options.blockedEcosystems??[]);for(const imported of imports){if(imported.sideEffect)continue;const upstreamTag=imported.subpath?deepImportTag(imported.specifier,imported.ecosystem):null,mapping=upstreamTag?contract.mappings.get(upstreamTag):null;mapping&&AUTO_CLASSIFICATIONS.has(mapping.classification)?blockedMappings.add(mapping.upstreamTag):imported.subpath||blockedEcosystems.add(imported.ecosystem)}const edits=[],changes=[],warnings=[],usage={webawesome:{automatic:0,manual:0},shoelace:{automatic:0,manual:0}},automaticMappings=new Set,deepRegistrationMappings=new Set,reportedOptionalPeers=new Set,reportOrigin=(upstreamTag,origin)=>origin??(upstreamTag?.startsWith("wa-")?"webawesome":upstreamTag?.startsWith("sl-")?"shoelace":null),change=(offset,upstreamTag,upstreamMember,action,target,message,origin=null)=>{changes.push(reportEntry({textStarts:starts,file,offset,origin:reportOrigin(upstreamTag,origin),upstreamTag,upstreamMember,action,target,message}))},warn=(offset,upstreamTag,upstreamMember,code,target,message,origin=null,behaviorReviewFlags=null)=>{warnings.push(reportEntry({textStarts:starts,file,offset,origin:reportOrigin(upstreamTag,origin),upstreamTag,upstreamMember,action:"manual-review",target,warningCode:code,behaviorReviewFlags,message}))},noteRuntimeRequirements=(mapping,offset)=>{for(const peer of mapping.target?.optionalPeers??[]){const key=`${mapping.targetTag}:${peer}`;reportedOptionalPeers.has(key)||(reportedOptionalPeers.add(key),warn(offset,mapping.upstreamTag,"runtime","OPTIONAL_PEER_REQUIRED",peer,`${mapping.targetTag} requires the optional peer package ${peer}; install a compatible version before relying on the migrated component.`))}},noteAutomatic=(mapping,offset)=>{automaticMappings.add(mapping.upstreamTag),noteRuntimeRequirements(mapping,offset)},addEdit=(start,end,replacement,details)=>{edits.push({start,end,replacement}),change(start,details.upstreamTag,details.upstreamMember,details.action,details.target,details.message,details.origin)},isBlocked=mapping=>!!mapping&&(blockedMappings.has(mapping.upstreamTag)||registrationBlockedMappings.has(mapping.upstreamTag)||blockedEcosystems.has(mapping.upstream)),isBlockedAutomatic=mapping=>AUTO_CLASSIFICATIONS.has(mapping?.classification)&&isBlocked(mapping),isAutomatic=mapping=>AUTO_CLASSIFICATIONS.has(mapping?.classification)&&!isBlocked(mapping),blockedMessage=mapping=>registrationBlockedMappings.has(mapping.upstreamTag)?`${mapping.upstreamTag} remains unchanged because the scanned target set does not prove registration for ${mapping.targetTag}. Include ${targetImport(mapping.target)} in the scan or migrate the file that owns its supported root registration import.`:`${mapping.upstreamTag} remains unchanged because the scanned target set contains a use that requires manual member, default, or import review.`,blockedWarningCode=mapping=>registrationBlockedMappings.has(mapping.upstreamTag)?"REGISTRATION_CLOSURE_REQUIRED":"MAPPING_REVIEW_BLOCKED";for(const{mapping,uses}of aliasReviews.values())for(const use of uses)warn(use.offset,mapping.upstreamTag,use.upstreamMember,"ALIASED_MEMBER_REVIEW",use.target,use.message);for(const{mapping,uses}of dynamicDefaultReviews.values())for(const use of uses)warn(use.offset,mapping.upstreamTag,use.upstreamMember,"DYNAMIC_VALUE_REVIEW",use.target,use.message);for(const{reference,mapping,defaults,missing}of imperativeDefaultReviews)warn(reference.start,mapping.upstreamTag,null,"IMPERATIVE_DEFAULT_REVIEW",mapping.targetTag,`${mapping.upstreamTag} is constructed imperatively and requires explicit migrated defaults (${defaults.map(rule=>`${rule.member}=${String(rule.value)}`).join(", ")}); review the created element before renaming this mapping. No unconditional immediate assignment was proven for ${missing.map(rule=>rule.member).join(", ")}.`);const openingTokens=[],manualOpeningTags=new Set;for(const token of markupTokens){const mapping=contract.mappings.get(token.tag),ecosystem=ecosystemForTag(token.tag);if(!isAutomatic(mapping)){if(mapping&&noteRuntimeRequirements(mapping,token.nameStart),token.closing&&manualOpeningTags.has(token.tag))continue;token.closing||manualOpeningTags.add(token.tag),usage[ecosystem].manual+=1,warn(token.nameStart,token.tag,null,isBlockedAutomatic(mapping)?blockedWarningCode(mapping):warningCode(mapping),mapping?.targetTag??null,isBlockedAutomatic(mapping)?blockedMessage(mapping):mappingMessage(mapping),null,mapping?.parity?.behaviorReviewFlags);continue}usage[ecosystem].automatic+=1,noteAutomatic(mapping,token.nameStart),addEdit(token.nameStart,token.nameEnd,mapping.targetTag,{upstreamTag:token.tag,upstreamMember:null,action:"rewrite-tag",target:mapping.targetTag,message:`Rename ${token.tag} to ${mapping.targetTag}.`});const behaviorReview=conditionalBehaviorReviews.get(token.start);behaviorReview&&warn(token.nameStart,mapping.upstreamTag,null,"BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,behaviorReview.message,null,behaviorReview.flags),!token.closing&&REDUCED_MOTION_REVIEW_TAGS.has(token.tag)&&warn(token.nameStart,mapping.upstreamTag,null,"BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,reducedMotionReviewMessage(mapping.upstreamTag),null,["reduced-motion-default"]),!token.closing&&ICON_VOCABULARY_REVIEW_TAGS.has(token.tag)&&warn(token.nameStart,mapping.upstreamTag,null,"BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,iconVocabularyReviewMessage(mapping.upstreamTag),null,["icon-name-vocabulary"]),token.closing||openingTokens.push({token,mapping,attributes:parseTagAttributes(original,token)})}for(const reference of apiReferences){const mapping=contract.mappings.get(reference.tag),ecosystem=ecosystemForTag(reference.tag);if(!isAutomatic(mapping)){mapping&&noteRuntimeRequirements(mapping,reference.start),usage[ecosystem].manual+=1,warn(reference.start,reference.tag,null,isBlockedAutomatic(mapping)?blockedWarningCode(mapping):warningCode(mapping),mapping?.targetTag??null,isBlockedAutomatic(mapping)?blockedMessage(mapping):mappingMessage(mapping),null,mapping?.parity?.behaviorReviewFlags);continue}usage[ecosystem].automatic+=1,noteAutomatic(mapping,reference.start),addEdit(reference.start,reference.end,mapping.targetTag,{upstreamTag:reference.tag,upstreamMember:null,action:"rewrite-tag",target:mapping.targetTag,message:`Rename ${reference.tag} to ${mapping.targetTag}.`}),REDUCED_MOTION_REVIEW_TAGS.has(reference.tag)&&warn(reference.start,mapping.upstreamTag,null,"BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,reducedMotionReviewMessage(mapping.upstreamTag),null,["reduced-motion-default"]),ICON_VOCABULARY_REVIEW_TAGS.has(reference.tag)&&warn(reference.start,mapping.upstreamTag,null,"BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,iconVocabularyReviewMessage(mapping.upstreamTag),null,["icon-name-vocabulary"])}for(const{token,mapping,attributes}of openingTokens){for(const attribute of attributes){const rule=namedRule(attribute.rawName,mapping);if(rule){if(rule.value!==void 0){rule.prefix===""&&attribute.valueKind==="boolean"&&!attributes.some(candidate=>candidate!==attribute&&[rule.to,`.${rule.to}`,`:${rule.to}`,`v-bind:${rule.to}`].includes(candidate.rawName))?addEdit(attribute.nameStart,attribute.nameEnd,`${rule.to}="${rule.value}"`,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:memberAction(rule.section),target:`${rule.to}="${rule.value}"`,message:`Rewrite ${rule.section} member ${rule.from} to ${rule.to}="${rule.value}".`}):(usage[mapping.upstream].manual+=1,warn(attribute.nameStart,mapping.upstreamTag,rule.from,"DYNAMIC_VALUE_REVIEW",rule.to,`${rule.from} is a boolean spelling of ${rule.to}="${rule.value}"; set ${rule.to} to "${rule.value}" when it is true and leave it unset otherwise.`));continue}addEdit(attribute.nameStart,attribute.nameEnd,rule.replacement,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:memberAction(rule.section),target:rule.to,message:`Rewrite ${rule.section} member ${rule.from} to ${rule.to}.`})}}const insertions=[];for(const rule of mapping.rewrites.defaults){const variants=new Set([rule.member,kebabCase(rule.member),camelCase(rule.member)]),attribute=attributes.find(entry=>variants.has(entry.rawName.replace(/^[.?:]/,"")));if(rule.action==="insert-if-absent"){if(attribute)continue;insertions.push(`${kebabCase(rule.member)}="${String(rule.value).replaceAll("&","&amp;").replaceAll('"',"&quot;")}"`),change(token.end,mapping.upstreamTag,rule.member,"insert-default",`${rule.member}=${String(rule.value)}`,`Insert ${rule.member} to preserve the upstream default.`);continue}!attribute||attribute.valueKind==="boolean"||(isDynamicAttribute(attribute)?(usage[mapping.upstream].manual+=1,warn(attribute.valueStart,mapping.upstreamTag,rule.member,"DYNAMIC_VALUE_REVIEW",String(rule.to),`The ${rule.member} value is dynamic; replace ${String(rule.from)} with ${String(rule.to)} at its source.`)):attribute.value===String(rule.from)&&addEdit(attribute.valueStart,attribute.valueEnd,String(rule.to),{upstreamTag:mapping.upstreamTag,upstreamMember:rule.member,action:"replace-default",target:String(rule.to),message:`Replace ${rule.member} value ${String(rule.from)} with ${String(rule.to)}.`}))}if(insertions.length){const insertionOffset=original[token.end-1]==="/"?token.end-1:token.end;edits.push({start:insertionOffset,end:insertionOffset,replacement:` ${insertions.join(" ")}`})}}const stack=[],pairs=[];for(const token of markupTokens)if(!token.closing&&!token.selfClosing)stack.push(token);else if(token.closing)for(let index=stack.length-1;index>=0;index-=1){if(stack[index].tag!==token.tag)continue;const[opening]=stack.splice(index,1);pairs.push({opening,closing:token});break}for(const{opening,closing}of pairs){const mapping=contract.mappings.get(opening.tag);if(!(!isAutomatic(mapping)||!mapping.rewrites.slots.length)){for(const descendant of allOpeningTokens)if(!(descendant.start<=opening.end||descendant.end>=closing.start))for(const attribute of parseTagAttributes(original,descendant))if(attribute.rawName==="slot"&&attribute.valueKind==="literal"){const rule=mapping.rewrites.slots.find(entry=>entry.from===attribute.value);rule&&addEdit(attribute.valueStart,attribute.valueEnd,rule.to,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:"rewrite-slot",target:rule.to,message:`Rewrite slot ${rule.from} to ${rule.to}.`})}else{const prefix=attribute.rawName.startsWith("v-slot:")?"v-slot:":attribute.rawName.startsWith("#")?"#":null;if(!prefix)continue;const name=attribute.rawName.slice(prefix.length),rule=mapping.rewrites.slots.find(entry=>entry.from===name);rule&&addEdit(attribute.nameStart,attribute.nameEnd,`${prefix}${rule.to}`,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:"rewrite-slot",target:rule.to,message:`Rewrite slot ${rule.from} to ${rule.to}.`})}}}const cssRule=/(?<selector>[^{}]+)\{(?<body>[^{}]*)\}/g;for(const match of original.matchAll(cssRule)){if(insideRanges(match.index,ignoredRanges))continue;const selectorStart=match.index,bodyStart=match.index+match[0].indexOf(match.groups.body);for(const mapping of contract.mappings.values()){const tagPattern=new RegExp(`(?<![a-z0-9-])${mapping.upstreamTag}(?![a-z0-9-])`,"g"),selectorMatches=[...match.groups.selector.matchAll(tagPattern)].filter(tagMatch=>{const offset=selectorStart+tagMatch.index;if(insideRanges(offset,ignoredRanges))return!1;const quoted=quotedRangeContaining(original,offset);return quoted?insideRanges(offset,htmlStyleRanges)&&!insideTemplateExpression(original,quoted[0],offset):!0});if(selectorMatches.length){if(!isAutomatic(mapping)){usage[mapping.upstream].manual+=selectorMatches.length;for(const tagMatch of selectorMatches){const offset=selectorStart+tagMatch.index;noteRuntimeRequirements(mapping,offset),warn(offset,mapping.upstreamTag,null,isBlockedAutomatic(mapping)?blockedWarningCode(mapping):warningCode(mapping),mapping.targetTag,isBlockedAutomatic(mapping)?blockedMessage(mapping):mappingMessage(mapping),null,mapping?.parity?.behaviorReviewFlags)}continue}for(const tagMatch of selectorMatches){const offset=selectorStart+tagMatch.index;if(noteAutomatic(mapping,offset),mapping.upstreamTag==="wa-random-content"){const flags=["host-layout","multi-item-layout"];warn(offset,mapping.upstreamTag,"selector","BEHAVIOR_REVIEW_REQUIRED",mapping.targetTag,"Review this selector after migration: Web Awesome lays candidates out through the host, while Lyra uses a block host and owns simultaneous-item flex layout inside its shadow base.",null,flags)}addEdit(offset,offset+mapping.upstreamTag.length,mapping.targetTag,{upstreamTag:mapping.upstreamTag,upstreamMember:null,action:"rewrite-tag",target:mapping.targetTag,message:`Rename ${mapping.upstreamTag} selector to ${mapping.targetTag}.`})}for(const rule of mapping.rewrites.parts){const pattern=new RegExp(`(?<=::part\\()${rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?=\\))`,"g");for(const partMatch of match.groups.selector.matchAll(pattern)){const offset=selectorStart+partMatch.index;insideRanges(offset,ignoredRanges)||addEdit(offset,offset+rule.from.length,rule.to,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:"rewrite-part",target:rule.to,message:`Rewrite CSS part ${rule.from} to ${rule.to}.`})}}for(const rule of mapping.rewrites.cssProperties){const pattern=new RegExp(`${rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![a-z0-9-])`,"g");for(const propertyMatch of match.groups.body.matchAll(pattern)){const offset=bodyStart+propertyMatch.index;insideRanges(offset,ignoredRanges)||addEdit(offset,offset+rule.from.length,rule.to,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:"rewrite-css-property",target:rule.to,message:`Rewrite CSS custom property ${rule.from} to ${rule.to}.`})}}}}}for(const mapping of contract.mappings.values()){if(!isAutomatic(mapping))continue;const owner=`(?:document\\.)?querySelector(?:<[^>\\n]+>)?\\(\\s*(['"])${mapping.upstreamTag.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\1\\s*\\)`;for(const[section,suffix]of[["methods","(?=\\s*\\()"],["properties","(?=\\s*(?:=|\\.|\\?|;|$))"]])for(const rule of mapping.rewrites[section]){const escaped=rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),regex=new RegExp(`${owner}\\s*(?:\\?\\.|!\\s*\\.|\\.)\\s*(?<member>${escaped})${suffix}`,"g");for(const memberMatch of original.matchAll(regex)){if(insideRanges(memberMatch.index,ignoredRanges))continue;const relative=memberMatch[0].lastIndexOf(memberMatch.groups.member),offset=memberMatch.index+relative;if(rule.value!==void 0){usage[mapping.upstream].manual+=1,warn(offset,mapping.upstreamTag,rule.from,"DYNAMIC_VALUE_REVIEW",rule.to,`${rule.from} is a boolean spelling of ${rule.to}="${rule.value}"; preserve explicit ${rule.to} values and review the boolean expression.`);continue}addEdit(offset,offset+rule.from.length,rule.to,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:memberAction(section),target:rule.to,message:`Rewrite ${section} member ${rule.from} to ${rule.to}.`})}}for(const rule of mapping.rewrites.attributes.filter(entry=>entry.value!==void 0)){const escaped=rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),regex=new RegExp(`${owner}\\s*(?:\\?\\.|!\\s*\\.|\\.)\\s*(?:get|set|has|toggle|remove)Attribute\\(\\s*(['"])(?<member>${escaped})\\2`,"g");for(const attributeMatch of original.matchAll(regex)){if(insideRanges(attributeMatch.index,ignoredRanges))continue;const offset=attributeMatch.index+attributeMatch[0].lastIndexOf(attributeMatch.groups.member);usage[mapping.upstream].manual+=1,warn(offset,mapping.upstreamTag,rule.from,"DYNAMIC_VALUE_REVIEW",rule.to,`${rule.from} is a boolean spelling of ${rule.to}="${rule.value}"; review this attribute operation before migrating it.`)}}for(const rule of mapping.rewrites.events){const escaped=rule.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),regex=new RegExp(`${owner}\\s*(?:\\?\\.|!\\s*\\.|\\.)\\s*(?:add|remove)EventListener\\(\\s*(['"])(?<member>${escaped})\\2`,"g");for(const eventMatch of original.matchAll(regex)){if(insideRanges(eventMatch.index,ignoredRanges))continue;const relative=eventMatch[0].lastIndexOf(eventMatch.groups.member),offset=eventMatch.index+relative;addEdit(offset,offset+rule.from.length,rule.to,{upstreamTag:mapping.upstreamTag,upstreamMember:rule.from,action:"rewrite-event",target:rule.to,message:`Rewrite event ${rule.from} to ${rule.to}.`})}}}for(const imported of imports){const{ecosystem}=imported;if(!imported.sideEffect){usage[ecosystem].manual+=1,warn(imported.start,imported.subpath?deepImportTag(imported.specifier,ecosystem):null,"module","IMPORT_BINDING_REVIEW_REQUIRED",null,`The ${imported.kind} import has runtime/type bindings whose exported names cannot be inferred safely.`,ecosystem);continue}if(!imported.subpath){const canRewrite=rewriteBarePackages.has(ecosystem)||rewriteBarePackages.has(imported.packageName),registeredMappings=rootRegistrationMappings.get(imported.packageName)??rootRegistrationMappings.get(ecosystem)??new Set,closure=registrationClosure(contract,registeredMappings);if(canRewrite&&closure.length>0){addEdit(imported.start,imported.end,closure[0],{upstreamTag:null,origin:ecosystem,upstreamMember:"module",action:"rewrite-import",target:closure[0],message:`Rewrite ${imported.packageName} root registration import to its proven Lyra registration closure.`});const lineEnding=original.includes(`\r
2
2
  `)?`\r
3
3
  `:`
4
4
  `;for(const specifier of closure.slice(1))edits.push({start:imported.statementEnd,end:imported.statementEnd,replacement:`${lineEnding}import ${imported.quote}${specifier}${imported.quote};`}),change(imported.start,null,"module","insert-registration",specifier,"Insert granular registration for a root-excluded Lyra target.",ecosystem)}else warn(imported.start,null,"module","PACKAGE_IMPORT_BLOCKED","@aceshooting/lyra-ui/all.js",`The ${ecosystem} package import remains because this scan contains manual uses or no proven registration closure.`,ecosystem);continue}const upstreamTag=deepImportTag(imported.specifier,ecosystem),mapping=upstreamTag?contract.mappings.get(upstreamTag):null;if(mapping&&!packageProvidesMapping(imported,mapping)){usage[ecosystem].manual+=1,noteRuntimeRequirements(mapping,imported.start),warn(imported.start,upstreamTag,"module","PACKAGE_TIER_MISMATCH",mapping.targetTag,`${imported.packageName} does not provide the ${mapping.source.tier} ${upstreamTag} registration entry; use a package identity that provides that tier before migrating it.`,ecosystem);continue}if(!upstreamTag||!isAutomatic(mapping)){usage[ecosystem].manual+=1,mapping&&noteRuntimeRequirements(mapping,imported.start),warn(imported.start,upstreamTag,"module",isBlockedAutomatic(mapping)?blockedWarningCode(mapping):mapping?warningCode(mapping):"UNRESOLVED_DEEP_IMPORT",mapping?.targetTag??null,isBlockedAutomatic(mapping)?blockedMessage(mapping):upstreamTag?mappingMessage(mapping):`No component registration entry can be derived from ${imported.specifier}.`,ecosystem,mapping?.parity?.behaviorReviewFlags);continue}usage[ecosystem].automatic+=1,noteAutomatic(mapping,imported.start),deepRegistrationMappings.add(mapping.upstreamTag);const target=targetImport(mapping.target);addEdit(imported.start,imported.end,target,{upstreamTag,upstreamMember:"module",action:"rewrite-import",target,message:`Rewrite the ${upstreamTag} registration entry to its checked Lyra package route.`})}const rewrittenRanges=edits.map(edit=>[edit.start,edit.end]),wasRewritten=offset=>rewrittenRanges.some(([start,end])=>offset>=start&&offset<end);for(const scan of scanUnrewrittenUpstreamReferences(original))wasRewritten(scan.offset)||warn(scan.offset,scan.upstreamTag,scan.member,scan.code,scan.target,scan.message);const content=finalizeEdits(original,edits);return changes.sort((left,right)=>left.line-right.line||left.column-right.column||left.action.localeCompare(right.action)),warnings.sort((left,right)=>left.line-right.line||left.column-right.column||left.warningCode.localeCompare(right.warningCode)),{content,changes,warnings,usage,blockedMappings,blockedEcosystems,bareImportPackages,automaticMappings,deepRegistrationMappings}}export{migrateText,scanUnrewrittenUpstreamReferences};
@@ -120,7 +120,7 @@ protected static readonly identityCollectionProperties:readonly string[];static
120
120
  /** Append-only: stable ids, new entries at the end. The newest 10,000 caller-owned entry
121
121
  * identities are retained; a localized limit notice discloses omitted history. Entries never change state once added.
122
122
  * Empty/blank ids are omitted and duplicates normalize first-wins before summary,
123
- * virtualization, and rendering. */
123
+ * virtualization, and rendering. Assign a new array to update: mutating an array and assigning it again does not. */
124
124
  entries:readonly ActivityEntry[];private _mode;get mode():ActivityFeedMode;set mode(next:ActivityFeedMode);
125
125
  /** Component-managed, host-assignable stick-to-bottom flag — released on user scroll-up,
126
126
  * re-engaged at the bottom. Only drives scrolling in `'live'` mode. */
@@ -1,4 +1,4 @@
1
- import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement,type LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type AgentStatusValue}from'../agent-status-presentation.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js';import type{AgentRunActivateDetail}from'../run-events.js';export type EvaluationMetricFormat='number'|'percent'|'milliseconds'|'currency';export interface AgentEvaluationMetric{readonly id:string;readonly label:string;readonly value:number;readonly format?:EvaluationMetricFormat;}export interface AgentEvaluationDashboardRun{readonly id:string;readonly label:string;readonly status:AgentStatusValue;readonly metrics?:Readonly<Record<string,number>>;}export interface LyraAgentEvalDashboardEventMap{'lr-metric-change-request':CustomEvent<{metricId:string;}>;'lr-metric-change':CustomEvent<{metricId:string;}>;'lr-run-activate':CustomEvent<LyraEventDetailSnapshot<AgentRunActivateDetail<AgentEvaluationDashboardRun>>>;}
1
+ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement,type LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type AgentStatusValue}from'../agent-status-presentation.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js';import type{AgentRunActivateDetail}from'../run-events.js';export type EvaluationMetricFormat='number'|'percent'|'milliseconds'|'currency';export interface AgentEvaluationMetric{readonly id:string;readonly label:string;readonly value:number;readonly format?:EvaluationMetricFormat;}export interface AgentEvaluationDashboardRun{readonly id:string;readonly label:string;readonly status:AgentStatusValue;readonly metrics?:Readonly<Record<string,number>>;}export interface LyraAgentEvalDashboardEventMap{'lr-metric-change-request':CustomEvent<{metricId:string;}>;'lr-run-activate':CustomEvent<LyraEventDetailSnapshot<AgentRunActivateDetail<AgentEvaluationDashboardRun>>>;}
2
2
  /**
3
3
  * `<lr-agent-eval-dashboard>` — a controlled evaluation overview with metric cards, a trend chart,
4
4
  * and run-status history. It never launches or scores evaluations. Duplicate metric or run ids
@@ -10,7 +10,6 @@ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement,type
10
10
  * @customElement lr-agent-eval-dashboard
11
11
  * @event lr-metric-change-request - A metric card was activated; the host decides whether to change `metricId`.
12
12
  * `detail: { metricId }`.
13
- * @event lr-metric-change - Deprecated alias of `lr-metric-change-request`, dispatched right after it.
14
13
  * @event lr-run-activate - A run row was activated. `detail: { runId, run }`.
15
14
  * @csspart base - The root dashboard wrapper.
16
15
  * @csspart heading - The visible heading.
@@ -6,7 +6,7 @@ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/co
6
6
  data-metric-id=${metric.id}
7
7
  aria-pressed=${active?.id===metric.id?"true":"false"}
8
8
  aria-label=${this.localize("chartValueLabel",void 0,{label:metric.label,value})}
9
- @click=${()=>{this.emit("lr-metric-change-request",{metricId:metric.id}),this.emit("lr-metric-change",{metricId:metric.id})}}
9
+ @click=${()=>this.emit("lr-metric-change-request",{metricId:metric.id})}
10
10
  ><lr-stat frame="plain" .label=${metric.label} .value=${value}></lr-stat></button>`})}</div>`:nothing}
11
11
  ${!this.withoutChart&&active&&runs.length?html`<div part="chart"><lr-lite-chart type="line" .height=${this.chartHeight} .labels=${this.chartInputs(runs,active).labels} .datasets=${this.chartInputs(runs,active).datasets} with-legend aria-label=${active.label}></lr-lite-chart></div>`:nothing}
12
12
  ${this.renderRuns(runs)}
@@ -1,10 +1,10 @@
1
1
  import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraFrame,LyraSize}from'../../../internal/variants.js';import type{AgentRun,CancelEventDetail,RetryEventDetail}from'../../../ai/types.js';import type{BadgeVariant}from'../../overlays/badge/badge.class.js';export interface AgentRunMetric{id:string;label:string;value:string|number;variant?:BadgeVariant;}
2
2
  /** Visual chrome for `<lr-agent-run>`'s root — the library's shared container-frame vocabulary. */
3
3
  export type AgentRunAppearance=LyraFrame;
4
- /** `detail` for `lr-run-cancel` and its deprecated alias `lr-cancel`. */
4
+ /** `detail` for `lr-run-cancel`. */
5
5
  export interface AgentRunCancelDetail extends CancelEventDetail{runId:string;}
6
6
  /** `detail` for `lr-run-retry`. */
7
- export interface AgentRunRetryDetail extends RetryEventDetail{runId:string;}export interface LyraAgentRunEventMap{'lr-run-cancel':CustomEvent<AgentRunCancelDetail>;'lr-cancel':CustomEvent<AgentRunCancelDetail>;'lr-run-retry':CustomEvent<AgentRunRetryDetail>;}
7
+ export interface AgentRunRetryDetail extends RetryEventDetail{runId:string;}export interface LyraAgentRunEventMap{'lr-run-cancel':CustomEvent<AgentRunCancelDetail>;'lr-run-retry':CustomEvent<AgentRunRetryDetail>;}
8
8
  /**
9
9
  * `<lr-agent-run>` — the top-level shell for one `AgentRun`: lifecycle-status badge, elapsed
10
10
  * time, current step, model/cost summary, and built-in Cancel/Retry controls in a header, plus
@@ -55,7 +55,7 @@ export interface AgentRunRetryDetail extends RetryEventDetail{runId:string;}expo
55
55
  *
56
56
  * Unless `without-cancel` is set, the built-in Cancel button renders while the run's status is one
57
57
  * of `TICKING_KINDS` (still genuinely in progress); unless `without-retry` is set, Retry renders
58
- * while the status is `error` or `cancelled`. Clicking either fires `lr-cancel`/`lr-run-retry` with
58
+ * while the status is `error` or `cancelled`. Clicking either fires `lr-run-cancel`/`lr-run-retry` with
59
59
  * `CancelEventDetail`/`RetryEventDetail` from `src/ai/types.ts` — this component never cancels or
60
60
  * retries anything itself, it only requests. `RetryEventDetail.attempt` is a 1-based counter
61
61
  * local to this component, incremented on every `lr-run-retry` click and reset to `0` whenever
@@ -84,7 +84,6 @@ export interface AgentRunRetryDetail extends RetryEventDetail{runId:string;}expo
84
84
  * @slot output - The run's final output content. No default content.
85
85
  * @slot actions - Extra header actions alongside the built-in Cancel/Retry buttons.
86
86
  * @event lr-run-cancel - The built-in Cancel button was activated. `detail: { runId }`.
87
- * @event lr-cancel - Deprecated alias of `lr-run-cancel`, dispatched right after it with the same detail.
88
87
  * @event lr-run-retry - The built-in Retry button was activated. `detail: { runId, attempt }`
89
88
  * (`attempt` is a 1-based counter reset per `run.id`).
90
89
  * @csspart base - The root container.
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{spinnerIcon}from"../../../internal/icons.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{formatShortDuration}from"../../../internal/duration.js";import{finiteRange}from"../../../internal/numbers.js";import{srOnly}from"../../../internal/a11y.js";import{AGENT_STATUS_VARIANTS}from"../../../internal/agent-status-variants.js";import{styles}from"./agent-run.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{firstByIdentity}from"../collection-identity.js";import{agentStatusKind,agentStatusMessage}from"../agent-status-presentation.js";import{agentStatusText}from"../../../internal/agent-status-text.js";import{LYRA_DEFAULT_agentRunCurrentStepLabel,LYRA_DEFAULT_agentRunStatusAnnounce,LYRA_DEFAULT_agentRunStatusCancelled,LYRA_DEFAULT_agentRunStatusCollecting,LYRA_DEFAULT_agentRunStatusDone,LYRA_DEFAULT_agentRunStatusIdle,LYRA_DEFAULT_agentRunStatusQueued,LYRA_DEFAULT_agentRunStatusWaitingApproval,LYRA_DEFAULT_agentRunStatusWaitingInput}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_cancel,LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_durationSeconds,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_retry,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusRunning}from"../../../internal/default-strings/shared.generated.js";const TICKING_KINDS=new Set(["running","collecting","waiting-input","waiting-approval"]),TERMINAL_KINDS=new Set(["done","error","cancelled"]),STEP_TO_TASK_STATUS={idle:"pending",running:"running",collecting:"running","waiting-input":"running","waiting-approval":"running",done:"success",error:"error",cancelled:"incomplete"};function toTaskItem(step){const kind=agentStatusKind(step.status);return{id:step.id,label:step.label,status:STEP_TO_TASK_STATUS[kind]??"pending",detail:agentStatusMessage(step.status)}}function runSteps(run){return Array.isArray(run?.steps)?run.steps:[]}class LyraAgentRun extends LyraElement{constructor(){super(...arguments),this.run=null,this.statusLabels={},this.statusVariants={},this.metrics=[],this.withoutCancel=!1,this.withoutRetry=!1,this.size="m",this.frame="card",this.retryAttempt=0,this.hasHeaderSlot=!1,this.hasSummarySlot=!1,this.onHeaderSlotChange=()=>{this.hasHeaderSlot=this.hasSlotted("header")},this.onSummarySlotChange=()=>{this.hasSummarySlot=this.hasSlotted("summary")},this.onCancelClick=()=>{const runId=this.run?.id??"";this.emit("lr-run-cancel",{runId}),this.emit("lr-cancel",{runId})},this.onRetryClick=()=>{this.retryAttempt+=1,this.emit("lr-run-retry",{runId:this.run?.id??"",attempt:this.retryAttempt})}}static{this.defaultStrings={...super.defaultStrings,agentRunCurrentStepLabel:LYRA_DEFAULT_agentRunCurrentStepLabel,agentRunStatusAnnounce:LYRA_DEFAULT_agentRunStatusAnnounce,agentRunStatusCancelled:LYRA_DEFAULT_agentRunStatusCancelled,agentRunStatusCollecting:LYRA_DEFAULT_agentRunStatusCollecting,agentRunStatusDone:LYRA_DEFAULT_agentRunStatusDone,agentRunStatusIdle:LYRA_DEFAULT_agentRunStatusIdle,agentRunStatusQueued:LYRA_DEFAULT_agentRunStatusQueued,agentRunStatusWaitingApproval:LYRA_DEFAULT_agentRunStatusWaitingApproval,agentRunStatusWaitingInput:LYRA_DEFAULT_agentRunStatusWaitingInput,cancel:LYRA_DEFAULT_cancel,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,durationSeconds:LYRA_DEFAULT_durationSeconds,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,retry:LYRA_DEFAULT_retry,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["run","statusLabels","statusVariants","metrics"])}static{this.styles=[LyraElement.styles,srOnly,styles,agentActionButtonStyles]}get normalizedMetrics(){return firstByIdentity(Array.isArray(this.metrics)?this.metrics:[],metric=>metric.id)}willUpdate(changed){super.willUpdate(changed),this.seedFirstRenderState(()=>{this.hasHeaderSlot=this.hasSlotted("header"),this.hasSummarySlot=this.hasSlotted("summary")}),changed.has("run")&&this.run?.id!==this.previousRunId&&(this.retryAttempt=0)}hasSlotted(name){return Array.from(this.children).some(element=>element.getAttribute("slot")===name)}updated(changed){super.updated(changed),changed.has("run")&&this.handleRunChange()}handleRunChange(){const runId=this.run?.id,kind=this.runKind;!(runId!==this.previousRunId)&&kind!==void 0&&kind!==this.previousStatusKind&&this.isAttentionKind(kind)&&this.announceStatus(kind),this.previousRunId=runId,this.previousStatusKind=kind}isAttentionKind(kind){return kind==="waiting-input"||kind==="waiting-approval"||TERMINAL_KINDS.has(kind)}announceStatus(kind){const region=this.liveRegion;region&&(region.mode=kind==="error"||kind==="waiting-input"||kind==="waiting-approval"?"assertive":"polite",region.announce(this.localize("agentRunStatusAnnounce",void 0,{status:this.statusLabel(kind)}),{force:!0}))}statusLabel(kind){return this.statusLabels[kind]||agentStatusText(this.localize.bind(this),kind)}get runKind(){return this.run?agentStatusKind(this.run.status):void 0}get currentStep(){const steps=runSteps(this.run);for(let i=steps.length-1;i>=0;i--)if(agentStatusKind(steps[i].status)==="running")return steps[i]}get isTicking(){const kind=this.runKind;return kind!==void 0&&TICKING_KINDS.has(kind)&&Number.isFinite(this.run?.startedAt)}get staticElapsedText(){const run=this.run;if(!run||!TERMINAL_KINDS.has(agentStatusKind(run.status)))return;const startedAt=run.startedAt,endedAt=run.endedAt;if(!(startedAt==null||endedAt==null||!Number.isFinite(startedAt)||!Number.isFinite(endedAt)))return formatShortDuration(this.localize.bind(this),this.effectiveLocale,endedAt-startedAt)}get costText(){const cost=this.run?.costEstimate;if(cost==null||!Number.isFinite(cost))return"";const value=finiteRange(cost,cost,0);return(this.formatCost??(c=>getNumberFormat(this.effectiveLocale,{maximumFractionDigits:4}).format(c)))(value)}get canCancel(){const kind=this.runKind;return!this.withoutCancel&&kind!==void 0&&TICKING_KINDS.has(kind)}get canRetry(){const kind=this.runKind;return!this.withoutRetry&&(kind==="error"||kind==="cancelled")}render(){const run=this.run;if(!run)return html`<div part="base"><lr-empty part="empty" heading=${this.localize("noData")}></lr-empty></div>`;const kind=agentStatusKind(run.status),message=agentStatusMessage(run.status),step=this.currentStep,ticking=this.isTicking,staticElapsed=this.staticElapsedText,cost=this.costText,metrics=this.normalizedMetrics,steps=runSteps(run),hasSummary=!!run.model||cost!==""||metrics.length>0;return html`
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{spinnerIcon}from"../../../internal/icons.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{formatShortDuration}from"../../../internal/duration.js";import{finiteRange}from"../../../internal/numbers.js";import{srOnly}from"../../../internal/a11y.js";import{AGENT_STATUS_VARIANTS}from"../../../internal/agent-status-variants.js";import{styles}from"./agent-run.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{firstByIdentity}from"../collection-identity.js";import{agentStatusKind,agentStatusMessage}from"../agent-status-presentation.js";import{agentStatusText}from"../../../internal/agent-status-text.js";import{LYRA_DEFAULT_agentRunCurrentStepLabel,LYRA_DEFAULT_agentRunStatusAnnounce,LYRA_DEFAULT_agentRunStatusCancelled,LYRA_DEFAULT_agentRunStatusCollecting,LYRA_DEFAULT_agentRunStatusDone,LYRA_DEFAULT_agentRunStatusIdle,LYRA_DEFAULT_agentRunStatusQueued,LYRA_DEFAULT_agentRunStatusWaitingApproval,LYRA_DEFAULT_agentRunStatusWaitingInput}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_cancel,LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_durationMilliseconds,LYRA_DEFAULT_durationSeconds,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_retry,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusRunning}from"../../../internal/default-strings/shared.generated.js";const TICKING_KINDS=new Set(["running","collecting","waiting-input","waiting-approval"]),TERMINAL_KINDS=new Set(["done","error","cancelled"]),STEP_TO_TASK_STATUS={idle:"pending",running:"running",collecting:"running","waiting-input":"running","waiting-approval":"running",done:"success",error:"error",cancelled:"incomplete"};function toTaskItem(step){const kind=agentStatusKind(step.status);return{id:step.id,label:step.label,status:STEP_TO_TASK_STATUS[kind]??"pending",detail:agentStatusMessage(step.status)}}function runSteps(run){return Array.isArray(run?.steps)?run.steps:[]}class LyraAgentRun extends LyraElement{constructor(){super(...arguments),this.run=null,this.statusLabels={},this.statusVariants={},this.metrics=[],this.withoutCancel=!1,this.withoutRetry=!1,this.size="m",this.frame="card",this.retryAttempt=0,this.hasHeaderSlot=!1,this.hasSummarySlot=!1,this.onHeaderSlotChange=()=>{this.hasHeaderSlot=this.hasSlotted("header")},this.onSummarySlotChange=()=>{this.hasSummarySlot=this.hasSlotted("summary")},this.onCancelClick=()=>{const runId=this.run?.id??"";this.emit("lr-run-cancel",{runId})},this.onRetryClick=()=>{this.retryAttempt+=1,this.emit("lr-run-retry",{runId:this.run?.id??"",attempt:this.retryAttempt})}}static{this.defaultStrings={...super.defaultStrings,agentRunCurrentStepLabel:LYRA_DEFAULT_agentRunCurrentStepLabel,agentRunStatusAnnounce:LYRA_DEFAULT_agentRunStatusAnnounce,agentRunStatusCancelled:LYRA_DEFAULT_agentRunStatusCancelled,agentRunStatusCollecting:LYRA_DEFAULT_agentRunStatusCollecting,agentRunStatusDone:LYRA_DEFAULT_agentRunStatusDone,agentRunStatusIdle:LYRA_DEFAULT_agentRunStatusIdle,agentRunStatusQueued:LYRA_DEFAULT_agentRunStatusQueued,agentRunStatusWaitingApproval:LYRA_DEFAULT_agentRunStatusWaitingApproval,agentRunStatusWaitingInput:LYRA_DEFAULT_agentRunStatusWaitingInput,cancel:LYRA_DEFAULT_cancel,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,durationMilliseconds:LYRA_DEFAULT_durationMilliseconds,durationSeconds:LYRA_DEFAULT_durationSeconds,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,retry:LYRA_DEFAULT_retry,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["run","statusLabels","statusVariants","metrics"])}static{this.styles=[LyraElement.styles,srOnly,styles,agentActionButtonStyles]}get normalizedMetrics(){return firstByIdentity(Array.isArray(this.metrics)?this.metrics:[],metric=>metric.id)}willUpdate(changed){super.willUpdate(changed),this.seedFirstRenderState(()=>{this.hasHeaderSlot=this.hasSlotted("header"),this.hasSummarySlot=this.hasSlotted("summary")}),changed.has("run")&&this.run?.id!==this.previousRunId&&(this.retryAttempt=0)}hasSlotted(name){return Array.from(this.children).some(element=>element.getAttribute("slot")===name)}updated(changed){super.updated(changed),changed.has("run")&&this.handleRunChange()}handleRunChange(){const runId=this.run?.id,kind=this.runKind;!(runId!==this.previousRunId)&&kind!==void 0&&kind!==this.previousStatusKind&&this.isAttentionKind(kind)&&this.announceStatus(kind),this.previousRunId=runId,this.previousStatusKind=kind}isAttentionKind(kind){return kind==="waiting-input"||kind==="waiting-approval"||TERMINAL_KINDS.has(kind)}announceStatus(kind){const region=this.liveRegion;region&&(region.mode=kind==="error"||kind==="waiting-input"||kind==="waiting-approval"?"assertive":"polite",region.announce(this.localize("agentRunStatusAnnounce",void 0,{status:this.statusLabel(kind)}),{force:!0}))}statusLabel(kind){return this.statusLabels[kind]||agentStatusText(this.localize.bind(this),kind)}get runKind(){return this.run?agentStatusKind(this.run.status):void 0}get currentStep(){const steps=runSteps(this.run);for(let i=steps.length-1;i>=0;i--)if(agentStatusKind(steps[i].status)==="running")return steps[i]}get isTicking(){const kind=this.runKind;return kind!==void 0&&TICKING_KINDS.has(kind)&&Number.isFinite(this.run?.startedAt)}get staticElapsedText(){const run=this.run;if(!run||!TERMINAL_KINDS.has(agentStatusKind(run.status)))return;const startedAt=run.startedAt,endedAt=run.endedAt;if(!(startedAt==null||endedAt==null||!Number.isFinite(startedAt)||!Number.isFinite(endedAt)))return formatShortDuration(this.localize.bind(this),this.effectiveLocale,endedAt-startedAt)}get costText(){const cost=this.run?.costEstimate;if(cost==null||!Number.isFinite(cost))return"";const value=finiteRange(cost,cost,0);return(this.formatCost??(c=>getNumberFormat(this.effectiveLocale,{maximumFractionDigits:4}).format(c)))(value)}get canCancel(){const kind=this.runKind;return!this.withoutCancel&&kind!==void 0&&TICKING_KINDS.has(kind)}get canRetry(){const kind=this.runKind;return!this.withoutRetry&&(kind==="error"||kind==="cancelled")}render(){const run=this.run;if(!run)return html`<div part="base"><lr-empty part="empty" heading=${this.localize("noData")}></lr-empty></div>`;const kind=agentStatusKind(run.status),message=agentStatusMessage(run.status),step=this.currentStep,ticking=this.isTicking,staticElapsed=this.staticElapsedText,cost=this.costText,metrics=this.normalizedMetrics,steps=runSteps(run),hasSummary=!!run.model||cost!==""||metrics.length>0;return html`
2
2
  <div part="base">
3
3
  <div part="header">
4
4
  <slot name="header" @slotchange=${this.onHeaderSlotChange}></slot>
@@ -76,7 +76,7 @@ get treeSource():TraceTreeSource|undefined;set treeSource(value:TraceTreeSource|
76
76
  revealSourceKey(key:string):Promise<boolean>;private forwardKinds;private bindTree;requestUpdate(name?:PropertyKey,oldValue?:unknown):void;disconnectedCallback():void;
77
77
  /** The full, unfiltered span array -- identical contract to `<lr-trace-tree>.spans`. Controlled
78
78
  * and never mutated by this component; `activeSpanId` and its ancestor path reserve positions
79
- * inside the maxNodes projection (default 500) before kind filtering. */
79
+ * inside the maxNodes projection (default 500) before kind filtering. Assign a new array to update: mutating an array and assigning it again does not. */
80
80
  spans:readonly LyraSpan[];
81
81
  /** Maximum projected rows, from 1 to 5000. Invalid or unset values use 500.
82
82
  * Source admission keeps the first 10000 outer entries without cloning opaque metadata. */
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{ref}from"lit/directives/ref.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./agent-trace.styles.js";import{projectLyraSpans}from"../trace-tree/span-projection.js";import{LYRA_DEFAULT_agentTraceFilterLabel,LYRA_DEFAULT_spanKindAgent,LYRA_DEFAULT_spanKindEmbedding,LYRA_DEFAULT_spanKindLlm,LYRA_DEFAULT_spanKindOther,LYRA_DEFAULT_spanKindRetriever,LYRA_DEFAULT_spanKindTool,LYRA_DEFAULT_spanProjectionLimit}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_handoffFromToAgent,LYRA_DEFAULT_handoffToAgent,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_open,LYRA_DEFAULT_tokensIn,LYRA_DEFAULT_tokensOut}from"../../../internal/default-strings/shared.generated.js";const EMPTY_SPANS=Object.freeze([]),KIND_ORDER=["agent","llm","tool","retriever","embedding","other"],KIND_LABEL_KEY={agent:"spanKindAgent",llm:"spanKindLlm",tool:"spanKindTool",retriever:"spanKindRetriever",embedding:"spanKindEmbedding",other:"spanKindOther"};class LyraAgentTrace extends LyraElement{constructor(){super(...arguments),this._treeSource=void 0,this.sourceVersion=0,this.bindTree=element=>{const tree=element;if(this.sourceTree=tree,!tree)return;const version=this.sourceVersion,source=this.treeSource;this.forwardKinds(tree),!(this.sourceTree!==tree||this.sourceVersion!==version||this.treeSource!==source)&&tree.treeSource!==source&&(tree.treeSource=source)},this.spans=[],this.maxNodes=500,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.sourceNotice=!1,this.previousSourceNotice=!1,this.noticeInitialized=!1,this.activeSpanId=null,this.hiddenKinds=[],this.withTokens=!1,this.withCost=!1,this.withoutBars=!1,this.projectionLimit=0,this.projectionActiveSpanId=null,this.filteredCache=[],this.presentKindsCache=[],this.handoffsCache=[],this.legendLabels=[],this.legendTypes=[],this.onVisibilityChange=e=>{e.stopPropagation();const version=this.sourceVersion,source=this.treeSource;this.hiddenKinds=e.detail.hiddenTypes,!(!this.isConnected||this.sourceVersion!==version||this.treeSource!==source)&&this.emit("lr-span-visibility-change",{hiddenKinds:[...this.hiddenKinds]})},this.onVisibilityChangeProposal=event=>{event.stopPropagation()},this.onTreeSpanSelect=e=>{!this.isConnected||e.currentTarget!==this.sourceTree||this.sourceTree.treeSource!==this.treeSource||(this.activeSpanId=e.detail.spanId)}}static{this.defaultStrings={...super.defaultStrings,agentTraceFilterLabel:LYRA_DEFAULT_agentTraceFilterLabel,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,handoffFromToAgent:LYRA_DEFAULT_handoffFromToAgent,handoffToAgent:LYRA_DEFAULT_handoffToAgent,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,open:LYRA_DEFAULT_open,spanKindAgent:LYRA_DEFAULT_spanKindAgent,spanKindEmbedding:LYRA_DEFAULT_spanKindEmbedding,spanKindLlm:LYRA_DEFAULT_spanKindLlm,spanKindOther:LYRA_DEFAULT_spanKindOther,spanKindRetriever:LYRA_DEFAULT_spanKindRetriever,spanKindTool:LYRA_DEFAULT_spanKindTool,spanProjectionLimit:LYRA_DEFAULT_spanProjectionLimit,tokensIn:LYRA_DEFAULT_tokensIn,tokensOut:LYRA_DEFAULT_tokensOut}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["spans","hiddenKinds"])}static{this.identityCollectionProperties=Object.freeze(["spans"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-span-visibility-change"])}get treeSource(){return this._treeSource}set treeSource(value){const previous=this._treeSource;this._treeSource=value,this.sourceVersion++;const tree=this.sourceTree;tree&&(tree.treeSource=value),this.requestUpdate("treeSource",previous)}async revealSourceKey(key){const source=this.treeSource;if(source===void 0)return!1;const version=this.sourceVersion,owner=this.ownerDocument,current=()=>this.isConnected&&this.ownerDocument===owner&&this.treeSource===source&&this.sourceVersion===version;await this.updateComplete;const tree=this.sourceTree;if(!current()||!tree||tree.treeSource!==source)return!1;const revealed=await tree.revealSourceKey(key);return current()&&this.sourceTree===tree&&tree.treeSource===source&&revealed}forwardKinds(tree){(this.forwardedTree!==tree||this.forwardedKinds!==this.hiddenKinds)&&(this.forwardedTree=tree,this.forwardedKinds=this.hiddenKinds,tree.hiddenKinds=this.hiddenKinds)}requestUpdate(name,oldValue){name==="hiddenKinds"&&this.sourceTree&&this.forwardKinds(this.sourceTree),name===void 0&&this._treeSource!==void 0&&(this.sourceVersion++,this.sourceTree?.requestUpdate()),super.requestUpdate(name,oldValue)}disconnectedCallback(){this.sourceVersion++,super.disconnectedCallback()}get effectiveMaxNodes(){return Math.max(1,Math.min(5e3,finiteCount(this.maxNodes,500)))}connectedCallback(){super.connectedCallback(),this.noticeInitialized=this.hasUpdated,this.previousSourceNotice=this.sourceNotice}adoptedCallback(){super.adoptedCallback(),this.sourceVersion++,this.announcements.adopted()}limitMessage(){return this.localize("spanProjectionLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(this.effectiveMaxNodes)})}updated(changed){if(super.updated(changed),this.treeSource!==void 0)return;const version=this.sourceVersion,owner=this.ownerDocument,notice=this.sourceNotice,current=()=>this.isConnected&&this.ownerDocument===owner&&this.sourceVersion===version&&this.treeSource===void 0&&this.sourceNotice===notice;if(this.noticeInitialized&&notice&&!this.previousSourceNotice){const message=this.limitMessage();if(!current()||(this.announcements.announcePolite(message),!current()))return}this.noticeInitialized=!0,this.previousSourceNotice=notice}projectedSpans(){return(this.projectionSource!==this.spans||this.projectionActiveSpanId!==this.activeSpanId||this.projectionLimit!==this.effectiveMaxNodes)&&(this.projectionSource=this.spans,this.projectionActiveSpanId=this.activeSpanId,this.projectionLimit=this.effectiveMaxNodes,this.projectionCache=projectLyraSpans(this.spans,this.activeSpanId,this.effectiveMaxNodes)),this.projectionCache}presentKinds(spans){if(this.presentKindsSource!==spans){this.presentKindsSource=spans;const present=new Set(spans.map(span=>span.kind));this.presentKindsCache=KIND_ORDER.filter(kind=>present.has(kind))}return this.presentKindsCache}filteredSpans(spans){if(this.filteredSource!==spans||this.filteredKinds!==this.hiddenKinds){this.filteredSource=spans,this.filteredKinds=this.hiddenKinds;const hidden=new Set(this.hiddenKinds);this.filteredCache=hidden.size===0?[...spans]:spans.filter(span=>!hidden.has(span.kind))}return this.filteredCache}handoffSpans(spans){return this.handoffsSource!==spans&&(this.handoffsSource=spans,this.handoffsCache=spans.filter(span=>span.kind==="agent")),this.handoffsCache}handoffFromAgent(span,byId){if(!span.parentId)return"";const parent=byId.get(span.parentId);return parent?.kind==="agent"?parent.name:""}handoffAccessibleLabel(span,fromAgent){return fromAgent?this.localize("handoffFromToAgent",void 0,{from:fromAgent,to:span.name}):this.localize("handoffToAgent",void 0,{agent:span.name})}selectSpan(id){this.treeSource!==void 0||!this.isConnected||(this.activeSpanId=id,this.emit("lr-span-select",{spanId:id}))}renderFilter(spans){const version=this.sourceVersion,hiddenKinds=this.hiddenKinds,kinds=this.treeSource!==void 0?KIND_ORDER:this.presentKinds(spans);if(kinds.length===0)return nothing;const labels=kinds.map(kind=>this.localize(KIND_LABEL_KEY[kind])),label=this.localize("agentTraceFilterLabel");if(version!==this.sourceVersion||hiddenKinds!==this.hiddenKinds)return nothing;(this.legendKinds!==kinds||labels.some((label2,index)=>label2!==this.legendLabels[index]))&&(this.legendKinds=kinds,this.legendLabels=labels,this.legendTypes=kinds.map((kind,index)=>({id:kind,label:labels[index]})));const current=event=>this.isConnected&&this.sourceVersion===version&&this.hiddenKinds===hiddenKinds&&event.currentTarget?.getRootNode()===this.renderRoot;return html`
1
+ import{__decorate}from"tslib";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{ref}from"lit/directives/ref.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./agent-trace.styles.js";import{projectLyraSpans}from"../trace-tree/span-projection.js";import{LYRA_DEFAULT_agentTraceFilterLabel,LYRA_DEFAULT_spanKindAgent,LYRA_DEFAULT_spanKindEmbedding,LYRA_DEFAULT_spanKindLlm,LYRA_DEFAULT_spanKindOther,LYRA_DEFAULT_spanKindRetriever,LYRA_DEFAULT_spanKindTool,LYRA_DEFAULT_spanProjectionLimit}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_handoffFromToAgent,LYRA_DEFAULT_handoffToAgent,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_open,LYRA_DEFAULT_tokensIn,LYRA_DEFAULT_tokensOut}from"../../../internal/default-strings/shared.generated.js";const EMPTY_SPANS=Object.freeze([]),KIND_ORDER=["agent","llm","tool","retriever","embedding","other"],KIND_LABEL_KEY={agent:"spanKindAgent",llm:"spanKindLlm",tool:"spanKindTool",retriever:"spanKindRetriever",embedding:"spanKindEmbedding",other:"spanKindOther"};class LyraAgentTrace extends LyraElement{constructor(){super(...arguments),this._treeSource=void 0,this.sourceVersion=0,this.bindTree=element=>{const tree=element;if(this.sourceTree=tree,!tree)return;const version=this.sourceVersion,source=this.treeSource;this.forwardKinds(tree),!(this.sourceTree!==tree||this.sourceVersion!==version||this.treeSource!==source)&&tree.treeSource!==source&&(tree.treeSource=source)},this.spans=[],this.maxNodes=500,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.sourceNotice=!1,this.previousSourceNotice=!1,this.noticeInitialized=!1,this.activeSpanId=null,this.hiddenKinds=[],this.withTokens=!1,this.withCost=!1,this.withoutBars=!1,this.projectionLimit=0,this.projectionActiveSpanId=null,this.filteredCache=[],this.presentKindsCache=[],this.handoffsCache=[],this.legendLabels=[],this.legendTypes=[],this.onVisibilityChange=e=>{e.stopPropagation();const version=this.sourceVersion,source=this.treeSource;this.hiddenKinds=e.detail.hiddenTypes,!(!this.isConnected||this.sourceVersion!==version||this.treeSource!==source)&&this.emit("lr-span-visibility-change",{hiddenKinds:[...this.hiddenKinds]})},this.onVisibilityChangeProposal=event=>{event.stopPropagation()},this.onTreeSpanSelect=e=>{!this.isConnected||e.currentTarget!==this.sourceTree||this.sourceTree.treeSource!==this.treeSource||(this.activeSpanId=e.detail.spanId)}}static{this.defaultStrings={...super.defaultStrings,agentTraceFilterLabel:LYRA_DEFAULT_agentTraceFilterLabel,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,handoffFromToAgent:LYRA_DEFAULT_handoffFromToAgent,handoffToAgent:LYRA_DEFAULT_handoffToAgent,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,open:LYRA_DEFAULT_open,spanKindAgent:LYRA_DEFAULT_spanKindAgent,spanKindEmbedding:LYRA_DEFAULT_spanKindEmbedding,spanKindLlm:LYRA_DEFAULT_spanKindLlm,spanKindOther:LYRA_DEFAULT_spanKindOther,spanKindRetriever:LYRA_DEFAULT_spanKindRetriever,spanKindTool:LYRA_DEFAULT_spanKindTool,spanProjectionLimit:LYRA_DEFAULT_spanProjectionLimit,tokensIn:LYRA_DEFAULT_tokensIn,tokensOut:LYRA_DEFAULT_tokensOut}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["spans","hiddenKinds"])}static{this.identityCollectionProperties=Object.freeze(["spans"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-span-visibility-change"])}get treeSource(){return this._treeSource}set treeSource(value){const previous=this._treeSource;this._treeSource=value,this.sourceVersion++;const tree=this.sourceTree;tree&&(tree.treeSource=value),this.requestUpdate("treeSource",previous)}async revealSourceKey(key){const source=this.treeSource;if(source===void 0)return!1;const version=this.sourceVersion,owner=this.ownerDocument,current=()=>this.isConnected&&this.ownerDocument===owner&&this.treeSource===source&&this.sourceVersion===version;await this.updateComplete;const tree=this.sourceTree;if(!current()||!tree||tree.treeSource!==source)return!1;const revealed=await tree.revealSourceKey(key);return current()&&this.sourceTree===tree&&tree.treeSource===source&&revealed}forwardKinds(tree){(this.forwardedTree!==tree||this.forwardedKinds!==this.hiddenKinds)&&(this.forwardedTree=tree,this.forwardedKinds=this.hiddenKinds,tree.hiddenKinds=this.hiddenKinds)}requestUpdate(name,oldValue){name==="hiddenKinds"&&this.sourceTree&&this.forwardKinds(this.sourceTree),name===void 0&&this._treeSource!==void 0&&(this.sourceVersion++,this.sourceTree?.requestUpdate()),super.requestUpdate(name,oldValue)}disconnectedCallback(){this.sourceVersion++,super.disconnectedCallback()}get effectiveMaxNodes(){return Math.max(1,Math.min(5e3,finiteCount(this.maxNodes,500)))}connectedCallback(){super.connectedCallback(),this.noticeInitialized=this.hasUpdated,this.previousSourceNotice=this.sourceNotice}adoptedCallback(){super.adoptedCallback(),this.sourceVersion++,this.announcements.adopted()}limitMessage(){return this.localize("spanProjectionLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(this.effectiveMaxNodes)})}updated(changed){if(super.updated(changed),this.treeSource!==void 0)return;const version=this.sourceVersion,owner=this.ownerDocument,notice=this.sourceNotice,current=()=>this.isConnected&&this.ownerDocument===owner&&this.sourceVersion===version&&this.treeSource===void 0&&this.sourceNotice===notice;if(this.noticeInitialized&&notice&&!this.previousSourceNotice){const message=this.limitMessage();if(!current()||(this.announcements.announcePolite(message),!current()))return}this.noticeInitialized=!0,this.previousSourceNotice=notice}projectedSpans(){return(this.projectionSource!==this.spans||this.projectionActiveSpanId!==this.activeSpanId||this.projectionLimit!==this.effectiveMaxNodes)&&(this.projectionSource=this.spans,this.projectionActiveSpanId=this.activeSpanId,this.projectionLimit=this.effectiveMaxNodes,this.projectionCache=projectLyraSpans(this.spans,this.activeSpanId,this.effectiveMaxNodes)),this.projectionCache}presentKinds(spans){if(this.presentKindsSource!==spans){this.presentKindsSource=spans;const present=new Set(spans.map(span=>span.kind));this.presentKindsCache=KIND_ORDER.filter(kind=>present.has(kind))}return this.presentKindsCache}filteredSpans(spans){if(this.filteredSource!==spans||this.filteredKinds!==this.hiddenKinds){this.filteredSource=spans,this.filteredKinds=this.hiddenKinds;const hidden=new Set(this.hiddenKinds);this.filteredCache=hidden.size===0?[...spans]:spans.filter(span=>!hidden.has(span.kind))}return this.filteredCache}handoffSpans(spans){return this.handoffsSource!==spans&&(this.handoffsSource=spans,this.handoffsCache=spans.filter(span=>span.kind==="agent")),this.handoffsCache}handoffFromAgent(span,byId){if(!span.parentId)return"";const parent=byId.get(span.parentId);return parent?.kind==="agent"?parent.name:""}handoffAccessibleLabel(span,fromAgent){return fromAgent?this.localize("handoffFromToAgent",void 0,{from:fromAgent,to:span.name}):this.localize("handoffToAgent",void 0,{agent:span.name})}selectSpan(id){this.treeSource!==void 0||!this.isConnected||(this.activeSpanId=id,this.emit("lr-span-select",{spanId:id}))}renderFilter(spans){const version=this.sourceVersion,hiddenKinds=this.hiddenKinds,kinds=this.treeSource!==void 0?KIND_ORDER:this.presentKinds(spans);if(kinds.length===0)return nothing;const labels=kinds.map(kind=>this.localize(KIND_LABEL_KEY[kind])),label=this.localize("agentTraceFilterLabel");if(version!==this.sourceVersion||hiddenKinds!==this.hiddenKinds)return nothing;(this.legendKinds!==kinds||labels.some((label2,index)=>label2!==this.legendLabels[index]))&&(this.legendKinds=kinds,this.legendLabels=labels,this.legendTypes=kinds.map((kind,index)=>({id:kind,label:labels[index]})));const current=event=>this.isConnected&&this.sourceVersion===version&&this.hiddenKinds===hiddenKinds&&event.currentTarget?.getRootNode()===this.renderRoot;return html`
2
2
  <lr-graph-legend
3
3
  part="filter"
4
4
  .label=${label}
@@ -24,7 +24,7 @@ import{__decorate}from"tslib";import{finiteCount}from"../../../internal/numbers.
24
24
  <lr-trace-tree
25
25
  part="tree"
26
26
  .maxNodes=${this.effectiveMaxNodes}
27
- .spans=${sourceMode?EMPTY_SPANS:guard([this.spans],()=>this.spans)}
27
+ .spans=${sourceMode?EMPTY_SPANS:this.spans}
28
28
  .activeSpanId=${this.activeSpanId}
29
29
  .label=${this.label}
30
30
  .strings=${this.strings}
@@ -2,7 +2,7 @@ import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/l
2
2
  /** Host-owned state for one background run. Status is display-only and never inferred or mutated. */
3
3
  export interface BackgroundRun{id:string;label:string;description?:string;
4
4
  /** Shared terminal spellings are accepted alongside the component's original values. */
5
- status:BackgroundRunStatus|'done'|'success'|'complete'|'error';}export interface LyraBackgroundRunsEventMap{'lr-run-activate':CustomEvent<{runId:string;}>;'lr-run-open':CustomEvent<{runId:string;}>;'lr-run-cancel':CustomEvent<{runId:string;}>;}
5
+ status:BackgroundRunStatus|'done'|'success'|'complete'|'error';}export interface LyraBackgroundRunsEventMap{'lr-run-activate':CustomEvent<{runId:string;}>;'lr-run-cancel':CustomEvent<{runId:string;}>;}
6
6
  /**
7
7
  * `<lr-background-runs>` — a bounded, controlled list of background run states. Open and eligible
8
8
  * cancel buttons emit host requests only; statuses remain host-owned and this component never
@@ -12,7 +12,6 @@ status:BackgroundRunStatus|'done'|'success'|'complete'|'error';}export interface
12
12
  *
13
13
  * @customElement lr-background-runs
14
14
  * @event lr-run-activate - A run was requested for opening. `detail: { runId }`.
15
- * @event lr-run-open - Deprecated alias of `lr-run-activate`, dispatched right after it.
16
15
  * @event lr-run-cancel - A queued or running run was requested for cancellation. `detail: { runId }`.
17
16
  * Terminal or missing runs cannot emit this event.
18
17
  * @csspart base - The fieldset and group.
@@ -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{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./background-runs.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{firstByIdentity}from"../collection-identity.js";import{normalizeAgentTerminalStatus}from"../../../internal/shared-unions.js";import{LYRA_DEFAULT_agentRunStatusCancelled,LYRA_DEFAULT_agentRunStatusQueued,LYRA_DEFAULT_backgroundRunsCancelFor,LYRA_DEFAULT_backgroundRunsEmpty,LYRA_DEFAULT_backgroundRunsLabel,LYRA_DEFAULT_backgroundRunsLimit,LYRA_DEFAULT_backgroundRunsOpenFor,LYRA_DEFAULT_backgroundRunsStatusCompleted,LYRA_DEFAULT_backgroundRunsStatusFailed}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_cancel,LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusUnknown}from"../../../internal/default-strings/shared.generated.js";const MAX_RENDERED_RUNS=100,STATUSES=["queued","running","completed","failed","cancelled"],STATUS_LABEL_KEY={queued:"agentRunStatusQueued",running:"statusRunning",completed:"backgroundRunsStatusCompleted",failed:"backgroundRunsStatusFailed",cancelled:"agentRunStatusCancelled",unknown:"statusUnknown"},CANCELLABLE_STATUSES=new Set(["queued","running"]);class LyraBackgroundRuns extends LyraElement{constructor(){super(...arguments),this.runs=[],this.disabled=!1,this.dispatchingRequest=!1,this.normalizedCache=[]}static{this.defaultStrings={...super.defaultStrings,agentRunStatusCancelled:LYRA_DEFAULT_agentRunStatusCancelled,agentRunStatusQueued:LYRA_DEFAULT_agentRunStatusQueued,backgroundRunsCancelFor:LYRA_DEFAULT_backgroundRunsCancelFor,backgroundRunsEmpty:LYRA_DEFAULT_backgroundRunsEmpty,backgroundRunsLabel:LYRA_DEFAULT_backgroundRunsLabel,backgroundRunsLimit:LYRA_DEFAULT_backgroundRunsLimit,backgroundRunsOpenFor:LYRA_DEFAULT_backgroundRunsOpenFor,backgroundRunsStatusCompleted:LYRA_DEFAULT_backgroundRunsStatusCompleted,backgroundRunsStatusFailed:LYRA_DEFAULT_backgroundRunsStatusFailed,cancel:LYRA_DEFAULT_cancel,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusRunning:LYRA_DEFAULT_statusRunning,statusUnknown:LYRA_DEFAULT_statusUnknown}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["runs"])}static{this.styles=[LyraElement.styles,styles,agentActionButtonStyles]}get normalizedRuns(){if(this.normalizedFor!==this.runs){this.normalizedFor=this.runs;const valid=[];for(const run of Array.isArray(this.runs)?this.runs:[])try{const terminal=normalizeAgentTerminalStatus(run.status),status=terminal==="success"?"completed":terminal==="error"?"failed":terminal==="cancelled"?"cancelled":run.status;typeof run.label=="string"&&valid.push({...run,status:STATUSES.includes(status)?status:"unknown"})}catch{}this.normalizedCache=firstByIdentity(valid,run=>run.id)}return this.normalizedCache}requestOpen(runId){if(!(this.disabled||!this.normalizedRuns.some(run=>run.id===runId)||this.dispatchingRequest)){this.dispatchingRequest=!0;try{this.emit("lr-run-activate",{runId}),this.emit("lr-run-open",{runId})}finally{this.dispatchingRequest=!1}}}requestCancel(runId){if(this.disabled)return;const current=this.normalizedRuns.find(run=>run.id===runId);if(!(!current||!CANCELLABLE_STATUSES.has(current.status)||this.dispatchingRequest)){this.dispatchingRequest=!0;try{this.emit("lr-run-cancel",{runId})}finally{this.dispatchingRequest=!1}}}renderRun(run){const cancellable=CANCELLABLE_STATUSES.has(run.status);return html`
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./background-runs.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{firstByIdentity}from"../collection-identity.js";import{normalizeAgentTerminalStatus}from"../../../internal/shared-unions.js";import{LYRA_DEFAULT_agentRunStatusCancelled,LYRA_DEFAULT_agentRunStatusQueued,LYRA_DEFAULT_backgroundRunsCancelFor,LYRA_DEFAULT_backgroundRunsEmpty,LYRA_DEFAULT_backgroundRunsLabel,LYRA_DEFAULT_backgroundRunsLimit,LYRA_DEFAULT_backgroundRunsOpenFor,LYRA_DEFAULT_backgroundRunsStatusCompleted,LYRA_DEFAULT_backgroundRunsStatusFailed}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_cancel,LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusRunning,LYRA_DEFAULT_statusUnknown}from"../../../internal/default-strings/shared.generated.js";const MAX_RENDERED_RUNS=100,STATUSES=["queued","running","completed","failed","cancelled"],STATUS_LABEL_KEY={queued:"agentRunStatusQueued",running:"statusRunning",completed:"backgroundRunsStatusCompleted",failed:"backgroundRunsStatusFailed",cancelled:"agentRunStatusCancelled",unknown:"statusUnknown"},CANCELLABLE_STATUSES=new Set(["queued","running"]);class LyraBackgroundRuns extends LyraElement{constructor(){super(...arguments),this.runs=[],this.disabled=!1,this.dispatchingRequest=!1,this.normalizedCache=[]}static{this.defaultStrings={...super.defaultStrings,agentRunStatusCancelled:LYRA_DEFAULT_agentRunStatusCancelled,agentRunStatusQueued:LYRA_DEFAULT_agentRunStatusQueued,backgroundRunsCancelFor:LYRA_DEFAULT_backgroundRunsCancelFor,backgroundRunsEmpty:LYRA_DEFAULT_backgroundRunsEmpty,backgroundRunsLabel:LYRA_DEFAULT_backgroundRunsLabel,backgroundRunsLimit:LYRA_DEFAULT_backgroundRunsLimit,backgroundRunsOpenFor:LYRA_DEFAULT_backgroundRunsOpenFor,backgroundRunsStatusCompleted:LYRA_DEFAULT_backgroundRunsStatusCompleted,backgroundRunsStatusFailed:LYRA_DEFAULT_backgroundRunsStatusFailed,cancel:LYRA_DEFAULT_cancel,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusRunning:LYRA_DEFAULT_statusRunning,statusUnknown:LYRA_DEFAULT_statusUnknown}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["runs"])}static{this.styles=[LyraElement.styles,styles,agentActionButtonStyles]}get normalizedRuns(){if(this.normalizedFor!==this.runs){this.normalizedFor=this.runs;const valid=[];for(const run of Array.isArray(this.runs)?this.runs:[])try{const terminal=normalizeAgentTerminalStatus(run.status),status=terminal==="success"?"completed":terminal==="error"?"failed":terminal==="cancelled"?"cancelled":run.status;typeof run.label=="string"&&valid.push({...run,status:STATUSES.includes(status)?status:"unknown"})}catch{}this.normalizedCache=firstByIdentity(valid,run=>run.id)}return this.normalizedCache}requestOpen(runId){if(!(this.disabled||!this.normalizedRuns.some(run=>run.id===runId)||this.dispatchingRequest)){this.dispatchingRequest=!0;try{this.emit("lr-run-activate",{runId})}finally{this.dispatchingRequest=!1}}}requestCancel(runId){if(this.disabled)return;const current=this.normalizedRuns.find(run=>run.id===runId);if(!(!current||!CANCELLABLE_STATUSES.has(current.status)||this.dispatchingRequest)){this.dispatchingRequest=!0;try{this.emit("lr-run-cancel",{runId})}finally{this.dispatchingRequest=!1}}}renderRun(run){const cancellable=CANCELLABLE_STATUSES.has(run.status);return html`
2
2
  <div part="run" role="listitem" data-run-id=${run.id}>
3
3
  <div part="run-copy">
4
4
  <span part="label">${run.label}</span>
@@ -1,4 +1,4 @@
1
- import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js';export type ChangeReviewDecision='pending'|'keep'|'discard';export interface ChangeReviewHunk{id:string;label?:string;before:string;after:string;decision?:ChangeReviewDecision;}export interface ChangeReviewFile{id:string;path:string;previousPath?:string;hunks:readonly ChangeReviewHunk[];}export interface LyraChangeReviewEventMap{'lr-change-decision-request':CustomEvent<{fileId:string;hunkId:string;decision:Exclude<ChangeReviewDecision,'pending'>;}>;'lr-change-decision':CustomEvent<{fileId:string;hunkId:string;decision:Exclude<ChangeReviewDecision,'pending'>;}>;}
1
+ import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraHeadingLevel}from'../../../internal/heading-level.js';export type ChangeReviewDecision='pending'|'keep'|'discard';export interface ChangeReviewHunk{id:string;label?:string;before:string;after:string;decision?:ChangeReviewDecision;}export interface ChangeReviewFile{id:string;path:string;previousPath?:string;hunks:readonly ChangeReviewHunk[];}export interface LyraChangeReviewEventMap{'lr-change-decision-request':CustomEvent<{fileId:string;hunkId:string;decision:Exclude<ChangeReviewDecision,'pending'>;}>;}
2
2
  /**
3
3
  * Multi-file change review with host-owned per-hunk keep/discard decisions. Inputs contain
4
4
  * already-separated hunks; this component does not parse patches or write files. Decisions are
@@ -10,7 +10,6 @@ import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/l
10
10
  *
11
11
  * @customElement lr-change-review
12
12
  * @event lr-change-decision-request - A keep/discard request. `detail: { fileId, hunkId, decision }`.
13
- * @event lr-change-decision - Deprecated alias of `lr-change-decision-request`, dispatched right after it.
14
13
  * @csspart base - The named review group.
15
14
  * @csspart heading - The review heading.
16
15
  * @csspart file - A file disclosure.
@@ -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{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{firstByIdentity}from"../collection-identity.js";import{styles}from"./change-review.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{LYRA_DEFAULT_changeReviewDiscard,LYRA_DEFAULT_changeReviewDiscarded,LYRA_DEFAULT_changeReviewEmpty,LYRA_DEFAULT_changeReviewHunk,LYRA_DEFAULT_changeReviewKeep,LYRA_DEFAULT_changeReviewKept,LYRA_DEFAULT_changeReviewLabel,LYRA_DEFAULT_changeReviewLimit,LYRA_DEFAULT_changeReviewPending}from"../../../internal/default-strings/agent-tools.generated.js";const MAX_CHANGES=200;class LyraChangeReview extends LyraElement{constructor(){super(...arguments),this.files=[],this.disabled=!1,this.headingLevel="2",this.readonly=!1,this.decisionDispatching=!1}static{this.defaultStrings={...super.defaultStrings,changeReviewDiscard:LYRA_DEFAULT_changeReviewDiscard,changeReviewDiscarded:LYRA_DEFAULT_changeReviewDiscarded,changeReviewEmpty:LYRA_DEFAULT_changeReviewEmpty,changeReviewHunk:LYRA_DEFAULT_changeReviewHunk,changeReviewKeep:LYRA_DEFAULT_changeReviewKeep,changeReviewKept:LYRA_DEFAULT_changeReviewKept,changeReviewLabel:LYRA_DEFAULT_changeReviewLabel,changeReviewLimit:LYRA_DEFAULT_changeReviewLimit,changeReviewPending:LYRA_DEFAULT_changeReviewPending}}static{this.collectionSupport=collectionSupport}static{this.styles=[LyraElement.styles,styles,agentActionButtonStyles]}static{this.ownedCollectionProperties=Object.freeze(["files"])}get normalizedFiles(){return firstByIdentity(Array.isArray(this.files)?this.files:[],file=>file.id)}hunks(file){return firstByIdentity(Array.isArray(file.hunks)?file.hunks:[],hunk=>hunk.id)}decision(hunk){return hunk.decision==="keep"||hunk.decision==="discard"?hunk.decision:"pending"}decide(renderedFile,renderedHunk,decision){if(this.decisionDispatching||this.disabled||this.readonly)return;const file=this.normalizedFiles.find(candidate=>candidate.id===renderedFile.id),hunk=file&&this.hunks(file).find(candidate=>candidate.id===renderedHunk.id);if(!(file!==renderedFile||hunk!==renderedHunk||this.decision(hunk)===decision)){this.decisionDispatching=!0;try{this.emit("lr-change-decision-request",{fileId:file.id,hunkId:hunk.id,decision}),this.emit("lr-change-decision",{fileId:file.id,hunkId:hunk.id,decision})}finally{this.decisionDispatching=!1}}}renderHunk(file,hunk,index){const decision=this.decision(hunk),label=hunk.label??this.localize("changeReviewHunk",void 0,{index:getNumberFormat(this.effectiveLocale).format(index+1)});return html`<section part="hunk" aria-label=${label}>
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{firstByIdentity}from"../collection-identity.js";import{styles}from"./change-review.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{LYRA_DEFAULT_changeReviewDiscard,LYRA_DEFAULT_changeReviewDiscarded,LYRA_DEFAULT_changeReviewEmpty,LYRA_DEFAULT_changeReviewHunk,LYRA_DEFAULT_changeReviewKeep,LYRA_DEFAULT_changeReviewKept,LYRA_DEFAULT_changeReviewLabel,LYRA_DEFAULT_changeReviewLimit,LYRA_DEFAULT_changeReviewPending}from"../../../internal/default-strings/agent-tools.generated.js";const MAX_CHANGES=200;class LyraChangeReview extends LyraElement{constructor(){super(...arguments),this.files=[],this.disabled=!1,this.headingLevel="2",this.readonly=!1,this.decisionDispatching=!1}static{this.defaultStrings={...super.defaultStrings,changeReviewDiscard:LYRA_DEFAULT_changeReviewDiscard,changeReviewDiscarded:LYRA_DEFAULT_changeReviewDiscarded,changeReviewEmpty:LYRA_DEFAULT_changeReviewEmpty,changeReviewHunk:LYRA_DEFAULT_changeReviewHunk,changeReviewKeep:LYRA_DEFAULT_changeReviewKeep,changeReviewKept:LYRA_DEFAULT_changeReviewKept,changeReviewLabel:LYRA_DEFAULT_changeReviewLabel,changeReviewLimit:LYRA_DEFAULT_changeReviewLimit,changeReviewPending:LYRA_DEFAULT_changeReviewPending}}static{this.collectionSupport=collectionSupport}static{this.styles=[LyraElement.styles,styles,agentActionButtonStyles]}static{this.ownedCollectionProperties=Object.freeze(["files"])}get normalizedFiles(){return firstByIdentity(Array.isArray(this.files)?this.files:[],file=>file.id)}hunks(file){return firstByIdentity(Array.isArray(file.hunks)?file.hunks:[],hunk=>hunk.id)}decision(hunk){return hunk.decision==="keep"||hunk.decision==="discard"?hunk.decision:"pending"}decide(renderedFile,renderedHunk,decision){if(this.decisionDispatching||this.disabled||this.readonly)return;const file=this.normalizedFiles.find(candidate=>candidate.id===renderedFile.id),hunk=file&&this.hunks(file).find(candidate=>candidate.id===renderedHunk.id);if(!(file!==renderedFile||hunk!==renderedHunk||this.decision(hunk)===decision)){this.decisionDispatching=!0;try{this.emit("lr-change-decision-request",{fileId:file.id,hunkId:hunk.id,decision})}finally{this.decisionDispatching=!1}}}renderHunk(file,hunk,index){const decision=this.decision(hunk),label=hunk.label??this.localize("changeReviewHunk",void 0,{index:getNumberFormat(this.effectiveLocale).format(index+1)});return html`<section part="hunk" aria-label=${label}>
2
2
  <div part="hunk-header"><span>${label}</span><span part="status">${this.localize(decision==="keep"?"changeReviewKept":decision==="discard"?"changeReviewDiscarded":"changeReviewPending")}</span></div>
3
3
  <lr-diff-view .oldText=${typeof hunk.before=="string"?hunk.before:""}
4
4
  .newText=${typeof hunk.after=="string"?hunk.after:""} layout="unified"></lr-diff-view>
@@ -47,7 +47,8 @@ export interface EvalDatasetSourceQuery{readonly search:string;readonly tags:rea
47
47
  * component surfaces.
48
48
  *
49
49
  * Public collection arrays take bounded readonly snapshots. Example records retain identity so
50
- * opaque metadata stays intact; reassign `examples` after editing records. At most 10,000 examples
50
+ * opaque metadata stays intact; assign a new `examples` array after editing records (assigning
51
+ * the same mutated array does not update). At most 10,000 examples
51
52
  * are admitted, with an existing limit notice when more are supplied. Other owned collections
52
53
  * retain the 10,000-entry and 50,000-node clone limits.
53
54
  *
@@ -126,7 +127,7 @@ get sourceTotal():number|null;private get sourceMode();private get sourceBlocked
126
127
  * result set resets to `null` (so Remove cannot act on a hidden row), and an active tag filter
127
128
  * that no longer matches any row's `tags` is dropped rather than silently matching zero rows
128
129
  * forever. Empty/blank ids are omitted and duplicates normalize first-wins before filtering,
129
- * selection, the nested grid, and mutation events. */
130
+ * selection, the nested grid, and mutation events. Assign a new array to update: mutating an array and assigning it again does not. */
130
131
  examples:readonly EvalExample[];
131
132
  /** Shows the built-in free-text search field, filtering by a case-insensitive substring match
132
133
  * against `input`, `expectedOutput`, and `tags`. */
@@ -99,7 +99,7 @@ import{__decorate}from"tslib";import{SourcePageController}from"../../../internal
99
99
  .loading=${this.sourceMode&&this.sourcePages.state.pending}
100
100
  .error=${this.sourceMode&&!!(this.sourceFailure||this.sourcePages.state.error)}
101
101
  .sortMode=${this.sourceMode?"server":"client"}
102
- .sortKey=${this.sourceMode?this.sourceSortKey:null}
102
+ .sortKey=${(this.sourceMode?this.sourceSortKey:null)??""}
103
103
  .sortDir=${this.sourceMode?this.sourceSortDir:"asc"}
104
104
  .selectionMode=${this.disabled||this.sourceBlocked?"none":"single"}
105
105
  .columns=${this.buildColumns()}
@@ -60,6 +60,12 @@ export interface EvalToolApprovalDetail extends ToolTimelineApprovalDetail{examp
60
60
  * Public collection properties take bounded, clone-owned readonly snapshots. Create a new
61
61
  * collection and reassign it after changes; mutating the assigned array does not update the view.
62
62
  *
63
+ * After the first render, a change of an example's status is announced politely (assertively for
64
+ * `error`) through the shared live region: `running`, `done`, `error`, `cancelled`, `waiting-input`
65
+ * and `waiting-approval` have their own sentences, `queued`, `collecting` and application-defined
66
+ * statuses announce "{label}: {status}" with the status's localized name or its `label`, and `idle`
67
+ * is silent.
68
+ *
63
69
  * @customElement lr-eval-run
64
70
  * @event lr-example-toggle - An example's disclosure was expanded or collapsed. `detail: { exampleId,
65
71
  * expanded }`.
@@ -113,7 +119,7 @@ protected static readonly identityCollectionProperties:readonly string[];static
113
119
  * to update it (e.g. as each example finishes, or as the whole batch streams in). Empty/blank ids
114
120
  * are omitted and duplicates normalize first-wins before expansion, counts, announcements,
115
121
  * rendering, and events. A valid-id partial streaming row keeps rendering with idle status and
116
- * empty Markdown content until its status/input/output payloads arrive. */
122
+ * empty Markdown content until its status/input/output payloads arrive. Assign a new array to update: mutating an array and assigning it again does not. */
117
123
  examples:readonly EvalExampleResult[];
118
124
  /** The batch's expected total example count. `null` (the default) derives it from
119
125
  * `examples.length` instead -- the common case once every result has already arrived; set this
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{AGENT_STATUS_VARIANTS}from"../../../internal/agent-status-variants.js";import{firstByIdentityMemo}from"../collection-identity.js";import{styles}from"./evaluation-run.styles.js";import{agentStatusKind,agentStatusLabel,agentStatusMessage,agentStatusVariant,isAgentStatusTerminal}from"../agent-status-presentation.js";import{agentStatusText}from"../../../internal/agent-status-text.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{LYRA_DEFAULT_agentRunStatusCancelled,LYRA_DEFAULT_agentRunStatusCollecting,LYRA_DEFAULT_agentRunStatusDone,LYRA_DEFAULT_agentRunStatusIdle,LYRA_DEFAULT_agentRunStatusQueued,LYRA_DEFAULT_agentRunStatusWaitingApproval,LYRA_DEFAULT_agentRunStatusWaitingInput,LYRA_DEFAULT_evaluationRunExampleCancelledAnnounce,LYRA_DEFAULT_evaluationRunExampleCompletedAnnounce,LYRA_DEFAULT_evaluationRunExampleFailedAnnounce,LYRA_DEFAULT_evaluationRunExampleLabel,LYRA_DEFAULT_evaluationRunExampleLimit,LYRA_DEFAULT_evaluationRunExampleStartedAnnounce,LYRA_DEFAULT_evaluationRunExampleWaitingApprovalAnnounce,LYRA_DEFAULT_evaluationRunExampleWaitingInputAnnounce,LYRA_DEFAULT_evaluationRunFailedCount,LYRA_DEFAULT_evaluationRunGroundingHeading,LYRA_DEFAULT_evaluationRunInputHeading,LYRA_DEFAULT_evaluationRunLabel,LYRA_DEFAULT_evaluationRunOutputHeading,LYRA_DEFAULT_evaluationRunProgressLabel,LYRA_DEFAULT_evaluationRunProgressSummary,LYRA_DEFAULT_evaluationRunRunningCount,LYRA_DEFAULT_evaluationRunToolTraceHeading}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusRunning}from"../../../internal/default-strings/shared.generated.js";const RUNNING_ERROR_KINDS=["running","error"],MAX_RENDERED_EXAMPLES=500;let expandedRegistration;const exampleId=example=>example.id;class LyraEvalRun extends LyraElement{constructor(){super(...arguments),this.examples=[],this.total=null,this.headingLevel="4",this.expandedIds=new Set,this.isMounting=!0,this.previousStatusById=new Map,this.decisionDispatching=!1}static{this.defaultStrings={...super.defaultStrings,agentRunStatusCancelled:LYRA_DEFAULT_agentRunStatusCancelled,agentRunStatusCollecting:LYRA_DEFAULT_agentRunStatusCollecting,agentRunStatusDone:LYRA_DEFAULT_agentRunStatusDone,agentRunStatusIdle:LYRA_DEFAULT_agentRunStatusIdle,agentRunStatusQueued:LYRA_DEFAULT_agentRunStatusQueued,agentRunStatusWaitingApproval:LYRA_DEFAULT_agentRunStatusWaitingApproval,agentRunStatusWaitingInput:LYRA_DEFAULT_agentRunStatusWaitingInput,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,evaluationRunExampleCancelledAnnounce:LYRA_DEFAULT_evaluationRunExampleCancelledAnnounce,evaluationRunExampleCompletedAnnounce:LYRA_DEFAULT_evaluationRunExampleCompletedAnnounce,evaluationRunExampleFailedAnnounce:LYRA_DEFAULT_evaluationRunExampleFailedAnnounce,evaluationRunExampleLabel:LYRA_DEFAULT_evaluationRunExampleLabel,evaluationRunExampleLimit:LYRA_DEFAULT_evaluationRunExampleLimit,evaluationRunExampleStartedAnnounce:LYRA_DEFAULT_evaluationRunExampleStartedAnnounce,evaluationRunExampleWaitingApprovalAnnounce:LYRA_DEFAULT_evaluationRunExampleWaitingApprovalAnnounce,evaluationRunExampleWaitingInputAnnounce:LYRA_DEFAULT_evaluationRunExampleWaitingInputAnnounce,evaluationRunFailedCount:LYRA_DEFAULT_evaluationRunFailedCount,evaluationRunGroundingHeading:LYRA_DEFAULT_evaluationRunGroundingHeading,evaluationRunInputHeading:LYRA_DEFAULT_evaluationRunInputHeading,evaluationRunLabel:LYRA_DEFAULT_evaluationRunLabel,evaluationRunOutputHeading:LYRA_DEFAULT_evaluationRunOutputHeading,evaluationRunProgressLabel:LYRA_DEFAULT_evaluationRunProgressLabel,evaluationRunProgressSummary:LYRA_DEFAULT_evaluationRunProgressSummary,evaluationRunRunningCount:LYRA_DEFAULT_evaluationRunRunningCount,evaluationRunToolTraceHeading:LYRA_DEFAULT_evaluationRunToolTraceHeading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning}}emitExampleToolApprovalDecideRequest(detail){return this.emit("lr-example-tool-approval-decide-request",Object.freeze(detail),{cancelable:!0})}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["examples"])}static{this.identityCollectionProperties=Object.freeze(["examples"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-example-citation-select","lr-example-claim-select"])}get normalizedExamples(){return firstByIdentityMemo(Array.isArray(this.examples)?this.examples:[],exampleId)}willUpdate(changed){if(super.willUpdate(changed),this.expandedIds.size>0&&(expandedRegistration??=Promise.all([import("../../conversation/markdown/markdown.js"),import("../../conversation/code-block/code-block.js"),import("../../retrieval/grounding-summary/grounding-summary.js"),import("../tool-timeline/tool-timeline.js")]).catch(()=>expandedRegistration=void 0)),!changed.has("examples"))return;const ids=new Set(this.normalizedExamples.map(example=>example.id));let pruned;for(const id of this.expandedIds)ids.has(id)||(pruned??=new Set(this.expandedIds),pruned.delete(id));pruned&&(this.expandedIds=pruned)}updated(changed){super.updated(changed);const wasMounting=this.isMounting;this.isMounting=!1,changed.has("examples")&&this.diffAndAnnounce(wasMounting)}statusCounts(){const counts={};for(const example of this.normalizedExamples){const kind=agentStatusKind(example.status);counts[kind]=(counts[kind]??0)+1}return counts}exampleLabel(example,index){return example.label||this.localize("evaluationRunExampleLabel",void 0,{index:getNumberFormat(this.effectiveLocale).format(index+1)})}statusText(status){const override=agentStatusLabel(status);return override!==void 0?override:agentStatusText(this.localize.bind(this),agentStatusKind(status))}diffAndAnnounce(firstSight){const region=this.liveRegion,nextStatusById=new Map;this.normalizedExamples.forEach((example,index)=>{const kind=agentStatusKind(example.status);if(nextStatusById.set(example.id,kind),firstSight||!region)return;const previous=this.previousStatusById.get(example.id);if(previous===void 0||previous===kind)return;const label=this.exampleLabel(example,index);switch(kind){case"running":region.mode="polite",region.announce(this.localize("evaluationRunExampleStartedAnnounce",void 0,{label}),{force:!0});break;case"done":region.mode="polite",region.announce(this.localize("evaluationRunExampleCompletedAnnounce",void 0,{label}),{force:!0});break;case"error":region.mode="assertive",region.announce(this.localize("evaluationRunExampleFailedAnnounce",void 0,{label}),{force:!0});break;case"cancelled":region.mode="polite",region.announce(this.localize("evaluationRunExampleCancelledAnnounce",void 0,{label}),{force:!0});break;case"waiting-input":region.mode="polite",region.announce(this.localize("evaluationRunExampleWaitingInputAnnounce",void 0,{label}),{force:!0});break;case"waiting-approval":region.mode="polite",region.announce(this.localize("evaluationRunExampleWaitingApprovalAnnounce",void 0,{label}),{force:!0});break;case"idle":break}}),this.previousStatusById=nextStatusById}exampleTimeline(exampleId2){return this.renderRoot.querySelector(`[part="tool-trace"][data-example-id="${CSS.escape(exampleId2)}"]`)}finalizePendingApproval(exampleId2){this.exampleTimeline(exampleId2)?.finalizePendingApproval()}revertPendingApproval(exampleId2){this.exampleTimeline(exampleId2)?.revertPendingApproval()}onExampleToggle(id,event){event.stopPropagation();const{expanded}=event.detail,next=new Set(this.expandedIds);expanded?next.add(id):next.delete(id),this.expandedIds=next,this.emit("lr-example-toggle",{exampleId:id,expanded})}onCitationSelect(exampleId2,event){event.stopPropagation(),this.emit("lr-example-citation-select",{exampleId:exampleId2,citation:event.detail.citation})}onClaimSelect(exampleId2,event){event.stopPropagation(),this.emit("lr-example-claim-select",{exampleId:exampleId2,claim:event.detail.claim})}onToolApprovalDecide(exampleId2,event){if(!this.decisionDispatching){this.decisionDispatching=!0;try{event.stopPropagation(),this.emitExampleToolApprovalDecideRequest({exampleId:exampleId2,...event.detail}).defaultPrevented&&event.preventDefault()}finally{this.decisionDispatching=!1}}}onToolActivate(exampleId2,event){event.stopPropagation(),this.emit("lr-example-tool-activate",{exampleId:exampleId2,...event.detail})}onToolRenderError(exampleId2,event){event.stopPropagation(),this.emit("lr-example-tool-render-error",{exampleId:exampleId2,...event.detail})}stopOwnedEvent(event){event.stopPropagation()}sectionHeading(text){const level=resolveHeadingLevel(this.headingLevel??"4");return html`<div part="section-heading" role=${level?"heading":nothing} aria-level=${level??nothing}>${text}</div>`}renderContent(content,part){const text=typeof content?.text=="string"?content.text:"";return content?.format==="code"?html`<lr-code-block
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{AGENT_STATUS_VARIANTS}from"../../../internal/agent-status-variants.js";import{firstByIdentityMemo}from"../collection-identity.js";import{styles}from"./evaluation-run.styles.js";import{agentStatusKind,agentStatusLabel,agentStatusMessage,agentStatusVariant,isAgentStatusTerminal}from"../agent-status-presentation.js";import{agentStatusText}from"../../../internal/agent-status-text.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{LYRA_DEFAULT_agentRunStatusCancelled,LYRA_DEFAULT_agentRunStatusCollecting,LYRA_DEFAULT_agentRunStatusDone,LYRA_DEFAULT_agentRunStatusIdle,LYRA_DEFAULT_agentRunStatusQueued,LYRA_DEFAULT_agentRunStatusWaitingApproval,LYRA_DEFAULT_agentRunStatusWaitingInput,LYRA_DEFAULT_evaluationRunExampleCancelledAnnounce,LYRA_DEFAULT_evaluationRunExampleCompletedAnnounce,LYRA_DEFAULT_evaluationRunExampleFailedAnnounce,LYRA_DEFAULT_evaluationRunExampleLabel,LYRA_DEFAULT_evaluationRunExampleLimit,LYRA_DEFAULT_evaluationRunExampleStartedAnnounce,LYRA_DEFAULT_evaluationRunExampleWaitingApprovalAnnounce,LYRA_DEFAULT_evaluationRunExampleWaitingInputAnnounce,LYRA_DEFAULT_evaluationRunFailedCount,LYRA_DEFAULT_evaluationRunGroundingHeading,LYRA_DEFAULT_evaluationRunInputHeading,LYRA_DEFAULT_evaluationRunLabel,LYRA_DEFAULT_evaluationRunOutputHeading,LYRA_DEFAULT_evaluationRunProgressLabel,LYRA_DEFAULT_evaluationRunProgressSummary,LYRA_DEFAULT_evaluationRunRunningCount,LYRA_DEFAULT_evaluationRunToolTraceHeading,LYRA_DEFAULT_taskListStepIncompleteAnnounce}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_statusRunning}from"../../../internal/default-strings/shared.generated.js";const RUNNING_ERROR_KINDS=["running","error"],MAX_RENDERED_EXAMPLES=500;let expandedRegistration;const exampleId=example=>example.id;class LyraEvalRun extends LyraElement{constructor(){super(...arguments),this.examples=[],this.total=null,this.headingLevel="4",this.expandedIds=new Set,this.isMounting=!0,this.previousStatusById=new Map,this.decisionDispatching=!1}static{this.defaultStrings={...super.defaultStrings,agentRunStatusCancelled:LYRA_DEFAULT_agentRunStatusCancelled,agentRunStatusCollecting:LYRA_DEFAULT_agentRunStatusCollecting,agentRunStatusDone:LYRA_DEFAULT_agentRunStatusDone,agentRunStatusIdle:LYRA_DEFAULT_agentRunStatusIdle,agentRunStatusQueued:LYRA_DEFAULT_agentRunStatusQueued,agentRunStatusWaitingApproval:LYRA_DEFAULT_agentRunStatusWaitingApproval,agentRunStatusWaitingInput:LYRA_DEFAULT_agentRunStatusWaitingInput,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,evaluationRunExampleCancelledAnnounce:LYRA_DEFAULT_evaluationRunExampleCancelledAnnounce,evaluationRunExampleCompletedAnnounce:LYRA_DEFAULT_evaluationRunExampleCompletedAnnounce,evaluationRunExampleFailedAnnounce:LYRA_DEFAULT_evaluationRunExampleFailedAnnounce,evaluationRunExampleLabel:LYRA_DEFAULT_evaluationRunExampleLabel,evaluationRunExampleLimit:LYRA_DEFAULT_evaluationRunExampleLimit,evaluationRunExampleStartedAnnounce:LYRA_DEFAULT_evaluationRunExampleStartedAnnounce,evaluationRunExampleWaitingApprovalAnnounce:LYRA_DEFAULT_evaluationRunExampleWaitingApprovalAnnounce,evaluationRunExampleWaitingInputAnnounce:LYRA_DEFAULT_evaluationRunExampleWaitingInputAnnounce,evaluationRunFailedCount:LYRA_DEFAULT_evaluationRunFailedCount,evaluationRunGroundingHeading:LYRA_DEFAULT_evaluationRunGroundingHeading,evaluationRunInputHeading:LYRA_DEFAULT_evaluationRunInputHeading,evaluationRunLabel:LYRA_DEFAULT_evaluationRunLabel,evaluationRunOutputHeading:LYRA_DEFAULT_evaluationRunOutputHeading,evaluationRunProgressLabel:LYRA_DEFAULT_evaluationRunProgressLabel,evaluationRunProgressSummary:LYRA_DEFAULT_evaluationRunProgressSummary,evaluationRunRunningCount:LYRA_DEFAULT_evaluationRunRunningCount,evaluationRunToolTraceHeading:LYRA_DEFAULT_evaluationRunToolTraceHeading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,statusRunning:LYRA_DEFAULT_statusRunning,taskListStepIncompleteAnnounce:LYRA_DEFAULT_taskListStepIncompleteAnnounce}}emitExampleToolApprovalDecideRequest(detail){return this.emit("lr-example-tool-approval-decide-request",Object.freeze(detail),{cancelable:!0})}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["examples"])}static{this.identityCollectionProperties=Object.freeze(["examples"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-example-citation-select","lr-example-claim-select"])}get normalizedExamples(){return firstByIdentityMemo(Array.isArray(this.examples)?this.examples:[],exampleId)}willUpdate(changed){if(super.willUpdate(changed),this.expandedIds.size>0&&(expandedRegistration??=Promise.all([import("../../conversation/markdown/markdown.js"),import("../../conversation/code-block/code-block.js"),import("../../retrieval/grounding-summary/grounding-summary.js"),import("../tool-timeline/tool-timeline.js")]).catch(()=>expandedRegistration=void 0)),!changed.has("examples"))return;const ids=new Set(this.normalizedExamples.map(example=>example.id));let pruned;for(const id of this.expandedIds)ids.has(id)||(pruned??=new Set(this.expandedIds),pruned.delete(id));pruned&&(this.expandedIds=pruned)}updated(changed){super.updated(changed);const wasMounting=this.isMounting;this.isMounting=!1,changed.has("examples")&&this.diffAndAnnounce(wasMounting)}statusCounts(){const counts={};for(const example of this.normalizedExamples){const kind=agentStatusKind(example.status);counts[kind]=(counts[kind]??0)+1}return counts}exampleLabel(example,index){return example.label||this.localize("evaluationRunExampleLabel",void 0,{index:getNumberFormat(this.effectiveLocale).format(index+1)})}statusText(status){const override=agentStatusLabel(status);return override!==void 0?override:agentStatusText(this.localize.bind(this),agentStatusKind(status))}diffAndAnnounce(firstSight){const region=this.liveRegion,nextStatusById=new Map;this.normalizedExamples.forEach((example,index)=>{const kind=agentStatusKind(example.status);if(nextStatusById.set(example.id,kind),firstSight||!region)return;const previous=this.previousStatusById.get(example.id);if(previous===void 0||previous===kind)return;const label=this.exampleLabel(example,index);switch(kind){case"running":region.mode="polite",region.announce(this.localize("evaluationRunExampleStartedAnnounce",void 0,{label}),{force:!0});break;case"done":region.mode="polite",region.announce(this.localize("evaluationRunExampleCompletedAnnounce",void 0,{label}),{force:!0});break;case"error":region.mode="assertive",region.announce(this.localize("evaluationRunExampleFailedAnnounce",void 0,{label}),{force:!0});break;case"cancelled":region.mode="polite",region.announce(this.localize("evaluationRunExampleCancelledAnnounce",void 0,{label}),{force:!0});break;case"waiting-input":region.mode="polite",region.announce(this.localize("evaluationRunExampleWaitingInputAnnounce",void 0,{label}),{force:!0});break;case"waiting-approval":region.mode="polite",region.announce(this.localize("evaluationRunExampleWaitingApprovalAnnounce",void 0,{label}),{force:!0});break;case"idle":break;default:region.mode="polite",region.announce(this.localize("taskListStepIncompleteAnnounce",void 0,{label,status:this.statusText(example.status)}),{force:!0})}}),this.previousStatusById=nextStatusById}exampleTimeline(exampleId2){return this.renderRoot.querySelector(`[part="tool-trace"][data-example-id="${CSS.escape(exampleId2)}"]`)}finalizePendingApproval(exampleId2){this.exampleTimeline(exampleId2)?.finalizePendingApproval()}revertPendingApproval(exampleId2){this.exampleTimeline(exampleId2)?.revertPendingApproval()}onExampleToggle(id,event){event.stopPropagation();const{expanded}=event.detail,next=new Set(this.expandedIds);expanded?next.add(id):next.delete(id),this.expandedIds=next,this.emit("lr-example-toggle",{exampleId:id,expanded})}onCitationSelect(exampleId2,event){event.stopPropagation(),this.emit("lr-example-citation-select",{exampleId:exampleId2,citation:event.detail.citation})}onClaimSelect(exampleId2,event){event.stopPropagation(),this.emit("lr-example-claim-select",{exampleId:exampleId2,claim:event.detail.claim})}onToolApprovalDecide(exampleId2,event){if(!this.decisionDispatching){this.decisionDispatching=!0;try{event.stopPropagation(),this.emitExampleToolApprovalDecideRequest({exampleId:exampleId2,...event.detail}).defaultPrevented&&event.preventDefault()}finally{this.decisionDispatching=!1}}}onToolActivate(exampleId2,event){event.stopPropagation(),this.emit("lr-example-tool-activate",{exampleId:exampleId2,...event.detail})}onToolRenderError(exampleId2,event){event.stopPropagation(),this.emit("lr-example-tool-render-error",{exampleId:exampleId2,...event.detail})}stopOwnedEvent(event){event.stopPropagation()}sectionHeading(text){const level=resolveHeadingLevel(this.headingLevel??"4");return html`<div part="section-heading" role=${level?"heading":nothing} aria-level=${level??nothing}>${text}</div>`}renderContent(content,part){const text=typeof content?.text=="string"?content.text:"";return content?.format==="code"?html`<lr-code-block
2
2
  part=${part}
3
3
  code=${text}
4
4
  language=${content.language??""}
@@ -10,8 +10,8 @@ export type PromptStudioWrap=LyraTextWrap;export interface PromptStudioMessage{i
10
10
  * messages, `{{variable}}` substitution, version selection, preview, save, and run intents.
11
11
  * The host owns persistence and model execution. Opting into message reordering exposes native,
12
12
  * keyboard-operable move controls; every proposed move is cancelable before the editor state changes.
13
- * Empty/blank message and version ids are omitted; duplicates use deterministic first-wins
14
- * semantics. Variable rows are
13
+ * Unsupported message roles and empty/blank message and version ids are omitted; duplicates
14
+ * use deterministic first-wins semantics. Variable rows are
15
15
  * occurrence-addressed because their names are editable and may temporarily be empty or repeated;
16
16
  * duplicate names remain independently editable while placeholder resolution uses the first one.
17
17
  * Variable values resolve recursively; undefined and cyclic placeholders remain intact within