@lsamien/yaoyao 0.4.79 → 0.4.81

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 (116) hide show
  1. package/README.md +9 -7
  2. package/THIRD_PARTY_NOTICES.md +4 -0
  3. package/bin/hermes-yaoyao-updater.mjs +97 -1
  4. package/bin/lib/npm-release.d.mts +10 -0
  5. package/bin/lib/npm-release.mjs +93 -0
  6. package/build-info.json +22 -3
  7. package/desktop/main.mjs +28 -26
  8. package/dist/assets/{AboutDialog-CrajAC--.js → AboutDialog-g6pYSCjs.js} +2 -2
  9. package/dist/assets/{AboutDialog-CrajAC--.js.map → AboutDialog-g6pYSCjs.js.map} +1 -1
  10. package/dist/assets/{BotAutomationsView-DTOoFSEl.js → BotAutomationsView-D1qf-5yf.js} +2 -2
  11. package/dist/assets/{BotAutomationsView-DTOoFSEl.js.map → BotAutomationsView-D1qf-5yf.js.map} +1 -1
  12. package/dist/assets/BotPluginsDialog-B0iR4Jy2.css +1 -0
  13. package/dist/assets/BotPluginsDialog-BOSzPlLZ.js +2 -0
  14. package/dist/assets/BotPluginsDialog-BOSzPlLZ.js.map +1 -0
  15. package/dist/assets/{BotSettingsDialog-ChffrjSM.js → BotSettingsDialog-Ba-380qV.js} +4 -4
  16. package/dist/assets/{BotSettingsDialog-ChffrjSM.js.map → BotSettingsDialog-Ba-380qV.js.map} +1 -1
  17. package/dist/assets/ChatView-ClK12dmT.css +1 -0
  18. package/dist/assets/ChatView-DHyj3yzu.js +2 -0
  19. package/dist/assets/ChatView-DHyj3yzu.js.map +1 -0
  20. package/dist/assets/{ComputerPanel-bNkvZAiT.js → ComputerPanel-D1hglwwV.js} +2 -2
  21. package/dist/assets/{ComputerPanel-bNkvZAiT.js.map → ComputerPanel-D1hglwwV.js.map} +1 -1
  22. package/dist/assets/{ComputerViewerView-DCTvbHr-.js → ComputerViewerView-BDL1eNKT.js} +2 -2
  23. package/dist/assets/{ComputerViewerView-DCTvbHr-.js.map → ComputerViewerView-BDL1eNKT.js.map} +1 -1
  24. package/dist/assets/{ConversationsView-BnysxvX_.js → ConversationsView-BaWBEaBU.js} +5 -5
  25. package/dist/assets/{ConversationsView-BnysxvX_.js.map → ConversationsView-BaWBEaBU.js.map} +1 -1
  26. package/dist/assets/{ConversationsView-CbArO1v2.css → ConversationsView-CdPjaDik.css} +1 -1
  27. package/dist/assets/{FilesView-D7tA6Nu1.js → FilesView-AjaCIyCs.js} +2 -2
  28. package/dist/assets/{FilesView-D7tA6Nu1.js.map → FilesView-AjaCIyCs.js.map} +1 -1
  29. package/dist/assets/FloatingResourceSearch-CeLuyNWO.js +9 -0
  30. package/dist/assets/{FloatingResourceSearch-c6l1JuAA.js.map → FloatingResourceSearch-CeLuyNWO.js.map} +1 -1
  31. package/dist/assets/{FloatingResourceSearch-3GOuDkuO.css → FloatingResourceSearch-CqauCQAf.css} +1 -1
  32. package/dist/assets/{HistoryView-Cnsriop4.js → HistoryView-C96yRoyB.js} +2 -2
  33. package/dist/assets/{HistoryView-Cnsriop4.js.map → HistoryView-C96yRoyB.js.map} +1 -1
  34. package/dist/assets/{KanbanView-CXm05b62.js → KanbanView-CVbjfqiX.js} +2 -2
  35. package/dist/assets/{KanbanView-CXm05b62.js.map → KanbanView-CVbjfqiX.js.map} +1 -1
  36. package/dist/assets/{LocalVmSettingsPanel-HgNC1SCF.js → LocalVmSettingsPanel-DcDIRVsO.js} +2 -2
  37. package/dist/assets/{LocalVmSettingsPanel-HgNC1SCF.js.map → LocalVmSettingsPanel-DcDIRVsO.js.map} +1 -1
  38. package/dist/assets/{RunnerSettingsPanel-CLKZvWua.js → RunnerSettingsPanel-XYeXVx5y.js} +2 -2
  39. package/dist/assets/{RunnerSettingsPanel-CLKZvWua.js.map → RunnerSettingsPanel-XYeXVx5y.js.map} +1 -1
  40. package/dist/assets/{StandaloneDialog-DODllzh1.js → StandaloneDialog-C6HIM_jc.js} +2 -2
  41. package/dist/assets/{StandaloneDialog-DODllzh1.js.map → StandaloneDialog-C6HIM_jc.js.map} +1 -1
  42. package/dist/assets/{UpdateCheckDialog-DHcAuryL.js → UpdateCheckDialog-Dv1d1s42.js} +2 -2
  43. package/dist/assets/{UpdateCheckDialog-DHcAuryL.js.map → UpdateCheckDialog-Dv1d1s42.js.map} +1 -1
  44. package/dist/assets/{WorkspaceKnowledgePanel-BrE8xSi2.js → WorkspaceKnowledgePanel-Dnauu0Hw.js} +2 -2
  45. package/dist/assets/{WorkspaceKnowledgePanel-BrE8xSi2.js.map → WorkspaceKnowledgePanel-Dnauu0Hw.js.map} +1 -1
  46. package/dist/assets/{WorkspaceRoutinesPanel-CpDVEwHx.js → WorkspaceRoutinesPanel-WNI3qP4D.js} +2 -2
  47. package/dist/assets/{WorkspaceRoutinesPanel-CpDVEwHx.js.map → WorkspaceRoutinesPanel-WNI3qP4D.js.map} +1 -1
  48. package/dist/assets/WorkspaceShell-BT92dIOL.css +1 -0
  49. package/dist/assets/WorkspaceShell-Bl2QMnvN.js +44 -0
  50. package/dist/assets/WorkspaceShell-Bl2QMnvN.js.map +1 -0
  51. package/dist/assets/{WorkspaceView-CBWFRLki.js → WorkspaceView-Dhdw4Kml.js} +2 -2
  52. package/dist/assets/{WorkspaceView-CBWFRLki.js.map → WorkspaceView-Dhdw4Kml.js.map} +1 -1
  53. package/dist/assets/{docx-preview-CG4CK2Qm.js → docx-preview-BNRkFvPc.js} +2 -2
  54. package/dist/assets/{docx-preview-CG4CK2Qm.js.map → docx-preview-BNRkFvPc.js.map} +1 -1
  55. package/dist/assets/{index-BRP9NWum.js → index-DU4OTLup.js} +3 -3
  56. package/dist/assets/{index-BRP9NWum.js.map → index-DU4OTLup.js.map} +1 -1
  57. package/dist/assets/{pdf-CFWXmhVF.js → pdf-C6_9GF5Z.js} +2 -2
  58. package/dist/assets/{pdf-CFWXmhVF.js.map → pdf-C6_9GF5Z.js.map} +1 -1
  59. package/dist/assets/{sessionOwnership-B2YxdBdf.js → sessionOwnership-D9vGe33s.js} +2 -2
  60. package/dist/assets/{sessionOwnership-B2YxdBdf.js.map → sessionOwnership-D9vGe33s.js.map} +1 -1
  61. package/dist/assets/{viewModels-CYJ8m5Uf.js → viewModels-BLN4GfVX.js} +5 -5
  62. package/dist/assets/viewModels-BLN4GfVX.js.map +1 -0
  63. package/dist/index.html +1 -1
  64. package/dist/provider-logos/airtable.svg +13 -0
  65. package/dist/provider-logos/discord.svg +15 -0
  66. package/dist/provider-logos/github.svg +10 -0
  67. package/dist/provider-logos/gmail.svg +1 -0
  68. package/dist/provider-logos/googlecalendar.svg +148 -0
  69. package/dist/provider-logos/googledrive.svg +25 -0
  70. package/dist/provider-logos/linear.svg +5 -0
  71. package/dist/provider-logos/notion.svg +11 -0
  72. package/dist/provider-logos/outlook.svg +76 -0
  73. package/dist/provider-logos/slack.svg +22 -0
  74. package/dist/provider-logos/trello.svg +19 -0
  75. package/dist/provider-logos/twitter.svg +128 -0
  76. package/dist-server/server/app.js +4 -2
  77. package/dist-server/server/botPlugins/connectedApps.js +3 -2
  78. package/dist-server/server/chatCache.js +3 -2
  79. package/dist-server/server/chatPresentation.js +32 -0
  80. package/dist-server/server/chatTranscriptApi.js +2 -1
  81. package/dist-server/server/config.js +2 -0
  82. package/dist-server/server/credentialVault/adapterExecutor.js +23 -0
  83. package/dist-server/server/credentialVault/botAccess.js +161 -0
  84. package/dist-server/server/credentialVault/broker.js +61 -6
  85. package/dist-server/server/credentialVault/coordinator.js +109 -14
  86. package/dist-server/server/credentialVault/localClient.js +191 -0
  87. package/dist-server/server/credentialVault/localExecutor.js +15 -0
  88. package/dist-server/server/credentialVault/protectedExecutor.js +3 -19
  89. package/dist-server/server/credentialVault/schema.js +11 -4
  90. package/dist-server/server/credentialVault/sshExecutor.js +111 -15
  91. package/dist-server/server/credentialVault/store.js +11 -5
  92. package/dist-server/server/credentialVault/transport.js +5 -1
  93. package/dist-server/server/dashboardCommand.js +62 -0
  94. package/dist-server/server/dashboardController.js +117 -25
  95. package/dist-server/server/jsonCompression.js +29 -0
  96. package/dist-server/server/routes.js +19 -1
  97. package/dist-server/server/runnerHub.js +12 -1
  98. package/dist-server/server/security.js +2 -1
  99. package/dist-server/server/updateManager.js +42 -10
  100. package/dist-server/server/workspaceRoutes.js +30 -4
  101. package/dist-server/server/workspaceSync.js +22 -4
  102. package/dist-server/shared/botProviderLogos.js +61 -0
  103. package/dist-server/shared/desktopUpdate.js +1 -0
  104. package/package.json +1 -1
  105. package/release.json +3 -3
  106. package/dist/assets/BotPluginsDialog-Ckiwmito.js +0 -2
  107. package/dist/assets/BotPluginsDialog-Ckiwmito.js.map +0 -1
  108. package/dist/assets/BotPluginsDialog-Db5dTqvg.css +0 -1
  109. package/dist/assets/ChatView-C_7_7olu.css +0 -1
  110. package/dist/assets/ChatView-znZF8RZE.js +0 -2
  111. package/dist/assets/ChatView-znZF8RZE.js.map +0 -1
  112. package/dist/assets/FloatingResourceSearch-c6l1JuAA.js +0 -9
  113. package/dist/assets/WorkspaceShell-Dhm3r61t.js +0 -44
  114. package/dist/assets/WorkspaceShell-Dhm3r61t.js.map +0 -1
  115. package/dist/assets/WorkspaceShell-Dk003lIq.css +0 -1
  116. package/dist/assets/viewModels-CYJ8m5Uf.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"FilesView-D7tA6Nu1.js","names":[],"sources":["../../src/client/components/library/LibraryGrid.vue","../../src/client/components/library/LibraryGrid.vue","../../src/client/api/files.ts","../../src/client/stores/files.ts","../../src/client/views/FilesView.vue","../../src/client/views/FilesView.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","import type { FileKind, FileLibraryPage } from '@shared/types'\nimport { apiRequest, apiUrl, unwrapData } from './client'\nimport { normalizeFile, number, record, values } from '@/utils/normalize'\n\nexport interface FileQuery {\n search?: string\n kind?: FileKind | 'all'\n profile?: string\n conversationOnly?: boolean\n cursor?: string\n limit?: number\n}\n\nexport async function getFiles(query: FileQuery = {}): Promise<FileLibraryPage> {\n const serverKind = query.kind === 'image' || query.kind === 'video' ? query.kind : undefined\n const payload = unwrapData(await apiRequest<unknown>(apiUrl('/api/app/files', {\n search: query.search,\n kind: serverKind,\n profile: query.profile,\n conversationOnly: query.conversationOnly || undefined,\n cursor: query.cursor,\n limit: Math.max(1, Math.min(100, query.limit ?? 50)),\n })))\n const source = record(payload)\n const responseProfile = typeof source.profile === 'string' ? source.profile : query.profile\n return {\n items: values(source.items ?? source.files ?? payload)\n .map(item => normalizeFile(item, responseProfile)).filter(file => file.id),\n nextCursor: typeof source.nextCursor === 'string' ? source.nextCursor : typeof source.next_cursor === 'string' ? source.next_cursor : null,\n total: number(source.total) || undefined,\n }\n}\n\nexport function fileDownloadUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/download`, { profile })\n}\n\nexport function filePreviewUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/preview`, { profile })\n}\n","import { computed, ref, shallowRef, watch } from 'vue'\nimport { defineStore } from 'pinia'\nimport type { FileKind, FileLibraryItem } from '@shared/types'\nimport { getFiles } from '@/api/files'\nimport { useAuthStore } from './auth'\n\nexport const useFilesStore = defineStore('files', () => {\n const auth = useAuthStore()\n const items = shallowRef<FileLibraryItem[]>([])\n const nextCursor = ref<string>()\n const hasMore = ref(true)\n const isLoading = ref(false)\n const error = ref<string>()\n const query = ref('')\n const kindFilter = ref<FileKind | 'all'>('all')\n const profile = ref<string>()\n const visitedCursors = new Set<string>()\n let loadGeneration = 0\n\n const filteredItems = computed<FileLibraryItem[]>(() => items.value.filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value))\n\n async function load(reset = true): Promise<void> {\n if (isLoading.value && !reset) return\n const generation = ++loadGeneration\n if (reset) {\n items.value = []\n nextCursor.value = undefined\n hasMore.value = true\n visitedCursors.clear()\n } else if (!hasMore.value) return\n isLoading.value = true\n error.value = undefined\n try {\n const existing = new Map(items.value.map(item => [item.id, item]))\n let cursor = reset ? undefined : nextCursor.value\n let pages = 0\n while (pages < 20) {\n const cursorKey = cursor ?? '<first-page>'\n if (visitedCursors.has(cursorKey)) {\n hasMore.value = false\n error.value = '文件分页返回了重复游标,已停止加载'\n break\n }\n visitedCursors.add(cursorKey)\n const page = await getFiles({\n search: query.value.trim() || undefined,\n kind: kindFilter.value,\n profile: profile.value,\n cursor,\n limit: 50,\n })\n if (generation !== loadGeneration) return\n for (const item of page.items) existing.set(item.id, item)\n pages += 1\n cursor = page.nextCursor ?? undefined\n nextCursor.value = cursor\n hasMore.value = Boolean(cursor)\n const matching = [...existing.values()].filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value).length\n if (!cursor || kindFilter.value === 'all' || matching >= 50) break\n }\n items.value = [...existing.values()]\n } catch (cause) {\n if (generation === loadGeneration) error.value = cause instanceof Error ? cause.message : '文件库加载失败'\n } finally {\n if (generation === loadGeneration) isLoading.value = false\n }\n }\n\n const reset = () => load(true)\n watch(() => auth.user?.id, () => {\n loadGeneration += 1\n items.value = []\n profile.value = undefined\n nextCursor.value = undefined\n visitedCursors.clear()\n isLoading.value = false\n error.value = undefined\n }, { flush: 'sync' })\n const loadMore = () => load(false)\n return { items, filteredItems, nextCursor, hasMore, isLoading, error, query, kindFilter, profile, load, reset, loadMore }\n})\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n"],"mappings":"8kCAiBA,IAAM,EAAO,EAOb,SAAS,EAAQ,EAAqB,CAEpC,OADI,EAAK,OAAS,YAAc,EAAK,OAAS,OAAS,EAAK,OAAS,QAAU,EAAK,OAAS,OAAe,OACrG,EAAK,IACd,CAEA,SAAS,EAAU,EAAqB,CACtC,MAAQ,CAAE,MAAO,KAAM,MAAO,KAAM,MAAO,KAAM,IAAK,KAAM,SAAU,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,IAAK,EAAY,EAAK,KAC9I,CAEA,SAAS,EAAW,EAAe,CAIjC,OAHI,IAAS,IAAA,GAAkB,GAC3B,EAAO,KAAa,GAAG,EAAK,IAC5B,EAAO,QAAoB,IAAI,EAAO,KAAA,CAAM,QAAQ,CAAC,EAAE,KACpD,IAAI,EAAO,KAAO,KAAA,CAAM,QAAQ,CAAC,EAAE,IAC5C,CAEA,SAAS,EAAW,EAAgC,CAClD,GAAI,CAAC,EAAO,MAAO,GACnB,IAAM,EAAO,aAAiB,KAAO,EAAQ,IAAI,KAAK,CAAK,EAE3D,OADI,OAAO,MAAM,EAAK,QAAQ,CAAC,EAAU,GAClC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EAAG,OAAQ,EAAA,MAAgB,UAAS"}
1
+ {"version":3,"file":"FilesView-AjaCIyCs.js","names":[],"sources":["../../src/client/components/library/LibraryGrid.vue","../../src/client/components/library/LibraryGrid.vue","../../src/client/api/files.ts","../../src/client/stores/files.ts","../../src/client/views/FilesView.vue","../../src/client/views/FilesView.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","<script setup lang=\"ts\">\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport EmptyState from '@/components/common/EmptyState.vue'\nimport type { UiLibraryItem } from './types'\n\nwithDefaults(defineProps<{\n items: UiLibraryItem[]\n selectedId?: string\n loading?: boolean\n hasMore?: boolean\n emptyTitle?: string\n emptyDescription?: string\n kind?: 'files' | 'artifacts'\n}>(), {\n selectedId: '', loading: false, hasMore: false, emptyTitle: '暂无文件', emptyDescription: '这里会显示来自 Hermes 的文件。', kind: 'files',\n})\n\nconst emit = defineEmits<{\n select: [item: UiLibraryItem]\n loadMore: []\n addToComposer: [item: UiLibraryItem]\n source: [item: UiLibraryItem]\n}>()\n\nfunction iconFor(item: UiLibraryItem) {\n if (item.kind === 'document' || item.kind === 'pdf' || item.kind === 'code' || item.kind === 'text') return 'file'\n return item.kind\n}\n\nfunction kindLabel(item: UiLibraryItem) {\n return ({ image: '图片', video: '视频', audio: '音频', pdf: '文档', document: '文档', code: '文档', text: '文档', link: '网页', file: '其他' } as const)[item.kind]\n}\n\nfunction formatSize(size?: number) {\n if (size === undefined) return ''\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`\n return `${(size / 1024 / 1024).toFixed(1)} MB`\n}\n\nfunction formatDate(value?: string | number | Date) {\n if (!value) return ''\n const date = value instanceof Date ? value : new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n return new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(date)\n}\n</script>\n\n<template>\n <div class=\"library-scroll\">\n <div v-if=\"loading && !items.length\" class=\"library-skeleton\">\n <i v-for=\"n in 10\" :key=\"n\" :style=\"{ opacity: .95 - n * .04 }\" />\n </div>\n <EmptyState v-else-if=\"!items.length\" :icon=\"kind === 'files' ? 'files' : 'artifacts'\" :title=\"emptyTitle\" :description=\"emptyDescription\" />\n <div v-else class=\"library-grid\">\n <article\n v-for=\"item in items\"\n :key=\"item.id\"\n :class=\"{ selected: item.id === selectedId }\"\n tabindex=\"0\"\n @click=\"emit('select', item)\"\n @keydown.enter=\"emit('select', item)\"\n >\n <div class=\"library-thumb\" :class=\"`library-thumb--${item.kind}`\">\n <img v-if=\"item.kind === 'image' && item.previewUrl\" :src=\"item.previewUrl\" :alt=\"item.name\" loading=\"lazy\" />\n <video v-else-if=\"item.kind === 'video' && item.previewUrl\" :src=\"item.previewUrl\" muted preload=\"metadata\" />\n <span v-else><AppIcon :name=\"iconFor(item)\" :size=\"36\" /><em>{{ item.name.split('.').at(-1)?.slice(0, 5).toUpperCase() }} · {{ kindLabel(item) }}</em></span>\n <div class=\"library-thumb__actions\">\n <button type=\"button\" title=\"加入输入框\" aria-label=\"加入输入框\" @click.stop=\"emit('addToComposer', item)\"><AppIcon name=\"plus\" :size=\"14\" /></button>\n <button v-if=\"item.sourceSessionId\" type=\"button\" title=\"查看来源\" aria-label=\"查看来源\" @click.stop=\"emit('source', item)\"><AppIcon name=\"external\" :size=\"14\" /></button>\n </div>\n </div>\n <div class=\"library-copy\">\n <strong :title=\"item.name\">{{ item.title || item.name }}</strong>\n <span><small>{{ item.sourceLabel || formatSize(item.size) || item.kind }}</small><time>{{ formatDate(item.updatedAt || item.createdAt) }}</time></span>\n </div>\n </article>\n </div>\n <button v-if=\"hasMore\" class=\"load-more\" type=\"button\" :disabled=\"loading\" @click=\"emit('loadMore')\">{{ loading ? '加载中…' : '加载更多' }}</button>\n </div>\n</template>\n\n<style scoped>\n.library-scroll { min-height: 0; flex: 1; overflow-y: auto; padding: 20px clamp(18px, 3vw, 36px) 32px; }\n.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }\narticle { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; outline: 0; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; } article:focus-visible, article.selected { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); } article:hover { border-color: var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-1px); }\n.library-thumb { position: relative; display: grid; height: 154px; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-soft); color: var(--text-muted); }\n.library-thumb img, .library-thumb video { width: 100%; height: 100%; object-fit: cover; }\n.library-thumb > span { display: flex; flex-direction: column; align-items: center; gap: 7px; }.library-thumb > span em { max-width: 150px; overflow: hidden; color: var(--text-muted); font-size: 11px; font-style: normal; letter-spacing: .02em; text-overflow: ellipsis; text-transform: capitalize; }\n.library-thumb--code, .library-thumb--text { background: linear-gradient(135deg, var(--surface-soft), var(--surface-raised)); }.library-thumb--link { border-style: dashed; }\n.library-thumb__actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 140ms var(--ease-out); }.library-thumb:hover .library-thumb__actions, article:focus-within .library-thumb__actions { opacity: 1; transform: translateY(0); }.library-thumb__actions button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(255,255,255,.32); border-radius: 8px; background: rgba(25,25,24,.72); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }\n.library-copy { padding: 10px 12px 9px; }.library-copy strong { display: block; overflow: hidden; font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }.library-copy > span { display: flex; margin-top: 5px; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; }.library-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.library-copy time { flex: 0 0 auto; }\n.load-more { display: block; margin: 28px auto 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 10px; }.load-more:hover { background: var(--surface-hover); }\n.library-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 12px; }.library-skeleton i { height: 208px; border-radius: 11px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-hover), var(--surface-soft)); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n@media (max-width: 600px) { .library-scroll { padding: 16px 12px 30px; }.library-grid, .library-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }.library-thumb { height: 122px; }.library-thumb__actions { opacity: 1; transform: none; }.library-copy { padding: 8px 9px; }.library-copy strong { font-size: 11px; }.library-copy > span { font-size: 9px; } }\n</style>\n","import type { FileKind, FileLibraryPage } from '@shared/types'\nimport { apiRequest, apiUrl, unwrapData } from './client'\nimport { normalizeFile, number, record, values } from '@/utils/normalize'\n\nexport interface FileQuery {\n search?: string\n kind?: FileKind | 'all'\n profile?: string\n conversationOnly?: boolean\n cursor?: string\n limit?: number\n}\n\nexport async function getFiles(query: FileQuery = {}): Promise<FileLibraryPage> {\n const serverKind = query.kind === 'image' || query.kind === 'video' ? query.kind : undefined\n const payload = unwrapData(await apiRequest<unknown>(apiUrl('/api/app/files', {\n search: query.search,\n kind: serverKind,\n profile: query.profile,\n conversationOnly: query.conversationOnly || undefined,\n cursor: query.cursor,\n limit: Math.max(1, Math.min(100, query.limit ?? 50)),\n })))\n const source = record(payload)\n const responseProfile = typeof source.profile === 'string' ? source.profile : query.profile\n return {\n items: values(source.items ?? source.files ?? payload)\n .map(item => normalizeFile(item, responseProfile)).filter(file => file.id),\n nextCursor: typeof source.nextCursor === 'string' ? source.nextCursor : typeof source.next_cursor === 'string' ? source.next_cursor : null,\n total: number(source.total) || undefined,\n }\n}\n\nexport function fileDownloadUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/download`, { profile })\n}\n\nexport function filePreviewUrl(id: string, profile?: string): string {\n return apiUrl(`/api/app/files/${encodeURIComponent(id)}/preview`, { profile })\n}\n","import { computed, ref, shallowRef, watch } from 'vue'\nimport { defineStore } from 'pinia'\nimport type { FileKind, FileLibraryItem } from '@shared/types'\nimport { getFiles } from '@/api/files'\nimport { useAuthStore } from './auth'\n\nexport const useFilesStore = defineStore('files', () => {\n const auth = useAuthStore()\n const items = shallowRef<FileLibraryItem[]>([])\n const nextCursor = ref<string>()\n const hasMore = ref(true)\n const isLoading = ref(false)\n const error = ref<string>()\n const query = ref('')\n const kindFilter = ref<FileKind | 'all'>('all')\n const profile = ref<string>()\n const visitedCursors = new Set<string>()\n let loadGeneration = 0\n\n const filteredItems = computed<FileLibraryItem[]>(() => items.value.filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value))\n\n async function load(reset = true): Promise<void> {\n if (isLoading.value && !reset) return\n const generation = ++loadGeneration\n if (reset) {\n items.value = []\n nextCursor.value = undefined\n hasMore.value = true\n visitedCursors.clear()\n } else if (!hasMore.value) return\n isLoading.value = true\n error.value = undefined\n try {\n const existing = new Map(items.value.map(item => [item.id, item]))\n let cursor = reset ? undefined : nextCursor.value\n let pages = 0\n while (pages < 20) {\n const cursorKey = cursor ?? '<first-page>'\n if (visitedCursors.has(cursorKey)) {\n hasMore.value = false\n error.value = '文件分页返回了重复游标,已停止加载'\n break\n }\n visitedCursors.add(cursorKey)\n const page = await getFiles({\n search: query.value.trim() || undefined,\n kind: kindFilter.value,\n profile: profile.value,\n cursor,\n limit: 50,\n })\n if (generation !== loadGeneration) return\n for (const item of page.items) existing.set(item.id, item)\n pages += 1\n cursor = page.nextCursor ?? undefined\n nextCursor.value = cursor\n hasMore.value = Boolean(cursor)\n const matching = [...existing.values()].filter(item => kindFilter.value === 'all' || item.kind === kindFilter.value).length\n if (!cursor || kindFilter.value === 'all' || matching >= 50) break\n }\n items.value = [...existing.values()]\n } catch (cause) {\n if (generation === loadGeneration) error.value = cause instanceof Error ? cause.message : '文件库加载失败'\n } finally {\n if (generation === loadGeneration) isLoading.value = false\n }\n }\n\n const reset = () => load(true)\n watch(() => auth.user?.id, () => {\n loadGeneration += 1\n items.value = []\n profile.value = undefined\n nextCursor.value = undefined\n visitedCursors.clear()\n isLoading.value = false\n error.value = undefined\n }, { flush: 'sync' })\n const loadMore = () => load(false)\n return { items, filteredItems, nextCursor, hasMore, isLoading, error, query, kindFilter, profile, load, reset, loadMore }\n})\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useRouter } from 'vue-router'\nimport type { FileKind } from '@shared/types'\nimport AppIcon from '@/components/common/AppIcon.vue'\nimport LibraryGrid from '@/components/library/LibraryGrid.vue'\nimport PreviewModal from '@/components/library/PreviewModal.vue'\nimport ImagePreviewLightbox from '@/components/library/ImagePreviewLightbox.vue'\nimport type { PreviewMedia } from '@/components/library/ImagePreviewLightbox.vue'\nimport type { LibraryFilterOption, UiLibraryItem } from '@/components/library/types'\nimport ResourceSidebar from '@/components/app/ResourceSidebar.vue'\nimport WorkspaceView from '@/components/workspace/WorkspaceView.vue'\nimport { fileToUi, sessionSidebarItem } from '@/components/workspace/viewModels'\nimport { useFilesStore } from '@/stores/files'\nimport { useAuthStore } from '@/stores/auth'\nimport { useChatStore } from '@/stores/chat'\n\nconst files = useFilesStore()\nconst auth = useAuthStore()\nconst chat = useChatStore()\nconst router = useRouter()\nconst selected = ref<UiLibraryItem | null>(null)\nconst mediaIndex = ref<number | null>(null)\nconst historySearch = ref('')\nlet searchTimer: number | undefined\n\nconst items = computed(() => files.filteredItems.map(fileToUi))\nconst lightboxMedia = computed(() => items.value.filter(item => item.kind === 'image' || item.kind === 'video').map(item => ({ url: item.previewUrl || item.downloadUrl || '', name: item.name, type: item.kind as 'image' | 'video' })).filter(item => item.url))\nconst agentNames = computed(() => new Map(auth.profiles.map(profile => [profile.name, profile.agentName || profile.displayName || profile.name])))\nconst historyItems = computed(() => chat.sessions\n .filter(session => !['cron', 'ios_group'].includes(session.source))\n .filter(session => !historySearch.value.trim() || `${session.title} ${session.preview || ''}`.toLocaleLowerCase().includes(historySearch.value.trim().toLocaleLowerCase()))\n .map(session => sessionSidebarItem(session, chat.unreadCounts[session.id] ?? 0, agentNames.value.get(session.profile || auth.activeProfile?.name || ''))))\nconst options = computed<LibraryFilterOption[]>(() => {\n const count = (kind: string) => files.items.filter(item => item.kind === kind).length\n return [\n { id: 'all', label: '全部', count: files.items.length, icon: 'files' },\n { id: 'image', label: '图片', count: count('image'), icon: 'image' },\n { id: 'video', label: '视频', count: count('video'), icon: 'video' },\n { id: 'audio', label: '音频', count: count('audio'), icon: 'audio' },\n { id: 'document', label: '文档', count: count('document'), icon: 'file' },\n { id: 'other', label: '其他', count: count('other'), icon: 'file' },\n ]\n})\n\nfunction updateSearch(value: string) {\n files.query = value\n window.clearTimeout(searchTimer)\n searchTimer = window.setTimeout(() => void files.load(true), 260)\n}\n\nfunction updateFilter(value: string) {\n files.kindFilter = value as FileKind | 'all'\n void files.load(true)\n}\n\nasync function openSource(item: UiLibraryItem) {\n if (item.sourceWorkspaceConversationId) {\n await router.push(`/conversations/${encodeURIComponent(item.sourceWorkspaceConversationId)}`)\n return\n }\n if (!item.sourceSessionId) return\n if (item.sourceProfile && auth.profiles.some(profile => profile.name === item.sourceProfile)) {\n auth.selectProfile(item.sourceProfile)\n }\n await router.push({\n path: `/chat/${encodeURIComponent(item.sourceSessionId)}`,\n query: {\n ...(item.sourceMessageId ? { message: item.sourceMessageId } : {}),\n ...(item.sourceProfile ? { profile: item.sourceProfile } : {}),\n },\n })\n}\n\nfunction selectFile(item: UiLibraryItem) {\n if (item.kind === 'image' || item.kind === 'video') {\n const index = lightboxMedia.value.findIndex(media => media.url === (item.previewUrl || item.downloadUrl))\n mediaIndex.value = index >= 0 ? index : null\n return\n }\n selected.value = item\n}\n\nasync function selectSession(id: string) {\n const session = chat.sessions.find(item => item.id === id)\n const profile = session?.profile || auth.activeProfile?.name\n await router.push({ path: `/chat/${encodeURIComponent(id)}`, query: profile ? { profile } : {} })\n}\n\nonMounted(() => {\n files.profile = undefined\n void files.load(true)\n void chat.loadSessions(auth.activeProfile?.name)\n void chat.loadUnread(auth.activeProfile?.name)\n})\nonBeforeUnmount(() => window.clearTimeout(searchTimer))\nwatch(() => files.items, () => {\n if (selected.value && !files.items.some(item => item.id === selected.value?.id)) selected.value = null\n})\nwatch(() => auth.activeProfile?.name, profile => {\n selected.value = null\n files.profile = profile\n void files.load(true)\n void chat.loadSessions(profile)\n void chat.loadUnread(profile)\n})\n</script>\n\n<template>\n <WorkspaceView sidebar-title=\"历史记录\" :sidebar-subtitle=\"`${chat.sessions.length} 个会话`\">\n <template #sidebar>\n <ResourceSidebar\n :items=\"historyItems\"\n :active-id=\"chat.activeSessionId\"\n :loading=\"chat.isLoading\"\n :search=\"historySearch\"\n single-line\n search-placeholder=\"搜索会话\"\n empty-title=\"还没有会话\"\n empty-description=\"原生 Hermes 会话会在这里以只读历史显示。\"\n @search=\"historySearch = $event\"\n @select=\"selectSession\"\n />\n </template>\n <section class=\"library-workspace\">\n <header class=\"library-header\">\n <div><h2>文件库</h2><span><AppIcon name=\"files\" :size=\"15\" />{{ items.length }}</span></div>\n <label class=\"file-search\"><AppIcon name=\"search\" :size=\"15\" /><input :value=\"files.query\" type=\"search\" placeholder=\"搜索文件名、路径或会话\" @input=\"updateSearch(($event.target as HTMLInputElement).value)\" /></label>\n </header>\n <nav class=\"file-tabs\" aria-label=\"文件类型筛选\">\n <button v-for=\"option in options\" :key=\"option.id\" type=\"button\" :class=\"{ active: option.id === files.kindFilter }\" @click=\"updateFilter(option.id)\">{{ option.label }}<small v-if=\"option.count !== undefined\">{{ option.count }}</small></button>\n <div class=\"file-tabs__status\"><span v-if=\"files.error\" class=\"error\"><AppIcon name=\"alert\" :size=\"13\" />{{ files.error }}</span><span v-else>{{ files.nextCursor ? '还有更多文件可加载' : items.length ? '已同步到最新' : '' }}</span><button class=\"icon-button\" type=\"button\" aria-label=\"刷新文件库\" title=\"刷新文件库\" :disabled=\"files.isLoading\" @click=\"files.load(true)\"><AppIcon name=\"refresh\" :size=\"15\" /></button></div>\n </nav>\n <LibraryGrid\n :items=\"items\"\n :selected-id=\"selected?.id\"\n :loading=\"files.isLoading\"\n :has-more=\"files.hasMore\"\n empty-title=\"文件库还是空的\"\n empty-description=\"聊天中的图片、文档和附件会出现在这里。\"\n @select=\"selectFile\"\n @load-more=\"files.loadMore\"\n @source=\"openSource\"\n />\n </section>\n </WorkspaceView>\n <PreviewModal v-if=\"selected\" :item=\"selected\" :items=\"items\" :can-add-to-composer=\"false\" @close=\"selected = null\" @source=\"openSource\" />\n <ImagePreviewLightbox v-model=\"mediaIndex\" :images=\"lightboxMedia\" :can-add=\"false\" />\n</template>\n\n<style scoped>\n.library-workspace { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }\n.library-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line); }.library-header > div { display: flex; align-items: center; gap: 10px; }.library-header h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }.library-header span { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 10px; }.file-search { display: flex; width: min(280px, 38vw); min-height: 32px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text-muted); }.file-search:focus-within { border-color: var(--line-strong); }.file-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text-primary); font-size: 11px; }\n.file-tabs { display: flex; min-height: 46px; align-items: center; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }.file-tabs > button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 10px; white-space: nowrap; }.file-tabs > button:hover, .file-tabs > button.active { background: var(--surface-soft); color: var(--text-primary); }.file-tabs > button.active { font-weight: 650; }.file-tabs > button small { margin-left: 4px; color: var(--text-muted); font-size: 8px; }.file-tabs__status { display: flex; min-width: 0; align-items: center; gap: 7px; margin-left: auto; color: var(--text-muted); font-size: 9px; white-space: nowrap; }.file-tabs__status > span { overflow: hidden; text-overflow: ellipsis; }.file-tabs__status .error { color: var(--danger); }.file-tabs__status .icon-button { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); cursor: pointer; }.file-tabs__status .icon-button:hover { background: var(--surface-soft); color: var(--text-primary); }\n@media (max-width: 600px) { .library-header { min-height: 52px; padding: 0 13px; }.library-header h2 { font-size: 14px; }.file-search { width: min(180px, 52vw); }.file-tabs { padding: 0 13px; }.file-tabs__status { display: none; } }\n</style>\n"],"mappings":"8kCAiBA,IAAM,EAAO,EAOb,SAAS,EAAQ,EAAqB,CAEpC,OADI,EAAK,OAAS,YAAc,EAAK,OAAS,OAAS,EAAK,OAAS,QAAU,EAAK,OAAS,OAAe,OACrG,EAAK,IACd,CAEA,SAAS,EAAU,EAAqB,CACtC,MAAQ,CAAE,MAAO,KAAM,MAAO,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KAAK,UAAW,KAAM,gBAE1X,EAUE,GAAA,CATC,MAAO,EAAA,MACP,cAAa,EAAA,OAAU,GACvB,QAAS,EAAA,CAAA,CAAK,CAAC,UACf,WAAU,EAAA,CAAA,CAAK,CAAC,QACjB,cAAY,UACZ,oBAAkB,sBACjB,SAAQ,EACR,WAAW,EAAA,CAAA,CAAK,CAAC,SACjB,SAAQ,sGAIK,EAAA,OAApB,EAAA,EAAA,EAA2I,EAAA,OAA5G,KAAM,EAAA,MAAW,MAAO,EAAA,MAAQ,sBAAqB,GAAQ,QAAK,AAAA,EAAA,KAAA,GAAE,EAAA,MAAQ,KAAU,SAAQ,sCAC7H,EAAsF,EAAA,CAAvD,WAAA,EAAA,MAAA,sBAAA,AAAA,EAAA,KAAA,GAAA,EAAU,MAAA,EAAG,OAAQ,EAAA,MAAgB,UAAS"}
@@ -0,0 +1,9 @@
1
+ import{A as e,D as t,F as n,G as r,H as i,L as a,M as o,R as s,W as c,_ as l,a as u,at as d,ct as f,d as p,et as m,f as h,g,h as _,l as v,m as y,n as b,nt as x,ot as S,p as C,s as ee,st as w,t as T,u as E,v as D,x as O,y as k}from"./_plugin-vue_export-helper-CscYwSBt.js";import{A as te,F as A,X as j,i as M,q as N,r as P}from"./index-DU4OTLup.js";import{m as F,v as I,x as ne,y as L}from"./viewModels-BLN4GfVX.js";var R={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 24 24`},re=O({name:`At`,render:function(e,t){return n(),l(`svg`,R,t[0]||=[y(`g`,{fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[y(`circle`,{cx:`12`,cy:`12`,r:`4`}),y(`path`,{d:`M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28`})],-1)])}}),z={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 24 24`},B=O({name:`Target`,render:function(e,t){return n(),l(`svg`,z,t[0]||=[y(`g`,{fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[y(`circle`,{cx:`12`,cy:`12`,r:`1`}),y(`circle`,{cx:`12`,cy:`12`,r:`5`}),y(`circle`,{cx:`12`,cy:`12`,r:`9`})],-1)])}}),ie={class:`composer-area`},ae={key:0,class:`composer-reference`},oe={class:`composer-activity-slot`},se={key:0,class:`composer-activity`,role:`status`,"aria-label":`机器人输入状态`,"aria-live":`polite`,"aria-atomic":`true`},ce={key:0,class:`composer-sending`,role:`status`,"aria-live":`polite`},le=[`title`],ue={key:0},de={key:1},fe={key:2},pe={key:3},me={key:1,class:`composer-attachments`,"aria-label":`附件`},he=[`src`,`alt`],ge=[`aria-label`,`onClick`],_e=[`disabled`,`placeholder`],ve={class:`composer-toolbar`},ye={class:`composer-tools`},be=[`disabled`,`aria-expanded`],xe={key:0,class:`composer-popover composer-add-menu`,role:`menu`,"aria-label":`添加到消息`},Se=[`disabled`],Ce=[`disabled`],we=[`disabled`,`title`],Te=[`disabled`],Ee={key:3,class:`composer-popover-anchor`},De=[`disabled`,`title`,`aria-label`,`aria-expanded`],Oe={key:0,class:`composer-popover composer-popover--reasoning`,role:`dialog`,"aria-label":`推理强度`},ke={class:`composer-popover__heading`},Ae=[`max`,`value`],je={class:`composer-popover__range`},Me={key:4,class:`composer-popover-anchor`},Ne=[`disabled`,`aria-expanded`],Pe={key:0,class:`composer-popover composer-popover--settings`,role:`dialog`,"aria-label":`输入设置`},Fe=[`aria-checked`],Ie=[`disabled`],Le=[`disabled`,`title`],Re=[`disabled`,`aria-pressed`,`aria-label`],ze=[`disabled`],Be={class:`composer-actions`},Ve={key:0,class:`composer-queue-slot`},He=[`title`],Ue={key:1,class:`composer-stop-hitbox`},We={class:`composer-send-hitbox`},Ge=[`disabled`,`aria-label`],Ke={key:0,class:`composer-menu`,role:`listbox`},qe={class:`composer-menu__label`},Je=[`aria-selected`,`disabled`,`onMousedown`,`onMouseenter`],Ye={class:`composer-menu__avatar`},Xe={key:0},Ze={key:0},Qe={key:2,class:`composer-drop-hint`},$e={key:0,class:`composer-error`,role:`alert`},et=26214400,tt=8,nt=T(O({__name:`ComposerShell`,props:{mode:{default:`chat`},draftKey:{default:``},placeholder:{default:`输入消息,Enter 发送,Shift + Enter 换行`},disabled:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1},stopWhileRunning:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},modelLabel:{default:`选择模型`},fastMode:{type:Boolean,default:!1},fastModeDisabled:{type:Boolean,default:!1},reasoningEffort:{default:`默认`},reasoningValue:{default:``},reasoningOptions:{default:()=>[]},contextUsed:{default:0},contextLimit:{default:0},contextPercent:{},showContext:{type:Boolean,default:!1},queueMode:{type:Boolean,default:!1},toolTraceVisible:{type:Boolean,default:!0},reference:{default:null},mentionOptions:{default:()=>[]},slashCommands:{default:()=>[]},attachmentsEnabled:{type:Boolean,default:!0},activityText:{default:``},deliveryAvailable:{type:Boolean,default:!1},deliveryMode:{type:Boolean,default:!1},deliveryDisabled:{type:Boolean,default:!1},deliveryDisabledReason:{default:``}},emits:[`send`,`stop`,`modelClick`,`fastModeToggle`,`reasoningChange`,`settingsClick`,`queueToggle`,`toolTraceToggle`,`clearReference`,`error`,`update:deliveryMode`],setup(u,{expose:h,emit:x}){let T=u,O=x,A=m(``),M=m(null),N=m(null),P=m([]),F=m(!1),I=m(0),ne=C(()=>I.value>0),L=m(null),R=m(0),z=m(null),nt=m(``),V=m([]),H=m(!1),U=m(!1),W=m(!1),rt=m(null),it=m(null),at=C(()=>T.mode===`group`&&(T.mentionOptions.length>0||T.deliveryAvailable)),ot=m(``),st,ct=C(()=>!T.disabled&&!T.sending&&(A.value.trim().length>0||P.value.length>0)),lt=C(()=>T.streaming&&(T.stopWhileRunning||T.mode===`chat`)),G=C(()=>lt.value&&!A.value.trim()&&!P.value.length),ut=C(()=>T.modelLabel.split(`/`).filter(Boolean).at(-1)||T.modelLabel),dt=C(()=>Math.max(0,Math.min(100,T.contextPercent??(T.contextLimit>0?Math.round(T.contextUsed/T.contextLimit*100):0)))),K=C(()=>T.contextUsed>0),ft=C(()=>T.showContext||T.contextLimit>0||K.value),pt=C(()=>Math.max(0,T.contextLimit-T.contextUsed)),mt=C(()=>Math.max(0,T.reasoningOptions.findIndex(e=>e.id===T.reasoningValue))),ht=C(()=>T.reasoningOptions[mt.value]?.label||T.reasoningEffort),q=C(()=>{let e=z.value===`slash`?T.slashCommands:T.mentionOptions,t=nt.value.trim().toLocaleLowerCase();return e.filter(e=>!t||e.label.toLocaleLowerCase().includes(t)||e.detail?.toLocaleLowerCase().includes(t)).slice(0,10)});function J(e=T.draftKey){return e?`hermes-yaoyao:composer:${T.mode}:${e}`:``}let gt=!1,_t=!1,Y=new Map;i([A,P,V],()=>{if(_t&&!gt){let e=J();Y.set(e,(Y.get(e)??0)+1)}},{deep:!0,flush:`sync`});function vt(){_t=!0;let e=J();return{key:e,revision:Y.get(e)??0}}function yt(){let e=J();gt=!0;try{A.value=e&&localStorage.getItem(e)||``}finally{gt=!1}t(Z)}function bt(e){let t=J();t&&(e?localStorage.setItem(t,e):localStorage.removeItem(t))}function X(e){ot.value=e,O(`error`,e),window.clearTimeout(st),st=window.setTimeout(()=>{ot.value=``},4500)}function xt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function St(e){return e.startsWith(`image/`)}function Ct(e){if(!T.attachmentsEnabled){X(`当前上游不支持团队附件`);return}let t=tt-P.value.length;if(t<=0)return X(`最多添加 ${tt} 个文件`);let n=[];for(let r of e.slice(0,t)){if(r.size>et){X(`${r.name} 超过 25 MiB`);continue}n.push({id:`${r.name}:${r.size}:${r.lastModified}:${te(`attachment`)}`,file:r,name:r.name,size:r.size,type:r.type||`application/octet-stream`,previewUrl:St(r.type)?URL.createObjectURL(r):void 0})}P.value.push(...n),e.length>t&&X(`最多添加 ${tt} 个文件`)}function wt(e){let t=P.value.findIndex(t=>t.id===e);if(t<0)return;let[n]=P.value.splice(t,1);n?.previewUrl&&URL.revokeObjectURL(n.previewUrl)}function Tt(){P.value.forEach(e=>e.previewUrl&&URL.revokeObjectURL(e.previewUrl)),P.value=[],N.value&&(N.value.value=``)}function Et(e){let t=e.target;Ct(Array.from(t.files??[])),t.value=``}function Dt(e){let t=Array.from(e.clipboardData?.files??[]);t.length&&Ct(t)}function Ot(e){e.dataTransfer?.types.includes(`Files`)&&(e.preventDefault(),I.value+=1)}function kt(e){e.dataTransfer?.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`))}function At(e){e.preventDefault(),I.value=Math.max(0,I.value-1)}function jt(e){e.preventDefault(),I.value=0,Ct(Array.from(e.dataTransfer?.files??[]))}function Z(){let e=M.value;!e||L.value!==null||(e.style.height=`auto`,e.style.height=`${Math.min(400,Math.max(30,e.scrollHeight))}px`)}function Mt(){L.value=null,M.value&&(M.value.style.height=`auto`),t(Z)}function Nt(e){let t=M.value;if(!t)return;e.preventDefault();let n=e.clientY,r=t.clientHeight,i=e.pointerId,a=e.currentTarget;a.setPointerCapture(i);let o=e=>{L.value=Math.min(400,Math.max(30,r-(e.clientY-n)))},s=()=>{a.removeEventListener(`pointermove`,o),a.removeEventListener(`pointerup`,s),a.removeEventListener(`pointercancel`,s)};a.addEventListener(`pointermove`,o),a.addEventListener(`pointerup`,s),a.addEventListener(`pointercancel`,s)}function Pt(){let e=M.value;if(!e||F.value)return;let t=A.value.slice(0,e.selectionStart);if(t.startsWith(`/`)&&!t.includes(` `)&&!t.includes(`
2
+ `)&&T.slashCommands.length){z.value=`slash`,nt.value=t.slice(1),R.value=0;return}if(T.mode===`group`&&T.mentionOptions.length){let e=t.match(/(?<![A-Za-z0-9_.%+/@-])@([^\s@]*)$/u);if(e&&!/https?:\/\/\S*$/u.test(t)){z.value=`mention`,nt.value=e[1]??``,R.value=0;return}}z.value=null}function Ft(){W.value=!W.value,H.value=!1,U.value=!1,z.value=null,W.value&&t(()=>rt.value?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus())}function Q(e=!1){W.value=!1,e&&it.value?.focus()}function It(e){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),Q(!0);else if(e.key===`Tab`)Q(!0);else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){e.preventDefault();let t=Array.from(rt.value?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]),n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowUp`?-1:1)+t.length)%t.length]?.focus()}}function Lt(){Q(!0),N.value?.click()}function Rt(){Q();let e=M.value;if(!e)return;let n=e.selectionStart,r=A.value.slice(0,n),i=`${r&&!/\s$/.test(r)?` `:``}@`;A.value=r+i+A.value.slice(e.selectionEnd),t(()=>{e.focus(),e.setSelectionRange(n+i.length,n+i.length),Pt(),Z()})}function zt(e){T.disabled||T.deliveryDisabled||T.sending||(O(`update:deliveryMode`,e),Q(),t(()=>M.value?.focus()))}function Bt(e){if(e.disabled)return;let n=M.value;if(!n)return;let r=n.selectionStart,i=A.value.slice(0,r),a=A.value.slice(r);if(z.value===`slash`){let r=e.insertText??`/${e.label} `;A.value=r+a,t(()=>n.setSelectionRange(r.length,r.length))}else{let o=i.match(/(?<![A-Za-z0-9_.%+/@-])@([^\s@]*)$/u),s=o?r-o[0].length:r,c=A.value.slice(0,s),l=`@${e.label} `;A.value=c+l+a,e.id!==`all`&&!V.value.includes(e.id)&&V.value.push(e.id),t(()=>{let e=c.length+l.length;n.setSelectionRange(e,e)})}z.value=null,t(()=>{n.focus(),Z()})}function Vt(e){if(z.value&&q.value.length){if(e.key===`ArrowDown`){e.preventDefault(),R.value=(R.value+1)%q.value.length;return}if(e.key===`ArrowUp`){e.preventDefault(),R.value=(R.value-1+q.value.length)%q.value.length;return}if(e.key===`Escape`){e.preventDefault(),z.value=null;return}if(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey){e.preventDefault();let t=q.value[R.value];t&&Bt(t);return}}e.key!==`Enter`||e.shiftKey||F.value||e.isComposing||e.keyCode===229||(e.preventDefault(),Ut())}function Ht(){requestAnimationFrame(()=>{F.value=!1,Pt()})}function Ut(){if(!ct.value)return;let e={text:A.value.trim(),files:P.value.map(e=>e.file),mentionIds:[...V.value]};O(`send`,e),t(()=>M.value?.focus())}function Wt(e){if(e){if((Y.get(e.key)??0)!==e.revision)return!1;if(e.key!==J())return e.key&&localStorage.removeItem(e.key),!1}return A.value=``,V.value=[],bt(``),Tt(),Mt(),t(()=>M.value?.focus()),!0}function Gt(e){e.target.closest(`button, input, textarea, [role="option"], .composer-resize`)||M.value?.focus()}function $(e){return e>=1048576?`${(e/1048576).toFixed(1)}m`:e>=1024?`${(e/1024).toFixed(1)}k`:`${e}`}function Kt(e){let t=Number(e.target.value),n=T.reasoningOptions[t];n&&O(`reasoningChange`,n.id)}function qt(e){let t=e.target;rt.value?.contains(t)||Q(),t.closest(`.composer-shell`)||(z.value=null,H.value=!1,U.value=!1)}return i(A,e=>{bt(e),t(Z)}),i(()=>T.draftKey,()=>{yt(),H.value=!1,U.value=!1,W.value=!1}),i(()=>T.disabled,e=>{e&&Q()}),o(()=>{yt(),document.addEventListener(`pointerdown`,qt)}),e(()=>{Tt(),window.clearTimeout(st),document.removeEventListener(`pointerdown`,qt)}),h({attachFiles:Ct,filesSnapshot:()=>P.value.map(e=>e.file),focus:()=>M.value?.focus(),clearAfterSend:Wt,submissionToken:vt}),(e,t)=>(n(),l(`div`,ie,[u.reference?(n(),l(`div`,ae,[k(j,{name:`quote`,size:14}),y(`span`,null,[y(`small`,null,f(u.reference.author?`回复 ${u.reference.author}`:`回复消息`),1),y(`strong`,null,f(u.reference.content.replace(/\s+/g,` `).trim()),1)]),y(`button`,{type:`button`,"aria-label":`取消引用`,onClick:t[0]||=e=>O(`clearReference`)},[k(j,{name:`close`,size:13})])])):g(``,!0),y(`div`,oe,[s(e.$slots,`activity`,{},()=>[k(b,{name:`composer-activity`},{default:c(()=>[u.activityText?(n(),l(`div`,se,[t[17]||=y(`span`,{class:`composer-typing-dots`,"aria-hidden":`true`},[y(`i`),y(`i`),y(`i`)],-1),y(`strong`,null,f(u.activityText),1)])):g(``,!0)]),_:1})],!0),u.sending?(n(),l(`span`,ce,[...t[18]||=[y(`i`,null,null,-1),D(`正在发送`,-1)]])):g(``,!0)]),s(e.$slots,`before-input`,{},void 0,!0),y(`div`,{class:S([`composer-shell`,{"composer-shell--drag":ne.value,"composer-shell--disabled":u.disabled}]),onMousedown:Gt,onDragenter:Ot,onDragover:kt,onDragleave:At,onDrop:jt},[y(`input`,{ref_key:`fileInput`,ref:N,class:`composer-file-input`,type:`file`,multiple:``,onChange:Et},null,544),y(`div`,{class:`composer-resize`,title:`拖动调整高度;双击复位`,onPointerdown:Nt,onDblclick:Mt},null,32),ft.value?(n(),l(`div`,{key:0,class:S([`composer-context`,{warning:K.value&&dt.value>80}]),title:K.value?`最近一次模型请求的上下文用量`:`等待服务端提供最近一次模型请求的上下文用量`},[K.value?u.contextLimit>0?(n(),l(`span`,de,f($(u.contextUsed))+` / `+f($(u.contextLimit))+` · 剩余 `+f($(pt.value)),1)):(n(),l(`span`,fe,`当前上下文 `+f($(u.contextUsed))+` · 窗口未确认`,1)):(n(),l(`span`,ue,`等待本轮实际用量 · `+f(u.contextLimit>0?`窗口 ${$(u.contextLimit)}`:`窗口未确认`),1)),K.value&&u.contextLimit>0?(n(),l(`i`,pe,[y(`b`,{style:w({width:`${dt.value}%`})},null,4)])):g(``,!0)],10,le)):g(``,!0),P.value.length?(n(),l(`div`,me,[(n(!0),l(p,null,a(P.value,e=>(n(),l(`div`,{key:e.id,class:S([`composer-attachment`,{image:St(e.type)}])},[e.previewUrl?(n(),l(`img`,{key:0,src:e.previewUrl,alt:e.name},null,8,he)):(n(),_(j,{key:1,name:`file`,size:19})),y(`span`,null,[y(`strong`,null,f(e.name),1),y(`small`,null,f(xt(e.size)),1)]),y(`button`,{type:`button`,"aria-label":`移除 ${e.name}`,onClick:t=>wt(e.id)},[k(j,{name:`close`,size:12})],8,ge)],2))),128))])):g(``,!0),r(y(`textarea`,{ref_key:`textarea`,ref:M,"onUpdate:modelValue":t[1]||=e=>A.value=e,class:`composer-textarea`,style:w(L.value===null?void 0:{height:`${L.value}px`}),rows:`1`,disabled:u.disabled,placeholder:u.deliveryAvailable&&u.deliveryMode?`描述希望团队交付的结果…`:u.placeholder,onInput:Pt,onClick:Pt,onKeydown:Vt,onPaste:Dt,onCompositionstart:t[2]||=e=>F.value=!0,onCompositionend:Ht},null,44,_e),[[ee,A.value]]),y(`div`,ve,[y(`div`,ye,[at.value?(n(),l(`div`,{key:0,ref_key:`actionsAnchor`,ref:rt,class:`composer-popover-anchor composer-actions-anchor`,onKeydown:It},[y(`button`,{ref_key:`actionsTrigger`,ref:it,class:`composer-tool composer-add`,type:`button`,disabled:u.disabled,"aria-label":`添加`,"aria-haspopup":`menu`,"aria-expanded":W.value,onClick:Ft,onKeydown:t[3]||=v(E(e=>!W.value&&Ft(),[`prevent`]),[`down`])},[k(j,{name:`plus`,size:20})],40,be),k(b,{name:`composer-menu`},{default:c(()=>[W.value?(n(),l(`div`,xe,[y(`button`,{type:`button`,role:`menuitem`,disabled:!u.attachmentsEnabled,onClick:Lt},[k(j,{name:`paperclip`,size:20}),t[19]||=y(`span`,null,`添加附件`,-1)],8,Se),u.mentionOptions.length?(n(),l(`button`,{key:0,type:`button`,role:`menuitem`,onClick:Rt},[k(d(re),{class:`composer-action-icon`,"aria-hidden":`true`}),t[20]||=y(`span`,null,`提及成员`,-1)])):g(``,!0),u.deliveryAvailable?(n(),l(p,{key:1},[t[22]||=y(`div`,{class:`composer-add-menu__divider`,role:`separator`},null,-1),y(`button`,{type:`button`,role:`menuitem`,disabled:u.deliveryDisabled||u.sending,onClick:t[4]||=e=>zt(!u.deliveryMode)},[k(d(B),{class:`composer-action-icon`,"aria-hidden":`true`}),y(`span`,null,[t[21]||=y(`strong`,null,`交付目标`,-1),y(`small`,null,f(u.deliveryDisabledReason||(u.deliveryMode?`已开启;点击返回普通聊天`:`让团队持续完成一个结果`)),1)]),u.deliveryMode?(n(),_(j,{key:0,name:`check`,size:16})):g(``,!0)],8,Ce)],64)):g(``,!0)])):g(``,!0)]),_:1})],544)):(n(),l(`button`,{key:1,class:`composer-tool composer-tool--icon`,type:`button`,disabled:u.disabled||!u.attachmentsEnabled,title:u.attachmentsEnabled?`添加附件`:`当前上游不支持附件`,"aria-label":`添加附件`,onClick:t[5]||=e=>N.value?.click()},[k(j,{name:`paperclip`,size:16})],8,we)),u.deliveryAvailable&&u.deliveryMode?(n(),l(`button`,{key:2,class:`composer-delivery-chip`,type:`button`,disabled:u.disabled||u.deliveryDisabled||u.sending,"aria-label":`关闭交付目标,返回普通聊天`,title:`关闭交付目标,返回普通聊天`,onClick:t[6]||=e=>zt(!1)},[k(d(B),{class:`composer-action-icon`,"aria-hidden":`true`}),t[23]||=y(`span`,null,`交付目标`,-1),k(j,{name:`close`,size:15})],8,Te)):g(``,!0),u.mode===`chat`?(n(),l(`div`,Ee,[y(`button`,{class:S([`composer-tool`,{active:H.value}]),type:`button`,disabled:u.disabled||!u.reasoningOptions.length,title:`推理强度:${ht.value}`,"aria-label":`推理强度:${ht.value}`,"aria-expanded":H.value,onClick:t[7]||=e=>{H.value=!H.value,U.value=!1}},[k(j,{name:`brain`,size:16}),y(`span`,null,f(ht.value),1),k(j,{name:`chevron-down`,size:11})],10,De),k(b,{name:`composer-menu`},{default:c(()=>[H.value?(n(),l(`div`,Oe,[y(`div`,ke,[t[24]||=y(`span`,null,`推理强度`,-1),y(`strong`,null,f(ht.value),1)]),y(`input`,{class:`reasoning-slider`,type:`range`,min:0,max:Math.max(0,u.reasoningOptions.length-1),step:`1`,value:mt.value,onInput:Kt},null,40,Ae),y(`div`,je,[y(`span`,null,f(u.reasoningOptions[0]?.label||`默认`),1),y(`span`,null,f(u.reasoningOptions.at(-1)?.label||`最大`),1)])])):g(``,!0)]),_:1})])):g(``,!0),u.mode===`chat`?(n(),l(`div`,Me,[y(`button`,{class:S([`composer-tool`,{active:U.value}]),type:`button`,disabled:u.disabled,title:`设置`,"aria-label":`设置`,"aria-expanded":U.value,onClick:t[8]||=e=>{U.value=!U.value,H.value=!1}},[k(j,{name:`settings`,size:16}),t[25]||=y(`span`,null,`设置`,-1),k(j,{name:`chevron-down`,size:11})],10,Ne),k(b,{name:`composer-menu`},{default:c(()=>[U.value?(n(),l(`div`,Pe,[y(`button`,{class:`composer-setting-row`,type:`button`,role:`switch`,"aria-checked":u.toolTraceVisible,onClick:t[9]||=e=>O(`settingsClick`)},[y(`span`,null,[k(j,{name:`brain`,size:15}),t[26]||=D(`显示思考`,-1)]),u.toolTraceVisible?(n(),_(j,{key:0,name:`check`,size:16})):g(``,!0)],8,Fe),y(`button`,{class:`composer-setting-row`,type:`button`,title:`首版暂未启用语音输入`,onClick:t[10]||=e=>X(`语音输入尚未启用`)},[...t[27]||=[y(`span`,null,`语音输入设置`,-1)]])])):g(``,!0)]),_:1})])):(n(),l(`button`,{key:5,class:S([`composer-tool`,{active:u.toolTraceVisible}]),type:`button`,disabled:u.disabled,title:`显示思考`,onClick:t[11]||=e=>O(`toolTraceToggle`)},[k(j,{name:`brain`,size:16}),t[28]||=y(`span`,null,`思考`,-1)],10,Ie)),u.mode===`chat`?(n(),l(`button`,{key:6,class:`composer-tool composer-tool--model`,type:`button`,disabled:u.disabled,title:u.modelLabel,onClick:t[12]||=e=>O(`modelClick`)},[k(j,{name:`model`,size:15}),y(`span`,null,f(ut.value),1),k(j,{name:`chevron-down`,size:11})],8,Le)):g(``,!0),u.mode===`chat`?(n(),l(`button`,{key:7,class:S([`composer-tool composer-tool--icon composer-fast-mode`,{active:u.fastMode}]),type:`button`,disabled:u.disabled||u.fastModeDisabled,"aria-pressed":u.fastMode,"aria-label":`快速模式:${u.fastMode?`已开启`:`已关闭`}`,title:`快速模式:响应更快,消耗更多额度`,onClick:t[13]||=e=>O(`fastModeToggle`,!u.fastMode)},[k(j,{name:`bolt`,size:15})],10,Re)):u.mentionOptions.length?(n(),l(`button`,{key:8,type:`button`,class:`composer-tool composer-mention-hint`,disabled:u.disabled,"aria-label":`提及成员`,onClick:Rt},[k(d(re),{class:`composer-action-icon`,"aria-hidden":`true`}),t[29]||=y(`span`,null,`提及成员`,-1)],8,ze)):g(``,!0)]),y(`div`,Be,[u.mode===`chat`?(n(),l(`span`,Ve,[u.streaming&&ct.value?(n(),l(`button`,{key:0,class:S([`queue-toggle`,{active:u.queueMode}]),type:`button`,title:u.queueMode?`消息将排队发送`:`消息将 Steer 当前会话`,onClick:t[14]||=e=>O(`queueToggle`)},f(u.queueMode?`排队`:`Steer`),11,He)):g(``,!0)])):g(``,!0),u.stopWhileRunning||u.mode===`chat`?(n(),l(`span`,Ue,[lt.value&&!G.value?(n(),l(`button`,{key:0,class:`composer-stop`,type:`button`,"aria-label":`停止生成`,title:`停止生成`,onClick:t[15]||=e=>O(`stop`)},[k(j,{name:`stop`,size:15})])):g(``,!0)])):g(``,!0),y(`span`,We,[y(`button`,{class:S([`composer-send`,{"composer-send--stop":G.value}]),type:`button`,disabled:!G.value&&!ct.value,"aria-label":G.value?`停止生成`:`发送消息`,onClick:t[16]||=e=>G.value?O(`stop`):Ut()},[k(j,{name:G.value?`stop`:`arrow-up`,size:(G.value,17)},null,8,[`name`,`size`])],10,Ge)])])]),k(b,{name:`composer-menu`},{default:c(()=>[z.value&&q.value.length?(n(),l(`div`,Ke,[y(`div`,qe,f(z.value===`mention`?`提及机器人`:`命令`),1),(n(!0),l(p,null,a(q.value,(e,t)=>(n(),l(`button`,{key:e.id,type:`button`,role:`option`,"aria-selected":t===R.value,disabled:e.disabled,class:S({active:t===R.value}),onMousedown:E(t=>Bt(e),[`prevent`]),onMouseenter:e=>R.value=t},[y(`span`,Ye,f(z.value===`mention`?e.label.slice(0,1).toUpperCase():`/`),1),y(`span`,null,[y(`strong`,null,f(z.value===`mention`?`@${e.label}`:`/${e.label}`),1),e.detail?(n(),l(`small`,Xe,f(e.detail),1)):g(``,!0)]),e.disabled?(n(),l(`em`,Ze,`不可用`)):g(``,!0)],42,Je))),128))])):g(``,!0)]),_:1}),ne.value?(n(),l(`div`,Qe,[k(j,{name:`paperclip`,size:20}),t[30]||=D(`松开以添加附件`,-1)])):g(``,!0)],34),k(b,{name:`composer-menu`},{default:c(()=>[ot.value?(n(),l(`p`,$e,f(ot.value),1)):g(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-41dd5183`]]),V=new Set([`apng`,`avif`,`bmp`,`gif`,`heic`,`heif`,`ico`,`jfif`,`jpeg`,`jpg`,`jxl`,`png`,`svg`,`tif`,`tiff`,`webp`]),H=new Set([`avi`,`m4v`,`mkv`,`mov`,`mp4`,`mpeg`,`mpg`,`webm`]);function U(e,t,n=`local:${t}`,r){let i=e.split(`.`).at(-1)?.toLocaleLowerCase()||``,a=V.has(i)?`image`:H.has(i)?`video`:[`mp3`,`wav`,`m4a`,`aac`,`ogg`].includes(i)?`audio`:i===`pdf`?`pdf`:[`md`,`markdown`,`txt`,`json`,`yaml`,`yml`,`csv`,`js`,`ts`,`py`,`sh`].includes(i)?`text`:`file`;return{id:n,name:e,kind:r||a,previewUrl:t,downloadUrl:t}}function W(e){try{let t=new URL(e,window.location.origin);return t.origin===window.location.origin&&t.pathname===`/api/files/download`&&(t.searchParams.delete(`_retry`),t.searchParams.sort()),t.origin===window.location.origin&&(t.pathname=t.pathname.replace(/(\/api\/app\/files\/[^/]+)\/(?:preview|download)$/,`$1`)),t.href}catch{return e}}function rt(e){try{let t=new URL(e,window.location.origin);return(t.pathname===`/api/files/download`?t.searchParams.get(`path`)||t.pathname:decodeURIComponent(t.pathname)).split(`/`).at(-1)||`媒体`}catch{return`媒体`}}function it(e){let t=[],n=new Set,r=e=>{if(!e.previewUrl||![`image`,`video`].includes(e.kind))return;let r=W(e.previewUrl);n.has(r)||(n.add(r),t.push(e))},i=new ne({html:!1}),a=i.validateLink;i.validateLink=e=>!!N(e)||a(e);for(let t of e){if(![`user`,`assistant`].includes(t.role)&&!t.communication)continue;let e=e=>{let n=t.attachments?.find(t=>t.id===e);n?.url&&[`image`,`video`].includes(n.kind||`file`)&&r(U(n.name,n.url,`${t.id}:${n.id}`,n.kind))},n=e=>{if(t.role===`user`)return;let n=L(e,t.status===`streaming`);for(let e of i.parse(n,{}))for(let n of e.children??[]){let e=n.type===`image`?n.attrGet(`src`):n.type===`link_open`?n.attrGet(`href`):null;if(!e)continue;let i=N(e,t.profile)||e,a=t.attachments?.find(e=>e.url&&W(e.url)===W(i));r(U(a?.name||rt(i),i,`${t.id}:${i}`,a?.kind))}};if(t.contentParts?.length)for(let r of t.contentParts)`text`in r?n(r.text):e(r.attachmentId);else n(t.content);for(let n of t.attachments??[])e(n.id)}return t}function at(t,n){let r,i=new Set,a=()=>{let e=t.value;if(!e||document.hidden||!document.hasFocus()){i.clear();return}let r=e.getBoundingClientRect(),a=new Set;for(let t of e.querySelectorAll(`[data-message-id]`)){let e=t.getBoundingClientRect(),n=Math.max(e.top,r.top,0),i=Math.min(e.bottom,r.bottom,innerHeight),o=Math.max(e.left,r.left,0),s=Math.min(e.right,r.right,innerWidth);if(i-n<Math.min(24,e.height)||s<=o)continue;let c=document.elementFromPoint((o+s)/2,(n+i)/2);c&&t.contains(c)&&t.dataset.messageId&&a.add(t.dataset.messageId)}let o=[...a].filter(e=>i.has(e));i=a,o.length&&n(o)};o(()=>{r=setInterval(a,350)}),e(()=>{clearInterval(r),i.clear()})}var ot={class:`system-message-notice`},st=[`href`,`aria-label`],ct={key:1},lt=[`aria-label`],G={role:`status`},ut={class:`system-message-notice__details`},dt={key:2,class:`system-message-notice__label`,role:`status`},K=T(O({__name:`SystemMessageNotice`,props:{title:{},icon:{},href:{},accessibleLabel:{}},setup(e){return(t,r)=>(n(),l(`div`,ot,[e.href?(n(),l(`a`,{key:0,class:`system-message-notice__label`,href:e.href,"aria-label":e.accessibleLabel||e.title},[k(j,{name:e.icon||`info`,size:16,"aria-hidden":`true`},null,8,[`name`]),y(`span`,null,f(e.title),1)],8,st)):t.$slots.default?(n(),l(`details`,ct,[y(`summary`,{class:`system-message-notice__label`,"aria-label":e.accessibleLabel||`${e.title},查看详情`},[k(j,{name:e.icon||`info`,size:16,"aria-hidden":`true`},null,8,[`name`]),y(`span`,G,f(e.title),1)],8,lt),y(`div`,ut,[s(t.$slots,`default`,{},void 0,!0)])])):(n(),l(`div`,dt,[k(j,{name:e.icon||`info`,size:16,"aria-hidden":`true`},null,8,[`name`]),y(`span`,null,f(e.title),1)]))]))}}),[[`__scopeId`,`data-v-fd32abae`]]),ft={key:0,class:`service-warnings`,"aria-label":`服务状态提示`},pt=O({__name:`ServiceWarnings`,props:{warnings:{}},setup(e){return(t,r)=>e.warnings.length?(n(),l(`div`,ft,[(n(!0),l(p,null,a(e.warnings,(e,t)=>(n(),_(K,{key:`${e.service}:${e.code}:${t}`,title:`${e.service}:${e.message}`,icon:`info`},null,8,[`title`]))),128))])):g(``,!0)}}),mt={key:0},ht=T(O({__name:`MessageFailureNotice`,props:{failure:{}},setup(e){return(t,r)=>(n(),_(K,{class:`failure-notice`,title:e.failure.title,icon:`info`},{default:c(()=>[y(`p`,null,f(e.failure.hint),1),e.failure.detail?(n(),l(`pre`,mt,f(e.failure.detail),1)):g(``,!0)]),_:1},8,[`title`]))}}),[[`__scopeId`,`data-v-739155c5`]]),q=/^执行失败[::]\s*/;function J(e){if(e.communication||e.taskReference||e.role===`tool`||e.status!==`failed`&&!e.error?.trim())return;let t=e.content.trim(),n=e.role!==`user`&&e.status===`failed`&&q.test(t),r=e.error?.trim()||(n?t.replace(q,``):``);if(!r&&e.status!==`failed`)return;let i=e.role===`assistant`&&e.status===`failed`&&t.includes(`Provider said:`)&&/didn[’']t respond in time on any of \d+ attempts/.test(t),a=e.role!==`user`&&(n||i||!!r&&t===r||!t),o=[...new Set([a?t.replace(q,``):``,r].filter(Boolean))].filter((e,t,n)=>!n.some((n,r)=>r!==t&&n.includes(e))).join(`
3
+
4
+ `),s=/timeout|timed?\s*out|no SSE events|didn[’']t respond in time|超时/i.test(r||o);return{title:e.role===`user`?`消息未发送`:s?`响应超时`:`回复暂时中断`,hint:e.role===`user`?`请检查连接后重新发送。`:`请稍后重试,或切换模型。`,detail:o,key:r||o,replacesContent:a}}function gt(e){return e.filter((t,n)=>{let r=e[n-1];if(!r||r.role!==`assistant`||t.role!==`system`||!/^执行失败[::]/.test(t.content))return!0;let i=J(t),a=J(r);if(!i?.key||i.key!==a?.key||t.attachments?.length||t.tools?.length||t.reasoning)return!0;if(t.runId&&r.runId)return t.runId!==r.runId;let o=new Date(t.createdAt??``).getTime(),s=new Date(r.createdAt??``).getTime();return!Number.isFinite(o)||!Number.isFinite(s)||o<s||o-s>2e3})}var _t=O({__name:`TaskResultNotice`,props:{content:{},taskReference:{}},setup(e){let t=e,r=C(()=>t.content.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!/^\[打开任务\]\(/.test(e))),i=C(()=>t.content.includes(`等待管理员复核`)),a=C(()=>i.value?`任务已有新结果`:t.content.includes(`已完成`)?`任务已完成`:`任务状态已更新`),o=C(()=>{let e=r.value[0]?.match(/^「([^」]+)」的任务「([^」]+)」/);return e?`${e[1]} · ${e[2]}`:r.value[0]||`团队交付任务`}),s=C(()=>i.value?`等待管理员复核后继续`:r.value.slice(1).join(` `)||`打开任务查看完整交付与验收状态`),c=C(()=>`/conversations/${encodeURIComponent(t.taskReference.conversationId)}?taskId=${encodeURIComponent(t.taskReference.taskId)}`);return(e,t)=>(n(),_(K,{class:`task-result-notice`,title:a.value,icon:i.value?`file`:`check`,href:c.value,"accessible-label":`${a.value},${o.value},${s.value},打开任务`},null,8,[`title`,`icon`,`href`,`accessible-label`]))}});function Y(e){if(e.communication||e.role===`user`)return;if(e.timelineKind===`delegation-complete`)return{title:`子任务已完成`,icon:`groups`};if(e.timelineKind===`background-process`){let t=e.timelineMetadata?.exit_code;return{title:e.timelineMetadata?.signal?`后台子任务已终止`:t==null?`后台子任务已结束`:Number(t)===0?`后台子任务已完成`:`后台子任务失败`,icon:`tools`}}if(e.role!==`system`&&e.timelineKind!==`system`)return;let t=e.content.trim();if(e.timelineMetadata?.eventKind===`compaction`||/^\[context compaction/i.test(t))return{title:`上下文已压缩`,icon:`archive`};if(/^(?:由管理员分派的子任务|(?:已)?分派(?:了)?(?:终审|子)?任务)/.test(t))return{title:`已分派子任务`,icon:`branch`};if(/^执行失败[::]/.test(t))return{title:/timeout|timed?\s*out|超时|no SSE events/i.test(t)?`响应超时`:`回复暂时中断`,icon:`info`};if(/^(?:回复重点|重点提示)[::]?/.test(t))return{title:`回复重点`,icon:`info`};if(/^(?:任务|子任务).*(?:已完成|完成通知)/.test(t.split(`
5
+ `)[0]||``))return{title:`任务已完成`,icon:`check`};let n=t.match(/(?:changed to|切换为)\s*([^\s,。\]]+?)(?=\s+via\b|\s*$|\])/i)?.[1];return{title:n?`模型已切换`:`系统提示`,icon:n?`settings`:`info`}}var vt={key:0},yt=O({__name:`MessageSystemEvent`,props:{message:{}},setup(e){let t=e,r=C(()=>Y(t.message)),i=C(()=>{let e=t.message.timelineMetadata;if(!e)return``;if(t.message.timelineKind===`delegation-complete`){let t=Number(e.completed_count??0),n=Number(e.failed_count??0),r=Number(e.duration_seconds??0),i=r>0?` · 耗时 ${Math.round(r)} 秒`:``;return`${Number(e.task_count)||t+n||1} 个子任务 · ${t} 已完成 · ${n} 失败${i}`}return t.message.timelineKind===`background-process`?[e.exit_code==null?``:`退出码:${e.exit_code}`,e.signal?`信号:${e.signal}`:``].filter(Boolean).join(` · `):``});return(t,a)=>r.value?(n(),_(K,{key:0,title:r.value.title,icon:r.value.icon},{default:c(()=>[i.value?(n(),l(`p`,vt,f(i.value),1)):g(``,!0),e.message.content?(n(),_(I,{key:1,"process-content":``,content:e.message.content},null,8,[`content`])):g(``,!0)]),_:1},8,[`title`,`icon`])):g(``,!0)}}),bt={class:`thinking-indicator`,role:`status`,"aria-live":`polite`,"aria-label":`机器人正在输入`,"data-testid":`chat-run-thinking-dots`},X={class:`thinking-indicator__dots`,"aria-hidden":`true`},xt=T(O({__name:`TypingIndicator`,props:{avatarName:{},avatar:{}},setup(e){return(t,r)=>(n(),l(`div`,bt,[k(M,{class:`thinking-indicator__avatar`,name:e.avatarName,avatar:e.avatar,size:20,state:`working`,"aria-hidden":`true`},null,8,[`name`,`avatar`]),y(`span`,X,[(n(),l(p,null,a(3,e=>y(`i`,{key:e,class:`thinking-indicator__dot`,style:w({"--dot-index":e-1})},null,4)),64))])]))}}),[[`__scopeId`,`data-v-c9d2172f`]]),St=[`aria-labelledby`],Ct={class:`interaction-card__heading`},wt={class:`interaction-card__icon`},Tt=[`id`],Et={key:0,class:`interaction-card__prompt`},Dt={key:1,class:`interaction-card__details`},Ot={key:2,class:`interaction-card__actions`},kt=[`disabled`],At=[`disabled`],jt={key:0,class:`interaction-card__options`},Z=[`value`,`disabled`,`onChange`],Mt={class:`interaction-card__custom`},Nt=[`for`],Pt={class:`interaction-card__custom-row`},Ft=[`id`,`disabled`],Q=[`disabled`],It=T(O({__name:`InteractionCard`,props:{interaction:{},busy:{type:Boolean}},emits:[`approve`,`clarify`],setup(e,{emit:t}){let o=e,s=t,c=m(``),d=m(``),h=C(()=>d.value.trim()||c.value);function v(e){c.value=e,d.value=``}function b(){!h.value||o.busy||s(`clarify`,h.value)}return i(()=>o.interaction.id,()=>{c.value=``,d.value=``}),(t,i)=>(n(),l(`section`,{class:S([`interaction-card`,`interaction-card--${e.interaction.kind}`]),"aria-live":`polite`,"aria-labelledby":`interaction-title-${e.interaction.id}`},[i[8]||=y(`span`,{class:`interaction-card__handle`,"aria-hidden":`true`},null,-1),y(`div`,Ct,[y(`span`,wt,[k(j,{name:e.interaction.kind===`approval`?`check`:`chat`,size:18},null,8,[`name`])]),y(`div`,null,[y(`small`,null,f(e.interaction.kind===`approval`?`需要审批`:`需要你的回答`),1),y(`strong`,{id:`interaction-title-${e.interaction.id}`},f(e.interaction.title||e.interaction.prompt),9,Tt)])]),e.interaction.title?(n(),l(`p`,Et,f(e.interaction.prompt),1)):g(``,!0),e.interaction.detail?(n(),l(`details`,Dt,[y(`summary`,null,[i[5]||=D(`查看详情`,-1),k(j,{name:`chevron-down`,size:13})]),y(`pre`,null,f(e.interaction.detail),1)])):g(``,!0),e.interaction.kind===`approval`?(n(),l(`div`,Ot,[y(`button`,{class:`quiet-button`,type:`button`,disabled:e.busy,onClick:i[0]||=e=>s(`approve`,!1)},`拒绝`,8,kt),y(`button`,{class:`solid-button`,type:`button`,disabled:e.busy,onClick:i[1]||=e=>s(`approve`,!0)},`允许`,8,At)])):(n(),l(`form`,{key:3,class:`interaction-card__answer`,onSubmit:E(b,[`prevent`])},[e.interaction.options?.length?(n(),l(`fieldset`,jt,[i[6]||=y(`legend`,null,`请选择一个回答`,-1),(n(!0),l(p,null,a(e.interaction.options,t=>(n(),l(`label`,{key:t,class:S({selected:c.value===t})},[r(y(`input`,{"onUpdate:modelValue":i[2]||=e=>c.value=e,type:`radio`,value:t,disabled:e.busy,onChange:e=>v(t)},null,40,Z),[[u,c.value]]),y(`span`,null,f(t),1),c.value===t?(n(),_(j,{key:0,name:`check`,size:15})):g(``,!0)],2))),128))])):g(``,!0),y(`div`,Mt,[y(`label`,{for:`interaction-answer-${e.interaction.id}`},`其他回答`,8,Nt),y(`div`,Pt,[r(y(`textarea`,{id:`interaction-answer-${e.interaction.id}`,"onUpdate:modelValue":i[3]||=e=>d.value=e,rows:`2`,disabled:e.busy,placeholder:`补充你的想法(可选)`,onInput:i[4]||=e=>c.value=``},null,40,Ft),[[ee,d.value]]),y(`button`,{class:`solid-button`,type:`submit`,disabled:e.busy||!h.value},[D(f(e.busy?`提交中…`:`提交回答`),1),e.busy?g(``,!0):(n(),_(j,{key:0,name:`arrow-up`,size:14}))],8,Q)])]),i[7]||=y(`small`,{class:`interaction-card__hint`},`选择预设答案,或输入你自己的回答`,-1)],32))],10,St))}}),[[`__scopeId`,`data-v-66a47616`]]),Lt={key:0},Rt={key:0,class:`tool-trace__details`},zt={key:0,role:`status`},Bt={key:2},Vt={key:3},Ht=T(O({__name:`ToolTrace`,props:{tool:{},expanded:{type:Boolean,default:!1}},setup(t){let r=t,a=m(r.expanded||r.tool.status===`error`),o=x(),s=m(!1),c=m(``),u;async function d(){let e=r.tool.detailsUrl;if(!a.value||!e||o.value||s.value)return;let t=new AbortController;u=t,s.value=!0,c.value=``;try{let n=await A(e,{signal:t.signal});u===t&&!t.signal.aborted&&(o.value=n)}catch(e){u===t&&!t.signal.aborted&&(c.value=e instanceof Error?e.message:`工具详情加载失败`)}finally{u===t&&(s.value=!1)}}i(()=>r.tool.detailsUrl,()=>{u?.abort(),u=void 0,o.value=void 0,s.value=!1,c.value=``,d()}),i(a,()=>{d()},{immediate:!0}),e(()=>u?.abort());let p=C(()=>({running:`运行中`,success:`完成`,error:`失败`,pending:`等待`,interrupted:`已结束,结果未确认`})[r.tool.status]);function h(e){if(e==null||e===``)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e??``)}}let _=C(()=>h(o.value?o.value.input:r.tool.input)),v=C(()=>h(o.value?o.value.output:r.tool.output));return i(()=>r.expanded,e=>{e&&(a.value=!0)}),(e,r)=>(n(),l(`div`,{class:S([`tool-trace`,`tool-trace--${t.tool.status}`])},[y(`button`,{type:`button`,onClick:r[0]||=e=>a.value=!a.value},[y(`strong`,null,f(t.tool.name),1),t.tool.status===`error`||t.tool.status===`interrupted`?(n(),l(`small`,Lt,f(p.value),1)):g(``,!0),y(`span`,{class:S([`tool-trace__caret`,{open:a.value}])},`›`,2)]),a.value&&(_.value||v.value||t.tool.detailsUrl)?(n(),l(`div`,Rt,[s.value?(n(),l(`small`,zt,`正在加载工具详情…`)):g(``,!0),c.value?(n(),l(`button`,{key:1,type:`button`,onClick:d},f(c.value)+`,点击重试`,1)):g(``,!0),_.value?(n(),l(`section`,Bt,[r[1]||=y(`small`,null,`输入`,-1),y(`pre`,null,f(_.value),1)])):g(``,!0),v.value?(n(),l(`section`,Vt,[r[2]||=y(`small`,null,`输出`,-1),y(`pre`,null,f(v.value),1)])):g(``,!0)])):g(``,!0)],2))}}),[[`__scopeId`,`data-v-1d132b69`]]),Ut={class:`turn-trace__summary`},Wt={class:`turn-trace__content`},Gt={key:0,class:`turn-trace__item turn-trace__reasoning`},$=T(O({__name:`TurnTrace`,props:{group:{},streamIntervalMs:{}},setup(e){let t=e,r=C(()=>t.group.entries.filter(e=>e.type===`reasoning`).length),i=C(()=>t.group.entries.filter(e=>e.type===`tool`).length),o=C(()=>[r.value?`${r.value} 段思考`:``,i.value?`${i.value} 个工具`:``].filter(Boolean).join(` · `)),s=C(()=>t.group.status===`running`?`进行中`:t.group.status===`error`?`有错误`:``);return(t,r)=>(n(),_(K,{class:`turn-trace`,icon:`brain`,title:e.group.status===`running`?`正在思考与使用工具`:e.group.status===`error`?`思考与工具出现错误`:`思考与工具`},{default:c(()=>[y(`p`,Ut,[D(f(o.value),1),s.value?(n(),l(p,{key:0},[D(` · `+f(s.value),1)],64)):g(``,!0)]),y(`div`,Wt,[(n(!0),l(p,null,a(e.group.entries,t=>(n(),l(p,{key:t.id},[t.type===`reasoning`?(n(),l(`section`,Gt,[y(`header`,null,[k(j,{name:`brain`,size:12}),D(`思考过程 · `+f(t.content.length)+` 字`,1)]),k(I,{"process-content":``,content:t.content,streaming:e.group.status===`running`,"stream-interval-ms":e.streamIntervalMs},null,8,[`content`,`streaming`,`stream-interval-ms`])])):(n(),_(Ht,{key:1,class:`turn-trace__item turn-trace__tool`,tool:t.tool,expanded:!t.tool.detailsUrl},null,8,[`tool`,`expanded`]))],64))),128))])]),_:1},8,[`title`]))}}),[[`__scopeId`,`data-v-cea5c2eb`]]);function Kt(e){return`${e.profile||``}\u0000${e.author||``}`}function qt(e){return!!(e.browserCard||e.serviceWarnings?.length||e.content.trim()||e.attachments?.length||e.error||e.status===`failed`)}function Jt(e,t){return e.some(e=>e.status===`failed`)||t.some(e=>e.type===`tool`&&e.tool.status===`error`)?`error`:e.some(e=>e.status===`streaming`)||t.some(e=>e.type===`tool`&&[`running`,`pending`].includes(e.tool.status))?`running`:`success`}function Yt(e,t,n){if(!t.length)return;let r=[];for(let e of t){e.reasoning?.trim()&&r.push({id:`reasoning:${e.id}`,type:`reasoning`,messageId:e.id,content:e.reasoning});for(let t of e.tools??[])r.push({id:`tool:${e.id}:${t.id}`,type:`tool`,messageId:e.id,tool:t})}r.length&&e.push({id:`trace:${t[0].id}`,kind:`trace`,entries:r,status:Jt(t,r)});for(let r of t){if(!qt(r))continue;let t=n?.get(r);t||(t={...r,reasoning:void 0,tools:void 0},n?.set(r,t)),e.push({id:`message:${r.id}`,kind:`message`,message:t})}}function Xt(e,t){let n=[],r=[],i=``,a=()=>{Yt(n,r,t),r=[],i=``};for(let t of gt(e)){if(t.role===`assistant`&&!t.timelineKind){let e=Kt(t);r.length&&e!==i&&a(),i=e,r.push(t),qt(t)&&a();continue}a(),n.push({id:`message:${t.id}`,kind:`message`,message:t})}return a(),n}var Zt=/(?:^|\n)--- Attached Context ---\s*\n/,Qt=/(?:^|\n)--- Context Warnings ---[\s\S]*$/,$t=/@(file|folder|url|image|tool|terminal):(?:"[^"\n]+"|'[^'\n]+'|`[^`\n]+`|\S+)/g;function en(e,t){if(e===`assistant`)return F(t);if(e!==`user`)return t;let n=t.match(Zt);if(!n||n.index===void 0)return t.replace(Qt,``).trim();let r=t.slice(0,n.index).replace(Qt,``).trim(),i=t.slice(n.index+n[0].length);return[[...new Set(Array.from(i.matchAll($t),e=>e[0]))].filter(e=>!r.includes(e)).join(`
6
+ `),r].filter(Boolean).join(`
7
+
8
+ `)||r}var tn=[`aria-label`,`onKeydown`],nn=[`placeholder`,`aria-label`],rn=[`aria-label`,`aria-selected`,`tabindex`,`aria-controls`,`onClick`],an={key:0,class:`floating-resource-search__navigation`,"aria-label":`搜索范围`},on={key:0,class:`floating-resource-search__navigation-heading`},sn=[`onClick`],cn=[`id`,`role`,`aria-label`],ln={key:0,class:`floating-resource-search__context`},un=[`role`],dn={key:0,class:`floating-resource-search__section`},fn=[`role`],pn=[`role`,`aria-haspopup`,`onClick`],mn={key:0,class:`floating-resource-search__icon floating-resource-search__icon--avatar`},hn={key:1,class:`floating-resource-search__icon`},gn={class:`floating-resource-search__copy`},_n={key:0},vn={key:2},yn={key:0},bn=`hermes-yaoyao:sidebar-search`,xn=`hermes-yaoyao:sidebar-search-close`,Sn=T(O({__name:`FloatingResourceSearch`,props:{section:{},label:{},items:{},split:{type:Boolean,default:!1},tabbed:{type:Boolean,default:!1}},emits:[`open`,`select`],setup(c,{emit:u}){let d=c,b=u,x=m(!1),w=m(``),T=m(null),O=m(null),te=m(null),A=null,N=m(``),F=C(()=>d.items.find(e=>e.id===N.value)),I=C(()=>F.value?.children??d.items),ne=C(()=>w.value.trim().toLocaleLowerCase()),L=C(()=>{let e=ne.value;return e?I.value.filter(t=>`${t.title} ${t.subtitle||``} ${t.meta||``}`.toLocaleLowerCase().includes(e)).slice(0,50):I.value.slice(0,50)}),R=C(()=>L.value.map((e,t)=>({item:e,hasChildren:e.children!==void 0,showSection:!!(e.section&&e.section!==L.value[t-1]?.section)}))),re=C(()=>d.items.map((e,t)=>({item:e,showSection:!!(e.section&&e.section!==d.items[t-1]?.section)})));async function z(e){e.detail?.section===d.section&&(w.value=``,A=document.activeElement instanceof HTMLElement?document.activeElement:null,N.value=(d.split||d.tabbed)&&d.items[0]?.id||``,x.value=!0,b(`open`),await t(),T.value?.focus())}function B(){x.value&&(x.value=!1,w.value=``,N.value=``,document.dispatchEvent(new CustomEvent(xn)),t(()=>{A?.isConnected&&A.focus()}))}async function ie(e){if(e.children!==void 0){N.value=e.id,d.tabbed||(w.value=``,await t(),T.value?.focus());return}b(`select`,e.id),B()}async function ae(){N.value=``,w.value=``,await t(),T.value?.focus()}function oe(e){let n=d.items.findIndex(e=>e.id===N.value);N.value=d.items[(n+e+d.items.length)%d.items.length]?.id||``,t(()=>te.value?.querySelector(`[aria-selected="true"]`)?.focus())}function se(e){let t=[...O.value?.querySelectorAll(`button:not(:disabled),input,[tabindex="0"]`)??[]].filter(e=>e.tabIndex>=0&&e.getClientRects().length>0);t.length&&(e.shiftKey&&document.activeElement===t[0]?(e.preventDefault(),t.at(-1)?.focus()):!e.shiftKey&&document.activeElement===t.at(-1)&&(e.preventDefault(),t[0]?.focus()))}return i(L,async()=>{await t(),x.value&&document.activeElement===document.body&&T.value?.focus()}),o(()=>{document.addEventListener(bn,z),document.addEventListener(xn,B)}),e(()=>{document.removeEventListener(bn,z),document.removeEventListener(xn,B)}),(e,t)=>(n(),_(h,{to:`body`},[x.value?(n(),l(`div`,{key:0,class:`floating-resource-search__backdrop`,onClick:E(B,[`self`])},[y(`section`,{ref_key:`panel`,ref:O,class:S([`floating-resource-search`,{"floating-resource-search--split":c.split}]),role:`dialog`,"aria-modal":`true`,"aria-label":c.label,onKeydown:[v(se,[`tab`]),v(E(B,[`prevent`]),[`esc`])]},[y(`header`,null,[F.value&&!c.split&&!c.tabbed?(n(),l(`button`,{key:0,class:`floating-resource-search__back`,type:`button`,"aria-label":`返回搜索结果`,onClick:ae},[k(j,{name:`chevron-left`,size:17})])):g(``,!0),y(`label`,null,[k(j,{name:`search`,size:18}),r(y(`input`,{ref_key:`input`,ref:T,"onUpdate:modelValue":t[0]||=e=>w.value=e,type:`search`,placeholder:c.tabbed?`搜索聊天名称或内容`:F.value?`搜索${F.value.title}`:c.label,"aria-label":c.tabbed?c.label:F.value?`搜索${F.value.title}`:c.label,onKeydown:t[1]||=v(E(e=>c.split||c.tabbed?B():F.value?ae():B(),[`stop`,`prevent`]),[`esc`])},null,40,nn),[[ee,w.value]])]),y(`button`,{type:`button`,"aria-label":`关闭搜索`,title:`关闭搜索`,onClick:B},[k(j,{name:`close`,size:17})])]),c.tabbed?(n(),l(`nav`,{key:0,ref_key:`categories`,ref:te,class:`floating-resource-search__tabs`,role:`tablist`,"aria-label":`聊天分类`,onKeydown:[t[2]||=v(E(e=>oe(-1),[`prevent`]),[`left`]),t[3]||=v(E(e=>oe(1),[`prevent`]),[`right`])]},[(n(!0),l(p,null,a(c.items,e=>(n(),l(`button`,{key:e.id,type:`button`,role:`tab`,"aria-label":e.title,"aria-selected":e.id===N.value,tabindex:e.id===N.value?0:-1,"aria-controls":`${c.section}-search-results`,onClick:t=>ie(e)},[D(f(e.title),1),y(`small`,null,f(e.children?.length??0),1)],8,rn))),128))],544)):g(``,!0),y(`div`,{class:S([`floating-resource-search__body`,{"floating-resource-search__body--split":c.split}])},[c.split?(n(),l(`nav`,an,[(n(!0),l(p,null,a(re.value,e=>(n(),l(p,{key:e.item.id},[e.showSection?(n(),l(`div`,on,f(e.item.section),1)):g(``,!0),y(`button`,{type:`button`,class:S({active:e.item.id===N.value}),onClick:t=>ie(e.item)},[e.item.icon?(n(),_(j,{key:0,name:e.item.icon,size:15},null,8,[`name`])):g(``,!0),y(`span`,null,f(e.item.title),1)],10,sn)],64))),128))])):g(``,!0),y(`section`,{id:`${c.section}-search-results`,class:`floating-resource-search__result-pane`,role:c.tabbed?`tabpanel`:void 0,"aria-label":c.tabbed?F.value?.title:void 0},[F.value&&!c.tabbed?(n(),l(`div`,ln,[y(`strong`,null,f(F.value.title),1),y(`span`,null,f(F.value.subtitle),1)])):g(``,!0),y(`div`,{class:`floating-resource-search__results`,role:e.$slots[`item-actions`]?`list`:`listbox`,"aria-label":`搜索结果`},[(n(!0),l(p,null,a(R.value,t=>(n(),l(p,{key:t.item.id},[t.showSection?(n(),l(`div`,dn,f(t.item.section),1)):g(``,!0),y(`div`,{class:`floating-resource-search__row`,role:e.$slots[`item-actions`]?`listitem`:`presentation`},[y(`button`,{class:`floating-resource-search__select`,type:`button`,role:e.$slots[`item-actions`]?void 0:`option`,"aria-haspopup":t.hasChildren?`listbox`:void 0,onClick:e=>ie(t.item)},[t.item.avatar!==void 0||t.item.avatarMembers?.length?(n(),l(`span`,mn,[t.item.avatarKind===`agent`?(n(),_(M,{key:0,name:t.item.title,avatar:t.item.avatar,state:t.item.avatarState,size:30},null,8,[`name`,`avatar`,`state`])):(n(),_(P,{key:1,name:t.item.title,avatar:t.item.avatar||``,members:t.item.avatarMembers||[],"fallback-key":t.item.avatarFallbackKey||t.item.id,size:30},null,8,[`name`,`avatar`,`members`,`fallback-key`]))])):t.item.icon?(n(),l(`span`,hn,[k(j,{name:t.item.icon,size:16},null,8,[`name`])])):g(``,!0),y(`span`,gn,[y(`strong`,null,f(t.item.title),1),t.item.subtitle?(n(),l(`small`,_n,f(t.item.subtitle),1)):g(``,!0)]),t.item.meta?(n(),l(`small`,vn,f(t.item.meta),1)):g(``,!0)],8,pn),s(e.$slots,`item-actions`,{item:t.item},void 0,!0)],8,fn)],64))),128)),L.value.length?g(``,!0):(n(),l(`p`,yn,f(F.value?.emptyText||(F.value?`暂无${F.value.title}内容`:`没有匹配结果`)),1))],8,un)],8,cn)],2),s(e.$slots,`footer`,{},void 0,!0)],42,tn)])):g(``,!0)]))}}),[[`__scopeId`,`data-v-171c037c`]]);export{U as _,Ht as a,yt as c,J as d,ht as f,W as g,it as h,$ as i,Y as l,at as m,en as n,It as o,pt as p,Xt as r,xt as s,Sn as t,_t as u,nt as v};
9
+ //# sourceMappingURL=FloatingResourceSearch-CeLuyNWO.js.map