@aceshooting/lyra-ui 27.0.0 → 28.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 (389) hide show
  1. package/CHANGELOG.md +55 -63
  2. package/README.md +7 -3
  3. package/dist/cli/css-declarations.mjs +1 -0
  4. package/dist/cli/lyra-rename-ledger.mjs +1 -1
  5. package/dist/cli/migrate-wa.mjs +9 -4
  6. package/dist/cli/migration-contract.json +1 -1
  7. package/dist/cli/migration-renames.mjs +2 -2
  8. package/dist/cli/migration-theme-scopes.mjs +3 -0
  9. package/dist/cli/theme-scope-vocabulary.generated.mjs +1 -0
  10. package/dist/components/agent-tools/activity-feed/activity-feed.class.js +1 -1
  11. package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.js +1 -1
  12. package/dist/components/agent-tools/agent-question/agent-question.class.js +1 -1
  13. package/dist/components/agent-tools/agent-run/agent-run.class.js +1 -1
  14. package/dist/components/agent-tools/agent-trace/agent-trace.class.js +1 -1
  15. package/dist/components/agent-tools/approval-queue/approval-queue.class.js +1 -1
  16. package/dist/components/agent-tools/artifact-panel/artifact-panel.class.js +1 -1
  17. package/dist/components/agent-tools/background-runs/background-runs.class.js +1 -1
  18. package/dist/components/agent-tools/browser-frame/browser-frame.class.js +1 -1
  19. package/dist/components/agent-tools/budget-meter/budget-meter.class.js +1 -1
  20. package/dist/components/agent-tools/change-review/change-review.class.js +1 -1
  21. package/dist/components/agent-tools/commit-card/commit-card.class.js +1 -1
  22. package/dist/components/agent-tools/compare-panel/compare-panel.class.js +1 -1
  23. package/dist/components/agent-tools/confirm-bar/confirm-bar.class.js +1 -1
  24. package/dist/components/agent-tools/connector-manager/connector-manager.class.js +1 -1
  25. package/dist/components/agent-tools/context-inspector/context-inspector.class.js +1 -1
  26. package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +1 -1
  27. package/dist/components/agent-tools/eval-result/eval-result.class.js +1 -1
  28. package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +1 -1
  29. package/dist/components/agent-tools/mcp-app/mcp-app.class.js +1 -1
  30. package/dist/components/agent-tools/permission-grant/permission-grant.class.js +1 -1
  31. package/dist/components/agent-tools/permission-rules/permission-rules.class.js +1 -1
  32. package/dist/components/agent-tools/policy-summary/policy-summary.class.js +1 -1
  33. package/dist/components/agent-tools/prompt-studio/prompt-studio.class.js +1 -1
  34. package/dist/components/agent-tools/result-card/result-field.class.js +1 -1
  35. package/dist/components/agent-tools/schema-viewer/schema-viewer.class.js +1 -1
  36. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +1 -1
  37. package/dist/components/agent-tools/stack-trace/stack-trace.class.js +1 -1
  38. package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +2 -2
  39. package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
  40. package/dist/components/agent-tools/terminal/terminal.class.js +1 -1
  41. package/dist/components/agent-tools/test-results/test-results.class.js +1 -1
  42. package/dist/components/agent-tools/thinking-panel/thinking-panel.class.js +1 -1
  43. package/dist/components/agent-tools/tool-approval-dialog/tool-approval-dialog.class.js +1 -1
  44. package/dist/components/agent-tools/tool-call-block/tool-call-block.class.js +1 -1
  45. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +1 -1
  46. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +1 -1
  47. package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.class.js +1 -1
  48. package/dist/components/agent-tools/tool-result-view/tool-result-view.class.js +1 -1
  49. package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.class.js +1 -1
  50. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.js +1 -1
  51. package/dist/components/agent-tools/trace-tree/trace-tree.class.js +2 -2
  52. package/dist/components/charts/chart/box-plot.class.js +1 -1
  53. package/dist/components/charts/chart/chart-token-cache.js +2 -2
  54. package/dist/components/charts/chart/chart.class.d.ts +1 -1
  55. package/dist/components/charts/chart/chart.class.js +3 -3
  56. package/dist/components/charts/chart/histogram.class.js +1 -1
  57. package/dist/components/charts/chart/lite-chart.class.js +1 -1
  58. package/dist/components/conversation/agent-workspace/agent-workspace.class.js +1 -1
  59. package/dist/components/conversation/audio-visualizer/audio-visualizer.class.js +1 -1
  60. package/dist/components/conversation/branch-picker/branch-picker.class.js +1 -1
  61. package/dist/components/conversation/chat-composer/chat-composer.class.js +1 -1
  62. package/dist/components/conversation/chat-message/chat-message.class.js +1 -1
  63. package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
  64. package/dist/components/conversation/checkpoint/checkpoint.class.js +1 -1
  65. package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
  66. package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
  67. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  68. package/dist/components/conversation/conversation-item/conversation-item.class.js +1 -1
  69. package/dist/components/conversation/generation-metrics/generation-metrics.class.js +1 -1
  70. package/dist/components/conversation/handoff-divider/handoff-divider.class.js +1 -1
  71. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  72. package/dist/components/conversation/markdown/markdown-core.class.js +1 -1
  73. package/dist/components/conversation/markdown/markdown.class.js +1 -1
  74. package/dist/components/conversation/message-actions/message-actions.class.js +1 -1
  75. package/dist/components/conversation/message-feedback/message-feedback.class.js +1 -1
  76. package/dist/components/conversation/message-parts/message-parts.class.js +1 -1
  77. package/dist/components/conversation/model-select/model-select.class.js +1 -1
  78. package/dist/components/conversation/model-settings-panel/model-settings-panel.class.js +1 -1
  79. package/dist/components/conversation/prompt-input/prompt-input.class.js +1 -1
  80. package/dist/components/conversation/prompt-queue/prompt-queue.class.js +1 -1
  81. package/dist/components/conversation/push-to-talk/push-to-talk.class.js +1 -1
  82. package/dist/components/conversation/realtime-session/realtime-session.class.js +1 -1
  83. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.js +1 -1
  84. package/dist/components/conversation/stream-status/stream-status.class.js +1 -1
  85. package/dist/components/conversation/suggestion-chips/suggestion-chips.class.js +1 -1
  86. package/dist/components/conversation/thread-list/thread-list.class.js +1 -1
  87. package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
  88. package/dist/components/conversation/typing-indicator/typing-indicator.class.js +1 -1
  89. package/dist/components/conversation/usage-badge/usage-badge.class.js +1 -1
  90. package/dist/components/conversation/voice-picker/voice-picker.class.js +1 -1
  91. package/dist/components/data/calendar/calendar.class.js +1 -1
  92. package/dist/components/data/condition-builder/condition-builder.class.js +1 -1
  93. package/dist/components/data/context-meter/context-meter.class.js +1 -1
  94. package/dist/components/data/data-grid/data-grid.class.d.ts +2 -2
  95. package/dist/components/data/data-grid/data-grid.class.js +3 -3
  96. package/dist/components/data/document-library/document-library.class.js +1 -1
  97. package/dist/components/data/env-list/env-list.class.js +1 -1
  98. package/dist/components/data/file-tree/file-tree.class.d.ts +2 -2
  99. package/dist/components/data/file-tree/file-tree.class.js +1 -1
  100. package/dist/components/data/flow-canvas/flow-canvas.class.js +1 -1
  101. package/dist/components/data/flow-controls/flow-controls.class.js +1 -1
  102. package/dist/components/data/flow-minimap/flow-minimap.class.js +1 -1
  103. package/dist/components/data/flow-node/flow-node.class.js +1 -1
  104. package/dist/components/data/flow-run-status/flow-run-status.class.js +1 -1
  105. package/dist/components/data/funnel/funnel.class.js +1 -1
  106. package/dist/components/data/gauge/gauge.class.js +1 -1
  107. package/dist/components/data/graph-query-builder/graph-query-builder.class.js +1 -1
  108. package/dist/components/data/heatmap/heatmap.class.js +1 -1
  109. package/dist/components/data/pagination/pagination.class.d.ts +2 -0
  110. package/dist/components/data/pagination/pagination.class.js +1 -1
  111. package/dist/components/data/pagination/pagination.styles.js +1 -1
  112. package/dist/components/data/sequence-strip/sequence-strip.class.js +1 -1
  113. package/dist/components/data/sparkline/sparkline.class.js +1 -1
  114. package/dist/components/data/stat/stat.class.js +1 -1
  115. package/dist/components/data/table/table.class.d.ts +23 -2
  116. package/dist/components/data/table/table.class.js +5 -3
  117. package/dist/components/data/table/table.styles.js +1 -1
  118. package/dist/components/data/timeline/timeline.class.js +1 -1
  119. package/dist/components/data/tree/tree.class.js +1 -1
  120. package/dist/components/data/word-cloud/word-cloud.class.js +1 -1
  121. package/dist/components/forms/button/button.class.js +1 -1
  122. package/dist/components/forms/checkbox/checkbox.class.js +1 -1
  123. package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
  124. package/dist/components/forms/code-editor/code-editor.class.js +1 -1
  125. package/dist/components/forms/color-picker/color-picker.class.d.ts +8 -4
  126. package/dist/components/forms/color-picker/color-picker.class.js +2 -2
  127. package/dist/components/forms/combobox/combobox.class.js +1 -1
  128. package/dist/components/forms/country-picker/country-picker.class.js +1 -1
  129. package/dist/components/forms/currency-picker/currency-picker.class.js +1 -1
  130. package/dist/components/forms/date-picker/date-input.class.js +1 -1
  131. package/dist/components/forms/date-picker/date-picker.class.js +1 -1
  132. package/dist/components/forms/emoji-picker/emoji-data-loader.js +1 -1
  133. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +7 -4
  134. package/dist/components/forms/emoji-picker/emoji-picker.class.js +5 -5
  135. package/dist/components/forms/icon-button/icon-button.class.d.ts +4 -0
  136. package/dist/components/forms/icon-button/icon-button.class.js +1 -1
  137. package/dist/components/forms/icon-button/icon-button.styles.js +1 -1
  138. package/dist/components/forms/input/input-shared.js +1 -1
  139. package/dist/components/forms/input/input.class.js +1 -1
  140. package/dist/components/forms/input/native-time-input.class.js +1 -1
  141. package/dist/components/forms/input/number-input.class.js +1 -1
  142. package/dist/components/forms/input/time-input.class.js +1 -1
  143. package/dist/components/forms/locale-picker/locale-picker.class.js +1 -1
  144. package/dist/components/forms/otp-input/otp-input.class.js +1 -1
  145. package/dist/components/forms/phone-input/phone-input.class.js +1 -1
  146. package/dist/components/forms/radio/radio-group.class.js +1 -1
  147. package/dist/components/forms/radio/radio.class.js +1 -1
  148. package/dist/components/forms/rubric-form/rubric-form.class.js +4 -4
  149. package/dist/components/forms/select/select.class.js +1 -1
  150. package/dist/components/forms/signature-pad/signature-pad.class.js +1 -1
  151. package/dist/components/forms/slider/slider.class.js +1 -1
  152. package/dist/components/forms/switch/switch.class.js +1 -1
  153. package/dist/components/forms/textarea/textarea.class.js +1 -1
  154. package/dist/components/forms/time-range/time-range.class.js +1 -1
  155. package/dist/components/forms/time-zone-picker/time-zone-picker.class.js +1 -1
  156. package/dist/components/forms/token-input/token-input.class.js +1 -1
  157. package/dist/components/forms/unit-picker/unit-picker.class.js +1 -1
  158. package/dist/components/layout/app-rail/app-rail-item.class.js +1 -1
  159. package/dist/components/layout/app-rail/app-rail.class.d.ts +70 -7
  160. package/dist/components/layout/app-rail/app-rail.class.js +16 -4
  161. package/dist/components/layout/app-rail/app-rail.styles.js +1 -1
  162. package/dist/components/layout/app-rail-group/app-rail-group.class.js +1 -1
  163. package/dist/components/layout/breadcrumb/breadcrumb.class.js +1 -1
  164. package/dist/components/layout/card/card.class.js +1 -1
  165. package/dist/components/layout/carousel/carousel.class.js +1 -1
  166. package/dist/components/layout/command-palette/command-palette.class.js +1 -1
  167. package/dist/components/layout/dashboard-grid/dashboard-grid.class.js +1 -1
  168. package/dist/components/layout/details/accordion-item.class.js +1 -1
  169. package/dist/components/layout/details/details.class.js +1 -1
  170. package/dist/components/layout/dock-panel/dock-panel.class.js +1 -1
  171. package/dist/components/layout/drilldown-panel/drilldown-panel.class.js +1 -1
  172. package/dist/components/layout/filter-bar/filter-bar.class.js +1 -1
  173. package/dist/components/layout/menu/menu.class.js +1 -1
  174. package/dist/components/layout/menubar/menubar.class.js +1 -1
  175. package/dist/components/layout/multi-split/multi-split.class.js +1 -1
  176. package/dist/components/layout/navigation-menu/navigation-menu.class.js +1 -1
  177. package/dist/components/layout/page/page.class.js +1 -1
  178. package/dist/components/layout/reorder-list/reorder-item.class.js +1 -1
  179. package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
  180. package/dist/components/layout/responsive-panel/responsive-panel.class.js +1 -1
  181. package/dist/components/layout/scroller/scroller.class.js +1 -1
  182. package/dist/components/layout/segmented/segmented.class.d.ts +7 -4
  183. package/dist/components/layout/segmented/segmented.styles.js +1 -1
  184. package/dist/components/layout/split-panel/split-panel.class.js +1 -1
  185. package/dist/components/layout/tab-group/tab-group.class.js +1 -1
  186. package/dist/components/layout/tab-group/tab.class.js +1 -1
  187. package/dist/components/layout/virtual-list/virtual-list.styles.js +1 -1
  188. package/dist/components/layout/widget/widget.class.js +1 -1
  189. package/dist/components/media/animated-image/animated-image.class.js +1 -1
  190. package/dist/components/media/attachment-chip/attachment-chip.class.js +1 -1
  191. package/dist/components/media/attachment-trigger/attachment-trigger.class.js +2 -2
  192. package/dist/components/media/av-player/av-player.class.js +1 -1
  193. package/dist/components/media/avatar-group/avatar-group.class.js +1 -1
  194. package/dist/components/media/drop-zone/drop-zone.class.js +1 -1
  195. package/dist/components/media/file-icon/file-icon.class.js +1 -1
  196. package/dist/components/media/file-input/file-input.class.js +1 -1
  197. package/dist/components/media/flag/flag.class.js +1 -1
  198. package/dist/components/media/image-comparer/image-comparer.class.js +1 -1
  199. package/dist/components/media/image-viewer/image-viewer.class.d.ts +2 -1
  200. package/dist/components/media/image-viewer/image-viewer.class.js +4 -2
  201. package/dist/components/media/image-viewer/image-viewer.styles.js +1 -1
  202. package/dist/components/media/lightbox/lightbox.class.js +1 -1
  203. package/dist/components/media/map/map.class.js +1 -1
  204. package/dist/components/media/media-card/media-card.class.js +1 -1
  205. package/dist/components/media/pan-zoom/pan-zoom.class.js +1 -1
  206. package/dist/components/media/qr-code/qr-code.class.d.ts +2 -2
  207. package/dist/components/media/qr-code/qr-code.class.js +1 -1
  208. package/dist/components/media/sequence-playback/sequence-playback.class.js +1 -1
  209. package/dist/components/media/video/video.class.js +1 -1
  210. package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
  211. package/dist/components/media/zoomable-frame/zoomable-frame.class.js +1 -1
  212. package/dist/components/overlays/alert/alert.class.js +1 -1
  213. package/dist/components/overlays/badge/tag.class.js +1 -1
  214. package/dist/components/overlays/callout/callout.class.js +1 -1
  215. package/dist/components/overlays/chip/chip-group.class.js +1 -1
  216. package/dist/components/overlays/chip/chip.class.js +1 -1
  217. package/dist/components/overlays/context-menu/context-menu.class.js +1 -1
  218. package/dist/components/overlays/dialog/confirm.js +1 -1
  219. package/dist/components/overlays/dialog/dialog.class.js +1 -1
  220. package/dist/components/overlays/kbd/kbd.class.js +1 -1
  221. package/dist/components/overlays/overlay/popover.class.js +1 -1
  222. package/dist/components/overlays/overlay/tooltip.class.js +1 -1
  223. package/dist/components/overlays/progress/progress-bar.class.js +1 -1
  224. package/dist/components/overlays/progress/progress-ring.class.js +1 -1
  225. package/dist/components/overlays/rating/rating.class.js +1 -1
  226. package/dist/components/overlays/skeleton/skeleton.class.js +1 -1
  227. package/dist/components/overlays/spinner/spinner.class.js +1 -1
  228. package/dist/components/overlays/toast/toast-item.class.js +1 -1
  229. package/dist/components/overlays/toast/toast.class.js +1 -1
  230. package/dist/components/retrieval/chunk-inspector/chunk-inspector.class.js +1 -1
  231. package/dist/components/retrieval/citation-badge/citation-badge.class.js +1 -1
  232. package/dist/components/retrieval/claim-evidence/claim-evidence.class.js +1 -1
  233. package/dist/components/retrieval/community-card/community-card.class.js +1 -1
  234. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +1 -1
  235. package/dist/components/retrieval/entity-card/entity-card.class.js +1 -1
  236. package/dist/components/retrieval/entity-chip/entity-chip.class.js +1 -1
  237. package/dist/components/retrieval/entity-dossier/entity-dossier.class.js +1 -1
  238. package/dist/components/retrieval/graph/graph.class.js +1 -1
  239. package/dist/components/retrieval/graph-legend/graph-legend.class.js +1 -1
  240. package/dist/components/retrieval/grounding-summary/grounding-summary.class.js +2 -2
  241. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +1 -1
  242. package/dist/components/retrieval/knowledge-base/knowledge-base.class.js +1 -1
  243. package/dist/components/retrieval/knowledge-base-admin/knowledge-base-admin.class.js +1 -1
  244. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +1 -1
  245. package/dist/components/retrieval/memory-panel/memory-panel.class.js +1 -1
  246. package/dist/components/retrieval/mind-map/mind-map.class.js +1 -1
  247. package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +1 -1
  248. package/dist/components/retrieval/node-palette/node-palette.class.js +1 -1
  249. package/dist/components/retrieval/path-strip/path-strip.class.js +1 -1
  250. package/dist/components/retrieval/provenance-panel/provenance-panel.class.js +1 -1
  251. package/dist/components/retrieval/rag-answer/rag-answer.class.js +1 -1
  252. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +1 -1
  253. package/dist/components/retrieval/research-progress/research-progress.class.js +1 -1
  254. package/dist/components/retrieval/retrieval-compare/retrieval-compare.class.js +1 -1
  255. package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +1 -1
  256. package/dist/components/retrieval/retrieval-search/retrieval-search.class.js +1 -1
  257. package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.js +1 -1
  258. package/dist/components/retrieval/source-card/source-card.class.js +1 -1
  259. package/dist/components/retrieval/source-list/source-list.class.js +1 -1
  260. package/dist/components/retrieval/source-picker/source-picker.class.js +1 -1
  261. package/dist/components/utility/copy-button/copy-button.class.js +1 -1
  262. package/dist/components/utility/diff-view/diff-view.class.js +1 -1
  263. package/dist/components/utility/export-button/export-button.class.js +1 -1
  264. package/dist/components/utility/icon/icon.class.js +1 -1
  265. package/dist/components/utility/json-viewer/json-viewer.class.js +1 -1
  266. package/dist/components/utility/known-date/known-date.class.js +1 -1
  267. package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
  268. package/dist/components/utility/poll-status/poll-status.class.js +1 -1
  269. package/dist/components/utility/random-content/random-content.class.js +1 -1
  270. package/dist/components/utility/tour/tour.class.js +1 -1
  271. package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
  272. package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
  273. package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
  274. package/dist/components/viewers/csv-viewer/csv-viewer.class.js +1 -1
  275. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.js +2 -2
  276. package/dist/components/viewers/document-compare/document-compare.class.js +1 -1
  277. package/dist/components/viewers/document-preview/document-preview.class.js +1 -1
  278. package/dist/components/viewers/document-viewer/document-viewer.class.js +1 -1
  279. package/dist/components/viewers/docx-viewer/docx-viewer.class.js +1 -1
  280. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
  281. package/dist/components/viewers/email-viewer/email-viewer.class.js +1 -1
  282. package/dist/components/viewers/geojson-view/geojson-view.class.js +1 -1
  283. package/dist/components/viewers/geojson-view/geojson-viewer.class.js +1 -1
  284. package/dist/components/viewers/highlight-layer/highlight-layer.class.js +1 -1
  285. package/dist/components/viewers/html-viewer/html-viewer.class.js +1 -1
  286. package/dist/components/viewers/include/include.class.js +1 -1
  287. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +1 -1
  288. package/dist/components/viewers/page-rail/page-rail.class.d.ts +1 -1
  289. package/dist/components/viewers/page-rail/page-rail.class.js +3 -3
  290. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +2 -2
  291. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +2 -2
  292. package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +1 -1
  293. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-viewer.class.js +1 -1
  294. package/dist/components/viewers/svg-viewer/svg-viewer.class.js +1 -1
  295. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +1 -1
  296. package/dist/events.d.ts +6 -1
  297. package/dist/framework-types.d.ts +1 -1
  298. package/dist/internal/accessibility-visibility.js +1 -1
  299. package/dist/internal/collection-snapshot.js +1 -1
  300. package/dist/internal/default-strings/agent-tools.generated.js +1 -0
  301. package/dist/internal/default-strings/charts.generated.js +1 -0
  302. package/dist/internal/default-strings/conversation.generated.js +1 -0
  303. package/dist/internal/default-strings/data.generated.js +1 -0
  304. package/dist/internal/default-strings/forms.generated.js +1 -0
  305. package/dist/internal/default-strings/layout.generated.js +1 -0
  306. package/dist/internal/default-strings/media.generated.js +1 -0
  307. package/dist/internal/default-strings/overlays.generated.js +1 -0
  308. package/dist/internal/default-strings/retrieval.generated.js +1 -0
  309. package/dist/internal/default-strings/shared.generated.js +1 -0
  310. package/dist/internal/default-strings/utility.generated.js +1 -0
  311. package/dist/internal/default-strings/viewers.generated.js +5 -0
  312. package/dist/internal/dev-mode-attribute-warning.development.js +1 -1
  313. package/dist/internal/dev-mode-attribute-warning.production.js +1 -1
  314. package/dist/internal/document-tokens.d.ts +11 -0
  315. package/dist/internal/document-tokens.generated.js +15 -0
  316. package/dist/internal/document-tokens.js +3 -0
  317. package/dist/internal/form-associated.d.ts +1 -1
  318. package/dist/internal/form-associated.js +1 -1
  319. package/dist/internal/glass-surface.styles.js +1 -1
  320. package/dist/internal/host-tokens.styles.js +1 -0
  321. package/dist/internal/image-zoom.js +1 -0
  322. package/dist/internal/intl-cache.js +1 -1
  323. package/dist/internal/localization-types.d.ts +1 -1
  324. package/dist/internal/localization.js +2 -2
  325. package/dist/internal/lyra-element.d.ts +4 -2
  326. package/dist/internal/lyra-element.js +2 -2
  327. package/dist/internal/opaque-content-border.styles.js +1 -1
  328. package/dist/internal/open-overlay-raise.styles.js +1 -0
  329. package/dist/internal/optional-peer-failure.js +1 -0
  330. package/dist/internal/package-metadata.js +1 -1
  331. package/dist/internal/prefix.js +1 -1
  332. package/dist/internal/specialist-host-tokens.styles.js +1 -0
  333. package/dist/internal/specialist-tokens.generated.js +2 -0
  334. package/dist/internal/step-value.js +1 -1
  335. package/dist/internal/theme-observation.js +1 -1
  336. package/dist/internal/theme-scopes.d.ts +11 -0
  337. package/dist/internal/theme-scopes.js +1 -0
  338. package/dist/looks/shadcn.css +1 -1
  339. package/dist/lyra.d.ts +1 -1
  340. package/dist/lyra.js +1 -1
  341. package/dist/styles/design-tokens.css +1 -1
  342. package/dist/styles/tokens-root.css +1 -1
  343. package/dist/surfaces/glass.css +1 -1
  344. package/dist/testing/happy-dom-shims.d.ts +21 -2
  345. package/dist/testing/happy-dom-shims.js +1 -1
  346. package/dist/testing/index.d.ts +1 -1
  347. package/dist/testing/index.js +1 -1
  348. package/dist/testing/interaction-drivers.d.ts +66 -7
  349. package/dist/testing/interaction-drivers.js +1 -1
  350. package/dist/testing/jsdom-shims.d.ts +70 -0
  351. package/dist/testing/jsdom-shims.js +1 -0
  352. package/dist/theme/look-inputs.d.ts +1 -1
  353. package/dist/theme/look-inputs.js +37 -41
  354. package/dist/theme/theme.d.ts +13 -0
  355. package/dist/theme/theme.js +1 -1
  356. package/dist/theme.css +1 -1
  357. package/dist/utilities/index.d.ts +1 -1
  358. package/dist/utilities/index.js +1 -1
  359. package/dist/utilities/scoped-registry.d.ts +3 -0
  360. package/dist/utilities/scoped-registry.js +1 -1
  361. package/dist/utilities/theme-scopes.d.ts +1 -0
  362. package/dist/utilities/theme-scopes.js +1 -0
  363. package/dist/utilities/tokens.d.ts +1 -0
  364. package/dist/utilities/tokens.js +1 -0
  365. package/llms/components/lr-app-rail.md +51 -4
  366. package/llms/components/lr-emoji-picker.md +13 -8
  367. package/llms/components/lr-icon-button.md +13 -1
  368. package/llms/components/lr-image-viewer.md +8 -0
  369. package/llms/components/lr-pagination.md +4 -2
  370. package/llms/components/lr-segmented.md +7 -3
  371. package/llms/components/lr-table.md +14 -12
  372. package/llms/components/lr-thread-list.md +4 -3
  373. package/llms/migration.md +9 -0
  374. package/llms/peers.md +1 -1
  375. package/llms/shared/events-and-types.md +41 -0
  376. package/llms/shared/frameworks-and-ssr.md +16 -0
  377. package/llms/shared/imports-and-registration.md +4 -3
  378. package/llms/shared/native-styles-and-utilities.md +38 -3
  379. package/llms/shared/styles-and-tokens.md +242 -102
  380. package/llms/shared/testing-and-utilities.md +90 -6
  381. package/llms/shared.md +431 -114
  382. package/llms/tokens.md +31 -49
  383. package/locales.json +138 -138
  384. package/package.json +14 -7
  385. package/registrations.json +1 -1
  386. package/dist/internal/default-strings.generated.js +0 -5
  387. package/dist/internal/specialist-tokens.styles.js +0 -1
  388. package/dist/internal/tokens/palette.styles.js +0 -1
  389. package/dist/internal/tokens.styles.js +0 -1
@@ -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{guard}from"lit/directives/guard.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./agent-trace.styles.js";import{normalizeLyraSpans}from"../trace-tree/span.js";import{LYRA_DEFAULT_agentTraceFilterLabel,LYRA_DEFAULT_copy,LYRA_DEFAULT_handoffFromToAgent,LYRA_DEFAULT_handoffToAgent,LYRA_DEFAULT_map,LYRA_DEFAULT_spanKindAgent,LYRA_DEFAULT_spanKindEmbedding,LYRA_DEFAULT_spanKindLlm,LYRA_DEFAULT_spanKindOther,LYRA_DEFAULT_spanKindRetriever,LYRA_DEFAULT_spanKindTool,LYRA_DEFAULT_tokensIn,LYRA_DEFAULT_tokensOut}from"../../../internal/default-strings.generated.js";const 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.spans=[],this.activeSpanId=null,this.hiddenKinds=[],this.withTokens=!1,this.withCost=!1,this.withoutBars=!1,this.projectionActiveSpanId=null,this.filteredCache=[],this.presentKindsCache=[],this.handoffsCache=[],this.legendLabels=[],this.legendTypes=[],this.onVisibilityChange=e=>{e.stopPropagation(),this.hiddenKinds=e.detail.hiddenTypes,this.emit("lr-span-visibility-change",{hiddenKinds:[...this.hiddenKinds]})},this.onVisibilityChangeProposal=event=>{event.stopPropagation()},this.onTreeSpanSelect=e=>{this.activeSpanId=e.detail.spanId}}static{this.defaultStrings={...super.defaultStrings,agentTraceFilterLabel:LYRA_DEFAULT_agentTraceFilterLabel,copy:LYRA_DEFAULT_copy,handoffFromToAgent:LYRA_DEFAULT_handoffFromToAgent,handoffToAgent:LYRA_DEFAULT_handoffToAgent,map:LYRA_DEFAULT_map,spanKindAgent:LYRA_DEFAULT_spanKindAgent,spanKindEmbedding:LYRA_DEFAULT_spanKindEmbedding,spanKindLlm:LYRA_DEFAULT_spanKindLlm,spanKindOther:LYRA_DEFAULT_spanKindOther,spanKindRetriever:LYRA_DEFAULT_spanKindRetriever,spanKindTool:LYRA_DEFAULT_spanKindTool,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"])}projectedSpans(){return(this.projectionSource!==this.spans||this.projectionActiveSpanId!==this.activeSpanId)&&(this.projectionSource=this.spans,this.projectionActiveSpanId=this.activeSpanId,this.projectionCache=normalizeLyraSpans(this.spans,this.activeSpanId)),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.activeSpanId=id,this.emit("lr-span-select",{spanId:id})}renderFilter(spans){const kinds=this.presentKinds(spans);if(kinds.length===0)return nothing;const labels=kinds.map(kind=>this.localize(KIND_LABEL_KEY[kind]));return(this.legendKinds!==kinds||labels.some((label,index)=>label!==this.legendLabels[index]))&&(this.legendKinds=kinds,this.legendLabels=labels,this.legendTypes=kinds.map((kind,index)=>({id:kind,label:labels[index]}))),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{guard}from"lit/directives/guard.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./agent-trace.styles.js";import{normalizeLyraSpans}from"../trace-tree/span.js";import{LYRA_DEFAULT_agentTraceFilterLabel,LYRA_DEFAULT_spanKindAgent,LYRA_DEFAULT_spanKindEmbedding,LYRA_DEFAULT_spanKindLlm,LYRA_DEFAULT_spanKindOther,LYRA_DEFAULT_spanKindRetriever,LYRA_DEFAULT_spanKindTool}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_handoffFromToAgent,LYRA_DEFAULT_handoffToAgent,LYRA_DEFAULT_map,LYRA_DEFAULT_tokensIn,LYRA_DEFAULT_tokensOut}from"../../../internal/default-strings/shared.generated.js";const 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.spans=[],this.activeSpanId=null,this.hiddenKinds=[],this.withTokens=!1,this.withCost=!1,this.withoutBars=!1,this.projectionActiveSpanId=null,this.filteredCache=[],this.presentKindsCache=[],this.handoffsCache=[],this.legendLabels=[],this.legendTypes=[],this.onVisibilityChange=e=>{e.stopPropagation(),this.hiddenKinds=e.detail.hiddenTypes,this.emit("lr-span-visibility-change",{hiddenKinds:[...this.hiddenKinds]})},this.onVisibilityChangeProposal=event=>{event.stopPropagation()},this.onTreeSpanSelect=e=>{this.activeSpanId=e.detail.spanId}}static{this.defaultStrings={...super.defaultStrings,agentTraceFilterLabel:LYRA_DEFAULT_agentTraceFilterLabel,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,handoffFromToAgent:LYRA_DEFAULT_handoffFromToAgent,handoffToAgent:LYRA_DEFAULT_handoffToAgent,map:LYRA_DEFAULT_map,spanKindAgent:LYRA_DEFAULT_spanKindAgent,spanKindEmbedding:LYRA_DEFAULT_spanKindEmbedding,spanKindLlm:LYRA_DEFAULT_spanKindLlm,spanKindOther:LYRA_DEFAULT_spanKindOther,spanKindRetriever:LYRA_DEFAULT_spanKindRetriever,spanKindTool:LYRA_DEFAULT_spanKindTool,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"])}projectedSpans(){return(this.projectionSource!==this.spans||this.projectionActiveSpanId!==this.activeSpanId)&&(this.projectionSource=this.spans,this.projectionActiveSpanId=this.activeSpanId,this.projectionCache=normalizeLyraSpans(this.spans,this.activeSpanId)),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.activeSpanId=id,this.emit("lr-span-select",{spanId:id})}renderFilter(spans){const kinds=this.presentKinds(spans);if(kinds.length===0)return nothing;const labels=kinds.map(kind=>this.localize(KIND_LABEL_KEY[kind]));return(this.legendKinds!==kinds||labels.some((label,index)=>label!==this.legendLabels[index]))&&(this.legendKinds=kinds,this.legendLabels=labels,this.legendTypes=kinds.map((kind,index)=>({id:kind,label:labels[index]}))),html`
2
2
  <lr-graph-legend
3
3
  part="filter"
4
4
  .label=${this.localize("agentTraceFilterLabel")}
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{keyed}from"lit/directives/keyed.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{deepActiveElementIn,shadowFocusTarget}from"../../../internal/active-element.js";import{focusFirstAvailable}from"../../../internal/focus-navigation.js";import{styles}from"./approval-queue.styles.js";import{overallSemanticLabel}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_approvalQueueEmpty,LYRA_DEFAULT_approvalQueueLabel,LYRA_DEFAULT_approvalQueueLimit,LYRA_DEFAULT_approvalQueueOpen,LYRA_DEFAULT_approvalQueuePending,LYRA_DEFAULT_approvalQueuePendingCount,LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmDenied}from"../../../internal/default-strings.generated.js";const MAX_RENDERED_REQUESTS=500,normalizedRequestCache=new WeakMap;class LyraApprovalQueue extends LyraElement{constructor(){super(...arguments),this.requests=[],this.selectedInvocationId=null,this.open=!1,this.readonly=!1,this.nestedCloseInvocationId=null,this.decidedInvocationIds=new Set,this.settledAnnouncements=[],this.focusAnchorId=null,this.decisionDispatching=!1}static{this.defaultStrings={...super.defaultStrings,approvalQueueEmpty:LYRA_DEFAULT_approvalQueueEmpty,approvalQueueLabel:LYRA_DEFAULT_approvalQueueLabel,approvalQueueLimit:LYRA_DEFAULT_approvalQueueLimit,approvalQueueOpen:LYRA_DEFAULT_approvalQueueOpen,approvalQueuePending:LYRA_DEFAULT_approvalQueuePending,approvalQueuePendingCount:LYRA_DEFAULT_approvalQueuePendingCount,confirmApproved:LYRA_DEFAULT_confirmApproved,confirmDenied:LYRA_DEFAULT_confirmDenied}}emitApprovalDecisionRequest(detail){return this.emit("lr-approval-decision-request",Object.freeze(detail),{cancelable:!0})}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["requests"])}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.sink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this})}disconnectedCallback(){super.disconnectedCallback(),this.sink?.release(),this.sink=void 0,this.decidedInvocationIds.clear(),this.settledAnnouncements=[]}get pendingApproval(){return this.dialogEl?.pendingAction??null}finalizePendingApproval(){const pending=this.pendingApproval;pending&&this.dialogEl?.close(pending)}revertPendingApproval(){this.dialogEl&&(this.dialogEl.pendingAction=null)}normalizedRequestsFor(value){if(!Array.isArray(value))return[];let normalized=normalizedRequestCache.get(value);return normalized||(normalized=firstByIdentity(value,request=>request.id),Object.isFrozen(value)&&normalizedRequestCache.set(value,normalized)),normalized}stableDialogArgs(request){let json="";try{json=JSON.stringify(request.args)??""}catch{}const previous=this.dialogArgs;return json&&previous?.id===request.id&&previous.json===json?previous.args:(this.dialogArgs={id:request.id,json,args:request.args},request.args)}get normalizedRequests(){return this.normalizedRequestsFor(this.requests)}get selectedRequest(){return this.normalizedRequests.find(request=>request.id===this.selectedInvocationId)}willUpdate(changed){if(super.willUpdate(changed),changed.has("requests")&&this.hasUpdated&&this.prepareRequestsUpdate(),!changed.has("requests")&&!changed.has("selectedInvocationId"))return;const selectedInvocationId=this.selectedInvocationId,selected=this.selectedRequest;if(selected&&(selected.status??"pending")==="pending")return;const previousSelected=selectedInvocationId!==null&&changed.has("requests")?this.normalizedRequestsFor(changed.get("requests")).find(request=>request.id===selectedInvocationId):void 0,invalidated=this.hasUpdated&&!changed.has("selectedInvocationId")&&selectedInvocationId!==null&&previousSelected!==void 0&&(previousSelected.status??"pending")==="pending",nestedCloseInSameCycle=this.nestedCloseInvocationId===selectedInvocationId;this.selectedInvocationId=null,this.open=!1,invalidated&&!nestedCloseInSameCycle&&this.emit("lr-approval-close",{invocationId:selectedInvocationId,reason:"request-invalidated"})}updated(changed){super.updated(changed),this.nestedCloseInvocationId=null;const anchorId=this.focusAnchorId;this.focusAnchorId=null;const active=deepActiveElementIn(this.ownerDocument);if(anchorId!==null&&(!active||active===this.ownerDocument.body||active.disabled)){const rows=[...this.renderRoot.querySelectorAll('[part~="request"]')],index=rows.findIndex(row=>row.dataset.requestId===anchorId);focusFirstAvailable([...rows.slice(index+1),...rows.slice(0,Math.max(index,0)).reverse(),this.countEl])}for(const text of this.settledAnnouncements.splice(0))this.sink?.announce(text)}prepareRequestsUpdate(){const active=shadowFocusTarget(this);this.focusAnchorId=active&&active===this.dialogEl?this.selectedInvocationId:active?.dataset.requestId??null;for(const id of this.decidedInvocationIds){const request=this.normalizedRequests.find(candidate=>candidate.id===id),status=request&&(request.status??"pending");status!=="pending"&&(this.decidedInvocationIds.delete(id),status&&this.settledAnnouncements.push(this.statusLabel(status)))}}pendingCount(){return this.normalizedRequests.filter(request=>(request.status??"pending")==="pending").length}formatCount(value){return getNumberFormat(this.effectiveLocale).format(value)}statusLabel(status){return status==="approved"?this.localize("confirmApproved"):status==="denied"?this.localize("confirmDenied"):this.localize("approvalQueuePending")}statusVariant(status){return status==="approved"?"success":status==="denied"?"danger":"warning"}select(request){(request.status??"pending")==="pending"&&(this.selectedInvocationId=request.id,this.open=!0,this.emit("lr-approval-select",{invocationId:request.id}))}onApprove(request,event){if(!this.decisionDispatching){this.decisionDispatching=!0;try{if(event.stopPropagation(),(request.status??"pending")!=="pending")return;this.decidedInvocationIds.add(request.id),this.emitApprovalDecisionRequest({invocationId:request.id,approved:!0,args:event.detail.args}).defaultPrevented&&event.preventDefault()}finally{this.decisionDispatching=!1}}}onDeny(request,event){if(!this.decisionDispatching){this.decisionDispatching=!0;try{if(event.stopPropagation(),(request.status??"pending")!=="pending")return;this.decidedInvocationIds.add(request.id),this.emitApprovalDecisionRequest({invocationId:request.id,approved:!1}).defaultPrevented&&event.preventDefault()}finally{this.decisionDispatching=!1}}}onClose(request,event){if(event.stopPropagation(),this.nestedCloseInvocationId=request.id,request.id===this.selectedInvocationId){const wasOpen=this.open;this.open=!1,wasOpen||this.requestUpdate()}else this.requestUpdate();this.emit("lr-approval-close",{invocationId:request.id,reason:event.detail.reason})}renderRequest(request){const status=request.status??"pending",statusId=`approval-queue-status-${request.id}`;return html`<div role="listitem"><button
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{keyed}from"lit/directives/keyed.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{deepActiveElementIn,shadowFocusTarget}from"../../../internal/active-element.js";import{focusFirstAvailable}from"../../../internal/focus-navigation.js";import{styles}from"./approval-queue.styles.js";import{overallSemanticLabel}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_approvalQueueEmpty,LYRA_DEFAULT_approvalQueueLabel,LYRA_DEFAULT_approvalQueueLimit,LYRA_DEFAULT_approvalQueueOpen,LYRA_DEFAULT_approvalQueuePending,LYRA_DEFAULT_approvalQueuePendingCount,LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmDenied}from"../../../internal/default-strings/agent-tools.generated.js";const MAX_RENDERED_REQUESTS=500,normalizedRequestCache=new WeakMap;class LyraApprovalQueue extends LyraElement{constructor(){super(...arguments),this.requests=[],this.selectedInvocationId=null,this.open=!1,this.readonly=!1,this.nestedCloseInvocationId=null,this.decidedInvocationIds=new Set,this.settledAnnouncements=[],this.focusAnchorId=null,this.decisionDispatching=!1}static{this.defaultStrings={...super.defaultStrings,approvalQueueEmpty:LYRA_DEFAULT_approvalQueueEmpty,approvalQueueLabel:LYRA_DEFAULT_approvalQueueLabel,approvalQueueLimit:LYRA_DEFAULT_approvalQueueLimit,approvalQueueOpen:LYRA_DEFAULT_approvalQueueOpen,approvalQueuePending:LYRA_DEFAULT_approvalQueuePending,approvalQueuePendingCount:LYRA_DEFAULT_approvalQueuePendingCount,confirmApproved:LYRA_DEFAULT_confirmApproved,confirmDenied:LYRA_DEFAULT_confirmDenied}}emitApprovalDecisionRequest(detail){return this.emit("lr-approval-decision-request",Object.freeze(detail),{cancelable:!0})}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["requests"])}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.sink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this})}disconnectedCallback(){super.disconnectedCallback(),this.sink?.release(),this.sink=void 0,this.decidedInvocationIds.clear(),this.settledAnnouncements=[]}get pendingApproval(){return this.dialogEl?.pendingAction??null}finalizePendingApproval(){const pending=this.pendingApproval;pending&&this.dialogEl?.close(pending)}revertPendingApproval(){this.dialogEl&&(this.dialogEl.pendingAction=null)}normalizedRequestsFor(value){if(!Array.isArray(value))return[];let normalized=normalizedRequestCache.get(value);return normalized||(normalized=firstByIdentity(value,request=>request.id),Object.isFrozen(value)&&normalizedRequestCache.set(value,normalized)),normalized}stableDialogArgs(request){let json="";try{json=JSON.stringify(request.args)??""}catch{}const previous=this.dialogArgs;return json&&previous?.id===request.id&&previous.json===json?previous.args:(this.dialogArgs={id:request.id,json,args:request.args},request.args)}get normalizedRequests(){return this.normalizedRequestsFor(this.requests)}get selectedRequest(){return this.normalizedRequests.find(request=>request.id===this.selectedInvocationId)}willUpdate(changed){if(super.willUpdate(changed),changed.has("requests")&&this.hasUpdated&&this.prepareRequestsUpdate(),!changed.has("requests")&&!changed.has("selectedInvocationId"))return;const selectedInvocationId=this.selectedInvocationId,selected=this.selectedRequest;if(selected&&(selected.status??"pending")==="pending")return;const previousSelected=selectedInvocationId!==null&&changed.has("requests")?this.normalizedRequestsFor(changed.get("requests")).find(request=>request.id===selectedInvocationId):void 0,invalidated=this.hasUpdated&&!changed.has("selectedInvocationId")&&selectedInvocationId!==null&&previousSelected!==void 0&&(previousSelected.status??"pending")==="pending",nestedCloseInSameCycle=this.nestedCloseInvocationId===selectedInvocationId;this.selectedInvocationId=null,this.open=!1,invalidated&&!nestedCloseInSameCycle&&this.emit("lr-approval-close",{invocationId:selectedInvocationId,reason:"request-invalidated"})}updated(changed){super.updated(changed),this.nestedCloseInvocationId=null;const anchorId=this.focusAnchorId;this.focusAnchorId=null;const active=deepActiveElementIn(this.ownerDocument);if(anchorId!==null&&(!active||active===this.ownerDocument.body||active.disabled)){const rows=[...this.renderRoot.querySelectorAll('[part~="request"]')],index=rows.findIndex(row=>row.dataset.requestId===anchorId);focusFirstAvailable([...rows.slice(index+1),...rows.slice(0,Math.max(index,0)).reverse(),this.countEl])}for(const text of this.settledAnnouncements.splice(0))this.sink?.announce(text)}prepareRequestsUpdate(){const active=shadowFocusTarget(this);this.focusAnchorId=active&&active===this.dialogEl?this.selectedInvocationId:active?.dataset.requestId??null;for(const id of this.decidedInvocationIds){const request=this.normalizedRequests.find(candidate=>candidate.id===id),status=request&&(request.status??"pending");status!=="pending"&&(this.decidedInvocationIds.delete(id),status&&this.settledAnnouncements.push(this.statusLabel(status)))}}pendingCount(){return this.normalizedRequests.filter(request=>(request.status??"pending")==="pending").length}formatCount(value){return getNumberFormat(this.effectiveLocale).format(value)}statusLabel(status){return status==="approved"?this.localize("confirmApproved"):status==="denied"?this.localize("confirmDenied"):this.localize("approvalQueuePending")}statusVariant(status){return status==="approved"?"success":status==="denied"?"danger":"warning"}select(request){(request.status??"pending")==="pending"&&(this.selectedInvocationId=request.id,this.open=!0,this.emit("lr-approval-select",{invocationId:request.id}))}onApprove(request,event){if(!this.decisionDispatching){this.decisionDispatching=!0;try{if(event.stopPropagation(),(request.status??"pending")!=="pending")return;this.decidedInvocationIds.add(request.id),this.emitApprovalDecisionRequest({invocationId:request.id,approved:!0,args:event.detail.args}).defaultPrevented&&event.preventDefault()}finally{this.decisionDispatching=!1}}}onDeny(request,event){if(!this.decisionDispatching){this.decisionDispatching=!0;try{if(event.stopPropagation(),(request.status??"pending")!=="pending")return;this.decidedInvocationIds.add(request.id),this.emitApprovalDecisionRequest({invocationId:request.id,approved:!1}).defaultPrevented&&event.preventDefault()}finally{this.decisionDispatching=!1}}}onClose(request,event){if(event.stopPropagation(),this.nestedCloseInvocationId=request.id,request.id===this.selectedInvocationId){const wasOpen=this.open;this.open=!1,wasOpen||this.requestUpdate()}else this.requestUpdate();this.emit("lr-approval-close",{invocationId:request.id,reason:event.detail.reason})}renderRequest(request){const status=request.status??"pending",statusId=`approval-queue-status-${request.id}`;return html`<div role="listitem"><button
2
2
  part="request"
3
3
  type="button"
4
4
  data-request-id=${request.id}
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{tag}from"../../../internal/prefix.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{safeDownloadHref}from"../../../internal/safe-url.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{styles}from"./artifact-panel.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_artifactPanelCode,LYRA_DEFAULT_artifactPanelGenerating,LYRA_DEFAULT_artifactPanelLabel,LYRA_DEFAULT_artifactPanelNextVersion,LYRA_DEFAULT_artifactPanelPreview,LYRA_DEFAULT_artifactPanelPreviousVersion,LYRA_DEFAULT_artifactPanelRestore,LYRA_DEFAULT_artifactPanelVersionPosition,LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_download}from"../../../internal/default-strings.generated.js";class LyraArtifactPanel extends LyraElement{constructor(){super(...arguments),this.kind="",this.view="preview",this.versions=[],this.activeVersionId=null,this.streaming=!1,this.copyText="",this.downloadSrc="",this.downloadName="",this.hasCodeSlot=!1,this.copyGeneration=0,this.onCodeSlotChange=()=>{this.hasCodeSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="code"),!this.hasCodeSlot&&this.view==="code"&&(this.view="preview")},this.onCopy=async()=>{const text=this.copyText,owner=this.isConnected?this.ownerDocument.defaultView:null,generation=++this.copyGeneration,outcome=await writeClipboardText(owner,text);if(!owner||!this.isConnected||this.ownerDocument.defaultView!==owner||generation!==this.copyGeneration)return;const liveRegion=this.renderRoot.querySelector(tag("live-region"));if(outcome.ok){liveRegion?.announce(this.localize("copied")),this.emit("lr-copy",outcome);return}liveRegion?.announce(this.localize("copyFailed")),this.emit("lr-error"),this.emit("lr-copy-error",outcome)},this.onDownload=()=>{const safeSrc=safeDownloadHref(this.downloadSrc);safeSrc&&this.emit("lr-download",{filename:this.downloadName,src:safeSrc})}}static{this.defaultStrings={...super.defaultStrings,artifactPanelCode:LYRA_DEFAULT_artifactPanelCode,artifactPanelGenerating:LYRA_DEFAULT_artifactPanelGenerating,artifactPanelLabel:LYRA_DEFAULT_artifactPanelLabel,artifactPanelNextVersion:LYRA_DEFAULT_artifactPanelNextVersion,artifactPanelPreview:LYRA_DEFAULT_artifactPanelPreview,artifactPanelPreviousVersion:LYRA_DEFAULT_artifactPanelPreviousVersion,artifactPanelRestore:LYRA_DEFAULT_artifactPanelRestore,artifactPanelVersionPosition:LYRA_DEFAULT_artifactPanelVersionPosition,copied:LYRA_DEFAULT_copied,copy:LYRA_DEFAULT_copy,copyFailed:LYRA_DEFAULT_copyFailed,download:LYRA_DEFAULT_download}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["versions"])}static{this.styles=[LyraElement.styles,styles,agentActionButtonStyles]}get normalizedVersions(){return firstByIdentity(Array.isArray(this.versions)?this.versions:[],version=>version.id)}disconnectedCallback(){super.disconnectedCallback(),this.copyGeneration+=1}willUpdate(changed){super.willUpdate(changed),this.seedFirstRenderState(()=>{this.hasCodeSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="code")}),!this.hasCodeSlot&&this.view==="code"&&(this.view="preview"),this.activeVersionId!==null&&(changed.has("versions")||changed.has("activeVersionId"))&&!this.normalizedVersions.some(version=>version.id===this.activeVersionId)&&(this.activeVersionId=null,this.removeAttribute("active-version-id"))}get accessibleLabel(){return this.label==null?this.localize("artifactPanelLabel"):this.label}setView(view){view!==this.view&&(this.view=view,this.emit("lr-view-change",{view}))}get currentIndex(){const versions=this.normalizedVersions;if(this.activeVersionId===null)return versions.length-1;const index=versions.findIndex(v=>v.id===this.activeVersionId);return index>=0?index:versions.length-1}goToVersion(index){const versions=this.normalizedVersions,version=versions[index];if(!version)return;const isLatest=index===versions.length-1;this.activeVersionId=isLatest?null:version.id,this.emit("lr-version-change",{versionId:version.id}),this.renderRoot.querySelector(tag("live-region"))?.announce(this.localize("artifactPanelVersionPosition",void 0,{index:this.formatCount(index+1),count:this.formatCount(versions.length)}))}render(){const versions=this.normalizedVersions,hasVersions=versions.length>0,index=this.currentIndex,currentVersion=versions[index],isLatest=this.activeVersionId===null||index===versions.length-1;return html`
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{tag}from"../../../internal/prefix.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{safeDownloadHref}from"../../../internal/safe-url.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{styles}from"./artifact-panel.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{firstByIdentity}from"../collection-identity.js";import{LYRA_DEFAULT_artifactPanelCode,LYRA_DEFAULT_artifactPanelGenerating,LYRA_DEFAULT_artifactPanelLabel,LYRA_DEFAULT_artifactPanelNextVersion,LYRA_DEFAULT_artifactPanelPreview,LYRA_DEFAULT_artifactPanelPreviousVersion,LYRA_DEFAULT_artifactPanelRestore,LYRA_DEFAULT_artifactPanelVersionPosition}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_download}from"../../../internal/default-strings/shared.generated.js";class LyraArtifactPanel extends LyraElement{constructor(){super(...arguments),this.kind="",this.view="preview",this.versions=[],this.activeVersionId=null,this.streaming=!1,this.copyText="",this.downloadSrc="",this.downloadName="",this.hasCodeSlot=!1,this.copyGeneration=0,this.onCodeSlotChange=()=>{this.hasCodeSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="code"),!this.hasCodeSlot&&this.view==="code"&&(this.view="preview")},this.onCopy=async()=>{const text=this.copyText,owner=this.isConnected?this.ownerDocument.defaultView:null,generation=++this.copyGeneration,outcome=await writeClipboardText(owner,text);if(!owner||!this.isConnected||this.ownerDocument.defaultView!==owner||generation!==this.copyGeneration)return;const liveRegion=this.renderRoot.querySelector(tag("live-region"));if(outcome.ok){liveRegion?.announce(this.localize("copied")),this.emit("lr-copy",outcome);return}liveRegion?.announce(this.localize("copyFailed")),this.emit("lr-error"),this.emit("lr-copy-error",outcome)},this.onDownload=()=>{const safeSrc=safeDownloadHref(this.downloadSrc);safeSrc&&this.emit("lr-download",{filename:this.downloadName,src:safeSrc})}}static{this.defaultStrings={...super.defaultStrings,artifactPanelCode:LYRA_DEFAULT_artifactPanelCode,artifactPanelGenerating:LYRA_DEFAULT_artifactPanelGenerating,artifactPanelLabel:LYRA_DEFAULT_artifactPanelLabel,artifactPanelNextVersion:LYRA_DEFAULT_artifactPanelNextVersion,artifactPanelPreview:LYRA_DEFAULT_artifactPanelPreview,artifactPanelPreviousVersion:LYRA_DEFAULT_artifactPanelPreviousVersion,artifactPanelRestore:LYRA_DEFAULT_artifactPanelRestore,artifactPanelVersionPosition:LYRA_DEFAULT_artifactPanelVersionPosition,copied:LYRA_DEFAULT_copied,copy:LYRA_DEFAULT_copy,copyFailed:LYRA_DEFAULT_copyFailed,download:LYRA_DEFAULT_download}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["versions"])}static{this.styles=[LyraElement.styles,styles,agentActionButtonStyles]}get normalizedVersions(){return firstByIdentity(Array.isArray(this.versions)?this.versions:[],version=>version.id)}disconnectedCallback(){super.disconnectedCallback(),this.copyGeneration+=1}willUpdate(changed){super.willUpdate(changed),this.seedFirstRenderState(()=>{this.hasCodeSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="code")}),!this.hasCodeSlot&&this.view==="code"&&(this.view="preview"),this.activeVersionId!==null&&(changed.has("versions")||changed.has("activeVersionId"))&&!this.normalizedVersions.some(version=>version.id===this.activeVersionId)&&(this.activeVersionId=null,this.removeAttribute("active-version-id"))}get accessibleLabel(){return this.label==null?this.localize("artifactPanelLabel"):this.label}setView(view){view!==this.view&&(this.view=view,this.emit("lr-view-change",{view}))}get currentIndex(){const versions=this.normalizedVersions;if(this.activeVersionId===null)return versions.length-1;const index=versions.findIndex(v=>v.id===this.activeVersionId);return index>=0?index:versions.length-1}goToVersion(index){const versions=this.normalizedVersions,version=versions[index];if(!version)return;const isLatest=index===versions.length-1;this.activeVersionId=isLatest?null:version.id,this.emit("lr-version-change",{versionId:version.id}),this.renderRoot.querySelector(tag("live-region"))?.announce(this.localize("artifactPanelVersionPosition",void 0,{index:this.formatCount(index+1),count:this.formatCount(versions.length)}))}render(){const versions=this.normalizedVersions,hasVersions=versions.length>0,index=this.currentIndex,currentVersion=versions[index],isLatest=this.activeVersionId===null||index===versions.length-1;return html`
2
2
  <div part="base">
3
3
  <lr-live-region mode="polite"></lr-live-region>
4
4
  <div part="header">
@@ -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,LYRA_DEFAULT_cancel,LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,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.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,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}),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`
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{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{safeMediaSrc}from"../../../internal/safe-url.js";import{srOnly}from"../../../internal/a11y.js";import{styles}from"./browser-frame.styles.js";import{literalSetConverter}from"../../../internal/converters.js";import{styleMap}from"lit/directives/style-map.js";import{finiteRange}from"../../../internal/numbers.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{LYRA_DEFAULT_browserFrameControllerAgent,LYRA_DEFAULT_browserFrameControllerUser,LYRA_DEFAULT_browserFrameHandBack,LYRA_DEFAULT_browserFrameLabel,LYRA_DEFAULT_browserFrameStatusConnecting,LYRA_DEFAULT_browserFrameStatusIdle,LYRA_DEFAULT_browserFrameStatusLive,LYRA_DEFAULT_browserFrameStatusStalled,LYRA_DEFAULT_browserFrameStop,LYRA_DEFAULT_browserFrameTakeOver,LYRA_DEFAULT_browserFrameUrlLabel,LYRA_DEFAULT_browserFrameViewOf,LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_details,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const BROWSER_FRAME_PHASE=literalSetConverter(["idle","connecting","streaming","stalled"],"idle"),BROWSER_FRAME_CONTROLLER=literalSetConverter(["agent","user"],"agent");function containRect(containerW,containerH,naturalW,naturalH){if(naturalW===0||naturalH===0||containerW===0||containerH===0)return{left:0,top:0,width:containerW,height:containerH};const containerRatio=containerW/containerH,naturalRatio=naturalW/naturalH;if(naturalRatio>containerRatio){const height=containerW/naturalRatio;return{left:0,top:(containerH-height)/2,width:containerW,height}}const width=containerH*naturalRatio;return{left:(containerW-width)/2,top:0,width,height:containerH}}const STATUS_KEY={idle:"browserFrameStatusIdle",connecting:"browserFrameStatusConnecting",streaming:"browserFrameStatusLive",stalled:"browserFrameStatusStalled"};class LyraBrowserFrame extends LyraElement{constructor(){super(...arguments),this._frameSrc="",this.url="",this._phase="idle",this._controller="agent",this.pings=[],this.withoutControls=!1,this.hasDefaultSlotContent=!1,this.contentRect=null,this.viewportObserverGeneration=0,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.suppressNextStatusAnnouncement=!0,this.onSlotChange=()=>{this.collectDefaultSlotContent()},this.onFrameLoad=()=>{this.observeViewport(),this.recomputeContentRect()},this.onFrameError=()=>{this.contentRect=null},this.onTakeOver=()=>{const requested=this.controller==="agent"?"user":"agent";this.emit("lr-take-over",{controller:requested})}}static{this.defaultStrings={...super.defaultStrings,browserFrameControllerAgent:LYRA_DEFAULT_browserFrameControllerAgent,browserFrameControllerUser:LYRA_DEFAULT_browserFrameControllerUser,browserFrameHandBack:LYRA_DEFAULT_browserFrameHandBack,browserFrameLabel:LYRA_DEFAULT_browserFrameLabel,browserFrameStatusConnecting:LYRA_DEFAULT_browserFrameStatusConnecting,browserFrameStatusIdle:LYRA_DEFAULT_browserFrameStatusIdle,browserFrameStatusLive:LYRA_DEFAULT_browserFrameStatusLive,browserFrameStatusStalled:LYRA_DEFAULT_browserFrameStatusStalled,browserFrameStop:LYRA_DEFAULT_browserFrameStop,browserFrameTakeOver:LYRA_DEFAULT_browserFrameTakeOver,browserFrameUrlLabel:LYRA_DEFAULT_browserFrameUrlLabel,browserFrameViewOf:LYRA_DEFAULT_browserFrameViewOf,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,details:LYRA_DEFAULT_details,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["pings"])}static{this.styles=[LyraElement.styles,styles,srOnly]}get frameSrc(){return this._frameSrc}set frameSrc(next){const old=this._frameSrc;this._frameSrc=next??"",old!==this._frameSrc&&(this.contentRect=null,this.requestUpdate("frameSrc",old))}get phase(){return this._phase}set phase(next){const normalized=BROWSER_FRAME_PHASE.normalizeReflected(this,"phase",next),old=this._phase;old!==normalized&&(this._phase=normalized,this.requestUpdate("phase",old))}get controller(){return this._controller}set controller(next){const old=this._controller;this._controller=BROWSER_FRAME_CONTROLLER.normalizeReflected(this,"controller",next),this.requestUpdate("controller",old)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.suppressNextStatusAnnouncement=!0,this.requestUpdate(),this.observeViewport(),this.recomputeContentRect())}disconnectedCallback(){super.disconnectedCallback(),this.resetViewportObserver(),this.suppressNextStatusAnnouncement=!0}adoptedCallback(){super.adoptedCallback(),this.resetViewportObserver(),this.announcements.adopted(),this.suppressNextStatusAnnouncement=!0}willUpdate(changed){super.willUpdate(changed),this.hasUpdated&&!this.suppressNextStatusAnnouncement&&changed.has("phase")&&this.announcements.announcePolite(this.localize(STATUS_KEY[this.phase]))}updated(_changed){super.updated(_changed),this.suppressNextStatusAnnouncement=!1}firstUpdated(changed){super.firstUpdated(changed);const slot=this.defaultSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,()=>this.collectDefaultSlotContent())})}observeViewport(){const viewport=this.renderRoot.querySelector('[part="viewport"]'),ownerDocument=this.ownerDocument;if(!this.isConnected||!viewport||this.viewportResizeObserver&&this.viewportObserverDocument===ownerDocument&&this.viewportObserverTarget===viewport)return;this.resetViewportObserver();const ResizeObserverCtor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverCtor)return;const generation=this.viewportObserverGeneration,observer=new ResizeObserverCtor(()=>{this.viewportResizeObserver!==observer||this.viewportObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.viewportObserverTarget!==viewport||this.recomputeContentRect()});this.viewportResizeObserver=observer,this.viewportObserverDocument=ownerDocument,this.viewportObserverTarget=viewport,observer.observe(viewport)}resetViewportObserver(){this.viewportObserverGeneration+=1,this.viewportResizeObserver?.disconnect(),this.viewportResizeObserver=void 0,this.viewportObserverDocument=void 0,this.viewportObserverTarget=void 0}recomputeContentRect(){const viewport=this.renderRoot.querySelector('[part="viewport"]'),img=this.renderRoot.querySelector('[part="frame"]');if(!viewport||!img||!img.naturalWidth||!img.naturalHeight){this.contentRect=null;return}this.contentRect=containRect(viewport.clientWidth,viewport.clientHeight,img.naturalWidth,img.naturalHeight)}pingStyle(ping){const x=finiteRange(ping.x,0,0,100),y=finiteRange(ping.y,0,0,100),rect=this.contentRect;return rect?styleMap({left:`${rect.left+x/100*rect.width}px`,top:`${rect.top+y/100*rect.height}px`}):styleMap({left:`${x}%`,top:`${y}%`})}collectDefaultSlotContent(){this.hasDefaultSlotContent=Array.from(this.children).some(el=>!el.getAttribute("slot")),this.contentRect=null,this.requestUpdate()}render(){const safeSrc=safeMediaSrc(this.frameSrc);return html`
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{safeMediaSrc}from"../../../internal/safe-url.js";import{srOnly}from"../../../internal/a11y.js";import{styles}from"./browser-frame.styles.js";import{literalSetConverter}from"../../../internal/converters.js";import{styleMap}from"lit/directives/style-map.js";import{finiteRange}from"../../../internal/numbers.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{LYRA_DEFAULT_browserFrameControllerAgent,LYRA_DEFAULT_browserFrameControllerUser,LYRA_DEFAULT_browserFrameHandBack,LYRA_DEFAULT_browserFrameLabel,LYRA_DEFAULT_browserFrameStatusConnecting,LYRA_DEFAULT_browserFrameStatusIdle,LYRA_DEFAULT_browserFrameStatusLive,LYRA_DEFAULT_browserFrameStatusStalled,LYRA_DEFAULT_browserFrameStop,LYRA_DEFAULT_browserFrameTakeOver,LYRA_DEFAULT_browserFrameUrlLabel,LYRA_DEFAULT_browserFrameViewOf}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings/shared.generated.js";const BROWSER_FRAME_PHASE=literalSetConverter(["idle","connecting","streaming","stalled"],"idle"),BROWSER_FRAME_CONTROLLER=literalSetConverter(["agent","user"],"agent");function containRect(containerW,containerH,naturalW,naturalH){if(naturalW===0||naturalH===0||containerW===0||containerH===0)return{left:0,top:0,width:containerW,height:containerH};const containerRatio=containerW/containerH,naturalRatio=naturalW/naturalH;if(naturalRatio>containerRatio){const height=containerW/naturalRatio;return{left:0,top:(containerH-height)/2,width:containerW,height}}const width=containerH*naturalRatio;return{left:(containerW-width)/2,top:0,width,height:containerH}}const STATUS_KEY={idle:"browserFrameStatusIdle",connecting:"browserFrameStatusConnecting",streaming:"browserFrameStatusLive",stalled:"browserFrameStatusStalled"};class LyraBrowserFrame extends LyraElement{constructor(){super(...arguments),this._frameSrc="",this.url="",this._phase="idle",this._controller="agent",this.pings=[],this.withoutControls=!1,this.hasDefaultSlotContent=!1,this.contentRect=null,this.viewportObserverGeneration=0,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.suppressNextStatusAnnouncement=!0,this.onSlotChange=()=>{this.collectDefaultSlotContent()},this.onFrameLoad=()=>{this.observeViewport(),this.recomputeContentRect()},this.onFrameError=()=>{this.contentRect=null},this.onTakeOver=()=>{const requested=this.controller==="agent"?"user":"agent";this.emit("lr-take-over",{controller:requested})}}static{this.defaultStrings={...super.defaultStrings,browserFrameControllerAgent:LYRA_DEFAULT_browserFrameControllerAgent,browserFrameControllerUser:LYRA_DEFAULT_browserFrameControllerUser,browserFrameHandBack:LYRA_DEFAULT_browserFrameHandBack,browserFrameLabel:LYRA_DEFAULT_browserFrameLabel,browserFrameStatusConnecting:LYRA_DEFAULT_browserFrameStatusConnecting,browserFrameStatusIdle:LYRA_DEFAULT_browserFrameStatusIdle,browserFrameStatusLive:LYRA_DEFAULT_browserFrameStatusLive,browserFrameStatusStalled:LYRA_DEFAULT_browserFrameStatusStalled,browserFrameStop:LYRA_DEFAULT_browserFrameStop,browserFrameTakeOver:LYRA_DEFAULT_browserFrameTakeOver,browserFrameUrlLabel:LYRA_DEFAULT_browserFrameUrlLabel,browserFrameViewOf:LYRA_DEFAULT_browserFrameViewOf,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["pings"])}static{this.styles=[LyraElement.styles,styles,srOnly]}get frameSrc(){return this._frameSrc}set frameSrc(next){const old=this._frameSrc;this._frameSrc=next??"",old!==this._frameSrc&&(this.contentRect=null,this.requestUpdate("frameSrc",old))}get phase(){return this._phase}set phase(next){const normalized=BROWSER_FRAME_PHASE.normalizeReflected(this,"phase",next),old=this._phase;old!==normalized&&(this._phase=normalized,this.requestUpdate("phase",old))}get controller(){return this._controller}set controller(next){const old=this._controller;this._controller=BROWSER_FRAME_CONTROLLER.normalizeReflected(this,"controller",next),this.requestUpdate("controller",old)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.suppressNextStatusAnnouncement=!0,this.requestUpdate(),this.observeViewport(),this.recomputeContentRect())}disconnectedCallback(){super.disconnectedCallback(),this.resetViewportObserver(),this.suppressNextStatusAnnouncement=!0}adoptedCallback(){super.adoptedCallback(),this.resetViewportObserver(),this.announcements.adopted(),this.suppressNextStatusAnnouncement=!0}willUpdate(changed){super.willUpdate(changed),this.hasUpdated&&!this.suppressNextStatusAnnouncement&&changed.has("phase")&&this.announcements.announcePolite(this.localize(STATUS_KEY[this.phase]))}updated(_changed){super.updated(_changed),this.suppressNextStatusAnnouncement=!1}firstUpdated(changed){super.firstUpdated(changed);const slot=this.defaultSlot;queueMicrotask(()=>{collectInitialSlotAssignment(slot,()=>this.collectDefaultSlotContent())})}observeViewport(){const viewport=this.renderRoot.querySelector('[part="viewport"]'),ownerDocument=this.ownerDocument;if(!this.isConnected||!viewport||this.viewportResizeObserver&&this.viewportObserverDocument===ownerDocument&&this.viewportObserverTarget===viewport)return;this.resetViewportObserver();const ResizeObserverCtor=ownerDocument.defaultView?.ResizeObserver;if(!ResizeObserverCtor)return;const generation=this.viewportObserverGeneration,observer=new ResizeObserverCtor(()=>{this.viewportResizeObserver!==observer||this.viewportObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||this.viewportObserverTarget!==viewport||this.recomputeContentRect()});this.viewportResizeObserver=observer,this.viewportObserverDocument=ownerDocument,this.viewportObserverTarget=viewport,observer.observe(viewport)}resetViewportObserver(){this.viewportObserverGeneration+=1,this.viewportResizeObserver?.disconnect(),this.viewportResizeObserver=void 0,this.viewportObserverDocument=void 0,this.viewportObserverTarget=void 0}recomputeContentRect(){const viewport=this.renderRoot.querySelector('[part="viewport"]'),img=this.renderRoot.querySelector('[part="frame"]');if(!viewport||!img||!img.naturalWidth||!img.naturalHeight){this.contentRect=null;return}this.contentRect=containRect(viewport.clientWidth,viewport.clientHeight,img.naturalWidth,img.naturalHeight)}pingStyle(ping){const x=finiteRange(ping.x,0,0,100),y=finiteRange(ping.y,0,0,100),rect=this.contentRect;return rect?styleMap({left:`${rect.left+x/100*rect.width}px`,top:`${rect.top+y/100*rect.height}px`}):styleMap({left:`${x}%`,top:`${y}%`})}collectDefaultSlotContent(){this.hasDefaultSlotContent=Array.from(this.children).some(el=>!el.getAttribute("slot")),this.contentRect=null,this.requestUpdate()}render(){const safeSrc=safeMediaSrc(this.frameSrc);return html`
2
2
  <div
3
3
  part="base"
4
4
  role=${overallSemanticRole(this,"group")??nothing}
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{hostAriaLabel}from"../../../internal/a11y.js";import{finiteNumber,finiteRatio}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./budget-meter.styles.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{LYRA_DEFAULT_budgetMeterExceeded,LYRA_DEFAULT_budgetMeterLabel,LYRA_DEFAULT_budgetMeterPercent,LYRA_DEFAULT_budgetMeterUnavailable,LYRA_DEFAULT_budgetMeterValue}from"../../../internal/default-strings.generated.js";class LyraBudgetMeter extends LyraElement{constructor(){super(...arguments),this.used=0,this.limit=0,this.headingLevel="2"}static{this.defaultStrings={...super.defaultStrings,budgetMeterExceeded:LYRA_DEFAULT_budgetMeterExceeded,budgetMeterLabel:LYRA_DEFAULT_budgetMeterLabel,budgetMeterPercent:LYRA_DEFAULT_budgetMeterPercent,budgetMeterUnavailable:LYRA_DEFAULT_budgetMeterUnavailable,budgetMeterValue:LYRA_DEFAULT_budgetMeterValue}}static{this.styles=[LyraElement.styles,styles]}get safeUsed(){return Math.max(0,finiteNumber(this.used,0))}get safeLimit(){return Math.max(0,finiteNumber(this.limit,0))}formatValue(value){return getNumberFormat(this.effectiveLocale,{maximumFractionDigits:2}).format(value)}valueText(){return this.localize("budgetMeterValue",void 0,{used:this.formatValue(this.safeUsed),limit:this.formatValue(this.safeLimit),unit:this.unit??""}).trim()}render(){const visibleLabel=this.label==null?this.localize("budgetMeterLabel"):this.label,hostLabel=hostAriaLabel(this),used=this.safeUsed,limit=this.safeLimit,available=limit>0,ratio=available?finiteRatio(used,0,limit):0,percentage=available?getNumberFormat(this.effectiveLocale,{style:"percent",maximumFractionDigits:0}).format(ratio):"",ariaValueNow=Math.min(used,limit),level=resolveHeadingLevel(this.headingLevel??"2");return html`
1
+ import{__decorate}from"tslib";import{hostAriaLabel}from"../../../internal/a11y.js";import{finiteNumber,finiteRatio}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./budget-meter.styles.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{LYRA_DEFAULT_budgetMeterExceeded,LYRA_DEFAULT_budgetMeterLabel,LYRA_DEFAULT_budgetMeterPercent,LYRA_DEFAULT_budgetMeterUnavailable,LYRA_DEFAULT_budgetMeterValue}from"../../../internal/default-strings/agent-tools.generated.js";class LyraBudgetMeter extends LyraElement{constructor(){super(...arguments),this.used=0,this.limit=0,this.headingLevel="2"}static{this.defaultStrings={...super.defaultStrings,budgetMeterExceeded:LYRA_DEFAULT_budgetMeterExceeded,budgetMeterLabel:LYRA_DEFAULT_budgetMeterLabel,budgetMeterPercent:LYRA_DEFAULT_budgetMeterPercent,budgetMeterUnavailable:LYRA_DEFAULT_budgetMeterUnavailable,budgetMeterValue:LYRA_DEFAULT_budgetMeterValue}}static{this.styles=[LyraElement.styles,styles]}get safeUsed(){return Math.max(0,finiteNumber(this.used,0))}get safeLimit(){return Math.max(0,finiteNumber(this.limit,0))}formatValue(value){return getNumberFormat(this.effectiveLocale,{maximumFractionDigits:2}).format(value)}valueText(){return this.localize("budgetMeterValue",void 0,{used:this.formatValue(this.safeUsed),limit:this.formatValue(this.safeLimit),unit:this.unit??""}).trim()}render(){const visibleLabel=this.label==null?this.localize("budgetMeterLabel"):this.label,hostLabel=hostAriaLabel(this),used=this.safeUsed,limit=this.safeLimit,available=limit>0,ratio=available?finiteRatio(used,0,limit):0,percentage=available?getNumberFormat(this.effectiveLocale,{style:"percent",maximumFractionDigits:0}).format(ratio):"",ariaValueNow=Math.min(used,limit),level=resolveHeadingLevel(this.headingLevel??"2");return html`
2
2
  <section part="base" role="group" aria-label=${hostLabel===null?nothing:hostLabel}>
3
3
  ${visibleLabel===""?nothing:html`<div part="label" role=${level?"heading":nothing} aria-level=${level??nothing}>${visibleLabel}</div>`}
4
4
  ${available?html`
@@ -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.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}),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}>
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>
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteCount,finiteRange}from"../../../internal/numbers.js";import{styles}from"./commit-card.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{GIT_STATUSES}from"../../data/file-tree/file-tree.class.js";import{getDateTimeFormat}from"../../../internal/intl-cache.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_commitCardCopyHash,LYRA_DEFAULT_commitCardDiffSummary,LYRA_DEFAULT_commitCardFilesLimit,LYRA_DEFAULT_commitCardHideFiles,LYRA_DEFAULT_commitCardLabel,LYRA_DEFAULT_commitCardShowFiles,LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_details,LYRA_DEFAULT_gitStatusAdded,LYRA_DEFAULT_gitStatusConflicted,LYRA_DEFAULT_gitStatusDeleted,LYRA_DEFAULT_gitStatusIgnored,LYRA_DEFAULT_gitStatusModified,LYRA_DEFAULT_gitStatusRenamed,LYRA_DEFAULT_gitStatusUntracked,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const GIT_STATUS_LETTER={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"C",ignored:"!"},MAX_DATE_EPOCH_MS=864e13,MAX_RENDERED_FILES=500,GIT_STATUS_KEY={added:"gitStatusAdded",modified:"gitStatusModified",deleted:"gitStatusDeleted",renamed:"gitStatusRenamed",untracked:"gitStatusUntracked",conflicted:"gitStatusConflicted",ignored:"gitStatusIgnored"};class LyraCommitCard extends LyraElement{constructor(){super(...arguments),this.limitAnnouncements=new AnnouncementSinkController(this,{eager:["polite"]}),this.limitAnnouncementInitialized=!1,this.previouslyTruncated=!1,this.hash="",this.message="",this.author="",this.files=[],this.filesExpanded=!1,this.withoutCopyButton=!1,this.size="m",this.frame="card",this.copyStatus="rest",this.copyGeneration=0,this.onCopy=()=>{this.copyHash()},this.toggleFiles=()=>{const expanded=!this.filesExpanded;this.emit("lr-toggle-request",{expanded},{cancelable:!0}).defaultPrevented||(this.filesExpanded=expanded,this.emit("lr-toggle",{expanded,collapsed:!expanded}))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,commitCardCopyHash:LYRA_DEFAULT_commitCardCopyHash,commitCardDiffSummary:LYRA_DEFAULT_commitCardDiffSummary,commitCardFilesLimit:LYRA_DEFAULT_commitCardFilesLimit,commitCardHideFiles:LYRA_DEFAULT_commitCardHideFiles,commitCardLabel:LYRA_DEFAULT_commitCardLabel,commitCardShowFiles:LYRA_DEFAULT_commitCardShowFiles,copied:LYRA_DEFAULT_copied,copy:LYRA_DEFAULT_copy,copyFailed:LYRA_DEFAULT_copyFailed,details:LYRA_DEFAULT_details,gitStatusAdded:LYRA_DEFAULT_gitStatusAdded,gitStatusConflicted:LYRA_DEFAULT_gitStatusConflicted,gitStatusDeleted:LYRA_DEFAULT_gitStatusDeleted,gitStatusIgnored:LYRA_DEFAULT_gitStatusIgnored,gitStatusModified:LYRA_DEFAULT_gitStatusModified,gitStatusRenamed:LYRA_DEFAULT_gitStatusRenamed,gitStatusUntracked:LYRA_DEFAULT_gitStatusUntracked,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["files"])}static{this.styles=[LyraElement.styles,styles,agentActionButtonStyles]}updated(changed){super.updated(changed);const truncated=this.filesExpanded&&this.normalizedFiles.length>MAX_RENDERED_FILES;this.limitAnnouncementInitialized&&truncated&&!this.previouslyTruncated&&this.limitAnnouncements.announcePolite(this.localize("commitCardFilesLimit",void 0,{count:this.formatCount(MAX_RENDERED_FILES)})),this.limitAnnouncementInitialized=!0,this.previouslyTruncated=truncated}get normalizedFiles(){return firstByIdentity(Array.isArray(this.files)?this.files:[],file=>file.path).map(file=>{if(file.status===void 0||GIT_STATUSES.has(file.status))return file;const retained={...file};return delete retained.status,retained})}disconnectedCallback(){super.disconnectedCallback(),this.resetCopyFeedback()}adoptedCallback(){super.adoptedCallback(),this.limitAnnouncements.adopted(),this.resetCopyFeedback()}cancelCopyTimer(){const timer=this.copyTimer;this.copyTimer=void 0,timer&&timer.owner.clearTimeout(timer.handle)}resetCopyFeedback(){this.copyGeneration+=1,this.cancelCopyTimer(),this.copyStatus="rest"}get subject(){return(this.message??"").split(`
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteCount,finiteRange}from"../../../internal/numbers.js";import{styles}from"./commit-card.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{GIT_STATUSES}from"../../data/file-tree/file-tree.class.js";import{getDateTimeFormat}from"../../../internal/intl-cache.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{firstByIdentity}from"../collection-identity.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{LYRA_DEFAULT_commitCardCopyHash,LYRA_DEFAULT_commitCardDiffSummary,LYRA_DEFAULT_commitCardFilesLimit,LYRA_DEFAULT_commitCardHideFiles,LYRA_DEFAULT_commitCardLabel,LYRA_DEFAULT_commitCardShowFiles}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_gitStatusAdded,LYRA_DEFAULT_gitStatusConflicted,LYRA_DEFAULT_gitStatusDeleted,LYRA_DEFAULT_gitStatusIgnored,LYRA_DEFAULT_gitStatusModified,LYRA_DEFAULT_gitStatusRenamed,LYRA_DEFAULT_gitStatusUntracked,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings/shared.generated.js";const GIT_STATUS_LETTER={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"C",ignored:"!"},MAX_DATE_EPOCH_MS=864e13,MAX_RENDERED_FILES=500,GIT_STATUS_KEY={added:"gitStatusAdded",modified:"gitStatusModified",deleted:"gitStatusDeleted",renamed:"gitStatusRenamed",untracked:"gitStatusUntracked",conflicted:"gitStatusConflicted",ignored:"gitStatusIgnored"};class LyraCommitCard extends LyraElement{constructor(){super(...arguments),this.limitAnnouncements=new AnnouncementSinkController(this,{eager:["polite"]}),this.limitAnnouncementInitialized=!1,this.previouslyTruncated=!1,this.hash="",this.message="",this.author="",this.files=[],this.filesExpanded=!1,this.withoutCopyButton=!1,this.size="m",this.frame="card",this.copyStatus="rest",this.copyGeneration=0,this.onCopy=()=>{this.copyHash()},this.toggleFiles=()=>{const expanded=!this.filesExpanded;this.emit("lr-toggle-request",{expanded},{cancelable:!0}).defaultPrevented||(this.filesExpanded=expanded,this.emit("lr-toggle",{expanded,collapsed:!expanded}))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,commitCardCopyHash:LYRA_DEFAULT_commitCardCopyHash,commitCardDiffSummary:LYRA_DEFAULT_commitCardDiffSummary,commitCardFilesLimit:LYRA_DEFAULT_commitCardFilesLimit,commitCardHideFiles:LYRA_DEFAULT_commitCardHideFiles,commitCardLabel:LYRA_DEFAULT_commitCardLabel,commitCardShowFiles:LYRA_DEFAULT_commitCardShowFiles,copied:LYRA_DEFAULT_copied,copy:LYRA_DEFAULT_copy,copyFailed:LYRA_DEFAULT_copyFailed,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,gitStatusAdded:LYRA_DEFAULT_gitStatusAdded,gitStatusConflicted:LYRA_DEFAULT_gitStatusConflicted,gitStatusDeleted:LYRA_DEFAULT_gitStatusDeleted,gitStatusIgnored:LYRA_DEFAULT_gitStatusIgnored,gitStatusModified:LYRA_DEFAULT_gitStatusModified,gitStatusRenamed:LYRA_DEFAULT_gitStatusRenamed,gitStatusUntracked:LYRA_DEFAULT_gitStatusUntracked,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["files"])}static{this.styles=[LyraElement.styles,styles,agentActionButtonStyles]}updated(changed){super.updated(changed);const truncated=this.filesExpanded&&this.normalizedFiles.length>MAX_RENDERED_FILES;this.limitAnnouncementInitialized&&truncated&&!this.previouslyTruncated&&this.limitAnnouncements.announcePolite(this.localize("commitCardFilesLimit",void 0,{count:this.formatCount(MAX_RENDERED_FILES)})),this.limitAnnouncementInitialized=!0,this.previouslyTruncated=truncated}get normalizedFiles(){return firstByIdentity(Array.isArray(this.files)?this.files:[],file=>file.path).map(file=>{if(file.status===void 0||GIT_STATUSES.has(file.status))return file;const retained={...file};return delete retained.status,retained})}disconnectedCallback(){super.disconnectedCallback(),this.resetCopyFeedback()}adoptedCallback(){super.adoptedCallback(),this.limitAnnouncements.adopted(),this.resetCopyFeedback()}cancelCopyTimer(){const timer=this.copyTimer;this.copyTimer=void 0,timer&&timer.owner.clearTimeout(timer.handle)}resetCopyFeedback(){this.copyGeneration+=1,this.cancelCopyTimer(),this.copyStatus="rest"}get subject(){return(this.message??"").split(`
2
2
  `)[0]??""}get body(){return(this.message??"").split(`
3
3
  `).slice(1).join(`
4
4
  `).trim()}get validTimestamp(){if(!(this.timestamp==null||!Number.isFinite(this.timestamp)||this.timestamp>MAX_DATE_EPOCH_MS))return finiteRange(this.timestamp,this.timestamp,0)}get totals(){return this.normalizedFiles.reduce((acc,file)=>({additions:finiteCount(acc.additions+finiteCount(file.additions)),deletions:finiteCount(acc.deletions+finiteCount(file.deletions))}),{additions:0,deletions:0})}async copyHash(){const text=this.hash,owner=this.isConnected?this.ownerDocument.defaultView:null,generation=++this.copyGeneration;this.cancelCopyTimer(),this.copyStatus="rest";const outcome=await writeClipboardText(owner,text);if(!(!owner||!this.isCurrentCopy(generation,owner))){if(!outcome.ok){this.showCopyStatus("error",generation,owner),this.emit("lr-error"),this.emit("lr-copy-error",outcome);return}this.showCopyStatus("success",generation,owner),this.emit("lr-copy",outcome)}}isCurrentCopy(generation,owner){return this.isConnected&&generation===this.copyGeneration&&this.ownerDocument.defaultView===owner}showCopyStatus(status,generation,owner){this.copyStatus=status,this.cancelCopyTimer();let handle=0;handle=owner.setTimeout(()=>{this.copyTimer?.owner!==owner||this.copyTimer.handle!==handle||this.copyTimer.generation!==generation||generation!==this.copyGeneration||!this.isConnected||this.ownerDocument.defaultView!==owner||(this.copyTimer=void 0,this.copyStatus="rest")},1500),this.copyTimer={owner,handle,generation}}render(){const files=this.normalizedFiles,{additions,deletions}=this.totals,timestamp=this.validTimestamp;return html`
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./compare-panel.styles.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{LYRA_DEFAULT_comparePanel,LYRA_DEFAULT_compareResponseA,LYRA_DEFAULT_compareResponseB,LYRA_DEFAULT_compareVoteBetter,LYRA_DEFAULT_compareVoteBothBad,LYRA_DEFAULT_compareVoteLabel,LYRA_DEFAULT_compareVoteRecorded,LYRA_DEFAULT_compareVoteTie}from"../../../internal/default-strings.generated.js";class LyraComparePanel extends LyraElement{constructor(){super(...arguments),this.hasPromptSlot=!1,this._labelA="",this._labelB="",this._vote=null,this._itemId="",this._syncScroll=!1,this._disabled=!1,this.pendingScrollReset=!1,this.suppressSync=!1,this.ownerRealmGeneration=0,this.voteAssignedInCommit=!1,this.voteWriteVersion=0,this.allowedVotes=["a","b","tie","both-bad"],this.onPromptSlotChange=e=>{this.collectPromptSlotContent(e.target)},this.voteDispatching=!1,this.onPaneScroll=source=>()=>{if(!this.syncScroll||this.suppressSync)return;const from=source==="a"?this.paneAEl:this.paneBEl,to=source==="a"?this.paneBEl:this.paneAEl;if(!from||!to)return;const fromMax=from.scrollHeight-from.clientHeight,toMax=to.scrollHeight-to.clientHeight;if(fromMax<=0)return;const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow||!this.isConnected)return;const fraction=from.scrollTop/fromMax;this.suppressSync=!0,to.scrollTop=fraction*toMax;const generation=this.ownerRealmGeneration,handle=ownerWindow.requestAnimationFrame(()=>{this.syncScrollRafId!==handle||this.syncScrollRafOwner!==ownerWindow||this.syncScrollRafDocument!==ownerDocument||this.ownerRealmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.syncScrollRafId=void 0,this.syncScrollRafOwner=void 0,this.syncScrollRafDocument=void 0,this.suppressSync=!1)});this.syncScrollRafId=handle,this.syncScrollRafOwner=ownerWindow,this.syncScrollRafDocument=ownerDocument}}static{this.defaultStrings={...super.defaultStrings,comparePanel:LYRA_DEFAULT_comparePanel,compareResponseA:LYRA_DEFAULT_compareResponseA,compareResponseB:LYRA_DEFAULT_compareResponseB,compareVoteBetter:LYRA_DEFAULT_compareVoteBetter,compareVoteBothBad:LYRA_DEFAULT_compareVoteBothBad,compareVoteLabel:LYRA_DEFAULT_compareVoteLabel,compareVoteRecorded:LYRA_DEFAULT_compareVoteRecorded,compareVoteTie:LYRA_DEFAULT_compareVoteTie}}emitVoteRequest(detail){return this.emit("lr-vote-request",Object.freeze(detail),{cancelable:!0})}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["allowedVotes"])}static{this.styles=[LyraElement.styles,styles]}static{this.properties={labelA:{attribute:"label-a",noAccessor:!0},labelB:{attribute:"label-b",noAccessor:!0},vote:{reflect:!0,noAccessor:!0},itemId:{attribute:"item-id",noAccessor:!0},syncScroll:{type:Boolean,attribute:"sync-scroll",noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}get labelA(){return this._labelA}set labelA(next){const old=this._labelA;this._labelA=next??"",this.requestUpdate("labelA",old)}get labelB(){return this._labelB}set labelB(next){const old=this._labelB;this._labelB=next??"",this.requestUpdate("labelB",old)}get vote(){return this._vote}set vote(next){this.voteWriteVersion++,this.voteAssignedInCommit=!0;const old=this._vote;this._vote=next??null,this._vote?this.setAttribute("vote",this._vote):this.removeAttribute("vote"),this.requestUpdate("vote",old)}get itemId(){return this._itemId}set itemId(next){const old=this._itemId;this._itemId=next??"",old!==this._itemId&&(this.pendingScrollReset=!0),this.requestUpdate("itemId",old)}get syncScroll(){return this._syncScroll}set syncScroll(next){const old=this._syncScroll;this._syncScroll=!!next,this.requestUpdate("syncScroll",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.requestUpdate("disabled",old)}collectPromptSlotContent(slot){this.hasPromptSlot=slot.assignedNodes({flatten:!0}).length>0}disconnectedCallback(){this.resetScrollSyncFrame(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetScrollSyncFrame()}resetScrollSyncFrame(){this.ownerRealmGeneration+=1,this.syncScrollRafId!==void 0&&this.syncScrollRafOwner?.cancelAnimationFrame(this.syncScrollRafId),this.syncScrollRafId=void 0,this.syncScrollRafOwner=void 0,this.syncScrollRafDocument=void 0,this.suppressSync=!1}castVote(choice){if(!this.voteDispatching){this.voteDispatching=!0;try{if(this.disabled)return;const itemId=this.itemId,voteVersion=this.voteWriteVersion,labelAText=this.labelA||this.localize("compareResponseA"),labelBText=this.labelB||this.localize("compareResponseB"),label=choice==="a"?labelAText:choice==="b"?labelBText:choice==="tie"?this.localize("compareVoteTie"):this.localize("compareVoteBothBad");if(this.emitVoteRequest({choice,itemId}).defaultPrevented||this.disabled||this.itemId===itemId&&this.voteWriteVersion!==voteVersion)return;this.itemId===itemId&&(this.vote=choice),this.liveRegion?.announce(this.localize("compareVoteRecorded",void 0,{label}),{force:!0})}finally{this.voteDispatching=!1}}}voteButton(choice,label){return!Array.isArray(this.allowedVotes)||!this.allowedVotes.includes(choice)?nothing:html`<button
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./compare-panel.styles.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{collectInitialSlotAssignment}from"../../../internal/initial-slot-collection.js";import{LYRA_DEFAULT_compareResponseA,LYRA_DEFAULT_compareResponseB,LYRA_DEFAULT_compareVoteBetter,LYRA_DEFAULT_compareVoteBothBad,LYRA_DEFAULT_compareVoteLabel,LYRA_DEFAULT_compareVoteRecorded,LYRA_DEFAULT_compareVoteTie}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_comparePanel}from"../../../internal/default-strings/shared.generated.js";class LyraComparePanel extends LyraElement{constructor(){super(...arguments),this.hasPromptSlot=!1,this._labelA="",this._labelB="",this._vote=null,this._itemId="",this._syncScroll=!1,this._disabled=!1,this.pendingScrollReset=!1,this.suppressSync=!1,this.ownerRealmGeneration=0,this.voteAssignedInCommit=!1,this.voteWriteVersion=0,this.allowedVotes=["a","b","tie","both-bad"],this.onPromptSlotChange=e=>{this.collectPromptSlotContent(e.target)},this.voteDispatching=!1,this.onPaneScroll=source=>()=>{if(!this.syncScroll||this.suppressSync)return;const from=source==="a"?this.paneAEl:this.paneBEl,to=source==="a"?this.paneBEl:this.paneAEl;if(!from||!to)return;const fromMax=from.scrollHeight-from.clientHeight,toMax=to.scrollHeight-to.clientHeight;if(fromMax<=0)return;const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow||!this.isConnected)return;const fraction=from.scrollTop/fromMax;this.suppressSync=!0,to.scrollTop=fraction*toMax;const generation=this.ownerRealmGeneration,handle=ownerWindow.requestAnimationFrame(()=>{this.syncScrollRafId!==handle||this.syncScrollRafOwner!==ownerWindow||this.syncScrollRafDocument!==ownerDocument||this.ownerRealmGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.syncScrollRafId=void 0,this.syncScrollRafOwner=void 0,this.syncScrollRafDocument=void 0,this.suppressSync=!1)});this.syncScrollRafId=handle,this.syncScrollRafOwner=ownerWindow,this.syncScrollRafDocument=ownerDocument}}static{this.defaultStrings={...super.defaultStrings,comparePanel:LYRA_DEFAULT_comparePanel,compareResponseA:LYRA_DEFAULT_compareResponseA,compareResponseB:LYRA_DEFAULT_compareResponseB,compareVoteBetter:LYRA_DEFAULT_compareVoteBetter,compareVoteBothBad:LYRA_DEFAULT_compareVoteBothBad,compareVoteLabel:LYRA_DEFAULT_compareVoteLabel,compareVoteRecorded:LYRA_DEFAULT_compareVoteRecorded,compareVoteTie:LYRA_DEFAULT_compareVoteTie}}emitVoteRequest(detail){return this.emit("lr-vote-request",Object.freeze(detail),{cancelable:!0})}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["allowedVotes"])}static{this.styles=[LyraElement.styles,styles]}static{this.properties={labelA:{attribute:"label-a",noAccessor:!0},labelB:{attribute:"label-b",noAccessor:!0},vote:{reflect:!0,noAccessor:!0},itemId:{attribute:"item-id",noAccessor:!0},syncScroll:{type:Boolean,attribute:"sync-scroll",noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0}}}get labelA(){return this._labelA}set labelA(next){const old=this._labelA;this._labelA=next??"",this.requestUpdate("labelA",old)}get labelB(){return this._labelB}set labelB(next){const old=this._labelB;this._labelB=next??"",this.requestUpdate("labelB",old)}get vote(){return this._vote}set vote(next){this.voteWriteVersion++,this.voteAssignedInCommit=!0;const old=this._vote;this._vote=next??null,this._vote?this.setAttribute("vote",this._vote):this.removeAttribute("vote"),this.requestUpdate("vote",old)}get itemId(){return this._itemId}set itemId(next){const old=this._itemId;this._itemId=next??"",old!==this._itemId&&(this.pendingScrollReset=!0),this.requestUpdate("itemId",old)}get syncScroll(){return this._syncScroll}set syncScroll(next){const old=this._syncScroll;this._syncScroll=!!next,this.requestUpdate("syncScroll",old)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.requestUpdate("disabled",old)}collectPromptSlotContent(slot){this.hasPromptSlot=slot.assignedNodes({flatten:!0}).length>0}disconnectedCallback(){this.resetScrollSyncFrame(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetScrollSyncFrame()}resetScrollSyncFrame(){this.ownerRealmGeneration+=1,this.syncScrollRafId!==void 0&&this.syncScrollRafOwner?.cancelAnimationFrame(this.syncScrollRafId),this.syncScrollRafId=void 0,this.syncScrollRafOwner=void 0,this.syncScrollRafDocument=void 0,this.suppressSync=!1}castVote(choice){if(!this.voteDispatching){this.voteDispatching=!0;try{if(this.disabled)return;const itemId=this.itemId,voteVersion=this.voteWriteVersion,labelAText=this.labelA||this.localize("compareResponseA"),labelBText=this.labelB||this.localize("compareResponseB"),label=choice==="a"?labelAText:choice==="b"?labelBText:choice==="tie"?this.localize("compareVoteTie"):this.localize("compareVoteBothBad");if(this.emitVoteRequest({choice,itemId}).defaultPrevented||this.disabled||this.itemId===itemId&&this.voteWriteVersion!==voteVersion)return;this.itemId===itemId&&(this.vote=choice),this.liveRegion?.announce(this.localize("compareVoteRecorded",void 0,{label}),{force:!0})}finally{this.voteDispatching=!1}}}voteButton(choice,label){return!Array.isArray(this.allowedVotes)||!this.allowedVotes.includes(choice)?nothing:html`<button
2
2
  part="vote-button"
3
3
  type="button"
4
4
  ?disabled=${this.disabled}
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{html,nothing,svg}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{renderApproveAction,renderDenyAction}from"../approval-action-buttons.js";import{hasRealContent,hostAriaLabel,nextId}from"../../../internal/a11y.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{deferComposedFocusRepair,focusFirstAvailable,isComposedFocusAvailable,repairComposedFocus}from"../../../internal/focus-navigation.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{resolveLocalizedParts}from"../../../internal/localization-runtime.js";import{optionalLiteralSetConverter}from"../../../internal/converters.js";import"../../layout/details/details.class.js";import"../../utility/json-viewer/json-viewer.class.js";import"../../utility/live-region/live-region.class.js";import"../../forms/button/button.class.js";import{styles}from"./confirm-bar.styles.js";import{approvalAction}from"../approval-state.js";import{createWaitUntil}from"../../../internal/approval-wait-until.js";import{LYRA_DEFAULT_approve,LYRA_DEFAULT_collapse,LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmApprovedAnnounce,LYRA_DEFAULT_confirmDenied,LYRA_DEFAULT_confirmDeniedAnnounce,LYRA_DEFAULT_date,LYRA_DEFAULT_deny,LYRA_DEFAULT_details,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_progress,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_toolApprovalArgsLabel,LYRA_DEFAULT_toolApprovalGenericTool,LYRA_DEFAULT_toolApprovalHeading,LYRA_DEFAULT_viewerSearchActiveMatch,LYRA_DEFAULT_viewerSearchMatchCount,LYRA_DEFAULT_viewerSearchNoMatches}from"../../../internal/default-strings.generated.js";const CONFIRM_BAR_DECISION=optionalLiteralSetConverter(["approved","denied"]),CONFIRM_BAR_PENDING_ACTION=optionalLiteralSetConverter(["approve","deny"]),ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function approvedIcon(){return svg`
1
+ import{__decorate}from"tslib";import{html,nothing,svg}from"lit";import{property,query,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{renderApproveAction,renderDenyAction}from"../approval-action-buttons.js";import{hasRealContent,hostAriaLabel,nextId}from"../../../internal/a11y.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{deferComposedFocusRepair,focusFirstAvailable,isComposedFocusAvailable,repairComposedFocus}from"../../../internal/focus-navigation.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{resolveLocalizedParts}from"../../../internal/localization-runtime.js";import{optionalLiteralSetConverter}from"../../../internal/converters.js";import"../../layout/details/details.class.js";import"../../utility/json-viewer/json-viewer.class.js";import"../../utility/live-region/live-region.class.js";import"../../forms/button/button.class.js";import{styles}from"./confirm-bar.styles.js";import{approvalAction}from"../approval-state.js";import{createWaitUntil}from"../../../internal/approval-wait-until.js";import{LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmApprovedAnnounce,LYRA_DEFAULT_confirmDenied,LYRA_DEFAULT_confirmDeniedAnnounce,LYRA_DEFAULT_toolApprovalArgsLabel,LYRA_DEFAULT_toolApprovalGenericTool,LYRA_DEFAULT_toolApprovalHeading}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_approve,LYRA_DEFAULT_collapse,LYRA_DEFAULT_date,LYRA_DEFAULT_deny,LYRA_DEFAULT_details,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_progress,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_viewerSearchActiveMatch,LYRA_DEFAULT_viewerSearchMatchCount,LYRA_DEFAULT_viewerSearchNoMatches}from"../../../internal/default-strings/shared.generated.js";const CONFIRM_BAR_DECISION=optionalLiteralSetConverter(["approved","denied"]),CONFIRM_BAR_PENDING_ACTION=optionalLiteralSetConverter(["approve","deny"]),ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function approvedIcon(){return svg`
2
2
  <svg width="1em" height="1em" viewBox=${ICON_VIEW_BOX} fill="none" stroke="currentColor" stroke-width=${ICON_STROKE_WIDTH} stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
3
3
  <circle cx="12" cy="12" r="9"></circle>
4
4
  <polyline points="8 12.5 11 15.5 16 9.5"></polyline>
@@ -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{acquireAnnouncementSink}from"../../../internal/announcer.js";import{styles}from"./connector-manager.styles.js";import"../../forms/button/button.class.js";import{firstByIdentity}from"../collection-identity.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_connectorManagerConnect,LYRA_DEFAULT_connectorManagerConnectFor,LYRA_DEFAULT_connectorManagerDisconnect,LYRA_DEFAULT_connectorManagerDisconnectFor,LYRA_DEFAULT_connectorManagerEmpty,LYRA_DEFAULT_connectorManagerKindConnector,LYRA_DEFAULT_connectorManagerKindMcp,LYRA_DEFAULT_connectorManagerLabel,LYRA_DEFAULT_connectorManagerLimit,LYRA_DEFAULT_connectorManagerRetryFor,LYRA_DEFAULT_connectorManagerStatusConnected,LYRA_DEFAULT_connectorManagerStatusConnecting,LYRA_DEFAULT_connectorManagerStatusDisconnected,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_progress,LYRA_DEFAULT_retry,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError}from"../../../internal/default-strings.generated.js";const MAX_RENDERED_CONNECTORS=100,KINDS=["mcp","connector"],STATUSES=["disconnected","connecting","connected","error"],KIND_LABEL_KEY={mcp:"connectorManagerKindMcp",connector:"connectorManagerKindConnector"},STATUS_LABEL_KEY={disconnected:"connectorManagerStatusDisconnected",connecting:"connectorManagerStatusConnecting",connected:"connectorManagerStatusConnected",error:"statusError"},ACTION_LABEL_KEY={connect:"connectorManagerConnect",disconnect:"connectorManagerDisconnect",retry:"retry"},ACTION_ACCESSIBLE_LABEL_KEY={connect:"connectorManagerConnectFor",disconnect:"connectorManagerDisconnectFor",retry:"connectorManagerRetryFor"};class LyraConnectorManager extends LyraElement{constructor(){super(...arguments),this.connectors=[],this.disabled=!1,this.dispatchingAction=!1,this.actedConnectorId=null,this.pendingAnnouncement="",this.focusedRowId=null}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,connectorManagerConnect:LYRA_DEFAULT_connectorManagerConnect,connectorManagerConnectFor:LYRA_DEFAULT_connectorManagerConnectFor,connectorManagerDisconnect:LYRA_DEFAULT_connectorManagerDisconnect,connectorManagerDisconnectFor:LYRA_DEFAULT_connectorManagerDisconnectFor,connectorManagerEmpty:LYRA_DEFAULT_connectorManagerEmpty,connectorManagerKindConnector:LYRA_DEFAULT_connectorManagerKindConnector,connectorManagerKindMcp:LYRA_DEFAULT_connectorManagerKindMcp,connectorManagerLabel:LYRA_DEFAULT_connectorManagerLabel,connectorManagerLimit:LYRA_DEFAULT_connectorManagerLimit,connectorManagerRetryFor:LYRA_DEFAULT_connectorManagerRetryFor,connectorManagerStatusConnected:LYRA_DEFAULT_connectorManagerStatusConnected,connectorManagerStatusConnecting:LYRA_DEFAULT_connectorManagerStatusConnecting,connectorManagerStatusDisconnected:LYRA_DEFAULT_connectorManagerStatusDisconnected,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,progress:LYRA_DEFAULT_progress,retry:LYRA_DEFAULT_retry,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["connectors"])}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.sink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this})}disconnectedCallback(){super.disconnectedCallback(),this.sink?.release(),this.sink=void 0,this.actedConnectorId=null,this.pendingAnnouncement=""}rowPart(connectorId,part){for(const row of this.renderRoot.querySelectorAll('[part~="connector"]'))if(row.dataset.connectorId===connectorId)return row.querySelector(`[part~="${part}"]`);return null}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated||!changed.has("connectors"))return;this.focusedRowId=shadowFocusTarget(this)?.closest('[part~="connector"]')?.dataset.connectorId??null;const acted=this.actedConnectorId;if(acted===null)return;const previous=this.normalizedConnectorsFrom(changed.get("connectors")).find(item=>item.id===acted),current=this.normalizedConnectors.find(item=>item.id===acted);current?(previous?.status!==current.status||previous.error!==current.error)&&(this.pendingAnnouncement=current.status==="error"&&current.error?current.error:this.localize(STATUS_LABEL_KEY[current.status]),current.status!=="connecting"&&(this.actedConnectorId=null)):this.actedConnectorId=null}updated(changed){super.updated(changed);const id=this.focusedRowId;if(this.focusedRowId=null,id!==null){const status=this.rowPart(id,"status"),active=shadowFocusTarget(this),action=this.rowPart(id,"action");if(!active||active===status){const target=action&&!action.disabled?action:status,moveFocus=()=>{const current=shadowFocusTarget(this);this.isConnected&&(!current||current===status)&&target?.focus()};target===action&&action?.updateComplete?action.updateComplete.then(moveFocus):moveFocus()}}this.pendingAnnouncement&&(this.sink?.announce(this.pendingAnnouncement),this.pendingAnnouncement="")}get normalizedConnectors(){return this.normalizedConnectorsFrom(this.connectors)}normalizedConnectorsFrom(source){const valid=(Array.isArray(source)?source:[]).filter(connector=>{try{return!!(connector&&typeof connector.name=="string"&&KINDS.includes(connector.kind)&&STATUSES.includes(connector.status))}catch{return!1}});return firstByIdentity(valid,connector=>connector.id)}actionFor(connector){return connector.status==="disconnected"?"connect":connector.status==="connected"?"disconnect":connector.status==="error"?"retry":null}requestAction(connector,action){const current=this.normalizedConnectors.find(item=>item.id===connector.id);if(!(this.disabled||!current||this.actionFor(current)!==action||this.dispatchingAction)){this.dispatchingAction=!0,this.actedConnectorId=current.id;try{this.emit("lr-connector-action",{connectorId:current.id,action})}finally{this.dispatchingAction=!1}}}renderConnector(connector){const action=this.actionFor(connector);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{acquireAnnouncementSink}from"../../../internal/announcer.js";import{styles}from"./connector-manager.styles.js";import"../../forms/button/button.class.js";import{firstByIdentity}from"../collection-identity.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{LYRA_DEFAULT_connectorManagerConnect,LYRA_DEFAULT_connectorManagerConnectFor,LYRA_DEFAULT_connectorManagerDisconnect,LYRA_DEFAULT_connectorManagerDisconnectFor,LYRA_DEFAULT_connectorManagerEmpty,LYRA_DEFAULT_connectorManagerKindConnector,LYRA_DEFAULT_connectorManagerKindMcp,LYRA_DEFAULT_connectorManagerLabel,LYRA_DEFAULT_connectorManagerLimit,LYRA_DEFAULT_connectorManagerRetryFor,LYRA_DEFAULT_connectorManagerStatusConnected,LYRA_DEFAULT_connectorManagerStatusConnecting,LYRA_DEFAULT_connectorManagerStatusDisconnected}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_progress,LYRA_DEFAULT_retry,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError}from"../../../internal/default-strings/shared.generated.js";const MAX_RENDERED_CONNECTORS=100,KINDS=["mcp","connector"],STATUSES=["disconnected","connecting","connected","error"],KIND_LABEL_KEY={mcp:"connectorManagerKindMcp",connector:"connectorManagerKindConnector"},STATUS_LABEL_KEY={disconnected:"connectorManagerStatusDisconnected",connecting:"connectorManagerStatusConnecting",connected:"connectorManagerStatusConnected",error:"statusError"},ACTION_LABEL_KEY={connect:"connectorManagerConnect",disconnect:"connectorManagerDisconnect",retry:"retry"},ACTION_ACCESSIBLE_LABEL_KEY={connect:"connectorManagerConnectFor",disconnect:"connectorManagerDisconnectFor",retry:"connectorManagerRetryFor"};class LyraConnectorManager extends LyraElement{constructor(){super(...arguments),this.connectors=[],this.disabled=!1,this.dispatchingAction=!1,this.actedConnectorId=null,this.pendingAnnouncement="",this.focusedRowId=null}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,connectorManagerConnect:LYRA_DEFAULT_connectorManagerConnect,connectorManagerConnectFor:LYRA_DEFAULT_connectorManagerConnectFor,connectorManagerDisconnect:LYRA_DEFAULT_connectorManagerDisconnect,connectorManagerDisconnectFor:LYRA_DEFAULT_connectorManagerDisconnectFor,connectorManagerEmpty:LYRA_DEFAULT_connectorManagerEmpty,connectorManagerKindConnector:LYRA_DEFAULT_connectorManagerKindConnector,connectorManagerKindMcp:LYRA_DEFAULT_connectorManagerKindMcp,connectorManagerLabel:LYRA_DEFAULT_connectorManagerLabel,connectorManagerLimit:LYRA_DEFAULT_connectorManagerLimit,connectorManagerRetryFor:LYRA_DEFAULT_connectorManagerRetryFor,connectorManagerStatusConnected:LYRA_DEFAULT_connectorManagerStatusConnected,connectorManagerStatusConnecting:LYRA_DEFAULT_connectorManagerStatusConnecting,connectorManagerStatusDisconnected:LYRA_DEFAULT_connectorManagerStatusDisconnected,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,progress:LYRA_DEFAULT_progress,retry:LYRA_DEFAULT_retry,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["connectors"])}static{this.styles=[LyraElement.styles,styles]}connectedCallback(){super.connectedCallback(),this.sink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this})}disconnectedCallback(){super.disconnectedCallback(),this.sink?.release(),this.sink=void 0,this.actedConnectorId=null,this.pendingAnnouncement=""}rowPart(connectorId,part){for(const row of this.renderRoot.querySelectorAll('[part~="connector"]'))if(row.dataset.connectorId===connectorId)return row.querySelector(`[part~="${part}"]`);return null}willUpdate(changed){if(super.willUpdate(changed),!this.hasUpdated||!changed.has("connectors"))return;this.focusedRowId=shadowFocusTarget(this)?.closest('[part~="connector"]')?.dataset.connectorId??null;const acted=this.actedConnectorId;if(acted===null)return;const previous=this.normalizedConnectorsFrom(changed.get("connectors")).find(item=>item.id===acted),current=this.normalizedConnectors.find(item=>item.id===acted);current?(previous?.status!==current.status||previous.error!==current.error)&&(this.pendingAnnouncement=current.status==="error"&&current.error?current.error:this.localize(STATUS_LABEL_KEY[current.status]),current.status!=="connecting"&&(this.actedConnectorId=null)):this.actedConnectorId=null}updated(changed){super.updated(changed);const id=this.focusedRowId;if(this.focusedRowId=null,id!==null){const status=this.rowPart(id,"status"),active=shadowFocusTarget(this),action=this.rowPart(id,"action");if(!active||active===status){const target=action&&!action.disabled?action:status,moveFocus=()=>{const current=shadowFocusTarget(this);this.isConnected&&(!current||current===status)&&target?.focus()};target===action&&action?.updateComplete?action.updateComplete.then(moveFocus):moveFocus()}}this.pendingAnnouncement&&(this.sink?.announce(this.pendingAnnouncement),this.pendingAnnouncement="")}get normalizedConnectors(){return this.normalizedConnectorsFrom(this.connectors)}normalizedConnectorsFrom(source){const valid=(Array.isArray(source)?source:[]).filter(connector=>{try{return!!(connector&&typeof connector.name=="string"&&KINDS.includes(connector.kind)&&STATUSES.includes(connector.status))}catch{return!1}});return firstByIdentity(valid,connector=>connector.id)}actionFor(connector){return connector.status==="disconnected"?"connect":connector.status==="connected"?"disconnect":connector.status==="error"?"retry":null}requestAction(connector,action){const current=this.normalizedConnectors.find(item=>item.id===connector.id);if(!(this.disabled||!current||this.actionFor(current)!==action||this.dispatchingAction)){this.dispatchingAction=!0,this.actedConnectorId=current.id;try{this.emit("lr-connector-action",{connectorId:current.id,action})}finally{this.dispatchingAction=!1}}}renderConnector(connector){const action=this.actionFor(connector);return html`
2
2
  <div part="connector" role="listitem" data-connector-id=${connector.id}>
3
3
  <div part="connector-copy">
4
4
  <span part="name">${connector.name}</span>
@@ -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{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import"../../data/context-meter/context-meter.class.js";import"../../utility/copy-button/copy-button.class.js";import"../../utility/export-button/export-button.class.js";import"../../retrieval/citation-badge/citation-badge.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./context-inspector.styles.js";import{firstByIdentity}from"../collection-identity.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_contextInspectorCopyLabel,LYRA_DEFAULT_contextInspectorEmpty,LYRA_DEFAULT_contextInspectorLabel,LYRA_DEFAULT_contextInspectorLimit,LYRA_DEFAULT_contextInspectorRedacted,LYRA_DEFAULT_contextInspectorSegmentTokens,LYRA_DEFAULT_contextInspectorTruncated,LYRA_DEFAULT_contextInspectorTruncatedCount,LYRA_DEFAULT_copy,LYRA_DEFAULT_details,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";function normalizeRedactions(redactions,length){if(!Array.isArray(redactions)||redactions.length===0)return[];const clamped=redactions.filter(r=>r!==null&&typeof r=="object").map(r=>({start:finiteCount(Math.min(r.start,r.end),0,length),end:finiteCount(Math.max(r.start,r.end),0,length),reason:r.reason})).filter(r=>r.end>r.start).sort((a,b)=>a.start-b.start),merged=[];for(const r of clamped){const prev=merged[merged.length-1];if(prev&&r.start<prev.end){prev.end=Math.max(prev.end,r.end);continue}merged.push({...r})}return merged}function formatCount(n,locale){return getNumberFormat(locale,{maximumFractionDigits:0}).format(finiteCount(n))}const MAX_RENDERED_SEGMENTS=500;class LyraContextInspector extends LyraElement{constructor(){super(...arguments),this.segments=[],this.total=0,this.exportFormats=["json"],this.exportFilename="context",this.normalizedCache=[]}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,contextInspectorCopyLabel:LYRA_DEFAULT_contextInspectorCopyLabel,contextInspectorEmpty:LYRA_DEFAULT_contextInspectorEmpty,contextInspectorLabel:LYRA_DEFAULT_contextInspectorLabel,contextInspectorLimit:LYRA_DEFAULT_contextInspectorLimit,contextInspectorRedacted:LYRA_DEFAULT_contextInspectorRedacted,contextInspectorSegmentTokens:LYRA_DEFAULT_contextInspectorSegmentTokens,contextInspectorTruncated:LYRA_DEFAULT_contextInspectorTruncated,contextInspectorTruncatedCount:LYRA_DEFAULT_contextInspectorTruncatedCount,copy:LYRA_DEFAULT_copy,details:LYRA_DEFAULT_details,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["segments","exportFormats"])}static{this.styles=[LyraElement.styles,styles]}get normalizedSegments(){return this.normalizedFor!==this.segments&&(this.normalizedFor=this.segments,this.normalizedCache=firstByIdentity(Array.isArray(this.segments)?this.segments:[],segment=>segment.id).map(segment=>({...segment,text:typeof segment.text=="string"?segment.text:""}))),this.normalizedCache}get derivedViews(){const source=this.normalizedSegments;return this.derived?.source!==source&&(this.derived={source,meter:source.map(s=>({label:s.label,value:s.tokens,...s.tone?{tone:s.tone}:{}})),text:source.map(s=>`${s.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{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import"../../data/context-meter/context-meter.class.js";import"../../utility/copy-button/copy-button.class.js";import"../../utility/export-button/export-button.class.js";import"../../retrieval/citation-badge/citation-badge.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./context-inspector.styles.js";import{firstByIdentity}from"../collection-identity.js";import{overallSemanticLabel,overallSemanticRole}from"../semantic-owner.js";import{LYRA_DEFAULT_contextInspectorCopyLabel,LYRA_DEFAULT_contextInspectorEmpty,LYRA_DEFAULT_contextInspectorLabel,LYRA_DEFAULT_contextInspectorLimit,LYRA_DEFAULT_contextInspectorRedacted,LYRA_DEFAULT_contextInspectorSegmentTokens,LYRA_DEFAULT_contextInspectorTruncated,LYRA_DEFAULT_contextInspectorTruncatedCount}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings/shared.generated.js";function normalizeRedactions(redactions,length){if(!Array.isArray(redactions)||redactions.length===0)return[];const clamped=redactions.filter(r=>r!==null&&typeof r=="object").map(r=>({start:finiteCount(Math.min(r.start,r.end),0,length),end:finiteCount(Math.max(r.start,r.end),0,length),reason:r.reason})).filter(r=>r.end>r.start).sort((a,b)=>a.start-b.start),merged=[];for(const r of clamped){const prev=merged[merged.length-1];if(prev&&r.start<prev.end){prev.end=Math.max(prev.end,r.end);continue}merged.push({...r})}return merged}function formatCount(n,locale){return getNumberFormat(locale,{maximumFractionDigits:0}).format(finiteCount(n))}const MAX_RENDERED_SEGMENTS=500;class LyraContextInspector extends LyraElement{constructor(){super(...arguments),this.segments=[],this.total=0,this.exportFormats=["json"],this.exportFilename="context",this.normalizedCache=[]}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,contextInspectorCopyLabel:LYRA_DEFAULT_contextInspectorCopyLabel,contextInspectorEmpty:LYRA_DEFAULT_contextInspectorEmpty,contextInspectorLabel:LYRA_DEFAULT_contextInspectorLabel,contextInspectorLimit:LYRA_DEFAULT_contextInspectorLimit,contextInspectorRedacted:LYRA_DEFAULT_contextInspectorRedacted,contextInspectorSegmentTokens:LYRA_DEFAULT_contextInspectorSegmentTokens,contextInspectorTruncated:LYRA_DEFAULT_contextInspectorTruncated,contextInspectorTruncatedCount:LYRA_DEFAULT_contextInspectorTruncatedCount,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["segments","exportFormats"])}static{this.styles=[LyraElement.styles,styles]}get normalizedSegments(){return this.normalizedFor!==this.segments&&(this.normalizedFor=this.segments,this.normalizedCache=firstByIdentity(Array.isArray(this.segments)?this.segments:[],segment=>segment.id).map(segment=>({...segment,text:typeof segment.text=="string"?segment.text:""}))),this.normalizedCache}get derivedViews(){const source=this.normalizedSegments;return this.derived?.source!==source&&(this.derived={source,meter:source.map(s=>({label:s.label,value:s.tokens,...s.tone?{tone:s.tone}:{}})),text:source.map(s=>`${s.label}
2
2
  ${s.text}`).join(`
3
3
 
4
4
  `),rows:source.map(s=>({id:s.id,label:s.label,tokens:s.tokens,truncated:!!s.truncated,omittedTokens:s.omittedTokens??null,sourceId:s.citation?.sourceId??null,redactionCount:s.redactions?.length??0,text:s.text}))}),this.derived}get safeTotal(){return finiteCount(this.total)}renderSegmentText(segment){const text=segment.text,redactions=normalizeRedactions(segment.redactions,text.length);if(redactions.length===0)return html`${text}`;const nodes=[];let cursor=0;for(const r of redactions)r.start>cursor&&nodes.push(text.slice(cursor,r.start)),nodes.push(html`<mark part="redaction" title=${r.reason||this.localize("contextInspectorRedacted")}
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import"../../forms/input/input.class.js";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getCollator,getNumberFormat}from"../../../internal/intl-cache.js";import{trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{styles}from"./eval-dataset.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{firstByIdentity}from"../collection-identity.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{LYRA_DEFAULT_evalDatasetAddExample,LYRA_DEFAULT_evalDatasetColumnExpectedOutput,LYRA_DEFAULT_evalDatasetColumnInput,LYRA_DEFAULT_evalDatasetColumnTags,LYRA_DEFAULT_evalDatasetEmpty,LYRA_DEFAULT_evalDatasetImportLabel,LYRA_DEFAULT_evalDatasetLabel,LYRA_DEFAULT_evalDatasetLimit,LYRA_DEFAULT_evalDatasetNoMatches,LYRA_DEFAULT_evalDatasetRemoveExample,LYRA_DEFAULT_evalDatasetSearchLabel,LYRA_DEFAULT_evalDatasetTagFilterLabel,LYRA_DEFAULT_fieldRequired}from"../../../internal/default-strings.generated.js";const MAX_RENDERED_EXAMPLES=100,rowKey=row=>row.id;class LyraEvalDataset extends LyraElement{constructor(){super(...arguments),this.limitAnnouncements=new AnnouncementSinkController(this,{eager:["polite"]}),this.limitAnnouncementInitialized=!1,this.previouslyTruncated=!1,this.examplesTruncated=!1,this.examples=[],this.searchable=!1,this.autocomplete="",this.spellcheck=!0,this.autocapitalize="",this.autoCorrect="",this.inputMode="",this.enterKeyHint="",this.accept="",this.exportFormats=["csv","json"],this.disabled=!1,this.label="",this.searchText="",this.activeTags=new Set,this.selectedId=null,this.normalizedCache=[],this.visibleExamples=[],this.onAddClick=()=>{this.disabled||this.emit("lr-example-add-request")},this.onRemoveClick=()=>{this.disabled||this.selectedId===null||this.emit("lr-example-remove-request",{exampleId:this.selectedId})},this.onGridRowActivate=e=>{if(e.stopPropagation(),this.disabled)return;const id=e.detail.row.id;this.selectedId=id,this.emit("lr-example-select",{exampleId:id})},this.onFiles=e=>{e.stopPropagation(),!(this.disabled||e.detail.files.length===0)&&this.emit("lr-import-request",{files:[...e.detail.files]})},this.onExportButtonExport=e=>{e.preventDefault(),e.stopPropagation(),!this.disabled&&this.emit("lr-export-request",{format:e.detail.format})},this.gateDisabledClear={handleEvent:event=>{this.disabled&&event.stopPropagation()},capture:!0}}static{this.defaultStrings={...super.defaultStrings,evalDatasetAddExample:LYRA_DEFAULT_evalDatasetAddExample,evalDatasetColumnExpectedOutput:LYRA_DEFAULT_evalDatasetColumnExpectedOutput,evalDatasetColumnInput:LYRA_DEFAULT_evalDatasetColumnInput,evalDatasetColumnTags:LYRA_DEFAULT_evalDatasetColumnTags,evalDatasetEmpty:LYRA_DEFAULT_evalDatasetEmpty,evalDatasetImportLabel:LYRA_DEFAULT_evalDatasetImportLabel,evalDatasetLabel:LYRA_DEFAULT_evalDatasetLabel,evalDatasetLimit:LYRA_DEFAULT_evalDatasetLimit,evalDatasetNoMatches:LYRA_DEFAULT_evalDatasetNoMatches,evalDatasetRemoveExample:LYRA_DEFAULT_evalDatasetRemoveExample,evalDatasetSearchLabel:LYRA_DEFAULT_evalDatasetSearchLabel,evalDatasetTagFilterLabel:LYRA_DEFAULT_evalDatasetTagFilterLabel,fieldRequired:LYRA_DEFAULT_fieldRequired}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["examples","exportFormats"])}static{this.identityCollectionProperties=Object.freeze(["examples"])}static{this.styles=[LyraElement.styles,styles,agentActionButtonStyles]}adoptedCallback(){super.adoptedCallback(),this.limitAnnouncements.adopted()}updated(changed){if(super.updated(changed),this.limitAnnouncementInitialized&&this.examplesTruncated&&!this.previouslyTruncated){const truncation=publicCollectionTruncation(this,"examples");truncation&&this.limitAnnouncements.announcePolite(this.localize("evalDatasetLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(truncation.retained)}))}this.limitAnnouncementInitialized=!0,this.previouslyTruncated=this.examplesTruncated}static{this.immutableEventDetails=Object.freeze(["lr-import-request"])}get normalizedExamples(){if(this.normalizedFor!==this.examples){this.normalizedFor=this.examples;const deduped=firstByIdentity(Array.isArray(this.examples)?this.examples:[],example=>example.id);this.normalizedCache=deduped.map(example=>Array.isArray(example.tags)?example:{...example,tags:void 0})}return this.normalizedCache}willUpdate(changed){if(super.willUpdate(changed),changed.has("searchable")&&!this.searchable&&(this.searchText=""),changed.has("examples")){this.selectedId!==null&&!this.normalizedExamples.some(example=>example.id===this.selectedId)&&this.clearSelection();const available=this.allTags();[...this.activeTags].some(tag=>!available.includes(tag))&&(this.activeTags=new Set([...this.activeTags].filter(tag=>available.includes(tag))))}this.visibleExamples=this.filterExamples(),(changed.has("examples")||changed.has("searchText")||changed.has("activeTags")||changed.has("searchable"))&&this.selectedId!==null&&!this.visibleExamples.some(example=>example.id===this.selectedId)&&this.clearSelection()}clearSelection(){this.selectedId=null,this.emit("lr-example-select",{exampleId:null})}allTags(){const tags=new Set;for(const example of this.normalizedExamples)for(const tag of example.tags??[])tags.add(tag);return[...tags].sort(getCollator(this.effectiveLocale).compare)}filterExamples(){const query=this.searchText.trim().toLocaleLowerCase(this.effectiveLocale);return this.normalizedExamples.filter(example=>this.activeTags.size>0&&!(example.tags??[]).some(tag=>this.activeTags.has(tag))?!1:query===""?!0:[example.input,example.expectedOutput??"",...example.tags??[]].join(" ").toLocaleLowerCase(this.effectiveLocale).includes(query))}buildColumns(){const labels=[this.localize("evalDatasetColumnInput"),this.localize("evalDatasetColumnExpectedOutput"),this.localize("evalDatasetColumnTags")],key=labels.join("\0");return this.columnsCache?.key!==key&&(this.columnsCache={key,columns:this.createColumns(labels)}),this.columnsCache.columns}selectedKeys(){return this.selectedKeysCache?.id!==this.selectedId&&(this.selectedKeysCache={id:this.selectedId,keys:this.selectedId===null?new Set:new Set([this.selectedId])}),this.selectedKeysCache.keys}createColumns([inputLabel,expectedLabel,tagsLabel]){return[{key:"input",label:inputLabel,sortable:!0,sortValue:row=>row.input,cell:row=>row.input},{key:"expectedOutput",label:expectedLabel,sortable:!0,sortValue:row=>row.expectedOutput??"",cell:row=>row.expectedOutput??""},{key:"tags",label:tagsLabel,sortable:!0,sortValue:row=>(row.tags??[]).join(", "),cell:row=>(row.tags??[]).join(", ")}]}onTagChipToggle(tag,e){if(e.stopPropagation(),this.disabled)return;const next=new Set(this.activeTags);e.detail.selected?next.add(tag):next.delete(tag),this.activeTags=next}stopOwnedEvent(event){event.stopPropagation()}renderToolbar(){return html`
1
+ import{__decorate}from"tslib";import{relayNativeEvent}from"../../../internal/native-event-relay.js";import"../../forms/input/input.class.js";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getCollator,getNumberFormat}from"../../../internal/intl-cache.js";import{trueDefaultSpellcheckConverter as spellcheckConverter}from"../../../internal/converters.js";import{styles}from"./eval-dataset.styles.js";import{agentActionButtonStyles}from"../agent-action-button.styles.js";import{firstByIdentity}from"../collection-identity.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{LYRA_DEFAULT_evalDatasetAddExample,LYRA_DEFAULT_evalDatasetColumnExpectedOutput,LYRA_DEFAULT_evalDatasetColumnInput,LYRA_DEFAULT_evalDatasetColumnTags,LYRA_DEFAULT_evalDatasetEmpty,LYRA_DEFAULT_evalDatasetImportLabel,LYRA_DEFAULT_evalDatasetLabel,LYRA_DEFAULT_evalDatasetLimit,LYRA_DEFAULT_evalDatasetNoMatches,LYRA_DEFAULT_evalDatasetRemoveExample,LYRA_DEFAULT_evalDatasetSearchLabel,LYRA_DEFAULT_evalDatasetTagFilterLabel}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_fieldRequired}from"../../../internal/default-strings/shared.generated.js";const MAX_RENDERED_EXAMPLES=100,rowKey=row=>row.id;class LyraEvalDataset extends LyraElement{constructor(){super(...arguments),this.limitAnnouncements=new AnnouncementSinkController(this,{eager:["polite"]}),this.limitAnnouncementInitialized=!1,this.previouslyTruncated=!1,this.examplesTruncated=!1,this.examples=[],this.searchable=!1,this.autocomplete="",this.spellcheck=!0,this.autocapitalize="",this.autoCorrect="",this.inputMode="",this.enterKeyHint="",this.accept="",this.exportFormats=["csv","json"],this.disabled=!1,this.label="",this.searchText="",this.activeTags=new Set,this.selectedId=null,this.normalizedCache=[],this.visibleExamples=[],this.onAddClick=()=>{this.disabled||this.emit("lr-example-add-request")},this.onRemoveClick=()=>{this.disabled||this.selectedId===null||this.emit("lr-example-remove-request",{exampleId:this.selectedId})},this.onGridRowActivate=e=>{if(e.stopPropagation(),this.disabled)return;const id=e.detail.row.id;this.selectedId=id,this.emit("lr-example-select",{exampleId:id})},this.onFiles=e=>{e.stopPropagation(),!(this.disabled||e.detail.files.length===0)&&this.emit("lr-import-request",{files:[...e.detail.files]})},this.onExportButtonExport=e=>{e.preventDefault(),e.stopPropagation(),!this.disabled&&this.emit("lr-export-request",{format:e.detail.format})},this.gateDisabledClear={handleEvent:event=>{this.disabled&&event.stopPropagation()},capture:!0}}static{this.defaultStrings={...super.defaultStrings,evalDatasetAddExample:LYRA_DEFAULT_evalDatasetAddExample,evalDatasetColumnExpectedOutput:LYRA_DEFAULT_evalDatasetColumnExpectedOutput,evalDatasetColumnInput:LYRA_DEFAULT_evalDatasetColumnInput,evalDatasetColumnTags:LYRA_DEFAULT_evalDatasetColumnTags,evalDatasetEmpty:LYRA_DEFAULT_evalDatasetEmpty,evalDatasetImportLabel:LYRA_DEFAULT_evalDatasetImportLabel,evalDatasetLabel:LYRA_DEFAULT_evalDatasetLabel,evalDatasetLimit:LYRA_DEFAULT_evalDatasetLimit,evalDatasetNoMatches:LYRA_DEFAULT_evalDatasetNoMatches,evalDatasetRemoveExample:LYRA_DEFAULT_evalDatasetRemoveExample,evalDatasetSearchLabel:LYRA_DEFAULT_evalDatasetSearchLabel,evalDatasetTagFilterLabel:LYRA_DEFAULT_evalDatasetTagFilterLabel,fieldRequired:LYRA_DEFAULT_fieldRequired}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["examples","exportFormats"])}static{this.identityCollectionProperties=Object.freeze(["examples"])}static{this.styles=[LyraElement.styles,styles,agentActionButtonStyles]}adoptedCallback(){super.adoptedCallback(),this.limitAnnouncements.adopted()}updated(changed){if(super.updated(changed),this.limitAnnouncementInitialized&&this.examplesTruncated&&!this.previouslyTruncated){const truncation=publicCollectionTruncation(this,"examples");truncation&&this.limitAnnouncements.announcePolite(this.localize("evalDatasetLimit",void 0,{count:getNumberFormat(this.effectiveLocale).format(truncation.retained)}))}this.limitAnnouncementInitialized=!0,this.previouslyTruncated=this.examplesTruncated}static{this.immutableEventDetails=Object.freeze(["lr-import-request"])}get normalizedExamples(){if(this.normalizedFor!==this.examples){this.normalizedFor=this.examples;const deduped=firstByIdentity(Array.isArray(this.examples)?this.examples:[],example=>example.id);this.normalizedCache=deduped.map(example=>Array.isArray(example.tags)?example:{...example,tags:void 0})}return this.normalizedCache}willUpdate(changed){if(super.willUpdate(changed),changed.has("searchable")&&!this.searchable&&(this.searchText=""),changed.has("examples")){this.selectedId!==null&&!this.normalizedExamples.some(example=>example.id===this.selectedId)&&this.clearSelection();const available=this.allTags();[...this.activeTags].some(tag=>!available.includes(tag))&&(this.activeTags=new Set([...this.activeTags].filter(tag=>available.includes(tag))))}this.visibleExamples=this.filterExamples(),(changed.has("examples")||changed.has("searchText")||changed.has("activeTags")||changed.has("searchable"))&&this.selectedId!==null&&!this.visibleExamples.some(example=>example.id===this.selectedId)&&this.clearSelection()}clearSelection(){this.selectedId=null,this.emit("lr-example-select",{exampleId:null})}allTags(){const tags=new Set;for(const example of this.normalizedExamples)for(const tag of example.tags??[])tags.add(tag);return[...tags].sort(getCollator(this.effectiveLocale).compare)}filterExamples(){const query=this.searchText.trim().toLocaleLowerCase(this.effectiveLocale);return this.normalizedExamples.filter(example=>this.activeTags.size>0&&!(example.tags??[]).some(tag=>this.activeTags.has(tag))?!1:query===""?!0:[example.input,example.expectedOutput??"",...example.tags??[]].join(" ").toLocaleLowerCase(this.effectiveLocale).includes(query))}buildColumns(){const labels=[this.localize("evalDatasetColumnInput"),this.localize("evalDatasetColumnExpectedOutput"),this.localize("evalDatasetColumnTags")],key=labels.join("\0");return this.columnsCache?.key!==key&&(this.columnsCache={key,columns:this.createColumns(labels)}),this.columnsCache.columns}selectedKeys(){return this.selectedKeysCache?.id!==this.selectedId&&(this.selectedKeysCache={id:this.selectedId,keys:this.selectedId===null?new Set:new Set([this.selectedId])}),this.selectedKeysCache.keys}createColumns([inputLabel,expectedLabel,tagsLabel]){return[{key:"input",label:inputLabel,sortable:!0,sortValue:row=>row.input,cell:row=>row.input},{key:"expectedOutput",label:expectedLabel,sortable:!0,sortValue:row=>row.expectedOutput??"",cell:row=>row.expectedOutput??""},{key:"tags",label:tagsLabel,sortable:!0,sortValue:row=>(row.tags??[]).join(", "),cell:row=>(row.tags??[]).join(", ")}]}onTagChipToggle(tag,e){if(e.stopPropagation(),this.disabled)return;const next=new Set(this.activeTags);e.detail.selected?next.add(tag):next.delete(tag),this.activeTags=next}stopOwnedEvent(event){event.stopPropagation()}renderToolbar(){return html`
2
2
  <div part="toolbar">
3
3
  <button part="add-button" data-agent-action="brand" type="button" ?disabled=${this.disabled} @click=${this.onAddClick}>
4
4
  ${this.localize("evalDatasetAddExample")}
@@ -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{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./eval-result.styles.js";import{firstByIdentityMemo}from"../collection-identity.js";import{LYRA_DEFAULT_evaluationDashboardRunsLabel,LYRA_DEFAULT_noData}from"../../../internal/default-strings.generated.js";const EMPTY_RUNS=[],EMPTY_COLUMNS=[],EMPTY_KEYS=[],runId=run=>run.id,columnKey=column=>column.key,rubricKey=key=>key.key,rowKey=row=>row.id;class LyraEvalResult extends LyraElement{constructor(){super(...arguments),this.runs=EMPTY_RUNS,this.columns=EMPTY_COLUMNS,this.rubricKeys=EMPTY_KEYS,this.label="",this.selectedRunId=null,this.baselineRunId=null,this.reviewSkippable=!1,this.disabled=!1}static{this.defaultStrings={...super.defaultStrings,evaluationDashboardRunsLabel:LYRA_DEFAULT_evaluationDashboardRunsLabel,noData:LYRA_DEFAULT_noData}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["runs","columns","rubricKeys"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-run-activate","lr-review-input","lr-review-validity-change","lr-review-submit","lr-review-skip"])}get normalizedRuns(){return firstByIdentityMemo(Array.isArray(this.runs)?this.runs:[],runId)}get normalizedColumns(){return firstByIdentityMemo(Array.isArray(this.columns)?this.columns:[],columnKey)}get normalizedRubricKeys(){return firstByIdentityMemo(Array.isArray(this.rubricKeys)?this.rubricKeys:[],rubricKey)}get effectiveSelectedRunId(){return this.selectedRunId??this.normalizedRuns[0]?.id??""}get selectedRun(){const id=this.effectiveSelectedRunId;return this.normalizedRuns.find(run=>run.id===id)}get effectiveBaselineRunId(){return this.baselineRunId??this.normalizedRuns[0]?.id??""}get baselineRun(){const id=this.effectiveBaselineRunId;return this.normalizedRuns.find(run=>run.id===id)}stopOwnedEvent(event){event.stopPropagation()}reviewValue(run){const json=JSON.stringify(run.review??null);return(this.reviewBinding?.id!==run.id||this.reviewBinding.json!==json)&&(this.reviewBinding={id:run.id,json,value:run.review??{}}),this.reviewBinding.value}renderReview(selected){return html`<lr-rubric-form
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{styles}from"./eval-result.styles.js";import{firstByIdentityMemo}from"../collection-identity.js";import{LYRA_DEFAULT_evaluationDashboardRunsLabel}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_noData}from"../../../internal/default-strings/shared.generated.js";const EMPTY_RUNS=[],EMPTY_COLUMNS=[],EMPTY_KEYS=[],runId=run=>run.id,columnKey=column=>column.key,rubricKey=key=>key.key,rowKey=row=>row.id;class LyraEvalResult extends LyraElement{constructor(){super(...arguments),this.runs=EMPTY_RUNS,this.columns=EMPTY_COLUMNS,this.rubricKeys=EMPTY_KEYS,this.label="",this.selectedRunId=null,this.baselineRunId=null,this.reviewSkippable=!1,this.disabled=!1}static{this.defaultStrings={...super.defaultStrings,evaluationDashboardRunsLabel:LYRA_DEFAULT_evaluationDashboardRunsLabel,noData:LYRA_DEFAULT_noData}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["runs","columns","rubricKeys"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-run-activate","lr-review-input","lr-review-validity-change","lr-review-submit","lr-review-skip"])}get normalizedRuns(){return firstByIdentityMemo(Array.isArray(this.runs)?this.runs:[],runId)}get normalizedColumns(){return firstByIdentityMemo(Array.isArray(this.columns)?this.columns:[],columnKey)}get normalizedRubricKeys(){return firstByIdentityMemo(Array.isArray(this.rubricKeys)?this.rubricKeys:[],rubricKey)}get effectiveSelectedRunId(){return this.selectedRunId??this.normalizedRuns[0]?.id??""}get selectedRun(){const id=this.effectiveSelectedRunId;return this.normalizedRuns.find(run=>run.id===id)}get effectiveBaselineRunId(){return this.baselineRunId??this.normalizedRuns[0]?.id??""}get baselineRun(){const id=this.effectiveBaselineRunId;return this.normalizedRuns.find(run=>run.id===id)}stopOwnedEvent(event){event.stopPropagation()}reviewValue(run){const json=JSON.stringify(run.review??null);return(this.reviewBinding?.id!==run.id||this.reviewBinding.json!==json)&&(this.reviewBinding={id:run.id,json,value:run.review??{}}),this.reviewBinding.value}renderReview(selected){return html`<lr-rubric-form
2
2
  part="review"
3
3
  .keys=${this.normalizedRubricKeys}
4
4
  .value=${this.reviewValue(selected)}
@@ -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_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_details,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_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.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,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}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
2
2
  part=${part}
3
3
  code=${text}
4
4
  language=${content.language??""}
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{keyed}from"lit/directives/keyed.js";import{finiteRange}from"../../../internal/numbers.js";import{resolveCssLength}from"../../../internal/css-length.js";import{LyraElement}from"../../../internal/lyra-element.js";import{safeFrameSrc}from"../../../internal/safe-url.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{styles}from"./mcp-app.styles.js";import{purposeAccessibleLabel}from"../semantic-owner.js";import{LYRA_DEFAULT_mcpAppLabel,LYRA_DEFAULT_mcpAppLoading,LYRA_DEFAULT_mcpAppUnavailable}from"../../../internal/default-strings.generated.js";function record(value){return value&&typeof value=="object"&&!Array.isArray(value)?value:null}function resolveResource(resource){const value=record(resource);if(!value||typeof value.uri!="string")return null;const uri=value.uri.trim();if(!uri)return null;const ownsHtml=Object.prototype.hasOwnProperty.call(value,"html"),ownsSrc=Object.prototype.hasOwnProperty.call(value,"src");if(ownsHtml===ownsSrc)return null;if(ownsHtml)return typeof value.html!="string"||value.html.length===0?null:{resource,uri,html:value.html};const src=safeFrameSrc(value.src);return src?{resource,uri,src}:null}function sameAppDocument(a,b){if(!a||!b||a.uri!==b.uri||a.html!==b.html||a.src!==b.src)return!1;const policy=({csp,permissions,metadata})=>JSON.stringify([csp,permissions,metadata]);try{return policy(a.resource)===policy(b.resource)}catch{return!1}}const CSP_HOST=/^(?:[a-z0-9-]+(?:\.[a-z0-9-]+)*|\[[0-9a-f:.]+\])$/i;function cspSources(values){return(values??[]).flatMap(value=>{try{const url=new URL(value);return(url.protocol==="https:"||url.protocol==="http:")&&CSP_HOST.test(url.hostname)?[url.origin]:[]}catch{return[]}})}function buildCsp(csp){const resources=cspSources(csp?.resourceDomains),connections=cspSources(csp?.connectDomains),frames=cspSources(csp?.frameDomains);return["default-src 'none'","script-src 'unsafe-inline'","style-src 'unsafe-inline'",`img-src data: blob: ${resources.join(" ")}`.trim(),`font-src data: ${resources.join(" ")}`.trim(),`media-src data: blob: ${resources.join(" ")}`.trim(),`connect-src ${connections.length?connections.join(" "):"'none'"}`,`frame-src ${frames.length?frames.join(" "):"'none'"}`,"base-uri 'none'","form-action 'none'"].join("; ")}function withCsp(htmlSource,csp){return`${`<meta http-equiv="Content-Security-Policy" content="${buildCsp(csp)}">`}${htmlSource}`}function absoluteLinkHref(value){try{const url=new URL(typeof value=="string"?value:"");return["http:","https:","mailto:"].includes(url.protocol)?url.href:null}catch{return null}}const heightAttributeConverter={fromAttribute(value){if(value===null)return null;const numeric=Number(value);return Number.isFinite(numeric)?numeric:value.trim()}};function permissionPolicy(permissions){return[permissions?.camera?"camera":"",permissions?.microphone?"microphone":"",permissions?.geolocation?"geolocation":"",permissions?.clipboardRead?"clipboard-read":"",permissions?.clipboardWrite?"clipboard-write":""].filter(Boolean).map(permission=>`${permission} *`).join("; ")}class LyraMcpApp extends LyraElement{constructor(){super(...arguments),this.resource=null,this.height=320,this.maxHeight=800,this.label="",this.accessibleLabel=null,this.loaded=!1,this.frameHeight=320,this.frameGeneration=0,this.announcements=new AnnouncementSinkController(this,{eager:["polite","assertive"]}),this.suppressNextResourceAnnouncement=!0,this.onPortMessage=event=>{this.handleMessage(event.data)}}static{this.defaultStrings={...super.defaultStrings,mcpAppLabel:LYRA_DEFAULT_mcpAppLabel,mcpAppLoading:LYRA_DEFAULT_mcpAppLoading,mcpAppUnavailable:LYRA_DEFAULT_mcpAppUnavailable}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["resource"])}static{this.styles=[LyraElement.styles,styles]}resourceAvailable(resource){return resolveResource(resource)!==null}invalidateFrame(){this.closeFramePort(),this.bootstrapPort?.port.close(),this.bootstrapPort=void 0,this.frameNonce=this.resourceAvailable(this.resource)?this.createFrameNonce():void 0,this.loaded=!1,this.frameGeneration++,this.requestUpdate()}closeFramePort(){this.framePort?.removeEventListener("message",this.onPortMessage),this.framePort?.close(),this.framePort=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.suppressNextResourceAnnouncement=!0,this.requestUpdate())}disconnectedCallback(){this.invalidateFrame(),this.suppressNextResourceAnnouncement=!0,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.invalidateFrame(),this.announcements.adopted()}willUpdate(changed){super.willUpdate(changed);const keptFrame=changed.has("resource")&&this.hasUpdated&&sameAppDocument(resolveResource(changed.get("resource")),resolveResource(this.resource));if(changed.has("resource")&&!keptFrame){if(this.hasUpdated&&!this.suppressNextResourceAnnouncement){const wasAvailable=this.resourceAvailable(changed.get("resource"));this.resourceAvailable(this.resource)?this.announcements.announcePolite(this.localize("mcpAppLoading")):wasAvailable&&this.announcements.announceAssertive(this.localize("mcpAppUnavailable"))}this.loaded=!1,this.closeFramePort(),this.bootstrapPort?.port.close(),this.bootstrapPort=void 0,this.frameNonce=this.resourceAvailable(this.resource)?this.createFrameNonce():void 0,this.frameGeneration++}(changed.has("resource")&&!keptFrame||changed.has("height")||changed.has("maxHeight"))&&(this.frameHeight=finiteRange(this.heightPx(),320,120,this.maxHeightPx()))}updated(_changed){super.updated(_changed),this.suppressNextResourceAnnouncement=!1}createFrameNonce(){return crypto.randomUUID()}onLoad(event,frameGeneration,resource){if(!this.isConnected||frameGeneration!==this.frameGeneration||event.currentTarget!==this.frame)return;const currentResource=resolveResource(this.resource);if(!currentResource||currentResource.resource!==resource.resource&&!sameAppDocument(currentResource,resource))return;if(this.loaded){this.invalidateFrame();return}this.frameNonce??=this.createFrameNonce();const frame=event.currentTarget,port=new MessageChannel;this.framePort=port.port1,this.framePort.addEventListener("message",this.onPortMessage),this.framePort.start(),this.loaded=!0,this.bootstrapPort={frame,port:port.port2},this.postHostContext({resource:{uri:resource.uri,metadata:resource.resource.metadata},locale:this.effectiveLocale,direction:this.effectiveDirection}),this.bootstrapPort?.port.close(),this.bootstrapPort=void 0,this.emit("lr-mcp-ready",{uri:resource.uri})}heightPx(){return resolveCssLength(this.height,{host:this})??Number.NaN}maxHeightPx(){return finiteRange(resolveCssLength(this.maxHeight,{host:this})??Number.NaN,800,120,1e4)}handleMessage(data){const message=record(data);if(!(typeof this.frameNonce!="string"||message?.nonce!==this.frameNonce)&&!(message?.channel!=="lyra-mcp-app"||message.version!==1||typeof message.type!="string"))switch(message.type){case"resize":{const requested=typeof message.height=="number"?message.height:this.heightPx(),height=finiteRange(requested,this.heightPx(),120,this.maxHeightPx());this.frameHeight=height,this.emit("lr-mcp-resize",{height});break}case"tool-call":typeof message.name=="string"&&this.emit("lr-mcp-tool-call",{requestId:typeof message.requestId=="string"?message.requestId:void 0,name:message.name,args:message.args,frameGeneration:this.frameGeneration});break;case"send-message":this.emit("lr-mcp-send-message",{message:message.message});break;case"open-link":{const href=absoluteLinkHref(message.href);href&&this.emit("lr-mcp-open-link",{href})}break;case"log":this.emit("lr-mcp-log",{level:typeof message.level=="string"?message.level:"info",value:message.value});break}}post(message,frame=this.frame,transferPort){const nonce=this.frameNonce;if(typeof nonce=="string"){if(transferPort){const target=frame?.contentWindow;if(!target)return;target.postMessage({...message,nonce},"*",[transferPort]);return}this.framePort?.postMessage({...message,nonce})}}postHostContext(context){const bootstrap=this.bootstrapPort;this.bootstrapPort=void 0,this.post({channel:"lyra-mcp-app",version:1,type:"host-context",context},bootstrap?.frame,bootstrap?.port)}postToolResult(requestId,options){const value=record(options);if(typeof requestId!="string"||!requestId.trim()||!value)return;const frameGeneration=value.frameGeneration;if(typeof frameGeneration!="number"||!Number.isSafeInteger(frameGeneration)||frameGeneration!==this.frameGeneration)return;const hasResult=Object.prototype.hasOwnProperty.call(value,"result"),hasError=Object.prototype.hasOwnProperty.call(value,"error");hasResult!==hasError&&(hasError&&(typeof value.error!="string"||!value.error.trim())||this.post({channel:"lyra-mcp-app",version:1,type:"tool-result",requestId,...hasResult?{result:value.result}:{},...hasError?{error:value.error}:{}}))}render(){const resource=resolveResource(this.resource);if(!resource)return html`<div part="base"><p part="error">${this.localize("mcpAppUnavailable")}</p></div>`;const fallbackLabel=(!this.hasAttribute("aria-label")&&typeof this.accessibleLabel=="string"?this.accessibleLabel:"")||this.label||resource.resource.title||this.localize("mcpAppLabel"),label=purposeAccessibleLabel(this,fallbackLabel),frameGeneration=this.frameGeneration;return html`<div part="base">
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{keyed}from"lit/directives/keyed.js";import{finiteRange}from"../../../internal/numbers.js";import{resolveCssLength}from"../../../internal/css-length.js";import{LyraElement}from"../../../internal/lyra-element.js";import{safeFrameSrc}from"../../../internal/safe-url.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{styles}from"./mcp-app.styles.js";import{purposeAccessibleLabel}from"../semantic-owner.js";import{LYRA_DEFAULT_mcpAppLabel,LYRA_DEFAULT_mcpAppLoading,LYRA_DEFAULT_mcpAppUnavailable}from"../../../internal/default-strings/agent-tools.generated.js";function record(value){return value&&typeof value=="object"&&!Array.isArray(value)?value:null}function resolveResource(resource){const value=record(resource);if(!value||typeof value.uri!="string")return null;const uri=value.uri.trim();if(!uri)return null;const ownsHtml=Object.prototype.hasOwnProperty.call(value,"html"),ownsSrc=Object.prototype.hasOwnProperty.call(value,"src");if(ownsHtml===ownsSrc)return null;if(ownsHtml)return typeof value.html!="string"||value.html.length===0?null:{resource,uri,html:value.html};const src=safeFrameSrc(value.src);return src?{resource,uri,src}:null}function sameAppDocument(a,b){if(!a||!b||a.uri!==b.uri||a.html!==b.html||a.src!==b.src)return!1;const policy=({csp,permissions,metadata})=>JSON.stringify([csp,permissions,metadata]);try{return policy(a.resource)===policy(b.resource)}catch{return!1}}const CSP_HOST=/^(?:[a-z0-9-]+(?:\.[a-z0-9-]+)*|\[[0-9a-f:.]+\])$/i;function cspSources(values){return(values??[]).flatMap(value=>{try{const url=new URL(value);return(url.protocol==="https:"||url.protocol==="http:")&&CSP_HOST.test(url.hostname)?[url.origin]:[]}catch{return[]}})}function buildCsp(csp){const resources=cspSources(csp?.resourceDomains),connections=cspSources(csp?.connectDomains),frames=cspSources(csp?.frameDomains);return["default-src 'none'","script-src 'unsafe-inline'","style-src 'unsafe-inline'",`img-src data: blob: ${resources.join(" ")}`.trim(),`font-src data: ${resources.join(" ")}`.trim(),`media-src data: blob: ${resources.join(" ")}`.trim(),`connect-src ${connections.length?connections.join(" "):"'none'"}`,`frame-src ${frames.length?frames.join(" "):"'none'"}`,"base-uri 'none'","form-action 'none'"].join("; ")}function withCsp(htmlSource,csp){return`${`<meta http-equiv="Content-Security-Policy" content="${buildCsp(csp)}">`}${htmlSource}`}function absoluteLinkHref(value){try{const url=new URL(typeof value=="string"?value:"");return["http:","https:","mailto:"].includes(url.protocol)?url.href:null}catch{return null}}const heightAttributeConverter={fromAttribute(value){if(value===null)return null;const numeric=Number(value);return Number.isFinite(numeric)?numeric:value.trim()}};function permissionPolicy(permissions){return[permissions?.camera?"camera":"",permissions?.microphone?"microphone":"",permissions?.geolocation?"geolocation":"",permissions?.clipboardRead?"clipboard-read":"",permissions?.clipboardWrite?"clipboard-write":""].filter(Boolean).map(permission=>`${permission} *`).join("; ")}class LyraMcpApp extends LyraElement{constructor(){super(...arguments),this.resource=null,this.height=320,this.maxHeight=800,this.label="",this.accessibleLabel=null,this.loaded=!1,this.frameHeight=320,this.frameGeneration=0,this.announcements=new AnnouncementSinkController(this,{eager:["polite","assertive"]}),this.suppressNextResourceAnnouncement=!0,this.onPortMessage=event=>{this.handleMessage(event.data)}}static{this.defaultStrings={...super.defaultStrings,mcpAppLabel:LYRA_DEFAULT_mcpAppLabel,mcpAppLoading:LYRA_DEFAULT_mcpAppLoading,mcpAppUnavailable:LYRA_DEFAULT_mcpAppUnavailable}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["resource"])}static{this.styles=[LyraElement.styles,styles]}resourceAvailable(resource){return resolveResource(resource)!==null}invalidateFrame(){this.closeFramePort(),this.bootstrapPort?.port.close(),this.bootstrapPort=void 0,this.frameNonce=this.resourceAvailable(this.resource)?this.createFrameNonce():void 0,this.loaded=!1,this.frameGeneration++,this.requestUpdate()}closeFramePort(){this.framePort?.removeEventListener("message",this.onPortMessage),this.framePort?.close(),this.framePort=void 0}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.suppressNextResourceAnnouncement=!0,this.requestUpdate())}disconnectedCallback(){this.invalidateFrame(),this.suppressNextResourceAnnouncement=!0,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.invalidateFrame(),this.announcements.adopted()}willUpdate(changed){super.willUpdate(changed);const keptFrame=changed.has("resource")&&this.hasUpdated&&sameAppDocument(resolveResource(changed.get("resource")),resolveResource(this.resource));if(changed.has("resource")&&!keptFrame){if(this.hasUpdated&&!this.suppressNextResourceAnnouncement){const wasAvailable=this.resourceAvailable(changed.get("resource"));this.resourceAvailable(this.resource)?this.announcements.announcePolite(this.localize("mcpAppLoading")):wasAvailable&&this.announcements.announceAssertive(this.localize("mcpAppUnavailable"))}this.loaded=!1,this.closeFramePort(),this.bootstrapPort?.port.close(),this.bootstrapPort=void 0,this.frameNonce=this.resourceAvailable(this.resource)?this.createFrameNonce():void 0,this.frameGeneration++}(changed.has("resource")&&!keptFrame||changed.has("height")||changed.has("maxHeight"))&&(this.frameHeight=finiteRange(this.heightPx(),320,120,this.maxHeightPx()))}updated(_changed){super.updated(_changed),this.suppressNextResourceAnnouncement=!1}createFrameNonce(){return crypto.randomUUID()}onLoad(event,frameGeneration,resource){if(!this.isConnected||frameGeneration!==this.frameGeneration||event.currentTarget!==this.frame)return;const currentResource=resolveResource(this.resource);if(!currentResource||currentResource.resource!==resource.resource&&!sameAppDocument(currentResource,resource))return;if(this.loaded){this.invalidateFrame();return}this.frameNonce??=this.createFrameNonce();const frame=event.currentTarget,port=new MessageChannel;this.framePort=port.port1,this.framePort.addEventListener("message",this.onPortMessage),this.framePort.start(),this.loaded=!0,this.bootstrapPort={frame,port:port.port2},this.postHostContext({resource:{uri:resource.uri,metadata:resource.resource.metadata},locale:this.effectiveLocale,direction:this.effectiveDirection}),this.bootstrapPort?.port.close(),this.bootstrapPort=void 0,this.emit("lr-mcp-ready",{uri:resource.uri})}heightPx(){return resolveCssLength(this.height,{host:this})??Number.NaN}maxHeightPx(){return finiteRange(resolveCssLength(this.maxHeight,{host:this})??Number.NaN,800,120,1e4)}handleMessage(data){const message=record(data);if(!(typeof this.frameNonce!="string"||message?.nonce!==this.frameNonce)&&!(message?.channel!=="lyra-mcp-app"||message.version!==1||typeof message.type!="string"))switch(message.type){case"resize":{const requested=typeof message.height=="number"?message.height:this.heightPx(),height=finiteRange(requested,this.heightPx(),120,this.maxHeightPx());this.frameHeight=height,this.emit("lr-mcp-resize",{height});break}case"tool-call":typeof message.name=="string"&&this.emit("lr-mcp-tool-call",{requestId:typeof message.requestId=="string"?message.requestId:void 0,name:message.name,args:message.args,frameGeneration:this.frameGeneration});break;case"send-message":this.emit("lr-mcp-send-message",{message:message.message});break;case"open-link":{const href=absoluteLinkHref(message.href);href&&this.emit("lr-mcp-open-link",{href})}break;case"log":this.emit("lr-mcp-log",{level:typeof message.level=="string"?message.level:"info",value:message.value});break}}post(message,frame=this.frame,transferPort){const nonce=this.frameNonce;if(typeof nonce=="string"){if(transferPort){const target=frame?.contentWindow;if(!target)return;target.postMessage({...message,nonce},"*",[transferPort]);return}this.framePort?.postMessage({...message,nonce})}}postHostContext(context){const bootstrap=this.bootstrapPort;this.bootstrapPort=void 0,this.post({channel:"lyra-mcp-app",version:1,type:"host-context",context},bootstrap?.frame,bootstrap?.port)}postToolResult(requestId,options){const value=record(options);if(typeof requestId!="string"||!requestId.trim()||!value)return;const frameGeneration=value.frameGeneration;if(typeof frameGeneration!="number"||!Number.isSafeInteger(frameGeneration)||frameGeneration!==this.frameGeneration)return;const hasResult=Object.prototype.hasOwnProperty.call(value,"result"),hasError=Object.prototype.hasOwnProperty.call(value,"error");hasResult!==hasError&&(hasError&&(typeof value.error!="string"||!value.error.trim())||this.post({channel:"lyra-mcp-app",version:1,type:"tool-result",requestId,...hasResult?{result:value.result}:{},...hasError?{error:value.error}:{}}))}render(){const resource=resolveResource(this.resource);if(!resource)return html`<div part="base"><p part="error">${this.localize("mcpAppUnavailable")}</p></div>`;const fallbackLabel=(!this.hasAttribute("aria-label")&&typeof this.accessibleLabel=="string"?this.accessibleLabel:"")||this.label||resource.resource.title||this.localize("mcpAppLabel"),label=purposeAccessibleLabel(this,fallbackLabel),frameGeneration=this.frameGeneration;return html`<div part="base">
2
2
  ${this.loaded?nothing:html`<p part="loading">${this.localize("mcpAppLoading")}</p>`}
3
3
  ${keyed(frameGeneration,html`<iframe
4
4
  part="frame"
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{literalSetConverter}from"../../../internal/converters.js";import"../../forms/button/button.class.js";import{styles}from"./permission-grant.styles.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{LYRA_DEFAULT_approvalQueuePending,LYRA_DEFAULT_collapse,LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmDenied,LYRA_DEFAULT_date,LYRA_DEFAULT_deny,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_permissionGrantAllowOnce,LYRA_DEFAULT_permissionGrantAllowSession,LYRA_DEFAULT_permissionGrantLabel,LYRA_DEFAULT_permissionGrantScopeLabel,LYRA_DEFAULT_progress,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const PERMISSION_GRANT_STATUS=literalSetConverter(["pending","approved","granted","denied"],"pending"),DECISION_LABEL_KEY={"allow-once":"permissionGrantAllowOnce","allow-session":"permissionGrantAllowSession",deny:"deny"};class LyraPermissionGrant extends LyraElement{constructor(){super(...arguments),this.requestId="",this.description="",this.scope="",this.statusValue="pending",this.disabled=!1,this.dispatchingDecision=!1,this.settledWithFocus=!1}static{this.defaultStrings={...super.defaultStrings,approvalQueuePending:LYRA_DEFAULT_approvalQueuePending,collapse:LYRA_DEFAULT_collapse,confirmApproved:LYRA_DEFAULT_confirmApproved,confirmDenied:LYRA_DEFAULT_confirmDenied,date:LYRA_DEFAULT_date,deny:LYRA_DEFAULT_deny,details:LYRA_DEFAULT_details,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,permissionGrantAllowOnce:LYRA_DEFAULT_permissionGrantAllowOnce,permissionGrantAllowSession:LYRA_DEFAULT_permissionGrantAllowSession,permissionGrantLabel:LYRA_DEFAULT_permissionGrantLabel,permissionGrantScopeLabel:LYRA_DEFAULT_permissionGrantScopeLabel,progress:LYRA_DEFAULT_progress,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.styles=[LyraElement.styles,styles]}get status(){return this.statusValue}set status(next){const old=this.statusValue;this.statusValue=PERMISSION_GRANT_STATUS.normalize(next),this.requestUpdate("status",old)}willUpdate(changed){super.willUpdate(changed),this.settledWithFocus=changed.get("status")==="pending"&&this.status!=="pending"&&!!shadowFocusTarget(this)?.matches('[part~="decision"]')}updated(changed){super.updated(changed),this.settledWithFocus&&this.statusEl?.focus()}get identifiedRequestId(){return typeof this.requestId=="string"&&this.requestId.trim().length>0?this.requestId:null}requestDecision(renderedRequestId,renderedScope,decision){if(!(this.disabled||this.status!=="pending"||this.identifiedRequestId!==renderedRequestId||this.scope!==renderedScope||this.dispatchingDecision)){this.dispatchingDecision=!0;try{this.emit("lr-permission-decision",{requestId:renderedRequestId,decision})}finally{this.dispatchingDecision=!1}}}render(){const visibleLabel=this.label==null?this.localize("permissionGrantLabel"):this.label,hostLabel=hostAriaLabel(this),scope=this.scope,status=this.status,statusLabel=status==="approved"||status==="granted"?this.localize("confirmApproved"):status==="denied"?this.localize("confirmDenied"):this.localize("approvalQueuePending"),pending=this.status==="pending",requestId=this.identifiedRequestId,identified=requestId!==null;return html`
1
+ import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{literalSetConverter}from"../../../internal/converters.js";import"../../forms/button/button.class.js";import{styles}from"./permission-grant.styles.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{LYRA_DEFAULT_approvalQueuePending,LYRA_DEFAULT_confirmApproved,LYRA_DEFAULT_confirmDenied,LYRA_DEFAULT_permissionGrantAllowOnce,LYRA_DEFAULT_permissionGrantAllowSession,LYRA_DEFAULT_permissionGrantLabel,LYRA_DEFAULT_permissionGrantScopeLabel}from"../../../internal/default-strings/agent-tools.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_date,LYRA_DEFAULT_deny,LYRA_DEFAULT_details,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_progress,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings/shared.generated.js";const PERMISSION_GRANT_STATUS=literalSetConverter(["pending","approved","granted","denied"],"pending"),DECISION_LABEL_KEY={"allow-once":"permissionGrantAllowOnce","allow-session":"permissionGrantAllowSession",deny:"deny"};class LyraPermissionGrant extends LyraElement{constructor(){super(...arguments),this.requestId="",this.description="",this.scope="",this.statusValue="pending",this.disabled=!1,this.dispatchingDecision=!1,this.settledWithFocus=!1}static{this.defaultStrings={...super.defaultStrings,approvalQueuePending:LYRA_DEFAULT_approvalQueuePending,collapse:LYRA_DEFAULT_collapse,confirmApproved:LYRA_DEFAULT_confirmApproved,confirmDenied:LYRA_DEFAULT_confirmDenied,date:LYRA_DEFAULT_date,deny:LYRA_DEFAULT_deny,details:LYRA_DEFAULT_details,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,permissionGrantAllowOnce:LYRA_DEFAULT_permissionGrantAllowOnce,permissionGrantAllowSession:LYRA_DEFAULT_permissionGrantAllowSession,permissionGrantLabel:LYRA_DEFAULT_permissionGrantLabel,permissionGrantScopeLabel:LYRA_DEFAULT_permissionGrantScopeLabel,progress:LYRA_DEFAULT_progress,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.styles=[LyraElement.styles,styles]}get status(){return this.statusValue}set status(next){const old=this.statusValue;this.statusValue=PERMISSION_GRANT_STATUS.normalize(next),this.requestUpdate("status",old)}willUpdate(changed){super.willUpdate(changed),this.settledWithFocus=changed.get("status")==="pending"&&this.status!=="pending"&&!!shadowFocusTarget(this)?.matches('[part~="decision"]')}updated(changed){super.updated(changed),this.settledWithFocus&&this.statusEl?.focus()}get identifiedRequestId(){return typeof this.requestId=="string"&&this.requestId.trim().length>0?this.requestId:null}requestDecision(renderedRequestId,renderedScope,decision){if(!(this.disabled||this.status!=="pending"||this.identifiedRequestId!==renderedRequestId||this.scope!==renderedScope||this.dispatchingDecision)){this.dispatchingDecision=!0;try{this.emit("lr-permission-decision",{requestId:renderedRequestId,decision})}finally{this.dispatchingDecision=!1}}}render(){const visibleLabel=this.label==null?this.localize("permissionGrantLabel"):this.label,hostLabel=hostAriaLabel(this),scope=this.scope,status=this.status,statusLabel=status==="approved"||status==="granted"?this.localize("confirmApproved"):status==="denied"?this.localize("confirmDenied"):this.localize("approvalQueuePending"),pending=this.status==="pending",requestId=this.identifiedRequestId,identified=requestId!==null;return html`
2
2
  <fieldset part="base" aria-label=${hostLabel===null?nothing:hostLabel} ?disabled=${this.disabled}>
3
3
  <legend part="legend">${visibleLabel}</legend>
4
4
  ${this.description?html`<p part="description">${this.description}</p>`:nothing}