@geminilight/mindos 0.6.59 → 0.6.61
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/_standalone/.mindos-build-version +1 -1
- package/_standalone/.next/BUILD_ID +1 -1
- package/_standalone/.next/app-path-routes-manifest.json +23 -22
- package/_standalone/.next/build-manifest.json +2 -2
- package/_standalone/.next/cache/.previewinfo +1 -1
- package/_standalone/.next/cache/.rscinfo +1 -1
- package/_standalone/.next/cache/config.json +3 -3
- package/_standalone/.next/prerender-manifest.json +3 -3
- package/_standalone/.next/routes-manifest.json +6 -0
- package/_standalone/.next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/_global-error.html +2 -2
- package/_standalone/.next/server/app/_global-error.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/_standalone/.next/server/app/_not-found/page.js +1 -1
- package/_standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page.js +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/agents/page.js +1 -1
- package/_standalone/.next/server/app/agents/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/registry/route.js +1 -1
- package/_standalone/.next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agents/copy-skill/route.js +1 -0
- package/_standalone/.next/server/app/api/agents/copy-skill/route.js.nft.json +1 -0
- package/_standalone/.next/server/app/api/agents/copy-skill/route_client-reference-manifest.js +1 -0
- package/_standalone/.next/server/app/api/agents/custom/detect/route.js +1 -1
- package/_standalone/.next/server/app/api/agents/custom/detect/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agents/custom/route.js +1 -1
- package/_standalone/.next/server/app/api/agents/custom/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/ask/route.js +20 -9
- package/_standalone/.next/server/app/api/ask/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/auth/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/export/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/extract-pdf/route.js +2 -2
- package/_standalone/.next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/raw/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/graph/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/agents/route.js +1 -1
- package/_standalone/.next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/install/route.js +1 -1
- package/_standalone/.next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/changes/page.js +2 -2
- package/_standalone/.next/server/app/changes/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/changes/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page.js +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/echo/page.js +1 -1
- package/_standalone/.next/server/app/echo/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/echo/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/explore/page.js +1 -1
- package/_standalone/.next/server/app/explore/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/explore/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/help/page.js +1 -1
- package/_standalone/.next/server/app/help/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/inbox/history/page.js +1 -1
- package/_standalone/.next/server/app/inbox/history/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/inbox/history/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/login/page.js +1 -1
- package/_standalone/.next/server/app/login/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/page.js +1 -1
- package/_standalone/.next/server/app/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/setup/page.js +1 -1
- package/_standalone/.next/server/app/setup/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/trash/page.js +3 -3
- package/_standalone/.next/server/app/trash/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/view/[...path]/page.js +2 -2
- package/_standalone/.next/server/app/view/[...path]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/wiki/page.js +1 -1
- package/_standalone/.next/server/app/wiki/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/wiki/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app-paths-manifest.json +23 -22
- package/_standalone/.next/server/chunks/1550.js +1 -1
- package/_standalone/.next/server/chunks/1750.js +1 -1
- package/_standalone/.next/server/chunks/3484.js +1 -1
- package/_standalone/.next/server/chunks/530.js +33 -33
- package/_standalone/.next/server/chunks/6539.js +1 -1
- package/_standalone/.next/server/chunks/{8343.js → 8955.js} +3 -3
- package/_standalone/.next/server/pages/500.html +2 -2
- package/_standalone/.next/server/server-reference-manifest.js +1 -1
- package/_standalone/.next/server/server-reference-manifest.json +1 -1
- package/_standalone/.next/static/5GmVArEG8OX03azKICsGq/_buildManifest.js +1 -0
- package/_standalone/.next/static/chunks/1369-7d0ac5d1564eed1e.js +1 -0
- package/_standalone/.next/static/chunks/{5581-dac72e9f16e5ea29.js → 5581-0c700c20718bd916.js} +4 -4
- package/_standalone/.next/static/chunks/7249-b0a9c77b9a84b11c.js +11 -0
- package/_standalone/.next/static/chunks/7637-904b0a381dc3ec02.js +1 -0
- package/_standalone/.next/static/chunks/8520-76d1b05072178b43.js +22 -0
- package/_standalone/.next/static/chunks/9186-ead47513192f658b.js +1 -0
- package/_standalone/.next/static/chunks/app/.well-known/agent-card.json/{route-2f4705aa66819b86.js → route-2ceea6eabf25b1f2.js} +1 -1
- package/_standalone/.next/static/chunks/app/_global-error/{page-2f4705aa66819b86.js → page-2ceea6eabf25b1f2.js} +1 -1
- package/_standalone/.next/static/chunks/app/agents/[agentKey]/page-0ea3571c8fbae823.js +1 -0
- package/_standalone/.next/static/chunks/app/agents/{page-b172ea3743adb047.js → page-66858acbcd1d4bf8.js} +1 -1
- package/_standalone/.next/static/chunks/app/api/a2a/agents/{route-2f4705aa66819b86.js → route-2ceea6eabf25b1f2.js} +1 -1
- package/_standalone/.next/static/chunks/app/api/a2a/delegations/{route-2f4705aa66819b86.js → route-2ceea6eabf25b1f2.js} +1 -1
- package/_standalone/.next/static/chunks/app/api/a2a/discover/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/a2a/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/config/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/detect/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/install/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/registry/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/session/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agent-activity/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agents/copy-skill/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agents/custom/detect/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agents/custom/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/ask/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/ask-sessions/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/auth/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/backlinks/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/bootstrap/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/changes/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/export/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/extract-pdf/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/file/import/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/file/raw/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/file/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/files/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/git/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/graph/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/health/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/inbox/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/init/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/agents/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/install/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/install-skill/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/restart/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/status/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/uninstall/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/monitoring/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/recent-files/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/restart/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/search/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/list-models/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/reset-token/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/test-key/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/check-path/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/check-port/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/generate-token/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/ls/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/skills/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/sync/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/tree-version/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/uninstall/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/update/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/update-check/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/update-status/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/workflows/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/changes/page-dd0b00a7b81f74e2.js +1 -0
- package/_standalone/.next/static/chunks/app/echo/[segment]/{page-84b95256f6e38aae.js → page-bf5c290fa3ccff09.js} +1 -1
- package/_standalone/.next/static/chunks/app/echo/page-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/inbox/history/{page-26e71fb6f716a4c4.js → page-3279585360df132c.js} +1 -1
- package/_standalone/.next/static/chunks/app/{layout-b89b0d955f39a753.js → layout-a5d5925b47e87cc3.js} +24 -24
- package/_standalone/.next/static/chunks/app/loading-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/{page-a8e6f085f38388bf.js → page-6a1f8d21c12b829e.js} +1 -1
- package/_standalone/.next/static/chunks/app/trash/page-40bc7316806acd62.js +1 -0
- package/_standalone/.next/static/chunks/app/view/[...path]/loading-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/view/[...path]/{page-f87f4901b5e1a88f.js → page-6fbb14b8f322d0f0.js} +1 -1
- package/_standalone/.next/static/chunks/app/wiki/page-ba36eccf4fe62cfe.js +1 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/css/b57c4eb3cc88308b.css +1 -0
- package/_standalone/.next/trace +65 -64
- package/_standalone/.next/types/routes.d.ts +2 -1
- package/_standalone/.next/types/validator.ts +9 -0
- package/_standalone/__tests__/api/mcp-install.test.ts +5 -2
- package/_standalone/components/AskFab.tsx +7 -1
- package/_standalone/components/FileTree.tsx +83 -1
- package/_standalone/components/Panel.tsx +20 -1
- package/_standalone/components/agents/AgentsOverviewSection.tsx +13 -11
- package/_standalone/components/agents/CustomAgentModal.tsx +72 -18
- package/_standalone/components/ask/AskContent.tsx +19 -3
- package/_standalone/components/ask/FileChip.tsx +93 -12
- package/_standalone/components/changes/ChangesBanner.tsx +1 -1
- package/_standalone/components/home/InboxSection.tsx +148 -32
- package/_standalone/components/walkthrough/WalkthroughTooltip.tsx +3 -1
- package/_standalone/components/walkthrough/steps.ts +1 -1
- package/_standalone/hooks/useAskChat.ts +10 -8
- package/_standalone/hooks/useFileUpload.ts +97 -43
- package/_standalone/hooks/useImageUpload.ts +1 -1
- package/_standalone/lib/inbox-upload.ts +86 -0
- package/_standalone/package-lock.json +2 -2
- package/_standalone/package.json +1 -1
- package/_standalone/scripts/extract-pdf.cjs +110 -3
- package/_standalone/tsconfig.tsbuildinfo +1 -1
- package/app/app/api/agents/copy-skill/route.ts +110 -0
- package/app/app/api/agents/custom/detect/route.ts +16 -1
- package/app/app/api/ask/route.ts +9 -3
- package/app/app/api/extract-pdf/route.ts +12 -5
- package/app/app/api/mcp/agents/route.ts +64 -2
- package/app/app/api/mcp/install/route.ts +17 -1
- package/app/components/AskFab.tsx +7 -1
- package/app/components/FileTree.tsx +83 -1
- package/app/components/HomeContent.tsx +14 -6
- package/app/components/Panel.tsx +20 -1
- package/app/components/agents/AgentDetailContent.tsx +58 -1
- package/app/components/agents/AgentsOverviewSection.tsx +13 -11
- package/app/components/agents/CustomAgentModal.tsx +72 -18
- package/app/components/ask/AskContent.tsx +19 -3
- package/app/components/ask/FileChip.tsx +93 -12
- package/app/components/changes/ChangesBanner.tsx +1 -1
- package/app/components/changes/ChangesContentPage.tsx +368 -168
- package/app/components/home/InboxSection.tsx +148 -32
- package/app/components/walkthrough/WalkthroughTooltip.tsx +3 -1
- package/app/components/walkthrough/steps.ts +1 -1
- package/app/hooks/useAskChat.ts +10 -8
- package/app/hooks/useFileUpload.ts +97 -43
- package/app/hooks/useImageUpload.ts +1 -1
- package/app/lib/acp/agent-descriptors.ts +3 -0
- package/app/lib/acp/subprocess.ts +56 -8
- package/app/lib/agent/prompt.ts +15 -4
- package/app/lib/custom-agents.ts +109 -1
- package/app/lib/file-ops.ts +58 -0
- package/app/lib/i18n/modules/ai-chat.ts +37 -0
- package/app/lib/i18n/modules/knowledge.ts +12 -0
- package/app/lib/inbox-upload.ts +86 -0
- package/app/lib/mcp-agents.ts +30 -1
- package/app/lib/types.ts +12 -0
- package/app/package.json +1 -1
- package/app/scripts/extract-pdf.cjs +110 -3
- package/bin/lib/mcp-agents.js +34 -1
- package/bin/lib/mcp-install.js +94 -20
- package/bin/lib/toml.js +125 -0
- package/package.json +1 -1
- package/scripts/build-runtime-archive.sh +5 -1
- package/scripts/setup.js +19 -0
- package/_standalone/.next/static/chunks/4237-ffc6e7c15d4007b6.js +0 -1
- package/_standalone/.next/static/chunks/6878-e2c5459e1c608f89.js +0 -1
- package/_standalone/.next/static/chunks/7249-6cf8f2b78718c59e.js +0 -11
- package/_standalone/.next/static/chunks/8520-56ec9ff087c15204.js +0 -22
- package/_standalone/.next/static/chunks/9286-5b09baa5200318c2.js +0 -1
- package/_standalone/.next/static/chunks/app/agents/[agentKey]/page-35ea6de1af2be3b5.js +0 -1
- package/_standalone/.next/static/chunks/app/api/a2a/discover/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/a2a/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/config/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/detect/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/install/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/registry/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/session/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/agent-activity/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/agents/custom/detect/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/agents/custom/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/ask/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/ask-sessions/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/auth/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/backlinks/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/bootstrap/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/changes/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/export/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/extract-pdf/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/file/import/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/file/raw/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/file/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/files/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/git/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/graph/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/health/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/inbox/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/init/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/agents/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/install/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/install-skill/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/restart/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/status/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/uninstall/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/monitoring/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/recent-files/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/restart/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/search/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/list-models/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/reset-token/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/test-key/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/check-path/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/check-port/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/generate-token/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/ls/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/skills/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/sync/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/tree-version/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/uninstall/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/update/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/update-check/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/update-status/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/workflows/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/changes/page-6d2f49651c0061f7.js +0 -1
- package/_standalone/.next/static/chunks/app/echo/page-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/loading-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/trash/page-f92b728b78ac0f7e.js +0 -1
- package/_standalone/.next/static/chunks/app/view/[...path]/loading-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/wiki/page-641edb1f3cff2f93.js +0 -1
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/css/6c104b118d3bc9b7.css +0 -1
- package/_standalone/.next/static/u8p6oIRTcr_ns-ElNZ9rl/_buildManifest.js +0 -1
- /package/_standalone/.next/static/{u8p6oIRTcr_ns-ElNZ9rl → 5GmVArEG8OX03azKICsGq}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7249],{3590:(e,t,r)=>{function s(e){return{connected:e.filter(e=>e.present&&e.installed),detected:e.filter(e=>e.present&&!e.installed),notFound:e.filter(e=>!e.present)}}function n(e){return e.present&&e.installed?"connected":e.present?"detected":"notFound"}function i(e){return f(`${e.name} ${e.description}`)}function o(e){let t=[];return e.mcpEnabled&&!e.mcpRunning&&t.push({id:"mcp-stopped",severity:"error",title:e.copy.riskMcpStopped}),e.detectedCount>0&&t.push({id:"detected-unconfigured",severity:"warn",title:e.copy.riskDetected(e.detectedCount)}),e.allSkillsDisabled&&t.push({id:"skills-disabled",severity:"warn",title:e.copy.riskSkillsDisabled}),t}function l(e){return new Set(e.filter(e=>!e.enabled&&"user"===e.source||0===e.description.trim().length).map(e=>e.name))}function a(e){let t=e.filter(e=>!e.ok).map(e=>e.skillName);return{total:e.length,succeeded:e.length-t.length,failed:t.length,failedSkills:t}}function d(e,t){let r=t.query.trim().toLowerCase();return e.filter(e=>{let s;return("all"===t.status||n(e)===t.status)&&("all"===t.transport||("stdio"===(s=(e.transport??e.preferredTransport??"").toLowerCase())||"http"===s?s:"other")===t.transport)&&(!r||`${e.name} ${e.key} ${e.configPath??""}`.toLowerCase().includes(r))})}function c(e){let t=e.filter(e=>!e.ok).length;return{total:e.length,succeeded:e.length-t,failed:t}}function u(e){let t=new Map;for(let r of e)for(let e of r.configuredMcpServers??[]){let s=t.get(e);s?s.push(r.name):t.set(e,[r.name])}return[...t.entries()].map(([e,t])=>({serverName:e,agents:t})).sort((e,t)=>t.agents.length-e.agents.length||e.serverName.localeCompare(t.serverName))}function m(e){let t=new Map;for(let r of e)for(let e of r.installedSkillNames??[]){let s=t.get(e);s?s.push(r.name):t.set(e,[r.name])}return[...t.entries()].map(([e,t])=>({skillName:e,agents:t})).sort((e,t)=>t.agents.length-e.agents.length||e.skillName.localeCompare(t.skillName))}r.d(t,{$2:()=>i,$t:()=>s,G9:()=>j,GU:()=>h,HL:()=>u,IK:()=>l,Ri:()=>v,ag:()=>b,fH:()=>d,gJ:()=>x,qC:()=>g,x3:()=>m,xJ:()=>c,xR:()=>a,yQ:()=>f,yv:()=>n,zK:()=>o});let p={connected:0,detected:1,notFound:2};function x(e){return[...e].sort((e,t)=>{let r=p[n(e)],s=p[n(t)];return r!==s?r-s:e.name.localeCompare(t.name)})}function g(e,t){let r=t.query.trim().toLowerCase();return e.filter(e=>("all"===t.source||e.source===t.source)&&(!r||`${e.name} ${e.description} ${e.path}`.toLowerCase().includes(r)))}function f(e){let t=e.toLowerCase();return t.includes("search")||t.includes("research")||t.includes("arxiv")||t.includes("paper")?"research":t.includes("doc")||t.includes("write")||t.includes("readme")||t.includes("copy")||t.includes("slide")||t.includes("ppt")?"docs":t.includes("deploy")||t.includes("ops")||t.includes("ci")||t.includes("ship")||t.includes("qa")||t.includes("review")||t.includes("test")?"ops":t.includes("memory")||t.includes("mind")||t.includes("handoff")||t.includes("session")?"memory":"coding"}function b(e,t){let r=new Set(e.map(e=>e.name)),s=new Map;for(let e of t)s.set(e.skillName,e.agents);let n=[];for(let t of e)n.push({name:t.name,kind:"mindos",mindosSkill:t,agents:s.get(t.name)??[],capability:i(t),enabled:t.enabled,source:t.source,description:t.description});for(let e of t)r.has(e.skillName)||n.push({name:e.skillName,kind:"native",agents:e.agents,capability:f(e.skillName),enabled:!0,source:"native",description:""});return n}function h(e){return{research:e.filter(e=>"research"===e.capability),coding:e.filter(e=>"coding"===e.capability),docs:e.filter(e=>"docs"===e.capability),ops:e.filter(e=>"ops"===e.capability),memory:e.filter(e=>"memory"===e.capability)}}function v(e,t){let r=t.query.trim().toLowerCase(),s=new Set(e.filter(e=>"mindos"===e.kind&&(!e.enabled&&"user"===e.source||0===e.description.trim().length)).map(e=>e.name));return e.filter(e=>("all"===t.source||("native"!==t.source||"native"===e.kind)&&("builtin"!==t.source||"builtin"===e.source)&&("user"!==t.source||"user"===e.source))&&("enabled"!==t.status||!!e.enabled)&&("disabled"!==t.status||!e.enabled)&&("attention"!==t.status||!!s.has(e.name))&&("all"===t.capability||e.capability===t.capability)&&(!r||!!`${e.name} ${e.description}`.toLowerCase().includes(r))&&!0)}function j(e,t){return e.filter(e=>"mindos"===e.kind&&e.enabled!==t).map(e=>e.name)}},85641:(e,t,r)=>{r.d(t,{A:()=>w});var s=r(95155),n=r(12115),i=r(61878),o=r(33591),l=r(48368),a=r(15573),d=r(97810),c=r(53961),u=r(33210),m=r(51914),p=r(67635),x=r(6296),g=r(66088),f=r(77800),b=r(68459),h=r(22356),v=r(7834),j=r(4235),y=r(20171),N=r(39498),k=r(3590);let C={research:i.A,coding:o.A,docs:l.A,ops:a.A,memory:d.A};function A({text:e,className:t=""}){let r=(0,n.useMemo)(()=>{let t;return(t=(t=e.replace(/```(\w*)\n([\s\S]*?)```/g,(e,t,r)=>`<pre><code>${r.trimEnd().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</code></pre>`).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/^#### (.+)$/gm,"<h4>$1</h4>").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/^# (.+)$/gm,"<h1>$1</h1>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/^---$/gm,"<hr/>").replace(/^- (.+)$/gm,"<li>$1</li>").replace(/^\* (.+)$/gm,"<li>$1</li>").replace(/^\d+\. (.+)$/gm,"<li>$1</li>")).replace(/((?:<li>.*<\/li>\n?)+)/g,"<ul>$1</ul>")).split("\n").map(e=>{let t=e.trim();return t?/^<(h[1-4]|ul|ol|li|pre|hr|div|p|blockquote)/.test(t)?e:`<p>${t}</p>`:""}).join("\n")},[e]);return(0,s.jsx)("div",{className:`prose prose-sm prose-invert max-w-none
|
|
2
|
+
prose-headings:text-foreground prose-headings:font-semibold prose-headings:mt-4 prose-headings:mb-2
|
|
3
|
+
prose-h1:text-sm prose-h2:text-xs prose-h3:text-xs
|
|
4
|
+
prose-p:text-xs prose-p:text-foreground/80 prose-p:leading-relaxed prose-p:my-1.5
|
|
5
|
+
prose-li:text-xs prose-li:text-foreground/80 prose-li:my-0.5
|
|
6
|
+
prose-strong:text-foreground prose-strong:font-semibold
|
|
7
|
+
prose-code:text-[var(--amber)] prose-code:bg-muted/50 prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:text-2xs prose-code:font-mono
|
|
8
|
+
prose-pre:bg-muted/30 prose-pre:border prose-pre:border-border/50 prose-pre:rounded-lg prose-pre:p-3 prose-pre:text-2xs prose-pre:overflow-x-auto
|
|
9
|
+
prose-ul:my-1 prose-ol:my-1
|
|
10
|
+
prose-hr:border-border/30 prose-hr:my-3
|
|
11
|
+
${t}`,dangerouslySetInnerHTML:{__html:r}})}function w({open:e,skillName:t,skill:r,agentNames:i=[],allAgentNames:o=[],isNative:l=!1,nativeSourcePath:a,copy:d,onClose:w,onToggle:$,onDelete:T,onRefresh:z,onAddAgent:L,onRemoveAgent:E}){let K,P,[F,M]=(0,n.useState)(null),[O,R]=(0,n.useState)(""),[H,J]=(0,n.useState)(!1),[_,q]=(0,n.useState)(!1),[W,B]=(0,n.useState)(!1),[I,U]=(0,n.useState)(!1),[Q,G]=(0,n.useState)(null),[V,Y]=(0,n.useState)(!1),[X,Z]=(0,n.useState)(!1),[ee,et]=(0,n.useState)(!1),er=(0,n.useCallback)(async()=>{if(t){J(!0),q(!1);try{if(l&&a){let e=await (0,h.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"read-native",name:t,sourcePath:a})});M(e.content),R(e.description||"")}else if(!l){let e=await (0,h.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"read",name:t})});M(e.content)}}catch{q(!0)}finally{J(!1)}}},[t,l,a]);(0,n.useEffect)(()=>{e&&t&&(M(null),R(""),q(!1),G(null),U(!1),Y(!1),Z(!1),et(!1),er())},[e,t,er]),(0,n.useEffect)(()=>{if(e)return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&w()}},[e,w]);let es=(0,n.useCallback)(async()=>{!F||await (0,v.l)(F)&&j.oR.copy()},[F]),en=(0,n.useCallback)(async e=>{if(t&&$){Y(!0);try{await $(t,e)}finally{Y(!1)}}},[t,$]),ei=(0,n.useCallback)(async()=>{if(t&&T){B(!1),U(!0);try{await T(t),G(d.deleted),await z?.(),setTimeout(()=>w(),800)}catch{G(d.deleteFailed),U(!1)}}},[t,T,z,w,d.deleted,d.deleteFailed]);if(!e||!t)return null;let eo=r?(0,k.yQ)(`${r.name} ${r.description}`):(0,k.yQ)(t),el=C[eo]??c.A,ea=r?.source==="user",ed=l?d.sourceNative:r?.source==="builtin"?d.sourceBuiltin:d.sourceUser,ec=r?.description||O||"",eu=r?.path||(l&&a?`${a}/${t}/SKILL.md`:""),em=F?(K=F,(P=F.match(/^---\n[\s\S]*?\n---\n?/))&&(K=F.slice(P[0].length).trim()),{triggerConditions:ec||"",instructions:K}):null,ep=o.filter(e=>!i.includes(e));return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 z-40 overlay-backdrop",onClick:w,"aria-hidden":"true"}),(0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":t,className:"fixed right-0 top-0 z-50 h-full w-full max-w-md border-l border-border bg-card shadow-2xl flex flex-col animate-in slide-in-from-right duration-200",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border/60 bg-gradient-to-r from-card to-card/80 shrink-0",children:[(0,s.jsx)("div",{className:"w-9 h-9 rounded-xl bg-[var(--amber)]/[0.08] flex items-center justify-center text-[var(--amber)] shrink-0",children:(0,s.jsx)(el,{size:18})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-foreground truncate",children:t}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,s.jsx)("span",{className:`text-2xs px-2 py-0.5 rounded-full font-medium select-none ${l||r?.source==="builtin"?"bg-muted text-muted-foreground":"bg-[var(--amber-dim)] text-[var(--amber-text)]"}`,children:ed}),(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/60 capitalize",children:eo})]})]}),(0,s.jsx)("button",{type:"button",onClick:w,className:"shrink-0 p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted cursor-pointer transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":d.close,children:(0,s.jsx)(u.A,{size:16})})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-5",children:[ec&&(0,s.jsxs)("section",{children:[(0,s.jsx)(S,{label:"Trigger Conditions"}),(0,s.jsx)("div",{className:"rounded-lg border border-border/40 bg-muted/[0.03] p-3.5",children:(0,s.jsx)("p",{className:"text-xs text-foreground/80 leading-relaxed whitespace-pre-wrap",children:ec})})]}),!ec&&!l&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground italic",children:d.noDescription}),(0,s.jsx)("section",{children:(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[!l&&r&&(0,s.jsx)(D,{label:d.enabled,value:r.enabled?"✓":"—",tone:r.enabled?"ok":"muted"}),(0,s.jsx)(D,{label:d.capability,value:eo}),(0,s.jsx)(D,{label:d.source,value:ed}),(0,s.jsx)(D,{label:d.agents,value:String(i.length)})]})}),(0,s.jsxs)("section",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)(S,{label:d.agents,noMargin:!0}),L&&ep.length>0&&(0,s.jsxs)("button",{type:"button",onClick:()=>Z(!X),className:"inline-flex items-center gap-1 text-2xs font-medium text-[var(--amber)] hover:opacity-80 transition-opacity cursor-pointer",children:[(0,s.jsx)(m.A,{size:12}),(0,s.jsx)("span",{children:"Add"})]})]}),X&&ep.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-2 p-2 rounded-lg border border-dashed border-[var(--amber)]/30 bg-[var(--amber)]/[0.03]",children:ep.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>{L?.(t,e),Z(!1)},className:"inline-flex items-center gap-1 px-2 py-1 text-2xs rounded-md border border-border bg-card hover:bg-muted cursor-pointer transition-colors",children:[(0,s.jsx)(m.A,{size:10,className:"text-[var(--amber)]"}),(0,s.jsx)("span",{className:"text-foreground/80",children:e})]},e))}),i.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(e=>(0,s.jsx)(N.lx,{name:e,size:"sm",onRemove:E?()=>E(t,e):void 0},e))}):(0,s.jsx)("div",{className:"rounded-lg border border-border/40 bg-card/30 p-3 text-center",children:(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:d.noAgents})})]}),(null!==F||H||_)&&(0,s.jsxs)("section",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)(S,{label:"Instructions",noMargin:!0}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:F&&(0,s.jsxs)("button",{type:"button",onClick:es,className:"inline-flex items-center gap-1 text-2xs text-muted-foreground hover:text-foreground cursor-pointer transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded px-1.5 py-0.5","aria-label":d.copyContent,children:[(0,s.jsx)(p.A,{size:11}),d.copyContent]})})]}),H&&(0,s.jsxs)("div",{className:"rounded-lg border border-border bg-background p-6 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,s.jsx)(x.A,{size:14,className:"animate-spin"}),d.loading]}),_&&(0,s.jsxs)("div",{className:"rounded-lg border border-destructive/20 bg-destructive/[0.03] p-4 text-center space-y-2",children:[(0,s.jsx)("p",{className:"text-sm text-destructive",children:d.loadFailed}),(0,s.jsx)("button",{type:"button",onClick:er,className:"text-xs text-foreground underline hover:no-underline cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded",children:d.retry})]}),em&&!H&&!_&&(0,s.jsx)("div",{className:`rounded-lg border border-border/50 bg-muted/[0.02] p-4 overflow-hidden transition-all duration-200 ${!ee?"max-h-60":""}`,children:(0,s.jsx)(A,{text:em.instructions})}),em&&!H&&!_&&em.instructions.split("\n").length>15&&(0,s.jsxs)("button",{type:"button",onClick:()=>et(!ee),className:"inline-flex items-center gap-1 mt-2 text-2xs font-medium text-[var(--amber)] hover:opacity-80 transition-opacity cursor-pointer",children:[(0,s.jsx)(g.A,{size:12,className:`transition-transform duration-200 ${ee?"rotate-180":""}`}),(0,s.jsx)("span",{children:ee?"Collapse":"View All"})]})]}),eu&&(0,s.jsxs)("section",{children:[(0,s.jsx)(S,{label:d.path}),(0,s.jsx)("div",{className:"rounded-lg border border-border/50 bg-muted/[0.03] p-3",children:(0,s.jsx)("code",{className:"text-2xs text-foreground/60 font-mono break-all leading-relaxed",children:eu})})]}),Q&&(0,s.jsx)("div",{role:"status","aria-live":"polite",className:"rounded-md border border-border bg-muted/50 px-3 py-2 text-xs text-muted-foreground animate-in fade-in duration-200",children:Q})]}),!l&&r&&(0,s.jsxs)("div",{className:"shrink-0 border-t border-border px-5 py-3 flex items-center gap-2",children:[$&&(0,s.jsxs)("div",{className:"flex items-center gap-2 mr-auto",children:[(0,s.jsx)(f.A,{size:14,className:"text-muted-foreground","aria-hidden":"true"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:r.enabled?d.enabled:d.disabled}),(0,s.jsx)(y.lM,{size:"sm",checked:r.enabled,onChange:e=>void en(e),disabled:V})]}),ea&&T&&(0,s.jsxs)("button",{type:"button",onClick:()=>B(!0),disabled:I,className:"inline-flex items-center gap-1.5 px-2.5 min-h-[32px] text-xs rounded-md border border-destructive/30 text-destructive hover:bg-destructive/10 cursor-pointer disabled:opacity-50 transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[I?(0,s.jsx)(x.A,{size:12,className:"animate-spin"}):(0,s.jsx)(b.A,{size:12}),d.deleteSkill]})]})]}),(0,s.jsx)(N.TM,{open:W,title:d.confirmDeleteTitle,message:t?d.confirmDeleteMessage(t):"",confirmLabel:d.confirmDeleteAction,cancelLabel:d.cancelAction,onConfirm:()=>void ei(),onCancel:()=>B(!1),variant:"destructive"})]})}function S({label:e,noMargin:t}){return(0,s.jsx)("h3",{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider ${t?"":"mb-2"}`,children:e})}function D({label:e,value:t,tone:r="default"}){return(0,s.jsxs)("div",{className:"rounded-xl border border-border/50 bg-muted/[0.03] px-3.5 py-3 hover:bg-muted/[0.06] transition-colors duration-100",children:[(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/60 block mb-1 uppercase tracking-wider",children:e}),(0,s.jsx)("span",{className:`text-sm font-semibold capitalize ${"ok"===r?"text-[var(--success)]":"muted"===r?"text-muted-foreground":"text-foreground"}`,children:t})]})}},90777:(e,t,r)=>{r.d(t,{A:()=>h});var s=r(95155),n=r(12115),i=r(33210),o=r(13545),l=r(12651),a=r(68822),d=r(15573),c=r(53961),u=r(66088),m=r(21362),p=r(6296),x=r(35581),g=r(15631),f=r(4235),b=r(20171);function h({open:e,onClose:t,onSuccess:r,existingAgents:h,editAgent:j}){let{t:y}=(0,x.Y)(),N=y.agentsContent.overview,k=(0,n.useRef)(null),C=(0,n.useRef)(null),A=!!j,[w,S]=(0,n.useState)("input"),[D,$]=(0,n.useState)(!1),[T,z]=(0,n.useState)(!1),[L,E]=(0,n.useState)(null),[K,P]=(0,n.useState)(null),[F,M]=(0,n.useState)(!1),[O,R]=(0,n.useState)(!1),[H,J]=(0,n.useState)({name:"",baseDir:"",global:"",configKey:"mcpServers",format:"json",preferredTransport:"stdio",project:"",presenceCli:"",skillDir:""});(0,n.useEffect)(()=>{e&&(j?(J({name:j.name,baseDir:j.customBaseDir||"",global:j.globalPath||"",configKey:j.configKey||"mcpServers",format:j.format||"json",preferredTransport:j.preferredTransport||"stdio",project:j.projectPath||"",presenceCli:"",skillDir:j.skillWorkspacePath||""}),S("result"),R(!0),P(null),E(null)):(J({name:"",baseDir:"",global:"",configKey:"mcpServers",format:"json",preferredTransport:"stdio",project:"",presenceCli:"",skillDir:""}),S("input"),R(!1),P(null),E(null),M(!1)))},[e,j]),(0,n.useEffect)(()=>{e&&"input"===w&&setTimeout(()=>C.current?.focus(),100)},[e,w]),(0,g.r)(k,e),(0,n.useEffect)(()=>{if(!e)return;let r=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t]);let _=(0,n.useMemo)(()=>{let e=new Set(h.map(e=>e.key));return A&&j&&e.delete(j.key),e},[h,A,j]),q=(0,n.useMemo)(()=>H.name.toLowerCase().replace(/[^\x20-\x7E]/g,"").replace(/[_\s]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-{2,}/g,"-").replace(/^-|-$/g,""),[H.name]),W=(0,n.useMemo)(()=>{if(A||!H.name.trim())return null;let e=q||"";if(!e)return null;if(_.has(e)){let t=h.find(t=>t.key===e);return t?.isCustom?N.customAgentKeyConflict?.(e)??`An agent with key "${e}" already exists`:N.customAgentBuiltinConflict?.(t?.name||e)??`Conflicts with built-in agent "${t?.name||e}"`}return null},[A,q,_,h,H.name,N]),B=H.name.trim()&&H.baseDir.trim()&&!W,I=(0,n.useCallback)((e,t)=>{J(r=>({...r,[e]:t}))},[]),U=(0,n.useCallback)(async()=>{if(!B)return;E(null),$(!0);let e=H.baseDir.trim();if(!e.startsWith("~/")){let t=e.endsWith("/")?e:e+"/";I("global",t+"mcp.json"),I("skillDir",t+"skills/"),P({exists:!1,hasSkillsDir:!1}),S("result"),$(!1);return}let t=new AbortController,r=setTimeout(()=>t.abort(),3e3);try{let s=await fetch("/api/agents/custom/detect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseDir:e}),signal:t.signal});clearTimeout(r);let n=await s.json();if(!s.ok)return void E(n.error||N.customAgentFailedSave);P(n),n.detectedConfig?I("global",n.detectedConfig):I("global",(e.endsWith("/")?e:e+"/")+"mcp.json"),n.detectedFormat&&I("format",n.detectedFormat),n.detectedConfigKey&&I("configKey",n.detectedConfigKey),I("skillDir",n.detectedSkillDir||(e.endsWith("/")?e:e+"/")+"skills/"),S("result")}catch{clearTimeout(r);let t=e.endsWith("/")?e:e+"/";I("global",t+"mcp.json"),I("skillDir",t+"skills/"),P({exists:!1,hasSkillsDir:!1}),M(!0),S("result")}finally{$(!1)}},[B,H.baseDir,I,N]),Q=(0,n.useCallback)(async()=>{z(!0),E(null);let e=A?{key:j.key,name:H.name.trim(),baseDir:H.baseDir.trim(),global:H.global.trim()||void 0,configKey:H.configKey.trim()||void 0,format:H.format,preferredTransport:H.preferredTransport,project:H.project.trim()||null,presenceCli:H.presenceCli.trim()||void 0,skillDir:H.skillDir.trim()||void 0}:{name:H.name.trim(),baseDir:H.baseDir.trim(),global:H.global.trim()||void 0,configKey:H.configKey.trim()||void 0,format:H.format,preferredTransport:H.preferredTransport,project:H.project.trim()||null,presenceCli:H.presenceCli.trim()||void 0,skillDir:H.skillDir.trim()||void 0};try{let s=await fetch("/api/agents/custom",{method:A?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await s.json();if(!s.ok){E(n.error||N.customAgentFailedSave),z(!1);return}let i=A?N.customAgentUpdated(H.name.trim()):N.customAgentAdded(H.name.trim());f.oR.success(i),r(),t()}catch{E(N.customAgentNetworkError)}finally{z(!1)}},[A,j,H,r,t,N]),G=(0,n.useCallback)(e=>{"Enter"===e.key&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement)&&(e.preventDefault(),"input"===w&&B&&!D?U():"result"!==w||T||Q())},[w,B,D,T,U,Q]);if(!e)return null;let V=A?N.editCustomAgentTitle(j.name):N.addCustomAgentTitle;return(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",role:"dialog","aria-modal":"true","aria-labelledby":"custom-agent-modal-title",children:[(0,s.jsx)("div",{className:"absolute inset-0 modal-backdrop",onClick:t,"aria-hidden":"true"}),(0,s.jsxs)("div",{ref:k,className:"relative bg-card border border-border rounded-xl shadow-2xl max-w-md w-full mx-4 animate-in fade-in zoom-in-95 duration-200 max-h-[85vh] overflow-y-auto",onKeyDown:G,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-5 pt-5 pb-1",children:[(0,s.jsx)("h2",{id:"custom-agent-modal-title",className:"text-base font-semibold text-foreground",children:V}),(0,s.jsx)("button",{type:"button",onClick:t,className:"w-7 h-7 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-muted transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:(0,s.jsx)(i.A,{size:16})})]}),(0,s.jsxs)("div",{className:"px-5 py-4 space-y-4",children:[(0,s.jsxs)(b.D0,{label:N.customAgentName,children:[(0,s.jsx)("input",{ref:C,value:H.name,onChange:e=>I("name",e.target.value),placeholder:N.customAgentNamePlaceholder,"aria-invalid":!!W,className:`w-full px-3 py-2 text-sm bg-background border rounded-lg text-foreground placeholder:text-muted-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 ${W?"border-[var(--error)] focus-visible:ring-[var(--error)]":"border-border"}`,autoComplete:"off"}),W?(0,s.jsxs)("p",{className:"text-xs text-[var(--error)] mt-1 flex items-center gap-1",children:[(0,s.jsx)(o.A,{size:12}),W]}):H.name.trim()&&q?(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:N.customAgentKeyPreview(q)}):null]}),(0,s.jsxs)(b.D0,{label:N.customAgentDir,hint:"input"===w?N.customAgentDirHint:void 0,children:[(0,s.jsx)(b.pd,{value:H.baseDir,onChange:e=>{I("baseDir",e.target.value),"result"===w&&(S("input"),P(null))},placeholder:N.customAgentDirPlaceholder,autoComplete:"off"}),"result"===w&&K?.exists&&(0,s.jsxs)("p",{className:"text-xs text-[var(--success)] mt-1 flex items-center gap-1",children:[(0,s.jsx)(l.A,{size:12}),N.customAgentDirFound]}),"result"===w&&K&&!K.exists&&!F&&(0,s.jsxs)("p",{className:"text-xs text-[var(--info,var(--muted-foreground))] mt-1 flex items-center gap-1",children:[(0,s.jsx)(a.A,{size:12}),N.customAgentDirNotFound]}),"result"===w&&F&&(0,s.jsxs)("p",{className:"text-xs text-[var(--amber)] mt-1 flex items-center gap-1",children:[(0,s.jsx)(o.A,{size:12}),N.customAgentDetectTimeout]})]}),"result"===w&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:`rounded-lg p-4 space-y-3 ${K?.exists?"border border-[var(--success)]/20 bg-[var(--success)]/5":"border border-border bg-muted/30"}`,children:[(0,s.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:K?.exists?N.customAgentDetectedTitle:N.customAgentDefaultTitle}),(0,s.jsxs)("div",{className:"space-y-2.5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground mb-1",children:N.customAgentConfigLabel}),(0,s.jsx)("span",{className:"text-sm text-foreground font-mono truncate block",children:H.global}),K?.mcpParseError&&(0,s.jsxs)("p",{className:"text-xs text-[var(--error)] mt-1 flex items-center gap-1",children:[(0,s.jsx)(o.A,{size:12,className:"shrink-0"}),K.mcpParseError]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground mb-1",children:N.customAgentFormatLabel}),(0,s.jsx)("span",{className:"text-sm text-foreground",children:H.format.toUpperCase()})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground mb-1",children:"Config Key"}),(0,s.jsx)("span",{className:"text-sm text-foreground font-mono",children:H.configKey})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground mb-1",children:N.customAgentTransportLabel}),(0,s.jsx)("span",{className:"text-sm text-foreground",children:H.preferredTransport})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("p",{className:"text-xs text-muted-foreground mb-1 flex items-center gap-1",children:[(0,s.jsx)(d.A,{size:11,className:"shrink-0","aria-hidden":"true"}),"MCP Servers"]}),K?.mcpServers&&K.mcpServers.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:K.mcpServers.map(e=>(0,s.jsx)("span",{className:"text-xs bg-muted/60 text-foreground px-2 py-0.5 rounded font-mono",children:e},e))}):(0,s.jsx)("span",{className:"text-sm text-muted-foreground",children:"—"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("p",{className:"text-xs text-muted-foreground mb-1 flex items-center gap-1",children:[(0,s.jsx)(c.A,{size:11,className:"shrink-0","aria-hidden":"true"}),N.customAgentSkillsLabel]}),K?.skillNames&&K.skillNames.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:K.skillNames.map(e=>(0,s.jsx)("span",{className:"text-xs bg-[var(--amber-dim)] text-[var(--amber-text,var(--foreground))] px-2 py-0.5 rounded font-mono",children:e},e))}):(0,s.jsx)("span",{className:"text-sm text-muted-foreground",children:"—"})]})]})]}),(0,s.jsxs)("button",{type:"button",onClick:()=>R(e=>!e),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded",children:[O?(0,s.jsx)(u.A,{size:14}):(0,s.jsx)(m.A,{size:14}),N.customAgentCustomize]}),(0,s.jsx)("div",{className:"grid transition-[grid-template-rows] duration-200 ease-out",style:{gridTemplateRows:O?"1fr":"0fr"},children:(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsxs)("div",{className:"rounded-xl border border-border/50 bg-card/50 p-5 space-y-4",children:[(0,s.jsx)(b.D0,{label:N.customAgentConfigPath,children:(0,s.jsx)(b.pd,{value:H.global,onChange:e=>I("global",e.target.value),autoComplete:"off"})}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsx)(b.D0,{label:N.customAgentConfigKey,children:(0,s.jsx)(b.pd,{value:H.configKey,onChange:e=>I("configKey",e.target.value),autoComplete:"off"})}),(0,s.jsx)(b.D0,{label:N.customAgentFormat,children:(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)(v,{label:"JSON",checked:"json"===H.format,onChange:()=>I("format","json"),name:"format"}),(0,s.jsx)(v,{label:"TOML",checked:"toml"===H.format,onChange:()=>I("format","toml"),name:"format"})]})})]}),(0,s.jsx)(b.D0,{label:N.customAgentTransport,children:(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(v,{label:"stdio",checked:"stdio"===H.preferredTransport,onChange:()=>I("preferredTransport","stdio"),name:"transport"}),(0,s.jsx)(v,{label:"http",checked:"http"===H.preferredTransport,onChange:()=>I("preferredTransport","http"),name:"transport"})]})}),(0,s.jsx)(b.D0,{label:N.customAgentSkillDir,hint:N.customAgentSkillDirHint,children:(0,s.jsx)(b.pd,{value:H.skillDir,onChange:e=>I("skillDir",e.target.value),placeholder:N.customAgentSkillDirPlaceholder,autoComplete:"off"})}),(0,s.jsx)(b.D0,{label:N.customAgentProjectConfig,children:(0,s.jsx)(b.pd,{value:H.project,onChange:e=>I("project",e.target.value),autoComplete:"off"})}),(0,s.jsx)(b.D0,{label:N.customAgentCliBinary,children:(0,s.jsx)(b.pd,{value:H.presenceCli,onChange:e=>I("presenceCli",e.target.value),placeholder:N.customAgentCliBinaryPlaceholder,autoComplete:"off"})})]})})})]}),L&&(0,s.jsxs)("div",{className:"rounded-lg border border-[var(--error)]/30 bg-[var(--error)]/5 p-3 flex items-start gap-2",children:[(0,s.jsx)(o.A,{size:14,className:"text-[var(--error)] mt-0.5 shrink-0"}),(0,s.jsx)("p",{className:"text-sm text-[var(--error)]",children:L})]})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 px-5 pb-5 pt-1",children:[(0,s.jsx)("button",{type:"button",onClick:t,className:"px-4 min-h-[36px] text-sm rounded-lg border border-border hover:bg-muted cursor-pointer transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:N.customAgentCancel}),"input"===w?(0,s.jsx)("button",{type:"button",onClick:U,disabled:!B||D,className:"px-4 min-h-[36px] text-sm rounded-lg bg-[var(--amber)] text-[var(--amber-foreground)] hover:bg-[var(--amber)]/90 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring flex items-center gap-2",children:D?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p.A,{size:14,className:"animate-spin"}),N.customAgentDetecting]}):(0,s.jsxs)(s.Fragment,{children:[N.customAgentContinue,(0,s.jsx)(m.A,{size:14})]})}):(0,s.jsx)("button",{type:"button",onClick:Q,disabled:T,className:"px-4 min-h-[36px] text-sm rounded-lg bg-[var(--amber)] text-[var(--amber-foreground)] hover:bg-[var(--amber)]/90 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring flex items-center gap-2",children:T?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p.A,{size:14,className:"animate-spin"}),A?N.customAgentSaving:N.customAgentAdding]}):L?N.customAgentRetry:A?N.customAgentSave:N.customAgentAdd})]})]})]})}function v({label:e,checked:t,onChange:r,name:n}){return(0,s.jsxs)("label",{className:`px-3 py-1.5 text-sm rounded-md border cursor-pointer transition-all duration-150 select-none ${t?"border-[var(--amber)]/40 bg-[var(--amber-dim)] text-foreground font-medium":"border-border bg-background text-muted-foreground hover:bg-muted"}`,children:[(0,s.jsx)("input",{type:"radio",name:n,checked:t,onChange:r,className:"sr-only"}),e]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7637],{439:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},3926:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]])},6296:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},10762:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]])},12651:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},13545:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},15573:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},21362:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},33210:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},33591:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])},41585:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},44478:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},49387:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},51914:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},52905:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},53961:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},61878:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},67635:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},68459:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},68822:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},73035:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]])},77800:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("toggle-left",[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]])},80723:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},84755:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},84980:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]])},92451:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},93219:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},93631:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("file-plus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]])},97810:(e,a,y)=>{y.d(a,{A:()=>t});let t=(0,y(90425).A)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])}}]);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8520],{2431:(e,t,r)=>{"use strict";r.d(t,{z:()=>a});var n=r(12115);let s="mindos:acp-detection";function a(){let e=(0,n.useRef)(function(){try{let e=sessionStorage.getItem(s);if(!e)return null;let t=JSON.parse(e);if("number"!=typeof t.ts||Date.now()-t.ts>18e5)return null;return t}catch{return null}}()),[t,r]=(0,n.useState)(e.current?.installed??[]),[a,o]=(0,n.useState)(e.current?.notInstalled??[]),[l,i]=(0,n.useState)(!e.current),[u,d]=(0,n.useState)(null),[c,m]=(0,n.useState)(0),p=(0,n.useRef)(!1),f=(0,n.useRef)(!1),g=(0,n.useCallback)(()=>{try{sessionStorage.removeItem(s)}catch{}e.current=null,f.current=!0,m(e=>e+1)},[]);return(0,n.useEffect)(()=>{let e=()=>g();return window.addEventListener("mindos:settings-changed",e),()=>window.removeEventListener("mindos:settings-changed",e)},[g]),(0,n.useEffect)(()=>{let n=f.current;if(f.current=!1,e.current&&Date.now()-e.current.ts<18e5&&0===c||p.current)return;p.current=!0;let l=t.length>0||a.length>0;l||i(!0),d(null);let u=!1;return fetch(`/api/acp/detect${n?"?force=1":""}`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(t=>{if(u)return;let n=t.installed??[],a=t.notInstalled??[];try{sessionStorage.setItem(s,JSON.stringify({installed:n,notInstalled:a,ts:Date.now()}))}catch{}e.current={installed:n,notInstalled:a,ts:Date.now()},r(n),o(a)}).catch(e=>{!u&&(l||d(e.message))}).finally(()=>{p.current=!1,u||i(!1)}),()=>{u=!0}},[c]),{installedAgents:t,notInstalledAgents:a,loading:l,error:u,refresh:g}}},27318:(e,t,r)=>{"use strict";r.d(t,{KT:()=>d,NH:()=>u});var n=r(12115);let s={open:!1,initialMessage:"",source:"user",acpAgent:null},a=new Set;function o(){a.forEach(e=>e())}function l(e){return a.add(e),()=>{a.delete(e)}}function i(){return s}function u(e="",t="user",r=null){s={open:!0,initialMessage:e,source:t,acpAgent:r},o()}function d(){let e=(0,n.useSyncExternalStore)(l,i,i);return{open:e.open,initialMessage:e.initialMessage,source:e.source,acpAgent:e.acpAgent,openWith:(0,n.useCallback)((e,t="user",r=null)=>u(e,t,r),[]),close:(0,n.useCallback)(()=>void(s={open:!1,initialMessage:"",source:"user",acpAgent:null},o()),[])}}},47376:(e,t,r)=>{"use strict";r.d(t,{Ot:()=>c,T_:()=>s,Ux:()=>d,bf:()=>l,jt:()=>a,rl:()=>o});var n=r(20699);r(87358);let s={anthropic:{id:"anthropic",name:"Anthropic",nameZh:"Anthropic",defaultModel:"claude-sonnet-4-6",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://console.anthropic.com/settings/keys",category:"primary"},openai:{id:"openai",name:"OpenAI",nameZh:"OpenAI",defaultModel:"gpt-5.4",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.openai.com/api-keys",category:"primary"},google:{id:"google",name:"Google Gemini",nameZh:"Google Gemini",defaultModel:"gemini-2.5-flash",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://aistudio.google.com/apikey",category:"primary"},groq:{id:"groq",name:"Groq",nameZh:"Groq",defaultModel:"llama-3.3-70b-versatile",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://console.groq.com/keys",category:"more"},xai:{id:"xai",name:"xAI (Grok)",nameZh:"xAI (Grok)",defaultModel:"grok-3",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},openrouter:{id:"openrouter",name:"OpenRouter",nameZh:"OpenRouter",defaultModel:"anthropic/claude-sonnet-4",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},mistral:{id:"mistral",name:"Mistral",nameZh:"Mistral",defaultModel:"mistral-large-latest",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},deepseek:{id:"deepseek",name:"DeepSeek",nameZh:"DeepSeek",defaultModel:"deepseek-chat",piProviderOverride:"openai",fixedBaseUrl:"https://api.deepseek.com/v1",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.deepseek.com/api_keys",category:"more"},zai:{id:"zai",name:"ZhipuAI (GLM)",nameZh:"智谱 AI (GLM 国际版)",defaultModel:"glm-4-plus",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"zai-cn":{id:"zai-cn",name:"ZhipuAI (GLM China)",nameZh:"智谱 AI (GLM 国内版)",defaultModel:"glm-4-plus",piProviderOverride:"zai",fixedBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://open.bigmodel.cn/",category:"more"},"kimi-coding":{id:"kimi-coding",name:"Kimi Coding",nameZh:"Kimi Coding (月之暗面)",defaultModel:"kimi-k2-thinking",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},cerebras:{id:"cerebras",name:"Cerebras",nameZh:"Cerebras",defaultModel:"llama-4-scout-17b-16e",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},minimax:{id:"minimax",name:"MiniMax",nameZh:"MiniMax (国际版)",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"minimax-cn":{id:"minimax-cn",name:"MiniMax (China)",nameZh:"MiniMax (国内版)",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},huggingface:{id:"huggingface",name:"Hugging Face",nameZh:"Hugging Face",defaultModel:"Qwen/Qwen3-235B-A22B-Thinking-2507",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},ollama:{id:"ollama",name:"Ollama",nameZh:"Ollama (本地)",defaultModel:"llama3.2",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:11434/v1",apiKeyFallback:"ollama",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://ollama.com/download",category:"more"}},a=Object.keys(s);function o(e){return e in s}function l(){let e=[],t=[];for(let r of a)"primary"===s[r].category?e.push(r):t.push(r);return t.sort((e,t)=>s[e].name.localeCompare(s[t].name)),{primary:e,more:t}}function i(e){return s[e].piProviderOverride??e}let u={deepseek:"DEEPSEEK_API_KEY"};function d(e){return u[e]?u[e]:m[i(e)]}function c(e){let t=s[e];if(t.fixedBaseUrl)return t.fixedBaseUrl;try{let t=(0,n.zr)(i(e));return t[0]?.baseUrl??""}catch{return""}}let m={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","azure-openai-responses":"AZURE_OPENAI_API_KEY",google:"GEMINI_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",openrouter:"OPENROUTER_API_KEY",zai:"ZAI_API_KEY","zai-cn":"ZAI_API_KEY",mistral:"MISTRAL_API_KEY",minimax:"MINIMAX_API_KEY","minimax-cn":"MINIMAX_API_KEY",huggingface:"HF_TOKEN","kimi-coding":"KIMI_API_KEY"}},48391:(e,t,r)=>{"use strict";r.d(t,{Oo:()=>s,dB:()=>d});var n=r(12115);function s(e){let t=e.replace(/<(thinking|reasoning|scratchpad)>[\s\S]*?<\/\1>/gi,"");return(t=t.replace(/<(?:thinking|reasoning|scratchpad)>[\s\S]*$/gi,"")).trim()}let a=new Set(["create_file","write_file","batch_create_files","append_to_file","insert_after_heading","update_section","edit_lines","delete_file","rename_file","move_file","append_csv"]),o=new Set(["read_file","read_lines","search","list_files"]);function l(e,t){return t&&"object"==typeof t?"string"==typeof t.path?t.path:"string"==typeof t.from_path?t.from_path:"batch_create_files"===e&&Array.isArray(t.files)?t.files.map(e=>e.path??"").filter(Boolean).join(", "):"":""}async function i(e){try{let t=await fetch(`/api/file?path=${encodeURIComponent(e)}&op=read_file`);if(!t.ok)return"";return(await t.json()).content??""}catch{return""}}async function u(e,t,r,n){let u=e.getReader(),d=new TextDecoder,c="",m=[],p=new Map,f="",g=0,h=new Set;try{for(;!n?.aborted;){let{done:e,value:n}=await u.read();if(e)break;let y=(c+=d.decode(n,{stream:!0})).split("\n");for(let e of(c=y.pop()??"",y)){let n,u=e.trim();if(!u.startsWith("data:"))continue;let d=u.slice(5).trim();if(!d)continue;try{n=JSON.parse(d)}catch{continue}let c=n.type;switch(c){case"tool_start":{var x,b,v;let e=n.toolName,s=n.toolCallId,u=n.args;g++;let d=(x=c,b=e,v=u,"text_delta"===x?{stage:"analyzing"}:"tool_start"===x&&b?a.has(b)?{stage:"writing",detail:l(b,v)||void 0}:o.has(b)?{stage:"reading",detail:v&&"object"==typeof v&&"path"in v&&"string"==typeof v.path?v.path:void 0}:{stage:"analyzing"}:null);if(d&&t({stageHint:d}),a.has(e)){let n=l(e,u),a="update";"create_file"===e||"batch_create_files"===e?a="create":("delete_file"===e||"rename_file"===e||"move_file"===e)&&(a="unknown"),"update"===a&&n&&!h.has(n)&&(h.add(n),i(n).then(e=>{e&&r(n,e)})),p.set(s,{name:e,path:n,action:a}),t({currentTool:{name:e,path:n}})}break}case"tool_end":{let e=n.toolCallId,r=!!n.isError,s=p.get(e);if(s){if("batch_create_files"===s.name)for(let t of s.path.split(", ").filter(Boolean))m.push({action:s.action,path:t,toolCallId:e,ok:!r});else m.push({action:s.action,path:s.path,toolCallId:e,ok:!r});p.delete(e),t({changes:[...m],currentTool:null})}break}case"text_delta":f+=n.delta??"",t({stageHint:{stage:"analyzing"},summary:s(f)});break;case"error":throw Error(n.message||"AI organize failed")}}}}finally{u.releaseLock()}return{changes:m,summary:s(f),toolCallCount:g}}function d(){let[e,t]=(0,n.useState)("idle"),[r,s]=(0,n.useState)([]),[a,o]=(0,n.useState)(null),[l,i]=(0,n.useState)(null),[d,c]=(0,n.useState)(""),[m,p]=(0,n.useState)(null),[f,g]=(0,n.useState)(0),h=(0,n.useRef)(null),x=(0,n.useRef)(0),b=(0,n.useRef)(new Map),[v,y]=(0,n.useState)([]),[k,w]=(0,n.useState)("upload"),j=(0,n.useRef)(0),[N,A]=(0,n.useState)(0),C=(0,n.useCallback)(async(e,r,n="upload")=>{t("organizing"),s([]),o(null),i({stage:"connecting"}),c(""),p(null),g(0),y(e.map(e=>e.name)),w(n),j.current=Date.now(),A(0),b.current=new Map,x.current=Date.now();let a=new AbortController;h.current=a;let l=e.map(e=>({name:e.name,content:e.content.length>2e4?e.content.slice(0,2e4)+"\n\n[...truncated to first ~20000 chars]":e.content}));try{let e=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:r}],uploadedFiles:l,maxSteps:15,mode:"organize"}),signal:a.signal});if(!e.ok){let t=`Request failed (${e.status})`;try{let r=await e.json();"string"==typeof r?.error?t=r.error:"object"==typeof r?.error&&r.error?.message?t=r.error.message:r?.message&&(t=r.message)}catch{}throw Error(t)}if(!e.body)throw Error("No response body");let n=await u(e.body,e=>{x.current=Date.now(),e.changes&&s(e.changes),void 0!==e.currentTool&&o(e.currentTool),e.stageHint&&i(e.stageHint),void 0!==e.summary&&c(e.summary)},(e,t)=>{b.current.set(e,t)},a.signal);s(n.changes),c(n.summary),g(n.toolCallCount),o(null),A(Date.now()-j.current),t("done")}catch(e){"AbortError"===e.name?t("idle"):(p(e.message),t("error"))}finally{h.current=null}},[]),S=(0,n.useCallback)(()=>{h.current?.abort()},[]),E=(0,n.useCallback)(async e=>{let t=r.find(t=>t.path===e&&t.ok&&!t.undone);if(!t)return!1;try{if("create"===t.action){if(!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:t.path})})).ok)return!1}else{if("update"!==t.action)return!1;let r=b.current.get(e);if(!r||!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:t.path,content:r})})).ok)return!1}return s(t=>t.map(t=>t.path===e&&t.ok&&!t.undone?{...t,undone:!0}:t)),!0}catch{return!1}},[r]),_=(0,n.useCallback)(async()=>{let e=r.filter(e=>e.ok&&!e.undone&&("create"===e.action||"update"===e.action&&b.current.has(e.path))),t=0;for(let r of e)try{if("create"===r.action)(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:r.path})})).ok&&t++;else if("update"===r.action){let e=b.current.get(r.path);e&&(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:r.path,content:e})})).ok&&t++}}catch{}return t>0&&s(e=>e.map(e=>!e.ok||e.undone?e:"create"===e.action||"update"===e.action&&b.current.has(e.path)?{...e,undone:!0}:e)),t},[r]),M=(0,n.useCallback)(e=>{let t=r.find(t=>t.path===e&&t.ok&&!t.undone);return!!t&&("create"===t.action||"update"===t.action&&b.current.has(e))},[r]),R=r.some(e=>e.ok&&!e.undone&&("create"===e.action||"update"===e.action&&b.current.has(e.path))),z=(0,n.useCallback)(()=>{t("idle"),s([]),o(null),i(null),c(""),p(null),g(0),y([]),w("upload"),A(0),j.current=0,b.current=new Map,x.current=0},[]);return{phase:e,changes:r,currentTool:a,stageHint:l,summary:d,error:m,toolCallCount:f,sourceFileNames:v,source:k,durationMs:N,snapshots:b,start:C,abort:S,undoOne:E,undoAll:_,canUndo:M,hasAnyUndoable:R,reset:z}}},51541:(e,t,r)=>{"use strict";r.d(t,{A:()=>eX});var n=r(95155),s=r(12115),a=r(51914),o=r(48368),l=r(17243),i=r(33210),u=r(46757),d=r(56204),c=r(35581),m=r(47650),p=r(96035),f=r(86901),g=r(94514),h=r(66088);let x="mindos-ask-mode",b=["agent","chat"];function v({mode:e,onChange:t,disabled:r}){let{t:a}=(0,c.Y)(),[o,l]=(0,s.useState)(!1),[i,u]=(0,s.useState)(null),d=(0,s.useRef)(null),v=(0,s.useRef)(null),y=(0,s.useCallback)(()=>{if(!d.current)return;let e=d.current.getBoundingClientRect(),t=e.top,r=t>window.innerHeight-e.bottom&&t>120?"up":"down";u({left:e.left,top:"up"===r?e.top-6:e.bottom+6,direction:r})},[]);(0,s.useEffect)(()=>{o&&y()},[o,y]),(0,s.useEffect)(()=>{if(!o)return;let e=e=>{let t=e.target;d.current&&!d.current.contains(t)&&v.current&&!v.current.contains(t)&&l(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[o]),(0,s.useEffect)(()=>{if(!o)return;let e=e=>{"Escape"===e.key&&l(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[o]),(0,s.useEffect)(()=>{if(o)return window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),()=>{window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y)}},[o,y]);let k=(0,s.useCallback)(e=>{t(e);try{localStorage.setItem(x,e)}catch{}l(!1)},[t]),w="chat"===e,j=(e,t)=>"chat"===e?(0,n.jsx)(p.A,{size:t,className:"shrink-0"}):(0,n.jsx)(f.A,{size:t,className:"shrink-0"}),N=e=>"chat"===e?a.ask.modeChat:a.ask.modeAgent,A=e=>"chat"===e?a.ask.modeChatHint:a.ask.modeAgentHint,C=o&&i?(0,n.jsx)("div",{ref:v,role:"listbox","aria-label":"Select mode",className:"fixed z-50 min-w-[200px] max-w-[260px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:i.left,..."up"===i.direction?{bottom:window.innerHeight-i.top}:{top:i.top}},children:b.map(t=>{let r=e===t;return(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":r,onClick:()=>k(t),className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs text-left transition-colors hover:bg-muted",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:j(t,13)}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"font-medium",children:N(t)}),(0,n.jsx)("div",{className:"text-2xs text-muted-foreground mt-0.5",children:A(t)})]}),r&&(0,n.jsx)(g.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]},t)})}):null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:d,type:"button",onClick:()=>{r||l(e=>!e)},disabled:r,className:`
|
|
2
|
+
inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
|
|
3
|
+
text-2xs font-medium transition-colors select-none
|
|
4
|
+
border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
|
|
5
|
+
disabled:opacity-40 disabled:cursor-not-allowed
|
|
6
|
+
${w?"bg-muted/50 border-border/50 text-muted-foreground hover:bg-muted hover:text-foreground":"bg-[var(--amber)]/10 border-[var(--amber)]/25 text-foreground hover:bg-[var(--amber)]/15"}
|
|
7
|
+
`,title:A(e),"aria-expanded":o,"aria-haspopup":"listbox",children:[j(e,11),(0,n.jsx)("span",{className:"truncate max-w-[80px]",children:N(e)}),(0,n.jsx)(h.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&C&&(0,m.createPortal)(C,document.body)]})}function y(e){let t=Date.now();return{id:`${t}-${Math.random().toString(36).slice(2,8)}`,currentFile:e,createdAt:t,updatedAt:t,messages:[]}}function k(e){if(e.title)return e.title;let t=e.messages.find(e=>"user"===e.role);if(!t)return"(empty session)";let r=t.content.replace(/\s+/g," ").trim();return!r&&t.images&&t.images.length>0?`[${t.images.length} image${t.images.length>1?"s":""}]`:r.length>42?`${r.slice(0,42)}...`:r||"(empty session)"}async function w(){try{let e=await fetch("/api/ask-sessions",{cache:"no-store"});if(!e.ok)return[];let t=await e.json();if(!Array.isArray(t))return[];return t.slice(0,30)}catch{return[]}}async function j(e){try{let t={...e,messages:e.messages.map(e=>e.images&&0!==e.images.length?{...e,images:e.images.map(e=>({...e,data:""}))}:e)};await fetch("/api/ask-sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:t})})}catch{}}async function N(e){try{await fetch("/api/ask-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})})}catch{}}async function A(e){try{await fetch("/api/ask-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:e})})}catch{}}let C=new Set([".txt",".md",".markdown",".csv",".json",".yaml",".yml",".xml",".html",".htm",".pdf"]);function S(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}async function E(e){let t=e.name;try{let r=await e.arrayBuffer(),n=function(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}(new Uint8Array(r)),s=await fetch("/api/extract-pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,dataBase64:n})}),a={};try{a=await s.json()}catch{throw Error("Failed to parse extraction response")}if(!s.ok)throw Error(a.error||`PDF extraction failed (${s.status})`);let o=a.extracted&&a.text||"";if(!o)return{name:t,content:`[PDF: ${t}] Could not extract readable text (possibly scanned/image PDF).`,status:"error",error:"Scanned or image-only PDF — no extractable text"};let l={name:t,content:`[PDF TEXT EXTRACTED: ${t}]
|
|
8
|
+
|
|
9
|
+
${o}`,status:"success"};return a.truncated&&a.totalChars&&(l.truncatedInfo={totalChars:a.totalChars,includedChars:o.length,totalPages:a.pagesParsed??0}),l}catch(e){return{name:t,content:`[PDF: ${t}] Failed to extract text from this PDF.`,status:"error",error:e instanceof Error?e.message:"Unknown error"}}}let _=new Set(["image/png","image/jpeg","image/gif","image/webp"]);async function M(e){let t=e.type;if(e.size<=5242880){let r=new Uint8Array(await e.arrayBuffer()),n="";for(let e=0;e<r.length;e+=32768)n+=String.fromCharCode(...r.subarray(e,e+32768));return{data:btoa(n),mimeType:t}}return new Promise((t,r)=>{let n=new Image;n.onload=()=>{let{width:e,height:s}=n;if(e>1920||s>1920){let t=Math.min(1920/e,1920/s);e=Math.round(e*t),s=Math.round(s*t)}let a=document.createElement("canvas");a.width=e,a.height=s;let o=a.getContext("2d");o?(o.drawImage(n,0,0,e,s),t({data:a.toDataURL("image/jpeg",.85).split(",")[1],mimeType:"image/jpeg"}),URL.revokeObjectURL(n.src)):r(Error("Canvas not supported"))},n.onerror=()=>{r(Error("Failed to load image")),URL.revokeObjectURL(n.src)},n.src=URL.createObjectURL(e)})}function R(e){let t=[];for(let r of Array.from(e))if("file"===r.kind&&_.has(r.type)){let e=r.getAsFile();e&&t.push(e)}return t}var z=r(67635),L=r(53961),T=r(6296),I=r(32967),P=r(59511),D=r(61878),$=r(37618),O=r(31885),U=r(13545),F=r(84755),B=r(56842),H=r(66804),K=r(32957),Z=r(48391),Y=r(7834),W=r(42129),q=r(97810),Q=r(49387),G=r(93631),J=r(45049),X=r(68459),V=r(48334),ee=r(97233),et=r(50538),er=r(84980),en=r(33078),es=r(21362),ea=r(41585),eo=r(12651),el=r(62791);let ei=new Set(["delete_file","move_file","rename_file","write_file"]),eu=new Set(["write_file","create_file","update_section","insert_after_heading","edit_lines","append_to_file"]),ed={search:D.A,list_files:W.A,read_file:q.A,write_file:Q.A,create_file:G.A,append_to_file:o.A,insert_after_heading:J.A,update_section:Q.A,delete_file:X.A,rename_file:o.A,move_file:V.A,get_backlinks:ee.A,get_history:et.A,get_file_at_version:et.A,get_recent:er.A,append_csv:en.A},ec="--- changes ---";function em({part:e}){let t=eu.has(e.toolName),r="done"===e.state,[a,o]=(0,s.useState)(null),l=a??(t&&r),i=ed[e.toolName]??I.A,u=ei.has(e.toolName),d=(0,s.useMemo)(()=>(function(e){if(!e)return{header:"",stats:"",diffLines:[]};let t=e.indexOf(ec);if(-1===t)return{header:e,stats:"",diffLines:[]};let r=e.slice(0,t).trim(),n=e.slice(t+ec.length).trim(),s=r.match(/\((\+\d+\s*−\d+)\)/);return{header:r,stats:s?s[1]:"",diffLines:n.split("\n").map(e=>e.startsWith("+ ")?{prefix:"+",text:e.slice(2)}:e.startsWith("- ")?{prefix:"-",text:e.slice(2)}:e.startsWith(" ")?{prefix:" ",text:e.slice(2)}:{prefix:" ",text:e})}})(e.output),[e.output]),c=(0,s.useMemo)(()=>e.input&&"object"==typeof e.input?e.input.path??"":"",[e.input]),m=c?`${c.split("/").pop()??c}${d.stats?` (${d.stats})`:""}`:function(e){if(!e||"object"!=typeof e)return String(e??"");let t=[];for(let r of Object.values(e))"string"==typeof r?t.push(r.length>60?`${r.slice(0,60)}…`:r):Array.isArray(r)?t.push(`[${r.length} items]`):null!=r&&t.push(String(r));return t.join(", ")}(e.input);return(0,n.jsxs)("div",{className:`my-1.5 rounded-lg border text-xs font-mono ${u?"border-[var(--amber)]/30 bg-background/60":"border-border/40 bg-background/50"}`,children:[(0,n.jsxs)("button",{type:"button",onClick:()=>o(e=>null===e?!l:!e),"aria-expanded":l,className:"w-full flex items-center gap-1.5 px-2.5 py-2 text-left hover:bg-muted/30 transition-colors rounded-lg",children:[l?(0,n.jsx)(h.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,n.jsx)(es.A,{size:12,className:"shrink-0 text-muted-foreground"}),u&&(0,n.jsx)(ea.A,{size:11,className:"shrink-0 text-[var(--amber)]"}),(0,n.jsx)(i,{size:12,className:`shrink-0 ${u?"text-[var(--amber)]":"text-muted-foreground"}`}),(0,n.jsx)("span",{className:`font-medium ${u?"text-[var(--amber)]":"text-foreground"}`,children:e.toolName}),(0,n.jsx)("span",{className:"text-muted-foreground truncate flex-1",children:m}),(0,n.jsx)("span",{className:"shrink-0 ml-auto",children:"pending"===e.state||"running"===e.state?(0,n.jsx)(T.A,{size:12,className:"animate-spin text-[var(--amber)]"}):"done"===e.state?(0,n.jsx)(eo.A,{size:12,className:"text-success"}):(0,n.jsx)(el.A,{size:12,className:"text-error"})})]}),l&&(0,n.jsx)("div",{className:"border-t border-border/30",children:t&&r&&d.diffLines.length>0?(0,n.jsx)("div",{className:"max-h-64 overflow-y-auto",children:d.diffLines.map((e,t)=>(0,n.jsxs)("div",{className:`px-2 py-px flex items-start gap-1.5 ${"+"===e.prefix?"bg-success/8":"-"===e.prefix?"bg-error/8":""}`,children:[(0,n.jsx)("span",{className:`select-none w-3 shrink-0 text-right ${"+"===e.prefix?"text-success":"-"===e.prefix?"text-error":"text-muted-foreground/50"}`,children:e.prefix}),(0,n.jsx)("span",{className:`whitespace-pre-wrap break-all flex-1 ${"+"===e.prefix?"text-success":"-"===e.prefix?"text-error":"text-muted-foreground"}`,children:e.text||"\xa0"})]},t))}):(0,n.jsxs)("div",{className:"px-2.5 pb-2.5 pt-1.5 space-y-1.5",children:["running"===e.state&&(0,n.jsxs)("div",{className:"text-muted-foreground/60 text-2xs flex items-center gap-1.5",children:[(0,n.jsx)(T.A,{size:10,className:"animate-spin"})," Running..."]}),(0,n.jsxs)("div",{className:"text-muted-foreground leading-relaxed",children:[(0,n.jsx)("span",{className:"font-semibold text-foreground/70",children:"Input: "}),(0,n.jsx)("span",{className:"break-all whitespace-pre-wrap",children:JSON.stringify(e.input,null,2)})]}),void 0!==e.output&&""!==e.output&&(0,n.jsxs)("div",{className:"text-muted-foreground leading-relaxed",children:[(0,n.jsx)("span",{className:"font-semibold text-foreground/70",children:"Output: "}),(0,n.jsx)("span",{className:"break-all whitespace-pre-wrap",children:e.output.length>500?e.output.slice(0,500)+"…":e.output})]})]})})]})}var ep=r(90718);function ef({text:e,isStreaming:t}){let[r,a]=(0,s.useState)(!1),{t:o}=(0,c.Y)();return e||t?(0,n.jsxs)("div",{className:"my-1.5 rounded-lg border border-border/30 bg-muted/15 text-xs",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),"aria-expanded":r,className:"w-full flex items-center gap-1.5 px-2.5 py-2 text-left hover:bg-muted/30 transition-colors rounded-lg",children:[r?(0,n.jsx)(h.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,n.jsx)(es.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,n.jsx)(ep.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,n.jsxs)("span",{className:"text-muted-foreground font-medium",children:[o.ask.thinkingLabel,t&&!r&&(0,n.jsx)("span",{className:"ml-1 animate-pulse",children:"..."})]}),!r&&e&&(0,n.jsxs)("span",{className:"text-muted-foreground/50 truncate flex-1 ml-1",children:[e.slice(0,80),e.length>80?"...":""]})]}),r&&(0,n.jsx)("div",{className:"px-2.5 pb-2.5 pt-1 border-t border-border/20",children:(0,n.jsxs)("div",{className:"text-muted-foreground whitespace-pre-wrap leading-relaxed",children:[e,t&&(0,n.jsx)("span",{className:"inline-block w-1 h-3 bg-muted-foreground/40 ml-0.5 align-middle animate-pulse rounded-full"})]})})]}):null}let eg=/^Use the skill ([^:]+):\s*/;function eh({text:e,label:t}){let[r,a]=(0,s.useState)(!1),o=(0,s.useCallback)(()=>{(0,Y.l)(e).then(e=>{e&&(a(!0),setTimeout(()=>a(!1),2e3))})},[e]);return(0,n.jsx)("button",{type:"button",onClick:o,className:"absolute -bottom-1 right-1 p-1 rounded-md bg-card border border-border/60 shadow-sm text-muted-foreground hover:text-foreground opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity",title:t??"Copy",children:r?(0,n.jsx)(g.A,{size:11,className:"text-success"}):(0,n.jsx)(z.A,{size:11})})}function ex({content:e,skillName:t,images:r}){let s=t??e.match(eg)?.[1],a=e.match(eg),o=a?e.slice(a[0].length):e;return(0,n.jsxs)(n.Fragment,{children:[r&&r.length>0&&(0,n.jsx)("div",{className:`flex flex-wrap gap-1.5${e?" mb-2":""}`,children:r.map((e,t)=>e.data?(0,n.jsx)("img",{src:`data:${e.mimeType};base64,${e.data}`,alt:`Image ${t+1}`,className:"max-h-48 max-w-full rounded-md object-contain"},t):(0,n.jsx)("div",{className:"h-12 px-3 rounded-md bg-muted flex items-center gap-1.5 text-xs text-muted-foreground",children:(0,n.jsxs)("span",{children:["[Image ",t+1,"]"]})},t))}),s&&(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[11px] font-medium bg-white/20 text-white/90 mr-1 align-middle",children:[(0,n.jsx)(L.A,{size:10,className:"shrink-0"}),s]}),s?o:e]})}function eb({content:e,isStreaming:t}){let r=(0,Z.Oo)(e);return r||t?(0,n.jsxs)("div",{className:"prose prose-sm prose-panel dark:prose-invert max-w-none text-foreground prose-p:my-2 prose-p:leading-relaxed prose-headings:font-semibold prose-headings:my-3 prose-h1:text-base prose-h2:text-[15px] prose-h3:text-sm prose-ul:my-1.5 prose-li:my-0.5 prose-ol:my-1.5 prose-code:text-[0.8em] prose-code:bg-muted/80 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:before:content-none prose-code:after:content-none prose-code:font-mono prose-pre:bg-muted/60 prose-pre:text-foreground prose-pre:text-xs prose-pre:rounded-lg prose-blockquote:border-l-[var(--amber)] prose-blockquote:text-muted-foreground prose-blockquote:not-italic prose-a:text-[var(--amber)] prose-a:no-underline hover:prose-a:underline prose-strong:text-foreground prose-strong:font-semibold prose-table:text-xs prose-th:py-1.5 prose-td:py-1 ",children:[(0,n.jsx)(H.oz,{remarkPlugins:[K.A],children:r}),t&&(0,n.jsx)("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--amber)] ml-0.5 align-middle animate-pulse rounded-full"})]}):null}function ev({message:e,isStreaming:t}){let r=e.parts;if(!r||0===r.length)return e.content?(0,n.jsx)(eb,{content:e.content,isStreaming:t}):null;let s=r[r.length-1],a=t&&"tool-call"===s.type&&("running"===s.state||"pending"===s.state);return(0,n.jsxs)("div",{children:[r.map((e,s)=>{if("reasoning"===e.type){let a=t&&s===r.length-1;return(0,n.jsx)(ef,{text:e.text,isStreaming:a},`reasoning-${s}`)}if("text"===e.type){let a=t&&s===r.length-1;return e.text?(0,n.jsx)(eb,{content:e.text,isStreaming:a},s):null}return"tool-call"===e.type?(0,n.jsx)(em,{part:e},e.toolCallId):null}),a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 py-1.5 mt-1.5",children:[(0,n.jsx)(T.A,{size:12,className:"animate-spin text-[var(--amber)]"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"Executing tool…"})]})]})}function ey({parts:e}){if(!e)return null;let t=e.filter(e=>"tool-call"===e.type);if(0===t.length)return null;let r=t[t.length-1],s="tool-call"===r.type?r.toolName:"";return(0,n.jsxs)("div",{className:"flex items-center gap-1.5 mt-2 pt-1.5 border-t border-border/15 text-xs text-muted-foreground/60",children:[(0,n.jsx)(I.A,{size:10}),(0,n.jsxs)("span",{className:"font-medium",children:["Step ",t.length,s?` — ${s}`:""]})]})}let ek=(0,s.memo)(function({messages:e,isLoading:t,loadingPhase:r,emptyPrompt:a,emptyHint:o,suggestions:l,onSuggestionClick:i,labels:u}){let d=(0,s.useRef)(null),c=(0,s.useRef)(null),[m,p]=(0,s.useState)(!1),g=(0,s.useCallback)(()=>{let e=c.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[]);return(0,s.useEffect)(()=>{g()},[e,g]),(0,s.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let{scrollTop:t,scrollHeight:r,clientHeight:n}=e;p(r-t-n>100)};return e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[]),(0,n.jsxs)("div",{ref:c,role:"log","aria-live":"polite",className:"relative flex-1 overflow-y-auto overflow-x-hidden px-4 py-5 space-y-5 min-h-0",children:[0===e.length&&(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1 min-h-[260px] px-6 pt-10 pb-4",children:[(0,n.jsxs)("div",{className:"relative w-12 h-12 rounded-2xl bg-[var(--amber)]/10 flex items-center justify-center mb-6",children:[(0,n.jsx)("div",{className:"absolute inset-0 rounded-2xl bg-[var(--amber)]/5 scale-[1.4]"}),(0,n.jsx)(f.A,{size:22,className:"text-[var(--amber)] relative z-10"})]}),(0,n.jsx)("p",{className:"text-center text-[15px] font-semibold text-foreground tracking-tight mb-2",children:a}),o&&(0,n.jsx)("p",{className:"text-center text-xs text-muted-foreground/80 mb-10 tracking-wide",children:o}),(0,n.jsx)("div",{className:"flex flex-col gap-2.5 max-w-[280px] w-full",children:l.map((e,t)=>{let r=[P.A,D.A,$.A,O.A],s=r[t%r.length];return(0,n.jsxs)("button",{type:"button",onClick:()=>i(e.prompt),className:"group/sug flex items-center gap-3 text-left text-[13px] px-3.5 py-3 rounded-xl border border-border/40 bg-transparent text-muted-foreground hover:text-foreground hover:border-[var(--amber)]/30 hover:bg-[var(--amber)]/5 transition-all leading-snug","aria-label":e.prompt,children:[(0,n.jsx)("span",{className:"shrink-0 w-8 h-8 rounded-lg bg-muted/60 flex items-center justify-center group-hover/sug:bg-[var(--amber)]/10 transition-colors",children:(0,n.jsx)(s,{size:15,className:"text-muted-foreground/70 group-hover/sug:text-[var(--amber)] transition-colors"})}),(0,n.jsx)("span",{className:"flex-1",children:e.label})]},t)})})]}),e.map((s,a)=>(0,n.jsxs)("div",{className:`flex gap-3 animate-[fadeSlideUp_0.22s_ease_both] ${"user"===s.role?"justify-end":"justify-start"}`,children:["assistant"===s.role&&(0,n.jsx)("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 mt-0.5 bg-[var(--amber)]/8",children:(0,n.jsx)(f.A,{size:13,className:"text-[var(--amber)]"})}),"user"===s.role?(0,n.jsx)("div",{className:"max-w-[85%] px-3.5 py-2.5 rounded-2xl rounded-br-lg text-sm leading-relaxed whitespace-pre-wrap bg-[var(--amber)] text-[var(--amber-foreground)] shadow-sm shadow-[var(--amber)]/10",children:(0,n.jsx)(ex,{content:s.content,skillName:s.skillName,images:s.images})}):s.content.startsWith("__error__")?(0,n.jsx)("div",{className:"max-w-[85%] px-3.5 py-3 rounded-2xl rounded-bl-md border border-error/30 bg-error/10 text-sm shadow-sm",children:(0,n.jsxs)("div",{className:"flex items-start gap-2.5 text-error",children:[(0,n.jsx)(U.A,{size:15,className:"shrink-0 mt-0.5"}),(0,n.jsx)("span",{className:"leading-relaxed font-medium",children:s.content.slice(9)})]})}):(0,n.jsx)("div",{className:"group relative max-w-[85%] px-3.5 py-2.5 rounded-2xl rounded-bl-lg bg-card border border-border/30 shadow-sm text-foreground text-sm",children:s.parts&&s.parts.length>0||(0,Z.Oo)(s.content)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ev,{message:s,isStreaming:t&&a===e.length-1}),t&&a===e.length-1&&(0,n.jsx)(ey,{parts:s.parts}),!(t&&a===e.length-1)&&(0,Z.Oo)(s.content)&&(0,n.jsx)(eh,{text:(0,Z.Oo)(s.content),label:u.copyMessage})]}):t&&a===e.length-1?(0,n.jsxs)("div",{className:"flex items-center gap-2.5 py-1",children:["reconnecting"===r?(0,n.jsx)(F.A,{size:14,className:"text-[var(--amber)] animate-pulse"}):(0,n.jsx)(T.A,{size:14,className:"animate-spin text-[var(--amber)]"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:["reconnecting"===r?u.reconnecting??"Reconnecting...":"connecting"===r?u.connecting:"thinking"===r?u.thinking:u.generating,(0,n.jsxs)("span",{className:"inline-flex gap-0.5",children:[(0,n.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:0ms]"}),(0,n.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:150ms]"}),(0,n.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:300ms]"})]})]})})]}):null})]},a)),(0,n.jsx)("div",{ref:d}),m&&e.length>0&&(0,n.jsx)("button",{type:"button",onClick:g,className:"sticky bottom-2 left-1/2 -translate-x-1/2 z-10 p-2 rounded-full border border-border/60 bg-card shadow-md text-muted-foreground hover:text-foreground hover:bg-muted transition-all hover:shadow-lg",title:"Scroll to bottom",children:(0,n.jsx)(B.A,{size:14})})]})});function ew({text:e,query:t}){if(!t)return(0,n.jsx)(n.Fragment,{children:e});let r=e.toLowerCase().indexOf(t.toLowerCase());return -1===r?(0,n.jsx)(n.Fragment,{children:e}):(0,n.jsxs)(n.Fragment,{children:[e.slice(0,r),(0,n.jsx)("span",{className:"text-[var(--amber)] font-semibold",children:e.slice(r,r+t.length)}),e.slice(r+t.length)]})}function ej({results:e,selectedIndex:t,query:r,onSelect:a}){let l=(0,s.useRef)(null),i=(0,s.useRef)(null),[u,d]=(0,s.useState)(280);return((0,s.useEffect)(()=>{let e=i.current;e&&d(Math.max(120,Math.min(320,Math.min(e.getBoundingClientRect().top-8,.5*window.innerHeight)-80)))},[e.length]),(0,s.useEffect)(()=>{let e=l.current;if(!e)return;let r=e.children[t];r?.scrollIntoView({block:"nearest"})},[t]),0===e.length)?null:(0,n.jsxs)("div",{ref:i,className:"border border-border rounded-lg bg-card shadow-lg overflow-hidden",children:[(0,n.jsxs)("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-1.5",children:[(0,n.jsx)(W.A,{size:11,className:"text-muted-foreground/50"}),(0,n.jsx)("span",{className:"text-2xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Files"}),(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/40 ml-auto",children:e.length})]}),(0,n.jsx)("div",{ref:l,className:"overflow-y-auto",style:{maxHeight:u},children:e.map((e,s)=>{let l=e.split("/").pop()??e,i=e.split("/").slice(0,-1).join("/"),u=l.endsWith(".csv");return(0,n.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),a(e)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors ${s===t?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:[u?(0,n.jsx)(en.A,{size:13,className:"text-success shrink-0"}):(0,n.jsx)(o.A,{size:13,className:"text-muted-foreground shrink-0"}),(0,n.jsx)("span",{className:"truncate font-medium flex-1",title:l,children:(0,n.jsx)(ew,{text:l,query:r})}),i&&(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/40 truncate max-w-[140px] shrink-0",title:i,children:(0,n.jsx)(ew,{text:i,query:r})})]},e)})}),(0,n.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex gap-3 text-2xs text-muted-foreground/40 shrink-0",children:[(0,n.jsx)("span",{children:"↑↓ navigate"}),(0,n.jsx)("span",{children:"↵ select"}),(0,n.jsx)("span",{children:"ESC dismiss"})]})]})}function eN({results:e,selectedIndex:t,query:r,onSelect:a}){let o=(0,s.useRef)(null),l=(0,s.useRef)(null),[i,u]=(0,s.useState)(280);return((0,s.useEffect)(()=>{let e=l.current;e&&u(Math.max(120,Math.min(320,Math.min(e.getBoundingClientRect().top-8,.5*window.innerHeight)-80)))},[e.length]),(0,s.useEffect)(()=>{let e=o.current;if(!e)return;let r=e.children[t];r?.scrollIntoView({block:"nearest"})},[t]),0===e.length)?null:(0,n.jsxs)("div",{ref:l,className:"border border-border rounded-lg bg-card shadow-lg overflow-hidden",children:[(0,n.jsxs)("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-1.5",children:[(0,n.jsx)(L.A,{size:11,className:"text-[var(--amber)]/50"}),(0,n.jsx)("span",{className:"text-2xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Skills"}),(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/40 ml-auto",children:e.length})]}),(0,n.jsx)("div",{ref:o,className:"overflow-y-auto",style:{maxHeight:i},children:e.map((e,s)=>(0,n.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),a(e)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors ${s===t?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:[(0,n.jsx)(L.A,{size:13,className:"text-[var(--amber)] shrink-0"}),(0,n.jsxs)("span",{className:"text-sm font-medium shrink-0",children:["/",(0,n.jsx)(ew,{text:e.name,query:r})]}),e.description&&(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/50 truncate min-w-0 flex-1",title:e.description,children:e.description})]},e.name))}),(0,n.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex gap-3 text-2xs text-muted-foreground/40 shrink-0",children:[(0,n.jsx)("span",{children:"↑↓ navigate"}),(0,n.jsx)("span",{children:"↵ / Tab select"}),(0,n.jsx)("span",{children:"ESC dismiss"})]})]})}var eA=r(36261);function eC({sessions:e,activeSessionId:t,onLoad:r,onDelete:a,onRename:o,onTogglePin:l,onClearAll:i,labels:u}){let[d,c]=(0,s.useState)(!1),m=(0,s.useRef)(void 0),[p,f]=(0,s.useState)(null),[g,h]=(0,s.useState)(""),x=(0,s.useRef)(null);(0,s.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]),(0,s.useEffect)(()=>{p&&x.current&&(x.current.focus(),x.current.select())},[p]);let b=(0,s.useCallback)(e=>{f(e.id),h(k(e))},[]),v=(0,s.useCallback)(()=>{p&&(o(p,g),f(null))},[p,g,o]),y=(0,s.useCallback)(()=>{f(null)},[]);return(0,n.jsxs)("div",{className:"border-b border-border/40 px-4 py-3 max-h-[220px] overflow-y-auto",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-2.5",children:[(0,n.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:u.title}),e.length>1&&(0,n.jsx)("button",{type:"button",onClick:()=>{if(!d){c(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>c(!1),3e3);return}m.current&&clearTimeout(m.current),i(),c(!1)},className:`text-2xs px-2 py-0.5 rounded-md transition-colors ${d?"bg-error/10 text-error font-medium":"text-muted-foreground/60 hover:text-error hover:bg-muted"}`,children:d?u.confirmClear:u.clearAll})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[0===e.length&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground/50 py-2 text-center",children:u.noSessions}),e.map(e=>{let s=t===e.id;return(0,n.jsxs)("div",{className:"group flex items-center gap-0.5",children:[e.pinned&&(0,n.jsx)(J.A,{size:10,className:"shrink-0 text-[var(--amber)]/50 -rotate-45 ml-1"}),(0,n.jsxs)("button",{type:"button",onClick:()=>r(e.id),onDoubleClick:()=>b(e),className:`flex-1 text-left px-2.5 py-2 rounded-lg text-xs transition-colors min-w-0 ${s?"bg-[var(--amber)]/8 text-foreground border border-[var(--amber)]/15":"text-muted-foreground hover:bg-muted hover:text-foreground border border-transparent"}`,children:[p===e.id?(0,n.jsx)("input",{ref:x,type:"text",value:g,onChange:e=>h(e.target.value),onBlur:v,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),v()),"Escape"===e.key&&(e.preventDefault(),y())},onClick:e=>e.stopPropagation(),className:"w-full bg-transparent border-b border-[var(--amber)] outline-none text-xs text-foreground"}):(0,n.jsx)("div",{className:"truncate font-medium",children:k(e)}),p!==e.id&&(0,n.jsx)("div",{className:"text-2xs text-muted-foreground/50 mt-0.5",children:function(e){let t=Math.floor((Date.now()-e.getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let r=Math.floor(t/60);if(r<24)return`${r}h ago`;let n=Math.floor(r/24);return n<7?`${n}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(new Date(e.updatedAt))})]}),(0,n.jsx)("button",{type:"button",onClick:()=>l(e.id),className:`p-1.5 rounded-lg transition-opacity opacity-0 group-hover:opacity-100 ${e.pinned?"text-[var(--amber)] hover:text-muted-foreground":"text-muted-foreground hover:text-[var(--amber)]"}`,title:e.pinned?"Unpin":"Pin",children:e.pinned?(0,n.jsx)(eA.A,{size:11}):(0,n.jsx)(J.A,{size:11})}),(0,n.jsx)("button",{type:"button",onClick:()=>b(e),className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:u.rename,children:(0,n.jsx)(Q.A,{size:11})}),(0,n.jsx)("button",{type:"button",onClick:()=>a(e.id),className:"p-1.5 rounded-lg text-muted-foreground hover:text-error hover:bg-error/5 opacity-0 group-hover:opacity-100 transition-opacity",title:"Delete session",children:(0,n.jsx)(X.A,{size:11})})]},e.id)})]})]})}var eS=r(89823),eE=r(60241),e_=r(24371),eM=r(52335),eR=r(94852);let ez=(0,s.memo)(function({isPanel:e,showHistory:t,onToggleHistory:r,onReset:a,isLoading:o,maximized:l,onMaximize:u,askMode:d,onModeSwitch:p,onClose:x,hideTitle:b,sessions:v,activeSessionId:y,onLoadSession:w,onDeleteSession:j,onRenameSession:N,onTogglePinSession:A}){let{t:C}=(0,c.Y)(),S=v&&v.length>=1,E=v?.find(e=>e.id===y),_=E?k(E):null,[M,R]=(0,s.useState)(!1),z=(0,s.useRef)(null),L=(0,s.useRef)(null),[T,I]=(0,s.useState)(null),[P,D]=(0,s.useState)(""),$=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!M)return;let e=e=>{let t=e.target;z.current&&!z.current.contains(t)&&L.current&&!L.current.contains(t)&&(R(!1),I(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[M]),(0,s.useEffect)(()=>{if(!M)return;let e=e=>{"Escape"===e.key&&(T?I(null):R(!1))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[M,T]),(0,s.useEffect)(()=>{T&&setTimeout(()=>$.current?.focus(),0)},[T]);let O=(0,s.useCallback)(e=>{w?.(e),R(!1)},[w]),U=(0,s.useCallback)((e,t)=>{I(e),D("(empty session)"===t?"":t)},[]),F=(0,s.useCallback)(()=>{T&&N&&P.trim()&&N(T,P.trim()),I(null)},[T,P,N]),[B,H]=(0,s.useState)(null);(0,s.useEffect)(()=>{if(!M||!z.current)return;let e=z.current.getBoundingClientRect();H({top:e.bottom+4,left:e.left,width:Math.max(e.width,240)})},[M]);let K=M&&B&&v?(0,m.createPortal)((0,n.jsx)("div",{ref:L,className:"fixed z-50 rounded-xl border border-border/50 bg-card shadow-lg py-1 animate-in fade-in-0 slide-in-from-top-1 duration-100",style:{top:B.top,left:B.left,minWidth:B.width,maxWidth:320},role:"listbox",children:v.map(e=>{let t=e.id===y,r=k(e),s="(empty session)"===r?C.hints?.newChat??"New chat":r;return T===e.id?(0,n.jsx)("div",{className:"flex items-center gap-1 px-2 py-1.5",children:(0,n.jsx)("input",{ref:$,type:"text",value:P,onChange:e=>D(e.target.value),onKeyDown:e=>{"Enter"===e.key&&F(),"Escape"===e.key&&I(null)},onBlur:F,className:"flex-1 min-w-0 px-2 py-1 text-xs rounded-md border border-border bg-background text-foreground outline-none focus:border-[var(--amber)]/50",placeholder:"Session name..."})},e.id):(0,n.jsxs)("div",{className:"group/item flex items-center",children:[(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":t,onClick:()=>O(e.id),className:`flex-1 min-w-0 flex items-center gap-2 px-3 py-2 text-xs text-left transition-colors ${t?"text-foreground font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.pinned&&(0,n.jsx)(J.A,{size:10,className:"shrink-0 text-[var(--amber)]/60 -rotate-45"}),t&&!e.pinned&&(0,n.jsx)(g.A,{size:11,className:"shrink-0 text-[var(--amber)]"}),(0,n.jsx)("span",{className:"truncate",children:s})]}),(0,n.jsxs)("div",{className:"shrink-0 flex items-center gap-0.5 mr-1 opacity-0 group-hover/item:opacity-100 transition-opacity",children:[A&&(0,n.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),A(e.id)},className:`p-1.5 rounded-md transition-colors ${e.pinned?"text-[var(--amber)] hover:text-muted-foreground hover:bg-muted/60":"text-muted-foreground/40 hover:text-[var(--amber)] hover:bg-[var(--amber)]/5"}`,"aria-label":e.pinned?"Unpin":"Pin",children:e.pinned?(0,n.jsx)(eA.A,{size:10}):(0,n.jsx)(J.A,{size:10})}),N&&(0,n.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),U(e.id,r)},className:"p-1.5 rounded-md text-muted-foreground/40 hover:text-foreground hover:bg-muted/60","aria-label":`Rename: ${s}`,children:(0,n.jsx)(Q.A,{size:10})}),v.length>1&&j&&(0,n.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),j(e.id)},className:"p-1.5 rounded-md text-muted-foreground/40 hover:text-error hover:bg-error/5","aria-label":`Delete: ${s}`,children:(0,n.jsx)(X.A,{size:10})})]})]},e.id)})}),document.body):null;return(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 shrink-0",children:[!e&&(0,n.jsx)("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 w-8 h-1 rounded-full bg-muted-foreground/20 md:hidden"}),!b&&(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,n.jsx)("div",{className:"w-6 h-6 rounded-lg bg-[var(--amber)]/10 flex items-center justify-center shrink-0",children:(0,n.jsx)(f.A,{size:13,className:"text-[var(--amber)]"})}),S&&_?(0,n.jsxs)("button",{ref:z,type:"button",onClick:()=>{v&&v.length>=2?R(e=>!e):r()},className:"flex items-center gap-1 min-w-0 text-sm font-medium text-[var(--amber)] hover:text-[var(--amber)]/80 transition-colors","aria-expanded":M,"aria-haspopup":"listbox",children:[(0,n.jsx)("span",{className:"truncate max-w-[180px]",children:"(empty session)"===_?C.hints?.newChat??"New chat":_}),(0,n.jsx)(h.A,{size:12,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${M?"rotate-180":""}`})]}):_?(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground/60 truncate max-w-[180px]",children:"(empty session)"===_?C.hints?.newChat??"New chat":_}):(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground/40",children:C.hints?.newChat??"New chat"})]}),b&&(0,n.jsx)("div",{}),(0,n.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),r()},"aria-pressed":t,className:`p-2 rounded-lg transition-colors ${t?"bg-[var(--amber)]/10 text-[var(--amber)]":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:C.hints.sessionHistory,children:(0,n.jsx)(et.A,{size:14})}),(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),a()},disabled:o,className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-40",title:C.hints.newSession,children:(0,n.jsx)(eS.A,{size:14})}),u&&(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),u()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:l?C.hints.restorePanel:C.hints.maximizePanel,children:l?(0,n.jsx)(eE.A,{size:14}):(0,n.jsx)(e_.A,{size:14})}),p&&(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),p()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"popup"===d?C.hints.dockToSide:C.hints.openAsPopup,children:"popup"===d?(0,n.jsx)(eM.A,{size:14}):(0,n.jsx)(eR.A,{size:14})}),x&&(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),x()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:C.hints.closePanel,"aria-label":"Close",children:(0,n.jsx)(i.A,{size:14})})]}),"u">typeof document&&K]})});var eL=r(56558),eT=r(49619),eI=r(38798);let eP={kb:{icon:o.A,cls:"text-muted-foreground"},upload:{icon:eL.A,cls:"text-muted-foreground"},image:{icon:l.A,cls:"text-muted-foreground"},skill:{icon:L.A,cls:"text-[var(--amber)]"},agent:{icon:eT.A,cls:"text-muted-foreground"}},eD={kb:"border-border bg-muted text-foreground",upload:"border-border bg-muted text-foreground",image:"border-border bg-muted text-foreground",skill:"border-[var(--amber)]/25 bg-[var(--amber)]/10 text-foreground",agent:"border-[var(--amber)]/25 bg-[var(--amber)]/10 text-foreground"};function e$({path:e,onRemove:t,variant:r="kb",imageData:a,imageMime:o,status:l,error:u,truncatedInfo:d}){let[c,p]=(0,s.useState)(!1),[f,g]=(0,s.useState)(!1),[h,x]=(0,s.useState)(!1),b=(0,s.useRef)(null),[v,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(null);(0,s.useEffect)(()=>x(!0),[]);let j="kb"===r&&e.endsWith("/"),N=j?e.slice(0,-1):e,A=N.split("/").pop()??N,C="kb"===r&&!j&&A.endsWith(".csv"),{icon:S,cls:E}=j?{icon:eI.A,cls:"text-yellow-400"}:C?{icon:en.A,cls:"text-success"}:eP[r],_=!!d,M=null,R="";"loading"===l?(M=T.A,R="text-muted-foreground animate-spin"):"error"===l?(M=U.A,R="text-destructive"):_?(M=ea.A,R="text-amber-500"):"success"===l&&(M=eo.A,R="text-emerald-500");let z="error"===l?"border-destructive/30 bg-destructive/5 text-foreground":_?"border-amber-500/30 bg-amber-500/5 text-foreground":eD[r],L=null;if("error"===l&&u)L=u;else if(_){let e=d.totalChars>0?Math.round(d.includedChars/d.totalChars*100):0;L=`Document truncated — only ${e}% included (${Math.round(d.includedChars/1e3)}K / ${Math.round(d.totalChars/1e3)}K chars, ${d.totalPages} pages total)`}(0,s.useEffect)(()=>{if(!c||!b.current)return void y(null);let e=b.current.getBoundingClientRect();y({top:e.top-8,left:e.left})},[c]),(0,s.useEffect)(()=>{if(!f||!b.current)return void w(null);let e=b.current.getBoundingClientRect();w({top:e.top-8,left:e.left})},[f]);let I=c&&v&&a&&o?(0,n.jsx)("div",{className:"fixed z-50 p-1 rounded-lg border border-border bg-card shadow-lg pointer-events-none",style:{left:v.left,bottom:window.innerHeight-v.top},children:(0,n.jsx)("img",{src:`data:${o};base64,${a}`,alt:A,className:"max-h-48 max-w-64 rounded object-contain"})}):null,P=f&&k&&L?(0,n.jsx)("div",{className:`fixed z-50 px-2.5 py-1.5 rounded-lg border bg-card text-xs shadow-lg pointer-events-none max-w-[280px] ${"error"===l?"border-destructive/20 text-destructive":"border-amber-500/20 text-amber-600 dark:text-amber-400"}`,style:{left:k.left,bottom:window.innerHeight-k.top},children:L}):null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{ref:b,className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs border max-w-[220px] ${z}`,onMouseEnter:()=>{a&&p(!0),L&&g(!0)},onMouseLeave:()=>{p(!1),g(!1)},children:[(0,n.jsx)(S,{size:11,className:`${E} shrink-0`}),(0,n.jsx)("span",{className:"truncate",title:j?N:e,children:A}),M&&(0,n.jsx)(M,{size:10,className:`${R} shrink-0`}),(0,n.jsx)("button",{type:"button",onClick:t,"aria-label":`Remove ${A}`,className:"p-0.5 -mr-1 rounded hover:text-foreground transition-colors shrink-0 text-muted-foreground",children:(0,n.jsx)(i.A,{size:10})})]}),h&&I&&(0,m.createPortal)(I,document.body),h&&P&&(0,m.createPortal)(P,document.body)]})}function eO({selectedAgent:e,onSelect:t,installedAgents:r,loading:a=!1}){let{t:o}=(0,c.Y)(),l=o.panels.agents,[u,d]=(0,s.useState)(!1),[p,f]=(0,s.useState)(null),x=(0,s.useRef)(null),b=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!u||!x.current)return;let e=x.current.getBoundingClientRect(),t=e.top,r=t>window.innerHeight-e.bottom&&t>200?"up":"down";f({left:e.left,top:"up"===r?e.top-6:e.bottom+6,direction:r})},[u]),(0,s.useEffect)(()=>{if(!u)return;let e=e=>{let t=e.target;x.current&&!x.current.contains(t)&&b.current&&!b.current.contains(t)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u]),(0,s.useEffect)(()=>{if(!u)return;let e=e=>{"Escape"===e.key&&d(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u]),(0,s.useEffect)(()=>{if(!u||!x.current)return;let e=()=>{if(!x.current)return;let e=x.current.getBoundingClientRect(),t=e.top,r=t>window.innerHeight-e.bottom&&t>200?"up":"down";f({left:e.left,top:"up"===r?e.top-6:e.bottom+6,direction:r})};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[u]);let v=(0,s.useCallback)(()=>{t(null),d(!1)},[t]),y=(0,s.useCallback)(e=>{t({id:e.id,name:e.name}),d(!1)},[t]),k=(0,s.useCallback)(e=>{e.stopPropagation(),t(null)},[t]),w=!e,j=e?.name??l.acpDefaultAgent;if(!a&&0===r.length&&!e)return null;let N=u&&p?(0,n.jsxs)("div",{ref:b,role:"listbox","aria-label":l.acpSelectAgent,className:"fixed z-50 min-w-[180px] max-w-[240px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:p.left,..."up"===p.direction?{bottom:window.innerHeight-p.top}:{top:p.top}},children:[(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":w,onClick:v,className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-left transition-colors hover:bg-muted",children:[(0,n.jsx)(eT.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,n.jsx)("span",{className:"flex-1 truncate font-medium",children:l.acpDefaultAgent}),w&&(0,n.jsx)(g.A,{size:11,className:"shrink-0 text-[var(--amber)]"})]}),r.length>0&&(0,n.jsx)("div",{className:"mx-2 my-1 border-t border-border/60"}),r.map(t=>{let r=e?.id===t.id;return(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":r,onClick:()=>y(t),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-left transition-colors hover:bg-muted",children:[(0,n.jsx)("span",{className:"w-2 h-2 rounded-full bg-[var(--success)] shrink-0"}),(0,n.jsx)("span",{className:"flex-1 truncate",children:t.name}),r&&(0,n.jsx)(g.A,{size:11,className:"shrink-0 text-[var(--amber)]"})]},t.id)})]}):null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:x,type:"button",onClick:()=>d(e=>!e),className:`
|
|
10
|
+
inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
|
|
11
|
+
text-2xs font-medium transition-colors
|
|
12
|
+
border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
|
|
13
|
+
${w?"bg-muted/50 border-border/50 text-muted-foreground hover:bg-muted hover:text-foreground":"bg-[var(--amber)]/10 border-[var(--amber)]/25 text-foreground hover:bg-[var(--amber)]/15"}
|
|
14
|
+
`,title:l.acpChangeAgent,"aria-expanded":u,"aria-haspopup":"listbox",children:[w?(0,n.jsx)(eT.A,{size:11,className:"shrink-0 text-muted-foreground"}):(0,n.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--success)] shrink-0"}),(0,n.jsx)("span",{className:"truncate max-w-[120px]",children:j}),e?(0,n.jsx)("span",{role:"button",tabIndex:0,onClick:k,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),k(e))},className:"p-0.5 -mr-1 rounded-full text-muted-foreground hover:text-foreground transition-colors","aria-label":`Remove ${e.name}`,children:(0,n.jsx)(i.A,{size:9})}):(0,n.jsx)(h.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&N&&(0,m.createPortal)(N,document.body)]})}var eU=r(89363),eF=r(65576),eB=r(47376);let eH="mindos-provider-override";function eK(e){try{e?localStorage.setItem(eH,e):localStorage.removeItem(eH)}catch{}}function eZ({value:e,onChange:t,disabled:r=!1}){let{t:a,locale:o}=(0,c.Y)(),[l,i]=(0,s.useState)(!1),[u,d]=(0,s.useState)(null),p=(0,s.useRef)(null),f=(0,s.useRef)(null),[x,b]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=!1,t=()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.json()).then(t=>{e||b(t)}).catch(()=>{})};t();let r=()=>{"visible"===document.visibilityState&&t()},n=()=>t();return document.addEventListener("visibilitychange",r),window.addEventListener("mindos:settings-changed",n),()=>{e=!0,document.removeEventListener("visibilitychange",r),window.removeEventListener("mindos:settings-changed",n)}},[]);let v=x?.ai?.provider&&(0,eB.rl)(x.ai.provider)?x.ai.provider:"anthropic",y=(0,s.useMemo)(()=>x?function(e){let t=[],r=e.ai?.providers??{},n=e.envOverrides??{};for(let s of eB.jt){let a=eB.T_[s],o=r[s]?.apiKey==="***set***",l=(0,eB.Ux)(s),i=!!l&&!!n[l];if(o||i)t.push(s);else if(a.apiKeyFallback){let n=e.ai?.provider===s,a=r[s];(n||a&&(a.model||a.baseUrl))&&t.push(s)}}return t}(x):[],[x]);(0,s.useEffect)(()=>{x&&e&&(y.includes(e)||(t(null),eK(null)))},[x,e,y,t]);let k=e??v,w=eB.T_[k],j=x?.ai?.providers?.[k]?.model||w.defaultModel,N="zh"===o?w.nameZh:w.name,A=(0,s.useCallback)(()=>{if(!p.current)return;let e=p.current.getBoundingClientRect(),t=e.top,r=t>window.innerHeight-e.bottom&&t>240?"up":"down";d({left:e.left,top:"up"===r?e.top-6:e.bottom+6,direction:r})},[]);(0,s.useEffect)(()=>{l&&A()},[l,A]),(0,s.useEffect)(()=>{if(!l)return;let e=e=>{let t=e.target;p.current&&!p.current.contains(t)&&f.current&&!f.current.contains(t)&&i(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[l]),(0,s.useEffect)(()=>{if(!l)return;let e=e=>{"Escape"===e.key&&i(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[l]),(0,s.useEffect)(()=>{if(l)return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[l,A]);let C=(0,s.useCallback)(e=>{t(e),eK(e),i(!1)},[t]);if(!x||0===y.length)return null;let S=j.length>24?j.slice(0,22)+"…":j,E=l&&u?(0,n.jsxs)("div",{ref:f,role:"listbox","aria-label":a.ask.providerCapsule,className:"fixed z-50 min-w-[200px] max-w-[280px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:u.left,..."up"===u.direction?{bottom:window.innerHeight-u.top}:{top:u.top}},children:[(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":null===e,onClick:()=>C(null),className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs text-left transition-colors hover:bg-muted",children:[(0,n.jsx)(eU.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"font-medium",children:a.ask.providerDefault}),(0,n.jsxs)("div",{className:"text-2xs text-muted-foreground mt-0.5",children:["zh"===o?eB.T_[v].nameZh:eB.T_[v].name," \xb7 ",x?.ai?.providers?.[v]?.model||eB.T_[v].defaultModel]})]}),null===e&&(0,n.jsx)(g.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]}),y.length>0&&(0,n.jsx)("div",{className:"mx-2 my-1 border-t border-border/60"}),y.map(t=>{let r=eB.T_[t],s="zh"===o?r.nameZh:r.name,a=x?.ai?.providers?.[t]?.model||r.defaultModel,l=e===t;return(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":l,onClick:()=>C(t),className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs text-left transition-colors hover:bg-muted",children:[(0,n.jsx)(eF.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"font-medium",children:s}),(0,n.jsx)("div",{className:"text-2xs text-muted-foreground mt-0.5 truncate",children:a})]}),l&&(0,n.jsx)(g.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]},t)})]}):null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:p,type:"button",onClick:()=>{r||i(e=>!e)},disabled:r,className:`
|
|
15
|
+
inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
|
|
16
|
+
text-2xs font-medium transition-colors select-none
|
|
17
|
+
border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
|
|
18
|
+
disabled:opacity-40 disabled:cursor-not-allowed
|
|
19
|
+
${e?"bg-[var(--amber)]/10 border-[var(--amber)]/25 text-foreground hover:bg-[var(--amber)]/15":"bg-muted/50 border-border/50 text-muted-foreground hover:bg-muted hover:text-foreground"}
|
|
20
|
+
`,title:a.ask.providerCapsule,"aria-expanded":l,"aria-haspopup":"listbox",children:[(0,n.jsx)(eF.A,{size:11,className:"shrink-0"}),(0,n.jsxs)("span",{className:"truncate max-w-[140px]",children:[N,(0,n.jsx)("span",{className:"text-muted-foreground",children:" \xb7 "}),(0,n.jsx)("span",{className:"text-muted-foreground",children:S})]}),(0,n.jsx)(h.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&E&&(0,m.createPortal)(E,document.body)]})}var eY=r(68589);let eW=new Set([401,403,429]),eq=[/api.?key/i,/model.*not.?found/i,/authentication/i,/unauthorized/i,/forbidden/i];var eQ=r(91337),eG=r(2431);let eJ=new WeakMap;function eX({visible:e,currentFile:t,initialMessage:r,initialAcpAgent:m,onFirstMessage:p,variant:f,onClose:g,maximized:h,onMaximize:b,askMode:k,onModeSwitch:z}){let L="panel"===f,T="home"===f,I=(0,s.useRef)(null),P=(0,s.useRef)(null),{t:D}=(0,c.Y)(),[$,O]=(0,s.useState)(!1);(0,s.useEffect)(()=>O(!0),[]);let[U,F]=(0,s.useState)(""),B=(0,s.useRef)("");B.current=U;let[H,K]=(0,s.useState)([]),Z=(0,s.useRef)(H);Z.current=H;let[Y,W]=(0,s.useState)(!1),[q,Q]=(0,s.useState)(!1),[G,J]=(0,s.useState)(!1),[X,V]=(0,s.useState)(null),ee=(0,s.useRef)(X);ee.current=X;let[et,er]=(0,s.useState)(null),en=(0,s.useRef)(et);en.current=et;let[es,ea]=(0,s.useState)("agent"),[eo,el]=(0,s.useState)(null);(0,s.useEffect)(()=>{ea(function(){try{let e=localStorage.getItem(x);if("chat"===e||"agent"===e)return e}catch{}return"agent"}()),el(function(){try{let e=localStorage.getItem(eH);if(e&&(0,eB.rl)(e))return e}catch{}return null}())},[]);let ei=function(e){let[t,r]=(0,s.useState)([]),[n,a]=(0,s.useState)([]),[o,l]=(0,s.useState)(null),i=(0,s.useRef)(null),u=(0,s.useCallback)(async()=>{let t=(await w()).sort((e,t)=>t.updatedAt-e.updatedAt).slice(0,30),n=t.filter(e=>0===e.messages.length).map(e=>e.id),s=n.length>0?t.filter(e=>!n.includes(e.id)):t;n.length>0&&A(n);let o=y(e),i=e?s.find(t=>t.currentFile===e):s[0];i?(l(i.id),r(i.messages),a([...s])):(l(o.id),r([]),a([o,...s].slice(0,30)))},[e]),d=(0,s.useCallback)((t,r)=>{if(!r||0===t.length)return;let n=null;a(s=>{let a=Date.now(),o=s.find(e=>e.id===r);n=o?{...o,currentFile:e,updatedAt:a,messages:t}:{id:r,currentFile:e,createdAt:a,updatedAt:a,messages:t};let l=s.filter(e=>e.id!==r);return[n,...l].sort((e,t)=>t.updatedAt-e.updatedAt).slice(0,30)}),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{n&&j(n)},600)},[e]),c=(0,s.useCallback)(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]),m=(0,s.useCallback)(()=>{a(t=>{let n=t.find(e=>e.id===o);if(n&&0===n.messages.length)return t;let s=y(e);return l(s.id),r([]),[s,...t].sort((e,t)=>t.updatedAt-e.updatedAt).slice(0,30)})},[e,o]),p=(0,s.useCallback)(e=>{let t=n.find(t=>t.id===e);if(!t)return;let s=o?n.find(e=>e.id===o):null;s&&0===s.messages.length&&s.id!==e&&a(e=>e.filter(e=>e.id!==s.id)),l(t.id),r(t.messages)},[n,o]),f=(0,s.useCallback)(t=>{let s=n.find(e=>e.id===t);s&&s.messages.length>0&&N(t);let i=n.filter(e=>e.id!==t);if(a(i),o===t){let t=y(e);l(t.id),r([]),a([t,...i].slice(0,30))}},[o,e,n]),g=(0,s.useCallback)((e,t)=>{let r=t.trim();a(t=>{let n=t.findIndex(t=>t.id===e);if(n<0)return t;let s={...t[n],title:r||void 0},a=[...t];return a[n]=s,j(s),a})},[]),h=(0,s.useCallback)(e=>{a(t=>{let r=t.findIndex(t=>t.id===e);if(r<0)return t;let n={...t[r],pinned:!t[r].pinned},s=[...t];return s[r]=n,n.messages.length>0&&j(n),s})},[]),x=(0,s.useCallback)(()=>{let t=n.filter(e=>e.messages.length>0).map(e=>e.id);t.length>0&&A(t);let s=y(e);l(s.id),r([]),a([s])},[e,n]);return{messages:t,setMessages:r,sessions:[...n].sort((e,t)=>e.pinned&&!t.pinned?-1:!e.pinned&&t.pinned?1:t.updatedAt-e.updatedAt),activeSessionId:o,initSessions:u,persistSession:d,clearPersistTimer:c,resetSession:m,loadSession:p,deleteSession:f,renameSession:g,togglePinSession:h,clearAllSessions:x}}(t),eu=(0,s.useRef)(ei);eu.current=ei;let ed=function(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(""),a=(0,s.useRef)(null),o=(0,s.useCallback)(async e=>{if(!e||0===e.length)return;let r=Array.from(e).slice(0,8),s=[],a=[];for(let e of r){let t=S(e.name);C.has(t)?s.push(e):a.push(e.name)}a.length>0?n(`Unsupported file type: ${a.join(", ")}`):n("");let o=[],l=[];for(let e of s)".pdf"===S(e.name)?(l.push({name:e.name,content:"",status:"loading"}),o.push(e)):l.push({name:e.name,content:await e.text(),status:"success"});if(t(e=>{let t=[...e];for(let e of l)t.some(t=>t.name===e.name)||t.push(e);return t}),o.length>0){let e=await Promise.all(o.map(E));t(t=>t.map(t=>"loading"!==t.status?t:e.find(e=>e.name===t.name)??t))}},[]),l=(0,s.useCallback)(e=>{t(t=>t.filter((t,r)=>r!==e))},[]);return{localAttachments:e,uploadError:r,uploadInputRef:a,pickFiles:o,removeAttachment:l,clearAttachments:(0,s.useCallback)(()=>{t([]),n("")},[]),injectFiles:(0,s.useCallback)(e=>{t(t=>{let r=[...t];for(let t of e)r.some(e=>e.name===t.name)||r.push(t);return r})},[])}}(),ec=(0,s.useRef)(ed);ec.current=ed;let em=function(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(""),a=(0,s.useCallback)(async e=>{n("");let r=e.slice(0,4),s=[];for(let e of r){var a;if(a=e.type,!_.has(a)){n(`Unsupported image type: ${e.type}`);continue}try{let{data:t,mimeType:r}=await M(e);s.push({type:"image",data:t,mimeType:r,fileName:e.name||void 0})}catch{n(`Failed to process image: ${e.name}`)}}t(e=>{let t=[...e,...s];return t.length>4?(n("Maximum 4 images allowed"),t.slice(0,4)):t})},[]),o=(0,s.useCallback)(async e=>{let t=e.clipboardData?.items;if(!t)return!1;let r=R(t);return 0!==r.length&&(await a(r),!0)},[a]),l=(0,s.useCallback)(async e=>{let t=e.dataTransfer?.items;if(!t)return;let r=R(t);r.length>0&&(e.preventDefault(),await a(r))},[a]),i=(0,s.useCallback)(async e=>{if(!e)return;let t=Array.from(e).filter(e=>{var t;return t=e.type,_.has(t)});await a(t)},[a]);return{images:e,imageError:r,addImages:a,handlePaste:o,handleDrop:l,handleFileSelect:i,removeImage:(0,s.useCallback)(e=>{t(t=>t.filter((t,r)=>r!==e))},[]),clearImages:(0,s.useCallback)(()=>{t([]),n("")},[])}}(),ep=function(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(null),[a,o]=(0,s.useState)([]),[l,i]=(0,s.useState)(0),u=(0,s.useCallback)(()=>{fetch("/api/files").then(e=>e.ok?e.json():[]).then(e=>Array.isArray(e)?e:[]).catch(()=>[]).then(t)},[]);(0,s.useEffect)(()=>{u();let e=()=>u();return window.addEventListener("mindos:files-changed",e),()=>window.removeEventListener("mindos:files-changed",e)},[u]);let d=(0,s.useCallback)((t,r)=>{let s=r??t.length,a=t.slice(0,s),l=a.lastIndexOf("@");if(-1===l||l>0&&" "!==a[l-1]&&"\n"!==a[l-1])return void n(null);let u=a.slice(l+1);if(u.includes(" ")||u.includes("\n")){n(null),o([]),i(0);return}let d=u.toLowerCase();if(!d){n(u),o(e.slice(0,30)),i(0);return}let c=e.map(e=>{let t=(e.split("/").pop()??e).toLowerCase(),r=e.toLowerCase(),n=0;return t.startsWith(d)?n=100:t.includes(d)?n=50:r.includes(d)&&(n=10),{path:e,score:n}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score).slice(0,30);if(0===c.length){n(null),o([]),i(0);return}n(u),o(c.map(e=>e.path)),i(0)},[e]),c=(0,s.useCallback)(e=>{0!==a.length&&("down"===e?i(e=>Math.min(e+1,a.length-1)):i(e=>Math.max(e-1,0)))},[a.length]);return{mentionQuery:r,mentionResults:a,mentionIndex:l,updateMentionFromInput:d,navigateMention:c,resetMention:(0,s.useCallback)(()=>{n(null),o([]),i(0)},[])}}(),ef=function(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(null),[a,o]=(0,s.useState)([]),[l,i]=(0,s.useState)(0),u=(0,s.useRef)(!1),d=(0,s.useCallback)(async()=>{t((await fetch("/api/skills").then(e=>e.ok?e.json():{skills:[]}).then(e=>Array.isArray(e?.skills)?e.skills:[]).catch(()=>[])).filter(e=>e.enabled)),u.current=!0},[]);(0,s.useEffect)(()=>{d();let e=()=>d();return window.addEventListener("mindos:skills-changed",e),()=>window.removeEventListener("mindos:skills-changed",e)},[d]);let c=(0,s.useCallback)((t,r)=>{let s=t.slice(0,r),a=s.lastIndexOf("/");if(-1===a||a>0&&" "!==s[a-1]&&"\n"!==s[a-1])return void n(null);let l=s.slice(a+1);if(l.includes(" "))return void n(null);if(!u.current){d(),n(null);return}let c=l.toLowerCase(),m=c?e.map(e=>{let t=e.name.toLowerCase(),r=0;return t.startsWith(c)?r=100:t.includes(c)?r=50:e.description.toLowerCase().includes(c)&&(r=10),{s:e,score:r}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score).slice(0,20).map(e=>({type:"skill",name:e.s.name,description:e.s.description})):e.slice(0,20).map(e=>({type:"skill",name:e.name,description:e.description}));if(0===m.length){n(null),o([]),i(0);return}n(l),o(m),i(0)},[e,d]),m=(0,s.useCallback)(e=>{0!==a.length&&("down"===e?i(e=>Math.min(e+1,a.length-1)):i(e=>Math.max(e-1,0)))},[a.length]);return{slashQuery:r,slashResults:a,slashIndex:l,updateSlashFromInput:c,navigateSlash:m,resetSlash:(0,s.useCallback)(()=>{n(null),o([]),i(0)},[])}}(),eg=(0,eG.z)(),eh=(0,s.useRef)(em);eh.current=em;let ex=(0,s.useRef)(ep);ex.current=ep;let eb=(0,s.useRef)(ef);eb.current=ef;let ev=(0,s.useCallback)(()=>{F(""),V(null),er(null),K(t?[t]:[])},[t]),ey=(0,s.useRef)({inputValueRef:B,mentionRef:ex,slashRef:eb,imageUploadRef:eh,sessionRef:eu,uploadRef:ec,selectedSkillRef:ee,selectedAcpAgentRef:en,attachedFilesRef:Z}),ew=function({currentFile:e,chatMode:t,providerOverride:r,onFirstMessage:n,refs:a,errorLabels:o,resetInputState:l}){let[i,u]=(0,s.useState)(!1),[d,c]=(0,s.useState)("connecting"),[m,p]=(0,s.useState)(0),f=(0,s.useRef)(3),g=(0,s.useRef)(null),h=(0,s.useRef)(!1),x=(0,s.useCallback)(()=>{g.current?.abort()},[]),b=(0,s.useCallback)(async s=>{s.preventDefault();let i=a.mentionRef.current,d=a.slashRef.current,m=a.imageUploadRef.current,x=a.sessionRef.current,b=a.uploadRef.current;if(!i||!d||!m||!x||!b||null!==i.mentionQuery||null!==d.slashQuery)return;let y=a.inputValueRef.current?.trim()??"";if(!y&&0===m.images.length||v.current)return;let k=a.selectedSkillRef.current,w=a.selectedAcpAgentRef.current,j=m.images.length>0?[...m.images]:void 0,N={role:"user",content:y,timestamp:Date.now(),...k&&{skillName:k.name},...j&&{images:j}};m.clearImages();let A=[...x.messages,N];x.setMessages([...A,{role:"assistant",content:"",timestamp:Date.now()}]),l(),n&&!h.current&&(h.current=!0,n()),u(!0),c("connecting"),p(0);let C=new AbortController;g.current=C;let S=3;try{let e=localStorage.getItem("mindos-reconnect-retries");if(null!==e){let t=parseInt(e,10);Number.isFinite(t)&&(S=Math.max(0,Math.min(10,t)))}}catch{}f.current=S;let E=JSON.stringify({messages:A,currentFile:e,attachedFiles:a.attachedFilesRef.current,uploadedFiles:b.localAttachments.filter(e=>"loading"!==e.status).map(e=>({name:e.name,content:e.content.length>8e4?e.content.slice(0,8e4)+"\n\n[...truncated to first ~80000 chars]":e.content})),selectedAcpAgent:w,mode:t,providerOverride:r??void 0}),_=async()=>{let e=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:E,signal:C.signal});if(!e.ok){let t=`Request failed (${e.status})`;try{let r=await e.json();"string"==typeof r?.error&&r.error.trim()?t=r.error:"object"==typeof r?.error&&"string"==typeof r.error?.message&&r.error.message.trim()?t=r.error.message:"string"==typeof r?.message&&r.message.trim()&&(t=r.message)}catch(e){console.warn("[useAskChat] error body parse failed:",e)}let r=Error(t);throw r.httpStatus=e.status,r}if(!e.body)throw Error("No response body");return c("thinking"),{finalMessage:await (0,eY.m)(e.body,e=>{c("streaming"),a.sessionRef.current?.setMessages(t=>{let r=[...t];return r[r.length-1]=e,r})},C.signal)}};try{let e=null;for(let t=0;t<=S&&!C.signal.aborted;t++){if(t>0){var M;p(t),c("reconnecting"),a.sessionRef.current?.setMessages(e=>{let t=[...e];return t[t.length-1]={role:"assistant",content:"",timestamp:Date.now()},t}),await function(e,t){return new Promise((r,n)=>{let s=()=>t?.reason??new DOMException("The operation was aborted.","AbortError");if(t?.aborted)return void n(s());let a=setTimeout(r,e);t?.addEventListener("abort",()=>{clearTimeout(a),n(s())},{once:!0})})}((M=t-1,Math.min(1e3*2**M,1e4)),C.signal),c("connecting")}try{let{finalMessage:e}=await _();e.content.trim()||e.parts&&0!==e.parts.length||a.sessionRef.current?.setMessages(e=>{let t=[...e];return t[t.length-1]={role:"assistant",content:`__error__${o.noResponse}`},t});return}catch(n){e=n instanceof Error?n:Error(String(n));let r=n.httpStatus;if(!function(e,t){if(e instanceof DOMException&&"AbortError"===e.name||t&&eW.has(t))return!1;if(e instanceof Error){let t=e.message;if(eq.some(e=>e.test(t)))return!1}return!0}(n,r)||t>=S)break}}if(e)throw e}catch(e){if("AbortError"===e.name)a.sessionRef.current?.setMessages(e=>{let t=[...e],r=t.length-1;if(r>=0&&"assistant"===t[r].role){let e=t[r];e.content.trim()||e.parts&&e.parts.length>0||(t[r]={role:"assistant",content:`__error__${o.stopped}`})}return t});else{let t=e instanceof Error?e.message:"Something went wrong";a.sessionRef.current?.setMessages(e=>{let r=[...e],n=r.length-1;if(n>=0&&"assistant"===r[n].role){let e=r[n];if(!(e.content.trim()||e.parts&&e.parts.length>0))return r[n]={role:"assistant",content:`__error__${t}`},r}return[...r,{role:"assistant",content:`__error__${t}`}]})}}finally{u(!1),p(0),g.current=null}},[e,t,r,o.noResponse,o.stopped,n,a,l]),v=(0,s.useRef)(i);return v.current=i,{isLoading:i,isLoadingRef:v,loadingPhase:d,reconnectAttempt:m,reconnectMaxRef:f,abortRef:g,firstMessageFired:h,submit:b,stop:x}}({currentFile:t,chatMode:es,providerOverride:eo,onFirstMessage:p,refs:ey.current,errorLabels:{noResponse:D.ask.errorNoResponse,stopped:D.ask.stopped},resetInputState:ev}),{isLoading:eA,loadingPhase:eS,reconnectAttempt:eE,reconnectMaxRef:e_}=ew,eM=ew.submit,eR=ew.stop;(0,s.useEffect)(()=>{let e=e=>{let t=e.detail?.files;Array.isArray(t)&&t.length>0&&ec.current.injectFiles(t)};return window.addEventListener("mindos:inject-ask-files",e),()=>window.removeEventListener("mindos:inject-ask-files",e)},[]),(0,s.useEffect)(()=>{if(!T)return;let e=e=>{let t=e.detail?.text;"string"==typeof t&&(F(t),setTimeout(()=>I.current?.focus(),50))};return window.addEventListener("mindos:home-suggestion",e),()=>window.removeEventListener("mindos:home-suggestion",e)},[T]);let eL=(0,s.useRef)(!1),eT=(0,s.useRef)(t);(0,s.useEffect)(()=>{let n="panel"===f||"home"===f?e&&!eL.current:e,s=e&&eL.current&&t!==eT.current;n?(setTimeout(()=>I.current?.focus(),50),ei.initSessions(),F(r||""),ew.firstMessageFired.current=!1,K(t?[t]:[]),ed.clearAttachments(),em.clearImages(),ep.resetMention(),ef.resetSlash(),V(null),er(m??null),W(!1)):s?K(t?[t]:[]):e||"modal"!==f||ew.abortRef.current?.abort(),"home"===f&&e&&!eL.current&&setTimeout(()=>I.current?.focus(),150),eL.current=e,eT.current=t},[e,t]),(0,s.useEffect)(()=>{if(!e||!ei.activeSessionId)return;let t=ei.messages;if(ew.isLoading&&t.length>0){let e=t[t.length-1];if("assistant"===e.role&&!e.content.trim()&&(!e.parts||0===e.parts.length))return}return ei.persistSession(t,ei.activeSessionId),()=>ei.clearPersistTimer()},[e,ei.messages,ei.activeSessionId,ew.isLoading]),(0,s.useEffect)(()=>{if(!e||"home"===f)return;let t="modal"===f,r="panel"===f&&h;if(!t&&!r)return;let n=e=>{if("Escape"===e.key){if(null!==ex.current.mentionQuery)return void ex.current.resetMention();if(null!==eb.current.slashQuery)return void eb.current.resetSlash();if(r&&b)return void b();t&&g&&g()}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[f,e,g,h,b]),(0,s.useEffect)(()=>{if(!G)return;let e=()=>J(!1),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[G]);let eI=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{if(!e)return;let t=I.current;t&&t instanceof HTMLTextAreaElement&&function(e,t){let r=eJ.get(e);if(!r){let t=getComputedStyle(e),n=parseFloat(t.lineHeight),s=parseFloat(t.fontSize),a=Number.isFinite(s)?s:14,o=8*(Number.isFinite(n)?n:1.375*a)+((Number.isFinite(parseFloat(t.paddingTop))?parseFloat(t.paddingTop):0)+(Number.isFinite(parseFloat(t.paddingBottom))?parseFloat(t.paddingBottom):0));if(!Number.isFinite(o)||o<=0)return;r={maxH:o},eJ.set(e,r)}let{maxH:n}=r;e.style.height="auto";let s=e.scrollHeight,a=Math.min(s,n);e.style.height=`${a}px`,e.style.overflowY=s>n?"auto":"hidden"}(t,0)},[U,eA,e]),(0,s.useEffect)(()=>{let e=I.current;if(!e)return;let t=()=>eJ.delete(e);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);let eP=(0,s.useRef)(null),eD=(0,s.useRef)(null),eU=(0,s.useCallback)((e,t)=>{F(e);let r=t??e.length;eP.current&&clearTimeout(eP.current),eD.current&&clearTimeout(eD.current),eP.current=setTimeout(()=>ex.current.updateMentionFromInput(e,r),80),eD.current=setTimeout(()=>eb.current.updateSlashFromInput(e,r),80)},[]);(0,s.useEffect)(()=>()=>{eP.current&&clearTimeout(eP.current),eD.current&&clearTimeout(eD.current)},[]);let eF=(0,s.useCallback)(e=>{let t=I.current,r=B.current,n=t?.selectionStart??r.length,s=r.slice(0,n).lastIndexOf("@");F(r.slice(0,s)+r.slice(n)),ex.current.resetMention(),Z.current.includes(e)||K(t=>[...t,e]),setTimeout(()=>{I.current?.focus(),I.current?.setSelectionRange(s,s)},0)},[]),eK=(0,s.useCallback)(e=>{let t=I.current,r=B.current,n=t?.selectionStart??r.length,s=r.slice(0,n).lastIndexOf("/");F(r.slice(0,s)+r.slice(n)),V(e),eb.current.resetSlash(),setTimeout(()=>{I.current?.focus(),I.current?.setSelectionRange(s,s)},0)},[]),eX=(0,s.useRef)(eF);eX.current=eF;let eV=(0,s.useRef)(eK);eV.current=eK;let e0=(0,s.useCallback)(e=>{let t=ex.current,r=eb.current;if(null!==t.mentionQuery){if("Escape"===e.key){e.preventDefault(),t.resetMention();return}if("ArrowDown"===e.key)e.preventDefault(),t.navigateMention("down");else if("ArrowUp"===e.key)e.preventDefault(),t.navigateMention("up");else if("Enter"===e.key||"Tab"===e.key){if("Enter"===e.key&&(e.shiftKey||e.nativeEvent.isComposing))return;t.mentionResults.length>0&&(e.preventDefault(),eX.current(t.mentionResults[t.mentionIndex]))}return}if(null!==r.slashQuery){if("Escape"===e.key){e.preventDefault(),r.resetSlash();return}if("ArrowDown"===e.key)e.preventDefault(),r.navigateSlash("down");else if("ArrowUp"===e.key)e.preventDefault(),r.navigateSlash("up");else if("Enter"===e.key||"Tab"===e.key){if("Enter"===e.key&&(e.shiftKey||e.nativeEvent.isComposing))return;r.slashResults.length>0&&(e.preventDefault(),eV.current(r.slashResults[r.slashIndex]))}return}"Enter"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing&&!ew.isLoadingRef.current&&(B.current.trim()||eh.current.images.length>0)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},[]),e1=(0,s.useCallback)(()=>{ew.isLoadingRef.current||(eu.current.resetSession(),F(""),K(t?[t]:[]),ec.current.clearAttachments(),eh.current.clearImages(),ex.current.resetMention(),eb.current.resetSlash(),V(null),er(null),W(!1),ew.firstMessageFired.current=!1,setTimeout(()=>I.current?.focus(),0))},[t]),e5=(0,s.useCallback)(e=>{(e.dataTransfer.types.includes("text/mindos-path")||e.dataTransfer.types.includes("Files"))&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",Q(!0))},[]),e2=(0,s.useCallback)(()=>Q(!1),[]),e3=(0,s.useCallback)(async e=>{e.preventDefault(),e.stopPropagation(),Q(!1);let t=e.dataTransfer.getData("text/mindos-path");if(t){let r="directory"===e.dataTransfer.getData("text/mindos-type")?t.replace(/\/?$/,"/"):t;Z.current.includes(r)||K(e=>[...e,r]);return}let r=e.dataTransfer.files;if(r.length>0){Array.from(r).some(e=>e.type.startsWith("image/"))&&await eh.current.handleDrop(e);let t=Array.from(r).filter(e=>!e.type.startsWith("image/"));if(t.length>0){let e=new DataTransfer;t.forEach(t=>e.items.add(t)),await ec.current.pickFiles(e.files)}}},[]),e4=(0,s.useCallback)(e=>{let t=e.clipboardData?.items;!t||Array.from(t).some(e=>"file"===e.kind&&e.type.startsWith("image/"))&&(e.preventDefault(),eh.current.handlePaste(e))},[]),e8=(0,s.useCallback)(e=>{eu.current.loadSession(e),W(!1),F(""),K(t?[t]:[]),ec.current.clearAttachments(),eh.current.clearImages(),ex.current.resetMention(),eb.current.resetSlash(),V(null),er(null),setTimeout(()=>I.current?.focus(),0)},[t]),e6=(0,s.useCallback)(()=>W(e=>!e),[]),e7=(0,s.useMemo)(()=>({connecting:D.ask.connecting,thinking:D.ask.thinking,generating:D.ask.generating,reconnecting:eE>0?D.ask.reconnecting(eE,e_.current):void 0,copyMessage:D.ask.copyMessage}),[D,eE]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ez,{isPanel:L||T,showHistory:Y,onToggleHistory:e6,onReset:e1,isLoading:eA,maximized:h,onMaximize:b,askMode:T?void 0:k,onModeSwitch:T?void 0:z,onClose:T?void 0:g,sessions:ei.sessions,activeSessionId:ei.activeSessionId,onLoadSession:e8,onDeleteSession:ei.deleteSession,onRenameSession:ei.renameSession,onTogglePinSession:ei.togglePinSession}),Y&&(0,n.jsx)(eC,{sessions:ei.sessions,activeSessionId:ei.activeSessionId,onLoad:e8,onDelete:ei.deleteSession,onRename:ei.renameSession,onTogglePin:ei.togglePinSession,onClearAll:ei.clearAllSessions,labels:{title:D.ask.sessionHistory??"Session History",clearAll:D.ask.clearAll??"Clear all",confirmClear:D.ask.confirmClear??"Confirm clear?",noSessions:D.ask.noSessions??"No saved sessions.",rename:D.ask.renameSession??"Rename"}}),!T&&(0,n.jsx)(ek,{messages:ei.messages,isLoading:eA,loadingPhase:eS,emptyPrompt:D.ask.emptyPrompt,emptyHint:D.ask.emptyHint,suggestions:D.ask.suggestions,onSuggestionClick:F,labels:e7}),T&&ei.messages.length>0&&(0,n.jsx)(ek,{messages:ei.messages,isLoading:eA,loadingPhase:eS,emptyPrompt:D.ask.emptyPrompt,emptyHint:D.ask.emptyHint,suggestions:[],onSuggestionClick:F,labels:e7}),null!==ep.mentionQuery&&ep.mentionResults.length>0&&(0,n.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,n.jsx)(ej,{results:ep.mentionResults,selectedIndex:ep.mentionIndex,query:ep.mentionQuery??void 0,onSelect:eF})}),null!==ef.slashQuery&&ef.slashResults.length>0&&(0,n.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,n.jsx)(eN,{results:ef.slashResults,selectedIndex:ef.slashIndex,query:ef.slashQuery??void 0,onSelect:eK})}),(0,n.jsx)("div",{className:"shrink-0 px-3 pb-2.5 pt-1",children:(0,n.jsxs)("div",{className:(0,eQ.cn)("rounded-xl bg-muted/40 transition-all focus-within:bg-muted/60",q&&"ring-2 ring-[var(--amber)] bg-[var(--amber-dim)]"),onDragOver:e5,onDragLeave:e2,onDrop:e3,children:[(H.length>0||ed.localAttachments.length>0||em.images.length>0||X||et||ed.uploadError||em.imageError)&&(0,n.jsxs)("div",{className:(0,eQ.cn)("px-3 pt-2.5 pb-1",L?"max-h-24 overflow-y-auto":"max-h-28 overflow-y-auto"),children:[(0,n.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[H.map(e=>(0,n.jsx)(e$,{path:e,variant:"kb",onRemove:()=>K(t=>t.filter(t=>t!==e))},e)),ed.localAttachments.map((e,t)=>(0,n.jsx)(e$,{path:e.name,variant:"upload",status:e.status,error:e.error,truncatedInfo:e.truncatedInfo,onRemove:()=>ed.removeAttachment(t)},`up-${e.name}-${t}`)),em.images.map((e,t)=>(0,n.jsx)(e$,{path:e.fileName||`Image ${t+1}`,variant:"image",imageData:e.data,imageMime:e.mimeType,onRemove:()=>em.removeImage(t)},`img-${t}`)),X&&(0,n.jsx)(e$,{path:X.name,variant:"skill",onRemove:()=>{V(null),I.current?.focus()}})]}),(ed.uploadError||em.imageError)&&(0,n.jsx)("div",{className:"mt-1 text-xs text-error",children:ed.uploadError||em.imageError})]}),(0,n.jsxs)("form",{ref:eI,onSubmit:eM,className:"flex items-end gap-1.5 px-3 py-2",children:[(0,n.jsxs)("div",{className:"relative shrink-0",children:[(0,n.jsx)("button",{type:"button",onClick:()=>J(e=>!e),className:"p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:D.hints.attachFile,children:(0,n.jsx)(a.A,{size:15})}),G&&(0,n.jsxs)("div",{className:"absolute bottom-full left-0 mb-1.5 py-1 rounded-xl border border-border/60 bg-card shadow-lg z-50 min-w-[150px] animate-in fade-in-0 slide-in-from-bottom-2 duration-150",children:[(0,n.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",onClick:()=>{J(!1),ed.uploadInputRef.current?.click()},children:[(0,n.jsx)(o.A,{size:12,className:"shrink-0 text-muted-foreground"}),D.ask.attachFileLabel]}),(0,n.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",onClick:()=>{J(!1),P.current?.click()},children:[(0,n.jsx)(l.A,{size:12,className:"shrink-0 text-muted-foreground"}),D.ask.attachImageLabel]})]})]}),(0,n.jsx)("input",{ref:ed.uploadInputRef,type:"file",className:"hidden",multiple:!0,accept:".txt,.md,.markdown,.csv,.json,.yaml,.yml,.xml,.html,.htm,.pdf,text/plain,text/markdown,text/csv,application/json,application/pdf",onChange:async e=>{let t=e.currentTarget;await ed.pickFiles(t.files),t.value=""}}),(0,n.jsx)("input",{ref:P,type:"file",className:"hidden",multiple:!0,accept:"image/png,image/jpeg,image/gif,image/webp",onChange:async e=>{let t=e.currentTarget;await em.handleFileSelect(t.files),t.value=""}}),(0,n.jsx)("textarea",{ref:e=>{I.current=e},value:U,onChange:e=>eU(e.target.value,e.target.selectionStart??void 0),onKeyDown:e0,onPaste:e4,placeholder:D.ask.placeholder,rows:1,className:"min-w-0 flex-1 resize-none overflow-y-hidden bg-transparent py-2 text-sm leading-relaxed text-foreground placeholder:text-muted-foreground/50 outline-none focus-visible:ring-0"}),eA?(0,n.jsx)("button",{type:"button",onClick:eR,className:"p-2 rounded-xl transition-colors shrink-0 text-foreground bg-muted hover:bg-muted/80",title:"reconnecting"===eS?D.ask.cancelReconnect:D.ask.stopTitle,children:"reconnecting"===eS?(0,n.jsx)(i.A,{size:15}):(0,n.jsx)(u.A,{size:15})}):(0,n.jsx)("button",{type:"submit",disabled:!U.trim()&&0===em.images.length,className:"p-2 rounded-xl disabled:opacity-20 disabled:scale-95 disabled:cursor-not-allowed transition-all duration-150 shrink-0 bg-[var(--amber)] text-[var(--amber-foreground)] shadow-sm shadow-[var(--amber)]/15 hover:shadow-md hover:shadow-[var(--amber)]/20 active:scale-95",children:(0,n.jsx)(d.A,{size:14})})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between px-3 pb-2 pt-1.5 border-t border-border/10",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(v,{mode:es,onChange:ea,disabled:eA}),$&&eg.installedAgents.length>0&&(0,n.jsx)(eO,{selectedAgent:et,onSelect:er,installedAgents:eg.installedAgents,loading:eg.loading}),$&&(0,n.jsx)(eZ,{value:eo,onChange:el,disabled:eA})]}),(0,n.jsxs)("span",{className:"hidden md:inline text-2xs text-muted-foreground/40 select-none",children:[(0,n.jsx)("kbd",{className:"font-mono",children:"Enter"})," ",D.ask.send," \xb7 ",(0,n.jsx)("kbd",{className:"font-mono",children:"Shift+Enter"})," ",D.ask.newlineHint]})]})]})})]})}},59960:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(95155);function s({id:e,className:t="w-8 h-4"}){return(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 40",fill:"none",className:`${t} text-[var(--amber)]`,"aria-hidden":"true",children:[(0,n.jsxs)("defs",{children:[(0,n.jsxs)("linearGradient",{id:`grad-human-${e}`,x1:"35",y1:"20",x2:"5",y2:"20",gradientUnits:"userSpaceOnUse",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.8"}),(0,n.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.3"})]}),(0,n.jsxs)("linearGradient",{id:`grad-agent-${e}`,x1:"35",y1:"20",x2:"75",y2:"20",gradientUnits:"userSpaceOnUse",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.8"}),(0,n.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"1"})]})]}),(0,n.jsx)("path",{d:"M35,20 C25,35 8,35 8,20 C8,5 25,5 35,20",stroke:`url(#grad-human-${e})`,strokeWidth:"3",strokeDasharray:"2 4",strokeLinecap:"round"}),(0,n.jsx)("path",{d:"M35,20 C45,2 75,2 75,20 C75,38 45,38 35,20",stroke:`url(#grad-agent-${e})`,strokeWidth:"4.5",strokeLinecap:"round"}),(0,n.jsx)("path",{d:"M35,17.5 Q35,20 37.5,20 Q35,20 35,22.5 Q35,20 32.5,20 Q35,20 35,17.5 Z",fill:"#FEF3C7"})]})}},60392:e=>{function t(e){return Promise.resolve().then(()=>{var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t})}t.keys=()=>[],t.resolve=t,t.id=60392,e.exports=t},68589:(e,t,r)=>{"use strict";r.d(t,{m:()=>s});let n=new Set(["write_file","create_file","batch_create_files","update_section","insert_after_heading","delete_file","rename_file","create_space"]);async function s(e,t,r){let s=e.getReader(),a=new TextDecoder,o="",l=[],i=new Map,u=null,d=null,c=Date.now();function m(){let e=l.map(e=>"text"===e.type?{type:"text",text:e.text}:"reasoning"===e.type?{type:"reasoning",text:e.text}:{...e});return{role:"assistant",content:e.filter(e=>"text"===e.type).map(e=>e.text).join(""),parts:e,timestamp:c}}try{for(;!r?.aborted;){let{done:e,value:r}=await s.read();if(e)break;let c=(o+=a.decode(r,{stream:!0})).split("\n");o=c.pop()??"";let p=!1;for(let e of c){let t,r=e.trim(),s=null;if(r.startsWith("data:")&&(s=r.slice(5).trim()),s){try{t=JSON.parse(s)}catch{continue}switch(t.type){case"text_delta":{let e=function(e){if(u===e){let e=l[l.length-1];if(e&&"text"===e.type)return e}let t={type:"text",text:""};return l.push(t),u=e,t}("text");e.text+=t.delta??"",p=!0;break}case"thinking_delta":d||(d={type:"reasoning",text:""},l.push(d),u=null),d.text+=t.delta??"",p=!0;break;case"tool_start":{let e=t.toolCallId,r=t.toolName,n=function(e,t){let r=i.get(e);return r||(r={type:"tool-call",toolCallId:e,toolName:t??"unknown",input:void 0,state:"pending"},i.set(e,r),l.push(r),u=null),r}(e,r);n.input=t.args,n.state="running",p=!0;break}case"tool_end":{let e=t.toolCallId,r=i.get(e);r&&(r.output=t.output??"",r.state=t.isError?"error":"done",p=!0,!t.isError&&n.has(r.toolName)&&window.dispatchEvent(new Event("mindos:files-changed")));break}case"error":{let e=t.message;l.push({type:"text",text:`
|
|
21
|
+
|
|
22
|
+
**Stream Error:** ${e}`}),u=null,p=!0}}}}p&&t(m())}}finally{s.releaseLock()}let p=!1;for(let e of i.values())("running"===e.state||"pending"===e.state)&&(e.state="error",e.output=e.output??"Stream ended before tool completed",p=!0);return p&&t(m()),m()}},76449:(e,t,r)=>{"use strict";r.d(t,{g:()=>n});let n=[{anchor:"files-panel",position:"right"},{anchor:"ask-button",position:"bottom"},{anchor:"agents-panel",position:"right"}]},84825:e=>{function t(e){return Promise.resolve().then(()=>{var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t})}t.keys=()=>[],t.resolve=t,t.id=84825,e.exports=t}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9186],{1934:(e,t,r)=>{r.d(t,{v:()=>a});var n=r(12115);let o=e=>{let t,r=new Set,n=(e,n)=>{let o="function"==typeof e?e(t):e;if(!Object.is(o,t)){let e=t;t=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},t,o),r.forEach(r=>r(t,e))}},o=()=>t,u={setState:n,getState:o,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e))},a=t=e(n,o,u);return u},u=e=>{let t=e?o(e):o,r=e=>(function(e,t=e=>e){let r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},a=e=>e?u(e):u},10857:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var r={DecodeError:function(){return g},MiddlewareNotFoundError:function(){return E},MissingStaticPage:function(){return v},NormalizeError:function(){return m},PageNotFoundError:function(){return b},SP:function(){return h},ST:function(){return y},WEB_VITALS:function(){return o},execOnce:function(){return u},getDisplayName:function(){return s},getLocationOrigin:function(){return i},getURL:function(){return c},isAbsoluteUrl:function(){return l},isResSent:function(){return f},loadGetInitialProps:function(){return p},normalizeRepeatedSlashes:function(){return d},stringifyError:function(){return _}};for(var n in r)Object.defineProperty(t,n,{enumerable:!0,get:r[n]});let o=["CLS","FCP","FID","INP","LCP","TTFB"];function u(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let a=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>a.test(e);function i(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=i();return e.substring(t.length)}function s(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function f(e){return e.finished||e.headersSent}function d(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function p(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await p(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&f(r))return n;if(!n)throw Object.defineProperty(Error(`"${s(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return n}let h="u">typeof performance,y=h&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class g extends Error{}class m extends Error{}class b extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class v extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class E extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function _(e){return JSON.stringify({message:e.message,stack:e.stack})}},20091:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n={formatUrl:function(){return l},formatWithValidation:function(){return c},urlObjectKeys:function(){return i}};for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:n[o]});let u=r(66388)._(r(31393)),a=/https?|ftp|gopher|file/;function l(e){let{auth:t,hostname:r}=e,n=e.protocol||"",o=e.pathname||"",l=e.hash||"",i=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:r&&(c=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(c+=":"+e.port)),i&&"object"==typeof i&&(i=String(u.urlQueryToSearchParams(i)));let s=e.search||i&&`?${i}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||a.test(n))&&!1!==c?(c="//"+(c||""),o&&"/"!==o[0]&&(o="/"+o)):c||(c=""),l&&"#"!==l[0]&&(l="#"+l),s&&"?"!==s[0]&&(s="?"+s),o=o.replace(/[?#]/g,encodeURIComponent),s=s.replace("#","%23"),`${n}${c}${o}${s}${l}`}let i=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function c(e){return l(e)}},21172:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useMergedRef",{enumerable:!0,get:function(){return o}});let n=r(12115);function o(e,t){let r=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(r.current=u(e,n)),t&&(o.current=u(t,n))},[e,t])}function u(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},29842:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"errorOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},31393:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var r={assign:function(){return l},searchParamsToUrlQuery:function(){return o},urlQueryToSearchParams:function(){return a}};for(var n in r)Object.defineProperty(t,n,{enumerable:!0,get:r[n]});function o(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function u(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function a(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,u(e));else t.set(r,u(n));return t}function l(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,n]of r.entries())e.append(t,n)}return e}},48368:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(90425).A)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},66088:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(90425).A)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},69470:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isLocalURL",{enumerable:!0,get:function(){return u}});let n=r(10857),o=r(48512);function u(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},90425:(e,t,r)=>{r.d(t,{A:()=>i});var n=r(12115);let o=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),u=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:u,className:l="",children:i,iconNode:c,...s},f)=>(0,n.createElement)("svg",{ref:f,...a,width:t,height:t,stroke:e,strokeWidth:u?24*Number(r)/Number(t):r,className:o("lucide",l),...!i&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(s)&&{"aria-hidden":"true"},...s},[...c.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(i)?i:[i]])),i=(e,t)=>{let r=(0,n.forwardRef)(({className:r,...a},i)=>(0,n.createElement)(l,{ref:i,iconNode:t,className:o(`lucide-${u(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...a}));return r.displayName=u(e),r}},94514:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(90425).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},98500:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n={default:function(){return m},useLinkStatus:function(){return v}};for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:n[o]});let u=r(66388),a=r(95155),l=u._(r(12115)),i=r(20091),c=r(22909),s=r(21172),f=r(10857),d=r(70127);r(47284);let p=r(24972),h=r(69470),y=r(77565);function g(e){return"string"==typeof e?e:(0,i.formatUrl)(e)}function m(e){var t;let n,o,u,[i,m]=(0,l.useOptimistic)(p.IDLE_LINK_STATUS),v=(0,l.useRef)(null),{href:E,as:_,children:P,prefetch:O=null,passHref:j,replace:k,shallow:C,scroll:S,onClick:w,onMouseEnter:A,onTouchStart:N,legacyBehavior:M=!1,onNavigate:R,ref:T,unstable_dynamicOnHover:x,...L}=e;n=P,M&&("string"==typeof n||"number"==typeof n)&&(n=(0,a.jsx)("a",{children:n}));let $=l.default.useContext(c.AppRouterContext),I=!1!==O,U=!1!==O?null===(t=O)||"auto"===t?y.FetchStrategy.PPR:y.FetchStrategy.Full:y.FetchStrategy.PPR,{href:F,as:D}=l.default.useMemo(()=>{let e=g(E);return{href:e,as:_?g(_):e}},[E,_]);if(M){if(n?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});o=l.default.Children.only(n)}let z=M?o&&"object"==typeof o&&o.ref:T,B=l.default.useCallback(e=>(null!==$&&(v.current=(0,p.mountLinkInstance)(e,F,$,U,I,m)),()=>{v.current&&((0,p.unmountLinkForCurrentNavigation)(v.current),v.current=null),(0,p.unmountPrefetchableInstance)(e)}),[I,F,$,U,m]),K={ref:(0,s.useMergedRef)(B,z),onClick(e){M||"function"!=typeof w||w(e),M&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(e),!$||e.defaultPrevented||function(e,t,n,o,u,a,i){{let c,{nodeName:s}=e.currentTarget;if("A"===s.toUpperCase()&&((c=e.currentTarget.getAttribute("target"))&&"_self"!==c||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which)||e.currentTarget.hasAttribute("download"))return;if(!(0,h.isLocalURL)(t)){u&&(e.preventDefault(),location.replace(t));return}if(e.preventDefault(),i){let e=!1;if(i({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:f}=r(70156);l.default.startTransition(()=>{f(n||t,u?"replace":"push",a??!0,o.current)})}}(e,F,D,v,k,S,R)},onMouseEnter(e){M||"function"!=typeof A||A(e),M&&o.props&&"function"==typeof o.props.onMouseEnter&&o.props.onMouseEnter(e),$&&I&&(0,p.onNavigationIntent)(e.currentTarget,!0===x)},onTouchStart:function(e){M||"function"!=typeof N||N(e),M&&o.props&&"function"==typeof o.props.onTouchStart&&o.props.onTouchStart(e),$&&I&&(0,p.onNavigationIntent)(e.currentTarget,!0===x)}};return(0,f.isAbsoluteUrl)(D)?K.href=D:M&&!j&&("a"!==o.type||"href"in o.props)||(K.href=(0,d.addBasePath)(D)),u=M?l.default.cloneElement(o,K):(0,a.jsx)("a",{...L,...K,children:n}),(0,a.jsx)(b.Provider,{value:i,children:u})}r(29842);let b=(0,l.createContext)(p.IDLE_LINK_STATUS),v=()=>(0,l.useContext)(b);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[44,160,165,635,706,910,1124,1131,1165,1212,1288,2036,2287,2437,2522,2772,2920,2950,3358,3390,3757,3896,3945,4048,4209,4230,4473,4503,4558,4888,4896,5177,5245,5411,5620,5684,5704,5931,6202,6306,6819,6828,6988,7330,7538,7581,7607,7646,7711,7822,7839,7851,8167,8181,8232,8616,8641,9120,9188,9303,9491,9596,9725,9861,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[44,160,165,635,706,910,1124,1131,1165,1212,1288,2036,2287,2437,2522,2772,2920,2950,3358,3390,3757,3896,3945,4048,4209,4230,4473,4503,4558,4888,4896,5177,5245,5411,5620,5684,5704,5931,6202,6306,6819,6828,6988,7330,7538,7581,7607,7646,7711,7822,7839,7851,8167,8181,8232,8372,8616,8641,9120,9188,9303,9491,9596,9725,9861,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[44,160,165,635,706,910,1124,1131,1165,1212,1288,2036,2287,2437,2522,2772,2920,2950,3358,3390,3757,3896,3945,4048,4209,4230,4473,4503,4558,4888,4896,5177,5245,5411,5620,5684,5704,5931,6202,6306,6819,6828,6988,7330,7538,7581,7607,7646,7711,7822,7839,7851,8167,8181,8232,8616,8641,9120,9188,9303,9491,9596,9725,9861,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[44,160,165,635,706,910,1124,1131,1165,1212,1288,2036,2287,2437,2522,2772,2920,2950,3358,3390,3757,3896,3945,4048,4209,4230,4473,4503,4558,4888,4896,5177,5245,5411,5620,5684,5704,5931,6202,6306,6819,6828,6988,7330,7538,7581,7607,7646,7711,7822,7839,7851,8167,8181,8232,8372,8616,8641,9120,9188,9303,9491,9596,9725,9861,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2114],{74009:(e,t,s)=>{Promise.resolve().then(s.bind(s,96485))},96485:(e,t,s)=>{"use strict";s.d(t,{default:()=>J});var r=s(95155),n=s(98500),a=s.n(n),l=s(12115),i=s(80723),o=s(49387),d=s(68459),c=s(15573),u=s(53961),m=s(61878),x=s(41585),p=s(67635),g=s(92451),f=s(73035),b=s(84755),h=s(93219),v=s(6296),j=s(52905),N=s(44478),y=s(439),k=s(84980),w=s(3926),S=s(93631),A=s(10762),C=s(97810),M=s(12651),z=s(13545),R=s(66088),T=s(35581),F=s(4235),E=s(91337),P=s(70617),$=s(2857),O=s(22356),D=s(7834),L=s(13845),I=s(3590),U=s(39498),_=s(85641),H=s(90777);function J({agentKey:e}){let{t}=(0,T.Y)(),s=t.agentsContent,n=t.panels.agents,h=(0,P.kr)(),v=(0,$.V)(),j=(0,l.useMemo)(()=>h.agents.find(t=>t.key===e),[h.agents,e]),[N,y]=(0,l.useState)(""),[k,w]=(0,l.useState)("all"),[S,A]=(0,l.useState)(null),[C,M]=(0,l.useState)(null),[z,R]=(0,l.useState)(""),[E,J]=(0,l.useState)(null),[q,B]=(0,l.useState)(!1),[X,Z]=(0,l.useState)(!1),[ee,et]=(0,l.useState)(null),[es,er]=(0,l.useState)(null),[en,ea]=(0,l.useState)(null),[el,ei]=(0,l.useState)(null),[eo,ed]=(0,l.useState)(null),[ec,eu]=(0,l.useState)(null),[em,ex]=(0,l.useState)(!1),[ep,eg]=(0,l.useState)(!1),ef=(0,l.useCallback)(async()=>{if(j?.isCustom)try{let e=await fetch("/api/agents/custom",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:j.key})});if(e.ok)F.oR.success(s.overview.customAgentRemoved(j.name)),h.refresh(),window.location.href="/agents";else{let t=await e.json();F.oR.error(t.error||s.overview.customAgentFailedRemove)}}catch{F.oR.error(s.overview.customAgentNetworkError)}finally{eg(!1)}},[j,s.overview,h]),eb=(0,l.useMemo)(()=>(0,I.qC)(h.skills,{query:N,source:k}),[h.skills,N,k]),eh=(0,l.useMemo)(()=>({total:h.skills.length,enabled:h.skills.filter(e=>e.enabled).length,builtin:h.skills.filter(e=>"builtin"===e.source).length,user:h.skills.filter(e=>"user"===e.source).length}),[h.skills]),ev=(0,l.useMemo)(()=>{let e=(0,I.HL)(h.agents),t=new Map;for(let s of e)t.set(s.serverName,s.agents);return t},[h.agents]),ej=(0,l.useMemo)(()=>{let e=(0,I.x3)(h.agents),t=new Map;for(let s of e)t.set(s.skillName,s.agents);return t},[h.agents]),eN="mindos"===e,ey=j?(0,I.yv)(j):"notFound",ek=j?.scope==="project"?"project":"global",ew=j?.transport==="http"?"http":"stdio",eS=(0,l.useMemo)(()=>j?(0,L.$k)(j,h.status,ew):{snippet:"",path:""},[j,h.status,ew]),eA=(0,l.useMemo)(()=>new Set(h.skills.map(e=>e.name)),[h.skills]),eC=(0,l.useMemo)(()=>(j?.installedSkillNames??[]).filter(e=>!eA.has(e)),[j?.installedSkillNames,eA]),eM=j?.configuredMcpServers??[],ez=(0,l.useCallback)(async(e,t)=>{A(e),J(null);try{await h.toggleSkill(e,t),await h.refresh()}finally{A(null)}},[h]),eR=(0,l.useCallback)(async e=>{J(null),A(e);try{let t=await (0,O.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"read",name:e})});M(e),R(t.content)}catch(e){J(e instanceof Error?e.message:s.detail.skillReadFailed)}finally{A(null)}},[s.detail.skillReadFailed]),eT=(0,l.useCallback)(async()=>{if(C){B(!0),J(null);try{await (0,O.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update",name:C,content:z})}),M(null),R(""),window.dispatchEvent(new Event("mindos:skills-changed")),await h.refresh()}catch(e){J(e instanceof Error?e.message:s.detail.skillSaveFailed)}finally{B(!1)}}},[C,z,s.detail.skillSaveFailed,h]),eF=(0,l.useCallback)(async e=>{er(null),A(e);try{await (0,O.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",name:e})}),ea(s.detail.skillDeleteSuccess),window.dispatchEvent(new Event("mindos:skills-changed")),await h.refresh()}catch{ea(s.detail.skillDeleteFailed)}finally{A(null),setTimeout(()=>ea(null),3e3)}},[s.detail.skillDeleteSuccess,s.detail.skillDeleteFailed,h]),eE=(0,l.useCallback)(async e=>{if(j?.skillWorkspacePath){A(e),J(null);try{(await (0,O.n)("/api/agents/copy-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({skillName:e,targetPath:j.skillWorkspacePath})})).success&&(F.oR.success(`Skill "${e}" copied to ${j.name}`),await h.refresh())}catch(t){let e=t instanceof Error?t.message:"Failed to copy skill";J(e),F.oR.error(e)}finally{A(null)}}},[j,h]),eP=(0,l.useCallback)(async()=>{await (0,D.l)(eS.snippet)&&F.oR.copy()},[eS.snippet]),e$=(0,l.useCallback)(async(e,t)=>{if(j){Z(!0),et(s.detail.mcpApplying);try{let r=await h.installAgent(j.key,{scope:e,transport:t});await h.refresh(),et(r?s.detail.mcpApplySuccess:s.detail.mcpApplyFailed)}finally{Z(!1)}}},[s.detail.mcpApplying,s.detail.mcpApplySuccess,s.detail.mcpApplyFailed,h,j]),eO=(0,l.useCallback)(async e=>{await (0,O.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",name:e})}),window.dispatchEvent(new Event("mindos:skills-changed")),await h.refresh()},[h]),eD=(0,l.useCallback)(()=>{ei(null),ed(s.detail.mcpServerHint),setTimeout(()=>ed(null),4e3)},[s.detail.mcpServerHint]);if(!j){let t=h.agents.filter(t=>t.key!==e&&"connected"===(0,I.yv)(t)).slice(0,3);return(0,r.jsxs)("div",{className:"content-width px-4 md:px-6 py-8 md:py-10",children:[(0,r.jsxs)(a(),{href:"/agents",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground mb-4",children:[(0,r.jsx)(i.A,{size:14}),s.backToOverview]}),(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:[(0,r.jsx)("p",{className:"text-sm text-foreground font-medium",children:s.detailNotFound}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:s.detailNotFoundHint}),t.length>0&&(0,r.jsxs)("div",{className:"pt-2 border-t border-border",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:s.detailNotFoundSuggestion}),(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:t.map(e=>(0,r.jsx)(a(),{href:`/agents/${encodeURIComponent(e.key)}`,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-muted text-foreground hover:bg-muted/80 transition-colors",children:e.name},e.key))})]})]})]})}return(0,r.jsxs)("div",{className:"content-width px-4 md:px-6 py-8 md:py-10 space-y-4",children:[(0,r.jsxs)(a(),{href:"/agents",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[(0,r.jsx)(i.A,{size:14}),s.backToOverview]}),(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3.5 px-5 py-4",children:[(0,r.jsx)(U.lx,{name:j.name,status:ey,size:"md"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-foreground truncate",children:j.name}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 mt-0.5 text-2xs text-muted-foreground/60",children:[(0,r.jsx)("span",{className:`font-medium px-1.5 py-px rounded-full ${"connected"===ey?"bg-muted text-muted-foreground":"detected"===ey?"bg-[var(--amber-subtle)] text-[var(--amber-text)]":"bg-error/10 text-error"}`,children:ey}),(0,r.jsx)("span",{className:"font-mono",children:j.transport??j.preferredTransport}),(0,r.jsx)("span",{className:"text-muted-foreground/25","aria-hidden":"true",children:"\xb7"}),(0,r.jsx)("span",{children:j.skillMode??s.na})]})]}),j.isCustom&&(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,r.jsx)("button",{type:"button",onClick:()=>ex(!0),className:"w-8 h-8 rounded-lg flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-muted transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":s.overview.customAgentEdit,title:s.overview.customAgentEdit,children:(0,r.jsx)(o.A,{size:14})}),(0,r.jsx)("button",{type:"button",onClick:()=>eg(!0),className:"w-8 h-8 rounded-lg flex items-center justify-center text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":s.overview.customAgentRemove,title:s.overview.customAgentRemove,children:(0,r.jsx)(d.A,{size:14})})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-2xs text-muted-foreground/50 px-5 py-2 border-t border-border/40",children:[(0,r.jsxs)("span",{children:[j.format," ",(0,r.jsx)("span",{className:"text-muted-foreground/30",children:"\xb7"})," ",W(j.runtimeLastActivityAt)]}),(0,r.jsxs)("span",{className:"tabular-nums",children:[eM.length," MCP ",(0,r.jsx)("span",{className:"text-muted-foreground/30",children:"\xb7"})," ",eC.length," skills"]})]})]}),(0,r.jsx)(G,{}),(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(c.A,{size:12,className:"text-muted-foreground/50"}),s.detail.mcpManagement]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[!eN&&(0,r.jsx)(U.rA,{onClick:()=>void eP(),disabled:!1,busy:!1,label:s.detail.mcpCopySnippet}),(0,r.jsx)(U.rA,{onClick:()=>void h.refresh(),disabled:!1,busy:!1,label:s.detail.mcpRefresh}),!eN&&(0,r.jsx)(U.rA,{onClick:()=>void e$(ek,ew),disabled:X,busy:X,label:s.detail.mcpReconnect})]})]}),ee&&(0,r.jsx)("p",{className:"text-2xs text-muted-foreground animate-in fade-in duration-200",children:ee}),(0,r.jsx)("div",{className:"flex flex-wrap gap-x-6 gap-y-1 py-2 border-y border-border/30",children:eN?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(V,{label:"Status",value:h.status?.running?"Running":"Stopped"}),(0,r.jsx)(V,{label:"Endpoint",value:h.status?.endpoint??s.na}),(0,r.jsx)(V,{label:"Tools",value:h.status?.toolCount!=null?String(h.status.toolCount):s.na})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(V,{label:s.detail.mcpInstalled,value:j.installed?s.detail.yes:s.detail.no}),(0,r.jsx)(V,{label:s.detail.mcpScope,value:j.scope??s.na}),(0,r.jsx)(V,{label:s.detail.mcpConfigPath,value:j.configPath??s.na})]})}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("p",{className:"text-2xs font-medium text-muted-foreground/60 uppercase tracking-wider",children:s.detail.configuredMcpServers}),(0,r.jsx)("span",{className:"text-2xs text-muted-foreground/40 tabular-nums",children:eM.length})]}),eo&&(0,r.jsx)("div",{role:"status","aria-live":"polite",className:"rounded-md border border-border bg-muted/50 px-3 py-2 text-xs text-muted-foreground animate-in fade-in duration-200",children:eo}),0===eM.length?(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:s.detail.configuredMcpServersEmpty}):(0,r.jsx)("div",{className:"space-y-1 max-h-[240px] overflow-y-auto",children:eM.map(e=>{let t=(ev.get(e)??[]).filter(e=>e!==j.name);return(0,r.jsxs)("div",{className:"flex items-center gap-2 rounded-md px-2 py-1.5 group/mcp hover:bg-muted/30 transition-colors duration-100",children:[(0,r.jsx)(c.A,{size:11,className:"text-muted-foreground/40 shrink-0"}),(0,r.jsx)("span",{className:"text-xs text-foreground flex-1 min-w-0 truncate",children:e}),t.length>0&&(0,r.jsxs)("div",{className:"flex items-center gap-0.5",children:[t.slice(0,3).map(e=>(0,r.jsx)(U.lx,{name:e,size:"sm"},e)),t.length>3&&(0,r.jsxs)("span",{className:"text-2xs text-muted-foreground/50",children:["+",t.length-3]})]}),(0,r.jsx)("button",{type:"button",onClick:()=>ei(e),className:"text-muted-foreground/40 hover:text-destructive cursor-pointer opacity-0 group-hover/mcp:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded p-0.5 transition-all duration-150","aria-label":`${s.detail.mcpServerRemove} ${e}`,children:(0,r.jsx)(d.A,{size:11})})]},e)})})]})]}),(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(u.A,{size:12,className:"text-muted-foreground/50"}),s.detail.skillAssignments]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5 text-2xs text-muted-foreground/50 tabular-nums",children:[(0,r.jsxs)("span",{children:[eh.enabled,"/",eh.total," enabled"]}),(0,r.jsx)("span",{className:"text-muted-foreground/25",children:"\xb7"}),(0,r.jsxs)("span",{children:[eC.length," native"]})]})]}),(0,r.jsxs)("div",{className:"flex flex-col md:flex-row gap-2",children:[(0,r.jsxs)("label",{className:"relative flex-1",children:[(0,r.jsx)(m.A,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),(0,r.jsx)("input",{value:N,onChange:e=>y(e.target.value),placeholder:s.detail.skillsSearchPlaceholder,className:"w-full h-9 rounded-md border border-border bg-background pl-8 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors duration-150"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-0.5 rounded-md border border-border p-0.5 bg-background",children:[(0,r.jsx)(U.KF,{active:"all"===k,label:s.detail.skillsFilterAll,onClick:()=>w("all")}),(0,r.jsx)(U.KF,{active:"builtin"===k,label:s.detail.skillsFilterBuiltin,onClick:()=>w("builtin")}),(0,r.jsx)(U.KF,{active:"user"===k,label:s.detail.skillsFilterUser,onClick:()=>w("user")})]})]}),en&&(0,r.jsx)("div",{role:"status","aria-live":"polite",className:"rounded-md border border-border bg-muted/50 px-3 py-2 text-xs text-muted-foreground animate-in fade-in duration-200",children:en}),j?.skillMode==="unsupported"&&(0,r.jsxs)("div",{className:"rounded-lg border border-[var(--amber)]/20 bg-[var(--amber-dim)] p-3 mb-2",children:[(0,r.jsxs)("p",{className:"text-sm font-medium text-foreground mb-2 flex items-center gap-1.5",children:[(0,r.jsx)(x.A,{size:14,className:"text-[var(--amber)] shrink-0","aria-hidden":"true"}),"Manual Skill Installation"]}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground mb-3",children:["This agent doesn't support ",(0,r.jsx)("code",{className:"bg-background px-1 py-0.5 rounded text-xs font-mono",children:"npx skills"}),". Copy skills manually:"]}),(0,r.jsxs)("div",{className:"bg-background rounded-md px-3 py-2 font-mono text-xs overflow-x-auto border border-border/50 select-all",children:["cp -r ~/.mindos/skills/<skill-name> ",j.skillWorkspacePath||"~/.agent/skills/"]})]}),eb.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-1.5",children:["MindOS Skills ",(0,r.jsxs)("span",{className:"tabular-nums",children:["(",eb.filter(e=>e.enabled).length,"/",eb.length,")"]})]}),(0,r.jsx)("ul",{className:"space-y-0.5",children:eb.map(e=>{let t=C===e.name;return(0,r.jsxs)("li",{className:"rounded-md hover:bg-muted/30 transition-colors duration-100",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 py-1.5 px-1.5 group/skill",children:[(0,r.jsx)(u.A,{size:13,className:`shrink-0 ${e.enabled?"text-[var(--amber)]":"text-muted-foreground/50"}`,"aria-hidden":"true"}),(0,r.jsx)("button",{type:"button",onClick:()=>eu(e.name),className:"text-xs text-foreground flex-1 min-w-0 truncate hover:text-[var(--amber)] cursor-pointer transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded text-left",children:e.name}),(0,r.jsx)("span",{className:`text-2xs px-1.5 py-0.5 rounded shrink-0 ${"builtin"===e.source?"bg-muted text-muted-foreground":"bg-[var(--amber-dim)] text-[var(--amber-text)]"}`,children:"builtin"===e.source?s.detail.skillsSourceBuiltin:s.detail.skillsSourceUser}),(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0 md:opacity-0 md:group-hover/skill:opacity-100 md:focus-within:opacity-100 transition-opacity duration-150",children:[(0,r.jsx)(U.rA,{onClick:()=>void ez(e.name,!e.enabled),disabled:S===e.name,busy:S===e.name,label:e.enabled?s.detail.skillDisable:s.detail.skillEnable}),e.editable&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(U.rA,{onClick:()=>void eR(e.name),disabled:S===e.name||q,busy:!1,label:s.detail.skillEdit}),(0,r.jsx)("button",{type:"button",onClick:()=>er(e.name),disabled:S===e.name,className:"inline-flex items-center justify-center min-h-[28px] px-1.5 rounded-md text-muted-foreground hover:text-destructive cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-150","aria-label":`${s.detail.skillDelete} ${e.name}`,children:(0,r.jsx)(d.A,{size:13})})]}),j?.skillMode==="unsupported"&&(0,r.jsx)("button",{type:"button",onClick:()=>void eE(e.name),disabled:S===e.name,className:"inline-flex items-center justify-center min-h-[28px] px-1.5 rounded-md text-muted-foreground hover:text-[var(--amber)] cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-150",title:`Copy ${e.name} to ${j.name}`,"aria-label":`Copy ${e.name} to ${j.name}`,children:(0,r.jsx)(p.A,{size:13})})]})]}),t&&(0,r.jsxs)("div",{className:"px-3 pb-3 pt-0 space-y-2",children:[(0,r.jsx)("textarea",{value:z,onChange:e=>R(e.target.value),className:"mt-2 w-full h-40 rounded-md border border-border bg-background px-3 py-2 text-xs font-mono text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring resize-y"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(U.rA,{onClick:()=>void eT(),disabled:q,busy:q,label:s.detail.skillSave,variant:"primary"}),(0,r.jsx)(U.rA,{onClick:()=>M(null),disabled:!1,busy:!1,label:s.detail.skillCancel})]})]})]},e.name)})})]}),0===eb.length&&0===eC.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:s.detail.noSkills}),eC.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-1.5",children:[s.detail.nativeInstalledSkills," ",(0,r.jsxs)("span",{className:"tabular-nums",children:["(",eC.length,")"]})]}),(0,r.jsx)("div",{className:"space-y-0.5 max-h-[280px] overflow-y-auto",children:eC.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>eu(e),className:"w-full flex items-center gap-2 py-1.5 px-1.5 rounded-md hover:bg-muted/30 transition-colors duration-100 cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,r.jsx)(u.A,{size:13,className:"shrink-0 text-muted-foreground/50","aria-hidden":"true"}),(0,r.jsx)("span",{className:"text-xs text-foreground flex-1 min-w-0 truncate hover:text-[var(--amber)] transition-colors duration-150",children:e})]},e))})]}),E&&(0,r.jsx)("p",{className:"text-xs text-error",children:E})]}),(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(g.A,{size:12,className:"text-muted-foreground/50"}),n.a2aCapabilities]}),(0,r.jsx)("span",{className:`text-2xs px-1.5 py-0.5 rounded font-medium shrink-0 ${"connected"===ey?"bg-[var(--success)]/15 text-[var(--success)]":"bg-muted text-muted-foreground/60"}`,children:"connected"===ey?n.a2aConnected:n.a2aUnavailable})]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-1 py-2 border-y border-border/30",children:[(0,r.jsx)(V,{label:n.a2aStatus,value:"connected"===ey?n.a2aConnected:n.a2aUnavailable}),(0,r.jsx)(V,{label:s.detail.transport,value:j.transport??j.preferredTransport}),v.agents.length>0&&(0,r.jsx)(V,{label:"Remote agents",value:String(v.agents.length)})]}),v.agents.length>0?(0,r.jsx)("div",{className:"space-y-1",children:v.agents.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1.5 hover:bg-muted/30 transition-colors duration-100",children:[(0,r.jsx)("div",{className:"w-6 h-6 rounded-md bg-muted/40 flex items-center justify-center shrink-0",children:(0,r.jsx)(g.A,{size:11,className:"text-muted-foreground/60"})}),(0,r.jsx)("span",{className:"text-xs text-foreground flex-1 min-w-0 truncate",children:e.card.name}),e.reachable?(0,r.jsx)(f.A,{size:11,className:"text-[var(--success)] shrink-0"}):(0,r.jsx)(b.A,{size:11,className:"text-muted-foreground/50 shrink-0"}),(0,r.jsxs)("span",{className:"text-2xs text-muted-foreground/50 tabular-nums shrink-0",children:[e.card.skills.length," skills"]})]},e.id))}):(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:n.a2aNoRemoteHint})]}),(0,r.jsx)(K,{agent:j,status:ey,isMindOS:eN,mcpStatus:h.status}),(0,r.jsx)(Y,{agent:j,isMindOS:eN}),(0,r.jsx)(Q,{agent:j}),(0,r.jsx)(U.TM,{open:null!==es,title:s.detail.skillDelete,message:es?s.detail.skillDeleteConfirm(es):"",confirmLabel:s.detail.skillDelete,cancelLabel:s.detail.skillCancel,onConfirm:()=>es&&void eF(es),onCancel:()=>er(null),variant:"destructive"}),(0,r.jsx)(U.TM,{open:null!==el,title:s.detail.mcpServerRemove,message:el?s.detail.mcpServerRemoveConfirm(el):"",confirmLabel:s.detail.mcpServerRemove,cancelLabel:s.detail.skillCancel,onConfirm:eD,onCancel:()=>ei(null),variant:"destructive"}),(0,r.jsx)(_.A,{open:null!==ec,skillName:ec,skill:ec?h.skills.find(e=>e.name===ec)??null:null,agentNames:ec?ej.get(ec)??[]:[],isNative:!!ec&&!h.skills.some(e=>e.name===ec),nativeSourcePath:j?.installedSkillSourcePath,copy:s.skills.skillPopover,onClose:()=>eu(null),onToggle:h.toggleSkill,onDelete:eO,onRefresh:h.refresh}),j?.isCustom&&(0,r.jsx)(H.A,{open:em,onClose:()=>ex(!1),onSuccess:()=>{h.refresh(),ex(!1)},existingAgents:h.agents,editAgent:j}),(0,r.jsx)(U.TM,{open:ep,title:j?s.overview.customAgentRemoveTitle(j.name):"",message:s.overview.customAgentRemoveMessage,confirmLabel:s.overview.customAgentRemoveConfirm,cancelLabel:s.detail.skillCancel,onConfirm:ef,onCancel:()=>eg(!1),variant:"destructive"})]})}function V({label:e,value:t}){return(0,r.jsxs)("div",{className:"flex items-baseline gap-2 px-0.5 min-w-0",children:[(0,r.jsx)("span",{className:"text-2xs text-muted-foreground/50 uppercase tracking-wider shrink-0 min-w-[60px]",children:e}),(0,r.jsx)("span",{className:"text-xs text-foreground/80 font-mono truncate min-w-0",children:t})]})}function W(e){if(!e)return"—";try{let t=Date.now()-new Date(e).getTime();if(t<0)return"just now";let s=Math.floor(t/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;let r=Math.floor(s/60);if(r<24)return`${r}h ago`;let n=Math.floor(r/24);return`${n}d ago`}catch{return e}}function K({agent:e,status:t,isMindOS:s,mcpStatus:n}){let{t:a}=(0,T.Y)(),i=a.agentsContent.detail,[o,d]=(0,l.useState)("idle"),[c,u]=(0,l.useState)(0),m=(0,l.useCallback)(async()=>{d("pinging");let e=performance.now();try{let t=await fetch("/api/mcp/status",{method:"GET",signal:AbortSignal.timeout(5e3)}),s=Math.round(performance.now()-e);u(s),d(t.ok?"ok":"fail")}catch{d("fail")}},[]);return(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(h.A,{size:12,className:"text-muted-foreground/50"}),i.runtimeDiagTitle]}),(0,r.jsx)("button",{type:"button",onClick:()=>void m(),disabled:"pinging"===o,className:"inline-flex items-center gap-1 px-2.5 py-1 text-2xs font-medium rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"pinging"===o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(v.A,{size:10,className:"animate-spin"})," ",i.runtimePinging]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.A,{size:10})," ",i.runtimePing]})})]}),"ok"===o&&(0,r.jsx)("div",{role:"status",className:"rounded-md bg-[var(--success)]/10 border border-[var(--success)]/20 px-3 py-1.5 text-2xs text-[var(--success)] font-medium animate-in fade-in duration-200",children:i.runtimePingOk(c)}),"fail"===o&&(0,r.jsx)("div",{role:"status",className:"rounded-md bg-error/10 border border-error/20 px-3 py-1.5 text-2xs text-error font-medium animate-in fade-in duration-200",children:i.runtimePingFail}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-1 py-2 border-y border-border/30",children:[(0,r.jsx)(V,{label:i.status,value:t}),(0,r.jsx)(V,{label:i.transport,value:e.transport??e.preferredTransport}),s&&n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(V,{label:i.runtimeVersion,value:n.endpoint}),(0,r.jsx)(V,{label:i.port,value:String(n.port)})]}),(0,r.jsx)(V,{label:i.lastActivityAt,value:W(e.runtimeLastActivityAt)}),void 0!==e.runtimeConversationSignal&&(0,r.jsx)(V,{label:i.conversationSignal,value:e.runtimeConversationSignal?"Active":"Inactive"}),void 0!==e.runtimeUsageSignal&&(0,r.jsx)(V,{label:i.usageSignal,value:e.runtimeUsageSignal?"Active":"Inactive"})]}),!e.runtimeLastActivityAt&&"idle"===o&&(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:i.runtimeNoData})]})}function Y({agent:e,isMindOS:t}){let{t:s}=(0,T.Y)(),n=s.agentsContent.detail,a=e.scope??(e.hasProjectScope?"project":e.hasGlobalScope?"global":"—");e.hiddenRootPresent;let l=[{label:n.envFileAccess,allowed:!0},{label:n.envNetworkAccess,allowed:"http"===e.transport||t},{label:n.envWriteAccess,allowed:!0},{label:n.envReadOnly,allowed:!1}];return(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(j.A,{size:12,className:"text-muted-foreground/50"}),n.envPermTitle]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-1 py-2 border-y border-border/30",children:[(0,r.jsx)(V,{label:n.envScope,value:a}),(0,r.jsx)(V,{label:n.format,value:e.format}),e.hiddenRootPath&&(0,r.jsx)(V,{label:n.hiddenRoot,value:e.hiddenRootPath}),(0,r.jsx)(V,{label:n.skillMode,value:e.skillMode??"—"})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"text-2xs font-medium text-muted-foreground/60 uppercase tracking-wider mb-1.5",children:n.envVars}),e.configuredMcpServers&&e.configuredMcpServers.length>0?(0,r.jsx)("p",{className:"text-2xs text-muted-foreground",children:n.envVarsCount(e.configuredMcpServers.length)}):(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:n.envVarsEmpty})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("p",{className:"text-2xs font-medium text-muted-foreground/60 uppercase tracking-wider",children:"Permissions"}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-1.5",children:l.map(({label:e,allowed:t})=>(0,r.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 bg-muted/20",children:[t?(0,r.jsx)(N.A,{size:12,className:"text-[var(--success)] shrink-0"}):(0,r.jsx)(y.A,{size:12,className:"text-muted-foreground/40 shrink-0"}),(0,r.jsx)("span",{className:"text-2xs text-foreground/80",children:e}),(0,r.jsx)("span",{className:`ml-auto text-2xs font-medium ${t?"text-[var(--success)]":"text-muted-foreground/50"}`,children:t?n.envAllowed:n.envRestricted})]},e))})]})]})}function q(e){return/search/.test(e)?"search":/read|list|get/.test(e)?"read":/create|batch_create/.test(e)?"create":/delete/.test(e)?"delete":/write|update|insert|append|edit|rename|move/.test(e)?"write":"other"}let B={read:{icon:k.A,color:"text-blue-400"},write:{icon:w.A,color:"text-[var(--amber)]"},create:{icon:S.A,color:"text-[var(--success)]"},delete:{icon:d.A,color:"text-[var(--error)]"},search:{icon:m.A,color:"text-purple-400"},other:{icon:A.A,color:"text-muted-foreground"}};function G(){let{t:e}=(0,T.Y)(),t=e.agentsContent?.detail,[s,n]=(0,l.useState)([]),[i,o]=(0,l.useState)(!0),[d,c]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=!1,t=()=>{fetch("/api/agent-activity?limit=50").then(e=>e.json()).then(t=>{e||n(t.events??[])}).catch(()=>{}).finally(()=>{e||o(!1)})};t();let s=()=>{"visible"===document.visibilityState&&t()};return document.addEventListener("visibilitychange",s),()=>{e=!0,document.removeEventListener("visibilitychange",s)}},[]);let u=(0,l.useMemo)(()=>{if(0===s.length)return null;let e=s.filter(e=>"read"===q(e.tool)).length,t=s.filter(e=>["write","create","delete"].includes(q(e.tool))).length,r=s.filter(e=>"error"===e.result).length,n=s.filter(e=>"number"==typeof e.durationMs).map(e=>e.durationMs),a=n.length>0?Math.round(n.reduce((e,t)=>e+t,0)/n.length):null,l=new Set;for(let e of s){let t=e.params.path;"string"==typeof t&&l.add(t)}let i=s.length>0?Math.round(r/s.length*100):0;return{total:s.length,reads:e,writes:t,errors:r,errorRate:i,avgMs:a,filesCount:l.size}},[s]),m=(0,l.useMemo)(()=>{let e=s.filter(e=>{let t=q(e.tool);return"write"===t||"create"===t||"delete"===t});return e.length>=3?e:s},[s]),x=d?m:m.slice(0,5),p=m.length-5;return i?(0,r.jsx)("section",{className:"rounded-xl border border-border bg-card p-4",children:(0,r.jsx)("div",{className:"flex justify-center py-6",children:(0,r.jsx)(v.A,{size:16,className:"animate-spin text-muted-foreground"})})}):0===s.length?(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(C.A,{size:12,className:"text-muted-foreground/50"}),t?.knowledgeInteraction??"Knowledge Interaction"]}),(0,r.jsxs)("div",{className:"rounded-lg border border-border/40 bg-card/30 px-4 py-6 text-center",children:[(0,r.jsx)(C.A,{size:20,className:"text-muted-foreground/30 mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:t?.knowledgeNoData??"No interactions yet. Agents will show activity here once they start working with your knowledge base."})]})]}):(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4 pb-2",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(C.A,{size:12,className:"text-muted-foreground/50"}),t?.knowledgeInteraction??"Knowledge Interaction"]}),(0,r.jsxs)(a(),{href:`/view/${(0,E.O0)(".mindos/agent-audit-log.json")}`,className:"text-2xs font-medium text-[var(--amber)] hover:opacity-80 transition-opacity",children:[t?.viewFullLog??"View log"," →"]})]}),u&&(0,r.jsxs)("div",{className:"flex items-center gap-px mx-4 mb-3 rounded-lg overflow-hidden border border-border/40",children:[(0,r.jsxs)("div",{className:"flex-1 px-3 py-2 bg-muted/20",children:[(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50 leading-none mb-1",children:t?.statTotalCalls??"Calls"}),(0,r.jsx)("p",{className:"text-sm font-semibold text-foreground font-mono tabular-nums leading-none",children:u.total})]}),(0,r.jsxs)("div",{className:"flex-1 px-3 py-2 bg-muted/20 border-l border-border/30",children:[(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50 leading-none mb-1",children:t?.statFilesTouched??"Files"}),(0,r.jsx)("p",{className:"text-sm font-semibold text-foreground font-mono tabular-nums leading-none",children:u.filesCount})]}),(0,r.jsxs)("div",{className:"flex-1 px-3 py-2 bg-muted/20 border-l border-border/30",children:[(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50 leading-none mb-1",children:t?.statReadWrite??"R / W"}),(0,r.jsxs)("p",{className:"text-sm font-semibold text-foreground font-mono tabular-nums leading-none",children:[(0,r.jsx)("span",{className:"text-blue-400",children:u.reads}),(0,r.jsx)("span",{className:"text-muted-foreground/30 mx-0.5",children:"/"}),(0,r.jsx)("span",{className:"text-[var(--amber)]",children:u.writes})]})]}),(0,r.jsxs)("div",{className:"flex-1 px-3 py-2 bg-muted/20 border-l border-border/30",children:[(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50 leading-none mb-1",children:t?.statHealth??"Health"}),(0,r.jsx)("p",{className:"text-sm font-semibold font-mono tabular-nums leading-none",children:u.errors>0?(0,r.jsxs)("span",{className:"text-[var(--error)]",children:[u.errorRate,"% err"]}):(0,r.jsx)("span",{className:"text-[var(--success)]",children:"100%"})})]})]}),(0,r.jsxs)("div",{className:"border-t border-border/40",children:[(0,r.jsx)("div",{className:"px-4 py-2 flex items-center justify-between",children:(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/40 uppercase tracking-wider",children:t?.recentOps??"Recent operations"})}),x.map((e,t)=>{let{icon:s,color:n}=B[q(e.tool)],l="string"==typeof e.params.path?e.params.path:null,i=e.tool.replace(/^mindos_/,"");return(0,r.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border/20 hover:bg-muted/20 transition-colors",children:[(0,r.jsx)("div",{className:"w-5 h-5 rounded-md bg-muted/40 flex items-center justify-center shrink-0",children:(0,r.jsx)(s,{size:11,className:n})}),(0,r.jsx)("span",{className:"text-xs font-medium text-foreground/80 font-mono shrink-0 min-w-[90px]",children:i}),l?(0,r.jsx)(a(),{href:`/view/${(0,E.O0)(l)}`,className:"text-xs text-muted-foreground hover:text-[var(--amber)] truncate min-w-0 flex-1 font-mono transition-colors",title:l,children:l}):(0,r.jsx)("span",{className:"flex-1"}),"ok"===e.result?(0,r.jsx)(M.A,{size:10,className:"shrink-0 text-[var(--success)]/40"}):(0,r.jsx)(z.A,{size:10,className:"shrink-0 text-[var(--error)]/60"}),(0,r.jsx)("span",{className:"text-2xs text-muted-foreground/30 tabular-nums shrink-0 font-mono w-[28px] text-right",title:e.ts,children:function(e){let t=Date.now()-new Date(e).getTime(),s=Math.floor(t/6e4);if(s<1)return"<1m";if(s<60)return`${s}m`;let r=Math.floor(t/36e5);return r<24?`${r}h`:`${Math.floor(t/864e5)}d`}(e.ts)})]},e.id??t)})]}),p>0&&(0,r.jsx)("div",{className:"px-4 py-2 border-t border-border/20",children:(0,r.jsxs)("button",{onClick:()=>c(e=>!e),className:"flex items-center gap-1.5 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-opacity cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded",children:[(0,r.jsx)(R.A,{size:12,className:`transition-transform duration-200 ${d?"rotate-180":""}`}),(0,r.jsx)("span",{children:d?t?.showLess??"Show less":`${p} more`})]})})]})}function Q({agent:e}){let{t}=(0,T.Y)(),s=t.agentsContent.detail,n=!!e.runtimeLastActivityAt;return(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(h.A,{size:12,className:"text-muted-foreground/50"}),s.activityTitle]}),n?(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:[(0,r.jsx)(X,{label:s.activityLastInvocation,value:W(e.runtimeLastActivityAt)}),(0,r.jsx)(X,{label:s.activityTotal,value:e.runtimeConversationSignal?"Active":"—"}),(0,r.jsx)(X,{label:s.activityLast7d,value:e.runtimeUsageSignal?"Active":"—"})]}):(0,r.jsxs)("div",{className:"rounded-lg border border-border/40 bg-card/30 px-4 py-6 text-center",children:[(0,r.jsx)(h.A,{size:20,className:"text-muted-foreground/30 mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:s.activityNoData})]})]})}function X({label:e,value:t}){return(0,r.jsxs)("div",{className:"rounded-lg border border-border/40 bg-muted/10 px-3 py-2.5",children:[(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50 uppercase tracking-wider mb-0.5",children:e}),(0,r.jsx)("p",{className:"text-sm font-medium text-foreground font-mono tabular-nums",children:t})]})}}},e=>{e.O(0,[9186,8409,7637,5581,8252,6636,7249,8441,3794,7358],()=>e(e.s=74009)),_N_E=e.O()}]);
|