@seqyuan/annodex 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/api/agent/[id]/events/route.ts +94 -0
- package/app/api/agent/[id]/route.ts +83 -0
- package/app/api/agent/new/route.ts +53 -0
- package/app/api/auth/all-providers/route.ts +21 -0
- package/app/api/auth/api-key/[provider]/route.ts +7 -0
- package/app/api/auth/login/[provider]/route.ts +7 -0
- package/app/api/auth/login/route.ts +22 -0
- package/app/api/auth/logout/[provider]/route.ts +7 -0
- package/app/api/auth/providers/route.ts +15 -0
- package/app/api/auth/status/route.ts +6 -0
- package/app/api/default-cwd/route.ts +22 -0
- package/app/api/files/[...path]/route.ts +621 -0
- package/app/api/harness/route.ts +47 -0
- package/app/api/home/route.ts +6 -0
- package/app/api/internal/runtime/route.ts +26 -0
- package/app/api/models/route.ts +67 -0
- package/app/api/models-config/discover/route.ts +42 -0
- package/app/api/models-config/route.ts +152 -0
- package/app/api/models-config/test/route.ts +154 -0
- package/app/api/projects/browse/route.ts +51 -0
- package/app/api/projects/route.ts +83 -0
- package/app/api/reports/[id]/route.ts +108 -0
- package/app/api/search/route.ts +122 -0
- package/app/api/sessions/[id]/context/route.ts +23 -0
- package/app/api/sessions/[id]/route.ts +124 -0
- package/app/api/sessions/new/route.ts +5 -0
- package/app/api/sessions/route.ts +16 -0
- package/app/api/settings/route.ts +51 -0
- package/app/api/skills/install/route.ts +249 -0
- package/app/api/skills/route.ts +161 -0
- package/app/api/skills/search/route.ts +121 -0
- package/app/api/soul/route.ts +47 -0
- package/app/api/version/route.ts +55 -0
- package/app/globals.css +736 -0
- package/app/layout.tsx +40 -0
- package/app/login/page.tsx +133 -0
- package/app/page.tsx +10 -0
- package/components/AppShell.tsx +1058 -0
- package/components/ChatInput.tsx +1103 -0
- package/components/ChatMinimap.tsx +381 -0
- package/components/ChatWindow.tsx +576 -0
- package/components/CodeMirrorEditor.tsx +137 -0
- package/components/ConversationSearch.tsx +369 -0
- package/components/DataTableViewer.tsx +248 -0
- package/components/FileExplorer.tsx +758 -0
- package/components/FileIcons.tsx +241 -0
- package/components/FileViewer.tsx +1273 -0
- package/components/GlobalFileEditor.tsx +98 -0
- package/components/MarkdownRenderer.tsx +331 -0
- package/components/MermaidDiagram.tsx +80 -0
- package/components/MessageView.tsx +1141 -0
- package/components/ModelsConfig.tsx +1991 -0
- package/components/ProjectContext.tsx +252 -0
- package/components/ProjectFolderPicker.tsx +202 -0
- package/components/ProjectsConfig.tsx +288 -0
- package/components/ProviderIcons.tsx +91 -0
- package/components/ReportPanel.tsx +237 -0
- package/components/ResizeHandle.tsx +105 -0
- package/components/SessionSidebar.tsx +1464 -0
- package/components/SettingsDialog.tsx +287 -0
- package/components/SkillsConfig.tsx +1093 -0
- package/components/SubagentPanel.tsx +191 -0
- package/components/TabBar.tsx +115 -0
- package/components/ToolPanel.tsx +131 -0
- package/components/WidgetRenderer.tsx +505 -0
- package/components/viewers/DocumentToolbar.tsx +78 -0
- package/components/viewers/DocxViewer.tsx +97 -0
- package/components/viewers/PdfViewer.tsx +206 -0
- package/components/viewers/PptxViewer.tsx +240 -0
- package/components/viewers/XlsxViewer.tsx +143 -0
- package/hooks/useAgentSession.ts +710 -0
- package/hooks/useAudio.ts +50 -0
- package/hooks/useDragDrop.ts +52 -0
- package/hooks/useResizable.ts +60 -0
- package/hooks/useTheme.ts +85 -0
- package/lib/agent-client.ts +39 -0
- package/lib/annodex-config.ts +556 -0
- package/lib/auth-token.ts +74 -0
- package/lib/auth.ts +90 -0
- package/lib/brand.ts +5 -0
- package/lib/code-theme.ts +32 -0
- package/lib/codex-compat-proxy.ts +1603 -0
- package/lib/codex-home.ts +6 -0
- package/lib/codex-server.ts +796 -0
- package/lib/codex-session.ts +590 -0
- package/lib/codex-usage.ts +213 -0
- package/lib/file-paths.ts +34 -0
- package/lib/model-discovery.ts +379 -0
- package/lib/normalize.ts +30 -0
- package/lib/npx.ts +87 -0
- package/lib/pi-types.ts +49 -0
- package/lib/projects.ts +269 -0
- package/lib/provider-api.ts +88 -0
- package/lib/report-prompt.ts +61 -0
- package/lib/report-store.ts +597 -0
- package/lib/report-update-parser.ts +66 -0
- package/lib/rpc-manager.ts +668 -0
- package/lib/runtime-state.ts +117 -0
- package/lib/session-reader.ts +903 -0
- package/lib/session-runtime.ts +105 -0
- package/lib/subagent-progress.ts +279 -0
- package/lib/types.ts +241 -0
- package/lib/widget-export.ts +318 -0
- package/lib/widget-guidelines.ts +288 -0
- package/lib/widget-prompt.ts +76 -0
- package/lib/widget-utils.ts +523 -0
- package/package.json +23 -18
- package/postcss.config.mjs +8 -0
- package/proxy.ts +64 -0
- package/scripts/postinstall.cjs +25 -0
- package/tsconfig.json +41 -0
- package/.next/BUILD_ID +0 -1
- package/.next/app-path-routes-manifest.json +0 -39
- package/.next/build-manifest.json +0 -20
- package/.next/diagnostics/build-diagnostics.json +0 -6
- package/.next/diagnostics/framework.json +0 -1
- package/.next/export-marker.json +0 -6
- package/.next/images-manifest.json +0 -68
- package/.next/next-minimal-server.js.nft.json +0 -1
- package/.next/next-server.js.nft.json +0 -1
- package/.next/package.json +0 -1
- package/.next/prerender-manifest.json +0 -109
- package/.next/react-loadable-manifest.json +0 -2320
- package/.next/required-server-files.js +0 -343
- package/.next/required-server-files.json +0 -343
- package/.next/routes-manifest.json +0 -286
- package/.next/server/app/_global-error/page.js +0 -32
- package/.next/server/app/_global-error/page.js.nft.json +0 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +0 -1
- package/.next/server/app/_global-error.html +0 -1
- package/.next/server/app/_global-error.meta +0 -16
- package/.next/server/app/_global-error.rsc +0 -14
- package/.next/server/app/_global-error.segments/_full.segment.rsc +0 -14
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +0 -5
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +0 -5
- package/.next/server/app/_global-error.segments/_head.segment.rsc +0 -5
- package/.next/server/app/_global-error.segments/_index.segment.rsc +0 -5
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +0 -1
- package/.next/server/app/_not-found/page.js +0 -2
- package/.next/server/app/_not-found/page.js.nft.json +0 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +0 -1
- package/.next/server/app/_not-found.html +0 -1
- package/.next/server/app/_not-found.meta +0 -16
- package/.next/server/app/_not-found.rsc +0 -18
- package/.next/server/app/_not-found.segments/_full.segment.rsc +0 -18
- package/.next/server/app/_not-found.segments/_head.segment.rsc +0 -6
- package/.next/server/app/_not-found.segments/_index.segment.rsc +0 -5
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +0 -5
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +0 -5
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +0 -4
- package/.next/server/app/api/agent/[id]/events/route.js +0 -3
- package/.next/server/app/api/agent/[id]/events/route.js.nft.json +0 -1
- package/.next/server/app/api/agent/[id]/events/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/agent/[id]/route.js +0 -1
- package/.next/server/app/api/agent/[id]/route.js.nft.json +0 -1
- package/.next/server/app/api/agent/[id]/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/agent/new/route.js +0 -1
- package/.next/server/app/api/agent/new/route.js.nft.json +0 -1
- package/.next/server/app/api/agent/new/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/auth/all-providers/route.js +0 -1
- package/.next/server/app/api/auth/all-providers/route.js.nft.json +0 -1
- package/.next/server/app/api/auth/all-providers/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/auth/api-key/[provider]/route.js +0 -1
- package/.next/server/app/api/auth/api-key/[provider]/route.js.nft.json +0 -1
- package/.next/server/app/api/auth/api-key/[provider]/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/auth/login/[provider]/route.js +0 -1
- package/.next/server/app/api/auth/login/[provider]/route.js.nft.json +0 -1
- package/.next/server/app/api/auth/login/[provider]/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/auth/login/route.js +0 -1
- package/.next/server/app/api/auth/login/route.js.nft.json +0 -1
- package/.next/server/app/api/auth/login/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/auth/logout/[provider]/route.js +0 -1
- package/.next/server/app/api/auth/logout/[provider]/route.js.nft.json +0 -1
- package/.next/server/app/api/auth/logout/[provider]/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/auth/providers/route.js +0 -1
- package/.next/server/app/api/auth/providers/route.js.nft.json +0 -1
- package/.next/server/app/api/auth/providers/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/auth/status/route.js +0 -1
- package/.next/server/app/api/auth/status/route.js.nft.json +0 -1
- package/.next/server/app/api/auth/status/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/default-cwd/route.js +0 -1
- package/.next/server/app/api/default-cwd/route.js.nft.json +0 -1
- package/.next/server/app/api/default-cwd/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/files/[...path]/route.js +0 -4
- package/.next/server/app/api/files/[...path]/route.js.nft.json +0 -1
- package/.next/server/app/api/files/[...path]/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/harness/route.js +0 -1
- package/.next/server/app/api/harness/route.js.nft.json +0 -1
- package/.next/server/app/api/harness/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/home/route.js +0 -1
- package/.next/server/app/api/home/route.js.nft.json +0 -1
- package/.next/server/app/api/home/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/internal/runtime/route.js +0 -1
- package/.next/server/app/api/internal/runtime/route.js.nft.json +0 -1
- package/.next/server/app/api/internal/runtime/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/models/route.js +0 -1
- package/.next/server/app/api/models/route.js.nft.json +0 -1
- package/.next/server/app/api/models/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/models-config/discover/route.js +0 -1
- package/.next/server/app/api/models-config/discover/route.js.nft.json +0 -1
- package/.next/server/app/api/models-config/discover/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/models-config/route.js +0 -1
- package/.next/server/app/api/models-config/route.js.nft.json +0 -1
- package/.next/server/app/api/models-config/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/models-config/test/route.js +0 -1
- package/.next/server/app/api/models-config/test/route.js.nft.json +0 -1
- package/.next/server/app/api/models-config/test/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/projects/browse/route.js +0 -1
- package/.next/server/app/api/projects/browse/route.js.nft.json +0 -1
- package/.next/server/app/api/projects/browse/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/projects/route.js +0 -1
- package/.next/server/app/api/projects/route.js.nft.json +0 -1
- package/.next/server/app/api/projects/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/reports/[id]/route.js +0 -10
- package/.next/server/app/api/reports/[id]/route.js.nft.json +0 -1
- package/.next/server/app/api/reports/[id]/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/search/route.js +0 -1
- package/.next/server/app/api/search/route.js.nft.json +0 -1
- package/.next/server/app/api/search/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/sessions/[id]/context/route.js +0 -1
- package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +0 -1
- package/.next/server/app/api/sessions/[id]/context/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/sessions/[id]/route.js +0 -1
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +0 -1
- package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/sessions/new/route.js +0 -1
- package/.next/server/app/api/sessions/new/route.js.nft.json +0 -1
- package/.next/server/app/api/sessions/new/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/sessions/route.js +0 -1
- package/.next/server/app/api/sessions/route.js.nft.json +0 -1
- package/.next/server/app/api/sessions/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/settings/route.js +0 -1
- package/.next/server/app/api/settings/route.js.nft.json +0 -1
- package/.next/server/app/api/settings/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/skills/install/route.js +0 -5
- package/.next/server/app/api/skills/install/route.js.nft.json +0 -1
- package/.next/server/app/api/skills/install/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/skills/route.js +0 -6
- package/.next/server/app/api/skills/route.js.nft.json +0 -1
- package/.next/server/app/api/skills/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/skills/search/route.js +0 -1
- package/.next/server/app/api/skills/search/route.js.nft.json +0 -1
- package/.next/server/app/api/skills/search/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/soul/route.js +0 -1
- package/.next/server/app/api/soul/route.js.nft.json +0 -1
- package/.next/server/app/api/soul/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/version/route.js +0 -1
- package/.next/server/app/api/version/route.js.nft.json +0 -1
- package/.next/server/app/api/version/route_client-reference-manifest.js +0 -1
- package/.next/server/app/index.html +0 -1
- package/.next/server/app/index.meta +0 -14
- package/.next/server/app/index.rsc +0 -17
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +0 -6
- package/.next/server/app/index.segments/_full.segment.rsc +0 -17
- package/.next/server/app/index.segments/_head.segment.rsc +0 -6
- package/.next/server/app/index.segments/_index.segment.rsc +0 -5
- package/.next/server/app/index.segments/_tree.segment.rsc +0 -4
- package/.next/server/app/login/page.js +0 -2
- package/.next/server/app/login/page.js.nft.json +0 -1
- package/.next/server/app/login/page_client-reference-manifest.js +0 -1
- package/.next/server/app/login.html +0 -1
- package/.next/server/app/login.meta +0 -15
- package/.next/server/app/login.rsc +0 -22
- package/.next/server/app/login.segments/_full.segment.rsc +0 -22
- package/.next/server/app/login.segments/_head.segment.rsc +0 -6
- package/.next/server/app/login.segments/_index.segment.rsc +0 -5
- package/.next/server/app/login.segments/_tree.segment.rsc +0 -4
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +0 -9
- package/.next/server/app/login.segments/login.segment.rsc +0 -5
- package/.next/server/app/page.js +0 -261
- package/.next/server/app/page.js.nft.json +0 -1
- package/.next/server/app/page_client-reference-manifest.js +0 -1
- package/.next/server/app-paths-manifest.json +0 -39
- package/.next/server/chunks/1048.js +0 -1
- package/.next/server/chunks/1367.js +0 -77
- package/.next/server/chunks/1381.js +0 -1
- package/.next/server/chunks/165.js +0 -1
- package/.next/server/chunks/1681.js +0 -215
- package/.next/server/chunks/1688.js +0 -45
- package/.next/server/chunks/1703.js +0 -79
- package/.next/server/chunks/1712.js +0 -43
- package/.next/server/chunks/1813.js +0 -1
- package/.next/server/chunks/2325.js +0 -80
- package/.next/server/chunks/258.js +0 -1
- package/.next/server/chunks/2671.js +0 -287
- package/.next/server/chunks/2778.js +0 -1
- package/.next/server/chunks/2943.js +0 -1
- package/.next/server/chunks/3031.js +0 -226
- package/.next/server/chunks/3181.js +0 -1
- package/.next/server/chunks/3493.js +0 -1
- package/.next/server/chunks/3672.js +0 -1
- package/.next/server/chunks/3701.js +0 -104
- package/.next/server/chunks/4013.js +0 -1
- package/.next/server/chunks/402.js +0 -2
- package/.next/server/chunks/4035.js +0 -80
- package/.next/server/chunks/4248.js +0 -153
- package/.next/server/chunks/4367.js +0 -1
- package/.next/server/chunks/4406.js +0 -141
- package/.next/server/chunks/4741.js +0 -18
- package/.next/server/chunks/4768.js +0 -1
- package/.next/server/chunks/4858.js +0 -148
- package/.next/server/chunks/4980.js +0 -1
- package/.next/server/chunks/5155.js +0 -5
- package/.next/server/chunks/5293.js +0 -166
- package/.next/server/chunks/5399.js +0 -8
- package/.next/server/chunks/5409.js +0 -1
- package/.next/server/chunks/5797.js +0 -93
- package/.next/server/chunks/5851.js +0 -36
- package/.next/server/chunks/6206.js +0 -1
- package/.next/server/chunks/6296.js +0 -1
- package/.next/server/chunks/63.js +0 -45
- package/.next/server/chunks/6346.js +0 -1
- package/.next/server/chunks/6406.js +0 -23
- package/.next/server/chunks/642.js +0 -1
- package/.next/server/chunks/6429.js +0 -50
- package/.next/server/chunks/6729.js +0 -64
- package/.next/server/chunks/6907.js +0 -115
- package/.next/server/chunks/6980.js +0 -1
- package/.next/server/chunks/7073.js +0 -24
- package/.next/server/chunks/7233.js +0 -24
- package/.next/server/chunks/7307.js +0 -1
- package/.next/server/chunks/7362.js +0 -9
- package/.next/server/chunks/7567.js +0 -29
- package/.next/server/chunks/7765.js +0 -1
- package/.next/server/chunks/7890.js +0 -1
- package/.next/server/chunks/8065.js +0 -1
- package/.next/server/chunks/8238.js +0 -34
- package/.next/server/chunks/8276.js +0 -1
- package/.next/server/chunks/8336.js +0 -1
- package/.next/server/chunks/8477.js +0 -3
- package/.next/server/chunks/8490.js +0 -1
- package/.next/server/chunks/8916.js +0 -1
- package/.next/server/chunks/9280.js +0 -252
- package/.next/server/chunks/9315.js +0 -1
- package/.next/server/chunks/9537.js +0 -90
- package/.next/server/chunks/966.js +0 -1
- package/.next/server/chunks/9818.js +0 -21
- package/.next/server/chunks/static/media/pdf.worker.min.c476e1a0.mjs +0 -6
- package/.next/server/functions-config-manifest.json +0 -16
- package/.next/server/interception-route-rewrite-manifest.js +0 -1
- package/.next/server/middleware-build-manifest.js +0 -1
- package/.next/server/middleware-manifest.json +0 -6
- package/.next/server/middleware-react-loadable-manifest.js +0 -1
- package/.next/server/middleware.js +0 -18
- package/.next/server/middleware.js.nft.json +0 -1
- package/.next/server/next-font-manifest.js +0 -1
- package/.next/server/next-font-manifest.json +0 -1
- package/.next/server/pages/404.html +0 -1
- package/.next/server/pages/500.html +0 -1
- package/.next/server/pages-manifest.json +0 -4
- package/.next/server/prefetch-hints.json +0 -1
- package/.next/server/server-reference-manifest.js +0 -1
- package/.next/server/server-reference-manifest.json +0 -1
- package/.next/server/webpack-runtime.js +0 -1
- package/.next/static/6cuMSvcr0FVO-GiK5RJZh/_buildManifest.js +0 -1
- package/.next/static/6cuMSvcr0FVO-GiK5RJZh/_ssgManifest.js +0 -1
- package/.next/static/chunks/0b9a0da7.9075af772487e743.js +0 -62
- package/.next/static/chunks/1413.922d232de90c0c41.js +0 -115
- package/.next/static/chunks/1643.467a526a1f24f54d.js +0 -24
- package/.next/static/chunks/1852.5543122f11aa7fed.js +0 -1
- package/.next/static/chunks/1960.b1e26436d7a5f586.js +0 -1
- package/.next/static/chunks/2170a4aa.4213bb2183c9cdf9.js +0 -1
- package/.next/static/chunks/2274.6cd173f80a1405a2.js +0 -21
- package/.next/static/chunks/2419.347fdfe3c170854d.js +0 -166
- package/.next/static/chunks/2619.9aac8983f30c7c8a.js +0 -1
- package/.next/static/chunks/2623.d20fabd8e18197c6.js +0 -287
- package/.next/static/chunks/2729.f5365061a849d659.js +0 -34
- package/.next/static/chunks/2821.934bcf60fbdc28c6.js +0 -1
- package/.next/static/chunks/2918becc.abff2ece1de37bc1.js +0 -153
- package/.next/static/chunks/2947.114e51cb06d1c01a.js +0 -23
- package/.next/static/chunks/3079.4c511fa1144e3adf.js +0 -79
- package/.next/static/chunks/3274.208ca44844cd7d95.js +0 -148
- package/.next/static/chunks/3308.465a94263d04bfea.js +0 -73
- package/.next/static/chunks/3325.e4bfe1ca657f3b5b.js +0 -80
- package/.next/static/chunks/3506.2a7eaa08b9f55337.js +0 -90
- package/.next/static/chunks/363642f4-043c1475ab9af70e.js +0 -1
- package/.next/static/chunks/3794-123fdf632563f469.js +0 -32
- package/.next/static/chunks/3837.a755ccfe6f9c1c1c.js +0 -5
- package/.next/static/chunks/394.91597771688df6d0.js +0 -1
- package/.next/static/chunks/3997.1009c06025691712.js +0 -1
- package/.next/static/chunks/4453.91a357dc43c21745.js +0 -1
- package/.next/static/chunks/4491.44fdf20580ac72bd.js +0 -24
- package/.next/static/chunks/4829.cf1d50e43e6d9db5.js +0 -1
- package/.next/static/chunks/498.fe1d9da9ecad6c36.js +0 -1
- package/.next/static/chunks/4bd1b696-e356ca5ba0218e27.js +0 -1
- package/.next/static/chunks/5019.b5a1a2b8daf17525.js +0 -1
- package/.next/static/chunks/5034.8f16c3fa3ce75411.js +0 -1
- package/.next/static/chunks/5074.d16651da01ec4e02.js +0 -1
- package/.next/static/chunks/51fb665c.0950e1b79671348d.js +0 -45
- package/.next/static/chunks/532.5956ed631aff722b.js +0 -9
- package/.next/static/chunks/5326.69460442bdcd6cd3.js +0 -1
- package/.next/static/chunks/5403.ff110bf5bf600758.js +0 -64
- package/.next/static/chunks/547.902a733488cfe3f7.js +0 -77
- package/.next/static/chunks/5567.540d7fc108ad6ee5.js +0 -215
- package/.next/static/chunks/5590.ef62922166d308b4.js +0 -1
- package/.next/static/chunks/5690.9d6eb1edb1399995.js +0 -1
- package/.next/static/chunks/5749.25faee4a1e55b854.js +0 -226
- package/.next/static/chunks/58bb9007.1ccb6bba34b4c635.js +0 -80
- package/.next/static/chunks/6121.f3f43f1896ea0cd9.js +0 -1
- package/.next/static/chunks/6600.583c88eef37aa524.js +0 -1
- package/.next/static/chunks/6696.a41aec266e657d54.js +0 -141
- package/.next/static/chunks/6922.42148793782d2fe7.js +0 -1
- package/.next/static/chunks/7006.e191611ffc2b9528.js +0 -43
- package/.next/static/chunks/7343.9fbb58204d8ac681.js +0 -1
- package/.next/static/chunks/73972abe.25a4cffa03b2bcef.js +0 -119
- package/.next/static/chunks/7547.58bda8a2aabba0d4.js +0 -93
- package/.next/static/chunks/7648.4ae2f183b4db0353.js +0 -1
- package/.next/static/chunks/7874.8db6929b94cdf697.js +0 -1
- package/.next/static/chunks/7959.1f20a35df316216a.js +0 -104
- package/.next/static/chunks/83.85d62d7fc9850b75.js +0 -29
- package/.next/static/chunks/8436.cab94b59cca0a8ff.js +0 -1
- package/.next/static/chunks/8451.ff6ff72b57dc52e1.js +0 -1
- package/.next/static/chunks/8489.45f22859734f514f.js +0 -36
- package/.next/static/chunks/8568.f85d8b36fc9a9037.js +0 -1
- package/.next/static/chunks/8771-3e14b6810486df1f.js +0 -1
- package/.next/static/chunks/8863.be51033a67436277.js +0 -1
- package/.next/static/chunks/90542734.dc1a2723e4f6affb.js +0 -1
- package/.next/static/chunks/9500.1488aec06ee78127.js +0 -1
- package/.next/static/chunks/9633.155548b5fca6e580.js +0 -1
- package/.next/static/chunks/9779.673004a62d70e36a.js +0 -1
- package/.next/static/chunks/app/_global-error/page-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/_not-found/page-c72daab99269beff.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/events/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/agent/new/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/auth/all-providers/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/auth/login/[provider]/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/auth/login/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/auth/providers/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/auth/status/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/default-cwd/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/files/[...path]/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/harness/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/home/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/internal/runtime/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/models/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/models-config/discover/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/models-config/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/models-config/test/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/projects/browse/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/projects/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/reports/[id]/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/search/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/context/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/sessions/new/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/sessions/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/settings/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/skills/install/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/skills/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/skills/search/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/soul/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/api/version/route-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/app/layout-be148b7ae915b22a.js +0 -1
- package/.next/static/chunks/app/login/page-ebf0e6de99062783.js +0 -1
- package/.next/static/chunks/app/page-c45d98ea81c548ca.js +0 -260
- package/.next/static/chunks/d3ac728e.7964f816a1ca64e5.js +0 -1
- package/.next/static/chunks/framework-711ef29bc66f648c.js +0 -1
- package/.next/static/chunks/main-app-45a0f19af99d61b6.js +0 -1
- package/.next/static/chunks/main-f74964b7ae52493e.js +0 -5
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/global-error-9bfa08b9491621f2.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-cc518af6b1ffb191.js +0 -1
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
- package/.next/static/chunks/webpack-fcf4a889ecbd753c.js +0 -1
- package/.next/static/css/45029451a1d7255d.css +0 -3
- package/.next/static/media/15605e25b523335c-s.woff2 +0 -0
- package/.next/static/media/1a3dce5cfb5f7760-s.woff2 +0 -0
- package/.next/static/media/1cdd02902f937a18-s.woff2 +0 -0
- package/.next/static/media/4c4b3b30b6bcb2be-s.woff2 +0 -0
- package/.next/static/media/641a7b8a5800ee0e-s.woff2 +0 -0
- package/.next/static/media/7deddc85b7ffd1dc-s.p.woff2 +0 -0
- package/.next/static/media/ec14413c594b3356-s.p.woff2 +0 -0
- package/.next/static/media/pdf.worker.min.29aaf158.mjs +0 -6
- package/.next/trace +0 -74
- package/.next/trace-build +0 -1
- package/.next/types/app/api/agent/[id]/events/route.ts +0 -351
- package/.next/types/app/api/agent/[id]/route.ts +0 -351
- package/.next/types/app/api/agent/new/route.ts +0 -351
- package/.next/types/app/api/auth/all-providers/route.ts +0 -351
- package/.next/types/app/api/auth/api-key/[provider]/route.ts +0 -351
- package/.next/types/app/api/auth/login/[provider]/route.ts +0 -351
- package/.next/types/app/api/auth/login/route.ts +0 -351
- package/.next/types/app/api/auth/logout/[provider]/route.ts +0 -351
- package/.next/types/app/api/auth/providers/route.ts +0 -351
- package/.next/types/app/api/auth/status/route.ts +0 -351
- package/.next/types/app/api/default-cwd/route.ts +0 -351
- package/.next/types/app/api/files/[...path]/route.ts +0 -351
- package/.next/types/app/api/harness/route.ts +0 -351
- package/.next/types/app/api/home/route.ts +0 -351
- package/.next/types/app/api/internal/runtime/route.ts +0 -351
- package/.next/types/app/api/models/route.ts +0 -351
- package/.next/types/app/api/models-config/discover/route.ts +0 -351
- package/.next/types/app/api/models-config/route.ts +0 -351
- package/.next/types/app/api/models-config/test/route.ts +0 -351
- package/.next/types/app/api/projects/browse/route.ts +0 -351
- package/.next/types/app/api/projects/route.ts +0 -351
- package/.next/types/app/api/reports/[id]/route.ts +0 -351
- package/.next/types/app/api/search/route.ts +0 -351
- package/.next/types/app/api/sessions/[id]/context/route.ts +0 -351
- package/.next/types/app/api/sessions/[id]/route.ts +0 -351
- package/.next/types/app/api/sessions/new/route.ts +0 -351
- package/.next/types/app/api/sessions/route.ts +0 -351
- package/.next/types/app/api/settings/route.ts +0 -351
- package/.next/types/app/api/skills/install/route.ts +0 -351
- package/.next/types/app/api/skills/route.ts +0 -351
- package/.next/types/app/api/skills/search/route.ts +0 -351
- package/.next/types/app/api/soul/route.ts +0 -351
- package/.next/types/app/api/version/route.ts +0 -351
- package/.next/types/app/layout.ts +0 -87
- package/.next/types/app/login/page.ts +0 -87
- package/.next/types/app/page.ts +0 -87
- package/.next/types/package.json +0 -1
- package/.next/types/routes.d.ts +0 -106
- package/.next/types/validator.ts +0 -376
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState, useCallback, useEffect, useRef } from "react";
|
|
4
|
+
import { getFileIcon, FolderIcon } from "./FileIcons";
|
|
5
|
+
import { encodeFilePathForApi, getRelativeFilePath, joinFilePath } from "@/lib/file-paths";
|
|
6
|
+
|
|
7
|
+
interface FileEntry {
|
|
8
|
+
name: string;
|
|
9
|
+
isDir: boolean;
|
|
10
|
+
size: number;
|
|
11
|
+
modified: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface FileNode {
|
|
15
|
+
name: string;
|
|
16
|
+
fullPath: string;
|
|
17
|
+
isDir: boolean;
|
|
18
|
+
size: number;
|
|
19
|
+
children?: FileNode[];
|
|
20
|
+
loaded?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type UploadPhase = "uploading" | "success" | "warning" | "error";
|
|
24
|
+
|
|
25
|
+
interface UploadState {
|
|
26
|
+
phase: UploadPhase;
|
|
27
|
+
targetPath: string;
|
|
28
|
+
fileCount: number;
|
|
29
|
+
loaded: number;
|
|
30
|
+
total: number;
|
|
31
|
+
message: string;
|
|
32
|
+
details?: string[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface UploadResponse {
|
|
36
|
+
error?: string;
|
|
37
|
+
uploaded?: Array<{ originalName: string; name: string; path: string; size: number }>;
|
|
38
|
+
failed?: Array<{ name: string; error: string }>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface Props {
|
|
42
|
+
cwd: string;
|
|
43
|
+
onOpenFile: (filePath: string, fileName: string) => void;
|
|
44
|
+
refreshKey?: number;
|
|
45
|
+
onAtMention?: (relativePath: string) => void;
|
|
46
|
+
searchQuery?: string;
|
|
47
|
+
onSearchChange?: (value: string) => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function fetchEntries(dirPath: string): Promise<FileNode[]> {
|
|
51
|
+
const encoded = encodeFilePathForApi(dirPath);
|
|
52
|
+
const res = await fetch(`/api/files/${encoded}?type=list`);
|
|
53
|
+
if (!res.ok) return [];
|
|
54
|
+
const data = await res.json() as { entries?: FileEntry[] };
|
|
55
|
+
return (data.entries ?? []).map((e) => ({
|
|
56
|
+
name: e.name,
|
|
57
|
+
fullPath: joinFilePath(dirPath, e.name),
|
|
58
|
+
isDir: e.isDir,
|
|
59
|
+
size: e.size,
|
|
60
|
+
children: e.isDir ? [] : undefined,
|
|
61
|
+
loaded: !e.isDir,
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function nodeMatchesSearch(node: FileNode, query: string): boolean {
|
|
66
|
+
const q = query.trim().toLowerCase();
|
|
67
|
+
if (!q) return true;
|
|
68
|
+
if (node.name.toLowerCase().includes(q)) return true;
|
|
69
|
+
return (node.children ?? []).some((child) => nodeMatchesSearch(child, q));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function hasDraggedFiles(dataTransfer: DataTransfer): boolean {
|
|
73
|
+
if (Array.from(dataTransfer.types).includes("Files")) return true;
|
|
74
|
+
return Array.from(dataTransfer.items).some((item) => item.kind === "file");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function getDroppedFiles(dataTransfer: DataTransfer): File[] {
|
|
78
|
+
return Array.from(dataTransfer.files).filter((file) => !!file.name);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function formatBytes(bytes: number): string {
|
|
82
|
+
if (!Number.isFinite(bytes) || bytes <= 0) return "0 B";
|
|
83
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
84
|
+
let value = bytes;
|
|
85
|
+
let unitIndex = 0;
|
|
86
|
+
while (value >= 1024 && unitIndex < units.length - 1) {
|
|
87
|
+
value /= 1024;
|
|
88
|
+
unitIndex += 1;
|
|
89
|
+
}
|
|
90
|
+
return `${value >= 10 || unitIndex === 0 ? Math.round(value) : value.toFixed(1)} ${units[unitIndex]}`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function getTargetLabel(targetPath: string, cwd: string): string {
|
|
94
|
+
return targetPath === cwd ? "." : getRelativeFilePath(targetPath, cwd);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function TreeNode({
|
|
98
|
+
node,
|
|
99
|
+
depth,
|
|
100
|
+
cwd,
|
|
101
|
+
onOpenFile,
|
|
102
|
+
onAtMention,
|
|
103
|
+
expandedPaths,
|
|
104
|
+
onToggleExpanded,
|
|
105
|
+
onUploadFiles,
|
|
106
|
+
uploadTargetPath,
|
|
107
|
+
refreshKey,
|
|
108
|
+
searchQuery,
|
|
109
|
+
}: {
|
|
110
|
+
node: FileNode;
|
|
111
|
+
depth: number;
|
|
112
|
+
cwd: string;
|
|
113
|
+
onOpenFile: (filePath: string, fileName: string) => void;
|
|
114
|
+
onAtMention?: (relativePath: string) => void;
|
|
115
|
+
expandedPaths: Set<string>;
|
|
116
|
+
onToggleExpanded: (fullPath: string, open: boolean) => void;
|
|
117
|
+
onUploadFiles: (files: File[], targetPath: string) => void;
|
|
118
|
+
uploadTargetPath: string | null;
|
|
119
|
+
refreshKey?: number;
|
|
120
|
+
searchQuery?: string;
|
|
121
|
+
}) {
|
|
122
|
+
const searching = !!searchQuery?.trim();
|
|
123
|
+
const open = searching ? node.isDir : expandedPaths.has(node.fullPath);
|
|
124
|
+
const [children, setChildren] = useState<FileNode[]>(node.children ?? []);
|
|
125
|
+
const [loaded, setLoaded] = useState(node.loaded ?? false);
|
|
126
|
+
const [loading, setLoading] = useState(false);
|
|
127
|
+
const [hovered, setHovered] = useState(false);
|
|
128
|
+
const [dragOver, setDragOver] = useState(false);
|
|
129
|
+
const isUploadTarget = node.isDir && (dragOver || uploadTargetPath === node.fullPath);
|
|
130
|
+
const visibleChildren = searching
|
|
131
|
+
? children.filter((child) => nodeMatchesSearch(child, searchQuery ?? ""))
|
|
132
|
+
: children;
|
|
133
|
+
|
|
134
|
+
const loadChildren = useCallback(async (force = false) => {
|
|
135
|
+
if (loaded && !force) return;
|
|
136
|
+
setLoading(true);
|
|
137
|
+
try {
|
|
138
|
+
const entries = await fetchEntries(node.fullPath);
|
|
139
|
+
setChildren(entries);
|
|
140
|
+
setLoaded(true);
|
|
141
|
+
} catch {
|
|
142
|
+
// ignore
|
|
143
|
+
} finally {
|
|
144
|
+
setLoading(false);
|
|
145
|
+
}
|
|
146
|
+
}, [loaded, node.fullPath]);
|
|
147
|
+
|
|
148
|
+
// When refreshKey causes a re-render with the same node identity, reload open dirs
|
|
149
|
+
const prevLoadedRef = useRef(loaded);
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
prevLoadedRef.current = loaded;
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Re-fetch children when refreshKey changes and the directory is already open/loaded
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
if (open && loaded) {
|
|
157
|
+
loadChildren(true);
|
|
158
|
+
}
|
|
159
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
160
|
+
}, [refreshKey]);
|
|
161
|
+
|
|
162
|
+
const handleClick = useCallback(() => {
|
|
163
|
+
if (node.isDir) {
|
|
164
|
+
const next = !open;
|
|
165
|
+
onToggleExpanded(node.fullPath, next);
|
|
166
|
+
if (next && !loaded) loadChildren();
|
|
167
|
+
} else {
|
|
168
|
+
onOpenFile(node.fullPath, node.name);
|
|
169
|
+
}
|
|
170
|
+
}, [node.isDir, node.fullPath, node.name, loaded, open, loadChildren, onOpenFile, onToggleExpanded]);
|
|
171
|
+
|
|
172
|
+
const handleDragEnter = useCallback((event: React.DragEvent<HTMLDivElement>) => {
|
|
173
|
+
if (!node.isDir || !hasDraggedFiles(event.dataTransfer)) return;
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
event.stopPropagation();
|
|
176
|
+
event.dataTransfer.dropEffect = "copy";
|
|
177
|
+
setDragOver(true);
|
|
178
|
+
}, [node.isDir]);
|
|
179
|
+
|
|
180
|
+
const handleDragOver = useCallback((event: React.DragEvent<HTMLDivElement>) => {
|
|
181
|
+
if (!node.isDir || !hasDraggedFiles(event.dataTransfer)) return;
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
event.stopPropagation();
|
|
184
|
+
event.dataTransfer.dropEffect = "copy";
|
|
185
|
+
}, [node.isDir]);
|
|
186
|
+
|
|
187
|
+
const handleDragLeave = useCallback((event: React.DragEvent<HTMLDivElement>) => {
|
|
188
|
+
if (!node.isDir) return;
|
|
189
|
+
const nextTarget = event.relatedTarget;
|
|
190
|
+
if (nextTarget instanceof Node && event.currentTarget.contains(nextTarget)) return;
|
|
191
|
+
setDragOver(false);
|
|
192
|
+
}, [node.isDir]);
|
|
193
|
+
|
|
194
|
+
const handleDrop = useCallback((event: React.DragEvent<HTMLDivElement>) => {
|
|
195
|
+
if (!node.isDir || !hasDraggedFiles(event.dataTransfer)) return;
|
|
196
|
+
event.preventDefault();
|
|
197
|
+
event.stopPropagation();
|
|
198
|
+
setDragOver(false);
|
|
199
|
+
const files = getDroppedFiles(event.dataTransfer);
|
|
200
|
+
if (files.length > 0) {
|
|
201
|
+
onUploadFiles(files, node.fullPath);
|
|
202
|
+
if (!open) onToggleExpanded(node.fullPath, true);
|
|
203
|
+
if (!loaded) void loadChildren();
|
|
204
|
+
}
|
|
205
|
+
}, [loadChildren, loaded, node.fullPath, node.isDir, onToggleExpanded, onUploadFiles, open]);
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<div>
|
|
209
|
+
<div
|
|
210
|
+
onClick={handleClick}
|
|
211
|
+
onMouseEnter={() => setHovered(true)}
|
|
212
|
+
onMouseLeave={() => setHovered(false)}
|
|
213
|
+
onDragEnter={handleDragEnter}
|
|
214
|
+
onDragOver={handleDragOver}
|
|
215
|
+
onDragLeave={handleDragLeave}
|
|
216
|
+
onDrop={handleDrop}
|
|
217
|
+
style={{
|
|
218
|
+
position: "relative",
|
|
219
|
+
display: "flex",
|
|
220
|
+
alignItems: "center",
|
|
221
|
+
gap: 4,
|
|
222
|
+
paddingLeft: 8 + depth * 14,
|
|
223
|
+
paddingRight: 8,
|
|
224
|
+
height: 24,
|
|
225
|
+
cursor: "pointer",
|
|
226
|
+
background: isUploadTarget ? "rgba(37,99,235,0.14)" : hovered ? "var(--bg-hover)" : "transparent",
|
|
227
|
+
outline: isUploadTarget ? "1px solid rgba(37,99,235,0.42)" : "none",
|
|
228
|
+
outlineOffset: -1,
|
|
229
|
+
borderRadius: 4,
|
|
230
|
+
userSelect: "none",
|
|
231
|
+
transition: "background 0.12s, outline-color 0.12s",
|
|
232
|
+
}}
|
|
233
|
+
>
|
|
234
|
+
{node.isDir && (
|
|
235
|
+
<svg
|
|
236
|
+
width="10" height="10" viewBox="0 0 10 10" fill="none"
|
|
237
|
+
stroke="var(--text-dim)" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"
|
|
238
|
+
style={{ flexShrink: 0, transform: open ? "rotate(90deg)" : "none", transition: "transform 0.1s" }}
|
|
239
|
+
>
|
|
240
|
+
<polyline points="3 2 7 5 3 8" />
|
|
241
|
+
</svg>
|
|
242
|
+
)}
|
|
243
|
+
{!node.isDir && <span style={{ width: 10, flexShrink: 0 }} />}
|
|
244
|
+
<span style={{ flexShrink: 0, display: "flex", alignItems: "center" }}>
|
|
245
|
+
{node.isDir ? <FolderIcon size={14} open={open} /> : getFileIcon(node.name, 14)}
|
|
246
|
+
</span>
|
|
247
|
+
<span
|
|
248
|
+
style={{
|
|
249
|
+
fontSize: 12,
|
|
250
|
+
color: "var(--text)",
|
|
251
|
+
overflow: "hidden",
|
|
252
|
+
textOverflow: "ellipsis",
|
|
253
|
+
whiteSpace: "nowrap",
|
|
254
|
+
flex: 1,
|
|
255
|
+
}}
|
|
256
|
+
title={node.fullPath}
|
|
257
|
+
>
|
|
258
|
+
{node.name}
|
|
259
|
+
</span>
|
|
260
|
+
{loading && (
|
|
261
|
+
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="var(--text-dim)" strokeWidth="2" strokeLinecap="round">
|
|
262
|
+
<path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4" />
|
|
263
|
+
</svg>
|
|
264
|
+
)}
|
|
265
|
+
{onAtMention && hovered && (
|
|
266
|
+
<button
|
|
267
|
+
onClick={(e) => {
|
|
268
|
+
e.stopPropagation();
|
|
269
|
+
onAtMention(getRelativeFilePath(node.fullPath, cwd));
|
|
270
|
+
}}
|
|
271
|
+
title="Insert path into chat"
|
|
272
|
+
style={{
|
|
273
|
+
position: "absolute",
|
|
274
|
+
right: 4,
|
|
275
|
+
top: "50%",
|
|
276
|
+
transform: "translateY(-50%)",
|
|
277
|
+
display: "flex",
|
|
278
|
+
alignItems: "center",
|
|
279
|
+
justifyContent: "center",
|
|
280
|
+
gap: 4,
|
|
281
|
+
padding: "0 8px",
|
|
282
|
+
height: 20,
|
|
283
|
+
background: "var(--bg-panel)",
|
|
284
|
+
border: "1px solid var(--border)",
|
|
285
|
+
borderRadius: 4,
|
|
286
|
+
color: "var(--accent)",
|
|
287
|
+
cursor: "pointer",
|
|
288
|
+
fontSize: 11,
|
|
289
|
+
fontWeight: 600,
|
|
290
|
+
whiteSpace: "nowrap",
|
|
291
|
+
}}
|
|
292
|
+
>
|
|
293
|
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round">
|
|
294
|
+
<circle cx="12" cy="12" r="4" />
|
|
295
|
+
<path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8" />
|
|
296
|
+
</svg>
|
|
297
|
+
mention
|
|
298
|
+
</button>
|
|
299
|
+
)}
|
|
300
|
+
</div>
|
|
301
|
+
{node.isDir && open && (
|
|
302
|
+
<div>
|
|
303
|
+
{visibleChildren.map((child) => (
|
|
304
|
+
<TreeNode key={child.fullPath} node={child} depth={depth + 1} cwd={cwd} onOpenFile={onOpenFile} onAtMention={onAtMention} expandedPaths={expandedPaths} onToggleExpanded={onToggleExpanded} onUploadFiles={onUploadFiles} uploadTargetPath={uploadTargetPath} refreshKey={refreshKey} searchQuery={searchQuery} />
|
|
305
|
+
))}
|
|
306
|
+
{visibleChildren.length === 0 && loaded && !searching && (
|
|
307
|
+
<div style={{ paddingLeft: 8 + (depth + 1) * 14, fontSize: 11, color: "var(--text-dim)", height: 22, display: "flex", alignItems: "center" }}>
|
|
308
|
+
empty
|
|
309
|
+
</div>
|
|
310
|
+
)}
|
|
311
|
+
</div>
|
|
312
|
+
)}
|
|
313
|
+
</div>
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export function FileExplorer({ cwd, onOpenFile, refreshKey, onAtMention, searchQuery = "",
|
|
318
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
319
|
+
onSearchChange,
|
|
320
|
+
}: Props) {
|
|
321
|
+
const [roots, setRoots] = useState<FileNode[]>([]);
|
|
322
|
+
const [loading, setLoading] = useState(true);
|
|
323
|
+
const [error, setError] = useState<string | null>(null);
|
|
324
|
+
const [expandedPaths, setExpandedPaths] = useState<Set<string>>(new Set());
|
|
325
|
+
const [isDraggingFiles, setIsDraggingFiles] = useState(false);
|
|
326
|
+
const [uploadTargetPath, setUploadTargetPath] = useState<string | null>(null);
|
|
327
|
+
const [uploadState, setUploadState] = useState<UploadState | null>(null);
|
|
328
|
+
const prevCwdRef = useRef<string | null>(null);
|
|
329
|
+
const uploadTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
330
|
+
const dragDepthRef = useRef(0);
|
|
331
|
+
|
|
332
|
+
const loadRootEntries = useCallback((nextCwd: string, showLoading: boolean) => {
|
|
333
|
+
setLoading(showLoading);
|
|
334
|
+
setError(null);
|
|
335
|
+
return fetchEntries(nextCwd)
|
|
336
|
+
.then((entries) => setRoots(entries))
|
|
337
|
+
.catch((e) => setError(String(e)))
|
|
338
|
+
.finally(() => setLoading(false));
|
|
339
|
+
}, []);
|
|
340
|
+
|
|
341
|
+
const handleToggleExpanded = useCallback((fullPath: string, open: boolean) => {
|
|
342
|
+
setExpandedPaths((prev) => {
|
|
343
|
+
const next = new Set(prev);
|
|
344
|
+
if (open) next.add(fullPath); else next.delete(fullPath);
|
|
345
|
+
return next;
|
|
346
|
+
});
|
|
347
|
+
}, []);
|
|
348
|
+
|
|
349
|
+
useEffect(() => {
|
|
350
|
+
const cwdChanged = prevCwdRef.current !== cwd;
|
|
351
|
+
prevCwdRef.current = cwd;
|
|
352
|
+
|
|
353
|
+
// Reset expanded state only when cwd changes, not on refreshKey bumps
|
|
354
|
+
if (cwdChanged) setExpandedPaths(new Set());
|
|
355
|
+
|
|
356
|
+
loadRootEntries(cwd, cwdChanged);
|
|
357
|
+
}, [cwd, refreshKey, loadRootEntries]);
|
|
358
|
+
|
|
359
|
+
useEffect(() => () => {
|
|
360
|
+
if (uploadTimerRef.current) clearTimeout(uploadTimerRef.current);
|
|
361
|
+
}, []);
|
|
362
|
+
|
|
363
|
+
const handleRefresh = useCallback(() => {
|
|
364
|
+
loadRootEntries(cwd, roots.length === 0);
|
|
365
|
+
}, [cwd, roots.length, loadRootEntries]);
|
|
366
|
+
|
|
367
|
+
const scheduleUploadNoticeClear = useCallback(() => {
|
|
368
|
+
if (uploadTimerRef.current) clearTimeout(uploadTimerRef.current);
|
|
369
|
+
uploadTimerRef.current = setTimeout(() => setUploadState(null), 5000);
|
|
370
|
+
}, []);
|
|
371
|
+
|
|
372
|
+
const uploadFiles = useCallback((files: File[], targetPath: string) => {
|
|
373
|
+
if (files.length === 0) return;
|
|
374
|
+
|
|
375
|
+
dragDepthRef.current = 0;
|
|
376
|
+
setIsDraggingFiles(false);
|
|
377
|
+
if (uploadTimerRef.current) clearTimeout(uploadTimerRef.current);
|
|
378
|
+
const total = files.reduce((sum, file) => sum + file.size, 0);
|
|
379
|
+
const targetLabel = getTargetLabel(targetPath, cwd);
|
|
380
|
+
setUploadTargetPath(targetPath);
|
|
381
|
+
setUploadState({
|
|
382
|
+
phase: "uploading",
|
|
383
|
+
targetPath,
|
|
384
|
+
fileCount: files.length,
|
|
385
|
+
loaded: 0,
|
|
386
|
+
total,
|
|
387
|
+
message: `Uploading ${files.length} file${files.length === 1 ? "" : "s"} to ${targetLabel}`,
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
const formData = new FormData();
|
|
391
|
+
files.forEach((file) => formData.append("files", file, file.name));
|
|
392
|
+
|
|
393
|
+
const xhr = new XMLHttpRequest();
|
|
394
|
+
const encoded = encodeFilePathForApi(targetPath);
|
|
395
|
+
xhr.open("POST", `/api/files/${encoded}?type=upload`);
|
|
396
|
+
|
|
397
|
+
xhr.upload.onprogress = (event) => {
|
|
398
|
+
if (!event.lengthComputable) return;
|
|
399
|
+
setUploadState((prev) => prev ? {
|
|
400
|
+
...prev,
|
|
401
|
+
loaded: event.loaded,
|
|
402
|
+
total: event.total,
|
|
403
|
+
} : prev);
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
xhr.onload = () => {
|
|
407
|
+
setUploadTargetPath(null);
|
|
408
|
+
let data: UploadResponse = {};
|
|
409
|
+
try {
|
|
410
|
+
data = JSON.parse(xhr.responseText) as UploadResponse;
|
|
411
|
+
} catch {
|
|
412
|
+
data = {};
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
416
|
+
const uploaded = data.uploaded ?? [];
|
|
417
|
+
const failed = data.failed ?? [];
|
|
418
|
+
const renamed = uploaded.filter((item) => item.name !== item.originalName);
|
|
419
|
+
const details = [
|
|
420
|
+
...renamed.slice(0, 3).map((item) => `${item.originalName} saved as ${item.name}`),
|
|
421
|
+
...failed.slice(0, 3).map((item) => `${item.name}: ${item.error}`),
|
|
422
|
+
];
|
|
423
|
+
setUploadState({
|
|
424
|
+
phase: failed.length > 0 ? "warning" : "success",
|
|
425
|
+
targetPath,
|
|
426
|
+
fileCount: files.length,
|
|
427
|
+
loaded: total,
|
|
428
|
+
total,
|
|
429
|
+
message: failed.length > 0
|
|
430
|
+
? `Uploaded ${uploaded.length}, ${failed.length} failed`
|
|
431
|
+
: `Uploaded ${uploaded.length} file${uploaded.length === 1 ? "" : "s"} to ${targetLabel}`,
|
|
432
|
+
details,
|
|
433
|
+
});
|
|
434
|
+
handleRefresh();
|
|
435
|
+
scheduleUploadNoticeClear();
|
|
436
|
+
} else {
|
|
437
|
+
const message = data.error ?? `Upload failed (HTTP ${xhr.status})`;
|
|
438
|
+
setUploadState({
|
|
439
|
+
phase: xhr.status === 403 ? "error" : "error",
|
|
440
|
+
targetPath,
|
|
441
|
+
fileCount: files.length,
|
|
442
|
+
loaded: 0,
|
|
443
|
+
total,
|
|
444
|
+
message,
|
|
445
|
+
details: xhr.status === 403 ? ["Check directory write permission or project access."] : undefined,
|
|
446
|
+
});
|
|
447
|
+
scheduleUploadNoticeClear();
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
xhr.onerror = () => {
|
|
452
|
+
setUploadTargetPath(null);
|
|
453
|
+
setUploadState({
|
|
454
|
+
phase: "error",
|
|
455
|
+
targetPath,
|
|
456
|
+
fileCount: files.length,
|
|
457
|
+
loaded: 0,
|
|
458
|
+
total,
|
|
459
|
+
message: "Upload failed due to a network error",
|
|
460
|
+
});
|
|
461
|
+
scheduleUploadNoticeClear();
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
xhr.onabort = () => {
|
|
465
|
+
setUploadTargetPath(null);
|
|
466
|
+
setUploadState({
|
|
467
|
+
phase: "error",
|
|
468
|
+
targetPath,
|
|
469
|
+
fileCount: files.length,
|
|
470
|
+
loaded: 0,
|
|
471
|
+
total,
|
|
472
|
+
message: "Upload canceled",
|
|
473
|
+
});
|
|
474
|
+
scheduleUploadNoticeClear();
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
xhr.send(formData);
|
|
478
|
+
}, [cwd, handleRefresh, scheduleUploadNoticeClear]);
|
|
479
|
+
|
|
480
|
+
const handleFrameDragEnter = useCallback((event: React.DragEvent<HTMLDivElement>) => {
|
|
481
|
+
if (!hasDraggedFiles(event.dataTransfer)) return;
|
|
482
|
+
event.preventDefault();
|
|
483
|
+
dragDepthRef.current += 1;
|
|
484
|
+
setIsDraggingFiles(true);
|
|
485
|
+
}, []);
|
|
486
|
+
|
|
487
|
+
const handleFrameDragOver = useCallback((event: React.DragEvent<HTMLDivElement>) => {
|
|
488
|
+
if (!hasDraggedFiles(event.dataTransfer)) return;
|
|
489
|
+
event.preventDefault();
|
|
490
|
+
event.dataTransfer.dropEffect = "copy";
|
|
491
|
+
}, []);
|
|
492
|
+
|
|
493
|
+
const handleFrameDragLeave = useCallback(() => {
|
|
494
|
+
dragDepthRef.current -= 1;
|
|
495
|
+
if (dragDepthRef.current <= 0) {
|
|
496
|
+
dragDepthRef.current = 0;
|
|
497
|
+
setIsDraggingFiles(false);
|
|
498
|
+
}
|
|
499
|
+
}, []);
|
|
500
|
+
|
|
501
|
+
const handleFrameDrop = useCallback((event: React.DragEvent<HTMLDivElement>) => {
|
|
502
|
+
if (!hasDraggedFiles(event.dataTransfer)) return;
|
|
503
|
+
event.preventDefault();
|
|
504
|
+
dragDepthRef.current = 0;
|
|
505
|
+
setIsDraggingFiles(false);
|
|
506
|
+
const files = getDroppedFiles(event.dataTransfer);
|
|
507
|
+
if (files.length > 0) uploadFiles(files, cwd);
|
|
508
|
+
}, [cwd, uploadFiles]);
|
|
509
|
+
|
|
510
|
+
const visibleRoots = searchQuery.trim()
|
|
511
|
+
? roots.filter((node) => nodeMatchesSearch(node, searchQuery))
|
|
512
|
+
: roots;
|
|
513
|
+
|
|
514
|
+
const searchActive = searchQuery.trim().length > 0;
|
|
515
|
+
|
|
516
|
+
if (loading) {
|
|
517
|
+
return (
|
|
518
|
+
<FileExplorerFrame
|
|
519
|
+
cwd={cwd}
|
|
520
|
+
isDraggingFiles={isDraggingFiles}
|
|
521
|
+
uploadState={uploadState}
|
|
522
|
+
onDragEnter={handleFrameDragEnter}
|
|
523
|
+
onDragOver={handleFrameDragOver}
|
|
524
|
+
onDragLeave={handleFrameDragLeave}
|
|
525
|
+
onDrop={handleFrameDrop}
|
|
526
|
+
>
|
|
527
|
+
<div style={{ padding: "8px 12px", fontSize: 11, color: "var(--text-dim)" }}>
|
|
528
|
+
Loading files...
|
|
529
|
+
</div>
|
|
530
|
+
</FileExplorerFrame>
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
if (error) {
|
|
535
|
+
return (
|
|
536
|
+
<FileExplorerFrame
|
|
537
|
+
cwd={cwd}
|
|
538
|
+
isDraggingFiles={isDraggingFiles}
|
|
539
|
+
uploadState={uploadState}
|
|
540
|
+
onDragEnter={handleFrameDragEnter}
|
|
541
|
+
onDragOver={handleFrameDragOver}
|
|
542
|
+
onDragLeave={handleFrameDragLeave}
|
|
543
|
+
onDrop={handleFrameDrop}
|
|
544
|
+
>
|
|
545
|
+
<div style={{ padding: "8px 12px", fontSize: 11, color: "#f87171" }}>
|
|
546
|
+
{error}
|
|
547
|
+
</div>
|
|
548
|
+
</FileExplorerFrame>
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
return (
|
|
553
|
+
<FileExplorerFrame
|
|
554
|
+
cwd={cwd}
|
|
555
|
+
isDraggingFiles={isDraggingFiles}
|
|
556
|
+
uploadState={uploadState}
|
|
557
|
+
onDragEnter={handleFrameDragEnter}
|
|
558
|
+
onDragOver={handleFrameDragOver}
|
|
559
|
+
onDragLeave={handleFrameDragLeave}
|
|
560
|
+
onDrop={handleFrameDrop}
|
|
561
|
+
>
|
|
562
|
+
<div style={{ padding: "2px 4px" }}>
|
|
563
|
+
{visibleRoots.map((node) => (
|
|
564
|
+
<TreeNode
|
|
565
|
+
key={node.fullPath}
|
|
566
|
+
node={node}
|
|
567
|
+
depth={0}
|
|
568
|
+
cwd={cwd}
|
|
569
|
+
onOpenFile={onOpenFile}
|
|
570
|
+
onAtMention={onAtMention}
|
|
571
|
+
expandedPaths={expandedPaths}
|
|
572
|
+
onToggleExpanded={handleToggleExpanded}
|
|
573
|
+
onUploadFiles={uploadFiles}
|
|
574
|
+
uploadTargetPath={uploadTargetPath}
|
|
575
|
+
refreshKey={refreshKey}
|
|
576
|
+
searchQuery={searchQuery}
|
|
577
|
+
/>
|
|
578
|
+
))}
|
|
579
|
+
{visibleRoots.length === 0 && (
|
|
580
|
+
<div style={{ padding: "8px 12px", fontSize: 11, color: "var(--text-dim)" }}>
|
|
581
|
+
{searchActive ? "No matching files" : "No files found"}
|
|
582
|
+
</div>
|
|
583
|
+
)}
|
|
584
|
+
</div>
|
|
585
|
+
</FileExplorerFrame>
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function FileExplorerFrame({
|
|
590
|
+
cwd,
|
|
591
|
+
isDraggingFiles,
|
|
592
|
+
uploadState,
|
|
593
|
+
onDragEnter,
|
|
594
|
+
onDragOver,
|
|
595
|
+
onDragLeave,
|
|
596
|
+
onDrop,
|
|
597
|
+
children,
|
|
598
|
+
}: {
|
|
599
|
+
cwd: string;
|
|
600
|
+
isDraggingFiles: boolean;
|
|
601
|
+
uploadState: UploadState | null;
|
|
602
|
+
onDragEnter: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
603
|
+
onDragOver: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
604
|
+
onDragLeave: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
605
|
+
onDrop: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
606
|
+
children: React.ReactNode;
|
|
607
|
+
}) {
|
|
608
|
+
const progress = uploadState && uploadState.total > 0
|
|
609
|
+
? Math.max(0, Math.min(100, Math.round((uploadState.loaded / uploadState.total) * 100)))
|
|
610
|
+
: uploadState?.phase === "uploading" ? 8 : 100;
|
|
611
|
+
const statusColor = uploadState?.phase === "success"
|
|
612
|
+
? "#22c55e"
|
|
613
|
+
: uploadState?.phase === "warning"
|
|
614
|
+
? "#f59e0b"
|
|
615
|
+
: uploadState?.phase === "error"
|
|
616
|
+
? "#ef4444"
|
|
617
|
+
: "var(--accent)";
|
|
618
|
+
|
|
619
|
+
return (
|
|
620
|
+
<div
|
|
621
|
+
onDragEnter={onDragEnter}
|
|
622
|
+
onDragOver={onDragOver}
|
|
623
|
+
onDragLeave={onDragLeave}
|
|
624
|
+
onDrop={onDrop}
|
|
625
|
+
style={{
|
|
626
|
+
position: "relative",
|
|
627
|
+
display: "flex",
|
|
628
|
+
flexDirection: "column",
|
|
629
|
+
minHeight: "100%",
|
|
630
|
+
outline: isDraggingFiles ? "1px solid rgba(37,99,235,0.45)" : "none",
|
|
631
|
+
outlineOffset: -1,
|
|
632
|
+
background: isDraggingFiles ? "rgba(37,99,235,0.04)" : undefined,
|
|
633
|
+
transition: "background 0.12s, outline-color 0.12s",
|
|
634
|
+
}}
|
|
635
|
+
>
|
|
636
|
+
<div style={{ flex: 1, minHeight: 0 }}>{children}</div>
|
|
637
|
+
{isDraggingFiles && (
|
|
638
|
+
<div
|
|
639
|
+
style={{
|
|
640
|
+
pointerEvents: "none",
|
|
641
|
+
position: "absolute",
|
|
642
|
+
inset: 6,
|
|
643
|
+
top: 42,
|
|
644
|
+
border: "1px dashed rgba(37,99,235,0.62)",
|
|
645
|
+
borderRadius: 8,
|
|
646
|
+
background: "rgba(37,99,235,0.07)",
|
|
647
|
+
display: "flex",
|
|
648
|
+
alignItems: "center",
|
|
649
|
+
justifyContent: "center",
|
|
650
|
+
zIndex: 2,
|
|
651
|
+
}}
|
|
652
|
+
>
|
|
653
|
+
<div
|
|
654
|
+
style={{
|
|
655
|
+
display: "flex",
|
|
656
|
+
alignItems: "center",
|
|
657
|
+
gap: 8,
|
|
658
|
+
padding: "7px 10px",
|
|
659
|
+
border: "1px solid var(--border)",
|
|
660
|
+
borderRadius: 6,
|
|
661
|
+
background: "var(--bg-panel)",
|
|
662
|
+
color: "var(--text)",
|
|
663
|
+
fontSize: 12,
|
|
664
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.16)",
|
|
665
|
+
}}
|
|
666
|
+
>
|
|
667
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="var(--accent)" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
668
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
|
669
|
+
<polyline points="17 8 12 3 7 8" />
|
|
670
|
+
<line x1="12" y1="3" x2="12" y2="15" />
|
|
671
|
+
</svg>
|
|
672
|
+
Drop to upload into {getTargetLabel(cwd, cwd)}
|
|
673
|
+
</div>
|
|
674
|
+
</div>
|
|
675
|
+
)}
|
|
676
|
+
{uploadState && (
|
|
677
|
+
<div
|
|
678
|
+
style={{
|
|
679
|
+
margin: "6px",
|
|
680
|
+
padding: "7px 8px",
|
|
681
|
+
border: "1px solid var(--border)",
|
|
682
|
+
borderRadius: 6,
|
|
683
|
+
background: "var(--bg-panel)",
|
|
684
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.12)",
|
|
685
|
+
}}
|
|
686
|
+
>
|
|
687
|
+
<div style={{ display: "flex", alignItems: "center", gap: 7, minWidth: 0 }}>
|
|
688
|
+
<span
|
|
689
|
+
style={{
|
|
690
|
+
width: 8,
|
|
691
|
+
height: 8,
|
|
692
|
+
borderRadius: 999,
|
|
693
|
+
background: statusColor,
|
|
694
|
+
flexShrink: 0,
|
|
695
|
+
}}
|
|
696
|
+
/>
|
|
697
|
+
<span
|
|
698
|
+
title={uploadState.message}
|
|
699
|
+
style={{
|
|
700
|
+
flex: 1,
|
|
701
|
+
minWidth: 0,
|
|
702
|
+
overflow: "hidden",
|
|
703
|
+
textOverflow: "ellipsis",
|
|
704
|
+
whiteSpace: "nowrap",
|
|
705
|
+
color: "var(--text)",
|
|
706
|
+
fontSize: 11,
|
|
707
|
+
fontWeight: 600,
|
|
708
|
+
}}
|
|
709
|
+
>
|
|
710
|
+
{uploadState.message}
|
|
711
|
+
</span>
|
|
712
|
+
<span style={{ color: "var(--text-dim)", fontSize: 10, flexShrink: 0 }}>
|
|
713
|
+
{uploadState.phase === "uploading" ? `${progress}%` : formatBytes(uploadState.total)}
|
|
714
|
+
</span>
|
|
715
|
+
</div>
|
|
716
|
+
<div
|
|
717
|
+
style={{
|
|
718
|
+
marginTop: 6,
|
|
719
|
+
height: 3,
|
|
720
|
+
borderRadius: 999,
|
|
721
|
+
background: "var(--bg)",
|
|
722
|
+
overflow: "hidden",
|
|
723
|
+
}}
|
|
724
|
+
>
|
|
725
|
+
<div
|
|
726
|
+
style={{
|
|
727
|
+
width: `${progress}%`,
|
|
728
|
+
height: "100%",
|
|
729
|
+
borderRadius: 999,
|
|
730
|
+
background: statusColor,
|
|
731
|
+
transition: "width 0.15s ease",
|
|
732
|
+
}}
|
|
733
|
+
/>
|
|
734
|
+
</div>
|
|
735
|
+
{uploadState.details && uploadState.details.length > 0 && (
|
|
736
|
+
<div style={{ marginTop: 5, display: "grid", gap: 2 }}>
|
|
737
|
+
{uploadState.details.map((detail) => (
|
|
738
|
+
<div
|
|
739
|
+
key={detail}
|
|
740
|
+
title={detail}
|
|
741
|
+
style={{
|
|
742
|
+
overflow: "hidden",
|
|
743
|
+
textOverflow: "ellipsis",
|
|
744
|
+
whiteSpace: "nowrap",
|
|
745
|
+
color: "var(--text-dim)",
|
|
746
|
+
fontSize: 10,
|
|
747
|
+
}}
|
|
748
|
+
>
|
|
749
|
+
{detail}
|
|
750
|
+
</div>
|
|
751
|
+
))}
|
|
752
|
+
</div>
|
|
753
|
+
)}
|
|
754
|
+
</div>
|
|
755
|
+
)}
|
|
756
|
+
</div>
|
|
757
|
+
);
|
|
758
|
+
}
|